From a1864c041413d37a2ff91162e9d22a5d2c0dea40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gauvain=20Boich=C3=A9?= Date: Tue, 31 Mar 2020 15:31:03 +0200 Subject: [PATCH] Augmentation vers version 3.3.0 --- docs/CHANGELOG.html | 400 +- docs/CREDITS.txt | 12 +- docs/FAQ.html | 12 +- docs/INSTALL.html | 68 +- docs/README.html | 26 +- docs/assets/css/stylesheet.css | 24 +- docs/assets/images/site_logo.svg | 6 + docs/auth_api.html | 2 +- docs/coding-guidelines.html | 32 +- docs/events.md | 119 +- docs/nginx.sample.conf | 6 +- docs/sphinx.sample.conf | 5 +- .../language/fr/viglink_module_acp.php | 2 +- .../OneNote Table Of Contents.onetoc2 | Bin 0 -> 4744 bytes .../adm/style/acp_style_settings_body.html | 1 - .../style/event/acp_overall_footer_after.html | 2 - .../event/acp_overall_header_head_append.html | 1 - .../flightdeck/adm/style/jscolor.js | 19 +- .../flightdeck/styles/style_config.json | 88 +- install/app.php | 4 +- install/convert/convertor.php | 23 +- install/phpbbcli.php | 2 +- install/startup.php | 1 + install/update/index.php | 395 + install/update/new/.htaccess | 92 + install/update/new/adm/images/alert_close.png | Bin 0 -> 2097 bytes install/update/new/adm/images/arrow_down.gif | Bin 0 -> 51 bytes install/update/new/adm/images/arrow_left.gif | Bin 0 -> 49 bytes install/update/new/adm/images/arrow_right.gif | Bin 0 -> 49 bytes install/update/new/adm/images/arrow_up.gif | Bin 0 -> 51 bytes install/update/new/adm/images/bg_button.gif | Bin 0 -> 182 bytes install/update/new/adm/images/bg_hash1.gif | Bin 0 -> 48 bytes install/update/new/adm/images/bg_hash2.gif | Bin 0 -> 48 bytes install/update/new/adm/images/bg_hash3.gif | Bin 0 -> 48 bytes install/update/new/adm/images/bg_hash4.gif | Bin 0 -> 48 bytes install/update/new/adm/images/bg_header.gif | Bin 0 -> 416 bytes install/update/new/adm/images/bg_header.jpg | Bin 0 -> 385 bytes .../update/new/adm/images/bg_tabs_alt1.gif | Bin 0 -> 1520 bytes .../update/new/adm/images/bg_tabs_alt2.gif | Bin 0 -> 420 bytes install/update/new/adm/images/cellpic3.gif | Bin 0 -> 826 bytes .../update/new/adm/images/file_conflict.gif | Bin 0 -> 344 bytes .../update/new/adm/images/file_modified.gif | Bin 0 -> 358 bytes install/update/new/adm/images/file_new.gif | Bin 0 -> 229 bytes .../new/adm/images/file_new_conflict.gif | Bin 0 -> 357 bytes .../new/adm/images/file_not_modified.gif | Bin 0 -> 570 bytes .../update/new/adm/images/file_up_to_date.gif | Bin 0 -> 357 bytes install/update/new/adm/images/gradient2b.gif | Bin 0 -> 192 bytes install/update/new/adm/images/icon_delete.gif | Bin 0 -> 255 bytes .../new/adm/images/icon_delete_disabled.gif | Bin 0 -> 249 bytes install/update/new/adm/images/icon_down.gif | Bin 0 -> 239 bytes .../new/adm/images/icon_down_disabled.gif | Bin 0 -> 166 bytes install/update/new/adm/images/icon_edit.gif | Bin 0 -> 242 bytes .../new/adm/images/icon_edit_disabled.gif | Bin 0 -> 239 bytes install/update/new/adm/images/icon_folder.gif | Bin 0 -> 662 bytes .../new/adm/images/icon_folder_link.gif | Bin 0 -> 708 bytes .../new/adm/images/icon_folder_lock.gif | Bin 0 -> 681 bytes .../update/new/adm/images/icon_subfolder.gif | Bin 0 -> 725 bytes install/update/new/adm/images/icon_sync.gif | Bin 0 -> 251 bytes .../new/adm/images/icon_sync_disabled.gif | Bin 0 -> 246 bytes install/update/new/adm/images/icon_trace.gif | Bin 0 -> 307 bytes install/update/new/adm/images/icon_up.gif | Bin 0 -> 240 bytes .../new/adm/images/icon_up_disabled.gif | Bin 0 -> 168 bytes install/update/new/adm/images/innerbox_bg.gif | Bin 0 -> 1980 bytes install/update/new/adm/images/loading.gif | Bin 0 -> 1320 bytes install/update/new/adm/images/no_avatar.gif | Bin 0 -> 930 bytes install/update/new/adm/images/no_image.png | Bin 0 -> 401 bytes install/update/new/adm/images/phpbb_logo.png | Bin 0 -> 6662 bytes install/update/new/adm/images/phpbb_logo.svg | 6 + .../update/new/adm/images/progress_bar.gif | Bin 0 -> 1353 bytes install/update/new/adm/images/spacer.gif | Bin 0 -> 807 bytes install/update/new/adm/index.php | 90 + .../update/new/adm/style/acp_attachments.html | 495 + .../adm/style/acp_avatar_options_upload.html | 11 + install/update/new/adm/style/acp_ban.html | 131 + install/update/new/adm/style/acp_contact.html | 76 + .../update/new/adm/style/acp_database.html | 90 + .../update/new/adm/style/acp_ext_actions.html | 7 + .../update/new/adm/style/acp_ext_list.html | 114 + install/update/new/adm/style/acp_forums.html | 524 + install/update/new/adm/style/acp_groups.html | 335 + .../update/new/adm/style/acp_help_phpbb.html | 67 + install/update/new/adm/style/acp_icons.html | 282 + .../update/new/adm/style/acp_language.html | 116 + install/update/new/adm/style/acp_main.html | 339 + install/update/new/adm/style/acp_modules.html | 203 + .../new/adm/style/acp_permission_roles.html | 191 + .../new/adm/style/acp_posting_buttons.html | 50 + install/update/new/adm/style/acp_ranks.html | 107 + install/update/new/adm/style/acp_search.html | 159 + install/update/new/adm/style/acp_styles.html | 178 + .../new/adm/style/acp_users_overview.html | 169 + .../update/new/adm/style/acp_users_prefs.html | 151 + .../new/adm/style/acp_users_signature.html | 52 + install/update/new/adm/style/admin.css | 2736 ++++++ install/update/new/adm/style/admin.js | 316 + install/update/new/adm/style/ajax.js | 360 + .../new/adm/style/captcha_recaptcha.html | 15 + .../new/adm/style/installer_convert.html | 87 + .../new/adm/style/installer_footer.html | 32 + .../update/new/adm/style/installer_form.html | 57 + .../new/adm/style/installer_header.html | 58 + .../new/adm/style/installer_install.html | 13 + .../update/new/adm/style/installer_main.html | 6 + .../new/adm/style/installer_update.html | 13 + .../style/installer_update_file_status.html | 80 + .../update/new/adm/style/overall_footer.html | 46 + .../update/new/adm/style/overall_header.html | 157 + .../new/adm/style/permission_forum_copy.html | 40 + .../update/new/adm/style/permission_mask.html | 152 + install/update/new/adm/style/permissions.js | 304 + .../update/new/adm/style/progress_bar.html | 40 + .../update/new/adm/style/simple_footer.html | 27 + .../update/new/adm/style/simple_header.html | 96 + .../cookieconsent/cookieconsent.min.css | 6 + .../assets/cookieconsent/cookieconsent.min.js | 1 + install/update/new/assets/javascript/core.js | 1823 ++++ .../update/new/assets/javascript/editor.js | 418 + .../update/new/assets/javascript/installer.js | 615 ++ .../new/assets/javascript/jquery-3.4.1.min.js | 2 + .../update/new/assets/javascript/plupload.js | 714 ++ install/update/new/common.php | 166 + install/update/new/composer.json | 76 + install/update/new/composer.lock | 4410 +++++++++ install/update/new/config/default/config.yml | 1 + .../config/default/container/parameters.yml | 22 + .../new/config/default/container/services.yml | 176 + .../default/container/services_attachment.yml | 40 + .../default/container/services_auth.yml | 110 + .../default/container/services_avatar.yml | 73 + .../default/container/services_captcha.yml | 59 + .../default/container/services_console.yml | 287 + .../default/container/services_content.yml | 73 + .../default/container/services_cron.yml | 248 + .../config/default/container/services_db.yml | 71 + .../default/container/services_event.yml | 26 + .../default/container/services_feed.yml | 126 + .../default/container/services_files.yml | 57 + .../default/container/services_filesystem.yml | 3 + .../default/container/services_help.yml | 27 + .../default/container/services_hook.yml | 7 + .../default/container/services_http.yml | 23 + .../default/container/services_language.yml | 22 + .../default/container/services_migrator.yml | 64 + .../container/services_mimetype_guesser.yml | 36 + .../default/container/services_module.yml | 10 + .../container/services_notification.yml | 224 + .../default/container/services_password.yml | 156 + .../config/default/container/services_php.yml | 3 + .../container/services_profilefield.yml | 102 + .../default/container/services_report.yml | 53 + .../default/container/services_routing.yml | 77 + .../container/services_text_formatter.yml | 84 + .../container/services_text_reparser.yml | 109 + .../default/container/services_twig.yml | 86 + .../config/default/container/services_ucp.yml | 17 + .../default/container/services_user.yml | 20 + .../new/config/default/container/tables.yml | 78 + .../new/config/default/routing/cron.yml | 3 + .../new/config/default/routing/feed.yml | 35 + .../new/config/default/routing/help.yml | 7 + .../new/config/default/routing/report.yml | 17 + .../new/config/default/routing/routing.yml | 32 + .../update/new/config/default/routing/ucp.yml | 7 + .../update/new/config/installer/config.yml | 2 + .../installer/container/environment.yml | 3 + .../config/installer/container/parameters.yml | 5 + .../config/installer/container/services.yml | 104 + .../container/services_file_updater.yml | 38 + .../container/services_install_console.yml | 61 + .../container/services_install_controller.yml | 73 + .../container/services_install_data.yml | 55 + .../container/services_install_database.yml | 71 + .../container/services_install_filesystem.yml | 28 + .../container/services_install_finish.yml | 44 + .../container/services_install_navigation.yml | 42 + .../services_install_obtain_data.yml | 59 + .../services_install_requirements.yml | 37 + .../container/services_installer.yml | 119 + .../container/services_update_database.yml | 40 + .../container/services_update_filesystem.yml | 72 + .../container/services_update_obtain_data.yml | 53 + .../services_update_requirements.yml | 41 + .../config/installer/routing/environment.yml | 2 + .../config/installer/routing/installer.yml | 67 + .../update/new/config/production/config.yml | 2 + .../production/container/environment.yml | 3 + .../production/container/parameters.yml | 2 + .../config/production/container/services.yml | 2 + .../config/production/routing/environment.yml | 2 + install/update/new/cron.php | 37 + install/update/new/download/file.php | 321 + .../ext/phpbb/viglink/acp/viglink_helper.php | 147 + .../new/ext/phpbb/viglink/composer.json | 27 + .../new/ext/phpbb/viglink/composer.lock | 2443 +++++ .../viglink/styles/all/theme/viglink.css | 18 + install/update/new/feed.php | 58 + .../new/includes/acp/acp_attachments.php | 1730 ++++ .../update/new/includes/acp/acp_bbcodes.php | 480 + install/update/new/includes/acp/acp_board.php | 1172 +++ .../update/new/includes/acp/acp_database.php | 616 ++ .../new/includes/acp/acp_extensions.php | 771 ++ .../update/new/includes/acp/acp_forums.php | 2211 +++++ .../new/includes/acp/acp_help_phpbb.php | 146 + install/update/new/includes/acp/acp_main.php | 707 ++ .../new/includes/acp/acp_permissions.php | 1346 +++ install/update/new/includes/acp/acp_prune.php | 588 ++ .../update/new/includes/acp/acp_reasons.php | 392 + .../update/new/includes/acp/acp_styles.php | 1396 +++ .../update/new/includes/acp/acp_update.php | 88 + install/update/new/includes/acp/acp_users.php | 2689 +++++ install/update/new/includes/acp/auth.php | 1316 +++ install/update/new/includes/bbcode.php | 707 ++ .../new/includes/compatibility_globals.php | 92 + install/update/new/includes/constants.php | 312 + install/update/new/includes/diff/engine.php | 557 ++ install/update/new/includes/functions.php | 4630 +++++++++ install/update/new/includes/functions_acp.php | 727 ++ .../update/new/includes/functions_admin.php | 3096 ++++++ .../new/includes/functions_compatibility.php | 675 ++ .../new/includes/functions_compress.php | 830 ++ .../update/new/includes/functions_content.php | 1788 ++++ .../update/new/includes/functions_convert.php | 2500 +++++ .../update/new/includes/functions_display.php | 1725 ++++ .../new/includes/functions_download.php | 782 ++ .../new/includes/functions_messenger.php | 1935 ++++ .../update/new/includes/functions_module.php | 1153 +++ .../update/new/includes/functions_posting.php | 2804 ++++++ .../new/includes/functions_privmsgs.php | 2303 +++++ .../new/includes/functions_transfer.php | 899 ++ .../update/new/includes/functions_user.php | 3757 +++++++ install/update/new/includes/mcp/mcp_ban.php | 301 + install/update/new/includes/mcp/mcp_logs.php | 230 + install/update/new/includes/mcp/mcp_main.php | 1717 ++++ install/update/new/includes/mcp/mcp_notes.php | 258 + install/update/new/includes/mcp/mcp_topic.php | 834 ++ install/update/new/includes/mcp/mcp_warn.php | 610 ++ .../update/new/includes/message_parser.php | 2087 ++++ .../includes/questionnaire/questionnaire.php | 497 + install/update/new/includes/startup.php | 86 + .../new/includes/ucp/ucp_attachments.php | 219 + .../update/new/includes/ucp/ucp_groups.php | 1142 +++ install/update/new/includes/ucp/ucp_pm.php | 442 + .../new/includes/ucp/ucp_pm_compose.php | 1562 +++ .../new/includes/ucp/ucp_pm_viewfolder.php | 611 ++ .../update/new/includes/ucp/ucp_profile.php | 847 ++ .../update/new/includes/ucp/ucp_register.php | 738 ++ .../update/new/includes/ucp/ucp_resend.php | 163 + install/update/new/includes/utf/utf_tools.php | 1469 +++ install/update/new/index.php | 252 + .../new/language/en/acp/attachments.php | 167 + install/update/new/language/en/acp/board.php | 635 ++ install/update/new/language/en/acp/common.php | 823 ++ install/update/new/language/en/acp/forums.php | 168 + .../new/language/en/acp/permissions.php | 287 + .../new/language/en/acp/permissions_phpbb.php | 215 + .../update/new/language/en/acp/posting.php | 291 + .../update/new/language/en/acp/profile.php | 176 + install/update/new/language/en/acp/styles.php | 91 + .../new/language/en/captcha_recaptcha.php | 52 + install/update/new/language/en/cli.php | 175 + install/update/new/language/en/common.php | 1453 +++ .../new/language/en/email/admin_activate.txt | 13 + .../en/email/user_forgot_password.txt | 13 + install/update/new/language/en/install.php | 598 ++ install/update/new/language/en/migrator.php | 81 + install/update/new/language/en/posting.php | 287 + install/update/new/language/en/ucp.php | 666 ++ install/update/new/mcp.php | 331 + install/update/new/memberlist.php | 1852 ++++ .../update/new/phpbb/auth/provider/apache.php | 285 + .../update/new/phpbb/auth/provider/base.php | 108 + install/update/new/phpbb/auth/provider/db.php | 259 + .../update/new/phpbb/auth/provider/ldap.php | 359 + .../new/phpbb/auth/provider/oauth/oauth.php | 859 ++ .../auth/provider/oauth/service/base.php | 59 + .../auth/provider/oauth/service/bitly.php | 107 + .../auth/provider/oauth/service/facebook.php | 107 + .../auth/provider/oauth/service/google.php | 118 + .../oauth/service/service_interface.php | 85 + .../auth/provider/oauth/service/twitter.php | 111 + .../auth/provider/oauth/token_storage.php | 620 ++ .../auth/provider/provider_interface.php | 198 + .../update/new/phpbb/avatar/driver/remote.php | 236 + .../update/new/phpbb/avatar/driver/upload.php | 332 + .../new/phpbb/cache/driver/memcached.php | 148 + .../update/new/phpbb/cache/driver/memory.php | 282 + install/update/new/phpbb/captcha/non_gd.php | 386 + .../update/new/phpbb/captcha/plugins/qa.php | 1040 ++ install/update/new/phpbb/class_loader.php | 164 + install/update/new/phpbb/config/config.php | 186 + install/update/new/phpbb/config_php_file.php | 166 + .../new/phpbb/console/command/cron/run.php | 173 + .../console/command/extension/enable.php | 78 + .../phpbb/console/command/update/check.php | 332 + .../new/phpbb/console/command/user/add.php | 334 + .../update/new/phpbb/content_visibility.php | 899 ++ .../update/new/phpbb/controller/helper.php | 195 + .../update/new/phpbb/cron/controller/cron.php | 40 + .../phpbb/cron/event/cron_runner_listener.php | 103 + install/update/new/phpbb/cron/manager.php | 164 + .../phpbb/cron/task/core/update_hashes.php | 130 + .../update/new/phpbb/cron/task/wrapper.php | 117 + install/update/new/phpbb/db/driver/driver.php | 1246 +++ .../new/phpbb/db/driver/driver_interface.php | 467 + .../update/new/phpbb/db/driver/factory.php | 459 + .../update/new/phpbb/db/driver/mssql_odbc.php | 384 + .../new/phpbb/db/driver/mssqlnative.php | 450 + install/update/new/phpbb/db/driver/mysqli.php | 492 + install/update/new/phpbb/db/driver/oracle.php | 821 ++ .../update/new/phpbb/db/driver/postgres.php | 500 + .../update/new/phpbb/db/driver/sqlite3.php | 430 + .../phpbb/db/extractor/mysql_extractor.php | 301 + .../migration/data/v30x/release_3_0_4_rc1.php | 129 + .../db/migration/data/v310/softdelete_p1.php | 211 + .../db/migration/data/v32x/timezone_p3.php | 29 + .../data/v32x/user_emoji_permission.php | 44 + .../new/phpbb/db/migration/data/v32x/v328.php | 36 + .../phpbb/db/migration/data/v32x/v328rc1.php | 37 + .../new/phpbb/db/migration/data/v32x/v329.php | 37 + .../phpbb/db/migration/data/v32x/v329rc1.php | 36 + .../add_display_unapproved_posts_config.php | 34 + .../new/phpbb/db/migration/data/v330/dev.php | 36 + .../data/v330/forums_legend_limit.php | 49 + .../db/migration/data/v330/jquery_update.php | 37 + .../data/v330/remove_attachment_flash.php | 89 + .../migration/data/v330/remove_email_hash.php | 62 + .../data/v330/remove_max_pass_chars.php | 43 + .../db/migration/data/v330/reset_password.php | 48 + .../new/phpbb/db/migration/data/v330/v330.php | 37 + .../phpbb/db/migration/data/v330/v330b1.php | 41 + .../phpbb/db/migration/data/v330/v330b2.php | 39 + .../phpbb/db/migration/data/v330/v330rc1.php | 36 + .../new/phpbb/db/migration/tool/module.php | 556 ++ install/update/new/phpbb/db/migrator.php | 1037 ++ install/update/new/phpbb/db/tools/mssql.php | 880 ++ .../update/new/phpbb/db/tools/postgres.php | 614 ++ install/update/new/phpbb/db/tools/tools.php | 1879 ++++ .../update/new/phpbb/di/container_builder.php | 678 ++ .../di/extension/container_configuration.php | 63 + .../update/new/phpbb/di/extension/core.php | 132 + .../update/new/phpbb/di/extension/tables.php | 59 + .../new/phpbb/di/service_collection.php | 122 + .../update/new/phpbb/event/md_exporter.php | 568 ++ .../phpbb/extension/extension_interface.php | 71 + .../update/new/phpbb/extension/manager.php | 591 ++ .../update/new/phpbb/feed/controller/feed.php | 410 + .../update/new/phpbb/feed/topics_active.php | 147 + install/update/new/phpbb/files/filespec.php | 584 ++ install/update/new/phpbb/filesystem.php | 21 + .../new/phpbb/filesystem/filesystem.php | 916 ++ .../phpbb/filesystem/filesystem_interface.php | 284 + install/update/new/phpbb/finder.php | 547 ++ install/update/new/phpbb/group/helper.php | 294 + .../new/phpbb/help/controller/bbcode.php | 90 + .../update/new/phpbb/help/controller/faq.php | 170 + .../new/phpbb/install/controller/helper.php | 413 + .../install/helper/container_factory.php | 191 + .../new/phpbb/install/helper/database.php | 421 + .../helper/iohandler/iohandler_interface.php | 222 + .../phpbb/install/installer_configuration.php | 146 + .../task/add_config_settings.php | 367 + .../install_database/task/create_schema.php | 227 + .../install_database/task/set_up_database.php | 157 + .../task/create_config_file.php | 243 + .../task/check_server_environment.php | 207 + .../update/new/phpbb/install/module_base.php | 213 + .../phpbb/language/language_file_loader.php | 207 + install/update/new/phpbb/lock/db.php | 153 + install/update/new/phpbb/lock/flock.php | 144 + install/update/new/phpbb/message/form.php | 175 + install/update/new/phpbb/mimetype/guesser.php | 156 + .../phpbb/notification/type/approve_post.php | 146 + .../phpbb/notification/type/approve_topic.php | 137 + .../new/phpbb/notification/type/base.php | 577 ++ .../new/phpbb/notification/type/post.php | 467 + .../new/phpbb/notification/type/topic.php | 307 + .../notification/type/type_interface.php | 218 + .../new/phpbb/passwords/driver/argon2i.php | 78 + .../new/phpbb/passwords/driver/argon2id.php | 33 + .../phpbb/passwords/driver/base_native.php | 75 + .../update/new/phpbb/passwords/manager.php | 407 + install/update/new/phpbb/permissions.php | 365 + .../update/new/phpbb/plupload/plupload.php | 417 + .../new/phpbb/report/report_handler.php | 104 + install/update/new/phpbb/request/request.php | 454 + .../new/phpbb/request/request_interface.php | 177 + .../new/phpbb/request/type_cast_helper.php | 125 + .../new/phpbb/search/fulltext_mysql.php | 1220 +++ .../new/phpbb/search/fulltext_native.php | 2068 ++++ .../new/phpbb/search/fulltext_postgres.php | 1178 +++ .../new/phpbb/search/fulltext_sphinx.php | 993 ++ install/update/new/phpbb/session.php | 1667 ++++ install/update/new/phpbb/template/asset.php | 203 + install/update/new/phpbb/template/context.php | 631 ++ .../update/new/phpbb/template/template.php | 224 + .../new/phpbb/template/twig/extension.php | 201 + .../phpbb/template/twig/extension/avatar.php | 80 + .../phpbb/template/twig/extension/config.php | 64 + .../template/twig/extension/username.php | 84 + .../update/new/phpbb/template/twig/lexer.php | 358 + .../update/new/phpbb/template/twig/loader.php | 176 + .../phpbb/template/twig/node/definenode.php | 57 + .../phpbb/template/twig/node/includeasset.php | 65 + .../phpbb/template/twig/node/includephp.php | 91 + .../twig/tokenparser/defineparser.php | 76 + .../phpbb/template/twig/tokenparser/event.php | 57 + .../template/twig/tokenparser/includecss.php | 44 + .../template/twig/tokenparser/includejs.php | 44 + .../twig/tokenparser/includeparser.php | 44 + .../template/twig/tokenparser/includephp.php | 68 + .../phpbb/template/twig/tokenparser/php.php | 65 + .../textformatter/acp_utils_interface.php | 54 + .../new/phpbb/textformatter/s9e/acp_utils.php | 67 + .../phpbb/textformatter/s9e/bbcode_merger.php | 199 + .../new/phpbb/textformatter/s9e/factory.php | 678 ++ .../phpbb/textformatter/s9e/link_helper.php | 115 + .../new/phpbb/textformatter/s9e/parser.php | 417 + .../phpbb/textformatter/s9e/quote_helper.php | 87 + .../phpbb/ucp/controller/reset_password.php | 443 + install/update/new/phpbb/user.php | 848 ++ install/update/new/phpbb/user_loader.php | 238 + install/update/new/posting.php | 2041 ++++ install/update/new/report.php | 41 + install/update/new/search.php | 1569 +++ install/update/new/styles/prosilver/style.cfg | 32 + .../styles/prosilver/template/attachment.html | 35 + .../new/styles/prosilver/template/bbcode.html | 79 + .../prosilver/template/captcha_recaptcha.html | 9 + .../new/styles/prosilver/template/forum_fn.js | 937 ++ .../prosilver/template/forumlist_body.html | 137 + .../styles/prosilver/template/mcp_forum.html | 155 + .../styles/prosilver/template/mcp_move.html | 73 + .../styles/prosilver/template/mcp_topic.html | 202 + .../prosilver/template/memberlist_body.html | 190 + .../prosilver/template/memberlist_search.html | 87 + .../prosilver/template/navbar_header.html | 212 + .../prosilver/template/overall_footer.html | 120 + .../prosilver/template/overall_header.html | 133 + .../styles/prosilver/template/plupload.html | 75 + .../template/posting_attach_body.html | 93 + .../prosilver/template/posting_buttons.html | 105 + .../prosilver/template/posting_layout.html | 65 + .../prosilver/template/posting_poll_body.html | 53 + .../prosilver/template/posting_review.html | 44 + .../template/posting_topic_review.html | 89 + .../prosilver/template/search_results.html | 244 + .../prosilver/template/simple_footer.html | 40 + .../prosilver/template/ucp_agreement.html | 72 + .../prosilver/template/ucp_attachments.html | 83 + .../template/ucp_avatar_options_upload.html | 11 + .../prosilver/template/ucp_groups_manage.html | 247 + .../prosilver/template/ucp_pm_history.html | 56 + .../template/ucp_pm_viewmessage_print.html | 57 + .../template/ucp_profile_profile_info.html | 51 + .../prosilver/template/ucp_register.html | 117 + .../template/ucp_reset_password.html | 49 + .../prosilver/template/viewforum_body.html | 315 + .../prosilver/template/viewtopic_body.html | 459 + .../prosilver/template/viewtopic_print.html | 53 + .../new/styles/prosilver/theme/colours.css | 1168 +++ .../new/styles/prosilver/theme/common.css | 1288 +++ .../new/styles/prosilver/theme/forms.css | 429 + .../new/styles/prosilver/theme/icons.css | 96 + .../prosilver/theme/images/site_logo.svg | 6 + .../new/styles/prosilver/theme/plupload.css | 90 + .../new/styles/prosilver/theme/print.css | 150 + .../new/styles/prosilver/theme/stylesheet.css | 21 + install/update/new/ucp.php | 413 + install/update/new/viewforum.php | 1064 ++ install/update/new/viewonline.php | 522 + install/update/new/viewtopic.php | 2427 +++++ install/update/old/.htaccess | 85 + install/update/old/adm/index.php | 91 + .../update/old/adm/style/acp_attachments.html | 487 + .../adm/style/acp_avatar_options_upload.html | 11 + install/update/old/adm/style/acp_ban.html | 131 + install/update/old/adm/style/acp_contact.html | 76 + .../update/old/adm/style/acp_database.html | 96 + .../update/old/adm/style/acp_ext_list.html | 123 + install/update/old/adm/style/acp_forums.html | 519 + install/update/old/adm/style/acp_groups.html | 333 + .../update/old/adm/style/acp_help_phpbb.html | 61 + install/update/old/adm/style/acp_icons.html | 282 + .../update/old/adm/style/acp_language.html | 116 + install/update/old/adm/style/acp_main.html | 312 + install/update/old/adm/style/acp_modules.html | 203 + .../old/adm/style/acp_permission_roles.html | 191 + .../old/adm/style/acp_posting_buttons.html | 71 + install/update/old/adm/style/acp_ranks.html | 107 + install/update/old/adm/style/acp_search.html | 159 + install/update/old/adm/style/acp_styles.html | 176 + .../old/adm/style/acp_users_overview.html | 169 + .../update/old/adm/style/acp_users_prefs.html | 151 + .../old/adm/style/acp_users_signature.html | 52 + install/update/old/adm/style/admin.css | 2720 ++++++ install/update/old/adm/style/admin.js | 258 + install/update/old/adm/style/ajax.js | 332 + .../old/adm/style/captcha_recaptcha.html | 14 + .../old/adm/style/installer_footer.html | 30 + .../update/old/adm/style/overall_footer.html | 46 + .../update/old/adm/style/overall_header.html | 157 + .../old/adm/style/permission_forum_copy.html | 40 + .../update/old/adm/style/permission_mask.html | 150 + install/update/old/adm/style/permissions.js | 300 + .../update/old/adm/style/progress_bar.html | 40 + .../update/old/adm/style/simple_footer.html | 27 + .../update/old/adm/style/simple_header.html | 96 + .../cookieconsent/cookieconsent.min.css | 6 + .../assets/cookieconsent/cookieconsent.min.js | 1 + install/update/old/assets/javascript/core.js | 1684 ++++ .../update/old/assets/javascript/editor.js | 425 + .../update/old/assets/javascript/plupload.js | 657 ++ install/update/old/common.php | 164 + install/update/old/composer.json | 75 + install/update/old/composer.lock | 3644 +++++++ .../config/default/container/parameters.yml | 20 + .../old/config/default/container/services.yml | 169 + .../default/container/services_auth.yml | 110 + .../default/container/services_console.yml | 295 + .../default/container/services_cron.yml | 235 + .../default/container/services_password.yml | 136 + .../default/container/services_routing.yml | 79 + .../container/services_text_formatter.yml | 79 + .../default/container/services_twig.yml | 68 + .../old/config/default/routing/routing.yml | 24 + install/update/old/cron.php | 84 + install/update/old/download/file.php | 326 + .../ext/phpbb/viglink/acp/viglink_helper.php | 146 + .../old/ext/phpbb/viglink/composer.json | 27 + .../old/ext/phpbb/viglink/composer.lock | 115 + .../viglink/styles/all/theme/viglink.css | 18 + install/update/old/feed.php | 58 + .../old/includes/acp/acp_attachments.php | 1732 ++++ .../update/old/includes/acp/acp_bbcodes.php | 620 ++ install/update/old/includes/acp/acp_board.php | 1178 +++ .../update/old/includes/acp/acp_database.php | 622 ++ .../old/includes/acp/acp_extensions.php | 665 ++ .../update/old/includes/acp/acp_forums.php | 2179 +++++ .../old/includes/acp/acp_help_phpbb.php | 143 + install/update/old/includes/acp/acp_main.php | 707 ++ .../old/includes/acp/acp_permissions.php | 1346 +++ install/update/old/includes/acp/acp_prune.php | 587 ++ .../update/old/includes/acp/acp_reasons.php | 394 + .../update/old/includes/acp/acp_styles.php | 1373 +++ .../update/old/includes/acp/acp_update.php | 86 + install/update/old/includes/acp/acp_users.php | 2692 +++++ install/update/old/includes/acp/auth.php | 1323 +++ install/update/old/includes/bbcode.php | 707 ++ .../old/includes/compatibility_globals.php | 84 + install/update/old/includes/constants.php | 316 + install/update/old/includes/diff/engine.php | 555 ++ install/update/old/includes/functions.php | 4945 ++++++++++ install/update/old/includes/functions_acp.php | 726 ++ .../update/old/includes/functions_admin.php | 3109 ++++++ .../old/includes/functions_compatibility.php | 513 + .../old/includes/functions_compress.php | 830 ++ .../update/old/includes/functions_content.php | 1805 ++++ .../update/old/includes/functions_convert.php | 2514 +++++ .../update/old/includes/functions_display.php | 1733 ++++ .../old/includes/functions_download.php | 790 ++ .../old/includes/functions_messenger.php | 1915 ++++ .../update/old/includes/functions_module.php | 1145 +++ .../update/old/includes/functions_posting.php | 2772 ++++++ .../old/includes/functions_privmsgs.php | 2264 +++++ .../old/includes/functions_transfer.php | 899 ++ .../update/old/includes/functions_user.php | 3759 +++++++ install/update/old/includes/mcp/mcp_ban.php | 301 + install/update/old/includes/mcp/mcp_logs.php | 230 + install/update/old/includes/mcp/mcp_main.php | 1701 ++++ install/update/old/includes/mcp/mcp_notes.php | 258 + install/update/old/includes/mcp/mcp_topic.php | 812 ++ install/update/old/includes/mcp/mcp_warn.php | 610 ++ .../update/old/includes/message_parser.php | 2059 ++++ .../includes/questionnaire/questionnaire.php | 501 + install/update/old/includes/startup.php | 86 + .../old/includes/ucp/ucp_attachments.php | 205 + .../update/old/includes/ucp/ucp_groups.php | 1137 +++ install/update/old/includes/ucp/ucp_pm.php | 435 + .../old/includes/ucp/ucp_pm_compose.php | 1546 +++ .../old/includes/ucp/ucp_pm_viewfolder.php | 604 ++ .../update/old/includes/ucp/ucp_profile.php | 847 ++ .../update/old/includes/ucp/ucp_register.php | 709 ++ .../update/old/includes/ucp/ucp_resend.php | 163 + install/update/old/includes/utf/utf_tools.php | 1450 +++ install/update/old/index.php | 260 + .../old/language/en/acp/attachments.php | 169 + install/update/old/language/en/acp/board.php | 631 ++ install/update/old/language/en/acp/common.php | 833 ++ install/update/old/language/en/acp/forums.php | 165 + .../old/language/en/acp/permissions.php | 287 + .../old/language/en/acp/permissions_phpbb.php | 214 + .../update/old/language/en/acp/posting.php | 291 + .../update/old/language/en/acp/profile.php | 176 + install/update/old/language/en/acp/styles.php | 90 + .../old/language/en/captcha_recaptcha.php | 52 + install/update/old/language/en/cli.php | 178 + install/update/old/language/en/common.php | 1438 +++ .../old/language/en/email/admin_activate.txt | 13 + install/update/old/language/en/install.php | 599 ++ install/update/old/language/en/migrator.php | 81 + install/update/old/language/en/posting.php | 287 + install/update/old/language/en/ucp.php | 662 ++ install/update/old/mcp.php | 326 + install/update/old/memberlist.php | 1776 ++++ .../update/old/phpbb/auth/provider/apache.php | 264 + .../update/old/phpbb/auth/provider/base.php | 108 + install/update/old/phpbb/auth/provider/db.php | 240 + .../update/old/phpbb/auth/provider/ldap.php | 348 + .../old/phpbb/auth/provider/oauth/oauth.php | 747 ++ .../auth/provider/oauth/service/base.php | 51 + .../auth/provider/oauth/service/bitly.php | 94 + .../auth/provider/oauth/service/facebook.php | 94 + .../auth/provider/oauth/service/google.php | 105 + .../oauth/service/service_interface.php | 73 + .../auth/provider/oauth/service/twitter.php | 102 + .../auth/provider/oauth/token_storage.php | 592 ++ .../auth/provider/provider_interface.php | 197 + .../update/old/phpbb/avatar/driver/remote.php | 216 + .../update/old/phpbb/avatar/driver/upload.php | 331 + .../old/phpbb/cache/driver/memcached.php | 134 + .../update/old/phpbb/cache/driver/memory.php | 282 + install/update/old/phpbb/captcha/non_gd.php | 386 + .../update/old/phpbb/captcha/plugins/qa.php | 1040 ++ install/update/old/phpbb/class_loader.php | 164 + install/update/old/phpbb/config/config.php | 167 + install/update/old/phpbb/config_php_file.php | 160 + .../old/phpbb/console/command/cron/run.php | 171 + .../console/command/extension/enable.php | 76 + .../phpbb/console/command/update/check.php | 331 + .../old/phpbb/console/command/user/add.php | 334 + .../update/old/phpbb/content_visibility.php | 885 ++ .../update/old/phpbb/controller/helper.php | 195 + install/update/old/phpbb/cron/manager.php | 147 + .../phpbb/cron/task/core/update_hashes.php | 130 + .../update/old/phpbb/cron/task/wrapper.php | 106 + install/update/old/phpbb/db/driver/driver.php | 1220 +++ .../old/phpbb/db/driver/driver_interface.php | 453 + .../update/old/phpbb/db/driver/factory.php | 443 + .../update/old/phpbb/db/driver/mssql_odbc.php | 385 + .../old/phpbb/db/driver/mssqlnative.php | 451 + install/update/old/phpbb/db/driver/mysqli.php | 490 + install/update/old/phpbb/db/driver/oracle.php | 822 ++ .../update/old/phpbb/db/driver/postgres.php | 501 + .../update/old/phpbb/db/driver/sqlite3.php | 431 + .../phpbb/db/extractor/mysql_extractor.php | 403 + .../migration/data/v30x/release_3_0_4_rc1.php | 129 + .../db/migration/data/v310/softdelete_p1.php | 211 + .../old/phpbb/db/migration/tool/module.php | 556 ++ install/update/old/phpbb/db/migrator.php | 1037 ++ install/update/old/phpbb/db/tools/mssql.php | 880 ++ .../update/old/phpbb/db/tools/postgres.php | 614 ++ install/update/old/phpbb/db/tools/tools.php | 1956 ++++ .../update/old/phpbb/di/container_builder.php | 673 ++ .../di/extension/container_configuration.php | 52 + .../update/old/phpbb/di/extension/core.php | 124 + .../old/phpbb/di/service_collection.php | 106 + .../update/old/phpbb/event/md_exporter.php | 561 ++ .../phpbb/extension/extension_interface.php | 70 + .../update/old/phpbb/extension/manager.php | 633 ++ .../update/old/phpbb/feed/controller/feed.php | 411 + .../update/old/phpbb/feed/topics_active.php | 147 + install/update/old/phpbb/files/filespec.php | 584 ++ install/update/old/phpbb/filesystem.php | 21 + .../old/phpbb/filesystem/filesystem.php | 916 ++ .../phpbb/filesystem/filesystem_interface.php | 284 + install/update/old/phpbb/finder.php | 547 ++ install/update/old/phpbb/group/helper.php | 40 + .../old/phpbb/help/controller/bbcode.php | 85 + .../update/old/phpbb/help/controller/faq.php | 165 + .../old/phpbb/install/controller/helper.php | 413 + .../install/helper/container_factory.php | 191 + .../old/phpbb/install/helper/database.php | 439 + .../helper/iohandler/iohandler_interface.php | 222 + .../phpbb/install/installer_configuration.php | 147 + .../task/add_config_settings.php | 368 + .../install_database/task/create_schema.php | 234 + .../install_database/task/set_up_database.php | 164 + .../task/create_config_file.php | 244 + .../task/check_server_environment.php | 209 + .../update/old/phpbb/install/module_base.php | 213 + .../phpbb/language/language_file_loader.php | 206 + install/update/old/phpbb/lock/db.php | 146 + install/update/old/phpbb/lock/flock.php | 141 + install/update/old/phpbb/message/form.php | 175 + install/update/old/phpbb/mimetype/guesser.php | 156 + .../phpbb/notification/type/approve_post.php | 149 + .../phpbb/notification/type/approve_topic.php | 140 + .../old/phpbb/notification/type/base.php | 577 ++ .../old/phpbb/notification/type/post.php | 467 + .../old/phpbb/notification/type/topic.php | 307 + .../notification/type/type_interface.php | 218 + .../update/old/phpbb/passwords/manager.php | 407 + install/update/old/phpbb/permissions.php | 364 + .../update/old/phpbb/plupload/plupload.php | 402 + .../old/phpbb/report/report_handler.php | 104 + install/update/old/phpbb/request/request.php | 454 + .../old/phpbb/request/request_interface.php | 177 + .../old/phpbb/request/type_cast_helper.php | 124 + .../old/phpbb/search/fulltext_mysql.php | 1227 +++ .../old/phpbb/search/fulltext_native.php | 2062 ++++ .../old/phpbb/search/fulltext_postgres.php | 1178 +++ .../old/phpbb/search/fulltext_sphinx.php | 992 ++ install/update/old/phpbb/session.php | 1650 ++++ install/update/old/phpbb/template/asset.php | 210 + install/update/old/phpbb/template/context.php | 631 ++ .../update/old/phpbb/template/template.php | 224 + .../old/phpbb/template/twig/extension.php | 185 + .../update/old/phpbb/template/twig/lexer.php | 368 + .../update/old/phpbb/template/twig/loader.php | 176 + .../phpbb/template/twig/node/definenode.php | 57 + .../phpbb/template/twig/node/includeasset.php | 71 + .../phpbb/template/twig/node/includephp.php | 91 + .../twig/tokenparser/defineparser.php | 76 + .../phpbb/template/twig/tokenparser/event.php | 44 + .../template/twig/tokenparser/includecss.php | 44 + .../template/twig/tokenparser/includejs.php | 44 + .../twig/tokenparser/includeparser.php | 44 + .../template/twig/tokenparser/includephp.php | 55 + .../phpbb/template/twig/tokenparser/php.php | 52 + .../phpbb/textformatter/s9e/bbcode_merger.php | 183 + .../old/phpbb/textformatter/s9e/factory.php | 676 ++ .../phpbb/textformatter/s9e/link_helper.php | 115 + .../old/phpbb/textformatter/s9e/parser.php | 399 + .../phpbb/textformatter/s9e/quote_helper.php | 81 + install/update/old/phpbb/user.php | 814 ++ install/update/old/phpbb/user_loader.php | 238 + install/update/old/posting.php | 1990 ++++ install/update/old/report.php | 41 + install/update/old/search.php | 1552 +++ install/update/old/styles/prosilver/style.cfg | 32 + .../styles/prosilver/template/attachment.html | 48 + .../old/styles/prosilver/template/bbcode.html | 75 + .../prosilver/template/captcha_recaptcha.html | 30 + .../old/styles/prosilver/template/forum_fn.js | 937 ++ .../prosilver/template/forumlist_body.html | 137 + .../styles/prosilver/template/mcp_forum.html | 153 + .../styles/prosilver/template/mcp_move.html | 71 + .../styles/prosilver/template/mcp_topic.html | 202 + .../prosilver/template/memberlist_body.html | 179 + .../prosilver/template/memberlist_search.html | 87 + .../prosilver/template/navbar_header.html | 210 + .../prosilver/template/overall_footer.html | 120 + .../prosilver/template/overall_header.html | 131 + .../styles/prosilver/template/plupload.html | 67 + .../template/posting_attach_body.html | 93 + .../prosilver/template/posting_buttons.html | 126 + .../prosilver/template/posting_layout.html | 86 + .../prosilver/template/posting_poll_body.html | 53 + .../prosilver/template/posting_review.html | 44 + .../template/posting_topic_review.html | 89 + .../prosilver/template/search_results.html | 242 + .../prosilver/template/simple_footer.html | 40 + .../prosilver/template/ucp_agreement.html | 73 + .../prosilver/template/ucp_attachments.html | 83 + .../template/ucp_avatar_options_upload.html | 11 + .../prosilver/template/ucp_groups_manage.html | 247 + .../prosilver/template/ucp_pm_history.html | 57 + .../template/ucp_pm_viewmessage_print.html | 50 + .../template/ucp_profile_profile_info.html | 51 + .../prosilver/template/ucp_register.html | 106 + .../prosilver/template/viewforum_body.html | 313 + .../prosilver/template/viewtopic_body.html | 452 + .../prosilver/template/viewtopic_print.html | 46 + .../old/styles/prosilver/theme/colours.css | 1163 +++ .../old/styles/prosilver/theme/common.css | 1287 +++ .../old/styles/prosilver/theme/forms.css | 429 + .../old/styles/prosilver/theme/icons.css | 96 + .../old/styles/prosilver/theme/plupload.css | 86 + .../old/styles/prosilver/theme/print.css | 150 + .../old/styles/prosilver/theme/stylesheet.css | 21 + install/update/old/ucp.php | 406 + install/update/old/viewforum.php | 1059 ++ install/update/old/viewonline.php | 517 + install/update/old/viewtopic.php | 2380 +++++ language/fr/acp/attachments.php | 2 - language/fr/acp/board.php | 74 +- language/fr/acp/common.php | 28 +- language/fr/acp/database.php | 4 +- language/fr/acp/extensions.php | 2 +- language/fr/acp/forums.php | 17 +- language/fr/acp/groups.php | 2 +- language/fr/acp/permissions.php | 2 +- language/fr/acp/permissions_phpbb.php | 1 + language/fr/acp/posting.php | 8 +- language/fr/acp/profile.php | 2 +- language/fr/acp/styles.php | 7 +- language/fr/captcha_recaptcha.php | 10 +- language/fr/cli.php | 7 +- language/fr/common.php | 25 +- language/fr/email/admin_activate.txt | 2 +- language/fr/email/newtopic_notify.txt | 2 +- language/fr/email/user_forgot_password.txt | 13 + language/fr/help/faq.php | 4 +- language/fr/install.php | 25 +- language/fr/migrator.php | 2 +- language/fr/posting.php | 20 +- language/fr/ucp.php | 22 +- styles/Milk_v2/style.cfg | 6 +- styles/Milk_v2/template/forum_fn.js | 11 +- styles/Milk_v2/template/forumlist_body.html | 28 +- styles/Milk_v2/template/forumlist_grid.html | 103 +- styles/Milk_v2/template/navbar_header.html | 3 +- styles/Milk_v2/template/overall_footer.html | 116 +- styles/Milk_v2/template/overall_header.html | 51 +- .../template/overall_header_simplified.html | 6 +- styles/Milk_v2/template/parallax.js | 68 +- styles/Milk_v2/template/particles.app.js | 21 +- styles/Milk_v2/template/search_results.html | 2 +- styles/Milk_v2/template/viewforum_body.html | 11 +- styles/Milk_v2/template/viewtopic_body.html | 29 +- styles/Milk_v2/theme/blank.css | 3 + styles/Milk_v2/theme/buttons.css | 5 + styles/Milk_v2/theme/colour-presets/Aqua.css | 12 +- .../theme/colour-presets/Blue_Lagoon.css | 9 +- styles/Milk_v2/theme/colour-presets/Blush.css | 9 +- .../theme/colour-presets/Calm_Darya.css | 10 +- .../theme/colour-presets/Electric_Violet.css | 6 +- .../Milk_v2/theme/colour-presets/HoneyDew.css | 10 +- .../Milk_v2/theme/colour-presets/Hot_Red.css | 10 +- .../theme/colour-presets/Ibiza_Sunset.css | 10 +- .../theme/colour-presets/Little_Leaf.css | 10 +- .../theme/colour-presets/Neon_Blue.css | 9 +- .../theme/colour-presets/Nighthawk.css | 11 +- .../theme/colour-presets/Pacific_Dream.css | 9 +- styles/Milk_v2/theme/colour-presets/Peach.css | 10 +- .../theme/colour-presets/Purple_Love.css | 9 +- .../theme/colour-presets/Rose_Water.css | 11 +- .../Milk_v2/theme/colour-presets/Sahara.css | 10 +- .../Milk_v2/theme/colour-presets/Titanium.css | 10 +- .../theme/colour-presets/Warm_Sunset.css | 11 +- .../Milk_v2/theme/colour-presets/default.css | 9 +- styles/Milk_v2/theme/colours.css | 21 +- styles/Milk_v2/theme/colours_dark.css | 50 +- styles/Milk_v2/theme/common.css | 32 +- styles/Milk_v2/theme/content.css | 23 +- styles/Milk_v2/theme/fonts.css | 21 +- styles/Milk_v2/theme/forms.css | 2 +- styles/Milk_v2/theme/icons.css | 2 +- styles/Milk_v2/theme/icons_forums_topics.css | 209 +- styles/Milk_v2/theme/images/comment.png | Bin 0 -> 5558 bytes styles/Milk_v2/theme/images/hex.png | Bin 0 -> 78712 bytes styles/Milk_v2/theme/merlin.css | 118 +- styles/Milk_v2/theme/milk.css | 37 +- styles/Milk_v2/theme/print.css | 2 +- .../theme/responsive/large-desktops.css | 131 +- .../Milk_v2/theme/responsive/medium-ipad.css | 173 +- styles/Milk_v2/theme/rounded.css | 87 + styles/Milk_v2/theme/stylesheet.css | 40 + vendor/autoload.php | 2 +- vendor/composer/autoload_classmap.php | 889 +- vendor/composer/autoload_files.php | 11 +- vendor/composer/autoload_psr4.php | 16 +- vendor/composer/autoload_real.php | 14 +- vendor/composer/autoload_static.php | 974 +- vendor/composer/installed.json | 1386 ++- .../.github/ISSUE_TEMPLATE/bug_report.md | 28 + vendor/google/recaptcha/ARCHITECTURE.md | 64 + vendor/google/recaptcha/LICENSE | 46 +- vendor/google/recaptcha/app.yaml | 8 + vendor/google/recaptcha/composer.json | 21 +- .../recaptcha/src/ReCaptcha/ReCaptcha.php | 234 +- .../recaptcha/src/ReCaptcha/RequestMethod.php | 42 +- .../src/ReCaptcha/RequestMethod/Curl.php | 42 +- .../src/ReCaptcha/RequestMethod/CurlPost.php | 78 +- .../src/ReCaptcha/RequestMethod/Post.php | 76 +- .../src/ReCaptcha/RequestMethod/Socket.php | 55 +- .../ReCaptcha/RequestMethod/SocketPost.php | 89 +- .../src/ReCaptcha/RequestParameters.php | 46 +- .../recaptcha/src/ReCaptcha/Response.php | 162 +- vendor/google/recaptcha/src/autoload.php | 41 +- vendor/guzzlehttp/guzzle/.php_cs | 23 + vendor/guzzlehttp/guzzle/Dockerfile | 18 + vendor/guzzlehttp/guzzle/LICENSE | 2 +- vendor/guzzlehttp/guzzle/composer.json | 43 +- vendor/guzzlehttp/guzzle/src/Client.php | 707 +- .../guzzlehttp/guzzle/src/ClientInterface.php | 187 +- .../guzzle/src/Cookie/CookieJar.php | 130 +- .../guzzle/src/Cookie/CookieJarInterface.php | 27 +- .../guzzle/src/Cookie/FileCookieJar.php | 29 +- .../guzzle/src/Cookie/SessionCookieJar.php | 26 +- .../guzzle/src/Cookie/SetCookie.php | 66 +- .../src/Exception/BadResponseException.php | 22 +- .../guzzle/src/Exception/ClientException.php | 4 +- .../guzzle/src/Exception/ConnectException.php | 35 +- .../guzzle/src/Exception/GuzzleException.php | 23 + .../Exception/InvalidArgumentException.php | 7 + .../guzzle/src/Exception/RequestException.php | 129 +- .../guzzle/src/Exception/SeekException.php | 27 + .../guzzle/src/Exception/ServerException.php | 4 +- .../Exception/TooManyRedirectsException.php | 4 +- .../src/Exception/TransferException.php | 4 +- .../guzzle/src/Handler/CurlFactory.php | 585 ++ .../src/Handler/CurlFactoryInterface.php | 27 + .../guzzle/src/Handler/CurlHandler.php | 45 + .../guzzle/src/Handler/CurlMultiHandler.php | 219 + .../guzzle/src/Handler/EasyHandle.php | 92 + .../guzzle/src/Handler/MockHandler.php | 195 + .../guzzlehttp/guzzle/src/Handler/Proxy.php | 55 + .../guzzle/src/Handler/StreamHandler.php | 544 ++ vendor/guzzlehttp/guzzle/src/HandlerStack.php | 277 + .../guzzle/src/MessageFormatter.php | 185 + vendor/guzzlehttp/guzzle/src/Middleware.php | 254 + vendor/guzzlehttp/guzzle/src/Pool.php | 373 +- .../guzzle/src/PrepareBodyMiddleware.php | 111 + .../guzzle/src/RedirectMiddleware.php | 255 + .../guzzlehttp/guzzle/src/RequestOptions.php | 263 + .../guzzlehttp/guzzle/src/RetryMiddleware.php | 128 + .../guzzlehttp/guzzle/src/TransferStats.php | 126 + vendor/guzzlehttp/guzzle/src/UriTemplate.php | 58 +- vendor/guzzlehttp/guzzle/src/functions.php | 394 + .../guzzle/src/functions_include.php | 6 + vendor/guzzlehttp/promises/CHANGELOG.md | 65 + vendor/guzzlehttp/promises/LICENSE | 19 + vendor/guzzlehttp/promises/Makefile | 13 + vendor/guzzlehttp/promises/README.md | 504 + vendor/guzzlehttp/promises/composer.json | 34 + .../promises/src/AggregateException.php | 16 + .../promises/src/CancellationException.php | 9 + vendor/guzzlehttp/promises/src/Coroutine.php | 151 + .../guzzlehttp/promises/src/EachPromise.php | 229 + .../promises/src/FulfilledPromise.php | 82 + vendor/guzzlehttp/promises/src/Promise.php | 280 + .../promises/src/PromiseInterface.php | 93 + .../promises/src/PromisorInterface.php | 15 + .../promises/src/RejectedPromise.php | 87 + .../promises/src/RejectionException.php | 47 + vendor/guzzlehttp/promises/src/TaskQueue.php | 66 + .../promises/src/TaskQueueInterface.php | 25 + vendor/guzzlehttp/promises/src/functions.php | 457 + .../promises/src/functions_include.php | 6 + vendor/guzzlehttp/psr7/CHANGELOG.md | 246 + vendor/guzzlehttp/psr7/LICENSE | 19 + vendor/guzzlehttp/psr7/README.md | 745 ++ vendor/guzzlehttp/psr7/composer.json | 49 + vendor/guzzlehttp/psr7/src/AppendStream.php | 241 + vendor/guzzlehttp/psr7/src/BufferStream.php | 137 + vendor/guzzlehttp/psr7/src/CachingStream.php | 138 + vendor/guzzlehttp/psr7/src/DroppingStream.php | 42 + vendor/guzzlehttp/psr7/src/FnStream.php | 158 + vendor/guzzlehttp/psr7/src/InflateStream.php | 52 + vendor/guzzlehttp/psr7/src/LazyOpenStream.php | 39 + vendor/guzzlehttp/psr7/src/LimitStream.php | 155 + vendor/guzzlehttp/psr7/src/MessageTrait.php | 213 + .../guzzlehttp/psr7/src/MultipartStream.php | 153 + vendor/guzzlehttp/psr7/src/NoSeekStream.php | 22 + vendor/guzzlehttp/psr7/src/PumpStream.php | 165 + vendor/guzzlehttp/psr7/src/Request.php | 151 + vendor/guzzlehttp/psr7/src/Response.php | 154 + vendor/guzzlehttp/psr7/src/Rfc7230.php | 18 + vendor/guzzlehttp/psr7/src/ServerRequest.php | 376 + vendor/guzzlehttp/psr7/src/Stream.php | 267 + .../psr7/src/StreamDecoratorTrait.php | 149 + vendor/guzzlehttp/psr7/src/StreamWrapper.php | 161 + vendor/guzzlehttp/psr7/src/UploadedFile.php | 316 + vendor/guzzlehttp/psr7/src/Uri.php | 760 ++ vendor/guzzlehttp/psr7/src/UriNormalizer.php | 216 + vendor/guzzlehttp/psr7/src/UriResolver.php | 219 + vendor/guzzlehttp/psr7/src/functions.php | 899 ++ .../guzzlehttp/psr7/src/functions_include.php | 6 + vendor/marc1706/fast-image-size/composer.json | 12 +- vendor/marc1706/fast-image-size/composer.lock | 283 +- .../fast-image-size/lib/FastImageSize.php | 75 +- .../fast-image-size/lib/Type/TypeJpeg.php | 13 +- .../fast-image-size/lib/Type/TypeTif.php | 20 +- vendor/ocramius/package-versions/CHANGELOG.md | 120 + .../ocramius/package-versions/CONTRIBUTING.md | 39 + vendor/ocramius/package-versions/LICENSE | 19 + vendor/ocramius/package-versions/README.md | 60 + .../ocramius/package-versions/composer.json | 43 + .../ocramius/package-versions/composer.lock | 2869 ++++++ .../package-versions/infection.json.dist | 11 + .../ocramius/package-versions/phpcs.xml.dist | 21 + .../src/PackageVersions/FallbackVersions.php | 121 + .../src/PackageVersions/Installer.php | 201 + .../src/PackageVersions/Versions.php | 116 + vendor/ocramius/proxy-manager/CHANGELOG.md | 375 + vendor/ocramius/proxy-manager/README.md | 17 +- vendor/ocramius/proxy-manager/STABILITY.md | 20 +- vendor/ocramius/proxy-manager/UPGRADE.md | 33 + vendor/ocramius/proxy-manager/composer.json | 29 +- .../doc-template/css/highlight.dark.css | 125 + .../proxy-manager/doc-template/css/main.css | 179 + .../proxy-manager/doc-template/default.twig | 117 + .../proxy-manager/doc-template/favicon.ico | Bin 0 -> 173246 bytes .../proxy-manager/doc-template/img/block.png | Bin 0 -> 2373 bytes .../proxy-manager/doc-template/img/enf.png | Bin 0 -> 3738 bytes .../access-interceptor-scope-localizer.md | 14 +- .../docs/access-interceptor-value-holder.md | 27 +- .../ocramius/proxy-manager/docs/copyright.md | 15 + vendor/ocramius/proxy-manager/docs/credits.md | 26 + .../ocramius/proxy-manager/docs/download.md | 11 + .../docs/generator-strategies.md | 6 +- .../docs/lazy-loading-ghost-object.md | 306 +- .../docs/lazy-loading-value-holder.md | 23 +- .../proxy-manager/docs/null-object.md | 28 +- .../proxy-manager/docs/remote-object.md | 15 +- .../docs/tuning-for-production.md | 4 + .../ProxyManager/Autoloader/Autoloader.php | 6 +- .../Autoloader/AutoloaderInterface.php | 4 +- .../src/ProxyManager/Configuration.php | 109 +- .../Exception/DisabledMethodException.php | 11 +- .../Exception/ExceptionInterface.php | 2 + .../Exception/FileNotWritableException.php | 28 +- .../InvalidProxiedClassException.php | 27 +- .../InvalidProxyDirectoryException.php | 11 +- .../UnsupportedProxiedClassException.php | 9 +- .../Factory/AbstractBaseFactory.php | 63 +- ...AccessInterceptorScopeLocalizerFactory.php | 23 +- .../AccessInterceptorValueHolderFactory.php | 23 +- .../Factory/LazyLoadingGhostFactory.php | 65 +- .../Factory/LazyLoadingValueHolderFactory.php | 20 +- .../Factory/NullObjectFactory.php | 18 +- .../RemoteObject/Adapter/BaseAdapter.php | 12 +- .../Factory/RemoteObject/Adapter/JsonRpc.php | 4 +- .../Factory/RemoteObject/Adapter/Soap.php | 6 +- .../Factory/RemoteObject/Adapter/XmlRpc.php | 4 +- .../Factory/RemoteObject/AdapterInterface.php | 4 +- .../Factory/RemoteObjectFactory.php | 23 +- .../ProxyManager/FileLocator/FileLocator.php | 12 +- .../FileLocator/FileLocatorInterface.php | 4 +- .../ProxyManager/Generator/ClassGenerator.php | 6 +- .../Generator/MagicMethodGenerator.php | 4 +- .../Generator/MethodGenerator.php | 125 +- .../Generator/Util/ClassGeneratorUtils.php | 13 +- .../Util/ProxiedMethodReturnExpression.php | 41 + .../Util/UniqueIdentifierGenerator.php | 4 +- .../BaseGeneratorStrategy.php | 4 +- .../EvaluatingGeneratorStrategy.php | 13 +- .../FileWriterGeneratorStrategy.php | 24 +- .../GeneratorStrategyInterface.php | 4 +- .../Inflector/ClassNameInflector.php | 12 +- .../Inflector/ClassNameInflectorInterface.php | 8 +- .../Inflector/Util/ParameterEncoder.php | 4 +- .../Inflector/Util/ParameterHasher.php | 4 +- .../Proxy/AccessInterceptorInterface.php | 10 +- .../AccessInterceptorValueHolderInterface.php | 31 + .../Proxy/Exception/RemoteObjectException.php | 2 + .../Proxy/FallbackValueHolderInterface.php | 2 + .../Proxy/GhostObjectInterface.php | 2 + .../Proxy/LazyLoadingInterface.php | 8 +- .../Proxy/NullObjectInterface.php | 2 + .../src/ProxyManager/Proxy/ProxyInterface.php | 2 + .../Proxy/RemoteObjectInterface.php | 2 + .../Proxy/SmartReferenceInterface.php | 2 + .../Proxy/ValueHolderInterface.php | 2 + .../Proxy/VirtualProxyInterface.php | 2 + .../MethodGenerator/MagicWakeup.php | 20 +- .../SetMethodPrefixInterceptor.php | 15 +- .../SetMethodSuffixInterceptor.php | 15 +- .../MethodPrefixInterceptors.php | 8 +- .../MethodSuffixInterceptors.php | 8 +- .../MethodGenerator/BindProxyProperties.php | 89 + .../MethodGenerator/InterceptedMethod.php | 29 +- .../MethodGenerator/MagicClone.php | 24 +- .../MethodGenerator/MagicGet.php | 35 +- .../MethodGenerator/MagicIsset.php | 35 +- .../MethodGenerator/MagicSet.php | 35 +- .../MethodGenerator/MagicSleep.php | 28 +- .../MethodGenerator/MagicUnset.php | 35 +- .../StaticProxyConstructor.php | 76 + .../Util/InterceptorGenerator.php | 36 +- ...cessInterceptorScopeLocalizerGenerator.php | 46 +- .../MethodGenerator/InterceptedMethod.php | 31 +- .../MethodGenerator/MagicClone.php | 9 +- .../MethodGenerator/MagicGet.php | 37 +- .../MethodGenerator/MagicIsset.php | 36 +- .../MethodGenerator/MagicSet.php | 36 +- .../MethodGenerator/MagicUnset.php | 36 +- .../StaticProxyConstructor.php | 88 + .../Util/InterceptorGenerator.php | 42 +- .../AccessInterceptorValueHolderGenerator.php | 52 +- .../Assertion/CanProxyAssertion.php | 12 +- .../StaticProxyConstructor.php | 61 + .../MethodGenerator/CallInitializer.php | 168 +- .../MethodGenerator/GetProxyInitializer.php | 8 +- .../MethodGenerator/InitializeProxy.php | 12 +- .../MethodGenerator/IsProxyInitialized.php | 9 +- .../MethodGenerator/MagicClone.php | 8 +- .../MethodGenerator/MagicGet.php | 130 +- .../MethodGenerator/MagicIsset.php | 117 +- .../MethodGenerator/MagicSet.php | 117 +- .../MethodGenerator/MagicSleep.php | 8 +- .../MethodGenerator/MagicUnset.php | 125 +- .../MethodGenerator/SetProxyInitializer.php | 22 +- .../InitializationTracker.php | 6 +- .../PropertyGenerator/InitializerProperty.php | 6 +- .../PrivatePropertiesMap.php | 75 + .../ProtectedPropertiesMap.php | 74 + .../LazyLoadingGhostGenerator.php | 121 +- .../MethodGenerator/GetProxyInitializer.php | 8 +- .../MethodGenerator/InitializeProxy.php | 10 +- .../MethodGenerator/IsProxyInitialized.php | 9 +- .../LazyLoadingMethodInterceptor.php | 24 +- .../MethodGenerator/MagicClone.php | 6 + .../MethodGenerator/MagicGet.php | 49 +- .../MethodGenerator/MagicIsset.php | 16 +- .../MethodGenerator/MagicSet.php | 33 +- .../MethodGenerator/MagicSleep.php | 6 + .../MethodGenerator/MagicUnset.php | 31 +- .../MethodGenerator/SetProxyInitializer.php | 13 +- .../PropertyGenerator/InitializerProperty.php | 6 +- .../PropertyGenerator/ValueHolderProperty.php | 6 +- .../LazyLoadingValueHolderGenerator.php | 44 +- .../NullObjectMethodInterceptor.php | 18 +- .../StaticProxyConstructor.php | 63 + .../ProxyGenerator/NullObjectGenerator.php | 21 +- .../PropertyGenerator/PublicPropertiesMap.php | 21 +- .../ProxyGeneratorInterface.php | 2 + .../RemoteObject/MethodGenerator/MagicGet.php | 10 +- .../MethodGenerator/MagicIsset.php | 10 +- .../RemoteObject/MethodGenerator/MagicSet.php | 10 +- .../MethodGenerator/MagicUnset.php | 10 +- .../MethodGenerator/RemoteObjectMethod.php | 25 +- .../StaticProxyConstructor.php | 67 + .../PropertyGenerator/AdapterProperty.php | 7 +- .../ProxyGenerator/RemoteObjectGenerator.php | 21 +- .../ProxyGenerator/Util/GetMethodIfExists.php | 42 + .../ProxyGenerator/Util/Properties.php | 166 + .../Util/ProxiedMethodsFilter.php | 68 +- .../Util/PublicScopeSimulator.php | 53 +- .../Util/UnsetPropertiesGenerator.php | 110 + .../MethodGenerator/Constructor.php | 123 + .../GetWrappedValueHolderValue.php | 8 +- .../MethodGenerator/MagicSleep.php | 5 + .../Signature/ClassSignatureGenerator.php | 6 +- .../ClassSignatureGeneratorInterface.php | 4 +- .../Exception/ExceptionInterface.php | 2 + .../Exception/InvalidSignatureException.php | 10 +- .../Exception/MissingSignatureException.php | 4 +- .../Signature/SignatureChecker.php | 4 +- .../Signature/SignatureCheckerInterface.php | 2 + .../Signature/SignatureGenerator.php | 6 +- .../Signature/SignatureGeneratorInterface.php | 6 +- .../src/ProxyManager/Stub/EmptyClassStub.php | 31 + .../src/ProxyManager/Version.php | 19 +- vendor/paragonie/random_compat/composer.json | 63 +- vendor/paragonie/random_compat/lib/random.php | 223 +- vendor/paragonie/random_compat/psalm.xml | 4 + vendor/patchwork/utf8/appveyor.yml | 7 +- vendor/patchwork/utf8/composer.json | 3 + .../Patchwork/PHP/Shim/charset/translit.ser | 2 +- .../PHP/Shim/unidata/combiningClass.ser | 2 +- .../unidata/compatibilityDecomposition.ser | 2 +- .../Patchwork/PHP/Shim/unidata/lowerCase.ser | 2 +- .../Patchwork/PHP/Shim/unidata/upperCase.ser | 2 +- .../utf8/src/Patchwork/Utf8/Bootup.php | 2 +- .../src/Patchwork/Utf8/Bootup/mbstring.php | 2 +- vendor/psr/container/.gitignore | 3 + vendor/psr/container/LICENSE | 21 + vendor/psr/container/README.md | 5 + vendor/psr/container/composer.json | 27 + .../src/ContainerExceptionInterface.php | 13 + .../psr/container/src/ContainerInterface.php | 37 + .../src/NotFoundExceptionInterface.php | 13 + vendor/psr/http-message/CHANGELOG.md | 36 + vendor/psr/http-message/LICENSE | 19 + vendor/psr/http-message/README.md | 13 + vendor/psr/http-message/composer.json | 26 + .../psr/http-message/src/MessageInterface.php | 187 + .../psr/http-message/src/RequestInterface.php | 129 + .../http-message/src/ResponseInterface.php | 68 + .../src/ServerRequestInterface.php | 261 + .../psr/http-message/src/StreamInterface.php | 158 + .../src/UploadedFileInterface.php | 123 + vendor/psr/http-message/src/UriInterface.php | 323 + vendor/psr/log/Psr/Log/LoggerInterface.php | 2 + vendor/psr/log/Psr/Log/LoggerTrait.php | 2 + vendor/psr/log/Psr/Log/NullLogger.php | 2 + vendor/psr/log/composer.json | 2 +- vendor/ralouphie/getallheaders/LICENSE | 21 + vendor/ralouphie/getallheaders/README.md | 27 + vendor/ralouphie/getallheaders/composer.json | 26 + .../getallheaders/src/getallheaders.php | 46 + vendor/s9e/regexp-builder/LICENSE | 20 + vendor/s9e/regexp-builder/composer.json | 25 + vendor/s9e/regexp-builder/src/Builder.php | 167 + vendor/s9e/regexp-builder/src/Escaper.php | 59 + .../src/Input/BaseImplementation.php | 23 + vendor/s9e/regexp-builder/src/Input/Bytes.php | 24 + .../src/Input/InputInterface.php | 24 + vendor/s9e/regexp-builder/src/Input/Utf8.php | 101 + .../s9e/regexp-builder/src/MetaCharacters.php | 222 + .../src/Output/BaseImplementation.php | 62 + .../s9e/regexp-builder/src/Output/Bytes.php | 22 + .../regexp-builder/src/Output/JavaScript.php | 24 + .../src/Output/OutputInterface.php | 19 + vendor/s9e/regexp-builder/src/Output/PHP.php | 22 + .../src/Output/PrintableAscii.php | 74 + vendor/s9e/regexp-builder/src/Output/Utf8.php | 54 + .../src/Passes/AbstractPass.php | 148 + .../src/Passes/CoalesceOptionalStrings.php | 138 + .../Passes/CoalesceSingleCharacterPrefix.php | 81 + .../src/Passes/GroupSingleCharacters.php | 42 + .../regexp-builder/src/Passes/MergePrefix.php | 104 + .../regexp-builder/src/Passes/MergeSuffix.php | 83 + .../src/Passes/PassInterface.php | 19 + .../src/Passes/PromoteSingleStrings.php | 47 + .../s9e/regexp-builder/src/Passes/Recurse.php | 58 + vendor/s9e/regexp-builder/src/Runner.php | 45 + vendor/s9e/regexp-builder/src/Serializer.php | 279 + vendor/s9e/text-formatter/composer.json | 15 +- vendor/s9e/text-formatter/src/Bundle.php | 113 +- .../text-formatter/src/Bundles/Fatdown.php | 105 +- .../src/Bundles/Fatdown/Renderer.php | 21 +- .../s9e/text-formatter/src/Bundles/Forum.php | 349 +- .../src/Bundles/Forum/Renderer.php | 21 +- .../text-formatter/src/Bundles/MediaPack.php | 101 +- .../src/Bundles/MediaPack/Renderer.php | 19 +- .../s9e/text-formatter/src/Configurator.php | 8652 +---------------- .../src/Configurator/Bundle.php | 26 +- .../src/Configurator/BundleGenerator.php | 250 + .../src/Configurator/Bundles/Fatdown.php | 41 +- .../src/Configurator/Bundles/Forum.php | 17 +- .../src/Configurator/Bundles/MediaPack.php | 12 +- .../Collections/AttributeCollection.php | 60 + .../Collections/AttributeFilterChain.php | 35 + .../Collections/AttributeFilterCollection.php | 108 + .../Collections/AttributeList.php | 23 +- .../AttributePreprocessorCollection.php | 110 + .../Configurator/Collections/Collection.php | 93 + .../Configurator/Collections/FilterChain.php | 95 + .../Configurator/Collections/HostnameList.php | 96 + .../Configurator/Collections/MinifierList.php | 42 +- .../Collections/NormalizedCollection.php | 262 + .../Collections/NormalizedList.php | 162 + .../Collections/PluginCollection.php | 149 + .../Collections/RulesGeneratorList.php | 42 + .../src/Configurator/Collections/Ruleset.php | 310 + .../Configurator/Collections/SchemeList.php | 43 + .../Collections/TagCollection.php | 60 + .../Collections/TagFilterChain.php | 19 + .../src/Configurator/Collections/TagList.php | 22 +- .../Collections/TemplateCheckList.php | 30 + .../Collections/TemplateNormalizationList.php | 37 + .../TemplateParameterCollection.php | 35 + .../src/Configurator/ConfigProvider.php | 21 + .../Exceptions/UnsafeTemplateException.php | 33 +- .../Configurator/FilterableConfigValue.php | 19 + .../src/Configurator/Helpers/AVTHelper.php | 119 + .../src/Configurator/Helpers/ConfigHelper.php | 186 + .../Configurator/Helpers/ContextSafeness.php | 43 +- .../Configurator/Helpers/ElementInspector.php | 399 + .../src/Configurator/Helpers/FilterHelper.php | 70 + .../Helpers/FilterSyntaxMatcher.php | 248 + .../src/Configurator/Helpers/NodeLocator.php | 205 + .../Configurator/Helpers/RegexpBuilder.php | 49 + .../src/Configurator/Helpers/RegexpParser.php | 273 +- .../src/Configurator/Helpers/RulesHelper.php | 257 + .../Configurator/Helpers/TemplateHelper.php | 200 + .../Helpers/TemplateInspector.php | 713 ++ .../Configurator/Helpers/TemplateLoader.php | 188 + .../Configurator/Helpers/TemplateModifier.php | 98 +- .../Configurator/Helpers/TemplateParser.php | 39 + .../Helpers/TemplateParser/IRProcessor.php | 74 + .../Helpers/TemplateParser/Normalizer.php | 282 + .../Helpers/TemplateParser/Optimizer.php | 244 + .../Helpers/TemplateParser/Parser.php | 381 + .../src/Configurator/Helpers/XPathHelper.php | 264 + .../src/Configurator/Items/Attribute.php | 92 + .../Configurator/Items/AttributeFilter.php | 54 + .../Items/AttributeFilters/AlnumFilter.php | 6 +- .../Items/AttributeFilters/ChoiceFilter.php | 43 +- .../Items/AttributeFilters/ColorFilter.php | 6 +- .../Items/AttributeFilters/EmailFilter.php | 7 +- .../Items/AttributeFilters/FalseFilter.php | 7 +- .../Items/AttributeFilters/FloatFilter.php | 7 +- .../AttributeFilters/FontfamilyFilter.php | 5 +- .../Items/AttributeFilters/HashmapFilter.php | 93 +- .../AttributeFilters/IdentifierFilter.php | 6 +- .../Items/AttributeFilters/IntFilter.php | 7 +- .../Items/AttributeFilters/IpFilter.php | 7 +- .../Items/AttributeFilters/IpportFilter.php | 7 +- .../Items/AttributeFilters/Ipv4Filter.php | 7 +- .../Items/AttributeFilters/Ipv6Filter.php | 7 +- .../Items/AttributeFilters/MapFilter.php | 111 +- .../Items/AttributeFilters/NumberFilter.php | 6 +- .../Items/AttributeFilters/RangeFilter.php | 52 +- .../Items/AttributeFilters/RegexpFilter.php | 108 +- .../AttributeFilters/SimpletextFilter.php | 6 +- .../AttributeFilters/TimestampFilter.php | 7 +- .../Items/AttributeFilters/UintFilter.php | 25 +- .../Items/AttributeFilters/UrlFilter.php | 51 + .../Items/AttributePreprocessor.php | 14 +- .../src/Configurator/Items/Filter.php | 12 + .../Items/ProgrammableCallback.php | 248 + .../src/Configurator/Items/Regexp.php | 165 + .../src/Configurator/Items/Tag.php | 245 + .../src/Configurator/Items/TagFilter.php | 25 + .../src/Configurator/Items/Template.php | 195 + .../Configurator/Items/TemplateDocument.php | 23 +- .../src/Configurator/Items/UnsafeTemplate.php | 3 +- .../src/Configurator/JavaScript.php | 263 +- .../JavaScript/CallbackGenerator.php | 126 +- .../src/Configurator/JavaScript/Code.php | 49 + .../JavaScript/ConfigOptimizer.php | 141 +- .../Configurator/JavaScript/ConfigValue.php | 80 +- .../Configurator/JavaScript/Dictionary.php | 13 +- .../src/Configurator/JavaScript/Encoder.php | 172 +- .../JavaScript/FunctionProvider.php | 145 + .../Configurator/JavaScript/HintGenerator.php | 125 +- .../src/Configurator/JavaScript/Minifier.php | 55 +- .../Minifiers/ClosureCompilerApplication.php | 120 +- .../Minifiers/ClosureCompilerService.php | 96 +- .../JavaScript/Minifiers/FirstAvailable.php | 54 +- .../Minifiers/MatthiasMullieMinify.php | 14 +- .../JavaScript/Minifiers/Noop.php | 13 +- .../JavaScript/OnlineMinifier.php | 13 +- .../JavaScript/RegexpConvertor.php | 162 +- .../JavaScript/StylesheetCompressor.php | 140 +- .../JavaScript/externs.application.js | 43 +- .../JavaScript/externs.service.js | 73 +- .../src/Configurator/RecursiveParser.php | 198 + .../AbstractRecursiveMatcher.php | 39 + .../CachingRecursiveParser.php | 40 + .../RecursiveParser/MatcherInterface.php | 29 + .../src/Configurator/RendererGenerator.php | 19 + .../Configurator/RendererGenerators/PHP.php | 242 + .../PHP/AbstractOptimizer.php | 138 + .../PHP/BranchOutputOptimizer.php | 467 + .../PHP/ControlStructuresOptimizer.php | 315 + .../RendererGenerators/PHP/Optimizer.php | 433 + .../RendererGenerators/PHP/Quick.php | 761 ++ .../RendererGenerators/PHP/Serializer.php | 435 + .../PHP/SwitchStatement.php | 90 + .../RendererGenerators/PHP/XPathConvertor.php | 211 + .../Convertors/AbstractConvertor.php | 39 + .../Convertors/BooleanFunctions.php | 122 + .../Convertors/BooleanOperators.php | 58 + .../XPathConvertor/Convertors/Comparisons.php | 112 + .../PHP/XPathConvertor/Convertors/Core.php | 102 + .../PHP/XPathConvertor/Convertors/Math.php | 109 + .../MultiByteStringManipulation.php | 80 + .../Convertors/SingleByteStringFunctions.php | 185 + .../SingleByteStringManipulation.php | 164 + .../RendererGenerators/Unformatted.php | 7 +- .../Configurator/RendererGenerators/XSLT.php | 138 +- .../src/Configurator/Rendering.php | 156 + .../src/Configurator/RulesGenerator.php | 193 + .../Configurator/RulesGenerators/AllowAll.php | 7 +- .../RulesGenerators/AutoCloseIfVoid.php | 22 + .../AutoReopenFormattingElements.php | 22 + .../BlockElementsCloseFormattingElements.php | 22 + .../BlockElementsFosterFormattingElements.php | 22 + ...leAutoLineBreaksIfNewLinesArePreserved.php | 22 + .../RulesGenerators/EnforceContentModels.php | 78 + .../EnforceOptionalEndTags.php | 22 + .../RulesGenerators/IgnoreTagsInCode.php | 22 + .../IgnoreTextIfDisallowed.php | 22 + .../IgnoreWhitespaceAroundBlockElements.php | 22 + .../Interfaces/BooleanRulesGenerator.php | 21 + .../Interfaces/TargetedRulesGenerator.php | 22 + .../RulesGenerators/ManageParagraphs.php | 28 +- .../TrimFirstLineInCodeBlocks.php | 22 + .../src/Configurator/TemplateCheck.php | 31 + .../src/Configurator/TemplateChecker.php | 153 + .../AbstractDynamicContentCheck.php | 337 + .../AbstractFlashRestriction.php | 290 + .../TemplateChecks/DisallowAttributeSets.php | 39 + .../TemplateChecks/DisallowCopy.php | 34 + .../DisallowDisableOutputEscaping.php | 35 + .../DisallowDynamicAttributeNames.php | 35 + .../DisallowDynamicElementNames.php | 35 + .../TemplateChecks/DisallowElement.php | 31 +- .../TemplateChecks/DisallowElementNS.php | 55 + .../DisallowFlashFullScreen.php | 24 +- .../TemplateChecks/DisallowNodeByXPath.php | 24 +- .../DisallowObjectParamsWithGeneratedName.php | 41 + .../TemplateChecks/DisallowPHPTags.php | 62 + .../TemplateChecks/DisallowUnsafeCopyOf.php | 39 + .../DisallowUnsafeDynamicCSS.php | 40 + .../DisallowUnsafeDynamicJS.php | 40 + .../DisallowUnsafeDynamicURL.php | 119 + .../TemplateChecks/DisallowXPathFunction.php | 97 + .../RestrictFlashNetworking.php | 15 +- .../RestrictFlashScriptAccess.php | 31 + .../AbstractChooseOptimization.php | 127 + .../AbstractConstantFolding.php | 89 + .../AbstractNormalization.php | 212 + .../ConvertCurlyExpressionsInText.php | 49 +- .../TemplateNormalizations/Custom.php | 22 +- .../TemplateNormalizations/DeoptimizeIf.php | 36 + .../EnforceHTMLOmittedEndTags.php | 56 + ...ixUnescapedCurlyBracesInHtmlAttributes.php | 49 + .../FoldArithmeticConstants.php | 110 + .../FoldConstantXPathExpressions.php | 127 + .../InlineAttributes.php | 53 + .../TemplateNormalizations/InlineCDATA.php | 29 + .../TemplateNormalizations/InlineElements.php | 59 + .../InlineInferredValues.php | 112 + .../InlineTextElements.php | 57 + .../InlineXPathLiterals.php | 76 + .../MergeConsecutiveCopyOf.php | 18 +- .../MergeIdenticalConditionalBranches.php | 114 +- .../MinifyInlineCSS.php | 58 + .../MinifyXPathExpressions.php | 61 + .../NormalizeAttributeNames.php | 39 + .../NormalizeElementNames.php | 87 + .../TemplateNormalizations/NormalizeUrls.php | 90 + .../TemplateNormalizations/OptimizeChoose.php | 272 + .../OptimizeChooseDeadBranches.php | 83 + .../OptimizeChooseText.php | 142 + .../OptimizeConditionalAttributes.php | 41 + .../OptimizeConditionalValueOf.php | 42 + .../OptimizeNestedConditionals.php | 24 +- .../PreserveSingleSpaces.php | 29 + .../TemplateNormalizations/RemoveComments.php | 29 + .../RemoveInterElementWhitespace.php | 29 + .../RemoveLivePreviewAttributes.php | 41 + .../RenameLivePreviewEvent.php | 43 + .../SetRelNoreferrerOnTargetedLinks.php | 77 + .../SortAttributesByName.php | 23 +- .../TransposeComments.php | 14 +- .../UninlineAttributes.php | 103 + .../src/Configurator/TemplateNormalizer.php | 153 + .../Configurator/Traits/CollectionProxy.php | 137 + .../src/Configurator/Traits/Configurable.php | 183 + .../Configurator/Traits/TemplateSafeness.php | 106 + .../src/Configurator/UrlConfig.php | 125 + .../Configurator/Validators/AttributeName.php | 49 + .../src/Configurator/Validators/TagName.php | 57 + .../Validators/TemplateParameterName.php | 30 +- vendor/s9e/text-formatter/src/Parser.js | 328 +- vendor/s9e/text-formatter/src/Parser.php | 1421 ++- .../Parser/AttributeFilters/EmailFilter.php | 11 +- .../Parser/AttributeFilters/FalseFilter.js | 2 +- .../Parser/AttributeFilters/FalseFilter.php | 11 +- .../Parser/AttributeFilters/HashmapFilter.js | 2 +- .../Parser/AttributeFilters/HashmapFilter.php | 16 +- .../src/Parser/AttributeFilters/MapFilter.php | 19 +- .../Parser/AttributeFilters/NetworkFilter.php | 60 +- .../Parser/AttributeFilters/NumericFilter.js | 8 +- .../Parser/AttributeFilters/NumericFilter.php | 60 +- .../Parser/AttributeFilters/RegexpFilter.php | 12 +- .../AttributeFilters/TimestampFilter.php | 15 +- .../src/Parser/AttributeFilters/UrlFilter.js | 43 +- .../src/Parser/AttributeFilters/UrlFilter.php | 202 +- .../src/Parser/FilterProcessing.js | 20 +- .../src/Parser/FilterProcessing.php | 147 +- .../s9e/text-formatter/src/Parser/Logger.js | 50 +- .../s9e/text-formatter/src/Parser/Logger.php | 104 +- .../text-formatter/src/Parser/NullLogger.js | 18 +- vendor/s9e/text-formatter/src/Parser/Tag.js | 177 +- vendor/s9e/text-formatter/src/Parser/Tag.php | 314 +- vendor/s9e/text-formatter/src/Parser/utils.js | 29 +- .../src/Plugins/Autoemail/Configurator.php | 33 +- .../src/Plugins/Autoemail/Parser.php | 15 +- .../src/Plugins/Autoimage/Configurator.php | 33 +- .../src/Plugins/Autoimage/Parser.php | 11 +- .../src/Plugins/Autolink/Configurator.php | 52 +- .../src/Plugins/Autolink/Parser.js | 17 +- .../src/Plugins/Autolink/Parser.php | 57 +- .../src/Plugins/Autovideo/Configurator.php | 35 +- .../src/Plugins/Autovideo/Parser.php | 11 +- .../src/Plugins/BBCodes/Configurator.php | 113 +- .../Plugins/BBCodes/Configurator/BBCode.php | 79 +- .../BBCodes/Configurator/BBCodeCollection.php | 38 +- .../BBCodes/Configurator/BBCodeMonkey.php | 526 +- .../BBCodes/Configurator/Repository.php | 99 +- .../Configurator/RepositoryCollection.php | 20 +- .../BBCodes/Configurator/repository.xml | 92 +- .../src/Plugins/BBCodes/Parser.js | 56 +- .../src/Plugins/BBCodes/Parser.php | 271 +- .../src/Plugins/Censor/Configurator.php | 164 +- .../src/Plugins/Censor/Helper.php | 115 +- .../src/Plugins/Censor/Parser.js | 4 +- .../src/Plugins/Censor/Parser.php | 28 +- .../src/Plugins/ConfiguratorBase.php | 177 +- .../src/Plugins/Emoji/Configurator.php | 90 +- .../src/Plugins/Emoji/Parser.js | 36 +- .../src/Plugins/Emoji/Parser.php | 140 +- .../src/Plugins/Emoticons/Configurator.php | 160 +- .../Configurator/EmoticonCollection.php | 28 +- .../src/Plugins/Emoticons/Parser.php | 11 +- .../src/Plugins/Escaper/Configurator.php | 35 +- .../src/Plugins/Escaper/Parser.php | 11 +- .../src/Plugins/FancyPants/Configurator.php | 64 +- .../src/Plugins/FancyPants/Parser.js | 44 +- .../src/Plugins/FancyPants/Parser.php | 219 +- .../src/Plugins/HTMLComments/Configurator.php | 25 +- .../src/Plugins/HTMLComments/Parser.php | 26 +- .../src/Plugins/HTMLElements/Configurator.php | 235 +- .../src/Plugins/HTMLElements/Parser.js | 28 +- .../src/Plugins/HTMLElements/Parser.php | 74 +- .../src/Plugins/HTMLEntities/Configurator.php | 25 +- .../src/Plugins/HTMLEntities/Parser.php | 20 +- .../src/Plugins/Keywords/Configurator.php | 97 +- .../src/Plugins/Keywords/Parser.js | 5 +- .../src/Plugins/Keywords/Parser.php | 21 +- .../src/Plugins/Litedown/Configurator.php | 81 +- .../src/Plugins/Litedown/Parser.php | 17 +- .../Litedown/Parser/LinkAttributesSetter.js | 2 +- .../Litedown/Parser/LinkAttributesSetter.php | 25 +- .../src/Plugins/Litedown/Parser/ParsedText.js | 6 +- .../Plugins/Litedown/Parser/ParsedText.php | 149 +- .../Parser/Passes/AbstractInlineMarkup.js | 29 + .../Parser/Passes/AbstractInlineMarkup.php | 41 + .../Litedown/Parser/Passes/AbstractPass.php | 22 +- .../Litedown/Parser/Passes/AbstractScript.js | 4 +- .../Litedown/Parser/Passes/AbstractScript.php | 76 +- .../Plugins/Litedown/Parser/Passes/Blocks.js | 115 +- .../Plugins/Litedown/Parser/Passes/Blocks.php | 350 +- .../Litedown/Parser/Passes/Emphasis.js | 32 +- .../Litedown/Parser/Passes/Emphasis.php | 163 +- .../Parser/Passes/ForcedLineBreaks.js | 4 +- .../Parser/Passes/ForcedLineBreaks.php | 12 +- .../Plugins/Litedown/Parser/Passes/Images.js | 4 +- .../Plugins/Litedown/Parser/Passes/Images.php | 66 +- .../Litedown/Parser/Passes/InlineCode.js | 4 +- .../Litedown/Parser/Passes/InlineCode.php | 43 +- .../Litedown/Parser/Passes/InlineSpoiler.js | 5 + .../Litedown/Parser/Passes/InlineSpoiler.php | 20 + .../Litedown/Parser/Passes/LinkReferences.js | 2 +- .../Litedown/Parser/Passes/LinkReferences.php | 21 +- .../Plugins/Litedown/Parser/Passes/Links.js | 4 +- .../Plugins/Litedown/Parser/Passes/Links.php | 75 +- .../Litedown/Parser/Passes/Strikethrough.js | 18 +- .../Litedown/Parser/Passes/Strikethrough.php | 22 +- .../Litedown/Parser/Passes/Subscript.js | 2 +- .../Litedown/Parser/Passes/Subscript.php | 8 +- .../Litedown/Parser/Passes/Superscript.js | 2 +- .../Litedown/Parser/Passes/Superscript.php | 8 +- .../src/Plugins/MediaEmbed/Configurator.php | 206 +- .../CachedDefinitionCollection.php | 58 +- .../Collections/SiteDefinitionCollection.php | 65 +- .../XmlFileDefinitionCollection.php | 122 +- .../Configurator/TemplateBuilder.php | 51 +- .../Configurator/TemplateGenerator.php | 149 +- .../TemplateGenerators/Choose.php | 28 +- .../Configurator/TemplateGenerators/Flash.php | 25 +- .../TemplateGenerators/Iframe.php | 26 +- .../src/Plugins/MediaEmbed/Parser.php | 143 +- .../Plugins/MediaEmbed/Parser/tagFilter.js | 15 +- .../text-formatter/src/Plugins/ParserBase.php | 32 +- .../src/Plugins/PipeTables/Configurator.php | 35 +- .../src/Plugins/PipeTables/Parser.js | 79 +- .../src/Plugins/PipeTables/Parser.php | 291 +- .../src/Plugins/Preg/Configurator.php | 284 +- .../text-formatter/src/Plugins/Preg/Parser.js | 2 +- .../src/Plugins/Preg/Parser.php | 30 +- vendor/s9e/text-formatter/src/Renderer.php | 137 +- .../s9e/text-formatter/src/Renderers/PHP.php | 222 +- .../src/Renderers/Unformatted.php | 13 +- .../s9e/text-formatter/src/Renderers/XSLT.php | 147 +- vendor/s9e/text-formatter/src/Unparser.php | 12 +- vendor/s9e/text-formatter/src/Utils.php | 149 +- vendor/s9e/text-formatter/src/Utils/Http.php | 22 +- .../text-formatter/src/Utils/Http/Client.php | 33 +- .../src/Utils/Http/Clients/Cached.php | 80 +- .../src/Utils/Http/Clients/Curl.php | 78 +- .../src/Utils/Http/Clients/Native.php | 105 +- vendor/s9e/text-formatter/src/Utils/XPath.php | 94 +- vendor/s9e/text-formatter/src/render.js | 227 +- vendor/symfony/config/ConfigCache.php | 27 +- .../symfony/config/Definition/ArrayNode.php | 36 +- vendor/symfony/config/Definition/BaseNode.php | 74 +- .../Builder/ArrayNodeDefinition.php | 103 +- .../Builder/BooleanNodeDefinition.php | 23 +- .../config/Definition/Builder/ExprBuilder.php | 27 +- .../config/Definition/Builder/NodeBuilder.php | 4 +- .../Definition/Builder/NodeDefinition.php | 20 +- .../Builder/NormalizationBuilder.php | 6 +- .../Builder/NumericNodeDefinition.php | 8 +- .../config/Definition/Builder/TreeBuilder.php | 4 + .../Definition/Builder/ValidationBuilder.php | 2 +- .../Builder/VariableNodeDefinition.php | 1 + .../Definition/Dumper/XmlReferenceDumper.php | 28 +- .../Definition/Dumper/YamlReferenceDumper.php | 107 +- vendor/symfony/config/Definition/EnumNode.php | 2 +- .../symfony/config/Definition/Processor.php | 6 +- .../config/Definition/PrototypedArrayNode.php | 58 +- .../DependencyInjection/ConfigCachePass.php | 52 + .../Exception/FileLoaderLoadException.php | 12 +- .../FileLocatorFileNotFoundException.php | 34 + vendor/symfony/config/FileLocator.php | 12 +- .../symfony/config/FileLocatorInterface.php | 5 +- vendor/symfony/config/LICENSE | 2 +- .../config/Loader/DelegatingLoader.php | 2 +- vendor/symfony/config/Loader/FileLoader.php | 88 +- .../symfony/config/Loader/GlobFileLoader.php | 36 + vendor/symfony/config/Loader/Loader.php | 2 +- .../symfony/config/Loader/LoaderResolver.php | 4 +- .../Resource/ClassExistenceResource.php | 210 + .../config/Resource/ComposerResource.php | 84 + .../config/Resource/DirectoryResource.php | 20 +- .../config/Resource/FileExistenceResource.php | 8 +- .../symfony/config/Resource/FileResource.php | 22 +- .../symfony/config/Resource/GlobResource.php | 159 + .../Resource/ReflectionClassResource.php | 250 + .../config/Resource/ResourceInterface.php | 25 - .../config/ResourceCheckerConfigCache.php | 73 +- .../ResourceCheckerConfigCacheFactory.php | 9 +- .../Util/Exception/InvalidXmlException.php | 21 + .../Util/Exception/XmlParsingException.php | 21 + vendor/symfony/config/Util/XmlUtils.php | 72 +- vendor/symfony/config/composer.json | 15 +- vendor/symfony/console/Application.php | 616 +- vendor/symfony/console/Command/Command.php | 142 +- .../symfony/console/Command/HelpCommand.php | 15 +- .../symfony/console/Command/ListCommand.php | 15 +- .../symfony/console/Command/LockableTrait.php | 72 + .../CommandLoader/CommandLoaderInterface.php | 46 + .../CommandLoader/ContainerCommandLoader.php | 64 + .../CommandLoader/FactoryCommandLoader.php | 62 + vendor/symfony/console/ConsoleEvents.php | 31 +- .../AddConsoleCommandPass.php | 106 + .../Descriptor/ApplicationDescription.php | 46 +- .../symfony/console/Descriptor/Descriptor.php | 14 +- .../Descriptor/DescriptorInterface.php | 6 +- .../console/Descriptor/JsonDescriptor.php | 59 +- .../console/Descriptor/MarkdownDescriptor.php | 84 +- .../console/Descriptor/TextDescriptor.php | 93 +- .../console/Descriptor/XmlDescriptor.php | 22 +- .../console/Event/ConsoleErrorEvent.php | 83 + vendor/symfony/console/Event/ConsoleEvent.php | 4 +- .../console/Event/ConsoleExceptionEvent.php | 4 + .../console/EventListener/ErrorListener.php | 95 + .../Exception/CommandNotFoundException.php | 10 +- .../console/Formatter/OutputFormatter.php | 35 +- .../Formatter/OutputFormatterStyle.php | 98 +- .../OutputFormatterStyleInterface.php | 2 +- .../Formatter/OutputFormatterStyleStack.php | 2 +- .../console/Helper/DebugFormatterHelper.php | 6 +- .../console/Helper/DescriptorHelper.php | 15 +- .../console/Helper/FormatterHelper.php | 30 +- vendor/symfony/console/Helper/Helper.php | 40 +- vendor/symfony/console/Helper/HelperSet.php | 12 +- .../symfony/console/Helper/ProcessHelper.php | 24 +- vendor/symfony/console/Helper/ProgressBar.php | 151 +- .../console/Helper/ProgressIndicator.php | 65 +- .../symfony/console/Helper/QuestionHelper.php | 131 +- .../console/Helper/SymfonyQuestionHelper.php | 4 + vendor/symfony/console/Helper/Table.php | 119 +- vendor/symfony/console/Helper/TableCell.php | 7 +- .../symfony/console/Helper/TableSeparator.php | 2 +- vendor/symfony/console/Helper/TableStyle.php | 2 +- vendor/symfony/console/Input/ArgvInput.php | 64 +- vendor/symfony/console/Input/ArrayInput.php | 35 +- vendor/symfony/console/Input/Input.php | 31 +- .../symfony/console/Input/InputArgument.php | 2 +- .../symfony/console/Input/InputDefinition.php | 80 +- .../symfony/console/Input/InputInterface.php | 12 +- vendor/symfony/console/Input/InputOption.php | 6 +- .../Input/StreamableInputInterface.php | 37 + vendor/symfony/console/Input/StringInput.php | 21 +- vendor/symfony/console/LICENSE | 2 +- .../symfony/console/Logger/ConsoleLogger.php | 61 +- .../symfony/console/Output/ConsoleOutput.php | 19 +- .../console/Output/OutputInterface.php | 28 + .../console/Question/ChoiceQuestion.php | 14 +- .../console/Question/ConfirmationQuestion.php | 2 +- vendor/symfony/console/Question/Question.php | 10 +- vendor/symfony/console/Style/OutputStyle.php | 42 + .../symfony/console/Style/StyleInterface.php | 1 - vendor/symfony/console/Style/SymfonyStyle.php | 54 +- vendor/symfony/console/Terminal.php | 176 + .../console/Tester/ApplicationTester.php | 75 +- .../symfony/console/Tester/CommandTester.php | 41 +- vendor/symfony/console/composer.json | 23 +- vendor/symfony/debug/BufferingLogger.php | 8 +- vendor/symfony/debug/Debug.php | 6 +- vendor/symfony/debug/DebugClassLoader.php | 475 +- vendor/symfony/debug/ErrorHandler.php | 419 +- .../debug/Exception/ContextErrorException.php | 8 +- .../debug/Exception/FatalErrorException.php | 21 +- .../debug/Exception/FlattenException.php | 98 +- .../debug/Exception/SilencedErrorContext.php | 67 + vendor/symfony/debug/ExceptionHandler.php | 382 +- .../ClassNotFoundFatalErrorHandler.php | 40 +- .../UndefinedFunctionFatalErrorHandler.php | 8 +- .../UndefinedMethodFatalErrorHandler.php | 4 +- vendor/symfony/debug/LICENSE | 2 +- vendor/symfony/debug/Resources/ext/README.md | 20 +- .../debug/Resources/ext/tests/001.phpt | 6 +- vendor/symfony/debug/composer.json | 7 +- vendor/symfony/dependency-injection/Alias.php | 38 +- .../Argument/ArgumentInterface.php | 27 + .../Argument/BoundArgument.php | 46 + .../Argument/IteratorArgument.php | 55 + .../Argument/RewindableGenerator.php | 46 + .../Argument/ServiceClosureArgument.php | 50 + .../Argument/TaggedIteratorArgument.php | 37 + .../dependency-injection/ChildDefinition.php | 126 + .../Compiler/AbstractRecursivePass.php | 174 + .../Compiler/AnalyzeServiceReferencesPass.php | 167 +- .../Compiler/AutoAliasServicePass.php | 2 +- .../Compiler/AutowireExceptionPass.php | 74 + .../Compiler/AutowirePass.php | 587 +- .../Compiler/AutowireRequiredMethodsPass.php | 70 + .../Compiler/CheckArgumentsValidityPass.php | 87 + .../Compiler/CheckCircularReferencesPass.php | 8 +- .../Compiler/CheckDefinitionValidityPass.php | 56 +- ...xceptionOnInvalidReferenceBehaviorPass.php | 43 +- .../Compiler/CheckReferenceValidityPass.php | 132 +- .../Compiler/Compiler.php | 72 +- .../Compiler/DecoratorServicePass.php | 31 +- .../Compiler/DefinitionErrorExceptionPass.php | 39 + .../Compiler/FactoryReturnTypePass.php | 112 + .../Compiler/InlineServiceDefinitionsPass.php | 145 +- .../Compiler/LoggingFormatter.php | 9 + .../MergeExtensionConfigurationPass.php | 158 +- .../Compiler/PassConfig.php | 149 +- .../Compiler/PriorityTaggedServiceTrait.php | 54 + .../Compiler/RegisterEnvVarProcessorsPass.php | 78 + .../RegisterServiceSubscribersPass.php | 101 + .../RemoveAbstractDefinitionsPass.php | 5 +- .../Compiler/RemovePrivateAliasesPass.php | 7 +- .../Compiler/RemoveUnusedDefinitionsPass.php | 23 +- .../ReplaceAliasByActualDefinitionPass.php | 91 +- .../Compiler/ResolveBindingsPass.php | 180 + .../Compiler/ResolveChildDefinitionsPass.php | 198 + .../Compiler/ResolveClassPass.php | 56 + .../ResolveDefinitionTemplatesPass.php | 210 +- .../Compiler/ResolveEnvPlaceholdersPass.php | 44 + .../Compiler/ResolveFactoryClassPass.php | 38 + .../Compiler/ResolveHotPathPass.php | 71 + .../ResolveInstanceofConditionalsPass.php | 155 + .../Compiler/ResolveInvalidReferencesPass.php | 112 +- .../Compiler/ResolveNamedArgumentsPass.php | 102 + .../ResolveParameterPlaceHoldersPass.php | 78 +- .../Compiler/ResolvePrivatesPass.php | 40 + .../ResolveReferencesToAliasesPass.php | 83 +- .../ResolveServiceSubscribersPass.php | 51 + .../ResolveTaggedIteratorArgumentPass.php | 38 + .../Compiler/ServiceLocatorTagPass.php | 126 + .../Compiler/ServiceReferenceGraph.php | 18 +- .../Compiler/ServiceReferenceGraphEdge.php | 45 +- .../Compiler/ServiceReferenceGraphNode.php | 16 +- .../Config/AutowireServiceResource.php | 88 + .../Config/ContainerParametersResource.php | 64 + .../ContainerParametersResourceChecker.php | 52 + .../dependency-injection/Container.php | 556 +- .../dependency-injection/ContainerBuilder.php | 1021 +- .../ContainerInterface.php | 77 +- .../dependency-injection/Definition.php | 438 +- .../DefinitionDecorator.php | 214 +- .../Dumper/DumperInterface.php | 6 +- .../Dumper/GraphvizDumper.php | 73 +- .../dependency-injection/Dumper/PhpDumper.php | 1876 ++-- .../dependency-injection/Dumper/XmlDumper.php | 88 +- .../Dumper/YamlDumper.php | 94 +- .../dependency-injection/EnvVarProcessor.php | 163 + .../EnvVarProcessorInterface.php | 40 + .../Exception/AutowiringFailedException.php | 32 + .../Exception/EnvNotFoundException.php | 25 + .../Exception/EnvParameterException.php | 25 + .../Exception/ExceptionInterface.php | 4 +- .../Exception/ParameterNotFoundException.php | 17 +- .../Exception/ServiceNotFoundException.php | 17 +- .../ExpressionLanguage.php | 8 +- .../ExpressionLanguageProvider.php | 13 +- .../Extension/Extension.php | 38 +- .../Extension/ExtensionInterface.php | 2 +- vendor/symfony/dependency-injection/LICENSE | 2 +- .../Instantiator/RealServiceInstantiator.php | 2 +- .../LazyProxy/PhpDumper/DumperInterface.php | 5 +- .../LazyProxy/PhpDumper/NullDumper.php | 4 +- .../LazyProxy/ProxyHelper.php | 64 + .../Configurator/AbstractConfigurator.php | 87 + .../AbstractServiceConfigurator.php | 117 + .../Loader/Configurator/AliasConfigurator.php | 30 + .../Configurator/ContainerConfigurator.php | 141 + .../Configurator/DefaultsConfigurator.php | 68 + .../InlineServiceConfigurator.php | 36 + .../Configurator/InstanceofConfigurator.php | 43 + .../Configurator/ParametersConfigurator.php | 57 + .../Configurator/PrototypeConfigurator.php | 84 + .../Configurator/ReferenceConfigurator.php | 66 + .../Configurator/ServiceConfigurator.php | 70 + .../Configurator/ServicesConfigurator.php | 154 + .../Configurator/Traits/AbstractTrait.php | 33 + .../Configurator/Traits/ArgumentTrait.php | 44 + .../Traits/AutoconfigureTrait.php | 37 + .../Configurator/Traits/AutowireTrait.php | 29 + .../Loader/Configurator/Traits/BindTrait.php | 43 + .../Loader/Configurator/Traits/CallTrait.php | 34 + .../Loader/Configurator/Traits/ClassTrait.php | 32 + .../Configurator/Traits/ConfiguratorTrait.php | 29 + .../Configurator/Traits/DecorateTrait.php | 35 + .../Configurator/Traits/DeprecateTrait.php | 33 + .../Configurator/Traits/FactoryTrait.php | 37 + .../Loader/Configurator/Traits/FileTrait.php | 29 + .../Loader/Configurator/Traits/LazyTrait.php | 29 + .../Configurator/Traits/ParentTrait.php | 55 + .../Configurator/Traits/PropertyTrait.php | 30 + .../Configurator/Traits/PublicTrait.php | 39 + .../Loader/Configurator/Traits/ShareTrait.php | 29 + .../Configurator/Traits/SyntheticTrait.php | 30 + .../Loader/Configurator/Traits/TagTrait.php | 42 + .../Loader/DirectoryLoader.php | 4 +- .../Loader/FileLoader.php | 143 + .../Loader/GlobFileLoader.php | 40 + .../Loader/IniFileLoader.php | 53 +- .../Loader/PhpFileLoader.php | 32 +- .../Loader/XmlFileLoader.php | 401 +- .../Loader/YamlFileLoader.php | 600 +- .../schema/dic/services/services-1.0.xsd | 86 +- .../EnvPlaceholderParameterBag.php | 123 + .../ParameterBag/FrozenParameterBag.php | 2 +- .../ParameterBag/ParameterBag.php | 94 +- .../ParameterBag/ParameterBagInterface.php | 7 + .../dependency-injection/Reference.php | 25 +- .../dependency-injection/ServiceLocator.php | 146 + .../ServiceSubscriberInterface.php | 50 + .../dependency-injection/TypedReference.php | 51 + .../dependency-injection/composer.json | 24 +- .../ContainerAwareEventDispatcher.php | 45 +- .../Debug/TraceableEventDispatcher.php | 197 +- .../TraceableEventDispatcherInterface.php | 2 + .../Debug/WrappedListener.php | 58 +- .../RegisterListenersPass.php | 99 +- vendor/symfony/event-dispatcher/Event.php | 62 - .../event-dispatcher/EventDispatcher.php | 98 +- .../EventDispatcherInterface.php | 28 +- .../EventSubscriberInterface.php | 8 +- .../symfony/event-dispatcher/GenericEvent.php | 6 +- vendor/symfony/event-dispatcher/LICENSE | 2 +- vendor/symfony/event-dispatcher/composer.json | 15 +- .../Exception/IOExceptionInterface.php | 2 +- vendor/symfony/filesystem/Filesystem.php | 222 +- vendor/symfony/filesystem/LICENSE | 2 +- vendor/symfony/filesystem/LockHandler.php | 6 + vendor/symfony/filesystem/composer.json | 4 +- .../symfony/finder/Comparator/Comparator.php | 2 +- .../finder/Exception/ExceptionInterface.php | 2 + vendor/symfony/finder/Finder.php | 265 +- vendor/symfony/finder/Glob.php | 30 +- .../finder/Iterator/CustomFilterIterator.php | 2 +- .../Iterator/DateRangeFilterIterator.php | 2 +- .../ExcludeDirectoryFilterIterator.php | 8 +- .../finder/Iterator/FilterIterator.php | 2 + .../Iterator/MultiplePcreFilterIterator.php | 6 +- .../Iterator/RecursiveDirectoryIterator.php | 4 +- .../Iterator/SizeRangeFilterIterator.php | 2 +- .../finder/Iterator/SortableIterator.php | 14 +- vendor/symfony/finder/LICENSE | 2 +- vendor/symfony/finder/composer.json | 4 +- .../symfony/http-foundation/AcceptHeader.php | 2 +- .../http-foundation/AcceptHeaderItem.php | 7 +- .../http-foundation/BinaryFileResponse.php | 43 +- vendor/symfony/http-foundation/Cookie.php | 151 +- .../Exception/ConflictingHeadersException.php | 4 +- .../Exception/RequestExceptionInterface.php | 21 + .../SuspiciousOperationException.php | 20 + .../ExpressionRequestMatcher.php | 4 +- .../File/MimeType/ExtensionGuesser.php | 4 +- .../MimeType/FileBinaryMimeTypeGuesser.php | 12 +- .../File/MimeType/FileinfoMimeTypeGuesser.php | 6 +- .../MimeType/MimeTypeExtensionGuesser.php | 32 +- .../File/MimeType/MimeTypeGuesser.php | 4 +- .../MimeType/MimeTypeGuesserInterface.php | 2 +- .../symfony/http-foundation/File/Stream.php | 28 + .../http-foundation/File/UploadedFile.php | 27 +- vendor/symfony/http-foundation/FileBag.php | 24 +- vendor/symfony/http-foundation/HeaderBag.php | 73 +- vendor/symfony/http-foundation/IpUtils.php | 4 +- .../symfony/http-foundation/JsonResponse.php | 115 +- vendor/symfony/http-foundation/LICENSE | 2 +- .../symfony/http-foundation/ParameterBag.php | 114 +- .../http-foundation/RedirectResponse.php | 12 +- vendor/symfony/http-foundation/Request.php | 466 +- .../http-foundation/RequestMatcher.php | 17 +- .../symfony/http-foundation/RequestStack.php | 8 +- vendor/symfony/http-foundation/Response.php | 212 +- .../http-foundation/ResponseHeaderBag.php | 125 +- vendor/symfony/http-foundation/ServerBag.php | 14 +- .../Session/Attribute/AttributeBag.php | 12 +- .../Attribute/NamespacedAttributeBag.php | 14 +- .../Session/Flash/AutoExpireFlashBag.php | 18 +- .../Session/Flash/FlashBag.php | 30 +- .../Session/Flash/FlashBagInterface.php | 12 +- .../http-foundation/Session/Session.php | 69 +- .../Session/SessionBagProxy.php | 89 + .../Handler/AbstractSessionHandler.php | 168 + .../Handler/MemcacheSessionHandler.php | 8 +- .../Handler/MemcachedSessionHandler.php | 43 +- .../Storage/Handler/MongoDbSessionHandler.php | 90 +- .../Handler/NativeFileSessionHandler.php | 3 +- .../Storage/Handler/NativeSessionHandler.php | 16 +- .../Storage/Handler/NullSessionHandler.php | 34 +- .../Storage/Handler/PdoSessionHandler.php | 166 +- .../Storage/Handler/StrictSessionHandler.php | 103 + .../Handler/WriteCheckSessionHandler.php | 4 + .../Session/Storage/MetadataBag.php | 2 +- .../Storage/MockArraySessionStorage.php | 10 +- .../Storage/MockFileSessionStorage.php | 23 +- .../Session/Storage/NativeSessionStorage.php | 145 +- .../Storage/PhpBridgeSessionStorage.php | 15 +- .../Session/Storage/Proxy/AbstractProxy.php | 36 +- .../Session/Storage/Proxy/NativeProxy.php | 4 + .../Storage/Proxy/SessionHandlerProxy.php | 41 +- .../Storage/SessionStorageInterface.php | 2 +- .../http-foundation/StreamedResponse.php | 23 +- vendor/symfony/http-foundation/composer.json | 11 +- vendor/symfony/http-kernel/Bundle/Bundle.php | 59 +- .../http-kernel/Bundle/BundleInterface.php | 2 + .../CacheClearer/ChainCacheClearer.php | 8 +- .../CacheClearer/Psr6CacheClearer.php | 58 + .../CacheWarmer/CacheWarmerAggregate.php | 22 +- vendor/symfony/http-kernel/Client.php | 53 +- .../Config/EnvParametersResource.php | 22 +- .../http-kernel/Config/FileLocator.php | 2 +- .../Controller/ArgumentResolver.php | 94 + .../ArgumentResolver/DefaultValueResolver.php | 40 + .../RequestAttributeValueResolver.php | 40 + .../ArgumentResolver/RequestValueResolver.php | 40 + .../ArgumentResolver/ServiceValueResolver.php | 77 + .../ArgumentResolver/SessionValueResolver.php | 46 + .../VariadicValueResolver.php | 48 + .../Controller/ArgumentResolverInterface.php | 34 + .../ArgumentValueResolverInterface.php | 37 + .../ContainerControllerResolver.php | 121 + .../Controller/ControllerReference.php | 6 +- .../Controller/ControllerResolver.php | 94 +- .../ControllerResolverInterface.php | 4 +- .../Controller/TraceableArgumentResolver.php | 44 + .../TraceableControllerResolver.php | 23 +- .../ControllerMetadata/ArgumentMetadata.php | 115 + .../ArgumentMetadataFactory.php | 135 + .../ArgumentMetadataFactoryInterface.php | 27 + .../DataCollector/AjaxDataCollector.php | 5 + .../DataCollector/ConfigDataCollector.php | 164 +- .../DataCollector/DataCollector.php | 82 +- .../DataCollector/DataCollectorInterface.php | 2 + .../DataCollector/DumpDataCollector.php | 58 +- .../DataCollector/EventDataCollector.php | 25 +- .../DataCollector/ExceptionDataCollector.php | 14 +- .../DataCollector/LoggerDataCollector.php | 230 +- .../DataCollector/MemoryDataCollector.php | 16 +- .../DataCollector/RequestDataCollector.php | 274 +- .../DataCollector/RouterDataCollector.php | 22 +- .../DataCollector/TimeDataCollector.php | 41 +- .../DataCollector/Util/ValueExporter.php | 16 +- .../http-kernel/Debug/FileLinkFormatter.php | 117 + .../Debug/TraceableEventDispatcher.php | 28 +- .../AddAnnotatedClassesToCachePass.php | 153 + .../AddClassesToCachePass.php | 29 +- .../ControllerArgumentValueResolverPass.php | 48 + .../DependencyInjection/Extension.php | 37 +- .../FragmentRendererPass.php | 37 +- .../LazyLoadingFragmentHandler.php | 39 +- .../DependencyInjection/LoggerPass.php | 41 + .../MergeExtensionConfigurationPass.php | 2 +- ...RegisterControllerArgumentLocatorsPass.php | 179 + ...oveEmptyControllerArgumentLocatorsPass.php | 76 + .../ResettableServicePass.php | 66 + .../DependencyInjection/ServicesResetter.php | 39 + .../Event/FilterControllerArgumentsEvent.php | 52 + .../Event/FilterControllerEvent.php | 50 +- .../Event/GetResponseForExceptionEvent.php | 23 + .../EventListener/AbstractSessionListener.php | 92 + .../AbstractTestSessionListener.php | 100 + .../AddRequestFormatsListener.php | 2 +- .../EventListener/DebugHandlersListener.php | 45 +- .../EventListener/DumpListener.php | 6 +- .../EventListener/ExceptionListener.php | 27 +- .../EventListener/FragmentListener.php | 22 +- .../EventListener/LocaleListener.php | 64 +- .../EventListener/ProfilerListener.php | 57 +- .../EventListener/ResponseListener.php | 4 +- .../EventListener/RouterListener.php | 118 +- .../EventListener/SaveSessionListener.php | 8 +- .../EventListener/SessionListener.php | 44 +- .../StreamedResponseListener.php | 6 +- .../EventListener/SurrogateListener.php | 22 +- .../EventListener/TestSessionListener.php | 68 +- .../EventListener/TranslatorListener.php | 8 +- .../EventListener/ValidateRequestListener.php | 16 +- .../Exception/AccessDeniedHttpException.php | 2 +- .../Exception/BadRequestHttpException.php | 2 +- .../Exception/ConflictHttpException.php | 2 +- .../Exception/GoneHttpException.php | 2 +- .../http-kernel/Exception/HttpException.php | 12 +- .../Exception/LengthRequiredHttpException.php | 2 +- .../MethodNotAllowedHttpException.php | 2 +- .../Exception/NotAcceptableHttpException.php | 2 +- .../Exception/NotFoundHttpException.php | 2 +- .../PreconditionFailedHttpException.php | 2 +- .../PreconditionRequiredHttpException.php | 2 +- .../ServiceUnavailableHttpException.php | 4 +- .../TooManyRequestsHttpException.php | 4 +- .../Exception/UnauthorizedHttpException.php | 2 +- .../UnprocessableEntityHttpException.php | 2 +- .../UnsupportedMediaTypeHttpException.php | 2 +- .../AbstractSurrogateFragmentRenderer.php | 19 +- .../http-kernel/Fragment/FragmentHandler.php | 60 +- .../Fragment/FragmentRendererInterface.php | 2 +- .../Fragment/HIncludeFragmentRenderer.php | 34 +- .../Fragment/InlineFragmentRenderer.php | 10 +- .../HttpCache/AbstractSurrogate.php | 136 + vendor/symfony/http-kernel/HttpCache/Esi.php | 179 +- .../http-kernel/HttpCache/HttpCache.php | 213 +- .../HttpCache/ResponseCacheStrategy.php | 197 +- vendor/symfony/http-kernel/HttpCache/Ssi.php | 100 +- .../symfony/http-kernel/HttpCache/Store.php | 37 +- .../HttpCache/SubRequestHandler.php | 76 +- vendor/symfony/http-kernel/HttpKernel.php | 40 +- vendor/symfony/http-kernel/Kernel.php | 418 +- vendor/symfony/http-kernel/KernelEvents.php | 46 +- .../symfony/http-kernel/KernelInterface.php | 22 +- vendor/symfony/http-kernel/LICENSE | 2 +- .../http-kernel/Log/DebugLoggerInterface.php | 2 + vendor/symfony/http-kernel/Log/Logger.php | 110 + .../Profiler/FileProfilerStorage.php | 30 +- .../symfony/http-kernel/Profiler/Profile.php | 25 +- .../symfony/http-kernel/Profiler/Profiler.php | 107 +- .../Profiler/ProfilerStorageInterface.php | 2 +- .../http-kernel/RebootableInterface.php | 30 + .../http-kernel/Resources/welcome.html.php | 70 + vendor/symfony/http-kernel/UriSigner.php | 28 +- vendor/symfony/http-kernel/composer.json | 50 +- vendor/symfony/polyfill-ctype/composer.json | 2 +- vendor/symfony/polyfill-mbstring/Mbstring.php | 44 +- .../symfony/polyfill-mbstring/bootstrap.php | 4 + .../symfony/polyfill-mbstring/composer.json | 2 +- vendor/symfony/polyfill-php56/LICENSE | 19 + vendor/symfony/polyfill-php56/Php56.php | 138 + vendor/symfony/polyfill-php56/README.md | 15 + vendor/symfony/polyfill-php56/bootstrap.php | 38 + vendor/symfony/polyfill-php56/composer.json | 32 + vendor/symfony/polyfill-php70/LICENSE | 19 + vendor/symfony/polyfill-php70/Php70.php | 74 + vendor/symfony/polyfill-php70/README.md | 28 + .../Resources/stubs/ArithmeticError.php | 5 + .../Resources/stubs/AssertionError.php | 5 + .../Resources/stubs/DivisionByZeroError.php | 5 + .../polyfill-php70/Resources/stubs/Error.php | 5 + .../Resources/stubs/ParseError.php | 5 + ...SessionUpdateTimestampHandlerInterface.php | 23 + .../Resources/stubs/TypeError.php | 5 + vendor/symfony/polyfill-php70/bootstrap.php | 27 + vendor/symfony/polyfill-php70/composer.json | 33 + vendor/symfony/polyfill-util/Binary.php | 22 + .../polyfill-util/BinaryNoFuncOverload.php | 65 + .../polyfill-util/BinaryOnFuncOverload.php | 67 + vendor/symfony/polyfill-util/LICENSE | 19 + vendor/symfony/polyfill-util/README.md | 13 + vendor/symfony/polyfill-util/TestListener.php | 28 + .../polyfill-util/TestListenerForV5.php | 89 + .../polyfill-util/TestListenerForV6.php | 95 + .../polyfill-util/TestListenerForV7.php | 96 + .../polyfill-util/TestListenerTrait.php | 125 + vendor/symfony/polyfill-util/composer.json | 30 + vendor/symfony/process/.gitignore | 3 + vendor/symfony/process/CHANGELOG.md | 57 + .../process/Exception/ExceptionInterface.php | 21 + .../Exception/InvalidArgumentException.php | 21 + .../process/Exception/LogicException.php | 21 + .../Exception/ProcessFailedException.php | 54 + .../Exception/ProcessTimedOutException.php | 69 + .../process/Exception/RuntimeException.php | 21 + vendor/symfony/process/ExecutableFinder.php | 88 + vendor/symfony/process/InputStream.php | 92 + vendor/symfony/process/LICENSE | 19 + .../symfony/process/PhpExecutableFinder.php | 94 + vendor/symfony/process/PhpProcess.php | 76 + .../symfony/process/Pipes/AbstractPipes.php | 182 + .../symfony/process/Pipes/PipesInterface.php | 67 + vendor/symfony/process/Pipes/UnixPipes.php | 153 + vendor/symfony/process/Pipes/WindowsPipes.php | 191 + vendor/symfony/process/Process.php | 1746 ++++ vendor/symfony/process/ProcessBuilder.php | 280 + vendor/symfony/process/ProcessUtils.php | 123 + vendor/symfony/process/README.md | 13 + .../process/Tests/ErrorProcessInitiator.php | 36 + .../process/Tests/ExecutableFinderTest.php | 175 + .../process/Tests/NonStopableProcess.php | 47 + .../process/Tests/PhpExecutableFinderTest.php | 72 + .../symfony/process/Tests/PhpProcessTest.php | 48 + .../PipeStdinInStdoutStdErrStreamSelect.php | 72 + .../process/Tests/ProcessBuilderTest.php | 220 + .../Tests/ProcessFailedExceptionTest.php | 133 + vendor/symfony/process/Tests/ProcessTest.php | 1589 +++ .../process/Tests/ProcessUtilsTest.php | 53 + .../symfony/process/Tests/SignalListener.php | 21 + vendor/symfony/process/composer.json | 33 + vendor/symfony/process/phpunit.xml.dist | 30 + vendor/symfony/proxy-manager-bridge/LICENSE | 2 +- .../LazyProxy/PhpDumper/ProxyDumper.php | 83 +- .../proxy-manager-bridge/composer.json | 8 +- vendor/symfony/routing/Annotation/Route.php | 50 +- vendor/symfony/routing/CompiledRoute.php | 13 +- .../RoutingResolverPass.php | 49 + .../Exception/MethodNotAllowedException.php | 2 +- .../Exception/NoConfigurationException.php | 21 + .../Dumper/GeneratorDumperInterface.php | 2 +- .../Generator/Dumper/PhpGeneratorDumper.php | 14 +- .../routing/Generator/UrlGenerator.php | 94 +- .../Generator/UrlGeneratorInterface.php | 10 +- vendor/symfony/routing/LICENSE | 2 +- .../routing/Loader/AnnotationClassLoader.php | 56 +- .../Loader/AnnotationDirectoryLoader.php | 49 +- .../routing/Loader/AnnotationFileLoader.php | 16 +- .../Configurator/CollectionConfigurator.php | 81 + .../Configurator/ImportConfigurator.php | 49 + .../Loader/Configurator/RouteConfigurator.php | 34 + .../Configurator/RoutingConfigurator.php | 63 + .../Loader/Configurator/Traits/AddTrait.php | 55 + .../Loader/Configurator/Traits/RouteTrait.php | 131 + .../ServiceRouterLoader.php | 4 +- .../symfony/routing/Loader/GlobFileLoader.php | 47 + .../routing/Loader/ObjectRouteLoader.php | 2 +- .../symfony/routing/Loader/PhpFileLoader.php | 37 +- .../symfony/routing/Loader/XmlFileLoader.php | 201 +- .../symfony/routing/Loader/YamlFileLoader.php | 115 +- .../Loader/schema/routing/routing-1.0.xsd | 89 +- .../Matcher/Dumper/DumperCollection.php | 8 +- .../Matcher/Dumper/MatcherDumperInterface.php | 2 +- .../Matcher/Dumper/PhpMatcherDumper.php | 201 +- .../Matcher/Dumper/StaticPrefixCollection.php | 238 + .../Matcher/RedirectableUrlMatcher.php | 14 +- .../Matcher/RequestMatcherInterface.php | 2 + .../routing/Matcher/TraceableUrlMatcher.php | 103 +- vendor/symfony/routing/Matcher/UrlMatcher.php | 76 +- .../routing/Matcher/UrlMatcherInterface.php | 2 + vendor/symfony/routing/RequestContext.php | 8 +- vendor/symfony/routing/Route.php | 106 +- vendor/symfony/routing/RouteCollection.php | 23 +- .../routing/RouteCollectionBuilder.php | 55 +- vendor/symfony/routing/RouteCompiler.php | 121 +- vendor/symfony/routing/Router.php | 90 +- vendor/symfony/routing/RouterInterface.php | 3 + vendor/symfony/routing/composer.json | 20 +- vendor/symfony/twig-bridge/AppVariable.php | 98 +- .../twig-bridge/Command/DebugCommand.php | 146 +- .../twig-bridge/Command/LintCommand.php | 84 +- .../DataCollector/TwigDataCollector.php | 63 +- .../twig-bridge/Extension/AssetExtension.php | 82 +- .../twig-bridge/Extension/CodeExtension.php | 108 +- .../twig-bridge/Extension/DumpExtension.php | 26 +- .../Extension/ExpressionExtension.php | 6 +- .../twig-bridge/Extension/FormExtension.php | 205 +- .../Extension/HttpFoundationExtension.php | 8 +- .../Extension/HttpKernelExtension.php | 54 +- .../Extension/HttpKernelRuntime.php | 64 + .../Extension/InitRuntimeInterface.php | 23 + .../Extension/LogoutUrlExtension.php | 8 +- .../Extension/RoutingExtension.php | 22 +- .../Extension/SecurityExtension.php | 6 +- .../Extension/StopwatchExtension.php | 4 +- .../Extension/TranslationExtension.php | 36 +- .../Extension/WebLinkExtension.php | 139 + .../Extension/WorkflowExtension.php | 108 + .../twig-bridge/Extension/YamlExtension.php | 20 +- .../symfony/twig-bridge/Form/TwigRenderer.php | 7 +- .../twig-bridge/Form/TwigRendererEngine.php | 28 +- .../Form/TwigRendererEngineInterface.php | 2 + .../Form/TwigRendererInterface.php | 2 + vendor/symfony/twig-bridge/LICENSE | 2 +- vendor/symfony/twig-bridge/Node/DumpNode.php | 10 +- .../twig-bridge/Node/FormThemeNode.php | 20 +- .../twig-bridge/Node/RenderBlockNode.php | 2 +- .../Node/SearchAndRenderBlockNode.php | 7 +- .../twig-bridge/Node/StopwatchNode.php | 2 +- .../Node/TransDefaultDomainNode.php | 2 +- vendor/symfony/twig-bridge/Node/TransNode.php | 10 +- .../symfony/twig-bridge/NodeVisitor/Scope.php | 8 +- .../TranslationDefaultDomainNodeVisitor.php | 10 +- .../NodeVisitor/TranslationNodeVisitor.php | 25 +- .../bootstrap_3_horizontal_layout.html.twig | 64 +- .../views/Form/bootstrap_3_layout.html.twig | 137 +- .../bootstrap_4_horizontal_layout.html.twig | 76 + .../views/Form/bootstrap_4_layout.html.twig | 282 + .../Form/bootstrap_base_layout.html.twig | 207 + .../views/Form/form_div_layout.html.twig | 95 +- .../views/Form/foundation_5_layout.html.twig | 14 +- .../TokenParser/FormThemeTokenParser.php | 9 +- .../TokenParser/StopwatchTokenParser.php | 2 +- .../TokenParser/TransChoiceTokenParser.php | 19 +- .../TransDefaultDomainTokenParser.php | 9 +- .../TokenParser/TransTokenParser.php | 21 +- .../twig-bridge/Translation/TwigExtractor.php | 17 +- vendor/symfony/twig-bridge/TwigEngine.php | 28 +- .../twig-bridge/UndefinedCallableHandler.php | 97 + vendor/symfony/twig-bridge/composer.json | 46 +- vendor/symfony/yaml/Command/LintCommand.php | 253 + vendor/symfony/yaml/Dumper.php | 102 +- vendor/symfony/yaml/Escaper.php | 10 +- .../symfony/yaml/Exception/ParseException.php | 7 +- vendor/symfony/yaml/Inline.php | 532 +- vendor/symfony/yaml/LICENSE | 2 +- vendor/symfony/yaml/Parser.php | 592 +- vendor/symfony/yaml/Tag/TaggedValue.php | 48 + vendor/symfony/yaml/Unescaper.php | 26 +- vendor/symfony/yaml/Yaml.php | 129 +- vendor/symfony/yaml/composer.json | 13 +- vendor/twig/twig/.gitattributes | 3 + vendor/twig/twig/.php_cs.dist | 2 + vendor/twig/twig/composer.json | 14 +- vendor/twig/twig/drupal_test.sh | 52 + vendor/twig/twig/lib/Twig/BaseNodeVisitor.php | 3 + .../twig/twig/lib/Twig/Cache/Filesystem.php | 3 + vendor/twig/twig/lib/Twig/Cache/Null.php | 3 + vendor/twig/twig/lib/Twig/CacheInterface.php | 3 + vendor/twig/twig/lib/Twig/Compiler.php | 3 + .../twig/lib/Twig/ContainerRuntimeLoader.php | 3 + vendor/twig/twig/lib/Twig/Environment.php | 3 + vendor/twig/twig/lib/Twig/Error.php | 3 + vendor/twig/twig/lib/Twig/Error/Loader.php | 3 + vendor/twig/twig/lib/Twig/Error/Runtime.php | 3 + vendor/twig/twig/lib/Twig/Error/Syntax.php | 3 + .../twig/lib/Twig/ExistsLoaderInterface.php | 3 + .../twig/twig/lib/Twig/ExpressionParser.php | 3 + vendor/twig/twig/lib/Twig/Extension.php | 3 + vendor/twig/twig/lib/Twig/Extension/Core.php | 3 + vendor/twig/twig/lib/Twig/Extension/Debug.php | 3 + .../twig/twig/lib/Twig/Extension/Escaper.php | 3 + .../lib/Twig/Extension/GlobalsInterface.php | 3 + .../Twig/Extension/InitRuntimeInterface.php | 3 + .../twig/lib/Twig/Extension/Optimizer.php | 3 + .../twig/twig/lib/Twig/Extension/Profiler.php | 3 + .../twig/twig/lib/Twig/Extension/Sandbox.php | 3 + .../twig/twig/lib/Twig/Extension/Staging.php | 3 + .../twig/lib/Twig/Extension/StringLoader.php | 3 + .../twig/twig/lib/Twig/ExtensionInterface.php | 3 + vendor/twig/twig/lib/Twig/ExtensionSet.php | 14 + .../twig/lib/Twig/FactoryRuntimeLoader.php | 3 + .../Twig/FileExtensionEscapingStrategy.php | 3 + vendor/twig/twig/lib/Twig/Filter.php | 84 +- vendor/twig/twig/lib/Twig/Function.php | 74 +- vendor/twig/twig/lib/Twig/Lexer.php | 3 + vendor/twig/twig/lib/Twig/Loader/Array.php | 3 + vendor/twig/twig/lib/Twig/Loader/Chain.php | 3 + .../twig/twig/lib/Twig/Loader/Filesystem.php | 3 + vendor/twig/twig/lib/Twig/LoaderInterface.php | 3 + vendor/twig/twig/lib/Twig/Markup.php | 3 + vendor/twig/twig/lib/Twig/Node.php | 3 + vendor/twig/twig/lib/Twig/Node/AutoEscape.php | 3 + vendor/twig/twig/lib/Twig/Node/Block.php | 3 + .../twig/lib/Twig/Node/BlockReference.php | 3 + vendor/twig/twig/lib/Twig/Node/Body.php | 3 + .../twig/twig/lib/Twig/Node/CheckSecurity.php | 3 + vendor/twig/twig/lib/Twig/Node/Deprecated.php | 3 + vendor/twig/twig/lib/Twig/Node/Do.php | 3 + vendor/twig/twig/lib/Twig/Node/Embed.php | 3 + vendor/twig/twig/lib/Twig/Node/Expression.php | 3 + .../twig/lib/Twig/Node/Expression/Array.php | 3 + .../lib/Twig/Node/Expression/AssignName.php | 3 + .../twig/lib/Twig/Node/Expression/Binary.php | 3 + .../lib/Twig/Node/Expression/Binary/Add.php | 3 + .../lib/Twig/Node/Expression/Binary/And.php | 3 + .../Node/Expression/Binary/BitwiseAnd.php | 3 + .../Twig/Node/Expression/Binary/BitwiseOr.php | 3 + .../Node/Expression/Binary/BitwiseXor.php | 3 + .../Twig/Node/Expression/Binary/Concat.php | 3 + .../lib/Twig/Node/Expression/Binary/Div.php | 3 + .../Twig/Node/Expression/Binary/EndsWith.php | 3 + .../lib/Twig/Node/Expression/Binary/Equal.php | 3 + .../Twig/Node/Expression/Binary/FloorDiv.php | 3 + .../Twig/Node/Expression/Binary/Greater.php | 3 + .../Node/Expression/Binary/GreaterEqual.php | 3 + .../lib/Twig/Node/Expression/Binary/In.php | 3 + .../lib/Twig/Node/Expression/Binary/Less.php | 3 + .../Twig/Node/Expression/Binary/LessEqual.php | 3 + .../Twig/Node/Expression/Binary/Matches.php | 3 + .../lib/Twig/Node/Expression/Binary/Mod.php | 3 + .../lib/Twig/Node/Expression/Binary/Mul.php | 3 + .../Twig/Node/Expression/Binary/NotEqual.php | 3 + .../lib/Twig/Node/Expression/Binary/NotIn.php | 3 + .../lib/Twig/Node/Expression/Binary/Or.php | 3 + .../lib/Twig/Node/Expression/Binary/Power.php | 3 + .../lib/Twig/Node/Expression/Binary/Range.php | 3 + .../Node/Expression/Binary/StartsWith.php | 3 + .../lib/Twig/Node/Expression/Binary/Sub.php | 3 + .../Twig/Node/Expression/BlockReference.php | 3 + .../twig/lib/Twig/Node/Expression/Call.php | 3 + .../lib/Twig/Node/Expression/Conditional.php | 3 + .../lib/Twig/Node/Expression/Constant.php | 3 + .../twig/lib/Twig/Node/Expression/Filter.php | 3 + .../Twig/Node/Expression/Filter/Default.php | 3 + .../lib/Twig/Node/Expression/Function.php | 3 + .../twig/lib/Twig/Node/Expression/GetAttr.php | 3 + .../lib/Twig/Node/Expression/MethodCall.php | 3 + .../twig/lib/Twig/Node/Expression/Name.php | 3 + .../lib/Twig/Node/Expression/NullCoalesce.php | 3 + .../twig/lib/Twig/Node/Expression/Parent.php | 3 + .../lib/Twig/Node/Expression/TempName.php | 3 + .../twig/lib/Twig/Node/Expression/Test.php | 3 + .../Twig/Node/Expression/Test/Constant.php | 3 + .../lib/Twig/Node/Expression/Test/Defined.php | 3 + .../Twig/Node/Expression/Test/Divisibleby.php | 3 + .../lib/Twig/Node/Expression/Test/Even.php | 3 + .../lib/Twig/Node/Expression/Test/Null.php | 3 + .../lib/Twig/Node/Expression/Test/Odd.php | 3 + .../lib/Twig/Node/Expression/Test/Sameas.php | 3 + .../twig/lib/Twig/Node/Expression/Unary.php | 3 + .../lib/Twig/Node/Expression/Unary/Neg.php | 3 + .../lib/Twig/Node/Expression/Unary/Not.php | 3 + .../lib/Twig/Node/Expression/Unary/Pos.php | 3 + vendor/twig/twig/lib/Twig/Node/Flush.php | 3 + vendor/twig/twig/lib/Twig/Node/For.php | 3 + vendor/twig/twig/lib/Twig/Node/ForLoop.php | 3 + vendor/twig/twig/lib/Twig/Node/If.php | 3 + vendor/twig/twig/lib/Twig/Node/Import.php | 3 + vendor/twig/twig/lib/Twig/Node/Include.php | 3 + vendor/twig/twig/lib/Twig/Node/Macro.php | 3 + vendor/twig/twig/lib/Twig/Node/Module.php | 3 + vendor/twig/twig/lib/Twig/Node/Print.php | 3 + vendor/twig/twig/lib/Twig/Node/Sandbox.php | 3 + .../twig/lib/Twig/Node/SandboxedPrint.php | 3 + vendor/twig/twig/lib/Twig/Node/Set.php | 3 + vendor/twig/twig/lib/Twig/Node/Spaceless.php | 3 + vendor/twig/twig/lib/Twig/Node/Text.php | 3 + vendor/twig/twig/lib/Twig/Node/With.php | 3 + .../twig/lib/Twig/NodeCaptureInterface.php | 3 + .../twig/lib/Twig/NodeOutputInterface.php | 3 + vendor/twig/twig/lib/Twig/NodeTraverser.php | 3 + .../twig/lib/Twig/NodeVisitor/Escaper.php | 3 + .../twig/lib/Twig/NodeVisitor/Optimizer.php | 3 + .../lib/Twig/NodeVisitor/SafeAnalysis.php | 3 + .../twig/lib/Twig/NodeVisitor/Sandbox.php | 3 + .../twig/lib/Twig/NodeVisitorInterface.php | 3 + vendor/twig/twig/lib/Twig/Parser.php | 3 + .../twig/lib/Twig/Profiler/Dumper/Base.php | 3 + .../lib/Twig/Profiler/Dumper/Blackfire.php | 3 + .../twig/lib/Twig/Profiler/Dumper/Html.php | 3 + .../twig/lib/Twig/Profiler/Dumper/Text.php | 3 + .../lib/Twig/Profiler/Node/EnterProfile.php | 3 + .../lib/Twig/Profiler/Node/LeaveProfile.php | 3 + .../Twig/Profiler/NodeVisitor/Profiler.php | 3 + .../twig/twig/lib/Twig/Profiler/Profile.php | 3 + .../twig/lib/Twig/RuntimeLoaderInterface.php | 3 + .../twig/lib/Twig/Sandbox/SecurityError.php | 3 + .../Sandbox/SecurityNotAllowedFilterError.php | 3 + .../SecurityNotAllowedFunctionError.php | 3 + .../Sandbox/SecurityNotAllowedMethodError.php | 3 + .../SecurityNotAllowedPropertyError.php | 3 + .../Sandbox/SecurityNotAllowedTagError.php | 3 + .../twig/lib/Twig/Sandbox/SecurityPolicy.php | 3 + .../Twig/Sandbox/SecurityPolicyInterface.php | 3 + vendor/twig/twig/lib/Twig/SimpleFilter.php | 21 +- vendor/twig/twig/lib/Twig/SimpleFunction.php | 21 +- vendor/twig/twig/lib/Twig/SimpleTest.php | 21 +- vendor/twig/twig/lib/Twig/Source.php | 3 + .../lib/Twig/SourceContextLoaderInterface.php | 3 + vendor/twig/twig/lib/Twig/Template.php | 3 + vendor/twig/twig/lib/Twig/TemplateWrapper.php | 3 + vendor/twig/twig/lib/Twig/Test.php | 35 +- .../lib/Twig/Test/IntegrationTestCase.php | 3 + .../twig/twig/lib/Twig/Test/NodeTestCase.php | 3 + vendor/twig/twig/lib/Twig/Token.php | 3 + vendor/twig/twig/lib/Twig/TokenParser.php | 3 + .../twig/lib/Twig/TokenParser/AutoEscape.php | 3 + .../twig/twig/lib/Twig/TokenParser/Block.php | 3 + .../twig/lib/Twig/TokenParser/Deprecated.php | 3 + vendor/twig/twig/lib/Twig/TokenParser/Do.php | 3 + .../twig/twig/lib/Twig/TokenParser/Embed.php | 3 + .../twig/lib/Twig/TokenParser/Extends.php | 3 + .../twig/twig/lib/Twig/TokenParser/Filter.php | 3 + .../twig/twig/lib/Twig/TokenParser/Flush.php | 3 + vendor/twig/twig/lib/Twig/TokenParser/For.php | 3 + .../twig/twig/lib/Twig/TokenParser/From.php | 3 + vendor/twig/twig/lib/Twig/TokenParser/If.php | 3 + .../twig/twig/lib/Twig/TokenParser/Import.php | 3 + .../twig/lib/Twig/TokenParser/Include.php | 3 + .../twig/twig/lib/Twig/TokenParser/Macro.php | 3 + .../twig/lib/Twig/TokenParser/Sandbox.php | 3 + vendor/twig/twig/lib/Twig/TokenParser/Set.php | 3 + .../twig/lib/Twig/TokenParser/Spaceless.php | 3 + vendor/twig/twig/lib/Twig/TokenParser/Use.php | 3 + .../twig/twig/lib/Twig/TokenParser/With.php | 3 + .../twig/lib/Twig/TokenParserInterface.php | 3 + vendor/twig/twig/lib/Twig/TokenStream.php | 3 + .../lib/Twig/Util/DeprecationCollector.php | 3 + .../lib/Twig/Util/TemplateDirIterator.php | 3 + .../twig/twig/src/Cache/FilesystemCache.php | 4 +- vendor/twig/twig/src/Cache/NullCache.php | 4 +- vendor/twig/twig/src/Compiler.php | 75 +- vendor/twig/twig/src/Environment.php | 897 +- vendor/twig/twig/src/Error/Error.php | 118 +- vendor/twig/twig/src/Error/SyntaxError.php | 21 +- vendor/twig/twig/src/ExpressionParser.php | 291 +- .../twig/src/Extension/AbstractExtension.php | 25 - .../twig/twig/src/Extension/CoreExtension.php | 1185 +-- .../twig/src/Extension/DebugExtension.php | 16 +- .../twig/src/Extension/EscaperExtension.php | 349 +- .../twig/src/Extension/ExtensionInterface.php | 28 - .../twig/src/Extension/GlobalsInterface.php | 6 + .../src/Extension/InitRuntimeInterface.php | 10 + .../twig/src/Extension/OptimizerExtension.php | 12 +- .../twig/src/Extension/ProfilerExtension.php | 5 - .../twig/src/Extension/SandboxExtension.php | 52 +- .../twig/src/Extension/StagingExtension.php | 61 +- .../src/Extension/StringLoaderExtension.php | 12 +- vendor/twig/twig/src/ExtensionSet.php | 477 + vendor/twig/twig/src/Lexer.php | 191 +- vendor/twig/twig/src/Loader/ArrayLoader.php | 24 +- vendor/twig/twig/src/Loader/ChainLoader.php | 58 +- .../twig/src/Loader/ExistsLoaderInterface.php | 16 +- .../twig/twig/src/Loader/FilesystemLoader.php | 61 +- .../twig/twig/src/Loader/LoaderInterface.php | 20 +- .../Loader/SourceContextLoaderInterface.php | 21 +- vendor/twig/twig/src/Markup.php | 13 +- vendor/twig/twig/src/Node/AutoEscapeNode.php | 2 +- vendor/twig/twig/src/Node/BlockNode.php | 3 +- .../twig/twig/src/Node/BlockReferenceNode.php | 2 +- .../twig/twig/src/Node/CheckSecurityNode.php | 8 +- .../twig/twig/src/Node/CheckToStringNode.php | 7 +- vendor/twig/twig/src/Node/DeprecatedNode.php | 2 +- vendor/twig/twig/src/Node/DoNode.php | 2 +- vendor/twig/twig/src/Node/EmbedNode.php | 4 +- .../src/Node/Expression/ArrayExpression.php | 4 +- .../Expression/ArrowFunctionExpression.php | 64 + .../Node/Expression/Binary/AbstractBinary.php | 3 +- .../Node/Expression/Binary/PowerBinary.php | 15 - .../Expression/Binary/SpaceshipBinary.php | 22 + .../Expression/BlockReferenceExpression.php | 18 +- .../src/Node/Expression/CallExpression.php | 68 +- .../Node/Expression/ConditionalExpression.php | 2 +- .../Node/Expression/ConstantExpression.php | 2 +- .../Node/Expression/Filter/DefaultFilter.php | 2 +- .../src/Node/Expression/FilterExpression.php | 13 +- .../Node/Expression/FunctionExpression.php | 20 +- .../src/Node/Expression/GetAttrExpression.php | 83 +- .../Node/Expression/MethodCallExpression.php | 30 +- .../src/Node/Expression/NameExpression.php | 55 +- .../Expression/NullCoalesceExpression.php | 18 +- .../src/Node/Expression/ParentExpression.php | 2 +- .../Node/Expression/TempNameExpression.php | 2 +- .../src/Node/Expression/Test/DefinedTest.php | 9 +- .../src/Node/Expression/TestExpression.php | 17 +- .../Node/Expression/Unary/AbstractUnary.php | 3 +- .../Node/Expression/VariadicExpression.php | 24 + vendor/twig/twig/src/Node/FlushNode.php | 2 +- vendor/twig/twig/src/Node/ForLoopNode.php | 2 +- vendor/twig/twig/src/Node/ForNode.php | 4 +- vendor/twig/twig/src/Node/IfNode.php | 2 +- vendor/twig/twig/src/Node/ImportNode.php | 20 +- vendor/twig/twig/src/Node/IncludeNode.php | 2 +- vendor/twig/twig/src/Node/MacroNode.php | 53 +- vendor/twig/twig/src/Node/ModuleNode.php | 68 +- vendor/twig/twig/src/Node/Node.php | 105 +- vendor/twig/twig/src/Node/PrintNode.php | 2 +- vendor/twig/twig/src/Node/SandboxNode.php | 2 +- .../twig/twig/src/Node/SandboxedPrintNode.php | 23 +- vendor/twig/twig/src/Node/SetNode.php | 8 +- vendor/twig/twig/src/Node/SpacelessNode.php | 14 +- vendor/twig/twig/src/Node/TextNode.php | 2 +- vendor/twig/twig/src/Node/WithNode.php | 4 +- vendor/twig/twig/src/NodeTraverser.php | 28 +- .../src/NodeVisitor/AbstractNodeVisitor.php | 16 +- .../src/NodeVisitor/EscaperNodeVisitor.php | 29 +- .../MacroAutoImportNodeVisitor.php | 72 + .../src/NodeVisitor/NodeVisitorInterface.php | 9 +- .../src/NodeVisitor/OptimizerNodeVisitor.php | 78 +- .../NodeVisitor/SafeAnalysisNodeVisitor.php | 18 +- .../src/NodeVisitor/SandboxNodeVisitor.php | 18 +- vendor/twig/twig/src/Parser.php | 165 +- .../twig/src/Profiler/Dumper/BaseDumper.php | 2 +- .../src/Profiler/Dumper/BlackfireDumper.php | 8 +- .../twig/src/Profiler/Dumper/HtmlDumper.php | 4 +- .../twig/src/Profiler/Dumper/TextDumper.php | 4 +- .../src/Profiler/Node/EnterProfileNode.php | 6 +- .../src/Profiler/Node/LeaveProfileNode.php | 2 +- .../NodeVisitor/ProfilerNodeVisitor.php | 8 +- vendor/twig/twig/src/Profiler/Profile.php | 10 +- .../RuntimeLoader/FactoryRuntimeLoader.php | 2 +- .../Sandbox/SecurityNotAllowedFilterError.php | 13 +- .../SecurityNotAllowedFunctionError.php | 13 +- .../Sandbox/SecurityNotAllowedMethodError.php | 13 +- .../SecurityNotAllowedPropertyError.php | 13 +- .../Sandbox/SecurityNotAllowedTagError.php | 13 +- .../twig/twig/src/Sandbox/SecurityPolicy.php | 17 +- .../src/Sandbox/SecurityPolicyInterface.php | 11 +- vendor/twig/twig/src/Source.php | 10 +- vendor/twig/twig/src/Template.php | 359 +- vendor/twig/twig/src/TemplateWrapper.php | 52 +- .../twig/src/Test/IntegrationTestCase.php | 52 +- vendor/twig/twig/src/Test/NodeTestCase.php | 16 +- vendor/twig/twig/src/Token.php | 16 +- .../src/TokenParser/AbstractTokenParser.php | 3 + .../twig/src/TokenParser/ApplyTokenParser.php | 58 + .../src/TokenParser/AutoEscapeTokenParser.php | 41 +- .../twig/src/TokenParser/BlockTokenParser.php | 12 +- .../twig/src/TokenParser/DoTokenParser.php | 6 +- .../twig/src/TokenParser/EmbedTokenParser.php | 18 +- .../src/TokenParser/ExtendsTokenParser.php | 13 +- .../src/TokenParser/FilterTokenParser.php | 19 +- .../twig/src/TokenParser/FlushTokenParser.php | 6 +- .../twig/src/TokenParser/ForTokenParser.php | 21 +- .../twig/src/TokenParser/FromTokenParser.php | 24 +- .../twig/src/TokenParser/IfTokenParser.php | 12 +- .../src/TokenParser/ImportTokenParser.php | 12 +- .../src/TokenParser/IncludeTokenParser.php | 10 +- .../twig/src/TokenParser/MacroTokenParser.php | 15 +- .../src/TokenParser/SandboxTokenParser.php | 8 +- .../twig/src/TokenParser/SetTokenParser.php | 12 +- .../src/TokenParser/SpacelessTokenParser.php | 11 +- .../src/TokenParser/TokenParserInterface.php | 3 +- .../twig/src/TokenParser/UseTokenParser.php | 12 +- .../twig/src/TokenParser/WithTokenParser.php | 12 +- vendor/twig/twig/src/TokenStream.php | 98 +- vendor/twig/twig/src/TwigFilter.php | 40 +- vendor/twig/twig/src/TwigFunction.php | 38 +- vendor/twig/twig/src/TwigTest.php | 58 +- .../twig/src/Util/DeprecationCollector.php | 27 +- vendor/zendframework/zend-code/CHANGELOG.md | 509 + vendor/zendframework/zend-code/LICENSE.md | 13 +- vendor/zendframework/zend-code/composer.json | 75 +- .../src/Annotation/AnnotationCollection.php | 4 +- .../src/Annotation/AnnotationInterface.php | 2 +- .../src/Annotation/AnnotationManager.php | 23 +- .../Parser/DoctrineAnnotationParser.php | 27 +- .../Parser/GenericAnnotationParser.php | 39 +- .../src/Annotation/Parser/ParserInterface.php | 2 +- .../zend-code/src/DeclareStatement.php | 116 + .../src/Exception/BadMethodCallException.php | 2 +- .../src/Exception/ExceptionInterface.php | 2 +- .../Exception/InvalidArgumentException.php | 2 +- .../src/Exception/RuntimeException.php | 2 +- .../src/Generator/AbstractGenerator.php | 17 +- .../src/Generator/AbstractMemberGenerator.php | 49 +- .../zend-code/src/Generator/BodyGenerator.php | 4 +- .../src/Generator/ClassGenerator.php | 372 +- .../zend-code/src/Generator/DocBlock/Tag.php | 2 +- .../DocBlock/Tag/AbstractTypeableTag.php | 25 +- .../src/Generator/DocBlock/Tag/AuthorTag.php | 16 +- .../src/Generator/DocBlock/Tag/GenericTag.php | 14 +- .../src/Generator/DocBlock/Tag/LicenseTag.php | 14 +- .../src/Generator/DocBlock/Tag/MethodTag.php | 22 +- .../src/Generator/DocBlock/Tag/ParamTag.php | 20 +- .../Generator/DocBlock/Tag/PropertyTag.php | 16 +- .../src/Generator/DocBlock/Tag/ReturnTag.php | 4 +- .../Generator/DocBlock/Tag/TagInterface.php | 2 +- .../src/Generator/DocBlock/Tag/ThrowsTag.php | 6 +- .../src/Generator/DocBlock/Tag/VarTag.php | 68 + .../src/Generator/DocBlock/TagManager.php | 12 +- .../src/Generator/DocBlockGenerator.php | 36 +- .../Exception/ExceptionInterface.php | 2 +- .../Exception/InvalidArgumentException.php | 2 +- .../Generator/Exception/RuntimeException.php | 2 +- .../zend-code/src/Generator/FileGenerator.php | 147 +- .../src/Generator/FileGeneratorRegistry.php | 8 +- .../src/Generator/GeneratorInterface.php | 2 +- .../src/Generator/InterfaceGenerator.php | 154 + .../src/Generator/MethodGenerator.php | 170 +- .../src/Generator/ParameterGenerator.php | 239 +- .../src/Generator/PropertyGenerator.php | 90 +- .../src/Generator/PropertyValueGenerator.php | 2 +- .../src/Generator/TraitGenerator.php | 15 +- .../src/Generator/TraitUsageGenerator.php | 176 +- .../src/Generator/TraitUsageInterface.php | 21 +- .../zend-code/src/Generator/TypeGenerator.php | 169 + .../src/Generator/ValueGenerator.php | 160 +- .../Prototype/PrototypeClassFactory.php | 18 +- .../Prototype/PrototypeGenericInterface.php | 2 +- .../Generic/Prototype/PrototypeInterface.php | 2 +- .../zend-code/src/NameInformation.php | 29 +- .../src/Reflection/ClassReflection.php | 34 +- .../src/Reflection/DocBlock/Tag/AuthorTag.php | 15 +- .../Reflection/DocBlock/Tag/GenericTag.php | 15 +- .../Reflection/DocBlock/Tag/LicenseTag.php | 15 +- .../src/Reflection/DocBlock/Tag/MethodTag.php | 18 +- .../src/Reflection/DocBlock/Tag/ParamTag.php | 17 +- .../DocBlock/Tag/PhpDocTypedTagInterface.php | 2 +- .../Reflection/DocBlock/Tag/PropertyTag.php | 18 +- .../src/Reflection/DocBlock/Tag/ReturnTag.php | 15 +- .../Reflection/DocBlock/Tag/TagInterface.php | 2 +- .../src/Reflection/DocBlock/Tag/ThrowsTag.php | 12 +- .../src/Reflection/DocBlock/Tag/VarTag.php | 87 + .../src/Reflection/DocBlock/TagManager.php | 3 +- .../src/Reflection/DocBlockReflection.php | 59 +- .../Exception/BadMethodCallException.php | 2 +- .../Exception/ExceptionInterface.php | 2 +- .../Exception/InvalidArgumentException.php | 2 +- .../Reflection/Exception/RuntimeException.php | 2 +- .../src/Reflection/FileReflection.php | 51 +- .../src/Reflection/FunctionReflection.php | 59 +- .../src/Reflection/MethodReflection.php | 195 +- .../src/Reflection/ParameterReflection.php | 33 +- .../src/Reflection/PropertyReflection.php | 10 +- .../src/Reflection/ReflectionInterface.php | 2 +- .../src/Scanner/AggregateDirectoryScanner.php | 17 +- .../src/Scanner/AnnotationScanner.php | 84 +- .../src/Scanner/CachingFileScanner.php | 20 +- .../zend-code/src/Scanner/ClassScanner.php | 193 +- .../zend-code/src/Scanner/ConstantScanner.php | 21 +- .../src/Scanner/DerivedClassScanner.php | 21 +- .../src/Scanner/DirectoryScanner.php | 34 +- .../zend-code/src/Scanner/DocBlockScanner.php | 76 +- .../zend-code/src/Scanner/FileScanner.php | 11 +- .../zend-code/src/Scanner/FunctionScanner.php | 2 +- .../zend-code/src/Scanner/MethodScanner.php | 109 +- .../src/Scanner/ParameterScanner.php | 31 +- .../zend-code/src/Scanner/PropertyScanner.php | 39 +- .../src/Scanner/ScannerInterface.php | 2 +- .../src/Scanner/TokenArrayScanner.php | 165 +- .../zend-code/src/Scanner/Util.php | 22 +- .../zend-code/src/Scanner/ValueScanner.php | 2 +- .../zend-eventmanager/CHANGELOG.md | 279 + .../zend-eventmanager/CONDUCT.md | 43 + .../zend-eventmanager/composer.json | 56 +- .../zend-eventmanager/composer.lock | 1937 ++++ .../src/AbstractListenerAggregate.php | 13 +- .../zend-eventmanager/src/Event.php | 28 +- .../zend-eventmanager/src/EventInterface.php | 6 +- .../zend-eventmanager/src/EventManager.php | 551 +- .../src/EventManagerAwareInterface.php | 4 +- .../src/EventManagerAwareTrait.php | 10 +- .../src/EventManagerInterface.php | 180 +- .../src/EventsCapableInterface.php | 6 +- .../src/Exception/DomainException.php | 4 +- .../src/Exception/ExceptionInterface.php | 4 +- .../Exception/InvalidArgumentException.php | 4 +- .../Exception/InvalidCallbackException.php | 4 +- .../src/Exception/RuntimeException.php | 16 + .../src/Filter/FilterInterface.php | 14 +- .../src/Filter/FilterIterator.php | 55 +- .../zend-eventmanager/src/FilterChain.php | 30 +- .../src/LazyEventListener.php | 75 + .../zend-eventmanager/src/LazyListener.php | 122 + .../src/LazyListenerAggregate.php | 110 + .../src/ListenerAggregateInterface.php | 9 +- .../src/ListenerAggregateTrait.php | 13 +- .../src/ResponseCollection.php | 6 +- .../src/SharedEventManager.php | 287 +- .../src/SharedEventManagerInterface.php | 58 +- .../src/SharedEventsCapableInterface.php | 24 + .../Test/EventListenerIntrospectionTrait.php | 152 + 2618 files changed, 406015 insertions(+), 31377 deletions(-) create mode 100644 docs/assets/images/site_logo.svg create mode 100644 ext/planetstyles/OneNote Table Of Contents.onetoc2 create mode 100644 install/update/index.php create mode 100644 install/update/new/.htaccess create mode 100644 install/update/new/adm/images/alert_close.png create mode 100644 install/update/new/adm/images/arrow_down.gif create mode 100644 install/update/new/adm/images/arrow_left.gif create mode 100644 install/update/new/adm/images/arrow_right.gif create mode 100644 install/update/new/adm/images/arrow_up.gif create mode 100644 install/update/new/adm/images/bg_button.gif create mode 100644 install/update/new/adm/images/bg_hash1.gif create mode 100644 install/update/new/adm/images/bg_hash2.gif create mode 100644 install/update/new/adm/images/bg_hash3.gif create mode 100644 install/update/new/adm/images/bg_hash4.gif create mode 100644 install/update/new/adm/images/bg_header.gif create mode 100644 install/update/new/adm/images/bg_header.jpg create mode 100644 install/update/new/adm/images/bg_tabs_alt1.gif create mode 100644 install/update/new/adm/images/bg_tabs_alt2.gif create mode 100644 install/update/new/adm/images/cellpic3.gif create mode 100644 install/update/new/adm/images/file_conflict.gif create mode 100644 install/update/new/adm/images/file_modified.gif create mode 100644 install/update/new/adm/images/file_new.gif create mode 100644 install/update/new/adm/images/file_new_conflict.gif create mode 100644 install/update/new/adm/images/file_not_modified.gif create mode 100644 install/update/new/adm/images/file_up_to_date.gif create mode 100644 install/update/new/adm/images/gradient2b.gif create mode 100644 install/update/new/adm/images/icon_delete.gif create mode 100644 install/update/new/adm/images/icon_delete_disabled.gif create mode 100644 install/update/new/adm/images/icon_down.gif create mode 100644 install/update/new/adm/images/icon_down_disabled.gif create mode 100644 install/update/new/adm/images/icon_edit.gif create mode 100644 install/update/new/adm/images/icon_edit_disabled.gif create mode 100644 install/update/new/adm/images/icon_folder.gif create mode 100644 install/update/new/adm/images/icon_folder_link.gif create mode 100644 install/update/new/adm/images/icon_folder_lock.gif create mode 100644 install/update/new/adm/images/icon_subfolder.gif create mode 100644 install/update/new/adm/images/icon_sync.gif create mode 100644 install/update/new/adm/images/icon_sync_disabled.gif create mode 100644 install/update/new/adm/images/icon_trace.gif create mode 100644 install/update/new/adm/images/icon_up.gif create mode 100644 install/update/new/adm/images/icon_up_disabled.gif create mode 100644 install/update/new/adm/images/innerbox_bg.gif create mode 100644 install/update/new/adm/images/loading.gif create mode 100644 install/update/new/adm/images/no_avatar.gif create mode 100644 install/update/new/adm/images/no_image.png create mode 100644 install/update/new/adm/images/phpbb_logo.png create mode 100644 install/update/new/adm/images/phpbb_logo.svg create mode 100644 install/update/new/adm/images/progress_bar.gif create mode 100644 install/update/new/adm/images/spacer.gif create mode 100644 install/update/new/adm/index.php create mode 100644 install/update/new/adm/style/acp_attachments.html create mode 100644 install/update/new/adm/style/acp_avatar_options_upload.html create mode 100644 install/update/new/adm/style/acp_ban.html create mode 100644 install/update/new/adm/style/acp_contact.html create mode 100644 install/update/new/adm/style/acp_database.html create mode 100644 install/update/new/adm/style/acp_ext_actions.html create mode 100644 install/update/new/adm/style/acp_ext_list.html create mode 100644 install/update/new/adm/style/acp_forums.html create mode 100644 install/update/new/adm/style/acp_groups.html create mode 100644 install/update/new/adm/style/acp_help_phpbb.html create mode 100644 install/update/new/adm/style/acp_icons.html create mode 100644 install/update/new/adm/style/acp_language.html create mode 100644 install/update/new/adm/style/acp_main.html create mode 100644 install/update/new/adm/style/acp_modules.html create mode 100644 install/update/new/adm/style/acp_permission_roles.html create mode 100644 install/update/new/adm/style/acp_posting_buttons.html create mode 100644 install/update/new/adm/style/acp_ranks.html create mode 100644 install/update/new/adm/style/acp_search.html create mode 100644 install/update/new/adm/style/acp_styles.html create mode 100644 install/update/new/adm/style/acp_users_overview.html create mode 100644 install/update/new/adm/style/acp_users_prefs.html create mode 100644 install/update/new/adm/style/acp_users_signature.html create mode 100644 install/update/new/adm/style/admin.css create mode 100644 install/update/new/adm/style/admin.js create mode 100644 install/update/new/adm/style/ajax.js create mode 100644 install/update/new/adm/style/captcha_recaptcha.html create mode 100644 install/update/new/adm/style/installer_convert.html create mode 100644 install/update/new/adm/style/installer_footer.html create mode 100644 install/update/new/adm/style/installer_form.html create mode 100644 install/update/new/adm/style/installer_header.html create mode 100644 install/update/new/adm/style/installer_install.html create mode 100644 install/update/new/adm/style/installer_main.html create mode 100644 install/update/new/adm/style/installer_update.html create mode 100644 install/update/new/adm/style/installer_update_file_status.html create mode 100644 install/update/new/adm/style/overall_footer.html create mode 100644 install/update/new/adm/style/overall_header.html create mode 100644 install/update/new/adm/style/permission_forum_copy.html create mode 100644 install/update/new/adm/style/permission_mask.html create mode 100644 install/update/new/adm/style/permissions.js create mode 100644 install/update/new/adm/style/progress_bar.html create mode 100644 install/update/new/adm/style/simple_footer.html create mode 100644 install/update/new/adm/style/simple_header.html create mode 100644 install/update/new/assets/cookieconsent/cookieconsent.min.css create mode 100644 install/update/new/assets/cookieconsent/cookieconsent.min.js create mode 100644 install/update/new/assets/javascript/core.js create mode 100644 install/update/new/assets/javascript/editor.js create mode 100644 install/update/new/assets/javascript/installer.js create mode 100644 install/update/new/assets/javascript/jquery-3.4.1.min.js create mode 100644 install/update/new/assets/javascript/plupload.js create mode 100644 install/update/new/common.php create mode 100644 install/update/new/composer.json create mode 100644 install/update/new/composer.lock create mode 100644 install/update/new/config/default/config.yml create mode 100644 install/update/new/config/default/container/parameters.yml create mode 100644 install/update/new/config/default/container/services.yml create mode 100644 install/update/new/config/default/container/services_attachment.yml create mode 100644 install/update/new/config/default/container/services_auth.yml create mode 100644 install/update/new/config/default/container/services_avatar.yml create mode 100644 install/update/new/config/default/container/services_captcha.yml create mode 100644 install/update/new/config/default/container/services_console.yml create mode 100644 install/update/new/config/default/container/services_content.yml create mode 100644 install/update/new/config/default/container/services_cron.yml create mode 100644 install/update/new/config/default/container/services_db.yml create mode 100644 install/update/new/config/default/container/services_event.yml create mode 100644 install/update/new/config/default/container/services_feed.yml create mode 100644 install/update/new/config/default/container/services_files.yml create mode 100644 install/update/new/config/default/container/services_filesystem.yml create mode 100644 install/update/new/config/default/container/services_help.yml create mode 100644 install/update/new/config/default/container/services_hook.yml create mode 100644 install/update/new/config/default/container/services_http.yml create mode 100644 install/update/new/config/default/container/services_language.yml create mode 100644 install/update/new/config/default/container/services_migrator.yml create mode 100644 install/update/new/config/default/container/services_mimetype_guesser.yml create mode 100644 install/update/new/config/default/container/services_module.yml create mode 100644 install/update/new/config/default/container/services_notification.yml create mode 100644 install/update/new/config/default/container/services_password.yml create mode 100644 install/update/new/config/default/container/services_php.yml create mode 100644 install/update/new/config/default/container/services_profilefield.yml create mode 100644 install/update/new/config/default/container/services_report.yml create mode 100644 install/update/new/config/default/container/services_routing.yml create mode 100644 install/update/new/config/default/container/services_text_formatter.yml create mode 100644 install/update/new/config/default/container/services_text_reparser.yml create mode 100644 install/update/new/config/default/container/services_twig.yml create mode 100644 install/update/new/config/default/container/services_ucp.yml create mode 100644 install/update/new/config/default/container/services_user.yml create mode 100644 install/update/new/config/default/container/tables.yml create mode 100644 install/update/new/config/default/routing/cron.yml create mode 100644 install/update/new/config/default/routing/feed.yml create mode 100644 install/update/new/config/default/routing/help.yml create mode 100644 install/update/new/config/default/routing/report.yml create mode 100644 install/update/new/config/default/routing/routing.yml create mode 100644 install/update/new/config/default/routing/ucp.yml create mode 100644 install/update/new/config/installer/config.yml create mode 100644 install/update/new/config/installer/container/environment.yml create mode 100644 install/update/new/config/installer/container/parameters.yml create mode 100644 install/update/new/config/installer/container/services.yml create mode 100644 install/update/new/config/installer/container/services_file_updater.yml create mode 100644 install/update/new/config/installer/container/services_install_console.yml create mode 100644 install/update/new/config/installer/container/services_install_controller.yml create mode 100644 install/update/new/config/installer/container/services_install_data.yml create mode 100644 install/update/new/config/installer/container/services_install_database.yml create mode 100644 install/update/new/config/installer/container/services_install_filesystem.yml create mode 100644 install/update/new/config/installer/container/services_install_finish.yml create mode 100644 install/update/new/config/installer/container/services_install_navigation.yml create mode 100644 install/update/new/config/installer/container/services_install_obtain_data.yml create mode 100644 install/update/new/config/installer/container/services_install_requirements.yml create mode 100644 install/update/new/config/installer/container/services_installer.yml create mode 100644 install/update/new/config/installer/container/services_update_database.yml create mode 100644 install/update/new/config/installer/container/services_update_filesystem.yml create mode 100644 install/update/new/config/installer/container/services_update_obtain_data.yml create mode 100644 install/update/new/config/installer/container/services_update_requirements.yml create mode 100644 install/update/new/config/installer/routing/environment.yml create mode 100644 install/update/new/config/installer/routing/installer.yml create mode 100644 install/update/new/config/production/config.yml create mode 100644 install/update/new/config/production/container/environment.yml create mode 100644 install/update/new/config/production/container/parameters.yml create mode 100644 install/update/new/config/production/container/services.yml create mode 100644 install/update/new/config/production/routing/environment.yml create mode 100644 install/update/new/cron.php create mode 100644 install/update/new/download/file.php create mode 100644 install/update/new/ext/phpbb/viglink/acp/viglink_helper.php create mode 100644 install/update/new/ext/phpbb/viglink/composer.json create mode 100644 install/update/new/ext/phpbb/viglink/composer.lock create mode 100644 install/update/new/ext/phpbb/viglink/styles/all/theme/viglink.css create mode 100644 install/update/new/feed.php create mode 100644 install/update/new/includes/acp/acp_attachments.php create mode 100644 install/update/new/includes/acp/acp_bbcodes.php create mode 100644 install/update/new/includes/acp/acp_board.php create mode 100644 install/update/new/includes/acp/acp_database.php create mode 100644 install/update/new/includes/acp/acp_extensions.php create mode 100644 install/update/new/includes/acp/acp_forums.php create mode 100644 install/update/new/includes/acp/acp_help_phpbb.php create mode 100644 install/update/new/includes/acp/acp_main.php create mode 100644 install/update/new/includes/acp/acp_permissions.php create mode 100644 install/update/new/includes/acp/acp_prune.php create mode 100644 install/update/new/includes/acp/acp_reasons.php create mode 100644 install/update/new/includes/acp/acp_styles.php create mode 100644 install/update/new/includes/acp/acp_update.php create mode 100644 install/update/new/includes/acp/acp_users.php create mode 100644 install/update/new/includes/acp/auth.php create mode 100644 install/update/new/includes/bbcode.php create mode 100644 install/update/new/includes/compatibility_globals.php create mode 100644 install/update/new/includes/constants.php create mode 100644 install/update/new/includes/diff/engine.php create mode 100644 install/update/new/includes/functions.php create mode 100644 install/update/new/includes/functions_acp.php create mode 100644 install/update/new/includes/functions_admin.php create mode 100644 install/update/new/includes/functions_compatibility.php create mode 100644 install/update/new/includes/functions_compress.php create mode 100644 install/update/new/includes/functions_content.php create mode 100644 install/update/new/includes/functions_convert.php create mode 100644 install/update/new/includes/functions_display.php create mode 100644 install/update/new/includes/functions_download.php create mode 100644 install/update/new/includes/functions_messenger.php create mode 100644 install/update/new/includes/functions_module.php create mode 100644 install/update/new/includes/functions_posting.php create mode 100644 install/update/new/includes/functions_privmsgs.php create mode 100644 install/update/new/includes/functions_transfer.php create mode 100644 install/update/new/includes/functions_user.php create mode 100644 install/update/new/includes/mcp/mcp_ban.php create mode 100644 install/update/new/includes/mcp/mcp_logs.php create mode 100644 install/update/new/includes/mcp/mcp_main.php create mode 100644 install/update/new/includes/mcp/mcp_notes.php create mode 100644 install/update/new/includes/mcp/mcp_topic.php create mode 100644 install/update/new/includes/mcp/mcp_warn.php create mode 100644 install/update/new/includes/message_parser.php create mode 100644 install/update/new/includes/questionnaire/questionnaire.php create mode 100644 install/update/new/includes/startup.php create mode 100644 install/update/new/includes/ucp/ucp_attachments.php create mode 100644 install/update/new/includes/ucp/ucp_groups.php create mode 100644 install/update/new/includes/ucp/ucp_pm.php create mode 100644 install/update/new/includes/ucp/ucp_pm_compose.php create mode 100644 install/update/new/includes/ucp/ucp_pm_viewfolder.php create mode 100644 install/update/new/includes/ucp/ucp_profile.php create mode 100644 install/update/new/includes/ucp/ucp_register.php create mode 100644 install/update/new/includes/ucp/ucp_resend.php create mode 100644 install/update/new/includes/utf/utf_tools.php create mode 100644 install/update/new/index.php create mode 100644 install/update/new/language/en/acp/attachments.php create mode 100644 install/update/new/language/en/acp/board.php create mode 100644 install/update/new/language/en/acp/common.php create mode 100644 install/update/new/language/en/acp/forums.php create mode 100644 install/update/new/language/en/acp/permissions.php create mode 100644 install/update/new/language/en/acp/permissions_phpbb.php create mode 100644 install/update/new/language/en/acp/posting.php create mode 100644 install/update/new/language/en/acp/profile.php create mode 100644 install/update/new/language/en/acp/styles.php create mode 100644 install/update/new/language/en/captcha_recaptcha.php create mode 100644 install/update/new/language/en/cli.php create mode 100644 install/update/new/language/en/common.php create mode 100644 install/update/new/language/en/email/admin_activate.txt create mode 100644 install/update/new/language/en/email/user_forgot_password.txt create mode 100644 install/update/new/language/en/install.php create mode 100644 install/update/new/language/en/migrator.php create mode 100644 install/update/new/language/en/posting.php create mode 100644 install/update/new/language/en/ucp.php create mode 100644 install/update/new/mcp.php create mode 100644 install/update/new/memberlist.php create mode 100644 install/update/new/phpbb/auth/provider/apache.php create mode 100644 install/update/new/phpbb/auth/provider/base.php create mode 100644 install/update/new/phpbb/auth/provider/db.php create mode 100644 install/update/new/phpbb/auth/provider/ldap.php create mode 100644 install/update/new/phpbb/auth/provider/oauth/oauth.php create mode 100644 install/update/new/phpbb/auth/provider/oauth/service/base.php create mode 100644 install/update/new/phpbb/auth/provider/oauth/service/bitly.php create mode 100644 install/update/new/phpbb/auth/provider/oauth/service/facebook.php create mode 100644 install/update/new/phpbb/auth/provider/oauth/service/google.php create mode 100644 install/update/new/phpbb/auth/provider/oauth/service/service_interface.php create mode 100644 install/update/new/phpbb/auth/provider/oauth/service/twitter.php create mode 100644 install/update/new/phpbb/auth/provider/oauth/token_storage.php create mode 100644 install/update/new/phpbb/auth/provider/provider_interface.php create mode 100644 install/update/new/phpbb/avatar/driver/remote.php create mode 100644 install/update/new/phpbb/avatar/driver/upload.php create mode 100644 install/update/new/phpbb/cache/driver/memcached.php create mode 100644 install/update/new/phpbb/cache/driver/memory.php create mode 100644 install/update/new/phpbb/captcha/non_gd.php create mode 100644 install/update/new/phpbb/captcha/plugins/qa.php create mode 100644 install/update/new/phpbb/class_loader.php create mode 100644 install/update/new/phpbb/config/config.php create mode 100644 install/update/new/phpbb/config_php_file.php create mode 100644 install/update/new/phpbb/console/command/cron/run.php create mode 100644 install/update/new/phpbb/console/command/extension/enable.php create mode 100644 install/update/new/phpbb/console/command/update/check.php create mode 100644 install/update/new/phpbb/console/command/user/add.php create mode 100644 install/update/new/phpbb/content_visibility.php create mode 100644 install/update/new/phpbb/controller/helper.php create mode 100644 install/update/new/phpbb/cron/controller/cron.php create mode 100644 install/update/new/phpbb/cron/event/cron_runner_listener.php create mode 100644 install/update/new/phpbb/cron/manager.php create mode 100644 install/update/new/phpbb/cron/task/core/update_hashes.php create mode 100644 install/update/new/phpbb/cron/task/wrapper.php create mode 100644 install/update/new/phpbb/db/driver/driver.php create mode 100644 install/update/new/phpbb/db/driver/driver_interface.php create mode 100644 install/update/new/phpbb/db/driver/factory.php create mode 100644 install/update/new/phpbb/db/driver/mssql_odbc.php create mode 100644 install/update/new/phpbb/db/driver/mssqlnative.php create mode 100644 install/update/new/phpbb/db/driver/mysqli.php create mode 100644 install/update/new/phpbb/db/driver/oracle.php create mode 100644 install/update/new/phpbb/db/driver/postgres.php create mode 100644 install/update/new/phpbb/db/driver/sqlite3.php create mode 100644 install/update/new/phpbb/db/extractor/mysql_extractor.php create mode 100644 install/update/new/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php create mode 100644 install/update/new/phpbb/db/migration/data/v310/softdelete_p1.php create mode 100644 install/update/new/phpbb/db/migration/data/v32x/timezone_p3.php create mode 100644 install/update/new/phpbb/db/migration/data/v32x/user_emoji_permission.php create mode 100644 install/update/new/phpbb/db/migration/data/v32x/v328.php create mode 100644 install/update/new/phpbb/db/migration/data/v32x/v328rc1.php create mode 100644 install/update/new/phpbb/db/migration/data/v32x/v329.php create mode 100644 install/update/new/phpbb/db/migration/data/v32x/v329rc1.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/dev.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/forums_legend_limit.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/jquery_update.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/remove_attachment_flash.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/remove_email_hash.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/remove_max_pass_chars.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/reset_password.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/v330.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/v330b1.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/v330b2.php create mode 100644 install/update/new/phpbb/db/migration/data/v330/v330rc1.php create mode 100644 install/update/new/phpbb/db/migration/tool/module.php create mode 100644 install/update/new/phpbb/db/migrator.php create mode 100644 install/update/new/phpbb/db/tools/mssql.php create mode 100644 install/update/new/phpbb/db/tools/postgres.php create mode 100644 install/update/new/phpbb/db/tools/tools.php create mode 100644 install/update/new/phpbb/di/container_builder.php create mode 100644 install/update/new/phpbb/di/extension/container_configuration.php create mode 100644 install/update/new/phpbb/di/extension/core.php create mode 100644 install/update/new/phpbb/di/extension/tables.php create mode 100644 install/update/new/phpbb/di/service_collection.php create mode 100644 install/update/new/phpbb/event/md_exporter.php create mode 100644 install/update/new/phpbb/extension/extension_interface.php create mode 100644 install/update/new/phpbb/extension/manager.php create mode 100644 install/update/new/phpbb/feed/controller/feed.php create mode 100644 install/update/new/phpbb/feed/topics_active.php create mode 100644 install/update/new/phpbb/files/filespec.php create mode 100644 install/update/new/phpbb/filesystem.php create mode 100644 install/update/new/phpbb/filesystem/filesystem.php create mode 100644 install/update/new/phpbb/filesystem/filesystem_interface.php create mode 100644 install/update/new/phpbb/finder.php create mode 100644 install/update/new/phpbb/group/helper.php create mode 100644 install/update/new/phpbb/help/controller/bbcode.php create mode 100644 install/update/new/phpbb/help/controller/faq.php create mode 100644 install/update/new/phpbb/install/controller/helper.php create mode 100644 install/update/new/phpbb/install/helper/container_factory.php create mode 100644 install/update/new/phpbb/install/helper/database.php create mode 100644 install/update/new/phpbb/install/helper/iohandler/iohandler_interface.php create mode 100644 install/update/new/phpbb/install/installer_configuration.php create mode 100644 install/update/new/phpbb/install/module/install_database/task/add_config_settings.php create mode 100644 install/update/new/phpbb/install/module/install_database/task/create_schema.php create mode 100644 install/update/new/phpbb/install/module/install_database/task/set_up_database.php create mode 100644 install/update/new/phpbb/install/module/install_filesystem/task/create_config_file.php create mode 100644 install/update/new/phpbb/install/module/requirements/task/check_server_environment.php create mode 100644 install/update/new/phpbb/install/module_base.php create mode 100644 install/update/new/phpbb/language/language_file_loader.php create mode 100644 install/update/new/phpbb/lock/db.php create mode 100644 install/update/new/phpbb/lock/flock.php create mode 100644 install/update/new/phpbb/message/form.php create mode 100644 install/update/new/phpbb/mimetype/guesser.php create mode 100644 install/update/new/phpbb/notification/type/approve_post.php create mode 100644 install/update/new/phpbb/notification/type/approve_topic.php create mode 100644 install/update/new/phpbb/notification/type/base.php create mode 100644 install/update/new/phpbb/notification/type/post.php create mode 100644 install/update/new/phpbb/notification/type/topic.php create mode 100644 install/update/new/phpbb/notification/type/type_interface.php create mode 100644 install/update/new/phpbb/passwords/driver/argon2i.php create mode 100644 install/update/new/phpbb/passwords/driver/argon2id.php create mode 100644 install/update/new/phpbb/passwords/driver/base_native.php create mode 100644 install/update/new/phpbb/passwords/manager.php create mode 100644 install/update/new/phpbb/permissions.php create mode 100644 install/update/new/phpbb/plupload/plupload.php create mode 100644 install/update/new/phpbb/report/report_handler.php create mode 100644 install/update/new/phpbb/request/request.php create mode 100644 install/update/new/phpbb/request/request_interface.php create mode 100644 install/update/new/phpbb/request/type_cast_helper.php create mode 100644 install/update/new/phpbb/search/fulltext_mysql.php create mode 100644 install/update/new/phpbb/search/fulltext_native.php create mode 100644 install/update/new/phpbb/search/fulltext_postgres.php create mode 100644 install/update/new/phpbb/search/fulltext_sphinx.php create mode 100644 install/update/new/phpbb/session.php create mode 100644 install/update/new/phpbb/template/asset.php create mode 100644 install/update/new/phpbb/template/context.php create mode 100644 install/update/new/phpbb/template/template.php create mode 100644 install/update/new/phpbb/template/twig/extension.php create mode 100644 install/update/new/phpbb/template/twig/extension/avatar.php create mode 100644 install/update/new/phpbb/template/twig/extension/config.php create mode 100644 install/update/new/phpbb/template/twig/extension/username.php create mode 100644 install/update/new/phpbb/template/twig/lexer.php create mode 100644 install/update/new/phpbb/template/twig/loader.php create mode 100644 install/update/new/phpbb/template/twig/node/definenode.php create mode 100644 install/update/new/phpbb/template/twig/node/includeasset.php create mode 100644 install/update/new/phpbb/template/twig/node/includephp.php create mode 100644 install/update/new/phpbb/template/twig/tokenparser/defineparser.php create mode 100644 install/update/new/phpbb/template/twig/tokenparser/event.php create mode 100644 install/update/new/phpbb/template/twig/tokenparser/includecss.php create mode 100644 install/update/new/phpbb/template/twig/tokenparser/includejs.php create mode 100644 install/update/new/phpbb/template/twig/tokenparser/includeparser.php create mode 100644 install/update/new/phpbb/template/twig/tokenparser/includephp.php create mode 100644 install/update/new/phpbb/template/twig/tokenparser/php.php create mode 100644 install/update/new/phpbb/textformatter/acp_utils_interface.php create mode 100644 install/update/new/phpbb/textformatter/s9e/acp_utils.php create mode 100644 install/update/new/phpbb/textformatter/s9e/bbcode_merger.php create mode 100644 install/update/new/phpbb/textformatter/s9e/factory.php create mode 100644 install/update/new/phpbb/textformatter/s9e/link_helper.php create mode 100644 install/update/new/phpbb/textformatter/s9e/parser.php create mode 100644 install/update/new/phpbb/textformatter/s9e/quote_helper.php create mode 100644 install/update/new/phpbb/ucp/controller/reset_password.php create mode 100644 install/update/new/phpbb/user.php create mode 100644 install/update/new/phpbb/user_loader.php create mode 100644 install/update/new/posting.php create mode 100644 install/update/new/report.php create mode 100644 install/update/new/search.php create mode 100644 install/update/new/styles/prosilver/style.cfg create mode 100644 install/update/new/styles/prosilver/template/attachment.html create mode 100644 install/update/new/styles/prosilver/template/bbcode.html create mode 100644 install/update/new/styles/prosilver/template/captcha_recaptcha.html create mode 100644 install/update/new/styles/prosilver/template/forum_fn.js create mode 100644 install/update/new/styles/prosilver/template/forumlist_body.html create mode 100644 install/update/new/styles/prosilver/template/mcp_forum.html create mode 100644 install/update/new/styles/prosilver/template/mcp_move.html create mode 100644 install/update/new/styles/prosilver/template/mcp_topic.html create mode 100644 install/update/new/styles/prosilver/template/memberlist_body.html create mode 100644 install/update/new/styles/prosilver/template/memberlist_search.html create mode 100644 install/update/new/styles/prosilver/template/navbar_header.html create mode 100644 install/update/new/styles/prosilver/template/overall_footer.html create mode 100644 install/update/new/styles/prosilver/template/overall_header.html create mode 100644 install/update/new/styles/prosilver/template/plupload.html create mode 100644 install/update/new/styles/prosilver/template/posting_attach_body.html create mode 100644 install/update/new/styles/prosilver/template/posting_buttons.html create mode 100644 install/update/new/styles/prosilver/template/posting_layout.html create mode 100644 install/update/new/styles/prosilver/template/posting_poll_body.html create mode 100644 install/update/new/styles/prosilver/template/posting_review.html create mode 100644 install/update/new/styles/prosilver/template/posting_topic_review.html create mode 100644 install/update/new/styles/prosilver/template/search_results.html create mode 100644 install/update/new/styles/prosilver/template/simple_footer.html create mode 100644 install/update/new/styles/prosilver/template/ucp_agreement.html create mode 100644 install/update/new/styles/prosilver/template/ucp_attachments.html create mode 100644 install/update/new/styles/prosilver/template/ucp_avatar_options_upload.html create mode 100644 install/update/new/styles/prosilver/template/ucp_groups_manage.html create mode 100644 install/update/new/styles/prosilver/template/ucp_pm_history.html create mode 100644 install/update/new/styles/prosilver/template/ucp_pm_viewmessage_print.html create mode 100644 install/update/new/styles/prosilver/template/ucp_profile_profile_info.html create mode 100644 install/update/new/styles/prosilver/template/ucp_register.html create mode 100644 install/update/new/styles/prosilver/template/ucp_reset_password.html create mode 100644 install/update/new/styles/prosilver/template/viewforum_body.html create mode 100644 install/update/new/styles/prosilver/template/viewtopic_body.html create mode 100644 install/update/new/styles/prosilver/template/viewtopic_print.html create mode 100644 install/update/new/styles/prosilver/theme/colours.css create mode 100644 install/update/new/styles/prosilver/theme/common.css create mode 100644 install/update/new/styles/prosilver/theme/forms.css create mode 100644 install/update/new/styles/prosilver/theme/icons.css create mode 100644 install/update/new/styles/prosilver/theme/images/site_logo.svg create mode 100644 install/update/new/styles/prosilver/theme/plupload.css create mode 100644 install/update/new/styles/prosilver/theme/print.css create mode 100644 install/update/new/styles/prosilver/theme/stylesheet.css create mode 100644 install/update/new/ucp.php create mode 100644 install/update/new/viewforum.php create mode 100644 install/update/new/viewonline.php create mode 100644 install/update/new/viewtopic.php create mode 100644 install/update/old/.htaccess create mode 100644 install/update/old/adm/index.php create mode 100644 install/update/old/adm/style/acp_attachments.html create mode 100644 install/update/old/adm/style/acp_avatar_options_upload.html create mode 100644 install/update/old/adm/style/acp_ban.html create mode 100644 install/update/old/adm/style/acp_contact.html create mode 100644 install/update/old/adm/style/acp_database.html create mode 100644 install/update/old/adm/style/acp_ext_list.html create mode 100644 install/update/old/adm/style/acp_forums.html create mode 100644 install/update/old/adm/style/acp_groups.html create mode 100644 install/update/old/adm/style/acp_help_phpbb.html create mode 100644 install/update/old/adm/style/acp_icons.html create mode 100644 install/update/old/adm/style/acp_language.html create mode 100644 install/update/old/adm/style/acp_main.html create mode 100644 install/update/old/adm/style/acp_modules.html create mode 100644 install/update/old/adm/style/acp_permission_roles.html create mode 100644 install/update/old/adm/style/acp_posting_buttons.html create mode 100644 install/update/old/adm/style/acp_ranks.html create mode 100644 install/update/old/adm/style/acp_search.html create mode 100644 install/update/old/adm/style/acp_styles.html create mode 100644 install/update/old/adm/style/acp_users_overview.html create mode 100644 install/update/old/adm/style/acp_users_prefs.html create mode 100644 install/update/old/adm/style/acp_users_signature.html create mode 100644 install/update/old/adm/style/admin.css create mode 100644 install/update/old/adm/style/admin.js create mode 100644 install/update/old/adm/style/ajax.js create mode 100644 install/update/old/adm/style/captcha_recaptcha.html create mode 100644 install/update/old/adm/style/installer_footer.html create mode 100644 install/update/old/adm/style/overall_footer.html create mode 100644 install/update/old/adm/style/overall_header.html create mode 100644 install/update/old/adm/style/permission_forum_copy.html create mode 100644 install/update/old/adm/style/permission_mask.html create mode 100644 install/update/old/adm/style/permissions.js create mode 100644 install/update/old/adm/style/progress_bar.html create mode 100644 install/update/old/adm/style/simple_footer.html create mode 100644 install/update/old/adm/style/simple_header.html create mode 100644 install/update/old/assets/cookieconsent/cookieconsent.min.css create mode 100644 install/update/old/assets/cookieconsent/cookieconsent.min.js create mode 100644 install/update/old/assets/javascript/core.js create mode 100644 install/update/old/assets/javascript/editor.js create mode 100644 install/update/old/assets/javascript/plupload.js create mode 100644 install/update/old/common.php create mode 100644 install/update/old/composer.json create mode 100644 install/update/old/composer.lock create mode 100644 install/update/old/config/default/container/parameters.yml create mode 100644 install/update/old/config/default/container/services.yml create mode 100644 install/update/old/config/default/container/services_auth.yml create mode 100644 install/update/old/config/default/container/services_console.yml create mode 100644 install/update/old/config/default/container/services_cron.yml create mode 100644 install/update/old/config/default/container/services_password.yml create mode 100644 install/update/old/config/default/container/services_routing.yml create mode 100644 install/update/old/config/default/container/services_text_formatter.yml create mode 100644 install/update/old/config/default/container/services_twig.yml create mode 100644 install/update/old/config/default/routing/routing.yml create mode 100644 install/update/old/cron.php create mode 100644 install/update/old/download/file.php create mode 100644 install/update/old/ext/phpbb/viglink/acp/viglink_helper.php create mode 100644 install/update/old/ext/phpbb/viglink/composer.json create mode 100644 install/update/old/ext/phpbb/viglink/composer.lock create mode 100644 install/update/old/ext/phpbb/viglink/styles/all/theme/viglink.css create mode 100644 install/update/old/feed.php create mode 100644 install/update/old/includes/acp/acp_attachments.php create mode 100644 install/update/old/includes/acp/acp_bbcodes.php create mode 100644 install/update/old/includes/acp/acp_board.php create mode 100644 install/update/old/includes/acp/acp_database.php create mode 100644 install/update/old/includes/acp/acp_extensions.php create mode 100644 install/update/old/includes/acp/acp_forums.php create mode 100644 install/update/old/includes/acp/acp_help_phpbb.php create mode 100644 install/update/old/includes/acp/acp_main.php create mode 100644 install/update/old/includes/acp/acp_permissions.php create mode 100644 install/update/old/includes/acp/acp_prune.php create mode 100644 install/update/old/includes/acp/acp_reasons.php create mode 100644 install/update/old/includes/acp/acp_styles.php create mode 100644 install/update/old/includes/acp/acp_update.php create mode 100644 install/update/old/includes/acp/acp_users.php create mode 100644 install/update/old/includes/acp/auth.php create mode 100644 install/update/old/includes/bbcode.php create mode 100644 install/update/old/includes/compatibility_globals.php create mode 100644 install/update/old/includes/constants.php create mode 100644 install/update/old/includes/diff/engine.php create mode 100644 install/update/old/includes/functions.php create mode 100644 install/update/old/includes/functions_acp.php create mode 100644 install/update/old/includes/functions_admin.php create mode 100644 install/update/old/includes/functions_compatibility.php create mode 100644 install/update/old/includes/functions_compress.php create mode 100644 install/update/old/includes/functions_content.php create mode 100644 install/update/old/includes/functions_convert.php create mode 100644 install/update/old/includes/functions_display.php create mode 100644 install/update/old/includes/functions_download.php create mode 100644 install/update/old/includes/functions_messenger.php create mode 100644 install/update/old/includes/functions_module.php create mode 100644 install/update/old/includes/functions_posting.php create mode 100644 install/update/old/includes/functions_privmsgs.php create mode 100644 install/update/old/includes/functions_transfer.php create mode 100644 install/update/old/includes/functions_user.php create mode 100644 install/update/old/includes/mcp/mcp_ban.php create mode 100644 install/update/old/includes/mcp/mcp_logs.php create mode 100644 install/update/old/includes/mcp/mcp_main.php create mode 100644 install/update/old/includes/mcp/mcp_notes.php create mode 100644 install/update/old/includes/mcp/mcp_topic.php create mode 100644 install/update/old/includes/mcp/mcp_warn.php create mode 100644 install/update/old/includes/message_parser.php create mode 100644 install/update/old/includes/questionnaire/questionnaire.php create mode 100644 install/update/old/includes/startup.php create mode 100644 install/update/old/includes/ucp/ucp_attachments.php create mode 100644 install/update/old/includes/ucp/ucp_groups.php create mode 100644 install/update/old/includes/ucp/ucp_pm.php create mode 100644 install/update/old/includes/ucp/ucp_pm_compose.php create mode 100644 install/update/old/includes/ucp/ucp_pm_viewfolder.php create mode 100644 install/update/old/includes/ucp/ucp_profile.php create mode 100644 install/update/old/includes/ucp/ucp_register.php create mode 100644 install/update/old/includes/ucp/ucp_resend.php create mode 100644 install/update/old/includes/utf/utf_tools.php create mode 100644 install/update/old/index.php create mode 100644 install/update/old/language/en/acp/attachments.php create mode 100644 install/update/old/language/en/acp/board.php create mode 100644 install/update/old/language/en/acp/common.php create mode 100644 install/update/old/language/en/acp/forums.php create mode 100644 install/update/old/language/en/acp/permissions.php create mode 100644 install/update/old/language/en/acp/permissions_phpbb.php create mode 100644 install/update/old/language/en/acp/posting.php create mode 100644 install/update/old/language/en/acp/profile.php create mode 100644 install/update/old/language/en/acp/styles.php create mode 100644 install/update/old/language/en/captcha_recaptcha.php create mode 100644 install/update/old/language/en/cli.php create mode 100644 install/update/old/language/en/common.php create mode 100644 install/update/old/language/en/email/admin_activate.txt create mode 100644 install/update/old/language/en/install.php create mode 100644 install/update/old/language/en/migrator.php create mode 100644 install/update/old/language/en/posting.php create mode 100644 install/update/old/language/en/ucp.php create mode 100644 install/update/old/mcp.php create mode 100644 install/update/old/memberlist.php create mode 100644 install/update/old/phpbb/auth/provider/apache.php create mode 100644 install/update/old/phpbb/auth/provider/base.php create mode 100644 install/update/old/phpbb/auth/provider/db.php create mode 100644 install/update/old/phpbb/auth/provider/ldap.php create mode 100644 install/update/old/phpbb/auth/provider/oauth/oauth.php create mode 100644 install/update/old/phpbb/auth/provider/oauth/service/base.php create mode 100644 install/update/old/phpbb/auth/provider/oauth/service/bitly.php create mode 100644 install/update/old/phpbb/auth/provider/oauth/service/facebook.php create mode 100644 install/update/old/phpbb/auth/provider/oauth/service/google.php create mode 100644 install/update/old/phpbb/auth/provider/oauth/service/service_interface.php create mode 100644 install/update/old/phpbb/auth/provider/oauth/service/twitter.php create mode 100644 install/update/old/phpbb/auth/provider/oauth/token_storage.php create mode 100644 install/update/old/phpbb/auth/provider/provider_interface.php create mode 100644 install/update/old/phpbb/avatar/driver/remote.php create mode 100644 install/update/old/phpbb/avatar/driver/upload.php create mode 100644 install/update/old/phpbb/cache/driver/memcached.php create mode 100644 install/update/old/phpbb/cache/driver/memory.php create mode 100644 install/update/old/phpbb/captcha/non_gd.php create mode 100644 install/update/old/phpbb/captcha/plugins/qa.php create mode 100644 install/update/old/phpbb/class_loader.php create mode 100644 install/update/old/phpbb/config/config.php create mode 100644 install/update/old/phpbb/config_php_file.php create mode 100644 install/update/old/phpbb/console/command/cron/run.php create mode 100644 install/update/old/phpbb/console/command/extension/enable.php create mode 100644 install/update/old/phpbb/console/command/update/check.php create mode 100644 install/update/old/phpbb/console/command/user/add.php create mode 100644 install/update/old/phpbb/content_visibility.php create mode 100644 install/update/old/phpbb/controller/helper.php create mode 100644 install/update/old/phpbb/cron/manager.php create mode 100644 install/update/old/phpbb/cron/task/core/update_hashes.php create mode 100644 install/update/old/phpbb/cron/task/wrapper.php create mode 100644 install/update/old/phpbb/db/driver/driver.php create mode 100644 install/update/old/phpbb/db/driver/driver_interface.php create mode 100644 install/update/old/phpbb/db/driver/factory.php create mode 100644 install/update/old/phpbb/db/driver/mssql_odbc.php create mode 100644 install/update/old/phpbb/db/driver/mssqlnative.php create mode 100644 install/update/old/phpbb/db/driver/mysqli.php create mode 100644 install/update/old/phpbb/db/driver/oracle.php create mode 100644 install/update/old/phpbb/db/driver/postgres.php create mode 100644 install/update/old/phpbb/db/driver/sqlite3.php create mode 100644 install/update/old/phpbb/db/extractor/mysql_extractor.php create mode 100644 install/update/old/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php create mode 100644 install/update/old/phpbb/db/migration/data/v310/softdelete_p1.php create mode 100644 install/update/old/phpbb/db/migration/tool/module.php create mode 100644 install/update/old/phpbb/db/migrator.php create mode 100644 install/update/old/phpbb/db/tools/mssql.php create mode 100644 install/update/old/phpbb/db/tools/postgres.php create mode 100644 install/update/old/phpbb/db/tools/tools.php create mode 100644 install/update/old/phpbb/di/container_builder.php create mode 100644 install/update/old/phpbb/di/extension/container_configuration.php create mode 100644 install/update/old/phpbb/di/extension/core.php create mode 100644 install/update/old/phpbb/di/service_collection.php create mode 100644 install/update/old/phpbb/event/md_exporter.php create mode 100644 install/update/old/phpbb/extension/extension_interface.php create mode 100644 install/update/old/phpbb/extension/manager.php create mode 100644 install/update/old/phpbb/feed/controller/feed.php create mode 100644 install/update/old/phpbb/feed/topics_active.php create mode 100644 install/update/old/phpbb/files/filespec.php create mode 100644 install/update/old/phpbb/filesystem.php create mode 100644 install/update/old/phpbb/filesystem/filesystem.php create mode 100644 install/update/old/phpbb/filesystem/filesystem_interface.php create mode 100644 install/update/old/phpbb/finder.php create mode 100644 install/update/old/phpbb/group/helper.php create mode 100644 install/update/old/phpbb/help/controller/bbcode.php create mode 100644 install/update/old/phpbb/help/controller/faq.php create mode 100644 install/update/old/phpbb/install/controller/helper.php create mode 100644 install/update/old/phpbb/install/helper/container_factory.php create mode 100644 install/update/old/phpbb/install/helper/database.php create mode 100644 install/update/old/phpbb/install/helper/iohandler/iohandler_interface.php create mode 100644 install/update/old/phpbb/install/installer_configuration.php create mode 100644 install/update/old/phpbb/install/module/install_database/task/add_config_settings.php create mode 100644 install/update/old/phpbb/install/module/install_database/task/create_schema.php create mode 100644 install/update/old/phpbb/install/module/install_database/task/set_up_database.php create mode 100644 install/update/old/phpbb/install/module/install_filesystem/task/create_config_file.php create mode 100644 install/update/old/phpbb/install/module/requirements/task/check_server_environment.php create mode 100644 install/update/old/phpbb/install/module_base.php create mode 100644 install/update/old/phpbb/language/language_file_loader.php create mode 100644 install/update/old/phpbb/lock/db.php create mode 100644 install/update/old/phpbb/lock/flock.php create mode 100644 install/update/old/phpbb/message/form.php create mode 100644 install/update/old/phpbb/mimetype/guesser.php create mode 100644 install/update/old/phpbb/notification/type/approve_post.php create mode 100644 install/update/old/phpbb/notification/type/approve_topic.php create mode 100644 install/update/old/phpbb/notification/type/base.php create mode 100644 install/update/old/phpbb/notification/type/post.php create mode 100644 install/update/old/phpbb/notification/type/topic.php create mode 100644 install/update/old/phpbb/notification/type/type_interface.php create mode 100644 install/update/old/phpbb/passwords/manager.php create mode 100644 install/update/old/phpbb/permissions.php create mode 100644 install/update/old/phpbb/plupload/plupload.php create mode 100644 install/update/old/phpbb/report/report_handler.php create mode 100644 install/update/old/phpbb/request/request.php create mode 100644 install/update/old/phpbb/request/request_interface.php create mode 100644 install/update/old/phpbb/request/type_cast_helper.php create mode 100644 install/update/old/phpbb/search/fulltext_mysql.php create mode 100644 install/update/old/phpbb/search/fulltext_native.php create mode 100644 install/update/old/phpbb/search/fulltext_postgres.php create mode 100644 install/update/old/phpbb/search/fulltext_sphinx.php create mode 100644 install/update/old/phpbb/session.php create mode 100644 install/update/old/phpbb/template/asset.php create mode 100644 install/update/old/phpbb/template/context.php create mode 100644 install/update/old/phpbb/template/template.php create mode 100644 install/update/old/phpbb/template/twig/extension.php create mode 100644 install/update/old/phpbb/template/twig/lexer.php create mode 100644 install/update/old/phpbb/template/twig/loader.php create mode 100644 install/update/old/phpbb/template/twig/node/definenode.php create mode 100644 install/update/old/phpbb/template/twig/node/includeasset.php create mode 100644 install/update/old/phpbb/template/twig/node/includephp.php create mode 100644 install/update/old/phpbb/template/twig/tokenparser/defineparser.php create mode 100644 install/update/old/phpbb/template/twig/tokenparser/event.php create mode 100644 install/update/old/phpbb/template/twig/tokenparser/includecss.php create mode 100644 install/update/old/phpbb/template/twig/tokenparser/includejs.php create mode 100644 install/update/old/phpbb/template/twig/tokenparser/includeparser.php create mode 100644 install/update/old/phpbb/template/twig/tokenparser/includephp.php create mode 100644 install/update/old/phpbb/template/twig/tokenparser/php.php create mode 100644 install/update/old/phpbb/textformatter/s9e/bbcode_merger.php create mode 100644 install/update/old/phpbb/textformatter/s9e/factory.php create mode 100644 install/update/old/phpbb/textformatter/s9e/link_helper.php create mode 100644 install/update/old/phpbb/textformatter/s9e/parser.php create mode 100644 install/update/old/phpbb/textformatter/s9e/quote_helper.php create mode 100644 install/update/old/phpbb/user.php create mode 100644 install/update/old/phpbb/user_loader.php create mode 100644 install/update/old/posting.php create mode 100644 install/update/old/report.php create mode 100644 install/update/old/search.php create mode 100644 install/update/old/styles/prosilver/style.cfg create mode 100644 install/update/old/styles/prosilver/template/attachment.html create mode 100644 install/update/old/styles/prosilver/template/bbcode.html create mode 100644 install/update/old/styles/prosilver/template/captcha_recaptcha.html create mode 100644 install/update/old/styles/prosilver/template/forum_fn.js create mode 100644 install/update/old/styles/prosilver/template/forumlist_body.html create mode 100644 install/update/old/styles/prosilver/template/mcp_forum.html create mode 100644 install/update/old/styles/prosilver/template/mcp_move.html create mode 100644 install/update/old/styles/prosilver/template/mcp_topic.html create mode 100644 install/update/old/styles/prosilver/template/memberlist_body.html create mode 100644 install/update/old/styles/prosilver/template/memberlist_search.html create mode 100644 install/update/old/styles/prosilver/template/navbar_header.html create mode 100644 install/update/old/styles/prosilver/template/overall_footer.html create mode 100644 install/update/old/styles/prosilver/template/overall_header.html create mode 100644 install/update/old/styles/prosilver/template/plupload.html create mode 100644 install/update/old/styles/prosilver/template/posting_attach_body.html create mode 100644 install/update/old/styles/prosilver/template/posting_buttons.html create mode 100644 install/update/old/styles/prosilver/template/posting_layout.html create mode 100644 install/update/old/styles/prosilver/template/posting_poll_body.html create mode 100644 install/update/old/styles/prosilver/template/posting_review.html create mode 100644 install/update/old/styles/prosilver/template/posting_topic_review.html create mode 100644 install/update/old/styles/prosilver/template/search_results.html create mode 100644 install/update/old/styles/prosilver/template/simple_footer.html create mode 100644 install/update/old/styles/prosilver/template/ucp_agreement.html create mode 100644 install/update/old/styles/prosilver/template/ucp_attachments.html create mode 100644 install/update/old/styles/prosilver/template/ucp_avatar_options_upload.html create mode 100644 install/update/old/styles/prosilver/template/ucp_groups_manage.html create mode 100644 install/update/old/styles/prosilver/template/ucp_pm_history.html create mode 100644 install/update/old/styles/prosilver/template/ucp_pm_viewmessage_print.html create mode 100644 install/update/old/styles/prosilver/template/ucp_profile_profile_info.html create mode 100644 install/update/old/styles/prosilver/template/ucp_register.html create mode 100644 install/update/old/styles/prosilver/template/viewforum_body.html create mode 100644 install/update/old/styles/prosilver/template/viewtopic_body.html create mode 100644 install/update/old/styles/prosilver/template/viewtopic_print.html create mode 100644 install/update/old/styles/prosilver/theme/colours.css create mode 100644 install/update/old/styles/prosilver/theme/common.css create mode 100644 install/update/old/styles/prosilver/theme/forms.css create mode 100644 install/update/old/styles/prosilver/theme/icons.css create mode 100644 install/update/old/styles/prosilver/theme/plupload.css create mode 100644 install/update/old/styles/prosilver/theme/print.css create mode 100644 install/update/old/styles/prosilver/theme/stylesheet.css create mode 100644 install/update/old/ucp.php create mode 100644 install/update/old/viewforum.php create mode 100644 install/update/old/viewonline.php create mode 100644 install/update/old/viewtopic.php create mode 100644 language/fr/email/user_forgot_password.txt create mode 100644 styles/Milk_v2/theme/blank.css create mode 100644 styles/Milk_v2/theme/images/comment.png create mode 100644 styles/Milk_v2/theme/images/hex.png create mode 100644 styles/Milk_v2/theme/rounded.css create mode 100644 styles/Milk_v2/theme/stylesheet.css create mode 100644 vendor/google/recaptcha/.github/ISSUE_TEMPLATE/bug_report.md create mode 100644 vendor/google/recaptcha/ARCHITECTURE.md create mode 100644 vendor/google/recaptcha/app.yaml create mode 100644 vendor/guzzlehttp/guzzle/.php_cs create mode 100644 vendor/guzzlehttp/guzzle/Dockerfile create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/GuzzleException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Exception/SeekException.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/Proxy.php create mode 100644 vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php create mode 100644 vendor/guzzlehttp/guzzle/src/HandlerStack.php create mode 100644 vendor/guzzlehttp/guzzle/src/MessageFormatter.php create mode 100644 vendor/guzzlehttp/guzzle/src/Middleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/RequestOptions.php create mode 100644 vendor/guzzlehttp/guzzle/src/RetryMiddleware.php create mode 100644 vendor/guzzlehttp/guzzle/src/TransferStats.php create mode 100644 vendor/guzzlehttp/guzzle/src/functions.php create mode 100644 vendor/guzzlehttp/guzzle/src/functions_include.php create mode 100644 vendor/guzzlehttp/promises/CHANGELOG.md create mode 100644 vendor/guzzlehttp/promises/LICENSE create mode 100644 vendor/guzzlehttp/promises/Makefile create mode 100644 vendor/guzzlehttp/promises/README.md create mode 100644 vendor/guzzlehttp/promises/composer.json create mode 100644 vendor/guzzlehttp/promises/src/AggregateException.php create mode 100644 vendor/guzzlehttp/promises/src/CancellationException.php create mode 100644 vendor/guzzlehttp/promises/src/Coroutine.php create mode 100644 vendor/guzzlehttp/promises/src/EachPromise.php create mode 100644 vendor/guzzlehttp/promises/src/FulfilledPromise.php create mode 100644 vendor/guzzlehttp/promises/src/Promise.php create mode 100644 vendor/guzzlehttp/promises/src/PromiseInterface.php create mode 100644 vendor/guzzlehttp/promises/src/PromisorInterface.php create mode 100644 vendor/guzzlehttp/promises/src/RejectedPromise.php create mode 100644 vendor/guzzlehttp/promises/src/RejectionException.php create mode 100644 vendor/guzzlehttp/promises/src/TaskQueue.php create mode 100644 vendor/guzzlehttp/promises/src/TaskQueueInterface.php create mode 100644 vendor/guzzlehttp/promises/src/functions.php create mode 100644 vendor/guzzlehttp/promises/src/functions_include.php create mode 100644 vendor/guzzlehttp/psr7/CHANGELOG.md create mode 100644 vendor/guzzlehttp/psr7/LICENSE create mode 100644 vendor/guzzlehttp/psr7/README.md create mode 100644 vendor/guzzlehttp/psr7/composer.json create mode 100644 vendor/guzzlehttp/psr7/src/AppendStream.php create mode 100644 vendor/guzzlehttp/psr7/src/BufferStream.php create mode 100644 vendor/guzzlehttp/psr7/src/CachingStream.php create mode 100644 vendor/guzzlehttp/psr7/src/DroppingStream.php create mode 100644 vendor/guzzlehttp/psr7/src/FnStream.php create mode 100644 vendor/guzzlehttp/psr7/src/InflateStream.php create mode 100644 vendor/guzzlehttp/psr7/src/LazyOpenStream.php create mode 100644 vendor/guzzlehttp/psr7/src/LimitStream.php create mode 100644 vendor/guzzlehttp/psr7/src/MessageTrait.php create mode 100644 vendor/guzzlehttp/psr7/src/MultipartStream.php create mode 100644 vendor/guzzlehttp/psr7/src/NoSeekStream.php create mode 100644 vendor/guzzlehttp/psr7/src/PumpStream.php create mode 100644 vendor/guzzlehttp/psr7/src/Request.php create mode 100644 vendor/guzzlehttp/psr7/src/Response.php create mode 100644 vendor/guzzlehttp/psr7/src/Rfc7230.php create mode 100644 vendor/guzzlehttp/psr7/src/ServerRequest.php create mode 100644 vendor/guzzlehttp/psr7/src/Stream.php create mode 100644 vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php create mode 100644 vendor/guzzlehttp/psr7/src/StreamWrapper.php create mode 100644 vendor/guzzlehttp/psr7/src/UploadedFile.php create mode 100644 vendor/guzzlehttp/psr7/src/Uri.php create mode 100644 vendor/guzzlehttp/psr7/src/UriNormalizer.php create mode 100644 vendor/guzzlehttp/psr7/src/UriResolver.php create mode 100644 vendor/guzzlehttp/psr7/src/functions.php create mode 100644 vendor/guzzlehttp/psr7/src/functions_include.php create mode 100644 vendor/ocramius/package-versions/CHANGELOG.md create mode 100644 vendor/ocramius/package-versions/CONTRIBUTING.md create mode 100644 vendor/ocramius/package-versions/LICENSE create mode 100644 vendor/ocramius/package-versions/README.md create mode 100644 vendor/ocramius/package-versions/composer.json create mode 100644 vendor/ocramius/package-versions/composer.lock create mode 100644 vendor/ocramius/package-versions/infection.json.dist create mode 100644 vendor/ocramius/package-versions/phpcs.xml.dist create mode 100644 vendor/ocramius/package-versions/src/PackageVersions/FallbackVersions.php create mode 100644 vendor/ocramius/package-versions/src/PackageVersions/Installer.php create mode 100644 vendor/ocramius/package-versions/src/PackageVersions/Versions.php create mode 100644 vendor/ocramius/proxy-manager/CHANGELOG.md create mode 100644 vendor/ocramius/proxy-manager/doc-template/css/highlight.dark.css create mode 100644 vendor/ocramius/proxy-manager/doc-template/css/main.css create mode 100644 vendor/ocramius/proxy-manager/doc-template/default.twig create mode 100644 vendor/ocramius/proxy-manager/doc-template/favicon.ico create mode 100644 vendor/ocramius/proxy-manager/doc-template/img/block.png create mode 100644 vendor/ocramius/proxy-manager/doc-template/img/enf.png create mode 100644 vendor/ocramius/proxy-manager/docs/copyright.md create mode 100644 vendor/ocramius/proxy-manager/docs/credits.md create mode 100644 vendor/ocramius/proxy-manager/docs/download.md create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ProxiedMethodReturnExpression.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorValueHolderInterface.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/BindProxyProperties.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/StaticProxyConstructor.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/StaticProxyConstructor.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoading/MethodGenerator/StaticProxyConstructor.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/PrivatePropertiesMap.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/ProtectedPropertiesMap.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/StaticProxyConstructor.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/StaticProxyConstructor.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/GetMethodIfExists.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/Properties.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/UnsetPropertiesGenerator.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/Constructor.php create mode 100644 vendor/ocramius/proxy-manager/src/ProxyManager/Stub/EmptyClassStub.php create mode 100644 vendor/psr/container/.gitignore create mode 100644 vendor/psr/container/LICENSE create mode 100644 vendor/psr/container/README.md create mode 100644 vendor/psr/container/composer.json create mode 100644 vendor/psr/container/src/ContainerExceptionInterface.php create mode 100644 vendor/psr/container/src/ContainerInterface.php create mode 100644 vendor/psr/container/src/NotFoundExceptionInterface.php create mode 100644 vendor/psr/http-message/CHANGELOG.md create mode 100644 vendor/psr/http-message/LICENSE create mode 100644 vendor/psr/http-message/README.md create mode 100644 vendor/psr/http-message/composer.json create mode 100644 vendor/psr/http-message/src/MessageInterface.php create mode 100644 vendor/psr/http-message/src/RequestInterface.php create mode 100644 vendor/psr/http-message/src/ResponseInterface.php create mode 100644 vendor/psr/http-message/src/ServerRequestInterface.php create mode 100644 vendor/psr/http-message/src/StreamInterface.php create mode 100644 vendor/psr/http-message/src/UploadedFileInterface.php create mode 100644 vendor/psr/http-message/src/UriInterface.php create mode 100644 vendor/ralouphie/getallheaders/LICENSE create mode 100644 vendor/ralouphie/getallheaders/README.md create mode 100644 vendor/ralouphie/getallheaders/composer.json create mode 100644 vendor/ralouphie/getallheaders/src/getallheaders.php create mode 100644 vendor/s9e/regexp-builder/LICENSE create mode 100644 vendor/s9e/regexp-builder/composer.json create mode 100644 vendor/s9e/regexp-builder/src/Builder.php create mode 100644 vendor/s9e/regexp-builder/src/Escaper.php create mode 100644 vendor/s9e/regexp-builder/src/Input/BaseImplementation.php create mode 100644 vendor/s9e/regexp-builder/src/Input/Bytes.php create mode 100644 vendor/s9e/regexp-builder/src/Input/InputInterface.php create mode 100644 vendor/s9e/regexp-builder/src/Input/Utf8.php create mode 100644 vendor/s9e/regexp-builder/src/MetaCharacters.php create mode 100644 vendor/s9e/regexp-builder/src/Output/BaseImplementation.php create mode 100644 vendor/s9e/regexp-builder/src/Output/Bytes.php create mode 100644 vendor/s9e/regexp-builder/src/Output/JavaScript.php create mode 100644 vendor/s9e/regexp-builder/src/Output/OutputInterface.php create mode 100644 vendor/s9e/regexp-builder/src/Output/PHP.php create mode 100644 vendor/s9e/regexp-builder/src/Output/PrintableAscii.php create mode 100644 vendor/s9e/regexp-builder/src/Output/Utf8.php create mode 100644 vendor/s9e/regexp-builder/src/Passes/AbstractPass.php create mode 100644 vendor/s9e/regexp-builder/src/Passes/CoalesceOptionalStrings.php create mode 100644 vendor/s9e/regexp-builder/src/Passes/CoalesceSingleCharacterPrefix.php create mode 100644 vendor/s9e/regexp-builder/src/Passes/GroupSingleCharacters.php create mode 100644 vendor/s9e/regexp-builder/src/Passes/MergePrefix.php create mode 100644 vendor/s9e/regexp-builder/src/Passes/MergeSuffix.php create mode 100644 vendor/s9e/regexp-builder/src/Passes/PassInterface.php create mode 100644 vendor/s9e/regexp-builder/src/Passes/PromoteSingleStrings.php create mode 100644 vendor/s9e/regexp-builder/src/Passes/Recurse.php create mode 100644 vendor/s9e/regexp-builder/src/Runner.php create mode 100644 vendor/s9e/regexp-builder/src/Serializer.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/BundleGenerator.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/AttributeCollection.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/AttributeFilterChain.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/AttributeFilterCollection.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/AttributePreprocessorCollection.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/Collection.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/FilterChain.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/HostnameList.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/NormalizedCollection.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/NormalizedList.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/PluginCollection.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/RulesGeneratorList.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/Ruleset.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/SchemeList.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/TagCollection.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/TagFilterChain.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/TemplateCheckList.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/TemplateNormalizationList.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Collections/TemplateParameterCollection.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/ConfigProvider.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/FilterableConfigValue.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/AVTHelper.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/ConfigHelper.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/ElementInspector.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/FilterHelper.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/FilterSyntaxMatcher.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/NodeLocator.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/RegexpBuilder.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/RulesHelper.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/TemplateHelper.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/TemplateInspector.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/TemplateLoader.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/TemplateParser.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/IRProcessor.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/Normalizer.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/Optimizer.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/Parser.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Helpers/XPathHelper.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Items/Attribute.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Items/AttributeFilter.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Items/AttributeFilters/UrlFilter.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Items/Filter.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Items/ProgrammableCallback.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Items/Regexp.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Items/Tag.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Items/TagFilter.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Items/Template.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/JavaScript/Code.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/JavaScript/FunctionProvider.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RecursiveParser.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RecursiveParser/AbstractRecursiveMatcher.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RecursiveParser/CachingRecursiveParser.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RecursiveParser/MatcherInterface.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerator.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/AbstractOptimizer.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/BranchOutputOptimizer.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/ControlStructuresOptimizer.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/Optimizer.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/Quick.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/Serializer.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/SwitchStatement.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/AbstractConvertor.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/BooleanFunctions.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/BooleanOperators.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/Comparisons.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/Core.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/Math.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/MultiByteStringManipulation.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/SingleByteStringFunctions.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/SingleByteStringManipulation.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Rendering.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerator.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/AutoCloseIfVoid.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/AutoReopenFormattingElements.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/BlockElementsCloseFormattingElements.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/BlockElementsFosterFormattingElements.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/DisableAutoLineBreaksIfNewLinesArePreserved.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/EnforceContentModels.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/EnforceOptionalEndTags.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/IgnoreTagsInCode.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/IgnoreTextIfDisallowed.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/IgnoreWhitespaceAroundBlockElements.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/Interfaces/BooleanRulesGenerator.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/Interfaces/TargetedRulesGenerator.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/RulesGenerators/TrimFirstLineInCodeBlocks.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateCheck.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecker.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/AbstractDynamicContentCheck.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/AbstractFlashRestriction.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowAttributeSets.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowCopy.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowDisableOutputEscaping.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowDynamicAttributeNames.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowDynamicElementNames.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowElementNS.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowObjectParamsWithGeneratedName.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowPHPTags.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeCopyOf.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeDynamicCSS.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeDynamicJS.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeDynamicURL.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowXPathFunction.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateChecks/RestrictFlashScriptAccess.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/AbstractChooseOptimization.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/AbstractConstantFolding.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/AbstractNormalization.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/DeoptimizeIf.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/EnforceHTMLOmittedEndTags.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/FixUnescapedCurlyBracesInHtmlAttributes.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/FoldArithmeticConstants.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/FoldConstantXPathExpressions.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineAttributes.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineCDATA.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineElements.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineInferredValues.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineTextElements.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineXPathLiterals.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/MinifyInlineCSS.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/MinifyXPathExpressions.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/NormalizeAttributeNames.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/NormalizeElementNames.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/NormalizeUrls.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeChoose.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeChooseDeadBranches.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeChooseText.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeConditionalAttributes.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeConditionalValueOf.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/PreserveSingleSpaces.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/RemoveComments.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/RemoveInterElementWhitespace.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/RemoveLivePreviewAttributes.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/RenameLivePreviewEvent.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/SetRelNoreferrerOnTargetedLinks.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizations/UninlineAttributes.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/TemplateNormalizer.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Traits/CollectionProxy.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Traits/Configurable.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Traits/TemplateSafeness.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/UrlConfig.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Validators/AttributeName.php create mode 100644 vendor/s9e/text-formatter/src/Configurator/Validators/TagName.php create mode 100644 vendor/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/AbstractInlineMarkup.js create mode 100644 vendor/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/AbstractInlineMarkup.php create mode 100644 vendor/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/InlineSpoiler.js create mode 100644 vendor/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/InlineSpoiler.php create mode 100644 vendor/symfony/config/DependencyInjection/ConfigCachePass.php create mode 100644 vendor/symfony/config/Exception/FileLocatorFileNotFoundException.php create mode 100644 vendor/symfony/config/Loader/GlobFileLoader.php create mode 100644 vendor/symfony/config/Resource/ClassExistenceResource.php create mode 100644 vendor/symfony/config/Resource/ComposerResource.php create mode 100644 vendor/symfony/config/Resource/GlobResource.php create mode 100644 vendor/symfony/config/Resource/ReflectionClassResource.php create mode 100644 vendor/symfony/config/Util/Exception/InvalidXmlException.php create mode 100644 vendor/symfony/config/Util/Exception/XmlParsingException.php create mode 100644 vendor/symfony/console/Command/LockableTrait.php create mode 100644 vendor/symfony/console/CommandLoader/CommandLoaderInterface.php create mode 100644 vendor/symfony/console/CommandLoader/ContainerCommandLoader.php create mode 100644 vendor/symfony/console/CommandLoader/FactoryCommandLoader.php create mode 100644 vendor/symfony/console/DependencyInjection/AddConsoleCommandPass.php create mode 100644 vendor/symfony/console/Event/ConsoleErrorEvent.php create mode 100644 vendor/symfony/console/EventListener/ErrorListener.php create mode 100644 vendor/symfony/console/Input/StreamableInputInterface.php create mode 100644 vendor/symfony/console/Terminal.php create mode 100644 vendor/symfony/debug/Exception/SilencedErrorContext.php create mode 100644 vendor/symfony/dependency-injection/Argument/ArgumentInterface.php create mode 100644 vendor/symfony/dependency-injection/Argument/BoundArgument.php create mode 100644 vendor/symfony/dependency-injection/Argument/IteratorArgument.php create mode 100644 vendor/symfony/dependency-injection/Argument/RewindableGenerator.php create mode 100644 vendor/symfony/dependency-injection/Argument/ServiceClosureArgument.php create mode 100644 vendor/symfony/dependency-injection/Argument/TaggedIteratorArgument.php create mode 100644 vendor/symfony/dependency-injection/ChildDefinition.php create mode 100644 vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/AutowireExceptionPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php create mode 100644 vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolveHotPathPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolvePrivatesPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ResolveTaggedIteratorArgumentPass.php create mode 100644 vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php create mode 100644 vendor/symfony/dependency-injection/Config/AutowireServiceResource.php create mode 100644 vendor/symfony/dependency-injection/Config/ContainerParametersResource.php create mode 100644 vendor/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php create mode 100644 vendor/symfony/dependency-injection/EnvVarProcessor.php create mode 100644 vendor/symfony/dependency-injection/EnvVarProcessorInterface.php create mode 100644 vendor/symfony/dependency-injection/Exception/AutowiringFailedException.php create mode 100644 vendor/symfony/dependency-injection/Exception/EnvNotFoundException.php create mode 100644 vendor/symfony/dependency-injection/Exception/EnvParameterException.php create mode 100644 vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/AliasConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/InlineServiceConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/ParametersConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/ReferenceConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/AbstractTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/ArgumentTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutoconfigureTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/AutowireTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/BindTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/ClassTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/ConfiguratorTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/DeprecateTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/FileTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/LazyTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/PropertyTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/PublicTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/ShareTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/SyntheticTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php create mode 100644 vendor/symfony/dependency-injection/Loader/GlobFileLoader.php create mode 100644 vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php create mode 100644 vendor/symfony/dependency-injection/ServiceLocator.php create mode 100644 vendor/symfony/dependency-injection/ServiceSubscriberInterface.php create mode 100644 vendor/symfony/dependency-injection/TypedReference.php create mode 100644 vendor/symfony/http-foundation/Exception/RequestExceptionInterface.php create mode 100644 vendor/symfony/http-foundation/Exception/SuspiciousOperationException.php create mode 100644 vendor/symfony/http-foundation/File/Stream.php create mode 100644 vendor/symfony/http-foundation/Session/SessionBagProxy.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php create mode 100644 vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php create mode 100644 vendor/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/DefaultValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/RequestValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/SessionValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentResolverInterface.php create mode 100644 vendor/symfony/http-kernel/Controller/ArgumentValueResolverInterface.php create mode 100644 vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php create mode 100644 vendor/symfony/http-kernel/Controller/TraceableArgumentResolver.php create mode 100644 vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadata.php create mode 100644 vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php create mode 100644 vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactoryInterface.php create mode 100644 vendor/symfony/http-kernel/Debug/FileLinkFormatter.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/LoggerPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/ResettableServicePass.php create mode 100644 vendor/symfony/http-kernel/DependencyInjection/ServicesResetter.php create mode 100644 vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php create mode 100644 vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php create mode 100644 vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php create mode 100644 vendor/symfony/http-kernel/HttpCache/AbstractSurrogate.php create mode 100644 vendor/symfony/http-kernel/Log/Logger.php create mode 100644 vendor/symfony/http-kernel/RebootableInterface.php create mode 100644 vendor/symfony/http-kernel/Resources/welcome.html.php create mode 100644 vendor/symfony/polyfill-php56/LICENSE create mode 100644 vendor/symfony/polyfill-php56/Php56.php create mode 100644 vendor/symfony/polyfill-php56/README.md create mode 100644 vendor/symfony/polyfill-php56/bootstrap.php create mode 100644 vendor/symfony/polyfill-php56/composer.json create mode 100644 vendor/symfony/polyfill-php70/LICENSE create mode 100644 vendor/symfony/polyfill-php70/Php70.php create mode 100644 vendor/symfony/polyfill-php70/README.md create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/AssertionError.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/Error.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/ParseError.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php create mode 100644 vendor/symfony/polyfill-php70/Resources/stubs/TypeError.php create mode 100644 vendor/symfony/polyfill-php70/bootstrap.php create mode 100644 vendor/symfony/polyfill-php70/composer.json create mode 100644 vendor/symfony/polyfill-util/Binary.php create mode 100644 vendor/symfony/polyfill-util/BinaryNoFuncOverload.php create mode 100644 vendor/symfony/polyfill-util/BinaryOnFuncOverload.php create mode 100644 vendor/symfony/polyfill-util/LICENSE create mode 100644 vendor/symfony/polyfill-util/README.md create mode 100644 vendor/symfony/polyfill-util/TestListener.php create mode 100644 vendor/symfony/polyfill-util/TestListenerForV5.php create mode 100644 vendor/symfony/polyfill-util/TestListenerForV6.php create mode 100644 vendor/symfony/polyfill-util/TestListenerForV7.php create mode 100644 vendor/symfony/polyfill-util/TestListenerTrait.php create mode 100644 vendor/symfony/polyfill-util/composer.json create mode 100644 vendor/symfony/process/.gitignore create mode 100644 vendor/symfony/process/CHANGELOG.md create mode 100644 vendor/symfony/process/Exception/ExceptionInterface.php create mode 100644 vendor/symfony/process/Exception/InvalidArgumentException.php create mode 100644 vendor/symfony/process/Exception/LogicException.php create mode 100644 vendor/symfony/process/Exception/ProcessFailedException.php create mode 100644 vendor/symfony/process/Exception/ProcessTimedOutException.php create mode 100644 vendor/symfony/process/Exception/RuntimeException.php create mode 100644 vendor/symfony/process/ExecutableFinder.php create mode 100644 vendor/symfony/process/InputStream.php create mode 100644 vendor/symfony/process/LICENSE create mode 100644 vendor/symfony/process/PhpExecutableFinder.php create mode 100644 vendor/symfony/process/PhpProcess.php create mode 100644 vendor/symfony/process/Pipes/AbstractPipes.php create mode 100644 vendor/symfony/process/Pipes/PipesInterface.php create mode 100644 vendor/symfony/process/Pipes/UnixPipes.php create mode 100644 vendor/symfony/process/Pipes/WindowsPipes.php create mode 100644 vendor/symfony/process/Process.php create mode 100644 vendor/symfony/process/ProcessBuilder.php create mode 100644 vendor/symfony/process/ProcessUtils.php create mode 100644 vendor/symfony/process/README.md create mode 100644 vendor/symfony/process/Tests/ErrorProcessInitiator.php create mode 100644 vendor/symfony/process/Tests/ExecutableFinderTest.php create mode 100644 vendor/symfony/process/Tests/NonStopableProcess.php create mode 100644 vendor/symfony/process/Tests/PhpExecutableFinderTest.php create mode 100644 vendor/symfony/process/Tests/PhpProcessTest.php create mode 100644 vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php create mode 100644 vendor/symfony/process/Tests/ProcessBuilderTest.php create mode 100644 vendor/symfony/process/Tests/ProcessFailedExceptionTest.php create mode 100644 vendor/symfony/process/Tests/ProcessTest.php create mode 100644 vendor/symfony/process/Tests/ProcessUtilsTest.php create mode 100644 vendor/symfony/process/Tests/SignalListener.php create mode 100644 vendor/symfony/process/composer.json create mode 100644 vendor/symfony/process/phpunit.xml.dist create mode 100644 vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php create mode 100644 vendor/symfony/routing/Exception/NoConfigurationException.php create mode 100644 vendor/symfony/routing/Loader/Configurator/CollectionConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/ImportConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/RouteConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/RoutingConfigurator.php create mode 100644 vendor/symfony/routing/Loader/Configurator/Traits/AddTrait.php create mode 100644 vendor/symfony/routing/Loader/Configurator/Traits/RouteTrait.php create mode 100644 vendor/symfony/routing/Loader/GlobFileLoader.php create mode 100644 vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php create mode 100644 vendor/symfony/twig-bridge/Extension/HttpKernelRuntime.php create mode 100644 vendor/symfony/twig-bridge/Extension/InitRuntimeInterface.php create mode 100644 vendor/symfony/twig-bridge/Extension/WebLinkExtension.php create mode 100644 vendor/symfony/twig-bridge/Extension/WorkflowExtension.php create mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_horizontal_layout.html.twig create mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_4_layout.html.twig create mode 100644 vendor/symfony/twig-bridge/Resources/views/Form/bootstrap_base_layout.html.twig create mode 100644 vendor/symfony/twig-bridge/UndefinedCallableHandler.php create mode 100644 vendor/symfony/yaml/Command/LintCommand.php create mode 100644 vendor/symfony/yaml/Tag/TaggedValue.php create mode 100644 vendor/twig/twig/.gitattributes create mode 100644 vendor/twig/twig/drupal_test.sh create mode 100644 vendor/twig/twig/lib/Twig/ExtensionSet.php create mode 100644 vendor/twig/twig/src/ExtensionSet.php create mode 100644 vendor/twig/twig/src/Node/Expression/ArrowFunctionExpression.php create mode 100644 vendor/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php create mode 100644 vendor/twig/twig/src/Node/Expression/VariadicExpression.php create mode 100644 vendor/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php create mode 100644 vendor/twig/twig/src/TokenParser/ApplyTokenParser.php create mode 100644 vendor/zendframework/zend-code/CHANGELOG.md create mode 100644 vendor/zendframework/zend-code/src/DeclareStatement.php create mode 100644 vendor/zendframework/zend-code/src/Generator/DocBlock/Tag/VarTag.php create mode 100644 vendor/zendframework/zend-code/src/Generator/InterfaceGenerator.php create mode 100644 vendor/zendframework/zend-code/src/Generator/TypeGenerator.php create mode 100644 vendor/zendframework/zend-code/src/Reflection/DocBlock/Tag/VarTag.php create mode 100644 vendor/zendframework/zend-eventmanager/CHANGELOG.md create mode 100644 vendor/zendframework/zend-eventmanager/CONDUCT.md create mode 100644 vendor/zendframework/zend-eventmanager/composer.lock create mode 100644 vendor/zendframework/zend-eventmanager/src/Exception/RuntimeException.php create mode 100644 vendor/zendframework/zend-eventmanager/src/LazyEventListener.php create mode 100644 vendor/zendframework/zend-eventmanager/src/LazyListener.php create mode 100644 vendor/zendframework/zend-eventmanager/src/LazyListenerAggregate.php create mode 100644 vendor/zendframework/zend-eventmanager/src/SharedEventsCapableInterface.php create mode 100644 vendor/zendframework/zend-eventmanager/src/Test/EventListenerIntrospectionTrait.php diff --git a/docs/CHANGELOG.html b/docs/CHANGELOG.html index b21c0ca..a6ad489 100644 --- a/docs/CHANGELOG.html +++ b/docs/CHANGELOG.html @@ -4,7 +4,7 @@ - + phpBB • Changelog @@ -20,8 +20,8 @@
- -

phpBB 3.2.x Changelog

+ +

phpBB 3.3.x Changelog

Skip

@@ -36,7 +36,7 @@

- This is a non-exhaustive (but still near complete) changelog for phpBB 3.2.x including release candidate versions. + This is a non-exhaustive (but still near complete) changelog for phpBB 3.3.x including release candidate versions. Our thanks to all those people who've contributed bug reports and code fixes.

@@ -50,6 +50,14 @@
  1. Changelog
      +
    • Changes since 3.3.0-RC1
    • +
    • Changes since 3.3.0-b2
    • +
    • Changes since 3.3.0-b1
    • +
    • Changes since 3.2.x
    • +
    • Changes since 3.2.9-RC1
    • +
    • Changes since 3.2.8
    • +
    • Changes since 3.2.8-RC1
    • +
    • Changes since 3.2.7
    • Changes since 3.2.6
    • Changes since 3.2.6-RC1
    • Changes since 3.2.5
    • @@ -138,6 +146,390 @@
      +

      Changes since 3.3.0-RC1

      +

      Bug

      +
        +
      • [PHPBB3-15592] - "Place inline" button appears when BBcode is disabled (Post settings)
      • +
      • [PHPBB3-15902] - Out of range error with Sphinx search
      • +
      • [PHPBB3-16209] - Nginx example configuration file blocks an image in the ACP
      • +
      • [PHPBB3-16230] - Check phrasing of FILESYSTEM_CANNOT_* lang keys
      • +
      • [PHPBB3-16257] - Typo in Email Settings section
      • +
      • [PHPBB3-16260] - Missing check whether the index exists in ACP - PHP 7.4
      • +
      • [PHPBB3-16261] - Missing check whether the index exists in install - PHP 7.4
      • +
      • [PHPBB3-16262] - php 7.3 compact() calls with undefined variables causing error page
      • +
      • [PHPBB3-16263] - Apache auth provider test fails on bamboo
      • +
      • [PHPBB3-16266] - Error on clean install with PHP 7.4
      • +
      • [PHPBB3-16267] - Check whether the index exists in ACP BBcodes - PHP 7.4
      • +
      • [PHPBB3-16273] - Trying to access array offset on value of type bool in Memberlist
      • +
      • [PHPBB3-16274] - compact() calls with undefined variables in search.php
      • +
      • [PHPBB3-16276] - Undefined $mode property in bbcode_firstpass class
      • +
      • [PHPBB3-16278] - Update instructions (INSTALL.html)
      • +
      • [PHPBB3-16281] - Extensions' Tab does not show up automatically
      • +
      • [PHPBB3-16282] - Default jQuery CDN URL is outdated on new installs
      • +
      • [PHPBB3-16285] - Missing sanity checks in migrations for 3.3
      • +
      • [PHPBB3-16287] - At first ACP screen after install, error message regarding statistics submission
      • +
      • [PHPBB3-16293] - Update hashes cron produces invalid hashes while updating from 3.0
      • +
      +

      Improvement

      + +

      Security

      +
        +
      • [SECURITY-249] - Group avatar overwrite on invalid submit
      • +
      • [SECURITY-250] - Group leader can be tricked into approving user
      • +
      +

      Hardening

      +
        +
      • [SECURITY-251] - Unwanted move of PMs to folders
      • +
      • [SECURITY-252] - PMs of unsuspecting users can be marked as important
      • +
      • [SECURITY-253] - PM export without proper validation
      • +
      + +

      Changes since 3.3.0-b2

      +

      Bug

      +
        +
      • [PHPBB3-16056] - JPEG dimensions undetectable for some kind of jpeg files
      • +
      • [PHPBB3-16211] - COPPA should not be skippable
      • +
      • [PHPBB3-16226] - Cron Tasks are not running on some Apache Server
      • +
      • [PHPBB3-16227] - If click login or acp login add errors
      • +
      • [PHPBB3-16228] - BBCode definitions with an optional attribute and a non-TEXT content are not merged correctly
      • +
      • [PHPBB3-16235] - Ignore patterns in ext-sniff.sh are not processed
      • +
      • [PHPBB3-16242] - Redirect loop when install folder doesn't exist
      • +
      • [PHPBB3-16255] - PHP 7.4 Deprecation warning on curly braces offsets
      • +
      • [PHPBB3-16258] - Sample Sphinx configuration file causes delta index to only include the most recent post
      • +
      +

      Improvement

      + +

      Task

      +
        +
      • [PHPBB3-16224] - Update composer dependencies
      • +
      • [PHPBB3-16241] - Color Palette Syntax Breaks Backwards Compatibility
      • +
      • [PHPBB3-16246] - Prettify and update README Automated Testing section
      • +
      + +

      Changes since 3.3.0-b1

      +

      Bug

      + +

      Improvement

      +
        +
      • [PHPBB3-12539] - Live Member Search Improvements
      • +
      • [PHPBB3-12559] - Add forum setting to limit subforums legend to direct children only
      • +
      • [PHPBB3-12574] - Don't require the passwords_manager in the constructor of the auth plugins
      • +
      • [PHPBB3-15958] - Created forums and default forum created during install have diferent options
      • +
      • [PHPBB3-16187] - Correctly display registration using external services
      • +
      • [PHPBB3-16189] - Deprecate inet_ntop and inet_pton wrappers
      • +
      • [PHPBB3-16190] - Deprecate phpbb's checkdnsrr wrapper
      • +
      • [PHPBB3-16195] - Copy forum permissions missing paragraph
      • +
      • [PHPBB3-16196] - Remove random_compat
      • +
      • [PHPBB3-16206] - Remove offsetExists reimplementation in service_collection
      • +
      + +

      Changes since 3.2.x

      +

      Bug

      +
        +
      • [PHPBB3-14670] - Use latest symfony branch in master
      • +
      • [PHPBB3-14769] - CLI Installer Fails
      • +
      • [PHPBB3-14815] - The facebook page link is not displayed properly in membership.php
      • +
      • [PHPBB3-15255] - Language variables of filesystem exception should moved
      • +
      • [PHPBB3-15351] - Confirm box function does not work with symlink on server config
      • +
      • [PHPBB3-15377] - INCLUDECSS and INCLUDEJS broken on all front controllers (app.php)
      • +
      • [PHPBB3-15400] - app.php urls aren't working in vagrant because of nginx
      • +
      • [PHPBB3-15424] - Fix typos in coding guidelines, comments, events list & credits
      • +
      • [PHPBB3-15436] - Remove folder icons from index
      • +
      • [PHPBB3-15522] - Allow multiple color palettes per page
      • +
      • [PHPBB3-15643] - $phpbb_filesystem->resolve_path() may triggers open_basedir restriction
      • +
      • [PHPBB3-15686] - Update homestead for vagrant
      • +
      • [PHPBB3-15720] - Redirections dont need to escape ampersands
      • +
      • [PHPBB3-15725] - Testing framework fails to install extensions because of outdated assertion
      • +
      • [PHPBB3-15744] - Not all sql querys need to free memory
      • +
      • [PHPBB3-15828] - php 7.3 warning in installing 3.2.3 and installtion failed
      • +
      • [PHPBB3-15846] - Wrong id for downloadable extension group
      • +
      • [PHPBB3-15922] - Remove support for APC cache
      • +
      • [PHPBB3-15935] - Check if APCu is installed before installing it
      • +
      • [PHPBB3-15938] - Static attributes blacklist references no longer existing classes
      • +
      • [PHPBB3-15991] - Tables in ACP are displayed incorrectly
      • +
      • [PHPBB3-16003] - Post count not updated when deleting only post in topic
      • +
      • [PHPBB3-16048] - Unable to restore any backup from ACP
      • +
      • [PHPBB3-16050] - PHP warning in MCP banning tab on PHP 7.2+
      • +
      • [PHPBB3-16057] - Fix vagrant in 3.3
      • +
      • [PHPBB3-16074] - Twemoji -fe0f sequence not rendering
      • +
      • [PHPBB3-16076] - Limit attachment size by extension group
      • +
      • [PHPBB3-16131] - Force vagrant to install phpBB with a specific PHP version
      • +
      +

      Improvement

      +
        +
      • [PHPBB3-11515] - Add interface for lock classes and add new methods
      • +
      • [PHPBB3-11838] - OAuth registration from ucp_register
      • +
      • [PHPBB3-12591] - Improve breadcrumb functionality with new "Home page"/"Forum index" link
      • +
      • [PHPBB3-14465] - Remove maximum password length setting
      • +
      • [PHPBB3-14573] - Extend breadcrumb to support more pages
      • +
      • [PHPBB3-14948] - Changes 3.3 PHP requirement to 7.1
      • +
      • [PHPBB3-14972] - PHP 7.2 compatibility: wrong sizeof/count parameter type
      • +
      • [PHPBB3-15088] - Optimize code for extension manager to avoid repetitions
      • +
      • [PHPBB3-15153] - Update laravel/homestead box for vagrant
      • +
      • [PHPBB3-15203] - Missing constants during web installation
      • +
      • [PHPBB3-15257] - Extensions may indicate reasons why they cannot enable
      • +
      • [PHPBB3-15269] - Set development environment and enable all debugs when installing with vagrant
      • +
      • [PHPBB3-15274] - Migration "custom" tool does not allow parameters
      • +
      • [PHPBB3-15295] - Restore MyIsam and mysql environments to test suite
      • +
      • [PHPBB3-15330] - Twig function to know if a language string is defined
      • +
      • [PHPBB3-15413] - Login from any page and redirecting back there
      • +
      • [PHPBB3-15508] - Upgrade Twig to version 2.x
      • +
      • [PHPBB3-15564] - Switch to Invisible reCAPTCHA
      • +
      • [PHPBB3-15580] - Remove extra settings in ACP
      • +
      • [PHPBB3-15610] - Improving UI of Board Statistics in ACP
      • +
      • [PHPBB3-15646] - Add support for Argon2i passwords
      • +
      • [PHPBB3-15663] - Remove flash support in attachments
      • +
      • [PHPBB3-15664] - Manage extensions with ajax
      • +
      • [PHPBB3-15671] - Limit accepted formats to allowed extensions in avatars upload
      • +
      • [PHPBB3-15694] - Add style-related language files into .gitignore
      • +
      • [PHPBB3-15714] - Login after register
      • +
      • [PHPBB3-15718] - Update CONTRIBUTING.md
      • +
      • [PHPBB3-15772] - Hide warning message in acp when install dir is present and allow_install_dir is true
      • +
      • [PHPBB3-15905] - Create multiple twig extensions
      • +
      • [PHPBB3-15940] - Expose user_id to notif method's is_available and add event before it to load user data
      • +
      • [PHPBB3-15987] - Make table parameters an array
      • +
      • [PHPBB3-16016] - Provide a base class to implement password hashing via native functions
      • +
      • [PHPBB3-16017] - Add support for Argon2id password hashing
      • +
      • [PHPBB3-16081] - Remove eAccelerator as its latest supported PHP version is 5.3
      • +
      • [PHPBB3-16082] - Remove XCache as it does not support PHP 7
      • +
      • [PHPBB3-16115] - Add PHP 7.4 builds to travis CI
      • +
      • [PHPBB3-16144] - NO_STYLE_DATA - Provide extra fallback to board's default style for $user.
      • +
      • [PHPBB3-16148] - Add template events to acp_groups.html
      • +
      • [PHPBB3-16159] - Wrap post times in html time tag
      • +
      +

      New Feature

      +
        +
      • [PHPBB3-11327] - Implement reset password functionality via form instead of sending password
      • +
      +

      Sub-task

      + +

      Task

      +
        +
      • [PHPBB3-14584] - Move deprecated globals and functions to compatibility_*.php
      • +
      • [PHPBB3-14761] - Update travis tests setup too, move myisam from PHP 5.4 to 5.5
      • +
      • [PHPBB3-15244] - Remove the UNGLOBALISE-related code
      • +
      • [PHPBB3-15410] - Remove obsolete code from BBCodes ACP
      • +
      • [PHPBB3-15422] - Remove the unnecessary helpline function and help_line variable
      • +
      • [PHPBB3-15738] - Remove code related with safe mode
      • +
      • [PHPBB3-15746] - Update dependencies for 3.2.3
      • +
      • [PHPBB3-15921] - Update TextFormatter to 1.3.2
      • +
      • [PHPBB3-15927] - Fix ACP table display error
      • +
      • [PHPBB3-16051] - Remove mysql driver as it's unsupported
      • +
      • [PHPBB3-16052] - Branch off 3.3.x branch
      • +
      • [PHPBB3-16067] - Define trusty build environment for travis builds
      • +
      • [PHPBB3-16072] - Update s9e/text-formatter
      • +
      • [PHPBB3-16112] - Update composer dependencies to latest
      • +
      • [PHPBB3-16175] - Update composer.json dependencies for 3.3.0-b1
      • +
      • [PHPBB3-16185] - Use Xenial build environment on travis-ci
      • +
      + +

      Changes since 3.2.9-RC1

      +

      Bug

      +
        +
      • [PHPBB3-15592] - "Place inline" button appears when BBcode is disabled (Post settings)
      • +
      • [PHPBB3-16269] - Sphinx backend indexes HTML markup as keywords
      • +
      • [PHPBB3-16282] - Default jQuery CDN URL is outdated on new installs
      • +
      +

      Improvement

      +
        +
      • [PHPBB3-16271] - Add support for 3.3.x API documentation
      • +
      • [PHPBB3-16279] - Add permission for Emojii in topic title
      • +
      +

      Security

      +
        +
      • [SECURITY-249] - Group avatar overwrite on invalid submit
      • +
      • [SECURITY-250] - Group leader can be tricked into approving user
      • +
      +

      Hardening

      +
        +
      • [SECURITY-251] - Unwanted move of PMs to folders
      • +
      • [SECURITY-252] - PMs of unsuspecting users can be marked as important
      • +
      • [SECURITY-253] - PM export without proper validation
      • +
      + +

      Changes since 3.2.8

      +

      Bug

      +
        +
      • [PHPBB3-14815] - The facebook page link is not displayed properly in memberlist.php
      • +
      • [PHPBB3-15643] - $phpbb_filesystem->resolve_path() may trigger open_basedir restriction
      • +
      • [PHPBB3-15902] - Out of range error with Sphinx search
      • +
      • [PHPBB3-16056] - JPEG dimensions undetectable for some kind of jpeg files
      • +
      • [PHPBB3-16076] - Limit attachment size by extension group
      • +
      • [PHPBB3-16141] - plupload chunk_size calculation incorrect when one or more settings are 'unlimited'
      • +
      • [PHPBB3-16150] - Post title link urls not reliable when shared
      • +
      • [PHPBB3-16156] - Bots see both register and logout links in the navbar
      • +
      • [PHPBB3-16157] - Incorrect FORM_INVALID error message while sending email form
      • +
      • [PHPBB3-16181] - OAuth provider id needs to be quoted
      • +
      • [PHPBB3-16184] - Mark read button only works once
      • +
      • [PHPBB3-16199] - Guest posting CAPTCHA is being generated with no guest posting auth
      • +
      • [PHPBB3-16209] - Nginx example configuration file blocks an image in the ACP
      • +
      • [PHPBB3-16210] - Terms of use should not be skippable
      • +
      • [PHPBB3-16211] - COPPA should not be skippable
      • +
      • [PHPBB3-16216] - Disable xdebug in travis builds
      • +
      • [PHPBB3-16217] - Enable opcache in travis CI builds
      • +
      • [PHPBB3-16228] - BBCode definitions with an optional attribute and a non-TEXT content are not merged correctly
      • +
      • [PHPBB3-16242] - Redirect loop when install folder doesn't exist
      • +
      • [PHPBB3-16252] - Ignore non-BBCodes when looking for unauthorized markup
      • +
      • [PHPBB3-16257] - Typo in Email Settings section
      • +
      • [PHPBB3-16258] - Sample Sphinx configuration file causes delta index to only include the most recent post
      • +
      +

      Improvement

      +
        +
      • [PHPBB3-16084] - Pointless radio button for database backup in 3.2.7
      • +
      • [PHPBB3-16139] - Add core.viewtopic_modify_quick_reply_template_vars
      • +
      • [PHPBB3-16140] - Add new event to UCP Edit Profile Page
      • +
      • [PHPBB3-16143] - Add core events for move topics
      • +
      • [PHPBB3-16144] - NO_STYLE_DATA - Provide extra fallback to board's default style for $user.
      • +
      • [PHPBB3-16146] - Add core event for after move the forum
      • +
      • [PHPBB3-16148] - Add template events to acp_groups.html
      • +
      • [PHPBB3-16151] - Enable Emojis and rich text in forum name
      • +
      • [PHPBB3-16153] - Enable Emojis and rich text in topic title
      • +
      • [PHPBB3-16159] - Wrap post times in html time tag
      • +
      • [PHPBB3-16174] - Event for disabling cookie creation
      • +
      • [PHPBB3-16182] - Add core.generate_smilies_modify_rowset
      • +
      • [PHPBB3-16183] - Add core.generate_smilies_count_sql_before
      • +
      • [PHPBB3-16203] - Enable Emojis and rich text in sent Emails
      • +
      • [PHPBB3-16247] - Quote PM has no identifier
      • +
      • [PHPBB3-16251] - Shortened link text shouldn't override custom plugins
      • +
      +

      Task

      +
        +
      • [PHPBB3-15422] - Remove the unnecessary helpline function and help_line variable
      • +
      • [PHPBB3-16147] - Updated tokens legend in BBCodes ACP
      • +
      • [PHPBB3-16160] - Add script for generating package json file
      • +
      • [PHPBB3-16172] - Add "Rank:" or "Group rank:" in the memberlist
      • +
      • [PHPBB3-16224] - Update composer dependencies
      • +
      • [PHPBB3-16246] - Prettify and update README Automated Testing section
      • +
      + +

      Changes since 3.2.8-RC1

      +

      Bug

      +
        +
      • [PHPBB3-15467] - Permission settings do not take affect when set using All YES/NO/NEVER
      • +
      • [PHPBB3-16123] - PHP error (Array to string conversion) on new user registration if email address is banned and " Reason shown to the banned" is empty
      • +
      • [PHPBB3-16136] - Missing word in 'AUTH_PROVIDER_OAUTH_ERROR_ALREADY_LINKED'
      • +
      +

      Improvement

      +
        +
      • [PHPBB3-16134] - Exclude group leaders on group member purge
      • +
      +

      Security Issue

      +
        +
      • [SECURITY-243] - CSS injection via BBCode tag
      • +
      • [SECURITY-244] - Missing form token check when handling attachments
      • +
      • [SECURITY-246] - Missing form token check when managing BBCodes
      • +
      +

      Hardening

      +
        +
      • [SECURITY-247] - Disable MySQLi local infile to prevent local file inclusion
      • +
      + +

      Changes since 3.2.7

      +

      Bug

      +
        +
      • [PHPBB3-13175] - External accounts can be linked to more than one local account
      • +
      • [PHPBB3-14459] - Check language input for group
      • +
      • [PHPBB3-15211] - Emoji characters in forum name causing SQL errors
      • +
      • [PHPBB3-15885] - Group rank not displaying on memberlist_body
      • +
      • [PHPBB3-15897] - Unicode Characters in Attachment Comment Causes mySQL Error
      • +
      • [PHPBB3-15932] - Users can delete their attachments in the UCP, even if the post is locked
      • +
      • [PHPBB3-15961] - SMTP support for TLS is forcing use of deprecated TLS 1.0
      • +
      • [PHPBB3-15974] - The link "Back to previous page" can redirect to another page, not the previous one
      • +
      • [PHPBB3-15976] - Changing account settings without changing password resets user_passchg
      • +
      • [PHPBB3-15982] - Q&A captcha plug-in still throws PHP 7.2.x countable warning
      • +
      • [PHPBB3-16003] - Post count not updated when deleting only post in topic
      • +
      • [PHPBB3-16021] - Recognize number of Template Event instances in events.md file
      • +
      • [PHPBB3-16040] - Topic Icon with space in filename isn't displayed by viewforum_body.html
      • +
      • [PHPBB3-16048] - Unable to restore any backup from ACP
      • +
      • [PHPBB3-16050] - PHP warning in MCP banning tab on PHP 7.2+
      • +
      • [PHPBB3-16053] - BBCodes using {TEXT} in HTML tags no longer work
      • +
      • [PHPBB3-16054] - Style templates no longer able to login "from any page."
      • +
      • [PHPBB3-16055] - Unable to login using Oauth via Forums, topics or posts
      • +
      • [PHPBB3-16061] - Migrator never drops unique indexes
      • +
      • [PHPBB3-16063] - board_dst config value is not removed from config table after conversion
      • +
      • [PHPBB3-16066] - Banned or suspended user receives "The submitted form was invalid. Try submitting again."
      • +
      • [PHPBB3-16071] - Undefined index for custom attachments groups
      • +
      • [PHPBB3-16073] - Fix warning in ACP version check
      • +
      • [PHPBB3-16074] - Twemoji -fe0f sequence not rendering
      • +
      • [PHPBB3-16075] - PM filter “sent to my default usergroup” triggers array to string conversion warning
      • +
      • [PHPBB3-16080] - Warnings When a Style exists on database but not on FTP
      • +
      • [PHPBB3-16093] - Attach row template always gets displayed with JS disabled
      • +
      • [PHPBB3-16096] - MySQL full text search always uses MyISAM limits
      • +
      • [PHPBB3-16124] - Incorrect users search by last visit time in memberlist.php
      • +
      • [PHPBB3-16126] - AppVeyor builds fail due to chocolatey being unable to install PHP
      • +
      +

      Improvement

      +
        +
      • [PHPBB3-15745] - Hardcoded lang in credit line
      • +
      • [PHPBB3-15886] - Group helper functions
      • +
      • [PHPBB3-15946] - Add event - core.posting_modify_row_data
      • +
      • [PHPBB3-15967] - Unambiguous wording in user activation request email to Admin/Moderator
      • +
      • [PHPBB3-15984] - Use of 'Cache-Control: public' for serving files
      • +
      • [PHPBB3-16000] - Provide link to PHP Date Function in both ACP and UCP
      • +
      • [PHPBB3-16013] - Do not prevent username changes in ACP
      • +
      • [PHPBB3-16019] - Deny prosilver's uninstallation
      • +
      • [PHPBB3-16024] - Add core.topic_review_modify_sql_ary
      • +
      • [PHPBB3-16025] - Add 2 template events *_author_username_{append/prepend}
      • +
      • [PHPBB3-16047] - ACP Private Messages: Wording could be better
      • +
      • [PHPBB3-16058] - Remove sudo required from travis config
      • +
      • [PHPBB3-16065] - Undefined index: user_ip in oauth.php
      • +
      • [PHPBB3-16068] - Incorrect docblock parameter types
      • +
      • [PHPBB3-16070] - Remove support for WebSTAR and Xitami
      • +
      • [PHPBB3-16078] - Use chrome webdriver for UI tests
      • +
      • [PHPBB3-16089] - Add core.confirm_box_ajax_before
      • +
      • [PHPBB3-16097] - Add core.viewtopic_gen_sort_selects_before
      • +
      • [PHPBB3-16102] - Add core.posting_modify_post_subject
      • +
      • [PHPBB3-16103] - Add core.pm_modify_message_subject
      • +
      • [PHPBB3-16106] - Add core.mcp_main_before
      • +
      • [PHPBB3-16107] - Add mcp_move_destination_forum_before|after
      • +
      • [PHPBB3-16108] - Add topiclist_row_topic_by_author_before|after
      • +
      • [PHPBB3-16109] - Custom Profile Field visibility is incorrectly explained
      • +
      • [PHPBB3-16111] - Add core.message_history_modify_sql_ary
      • +
      • [PHPBB3-16113] - Add core.mcp_topic_modify_sql_ary
      • +
      • [PHPBB3-16114] - Add 2 mcp_topic_post_author_full_{append/prepend}
      • +
      • [PHPBB3-16127] - Add UI for Mass email $max_chunk_size
      • +
      • [PHPBB3-16129] - The attachment's ALT tag is supposed to describe the image, not the file.
      • +
      +

      Task

      +
        +
      • [PHPBB3-16067] - Define trusty build environment for travis builds
      • +
      • [PHPBB3-16112] - Update composer dependencies to latest
      • +
      • [PHPBB3-16119] - The text input for poll question has a too high maxlength attribute
      • +
      +

      Hardening

      + +

      Changes since 3.2.6

      Bug

        diff --git a/docs/CREDITS.txt b/docs/CREDITS.txt index 90e9a31..64f5588 100644 --- a/docs/CREDITS.txt +++ b/docs/CREDITS.txt @@ -1,7 +1,7 @@ /** * -* phpBB © Copyright phpBB Limited 2003-2016 -* http://www.phpbb.com +* phpBB © Copyright phpBB Limited 2003-2019 +* https://www.phpbb.com * * phpBB is free software. You can redistribute it and/or modify it * under the terms of the GNU General Public License, version 2 (GPL-2.0) @@ -27,7 +27,6 @@ phpBB Developers: bantu (Andreas Fischer) Derky (Derk Ruitenbeek) Elsensee (Oliver Schramm) Hanakin (Michael Miday) - MichaelC (Michael Cullum) Nicofuma (Tristan Darricau) rubencm (Rubén Calvo) @@ -63,6 +62,7 @@ phpBB Developers: A_Jelly_Doughnut (Josh Woody) [01/2010 - 11/2010] igorw (Igor Wiedler) [08/2010 - 02/2013] imkingdavid (David King) [11/2012 - 06/2014] kellanved (Henry Sudhof) [04/2007 - 03/2011] + MichaelC (Michael Cullum) [11/2017 - 09/2019] nickvergessen (Joas Schilling)[04/2010 - 12/2015] Oleg (Oleg Pudeyev) [01/2011 - 05/2013] prototech (Cesar Gallegos) [01/2014 - 12/2016] @@ -84,10 +84,10 @@ prosilver by subBlue Design, Tom Beddard, (c) 2004 phpBB Limited phpBB contains code from the following applications: -LGPL licenced: +LGPL licensed: Smarty (c) 2001, 2002 by ispi of Lincoln, Inc, http://smarty.php.net/ -GPL licenced: +GPL licensed: phpMyAdmin (c) 2001, 2003 phpMyAdmin Devel team, http://www.phpmyadmin.net/ Jabber Class (c) 2006 Flyspray.org, http://www.flyspray.org/ Chora (c) 2000-2006, The Horde Project. http://horde.org/chora/ @@ -101,7 +101,7 @@ Pear (c) 2001-2004 PHP Group, http://pear.php.net Text_Diff-0.2.1 http://pear.php.net/package/Text_Diff -MIT licenced: +MIT licensed: Symfony2 (c) 2004-2011 Fabien Potencier, https://symfony.com/ Cookie Consent (c) 2015 Silktide Ltd, https://cookieconsent.insites.com diff --git a/docs/FAQ.html b/docs/FAQ.html index 09ee6c1..5e0403e 100644 --- a/docs/FAQ.html +++ b/docs/FAQ.html @@ -4,7 +4,7 @@ - + phpBB • FAQ @@ -20,9 +20,9 @@
        - -

        phpBB 3.2.x FAQ

        -

        phpBB 3.2.x frequently asked questions

        + +

        phpBB 3.3.x FAQ

        +

        phpBB 3.3.x frequently asked questions

        Skip

        @@ -249,7 +249,7 @@ I want to sue you because i think you host an illegal board!
        -

        Please read the paragraph about permissions in our extensive online documentation.

        +

        Please read the paragraph about permissions in our extensive online documentation.

        @@ -305,7 +305,7 @@ I want to sue you because i think you host an illegal board!
        -

        Please read our extensive user documentation first, it may just explain what you want to know.

        +

        Please read our extensive user documentation first, it may just explain what you want to know.

        Feel free to search our community forum for the information you require. PLEASE DO NOT post your question without having first used search, chances are someone has already asked and answered your question. You can find our board here:

        diff --git a/docs/INSTALL.html b/docs/INSTALL.html index 4f7f07d..d196403 100644 --- a/docs/INSTALL.html +++ b/docs/INSTALL.html @@ -4,7 +4,7 @@ - + phpBB • Install @@ -20,9 +20,9 @@
        - -

        phpBB 3.2.x Install

        -

        phpBB 3.2.x Installation, updating and conversion informations

        + +

        phpBB 3.3.x Install

        +

        phpBB 3.3.x Installation, updating and conversion information

        Skip

        @@ -44,7 +44,7 @@

        A basic overview of running phpBB can be found in the accompanying README file. Please ensure you read that document in addition to this! For more detailed information on using, installing, - updating and converting phpBB you should read the documentation + updating and converting phpBB you should read the documentation available online.

        @@ -59,7 +59,7 @@
      • Quick install
      • Requirements
      • New installation
      • -
      • Updating from stable releases of phpBB 3.2.x +
      • Updating from stable releases of phpBB 3.3.x
        1. Full package
        2. Changed files
        3. @@ -68,8 +68,8 @@
        4. All package types
      • -
      • Updating from phpBB 3.0.x/3.1.x to phpBB 3.2.x
      • -
      • Conversion from phpBB 2.0.x to phpBB 3.2.x +
      • Updating from phpBB 3.0.x/3.1.x to phpBB 3.2.x or phpBB 3.3.x
      • +
      • Conversion from phpBB 2.0.x to phpBB 3.3.x
        1. Requirements before converting
        2. Converting
        3. @@ -101,18 +101,18 @@
          -

          If you have basic knowledge of using FTP and are sure your hosting service or server will run phpBB3 you can use these steps to quickly get started. For a more detailed explanation you should skip this and go to section 2 below.

          +

          If you have basic knowledge of using FTP and are sure your hosting service or server will run phpBB you can use these steps to quickly get started. For a more detailed explanation you should skip this and go to section 2 below.

            -
          1. Decompress the phpBB3 archive to a local directory on your system.
          2. +
          3. Decompress the phpBB archive to a local directory on your system.
          4. Upload all the files contained in this archive (retaining the directory structure) to a web accessible directory on your server or hosting account.
          5. Change the permissions on config.php to be writable by all (666 or -rw-rw-rw- within your FTP Client)
          6. Change the permissions on the following directories to be writable by all (777 or -rwxrwxrwx within your FTP Client):
            store/, cache/, files/ and images/avatars/upload/.
          7. -
          8. Point your web browser to the location where you uploaded the phpBB3 files with the addition of install/app.php or simply install/, e.g. http://www.example.com/phpBB3/install/app.php, http://www.example.com/forum/install/.
          9. +
          10. Point your web browser to the location where you uploaded the phpBB files with the addition of install/app.php or simply install/, e.g. http://www.example.com/phpBB3/install/app.php, http://www.example.com/forum/install/.
          11. Click the INSTALL tab, follow the steps and fill out all the requested information.
          12. Change the permissions on config.php to be writable only by yourself (644 or -rw-r--r-- within your FTP Client)
          13. -
          14. phpBB3 should now be available, please MAKE SURE you read at least Section 6 below for important, security related post-installation instructions, and also take note of Section 7 regarding anti-spam measures.
          15. +
          16. phpBB should now be available, please MAKE SURE you read at least Section 6 below for important, security related post-installation instructions, and also take note of Section 7 regarding anti-spam measures.

          If you experienced problems or do not know how to proceed with any of the steps above please read the rest of this document.

          @@ -133,13 +133,13 @@
          -

          phpBB 3.2.x has a few requirements which must be met before you are able to install and use it.

          +

          phpBB 3.3.x has a few requirements which must be met before you are able to install and use it.

          • A webserver or web hosting account running on any major Operating System with support for PHP
          • A SQL database system, one of:
              -
            • MySQL 3.23 or above (MySQLi supported)
            • +
            • MySQL 4.1.3 or above (MySQLi required)
            • MariaDB 5.1 or above
            • PostgreSQL 8.3+
            • SQLite 3.6.15+
            • @@ -147,10 +147,11 @@
            • Oracle
          • -
          • PHP 5.4.7+ but less than PHP 7.3 with support for the database you intend to use.
          • +
          • PHP 7.1.3+ up to and including PHP 7.4 with support for the database you intend to use.
          • The following PHP modules are required:
            • json
            • +
            • XML support
          • getimagesize() function must be enabled.
          • @@ -158,13 +159,12 @@
            • zlib Compression support
            • Remote FTP support
            • -
            • XML support
            • GD Support
          -

          If your server or hosting account does not meet the requirements above then you will be unable to install phpBB 3.2.x.

          +

          If your server or hosting account does not meet the requirements above then you will be unable to install phpBB 3.3.x.

          @@ -255,7 +255,7 @@
          -

          4. Updating from stable releases of phpBB 3.2.x

          +

          4. Updating from stable releases of phpBB 3.3.x

          @@ -280,7 +280,7 @@

          This package is meant for those wanting to only replace the files that were changed between a previous version and the latest version.

          -

          This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.2.0 you should select the appropriate phpBB-3.2.1-files.zip/tar.bz2 file.

          +

          This package contains a number of archives, each contains the files changed from a given release to the latest version. You should select the appropriate archive for your current version, e.g. if you currently have 3.3.0 you should select the appropriate phpBB-3.3.1-files.zip/tar.bz2 file.

          The directory structure has been preserved, enabling you (if you wish) to simply upload the uncompressed contents of the archive to the appropriate location on your server, i.e. simply overwrite the existing files with the new versions. Do not forget that if you have installed any modifications (MODs) these files will overwrite the originals, possibly destroying them in the process. You will need to re-add MODs to any affected file before uploading.

          @@ -292,7 +292,7 @@

          The patch file is one solution for those with changes in to the phpBB core files and do not want to re-add them back to all the changed files. To use this you will need command line access to a standard UNIX type patch application. If you do not have access to such an application, but still want to use this update approach, we strongly recommend the Automatic update package explained below. It is also the recommended update method.

          -

          A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.2.0, you need the phpBB-3.2.1-patch.zip/tar.bz2 file. Place the correct patch in the parent directory containing the phpBB core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

          +

          A number of patch files are provided to allow you to update from previous stable releases. Select the correct patch, e.g. if your current version is 3.3.0, you need the phpBB-3.3.1-patch.zip/tar.bz2 file. Place the correct patch in the parent directory containing the phpBB core files (i.e. index.php, viewforum.php, etc.). With this done you should run the following command: patch -cl -d [PHPBB DIRECTORY] -p1 < [PATCH NAME] (where PHPBB DIRECTORY is the directory name your phpBB Installation resides in, for example phpBB, and where PATCH NAME is the relevant filename of the selected patch file). This should complete quickly, hopefully without any HUNK FAILED comments.

          If you do get failures, you should look at using the Changed Files package to replace the files which failed to patch. Please note that you will need to manually re-add any MODs to these particular files. Alternatively, if you know how, you can examine the .rej files to determine what failed where and make manual adjustments to the relevant source.

          @@ -302,7 +302,7 @@

          This update method is only recommended for installations with modifications to core phpBB files. This package detects changed files automatically and merges in changes if needed.

          -

          The automatic update package will update the board from a given version to the latest version. A number of automatic update files are available, and you should choose the one that corresponds to the version of the board that you are currently running. For example, if your current version is 3.2.0, you need the phpBB-3.2.0_to_3.2.1.zip/tar.bz2 file.

          +

          The automatic update package will update the board from a given version to the latest version. A number of automatic update files are available, and you should choose the one that corresponds to the version of the board that you are currently running. For example, if your current version is 3.3.0, you need the phpBB-3.3.0_to_3.3.1.zip/tar.bz2 file.

          To perform the update, either follow the instructions from the Administration Control Panel->System Tab - this should point out that you are running an outdated version and will guide you through the update - or follow the instructions listed below.

          @@ -331,16 +331,16 @@
          -

          5. Updating from phpBB 3.0.x/3.1x to phpBB 3.2.x

          +

          5. Updating from phpBB 3.0.x/3.1x to phpBB 3.2.x or phpBB 3.3.x

          -

          Updating from phpBB 3.0.x or 3.1.x to 3.2.x is just the same as updating from stable releases of phpBB 3.2.x

          +

          Updating from phpBB 3.0.x or 3.1.x to 3.2.x or 3.3.x is just the same as updating from stable releases of phpBB 3.3.x

          -

          However you can also start with a new set of phpBB 3.2.x files.

          +

          However you can also start with a new set of phpBB 3.3.x files.

          1. Delete all files EXCEPT for the following: @@ -353,7 +353,7 @@
          2. (The ext/ directory
      -
    • Upload the contents of the 3.2.x Full Package into your forum's directory. Make sure the root level .htaccess file is included in the upload.
    • +
    • Upload the contents of the 3.3.x Full Package (except for config.php) into your forum's directory. Make sure the root level .htaccess file is included in the upload.
    • Browse to /install/app.php/update
    • Read the notice Update database only and press Submit
    • Delete the install/ directory
    • @@ -367,28 +367,28 @@
      -

      6. Conversion from phpBB 2.0.x to phpBB 3.2.x

      +

      6. Conversion from phpBB 2.0.x to phpBB 3.3.x

      -

      This paragraph explains the steps necessary to convert your existing phpBB2 installation to phpBB3.

      +

      This paragraph explains the steps necessary to convert your existing phpBB2 installation to phpBB 3.x.

      5.i. Requirements before converting

      -

      Before converting, we heavily recommend you do a full backup of your database and files! If you are unsure how to achieve this, please ask your hosting provider for advice. You basically need to follow the instructions given for New installations. Please do not overwrite any old files - install phpBB3 at a different location.

      +

      Before converting, we heavily recommend you do a full backup of your database and files! If you are unsure how to achieve this, please ask your hosting provider for advice. You basically need to follow the instructions given for New installations. Please do not overwrite any old files - install phpBB 3.x at a different location.

      -

      Once you made a backup of everything and also have a brand new phpBB3 installation, you can now begin the conversion.

      +

      Once you made a backup of everything and also have a brand new phpBB 3.x installation, you can now begin the conversion.

      -

      Note that the conversion requires CREATE and DROP privileges for the phpBB3 database user account.

      +

      Note that the conversion requires CREATE and DROP privileges for the phpBB 3.x database user account.

      5.ii. Converting

      -

      To begin the conversion, visit the install/ folder of your phpBB3 installation (the same as you have done for installing). Now you will see a new tab Convert. Click this tab.

      +

      To begin the conversion, visit the install/ folder of your phpBB 3.x installation (the same as you have done for installing). Now you will see a new tab Convert. Click this tab.

      -

      As with install, the conversion is automated. Your previous 2.0.x database tables will not be changed and the original 2.0.x files will remain unaltered. The conversion is actually only filling your phpBB3 database tables and copying additional data over to your phpBB3 installation. This has the benefit that if something goes wrong, you are able to either re-run the conversion or continue a conversion, while your old board is still accessible. We really recommend that you disable your old installation while converting, else you may have inconsistent data after the conversion.

      +

      As with install, the conversion is automated. Your previous 2.0.x database tables will not be changed and the original 2.0.x files will remain unaltered. The conversion is actually only filling your phpBB 3.x database tables and copying additional data over to your phpBB 3.x installation. This has the benefit that if something goes wrong, you are able to either re-run the conversion or continue a conversion, while your old board is still accessible. We really recommend that you disable your old installation while converting, else you may have inconsistent data after the conversion.

      Please note that this conversion process may take quite some time and depending on your hosting provider this may result in it failing (due to web server resource limits or other timeout issues). If this is the case, you should ask your provider if they are willing to allow the convert script to temporarily exceed their limits (be nice and they will probably be quite helpful). If your host is unwilling to increase the limits to run the convertor, please see this article for performing the conversion on your local machine: Knowledge Base - Offline Conversions

      @@ -412,9 +412,9 @@

      http 500 / white pages The conversion is a load-heavy procedure. Restrictions imposed by some server hosting providers can cause problems. The most common causes are: values too low for the PHP settings memory_limit and max_execution_time. Limits on the allowed CPU time are also a frequent cause for such errors, as are limits on the number of database queries allowed. If you cannot change such settings, then contact your hosting provider or run the conversion procedure on a different computer. The phpBB.com forums are also an excellent location to ask for support.

      -

      Password conversion Due to the utf-8 based handling of passwords in phpBB3, it is not always possible to transfer all passwords. For passwords "lost in translation" the easiest workaround is to use the I forgot my password link on the login page.

      +

      Password conversion Due to the utf-8 based handling of passwords in phpBB 3.x, it is not always possible to transfer all passwords. For passwords "lost in translation" the easiest workaround is to use the I forgot my password link on the login page.

      -

      Path to your former board The convertor expects the relative path to your old board's files. So, for instance, if the old board is located at http://www.yourdomain.com/forum and the phpBB3 installation is located at http://www.yourdomain.com/phpBB3, then the correct value would be ../forum. Note that the webserver user must be able to access the source installation's files.

      +

      Path to your former board The convertor expects the relative path to your old board's files. So, for instance, if the old board is located at http://www.yourdomain.com/forum and the phpBB 3.x installation is located at http://www.yourdomain.com/phpBB3, then the correct value would be ../forum. Note that the webserver user must be able to access the source installation's files.

      Missing images If your default board language's language pack does not include all images, then some images might be missing in your installation. Always use a complete language pack as default language.

      diff --git a/docs/README.html b/docs/README.html index 8fb9036..824a604 100644 --- a/docs/README.html +++ b/docs/README.html @@ -4,7 +4,7 @@ - + phpBB • Readme @@ -20,8 +20,8 @@
      - -

      phpBB 3.2.x Readme

      + +

      phpBB 3.3.x Readme

      Skip

      @@ -91,13 +91,13 @@

      Installation, update and conversion instructions can be found in the INSTALL document in this directory. If you are intending on converting from a phpBB 2.0.x or 3.0.x installation we highly recommend that you backup any existing data before proceeding!

      -

      Users of phpBB 3.0, 3.1 and 3.2 Beta versions cannot directly update.

      +

      Users of phpBB 3.0, 3.1, 3.2, and 3.3 Beta versions cannot directly update.

      Please note that we don't support the following installation types:

      • Updates from phpBB Beta versions and lower to phpBB Release Candidates and higher
      • -
      • Conversions from phpBB 2.0.x to phpBB 3.0 Beta, 3.1 Beta and 3.2 Beta versions
      • -
      • phpBB 3.0 Beta, 3.1 Beta or 3.2 beta installations
      • +
      • Conversions from phpBB 2.0.x to phpBB 3.0 Beta, 3.1 Beta, 3.2 Beta, and 3.3 Beta versions
      • +
      • phpBB 3.0 Beta, 3.1 Beta, 3.2 beta, or 3.3 beta installations

      We give support for the following installation types:

      @@ -106,8 +106,8 @@
    • Updates from phpBB 3.0 RC1, 3.1 RC1 and 3.2 RC1 to the latest version
    • Note: if using the Automatic Update Package, updates are supported from phpBB 3.0.2 onward. To update a pre-3.0.2 installation, first update to 3.0.2 and then update to the current version.
    • Conversions from phpBB 2.0.x to the latest version
    • -
    • New installations of phpBB 3.1.x - only the latest released version
    • New installations of phpBB 3.2.x - only the latest released version
    • +
    • New installations of phpBB 3.3.x - only the latest released version
@@ -184,7 +184,7 @@

Comprehensive documentation is now available on the phpBB website:

-

https://www.phpbb.com/support/docs/en/3.2/ug/

+

https://www.phpbb.com/support/docs/en/3.3/ug/

This covers everything from installation to setting permissions and managing users.

@@ -224,7 +224,7 @@
-

This is a stable release of phpBB. The 3.2.x line is feature frozen, with point releases principally including fixes for bugs and security issues. Feature alterations and minor feature additions may be done if deemed absolutely required. The next major release will be phpBB 3.3 which is currently under development. Please do not post questions asking when 3.3 will be available, no release date has been set.

+

This is a stable release of phpBB. The 3.3.x line is feature frozen, with point releases principally including fixes for bugs and security issues. Feature alterations and minor feature additions may be done if deemed absolutely required. The next major release will be phpBB 3.3 which is currently under development. Please do not post questions asking when 3.3 will be available, no release date has been set.

Those interested in the development of phpBB should keep an eye on the development forums to see how things are progressing:

@@ -265,7 +265,7 @@ @@ -273,7 +273,7 @@

Please be as detailed as you can in your report, and if possible, list the steps required to duplicate the problem. If you have a patch that fixes the issue, please attach it to the ticket or submit a pull request to our repository on GitHub.

-

If you create a patch, it is very much appreciated (but not required) if you follow the phpBB coding guidelines. Please note that the coding guidelines are somewhat different between different versions of phpBB. For phpBB 3.2.x the coding guidelines may be found here: http://area51.phpbb.com/docs/32x/coding-guidelines.html

+

If you create a patch, it is very much appreciated (but not required) if you follow the phpBB coding guidelines. Please note that the coding guidelines are somewhat different between different versions of phpBB. For phpBB 3.3.x the coding guidelines may be found here: http://area51.phpbb.com/docs/33x/coding-guidelines.html

Once a bug has been submitted you will be emailed any follow up comments added to it. Please if you are requested to supply additional information, do so! It is frustrating for us to receive bug reports, ask for additional information but get nothing. In these cases we have a policy of closing the bug, which may leave a very real problem in place. Obviously we would rather not have this situation arise.

@@ -323,11 +323,11 @@
-

phpBB 3.2.x takes advantage of new features added in PHP 5.4. We recommend that you upgrade to the latest stable release of PHP to run phpBB. The minimum version required is PHP 5.4.7 and the maximum supported version is the latest stable version of PHP.

+

phpBB 3.3.x takes advantage of new features added in PHP 7.1. We recommend that you upgrade to the latest stable release of PHP to run phpBB. The minimum version required is PHP 7.1.3 and the maximum supported version is the latest stable version of PHP.

Please remember that running any application on a development (unstable, e.g. a beta release) version of PHP can lead to strange/unexpected results which may appear to be bugs in the application. Therefore, we recommend you upgrade to the newest stable version of PHP before running phpBB. If you are running a development version of PHP please check any bugs you find on a system running a stable release before submitting.

-

This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQL 3.23, 4.x, 5.x, MariaDB 5.x, PostgreSQL 8.x, Oracle 8 and SQLite 3. Versions of PHP used range from 5.4.7 above 5.6.x to 7.1.x and 7.2.x without problem.

+

This board has been developed and tested under Linux and Windows (amongst others) running Apache using MySQLi 4.1.3, 4.x, 5.x, MariaDB 5.x, PostgreSQL 8.x, Oracle 8 and SQLite 3. Versions of PHP used range from 7.1.3 to 7.2.x and 7.3.x without issues.

7.i. Notice on PHP security issues

diff --git a/docs/assets/css/stylesheet.css b/docs/assets/css/stylesheet.css index c090ab7..b240a90 100644 --- a/docs/assets/css/stylesheet.css +++ b/docs/assets/css/stylesheet.css @@ -104,14 +104,14 @@ h4 { border-top: 1px solid #ccc; } -code { - color: #006600; - font-weight: normal; - font-family: 'Courier New', monospace; - border-color: #D1D7DC; - border-width: 1px; - border-style: solid; - background-color: #FAFAFA; +code { + color: #006600; + font-weight: normal; + font-family: 'Courier New', monospace; + border-color: #D1D7DC; + border-width: 1px; + border-style: solid; + background-color: #FAFAFA; padding: 0 4px; } @@ -154,6 +154,14 @@ a#logo:hover { text-decoration: none; } +.site_logo { + background-image: url("../images/site_logo.svg"); + background-repeat: no-repeat; + display: inline-block; + width: 149px; + height: 52px; +} + #doc-description { float: left; width: 70%; diff --git a/docs/assets/images/site_logo.svg b/docs/assets/images/site_logo.svg new file mode 100644 index 0000000..4ce8903 --- /dev/null +++ b/docs/assets/images/site_logo.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/docs/auth_api.html b/docs/auth_api.html index 960fa76..c011fdc 100644 --- a/docs/auth_api.html +++ b/docs/auth_api.html @@ -20,7 +20,7 @@
- +

Auth API

This is an explanation of how to use the phpBB auth/acl API

Skip

diff --git a/docs/coding-guidelines.html b/docs/coding-guidelines.html index 569ffe6..b2f6780 100644 --- a/docs/coding-guidelines.html +++ b/docs/coding-guidelines.html @@ -4,7 +4,7 @@ - + phpBB3 • Coding Guidelines @@ -20,9 +20,9 @@
- +

Coding Guidelines

-

Rhea coding guidelines document

+

Proteus coding guidelines document

Skip

@@ -37,7 +37,7 @@

- These are the phpBB Coding Guidelines for Rhea, all attempts should be made to follow them as closely as possible. + These are the phpBB Coding Guidelines for Proteus, all attempts should be made to follow them as closely as possible.

Coding Guidelines

@@ -234,9 +234,9 @@ PHPBB_USE_BOARD_URL_PATH (use generate_board_url() for image paths instead of PHPBB_DISABLE_ACP_EDITOR (disable ACP style editor for templates) PHPBB_DISABLE_CONFIG_CHECK (disable ACP config.php writeable check) -PHPBB_ACM_MEMCACHE_PORT (overwrite memcached port, default is 11211) -PHPBB_ACM_MEMCACHE_COMPRESS (overwrite memcached compress setting, default is disabled) -PHPBB_ACM_MEMCACHE_HOST (overwrite memcached host name, default is localhost) +PHPBB_ACM_MEMCACHED_PORT (overwrite memcached port, default is 11211) +PHPBB_ACM_MEMCACHED_COMPRESS (overwrite memcached compress setting, default is disabled) +PHPBB_ACM_MEMCACHED_HOST (overwrite memcached host name, default is localhost) PHPBB_ACM_REDIS_HOST (overwrite redis host name, default is localhost) PHPBB_ACM_REDIS_PORT (overwrite redis port, default is 6379) @@ -738,7 +738,7 @@ static private function f()

2.iii. SQL/SQL Layout

Common SQL Guidelines:

-

All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL3/4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), SQLite, Oracle8, ODBC (generalised if possible)).

+

All SQL should be cross-DB compatible, if DB specific SQL is used alternatives must be provided which work on all supported DB's (MySQL4/5, MSSQL (7.0 and 2000), PostgreSQL (8.3+), SQLite, Oracle8, ODBC (generalised if possible)).

All SQL commands should utilise the DataBase Abstraction Layer (DBAL)

SQL code layout:

@@ -1184,8 +1184,8 @@ append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&amp; # General Information about this style name = prosilver_duplicate copyright = © phpBB Limited, 2007 -style_version = 3.2.0 -phpbb_version = 3.2.0 +style_version = 3.3.0 +phpbb_version = 3.3.0 # Defining a different template bitfield # template_bitfield = lNg= @@ -1211,7 +1211,7 @@ parent = prosilver <td class="gensmall">TEST</td>
-

Try to match text class types with existing useage, e.g. don't use the nav class where viewtopic uses gensmall for example.

+

Try to match text class types with existing usage, e.g. don't use the nav class where viewtopic uses gensmall for example.

Row colours/classes are now defined by the template, use an IF S_ROW_COUNT switch, see viewtopic or viewforum for an example.

@@ -1223,7 +1223,7 @@ parent = prosilver

The separate catXXXX and thXXX classes are gone. When defining a header cell just use <th> rather than <th class="thHead"> etc. Similarly for cat, don't use <td class="catLeft"> use <td class="cat"> etc.

-

Try to retain consistency of basic layout and class useage, i.e. _EXPLAIN text should generally be placed below the title it explains, e.g. {L_POST_USERNAME}<br /><span class="gensmall">{L_POST_USERNAME_EXPLAIN}</span> is the typical way of handling this ... there may be exceptions and this isn't a hard and fast rule.

+

Try to retain consistency of basic layout and class usage, i.e. _EXPLAIN text should generally be placed below the title it explains, e.g. {L_POST_USERNAME}<br /><span class="gensmall">{L_POST_USERNAME_EXPLAIN}</span> is the typical way of handling this ... there may be exceptions and this isn't a hard and fast rule.

Try to keep template conditional and other statements tabbed in line with the block to which they refer.

@@ -1767,7 +1767,7 @@ This may span multiple lines.

The Universal Character Set (UCS) described in ISO/IEC 10646 consists of a large amount of characters. Each of them has a unique name and a code point which is an integer number. Unicode - which is an industry standard - complements the Universal Character Set with further information about the characters' properties and alternative character encodings. More information on Unicode can be found on the Unicode Consortium's website. One of the Unicode encodings is the 8-bit Unicode Transformation Format (UTF-8). It encodes characters with up to four bytes aiming for maximum compatibility with the American Standard Code for Information Interchange which is a 7-bit encoding of a relatively small subset of the UCS.

phpBB's use of Unicode

-

Unfortunately PHP does not faciliate the use of Unicode prior to version 6. Most functions simply treat strings as sequences of bytes assuming that each character takes up exactly one byte. This behaviour still allows for storing UTF-8 encoded text in PHP strings but many operations on strings have unexpected results. To circumvent this problem we have created some alternative functions to PHP's native string operations which use code points instead of bytes. These functions can be found in /includes/utf/utf_tools.php. They are also covered in the phpBB3 Sourcecode Documentation. A lot of native PHP functions still work with UTF-8 as long as you stick to certain restrictions. For example explode still works as long as the first and the last character of the delimiter string are ASCII characters.

+

Unfortunately PHP does not facilitate the use of Unicode prior to version 6. Most functions simply treat strings as sequences of bytes assuming that each character takes up exactly one byte. This behaviour still allows for storing UTF-8 encoded text in PHP strings but many operations on strings have unexpected results. To circumvent this problem we have created some alternative functions to PHP's native string operations which use code points instead of bytes. These functions can be found in /includes/utf/utf_tools.php. They are also covered in the phpBB3 Sourcecode Documentation. A lot of native PHP functions still work with UTF-8 as long as you stick to certain restrictions. For example explode still works as long as the first and the last character of the delimiter string are ASCII characters.

phpBB only uses the ASCII and the UTF-8 character encodings. Still all Strings are UTF-8 encoded because ASCII is a subset of UTF-8. The only exceptions to this rule are code sections which deal with external systems which use other encodings and character sets. Such external data should be converted to UTF-8 using the utf8_recode() function supplied with phpBB. It supports a variety of other character sets and encodings, a full list can be found below.

@@ -1848,7 +1848,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

The IETF recently published RFC 4646 for tags used to identify languages, which in combination with RFC 4647 obseletes the older RFC 3006 and older-still RFC 1766. RFC 4646 uses ISO 639-1/ISO 639-2, ISO 3166-1 alpha-2, ISO 15924 and UN M.49 to define a language tag. Each complete tag is composed of subtags which are not case sensitive and can also be empty.

-

Ordering of the subtags in the case that they are all non-empty is: language-script-region-variant-extension-privateuse. Should any subtag be empty, its corresponding hyphen would also be ommited. Thus, the language tag for English will be en and not en-----.

+

Ordering of the subtags in the case that they are all non-empty is: language-script-region-variant-extension-privateuse. Should any subtag be empty, its corresponding hyphen would also be omitted. Thus, the language tag for English will be en and not en-----.

Most language tags consist of a two- or three-letter language subtag (from ISO 639-1/ISO 639-2). Sometimes, this is followed by a two-letter or three-digit region subtag (from ISO 3166-1 alpha-2 or UN M.49). Some examples are:

@@ -1902,7 +1902,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))

The ultimate aim of a language tag is to convey the needed useful distingushing information, whilst keeping it as short as possible. So for example, use en, fr and ja as opposed to en-GB, fr-FR and ja-JP, since we know English, French and Japanese are the native language of Great Britain, France and Japan respectively.

-

Next is the ISO 15924 language script code and when one should or shouldn't use it. For example, whilst en-Latn is syntaxically correct for describing English written with Latin script, real world English writing is more-or-less exclusively in the Latin script. For such languages like English that are written in a single script, the IANA Language Subtag Registry has a "Suppress-Script" field meaning the script code should be ommitted unless a specific language tag requires a specific script code. Some languages are written in more than one script and in such cases, the script code is encouraged since an end-user may be able to read their language in one script, but not the other. Some examples are:

+

Next is the ISO 15924 language script code and when one should or shouldn't use it. For example, whilst en-Latn is syntaxically correct for describing English written with Latin script, real world English writing is more-or-less exclusively in the Latin script. For such languages like English that are written in a single script, the IANA Language Subtag Registry has a "Suppress-Script" field meaning the script code should be omitted unless a specific language tag requires a specific script code. Some languages are written in more than one script and in such cases, the script code is encouraged since an end-user may be able to read their language in one script, but not the other. Some examples are:

@@ -1967,7 +1967,7 @@ if (utf8_case_fold_nfc($string1) == utf8_case_fold_nfc($string2))
Examples of using a language subtag in combination with a script subtag
-

Usage of the three-digit UN M.49 code over the two-letter ISO 3166-1 alpha-2 code should hapen if a macro-geographical entity is required and/or the ISO 3166-1 alpha-2 is ambiguous.

+

Usage of the three-digit UN M.49 code over the two-letter ISO 3166-1 alpha-2 code should happen if a macro-geographical entity is required and/or the ISO 3166-1 alpha-2 is ambiguous.

Examples of English using marco-geographical regions:

diff --git a/docs/events.md b/docs/events.md index fb782ee..bfe26b4 100644 --- a/docs/events.md +++ b/docs/events.md @@ -172,6 +172,18 @@ acp_group_options_before * Since: 3.1.0-b4 * Purpose: Add additional options to group settings (before GROUP_FOUNDER_MANAGE) +acp_group_types_append +=== +* Location: adm/style/acp_groups.html +* Since: 3.2.9-RC1 +* Purpose: Add additional group type options to group settings (append the list) + +acp_group_types_prepend +=== +* Location: adm/style/acp_groups.html +* Since: 3.2.9-RC1 +* Purpose: Add additional group type options to group settings (prepend the list) + acp_groups_find_username_append === * Location: adm/style/acp_groups.html @@ -988,6 +1000,20 @@ mcp_move_before * Since: 3.1.10-RC1 * Purpose: Add content before move topic/post form +mcp_move_destination_forum_after +=== +* Locations: + + styles/prosilver/template/mcp_move.html +* Since: 3.2.8-RC1 +* Purpose: Add content after the destination select element in the move topic/post form + +mcp_move_destination_forum_before +=== +* Locations: + + styles/prosilver/template/mcp_move.html +* Since: 3.2.8-RC1 +* Purpose: Add content before the destination select element in the move topic/post form + mcp_post_additional_options === * Locations: @@ -1037,6 +1063,20 @@ mcp_topic_options_before * Since: 3.1.6-RC1 * Purpose: Add some options (field, checkbox, ...) before the subject field when split a subject +mcp_topic_post_author_full_append +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.2.8-RC1 +* Purpose: Append information to message author username for post details in topic moderation + +mcp_topic_post_author_full_prepend +=== +* Locations: + + styles/prosilver/template/mcp_topic.html +* Since: 3.2.8-RC1 +* Purpose: Prepend information to message author username for post details in topic moderation + mcp_topic_postrow_attachments_after === * Locations: @@ -1740,14 +1780,14 @@ posting_attach_body_file_list_after * Locations: + styles/prosilver/template/posting_attach_body.html * Since: 3.2.6-RC1 -* Purpose: Add content after attachments list +* Purpose: Add content after attachments list posting_attach_body_file_list_before === * Locations: + styles/prosilver/template/posting_attach_body.html * Since: 3.2.6-RC1 -* Purpose: Add content before attachments list +* Purpose: Add content before attachments list posting_editor_add_panel_tab === @@ -1910,6 +1950,20 @@ posting_preview_poll_after * Since: 3.1.7-RC1 * Purpose: Add content after the poll preview block +posting_review_row_post_author_username_append +=== +* Locations: + + styles/prosilver/template/posting_review.html +* Since: 3.2.8-RC1 +* Purpose: Append information to post author username of member + +posting_review_row_post_author_username_prepend +=== +* Locations: + + styles/prosilver/template/posting_review.html +* Since: 3.2.8-RC1 +* Purpose: Prepend information to post author username of member + posting_topic_review_row_content_after === * Locations: @@ -1917,6 +1971,20 @@ posting_topic_review_row_content_after * Since: 3.2.4-RC1 * Purpose: Add content after the message content in topic review +posting_topic_review_row_post_author_username_append +=== +* Locations: + + styles/prosilver/template/posting_topic_review.html +* Since: 3.2.8-RC1 +* Purpose: Append information to post author username of member + +posting_topic_review_row_post_author_username_prepend +=== +* Locations: + + styles/prosilver/template/posting_topic_review.html +* Since: 3.2.8-RC1 +* Purpose: Prepend information to post author username of member + posting_topic_review_row_post_details_after === * Locations: @@ -2102,14 +2170,14 @@ search_results_header_before search_results_last_post_author_username_append === * Locations: - + styles/prosilver/template/search_results.html + + styles/prosilver/template/search_results.html (2) * Since: 3.2.4-RC1 * Purpose: Append information to last post author username of member search_results_last_post_author_username_prepend === * Locations: - + styles/prosilver/template/search_results.html + + styles/prosilver/template/search_results.html (2) * Since: 3.2.4-RC1 * Purpose: Prepend information to last post author username of member @@ -2253,6 +2321,24 @@ topiclist_row_prepend * Changed: 3.1.6-RC1 Added event to mcp_forum.html * Purpose: Add content into topic rows (inside the elements containing topic titles) +topiclist_row_topic_by_author_after +=== +* Locations: + + styles/prosilver/template/search_results.html + + styles/prosilver/template/viewforum_body.html + + styles/prosilver/template/mcp_forum.html +* Since: 3.2.8-RC1 +* Purpose: Add content into topic rows (after the "by topic author" row) + +topiclist_row_topic_by_author_before +=== +* Locations: + + styles/prosilver/template/search_results.html + + styles/prosilver/template/viewforum_body.html + + styles/prosilver/template/mcp_forum.html +* Since: 3.2.8-RC1 +* Purpose: Add content into topic rows (before the "by topic author" row) + topiclist_row_topic_title_after === * Locations: @@ -2364,6 +2450,20 @@ ucp_pm_history_review_before * Since: 3.1.6-RC1 * Purpose: Add content before the private messages history review. +ucp_pm_history_row_message_author_username_append +=== +* Locations: + + styles/prosilver/template/ucp_pm_history.html +* Since: 3.2.8-RC1 +* Purpose: Append information to message author username of member + +ucp_pm_history_row_message_author_username_prepend +=== +* Locations: + + styles/prosilver/template/ucp_pm_history.html +* Since: 3.2.8-RC1 +* Purpose: Prepend information to message author username of member + ucp_pm_viewmessage_avatar_after === * Locations: @@ -2546,6 +2646,13 @@ ucp_profile_profile_info_before * Since: 3.1.4-RC1 * Purpose: Add options in profile page fieldset - before jabber field. +ucp_profile_profile_info_birthday_label_append +=== +* Locations: + + styles/prosilver/template/ucp_profile_profile_info.html +* Since: 3.2.9-RC1 +* Purpose: Add more text to birthday label, such as required asterisk + ucp_profile_register_details_after === * Locations: @@ -2612,14 +2719,14 @@ ucp_register_profile_fields_before viewforum_body_last_post_author_username_append === * Locations: - + styles/prosilver/template/viewforum_body.html + + styles/prosilver/template/viewforum_body.html (2) * Since: 3.2.4-RC1 * Purpose: Append information to last post author username of member viewforum_body_last_post_author_username_prepend === * Locations: - + styles/prosilver/template/viewforum_body.html + + styles/prosilver/template/viewforum_body.html (2) * Since: 3.2.4-RC1 * Purpose: Prepend information to last post author username of member diff --git a/docs/nginx.sample.conf b/docs/nginx.sample.conf index 55c01a1..c5a9472 100644 --- a/docs/nginx.sample.conf +++ b/docs/nginx.sample.conf @@ -70,7 +70,7 @@ http { } # Deny access to internal phpbb files. - location ~ /(config\.php|common\.php|cache|files|images/avatars/upload|includes|(?= ( SELECT max_doc_id FROM phpbb_sphinx WHERE counter_id=1 ) - sql_query_pre = + sql_query_post_index = } index index_phpbb_{SPHINX_ID}_main { @@ -74,6 +74,7 @@ index index_phpbb_{SPHINX_ID}_main charset_table = U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153, U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159, U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161, U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167, U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F, U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175, U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C, U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F, U+4E00..U+9FFF min_prefix_len = 0 min_infix_len = 0 + html_strip = 1 } index index_phpbb_{SPHINX_ID}_delta : index_phpbb_{SPHINX_ID}_main { diff --git a/ext/phpbb/viglink/language/fr/viglink_module_acp.php b/ext/phpbb/viglink/language/fr/viglink_module_acp.php index b0c55b3..62148c3 100644 --- a/ext/phpbb/viglink/language/fr/viglink_module_acp.php +++ b/ext/phpbb/viglink/language/fr/viglink_module_acp.php @@ -39,7 +39,7 @@ $lang = array_merge($lang, [ 'ACP_VIGLINK_SETTINGS' => 'Paramètres de VigLink', 'ACP_VIGLINK_SETTINGS_EXPLAIN' => 'VigLink est un service tiers qui permet de monétiser en toute tranquillité les liens publiés par les utilisateurs de votre forum sans impacter leur expérience utilisateur. Lorsque les utilisateurs accèderont aux liens menant à des produits ou des services et achèteront quelque chose au marchand partenaire, ce dernier versera à VigLink une commission dont une partie du montant sera partagée au projet phpBB. En choisissant d’activer VigLink tout en laissant les parts des commissions au projet phpBB, vous aidez considérablement notre organisation de logiciels libres et gratuits en assurant notre stabilité financière.', 'ACP_VIGLINK_SETTINGS_CHANGE' => 'Vous pouvez modifier ces paramètres à tout moment depuis le panneau « Paramètres de VigLink ».', - 'ACP_VIGLINK_SUPPORT_EXPLAIN' => 'Vous ne serez plus redirigé sur cette page lorsque vous aurez renseigné vos préférences disponibles ci-dessous, en cliquant le bouton « Envoyer ».', + 'ACP_VIGLINK_SUPPORT_EXPLAIN' => 'Vous ne serez plus redirigé sur cette page lorsque vous aurez renseigné vos préférences disponibles ci-dessous, en cliquant le bouton « Envoyer ».', 'ACP_VIGLINK_ENABLE' => 'Activer VigLink', 'ACP_VIGLINK_ENABLE_EXPLAIN' => 'Permet l’utilisation des services de VigLink.', 'ACP_VIGLINK_EARNINGS' => 'Me reverser mes parts des commissions (optionnel)', diff --git a/ext/planetstyles/OneNote Table Of Contents.onetoc2 b/ext/planetstyles/OneNote Table Of Contents.onetoc2 new file mode 100644 index 0000000000000000000000000000000000000000..1ec2f0558616f241d972f503d81af7089df3f895 GIT binary patch literal 4744 zcmZ3e|KIuM`!b(-j|5(YE0x7hVGyi7;cn@&>uz<$^12263~0dq?koZ6iC;aJUJ#%7 z_Qbjy(m;7+3{(Ce2taIBm;jW9iK7Xla6xK704&G>m0|(XAPfRP8lnQCrb7rK3?p-k zZ9R__HF>ri(A+MvHm-voDzV^8KTBWcBaeM${!Tpmu9d>nW21$ZDf%H}Y-&cuMnhnz zhrp39-@k6G3R@xo^$14}!_)>wl?m)yIRZa(GVD1+1FNDWk0Vgn7XGv12sy~+rYR}^Vz zU{C=DJxJ-!Pm_fz9##0X9NGD+f17l$ z=sm&62rGgA|7VOeXlQ_OTT&Q$kUa%59R$|P0FC@Fz|a8Z5lwXPL6x#FFu>{$phyE$ zw1J6XiY$Z7P8kLfP%RSl!cTtVfphNr!gAYRpPPLP;!_|Ab>24_1{H`HNI!BogG51L z86ITEVd^94H_P?cd(W1bMvyqR@ZG?>04*$;U||_Mg(bB{WujO25tVmSBqV%QfuRF5 z1zd%}!gblSgLYA?L>(Ib7~OuC^k_NA8bBv?5D0EY!LF8}}l literal 0 HcmV?d00001 diff --git a/ext/planetstyles/flightdeck/adm/style/acp_style_settings_body.html b/ext/planetstyles/flightdeck/adm/style/acp_style_settings_body.html index f0cfaef..af70a5a 100644 --- a/ext/planetstyles/flightdeck/adm/style/acp_style_settings_body.html +++ b/ext/planetstyles/flightdeck/adm/style/acp_style_settings_body.html @@ -71,7 +71,6 @@
-

Refer to documentation for corresponding output locations.

{{ lang('STYLE_SETTINGS_HTML_CODE') }} {% for style_settings_html in loops.style_settings_html %}
diff --git a/ext/planetstyles/flightdeck/adm/style/event/acp_overall_footer_after.html b/ext/planetstyles/flightdeck/adm/style/event/acp_overall_footer_after.html index 6df9e88..1989cbc 100644 --- a/ext/planetstyles/flightdeck/adm/style/event/acp_overall_footer_after.html +++ b/ext/planetstyles/flightdeck/adm/style/event/acp_overall_footer_after.html @@ -1,7 +1,5 @@ diff --git a/ext/planetstyles/flightdeck/adm/style/event/acp_overall_header_head_append.html b/ext/planetstyles/flightdeck/adm/style/event/acp_overall_header_head_append.html index 97e2d91..9343db9 100644 --- a/ext/planetstyles/flightdeck/adm/style/event/acp_overall_header_head_append.html +++ b/ext/planetstyles/flightdeck/adm/style/event/acp_overall_header_head_append.html @@ -1,2 +1 @@ - diff --git a/ext/planetstyles/flightdeck/adm/style/jscolor.js b/ext/planetstyles/flightdeck/adm/style/jscolor.js index 2bdd460..e650a69 100644 --- a/ext/planetstyles/flightdeck/adm/style/jscolor.js +++ b/ext/planetstyles/flightdeck/adm/style/jscolor.js @@ -5,7 +5,7 @@ * @license For open source use: GPLv3 * For commercial use: JSColor Commercial License * @author Jan Odvarko - * @version 2.0.4 + * @version 2.0.5 * * See usage examples at http://jscolor.com/examples/ */ @@ -984,9 +984,10 @@ var jsc = { this.required = true; // whether the associated text can be left empty this.refine = true; // whether to refine the entered color code (e.g. uppercase it and remove whitespace) this.hash = false; // whether to prefix the HEX color code with # symbol - this.uppercase = true; // whether to uppercase the color code + this.uppercase = true; // whether to show the color code in upper case this.onFineChange = null; // called instantly every time the color changes (value can be either a function or a string with javascript code) this.activeClass = 'jscolor-active'; // class to be set to the target element when a picker window is open on it + this.overwriteImportant = false; // whether to overwrite colors of styleElement using !important this.minS = 0; // min allowed saturation (0 - 100) this.maxS = 100; // max allowed saturation (0 - 100) this.minV = 0; // min allowed value (brightness) (0 - 100) @@ -1105,9 +1106,19 @@ var jsc = { } if (!(flags & jsc.leaveStyle)) { if (this.styleElement) { + var bgColor = '#' + this.toString(); + var fgColor = this.isLight() ? '#000' : '#FFF'; + this.styleElement.style.backgroundImage = 'none'; - this.styleElement.style.backgroundColor = '#' + this.toString(); - this.styleElement.style.color = this.isLight() ? '#000' : '#FFF'; + this.styleElement.style.backgroundColor = bgColor; + this.styleElement.style.color = fgColor; + + if (this.overwriteImportant) { + this.styleElement.setAttribute('style', + 'background: ' + bgColor + ' !important; ' + + 'color: ' + fgColor + ' !important;' + ); + } } } if (!(flags & jsc.leavePad) && isPickerOwner()) { diff --git a/ext/planetstyles/flightdeck/styles/style_config.json b/ext/planetstyles/flightdeck/styles/style_config.json index 3f08a82..cf85587 100644 --- a/ext/planetstyles/flightdeck/styles/style_config.json +++ b/ext/planetstyles/flightdeck/styles/style_config.json @@ -43,7 +43,7 @@ "Stretch header background to fill space?": { "name": "header_size", "type": "bool", - "help": "Stretches background image to fill header space. Only recommended for large backgrounds that don't repeat.
Note: Automatically applied when parallax header is enabled.
Default value: No." + "help": "Stretches background image to fill header space. Only recommended for large backgrounds that don't repeat.
Note: Automatically applied when parallax header is enabled.
Default value: No." }, "Header Background Effect": { @@ -60,14 +60,14 @@ "Parallax Header?": { "name": "parallax_header", "type": "bool", - "help": "Subtly moves the header background when scrolling.
Note: Requires a header image taller than the forum header. See documentation.
Default value: No." + "help": "Subtly moves the header background when scrolling.
Note: Requires a header image taller than the forum header. See documentation.
Default value: No." }, "Enable Animated Header Particles?": { "name": "header_particles", "type": "bool", - "help": "Enables an animated geometric overlay across the header.
Default value: No." -}, + "help": "Enables an animated geometric overlay across the header.
Default value: No." +}, "Header Format": { "name": "header_format", @@ -121,9 +121,9 @@ "name": "base_colour", "type": "list", "help": "Choose a light or dark base colour. See documentation for previews.
Default value: 'Light'.", - "values": [ + "values": [ "Light", - "Dark" + "Dark" ] }, @@ -131,34 +131,34 @@ "name": "colour_preset", "type": "list", "help": "Choose a predefined colour palette for your forum's accent colour. See documentation for previews.
Default value: 'No Preset'.", - "values": [ + "values": [ "Custom (Use colour picker below)", "No Custom Colour", - "Aqua", - "Blush", + "Aqua", + "Blush", "Blue_Lagoon", - "Calm_Darya", - "Electric_Violet", - "HoneyDew", - "Hot_Red", - "Ibiza_Sunset", - "Little_Leaf", - "Neon_Blue", - "Nighthawk", - "Pacific_Dream", + "Calm_Darya", + "Electric_Violet", + "HoneyDew", + "Hot_Red", + "Ibiza_Sunset", + "Little_Leaf", + "Neon_Blue", + "Nighthawk", + "Pacific_Dream", "Peach", - "Purple_Love", + "Purple_Love", "Rose_Water", "Sahara", - "Titanium", - "Warm_Sunset" + "Titanium", + "Warm_Sunset" ] }, "Theme Accent Colour": { "name": "colour_picker", - "help": "Select colour of category headers, links and buttons.
Note: Only applied if 'No Preset' is selected above.", - "type": "string" + "help": "Select colour of category headers, links and buttons.
Note: Only applied if 'No Preset' is selected above.", + "type": "string" }, "High Contrast Footer Links?": { @@ -170,7 +170,7 @@ "Forumlist Display": { "name": "forumlist_display", - "help": "Defines how forums are displayed on the index page.
Default setting: List.", + "help": "Defines how forums are displayed on the index page.
Default setting: List.", "type": "list", "values": [ "List", @@ -192,7 +192,7 @@ "Enable Sidebars?": { "name": "sidebars", "type": "bool", - "help": "Choose to enable or disable sidebars. Further options configured below.
Default Value: No" + "help": "Choose to enable or disable sidebars. Further options configured below.
Default Value: No" }, "Sidebar Placement": { @@ -209,18 +209,18 @@ "Enable Sidebar Profile Widget?": { "name": "profile_widget", "type": "bool", - "help": "Displays User Avatar and basic profile links in right sidebar. Guests see a login/registration form,
Default Value: No" + "help": "Displays User Avatar and basic profile links in right sidebar. Guests see a login/registration form,
Default Value: No" }, "Enable Sidebar Search Widget?": { "name": "search_widget", "type": "bool", - "help": "Displays a quick search form in the sidebar.
Default Value: No" + "help": "Displays a quick search form in the sidebar.
Default Value: No" }, "Postprofile Side": { "name": "postprofile_side", - "help": "Sets which side avatars / post counts display on when reading a topic.
Default setting: Right.", + "help": "Sets which side avatars / post counts display on when reading a topic.
Default setting: Right.", "type": "list", "values": [ "Left", @@ -248,16 +248,38 @@ "help": "Hides the social bar above the footer.
Default Value: No" }, -"Force Rounded 'Last Post' Avatars?": { - "name": "rounded_avatars", +"Enable Rounded Corners?": { + "name": "rounded_corners", "type": "bool", - "help": "Forces the avatars within the 'last post' column to be round.
Requires Avatar in last post extension.
Default Value: No" + "help": "Rounds off most of Milk's corners
Default Value: No" +}, + +"Replace CSS Icons With Images?": { + "name": "css_image_replace", + "type": "bool", + "help": "Replaces the CSS icons with images from /theme/images/icons/
Default: No" +}, + +"CSS Icon Shape": { + "name": "css_icon_shape", + "help": "Choose whether the CSS icons are round or square.
Default setting: Circle.", + "type": "list", + "values": [ + "Circle", + "Square" + ] +}, + +"Disable CSS Loading Animations?": { + "name": "disable_css_animations", + "type": "bool", + "help": "Disables the CSS loading animations.
Default: No" }, "Hide PlanetStyles link in footer?": { "name": "credit_line", "type": "bool", "help": "We'd rather you didn't, but it's OK if you really want to :)" -} +} -} \ No newline at end of file +} diff --git a/install/app.php b/install/app.php index 710f495..0e6212e 100644 --- a/install/app.php +++ b/install/app.php @@ -20,9 +20,9 @@ define('PHPBB_ENVIRONMENT', 'production'); $phpbb_root_path = '../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); -if (version_compare(PHP_VERSION, '5.4.7', '<') || version_compare(PHP_VERSION, '7.3-dev', '>=')) +if (version_compare(PHP_VERSION, '7.1.3', '<')) { - die('You are running an unsupported PHP version. Please upgrade to PHP equal to or greater than 5.4.7 but less than 7.3-dev in order to install or update to phpBB 3.2'); + die('You are running an unsupported PHP version. Please upgrade to PHP 7.1.3 or higher before trying to install or update to phpBB 3.3'); } $startup_new_path = $phpbb_root_path . 'install/update/update/new/install/startup.' . $phpEx; diff --git a/install/convert/convertor.php b/install/convert/convertor.php index 5118651..09088fe 100644 --- a/install/convert/convertor.php +++ b/install/convert/convertor.php @@ -63,7 +63,7 @@ class convertor { global $user, $phpbb_root_path, $phpEx, $db, $lang, $config, $cache, $auth; global $convert, $convert_row, $message_parser, $skip_rows, $language; - global $request, $phpbb_dispatcher; + global $request, $phpbb_dispatcher, $phpbb_container; $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); extract($phpbb_config_php_file->get_all()); @@ -148,16 +148,6 @@ class convertor $convert->src_truncate_statement = 'DELETE FROM '; break; - // Thanks MySQL, for silently converting... - case 'mysql': - case 'mysql4': - if (version_compare($src_db->sql_server_info(true, false), '4.1.3', '>=')) - { - $convert->mysql_convert = true; - } - $convert->src_truncate_statement = 'TRUNCATE TABLE '; - break; - case 'mysqli': $convert->mysql_convert = true; $convert->src_truncate_statement = 'TRUNCATE TABLE '; @@ -687,7 +677,7 @@ class convertor $this->template->assign_block_vars('checks', array( 'TITLE' => "skip_rows = $skip_rows", - 'RESULT' => $rows . ((defined('DEBUG') && function_exists('memory_get_usage')) ? ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] : ''), + 'RESULT' => $rows . (($phpbb_container->getParameter('debug.memory') && function_exists('memory_get_usage')) ? ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] : ''), )); $mtime = explode(' ', microtime()); @@ -748,8 +738,6 @@ class convertor switch ($db->get_sql_layer()) { // If MySQL, we'll wait to have num_wait_rows rows to submit at once - case 'mysql': - case 'mysql4': case 'mysqli': $waiting_rows[] = '(' . implode(', ', $insert_values) . ')'; @@ -920,6 +908,7 @@ class convertor { global $user, $db, $phpbb_root_path, $phpEx, $config, $cache; global $convert; + global $phpbb_container; include_once ($phpbb_root_path . 'includes/functions_admin.' . $phpEx); @@ -959,7 +948,7 @@ class convertor sync('topic', 'range', 'topic_id BETWEEN ' . $sync_batch . ' AND ' . $end, true, true); $this->template->assign_block_vars('checks', array( - 'TITLE' => sprintf($user->lang['SYNC_TOPIC_ID'], $sync_batch, ($sync_batch + $batch_size)) . ((defined('DEBUG') && function_exists('memory_get_usage')) ? ' [' . ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] . ']' : ''), + 'TITLE' => sprintf($user->lang['SYNC_TOPIC_ID'], $sync_batch, ($sync_batch + $batch_size)) . (($phpbb_container->getParameter('debug.memory') && function_exists('memory_get_usage')) ? ' [' . ceil(memory_get_usage()/1024) . ' ' . $user->lang['KIB'] . ']' : ''), 'RESULT' => $user->lang['DONE'], )); @@ -1257,9 +1246,7 @@ class convertor global $db, $user; global $convert; - // Can we use IGNORE with this DBMS? - $sql_ignore = (strpos($db->get_sql_layer(), 'mysql') === 0 && !defined('DEBUG')) ? 'IGNORE ' : ''; - $insert_query = 'INSERT ' . $sql_ignore . 'INTO ' . $schema['target'] . ' ('; + $insert_query = 'INSERT INTO ' . $schema['target'] . ' ('; $aliases = array(); diff --git a/install/phpbbcli.php b/install/phpbbcli.php index 217f1df..cf8cfd1 100644 --- a/install/phpbbcli.php +++ b/install/phpbbcli.php @@ -23,7 +23,7 @@ if (php_sapi_name() !== 'cli') define('IN_PHPBB', true); define('IN_INSTALL', true); define('PHPBB_ENVIRONMENT', 'production'); -define('PHPBB_VERSION', '3.2.7'); +define('PHPBB_VERSION', '3.3.0'); $phpbb_root_path = __DIR__ . '/../'; $phpEx = substr(strrchr(__FILE__, '.'), 1); diff --git a/install/startup.php b/install/startup.php index 9a4f9bf..50758f5 100644 --- a/install/startup.php +++ b/install/startup.php @@ -120,6 +120,7 @@ $phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relati $phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; // Include files +phpbb_require_updated('includes/compatibility_globals.' . $phpEx, $phpbb_root_path); phpbb_require_updated('includes/functions.' . $phpEx, $phpbb_root_path); phpbb_require_updated('includes/functions_content.' . $phpEx, $phpbb_root_path); phpbb_include_updated('includes/functions_compatibility.' . $phpEx, $phpbb_root_path); diff --git a/install/update/index.php b/install/update/index.php new file mode 100644 index 0000000..250c0ab --- /dev/null +++ b/install/update/index.php @@ -0,0 +1,395 @@ + array('from' => '3.2.7', 'to' => '3.3.0'), + 'files' => array( + '.htaccess', + 'adm/images/phpbb_logo.svg', + 'adm/index.php', + 'adm/style/acp_attachments.html', + 'adm/style/acp_avatar_options_upload.html', + 'adm/style/acp_ban.html', + 'adm/style/acp_contact.html', + 'adm/style/acp_database.html', + 'adm/style/acp_ext_actions.html', + 'adm/style/acp_ext_list.html', + 'adm/style/acp_forums.html', + 'adm/style/acp_groups.html', + 'adm/style/acp_help_phpbb.html', + 'adm/style/acp_icons.html', + 'adm/style/acp_language.html', + 'adm/style/acp_main.html', + 'adm/style/acp_modules.html', + 'adm/style/acp_permission_roles.html', + 'adm/style/acp_posting_buttons.html', + 'adm/style/acp_ranks.html', + 'adm/style/acp_search.html', + 'adm/style/acp_styles.html', + 'adm/style/acp_users_overview.html', + 'adm/style/acp_users_prefs.html', + 'adm/style/acp_users_signature.html', + 'adm/style/admin.css', + 'adm/style/admin.js', + 'adm/style/ajax.js', + 'adm/style/captcha_recaptcha.html', + 'adm/style/installer_footer.html', + 'adm/style/overall_footer.html', + 'adm/style/overall_header.html', + 'adm/style/permission_forum_copy.html', + 'adm/style/permission_mask.html', + 'adm/style/permissions.js', + 'adm/style/progress_bar.html', + 'adm/style/simple_footer.html', + 'adm/style/simple_header.html', + 'assets/cookieconsent/cookieconsent.min.css', + 'assets/cookieconsent/cookieconsent.min.js', + 'assets/javascript/core.js', + 'assets/javascript/editor.js', + 'assets/javascript/jquery-3.4.1.min.js', + 'assets/javascript/plupload.js', + 'common.php', + 'composer.json', + 'composer.lock', + 'config/default/container/parameters.yml', + 'config/default/container/services.yml', + 'config/default/container/services_auth.yml', + 'config/default/container/services_console.yml', + 'config/default/container/services_cron.yml', + 'config/default/container/services_password.yml', + 'config/default/container/services_routing.yml', + 'config/default/container/services_text_formatter.yml', + 'config/default/container/services_twig.yml', + 'config/default/container/services_ucp.yml', + 'config/default/routing/cron.yml', + 'config/default/routing/routing.yml', + 'config/default/routing/ucp.yml', + 'cron.php', + 'download/file.php', + 'ext/phpbb/viglink/acp/viglink_helper.php', + 'ext/phpbb/viglink/composer.json', + 'ext/phpbb/viglink/composer.lock', + 'ext/phpbb/viglink/styles/all/theme/viglink.css', + 'feed.php', + 'includes/acp/acp_attachments.php', + 'includes/acp/acp_bbcodes.php', + 'includes/acp/acp_board.php', + 'includes/acp/acp_database.php', + 'includes/acp/acp_extensions.php', + 'includes/acp/acp_forums.php', + 'includes/acp/acp_help_phpbb.php', + 'includes/acp/acp_main.php', + 'includes/acp/acp_permissions.php', + 'includes/acp/acp_prune.php', + 'includes/acp/acp_reasons.php', + 'includes/acp/acp_styles.php', + 'includes/acp/acp_update.php', + 'includes/acp/acp_users.php', + 'includes/acp/auth.php', + 'includes/bbcode.php', + 'includes/compatibility_globals.php', + 'includes/constants.php', + 'includes/diff/engine.php', + 'includes/functions.php', + 'includes/functions_acp.php', + 'includes/functions_admin.php', + 'includes/functions_compatibility.php', + 'includes/functions_compress.php', + 'includes/functions_content.php', + 'includes/functions_convert.php', + 'includes/functions_display.php', + 'includes/functions_download.php', + 'includes/functions_messenger.php', + 'includes/functions_module.php', + 'includes/functions_posting.php', + 'includes/functions_privmsgs.php', + 'includes/functions_transfer.php', + 'includes/functions_user.php', + 'includes/mcp/mcp_ban.php', + 'includes/mcp/mcp_logs.php', + 'includes/mcp/mcp_main.php', + 'includes/mcp/mcp_notes.php', + 'includes/mcp/mcp_topic.php', + 'includes/mcp/mcp_warn.php', + 'includes/message_parser.php', + 'includes/questionnaire/questionnaire.php', + 'includes/startup.php', + 'includes/ucp/ucp_attachments.php', + 'includes/ucp/ucp_groups.php', + 'includes/ucp/ucp_pm.php', + 'includes/ucp/ucp_pm_compose.php', + 'includes/ucp/ucp_pm_viewfolder.php', + 'includes/ucp/ucp_profile.php', + 'includes/ucp/ucp_register.php', + 'includes/ucp/ucp_resend.php', + 'includes/utf/utf_tools.php', + 'index.php', + 'language/en/acp/attachments.php', + 'language/en/acp/board.php', + 'language/en/acp/common.php', + 'language/en/acp/forums.php', + 'language/en/acp/permissions.php', + 'language/en/acp/permissions_phpbb.php', + 'language/en/acp/posting.php', + 'language/en/acp/profile.php', + 'language/en/acp/styles.php', + 'language/en/captcha_recaptcha.php', + 'language/en/cli.php', + 'language/en/common.php', + 'language/en/email/admin_activate.txt', + 'language/en/email/user_forgot_password.txt', + 'language/en/install.php', + 'language/en/migrator.php', + 'language/en/posting.php', + 'language/en/ucp.php', + 'mcp.php', + 'memberlist.php', + 'phpbb/auth/provider/apache.php', + 'phpbb/auth/provider/base.php', + 'phpbb/auth/provider/db.php', + 'phpbb/auth/provider/ldap.php', + 'phpbb/auth/provider/oauth/oauth.php', + 'phpbb/auth/provider/oauth/service/base.php', + 'phpbb/auth/provider/oauth/service/bitly.php', + 'phpbb/auth/provider/oauth/service/facebook.php', + 'phpbb/auth/provider/oauth/service/google.php', + 'phpbb/auth/provider/oauth/service/service_interface.php', + 'phpbb/auth/provider/oauth/service/twitter.php', + 'phpbb/auth/provider/oauth/token_storage.php', + 'phpbb/auth/provider/provider_interface.php', + 'phpbb/avatar/driver/remote.php', + 'phpbb/avatar/driver/upload.php', + 'phpbb/cache/driver/memcached.php', + 'phpbb/cache/driver/memory.php', + 'phpbb/captcha/non_gd.php', + 'phpbb/captcha/plugins/qa.php', + 'phpbb/class_loader.php', + 'phpbb/config/config.php', + 'phpbb/config_php_file.php', + 'phpbb/console/command/cron/run.php', + 'phpbb/console/command/extension/enable.php', + 'phpbb/console/command/update/check.php', + 'phpbb/console/command/user/add.php', + 'phpbb/content_visibility.php', + 'phpbb/controller/helper.php', + 'phpbb/cron/controller/cron.php', + 'phpbb/cron/event/cron_runner_listener.php', + 'phpbb/cron/manager.php', + 'phpbb/cron/task/core/update_hashes.php', + 'phpbb/cron/task/wrapper.php', + 'phpbb/db/driver/driver.php', + 'phpbb/db/driver/driver_interface.php', + 'phpbb/db/driver/factory.php', + 'phpbb/db/driver/mssql_odbc.php', + 'phpbb/db/driver/mssqlnative.php', + 'phpbb/db/driver/mysqli.php', + 'phpbb/db/driver/oracle.php', + 'phpbb/db/driver/postgres.php', + 'phpbb/db/driver/sqlite3.php', + 'phpbb/db/extractor/mysql_extractor.php', + 'phpbb/db/migration/data/v30x/release_3_0_4_rc1.php', + 'phpbb/db/migration/data/v310/softdelete_p1.php', + 'phpbb/db/migration/data/v32x/timezone_p3.php', + 'phpbb/db/migration/data/v32x/user_emoji_permission.php', + 'phpbb/db/migration/data/v32x/v328.php', + 'phpbb/db/migration/data/v32x/v328rc1.php', + 'phpbb/db/migration/data/v32x/v329.php', + 'phpbb/db/migration/data/v32x/v329rc1.php', + 'phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php', + 'phpbb/db/migration/data/v330/dev.php', + 'phpbb/db/migration/data/v330/forums_legend_limit.php', + 'phpbb/db/migration/data/v330/jquery_update.php', + 'phpbb/db/migration/data/v330/remove_attachment_flash.php', + 'phpbb/db/migration/data/v330/remove_email_hash.php', + 'phpbb/db/migration/data/v330/remove_max_pass_chars.php', + 'phpbb/db/migration/data/v330/reset_password.php', + 'phpbb/db/migration/data/v330/v330.php', + 'phpbb/db/migration/data/v330/v330b1.php', + 'phpbb/db/migration/data/v330/v330b2.php', + 'phpbb/db/migration/data/v330/v330rc1.php', + 'phpbb/db/migration/tool/module.php', + 'phpbb/db/migrator.php', + 'phpbb/db/tools/mssql.php', + 'phpbb/db/tools/postgres.php', + 'phpbb/db/tools/tools.php', + 'phpbb/di/container_builder.php', + 'phpbb/di/extension/container_configuration.php', + 'phpbb/di/extension/core.php', + 'phpbb/di/extension/tables.php', + 'phpbb/di/service_collection.php', + 'phpbb/event/md_exporter.php', + 'phpbb/extension/extension_interface.php', + 'phpbb/extension/manager.php', + 'phpbb/feed/controller/feed.php', + 'phpbb/feed/topics_active.php', + 'phpbb/files/filespec.php', + 'phpbb/filesystem/filesystem.php', + 'phpbb/filesystem/filesystem_interface.php', + 'phpbb/filesystem.php', + 'phpbb/finder.php', + 'phpbb/group/helper.php', + 'phpbb/help/controller/bbcode.php', + 'phpbb/help/controller/faq.php', + 'phpbb/install/controller/helper.php', + 'phpbb/install/helper/container_factory.php', + 'phpbb/install/helper/database.php', + 'phpbb/install/helper/iohandler/iohandler_interface.php', + 'phpbb/install/installer_configuration.php', + 'phpbb/install/module/install_database/task/add_config_settings.php', + 'phpbb/install/module/install_database/task/create_schema.php', + 'phpbb/install/module/install_database/task/set_up_database.php', + 'phpbb/install/module/install_filesystem/task/create_config_file.php', + 'phpbb/install/module/requirements/task/check_server_environment.php', + 'phpbb/install/module_base.php', + 'phpbb/language/language_file_loader.php', + 'phpbb/lock/db.php', + 'phpbb/lock/flock.php', + 'phpbb/message/form.php', + 'phpbb/mimetype/guesser.php', + 'phpbb/notification/type/approve_post.php', + 'phpbb/notification/type/approve_topic.php', + 'phpbb/notification/type/base.php', + 'phpbb/notification/type/post.php', + 'phpbb/notification/type/topic.php', + 'phpbb/notification/type/type_interface.php', + 'phpbb/passwords/driver/argon2i.php', + 'phpbb/passwords/driver/argon2id.php', + 'phpbb/passwords/driver/base_native.php', + 'phpbb/passwords/manager.php', + 'phpbb/permissions.php', + 'phpbb/plupload/plupload.php', + 'phpbb/report/report_handler.php', + 'phpbb/request/request.php', + 'phpbb/request/request_interface.php', + 'phpbb/request/type_cast_helper.php', + 'phpbb/search/fulltext_mysql.php', + 'phpbb/search/fulltext_native.php', + 'phpbb/search/fulltext_postgres.php', + 'phpbb/search/fulltext_sphinx.php', + 'phpbb/session.php', + 'phpbb/template/asset.php', + 'phpbb/template/context.php', + 'phpbb/template/template.php', + 'phpbb/template/twig/extension/avatar.php', + 'phpbb/template/twig/extension/config.php', + 'phpbb/template/twig/extension/username.php', + 'phpbb/template/twig/extension.php', + 'phpbb/template/twig/lexer.php', + 'phpbb/template/twig/loader.php', + 'phpbb/template/twig/node/definenode.php', + 'phpbb/template/twig/node/includeasset.php', + 'phpbb/template/twig/node/includephp.php', + 'phpbb/template/twig/tokenparser/defineparser.php', + 'phpbb/template/twig/tokenparser/event.php', + 'phpbb/template/twig/tokenparser/includecss.php', + 'phpbb/template/twig/tokenparser/includejs.php', + 'phpbb/template/twig/tokenparser/includeparser.php', + 'phpbb/template/twig/tokenparser/includephp.php', + 'phpbb/template/twig/tokenparser/php.php', + 'phpbb/textformatter/acp_utils_interface.php', + 'phpbb/textformatter/s9e/acp_utils.php', + 'phpbb/textformatter/s9e/bbcode_merger.php', + 'phpbb/textformatter/s9e/factory.php', + 'phpbb/textformatter/s9e/link_helper.php', + 'phpbb/textformatter/s9e/parser.php', + 'phpbb/textformatter/s9e/quote_helper.php', + 'phpbb/ucp/controller/reset_password.php', + 'phpbb/user.php', + 'phpbb/user_loader.php', + 'posting.php', + 'report.php', + 'search.php', + 'styles/prosilver/style.cfg', + 'styles/prosilver/template/attachment.html', + 'styles/prosilver/template/bbcode.html', + 'styles/prosilver/template/captcha_recaptcha.html', + 'styles/prosilver/template/forum_fn.js', + 'styles/prosilver/template/forumlist_body.html', + 'styles/prosilver/template/mcp_forum.html', + 'styles/prosilver/template/mcp_move.html', + 'styles/prosilver/template/mcp_topic.html', + 'styles/prosilver/template/memberlist_body.html', + 'styles/prosilver/template/memberlist_search.html', + 'styles/prosilver/template/navbar_header.html', + 'styles/prosilver/template/overall_footer.html', + 'styles/prosilver/template/overall_header.html', + 'styles/prosilver/template/plupload.html', + 'styles/prosilver/template/posting_attach_body.html', + 'styles/prosilver/template/posting_buttons.html', + 'styles/prosilver/template/posting_layout.html', + 'styles/prosilver/template/posting_poll_body.html', + 'styles/prosilver/template/posting_review.html', + 'styles/prosilver/template/posting_topic_review.html', + 'styles/prosilver/template/search_results.html', + 'styles/prosilver/template/simple_footer.html', + 'styles/prosilver/template/ucp_agreement.html', + 'styles/prosilver/template/ucp_attachments.html', + 'styles/prosilver/template/ucp_avatar_options_upload.html', + 'styles/prosilver/template/ucp_groups_manage.html', + 'styles/prosilver/template/ucp_pm_history.html', + 'styles/prosilver/template/ucp_pm_viewmessage_print.html', + 'styles/prosilver/template/ucp_profile_profile_info.html', + 'styles/prosilver/template/ucp_register.html', + 'styles/prosilver/template/ucp_reset_password.html', + 'styles/prosilver/template/viewforum_body.html', + 'styles/prosilver/template/viewtopic_body.html', + 'styles/prosilver/template/viewtopic_print.html', + 'styles/prosilver/theme/colours.css', + 'styles/prosilver/theme/common.css', + 'styles/prosilver/theme/forms.css', + 'styles/prosilver/theme/icons.css', + 'styles/prosilver/theme/images/site_logo.svg', + 'styles/prosilver/theme/plupload.css', + 'styles/prosilver/theme/print.css', + 'styles/prosilver/theme/stylesheet.css', + 'ucp.php', + 'viewforum.php', + 'viewonline.php', + 'viewtopic.php', + ), + 'binary' => array( + 'images/upload_icons/flash.gif', + 'styles/prosilver/theme/images/bg_header.gif', + 'styles/prosilver/theme/images/bg_list.gif', + 'styles/prosilver/theme/images/icon_download.gif', + 'styles/prosilver/theme/images/icon_offline.gif', + 'styles/prosilver/theme/images/icon_online.gif', + 'styles/prosilver/theme/images/icon_rate_bad.gif', + 'styles/prosilver/theme/images/icon_rate_good.gif', + 'styles/prosilver/theme/images/quote.gif', + 'styles/prosilver/theme/images/quote_rtl.gif', + 'styles/prosilver/theme/images/site_logo.gif', + ), + 'deleted' => array( + 'adm/style/acp_ext_delete_data.html', + 'adm/style/acp_ext_disable.html', + 'adm/style/acp_ext_enable.html', + 'assets/javascript/jquery.min.js', + 'images/upload_icons/flash.gif', + 'includes/ucp/ucp_remind.php', + 'language/en/email/user_activate_passwd.txt', + 'phpbb/cache/driver/apc.php', + 'phpbb/cache/driver/eaccelerator.php', + 'phpbb/cache/driver/memcache.php', + 'phpbb/cache/driver/xcache.php', + 'phpbb/console/command/fixup/recalculate_email_hash.php', + 'phpbb/db/driver/mysql.php', + 'phpbb/db/tools.php', + 'styles/prosilver/template/ucp_remind.html', + 'styles/prosilver/theme/images/bg_header.gif', + 'styles/prosilver/theme/images/bg_list.gif', + 'styles/prosilver/theme/images/icon_download.gif', + 'styles/prosilver/theme/images/icon_offline.gif', + 'styles/prosilver/theme/images/icon_online.gif', + 'styles/prosilver/theme/images/icon_rate_bad.gif', + 'styles/prosilver/theme/images/icon_rate_good.gif', + 'styles/prosilver/theme/images/quote.gif', + 'styles/prosilver/theme/images/quote_rtl.gif', + 'styles/prosilver/theme/images/site_logo.gif', + ), +); diff --git a/install/update/new/.htaccess b/install/update/new/.htaccess new file mode 100644 index 0000000..0be28ab --- /dev/null +++ b/install/update/new/.htaccess @@ -0,0 +1,92 @@ + +RewriteEngine on + +# +# Uncomment the statement below if URL rewriting doesn't +# work properly. If you installed phpBB in a subdirectory +# of your site, properly set the argument for the statement. +# e.g.: if your domain is test.com and you installed phpBB +# in http://www.test.com/phpBB/index.php you have to set +# the statement RewriteBase /phpBB/ +# +#RewriteBase / + +# +# Uncomment the statement below if you want to make use of +# HTTP authentication and it does not already work. +# This could be required if you are for example using PHP via Apache CGI. +# +#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] + +# +# The following 3 lines will rewrite URLs passed through the front controller +# to not require app.php in the actual URL. In other words, a controller is +# by default accessed at /app.php/my/controller, but can also be accessed at +# /my/controller +# +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ app.php [QSA,L] + +# +# If symbolic links are not already being followed, +# uncomment the line below. +# http://anothersysadmin.wordpress.com/2008/06/10/mod_rewrite-forbidden-403-with-apache-228/ +# +#Options +FollowSymLinks + + +# Apache content negotation tries to interpret non-existent paths as files if +# MultiViews is enabled. This will however cause issues with paths containg +# dots, e.g. for the cron tasks + + Options -MultiViews + + +# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from +# module mod_authz_host to a new module called mod_access_compat (which may be +# disabled) and a new "Require" syntax has been introduced to mod_authz_host. +# We could just conditionally provide both versions, but unfortunately Apache +# does not explicitly tell us its version if the module mod_version is not +# available. In this case, we check for the availability of module +# mod_authz_core (which should be on 2.4 or higher only) as a best guess. + + + + Order Allow,Deny + Deny from All + + + Order Allow,Deny + Deny from All + + + = 2.4> + + Require all denied + + + Require all denied + + + + + + + Order Allow,Deny + Deny from All + + + Order Allow,Deny + Deny from All + + + + + Require all denied + + + Require all denied + + + diff --git a/install/update/new/adm/images/alert_close.png b/install/update/new/adm/images/alert_close.png new file mode 100644 index 0000000000000000000000000000000000000000..79750a013c5db627a14bf3d57edc8f8e3a477046 GIT binary patch literal 2097 zcmaJ?YgAKL7LJ0*E65`_OVRcktP$(m;m=}RWa0BUlnFI$KFgT?|u4kiA3~!|za!^XLV766|9vif#KejaL{7)!6A}_|31pm15rZevXf%TciR7k7xWS211XQ|7 zVaFu}76kJZVmTs~Ndbc*7%e-9FtPed|G0ug{y|m>zi*SiVR$7d#}jb`!`M;+DD?ERrEISR|7J zeqkN}7vzhjhWH(x%cXOqFak>X5QoLY>J@Nev4GC@B#`|*{mC94R5FpsCi<{wRDTMY z!ydg(~-9>ey7ZS}zi<3m!t+ZB3SKgt9WQ7Gdw4$Ft9d~}4j zFW?e{Nv?m9pHdj_97b)G@1|0l9`^7s(F1|DU%OVV^zp?&GlP5Zhxvso<-*BtV`j90+^+Kq+rZ^rVgVBNYDp_VD1tDjYM!MYi*vF#7t(PL0l z)DyZYi6cAnqoAfJ+sj$iJv7vitlLk2akMevXSk}Y?AyJOkta(^u++rfgKD3$rw7cKB`MuM-owP8{DYdB?iOn(y5+F}JX2vgz#XG`}8n#b{t^MpOj~ zg+kWF*_X97H56K5&}Lh+f9sl>d^#RHFta*$?i_(mKY8nxM|XGkwh+v4o5;OgTKnnc z(t&~Y_IBgXf1jGN&Iw?#NDM}n-5HHWV`FJ@v3LC2uj}dxI1;{9<)g_%Ez!i`;!Br| znM`Ij^a@jO_Uv(;ZhyqJ-C%Rg;?5DqCY$?$XqHO_x$=jU7ObcxOv{#IgZ&VT-z={VJW37mK0GC+~Yb-~OSGgC|l zZr!!dj?z>Fuz&h~MEzxs&zgQg<3&zW3AgzLh1+4IKqzYtm@Vp3jR!(7oD}PFIVLjH zzWr@oYYbJz;Z3@9K1=N#x1V{!$2%>0ev*Z*jE<<-YCWq=PgvMqn?3dB6pvt;H{Up{ zd7_DioBR6uGJWm)QpUF(*kVuz0!+ph1Beywao>^UFx1wac`1|_6gs6iqg>D5F;_n_sqUFU+rFJp-wFwhQkVD7JgIw13D@SeKaZ>)ZJd4< z+yAO-gF4Z=JHFzfN8W7Hfby#=Ocj}k59M^l>lQ38kK?L8?&YOrwf8gR`5pnzrJk07 z9h>HqX7}&L$Wx~68AZB`wWs)RGd{E4H?(8tzjDos27za(tedB`w-v2!Ti0L7i8%Kg z{pab)fVr32!GH^D*`%P6vmxhA_uiJxkAp>NlObLf(dO&-mrdKxoIaINP)J#o)3)m4 zP&-o_>eMz2#Z3YgxgTUO}hquind8 z6ZFON6Q7E3^pnjtJ7$l0Z`TYmj0WTG-oDUjK}#HF0P-Ihb32c&Kw&oWB|A*ZcNl)+ N9Ci?^(l_eZe*jUwWY7Qr literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/arrow_down.gif b/install/update/new/adm/images/arrow_down.gif new file mode 100644 index 0000000000000000000000000000000000000000..b7fbf7e2764e1f1c58ed0a166ec0d02eec927970 GIT binary patch literal 51 zcmZ?wbhEHbWMg1sXkcJ4Ha2EpU{L(Y!pOkD$e;sc1I5`G7?`+v_!DNXzIefUIRk?= E0LkGAF8}}l literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/arrow_left.gif b/install/update/new/adm/images/arrow_left.gif new file mode 100644 index 0000000000000000000000000000000000000000..ac92cb49719f40ae82a284f16e3b9bca63feeded GIT binary patch literal 49 zcmZ?wbhEHbWMN=qXkcJ4Ha2EpU{L(Y!pOkD$e;scGk|0mm^geG+E!#f4`5`l1^}?* B2Z8_q literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/arrow_right.gif b/install/update/new/adm/images/arrow_right.gif new file mode 100644 index 0000000000000000000000000000000000000000..3a080ffdfe21b646239778d71fa09e843351a63f GIT binary patch literal 49 zcmZ?wbhEHbWMN=qXkcJ4Ha2EpU{L(Y!pOkD$e;scGk|0mm^fI3+E!#f4`5`l1^}+L B2TT9} literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/arrow_up.gif b/install/update/new/adm/images/arrow_up.gif new file mode 100644 index 0000000000000000000000000000000000000000..0ff587218205e6ad32bde7ba0e65d7d4eeff98b8 GIT binary patch literal 51 zcmZ?wbhEHbWMg1sXkcJ4Ha2EpU{L(Y!pOkD$e;sc1I5`G7?`+v@)=g_Tqsquf`P#r E0LJYIr~m)} literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/bg_button.gif b/install/update/new/adm/images/bg_button.gif new file mode 100644 index 0000000000000000000000000000000000000000..03172ff5c674ae95000d265bff3e5068cab73af0 GIT binary patch literal 182 zcmV;n07?HxNk%w1VFUme0K@ln-?Cj_0=;r6<;o#x!?(XE| z<gwv++S>pB|L^bbA^8LV00000EC2ui00aOS000FupeK4-sVxFUNfH2ba934PwB4Iy kAy$z63IYUzDIOk-hJnN66fV%gBr*9|uh^`1%MAelJFawYMF0Q* literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/bg_hash1.gif b/install/update/new/adm/images/bg_hash1.gif new file mode 100644 index 0000000000000000000000000000000000000000..61163679a80e2c6074658193458280c8713489a4 GIT binary patch literal 48 zcmZ?wbhEHbWMyDwXkcV;IBLtlz@Ye(g^_`QkwFK@28y#XFfg(AFi+pMLY#}i8UVn0 B2ekkI literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/bg_hash2.gif b/install/update/new/adm/images/bg_hash2.gif new file mode 100644 index 0000000000000000000000000000000000000000..d31840361c1e83c8e4828c1641d1b7d629c2068d GIT binary patch literal 48 zcmZ?wbhEHbWMyDwXkcV0*zksdfkE*n3nK#qBZCf*4HRc(U|?eJVV=Hig*X?3H2~Vr B2!8+o literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/bg_hash3.gif b/install/update/new/adm/images/bg_hash3.gif new file mode 100644 index 0000000000000000000000000000000000000000..40bc7e1b5c67192a6299730460b88e46ce9b4c1f GIT binary patch literal 48 zcmZ?wbhEHbWMyDwXkcV`Q`pGBz@Ye(g^_`QkwFK@28y#XFfg(AFi+pMLY#}i8UWRr B2vGn4 literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/bg_hash4.gif b/install/update/new/adm/images/bg_hash4.gif new file mode 100644 index 0000000000000000000000000000000000000000..54e7f0019f7bca1fef37bee315e6b44380505ae0 GIT binary patch literal 48 zcmZ?wbhEHbWMyDwXkcVWOG{&5U{L(Y!pOkD$e;sc1I1Yx7?{|5n5S=BAAMU((ec}GodoSPI zdiMJ6%QqJvJUe~&(VZ7>9=?A6;PtyZ&tG4D`0W16x0fG1KYi!XxqD9@zJ7P+?&JHf z-adNs{`T|NR~|jT^zhl^H}B8ifAZw*2L@7r;!hT^avcx}@)HBw-UE{gJao$X+}nyy zx>(M?up-H8t<<_3Yf^TbR_=fBA=^i9_SqRFvkv6#=Kio_j`Q;E?|$rwJMujEU%g6G zlTK?}dxv0G7ejAfzwpF~98;!F=^sWQ>T^Bp4Gf?@zQ19tJkh8+`OrN=kC4x@(&;K rKY60{{Kd;xdT-vodoT9!Bh#0!-wb~I{Pp|K-+%uZm|t--F<1it4*>Fk literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/bg_header.jpg b/install/update/new/adm/images/bg_header.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5ecec5360b11992492807a8fa1353ad25392d55f GIT binary patch literal 385 zcmex=uI=H%w(=K}(Mey}1a#RK7?>VxzCA7BvVV6b6eVrCR%U=n0x7G(T?gdvlGk&zMT zNCaTz;A8|TLWlraj7&gR3INrz0wobZn9(qiIZf~)lhLGLkq|KrK}H5f7G{Jz1B1{9 zM!`TP71jT@7G0w2`|tAh z!qVN!)7{6=+uY{v&DP)P^ZfVw{_XVpfq|}%G~S!|Npwo z+1>5?A^8LV00000EC2ui0A2xU000L6z+P`-Voi?7q;kn@I-k&}bV{vSuh^`1%k6rz zJsfB?qL|O41ejE#(BSV%Upt9x5m@{kM%(=7Y&!9t#9!C>oFt6t4|HHrYRW6PdRySDAy zxO3~?&AYen-@t~;D7`cXyAbeCaBNG7S|l1w(~WRp4|Amx-)R%zvxSZ1l^mRxq}<(FWFDdw1D zmTBghXr_tg3=6dB=9_TFDd(JY)@kRRc;>0+o_zM{=bwNED(Iku4*G!sh$gD&qKr1` z=%bKED(R$@R%+>`m}aW!rkr-_>8GB4aKNafmTKy$sHUpws;su^>Z`EED(kGY)@tjm zxaO*Bt{Cv(>#x8DE9|hu7HjOW$R?}ovdlK??6c5DEA6z@R!eOL)@G~iw%m5>?YH2D zD=x9vj%)6@=%%ax?z-$!yF!3Za; z@WTHx?C`@7Lws<=6jyAqy%S%o@x~m7n{me=hb*$QACGME$td$6#L6tU?DESn$1L;A zG}mnN%{b?*^Ugf??DNk+2QBmv7jWRi(MTt)^wLZ>?ex=7M=kZ#R99{F)mUe(_10W> z?X}iD82$CwWS4FB*=VP&_S$SOeL>rB$1V5Vbk}XS*D&0z_uhQ>?f2h+2QK*Fgcol3 z;fN=$_~MK=?)c-7M=tr~lvi%~<(Ox#`R1H=?)m4Shc5c)q?c~`>8Pi!`s%E=?)vMn z$1eNqwAXI``|Y^ruKVu1_wM`ezy~k<@WdBy{PD;qul(}NH}CxO&_^%*^wd{x{q@*q zul@Gickli8;D;~%_~e&w_|WL5um1Y%x9|S@@WU@c2pTM8|NZ#qumAr1_wWDz_UJ+V z07$?B8t{M!OrQc05`qOf@PQDFpaduAj}}nyf*8!81~TiOrsjt$i_Ch@r`hdqa5c* W$2!^#@s4=RqaOFj$3EUL2mm{Rf3^$& literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/bg_tabs_alt2.gif b/install/update/new/adm/images/bg_tabs_alt2.gif new file mode 100644 index 0000000000000000000000000000000000000000..a2142d5432be00a2e6395bed8b503a0eb053de5b GIT binary patch literal 420 zcmV;V0bBk@Nk%w1VFv(d0M!5h-R=9j%-PD^>;M1%;p_6)>G#^|_}1t3)8z8r?)=T( z?a<=z%--$P<@43%^v>Vz%iZkH;qcq+`O@R@&fxFM-Rt1+{o(Qc#?RT|@B7^5?%(eF z$I#ot(%s+b@Y>|;@ACHY`Tyeb|LODm%G2Gz$<_D!{?gv&)7s+H-sjQVBe^A^8LV00000EC2ui00#hR000KTz)}f=0u2VC5byV*4MZZCP8OS8uGd`8!sRA7 ziLe+0D4Q{ow3=gRyGez(oOGz$Z;rfv)#&?i2!Vnu6NQE<3yF$85si*16p@lU50#cR z3YnTU44s}I5TT+P6{V&c0;#Gws;VBXsjsjuumS|Nx3IabyQ;mZzqYtX#769z?d||0@&Ft4`1$(#{Qds_ O00RmfNU$KlAOJh7n-8b} literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/cellpic3.gif b/install/update/new/adm/images/cellpic3.gif new file mode 100644 index 0000000000000000000000000000000000000000..be46fc6fcc29f3b2e58196de077fd154c541ed06 GIT binary patch literal 826 zcmZ?wbhEHbWMq(J_|CwUjYc5;%JdWJ?TzLz5@)z+IF6J*Cz2jpx}USQym mXV8t{P)J~CWMbn}@YvAc$jr{K;4;BrAyX?m7Xu3mgEas{NhJ&b literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/file_conflict.gif b/install/update/new/adm/images/file_conflict.gif new file mode 100644 index 0000000000000000000000000000000000000000..4458c4ff230b69b2c5d0cb5e15527c07c67ea968 GIT binary patch literal 344 zcmZ?wbhEHb6krfwxT?bNyrbipug~9)AD=kbJ+iWR5+3@zr{~qVvrl58KD>PK`pT83 z-d-OjO?;Z2^?B`@XSFrYT3cRaroX;%Vn|&9BNzzMnYpV%4e_ z(UCu|U3+Y2{Ukp2Nud8@7sp4YCjbBce`I6;BpIj;6o0ZXGBBtx=zt6c`H6w8)M3(u zk_Hj2g-i~HIYAtYS4=U;RI|CXX3InYyDfqfRk;K7on3oP(i!qOu5kOQ4vNbd;iyia<~sQ#qRxC-0;{311cAfGAn1 S)lOV&917eVY;&C*8LR<45pCE2 literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/file_modified.gif b/install/update/new/adm/images/file_modified.gif new file mode 100644 index 0000000000000000000000000000000000000000..17e8f976c3745c971ca0d8bb4c36b6d1569471cf GIT binary patch literal 358 zcmZ?wbhEHb6krfwxN5-g>3ra;m$&{rU;6C+o?nNVex8v2c}n5=-Ax}ahX4Qj?elr( zKS$XAyxIO^FT=OJoWG9?e!d*{J4@oVNM%Y|)=%tltkx z{5;0>_w%KnR}=nzJo)RC*uS68f1dOBeo*wsS=T?WHvTwc|L5ua@26DWUT^q*MDg$2 zy+1F8{Jm=RYcIq9|Np=329XS;0L7myj0_A03_2i9AU`p%H9O1@D4QT6wU#NtAjgSg z{fa3DnQVTS)?5)1(AuK(mfImG#aXQ|`@_^eA*PQ%6m?Z&XE|6Eg>!G(Q{1YG+3VYXA(QmgfKf literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/file_new.gif b/install/update/new/adm/images/file_new.gif new file mode 100644 index 0000000000000000000000000000000000000000..d0ec75876d8889d1ec98c16d430c3c7546c3c9d0 GIT binary patch literal 229 zcmZ?wbhEHb6krfwI3msP>3rbFi{a1i@A-L3;pYkIUx%4qy}b4O?xsIS*njM0_7IE0OUeru>b%7 literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/file_new_conflict.gif b/install/update/new/adm/images/file_new_conflict.gif new file mode 100644 index 0000000000000000000000000000000000000000..84efde4faa94e7b0c95a2793e4f355a6a5c2a56e GIT binary patch literal 357 zcmZ?wbhEHb6krfwxT?%BZ{D0WYgXO4b7$+;EkAzzxPJZmix)2zFJ8EG>Ei9%x6PV0 z)J{3qZ&;Tg@WMO1rP-f5pnGNz216$L9 zi3K4UG79q#Cm800i7Z+XVwfpqc4^I*M1i<12^SkUI+-jY+rDi6;l`@yB_a~!&Mv5V zAZU5>CU*JAYDLBRNTH_45=Gf4A&G89CKeXPNDk(pIwi)b(*s3WyF}XO$}t4WGb!^X iMsYf^@vje*@>LcNh~ksn;l$0!!6(SUxyIR%!5RR?SbJyy literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/file_not_modified.gif b/install/update/new/adm/images/file_not_modified.gif new file mode 100644 index 0000000000000000000000000000000000000000..8f9b3d383916ce09c6bf67a1f8788c6c96ffa794 GIT binary patch literal 570 zcmZ?wbhEHb6krfwc;?D*;Q&>CNV|uNEGB zI(f&#N!uT;IQIO;(=WXnuIK0HXJuutJodb0`Pr&j`$~J3Cg#@{mz1cgswycfRaI5b z-T%bG!ot$VVban)MMXuHmX_%m8U1rsR8?1-Svy+U*hfS}I66Az7ZhY?=U7|Y^)J~| zQdU;kI(h%qx8)TT;Smvbwsy9*c6D?1wywGq79JiD7&vvw*5s_BiK~vMq@+xpI?deN zqI1Ko+RkY;J@ez@;yTt|TXW(?-_{4+oA3Ys|DRz<0mYvzj0_B}3_2iJgW`mNeR_jy zlPiN0E4wqR6LWJfr?bn%NzNR-jM9^4PU2#0;+?g?#i@mTqNA9Cx{avqWajx3jm70G zl@x_%IcQ2 zNYlYo%|LY~C&R^s6P@{7pM9Rh*2Kv5(?v*1)KNiSh*_M8mDfO_fsv7s?F}y%3xhQP D5Zj>E literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/file_up_to_date.gif b/install/update/new/adm/images/file_up_to_date.gif new file mode 100644 index 0000000000000000000000000000000000000000..c37234264629d4f5a4378c07f0b5be38a5b34f66 GIT binary patch literal 357 zcmZ?wbhEHb6krfwxN5{O?|DbuBa6$g&Xzt2t$Y&o^23XT&wFmZzLNaJuK!I*$`kvX zryjXaz0Q3*bm#SrDbH%|{k)d<%sc9l(S{cbmOY;|>sia&KQG&!W)(d1EqWHv{W?G4 zvGwae&r6;M{r&&9^L6gNFYCYl{ruq9joKG+DUTfsp7w^@rJh1xpy(BAGXPu&@8Hh_!g;B96)+ zPC-Ln0|D+J4%I-eb_L}Qu1FS!AbE8;CB@cA5vC?X2{8lhD1AO7(MUuasVh8^NkePx>nFP$W%Nzf-YH-5I`n?DLqf7ejYMy2O3{H7xq1E_Az3TJWFyuj U>|R>2x1(T&qnhx!=K>7Y0JXDBD*ylh literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/icon_delete.gif b/install/update/new/adm/images/icon_delete.gif new file mode 100644 index 0000000000000000000000000000000000000000..57962d51728640b66636143a9f4fc91ca9afc1fe GIT binary patch literal 255 zcmVHCpIecJdn*Ws<-1jU*u44=Z&EK@$}?BVfohG z?t_~D|Nr7KR_yHTA^8LW0018VEC2ui01yBW000Gi;3s|*fFuQ?9AoP&UMw$A`w((2 z505Cwfm|@AASGgqj3K7kFk*$nFV^WOn^l=&=;2f|n<__!DCE4=&RC`~vmf6j`@#;V zl`@G!X6K+YG7c1OVQXF+Pz@gdOc6N|8Zj6m4+AXky F06RBtaaI5T literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/icon_delete_disabled.gif b/install/update/new/adm/images/icon_delete_disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..da55bbbe445dfc0e71a24ca92c901ba292bbb6d1 GIT binary patch literal 249 zcmZ?wbhEHb6krfwI3mPw^XAPfmo8nudiBYZCs(grxp(j0{rmTC-@JL}&Yc_AuRnV9 z=-IPp*RNl{a^=e7$B*yazWws$%S#t8{{R1-9ER$0FlKT^%7{*#G>%ZZ7 zY_8Lxjc)437J@)Vr7jC;UULk zPKV?r0ujVSED}2-htUW~afk*0WkYO;IvtJ4pb%XOrU%v-Nl})?@(5tWE=+{(=Nra~ s4p0ODY_g7gXeJ0FLxD#kH68#MZyr2KKqCSbE+!}+9WyGGFe)JcJIK{-EdT%j literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/icon_edit_disabled.gif b/install/update/new/adm/images/icon_edit_disabled.gif new file mode 100644 index 0000000000000000000000000000000000000000..ac96b0e6dca874183e3165c98062c1f8008dabfa GIT binary patch literal 239 zcmZ?wbhEHb6krfwI3msP^5x49A3i*I@Zj|6(}xcqzJLGz?c29MefsqATOVxbgn|`%|Y*ojrT@s%|-I1Y`h$lb@bFUq$Q2DCK+fcGFSrudTw>% literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/icon_folder.gif b/install/update/new/adm/images/icon_folder.gif new file mode 100644 index 0000000000000000000000000000000000000000..845618c1a266a23aa575c2f12db1d75830e2c1f9 GIT binary patch literal 662 zcmV;H0%`q6Nk%w1VH*G&0M!5h>hboKy4$_d@kWTj>Fe%RlgH%d z>NI`4$<*Isn#!cY-TM0b_V)Pn_4hl0zWDk1#M$et#oM60*yri&^7Hj=p2^(g?EC!u zEO@$5jl;0Y;qdYE`TF`Pce%^n?RBTp;pFJ#>+!eE;IYl+CUm&=`1!Wb<{@&o;Ns`s z;pTO9b>ZXa;OFj%u+*o(*FS~8@9^^D<>}_=>-6>Z?CtRG@A2yF@A2~V0001)nVDv0 zX4~H5A^8LW002J#EC2ui02=@s000L6z@Kn9tYkV1&Z3hc5TDRrAv7BWR1{U9G2;}X zPsSoa0SwOQ0YH#gFu+od$~@TE@0&B=g!)1YGa_{l4i z6CjHyZ$k?w8xIo@5Ij6Cs4k?d6NM)WLj?%{533M9J-NBIs}BGPekc^RH^s)s$i)y3 z0vtaU2LKZ{7}Xf2KH1tl))+Sv00%M|BNGuj=;`X~>JTXn88Z$k7&P|wJlgs__x2bm z0S?H4up@`Tg9sBM+yTMEf)D~A(7-{lqQ#3AX+RJVf`bVNIdq5|NwOr#91Ry72mlg+ zOPAQRy_|_4M}&YG8eqtAp=VFCT)KMr99k0tJZL3$Ah5x-sne%S5$q@-?gt717?!2k^n w7FMJVv&4f20||9#@X$d5W;g{nNN5nlfd>mQ8c6U0CklZh(HmiNW;s_vYy9{r>*;_xR1$;P3GAcB9LUvC>+V z$&2-B=_WAqx`1$AQ?A+<|z0u?;ce?EE@ygWS9B;PK-Raol?$g@g z!q@2~bh!Ha`{n2B*X8l>^7Q!m`d5<1Uzf;IkHlr3&O?X5Xq?Dqn#g0B$KmAY?CtRG z@AB^N@$>ZdAaS?*{QU6o^WWj-0001)nVIqO^!fVw>g@0G^Y!HB>Ly^5Hj2{e>+WV| zX4~H5A^8LW002J#EC2ui02=@s000L6z@Km^G$cwDOtMl+7>H1)fz(kfI3Nayvru$M z&nOWAGfg0bbSzDPOiVC@SeQBi*0FrdqhEUfCn#blBNGIBH;Iahd;}mPf@3Ejh$134 z9+{dRiF_a@azYyz03IR{1qC7vJFTue4FwS*e;6A=DkKm$1p>YztvtfRBEAJT5F{!; z1|1-=zQz&L5yLzY(FF}49R>&_0tGKQGU=NA`1Z> z93t2_K#*V#0l|Fj;31&k0UHrGbbz6ufD9KHF}?`)!p24(FEYB2Q9uKX3K|5oV8N25 zj2t|2$Y7CUhs>5NS_sfkfuaE63pj!beRv=!QK3OC?1a&QLIDdsqDq}gb*fSd72v(F zAfanl8Z;h=ec-jM1Pd?xAy7b2!hp8}eAJjb7p`3i1Qj5-P$5H(9y$UG9!xlJj~p2) zT=~B0RTJRokGz7 literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/icon_folder_lock.gif b/install/update/new/adm/images/icon_folder_lock.gif new file mode 100644 index 0000000000000000000000000000000000000000..7afb092a8f1db6878d8ac80c4cf6840edce929e7 GIT binary patch literal 681 zcmV;a0#^M;Nk%w1VH*G&0M!5h$_dg%Ixj%$H>gP(dBh@b#*(t3legF1G1aU_W0Y~;q>+Q&(YP>)!0mixcK?`>g@0D@bdEW_51w%UteE>f`U+u!$U+w>+<;6 z+ur&5`tb4dT0g1-0o`MbTrqP*1e^!7i6z>bcOz{14z_4e`d^zQHRnVFepW@Z2Y z0NdW`2Bij}s4|2L6GI0Z92y<79X&j^x3sz%92;Lh3=W_<#Kp$P#Hs}h zKQtFCGBqaCCZj#q*gn)IH8LC*3IYcsA3Eme=;`PmG6Gx*GA1SS^FG-3JoNJ>G7uMX zGIZ=1NU)&6f;wcd0$5^z!-o(_ka$p`;sc2#IxJ(bpu-M{AVX3Nkimn=3;`Yt$ieCY zjSo8>$dtKa1rG$bJcIx-s^@^l5B}Vlh&l5?g9J#Cf*^1W*EJpPoWamRv7*(A0a_5i zVQVIj9x%WGD`0{|g#c)4HfV68Edn1ry!zlHY_e8TMxO@ZpP-f)YE> zW>~SdaRVNsaE)p}1c00u14w4rtdjuXuh&qZNa5qjffxk_p5+|kFWj3q8l)f%Wr~6b zh$&_WvDF6x(H4RmC=Er7iUkn{#N185$J*JZi2Gp>LjVK_6d+(g(X;ysI6{mdQ6d5Z P4G`!-glOSGNDu%!s{lm(^`qKhKY^J)Ze_({r&#i-O} z_V)Pt`uoh?>-F{b>G1aW`S~n)x|*`c#o6oZ^Z5Jx{LatQDR;T~`ug|y`Q_~M@A30c zj>IByw7 z&jMvb0x`~L6R6gT6~I!_qjWae@1}F8(@qWkzoPxdmdy!!E|64(S{2)EU-WfE>Pe?3;-xF HL=XTw3P?}z literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/icon_sync.gif b/install/update/new/adm/images/icon_sync.gif new file mode 100644 index 0000000000000000000000000000000000000000..16223dfd9a4b92754df7790c789cec24b7d67976 GIT binary patch literal 251 zcmVNk%w1VGsZi0K^{v^}>7e%aZrDTJh7W`L09zq$~BncK((G@7=-h*t7Vu zPVDRH?&8q=ofi19OY_N&_^?RsKR{g?>#zjFGgGW?$$ z?CR$InhySz0PO7SA^8LW0018VEC2ui01yBW000Ge;3tY!U{udFe#?juUMy?L#|dJ9 z$$ShbozFnl$VeoB0pPt9S0)IePTylP6CeKYo1s_U%WH9vwMy zEY^ fg@u@HtQiE9{Ka{=`$Tz_bHq6X1T_-06&b7n>9J!# literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/icon_trace.gif b/install/update/new/adm/images/icon_trace.gif new file mode 100644 index 0000000000000000000000000000000000000000..5c622e9a9dc22036b560f2ef5bbc6b910abf6903 GIT binary patch literal 307 zcmZ?wbhEHb6`11UtW9k z;`8^PKY#!E@$0uy`3&QVna1TaOe$vDH_UZxobT8$^~f9KNB-W3_MHl~Ri z_51JNfB*mg{{8#s&!1nve*N_6)5nh=-@kwV`t|FlPoF-1{21s$uuHKJia%Kx85qnN zbU<<-KQXWc9Eg6TJh3KZ`;s8nhYS4VPQP-KvdmNTQ~uD!>#)7s^+<(6%!Zk%XSb!u tX-clWme$Q7-I#lyFLP=RK(7o6YFx>g+usN=oj_T%#VQnKdw{Qf+s6F2#8aMmmBX8~`79gE9mnrY0tpZxK!g+{1QH)w9u^HmM3^W}(kM>Ogi$&Y4T$$SE(~K3f`=fCW}-qo9${FPjfD}M zjd8&+N|1CI7DbF8#0e@wMHpTXLJ-QvVi-It0@ZMl^z8 zL?DbnD9&-5zzaA*F${}hB#aRx#gKF)5JZ9y7KudTf`H*9M$lnVLy9(I2uiRl7mM-J zK_nVwVHA(Y1zNPovJ@TR1s*4<83>IF@i2smmJytc#$sY(ju#?PR)`B!BsvokL7^lW z3Bf3g;3z>s2o{No5F!wap%^9bJdBbd7#B$eVN4KshKX`K2O~rfLU=(?Rop4=J>a_1(y7#zr)o*k?CGDN{4NG!9wbmBx|J@HMtx)fX`I!<~W;=Dv zIla8}=thuyG0C2@2T(lw1DxbB0nOvCEvmfYb>_2$j-pD}{N0tuzo|CLNwewROWD=7 z@0$5_ULtLQjwczDO$5!pGg|NBs}W?@hhb z)uC0_=F2N)pShj3dX1@Dsl9FVr|mYFq`9lBdUQuJ>k9m7`CsY$OR~OdvV#YhCi@$C zx$X<#>i*pq)I|fYwy4U>oAoXeK6@)Ck(_e4)}cU+%7p7IX_htnK9C*MaMf9LuNRE= z)|bBa;n`p92giEfsBIcOv-3H?ajvBf80%|sy==)bjx>+?ucjo5A7- z*9_Nnr#HT}kXw|xsLI-XscqI~Nx1m^vFe1z$xE$;*Bi{O2}^aChdy2E+3Ne##6_DW z_2-_gmC1L`p6VK&EZyqMytD24cwSlG>8{7hb{vmN%Ql2rDZXc}^g6reyiXN}=j|B&BXLJtE{q0HrTXh5{X@P~&7gNx;@Zi>-Cq|WC)&T&ysBE0xbaYvY${JtGMr)6e>5yV zrm=KR<=L9XrnW!*?q?Y~+hkdS+9r`Gp6y7z`s4G5p0X_Yb=KrR(sd5rA7~v(l}yVV zpag84UoZpUCI^2%(2=ue7V4<6cvCuVdY$?m^WVsj`l^g-tp1mf3EZyZd?^D@f14nw z*V(Go10BK73B@pbkSNfp6p|~~^Q_FyJM8*s!HIBH>~nqimgsEnoMNYDlZ3w+3U+0c za8q;fJ9BwABqb}{HzfL6-;=z)DgWU=f0ACXCr-cr-M_Pl_D@E$$X5HtG?VvDf4(sO zvrTgyci;3s*f6+Dnm7pli+6)^v{RDNBTXom$a6h@VELpysZk}DYTdFD(`fRGr@C}Q z?)+sQz}Uz+48>+?vawTA>~*Fz0)_KHqUNl}x$>1}utDY5bV1IFVtd-#pSb;6mP=lF zxLXC9s|v4qFEtVwc)|Uw%5%{d%$3@OiVPi^`7}ysQ@be1ES4-g#Z8m literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/loading.gif b/install/update/new/adm/images/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..e1ed0883e07c63f3a36f9ee38318ffabdfe44147 GIT binary patch literal 1320 zcmd6l{c9U_9LGOt)7<6K<~f(UB$vxmAJ&H~TlbKzUA3ESll8uJwt_Hp&><)jMP);L zm|QM*NnEn6Bh6&Z3@cmf9>f+l?VPUcL23mN9Qag_IhEqWZ^A%@so#rp-u?p*?x%ad zzMt3k{kg&9K)h=#1R+>KaPya6%@&KPzTRfHJ6*KX>2lzgb~l*K1W6hU1|vlojg(%m zKUg}tW9P2-u6%Ui@?vHBjGqs_oKg})!y7mCpzWiFN|TqDKGo@Tk*4M^Zmck@Cm4>n z8TPTU#~Id3yII!b<@kWd>q}+xucQ=@kMnUn=MU_C>D2?p*S(y7`G=p!kCb=p9P8=r zYmct}`1)7H$;u1+Qti=LynFMd#ZN9?UFuvP=luMh7xxV&1+R|_g(K0}nx~)J+tj?O ztEYD$IduMmtNFvF-OoJVxglPjn(+sMU*7zYb~EsQeS&|PhWj5L-P*Uke{D2YtHYkb z-}Q9>2-;O=bxlC5h)7DysG**$ts{uKTC%=DDNaa6onDwMAJglMr4pq(Ha#Qgs43ZG zcyqRFFrD?(%*~f;Jf(LpEYwVx7On~BWa{k&jtkBk&ZJLX^I6Rn$DA&0{7`@!VBb7< z99^H`L(^WD)7H7+>&(&F@N8nsygvKQZ6WvP#YQS2*shG_&427VX?^5GX5QB)-+J=9 zw!~cTw{7f3p z0QNq$f_xwjC9u0uf3+wnjEhTi8rTR<46BN*BI3J|qVQV>{28>Z3mCc(V8P~ec@?)E zDv)tl%vN6^)2P8ojjRv6NRqJ)GJ_LYz(zalz#uoPl_i0Kx~eRPD_P4+Zgw!F<~meB zB_(`7-q zS`7*zS?2gnS&45iNNwXqZIlGZo!%MI4C@6&u?*dxQCj`Ic_lnvoG9fr0&2^()g@8? d2uOVTp3nbwY83?`yc#5-wJ)159KZv+{{|9CDcS%4 literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/no_avatar.gif b/install/update/new/adm/images/no_avatar.gif new file mode 100644 index 0000000000000000000000000000000000000000..ad73330e713ec9a21f97366b326a8c66afe5e9bb GIT binary patch literal 930 zcmV;T16}+_Nk%w1VPpVg0M!5h!_3s-=IPqth19I^!oe!#m?2-;pXx4 z_2lU6!_Cz8_xS1U@6p)a$I#d1>FxCP_uJv+;pOS&>FnoQ6%sUqgoT9?6&QSdUl0ifhLMtk1_=<1 zTL1zIlbw)hY95S;PU3YWDB_uL7! z03h|FX24w^3i*en7j3nYtKz;q!c zu?v_ExZHIB)3%wg2-w6KOD7}$nLJU|WYjX~DVU5<8uhf2(a5EpOfvEaby7%18LLX- zxJIH@Ll#Fh{7MMoD1>AOEsQAeYr%bK|IxEoHD5A#TIT^&x3nELaZAmCo1rbJx4}ZD z@w|q3#xk7G8VeET@|ffyw{9lv1?}<>R}N=+K2mC+s?kU^(X9sRB5ERz+7hdz?==z@ zEdscJQ4EHQ04-S9E`q>A0S)&w6!3uTb%+2XG>!-m!t;XyKuI1b@Bnd!0xN>9D3BqV z2?`>rilAVk775u^4UoVD0!4|mgG!(PvF5=C{Dyqc9U2>?0AM63Y;eX2DjX<@3MY`! z0S69x!a)aNbU;Ccr%-^u;TIHgcnSw!oFF1B5puCXgD0M%f`VE+U|@@=q%hzWApA!o zEFbW91qwUrg2ELf+!rJ)CCo>K3Gf~1i2?0Rv7wW?P%uRX=}{Sr2<1glfR?)y5XA%G zff>sRH#YI5nYxJSL$AcLo<$N*>&8ITG~mqx^(Dk?D`f$6J~Y#Iar EJ3isPuK)l5 literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/no_image.png b/install/update/new/adm/images/no_image.png new file mode 100644 index 0000000000000000000000000000000000000000..1061ee3b8fffaaef55c7a819438d50c02ddc33db GIT binary patch literal 401 zcmeAS@N?(olHy`uVBq!ia0vp^0YEIr!2~2t6#1S3DbW(wh!W?b)Wnj^{5*w_%-mE4 z_RAc6jJ#4J_r5I#Dqt`1^mPRb@pG1koAm>QI14-?iy0WWg+Q3`(%rg03=E9?o-U3d z6}O(=wB|cxz{3#GyocfYeokv`ai*{dN~Hytk9}P4ccP(1qf>sHH^=hdk2x8(zh+I7 zU;q92_m0-6c|MxzCMxGXeUf>ziuI(cuu6@6#hQKXDm5II#vym+r*;Ir@8Y!-cRUp| zo%Jy5cMKl-ZB1rVJJ@;n>pQ{Z4H0r>`X89` zPhOw*AitvAV50uan0h6{$1*!3+61RRtk-<`?5;+|k{lux@&w1z7LGPK%w(HtCXXk#N`@WxNae6wc6lAx^APAyRS5qO2$BM`FnGSU>QaHA zn~Ca54~zn){yq*hG8(VFn$4<*b=-py@WrW7hqLi_2XXIk&U3Gl-_kBCAAr=#cF73yU>cN6zDQp*1UOBsBB_uNSvl|u7bGrKzTb~iH4e*1(vwi)+aK@wtO+) zbSTx=3d?Io1Xt8#*82`z<}?j7pZ%>FxX%y|)>$FGC2&27{VvUaj!-sU;pHHAhbEo! zK{*K@TiAoa3 zDQ=r_hYS7O}Wtcj^uBdO*2`AJiGw5taZSZd^(7UJkyN(E!KoLd65&~c<-_k4FD z-x~eW7iXNFnVFe8dRqK&W7_0mAyrqd^=fQzaL`?Z5h3o>|CX7JEl=>~5TwWT4cq#~ z{LU~AcLQ3Oqa8@2f>@J@9cylahXOllm}QtC;w!+hjPuVKKY7I1cST{Z-d-Ah)TjN(iQDz^$5@p-;g_n}2E?v1QARSsI98q9vj~$)=XBOF{G$1z>KSEYG}u+tcaEM zMgM$HzT#BY-}kZ`8ym~7tlYE?36Zh2vtuxzbC~;N(;>aFv5_=6Ihp+I>C-!6w~}TD zKUcecy9@O+x&SiwpZKlqsnkEcWRcPkhkH>~TM$_a0bPo`;+J@wLH4tDfb( z*+oC8f(m2Tk!lBwBZ%4o004THGeu3rt{e7uvSzu6keuF)JMuW1cJF-*t3Z5mvQ=H+ z-qQHt)ekXJ)fb9~kBo1^-xb9Fg+CU2=6ku0rG<`rI2IV+o+ z(c{6m<01q8+nk*5jRa_zn8-_w-gFVZYa!TvfRbf&vT%Tm%q!?Y!t$h&LhKnBjuf?X zQOvzQ-S$3Oiu$*0_A*b`MwWSXbL}HWF<7iNb(|8e<$PE3&*{N>$umE{&Xb$h`W(f- zH8d1iysl}G&uo7u&&$he-*#+0VFREl?K8$;mNXVZ#{6J`?Ns zq;~3&I2o!4FKl`v8a%peU#Jwctqc{2I`%OtDJxg}iO%8~q)d4!f6Z@|J|wH3Q29O1FoWsFPex7xptmNBZi`D>kovl9!Y;VY_*= zUP&n9`$;ez1Wx273%u|5@83GmnXiw}X=h)5|I+jcMVM!}ob{y--j9`)6$MvU!9GXd z!7x!hQAXGkXXh6>C4cNnu=7N%7PBMeCROd$B9W1StHazYeo}gLwUyP?J{o)%k`_Lc zezyyZ%gZ}$KdbVj9{f_&r;}k#o@iksjyJQgU?y`^GI^0jK-%4 z?D|1|QxglFGKY|mkZ#pDik5-lNcjV6-xEZ;V@=zt-_Q0fa@?vPSd?8(PHst6{#0L1 zSwDf4qu=s+N(YY~BC9l_UM^EB-bG4-bdZ;!Z$Nmr<#a&CN_Q zh2}Qv)+8oL_LO}X_7)Qplc0dW)Zy0LoY3{SMiA_uS65ee#2x!G`2bO$Z*8rtK-#$2 zq@)X+Q(oxd!SAjF3E5We*I_Ix2SFf8-r-g&Gt$#7WxRfcsle%jbAvbQ7yA18;zUJ7 zdoG{Oct}b~OQ*bgwLOQ)5JpicD1NGQy|)Ok>FYPfn}7pS5XvZ54W0&LeSKXU`Wq3Y zPC`ohFW$*8t-H{NL=`)#gfz_J#J8vG;|=~BWyx`Iq9C!K;t(74&o90emX`9bv0WX1 zFRgVQcT8fHeY4}_A(lnW!osrGNvqqaqCcX6jFr?&q>VLy^oYs$qp7!6snMm(ekEsvrf_gjlyM^0Ft zaz|v3F5#(-t{=$CxNB*_#y*<)g0OGkH)=YJ23sc=|H$#0y1KBuoZPbN=xg^7BB?+% zId`%t_}OD5vfU;M>8(>?jNYkX1}XTB#xvv?p6!Qj#na8=DnR>svLPUw3yBQ_}i)l?gSH=bHH@04RruohYnd zH?Bj-NtjAstpNrjBG?bQa1SXo;P>B{dKmb-Gfp72$B%nrfs3wBfm0175-k1+7N2hb zqC7b|PU*IZJgELxt11zR(J_*>q!(jgPfUx!S!0d)#0-XCp(~S0%;n7r~9jU z1jiqQl?M??Yinx>w^Kfx{z&0O?RB_a8_dkfkv-~76I=%3$UEWob$YGALTC_?!;^V; zZkLRc!-@T-HV^H88V-XxfTli8Zvdw9YM4du0Is61H4pVa+MHd+`;QvQ{GM^b+V+&Y z{S5I5UVM^kjeabE-X7G3K1VN{qM0>fk6JT9y z{x9h4;`41uI37235or`%PfJUqkdTlF4xitcsozu6(CD27lHRw3qenK@)zy(gw=ZbR z{z>q2Pu#4m}_mf2f9R> z`6VlPPKfIG=x8Vl(t3r!>wI?+vurPBMrA3KLGDv86QN0R_-%sa#*HZ1;KLA#)*13b zbVWrHi-e1j!pGRySUwchT>~G=?tJmN{(ooQ9C~(`*LZolz6eH1`=pWx&V8Ap8wRCch=tM96mN)c@O@KW)H5ASfqLk34>Gz1zds4Un^Gh};RRRH8i+nFaSO&0G zVoi=QE;T9u8NFi-z(ll(QIK%xl^O{of8V>QjT0x~*lhL_%glrvA+MOX#oIwmXu{}} zloUNaI*qGqmTWt5l9G}P2BnCFPD_-|7g*$XwI4TESnDk)fvAYxxl{3;;jMiJ=IK^6 z1(Uh_`L<%ckw6Z+MO6_W86Y>DkX7@!YkdA)>IZHj%$b5<8*J4tP98N5EJy4vy}kSK z&S=Oc-yrSC=%~Z)KnJXZn2G;>MD5mak>=dk`1nz}TSYGxo3tO)l$o7tjQ(B!f%RgL>T>`x1ri4XMfs|i=x+kD2-H*u^?VI zxa3Qz>65<`#3_mOqWtAZf+z^Z{Rqer$_D{5bz9A6xv*C>R2uXNi!^fmH1xpwGD&(o zxgh9}ds!IsH|_uDicUnGV61-Q?{Gx6uKG!x^Xhg)-WMV8t+xQ!>3$epBjwmN=vmxl zz+ZgRX)F2?FmxL#ZeB;^)BE(AjKe6I&;Qg&nO!DD?OKwGFF_cuQVxt~sWn;+1Zdts zjB)~f1yzbkt{PXof4zllfLVpHuey2<`m(1_+9sCS1%NOx?{&^aXV;CzCI;%1)DY*z z#*zS>YEPK@6+}om1dwWcnH*KhM4@XrI=~oCqI{5-lx@i$m+?%$dsf}prHxa%=d+;J zgmrY?)pdO7_ey@m=T=fTt82PUu93inc$jltAW}WEPHPb+ctcXxu=K4CuZ56F@*xh9 z^!oK{7YOb1Xx`RmGU?Jf+QYgnHz)%`_}MfO?Ba4|g19a)KiWi%((2zg9tK!`oo#rQ z=LrU*TD%S4FrDI^665kwE*_qjf1JwO6XntH^l_7Hu+d|Q5!S%OvNFvQ-Mq@EU;hny z+34g*J^jU+=v&SnsUVP6=CvnFC>twJ_kd(|$7pLBy%nOZjrG2EPe4MC%CXk`fKIuK zA{x!)cAr1~H2|V2H8s_V)H2RX@M_8HUTYPcMEW%~K9VFv&PoCP;%~Zy>)6{b(;Fqn zT9;n7l=prdQAJi53t9+eY+ul92gm?sN8j4C(k;QQ{sii(fu4Rm-}1KY=J&Ahkc2MV zUsSjEC4aCX@Ar&VJQDPinq9OG@Iar9$-$fNF;m{l(W#r=eCK|664F0fZo)RSe!yF4 z*%V~Ph)jYUufju8)FKlYgvZD#W;gshJkT93wLhig`9f|-DueYHge@C&;q<6kkOgbw zL${Mua9k;Brz{JGbjpu`iD)#1v+BK)H}biTY^01S*x5kO{dB&YEluP~o&*ked2ul< zS2j4kcG9gOa=IvnoHp!PD=Yl=ZTxcM3Mt&skT>^?J8MNn#az>FuizOo<@fp;r-A1; zo;>*p3Kx&Ofn~-p;?$7CNv9YJqK;<-JJyQ)PJw}esg_k$XIRhYd&=(a8)$+_DLb(& z_@l3G_Yd}Qy1;3z)P2z7y9@%QN9BC?$EvC=GS}-WBpjCwNIV6eR1R6$i;QQpPscMI zFzK>)J%2X#HCq}ld)>1Db;XH4u2}maSyVn=YsvRyHZ;+$+};xQ(K{mnw$O`%@#UhT zBJQrvPQCz(_Ni#LDF_RrG;x@Gcz-4 zc>_nW(;K-SHIw$n5$kk+%ZRB)(_+y!EE#i%JZPAlVPRO*8fizOjBe~ zDk~t+%ahvkEk8fMS-*Vr;d=qRRurVRMDKQ@;t3li^pz>b&m>`g&%nybQ}V7t14^y) z*SKFFkrJ1kVo5mI%_2vdO%&eKq`}S}{=!du1k51Yv^)RBZ>C7$^FGRTO+-!7)>Tlj)M{+HR#p5rTne(5Bxc>%YnFV5&t zCo_M(>5Ktx*{v@2#wV4M_gkEv8!aKq%wZ#6!H{aTzbr51uGSr94#ZkqPiB^l+Lp!eJm^h?6R3y# z9xtCPkxyyIaF$s0P;c`@zIqxyH%3}%;(N5~gCJi^JLyU19?a0Aa%nqq)Y*i$NHwzJ z&l{bM_N*(Gys+2vF6z7bhJvN1rbbxq6Cp{IvhTVJ0Ii*w)T4OqFlhv3C&b53F-Dgj zFUwy!?+3^*?Nl9QIo_bBzuR&!_J|S?md~$Nyf-$P@$K!%%PSfO(~7Yx2}T(0&FIpA zJ*=d#mym3NO(wZ{#hCZX;Csqw8=<%Nyukd3iv2K*!>B&0YVU%$HtEilm0Aw*z?LlYAL=;;k1ys)LE zr8xhF(3zS6x!|}|>GkdT4pA`clUnnb9((hSz40fA9`K%7%I^b#LVvM#b{}Y(NI(X) z<{Ox^!;Neb=-leP1s02?#Vc$+oN~Qmkpr{I0X4~Gon#LF51_l4>Y5r?R@C_p?p6}d z5alpQE@)EuWtYs}?9c@CX{3YpSMH`epl*C<182il1J5qSt-^t^u!L^X z(9p!iP_mTSnBDc=n5tzXimjTN@9ohi(#EOFYyo{W0q|He7Hbv^H4aWqO+7X+*cHH3 zXAx5}e<*U6BAt1Dk)BSksi@c?D3InN2w5}+dhfd_01yQY0z5peSWHb!#-D;dWl`JOez9Sa${tclNofRl6tP|m#_1)Kq|ndhJ*-uY zV-gUgAi0x;)c-)%pMvWv2qCMM@Q`{7OA3XD=H@Q^ckaw?EfeW3E-n3Bq6dZe7K^we z%*WUF2vmghaLjYqFT2a!%*;%ebO%i^7`%yw^b8F08y-6zj;j=S8!0Pyb?)x&9?GB3 zQ;~E;co0BuigPThOf1aJ-!yv7Beim6PGCo8%?byHo3oE{va^}=`mM`}fI8%z{@_d| z31lOD)pJwJ&Cl;kL__!7p1rfPvrkZv6lfAvz%iC{XwN)W==hHJwbbHk=pCoY3pMWbOEY{lE_a%&c9?}@ z9IN4vepLVMfMfjef7E%+hr6y07p(#AK7=&L15q-`;-Dk-9eO8eQfXYSm`)3&3tL(8 zE?_B=uPGS2ySuN0_Rw!{-#kWE(5cLGsWtyDz18SzBVuRYWa)_)28_WO#4alvs)9Pc zHtejaiFx)<-AvO%85DRh)hTd{26&z8Fc~;r`S|R-D8q7U6vR>mZk6ZAHI^O9!(#e$xbRRBMKYvuLxbuVpg#1U1qBlLM{pLMg*A5>7G*Cv#A~hl! zxVumU#g4i>jKpwe>X=kooS=JqHCV#L(jDSd3e=y^M=>A(Uvz)__N@~AGssl}Q_VJr z*f<7;WME%VqSMJ6Q2pKho0mAdYJAYe*Y)iu4weYvN(%u(8&H$wx?z2@qEky zTj>5!`^Gf-YBkF#_hgY>>x7`U^`aY{mSHE0sitWE>U|)8ZCg-BwS7+KcwLD-ZyP;_ zZ_3x2)miOU{3_!U<+Fhpi(rk2)&CqO*I^wWm;5k$mOTfnE;HvSHMD)Uhz(LPjQHz7 zQNGs=xwmm+gVmo;P9B2pUG8-n8je4_x3-#&ev;33i(kE@)5))u50$khXi!|i+l>1Y olkDCe_niuHZ-kBDtOXBJ@m3#ng!Y%fe>jl3vW`+E(mMSA0ItRG6aWAK literal 0 HcmV?d00001 diff --git a/install/update/new/adm/images/phpbb_logo.svg b/install/update/new/adm/images/phpbb_logo.svg new file mode 100644 index 0000000..2a24106 --- /dev/null +++ b/install/update/new/adm/images/phpbb_logo.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/install/update/new/adm/images/progress_bar.gif b/install/update/new/adm/images/progress_bar.gif new file mode 100644 index 0000000000000000000000000000000000000000..1ae265152cad03d45dd8bd834adde294ee644c8b GIT binary patch literal 1353 zcmZ?wbhEHblwcHK*v!bVWXY1JPoIAN{Q26oYy0-?TeD`((xppp=tUelbm(b8?`1*9 znKNhp|NsBnw{Hw!p!lEL&ow02*)hP?NY8+o5h$qmlZDlYfssK6qyS_r1IvE{j}5E# zTD(5H`+tH)UrOe@j4Y-}Av{dV=Sy<$SFC$q^Zx&V1qB{DQteHSjz$(%^DnF@@md=t z+03BOW)PAhzQOfRYRlQ=lAmY%wqJi|QL|6s`ql5{ar>6v{$J5h)l}0`*VxhA+1ky< z!NVkC6xZH0t!Mhw8M9~2t)1VtpnKlJrHdEMTrp=AH(S!Ol^a%XTC#l0njPDBZQHYP z@8T0aGadPwW^Ya~=x&EGX za$*68p9m=Ym>HNExPXv>Mbbcasnddzpzi9u_t@HEe#~4RnRa89N0K-rLNz~JwMc-c z=%GDVk|NEoM?ddW?3lQ`a-kqXp)|1y)rnPTOsqnCVikH5t1z5cg~`M!%qLc1HL(iY ziB&k6ScUV6Rk)g1h1-c$c$ip)=ZRH#n^=XdqfQtYvn%VZ`yDQgw4er)UO?E4 zG}?&ude0I+aCWBTh&{G)+1Z^EH2%S&yR*F@2^#-k(M{6WB}?Lfl40@y3ddLk8ZD?9 zg$ociBaL=%^s=MQ51jIZB#U7`y9^j^TNb@FZ#UFVO{XJzi2OxCoPcgy&uO1 reI`&k%nR$;Tn^vIGfg}7`&j +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +define('IN_PHPBB', true); +define('ADMIN_START', true); +define('NEED_SID', true); + +// Include files +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +require($phpbb_root_path . 'common.' . $phpEx); +require($phpbb_root_path . 'includes/functions_acp.' . $phpEx); +require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); +require($phpbb_root_path . 'includes/functions_module.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('acp/common'); +// End session management + +// Have they authenticated (again) as an admin for this session? +if (!isset($user->data['session_admin']) || !$user->data['session_admin']) +{ + login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false); +} + +// Is user any type of admin? No, then stop here, each script needs to +// check specific permissions but this is a catchall +if (!$auth->acl_get('a_')) +{ + send_status_line(403, 'Forbidden'); + trigger_error('NO_ADMIN'); +} + +// We define the admin variables now, because the user is now able to use the admin related features... +define('IN_ADMIN', true); + +// Some oft used variables +$file_uploads = (@ini_get('file_uploads') == '1' || strtolower(@ini_get('file_uploads')) === 'on') ? true : false; +$module_id = $request->variable('i', ''); +$mode = $request->variable('mode', ''); + +// Set custom style for admin area +$template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), +), $phpbb_admin_path . 'style'); + +$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); +$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); + +// Instantiate new module +$module = new p_master(); + +// Instantiate module system and generate list of available modules +$module->list_modules('acp'); + +// Select the active module +$module->set_active($module_id, $mode); + +// Assign data to the template engine for the list of modules +// We do this before loading the active module for correct menu display in trigger_error +$module->assign_tpl_vars(append_sid("{$phpbb_admin_path}index.$phpEx")); + +// Load and execute the relevant module +$module->load_active(); + +// Generate the page +adm_page_header($module->get_page_title()); + +$template->set_filenames(array( + 'body' => $module->get_tpl_name(), +)); + +adm_page_footer(); diff --git a/install/update/new/adm/style/acp_attachments.html b/install/update/new/adm/style/acp_attachments.html new file mode 100644 index 0000000..7a66f17 --- /dev/null +++ b/install/update/new/adm/style/acp_attachments.html @@ -0,0 +1,495 @@ + + + + + + « {L_BACK} + + +

{L_TITLE}

+ +

{L_TITLE_EXPLAIN}

+ + +
+

{L_WARNING}

+

{WARNING_MSG}

+
+ + + +
+

{L_NOTIFY}

+

{NOTIFY_MSG}

+
+ + + +

{L_UPLOADING_FILES}

+ + + :: {upload.FILE_INFO}
+ {upload.DENIED}{upload.ERROR_MSG}{L_SUCCESSFULLY_UPLOADED} +

+ + + + + + +
+ + + +
+ +
+ {options.LEGEND} + + +
+

{options.TITLE_EXPLAIN}
+
{options.CONTENT}
+
+ + + +
+ +
+ {L_SUBMIT} +   + +
+ + +
+

{L_SECURE_DOWNLOAD_NOTICE}

+
+ + +
+ {L_SECURE_TITLE} +

{L_DOWNLOAD_ADD_IPS_EXPLAIN}

+
+
+
+
+
+

{L_EXCLUDE_ENTERED_IP}
+
+
+
+ +

+ +

+
+ +
+ {L_REMOVE_IPS} + +

{L_DOWNLOAD_REMOVE_IPS_EXPLAIN}

+
+
+
+
+ +

+ +

+
+ + +

{L_NO_IPS_DEFINED}

+ + {S_FORM_TOKEN} + + + + + + + + +
+
+ + + + {L_LEGEND} +
+
+
+
+
+

{L_SPECIAL_CATEGORY_EXPLAIN}
+
{S_CATEGORY_SELECT}
+
+
+
+
checked="checked" />
+
+
+
+
checked="checked" />
+
+
+
+
+
 src="{ROOT_PATH}images/spacer.gif"src="{UPLOAD_ICON_SRC}" id="image_upload_icon" alt="" title="" /> 
+
+
+
+
+
+
+
+
{ASSIGNED_EXTENSIONS}
[{L_GO_TO_EXTENSIONS} ]
+
+
+
+

{L_ALLOWED_FORUMS_EXPLAIN}
+
+
+
+
+ +

+   + +

+ {S_FORM_TOKEN} +
+ +
+ + +
+
+ {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + + +
{L_EXTENSION_GROUP}{L_SPECIAL_CATEGORY}{L_OPTIONS}
 
{groups.GROUP_NAME} +
» {L_NOT_ALLOWED_IN_PM} +
» {L_ONLY_ALLOWED_IN_PM} +
» {L_NOT_ALLOWED_IN_PM_POST} +
» {L_ALLOWED_IN_PM_POST} +
{groups.CATEGORY} {ICON_EDIT}  {ICON_DELETE} 
+

+ {L_CREATE_GROUP}{L_COLON} + +

+ {S_FORM_TOKEN} +
+
+ + + + + +
+
+ {L_ADD_EXTENSION} +
+
+
+
+
+
+
{GROUP_SELECT_OPTIONS}
+
+ +

+ +

+ {S_FORM_TOKEN} +
+
+ +
+ +
+ {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + + +
{L_EXTENSION}{L_EXTENSION_GROUP}{L_DELETE}
 
{extensions.EXTENSION}{extensions.GROUP_OPTIONS}
+ +

+   + +

+ {S_FORM_TOKEN} +
+
+ + + +
+ +
+ {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_FILENAME}{L_FILEDATE}{L_FILESIZE}{L_ATTACH_POST_ID}{L_ATTACH_TO_POST}{L_DELETE}
{orphan.REAL_FILENAME}{orphan.FILETIME}{orphan.FILESIZE}{L_ATTACH_ID}{L_COLON}
 {L_MARK_ALL} :: {L_UNMARK_ALL}{L_MARK_ALL} :: {L_UNMARK_ALL}
+ +
+

{L_NO_ATTACHMENTS}

+
+ + + + + + + +

+   + +

+ + + {S_FORM_TOKEN} +
+
+ + + +
+ +
+ {L_TITLE} + + + + + + + + + + + + + + + {% for attachments in attachments %} + + + + + + + {% endfor %} + +
{L_FILENAME}{L_POSTED}{L_FILESIZE}{L_MARK}
+ {{ lang('EXTENSION_GROUP') ~ lang('COLON') }} {{ attachments.EXT_GROUP_NAME }} + {% if attachments.S_IN_MESSAGE %} +
{{ attachments.L_DOWNLOAD_COUNT }} +
{{ lang('IN') }} {{ lang('PRIVATE_MESSAGE') }} + {% else %} +
{{ attachments.REAL_FILENAME }} + {% if attachments.COMMENT %}
{{ attachments.COMMENT }}{% endif %} +
{{ attachments.L_DOWNLOAD_COUNT }} +
{{ lang('TOPIC') ~ lang('COLON') }} {{ attachments.TOPIC_TITLE }} + {% endif %} +
{{ attachments.FILETIME }}
{{ lang('POST_BY_AUTHOR') }} {{ attachments.ATTACHMENT_POSTER }}
{{ attachments.FILESIZE }}
+ +
+

{L_NO_ATTACHMENTS}

+
+ + + + + + +
+ {L_DISPLAY_LOG}{L_COLON}  {S_LIMIT_DAYS} {L_SORT_BY}{L_COLON} {S_SORT_KEY} {S_SORT_DIR} + +
+ +
+ + +
+
+

+ {L_MARK_ALL} • + {L_UNMARK_ALL} +

+
+ + {S_FORM_TOKEN} +
+
+ + +
+ {L_RESYNC_STATS} +
+
+

{L_RESYNC_FILES_STATS_EXPLAIN}
+
+
+
+
+ + + + diff --git a/install/update/new/adm/style/acp_avatar_options_upload.html b/install/update/new/adm/style/acp_avatar_options_upload.html new file mode 100644 index 0000000..666950e --- /dev/null +++ b/install/update/new/adm/style/acp_avatar_options_upload.html @@ -0,0 +1,11 @@ +
+
+
+
+ + +
+

{L_UPLOAD_AVATAR_URL_EXPLAIN}
+
+
+ diff --git a/install/update/new/adm/style/acp_ban.html b/install/update/new/adm/style/acp_ban.html new file mode 100644 index 0000000..d0eab75 --- /dev/null +++ b/install/update/new/adm/style/acp_ban.html @@ -0,0 +1,131 @@ + + + + +

{L_ACP_BAN_EXPLAIN}

+ +

{L_TITLE}

+ +

{L_EXPLAIN}

+ + + +
+ +
+ {L_TITLE} +
+
+
+
[ {L_FIND_USERNAME} ]
+
+
+
+
+ +
+
+

{L_BAN_EXCLUDE_EXPLAIN}
+
+
+
+
+
+
+
+
+
+
+
+ +

+   + +

+{S_FORM_TOKEN} +
+
+ +

+ +

{L_UNBAN_TITLE}

+ +

{L_UNBAN_EXPLAIN}

+ +
+ +
+ {L_UNBAN_TITLE} + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +

+   + +

+ {S_FORM_TOKEN} +
+ + + +

{L_NO_BAN_CELL}

+ {S_FORM_TOKEN} + + + + +
+ + diff --git a/install/update/new/adm/style/acp_contact.html b/install/update/new/adm/style/acp_contact.html new file mode 100644 index 0000000..c46a2d7 --- /dev/null +++ b/install/update/new/adm/style/acp_contact.html @@ -0,0 +1,76 @@ + + + + + + +

{L_ACP_CONTACT_SETTINGS}

+ +

{L_ACP_CONTACT_SETTINGS_EXPLAIN}

+ +
+
+ {L_GENERAL_OPTIONS} +
+

{L_CONTACT_US_ENABLE_EXPLAIN}
+
+ + +
+
+
+ + +
+ {L_CONTACT_US_INFO_PREVIEW} +

{CONTACT_US_INFO_PREVIEW}

+
+ + +
+ {L_CONTACT_US_INFO} +

{L_CONTACT_US_INFO_EXPLAIN}

+ + + +
+
+
+ +
+ +
+ +
+ + + + + + + + + +
+
{L_OPTIONS}{L_COLON} {BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {URL_STATUS} :: {SMILIES_STATUS}
+
+
+ +
+   + + {S_FORM_TOKEN} +
+
+ + diff --git a/install/update/new/adm/style/acp_database.html b/install/update/new/adm/style/acp_database.html new file mode 100644 index 0000000..d3433a8 --- /dev/null +++ b/install/update/new/adm/style/acp_database.html @@ -0,0 +1,90 @@ + + + + + +

{L_ACP_RESTORE}

+ +

{L_ACP_RESTORE_EXPLAIN}

+ + +
+ +
+ {L_RESTORE_OPTIONS} +
+
+
+
+ +

+   +   +

+ {S_FORM_TOKEN} +
+
+ +
+

{L_ACP_NO_ITEMS}

+
+ + + +

{L_ACP_BACKUP}

+ +

{L_ACP_BACKUP_EXPLAIN}

+ + + +
+ +
+ {L_BACKUP_OPTIONS} +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
{L_SELECT_ALL} :: {L_DESELECT_ALL}
+
+ +

+   + +

+ {S_FORM_TOKEN} +
+
+ + + + diff --git a/install/update/new/adm/style/acp_ext_actions.html b/install/update/new/adm/style/acp_ext_actions.html new file mode 100644 index 0000000..6b59ab7 --- /dev/null +++ b/install/update/new/adm/style/acp_ext_actions.html @@ -0,0 +1,7 @@ +{% for action in enabled.actions %} + {{ action.L_ACTION }}{% if not action.S_LAST_ROW %} | {% endif %} +{% endfor %} + +{% for action in disabled.actions %} + {{ action.L_ACTION }}{% if not action.S_LAST_ROW %} | {% endif %} +{% endfor %} diff --git a/install/update/new/adm/style/acp_ext_list.html b/install/update/new/adm/style/acp_ext_list.html new file mode 100644 index 0000000..e578312 --- /dev/null +++ b/install/update/new/adm/style/acp_ext_list.html @@ -0,0 +1,114 @@ + + + + +

{L_EXTENSIONS_ADMIN}

+ +

{L_EXTENSIONS_EXPLAIN}

+ +
+ {L_BROWSE_EXTENSIONS_DATABASE}{L_VERSIONCHECK_FORCE_UPDATE_ALL}{L_SETTINGS} +
+ + + + + + + + + + + + + + + + class="hidden"> + + + + + + + + + + + + class="hidden"> + + + + + + + + + + + +
{L_EXTENSION_NAME}{L_CURRENT_VERSION}{L_EXTENSION_OPTIONS}{L_EXTENSION_ACTIONS}
{L_EXTENSIONS_ENABLED}
{enabled.META_DISPLAY_NAME} + + {enabled.META_VERSION} + + + {enabled.META_VERSION} + + {L_DETAILS} + +
{L_EXTENSIONS_DISABLED}
{disabled.META_DISPLAY_NAME} + + {disabled.META_VERSION} + + + {disabled.META_VERSION} + + + {L_DETAILS} + + +
+ + + + + + + + + + + + + + + + + + + + + +
{L_EXTENSION_INSTALL_HEADLINE}
{L_EXTENSION_INSTALL_EXPLAIN}
{L_EXTENSION_UPDATE_HEADLINE}
{L_EXTENSION_UPDATE_EXPLAIN}
{L_EXTENSION_REMOVE_HEADLINE}
{L_EXTENSION_REMOVE_EXPLAIN}
+ + diff --git a/install/update/new/adm/style/acp_forums.html b/install/update/new/adm/style/acp_forums.html new file mode 100644 index 0000000..f51ce98 --- /dev/null +++ b/install/update/new/adm/style/acp_forums.html @@ -0,0 +1,524 @@ + + + + + + + + + « {L_BACK} + +

{L_TITLE} :: {FORUM_NAME}

+ +

{L_FORUM_EDIT_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + +
+ +
+ {L_FORUM_SETTINGS} + +
+
+
+
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+ +
+

{L_COPY_PERMISSIONS_EXPLAIN}
+
+
+ +
+
+
+
+
+

{L_FORUM_DESC_EXPLAIN}
+
+
+ +
+
+
+

{L_FORUM_IMAGE_EXPLAIN}
+
+ +
{L_FORUM_IMAGE}
+ +
+
+

{L_FORUM_PASSWORD_EXPLAIN}
+
+
+
+

{L_FORUM_PASSWORD_CONFIRM_EXPLAIN}
+
+
+ +
+

{L_FORUM_PASSWORD_UNSET_EXPLAIN}
+
+
+ +
+
+
+
+ +
+ +
+
+ {L_GENERAL_FORUM_SETTINGS} +
+

{L_DISPLAY_ACTIVE_TOPICS_EXPLAIN}
+
+
+
+
+
+ +
+
+ {L_GENERAL_FORUM_SETTINGS} + +
+
+
+
+
+

{L_LIST_SUBFORUMS_EXPLAIN}
+
+
+
+
+

{L_LIMIT_SUBFORUMS_EXPLAIN}
+
+
+
+
+

{L_LIST_INDEX_EXPLAIN}
+
+
+
+
+

{L_ENABLE_POST_REVIEW_EXPLAIN}
+
+
+
+
+

{L_ENABLE_QUICK_REPLY_EXPLAIN}
+
+
+
+
+

{L_ENABLE_INDEXING_EXPLAIN}
+
+
+
+
+
+
+
+
+
+

{L_ENABLE_RECENT_EXPLAIN}
+
+
+
+
+

{L_FORUM_TOPICS_PAGE_EXPLAIN}
+
+
+ +
+ +
+ {L_FORUM_PRUNE_SETTINGS} + +
+

{L_FORUM_AUTO_PRUNE_EXPLAIN}
+
+
+
+
+

{L_AUTO_PRUNE_FREQ_EXPLAIN}
+
{L_DAYS}
+
+
+

{L_AUTO_PRUNE_DAYS_EXPLAIN}
+
{L_DAYS}
+
+
+

{L_AUTO_PRUNE_VIEWED_EXPLAIN}
+
{L_DAYS}
+
+
+

{L_PRUNE_OLD_POLLS_EXPLAIN}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

{L_FORUM_PRUNE_SHADOW_EXPLAIN}
+
+
+
+
+

{L_AUTO_PRUNE_SHADOW_FREQ_EXPLAIN}
+
{L_DAYS}
+
+
+

{L_AUTO_PRUNE_SHADOW_DAYS_EXPLAIN}
+
{L_DAYS}
+
+ +
+
+ + + +
+
+ {L_FORUM_RULES} + +
+

{L_FORUM_RULES_LINK_EXPLAIN}
+
+
+ +
+
+
{FORUM_RULES_PREVIEW}
+
+ +
+

{L_FORUM_RULES_EXPLAIN}
+
+
+ +
+
+ +
+
+ + + +
+ {L_SUBMIT} +   + + {S_FORM_TOKEN} +
+
+ + + + « {L_BACK} + +

{L_FORUM_DELETE}

+ +

{L_FORUM_DELETE_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + +
+ +
+ {L_FORUM_DELETE} +
+
+
{FORUM_NAME}
+
+ +
+
+
+ +
+ +
+ + +
+
+
+ +
+ +
+ + +

+ +

+ {S_FORM_TOKEN} +
+
+ + + + + +

{L_FORUM_ADMIN}

+ +

{L_FORUM_ADMIN_EXPLAIN}

+ +

{L_PROGRESS_EXPLAIN}

+ + + + + +

{L_FORUM_ADMIN}

+ +

{L_FORUM_ADMIN_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + + + + +
+

{L_NOTIFY}

+

{L_FORUM_RESYNCED}

+
+ + +

{NAVIGATION} [{L_EDIT} | {L_DELETE} | {L_RESYNC}]

+ + + + + + + + + + + + + +
{forums.FOLDER_IMAGE} +
{forums.FORUM_IMAGE}
+ {forums.FORUM_NAME}{forums.FORUM_NAME} +
{forums.FORUM_DESCRIPTION} +

{L_TOPICS}{L_COLON} {forums.FORUM_TOPICS} / {L_POSTS}{L_COLON} {forums.FORUM_POSTS} +
+ + {ICON_MOVE_UP} + + {ICON_MOVE_DOWN} + {ICON_EDIT} + + {ICON_SYNC} + + {ICON_SYNC_DISABLED} + + {ICON_DELETE} +
+ + +
+ +
+ {L_SELECT_FORUM}{L_COLON} + + + {S_FORM_TOKEN} +
+
+ +
+ +
+ + + + + {S_FORM_TOKEN} +
+
+ + + + diff --git a/install/update/new/adm/style/acp_groups.html b/install/update/new/adm/style/acp_groups.html new file mode 100644 index 0000000..8651b63 --- /dev/null +++ b/install/update/new/adm/style/acp_groups.html @@ -0,0 +1,335 @@ + + + + + + + « {L_BACK} + +

{L_ACP_GROUPS_MANAGE}

+ +

{L_GROUP_EDIT_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + +
+ +
+ {L_GROUP_DETAILS} +
+
for="group_name">{L_GROUP_NAME}{L_COLON}
+
{GROUP_NAME}
+
+
+
+
+
+ +
+
+ +
+

{L_GROUP_TYPE_EXPLAIN}
+
+ {% EVENT acp_group_types_prepend %} + + + + + {% EVENT acp_group_types_append %} +
+
+ + + + + +
+

{L_COPY_PERMISSIONS_EXPLAIN}
+
+
+ +
+ +
+ {L_GROUP_OPTIONS_SAVE} + + +
+

{L_GROUP_FOUNDER_MANAGE_EXPLAIN}
+
+
+ +
+

{L_GROUP_SKIP_AUTH_EXPLAIN}
+
+
+
+
+
+
+
+
+
+
+
+

{L_GROUP_RECEIVE_PM_EXPLAIN}
+
+
+ +
+ +
+ {L_GROUP_SETTINGS_SAVE} +
+

{L_GROUP_MESSAGE_LIMIT_EXPLAIN}
+
+
+
+

{L_GROUP_MAX_RECIPIENTS_EXPLAIN}
+
+
+
+

{L_GROUP_COLOR_EXPLAIN}
+
+ +        + [ {L_COLOUR_SWATCH} ] + +
+
+
+
+
+
+
+ +
+ {L_GROUP_AVATAR} +
+

{L_AVATAR_EXPLAIN}
+
{AVATAR}
+
+
+
+
+
+
+
+ +
+

{avatar_drivers.L_EXPLAIN}

+ {avatar_drivers.OUTPUT} +
+ +
+
+ +
+ {L_SUBMIT} +   + + {S_FORM_TOKEN} +
+
+ + + + « {L_BACK} + +

{L_GROUP_MEMBERS} :: {GROUP_NAME}

+ +

{L_GROUP_MEMBERS_EXPLAIN}

+ +
+ +
+ » {L_MAKE_DEFAULT_FOR_ALL} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_USERNAME}{L_GROUP_DEFAULT}{L_JOINED}{L_POSTS}{L_MARK}
{L_GROUP_LEAD}
{leader.USERNAME}{leader.USERNAME}{L_YES}{L_NO}{leader.JOINED}{leader.USER_POSTS}
{L_GROUPS_NO_MODS}
{L_GROUP_APPROVED}
{L_GROUP_PENDING}
{member.USERNAME}{member.USERNAME}{L_YES}{L_NO}{member.JOINED}{member.USER_POSTS}
{L_GROUPS_NO_MEMBERS}
+ + +
+ + +

{L_MARK_ALL}{L_UNMARK_ALL}

+
+ +

{L_ADD_USERS}

+ +

{L_ADD_USERS_EXPLAIN}

+ +
+ {L_ADD_USERS} +
+
+
+
+
+
+

{L_USER_GROUP_DEFAULT_EXPLAIN}
+
+
+
+
+

{L_USERNAMES_EXPLAIN}
+
+
[ {L_FIND_USERNAME} ]
+
+ +

+ +

+ {S_FORM_TOKEN} +
+
+ + + +

{L_ACP_GROUPS_MANAGE}

+ +

{L_ACP_GROUPS_MANAGE_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + +

{L_USER_DEF_GROUPS}

+ +

{L_USER_DEF_GROUPS_EXPLAIN}

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
{L_GROUP}{L_TOTAL_MEMBERS}{L_PENDING_MEMBERS}{L_OPTIONS}{L_ACTION}
{L_NO_GROUPS_CREATED}
+ + +
+ + {L_CREATE_GROUP}{L_COLON} + + + {S_FORM_TOKEN} +
+
+ +

{L_SPECIAL_GROUPS}

+ +

{L_SPECIAL_GROUPS_EXPLAIN}

+ + + + + + + + + + + + + + + + + + + + + + + + + +
{L_GROUP}{L_TOTAL_MEMBERS}{L_PENDING_MEMBERS}{L_OPTIONS}{L_ACTION}
style="color: #{groups.GROUP_COLOR}">{groups.GROUP_NAME}{groups.TOTAL_MEMBERS}{groups.PENDING_MEMBERS}{L_SETTINGS}{L_MEMBERS}{L_DELETE}{L_DELETE}
+ + + + diff --git a/install/update/new/adm/style/acp_help_phpbb.html b/install/update/new/adm/style/acp_help_phpbb.html new file mode 100644 index 0000000..7d3c503 --- /dev/null +++ b/install/update/new/adm/style/acp_help_phpbb.html @@ -0,0 +1,67 @@ + + + + +

{L_ACP_HELP_PHPBB}

+ +
+
+ +
+

{L_SEND_STATISTICS}

+

{L_EXPLAIN_SEND_STATISTICS}

+
+ +
+
+ +
+ {providers.NAME} + +
+
{providers.values.KEY}
+
{providers.values.VALUE}
+
+ +
+ +
+
+
+
+
+ checked="checked" /> + +
+
{L_SEND_STATISTICS_LONG}
+
+
+ + +
+

+ + +

+ {S_FORM_TOKEN} +
+
+
+
+
+

+ {% for providers in providers %} + {% for values in providers.values %} + + {% endfor %} + {% endfor %} + +

+
+
+ + diff --git a/install/update/new/adm/style/acp_icons.html b/install/update/new/adm/style/acp_icons.html new file mode 100644 index 0000000..45fe7f8 --- /dev/null +++ b/install/update/new/adm/style/acp_icons.html @@ -0,0 +1,282 @@ + + + + + + + + + « {L_BACK} + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ +
+ {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_CONFIG}
{L_URL}{L_LOCATION}{L_SMILIES_CODE}{L_SMILIES_EMOTION}{L_WIDTH}{L_HEIGHT}{L_ALT_TEXT}{L_DISPLAY_ON_POSTING}{L_ORDER}{L_ADD} ({L_MARK_ALL})
{items.TEXT_ALT}[{items.IMG}] + + + + +
{L_ADD_SMILEY_CODE}
{L_NO_ICONS}
+ +

+   + +

+ {S_FORM_TOKEN} +
+
+ + + + « {L_BACK} + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ +
+ {L_IMPORT} + + +

{L_NO_PAK_OPTIONS}

+ + +
+
+
+
+

{L_CURRENT_EXPLAIN}
+
+ +
+ + +

+ +

+ + {S_FORM_TOKEN} +
+
+ + + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ + +
+

{L_NOTIFY}

+

{NOTICE}

+
+ + +
+ + + +
+ + {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_TITLE}{L_CODE}{L_EMOTION}{L_OPTIONS}
{L_NOT_DISPLAYED}
{items.ALT_TEXT}{items.CODE}{items.EMOTION} + + {ICON_MOVE_UP} + + {ICON_MOVE_DOWN} + {ICON_EDIT} {ICON_DELETE} +
{L_ACP_NO_ITEMS}
+ +

+     +

+ {S_FORM_TOKEN} +
+
+ + + + diff --git a/install/update/new/adm/style/acp_language.html b/install/update/new/adm/style/acp_language.html new file mode 100644 index 0000000..5e3ac95 --- /dev/null +++ b/install/update/new/adm/style/acp_language.html @@ -0,0 +1,116 @@ + + + + + + + « {L_BACK} + +

{L_LANGUAGE_PACK_DETAILS}

+ +
+ +
+ {LANG_LOCAL_NAME} +
+
+
+
+
+
+
+
+
+
+
{LANG_ISO}
+
+
+
+
+
+ +

+ +

+ {S_FORM_TOKEN} +
+
+ + +

{L_MISSING_FILES}

+ +
+ {L_MISSING_LANG_FILES} + + » {missing_files.FILE_NAME}
+ +
+ + + +

{L_MISSING_VARS_EXPLAIN}

+ +
+ {L_MISSING_LANG_VARIABLES} + +
+
+ +
{missing_varfile.variable.VAR_NAME}
+ +
+ +
+ + + +

{L_ACP_LANGUAGE_PACKS}

+ +

{L_ACP_LANGUAGE_PACKS_EXPLAIN}

+ +
+ {L_BROWSE_LANGUAGE_PACKS_DATABASE} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_LANGUAGE_PACK_NAME}{L_LANGUAGE_PACK_LOCALNAME}{L_LANGUAGE_PACK_ISO}{L_LANGUAGE_PACK_USED_BY}{L_OPTIONS}
{L_INSTALLED_LANGUAGE_PACKS}
{lang.ENGLISH_NAME} {lang.TAG}{lang.LOCAL_NAME}{lang.ISO}{lang.USED_BY}{L_DELETE}
{L_UNINSTALLED_LANGUAGE_PACKS}
{notinst.NAME}{notinst.LOCAL_NAME}{notinst.ISO}{L_INSTALL}
+ + + + diff --git a/install/update/new/adm/style/acp_main.html b/install/update/new/adm/style/acp_main.html new file mode 100644 index 0000000..b8d337c --- /dev/null +++ b/install/update/new/adm/style/acp_main.html @@ -0,0 +1,339 @@ + + + + + + +

{L_PERMISSIONS_TRANSFERRED}

+ +

{L_PERMISSIONS_TRANSFERRED_EXPLAIN}

+ + + +

{L_WELCOME_PHPBB}

+ +

{L_ADMIN_INTRO}

+ + +
+

{L_UPDATE_INCOMPLETE} {L_MORE_INFORMATION}

+
+ +
+

{L_VERSIONCHECK_FAIL}

+

{VERSIONCHECK_FAIL_REASON}

+

{L_VERSIONCHECK_FORCE_UPDATE} · {L_MORE_INFORMATION}

+
+ +
+

{L_VERSION_NOT_UP_TO_DATE_TITLE}

+

{L_VERSIONCHECK_FORCE_UPDATE} · {L_MORE_INFORMATION}

+
+ + +
+

{UPGRADE_INSTRUCTIONS}

+
+ + + +
+

{L_WARNING}

+

{L_NO_SEARCH_INDEX}

+
+ + + +
+

{L_WARNING}

+

{L_REMOVE_INSTALL}

+
+ + + + +
+

{L_ERROR_MBSTRING_FUNC_OVERLOAD}

+

{L_ERROR_MBSTRING_FUNC_OVERLOAD_EXPLAIN}

+
+ + + +
+

{L_ERROR_MBSTRING_ENCODING_TRANSLATION}

+

{L_ERROR_MBSTRING_ENCODING_TRANSLATION_EXPLAIN}

+
+ + + +
+

{L_ERROR_MBSTRING_HTTP_INPUT}

+

{L_ERROR_MBSTRING_HTTP_INPUT_EXPLAIN}

+
+ + + +
+

{L_ERROR_MBSTRING_HTTP_OUTPUT}

+

{L_ERROR_MBSTRING_HTTP_OUTPUT_EXPLAIN}

+
+ + + + +
+

{L_WRITABLE_CONFIG}

+
+ + + +
+

{L_PHP_VERSION_OLD}

+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {% if S_TOTAL_ORPHAN %} + + + {% else %} + {% endif %} + + {% if S_VERSIONCHECK %} + + + + + {% endif %} + +
{{ lang('STATISTIC') }}{{ lang('VALUE') }}
{{ lang('BOARD_STARTED') ~ lang('COLON') }}{{ START_DATE }}
{{ lang('AVATAR_DIR_SIZE') ~ lang('COLON') }}{{ AVATAR_DIR_SIZE }}
{{ lang('DATABASE_SIZE') ~ lang('COLON') }}{{ DBSIZE }}
{{ lang('UPLOAD_DIR_SIZE') ~ lang('COLON') }}{{ UPLOAD_DIR_SIZE }}
{{ lang('DATABASE_SERVER_INFO') ~ lang('COLON') }}{{ DATABASE_INFO }}
{{ lang('GZIP_COMPRESSION') ~ lang('COLON') }}{{ GZIP_COMPRESSION }}
{{ lang('PHP_VERSION') ~ lang('COLON') }}{{ PHP_VERSION_INFO }}
{{ lang('NUMBER_ORPHAN') ~ lang('COLON') }} + {% if TOTAL_ORPHAN > 0 %} + {{ TOTAL_ORPHAN }} + {% else %} + {{ TOTAL_ORPHAN }} + {% endif %} +
{{ lang('BOARD_VERSION') ~ lang('COLON') }} + {{ BOARD_VERSION }}{{ lang('VERSIONCHECK_FORCE_UPDATE') }} ] +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{{ lang('STATISTIC') }}{{ lang('VALUE') }}
{{ lang('NUMBER_POSTS') ~ lang('COLON') }}{{ TOTAL_POSTS }}
{{ lang('POSTS_PER_DAY') ~ lang('COLON') }}{{ POSTS_PER_DAY }}
{{ lang('NUMBER_TOPICS') ~ lang('COLON') }}{{ TOTAL_TOPICS }}
{{ lang('TOPICS_PER_DAY') ~ lang('COLON') }}{{ TOPICS_PER_DAY }}
{{ lang('NUMBER_USERS') ~ lang('COLON') }}{{ TOTAL_USERS }}
{{ lang('USERS_PER_DAY') ~ lang('COLON') }}{{ USERS_PER_DAY }}
{{ lang('NUMBER_FILES') ~ lang('COLON') }}{{ TOTAL_FILES }}
{{ lang('FILES_PER_DAY') ~ lang('COLON') }}{{ FILES_PER_DAY }}
  
+
+ + +
+ {L_STATISTIC_RESYNC_OPTIONS} + +
+
+

 
+
+
+
+ +
+
+

 
+
+
+
+ +
+
+

{L_RESYNC_STATS_EXPLAIN}
+
+
+
+ +
+
+

{L_RESYNC_POSTCOUNTS_EXPLAIN}
+
+
+
+ +
+
+

{L_RESYNC_POST_MARKING_EXPLAIN}
+
+
+
+ + +
+
+

{L_PURGE_SESSIONS_EXPLAIN}
+
+
+
+ + +
+
+

{L_PURGE_CACHE_EXPLAIN}
+
+
+
+ + +
+ + + +

{L_ADMIN_LOG}

+ +

{L_ADMIN_LOG_INDEX_EXPLAIN}

+ + + + + + + + + + + + + + + + + + + + + + +
{L_USERNAME}{L_IP}{L_TIME}{L_ACTION}
{log.USERNAME}{log.IP}{log.DATE}{log.ACTION}
+ + + +

{L_INACTIVE_USERS}

+ +

{L_INACTIVE_USERS_EXPLAIN_INDEX}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_USERNAME}{L_JOINED}{L_INACTIVE_DATE}{L_LAST_VISIT}{L_INACTIVE_REASON}
+ {inactive.USERNAME_FULL} +
{L_POSTS}{L_COLON} {inactive.POSTS} [{L_SEARCH_USER_POSTS}] +
{inactive.JOINED}{inactive.INACTIVE_DATE}{inactive.LAST_VISIT} + {inactive.REASON} +
{inactive.REMINDED_EXPLAIN} +
{L_NO_INACTIVE_USERS}
+ + + + + diff --git a/install/update/new/adm/style/acp_modules.html b/install/update/new/adm/style/acp_modules.html new file mode 100644 index 0000000..f4040da --- /dev/null +++ b/install/update/new/adm/style/acp_modules.html @@ -0,0 +1,203 @@ + + + + + + + + + « {L_BACK} + +

{L_TITLE} :: {MODULENAME}

+ +

{L_EDIT_MODULE_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + +
+ +
+ {L_GENERAL_OPTIONS} +
+

+ {L_MODULE_LANGNAME_EXPLAIN}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
style="display: none;"> +
+

{L_MODULE_DISPLAYED_EXPLAIN}
+
+
+
+
+

+ {L_CHOOSE_MODULE_EXPLAIN}
+
+
+
+

+ {L_CHOOSE_MODE_EXPLAIN}
+
+
+
+ +

+ + + +   + +

+ {S_FORM_TOKEN} +
+
+ + + +

{L_ACP_MODULE_MANAGEMENT}

+ +

{L_ACP_MODULE_MANAGEMENT_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + + + + + + + +
{NAVIGATION} [{L_EDIT} | {L_DELETE} | {L_DISABLE}{L_ENABLE}]
+ + + + + + + + + + + + + + +
{modules.MODULE_IMAGE}{modules.MODULE_TITLE} [{L_HIDDEN_MODULE}] {L_DISABLE}{L_ENABLE}  + + {ICON_MOVE_UP} + + {ICON_MOVE_DOWN} + {ICON_EDIT} + {ICON_DELETE} +
+ + +
 
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + + +
+ +
+ +
 

+ +
+
+ {L_SELECT_MODULE}{L_COLON} + + +
+
+ + + + diff --git a/install/update/new/adm/style/acp_permission_roles.html b/install/update/new/adm/style/acp_permission_roles.html new file mode 100644 index 0000000..670d5e1 --- /dev/null +++ b/install/update/new/adm/style/acp_permission_roles.html @@ -0,0 +1,191 @@ + + + + + + + + + + + « {L_BACK} + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ » {L_SET_ROLE_PERMISSIONS} + +
+ +
+ {L_ROLE_DETAILS} +
+
+
+
+
+

{L_ROLE_DESCRIPTION_EXPLAIN}
+
+
+ +

+ + {S_FORM_TOKEN} +

+
+ + + +

{L_ROLE_ASSIGNED_TO}

+ + + + + +

+ + + + » {L_BACK_TO_TOP}
+

+ +

+ +

{L_ACL_TYPE}

+ +
+ +
+
+ +
+ +
style="display: none;"> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_ACL_SETTING}{L_ACL_YES}{L_ACL_NO}{L_ACL_NEVER}
{auth.mask.PERMISSION}
+
+
+ +
+ +
+ +
+ + {S_FORM_TOKEN} +
+
+ + » {L_BACK_TO_TOP}
+
+ + + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ + + + + + + + + + + + + + + + + + +
{L_ROLE_NAME}{L_OPTIONS}
{roles.ROLE_NAME} +
{roles.ROLE_DESCRIPTION} +
{L_VIEW_ASSIGNED_ITEMS}{L_VIEW_ASSIGNED_ITEMS} + + {ICON_MOVE_UP} + + {ICON_MOVE_DOWN} + {ICON_EDIT} + {ICON_DELETE} +
+ +
+ {L_CREATE_ROLE}{L_COLON}
+ {S_FORM_TOKEN} +
+
+ + + + + +

{L_ROLE_ASSIGNED_TO}

+ + + + + + + + diff --git a/install/update/new/adm/style/acp_posting_buttons.html b/install/update/new/adm/style/acp_posting_buttons.html new file mode 100644 index 0000000..614d6fa --- /dev/null +++ b/install/update/new/adm/style/acp_posting_buttons.html @@ -0,0 +1,50 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/install/update/new/adm/style/acp_ranks.html b/install/update/new/adm/style/acp_ranks.html new file mode 100644 index 0000000..d373657 --- /dev/null +++ b/install/update/new/adm/style/acp_ranks.html @@ -0,0 +1,107 @@ + + + + + + + « {L_BACK} + + + +

{L_ACP_MANAGE_RANKS}

+ +

{L_ACP_RANKS_EXPLAIN}

+ +
+ +
+ {L_ACP_RANKS} + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
style="display: none;"> +
+
+
+
+
+ + + +

+ + +   + + {S_FORM_TOKEN} +

+
+
+ + + +

{L_ACP_MANAGE_RANKS}

+ +

{L_ACP_RANKS_EXPLAIN}

+ +
+
+ {L_ACP_MANAGE_RANKS} + + + + + + + + + + + + + + + + + + + + + + + + +
{L_RANK_IMAGE}{L_RANK_TITLE}{L_RANK_MINIMUM}{L_ACTION}
{ranks.RANK_TITLE}  -  {ranks.RANK_TITLE}  -  {ranks.MIN_POSTS}{ICON_EDIT} {ICON_DELETE}
+ +

+ + {S_FORM_TOKEN} +

+
+
+ + + + diff --git a/install/update/new/adm/style/acp_search.html b/install/update/new/adm/style/acp_search.html new file mode 100644 index 0000000..9962005 --- /dev/null +++ b/install/update/new/adm/style/acp_search.html @@ -0,0 +1,159 @@ + + + + + +

{L_ACP_SEARCH_SETTINGS}

+ +

{L_ACP_SEARCH_SETTINGS_EXPLAIN}

+ + + + + + + +

{L_ACP_SEARCH_INDEX}

+ + +

{L_CONTINUE_EXPLAIN}

+ +
+
+ {L_SUBMIT} +   + + {S_FORM_TOKEN} +
+
+ + +

{L_ACP_SEARCH_INDEX_EXPLAIN}

+ + + + + +
+ +
+ + {backend.S_HIDDEN_FIELDS} + + {L_INDEX_STATS}{L_COLON} {backend.L_NAME} ({L_ACTIVE}) + + + + + + + + + + + + + + + + + + + + + + +
{backend.L_NAME} ({L_ACTIVE})
{L_STATISTIC}{L_VALUE}{L_STATISTIC}{L_VALUE}
{backend.data.STATISTIC_1}{L_COLON}{backend.data.VALUE_1}{backend.data.STATISTIC_2}{L_COLON}{backend.data.VALUE_2}
+ + + +

+ + + + + + + +

+ {S_FORM_TOKEN} +
+ +
+ + + + + + + diff --git a/install/update/new/adm/style/acp_styles.html b/install/update/new/adm/style/acp_styles.html new file mode 100644 index 0000000..c09294b --- /dev/null +++ b/install/update/new/adm/style/acp_styles.html @@ -0,0 +1,178 @@ + + + + + + « {L_BACK} + + + +
+ +
+

{MESSAGE_TITLE}

+

{MESSAGE_TEXT}

+ + + + + {S_HIDDEN_FIELDS} + +
+   + +
+ +
+ +
+ + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ {L_BROWSE_STYLES_DATABASE} +
+ +
+{S_HIDDEN_FIELDS} +{S_FORM_TOKEN} + + + +
+
+
+
+
+
+
+
{STYLE_PATH}
+
+
+
+
{STYLE_VERSION}
+
+
+
+
{STYLE_COPYRIGHT}
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+ +
+ {L_SUBMIT} +   + + {S_FORM_TOKEN} +
+ + + + + + + + + + + + {STYLES_LIST_EXTRA} + + + + + + + + + + + + + + + + + + {styles_list.EXTRA} + + + + +
{L_STYLE_NAME}{L_STYLE_PHPBB_VERSION}{L_STYLE_USED_BY}{L_ACTIONS} 
+ + + + + {styles_list.STYLE_NAME} +
{styles_list.STYLE_COPYRIGHT}
+ + {styles_list.STYLE_NAME} + + +
{styles_list.COMMENT}
+ + +
{L_STYLE_PATH}{L_COLON} {styles_list.STYLE_PATH_FULL}
+ +
{styles_list.STYLE_PHPBB_VERSION}{styles_list.USERS} + + | + + {styles_list.actions.L_ACTION} + + {styles_list.actions.HTML} + + + + {% if styles_list.STYLE_NAME !== 'prosilver' %} + + {% endif %} + + +   + + + + +
+ + + +
+ + + +
+ + +
+ + + + diff --git a/install/update/new/adm/style/acp_users_overview.html b/install/update/new/adm/style/acp_users_overview.html new file mode 100644 index 0000000..2af669a --- /dev/null +++ b/install/update/new/adm/style/acp_users_overview.html @@ -0,0 +1,169 @@ +
+ +
+ {L_ACP_USER_OVERVIEW} +
+

{L_NAME_CHARS_EXPLAIN}
+
+
[ {L_USE_PERMISSIONS} ]
+
+ +
+
+
{USER_INACTIVE_REASON}
+
+ +
+
+
{USER_REGISTERED}
+
+ +
+
+
{REGISTERED_IP}
+
[ {L_WHOIS} ]
+
+ +
+
+
{USER_LASTACTIVE}
+
+
+
+
+ + + {USER_POSTS} + + {USER_POSTS} + + + + ({L_POSTS_IN_QUEUE}) + + ({L_POSTS_IN_QUEUE}) + +
+
+
+
+
{USER_WARNINGS}
+
+
+

{L_FOUNDER_EXPLAIN}
+
+
+
+
+
+
+
+
+

{L_CHANGE_PASSWORD_EXPLAIN}
+
+
+
+

{L_CONFIRM_PASSWORD_EXPLAIN}
+
+
+ + +

+ + + {S_FORM_TOKEN} +

+ +
+
+ + + + + +
+ +
+ {L_USER_TOOLS} +
+
+
+
+ + +

+ + {S_FORM_TOKEN} +

+ +
+ +
+ + +
+
+ {L_DELETE_USER} +
+

{L_DELETE_USER_EXPLAIN}
+
+ + + + {L_USER_NO_POSTS_TO_DELETE} + +
+
+

+ + + {S_FORM_TOKEN} +

+
+
+ + diff --git a/install/update/new/adm/style/acp_users_prefs.html b/install/update/new/adm/style/acp_users_prefs.html new file mode 100644 index 0000000..358f3d5 --- /dev/null +++ b/install/update/new/adm/style/acp_users_prefs.html @@ -0,0 +1,151 @@ + + +
+ +
+ {L_UCP_PREFS_PERSONAL} + +
+
+
+
+
+
+
+
+
+
+
+

{L_ALLOW_PM_EXPLAIN}
+
+
+
+
+
+
+
+
+
+

{L_NOTIFY_METHOD_EXPLAIN}
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+

{L_BOARD_DATE_FORMAT_EXPLAIN}
+
+
style="display:none;">
+
+ +
+ +
+ {L_UCP_PREFS_POST} + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+ {L_UCP_PREFS_VIEW} + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{S_TOPIC_SORT_DAYS}
+
+
+
+
{S_TOPIC_SORT_KEY}
+
+
+
+
{S_TOPIC_SORT_DIR}
+
+
+
+
{S_POST_SORT_DAYS}
+
+
+
+
{S_POST_SORT_KEY}
+
+
+
+
{S_POST_SORT_DIR}
+
+ +
+ +
+ + {S_FORM_TOKEN} +
+ +
diff --git a/install/update/new/adm/style/acp_users_signature.html b/install/update/new/adm/style/acp_users_signature.html new file mode 100644 index 0000000..40f0fc2 --- /dev/null +++ b/install/update/new/adm/style/acp_users_signature.html @@ -0,0 +1,52 @@ + + +
+ + +
+ {L_ADMIN_SIG_PREVIEW} +

{SIGNATURE_PREVIEW}

+
+ + +
+ {L_SIGNATURE} +

{L_SIGNATURE_EXPLAIN}

+ + + +
+
+
+
+
+ + + + + + + + + +
+
{L_OPTIONS}{L_COLON} {BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {URL_STATUS} :: {SMILIES_STATUS}
+
+
+ +
+   + + {S_FORM_TOKEN} +
+
diff --git a/install/update/new/adm/style/admin.css b/install/update/new/adm/style/admin.css new file mode 100644 index 0000000..3243d0e --- /dev/null +++ b/install/update/new/adm/style/admin.css @@ -0,0 +1,2736 @@ +/* phpBB 3.3 Admin Style Sheet + ------------------------------------------------------------------------ + Original author: subBlue ( http://www.subblue.com/ ) + Copyright (c) phpBB Limited + + For full copyright and license information, please see + the docs/CREDITS.txt file. + ------------------------------------------------------------------------ +*/ + +/* General markup styles +---------------------------------------- */ +* { + /* Reset browsers default margin, padding and font sizes */ + margin: 0; + padding: 0; + font-size: 100%; +} + +abbr { + text-decoration: none; +} + +body, div, p, th, td, li, dd { + font-size: x-small; + voice-family: "\"}\""; + voice-family: inherit; + font-size: small; +} + +html>body, html>div, html>p, html>th, html>td, html>li, html>dd { + font-size: small; +} + +html { + color: #536482; + background: #DBD7D1; + /* Always show a scrollbar for short pages - stops the jump when the scrollbar appears. non-ie browsers */ + height: 100%; + margin-bottom: 1px; + word-wrap: break-word; +} + +body { + /* Text-Sizing with ems: http://www.clagnut.com/blog/348/ */ + font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + color: #536482; + background: #DBD7D1; + font-size: 62.5%; /* This sets the default font size to be equivalent to 10px */ + margin: 10px 15px; +} + +code, samp { + font-size: 1.2em; +} + +img { + border: 0; +} + +h1 { + font-family: "Trebuchet MS", Helvetica, sans-serif; + font-size: 1.70em; + font-weight: normal; + color: #333333; +} + +h2, caption { + font-family: "Trebuchet MS", Helvetica, sans-serif; + font-size: 1.40em; + font-weight: normal; + color: #115098; + text-align: left; + margin-top: 25px; +} + +.rtl h2, .rtl caption { + text-align: right; +} + +h3, h4 { + font-family: "Trebuchet MS", Helvetica, sans-serif; + font-size: 1.20em; + text-decoration: none; + line-height: 1.20em; + margin-top: 25px; +} + +p { + margin-bottom: 0.7em; + line-height: 1.40em; + font-size: 0.90em; +} + +ul { + list-style: disc; + margin: 0 0 1em 2em; +} + +.rtl ul { + margin: 0 2em 1em 0; +} + +hr { + border: 0 none; + border-top: 1px dashed #999999; + margin-bottom: 5px; + padding-bottom: 5px; + height: 1px; +} + +.centered-text { + text-align: center; +} + +.search-box { + float: left; +} + +.rtl .search-box { + float: right; +} + +.small { + font-size: 0.85em; +} + +.hidden { + display: none; +} + +@media only screen and (max-width: 800px), only screen and (max-device-width: 800px) +{ + body { + margin: 5px 5px 0; + } +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + html, body { + height: auto; + margin: 0; + padding: 0; + } +} + + +/* General links */ +a:link, a:visited { + color: #105289; + text-decoration: none; +} + +a:hover { + color: #BC2A4D; + text-decoration: underline; +} + +a:active { + color: #368AD2; + text-decoration: none; +} + +.install-body p a { + font-weight: bold; +} + +a#maincontent, a#acl, a#assigned_to { + display: block; +} + +/* List items */ +ul, ol { + list-style-position: inside; + margin-left: 1em; +} + +li { + display: list-item; + list-style-type: inherit; +} + + +/* Main blocks +---------------------------------------- */ +#wrap { + padding: 0 0 15px 0; + min-width: 615px; +} + +#page-header { + text-align: right; + background: url("../images/phpbb_logo.svg") top left no-repeat; + height: 54px; + font-size: 0.85em; + margin-bottom: 10px; +} + +.rtl #page-header { + text-align: left; + background: url("../images/phpbb_logo.svg") top right no-repeat; +} + +#page-header h1 { + color: #767676; + font-family: "Trebuchet MS",Helvetica,sans-serif; + font-size: 1.70em; + padding-top: 10px; +} + +#page-header p { + font-size: 1.00em; +} + +#page-header p#skip { + display: none; +} + +#page-body { + min-width: 650px; +} + +.copyright { + font-size: 0.75em; + text-align: center; +} + +#content { + padding: 30px 10px 10px; + position: relative; +} + +#content h1 { + color: #115098; + line-height: 1.2em; + margin-bottom: 0; +} + +#main { + float: right; + width: 100%; + margin: 0 0 0 -210px; +} + +.rtl #main { + float: left; + margin: 0 -210px 0 0; +} + +.main { + margin-left: 210px; +} + +.rtl .main { + margin-left: 0; + margin-right: 210px; +} + +#page-body.simple-page-body { + padding: 0; + padding-right: 10px; + min-width: 0; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + #wrap, #page-body, #page-body.simple-page-body { + padding: 0; + min-width: 300px; + } + + #page-header { + margin: 5px; + padding-left: 160px; + height: auto; + min-height: 54px; + overflow: hidden; + } + + .rtl #page-header { + padding-right: 160px; + padding-left: 0; + } + + #page-header h1 { + font-size: 1.2em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + #page-header fieldset { + margin-top: 5px; + } + + #main, .rtl #main, .main, .rtl .main { + float: none; + width: auto; + margin: 0; + } + + #content { + background: #F3F3F3 url("../images/innerbox_bg.gif") repeat-x top; + padding: 5px; + } + + #page-footer { + padding: 0 5px 5px; + } +} + +@media only screen and (max-width: 400px), only screen and (max-device-width: 400px) +{ + #page-header { + background-size: 76px 26.5px; + padding-left: 80px; + min-height: 30px; + } + + .rtl #page-header { + padding-right: 80px; + } + + #page-header h1 { + padding-top: 0; + font-size: 1.1em; + } +} + + +/* Tabbed menu +----------------------------------------*/ +#tabs { + font-family: Arial, Helvetica, sans-serif; + line-height: normal; + margin: 0 7px; + position: relative; + z-index: 2; +} + +#tabs > ul { + list-style: none; + margin: 0; + padding: 0; +} + +#tabs .tab { + display: inline-block; + float: left; + font-size: 0.85em; + font-weight: bold; + line-height: 14px; +} + +.rtl #tabs .tab { + float: right; +} + +#tabs .tab > a { + background: #D4D6DA; + background: -moz-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #CACBCF), color-stop(100%, #D4D6DA)); + background: -webkit-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: -o-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: -ms-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: linear-gradient(to bottom, #CACBCF 0%, #D4D6DA 100%); + border: 1px solid #BBB; + border-bottom-width: 0; + border-radius: 5px 5px 0 0; + color: #767676; + display: block; + font-weight: bold; + margin: 1px 1px 2px 0; + padding: 6px 9px 4px; + position: relative; + text-decoration: none; + text-transform: uppercase; + white-space: nowrap; + cursor: pointer; +} + +#tabs .tab > a:hover { + background: #F1F1EE; + border-color: #C0BFBB; + color: #BC2A4D; +} + +#tabs .activetab > a, +#tabs .activetab > a:hover { + background: #DCDEE2; + background: -moz-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #F2F2F2), color-stop(100%, #DCDEE2)); + background: -webkit-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: -o-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: -ms-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: linear-gradient(to bottom, #F2F2F2 0%, #DCDEE2 100%); + border-color: #999; + border-bottom: 2px solid #DCDEE2; + box-shadow: 0 1px 1px #FFF inset; + color: #23649F; + margin: 0 1px 0 0; + padding: 7px 10px 4px; +} + +#tabs .activetab > a:hover { + color: #115098; +} + +/* Responsive tabs +----------------------------------------*/ +.responsive-tab { + position: relative; +} + +.responsive-tab > a.responsive-tab-link { + display: block; + font-size: 16px; + position: relative; + width: 16px; + line-height: 14px; + text-decoration: none; + padding-left: 9px !important; + padding-right: 9px !important; +} + +.responsive-tab .responsive-tab-link:before { + content: ''; + position: absolute; + left: 10px; + top: 7px; + height: .125em; + width: 14px; + border-bottom: 0.125em solid #767676; + border-top: 0.375em double #767676; +} + +.responsive-tab .responsive-tab-link:hover:before { + border-color: #BC2A4D; +} + +.responsive-tab.activetab .responsive-tab-link:before { + border-color: #23649F; +} + +.responsive-tab.activetab .responsive-tab-link:hover:before { + border-color: #115098; +} + +#tabs .dropdown, #minitabs .dropdown { + top: 20px; + margin-right: -2px; + font-weight: normal; +} + +#tabs .dropdown-right .dropdown { + margin-left: -2px; +} + +#tabs .dropdown-contents { + list-style: none; + margin: 0; +} + +#tabs .dropdown li { + border-bottom: 1px dotted #DCDCDC; +} + +#tabs .dropdown li:last-child { + border-bottom: none; +} + +#tabs .dropdown a { + display: block; + padding: 4px 8px; + text-align: right; +} + +/* Main Panel +---------------------------------------- */ +#acp { + position: relative; + top: -2px; + margin: 0 0 2px; + padding: 3px 1px; + min-width: 550px; + background: #F3F3F3 url("../images/innerbox_bg.gif") repeat-x top; + border: 1px #999999 solid; + border-radius: 5px; + box-shadow: #FFF 0 0 0 1px inset; +} + +#acp:first-child { + top: 0; +} + +.panel { + background: #F3F3F3 url("../images/innerbox_bg.gif") repeat-x top; + padding: 5px 0; + border-radius: 5px; + overflow: hidden; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + #acp { + min-width: 0; + min-height: 0; + border-radius: 0; + border-width: 1px 0; + background: #fff; + padding: 1px 0; + box-shadow: none; + } +} + +/* Sub-navigation Menu +---------------------------------------- */ + +/* Menu */ +#menu { + float: left; + width: 200px; + font-size: 1.00em; + padding: 0; + border-right: 1px solid #CCCFD3; + position: relative; +} + +.rtl #menu { + float: right; + border: none; + border-left: 1px solid #CCCFD3; +} + +#menu p { + font-size: 0.85em; +} + +#menu ul { + list-style: none; + margin: 0; + padding: 0; + word-wrap: normal; +} + +/* Default list state */ +#menu li, #menu .header { + padding: 0; + margin: 0; + font-size: 0.85em; + font-weight: bold; + display: block; +} + +/* Link styles for the sub-section links */ +#menu li span { + display: block; + padding: 3px 3px 3px 8px; + margin: 1px 0; + text-decoration: none; + font-weight: normal; + color: #138ECB; +} + +.rtl #menu li span { + padding: 3px 8px 3px 3px; +} + +#menu li a:hover, #menu li a:hover span { + text-decoration: none; + background-color: #FFFFFF; + color: #BC2A4D; +} + +#menu li a:active, #menu li a:active span { + color: #F632A0; +} + +#menu li#activemenu a span { + text-decoration: none; + font-weight: bold; + color: #1180B7; + background: transparent url("../images/arrow_right.gif") 0% 50% no-repeat; +} + +.rtl #menu li#activemenu a span { + background: transparent url("../images/arrow_left.gif") 100% 50% no-repeat; +} + +#menu li#activemenu a:hover span, #menu li#activemenu span { + text-decoration: none; + font-weight: bold; + color: #BC2A4D; + background: #FFFFFF url("../images/arrow_right.gif") 1% 50% no-repeat; +} + +.rtl #menu li#activemenu a:hover span, .rtl #menu li#activemenu span { + background: #FFFFFF url("../images/arrow_left.gif") 99% 50% no-repeat; +} + +#menu li a:active, #menu li a:active span, #menu li#activemenu a:active span { + color: #F632A0; +} + +#menu li span.completed { + text-decoration: none; + padding: 3px 3px 3px 12px; + background: url("../images/arrow_down.gif") 1% 50% no-repeat; +} + +.rtl #menu li span.completed { + text-decoration: none; + padding: 3px 12px 3px 3px; + background: url("../images/arrow_down.gif") 99% 50% no-repeat; +} + +#menu .header { + font-family: Tahoma, Helvetica, sans-serif; + display: block; + font-weight: bold; + color: #115098; + border-bottom: 1px solid #327AA5; + padding: 4px 0 2px; + margin-top: 15px; + text-transform: uppercase; + font-size: 0.75em; + text-decoration: none; + cursor: inherit; + outline-style: none; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + #menu, .rtl #menu { + float: none; + width: auto; + border-width: 0; + max-width: 200px; + margin: 0 auto 10px; + } + + #menu p { + text-align: center; + } + + #menu .menu-block.active { + margin: 0 -5px; + padding: 0 5px 3px; + background: rgba(255, 255, 255, .5); + border-radius: 5px; + } + + #menu .menu-block.no-header.active { + padding-top: 3px; + } + + #menu .menu-block .header { + margin-top: 5px; + cursor: pointer; + border-bottom-width: 0; + position: relative; + text-decoration: underline; + } + + #menu .menu-block .header:focus, #menu .menu-block.active .header { + color: #D31141; + text-decoration: none; + } + + #menu .menu-block ul { + display: none; + } + + .nojs #menu .menu-block:hover ul, #menu .menu-block.active ul, #menu .menu-block.no-header ul { + display: block; + } + + #menu .menu-block li:last-child { + border-bottom: 1px solid #327AA5; + } + + #menu .menu-block:last-child li:last-child, #menu .menu-block.active li:last-child { + border-bottom-width: 0; + } + + #menu .menu-block li a span { + border-radius: 2px; + } +} + + +/* Table styles +---------------------------------------- */ + +table { + width: 100%; + border: 1px solid #CCCFD3; + background-color: #FFFFFF; + padding: 1px; +} + +th { + padding: 3px 4px; + color: #FFFFFF; + background: #70AED3 url("../images/gradient2b.gif") bottom left repeat-x; + border-top: 1px solid #6DACD2; + border-bottom: 1px solid #327AA5; + text-align: left; + font-size: 0.75em; + text-transform: uppercase; +} + +td { + text-align: left; + font-size: 0.85em; + padding: 4px; + line-height: 1.20em; +} + +.rtl th, .rtl td { + text-align: right; +} + +.table1 { + clear: both; + border-spacing: 1px; + border-collapse: separate; +} + +.table2 { + display: inline-block; + border-spacing: 1px; + border-collapse: separate; +} + +.lside { + display: flex; + align-items: stretch; + width: 100%; +} + +.tabled { + width: 1%; +} + +dt#color_palette_placeholder table { + margin-right: 5px; + width: 80px; +} + +#color_palette_placeholder td { + padding: 0; +} + +table.type2 { + border: none; + background: none; + padding: 0; +} + +table.type2 th { + background: none; + border-top: none; + text-align: center; + color: #115098; + padding: 2px 0; +} + +table.type2 td { + padding: 0; + font-size: 1em; +} + +table.type2 td.name { + padding: 2px; + vertical-align: middle; +} + +table.type3 { + float: right; + width: 300px; + border: none; + background-color: transparent; + padding: 0; +} + +.rtl table.type3 { + float: left; +} + +table.type3 thead th { + background-color: transparent; + border-top: none; + text-align: center; + color: #115098; + padding: 0 3px; + font-size: 0.85em; + font-weight: normal; + text-transform: none; +} + +table.type3 tbody th { + border-top: none; + text-align: left; + text-transform: none; + padding: 0; + border: none; + font-size: 0.90em; + font-weight: normal; + width: 100%; +} + +.rtl table.type3 tbody th { + text-align: right; +} + +table.type3 td { + text-align: center; + padding: 1px; +} + +th.name { + text-align: left; + width: auto; +} + +.rtl th.name { + text-align: right; +} + +td.name { + text-align: left; + font-weight: bold; +} + +.rtl td.name { + text-align: right; +} + +.entry { + text-align: left; + font-weight: normal; +} + +.rtl .entry { + text-align: right; +} + +.row1 { + background-color: #F9F9F9; +} + +table.zebra-table tbody tr:nth-child(odd) { + background-color: #F9F9F9; +} + +.row2 { + word-break: break-all; + background-color: #DCEBFE; +} + +table.zebra-table tbody tr:nth-child(even) { + background-color: #DCEBFE; +} + +.row3 { background-color: #DBDFE2; } +.row4 { background-color: #E4E8EB; } +.col1 { background-color: #DCEBFE; } +.col2 { background-color: #F9F9F9; } + +/* 4 row background colours for trees */ +.row1a { background-color: #F9F9F9; } +.row1b { background-color: #F6F6F6; } +.row2a { background-color: #E7EEF4; } +.row2b { background-color: #E3EBF2; } + +tr.row-highlight:hover td { background-color: #DBDFE2; } + +.spacer { + background-color: #DBDFE2; + height: 1px; + line-height: 1px; +} + +/* Deactivated row */ +.row-inactive { + color: #999; +} +.row-inactive a, .row-inactive strong { + color: #888; +} +.row-inactive a:hover { + color: #BC2A4D; +} + +/* Specific tables */ +table.forums td.folder { + width: 27px; + text-align: center; +} + +table td.actions { + vertical-align: middle; + width: 100px; + text-align: center; + white-space: nowrap; +} + +table tr:first-child td.actions .up, table tr:last-child td.actions .down { + display: none; +} + +table tr:first-child td.actions .up-disabled, table tr:last-child td.actions .down-disabled { + display: inline !important; +} + +table.styles td.users, table td.mark { + text-align: center; +} + +table.fixed-width-table { + table-layout: fixed; + word-break: break-word; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { + display: block; + } + + table.responsive thead, table.responsive th, table.responsive colgroup { + display: none; + } + + table.responsive.show-header thead, table.responsive.show-header th:first-child, table.responsive caption { + display: block; + width: auto !important; + text-align: left !important; + margin: 0; + } + + table.responsive { + background: transparent none; + border-width: 0; + padding: 0; + } + + table.responsive caption { + padding: 3px 4px; + color: #FFFFFF; + background: #70AED3 url("../images/gradient2b.gif") bottom left repeat-x; + border-top: 1px solid #6DACD2; + border-bottom: 1px solid #327AA5; + text-align: left; + font-size: 0.75em; + font-weight: bold; + text-transform: uppercase; + } + + table.responsive.show-header th:first-child span.rank-img, table.responsive.no-caption caption, table.responsive.no-header thead { + display: none; + } + + table.responsive tr { + margin: 2px 0; + border: 1px solid #CCCFD3; + background-color: #FFFFFF; + padding: 1px 1px 0; + overflow: hidden; + } + + table.responsive tr.row1 td { background-color: #F9F9F9; } + table.responsive tr.row2 td { background-color: #DCEBFE; } + table.responsive tr.row3 td { background-color: #DBDFE2; } + table.responsive tr.row4 td { background-color: #E4E8EB; } + table.responsive tr.col1 td { background-color: #DCEBFE; } + table.responsive tr.col2 td { background-color: #F9F9F9; } + table.responsive tr.row1a td { background-color: #F9F9F9; } + table.responsive tr.row1b td { background-color: #F6F6F6; } + table.responsive tr.row2a td { background-color: #E7EEF4; } + table.responsive tr.row2b td { background-color: #E3EBF2; } + + table.responsive td { + width: auto !important; + text-align: left !important; + padding: 4px; + margin-bottom: 1px; + } + + .rtl table.responsive td { + text-align: right !important; + } + + table.responsive td.empty { + display: none !important; + } + + table.responsive td > dfn { + display: inline-block !important; + } + + table.responsive td > dfn:after { + content: ':'; + padding-right: 5px; + } + + table.responsive.two-columns td { + width: 50% !important; + float: left; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + + .rtl table.responsive.two-columns td { + float: right; + } + + table.responsive.two-columns td:nth-child(2n+1) { + clear: left; + } + + table.responsive span.rank-img { + float: none; + padding-right: 5px; + } + + table.responsive#memberlist td:first-child input[type="checkbox"] { + float: right; + } + + /* Specific tables */ + table.responsive.forums td.folder { + float: left; + width: 27px; + background: transparent; + } + .rtl table.responsive.forums td.folder { + float: right; + } + + table.responsive.forums td.forum-desc { + margin-left: 35px; + min-height: 27px; + background: transparent; + } + + .rtl table.responsive.forums td.forum-desc { + margin-left: 0; + margin-right: 35px; + } + + table.responsive td.actions { + clear: both; + text-align: right !important; + } + + .rtl table.responsive td.actions { + text-align: left !important; + } + + table.responsive.styles tr.responsive-style-row td:first-child { + padding-left: 4px !important; + padding-right: 4px !important; + } + + table.responsive.styles td:first-child > dfn, table.responsive td.actions > dfn { + display: none !important; + } + + .horizontal-palette td:nth-child(2n), .vertical-palette tr:nth-child(2n) { + display: none; + } + + .colour-palette a { + display: inline-block !important; + } +} + +/* General form styles +----------------------------------------*/ +fieldset { + margin: 15px 0; + padding: 10px; + border-top: 1px solid #D7D7D7; + border-right: 1px solid #CCCCCC; + border-bottom: 1px solid #CCCCCC; + border-left: 1px solid #D7D7D7; + background-color: #FFFFFF; + position: relative; + border-radius: 3px; +} + +fieldset h2 { + margin-top: 0; +} + +.rtl fieldset { + border-top: 1px solid #D7D7D7; + border-right: 1px solid #D7D7D7; + border-bottom: 1px solid #CCCCCC; + border-left: 1px solid #CCCCCC; +} + +fieldset p { + font-size: 0.85em; +} + +legend { + padding: 1px 0; + font-family: Tahoma,arial,Verdana,Sans-serif; + font-size: .9em; + font-weight: bold; + color: #115098; + margin-top: -.4em; + position: relative; + text-transform: none; + line-height: 1.2em; + top: -.2em; + vertical-align: middle; +} + +input, textarea { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 0.90em; + font-weight: normal; + vertical-align: middle; + padding: 2px; + color: #111111; + border-left: 1px solid #AFAEAA; + border-top: 1px solid #AFAEAA; + border-right: 1px solid #D5D5C8; + border-bottom: 1px solid #D5D5C8; + background-color: #E3DFD8; +} + +.rtl input, .rtl textarea { + border-left: 1px solid #D5D5C8; + border-top: 1px solid #AFAEAA; + border-right: 1px solid #AFAEAA; + border-bottom: 1px solid #D5D5C8; +} + +input:hover, textarea:hover { + border-left: 1px solid #AFAEAA; + border-top: 1px solid #AFAEAA; + border-right: 1px solid #AFAEAA; + border-bottom: 1px solid #AFAEAA; + background-color: #E9E9E2; +} + +input.langvalue, textarea.langvalue { + width: 90%; +} + +input[type="number"] { + width: 60px; + -moz-padding-end: 0; +} + +optgroup, select { + background-color: #FAFAFA; + border: 1px solid #666666; + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 0.85em; + font-weight: normal; + font-style: normal; + cursor: pointer; + padding: 1px; + vertical-align: middle; + width: auto; + color: #000; +} + +select:focus { + outline-style: none; +} + +optgroup { + font-size: 1.00em; + font-weight: bold; +} + +optgroup.disabled-options { + display: none; + background-color: gray; +} + +option { + padding: 0 1em 0 0; + color: #000; +} + +option.disabled-option { + color: graytext; +} + +.rtl option { + padding: 0 0 0 1em; +} + +.sep { + font-weight: bold; +} + +.username-coloured { + font-weight: bold; +} + +textarea { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 0.85em; + width: 60%; + padding: 2px; +} + +label { + cursor: pointer; + font-size: 0.85em; + padding: 0 5px 0 0; +} + +.rtl label { + padding: 0 0 0 5px; +} + +label input { + font-size: 1.00em; + vertical-align: middle; +} + +label img { + vertical-align: middle; +} + +fieldset.quick, p.quick { + margin: 0 0 5px; + padding: 5px 0 0; + border: none; + background-color: transparent; + text-align: right; +} + +.rtl fieldset.quick, .rtl p.quick { + text-align: left; +} + +fieldset.quick legend { + display: none; +} + +fieldset.tabulated { + background: none; + margin: 0; + margin-top: 5px; + padding: 0; + border: 0; +} + +fieldset.tabulated legend { + display: none; +} + +fieldset.nobg { + margin: 15px 0 0 0; + padding: 0; + border: none; + background-color: transparent; +} + +fieldset.display-options { + margin: 15px 0 2px 0; + padding: 0 0 4px 0; + border: none; + background-color: transparent; + text-align: center; + font-size: 0.85em; +} + +fieldset.display-options select, fieldset.display-options input, fieldset.display-options label { + font-size: 1.00em; + vertical-align: middle; +} + +select option.disabled { + background-color: #bbb; + color: #fff; +} + +/* Special case inputs */ +select#board_timezone, +select#full_folder_action { + width: 95%; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + fieldset { + padding: 5px; + } + + fieldset.quick, p.quick { + float: none !important; + text-align: center; + } + + fieldset.display-options { + clear: both; + } +} + +/* Definition list layout for forms + Other general def. list properties defined in prosilver_main.css +---------------------------------------- */ +dl { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 1.00em; +} + +dt { + float: left; + width: auto; +} + +.rtl dt { + float: right; +} + +dd { color: #666666;} +dd + dd { padding-top: 5px;} +dt span { padding: 0 5px 0 0;} +.rtl dt span { padding: 0 0 0 5px;} + +dt .explain { font-style: italic;} + +dt label { + font-size: 1.00em; + text-align: left; + font-weight: bold; + color: #4A5A73; +} + +.rtl dt label { + text-align: right; +} + +dd label { + font-size: 1.00em; + white-space: nowrap; + margin: 0 10px 0 0; + color: #4A5A73; +} + +.rtl dd label { + margin: 0 0 0 10px; +} + +html>body dd label input { vertical-align: text-bottom;} /* Tweak for Moz to align checkboxes/radio buttons nicely */ + +dd input { + font-size: 1.00em; + max-width: 100%; + margin: 2px 0; +} + +dd select { + font-size: 100%; + font-size: 1em; + width: auto; + max-width: 100%; + margin: 2px 0; +} + +dd textarea { + font-size: 0.90em; + width: 90%; +} + +fieldset dl { + margin-bottom: 10px; + font-size: 0.85em; +} + +fieldset dt { + width: 45%; + text-align: left; + border: none; + border-right: 1px solid #CCCCCC; + padding-top: 3px; +} + +.rtl fieldset dt { + text-align: right; + border: none; + border-left: 1px solid #CCCCCC; +} + +fieldset #color_palette_placeholder { + padding-top: 0; +} + +fieldset dd { + margin: 0 0 0 45%; + padding: 0 0 0 5px; + border: none; + border-left: 1px solid #CCCCCC; + vertical-align: top; + font-size: 1.00em; +} + +.rtl fieldset dd { + margin: 0 45% 0 0; + padding: 0 5px 0 0; + border: none; + border-right: 1px solid #CCCCCC; +} + +dd.full, .rtl dd.full { + margin: 0; + border: 0; + padding: 0; + padding-top: 3px; + text-align: center; + width: 95%; +} + +/* Hover highlights for form rows */ +fieldset dl:hover dt, fieldset dl:hover dd { + border-color: #666666; +} + +fieldset dl:hover dt label { + color: #000000; +} + +fieldset dl dd label:hover { + color: #BC2A4D; +} + +input:focus, textarea:focus { + border: 1px solid #BC2A4D; + background-color: #E9E9E2; + color: #BC2A4D; + outline-style: none; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + fieldset dl { + margin-bottom: 5px; + padding-bottom: 5px; + border-bottom: 1px solid #e8e8e8; + } + + fieldset > dl:last-child, fieldset > form:last-child > dl:last-child { + border-bottom-width: 0; + margin-bottom: 0; + } + + fieldset dt, .rtl fieldset dt, fieldset dd, .rtl fieldset dd { + border-width: 0; + margin-left: 0; + margin-right: 0; + float: none; + width: auto; + } + + fieldset .responsive-columns dt { + float: left; + } + + .ltr fieldset dd { + padding-left: 20px; + } + + .rtl fieldset dd { + padding-right: 20px; + } + + select, dd select, dd input { + max-width: 300px; + } + + input[type="number"], dd input[type="number"] { + max-width: 70px; + } +} + +@media only screen and (max-width: 400px), only screen and (max-device-width: 400px) +{ + select, dd select, dd input { + max-width: 240px; + } +} + +/* Submit button fieldset or paragraph +---------------------------------------- */ +fieldset.submit-buttons { + text-align: center; + border: none; + background-color: transparent; + margin: 0; + padding: 4px; + margin-top: -1px; +} + +p.submit-buttons { + text-align: center; + margin: 0; + padding: 4px; + margin-top: 10px; +} + +fieldset.submit-buttons input, p.submit-buttons input { + padding: 3px 2px; +} + +fieldset.submit-buttons legend { + display: none; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + p.submit-buttons { + margin-top: 0; + } +} + +/* Input field styles +---------------------------------------- */ + +input.radio, input.checkbox, input.permissions-checkbox { + width: auto !important; + background-color: transparent; + border: none; + cursor: pointer; +} + +input.full, +textarea.full { + width: 99%; +} + +input.medium { width: 50%;} +input.narrow { width: 25%;} +input.tiny { width: 10%;} +input.autowidth { width: auto !important;} +.box2 .inputbox { background-color: #E9E9E9;} + +/* Form button styles +---------------------------------------- */ +a.button1, input.button1, +a.button2, input.button2 { + width: auto !important; + padding: 1px 3px 0 3px; + font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + color: #000; + font-size: 0.85em; + background: #EFEFEF url("../images/bg_button.gif") repeat-x top; + cursor: pointer; +} + +a.button1, input.button1 { + font-weight: bold; + border: 1px solid #666666; +} + +/* Alternative button */ +a.button2, input.button2 { + border: 1px solid #666666; +} + +/* button in the style of the form buttons */ +a.button1, a.button1:link, a.button1:visited, a.button1:active, +a.button2, a.button2:link, a.button2:visited, a.button2:active { + text-decoration: none; + color: #000000; + padding: 4px 8px; +} + +/* Hover states */ +a.button1:hover, input.button1:hover, +a.button2:hover, input.button2:hover { + border: 1px solid #BC2A4D; + background: #EFEFEF url("../images/bg_button.gif") repeat bottom; + color: #BC2A4D; +} + +input.disabled { + font-weight: normal; + color: #666666; +} + +/* Focus states */ +input.button1:focus, input.button2:focus { + outline-style: none; +} + +/* jQuery popups +---------------------------------------- */ +.phpbb_alert { + background-color: #FFFFFF; + border: 1px solid #999999; + position: fixed; + display: none; + top: 150px; + left: 0; + right: 0; + width: 620px; + margin: 0 auto; + z-index: 50; + padding: 25px; + padding: 0 25px 20px 25px; +} + +.phpbb_alert .alert_close { + display: block; + float: right; + width: 16px; + height: 16px; + overflow: hidden; + text-decoration: none !important; + background: transparent url("../images/alert_close.png") 0 0 no-repeat; + margin-top: -7px; + margin-right: -31px; +} +.phpbb_alert .alert_close:hover { + background-position: 0 -16px; +} + + +.phpbb_alert p { + margin: 8px 0; + padding-bottom: 8px; +} + +.phpbb_alert label { + display: block; + margin: 8px 0; + padding-bottom: 8px; +} + +.phpbb_alert div.alert_text > p, +.phpbb_alert div.alert_text > label, +.phpbb_alert div.alert_text > select, +.phpbb_alert div.alert_text > textarea, +.phpbb_alert div.alert_text > input { + font-size: 0.9em; +} + +#darkenwrapper { + display: none; + position: relative; + z-index: 44; +} + +#darken { + position: fixed; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: #000000; + opacity: 0.5; + z-index: 45; +} + +@media only screen and (max-height: 500px), only screen and (max-device-width: 500px) +{ + .phpbb_alert { + top: 25px; + } +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + .phpbb_alert { + width: auto; + margin: 0 25px; + } +} + +#loading_indicator { + background: #000000 url("../images/loading.gif") center center no-repeat; + border-radius: 5px; + display: none; + opacity: 0.8; + margin-top: -50px; + margin-left: -50px; + height: 50px; + width: 50px; + position: fixed; + left: 50%; + top: 50%; + z-index: 51; +} + +/* Pagination +---------------------------------------- */ +.pagination { + font-size: .85em; + height: 1%; /* IE tweak (holly hack) */ + width: auto; + text-align: right; + margin: 5px 0; +} + +.top-pagination { + float: right; + margin: 15px 0 5px 0; +} + +.rtl .pagination { + text-align: left; + float: left; +} + +li.pagination { + margin-top: 0; +} + +.pagination img { + vertical-align: middle; +} + +.pagination ul { + display: inline-block; + *display: inline; /* IE7 inline-block hack */ + *zoom: 1; + margin-left: 0; + margin-bottom: 0; +} + +li.pagination ul { + margin-top: -2px; + vertical-align: middle; +} + +.pagination ul li, dl .pagination ul li, dl.icon .pagination ul li { + display: inline; + padding: 0; + font-size: 100%; + line-height: normal; +} + +.pagination li a, .pagnation li span, li .pagination li a, li .pagnation li span, .pagination li.active span, .pagination li.ellipsis span { + font-weight: normal; + text-decoration: none; + padding: 0 2px; + border: 1px solid transparent; + font-size: 0.9em; + line-height: 1.5em; +} + +.pagination li a, .pagination li a:link, .pagination li a:visited { + color: #5C758C; + background-color: #ECEDEE; + border-color: #B4BAC0; +} + +.pagination li.ellipsis span { + background-color: transparent; + color: #000000; +} + +.pagination li.active span { + color: #FFFFFF; + background-color: #4692BF; + border-color: #4692BF; +} + +.pagination li a:hover, .pagination .active a:hover { + color: #FFFFFF; + background-color: #368AD2; + border-color: #368AD2; +} + +.pagination li a:active, .pagination li.active a:active { + color: #5C758C; + background-color: #ECEDEE; + border-color: #B4BAC0; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + .pagination, .rtl .pagination { + float: none; + text-align: center; + margin: 5px 0; + } + + .pagination li a, .pagination li span { + display: inline-block; + min-width: 10px; + } +} + +/* Action Highlighting +---------------------------------------- */ +.successbox, .errorbox, .warningbox { + padding: 8px; + margin: 10px 0; + color: #FFFFFF; + text-align: center; + clear: both; +} + +.success { + color: #228822; +} + +.error { + color: #BC2A4D; +} + +.successbox { + background-color: #228822; +} + +.errorbox { + background-color: #BC2A4D; +} + +.warningbox { + background-color: #fca600; +} + +.successbox h3, .errorbox h3 { + color: #FFFFFF; + margin: 0 0 0.5em; + font-size: 1.10em; + font-family: "Lucida Grande",Verdana,Helvetica,Arial,sans-serif; +} + +.successbox p, .errorbox p { + color: #FFFFFF; + font-size: 0.85em; + margin-bottom: 0; +} + +.errorbox a:link, .errorbox a:active, .errorbox a:visited, +.successbox a:link, .successbox a:active, .successbox a:visited { + color: #DBD7D1; + text-decoration: underline; + font-weight: bold; +} + +.errorbox a:hover, .successbox a:hover { + color: #FFFFFF; + text-decoration: none; + font-weight: bold; +} + +#log-container { + display: none; + max-height: 300px; + padding: 8px; + margin: 10px 0; + clear: both; + overflow-y: auto; + background-color: #FFFFFF; +} + +#log-container.show_log_container { + display: block; + border: 1px solid #DBD7D1; +} + +.log { + font-size: 0.8em; +} + +.notice { + background-color: #62A5CC; +} + +.download-box { + margin: 10px 0 10px 0; +} + +/* Special cases for the error page */ +#errorpage #page-header a { + font-weight: bold; + line-height: 6em; +} + +#errorpage #content { + padding-top: 10px; +} + +#errorpage #content h1 { + color: #DF075C; +} + +#errorpage #content h2 { + margin-top: 20px; + margin-bottom: 5px; + border-bottom: 1px solid #CCCCCC; + padding-bottom: 5px; + color: #333333; +} + +/* Tooltip for permission roles */ +.tooltip { + width: 200px; + color: #000; + text-align: center; + border: 1px solid #AAA; +} + +.tooltip span.top { + background: #EFEFEF; + font-weight: bold; + padding: 2px; +} + +.tooltip span.bottom { + padding: 5px; + color: #000000; + background: #FFFFFF; +} + +/* + Format Buttons for signature editor +*/ +#format-buttons { + margin: 15px 0 2px 0; +} + +#format-buttons input, #format-buttons select { + vertical-align: middle; +} + +.row, fieldset dl { + overflow: hidden; +} + +/* Syntax Highlighting +---------------------------------------- */ +.sourcenum { + color: gray; + font-family: Monaco, 'Courier New', monospace; + font-size: 1.25em; + font-weight: bold; + line-height: 1.20em; + text-align: right; + padding: 0; +} + +.rtl .sourcenum { + text-align: left; +} + +.source { + font-family: Monaco, 'Courier New', monospace; + font-size: 1.25em; + line-height: 1.20em; + padding: 0; +} + +.syntaxbg { + color: #FFFFFF; +} + +.syntaxcomment { + color: #FF8000; +} + +.syntaxdefault { + color: #0000BB; +} + +.syntaxhtml { + color: #000000; +} + +.syntaxkeyword { + color: #007700; +} + +.syntaxstring { + color: #DD0000; +} + +/* Permission interface +---------------------------------------- */ + +.column1, .column2 { + width: 48%; + float: left; +} + +.ltr .column2, .rtl .column1 { + float: right; +} + +fieldset.permissions legend { + text-transform: none; +} + +fieldset.permissions legend input{ + height: 1.1em; +} + +/* Permission sections */ +fieldset.permissions .permissions-simple { + text-align: left; + padding-top: 3px; +} + +.rtl fieldset.permissions .permissions-simple { + text-align: right; +} + +fieldset.permissions .permissions-advanced { + padding: 10px 0 0 5px; + vertical-align: top; + clear: right; +} + +.rtl fieldset.permissions .permissions-advanced { + padding: 10px 5px 0 0; + clear: left; +} + +fieldset.permissions .permissions-switch { + float: right; +} + +.rtl fieldset.permissions .permissions-switch { + float: left; +} + +fieldset.permissions .padding { +} + +.permissions-switch { + margin-top: -6px; + font-size: .9em; +} + +.permissions-switch a { + text-decoration: underline; +} + +.permissions-reset { + padding-bottom: 10px; +} + +.permissions-reset a { + font-size: .85em; +} + +/* Tabbed menu */ +.permissions-category { + line-height: normal; + margin: 0 0 -1px 7px; + min-width: 570px; + font-size: 0.85em; +} + +.rtl .permissions-category { + margin: 0 7px -1px 0; +} + +.permissions-category ul { + margin: 0; + padding: 0; + list-style: none; +} + +.permissions-category li { + display: inline; + margin: 0; + padding: 0; + font-size: 1em; + font-weight: bold; +} + +.permissions-category a { + float: left; + background: url("../images/bg_tabs_alt1.gif") no-repeat 0% -35px; + margin: 0 1px 0 0; + padding: 0 0 0 6px; + text-decoration: none; + position: relative; +} + +.rtl .permissions-category a { + float: right; +} + +.permissions-category a span.tabbg { + float: left; + display: block; + background: url("../images/bg_tabs_alt2.gif") no-repeat 100% -35px; + padding: 7px 12px 6px 6px; + color: #536482; + white-space: nowrap; +} + +.rtl .permissions-category a span.tabbg { + float: right; +} + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +.permissions-category a span.tabbg, .rtl .permissions-category a span.tabbg { float: none;} +/* End hack */ + +.permissions-category a:hover span.tabbg { + color: #DD6900; +} + +.permissions-category .activetab a { + background-position: 0 0; +} + +.permissions-category .activetab a span.tabbg { + background-position: 100% 0; + padding-bottom: 7px; + color: #333333; +} + +.permissions-category a:hover { + background-position: 0 -70px; +} + +.permissions-category a:hover span.tabbg { + background-position: 100% -70px; +} + +.permissions-category .activetab a:hover span.tabbg { + color: #333333; + background-position: 100% 0; +} + +.permissions-category .activetab a:hover { + background-position: 0 0; +} + +.permissions-category a span.colour { + border: 1px solid #536482; + display: block; + float: left; + width: 10px; + height: 10px; + margin: 0 5px 0 0; +} + +/* Most browsers will have to live with a left aligned icon in RTL mode, as (currently) only Firefox 3.0 Alpha 3 renders it correctly without destroying it +.rtl .permissions-category a span.colour { + float: right; + margin: 0 0 0 5px; +} +*/ + +.permissions-category .activetab span.colour { + border-color: #333333; +} + +.permissions-category a:hover span.colour { + border-color: #DD6900; +} + +.permissions-category .activetab a:hover span.colour { + border-color: #333333; +} + +/* Permission preset colours */ +.permissions-preset-yes span.colour, +.yes { + background-color: #86F786; +} + +.permissions-preset-custom span.colour { + background-color: #B2BBDD; +} + +.permissions-preset-never span.colour { + background-color: #DD0000; +} + +.permissions-preset-no span.colour, +.never { + background-color: #EFB0B2; +} + +/* Permission panel +---------------------------------------- */ +.permissions-panel { + float: left; + background-color: #CADCEB; + width: 100%; + border-radius: 5px; + overflow: hidden; + padding: 5px 0; +} + +.rtl .permissions-panel { + float: right; +} + +/* Permission table +---------------------------------------- */ +.permissions-panel .tablewrap { + margin: 0 10px; +} + +.permissions-panel table { + width: 100%; +} + +.permissions-panel th { + text-transform: none; +} + +.permissions-panel th.value { + text-align: center; +} + +.permissions-panel th.name { + text-align: left; + width: auto; + text-transform: none; +} + +.rtl .permissions-panel th.name { + text-align: right; +} + +.permissions-panel th.permissions-name { + border: none; + color: #536482; + font-weight: normal; +} + +.permissions-panel th.permissions-name a.trace { + display: inline; +} + +.permissions-panel th.row3 { + background-image: none; + background-color: #D1D7DC; + color: #536482; + border: none; +} + +.permissions-panel th.row4 { + background-image: none; + background-color: #E4E8EB; + color: #536482; + border: none; +} + +.permissions-panel th a:link, .permissions-panel th a:hover, .permissions-panel th a:visited { + display: block; + color: #FFFFFF; + text-decoration: underline; +} + +.permissions-panel td.permissions-yes label:hover { + background-color: #86F786; +} + +.permissions-panel td.permissions-no label:hover { + background-color: #EFB0B2; +} + +.permissions-panel td.permissions-never label:hover { + background-color: #DD0000; +} + +.permissions-panel td { + padding: 0; + text-align: center; + width: 10%; +} + +.permissions-panel td label { + display: block; + margin: 0; + padding: 0; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + .column1, .column2 { + float: none !important; + width: auto; + } + + .permissions-simple { + clear: both; + } + + .permissions-simple td, .permissions-simple dd { + width: auto !important; + margin-left: 0 !important; + margin-right: 0 !important; + } + + .permissions-simple dd { + margin-top: 5px; + } + + .permissions-panel .tablewrap { + margin: 0 5px; + } + + .permissions-category { + min-width: 0; + margin: 0 !important; + } + + .permissions-category a, .permissions-category a span.tabbg { + display: block; + float: none !important; + background: transparent none; + } + + .permissions-category a { + background: #d9e5ee; + margin: 5px 0; + padding: 0 !important; + border-radius: 3px; + text-decoration: underline; + } + + .permissions-category .activetab a { + background-color: #dd6900; + color: #fff; + } + + .permissions-category a span.tabbg { + color: inherit !important; + padding-top: 6px !important; + padding-bottom: 6px !important; + } + + .permissions-category .activetab span.colour { + border-color: #fff; + } +} + +/* Avatars gallery +---------------------------------------- */ +#gallery { + display: block; + margin: 0 -5px; + padding: 0; + overflow: hidden; +} + +#gallery li { + display: block; + float: left; + border: 1px solid #ccc; + border-radius: 2px; + background: #fff; + padding: 5px; + margin: 5px; +} + +#gallery li:hover { + background-color: #eee; +} + +#gallery li label { + display: block; + text-align: center; + padding: 0; +} + +/* Dropdown menu +----------------------------------------*/ +.dropdown { + position: absolute; + left: 0; + top: 22px; + z-index: 2; + border: 1px solid transparent; + border-radius: 5px; + padding: 9px 0 0; +} + +.dropdown-up .dropdown { + top: auto; + bottom: 18px; + padding: 0 0 9px; +} + +.dropdown-left .dropdown { + left: auto; + right: 0; +} + +.dropdown .pointer, .dropdown .pointer-inner { + position: absolute; + width: 0; + height: 0; + border-top-width: 0; + border-bottom: 10px solid transparent; + border-left: 10px dashed transparent; + border-right: 10px dashed transparent; + -webkit-transform: rotate(360deg); /* better anti-aliasing in webkit */ + display: block; +} + +.dropdown-up .pointer, .dropdown-up .pointer-inner { + border-bottom-width: 0; + border-top: 10px solid transparent; +} + +.dropdown .pointer { + right: auto; + left: 10px; + top: 0; + z-index: 3; +} + +.dropdown-up .pointer { + bottom: 0; + top: auto; +} + +.dropdown-left .dropdown .pointer { + left: auto; + right: 10px; +} + +.dropdown .pointer-inner { + top: auto; + bottom: -11px; + left: -10px; +} + +.dropdown-up .pointer-inner { + bottom: auto; + top: -11px; +} + +.dropdown .pointer { + border-color: #B9B9B9 transparent; +} + +.dropdown .pointer-inner { + border-color: #FFF transparent; +} + +.dropdown .dropdown-contents { + z-index: 2; + overflow: hidden; + overflow-y: auto; + background: #fff; + border: 1px solid #b9b9b9; + border-radius: 5px; + padding: 5px; + position: relative; + min-width: 40px; + max-height: 200px; + box-shadow: 1px 3px 5px rgba(0, 0, 0, 0.2); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.dropdown-up .dropdown-contents { + box-shadow: 1px 0 5px rgba(0, 0, 0, 0.2); +} + +.dropdown li { + float: none; + margin: 0; + white-space: nowrap; + text-align: left; +} + +.rtl .dropdown li { + text-align: right; +} +.wrap .dropdown li, .dropdown.wrap li { + white-space: normal; +} + +.dropdown li:before, .dropdown li:after { + display: none !important; +} + +.roles-options > .dropdown { + left: auto; + top: 3.2em; + width: 250px; +} + +.rtl .roles-options > .dropdown { + right: auto; +} + +.roles-options { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; + width: 250px; +} + +.roles-options > span { + border: 1px solid #DEDEDE; + border-radius: 3px; + padding: 4px; + width: 250px; + display: none; + background: url('../images/arrow_down.gif') no-repeat 245px .7em; +} + +.rtl .roles-options > span { + background: url('../images/arrow_down.gif') no-repeat 7px .7em; +} + +.roles-options li { + list-style: none; +} + +.roles-highlight { + background-color: #1e90ff; + color: #fff; +} + + +/* Classes for additional tasks +---------------------------------------- */ + +.current-ext { + color: #228822; +} + +.outdated-ext { + color: #BC2A4D; +} + +.phpinfo { + overflow: auto; + width: 99%; + direction: ltr; +} + +.phpinfo td, .phpinfo th, .phpinfo h2, .phpinfo h1 { + text-align: left; +} + +.requirements_not_met { + padding: 5px; + background-color: #BC2A4D; +} + +.requirements_not_met dt label, .requirements_not_met dd p { + color: #FFFFFF; + font-size: 1.4em; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + .responsive-hide { display: none !important; } + .responsive-show { display: block !important; } + .responsive-show-inline { display: inline !important; } + .responsive-show-inline-block { display: inline-block !important; } +} + +.clearfix { + overflow: hidden; +} + +.pagination:after, +#page-header:after, +#page-body:after, +#tabs:after, +#tabs > ul:after, +#tabs li:after, +#acp:after, +#content:after { + content: ''; + clear: both; + display: block; +} + +#progress-bar { + position: relative; + width: 90%; + text-align: center; + height: 25px; + margin: 20px auto; + border: 1px solid #cecece; +} + +#progress-bar #progress-bar-text { + position: absolute; + top: 0; + width: 100%; + color: #000; +} + +#progress-bar #progress-bar-filler { + display: block; + position: relative; + top: 0; + left: 0; + background-color: #3c84ad; + width: 0; + height: 25px; + overflow: hidden; + color: #fff; +} + +#progress-bar p { + line-height: 25px; + font-weight: bold; +} + +.send-stats-row { + margin: 15px 0; +} + +.send-stats-row:before { + display: table; + content: " "; +} + +.send-stats-tile { + position: relative; + padding: 14px; + margin-bottom: 20px; + background-color: #eff0f2; + border-radius: 6px; + box-shadow: rgba(0,0,0,0.3) 1px 1px 5px; +} + +.send-stats-tile h2 { + margin-top: 0; + text-align: center; + padding-bottom: 1em; +} + +.send-stats-tile i { + padding-right: 0.3em; +} + +.icon { + font-family: FontAwesome; + font-style: normal; +} + +.send-stats-data-row { + background: #f9f9f9; + border-radius: 6px; + border: #DEDEDE 1px solid; + padding: 10px; + border-top-width: 0; + border-top-right-radius: 0; + border-top-left-radius: 0; +} + +.send-stats-data-hidden .configlist { + display: none; +} + +.send-stats-data-only-row { + border-radius: 6px !important; + border-bottom-width: 1px !important; +} + +.send-stats-data-hidden { + padding: 0; + border: none; +} + +.send-stats-row > .send-stats-data-row:first-child { + background-color: #d9edf7; + border-bottom-width: 0; + border-top-right-radius: 6px; + border-top-left-radius: 6px; + border-top-width: 1px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} + +.send-stats-settings dt, .send-stats-settings dd { + min-width: 25px; +} + +.send-stats-settings dd { + line-height: 1.5em; +} + +.send-stats-settings input { + display: none; +} + +.send-stats-settings input[type=checkbox] + label:before { + content: "\f096"; + font-family: FontAwesome; + font-size: 1.5em; +} + +.send-stats-settings input[type=checkbox]:checked + label:before { + content: "\f14a"; + color: #3c763d; +} + +.send-stats-data-row a:hover span { + text-decoration: underline; +} + +.send-stats-data-row a { + text-decoration: none; + cursor: default; +} + +.send-stats-data-row i { + padding-left: 6px; +} + +.configlist { + word-wrap: break-word; + word-break: break-all; +} + +/* stylelint-disable declaration-property-unit-whitelist */ +.emoji { + min-height: 18px; + min-width: 18px; + height: 1em; + width: 1em; +} +/* stylelint-enable declaration-property-unit-whitelist */ diff --git a/install/update/new/adm/style/admin.js b/install/update/new/adm/style/admin.js new file mode 100644 index 0000000..5fdd073 --- /dev/null +++ b/install/update/new/adm/style/admin.js @@ -0,0 +1,316 @@ +/** +* phpBB3 ACP functions +*/ + +/** +* Parse document block +*/ +function parse_document(container) +{ + var test = document.createElement('div'), + oldBrowser = (typeof test.style.borderRadius == 'undefined'); + + delete test; + + /** + * Navigation + */ + container.find('#menu').each(function() { + var menu = $(this), + blocks = menu.children('.menu-block'); + + if (!blocks.length) { + return; + } + + // Set onclick event + blocks.children('a.header').click(function() { + var parent = $(this).parent(); + if (!parent.hasClass('active')) { + parent.siblings().removeClass('active'); + } + parent.toggleClass('active'); + }); + + // Set active menu + menu.find('#activemenu').parents('.menu-block').addClass('active'); + + // Check if there is active menu + if (!blocks.filter('.active').length) { + blocks.filter(':first').addClass('active'); + } + }); + + /** + * Responsive tables + */ + container.find('table').not('.not-responsive').each(function() { + var $this = $(this), + th = $this.find('thead > tr > th'), + columns = th.length, + headers = [], + totalHeaders = 0, + i, headersLength; + + // Find columns + $this.find('colgroup:first').children().each(function(i) { + var column = $(this); + $this.find('td:nth-child(' + (i + 1) + ')').addClass(column.prop('className')); + }); + + // Styles table + if ($this.hasClass('styles')) { + $this.find('td:first-child[style]').each(function() { + var style = $(this).attr('style'); + if (style.length) { + $(this).parent('tr').attr('style', style.toLowerCase().replace('padding', 'margin')).addClass('responsive-style-row'); + } + }); + } + + // Find each header + if (!$this.data('no-responsive-header')) + { + th.each(function(column) { + var cell = $(this), + colspan = parseInt(cell.attr('colspan')), + dfn = cell.attr('data-dfn'), + text = dfn ? dfn : $.trim(cell.text()); + + if (text == ' ') text = ''; + colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; + + for (i=0; i + $this.addClass('responsive'); + + if (totalHeaders < 2) { + $this.addClass('show-header'); + return; + } + + $this.find('tbody > tr').each(function() { + var row = $(this), + cells = row.children('td'), + column = 0; + + if (cells.length == 1) { + row.addClass('big-column'); + return; + } + + cells.each(function() { + var cell = $(this), + colspan = parseInt(cell.attr('colspan')), + text = $.trim(cell.text()); + + if (headersLength <= column) { + return; + } + + if ((text.length && text !== '-') || cell.children().length) { + if (headers[column] != '') { + cell.prepend('' + headers[column] + ''); + } + } + else { + cell.addClass('empty'); + } + + colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; + column += colspan; + }); + }); + + // Remove in disabled extensions list + $this.find('tr.ext_disabled > .empty:nth-child(2) + .empty').siblings(':first-child').children('dfn').remove(); + }); + + /** + * Hide empty responsive tables + */ + container.find('table.responsive > tbody').each(function() { + var items = $(this).children('tr'); + if (items.length == 0) + { + $(this).parent('table:first').addClass('responsive-hide'); + } + }); + + /** + * Fieldsets with empty + */ + container.find('fieldset dt > span:last-child').each(function() { + var $this = $(this); + if ($this.html() == ' ') { + $this.addClass('responsive-hide'); + } + + }); + + /** + * Responsive tabs + */ + container.find('#tabs').not('[data-skip-responsive]').each(function() { + var $this = $(this), + $body = $('body'), + ul = $this.children(), + tabs = ul.children().not('[data-skip-responsive]'), + links = tabs.children('a'), + item = ul.append('').find('li.responsive-tab'), + menu = item.find('.dropdown-contents'), + maxHeight = 0, + lastWidth = false, + responsive = false; + + links.each(function() { + var link = $(this); + maxHeight = Math.max(maxHeight, Math.max(link.outerHeight(true), link.parent().outerHeight(true))); + }) + + function check() { + var width = $body.width(), + height = $this.height(); + + if (arguments.length == 0 && (!responsive || width <= lastWidth) && height <= maxHeight) { + return; + } + + tabs.show(); + item.hide(); + + lastWidth = width; + height = $this.height(); + if (height <= maxHeight) { + responsive = false; + if (item.hasClass('dropdown-visible')) { + phpbb.toggleDropdown.call(item.find('a.responsive-tab-link').get(0)); + } + return; + } + + responsive = true; + item.show(); + menu.html(''); + + var availableTabs = tabs.filter(':not(.activetab, .responsive-tab)'), + total = availableTabs.length, + i, tab; + + for (i = total - 1; i >= 0; i --) { + tab = availableTabs.eq(i); + menu.prepend(tab.clone(true).removeClass('tab')); + tab.hide(); + if ($this.height() <= maxHeight) { + menu.find('a').click(function() { check(true); }); + return; + } + } + menu.find('a').click(function() { check(true); }); + } + + phpbb.registerDropdown(item.find('a.responsive-tab-link'), item.find('.dropdown'), {visibleClass: 'activetab', verticalDirection: 'down'}); + + check(true); + $(window).resize(check); + }); +} + +/** + * Extension actions helper functions + */ +function move_to_enabled(element) +{ + var disabled_header = document.querySelector('#ext_disabled_header'); + disabled_header.parentNode.insertBefore(element, disabled_header); + element.classList.remove('ext_disabled'); + element.classList.add('ext_enabled'); +} +function move_to_disabled(element) +{ + var table_body = document.querySelector('#ext_disabled_header').parentNode; + table_body.appendChild(element); + element.classList.remove('ext_enabled'); + element.classList.add('ext_disabled'); +} +function set_actions(container, actions) { + container.innerHTML = ''; + for (var i = 0; i < actions.length; i++) { + var a = document.createElement('a'); + a.href = actions[i].U_ACTION.split('&').join('&'); // replace all occurances + a.title = actions[i].L_ACTION_EXPLAIN; + if (actions[i].COLOR) { + a.style = actions[i].COLOR; + } + a.innerHTML = actions[i].L_ACTION; + // ajaxify this action as well + phpbb.ajaxify({ + selector: a, + refresh: true, + callback: actions[i].ACTION_AJAX + }); + + container.appendChild(a); + + if (i < actions.length - 1) { + container.innerHTML += ' | '; + } + } +} +function show_enabled_header() { + document.querySelector('#ext_enabled_header').classList.remove('hidden'); +} +function show_disabled_header() { + document.querySelector('#ext_disabled_header').classList.remove('hidden'); +} +function hide_disabled_header_if_empty() { + if (!document.querySelector('.ext_disabled')) { + document.querySelector('#ext_disabled_header').classList.add('hidden'); + } +} +function hide_enabled_header_if_empty() { + if (!document.querySelector('.ext_enabled')) { + document.querySelector('#ext_enabled_header').classList.add('hidden'); + } +} + +/** +* Run onload functions +*/ +(function($) { + $(document).ready(function() { + // Swap .nojs and .hasjs + $('body.nojs').toggleClass('nojs hasjs'); + + // Focus forms + $('form[data-focus]:first').each(function() { + $('#' + this.getAttribute('data-focus')).focus(); + }); + + parse_document($('body')); + + $('#questionnaire-form').css('display', 'none'); + var $triggerConfiglist = $('#trigger-configlist'); + + $triggerConfiglist.on('click', function () { + var $configlist = $('#configlist'); + $configlist.closest('.send-stats-data-row').toggleClass('send-stats-data-hidden'); + $configlist.closest('.send-stats-row').find('.send-stats-data-row:first-child').toggleClass('send-stats-data-only-row'); + $(this).find('i').toggleClass('fa-angle-down fa-angle-up'); + }); + + $('#configlist').closest('.send-stats-data-row').addClass('send-stats-data-hidden'); + }); +})(jQuery); diff --git a/install/update/new/adm/style/ajax.js b/install/update/new/adm/style/ajax.js new file mode 100644 index 0000000..39b63e4 --- /dev/null +++ b/install/update/new/adm/style/ajax.js @@ -0,0 +1,360 @@ +/* global phpbb, statsData */ + +(function($) { // Avoid conflicts with other libraries + +'use strict'; + + +phpbb.prepareSendStats = function () { + var $form = $('#acp_help_phpbb'); + var $dark = $('#darkenwrapper'); + var $loadingIndicator; + + $form.on('submit', function (event) { + var $this = $(this), + currentTime = Math.floor(new Date().getTime() / 1000), + statsTime = parseInt($this.find('input[name=help_send_statistics_time]').val(), 10); + + event.preventDefault(); + $this.unbind('submit'); + + // Skip ajax request if form is submitted too early or send stats + // checkbox is not checked + if (!$this.find('input[name=help_send_statistics]').is(':checked') || + statsTime > currentTime) { + $form.find('input[type=submit]').click(); + setTimeout(function () { + $form.find('input[type=submit]').click(); + }, 300); + return; + } + + /** + * Handler for AJAX errors + */ + function errorHandler(jqXHR, textStatus, errorThrown) { + if (typeof console !== 'undefined' && console.log) { + console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown); + } + phpbb.clearLoadingTimeout(); + var errorText = ''; + + if (typeof errorThrown === 'string' && errorThrown.length > 0) { + errorText = errorThrown; + } else { + errorText = $dark.attr('data-ajax-error-text-' + textStatus); + if (typeof errorText !== 'string' || !errorText.length) { + errorText = $dark.attr('data-ajax-error-text'); + } + } + phpbb.alert($dark.attr('data-ajax-error-title'), errorText); + } + + /** + * This is a private function used to handle the callbacks, refreshes + * and alert. It calls the callback, refreshes the page if necessary, and + * displays an alert to the user and removes it after an amount of time. + * + * It cannot be called from outside this function, and is purely here to + * avoid repetition of code. + * + * @param {object} res The object sent back by the server. + */ + function returnHandler(res) { + phpbb.clearLoadingTimeout(); + + // If a confirmation is not required, display an alert and call the + // callbacks. + $dark.fadeOut(phpbb.alertTime); + + if ($loadingIndicator) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + + var $sendStatisticsSuccess = $('', { + type: 'hidden', + name: 'send_statistics_response', + value: JSON.stringify(res) + }); + $sendStatisticsSuccess.appendTo('p.submit-buttons'); + + // Finish actual form submission + $form.find('input[type=submit]').click(); + } + + $loadingIndicator = phpbb.loadingIndicator(); + + $.ajax({ + url: $this.attr('data-ajax-action').replace('&', '&'), + type: 'POST', + data: statsData, + success: returnHandler, + error: errorHandler, + cache: false + }).always(function() { + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + }); + }); +}; + +/** + * The following callbacks are for reording items. row_down + * is triggered when an item is moved down, and row_up is triggered when + * an item is moved up. It moves the row up or down, and deactivates / + * activates any up / down icons that require it (the ones at the top or bottom). + */ +phpbb.addAjaxCallback('row_down', function(res) { + if (typeof res.success === 'undefined' || !res.success) { + return; + } + + var $firstTr = $(this).parents('tr'), + $secondTr = $firstTr.next(); + + $firstTr.insertAfter($secondTr); +}); + +phpbb.addAjaxCallback('row_up', function(res) { + if (typeof res.success === 'undefined' || !res.success) { + return; + } + + var $secondTr = $(this).parents('tr'), + $firstTr = $secondTr.prev(); + + $secondTr.insertBefore($firstTr); +}); + +/** + * This callback replaces activate links with deactivate links and vice versa. + * It does this by replacing the text, and replacing all instances of "activate" + * in the href with "deactivate", and vice versa. + */ +phpbb.addAjaxCallback('activate_deactivate', function(res) { + var $this = $(this), + newHref = $this.attr('href'); + + $this.text(res.text); + + if (newHref.indexOf('deactivate') !== -1) { + newHref = newHref.replace('deactivate', 'activate'); + } else { + newHref = newHref.replace('activate', 'deactivate'); + } + + $this.attr('href', newHref); +}); + +/** + * 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(res) { + if (res.SUCCESS !== false) { + $(this).parents('tr').remove(); + } +}); + +/** + * Callbacks for extension actions + */ +phpbb.addAjaxCallback('ext_enable', function(res) { + if (res.EXT_ENABLE_SUCCESS) { + move_to_enabled(this.parentNode.parentNode); + set_actions(this.parentNode, res.ACTIONS); + show_enabled_header(); + hide_disabled_header_if_empty(); + } +}); +phpbb.addAjaxCallback('ext_delete_data', function(res) { + if (res.EXT_DELETE_DATA_SUCCESS) { + move_to_disabled(this.parentNode.parentNode); + set_actions(this.parentNode, res.ACTIONS); + show_disabled_header(); + hide_enabled_header_if_empty(); + } +}); +phpbb.addAjaxCallback('ext_disable', function(res) { + if (res.EXT_DISABLE_SUCCESS) { + move_to_disabled(this.parentNode.parentNode); + set_actions(this.parentNode, res.ACTIONS); + show_disabled_header(); + hide_enabled_header_if_empty(); + } +}); + +/** + * Handler for submitting permissions form in chunks + * This call will submit permissions forms in chunks of 5 fieldsets. + */ +function submitPermissions() { + var $form = $('form#set-permissions'), + fieldsetList = $form.find('fieldset[id^=perm]'), + formDataSets = [], + dataSetIndex = 0, + $submitAllButton = $form.find('input[type=submit][name^=action]')[0], + $submitButton = $form.find('input[type=submit][data-clicked=true]')[0]; + + // Set proper start values for handling refresh of page + var permissionSubmitSize = 0, + permissionRequestCount = 0, + forumIds = [], + permissionSubmitFailed = false; + + if ($submitAllButton !== $submitButton) { + fieldsetList = $form.find('fieldset#' + $submitButton.closest('fieldset.permissions').id); + } + + $.each(fieldsetList, function (key, value) { + dataSetIndex = Math.floor(key / 5); + var $fieldset = $('fieldset#' + value.id); + if (key % 5 === 0) { + formDataSets[dataSetIndex] = $fieldset.find('select:visible, input:not([data-name])').serialize(); + } else { + formDataSets[dataSetIndex] += '&' + $fieldset.find('select:visible, input:not([data-name])').serialize(); + } + + // Find proper role value + var roleInput = $fieldset.find('input[name^=role][data-name]'); + if (roleInput.val()) { + formDataSets[dataSetIndex] += '&' + roleInput.attr('name') + '=' + roleInput.val(); + } else { + formDataSets[dataSetIndex] += '&' + roleInput.attr('name') + '=' + + $fieldset.find('select[name="' + roleInput.attr('name') + '"]').val(); + } + }); + + permissionSubmitSize = formDataSets.length; + + // Add each forum ID to forum ID list to preserve selected forums + $.each($form.find('input[type=hidden][name^=forum_id]'), function (key, value) { + if (value.name.match(/^forum_id\[([0-9]+)\]$/)) { + forumIds.push(value.value); + } + }); + + /** + * Handler for submitted permissions form chunk + * + * @param {object} res Object returned by AJAX call + */ + function handlePermissionReturn(res) { + permissionRequestCount++; + var $dark = $('#darkenwrapper'); + + if (res.S_USER_WARNING) { + phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + permissionSubmitFailed = true; + } else if (!permissionSubmitFailed && res.S_USER_NOTICE) { + // Display success message at the end of submitting the form + if (permissionRequestCount >= permissionSubmitSize) { + var $alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + var $alertBoxLink = $alert.find('p.alert_text > a'); + + // Create form to submit instead of normal "Back to previous page" link + if ($alertBoxLink) { + // Remove forum_id[] from URL + $alertBoxLink.attr('href', $alertBoxLink.attr('href').replace(/(&forum_id\[\]=[0-9]+)/g, '')); + var previousPageForm = '
'; + $.each(forumIds, function (key, value) { + previousPageForm += ''; + }); + previousPageForm += '
'; + + $alertBoxLink.on('click', function (e) { + var $previousPageForm = $(previousPageForm); + $('body').append($previousPageForm); + e.preventDefault(); + $previousPageForm.submit(); + }); + } + + // Do not allow closing alert + $dark.off('click'); + $alert.find('.alert_close').hide(); + + if (typeof res.REFRESH_DATA !== 'undefined') { + setTimeout(function () { + // Create forum to submit using POST. This will prevent + // exceeding the maximum length of URLs + var form = '
'; + $.each(forumIds, function (key, value) { + form += ''; + }); + form += '
'; + $form = $(form); + $('body').append($form); + + // Hide the alert even if we refresh the page, in case the user + // presses the back button. + $dark.fadeOut(phpbb.alertTime, function () { + if (typeof $alert !== 'undefined') { + $alert.hide(); + } + }); + + // Submit form + $form.submit(); + }, res.REFRESH_DATA.time * 1000); // Server specifies time in seconds + } + } + } + } + + // Create AJAX request for each form data set + $.each(formDataSets, function (key, formData) { + $.ajax({ + url: $form.action, + type: 'POST', + data: formData + '&' + $submitButton.name + '=' + encodeURIComponent($submitButton.value) + + '&creation_time=' + $form.find('input[type=hidden][name=creation_time]')[0].value + + '&form_token=' + $form.find('input[type=hidden][name=form_token]')[0].value + + '&' + $form.children('input[type=hidden]').serialize() + + '&' + $form.find('input[type=checkbox][name^=inherit]').serialize(), + success: handlePermissionReturn, + error: handlePermissionReturn + }); + }); +} + +$('[data-ajax]').each(function() { + var $this = $(this), + ajax = $this.attr('data-ajax'); + + if (ajax !== 'false') { + var fn = (ajax !== 'true') ? ajax : null; + phpbb.ajaxify({ + selector: this, + refresh: $this.attr('data-refresh') !== undefined, + callback: fn + }); + } +}); + +/** +* Automatically resize textarea +*/ +$(function() { + phpbb.resizeTextArea($('textarea:not(.no-auto-resize)'), {minHeight: 75}); + + var $setPermissionsForm = $('form#set-permissions'); + if ($setPermissionsForm.length) { + $setPermissionsForm.on('submit', function (e) { + submitPermissions(); + e.preventDefault(); + }); + $setPermissionsForm.find('input[type=submit]').click(function() { + $('input[type=submit]', $(this).parents($('form#set-permissions'))).removeAttr('data-clicked'); + $(this).attr('data-clicked', true); + }); + } + + if ($('#acp_help_phpbb')) { + phpbb.prepareSendStats(); + } +}); + + +})(jQuery); // Avoid conflicts with other libraries diff --git a/install/update/new/adm/style/captcha_recaptcha.html b/install/update/new/adm/style/captcha_recaptcha.html new file mode 100644 index 0000000..563bd98 --- /dev/null +++ b/install/update/new/adm/style/captcha_recaptcha.html @@ -0,0 +1,15 @@ + +
+
+ + + {L_RECAPTCHA_INVISIBLE} + +
+
+
+ +{L_RECAPTCHA_NOT_AVAILABLE} + diff --git a/install/update/new/adm/style/installer_convert.html b/install/update/new/adm/style/installer_convert.html new file mode 100644 index 0000000..aa16542 --- /dev/null +++ b/install/update/new/adm/style/installer_convert.html @@ -0,0 +1,87 @@ + +

{TITLE}

+ +
+

{ERROR_TITLE}

+

{ERROR_MSG}

+
+ + +
+ + {errors.TITLE} +

{errors.DESCRIPTION}

+ +
+ +

{BODY}

+{CONTENT} + +

onclick="return false;">{L_SUBMIT}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_AVAILABLE_CONVERTORS}
{L_SOFTWARE}{L_VERSION}{L_AUTHOR}{L_CONVERT_OPTIONS}
{convertors.SOFTWARE}{convertors.VERSION}{convertors.AUTHOR}{L_CONVERT}
{L_NO_CONVERTORS}---
+ + +
+ + + + +
+ +
+ + {checks.LEGEND} +

{checks.LEGEND_EXPLAIN}

+ + +
+

{checks.TITLE_EXPLAIN}
+
{checks.RESULT}
+
+ + + +
+ + + diff --git a/install/update/new/adm/style/installer_footer.html b/install/update/new/adm/style/installer_footer.html new file mode 100644 index 0000000..81a85d1 --- /dev/null +++ b/install/update/new/adm/style/installer_footer.html @@ -0,0 +1,32 @@ +
+
+
+
+ + + + + + + + + + + +{$SCRIPTS} + + + diff --git a/install/update/new/adm/style/installer_form.html b/install/update/new/adm/style/installer_form.html new file mode 100644 index 0000000..592d361 --- /dev/null +++ b/install/update/new/adm/style/installer_form.html @@ -0,0 +1,57 @@ +

{FORM_TITLE}

+
+ + +
+ + + + + +
+ +
+ + {options.LEGEND} + +
+

{options.TITLE_EXPLAIN}
+
+ + + + + + + + + + + + + + + checked /> {options.OPTIONS.label} + + +
+
+ + + +
+ + + +
+ {L_SUBMIT} + + disabled="disabled" /> + +
+ +
diff --git a/install/update/new/adm/style/installer_header.html b/install/update/new/adm/style/installer_header.html new file mode 100644 index 0000000..704db9e --- /dev/null +++ b/install/update/new/adm/style/installer_header.html @@ -0,0 +1,58 @@ + + + + + + + {META} + {PAGE_TITLE} + + + + + +
+ + +
+
+ +
+ +
+
+ + +
+
diff --git a/install/update/new/adm/style/installer_install.html b/install/update/new/adm/style/installer_install.html new file mode 100644 index 0000000..53a91f2 --- /dev/null +++ b/install/update/new/adm/style/installer_install.html @@ -0,0 +1,13 @@ + +

{TITLE}

+

{CONTENT}

+ +
+
+ {L_SUBMIT} + +
+
+ + + diff --git a/install/update/new/adm/style/installer_main.html b/install/update/new/adm/style/installer_main.html new file mode 100644 index 0000000..f14fe4d --- /dev/null +++ b/install/update/new/adm/style/installer_main.html @@ -0,0 +1,6 @@ + + +

{TITLE}

+

{BODY}

+ + diff --git a/install/update/new/adm/style/installer_update.html b/install/update/new/adm/style/installer_update.html new file mode 100644 index 0000000..48cc07f --- /dev/null +++ b/install/update/new/adm/style/installer_update.html @@ -0,0 +1,13 @@ + +

{TITLE}

+

{CONTENT}

+ +
+
+ {L_SUBMIT} + +
+
+ + + diff --git a/install/update/new/adm/style/installer_update_file_status.html b/install/update/new/adm/style/installer_update_file_status.html new file mode 100644 index 0000000..a27bfa6 --- /dev/null +++ b/install/update/new/adm/style/installer_update_file_status.html @@ -0,0 +1,80 @@ + +

{L_FILES_DELETED}

+ +

{L_FILES_DELETED_EXPLAIN}

+ +
+ {L_STATUS_DELETED} + +
+
{deleted.DIR_PART}{deleted.FILE_PART}
+
+ +
+ + + + +

{L_FILES_CONFLICT}

+ +

{L_FILES_CONFLICT_EXPLAIN}

+ +
+ {L_STATUS_CONFLICT} + +
+
{conflict.DIR_PART}{conflict.FILE_PART}
+
+ +
+ + + + +

{L_FILES_MODIFIED}

+ +

{L_FILES_MODIFIED_EXPLAIN}

+ +
+ {L_STATUS_MODIFIED} + +
+
{modified.DIR_PART}{modified.FILE_PART}
+
+ +
+ + + + +

{L_FILES_NEW}

+ +

{L_FILES_NEW_EXPLAIN}

+ + + + + + +

{L_FILES_NOT_MODIFIED}

+ +

{L_FILES_NOT_MODIFIED_EXPLAIN}

+ + + + diff --git a/install/update/new/adm/style/overall_footer.html b/install/update/new/adm/style/overall_footer.html new file mode 100644 index 0000000..7a5b620 --- /dev/null +++ b/install/update/new/adm/style/overall_footer.html @@ -0,0 +1,46 @@ +
+
+
+
+
+ + +
+ + + + + + + + +{$SCRIPTS} + + + diff --git a/install/update/new/adm/style/overall_header.html b/install/update/new/adm/style/overall_header.html new file mode 100644 index 0000000..fa361d6 --- /dev/null +++ b/install/update/new/adm/style/overall_header.html @@ -0,0 +1,157 @@ + + + + + + +{META} +{PAGE_TITLE} + + + + + + + + +{$STYLESHEETS} + + + + + + + + + +
+ + +
+
+ +
+ +
+
+ + + +
+ +
+
+ {% if CONTAINER_EXCEPTION !== false %} +
+

{{ lang('CONTAINER_EXCEPTION') }}


+

{{ lang('EXCEPTION') }}{{ lang('COLON') }} {{ CONTAINER_EXCEPTION.getMessage() }}

+
{{ CONTAINER_EXCEPTION.getTraceAsString() }}
+
+ {% endif %} diff --git a/install/update/new/adm/style/permission_forum_copy.html b/install/update/new/adm/style/permission_forum_copy.html new file mode 100644 index 0000000..0560648 --- /dev/null +++ b/install/update/new/adm/style/permission_forum_copy.html @@ -0,0 +1,40 @@ + + + + +

{L_ACP_FORUM_PERMISSIONS_COPY}

+ +

{L_ACP_FORUM_PERMISSIONS_COPY_EXPLAIN}

+ +
+ +
+ {L_LOOK_UP_FORUM} + +
+

{L_COPY_PERMISSIONS_FORUM_FROM_EXPLAIN}
+
+
+
+ +
+ {L_LOOK_UP_FORUM} +

{L_LOOK_UP_FORUMS_EXPLAIN}

+ +
+

{L_COPY_PERMISSIONS_FORUM_TO_EXPLAIN}
+
+
+
+ +
+ {L_SUBMIT} +   + + {S_HIDDEN_FIELDS} + {S_FORM_TOKEN} +
+ +
+ + diff --git a/install/update/new/adm/style/permission_mask.html b/install/update/new/adm/style/permission_mask.html new file mode 100644 index 0000000..26aa5e0 --- /dev/null +++ b/install/update/new/adm/style/permission_mask.html @@ -0,0 +1,152 @@ + + + + + +
+

{p_mask.NAME} [{p_mask.L_ACL_TYPE}]

+ + +
+
+ + + + + + {p_mask.f_mask.PADDING}{p_mask.f_mask.PADDING}{p_mask.f_mask.NAME} + + + +
+
+ {% if p_mask.f_mask.role_options %} +
+ +
+ {% else %} +
{L_NO_ROLE_AVAILABLE}
+ {% endif %} +
+ + + + + +
+ + + diff --git a/install/update/new/adm/style/permissions.js b/install/update/new/adm/style/permissions.js new file mode 100644 index 0000000..af8e21a --- /dev/null +++ b/install/update/new/adm/style/permissions.js @@ -0,0 +1,304 @@ +/** +* Hide and show all checkboxes +* status = true (show boxes), false (hide boxes) +*/ +function display_checkboxes(status) { + var form = document.getElementById('set-permissions'); + var cb = document.getElementsByTagName('input'); + var display; + + //show + if (status) { + display = 'inline'; + } + //hide + else { + display = 'none'; + } + + for (var i = 0; i < cb.length; i++ ) { + if (cb[i].className === 'permissions-checkbox') { + cb[i].style.display = display; + } + } +} + +/** +* Change opacity of element +* e = element +* value = 0 (hidden) till 10 (fully visible) +*/ +function set_opacity(e, value) { + e.style.opacity = value/10; + + //IE opacity currently turned off, because of its astronomical stupidity + //e.style.filter = 'alpha(opacity=' + value*10 + ')'; +} + +/** +* Reset the opacity and checkboxes +* block_id = id of the element that needs to be toggled +*/ +function toggle_opacity(block_id) { + var cb = document.getElementById('checkbox' + block_id); + var fs = document.getElementById('perm' + block_id); + + if (cb.checked) { + set_opacity(fs, 5); + } else { + set_opacity(fs, 10); + } +} + +/** +* Reset the opacity and checkboxes +* value = 0 (checked) and 1 (unchecked) +* except_id = id of the element not to hide +*/ +function reset_opacity(status, except_id) { + var perm = document.getElementById('set-permissions'); + var fs = perm.getElementsByTagName('fieldset'); + var opacity = 5; + + if (status) { + opacity = 10; + } + + for (var i = 0; i < fs.length; i++ ) { + if (fs[i].className !== 'quick') { + set_opacity(fs[i], opacity); + } + } + + if (typeof(except_id) !== 'undefined') { + set_opacity(document.getElementById('perm' + except_id), 10); + } + + //reset checkboxes too + marklist('set-permissions', 'inherit', !status); +} + +/** +* Check whether we have a full radiobutton row of true +* index = offset for the row of inputs (0 == first row, 1 == second, 2 == third), +* rb = array of radiobuttons +*/ +function get_radio_status(index, rb) { + for (var i = index; i < rb.length; i = i + 3 ) { + if (rb[i].checked !== true) { + if (i > index) { + //at least one is true, but not all (custom) + return 2; + } + //first one is not true + return 0; + } + } + + // all radiobuttons true + return 1; +} + +/** +* Set tab colours +* id = panel the tab needs to be set for, +* init = initialising on open, +* quick = If no calculation needed, this contains the colour +*/ +function set_colours(id, init, quick) { + var table = document.getElementById('table' + id); + var tab = document.getElementById('tab' + id); + + if (typeof(quick) !== 'undefined') { + tab.className = 'permissions-preset-' + quick + ' activetab'; + return; + } + + var rb = table.getElementsByTagName('input'); + var colour = 'custom'; + + var status = get_radio_status(0, rb); + + if (status === 1) { + colour = 'yes'; + } else if (status === 0) { + // We move on to No + status = get_radio_status(1, rb); + + if (status === 1) { + colour = 'no'; + } else if (status === 0) { + // We move on to Never + status = get_radio_status(2, rb); + + if (status === 1) { + colour = 'never'; + } + } + } + + if (init) { + tab.className = 'permissions-preset-' + colour; + } else { + tab.className = 'permissions-preset-' + colour + ' activetab'; + } +} + +/** +* Initialise advanced tab colours on first load +* block_id = block that is opened +*/ +function init_colours(block_id) { + var block = document.getElementById('advanced' + block_id); + var panels = block.getElementsByTagName('div'); + var tab = document.getElementById('tab' + id); + + for (var i = 0; i < panels.length; i++) { + if (panels[i].className === 'permissions-panel') { + set_colours(panels[i].id.replace(/options/, ''), true); + } + } + + tab.className = tab.className + ' activetab'; +} + +/** +* Show/hide option panels +* value = suffix for ID to show +* adv = we are opening advanced permissions +* view = called from view permissions +*/ +function swap_options(pmask, fmask, cat, adv, view) { + id = pmask + fmask + cat; + active_option = active_pmask + active_fmask + active_cat; + + var old_tab = document.getElementById('tab' + active_option); + var new_tab = document.getElementById('tab' + id); + var adv_block = document.getElementById('advanced' + pmask + fmask); + + if (adv_block.style.display === 'block' && adv === true) { + phpbb.toggleDisplay('advanced' + pmask + fmask, -1); + reset_opacity(1); + display_checkboxes(false); + return; + } + + // no need to set anything if we are clicking on the same tab again + if (new_tab === old_tab && !adv) { + return; + } + + // init colours + if (adv && (pmask + fmask) !== (active_pmask + active_fmask)) { + init_colours(pmask + fmask); + display_checkboxes(true); + reset_opacity(1); + } else if (adv) { + //Checkbox might have been clicked, but we need full visibility + display_checkboxes(true); + reset_opacity(1); + } + + // set active tab + old_tab.className = old_tab.className.replace(/\ activetab/g, ''); + new_tab.className = new_tab.className + ' activetab'; + + if (id === active_option && adv !== true) { + return; + } + + phpbb.toggleDisplay('options' + active_option, -1); + + //hiding and showing the checkbox + if (document.getElementById('checkbox' + active_pmask + active_fmask)) { + phpbb.toggleDisplay('checkbox' + pmask + fmask, -1); + + if ((pmask + fmask) !== (active_pmask + active_fmask)) { + document.getElementById('checkbox' + active_pmask + active_fmask).style.display = 'inline'; + } + } + + if (!view) { + phpbb.toggleDisplay('advanced' + active_pmask + active_fmask, -1); + } + + if (!view) { + phpbb.toggleDisplay('advanced' + pmask + fmask, 1); + } + phpbb.toggleDisplay('options' + id, 1); + + active_pmask = pmask; + active_fmask = fmask; + active_cat = cat; +} + +/** +* Mark all radio buttons in one panel +* id = table ID container, s = status ['y'/'u'/'n'] +*/ +function mark_options(id, s) { + var t = document.getElementById(id); + + if (!t) { + return; + } + + var rb = t.getElementsByTagName('input'); + + for (var r = 0; r < rb.length; r++) { + if (rb[r].id.substr(rb[r].id.length-1) === s) { + rb[r].checked = true; + } + } +} + +function mark_one_option(id, field_name, s) { + var t = document.getElementById(id); + + if (!t) { + return; + } + + var rb = t.getElementsByTagName('input'); + + for (var r = 0; r < rb.length; r++) { + if (rb[r].id.substr(rb[r].id.length-field_name.length-3, field_name.length) === field_name && rb[r].id.substr(rb[r].id.length-1) === s) { + rb[r].checked = true; + } + } +} + +/** +* Reset role dropdown field to Select role... if an option gets changed +*/ +function reset_role(id) { + var t = document.getElementById(id); + + if (!t) { + return; + } + + t.options[0].selected = true; + + var parent = t.parentNode; + parent.querySelector('span.dropdown-trigger').innerText = no_role_assigned; + parent.querySelector('input[data-name^=role]').value = '0'; +} + +/** +* Load role and set options accordingly +*/ +function set_role_settings(role_id, target_id) { + settings = role_options[role_id]; + + if (!settings) { + return; + } + + // Mark all options to no (unset) first... + mark_options(target_id, 'u'); + + for (var r in settings) { + mark_one_option(target_id, r, (settings[r] === 1) ? 'y' : 'n'); + } +} diff --git a/install/update/new/adm/style/progress_bar.html b/install/update/new/adm/style/progress_bar.html new file mode 100644 index 0000000..1e58257 --- /dev/null +++ b/install/update/new/adm/style/progress_bar.html @@ -0,0 +1,40 @@ + + + + +
+

{L_PROGRESS}

+ {L_PROGRESS} +

{L_PROGRESS_EXPLAIN}

+
+ + + + diff --git a/install/update/new/adm/style/simple_footer.html b/install/update/new/adm/style/simple_footer.html new file mode 100644 index 0000000..dd9dc90 --- /dev/null +++ b/install/update/new/adm/style/simple_footer.html @@ -0,0 +1,27 @@ + +

+
+ + + + + + + + +{$SCRIPTS} + + + diff --git a/install/update/new/adm/style/simple_header.html b/install/update/new/adm/style/simple_header.html new file mode 100644 index 0000000..a8a32bf --- /dev/null +++ b/install/update/new/adm/style/simple_header.html @@ -0,0 +1,96 @@ + + + + + + +{META} +{PAGE_TITLE} + + + + + +{$STYLESHEETS} + + + + + + + +
diff --git a/install/update/new/assets/cookieconsent/cookieconsent.min.css b/install/update/new/assets/cookieconsent/cookieconsent.min.css new file mode 100644 index 0000000..d4d4390 --- /dev/null +++ b/install/update/new/assets/cookieconsent/cookieconsent.min.css @@ -0,0 +1,6 @@ +.cc-window{opacity:1;-webkit-transition:opacity 1s ease;transition:opacity 1s ease}.cc-window.cc-invisible{opacity:0}.cc-animate.cc-revoke{-webkit-transition:transform 1s ease;-webkit-transition:-webkit-transform 1s ease;transition:-webkit-transform 1s ease;transition:transform 1s ease;transition:transform 1s ease,-webkit-transform 1s ease}.cc-animate.cc-revoke.cc-top{-webkit-transform:translateY(-2em);transform:translateY(-2em)}.cc-animate.cc-revoke.cc-bottom{-webkit-transform:translateY(2em);transform:translateY(2em)}.cc-animate.cc-revoke.cc-active.cc-top{-webkit-transform:translateY(0);transform:translateY(0)}.cc-animate.cc-revoke.cc-active.cc-bottom{-webkit-transform:translateY(0);transform:translateY(0)}.cc-revoke:hover{-webkit-transform:translateY(0);transform:translateY(0)}.cc-grower{max-height:0;overflow:hidden;-webkit-transition:max-height 1s;transition:max-height 1s} +.cc-revoke,.cc-window{position:fixed;overflow:hidden;-webkit-box-sizing:border-box;box-sizing:border-box;font-family:Helvetica,Calibri,Arial,sans-serif;font-size:16px;line-height:1.5em;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;z-index:9999}.cc-window.cc-static{position:static}.cc-window.cc-floating{padding:2em;max-width:24em;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.cc-window.cc-banner{padding:1em 1.8em;width:100%;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.cc-revoke{padding:.5em}.cc-revoke:hover{text-decoration:underline}.cc-header{font-size:18px;font-weight:700}.cc-btn,.cc-close,.cc-link,.cc-revoke{cursor:pointer}.cc-link{opacity:.8;display:inline-block;padding:.2em;text-decoration:underline}.cc-link:hover{opacity:1}.cc-link:active,.cc-link:visited{color:initial}.cc-btn{display:block;padding:.4em .8em;font-size:.9em;font-weight:700;border-width:2px;border-style:solid;text-align:center;white-space:nowrap}.cc-highlight .cc-btn:first-child{background-color:transparent;border-color:transparent}.cc-highlight .cc-btn:first-child:focus,.cc-highlight .cc-btn:first-child:hover{background-color:transparent;text-decoration:underline}.cc-close{display:block;position:absolute;top:.5em;right:.5em;font-size:1.6em;opacity:.9;line-height:.75}.cc-close:focus,.cc-close:hover{opacity:1} +.cc-revoke.cc-top{top:0;left:3em;border-bottom-left-radius:.5em;border-bottom-right-radius:.5em}.cc-revoke.cc-bottom{bottom:0;left:3em;border-top-left-radius:.5em;border-top-right-radius:.5em}.cc-revoke.cc-left{left:3em;right:unset}.cc-revoke.cc-right{right:3em;left:unset}.cc-top{top:1em}.cc-left{left:1em}.cc-right{right:1em}.cc-bottom{bottom:1em}.cc-floating>.cc-link{margin-bottom:1em}.cc-floating .cc-message{display:block;margin-bottom:1em}.cc-window.cc-floating .cc-compliance{-webkit-box-flex:1;-ms-flex:1 0 auto;flex:1 0 auto}.cc-window.cc-banner{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.cc-banner.cc-top{left:0;right:0;top:0}.cc-banner.cc-bottom{left:0;right:0;bottom:0}.cc-banner .cc-message{display:block;-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;max-width:100%;margin-right:1em}.cc-compliance{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-ms-flex-line-pack:justify;align-content:space-between}.cc-floating .cc-compliance>.cc-btn{-webkit-box-flex:1;-ms-flex:1;flex:1}.cc-btn+.cc-btn{margin-left:.5em} +@media print{.cc-revoke,.cc-window{display:none}}@media screen and (max-width:900px){.cc-btn{white-space:normal}}@media screen and (max-width:414px) and (orientation:portrait),screen and (max-width:736px) and (orientation:landscape){.cc-window.cc-top{top:0}.cc-window.cc-bottom{bottom:0}.cc-window.cc-banner,.cc-window.cc-floating,.cc-window.cc-left,.cc-window.cc-right{left:0;right:0}.cc-window.cc-banner{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column}.cc-window.cc-banner .cc-compliance{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto}.cc-window.cc-floating{max-width:none}.cc-window .cc-message{margin-bottom:1em}.cc-window.cc-banner{-webkit-box-align:unset;-ms-flex-align:unset;align-items:unset}.cc-window.cc-banner .cc-message{margin-right:0}} +.cc-floating.cc-theme-classic{padding:1.2em;border-radius:5px}.cc-floating.cc-type-info.cc-theme-classic .cc-compliance{text-align:center;display:inline;-webkit-box-flex:0;-ms-flex:none;flex:none}.cc-theme-classic .cc-btn{border-radius:5px}.cc-theme-classic .cc-btn:last-child{min-width:140px}.cc-floating.cc-type-info.cc-theme-classic .cc-btn{display:inline-block} +.cc-theme-edgeless.cc-window{padding:0}.cc-floating.cc-theme-edgeless .cc-message{margin:2em;margin-bottom:1.5em}.cc-banner.cc-theme-edgeless .cc-btn{margin:0;padding:.8em 1.8em;height:100%}.cc-banner.cc-theme-edgeless .cc-message{margin-left:1em}.cc-floating.cc-theme-edgeless .cc-btn+.cc-btn{margin-left:0} \ No newline at end of file diff --git a/install/update/new/assets/cookieconsent/cookieconsent.min.js b/install/update/new/assets/cookieconsent/cookieconsent.min.js new file mode 100644 index 0000000..1e3dccf --- /dev/null +++ b/install/update/new/assets/cookieconsent/cookieconsent.min.js @@ -0,0 +1 @@ +!function(e){if(!e.hasInitialised){var t={escapeRegExp:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},hasClass:function(e,t){var i=" ";return 1===e.nodeType&&(i+e.className+i).replace(/[\n\t]/g,i).indexOf(i+t+i)>=0},addClass:function(e,t){e.className+=" "+t},removeClass:function(e,t){var i=new RegExp("\\b"+this.escapeRegExp(t)+"\\b");e.className=e.className.replace(i,"")},interpolateString:function(e,t){return e.replace(/{{([a-z][a-z0-9\-_]*)}}/gi,function(e){return t(arguments[1])||""})},getCookie:function(e){var t=("; "+document.cookie).split("; "+e+"=");return t.length<2?void 0:t.pop().split(";").shift()},setCookie:function(e,t,i,n,o,s){var r=new Date;r.setHours(r.getHours()+24*(i||365));var a=[e+"="+t,"expires="+r.toUTCString(),"path="+(o||"/")];n&&a.push("domain="+n),s&&a.push("secure"),document.cookie=a.join(";")},deepExtend:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(i in e&&this.isPlainObject(e[i])&&this.isPlainObject(t[i])?this.deepExtend(e[i],t[i]):e[i]=t[i]);return e},throttle:function(e,t){var i=!1;return function(){i||(e.apply(this,arguments),i=!0,setTimeout(function(){i=!1},t))}},hash:function(e){var t,i,n=0;if(0===e.length)return n;for(t=0,i=e.length;t=128?"#000":"#fff"},getLuminance:function(e){var t=parseInt(this.normaliseHex(e),16),i=38+(t>>16),n=38+(t>>8&255),o=38+(255&t);return"#"+(16777216+65536*(i<255?i<1?0:i:255)+256*(n<255?n<1?0:n:255)+(o<255?o<1?0:o:255)).toString(16).slice(1)},isMobile:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},isPlainObject:function(e){return"object"==typeof e&&null!==e&&e.constructor==Object},traverseDOMPath:function(e,i){return e&&e.parentNode?t.hasClass(e,i)?e:this.traverseDOMPath(e.parentNode,i):null}};e.status={deny:"deny",allow:"allow",dismiss:"dismiss"},e.transitionEnd=function(){var e=document.createElement("div"),t={t:"transitionend",OT:"oTransitionEnd",msT:"MSTransitionEnd",MozT:"transitionend",WebkitT:"webkitTransitionEnd"};for(var i in t)if(t.hasOwnProperty(i)&&void 0!==e.style[i+"ransition"])return t[i];return""}(),e.hasTransition=!!e.transitionEnd;var i=Object.keys(e.status).map(t.escapeRegExp);e.customStyles={},e.Popup=function(){var n={enabled:!0,container:null,cookie:{name:"cookieconsent_status",path:"/",domain:"",expiryDays:365,secure:!1},onPopupOpen:function(){},onPopupClose:function(){},onInitialise:function(e){},onStatusChange:function(e,t){},onRevokeChoice:function(){},onNoCookieLaw:function(e,t){},content:{header:"Cookies used on the website!",message:"This website uses cookies to ensure you get the best experience on our website.",dismiss:"Got it!",allow:"Allow cookies",deny:"Decline",link:"Learn more",href:"https://www.cookiesandyou.com",close:"❌",target:"_blank",policy:"Cookie Policy"},elements:{header:'{{header}} ',message:'{{message}}',messagelink:'{{message}} {{link}}',dismiss:'{{dismiss}}',allow:'{{allow}}',deny:'{{deny}}',link:'{{link}}',close:'{{close}}'},window:'',revokeBtn:'
{{policy}}
',compliance:{info:'
{{dismiss}}
',"opt-in":'
{{deny}}{{allow}}
',"opt-out":'
{{deny}}{{allow}}
'},type:"info",layouts:{basic:"{{messagelink}}{{compliance}}","basic-close":"{{messagelink}}{{compliance}}{{close}}","basic-header":"{{header}}{{message}}{{link}}{{compliance}}"},layout:"basic",position:"bottom",theme:"block",static:!1,palette:null,revokable:!1,animateRevokable:!0,showLink:!0,dismissOnScroll:!1,dismissOnTimeout:!1,dismissOnWindowClick:!1,ignoreClicksFrom:["cc-revoke","cc-btn"],autoOpen:!0,autoAttach:!0,whitelistPage:[],blacklistPage:[],overrideHTML:null};function o(){this.initialise.apply(this,arguments)}function s(e){this.openingTimeout=null,t.removeClass(e,"cc-invisible")}function r(t){t.style.display="none",t.removeEventListener(e.transitionEnd,this.afterTransition),this.afterTransition=null}function a(){var e=this.options.position.split("-"),t=[];return e.forEach(function(e){t.push("cc-"+e)}),t}function c(n){var o=this.options,s=document.createElement("div"),r=o.container&&1===o.container.nodeType?o.container:document.body;s.innerHTML=n;var a=s.children[0];return a.style.display="none",t.hasClass(a,"cc-window")&&e.hasTransition&&t.addClass(a,"cc-invisible"),this.onButtonClick=function(n){var o=t.traverseDOMPath(n.target,"cc-btn")||n.target;if(t.hasClass(o,"cc-btn")){var s=o.className.match(new RegExp("\\bcc-("+i.join("|")+")\\b")),r=s&&s[1]||!1;r&&(this.setStatus(r),this.close(!0))}t.hasClass(o,"cc-close")&&(this.setStatus(e.status.dismiss),this.close(!0));t.hasClass(o,"cc-revoke")&&this.revokeChoice()}.bind(this),a.addEventListener("click",this.onButtonClick),o.autoAttach&&(r.firstChild?r.insertBefore(a,r.firstChild):r.appendChild(a)),a}function l(e){return"000000"==(e=t.normaliseHex(e))?"#222":t.getLuminance(e)}function u(e,t){for(var i=0,n=e.length;i=0;o&&t(n);return o}.call(this)&&(this.options.enabled=!1),u(this.options.blacklistPage,location.pathname)&&(this.options.enabled=!1),u(this.options.whitelistPage,location.pathname)&&(this.options.enabled=!0);var o=this.options.window.replace("{{classes}}",function(){var i=this.options,n="top"==i.position||"bottom"==i.position?"banner":"floating";t.isMobile()&&(n="floating");var o=["cc-"+n,"cc-type-"+i.type,"cc-theme-"+i.theme];i.static&&o.push("cc-static");o.push.apply(o,a.call(this));(function(i){var n=t.hash(JSON.stringify(i)),o="cc-color-override-"+n,s=t.isPlainObject(i);this.customStyleSelector=s?o:null,s&&function(i,n,o){if(e.customStyles[i])return void++e.customStyles[i].references;var s={},r=n.popup,a=n.button,c=n.highlight;r&&(r.text=r.text?r.text:t.getContrast(r.background),r.link=r.link?r.link:r.text,s[o+".cc-window"]=["color: "+r.text,"background-color: "+r.background],s[o+".cc-revoke"]=["color: "+r.text,"background-color: "+r.background],s[o+" .cc-link,"+o+" .cc-link:active,"+o+" .cc-link:visited"]=["color: "+r.link],a&&(a.text=a.text?a.text:t.getContrast(a.background),a.border=a.border?a.border:"transparent",s[o+" .cc-btn"]=["color: "+a.text,"border-color: "+a.border,"background-color: "+a.background],a.padding&&s[o+" .cc-btn"].push("padding: "+a.padding),"transparent"!=a.background&&(s[o+" .cc-btn:hover, "+o+" .cc-btn:focus"]=["background-color: "+(a.hover||l(a.background))]),c?(c.text=c.text?c.text:t.getContrast(c.background),c.border=c.border?c.border:"transparent",s[o+" .cc-highlight .cc-btn:first-child"]=["color: "+c.text,"border-color: "+c.border,"background-color: "+c.background]):s[o+" .cc-highlight .cc-btn:first-child"]=["color: "+r.text]));var u=document.createElement("style");document.head.appendChild(u),e.customStyles[i]={references:1,element:u.sheet};var h=-1;for(var p in s)s.hasOwnProperty(p)&&u.sheet.insertRule(p+"{"+s[p].join(";")+"}",++h)}(n,i,"."+o);return s}).call(this,this.options.palette);this.customStyleSelector&&o.push(this.customStyleSelector);return o}.call(this).join(" ")).replace("{{children}}",function(){var e={},i=this.options;i.showLink||(i.elements.link="",i.elements.messagelink=i.elements.message);Object.keys(i.elements).forEach(function(n){e[n]=t.interpolateString(i.elements[n],function(e){var t=i.content[e];return e&&"string"==typeof t&&t.length?t:""})});var n=i.compliance[i.type];n||(n=i.compliance.info);e.compliance=t.interpolateString(n,function(t){return e[t]});var o=i.layouts[i.layout];o||(o=i.layouts.basic);return t.interpolateString(o,function(t){return e[t]})}.call(this)),s=this.options.overrideHTML;if("string"==typeof s&&s.length&&(o=s),this.options.static){var r=c.call(this,'
'+o+"
");r.style.display="",this.element=r.firstChild,this.element.style.display="none",t.addClass(this.element,"cc-invisible")}else this.element=c.call(this,o);(function(){var i=this.setStatus.bind(this),n=this.close.bind(this),o=this.options.dismissOnTimeout;"number"==typeof o&&o>=0&&(this.dismissTimeout=window.setTimeout(function(){i(e.status.dismiss),n(!0)},Math.floor(o)));var s=this.options.dismissOnScroll;if("number"==typeof s&&s>=0){var r=function(t){window.pageYOffset>Math.floor(s)&&(i(e.status.dismiss),n(!0),window.removeEventListener("scroll",r),this.onWindowScroll=null)};this.options.enabled&&(this.onWindowScroll=r,window.addEventListener("scroll",r))}var a=this.options.dismissOnWindowClick,c=this.options.ignoreClicksFrom;if(a){var l=function(o){for(var s=!1,r=o.path.length,a=c.length,u=0;uo&&(i=!0),i?t.hasClass(n,"cc-active")||t.addClass(n,"cc-active"):t.hasClass(n,"cc-active")&&t.removeClass(n,"cc-active")},200);this.onMouseMove=o,window.addEventListener("mousemove",o)}}}.call(this),this.options.autoOpen&&this.autoOpen()},o.prototype.destroy=function(){this.onButtonClick&&this.element&&(this.element.removeEventListener("click",this.onButtonClick),this.onButtonClick=null),this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.onWindowScroll&&(window.removeEventListener("scroll",this.onWindowScroll),this.onWindowScroll=null),this.onWindowClick&&(window.removeEventListener("click",this.onWindowClick),this.onWindowClick=null),this.onMouseMove&&(window.removeEventListener("mousemove",this.onMouseMove),this.onMouseMove=null),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.revokeBtn&&this.revokeBtn.parentNode&&this.revokeBtn.parentNode.removeChild(this.revokeBtn),this.revokeBtn=null,function(i){if(t.isPlainObject(i)){var n=t.hash(JSON.stringify(i)),o=e.customStyles[n];if(o&&!--o.references){var s=o.element.ownerNode;s&&s.parentNode&&s.parentNode.removeChild(s),e.customStyles[n]=null}}}(this.options.palette),this.options=null},o.prototype.open=function(t){if(this.element)return this.isOpen()||(e.hasTransition?this.fadeIn():this.element.style.display="",this.options.revokable&&this.toggleRevokeButton(),this.options.onPopupOpen.call(this)),this},o.prototype.close=function(t){if(this.element)return this.isOpen()&&(e.hasTransition?this.fadeOut():this.element.style.display="none",t&&this.options.revokable&&this.toggleRevokeButton(!0),this.options.onPopupClose.call(this)),this},o.prototype.fadeIn=function(){var i=this.element;if(e.hasTransition&&i&&(this.afterTransition&&r.call(this,i),t.hasClass(i,"cc-invisible"))){if(i.style.display="",this.options.static){var n=this.element.clientHeight;this.element.parentNode.style.maxHeight=n+"px"}this.openingTimeout=setTimeout(s.bind(this,i),20)}},o.prototype.fadeOut=function(){var i=this.element;e.hasTransition&&i&&(this.openingTimeout&&(clearTimeout(this.openingTimeout),s.bind(this,i)),t.hasClass(i,"cc-invisible")||(this.options.static&&(this.element.parentNode.style.maxHeight=""),this.afterTransition=r.bind(this,i),i.addEventListener(e.transitionEnd,this.afterTransition),t.addClass(i,"cc-invisible")))},o.prototype.isOpen=function(){return this.element&&""==this.element.style.display&&(!e.hasTransition||!t.hasClass(this.element,"cc-invisible"))},o.prototype.toggleRevokeButton=function(e){this.revokeBtn&&(this.revokeBtn.style.display=e?"":"none")},o.prototype.revokeChoice=function(e){this.options.enabled=!0,this.clearStatus(),this.options.onRevokeChoice.call(this),e||this.autoOpen()},o.prototype.hasAnswered=function(t){return Object.keys(e.status).indexOf(this.getStatus())>=0},o.prototype.hasConsented=function(t){var i=this.getStatus();return i==e.status.allow||i==e.status.dismiss},o.prototype.autoOpen=function(e){!this.hasAnswered()&&this.options.enabled?this.open():this.hasAnswered()&&this.options.revokable&&this.toggleRevokeButton(!0)},o.prototype.setStatus=function(i){var n=this.options.cookie,o=t.getCookie(n.name),s=Object.keys(e.status).indexOf(o)>=0;Object.keys(e.status).indexOf(i)>=0?(t.setCookie(n.name,i,n.expiryDays,n.domain,n.path,n.secure),this.options.onStatusChange.call(this,i,s)):this.clearStatus()},o.prototype.getStatus=function(){return t.getCookie(this.options.cookie.name)},o.prototype.clearStatus=function(){var e=this.options.cookie;t.setCookie(e.name,"",-1,e.domain,e.path)},o}(),e.Location=function(){var e={timeout:5e3,services:["ipinfo"],serviceDefinitions:{ipinfo:function(){return{url:"//ipinfo.io",headers:["Accept: application/json"],callback:function(e,t){try{var i=JSON.parse(t);return i.error?s(i):{code:i.country}}catch(e){return s({error:"Invalid response ("+e+")"})}}}},ipinfodb:function(e){return{url:"//api.ipinfodb.com/v3/ip-country/?key={api_key}&format=json&callback={callback}",isScript:!0,callback:function(e,t){try{var i=JSON.parse(t);return"ERROR"==i.statusCode?s({error:i.statusMessage}):{code:i.countryCode}}catch(e){return s({error:"Invalid response ("+e+")"})}}}},maxmind:function(){return{url:"//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js",isScript:!0,callback:function(e){window.geoip2?geoip2.country(function(t){try{e({code:t.country.iso_code})}catch(t){e(s(t))}},function(t){e(s(t))}):e(new Error("Unexpected response format. The downloaded script should have exported `geoip2` to the global scope"))}}}}};function i(i){t.deepExtend(this.options={},e),t.isPlainObject(i)&&t.deepExtend(this.options,i),this.currentServiceIndex=-1}function n(e,t,i){var n,o=document.createElement("script");o.type="text/"+(e.type||"javascript"),o.src=e.src||e,o.async=!1,o.onreadystatechange=o.onload=function(){var e=o.readyState;clearTimeout(n),t.done||e&&!/loaded|complete/.test(e)||(t.done=!0,t(),o.onreadystatechange=o.onload=null)},document.body.appendChild(o),n=setTimeout(function(){t.done=!0,t(),o.onreadystatechange=o.onload=null},i)}function o(e,t,i,n,o){var s=new(window.XMLHttpRequest||window.ActiveXObject)("MSXML2.XMLHTTP.3.0");if(s.open(n?"POST":"GET",e,1),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),Array.isArray(o))for(var r=0,a=o.length;r3&&t(s)}),s.send(n)}function s(e){return new Error("Error ["+(e.code||"UNKNOWN")+"]: "+e.error)}return i.prototype.getNextService=function(){var e;do{e=this.getServiceByIdx(++this.currentServiceIndex)}while(this.currentServiceIndex=0,revokable:t.revokable.indexOf(e)>=0,explicitAction:t.explicitAction.indexOf(e)>=0}},i.prototype.applyLaw=function(e,t){var i=this.get(t);return i.hasLaw||(e.enabled=!1,"function"==typeof e.onNoCookieLaw&&e.onNoCookieLaw(t,i)),this.options.regionalLaw&&(i.revokable&&(e.revokable=!0),i.explicitAction&&(e.dismissOnScroll=!1,e.dismissOnTimeout=!1)),e},i}(),e.initialise=function(i,n,o){var s=new e.Law(i.law);n||(n=function(){}),o||(o=function(){});var r=Object.keys(e.status),a=t.getCookie("cookieconsent_status");r.indexOf(a)>=0?n(new e.Popup(i)):e.getCountryCode(i,function(t){delete i.law,delete i.location,t.code&&(i=s.applyLaw(i,t.code)),n(new e.Popup(i))},function(t){delete i.law,delete i.location,o(t,new e.Popup(i))})},e.getCountryCode=function(t,i,n){t.law&&t.law.countryCode?i({code:t.law.countryCode}):t.location?new e.Location(t.location).locate(function(e){i(e||{})},n):i({})},e.utils=t,e.hasInitialised=!0,window.cookieconsent=e}}(window.cookieconsent||{}); \ No newline at end of file diff --git a/install/update/new/assets/javascript/core.js b/install/update/new/assets/javascript/core.js new file mode 100644 index 0000000..bedbd23 --- /dev/null +++ b/install/update/new/assets/javascript/core.js @@ -0,0 +1,1823 @@ +/* global bbfontstyle */ + +var phpbb = {}; +phpbb.alertTime = 100; + +(function($) { // Avoid conflicts with other libraries + +'use strict'; + +// define a couple constants for keydown functions. +var keymap = { + TAB: 9, + ENTER: 13, + ESC: 27, + ARROW_UP: 38, + ARROW_DOWN: 40 +}; + +var $dark = $('#darkenwrapper'); +var $loadingIndicator; +var phpbbAlertTimer = null; + +phpbb.isTouch = (window && typeof window.ontouchstart !== 'undefined'); + +// Add ajax pre-filter to prevent cross-domain script execution +$.ajaxPrefilter(function(s) { + if (s.crossDomain) { + s.contents.script = false; + } +}); + +/** + * Display a loading screen + * + * @returns {object} Returns loadingIndicator. + */ +phpbb.loadingIndicator = function() { + if (!$loadingIndicator) { + $loadingIndicator = $('
', { + 'id': 'loading_indicator', + 'class': 'loading_indicator' + }); + $loadingIndicator.appendTo('#page-footer'); + } + + if (!$loadingIndicator.is(':visible')) { + $loadingIndicator.fadeIn(phpbb.alertTime); + // Wait 60 seconds and display an error if nothing has been returned by then. + phpbb.clearLoadingTimeout(); + phpbbAlertTimer = setTimeout(function() { + phpbb.showTimeoutMessage(); + }, 60000); + } + + return $loadingIndicator; +}; + +/** + * Show timeout message + */ +phpbb.showTimeoutMessage = function () { + var $alert = $('#phpbb_alert'); + + if ($loadingIndicator.is(':visible')) { + phpbb.alert($alert.attr('data-l-err'), $alert.attr('data-l-timeout-processing-req')); + } +}; + +/** + * Clear loading alert timeout +*/ +phpbb.clearLoadingTimeout = function() { + if (phpbbAlertTimer !== null) { + clearTimeout(phpbbAlertTimer); + phpbbAlertTimer = null; + } +}; + + +/** +* Close popup alert after a specified delay +* +* @param {int} delay Delay in ms until darkenwrapper's click event is triggered +*/ +phpbb.closeDarkenWrapper = function(delay) { + phpbbAlertTimer = setTimeout(function() { + $('#darkenwrapper').trigger('click'); + }, delay); +}; + +/** + * Display a simple alert similar to JSs native alert(). + * + * You can only call one alert or confirm box at any one time. + * + * @param {string} title Title of the message, eg "Information" (HTML). + * @param {string} msg Message to display (HTML). + * + * @returns {object} Returns the div created. + */ +phpbb.alert = function(title, msg) { + var $alert = $('#phpbb_alert'); + $alert.find('.alert_title').html(title); + $alert.find('.alert_text').html(msg); + + $(document).on('keydown.phpbb.alert', function(e) { + if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { + phpbb.alert.close($alert, true); + e.preventDefault(); + e.stopPropagation(); + } + }); + phpbb.alert.open($alert); + + return $alert; +}; + +/** +* Handler for opening an alert box. +* +* @param {jQuery} $alert jQuery object. +*/ +phpbb.alert.open = function($alert) { + if (!$dark.is(':visible')) { + $dark.fadeIn(phpbb.alertTime); + } + + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime, function() { + $dark.append($alert); + $alert.fadeIn(phpbb.alertTime); + }); + } else if ($dark.is(':visible')) { + $dark.append($alert); + $alert.fadeIn(phpbb.alertTime); + } else { + $dark.append($alert); + $alert.show(); + $dark.fadeIn(phpbb.alertTime); + } + + $alert.on('click', function(e) { + e.stopPropagation(); + }); + + $dark.one('click', function(e) { + phpbb.alert.close($alert, true); + e.preventDefault(); + e.stopPropagation(); + }); + + $alert.find('.alert_close').one('click', function(e) { + phpbb.alert.close($alert, true); + e.preventDefault(); + }); +}; + +/** +* Handler for closing an alert box. +* +* @param {jQuery} $alert jQuery object. +* @param {bool} fadedark Whether to remove dark background. +*/ +phpbb.alert.close = function($alert, fadedark) { + var $fade = (fadedark) ? $dark : $alert; + + $fade.fadeOut(phpbb.alertTime, function() { + $alert.hide(); + }); + + $alert.find('.alert_close').off('click'); + $(document).off('keydown.phpbb.alert'); +}; + +/** + * Display a simple yes / no box to the user. + * + * You can only call one alert or confirm box at any one time. + * + * @param {string} msg Message to display (HTML). + * @param {function} callback Callback. Bool param, whether the user pressed + * yes or no (or whatever their language is). + * @param {bool} fadedark Remove the dark background when done? Defaults + * to yes. + * + * @returns {object} Returns the div created. + */ +phpbb.confirm = function(msg, callback, fadedark) { + var $confirmDiv = $('#phpbb_confirm'); + $confirmDiv.find('.alert_text').html(msg); + fadedark = typeof fadedark !== 'undefined' ? fadedark : true; + + $(document).on('keydown.phpbb.alert', function(e) { + if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { + var name = (e.keyCode === keymap.ENTER) ? 'confirm' : 'cancel'; + + $('input[name="' + name + '"]').trigger('click'); + e.preventDefault(); + e.stopPropagation(); + } + }); + + $confirmDiv.find('input[type="button"]').one('click.phpbb.confirmbox', function(e) { + var confirmed = this.name === 'confirm'; + + callback(confirmed); + $confirmDiv.find('input[type="button"]').off('click.phpbb.confirmbox'); + phpbb.alert.close($confirmDiv, fadedark || !confirmed); + + e.preventDefault(); + e.stopPropagation(); + }); + + phpbb.alert.open($confirmDiv); + + return $confirmDiv; +}; + +/** + * Turn a querystring into an array. + * + * @argument {string} string The querystring to parse. + * @returns {object} The object created. + */ +phpbb.parseQuerystring = function(string) { + var params = {}, i, split; + + string = string.split('&'); + for (i = 0; i < string.length; i++) { + split = string[i].split('='); + params[split[0]] = decodeURIComponent(split[1]); + } + return params; +}; + + +/** + * Makes a link use AJAX instead of loading an entire page. + * + * This function will work for links (both standard links and links which + * invoke confirm_box) and forms. It will be called automatically for links + * and forms with the data-ajax attribute set, and will call the necessary + * callback. + * + * For more info, view the following page on the phpBB wiki: + * http://wiki.phpbb.com/JavaScript_Function.phpbb.ajaxify + * + * @param {object} options Options. + */ +phpbb.ajaxify = function(options) { + var $elements = $(options.selector), + refresh = options.refresh, + callback = options.callback, + overlay = (typeof options.overlay !== 'undefined') ? options.overlay : true, + isForm = $elements.is('form'), + isText = $elements.is('input[type="text"], textarea'), + eventName; + + if (isForm) { + eventName = 'submit'; + } else if (isText) { + eventName = 'keyup'; + } else { + eventName = 'click'; + } + + $elements.on(eventName, function(event) { + var action, method, data, submit, that = this, $this = $(this); + + if ($this.find('input[type="submit"][data-clicked]').attr('data-ajax') === 'false') { + return; + } + + /** + * Handler for AJAX errors + */ + function errorHandler(jqXHR, textStatus, errorThrown) { + if (typeof console !== 'undefined' && console.log) { + console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown); + } + phpbb.clearLoadingTimeout(); + var responseText, errorText = false; + try { + responseText = JSON.parse(jqXHR.responseText); + responseText = responseText.message; + } catch (e) {} + if (typeof responseText === 'string' && responseText.length > 0) { + errorText = responseText; + } else if (typeof errorThrown === 'string' && errorThrown.length > 0) { + errorText = errorThrown; + } else { + errorText = $dark.attr('data-ajax-error-text-' + textStatus); + if (typeof errorText !== 'string' || !errorText.length) { + errorText = $dark.attr('data-ajax-error-text'); + } + } + phpbb.alert($dark.attr('data-ajax-error-title'), errorText); + } + + /** + * This is a private function used to handle the callbacks, refreshes + * and alert. It calls the callback, refreshes the page if necessary, and + * displays an alert to the user and removes it after an amount of time. + * + * It cannot be called from outside this function, and is purely here to + * avoid repetition of code. + * + * @param {object} res The object sent back by the server. + */ + function returnHandler(res) { + var alert; + + phpbb.clearLoadingTimeout(); + + // Is a confirmation required? + if (typeof res.S_CONFIRM_ACTION === 'undefined') { + // If a confirmation is not required, display an alert and call the + // callbacks. + if (typeof res.MESSAGE_TITLE !== 'undefined') { + alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + } else { + $dark.fadeOut(phpbb.alertTime); + + if ($loadingIndicator) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + } + + if (typeof phpbb.ajaxCallbacks[callback] === 'function') { + phpbb.ajaxCallbacks[callback].call(that, res); + } + + // If the server says to refresh the page, check whether the page should + // be refreshed and refresh page after specified time if required. + if (res.REFRESH_DATA) { + if (typeof refresh === 'function') { + refresh = refresh(res.REFRESH_DATA.url); + } else if (typeof refresh !== 'boolean') { + refresh = false; + } + + phpbbAlertTimer = setTimeout(function() { + if (refresh) { + window.location = res.REFRESH_DATA.url; + } + + // Hide the alert even if we refresh the page, in case the user + // presses the back button. + $dark.fadeOut(phpbb.alertTime, function() { + if (typeof alert !== 'undefined') { + alert.hide(); + } + }); + }, res.REFRESH_DATA.time * 1000); // Server specifies time in seconds + } + } else { + // If confirmation is required, display a dialog to the user. + phpbb.confirm(res.MESSAGE_BODY, function(del) { + if (!del) { + return; + } + + phpbb.loadingIndicator(); + data = $('
' + res.S_HIDDEN_FIELDS + '
').serialize(); + $.ajax({ + url: res.S_CONFIRM_ACTION, + type: 'POST', + data: data + '&confirm=' + res.YES_VALUE + '&' + $('form', '#phpbb_confirm').serialize(), + success: returnHandler, + error: errorHandler + }); + }, false); + } + } + + // If the element is a form, POST must be used and some extra data must + // be taken from the form. + var runFilter = (typeof options.filter === 'function'); + data = {}; + + if (isForm) { + action = $this.attr('action').replace('&', '&'); + data = $this.serializeArray(); + method = $this.attr('method') || 'GET'; + + if ($this.find('input[type="submit"][data-clicked]')) { + submit = $this.find('input[type="submit"][data-clicked]'); + data.push({ + name: submit.attr('name'), + value: submit.val() + }); + } + } else if (isText) { + var name = $this.attr('data-name') || this.name; + action = $this.attr('data-url').replace('&', '&'); + data[name] = this.value; + method = 'POST'; + } else { + action = this.href; + data = null; + method = 'GET'; + } + + var sendRequest = function() { + var dataOverlay = $this.attr('data-overlay'); + if (overlay && (typeof dataOverlay === 'undefined' || dataOverlay === 'true')) { + phpbb.loadingIndicator(); + } + + var request = $.ajax({ + url: action, + type: method, + data: data, + success: returnHandler, + error: errorHandler, + cache: false + }); + + request.always(function() { + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + }); + }; + + // If filter function returns false, cancel the AJAX functionality, + // and return true (meaning that the HTTP request will be sent normally). + if (runFilter && !options.filter.call(this, data, event, sendRequest)) { + return; + } + + sendRequest(); + event.preventDefault(); + }); + + if (isForm) { + $elements.find('input:submit').click(function () { + var $this = $(this); + + // Remove data-clicked attribute from any submit button of form + $this.parents('form:first').find('input:submit[data-clicked]').removeAttr('data-clicked'); + + $this.attr('data-clicked', 'true'); + }); + } + + return this; +}; + +phpbb.search = { + cache: { + data: [] + }, + tpl: [], + container: [] +}; + +/** + * Get cached search data. + * + * @param {string} id Search ID. + * @returns {bool|object} Cached data object. Returns false if no data exists. + */ +phpbb.search.cache.get = function(id) { + if (this.data[id]) { + return this.data[id]; + } + return false; +}; + +/** + * Set search cache data value. + * + * @param {string} id Search ID. + * @param {string} key Data key. + * @param {string} value Data value. + */ +phpbb.search.cache.set = function(id, key, value) { + if (!this.data[id]) { + this.data[id] = { results: [] }; + } + this.data[id][key] = value; +}; + +/** + * Cache search result. + * + * @param {string} id Search ID. + * @param {string} keyword Keyword. + * @param {Array} results Search results. + */ +phpbb.search.cache.setResults = function(id, keyword, results) { + this.data[id].results[keyword] = results; +}; + +/** + * Trim spaces from keyword and lower its case. + * + * @param {string} keyword Search keyword to clean. + * @returns {string} Cleaned string. + */ +phpbb.search.cleanKeyword = function(keyword) { + return $.trim(keyword).toLowerCase(); +}; + +/** + * Get clean version of search keyword. If textarea supports several keywords + * (one per line), it fetches the current keyword based on the caret position. + * + * @param {jQuery} $input Search input|textarea. + * @param {string} keyword Input|textarea value. + * @param {bool} multiline Whether textarea supports multiple search keywords. + * + * @returns string Clean string. + */ +phpbb.search.getKeyword = function($input, keyword, multiline) { + if (multiline) { + var line = phpbb.search.getKeywordLine($input); + keyword = keyword.split('\n').splice(line, 1); + } + return phpbb.search.cleanKeyword(keyword); +}; + +/** + * Get the textarea line number on which the keyword resides - for textareas + * that support multiple keywords (one per line). + * + * @param {jQuery} $textarea Search textarea. + * @returns {int} The line number. + */ +phpbb.search.getKeywordLine = function ($textarea) { + var selectionStart = $textarea.get(0).selectionStart; + return $textarea.val().substr(0, selectionStart).split('\n').length - 1; +}; + +/** + * Set the value on the input|textarea. If textarea supports multiple + * keywords, only the active keyword is replaced. + * + * @param {jQuery} $input Search input|textarea. + * @param {string} value Value to set. + * @param {bool} multiline Whether textarea supports multiple search keywords. + */ +phpbb.search.setValue = function($input, value, multiline) { + if (multiline) { + var line = phpbb.search.getKeywordLine($input), + lines = $input.val().split('\n'); + lines[line] = value; + value = lines.join('\n'); + } + $input.val(value); +}; + +/** + * Sets the onclick event to set the value on the input|textarea to the + * selected search result. + * + * @param {jQuery} $input Search input|textarea. + * @param {object} value Result object. + * @param {jQuery} $row Result element. + * @param {jQuery} $container jQuery object for the search container. + */ +phpbb.search.setValueOnClick = function($input, value, $row, $container) { + $row.click(function() { + phpbb.search.setValue($input, value.result, $input.attr('data-multiline')); + phpbb.search.closeResults($input, $container); + }); +}; + +/** + * Runs before the AJAX search request is sent and determines whether + * there is a need to contact the server. If there are cached results + * already, those are displayed instead. Executes the AJAX request function + * itself due to the need to use a timeout to limit the number of requests. + * + * @param {Array} data Data to be sent to the server. + * @param {object} event Onkeyup event object. + * @param {function} sendRequest Function to execute AJAX request. + * + * @returns {boolean} Returns false. + */ +phpbb.search.filter = function(data, event, sendRequest) { + var $this = $(this), + dataName = ($this.attr('data-name') !== undefined) ? $this.attr('data-name') : $this.attr('name'), + minLength = parseInt($this.attr('data-min-length'), 10), + searchID = $this.attr('data-results'), + keyword = phpbb.search.getKeyword($this, data[dataName], $this.attr('data-multiline')), + cache = phpbb.search.cache.get(searchID), + key = event.keyCode || event.which, + proceed = true; + data[dataName] = keyword; + + // No need to search if enter was pressed + // for selecting a value from the results. + if (key === keymap.ENTER) { + return false; + } + + if (cache.timeout) { + clearTimeout(cache.timeout); + } + + var timeout = setTimeout(function() { + // Check min length and existence of cache. + if (minLength > keyword.length) { + proceed = false; + } else if (cache.lastSearch) { + // Has the keyword actually changed? + if (cache.lastSearch === keyword) { + proceed = false; + } else { + // Do we already have results for this? + if (cache.results[keyword]) { + var response = { + keyword: keyword, + results: cache.results[keyword] + }; + phpbb.search.handleResponse(response, $this, true); + proceed = false; + } + + // If the previous search didn't yield results and the string only had characters added to it, + // then we won't bother sending a request. + if (keyword.indexOf(cache.lastSearch) === 0 && cache.results[cache.lastSearch].length === 0) { + phpbb.search.cache.set(searchID, 'lastSearch', keyword); + phpbb.search.cache.setResults(searchID, keyword, []); + proceed = false; + } + } + } + + if (proceed) { + sendRequest.call(this); + } + }, 350); + phpbb.search.cache.set(searchID, 'timeout', timeout); + + return false; +}; + +/** + * Handle search result response. + * + * @param {object} res Data received from server. + * @param {jQuery} $input Search input|textarea. + * @param {bool} fromCache Whether the results are from the cache. + * @param {function} callback Optional callback to run when assigning each search result. + */ +phpbb.search.handleResponse = function(res, $input, fromCache, callback) { + if (typeof res !== 'object') { + return; + } + + var searchID = $input.attr('data-results'), + $container = $(searchID); + + if (this.cache.get(searchID).callback) { + callback = this.cache.get(searchID).callback; + } else if (typeof callback === 'function') { + this.cache.set(searchID, 'callback', callback); + } + + if (!fromCache) { + this.cache.setResults(searchID, res.keyword, res.results); + } + + this.cache.set(searchID, 'lastSearch', res.keyword); + this.showResults(res.results, $input, $container, callback); +}; + +/** + * Show search results. + * + * @param {Array} results Search results. + * @param {jQuery} $input Search input|textarea. + * @param {jQuery} $container Search results container element. + * @param {function} callback Optional callback to run when assigning each search result. + */ +phpbb.search.showResults = function(results, $input, $container, callback) { + var $resultContainer = $('.search-results', $container); + this.clearResults($resultContainer); + + if (!results.length) { + $container.hide(); + return; + } + + var searchID = $container.attr('id'), + tpl, + row; + + if (!this.tpl[searchID]) { + tpl = $('.search-result-tpl', $container); + this.tpl[searchID] = tpl.clone().removeClass('search-result-tpl'); + tpl.remove(); + } + tpl = this.tpl[searchID]; + + $.each(results, function(i, item) { + row = tpl.clone(); + row.find('.search-result').html(item.display); + + if (typeof callback === 'function') { + callback.call(this, $input, item, row, $container); + } + row.appendTo($resultContainer).show(); + }); + $container.show(); + + phpbb.search.navigateResults($input, $container, $resultContainer); +}; + +/** + * Clear search results. + * + * @param {jQuery} $container Search results container. + */ +phpbb.search.clearResults = function($container) { + $container.children(':not(.search-result-tpl)').remove(); +}; + +/** + * Close search results. + * + * @param {jQuery} $input Search input|textarea. + * @param {jQuery} $container Search results container. + */ +phpbb.search.closeResults = function($input, $container) { + $input.off('.phpbb.search'); + $container.hide(); +}; + +/** + * Navigate search results. + * + * @param {jQuery} $input Search input|textarea. + * @param {jQuery} $container Search results container. + * @param {jQuery} $resultContainer Search results list container. + */ +phpbb.search.navigateResults = function($input, $container, $resultContainer) { + // Add a namespace to the event (.phpbb.search), + // so it can be unbound specifically later on. + // Rebind it, to ensure the event is 'dynamic'. + $input.off('.phpbb.search'); + $input.on('keydown.phpbb.search', function(event) { + var key = event.keyCode || event.which, + $active = $resultContainer.children('.active'); + + switch (key) { + // Close the results + case keymap.ESC: + phpbb.search.closeResults($input, $container); + break; + + // Set the value for the selected result + case keymap.ENTER: + if ($active.length) { + var value = $active.find('.search-result > span').text(); + + phpbb.search.setValue($input, value, $input.attr('data-multiline')); + } + + phpbb.search.closeResults($input, $container); + + // Do not submit the form + event.preventDefault(); + break; + + // Navigate the results + case keymap.ARROW_DOWN: + case keymap.ARROW_UP: + var up = key === keymap.ARROW_UP, + $children = $resultContainer.children(); + + if (!$active.length) { + if (up) { + $children.last().addClass('active'); + } else { + $children.first().addClass('active'); + } + } else if ($children.length > 1) { + if (up) { + if ($active.is(':first-child')) { + $children.last().addClass('active'); + } else { + $active.prev().addClass('active'); + } + } else { + if ($active.is(':last-child')) { + $children.first().addClass('active'); + } else { + $active.next().addClass('active'); + } + } + + $active.removeClass('active'); + } + + // Do not change cursor position in the input element + event.preventDefault(); + break; + } + }); +}; + +$('#phpbb').click(function() { + var $this = $(this); + + if (!$this.is('.live-search') && !$this.parents().is('.live-search')) { + phpbb.search.closeResults($('input, textarea'), $('.live-search')); + } +}); + +phpbb.history = {}; + +/** +* Check whether a method in the native history object is supported. +* +* @param {string} fn Method name. +* @returns {bool} Returns true if the method is supported. +*/ +phpbb.history.isSupported = function(fn) { + return !(typeof history === 'undefined' || typeof history[fn] === 'undefined'); +}; + +/** +* Wrapper for the pushState and replaceState methods of the +* native history object. +* +* @param {string} mode Mode. Either push or replace. +* @param {string} url New URL. +* @param {string} [title] Optional page title. +* @param {object} [obj] Optional state object. +*/ +phpbb.history.alterUrl = function(mode, url, title, obj) { + var fn = mode + 'State'; + + if (!url || !phpbb.history.isSupported(fn)) { + return; + } + if (!title) { + title = document.title; + } + if (!obj) { + obj = null; + } + + history[fn](obj, title, url); +}; + +/** +* Wrapper for the native history.replaceState method. +* +* @param {string} url New URL. +* @param {string} [title] Optional page title. +* @param {object} [obj] Optional state object. +*/ +phpbb.history.replaceUrl = function(url, title, obj) { + phpbb.history.alterUrl('replace', url, title, obj); +}; + +/** +* Wrapper for the native history.pushState method. +* +* @param {string} url New URL. +* @param {string} [title] Optional page title. +* @param {object} [obj] Optional state object. +*/ +phpbb.history.pushUrl = function(url, title, obj) { + phpbb.history.alterUrl('push', url, title, obj); +}; + +/** +* Hide the optgroups that are not the selected timezone +* +* @param {bool} keepSelection Shall we keep the value selected, or shall the +* user be forced to repick one. +*/ +phpbb.timezoneSwitchDate = function(keepSelection) { + var $timezoneCopy = $('#timezone_copy'); + var $timezone = $('#timezone'); + var $tzDate = $('#tz_date'); + var $tzSelectDateSuggest = $('#tz_select_date_suggest'); + + if ($timezoneCopy.length === 0) { + // We make a backup of the original dropdown, so we can remove optgroups + // instead of setting display to none, because IE and chrome will not + // hide options inside of optgroups and selects via css + $timezone.clone() + .attr('id', 'timezone_copy') + .css('display', 'none') + .attr('name', 'tz_copy') + .insertAfter('#timezone'); + } else { + // Copy the content of our backup, so we can remove all unneeded options + $timezone.html($timezoneCopy.html()); + } + + if ($tzDate.val() !== '') { + $timezone.children('optgroup').remove(':not([data-tz-value="' + $tzDate.val() + '"])'); + } + + if ($tzDate.val() === $tzSelectDateSuggest.attr('data-suggested-tz')) { + $tzSelectDateSuggest.css('display', 'none'); + } else { + $tzSelectDateSuggest.css('display', 'inline'); + } + + var $tzOptions = $timezone.children('optgroup[data-tz-value="' + $tzDate.val() + '"]').children('option'); + + if ($tzOptions.length === 1) { + // If there is only one timezone for the selected date, we just select that automatically. + $tzOptions.prop('selected', true); + keepSelection = true; + } + + if (typeof keepSelection !== 'undefined' && !keepSelection) { + var $timezoneOptions = $timezone.find('optgroup option'); + if ($timezoneOptions.filter(':selected').length <= 0) { + $timezoneOptions.filter(':first').prop('selected', true); + } + } +}; + +/** +* Display the date/time select +*/ +phpbb.timezoneEnableDateSelection = function() { + $('#tz_select_date').css('display', 'block'); +}; + +/** +* Preselect a date/time or suggest one, if it is not picked. +* +* @param {bool} forceSelector Shall we select the suggestion? +*/ +phpbb.timezonePreselectSelect = function(forceSelector) { + + // The offset returned here is in minutes and negated. + var offset = (new Date()).getTimezoneOffset(); + var sign = '-'; + + if (offset < 0) { + sign = '+'; + offset = -offset; + } + + var minutes = offset % 60; + var hours = (offset - minutes) / 60; + + if (hours < 10) { + hours = '0' + hours.toString(); + } else { + hours = hours.toString(); + } + + if (minutes < 10) { + minutes = '0' + minutes.toString(); + } else { + minutes = minutes.toString(); + } + + var prefix = 'UTC' + sign + hours + ':' + minutes; + var prefixLength = prefix.length; + var selectorOptions = $('option', '#tz_date'); + var i; + + var $tzSelectDateSuggest = $('#tz_select_date_suggest'); + + for (i = 0; i < selectorOptions.length; ++i) { + var option = selectorOptions[i]; + + if (option.value.substring(0, prefixLength) === prefix) { + if ($('#tz_date').val() !== option.value && !forceSelector) { + // We do not select the option for the user, but notify him, + // that we would suggest a different setting. + phpbb.timezoneSwitchDate(true); + $tzSelectDateSuggest.css('display', 'inline'); + } else { + option.selected = true; + phpbb.timezoneSwitchDate(!forceSelector); + $tzSelectDateSuggest.css('display', 'none'); + } + + var suggestion = $tzSelectDateSuggest.attr('data-l-suggestion'); + + $tzSelectDateSuggest.attr('title', suggestion.replace('%s', option.innerHTML)); + $tzSelectDateSuggest.attr('value', suggestion.replace('%s', option.innerHTML.substring(0, 9))); + $tzSelectDateSuggest.attr('data-suggested-tz', option.innerHTML); + + // Found the suggestion, there cannot be more, so return from here. + return; + } + } +}; + +phpbb.ajaxCallbacks = {}; + +/** + * Adds an AJAX callback to be used by phpbb.ajaxify. + * + * See the phpbb.ajaxify comments for information on stuff like parameters. + * + * @param {string} id The name of the callback. + * @param {function} callback The callback to be called. + */ +phpbb.addAjaxCallback = function(id, callback) { + if (typeof callback === 'function') { + phpbb.ajaxCallbacks[id] = callback; + } + return this; +}; + +/** + * This callback handles live member searches. + */ +phpbb.addAjaxCallback('member_search', function(res) { + phpbb.search.handleResponse(res, $(this), false, phpbb.getFunctionByName('phpbb.search.setValueOnClick')); +}); + +/** + * This callback alternates text - it replaces the current text with the text in + * the alt-text data attribute, and replaces the text in the attribute with the + * current text so that the process can be repeated. + */ +phpbb.addAjaxCallback('alt_text', function() { + var $anchor, + updateAll = $(this).data('update-all'), + altText; + + if (updateAll !== undefined && updateAll.length) { + $anchor = $(updateAll); + } else { + $anchor = $(this); + } + + $anchor.each(function() { + var $this = $(this); + altText = $this.attr('data-alt-text'); + $this.attr('data-alt-text', $.trim($this.text())); + $this.attr('title', altText); + $this.children('span').text(altText); + }); +}); + +/** + * This callback is based on the alt_text callback. + * + * It replaces the current text with the text in the alt-text data attribute, + * and replaces the text in the attribute with the current text so that the + * process can be repeated. + * Additionally it replaces the class of the link's parent + * and changes the link itself. + */ +phpbb.addAjaxCallback('toggle_link', function() { + var $anchor, + updateAll = $(this).data('update-all') , + toggleText, + toggleUrl, + toggleClass; + + if (updateAll !== undefined && updateAll.length) { + $anchor = $(updateAll); + } else { + $anchor = $(this); + } + + $anchor.each(function() { + var $this = $(this); + + // Toggle link url + toggleUrl = $this.attr('data-toggle-url'); + $this.attr('data-toggle-url', $this.attr('href')); + $this.attr('href', toggleUrl); + + // Toggle class of link parent + toggleClass = $this.attr('data-toggle-class'); + $this.attr('data-toggle-class', $this.children().attr('class')); + $this.children('.icon').attr('class', toggleClass); + + // Toggle link text + toggleText = $this.attr('data-toggle-text'); + $this.attr('data-toggle-text', $this.children('span').text()); + $this.attr('title', $.trim(toggleText)); + $this.children('span').text(toggleText); + }); +}); + +/** +* Automatically resize textarea +* +* This function automatically resizes textarea elements when user +* types text. +* +* @param {jQuery} $items jQuery object(s) to resize +* @param {object} [options] Optional parameter that adjusts default +* configuration. See configuration variable +* +* Optional parameters: +* minWindowHeight {number} Minimum browser window height when textareas are resized. Default = 500 +* minHeight {number} Minimum height of textarea. Default = 200 +* maxHeight {number} Maximum height of textarea. Default = 500 +* heightDiff {number} Minimum difference between window and textarea height. Default = 200 +* resizeCallback {function} Function to call after resizing textarea +* resetCallback {function} Function to call when resize has been canceled + +* Callback function format: function(item) {} +* this points to DOM object +* item is a jQuery object, same as this +*/ +phpbb.resizeTextArea = function($items, options) { + // Configuration + var configuration = { + minWindowHeight: 500, + minHeight: 200, + maxHeight: 500, + heightDiff: 200, + resizeCallback: function() {}, + resetCallback: function() {} + }; + + if (phpbb.isTouch) { + return; + } + + if (arguments.length > 1) { + configuration = $.extend(configuration, options); + } + + function resetAutoResize(item) { + var $item = $(item); + if ($item.hasClass('auto-resized')) { + $(item) + .css({ height: '', resize: '' }) + .removeClass('auto-resized'); + configuration.resetCallback.call(item, $item); + } + } + + function autoResize(item) { + function setHeight(height) { + height += parseInt($item.css('height'), 10) - $item.innerHeight(); + $item + .css({ height: height + 'px', resize: 'none' }) + .addClass('auto-resized'); + configuration.resizeCallback.call(item, $item); + } + + var windowHeight = $(window).height(); + + if (windowHeight < configuration.minWindowHeight) { + resetAutoResize(item); + return; + } + + var maxHeight = Math.min( + Math.max(windowHeight - configuration.heightDiff, configuration.minHeight), + configuration.maxHeight + ), + $item = $(item), + height = parseInt($item.innerHeight(), 10), + scrollHeight = (item.scrollHeight) ? item.scrollHeight : 0; + + if (height < 0) { + return; + } + + if (height > maxHeight) { + setHeight(maxHeight); + } else if (scrollHeight > (height + 5)) { + setHeight(Math.min(maxHeight, scrollHeight)); + } + } + + $items.on('focus change keyup', function() { + $(this).each(function() { + autoResize(this); + }); + }).change(); + + $(window).resize(function() { + $items.each(function() { + if ($(this).hasClass('auto-resized')) { + autoResize(this); + } + }); + }); +}; + +/** +* Check if cursor in textarea is currently inside a bbcode tag +* +* @param {object} textarea Textarea DOM object +* @param {Array} startTags List of start tags to look for +* For example, Array('[code]', '[code=') +* @param {Array} endTags List of end tags to look for +* For example, Array('[/code]') +* +* @returns {boolean} True if cursor is in bbcode tag +*/ +phpbb.inBBCodeTag = function(textarea, startTags, endTags) { + var start = textarea.selectionStart, + lastEnd = -1, + lastStart = -1, + i, index, value; + + if (typeof start !== 'number') { + return false; + } + + value = textarea.value.toLowerCase(); + + for (i = 0; i < startTags.length; i++) { + var tagLength = startTags[i].length; + if (start >= tagLength) { + index = value.lastIndexOf(startTags[i], start - tagLength); + lastStart = Math.max(lastStart, index); + } + } + if (lastStart === -1) { + return false; + } + + if (start > 0) { + for (i = 0; i < endTags.length; i++) { + index = value.lastIndexOf(endTags[i], start - 1); + lastEnd = Math.max(lastEnd, index); + } + } + + return (lastEnd < lastStart); +}; + + +/** +* Adjust textarea to manage code bbcode +* +* This function allows to use tab characters when typing code +* and keeps indentation of previous line of code when adding new +* line while typing code. +* +* Editor's functionality is changed only when cursor is between +* [code] and [/code] bbcode tags. +* +* @param {object} textarea Textarea DOM object to apply editor to +*/ +phpbb.applyCodeEditor = function(textarea) { + // list of allowed start and end bbcode code tags, in lower case + var startTags = ['[code]', '[code='], + startTagsEnd = ']', + endTags = ['[/code]']; + + if (!textarea || typeof textarea.selectionStart !== 'number') { + return; + } + + if ($(textarea).data('code-editor') === true) { + return; + } + + function inTag() { + return phpbb.inBBCodeTag(textarea, startTags, endTags); + } + + /** + * Get line of text before cursor + * + * @param {boolean} stripCodeStart If true, only part of line + * after [code] tag will be returned. + * + * @returns {string} Line of text + */ + function getLastLine(stripCodeStart) { + var start = textarea.selectionStart, + value = textarea.value, + index = value.lastIndexOf('\n', start - 1); + + value = value.substring(index + 1, start); + + if (stripCodeStart) { + for (var i = 0; i < startTags.length; i++) { + index = value.lastIndexOf(startTags[i]); + if (index >= 0) { + var tagLength = startTags[i].length; + + value = value.substring(index + tagLength); + if (startTags[i].lastIndexOf(startTagsEnd) !== tagLength) { + index = value.indexOf(startTagsEnd); + + if (index >= 0) { + value = value.substr(index + 1); + } + } + } + } + } + + return value; + } + + /** + * Append text at cursor position + * + * @param {string} text Text to append + */ + function appendText(text) { + var start = textarea.selectionStart, + end = textarea.selectionEnd, + value = textarea.value; + + textarea.value = value.substr(0, start) + text + value.substr(end); + textarea.selectionStart = textarea.selectionEnd = start + text.length; + } + + $(textarea).data('code-editor', true).on('keydown', function(event) { + var key = event.keyCode || event.which; + + // intercept tabs + if (key === keymap.TAB && + !event.ctrlKey && + !event.shiftKey && + !event.altKey && + !event.metaKey) { + if (inTag()) { + appendText('\t'); + event.preventDefault(); + return; + } + } + + // intercept new line characters + if (key === keymap.ENTER) { + if (inTag()) { + var lastLine = getLastLine(true), + code = '' + /^\s*/g.exec(lastLine); + + if (code.length > 0) { + appendText('\n' + code); + event.preventDefault(); + } + } + } + }); +}; + +/** + * Show drag and drop animation when textarea is present + * + * This function will enable the drag and drop animation for a specified + * textarea. + * + * @param {HTMLElement} textarea Textarea DOM object to apply editor to + */ +phpbb.showDragNDrop = function(textarea) { + if (!textarea) { + return; + } + + $('body').on('dragenter dragover', function () { + $(textarea).addClass('drag-n-drop'); + }).on('dragleave dragout dragend drop', function() { + $(textarea).removeClass('drag-n-drop'); + }); + $(textarea).on('dragenter dragover', function () { + $(textarea).addClass('drag-n-drop-highlight'); + }).on('dragleave dragout dragend drop', function() { + $(textarea).removeClass('drag-n-drop-highlight'); + }); +}; + +/** +* List of classes that toggle dropdown menu, +* list of classes that contain visible dropdown menu +* +* Add your own classes to strings with comma (probably you +* will never need to do that) +*/ +phpbb.dropdownHandles = '.dropdown-container.dropdown-visible .dropdown-toggle'; +phpbb.dropdownVisibleContainers = '.dropdown-container.dropdown-visible'; + +/** +* Dropdown toggle event handler +* This handler is used by phpBB.registerDropdown() and other functions +*/ +phpbb.toggleDropdown = function() { + var $this = $(this), + options = $this.data('dropdown-options'), + parent = options.parent, + visible = parent.hasClass('dropdown-visible'), + direction; + + if (!visible) { + // Hide other dropdown menus + $(phpbb.dropdownHandles).each(phpbb.toggleDropdown); + + // Figure out direction of dropdown + direction = options.direction; + var verticalDirection = options.verticalDirection, + offset = $this.offset(); + + if (direction === 'auto') { + if (($(window).width() - $this.outerWidth(true)) / 2 > offset.left) { + direction = 'right'; + } else { + direction = 'left'; + } + } + parent.toggleClass(options.leftClass, direction === 'left') + .toggleClass(options.rightClass, direction === 'right'); + + if (verticalDirection === 'auto') { + var height = $(window).height(), + top = offset.top - $(window).scrollTop(); + + verticalDirection = (top < height * 0.7) ? 'down' : 'up'; + } + parent.toggleClass(options.upClass, verticalDirection === 'up') + .toggleClass(options.downClass, verticalDirection === 'down'); + } + + options.dropdown.toggle(); + parent.toggleClass(options.visibleClass, !visible) + .toggleClass('dropdown-visible', !visible); + + // Check dimensions when showing dropdown + // !visible because variable shows state of dropdown before it was toggled + if (!visible) { + var windowWidth = $(window).width(); + + options.dropdown.find('.dropdown-contents').each(function() { + var $this = $(this); + + $this.css({ + marginLeft: 0, + left: 0, + marginRight: 0, + maxWidth: (windowWidth - 4) + 'px' + }); + + var offset = $this.offset().left, + width = $this.outerWidth(true); + + if (offset < 2) { + $this.css('left', (2 - offset) + 'px'); + } else if ((offset + width + 2) > windowWidth) { + $this.css('margin-left', (windowWidth - offset - width - 2) + 'px'); + } + + // Check whether the vertical scrollbar is present. + $this.toggleClass('dropdown-nonscroll', this.scrollHeight === $this.innerHeight()); + + }); + var freeSpace = parent.offset().left - 4; + + if (direction === 'left') { + options.dropdown.css('margin-left', '-' + freeSpace + 'px'); + + // Try to position the notification dropdown correctly in RTL-responsive mode + if (options.dropdown.hasClass('dropdown-extended')) { + var contentWidth, + fullFreeSpace = freeSpace + parent.outerWidth(); + + options.dropdown.find('.dropdown-contents').each(function() { + contentWidth = parseInt($(this).outerWidth(), 10); + $(this).css({ marginLeft: 0, left: 0 }); + }); + + var maxOffset = Math.min(contentWidth, fullFreeSpace) + 'px'; + options.dropdown.css({ + width: maxOffset, + marginLeft: -maxOffset + }); + } + } else { + options.dropdown.css('margin-right', '-' + (windowWidth + freeSpace) + 'px'); + } + } + + // Prevent event propagation + if (arguments.length > 0) { + try { + var e = arguments[0]; + e.preventDefault(); + e.stopPropagation(); + } catch (error) { } + } + return false; +}; + +/** +* Toggle dropdown submenu +*/ +phpbb.toggleSubmenu = function(e) { + $(this).siblings('.dropdown-submenu').toggle(); + e.preventDefault(); +}; + +/** +* Register dropdown menu +* Shows/hides dropdown, decides which side to open to +* +* @param {jQuery} toggle Link that toggles dropdown. +* @param {jQuery} dropdown Dropdown menu. +* @param {Object} options List of options. Optional. +*/ +phpbb.registerDropdown = function(toggle, dropdown, options) { + var ops = { + parent: toggle.parent(), // Parent item to add classes to + direction: 'auto', // Direction of dropdown menu. Possible values: auto, left, right + verticalDirection: 'auto', // Vertical direction. Possible values: auto, up, down + visibleClass: 'visible', // Class to add to parent item when dropdown is visible + leftClass: 'dropdown-left', // Class to add to parent item when dropdown opens to left side + rightClass: 'dropdown-right', // Class to add to parent item when dropdown opens to right side + upClass: 'dropdown-up', // Class to add to parent item when dropdown opens above menu item + downClass: 'dropdown-down' // Class to add to parent item when dropdown opens below menu item + }; + if (options) { + ops = $.extend(ops, options); + } + ops.dropdown = dropdown; + + ops.parent.addClass('dropdown-container'); + toggle.addClass('dropdown-toggle'); + + toggle.data('dropdown-options', ops); + + toggle.click(phpbb.toggleDropdown); + $('.dropdown-toggle-submenu', ops.parent).click(phpbb.toggleSubmenu); +}; + +/** +* Get the HTML for a color palette table. +* +* @param {string} dir Palette direction - either v or h +* @param {int} width Palette cell width. +* @param {int} height Palette cell height. +*/ +phpbb.colorPalette = function(dir, width, height) { + var r, g, b, + numberList = new Array(6), + color = '', + html = ''; + + numberList[0] = '00'; + numberList[1] = '40'; + numberList[2] = '80'; + numberList[3] = 'BF'; + numberList[4] = 'FF'; + + var tableClass = (dir === 'h') ? 'horizontal-palette' : 'vertical-palette'; + html += ''; + + for (r = 0; r < 5; r++) { + if (dir === 'h') { + html += ''; + } + + for (g = 0; g < 5; g++) { + if (dir === 'v') { + html += ''; + } + + for (b = 0; b < 5; b++) { + color = '' + numberList[r] + numberList[g] + numberList[b]; + html += ''; + } + + if (dir === 'v') { + html += ''; + } + } + + if (dir === 'h') { + html += ''; + } + } + html += '
'; + html += '
'; + return html; +}; + +/** +* Register a color palette. +* +* @param {jQuery} el jQuery object for the palette container. +*/ +phpbb.registerPalette = function(el) { + var orientation = el.attr('data-color-palette') || el.attr('data-orientation'), // data-orientation kept for backwards compat. + height = el.attr('data-height'), + width = el.attr('data-width'), + target = el.attr('data-target'), + bbcode = el.attr('data-bbcode'); + + // Insert the palette HTML into the container. + el.html(phpbb.colorPalette(orientation, width, height)); + + // Add toggle control. + $('#color_palette_toggle').click(function(e) { + el.toggle(); + e.preventDefault(); + }); + + // Attach event handler when a palette cell is clicked. + $(el).on('click', 'a', function(e) { + var color = $(this).attr('data-color'); + + if (bbcode) { + bbfontstyle('[color=#' + color + ']', '[/color]'); + } else { + $(target).val(color); + } + e.preventDefault(); + }); +}; + +/** +* Set display of page element +* +* @param {string} id The ID of the element to change +* @param {int} action Set to 0 if element display should be toggled, -1 for +* hiding the element, and 1 for showing it. +* @param {string} type Display type that should be used, e.g. inline, block or +* other CSS "display" types +*/ +phpbb.toggleDisplay = function(id, action, type) { + if (!type) { + type = 'block'; + } + + var $element = $('#' + id); + + var display = $element.css('display'); + if (!action) { + action = (display === '' || display === type) ? -1 : 1; + } + $element.css('display', ((action === 1) ? type : 'none')); +}; + +/** +* Toggle additional settings based on the selected +* option of select element. +* +* @param {jQuery} el jQuery select element object. +*/ +phpbb.toggleSelectSettings = function(el) { + el.children().each(function() { + var $this = $(this), + $setting = $($this.data('toggle-setting')); + $setting.toggle($this.is(':selected')); + + // Disable any input elements that are not visible right now + if ($this.is(':selected')) { + $($this.data('toggle-setting') + ' input').prop('disabled', false); + } else { + $($this.data('toggle-setting') + ' input').prop('disabled', true); + } + }); +}; + +/** +* Get function from name. +* Based on http://stackoverflow.com/a/359910 +* +* @param {string} functionName Function to get. +* @returns function +*/ +phpbb.getFunctionByName = function (functionName) { + var namespaces = functionName.split('.'), + func = namespaces.pop(), + context = window; + + for (var i = 0; i < namespaces.length; i++) { + context = context[namespaces[i]]; + } + return context[func]; +}; + +/** +* Register page dropdowns. +*/ +phpbb.registerPageDropdowns = function() { + var $body = $('body'); + + $body.find('.dropdown-container').each(function() { + var $this = $(this), + $trigger = $this.find('.dropdown-trigger:first'), + $contents = $this.find('.dropdown'), + options = { + direction: 'auto', + verticalDirection: 'auto' + }, + data; + + if (!$trigger.length) { + data = $this.attr('data-dropdown-trigger'); + $trigger = data ? $this.children(data) : $this.children('a:first'); + } + + if (!$contents.length) { + data = $this.attr('data-dropdown-contents'); + $contents = data ? $this.children(data) : $this.children('div:first'); + } + + if (!$trigger.length || !$contents.length) { + return; + } + + if ($this.hasClass('dropdown-up')) { + options.verticalDirection = 'up'; + } + if ($this.hasClass('dropdown-down')) { + options.verticalDirection = 'down'; + } + if ($this.hasClass('dropdown-left')) { + options.direction = 'left'; + } + if ($this.hasClass('dropdown-right')) { + options.direction = 'right'; + } + + phpbb.registerDropdown($trigger, $contents, options); + }); + + // Hide active dropdowns when click event happens outside + $body.click(function(e) { + var $parents = $(e.target).parents(); + if (!$parents.is(phpbb.dropdownVisibleContainers)) { + $(phpbb.dropdownHandles).each(phpbb.toggleDropdown); + } + }); +}; + +/** + * Handle avatars to be lazy loaded. + */ +phpbb.lazyLoadAvatars = function loadAvatars() { + $('.avatar[data-src]').each(function () { + var $avatar = $(this); + + $avatar + .attr('src', $avatar.data('src')) + .removeAttr('data-src'); + }); +}; + +var recaptchaForm = $('.g-recaptcha').parents('form'); +var submitButton = null; +var programaticallySubmitted = false; + +phpbb.recaptchaOnLoad = function () { + // Listen to submit buttons in order to know which one was pressed + $('input[type="submit"]').each(function () { + $(this).on('click', function () { + submitButton = this; + }); + }); + + recaptchaForm.on('submit', function (e) { + if (!programaticallySubmitted) { + grecaptcha.execute(); + e.preventDefault(); + } + }); +} + +phpbb.recaptchaOnSubmit = function () { + programaticallySubmitted = true; + // If concrete button was clicked (e.g. preview instead of submit), + // let's trigger the same action + if (submitButton) { + submitButton.click(); + } else { + // Rename input[name="submit"] so that we can submit the form + if (typeof recaptchaForm.submit !== 'function') { + recaptchaForm.submit.name = 'submit_btn'; + } + recaptchaForm.submit(); + } +} + +// reCAPTCHA doesn't accept callback functions nested inside objects +// so we need to make this helper functions here +window.phpbbRecaptchaOnLoad = function() { + phpbb.recaptchaOnLoad(); +} +window.phpbbRecaptchaOnSubmit = function() { + phpbb.recaptchaOnSubmit(); +} + +$(window).on('load', phpbb.lazyLoadAvatars); + +/** +* Apply code editor to all textarea elements with data-bbcode attribute +*/ +$(function() { + $('textarea[data-bbcode]').each(function() { + phpbb.applyCodeEditor(this); + }); + + phpbb.registerPageDropdowns(); + + $('[data-color-palette], [data-orientation]').each(function() { + phpbb.registerPalette($(this)); + }); + + // Update browser history URL to point to specific post in viewtopic.php + // when using view=unread#unread link. + phpbb.history.replaceUrl($('#unread[data-url]').data('url')); + + // Hide settings that are not selected via select element. + $('select[data-togglable-settings]').each(function() { + var $this = $(this); + + $this.change(function() { + phpbb.toggleSelectSettings($this); + }); + phpbb.toggleSelectSettings($this); + }); +}); + +})(jQuery); // Avoid conflicts with other libraries diff --git a/install/update/new/assets/javascript/editor.js b/install/update/new/assets/javascript/editor.js new file mode 100644 index 0000000..24cbc09 --- /dev/null +++ b/install/update/new/assets/javascript/editor.js @@ -0,0 +1,418 @@ +/** +* bbCode control by subBlue design [ www.subBlue.com ] +* Includes unixsafe colour palette selector by SHS` +*/ + +// Startup variables +var imageTag = false; +var theSelection = false; +var bbcodeEnabled = true; + +// Check for Browser & Platform for PC & IE specific bits +// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html +var clientPC = navigator.userAgent.toLowerCase(); // Get client info +var clientVer = parseInt(navigator.appVersion, 10); // Get browser version + +var is_ie = ((clientPC.indexOf('msie') !== -1) && (clientPC.indexOf('opera') === -1)); +var is_win = ((clientPC.indexOf('win') !== -1) || (clientPC.indexOf('16bit') !== -1)); +var baseHeight; + +/** +* Fix a bug involving the TextRange object. From +* http://www.frostjedi.com/terra/scripts/demo/caretBug.html +*/ +function initInsertions() { + var doc; + + if (document.forms[form_name]) { + doc = document; + } else { + doc = opener.document; + } + + var textarea = doc.forms[form_name].elements[text_name]; + + if (is_ie && typeof(baseHeight) !== 'number') { + textarea.focus(); + baseHeight = doc.selection.createRange().duplicate().boundingHeight; + + if (!document.forms[form_name]) { + document.body.focus(); + } + } +} + +/** +* bbstyle +*/ +function bbstyle(bbnumber) { + if (bbnumber !== -1) { + bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]); + } else { + insert_text('[*]'); + document.forms[form_name].elements[text_name].focus(); + } +} + +/** +* Apply bbcodes +*/ +function bbfontstyle(bbopen, bbclose) { + theSelection = false; + + var textarea = document.forms[form_name].elements[text_name]; + + textarea.focus(); + + if ((clientVer >= 4) && is_ie && is_win) { + // Get text selection + theSelection = document.selection.createRange().text; + + if (theSelection) { + // Add tags around selection + document.selection.createRange().text = bbopen + theSelection + bbclose; + textarea.focus(); + theSelection = ''; + return; + } + } else if (textarea.selectionEnd && (textarea.selectionEnd - textarea.selectionStart > 0)) { + mozWrap(textarea, bbopen, bbclose); + textarea.focus(); + theSelection = ''; + return; + } + + //The new position for the cursor after adding the bbcode + var caret_pos = getCaretPosition(textarea).start; + var new_pos = caret_pos + bbopen.length; + + // Open tag + insert_text(bbopen + bbclose); + + // Center the cursor when we don't have a selection + // Gecko and proper browsers + if (!isNaN(textarea.selectionStart)) { + textarea.selectionStart = new_pos; + textarea.selectionEnd = new_pos; + } + // IE + else if (document.selection) { + var range = textarea.createTextRange(); + range.move("character", new_pos); + range.select(); + storeCaret(textarea); + } + + textarea.focus(); +} + +/** +* Insert text at position +*/ +function insert_text(text, spaces, popup) { + var textarea; + + if (!popup) { + textarea = document.forms[form_name].elements[text_name]; + } else { + textarea = opener.document.forms[form_name].elements[text_name]; + } + + if (spaces) { + text = ' ' + text + ' '; + } + + // Since IE9, IE also has textarea.selectionStart, but it still needs to be treated the old way. + // Therefore we simply add a !is_ie here until IE fixes the text-selection completely. + if (!isNaN(textarea.selectionStart) && !is_ie) { + var sel_start = textarea.selectionStart; + var sel_end = textarea.selectionEnd; + + mozWrap(textarea, text, ''); + textarea.selectionStart = sel_start + text.length; + textarea.selectionEnd = sel_end + text.length; + } else if (textarea.createTextRange && textarea.caretPos) { + if (baseHeight !== textarea.caretPos.boundingHeight) { + textarea.focus(); + storeCaret(textarea); + } + + var caret_pos = textarea.caretPos; + caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) === ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text; + } else { + textarea.value = textarea.value + text; + } + + if (!popup) { + textarea.focus(); + } +} + +/** +* Add inline attachment at position +*/ +function attachInline(index, filename) { + insert_text('[attachment=' + index + ']' + filename + '[/attachment]'); + document.forms[form_name].elements[text_name].focus(); +} + +/** +* Add quote text to message +*/ +function addquote(post_id, username, l_wrote, attributes) { + var message_name = 'message_' + post_id; + var theSelection = ''; + var divarea = false; + var i; + + if (l_wrote === undefined) { + // Backwards compatibility + l_wrote = 'wrote'; + } + if (typeof attributes !== 'object') { + attributes = {}; + } + + if (document.all) { + divarea = document.all[message_name]; + } else { + divarea = document.getElementById(message_name); + } + + // Get text selection - not only the post content :( + // IE9 must use the document.selection method but has the *.getSelection so we just force no IE + if (window.getSelection && !is_ie && !window.opera) { + theSelection = window.getSelection().toString(); + } else if (document.getSelection && !is_ie) { + theSelection = document.getSelection(); + } else if (document.selection) { + theSelection = document.selection.createRange().text; + } + + if (theSelection === '' || typeof theSelection === 'undefined' || theSelection === null) { + if (divarea.innerHTML) { + theSelection = divarea.innerHTML.replace(/
/ig, '\n'); + theSelection = theSelection.replace(//ig, '\n'); + theSelection = theSelection.replace(/<\;/ig, '<'); + theSelection = theSelection.replace(/>\;/ig, '>'); + theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/ \;/ig, ' '); + } else if (document.all) { + theSelection = divarea.innerText; + } else if (divarea.textContent) { + theSelection = divarea.textContent; + } else if (divarea.firstChild.nodeValue) { + theSelection = divarea.firstChild.nodeValue; + } + } + + if (theSelection) { + if (bbcodeEnabled) { + attributes.author = username; + insert_text(generateQuote(theSelection, attributes)); + } else { + insert_text(username + ' ' + l_wrote + ':' + '\n'); + var lines = split_lines(theSelection); + for (i = 0; i < lines.length; i++) { + insert_text('> ' + lines[i] + '\n'); + } + } + } +} + +/** +* Create a quote block for given text +* +* Possible attributes: +* - author: author's name (usually a username) +* - post_id: post_id of the post being quoted +* - user_id: user_id of the user being quoted +* - time: timestamp of the original message +* +* @param {!string} text Quote's text +* @param {!Object} attributes Quote's attributes +* @return {!string} Quote block to be used in a new post/text +*/ +function generateQuote(text, attributes) { + text = text.replace(/^\s+/, '').replace(/\s+$/, ''); + var quote = '[quote'; + if (attributes.author) { + // Add the author as the BBCode's default attribute + quote += '=' + formatAttributeValue(attributes.author); + delete attributes.author; + } + for (var name in attributes) { + if (attributes.hasOwnProperty(name)) { + var value = attributes[name]; + quote += ' ' + name + '=' + formatAttributeValue(value.toString()); + } + } + quote += ']'; + var newline = ((quote + text + '[/quote]').length > 80 || text.indexOf('\n') > -1) ? '\n' : ''; + quote += newline + text + newline + '[/quote]'; + + return quote; +} + +/** +* Format given string to be used as an attribute value +* +* Will return the string as-is if it can be used in a BBCode without quotes. Otherwise, +* it will use either single- or double- quotes depending on whichever requires less escaping. +* Quotes and backslashes are escaped with backslashes where necessary +* +* @param {!string} str Original string +* @return {!string} Same string if possible, escaped string within quotes otherwise +*/ +function formatAttributeValue(str) { + if (!/[ "'\\\]]/.test(str)) { + // Return as-is if it contains none of: space, ' " \ or ] + return str; + } + var singleQuoted = "'" + str.replace(/[\\']/g, '\\$&') + "'", + doubleQuoted = '"' + str.replace(/[\\"]/g, '\\$&') + '"'; + + return (singleQuoted.length < doubleQuoted.length) ? singleQuoted : doubleQuoted; +} + +function split_lines(text) { + var lines = text.split('\n'); + var splitLines = new Array(); + var j = 0; + var i; + + for(i = 0; i < lines.length; i++) { + if (lines[i].length <= 80) { + splitLines[j] = lines[i]; + j++; + } else { + var line = lines[i]; + var splitAt; + do { + splitAt = line.indexOf(' ', 80); + + if (splitAt === -1) { + splitLines[j] = line; + j++; + } else { + splitLines[j] = line.substring(0, splitAt); + line = line.substring(splitAt); + j++; + } + } + while(splitAt !== -1); + } + } + return splitLines; +} + +/** +* From http://www.massless.org/mozedit/ +*/ +function mozWrap(txtarea, open, close) { + var selLength = (typeof(txtarea.textLength) === 'undefined') ? txtarea.value.length : txtarea.textLength; + var selStart = txtarea.selectionStart; + var selEnd = txtarea.selectionEnd; + var scrollTop = txtarea.scrollTop; + + var s1 = (txtarea.value).substring(0,selStart); + var s2 = (txtarea.value).substring(selStart, selEnd); + var s3 = (txtarea.value).substring(selEnd, selLength); + + txtarea.value = s1 + open + s2 + close + s3; + txtarea.selectionStart = selStart + open.length; + txtarea.selectionEnd = selEnd + open.length; + txtarea.focus(); + txtarea.scrollTop = scrollTop; + + return; +} + +/** +* Insert at Caret position. Code from +* http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130 +*/ +function storeCaret(textEl) { + if (textEl.createTextRange && document.selection) { + textEl.caretPos = document.selection.createRange().duplicate(); + } +} + +/** +* Caret Position object +*/ +function caretPosition() { + var start = null; + var end = null; +} + +/** +* Get the caret position in an textarea +*/ +function getCaretPosition(txtarea) { + var caretPos = new caretPosition(); + + // simple Gecko/Opera way + if (txtarea.selectionStart || txtarea.selectionStart === 0) { + caretPos.start = txtarea.selectionStart; + caretPos.end = txtarea.selectionEnd; + } + // dirty and slow IE way + else if (document.selection) { + // get current selection + var range = document.selection.createRange(); + + // a new selection of the whole textarea + var range_all = document.body.createTextRange(); + range_all.moveToElementText(txtarea); + + // calculate selection start point by moving beginning of range_all to beginning of range + var sel_start; + for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) { + range_all.moveStart('character', 1); + } + + txtarea.sel_start = sel_start; + + // we ignore the end value for IE, this is already dirty enough and we don't need it + caretPos.start = txtarea.sel_start; + caretPos.end = txtarea.sel_start; + } + + return caretPos; +} + +/** +* Allow to use tab character when typing code +* Keep indentation of last line of code when typing code +*/ +(function($) { + $(document).ready(function() { + var doc, textarea; + + // find textarea, make sure browser supports necessary functions + if (document.forms[form_name]) { + doc = document; + } else { + doc = opener.document; + } + + if (!doc.forms[form_name]) { + return; + } + + textarea = doc.forms[form_name].elements[text_name]; + + phpbb.applyCodeEditor(textarea); + if ($('#attach-panel').length) { + phpbb.showDragNDrop(textarea); + } + + $('textarea').on('keydown', function (e) { + if (e.which === 13 && (e.metaKey || e.ctrlKey)) { + $(this).closest('form').find(':submit').click(); + } + }); + }); +})(jQuery); + diff --git a/install/update/new/assets/javascript/installer.js b/install/update/new/assets/javascript/installer.js new file mode 100644 index 0000000..a11b76b --- /dev/null +++ b/install/update/new/assets/javascript/installer.js @@ -0,0 +1,615 @@ +/** + * Installer's AJAX frontend handler + */ + +(function($) { // Avoid conflicts with other libraries + 'use strict'; + + // Installer variables + var pollTimer = null; + var nextReadPosition = 0; + var progressBarTriggered = false; + var progressTimer = null; + var currentProgress = 0; + var refreshRequested = false; + var transmissionOver = false; + var statusCount = 0; + + // Template related variables + var $contentWrapper = $('.install-body').find('.main'); + + // Intercept form submits + interceptFormSubmit($('#install_install')); + + /** + * Creates an XHR object + * + * jQuery cannot be used as the response is streamed, and + * as of now, jQuery does not provide access to the response until + * the connection is not closed. + * + * @return XMLHttpRequest + */ + function createXhrObject() { + return new XMLHttpRequest(); + } + + /** + * Displays error, warning and log messages + * + * @param type + * @param messages + */ + function addMessage(type, messages) { + // Get message containers + var $errorContainer = $('#error-container'); + var $warningContainer = $('#warning-container'); + var $logContainer = $('#log-container'); + + var $title, $description, $msgElement, arraySize = messages.length; + for (var i = 0; i < arraySize; i++) { + $msgElement = $('
'); + $title = $(''); + $title.text(messages[i].title); + $msgElement.append($title); + + if (messages[i].hasOwnProperty('description')) { + $description = $('

'); + $description.html(messages[i].description); + $msgElement.append($description); + } + + switch (type) { + case 'error': + $msgElement.addClass('errorbox'); + $errorContainer.append($msgElement); + break; + case 'warning': + $msgElement.addClass('warningbox'); + $warningContainer.append($msgElement); + break; + case 'log': + $msgElement.addClass('log'); + $logContainer.prepend($msgElement); + $logContainer.addClass('show_log_container'); + break; + case 'success': + $msgElement.addClass('successbox'); + $errorContainer.prepend($msgElement); + break; + } + } + } + + /** + * Render a download box + */ + function addDownloadBox(downloadArray) + { + var $downloadContainer = $('#download-wrapper'); + var $downloadBox, $title, $content, $link; + + for (var i = 0; i < downloadArray.length; i++) { + $downloadBox = $('

'); + $downloadBox.addClass('download-box'); + + $title = $(''); + $title.text(downloadArray[i].title); + $downloadBox.append($title); + + if (downloadArray[i].hasOwnProperty('msg')) { + $content = $('

'); + $content.text(downloadArray[i].msg); + $downloadBox.append($content); + } + + $link = $(''); + $link.addClass('button1'); + $link.attr('href', downloadArray[i].href); + $link.text(downloadArray[i].download); + $downloadBox.append($link); + + $downloadContainer.append($downloadBox); + } + } + + /** + * Render update files' status + */ + function addUpdateFileStatus(fileStatus) + { + var $statusContainer = $('#file-status-wrapper'); + $statusContainer.html(fileStatus); + } + + /** + * Displays a form from the response + * + * @param formHtml + */ + function addForm(formHtml) { + var $formContainer = $('#form-wrapper'); + $formContainer.html(formHtml); + var $form = $('#install_install'); + interceptFormSubmit($form); + } + + /** + * Handles navigation status updates + * + * @param navObj + */ + function updateNavbarStatus(navObj) { + var navID, $stage, $stageListItem, $active; + $active = $('#activemenu'); + + if (navObj.hasOwnProperty('finished')) { + // This should be an Array + var navItems = navObj.finished; + + for (var i = 0; i < navItems.length; i++) { + navID = 'installer-stage-' + navItems[i]; + $stage = $('#' + navID); + $stageListItem = $stage.parent(); + + if ($active.length && $active.is($stageListItem)) { + $active.removeAttr('id'); + } + + $stage.addClass('completed'); + } + } + + if (navObj.hasOwnProperty('active')) { + navID = 'installer-stage-' + navObj.active; + $stage = $('#' + navID); + $stageListItem = $stage.parent(); + + if ($active.length && !$active.is($stageListItem)) { + $active.removeAttr('id'); + } + + $stageListItem.attr('id', 'activemenu'); + } + } + + /** + * Renders progress bar + * + * @param progressObject + */ + function setProgress(progressObject) { + var $statusText, $progressBar, $progressText, $progressFiller, $progressFillerText; + + if (progressObject.task_name.length) { + if (!progressBarTriggered) { + // Create progress bar + var $progressBarWrapper = $('#progress-bar-container'); + + // Create progress bar elements + $progressBar = $('

'); + $progressBar.attr('id', 'progress-bar'); + $progressText = $('

'); + $progressText.attr('id', 'progress-bar-text'); + $progressFiller = $('

'); + $progressFiller.attr('id', 'progress-bar-filler'); + $progressFillerText = $('

'); + $progressFillerText.attr('id', 'progress-bar-filler-text'); + + $statusText = $('

'); + $statusText.attr('id', 'progress-status-text'); + + $progressFiller.append($progressFillerText); + $progressBar.append($progressText); + $progressBar.append($progressFiller); + + $progressBarWrapper.append($statusText); + $progressBarWrapper.append($progressBar); + + $progressFillerText.css('width', $progressBar.width()); + + progressBarTriggered = true; + } else if (progressObject.hasOwnProperty('restart')) { + clearInterval(progressTimer); + + $progressFiller = $('#progress-bar-filler'); + $progressFillerText = $('#progress-bar-filler-text'); + $progressText = $('#progress-bar-text'); + $statusText = $('#progress-status-text'); + + $progressText.text('0%'); + $progressFillerText.text('0%'); + $progressFiller.css('width', '0%'); + + currentProgress = 0; + } else { + $statusText = $('#progress-status-text'); + } + + // Update progress bar + $statusText.text(progressObject.task_name + '…'); + incrementProgressBar(Math.round(progressObject.task_num / progressObject.task_count * 100)); + } + } + + // Set cookies + function setCookies(cookies) { + var cookie; + + for (var i = 0; i < cookies.length; i++) { + // Set cookie name and value + cookie = encodeURIComponent(cookies[i].name) + '=' + encodeURIComponent(cookies[i].value); + // Set path + cookie += '; path=/'; + document.cookie = cookie; + } + } + + // Redirects user + function redirect(url, use_ajax) { + if (use_ajax) { + resetPolling(); + + var xhReq = createXhrObject(); + xhReq.open('GET', url, true); + xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhReq.send(); + + startPolling(xhReq); + } else { + window.location.href = url; + } + } + + /** + * Parse messages from the response object + * + * @param messageJSON + */ + function parseMessage(messageJSON) { + $('#loading_indicator').css('display', 'none'); + var responseObject; + + try { + responseObject = JSON.parse(messageJSON); + } catch (err) { + if (window.console) { + console.log('Failed to parse JSON object\n\nMessage: ' + err.message + '\n\nServer Response: ' + messageJSON); + } else { + alert('Failed to parse JSON object\n\nMessage: ' + err.message + '\n\nServer Response: ' + messageJSON); + } + + resetPolling(); + return; + } + + // Parse object + if (responseObject.hasOwnProperty('errors')) { + addMessage('error', responseObject.errors); + } + + if (responseObject.hasOwnProperty('warnings')) { + addMessage('warning', responseObject.warnings); + } + + if (responseObject.hasOwnProperty('logs')) { + addMessage('log', responseObject.logs); + } + + if (responseObject.hasOwnProperty('success')) { + addMessage('success', responseObject.success); + } + + if (responseObject.hasOwnProperty('form')) { + addForm(responseObject.form); + } + + if (responseObject.hasOwnProperty('progress')) { + setProgress(responseObject.progress); + } + + if (responseObject.hasOwnProperty('download')) { + addDownloadBox(responseObject.download); + } + + if (responseObject.hasOwnProperty('file_status')) { + addUpdateFileStatus(responseObject.file_status); + } + + if (responseObject.hasOwnProperty('nav')) { + updateNavbarStatus(responseObject.nav); + } + + if (responseObject.hasOwnProperty('cookies')) { + setCookies(responseObject.cookies); + } + + if (responseObject.hasOwnProperty('refresh')) { + refreshRequested = true; + } + + if (responseObject.hasOwnProperty('redirect')) { + redirect(responseObject.redirect.url, responseObject.redirect.use_ajax); + } + + if (responseObject.hasOwnProperty('over')) { + if (responseObject.over) { + transmissionOver = true; + } + } + } + + /** + * Processes status data + * + * @param status + */ + function processTimeoutResponse(status) { + if (statusCount === 12) { // 1 minute hard cap + status = 'fail'; + } + + if (status === 'continue') { + refreshRequested = false; + doRefresh(); + } else if (status === 'running') { + statusCount++; + $('#loading_indicator').css('display', 'block'); + setTimeout(queryInstallerStatus, 5000); + } else { + $('#loading_indicator').css('display', 'none'); + addMessage('error', + [{ + title: installLang.title, + description: installLang.msg + }] + ); + } + } + + /** + * Queries the installer's status + */ + function queryInstallerStatus() { + var url = $(location).attr('pathname'); + var lookUp = 'install/app.php'; + var position = url.indexOf(lookUp); + + if (position === -1) { + lookUp = 'install'; + position = url.indexOf(lookUp); + + if (position === -1) { + return false; + } + } + + url = url.substring(0, position) + lookUp + '/installer/status'; + $.getJSON(url, function(data) { + processTimeoutResponse(data.status); + }); + } + + /** + * Process updates in streamed response + * + * @param xhReq XHR object + */ + function pollContent(xhReq) { + var messages = xhReq.responseText; + var msgSeparator = '}\n\n'; + var unprocessed, messageEndIndex, endOfMessageIndex, message; + + do { + unprocessed = messages.substring(nextReadPosition); + messageEndIndex = unprocessed.indexOf(msgSeparator); + + if (messageEndIndex !== -1) { + endOfMessageIndex = messageEndIndex + msgSeparator.length; + message = unprocessed.substring(0, endOfMessageIndex); + parseMessage($.trim(message)); + nextReadPosition += endOfMessageIndex; + } + } while (messageEndIndex !== -1); + + if (xhReq.readyState === 4) { + $('#loading_indicator').css('display', 'none'); + resetPolling(); + + var timeoutDetected = !transmissionOver; + + if (refreshRequested) { + refreshRequested = false; + doRefresh(); + } + + if (timeoutDetected) { + statusCount = 0; + queryInstallerStatus(); + } + } + } + + /** + * Animates the progress bar + * + * @param $progressText + * @param $progressFiller + * @param $progressFillerText + * @param progressLimit + */ + function incrementFiller($progressText, $progressFiller, $progressFillerText, progressLimit) { + if (currentProgress >= progressLimit || currentProgress >= 100) { + clearInterval(progressTimer); + return; + } + + var $progressBar = $('#progress-bar'); + + currentProgress++; + $progressFillerText.css('width', $progressBar.width()); + $progressFillerText.text(currentProgress + '%'); + $progressText.text(currentProgress + '%'); + $progressFiller.css('width', currentProgress + '%'); + } + + /** + * Wrapper function for progress bar rendering and animating + * + * @param progressLimit + */ + function incrementProgressBar(progressLimit) { + var $progressFiller = $('#progress-bar-filler'); + var $progressFillerText = $('#progress-bar-filler-text'); + var $progressText = $('#progress-bar-text'); + var progressStart = $progressFiller.width() / $progressFiller.offsetParent().width() * 100; + currentProgress = Math.floor(progressStart); + + clearInterval(progressTimer); + progressTimer = setInterval(function() { + incrementFiller($progressText, $progressFiller, $progressFillerText, progressLimit); + }, 10); + } + + /** + * Resets the polling timer + */ + function resetPolling() { + clearInterval(pollTimer); + nextReadPosition = 0; + } + + /** + * Sets up timer for processing the streamed HTTP response + * + * @param xhReq + */ + function startPolling(xhReq) { + resetPolling(); + transmissionOver = false; + pollTimer = setInterval(function () { + pollContent(xhReq); + }, 250); + } + + /** + * Refresh page + */ + function doRefresh() { + resetPolling(); + + var xhReq = createXhrObject(); + xhReq.open('GET', $(location).attr('pathname'), true); + xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhReq.send(); + + startPolling(xhReq); + } + + /** + * Renders the AJAX UI layout + */ + function setupAjaxLayout() { + progressBarTriggered = false; + + // Clear content + $contentWrapper.html(''); + + var $header = $('

'); + $header.attr('id', 'header-container'); + $contentWrapper.append($header); + + var $description = $('
'); + $description.attr('id', 'description-container'); + $contentWrapper.append($description); + + var $errorContainer = $('
'); + $errorContainer.attr('id', 'error-container'); + $contentWrapper.append($errorContainer); + + var $warningContainer = $('
'); + $warningContainer.attr('id', 'warning-container'); + $contentWrapper.append($warningContainer); + + var $progressContainer = $('
'); + $progressContainer.attr('id', 'progress-bar-container'); + $contentWrapper.append($progressContainer); + + var $logContainer = $('
'); + $logContainer.attr('id', 'log-container'); + $contentWrapper.append($logContainer); + + var $installerContentWrapper = $('
'); + $installerContentWrapper.attr('id', 'content-container'); + $contentWrapper.append($installerContentWrapper); + + var $installerDownloadWrapper = $('
'); + $installerDownloadWrapper.attr('id', 'download-wrapper'); + $installerContentWrapper.append($installerDownloadWrapper); + + var $updaterFileStatusWrapper = $('
'); + $updaterFileStatusWrapper.attr('id', 'file-status-wrapper'); + $installerContentWrapper.append($updaterFileStatusWrapper); + + var $formWrapper = $('
'); + $formWrapper.attr('id', 'form-wrapper'); + $installerContentWrapper.append($formWrapper); + + var $spinner = $('
'); + $spinner.attr('id', 'loading_indicator'); + $spinner.html(' '); + $contentWrapper.append($spinner); + } + + // Submits a form + function submitForm($form, $submitBtn) { + $form.css('display', 'none'); + + var xhReq = createXhrObject(); + xhReq.open('POST', $form.attr('action'), true); + xhReq.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); + xhReq.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); + xhReq.send(getFormFields($form, $submitBtn)); + + // Disable language selector + $('#language_selector :input, label').css('display', 'none'); + + // Clear content + setupAjaxLayout(); + $('#loading_indicator').css('display', 'block'); + + startPolling(xhReq); + } + + /** + * Add submit button to the POST information + * + * @param $form + * @param $submitBtn + * + * @returns {*} + */ + function getFormFields($form, $submitBtn) { + var formData = $form.serialize(); + formData += ((formData.length) ? '&' : '') + encodeURIComponent($submitBtn.attr('name')) + '='; + formData += encodeURIComponent($submitBtn.attr('value')); + + return formData; + } + + /** + * Intercept form submit events and determine the submit button used + * + * @param $form + */ + function interceptFormSubmit($form) { + if (!$form.length) { + return; + } + + $form.find(':submit').bind('click', function (event) { + event.preventDefault(); + submitForm($form, $(this)); + }); + } +})(jQuery); // Avoid conflicts with other libraries diff --git a/install/update/new/assets/javascript/jquery-3.4.1.min.js b/install/update/new/assets/javascript/jquery-3.4.1.min.js new file mode 100644 index 0000000..a1c07fd --- /dev/null +++ b/install/update/new/assets/javascript/jquery-3.4.1.min.js @@ -0,0 +1,2 @@ +/*! jQuery v3.4.1 | (c) JS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],E=C.document,r=Object.getPrototypeOf,s=t.slice,g=t.concat,u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.4.1",k=function(e,t){return new k.fn.init(e,t)},p=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function d(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp($),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+$),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ne=function(e,t,n){var r="0x"+t-65536;return r!=r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(m.childNodes),m.childNodes),t[m.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&((e?e.ownerDocument||e:m)!==C&&T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!A[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&U.test(t)){(s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=k),o=(l=h(t)).length;while(o--)l[o]="#"+s+" "+xe(l[o]);c=l.join(","),f=ee.test(t)&&ye(e.parentNode)||e}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){A(t,!0)}finally{s===k&&e.removeAttribute("id")}}}return g(t.replace(B,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[k]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:m;return r!==C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),m!==C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=k,!C.getElementsByName||!C.getElementsByName(k).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+k+"-]").length||v.push("~="),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+k+"+*").length||v.push(".#.+[+~]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",$)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e===C||e.ownerDocument===m&&y(m,e)?-1:t===C||t.ownerDocument===m&&y(m,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===C?-1:t===C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]===m?-1:s[r]===m?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if((e.ownerDocument||e)!==C&&T(e),d.matchesSelector&&E&&!A[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){A(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=p[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&p(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?k.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?k.grep(e,function(e){return e===n!==r}):"string"!=typeof n?k.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(k.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:L.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof k?t[0]:t,k.merge(this,k.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),D.test(r[1])&&k.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(k):k.makeArray(e,this)}).prototype=k.fn,q=k(E);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}k.fn.extend({has:function(e){var t=k(e,this),n=t.length;return this.filter(function(){for(var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?k.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;nx",y.noCloneChecked=!!me.cloneNode(!0).lastChild.defaultValue;var Te=/^key/,Ce=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ee=/^([^.]*)(?:\.(.+)|)/;function ke(){return!0}function Se(){return!1}function Ne(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function Ae(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)Ae(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Se;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return k().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=k.guid++)),e.each(function(){k.event.add(this,t,i,r,n)})}function De(e,i,o){o?(Q.set(e,i,!1),k.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Q.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(k.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Q.set(this,i,r),t=o(this,i),this[i](),r!==(n=Q.get(this,i))||t?Q.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Q.set(this,i,{value:k.event.trigger(k.extend(r[0],k.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Q.get(e,i)&&k.event.add(e,i,ke)}k.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.get(t);if(v){n.handler&&(n=(o=n).handler,i=o.selector),i&&k.find.matchesSelector(ie,i),n.guid||(n.guid=k.guid++),(u=v.events)||(u=v.events={}),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof k&&k.event.triggered!==e.type?k.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(R)||[""]).length;while(l--)d=g=(s=Ee.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=k.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=k.event.special[d]||{},c=k.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&k.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),k.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Q.hasData(e)&&Q.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(R)||[""]).length;while(l--)if(d=g=(s=Ee.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=k.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||k.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)k.event.remove(e,d+t[l],n,r,!0);k.isEmptyObject(u)&&Q.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=k.event.fix(e),u=new Array(arguments.length),l=(Q.get(this,"events")||{})[s.type]||[],c=k.event.special[s.type]||{};for(u[0]=s,t=1;t\x20\t\r\n\f]*)[^>]*)\/>/gi,qe=/\s*$/g;function Oe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&k(e).children("tbody")[0]||e}function Pe(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Re(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Me(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(Q.hasData(e)&&(o=Q.access(e),a=Q.set(t,o),l=o.events))for(i in delete a.handle,a.events={},l)for(n=0,r=l[i].length;n")},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=oe(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||k.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Vt,Gt=[],Yt=/(=)\?(?=&|$)|\?\?/;k.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Gt.pop()||k.expando+"_"+kt++;return this[e]=!0,e}}),k.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Yt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Yt,"$1"+r):!1!==e.jsonp&&(e.url+=(St.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||k.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?k(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Gt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Vt=E.implementation.createHTMLDocument("").body).innerHTML="
",2===Vt.childNodes.length),k.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=D.exec(e))?[t.createElement(i[1])]:(i=we([e],t,o),o&&o.length&&k(o).remove(),k.merge([],i.childNodes)));var r,i,o},k.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(k.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},k.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){k.fn[t]=function(e){return this.on(t,e)}}),k.expr.pseudos.animated=function(t){return k.grep(k.timers,function(e){return t===e.elem}).length},k.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=k.css(e,"position"),c=k(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=k.css(e,"top"),u=k.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,k.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},k.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){k.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===k.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===k.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=k(e).offset()).top+=k.css(e,"borderTopWidth",!0),i.left+=k.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-k.css(r,"marginTop",!0),left:t.left-i.left-k.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===k.css(e,"position"))e=e.offsetParent;return e||ie})}}),k.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;k.fn[t]=function(e){return _(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),k.each(["top","left"],function(e,n){k.cssHooks[n]=ze(y.pixelPosition,function(e,t){if(t)return t=_e(e,n),$e.test(t)?k(e).position()[n]+"px":t})}),k.each({Height:"height",Width:"width"},function(a,s){k.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){k.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return _(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?k.css(e,t,i):k.style(e,t,n,i)},s,n?e:void 0,n)}})}),k.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){k.fn[n]=function(e,t){return 0 object(property: value). Requires attach_id to be one of the object properties. + */ +phpbb.plupload.setData = function(data) { + // Make sure that the array keys are reset. + phpbb.plupload.ids = phpbb.plupload.data = []; + phpbb.plupload.data = data; + + for (var i = 0; i < data.length; i++) { + phpbb.plupload.ids.push(Number(data[i].attach_id)); + } +}; + +/** + * Update the attachment data in the HTML and the phpbb & phpbb.plupload objects. + * + * @param {Array} data Array containing the new data to use. + * @param {string} action The action that required the update. Used to update the inline attachment bbcodes. + * @param {int} index The index from phpbb.plupload_ids that was affected by the action. + * @param {Array} downloadUrl Optional array of download urls to update. + */ +phpbb.plupload.update = function(data, action, index, downloadUrl) { + + phpbb.plupload.updateBbcode(action, index); + phpbb.plupload.setData(data); + phpbb.plupload.updateRows(downloadUrl); + phpbb.plupload.clearParams(); + phpbb.plupload.updateMultipartParams(phpbb.plupload.getSerializedData()); +}; + +/** + * Update the relevant elements and hidden data for all attachments. + * + * @param {Array} downloadUrl Optional array of download urls to update. + */ +phpbb.plupload.updateRows = function(downloadUrl) { + for (var i = 0; i < phpbb.plupload.ids.length; i++) { + phpbb.plupload.updateRow(i, downloadUrl); + } +}; + +/** + * Insert a row for a new attachment. This expects an HTML snippet in the HTML + * using the id "attach-row-tpl" to be present. This snippet is cloned and the + * data for the file inserted into it. The row is then appended or prepended to + * #file-list based on the attach_order setting. + * + * @param {object} file Plupload file object for the new attachment. + */ +phpbb.plupload.insertRow = function(file) { + var row = $(phpbb.plupload.rowTpl); + + row.attr('id', file.id); + row.find('.file-name').html(plupload.xmlEncode(file.name)); + row.find('.file-size').html(plupload.formatSize(file.size)); + + if (phpbb.plupload.order === 'desc') { + $('#file-list').prepend(row); + } else { + $('#file-list').append(row); + } +}; + +/** + * Update the relevant elements and hidden data for an attachment. + * + * @param {int} index The index from phpbb.plupload.ids of the attachment to edit. + * @param {Array} downloadUrl Optional array of download urls to update. + */ +phpbb.plupload.updateRow = function(index, downloadUrl) { + var attach = phpbb.plupload.data[index], + row = $('[data-attach-id="' + attach.attach_id + '"]'); + + // Add the link to the file + if (typeof downloadUrl !== 'undefined' && typeof downloadUrl[index] !== 'undefined') { + var url = downloadUrl[index].replace('&', '&'), + link = $(''); + + link.attr('href', url).html(attach.real_filename); + row.find('.file-name').html(link); + } + + row.find('textarea').attr('name', 'comment_list[' + index + ']'); + phpbb.plupload.updateHiddenData(row, attach, index); +}; + +/** + * Update hidden input data for an attachment. + * + * @param {object} row jQuery object for the attachment row. + * @param {object} attach Attachment data object from phpbb.plupload.data + * @param {int} index Attachment index from phpbb.plupload.ids + */ +phpbb.plupload.updateHiddenData = function(row, attach, index) { + row.find('input[type="hidden"]').remove(); + + for (var key in attach) { + if (!attach.hasOwnProperty(key)) { + return; + } + + var input = $('') + .attr('type', 'hidden') + .attr('name', 'attachment_data[' + index + '][' + key + ']') + .attr('value', attach[key]); + $(row).append(input); + } +}; + +/** + * Deleting a file removes it from the queue and fires an AJAX event to the + * server to tell it to remove the temporary attachment. The server + * responds with the updated attachment data list so that any future + * uploads can maintain state with the server + * + * @param {object} row jQuery object for the attachment row. + * @param {int} attachId Attachment id of the file to be removed. + */ +phpbb.plupload.deleteFile = function(row, attachId) { + // If there's no attach id, then the file hasn't been uploaded. Simply delete the row. + if (typeof attachId === 'undefined') { + var file = phpbb.plupload.uploader.getFile(row.attr('id')); + phpbb.plupload.uploader.removeFile(file); + + row.slideUp(100, function() { + row.remove(); + phpbb.plupload.hideEmptyList(); + }); + } + + var index = phpbb.plupload.getIndex(attachId); + row.find('.file-status').toggleClass('file-uploaded file-working'); + + if (index === false) { + return; + } + var fields = {}; + fields['delete_file[' + index + ']'] = 1; + + var always = function() { + row.find('.file-status').removeClass('file-working'); + }; + + var done = function(response) { + if (typeof response !== 'object') { + return; + } + + // trigger_error() was called which likely means a permission error was encountered. + if (typeof response.title !== 'undefined') { + phpbb.plupload.uploader.trigger('Error', { message: response.message }); + // We will have to assume that the deletion failed. So leave the file status as uploaded. + row.find('.file-status').toggleClass('file-uploaded'); + + return; + } + + // Handle errors while deleting file + if (typeof response.error !== 'undefined') { + phpbb.alert(phpbb.plupload.lang.ERROR, response.error.message); + + // We will have to assume that the deletion failed. So leave the file status as uploaded. + row.find('.file-status').toggleClass('file-uploaded'); + + return; + } + + phpbb.plupload.update(response, 'removal', index); + // Check if the user can upload files now if he had reached the max files limit. + phpbb.plupload.handleMaxFilesReached(); + + if (row.attr('id')) { + var file = phpbb.plupload.uploader.getFile(row.attr('id')); + phpbb.plupload.uploader.removeFile(file); + } + row.slideUp(100, function() { + row.remove(); + // Hide the file list if it's empty now. + phpbb.plupload.hideEmptyList(); + }); + phpbb.plupload.uploader.trigger('FilesRemoved'); + }; + + $.ajax(phpbb.plupload.config.url, { + type: 'POST', + data: $.extend(fields, phpbb.plupload.getSerializedData()), + headers: phpbb.plupload.config.headers + }) + .always(always) + .done(done); +}; + +/** + * Check the attachment list and hide its container if it's empty. + */ +phpbb.plupload.hideEmptyList = function() { + if (!$('#file-list').children().length) { + $('#file-list-container').slideUp(100); + } +}; + +/** + * Update the indices used in inline attachment bbcodes. This ensures that the + * bbcodes correspond to the correct file after a file is added or removed. + * This should be called before the phpbb.plupload,data and phpbb.plupload.ids + * arrays are updated, otherwise it will not work correctly. + * + * @param {string} action The action that occurred -- either "addition" or "removal" + * @param {int} index The index of the attachment from phpbb.plupload.ids that was affected. + */ +phpbb.plupload.updateBbcode = function(action, index) { + var textarea = $('#message', phpbb.plupload.form), + text = textarea.val(), + removal = (action === 'removal'); + + // Return if the bbcode isn't used at all. + if (text.indexOf('[attachment=') === -1) { + return; + } + + function runUpdate(i) { + var regex = new RegExp('\\[attachment=' + i + '\\](.*?)\\[\\/attachment\\]', 'g'); + text = text.replace(regex, function updateBbcode(_, fileName) { + // Remove the bbcode if the file was removed. + if (removal && index === i) { + return ''; + } + var newIndex = i + ((removal) ? -1 : 1); + return '[attachment=' + newIndex + ']' + fileName + '[/attachment]'; + }); + } + + // Loop forwards when removing and backwards when adding ensures we don't + // corrupt the bbcode index. + var i; + if (removal) { + for (i = index; i < phpbb.plupload.ids.length; i++) { + runUpdate(i); + } + } else { + for (i = phpbb.plupload.ids.length - 1; i >= index; i--) { + runUpdate(i); + } + } + + textarea.val(text); +}; + +/** + * Get Plupload file objects based on their upload status. + * + * @param {int} status Plupload status - plupload.DONE, plupload.FAILED, + * plupload.QUEUED, plupload.STARTED, plupload.STOPPED + * + * @returns {Array} The Plupload file objects matching the status. + */ +phpbb.plupload.getFilesByStatus = function(status) { + var files = []; + + $.each(phpbb.plupload.uploader.files, function(i, file) { + if (file.status === status) { + files.push(file); + } + }); + return files; +}; + +/** + * Check whether the user has reached the maximun number of files that he's allowed + * to upload. If so, disables the uploader and marks the queued files as failed. Otherwise + * makes sure that the uploader is enabled. + * + * @returns {bool} True if the limit has been reached. False if otherwise. + */ +phpbb.plupload.handleMaxFilesReached = function() { + // If there is no limit, the user is an admin or moderator. + if (!phpbb.plupload.maxFiles) { + return false; + } + + if (phpbb.plupload.maxFiles <= phpbb.plupload.ids.length) { + // Fail the rest of the queue. + phpbb.plupload.markQueuedFailed(phpbb.plupload.lang.TOO_MANY_ATTACHMENTS); + // Disable the uploader. + phpbb.plupload.disableUploader(); + phpbb.plupload.uploader.trigger('Error', { message: phpbb.plupload.lang.TOO_MANY_ATTACHMENTS }); + + return true; + } else if (phpbb.plupload.maxFiles > phpbb.plupload.ids.length) { + // Enable the uploader if the user is under the limit + phpbb.plupload.enableUploader(); + } + return false; +}; + +/** + * Disable the uploader + */ +phpbb.plupload.disableUploader = function() { + $('#add_files').addClass('disabled'); + phpbb.plupload.uploader.disableBrowse(); +}; + +/** + * Enable the uploader + */ +phpbb.plupload.enableUploader = function() { + $('#add_files').removeClass('disabled'); + phpbb.plupload.uploader.disableBrowse(false); +}; + +/** + * Mark all queued files as failed. + * + * @param {string} error Error message to present to the user. + */ +phpbb.plupload.markQueuedFailed = function(error) { + var files = phpbb.plupload.getFilesByStatus(plupload.QUEUED); + + $.each(files, function(i, file) { + $('#' + file.id).find('.file-progress').hide(); + phpbb.plupload.fileError(file, error); + }); +}; + +/** + * Marks a file as failed and sets the error message for it. + * + * @param {object} file Plupload file object that failed. + * @param {string} error Error message to present to the user. + */ +phpbb.plupload.fileError = function(file, error) { + file.status = plupload.FAILED; + file.error = error; + $('#' + file.id).find('.file-status') + .addClass('file-error') + .attr({ + 'data-error-title': phpbb.plupload.lang.ERROR, + 'data-error-message': error + }); +}; + + +/** + * Set up the Plupload object and get some basic data. + */ +phpbb.plupload.uploader = new plupload.Uploader(phpbb.plupload.config); +phpbb.plupload.initialize(); + +/** + * Add a file filter to check for max file sizes per mime type. + */ +plupload.addFileFilter('mime_types_max_file_size', function(types, file, callback) { + if (file.size !== 'undefined') { + $(types).each(function(i, type) { + let extensions = [], + extsArray = type.extensions.split(','); + + $(extsArray).each(function(i, extension) { + /^\s*\*\s*$/.test(extension) ? extensions.push("\\.*") : extensions.push("\\." + extension.replace(new RegExp("[" + "/^$.*+?|()[]{}\\".replace(/./g, "\\$&") + "]", "g"), "\\$&")); + }); + + let regex = new RegExp("(" + extensions.join("|") + ")$", "i"); + + if (regex.test(file.name)) { + if (type.max_file_size !== 'undefined' && type.max_file_size) { + if (file.size > type.max_file_size) { + phpbb.plupload.uploader.trigger('Error', { + code: plupload.FILE_SIZE_ERROR, + message: plupload.translate('File size error.'), + file: file + }); + + callback(false); + } else { + callback(true); + } + } else { + callback(true); + } + + return false; + } + }); + } +}); + +var $fileList = $('#file-list'); + +/** + * Insert inline attachment bbcode. + */ +$fileList.on('click', '.file-inline-bbcode', function(e) { + var attachId = $(this).parents('.attach-row').attr('data-attach-id'), + index = phpbb.plupload.getIndex(attachId); + + attachInline(index, phpbb.plupload.data[index].real_filename); + e.preventDefault(); +}); + +/** + * Delete a file. + */ +$fileList.on('click', '.file-delete', function(e) { + var row = $(this).parents('.attach-row'), + attachId = row.attr('data-attach-id'); + + phpbb.plupload.deleteFile(row, attachId); + e.preventDefault(); +}); + +/** + * Display the error message for a particular file when the error icon is clicked. + */ +$fileList.on('click', '.file-error', function(e) { + phpbb.alert($(this).attr('data-error-title'), $(this).attr('data-error-message')); + e.preventDefault(); +}); + +/** + * Fires when an error occurs. + */ +phpbb.plupload.uploader.bind('Error', function(up, error) { + error.file.name = plupload.xmlEncode(error.file.name); + + // The error message that Plupload provides for these is vague, so we'll be more specific. + if (error.code === plupload.FILE_EXTENSION_ERROR) { + error.message = plupload.translate('Invalid file extension:') + ' ' + error.file.name; + } else if (error.code === plupload.FILE_SIZE_ERROR) { + error.message = plupload.translate('File too large:') + ' ' + error.file.name; + } + phpbb.alert(phpbb.plupload.lang.ERROR, error.message); +}); + +/** + * Fires before a given file is about to be uploaded. This allows us to + * send the real filename along with the chunk. This is necessary because + * for some reason the filename is set to 'blob' whenever a file is chunked + * + * @param {object} up The plupload.Uploader object + * @param {object} file The plupload.File object that is about to be uploaded + */ +phpbb.plupload.uploader.bind('BeforeUpload', function(up, file) { + if (phpbb.plupload.handleMaxFilesReached()) { + return; + } + + phpbb.plupload.updateMultipartParams({ real_filename: file.name }); +}); + +/** + * Fired when a single chunk of any given file is uploaded. This parses the + * response from the server and checks for an error. If an error occurs it + * is reported to the user and the upload of this particular file is halted + * + * @param {object} up The plupload.Uploader object + * @param {object} file The plupload.File object whose chunk has just + * been uploaded + * @param {object} response The response object from the server + */ +phpbb.plupload.uploader.bind('ChunkUploaded', function(up, file, response) { + if (response.chunk >= response.chunks - 1) { + return; + } + + var json = {}; + try { + json = $.parseJSON(response.response); + } catch (e) { + file.status = plupload.FAILED; + up.trigger('FileUploaded', file, { + response: JSON.stringify({ + error: { + message: 'Error parsing server response.' + } + }) + }); + } + + // If trigger_error() was called, then a permission error likely occurred. + if (typeof json.title !== 'undefined') { + json.error = { message: json.message }; + } + + if (json.error) { + file.status = plupload.FAILED; + up.trigger('FileUploaded', file, { + response: JSON.stringify({ + error: { + message: json.error.message + } + }) + }); + } +}); + +/** + * Fires when files are added to the queue. + */ +phpbb.plupload.uploader.bind('FilesAdded', function(up, files) { + // Prevent unnecessary requests to the server if the user already uploaded + // the maximum number of files allowed. + if (phpbb.plupload.handleMaxFilesReached()) { + return; + } + + // Switch the active tab if the style supports it + if (typeof activateSubPanel === 'function') { + activateSubPanel('attach-panel'); // jshint ignore: line + } + + // Show the file list if there aren't any files currently. + var $fileListContainer = $('#file-list-container'); + if (!$fileListContainer.is(':visible')) { + $fileListContainer.show(100); + } + + $.each(files, function(i, file) { + phpbb.plupload.insertRow(file); + }); + + up.bind('UploadProgress', function(up, file) { + $('.file-progress-bar', '#' + file.id).css('width', file.percent + '%'); + $('#file-total-progress-bar').css('width', up.total.percent + '%'); + }); + + // Do not allow more files to be added to the running queue. + phpbb.plupload.disableUploader(); + + // Start uploading the files once the user has selected them. + up.start(); +}); + + +/** + * Fires when an entire file has been uploaded. It checks for errors + * returned by the server otherwise parses the list of attachment data and + * appends it to the next file upload so that the server can maintain state + * with regards to the attachments in a given post + * + * @param {object} up The plupload.Uploader object + * @param {object} file The plupload.File object that has just been + * uploaded + * @param {string} response The response string from the server + */ +phpbb.plupload.uploader.bind('FileUploaded', function(up, file, response) { + var json = {}, + row = $('#' + file.id), + error; + + // Hide the progress indicator. + row.find('.file-progress').hide(); + + try { + json = JSON.parse(response.response); + } catch (e) { + error = 'Error parsing server response.'; + } + + // If trigger_error() was called, then a permission error likely occurred. + if (typeof json.title !== 'undefined') { + error = json.message; + up.trigger('Error', { message: error }); + + // The rest of the queue will fail. + phpbb.plupload.markQueuedFailed(error); + } else if (json.error) { + error = json.error.message; + } + + if (typeof error !== 'undefined') { + phpbb.plupload.fileError(file, error); + } else if (file.status === plupload.DONE) { + file.attachment_data = json.data[0]; + + row.attr('data-attach-id', file.attachment_data.attach_id); + row.find('.file-inline-bbcode').show(); + row.find('.file-status').addClass('file-uploaded'); + phpbb.plupload.update(json.data, 'addition', 0, [json.download_url]); + } +}); + +/** + * Fires when the entire queue of files have been uploaded. + */ +phpbb.plupload.uploader.bind('UploadComplete', function() { + // Hide the progress bar + setTimeout(function() { + $('#file-total-progress-bar').fadeOut(500, function() { + $(this).css('width', 0).show(); + }); + }, 2000); + + // Re-enable the uploader + phpbb.plupload.enableUploader(); +}); + +})(jQuery); // Avoid conflicts with other libraries diff --git a/install/update/new/common.php b/install/update/new/common.php new file mode 100644 index 0000000..e25274d --- /dev/null +++ b/install/update/new/common.php @@ -0,0 +1,166 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* Minimum Requirement: PHP 7.1.3 +*/ + +if (!defined('IN_PHPBB')) +{ + exit; +} + +require($phpbb_root_path . 'includes/startup.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); + +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); +$phpbb_class_loader->register(); + +$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); +extract($phpbb_config_php_file->get_all()); + +if (!defined('PHPBB_ENVIRONMENT')) +{ + @define('PHPBB_ENVIRONMENT', 'production'); +} + +if (!defined('PHPBB_INSTALLED')) +{ + // Redirect the user to the installer + require($phpbb_root_path . 'includes/functions.' . $phpEx); + + // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information + // available as used by the redirect function + $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')); + $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'); + $secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 1 : 0; + + if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') + { + $secure = 1; + $server_port = 443; + } + + $script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF'); + if (!$script_name) + { + $script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI'); + } + + // $phpbb_root_path accounts for redirects from e.g. /adm + $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/app.' . $phpEx; + // Replace any number of consecutive backslashes and/or slashes with a single slash + // (could happen on some proxy setups and/or Windows servers) + $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); + + // Eliminate . and .. from the path + require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx); + $phpbb_filesystem = new phpbb\filesystem\filesystem(); + $script_path = $phpbb_filesystem->clean_path($script_path); + + $url = (($secure) ? 'https://' : 'http://') . $server_name; + + if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80))) + { + // HTTP HOST can carry a port number... + if (strpos($server_name, ':') === false) + { + $url .= ':' . $server_port; + } + } + + $url .= $script_path; + header('Location: ' . $url); + exit; +} + +// In case $phpbb_adm_relative_path is not set (in case of an update), use the default. +$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/'; +$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; + +// Include files +require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_content.' . $phpEx); +include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx); + +require($phpbb_root_path . 'includes/constants.' . $phpEx); +require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + +if (PHPBB_ENVIRONMENT === 'development') +{ + \phpbb\debug\debug::enable(); +} +else +{ + set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); +} + +$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); +$phpbb_class_loader_ext->register(); + +// Set up container +try +{ + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); + $phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container(); +} +catch (InvalidArgumentException $e) +{ + if (PHPBB_ENVIRONMENT !== 'development') + { + trigger_error( + 'The requested environment ' . PHPBB_ENVIRONMENT . ' is not available.', + E_USER_ERROR + ); + } + else + { + throw $e; + } +} + +$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); +$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); + +$phpbb_container->get('dbal.conn')->set_debug_sql_explain($phpbb_container->getParameter('debug.sql_explain')); +$phpbb_container->get('dbal.conn')->set_debug_load_time($phpbb_container->getParameter('debug.load_time')); +require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx); + +register_compatibility_globals(); + +// Add own hook handler +require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); +$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); + +/* @var $phpbb_hook_finder \phpbb\hook\finder */ +$phpbb_hook_finder = $phpbb_container->get('hook_finder'); + +foreach ($phpbb_hook_finder->find() as $hook) +{ + @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); +} + +/** +* Main event which is triggered on every page +* +* You can use this event to load function files and initiate objects +* +* NOTE: At this point the global session ($user) and permissions ($auth) +* do NOT exist yet. If you need to use the user object +* (f.e. to include language files) or need to check permissions, +* please use the core.user_setup event instead! +* +* @event core.common +* @since 3.1.0-a1 +*/ +$phpbb_dispatcher->dispatch('core.common'); diff --git a/install/update/new/composer.json b/install/update/new/composer.json new file mode 100644 index 0000000..57c7d74 --- /dev/null +++ b/install/update/new/composer.json @@ -0,0 +1,76 @@ +{ + "name": "phpbb/phpbb", + "description": "phpBB Forum Software application", + "type": "project", + "keywords": ["phpbb", "forum"], + "homepage": "https://www.phpbb.com", + "license": "GPL-2.0-only", + "authors": [ + { + "name": "phpBB Limited", + "email": "operations@phpbb.com", + "homepage": "https://www.phpbb.com/go/authors" + } + ], + "support": { + "issues": "https://tracker.phpbb.com", + "forum": "https://www.phpbb.com/community/", + "wiki": "https://wiki.phpbb.com", + "irc": "irc://irc.freenode.org/phpbb" + }, + "scripts": { + "post-update-cmd": "echo 'You MUST manually modify the clean-vendor-dir target in build/build.xml when adding or upgrading dependencies.'" + }, + "replace": { + "phpbb/phpbb-core": "self.version" + }, + "require": { + "php": "^7.1.3", + "ext-json": "*", + "bantu/ini-get-wrapper": "~1.0", + "google/recaptcha": "~1.1", + "guzzlehttp/guzzle": "~6.3", + "lusitanian/oauth": "^0.8.1", + "marc1706/fast-image-size": "^1.1", + "patchwork/utf8": "^1.1", + "s9e/text-formatter": "^2.0", + "symfony/config": "~3.4", + "symfony/console": "~3.4", + "symfony/debug": "~3.4", + "symfony/dependency-injection": "~3.4", + "symfony/event-dispatcher": "~3.4", + "symfony/filesystem": "~3.4", + "symfony/finder": "~3.4", + "symfony/http-foundation": "~3.4", + "symfony/http-kernel": "~3.4", + "symfony/process": "^3.4", + "symfony/proxy-manager-bridge": "~3.4", + "symfony/routing": "~3.4", + "symfony/twig-bridge": "~3.4", + "symfony/yaml": "~3.4", + "twig/twig": "^1.0 || ^2.0" + }, + "require-dev": { + "fabpot/goutte": "~3.2", + "facebook/webdriver": "~1.6", + "laravel/homestead": "~7.0", + "phing/phing": "~2.4", + "phpunit/dbunit": "~4.0", + "phpunit/phpunit": "^7.0", + "squizlabs/php_codesniffer": "~3.4", + "symfony/browser-kit": "~3.4", + "symfony/css-selector": "~3.4", + "symfony/dom-crawler": "~3.4", + "sami/sami": "^4.1" + }, + "extra": { + "branch-alias": { + "dev-master": "3.3.x-dev" + } + }, + "config": { + "platform": { + "php": "7.1.3" + } + } +} diff --git a/install/update/new/composer.lock b/install/update/new/composer.lock new file mode 100644 index 0000000..272c0fb --- /dev/null +++ b/install/update/new/composer.lock @@ -0,0 +1,4410 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "bbbc187ca0c5d8f13e6358d529412446", + "packages": [ + { + "name": "bantu/ini-get-wrapper", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/bantuXorg/php-ini-get-wrapper.git", + "reference": "4770c7feab370c62e23db4f31c112b7c6d90aee2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bantuXorg/php-ini-get-wrapper/zipball/4770c7feab370c62e23db4f31c112b7c6d90aee2", + "reference": "4770c7feab370c62e23db4f31c112b7c6d90aee2", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "bantu\\IniGetWrapper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Convenience wrapper around ini_get()", + "time": "2014-09-15T13:12:35+00:00" + }, + { + "name": "google/recaptcha", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/google/recaptcha.git", + "reference": "98c4a6573b27e8b0990ea8789c74ea378795134c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/recaptcha/zipball/98c4a6573b27e8b0990ea8789c74ea378795134c", + "reference": "98c4a6573b27e8b0990ea8789c74ea378795134c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.2.20|^2.15", + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7.5.11" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "ReCaptcha\\": "src/ReCaptcha" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Client library for reCAPTCHA, a free service that protects websites from spam and abuse.", + "homepage": "https://www.google.com/recaptcha/", + "keywords": [ + "Abuse", + "captcha", + "recaptcha", + "spam" + ], + "time": "2019-08-16T15:48:25+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.5.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.6.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.1" + }, + "suggest": { + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2019-12-23T11:57:10+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2019-07-01T23:21:34+00:00" + }, + { + "name": "lusitanian/oauth", + "version": "v0.8.11", + "source": { + "type": "git", + "url": "https://github.com/Lusitanian/PHPoAuthLib.git", + "reference": "fc11a53db4b66da555a6a11fce294f574a8374f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/fc11a53db4b66da555a6a11fce294f574a8374f9", + "reference": "fc11a53db4b66da555a6a11fce294f574a8374f9", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*", + "predis/predis": "0.8.*@dev", + "squizlabs/php_codesniffer": "2.*", + "symfony/http-foundation": "~2.1" + }, + "suggest": { + "ext-openssl": "Allows for usage of secure connections with the stream-based HTTP client.", + "predis/predis": "Allows using the Redis storage backend.", + "symfony/http-foundation": "Allows using the Symfony Session storage backend." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.1-dev" + } + }, + "autoload": { + "psr-0": { + "OAuth": "src", + "OAuth\\Unit": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David Desberg", + "email": "david@daviddesberg.com" + }, + { + "name": "Elliot Chance", + "email": "elliotchance@gmail.com" + }, + { + "name": "Pieter Hordijk", + "email": "info@pieterhordijk.com" + } + ], + "description": "PHP 5.3+ oAuth 1/2 Library", + "keywords": [ + "Authentication", + "authorization", + "oauth", + "security" + ], + "time": "2016-07-12T22:15:00+00:00" + }, + { + "name": "marc1706/fast-image-size", + "version": "v1.1.6", + "source": { + "type": "git", + "url": "https://github.com/marc1706/fast-image-size.git", + "reference": "3a3a2b036be20f43fa06ce00dfa754df503e6684" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/marc1706/fast-image-size/zipball/3a3a2b036be20f43fa06ce00dfa754df503e6684", + "reference": "3a3a2b036be20f43fa06ce00dfa754df503e6684", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "FastImageSize\\": "lib", + "FastImageSize\\tests\\": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marc Alexander", + "email": "admin@m-a-styles.de", + "homepage": "https://www.m-a-styles.de", + "role": "Developer" + } + ], + "description": "fast-image-size is a PHP library that does almost everything PHP's getimagesize() does but without the large overhead of downloading the complete file.", + "homepage": "https://www.m-a-styles.de", + "keywords": [ + "fast", + "getimagesize", + "image", + "imagesize", + "php", + "size" + ], + "time": "2019-12-07T08:02:07+00:00" + }, + { + "name": "ocramius/package-versions", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0.0", + "php": "^7.1.0" + }, + "require-dev": { + "composer/composer": "^1.6.3", + "doctrine/coding-standard": "^5.0.1", + "ext-zip": "*", + "infection/infection": "^0.7.1", + "phpunit/phpunit": "^7.5.17" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "time": "2019-11-15T16:17:10+00:00" + }, + { + "name": "ocramius/proxy-manager", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/ProxyManager.git", + "reference": "e18ac876b2e4819c76349de8f78ccc8ef1554cd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/e18ac876b2e4819c76349de8f78ccc8ef1554cd7", + "reference": "e18ac876b2e4819c76349de8f78ccc8ef1554cd7", + "shasum": "" + }, + "require": { + "ocramius/package-versions": "^1.1.1", + "php": "^7.1.0", + "zendframework/zend-code": "^3.1.0" + }, + "require-dev": { + "couscous/couscous": "^1.5.2", + "ext-phar": "*", + "humbug/humbug": "dev-master@DEV", + "nikic/php-parser": "^3.0.4", + "phpbench/phpbench": "^0.12.2", + "phpstan/phpstan": "^0.6.4", + "phpunit/phpunit": "^5.6.4", + "phpunit/phpunit-mock-objects": "^3.4.1", + "squizlabs/php_codesniffer": "^2.7.0" + }, + "suggest": { + "ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects", + "zendframework/zend-json": "To have the JsonRpc adapter (Remote Object feature)", + "zendframework/zend-soap": "To have the Soap adapter (Remote Object feature)", + "zendframework/zend-xmlrpc": "To have the XmlRpc adapter (Remote Object feature)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "ProxyManager\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.io/" + } + ], + "description": "A library providing utilities to generate, instantiate and generally operate with Object Proxies", + "homepage": "https://github.com/Ocramius/ProxyManager", + "keywords": [ + "aop", + "lazy loading", + "proxy", + "proxy pattern", + "service proxies" + ], + "time": "2017-05-04T11:12:50+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.99", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "shasum": "" + }, + "require": { + "php": "^7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "time": "2018-07-02T15:55:56+00:00" + }, + { + "name": "patchwork/utf8", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/tchwork/utf8.git", + "reference": "d296e0026e7ce10b2a9fe594feca9628ef00e9e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tchwork/utf8/zipball/d296e0026e7ce10b2a9fe594feca9628ef00e9e8", + "reference": "d296e0026e7ce10b2a9fe594feca9628ef00e9e8", + "shasum": "" + }, + "require": { + "lib-pcre": ">=7.3", + "php": ">=5.3.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.4|^4.4" + }, + "suggest": { + "ext-iconv": "Use iconv for best performance", + "ext-intl": "Use Intl for best performance", + "ext-mbstring": "Use Mbstring for best performance", + "ext-wfio": "Use WFIO for UTF-8 filesystem access on Windows" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Patchwork\\": "src/Patchwork/" + }, + "classmap": [ + "src/Normalizer.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "(Apache-2.0 or GPL-2.0)" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + } + ], + "description": "Portable and performant UTF-8, Unicode and Grapheme Clusters for PHP", + "homepage": "https://github.com/tchwork/utf8", + "keywords": [ + "grapheme", + "i18n", + "unicode", + "utf-8", + "utf8" + ], + "time": "2019-12-03T14:44:12+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2019-11-01T11:05:21+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "s9e/regexp-builder", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/s9e/RegexpBuilder.git", + "reference": "59d0167a909659d718f53964f7653d2c83a5f8fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/s9e/RegexpBuilder/zipball/59d0167a909659d718f53964f7653d2c83a5f8fe", + "reference": "59d0167a909659d718f53964f7653d2c83a5f8fe", + "shasum": "" + }, + "require": { + "lib-pcre": ">=7.2", + "php": ">=5.5.1" + }, + "require-dev": { + "phpunit/phpunit": "<5.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "s9e\\RegexpBuilder\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Single-purpose library that generates regular expressions that match a list of strings.", + "homepage": "https://github.com/s9e/RegexpBuilder/", + "keywords": [ + "regexp" + ], + "time": "2019-04-26T17:55:23+00:00" + }, + { + "name": "s9e/text-formatter", + "version": "2.3.1", + "source": { + "type": "git", + "url": "https://github.com/s9e/TextFormatter.git", + "reference": "65a0605f163b8ffcf7145357f167b153f31cd168" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/65a0605f163b8ffcf7145357f167b153f31cd168", + "reference": "65a0605f163b8ffcf7145357f167b153f31cd168", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-filter": "*", + "lib-pcre": ">=8.13", + "php": ">=7.1", + "s9e/regexp-builder": "^1.4" + }, + "require-dev": { + "matthiasmullie/minify": "*", + "phpunit/phpunit": "^7 || 8.2.*" + }, + "suggest": { + "ext-curl": "Improves the performance of the MediaEmbed plugin and some JavaScript minifiers", + "ext-intl": "Allows international URLs to be accepted by the URL filter", + "ext-json": "Enables the generation of a JavaScript parser", + "ext-mbstring": "Improves the performance of the PHP renderer", + "ext-tokenizer": "Improves the performance of the PHP renderer", + "ext-xsl": "Enables the XSLT renderer", + "ext-zlib": "Enables gzip compression when scraping content via the MediaEmbed plugin" + }, + "type": "library", + "extra": { + "version": "2.3.1" + }, + "autoload": { + "psr-4": { + "s9e\\TextFormatter\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Multi-purpose text formatting and markup library. Plugins offer support for BBCodes, Markdown, emoticons, HTML, embedding media (YouTube, etc...), enhanced typography and more.", + "homepage": "https://github.com/s9e/TextFormatter/", + "keywords": [ + "bbcode", + "bbcodes", + "blog", + "censor", + "embed", + "emoji", + "emoticons", + "engine", + "forum", + "html", + "markdown", + "markup", + "media", + "parser", + "shortcodes" + ], + "time": "2019-12-26T19:14:01+00:00" + }, + { + "name": "symfony/config", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "a599a867d0e4a07c342b5f1e656b3915a540ddbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/a599a867d0e4a07c342b5f1e656b3915a540ddbe", + "reference": "a599a867d0e4a07c342b5f1e656b3915a540ddbe", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/filesystem": "~2.8|~3.0|~4.0", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" + }, + "require-dev": { + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/event-dispatcher": "~3.3|~4.0", + "symfony/finder": "~3.3|~4.0", + "symfony/yaml": "~3.0|~4.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2019-12-01T10:45:41+00:00" + }, + { + "name": "symfony/console", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "1ee23b3b659b06c622f2bd2492a229e416eb4586" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/1ee23b3b659b06c622f2bd2492a229e416eb4586", + "reference": "1ee23b3b659b06c622f2bd2492a229e416eb4586", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2019-12-01T10:04:45+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "f72e33fdb1170b326e72c3157f0cd456351dd086" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/f72e33fdb1170b326e72c3157f0cd456351dd086", + "reference": "f72e33fdb1170b326e72c3157f0cd456351dd086", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2019-10-24T15:33:53+00:00" + }, + { + "name": "symfony/dependency-injection", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "0d201916bfb3af939fec3c0c8815ea16c60ac1a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/0d201916bfb3af939fec3c0c8815ea16c60ac1a2", + "reference": "0d201916bfb3af939fec3c0c8815ea16c60ac1a2", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/container": "^1.0" + }, + "conflict": { + "symfony/config": "<3.3.7", + "symfony/finder": "<3.3", + "symfony/proxy-manager-bridge": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "psr/container-implementation": "1.0" + }, + "require-dev": { + "symfony/config": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DependencyInjection\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "https://symfony.com", + "time": "2019-12-01T08:33:36+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "f9031c22ec127d4a2450760f81a8677fe8a10177" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f9031c22ec127d4a2450760f81a8677fe8a10177", + "reference": "f9031c22ec127d4a2450760f81a8677fe8a10177", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2019-10-24T15:33:53+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "00cdad0936d06fab136944bc2342b762b1c3a4a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/00cdad0936d06fab136944bc2342b762b1c3a4a2", + "reference": "00cdad0936d06fab136944bc2342b762b1c3a4a2", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2019-11-25T16:36:22+00:00" + }, + { + "name": "symfony/finder", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "290ae21279b37bfd287cdcce640d51204e84afdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/290ae21279b37bfd287cdcce640d51204e84afdf", + "reference": "290ae21279b37bfd287cdcce640d51204e84afdf", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2019-11-17T21:55:15+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "d2d0cfe8e319d9df44c4cca570710fcf221d4593" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d2d0cfe8e319d9df44c4cca570710fcf221d4593", + "reference": "d2d0cfe8e319d9df44c4cca570710fcf221d4593", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php70": "~1.6" + }, + "require-dev": { + "symfony/expression-language": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2019-11-28T12:52:59+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "c42c8339acb28cfff0fb1786948db4d23d609ff7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/c42c8339acb28cfff0fb1786948db4d23d609ff7", + "reference": "c42c8339acb28cfff0fb1786948db4d23d609ff7", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0", + "symfony/debug": "^3.3.3|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php56": "~1.8" + }, + "conflict": { + "symfony/config": "<2.8", + "symfony/dependency-injection": "<3.4.10|<4.0.10,>=4", + "symfony/var-dumper": "<3.3", + "twig/twig": "<1.34|<2.4,>=2" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/cache": "~1.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", + "symfony/class-loader": "~2.8|~3.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/console": "~2.8|~3.0|~4.0", + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "^3.4.10|^4.0.10", + "symfony/dom-crawler": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/finder": "", + "symfony/var-dumper": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com", + "time": "2019-12-01T13:50:37+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T14:18:11+00:00" + }, + { + "name": "symfony/polyfill-php56", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "53dd1cdf3cb986893ccf2b96665b25b3abb384f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/53dd1cdf3cb986893ccf2b96665b25b3abb384f4", + "reference": "53dd1cdf3cb986893ccf2b96665b25b3abb384f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "af23c7bb26a73b850840823662dda371484926c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4", + "reference": "af23c7bb26a73b850840823662dda371484926c4", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0|~9.99", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/polyfill-util", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "964a67f293b66b95883a5ed918a65354fcd2258f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/964a67f293b66b95883a5ed918a65354fcd2258f", + "reference": "964a67f293b66b95883a5ed918a65354fcd2258f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Util\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony utilities for portability of PHP codes", + "homepage": "https://symfony.com", + "keywords": [ + "compat", + "compatibility", + "polyfill", + "shim" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/process", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "9a4545c01e1e4f473492bd52b71e574dcc401ca2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/9a4545c01e1e4f473492bd52b71e574dcc401ca2", + "reference": "9a4545c01e1e4f473492bd52b71e574dcc401ca2", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2019-11-28T10:05:51+00:00" + }, + { + "name": "symfony/proxy-manager-bridge", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/proxy-manager-bridge.git", + "reference": "3c185a0e45ea13334aaf7b0fa9726922816ebec6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/3c185a0e45ea13334aaf7b0fa9726922816ebec6", + "reference": "3c185a0e45ea13334aaf7b0fa9726922816ebec6", + "shasum": "" + }, + "require": { + "ocramius/proxy-manager": "~0.4|~1.0|~2.0", + "php": "^5.5.9|>=7.0.8", + "symfony/dependency-injection": "~3.4|~4.0" + }, + "require-dev": { + "symfony/config": "~2.8|~3.0|~4.0" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\ProxyManager\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony ProxyManager Bridge", + "homepage": "https://symfony.com", + "time": "2019-08-29T14:54:55+00:00" + }, + { + "name": "symfony/routing", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "b689ccd48e234ea404806d94b07eeb45f9f6f06a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/b689ccd48e234ea404806d94b07eeb45f9f6f06a", + "reference": "b689ccd48e234ea404806d94b07eeb45f9f6f06a", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/config": "<3.3.1", + "symfony/dependency-injection": "<3.3", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "psr/log": "~1.0", + "symfony/config": "^3.3.1|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2019-12-01T08:33:36+00:00" + }, + { + "name": "symfony/twig-bridge", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-bridge.git", + "reference": "49b824ddc7f2d250a1f172349cd9a111d63287c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/49b824ddc7f2d250a1f172349cd9a111d63287c0", + "reference": "49b824ddc7f2d250a1f172349cd9a111d63287c0", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "twig/twig": "^1.41|^2.10" + }, + "conflict": { + "symfony/console": "<3.4", + "symfony/form": "<3.4.31|>=4.0,<4.3.4" + }, + "require-dev": { + "fig/link-util": "^1.0", + "symfony/asset": "~2.8|~3.0|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/form": "^3.4.31|^4.3.4", + "symfony/http-foundation": "^3.3.11|~4.0", + "symfony/http-kernel": "~3.2|~4.0", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/routing": "~2.8|~3.0|~4.0", + "symfony/security": "^2.8.31|^3.3.13|~4.0", + "symfony/security-acl": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2|~4.0", + "symfony/web-link": "~3.3|~4.0", + "symfony/workflow": "~3.3|~4.0", + "symfony/yaml": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/asset": "For using the AssetExtension", + "symfony/expression-language": "For using the ExpressionExtension", + "symfony/finder": "", + "symfony/form": "For using the FormExtension", + "symfony/http-kernel": "For using the HttpKernelExtension", + "symfony/routing": "For using the RoutingExtension", + "symfony/security": "For using the SecurityExtension", + "symfony/stopwatch": "For using the StopwatchExtension", + "symfony/templating": "For using the TwigEngine", + "symfony/translation": "For using the TranslationExtension", + "symfony/var-dumper": "For using the DumpExtension", + "symfony/web-link": "For using the WebLinkExtension", + "symfony/yaml": "For using the YamlExtension" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\Twig\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Twig Bridge", + "homepage": "https://symfony.com", + "time": "2019-11-30T08:19:08+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "dab657db15207879217fc81df4f875947bf68804" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/dab657db15207879217fc81df4f875947bf68804", + "reference": "dab657db15207879217fc81df4f875947bf68804", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2019-10-24T15:33:53+00:00" + }, + { + "name": "twig/twig", + "version": "v2.12.2", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed", + "reference": "d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed", + "shasum": "" + }, + "require": { + "php": "^7.0", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "^3.4|^4.2", + "symfony/phpunit-bridge": "^4.4@dev|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.12-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "homepage": "https://twig.symfony.com/contributors", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "time": "2019-11-11T16:52:09+00:00" + }, + { + "name": "zendframework/zend-code", + "version": "3.4.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-code.git", + "reference": "268040548f92c2bfcba164421c1add2ba43abaaa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-code/zipball/268040548f92c2bfcba164421c1add2ba43abaaa", + "reference": "268040548f92c2bfcba164421c1add2ba43abaaa", + "shasum": "" + }, + "require": { + "php": "^7.1", + "zendframework/zend-eventmanager": "^2.6 || ^3.0" + }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, + "require-dev": { + "doctrine/annotations": "^1.7", + "ext-phar": "*", + "phpunit/phpunit": "^7.5.16 || ^8.4", + "zendframework/zend-coding-standard": "^1.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "suggest": { + "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", + "zendframework/zend-stdlib": "Zend\\Stdlib component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4.x-dev", + "dev-develop": "3.5.x-dev", + "dev-dev-4.0": "4.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Code\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Extensions to the PHP Reflection API, static code scanning, and code generation", + "keywords": [ + "ZendFramework", + "code", + "zf" + ], + "time": "2019-12-10T19:21:15+00:00" + }, + { + "name": "zendframework/zend-eventmanager", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-eventmanager.git", + "reference": "a5e2583a211f73604691586b8406ff7296a946dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/a5e2583a211f73604691586b8406ff7296a946dd", + "reference": "a5e2583a211f73604691586b8406ff7296a946dd", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "^0.1", + "container-interop/container-interop": "^1.1.0", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0" + }, + "suggest": { + "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev", + "dev-develop": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\EventManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Trigger and listen to events within a PHP application", + "homepage": "https://github.com/zendframework/zend-eventmanager", + "keywords": [ + "event", + "eventmanager", + "events", + "zf2" + ], + "time": "2018-04-25T15:33:34+00:00" + } + ], + "packages-dev": [ + { + "name": "blackfire/php-sdk", + "version": "v1.21.0", + "source": { + "type": "git", + "url": "https://github.com/blackfireio/php-sdk.git", + "reference": "1aa41771641ac268c5a2a0fc520e0da0e1f6698a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/blackfireio/php-sdk/zipball/1aa41771641ac268c5a2a0fc520e0da0e1f6698a", + "reference": "1aa41771641ac268c5a2a0fc520e0da0e1f6698a", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "php": ">=5.2.0" + }, + "require-dev": { + "symfony/http-client": "^4.3" + }, + "suggest": { + "ext-blackfire": "The C version of the Blackfire probe", + "ext-zlib": "To push config to remote profiling targets" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.5.x-dev" + } + }, + "autoload": { + "files": [ + "src/autostart.php" + ], + "psr-4": { + "Blackfire\\": "src/Blackfire" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Blackfire.io", + "email": "support@blackfire.io" + } + ], + "description": "Blackfire.io PHP SDK", + "keywords": [ + "performance", + "profiler", + "uprofiler", + "xhprof" + ], + "time": "2019-12-05T12:48:12+00:00" + }, + { + "name": "composer/ca-bundle", + "version": "1.2.5", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/62e8fc2dc550e5d6d8c9360c7721662670f58149", + "reference": "62e8fc2dc550e5d6d8c9360c7721662670f58149", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8", + "psr/log": "^1.0", + "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "time": "2019-12-11T14:44:42+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/ae466f726242e637cebdd526a7d991b9433bacf1", + "reference": "ae466f726242e637cebdd526a7d991b9433bacf1", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "doctrine/coding-standard": "^6.0", + "ext-pdo": "*", + "ext-phar": "*", + "phpbench/phpbench": "^0.13", + "phpstan/phpstan-phpunit": "^0.11", + "phpstan/phpstan-shim": "^0.11", + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://www.doctrine-project.org/projects/instantiator.html", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2019-10-21T16:45:58+00:00" + }, + { + "name": "fabpot/goutte", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/Goutte.git", + "reference": "3f0eaf0a40181359470651f1565b3e07e3dd31b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/Goutte/zipball/3f0eaf0a40181359470651f1565b3e07e3dd31b8", + "reference": "3f0eaf0a40181359470651f1565b3e07e3dd31b8", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "^6.0", + "php": ">=5.5.0", + "symfony/browser-kit": "~2.1|~3.0|~4.0", + "symfony/css-selector": "~2.1|~3.0|~4.0", + "symfony/dom-crawler": "~2.1|~3.0|~4.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.3 || ^4" + }, + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Goutte\\": "Goutte" + }, + "exclude-from-classmap": [ + "Goutte/Tests" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A simple PHP Web Scraper", + "homepage": "https://github.com/FriendsOfPHP/Goutte", + "keywords": [ + "scraper" + ], + "time": "2018-06-29T15:13:57+00:00" + }, + { + "name": "facebook/webdriver", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/facebook/php-webdriver.git", + "reference": "e43de70f3c7166169d0f14a374505392734160e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/e43de70f3c7166169d0f14a374505392734160e5", + "reference": "e43de70f3c7166169d0f14a374505392734160e5", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "ext-zip": "*", + "php": "^5.6 || ~7.0", + "symfony/process": "^2.8 || ^3.1 || ^4.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "jakub-onderka/php-parallel-lint": "^0.9.2", + "php-coveralls/php-coveralls": "^2.0", + "php-mock/php-mock-phpunit": "^1.1", + "phpunit/phpunit": "^5.7", + "sebastian/environment": "^1.3.4 || ^2.0 || ^3.0", + "squizlabs/php_codesniffer": "^2.6", + "symfony/var-dumper": "^3.3 || ^4.0" + }, + "suggest": { + "ext-SimpleXML": "For Firefox profile creation" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-community": "1.5-dev" + } + }, + "autoload": { + "psr-4": { + "Facebook\\WebDriver\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "A PHP client for Selenium WebDriver", + "homepage": "https://github.com/facebook/php-webdriver", + "keywords": [ + "facebook", + "php", + "selenium", + "webdriver" + ], + "time": "2019-06-13T08:02:18+00:00" + }, + { + "name": "laravel/homestead", + "version": "v7.20.0", + "source": { + "type": "git", + "url": "https://github.com/laravel/homestead.git", + "reference": "cae38adcfdde1de1c4581e7a33872adaf9fbf926" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/homestead/zipball/cae38adcfdde1de1c4581e7a33872adaf9fbf926", + "reference": "cae38adcfdde1de1c4581e7a33872adaf9fbf926", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0", + "symfony/console": "~3.3|~4.0", + "symfony/process": "~3.3|~4.0", + "symfony/yaml": "~3.3|~4.0" + }, + "require-dev": { + "phly/changelog-generator": "^2.2", + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "bin": [ + "bin/homestead" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Laravel\\Homestead\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + } + ], + "description": "A virtual machine for web artisans.", + "time": "2018-12-11T02:04:35+00:00" + }, + { + "name": "michelf/php-markdown", + "version": "1.9.0", + "source": { + "type": "git", + "url": "https://github.com/michelf/php-markdown.git", + "reference": "c83178d49e372ca967d1a8c77ae4e051b3a3c75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/c83178d49e372ca967d1a8c77ae4e051b3a3c75c", + "reference": "c83178d49e372ca967d1a8c77ae4e051b3a3c75c", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": ">=4.3 <5.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Michelf\\": "Michelf/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Michel Fortin", + "email": "michel.fortin@michelf.ca", + "homepage": "https://michelf.ca/", + "role": "Developer" + }, + { + "name": "John Gruber", + "homepage": "https://daringfireball.net/" + } + ], + "description": "PHP Markdown", + "homepage": "https://michelf.ca/projects/php-markdown/", + "keywords": [ + "markdown" + ], + "time": "2019-12-02T02:32:27+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.9.4", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/579bb7356d91f9456ccd505f24ca8b667966a0a7", + "reference": "579bb7356d91f9456ccd505f24ca8b667966a0a7", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "replace": { + "myclabs/deep-copy": "self.version" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2019-12-15T19:12:40+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2018-02-28T20:30:58+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^2.0", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2018-07-08T19:23:20+00:00" + }, + { + "name": "phar-io/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2018-07-08T19:19:57+00:00" + }, + { + "name": "phing/phing", + "version": "2.16.1", + "source": { + "type": "git", + "url": "https://github.com/phingofficial/phing.git", + "reference": "cbe0f969e434e269af91b4160b86fe899c6e07c7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phingofficial/phing/zipball/cbe0f969e434e269af91b4160b86fe899c6e07c7", + "reference": "cbe0f969e434e269af91b4160b86fe899c6e07c7", + "shasum": "" + }, + "require": { + "php": ">=5.2.0", + "symfony/yaml": "^3.1 || ^4.0" + }, + "require-dev": { + "ext-pdo_sqlite": "*", + "mikey179/vfsstream": "^1.6", + "pdepend/pdepend": "2.x", + "pear/archive_tar": "1.4.x", + "pear/http_request2": "dev-trunk", + "pear/net_growl": "dev-trunk", + "pear/pear-core-minimal": "1.10.1", + "pear/versioncontrol_git": "@dev", + "pear/versioncontrol_svn": "~0.5", + "phpdocumentor/phpdocumentor": "2.x", + "phploc/phploc": "~2.0.6", + "phpmd/phpmd": "~2.2", + "phpunit/phpunit": ">=3.7", + "sebastian/git": "~1.0", + "sebastian/phpcpd": "2.x", + "siad007/versioncontrol_hg": "^1.0", + "simpletest/simpletest": "^1.1", + "squizlabs/php_codesniffer": "~2.2" + }, + "suggest": { + "pdepend/pdepend": "PHP version of JDepend", + "pear/archive_tar": "Tar file management class", + "pear/versioncontrol_git": "A library that provides OO interface to handle Git repository", + "pear/versioncontrol_svn": "A simple OO-style interface for Subversion, the free/open-source version control system", + "phpdocumentor/phpdocumentor": "Documentation Generator for PHP", + "phploc/phploc": "A tool for quickly measuring the size of a PHP project", + "phpmd/phpmd": "PHP version of PMD tool", + "phpunit/php-code-coverage": "Library that provides collection, processing, and rendering functionality for PHP code coverage information", + "phpunit/phpunit": "The PHP Unit Testing Framework", + "sebastian/phpcpd": "Copy/Paste Detector (CPD) for PHP code", + "siad007/versioncontrol_hg": "A library for interfacing with Mercurial repositories.", + "tedivm/jshrink": "Javascript Minifier built in PHP" + }, + "bin": [ + "bin/phing" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.16.x-dev" + } + }, + "autoload": { + "classmap": [ + "classes/phing/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "classes" + ], + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Michiel Rook", + "email": "mrook@php.net" + }, + { + "name": "Phing Community", + "homepage": "https://www.phing.info/trac/wiki/Development/Contributors" + } + ], + "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.", + "homepage": "https://www.phing.info/", + "keywords": [ + "build", + "phing", + "task", + "tool" + ], + "time": "2018-01-25T13:18:09+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2016-01-25T08:17:30+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.10.1", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/cbe1df668b3fe136bcc909126a0f529a78d4cbbc", + "reference": "cbe1df668b3fe136bcc909126a0f529a78d4cbbc", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", + "sebastian/comparator": "^1.2.3|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5 || ^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10.x-dev" + } + }, + "autoload": { + "psr-4": { + "Prophecy\\": "src/Prophecy" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2019-12-22T21:05:45+00:00" + }, + { + "name": "phpunit/dbunit", + "version": "4.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/dbunit.git", + "reference": "e77b469c3962b5a563f09a2a989f1c9bd38b8615" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/dbunit/zipball/e77b469c3962b5a563f09a2a989f1c9bd38b8615", + "reference": "e77b469c3962b5a563f09a2a989f1c9bd38b8615", + "shasum": "" + }, + "require": { + "ext-pdo": "*", + "ext-simplexml": "*", + "php": "^7.1", + "phpunit/phpunit": "^7.0", + "symfony/yaml": "^3.0 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "PHPUnit extension for database interaction testing", + "homepage": "https://github.com/sebastianbergmann/dbunit/", + "keywords": [ + "database", + "testing", + "xunit" + ], + "abandoned": true, + "time": "2018-02-07T06:47:59+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "reference": "807e6013b00af69b6c5d9ceb4282d0393dbb9d8d", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^2.0", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1 || ^4.0", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2018-10-31T16:06:48+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "050bedf145a257b1ff02746c31894800e5122946" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", + "reference": "050bedf145a257b1ff02746c31894800e5122946", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2018-09-13T20:33:42+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/1038454804406b0b5f5f520358e78c1c2f71501e", + "reference": "1038454804406b0b5f5f520358e78c1c2f71501e", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2019-06-07T04:22:29+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/995192df77f63a59e47f025390d2d1fdf8f425ff", + "reference": "995192df77f63a59e47f025390d2d1fdf8f425ff", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2019-09-17T06:23:10+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.5.18", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "fcf6c4bfafaadc07785528b06385cce88935474d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fcf6c4bfafaadc07785528b06385cce88935474d", + "reference": "fcf6c4bfafaadc07785528b06385cce88935474d", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.1", + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.7", + "phar-io/manifest": "^1.0.2", + "phar-io/version": "^2.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.7", + "phpunit/php-file-iterator": "^2.0.1", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^4.0", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^2.0", + "sebastian/version": "^2.0.1" + }, + "conflict": { + "phpunit/phpunit-mock-objects": "*" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-soap": "*", + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.5-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2019-12-06T05:14:37+00:00" + }, + { + "name": "pimple/pimple", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2018-01-21T07:42:36+00:00" + }, + { + "name": "sami/sami", + "version": "v4.1.2", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/Sami.git", + "reference": "19b8a82b858bd31544c468317c8307188ccb4022" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/Sami/zipball/19b8a82b858bd31544c468317c8307188ccb4022", + "reference": "19b8a82b858bd31544c468317c8307188ccb4022", + "shasum": "" + }, + "require": { + "blackfire/php-sdk": "^1.5.18", + "michelf/php-markdown": "~1.3", + "nikic/php-parser": "~3.0", + "php": "^7.1.3", + "phpdocumentor/reflection-docblock": "~2.0", + "pimple/pimple": "~3.0", + "symfony/console": "~3.0|~4.0", + "symfony/filesystem": "~3.0|~4.0", + "symfony/finder": "~3.0|~4.0", + "symfony/process": "~3.0|~4.0", + "symfony/yaml": "~3.0|~4.0", + "twig/twig": "~2.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "~4.0" + }, + "bin": [ + "sami.php" + ], + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "4.1-dev" + } + }, + "autoload": { + "psr-4": { + "Sami\\": "Sami/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Sami, an API documentation generator", + "homepage": "http://sami.sensiolabs.org", + "keywords": [ + "phpdoc" + ], + "abandoned": true, + "time": "2018-07-02T13:20:39+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-07-12T15:12:46+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5 || ^8.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2019-02-04T06:01:07+00:00" + }, + { + "name": "sebastian/environment", + "version": "4.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "reference": "464c90d7bdf5ad4e8a6aea15c091fec0603d4368", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.5" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2019-11-20T08:46:58+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/68609e1261d215ea5b21b7987539cbfbe156ec3e", + "reference": "68609e1261d215ea5b21b7987539cbfbe156ec3e", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2019-09-14T09:02:43+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2018-10-04T04:07:39+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.5.3", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", + "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2019-12-04T04:46:47+00:00" + }, + { + "name": "symfony/browser-kit", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/browser-kit.git", + "reference": "2e4c991e27a97a8c27745720b030ff85a5cebdf6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/2e4c991e27a97a8c27745720b030ff85a5cebdf6", + "reference": "2e4c991e27a97a8c27745720b030ff85a5cebdf6", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/dom-crawler": "~2.8|~3.0|~4.0" + }, + "require-dev": { + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\BrowserKit\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony BrowserKit Component", + "homepage": "https://symfony.com", + "time": "2019-10-24T15:33:53+00:00" + }, + { + "name": "symfony/css-selector", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "f819f71ae3ba6f396b4c015bd5895de7d2f1f85f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/f819f71ae3ba6f396b4c015bd5895de7d2f1f85f", + "reference": "f819f71ae3ba6f396b4c015bd5895de7d2f1f85f", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2019-10-01T11:57:37+00:00" + }, + { + "name": "symfony/dom-crawler", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/dom-crawler.git", + "reference": "6bcffd2eabc4ca087faaaf54e26c8ff3a40284f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/6bcffd2eabc4ca087faaaf54e26c8ff3a40284f3", + "reference": "6bcffd2eabc4ca087faaaf54e26c8ff3a40284f3", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "symfony/css-selector": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/css-selector": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DomCrawler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DomCrawler Component", + "homepage": "https://symfony.com", + "time": "2019-10-24T15:33:53+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "reference": "11336f6f84e16a720dae9d8e6ed5019efa85a0f9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2019-06-13T22:48:21+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.1.3", + "ext-json": "*" + }, + "platform-dev": [], + "platform-overrides": { + "php": "7.1.3" + } +} diff --git a/install/update/new/config/default/config.yml b/install/update/new/config/default/config.yml new file mode 100644 index 0000000..e8d0536 --- /dev/null +++ b/install/update/new/config/default/config.yml @@ -0,0 +1 @@ +# phpBB's config file (This line is needed because of the packager) diff --git a/install/update/new/config/default/container/parameters.yml b/install/update/new/config/default/container/parameters.yml new file mode 100644 index 0000000..8fcb401 --- /dev/null +++ b/install/update/new/config/default/container/parameters.yml @@ -0,0 +1,22 @@ +parameters: + # Disable the usage of the super globals (_GET, _POST, _SERVER...) + core.disable_super_globals: true + + # Datetime class to use + datetime.class: \phpbb\datetime + + # Mimetype guesser priorities + mimetype.guesser.priority.lowest: -2 + mimetype.guesser.priority.low: -1 + mimetype.guesser.priority.default: 0 + mimetype.guesser.priority.high: 1 + mimetype.guesser.priority.highest: 2 + + # List of default password driver types + passwords.algorithms: + - passwords.driver.argon2id + - passwords.driver.argon2i + - passwords.driver.bcrypt_2y + - passwords.driver.bcrypt + - passwords.driver.salted_md5 + - passwords.driver.phpass diff --git a/install/update/new/config/default/container/services.yml b/install/update/new/config/default/container/services.yml new file mode 100644 index 0000000..2d47200 --- /dev/null +++ b/install/update/new/config/default/container/services.yml @@ -0,0 +1,176 @@ +imports: + - { resource: services_attachment.yml } + - { resource: services_auth.yml } + - { resource: services_avatar.yml } + - { resource: services_captcha.yml } + - { resource: services_console.yml } + - { resource: services_content.yml } + - { resource: services_cron.yml } + - { resource: services_db.yml } + - { resource: services_event.yml } + - { resource: services_feed.yml } + - { resource: services_files.yml } + - { resource: services_filesystem.yml } + - { resource: services_help.yml } + - { resource: services_hook.yml } + - { resource: services_http.yml } + - { resource: services_language.yml } + - { resource: services_migrator.yml } + - { resource: services_mimetype_guesser.yml } + - { resource: services_module.yml } + - { resource: services_notification.yml } + - { resource: services_password.yml } + - { resource: services_php.yml } + - { resource: services_profilefield.yml } + - { resource: services_report.yml } + - { resource: services_routing.yml } + - { resource: services_text_formatter.yml } + - { resource: services_text_reparser.yml } + - { resource: services_twig.yml } + - { resource: services_ucp.yml } + - { resource: services_user.yml } + + - { resource: tables.yml } + - { resource: parameters.yml } + +services: + cache: + class: phpbb\cache\service + arguments: + - '@cache.driver' + - '@config' + - '@dbal.conn' + - '%core.root_path%' + - '%core.php_ext%' + + cache.driver: + class: '%cache.driver.class%' + + class_loader: + class: phpbb\class_loader + arguments: + - phpbb\ + - '%core.root_path%includes/' + - '%core.php_ext%' + calls: + - [register, []] + - [set_cache, ['@cache.driver']] + + class_loader.ext: + class: phpbb\class_loader + arguments: + - \ + - '%core.root_path%ext/' + - '%core.php_ext%' + calls: + - [register, []] + - [set_cache, ['@cache.driver']] + + config: + class: phpbb\config\db + arguments: + - '@dbal.conn' + - '@cache.driver' + - '%tables.config%' + + config.php: + synthetic: true + + config_text: + class: phpbb\config\db_text + arguments: + - '@dbal.conn' + - '%tables.config_text%' + + controller.helper: + class: phpbb\controller\helper + arguments: + - '@template' + - '@user' + - '@config' + - '@symfony_request' + - '@request' + - '@routing.helper' + + controller.resolver: + class: phpbb\controller\resolver + arguments: + - '@service_container' + - '%core.root_path%' + - '@template' + + ext.manager: + class: phpbb\extension\manager + arguments: + - '@service_container' + - '@dbal.conn' + - '@config' + - '@filesystem' + - '%tables.ext%' + - '%core.root_path%' + - '%core.php_ext%' + - '@cache' + + file_downloader: + class: phpbb\file_downloader + + file_locator: + class: phpbb\routing\file_locator + arguments: + - '@filesystem' + - '%core.root_path%' + + group_helper: + class: phpbb\group\helper + arguments: + - '@auth' + - '@cache' + - '@config' + - '@language' + - '@dispatcher' + - '@path_helper' + - '@user' + + log: + class: phpbb\log\log + arguments: + - '@dbal.conn' + - '@user' + - '@auth' + - '@dispatcher' + - '%core.root_path%' + - '%core.adm_relative_path%' + - '%core.php_ext%' + - '%tables.log%' + + path_helper: + class: phpbb\path_helper + arguments: + - '@symfony_request' + - '@filesystem' + - '@request' + - '%core.root_path%' + - '%core.php_ext%' + - '%core.adm_relative_path%' + + plupload: + class: phpbb\plupload\plupload + arguments: + - '%core.root_path%' + - '@config' + - '@request' + - '@user' + - '@php_ini' + - '@mimetype.guesser' + + upload_imagesize: + class: FastImageSize\FastImageSize + + version_helper: + class: phpbb\version_helper + shared: false + arguments: + - '@cache' + - '@config' + - '@file_downloader' + - '@user' diff --git a/install/update/new/config/default/container/services_attachment.yml b/install/update/new/config/default/container/services_attachment.yml new file mode 100644 index 0000000..c56ced2 --- /dev/null +++ b/install/update/new/config/default/container/services_attachment.yml @@ -0,0 +1,40 @@ +services: + attachment.delete: + class: phpbb\attachment\delete + shared: false + arguments: + - '@config' + - '@dbal.conn' + - '@dispatcher' + - '@filesystem' + - '@attachment.resync' + - '%core.root_path%' + + attachment.manager: + class: phpbb\attachment\manager + shared: false + arguments: + - '@attachment.delete' + - '@attachment.resync' + - '@attachment.upload' + + attachment.resync: + class: phpbb\attachment\resync + shared: false + arguments: + - '@dbal.conn' + + attachment.upload: + class: phpbb\attachment\upload + shared: false + arguments: + - '@auth' + - '@cache' + - '@config' + - '@files.upload' + - '@language' + - '@mimetype.guesser' + - '@dispatcher' + - '@plupload' + - '@user' + - '%core.root_path%' diff --git a/install/update/new/config/default/container/services_auth.yml b/install/update/new/config/default/container/services_auth.yml new file mode 100644 index 0000000..1540bea --- /dev/null +++ b/install/update/new/config/default/container/services_auth.yml @@ -0,0 +1,110 @@ +services: +# ----- Auth management ----- + auth: + class: phpbb\auth\auth + +# ----- Auth providers ----- + auth.provider_collection: + class: phpbb\auth\provider_collection + arguments: + - '@service_container' + - '@config' + tags: + - { name: service_collection, tag: auth.provider } + + auth.provider.db: + class: phpbb\auth\provider\db + arguments: + - '@captcha.factory' + - '@config' + - '@dbal.conn' + - '@passwords.manager' + - '@request' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: auth.provider } + + auth.provider.apache: + class: phpbb\auth\provider\apache + arguments: + - '@config' + - '@dbal.conn' + - '@language' + - '@request' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: auth.provider } + + auth.provider.ldap: + class: phpbb\auth\provider\ldap + arguments: + - '@config' + - '@dbal.conn' + - '@language' + - '@user' + tags: + - { name: auth.provider } + + auth.provider.oauth: + class: phpbb\auth\provider\oauth\oauth + arguments: + - '@config' + - '@dbal.conn' + - '@auth.provider.db' + - '@dispatcher' + - '@language' + - '@request' + - '@auth.provider.oauth.service_collection' + - '@user' + - '%tables.auth_provider_oauth_token_storage%' + - '%tables.auth_provider_oauth_states%' + - '%tables.auth_provider_oauth_account_assoc%' + - '%tables.users%' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: auth.provider } + +# ----- OAuth services providers ----- + auth.provider.oauth.service_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: auth.provider.oauth.service } + + auth.provider.oauth.service.bitly: + class: phpbb\auth\provider\oauth\service\bitly + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } + + auth.provider.oauth.service.facebook: + class: phpbb\auth\provider\oauth\service\facebook + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } + + auth.provider.oauth.service.google: + class: phpbb\auth\provider\oauth\service\google + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } + + auth.provider.oauth.service.twitter: + class: phpbb\auth\provider\oauth\service\twitter + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } diff --git a/install/update/new/config/default/container/services_avatar.yml b/install/update/new/config/default/container/services_avatar.yml new file mode 100644 index 0000000..d96aa62 --- /dev/null +++ b/install/update/new/config/default/container/services_avatar.yml @@ -0,0 +1,73 @@ +services: + avatar.manager: + class: phpbb\avatar\manager + arguments: + - '@config' + - '@dispatcher' + - '@avatar.driver_collection' + +# ----- Avatar drivers ----- + avatar.driver_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: avatar.driver } + + avatar.driver.gravatar: + class: phpbb\avatar\driver\gravatar + arguments: + - '@config' + - '@upload_imagesize' + - '%core.root_path%' + - '%core.php_ext%' + - '@path_helper' + - '@cache.driver' + calls: + - [set_name, [avatar.driver.gravatar]] + tags: + - { name: avatar.driver } + + avatar.driver.local: + class: phpbb\avatar\driver\local + arguments: + - '@config' + - '@upload_imagesize' + - '%core.root_path%' + - '%core.php_ext%' + - '@path_helper' + - '@cache.driver' + calls: + - [set_name, [avatar.driver.local]] + tags: + - { name: avatar.driver } + + avatar.driver.remote: + class: phpbb\avatar\driver\remote + arguments: + - '@config' + - '@upload_imagesize' + - '%core.root_path%' + - '%core.php_ext%' + - '@path_helper' + - '@cache.driver' + calls: + - [set_name, [avatar.driver.remote]] + tags: + - { name: avatar.driver } + + avatar.driver.upload: + class: phpbb\avatar\driver\upload + arguments: + - '@config' + - '%core.root_path%' + - '%core.php_ext%' + - '@filesystem' + - '@path_helper' + - '@dispatcher' + - '@files.factory' + - '@cache.driver' + calls: + - [set_name, [avatar.driver.upload]] + tags: + - { name: avatar.driver } diff --git a/install/update/new/config/default/container/services_captcha.yml b/install/update/new/config/default/container/services_captcha.yml new file mode 100644 index 0000000..e462c43 --- /dev/null +++ b/install/update/new/config/default/container/services_captcha.yml @@ -0,0 +1,59 @@ +services: + captcha.factory: + class: phpbb\captcha\factory + arguments: + - '@service_container' + - '@captcha.plugins.service_collection' + +# ----- Captcha plugins ----- +# Service MUST NOT be shared for all the plugins to work. + captcha.plugins.service_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: captcha.plugins } + + core.captcha.plugins.gd: + class: phpbb\captcha\plugins\gd + shared: false + calls: + - [set_name, [core.captcha.plugins.gd]] + tags: + - { name: captcha.plugins } + + core.captcha.plugins.gd_wave: + class: phpbb\captcha\plugins\gd_wave + shared: false + calls: + - [set_name, [core.captcha.plugins.gd_wave]] + tags: + - { name: captcha.plugins } + + core.captcha.plugins.nogd: + class: phpbb\captcha\plugins\nogd + shared: false + calls: + - [set_name, [core.captcha.plugins.nogd]] + tags: + - { name: captcha.plugins } + + core.captcha.plugins.qa: + class: phpbb\captcha\plugins\qa + shared: false + arguments: + - '%tables.captcha_qa_questions%' + - '%tables.captcha_qa_answers%' + - '%tables.captcha_qa_confirm%' + calls: + - [set_name, [core.captcha.plugins.qa]] + tags: + - { name: captcha.plugins } + + core.captcha.plugins.recaptcha: + class: phpbb\captcha\plugins\recaptcha + shared: false + calls: + - [set_name, [core.captcha.plugins.recaptcha]] + tags: + - { name: captcha.plugins } diff --git a/install/update/new/config/default/container/services_console.yml b/install/update/new/config/default/container/services_console.yml new file mode 100644 index 0000000..b662102 --- /dev/null +++ b/install/update/new/config/default/container/services_console.yml @@ -0,0 +1,287 @@ +services: + console.exception_subscriber: + class: phpbb\console\exception_subscriber + arguments: + - '@language' + tags: + - { name: kernel.event_subscriber } + + console.command_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: console.command } + + console.command.cache.purge: + class: phpbb\console\command\cache\purge + arguments: + - '@user' + - '@cache.driver' + - '@dbal.conn' + - '@auth' + - '@log' + - '@config' + tags: + - { name: console.command } + + console.command.config.delete: + class: phpbb\console\command\config\delete + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.increment: + class: phpbb\console\command\config\increment + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.get: + class: phpbb\console\command\config\get + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.set: + class: phpbb\console\command\config\set + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.set_atomic: + class: phpbb\console\command\config\set_atomic + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.cron.list: + class: phpbb\console\command\cron\cron_list + arguments: + - '@user' + - '@cron.manager' + tags: + - { name: console.command } + + console.command.cron.run: + class: phpbb\console\command\cron\run + arguments: + - '@user' + - '@cron.manager' + - '@cron.lock_db' + tags: + - { name: console.command } + + console.command.db.list: + class: phpbb\console\command\db\list_command + arguments: + - '@user' + - '@migrator' + - '@ext.manager' + - '@config' + - '@cache' + tags: + - { name: console.command } + + console.command.db.migrate: + class: phpbb\console\command\db\migrate + arguments: + - '@user' + - '@language' + - '@migrator' + - '@ext.manager' + - '@config' + - '@cache' + - '@log' + - '@filesystem' + - '%core.root_path%' + tags: + - { name: console.command } + + console.command.db.revert: + class: phpbb\console\command\db\revert + parent: console.command.db.migrate + tags: + - { name: console.command } + + console.command.dev.migration_tips: + class: phpbb\console\command\dev\migration_tips + arguments: + - '@user' + - '@ext.manager' + tags: + - { name: console.command } + + console.command.extension.disable: + class: phpbb\console\command\extension\disable + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.extension.enable: + class: phpbb\console\command\extension\enable + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.extension.purge: + class: phpbb\console\command\extension\purge + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.extension.show: + class: phpbb\console\command\extension\show + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.fixup.update_hashes: + class: phpbb\console\command\fixup\update_hashes + arguments: + - '@config' + - '@user' + - '@dbal.conn' + - '@passwords.manager' + - '@passwords.driver_collection' + - '%passwords.algorithms%' + tags: + - { name: console.command } + + console.command.fixup.fix_left_right_ids: + class: phpbb\console\command\fixup\fix_left_right_ids + arguments: + - '@user' + - '@dbal.conn' + - '@cache.driver' + tags: + - { name: console.command } + + console.command.reparser.list: + class: phpbb\console\command\reparser\list_all + arguments: + - '@user' + - '@text_reparser_collection' + tags: + - { name: console.command } + + console.command.reparser.reparse: + class: phpbb\console\command\reparser\reparse + arguments: + - '@user' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + tags: + - { name: console.command } + + console.command.thumbnail.delete: + class: phpbb\console\command\thumbnail\delete + arguments: + - '@config' + - '@user' + - '@dbal.conn' + - '%core.root_path%' + tags: + - { name: console.command } + + console.command.thumbnail.generate: + class: phpbb\console\command\thumbnail\generate + arguments: + - '@config' + - '@user' + - '@dbal.conn' + - '@cache' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: console.command } + + console.command.thumbnail.recreate: + class: phpbb\console\command\thumbnail\recreate + arguments: + - '@user' + tags: + - { name: console.command } + + console.command.update.check: + class: phpbb\console\command\update\check + arguments: + - '@user' + - '@config' + - '@service_container' + - '@language' + tags: + - { name: console.command } + + console.command.user.activate: + class: phpbb\console\command\user\activate + arguments: + - '@user' + - '@dbal.conn' + - '@config' + - '@language' + - '@log' + - '@notification_manager' + - '@user_loader' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: console.command } + + console.command.user.add: + class: phpbb\console\command\user\add + arguments: + - '@user' + - '@dbal.conn' + - '@config' + - '@language' + - '@passwords.manager' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: console.command } + + console.command.user.delete: + class: phpbb\console\command\user\delete + arguments: + - '@user' + - '@dbal.conn' + - '@language' + - '@log' + - '@user_loader' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: console.command } + + console.command.user.reclean: + class: phpbb\console\command\user\reclean + arguments: + - '@user' + - '@dbal.conn' + - '@language' + tags: + - { name: console.command } diff --git a/install/update/new/config/default/container/services_content.yml b/install/update/new/config/default/container/services_content.yml new file mode 100644 index 0000000..6717c20 --- /dev/null +++ b/install/update/new/config/default/container/services_content.yml @@ -0,0 +1,73 @@ +services: + content.visibility: + class: phpbb\content_visibility + arguments: + - '@auth' + - '@config' + - '@dispatcher' + - '@dbal.conn' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + - '%tables.forums%' + - '%tables.posts%' + - '%tables.topics%' + - '%tables.users%' + + groupposition.legend: + class: phpbb\groupposition\legend + arguments: + - '@dbal.conn' + - '@user' + + groupposition.teampage: + class: phpbb\groupposition\teampage + arguments: + - '@dbal.conn' + - '@user' + - '@cache.driver' + + message.form.admin: + class: phpbb\message\admin_form + arguments: + - '@auth' + - '@config' + - '@config_text' + - '@dbal.conn' + - '@user' + - '@dispatcher' + - '%core.root_path%' + - '%core.php_ext%' + + message.form.topic: + class: phpbb\message\topic_form + arguments: + - '@auth' + - '@config' + - '@dbal.conn' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + + message.form.user: + class: phpbb\message\user_form + arguments: + - '@auth' + - '@config' + - '@dbal.conn' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + + pagination: + class: phpbb\pagination + arguments: + - '@template' + - '@user' + - '@controller.helper' + - '@dispatcher' + + viewonline_helper: + class: phpbb\viewonline_helper + arguments: + - '@filesystem' diff --git a/install/update/new/config/default/container/services_cron.yml b/install/update/new/config/default/container/services_cron.yml new file mode 100644 index 0000000..70f70e3 --- /dev/null +++ b/install/update/new/config/default/container/services_cron.yml @@ -0,0 +1,248 @@ +services: + cron.manager: + class: phpbb\cron\manager + arguments: + - '@cron.task_collection' + - '@routing.helper' + - '%core.root_path%' + - '%core.php_ext%' + + cron.lock_db: + class: phpbb\lock\db + arguments: + - cron_lock + - '@config' + - '@dbal.conn' + + cron.controller: + class: phpbb\cron\controller\cron + + cron.event_listener: + class: phpbb\cron\event\cron_runner_listener + arguments: + - '@cron.lock_db' + - '@cron.manager' + - '@request' + tags: + - { name: kernel.event_subscriber } + +# ----- Cron tasks ----- + cron.task_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: cron.task } + + cron.task.core.prune_all_forums: + class: phpbb\cron\task\core\prune_all_forums + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '@dbal.conn' + calls: + - [set_name, [cron.task.core.prune_all_forums]] + tags: + - { name: cron.task } + + cron.task.core.prune_forum: + class: phpbb\cron\task\core\prune_forum + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '@dbal.conn' + calls: + - [set_name, [cron.task.core.prune_forum]] + tags: + - { name: cron.task } + + cron.task.core.prune_shadow_topics: + class: phpbb\cron\task\core\prune_shadow_topics + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '@dbal.conn' + - '@log' + - '@user' + calls: + - [set_name, [cron.task.core.prune_shadow_topics]] + tags: + - { name: cron.task } + + cron.task.core.prune_notifications: + class: phpbb\cron\task\core\prune_notifications + arguments: + - '@config' + - '@notification_manager' + calls: + - [set_name, [cron.task.core.prune_notifications]] + tags: + - { name: cron.task } + + cron.task.core.queue: + class: phpbb\cron\task\core\queue + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '%core.cache_dir%' + calls: + - [set_name, [cron.task.core.queue]] + tags: + - { name: cron.task } + + cron.task.core.tidy_cache: + class: phpbb\cron\task\core\tidy_cache + arguments: + - '@config' + - '@cache.driver' + calls: + - [set_name, [cron.task.core.tidy_cache]] + tags: + - { name: cron.task } + + cron.task.core.tidy_database: + class: phpbb\cron\task\core\tidy_database + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + calls: + - [set_name, [cron.task.core.tidy_database]] + tags: + - { name: cron.task } + + cron.task.core.tidy_plupload: + class: phpbb\cron\task\core\tidy_plupload + arguments: + - '%core.root_path%' + - '@config' + - '@log' + - '@user' + calls: + - [set_name, [cron.task.core.tidy_plupload]] + tags: + - { name: cron.task } + + cron.task.core.tidy_search: + class: phpbb\cron\task\core\tidy_search + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@auth' + - '@config' + - '@dbal.conn' + - '@user' + - '@dispatcher' + calls: + - [set_name, [cron.task.core.tidy_search]] + tags: + - { name: cron.task } + + cron.task.core.tidy_sessions: + class: phpbb\cron\task\core\tidy_sessions + arguments: + - '@config' + - '@user' + calls: + - [set_name, [cron.task.core.tidy_sessions]] + tags: + - { name: cron.task } + + cron.task.core.tidy_warnings: + class: phpbb\cron\task\core\tidy_warnings + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + calls: + - [set_name, [cron.task.core.tidy_warnings]] + tags: + - { name: cron.task } + + cron.task.text_reparser.pm_text: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.pm_text]] + - [set_reparser, [text_reparser.pm_text]] + tags: + - { name: cron.task } + + cron.task.text_reparser.poll_option: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.poll_option]] + - [set_reparser, [text_reparser.poll_option]] + tags: + - { name: cron.task } + + cron.task.text_reparser.poll_title: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.poll_title]] + - [set_reparser, [text_reparser.poll_title]] + tags: + - { name: cron.task } + + cron.task.text_reparser.post_text: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.post_text]] + - [set_reparser, [text_reparser.post_text]] + tags: + - { name: cron.task } + + cron.task.text_reparser.user_signature: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.user_signature]] + - [set_reparser, [text_reparser.user_signature]] + tags: + - { name: cron.task } + + cron.task.core.update_hashes: + class: phpbb\cron\task\core\update_hashes + arguments: + - '@config' + - '@dbal.conn' + - '@passwords.update.lock' + - '@passwords.manager' + - '@passwords.driver_collection' + - '%passwords.algorithms%' + calls: + - [set_name, [cron.task.core.update_hashes]] + tags: + - { name: cron.task } diff --git a/install/update/new/config/default/container/services_db.yml b/install/update/new/config/default/container/services_db.yml new file mode 100644 index 0000000..d538177 --- /dev/null +++ b/install/update/new/config/default/container/services_db.yml @@ -0,0 +1,71 @@ +services: + dbal.conn: + class: phpbb\db\driver\factory + arguments: + - '@service_container' + + dbal.conn.driver: + synthetic: true + +# ----- DB Tools ----- + dbal.tools.factory: + class: phpbb\db\tools\factory + + dbal.tools: + class: phpbb\db\tools\tools_interface + factory: ['@dbal.tools.factory', get] + arguments: + - '@dbal.conn.driver' + +# ----- DB Extractor ----- + dbal.extractor.factory: + class: phpbb\db\extractor\factory + arguments: + - '@dbal.conn.driver' + - '@service_container' + + dbal.extractor: + class: phpbb\db\extractor\extractor_interface + factory: ['@dbal.extractor.factory', get] + +# ----- DB Extractors for different drivers ----- +# Service MUST NOT be shared for all the handlers to work correctly. + dbal.extractor.extractors.mssql_extractor: + class: phpbb\db\extractor\mssql_extractor + shared: false + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' + + dbal.extractor.extractors.mysql_extractor: + class: phpbb\db\extractor\mysql_extractor + shared: false + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' + + dbal.extractor.extractors.oracle_extractor: + class: phpbb\db\extractor\oracle_extractor + shared: false + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' + + dbal.extractor.extractors.postgres_extractor: + class: phpbb\db\extractor\postgres_extractor + shared: false + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' + + dbal.extractor.extractors.sqlite3_extractor: + class: phpbb\db\extractor\sqlite3_extractor + shared: false + arguments: + - '%core.root_path%' + - '@request' + - '@dbal.conn.driver' diff --git a/install/update/new/config/default/container/services_event.yml b/install/update/new/config/default/container/services_event.yml new file mode 100644 index 0000000..5696275 --- /dev/null +++ b/install/update/new/config/default/container/services_event.yml @@ -0,0 +1,26 @@ +services: + dispatcher: + class: phpbb\event\dispatcher + arguments: + - '@service_container' + + kernel_exception_subscriber: + class: phpbb\event\kernel_exception_subscriber + arguments: + - '@template' + - '@language' + - '%debug.exceptions%' + tags: + - { name: kernel.event_subscriber } + + kernel_terminate_subscriber: + class: phpbb\event\kernel_terminate_subscriber + tags: + - { name: kernel.event_subscriber } + + symfony_response_listener: + class: Symfony\Component\HttpKernel\EventListener\ResponseListener + arguments: + - UTF-8 + tags: + - { name: kernel.event_subscriber } diff --git a/install/update/new/config/default/container/services_feed.yml b/install/update/new/config/default/container/services_feed.yml new file mode 100644 index 0000000..e8bac4b --- /dev/null +++ b/install/update/new/config/default/container/services_feed.yml @@ -0,0 +1,126 @@ +services: + phpbb.feed.controller: + class: phpbb\feed\controller\feed + arguments: + - '@template.twig.environment' + - '@symfony_request' + - '@controller.helper' + - '@config' + - '@dbal.conn' + - '@service_container' + - '@feed.helper' + - '@user' + - '@auth' + - '@dispatcher' + - '%core.php_ext%' + + feed.helper: + class: phpbb\feed\helper + arguments: + - '@config' + - '@service_container' + - '@path_helper' + - '@text_formatter.renderer' + - '@user' + + feed.forum: + class: phpbb\feed\forum + shared: false + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '@dispatcher' + - '%core.php_ext%' + + feed.forums: + class: phpbb\feed\forums + shared: false + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '@dispatcher' + - '%core.php_ext%' + + feed.news: + class: phpbb\feed\news + shared: false + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '@dispatcher' + - '%core.php_ext%' + + feed.overall: + class: phpbb\feed\overall + shared: false + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '@dispatcher' + - '%core.php_ext%' + + feed.quote_helper: + class: phpbb\feed\quote_helper + parent: text_formatter.s9e.quote_helper + + feed.topic: + class: phpbb\feed\topic + shared: false + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '@dispatcher' + - '%core.php_ext%' + + feed.topics: + class: phpbb\feed\topics + shared: false + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '@dispatcher' + - '%core.php_ext%' + + feed.topics_active: + class: phpbb\feed\topics_active + shared: false + arguments: + - '@feed.helper' + - '@config' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@auth' + - '@content.visibility' + - '@dispatcher' + - '%core.php_ext%' diff --git a/install/update/new/config/default/container/services_files.yml b/install/update/new/config/default/container/services_files.yml new file mode 100644 index 0000000..ba1fdb4 --- /dev/null +++ b/install/update/new/config/default/container/services_files.yml @@ -0,0 +1,57 @@ +services: + files.factory: + class: phpbb\files\factory + arguments: + - '@service_container' + + files.filespec: + class: phpbb\files\filespec + shared: false + arguments: + - '@filesystem' + - '@language' + - '@php_ini' + - '@upload_imagesize' + - '%core.root_path%' + - '@mimetype.guesser' + - '@plupload' + + files.upload: + class: phpbb\files\upload + shared: false + arguments: + - '@filesystem' + - '@files.factory' + - '@language' + - '@php_ini' + - '@request' + + files.types.form: + class: phpbb\files\types\form + shared: false + arguments: + - '@files.factory' + - '@language' + - '@php_ini' + - '@plupload' + - '@request' + + files.types.local: + class: phpbb\files\types\local + shared: false + arguments: + - '@files.factory' + - '@language' + - '@php_ini' + - '@request' + + files.types.remote: + class: phpbb\files\types\remote + shared: false + arguments: + - '@config' + - '@files.factory' + - '@language' + - '@php_ini' + - '@request' + - '%core.root_path%' diff --git a/install/update/new/config/default/container/services_filesystem.yml b/install/update/new/config/default/container/services_filesystem.yml new file mode 100644 index 0000000..828f907 --- /dev/null +++ b/install/update/new/config/default/container/services_filesystem.yml @@ -0,0 +1,3 @@ +services: + filesystem: + class: phpbb\filesystem\filesystem diff --git a/install/update/new/config/default/container/services_help.yml b/install/update/new/config/default/container/services_help.yml new file mode 100644 index 0000000..1bff001 --- /dev/null +++ b/install/update/new/config/default/container/services_help.yml @@ -0,0 +1,27 @@ +services: + phpbb.help.manager: + class: phpbb\help\manager + arguments: + - '@dispatcher' + - '@language' + - '@template' + + phpbb.help.controller.bbcode: + class: phpbb\help\controller\bbcode + arguments: + - '@controller.helper' + - '@phpbb.help.manager' + - '@template' + - '@language' + - '%core.root_path%' + - '%core.php_ext%' + + phpbb.help.controller.faq: + class: phpbb\help\controller\faq + arguments: + - '@controller.helper' + - '@phpbb.help.manager' + - '@template' + - '@language' + - '%core.root_path%' + - '%core.php_ext%' diff --git a/install/update/new/config/default/container/services_hook.yml b/install/update/new/config/default/container/services_hook.yml new file mode 100644 index 0000000..10a8418 --- /dev/null +++ b/install/update/new/config/default/container/services_hook.yml @@ -0,0 +1,7 @@ +services: + hook_finder: + class: phpbb\hook\finder + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@cache.driver' diff --git a/install/update/new/config/default/container/services_http.yml b/install/update/new/config/default/container/services_http.yml new file mode 100644 index 0000000..49cfbf5 --- /dev/null +++ b/install/update/new/config/default/container/services_http.yml @@ -0,0 +1,23 @@ +services: + http_kernel: + class: Symfony\Component\HttpKernel\HttpKernel + arguments: + - '@dispatcher' + - '@controller.resolver' + - '@request_stack' + + # WARNING: The Symfony request does not escape the input and should be used very carefully + # prefer the phpbb request (service @request) as possible + symfony_request: + class: phpbb\symfony_request + arguments: + - '@request' + + request_stack: + class: Symfony\Component\HttpFoundation\RequestStack + + request: + class: phpbb\request\request + arguments: + - null + - '%core.disable_super_globals%' diff --git a/install/update/new/config/default/container/services_language.yml b/install/update/new/config/default/container/services_language.yml new file mode 100644 index 0000000..8201fbf --- /dev/null +++ b/install/update/new/config/default/container/services_language.yml @@ -0,0 +1,22 @@ +services: + language.helper.language_file: + class: phpbb\language\language_file_helper + arguments: + - '%core.root_path%' + + language: + class: phpbb\language\language + arguments: + - '@language.loader' + + language.loader_abstract: + abstract: true + class: phpbb\language\language_file_loader + arguments: + - '%core.root_path%' + - '%core.php_ext%' + + language.loader: + parent: language.loader_abstract + calls: + - [set_extension_manager, ['@ext.manager']] diff --git a/install/update/new/config/default/container/services_migrator.yml b/install/update/new/config/default/container/services_migrator.yml new file mode 100644 index 0000000..c63b087 --- /dev/null +++ b/install/update/new/config/default/container/services_migrator.yml @@ -0,0 +1,64 @@ +services: +# ----- Migrator ----- + migrator: + class: phpbb\db\migrator + arguments: + - '@service_container' + - '@config' + - '@dbal.conn' + - '@dbal.tools' + - '%tables.migrations%' + - '%core.root_path%' + - '%core.php_ext%' + - '%core.table_prefix%' + - '@migrator.tool_collection' + - '@migrator.helper' + + migrator.helper: + class: phpbb\db\migration\helper + +# ----- Migrator's tools ----- + migrator.tool_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: migrator.tool } + + migrator.tool.config: + class: phpbb\db\migration\tool\config + arguments: + - '@config' + tags: + - { name: migrator.tool } + + migrator.tool.config_text: + class: phpbb\db\migration\tool\config_text + arguments: + - '@config_text' + tags: + - { name: migrator.tool } + + migrator.tool.module: + class: phpbb\db\migration\tool\module + arguments: + - '@dbal.conn' + - '@cache' + - '@user' + - '@module.manager' + - '%core.root_path%' + - '%core.php_ext%' + - '%tables.modules%' + tags: + - { name: migrator.tool } + + migrator.tool.permission: + class: phpbb\db\migration\tool\permission + arguments: + - '@dbal.conn' + - '@cache' + - '@auth' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: migrator.tool } diff --git a/install/update/new/config/default/container/services_mimetype_guesser.yml b/install/update/new/config/default/container/services_mimetype_guesser.yml new file mode 100644 index 0000000..432470d --- /dev/null +++ b/install/update/new/config/default/container/services_mimetype_guesser.yml @@ -0,0 +1,36 @@ +services: + mimetype.guesser_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: mimetype.guessers } + + mimetype.fileinfo_mimetype_guesser: + class: Symfony\Component\HttpFoundation\File\MimeType\FileinfoMimeTypeGuesser + tags: + - { name: mimetype.guessers } + + mimetype.filebinary_mimetype_guesser: + class: Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser + tags: + - { name: mimetype.guessers } + + mimetype.content_guesser: + class: phpbb\mimetype\content_guesser + calls: + - [set_priority, ['%mimetype.guesser.priority.low%']] + tags: + - { name: mimetype.guessers } + + mimetype.extension_guesser: + class: phpbb\mimetype\extension_guesser + calls: + - [set_priority, ['%mimetype.guesser.priority.lowest%']] + tags: + - { name: mimetype.guessers } + + mimetype.guesser: + class: phpbb\mimetype\guesser + arguments: + - '@mimetype.guesser_collection' diff --git a/install/update/new/config/default/container/services_module.yml b/install/update/new/config/default/container/services_module.yml new file mode 100644 index 0000000..a057e55 --- /dev/null +++ b/install/update/new/config/default/container/services_module.yml @@ -0,0 +1,10 @@ +services: + module.manager: + class: phpbb\module\module_manager + arguments: + - '@cache.driver' + - '@dbal.conn' + - '@ext.manager' + - '%tables.modules%' + - '%core.root_path%' + - '%core.php_ext%' diff --git a/install/update/new/config/default/container/services_notification.yml b/install/update/new/config/default/container/services_notification.yml new file mode 100644 index 0000000..6c3cea3 --- /dev/null +++ b/install/update/new/config/default/container/services_notification.yml @@ -0,0 +1,224 @@ +services: + notification_manager: + class: phpbb\notification\manager + arguments: + - '@notification.type_collection' + - '@notification.method_collection' + - '@service_container' + - '@user_loader' + - '@dispatcher' + - '@dbal.conn' + - '@cache' + - '@language' + - '@user' + - '%tables.notification_types%' + - '%tables.user_notifications%' + +# ----- Notification's types ----- +# Service MUST NOT be shared for all the plugins to work. + notification.type_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: notification.type } + + notification.type.base: + abstract: true + arguments: + - '@dbal.conn' + - '@language' + - '@user' + - '@auth' + - '%core.root_path%' + - '%core.php_ext%' + - '%tables.user_notifications%' + + notification.type.admin_activate_user: + class: phpbb\notification\type\admin_activate_user + shared: false + parent: notification.type.base + calls: + - [set_user_loader, ['@user_loader']] + - [set_config, ['@config']] + tags: + - { name: notification.type } + + notification.type.approve_post: + class: phpbb\notification\type\approve_post + shared: false + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.approve_topic: + class: phpbb\notification\type\approve_topic + shared: false + parent: notification.type.topic + tags: + - { name: notification.type } + + notification.type.bookmark: + class: phpbb\notification\type\bookmark + shared: false + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.disapprove_post: + class: phpbb\notification\type\disapprove_post + shared: false + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.disapprove_topic: + class: phpbb\notification\type\disapprove_topic + shared: false + parent: notification.type.topic + tags: + - { name: notification.type } + + notification.type.group_request: + class: phpbb\notification\type\group_request + shared: false + parent: notification.type.base + calls: + - [set_user_loader, ['@user_loader']] + tags: + - { name: notification.type } + + notification.type.group_request_approved: + class: phpbb\notification\type\group_request_approved + shared: false + parent: notification.type.base + tags: + - { name: notification.type } + + notification.type.pm: + class: phpbb\notification\type\pm + shared: false + parent: notification.type.base + calls: + - [set_user_loader, ['@user_loader']] + - [set_config, ['@config']] + tags: + - { name: notification.type } + + notification.type.post: + class: phpbb\notification\type\post + shared: false + parent: notification.type.base + calls: + - [set_user_loader, ['@user_loader']] + - [set_config, ['@config']] + tags: + - { name: notification.type } + + notification.type.post_in_queue: + class: phpbb\notification\type\post_in_queue + shared: false + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.quote: + class: phpbb\notification\type\quote + shared: false + parent: notification.type.post + calls: + - [set_utils, ['@text_formatter.utils']] + tags: + - { name: notification.type } + + notification.type.report_pm: + class: phpbb\notification\type\report_pm + shared: false + parent: notification.type.pm + tags: + - { name: notification.type } + + notification.type.report_pm_closed: + class: phpbb\notification\type\report_pm_closed + shared: false + parent: notification.type.pm + tags: + - { name: notification.type } + + notification.type.report_post: + class: phpbb\notification\type\report_post + shared: false + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.report_post_closed: + class: phpbb\notification\type\report_post_closed + shared: false + parent: notification.type.post + tags: + - { name: notification.type } + + notification.type.topic: + class: phpbb\notification\type\topic + shared: false + parent: notification.type.base + calls: + - [set_user_loader, ['@user_loader']] + - [set_config, ['@config']] + tags: + - { name: notification.type } + + notification.type.topic_in_queue: + class: phpbb\notification\type\topic_in_queue + shared: false + parent: notification.type.topic + tags: + - { name: notification.type } + +# ----- Notification's methods ----- +# Service MUST NOT be shared for all the plugins to work. + notification.method_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: notification.method } + + notification.method.board: + class: phpbb\notification\method\board + shared: false + arguments: + - '@user_loader' + - '@dbal.conn' + - '@cache.driver' + - '@user' + - '@config' + - '%tables.notification_types%' + - '%tables.notifications%' + tags: + - { name: notification.method } + + notification.method.email: + class: phpbb\notification\method\email + shared: false + arguments: + - '@user_loader' + - '@user' + - '@config' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: notification.method } + + notification.method.jabber: + class: phpbb\notification\method\jabber + shared: false + arguments: + - '@user_loader' + - '@user' + - '@config' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: notification.method } diff --git a/install/update/new/config/default/container/services_password.yml b/install/update/new/config/default/container/services_password.yml new file mode 100644 index 0000000..a9adbeb --- /dev/null +++ b/install/update/new/config/default/container/services_password.yml @@ -0,0 +1,156 @@ +parameters: + passwords.driver.argon2_memory_cost: 1024 + passwords.driver.argon2_threads: 2 + passwords.driver.argon2_time_cost: 2 + passwords.driver.bcrypt_cost: 10 + +services: +# ----- Password management ----- + passwords.manager: + class: phpbb\passwords\manager + arguments: + - '@config' + - '@passwords.driver_collection' + - '@passwords.helper' + - '%passwords.algorithms%' + + passwords.helper: + class: phpbb\passwords\helper + + passwords.driver_helper: + class: phpbb\passwords\driver\helper + arguments: + - '@config' + +# ----- Password's drivers ----- + passwords.driver_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: passwords.driver } + + passwords.driver.argon2i: + class: phpbb\passwords\driver\argon2i + arguments: + - '@config' + - '@passwords.driver_helper' + - '%passwords.driver.argon2_memory_cost%' + - '%passwords.driver.argon2_threads%' + - '%passwords.driver.argon2_time_cost%' + tags: + - { name: passwords.driver } + + passwords.driver.argon2id: + class: phpbb\passwords\driver\argon2id + parent: passwords.driver.argon2i + tags: + - { name: passwords.driver } + + passwords.driver.bcrypt: + class: phpbb\passwords\driver\bcrypt + arguments: + - '@config' + - '@passwords.driver_helper' + - '%passwords.driver.bcrypt_cost%' + tags: + - { name: passwords.driver } + + passwords.driver.bcrypt_2y: + class: phpbb\passwords\driver\bcrypt_2y + arguments: + - '@config' + - '@passwords.driver_helper' + - '%passwords.driver.bcrypt_cost%' + tags: + - { name: passwords.driver } + + passwords.driver.bcrypt_wcf2: + class: phpbb\passwords\driver\bcrypt_wcf2 + arguments: + - '@passwords.driver.bcrypt' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.salted_md5: + class: phpbb\passwords\driver\salted_md5 + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.phpass: + class: phpbb\passwords\driver\phpass + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.convert_password: + class: phpbb\passwords\driver\convert_password + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.sha1_smf: + class: phpbb\passwords\driver\sha1_smf + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.sha1_wcf1: + class: phpbb\passwords\driver\sha1_wcf1 + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.sha1: + class: phpbb\passwords\driver\sha1 + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.md5_phpbb2: + class: phpbb\passwords\driver\md5_phpbb2 + arguments: + - '@request' + - '@passwords.driver.salted_md5' + - '@passwords.driver_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: passwords.driver } + + passwords.driver.md5_mybb: + class: phpbb\passwords\driver\md5_mybb + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.md5_vb: + class: phpbb\passwords\driver\md5_vb + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.update.lock: + class: phpbb\lock\db + arguments: + - update_hashes_lock + - '@config' + - '@dbal.conn' diff --git a/install/update/new/config/default/container/services_php.yml b/install/update/new/config/default/container/services_php.yml new file mode 100644 index 0000000..2934996 --- /dev/null +++ b/install/update/new/config/default/container/services_php.yml @@ -0,0 +1,3 @@ +services: + php_ini: + class: bantu\IniGetWrapper\IniGetWrapper diff --git a/install/update/new/config/default/container/services_profilefield.yml b/install/update/new/config/default/container/services_profilefield.yml new file mode 100644 index 0000000..90b2283 --- /dev/null +++ b/install/update/new/config/default/container/services_profilefield.yml @@ -0,0 +1,102 @@ +services: + profilefields.manager: + class: phpbb\profilefields\manager + arguments: + - '@auth' + - '@dbal.conn' + - '@dispatcher' + - '@request' + - '@template' + - '@profilefields.type_collection' + - '@user' + - '%tables.profile_fields%' + - '%tables.profile_fields_language%' + - '%tables.profile_fields_data%' + + profilefields.lang_helper: + class: phpbb\profilefields\lang_helper + arguments: + - '@dbal.conn' + - '%tables.profile_fields_options_language%' + +# ----- Profile fields types ----- + profilefields.type_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: profilefield.type } + + profilefields.type.bool: + class: phpbb\profilefields\type\type_bool + arguments: + - '@profilefields.lang_helper' + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.date: + class: phpbb\profilefields\type\type_date + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.dropdown: + class: phpbb\profilefields\type\type_dropdown + arguments: + - '@profilefields.lang_helper' + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.googleplus: + class: phpbb\profilefields\type\type_googleplus + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.int: + class: phpbb\profilefields\type\type_int + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.string: + class: phpbb\profilefields\type\type_string + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.text: + class: phpbb\profilefields\type\type_text + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } + + profilefields.type.url: + class: phpbb\profilefields\type\type_url + arguments: + - '@request' + - '@template' + - '@user' + tags: + - { name: profilefield.type } diff --git a/install/update/new/config/default/container/services_report.yml b/install/update/new/config/default/container/services_report.yml new file mode 100644 index 0000000..2c5b3bf --- /dev/null +++ b/install/update/new/config/default/container/services_report.yml @@ -0,0 +1,53 @@ +services: +# ----- Report controller ----- + phpbb.report.controller: + class: phpbb\report\controller\report + arguments: + - '@config' + - '@user' + - '@template' + - '@controller.helper' + - '@request' + - '@captcha.factory' + - '@phpbb.report.handler_factory' + - '@phpbb.report.report_reason_list_provider' + - '%core.root_path%' + - '%core.php_ext%' + +# ----- Report handler factory ----- + phpbb.report.handler_factory: + class: phpbb\report\handler_factory + arguments: + - '@service_container' + +# ----- Report UI provider ----- + phpbb.report.report_reason_list_provider: + class: phpbb\report\report_reason_list_provider + arguments: + - '@dbal.conn.driver' + - '@template' + - '@user' + +# ----- Report handlers ----- +# Service MUST NOT be shared for all the handlers to work correctly. + phpbb.report.handlers.report_handler_pm: + class: phpbb\report\report_handler_pm + shared: false + arguments: + - '@dbal.conn.driver' + - '@dispatcher' + - '@config' + - '@auth' + - '@user' + - '@notification_manager' + + phpbb.report.handlers.report_handler_post: + class: phpbb\report\report_handler_post + shared: false + arguments: + - '@dbal.conn.driver' + - '@dispatcher' + - '@config' + - '@auth' + - '@user' + - '@notification_manager' diff --git a/install/update/new/config/default/container/services_routing.yml b/install/update/new/config/default/container/services_routing.yml new file mode 100644 index 0000000..0bf0a33 --- /dev/null +++ b/install/update/new/config/default/container/services_routing.yml @@ -0,0 +1,77 @@ +services: + router: + class: phpbb\routing\router + arguments: + - '@service_container' + - '@routing.chained_resources_locator' + - '@routing.delegated_loader' + - '%core.php_ext%' + - '%core.cache_dir%' + + router.listener: + class: Symfony\Component\HttpKernel\EventListener\RouterListener + arguments: + - '@router' + - '@request_stack' + tags: + - { name: kernel.event_subscriber } + + routing.helper: + class: phpbb\routing\helper + arguments: + - '@config' + - '@router' + - '@symfony_request' + - '@request' + - '@filesystem' + - '%core.root_path%' + - '%core.php_ext%' + +# ---- Route loaders ---- + + routing.delegated_loader: + class: Symfony\Component\Config\Loader\DelegatingLoader + arguments: + - '@routing.resolver' + + routing.resolver: + class: phpbb\routing\loader_resolver + arguments: + - '@routing.loader.collection' + + routing.loader.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: routing.loader } + + routing.loader.yaml: + class: Symfony\Component\Routing\Loader\YamlFileLoader + arguments: + - '@file_locator' + tags: + - { name: routing.loader } + +# ---- Resources Locators ---- + + routing.chained_resources_locator: + class: phpbb\routing\resources_locator\chained_resources_locator + arguments: + - '@routing.resources_locator.collection' + + routing.resources_locator.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: routing.resources_locator } + + routing.resources_locator.default: + class: phpbb\routing\resources_locator\default_resources_locator + arguments: + - '%core.root_path%' + - '%core.environment%' + - '@ext.manager' + tags: + - { name: routing.resources_locator } diff --git a/install/update/new/config/default/container/services_text_formatter.yml b/install/update/new/config/default/container/services_text_formatter.yml new file mode 100644 index 0000000..4e4abf6 --- /dev/null +++ b/install/update/new/config/default/container/services_text_formatter.yml @@ -0,0 +1,84 @@ +parameters: + text_formatter.cache.dir: '%core.cache_dir%' + text_formatter.cache.parser.key: _text_formatter_parser + text_formatter.cache.renderer.key: _text_formatter_renderer + +services: + text_formatter.acp_utils: + class: phpbb\textformatter\s9e\acp_utils + arguments: + - '@text_formatter.s9e.factory' + + text_formatter.cache: + alias: text_formatter.s9e.factory + + text_formatter.data_access: + class: phpbb\textformatter\data_access + arguments: + - '@dbal.conn' + - '%tables.bbcodes%' + - '%tables.smilies%' + - '%tables.styles%' + - '%tables.words%' + - '%core.root_path%styles/' + + text_formatter.parser: + alias: text_formatter.s9e.parser + + text_formatter.renderer: + alias: text_formatter.s9e.renderer + + text_formatter.utils: + alias: text_formatter.s9e.utils + + text_formatter.s9e.bbcode_merger: + class: phpbb\textformatter\s9e\bbcode_merger + arguments: + - '@text_formatter.s9e.factory' + + text_formatter.s9e.factory: + class: phpbb\textformatter\s9e\factory + arguments: + - '@text_formatter.data_access' + - '@cache.driver' + - '@dispatcher' + - '@config' + - '@text_formatter.s9e.link_helper' + - '@log' + - '%text_formatter.cache.dir%' + - '%text_formatter.cache.parser.key%' + - '%text_formatter.cache.renderer.key%' + + text_formatter.s9e.link_helper: + class: phpbb\textformatter\s9e\link_helper + + text_formatter.s9e.parser: + class: phpbb\textformatter\s9e\parser + arguments: + - '@cache.driver' + - '%text_formatter.cache.parser.key%' + - '@text_formatter.s9e.factory' + - '@dispatcher' + + text_formatter.s9e.quote_helper: + class: phpbb\textformatter\s9e\quote_helper + arguments: + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + + text_formatter.s9e.renderer: + class: phpbb\textformatter\s9e\renderer + arguments: + - '@cache.driver' + - '%text_formatter.cache.dir%' + - '%text_formatter.cache.renderer.key%' + - '@text_formatter.s9e.factory' + - '@dispatcher' + calls: + - [configure_quote_helper, ['@text_formatter.s9e.quote_helper']] + - [configure_smilies_path, ['@config', '@path_helper']] + - [configure_user, ['@user', '@config', '@auth']] + + text_formatter.s9e.utils: + class: phpbb\textformatter\s9e\utils diff --git a/install/update/new/config/default/container/services_text_reparser.yml b/install/update/new/config/default/container/services_text_reparser.yml new file mode 100644 index 0000000..4bc49f5 --- /dev/null +++ b/install/update/new/config/default/container/services_text_reparser.yml @@ -0,0 +1,109 @@ +services: + text_reparser.manager: + class: phpbb\textreparser\manager + arguments: + - '@config' + - '@config_text' + - '@text_reparser_collection' + + text_reparser.lock: + class: phpbb\lock\db + arguments: + - reparse_lock + - '@config' + - '@dbal.conn' + + text_reparser_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: text_reparser.plugin } + + text_reparser.contact_admin_info: + class: phpbb\textreparser\plugins\contact_admin_info + arguments: + - '@config_text' + calls: + - [set_name, [contact_admin_info]] + tags: + - { name: text_reparser.plugin } + + text_reparser.forum_description: + class: phpbb\textreparser\plugins\forum_description + arguments: + - '@dbal.conn' + - '%tables.forums%' + calls: + - [set_name, [forum_description]] + tags: + - { name: text_reparser.plugin } + + text_reparser.forum_rules: + class: phpbb\textreparser\plugins\forum_rules + arguments: + - '@dbal.conn' + - '%tables.forums%' + calls: + - [set_name, [forum_rules]] + tags: + - { name: text_reparser.plugin } + + text_reparser.group_description: + class: phpbb\textreparser\plugins\group_description + arguments: + - '@dbal.conn' + - '%tables.groups%' + calls: + - [set_name, [group_description]] + tags: + - { name: text_reparser.plugin } + + text_reparser.pm_text: + class: phpbb\textreparser\plugins\pm_text + arguments: + - '@dbal.conn' + - '%tables.privmsgs%' + calls: + - [set_name, [pm_text]] + tags: + - { name: text_reparser.plugin } + + text_reparser.poll_option: + class: phpbb\textreparser\plugins\poll_option + arguments: + - '@dbal.conn' + calls: + - [set_name, [poll_option]] + tags: + - { name: text_reparser.plugin } + + text_reparser.poll_title: + class: phpbb\textreparser\plugins\poll_title + arguments: + - '@dbal.conn' + - '%tables.topics%' + calls: + - [set_name, [poll_title]] + tags: + - { name: text_reparser.plugin } + + text_reparser.post_text: + class: phpbb\textreparser\plugins\post_text + arguments: + - '@dbal.conn' + - '%tables.posts%' + calls: + - [set_name, [post_text]] + tags: + - { name: text_reparser.plugin } + + text_reparser.user_signature: + class: phpbb\textreparser\plugins\user_signature + arguments: + - '@dbal.conn' + - '%tables.users%' + calls: + - [set_name, [user_signature]] + tags: + - { name: text_reparser.plugin } diff --git a/install/update/new/config/default/container/services_twig.yml b/install/update/new/config/default/container/services_twig.yml new file mode 100644 index 0000000..6f70155 --- /dev/null +++ b/install/update/new/config/default/container/services_twig.yml @@ -0,0 +1,86 @@ +parameters: + core.template.cache_path: '%core.cache_dir%twig/' + +services: + template.twig.environment: + class: phpbb\template\twig\environment + arguments: + - '@config' + - '@filesystem' + - '@path_helper' + - '%core.template.cache_path%' + - '@ext.manager' + - '@template.twig.loader' + - '@dispatcher' + - [] + calls: + - [setLexer, ['@template.twig.lexer']] + + template.twig.lexer: + class: phpbb\template\twig\lexer + lazy: true + arguments: + - '@template.twig.environment' + + template.twig.loader: + class: phpbb\template\twig\loader + arguments: + - '@filesystem' + + template.twig.extensions.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: twig.extension } + + template.twig.extensions.phpbb: + class: phpbb\template\twig\extension + arguments: + - '@template_context' + - '@template.twig.environment' + - '@language' + tags: + - { name: twig.extension } + + template.twig.extensions.avatar: + class: phpbb\template\twig\extension\avatar + tags: + - { name: twig.extension } + + template.twig.extensions.config: + class: phpbb\template\twig\extension\config + arguments: + - '@config' + tags: + - { name: twig.extension } + + template.twig.extensions.routing: + class: phpbb\template\twig\extension\routing + arguments: + - '@routing.helper' + tags: + - { name: twig.extension } + + template.twig.extensions.username: + class: phpbb\template\twig\extension\username + tags: + - { name: twig.extension } + + template.twig.extensions.debug: + class: Twig_Extension_Debug + + template: + class: phpbb\template\twig\twig + arguments: + - '@path_helper' + - '@config' + - '@template_context' + - '@template.twig.environment' + - '%core.template.cache_path%' + - '@user' + - '@template.twig.extensions.collection' + - '@ext.manager' + + template_context: + class: phpbb\template\context diff --git a/install/update/new/config/default/container/services_ucp.yml b/install/update/new/config/default/container/services_ucp.yml new file mode 100644 index 0000000..861fa4a --- /dev/null +++ b/install/update/new/config/default/container/services_ucp.yml @@ -0,0 +1,17 @@ +services: + phpbb.ucp.controller.reset_password: + class: phpbb\ucp\controller\reset_password + arguments: + - '@config' + - '@dbal.conn' + - '@dispatcher' + - '@controller.helper' + - '@language' + - '@log' + - '@passwords.manager' + - '@request' + - '@template' + - '@user' + - '%tables.users%' + - '%core.root_path%' + - '%core.php_ext%' diff --git a/install/update/new/config/default/container/services_user.yml b/install/update/new/config/default/container/services_user.yml new file mode 100644 index 0000000..7e634c6 --- /dev/null +++ b/install/update/new/config/default/container/services_user.yml @@ -0,0 +1,20 @@ +services: + acl.permissions: + class: phpbb\permissions + arguments: + - '@dispatcher' + - '@user' + + user: + class: phpbb\user + arguments: + - '@language' + - '%datetime.class%' + + user_loader: + class: phpbb\user_loader + arguments: + - '@dbal.conn' + - '%core.root_path%' + - '%core.php_ext%' + - '%tables.users%' diff --git a/install/update/new/config/default/container/tables.yml b/install/update/new/config/default/container/tables.yml new file mode 100644 index 0000000..4aed357 --- /dev/null +++ b/install/update/new/config/default/container/tables.yml @@ -0,0 +1,78 @@ +parameters: + tables.acl_groups: '%core.table_prefix%acl_groups' + tables.acl_options: '%core.table_prefix%acl_options' + tables.acl_roles: '%core.table_prefix%acl_roles' + tables.acl_roles_data: '%core.table_prefix%acl_roles_data' + tables.acl_users: '%core.table_prefix%acl_users' + tables.attachments: '%core.table_prefix%attachments' + tables.auth_provider_oauth_token_storage: '%core.table_prefix%oauth_tokens' + tables.auth_provider_oauth_states: '%core.table_prefix%oauth_states' + tables.auth_provider_oauth_account_assoc: '%core.table_prefix%oauth_accounts' + tables.banlist: '%core.table_prefix%banlist' + tables.bbcodes: '%core.table_prefix%bbcodes' + tables.bookmarks: '%core.table_prefix%bookmarks' + tables.bots: '%core.table_prefix%bots' + tables.captcha_qa_questions: '%core.table_prefix%captcha_questions' + tables.captcha_qa_answers: '%core.table_prefix%captcha_answers' + tables.captcha_qa_confirm: '%core.table_prefix%qa_confirm' + tables.config: '%core.table_prefix%config' + tables.config_text: '%core.table_prefix%config_text' + tables.confirm: '%core.table_prefix%confirm' + tables.disallow: '%core.table_prefix%disallow' + tables.drafts: '%core.table_prefix%drafts' + tables.ext: '%core.table_prefix%ext' + tables.extensions: '%core.table_prefix%extensions' + tables.extension_groups: '%core.table_prefix%extension_groups' + tables.forums: '%core.table_prefix%forums' + tables.forums_access: '%core.table_prefix%forums_access' + tables.forums_track: '%core.table_prefix%forums_track' + tables.forums_watch: '%core.table_prefix%forums_watch' + tables.groups: '%core.table_prefix%groups' + tables.icons: '%core.table_prefix%icons' + tables.lang: '%core.table_prefix%lang' + tables.log: '%core.table_prefix%log' + tables.login_attempts: '%core.table_prefix%login_attempts' + tables.migrations: '%core.table_prefix%migrations' + tables.moderator_cache: '%core.table_prefix%moderator_cache' + tables.modules: '%core.table_prefix%modules' + tables.notification_types: '%core.table_prefix%notification_types' + tables.notifications: '%core.table_prefix%notifications' + tables.poll_options: '%core.table_prefix%poll_options' + tables.poll_votes: '%core.table_prefix%poll_votes' + tables.posts: '%core.table_prefix%posts' + tables.privmsgs: '%core.table_prefix%privmsgs' + tables.privmsgs_folder: '%core.table_prefix%privmsgs_folder' + tables.privmsgs_rules: '%core.table_prefix%privmsgs_rules' + tables.privmsgs_to: '%core.table_prefix%privmsgs_to' + tables.profile_fields: '%core.table_prefix%profile_fields' + tables.profile_fields_data: '%core.table_prefix%profile_fields_data' + tables.profile_fields_options_language: '%core.table_prefix%profile_fields_lang' + tables.profile_fields_language: '%core.table_prefix%profile_lang' + tables.ranks: '%core.table_prefix%ranks' + tables.reports: '%core.table_prefix%reports' + tables.reports_reasons: '%core.table_prefix%reports_reasons' + tables.search_results: '%core.table_prefix%search_results' + tables.search_wordlist: '%core.table_prefix%search_wordlist' + tables.search_wordmatch: '%core.table_prefix%search_wordmatch' + tables.sessions: '%core.table_prefix%sessions' + tables.sessions_keys: '%core.table_prefix%sessions_keys' + tables.sitelist: '%core.table_prefix%sitelist' + tables.smilies: '%core.table_prefix%smilies' + tables.sphinx: '%core.table_prefix%sphinx' + tables.styles: '%core.table_prefix%styles' + tables.styles_template: '%core.table_prefix%styles_template' + tables.styles_template_data: '%core.table_prefix%styles_template_data' + tables.styles_theme: '%core.table_prefix%styles_theme' + tables.styles_imageset: '%core.table_prefix%styles_imageset' + tables.styles_imageset_data: '%core.table_prefix%styles_imageset_data' + tables.teampage: '%core.table_prefix%teampage' + tables.topics: '%core.table_prefix%topics' + tables.topics_posted: '%core.table_prefix%topics_posted' + tables.topics_track: '%core.table_prefix%topics_track' + tables.topics_watch: '%core.table_prefix%topics_watch' + tables.user_group: '%core.table_prefix%user_group' + tables.user_notifications: '%core.table_prefix%user_notifications' + tables.users: '%core.table_prefix%users' + tables.warnings: '%core.table_prefix%warnings' + tables.words: '%core.table_prefix%words' + tables.zebra: '%core.table_prefix%zebra' diff --git a/install/update/new/config/default/routing/cron.yml b/install/update/new/config/default/routing/cron.yml new file mode 100644 index 0000000..5a63416 --- /dev/null +++ b/install/update/new/config/default/routing/cron.yml @@ -0,0 +1,3 @@ +phpbb_cron_run: + path: /{cron_type} + defaults: { _controller: cron.controller:handle } diff --git a/install/update/new/config/default/routing/feed.yml b/install/update/new/config/default/routing/feed.yml new file mode 100644 index 0000000..22c9ea5 --- /dev/null +++ b/install/update/new/config/default/routing/feed.yml @@ -0,0 +1,35 @@ +phpbb_feed_forums: + path: /forums + defaults: { _controller: phpbb.feed.controller:forums } + +phpbb_feed_news: + path: /news + defaults: { _controller: phpbb.feed.controller:news } + +phpbb_feed_topics: + path: /topics + defaults: { _controller: phpbb.feed.controller:topics } + +phpbb_feed_topics_active: + path: /topics_active + defaults: { _controller: phpbb.feed.controller:topics_active } + +phpbb_feed_topics_new: + path: /topics_new + defaults: { _controller: phpbb.feed.controller:topics_new } + +phpbb_feed_forum: + path: /forum/{forum_id} + defaults: { _controller: phpbb.feed.controller:forum } + requirements: + forum_id: \d+ + +phpbb_feed_topic: + path: /topic/{topic_id} + defaults: { _controller: phpbb.feed.controller:topic } + requirements: + topic_id: \d+ + +phpbb_feed_overall: + path: /{mode} + defaults: { _controller: phpbb.feed.controller:overall } diff --git a/install/update/new/config/default/routing/help.yml b/install/update/new/config/default/routing/help.yml new file mode 100644 index 0000000..8d43839 --- /dev/null +++ b/install/update/new/config/default/routing/help.yml @@ -0,0 +1,7 @@ +phpbb_help_bbcode_controller: + path: /bbcode + defaults: { _controller: phpbb.help.controller.bbcode:handle } + +phpbb_help_faq_controller: + path: /faq + defaults: { _controller: phpbb.help.controller.faq:handle } diff --git a/install/update/new/config/default/routing/report.yml b/install/update/new/config/default/routing/report.yml new file mode 100644 index 0000000..c386770 --- /dev/null +++ b/install/update/new/config/default/routing/report.yml @@ -0,0 +1,17 @@ +phpbb_report_pm_controller: + path: /pm/{id}/report + methods: [GET, POST] + defaults: + _controller: phpbb.report.controller:handle + mode: 'pm' + requirements: + id: \d+ + +phpbb_report_post_controller: + path: /post/{id}/report + methods: [GET, POST] + defaults: + _controller: phpbb.report.controller:handle + mode: 'post' + requirements: + id: \d+ diff --git a/install/update/new/config/default/routing/routing.yml b/install/update/new/config/default/routing/routing.yml new file mode 100644 index 0000000..a5e9265 --- /dev/null +++ b/install/update/new/config/default/routing/routing.yml @@ -0,0 +1,32 @@ +# Structure: +# +# foo_controller: +# path: /foo +# defaults: { _controller: foo_sevice:method } +# +# The above will be accessed via app.php?controller=foo and it will +# instantiate the 'foo_service' service and call the 'method' method. +# + +phpbb_cron_routing: + resource: cron.yml + prefix: /cron + +phpbb_feed_routing: + resource: feed.yml + prefix: /feed + +phpbb_feed_index: + path: /feed + defaults: { _controller: phpbb.feed.controller:overall } + +phpbb_help_routing: + resource: help.yml + prefix: /help + +phpbb_report_routing: + resource: report.yml + +phpbb_ucp_routing: + resource: ucp.yml + prefix: /user diff --git a/install/update/new/config/default/routing/ucp.yml b/install/update/new/config/default/routing/ucp.yml new file mode 100644 index 0000000..06bd7c3 --- /dev/null +++ b/install/update/new/config/default/routing/ucp.yml @@ -0,0 +1,7 @@ +phpbb_ucp_reset_password_controller: + path: /reset_password + defaults: { _controller: phpbb.ucp.controller.reset_password:reset } + +phpbb_ucp_forgot_password_controller: + path: /forgot_password + defaults: { _controller: phpbb.ucp.controller.reset_password:request } diff --git a/install/update/new/config/installer/config.yml b/install/update/new/config/installer/config.yml new file mode 100644 index 0000000..979dbbc --- /dev/null +++ b/install/update/new/config/installer/config.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../default/config.yml } diff --git a/install/update/new/config/installer/container/environment.yml b/install/update/new/config/installer/container/environment.yml new file mode 100644 index 0000000..40a3c7a --- /dev/null +++ b/install/update/new/config/installer/container/environment.yml @@ -0,0 +1,3 @@ +imports: + - { resource: services.yml } + - { resource: parameters.yml } diff --git a/install/update/new/config/installer/container/parameters.yml b/install/update/new/config/installer/container/parameters.yml new file mode 100644 index 0000000..f11f7e2 --- /dev/null +++ b/install/update/new/config/installer/container/parameters.yml @@ -0,0 +1,5 @@ +imports: + - { resource: ../../default/container/parameters.yml } + +parameters: + installer.create_config_file.options: [] diff --git a/install/update/new/config/installer/container/services.yml b/install/update/new/config/installer/container/services.yml new file mode 100644 index 0000000..7203c0a --- /dev/null +++ b/install/update/new/config/installer/container/services.yml @@ -0,0 +1,104 @@ +imports: + - { resource: services_installer.yml } + - { resource: ../../default/container/services_event.yml } + - { resource: ../../default/container/services_filesystem.yml } + - { resource: ../../default/container/services_http.yml } + - { resource: ../../default/container/services_language.yml } + - { resource: ../../default/container/services_php.yml } + - { resource: ../../default/container/services_routing.yml } + - { resource: ../../default/container/services_twig.yml } + +services: + cache.driver: + class: '%cache.driver.class%' + arguments: + - '%core.cache_dir%' + + config: + class: phpbb\config\config + arguments: + - + rand_seed: 'installer_seed' + rand_seed_last_update: 0 + + controller.resolver: + class: phpbb\controller\resolver + arguments: + - '@service_container' + - '%core.root_path%' + - '@template' + + file_locator: + class: phpbb\routing\file_locator + arguments: + - '@filesystem' + - '%core.root_path%' + + kernel_exception_subscriber: + class: phpbb\install\event\kernel_exception_subscriber + arguments: + - '@phpbb.installer.controller.helper' + - '@language' + - '@template' + tags: + - { name: kernel.event_subscriber } + + language.loader: + parent: language.loader_abstract + + path_helper: + class: phpbb\path_helper + arguments: + - '@symfony_request' + - '@filesystem' + - '@request' + - '%core.root_path%' + - '%core.php_ext%' + + routing.resources_locator.default: + class: phpbb\routing\resources_locator\installer_resources_locator + arguments: + - '@filesystem' + - '%core.root_path%' + - '%core.environment%' + tags: + - { name: routing.resources_locator } + + template: + class: phpbb\template\twig\twig + arguments: + - '@path_helper' + - '@config' + - '@template_context' + - '@template.twig.environment' + - '%core.template.cache_path%' + - null + - '@template.twig.extensions.collection' + + template.twig.environment: + class: phpbb\template\twig\environment + arguments: + - '@config' + - '@filesystem' + - '@path_helper' + - '%core.template.cache_path%' + - null + - '@template.twig.loader' + - null + - [] + calls: + - [setLexer, ['@template.twig.lexer']] + + user: + class: phpbb\user + arguments: + - '@language' + - '%datetime.class%' + + console.exception_subscriber: + class: phpbb\console\exception_subscriber + arguments: + - '@language' + - '%debug.exceptions%' + tags: + - { name: kernel.event_subscriber } diff --git a/install/update/new/config/installer/container/services_file_updater.yml b/install/update/new/config/installer/container/services_file_updater.yml new file mode 100644 index 0000000..9d39bb8 --- /dev/null +++ b/install/update/new/config/installer/container/services_file_updater.yml @@ -0,0 +1,38 @@ +services: + installer.file_updater.factory: + class: phpbb\install\helper\file_updater\factory + arguments: + - '@installer.file_updater.collection' + + installer.file_updater.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: file_updater } + + installer.file_updater.compress: + class: phpbb\install\helper\file_updater\compression_file_updater + arguments: + - '@installer.helper.update_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: file_updater } + + installer.file_updater.ftp: + class: phpbb\install\helper\file_updater\ftp_file_updater + arguments: + - '@installer.helper.update_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: file_updater } + + installer.file_updater.file: + class: phpbb\install\helper\file_updater\file_updater + arguments: + - '@filesystem' + - '%core.root_path%' + tags: + - { name: file_updater } diff --git a/install/update/new/config/installer/container/services_install_console.yml b/install/update/new/config/installer/container/services_install_console.yml new file mode 100644 index 0000000..41d3aa4 --- /dev/null +++ b/install/update/new/config/installer/container/services_install_console.yml @@ -0,0 +1,61 @@ +services: + console.installer.command_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: console.installer.command } + + console.installer.command.install: + class: phpbb\install\console\command\install\install + arguments: + - '@language' + - '@installer.helper.iohandler_factory' + - '@installer.installer.install' + - '@installer.helper.install_helper' + tags: + - { name: console.installer.command } + + console.installer.command.config.show: + class: phpbb\install\console\command\install\config\show + arguments: + - '@language' + - '@installer.helper.iohandler_factory' + tags: + - { name: console.installer.command } + + + console.installer.command.config.validate: + class: phpbb\install\console\command\install\config\validate + arguments: + - '@language' + - '@installer.helper.iohandler_factory' + tags: + - { name: console.installer.command } + + console.updater.command.update: + class: phpbb\install\console\command\update\update + arguments: + - '@language' + - '@installer.helper.iohandler_factory' + - '@installer.installer.update' + - '@installer.helper.install_helper' + tags: + - { name: console.installer.command } + + console.updater.command.config.show: + class: phpbb\install\console\command\update\config\show + arguments: + - '@language' + - '@installer.helper.iohandler_factory' + tags: + - { name: console.installer.command } + + + console.updater.command.config.validate: + class: phpbb\install\console\command\update\config\validate + arguments: + - '@language' + - '@installer.helper.iohandler_factory' + tags: + - { name: console.installer.command } diff --git a/install/update/new/config/installer/container/services_install_controller.yml b/install/update/new/config/installer/container/services_install_controller.yml new file mode 100644 index 0000000..5aaba0f --- /dev/null +++ b/install/update/new/config/installer/container/services_install_controller.yml @@ -0,0 +1,73 @@ +services: + phpbb.installer.controller.welcome: + class: phpbb\install\controller\installer_index + arguments: + - '@phpbb.installer.controller.helper' + - '@language' + - '@template' + - '%core.root_path%' + + phpbb.installer.controller.helper: + class: phpbb\install\controller\helper + arguments: + - '@installer.helper.config' + - '@language' + - '@language.helper.language_file' + - '@installer.navigation.provider' + - '@template' + - '@path_helper' + - '@request' + - '@symfony_request' + - '@router' + - '%core.root_path%' + + phpbb.installer.controller.install: + class: phpbb\install\controller\install + arguments: + - '@phpbb.installer.controller.helper' + - '@installer.helper.iohandler_factory' + - '@installer.navigation.provider' + - '@language' + - '@template' + - '@request' + - '@installer.installer.install' + - '@installer.helper.install_helper' + + phpbb.installer.controller.update: + class: phpbb\install\controller\update + arguments: + - '@phpbb.installer.controller.helper' + - '@installer.installer.update' + - '@installer.helper.install_helper' + - '@installer.helper.iohandler_factory' + - '@language' + - '@installer.navigation.provider' + - '@request' + - '@template' + + phpbb.installer.controller.file_downloader: + class: phpbb\install\controller\archive_download + arguments: + - '@installer.helper.config' + + phpbb.installer.controller.convert: + class: phpbb\convert\controller\convertor + arguments: + - '@cache.driver' + - '@installer.helper.container_factory' + - '@installer.helper.database' + - '@phpbb.installer.controller.helper' + - '@installer.helper.install_helper' + - '@installer.helper.iohandler_factory' + - '@language' + - '@installer.navigation.provider' + - '@request' + - '@template' + - '%core.root_path%' + - '%core.php_ext%' + + phpbb.installer.controller.status: + class: phpbb\install\controller\timeout_check + arguments: + - '@phpbb.installer.controller.helper' + - '%core.root_path%' diff --git a/install/update/new/config/installer/container/services_install_data.yml b/install/update/new/config/installer/container/services_install_data.yml new file mode 100644 index 0000000..5de0017 --- /dev/null +++ b/install/update/new/config/installer/container/services_install_data.yml @@ -0,0 +1,55 @@ +services: + installer.install_data.add_bots: + class: phpbb\install\module\install_data\task\add_bots + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.container_factory' + - '@language' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: install_data_install, order: 20 } + + installer.install_data.add_languages: + class: phpbb\install\module\install_data\task\add_languages + arguments: + - '@installer.helper.iohandler' + - '@installer.helper.container_factory' + - '@language.helper.language_file' + tags: + - { name: install_data_install, order: 10 } + + installer.install_data.add_modules: + class: phpbb\install\module\install_data\task\add_modules + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.container_factory' + tags: + - { name: install_data_install, order: 30 } + + installer.install_data.create_search_index: + class: phpbb\install\module\install_data\task\create_search_index + arguments: + - '@config' + - '@installer.helper.container_factory' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: install_data_install, order: 40 } + + installer.module.data_install_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: install_data_install, class_name_aware: true } + + installer.module.data_install: + class: phpbb\install\module\install_data\module + parent: installer.module_base + arguments: + - '@installer.module.data_install_collection' + tags: + - { name: installer_install_module, order: 50 } diff --git a/install/update/new/config/installer/container/services_install_database.yml b/install/update/new/config/installer/container/services_install_database.yml new file mode 100644 index 0000000..33f5965 --- /dev/null +++ b/install/update/new/config/installer/container/services_install_database.yml @@ -0,0 +1,71 @@ +services: + installer.install_database.create_schema_file: + class: phpbb\install\module\install_database\task\create_schema_file + arguments: + - '@installer.helper.config' + - '@installer.helper.database' + - '@filesystem' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: install_database_install, order: 10 } + + installer.install_database.set_up_database: + class: phpbb\install\module\install_database\task\set_up_database + arguments: + - '@installer.helper.config' + - '@installer.helper.database' + - '@filesystem' + - '@installer.helper.iohandler' + - '%core.root_path%' + tags: + - { name: install_database_install, order: 20 } + + installer.install_database.add_tables: + class: phpbb\install\module\install_database\task\add_tables + arguments: + - '@installer.helper.config' + - '@installer.helper.database' + - '@filesystem' + - '%core.root_path%' + tags: + - { name: install_database_install, order: 30 } + + installer.install_database.add_default_data: + class: phpbb\install\module\install_database\task\add_default_data + arguments: + - '@installer.helper.database' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.container_factory' + - '@language' + - '%core.root_path%' + tags: + - { name: install_database_install, order: 40 } + + installer.install_database.add_config_settings: + class: phpbb\install\module\install_database\task\add_config_settings + arguments: + - '@filesystem' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.container_factory' + - '@language' + - '%core.root_path%' + tags: + - { name: install_database_install, order: 50 } + + installer.module.install_database_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: install_database_install, class_name_aware: true } + + installer.module.database_install: + class: phpbb\install\module\install_database\module + parent: installer.module_base + arguments: + - '@installer.module.install_database_collection' + tags: + - { name: installer_install_module, order: 40 } diff --git a/install/update/new/config/installer/container/services_install_filesystem.yml b/install/update/new/config/installer/container/services_install_filesystem.yml new file mode 100644 index 0000000..65b2a6e --- /dev/null +++ b/install/update/new/config/installer/container/services_install_filesystem.yml @@ -0,0 +1,28 @@ +services: + installer.install_filesystem.create_config_file: + class: phpbb\install\module\install_filesystem\task\create_config_file + arguments: + - '@filesystem' + - '@installer.helper.config' + - '@installer.helper.database' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + - '%installer.create_config_file.options%' + tags: + - { name: install_filesystem_install, order: 10 } + + installer.module.install_filesystem_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: install_filesystem_install, class_name_aware: true } + + installer.module.filesystem_install: + class: phpbb\install\module\install_filesystem\module + parent: installer.module_base + arguments: + - '@installer.module.install_filesystem_collection' + tags: + - { name: installer_install_module, order: 30 } diff --git a/install/update/new/config/installer/container/services_install_finish.yml b/install/update/new/config/installer/container/services_install_finish.yml new file mode 100644 index 0000000..6a46d8f --- /dev/null +++ b/install/update/new/config/installer/container/services_install_finish.yml @@ -0,0 +1,44 @@ +services: + installer.install_finish.populate_migrations: + class: phpbb\install\module\install_finish\task\populate_migrations + arguments: + - '@installer.helper.config' + - '@installer.helper.container_factory' + tags: + - { name: install_finish, order: 10 } + + installer.install_finish.install_extensions: + class: phpbb\install\module\install_finish\task\install_extensions + arguments: + - '@installer.helper.container_factory' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '%core.root_path%' + tags: + - { name: install_finish, order: 20 } + + installer.install_finish.notify_user: + class: phpbb\install\module\install_finish\task\notify_user + arguments: + - '@installer.helper.container_factory' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: install_finish, order: 30 } + + installer.module.install_finish_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: install_finish, class_name_aware: true } + + installer.module.finish_install: + class: phpbb\install\module\install_finish\module + parent: installer.module_base + arguments: + - '@installer.module.install_finish_collection' + tags: + - { name: installer_install_module, order: 60 } diff --git a/install/update/new/config/installer/container/services_install_navigation.yml b/install/update/new/config/installer/container/services_install_navigation.yml new file mode 100644 index 0000000..d7151eb --- /dev/null +++ b/install/update/new/config/installer/container/services_install_navigation.yml @@ -0,0 +1,42 @@ +services: + installer.navigation.provider: + class: phpbb\install\helper\navigation\navigation_provider + arguments: + - '@installer.navigation.service_collection' + + installer.navigation.service_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: installer.navigation } + + installer.navigation.main_navigation: + class: phpbb\install\helper\navigation\main_navigation + shared: false + tags: + - { name: installer.navigation } + + installer.navigation.install_navigation: + class: phpbb\install\helper\navigation\install_navigation + arguments: + - '@installer.helper.install_helper' + shared: false + tags: + - { name: installer.navigation } + + installer.navigation.update_navigation: + class: phpbb\install\helper\navigation\update_navigation + arguments: + - '@installer.helper.install_helper' + shared: false + tags: + - { name: installer.navigation } + + installer.navigation.convertor_navigation: + class: phpbb\install\helper\navigation\convertor_navigation + arguments: + - '@installer.helper.install_helper' + shared: false + tags: + - { name: installer.navigation } diff --git a/install/update/new/config/installer/container/services_install_obtain_data.yml b/install/update/new/config/installer/container/services_install_obtain_data.yml new file mode 100644 index 0000000..010aba8 --- /dev/null +++ b/install/update/new/config/installer/container/services_install_obtain_data.yml @@ -0,0 +1,59 @@ +services: + installer.obtain_data.obtain_admin_data: + class: phpbb\install\module\obtain_data\task\obtain_admin_data + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: install_obtain_data, order: 10 } + + installer.obtain_data.obtain_board_data: + class: phpbb\install\module\obtain_data\task\obtain_board_data + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@language.helper.language_file' + tags: + - { name: install_obtain_data, order: 50 } + + installer.obtain_data.obtain_database_data: + class: phpbb\install\module\obtain_data\task\obtain_database_data + arguments: + - '@installer.helper.database' + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: install_obtain_data, order: 20 } + + installer.obtain_data.obtain_email_data: + class: phpbb\install\module\obtain_data\task\obtain_email_data + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: install_obtain_data, order: 40 } + + installer.obtain_data.obtain_server_data: + class: phpbb\install\module\obtain_data\task\obtain_server_data + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: install_obtain_data, order: 30 } + + installer.module.install_obtain_data_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: install_obtain_data, class_name_aware: true } + + installer.module.obtain_data_install: + class: phpbb\install\module\obtain_data\install_module + parent: installer.module_base + arguments: + - '@installer.module.install_obtain_data_collection' + - true + - false + tags: + - { name: installer_install_module, order: 20 } diff --git a/install/update/new/config/installer/container/services_install_requirements.yml b/install/update/new/config/installer/container/services_install_requirements.yml new file mode 100644 index 0000000..c03eb1f --- /dev/null +++ b/install/update/new/config/installer/container/services_install_requirements.yml @@ -0,0 +1,37 @@ +services: + installer.requirements.check_filesystem: + class: phpbb\install\module\requirements\task\check_filesystem + arguments: + - '@filesystem' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: installer_requirements, order: 10 } + + installer.requirements.check_server_environment: + class: phpbb\install\module\requirements\task\check_server_environment + arguments: + - '@installer.helper.database' + - '@installer.helper.iohandler' + tags: + - { name: installer_requirements, order: 20 } + - { name: update_requirements, order: 20 } + + installer.module.install_requirements_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: installer_requirements, class_name_aware: true } + +# Please note, that the name of this module is hard coded in the installer service + installer.module.requirements_install: + class: phpbb\install\module\requirements\install_module + parent: installer.module_base + arguments: + - '@installer.module.install_requirements_collection' + - true + - false + tags: + - { name: installer_install_module, order: 10 } diff --git a/install/update/new/config/installer/container/services_installer.yml b/install/update/new/config/installer/container/services_installer.yml new file mode 100644 index 0000000..57181b2 --- /dev/null +++ b/install/update/new/config/installer/container/services_installer.yml @@ -0,0 +1,119 @@ +imports: + - { resource: services_file_updater.yml } + - { resource: services_install_console.yml } + - { resource: services_install_controller.yml } + - { resource: services_install_data.yml } + - { resource: services_install_database.yml } + - { resource: services_install_filesystem.yml } + - { resource: services_install_finish.yml } + - { resource: services_install_navigation.yml } + - { resource: services_install_obtain_data.yml } + - { resource: services_install_requirements.yml } + - { resource: services_update_database.yml } + - { resource: services_update_filesystem.yml } + - { resource: services_update_obtain_data.yml } + - { resource: services_update_requirements.yml } + +services: +# -------- Installer helpers ------------------------ + installer.helper.config: + class: phpbb\install\helper\config + arguments: + - '@filesystem' + - '@php_ini' + - '%core.root_path%' + + installer.helper.database: + class: phpbb\install\helper\database + arguments: + - '@filesystem' + - '%core.root_path%' + + installer.helper.iohandler_factory: + class: phpbb\install\helper\iohandler\factory + arguments: + - '@service_container' + + installer.helper.iohandler_abstract: + abstract: true + calls: + - [set_language, ['@language']] + + installer.helper.iohandler_ajax: + class: phpbb\install\helper\iohandler\ajax_iohandler + parent: installer.helper.iohandler_abstract + arguments: + - '@path_helper' + - '@request' + - '@template' + - '@router' + - '%core.root_path%' + + installer.helper.iohandler_cli: + class: phpbb\install\helper\iohandler\cli_iohandler + parent: installer.helper.iohandler_abstract + + installer.helper.iohandler: + class: phpbb\install\helper\iohandler\iohandler_interface + factory: ['@installer.helper.iohandler_factory', get] + + installer.helper.container_factory: + class: phpbb\install\helper\container_factory + arguments: + - '@language' + - '@request' + - '@installer.helper.update_helper' + - '%core.root_path%' + - '%core.php_ext%' + + installer.helper.install_helper: + class: phpbb\install\helper\install_helper + arguments: + - '%core.root_path%' + - '%core.php_ext%' + + installer.helper.update_helper: + class: phpbb\install\helper\update_helper + arguments: + - '%core.root_path%' + +# -------- Installer -------------------------------- + installer.module_base: + abstract: true + calls: + - [setup, ['@installer.helper.config', '@installer.helper.iohandler']] + + installer.installer.abstract: + class: phpbb\install\installer + abstract: true + arguments: + - '@cache.driver' + - '@installer.helper.config' + - '@path_helper' + - '@installer.helper.container_factory' + + installer.install.module_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: installer_install_module } + + installer.update.module_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: installer_update_module } + + installer.installer.install: + parent: installer.installer.abstract + calls: + - [set_modules, ['@installer.install.module_collection']] + - [set_purge_cache_before, [false]] + + installer.installer.update: + parent: installer.installer.abstract + calls: + - [set_modules, ['@installer.update.module_collection']] + - [set_purge_cache_before, [true]] diff --git a/install/update/new/config/installer/container/services_update_database.yml b/install/update/new/config/installer/container/services_update_database.yml new file mode 100644 index 0000000..bb97cff --- /dev/null +++ b/install/update/new/config/installer/container/services_update_database.yml @@ -0,0 +1,40 @@ +services: + installer.update_database.update_task: + class: phpbb\install\module\update_database\task\update + arguments: + - '@installer.helper.container_factory' + - '@filesystem' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@language' + - '%core.root_path%' + tags: + - { name: update_database_task, order: 10 } + + installer.update_database.update_extensions: + class: phpbb\install\module\update_database\task\update_extensions + arguments: + - '@installer.helper.container_factory' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.update_helper' + - '%core.root_path%' + tags: + - { name: update_database_task, order: 20 } + + installer.module.update_database_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: update_database_task, class_name_aware: true } + + installer.module.update_database: + class: phpbb\install\module\update_database\module + parent: installer.module_base + arguments: + - '@installer.module.update_database_collection' + - true + - false + tags: + - { name: installer_update_module, order: 40 } diff --git a/install/update/new/config/installer/container/services_update_filesystem.yml b/install/update/new/config/installer/container/services_update_filesystem.yml new file mode 100644 index 0000000..c0a0467 --- /dev/null +++ b/install/update/new/config/installer/container/services_update_filesystem.yml @@ -0,0 +1,72 @@ +services: + installer.update_filesystem.check_task: + class: phpbb\install\module\update_filesystem\task\file_check + arguments: + - '@filesystem' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.update_helper' + - '%core.root_path%' + tags: + - { name: update_filesystem, order: 10 } + + installer.update_filesystem.diff_files: + class: phpbb\install\module\update_filesystem\task\diff_files + arguments: + - '@installer.helper.container_factory' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.update_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: update_filesystem, order: 20 } + + installer.update_filesystem.show_file_status: + class: phpbb\install\module\update_filesystem\task\show_file_status + arguments: + - '@installer.helper.container_factory' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@filesystem' + - '@installer.file_updater.factory' + tags: + - { name: update_filesystem, order: 30 } + + installer.update_filesystem.update_files: + class: phpbb\install\module\update_filesystem\task\update_files + arguments: + - '@installer.helper.container_factory' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.file_updater.factory' + - '@installer.helper.update_helper' + - '%core.root_path%' + tags: + - { name: update_filesystem, order: 40 } + + installer.update_filesystem.download_updated_files: + class: phpbb\install\module\update_filesystem\task\download_updated_files + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@filesystem' + tags: + - { name: update_filesystem, order: 50 } + + installer.module.update_filesystem_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: update_filesystem, class_name_aware: true } + + installer.module.filesystem_update: + class: phpbb\install\module\update_filesystem\module + parent: installer.module_base + arguments: + - '@installer.module.update_filesystem_collection' + - true + - false + tags: + - { name: installer_update_module, order: 30 } diff --git a/install/update/new/config/installer/container/services_update_obtain_data.yml b/install/update/new/config/installer/container/services_update_obtain_data.yml new file mode 100644 index 0000000..999976a --- /dev/null +++ b/install/update/new/config/installer/container/services_update_obtain_data.yml @@ -0,0 +1,53 @@ +services: + installer.obtain_data.update_options: + class: phpbb\install\module\obtain_data\task\obtain_update_settings + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: update_obtain_data, order: 10 } + + installer.obtain_data.file_updater_method: + class: phpbb\install\module\obtain_data\task\obtain_file_updater_method + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + tags: + - { name: update_obtain_data, order: 20 } + + installer.obtain_data.update_files: + class: phpbb\install\module\obtain_data\task\obtain_update_files + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: update_obtain_data, order: 30 } + + installer.obtain_data.update_ftp_settings: + class: phpbb\install\module\obtain_data\task\obtain_update_ftp_data + arguments: + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.update_helper' + - '%core.php_ext%' + tags: + - { name: update_obtain_data, order: 40 } + + installer.module.update_obtain_data_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: update_obtain_data, class_name_aware: true } + + installer.module.obtain_data_update: + class: phpbb\install\module\obtain_data\update_module + parent: installer.module_base + arguments: + - '@installer.module.update_obtain_data_collection' + - true + - false + tags: + - { name: installer_update_module, order: 20 } diff --git a/install/update/new/config/installer/container/services_update_requirements.yml b/install/update/new/config/installer/container/services_update_requirements.yml new file mode 100644 index 0000000..6b851de --- /dev/null +++ b/install/update/new/config/installer/container/services_update_requirements.yml @@ -0,0 +1,41 @@ +services: + installer.requirements.check_filesystem_update: + class: phpbb\install\module\requirements\task\check_filesystem + arguments: + - '@filesystem' + - '@installer.helper.iohandler' + - '%core.root_path%' + - '%core.php_ext%' + - false + tags: + - { name: update_requirements, order: 10 } + + installer.requirements.update_requirements: + class: phpbb\install\module\requirements\task\check_update + arguments: + - '@installer.helper.container_factory' + - '@filesystem' + - '@installer.helper.config' + - '@installer.helper.iohandler' + - '@installer.helper.update_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: update_requirements, order: 30 } + + installer.module.update_requirements_collection: + class: phpbb\di\ordered_service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: update_requirements, class_name_aware: true } + + installer.module.requirements_update: + class: phpbb\install\module\requirements\update_module + parent: installer.module_base + arguments: + - '@installer.module.update_requirements_collection' + - true + - false + tags: + - { name: installer_update_module, order: 10 } diff --git a/install/update/new/config/installer/routing/environment.yml b/install/update/new/config/installer/routing/environment.yml new file mode 100644 index 0000000..7a1f588 --- /dev/null +++ b/install/update/new/config/installer/routing/environment.yml @@ -0,0 +1,2 @@ +core.default: + resource: installer.yml diff --git a/install/update/new/config/installer/routing/installer.yml b/install/update/new/config/installer/routing/installer.yml new file mode 100644 index 0000000..66b8893 --- /dev/null +++ b/install/update/new/config/installer/routing/installer.yml @@ -0,0 +1,67 @@ +phpbb_installer_index: + path: / + defaults: + _controller: phpbb.installer.controller.welcome:handle + mode: 'intro' + +phpbb_installer_license: + path: /license + defaults: + _controller: phpbb.installer.controller.welcome:handle + mode: 'license' + +phpbb_installer_support: + path: /support + defaults: + _controller: phpbb.installer.controller.welcome:handle + mode: 'support' + +phpbb_installer_install: + path: /install + defaults: + _controller: phpbb.installer.controller.install:handle + +phpbb_installer_update: + path: /update + defaults: + _controller: phpbb.installer.controller.update:handle + +phpbb_installer_update_file_download: + path: /download/updated + defaults: + _controller: phpbb.installer.controller.file_downloader:update_archive + +phpbb_installer_update_conflict_download: + path: /download/conflict + defaults: + _controller: phpbb.installer.controller.file_downloader:conflict_archive + +phpbb_convert_intro: + path: /convert/{start_new} + defaults: + _controller: phpbb.installer.controller.convert:intro + start_new: 0 + +phpbb_convert_settings: + path: /convert/settings/{converter} + defaults: + _controller: phpbb.installer.controller.convert:settings + requirements: + converter: "[a-zA-Z0-9_]+" + +phpbb_convert_convert: + path: /convert/in_progress/{converter} + defaults: + _controller: phpbb.installer.controller.convert:convert + requirements: + converter: "[a-zA-Z0-9_]+" + +phpbb_convert_finish: + path: /convert/finished + defaults: + _controller: phpbb.installer.controller.convert:finish + +phpbb_installer_status: + path: /installer/status + defaults: + _controller: phpbb.installer.controller.status:status diff --git a/install/update/new/config/production/config.yml b/install/update/new/config/production/config.yml new file mode 100644 index 0000000..979dbbc --- /dev/null +++ b/install/update/new/config/production/config.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../default/config.yml } diff --git a/install/update/new/config/production/container/environment.yml b/install/update/new/config/production/container/environment.yml new file mode 100644 index 0000000..40a3c7a --- /dev/null +++ b/install/update/new/config/production/container/environment.yml @@ -0,0 +1,3 @@ +imports: + - { resource: services.yml } + - { resource: parameters.yml } diff --git a/install/update/new/config/production/container/parameters.yml b/install/update/new/config/production/container/parameters.yml new file mode 100644 index 0000000..0447646 --- /dev/null +++ b/install/update/new/config/production/container/parameters.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../../default/container/parameters.yml } diff --git a/install/update/new/config/production/container/services.yml b/install/update/new/config/production/container/services.yml new file mode 100644 index 0000000..b302f0f --- /dev/null +++ b/install/update/new/config/production/container/services.yml @@ -0,0 +1,2 @@ +imports: + - { resource: ../../default/container/services.yml } diff --git a/install/update/new/config/production/routing/environment.yml b/install/update/new/config/production/routing/environment.yml new file mode 100644 index 0000000..301183b --- /dev/null +++ b/install/update/new/config/production/routing/environment.yml @@ -0,0 +1,2 @@ +core.default: + resource: ../../default/routing/routing.yml diff --git a/install/update/new/cron.php b/install/update/new/cron.php new file mode 100644 index 0000000..c99b772 --- /dev/null +++ b/install/update/new/cron.php @@ -0,0 +1,37 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use Symfony\Component\HttpFoundation\RedirectResponse; + +/** +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); + +// Do not update users last page entry +$user->session_begin(false); +$auth->acl($user->data); + +$cron_type = $request->variable('cron_type', ''); + +$get_params_array = $request->get_super_global(\phpbb\request\request_interface::GET); + +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); +$response = new RedirectResponse( + $controller_helper->route('phpbb_cron_run', $get_params_array, false), + 301 +); +$response->send(); diff --git a/install/update/new/download/file.php b/install/update/new/download/file.php new file mode 100644 index 0000000..6d0796d --- /dev/null +++ b/install/update/new/download/file.php @@ -0,0 +1,321 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); + +// Thank you sun. +if (isset($_SERVER['CONTENT_TYPE'])) +{ + if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive') + { + exit; + } +} +else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Java') !== false) +{ + exit; +} + +if (isset($_GET['avatar'])) +{ + require($phpbb_root_path . 'includes/startup.' . $phpEx); + + require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); + $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); + $phpbb_class_loader->register(); + + $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); + extract($phpbb_config_php_file->get_all()); + + if (!defined('PHPBB_ENVIRONMENT')) + { + @define('PHPBB_ENVIRONMENT', 'production'); + } + + if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) + { + exit; + } + + require($phpbb_root_path . 'includes/constants.' . $phpEx); + require($phpbb_root_path . 'includes/functions.' . $phpEx); + require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); + require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + + // Setup class loader first + $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); + $phpbb_class_loader_ext->register(); + + // Set up container + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); + $phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container(); + + $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); + $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); + + // set up caching + /* @var $cache \phpbb\cache\service */ + $cache = $phpbb_container->get('cache'); + + /* @var $phpbb_dispatcher \phpbb\event\dispatcher */ + $phpbb_dispatcher = $phpbb_container->get('dispatcher'); + + /* @var $request \phpbb\request\request_interface */ + $request = $phpbb_container->get('request'); + + /* @var $db \phpbb\db\driver\driver_interface */ + $db = $phpbb_container->get('dbal.conn'); + + /* @var $phpbb_log \phpbb\log\log_interface */ + $phpbb_log = $phpbb_container->get('log'); + + unset($dbpasswd); + + /* @var $config \phpbb\config\config */ + $config = $phpbb_container->get('config'); + + // load extensions + /* @var $phpbb_extension_manager \phpbb\extension\manager */ + $phpbb_extension_manager = $phpbb_container->get('ext.manager'); + + // worst-case default + $browser = strtolower($request->header('User-Agent', 'msie 6.0')); + + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + + $filename = $request->variable('avatar', ''); + $avatar_group = false; + $exit = false; + + if (isset($filename[0]) && $filename[0] === 'g') + { + $avatar_group = true; + $filename = substr($filename, 1); + } + + // '==' is not a bug - . as the first char is as bad as no dot at all + if (strpos($filename, '.') == false) + { + send_status_line(403, 'Forbidden'); + $exit = true; + } + + if (!$exit) + { + $ext = substr(strrchr($filename, '.'), 1); + $stamp = (int) substr(stristr($filename, '_'), 1); + $filename = (int) $filename; + $exit = set_modified_headers($stamp, $browser); + } + if (!$exit && !in_array($ext, array('png', 'gif', 'jpg', 'jpeg'))) + { + // no way such an avatar could exist. They are not following the rules, stop the show. + send_status_line(403, 'Forbidden'); + $exit = true; + } + + + if (!$exit) + { + if (!$filename) + { + // no way such an avatar could exist. They are not following the rules, stop the show. + send_status_line(403, 'Forbidden'); + } + else + { + send_avatar_to_browser(($avatar_group ? 'g' : '') . $filename . '.' . $ext, $browser); + } + } + file_gc(); +} + +// implicit else: we are not in avatar mode +include($phpbb_root_path . 'common.' . $phpEx); +require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); + +$attach_id = $request->variable('id', 0); +$mode = $request->variable('mode', ''); +$thumbnail = $request->variable('t', false); + +// Start session management, do not update session page. +$user->session_begin(false); +$auth->acl($user->data); +$user->setup('viewtopic'); + +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +if (!$config['allow_attachments'] && !$config['allow_pm_attach']) +{ + send_status_line(404, 'Not Found'); + trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED'); +} + +if (!$attach_id) +{ + send_status_line(404, 'Not Found'); + trigger_error('NO_ATTACHMENT_SELECTED'); +} + +$sql = 'SELECT attach_id, post_msg_id, topic_id, in_message, poster_id, is_orphan, physical_filename, real_filename, extension, mimetype, filesize, filetime + FROM ' . ATTACHMENTS_TABLE . " + WHERE attach_id = $attach_id"; +$result = $db->sql_query($sql); +$attachment = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +if (!$attachment) +{ + send_status_line(404, 'Not Found'); + trigger_error('ERROR_NO_ATTACHMENT'); +} +else if (!download_allowed()) +{ + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['LINKAGE_FORBIDDEN']); +} +else +{ + $attachment['physical_filename'] = utf8_basename($attachment['physical_filename']); + + if (!$attachment['in_message'] && !$config['allow_attachments'] || $attachment['in_message'] && !$config['allow_pm_attach']) + { + send_status_line(404, 'Not Found'); + trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED'); + } + + if ($attachment['is_orphan']) + { + // We allow admins having attachment permissions to see orphan attachments... + $own_attachment = ($auth->acl_get('a_attach') || $attachment['poster_id'] == $user->data['user_id']) ? true : false; + + if (!$own_attachment || ($attachment['in_message'] && !$auth->acl_get('u_pm_download')) || (!$attachment['in_message'] && !$auth->acl_get('u_download'))) + { + send_status_line(404, 'Not Found'); + trigger_error('ERROR_NO_ATTACHMENT'); + } + + // Obtain all extensions... + $extensions = $cache->obtain_attach_extensions(true); + } + else + { + if (!$attachment['in_message']) + { + phpbb_download_handle_forum_auth($db, $auth, $attachment['topic_id']); + + $sql = 'SELECT forum_id, post_visibility + FROM ' . POSTS_TABLE . ' + WHERE post_id = ' . (int) $attachment['post_msg_id']; + $result = $db->sql_query($sql); + $post_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$post_row || !$phpbb_content_visibility->is_visible('post', $post_row['forum_id'], $post_row)) + { + // Attachment of a soft deleted post and the user is not allowed to see the post + send_status_line(404, 'Not Found'); + trigger_error('ERROR_NO_ATTACHMENT'); + } + } + else + { + // Attachment is in a private message. + $post_row = array('forum_id' => false); + phpbb_download_handle_pm_auth($db, $auth, $user->data['user_id'], $attachment['post_msg_id']); + } + + $extensions = array(); + if (!extension_allowed($post_row['forum_id'], $attachment['extension'], $extensions)) + { + send_status_line(403, 'Forbidden'); + trigger_error(sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])); + } + } + + $download_mode = (int) $extensions[$attachment['extension']]['download_mode']; + $display_cat = $extensions[$attachment['extension']]['display_cat']; + + if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !$user->optionget('viewimg')) + { + $display_cat = ATTACHMENT_CATEGORY_NONE; + } + + /** + * Event to modify data before sending file to browser + * + * @event core.download_file_send_to_browser_before + * @var int attach_id The attachment ID + * @var array attachment Array with attachment data + * @var int display_cat Attachment category + * @var int download_mode File extension specific download mode + * @var array extensions Array with file extensions data + * @var string mode Download mode + * @var bool thumbnail Flag indicating if the file is a thumbnail + * @since 3.1.6-RC1 + * @changed 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions") + */ + $vars = array( + 'attach_id', + 'attachment', + 'display_cat', + 'download_mode', + 'extensions', + 'mode', + 'thumbnail', + ); + extract($phpbb_dispatcher->trigger_event('core.download_file_send_to_browser_before', compact($vars))); + + if ($thumbnail) + { + $attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename']; + } + else if ($display_cat == ATTACHMENT_CATEGORY_NONE && !$attachment['is_orphan'] && !phpbb_http_byte_range($attachment['filesize'])) + { + // Update download count + phpbb_increment_downloads($db, $attachment['attach_id']); + } + + if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && (strpos(strtolower($user->browser), 'msie') !== false) && !phpbb_is_greater_ie_version($user->browser, 7)) + { + wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']); + file_gc(); + } + else + { + // Determine the 'presenting'-method + if ($download_mode == PHYSICAL_LINK) + { + // This presenting method should no longer be used + if (!@is_dir($phpbb_root_path . $config['upload_path'])) + { + send_status_line(500, 'Internal Server Error'); + trigger_error($user->lang['PHYSICAL_DOWNLOAD_NOT_POSSIBLE']); + } + + redirect($phpbb_root_path . $config['upload_path'] . '/' . $attachment['physical_filename']); + file_gc(); + } + else + { + send_file_to_browser($attachment, $config['upload_path'], $display_cat); + file_gc(); + } + } +} diff --git a/install/update/new/ext/phpbb/viglink/acp/viglink_helper.php b/install/update/new/ext/phpbb/viglink/acp/viglink_helper.php new file mode 100644 index 0000000..36bf313 --- /dev/null +++ b/install/update/new/ext/phpbb/viglink/acp/viglink_helper.php @@ -0,0 +1,147 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ + +namespace phpbb\viglink\acp; + +/** + * Class to handle allowing or disallowing VigLink services + */ +class viglink_helper +{ + /** @var \phpbb\cache\driver\driver_interface $cache */ + protected $cache; + + /** @var \phpbb\config\config $config */ + protected $config; + + /** @var \phpbb\file_downloader $file_downloader */ + protected $file_downloader; + + /** @var \phpbb\language\language $language */ + protected $language; + + /** @var \phpbb\log\log $log */ + protected $log; + + /** @var \phpbb\user $user */ + protected $user; + + /** @var bool Use SSL or not */ + protected $use_ssl = false; + + /** + * Constructor + * + * @param \phpbb\cache\driver\driver_interface $cache + * @param \phpbb\config\config $config + * @param \phpbb\file_downloader $file_downloader + * @param \phpbb\language\language $language + * @param \phpbb\log\log $log + * @param \phpbb\user $user + */ + public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\config\config $config, \phpbb\file_downloader $file_downloader, \phpbb\language\language $language, \phpbb\log\log $log, \phpbb\user $user) + { + $this->cache = $cache; + $this->config = $config; + $this->file_downloader = $file_downloader; + $this->language = $language; + $this->log = $log; + $this->user = $user; + } + + /** + * Obtains the latest VigLink services information from phpBB + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * + * @throws \RuntimeException + * + * @return void + */ + public function set_viglink_services($force_update = false, $force_cache = false) + { + $cache_key = '_versioncheck_viglink_' . $this->use_ssl; + + $info = $this->cache->get($cache_key); + + if ($info === false && $force_cache) + { + throw new \RuntimeException($this->language->lang('VERSIONCHECK_FAIL')); + } + + if ($info === false || $force_update) + { + try + { + $info = $this->file_downloader->get('www.phpbb.com', '/viglink', 'enabled', 443); + } + catch (\phpbb\exception\runtime_exception $exception) + { + $prepare_parameters = array_merge(array($exception->getMessage()), $exception->get_parameters()); + throw new \RuntimeException(call_user_func_array(array($this->language, 'lang'), $prepare_parameters)); + } + + if ($info === '0') + { + $this->set_viglink_configs(array( + 'allow_viglink_phpbb' => false, + )); + } + else + { + $info = '1'; + $this->set_viglink_configs(array( + 'allow_viglink_phpbb' => true, + )); + } + + $this->cache->put($cache_key, $info, 86400); // 24 hours + } + } + + /** + * Sets VigLink service configs as determined by phpBB + * + * @param array $data Array of VigLink file data. + * + * @return void + */ + protected function set_viglink_configs($data) + { + $viglink_configs = array( + 'allow_viglink_phpbb', + 'phpbb_viglink_api_key', + ); + + foreach ($viglink_configs as $cfg_name) + { + if (array_key_exists($cfg_name, $data) && ($data[$cfg_name] != $this->config[$cfg_name] || !isset($this->config[$cfg_name]))) + { + $this->config->set($cfg_name, $data[$cfg_name]); + } + } + + $this->config->set('viglink_last_gc', time(), false); + } + + /** + * Log a VigLink error message to the error log + * + * @param string $message The error message + */ + public function log_viglink_error($message) + { + $user_id = empty($this->user->data) ? ANONYMOUS : $this->user->data['user_id']; + $user_ip = empty($this->user->ip) ? '' : $this->user->ip; + + $this->log->add('critical', $user_id, $user_ip, 'LOG_VIGLINK_CHECK_FAIL', false, array($message)); + } +} diff --git a/install/update/new/ext/phpbb/viglink/composer.json b/install/update/new/ext/phpbb/viglink/composer.json new file mode 100644 index 0000000..e1e73f3 --- /dev/null +++ b/install/update/new/ext/phpbb/viglink/composer.json @@ -0,0 +1,27 @@ +{ + "name": "phpbb/viglink", + "type": "phpbb-extension", + "description": "The VigLink extension for phpBB makes it possible to earn revenue, without any change to the user experience, when users post and follow links to commercial sites.", + "homepage": "https://www.phpbb.com", + "version": "1.0.5", + "keywords": ["phpbb", "extension", "viglink"], + "license": "GPL-2.0-only", + "authors": [ + { + "name": "phpBB Limited", + "email": "operations@phpbb.com", + "homepage": "https://www.phpbb.com/go/authors" + } + ], + "require": { + "php": ">=5.4", + "phpbb/phpbb": ">=3.2.0", + "composer/installers": "~1.0" + }, + "extra": { + "display-name": "VigLink", + "soft-require": { + "phpbb/phpbb": ">=3.2.0-b1,<4.0.0@dev" + } + } +} diff --git a/install/update/new/ext/phpbb/viglink/composer.lock b/install/update/new/ext/phpbb/viglink/composer.lock new file mode 100644 index 0000000..1f8e919 --- /dev/null +++ b/install/update/new/ext/phpbb/viglink/composer.lock @@ -0,0 +1,2443 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "b80efb4b6261de83a1e263bb46ddfa8b", + "packages": [ + { + "name": "bantu/ini-get-wrapper", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/bantuXorg/php-ini-get-wrapper.git", + "reference": "4770c7feab370c62e23db4f31c112b7c6d90aee2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bantuXorg/php-ini-get-wrapper/zipball/4770c7feab370c62e23db4f31c112b7c6d90aee2", + "reference": "4770c7feab370c62e23db4f31c112b7c6d90aee2", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "bantu\\IniGetWrapper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Convenience wrapper around ini_get()", + "time": "2014-09-15T13:12:35+00:00" + }, + { + "name": "composer/installers", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/composer/installers.git", + "reference": "141b272484481432cda342727a427dc1e206bfa0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/installers/zipball/141b272484481432cda342727a427dc1e206bfa0", + "reference": "141b272484481432cda342727a427dc1e206bfa0", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "replace": { + "roundcube/plugin-installer": "*", + "shama/baton": "*" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpunit/phpunit": "^4.8.36" + }, + "type": "composer-plugin", + "extra": { + "class": "Composer\\Installers\\Plugin", + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Installers\\": "src/Composer/Installers" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "description": "A multi-framework Composer library installer", + "homepage": "https://composer.github.io/installers/", + "keywords": [ + "Craft", + "Dolibarr", + "Eliasis", + "Hurad", + "ImageCMS", + "Kanboard", + "Lan Management System", + "MODX Evo", + "Mautic", + "Maya", + "OXID", + "Plentymarkets", + "Porto", + "RadPHP", + "SMF", + "Thelia", + "Whmcs", + "WolfCMS", + "agl", + "aimeos", + "annotatecms", + "attogram", + "bitrix", + "cakephp", + "chef", + "cockpit", + "codeigniter", + "concrete5", + "croogo", + "dokuwiki", + "drupal", + "eZ Platform", + "elgg", + "expressionengine", + "fuelphp", + "grav", + "installer", + "itop", + "joomla", + "known", + "kohana", + "laravel", + "lavalite", + "lithium", + "magento", + "majima", + "mako", + "mediawiki", + "modulework", + "modx", + "moodle", + "osclass", + "phpbb", + "piwik", + "ppi", + "puppet", + "pxcms", + "reindex", + "roundcube", + "shopware", + "silverstripe", + "sydes", + "symfony", + "typo3", + "wordpress", + "yawik", + "zend", + "zikula" + ], + "time": "2019-08-12T15:00:31+00:00" + }, + { + "name": "google/recaptcha", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/google/recaptcha.git", + "reference": "98c4a6573b27e8b0990ea8789c74ea378795134c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/recaptcha/zipball/98c4a6573b27e8b0990ea8789c74ea378795134c", + "reference": "98c4a6573b27e8b0990ea8789c74ea378795134c", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.2.20|^2.15", + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7.5.11" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "ReCaptcha\\": "src/ReCaptcha" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Client library for reCAPTCHA, a free service that protects websites from spam and abuse.", + "homepage": "https://www.google.com/recaptcha/", + "keywords": [ + "Abuse", + "captcha", + "recaptcha", + "spam" + ], + "time": "2019-08-16T15:48:25+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.5.2", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.6.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.1" + }, + "suggest": { + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2019-12-23T11:57:10+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-12-20T10:07:11+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "time": "2019-07-01T23:21:34+00:00" + }, + { + "name": "lusitanian/oauth", + "version": "v0.8.11", + "source": { + "type": "git", + "url": "https://github.com/Lusitanian/PHPoAuthLib.git", + "reference": "fc11a53db4b66da555a6a11fce294f574a8374f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/fc11a53db4b66da555a6a11fce294f574a8374f9", + "reference": "fc11a53db4b66da555a6a11fce294f574a8374f9", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*", + "predis/predis": "0.8.*@dev", + "squizlabs/php_codesniffer": "2.*", + "symfony/http-foundation": "~2.1" + }, + "suggest": { + "ext-openssl": "Allows for usage of secure connections with the stream-based HTTP client.", + "predis/predis": "Allows using the Redis storage backend.", + "symfony/http-foundation": "Allows using the Symfony Session storage backend." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.1-dev" + } + }, + "autoload": { + "psr-0": { + "OAuth": "src", + "OAuth\\Unit": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David Desberg", + "email": "david@daviddesberg.com" + }, + { + "name": "Elliot Chance", + "email": "elliotchance@gmail.com" + }, + { + "name": "Pieter Hordijk", + "email": "info@pieterhordijk.com" + } + ], + "description": "PHP 5.3+ oAuth 1/2 Library", + "keywords": [ + "Authentication", + "authorization", + "oauth", + "security" + ], + "time": "2018-02-14T22:37:14+00:00" + }, + { + "name": "marc1706/fast-image-size", + "version": "v1.1.6", + "source": { + "type": "git", + "url": "https://github.com/marc1706/fast-image-size.git", + "reference": "3a3a2b036be20f43fa06ce00dfa754df503e6684" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/marc1706/fast-image-size/zipball/3a3a2b036be20f43fa06ce00dfa754df503e6684", + "reference": "3a3a2b036be20f43fa06ce00dfa754df503e6684", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "FastImageSize\\": "lib", + "FastImageSize\\tests\\": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marc Alexander", + "email": "admin@m-a-styles.de", + "homepage": "https://www.m-a-styles.de", + "role": "Developer" + } + ], + "description": "fast-image-size is a PHP library that does almost everything PHP's getimagesize() does but without the large overhead of downloading the complete file.", + "homepage": "https://www.m-a-styles.de", + "keywords": [ + "fast", + "getimagesize", + "image", + "imagesize", + "php", + "size" + ], + "time": "2019-12-07T08:02:07+00:00" + }, + { + "name": "ocramius/package-versions", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0.0", + "php": "^7.1.0" + }, + "require-dev": { + "composer/composer": "^1.6.3", + "doctrine/coding-standard": "^5.0.1", + "ext-zip": "*", + "infection/infection": "^0.7.1", + "phpunit/phpunit": "^7.5.17" + }, + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "time": "2019-11-15T16:17:10+00:00" + }, + { + "name": "ocramius/proxy-manager", + "version": "2.2.3", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/ProxyManager.git", + "reference": "4d154742e31c35137d5374c998e8f86b54db2e2f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/4d154742e31c35137d5374c998e8f86b54db2e2f", + "reference": "4d154742e31c35137d5374c998e8f86b54db2e2f", + "shasum": "" + }, + "require": { + "ocramius/package-versions": "^1.1.3", + "php": "^7.2.0", + "zendframework/zend-code": "^3.3.0" + }, + "require-dev": { + "couscous/couscous": "^1.6.1", + "ext-phar": "*", + "humbug/humbug": "1.0.0-RC.0@RC", + "nikic/php-parser": "^3.1.1", + "padraic/phpunit-accelerator": "dev-master@DEV", + "phpbench/phpbench": "^0.12.2", + "phpstan/phpstan": "dev-master#856eb10a81c1d27c701a83f167dc870fd8f4236a as 0.9.999", + "phpstan/phpstan-phpunit": "dev-master#5629c0a1f4a9c417cb1077cf6693ad9753895761", + "phpunit/phpunit": "^6.4.3", + "squizlabs/php_codesniffer": "^2.9.1" + }, + "suggest": { + "ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects", + "zendframework/zend-json": "To have the JsonRpc adapter (Remote Object feature)", + "zendframework/zend-soap": "To have the Soap adapter (Remote Object feature)", + "zendframework/zend-xmlrpc": "To have the XmlRpc adapter (Remote Object feature)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "ProxyManager\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.io/" + } + ], + "description": "A library providing utilities to generate, instantiate and generally operate with Object Proxies", + "homepage": "https://github.com/Ocramius/ProxyManager", + "keywords": [ + "aop", + "lazy loading", + "proxy", + "proxy pattern", + "service proxies" + ], + "time": "2019-08-10T08:37:15+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v9.99.99", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "shasum": "" + }, + "require": { + "php": "^7" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "polyfill", + "pseudorandom", + "random" + ], + "time": "2018-07-02T15:55:56+00:00" + }, + { + "name": "patchwork/utf8", + "version": "v1.3.2", + "source": { + "type": "git", + "url": "https://github.com/tchwork/utf8.git", + "reference": "d296e0026e7ce10b2a9fe594feca9628ef00e9e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tchwork/utf8/zipball/d296e0026e7ce10b2a9fe594feca9628ef00e9e8", + "reference": "d296e0026e7ce10b2a9fe594feca9628ef00e9e8", + "shasum": "" + }, + "require": { + "lib-pcre": ">=7.3", + "php": ">=5.3.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.4|^4.4" + }, + "suggest": { + "ext-iconv": "Use iconv for best performance", + "ext-intl": "Use Intl for best performance", + "ext-mbstring": "Use Mbstring for best performance", + "ext-wfio": "Use WFIO for UTF-8 filesystem access on Windows" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Patchwork\\": "src/Patchwork/" + }, + "classmap": [ + "src/Normalizer.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "(Apache-2.0 or GPL-2.0)" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + } + ], + "description": "Portable and performant UTF-8, Unicode and Grapheme Clusters for PHP", + "homepage": "https://github.com/tchwork/utf8", + "keywords": [ + "grapheme", + "i18n", + "unicode", + "utf-8", + "utf8" + ], + "time": "2019-12-03T14:44:12+00:00" + }, + { + "name": "phpbb/phpbb", + "version": "3.3.0-RC1", + "source": { + "type": "git", + "url": "https://github.com/phpbb/phpbb-app.git", + "reference": "664db37d53bb5490e701d4e016f7df2434e2418e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpbb/phpbb-app/zipball/664db37d53bb5490e701d4e016f7df2434e2418e", + "reference": "664db37d53bb5490e701d4e016f7df2434e2418e", + "shasum": "" + }, + "require": { + "bantu/ini-get-wrapper": "~1.0", + "ext-json": "*", + "google/recaptcha": "~1.1", + "guzzlehttp/guzzle": "~6.3", + "lusitanian/oauth": "^0.8.1", + "marc1706/fast-image-size": "^1.1", + "patchwork/utf8": "^1.1", + "php": ">=7.1", + "s9e/text-formatter": "^2.0", + "symfony/config": "~3.4", + "symfony/console": "~3.4", + "symfony/debug": "~3.4", + "symfony/dependency-injection": "~3.4", + "symfony/event-dispatcher": "~3.4", + "symfony/filesystem": "~3.4", + "symfony/finder": "~3.4", + "symfony/http-foundation": "~3.4", + "symfony/http-kernel": "~3.4", + "symfony/proxy-manager-bridge": "~3.4", + "symfony/routing": "~3.4", + "symfony/twig-bridge": "~3.4", + "symfony/yaml": "~3.4", + "twig/twig": "^1.0 || ^2.0" + }, + "replace": { + "phpbb/phpbb-core": "self.version" + }, + "require-dev": { + "fabpot/goutte": "~3.2", + "facebook/webdriver": "~1.6", + "laravel/homestead": "~7.0", + "phing/phing": "~2.4", + "phpunit/dbunit": "~4.0", + "phpunit/phpunit": "^7.0", + "squizlabs/php_codesniffer": "~3.4", + "symfony/browser-kit": "~3.4", + "symfony/css-selector": "~3.4", + "symfony/dom-crawler": "~3.4" + }, + "type": "project", + "extra": { + "branch-alias": { + "dev-master": "3.3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0-only" + ], + "authors": [ + { + "name": "phpBB Limited", + "email": "operations@phpbb.com", + "homepage": "https://www.phpbb.com/go/authors" + } + ], + "description": "phpBB Forum Software application", + "homepage": "https://www.phpbb.com", + "keywords": [ + "forum", + "phpbb" + ], + "time": "2019-12-21T09:51:05+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06T14:39:51+00:00" + }, + { + "name": "psr/log", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2019-11-01T11:05:21+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "s9e/regexp-builder", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/s9e/RegexpBuilder.git", + "reference": "59d0167a909659d718f53964f7653d2c83a5f8fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/s9e/RegexpBuilder/zipball/59d0167a909659d718f53964f7653d2c83a5f8fe", + "reference": "59d0167a909659d718f53964f7653d2c83a5f8fe", + "shasum": "" + }, + "require": { + "lib-pcre": ">=7.2", + "php": ">=5.5.1" + }, + "require-dev": { + "phpunit/phpunit": "<5.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "s9e\\RegexpBuilder\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Single-purpose library that generates regular expressions that match a list of strings.", + "homepage": "https://github.com/s9e/RegexpBuilder/", + "keywords": [ + "regexp" + ], + "time": "2019-04-26T17:55:23+00:00" + }, + { + "name": "s9e/text-formatter", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/s9e/TextFormatter.git", + "reference": "26d6ee3a931a25acfea3096f62f0cc42172f3859" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/26d6ee3a931a25acfea3096f62f0cc42172f3859", + "reference": "26d6ee3a931a25acfea3096f62f0cc42172f3859", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-filter": "*", + "lib-pcre": ">=8.13", + "php": ">=7.1", + "s9e/regexp-builder": "^1.4" + }, + "require-dev": { + "matthiasmullie/minify": "*", + "phpunit/phpunit": "^7 || 8.2.*" + }, + "suggest": { + "ext-curl": "Improves the performance of the MediaEmbed plugin and some JavaScript minifiers", + "ext-intl": "Allows international URLs to be accepted by the URL filter", + "ext-json": "Enables the generation of a JavaScript parser", + "ext-mbstring": "Improves the performance of the PHP renderer", + "ext-tokenizer": "Improves the performance of the PHP renderer", + "ext-xsl": "Enables the XSLT renderer", + "ext-zlib": "Enables gzip compression when scraping content via the MediaEmbed plugin" + }, + "type": "library", + "extra": { + "version": "2.3.0" + }, + "autoload": { + "psr-4": { + "s9e\\TextFormatter\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Multi-purpose text formatting and markup library. Plugins offer support for BBCodes, Markdown, emoticons, HTML, embedding media (YouTube, etc...), enhanced typography and more.", + "homepage": "https://github.com/s9e/TextFormatter/", + "keywords": [ + "bbcode", + "bbcodes", + "blog", + "censor", + "embed", + "emoji", + "emoticons", + "engine", + "forum", + "html", + "markdown", + "markup", + "media", + "parser", + "shortcodes" + ], + "time": "2019-11-17T16:03:56+00:00" + }, + { + "name": "symfony/config", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "a599a867d0e4a07c342b5f1e656b3915a540ddbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/a599a867d0e4a07c342b5f1e656b3915a540ddbe", + "reference": "a599a867d0e4a07c342b5f1e656b3915a540ddbe", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/filesystem": "~2.8|~3.0|~4.0", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" + }, + "require-dev": { + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/event-dispatcher": "~3.3|~4.0", + "symfony/finder": "~3.3|~4.0", + "symfony/yaml": "~3.0|~4.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2019-12-01T10:45:41+00:00" + }, + { + "name": "symfony/console", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "1ee23b3b659b06c622f2bd2492a229e416eb4586" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/1ee23b3b659b06c622f2bd2492a229e416eb4586", + "reference": "1ee23b3b659b06c622f2bd2492a229e416eb4586", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" + }, + "suggest": { + "psr/log": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2019-12-01T10:04:45+00:00" + }, + { + "name": "symfony/debug", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "f72e33fdb1170b326e72c3157f0cd456351dd086" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/f72e33fdb1170b326e72c3157f0cd456351dd086", + "reference": "f72e33fdb1170b326e72c3157f0cd456351dd086", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/http-kernel": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2019-10-24T15:33:53+00:00" + }, + { + "name": "symfony/dependency-injection", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "0d201916bfb3af939fec3c0c8815ea16c60ac1a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/0d201916bfb3af939fec3c0c8815ea16c60ac1a2", + "reference": "0d201916bfb3af939fec3c0c8815ea16c60ac1a2", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/container": "^1.0" + }, + "conflict": { + "symfony/config": "<3.3.7", + "symfony/finder": "<3.3", + "symfony/proxy-manager-bridge": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "psr/container-implementation": "1.0" + }, + "require-dev": { + "symfony/config": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DependencyInjection\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "https://symfony.com", + "time": "2019-12-01T08:33:36+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "f9031c22ec127d4a2450760f81a8677fe8a10177" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f9031c22ec127d4a2450760f81a8677fe8a10177", + "reference": "f9031c22ec127d4a2450760f81a8677fe8a10177", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2019-10-24T15:33:53+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "00cdad0936d06fab136944bc2342b762b1c3a4a2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/00cdad0936d06fab136944bc2342b762b1c3a4a2", + "reference": "00cdad0936d06fab136944bc2342b762b1c3a4a2", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2019-11-25T16:36:22+00:00" + }, + { + "name": "symfony/finder", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "290ae21279b37bfd287cdcce640d51204e84afdf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/290ae21279b37bfd287cdcce640d51204e84afdf", + "reference": "290ae21279b37bfd287cdcce640d51204e84afdf", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2019-11-17T21:55:15+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "d2d0cfe8e319d9df44c4cca570710fcf221d4593" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d2d0cfe8e319d9df44c4cca570710fcf221d4593", + "reference": "d2d0cfe8e319d9df44c4cca570710fcf221d4593", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php70": "~1.6" + }, + "require-dev": { + "symfony/expression-language": "~2.8|~3.0|~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2019-11-28T12:52:59+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "c42c8339acb28cfff0fb1786948db4d23d609ff7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/c42c8339acb28cfff0fb1786948db4d23d609ff7", + "reference": "c42c8339acb28cfff0fb1786948db4d23d609ff7", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "psr/log": "~1.0", + "symfony/debug": "^3.3.3|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php56": "~1.8" + }, + "conflict": { + "symfony/config": "<2.8", + "symfony/dependency-injection": "<3.4.10|<4.0.10,>=4", + "symfony/var-dumper": "<3.3", + "twig/twig": "<1.34|<2.4,>=2" + }, + "provide": { + "psr/log-implementation": "1.0" + }, + "require-dev": { + "psr/cache": "~1.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", + "symfony/class-loader": "~2.8|~3.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/console": "~2.8|~3.0|~4.0", + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "^3.4.10|^4.0.10", + "symfony/dom-crawler": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/finder": "", + "symfony/var-dumper": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com", + "time": "2019-12-01T13:50:37+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T14:18:11+00:00" + }, + { + "name": "symfony/polyfill-php56", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "53dd1cdf3cb986893ccf2b96665b25b3abb384f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/53dd1cdf3cb986893ccf2b96665b25b3abb384f4", + "reference": "53dd1cdf3cb986893ccf2b96665b25b3abb384f4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "af23c7bb26a73b850840823662dda371484926c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4", + "reference": "af23c7bb26a73b850840823662dda371484926c4", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0|~9.99", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/polyfill-util", + "version": "v1.13.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "964a67f293b66b95883a5ed918a65354fcd2258f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/964a67f293b66b95883a5ed918a65354fcd2258f", + "reference": "964a67f293b66b95883a5ed918a65354fcd2258f", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Util\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony utilities for portability of PHP codes", + "homepage": "https://symfony.com", + "keywords": [ + "compat", + "compatibility", + "polyfill", + "shim" + ], + "time": "2019-11-27T13:56:44+00:00" + }, + { + "name": "symfony/proxy-manager-bridge", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/proxy-manager-bridge.git", + "reference": "3c185a0e45ea13334aaf7b0fa9726922816ebec6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/3c185a0e45ea13334aaf7b0fa9726922816ebec6", + "reference": "3c185a0e45ea13334aaf7b0fa9726922816ebec6", + "shasum": "" + }, + "require": { + "ocramius/proxy-manager": "~0.4|~1.0|~2.0", + "php": "^5.5.9|>=7.0.8", + "symfony/dependency-injection": "~3.4|~4.0" + }, + "require-dev": { + "symfony/config": "~2.8|~3.0|~4.0" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\ProxyManager\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony ProxyManager Bridge", + "homepage": "https://symfony.com", + "time": "2019-08-29T14:54:55+00:00" + }, + { + "name": "symfony/routing", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "b689ccd48e234ea404806d94b07eeb45f9f6f06a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/b689ccd48e234ea404806d94b07eeb45f9f6f06a", + "reference": "b689ccd48e234ea404806d94b07eeb45f9f6f06a", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/config": "<3.3.1", + "symfony/dependency-injection": "<3.3", + "symfony/yaml": "<3.4" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "psr/log": "~1.0", + "symfony/config": "^3.3.1|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2019-12-01T08:33:36+00:00" + }, + { + "name": "symfony/twig-bridge", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-bridge.git", + "reference": "49b824ddc7f2d250a1f172349cd9a111d63287c0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/49b824ddc7f2d250a1f172349cd9a111d63287c0", + "reference": "49b824ddc7f2d250a1f172349cd9a111d63287c0", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "twig/twig": "^1.41|^2.10" + }, + "conflict": { + "symfony/console": "<3.4", + "symfony/form": "<3.4.31|>=4.0,<4.3.4" + }, + "require-dev": { + "fig/link-util": "^1.0", + "symfony/asset": "~2.8|~3.0|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/form": "^3.4.31|^4.3.4", + "symfony/http-foundation": "^3.3.11|~4.0", + "symfony/http-kernel": "~3.2|~4.0", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/routing": "~2.8|~3.0|~4.0", + "symfony/security": "^2.8.31|^3.3.13|~4.0", + "symfony/security-acl": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2|~4.0", + "symfony/web-link": "~3.3|~4.0", + "symfony/workflow": "~3.3|~4.0", + "symfony/yaml": "~2.8|~3.0|~4.0" + }, + "suggest": { + "symfony/asset": "For using the AssetExtension", + "symfony/expression-language": "For using the ExpressionExtension", + "symfony/finder": "", + "symfony/form": "For using the FormExtension", + "symfony/http-kernel": "For using the HttpKernelExtension", + "symfony/routing": "For using the RoutingExtension", + "symfony/security": "For using the SecurityExtension", + "symfony/stopwatch": "For using the StopwatchExtension", + "symfony/templating": "For using the TwigEngine", + "symfony/translation": "For using the TranslationExtension", + "symfony/var-dumper": "For using the DumpExtension", + "symfony/web-link": "For using the WebLinkExtension", + "symfony/yaml": "For using the YamlExtension" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\Twig\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Twig Bridge", + "homepage": "https://symfony.com", + "time": "2019-11-30T08:19:08+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.4.36", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "dab657db15207879217fc81df4f875947bf68804" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/dab657db15207879217fc81df4f875947bf68804", + "reference": "dab657db15207879217fc81df4f875947bf68804", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2019-10-24T15:33:53+00:00" + }, + { + "name": "twig/twig", + "version": "v2.12.2", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed", + "reference": "d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed", + "shasum": "" + }, + "require": { + "php": "^7.0", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "^3.4|^4.2", + "symfony/phpunit-bridge": "^4.4@dev|^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.12-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Twig Team", + "homepage": "https://twig.symfony.com/contributors", + "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "time": "2019-11-11T16:52:09+00:00" + }, + { + "name": "zendframework/zend-code", + "version": "3.4.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-code.git", + "reference": "268040548f92c2bfcba164421c1add2ba43abaaa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-code/zipball/268040548f92c2bfcba164421c1add2ba43abaaa", + "reference": "268040548f92c2bfcba164421c1add2ba43abaaa", + "shasum": "" + }, + "require": { + "php": "^7.1", + "zendframework/zend-eventmanager": "^2.6 || ^3.0" + }, + "conflict": { + "phpspec/prophecy": "<1.9.0" + }, + "require-dev": { + "doctrine/annotations": "^1.7", + "ext-phar": "*", + "phpunit/phpunit": "^7.5.16 || ^8.4", + "zendframework/zend-coding-standard": "^1.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" + }, + "suggest": { + "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", + "zendframework/zend-stdlib": "Zend\\Stdlib component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4.x-dev", + "dev-develop": "3.5.x-dev", + "dev-dev-4.0": "4.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Code\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Extensions to the PHP Reflection API, static code scanning, and code generation", + "keywords": [ + "ZendFramework", + "code", + "zf" + ], + "time": "2019-12-10T19:21:15+00:00" + }, + { + "name": "zendframework/zend-eventmanager", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-eventmanager.git", + "reference": "a5e2583a211f73604691586b8406ff7296a946dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/a5e2583a211f73604691586b8406ff7296a946dd", + "reference": "a5e2583a211f73604691586b8406ff7296a946dd", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "athletic/athletic": "^0.1", + "container-interop/container-interop": "^1.1.0", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0" + }, + "suggest": { + "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev", + "dev-develop": "3.3-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\EventManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Trigger and listen to events within a PHP application", + "homepage": "https://github.com/zendframework/zend-eventmanager", + "keywords": [ + "event", + "eventmanager", + "events", + "zf2" + ], + "time": "2018-04-25T15:33:34+00:00" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": { + "phpbb/phpbb": 10 + }, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [] +} diff --git a/install/update/new/ext/phpbb/viglink/styles/all/theme/viglink.css b/install/update/new/ext/phpbb/viglink/styles/all/theme/viglink.css new file mode 100644 index 0000000..96c5137 --- /dev/null +++ b/install/update/new/ext/phpbb/viglink/styles/all/theme/viglink.css @@ -0,0 +1,18 @@ +/* phpBB VigLink Extension Style Sheet + ------------------------------------------------------------------------ + Copyright (c) phpBB Limited + + For full copyright and license information, please see + the docs/CREDITS.txt file. + ------------------------------------------------------------------------ +*/ + +.viglink-header { + background: url("images/VigLink_logo.png") no-repeat 0 0; + padding-bottom: 18px; + padding-left: 142px; +} + +.send-stats-tile > .viglink-header-h2 { + margin-bottom: 10px; +} diff --git a/install/update/new/feed.php b/install/update/new/feed.php new file mode 100644 index 0000000..e384489 --- /dev/null +++ b/install/update/new/feed.php @@ -0,0 +1,58 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +* Idea and original RSS Feed 2.0 MOD (Version 1.0.8/9) by leviatan21 +* Original MOD: http://www.phpbb.com/community/viewtopic.php?f=69&t=1214645 +* MOD Author Profile: http://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=345763 +* MOD Author Homepage: http://www.mssti.com/phpbb3/ +* +**/ + +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Routing\Exception\InvalidParameterException; + +/** +* @ignore +**/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); + +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); + +$forum_id = $request->variable('f', 0); +$topic_id = $request->variable('t', 0); +$mode = $request->variable('mode', ''); + +if ($forum_id !== 0) +{ + $url = $controller_helper->route('phpbb_feed_forum', array('forum_id' => $forum_id), false); +} +else if ($topic_id !== 0) +{ + $url = $controller_helper->route('phpbb_feed_topic', array('topic_id' => $topic_id), false); +} +else +{ + try + { + $url = $controller_helper->route('phpbb_feed_overall', array('mode' => $mode), false); + } + catch (InvalidParameterException $e) + { + $url = $controller_helper->route('phpbb_feed_index'); + } +} + +$response = new RedirectResponse($url, 301); +$response->send(); diff --git a/install/update/new/includes/acp/acp_attachments.php b/install/update/new/includes/acp/acp_attachments.php new file mode 100644 index 0000000..feeccbe --- /dev/null +++ b/install/update/new/includes/acp/acp_attachments.php @@ -0,0 +1,1730 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_attachments +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var ContainerBuilder */ + protected $phpbb_container; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + /** @var \phpbb\attachment\manager */ + protected $attachment_manager; + + public $id; + public $u_action; + protected $new_config; + + function main($id, $mode) + { + global $db, $user, $auth, $template, $cache, $phpbb_container, $phpbb_filesystem, $phpbb_dispatcher; + global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx, $phpbb_log, $request; + + $this->id = $id; + $this->db = $db; + $this->config = $config; + $this->language = $phpbb_container->get('language'); + $this->template = $template; + $this->user = $user; + $this->phpbb_container = $phpbb_container; + $this->filesystem = $phpbb_filesystem; + $this->attachment_manager = $phpbb_container->get('attachment.manager'); + + $user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); + + $error = $notify = array(); + $submit = (isset($_POST['submit'])) ? true : false; + $action = $request->variable('action', ''); + + $form_key = 'acp_attach'; + add_form_key($form_key); + + if ($submit && !check_form_key($form_key)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + switch ($mode) + { + case 'attach': + $l_title = 'ACP_ATTACHMENT_SETTINGS'; + break; + + case 'extensions': + $l_title = 'ACP_MANAGE_EXTENSIONS'; + break; + + case 'ext_groups': + $l_title = 'ACP_EXTENSION_GROUPS'; + break; + + case 'orphan': + $l_title = 'ACP_ORPHAN_ATTACHMENTS'; + break; + + case 'manage': + $l_title = 'ACP_MANAGE_ATTACHMENTS'; + break; + + default: + trigger_error('NO_MODE', E_USER_ERROR); + break; + } + + $this->tpl_name = 'acp_attachments'; + $this->page_title = $l_title; + + $template->assign_vars(array( + 'L_TITLE' => $user->lang[$l_title], + 'L_TITLE_EXPLAIN' => $user->lang[$l_title . '_EXPLAIN'], + 'U_ACTION' => $this->u_action) + ); + + switch ($mode) + { + case 'attach': + + if (!function_exists('get_supported_image_types')) + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } + + $sql = 'SELECT group_name, cat_id + FROM ' . EXTENSION_GROUPS_TABLE . ' + WHERE cat_id > 0 + ORDER BY cat_id'; + $result = $db->sql_query($sql); + + $s_assigned_groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['group_name'] = $this->language->is_set('EXT_GROUP_' . utf8_strtoupper($row['group_name'])) ? $this->language->lang('EXT_GROUP_' . utf8_strtoupper($row['group_name'])) : $row['group_name']; + $s_assigned_groups[$row['cat_id']][] = $row['group_name']; + } + $db->sql_freeresult($result); + + $l_legend_cat_images = $user->lang['SETTINGS_CAT_IMAGES'] . ' [' . $user->lang['ASSIGNED_GROUP'] . ': ' . ((!empty($s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE])) ? implode($user->lang['COMMA_SEPARATOR'], $s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) : $user->lang['NO_EXT_GROUP']) . ']'; + + $display_vars = array( + 'title' => 'ACP_ATTACHMENT_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_ATTACHMENT_SETTINGS', + + 'img_max_width' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), + 'img_max_height' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), + 'img_link_width' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), + 'img_link_height' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), + + 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'upload_path' => array('lang' => 'UPLOAD_DIR', 'validate' => 'wpath', 'type' => 'text:25:100', 'explain' => true), + 'display_order' => array('lang' => 'DISPLAY_ORDER', 'validate' => 'bool', 'type' => 'custom', 'method' => 'display_order', 'explain' => true), + 'attachment_quota' => array('lang' => 'ATTACH_QUOTA', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), + 'max_filesize' => array('lang' => 'ATTACH_MAX_FILESIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), + 'max_filesize_pm' => array('lang' => 'ATTACH_MAX_PM_FILESIZE','validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), + 'max_attachments' => array('lang' => 'MAX_ATTACHMENTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => false), + 'max_attachments_pm' => array('lang' => 'MAX_ATTACHMENTS_PM', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => false), + 'secure_downloads' => array('lang' => 'SECURE_DOWNLOADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'secure_allow_deny' => array('lang' => 'SECURE_ALLOW_DENY', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_allow_deny', 'explain' => true), + 'secure_allow_empty_referer' => array('lang' => 'SECURE_EMPTY_REFERRER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'check_attachment_content' => array('lang' => 'CHECK_CONTENT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend2' => $l_legend_cat_images, + 'img_display_inlined' => array('lang' => 'DISPLAY_INLINED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'img_create_thumbnail' => array('lang' => 'CREATE_THUMBNAIL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'img_max_thumb_width' => array('lang' => 'MAX_THUMB_WIDTH', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), + 'img_max' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'img_link' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + ) + ); + + /** + * Event to add and/or modify acp_attachement configurations + * + * @event core.acp_attachments_config_edit_add + * @var array display_vars Array of config values to display and process + * @var string mode Mode of the config page we are displaying + * @var boolean submit Do we display the form or process the submission + * @since 3.1.11-RC1 + */ + $vars = array('display_vars', 'mode', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.acp_attachments_config_edit_add', compact($vars))); + + $this->new_config = $config; + $cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => '')) : $this->new_config; + $error = array(); + + // We validate the complete config if whished + validate_config_vars($display_vars['vars'], $cfg_array, $error); + + // Do not write values if there is an error + if (count($error)) + { + $submit = false; + } + + // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... + foreach ($display_vars['vars'] as $config_name => $null) + { + if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) + { + continue; + } + + $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; + + if (in_array($config_name, array('attachment_quota', 'max_filesize', 'max_filesize_pm'))) + { + $size_var = $request->variable($config_name, ''); + $this->new_config[$config_name] = $config_value = ($size_var == 'kb') ? round($config_value * 1024) : (($size_var == 'mb') ? round($config_value * 1048576) : $config_value); + } + + if ($submit) + { + $config->set($config_name, $config_value); + } + } + + $this->perform_site_list(); + + if ($submit) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_ATTACH'); + + // Check Settings + $this->test_upload($error, $this->new_config['upload_path'], false); + + if (!count($error)) + { + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + } + } + + $template->assign_var('S_ATTACHMENT_SETTINGS', true); + + // Secure Download Options - Same procedure as with banning + $allow_deny = ($this->new_config['secure_allow_deny']) ? 'ALLOWED' : 'DISALLOWED'; + + $sql = 'SELECT * + FROM ' . SITELIST_TABLE; + $result = $db->sql_query($sql); + + $defined_ips = ''; + $ips = array(); + + while ($row = $db->sql_fetchrow($result)) + { + $value = ($row['site_ip']) ? $row['site_ip'] : $row['site_hostname']; + if ($value) + { + $defined_ips .= '' . $value . ''; + $ips[$row['site_id']] = $value; + } + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_SECURE_DOWNLOADS' => $this->new_config['secure_downloads'], + 'S_DEFINED_IPS' => ($defined_ips != '') ? true : false, + 'S_WARNING' => (count($error)) ? true : false, + + 'WARNING_MSG' => implode('
', $error), + 'DEFINED_IPS' => $defined_ips, + + 'L_SECURE_TITLE' => $user->lang['DEFINE_' . $allow_deny . '_IPS'], + 'L_IP_EXCLUDE' => $user->lang['EXCLUDE_FROM_' . $allow_deny . '_IP'], + 'L_REMOVE_IPS' => $user->lang['REMOVE_' . $allow_deny . '_IPS']) + ); + + // Output relevant options + foreach ($display_vars['vars'] as $config_key => $vars) + { + if (!is_array($vars) && strpos($config_key, 'legend') === false) + { + continue; + } + + if (strpos($config_key, 'legend') !== false) + { + $template->assign_block_vars('options', array( + 'S_LEGEND' => true, + 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars) + ); + + continue; + } + + $type = explode(':', $vars['type']); + + $l_explain = ''; + if ($vars['explain'] && isset($vars['lang_explain'])) + { + $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain']; + } + else if ($vars['explain']) + { + $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : ''; + } + + $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); + if (empty($content)) + { + continue; + } + + $template->assign_block_vars('options', array( + 'KEY' => $config_key, + 'TITLE' => $user->lang[$vars['lang']], + 'S_EXPLAIN' => $vars['explain'], + 'TITLE_EXPLAIN' => $l_explain, + 'CONTENT' => $content, + ) + ); + + unset($display_vars['vars'][$config_key]); + } + + break; + + case 'extensions': + + if ($submit || isset($_POST['add_extension_check'])) + { + if ($submit) + { + // Change Extensions ? + $extension_change_list = $request->variable('extension_change_list', array(0)); + $group_select_list = $request->variable('group_select', array(0)); + + // Generate correct Change List + $extensions = array(); + + for ($i = 0, $size = count($extension_change_list); $i < $size; $i++) + { + $extensions[$extension_change_list[$i]]['group_id'] = $group_select_list[$i]; + } + + $sql = 'SELECT * + FROM ' . EXTENSIONS_TABLE . ' + ORDER BY extension_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['group_id'] != $extensions[$row['extension_id']]['group_id']) + { + $sql = 'UPDATE ' . EXTENSIONS_TABLE . ' + SET group_id = ' . (int) $extensions[$row['extension_id']]['group_id'] . ' + WHERE extension_id = ' . $row['extension_id']; + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_UPDATE', false, array($row['extension'])); + } + } + $db->sql_freeresult($result); + + // Delete Extension? + $extension_id_list = $request->variable('extension_id_list', array(0)); + + if (count($extension_id_list)) + { + $sql = 'SELECT extension + FROM ' . EXTENSIONS_TABLE . ' + WHERE ' . $db->sql_in_set('extension_id', $extension_id_list); + $result = $db->sql_query($sql); + + $extension_list = ''; + while ($row = $db->sql_fetchrow($result)) + { + $extension_list .= ($extension_list == '') ? $row['extension'] : ', ' . $row['extension']; + } + $db->sql_freeresult($result); + + $sql = 'DELETE + FROM ' . EXTENSIONS_TABLE . ' + WHERE ' . $db->sql_in_set('extension_id', $extension_id_list); + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_DEL', false, array($extension_list)); + } + } + + // Add Extension? + $add_extension = strtolower($request->variable('add_extension', '')); + $add_extension_group = $request->variable('add_group_select', 0); + $add = (isset($_POST['add_extension_check'])) ? true : false; + + if ($add_extension && $add) + { + if (!count($error)) + { + $sql = 'SELECT extension_id + FROM ' . EXTENSIONS_TABLE . " + WHERE extension = '" . $db->sql_escape($add_extension) . "'"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $error[] = sprintf($user->lang['EXTENSION_EXIST'], $add_extension); + } + $db->sql_freeresult($result); + + if (!count($error)) + { + $sql_ary = array( + 'group_id' => $add_extension_group, + 'extension' => $add_extension + ); + + $db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_ADD', false, array($add_extension)); + } + } + } + + if (!count($error)) + { + $notify[] = $user->lang['EXTENSIONS_UPDATED']; + } + + $cache->destroy('_extensions'); + } + + $template->assign_vars(array( + 'S_EXTENSIONS' => true, + 'ADD_EXTENSION' => (isset($add_extension)) ? $add_extension : '', + 'GROUP_SELECT_OPTIONS' => (isset($_POST['add_extension_check'])) ? $this->group_select('add_group_select', $add_extension_group, 'extension_group') : $this->group_select('add_group_select', false, 'extension_group')) + ); + + $sql = 'SELECT * + FROM ' . EXTENSIONS_TABLE . ' + ORDER BY group_id, extension'; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $old_group_id = $row['group_id']; + do + { + $s_spacer = false; + + $current_group_id = $row['group_id']; + if ($old_group_id != $current_group_id) + { + $s_spacer = true; + $old_group_id = $current_group_id; + } + + $template->assign_block_vars('extensions', array( + 'S_SPACER' => $s_spacer, + 'EXTENSION_ID' => $row['extension_id'], + 'EXTENSION' => $row['extension'], + 'GROUP_OPTIONS' => $this->group_select('group_select[]', $row['group_id'])) + ); + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + break; + + case 'ext_groups': + + $template->assign_var('S_EXTENSION_GROUPS', true); + + if ($submit) + { + $action = $request->variable('action', ''); + $group_id = $request->variable('g', 0); + + if ($action != 'add' && $action != 'edit') + { + trigger_error('NO_MODE', E_USER_ERROR); + } + + if (!$group_id && $action == 'edit') + { + trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if ($group_id) + { + $sql = 'SELECT * + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE group_id = $group_id"; + $result = $db->sql_query($sql); + $ext_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$ext_row) + { + trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + else + { + $ext_row = array(); + } + + $group_name = $request->variable('group_name', '', true); + $new_group_name = ($action == 'add') ? $group_name : (($ext_row['group_name'] != $group_name) ? $group_name : ''); + + if (!$group_name) + { + $error[] = $user->lang['NO_EXT_GROUP_NAME']; + } + + // Check New Group Name + if ($new_group_name) + { + $sql = 'SELECT group_id + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($new_group_name)) . "'"; + if ($group_id) + { + $sql .= ' AND group_id <> ' . $group_id; + } + $result = $db->sql_query($sql); + + if ($db->sql_fetchrow($result)) + { + $error[] = sprintf($user->lang['EXTENSION_GROUP_EXIST'], $new_group_name); + } + $db->sql_freeresult($result); + } + + if (!count($error)) + { + // Ok, build the update/insert array + $upload_icon = $request->variable('upload_icon', 'no_image'); + $size_select = $request->variable('size_select', 'b'); + $forum_select = $request->variable('forum_select', false); + $allowed_forums = $request->variable('allowed_forums', array(0)); + $allow_in_pm = (isset($_POST['allow_in_pm'])) ? true : false; + $max_filesize = $request->variable('max_filesize', 0); + $max_filesize = ($size_select == 'kb') ? round($max_filesize * 1024) : (($size_select == 'mb') ? round($max_filesize * 1048576) : $max_filesize); + $allow_group = (isset($_POST['allow_group'])) ? true : false; + + if ($max_filesize == $config['max_filesize']) + { + $max_filesize = 0; + } + + if (!count($allowed_forums)) + { + $forum_select = false; + } + + $group_ary = array( + 'group_name' => $group_name, + 'cat_id' => $request->variable('special_category', ATTACHMENT_CATEGORY_NONE), + 'allow_group' => ($allow_group) ? 1 : 0, + 'upload_icon' => ($upload_icon == 'no_image') ? '' : $upload_icon, + 'max_filesize' => $max_filesize, + 'allowed_forums'=> ($forum_select) ? serialize($allowed_forums) : '', + 'allow_in_pm' => ($allow_in_pm) ? 1 : 0, + ); + + if ($action == 'add') + { + $group_ary['download_mode'] = INLINE_LINK; + } + + $sql = ($action == 'add') ? 'INSERT INTO ' . EXTENSION_GROUPS_TABLE . ' ' : 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET '; + $sql .= $db->sql_build_array((($action == 'add') ? 'INSERT' : 'UPDATE'), $group_ary); + $sql .= ($action == 'edit') ? " WHERE group_id = $group_id" : ''; + + $db->sql_query($sql); + + if ($action == 'add') + { + $group_id = $db->sql_nextid(); + } + + $group_name = $this->language->is_set('EXT_GROUP_' . utf8_strtoupper($group_name)) ? $this->language->lang('EXT_GROUP_' . utf8_strtoupper($group_name)) : $group_name; + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), false, array($group_name)); + } + + $extension_list = $request->variable('extensions', array(0)); + + if ($action == 'edit' && count($extension_list)) + { + $sql = 'UPDATE ' . EXTENSIONS_TABLE . " + SET group_id = 0 + WHERE group_id = $group_id"; + $db->sql_query($sql); + } + + if (count($extension_list)) + { + $sql = 'UPDATE ' . EXTENSIONS_TABLE . " + SET group_id = $group_id + WHERE " . $db->sql_in_set('extension_id', $extension_list); + $db->sql_query($sql); + } + + $cache->destroy('_extensions'); + + if (!count($error)) + { + $notify[] = $user->lang['SUCCESS_EXTENSION_GROUP_' . strtoupper($action)]; + } + } + + $cat_lang = array( + ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], + ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], + ); + + $group_id = $request->variable('g', 0); + $action = (isset($_POST['add'])) ? 'add' : $action; + + switch ($action) + { + case 'delete': + + if (confirm_box(true)) + { + $sql = 'SELECT group_name + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE group_id = $group_id"; + $result = $db->sql_query($sql); + $group_name = (string) $db->sql_fetchfield('group_name'); + $db->sql_freeresult($result); + + $sql = 'DELETE + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE group_id = $group_id"; + $db->sql_query($sql); + + // Set corresponding Extensions to a pending Group + $sql = 'UPDATE ' . EXTENSIONS_TABLE . " + SET group_id = 0 + WHERE group_id = $group_id"; + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXTGROUP_DEL', false, array($group_name)); + + $cache->destroy('_extensions'); + + trigger_error($user->lang['EXTENSION_GROUP_DELETED'] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'group_id' => $group_id, + 'action' => 'delete', + ))); + } + + break; + + case 'edit': + + if (!$group_id) + { + trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql = 'SELECT * + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE group_id = $group_id"; + $result = $db->sql_query($sql); + $ext_group_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $forum_ids = (!$ext_group_row['allowed_forums']) ? array() : unserialize(trim($ext_group_row['allowed_forums'])); + + // no break; + + case 'add': + + if ($action == 'add') + { + $ext_group_row = array( + 'group_name' => $request->variable('group_name', '', true), + 'cat_id' => 0, + 'allow_group' => 1, + 'allow_in_pm' => 1, + 'upload_icon' => '', + 'max_filesize' => 0, + ); + + $forum_ids = array(); + } + + $sql = 'SELECT * + FROM ' . EXTENSIONS_TABLE . " + WHERE group_id = $group_id + OR group_id = 0 + ORDER BY extension"; + $result = $db->sql_query($sql); + $extensions = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + if ($ext_group_row['max_filesize'] == 0) + { + $ext_group_row['max_filesize'] = (int) $config['max_filesize']; + } + + $max_filesize = get_formatted_filesize($ext_group_row['max_filesize'], false, array('mb', 'kb', 'b')); + $size_format = $max_filesize['si_identifier']; + $ext_group_row['max_filesize'] = $max_filesize['value']; + + $img_path = $config['upload_icons_path']; + + $filename_list = ''; + $no_image_select = false; + + $imglist = filelist($phpbb_root_path . $img_path); + + if (!empty($imglist[''])) + { + $imglist = array_values($imglist); + $imglist = $imglist[0]; + + foreach ($imglist as $key => $img) + { + if (!$ext_group_row['upload_icon']) + { + $no_image_select = true; + $selected = ''; + } + else + { + $selected = ($ext_group_row['upload_icon'] == $img) ? ' selected="selected"' : ''; + } + + if (strlen($img) > 255) + { + continue; + } + + $filename_list .= ''; + } + } + + $i = 0; + $assigned_extensions = ''; + foreach ($extensions as $num => $row) + { + if ($row['group_id'] == $group_id && $group_id) + { + $assigned_extensions .= ($i) ? ', ' . $row['extension'] : $row['extension']; + $i++; + } + } + + $s_extension_options = ''; + foreach ($extensions as $row) + { + $s_extension_options .= '' . $row['extension'] . ''; + } + + $template->assign_vars(array( + 'IMG_PATH' => $img_path, + 'ACTION' => $action, + 'GROUP_ID' => $group_id, + 'GROUP_NAME' => $ext_group_row['group_name'], + 'ALLOW_GROUP' => $ext_group_row['allow_group'], + 'ALLOW_IN_PM' => $ext_group_row['allow_in_pm'], + 'UPLOAD_ICON_SRC' => $phpbb_root_path . $img_path . '/' . $ext_group_row['upload_icon'], + 'EXTGROUP_FILESIZE' => $ext_group_row['max_filesize'], + 'ASSIGNED_EXTENSIONS' => $assigned_extensions, + + 'S_CATEGORY_SELECT' => $this->category_select('special_category', $group_id, 'category'), + 'S_EXT_GROUP_SIZE_OPTIONS' => size_select_options($size_format), + 'S_EXTENSION_OPTIONS' => $s_extension_options, + 'S_FILENAME_LIST' => $filename_list, + 'S_EDIT_GROUP' => true, + 'S_NO_IMAGE' => $no_image_select, + 'S_FORUM_IDS' => (count($forum_ids)) ? true : false, + + 'U_EXTENSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=extensions"), + 'U_BACK' => $this->u_action, + + 'L_LEGEND' => $user->lang[strtoupper($action) . '_EXTENSION_GROUP']) + ); + + $s_forum_id_options = ''; + + /** @todo use in-built function **/ + + $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql, 600); + + $right = $cat_right = $padding_inc = 0; + $padding = $forum_list = $holding = ''; + $padding_store = array('0' => ''); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) + { + // Non-postable forum with no subforums, don't display + continue; + } + + if (!$auth->acl_get('f_list', $row['forum_id'])) + { + // if the user does not have permissions to list this forum skip + continue; + } + + if ($row['left_id'] < $right) + { + $padding .= '   '; + $padding_store[$row['parent_id']] = $padding; + } + else if ($row['left_id'] > $right + 1) + { + $padding = empty($padding_store[$row['parent_id']]) ? '' : $padding_store[$row['parent_id']]; + } + + $right = $row['right_id']; + + $selected = (in_array($row['forum_id'], $forum_ids)) ? ' selected="selected"' : ''; + + if ($row['left_id'] > $cat_right) + { + // make sure we don't forget anything + $s_forum_id_options .= $holding; + $holding = ''; + } + + if ($row['right_id'] - $row['left_id'] > 1) + { + $cat_right = max($cat_right, $row['right_id']); + + $holding .= ''; + } + else + { + $s_forum_id_options .= $holding . ''; + $holding = ''; + } + } + + if ($holding) + { + $s_forum_id_options .= $holding; + } + + $db->sql_freeresult($result); + unset($padding_store); + + $template->assign_vars(array( + 'S_FORUM_ID_OPTIONS' => $s_forum_id_options) + ); + + break; + } + + $sql = 'SELECT * + FROM ' . EXTENSION_GROUPS_TABLE . ' + ORDER BY allow_group DESC, allow_in_pm DESC, group_name'; + $result = $db->sql_query($sql); + + $old_allow_group = $old_allow_pm = 1; + while ($row = $db->sql_fetchrow($result)) + { + $s_add_spacer = ($old_allow_group != $row['allow_group'] || $old_allow_pm != $row['allow_in_pm']) ? true : false; + + $template->assign_block_vars('groups', array( + 'S_ADD_SPACER' => $s_add_spacer, + 'S_ALLOWED_IN_PM' => ($row['allow_in_pm']) ? true : false, + 'S_GROUP_ALLOWED' => ($row['allow_group']) ? true : false, + + 'U_EDIT' => $this->u_action . "&action=edit&g={$row['group_id']}", + 'U_DELETE' => $this->u_action . "&action=delete&g={$row['group_id']}", + + 'GROUP_NAME' => $this->language->is_set('EXT_GROUP_' . utf8_strtoupper($row['group_name'])) ? $this->language->lang('EXT_GROUP_' . utf8_strtoupper($row['group_name'])) : $row['group_name'], + 'CATEGORY' => $cat_lang[$row['cat_id']], + ) + ); + + $old_allow_group = $row['allow_group']; + $old_allow_pm = $row['allow_in_pm']; + } + $db->sql_freeresult($result); + + break; + + case 'orphan': + + /* @var $pagination \phpbb\pagination */ + $pagination = $this->phpbb_container->get('pagination'); + + if ($submit) + { + $delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); + $add_files = (isset($_POST['add'])) ? array_keys($request->variable('add', array('' => 0))) : array(); + $post_ids = $request->variable('post_id', array('' => 0)); + + if (count($delete_files)) + { + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', $delete_files) . ' + AND is_orphan = 1'; + $result = $db->sql_query($sql); + + $delete_files = array(); + while ($row = $db->sql_fetchrow($result)) + { + $this->attachment_manager->unlink($row['physical_filename'], 'file'); + + if ($row['thumbnail']) + { + $this->attachment_manager->unlink($row['physical_filename'], 'thumbnail'); + } + + $delete_files[$row['attach_id']] = $row['real_filename']; + } + $db->sql_freeresult($result); + } + + if (count($delete_files)) + { + $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($delete_files)); + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_ORPHAN_DEL', false, array(implode(', ', $delete_files))); + $notify[] = sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode($user->lang['COMMA_SEPARATOR'], $delete_files)); + } + + $upload_list = array(); + foreach ($add_files as $attach_id) + { + if (!isset($delete_files[$attach_id]) && !empty($post_ids[$attach_id])) + { + $upload_list[$attach_id] = $post_ids[$attach_id]; + } + } + unset($add_files); + + if (count($upload_list)) + { + $template->assign_var('S_UPLOADING_FILES', true); + + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + + $forum_names = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_names[$row['forum_id']] = $row['forum_name']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT forum_id, topic_id, post_id, poster_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_id', $upload_list); + $result = $db->sql_query($sql); + + $post_info = array(); + while ($row = $db->sql_fetchrow($result)) + { + $post_info[$row['post_id']] = $row; + } + $db->sql_freeresult($result); + + // Select those attachments we want to change... + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($upload_list)) . ' + AND is_orphan = 1'; + $result = $db->sql_query($sql); + + $files_added = $space_taken = 0; + while ($row = $db->sql_fetchrow($result)) + { + $post_row = $post_info[$upload_list[$row['attach_id']]]; + + $template->assign_block_vars('upload', array( + 'FILE_INFO' => sprintf($user->lang['UPLOADING_FILE_TO'], $row['real_filename'], $post_row['post_id']), + 'S_DENIED' => (!$auth->acl_get('f_attach', $post_row['forum_id'])) ? true : false, + 'L_DENIED' => (!$auth->acl_get('f_attach', $post_row['forum_id'])) ? sprintf($user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) : '') + ); + + if (!$auth->acl_get('f_attach', $post_row['forum_id'])) + { + continue; + } + + // Adjust attachment entry + $sql_ary = array( + 'in_message' => 0, + 'is_orphan' => 0, + 'poster_id' => $post_row['poster_id'], + 'post_msg_id' => $post_row['post_id'], + 'topic_id' => $post_row['topic_id'], + ); + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE attach_id = ' . $row['attach_id']; + $db->sql_query($sql); + + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_attachment = 1 + WHERE post_id = ' . $post_row['post_id']; + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_attachment = 1 + WHERE topic_id = ' . $post_row['topic_id']; + $db->sql_query($sql); + + $space_taken += $row['filesize']; + $files_added++; + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_FILEUPLOAD', false, array($post_row['post_id'], $row['real_filename'])); + } + $db->sql_freeresult($result); + + if ($files_added) + { + $config->increment('upload_dir_size', $space_taken, false); + $config->increment('num_files', $files_added, false); + } + } + } + + $template->assign_vars(array( + 'S_ORPHAN' => true) + ); + + $attachments_per_page = (int) $config['topics_per_page']; + + // Get total number or orphans older than 3 hours + $sql = 'SELECT COUNT(attach_id) as num_files, SUM(filesize) as total_size + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 1 + AND filetime < ' . (time() - 3*60*60); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $num_files = (int) $row['num_files']; + $total_size = (int) $row['total_size']; + $this->db->sql_freeresult($result); + + $start = $request->variable('start', 0); + $start = $pagination->validate_start($start, $attachments_per_page, $num_files); + + // Just get the files with is_orphan set and older than 3 hours + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 1 + AND filetime < ' . (time() - 3*60*60) . ' + ORDER BY filetime DESC'; + $result = $db->sql_query_limit($sql, $attachments_per_page, $start); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('orphan', array( + 'FILESIZE' => get_formatted_filesize($row['filesize']), + 'FILETIME' => $user->format_date($row['filetime']), + 'REAL_FILENAME' => utf8_basename($row['real_filename']), + 'PHYSICAL_FILENAME' => utf8_basename($row['physical_filename']), + 'ATTACH_ID' => $row['attach_id'], + 'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '', + 'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&id=' . $row['attach_id'])) + ); + } + $db->sql_freeresult($result); + + $pagination->generate_template_pagination( + $this->u_action, + 'pagination', + 'start', + $num_files, + $attachments_per_page, + $start + ); + + $template->assign_vars(array( + 'TOTAL_FILES' => $num_files, + 'TOTAL_SIZE' => get_formatted_filesize($total_size), + )); + + break; + + case 'manage': + + if ($submit) + { + $delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); + + if (count($delete_files)) + { + // Select those attachments we want to delete... + $sql = 'SELECT real_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', $delete_files) . ' + AND is_orphan = 0'; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $deleted_filenames[] = $row['real_filename']; + } + $db->sql_freeresult($result); + + if ($num_deleted = $this->attachment_manager->delete('attach', $delete_files)) + { + if (count($delete_files) != $num_deleted) + { + $error[] = $user->lang['FILES_GONE']; + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACHMENTS_DELETED', false, array(implode(', ', $deleted_filenames))); + $notify[] = sprintf($user->lang['LOG_ATTACHMENTS_DELETED'], implode($user->lang['COMMA_SEPARATOR'], $deleted_filenames)); + } + else + { + $error[] = $user->lang['NO_FILES_TO_DELETE']; + } + } + } + + if ($action == 'stats') + { + $this->handle_stats_resync(); + } + + $stats_error = $this->check_stats_accuracy(); + + if ($stats_error) + { + $error[] = $stats_error; + } + + $template->assign_vars(array( + 'S_MANAGE' => true, + )); + + $start = $request->variable('start', 0); + + // Sort keys + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); + + // Sorting + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('f' => $user->lang['FILENAME'], 't' => $user->lang['FILEDATE'], 's' => $user->lang['FILESIZE'], 'x' => $user->lang['EXTENSION'], 'd' => $user->lang['DOWNLOADS'],'p' => $user->lang['ATTACH_POST_TYPE'], 'u' => $user->lang['AUTHOR']); + $sort_by_sql = array('f' => 'a.real_filename', 't' => 'a.filetime', 's' => 'a.filesize', 'x' => 'a.extension', 'd' => 'a.download_count', 'p' => 'a.in_message', 'u' => 'u.username'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + $min_filetime = ($sort_days) ? (time() - ($sort_days * 86400)) : ''; + $limit_filetime = ($min_filetime) ? " AND a.filetime >= $min_filetime " : ''; + $start = ($sort_days && isset($_POST['sort'])) ? 0 : $start; + + $attachments_per_page = (int) $config['topics_per_page']; + + $stats = $this->get_attachment_stats($limit_filetime); + $num_files = $stats['num_files']; + $total_size = $stats['upload_dir_size']; + + // Make sure $start is set to the last page if it exceeds the amount + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $start = $pagination->validate_start($start, $attachments_per_page, $num_files); + + // If the user is trying to reach the second half of the attachments list, fetch it starting from the end + $store_reverse = false; + $sql_limit = $attachments_per_page; + + if ($start > $num_files / 2) + { + $store_reverse = true; + + // Select the sort order. Add time sort anchor for non-time sorting cases + $sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') : ''; + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') . $sql_sort_anchor; + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $num_files); + $sql_start = $pagination->reverse_start($start, $sql_limit, $num_files); + } + else + { + // Select the sort order. Add time sort anchor for non-time sorting cases + $sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') : ''; + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') . $sql_sort_anchor; + $sql_start = $start; + } + + $attachments_list = array(); + + // Just get the files + $sql = 'SELECT a.*, u.username, u.user_colour, t.topic_title + FROM ' . ATTACHMENTS_TABLE . ' a + LEFT JOIN ' . USERS_TABLE . ' u ON (u.user_id = a.poster_id) + LEFT JOIN ' . TOPICS_TABLE . " t ON (a.topic_id = t.topic_id) + WHERE a.is_orphan = 0 + $limit_filetime + ORDER BY $sql_sort_order"; + $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + + $i = ($store_reverse) ? $sql_limit - 1 : 0; + + // Store increment value in a variable to save some conditional calls + $i_increment = ($store_reverse) ? -1 : 1; + while ($attachment_row = $db->sql_fetchrow($result)) + { + $attachments_list[$i] = $attachment_row; + $i = $i + $i_increment; + } + $db->sql_freeresult($result); + + $base_url = $this->u_action . "&$u_sort_param"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_files, $attachments_per_page, $start); + + $template->assign_vars(array( + 'TOTAL_FILES' => $num_files, + 'TOTAL_SIZE' => get_formatted_filesize($total_size), + + 'S_LIMIT_DAYS' => $s_limit_days, + 'S_SORT_KEY' => $s_sort_key, + 'S_SORT_DIR' => $s_sort_dir) + ); + + // Grab extensions + $extensions = $cache->obtain_attach_extensions(true); + + for ($i = 0, $end = count($attachments_list); $i < $end; ++$i) + { + $row = $attachments_list[$i]; + + $row['extension'] = strtolower(trim((string) $row['extension'])); + $comment = ($row['attach_comment'] && !$row['in_message']) ? str_replace(array("\n", "\r"), array('
', "\n"), $row['attach_comment']) : ''; + $display_cat = isset($extensions[$row['extension']]['display_cat']) ? $extensions[$row['extension']]['display_cat'] : ATTACHMENT_CATEGORY_NONE; + $l_downloaded_viewed = ($display_cat == ATTACHMENT_CATEGORY_NONE) ? 'DOWNLOAD_COUNTS' : 'VIEWED_COUNTS'; + + $template->assign_block_vars('attachments', array( + 'ATTACHMENT_POSTER' => get_username_string('full', (int) $row['poster_id'], (string) $row['username'], (string) $row['user_colour'], (string) $row['username']), + 'FILESIZE' => get_formatted_filesize((int) $row['filesize']), + 'FILETIME' => $user->format_date((int) $row['filetime']), + 'REAL_FILENAME' => utf8_basename((string) $row['real_filename']), + 'EXT_GROUP_NAME' => $this->language->is_set('EXT_GROUP_' . utf8_strtoupper($extensions[$row['extension']]['group_name'])) ? $this->language->lang('EXT_GROUP_' . utf8_strtoupper($extensions[$row['extension']]['group_name'])) : $extensions[$row['extension']]['group_name'], + 'COMMENT' => $comment, + 'TOPIC_TITLE' => (!$row['in_message']) ? (string) $row['topic_title'] : '', + 'ATTACH_ID' => (int) $row['attach_id'], + + 'L_DOWNLOAD_COUNT' => $user->lang($l_downloaded_viewed, (int) $row['download_count']), + + 'S_IN_MESSAGE' => (bool) $row['in_message'], + + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . "#p{$row['post_msg_id']}", + 'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&id=' . $row['attach_id'])) + ); + } + + break; + } + + if (count($error)) + { + $template->assign_vars(array( + 'S_WARNING' => true, + 'WARNING_MSG' => implode('
', $error)) + ); + } + + if (count($notify)) + { + $template->assign_vars(array( + 'S_NOTIFY' => true, + 'NOTIFY_MSG' => implode('
', $notify)) + ); + } + } + + /** + * Get attachment file count and size of upload directory + * + * @param $limit string Additional limit for WHERE clause to filter stats by. + * @return array Returns array with stats: num_files and upload_dir_size + */ + public function get_attachment_stats($limit = '') + { + $sql = 'SELECT COUNT(a.attach_id) AS num_files, SUM(a.filesize) AS upload_dir_size + FROM ' . ATTACHMENTS_TABLE . " a + WHERE a.is_orphan = 0 + $limit"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + return array( + 'num_files' => (int) $row['num_files'], + 'upload_dir_size' => (float) $row['upload_dir_size'], + ); + } + + /** + * Set config attachment stat values + * + * @param $stats array Array of config key => value pairs to set. + * @return null + */ + public function set_attachment_stats($stats) + { + foreach ($stats as $key => $value) + { + $this->config->set($key, $value, true); + } + } + + /** + * Check accuracy of attachment statistics. + * + * @return bool|string Returns false if stats are correct or error message + * otherwise. + */ + public function check_stats_accuracy() + { + // Get fresh stats. + $stats = $this->get_attachment_stats(); + + // Get current files stats + $num_files = (int) $this->config['num_files']; + $total_size = (float) $this->config['upload_dir_size']; + + if (($num_files != $stats['num_files']) || ($total_size != $stats['upload_dir_size'])) + { + $u_resync = $this->u_action . '&action=stats'; + + return $this->user->lang( + 'FILES_STATS_WRONG', + (int) $stats['num_files'], + get_formatted_filesize($stats['upload_dir_size']), + '', + '' + ); + } + return false; + } + + /** + * Handle stats resync. + * + * @return null + */ + public function handle_stats_resync() + { + if (!confirm_box(true)) + { + confirm_box(false, $this->user->lang['RESYNC_FILES_STATS_CONFIRM'], build_hidden_fields(array( + 'i' => $this->id, + 'mode' => 'manage', + 'action' => 'stats', + ))); + } + else + { + $this->set_attachment_stats($this->get_attachment_stats()); + + /* @var $log \phpbb\log\log_interface */ + $log = $this->phpbb_container->get('log'); + $log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_RESYNC_FILES_STATS'); + } + + } + + /** + * Build Select for category items + */ + function category_select($select_name, $group_id = false, $key = '') + { + global $db, $user; + + $types = array( + ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], + ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], + ); + + if ($group_id) + { + $sql = 'SELECT cat_id + FROM ' . EXTENSION_GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + + $cat_type = (!($row = $db->sql_fetchrow($result))) ? ATTACHMENT_CATEGORY_NONE : $row['cat_id']; + + $db->sql_freeresult($result); + } + else + { + $cat_type = ATTACHMENT_CATEGORY_NONE; + } + + $group_select = ''; + + return $group_select; + } + + /** + * Extension group select + */ + function group_select($select_name, $default_group = false, $key = '') + { + global $db, $user; + + $group_select = ''; + + return $group_select; + } + + /** + * Test Settings + */ + function test_upload(&$error, $upload_dir, $create_directory = false) + { + global $user, $phpbb_root_path; + + // Does the target directory exist, is it a directory and writable. + if ($create_directory) + { + if (!file_exists($phpbb_root_path . $upload_dir)) + { + @mkdir($phpbb_root_path . $upload_dir, 0777); + + try + { + $this->filesystem->phpbb_chmod($phpbb_root_path . $upload_dir, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + + if (!file_exists($phpbb_root_path . $upload_dir)) + { + $error[] = sprintf($user->lang['NO_UPLOAD_DIR'], $upload_dir); + return; + } + + if (!is_dir($phpbb_root_path . $upload_dir)) + { + $error[] = sprintf($user->lang['UPLOAD_NOT_DIR'], $upload_dir); + return; + } + + if (!$this->filesystem->is_writable($phpbb_root_path . $upload_dir)) + { + $error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir); + return; + } + } + + /** + * Perform operations on sites for external linking + */ + function perform_site_list() + { + global $db, $user, $request, $phpbb_log; + + if (isset($_REQUEST['securesubmit'])) + { + // Grab the list of entries + $ips = $request->variable('ips', ''); + $ip_list = array_unique(explode("\n", $ips)); + $ip_list_log = implode(', ', $ip_list); + + $ip_exclude = (int) $request->variable('ipexclude', false, false, \phpbb\request\request_interface::POST); + + $iplist = array(); + $hostlist = array(); + + foreach ($ip_list as $item) + { + if (preg_match('#^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$#', trim($item), $ip_range_explode)) + { + // Don't ask about all this, just don't ask ... ! + $ip_1_counter = $ip_range_explode[1]; + $ip_1_end = $ip_range_explode[5]; + + while ($ip_1_counter <= $ip_1_end) + { + $ip_2_counter = ($ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[2] : 0; + $ip_2_end = ($ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[6]; + + if ($ip_2_counter == 0 && $ip_2_end == 254) + { + $ip_2_counter = 256; + + $iplist[] = "'$ip_1_counter.*'"; + } + + while ($ip_2_counter <= $ip_2_end) + { + $ip_3_counter = ($ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[3] : 0; + $ip_3_end = ($ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[7]; + + if ($ip_3_counter == 0 && $ip_3_end == 254) + { + $ip_3_counter = 256; + + $iplist[] = "'$ip_1_counter.$ip_2_counter.*'"; + } + + while ($ip_3_counter <= $ip_3_end) + { + $ip_4_counter = ($ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[4] : 0; + $ip_4_end = ($ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end) ? 254 : $ip_range_explode[8]; + + if ($ip_4_counter == 0 && $ip_4_end == 254) + { + $ip_4_counter = 256; + + $iplist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.*'"; + } + + while ($ip_4_counter <= $ip_4_end) + { + $iplist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter'"; + $ip_4_counter++; + } + $ip_3_counter++; + } + $ip_2_counter++; + } + $ip_1_counter++; + } + } + else if (preg_match('#^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$#', trim($item)) || preg_match('#^[a-f0-9:]+\*?$#i', trim($item))) + { + $iplist[] = "'" . trim($item) . "'"; + } + else if (preg_match('#^([\w\-_]\.?){2,}$#is', trim($item))) + { + $hostlist[] = "'" . trim($item) . "'"; + } + else if (preg_match("#^([a-z0-9\-\*\._/]+?)$#is", trim($item))) + { + $hostlist[] = "'" . trim($item) . "'"; + } + } + + $sql = 'SELECT site_ip, site_hostname + FROM ' . SITELIST_TABLE . " + WHERE ip_exclude = $ip_exclude"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $iplist_tmp = array(); + $hostlist_tmp = array(); + do + { + if ($row['site_ip']) + { + if (strlen($row['site_ip']) > 40) + { + continue; + } + + $iplist_tmp[] = "'" . $row['site_ip'] . "'"; + } + else if ($row['site_hostname']) + { + if (strlen($row['site_hostname']) > 255) + { + continue; + } + + $hostlist_tmp[] = "'" . $row['site_hostname'] . "'"; + } + // break; + } + while ($row = $db->sql_fetchrow($result)); + + $iplist = array_unique(array_diff($iplist, $iplist_tmp)); + $hostlist = array_unique(array_diff($hostlist, $hostlist_tmp)); + unset($iplist_tmp); + unset($hostlist_tmp); + } + $db->sql_freeresult($result); + + if (count($iplist)) + { + foreach ($iplist as $ip_entry) + { + $sql = 'INSERT INTO ' . SITELIST_TABLE . " (site_ip, ip_exclude) + VALUES ($ip_entry, $ip_exclude)"; + $db->sql_query($sql); + } + } + + if (count($hostlist)) + { + foreach ($hostlist as $host_entry) + { + $sql = 'INSERT INTO ' . SITELIST_TABLE . " (site_hostname, ip_exclude) + VALUES ($host_entry, $ip_exclude)"; + $db->sql_query($sql); + } + } + + if (!empty($ip_list_log)) + { + // Update log + $log_entry = ($ip_exclude) ? 'LOG_DOWNLOAD_EXCLUDE_IP' : 'LOG_DOWNLOAD_IP'; + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_entry, false, array($ip_list_log)); + } + + trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); + } + else if (isset($_POST['unsecuresubmit'])) + { + $unip_sql = $request->variable('unip', array(0)); + + if (count($unip_sql)) + { + $l_unip_list = ''; + + // Grab details of ips for logging information later + $sql = 'SELECT site_ip, site_hostname + FROM ' . SITELIST_TABLE . ' + WHERE ' . $db->sql_in_set('site_id', $unip_sql); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $l_unip_list .= (($l_unip_list != '') ? ', ' : '') . (($row['site_ip']) ? $row['site_ip'] : $row['site_hostname']); + } + $db->sql_freeresult($result); + + $sql = 'DELETE FROM ' . SITELIST_TABLE . ' + WHERE ' . $db->sql_in_set('site_id', $unip_sql); + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DOWNLOAD_REMOVE_IP', false, array($l_unip_list)); + } + + trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); + } + } + + /** + * Write display_order config field + */ + function display_order($value, $key = '') + { + $radio_ary = array(0 => 'DESCENDING', 1 => 'ASCENDING'); + + return h_radio('config[display_order]', $radio_ary, $value, $key); + } + + /** + * Adjust all three max_filesize config vars for display + */ + function max_filesize($value, $key = '') + { + // Determine size var and adjust the value accordingly + $filesize = get_formatted_filesize($value, false, array('mb', 'kb', 'b')); + $size_var = $filesize['si_identifier']; + $value = $filesize['value']; + + // size and maxlength must not be specified for input of type number + return ' '; + } + + /** + * Write secure_allow_deny config field + */ + function select_allow_deny($value, $key = '') + { + $radio_ary = array(1 => 'ORDER_ALLOW_DENY', 0 => 'ORDER_DENY_ALLOW'); + + return h_radio('config[' . $key . ']', $radio_ary, $value, $key); + } + +} diff --git a/install/update/new/includes/acp/acp_bbcodes.php b/install/update/new/includes/acp/acp_bbcodes.php new file mode 100644 index 0000000..5e39055 --- /dev/null +++ b/install/update/new/includes/acp/acp_bbcodes.php @@ -0,0 +1,480 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_bbcodes +{ + var $u_action; + + function main($id, $mode) + { + global $db, $user, $template, $cache, $request, $phpbb_dispatcher, $phpbb_container; + global $phpbb_log; + + $user->add_lang('acp/posting'); + + // Set up general vars + $action = $request->variable('action', ''); + $bbcode_id = $request->variable('bbcode', 0); + + $this->tpl_name = 'acp_bbcodes'; + $this->page_title = 'ACP_BBCODES'; + $form_key = 'acp_bbcodes'; + + add_form_key($form_key); + + // Set up mode-specific vars + switch ($action) + { + case 'add': + $bbcode_match = $bbcode_tpl = $bbcode_helpline = ''; + $display_on_posting = 0; + break; + + case 'edit': + $sql = 'SELECT bbcode_match, bbcode_tpl, display_on_posting, bbcode_helpline + FROM ' . BBCODES_TABLE . ' + WHERE bbcode_id = ' . $bbcode_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['BBCODE_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $bbcode_match = $row['bbcode_match']; + $bbcode_tpl = htmlspecialchars($row['bbcode_tpl']); + $display_on_posting = $row['display_on_posting']; + $bbcode_helpline = $row['bbcode_helpline']; + break; + + case 'modify': + $sql = 'SELECT bbcode_id, bbcode_tag + FROM ' . BBCODES_TABLE . ' + WHERE bbcode_id = ' . $bbcode_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['BBCODE_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // No break here + + case 'create': + $display_on_posting = $request->variable('display_on_posting', 0); + + $bbcode_match = $request->variable('bbcode_match', ''); + $bbcode_tpl = htmlspecialchars_decode($request->variable('bbcode_tpl', '', true)); + $bbcode_helpline = $request->variable('bbcode_helpline', '', true); + break; + } + + // Do major work + switch ($action) + { + case 'edit': + case 'add': + + $tpl_ary = array( + 'S_EDIT_BBCODE' => true, + 'U_BACK' => $this->u_action, + 'U_ACTION' => $this->u_action . '&action=' . (($action == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&bbcode=$bbcode_id" : ''), + + 'L_BBCODE_USAGE_EXPLAIN'=> sprintf($user->lang['BBCODE_USAGE_EXPLAIN'], '', ''), + 'BBCODE_MATCH' => $bbcode_match, + 'BBCODE_TPL' => $bbcode_tpl, + 'BBCODE_HELPLINE' => $bbcode_helpline, + 'DISPLAY_ON_POSTING' => $display_on_posting, + ); + + $bbcode_tokens = array('TEXT', 'SIMPLETEXT', 'INTTEXT', 'IDENTIFIER', 'NUMBER', 'EMAIL', 'URL', 'LOCAL_URL', 'RELATIVE_URL', 'COLOR'); + + /** + * Modify custom bbcode template data before we display the add/edit form + * + * @event core.acp_bbcodes_edit_add + * @var string action Type of the action: add|edit + * @var array tpl_ary Array with custom bbcode add/edit data + * @var int bbcode_id When editing: the bbcode id, + * when creating: 0 + * @var array bbcode_tokens Array of bbcode tokens + * @since 3.1.0-a3 + */ + $vars = array('action', 'tpl_ary', 'bbcode_id', 'bbcode_tokens'); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_edit_add', compact($vars))); + + $template->assign_vars($tpl_ary); + + foreach ($bbcode_tokens as $token) + { + $template->assign_block_vars('token', array( + 'TOKEN' => '{' . $token . '}', + 'EXPLAIN' => ($token === 'LOCAL_URL') ? $user->lang(array('tokens', $token), generate_board_url() . '/') : $user->lang(array('tokens', $token)), + )); + } + + return; + + break; + + case 'modify': + case 'create': + + $sql_ary = $hidden_fields = array(); + + /** + * Modify custom bbcode data before the modify/create action + * + * @event core.acp_bbcodes_modify_create + * @var string action Type of the action: modify|create + * @var array sql_ary Array with new bbcode data + * @var int bbcode_id When editing: the bbcode id, + * when creating: 0 + * @var bool display_on_posting Display bbcode on posting form + * @var string bbcode_match The bbcode usage string to match + * @var string bbcode_tpl The bbcode HTML replacement string + * @var string bbcode_helpline The bbcode help line string + * @var array hidden_fields Array of hidden fields for use when + * submitting form when $warn_unsafe is true + * @since 3.1.0-a3 + */ + $vars = array( + 'action', + 'sql_ary', + 'bbcode_id', + 'display_on_posting', + 'bbcode_match', + 'bbcode_tpl', + 'bbcode_helpline', + 'hidden_fields', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create', compact($vars))); + + $acp_utils = $phpbb_container->get('text_formatter.acp_utils'); + $bbcode_info = $acp_utils->analyse_bbcode($bbcode_match, $bbcode_tpl); + $warn_unsafe = ($bbcode_info['status'] === $acp_utils::BBCODE_STATUS_UNSAFE); + + if ($bbcode_info['status'] === $acp_utils::BBCODE_STATUS_INVALID_TEMPLATE) + { + trigger_error($user->lang['BBCODE_INVALID_TEMPLATE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + if ($bbcode_info['status'] === $acp_utils::BBCODE_STATUS_INVALID_DEFINITION) + { + trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (!$warn_unsafe && !check_form_key($form_key)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (!$warn_unsafe || confirm_box(true)) + { + $data = $this->build_regexp($bbcode_match, $bbcode_tpl); + + // Make sure the user didn't pick a "bad" name for the BBCode tag. + $hard_coded = array('code', 'quote', 'quote=', 'attachment', 'attachment=', 'b', 'i', 'url', 'url=', 'img', 'size', 'size=', 'color', 'color=', 'u', 'list', 'list=', 'email', 'email=', 'flash', 'flash='); + + if (($action == 'modify' && strtolower($data['bbcode_tag']) !== strtolower($row['bbcode_tag'])) || ($action == 'create')) + { + $sql = 'SELECT 1 as test + FROM ' . BBCODES_TABLE . " + WHERE LOWER(bbcode_tag) = '" . $db->sql_escape(strtolower($data['bbcode_tag'])) . "'"; + $result = $db->sql_query($sql); + $info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Grab the end, interrogate the last closing tag + if (isset($info['test']) && $info['test'] === '1' + || in_array(strtolower($data['bbcode_tag']), $hard_coded) + || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded)) + ) + { + trigger_error($user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + if (substr($data['bbcode_tag'], -1) === '=') + { + $test = substr($data['bbcode_tag'], 0, -1); + } + else + { + $test = $data['bbcode_tag']; + } + + if (strlen($data['bbcode_tag']) > 16) + { + trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (strlen($bbcode_match) > 4000) + { + trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (strlen($bbcode_helpline) > 255) + { + trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql_ary = array_merge($sql_ary, array( + 'bbcode_tag' => $data['bbcode_tag'], + 'bbcode_match' => $bbcode_match, + 'bbcode_tpl' => $bbcode_tpl, + 'display_on_posting' => $display_on_posting, + 'bbcode_helpline' => $bbcode_helpline, + 'first_pass_match' => $data['first_pass_match'], + 'first_pass_replace' => $data['first_pass_replace'], + 'second_pass_match' => $data['second_pass_match'], + 'second_pass_replace' => $data['second_pass_replace'] + )); + + if ($action == 'create') + { + $sql = 'SELECT MAX(bbcode_id) as max_bbcode_id + FROM ' . BBCODES_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $bbcode_id = (int) $row['max_bbcode_id'] + 1; + + // Make sure it is greater than the core bbcode ids... + if ($bbcode_id <= NUM_CORE_BBCODES) + { + $bbcode_id = NUM_CORE_BBCODES + 1; + } + } + else + { + $bbcode_id = NUM_CORE_BBCODES + 1; + } + + if ($bbcode_id > BBCODE_LIMIT) + { + trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql_ary['bbcode_id'] = (int) $bbcode_id; + + $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary)); + $cache->destroy('sql', BBCODES_TABLE); + $phpbb_container->get('text_formatter.cache')->invalidate(); + + $lang = 'BBCODE_ADDED'; + $log_action = 'LOG_BBCODE_ADD'; + } + else + { + $sql = 'UPDATE ' . BBCODES_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE bbcode_id = ' . $bbcode_id; + $db->sql_query($sql); + $cache->destroy('sql', BBCODES_TABLE); + $phpbb_container->get('text_formatter.cache')->invalidate(); + + $lang = 'BBCODE_EDITED'; + $log_action = 'LOG_BBCODE_EDIT'; + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($data['bbcode_tag'])); + + /** + * Event after a BBCode has been added or updated + * + * @event core.acp_bbcodes_modify_create_after + * @var string action Type of the action: modify|create + * @var int bbcode_id The id of the added or updated bbcode + * @var array sql_ary Array with bbcode data (read only) + * @since 3.2.4-RC1 + */ + $vars = array( + 'action', + 'bbcode_id', + 'sql_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create_after', compact($vars))); + + trigger_error($user->lang[$lang] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['BBCODE_DANGER'], build_hidden_fields(array_merge($hidden_fields, array( + 'action' => $action, + 'bbcode' => $bbcode_id, + 'bbcode_match' => $bbcode_match, + 'bbcode_tpl' => htmlspecialchars($bbcode_tpl), + 'bbcode_helpline' => $bbcode_helpline, + 'display_on_posting' => $display_on_posting, + ))) + , 'confirm_bbcode.html'); + } + + break; + + case 'delete': + + $sql = 'SELECT bbcode_tag + FROM ' . BBCODES_TABLE . " + WHERE bbcode_id = $bbcode_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + if (confirm_box(true)) + { + $bbcode_tag = $row['bbcode_tag']; + + $db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id"); + $cache->destroy('sql', BBCODES_TABLE); + $phpbb_container->get('text_formatter.cache')->invalidate(); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BBCODE_DELETE', false, array($bbcode_tag)); + + /** + * Event after a BBCode has been deleted + * + * @event core.acp_bbcodes_delete_after + * @var string action Type of the action: delete + * @var int bbcode_id The id of the deleted bbcode + * @var string bbcode_tag The tag of the deleted bbcode + * @since 3.2.4-RC1 + */ + $vars = array( + 'action', + 'bbcode_id', + 'bbcode_tag', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_delete_after', compact($vars))); + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['BBCODE_DELETED'], + 'REFRESH_DATA' => array( + 'time' => 3 + ) + )); + } + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'bbcode' => $bbcode_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action)) + ); + } + } + + break; + } + + $u_action = $this->u_action; + + $template_data = array( + 'U_ACTION' => $this->u_action . '&action=add', + ); + + $sql_ary = array( + 'SELECT' => 'b.*', + 'FROM' => array(BBCODES_TABLE => 'b'), + 'ORDER_BY' => 'b.bbcode_tag', + ); + + /** + * Modify custom bbcode template data before we display the form + * + * @event core.acp_bbcodes_display_form + * @var string action Type of the action: modify|create + * @var array sql_ary The SQL array to get custom bbcode data + * @var array template_data Array with form template data + * @var string u_action The u_action link + * @since 3.1.0-a3 + */ + $vars = array('action', 'sql_ary', 'template_data', 'u_action'); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_display_form', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + $template->assign_vars($template_data); + + while ($row = $db->sql_fetchrow($result)) + { + $bbcodes_array = array( + 'BBCODE_TAG' => $row['bbcode_tag'], + 'U_EDIT' => $u_action . '&action=edit&bbcode=' . $row['bbcode_id'], + 'U_DELETE' => $u_action . '&action=delete&bbcode=' . $row['bbcode_id'], + ); + + /** + * Modify display of custom bbcodes in the form + * + * @event core.acp_bbcodes_display_bbcodes + * @var array row Array with current bbcode data + * @var array bbcodes_array Array of bbcodes template data + * @var string u_action The u_action link + * @since 3.1.0-a3 + */ + $vars = array('bbcodes_array', 'row', 'u_action'); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_display_bbcodes', compact($vars))); + + $template->assign_block_vars('bbcodes', $bbcodes_array); + + } + $db->sql_freeresult($result); + } + + /* + * Build regular expression for custom bbcode + */ + function build_regexp(&$bbcode_match, &$bbcode_tpl) + { + $bbcode_match = trim($bbcode_match); + $bbcode_tag = preg_replace('/.*?\[([a-z0-9_-]+).*/i', '$1', $bbcode_match); + + if (!preg_match('/^[a-zA-Z0-9_-]+$/', $bbcode_tag)) + { + global $user; + trigger_error($user->lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + return array( + 'bbcode_tag' => $bbcode_tag, + 'first_pass_match' => '/(?!)/', + 'first_pass_replace' => '', + // Use a non-matching, valid regexp to effectively disable this BBCode + 'second_pass_match' => '/(?!)/', + 'second_pass_replace' => '' + ); + } +} diff --git a/install/update/new/includes/acp/acp_board.php b/install/update/new/includes/acp/acp_board.php new file mode 100644 index 0000000..cd72a87 --- /dev/null +++ b/install/update/new/includes/acp/acp_board.php @@ -0,0 +1,1172 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @todo add cron intervals to server settings? (database_gc, queue_interval, session_gc, search_gc, cache_gc, warnings_gc) +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_board +{ + var $u_action; + var $new_config; + + function main($id, $mode) + { + global $user, $template, $request, $language; + global $config, $phpbb_root_path, $phpEx; + global $cache, $phpbb_container, $phpbb_dispatcher, $phpbb_log; + + /** @var \phpbb\language\language $language Language object */ + $language = $phpbb_container->get('language'); + + $user->add_lang('acp/board'); + + $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false; + + $form_key = 'acp_board'; + add_form_key($form_key); + + /** + * Validation types are: + * string, int, bool, + * script_path (absolute path in url - beginning with / and no trailing slash), + * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable) + */ + switch ($mode) + { + case 'settings': + $display_vars = array( + 'title' => 'ACP_BOARD_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_BOARD_SETTINGS', + 'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), + 'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), + 'site_home_url' => array('lang' => 'SITE_HOME_URL', 'validate' => 'url', 'type' => 'url:40:255', 'explain' => true), + 'site_home_text' => array('lang' => 'SITE_HOME_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + 'board_index_text' => array('lang' => 'BOARD_INDEX_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + 'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true), + 'board_disable_msg' => false, + 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), + 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), + 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'custom', 'method' => 'timezone_select', 'explain' => true), + + 'legend2' => 'BOARD_STYLE', + 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true), + 'guest_style' => array('lang' => 'GUEST_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array($this->guest_style_get(), false), 'explain' => true), + 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend3' => 'WARNINGS', + 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + + 'legend4' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'features': + $display_vars = array( + 'title' => 'ACP_BOARD_FEATURES', + 'vars' => array( + 'legend1' => 'ACP_BOARD_FEATURES', + 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_board_notifications' => array('lang' => 'ALLOW_BOARD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'display_last_subject' => array('lang' => 'DISPLAY_LAST_SUBJECT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'display_unapproved_posts' => array('lang' => 'DISPLAY_UNAPPROVED_POSTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), + + 'legend2' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'avatar': + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + $avatar_drivers = $phpbb_avatar_manager->get_all_drivers(); + + $avatar_vars = array(); + foreach ($avatar_drivers as $current_driver) + { + /** @var \phpbb\avatar\driver\driver_interface $driver */ + $driver = $phpbb_avatar_manager->get_driver($current_driver, false); + + /* + * First grab the settings for enabling/disabling the avatar + * driver and afterwards grab additional settings the driver + * might have. + */ + $avatar_vars += $phpbb_avatar_manager->get_avatar_settings($driver); + $avatar_vars += $driver->prepare_form_acp($user); + } + + $display_vars = array( + 'title' => 'ACP_AVATAR_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_AVATAR_SETTINGS', + + 'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), + 'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), + 'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), + 'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), + + 'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + ) + ); + + if (!empty($avatar_vars)) + { + $display_vars['vars'] += $avatar_vars; + } + break; + + case 'message': + $display_vars = array( + 'title' => 'ACP_MESSAGE_SETTINGS', + 'lang' => 'ucp', + 'vars' => array( + 'legend1' => 'GENERAL_SETTINGS', + 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true), + 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), + + 'legend2' => 'GENERAL_OPTIONS', + 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_pm' => array('lang' => 'ALLOW_SIG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + + 'legend3' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'post': + $display_vars = array( + 'title' => 'ACP_POST_SETTINGS', + 'vars' => array( + 'legend1' => 'GENERAL_OPTIONS', + 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allowed_schemes_links' => array('lang' => 'ALLOWED_SCHEMES_LINKS', 'validate' => 'string', 'type' => 'text:0:255', 'explain' => true), + 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), + + 'legend2' => 'POSTING', + 'bump_type' => false, + 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0:9999999999', 'type' => 'number:0:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), + 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), + 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), + 'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), + 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'number:2:127', 'explain' => false), + 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0:999999', 'type' => 'number:0:999999', 'explain' => true), + 'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:1:999999', 'type' => 'number:1:999999', 'explain' => true), + 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'), + 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + + 'legend3' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'signature': + $display_vars = array( + 'title' => 'ACP_SIGNATURE_SETTINGS', + 'vars' => array( + 'legend1' => 'GENERAL_OPTIONS', + 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_bbcode' => array('lang' => 'ALLOW_SIG_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend2' => 'GENERAL_SETTINGS', + 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'), + 'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + + 'legend3' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'registration': + $display_vars = array( + 'title' => 'ACP_REGISTER_SETTINGS', + 'vars' => array( + 'legend1' => 'GENERAL_SETTINGS', + 'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false,), + + 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true), + 'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']), + 'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true), + 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), + 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true), + 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), + 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + + 'legend2' => 'GENERAL_OPTIONS', + 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'enable_confirm' => array('lang' => 'VISUAL_CONFIRM_REG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), + 'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + + 'legend3' => 'COPPA', + 'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true), + 'coppa_fax' => array('lang' => 'COPPA_FAX', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => false), + + 'legend4' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'feed': + $display_vars = array( + 'title' => 'ACP_FEED_MANAGEMENT', + 'vars' => array( + 'legend1' => 'ACP_FEED_GENERAL', + 'feed_enable' => array('lang' => 'ACP_FEED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'feed_http_auth' => array('lang' => 'ACP_FEED_HTTP_AUTH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + + 'legend2' => 'ACP_FEED_POST_BASED', + 'feed_limit_post' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5:9999', 'type' => 'number:5:9999', 'explain' => true), + 'feed_overall' => array('lang' => 'ACP_FEED_OVERALL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + + 'legend3' => 'ACP_FEED_TOPIC_BASED', + 'feed_limit_topic' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5:9999', 'type' => 'number:5:9999', 'explain' => true), + 'feed_topics_new' => array('lang' => 'ACP_FEED_TOPICS_NEW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_topics_active' => array('lang' => 'ACP_FEED_TOPICS_ACTIVE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true), + + 'legend4' => 'ACP_FEED_SETTINGS_OTHER', + 'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true), + ) + ); + break; + + case 'cookie': + $display_vars = array( + 'title' => 'ACP_COOKIE_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_COOKIE_SETTINGS', + 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => true), + 'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => true), + 'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => true), + 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'cookie_notice' => array('lang' => 'COOKIE_NOTICE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + ) + ); + break; + + case 'load': + $display_vars = array( + 'title' => 'ACP_LOAD_SETTINGS', + 'vars' => array( + 'legend1' => 'GENERAL_SETTINGS', + 'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60:9999999999', 'type' => 'number:60:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'read_notification_expire_days' => array('lang' => 'READ_NOTIFICATION_EXPIRE_DAYS', 'validate' => 'int:0', 'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + + 'legend2' => 'GENERAL_OPTIONS', + 'load_notifications' => array('lang' => 'LOAD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_anon_lastread' => array('lang' => 'YES_ANON_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_online' => array('lang' => 'YES_ONLINE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_unreads_search' => array('lang' => 'YES_UNREAD_SEARCH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_user_activity_limit' => array('lang' => 'LOAD_USER_ACTIVITY_LIMIT', 'validate' => 'int:0:99999999', 'type' => 'number:0:99999999', 'explain' => true), + 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_cdn' => array('lang' => 'ALLOW_CDN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'enable_accurate_pm_button' => array('lang' => 'YES_ACCURATE_PM_BUTTON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_live_searches' => array('lang' => 'ALLOW_LIVE_SEARCHES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend3' => 'CUSTOM_PROFILE_FIELDS', + 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + + 'legend4' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'auth': + $display_vars = array( + 'title' => 'ACP_AUTH_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_AUTH_SETTINGS', + 'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select:1:toggable', 'method' => 'select_auth_method', 'explain' => false), + ) + ); + break; + + case 'server': + $display_vars = array( + 'title' => 'ACP_SERVER_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_SERVER_SETTINGS', + 'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'use_system_cron' => array('lang' => 'USE_SYSTEM_CRON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend2' => 'PATH_SETTINGS', + 'enable_mod_rewrite' => array('lang' => 'MOD_REWRITE_ENABLE', 'validate' => 'bool', 'type' => 'custom', 'method' => 'enable_mod_rewrite', 'explain' => true), + 'smilies_path' => array('lang' => 'SMILIES_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), + 'icons_path' => array('lang' => 'ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), + 'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), + 'ranks_path' => array('lang' => 'RANKS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), + + 'legend3' => 'SERVER_URL_SETTINGS', + 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true), + 'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + 'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), + 'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true), + + 'legend4' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'security': + $display_vars = array( + 'title' => 'ACP_SECURITY_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_SECURITY_SETTINGS', + 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_password_reset' => array('lang' => 'ALLOW_PASSWORD_RESET', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), + 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'referer_validation' => array('lang' => 'REFERRER_VALID', 'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), + 'remote_upload_verify' => array('lang' => 'UPLOAD_CERT_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), + 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), + 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), + 'ip_login_limit_max' => array('lang' => 'IP_LOGIN_LIMIT_MAX', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), + 'ip_login_limit_time' => array('lang' => 'IP_LOGIN_LIMIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'ip_login_limit_use_forwarded' => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1:99999', 'type' => 'number:-1:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + ) + ); + break; + + case 'email': + $display_vars = array( + 'title' => 'ACP_EMAIL_SETTINGS', + 'vars' => array( + 'legend1' => 'GENERAL_SETTINGS', + 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'number:0:99999', 'explain' => true), + 'email_max_chunk_size' => array('lang' => 'EMAIL_MAX_CHUNK_SIZE', 'validate' => 'int:1:99999', 'type' => 'number:1:99999', 'explain' => true), + 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), + 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), + 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), + 'email_force_sender' => array('lang' => 'EMAIL_FORCE_SENDER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true), + 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'send_test_email' => array('lang' => 'SEND_TEST_EMAIL', 'validate' => 'bool', 'type' => 'custom', 'method' => 'send_test_email', 'explain' => true), + + 'legend2' => 'SMTP_SETTINGS', + 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), + 'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), + 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), + 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), + 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true), + 'smtp_verify_peer' => array('lang' => 'SMTP_VERIFY_PEER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'smtp_verify_peer_name' => array('lang' => 'SMTP_VERIFY_PEER_NAME', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'smtp_allow_self_signed'=> array('lang' => 'SMTP_ALLOW_SELF_SIGNED','validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend3' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + default: + trigger_error('NO_MODE', E_USER_ERROR); + break; + } + + /** + * Event to add and/or modify acp_board configurations + * + * @event core.acp_board_config_edit_add + * @var array display_vars Array of config values to display and process + * @var string mode Mode of the config page we are displaying + * @var boolean submit Do we display the form or process the submission + * @since 3.1.0-a4 + */ + $vars = array('display_vars', 'mode', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.acp_board_config_edit_add', compact($vars))); + + if (isset($display_vars['lang'])) + { + $user->add_lang($display_vars['lang']); + } + + $this->new_config = clone $config; + $cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => ''), true) : $this->new_config; + $error = array(); + + // We validate the complete config if wished + validate_config_vars($display_vars['vars'], $cfg_array, $error); + + if ($submit && !check_form_key($form_key)) + { + $error[] = $user->lang['FORM_INVALID']; + } + // Do not write values if there is an error + if (count($error)) + { + $submit = false; + } + + // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... + foreach ($display_vars['vars'] as $config_name => $data) + { + if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) + { + continue; + } + + if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') + { + continue; + } + + if ($config_name == 'guest_style') + { + if (isset($cfg_array[$config_name])) + { + $this->guest_style_set($cfg_array[$config_name]); + } + continue; + } + + $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; + + if ($submit) + { + if (isset($data['type']) && strpos($data['type'], 'password') === 0 && $config_value === '********') + { + /** + * Do not update password fields if the content is ********, + * because that is the password replacement we use to not + * send the password to the output + */ + continue; + } + + $config->set($config_name, $config_value); + + if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) + { + enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', round(log(FORUM_FLAG_QUICK_REPLY, 2))); + } + } + } + + // Invalidate the text_formatter cache when posting options are changed + if ($mode == 'post' && $submit) + { + $phpbb_container->get('text_formatter.cache')->invalidate(); + } + + // Store news and exclude ids + if ($mode == 'feed' && $submit) + { + $cache->destroy('_feed_news_forum_ids'); + $cache->destroy('_feed_excluded_forum_ids'); + + $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id'); + $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id'); + } + + if ($mode == 'auth') + { + // Retrieve a list of auth plugins and check their config values + /* @var $auth_providers \phpbb\auth\provider_collection */ + $auth_providers = $phpbb_container->get('auth.provider_collection'); + + $updated_auth_settings = false; + $old_auth_config = array(); + foreach ($auth_providers as $provider) + { + /** @var \phpbb\auth\provider\provider_interface $provider */ + if ($fields = $provider->acp()) + { + // Check if we need to create config fields for this plugin and save config when submit was pressed + foreach ($fields as $field) + { + if (!isset($config[$field])) + { + $config->set($field, ''); + } + + if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false) + { + continue; + } + + if (substr($field, -9) === '_password' && $cfg_array[$field] === '********') + { + // Do not update password fields if the content is ********, + // because that is the password replacement we use to not + // send the password to the output + continue; + } + + $old_auth_config[$field] = $this->new_config[$field]; + $config_value = $cfg_array[$field]; + $this->new_config[$field] = $config_value; + + if ($submit) + { + $updated_auth_settings = true; + $config->set($field, $config_value); + } + } + } + unset($fields); + } + + if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings)) + { + $method = basename($cfg_array['auth_method']); + if (array_key_exists('auth.provider.' . $method, $auth_providers)) + { + $provider = $auth_providers['auth.provider.' . $method]; + if ($error = $provider->init()) + { + foreach ($old_auth_config as $config_name => $config_value) + { + $config->set($config_name, $config_value); + } + trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING); + } + $config->set('auth_method', basename($cfg_array['auth_method'])); + } + else + { + trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR); + } + } + } + + if ($mode == 'email' && $request->is_set_post('send_test_email')) + { + if ($config['email_enable']) + { + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $messenger = new messenger(false); + $messenger->template('test'); + $messenger->set_addresses($user->data); + $messenger->anti_abuse_headers($config, $user); + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($user->data['username']), + )); + $messenger->send(NOTIFY_EMAIL); + + trigger_error($user->lang('TEST_EMAIL_SENT') . adm_back_link($this->u_action)); + } + else + { + $user->add_lang('memberlist'); + trigger_error($user->lang('EMAIL_DISABLED') . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + if ($submit) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode)); + + $message = $user->lang('CONFIG_UPDATED'); + $message_type = E_USER_NOTICE; + if (!$config['email_enable'] && in_array($mode, array('email', 'registration')) && + in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN))) + { + $message .= '

' . $user->lang('ACC_ACTIVATION_WARNING'); + $message_type = E_USER_WARNING; + } + trigger_error($message . adm_back_link($this->u_action), $message_type); + } + + $this->tpl_name = 'acp_board'; + $this->page_title = $display_vars['title']; + + $template->assign_vars(array( + 'L_TITLE' => $user->lang[$display_vars['title']], + 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], + + 'S_ERROR' => (count($error)) ? true : false, + 'ERROR_MSG' => implode('
', $error), + + 'U_ACTION' => $this->u_action) + ); + + // Output relevant page + foreach ($display_vars['vars'] as $config_key => $vars) + { + if (!is_array($vars) && strpos($config_key, 'legend') === false) + { + continue; + } + + if (strpos($config_key, 'legend') !== false) + { + $template->assign_block_vars('options', array( + 'S_LEGEND' => true, + 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars) + ); + + continue; + } + + $type = explode(':', $vars['type']); + + $l_explain = ''; + if ($vars['explain'] && isset($vars['lang_explain'])) + { + $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain']; + } + else if ($vars['explain']) + { + $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : ''; + } + + $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); + + if (empty($content)) + { + continue; + } + + $template->assign_block_vars('options', array( + 'KEY' => $config_key, + 'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'], + 'S_EXPLAIN' => $vars['explain'] && !empty($l_explain), + 'TITLE_EXPLAIN' => $l_explain, + 'CONTENT' => $content, + ) + ); + + unset($display_vars['vars'][$config_key]); + } + + if ($mode == 'auth') + { + $template->assign_var('S_AUTH', true); + + foreach ($auth_providers as $provider) + { + $auth_tpl = $provider->get_acp_template($this->new_config); + if ($auth_tpl) + { + if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl)) + { + foreach ($auth_tpl['BLOCK_VARS'] as $block_vars) + { + $template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars); + } + } + $template->assign_vars($auth_tpl['TEMPLATE_VARS']); + $template->assign_block_vars('auth_tpl', array( + 'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'], + )); + } + } + } + } + + /** + * Select auth method + */ + function select_auth_method($selected_method, $key = '') + { + global $phpbb_container; + + /* @var $auth_providers \phpbb\auth\provider_collection */ + $auth_providers = $phpbb_container->get('auth.provider_collection'); + $auth_plugins = array(); + + foreach ($auth_providers as $key => $value) + { + if (!($value instanceof \phpbb\auth\provider\provider_interface)) + { + continue; + } + $auth_plugins[] = str_replace('auth.provider.', '', $key); + } + + sort($auth_plugins); + + $auth_select = ''; + foreach ($auth_plugins as $method) + { + $selected = ($selected_method == $method) ? ' selected="selected"' : ''; + $auth_select .= "'; + } + + return $auth_select; + } + + /** + * Select mail authentication method + */ + function mail_auth_select($selected_method, $key = '') + { + global $user; + + $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); + $s_smtp_auth_options = ''; + + foreach ($auth_methods as $method) + { + $s_smtp_auth_options .= ''; + } + + return $s_smtp_auth_options; + } + + /** + * Select full folder action + */ + function full_folder_select($value, $key = '') + { + global $user; + + return ''; + } + + /** + * Select ip validation + */ + function select_ip_check($value, $key = '') + { + $radio_ary = array(4 => 'ALL', 3 => 'CLASS_C', 2 => 'CLASS_B', 0 => 'NO_IP_VALIDATION'); + + return h_radio('config[ip_check]', $radio_ary, $value, $key); + } + + /** + * Select referer validation + */ + function select_ref_check($value, $key = '') + { + $radio_ary = array(REFERER_VALIDATE_PATH => 'REF_PATH', REFERER_VALIDATE_HOST => 'REF_HOST', REFERER_VALIDATE_NONE => 'NO_REF_VALIDATION'); + + return h_radio('config[referer_validation]', $radio_ary, $value, $key); + } + + /** + * Select account activation method + */ + function select_acc_activation($selected_value, $value) + { + global $user, $config; + + $act_ary = array( + 'ACC_DISABLE' => array(true, USER_ACTIVATION_DISABLE), + 'ACC_NONE' => array(true, USER_ACTIVATION_NONE), + 'ACC_USER' => array($config['email_enable'], USER_ACTIVATION_SELF), + 'ACC_ADMIN' => array($config['email_enable'], USER_ACTIVATION_ADMIN), + ); + + $act_options = ''; + foreach ($act_ary as $key => $data) + { + list($available, $value) = $data; + $selected = ($selected_value == $value) ? ' selected="selected"' : ''; + $class = (!$available) ? ' class="disabled-option"' : ''; + $act_options .= ''; + } + + return $act_options; + } + + /** + * Maximum/Minimum username length + */ + function username_length($value, $key = '') + { + global $user; + + return ' ' . $user->lang['MIN_CHARS'] . '   ' . $user->lang['MAX_CHARS']; + } + + /** + * Allowed chars in usernames + */ + function select_username_chars($selected_value, $key) + { + global $user; + + $user_char_ary = array('USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII'); + $user_char_options = ''; + foreach ($user_char_ary as $user_type) + { + $selected = ($selected_value == $user_type) ? ' selected="selected"' : ''; + $user_char_options .= ''; + } + + return $user_char_options; + } + + /** + * Minimum password length + */ + function password_length($value, $key) + { + global $user; + + return ' ' . $user->lang['MIN_CHARS']; + } + + /** + * Required chars in passwords + */ + function select_password_chars($selected_value, $key) + { + global $user; + + $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL'); + $pass_char_options = ''; + foreach ($pass_type_ary as $pass_type) + { + $selected = ($selected_value == $pass_type) ? ' selected="selected"' : ''; + $pass_char_options .= ''; + } + + return $pass_char_options; + } + + /** + * Select bump interval + */ + function bump_interval($value, $key) + { + global $user; + + $s_bump_type = ''; + $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); + foreach ($types as $type => $lang) + { + $selected = ($this->new_config['bump_type'] == $type) ? ' selected="selected"' : ''; + $s_bump_type .= ''; + } + + return ' '; + } + + /** + * Board disable option and message + */ + function board_disable($value, $key) + { + $radio_ary = array(1 => 'YES', 0 => 'NO'); + + return h_radio('config[board_disable]', $radio_ary, $value) . '
'; + } + + /** + * Global quick reply enable/disable setting and button to enable in all forums + */ + function quick_reply($value, $key) + { + global $user; + + $radio_ary = array(1 => 'YES', 0 => 'NO'); + + return h_radio('config[allow_quick_reply]', $radio_ary, $value) . + '

'; + } + + /** + * Select guest timezone + */ + function timezone_select($value, $key) + { + global $template, $user; + + $timezone_select = phpbb_timezone_select($template, $user, $value, true); + + return ''; + } + + /** + * Get guest style + */ + public function guest_style_get() + { + global $db; + + $sql = 'SELECT user_style + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . ANONYMOUS; + $result = $db->sql_query($sql); + + $style = (int) $db->sql_fetchfield('user_style'); + $db->sql_freeresult($result); + + return $style; + } + + /** + * Set guest style + * + * @param int $style_id The style ID + */ + public function guest_style_set($style_id) + { + global $db; + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $style_id . ' + WHERE user_id = ' . ANONYMOUS; + $db->sql_query($sql); + } + + /** + * Select default dateformat + */ + function dateformat_select($value, $key) + { + global $user, $config; + + // Let the format_date function operate with the acp values + $old_tz = $user->timezone; + try + { + $user->timezone = new DateTimeZone($config['board_timezone']); + } + catch (\Exception $e) + { + // If the board timezone is invalid, we just use the users timezone. + } + + $dateformat_options = ''; + + foreach ($user->lang['dateformats'] as $format => $null) + { + $dateformat_options .= ''; + } + + $dateformat_options .= ''; + + // Reset users date options + $user->timezone = $old_tz; + + return " + "; + } + + /** + * Select multiple forums + */ + function select_news_forums($value, $key) + { + $forum_list = make_forum_select(false, false, true, true, true, false, true); + + // Build forum options + $s_forum_options = ''; + + return $s_forum_options; + } + + function select_exclude_forums($value, $key) + { + $forum_list = make_forum_select(false, false, true, true, true, false, true); + + // Build forum options + $s_forum_options = ''; + + return $s_forum_options; + } + + function store_feed_forums($option, $key) + { + global $db, $cache, $request; + + // Get key + $values = $request->variable($key, array(0 => 0)); + + // Empty option bit for all forums + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_options = forum_options - ' . (1 << $option) . ' + WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0'); + $db->sql_query($sql); + + // Already emptied for all... + if (count($values)) + { + // Set for selected forums + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_options = forum_options + ' . (1 << $option) . ' + WHERE ' . $db->sql_in_set('forum_id', $values); + $db->sql_query($sql); + } + + // Empty sql cache for forums table because options changed + $cache->destroy('sql', FORUMS_TABLE); + } + + /** + * Option to enable/disable removal of 'app.php' from URLs + * + * Note that if mod_rewrite is on, URLs without app.php will still work, + * but any paths generated by the controller helper url() method will not + * contain app.php. + * + * @param int $value The current config value + * @param string $key The config key + * @return string The HTML for the form field + */ + function enable_mod_rewrite($value, $key) + { + global $user; + + // Determine whether mod_rewrite is enabled on the server + // NOTE: This only works on Apache servers on which PHP is NOT + // installed as CGI. In that case, there is no way for PHP to + // determine whether or not the Apache module is enabled. + // + // To be clear on the value of $mod_rewite: + // null = Cannot determine whether or not the server has mod_rewrite + // enabled + // false = Can determine that the server does NOT have mod_rewrite + // enabled + // true = Can determine that the server DOES have mod_rewrite_enabled + $mod_rewrite = null; + if (function_exists('apache_get_modules')) + { + $mod_rewrite = (bool) in_array('mod_rewrite', apache_get_modules()); + } + + // If $message is false, mod_rewrite is enabled. + // Otherwise, it is not and we need to: + // 1) disable the form field + // 2) make sure the config value is set to 0 + // 3) append the message to the return + $value = ($mod_rewrite === false) ? 0 : $value; + $message = $mod_rewrite === null ? 'MOD_REWRITE_INFORMATION_UNAVAILABLE' : ($mod_rewrite === false ? 'MOD_REWRITE_DISABLED' : false); + + // Let's do some friendly HTML injection if we want to disable the + // form field because h_radio() has no pretty way of doing so + $field_name = 'config[enable_mod_rewrite]' . ($message === 'MOD_REWRITE_DISABLED' ? '" disabled="disabled' : ''); + + return h_radio($field_name, array(1 => 'YES', 0 => 'NO'), $value) . + ($message !== false ? '
' . $user->lang($message) . '' : ''); + } + + function send_test_email($value, $key) + { + global $user; + + return ''; + } +} diff --git a/install/update/new/includes/acp/acp_database.php b/install/update/new/includes/acp/acp_database.php new file mode 100644 index 0000000..c1c7488 --- /dev/null +++ b/install/update/new/includes/acp/acp_database.php @@ -0,0 +1,616 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_database +{ + var $db_tools; + var $u_action; + public $page_title; + + function main($id, $mode) + { + global $cache, $db, $user, $template, $table_prefix, $request; + global $phpbb_root_path, $phpbb_container, $phpbb_log; + + $this->db_tools = $phpbb_container->get('dbal.tools'); + + $user->add_lang('acp/database'); + + $this->tpl_name = 'acp_database'; + $this->page_title = 'ACP_DATABASE'; + + $action = $request->variable('action', ''); + + $form_key = 'acp_database'; + add_form_key($form_key); + + $template->assign_vars(array( + 'MODE' => $mode + )); + + switch ($mode) + { + case 'backup': + + $this->page_title = 'ACP_BACKUP'; + + switch ($action) + { + case 'download': + $type = $request->variable('type', ''); + $table = array_intersect($this->db_tools->sql_list_tables(), $request->variable('table', array(''))); + $format = $request->variable('method', ''); + + if (!count($table)) + { + trigger_error($user->lang['TABLE_SELECT_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (!check_form_key($form_key)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $store = true; + $structure = false; + $schema_data = false; + + if ($type == 'full' || $type == 'structure') + { + $structure = true; + } + + if ($type == 'full' || $type == 'data') + { + $schema_data = true; + } + + @set_time_limit(1200); + @set_time_limit(0); + + $time = time(); + + $filename = 'backup_' . $time . '_' . unique_id(); + + /** @var phpbb\db\extractor\extractor_interface $extractor Database extractor */ + $extractor = $phpbb_container->get('dbal.extractor'); + $extractor->init_extractor($format, $filename, $time, false, $store); + + $extractor->write_start($table_prefix); + + foreach ($table as $table_name) + { + // Get the table structure + if ($structure) + { + $extractor->write_table($table_name); + } + else + { + // We might wanna empty out all that junk :D + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $extractor->flush('DELETE FROM ' . $table_name . ";\n"); + break; + + case 'mssql_odbc': + case 'mssqlnative': + $extractor->flush('TRUNCATE TABLE ' . $table_name . "GO\n"); + break; + + case 'oracle': + $extractor->flush('TRUNCATE TABLE ' . $table_name . "/\n"); + break; + + default: + $extractor->flush('TRUNCATE TABLE ' . $table_name . ";\n"); + break; + } + } + + // Data + if ($schema_data) + { + $extractor->write_data($table_name); + } + } + + $extractor->write_end(); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_BACKUP'); + + trigger_error($user->lang['BACKUP_SUCCESS'] . adm_back_link($this->u_action)); + break; + + default: + $tables = $this->db_tools->sql_list_tables(); + asort($tables); + foreach ($tables as $table_name) + { + if (strlen($table_prefix) === 0 || stripos($table_name, $table_prefix) === 0) + { + $template->assign_block_vars('tables', array( + 'TABLE' => $table_name + )); + } + } + unset($tables); + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action . '&action=download' + )); + + $available_methods = array('gzip' => 'zlib', 'bzip2' => 'bz2'); + + foreach ($available_methods as $type => $module) + { + if (!@extension_loaded($module)) + { + continue; + } + + $template->assign_block_vars('methods', array( + 'TYPE' => $type + )); + } + + $template->assign_block_vars('methods', array( + 'TYPE' => 'text' + )); + break; + } + break; + + case 'restore': + + $this->page_title = 'ACP_RESTORE'; + + switch ($action) + { + case 'submit': + $delete = $request->variable('delete', ''); + $file = $request->variable('file', ''); + + $backup_info = $this->get_backup_file($phpbb_root_path . 'store/', $file); + + if (empty($backup_info) || !is_readable($backup_info['file_name'])) + { + trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if ($delete) + { + if (confirm_box(true)) + { + unlink($backup_info['file_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_DELETE'); + trigger_error($user->lang['BACKUP_DELETE'] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['DELETE_SELECTED_BACKUP'], build_hidden_fields(array('delete' => $delete, 'file' => $file))); + } + } + else if (confirm_box(true)) + { + switch ($backup_info['extension']) + { + case 'sql': + $fp = fopen($backup_info['file_name'], 'rb'); + $read = 'fread'; + $seek = 'fseek'; + $eof = 'feof'; + $close = 'fclose'; + $fgetd = 'fgetd'; + break; + + case 'sql.bz2': + $fp = bzopen($backup_info['file_name'], 'r'); + $read = 'bzread'; + $seek = ''; + $eof = 'feof'; + $close = 'bzclose'; + $fgetd = 'fgetd_seekless'; + break; + + case 'sql.gz': + $fp = gzopen($backup_info['file_name'], 'rb'); + $read = 'gzread'; + $seek = 'gzseek'; + $eof = 'gzeof'; + $close = 'gzclose'; + $fgetd = 'fgetd'; + break; + + default: + trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + return; + } + + switch ($db->get_sql_layer()) + { + case 'mysqli': + case 'sqlite3': + while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false) + { + $db->sql_query($sql); + } + break; + + case 'postgres': + $delim = ";\n"; + while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false) + { + $query = trim($sql); + + if (substr($query, 0, 13) == 'CREATE DOMAIN') + { + list(, , $domain) = explode(' ', $query); + $sql = "SELECT domain_name + FROM information_schema.domains + WHERE domain_name = '$domain';"; + $result = $db->sql_query($sql); + if (!$db->sql_fetchrow($result)) + { + $db->sql_query($query); + } + $db->sql_freeresult($result); + } + else + { + $db->sql_query($query); + } + + if (substr($query, 0, 4) == 'COPY') + { + while (($sub = $fgetd($fp, "\n", $read, $seek, $eof)) !== '\.') + { + if ($sub === false) + { + trigger_error($user->lang['RESTORE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + pg_put_line($db->get_db_connect_id(), $sub . "\n"); + } + pg_put_line($db->get_db_connect_id(), "\\.\n"); + pg_end_copy($db->get_db_connect_id()); + } + } + break; + + case 'oracle': + while (($sql = $fgetd($fp, "/\n", $read, $seek, $eof)) !== false) + { + $db->sql_query($sql); + } + break; + + case 'mssql_odbc': + case 'mssqlnative': + while (($sql = $fgetd($fp, "GO\n", $read, $seek, $eof)) !== false) + { + $db->sql_query($sql); + } + break; + } + + $close($fp); + + // Purge the cache due to updated data + $cache->purge(); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_RESTORE'); + trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action)); + break; + } + else + { + confirm_box(false, $user->lang['RESTORE_SELECTED_BACKUP'], build_hidden_fields(array('file' => $file))); + } + + default: + $backup_files = $this->get_file_list($phpbb_root_path . 'store/'); + + if (!empty($backup_files)) + { + krsort($backup_files); + + foreach ($backup_files as $name => $file) + { + $template->assign_block_vars('files', array( + 'FILE' => sha1($file), + 'NAME' => $user->format_date($name, 'd-m-Y H:i', true), + 'SUPPORTED' => true, + )); + } + } + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action . '&action=submit' + )); + break; + } + break; + } + } + + /** + * Get backup file from file hash + * + * @param string $directory Relative path to directory + * @param string $file_hash Hash of selected file + * + * @return array Backup file data or empty array if unable to find file + */ + protected function get_backup_file($directory, $file_hash) + { + $backup_data = []; + + $file_list = $this->get_file_list($directory); + $supported_extensions = $this->get_supported_extensions(); + + foreach ($file_list as $file) + { + preg_match('#^backup_(\d{10,})_(?:[a-z\d]{16}|[a-z\d]{32})\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches); + if (sha1($file) === $file_hash && in_array($matches[2], $supported_extensions)) + { + $backup_data = [ + 'file_name' => $directory . $file, + 'extension' => $matches[2], + ]; + break; + } + } + + return $backup_data; + } + + /** + * Get backup file list for directory + * + * @param string $directory Relative path to backup directory + * + * @return array List of backup files in specified directory + */ + protected function get_file_list($directory) + { + $supported_extensions = $this->get_supported_extensions(); + + $dh = @opendir($directory); + + $backup_files = []; + + if ($dh) + { + while (($file = readdir($dh)) !== false) + { + if (preg_match('#^backup_(\d{10,})_(?:[a-z\d]{16}|[a-z\d]{32})\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches)) + { + if (in_array($matches[2], $supported_extensions)) + { + $backup_files[(int) $matches[1]] = $file; + } + } + } + closedir($dh); + } + + return $backup_files; + } + + /** + * Get supported extensions for backup + * + * @return array List of supported extensions + */ + protected function get_supported_extensions() + { + $extensions = ['sql']; + $available_methods = ['sql.gz' => 'zlib', 'sql.bz2' => 'bz2']; + + foreach ($available_methods as $type => $module) + { + if (!@extension_loaded($module)) + { + continue; + } + $extensions[] = $type; + } + + return $extensions; + } +} + +// get how much space we allow for a chunk of data, very similar to phpMyAdmin's way of doing things ;-) (hey, we only do this for MySQL anyway :P) +function get_usable_memory() +{ + $val = trim(@ini_get('memory_limit')); + + if (preg_match('/(\\d+)([mkg]?)/i', $val, $regs)) + { + $memory_limit = (int) $regs[1]; + switch ($regs[2]) + { + + case 'k': + case 'K': + $memory_limit *= 1024; + break; + + case 'm': + case 'M': + $memory_limit *= 1048576; + break; + + case 'g': + case 'G': + $memory_limit *= 1073741824; + break; + } + + // how much memory PHP requires at the start of export (it is really a little less) + if ($memory_limit > 6100000) + { + $memory_limit -= 6100000; + } + + // allow us to consume half of the total memory available + $memory_limit /= 2; + } + else + { + // set the buffer to 1M if we have no clue how much memory PHP will give us :P + $memory_limit = 1048576; + } + + return $memory_limit; +} + +function sanitize_data_mssql($text) +{ + $data = preg_split('/[\n\t\r\b\f]/', $text); + preg_match_all('/[\n\t\r\b\f]/', $text, $matches); + + $val = array(); + + foreach ($data as $value) + { + if (strlen($value)) + { + $val[] = "'" . $value . "'"; + } + if (count($matches[0])) + { + $val[] = 'char(' . ord(array_shift($matches[0])) . ')'; + } + } + + return implode('+', $val); +} + +function sanitize_data_oracle($text) +{ +// $data = preg_split('/[\0\n\t\r\b\f\'"\/\\\]/', $text); +// preg_match_all('/[\0\n\t\r\b\f\'"\/\\\]/', $text, $matches); + $data = preg_split('/[\0\b\f\'\/]/', $text); + preg_match_all('/[\0\r\b\f\'\/]/', $text, $matches); + + $val = array(); + + foreach ($data as $value) + { + if (strlen($value)) + { + $val[] = "'" . $value . "'"; + } + if (count($matches[0])) + { + $val[] = 'chr(' . ord(array_shift($matches[0])) . ')'; + } + } + + return implode('||', $val); +} + +function sanitize_data_generic($text) +{ + $data = preg_split('/[\n\t\r\b\f]/', $text); + preg_match_all('/[\n\t\r\b\f]/', $text, $matches); + + $val = array(); + + foreach ($data as $value) + { + if (strlen($value)) + { + $val[] = "'" . $value . "'"; + } + if (count($matches[0])) + { + $val[] = "'" . array_shift($matches[0]) . "'"; + } + } + + return implode('||', $val); +} + +// modified from PHP.net +function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192) +{ + $record = ''; + $delim_len = strlen($delim); + + while (!$eof($fp)) + { + $pos = strpos($record, $delim); + if ($pos === false) + { + $record .= $read($fp, $buffer); + if ($eof($fp) && ($pos = strpos($record, $delim)) !== false) + { + $seek($fp, $pos + $delim_len - strlen($record), SEEK_CUR); + return substr($record, 0, $pos); + } + } + else + { + $seek($fp, $pos + $delim_len - strlen($record), SEEK_CUR); + return substr($record, 0, $pos); + } + } + + return false; +} + +function fgetd_seekless(&$fp, $delim, $read, $seek, $eof, $buffer = 8192) +{ + static $array = array(); + static $record = ''; + + if (!count($array)) + { + while (!$eof($fp)) + { + if (strpos($record, $delim) !== false) + { + $array = explode($delim, $record); + $record = array_pop($array); + break; + } + else + { + $record .= $read($fp, $buffer); + } + } + if ($eof($fp) && strpos($record, $delim) !== false) + { + $array = explode($delim, $record); + $record = array_pop($array); + } + } + + if (count($array)) + { + return array_shift($array); + } + + return false; +} diff --git a/install/update/new/includes/acp/acp_extensions.php b/install/update/new/includes/acp/acp_extensions.php new file mode 100644 index 0000000..8696654 --- /dev/null +++ b/install/update/new/includes/acp/acp_extensions.php @@ -0,0 +1,771 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use phpbb\exception\exception_interface; +use phpbb\exception\version_check_exception; + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_extensions +{ + var $u_action; + var $tpl_name; + var $page_title; + + private $config; + private $template; + private $user; + private $log; + private $request; + private $phpbb_dispatcher; + private $ext_manager; + private $phpbb_container; + private $php_ini; + + function main($id, $mode) + { + // Start the page + global $config, $user, $template, $request, $phpbb_extension_manager, $phpbb_root_path, $phpbb_log, $phpbb_dispatcher, $phpbb_container; + + $this->config = $config; + $this->template = $template; + $this->user = $user; + $this->request = $request; + $this->log = $phpbb_log; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->ext_manager = $phpbb_extension_manager; + $this->phpbb_container = $phpbb_container; + $this->php_ini = $this->phpbb_container->get('php_ini'); + + $this->user->add_lang(array('install', 'acp/extensions', 'migrator')); + + $this->page_title = 'ACP_EXTENSIONS'; + + $action = $this->request->variable('action', 'list'); + $ext_name = $this->request->variable('ext_name', ''); + + // What is a safe limit of execution time? Half the max execution time should be safe. + $safe_time_limit = ($this->php_ini->getNumeric('max_execution_time') / 2); + $start_time = time(); + + // Cancel action + if ($this->request->is_set_post('cancel')) + { + $action = 'list'; + $ext_name = ''; + } + + if (in_array($action, array('enable', 'disable', 'delete_data')) && !check_link_hash($this->request->variable('hash', ''), $action . '.' . $ext_name)) + { + trigger_error('FORM_INVALID', E_USER_WARNING); + } + + /** + * Event to run a specific action on extension + * + * @event core.acp_extensions_run_action_before + * @var string action Action to run; if the event completes execution of the action, should be set to 'none' + * @var string u_action Url we are at + * @var string ext_name Extension name from request + * @var int safe_time_limit Safe limit of execution time + * @var int start_time Start time + * @var string tpl_name Template file to load + * @since 3.1.11-RC1 + * @changed 3.2.1-RC1 Renamed to core.acp_extensions_run_action_before, added tpl_name, added action 'none' + */ + $u_action = $this->u_action; + $tpl_name = ''; + $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time', 'tpl_name'); + extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action_before', compact($vars))); + + // In case they have been updated by the event + $this->u_action = $u_action; + $this->tpl_name = $tpl_name; + + // If they've specified an extension, let's load the metadata manager and validate it. + if ($ext_name) + { + $md_manager = $this->ext_manager->create_extension_metadata_manager($ext_name); + + try + { + $md_manager->get_metadata('all'); + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + // What are we doing? + switch ($action) + { + case 'none': + // Intentionally empty, used by extensions that execute additional actions in the prior event + break; + + case 'set_config_version_check_force_unstable': + $force_unstable = $this->request->variable('force_unstable', false); + + if ($force_unstable) + { + $s_hidden_fields = build_hidden_fields(array( + 'force_unstable' => $force_unstable, + )); + + confirm_box(false, $this->user->lang('EXTENSION_FORCE_UNSTABLE_CONFIRM'), $s_hidden_fields); + } + else + { + $this->config->set('extension_force_unstable', false); + trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + } + break; + + case 'list': + default: + if (confirm_box(true)) + { + $this->config->set('extension_force_unstable', true); + trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + } + + $this->list_enabled_exts(); + $this->list_disabled_exts(); + $this->list_available_exts(); + + $this->template->assign_vars(array( + 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=list&versioncheck_force=1', + 'FORCE_UNSTABLE' => $this->config['extension_force_unstable'], + 'U_ACTION' => $this->u_action, + )); + + $this->tpl_name = 'acp_ext_list'; + break; + + case 'enable_pre': + try + { + $md_manager->validate_enable(); + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); + } + + $extension = $this->ext_manager->get_extension($ext_name); + + $this->check_is_enableable($extension); + + if ($this->ext_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + + if (confirm_box(true)) + { + redirect($this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name)); + } + else + { + confirm_box(false, $this->user->lang('EXTENSION_ENABLE_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'action' => 'enable_pre', + 'ext_name' => $ext_name, + ))); + } + break; + + case 'enable': + try + { + $md_manager->validate_enable(); + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); + } + + $extension = $this->ext_manager->get_extension($ext_name); + + $this->check_is_enableable($extension); + + try + { + while ($this->ext_manager->enable_step($ext_name)) + { + // Are we approaching the time limit? If so we want to pause the update and continue after refreshing + if ((time() - $start_time) >= $safe_time_limit) + { + meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name)); + trigger_error('EXTENSION_ENABLE_IN_PROGRESS', E_USER_NOTICE); + } + } + + // Update custom style for admin area + $this->template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), + ), array($phpbb_root_path . 'adm/style')); + + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_ENABLE', time(), array($ext_name)); + } + catch (\phpbb\db\migration\exception $e) + { + trigger_error($this->user->lang('MIGRATION_EXCEPTION_ERROR', $e->getLocalisedMessage($this->user)), E_USER_WARNING); + } + + if ($this->request->is_ajax()) + { + $actions = $this->output_actions('enabled', [ + 'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($ext_name), + ]); + + $data = [ + 'EXT_ENABLE_SUCCESS' => true, + 'ACTIONS' => $actions, + 'REFRESH_DATA' => [ + 'url' => '', + 'time' => 0, + ], + ]; + + $json_response = new \phpbb\json_response; + $json_response->send($data); + } + + trigger_error($this->user->lang('EXTENSION_ENABLE_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE); + break; + + case 'disable_pre': + if (!$this->ext_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + + if (confirm_box(true)) + { + redirect($this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name)); + } + else + { + confirm_box(false, $this->user->lang('EXTENSION_DISABLE_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'action' => 'disable_pre', + 'ext_name' => $ext_name, + ))); + } + break; + + case 'disable': + if (!$this->ext_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + + while ($this->ext_manager->disable_step($ext_name)) + { + // Are we approaching the time limit? If so we want to pause the update and continue after refreshing + if ((time() - $start_time) >= $safe_time_limit) + { + $this->template->assign_var('S_NEXT_STEP', true); + + meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name)); + trigger_error('EXTENSION_DISABLE_IN_PROGRESS', E_USER_NOTICE); + } + } + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_DISABLE', time(), array($ext_name)); + + if ($this->request->is_ajax()) + { + $actions = $this->output_actions('disabled', [ + 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($ext_name), + 'DELETE_DATA' => $this->u_action . '&action=delete_data_pre&ext_name=' . urlencode($ext_name), + ]); + + $data = [ + 'EXT_DISABLE_SUCCESS' => true, + 'ACTIONS' => $actions, + 'REFRESH_DATA' => [ + 'url' => '', + 'time' => 0, + ], + ]; + + $json_response = new \phpbb\json_response; + $json_response->send($data); + } + + trigger_error($this->user->lang('EXTENSION_DISABLE_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE); + break; + + case 'delete_data_pre': + if ($this->ext_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + + if (confirm_box(true)) + { + redirect($this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name)); + } + else + { + confirm_box(false, $this->user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')), build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'action' => 'delete_data_pre', + 'ext_name' => $ext_name, + ))); + } + break; + + case 'delete_data': + if ($this->ext_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + + try + { + while ($this->ext_manager->purge_step($ext_name)) + { + // Are we approaching the time limit? If so we want to pause the update and continue after refreshing + if ((time() - $start_time) >= $safe_time_limit) + { + $this->template->assign_var('S_NEXT_STEP', true); + + meta_refresh(0, $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name)); + trigger_error('EXTENSION_DELETE_DATA_IN_PROGRESS', E_USER_NOTICE); + } + } + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_PURGE', time(), array($ext_name)); + } + catch (\phpbb\db\migration\exception $e) + { + trigger_error($this->user->lang('MIGRATION_EXCEPTION_ERROR', $e->getLocalisedMessage($this->user)), E_USER_WARNING); + } + + if ($this->request->is_ajax()) + { + $actions = $this->output_actions('disabled', [ + 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($ext_name), + ]); + + $data = [ + 'EXT_DELETE_DATA_SUCCESS' => true, + 'ACTIONS' => $actions, + 'REFRESH_DATA' => [ + 'url' => '', + 'time' => 0, + ], + ]; + + $json_response = new \phpbb\json_response; + $json_response->send($data); + } + + trigger_error($this->user->lang('EXTENSION_DELETE_DATA_SUCCESS') . adm_back_link($this->u_action), E_USER_NOTICE); + break; + + case 'details': + // Output it to the template + $meta = $md_manager->get_metadata('all'); + $this->output_metadata_to_template($meta); + + if (isset($meta['extra']['version-check'])) + { + try + { + $updates_available = $this->ext_manager->version_check($md_manager, $this->request->variable('versioncheck_force', false), false, $this->config['extension_force_unstable'] ? 'unstable' : null); + + $this->template->assign_vars(array( + 'S_UP_TO_DATE' => empty($updates_available), + 'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')), + )); + + $this->template->assign_block_vars('updates_available', $updates_available); + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + + $this->template->assign_vars(array( + 'S_VERSIONCHECK_FAIL' => true, + 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '', + )); + } + $this->template->assign_var('S_VERSIONCHECK', true); + } + else + { + $this->template->assign_var('S_VERSIONCHECK', false); + } + + $this->template->assign_vars(array( + 'U_BACK' => $this->u_action . '&action=list', + 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')), + )); + + $this->tpl_name = 'acp_ext_details'; + break; + } + + /** + * Event to run after a specific action on extension has completed + * + * @event core.acp_extensions_run_action_after + * @var string action Action that has run + * @var string u_action Url we are at + * @var string ext_name Extension name from request + * @var int safe_time_limit Safe limit of execution time + * @var int start_time Start time + * @var string tpl_name Template file to load + * @since 3.1.11-RC1 + */ + $u_action = $this->u_action; + $tpl_name = $this->tpl_name; + $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time', 'tpl_name'); + extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action_after', compact($vars))); + + // In case they have been updated by the event + $this->u_action = $u_action; + $this->tpl_name = $tpl_name; + } + + /** + * Lists all the enabled extensions and dumps to the template + * + * @return null + */ + public function list_enabled_exts() + { + $enabled_extension_meta_data = array(); + + foreach ($this->ext_manager->all_enabled() as $name => $location) + { + $md_manager = $this->ext_manager->create_extension_metadata_manager($name); + + try + { + $meta = $md_manager->get_metadata('all'); + $enabled_extension_meta_data[$name] = array( + 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), + 'META_VERSION' => $meta['version'], + ); + + if (isset($meta['extra']['version-check'])) + { + try + { + $force_update = $this->request->variable('versioncheck_force', false); + $updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update); + + $enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); + $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; + $enabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); + } + catch (exception_interface $e) + { + // Ignore exceptions due to the version check + } + } + else + { + $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->template->assign_block_vars('disabled', array( + 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $message), + 'S_VERSIONCHECK' => false, + )); + } + catch (\RuntimeException $e) + { + $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + + uasort($enabled_extension_meta_data, array($this, 'sort_extension_meta_data_table')); + + foreach ($enabled_extension_meta_data as $name => $block_vars) + { + $block_vars['NAME'] = $name; + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('enabled', $block_vars); + + $this->output_actions('enabled', array( + 'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($name), + )); + } + } + + /** + * Lists all the disabled extensions and dumps to the template + * + * @return null + */ + public function list_disabled_exts() + { + $disabled_extension_meta_data = array(); + + foreach ($this->ext_manager->all_disabled() as $name => $location) + { + $md_manager = $this->ext_manager->create_extension_metadata_manager($name); + + try + { + $meta = $md_manager->get_metadata('all'); + $disabled_extension_meta_data[$name] = array( + 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), + 'META_VERSION' => $meta['version'], + ); + + if (isset($meta['extra']['version-check'])) + { + $force_update = $this->request->variable('versioncheck_force', false); + $updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update); + + $disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); + $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; + $disabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); + } + else + { + $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + catch (version_check_exception $e) + { + $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->template->assign_block_vars('disabled', array( + 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $message), + 'S_VERSIONCHECK' => false, + )); + } + catch (\RuntimeException $e) + { + $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + + uasort($disabled_extension_meta_data, array($this, 'sort_extension_meta_data_table')); + + foreach ($disabled_extension_meta_data as $name => $block_vars) + { + $block_vars['NAME'] = $name; + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('disabled', $block_vars); + + $this->output_actions('disabled', array( + 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), + 'DELETE_DATA' => $this->u_action . '&action=delete_data_pre&ext_name=' . urlencode($name), + )); + } + } + + /** + * Lists all the available extensions and dumps to the template + * + * @return null + */ + public function list_available_exts() + { + $uninstalled = array_diff_key($this->ext_manager->all_available(), $this->ext_manager->all_configured()); + + $available_extension_meta_data = array(); + + foreach ($uninstalled as $name => $location) + { + $md_manager = $this->ext_manager->create_extension_metadata_manager($name); + + try + { + $meta = $md_manager->get_metadata('all'); + $available_extension_meta_data[$name] = array( + 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), + 'META_VERSION' => $meta['version'], + ); + + if (isset($meta['extra']['version-check'])) + { + $force_update = $this->request->variable('versioncheck_force', false); + $updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update); + + $available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); + $available_extension_meta_data[$name]['S_VERSIONCHECK'] = true; + $available_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); + } + else + { + $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + catch (version_check_exception $e) + { + $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->template->assign_block_vars('disabled', array( + 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $message), + 'S_VERSIONCHECK' => false, + )); + } + } + + uasort($available_extension_meta_data, array($this, 'sort_extension_meta_data_table')); + + foreach ($available_extension_meta_data as $name => $block_vars) + { + $block_vars['NAME'] = $name; + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('disabled', $block_vars); + + $this->output_actions('disabled', array( + 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), + )); + } + } + + /** + * Output actions to a block + * + * @param string $block + * @param array $actions + * @return array List of actions to be performed on the extension + */ + private function output_actions($block, $actions) + { + $vars_ary = array(); + foreach ($actions as $lang => $options) + { + $url = $options; + if (is_array($options)) + { + $url = $options['url']; + } + + $vars = array( + 'L_ACTION' => $this->user->lang('EXTENSION_' . $lang), + 'L_ACTION_EXPLAIN' => (isset($this->user->lang['EXTENSION_' . $lang . '_EXPLAIN'])) ? $this->user->lang('EXTENSION_' . $lang . '_EXPLAIN') : '', + 'U_ACTION' => $url, + 'ACTION_AJAX' => 'ext_' . strtolower($lang), + ); + + if (isset($options['color'])) + { + $vars['COLOR'] = $options['color']; + } + + $this->template->assign_block_vars($block . '.actions', $vars); + + $vars_ary[] = $vars; + } + + return $vars_ary; + } + + /** + * Sort helper for the table containing the metadata about the extensions. + */ + protected function sort_extension_meta_data_table($val1, $val2) + { + return strnatcasecmp($val1['META_DISPLAY_NAME'], $val2['META_DISPLAY_NAME']); + } + + /** + * Outputs extension metadata into the template + * + * @param array $metadata Array with all metadata for the extension + * @return null + */ + public function output_metadata_to_template($metadata) + { + $this->template->assign_vars(array( + 'META_NAME' => $metadata['name'], + 'META_TYPE' => $metadata['type'], + 'META_DESCRIPTION' => (isset($metadata['description'])) ? $metadata['description'] : '', + 'META_HOMEPAGE' => (isset($metadata['homepage'])) ? $metadata['homepage'] : '', + 'META_VERSION' => $metadata['version'], + 'META_TIME' => (isset($metadata['time'])) ? $metadata['time'] : '', + 'META_LICENSE' => $metadata['license'], + + 'META_REQUIRE_PHP' => (isset($metadata['require']['php'])) ? $metadata['require']['php'] : '', + 'META_REQUIRE_PHP_FAIL' => (isset($metadata['require']['php'])) ? false : true, + + 'META_REQUIRE_PHPBB' => (isset($metadata['extra']['soft-require']['phpbb/phpbb'])) ? $metadata['extra']['soft-require']['phpbb/phpbb'] : '', + 'META_REQUIRE_PHPBB_FAIL' => (isset($metadata['extra']['soft-require']['phpbb/phpbb'])) ? false : true, + + 'META_DISPLAY_NAME' => (isset($metadata['extra']['display-name'])) ? $metadata['extra']['display-name'] : '', + )); + + foreach ($metadata['authors'] as $author) + { + $this->template->assign_block_vars('meta_authors', array( + 'AUTHOR_NAME' => $author['name'], + 'AUTHOR_EMAIL' => (isset($author['email'])) ? $author['email'] : '', + 'AUTHOR_HOMEPAGE' => (isset($author['homepage'])) ? $author['homepage'] : '', + 'AUTHOR_ROLE' => (isset($author['role'])) ? $author['role'] : '', + )); + } + } + + /** + * Checks whether the extension can be enabled. Triggers error if not. + * Error message can be set by the extension. + * + * @param \phpbb\extension\extension_interface $extension Extension to check + */ + protected function check_is_enableable(\phpbb\extension\extension_interface $extension) + { + $message = $extension->is_enableable(); + if ($message !== true) + { + if (empty($message)) + { + $message = $this->user->lang('EXTENSION_NOT_ENABLEABLE'); + } + else if (is_array($message)) + { + $message = implode('
', $message); + } + + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); + } + } +} diff --git a/install/update/new/includes/acp/acp_forums.php b/install/update/new/includes/acp/acp_forums.php new file mode 100644 index 0000000..ba3901f --- /dev/null +++ b/install/update/new/includes/acp/acp_forums.php @@ -0,0 +1,2211 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_forums +{ + var $u_action; + var $parent_id = 0; + + function main($id, $mode) + { + global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; + global $phpbb_admin_path, $phpbb_root_path, $phpEx, $phpbb_log; + + $user->add_lang('acp/forums'); + $this->tpl_name = 'acp_forums'; + $this->page_title = 'ACP_MANAGE_FORUMS'; + + $form_key = 'acp_forums'; + add_form_key($form_key); + + $action = $request->variable('action', ''); + $update = (isset($_POST['update'])) ? true : false; + $forum_id = $request->variable('f', 0); + + $this->parent_id = $request->variable('parent_id', 0); + $forum_data = $errors = array(); + if ($update && !check_form_key($form_key)) + { + $update = false; + $errors[] = $user->lang['FORM_INVALID']; + } + + // Check additional permissions + switch ($action) + { + case 'progress_bar': + $start = $request->variable('start', 0); + $total = $request->variable('total', 0); + + $this->display_progress_bar($start, $total); + break; + + case 'delete': + + if (!$auth->acl_get('a_forumdel')) + { + trigger_error($user->lang['NO_PERMISSION_FORUM_DELETE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + break; + + case 'add': + + if (!$auth->acl_get('a_forumadd')) + { + trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + break; + } + + // Major routines + if ($update) + { + switch ($action) + { + case 'delete': + $action_subforums = $request->variable('action_subforums', ''); + $subforums_to_id = $request->variable('subforums_to_id', 0); + $action_posts = $request->variable('action_posts', ''); + $posts_to_id = $request->variable('posts_to_id', 0); + + $errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id); + + if (count($errors)) + { + break; + } + + $auth->acl_clear_prefetch(); + $cache->destroy('sql', FORUMS_TABLE); + + trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + + break; + + case 'edit': + $forum_data = array( + 'forum_id' => $forum_id + ); + + // No break here + + case 'add': + + $forum_data += array( + 'parent_id' => $request->variable('forum_parent_id', $this->parent_id), + 'forum_type' => $request->variable('forum_type', FORUM_POST), + 'type_action' => $request->variable('type_action', ''), + 'forum_status' => $request->variable('forum_status', ITEM_UNLOCKED), + 'forum_parents' => '', + 'forum_name' => $request->variable('forum_name', '', true), + 'forum_link' => $request->variable('forum_link', ''), + 'forum_link_track' => $request->variable('forum_link_track', false), + 'forum_desc' => $request->variable('forum_desc', '', true), + 'forum_desc_uid' => '', + 'forum_desc_options' => 7, + 'forum_desc_bitfield' => '', + 'forum_rules' => $request->variable('forum_rules', '', true), + 'forum_rules_uid' => '', + 'forum_rules_options' => 7, + 'forum_rules_bitfield' => '', + 'forum_rules_link' => $request->variable('forum_rules_link', ''), + 'forum_image' => $request->variable('forum_image', ''), + 'forum_style' => $request->variable('forum_style', 0), + 'display_subforum_list' => $request->variable('display_subforum_list', true), + 'display_subforum_limit'=> $request->variable('display_subforum_limit', false), + 'display_on_index' => $request->variable('display_on_index', true), + 'forum_topics_per_page' => $request->variable('topics_per_page', 0), + 'enable_indexing' => $request->variable('enable_indexing', true), + 'enable_icons' => $request->variable('enable_icons', true), + 'enable_prune' => $request->variable('enable_prune', false), + 'enable_post_review' => $request->variable('enable_post_review', true), + 'enable_quick_reply' => $request->variable('enable_quick_reply', false), + 'enable_shadow_prune' => $request->variable('enable_shadow_prune', false), + 'prune_days' => $request->variable('prune_days', 7), + 'prune_viewed' => $request->variable('prune_viewed', 7), + 'prune_freq' => $request->variable('prune_freq', 1), + 'prune_old_polls' => $request->variable('prune_old_polls', false), + 'prune_announce' => $request->variable('prune_announce', false), + 'prune_sticky' => $request->variable('prune_sticky', false), + 'prune_shadow_days' => $request->variable('prune_shadow_days', 7), + 'prune_shadow_freq' => $request->variable('prune_shadow_freq', 1), + 'forum_password' => $request->variable('forum_password', '', true), + 'forum_password_confirm'=> $request->variable('forum_password_confirm', '', true), + 'forum_password_unset' => $request->variable('forum_password_unset', false), + ); + + /** + * Request forum data and operate on it (parse texts, etc.) + * + * @event core.acp_manage_forums_request_data + * @var string action Type of the action: add|edit + * @var array forum_data Array with new forum data + * @since 3.1.0-a1 + */ + $vars = array('action', 'forum_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_request_data', compact($vars))); + + // On add, add empty forum_options... else do not consider it (not updating it) + if ($action == 'add') + { + $forum_data['forum_options'] = 0; + } + + // Use link_display_on_index setting if forum type is link + if ($forum_data['forum_type'] == FORUM_LINK) + { + $forum_data['display_on_index'] = $request->variable('link_display_on_index', false); + } + + // Linked forums and categories are not able to be locked... + if ($forum_data['forum_type'] == FORUM_LINK || $forum_data['forum_type'] == FORUM_CAT) + { + $forum_data['forum_status'] = ITEM_UNLOCKED; + } + + $forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? $request->variable('display_recent', true) : $request->variable('display_active', false); + + // Get data for forum rules if specified... + if ($forum_data['forum_rules']) + { + generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], $request->variable('rules_parse_bbcode', false), $request->variable('rules_parse_urls', false), $request->variable('rules_parse_smilies', false)); + } + + // Get data for forum description if specified + if ($forum_data['forum_desc']) + { + generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], $request->variable('desc_parse_bbcode', false), $request->variable('desc_parse_urls', false), $request->variable('desc_parse_smilies', false)); + } + + $errors = $this->update_forum_data($forum_data); + + if (!count($errors)) + { + $forum_perm_from = $request->variable('forum_perm_from', 0); + $cache->destroy('sql', FORUMS_TABLE); + + $copied_permissions = false; + // Copy permissions? + if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id'] && + ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')))) + { + copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false); + phpbb_cache_moderators($db, $cache, $auth); + $copied_permissions = true; + } +/* Commented out because of questionable UI workflow - re-visit for 3.0.7 + else if (!$this->parent_id && $action != 'edit' && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) + { + $this->copy_permission_page($forum_data); + return; + } +*/ + $auth->acl_clear_prefetch(); + + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; + + $message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED']; + + // redirect directly to permission settings screen if authed + if ($action == 'add' && !$copied_permissions && $auth->acl_get('a_fauth')) + { + $message .= '

' . sprintf($user->lang['REDIRECT_ACL'], '', ''); + + meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url)); + } + + trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + } + + break; + } + } + + switch ($action) + { + case 'move_up': + case 'move_down': + + if (!$forum_id) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + $move_forum_name = $this->move_forum_by($row, $action, 1); + + if ($move_forum_name !== false) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_' . strtoupper($action), false, array($row['forum_name'], $move_forum_name)); + $cache->destroy('sql', FORUMS_TABLE); + } + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response; + $json_response->send(array('success' => ($move_forum_name !== false))); + } + + break; + + case 'sync': + if (!$forum_id) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + @set_time_limit(0); + + $sql = 'SELECT forum_name, (forum_topics_approved + forum_topics_unapproved + forum_topics_softdeleted) AS total_topics + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + if ($row['total_topics']) + { + $sql = 'SELECT MIN(topic_id) as min_topic_id, MAX(topic_id) as max_topic_id + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = ' . $forum_id; + $result = $db->sql_query($sql); + $row2 = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Typecast to int if there is no data available + $row2['min_topic_id'] = (int) $row2['min_topic_id']; + $row2['max_topic_id'] = (int) $row2['max_topic_id']; + + $start = $request->variable('start', $row2['min_topic_id']); + + $batch_size = 2000; + $end = $start + $batch_size; + + // Sync all topics in batch mode... + sync('topic', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, true); + + if ($end < $row2['max_topic_id']) + { + // We really need to find a way of showing statistics... no progress here + $sql = 'SELECT COUNT(topic_id) as num_topics + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = ' . $forum_id . ' + AND topic_id BETWEEN ' . $start . ' AND ' . $end; + $result = $db->sql_query($sql); + $topics_done = $request->variable('topics_done', 0) + (int) $db->sql_fetchfield('num_topics'); + $db->sql_freeresult($result); + + $start += $batch_size; + + $url = $this->u_action . "&parent_id={$this->parent_id}&f=$forum_id&action=sync&start=$start&topics_done=$topics_done&total={$row['total_topics']}"; + + meta_refresh(0, $url); + + $template->assign_vars(array( + 'U_PROGRESS_BAR' => $this->u_action . "&action=progress_bar&start=$topics_done&total={$row['total_topics']}", + 'UA_PROGRESS_BAR' => addslashes($this->u_action . "&action=progress_bar&start=$topics_done&total={$row['total_topics']}"), + 'S_CONTINUE_SYNC' => true, + 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $topics_done, $row['total_topics'])) + ); + + return; + } + } + + $url = $this->u_action . "&parent_id={$this->parent_id}&f=$forum_id&action=sync_forum"; + meta_refresh(0, $url); + + $template->assign_vars(array( + 'U_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', + 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&action=progress_bar'), + 'S_CONTINUE_SYNC' => true, + 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], 0, $row['total_topics'])) + ); + + return; + + break; + + case 'sync_forum': + + $sql = 'SELECT forum_name, forum_type + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + sync('forum', 'forum_id', $forum_id, false, true); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_SYNC', false, array($row['forum_name'])); + + $cache->destroy('sql', FORUMS_TABLE); + + $template->assign_var('L_FORUM_RESYNCED', sprintf($user->lang['FORUM_RESYNCED'], $row['forum_name'])); + + break; + + case 'add': + case 'edit': + + if ($update) + { + $forum_data['forum_flags'] = 0; + $forum_data['forum_flags'] += ($request->variable('forum_link_track', false)) ? FORUM_FLAG_LINK_TRACK : 0; + $forum_data['forum_flags'] += ($request->variable('prune_old_polls', false)) ? FORUM_FLAG_PRUNE_POLL : 0; + $forum_data['forum_flags'] += ($request->variable('prune_announce', false)) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; + $forum_data['forum_flags'] += ($request->variable('prune_sticky', false)) ? FORUM_FLAG_PRUNE_STICKY : 0; + $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; + $forum_data['forum_flags'] += ($request->variable('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0; + $forum_data['forum_flags'] += ($request->variable('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0; + } + + // Initialise $row, so we always have it in the event + $row = array(); + + // Show form to create/modify a forum + if ($action == 'edit') + { + $this->page_title = 'EDIT_FORUM'; + $row = $this->get_forum_info($forum_id); + $old_forum_type = $row['forum_type']; + + if (!$update) + { + $forum_data = $row; + } + else + { + $forum_data['left_id'] = $row['left_id']; + $forum_data['right_id'] = $row['right_id']; + } + + // Make sure no direct child forums are able to be selected as parents. + $exclude_forums = array(); + foreach (get_forum_branch($forum_id, 'children') as $row) + { + $exclude_forums[] = $row['forum_id']; + } + + $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, false, false, false); + + $forum_data['forum_password_confirm'] = $forum_data['forum_password']; + } + else + { + $this->page_title = 'CREATE_FORUM'; + + $forum_id = $this->parent_id; + $parents_list = make_forum_select($this->parent_id, false, false, false, false); + + // Fill forum data with default values + if (!$update) + { + $forum_data = array( + 'parent_id' => $this->parent_id, + 'forum_type' => FORUM_POST, + 'forum_status' => ITEM_UNLOCKED, + 'forum_name' => $request->variable('forum_name', '', true), + 'forum_link' => '', + 'forum_link_track' => false, + 'forum_desc' => '', + 'forum_rules' => '', + 'forum_rules_link' => '', + 'forum_image' => '', + 'forum_style' => 0, + 'display_subforum_list' => true, + 'display_subforum_limit' => false, + 'display_on_index' => true, + 'forum_topics_per_page' => 0, + 'enable_indexing' => true, + 'enable_icons' => true, + 'enable_prune' => false, + 'prune_days' => 7, + 'prune_viewed' => 7, + 'prune_freq' => 1, + 'enable_shadow_prune' => false, + 'prune_shadow_days' => 7, + 'prune_shadow_freq' => 1, + 'forum_flags' => FORUM_FLAG_POST_REVIEW + FORUM_FLAG_ACTIVE_TOPICS, + 'forum_options' => 0, + 'forum_password' => '', + 'forum_password_confirm'=> '', + ); + } + } + + /** + * Initialise data before we display the add/edit form + * + * @event core.acp_manage_forums_initialise_data + * @var string action Type of the action: add|edit + * @var bool update Do we display the form only + * or did the user press submit + * @var int forum_id When editing: the forum id, + * when creating: the parent forum id + * @var array row Array with current forum data + * empty when creating new forum + * @var array forum_data Array with new forum data + * @var string parents_list List of parent options + * @since 3.1.0-a1 + */ + $vars = array('action', 'update', 'forum_id', 'row', 'forum_data', 'parents_list'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_initialise_data', compact($vars))); + + $forum_rules_data = array( + 'text' => $forum_data['forum_rules'], + 'allow_bbcode' => true, + 'allow_smilies' => true, + 'allow_urls' => true + ); + + $forum_desc_data = array( + 'text' => $forum_data['forum_desc'], + 'allow_bbcode' => true, + 'allow_smilies' => true, + 'allow_urls' => true + ); + + $forum_rules_preview = ''; + + // Parse rules if specified + if ($forum_data['forum_rules']) + { + if (!isset($forum_data['forum_rules_uid'])) + { + // Before we are able to display the preview and plane text, we need to parse our $request->variable()'d value... + $forum_data['forum_rules_uid'] = ''; + $forum_data['forum_rules_bitfield'] = ''; + $forum_data['forum_rules_options'] = 0; + + generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], $request->variable('rules_allow_bbcode', false), $request->variable('rules_allow_urls', false), $request->variable('rules_allow_smilies', false)); + } + + // Generate preview content + $forum_rules_preview = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']); + + // decode... + $forum_rules_data = generate_text_for_edit($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_options']); + } + + // Parse desciption if specified + if ($forum_data['forum_desc']) + { + if (!isset($forum_data['forum_desc_uid'])) + { + // Before we are able to display the preview and plane text, we need to parse our $request->variable()'d value... + $forum_data['forum_desc_uid'] = ''; + $forum_data['forum_desc_bitfield'] = ''; + $forum_data['forum_desc_options'] = 0; + + generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], $request->variable('desc_allow_bbcode', false), $request->variable('desc_allow_urls', false), $request->variable('desc_allow_smilies', false)); + } + + // decode... + $forum_desc_data = generate_text_for_edit($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_options']); + } + + $forum_type_options = ''; + $forum_type_ary = array(FORUM_CAT => 'CAT', FORUM_POST => 'FORUM', FORUM_LINK => 'LINK'); + + foreach ($forum_type_ary as $value => $lang) + { + $forum_type_options .= ''; + } + + $styles_list = style_select($forum_data['forum_style'], true); + + $statuslist = ''; + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST . " + AND forum_id <> $forum_id"; + $result = $db->sql_query_limit($sql, 1); + + $postable_forum_exists = false; + if ($db->sql_fetchrow($result)) + { + $postable_forum_exists = true; + } + $db->sql_freeresult($result); + + // Subforum move options + if ($action == 'edit' && $forum_data['forum_type'] == FORUM_CAT) + { + $subforums_id = array(); + $subforums = get_forum_branch($forum_id, 'children'); + + foreach ($subforums as $row) + { + $subforums_id[] = $row['forum_id']; + } + + $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id); + + if ($postable_forum_exists) + { + $template->assign_vars(array( + 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id)) // , false, true, false??? + ); + } + + $template->assign_vars(array( + 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, + 'S_FORUMS_LIST' => $forums_list) + ); + } + else if ($postable_forum_exists) + { + $template->assign_vars(array( + 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false)) + ); + } + + $s_show_display_on_index = false; + + if ($forum_data['parent_id'] > 0) + { + // if this forum is a subforum put the "display on index" checkbox + if ($parent_info = $this->get_forum_info($forum_data['parent_id'])) + { + if ($parent_info['parent_id'] > 0 || $parent_info['forum_type'] == FORUM_CAT) + { + $s_show_display_on_index = true; + } + } + } + + if (strlen($forum_data['forum_password']) == 32) + { + $errors[] = $user->lang['FORUM_PASSWORD_OLD']; + } + + $template_data = array( + 'S_EDIT_FORUM' => true, + 'S_ERROR' => (count($errors)) ? true : false, + 'S_PARENT_ID' => $this->parent_id, + 'S_FORUM_PARENT_ID' => $forum_data['parent_id'], + 'S_ADD_ACTION' => ($action == 'add') ? true : false, + + 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, + 'U_EDIT_ACTION' => $this->u_action . "&parent_id={$this->parent_id}&action=$action&f=$forum_id", + + 'L_COPY_PERMISSIONS_EXPLAIN' => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'], + 'L_TITLE' => $user->lang[$this->page_title], + 'ERROR_MSG' => (count($errors)) ? implode('
', $errors) : '', + + 'FORUM_NAME' => $forum_data['forum_name'], + 'FORUM_DATA_LINK' => $forum_data['forum_link'], + 'FORUM_IMAGE' => $forum_data['forum_image'], + 'FORUM_IMAGE_SRC' => ($forum_data['forum_image']) ? $phpbb_root_path . $forum_data['forum_image'] : '', + 'FORUM_POST' => FORUM_POST, + 'FORUM_LINK' => FORUM_LINK, + 'FORUM_CAT' => FORUM_CAT, + 'PRUNE_FREQ' => $forum_data['prune_freq'], + 'PRUNE_DAYS' => $forum_data['prune_days'], + 'PRUNE_VIEWED' => $forum_data['prune_viewed'], + 'PRUNE_SHADOW_FREQ' => $forum_data['prune_shadow_freq'], + 'PRUNE_SHADOW_DAYS' => $forum_data['prune_shadow_days'], + 'TOPICS_PER_PAGE' => $forum_data['forum_topics_per_page'], + 'FORUM_RULES_LINK' => $forum_data['forum_rules_link'], + 'FORUM_RULES' => $forum_data['forum_rules'], + 'FORUM_RULES_PREVIEW' => $forum_rules_preview, + 'FORUM_RULES_PLAIN' => $forum_rules_data['text'], + 'S_BBCODE_CHECKED' => ($forum_rules_data['allow_bbcode']) ? true : false, + 'S_SMILIES_CHECKED' => ($forum_rules_data['allow_smilies']) ? true : false, + 'S_URLS_CHECKED' => ($forum_rules_data['allow_urls']) ? true : false, + 'S_FORUM_PASSWORD_SET' => (empty($forum_data['forum_password'])) ? false : true, + + 'FORUM_DESC' => $forum_desc_data['text'], + 'S_DESC_BBCODE_CHECKED' => ($forum_desc_data['allow_bbcode']) ? true : false, + 'S_DESC_SMILIES_CHECKED' => ($forum_desc_data['allow_smilies']) ? true : false, + 'S_DESC_URLS_CHECKED' => ($forum_desc_data['allow_urls']) ? true : false, + + 'S_FORUM_TYPE_OPTIONS' => $forum_type_options, + 'S_STATUS_OPTIONS' => $statuslist, + 'S_PARENT_OPTIONS' => $parents_list, + 'S_STYLES_OPTIONS' => $styles_list, + 'S_FORUM_OPTIONS' => make_forum_select(($action == 'add') ? $forum_data['parent_id'] : false, ($action == 'edit') ? $forum_data['forum_id'] : false, false, false, false), + 'S_SHOW_DISPLAY_ON_INDEX' => $s_show_display_on_index, + 'S_FORUM_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, + 'S_FORUM_ORIG_POST' => (isset($old_forum_type) && $old_forum_type == FORUM_POST) ? true : false, + 'S_FORUM_ORIG_CAT' => (isset($old_forum_type) && $old_forum_type == FORUM_CAT) ? true : false, + 'S_FORUM_ORIG_LINK' => (isset($old_forum_type) && $old_forum_type == FORUM_LINK) ? true : false, + 'S_FORUM_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, + 'S_FORUM_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false, + 'S_ENABLE_INDEXING' => ($forum_data['enable_indexing']) ? true : false, + 'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false, + 'S_DISPLAY_SUBFORUM_LIST' => ($forum_data['display_subforum_list']) ? true : false, + 'S_DISPLAY_SUBFORUM_LIMIT' => ($forum_data['display_subforum_limit']) ? true : false, + 'S_DISPLAY_ON_INDEX' => ($forum_data['display_on_index']) ? true : false, + 'S_PRUNE_ENABLE' => ($forum_data['enable_prune']) ? true : false, + 'S_PRUNE_SHADOW_ENABLE' => ($forum_data['enable_shadow_prune']) ? true : false, + 'S_FORUM_LINK_TRACK' => ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? true : false, + 'S_PRUNE_OLD_POLLS' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_POLL) ? true : false, + 'S_PRUNE_ANNOUNCE' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_ANNOUNCE) ? true : false, + 'S_PRUNE_STICKY' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_STICKY) ? true : false, + 'S_DISPLAY_ACTIVE_TOPICS' => ($forum_data['forum_type'] == FORUM_POST) ? ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) : true, + 'S_ENABLE_ACTIVE_TOPICS' => ($forum_data['forum_type'] == FORUM_CAT) ? ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) : false, + 'S_ENABLE_POST_REVIEW' => ($forum_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) ? true : false, + 'S_ENABLE_QUICK_REPLY' => ($forum_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) ? true : false, + 'S_CAN_COPY_PERMISSIONS' => ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) ? true : false, + ); + + /** + * Modify forum template data before we display the form + * + * @event core.acp_manage_forums_display_form + * @var string action Type of the action: add|edit + * @var bool update Do we display the form only + * or did the user press submit + * @var int forum_id When editing: the forum id, + * when creating: the parent forum id + * @var array row Array with current forum data + * empty when creating new forum + * @var array forum_data Array with new forum data + * @var string parents_list List of parent options + * @var array errors Array of errors, if you add errors + * ensure to update the template variables + * S_ERROR and ERROR_MSG to display it + * @var array template_data Array with new forum data + * @since 3.1.0-a1 + */ + $vars = array( + 'action', + 'update', + 'forum_id', + 'row', + 'forum_data', + 'parents_list', + 'errors', + 'template_data', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_display_form', compact($vars))); + + $template->assign_vars($template_data); + + return; + + break; + + case 'delete': + + if (!$forum_id) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + $forum_data = $this->get_forum_info($forum_id); + + $subforums_id = array(); + $subforums = get_forum_branch($forum_id, 'children'); + + foreach ($subforums as $row) + { + $subforums_id[] = $row['forum_id']; + } + + $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id); + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST . " + AND forum_id <> $forum_id"; + $result = $db->sql_query_limit($sql, 1); + + if ($db->sql_fetchrow($result)) + { + $template->assign_vars(array( + 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id, false, true)) // , false, true, false??? + ); + } + $db->sql_freeresult($result); + + $parent_id = ($this->parent_id == $forum_id) ? 0 : $this->parent_id; + + $template->assign_vars(array( + 'S_DELETE_FORUM' => true, + 'U_ACTION' => $this->u_action . "&parent_id={$parent_id}&action=delete&f=$forum_id", + 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, + + 'FORUM_NAME' => $forum_data['forum_name'], + 'S_FORUM_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, + 'S_FORUM_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, + 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, + 'S_FORUMS_LIST' => $forums_list, + 'S_ERROR' => (count($errors)) ? true : false, + 'ERROR_MSG' => (count($errors)) ? implode('
', $errors) : '') + ); + + return; + break; + + case 'copy_perm': + $forum_perm_from = $request->variable('forum_perm_from', 0); + + // Copy permissions? + if (!empty($forum_perm_from) && $forum_perm_from != $forum_id) + { + copy_forum_permissions($forum_perm_from, $forum_id, true); + phpbb_cache_moderators($db, $cache, $auth); + $auth->acl_clear_prefetch(); + $cache->destroy('sql', FORUMS_TABLE); + + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_id; + + $message = $user->lang['FORUM_UPDATED']; + + // Redirect to permissions + if ($auth->acl_get('a_fauth')) + { + $message .= '

' . sprintf($user->lang['REDIRECT_ACL'], '', ''); + } + + trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + } + + break; + } + + // Default management page + if (!$this->parent_id) + { + $navigation = $user->lang['FORUM_INDEX']; + } + else + { + $navigation = '' . $user->lang['FORUM_INDEX'] . ''; + + $forums_nav = get_forum_branch($this->parent_id, 'parents', 'descending'); + foreach ($forums_nav as $row) + { + if ($row['forum_id'] == $this->parent_id) + { + $navigation .= ' -> ' . $row['forum_name']; + } + else + { + $navigation .= ' -> ' . $row['forum_name'] . ''; + } + } + } + + // Jumpbox + $forum_box = make_forum_select($this->parent_id, false, false, false, false); //make_forum_select($this->parent_id); + + if ($action == 'sync' || $action == 'sync_forum') + { + $template->assign_var('S_RESYNCED', true); + } + + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . " + WHERE parent_id = $this->parent_id + ORDER BY left_id"; + $result = $db->sql_query($sql); + + $rowset = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rowset[(int) $row['forum_id']] = $row; + } + $db->sql_freeresult($result); + + /** + * Modify the forum list data + * + * @event core.acp_manage_forums_modify_forum_list + * @var array rowset Array with the forums list data + * @since 3.1.10-RC1 + */ + $vars = array('rowset'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_modify_forum_list', compact($vars))); + + if (!empty($rowset)) + { + foreach ($rowset as $row) + { + $forum_type = $row['forum_type']; + + if ($row['forum_status'] == ITEM_LOCKED) + { + $folder_image = '' . $user->lang['LOCKED'] . ''; + } + else + { + switch ($forum_type) + { + case FORUM_LINK: + $folder_image = '' . $user->lang['LINK'] . ''; + break; + + default: + $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '' . $user->lang['SUBFORUM'] . '' : '' . $user->lang['FOLDER'] . ''; + break; + } + } + + $url = $this->u_action . "&parent_id=$this->parent_id&f={$row['forum_id']}"; + + $template->assign_block_vars('forums', array( + 'FOLDER_IMAGE' => $folder_image, + 'FORUM_IMAGE' => ($row['forum_image']) ? '' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', + 'FORUM_NAME' => $row['forum_name'], + 'FORUM_DESCRIPTION' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), + 'FORUM_TOPICS' => $row['forum_topics_approved'], + 'FORUM_POSTS' => $row['forum_posts_approved'], + + 'S_FORUM_LINK' => ($forum_type == FORUM_LINK) ? true : false, + 'S_FORUM_POST' => ($forum_type == FORUM_POST) ? true : false, + + 'U_FORUM' => $this->u_action . '&parent_id=' . $row['forum_id'], + 'U_MOVE_UP' => $url . '&action=move_up', + 'U_MOVE_DOWN' => $url . '&action=move_down', + 'U_EDIT' => $url . '&action=edit', + 'U_DELETE' => $url . '&action=delete', + 'U_SYNC' => $url . '&action=sync') + ); + } + } + else if ($this->parent_id) + { + $row = $this->get_forum_info($this->parent_id); + + $url = $this->u_action . '&parent_id=' . $this->parent_id . '&f=' . $row['forum_id']; + + $template->assign_vars(array( + 'S_NO_FORUMS' => true, + + 'U_EDIT' => $url . '&action=edit', + 'U_DELETE' => $url . '&action=delete', + 'U_SYNC' => $url . '&action=sync') + ); + } + unset($rowset); + + $template->assign_vars(array( + 'ERROR_MSG' => (count($errors)) ? implode('
', $errors) : '', + 'NAVIGATION' => $navigation, + 'FORUM_BOX' => $forum_box, + 'U_SEL_ACTION' => $this->u_action, + 'U_ACTION' => $this->u_action . '&parent_id=' . $this->parent_id, + + 'U_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', + 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&action=progress_bar'), + )); + } + + /** + * Get forum details + */ + function get_forum_info($forum_id) + { + global $db; + + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error("Forum #$forum_id does not exist", E_USER_ERROR); + } + + return $row; + } + + /** + * Update forum data + */ + function update_forum_data(&$forum_data_ary) + { + global $db, $user, $cache, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request; + + $errors = array(); + + $forum_data = $forum_data_ary; + /** + * Validate the forum data before we create/update the forum + * + * @event core.acp_manage_forums_validate_data + * @var array forum_data Array with new forum data + * @var array errors Array of errors, should be strings and not + * language key. + * @since 3.1.0-a1 + */ + $vars = array('forum_data', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_validate_data', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); + + if ($forum_data_ary['forum_name'] == '') + { + $errors[] = $user->lang['FORUM_NAME_EMPTY']; + } + + /** + * Replace Emojis and other 4bit UTF-8 chars not allowed by MySql to UCR / NCR. + * Using their Numeric Character Reference's Hexadecimal notation. + */ + $forum_data_ary['forum_name'] = utf8_encode_ucr($forum_data_ary['forum_name']); + + /** + * This should never happen again. + * Leaving the fallback here just in case there will be the need of it. + */ + if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $forum_data_ary['forum_name'], $matches)) + { + $character_list = implode('
', $matches[0]); + + $errors[] = $user->lang('FORUM_NAME_EMOJI', $character_list); + } + + if (utf8_strlen($forum_data_ary['forum_desc']) > 4000) + { + $errors[] = $user->lang['FORUM_DESC_TOO_LONG']; + } + + if (utf8_strlen($forum_data_ary['forum_rules']) > 4000) + { + $errors[] = $user->lang['FORUM_RULES_TOO_LONG']; + } + + if ($forum_data_ary['forum_password'] || $forum_data_ary['forum_password_confirm']) + { + if ($forum_data_ary['forum_password'] != $forum_data_ary['forum_password_confirm']) + { + $forum_data_ary['forum_password'] = $forum_data_ary['forum_password_confirm'] = ''; + $errors[] = $user->lang['FORUM_PASSWORD_MISMATCH']; + } + } + + if ($forum_data_ary['prune_days'] < 0 || $forum_data_ary['prune_viewed'] < 0 || $forum_data_ary['prune_freq'] < 0) + { + $forum_data_ary['prune_days'] = $forum_data_ary['prune_viewed'] = $forum_data_ary['prune_freq'] = 0; + $errors[] = $user->lang['FORUM_DATA_NEGATIVE']; + } + + $range_test_ary = array( + array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'USINT:0'), + ); + + if (!empty($forum_data_ary['forum_image']) && !file_exists($phpbb_root_path . $forum_data_ary['forum_image'])) + { + $errors[] = $user->lang['FORUM_IMAGE_NO_EXIST']; + } + + validate_range($range_test_ary, $errors); + + // Set forum flags + // 1 = link tracking + // 2 = prune old polls + // 4 = prune announcements + // 8 = prune stickies + // 16 = show active topics + // 32 = enable post review + $forum_data_ary['forum_flags'] = 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['forum_link_track']) ? FORUM_FLAG_LINK_TRACK : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_old_polls']) ? FORUM_FLAG_PRUNE_POLL : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_announce']) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0; + + // Unset data that are not database fields + $forum_data_sql = $forum_data_ary; + + unset($forum_data_sql['forum_link_track']); + unset($forum_data_sql['prune_old_polls']); + unset($forum_data_sql['prune_announce']); + unset($forum_data_sql['prune_sticky']); + unset($forum_data_sql['show_active']); + unset($forum_data_sql['enable_post_review']); + unset($forum_data_sql['enable_quick_reply']); + unset($forum_data_sql['forum_password_confirm']); + + // What are we going to do tonight Brain? The same thing we do everynight, + // try to take over the world ... or decide whether to continue update + // and if so, whether it's a new forum/cat/link or an existing one + if (count($errors)) + { + return $errors; + } + + // As we don't know the old password, it's kinda tricky to detect changes + if ($forum_data_sql['forum_password_unset']) + { + $forum_data_sql['forum_password'] = ''; + } + else if (empty($forum_data_sql['forum_password'])) + { + unset($forum_data_sql['forum_password']); + } + else + { + // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + + $forum_data_sql['forum_password'] = $passwords_manager->hash($forum_data_sql['forum_password']); + } + unset($forum_data_sql['forum_password_unset']); + + $forum_data = $forum_data_ary; + /** + * Remove invalid values from forum_data_sql that should not be updated + * + * @event core.acp_manage_forums_update_data_before + * @var array forum_data Array with forum data + * @var array forum_data_sql Array with data we are going to update + * If forum_data_sql[forum_id] is set, we update + * that forum, otherwise a new one is created. + * @since 3.1.0-a1 + */ + $vars = array('forum_data', 'forum_data_sql'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_before', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); + + $is_new_forum = !isset($forum_data_sql['forum_id']); + + if ($is_new_forum) + { + // no forum_id means we're creating a new forum + unset($forum_data_sql['type_action']); + + if ($forum_data_sql['parent_id']) + { + $sql = 'SELECT left_id, right_id, forum_type + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_data_sql['parent_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['PARENT_NOT_EXIST'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + if ($row['forum_type'] == FORUM_LINK) + { + $errors[] = $user->lang['PARENT_IS_LINK_FORUM']; + return $errors; + } + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET left_id = left_id + 2, right_id = right_id + 2 + WHERE left_id > ' . $row['right_id']; + $db->sql_query($sql); + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET right_id = right_id + 2 + WHERE ' . $row['left_id'] . ' BETWEEN left_id AND right_id'; + $db->sql_query($sql); + + $forum_data_sql['left_id'] = $row['right_id']; + $forum_data_sql['right_id'] = $row['right_id'] + 1; + } + else + { + $sql = 'SELECT MAX(right_id) AS right_id + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $forum_data_sql['left_id'] = $row['right_id'] + 1; + $forum_data_sql['right_id'] = $row['right_id'] + 2; + } + + $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $forum_data_sql); + $db->sql_query($sql); + + $forum_data_ary['forum_id'] = $db->sql_nextid(); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_ADD', false, array($forum_data_ary['forum_name'])); + } + else + { + $row = $this->get_forum_info($forum_data_sql['forum_id']); + + if ($row['forum_type'] == FORUM_POST && $row['forum_type'] != $forum_data_sql['forum_type']) + { + // Has subforums and want to change into a link? + if ($row['right_id'] - $row['left_id'] > 1 && $forum_data_sql['forum_type'] == FORUM_LINK) + { + $errors[] = $user->lang['FORUM_WITH_SUBFORUMS_NOT_TO_LINK']; + return $errors; + } + + // we're turning a postable forum into a non-postable forum + if ($forum_data_sql['type_action'] == 'move') + { + $to_forum_id = $request->variable('to_forum_id', 0); + + if ($to_forum_id) + { + $errors = $this->move_forum_content($forum_data_sql['forum_id'], $to_forum_id); + } + else + { + return array($user->lang['NO_DESTINATION_FORUM']); + } + } + else if ($forum_data_sql['type_action'] == 'delete') + { + $errors = $this->delete_forum_content($forum_data_sql['forum_id']); + } + else + { + return array($user->lang['NO_FORUM_ACTION']); + } + + $forum_data_sql['forum_posts_approved'] = $forum_data_sql['forum_posts_unapproved'] = $forum_data_sql['forum_posts_softdeleted'] = $forum_data_sql['forum_topics_approved'] = $forum_data_sql['forum_topics_unapproved'] = $forum_data_sql['forum_topics_softdeleted'] = 0; + $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0; + $forum_data_sql['forum_last_poster_name'] = $forum_data_sql['forum_last_poster_colour'] = ''; + } + else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_LINK) + { + // Has subforums? + if ($row['right_id'] - $row['left_id'] > 1) + { + // We are turning a category into a link - but need to decide what to do with the subforums. + $action_subforums = $request->variable('action_subforums', ''); + $subforums_to_id = $request->variable('subforums_to_id', 0); + + if ($action_subforums == 'delete') + { + $rows = get_forum_branch($row['forum_id'], 'children', 'descending', false); + + foreach ($rows as $_row) + { + // Do not remove the forum id we are about to change. ;) + if ($_row['forum_id'] == $row['forum_id']) + { + continue; + } + + $forum_ids[] = $_row['forum_id']; + $errors = array_merge($errors, $this->delete_forum_content($_row['forum_id'])); + } + + if (count($errors)) + { + return $errors; + } + + if (count($forum_ids)) + { + $sql = 'DELETE FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + // Delete forum ids from extension groups table + $sql = 'SELECT group_id, allowed_forums + FROM ' . EXTENSION_GROUPS_TABLE; + $result = $db->sql_query($sql); + + while ($_row = $db->sql_fetchrow($result)) + { + if (!$_row['allowed_forums']) + { + continue; + } + + $allowed_forums = unserialize(trim($_row['allowed_forums'])); + $allowed_forums = array_diff($allowed_forums, $forum_ids); + + $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " + SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "' + WHERE group_id = {$_row['group_id']}"; + $db->sql_query($sql); + } + $db->sql_freeresult($result); + + $cache->destroy('_extensions'); + } + } + else if ($action_subforums == 'move') + { + if (!$subforums_to_id) + { + return array($user->lang['NO_DESTINATION_FORUM']); + } + + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $subforums_to_id; + $result = $db->sql_query($sql); + $_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$_row) + { + return array($user->lang['NO_FORUM']); + } + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . " + WHERE parent_id = {$row['forum_id']}"; + $result = $db->sql_query($sql); + + while ($_row = $db->sql_fetchrow($result)) + { + $this->move_forum($_row['forum_id'], $subforums_to_id); + } + $db->sql_freeresult($result); + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET parent_id = $subforums_to_id + WHERE parent_id = {$row['forum_id']}"; + $db->sql_query($sql); + } + + // Adjust the left/right id + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET right_id = left_id + 1 + WHERE forum_id = ' . $row['forum_id']; + $db->sql_query($sql); + } + } + else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_POST) + { + // Changing a category to a forum? Reset the data (you can't post directly in a cat, you must use a forum) + $forum_data_sql['forum_posts_approved'] = 0; + $forum_data_sql['forum_posts_unapproved'] = 0; + $forum_data_sql['forum_posts_softdeleted'] = 0; + $forum_data_sql['forum_topics_approved'] = 0; + $forum_data_sql['forum_topics_unapproved'] = 0; + $forum_data_sql['forum_topics_softdeleted'] = 0; + $forum_data_sql['forum_last_post_id'] = 0; + $forum_data_sql['forum_last_post_subject'] = ''; + $forum_data_sql['forum_last_post_time'] = 0; + $forum_data_sql['forum_last_poster_id'] = 0; + $forum_data_sql['forum_last_poster_name'] = ''; + $forum_data_sql['forum_last_poster_colour'] = ''; + } + + if (count($errors)) + { + return $errors; + } + + if ($row['parent_id'] != $forum_data_sql['parent_id']) + { + if ($row['forum_id'] != $forum_data_sql['parent_id']) + { + $errors = $this->move_forum($forum_data_sql['forum_id'], $forum_data_sql['parent_id']); + } + else + { + $forum_data_sql['parent_id'] = $row['parent_id']; + } + } + + if (count($errors)) + { + return $errors; + } + + unset($forum_data_sql['type_action']); + + if ($row['forum_name'] != $forum_data_sql['forum_name']) + { + // the forum name has changed, clear the parents list of all forums (for safety) + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET forum_parents = ''"; + $db->sql_query($sql); + } + + // Setting the forum id to the forum id is not really received well by some dbs. ;) + $forum_id = $forum_data_sql['forum_id']; + unset($forum_data_sql['forum_id']); + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $forum_data_sql) . ' + WHERE forum_id = ' . $forum_id; + $db->sql_query($sql); + + // Add it back + $forum_data_ary['forum_id'] = $forum_id; + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_EDIT', false, array($forum_data_ary['forum_name'])); + } + + $forum_data = $forum_data_ary; + /** + * Event after a forum was updated or created + * + * @event core.acp_manage_forums_update_data_after + * @var array forum_data Array with forum data + * @var array forum_data_sql Array with data we updated + * @var bool is_new_forum Did we create a forum or update one + * If you want to overwrite this value, + * ensure to set forum_data_sql[forum_id] + * @var array errors Array of errors, should be strings and not + * language key. + * @since 3.1.0-a1 + */ + $vars = array('forum_data', 'forum_data_sql', 'is_new_forum', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_after', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); + + return $errors; + } + + /** + * Move forum + */ + function move_forum($from_id, $to_id) + { + global $db, $user, $phpbb_dispatcher; + + $errors = array(); + + // Check if we want to move to a parent with link type + if ($to_id > 0) + { + $to_data = $this->get_forum_info($to_id); + + if ($to_data['forum_type'] == FORUM_LINK) + { + $errors[] = $user->lang['PARENT_IS_LINK_FORUM']; + } + } + + /** + * Event when we move all children of one forum to another + * + * This event may be triggered, when a forum is deleted + * + * @event core.acp_manage_forums_move_children + * @var int from_id Id of the current parent forum + * @var int to_id Id of the new parent forum + * @var array errors Array of errors, should be strings and not + * language key. + * @since 3.1.0-a1 + */ + $vars = array('from_id', 'to_id', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_children', compact($vars))); + + // Return if there were errors + if (!empty($errors)) + { + return $errors; + } + + $db->sql_transaction('begin'); + + $moved_forums = get_forum_branch($from_id, 'children', 'descending'); + $from_data = $moved_forums[0]; + $diff = count($moved_forums) * 2; + + $moved_ids = array(); + for ($i = 0, $size = count($moved_forums); $i < $size; ++$i) + { + $moved_ids[] = $moved_forums[$i]['forum_id']; + } + + // Resync parents + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET right_id = right_id - $diff, forum_parents = '' + WHERE left_id < " . $from_data['right_id'] . " + AND right_id > " . $from_data['right_id']; + $db->sql_query($sql); + + // Resync righthand side of tree + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id - $diff, right_id = right_id - $diff, forum_parents = '' + WHERE left_id > " . $from_data['right_id']; + $db->sql_query($sql); + + if ($to_id > 0) + { + // Retrieve $to_data again, it may have been changed... + $to_data = $this->get_forum_info($to_id); + + // Resync new parents + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET right_id = right_id + $diff, forum_parents = '' + WHERE " . $to_data['right_id'] . ' BETWEEN left_id AND right_id + AND ' . $db->sql_in_set('forum_id', $moved_ids, true); + $db->sql_query($sql); + + // Resync the righthand side of the tree + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id + $diff, right_id = right_id + $diff, forum_parents = '' + WHERE left_id > " . $to_data['right_id'] . ' + AND ' . $db->sql_in_set('forum_id', $moved_ids, true); + $db->sql_query($sql); + + // Resync moved branch + $to_data['right_id'] += $diff; + + if ($to_data['right_id'] > $from_data['right_id']) + { + $diff = '+ ' . ($to_data['right_id'] - $from_data['right_id'] - 1); + } + else + { + $diff = '- ' . abs($to_data['right_id'] - $from_data['right_id'] - 1); + } + } + else + { + $sql = 'SELECT MAX(right_id) AS right_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $moved_ids, true); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $diff = '+ ' . ($row['right_id'] - $from_data['left_id'] + 1); + } + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id $diff, right_id = right_id $diff, forum_parents = '' + WHERE " . $db->sql_in_set('forum_id', $moved_ids); + $db->sql_query($sql); + + $db->sql_transaction('commit'); + + return $errors; + } + + /** + * Move forum content from one to another forum + */ + function move_forum_content($from_id, $to_id, $sync = true) + { + global $db, $phpbb_dispatcher; + + $errors = array(); + + /** + * Event when we move content from one forum to another + * + * @event core.acp_manage_forums_move_content + * @var int from_id Id of the current parent forum + * @var int to_id Id of the new parent forum + * @var bool sync Shall we sync the "to"-forum's data + * @var array errors Array of errors, should be strings and not + * language key. If this array is not empty, + * The content will not be moved. + * @since 3.1.0-a1 + */ + $vars = array('from_id', 'to_id', 'sync', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content', compact($vars))); + + // Return if there were errors + if (!empty($errors)) + { + return $errors; + } + + $table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); + + /** + * Perform additional actions before move forum content + * + * @event core.acp_manage_forums_move_content_sql_before + * @var array table_ary Array of tables from which forum_id will be updated + * @since 3.2.4-RC1 + */ + $vars = array('table_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content_sql_before', compact($vars))); + + foreach ($table_ary as $table) + { + $sql = "UPDATE $table + SET forum_id = $to_id + WHERE forum_id = $from_id"; + $db->sql_query($sql); + } + unset($table_ary); + + $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, MODERATOR_CACHE_TABLE); + + foreach ($table_ary as $table) + { + $sql = "DELETE FROM $table + WHERE forum_id = $from_id"; + $db->sql_query($sql); + } + + /** + * Event when content has been moved from one forum to another + * + * @event core.acp_manage_forums_move_content_after + * @var int from_id Id of the current parent forum + * @var int to_id Id of the new parent forum + * @var bool sync Shall we sync the "to"-forum's data + * + * @since 3.2.9-RC1 + */ + $vars = array('from_id', 'to_id', 'sync'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content_after', compact($vars))); + + if ($sync) + { + // Delete ghost topics that link back to the same forum then resync counters + sync('topic_moved'); + sync('forum', 'forum_id', $to_id, false, true); + } + + return array(); + } + + /** + * Remove complete forum + */ + function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0) + { + global $db, $user, $cache, $phpbb_log; + + $forum_data = $this->get_forum_info($forum_id); + + $errors = array(); + $log_action_posts = $log_action_forums = $posts_to_name = $subforums_to_name = ''; + $forum_ids = array($forum_id); + + if ($action_posts == 'delete') + { + $log_action_posts = 'POSTS'; + $errors = array_merge($errors, $this->delete_forum_content($forum_id)); + } + else if ($action_posts == 'move') + { + if (!$posts_to_id) + { + $errors[] = $user->lang['NO_DESTINATION_FORUM']; + } + else + { + $log_action_posts = 'MOVE_POSTS'; + + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $posts_to_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $errors[] = $user->lang['NO_FORUM']; + } + else + { + $posts_to_name = $row['forum_name']; + $errors = array_merge($errors, $this->move_forum_content($forum_id, $posts_to_id)); + } + } + } + + if (count($errors)) + { + return $errors; + } + + if ($action_subforums == 'delete') + { + $log_action_forums = 'FORUMS'; + $rows = get_forum_branch($forum_id, 'children', 'descending', false); + + foreach ($rows as $row) + { + $forum_ids[] = $row['forum_id']; + $errors = array_merge($errors, $this->delete_forum_content($row['forum_id'])); + } + + if (count($errors)) + { + return $errors; + } + + $diff = count($forum_ids) * 2; + + $sql = 'DELETE FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + } + else if ($action_subforums == 'move') + { + if (!$subforums_to_id) + { + $errors[] = $user->lang['NO_DESTINATION_FORUM']; + } + else + { + $log_action_forums = 'MOVE_FORUMS'; + + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $subforums_to_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $errors[] = $user->lang['NO_FORUM']; + } + else + { + $subforums_to_name = $row['forum_name']; + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . " + WHERE parent_id = $forum_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $this->move_forum($row['forum_id'], $subforums_to_id); + } + $db->sql_freeresult($result); + + // Grab new forum data for correct tree updating later + $forum_data = $this->get_forum_info($forum_id); + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET parent_id = $subforums_to_id + WHERE parent_id = $forum_id"; + $db->sql_query($sql); + + $diff = 2; + $sql = 'DELETE FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + } + } + + if (count($errors)) + { + return $errors; + } + } + else + { + $diff = 2; + $sql = 'DELETE FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + } + + // Resync tree + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET right_id = right_id - $diff + WHERE left_id < {$forum_data['right_id']} AND right_id > {$forum_data['right_id']}"; + $db->sql_query($sql); + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id - $diff, right_id = right_id - $diff + WHERE left_id > {$forum_data['right_id']}"; + $db->sql_query($sql); + + // Delete forum ids from extension groups table + $sql = 'SELECT group_id, allowed_forums + FROM ' . EXTENSION_GROUPS_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$row['allowed_forums']) + { + continue; + } + + $allowed_forums = unserialize(trim($row['allowed_forums'])); + $allowed_forums = array_diff($allowed_forums, $forum_ids); + + $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " + SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "' + WHERE group_id = {$row['group_id']}"; + $db->sql_query($sql); + } + $db->sql_freeresult($result); + + $cache->destroy('_extensions'); + + $log_action = implode('_', array($log_action_posts, $log_action_forums)); + + switch ($log_action) + { + case 'MOVE_POSTS_MOVE_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS', false, array($posts_to_name, $subforums_to_name, $forum_data['forum_name'])); + break; + + case 'MOVE_POSTS_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS', false, array($posts_to_name, $forum_data['forum_name'])); + break; + + case 'POSTS_MOVE_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS', false, array($subforums_to_name, $forum_data['forum_name'])); + break; + + case '_MOVE_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_FORUMS', false, array($subforums_to_name, $forum_data['forum_name'])); + break; + + case 'MOVE_POSTS_': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS', false, array($posts_to_name, $forum_data['forum_name'])); + break; + + case 'POSTS_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS_FORUMS', false, array($forum_data['forum_name'])); + break; + + case '_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_FORUMS', false, array($forum_data['forum_name'])); + break; + + case 'POSTS_': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS', false, array($forum_data['forum_name'])); + break; + + default: + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_FORUM', false, array($forum_data['forum_name'])); + break; + } + + return $errors; + } + + /** + * Delete forum content + */ + function delete_forum_content($forum_id) + { + global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher; + + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + + $db->sql_transaction('begin'); + + // Select then delete all attachments + $sql = 'SELECT a.topic_id + FROM ' . POSTS_TABLE . ' p, ' . ATTACHMENTS_TABLE . " a + WHERE p.forum_id = $forum_id + AND a.in_message = 0 + AND a.topic_id = p.topic_id"; + $result = $db->sql_query($sql); + + $topic_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('topic', $topic_ids, false); + unset($attachment_manager); + + // Delete shadow topics pointing to topics in this forum + delete_topic_shadows($forum_id); + + // Before we remove anything we make sure we are able to adjust the post counts later. ;) + $sql = 'SELECT poster_id + FROM ' . POSTS_TABLE . ' + WHERE forum_id = ' . $forum_id . ' + AND post_postcount = 1 + AND post_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + + $post_counts = array(); + while ($row = $db->sql_fetchrow($result)) + { + $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1; + } + $db->sql_freeresult($result); + + switch ($db->get_sql_layer()) + { + case 'mysqli': + + // Delete everything else and thank MySQL for offering multi-table deletion + $tables_ary = array( + SEARCH_WORDMATCH_TABLE => 'post_id', + REPORTS_TABLE => 'post_id', + WARNINGS_TABLE => 'post_id', + BOOKMARKS_TABLE => 'topic_id', + TOPICS_WATCH_TABLE => 'topic_id', + TOPICS_POSTED_TABLE => 'topic_id', + POLL_OPTIONS_TABLE => 'topic_id', + POLL_VOTES_TABLE => 'topic_id', + ); + + $sql = 'DELETE ' . POSTS_TABLE; + $sql_using = "\nFROM " . POSTS_TABLE; + $sql_where = "\nWHERE " . POSTS_TABLE . ".forum_id = $forum_id\n"; + + foreach ($tables_ary as $table => $field) + { + $sql .= ", $table "; + $sql_using .= ", $table "; + $sql_where .= "\nAND $table.$field = " . POSTS_TABLE . ".$field"; + } + + $db->sql_query($sql . $sql_using . $sql_where); + + break; + + default: + + // Delete everything else and curse your DB for not offering multi-table deletion + $tables_ary = array( + 'post_id' => array( + SEARCH_WORDMATCH_TABLE, + REPORTS_TABLE, + WARNINGS_TABLE, + ), + + 'topic_id' => array( + BOOKMARKS_TABLE, + TOPICS_WATCH_TABLE, + TOPICS_POSTED_TABLE, + POLL_OPTIONS_TABLE, + POLL_VOTES_TABLE, + ) + ); + + // Amount of rows we select and delete in one iteration. + $batch_size = 500; + + foreach ($tables_ary as $field => $tables) + { + $start = 0; + + do + { + $sql = "SELECT $field + FROM " . POSTS_TABLE . ' + WHERE forum_id = ' . $forum_id; + $result = $db->sql_query_limit($sql, $batch_size, $start); + + $ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $ids[] = $row[$field]; + } + $db->sql_freeresult($result); + + if (count($ids)) + { + $start += count($ids); + + foreach ($tables as $table) + { + $db->sql_query("DELETE FROM $table WHERE " . $db->sql_in_set($field, $ids)); + } + } + } + while (count($ids) == $batch_size); + } + unset($ids); + + break; + } + + $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, LOG_TABLE, MODERATOR_CACHE_TABLE, POSTS_TABLE, TOPICS_TABLE, TOPICS_TRACK_TABLE); + + /** + * Perform additional actions before forum content deletion + * + * @event core.delete_forum_content_before_query + * @var array table_ary Array of tables from which all rows will be deleted that hold the forum_id + * @var int forum_id the forum id + * @var array topic_ids Array of the topic ids from the forum to be deleted + * @var array post_counts Array of counts of posts in the forum, by poster_id + * @since 3.1.6-RC1 + */ + $vars = array( + 'table_ary', + 'forum_id', + 'topic_ids', + 'post_counts', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_forum_content_before_query', compact($vars))); + + foreach ($table_ary as $table) + { + $db->sql_query("DELETE FROM $table WHERE forum_id = $forum_id"); + } + + // Set forum ids to 0 + $table_ary = array(DRAFTS_TABLE); + + foreach ($table_ary as $table) + { + $db->sql_query("UPDATE $table SET forum_id = 0 WHERE forum_id = $forum_id"); + } + + // Adjust users post counts + if (count($post_counts)) + { + foreach ($post_counts as $poster_id => $substract) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = 0 + WHERE user_id = ' . $poster_id . ' + AND user_posts < ' . $substract; + $db->sql_query($sql); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts - ' . $substract . ' + WHERE user_id = ' . $poster_id . ' + AND user_posts >= ' . $substract; + $db->sql_query($sql); + } + } + + $db->sql_transaction('commit'); + + // Make sure the overall post/topic count is correct... + $sql = 'SELECT COUNT(post_id) AS stat + FROM ' . POSTS_TABLE . ' + WHERE post_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_posts', (int) $row['stat'], false); + + $sql = 'SELECT COUNT(topic_id) AS stat + FROM ' . TOPICS_TABLE . ' + WHERE topic_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_topics', (int) $row['stat'], false); + + $sql = 'SELECT COUNT(attach_id) as stat + FROM ' . ATTACHMENTS_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_files', (int) $row['stat'], false); + + $sql = 'SELECT SUM(filesize) as stat + FROM ' . ATTACHMENTS_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('upload_dir_size', (float) $row['stat'], false); + + return array(); + } + + /** + * Move forum position by $steps up/down + */ + function move_forum_by($forum_row, $action = 'move_up', $steps = 1) + { + global $db; + + /** + * Fetch all the siblings between the module's current spot + * and where we want to move it to. If there are less than $steps + * siblings between the current spot and the target then the + * module will move as far as possible + */ + $sql = 'SELECT forum_id, forum_name, left_id, right_id + FROM ' . FORUMS_TABLE . " + WHERE parent_id = {$forum_row['parent_id']} + AND " . (($action == 'move_up') ? "right_id < {$forum_row['right_id']} ORDER BY right_id DESC" : "left_id > {$forum_row['left_id']} ORDER BY left_id ASC"); + $result = $db->sql_query_limit($sql, $steps); + + $target = array(); + while ($row = $db->sql_fetchrow($result)) + { + $target = $row; + } + $db->sql_freeresult($result); + + if (!count($target)) + { + // The forum is already on top or bottom + return false; + } + + /** + * $left_id and $right_id define the scope of the nodes that are affected by the move. + * $diff_up and $diff_down are the values to substract or add to each node's left_id + * and right_id in order to move them up or down. + * $move_up_left and $move_up_right define the scope of the nodes that are moving + * up. Other nodes in the scope of ($left_id, $right_id) are considered to move down. + */ + if ($action == 'move_up') + { + $left_id = $target['left_id']; + $right_id = $forum_row['right_id']; + + $diff_up = $forum_row['left_id'] - $target['left_id']; + $diff_down = $forum_row['right_id'] + 1 - $forum_row['left_id']; + + $move_up_left = $forum_row['left_id']; + $move_up_right = $forum_row['right_id']; + } + else + { + $left_id = $forum_row['left_id']; + $right_id = $target['right_id']; + + $diff_up = $forum_row['right_id'] + 1 - $forum_row['left_id']; + $diff_down = $target['right_id'] - $forum_row['right_id']; + + $move_up_left = $forum_row['right_id'] + 1; + $move_up_right = $target['right_id']; + } + + // Now do the dirty job + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id + CASE + WHEN left_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} + ELSE {$diff_down} + END, + right_id = right_id + CASE + WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} + ELSE {$diff_down} + END, + forum_parents = '' + WHERE + left_id BETWEEN {$left_id} AND {$right_id} + AND right_id BETWEEN {$left_id} AND {$right_id}"; + $db->sql_query($sql); + + return $target['forum_name']; + } + + /** + * Display progress bar for syncinc forums + */ + function display_progress_bar($start, $total) + { + global $template, $user; + + adm_page_header($user->lang['SYNC_IN_PROGRESS']); + + $template->set_filenames(array( + 'body' => 'progress_bar.html') + ); + + $template->assign_vars(array( + 'L_PROGRESS' => $user->lang['SYNC_IN_PROGRESS'], + 'L_PROGRESS_EXPLAIN' => ($start && $total) ? sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $total) : $user->lang['SYNC_IN_PROGRESS']) + ); + + adm_page_footer(); + } + + /** + * Display copy permission page + * Not used at the moment - we will have a look at it for 3.0.7 + */ + function copy_permission_page($forum_data) + { + global $phpEx, $phpbb_admin_path, $template, $user; + + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; + $action = append_sid($this->u_action . "&parent_id={$this->parent_id}&f={$forum_data['forum_id']}&action=copy_perm"); + + $l_acl = sprintf($user->lang['COPY_TO_ACL'], '', ''); + + $this->tpl_name = 'acp_forums_copy_perm'; + + $template->assign_vars(array( + 'U_ACL' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url), + 'L_ACL_LINK' => $l_acl, + 'L_BACK_LINK' => adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), + 'S_COPY_ACTION' => $action, + 'S_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_data['forum_id'], false, false, false), + )); + } + +} diff --git a/install/update/new/includes/acp/acp_help_phpbb.php b/install/update/new/includes/acp/acp_help_phpbb.php new file mode 100644 index 0000000..798cff5 --- /dev/null +++ b/install/update/new/includes/acp/acp_help_phpbb.php @@ -0,0 +1,146 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_help_phpbb +{ + var $u_action; + + function main($id, $mode) + { + global $config, $request, $template, $user, $phpbb_dispatcher, $phpbb_admin_path, $phpbb_root_path, $phpEx; + + if (!class_exists('phpbb_questionnaire_data_collector')) + { + include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx); + } + + $collect_url = "https://www.phpbb.com/statistics/send"; + + $this->tpl_name = 'acp_help_phpbb'; + $this->page_title = 'ACP_HELP_PHPBB'; + + $submit = ($request->is_set_post('submit')) ? true : false; + + $form_key = 'acp_help_phpbb'; + add_form_key($form_key); + $error = array(); + + if ($submit && !check_form_key($form_key)) + { + $error[] = $user->lang['FORM_INVALID']; + } + // Do not write values if there is an error + if (count($error)) + { + $submit = false; + } + + // generate a unique id if necessary + if (!isset($config['questionnaire_unique_id'])) + { + $install_id = unique_id(); + $config->set('questionnaire_unique_id', $install_id); + } + else + { + $install_id = $config['questionnaire_unique_id']; + } + + $collector = new phpbb_questionnaire_data_collector($install_id); + + // Add data provider + $collector->add_data_provider(new phpbb_questionnaire_php_data_provider()); + $collector->add_data_provider(new phpbb_questionnaire_system_data_provider()); + $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config)); + + /** + * Event to modify ACP help phpBB page and/or listen to submit + * + * @event core.acp_help_phpbb_submit_before + * @var boolean submit Do we display the form or process the submission + * @since 3.2.0-RC2 + */ + $vars = array('submit'); + extract($phpbb_dispatcher->trigger_event('core.acp_help_phpbb_submit_before', compact($vars))); + + if ($submit) + { + $config->set('help_send_statistics', $request->variable('help_send_statistics', false)); + $response = $request->variable('send_statistics_response', ''); + + $config->set('help_send_statistics_time', time()); + + if (!empty($response)) + { + $decoded_response = json_decode(htmlspecialchars_decode($response), true); + + if ($decoded_response && isset($decoded_response['status']) && $decoded_response['status'] == 'ok') + { + trigger_error($user->lang('THANKS_SEND_STATISTICS') . adm_back_link($this->u_action)); + } + else + { + trigger_error($user->lang('FAIL_SEND_STATISTICS') . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); + } + + $template->assign_vars(array( + 'U_COLLECT_STATS' => $collect_url, + 'S_COLLECT_STATS' => (!empty($config['help_send_statistics'])) ? true : false, + 'S_STATS' => $collector->get_data_raw(), + 'S_STATS_DATA' => json_encode($collector->get_data_raw()), + 'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.$phpEx"), + 'U_ACTION' => $this->u_action, + // Pass earliest time we should try to send stats again + 'COLLECT_STATS_TIME' => intval($config['help_send_statistics_time']) + 86400, + )); + + $raw = $collector->get_data_raw(); + + foreach ($raw as $provider => $data) + { + if ($provider == 'install_id') + { + $data = array($provider => $data); + } + + $template->assign_block_vars('providers', array( + 'NAME' => htmlspecialchars($provider), + )); + + foreach ($data as $key => $value) + { + if (is_array($value)) + { + $value = utf8_wordwrap(serialize($value), 75, "\n", true); + } + + $template->assign_block_vars('providers.values', array( + 'KEY' => utf8_htmlspecialchars($key), + 'VALUE' => utf8_htmlspecialchars($value), + )); + } + } + } +} diff --git a/install/update/new/includes/acp/acp_main.php b/install/update/new/includes/acp/acp_main.php new file mode 100644 index 0000000..27fac54 --- /dev/null +++ b/install/update/new/includes/acp/acp_main.php @@ -0,0 +1,707 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_main +{ + var $u_action; + + function main($id, $mode) + { + global $config, $db, $cache, $user, $auth, $template, $request, $phpbb_log; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container, $phpbb_dispatcher, $phpbb_filesystem; + + // Show restore permissions notice + if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) + { + $this->tpl_name = 'acp_main'; + $this->page_title = 'ACP_MAIN'; + + $sql = 'SELECT user_id, username, user_colour + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user->data['user_perm_from']; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $perm_from = get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']); + + $template->assign_vars(array( + 'S_RESTORE_PERMISSIONS' => true, + 'U_RESTORE_PERMISSIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm'), + 'PERM_FROM' => $perm_from, + 'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm')), + )); + + return; + } + + $action = $request->variable('action', ''); + + if ($action) + { + if ($action === 'admlogout') + { + $user->unset_admin(); + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + if (!confirm_box(true)) + { + switch ($action) + { + case 'online': + $confirm = true; + $confirm_lang = 'RESET_ONLINE_CONFIRM'; + break; + case 'stats': + $confirm = true; + $confirm_lang = 'RESYNC_STATS_CONFIRM'; + break; + case 'user': + $confirm = true; + $confirm_lang = 'RESYNC_POSTCOUNTS_CONFIRM'; + break; + case 'date': + $confirm = true; + $confirm_lang = 'RESET_DATE_CONFIRM'; + break; + case 'db_track': + $confirm = true; + $confirm_lang = 'RESYNC_POST_MARKING_CONFIRM'; + break; + case 'purge_cache': + $confirm = true; + $confirm_lang = 'PURGE_CACHE_CONFIRM'; + break; + case 'purge_sessions': + $confirm = true; + $confirm_lang = 'PURGE_SESSIONS_CONFIRM'; + break; + + default: + $confirm = true; + $confirm_lang = 'CONFIRM_OPERATION'; + } + + if ($confirm) + { + confirm_box(false, $user->lang[$confirm_lang], build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + ))); + } + } + else + { + switch ($action) + { + + case 'online': + if (!$auth->acl_get('a_board')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $config->set('record_online_users', 1, false); + $config->set('record_online_date', time(), false); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_ONLINE'); + + if ($request->is_ajax()) + { + trigger_error('RESET_ONLINE_SUCCESS'); + } + break; + + case 'stats': + if (!$auth->acl_get('a_board')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql = 'SELECT COUNT(post_id) AS stat + FROM ' . POSTS_TABLE . ' + WHERE post_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $config->set('num_posts', (int) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + $sql = 'SELECT COUNT(topic_id) AS stat + FROM ' . TOPICS_TABLE . ' + WHERE topic_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $config->set('num_topics', (int) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + $sql = 'SELECT COUNT(user_id) AS stat + FROM ' . USERS_TABLE . ' + WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')'; + $result = $db->sql_query($sql); + $config->set('num_users', (int) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + $sql = 'SELECT COUNT(attach_id) as stat + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 0'; + $result = $db->sql_query($sql); + $config->set('num_files', (int) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + $sql = 'SELECT SUM(filesize) as stat + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 0'; + $result = $db->sql_query($sql); + $config->set('upload_dir_size', (float) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + if (!function_exists('update_last_username')) + { + include($phpbb_root_path . "includes/functions_user.$phpEx"); + } + update_last_username(); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_STATS'); + + if ($request->is_ajax()) + { + trigger_error('RESYNC_STATS_SUCCESS'); + } + break; + + case 'user': + if (!$auth->acl_get('a_board')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Resync post counts + $start = $max_post_id = 0; + + // Find the maximum post ID, we can only stop the cycle when we've reached it + $sql = 'SELECT MAX(forum_last_post_id) as max_post_id + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + $max_post_id = (int) $db->sql_fetchfield('max_post_id'); + $db->sql_freeresult($result); + + // No maximum post id? :o + if (!$max_post_id) + { + $sql = 'SELECT MAX(post_id) as max_post_id + FROM ' . POSTS_TABLE; + $result = $db->sql_query($sql); + $max_post_id = (int) $db->sql_fetchfield('max_post_id'); + $db->sql_freeresult($result); + } + + // Still no maximum post id? Then we are finished + if (!$max_post_id) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POSTCOUNTS'); + break; + } + + $step = ($config['num_posts']) ? (max((int) ($config['num_posts'] / 5), 20000)) : 20000; + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0'); + + while ($start < $max_post_id) + { + $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id + FROM ' . POSTS_TABLE . ' + WHERE post_id BETWEEN ' . ($start + 1) . ' AND ' . ($start + $step) . ' + AND post_postcount = 1 AND post_visibility = ' . ITEM_APPROVED . ' + GROUP BY poster_id'; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $sql = 'UPDATE ' . USERS_TABLE . " SET user_posts = user_posts + {$row['num_posts']} WHERE user_id = {$row['poster_id']}"; + $db->sql_query($sql); + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + $start += $step; + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POSTCOUNTS'); + + if ($request->is_ajax()) + { + trigger_error('RESYNC_POSTCOUNTS_SUCCESS'); + } + break; + + case 'date': + if (!$auth->acl_get('a_board')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $config->set('board_startdate', time() - 1); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_DATE'); + + if ($request->is_ajax()) + { + trigger_error('RESET_DATE_SUCCESS'); + } + break; + + case 'db_track': + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); + break; + + default: + $db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE); + break; + } + + // This can get really nasty... therefore we only do the last six months + $get_from_time = time() - (6 * 4 * 7 * 24 * 60 * 60); + + // Select forum ids, do not include categories + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type <> ' . FORUM_CAT; + $result = $db->sql_query($sql); + + $forum_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + // Any global announcements? ;) + $forum_ids[] = 0; + + // Now go through the forums and get us some topics... + foreach ($forum_ids as $forum_id) + { + $sql = 'SELECT p.poster_id, p.topic_id + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t + WHERE t.forum_id = ' . $forum_id . ' + AND t.topic_moved_id = 0 + AND t.topic_last_post_time > ' . $get_from_time . ' + AND t.topic_id = p.topic_id + AND p.poster_id <> ' . ANONYMOUS . ' + GROUP BY p.poster_id, p.topic_id'; + $result = $db->sql_query($sql); + + $posted = array(); + while ($row = $db->sql_fetchrow($result)) + { + $posted[$row['poster_id']][] = $row['topic_id']; + } + $db->sql_freeresult($result); + + $sql_ary = array(); + foreach ($posted as $user_id => $topic_row) + { + foreach ($topic_row as $topic_id) + { + $sql_ary[] = array( + 'user_id' => (int) $user_id, + 'topic_id' => (int) $topic_id, + 'topic_posted' => 1, + ); + } + } + unset($posted); + + if (count($sql_ary)) + { + $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); + } + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POST_MARKING'); + + if ($request->is_ajax()) + { + trigger_error('RESYNC_POST_MARKING_SUCCESS'); + } + break; + + case 'purge_cache': + $config->increment('assets_version', 1); + $cache->purge(); + + // Remove old renderers from the text_formatter service. Since this + // operation is performed after the cache is purged, there is not "current" + // renderer and in effect all renderers will be purged + $phpbb_container->get('text_formatter.cache')->tidy(); + + // Clear permissions + $auth->acl_clear_prefetch(); + phpbb_cache_moderators($db, $cache, $auth); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PURGE_CACHE'); + + if ($request->is_ajax()) + { + trigger_error('PURGE_CACHE_SUCCESS'); + } + break; + + case 'purge_sessions': + if ((int) $user->data['user_type'] !== USER_FOUNDER) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $tables = array(CONFIRM_TABLE, SESSIONS_TABLE); + + foreach ($tables as $table) + { + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $db->sql_query("DELETE FROM $table"); + break; + + default: + $db->sql_query("TRUNCATE TABLE $table"); + break; + } + } + + // let's restore the admin session + $reinsert_ary = array( + 'session_id' => (string) $user->session_id, + 'session_page' => (string) substr($user->page['page'], 0, 199), + 'session_forum_id' => $user->page['forum'], + 'session_user_id' => (int) $user->data['user_id'], + 'session_start' => (int) $user->data['session_start'], + 'session_last_visit' => (int) $user->data['session_last_visit'], + 'session_time' => (int) $user->time_now, + 'session_browser' => (string) trim(substr($user->browser, 0, 149)), + 'session_forwarded_for' => (string) $user->forwarded_for, + 'session_ip' => (string) $user->ip, + 'session_autologin' => (int) $user->data['session_autologin'], + 'session_admin' => 1, + 'session_viewonline' => (int) $user->data['session_viewonline'], + ); + + $sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $reinsert_ary); + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PURGE_SESSIONS'); + + if ($request->is_ajax()) + { + trigger_error('PURGE_SESSIONS_SUCCESS'); + } + break; + } + } + } + + // Version check + $user->add_lang('install'); + + if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.4.0', '<')) + { + $template->assign_vars(array( + 'S_PHP_VERSION_OLD' => true, + 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], PHP_VERSION, '5.4.0', '', ''), + )); + } + + if ($auth->acl_get('a_board')) + { + $version_helper = $phpbb_container->get('version_helper'); + try + { + $recheck = $request->variable('versioncheck_force', false); + $updates_available = $version_helper->get_update_on_branch($recheck); + $upgrades_available = $version_helper->get_suggested_updates(); + if (!empty($upgrades_available)) + { + $upgrades_available = array_pop($upgrades_available); + } + + $template->assign_vars(array( + 'S_VERSION_UP_TO_DATE' => empty($updates_available), + 'S_VERSION_UPGRADEABLE' => !empty($upgrades_available), + 'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false, + )); + } + catch (\RuntimeException $e) + { + $message = call_user_func_array(array($user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $template->assign_vars(array( + 'S_VERSIONCHECK_FAIL' => true, + 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '', + )); + } + } + else + { + // We set this template var to true, to not display an outdated version notice. + $template->assign_var('S_VERSION_UP_TO_DATE', true); + } + + // Incomplete update? + if (phpbb_version_compare($config['version'], PHPBB_VERSION, '<')) + { + $template->assign_var('S_UPDATE_INCOMPLETE', true); + } + + /** + * Notice admin + * + * @event core.acp_main_notice + * @since 3.1.0-RC3 + */ + $phpbb_dispatcher->dispatch('core.acp_main_notice'); + + // Get forum statistics + $total_posts = $config['num_posts']; + $total_topics = $config['num_topics']; + $total_users = $config['num_users']; + $total_files = $config['num_files']; + + $start_date = $user->format_date($config['board_startdate']); + + $boarddays = (time() - $config['board_startdate']) / 86400; + + $posts_per_day = sprintf('%.2f', $total_posts / $boarddays); + $topics_per_day = sprintf('%.2f', $total_topics / $boarddays); + $users_per_day = sprintf('%.2f', $total_users / $boarddays); + $files_per_day = sprintf('%.2f', $total_files / $boarddays); + + $upload_dir_size = get_formatted_filesize($config['upload_dir_size']); + + $avatar_dir_size = 0; + + if ($avatar_dir = @opendir($phpbb_root_path . $config['avatar_path'])) + { + while (($file = readdir($avatar_dir)) !== false) + { + if ($file[0] != '.' && $file != 'CVS' && strpos($file, 'index.') === false) + { + $avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file); + } + } + closedir($avatar_dir); + + $avatar_dir_size = get_formatted_filesize($avatar_dir_size); + } + else + { + // Couldn't open Avatar dir. + $avatar_dir_size = $user->lang['NOT_AVAILABLE']; + } + + if ($posts_per_day > $total_posts) + { + $posts_per_day = $total_posts; + } + + if ($topics_per_day > $total_topics) + { + $topics_per_day = $total_topics; + } + + if ($users_per_day > $total_users) + { + $users_per_day = $total_users; + } + + if ($files_per_day > $total_files) + { + $files_per_day = $total_files; + } + + if ($config['allow_attachments'] || $config['allow_pm_attach']) + { + $sql = 'SELECT COUNT(attach_id) AS total_orphan + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 1 + AND filetime < ' . (time() - 3*60*60); + $result = $db->sql_query($sql); + $total_orphan = (int) $db->sql_fetchfield('total_orphan'); + $db->sql_freeresult($result); + } + else + { + $total_orphan = false; + } + + $dbsize = get_database_size(); + + $template->assign_vars(array( + 'TOTAL_POSTS' => $total_posts, + 'POSTS_PER_DAY' => $posts_per_day, + 'TOTAL_TOPICS' => $total_topics, + 'TOPICS_PER_DAY' => $topics_per_day, + 'TOTAL_USERS' => $total_users, + 'USERS_PER_DAY' => $users_per_day, + 'TOTAL_FILES' => $total_files, + 'FILES_PER_DAY' => $files_per_day, + 'START_DATE' => $start_date, + 'AVATAR_DIR_SIZE' => $avatar_dir_size, + 'DBSIZE' => $dbsize, + 'UPLOAD_DIR_SIZE' => $upload_dir_size, + 'TOTAL_ORPHAN' => $total_orphan, + 'S_TOTAL_ORPHAN' => ($total_orphan === false) ? false : true, + 'GZIP_COMPRESSION' => ($config['gzip_compress'] && @extension_loaded('zlib')) ? $user->lang['ON'] : $user->lang['OFF'], + 'DATABASE_INFO' => $db->sql_server_info(), + 'PHP_VERSION_INFO' => PHP_VERSION, + 'BOARD_VERSION' => $config['version'], + + 'U_ACTION' => $this->u_action, + 'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=admin'), + 'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'), + 'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'), + 'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'versioncheck_force=1'), + 'U_ATTACH_ORPHAN' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=acp_attachments&mode=orphan'), + + 'S_VERSIONCHECK' => ($auth->acl_get('a_board')) ? true : false, + 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false, + 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, + ) + ); + + $log_data = array(); + $log_count = false; + + if ($auth->acl_get('a_viewlogs')) + { + view_log('admin', $log_data, $log_count, 5); + + foreach ($log_data as $row) + { + $template->assign_block_vars('log', array( + 'USERNAME' => $row['username_full'], + 'IP' => $row['ip'], + 'DATE' => $user->format_date($row['time']), + 'ACTION' => $row['action']) + ); + } + } + + if ($auth->acl_get('a_user')) + { + $user->add_lang('memberlist'); + + $inactive = array(); + $inactive_count = 0; + + view_inactive_users($inactive, $inactive_count, 10); + + foreach ($inactive as $row) + { + $template->assign_block_vars('inactive', array( + 'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']), + 'REMINDED_DATE' => $user->format_date($row['user_reminded_time']), + 'JOINED' => $user->format_date($row['user_regdate']), + 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']), + + 'REASON' => $row['inactive_reason'], + 'USER_ID' => $row['user_id'], + 'POSTS' => ($row['user_posts']) ? $row['user_posts'] : 0, + 'REMINDED' => $row['user_reminded'], + + 'REMINDED_EXPLAIN' => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview')), + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), + 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + + 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}"), + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&sr=posts") : '', + )); + } + + $option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE'); + if ($config['email_enable']) + { + $option_ary += array('remind' => 'REMIND'); + } + + $template->assign_vars(array( + 'S_INACTIVE_USERS' => true, + 'S_INACTIVE_OPTIONS' => build_select($option_ary)) + ); + } + + // Warn if install is still present + if (!defined('IN_INSTALL') && !$phpbb_container->getParameter('allow_install_dir') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install')) + { + $template->assign_var('S_REMOVE_INSTALL', true); + } + + // Warn if no search index is created + if ($config['num_posts'] && class_exists($config['search_type'])) + { + $error = false; + $search_type = $config['search_type']; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if (!$search->index_created()) + { + $template->assign_vars(array( + 'S_SEARCH_INDEX_MISSING' => true, + 'L_NO_SEARCH_INDEX' => $user->lang('NO_SEARCH_INDEX', $search->get_name(), '', ''), + )); + } + } + + if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && $phpbb_filesystem->is_writable($phpbb_root_path . 'config.' . $phpEx)) + { + // World-Writable? (000x) + $template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002)); + } + + if (extension_loaded('mbstring')) + { + $template->assign_vars(array( + 'S_MBSTRING_LOADED' => true, + 'S_MBSTRING_FUNC_OVERLOAD_FAIL' => (intval(@ini_get('mbstring.func_overload')) & (MB_OVERLOAD_MAIL | MB_OVERLOAD_STRING)), + 'S_MBSTRING_ENCODING_TRANSLATION_FAIL' => (@ini_get('mbstring.encoding_translation') != 0), + 'S_MBSTRING_HTTP_INPUT_FAIL' => !in_array(@ini_get('mbstring.http_input'), array('pass', '')), + 'S_MBSTRING_HTTP_OUTPUT_FAIL' => !in_array(@ini_get('mbstring.http_output'), array('pass', '')), + )); + } + + // Fill dbms version if not yet filled + if (empty($config['dbms_version'])) + { + $config->set('dbms_version', $db->sql_server_info(true)); + } + + $this->tpl_name = 'acp_main'; + $this->page_title = 'ACP_MAIN'; + } +} diff --git a/install/update/new/includes/acp/acp_permissions.php b/install/update/new/includes/acp/acp_permissions.php new file mode 100644 index 0000000..59bf366 --- /dev/null +++ b/install/update/new/includes/acp/acp_permissions.php @@ -0,0 +1,1346 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_permissions +{ + var $u_action; + var $permission_dropdown; + + /** + * @var $phpbb_permissions \phpbb\permissions + */ + protected $permissions; + + function main($id, $mode) + { + global $db, $user, $auth, $template, $phpbb_container, $request; + global $config, $phpbb_root_path, $phpEx; + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + if (!class_exists('auth_admin')) + { + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + } + + $this->permissions = $phpbb_container->get('acl.permissions'); + + $auth_admin = new auth_admin(); + + $user->add_lang('acp/permissions'); + add_permission_language(); + + $this->tpl_name = 'acp_permissions'; + + // Trace has other vars + if ($mode == 'trace') + { + $user_id = $request->variable('u', 0); + $forum_id = $request->variable('f', 0); + $permission = $request->variable('auth', ''); + + $this->tpl_name = 'permission_trace'; + + if ($user_id && isset($auth_admin->acl_options['id'][$permission]) && $auth->acl_get('a_viewauth')) + { + $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $this->permissions->get_permission_lang($permission)); + $this->permission_trace($user_id, $forum_id, $permission); + return; + } + trigger_error('NO_MODE', E_USER_ERROR); + } + + // Copy forum permissions + if ($mode == 'setting_forum_copy') + { + $this->tpl_name = 'permission_forum_copy'; + + if ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) + { + $this->page_title = 'ACP_FORUM_PERMISSIONS_COPY'; + $this->copy_forum_permissions(); + return; + } + + trigger_error('NO_MODE', E_USER_ERROR); + } + + // Set some vars + $action = $request->variable('action', array('' => 0)); + $action = key($action); + $action = (isset($_POST['psubmit'])) ? 'apply_permissions' : $action; + + $all_forums = $request->variable('all_forums', 0); + $subforum_id = $request->variable('subforum_id', 0); + $forum_id = $request->variable('forum_id', array(0)); + + $username = $request->variable('username', array(''), true); + $usernames = $request->variable('usernames', '', true); + $user_id = $request->variable('user_id', array(0)); + + $group_id = $request->variable('group_id', array(0)); + $select_all_groups = $request->variable('select_all_groups', 0); + + $form_name = 'acp_permissions'; + add_form_key($form_name); + + // If select all groups is set, we pre-build the group id array (this option is used for other screens to link to the permission settings screen) + if ($select_all_groups) + { + // Add default groups to selection + $sql_and = (!$config['coppa_enable']) ? " AND group_name <> 'REGISTERED_COPPA'" : ''; + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . ' + WHERE group_type = ' . GROUP_SPECIAL . " + $sql_and"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $group_id[] = $row['group_id']; + } + $db->sql_freeresult($result); + } + + // Map usernames to ids and vice versa + if ($usernames) + { + $username = explode("\n", $usernames); + } + unset($usernames); + + if (count($username) && !count($user_id)) + { + user_get_id_name($user_id, $username); + + if (!count($user_id)) + { + trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + unset($username); + + // Build forum ids (of all forums are checked or subforum listing used) + if ($all_forums) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id'; + $result = $db->sql_query($sql); + + $forum_id = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_id[] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + } + else if ($subforum_id) + { + $forum_id = array(); + foreach (get_forum_branch($subforum_id, 'children') as $row) + { + $forum_id[] = (int) $row['forum_id']; + } + } + + // Define some common variables for every mode + $permission_scope = (strpos($mode, '_global') !== false) ? 'global' : 'local'; + + // Showing introductionary page? + if ($mode == 'intro') + { + $this->page_title = 'ACP_PERMISSIONS'; + + $template->assign_vars(array( + 'S_INTRO' => true) + ); + + return; + } + + switch ($mode) + { + case 'setting_user_global': + case 'setting_group_global': + $this->permission_dropdown = array('u_', 'm_', 'a_'); + $permission_victim = ($mode == 'setting_user_global') ? array('user') : array('group'); + $this->page_title = ($mode == 'setting_user_global') ? 'ACP_USERS_PERMISSIONS' : 'ACP_GROUPS_PERMISSIONS'; + break; + + case 'setting_user_local': + case 'setting_group_local': + $this->permission_dropdown = array('f_', 'm_'); + $permission_victim = ($mode == 'setting_user_local') ? array('user', 'forums') : array('group', 'forums'); + $this->page_title = ($mode == 'setting_user_local') ? 'ACP_USERS_FORUM_PERMISSIONS' : 'ACP_GROUPS_FORUM_PERMISSIONS'; + break; + + case 'setting_admin_global': + case 'setting_mod_global': + $this->permission_dropdown = (strpos($mode, '_admin_') !== false) ? array('a_') : array('m_'); + $permission_victim = array('usergroup'); + $this->page_title = ($mode == 'setting_admin_global') ? 'ACP_ADMINISTRATORS' : 'ACP_GLOBAL_MODERATORS'; + break; + + case 'setting_mod_local': + case 'setting_forum_local': + $this->permission_dropdown = ($mode == 'setting_mod_local') ? array('m_') : array('f_'); + $permission_victim = array('forums', 'usergroup'); + $this->page_title = ($mode == 'setting_mod_local') ? 'ACP_FORUM_MODERATORS' : 'ACP_FORUM_PERMISSIONS'; + break; + + case 'view_admin_global': + case 'view_user_global': + case 'view_mod_global': + $this->permission_dropdown = ($mode == 'view_admin_global') ? array('a_') : (($mode == 'view_user_global') ? array('u_') : array('m_')); + $permission_victim = array('usergroup_view'); + $this->page_title = ($mode == 'view_admin_global') ? 'ACP_VIEW_ADMIN_PERMISSIONS' : (($mode == 'view_user_global') ? 'ACP_VIEW_USER_PERMISSIONS' : 'ACP_VIEW_GLOBAL_MOD_PERMISSIONS'); + break; + + case 'view_mod_local': + case 'view_forum_local': + $this->permission_dropdown = ($mode == 'view_mod_local') ? array('m_') : array('f_'); + $permission_victim = array('forums', 'usergroup_view'); + $this->page_title = ($mode == 'view_mod_local') ? 'ACP_VIEW_FORUM_MOD_PERMISSIONS' : 'ACP_VIEW_FORUM_PERMISSIONS'; + break; + + default: + trigger_error('NO_MODE', E_USER_ERROR); + break; + } + + $template->assign_vars(array( + 'L_TITLE' => $user->lang[$this->page_title], + 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN']) + ); + + // Get permission type + $permission_type = $request->variable('type', $this->permission_dropdown[0]); + + if (!in_array($permission_type, $this->permission_dropdown)) + { + trigger_error($user->lang['WRONG_PERMISSION_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Handle actions + if (strpos($mode, 'setting_') === 0 && $action) + { + switch ($action) + { + case 'delete': + if (confirm_box(true)) + { + // All users/groups selected? + $all_users = (isset($_POST['all_users'])) ? true : false; + $all_groups = (isset($_POST['all_groups'])) ? true : false; + + if ($all_users || $all_groups) + { + $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); + + if ($all_users && count($items['user_ids'])) + { + $user_id = $items['user_ids']; + } + else if ($all_groups && count($items['group_ids'])) + { + $group_id = $items['group_ids']; + } + } + + if (count($user_id) || count($group_id)) + { + $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); + } + else + { + trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + else + { + if (isset($_POST['cancel'])) + { + $u_redirect = $this->u_action . '&type=' . $permission_type; + foreach ($forum_id as $fid) + { + $u_redirect .= '&forum_id[]=' . $fid; + } + redirect($u_redirect); + } + + $s_hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'action' => array($action => 1), + 'user_id' => $user_id, + 'group_id' => $group_id, + 'forum_id' => $forum_id, + 'type' => $permission_type, + ); + if (isset($_POST['all_users'])) + { + $s_hidden_fields['all_users'] = 1; + } + if (isset($_POST['all_groups'])) + { + $s_hidden_fields['all_groups'] = 1; + } + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); + } + break; + + case 'apply_permissions': + if (!isset($_POST['setting'])) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + } + + $this->set_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id); + break; + + case 'apply_all_permissions': + if (!isset($_POST['setting'])) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + } + + $this->set_all_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id); + break; + } + } + + // Go through the screens/options needed and present them in correct order + foreach ($permission_victim as $victim) + { + switch ($victim) + { + case 'forum_dropdown': + + if (count($forum_id)) + { + $this->check_existence('forum', $forum_id); + continue 2; + } + + $template->assign_vars(array( + 'S_SELECT_FORUM' => true, + 'S_FORUM_OPTIONS' => make_forum_select(false, false, true, false, false)) + ); + + break; + + case 'forums': + + if (count($forum_id)) + { + $this->check_existence('forum', $forum_id); + continue 2; + } + + $forum_list = make_forum_select(false, false, true, false, false, false, true); + + // Build forum options + $s_forum_options = ''; + foreach ($forum_list as $f_id => $f_row) + { + $s_forum_options .= ''; + } + + // Build subforum options + $s_subforum_options = $this->build_subforum_options($forum_list); + + $template->assign_vars(array( + 'S_SELECT_FORUM' => true, + 'S_FORUM_OPTIONS' => $s_forum_options, + 'S_SUBFORUM_OPTIONS' => $s_subforum_options, + 'S_FORUM_ALL' => true, + 'S_FORUM_MULTIPLE' => true) + ); + + break; + + case 'user': + + if (count($user_id)) + { + $this->check_existence('user', $user_id); + continue 2; + } + + $template->assign_vars(array( + 'S_SELECT_USER' => true, + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_victim&field=username&select_single=true'), + )); + + break; + + case 'group': + + if (count($group_id)) + { + $this->check_existence('group', $group_id); + continue 2; + } + + $template->assign_vars(array( + 'S_SELECT_GROUP' => true, + 'S_GROUP_OPTIONS' => group_select_options(false, false, false), // Show all groups + )); + + break; + + case 'usergroup': + case 'usergroup_view': + + $all_users = (isset($_POST['all_users'])) ? true : false; + $all_groups = (isset($_POST['all_groups'])) ? true : false; + + if ((count($user_id) && !$all_users) || (count($group_id) && !$all_groups)) + { + if (count($user_id)) + { + $this->check_existence('user', $user_id); + } + + if (count($group_id)) + { + $this->check_existence('group', $group_id); + } + + continue 2; + } + + // Now we check the users... because the "all"-selection is different here (all defined users/groups) + $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); + + if ($all_users && count($items['user_ids'])) + { + $user_id = $items['user_ids']; + continue 2; + } + + if ($all_groups && count($items['group_ids'])) + { + $group_id = $items['group_ids']; + continue 2; + } + + $template->assign_vars(array( + 'S_SELECT_USERGROUP' => ($victim == 'usergroup') ? true : false, + 'S_SELECT_USERGROUP_VIEW' => ($victim == 'usergroup_view') ? true : false, + 'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'], + 'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'], + 'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], false), // Show all groups + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=add_user&field=username&select_single=true'), + )); + + break; + } + + // The S_ALLOW_SELECT parameter below is a measure to lower memory usage. + // If there are more than 5 forums selected the admin is not able to select all users/groups too. + // We need to see if the number of forums can be increased or need to be decreased. + + // Setting permissions screen + $s_hidden_fields = build_hidden_fields(array( + 'user_id' => $user_id, + 'group_id' => $group_id, + 'forum_id' => $forum_id, + 'type' => $permission_type, + )); + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + 'ANONYMOUS_USER_ID' => ANONYMOUS, + + 'S_SELECT_VICTIM' => true, + 'S_ALLOW_ALL_SELECT' => (count($forum_id) > 5) ? false : true, + 'S_CAN_SELECT_USER' => ($auth->acl_get('a_authusers')) ? true : false, + 'S_CAN_SELECT_GROUP' => ($auth->acl_get('a_authgroups')) ? true : false, + 'S_HIDDEN_FIELDS' => $s_hidden_fields) + ); + + // Let the forum names being displayed + if (count($forum_id)) + { + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id) . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql); + + $forum_names = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_names[] = $row['forum_name']; + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_FORUM_NAMES' => (count($forum_names)) ? true : false, + 'FORUM_NAMES' => implode($user->lang['COMMA_SEPARATOR'], $forum_names)) + ); + } + + return; + } + + // Setting permissions screen + $s_hidden_fields = build_hidden_fields(array( + 'user_id' => $user_id, + 'group_id' => $group_id, + 'forum_id' => $forum_id, + 'type' => $permission_type, + )); + + // Do not allow forum_ids being set and no other setting defined (will bog down the server too much) + if (count($forum_id) && !count($user_id) && !count($group_id)) + { + trigger_error($user->lang['ONLY_FORUM_DEFINED'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $template->assign_vars(array( + 'S_PERMISSION_DROPDOWN' => (count($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, + 'L_PERMISSION_TYPE' => $this->permissions->get_type_lang($permission_type), + + 'U_ACTION' => $this->u_action, + 'S_HIDDEN_FIELDS' => $s_hidden_fields) + ); + + if (strpos($mode, 'setting_') === 0) + { + $template->assign_vars(array( + 'S_SETTING_PERMISSIONS' => true) + ); + + $hold_ary = $auth_admin->get_mask('set', (count($user_id)) ? $user_id : false, (count($group_id)) ? $group_id : false, (count($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NO); + $auth_admin->display_mask('set', $permission_type, $hold_ary, ((count($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); + } + else + { + $template->assign_vars(array( + 'S_VIEWING_PERMISSIONS' => true) + ); + + $hold_ary = $auth_admin->get_mask('view', (count($user_id)) ? $user_id : false, (count($group_id)) ? $group_id : false, (count($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NEVER); + $auth_admin->display_mask('view', $permission_type, $hold_ary, ((count($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); + } + } + + /** + * Build +subforum options + */ + function build_subforum_options($forum_list) + { + global $user; + + $s_options = ''; + + $forum_list = array_merge($forum_list); + + foreach ($forum_list as $key => $row) + { + if ($row['disabled']) + { + continue; + } + + $s_options .= ''; + } + + return $s_options; + } + + /** + * Build dropdown field for changing permission types + */ + function build_permission_dropdown($options, $default_option, $permission_scope) + { + global $auth; + + $s_dropdown_options = ''; + foreach ($options as $setting) + { + if (!$auth->acl_get('a_' . str_replace('_', '', $setting) . 'auth')) + { + continue; + } + + $selected = ($setting == $default_option) ? ' selected="selected"' : ''; + $l_setting = $this->permissions->get_type_lang($setting, $permission_scope); + $s_dropdown_options .= ''; + } + + return $s_dropdown_options; + } + + /** + * Check if selected items exist. Remove not found ids and if empty return error. + */ + function check_existence($mode, &$ids) + { + global $db, $user; + + switch ($mode) + { + case 'user': + $table = USERS_TABLE; + $sql_id = 'user_id'; + break; + + case 'group': + $table = GROUPS_TABLE; + $sql_id = 'group_id'; + break; + + case 'forum': + $table = FORUMS_TABLE; + $sql_id = 'forum_id'; + break; + } + + if (count($ids)) + { + $sql = "SELECT $sql_id + FROM $table + WHERE " . $db->sql_in_set($sql_id, $ids); + $result = $db->sql_query($sql); + + $ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $ids[] = (int) $row[$sql_id]; + } + $db->sql_freeresult($result); + } + + if (!count($ids)) + { + trigger_error($user->lang['SELECTED_' . strtoupper($mode) . '_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + /** + * Apply permissions + */ + function set_permissions($mode, $permission_type, $auth_admin, &$user_id, &$group_id) + { + global $db, $cache, $user, $auth; + global $request; + + $psubmit = $request->variable('psubmit', array(0 => array(0 => 0))); + + // User or group to be set? + $ug_type = (count($user_id)) ? 'user' : 'group'; + + // Check the permission setting again + if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // We loop through the auth settings defined in our submit + $ug_id = key($psubmit); + $forum_id = key($psubmit[$ug_id]); + + $settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST); + if (empty($settings) || empty($settings[$ug_id]) || empty($settings[$ug_id][$forum_id])) + { + trigger_error('WRONG_PERMISSION_SETTING_FORMAT', E_USER_WARNING); + } + + $auth_settings = $settings[$ug_id][$forum_id]; + + // Do we have a role we want to set? + $roles = $request->variable('role', array(0 => array(0 => 0)), false, \phpbb\request\request_interface::POST); + $assigned_role = (isset($roles[$ug_id][$forum_id])) ? (int) $roles[$ug_id][$forum_id] : 0; + + // Do the admin want to set these permissions to other items too? + $inherit = $request->variable('inherit', array(0 => array(0))); + + $ug_id = array($ug_id); + $forum_id = array($forum_id); + + if (count($inherit)) + { + foreach ($inherit as $_ug_id => $forum_id_ary) + { + // Inherit users/groups? + if (!in_array($_ug_id, $ug_id)) + { + $ug_id[] = $_ug_id; + } + + // Inherit forums? + $forum_id = array_merge($forum_id, array_keys($forum_id_ary)); + } + } + + $forum_id = array_unique($forum_id); + + // If the auth settings differ from the assigned role, then do not set a role... + if ($assigned_role) + { + if (!$this->check_assigned_role($assigned_role, $auth_settings)) + { + $assigned_role = 0; + } + } + + // Update the permission set... + $auth_admin->acl_set($ug_type, $forum_id, $ug_id, $auth_settings, $assigned_role); + + // Do we need to recache the moderator lists? + if ($permission_type == 'm_') + { + phpbb_cache_moderators($db, $cache, $auth); + } + + // Remove users who are now moderators or admins from everyones foes list + if ($permission_type == 'm_' || $permission_type == 'a_') + { + phpbb_update_foes($db, $auth, $group_id, $user_id); + } + + $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_id, $forum_id); + + meta_refresh(5, $this->u_action); + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + } + + /** + * Apply all permissions + */ + function set_all_permissions($mode, $permission_type, $auth_admin, &$user_id, &$group_id) + { + global $db, $cache, $user, $auth; + global $request; + + // User or group to be set? + $ug_type = (count($user_id)) ? 'user' : 'group'; + + // Check the permission setting again + if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $auth_settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST); + $auth_roles = $request->variable('role', array(0 => array(0 => 0)), false, \phpbb\request\request_interface::POST); + $ug_ids = $forum_ids = array(); + + // We need to go through the auth settings + foreach ($auth_settings as $ug_id => $forum_auth_row) + { + $ug_id = (int) $ug_id; + $ug_ids[] = $ug_id; + + foreach ($forum_auth_row as $forum_id => $auth_options) + { + $forum_id = (int) $forum_id; + $forum_ids[] = $forum_id; + + // Check role... + $assigned_role = (isset($auth_roles[$ug_id][$forum_id])) ? (int) $auth_roles[$ug_id][$forum_id] : 0; + + // If the auth settings differ from the assigned role, then do not set a role... + if ($assigned_role) + { + if (!$this->check_assigned_role($assigned_role, $auth_options)) + { + $assigned_role = 0; + } + } + + // Update the permission set... + $auth_admin->acl_set($ug_type, $forum_id, $ug_id, $auth_options, $assigned_role, false); + } + } + + $auth_admin->acl_clear_prefetch(); + + // Do we need to recache the moderator lists? + if ($permission_type == 'm_') + { + phpbb_cache_moderators($db, $cache, $auth); + } + + // Remove users who are now moderators or admins from everyones foes list + if ($permission_type == 'm_' || $permission_type == 'a_') + { + phpbb_update_foes($db, $auth, $group_id, $user_id); + } + + $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids); + + if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') + { + meta_refresh(5, $this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids)); + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids))); + } + else + { + meta_refresh(5, $this->u_action); + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + } + } + + /** + * Compare auth settings with auth settings from role + * returns false if they differ, true if they are equal + */ + function check_assigned_role($role_id, &$auth_settings) + { + global $db; + + $sql = 'SELECT o.auth_option, r.auth_setting + FROM ' . ACL_OPTIONS_TABLE . ' o, ' . ACL_ROLES_DATA_TABLE . ' r + WHERE o.auth_option_id = r.auth_option_id + AND r.role_id = ' . $role_id; + $result = $db->sql_query($sql); + + $test_auth_settings = array(); + while ($row = $db->sql_fetchrow($result)) + { + $test_auth_settings[$row['auth_option']] = $row['auth_setting']; + } + $db->sql_freeresult($result); + + // We need to add any ACL_NO setting from auth_settings to compare correctly + foreach ($auth_settings as $option => $setting) + { + if ($setting == ACL_NO) + { + $test_auth_settings[$option] = $setting; + } + } + + if (count(array_diff_assoc($auth_settings, $test_auth_settings))) + { + return false; + } + + return true; + } + + /** + * Remove permissions + */ + function remove_permissions($mode, $permission_type, $auth_admin, &$user_id, &$group_id, &$forum_id) + { + global $user, $db, $cache, $auth; + + // User or group to be set? + $ug_type = (count($user_id)) ? 'user' : 'group'; + + // Check the permission setting again + if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $auth_admin->acl_delete($ug_type, (($ug_type == 'user') ? $user_id : $group_id), (count($forum_id) ? $forum_id : false), $permission_type); + + // Do we need to recache the moderator lists? + if ($permission_type == 'm_') + { + phpbb_cache_moderators($db, $cache, $auth); + } + + $this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (count($forum_id) ? $forum_id : array(0 => 0))); + + if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') + { + meta_refresh(5, $this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id)); + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id))); + } + else + { + meta_refresh(5, $this->u_action); + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + } + } + + /** + * Log permission changes + */ + function log_action($mode, $action, $permission_type, $ug_type, $ug_id, $forum_id) + { + global $db, $user, $phpbb_log, $phpbb_container; + + if (!is_array($ug_id)) + { + $ug_id = array($ug_id); + } + + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + // Logging ... first grab user or groupnames ... + $sql = ($ug_type == 'group') ? 'SELECT group_name as name, group_type FROM ' . GROUPS_TABLE . ' WHERE ' : 'SELECT username as name FROM ' . USERS_TABLE . ' WHERE '; + $sql .= $db->sql_in_set(($ug_type == 'group') ? 'group_id' : 'user_id', array_map('intval', $ug_id)); + $result = $db->sql_query($sql); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $l_ug_list = ''; + while ($row = $db->sql_fetchrow($result)) + { + $group_name = $group_helper->get_name($row['name']); + $l_ug_list .= (($l_ug_list != '') ? ', ' : '') . ((isset($row['group_type']) && $row['group_type'] == GROUP_SPECIAL) ? '' . $group_name . '' : $group_name); + } + $db->sql_freeresult($result); + + $mode = str_replace('setting_', '', $mode); + + if ($forum_id[0] == 0) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), false, array($l_ug_list)); + } + else + { + // Grab the forum details if non-zero forum_id + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id); + $result = $db->sql_query($sql); + + $l_forum_list = ''; + while ($row = $db->sql_fetchrow($result)) + { + $l_forum_list .= (($l_forum_list != '') ? ', ' : '') . $row['forum_name']; + } + $db->sql_freeresult($result); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), false, array($l_forum_list, $l_ug_list)); + } + } + + /** + * Display a complete trace tree for the selected permission to determine where settings are set/unset + */ + function permission_trace($user_id, $forum_id, $permission) + { + global $db, $template, $user, $auth, $request, $phpbb_container; + + if ($user_id != $user->data['user_id']) + { + $userdata = $auth->obtain_user_data($user_id); + } + else + { + $userdata = $user->data; + } + + if (!$userdata) + { + trigger_error('NO_USERS', E_USER_ERROR); + } + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $forum_name = false; + + if ($forum_id) + { + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql, 3600); + $forum_name = $db->sql_fetchfield('forum_name'); + $db->sql_freeresult($result); + } + + $back = $request->variable('back', 0); + + $template->assign_vars(array( + 'PERMISSION' => $this->permissions->get_permission_lang($permission), + 'PERMISSION_USERNAME' => $userdata['username'], + 'FORUM_NAME' => $forum_name, + + 'S_GLOBAL_TRACE' => ($forum_id) ? false : true, + + 'U_BACK' => ($back) ? build_url(array('f', 'back')) . "&f=$back" : '') + ); + + $template->assign_block_vars('trace', array( + 'WHO' => $user->lang['DEFAULT'], + 'INFORMATION' => $user->lang['TRACE_DEFAULT'], + + 'S_SETTING_NO' => true, + 'S_TOTAL_NO' => true) + ); + + $sql = 'SELECT DISTINCT g.group_name, g.group_id, g.group_type + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.group_id = g.group_id) + WHERE ug.user_id = ' . $user_id . ' + AND ug.user_pending = 0 + AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) + ORDER BY g.group_type DESC, g.group_id DESC'; + $result = $db->sql_query($sql); + + $groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $groups[$row['group_id']] = array( + 'auth_setting' => ACL_NO, + 'group_name' => $group_helper->get_name($row['group_name']), + ); + } + $db->sql_freeresult($result); + + $total = ACL_NO; + $add_key = (($forum_id) ? '_LOCAL' : ''); + + if (count($groups)) + { + // Get group auth settings + $hold_ary = $auth->acl_group_raw_data(array_keys($groups), $permission, $forum_id); + + foreach ($hold_ary as $group_id => $forum_ary) + { + $groups[$group_id]['auth_setting'] = $hold_ary[$group_id][$forum_id][$permission]; + } + unset($hold_ary); + + foreach ($groups as $id => $row) + { + switch ($row['auth_setting']) + { + case ACL_NO: + $information = $user->lang['TRACE_GROUP_NO' . $add_key]; + break; + + case ACL_YES: + $information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_YES_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_GROUP_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_YES_TOTAL_NO' . $add_key]); + $total = ($total == ACL_NO) ? ACL_YES : $total; + break; + + case ACL_NEVER: + $information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_NEVER_TOTAL_NO' . $add_key]); + $total = ACL_NEVER; + break; + } + + $template->assign_block_vars('trace', array( + 'WHO' => $row['group_name'], + 'INFORMATION' => $information, + + 'S_SETTING_NO' => ($row['auth_setting'] == ACL_NO) ? true : false, + 'S_SETTING_YES' => ($row['auth_setting'] == ACL_YES) ? true : false, + 'S_SETTING_NEVER' => ($row['auth_setting'] == ACL_NEVER) ? true : false, + 'S_TOTAL_NO' => ($total == ACL_NO) ? true : false, + 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, + 'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false) + ); + } + } + + // Get user specific permission... globally or for this forum + $hold_ary = $auth->acl_user_raw_data($user_id, $permission, $forum_id); + $auth_setting = (!count($hold_ary)) ? ACL_NO : $hold_ary[$user_id][$forum_id][$permission]; + + switch ($auth_setting) + { + case ACL_NO: + $information = ($total == ACL_NO) ? $user->lang['TRACE_USER_NO_TOTAL_NO' . $add_key] : $user->lang['TRACE_USER_KEPT' . $add_key]; + $total = ($total == ACL_NO) ? ACL_NEVER : $total; + break; + + case ACL_YES: + $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_YES_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_USER_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_YES_TOTAL_NO' . $add_key]); + $total = ($total == ACL_NO) ? ACL_YES : $total; + break; + + case ACL_NEVER: + $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_NEVER_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_USER_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_NEVER_TOTAL_NO' . $add_key]); + $total = ACL_NEVER; + break; + } + + $template->assign_block_vars('trace', array( + 'WHO' => $userdata['username'], + 'INFORMATION' => $information, + + 'S_SETTING_NO' => ($auth_setting == ACL_NO) ? true : false, + 'S_SETTING_YES' => ($auth_setting == ACL_YES) ? true : false, + 'S_SETTING_NEVER' => ($auth_setting == ACL_NEVER) ? true : false, + 'S_TOTAL_NO' => false, + 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, + 'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false) + ); + + if ($forum_id != 0 && isset($auth->acl_options['global'][$permission])) + { + if ($user_id != $user->data['user_id']) + { + $auth2 = new \phpbb\auth\auth(); + $auth2->acl($userdata); + $auth_setting = $auth2->acl_get($permission); + } + else + { + $auth_setting = $auth->acl_get($permission); + } + + if ($auth_setting) + { + $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_YES'] : $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_NEVER']; + $total = ACL_YES; + } + else + { + $information = $user->lang['TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT']; + } + + // If there is no auth information we do not need to worry the user by showing non-relevant data. + if ($auth_setting) + { + $template->assign_block_vars('trace', array( + 'WHO' => sprintf($user->lang['TRACE_GLOBAL_SETTING'], $userdata['username']), + 'INFORMATION' => sprintf($information, '", ''), + + 'S_SETTING_NO' => false, + 'S_SETTING_YES' => $auth_setting, + 'S_SETTING_NEVER' => !$auth_setting, + 'S_TOTAL_NO' => false, + 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, + 'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false) + ); + } + } + + // Take founder status into account, overwriting the default values + if ($userdata['user_type'] == USER_FOUNDER && strpos($permission, 'a_') === 0) + { + $template->assign_block_vars('trace', array( + 'WHO' => $userdata['username'], + 'INFORMATION' => $user->lang['TRACE_USER_FOUNDER'], + + 'S_SETTING_NO' => ($auth_setting == ACL_NO) ? true : false, + 'S_SETTING_YES' => ($auth_setting == ACL_YES) ? true : false, + 'S_SETTING_NEVER' => ($auth_setting == ACL_NEVER) ? true : false, + 'S_TOTAL_NO' => false, + 'S_TOTAL_YES' => true, + 'S_TOTAL_NEVER' => false) + ); + + $total = ACL_YES; + } + + // Total value... + $template->assign_vars(array( + 'S_RESULT_NO' => ($total == ACL_NO) ? true : false, + 'S_RESULT_YES' => ($total == ACL_YES) ? true : false, + 'S_RESULT_NEVER' => ($total == ACL_NEVER) ? true : false, + )); + } + + /** + * Handles copying permissions from one forum to others + */ + function copy_forum_permissions() + { + global $db, $auth, $cache, $template, $user, $request; + + $user->add_lang('acp/forums'); + + $submit = isset($_POST['submit']) ? true : false; + + if ($submit) + { + $src = $request->variable('src_forum_id', 0); + $dest = $request->variable('dest_forum_ids', array(0)); + + if (confirm_box(true)) + { + if (copy_forum_permissions($src, $dest)) + { + phpbb_cache_moderators($db, $cache, $auth); + + $auth->acl_clear_prefetch(); + $cache->destroy('sql', FORUMS_TABLE); + + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + } + else + { + trigger_error($user->lang['SELECTED_FORUM_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + else + { + $s_hidden_fields = array( + 'submit' => $submit, + 'src_forum_id' => $src, + 'dest_forum_ids' => $dest, + ); + + $s_hidden_fields = build_hidden_fields($s_hidden_fields); + + confirm_box(false, $user->lang['COPY_PERMISSIONS_CONFIRM'], $s_hidden_fields); + } + } + + $template->assign_vars(array( + 'S_FORUM_OPTIONS' => make_forum_select(false, false, false, false, false), + )); + } + + /** + * Get already assigned users/groups + */ + function retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type) + { + global $db, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((count($forum_id)) ? 'AND ' . $db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); + + // Permission options are only able to be a permission set... therefore we will pre-fetch the possible options and also the possible roles + $option_ids = $role_ids = array(); + + $sql = 'SELECT auth_option_id + FROM ' . ACL_OPTIONS_TABLE . ' + WHERE auth_option ' . $db->sql_like_expression($permission_type . $db->get_any_char()); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $option_ids[] = (int) $row['auth_option_id']; + } + $db->sql_freeresult($result); + + if (count($option_ids)) + { + $sql = 'SELECT DISTINCT role_id + FROM ' . ACL_ROLES_DATA_TABLE . ' + WHERE ' . $db->sql_in_set('auth_option_id', $option_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $role_ids[] = (int) $row['role_id']; + } + $db->sql_freeresult($result); + } + + if (count($option_ids) && count($role_ids)) + { + $sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')'; + } + else if (count($role_ids)) + { + $sql_where = 'AND ' . $db->sql_in_set('a.auth_role_id', $role_ids); + } + else if (count($option_ids)) + { + $sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids); + } + + // Not ideal, due to the filesort, non-use of indexes, etc. + $sql = 'SELECT DISTINCT u.user_id, u.username, u.username_clean, u.user_regdate + FROM ' . USERS_TABLE . ' u, ' . ACL_USERS_TABLE . " a + WHERE u.user_id = a.user_id + $sql_forum_id + $sql_where + ORDER BY u.username_clean, u.user_regdate ASC"; + $result = $db->sql_query($sql); + + $s_defined_user_options = ''; + $defined_user_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $s_defined_user_options .= ''; + $defined_user_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT DISTINCT g.group_type, g.group_name, g.group_id + FROM ' . GROUPS_TABLE . ' g, ' . ACL_GROUPS_TABLE . " a + WHERE g.group_id = a.group_id + $sql_forum_id + $sql_where + ORDER BY g.group_type DESC, g.group_name ASC"; + $result = $db->sql_query($sql); + + $s_defined_group_options = ''; + $defined_group_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $s_defined_group_options .= '' . $group_helper->get_name($row['group_name']) . ''; + $defined_group_ids[] = $row['group_id']; + } + $db->sql_freeresult($result); + + return array( + 'group_ids' => $defined_group_ids, + 'group_ids_options' => $s_defined_group_options, + 'user_ids' => $defined_user_ids, + 'user_ids_options' => $s_defined_user_options + ); + } +} diff --git a/install/update/new/includes/acp/acp_prune.php b/install/update/new/includes/acp/acp_prune.php new file mode 100644 index 0000000..c5f7789 --- /dev/null +++ b/install/update/new/includes/acp/acp_prune.php @@ -0,0 +1,588 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_prune +{ + var $u_action; + + function main($id, $mode) + { + global $user, $phpEx, $phpbb_root_path; + + $user->add_lang('acp/prune'); + + if (!function_exists('user_active_flip')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + switch ($mode) + { + case 'forums': + $this->tpl_name = 'acp_prune_forums'; + $this->page_title = 'ACP_PRUNE_FORUMS'; + $this->prune_forums($id, $mode); + break; + + case 'users': + $this->tpl_name = 'acp_prune_users'; + $this->page_title = 'ACP_PRUNE_USERS'; + $this->prune_users($id, $mode); + break; + } + } + + /** + * Prune forums + */ + function prune_forums($id, $mode) + { + global $db, $user, $auth, $template, $phpbb_log, $request, $phpbb_dispatcher; + + $all_forums = $request->variable('all_forums', 0); + $forum_id = $request->variable('f', array(0)); + $submit = (isset($_POST['submit'])) ? true : false; + + if ($all_forums) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id'; + $result = $db->sql_query($sql); + + $forum_id = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_id[] = $row['forum_id']; + } + $db->sql_freeresult($result); + } + + if ($submit) + { + if (confirm_box(true)) + { + $prune_posted = $request->variable('prune_days', 0); + $prune_viewed = $request->variable('prune_vieweddays', 0); + $prune_all = (!$prune_posted && !$prune_viewed) ? true : false; + + $prune_flags = 0; + $prune_flags += ($request->variable('prune_old_polls', 0)) ? 2 : 0; + $prune_flags += ($request->variable('prune_announce', 0)) ? 4 : 0; + $prune_flags += ($request->variable('prune_sticky', 0)) ? 8 : 0; + + // Convert days to seconds for timestamp functions... + $prunedate_posted = time() - ($prune_posted * 86400); + $prunedate_viewed = time() - ($prune_viewed * 86400); + + $template->assign_vars(array( + 'S_PRUNED' => true) + ); + + $sql_forum = (count($forum_id)) ? ' AND ' . $db->sql_in_set('forum_id', $forum_id) : ''; + + // Get a list of forum's or the data for the forum that we are pruning. + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST . " + $sql_forum + ORDER BY left_id ASC"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $prune_ids = array(); + $p_result['topics'] = 0; + $p_result['posts'] = 0; + $log_data = ''; + + do + { + if (!$auth->acl_get('f_list', $row['forum_id'])) + { + continue; + } + + if ($prune_all) + { + $p_result = prune($row['forum_id'], 'posted', time(), $prune_flags, false); + } + else + { + if ($prune_posted) + { + $return = prune($row['forum_id'], 'posted', $prunedate_posted, $prune_flags, false); + $p_result['topics'] += $return['topics']; + $p_result['posts'] += $return['posts']; + } + + if ($prune_viewed) + { + $return = prune($row['forum_id'], 'viewed', $prunedate_viewed, $prune_flags, false); + $p_result['topics'] += $return['topics']; + $p_result['posts'] += $return['posts']; + } + } + + $prune_ids[] = $row['forum_id']; + + $template->assign_block_vars('pruned', array( + 'FORUM_NAME' => $row['forum_name'], + 'NUM_TOPICS' => $p_result['topics'], + 'NUM_POSTS' => $p_result['posts']) + ); + + $log_data .= (($log_data != '') ? ', ' : '') . $row['forum_name']; + } + while ($row = $db->sql_fetchrow($result)); + + // Sync all pruned forums at once + sync('forum', 'forum_id', $prune_ids, true, true); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PRUNE', false, array($log_data)); + } + $db->sql_freeresult($result); + + return; + } + else + { + $hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'submit' => 1, + 'all_forums' => $all_forums, + 'f' => $forum_id, + + 'prune_days' => $request->variable('prune_days', 0), + 'prune_vieweddays' => $request->variable('prune_vieweddays', 0), + 'prune_old_polls' => $request->variable('prune_old_polls', 0), + 'prune_announce' => $request->variable('prune_announce', 0), + 'prune_sticky' => $request->variable('prune_sticky', 0), + ); + + /** + * Use this event to pass data from the prune form to the confirmation screen + * + * @event core.prune_forums_settings_confirm + * @var array hidden_fields Hidden fields that are passed through the confirm screen + * @since 3.2.2-RC1 + */ + $vars = array('hidden_fields'); + extract($phpbb_dispatcher->trigger_event('core.prune_forums_settings_confirm', compact($vars))); + + confirm_box(false, $user->lang['PRUNE_FORUM_CONFIRM'], build_hidden_fields($hidden_fields)); + } + } + + // If they haven't selected a forum for pruning yet then + // display a select box to use for pruning. + if (!count($forum_id)) + { + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + 'S_SELECT_FORUM' => true, + 'S_FORUM_OPTIONS' => make_forum_select(false, false, false)) + ); + } + else + { + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + + if (!$row) + { + $db->sql_freeresult($result); + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $forum_list = $s_hidden_fields = ''; + do + { + $forum_list .= (($forum_list != '') ? ', ' : '') . '' . $row['forum_name'] . ''; + $s_hidden_fields .= ''; + } + while ($row = $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + + $l_selected_forums = (count($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS'; + + $template_data = array( + 'L_SELECTED_FORUMS' => $user->lang[$l_selected_forums], + 'U_ACTION' => $this->u_action, + 'U_BACK' => $this->u_action, + 'FORUM_LIST' => $forum_list, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + ); + + /** + * Event to add/modify prune forums settings template data + * + * @event core.prune_forums_settings_template_data + * @var array template_data Array with form template data + * @since 3.2.2-RC1 + */ + $vars = array('template_data'); + extract($phpbb_dispatcher->trigger_event('core.prune_forums_settings_template_data', compact($vars))); + + $template->assign_vars($template_data); + } + } + + /** + * Prune users + */ + function prune_users($id, $mode) + { + global $db, $user, $auth, $template, $phpbb_log, $request; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $user->add_lang('memberlist'); + + $prune = (isset($_POST['prune'])) ? true : false; + + if ($prune) + { + $action = $request->variable('action', 'deactivate'); + $deleteposts = $request->variable('deleteposts', 0); + + if (confirm_box(true)) + { + $user_ids = $usernames = array(); + + $this->get_prune_users($user_ids, $usernames); + if (count($user_ids)) + { + if ($action == 'deactivate') + { + user_active_flip('deactivate', $user_ids); + $l_log = 'LOG_PRUNE_USER_DEAC'; + } + else if ($action == 'delete') + { + if ($deleteposts) + { + user_delete('remove', $user_ids); + + $l_log = 'LOG_PRUNE_USER_DEL_DEL'; + } + else + { + user_delete('retain', $user_ids, true); + + $l_log = 'LOG_PRUNE_USER_DEL_ANON'; + } + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $l_log, false, array(implode(', ', $usernames))); + $msg = $user->lang['USER_' . strtoupper($action) . '_SUCCESS']; + } + else + { + $msg = $user->lang['USER_PRUNE_FAILURE']; + } + + trigger_error($msg . adm_back_link($this->u_action)); + } + else + { + // We list the users which will be pruned... + $user_ids = $usernames = array(); + $this->get_prune_users($user_ids, $usernames); + + if (!count($user_ids)) + { + trigger_error($user->lang['USER_PRUNE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Assign to template + foreach ($user_ids as $user_id) + { + $template->assign_block_vars('users', array( + 'USERNAME' => $usernames[$user_id], + 'USER_ID' => $user_id, + 'U_PROFILE' => get_username_string('profile', $user_id, $usernames[$user_id]), + 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', + )); + } + + $template->assign_vars(array( + 'S_DEACTIVATE' => ($action == 'deactivate') ? true : false, + 'S_DELETE' => ($action == 'delete') ? true : false, + )); + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'prune' => 1, + + 'deleteposts' => $request->variable('deleteposts', 0), + 'action' => $request->variable('action', ''), + )), 'confirm_body_prune.html'); + } + } + + $find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']); + $s_find_count = ''; + + foreach ($find_count as $key => $value) + { + $selected = ($key == 'eq') ? ' selected="selected"' : ''; + $s_find_count .= ''; + } + + $find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']); + $s_find_active_time = ''; + foreach ($find_time as $key => $value) + { + $s_find_active_time .= ''; + } + + $sql = 'SELECT group_id, group_name + FROM ' . GROUPS_TABLE . ' + WHERE group_type <> ' . GROUP_SPECIAL . ' + ORDER BY group_name ASC'; + $result = $db->sql_query($sql); + + $s_group_list = ''; + while ($row = $db->sql_fetchrow($result)) + { + $s_group_list .= ''; + } + $db->sql_freeresult($result); + + if ($s_group_list) + { + // Only prepend the "All groups" option if there are groups, + // otherwise we don't want to display this option at all. + $s_group_list = '' . $s_group_list; + } + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + 'S_ACTIVE_OPTIONS' => $s_find_active_time, + 'S_GROUP_LIST' => $s_group_list, + 'S_COUNT_OPTIONS' => $s_find_count, + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_prune&field=users'), + )); + } + + /** + * Get user_ids/usernames from those being pruned + */ + function get_prune_users(&$user_ids, &$usernames) + { + global $user, $db, $request; + + $users_by_name = $request->variable('users', '', true); + $users_by_id = $request->variable('user_ids', array(0)); + $group_id = $request->variable('group_id', 0); + $posts_on_queue = (trim($request->variable('posts_on_queue', '')) === '') ? false : $request->variable('posts_on_queue', 0); + + if ($users_by_name) + { + $users = explode("\n", $users_by_name); + $where_sql = ' AND ' . $db->sql_in_set('username_clean', array_map('utf8_clean_string', $users)); + } + else if (!empty($users_by_id)) + { + $user_ids = $users_by_id; + user_get_id_name($user_ids, $usernames); + + $where_sql = ' AND ' . $db->sql_in_set('user_id', $user_ids); + } + else + { + $username = $request->variable('username', '', true); + $email = $request->variable('email', ''); + + $active_select = $request->variable('active_select', 'lt'); + $count_select = $request->variable('count_select', 'eq'); + $queue_select = $request->variable('queue_select', 'gt'); + $joined_before = $request->variable('joined_before', ''); + $joined_after = $request->variable('joined_after', ''); + $active = $request->variable('active', ''); + + $count = ($request->variable('count', '') === '') ? false : $request->variable('count', 0); + + $active = ($active) ? explode('-', $active) : array(); + $joined_before = ($joined_before) ? explode('-', $joined_before) : array(); + $joined_after = ($joined_after) ? explode('-', $joined_after) : array(); + + // calculate the conditions required by the join time criteria + $joined_sql = ''; + if (!empty($joined_before) && !empty($joined_after)) + { + // if the two entered dates are equal, we need to adjust + // so that our time range is a full day instead of 1 second + if ($joined_after == $joined_before) + { + $joined_after[2] += 1; + } + + $joined_sql = ' AND user_regdate BETWEEN ' . gmmktime(0, 0, 0, (int) $joined_after[1], (int) $joined_after[2], (int) $joined_after[0]) . + ' AND ' . gmmktime(0, 0, 0, (int) $joined_before[1], (int) $joined_before[2], (int) $joined_before[0]); + } + else if (empty($joined_before) && !empty($joined_after)) + { + $joined_sql = ' AND user_regdate > ' . gmmktime(0, 0, 0, (int) $joined_after[1], (int) $joined_after[2], (int) $joined_after[0]); + } + else if (empty($joined_after) && !empty($joined_before)) + { + $joined_sql = ' AND user_regdate < ' . gmmktime(0, 0, 0, (int) $joined_before[1], (int) $joined_before[2], (int) $joined_before[0]); + } + // implicit else when both arrays are empty do nothing + + if ((count($active) && count($active) != 3) || (count($joined_before) && count($joined_before) != 3) || (count($joined_after) && count($joined_after) != 3)) + { + trigger_error($user->lang['WRONG_ACTIVE_JOINED_DATE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); + + $where_sql = ''; + $where_sql .= ($username) ? ' AND username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($username))) : ''; + $where_sql .= ($email) ? ' AND user_email ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $email)) . ' ' : ''; + $where_sql .= $joined_sql; + $where_sql .= ($count !== false) ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : ''; + + // First handle pruning of users who never logged in, last active date is 0000-00-00 + if (count($active) && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) + { + $where_sql .= ' AND user_lastvisit = 0'; + } + else if (count($active) && $active_select != 'lt') + { + $where_sql .= ' AND user_lastvisit ' . $key_match[$active_select] . ' ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]); + } + else if (count($active)) + { + $where_sql .= ' AND (user_lastvisit > 0 AND user_lastvisit < ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]) . ')'; + } + } + + // If no search criteria were provided, go no further. + if (!$where_sql && !$group_id && $posts_on_queue === false) + { + return; + } + + // Get bot ids + $sql = 'SELECT user_id + FROM ' . BOTS_TABLE; + $result = $db->sql_query($sql); + + $bot_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $bot_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + // Protect the admin, do not prune if no options are given... + if ($where_sql) + { + // Do not prune founder members + $sql = 'SELECT user_id, username + FROM ' . USERS_TABLE . ' + WHERE user_id <> ' . ANONYMOUS . ' + AND user_type <> ' . USER_FOUNDER . " + $where_sql"; + $result = $db->sql_query($sql); + + $user_ids = $usernames = array(); + + while ($row = $db->sql_fetchrow($result)) + { + // Do not prune bots and the user currently pruning. + if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + { + $user_ids[] = $row['user_id']; + $usernames[$row['user_id']] = $row['username']; + } + } + $db->sql_freeresult($result); + } + + if ($group_id) + { + $sql = 'SELECT u.user_id, u.username + FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u + WHERE ug.group_id = ' . (int) $group_id . ' + AND ug.user_id <> ' . ANONYMOUS . ' + AND u.user_type <> ' . USER_FOUNDER . ' + AND ug.user_pending = 0 + AND ug.group_leader = 0 + AND u.user_id = ug.user_id + ' . (!empty($user_ids) ? ' AND ' . $db->sql_in_set('ug.user_id', $user_ids) : ''); + $result = $db->sql_query($sql); + + // we're performing an intersection operation, so all the relevant users + // come from this most recent query (which was limited to the results of the + // previous query) + $user_ids = $usernames = array(); + while ($row = $db->sql_fetchrow($result)) + { + // Do not prune bots and the user currently pruning. + if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + { + $user_ids[] = $row['user_id']; + $usernames[$row['user_id']] = $row['username']; + } + } + $db->sql_freeresult($result); + } + + if ($posts_on_queue !== false) + { + $sql = 'SELECT u.user_id, u.username, COUNT(p.post_id) AS queue_posts + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE u.user_id <> ' . ANONYMOUS . ' + AND u.user_type <> ' . USER_FOUNDER . ' + AND ' . $db->sql_in_set('p.post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) . ' + AND u.user_id = p.poster_id + ' . (!empty($user_ids) ? ' AND ' . $db->sql_in_set('p.poster_id', $user_ids) : '') . ' + GROUP BY p.poster_id + HAVING queue_posts ' . $key_match[$queue_select] . ' ' . $posts_on_queue; + $result = $db->sql_query($sql); + + // same intersection logic as the above group ID portion + $user_ids = $usernames = array(); + while ($row = $db->sql_fetchrow($result)) + { + // Do not prune bots and the user currently pruning. + if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + { + $user_ids[] = $row['user_id']; + $usernames[$row['user_id']] = $row['username']; + } + } + $db->sql_freeresult($result); + } + } +} diff --git a/install/update/new/includes/acp/acp_reasons.php b/install/update/new/includes/acp/acp_reasons.php new file mode 100644 index 0000000..f3f82bd --- /dev/null +++ b/install/update/new/includes/acp/acp_reasons.php @@ -0,0 +1,392 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_reasons +{ + var $u_action; + + function main($id, $mode) + { + global $db, $user, $template; + global $request, $phpbb_log; + + $user->add_lang(array('mcp', 'acp/posting')); + + // Set up general vars + $action = $request->variable('action', ''); + $submit = (isset($_POST['submit'])) ? true : false; + $reason_id = $request->variable('id', 0); + + $this->tpl_name = 'acp_reasons'; + $this->page_title = 'ACP_REASONS'; + + $form_name = 'acp_reason'; + add_form_key('acp_reason'); + + $error = array(); + + switch ($action) + { + case 'add': + case 'edit': + + $reason_row = array( + 'reason_title' => $request->variable('reason_title', '', true), + 'reason_description' => $request->variable('reason_description', '', true), + ); + + if ($submit) + { + if (!check_form_key($form_name)) + { + $error[] = $user->lang['FORM_INVALID']; + } + // Reason specified? + if (!$reason_row['reason_title'] || !$reason_row['reason_description']) + { + $error[] = $user->lang['NO_REASON_INFO']; + } + + $check_double = ($action == 'add') ? true : false; + + if ($action == 'edit') + { + $sql = 'SELECT reason_title + FROM ' . REPORTS_REASONS_TABLE . " + WHERE reason_id = $reason_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (strtolower($row['reason_title']) == 'other' || strtolower($reason_row['reason_title']) == 'other') + { + $reason_row['reason_title'] = 'other'; + } + + if ($row['reason_title'] != $reason_row['reason_title']) + { + $check_double = true; + } + } + + // Check for same reason if adding it... + if ($check_double) + { + $sql = 'SELECT reason_id + FROM ' . REPORTS_REASONS_TABLE . " + WHERE reason_title = '" . $db->sql_escape($reason_row['reason_title']) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row || ($action == 'add' && strtolower($reason_row['reason_title']) == 'other')) + { + $error[] = $user->lang['REASON_ALREADY_EXIST']; + } + } + + if (!count($error)) + { + // New reason? + if ($action == 'add') + { + // Get new order... + $sql = 'SELECT MAX(reason_order) as max_reason_order + FROM ' . REPORTS_REASONS_TABLE; + $result = $db->sql_query($sql); + $max_order = (int) $db->sql_fetchfield('max_reason_order'); + $db->sql_freeresult($result); + + $sql_ary = array( + 'reason_title' => (string) $reason_row['reason_title'], + 'reason_description' => (string) $reason_row['reason_description'], + 'reason_order' => $max_order + 1 + ); + + $db->sql_query('INSERT INTO ' . REPORTS_REASONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $log = 'ADDED'; + } + else if ($reason_id) + { + $sql_ary = array( + 'reason_title' => (string) $reason_row['reason_title'], + 'reason_description' => (string) $reason_row['reason_description'], + ); + + $db->sql_query('UPDATE ' . REPORTS_REASONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE reason_id = ' . $reason_id); + + $log = 'UPDATED'; + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_REASON_' . $log, false, array($reason_row['reason_title'])); + trigger_error($user->lang['REASON_' . $log] . adm_back_link($this->u_action)); + } + } + else if ($reason_id) + { + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . ' + WHERE reason_id = ' . $reason_id; + $result = $db->sql_query($sql); + $reason_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$reason_row) + { + trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + $l_title = ($action == 'edit') ? 'EDIT' : 'ADD'; + + $translated = false; + + // If the reason is defined within the language file, we will use the localized version, else just use the database entry... + if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason_row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason_row['reason_title'])])) + { + $translated = true; + } + + $template->assign_vars(array( + 'L_TITLE' => $user->lang['REASON_' . $l_title], + 'U_ACTION' => $this->u_action . "&id=$reason_id&action=$action", + 'U_BACK' => $this->u_action, + 'ERROR_MSG' => (count($error)) ? implode('
', $error) : '', + + 'REASON_TITLE' => $reason_row['reason_title'], + 'REASON_DESCRIPTION' => $reason_row['reason_description'], + + 'TRANSLATED_TITLE' => ($translated) ? $user->lang['report_reasons']['TITLE'][strtoupper($reason_row['reason_title'])] : '', + 'TRANSLATED_DESCRIPTION'=> ($translated) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason_row['reason_title'])] : '', + + 'S_AVAILABLE_TITLES' => implode($user->lang['COMMA_SEPARATOR'], array_map('htmlspecialchars', array_keys($user->lang['report_reasons']['TITLE']))), + 'S_EDIT_REASON' => true, + 'S_TRANSLATED' => $translated, + 'S_ERROR' => (count($error)) ? true : false, + ) + ); + + return; + break; + + case 'delete': + + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . ' + WHERE reason_id = ' . $reason_id; + $result = $db->sql_query($sql); + $reason_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$reason_row) + { + trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (strtolower($reason_row['reason_title']) == 'other') + { + trigger_error($user->lang['NO_REMOVE_DEFAULT_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Let the deletion be confirmed... + if (confirm_box(true)) + { + $sql = 'SELECT reason_id + FROM ' . REPORTS_REASONS_TABLE . " + WHERE LOWER(reason_title) = 'other'"; + $result = $db->sql_query($sql); + $other_reason_id = (int) $db->sql_fetchfield('reason_id'); + $db->sql_freeresult($result); + + switch ($db->get_sql_layer()) + { + // The ugly one! + case 'mysqli': + // Change the reports using this reason to 'other' + $sql = 'UPDATE ' . REPORTS_TABLE . ' + SET reason_id = ' . $other_reason_id . ", report_text = CONCAT('" . $db->sql_escape($reason_row['reason_description']) . "\n\n', report_text) + WHERE reason_id = $reason_id"; + break; + + // Standard? What's that? + case 'mssql_odbc': + case 'mssqlnative': + // Change the reports using this reason to 'other' + $sql = "DECLARE @ptrval binary(16) + + SELECT @ptrval = TEXTPTR(report_text) + FROM " . REPORTS_TABLE . " + WHERE reason_id = " . $reason_id . " + + UPDATETEXT " . REPORTS_TABLE . ".report_text @ptrval 0 0 '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' + + UPDATE " . REPORTS_TABLE . ' + SET reason_id = ' . $other_reason_id . " + WHERE reason_id = $reason_id"; + break; + + // Teh standard + case 'postgres': + case 'oracle': + case 'sqlite3': + // Change the reports using this reason to 'other' + $sql = 'UPDATE ' . REPORTS_TABLE . ' + SET reason_id = ' . $other_reason_id . ", report_text = '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' || report_text + WHERE reason_id = $reason_id"; + break; + } + $db->sql_query($sql); + + $db->sql_query('DELETE FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_REASON_REMOVED', false, array($reason_row['reason_title'])); + trigger_error($user->lang['REASON_REMOVED'] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'id' => $reason_id)) + ); + } + + break; + + case 'move_up': + case 'move_down': + + if (!check_link_hash($request->variable('hash', ''), 'acp_reasons')) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql = 'SELECT reason_order + FROM ' . REPORTS_REASONS_TABLE . " + WHERE reason_id = $reason_id"; + $result = $db->sql_query($sql); + $order = $db->sql_fetchfield('reason_order'); + $db->sql_freeresult($result); + + if ($order === false || ($order == 0 && $action == 'move_up')) + { + break; + } + $order = (int) $order; + $order_total = $order * 2 + (($action == 'move_up') ? -1 : 1); + + $sql = 'UPDATE ' . REPORTS_REASONS_TABLE . ' + SET reason_order = ' . $order_total . ' - reason_order + WHERE reason_order IN (' . $order . ', ' . (($action == 'move_up') ? $order - 1 : $order + 1) . ')'; + $db->sql_query($sql); + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'success' => (bool) $db->sql_affectedrows(), + )); + } + break; + } + + // By default, check that order is valid and fix it if necessary + $sql = 'SELECT reason_id, reason_order + FROM ' . REPORTS_REASONS_TABLE . ' + ORDER BY reason_order'; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $order = 0; + do + { + ++$order; + + if ($row['reason_order'] != $order) + { + $sql = 'UPDATE ' . REPORTS_REASONS_TABLE . " + SET reason_order = $order + WHERE reason_id = {$row['reason_id']}"; + $db->sql_query($sql); + } + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + ) + ); + + // Reason count + $sql = 'SELECT reason_id, COUNT(reason_id) AS reason_count + FROM ' . REPORTS_TABLE . ' + GROUP BY reason_id'; + $result = $db->sql_query($sql); + + $reason_count = array(); + while ($row = $db->sql_fetchrow($result)) + { + $reason_count[$row['reason_id']] = $row['reason_count']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . ' + ORDER BY reason_order ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $translated = false; + $other_reason = ($row['reason_title'] == 'other') ? true : false; + + // If the reason is defined within the language file, we will use the localized version, else just use the database entry... + if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) + { + $row['reason_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; + $row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; + + $translated = true; + } + + $template->assign_block_vars('reasons', array( + 'REASON_TITLE' => $row['reason_title'], + 'REASON_DESCRIPTION' => $row['reason_description'], + 'REASON_COUNT' => (isset($reason_count[$row['reason_id']])) ? $reason_count[$row['reason_id']] : 0, + + 'S_TRANSLATED' => $translated, + 'S_OTHER_REASON' => $other_reason, + + 'U_EDIT' => $this->u_action . '&action=edit&id=' . $row['reason_id'], + 'U_DELETE' => (!$other_reason) ? $this->u_action . '&action=delete&id=' . $row['reason_id'] : '', + 'U_MOVE_UP' => $this->u_action . '&action=move_up&id=' . $row['reason_id'] . '&hash=' . generate_link_hash('acp_reasons'), + 'U_MOVE_DOWN' => $this->u_action . '&action=move_down&id=' . $row['reason_id'] . '&hash=' . generate_link_hash('acp_reasons')) + ); + } + $db->sql_freeresult($result); + } +} diff --git a/install/update/new/includes/acp/acp_styles.php b/install/update/new/includes/acp/acp_styles.php new file mode 100644 index 0000000..87c8d88 --- /dev/null +++ b/install/update/new/includes/acp/acp_styles.php @@ -0,0 +1,1396 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_styles +{ + public $u_action; + + protected $u_base_action; + protected $s_hidden_fields; + protected $mode; + protected $styles_path; + protected $styles_path_absolute = 'styles'; + protected $default_style = 0; + protected $styles_list_cols = 0; + protected $reserved_style_names = array('adm', 'admin', 'all'); + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** @var \phpbb\cache\driver\driver_interface */ + protected $cache; + + /** @var \phpbb\auth\auth */ + protected $auth; + + /** @var \phpbb\textformatter\cache_interface */ + protected $text_formatter_cache; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** @var \phpbb\event\dispatcher_interface */ + protected $dispatcher; + + public function main($id, $mode) + { + global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_container; + + $this->db = $db; + $this->user = $user; + $this->template = $template; + $this->request = $request; + $this->cache = $cache; + $this->auth = $auth; + $this->text_formatter_cache = $phpbb_container->get('text_formatter.cache'); + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $phpEx; + $this->dispatcher = $phpbb_dispatcher; + + $this->default_style = $config['default_style']; + $this->styles_path = $this->phpbb_root_path . $this->styles_path_absolute . '/'; + + $this->u_base_action = append_sid("{$phpbb_admin_path}index.{$this->php_ext}", "i={$id}"); + $this->s_hidden_fields = array( + 'mode' => $mode, + ); + + $this->user->add_lang('acp/styles'); + + $this->tpl_name = 'acp_styles'; + $this->page_title = 'ACP_CAT_STYLES'; + $this->mode = $mode; + + $action = $this->request->variable('action', ''); + $post_actions = array('install', 'activate', 'deactivate', 'uninstall'); + + foreach ($post_actions as $key) + { + if ($this->request->is_set_post($key)) + { + $action = $key; + } + } + + // The uninstall action uses confirm_box() to verify the validity of the request, + // so there is no need to check for a valid token here. + if (in_array($action, $post_actions) && $action != 'uninstall') + { + $is_valid_request = check_link_hash($request->variable('hash', ''), $action) || check_form_key('styles_management'); + + if (!$is_valid_request) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + if ($action != '') + { + $this->s_hidden_fields['action'] = $action; + } + + $this->template->assign_vars(array( + 'U_ACTION' => $this->u_base_action, + 'S_HIDDEN_FIELDS' => build_hidden_fields($this->s_hidden_fields) + ) + ); + + /** + * Run code before ACP styles action execution + * + * @event core.acp_styles_action_before + * @var int id Module ID + * @var string mode Active module + * @var string action Module that should be run + * @since 3.1.7-RC1 + */ + $vars = array('id', 'mode', 'action'); + extract($this->dispatcher->trigger_event('core.acp_styles_action_before', compact($vars))); + + // Execute actions + switch ($action) + { + case 'install': + $this->action_install(); + return; + case 'uninstall': + $this->action_uninstall(); + return; + case 'activate': + $this->action_activate(); + return; + case 'deactivate': + $this->action_deactivate(); + return; + case 'details': + $this->action_details(); + return; + default: + $this->frontend(); + } + } + + /** + * Main page + */ + protected function frontend() + { + add_form_key('styles_management'); + + // Check mode + switch ($this->mode) + { + case 'style': + $this->welcome_message('ACP_STYLES', 'ACP_STYLES_EXPLAIN'); + $this->show_installed(); + return; + case 'install': + $this->welcome_message('INSTALL_STYLES', 'INSTALL_STYLES_EXPLAIN'); + $this->show_available(); + return; + } + trigger_error($this->user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + /** + * Install style(s) + */ + protected function action_install() + { + // Get list of styles to install + $dirs = $this->request_vars('dir', '', true); + + // Get list of styles that can be installed + $styles = $this->find_available(false); + + // Install each style + $messages = array(); + $installed_names = array(); + $installed_dirs = array(); + foreach ($dirs as $dir) + { + if (in_array($dir, $this->reserved_style_names)) + { + $messages[] = $this->user->lang('STYLE_NAME_RESERVED', htmlspecialchars($dir)); + continue; + } + + $found = false; + foreach ($styles as &$style) + { + // Check if: + // 1. Directory matches directory we are looking for + // 2. Style is not installed yet + // 3. Style with same name or directory hasn't been installed already within this function + if ($style['style_path'] == $dir && empty($style['_installed']) && !in_array($style['style_path'], $installed_dirs) && !in_array($style['style_name'], $installed_names)) + { + // Install style + $style['style_active'] = 1; + $style['style_id'] = $this->install_style($style); + $style['_installed'] = true; + $found = true; + $installed_names[] = $style['style_name']; + $installed_dirs[] = $style['style_path']; + $messages[] = sprintf($this->user->lang['STYLE_INSTALLED'], htmlspecialchars($style['style_name'])); + } + } + if (!$found) + { + $messages[] = sprintf($this->user->lang['STYLE_NOT_INSTALLED'], htmlspecialchars($dir)); + } + } + + // Invalidate the text formatter's cache for the new styles to take effect + if (!empty($installed_names)) + { + $this->text_formatter_cache->invalidate(); + } + + // Show message + if (!count($messages)) + { + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + $message = implode('
', $messages); + $message .= '

« ' . $this->user->lang('STYLE_INSTALLED_RETURN_INSTALLED_STYLES') . ''; + $message .= '

» ' . $this->user->lang('STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES') . ''; + trigger_error($message, E_USER_NOTICE); + } + + /** + * Confirm styles removal + */ + protected function action_uninstall() + { + // Get list of styles to uninstall + $ids = $this->request_vars('id', 0, true); + + // Don't remove prosilver, you can still deactivate it. + $sql = 'SELECT style_id + FROM ' . STYLES_TABLE . " + WHERE style_name = '" . $this->db->sql_escape('prosilver') . "'"; + $result = $this->db->sql_query($sql); + $prosilver_id = (int) $this->db->sql_fetchfield('style_id'); + $this->db->sql_freeresult($result); + + if ($prosilver_id && in_array($prosilver_id, $ids)) + { + trigger_error($this->user->lang('UNINSTALL_PROSILVER') . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Check if confirmation box was submitted + if (confirm_box(true)) + { + // Uninstall + $this->action_uninstall_confirmed($ids, $this->request->variable('confirm_delete_files', false)); + return; + } + + // Confirm box + $s_hidden = build_hidden_fields(array( + 'action' => 'uninstall', + 'ids' => $ids + )); + $this->template->assign_var('S_CONFIRM_DELETE', true); + confirm_box(false, $this->user->lang['CONFIRM_UNINSTALL_STYLES'], $s_hidden, 'acp_styles.html'); + + // Canceled - show styles list + $this->frontend(); + } + + /** + * Uninstall styles(s) + * + * @param array $ids List of style IDs + * @param bool $delete_files If true, script will attempt to remove files for selected styles + */ + protected function action_uninstall_confirmed($ids, $delete_files) + { + global $user, $phpbb_log; + + $default = $this->default_style; + $uninstalled = array(); + $messages = array(); + + // Check styles list + foreach ($ids as $id) + { + if (!$id) + { + trigger_error($this->user->lang['INVALID_STYLE_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + if ($id == $default) + { + trigger_error($this->user->lang['UNINSTALL_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); + } + $uninstalled[$id] = false; + } + + // Order by reversed style_id, so parent styles would be removed after child styles + // This way parent and child styles can be removed in same function call + $sql = 'SELECT * + FROM ' . STYLES_TABLE . ' + WHERE style_id IN (' . implode(', ', $ids) . ') + ORDER BY style_id DESC'; + $result = $this->db->sql_query($sql); + + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + // Uinstall each style + $uninstalled = array(); + foreach ($rows as $style) + { + $result = $this->uninstall_style($style, $delete_files); + + if (is_string($result)) + { + $messages[] = $result; + continue; + } + $messages[] = sprintf($this->user->lang['STYLE_UNINSTALLED'], $style['style_name']); + $uninstalled[] = $style['style_name']; + + // Attempt to delete files + if ($delete_files) + { + $messages[] = sprintf($this->user->lang[$this->delete_style_files($style['style_path']) ? 'DELETE_STYLE_FILES_SUCCESS' : 'DELETE_STYLE_FILES_FAILED'], $style['style_name']); + } + } + + if (empty($messages)) + { + // Nothing to uninstall? + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Log action + if (count($uninstalled)) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_DELETE', false, array(implode(', ', $uninstalled))); + } + + // Clear cache + $this->cache->purge(); + + // Show message + trigger_error(implode('
', $messages) . adm_back_link($this->u_action), E_USER_NOTICE); + } + + /** + * Activate styles + */ + protected function action_activate() + { + // Get list of styles to activate + $ids = $this->request_vars('id', 0, true); + + // Activate styles + $sql = 'UPDATE ' . STYLES_TABLE . ' + SET style_active = 1 + WHERE style_id IN (' . implode(', ', $ids) . ')'; + $this->db->sql_query($sql); + + // Purge cache + $this->cache->destroy('sql', STYLES_TABLE); + + // Show styles list + $this->frontend(); + } + + /** + * Deactivate styles + */ + protected function action_deactivate() + { + // Get list of styles to deactivate + $ids = $this->request_vars('id', 0, true); + + // Check for default style + foreach ($ids as $id) + { + if ($id == $this->default_style) + { + trigger_error($this->user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + // Reset default style for users who use selected styles + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $this->default_style . ' + WHERE user_style IN (' . implode(', ', $ids) . ')'; + $this->db->sql_query($sql); + + // Deactivate styles + $sql = 'UPDATE ' . STYLES_TABLE . ' + SET style_active = 0 + WHERE style_id IN (' . implode(', ', $ids) . ')'; + $this->db->sql_query($sql); + + // Purge cache + $this->cache->destroy('sql', STYLES_TABLE); + + // Show styles list + $this->frontend(); + } + + /** + * Show style details + */ + protected function action_details() + { + global $user, $phpbb_log; + + $id = $this->request->variable('id', 0); + if (!$id) + { + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Get all styles + $styles = $this->get_styles(); + usort($styles, array($this, 'sort_styles')); + + // Find current style + $style = false; + foreach ($styles as $row) + { + if ($row['style_id'] == $id) + { + $style = $row; + break; + } + } + + if ($style === false) + { + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Read style configuration file + $style_cfg = $this->read_style_cfg($style['style_path']); + + // Find all available parent styles + $list = $this->find_possible_parents($styles, $id); + + // Add form key + $form_key = 'acp_styles'; + add_form_key($form_key); + + // Change data + if ($this->request->variable('update', false)) + { + if (!check_form_key($form_key)) + { + trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $update = array( + 'style_name' => trim($this->request->variable('style_name', $style['style_name'])), + 'style_parent_id' => $this->request->variable('style_parent', (int) $style['style_parent_id']), + 'style_active' => $this->request->variable('style_active', (int) $style['style_active']), + ); + $update_action = $this->u_action . '&action=details&id=' . $id; + + // Check style name + if ($update['style_name'] != $style['style_name']) + { + if (!strlen($update['style_name'])) + { + trigger_error($this->user->lang['STYLE_ERR_STYLE_NAME'] . adm_back_link($update_action), E_USER_WARNING); + } + foreach ($styles as $row) + { + if ($row['style_name'] == $update['style_name']) + { + trigger_error($this->user->lang['STYLE_ERR_NAME_EXIST'] . adm_back_link($update_action), E_USER_WARNING); + } + } + } + else + { + unset($update['style_name']); + } + + // Check parent style id + if ($update['style_parent_id'] != $style['style_parent_id']) + { + if ($update['style_parent_id'] != 0) + { + $found = false; + foreach ($list as $row) + { + if ($row['style_id'] == $update['style_parent_id']) + { + $found = true; + $update['style_parent_tree'] = ($row['style_parent_tree'] != '' ? $row['style_parent_tree'] . '/' : '') . $row['style_path']; + break; + } + } + if (!$found) + { + trigger_error($this->user->lang['STYLE_ERR_INVALID_PARENT'] . adm_back_link($update_action), E_USER_WARNING); + } + } + else + { + $update['style_parent_tree'] = ''; + } + } + else + { + unset($update['style_parent_id']); + } + + // Check style_active + if ($update['style_active'] != $style['style_active']) + { + if (!$update['style_active'] && $this->default_style == $style['style_id']) + { + trigger_error($this->user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($update_action), E_USER_WARNING); + } + } + else + { + unset($update['style_active']); + } + + // Update data + if (count($update)) + { + $sql = 'UPDATE ' . STYLES_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $update) . " + WHERE style_id = $id"; + $this->db->sql_query($sql); + + $style = array_merge($style, $update); + + if (isset($update['style_parent_id'])) + { + // Update styles tree + $styles = $this->get_styles(); + if ($this->update_styles_tree($styles, $style)) + { + // Something was changed in styles tree, purge all cache + $this->cache->purge(); + } + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_EDIT_DETAILS', false, array($style['style_name'])); + } + + // Update default style + $default = $this->request->variable('style_default', 0); + if ($default) + { + if (!$style['style_active']) + { + trigger_error($this->user->lang['STYLE_DEFAULT_CHANGE_INACTIVE'] . adm_back_link($update_action), E_USER_WARNING); + } + $this->config->set('default_style', $id); + $this->cache->purge(); + } + + // Show styles list + $this->frontend(); + return; + } + + // Show page title + $this->welcome_message('ACP_STYLES', null); + + // Show parent styles + foreach ($list as $row) + { + $this->template->assign_block_vars('parent_styles', array( + 'STYLE_ID' => $row['style_id'], + 'STYLE_NAME' => htmlspecialchars($row['style_name']), + 'LEVEL' => $row['level'], + 'SPACER' => str_repeat('  ', $row['level']), + ) + ); + } + + // Show style details + $this->template->assign_vars(array( + 'S_STYLE_DETAILS' => true, + 'STYLE_ID' => $style['style_id'], + 'STYLE_NAME' => htmlspecialchars($style['style_name']), + 'STYLE_PATH' => htmlspecialchars($style['style_path']), + 'STYLE_VERSION' => htmlspecialchars($style_cfg['style_version']), + 'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']), + 'STYLE_PARENT' => $style['style_parent_id'], + 'S_STYLE_ACTIVE' => $style['style_active'], + 'S_STYLE_DEFAULT' => ($style['style_id'] == $this->default_style) + ) + ); + } + + /** + * List installed styles + */ + protected function show_installed() + { + // Get all installed styles + $styles = $this->get_styles(); + + if (!count($styles)) + { + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + usort($styles, array($this, 'sort_styles')); + + // Get users + $users = $this->get_users(); + + // Add users counter to rows + foreach ($styles as &$style) + { + $style['_users'] = isset($users[$style['style_id']]) ? $users[$style['style_id']] : 0; + } + + // Set up styles list variables + // Addons should increase this number and update template variable + $this->styles_list_cols = 4; + $this->template->assign_var('STYLES_LIST_COLS', $this->styles_list_cols); + + // Show styles list + $this->show_styles_list($styles, 0, 0); + + // Show styles with invalid inherits_id + foreach ($styles as $style) + { + if (empty($style['_shown'])) + { + $style['_note'] = sprintf($this->user->lang['REQUIRES_STYLE'], htmlspecialchars($style['style_parent_tree'])); + $this->list_style($style, 0); + } + } + + // Add buttons + $this->template->assign_block_vars('extra_actions', array( + 'ACTION_NAME' => 'activate', + 'L_ACTION' => $this->user->lang['STYLE_ACTIVATE'], + ) + ); + + $this->template->assign_block_vars('extra_actions', array( + 'ACTION_NAME' => 'deactivate', + 'L_ACTION' => $this->user->lang['STYLE_DEACTIVATE'], + ) + ); + + if (isset($this->style_counters) && $this->style_counters['total'] > 1) + { + $this->template->assign_block_vars('extra_actions', array( + 'ACTION_NAME' => 'uninstall', + 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL'], + ) + ); + } + } + + /** + * Show list of styles that can be installed + */ + protected function show_available() + { + // Get list of styles + $styles = $this->find_available(true); + + // Show styles + if (empty($styles)) + { + trigger_error($this->user->lang['NO_UNINSTALLED_STYLE'] . adm_back_link($this->u_base_action), E_USER_NOTICE); + } + + usort($styles, array($this, 'sort_styles')); + + $this->styles_list_cols = 3; + $this->template->assign_vars(array( + 'STYLES_LIST_COLS' => $this->styles_list_cols, + 'STYLES_LIST_HIDE_COUNT' => true + ) + ); + + // Show styles + foreach ($styles as &$style) + { + // Check if style has a parent style in styles list + $has_parent = false; + if ($style['_inherit_name'] != '') + { + foreach ($styles as $parent_style) + { + if ($parent_style['style_name'] == $style['_inherit_name'] && empty($parent_style['_shown'])) + { + // Show parent style first + $has_parent = true; + } + } + } + if (!$has_parent) + { + $this->list_style($style, 0); + $this->show_available_child_styles($styles, $style['style_name'], 1); + } + } + + // Show styles that do not have parent style in styles list + foreach ($styles as $style) + { + if (empty($style['_shown'])) + { + $this->list_style($style, 0); + } + } + + // Add button + if (isset($this->style_counters) && $this->style_counters['caninstall'] > 0) + { + $this->template->assign_block_vars('extra_actions', array( + 'ACTION_NAME' => 'install', + 'L_ACTION' => $this->user->lang['INSTALL_STYLES'], + ) + ); + } + } + + /** + * Find styles available for installation + * + * @param bool $all if true, function will return all installable styles. if false, function will return only styles that can be installed + * @return array List of styles + */ + protected function find_available($all) + { + // Get list of installed styles + $installed = $this->get_styles(); + + $installed_dirs = array(); + $installed_names = array(); + foreach ($installed as $style) + { + $installed_dirs[] = $style['style_path']; + $installed_names[$style['style_name']] = array( + 'path' => $style['style_path'], + 'id' => $style['style_id'], + 'parent' => $style['style_parent_id'], + 'tree' => (strlen($style['style_parent_tree']) ? $style['style_parent_tree'] . '/' : '') . $style['style_path'], + ); + } + + // Get list of directories + $dirs = $this->find_style_dirs(); + + // Find styles that can be installed + $styles = array(); + foreach ($dirs as $dir) + { + if (in_array($dir, $installed_dirs)) + { + // Style is already installed + continue; + } + $cfg = $this->read_style_cfg($dir); + if ($cfg === false) + { + // Invalid style.cfg + continue; + } + + // Style should be available for installation + $parent = $cfg['parent']; + $style = array( + 'style_id' => 0, + 'style_name' => $cfg['name'], + 'style_copyright' => $cfg['copyright'], + 'style_active' => 0, + 'style_path' => $dir, + 'bbcode_bitfield' => $cfg['template_bitfield'], + 'style_parent_id' => 0, + 'style_parent_tree' => '', + // Extra values for styles list + // All extra variable start with _ so they won't be confused with data that can be added to styles table + '_inherit_name' => $parent, + '_available' => true, + '_note' => '', + ); + + // Check style inheritance + if ($parent != '') + { + if (isset($installed_names[$parent])) + { + // Parent style is installed + $row = $installed_names[$parent]; + $style['style_parent_id'] = $row['id']; + $style['style_parent_tree'] = $row['tree']; + } + else + { + // Parent style is not installed yet + $style['_available'] = false; + $style['_note'] = sprintf($this->user->lang['REQUIRES_STYLE'], htmlspecialchars($parent)); + } + } + + if ($all || $style['_available']) + { + $styles[] = $style; + } + } + + return $styles; + } + + /** + * Show styles list + * + * @param array $styles styles list + * @param int $parent parent style id + * @param int $level style inheritance level + */ + protected function show_styles_list(&$styles, $parent, $level) + { + foreach ($styles as &$style) + { + if (empty($style['_shown']) && $style['style_parent_id'] == $parent) + { + $this->list_style($style, $level); + $this->show_styles_list($styles, $style['style_id'], $level + 1); + } + } + } + + /** + * Show available styles tree + * + * @param array $styles Styles list, passed as reference + * @param string $name Name of parent style + * @param int $level Styles tree level + */ + protected function show_available_child_styles(&$styles, $name, $level) + { + foreach ($styles as &$style) + { + if (empty($style['_shown']) && $style['_inherit_name'] == $name) + { + $this->list_style($style, $level); + $this->show_available_child_styles($styles, $style['style_name'], $level + 1); + } + } + } + + /** + * Update styles tree + * + * @param array $styles Styles list, passed as reference + * @param array|false $style Current style, false if root + * @return bool True if something was updated, false if not + */ + protected function update_styles_tree(&$styles, $style = false) + { + $parent_id = ($style === false) ? 0 : $style['style_id']; + $parent_tree = ($style === false) ? '' : ($style['style_parent_tree'] == '' ? '' : $style['style_parent_tree']) . $style['style_path']; + $update = false; + $updated = false; + foreach ($styles as &$row) + { + if ($row['style_parent_id'] == $parent_id) + { + if ($row['style_parent_tree'] != $parent_tree) + { + $row['style_parent_tree'] = $parent_tree; + $update = true; + } + $updated |= $this->update_styles_tree($styles, $row); + } + } + if ($update) + { + $sql = 'UPDATE ' . STYLES_TABLE . " + SET style_parent_tree = '" . $this->db->sql_escape($parent_tree) . "' + WHERE style_parent_id = {$parent_id}"; + $this->db->sql_query($sql); + $updated = true; + } + return $updated; + } + + /** + * Find all possible parent styles for style + * + * @param array $styles list of styles + * @param int $id id of style + * @param int $parent current parent style id + * @param int $level current tree level + * @return array Style ids, names and levels + */ + protected function find_possible_parents($styles, $id = -1, $parent = 0, $level = 0) + { + $results = array(); + foreach ($styles as $style) + { + if ($style['style_id'] != $id && $style['style_parent_id'] == $parent) + { + $results[] = array( + 'style_id' => $style['style_id'], + 'style_name' => $style['style_name'], + 'style_path' => $style['style_path'], + 'style_parent_id' => $style['style_parent_id'], + 'style_parent_tree' => $style['style_parent_tree'], + 'level' => $level + ); + $results = array_merge($results, $this->find_possible_parents($styles, $id, $style['style_id'], $level + 1)); + } + } + return $results; + } + + /** + * Show item in styles list + * + * @param array $style style row + * @param int $level style inheritance level + */ + protected function list_style(&$style, $level) + { + // Mark row as shown + if (!empty($style['_shown'])) + { + return; + } + + $style['_shown'] = true; + + // Generate template variables + $actions = array(); + $row = array( + // Style data + 'STYLE_ID' => $style['style_id'], + 'STYLE_NAME' => htmlspecialchars($style['style_name']), + 'STYLE_PHPBB_VERSION' => $this->read_style_cfg($style['style_path'])['phpbb_version'], + 'STYLE_PATH' => htmlspecialchars($style['style_path']), + 'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']), + 'STYLE_ACTIVE' => $style['style_active'], + + // Additional data + 'DEFAULT' => ($style['style_id'] && $style['style_id'] == $this->default_style), + 'USERS' => (isset($style['_users'])) ? $style['_users'] : '', + 'LEVEL' => $level, + 'PADDING' => (4 + 16 * $level), + 'SHOW_COPYRIGHT' => ($style['style_id']) ? false : true, + 'STYLE_PATH_FULL' => htmlspecialchars($this->styles_path_absolute . '/' . $style['style_path']) . '/', + + // Comment to show below style + 'COMMENT' => (isset($style['_note'])) ? $style['_note'] : '', + + // The following variables should be used by hooks to add custom HTML code + 'EXTRA' => '', + 'EXTRA_OPTIONS' => '' + ); + + // Status specific data + if ($style['style_id']) + { + // Style is installed + + // Details + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=details&id=' . $style['style_id'], + 'L_ACTION' => $this->user->lang['DETAILS'] + ); + + // Activate/Deactive + $action_name = ($style['style_active'] ? 'de' : '') . 'activate'; + + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=' . $action_name . '&hash=' . generate_link_hash($action_name) . '&id=' . $style['style_id'], + 'L_ACTION' => $this->user->lang['STYLE_' . ($style['style_active'] ? 'DE' : '') . 'ACTIVATE'] + ); + +/* // Export + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=export&hash=' . generate_link_hash('export') . '&id=' . $style['style_id'], + 'L_ACTION' => $this->user->lang['EXPORT'] + ); */ + + if ($style['style_name'] !== 'prosilver') + { + // Uninstall + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=uninstall&hash=' . generate_link_hash('uninstall') . '&id=' . $style['style_id'], + 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL'] + ); + } + + // Preview + $actions[] = array( + 'U_ACTION' => append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'style=' . $style['style_id']), + 'L_ACTION' => $this->user->lang['PREVIEW'] + ); + } + else + { + // Style is not installed + if (empty($style['_available'])) + { + $actions[] = array( + 'HTML' => $this->user->lang['CANNOT_BE_INSTALLED'] + ); + } + else + { + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=install&hash=' . generate_link_hash('install') . '&dir=' . urlencode($style['style_path']), + 'L_ACTION' => $this->user->lang['INSTALL_STYLE'] + ); + } + } + + // todo: add hook + + // Assign template variables + $this->template->assign_block_vars('styles_list', $row); + foreach ($actions as $action) + { + $this->template->assign_block_vars('styles_list.actions', $action); + } + + // Increase counters + $counter = ($style['style_id']) ? ($style['style_active'] ? 'active' : 'inactive') : (empty($style['_available']) ? 'cannotinstall' : 'caninstall'); + if (!isset($this->style_counters)) + { + $this->style_counters = array( + 'total' => 0, + 'active' => 0, + 'inactive' => 0, + 'caninstall' => 0, + 'cannotinstall' => 0 + ); + } + $this->style_counters[$counter]++; + $this->style_counters['total']++; + } + + /** + * Show welcome message + * + * @param string $title main title + * @param string $description page description + */ + protected function welcome_message($title, $description) + { + $this->template->assign_vars(array( + 'L_TITLE' => $this->user->lang[$title], + 'L_EXPLAIN' => (isset($this->user->lang[$description])) ? $this->user->lang[$description] : '' + ) + ); + } + + /** + * Find all directories that have styles + * + * @return array Directory names + */ + protected function find_style_dirs() + { + $styles = array(); + + $dp = @opendir($this->styles_path); + if ($dp) + { + while (($file = readdir($dp)) !== false) + { + $dir = $this->styles_path . $file; + if ($file[0] == '.' || !is_dir($dir)) + { + continue; + } + + if (file_exists("{$dir}/style.cfg")) + { + $styles[] = $file; + } + } + closedir($dp); + } + + return $styles; + } + + /** + * Sort styles + */ + public function sort_styles($style1, $style2) + { + if ($style1['style_active'] != $style2['style_active']) + { + return ($style1['style_active']) ? -1 : 1; + } + if (isset($style1['_available']) && $style1['_available'] != $style2['_available']) + { + return ($style1['_available']) ? -1 : 1; + } + return strcasecmp(isset($style1['style_name']) ? $style1['style_name'] : $style1['name'], isset($style2['style_name']) ? $style2['style_name'] : $style2['name']); + } + + /** + * Read style configuration file + * + * @param string $dir style directory + * @return array|bool Style data, false on error + */ + protected function read_style_cfg($dir) + { + // This should never happen, we give them a red warning because of its relevance. + if (!file_exists($this->styles_path . $dir . '/style.cfg')) + { + trigger_error($this->user->lang('NO_STYLE_CFG', $dir), E_USER_WARNING); + } + + static $required = array('name', 'phpbb_version', 'copyright'); + + $cfg = parse_cfg_file($this->styles_path . $dir . '/style.cfg'); + + // Check if it is a valid file + foreach ($required as $key) + { + if (!isset($cfg[$key])) + { + return false; + } + } + + // Check data + if (!isset($cfg['parent']) || !is_string($cfg['parent']) || $cfg['parent'] == $cfg['name']) + { + $cfg['parent'] = ''; + } + if (!isset($cfg['template_bitfield'])) + { + $cfg['template_bitfield'] = $this->default_bitfield(); + } + + return $cfg; + } + + /** + * Install style + * + * @param array $style style data + * @return int Style id + */ + protected function install_style($style) + { + global $user, $phpbb_log; + + // Generate row + $sql_ary = array(); + foreach ($style as $key => $value) + { + if ($key != 'style_id' && substr($key, 0, 1) != '_') + { + $sql_ary[$key] = $value; + } + } + + // Add to database + $this->db->sql_transaction('begin'); + + $sql = 'INSERT INTO ' . STYLES_TABLE . ' + ' . $this->db->sql_build_array('INSERT', $sql_ary); + $this->db->sql_query($sql); + + $id = $this->db->sql_nextid(); + + $this->db->sql_transaction('commit'); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_ADD', false, array($sql_ary['style_name'])); + + return $id; + } + + /** + * Lists all styles + * + * @return array Rows with styles data + */ + protected function get_styles() + { + $sql = 'SELECT * + FROM ' . STYLES_TABLE; + $result = $this->db->sql_query($sql); + + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $rows; + } + + /** + * Count users for each style + * + * @return array Styles in following format: [style_id] = number of users + */ + protected function get_users() + { + $sql = 'SELECT user_style, COUNT(user_style) AS style_count + FROM ' . USERS_TABLE . ' + GROUP BY user_style'; + $result = $this->db->sql_query($sql); + + $style_count = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $style_count[$row['user_style']] = $row['style_count']; + } + $this->db->sql_freeresult($result); + + return $style_count; + } + + /** + * Uninstall style + * + * @param array $style Style data + * @return bool|string True on success, error message on error + */ + protected function uninstall_style($style) + { + $id = $style['style_id']; + $path = $style['style_path']; + + // Check if style has child styles + $sql = 'SELECT style_id + FROM ' . STYLES_TABLE . ' + WHERE style_parent_id = ' . (int) $id . " OR style_parent_tree = '" . $this->db->sql_escape($path) . "'"; + $result = $this->db->sql_query($sql); + + $conflict = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($conflict !== false) + { + return sprintf($this->user->lang['STYLE_UNINSTALL_DEPENDENT'], $style['style_name']); + } + + // Change default style for users + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $this->default_style . ' + WHERE user_style = ' . $id; + $this->db->sql_query($sql); + + // Uninstall style + $sql = 'DELETE FROM ' . STYLES_TABLE . ' + WHERE style_id = ' . $id; + $this->db->sql_query($sql); + return true; + } + + /** + * Delete all files in style directory + * + * @param string $path Style directory + * @param string $dir Directory to remove inside style's directory + * @return bool True on success, false on error + */ + protected function delete_style_files($path, $dir = '') + { + $dirname = $this->styles_path . $path . $dir; + $result = true; + + $dp = @opendir($dirname); + + if ($dp) + { + while (($file = readdir($dp)) !== false) + { + if ($file == '.' || $file == '..') + { + continue; + } + $filename = $dirname . '/' . $file; + if (is_dir($filename)) + { + if (!$this->delete_style_files($path, $dir . '/' . $file)) + { + $result = false; + } + } + else + { + if (!@unlink($filename)) + { + $result = false; + } + } + } + closedir($dp); + } + if (!@rmdir($dirname)) + { + return false; + } + + return $result; + } + + /** + * Get list of items from posted data + * + * @param string $name Variable name + * @param string|int $default Default value for array + * @param bool $error If true, error will be triggered if list is empty + * @return array Items + */ + protected function request_vars($name, $default, $error = false) + { + $item = $this->request->variable($name, $default); + $items = $this->request->variable($name . 's', array($default)); + + if (count($items) == 1 && $items[0] == $default) + { + $items = array(); + } + + if ($item != $default && !count($items)) + { + $items[] = $item; + } + + if ($error && !count($items)) + { + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + return $items; + } + + /** + * Generates default bitfield + * + * This bitfield decides which bbcodes are defined in a template. + * + * @return string Bitfield + */ + protected function default_bitfield() + { + static $value; + if (isset($value)) + { + return $value; + } + + // Hardcoded template bitfield to add for new templates + $default_bitfield = '1111111111111'; + + $bitfield = new bitfield(); + for ($i = 0; $i < strlen($default_bitfield); $i++) + { + if ($default_bitfield[$i] == '1') + { + $bitfield->set($i); + } + } + + return $bitfield->get_base64(); + } + +} diff --git a/install/update/new/includes/acp/acp_update.php b/install/update/new/includes/acp/acp_update.php new file mode 100644 index 0000000..fa3afa6 --- /dev/null +++ b/install/update/new/includes/acp/acp_update.php @@ -0,0 +1,88 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_update +{ + var $u_action; + + function main($id, $mode) + { + global $config, $user, $template, $request; + global $phpbb_root_path, $phpEx, $phpbb_container; + + $user->add_lang('install'); + + $this->tpl_name = 'acp_update'; + $this->page_title = 'ACP_VERSION_CHECK'; + + /* @var $version_helper \phpbb\version_helper */ + $version_helper = $phpbb_container->get('version_helper'); + try + { + $recheck = $request->variable('versioncheck_force', false); + $updates_available = $version_helper->get_update_on_branch($recheck); + $upgrades_available = $version_helper->get_suggested_updates(); + if (!empty($upgrades_available)) + { + $upgrades_available = array_pop($upgrades_available); + } + } + catch (\RuntimeException $e) + { + $template->assign_var('S_VERSIONCHECK_FAIL', true); + + $updates_available = array(); + } + + if (!empty($updates_available)) + { + $template->assign_block_vars('updates_available', $updates_available); + } + + $update_link = $phpbb_root_path . 'install/app.' . $phpEx; + + $template_ary = [ + 'S_UP_TO_DATE' => empty($updates_available), + 'U_ACTION' => $this->u_action, + 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'), + + 'CURRENT_VERSION' => $config['version'], + + 'UPDATE_INSTRUCTIONS' => $user->lang('UPDATE_INSTRUCTIONS', $update_link), + 'S_VERSION_UPGRADEABLE' => !empty($upgrades_available), + 'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false, + ]; + + $template->assign_vars($template_ary); + + // Incomplete update? + if (phpbb_version_compare($config['version'], PHPBB_VERSION, '<')) + { + $database_update_link = $phpbb_root_path . 'install/app.php/update'; + + $template->assign_vars(array( + 'S_UPDATE_INCOMPLETE' => true, + 'FILES_VERSION' => PHPBB_VERSION, + 'INCOMPLETE_INSTRUCTIONS' => $user->lang('UPDATE_INCOMPLETE_EXPLAIN', $database_update_link), + )); + } + } +} diff --git a/install/update/new/includes/acp/acp_users.php b/install/update/new/includes/acp/acp_users.php new file mode 100644 index 0000000..6993c86 --- /dev/null +++ b/install/update/new/includes/acp/acp_users.php @@ -0,0 +1,2689 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_users +{ + var $u_action; + var $p_master; + + function __construct($p_master) + { + $this->p_master = $p_master; + } + + function main($id, $mode) + { + global $config, $db, $user, $auth, $template; + global $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $phpbb_dispatcher, $request; + global $phpbb_container, $phpbb_log; + + $user->add_lang(array('posting', 'ucp', 'acp/users')); + $this->tpl_name = 'acp_users'; + + $error = array(); + $username = $request->variable('username', '', true); + $user_id = $request->variable('u', 0); + $action = $request->variable('action', ''); + + // Get referer to redirect user to the appropriate page after delete action + $redirect = $request->variable('redirect', ''); + $redirect_tag = "redirect=$redirect"; + $redirect_url = append_sid("{$phpbb_admin_path}index.$phpEx", "i=$redirect"); + + $submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false; + + $form_name = 'acp_users'; + add_form_key($form_name); + + // Whois (special case) + if ($action == 'whois') + { + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $this->page_title = 'WHOIS'; + $this->tpl_name = 'simple_body'; + + $user_ip = phpbb_ip_normalise($request->variable('user_ip', '')); + $domain = gethostbyaddr($user_ip); + $ipwhois = user_ipwhois($user_ip); + + $template->assign_vars(array( + 'MESSAGE_TITLE' => sprintf($user->lang['IP_WHOIS_FOR'], $domain), + 'MESSAGE_TEXT' => nl2br($ipwhois)) + ); + + return; + } + + // Show user selection mask + if (!$username && !$user_id) + { + $this->page_title = 'SELECT_USER'; + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + 'ANONYMOUS_USER_ID' => ANONYMOUS, + + 'S_SELECT_USER' => true, + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_user&field=username&select_single=true'), + )); + + return; + } + + if (!$user_id) + { + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $result = $db->sql_query($sql); + $user_id = (int) $db->sql_fetchfield('user_id'); + $db->sql_freeresult($result); + + if (!$user_id) + { + trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + // Generate content for all modes + $sql = 'SELECT u.*, s.* + FROM ' . USERS_TABLE . ' u + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) + WHERE u.user_id = ' . $user_id . ' + ORDER BY s.session_time DESC'; + $result = $db->sql_query_limit($sql, 1); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Generate overall "header" for user admin + $s_form_options = ''; + + // Build modes dropdown list + $sql = 'SELECT module_mode, module_auth + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_users' + AND module_enabled = 1 + AND module_class = 'acp' + ORDER BY left_id, module_mode"; + $result = $db->sql_query($sql); + + $dropdown_modes = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!$this->p_master->module_auth_self($row['module_auth'])) + { + continue; + } + + $dropdown_modes[$row['module_mode']] = true; + } + $db->sql_freeresult($result); + + foreach ($dropdown_modes as $module_mode => $null) + { + $selected = ($mode == $module_mode) ? ' selected="selected"' : ''; + $s_form_options .= ''; + } + + $template->assign_vars(array( + 'U_BACK' => (empty($redirect)) ? $this->u_action : $redirect_url, + 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"), + 'U_ACTION' => $this->u_action . '&u=' . $user_id . ((empty($redirect)) ? '' : '&' . $redirect_tag), + 'S_FORM_OPTIONS' => $s_form_options, + 'MANAGED_USERNAME' => $user_row['username']) + ); + + // Prevent normal users/admins change/view founders if they are not a founder by themselves + if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $this->page_title = $user_row['username'] . ' :: ' . $user->lang('ACP_USER_' . strtoupper($mode)); + + switch ($mode) + { + case 'overview': + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $user->add_lang('acp/ban'); + + $delete = $request->variable('delete', 0); + $delete_type = $request->variable('delete_type', ''); + $ip = $request->variable('ip', 'ip'); + + /** + * Run code at beginning of ACP users overview + * + * @event core.acp_users_overview_before + * @var array user_row Current user data + * @var string mode Active module + * @var string action Module that should be run + * @var bool submit Do we display the form only + * or did the user press submit + * @var array error Array holding error messages + * @since 3.1.3-RC1 + */ + $vars = array('user_row', 'mode', 'action', 'submit', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_before', compact($vars))); + + if ($submit) + { + if ($delete) + { + if (!$auth->acl_get('a_userdel')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Check if the user wants to remove himself or the guest user account + if ($user_id == ANONYMOUS) + { + trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Founders can not be deleted. + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_REMOVE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_id == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($delete_type) + { + if (confirm_box(true)) + { + user_delete($delete_type, $user_id, $user_row['username']); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DELETED', false, array($user_row['username'])); + trigger_error($user->lang['USER_DELETED'] . adm_back_link( + (empty($redirect)) ? $this->u_action : $redirect_url + ) + ); + } + else + { + $delete_confirm_hidden_fields = array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true, + 'delete' => 1, + 'delete_type' => $delete_type, + ); + + // Checks if the redirection page is specified + if (!empty($redirect)) + { + $delete_confirm_hidden_fields['redirect'] = $redirect; + } + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($delete_confirm_hidden_fields)); + } + } + else + { + trigger_error($user->lang['NO_MODE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + + // Handle quicktool actions + switch ($action) + { + case 'banuser': + case 'banemail': + case 'banip': + + if ($user_id == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_id == ANONYMOUS) + { + trigger_error($user->lang['CANNOT_BAN_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_BAN_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $ban = array(); + + switch ($action) + { + case 'banuser': + $ban[] = $user_row['username']; + $reason = 'USER_ADMIN_BAN_NAME_REASON'; + break; + + case 'banemail': + $ban[] = $user_row['user_email']; + $reason = 'USER_ADMIN_BAN_EMAIL_REASON'; + break; + + case 'banip': + $ban[] = $user_row['user_ip']; + + $sql = 'SELECT DISTINCT poster_ip + FROM ' . POSTS_TABLE . " + WHERE poster_id = $user_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $ban[] = $row['poster_ip']; + } + $db->sql_freeresult($result); + + $reason = 'USER_ADMIN_BAN_IP_REASON'; + break; + } + + $ban_reason = $request->variable('ban_reason', $user->lang[$reason], true); + $ban_give_reason = $request->variable('ban_give_reason', '', true); + + // Log not used at the moment, we simply utilize the ban function. + $result = user_ban(substr($action, 3), $ban, 0, 0, 0, $ban_reason, $ban_give_reason); + + trigger_error((($result === false) ? $user->lang['BAN_ALREADY_ENTERED'] : $user->lang['BAN_SUCCESSFUL']) . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'reactivate': + + if ($user_id == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_FORCE_REACT_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error($user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($config['email_enable']) + { + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } + + $server_url = generate_board_url(); + + $user_actkey = gen_rand_string(mt_rand(6, 10)); + $email_template = ($user_row['user_type'] == USER_NORMAL) ? 'user_reactivate_account' : 'user_resend_inactive'; + + if ($user_row['user_type'] == USER_NORMAL) + { + user_active_flip('deactivate', $user_id, INACTIVE_REMIND); + } + else + { + // Grabbing the last confirm key - we only send a reminder + $sql = 'SELECT user_actkey + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $user_activation_key = (string) $db->sql_fetchfield('user_actkey'); + $db->sql_freeresult($result); + + $user_actkey = empty($user_activation_key) ? $user_actkey : $user_activation_key; + } + + if ($user_row['user_type'] == USER_NORMAL || empty($user_activation_key)) + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_actkey = '" . $db->sql_escape($user_actkey) . "' + WHERE user_id = $user_id"; + $db->sql_query($sql); + } + + $messenger = new messenger(false); + + $messenger->template($email_template, $user_row['user_lang']); + + $messenger->set_addresses($user_row); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'USERNAME' => htmlspecialchars_decode($user_row['username']), + 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey") + ); + + $messenger->send(NOTIFY_EMAIL); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_REACTIVATE', false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_REACTIVATE_USER', false, array( + 'reportee_id' => $user_id + )); + + trigger_error($user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + break; + + case 'active': + + if ($user_id == $user->data['user_id']) + { + // It is only deactivation since the user is already activated (else he would not have reached this page) + trigger_error($user->lang['CANNOT_DEACTIVATE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_DEACTIVATE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error($user->lang['CANNOT_DEACTIVATE_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + user_active_flip('flip', $user_id); + + if ($user_row['user_type'] == USER_INACTIVE) + { + if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']); + + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } + + $messenger = new messenger(false); + + $messenger->template('admin_welcome_activated', $user_row['user_lang']); + + $messenger->set_addresses($user_row); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($user_row['username'])) + ); + + $messenger->send(NOTIFY_EMAIL); + } + } + + $message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED'; + $log = ($user_row['user_type'] == USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE'; + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, $log . '_USER', false, array( + 'reportee_id' => $user_id + )); + + trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'delsig': + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $sql_ary = array( + 'user_sig' => '', + 'user_sig_bbcode_uid' => '', + 'user_sig_bbcode_bitfield' => '' + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_SIG', false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_SIG_USER', false, array( + 'reportee_id' => $user_id + )); + + trigger_error($user->lang['USER_ADMIN_SIG_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'delavatar': + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Delete old avatar if present + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $phpbb_avatar_manager->clean_row($user_row, 'user'), USERS_TABLE, 'user_'); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_AVATAR', false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_AVATAR_USER', false, array( + 'reportee_id' => $user_id + )); + + trigger_error($user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + break; + + case 'delposts': + + if (confirm_box(true)) + { + // Delete posts, attachments, etc. + delete_posts('poster_id', $user_id); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_POSTS', false, array($user_row['username'])); + trigger_error($user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + + break; + + case 'delattach': + + if (confirm_box(true)) + { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('user', $user_id); + unset($attachment_manager); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_ATTACH', false, array($user_row['username'])); + trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + + break; + + case 'deloutbox': + + if (confirm_box(true)) + { + $msg_ids = array(); + $lang = 'EMPTY'; + + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE author_id = $user_id + AND folder_id = " . PRIVMSGS_OUTBOX; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + if (!function_exists('delete_pm')) + { + include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + } + + do + { + $msg_ids[] = (int) $row['msg_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + + delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_OUTBOX', false, array($user_row['username'])); + + $lang = 'EMPTIED'; + } + $db->sql_freeresult($result); + + trigger_error($user->lang['USER_OUTBOX_' . $lang] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + break; + + case 'moveposts': + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $user->add_lang('acp/forums'); + + $new_forum_id = $request->variable('new_f', 0); + + if (!$new_forum_id) + { + $this->page_title = 'USER_ADMIN_MOVE_POSTS'; + + $template->assign_vars(array( + 'S_SELECT_FORUM' => true, + 'U_ACTION' => $this->u_action . "&action=$action&u=$user_id", + 'U_BACK' => $this->u_action . "&u=$user_id", + 'S_FORUM_OPTIONS' => make_forum_select(false, false, false, true)) + ); + + return; + } + + // Is the new forum postable to? + $sql = 'SELECT forum_name, forum_type + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $new_forum_id"; + $result = $db->sql_query($sql); + $forum_info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$forum_info) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($forum_info['forum_type'] != FORUM_POST) + { + trigger_error($user->lang['MOVE_POSTS_NO_POSTABLE_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Two stage? + // Move topics comprising only posts from this user + $topic_id_ary = $move_topic_ary = $move_post_ary = $new_topic_id_ary = array(); + $forum_id_ary = array($new_forum_id); + + $sql = 'SELECT topic_id, post_visibility, COUNT(post_id) AS total_posts + FROM ' . POSTS_TABLE . " + WHERE poster_id = $user_id + AND forum_id <> $new_forum_id + GROUP BY topic_id, post_visibility"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id_ary[$row['topic_id']][$row['post_visibility']] = $row['total_posts']; + } + $db->sql_freeresult($result); + + if (count($topic_id_ary)) + { + $sql = 'SELECT topic_id, forum_id, topic_title, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_attachment + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts_approved'] + && $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved'] + && $topic_id_ary[$row['topic_id']][ITEM_REAPPROVE] == $row['topic_posts_unapproved'] + && $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted']) + { + $move_topic_ary[] = $row['topic_id']; + } + else + { + $move_post_ary[$row['topic_id']]['title'] = $row['topic_title']; + $move_post_ary[$row['topic_id']]['attach'] = ($row['topic_attachment']) ? 1 : 0; + } + + $forum_id_ary[] = $row['forum_id']; + } + $db->sql_freeresult($result); + } + + // Entire topic comprises posts by this user, move these topics + if (count($move_topic_ary)) + { + move_topics($move_topic_ary, $new_forum_id, false); + } + + if (count($move_post_ary)) + { + // Create new topic + // Update post_ids, report_ids, attachment_ids + foreach ($move_post_ary as $topic_id => $post_ary) + { + // Create new topic + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'topic_poster' => $user_id, + 'topic_time' => time(), + 'forum_id' => $new_forum_id, + 'icon_id' => 0, + 'topic_visibility' => ITEM_APPROVED, + 'topic_title' => $post_ary['title'], + 'topic_first_poster_name' => $user_row['username'], + 'topic_type' => POST_NORMAL, + 'topic_time_limit' => 0, + 'topic_attachment' => $post_ary['attach']) + ); + $db->sql_query($sql); + + $new_topic_id = $db->sql_nextid(); + + // Move posts + $sql = 'UPDATE ' . POSTS_TABLE . " + SET forum_id = $new_forum_id, topic_id = $new_topic_id + WHERE topic_id = $topic_id + AND poster_id = $user_id"; + $db->sql_query($sql); + + if ($post_ary['attach']) + { + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " + SET topic_id = $new_topic_id + WHERE topic_id = $topic_id + AND poster_id = $user_id"; + $db->sql_query($sql); + } + + $new_topic_id_ary[] = $new_topic_id; + } + } + + $forum_id_ary = array_unique($forum_id_ary); + $topic_id_ary = array_unique(array_merge(array_keys($topic_id_ary), $new_topic_id_ary)); + + if (count($topic_id_ary)) + { + sync('topic_reported', 'topic_id', $topic_id_ary); + sync('topic', 'topic_id', $topic_id_ary); + } + + if (count($forum_id_ary)) + { + sync('forum', 'forum_id', $forum_id_ary, false, true); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_MOVE_POSTS', false, array($user_row['username'], $forum_info['forum_name'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_MOVE_POSTS_USER', false, array( + 'reportee_id' => $user_id, + $forum_info['forum_name'] + )); + + trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'leave_nr': + + if (confirm_box(true)) + { + remove_newly_registered($user_id, $user_row); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_REMOVED_NR', false, array($user_row['username'])); + trigger_error($user->lang['USER_LIFTED_NR'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + + break; + + default: + $u_action = $this->u_action; + + /** + * Run custom quicktool code + * + * @event core.acp_users_overview_run_quicktool + * @var string action Quick tool that should be run + * @var array user_row Current user data + * @var string u_action The u_action link + * @since 3.1.0-a1 + * @changed 3.2.2-RC1 Added u_action + */ + $vars = array('action', 'user_row', 'u_action'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_run_quicktool', compact($vars))); + + unset($u_action); + break; + } + + // Handle registration info updates + $data = array( + 'username' => $request->variable('user', $user_row['username'], true), + 'user_founder' => $request->variable('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), + 'email' => strtolower($request->variable('user_email', $user_row['user_email'])), + 'new_password' => $request->variable('new_password', '', true), + 'password_confirm' => $request->variable('password_confirm', '', true), + ); + + // Validation data - we do not check the password complexity setting here + $check_ary = array( + 'new_password' => array( + array('string', true, $config['min_pass_chars'], 0), + array('password')), + 'password_confirm' => array('string', true, $config['min_pass_chars'], 0), + ); + + // Check username if altered + if ($data['username'] != $user_row['username']) + { + $check_ary += array( + 'username' => array( + array('string', false, $config['min_name_chars'], $config['max_name_chars']), + array('username', $user_row['username'], true) + ), + ); + } + + // Check email if altered + if ($data['email'] != $user_row['user_email']) + { + $check_ary += array( + 'email' => array( + array('string', false, 6, 60), + array('user_email', $user_row['user_email']), + ), + ); + } + + $error = validate_data($data, $check_ary); + + if ($data['new_password'] && $data['password_confirm'] != $data['new_password']) + { + $error[] = 'NEW_PASSWORD_ERROR'; + } + + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + + // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + + // Which updates do we need to do? + $update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false; + $update_password = $data['new_password'] && !$passwords_manager->check($data['new_password'], $user_row['user_password']); + $update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false; + + if (!count($error)) + { + $sql_ary = array(); + + if ($user_row['user_type'] != USER_FOUNDER || $user->data['user_type'] == USER_FOUNDER) + { + // Only allow founders updating the founder status... + if ($user->data['user_type'] == USER_FOUNDER) + { + // Setting a normal member to be a founder + if ($data['user_founder'] && $user_row['user_type'] != USER_FOUNDER) + { + // Make sure the user is not setting an Inactive or ignored user to be a founder + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error($user->lang['CANNOT_SET_FOUNDER_IGNORED'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_INACTIVE) + { + trigger_error($user->lang['CANNOT_SET_FOUNDER_INACTIVE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $sql_ary['user_type'] = USER_FOUNDER; + } + else if (!$data['user_founder'] && $user_row['user_type'] == USER_FOUNDER) + { + // Check if at least one founder is present + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_FOUNDER . ' + AND user_id <> ' . $user_id; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $sql_ary['user_type'] = USER_NORMAL; + } + else + { + trigger_error($user->lang['AT_LEAST_ONE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + } + } + + /** + * Modify user data before we update it + * + * @event core.acp_users_overview_modify_data + * @var array user_row Current user data + * @var array data Submitted user data + * @var array sql_ary User data we udpate + * @since 3.1.0-a1 + */ + $vars = array('user_row', 'data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_modify_data', compact($vars))); + + if ($update_username !== false) + { + $sql_ary['username'] = $update_username; + $sql_ary['username_clean'] = utf8_clean_string($update_username); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_NAME', false, array( + 'reportee_id' => $user_id, + $user_row['username'], + $update_username + )); + } + + if ($update_email !== false) + { + $sql_ary += ['user_email' => $update_email]; + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_EMAIL', false, array( + 'reportee_id' => $user_id, + $user_row['username'], + $user_row['user_email'], + $update_email + )); + } + + if ($update_password) + { + $sql_ary += array( + 'user_password' => $passwords_manager->hash($data['new_password']), + 'user_passchg' => time(), + ); + + $user->reset_login_keys($user_id); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array( + 'reportee_id' => $user_id, + $user_row['username'] + )); + } + + if (count($sql_ary)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + } + + if ($update_username) + { + user_update_name($user_row['username'], $update_username); + } + + // Let the users permissions being updated + $auth->acl_clear_prefetch($user_id); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_USER_UPDATE', false, array($data['username'])); + + trigger_error($user->lang['USER_OVERVIEW_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + if ($user_id == $user->data['user_id']) + { + $quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH', 'deloutbox' => 'DEL_OUTBOX'); + if ($user_row['user_new']) + { + $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; + } + } + else + { + $quick_tool_ary = array(); + + if ($user_row['user_type'] != USER_FOUNDER) + { + $quick_tool_ary += array('banuser' => 'BAN_USER', 'banemail' => 'BAN_EMAIL', 'banip' => 'BAN_IP'); + } + + if ($user_row['user_type'] != USER_FOUNDER && $user_row['user_type'] != USER_IGNORE) + { + $quick_tool_ary += array('active' => (($user_row['user_type'] == USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE')); + } + + $quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH', 'deloutbox' => 'DEL_OUTBOX'); + + if ($config['email_enable'] && ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_INACTIVE)) + { + $quick_tool_ary['reactivate'] = 'FORCE'; + } + + if ($user_row['user_new']) + { + $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; + } + } + + if ($config['load_onlinetrack']) + { + $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline + FROM ' . SESSIONS_TABLE . " + WHERE session_user_id = $user_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $user_row['session_time'] = (isset($row['session_time'])) ? $row['session_time'] : 0; + $user_row['session_viewonline'] = (isset($row['session_viewonline'])) ? $row['session_viewonline'] : 0; + unset($row); + } + + /** + * Add additional quick tool options and overwrite user data + * + * @event core.acp_users_display_overview + * @var array user_row Array with user data + * @var array quick_tool_ary Ouick tool options + * @since 3.1.0-a1 + */ + $vars = array('user_row', 'quick_tool_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_display_overview', compact($vars))); + + $s_action_options = ''; + foreach ($quick_tool_ary as $value => $lang) + { + $s_action_options .= ''; + } + + $last_active = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit']; + + $inactive_reason = ''; + if ($user_row['user_type'] == USER_INACTIVE) + { + $inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN']; + + switch ($user_row['user_inactive_reason']) + { + case INACTIVE_REGISTER: + $inactive_reason = $user->lang['INACTIVE_REASON_REGISTER']; + break; + + case INACTIVE_PROFILE: + $inactive_reason = $user->lang['INACTIVE_REASON_PROFILE']; + break; + + case INACTIVE_MANUAL: + $inactive_reason = $user->lang['INACTIVE_REASON_MANUAL']; + break; + + case INACTIVE_REMIND: + $inactive_reason = $user->lang['INACTIVE_REASON_REMIND']; + break; + } + } + + // Posts in Queue + $sql = 'SELECT COUNT(post_id) as posts_in_queue + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . $user_id . ' + AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)); + $result = $db->sql_query($sql); + $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); + $db->sql_freeresult($result); + + $sql = 'SELECT post_id + FROM ' . POSTS_TABLE . ' + WHERE poster_id = '. $user_id; + $result = $db->sql_query_limit($sql, 1); + $user_row['user_has_posts'] = (bool) $db->sql_fetchfield('post_id'); + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'L_NAME_CHARS_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), + 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars'])), + 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']), + 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, + + 'S_OVERVIEW' => true, + 'S_USER_IP' => ($user_row['user_ip']) ? true : false, + 'S_USER_FOUNDER' => ($user_row['user_type'] == USER_FOUNDER) ? true : false, + 'S_ACTION_OPTIONS' => $s_action_options, + 'S_OWN_ACCOUNT' => ($user_id == $user->data['user_id']) ? true : false, + 'S_USER_INACTIVE' => ($user_row['user_type'] == USER_INACTIVE) ? true : false, + + 'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'), + 'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}", + 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', + 'U_SEARCH_USER' => ($config['load_search'] && $auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$user_row['user_id']}&sr=posts") : '', + + 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_row['user_id']}&hash=" . generate_link_hash('switchperm')) : '', + + 'POSTS_IN_QUEUE' => $user_row['posts_in_queue'], + 'USER' => $user_row['username'], + 'USER_REGISTERED' => $user->format_date($user_row['user_regdate']), + 'REGISTERED_IP' => ($ip == 'hostname') ? gethostbyaddr($user_row['user_ip']) : $user_row['user_ip'], + 'USER_LASTACTIVE' => ($last_active) ? $user->format_date($last_active) : ' - ', + 'USER_EMAIL' => $user_row['user_email'], + 'USER_WARNINGS' => $user_row['user_warnings'], + 'USER_POSTS' => $user_row['user_posts'], + 'USER_HAS_POSTS' => $user_row['user_has_posts'], + 'USER_INACTIVE_REASON' => $inactive_reason, + )); + + break; + + case 'feedback': + + $user->add_lang('mcp'); + + // Set up general vars + $start = $request->variable('start', 0); + $deletemark = (isset($_POST['delmarked'])) ? true : false; + $deleteall = (isset($_POST['delall'])) ? true : false; + $marked = $request->variable('mark', array(0)); + $message = $request->variable('message', '', true); + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + // Sort keys + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); + + // Delete entries if requested and able + if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) + { + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $where_sql = ''; + if ($deletemark && $marked) + { + $sql_in = array(); + foreach ($marked as $mark) + { + $sql_in[] = $mark; + } + $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); + unset($sql_in); + } + + if ($where_sql || $deleteall) + { + $sql = 'DELETE FROM ' . LOG_TABLE . ' + WHERE log_type = ' . LOG_USERS . " + AND reportee_id = $user_id + $where_sql"; + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CLEAR_USER', false, array($user_row['username'])); + } + } + + if ($submit && $message) + { + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array($user_row['username'])); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $user_row['username'] + )); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GENERAL', false, array( + 'reportee_id' => $user_id, + $message + )); + + trigger_error($user->lang['USER_FEEDBACK_ADDED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Sorting + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); + $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + // Define where and sort sql for use in displaying logs + $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; + $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + + // Grab log data + $log_data = array(); + $log_count = 0; + $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); + + $base_url = $this->u_action . "&u=$user_id&$u_sort_param"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'S_FEEDBACK' => true, + + 'S_LIMIT_DAYS' => $s_limit_days, + 'S_SORT_KEY' => $s_sort_key, + 'S_SORT_DIR' => $s_sort_dir, + 'S_CLEARLOGS' => $auth->acl_get('a_clearlogs')) + ); + + foreach ($log_data as $row) + { + $template->assign_block_vars('log', array( + 'USERNAME' => $row['username_full'], + 'IP' => $row['ip'], + 'DATE' => $user->format_date($row['time']), + 'ACTION' => nl2br($row['action']), + 'ID' => $row['id']) + ); + } + + break; + + case 'warnings': + $user->add_lang('mcp'); + + // Set up general vars + $deletemark = (isset($_POST['delmarked'])) ? true : false; + $deleteall = (isset($_POST['delall'])) ? true : false; + $confirm = (isset($_POST['confirm'])) ? true : false; + $marked = $request->variable('mark', array(0)); + + // Delete entries if requested and able + if ($deletemark || $deleteall || $confirm) + { + if (confirm_box(true)) + { + $where_sql = ''; + $deletemark = $request->variable('delmarked', 0); + $deleteall = $request->variable('delall', 0); + if ($deletemark && $marked) + { + $where_sql = ' AND ' . $db->sql_in_set('warning_id', array_values($marked)); + } + + if ($where_sql || $deleteall) + { + $sql = 'DELETE FROM ' . WARNINGS_TABLE . " + WHERE user_id = $user_id + $where_sql"; + $db->sql_query($sql); + + if ($deleteall) + { + $log_warnings = $deleted_warnings = 0; + } + else + { + $num_warnings = (int) $db->sql_affectedrows(); + $deleted_warnings = ' user_warnings - ' . $num_warnings; + $log_warnings = ($num_warnings > 2) ? 2 : $num_warnings; + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_warnings = $deleted_warnings + WHERE user_id = $user_id"; + $db->sql_query($sql); + + if ($log_warnings) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WARNINGS_DELETED', false, array($user_row['username'], $num_warnings)); + } + else + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WARNINGS_DELETED_ALL', false, array($user_row['username'])); + } + } + } + else + { + $s_hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'u' => $user_id, + 'mark' => $marked, + ); + if (isset($_POST['delmarked'])) + { + $s_hidden_fields['delmarked'] = 1; + } + if (isset($_POST['delall'])) + { + $s_hidden_fields['delall'] = 1; + } + if (isset($_POST['delall']) || (isset($_POST['delmarked']) && count($marked))) + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); + } + } + } + + $sql = 'SELECT w.warning_id, w.warning_time, w.post_id, l.log_operation, l.log_data, l.user_id AS mod_user_id, m.username AS mod_username, m.user_colour AS mod_user_colour + FROM ' . WARNINGS_TABLE . ' w + LEFT JOIN ' . LOG_TABLE . ' l + ON (w.log_id = l.log_id) + LEFT JOIN ' . USERS_TABLE . ' m + ON (l.user_id = m.user_id) + WHERE w.user_id = ' . $user_id . ' + ORDER BY w.warning_time DESC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$row['log_operation']) + { + // We do not have a log-entry anymore, so there is no data available + $row['action'] = $user->lang['USER_WARNING_LOG_DELETED']; + } + else + { + $row['action'] = (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}'; + if (!empty($row['log_data'])) + { + $log_data_ary = @unserialize($row['log_data']); + $log_data_ary = ($log_data_ary === false) ? array() : $log_data_ary; + + if (isset($user->lang[$row['log_operation']])) + { + // Check if there are more occurrences of % than arguments, if there are we fill out the arguments array + // It doesn't matter if we add more arguments than placeholders + if ((substr_count($row['action'], '%') - count($log_data_ary)) > 0) + { + $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - count($log_data_ary), '')); + } + $row['action'] = vsprintf($row['action'], $log_data_ary); + $row['action'] = bbcode_nl2br(censor_text($row['action'])); + } + else if (!empty($log_data_ary)) + { + $row['action'] .= '
' . implode('', $log_data_ary); + } + } + } + + $template->assign_block_vars('warn', array( + 'ID' => $row['warning_id'], + 'USERNAME' => ($row['log_operation']) ? get_username_string('full', $row['mod_user_id'], $row['mod_username'], $row['mod_user_colour']) : '-', + 'ACTION' => make_clickable($row['action']), + 'DATE' => $user->format_date($row['warning_time']), + )); + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_WARNINGS' => true, + )); + + break; + + case 'profile': + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + + $cp_data = $cp_error = array(); + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $user_row['iso_lang_id'] = $row['lang_id']; + + $data = array( + 'jabber' => $request->variable('jabber', $user_row['user_jabber'], true), + 'bday_day' => 0, + 'bday_month' => 0, + 'bday_year' => 0, + ); + + if ($user_row['user_birthday']) + { + list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user_row['user_birthday']); + } + + $data['bday_day'] = $request->variable('bday_day', $data['bday_day']); + $data['bday_month'] = $request->variable('bday_month', $data['bday_month']); + $data['bday_year'] = $request->variable('bday_year', $data['bday_year']); + $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']); + + /** + * Modify user data on editing profile in ACP + * + * @event core.acp_users_modify_profile + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @var int user_id The user id + * @var array user_row Array with the full user data + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit', 'user_id', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_modify_profile', compact($vars))); + + if ($submit) + { + $error = validate_data($data, array( + 'jabber' => array( + array('string', true, 5, 255), + array('jabber')), + 'bday_day' => array('num', true, 1, 31), + 'bday_month' => array('num', true, 1, 12), + 'bday_year' => array('num', true, 1901, gmdate('Y', time())), + 'user_birthday' => array('date', true), + )); + + // validate custom profile fields + $cp->submit_cp_field('profile', $user_row['iso_lang_id'], $cp_data, $cp_error); + + if (count($cp_error)) + { + $error = array_merge($error, $cp_error); + } + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + + /** + * Validate profile data in ACP before submitting to the database + * + * @event core.acp_users_profile_validate + * @var array data Array with user profile data + * @var int user_id The user id + * @var array user_row Array with the full user data + * @var array error Array with the form errors + * @since 3.1.4-RC1 + * @changed 3.1.12-RC1 Removed submit, added user_id, user_row + */ + $vars = array('data', 'user_id', 'user_row', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars))); + + if (!count($error)) + { + $sql_ary = array( + 'user_jabber' => $data['jabber'], + 'user_birthday' => $data['user_birthday'], + ); + + /** + * Modify profile data in ACP before submitting to the database + * + * @event core.acp_users_profile_modify_sql_ary + * @var array cp_data Array with the user custom profile fields data + * @var array data Array with user profile data + * @var int user_id The user id + * @var array user_row Array with the full user data + * @var array sql_ary Array with sql data + * @since 3.1.4-RC1 + */ + $vars = array('cp_data', 'data', 'user_id', 'user_row', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_modify_sql_ary', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + // Update Custom Fields + $cp->update_profile_field_data($user_id, $cp_data); + + trigger_error($user->lang['USER_PROFILE_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + $s_birthday_day_options = ''; + for ($i = 1; $i < 32; $i++) + { + $selected = ($i == $data['bday_day']) ? ' selected="selected"' : ''; + $s_birthday_day_options .= ""; + } + + $s_birthday_month_options = ''; + for ($i = 1; $i < 13; $i++) + { + $selected = ($i == $data['bday_month']) ? ' selected="selected"' : ''; + $s_birthday_month_options .= ""; + } + + $now = getdate(); + $s_birthday_year_options = ''; + for ($i = $now['year'] - 100; $i <= $now['year']; $i++) + { + $selected = ($i == $data['bday_year']) ? ' selected="selected"' : ''; + $s_birthday_year_options .= ""; + } + unset($now); + + $template->assign_vars(array( + 'JABBER' => $data['jabber'], + 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, + 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, + 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, + + 'S_PROFILE' => true) + ); + + // Get additional profile fields and assign them to the template block var 'profile_fields' + $user->get_profile_fields($user_id); + + $cp->generate_profile_fields('profile', $user_row['iso_lang_id']); + + break; + + case 'prefs': + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $data = array( + 'dateformat' => $request->variable('dateformat', $user_row['user_dateformat'], true), + 'lang' => basename($request->variable('lang', $user_row['user_lang'])), + 'tz' => $request->variable('tz', $user_row['user_timezone']), + 'style' => $request->variable('style', $user_row['user_style']), + 'viewemail' => $request->variable('viewemail', $user_row['user_allow_viewemail']), + 'massemail' => $request->variable('massemail', $user_row['user_allow_massemail']), + 'hideonline' => $request->variable('hideonline', !$user_row['user_allow_viewonline']), + 'notifymethod' => $request->variable('notifymethod', $user_row['user_notify_type']), + 'notifypm' => $request->variable('notifypm', $user_row['user_notify_pm']), + 'allowpm' => $request->variable('allowpm', $user_row['user_allow_pm']), + + 'topic_sk' => $request->variable('topic_sk', ($user_row['user_topic_sortby_type']) ? $user_row['user_topic_sortby_type'] : 't'), + 'topic_sd' => $request->variable('topic_sd', ($user_row['user_topic_sortby_dir']) ? $user_row['user_topic_sortby_dir'] : 'd'), + 'topic_st' => $request->variable('topic_st', ($user_row['user_topic_show_days']) ? $user_row['user_topic_show_days'] : 0), + + 'post_sk' => $request->variable('post_sk', ($user_row['user_post_sortby_type']) ? $user_row['user_post_sortby_type'] : 't'), + 'post_sd' => $request->variable('post_sd', ($user_row['user_post_sortby_dir']) ? $user_row['user_post_sortby_dir'] : 'a'), + 'post_st' => $request->variable('post_st', ($user_row['user_post_show_days']) ? $user_row['user_post_show_days'] : 0), + + 'view_images' => $request->variable('view_images', $this->optionget($user_row, 'viewimg')), + 'view_flash' => $request->variable('view_flash', $this->optionget($user_row, 'viewflash')), + 'view_smilies' => $request->variable('view_smilies', $this->optionget($user_row, 'viewsmilies')), + 'view_sigs' => $request->variable('view_sigs', $this->optionget($user_row, 'viewsigs')), + 'view_avatars' => $request->variable('view_avatars', $this->optionget($user_row, 'viewavatars')), + 'view_wordcensor' => $request->variable('view_wordcensor', $this->optionget($user_row, 'viewcensors')), + + 'bbcode' => $request->variable('bbcode', $this->optionget($user_row, 'bbcode')), + 'smilies' => $request->variable('smilies', $this->optionget($user_row, 'smilies')), + 'sig' => $request->variable('sig', $this->optionget($user_row, 'attachsig')), + 'notify' => $request->variable('notify', $user_row['user_notify']), + ); + + /** + * Modify users preferences data + * + * @event core.acp_users_prefs_modify_data + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_data', compact($vars))); + + if ($submit) + { + $error = validate_data($data, array( + 'dateformat' => array('string', false, 1, 64), + 'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'), + 'tz' => array('timezone'), + + 'topic_sk' => array('string', false, 1, 1), + 'topic_sd' => array('string', false, 1, 1), + 'post_sk' => array('string', false, 1, 1), + 'post_sd' => array('string', false, 1, 1), + )); + + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + + if (!count($error)) + { + $this->optionset($user_row, 'viewimg', $data['view_images']); + $this->optionset($user_row, 'viewflash', $data['view_flash']); + $this->optionset($user_row, 'viewsmilies', $data['view_smilies']); + $this->optionset($user_row, 'viewsigs', $data['view_sigs']); + $this->optionset($user_row, 'viewavatars', $data['view_avatars']); + $this->optionset($user_row, 'viewcensors', $data['view_wordcensor']); + $this->optionset($user_row, 'bbcode', $data['bbcode']); + $this->optionset($user_row, 'smilies', $data['smilies']); + $this->optionset($user_row, 'attachsig', $data['sig']); + + $sql_ary = array( + 'user_options' => $user_row['user_options'], + + 'user_allow_pm' => $data['allowpm'], + 'user_allow_viewemail' => $data['viewemail'], + 'user_allow_massemail' => $data['massemail'], + 'user_allow_viewonline' => !$data['hideonline'], + 'user_notify_type' => $data['notifymethod'], + 'user_notify_pm' => $data['notifypm'], + + 'user_dateformat' => $data['dateformat'], + 'user_lang' => $data['lang'], + 'user_timezone' => $data['tz'], + 'user_style' => $data['style'], + + 'user_topic_sortby_type' => $data['topic_sk'], + 'user_post_sortby_type' => $data['post_sk'], + 'user_topic_sortby_dir' => $data['topic_sd'], + 'user_post_sortby_dir' => $data['post_sd'], + + 'user_topic_show_days' => $data['topic_st'], + 'user_post_show_days' => $data['post_st'], + + 'user_notify' => $data['notify'], + ); + + /** + * Modify SQL query before users preferences are updated + * + * @event core.acp_users_prefs_modify_sql + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @var array sql_ary SQL array with users preferences data to update + * @var array error Array with errors data + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row', 'sql_ary', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_sql', compact($vars))); + + if (!count($error)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + // Check if user has an active session + if ($user_row['session_id']) + { + // We'll update the session if user_allow_viewonline has changed and the user is a bot + // Or if it's a regular user and the admin set it to hide the session + if ($user_row['user_allow_viewonline'] != $sql_ary['user_allow_viewonline'] && $user_row['user_type'] == USER_IGNORE + || $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline']) + { + // We also need to check if the user has the permission to cloak. + $user_auth = new \phpbb\auth\auth(); + $user_auth->acl($user_row); + + $session_sql_ary = array( + 'session_viewonline' => ($user_auth->acl_get('u_hideonline')) ? $sql_ary['user_allow_viewonline'] : true, + ); + + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $session_sql_ary) . " + WHERE session_user_id = $user_id"; + $db->sql_query($sql); + + unset($user_auth); + } + } + + trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + $dateformat_options = ''; + foreach ($user->lang['dateformats'] as $format => $null) + { + $dateformat_options .= ''; + } + + $s_custom = false; + + $dateformat_options .= ''; + + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + // Topic ordering options + $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']); + + // 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']); + $sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + + $_options = array('topic', 'post'); + foreach ($_options as $sort_option) + { + ${'s_limit_' . $sort_option . '_days'} = ''; + + ${'s_sort_' . $sort_option . '_key'} = ''; + + ${'s_sort_' . $sort_option . '_dir'} = ''; + } + + phpbb_timezone_select($template, $user, $data['tz'], true); + $user_prefs_data = array( + 'S_PREFS' => true, + 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, + + 'VIEW_EMAIL' => $data['viewemail'], + 'MASS_EMAIL' => $data['massemail'], + 'ALLOW_PM' => $data['allowpm'], + 'HIDE_ONLINE' => $data['hideonline'], + 'NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false, + 'NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false, + 'NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false, + 'NOTIFY_PM' => $data['notifypm'], + 'BBCODE' => $data['bbcode'], + 'SMILIES' => $data['smilies'], + 'ATTACH_SIG' => $data['sig'], + 'NOTIFY' => $data['notify'], + 'VIEW_IMAGES' => $data['view_images'], + 'VIEW_FLASH' => $data['view_flash'], + 'VIEW_SMILIES' => $data['view_smilies'], + 'VIEW_SIGS' => $data['view_sigs'], + 'VIEW_AVATARS' => $data['view_avatars'], + 'VIEW_WORDCENSOR' => $data['view_wordcensor'], + + 'S_TOPIC_SORT_DAYS' => $s_limit_topic_days, + 'S_TOPIC_SORT_KEY' => $s_sort_topic_key, + 'S_TOPIC_SORT_DIR' => $s_sort_topic_dir, + 'S_POST_SORT_DAYS' => $s_limit_post_days, + 'S_POST_SORT_KEY' => $s_sort_post_key, + 'S_POST_SORT_DIR' => $s_sort_post_dir, + + 'DATE_FORMAT' => $data['dateformat'], + 'S_DATEFORMAT_OPTIONS' => $dateformat_options, + 'S_CUSTOM_DATEFORMAT' => $s_custom, + 'DEFAULT_DATEFORMAT' => $config['default_dateformat'], + 'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']), + + 'S_LANG_OPTIONS' => language_select($data['lang']), + 'S_STYLE_OPTIONS' => style_select($data['style']), + ); + + /** + * Modify users preferences data before assigning it to the template + * + * @event core.acp_users_prefs_modify_template_data + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @var array user_prefs_data Array with users preferences data to be assigned to the template + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row', 'user_prefs_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_template_data', compact($vars))); + + $template->assign_vars($user_prefs_data); + + break; + + case 'avatar': + + $avatars_enabled = false; + /** @var \phpbb\avatar\manager $phpbb_avatar_manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + + if ($config['allow_avatar']) + { + $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); + + // This is normalised data, without the user_ prefix + $avatar_data = \phpbb\avatar\manager::clean_row($user_row, 'user'); + + if ($submit) + { + if (check_form_key($form_name)) + { + $driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); + + if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) + { + $driver = $phpbb_avatar_manager->get_driver($driver_name); + $result = $driver->process_form($request, $template, $user, $avatar_data, $error); + + if ($result && empty($error)) + { + // Success! Lets save the result in the database + $result = array( + 'user_avatar_type' => $driver_name, + 'user_avatar' => $result['avatar'], + 'user_avatar_width' => $result['avatar_width'], + 'user_avatar_height' => $result['avatar_height'], + ); + + /** + * Modify users preferences data before assigning it to the template + * + * @event core.acp_users_avatar_sql + * @var array user_row Array with user data + * @var array result Array with user avatar data to be updated in the DB + * @since 3.2.4-RC1 + */ + $vars = array('user_row', 'result'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_avatar_sql', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $result) . ' + WHERE user_id = ' . (int) $user_id; + + $db->sql_query($sql); + trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + } + else + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (!confirm_box(true)) + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true)) + ); + } + else + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, USERS_TABLE, 'user_'); + + trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + + $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type'])); + + // Assign min and max values before generating avatar driver html + $template->assign_vars(array( + 'AVATAR_MIN_WIDTH' => $config['avatar_min_width'], + 'AVATAR_MAX_WIDTH' => $config['avatar_max_width'], + 'AVATAR_MIN_HEIGHT' => $config['avatar_min_height'], + 'AVATAR_MAX_HEIGHT' => $config['avatar_max_height'], + )); + + foreach ($avatar_drivers as $current_driver) + { + $driver = $phpbb_avatar_manager->get_driver($current_driver); + + $avatars_enabled = true; + $template->set_filenames(array( + 'avatar' => $driver->get_acp_template_name(), + )); + + if ($driver->prepare_form($request, $template, $user, $avatar_data, $error)) + { + $driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver); + $driver_upper = strtoupper($driver_name); + + $template->assign_block_vars('avatar_drivers', array( + 'L_TITLE' => $user->lang($driver_upper . '_TITLE'), + 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), + + 'DRIVER' => $driver_name, + 'SELECTED' => $current_driver == $selected_driver, + 'OUTPUT' => $template->assign_display('avatar'), + )); + } + } + } + + // Avatar manager is not initialized if avatars are disabled + if (isset($phpbb_avatar_manager)) + { + // Replace "error" strings with their real, localised form + $error = $phpbb_avatar_manager->localize_errors($user, $error); + } + + $avatar = phpbb_get_user_avatar($user_row, 'USER_AVATAR', true); + + $template->assign_vars(array( + 'S_AVATAR' => true, + 'ERROR' => (!empty($error)) ? implode('
', $error) : '', + 'AVATAR' => (empty($avatar) ? '' : $avatar), + + 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', + + 'L_AVATAR_EXPLAIN' => $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), + + 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), + )); + + break; + + case 'rank': + + if ($submit) + { + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $rank_id = $request->variable('user_rank', 0); + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_rank = $rank_id + WHERE user_id = $user_id"; + $db->sql_query($sql); + + trigger_error($user->lang['USER_RANK_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + $sql = 'SELECT * + FROM ' . RANKS_TABLE . ' + WHERE rank_special = 1 + ORDER BY rank_title'; + $result = $db->sql_query($sql); + + $s_rank_options = ''; + + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($user_row['user_rank'] && $row['rank_id'] == $user_row['user_rank']) ? ' selected="selected"' : ''; + $s_rank_options .= ''; + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_RANK' => true, + 'S_RANK_OPTIONS' => $s_rank_options) + ); + + break; + + case 'sig': + + if (!function_exists('display_custom_bbcodes')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $enable_bbcode = ($config['allow_sig_bbcode']) ? $this->optionget($user_row, 'sig_bbcode') : false; + $enable_smilies = ($config['allow_sig_smilies']) ? $this->optionget($user_row, 'sig_smilies') : false; + $enable_urls = ($config['allow_sig_links']) ? $this->optionget($user_row, 'sig_links') : false; + + $bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0); + + $decoded_message = generate_text_for_edit($user_row['user_sig'], $user_row['user_sig_bbcode_uid'], $bbcode_flags); + $signature = $request->variable('signature', $decoded_message['text'], true); + $signature_preview = ''; + + if ($submit || $request->is_set_post('preview')) + { + $enable_bbcode = ($config['allow_sig_bbcode']) ? !$request->variable('disable_bbcode', false) : false; + $enable_smilies = ($config['allow_sig_smilies']) ? !$request->variable('disable_smilies', false) : false; + $enable_urls = ($config['allow_sig_links']) ? !$request->variable('disable_magic_url', false) : false; + + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + } + + $bbcode_uid = $bbcode_bitfield = $bbcode_flags = ''; + $warn_msg = generate_text_for_storage( + $signature, + $bbcode_uid, + $bbcode_bitfield, + $bbcode_flags, + $enable_bbcode, + $enable_urls, + $enable_smilies, + $config['allow_sig_img'], + $config['allow_sig_flash'], + true, + $config['allow_sig_links'], + 'sig' + ); + + if (count($warn_msg)) + { + $error += $warn_msg; + } + + if (!$submit) + { + // Parse it for displaying + $signature_preview = generate_text_for_display($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags); + } + else + { + if (!count($error)) + { + $this->optionset($user_row, 'sig_bbcode', $enable_bbcode); + $this->optionset($user_row, 'sig_smilies', $enable_smilies); + $this->optionset($user_row, 'sig_links', $enable_urls); + + $sql_ary = array( + 'user_sig' => $signature, + 'user_options' => $user_row['user_options'], + 'user_sig_bbcode_uid' => $bbcode_uid, + 'user_sig_bbcode_bitfield' => $bbcode_bitfield, + ); + + /** + * Modify user signature before it is stored in the DB + * + * @event core.acp_users_modify_signature_sql_ary + * @var array user_row Array with user data + * @var array sql_ary Array with user signature data to be updated in the DB + * @since 3.2.4-RC1 + */ + $vars = array('user_row', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_modify_signature_sql_ary', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + + trigger_error($user->lang['USER_SIG_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + + if ($request->is_set_post('preview')) + { + $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_flags); + } + + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + + $template->assign_vars(array( + 'S_SIGNATURE' => true, + + 'SIGNATURE' => $decoded_message['text'], + 'SIGNATURE_PREVIEW' => $signature_preview, + + 'S_BBCODE_CHECKED' => (!$enable_bbcode) ? ' checked="checked"' : '', + 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', + 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', + + 'BBCODE_STATUS' => $user->lang(($config['allow_sig_bbcode'] ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), + 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + + 'L_SIGNATURE_EXPLAIN' => $user->lang('SIGNATURE_EXPLAIN', (int) $config['max_sig_chars']), + + 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], + 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], + 'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false, + 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false, + 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false) + ); + + // Assigning custom bbcodes + display_custom_bbcodes(); + + break; + + case 'attach': + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + $start = $request->variable('start', 0); + $deletemark = (isset($_POST['delmarked'])) ? true : false; + $marked = $request->variable('mark', array(0)); + + // Sort keys + $sort_key = $request->variable('sk', 'a'); + $sort_dir = $request->variable('sd', 'd'); + + if ($deletemark && count($marked)) + { + $sql = 'SELECT attach_id + FROM ' . ATTACHMENTS_TABLE . ' + WHERE poster_id = ' . $user_id . ' + AND is_orphan = 0 + AND ' . $db->sql_in_set('attach_id', $marked); + $result = $db->sql_query($sql); + + $marked = array(); + while ($row = $db->sql_fetchrow($result)) + { + $marked[] = $row['attach_id']; + } + $db->sql_freeresult($result); + } + + if ($deletemark && count($marked)) + { + if (confirm_box(true)) + { + $sql = 'SELECT real_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', $marked); + $result = $db->sql_query($sql); + + $log_attachments = array(); + while ($row = $db->sql_fetchrow($result)) + { + $log_attachments[] = $row['real_filename']; + } + $db->sql_freeresult($result); + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('attach', $marked); + unset($attachment_manager); + + $message = (count($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACHMENTS_DELETED', false, array(implode($user->lang['COMMA_SEPARATOR'], $log_attachments))); + trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'delmarked' => true, + 'mark' => $marked)) + ); + } + } + + $sk_text = array('a' => $user->lang['SORT_FILENAME'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']); + $sk_sql = array('a' => 'a.real_filename', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title'); + + $sd_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + $s_sort_key = ''; + foreach ($sk_text as $key => $value) + { + $selected = ($sort_key == $key) ? ' selected="selected"' : ''; + $s_sort_key .= ''; + } + + $s_sort_dir = ''; + foreach ($sd_text as $key => $value) + { + $selected = ($sort_dir == $key) ? ' selected="selected"' : ''; + $s_sort_dir .= ''; + } + + if (!isset($sk_sql[$sort_key])) + { + $sort_key = 'a'; + } + + $order_by = $sk_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); + + $sql = 'SELECT COUNT(attach_id) as num_attachments + FROM ' . ATTACHMENTS_TABLE . " + WHERE poster_id = $user_id + AND is_orphan = 0"; + $result = $db->sql_query_limit($sql, 1); + $num_attachments = (int) $db->sql_fetchfield('num_attachments'); + $db->sql_freeresult($result); + + $sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title + FROM ' . ATTACHMENTS_TABLE . ' a + LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id + AND a.in_message = 0) + LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id + AND a.in_message = 1) + WHERE a.poster_id = ' . $user_id . " + AND a.is_orphan = 0 + ORDER BY $order_by"; + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['in_message']) + { + $view_topic = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&p={$row['post_msg_id']}"); + } + else + { + $view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . '#p' . $row['post_msg_id']; + } + + $template->assign_block_vars('attach', array( + 'REAL_FILENAME' => $row['real_filename'], + 'COMMENT' => nl2br($row['attach_comment']), + 'EXTENSION' => $row['extension'], + 'SIZE' => get_formatted_filesize($row['filesize']), + 'DOWNLOAD_COUNT' => $row['download_count'], + 'POST_TIME' => $user->format_date($row['filetime']), + 'TOPIC_TITLE' => ($row['in_message']) ? $row['message_title'] : $row['topic_title'], + + 'ATTACH_ID' => $row['attach_id'], + 'POST_ID' => $row['post_msg_id'], + 'TOPIC_ID' => $row['topic_id'], + + 'S_IN_MESSAGE' => $row['in_message'], + + 'U_DOWNLOAD' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . $row['attach_id']), + 'U_VIEW_TOPIC' => $view_topic) + ); + } + $db->sql_freeresult($result); + + $base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'S_ATTACHMENTS' => true, + 'S_SORT_KEY' => $s_sort_key, + 'S_SORT_DIR' => $s_sort_dir, + )); + + break; + + case 'groups': + + if (!function_exists('group_user_attributes')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $user->add_lang(array('groups', 'acp/groups')); + $group_id = $request->variable('g', 0); + + if ($group_id) + { + // Check the founder only entry for this group to make sure everything is well + $sql = 'SELECT group_founder_manage + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $db->sql_query($sql); + $founder_manage = (int) $db->sql_fetchfield('group_founder_manage'); + $db->sql_freeresult($result); + + if ($user->data['user_type'] != USER_FOUNDER && $founder_manage) + { + trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + + switch ($action) + { + case 'demote': + case 'promote': + case 'default': + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_link_hash($request->variable('hash', ''), 'acp_users')) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + group_user_attributes($action, $group_id, $user_id); + + if ($action == 'default') + { + $user_row['group_id'] = $group_id; + } + break; + + case 'delete': + + if (confirm_box(true)) + { + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($error = group_user_del($group_id, $user_id)) + { + trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $error = array(); + + // The delete action was successful - therefore update the user row... + $sql = 'SELECT u.*, s.* + FROM ' . USERS_TABLE . ' u + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) + WHERE u.user_id = ' . $user_id . ' + ORDER BY s.session_time DESC'; + $result = $db->sql_query_limit($sql, 1); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'g' => $group_id)) + ); + } + + break; + + case 'approve': + + if (confirm_box(true)) + { + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + group_user_attributes($action, $group_id, $user_id); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'g' => $group_id)) + ); + } + + break; + } + + // Add user to group? + if ($submit) + { + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Add user/s to group + if ($error = group_user_add($group_id, $user_id)) + { + trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $error = array(); + } + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $sql = 'SELECT ug.*, g.* + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug + WHERE ug.user_id = $user_id + AND g.group_id = ug.group_id + ORDER BY g.group_type DESC, ug.user_pending ASC, g.group_name"; + $result = $db->sql_query($sql); + + $i = 0; + $group_data = $id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $type = ($row['group_type'] == GROUP_SPECIAL) ? 'special' : (($row['user_pending']) ? 'pending' : 'normal'); + + $group_data[$type][$i]['group_id'] = $row['group_id']; + $group_data[$type][$i]['group_name'] = $row['group_name']; + $group_data[$type][$i]['group_leader'] = ($row['group_leader']) ? 1 : 0; + + $id_ary[] = $row['group_id']; + + $i++; + } + $db->sql_freeresult($result); + + // Select box for other groups + $sql = 'SELECT group_id, group_name, group_type, group_founder_manage + FROM ' . GROUPS_TABLE . ' + ' . ((count($id_ary)) ? 'WHERE ' . $db->sql_in_set('group_id', $id_ary, true) : '') . ' + ORDER BY group_type DESC, group_name ASC'; + $result = $db->sql_query($sql); + + $s_group_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + if (!$config['coppa_enable'] && $row['group_name'] == 'REGISTERED_COPPA') + { + continue; + } + + // Do not display those groups not allowed to be managed + if ($user->data['user_type'] != USER_FOUNDER && $row['group_founder_manage']) + { + continue; + } + + $s_group_options .= '' . $group_helper->get_name($row['group_name']) . ''; + } + $db->sql_freeresult($result); + + $current_type = ''; + foreach ($group_data as $group_type => $data_ary) + { + if ($current_type != $group_type) + { + $template->assign_block_vars('group', array( + 'S_NEW_GROUP_TYPE' => true, + 'GROUP_TYPE' => $user->lang['USER_GROUP_' . strtoupper($group_type)]) + ); + } + + foreach ($data_ary as $data) + { + $template->assign_block_vars('group', array( + 'U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=groups&mode=manage&action=edit&u=$user_id&g={$data['group_id']}&back_link=acp_users_groups"), + 'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'] . '&hash=' . generate_link_hash('acp_users'), + 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'] . '&hash=' . generate_link_hash('acp_users'), + 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], + 'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '', + + 'GROUP_NAME' => $group_helper->get_name($data['group_name']), + 'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], + + 'S_IS_MEMBER' => ($group_type != 'pending') ? true : false, + 'S_NO_DEFAULT' => ($user_row['group_id'] != $data['group_id']) ? true : false, + 'S_SPECIAL_GROUP' => ($group_type == 'special') ? true : false, + ) + ); + } + } + + $template->assign_vars(array( + 'S_GROUPS' => true, + 'S_GROUP_OPTIONS' => $s_group_options) + ); + + break; + + case 'perm': + + if (!class_exists('auth_admin')) + { + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + } + + $auth_admin = new auth_admin(); + + $user->add_lang('acp/permissions'); + add_permission_language(); + + $forum_id = $request->variable('f', 0); + + // Global Permissions + if (!$forum_id) + { + // Select auth options + $sql = 'SELECT auth_option, is_local, is_global + FROM ' . ACL_OPTIONS_TABLE . ' + WHERE auth_option ' . $db->sql_like_expression($db->get_any_char() . '_') . ' + AND is_global = 1 + ORDER BY auth_option'; + $result = $db->sql_query($sql); + + $hold_ary = array(); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NEVER); + $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false); + } + $db->sql_freeresult($result); + + unset($hold_ary); + } + else + { + $sql = 'SELECT auth_option, is_local, is_global + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option " . $db->sql_like_expression($db->get_any_char() . '_') . " + AND is_local = 1 + ORDER BY is_global DESC, auth_option"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', ACL_NEVER); + $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false); + } + $db->sql_freeresult($result); + } + + $s_forum_options = ''; + $s_forum_options .= make_forum_select($forum_id, false, true, false, false, false); + + $template->assign_vars(array( + 'S_PERMISSIONS' => true, + + 'S_GLOBAL' => (!$forum_id) ? true : false, + 'S_FORUM_OPTIONS' => $s_forum_options, + + 'U_ACTION' => $this->u_action . '&u=' . $user_id, + 'U_USER_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx" ,'i=permissions&mode=setting_user_global&user_id[]=' . $user_id), + 'U_USER_FORUM_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id)) + ); + + break; + + default: + + /** + * Additional modes provided by extensions + * + * @event core.acp_users_mode_add + * @var string mode New mode + * @var int user_id User id of the user to manage + * @var array user_row Array with user data + * @var array error Array with errors data + * @since 3.2.2-RC1 + */ + $vars = array('mode', 'user_id', 'user_row', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_mode_add', compact($vars))); + + break; + } + + // Assign general variables + $template->assign_vars(array( + 'S_ERROR' => (count($error)) ? true : false, + 'ERROR_MSG' => (count($error)) ? implode('
', $error) : '') + ); + } + + /** + * Set option bit field for user options in a user row array. + * + * Optionset replacement for this module based on $user->optionset. + * + * @param array $user_row Row from the users table. + * @param int $key Option key, as defined in $user->keyoptions property. + * @param bool $value True to set the option, false to clear the option. + * @param int $data Current bit field value, or false to use $user_row['user_options'] + * @return int|bool If $data is false, the bit field is modified and + * written back to $user_row['user_options'], and + * return value is true if the bit field changed and + * false otherwise. If $data is not false, the new + * bitfield value is returned. + */ + function optionset(&$user_row, $key, $value, $data = false) + { + global $user; + + $var = ($data !== false) ? $data : $user_row['user_options']; + + $new_var = phpbb_optionset($user->keyoptions[$key], $value, $var); + + if ($data === false) + { + if ($new_var != $var) + { + $user_row['user_options'] = $new_var; + return true; + } + else + { + return false; + } + } + else + { + return $new_var; + } + } + + /** + * Get option bit field from user options in a user row array. + * + * Optionget replacement for this module based on $user->optionget. + * + * @param array $user_row Row from the users table. + * @param int $key option key, as defined in $user->keyoptions property. + * @param int $data bit field value to use, or false to use $user_row['user_options'] + * @return bool true if the option is set in the bit field, false otherwise + */ + function optionget(&$user_row, $key, $data = false) + { + global $user; + + $var = ($data !== false) ? $data : $user_row['user_options']; + return phpbb_optionget($user->keyoptions[$key], $var); + } +} diff --git a/install/update/new/includes/acp/auth.php b/install/update/new/includes/acp/auth.php new file mode 100644 index 0000000..f203f9d --- /dev/null +++ b/install/update/new/includes/acp/auth.php @@ -0,0 +1,1316 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ACP Permission/Auth class +*/ +class auth_admin extends \phpbb\auth\auth +{ + /** + * Init auth settings + */ + function __construct() + { + global $db, $cache; + + if (($this->acl_options = $cache->get('_acl_options')) === false) + { + $sql = 'SELECT auth_option_id, auth_option, is_global, is_local + FROM ' . ACL_OPTIONS_TABLE . ' + ORDER BY auth_option_id'; + $result = $db->sql_query($sql); + + $global = $local = 0; + $this->acl_options = array(); + while ($row = $db->sql_fetchrow($result)) + { + if ($row['is_global']) + { + $this->acl_options['global'][$row['auth_option']] = $global++; + } + + if ($row['is_local']) + { + $this->acl_options['local'][$row['auth_option']] = $local++; + } + + $this->acl_options['id'][$row['auth_option']] = (int) $row['auth_option_id']; + $this->acl_options['option'][(int) $row['auth_option_id']] = $row['auth_option']; + } + $db->sql_freeresult($result); + + $cache->put('_acl_options', $this->acl_options); + } + } + + /** + * Get permission mask + * This function only supports getting permissions of one type (for example a_) + * + * @param set|view $mode defines the permissions we get, view gets effective permissions (checking user AND group permissions), set only gets the user or group permission set alone + * @param mixed $user_id user ids to search for (a user_id or a group_id has to be specified at least) + * @param mixed $group_id group ids to search for, return group related settings (a user_id or a group_id has to be specified at least) + * @param mixed $forum_id forum_ids to search for. Defining a forum id also means getting local settings + * @param string $auth_option the auth_option defines the permission setting to look for (a_ for example) + * @param local|global $scope the scope defines the permission scope. If local, a forum_id is additionally required + * @param ACL_NEVER|ACL_NO|ACL_YES $acl_fill defines the mode those permissions not set are getting filled with + */ + function get_mask($mode, $user_id = false, $group_id = false, $forum_id = false, $auth_option = false, $scope = false, $acl_fill = ACL_NEVER) + { + global $db, $user; + + $hold_ary = array(); + $view_user_mask = ($mode == 'view' && $group_id === false) ? true : false; + + if ($auth_option === false || $scope === false) + { + return array(); + } + + $acl_user_function = ($mode == 'set') ? 'acl_user_raw_data' : 'acl_raw_data'; + + if (!$view_user_mask) + { + if ($forum_id !== false) + { + $hold_ary = ($group_id !== false) ? $this->acl_group_raw_data($group_id, $auth_option . '%', $forum_id) : $this->$acl_user_function($user_id, $auth_option . '%', $forum_id); + } + else + { + $hold_ary = ($group_id !== false) ? $this->acl_group_raw_data($group_id, $auth_option . '%', ($scope == 'global') ? 0 : false) : $this->$acl_user_function($user_id, $auth_option . '%', ($scope == 'global') ? 0 : false); + } + } + + // Make sure hold_ary is filled with every setting (prevents missing forums/users/groups) + $ug_id = ($group_id !== false) ? ((!is_array($group_id)) ? array($group_id) : $group_id) : ((!is_array($user_id)) ? array($user_id) : $user_id); + $forum_ids = ($forum_id !== false) ? ((!is_array($forum_id)) ? array($forum_id) : $forum_id) : (($scope == 'global') ? array(0) : array()); + + // Only those options we need + $compare_options = array_diff(preg_replace('/^((?!' . $auth_option . ').+)|(' . $auth_option . ')$/', '', array_keys($this->acl_options[$scope])), array('')); + + // If forum_ids is false and the scope is local we actually want to have all forums within the array + if ($scope == 'local' && !count($forum_ids)) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql, 120); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + } + + if ($view_user_mask) + { + $auth2 = null; + + $sql = 'SELECT user_id, user_permissions, user_type + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $ug_id); + $result = $db->sql_query($sql); + + while ($userdata = $db->sql_fetchrow($result)) + { + if ($user->data['user_id'] != $userdata['user_id']) + { + $auth2 = new \phpbb\auth\auth(); + $auth2->acl($userdata); + } + else + { + global $auth; + $auth2 = &$auth; + } + + $hold_ary[$userdata['user_id']] = array(); + foreach ($forum_ids as $f_id) + { + $hold_ary[$userdata['user_id']][$f_id] = array(); + foreach ($compare_options as $option) + { + $hold_ary[$userdata['user_id']][$f_id][$option] = $auth2->acl_get($option, $f_id); + } + } + } + $db->sql_freeresult($result); + + unset($userdata); + unset($auth2); + } + + foreach ($ug_id as $_id) + { + if (!isset($hold_ary[$_id])) + { + $hold_ary[$_id] = array(); + } + + foreach ($forum_ids as $f_id) + { + if (!isset($hold_ary[$_id][$f_id])) + { + $hold_ary[$_id][$f_id] = array(); + } + } + } + + // Now, we need to fill the gaps with $acl_fill. ;) + + // Now switch back to keys + if (count($compare_options)) + { + $compare_options = array_combine($compare_options, array_fill(1, count($compare_options), $acl_fill)); + } + + // Defining the user-function here to save some memory + $return_acl_fill = function () use ($acl_fill) + { + return $acl_fill; + }; + + // Actually fill the gaps + if (count($hold_ary)) + { + foreach ($hold_ary as $ug_id => $row) + { + foreach ($row as $id => $options) + { + // Do not include the global auth_option + unset($options[$auth_option]); + + // Not a "fine" solution, but at all it's a 1-dimensional + // array_diff_key function filling the resulting array values with zeros + // The differences get merged into $hold_ary (all permissions having $acl_fill set) + $hold_ary[$ug_id][$id] = array_merge($options, + + array_map($return_acl_fill, + array_flip( + array_diff( + array_keys($compare_options), array_keys($options) + ) + ) + ) + ); + } + } + } + else + { + $hold_ary[($group_id !== false) ? $group_id : $user_id][(int) $forum_id] = $compare_options; + } + + return $hold_ary; + } + + /** + * Get permission mask for roles + * This function only supports getting masks for one role + */ + function get_role_mask($role_id) + { + global $db; + + $hold_ary = array(); + + // Get users having this role set... + $sql = 'SELECT user_id, forum_id + FROM ' . ACL_USERS_TABLE . ' + WHERE auth_role_id = ' . $role_id . ' + ORDER BY forum_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary[$row['forum_id']]['users'][] = $row['user_id']; + } + $db->sql_freeresult($result); + + // Now grab groups... + $sql = 'SELECT group_id, forum_id + FROM ' . ACL_GROUPS_TABLE . ' + WHERE auth_role_id = ' . $role_id . ' + ORDER BY forum_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary[$row['forum_id']]['groups'][] = $row['group_id']; + } + $db->sql_freeresult($result); + + return $hold_ary; + } + + /** + * Display permission mask (assign to template) + */ + function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true) + { + global $template, $user, $db, $phpbb_container; + + /* @var $phpbb_permissions \phpbb\permissions */ + $phpbb_permissions = $phpbb_container->get('acl.permissions'); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + // Define names for template loops, might be able to be set + $tpl_pmask = 'p_mask'; + $tpl_fmask = 'f_mask'; + $tpl_category = 'category'; + $tpl_mask = 'mask'; + + $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; + + // Get names + if ($user_mode == 'user') + { + $sql = 'SELECT user_id as ug_id, username as ug_name + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', array_keys($hold_ary)) . ' + ORDER BY username_clean ASC'; + } + else + { + $sql = 'SELECT group_id as ug_id, group_name as ug_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_id', array_keys($hold_ary)) . ' + ORDER BY group_type DESC, group_name ASC'; + } + $result = $db->sql_query($sql); + + $ug_names_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : $group_helper->get_name($row['ug_name']); + } + $db->sql_freeresult($result); + + // Get used forums + $forum_ids = array(); + foreach ($hold_ary as $ug_id => $row) + { + $forum_ids = array_merge($forum_ids, array_keys($row)); + } + $forum_ids = array_unique($forum_ids); + + $forum_names_ary = array(); + if ($local) + { + $forum_names_ary = make_forum_select(false, false, true, false, false, false, true); + + // Remove the disabled ones, since we do not create an option field here... + foreach ($forum_names_ary as $key => $value) + { + if (!$value['disabled']) + { + continue; + } + unset($forum_names_ary[$key]); + } + } + else + { + $forum_names_ary[0] = $l_acl_type; + } + + // Get available roles + $sql = 'SELECT * + FROM ' . ACL_ROLES_TABLE . " + WHERE role_type = '" . $db->sql_escape($permission_type) . "' + ORDER BY role_order ASC"; + $result = $db->sql_query($sql); + + $roles = array(); + while ($row = $db->sql_fetchrow($result)) + { + $roles[$row['role_id']] = $row; + } + $db->sql_freeresult($result); + + $cur_roles = $this->acl_role_data($user_mode, $permission_type, array_keys($hold_ary)); + + // Build js roles array (role data assignments) + $s_role_js_array = ''; + + if (count($roles)) + { + $s_role_js_array = array(); + + // Make sure every role (even if empty) has its array defined + foreach ($roles as $_role_id => $null) + { + $s_role_js_array[$_role_id] = "\n" . 'role_options[' . $_role_id . '] = new Array();' . "\n"; + } + + $sql = 'SELECT r.role_id, o.auth_option, r.auth_setting + FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o + WHERE o.auth_option_id = r.auth_option_id + AND ' . $db->sql_in_set('r.role_id', array_keys($roles)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1); + if ($flag == $row['auth_option']) + { + continue; + } + + $s_role_js_array[$row['role_id']] .= 'role_options[' . $row['role_id'] . '][\'' . addslashes($row['auth_option']) . '\'] = ' . $row['auth_setting'] . '; '; + } + $db->sql_freeresult($result); + + $s_role_js_array = implode('', $s_role_js_array); + } + + $template->assign_var('S_ROLE_JS_ARRAY', $s_role_js_array); + unset($s_role_js_array); + + // Now obtain memberships + $user_groups_default = $user_groups_custom = array(); + if ($user_mode == 'user' && $group_display) + { + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE . ' + ORDER BY group_type DESC, group_name ASC'; + $result = $db->sql_query($sql); + + $groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $groups[$row['group_id']] = $row; + } + $db->sql_freeresult($result); + + $memberships = group_memberships(false, array_keys($hold_ary), false); + + // User is not a member of any group? Bad admin, bad bad admin... + if ($memberships) + { + foreach ($memberships as $row) + { + $user_groups_default[$row['user_id']][] = $group_helper->get_name($groups[$row['group_id']]['group_name']); + } + } + unset($memberships, $groups); + } + + // If we only have one forum id to display or being in local mode and more than one user/group to display, + // we switch the complete interface to group by user/usergroup instead of grouping by forum + // To achieve this, we need to switch the array a bit + if (count($forum_ids) == 1 || ($local && count($ug_names_ary) > 1)) + { + $hold_ary_temp = $hold_ary; + $hold_ary = array(); + foreach ($hold_ary_temp as $ug_id => $row) + { + foreach ($forum_names_ary as $forum_id => $forum_row) + { + if (isset($row[$forum_id])) + { + $hold_ary[$forum_id][$ug_id] = $row[$forum_id]; + } + } + } + unset($hold_ary_temp); + + foreach ($hold_ary as $forum_id => $forum_array) + { + $content_array = $categories = array(); + $this->build_permission_array($hold_ary[$forum_id], $content_array, $categories, array_keys($ug_names_ary)); + + $template->assign_block_vars($tpl_pmask, array( + 'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'], + 'PADDING' => ($forum_id == 0) ? '' : $forum_names_ary[$forum_id]['padding'], + + 'CATEGORIES' => implode('', $categories), + + 'L_ACL_TYPE' => $l_acl_type, + + 'S_LOCAL' => ($local) ? true : false, + 'S_GLOBAL' => (!$local) ? true : false, + 'S_NUM_CATS' => count($categories), + 'S_VIEW' => ($mode == 'view') ? true : false, + 'S_NUM_OBJECTS' => count($content_array), + 'S_USER_MODE' => ($user_mode == 'user') ? true : false, + 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false) + ); + + foreach ($content_array as $ug_id => $ug_array) + { + // Build role dropdown options + $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; + + $role_options = array(); + + $s_role_options = ''; + $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; + + foreach ($roles as $role_id => $role_row) + { + $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); + $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; + + $title = ($role_description) ? ' title="' . $role_description . '"' : ''; + $s_role_options .= ''; + + $role_options[] = array( + 'ID' => $role_id, + 'ROLE_NAME' => $role_name, + 'TITLE' => $role_description, + 'SELECTED' => $role_id == $current_role_id, + ); + } + + if ($s_role_options) + { + $s_role_options = '' . $s_role_options; + } + + if (!$current_role_id && $mode != 'view') + { + $s_custom_permissions = false; + + foreach ($ug_array as $key => $value) + { + if ($value['S_NEVER'] || $value['S_YES']) + { + $s_custom_permissions = true; + break; + } + } + } + else + { + $s_custom_permissions = false; + } + + $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array( + 'NAME' => $ug_names_ary[$ug_id], + 'UG_ID' => $ug_id, + 'S_ROLE_OPTIONS' => $s_role_options, + 'S_CUSTOM' => $s_custom_permissions, + 'FORUM_ID' => $forum_id, + 'S_ROLE_ID' => $current_role_id, + )); + + $template->assign_block_vars_array($tpl_pmask . '.' . $tpl_fmask . '.role_options', $role_options); + + $this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, ($mode == 'view'), $show_trace); + + unset($content_array[$ug_id]); + } + + unset($hold_ary[$forum_id]); + } + } + else + { + foreach ($ug_names_ary as $ug_id => $ug_name) + { + if (!isset($hold_ary[$ug_id])) + { + continue; + } + + $content_array = $categories = array(); + $this->build_permission_array($hold_ary[$ug_id], $content_array, $categories, array_keys($forum_names_ary)); + + $template->assign_block_vars($tpl_pmask, array( + 'NAME' => $ug_name, + 'CATEGORIES' => implode('', $categories), + + 'USER_GROUPS_DEFAULT' => ($user_mode == 'user' && isset($user_groups_default[$ug_id]) && count($user_groups_default[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_default[$ug_id]) : '', + 'USER_GROUPS_CUSTOM' => ($user_mode == 'user' && isset($user_groups_custom[$ug_id]) && count($user_groups_custom[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_custom[$ug_id]) : '', + 'L_ACL_TYPE' => $l_acl_type, + + 'S_LOCAL' => ($local) ? true : false, + 'S_GLOBAL' => (!$local) ? true : false, + 'S_NUM_CATS' => count($categories), + 'S_VIEW' => ($mode == 'view') ? true : false, + 'S_NUM_OBJECTS' => count($content_array), + 'S_USER_MODE' => ($user_mode == 'user') ? true : false, + 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false) + ); + + foreach ($content_array as $forum_id => $forum_array) + { + // Build role dropdown options + $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; + + $role_options = array(); + + $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; + $s_role_options = ''; + + foreach ($roles as $role_id => $role_row) + { + $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); + $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; + + $title = ($role_description) ? ' title="' . $role_description . '"' : ''; + $s_role_options .= ''; + + $role_options[] = array( + 'ID' => $role_id, + 'ROLE_NAME' => $role_name, + 'TITLE' => $role_description, + 'SELECTED' => $role_id == $current_role_id, + ); + } + + if ($s_role_options) + { + $s_role_options = '' . $s_role_options; + } + + if (!$current_role_id && $mode != 'view') + { + $s_custom_permissions = false; + + foreach ($forum_array as $key => $value) + { + if ($value['S_NEVER'] || $value['S_YES']) + { + $s_custom_permissions = true; + break; + } + } + } + else + { + $s_custom_permissions = false; + } + + $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array( + 'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'], + 'PADDING' => ($forum_id == 0) ? '' : $forum_names_ary[$forum_id]['padding'], + 'S_CUSTOM' => $s_custom_permissions, + 'UG_ID' => $ug_id, + 'S_ROLE_OPTIONS' => $s_role_options, + 'FORUM_ID' => $forum_id) + ); + + $template->assign_block_vars_array($tpl_pmask . '.' . $tpl_fmask . '.role_options', $role_options); + + $this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, ($mode == 'view'), $show_trace); + } + + unset($hold_ary[$ug_id], $ug_names_ary[$ug_id]); + } + } + } + + /** + * Display permission mask for roles + */ + function display_role_mask(&$hold_ary) + { + global $db, $template, $user, $phpbb_root_path, $phpEx; + global $phpbb_container; + + if (!count($hold_ary)) + { + return; + } + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + // Get forum names + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', array_keys($hold_ary)) . ' + ORDER BY left_id'; + $result = $db->sql_query($sql); + + // If the role is used globally, then reflect that + $forum_names = (isset($hold_ary[0])) ? array(0 => '') : array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_names[$row['forum_id']] = $row['forum_name']; + } + $db->sql_freeresult($result); + + foreach ($forum_names as $forum_id => $forum_name) + { + $auth_ary = $hold_ary[$forum_id]; + + $template->assign_block_vars('role_mask', array( + 'NAME' => ($forum_id == 0) ? $user->lang['GLOBAL_MASK'] : $forum_name, + 'FORUM_ID' => $forum_id) + ); + + if (isset($auth_ary['users']) && count($auth_ary['users'])) + { + $sql = 'SELECT user_id, username + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $auth_ary['users']) . ' + ORDER BY username_clean ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('role_mask.users', array( + 'USER_ID' => $row['user_id'], + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username']), + 'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username']), + )); + } + $db->sql_freeresult($result); + } + + if (isset($auth_ary['groups']) && count($auth_ary['groups'])) + { + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_id', $auth_ary['groups']) . ' + ORDER BY group_type ASC, group_name'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('role_mask.groups', array( + 'GROUP_ID' => $row['group_id'], + 'GROUP_NAME' => $group_helper->get_name($row['group_name']), + 'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=group&g={$row['group_id']}")) + ); + } + $db->sql_freeresult($result); + } + } + } + + /** + * NOTE: this function is not in use atm + * Add a new option to the list ... $options is a hash of form -> + * $options = array( + * 'local' => array('option1', 'option2', ...), + * 'global' => array('optionA', 'optionB', ...) + * ); + */ + function acl_add_option($options) + { + global $db, $cache; + + if (!is_array($options)) + { + return false; + } + + $cur_options = array(); + + // Determine current options + $sql = 'SELECT auth_option, is_global, is_local + FROM ' . ACL_OPTIONS_TABLE . ' + ORDER BY auth_option_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $cur_options[$row['auth_option']] = ($row['is_global'] && $row['is_local']) ? 'both' : (($row['is_global']) ? 'global' : 'local'); + } + $db->sql_freeresult($result); + + // Here we need to insert new options ... this requires discovering whether + // an options is global, local or both and whether we need to add an permission + // set flag (x_) + $new_options = array('local' => array(), 'global' => array()); + + foreach ($options as $type => $option_ary) + { + $option_ary = array_unique($option_ary); + + foreach ($option_ary as $option_value) + { + $new_options[$type][] = $option_value; + + $flag = substr($option_value, 0, strpos($option_value, '_') + 1); + + if (!in_array($flag, $new_options[$type])) + { + $new_options[$type][] = $flag; + } + } + } + unset($options); + + $options = array(); + $options['local'] = array_diff($new_options['local'], $new_options['global']); + $options['global'] = array_diff($new_options['global'], $new_options['local']); + $options['both'] = array_intersect($new_options['local'], $new_options['global']); + + // Now check which options to add/update + $add_options = $update_options = array(); + + // First local ones... + foreach ($options as $type => $option_ary) + { + foreach ($option_ary as $option) + { + if (!isset($cur_options[$option])) + { + $add_options[] = array( + 'auth_option' => (string) $option, + 'is_global' => ($type == 'global' || $type == 'both') ? 1 : 0, + 'is_local' => ($type == 'local' || $type == 'both') ? 1 : 0 + ); + + continue; + } + + // Else, update existing entry if it is changed... + if ($type === $cur_options[$option]) + { + continue; + } + + // New type is always both: + // If is now both, we set both. + // If it was global the new one is local and we need to set it to both + // If it was local the new one is global and we need to set it to both + $update_options[] = $option; + } + } + + if (!empty($add_options)) + { + $db->sql_multi_insert(ACL_OPTIONS_TABLE, $add_options); + } + + if (!empty($update_options)) + { + $sql = 'UPDATE ' . ACL_OPTIONS_TABLE . ' + SET is_global = 1, is_local = 1 + WHERE ' . $db->sql_in_set('auth_option', $update_options); + $db->sql_query($sql); + } + + $cache->destroy('_acl_options'); + $this->acl_clear_prefetch(); + + // Because we just changed the options and also purged the options cache, we instantly update/regenerate it for later calls to succeed. + $this->acl_options = array(); + $this->__construct(); + + return true; + } + + /** + * Set a user or group ACL record + */ + function acl_set($ug_type, $forum_id, $ug_id, $auth, $role_id = 0, $clear_prefetch = true) + { + global $db; + + // One or more forums + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + // One or more users + if (!is_array($ug_id)) + { + $ug_id = array($ug_id); + } + + $ug_id_sql = $db->sql_in_set($ug_type . '_id', array_map('intval', $ug_id)); + $forum_sql = $db->sql_in_set('forum_id', array_map('intval', $forum_id)); + + // Instead of updating, inserting, removing we just remove all current settings and re-set everything... + $table = ($ug_type == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; + $id_field = $ug_type . '_id'; + + // Get any flags as required + reset($auth); + $flag = key($auth); + $flag = substr($flag, 0, strpos($flag, '_') + 1); + + // This ID (the any-flag) is set if one or more permissions are true... + $any_option_id = (int) $this->acl_options['id'][$flag]; + + // Remove any-flag from auth ary + if (isset($auth[$flag])) + { + unset($auth[$flag]); + } + + // Remove current auth options... + $auth_option_ids = array((int) $any_option_id); + foreach ($auth as $auth_option => $auth_setting) + { + $auth_option_ids[] = (int) $this->acl_options['id'][$auth_option]; + } + + $sql = "DELETE FROM $table + WHERE $forum_sql + AND $ug_id_sql + AND " . $db->sql_in_set('auth_option_id', $auth_option_ids); + $db->sql_query($sql); + + // Remove those having a role assigned... the correct type of course... + $sql = 'SELECT role_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_type = '" . $db->sql_escape($flag) . "'"; + $result = $db->sql_query($sql); + + $role_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $role_ids[] = $row['role_id']; + } + $db->sql_freeresult($result); + + if (count($role_ids)) + { + $sql = "DELETE FROM $table + WHERE $forum_sql + AND $ug_id_sql + AND auth_option_id = 0 + AND " . $db->sql_in_set('auth_role_id', $role_ids); + $db->sql_query($sql); + } + + // Ok, include the any-flag if one or more auth options are set to yes... + foreach ($auth as $auth_option => $setting) + { + if ($setting == ACL_YES && (!isset($auth[$flag]) || $auth[$flag] == ACL_NEVER)) + { + $auth[$flag] = ACL_YES; + } + } + + $sql_ary = array(); + foreach ($forum_id as $forum) + { + $forum = (int) $forum; + + if ($role_id) + { + foreach ($ug_id as $id) + { + $sql_ary[] = array( + $id_field => (int) $id, + 'forum_id' => (int) $forum, + 'auth_option_id' => 0, + 'auth_setting' => 0, + 'auth_role_id' => (int) $role_id, + ); + } + } + else + { + foreach ($auth as $auth_option => $setting) + { + $auth_option_id = (int) $this->acl_options['id'][$auth_option]; + + if ($setting != ACL_NO) + { + foreach ($ug_id as $id) + { + $sql_ary[] = array( + $id_field => (int) $id, + 'forum_id' => (int) $forum, + 'auth_option_id' => (int) $auth_option_id, + 'auth_setting' => (int) $setting + ); + } + } + } + } + } + + $db->sql_multi_insert($table, $sql_ary); + + if ($clear_prefetch) + { + $this->acl_clear_prefetch(); + } + } + + /** + * Set a role-specific ACL record + */ + function acl_set_role($role_id, $auth) + { + global $db; + + // Get any-flag as required + reset($auth); + $flag = key($auth); + $flag = substr($flag, 0, strpos($flag, '_') + 1); + + // Remove any-flag from auth ary + if (isset($auth[$flag])) + { + unset($auth[$flag]); + } + + // Re-set any flag... + foreach ($auth as $auth_option => $setting) + { + if ($setting == ACL_YES && (!isset($auth[$flag]) || $auth[$flag] == ACL_NEVER)) + { + $auth[$flag] = ACL_YES; + } + } + + $sql_ary = array(); + foreach ($auth as $auth_option => $setting) + { + $auth_option_id = (int) $this->acl_options['id'][$auth_option]; + + if ($setting != ACL_NO) + { + $sql_ary[] = array( + 'role_id' => (int) $role_id, + 'auth_option_id' => (int) $auth_option_id, + 'auth_setting' => (int) $setting + ); + } + } + + // If no data is there, we set the any-flag to ACL_NEVER... + if (!count($sql_ary)) + { + $sql_ary[] = array( + 'role_id' => (int) $role_id, + 'auth_option_id' => (int) $this->acl_options['id'][$flag], + 'auth_setting' => ACL_NEVER + ); + } + + // Remove current auth options... + $sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' + WHERE role_id = ' . $role_id; + $db->sql_query($sql); + + // Now insert the new values + $db->sql_multi_insert(ACL_ROLES_DATA_TABLE, $sql_ary); + + $this->acl_clear_prefetch(); + } + + /** + * Remove local permission + */ + function acl_delete($mode, $ug_id = false, $forum_id = false, $permission_type = false) + { + global $db; + + if ($ug_id === false && $forum_id === false) + { + return; + } + + $option_id_ary = array(); + $table = ($mode == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; + $id_field = $mode . '_id'; + + $where_sql = array(); + + if ($forum_id !== false) + { + $where_sql[] = (!is_array($forum_id)) ? 'forum_id = ' . (int) $forum_id : $db->sql_in_set('forum_id', array_map('intval', $forum_id)); + } + + if ($ug_id !== false) + { + $where_sql[] = (!is_array($ug_id)) ? $id_field . ' = ' . (int) $ug_id : $db->sql_in_set($id_field, array_map('intval', $ug_id)); + } + + // There seem to be auth options involved, therefore we need to go through the list and make sure we capture roles correctly + if ($permission_type !== false) + { + // Get permission type + $sql = 'SELECT auth_option, auth_option_id + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()); + $result = $db->sql_query($sql); + + $auth_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $option_id_ary[] = $row['auth_option_id']; + $auth_id_ary[$row['auth_option']] = ACL_NO; + } + $db->sql_freeresult($result); + + // First of all, lets grab the items having roles with the specified auth options assigned + $sql = "SELECT auth_role_id, $id_field, forum_id + FROM $table, " . ACL_ROLES_TABLE . " r + WHERE auth_role_id <> 0 + AND auth_role_id = r.role_id + AND r.role_type = '{$permission_type}' + AND " . implode(' AND ', $where_sql) . ' + ORDER BY auth_role_id'; + $result = $db->sql_query($sql); + + $cur_role_auth = array(); + while ($row = $db->sql_fetchrow($result)) + { + $cur_role_auth[$row['auth_role_id']][$row['forum_id']][] = $row[$id_field]; + } + $db->sql_freeresult($result); + + // Get role data for resetting data + if (count($cur_role_auth)) + { + $sql = 'SELECT ao.auth_option, rd.role_id, rd.auth_setting + FROM ' . ACL_OPTIONS_TABLE . ' ao, ' . ACL_ROLES_DATA_TABLE . ' rd + WHERE ao.auth_option_id = rd.auth_option_id + AND ' . $db->sql_in_set('rd.role_id', array_keys($cur_role_auth)); + $result = $db->sql_query($sql); + + $auth_settings = array(); + while ($row = $db->sql_fetchrow($result)) + { + // We need to fill all auth_options, else setting it will fail... + if (!isset($auth_settings[$row['role_id']])) + { + $auth_settings[$row['role_id']] = $auth_id_ary; + } + $auth_settings[$row['role_id']][$row['auth_option']] = $row['auth_setting']; + } + $db->sql_freeresult($result); + + // Set the options + foreach ($cur_role_auth as $role_id => $auth_row) + { + foreach ($auth_row as $f_id => $ug_row) + { + $this->acl_set($mode, $f_id, $ug_row, $auth_settings[$role_id], 0, false); + } + } + } + } + + // Now, normally remove permissions... + if ($permission_type !== false) + { + $where_sql[] = $db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary)); + } + + $sql = "DELETE FROM $table + WHERE " . implode(' AND ', $where_sql); + $db->sql_query($sql); + + $this->acl_clear_prefetch(); + } + + /** + * Assign category to template + * used by display_mask() + */ + function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $s_view, $show_trace = false) + { + global $template, $phpbb_admin_path, $phpEx, $phpbb_container; + + /* @var $phpbb_permissions \phpbb\permissions */ + $phpbb_permissions = $phpbb_container->get('acl.permissions'); + + foreach ($category_array as $cat => $cat_array) + { + if (!$phpbb_permissions->category_defined($cat)) + { + continue; + } + + $template->assign_block_vars($tpl_cat, array( + '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, + 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, + + '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 + * + $key_array = array_intersect(array_keys($user->lang), array_map(create_function('$a', 'return "acl_" . $a;'), array_keys($cat_array['permissions']))); + $values_array = $cat_array['permissions']; + + $cat_array['permissions'] = array(); + + foreach ($key_array as $key) + { + $key = str_replace('acl_', '', $key); + $cat_array['permissions'][$key] = $values_array[$key]; + } + unset($key_array, $values_array); +*/ + foreach ($cat_array['permissions'] as $permission => $allowed) + { + if (!$phpbb_permissions->permission_defined($permission)) + { + continue; + } + + if ($s_view) + { + $template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array( + 'S_YES' => ($allowed == ACL_YES) ? true : false, + 'S_NEVER' => ($allowed == ACL_NEVER) ? true : false, + + 'UG_ID' => $ug_id, + 'FORUM_ID' => $forum_id, + 'FIELD_NAME' => $permission, + 'S_FIELD_NAME' => 'setting[' . $ug_id . '][' . $forum_id . '][' . $permission . ']', + + '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' => $phpbb_permissions->get_permission_lang($permission), + )); + } + else + { + $template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array( + 'S_YES' => ($allowed == ACL_YES) ? true : false, + 'S_NEVER' => ($allowed == ACL_NEVER) ? true : false, + 'S_NO' => ($allowed == ACL_NO) ? true : false, + + 'UG_ID' => $ug_id, + 'FORUM_ID' => $forum_id, + 'FIELD_NAME' => $permission, + 'S_FIELD_NAME' => 'setting[' . $ug_id . '][' . $forum_id . '][' . $permission . ']', + + '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' => $phpbb_permissions->get_permission_lang($permission), + )); + } + } + } + } + + /** + * Building content array from permission rows with explicit key ordering + * used by display_mask() + */ + function build_permission_array(&$permission_row, &$content_array, &$categories, $key_sort_array) + { + global $phpbb_container; + + /* @var $phpbb_permissions \phpbb\permissions */ + $phpbb_permissions = $phpbb_container->get('acl.permissions'); + + foreach ($key_sort_array as $forum_id) + { + if (!isset($permission_row[$forum_id])) + { + continue; + } + + $permissions = $permission_row[$forum_id]; + ksort($permissions); + + foreach ($permissions as $permission => $auth_setting) + { + $cat = $phpbb_permissions->get_permission_category($permission); + + // Build our categories array + if (!isset($categories[$cat])) + { + $categories[$cat] = $phpbb_permissions->get_category_lang($cat); + } + + // Build our content array + if (!isset($content_array[$forum_id])) + { + $content_array[$forum_id] = array(); + } + + if (!isset($content_array[$forum_id][$cat])) + { + $content_array[$forum_id][$cat] = array( + 'S_YES' => false, + 'S_NEVER' => false, + 'S_NO' => false, + 'permissions' => array(), + ); + } + + $content_array[$forum_id][$cat]['S_YES'] |= ($auth_setting == ACL_YES) ? true : false; + $content_array[$forum_id][$cat]['S_NEVER'] |= ($auth_setting == ACL_NEVER) ? true : false; + $content_array[$forum_id][$cat]['S_NO'] |= ($auth_setting == ACL_NO) ? true : false; + + $content_array[$forum_id][$cat]['permissions'][$permission] = $auth_setting; + } + } + } + + /** + * Use permissions from another user. This transferes a permission set from one user to another. + * The other user is always able to revert back to his permission set. + * This function does not check for lower/higher permissions, it is possible for the user to gain + * "more" permissions by this. + * Admin permissions will not be copied. + */ + function ghost_permissions($from_user_id, $to_user_id) + { + global $db; + + if ($to_user_id == ANONYMOUS) + { + return false; + } + + $hold_ary = $this->acl_raw_data_single_user($from_user_id); + + // Key 0 in $hold_ary are global options, all others are forum_ids + + // We disallow copying admin permissions + foreach ($this->acl_options['global'] as $opt => $id) + { + if (strpos($opt, 'a_') === 0) + { + $hold_ary[0][$this->acl_options['id'][$opt]] = ACL_NEVER; + } + } + + // Force a_switchperm to be allowed + $hold_ary[0][$this->acl_options['id']['a_switchperm']] = ACL_YES; + + $user_permissions = $this->build_bitstring($hold_ary); + + if (!$user_permissions) + { + return false; + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_permissions = '" . $db->sql_escape($user_permissions) . "', + user_perm_from = $from_user_id + WHERE user_id = " . $to_user_id; + $db->sql_query($sql); + + return true; + } +} diff --git a/install/update/new/includes/bbcode.php b/install/update/new/includes/bbcode.php new file mode 100644 index 0000000..21c630d --- /dev/null +++ b/install/update/new/includes/bbcode.php @@ -0,0 +1,707 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* BBCode class +*/ +class bbcode +{ + var $bbcode_uid = ''; + var $bbcode_bitfield = ''; + var $bbcode_cache = array(); + var $bbcode_template = array(); + + var $bbcodes = array(); + + var $template_bitfield; + + /** + * Constructor + */ + function __construct($bitfield = '') + { + $this->bbcode_set_bitfield($bitfield); + } + + /** + * Init bbcode cache entries if bitfield is specified + * + * @param string $bitfield The bbcode bitfield + */ + function bbcode_set_bitfield($bitfield = '') + { + if ($bitfield) + { + $this->bbcode_bitfield = $bitfield; + $this->bbcode_cache_init(); + } + } + + /** + * Second pass bbcodes + */ + function bbcode_second_pass(&$message, $bbcode_uid = '', $bbcode_bitfield = false) + { + if ($bbcode_uid) + { + $this->bbcode_uid = $bbcode_uid; + } + + if ($bbcode_bitfield !== false) + { + $this->bbcode_bitfield = $bbcode_bitfield; + + // Init those added with a new bbcode_bitfield (already stored codes will not get parsed again) + $this->bbcode_cache_init(); + } + + if (!$this->bbcode_bitfield) + { + // Remove the uid from tags that have not been transformed into HTML + if ($this->bbcode_uid) + { + $message = str_replace(':' . $this->bbcode_uid, '', $message); + } + + return; + } + + $str = array('search' => array(), 'replace' => array()); + $preg = array('search' => array(), 'replace' => array()); + + $bitfield = new bitfield($this->bbcode_bitfield); + $bbcodes_set = $bitfield->get_all_set(); + + $undid_bbcode_specialchars = false; + foreach ($bbcodes_set as $bbcode_id) + { + if (!empty($this->bbcode_cache[$bbcode_id])) + { + foreach ($this->bbcode_cache[$bbcode_id] as $type => $array) + { + foreach ($array as $search => $replace) + { + ${$type}['search'][] = str_replace('$uid', $this->bbcode_uid, $search); + ${$type}['replace'][] = $replace; + } + + if (count($str['search'])) + { + $message = str_replace($str['search'], $str['replace'], $message); + $str = array('search' => array(), 'replace' => array()); + } + + if (count($preg['search'])) + { + // we need to turn the entities back into their original form to allow the + // search patterns to work properly + if (!$undid_bbcode_specialchars) + { + $message = str_replace(array(':', '.'), array(':', '.'), $message); + $undid_bbcode_specialchars = true; + } + + foreach ($preg['search'] as $key => $search) + { + if (is_callable($preg['replace'][$key])) + { + $message = preg_replace_callback($search, $preg['replace'][$key], $message); + } + else + { + $message = preg_replace($search, $preg['replace'][$key], $message); + } + } + + $preg = array('search' => array(), 'replace' => array()); + } + } + } + } + + // Remove the uid from tags that have not been transformed into HTML + $message = str_replace(':' . $this->bbcode_uid, '', $message); + } + + /** + * Init bbcode cache + * + * requires: $this->bbcode_bitfield + * sets: $this->bbcode_cache with bbcode templates needed for bbcode_bitfield + */ + function bbcode_cache_init() + { + global $user, $phpbb_dispatcher, $phpbb_extension_manager, $phpbb_container, $phpbb_filesystem; + + if (empty($this->template_filename)) + { + $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); + + $template = new \phpbb\template\twig\twig( + $phpbb_container->get('path_helper'), + $phpbb_container->get('config'), + new \phpbb\template\context(), + new \phpbb\template\twig\environment( + $phpbb_container->get('config'), + $phpbb_container->get('filesystem'), + $phpbb_container->get('path_helper'), + $phpbb_container->getParameter('core.cache_dir'), + $phpbb_container->get('ext.manager'), + new \phpbb\template\twig\loader( + $phpbb_filesystem + ) + ), + $phpbb_container->getParameter('core.cache_dir'), + $phpbb_container->get('user'), + $phpbb_container->get('template.twig.extensions.collection'), + $phpbb_extension_manager + ); + + $template->set_style(); + $template->set_filenames(array('bbcode.html' => 'bbcode.html')); + $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); + } + + $bbcode_ids = $rowset = $sql = array(); + + $bitfield = new bitfield($this->bbcode_bitfield); + $bbcodes_set = $bitfield->get_all_set(); + + foreach ($bbcodes_set as $bbcode_id) + { + if (isset($this->bbcode_cache[$bbcode_id])) + { + // do not try to re-cache it if it's already in + continue; + } + $bbcode_ids[] = $bbcode_id; + + if ($bbcode_id > NUM_CORE_BBCODES) + { + $sql[] = $bbcode_id; + } + } + + if (count($sql)) + { + global $db; + + $sql = 'SELECT * + FROM ' . BBCODES_TABLE . ' + WHERE ' . $db->sql_in_set('bbcode_id', $sql); + $result = $db->sql_query($sql, 3600); + + while ($row = $db->sql_fetchrow($result)) + { + // To circumvent replacing newlines with
for the generated html, + // we use carriage returns here. They are later changed back to newlines + $row['bbcode_tpl'] = str_replace("\n", "\r", $row['bbcode_tpl']); + $row['second_pass_replace'] = str_replace("\n", "\r", $row['second_pass_replace']); + + $rowset[$row['bbcode_id']] = $row; + } + $db->sql_freeresult($result); + } + + // To perform custom second pass in extension, use $this->bbcode_second_pass_by_extension() + // method which accepts variable number of parameters + foreach ($bbcode_ids as $bbcode_id) + { + switch ($bbcode_id) + { + case BBCODE_ID_QUOTE: + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[/quote:$uid]' => $this->bbcode_tpl('quote_close', $bbcode_id) + ), + 'preg' => array( + '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#is' => function ($match) { + if (!isset($match[2])) + { + $match[2] = ''; + } + + return $this->bbcode_second_pass_quote($match[1], $match[2]); + }, + ) + ); + break; + + case BBCODE_ID_B: + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[b:$uid]' => $this->bbcode_tpl('b_open', $bbcode_id), + '[/b:$uid]' => $this->bbcode_tpl('b_close', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_I: + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[i:$uid]' => $this->bbcode_tpl('i_open', $bbcode_id), + '[/i:$uid]' => $this->bbcode_tpl('i_close', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_URL: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[url:$uid\]((.*?))\[/url:$uid\]#s' => $this->bbcode_tpl('url', $bbcode_id), + '#\[url=([^\[]+?):$uid\](.*?)\[/url:$uid\]#s' => $this->bbcode_tpl('url', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_IMG: + if ($user->optionget('viewimg')) + { + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[img:$uid\](.*?)\[/img:$uid\]#s' => $this->bbcode_tpl('img', $bbcode_id), + ) + ); + } + else + { + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[img:$uid\](.*?)\[/img:$uid\]#s' => str_replace('$2', '[ img ]', $this->bbcode_tpl('url', $bbcode_id, true)), + ) + ); + } + break; + + case BBCODE_ID_SIZE: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[size=([\-\+]?\d+):$uid\](.*?)\[/size:$uid\]#s' => $this->bbcode_tpl('size', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_COLOR: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+):$uid\](.*?)\[/color:$uid\]!is' => $this->bbcode_tpl('color', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_U: + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[u:$uid]' => $this->bbcode_tpl('u_open', $bbcode_id), + '[/u:$uid]' => $this->bbcode_tpl('u_close', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_CODE: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#is' => function ($match) { + return $this->bbcode_second_pass_code($match[1], $match[2]); + }, + ) + ); + break; + + case BBCODE_ID_LIST: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#(\[\/?(list|\*):[mou]?:?$uid\])[\n]{1}#' => "\$1", + '#(\[list=([^\[]+):$uid\])[\n]{1}#' => "\$1", + '#\[list=([^\[]+):$uid\]#' => function ($match) { + return $this->bbcode_list($match[1]); + }, + ), + 'str' => array( + '[list:$uid]' => $this->bbcode_tpl('ulist_open_default', $bbcode_id), + '[/list:u:$uid]' => $this->bbcode_tpl('ulist_close', $bbcode_id), + '[/list:o:$uid]' => $this->bbcode_tpl('olist_close', $bbcode_id), + '[*:$uid]' => $this->bbcode_tpl('listitem', $bbcode_id), + '[/*:$uid]' => $this->bbcode_tpl('listitem_close', $bbcode_id), + '[/*:m:$uid]' => $this->bbcode_tpl('listitem_close', $bbcode_id) + ), + ); + break; + + case BBCODE_ID_EMAIL: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[email:$uid\]((.*?))\[/email:$uid\]#is' => $this->bbcode_tpl('email', $bbcode_id), + '#\[email=([^\[]+):$uid\](.*?)\[/email:$uid\]#is' => $this->bbcode_tpl('email', $bbcode_id) + ) + ); + break; + + case BBCODE_ID_FLASH: + if ($user->optionget('viewflash')) + { + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[flash=([0-9]+),([0-9]+):$uid\](.*?)\[/flash:$uid\]#' => $this->bbcode_tpl('flash', $bbcode_id), + ) + ); + } + else + { + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[flash=([0-9]+),([0-9]+):$uid\](.*?)\[/flash:$uid\]#' => str_replace('$1', '$3', str_replace('$2', '[ flash ]', $this->bbcode_tpl('url', $bbcode_id, true))) + ) + ); + } + break; + + case BBCODE_ID_ATTACH: + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[/attachment:$uid]' => $this->bbcode_tpl('inline_attachment_close', $bbcode_id) + ), + 'preg' => array( + '#\[attachment=([0-9]+):$uid\]#' => $this->bbcode_tpl('inline_attachment_open', $bbcode_id) + ) + ); + break; + + default: + if (isset($rowset[$bbcode_id])) + { + if ($this->template_bitfield->get($bbcode_id)) + { + // The bbcode requires a custom template to be loaded + if (!$bbcode_tpl = $this->bbcode_tpl($rowset[$bbcode_id]['bbcode_tag'], $bbcode_id)) + { + // For some reason, the required template seems not to be available, use the default template + $bbcode_tpl = (!empty($rowset[$bbcode_id]['second_pass_replace'])) ? $rowset[$bbcode_id]['second_pass_replace'] : $rowset[$bbcode_id]['bbcode_tpl']; + } + else + { + // In order to use templates with custom bbcodes we need + // to replace all {VARS} to corresponding backreferences + // Note that backreferences are numbered from bbcode_match + if (preg_match_all('/\{(URL|LOCAL_URL|EMAIL|TEXT|SIMPLETEXT|INTTEXT|IDENTIFIER|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m)) + { + foreach ($m[0] as $i => $tok) + { + $bbcode_tpl = str_replace($tok, '$' . ($i + 1), $bbcode_tpl); + } + } + } + } + else + { + // Default template + $bbcode_tpl = (!empty($rowset[$bbcode_id]['second_pass_replace'])) ? $rowset[$bbcode_id]['second_pass_replace'] : $rowset[$bbcode_id]['bbcode_tpl']; + } + + // Replace {L_*} lang strings + $bbcode_tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) { + return (!empty($user->lang[$match[1]])) ? $user->lang($match[1]) : ucwords(strtolower(str_replace('_', ' ', $match[1]))); + }, $bbcode_tpl); + + if (!empty($rowset[$bbcode_id]['second_pass_replace'])) + { + // The custom BBCode requires second-pass pattern replacements + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array($rowset[$bbcode_id]['second_pass_match'] => $bbcode_tpl) + ); + } + else + { + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array($rowset[$bbcode_id]['second_pass_match'] => $bbcode_tpl) + ); + } + } + else + { + $this->bbcode_cache[$bbcode_id] = false; + } + break; + } + } + + $bbcode_cache = $this->bbcode_cache; + $bbcode_bitfield = $this->bbcode_bitfield; + $bbcode_uid = $this->bbcode_uid; + + /** + * Use this event to modify the bbcode_cache + * + * @event core.bbcode_cache_init_end + * @var array bbcode_cache The array of cached search and replace patterns of bbcodes + * @var string bbcode_bitfield The bbcode bitfield + * @var string bbcode_uid The bbcode uid + * @since 3.1.3-RC1 + */ + $vars = array('bbcode_cache', 'bbcode_bitfield', 'bbcode_uid'); + extract($phpbb_dispatcher->trigger_event('core.bbcode_cache_init_end', compact($vars))); + + $this->bbcode_cache = $bbcode_cache; + $this->bbcode_bitfield = $bbcode_bitfield; + $this->bbcode_uid = $bbcode_uid; + } + + /** + * Return bbcode template + */ + function bbcode_tpl($tpl_name, $bbcode_id = -1, $skip_bitfield_check = false) + { + static $bbcode_hardtpl = array(); + if (empty($bbcode_hardtpl)) + { + global $user; + + $bbcode_hardtpl = array( + 'b_open' => '', + 'b_close' => '', + 'i_open' => '', + 'i_close' => '', + 'u_open' => '', + 'u_close' => '', + 'img' => '' . $user->lang['IMAGE'] . '', + 'size' => '$2', + 'color' => '$2', + 'email' => '$2' + ); + } + + if ($bbcode_id != -1 && !$skip_bitfield_check && !$this->template_bitfield->get($bbcode_id)) + { + return (isset($bbcode_hardtpl[$tpl_name])) ? $bbcode_hardtpl[$tpl_name] : false; + } + + if (empty($this->bbcode_template)) + { + if (($tpl = file_get_contents($this->template_filename)) === false) + { + trigger_error('Could not load bbcode template', E_USER_ERROR); + } + + // replace \ with \\ and then ' with \'. + $tpl = str_replace('\\', '\\\\', $tpl); + $tpl = str_replace("'", "\'", $tpl); + + // strip newlines and indent + $tpl = preg_replace("/\n[\n\r\s\t]*/", '', $tpl); + + // Turn template blocks into PHP assignment statements for the values of $bbcode_tpl.. + $this->bbcode_template = array(); + + // Capture the BBCode template matches + // Allow phpBB template or the Twig syntax + $matches = (preg_match_all('#(.*?)#', $tpl, $match)) ?: + preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $tpl, $match); + + for ($i = 0; $i < $matches; $i++) + { + if (empty($match[1][$i])) + { + continue; + } + + $this->bbcode_template[$match[1][$i]] = $this->bbcode_tpl_replace($match[1][$i], $match[2][$i]); + } + } + + return (isset($this->bbcode_template[$tpl_name])) ? $this->bbcode_template[$tpl_name] : ((isset($bbcode_hardtpl[$tpl_name])) ? $bbcode_hardtpl[$tpl_name] : false); + } + + /** + * Return bbcode template replacement + */ + function bbcode_tpl_replace($tpl_name, $tpl) + { + global $user; + + static $replacements = array( + 'quote_username_open' => array('{USERNAME}' => '$1'), + 'color' => array('{COLOR}' => '$1', '{TEXT}' => '$2'), + 'size' => array('{SIZE}' => '$1', '{TEXT}' => '$2'), + 'img' => array('{URL}' => '$1'), + 'flash' => array('{WIDTH}' => '$1', '{HEIGHT}' => '$2', '{URL}' => '$3'), + 'url' => array('{URL}' => '$1', '{DESCRIPTION}' => '$2'), + 'email' => array('{EMAIL}' => '$1', '{DESCRIPTION}' => '$2') + ); + + $tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) { + return (!empty($user->lang[$match[1]])) ? $user->lang($match[1]) : ucwords(strtolower(str_replace('_', ' ', $match[1]))); + }, $tpl); + + if (!empty($replacements[$tpl_name])) + { + $tpl = strtr($tpl, $replacements[$tpl_name]); + } + + return trim($tpl); + } + + /** + * Second parse list bbcode + */ + function bbcode_list($type) + { + if ($type == '') + { + $tpl = 'ulist_open_default'; + $type = 'default'; + } + else if ($type == 'i') + { + $tpl = 'olist_open'; + $type = 'lower-roman'; + } + else if ($type == 'I') + { + $tpl = 'olist_open'; + $type = 'upper-roman'; + } + else if (preg_match('#^(disc|circle|square)$#i', $type)) + { + $tpl = 'ulist_open'; + $type = strtolower($type); + } + else if (preg_match('#^[a-z]$#', $type)) + { + $tpl = 'olist_open'; + $type = 'lower-alpha'; + } + else if (preg_match('#[A-Z]#', $type)) + { + $tpl = 'olist_open'; + $type = 'upper-alpha'; + } + else if (is_numeric($type)) + { + $tpl = 'olist_open'; + $type = 'decimal'; + } + else + { + $tpl = 'olist_open'; + $type = 'decimal'; + } + + return str_replace('{LIST_TYPE}', $type, $this->bbcode_tpl($tpl)); + } + + /** + * Second parse quote tag + */ + function bbcode_second_pass_quote($username, $quote) + { + // when using the /e modifier, preg_replace slashes double-quotes but does not + // seem to slash anything else + $quote = str_replace('\"', '"', $quote); + $username = str_replace('\"', '"', $username); + + // remove newline at the beginning + if ($quote == "\n") + { + $quote = ''; + } + + $quote = (($username) ? str_replace('$1', $username, $this->bbcode_tpl('quote_username_open')) : $this->bbcode_tpl('quote_open')) . $quote; + + return $quote; + } + + /** + * Second parse code tag + */ + function bbcode_second_pass_code($type, $code) + { + // when using the /e modifier, preg_replace slashes double-quotes but does not + // seem to slash anything else + $code = str_replace('\"', '"', $code); + + switch ($type) + { + case 'php': + // Not the english way, but valid because of hardcoded syntax highlighting + if (strpos($code, '
') === 0) + { + $code = substr($code, 41); + } + + // no break; + + default: + $code = str_replace("\t", '   ', $code); + $code = str_replace(' ', '  ', $code); + $code = str_replace(' ', '  ', $code); + $code = str_replace("\n ", "\n ", $code); + + // keep space at the beginning + if (!empty($code) && $code[0] == ' ') + { + $code = ' ' . substr($code, 1); + } + + // remove newline at the beginning + if (!empty($code) && $code[0] == "\n") + { + $code = substr($code, 1); + } + break; + } + + $code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close'); + + return $code; + } + + /** + * Function to perform custom bbcode second pass by extensions + * can be used to assign bbcode pattern replacement + * Example: '#\[list=([^\[]+):$uid\]#e' => "\$this->bbcode_second_pass_by_extension('\$1')" + * + * Accepts variable number of parameters + * + * @return mixed Second pass result + */ + function bbcode_second_pass_by_extension() + { + global $phpbb_dispatcher; + + $return = false; + $params_array = func_get_args(); + + /** + * Event to perform bbcode second pass with + * the custom validating methods provided by extensions + * + * @event core.bbcode_second_pass_by_extension + * @var array params_array Array with the function parameters + * @var mixed return Second pass result to return + * + * @since 3.1.5-RC1 + */ + $vars = array('params_array', 'return'); + extract($phpbb_dispatcher->trigger_event('core.bbcode_second_pass_by_extension', compact($vars))); + + return $return; + } +} diff --git a/install/update/new/includes/compatibility_globals.php b/install/update/new/includes/compatibility_globals.php new file mode 100644 index 0000000..15880d4 --- /dev/null +++ b/install/update/new/includes/compatibility_globals.php @@ -0,0 +1,92 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +// +// Deprecated globals +// +define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming - @deprecated 3.2 +define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming - @deprecated 3.2 +define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files - @deprecated 3.2 +define('ATTACHMENT_CATEGORY_FLASH', 5); // Flash/SWF files - @deprecated 3.3 + +/** + * Sets compatibility globals in the global scope + * + * This function registers compatibility variables to the global + * variable scope. This is required to make it possible to include this file + * in a service. + */ +function register_compatibility_globals() +{ + global $phpbb_container; + + global $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $language, $phpbb_log; + global $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template; + + // set up caching + /* @var $cache \phpbb\cache\service */ + $cache = $phpbb_container->get('cache'); + + // Instantiate some basic classes + /* @var $phpbb_dispatcher \phpbb\event\dispatcher */ + $phpbb_dispatcher = $phpbb_container->get('dispatcher'); + + /* @var $request \phpbb\request\request_interface */ + $request = $phpbb_container->get('request'); + // Inject request instance, so only this instance is used with request_var + request_var('', 0, false, false, $request); + + /* @var $user \phpbb\user */ + $user = $phpbb_container->get('user'); + + /* @var \phpbb\language\language $language */ + $language = $phpbb_container->get('language'); + + /* @var $auth \phpbb\auth\auth */ + $auth = $phpbb_container->get('auth'); + + /* @var $db \phpbb\db\driver\driver_interface */ + $db = $phpbb_container->get('dbal.conn'); + + // Grab global variables, re-cache if necessary + /* @var $config phpbb\config\db */ + $config = $phpbb_container->get('config'); + set_config('', '', false, $config); + set_config_count('', 0, false, $config); + + /* @var $phpbb_log \phpbb\log\log_interface */ + $phpbb_log = $phpbb_container->get('log'); + + /* @var $symfony_request \phpbb\symfony_request */ + $symfony_request = $phpbb_container->get('symfony_request'); + + /* @var $phpbb_filesystem \phpbb\filesystem\filesystem_interface */ + $phpbb_filesystem = $phpbb_container->get('filesystem'); + + /* @var $phpbb_path_helper \phpbb\path_helper */ + $phpbb_path_helper = $phpbb_container->get('path_helper'); + + // load extensions + /* @var $phpbb_extension_manager \phpbb\extension\manager */ + $phpbb_extension_manager = $phpbb_container->get('ext.manager'); + + /* @var $template \phpbb\template\template */ + $template = $phpbb_container->get('template'); +} diff --git a/install/update/new/includes/constants.php b/install/update/new/includes/constants.php new file mode 100644 index 0000000..9508ce5 --- /dev/null +++ b/install/update/new/includes/constants.php @@ -0,0 +1,312 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* valid external constants: +* PHPBB_MSG_HANDLER +* PHPBB_DB_NEW_LINK +* PHPBB_ROOT_PATH +* PHPBB_ADMIN_PATH +*/ + +// phpBB Version +@define('PHPBB_VERSION', '3.3.0'); + +// QA-related +// define('PHPBB_QA', 1); + +// User related +define('ANONYMOUS', 1); + +define('USER_ACTIVATION_NONE', 0); +define('USER_ACTIVATION_SELF', 1); +define('USER_ACTIVATION_ADMIN', 2); +define('USER_ACTIVATION_DISABLE', 3); + +define('AVATAR_UPLOAD', 1); +define('AVATAR_REMOTE', 2); +define('AVATAR_GALLERY', 3); + +define('USER_NORMAL', 0); +define('USER_INACTIVE', 1); +define('USER_IGNORE', 2); +define('USER_FOUNDER', 3); + +define('INACTIVE_REGISTER', 1); // Newly registered account +define('INACTIVE_PROFILE', 2); // Profile details changed +define('INACTIVE_MANUAL', 3); // Account deactivated by administrator +define('INACTIVE_REMIND', 4); // Forced user account reactivation + +// ACL +define('ACL_NEVER', 0); +define('ACL_YES', 1); +define('ACL_NO', -1); + +// Login error codes +define('LOGIN_CONTINUE', 1); +define('LOGIN_BREAK', 2); +define('LOGIN_SUCCESS', 3); +define('LOGIN_SUCCESS_CREATE_PROFILE', 20); +define('LOGIN_SUCCESS_LINK_PROFILE', 21); +define('LOGIN_ERROR_USERNAME', 10); +define('LOGIN_ERROR_PASSWORD', 11); +define('LOGIN_ERROR_ACTIVE', 12); +define('LOGIN_ERROR_ATTEMPTS', 13); +define('LOGIN_ERROR_EXTERNAL_AUTH', 14); +define('LOGIN_ERROR_PASSWORD_CONVERT', 15); + +// Maximum login attempts +// The value is arbitrary, but it has to fit into the user_login_attempts field. +define('LOGIN_ATTEMPTS_MAX', 100); + +// Group settings +define('GROUP_OPEN', 0); +define('GROUP_CLOSED', 1); +define('GROUP_HIDDEN', 2); +define('GROUP_SPECIAL', 3); +define('GROUP_FREE', 4); + +// Forum/Topic states +define('FORUM_CAT', 0); +define('FORUM_POST', 1); +define('FORUM_LINK', 2); +define('ITEM_UNLOCKED', 0); +define('ITEM_LOCKED', 1); +define('ITEM_MOVED', 2); + +define('ITEM_UNAPPROVED', 0); // => has not yet been approved +define('ITEM_APPROVED', 1); // => has been approved, and has not been soft deleted +define('ITEM_DELETED', 2); // => has been soft deleted +define('ITEM_REAPPROVE', 3); // => has been edited and needs to be re-approved + +// Forum Flags +define('FORUM_FLAG_LINK_TRACK', 1); +define('FORUM_FLAG_PRUNE_POLL', 2); +define('FORUM_FLAG_PRUNE_ANNOUNCE', 4); +define('FORUM_FLAG_PRUNE_STICKY', 8); +define('FORUM_FLAG_ACTIVE_TOPICS', 16); +define('FORUM_FLAG_POST_REVIEW', 32); +define('FORUM_FLAG_QUICK_REPLY', 64); + +// Forum Options... sequential order. Modifications should begin at number 10 (number 29 is maximum) +define('FORUM_OPTION_FEED_NEWS', 1); +define('FORUM_OPTION_FEED_EXCLUDE', 2); + +// Optional text flags +define('OPTION_FLAG_BBCODE', 1); +define('OPTION_FLAG_SMILIES', 2); +define('OPTION_FLAG_LINKS', 4); + +// Topic types +define('POST_NORMAL', 0); +define('POST_STICKY', 1); +define('POST_ANNOUNCE', 2); +define('POST_GLOBAL', 3); + +// Lastread types +define('TRACK_NORMAL', 0); +define('TRACK_POSTED', 1); + +// Notify methods +define('NOTIFY_EMAIL', 0); +define('NOTIFY_IM', 1); +define('NOTIFY_BOTH', 2); + +// Notify status +define('NOTIFY_YES', 0); +define('NOTIFY_NO', 1); + +// Email Priority Settings +define('MAIL_LOW_PRIORITY', 4); +define('MAIL_NORMAL_PRIORITY', 3); +define('MAIL_HIGH_PRIORITY', 2); + +// Log types +define('LOG_ADMIN', 0); +define('LOG_MOD', 1); +define('LOG_CRITICAL', 2); +define('LOG_USERS', 3); + +// Private messaging - Do NOT change these values +define('PRIVMSGS_HOLD_BOX', -4); +define('PRIVMSGS_NO_BOX', -3); +define('PRIVMSGS_OUTBOX', -2); +define('PRIVMSGS_SENTBOX', -1); +define('PRIVMSGS_INBOX', 0); + +// Full Folder Actions +define('FULL_FOLDER_NONE', -3); +define('FULL_FOLDER_DELETE', -2); +define('FULL_FOLDER_HOLD', -1); + +// Download Modes - Attachments +define('INLINE_LINK', 1); +// This mode is only used internally to allow modders extending the attachment functionality +define('PHYSICAL_LINK', 2); + +// Confirm types +define('CONFIRM_REG', 1); +define('CONFIRM_LOGIN', 2); +define('CONFIRM_POST', 3); +define('CONFIRM_REPORT', 4); + +// Categories - Attachments +define('ATTACHMENT_CATEGORY_NONE', 0); +define('ATTACHMENT_CATEGORY_IMAGE', 1); // Inline Images +define('ATTACHMENT_CATEGORY_THUMB', 4); // Not used within the database, only while displaying posts + +// BBCode UID length +define('BBCODE_UID_LEN', 8); + +// Number of core BBCodes +define('NUM_CORE_BBCODES', 12); +define('NUM_PREDEFINED_BBCODES', 22); + +// BBCode IDs +define('BBCODE_ID_QUOTE', 0); +define('BBCODE_ID_B', 1); +define('BBCODE_ID_I', 2); +define('BBCODE_ID_URL', 3); +define('BBCODE_ID_IMG', 4); +define('BBCODE_ID_SIZE', 5); +define('BBCODE_ID_COLOR', 6); +define('BBCODE_ID_U', 7); +define('BBCODE_ID_CODE', 8); +define('BBCODE_ID_LIST', 9); +define('BBCODE_ID_EMAIL', 10); +define('BBCODE_ID_FLASH', 11); +define('BBCODE_ID_ATTACH', 12); + +// BBCode hard limit +define('BBCODE_LIMIT', 1511); + +// Smiley hard limit +define('SMILEY_LIMIT', 1000); + +// Magic url types +define('MAGIC_URL_EMAIL', 1); +define('MAGIC_URL_FULL', 2); +define('MAGIC_URL_LOCAL', 3); +define('MAGIC_URL_WWW', 4); + +// Profile Field Types +define('FIELD_INT', 1); +define('FIELD_STRING', 2); +define('FIELD_TEXT', 3); +define('FIELD_BOOL', 4); +define('FIELD_DROPDOWN', 5); +define('FIELD_DATE', 6); + +// referer validation +define('REFERER_VALIDATE_NONE', 0); +define('REFERER_VALIDATE_HOST', 1); +define('REFERER_VALIDATE_PATH', 2); + +// phpbb_chmod() permissions +@define('CHMOD_ALL', 7); +@define('CHMOD_READ', 4); +@define('CHMOD_WRITE', 2); +@define('CHMOD_EXECUTE', 1); + +// Captcha code length +define('CAPTCHA_MIN_CHARS', 4); +define('CAPTCHA_MAX_CHARS', 7); + +// Additional constants +define('VOTE_CONVERTED', 127); + +// BC global FTW +global $table_prefix; + +// Table names +define('ACL_GROUPS_TABLE', $table_prefix . 'acl_groups'); +define('ACL_OPTIONS_TABLE', $table_prefix . 'acl_options'); +define('ACL_ROLES_DATA_TABLE', $table_prefix . 'acl_roles_data'); +define('ACL_ROLES_TABLE', $table_prefix . 'acl_roles'); +define('ACL_USERS_TABLE', $table_prefix . 'acl_users'); +define('ATTACHMENTS_TABLE', $table_prefix . 'attachments'); +define('BANLIST_TABLE', $table_prefix . 'banlist'); +define('BBCODES_TABLE', $table_prefix . 'bbcodes'); +define('BOOKMARKS_TABLE', $table_prefix . 'bookmarks'); +define('BOTS_TABLE', $table_prefix . 'bots'); +@define('CONFIG_TABLE', $table_prefix . 'config'); +define('CONFIG_TEXT_TABLE', $table_prefix . 'config_text'); +define('CONFIRM_TABLE', $table_prefix . 'confirm'); +define('DISALLOW_TABLE', $table_prefix . 'disallow'); +define('DRAFTS_TABLE', $table_prefix . 'drafts'); +define('EXT_TABLE', $table_prefix . 'ext'); +define('EXTENSIONS_TABLE', $table_prefix . 'extensions'); +define('EXTENSION_GROUPS_TABLE', $table_prefix . 'extension_groups'); +define('FORUMS_TABLE', $table_prefix . 'forums'); +define('FORUMS_ACCESS_TABLE', $table_prefix . 'forums_access'); +define('FORUMS_TRACK_TABLE', $table_prefix . 'forums_track'); +define('FORUMS_WATCH_TABLE', $table_prefix . 'forums_watch'); +define('GROUPS_TABLE', $table_prefix . 'groups'); +define('ICONS_TABLE', $table_prefix . 'icons'); +define('LANG_TABLE', $table_prefix . 'lang'); +define('LOG_TABLE', $table_prefix . 'log'); +define('LOGIN_ATTEMPT_TABLE', $table_prefix . 'login_attempts'); +define('MIGRATIONS_TABLE', $table_prefix . 'migrations'); +define('MODERATOR_CACHE_TABLE', $table_prefix . 'moderator_cache'); +define('MODULES_TABLE', $table_prefix . 'modules'); +define('NOTIFICATION_TYPES_TABLE', $table_prefix . 'notification_types'); +define('NOTIFICATIONS_TABLE', $table_prefix . 'notifications'); +define('POLL_OPTIONS_TABLE', $table_prefix . 'poll_options'); +define('POLL_VOTES_TABLE', $table_prefix . 'poll_votes'); +define('POSTS_TABLE', $table_prefix . 'posts'); +define('PRIVMSGS_TABLE', $table_prefix . 'privmsgs'); +define('PRIVMSGS_FOLDER_TABLE', $table_prefix . 'privmsgs_folder'); +define('PRIVMSGS_RULES_TABLE', $table_prefix . 'privmsgs_rules'); +define('PRIVMSGS_TO_TABLE', $table_prefix . 'privmsgs_to'); +define('PROFILE_FIELDS_TABLE', $table_prefix . 'profile_fields'); +define('PROFILE_FIELDS_DATA_TABLE', $table_prefix . 'profile_fields_data'); +define('PROFILE_FIELDS_LANG_TABLE', $table_prefix . 'profile_fields_lang'); +define('PROFILE_LANG_TABLE', $table_prefix . 'profile_lang'); +define('RANKS_TABLE', $table_prefix . 'ranks'); +define('REPORTS_TABLE', $table_prefix . 'reports'); +define('REPORTS_REASONS_TABLE', $table_prefix . 'reports_reasons'); +define('SEARCH_RESULTS_TABLE', $table_prefix . 'search_results'); +define('SEARCH_WORDLIST_TABLE', $table_prefix . 'search_wordlist'); +define('SEARCH_WORDMATCH_TABLE', $table_prefix . 'search_wordmatch'); +define('SESSIONS_TABLE', $table_prefix . 'sessions'); +define('SESSIONS_KEYS_TABLE', $table_prefix . 'sessions_keys'); +define('SITELIST_TABLE', $table_prefix . 'sitelist'); +define('SMILIES_TABLE', $table_prefix . 'smilies'); +define('SPHINX_TABLE', $table_prefix . 'sphinx'); +define('STYLES_TABLE', $table_prefix . 'styles'); +define('STYLES_TEMPLATE_TABLE', $table_prefix . 'styles_template'); +define('STYLES_TEMPLATE_DATA_TABLE',$table_prefix . 'styles_template_data'); +define('STYLES_THEME_TABLE', $table_prefix . 'styles_theme'); +define('STYLES_IMAGESET_TABLE', $table_prefix . 'styles_imageset'); +define('STYLES_IMAGESET_DATA_TABLE',$table_prefix . 'styles_imageset_data'); +define('TEAMPAGE_TABLE', $table_prefix . 'teampage'); +define('TOPICS_TABLE', $table_prefix . 'topics'); +define('TOPICS_POSTED_TABLE', $table_prefix . 'topics_posted'); +define('TOPICS_TRACK_TABLE', $table_prefix . 'topics_track'); +define('TOPICS_WATCH_TABLE', $table_prefix . 'topics_watch'); +define('USER_GROUP_TABLE', $table_prefix . 'user_group'); +define('USER_NOTIFICATIONS_TABLE', $table_prefix . 'user_notifications'); +define('USERS_TABLE', $table_prefix . 'users'); +define('WARNINGS_TABLE', $table_prefix . 'warnings'); +define('WORDS_TABLE', $table_prefix . 'words'); +define('ZEBRA_TABLE', $table_prefix . 'zebra'); + +// Additional tables diff --git a/install/update/new/includes/diff/engine.php b/install/update/new/includes/diff/engine.php new file mode 100644 index 0000000..0d73db0 --- /dev/null +++ b/install/update/new/includes/diff/engine.php @@ -0,0 +1,557 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Code from pear.php.net, Text_Diff-1.1.0 package +* http://pear.php.net/package/Text_Diff/ (native engine) +* +* Modified by phpBB Limited to meet our coding standards +* and being able to integrate into phpBB +* +* Class used internally by Text_Diff to actually compute the diffs. This +* class is implemented using native PHP code. +* +* The algorithm used here is mostly lifted from the perl module +* Algorithm::Diff (version 1.06) by Ned Konz, which is available at: +* http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip +* +* More ideas are taken from: http://www.ics.uci.edu/~eppstein/161/960229.html +* +* Some ideas (and a bit of code) are taken from analyze.c, of GNU +* diffutils-2.7, which can be found at: +* ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz +* +* Some ideas (subdivision by NCHUNKS > 2, and some optimizations) are from +* Geoffrey T. Dairiki . The original PHP version of this +* code was written by him, and is used/adapted with his permission. +* +* Copyright 2004-2008 The Horde Project (http://www.horde.org/) +* +* @author Geoffrey T. Dairiki +* @package diff +* +* @access private +*/ +class diff_engine +{ + /** + * If set to true we trim all lines before we compare them. This ensures that sole space/tab changes do not trigger diffs. + */ + var $skip_whitespace_changes = true; + + function diff(&$from_lines, &$to_lines, $preserve_cr = true) + { + // Remove empty lines... + // If preserve_cr is true, we basically only change \r\n and bare \r to \n to get the same carriage returns for both files + // If it is false, we try to only use \n once per line and ommit all empty lines to be able to get a proper data diff + + if (is_array($from_lines)) + { + $from_lines = implode("\n", $from_lines); + } + + if (is_array($to_lines)) + { + $to_lines = implode("\n", $to_lines); + } + + if ($preserve_cr) + { + $from_lines = explode("\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $from_lines))); + $to_lines = explode("\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $to_lines))); + } + else + { + $from_lines = explode("\n", preg_replace('#[\n\r]+#', "\n", $from_lines)); + $to_lines = explode("\n", preg_replace('#[\n\r]+#', "\n", $to_lines)); + } + + $n_from = count($from_lines); + $n_to = count($to_lines); + + $this->xchanged = $this->ychanged = $this->xv = $this->yv = $this->xind = $this->yind = array(); + unset($this->seq, $this->in_seq, $this->lcs); + + // Skip leading common lines. + for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) + { + if (trim($from_lines[$skip]) !== trim($to_lines[$skip])) + { + break; + } + $this->xchanged[$skip] = $this->ychanged[$skip] = false; + } + + // Skip trailing common lines. + $xi = $n_from; + $yi = $n_to; + + for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) + { + if (trim($from_lines[$xi]) !== trim($to_lines[$yi])) + { + break; + } + $this->xchanged[$xi] = $this->ychanged[$yi] = false; + } + + // Ignore lines which do not exist in both files. + for ($xi = $skip; $xi < $n_from - $endskip; $xi++) + { + if ($this->skip_whitespace_changes) $xhash[trim($from_lines[$xi])] = 1; else $xhash[$from_lines[$xi]] = 1; + } + + for ($yi = $skip; $yi < $n_to - $endskip; $yi++) + { + $line = ($this->skip_whitespace_changes) ? trim($to_lines[$yi]) : $to_lines[$yi]; + + if (($this->ychanged[$yi] = empty($xhash[$line]))) + { + continue; + } + $yhash[$line] = 1; + $this->yv[] = $line; + $this->yind[] = $yi; + } + + for ($xi = $skip; $xi < $n_from - $endskip; $xi++) + { + $line = ($this->skip_whitespace_changes) ? trim($from_lines[$xi]) : $from_lines[$xi]; + + if (($this->xchanged[$xi] = empty($yhash[$line]))) + { + continue; + } + $this->xv[] = $line; + $this->xind[] = $xi; + } + + // Find the LCS. + $this->_compareseq(0, count($this->xv), 0, count($this->yv)); + + // Merge edits when possible. + if ($this->skip_whitespace_changes) + { + $from_lines_clean = array_map('trim', $from_lines); + $to_lines_clean = array_map('trim', $to_lines); + + $this->_shift_boundaries($from_lines_clean, $this->xchanged, $this->ychanged); + $this->_shift_boundaries($to_lines_clean, $this->ychanged, $this->xchanged); + + unset($from_lines_clean, $to_lines_clean); + } + else + { + $this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged); + $this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged); + } + + // Compute the edit operations. + $edits = array(); + $xi = $yi = 0; + + while ($xi < $n_from || $yi < $n_to) + { + // Skip matching "snake". + $copy = array(); + + while ($xi < $n_from && $yi < $n_to && !$this->xchanged[$xi] && !$this->ychanged[$yi]) + { + $copy[] = $from_lines[$xi++]; + $yi++; + } + + if ($copy) + { + $edits[] = new diff_op_copy($copy); + } + + // Find deletes & adds. + $delete = array(); + while ($xi < $n_from && $this->xchanged[$xi]) + { + $delete[] = $from_lines[$xi++]; + } + + $add = array(); + while ($yi < $n_to && $this->ychanged[$yi]) + { + $add[] = $to_lines[$yi++]; + } + + if ($delete && $add) + { + $edits[] = new diff_op_change($delete, $add); + } + else if ($delete) + { + $edits[] = new diff_op_delete($delete); + } + else if ($add) + { + $edits[] = new diff_op_add($add); + } + } + + return $edits; + } + + /** + * Divides the Largest Common Subsequence (LCS) of the sequences (XOFF, + * XLIM) and (YOFF, YLIM) into NCHUNKS approximately equally sized segments. + * + * Returns (LCS, PTS). LCS is the length of the LCS. PTS is an array of + * NCHUNKS+1 (X, Y) indexes giving the diving points between sub + * sequences. The first sub-sequence is contained in (X0, X1), (Y0, Y1), + * the second in (X1, X2), (Y1, Y2) and so on. Note that (X0, Y0) == + * (XOFF, YOFF) and (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM). + * + * This function assumes that the first lines of the specified portions of + * the two files do not match, and likewise that the last lines do not + * match. The caller must trim matching lines from the beginning and end + * of the portions it is going to specify. + */ + function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) + { + $flip = false; + + if ($xlim - $xoff > $ylim - $yoff) + { + // Things seems faster (I'm not sure I understand why) when the shortest sequence is in X. + $flip = true; + list($xoff, $xlim, $yoff, $ylim) = array($yoff, $ylim, $xoff, $xlim); + } + + if ($flip) + { + for ($i = $ylim - 1; $i >= $yoff; $i--) + { + $ymatches[$this->xv[$i]][] = $i; + } + } + else + { + for ($i = $ylim - 1; $i >= $yoff; $i--) + { + $ymatches[$this->yv[$i]][] = $i; + } + } + + $this->lcs = 0; + $this->seq[0]= $yoff - 1; + $this->in_seq = array(); + $ymids[0] = array(); + + $numer = $xlim - $xoff + $nchunks - 1; + $x = $xoff; + + for ($chunk = 0; $chunk < $nchunks; $chunk++) + { + if ($chunk > 0) + { + for ($i = 0; $i <= $this->lcs; $i++) + { + $ymids[$i][$chunk - 1] = $this->seq[$i]; + } + } + + $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks); + + for (; $x < $x1; $x++) + { + $line = $flip ? $this->yv[$x] : $this->xv[$x]; + if (empty($ymatches[$line])) + { + continue; + } + $matches = $ymatches[$line]; + + reset($matches); + while ($y = current($matches)) + { + next($matches); + if (empty($this->in_seq[$y])) + { + $k = $this->_lcs_pos($y); + $ymids[$k] = $ymids[$k - 1]; + break; + } + } + + // no reset() here + while ($y = current($matches)) + { + next($matches); + if ($y > $this->seq[$k - 1]) + { + // Optimization: this is a common case: next match is just replacing previous match. + $this->in_seq[$this->seq[$k]] = false; + $this->seq[$k] = $y; + $this->in_seq[$y] = 1; + } + else if (empty($this->in_seq[$y])) + { + $k = $this->_lcs_pos($y); + $ymids[$k] = $ymids[$k - 1]; + } + } + } + } + + $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff); + $ymid = $ymids[$this->lcs]; + + for ($n = 0; $n < $nchunks - 1; $n++) + { + $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks); + $y1 = $ymid[$n] + 1; + $seps[] = $flip ? array($y1, $x1) : array($x1, $y1); + } + $seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim); + + return array($this->lcs, $seps); + } + + function _lcs_pos($ypos) + { + $end = $this->lcs; + + if ($end == 0 || $ypos > $this->seq[$end]) + { + $this->seq[++$this->lcs] = $ypos; + $this->in_seq[$ypos] = 1; + return $this->lcs; + } + + $beg = 1; + while ($beg < $end) + { + $mid = (int)(($beg + $end) / 2); + if ($ypos > $this->seq[$mid]) + { + $beg = $mid + 1; + } + else + { + $end = $mid; + } + } + + $this->in_seq[$this->seq[$end]] = false; + $this->seq[$end] = $ypos; + $this->in_seq[$ypos] = 1; + + return $end; + } + + /** + * Finds LCS of two sequences. + * + * The results are recorded in the vectors $this->{x,y}changed[], by + * storing a 1 in the element for each line that is an insertion or + * deletion (ie. is not in the LCS). + * + * The subsequence of file 0 is (XOFF, XLIM) and likewise for file 1. + * + * Note that XLIM, YLIM are exclusive bounds. All line numbers are + * origin-0 and discarded lines are not counted. + */ + function _compareseq($xoff, $xlim, $yoff, $ylim) + { + // Slide down the bottom initial diagonal. + while ($xoff < $xlim && $yoff < $ylim && $this->xv[$xoff] == $this->yv[$yoff]) + { + ++$xoff; + ++$yoff; + } + + // Slide up the top initial diagonal. + while ($xlim > $xoff && $ylim > $yoff && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) + { + --$xlim; + --$ylim; + } + + if ($xoff == $xlim || $yoff == $ylim) + { + $lcs = 0; + } + else + { + // This is ad hoc but seems to work well. + // $nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5); + // $nchunks = max(2,min(8,(int)$nchunks)); + $nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1; + list($lcs, $seps) = $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks); + } + + if ($lcs == 0) + { + // X and Y sequences have no common subsequence: mark all changed. + while ($yoff < $ylim) + { + $this->ychanged[$this->yind[$yoff++]] = 1; + } + + while ($xoff < $xlim) + { + $this->xchanged[$this->xind[$xoff++]] = 1; + } + } + else + { + // Use the partitions to split this problem into subproblems. + reset($seps); + $pt1 = $seps[0]; + + while ($pt2 = next($seps)) + { + $this->_compareseq($pt1[0], $pt2[0], $pt1[1], $pt2[1]); + $pt1 = $pt2; + } + } + } + + /** + * Adjusts inserts/deletes of identical lines to join changes as much as possible. + * + * We do something when a run of changed lines include a line at one end + * and has an excluded, identical line at the other. We are free to + * choose which identical line is included. 'compareseq' usually chooses + * the one at the beginning, but usually it is cleaner to consider the + * following identical line to be the "change". + * + * This is extracted verbatim from analyze.c (GNU diffutils-2.7). + */ + function _shift_boundaries($lines, &$changed, $other_changed) + { + $i = 0; + $j = 0; + + $len = count($lines); + $other_len = count($other_changed); + + while (1) + { + // Scan forward to find the beginning of another run of + // changes. Also keep track of the corresponding point in the other file. + // + // Throughout this code, $i and $j are adjusted together so that + // the first $i elements of $changed and the first $j elements of + // $other_changed both contain the same number of zeros (unchanged lines). + // + // Furthermore, $j is always kept so that $j == $other_len or $other_changed[$j] == false. + while ($j < $other_len && $other_changed[$j]) + { + $j++; + } + + while ($i < $len && ! $changed[$i]) + { + $i++; + $j++; + + while ($j < $other_len && $other_changed[$j]) + { + $j++; + } + } + + if ($i == $len) + { + break; + } + + $start = $i; + + // Find the end of this run of changes. + while (++$i < $len && $changed[$i]) + { + continue; + } + + do + { + // Record the length of this run of changes, so that we can later determine whether the run has grown. + $runlength = $i - $start; + + // Move the changed region back, so long as the previous unchanged line matches the last changed one. + // This merges with previous changed regions. + while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) + { + $changed[--$start] = 1; + $changed[--$i] = false; + + while ($start > 0 && $changed[$start - 1]) + { + $start--; + } + + while ($other_changed[--$j]) + { + continue; + } + } + + // Set CORRESPONDING to the end of the changed run, at the last point where it corresponds to a changed run in the + // other file. CORRESPONDING == LEN means no such point has been found. + $corresponding = $j < $other_len ? $i : $len; + + // Move the changed region forward, so long as the first changed line matches the following unchanged one. + // This merges with following changed regions. + // Do this second, so that if there are no merges, the changed region is moved forward as far as possible. + while ($i < $len && $lines[$start] == $lines[$i]) + { + $changed[$start++] = false; + $changed[$i++] = 1; + + while ($i < $len && $changed[$i]) + { + $i++; + } + + $j++; + if ($j < $other_len && $other_changed[$j]) + { + $corresponding = $i; + while ($j < $other_len && $other_changed[$j]) + { + $j++; + } + } + } + } + while ($runlength != $i - $start); + + // If possible, move the fully-merged run of changes back to a corresponding run in the other file. + while ($corresponding < $i) + { + $changed[--$start] = 1; + $changed[--$i] = 0; + + while ($other_changed[--$j]) + { + continue; + } + } + } + } +} diff --git a/install/update/new/includes/functions.php b/install/update/new/includes/functions.php new file mode 100644 index 0000000..9759eab --- /dev/null +++ b/install/update/new/includes/functions.php @@ -0,0 +1,4630 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +// Common global functions +/** +* Load the autoloaders added by the extensions. +* +* @param string $phpbb_root_path Path to the phpbb root directory. +*/ +function phpbb_load_extensions_autoloaders($phpbb_root_path) +{ + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $phpbb_root_path . 'ext/', + \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + $iterator->setMaxDepth(2); + + foreach ($iterator as $file_info) + { + if ($file_info->getFilename() === 'vendor' && $iterator->getDepth() === 2) + { + $filename = $file_info->getRealPath() . '/autoload.php'; + if (file_exists($filename)) + { + require $filename; + } + } + } +} + +/** +* Generates an alphanumeric random string of given length +* +* @param int $num_chars Length of random string, defaults to 8. +* This number should be less or equal than 64. +* +* @return string +*/ +function gen_rand_string($num_chars = 8) +{ + $range = array_merge(range('A', 'Z'), range(0, 9)); + $size = count($range); + + $output = ''; + for ($i = 0; $i < $num_chars; $i++) + { + $rand = random_int(0, $size-1); + $output .= $range[$rand]; + } + + return $output; +} + +/** +* Generates a user-friendly alphanumeric random string of given length +* We remove 0 and O so users cannot confuse those in passwords etc. +* +* @param int $num_chars Length of random string, defaults to 8. +* This number should be less or equal than 64. +* +* @return string +*/ +function gen_rand_string_friendly($num_chars = 8) +{ + $range = array_merge(range('A', 'N'), range('P', 'Z'), range(1, 9)); + $size = count($range); + + $output = ''; + for ($i = 0; $i < $num_chars; $i++) + { + $rand = random_int(0, $size-1); + $output .= $range[$rand]; + } + + return $output; +} + +/** +* Return unique id +*/ +function unique_id() +{ + return strtolower(gen_rand_string(16)); +} + +/** +* Wrapper for mt_rand() which allows swapping $min and $max parameters. +* +* PHP does not allow us to swap the order of the arguments for mt_rand() anymore. +* (since PHP 5.3.4, see http://bugs.php.net/46587) +* +* @param int $min Lowest value to be returned +* @param int $max Highest value to be returned +* +* @return int Random integer between $min and $max (or $max and $min) +*/ +function phpbb_mt_rand($min, $max) +{ + return ($min > $max) ? mt_rand($max, $min) : mt_rand($min, $max); +} + +/** +* Wrapper for getdate() which returns the equivalent array for UTC timestamps. +* +* @param int $time Unix timestamp (optional) +* +* @return array Returns an associative array of information related to the timestamp. +* See http://www.php.net/manual/en/function.getdate.php +*/ +function phpbb_gmgetdate($time = false) +{ + if ($time === false) + { + $time = time(); + } + + // getdate() interprets timestamps in local time. + // What follows uses the fact that getdate() and + // date('Z') balance each other out. + return getdate($time - date('Z')); +} + +/** +* Return formatted string for filesizes +* +* @param mixed $value filesize in bytes +* (non-negative number; int, float or string) +* @param bool $string_only true if language string should be returned +* @param array $allowed_units only allow these units (data array indexes) +* +* @return mixed data array if $string_only is false +*/ +function get_formatted_filesize($value, $string_only = true, $allowed_units = false) +{ + global $user; + + $available_units = array( + 'tb' => array( + 'min' => 1099511627776, // pow(2, 40) + 'index' => 4, + 'si_unit' => 'TB', + 'iec_unit' => 'TIB', + ), + 'gb' => array( + 'min' => 1073741824, // pow(2, 30) + 'index' => 3, + 'si_unit' => 'GB', + 'iec_unit' => 'GIB', + ), + 'mb' => array( + 'min' => 1048576, // pow(2, 20) + 'index' => 2, + 'si_unit' => 'MB', + 'iec_unit' => 'MIB', + ), + 'kb' => array( + 'min' => 1024, // pow(2, 10) + 'index' => 1, + 'si_unit' => 'KB', + 'iec_unit' => 'KIB', + ), + 'b' => array( + 'min' => 0, + 'index' => 0, + 'si_unit' => 'BYTES', // Language index + 'iec_unit' => 'BYTES', // Language index + ), + ); + + foreach ($available_units as $si_identifier => $unit_info) + { + if (!empty($allowed_units) && $si_identifier != 'b' && !in_array($si_identifier, $allowed_units)) + { + continue; + } + + if ($value >= $unit_info['min']) + { + $unit_info['si_identifier'] = $si_identifier; + + break; + } + } + unset($available_units); + + for ($i = 0; $i < $unit_info['index']; $i++) + { + $value /= 1024; + } + $value = round($value, 2); + + // Lookup units in language dictionary + $unit_info['si_unit'] = (isset($user->lang[$unit_info['si_unit']])) ? $user->lang[$unit_info['si_unit']] : $unit_info['si_unit']; + $unit_info['iec_unit'] = (isset($user->lang[$unit_info['iec_unit']])) ? $user->lang[$unit_info['iec_unit']] : $unit_info['iec_unit']; + + // Default to IEC + $unit_info['unit'] = $unit_info['iec_unit']; + + if (!$string_only) + { + $unit_info['value'] = $value; + + return $unit_info; + } + + return $value . ' ' . $unit_info['unit']; +} + +/** +* Determine whether we are approaching the maximum execution time. Should be called once +* at the beginning of the script in which it's used. +* @return bool Either true if the maximum execution time is nearly reached, or false +* if some time is still left. +*/ +function still_on_time($extra_time = 15) +{ + static $max_execution_time, $start_time; + + $current_time = microtime(true); + + if (empty($max_execution_time)) + { + $max_execution_time = (function_exists('ini_get')) ? (int) @ini_get('max_execution_time') : (int) @get_cfg_var('max_execution_time'); + + // If zero, then set to something higher to not let the user catch the ten seconds barrier. + if ($max_execution_time === 0) + { + $max_execution_time = 50 + $extra_time; + } + + $max_execution_time = min(max(10, ($max_execution_time - $extra_time)), 50); + + // For debugging purposes + // $max_execution_time = 10; + + global $starttime; + $start_time = (empty($starttime)) ? $current_time : $starttime; + } + + return (ceil($current_time - $start_time) < $max_execution_time) ? true : false; +} + +/** +* Wrapper for version_compare() that allows using uppercase A and B +* for alpha and beta releases. +* +* See http://www.php.net/manual/en/function.version-compare.php +* +* @param string $version1 First version number +* @param string $version2 Second version number +* @param string $operator Comparison operator (optional) +* +* @return mixed Boolean (true, false) if comparison operator is specified. +* Integer (-1, 0, 1) otherwise. +*/ +function phpbb_version_compare($version1, $version2, $operator = null) +{ + $version1 = strtolower($version1); + $version2 = strtolower($version2); + + if (is_null($operator)) + { + return version_compare($version1, $version2); + } + else + { + return version_compare($version1, $version2, $operator); + } +} + +// functions used for building option fields + +/** +* Pick a language, any language ... +*/ +function language_select($default = '') +{ + global $db; + + $sql = 'SELECT lang_iso, lang_local_name + FROM ' . LANG_TABLE . ' + ORDER BY lang_english_name'; + $result = $db->sql_query($sql); + + $lang_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($row['lang_iso'] == $default) ? ' selected="selected"' : ''; + $lang_options .= ''; + } + $db->sql_freeresult($result); + + return $lang_options; +} + +/** +* Pick a template/theme combo, +*/ +function style_select($default = '', $all = false) +{ + global $db; + + $sql_where = (!$all) ? 'WHERE style_active = 1 ' : ''; + $sql = 'SELECT style_id, style_name + FROM ' . STYLES_TABLE . " + $sql_where + ORDER BY style_name"; + $result = $db->sql_query($sql); + + $style_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($row['style_id'] == $default) ? ' selected="selected"' : ''; + $style_options .= ''; + } + $db->sql_freeresult($result); + + return $style_options; +} + +/** +* Format the timezone offset with hours and minutes +* +* @param int $tz_offset Timezone offset in seconds +* @param bool $show_null Whether null offsets should be shown +* @return string Normalized offset string: -7200 => -02:00 +* 16200 => +04:30 +*/ +function phpbb_format_timezone_offset($tz_offset, $show_null = false) +{ + $sign = ($tz_offset < 0) ? '-' : '+'; + $time_offset = abs($tz_offset); + + if ($time_offset == 0 && $show_null == false) + { + return ''; + } + + $offset_seconds = $time_offset % 3600; + $offset_minutes = $offset_seconds / 60; + $offset_hours = ($time_offset - $offset_seconds) / 3600; + + $offset_string = sprintf("%s%02d:%02d", $sign, $offset_hours, $offset_minutes); + return $offset_string; +} + +/** +* Compares two time zone labels. +* Arranges them in increasing order by timezone offset. +* Places UTC before other timezones in the same offset. +*/ +function phpbb_tz_select_compare($a, $b) +{ + $a_sign = $a[3]; + $b_sign = $b[3]; + if ($a_sign != $b_sign) + { + return $a_sign == '-' ? -1 : 1; + } + + $a_offset = substr($a, 4, 5); + $b_offset = substr($b, 4, 5); + if ($a_offset == $b_offset) + { + $a_name = substr($a, 12); + $b_name = substr($b, 12); + if ($a_name == $b_name) + { + return 0; + } + else if ($a_name == 'UTC') + { + return -1; + } + else if ($b_name == 'UTC') + { + return 1; + } + else + { + return $a_name < $b_name ? -1 : 1; + } + } + else + { + if ($a_sign == '-') + { + return $a_offset > $b_offset ? -1 : 1; + } + else + { + return $a_offset < $b_offset ? -1 : 1; + } + } +} + +/** +* Return list of timezone identifiers +* We also add the selected timezone if we can create an object with it. +* DateTimeZone::listIdentifiers seems to not add all identifiers to the list, +* because some are only kept for backward compatible reasons. If the user has +* a deprecated value, we add it here, so it can still be kept. Once the user +* changed his value, there is no way back to deprecated values. +* +* @param string $selected_timezone Additional timezone that shall +* be added to the list of identiers +* @return array DateTimeZone::listIdentifiers and additional +* selected_timezone if it is a valid timezone. +*/ +function phpbb_get_timezone_identifiers($selected_timezone) +{ + $timezones = DateTimeZone::listIdentifiers(); + + if (!in_array($selected_timezone, $timezones)) + { + try + { + // Add valid timezones that are currently selected but not returned + // by DateTimeZone::listIdentifiers + $validate_timezone = new DateTimeZone($selected_timezone); + $timezones[] = $selected_timezone; + } + catch (\Exception $e) + { + } + } + + return $timezones; +} + +/** +* Options to pick a timezone and date/time +* +* @param \phpbb\template\template $template phpBB template object +* @param \phpbb\user $user Object of the current user +* @param string $default A timezone to select +* @param boolean $truncate Shall we truncate the options text +* +* @return array Returns an array containing the options for the time selector. +*/ +function phpbb_timezone_select($template, $user, $default = '', $truncate = false) +{ + static $timezones; + + $default_offset = ''; + if (!isset($timezones)) + { + $unsorted_timezones = phpbb_get_timezone_identifiers($default); + + $timezones = array(); + foreach ($unsorted_timezones as $timezone) + { + $tz = new DateTimeZone($timezone); + $dt = $user->create_datetime('now', $tz); + $offset = $dt->getOffset(); + $current_time = $dt->format($user->lang['DATETIME_FORMAT'], true); + $offset_string = phpbb_format_timezone_offset($offset, true); + $timezones['UTC' . $offset_string . ' - ' . $timezone] = array( + 'tz' => $timezone, + 'offset' => $offset_string, + 'current' => $current_time, + ); + if ($timezone === $default) + { + $default_offset = 'UTC' . $offset_string; + } + } + unset($unsorted_timezones); + + uksort($timezones, 'phpbb_tz_select_compare'); + } + + $tz_select = $opt_group = ''; + + foreach ($timezones as $key => $timezone) + { + if ($opt_group != $timezone['offset']) + { + // Generate tz_select for backwards compatibility + $tz_select .= ($opt_group) ? '' : ''; + $tz_select .= ''; + $opt_group = $timezone['offset']; + $template->assign_block_vars('timezone_select', array( + 'LABEL' => $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']), + 'VALUE' => $key . ' - ' . $timezone['current'], + )); + + $selected = (!empty($default_offset) && strpos($key, $default_offset) !== false) ? ' selected="selected"' : ''; + $template->assign_block_vars('timezone_date', array( + 'VALUE' => $key . ' - ' . $timezone['current'], + 'SELECTED' => !empty($selected), + 'TITLE' => $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']), + )); + } + + $label = $timezone['tz']; + if (isset($user->lang['timezones'][$label])) + { + $label = $user->lang['timezones'][$label]; + } + $title = $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $label); + + if ($truncate) + { + $label = truncate_string($label, 50, 255, false, '...'); + } + + // Also generate timezone_select for backwards compatibility + $selected = ($timezone['tz'] === $default) ? ' selected="selected"' : ''; + $tz_select .= ''; + $template->assign_block_vars('timezone_select.timezone_options', array( + 'TITLE' => $title, + 'VALUE' => $timezone['tz'], + 'SELECTED' => !empty($selected), + 'LABEL' => $label, + )); + } + $tz_select .= ''; + + return $tz_select; +} + +// Functions handling topic/post tracking/marking + +/** +* Marks a topic/forum as read +* Marks a topic as posted to +* +* @param string $mode (all, topics, topic, post) +* @param int|bool $forum_id Used in all, topics, and topic mode +* @param int|bool $topic_id Used in topic and post mode +* @param int $post_time 0 means current time(), otherwise to set a specific mark time +* @param int $user_id can only be used with $mode == 'post' +*/ +function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $user_id = 0) +{ + global $db, $user, $config; + global $request, $phpbb_container, $phpbb_dispatcher; + + $post_time = ($post_time === 0 || $post_time > time()) ? time() : (int) $post_time; + + $should_markread = true; + + /** + * This event is used for performing actions directly before marking forums, + * topics or posts as read. + * + * It is also possible to prevent the marking. For that, the $should_markread parameter + * should be set to FALSE. + * + * @event core.markread_before + * @var string mode Variable containing marking mode value + * @var mixed forum_id Variable containing forum id, or false + * @var mixed topic_id Variable containing topic id, or false + * @var int post_time Variable containing post time + * @var int user_id Variable containing the user id + * @var bool should_markread Flag indicating if the markread should be done or not. + * @since 3.1.4-RC1 + */ + $vars = array( + 'mode', + 'forum_id', + 'topic_id', + 'post_time', + 'user_id', + 'should_markread', + ); + extract($phpbb_dispatcher->trigger_event('core.markread_before', compact($vars))); + + if (!$should_markread) + { + return; + } + + if ($mode == 'all') + { + if (empty($forum_id)) + { + // Mark all forums read (index page) + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + // Mark all topic notifications read for this user + $phpbb_notifications->mark_notifications(array( + 'notification.type.topic', + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + 'notification.type.approve_topic', + 'notification.type.approve_post', + ), false, $user->data['user_id'], $post_time); + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + // Mark all forums read (index page) + $tables = array(TOPICS_TRACK_TABLE, FORUMS_TRACK_TABLE); + foreach ($tables as $table) + { + $sql = 'DELETE FROM ' . $table . " + WHERE user_id = {$user->data['user_id']} + AND mark_time < $post_time"; + $db->sql_query($sql); + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastmark = $post_time + WHERE user_id = {$user->data['user_id']} + AND user_lastmark < $post_time"; + $db->sql_query($sql); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + + unset($tracking_topics['tf']); + unset($tracking_topics['t']); + unset($tracking_topics['f']); + $tracking_topics['l'] = base_convert($post_time - $config['board_startdate'], 10, 36); + + $user->set_cookie('track', tracking_serialize($tracking_topics), $post_time + 31536000); + $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking_topics), \phpbb\request\request_interface::COOKIE); + + unset($tracking_topics); + + if ($user->data['is_registered']) + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastmark = $post_time + WHERE user_id = {$user->data['user_id']} + AND user_lastmark < $post_time"; + $db->sql_query($sql); + } + } + } + } + else if ($mode == 'topics') + { + // Mark all topics in forums read + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + else + { + $forum_id = array_unique($forum_id); + } + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->mark_notifications_by_parent(array( + 'notification.type.topic', + 'notification.type.approve_topic', + ), $forum_id, $user->data['user_id'], $post_time); + + // Mark all post/quote notifications read for this user in this forum + $topic_ids = array(); + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id); + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + $phpbb_notifications->mark_notifications_by_parent(array( + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + 'notification.type.approve_post', + ), $topic_ids, $user->data['user_id'], $post_time); + + // Add 0 to forums array to mark global announcements correctly + // $forum_id[] = 0; + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $sql = 'DELETE FROM ' . TOPICS_TRACK_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND mark_time < $post_time + AND " . $db->sql_in_set('forum_id', $forum_id); + $db->sql_query($sql); + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TRACK_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND " . $db->sql_in_set('forum_id', $forum_id); + $result = $db->sql_query($sql); + + $sql_update = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_update[] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + + if (count($sql_update)) + { + $sql = 'UPDATE ' . FORUMS_TRACK_TABLE . " + SET mark_time = $post_time + WHERE user_id = {$user->data['user_id']} + AND mark_time < $post_time + AND " . $db->sql_in_set('forum_id', $sql_update); + $db->sql_query($sql); + } + + if ($sql_insert = array_diff($forum_id, $sql_update)) + { + $sql_ary = array(); + foreach ($sql_insert as $f_id) + { + $sql_ary[] = array( + 'user_id' => (int) $user->data['user_id'], + 'forum_id' => (int) $f_id, + 'mark_time' => $post_time, + ); + } + + $db->sql_multi_insert(FORUMS_TRACK_TABLE, $sql_ary); + } + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $tracking = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking = ($tracking) ? tracking_unserialize($tracking) : array(); + + foreach ($forum_id as $f_id) + { + $topic_ids36 = (isset($tracking['tf'][$f_id])) ? $tracking['tf'][$f_id] : array(); + + if (isset($tracking['tf'][$f_id])) + { + unset($tracking['tf'][$f_id]); + } + + foreach ($topic_ids36 as $topic_id36) + { + unset($tracking['t'][$topic_id36]); + } + + if (isset($tracking['f'][$f_id])) + { + unset($tracking['f'][$f_id]); + } + + $tracking['f'][$f_id] = base_convert($post_time - $config['board_startdate'], 10, 36); + } + + if (isset($tracking['tf']) && empty($tracking['tf'])) + { + unset($tracking['tf']); + } + + $user->set_cookie('track', tracking_serialize($tracking), $post_time + 31536000); + $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), \phpbb\request\request_interface::COOKIE); + + unset($tracking); + } + } + else if ($mode == 'topic') + { + if ($topic_id === false || $forum_id === false) + { + return; + } + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + // Mark post notifications read for this user in this topic + $phpbb_notifications->mark_notifications(array( + 'notification.type.topic', + 'notification.type.approve_topic', + ), $topic_id, $user->data['user_id'], $post_time); + + $phpbb_notifications->mark_notifications_by_parent(array( + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + 'notification.type.approve_post', + ), $topic_id, $user->data['user_id'], $post_time); + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $sql = 'UPDATE ' . TOPICS_TRACK_TABLE . " + SET mark_time = $post_time + WHERE user_id = {$user->data['user_id']} + AND mark_time < $post_time + AND topic_id = $topic_id"; + $db->sql_query($sql); + + // insert row + if (!$db->sql_affectedrows()) + { + $db->sql_return_on_error(true); + + $sql_ary = array( + 'user_id' => (int) $user->data['user_id'], + 'topic_id' => (int) $topic_id, + 'forum_id' => (int) $forum_id, + 'mark_time' => $post_time, + ); + + $db->sql_query('INSERT INTO ' . TOPICS_TRACK_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $db->sql_return_on_error(false); + } + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $tracking = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking = ($tracking) ? tracking_unserialize($tracking) : array(); + + $topic_id36 = base_convert($topic_id, 10, 36); + + if (!isset($tracking['t'][$topic_id36])) + { + $tracking['tf'][$forum_id][$topic_id36] = true; + } + + $tracking['t'][$topic_id36] = base_convert($post_time - (int) $config['board_startdate'], 10, 36); + + // If the cookie grows larger than 10000 characters we will remove the smallest value + // This can result in old topics being unread - but most of the time it should be accurate... + if (strlen($request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE)) > 10000) + { + //echo 'Cookie grown too large' . print_r($tracking, true); + + // We get the ten most minimum stored time offsets and its associated topic ids + $time_keys = array(); + for ($i = 0; $i < 10 && count($tracking['t']); $i++) + { + $min_value = min($tracking['t']); + $m_tkey = array_search($min_value, $tracking['t']); + unset($tracking['t'][$m_tkey]); + + $time_keys[$m_tkey] = $min_value; + } + + // Now remove the topic ids from the array... + foreach ($tracking['tf'] as $f_id => $topic_id_ary) + { + foreach ($time_keys as $m_tkey => $min_value) + { + if (isset($topic_id_ary[$m_tkey])) + { + $tracking['f'][$f_id] = $min_value; + unset($tracking['tf'][$f_id][$m_tkey]); + } + } + } + + if ($user->data['is_registered']) + { + $user->data['user_lastmark'] = intval(base_convert(max($time_keys) + $config['board_startdate'], 36, 10)); + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastmark = $post_time + WHERE user_id = {$user->data['user_id']} + AND mark_time < $post_time"; + $db->sql_query($sql); + } + else + { + $tracking['l'] = max($time_keys); + } + } + + $user->set_cookie('track', tracking_serialize($tracking), $post_time + 31536000); + $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), \phpbb\request\request_interface::COOKIE); + } + } + else if ($mode == 'post') + { + if ($topic_id === false) + { + return; + } + + $use_user_id = (!$user_id) ? $user->data['user_id'] : $user_id; + + if ($config['load_db_track'] && $use_user_id != ANONYMOUS) + { + $db->sql_return_on_error(true); + + $sql_ary = array( + 'user_id' => (int) $use_user_id, + 'topic_id' => (int) $topic_id, + 'topic_posted' => 1, + ); + + $db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $db->sql_return_on_error(false); + } + } + + /** + * This event is used for performing actions directly after forums, + * topics or posts have been marked as read. + * + * @event core.markread_after + * @var string mode Variable containing marking mode value + * @var mixed forum_id Variable containing forum id, or false + * @var mixed topic_id Variable containing topic id, or false + * @var int post_time Variable containing post time + * @var int user_id Variable containing the user id + * @since 3.2.6-RC1 + */ + $vars = array( + 'mode', + 'forum_id', + 'topic_id', + 'post_time', + 'user_id', + ); + extract($phpbb_dispatcher->trigger_event('core.markread_after', compact($vars))); +} + +/** +* Get topic tracking info by using already fetched info +*/ +function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $global_announce_list = false) +{ + global $user; + + $last_read = array(); + + if (!is_array($topic_ids)) + { + $topic_ids = array($topic_ids); + } + + foreach ($topic_ids as $topic_id) + { + if (!empty($rowset[$topic_id]['mark_time'])) + { + $last_read[$topic_id] = $rowset[$topic_id]['mark_time']; + } + } + + $topic_ids = array_diff($topic_ids, array_keys($last_read)); + + if (count($topic_ids)) + { + $mark_time = array(); + + if (!empty($forum_mark_time[$forum_id]) && $forum_mark_time[$forum_id] !== false) + { + $mark_time[$forum_id] = $forum_mark_time[$forum_id]; + } + + $user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user->data['user_lastmark']; + + foreach ($topic_ids as $topic_id) + { + $last_read[$topic_id] = $user_lastmark; + } + } + + return $last_read; +} + +/** +* Get topic tracking info from db (for cookie based tracking only this function is used) +*/ +function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_list = false) +{ + global $config, $user, $request; + + $last_read = array(); + + if (!is_array($topic_ids)) + { + $topic_ids = array($topic_ids); + } + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + global $db; + + $sql = 'SELECT topic_id, mark_time + FROM ' . TOPICS_TRACK_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND " . $db->sql_in_set('topic_id', $topic_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $last_read[$row['topic_id']] = $row['mark_time']; + } + $db->sql_freeresult($result); + + $topic_ids = array_diff($topic_ids, array_keys($last_read)); + + if (count($topic_ids)) + { + $sql = 'SELECT forum_id, mark_time + FROM ' . FORUMS_TRACK_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND forum_id = $forum_id"; + $result = $db->sql_query($sql); + + $mark_time = array(); + while ($row = $db->sql_fetchrow($result)) + { + $mark_time[$row['forum_id']] = $row['mark_time']; + } + $db->sql_freeresult($result); + + $user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user->data['user_lastmark']; + + foreach ($topic_ids as $topic_id) + { + $last_read[$topic_id] = $user_lastmark; + } + } + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + global $tracking_topics; + + if (!isset($tracking_topics) || !count($tracking_topics)) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + } + + if (!$user->data['is_registered']) + { + $user_lastmark = (isset($tracking_topics['l'])) ? base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate'] : 0; + } + else + { + $user_lastmark = $user->data['user_lastmark']; + } + + foreach ($topic_ids as $topic_id) + { + $topic_id36 = base_convert($topic_id, 10, 36); + + if (isset($tracking_topics['t'][$topic_id36])) + { + $last_read[$topic_id] = base_convert($tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate']; + } + } + + $topic_ids = array_diff($topic_ids, array_keys($last_read)); + + if (count($topic_ids)) + { + $mark_time = array(); + + if (isset($tracking_topics['f'][$forum_id])) + { + $mark_time[$forum_id] = base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']; + } + + $user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user_lastmark; + + foreach ($topic_ids as $topic_id) + { + $last_read[$topic_id] = $user_lastmark; + } + } + } + + return $last_read; +} + +/** +* Get list of unread topics +* +* @param int $user_id User ID (or false for current user) +* @param string $sql_extra Extra WHERE SQL statement +* @param string $sql_sort ORDER BY SQL sorting statement +* @param string $sql_limit Limits the size of unread topics list, 0 for unlimited query +* @param string $sql_limit_offset Sets the offset of the first row to search, 0 to search from the start +* +* @return array[int][int] Topic ids as keys, mark_time of topic as value +*/ +function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001, $sql_limit_offset = 0) +{ + global $config, $db, $user, $request; + global $phpbb_dispatcher; + + $user_id = ($user_id === false) ? (int) $user->data['user_id'] : (int) $user_id; + + // Data array we're going to return + $unread_topics = array(); + + if (empty($sql_sort)) + { + $sql_sort = 'ORDER BY t.topic_last_post_time DESC, t.topic_last_post_id DESC'; + } + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + // Get list of the unread topics + $last_mark = (int) $user->data['user_lastmark']; + + $sql_array = array( + 'SELECT' => 't.topic_id, t.topic_last_post_time, tt.mark_time as topic_mark_time, ft.mark_time as forum_mark_time', + + 'FROM' => array(TOPICS_TABLE => 't'), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), + 'ON' => "tt.user_id = $user_id AND t.topic_id = tt.topic_id", + ), + array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => "ft.user_id = $user_id AND t.forum_id = ft.forum_id", + ), + ), + + 'WHERE' => " + t.topic_last_post_time > $last_mark AND + ( + (tt.mark_time IS NOT NULL AND t.topic_last_post_time > tt.mark_time) OR + (tt.mark_time IS NULL AND ft.mark_time IS NOT NULL AND t.topic_last_post_time > ft.mark_time) OR + (tt.mark_time IS NULL AND ft.mark_time IS NULL) + ) + $sql_extra + $sql_sort", + ); + + /** + * Change SQL query for fetching unread topics data + * + * @event core.get_unread_topics_modify_sql + * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, LEFT_JOIN, WHERE + * @var int last_mark User's last_mark time + * @var string sql_extra Extra WHERE SQL statement + * @var string sql_sort ORDER BY SQL sorting statement + * @since 3.1.4-RC1 + */ + $vars = array( + 'sql_array', + 'last_mark', + 'sql_extra', + 'sql_sort', + ); + extract($phpbb_dispatcher->trigger_event('core.get_unread_topics_modify_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query_limit($sql, $sql_limit, $sql_limit_offset); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id = (int) $row['topic_id']; + $unread_topics[$topic_id] = ($row['topic_mark_time']) ? (int) $row['topic_mark_time'] : (($row['forum_mark_time']) ? (int) $row['forum_mark_time'] : $last_mark); + } + $db->sql_freeresult($result); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + global $tracking_topics; + + if (empty($tracking_topics)) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', false, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + } + + if (!$user->data['is_registered']) + { + $user_lastmark = (isset($tracking_topics['l'])) ? base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate'] : 0; + } + else + { + $user_lastmark = (int) $user->data['user_lastmark']; + } + + $sql = 'SELECT t.topic_id, t.forum_id, t.topic_last_post_time + FROM ' . TOPICS_TABLE . ' t + WHERE t.topic_last_post_time > ' . $user_lastmark . " + $sql_extra + $sql_sort"; + $result = $db->sql_query_limit($sql, $sql_limit, $sql_limit_offset); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_id = (int) $row['forum_id']; + $topic_id = (int) $row['topic_id']; + $topic_id36 = base_convert($topic_id, 10, 36); + + if (isset($tracking_topics['t'][$topic_id36])) + { + $last_read = base_convert($tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate']; + + if ($row['topic_last_post_time'] > $last_read) + { + $unread_topics[$topic_id] = $last_read; + } + } + else if (isset($tracking_topics['f'][$forum_id])) + { + $mark_time = base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']; + + if ($row['topic_last_post_time'] > $mark_time) + { + $unread_topics[$topic_id] = $mark_time; + } + } + else + { + $unread_topics[$topic_id] = $user_lastmark; + } + } + $db->sql_freeresult($result); + } + + return $unread_topics; +} + +/** +* Check for read forums and update topic tracking info accordingly +* +* @param int $forum_id the forum id to check +* @param int $forum_last_post_time the forums last post time +* @param int $f_mark_time the forums last mark time if user is registered and load_db_lastread enabled +* @param int $mark_time_forum false if the mark time needs to be obtained, else the last users forum mark time +* +* @return true if complete forum got marked read, else false. +*/ +function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false) +{ + global $db, $tracking_topics, $user, $config, $request, $phpbb_container; + + // Determine the users last forum mark time if not given. + if ($mark_time_forum === false) + { + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $mark_time_forum = (!empty($f_mark_time)) ? $f_mark_time : $user->data['user_lastmark']; + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + + if (!$user->data['is_registered']) + { + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + + $mark_time_forum = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + } + } + + // Handle update of unapproved topics info. + // Only update for moderators having m_approve permission for the forum. + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + // Check the forum for any left unread topics. + // If there are none, we mark the forum as read. + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + if ($mark_time_forum >= $forum_last_post_time) + { + // We do not need to mark read, this happened before. Therefore setting this to true + $row = true; + } + else + { + $sql = 'SELECT t.forum_id + FROM ' . TOPICS_TABLE . ' t + LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt + ON (tt.topic_id = t.topic_id + AND tt.user_id = ' . $user->data['user_id'] . ') + WHERE t.forum_id = ' . $forum_id . ' + AND t.topic_last_post_time > ' . $mark_time_forum . ' + AND t.topic_moved_id = 0 + AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.') . ' + AND (tt.topic_id IS NULL + OR tt.mark_time < t.topic_last_post_time)'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + // Get information from cookie + if (!isset($tracking_topics['tf'][$forum_id])) + { + // We do not need to mark read, this happened before. Therefore setting this to true + $row = true; + } + else + { + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE t.forum_id = ' . $forum_id . ' + AND t.topic_last_post_time > ' . $mark_time_forum . ' + AND t.topic_moved_id = 0 + AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'); + $result = $db->sql_query($sql); + + $check_forum = $tracking_topics['tf'][$forum_id]; + $unread = false; + + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($check_forum[base_convert($row['topic_id'], 10, 36)])) + { + $unread = true; + break; + } + } + $db->sql_freeresult($result); + + $row = $unread; + } + } + else + { + $row = true; + } + + if (!$row) + { + markread('topics', $forum_id); + return true; + } + + return false; +} + +/** +* Transform an array into a serialized format +*/ +function tracking_serialize($input) +{ + $out = ''; + foreach ($input as $key => $value) + { + if (is_array($value)) + { + $out .= $key . ':(' . tracking_serialize($value) . ');'; + } + else + { + $out .= $key . ':' . $value . ';'; + } + } + return $out; +} + +/** +* Transform a serialized array into an actual array +*/ +function tracking_unserialize($string, $max_depth = 3) +{ + $n = strlen($string); + if ($n > 10010) + { + die('Invalid data supplied'); + } + $data = $stack = array(); + $key = ''; + $mode = 0; + $level = &$data; + for ($i = 0; $i < $n; ++$i) + { + switch ($mode) + { + case 0: + switch ($string[$i]) + { + case ':': + $level[$key] = 0; + $mode = 1; + break; + case ')': + unset($level); + $level = array_pop($stack); + $mode = 3; + break; + default: + $key .= $string[$i]; + } + break; + + case 1: + switch ($string[$i]) + { + case '(': + if (count($stack) >= $max_depth) + { + die('Invalid data supplied'); + } + $stack[] = &$level; + $level[$key] = array(); + $level = &$level[$key]; + $key = ''; + $mode = 0; + break; + default: + $level[$key] = $string[$i]; + $mode = 2; + break; + } + break; + + case 2: + switch ($string[$i]) + { + case ')': + unset($level); + $level = array_pop($stack); + $mode = 3; + break; + case ';': + $key = ''; + $mode = 0; + break; + default: + $level[$key] .= $string[$i]; + break; + } + break; + + case 3: + switch ($string[$i]) + { + case ')': + unset($level); + $level = array_pop($stack); + break; + case ';': + $key = ''; + $mode = 0; + break; + default: + die('Invalid data supplied'); + break; + } + break; + } + } + + if (count($stack) != 0 || ($mode != 0 && $mode != 3)) + { + die('Invalid data supplied'); + } + + return $level; +} + +// Server functions (building urls, redirecting...) + +/** +* Append session id to url. +* This function supports hooks. +* +* @param string $url The url the session id needs to be appended to (can have params) +* @param mixed $params String or array of additional url parameters +* @param bool $is_amp Is url using & (true) or & (false) +* @param string $session_id Possibility to use a custom session id instead of the global one +* @param bool $is_route Is url generated by a route. +* +* @return string The corrected url. +* +* Examples: +* +* append_sid("{$phpbb_root_path}viewtopic.$phpEx?t=1&f=2"); +* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2'); +* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2', false); +* append_sid("{$phpbb_root_path}viewtopic.$phpEx", array('t' => 1, 'f' => 2)); +* +* +*/ +function append_sid($url, $params = false, $is_amp = true, $session_id = false, $is_route = false) +{ + global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_path_helper; + global $phpbb_dispatcher; + + if ($params === '' || (is_array($params) && empty($params))) + { + // Do not append the ? if the param-list is empty anyway. + $params = false; + } + + // Update the root path with the correct relative web path + if (!$is_route && $phpbb_path_helper instanceof \phpbb\path_helper) + { + $url = $phpbb_path_helper->update_web_root_path($url); + } + + $append_sid_overwrite = false; + + /** + * This event can either supplement or override the append_sid() function + * + * To override this function, the event must set $append_sid_overwrite to + * the new URL value, which will be returned following the event + * + * @event core.append_sid + * @var string url The url the session id needs + * to be appended to (can have + * params) + * @var mixed params String or array of additional + * url parameters + * @var bool is_amp Is url using & (true) or + * & (false) + * @var bool|string session_id Possibility to use a custom + * session id (string) instead of + * the global one (false) + * @var bool|string append_sid_overwrite Overwrite function (string + * URL) or not (false) + * @var bool is_route Is url generated by a route. + * @since 3.1.0-a1 + */ + $vars = array('url', 'params', 'is_amp', 'session_id', 'append_sid_overwrite', 'is_route'); + extract($phpbb_dispatcher->trigger_event('core.append_sid', compact($vars))); + + if ($append_sid_overwrite) + { + return $append_sid_overwrite; + } + + // The following hook remains for backwards compatibility, though use of + // the event above is preferred. + // Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropriately. + // They could mimic most of what is within this function + if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id)) + { + if ($phpbb_hook->hook_return(__FUNCTION__)) + { + return $phpbb_hook->hook_return_result(__FUNCTION__); + } + } + + $params_is_array = is_array($params); + + // Get anchor + $anchor = ''; + if (strpos($url, '#') !== false) + { + list($url, $anchor) = explode('#', $url, 2); + $anchor = '#' . $anchor; + } + else if (!$params_is_array && strpos($params, '#') !== false) + { + list($params, $anchor) = explode('#', $params, 2); + $anchor = '#' . $anchor; + } + + // Handle really simple cases quickly + if ($_SID == '' && $session_id === false && empty($_EXTRA_URL) && !$params_is_array && !$anchor) + { + if ($params === false) + { + return $url; + } + + $url_delim = (strpos($url, '?') === false) ? '?' : (($is_amp) ? '&' : '&'); + return $url . ($params !== false ? $url_delim. $params : ''); + } + + // Assign sid if session id is not specified + if ($session_id === false) + { + $session_id = $_SID; + } + + $amp_delim = ($is_amp) ? '&' : '&'; + $url_delim = (strpos($url, '?') === false) ? '?' : $amp_delim; + + // Appending custom url parameter? + $append_url = (!empty($_EXTRA_URL)) ? implode($amp_delim, $_EXTRA_URL) : ''; + + // Use the short variant if possible ;) + if ($params === false) + { + // Append session id + if (!$session_id) + { + return $url . (($append_url) ? $url_delim . $append_url : '') . $anchor; + } + else + { + return $url . (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . 'sid=' . $session_id . $anchor; + } + } + + // Build string if parameters are specified as array + if (is_array($params)) + { + $output = array(); + + foreach ($params as $key => $item) + { + if ($item === NULL) + { + continue; + } + + if ($key == '#') + { + $anchor = '#' . $item; + continue; + } + + $output[] = $key . '=' . $item; + } + + $params = implode($amp_delim, $output); + } + + // Append session id and parameters (even if they are empty) + // If parameters are empty, the developer can still append his/her parameters without caring about the delimiter + return $url . (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . $params . ((!$session_id) ? '' : $amp_delim . 'sid=' . $session_id) . $anchor; +} + +/** +* Generate board url (example: http://www.example.com/phpBB) +* +* @param bool $without_script_path if set to true the script path gets not appended (example: http://www.example.com) +* +* @return string the generated board url +*/ +function generate_board_url($without_script_path = false) +{ + global $config, $user, $request, $symfony_request; + + $server_name = $user->host; + + // Forcing server vars is the only way to specify/override the protocol + if ($config['force_server_vars'] || !$server_name) + { + $server_protocol = ($config['server_protocol']) ? $config['server_protocol'] : (($config['cookie_secure']) ? 'https://' : 'http://'); + $server_name = $config['server_name']; + $server_port = (int) $config['server_port']; + $script_path = $config['script_path']; + + $url = $server_protocol . $server_name; + $cookie_secure = $config['cookie_secure']; + } + else + { + $server_port = (int) $symfony_request->getPort(); + + $forwarded_proto = $request->server('HTTP_X_FORWARDED_PROTO'); + + if (!empty($forwarded_proto) && $forwarded_proto === 'https') + { + $server_port = 443; + } + // Do not rely on cookie_secure, users seem to think that it means a secured cookie instead of an encrypted connection + $cookie_secure = $request->is_secure() ? 1 : 0; + $url = (($cookie_secure) ? 'https://' : 'http://') . $server_name; + + $script_path = $user->page['root_script_path']; + } + + if ($server_port && (($cookie_secure && $server_port <> 443) || (!$cookie_secure && $server_port <> 80))) + { + // HTTP HOST can carry a port number (we fetch $user->host, but for old versions this may be true) + if (strpos($server_name, ':') === false) + { + $url .= ':' . $server_port; + } + } + + if (!$without_script_path) + { + $url .= $script_path; + } + + // Strip / from the end + if (substr($url, -1, 1) == '/') + { + $url = substr($url, 0, -1); + } + + return $url; +} + +/** +* Redirects the user to another page then exits the script nicely +* This function is intended for urls within the board. It's not meant to redirect to cross-domains. +* +* @param string $url The url to redirect to +* @param bool $return If true, do not redirect but return the sanitized URL. Default is no return. +* @param bool $disable_cd_check If true, redirect() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. Default is false. +*/ +function redirect($url, $return = false, $disable_cd_check = false) +{ + global $user, $phpbb_path_helper, $phpbb_dispatcher; + + if (!$user->is_setup()) + { + $user->add_lang('common'); + } + + // Make sure no &'s are in, this will break the redirect + $url = str_replace('&', '&', $url); + + // Determine which type of redirect we need to handle... + $url_parts = @parse_url($url); + + if ($url_parts === false) + { + // Malformed url + trigger_error('INSECURE_REDIRECT', E_USER_WARNING); + } + else if (!empty($url_parts['scheme']) && !empty($url_parts['host'])) + { + // Attention: only able to redirect within the same domain if $disable_cd_check is false (yourdomain.com -> www.yourdomain.com will not work) + if (!$disable_cd_check && $url_parts['host'] !== $user->host) + { + trigger_error('INSECURE_REDIRECT', E_USER_WARNING); + } + } + else if ($url[0] == '/') + { + // Absolute uri, prepend direct url... + $url = generate_board_url(true) . $url; + } + else + { + // Relative uri + $pathinfo = pathinfo($url); + + // Is the uri pointing to the current directory? + if ($pathinfo['dirname'] == '.') + { + $url = str_replace('./', '', $url); + + // Strip / from the beginning + if ($url && substr($url, 0, 1) == '/') + { + $url = substr($url, 1); + } + } + + $url = $phpbb_path_helper->remove_web_root_path($url); + + if ($user->page['page_dir']) + { + $url = $user->page['page_dir'] . '/' . $url; + } + + $url = generate_board_url() . '/' . $url; + } + + // Clean URL and check if we go outside the forum directory + $url = $phpbb_path_helper->clean_url($url); + + if (!$disable_cd_check && strpos($url, generate_board_url(true) . '/') !== 0) + { + trigger_error('INSECURE_REDIRECT', E_USER_WARNING); + } + + // Make sure no linebreaks are there... to prevent http response splitting for PHP < 4.4.2 + if (strpos(urldecode($url), "\n") !== false || strpos(urldecode($url), "\r") !== false || strpos($url, ';') !== false) + { + trigger_error('INSECURE_REDIRECT', E_USER_WARNING); + } + + // Now, also check the protocol and for a valid url the last time... + $allowed_protocols = array('http', 'https', 'ftp', 'ftps'); + $url_parts = parse_url($url); + + if ($url_parts === false || empty($url_parts['scheme']) || !in_array($url_parts['scheme'], $allowed_protocols)) + { + trigger_error('INSECURE_REDIRECT', E_USER_WARNING); + } + + /** + * Execute code and/or overwrite redirect() + * + * @event core.functions.redirect + * @var string url The url + * @var bool return If true, do not redirect but return the sanitized URL. + * @var bool disable_cd_check If true, redirect() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. + * @since 3.1.0-RC3 + */ + $vars = array('url', 'return', 'disable_cd_check'); + extract($phpbb_dispatcher->trigger_event('core.functions.redirect', compact($vars))); + + if ($return) + { + return $url; + } + else + { + garbage_collection(); + } + + // Behave as per HTTP/1.1 spec for others + header('Location: ' . $url); + exit; +} + +/** +* Re-Apply session id after page reloads +*/ +function reapply_sid($url, $is_route = false) +{ + global $phpEx, $phpbb_root_path; + + if ($url === "index.$phpEx") + { + return append_sid("index.$phpEx"); + } + else if ($url === "{$phpbb_root_path}index.$phpEx") + { + return append_sid("{$phpbb_root_path}index.$phpEx"); + } + + // Remove previously added sid + if (strpos($url, 'sid=') !== false) + { + // All kind of links + $url = preg_replace('/(\?)?(&|&)?sid=[a-z0-9]+/', '', $url); + // if the sid was the first param, make the old second as first ones + $url = preg_replace("/$phpEx(&|&)+?/", "$phpEx?", $url); + } + + return append_sid($url, false, true, false, $is_route); +} + +/** +* Returns url from the session/current page with an re-appended SID with optionally stripping vars from the url +*/ +function build_url($strip_vars = false) +{ + global $config, $user, $phpbb_path_helper; + + $page = $phpbb_path_helper->get_valid_page($user->page['page'], $config['enable_mod_rewrite']); + + // Append SID + $redirect = append_sid($page, false, false); + + if ($strip_vars !== false) + { + $redirect = $phpbb_path_helper->strip_url_params($redirect, $strip_vars, false); + } + else + { + $redirect = str_replace('&', '&', $redirect); + } + + return $redirect . ((strpos($redirect, '?') === false) ? '?' : ''); +} + +/** +* Meta refresh assignment +* Adds META template variable with meta http tag. +* +* @param int $time Time in seconds for meta refresh tag +* @param string $url URL to redirect to. The url will go through redirect() first before the template variable is assigned +* @param bool $disable_cd_check If true, meta_refresh() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. Default is false. +*/ +function meta_refresh($time, $url, $disable_cd_check = false) +{ + global $template, $refresh_data, $request; + + $url = redirect($url, true, $disable_cd_check); + if ($request->is_ajax()) + { + $refresh_data = array( + 'time' => $time, + 'url' => $url, + ); + } + else + { + // For XHTML compatibility we change back & to & + $url = str_replace('&', '&', $url); + + $template->assign_vars(array( + 'META' => '') + ); + } + + return $url; +} + +/** +* Outputs correct status line header. +* +* Depending on php sapi one of the two following forms is used: +* +* Status: 404 Not Found +* +* HTTP/1.x 404 Not Found +* +* HTTP version is taken from HTTP_VERSION environment variable, +* and defaults to 1.0. +* +* Sample usage: +* +* send_status_line(404, 'Not Found'); +* +* @param int $code HTTP status code +* @param string $message Message for the status code +* @return null +*/ +function send_status_line($code, $message) +{ + if (substr(strtolower(@php_sapi_name()), 0, 3) === 'cgi') + { + // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though + header("Status: $code $message", true, $code); + } + else + { + $version = phpbb_request_http_version(); + header("$version $code $message", true, $code); + } +} + +/** +* Returns the HTTP version used in the current request. +* +* Handles the case of being called before $request is present, +* in which case it falls back to the $_SERVER superglobal. +* +* @return string HTTP version +*/ +function phpbb_request_http_version() +{ + global $request; + + $version = ''; + if ($request && $request->server('SERVER_PROTOCOL')) + { + $version = $request->server('SERVER_PROTOCOL'); + } + else if (isset($_SERVER['SERVER_PROTOCOL'])) + { + $version = $_SERVER['SERVER_PROTOCOL']; + } + + if (!empty($version) && is_string($version) && preg_match('#^HTTP/[0-9]\.[0-9]$#', $version)) + { + return $version; + } + + return 'HTTP/1.0'; +} + +//Form validation + + +/** +* Add a secret hash for use in links/GET requests +* @param string $link_name The name of the link; has to match the name used in check_link_hash, otherwise no restrictions apply +* @return string the hash + +*/ +function generate_link_hash($link_name) +{ + global $user; + + if (!isset($user->data["hash_$link_name"])) + { + $user->data["hash_$link_name"] = substr(sha1($user->data['user_form_salt'] . $link_name), 0, 8); + } + + return $user->data["hash_$link_name"]; +} + + +/** +* checks a link hash - for GET requests +* @param string $token the submitted token +* @param string $link_name The name of the link +* @return boolean true if all is fine +*/ +function check_link_hash($token, $link_name) +{ + return $token === generate_link_hash($link_name); +} + +/** +* Add a secret token to the form (requires the S_FORM_TOKEN template variable) +* @param string $form_name The name of the form; has to match the name used in check_form_key, otherwise no restrictions apply +* @param string $template_variable_suffix A string that is appended to the name of the template variable to which the form elements are assigned +*/ +function add_form_key($form_name, $template_variable_suffix = '') +{ + global $config, $template, $user, $phpbb_dispatcher; + + $now = time(); + $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : ''; + $token = sha1($now . $user->data['user_form_salt'] . $form_name . $token_sid); + + $s_fields = build_hidden_fields(array( + 'creation_time' => $now, + 'form_token' => $token, + )); + + /** + * Perform additional actions on creation of the form token + * + * @event core.add_form_key + * @var string form_name The form name + * @var int now Current time timestamp + * @var string s_fields Generated hidden fields + * @var string token Form token + * @var string token_sid User session ID + * @var string template_variable_suffix The string that is appended to template variable name + * + * @since 3.1.0-RC3 + * @changed 3.1.11-RC1 Added template_variable_suffix + */ + $vars = array( + 'form_name', + 'now', + 's_fields', + 'token', + 'token_sid', + 'template_variable_suffix', + ); + extract($phpbb_dispatcher->trigger_event('core.add_form_key', compact($vars))); + + $template->assign_var('S_FORM_TOKEN' . $template_variable_suffix, $s_fields); +} + +/** + * Check the form key. Required for all altering actions not secured by confirm_box + * + * @param string $form_name The name of the form; has to match the name used + * in add_form_key, otherwise no restrictions apply + * @param int $timespan The maximum acceptable age for a submitted form + * in seconds. Defaults to the config setting. + * @return bool True, if the form key was valid, false otherwise + */ +function check_form_key($form_name, $timespan = false) +{ + global $config, $request, $user; + + if ($timespan === false) + { + // we enforce a minimum value of half a minute here. + $timespan = ($config['form_token_lifetime'] == -1) ? -1 : max(30, $config['form_token_lifetime']); + } + + if ($request->is_set_post('creation_time') && $request->is_set_post('form_token')) + { + $creation_time = abs($request->variable('creation_time', 0)); + $token = $request->variable('form_token', ''); + + $diff = time() - $creation_time; + + // If creation_time and the time() now is zero we can assume it was not a human doing this (the check for if ($diff)... + if (defined('DEBUG_TEST') || $diff && ($diff <= $timespan || $timespan === -1)) + { + $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : ''; + $key = sha1($creation_time . $user->data['user_form_salt'] . $form_name . $token_sid); + + if ($key === $token) + { + return true; + } + } + } + + return false; +} + +// Message/Login boxes + +/** +* Build Confirm box +* @param boolean $check True for checking if confirmed (without any additional parameters) and false for displaying the confirm box +* @param string|array $title Title/Message used for confirm box. +* message text is _CONFIRM appended to title. +* If title cannot be found in user->lang a default one is displayed +* If title_CONFIRM cannot be found in user->lang the text given is used. +* If title is an array, the first array value is used as explained per above, +* all other array values are sent as parameters to the language function. +* @param string $hidden Hidden variables +* @param string $html_body Template used for confirm box +* @param string $u_action Custom form action +* +* @return bool True if confirmation was successful, false if not +*/ +function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '') +{ + global $user, $template, $db, $request; + global $config, $language, $phpbb_path_helper, $phpbb_dispatcher; + + if (isset($_POST['cancel'])) + { + return false; + } + + $confirm = ($language->lang('YES') === $request->variable('confirm', '', true, \phpbb\request\request_interface::POST)); + + if ($check && $confirm) + { + $user_id = $request->variable('confirm_uid', 0); + $session_id = $request->variable('sess', ''); + $confirm_key = $request->variable('confirm_key', ''); + + if ($user_id != $user->data['user_id'] || $session_id != $user->session_id || !$confirm_key || !$user->data['user_last_confirm_key'] || $confirm_key != $user->data['user_last_confirm_key']) + { + return false; + } + + // Reset user_last_confirm_key + $sql = 'UPDATE ' . USERS_TABLE . " SET user_last_confirm_key = '' + WHERE user_id = " . $user->data['user_id']; + $db->sql_query($sql); + + return true; + } + else if ($check) + { + return false; + } + + $s_hidden_fields = build_hidden_fields(array( + 'confirm_uid' => $user->data['user_id'], + 'sess' => $user->session_id, + 'sid' => $user->session_id, + )); + + // generate activation key + $confirm_key = gen_rand_string(10); + + // generate language strings + if (is_array($title)) + { + $key = array_shift($title); + $count = array_shift($title); + $confirm_title = $language->is_set($key) ? $language->lang($key, $count, $title) : $language->lang('CONFIRM'); + $confirm_text = $language->is_set($key . '_CONFIRM') ? $language->lang($key . '_CONFIRM', $count, $title) : $key; + } + else + { + $confirm_title = $language->is_set($title) ? $language->lang($title) : $language->lang('CONFIRM'); + $confirm_text = $language->is_set($title . '_CONFIRM') ? $language->lang($title . '_CONFIRM') : $title; + } + + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_header($confirm_title); + } + else + { + page_header($confirm_title); + } + + $template->set_filenames(array( + 'body' => $html_body) + ); + + // If activation key already exist, we better do not re-use the key (something very strange is going on...) + if ($request->variable('confirm_key', '')) + { + // This should not occur, therefore we cancel the operation to safe the user + return false; + } + + // re-add sid / transform & to & for user->page (user->page is always using &) + $use_page = ($u_action) ? $u_action : str_replace('&', '&', $user->page['page']); + $u_action = reapply_sid($phpbb_path_helper->get_valid_page($use_page, $config['enable_mod_rewrite'])); + $u_action .= ((strpos($u_action, '?') === false) ? '?' : '&') . 'confirm_key=' . $confirm_key; + + $template->assign_vars(array( + 'MESSAGE_TITLE' => $confirm_title, + 'MESSAGE_TEXT' => $confirm_text, + + 'YES_VALUE' => $language->lang('YES'), + 'S_CONFIRM_ACTION' => $u_action, + 'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields, + 'S_AJAX_REQUEST' => $request->is_ajax(), + )); + + $sql = 'UPDATE ' . USERS_TABLE . " SET user_last_confirm_key = '" . $db->sql_escape($confirm_key) . "' + WHERE user_id = " . $user->data['user_id']; + $db->sql_query($sql); + + if ($request->is_ajax()) + { + $u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id; + $data = array( + 'MESSAGE_BODY' => $template->assign_display('body'), + 'MESSAGE_TITLE' => $confirm_title, + 'MESSAGE_TEXT' => $confirm_text, + + 'YES_VALUE' => $language->lang('YES'), + 'S_CONFIRM_ACTION' => str_replace('&', '&', $u_action), //inefficient, rewrite whole function + 'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields + ); + + /** + * This event allows an extension to modify the ajax output of confirm box. + * + * @event core.confirm_box_ajax_before + * @var string u_action Action of the form + * @var array data Data to be sent + * @var string hidden Hidden fields generated by caller + * @var string s_hidden_fields Hidden fields generated by this function + * @since 3.2.8-RC1 + */ + $vars = array( + 'u_action', + 'data', + 'hidden', + 's_hidden_fields', + ); + extract($phpbb_dispatcher->trigger_event('core.confirm_box_ajax_before', compact($vars))); + + $json_response = new \phpbb\json_response; + $json_response->send($data); + } + + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_footer(); + } + else + { + page_footer(); + } + + exit; // unreachable, page_footer() above will call exit() +} + +/** +* Generate login box or verify password +*/ +function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true) +{ + global $user, $template, $auth, $phpEx, $phpbb_root_path, $config; + global $request, $phpbb_container, $phpbb_dispatcher, $phpbb_log; + + $err = ''; + $form_name = 'login'; + $username = $autologin = false; + + // Make sure user->setup() has been called + if (!$user->is_setup()) + { + $user->setup(); + } + + /** + * This event allows an extension to modify the login process + * + * @event core.login_box_before + * @var string redirect Redirect string + * @var string l_explain Explain language string + * @var string l_success Success language string + * @var bool admin Is admin? + * @var bool s_display Display full login form? + * @var string err Error string + * @since 3.1.9-RC1 + */ + $vars = array('redirect', 'l_explain', 'l_success', 'admin', 's_display', 'err'); + extract($phpbb_dispatcher->trigger_event('core.login_box_before', compact($vars))); + + // Print out error if user tries to authenticate as an administrator without having the privileges... + if ($admin && !$auth->acl_get('a_')) + { + // Not authd + // anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions + if ($user->data['is_registered']) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); + } + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_ADMIN'); + } + + if (empty($err) && ($request->is_set_post('login') || ($request->is_set('login') && $request->variable('login', '') == 'external'))) + { + // Get credential + if ($admin) + { + $credential = $request->variable('credential', ''); + + if (strspn($credential, 'abcdef0123456789') !== strlen($credential) || strlen($credential) != 32) + { + if ($user->data['is_registered']) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); + } + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_ADMIN'); + } + + $password = $request->untrimmed_variable('password_' . $credential, '', true); + } + else + { + $password = $request->untrimmed_variable('password', '', true); + } + + $username = $request->variable('username', '', true); + $autologin = $request->is_set_post('autologin'); + $viewonline = (int) !$request->is_set_post('viewonline'); + $admin = ($admin) ? 1 : 0; + $viewonline = ($admin) ? $user->data['session_viewonline'] : $viewonline; + + // Check if the supplied username is equal to the one stored within the database if re-authenticating + if ($admin && utf8_clean_string($username) != utf8_clean_string($user->data['username'])) + { + // We log the attempt to use a different username... + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); + + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_ADMIN_USER_DIFFER'); + } + + // Check form key + if ($password && !defined('IN_CHECK_BAN') && !check_form_key($form_name)) + { + $result = array( + 'status' => false, + 'error_msg' => 'FORM_INVALID', + ); + } + else + { + // If authentication is successful we redirect user to previous page + $result = $auth->login($username, $password, $autologin, $viewonline, $admin); + } + + // If admin authentication and login, we will log if it was a success or not... + // We also break the operation on the first non-success login - it could be argued that the user already knows + if ($admin) + { + if ($result['status'] == LOGIN_SUCCESS) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_SUCCESS'); + } + else + { + // Only log the failed attempt if a real user tried to. + // anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions + if ($user->data['is_registered']) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); + } + } + } + + // The result parameter is always an array, holding the relevant information... + if ($result['status'] == LOGIN_SUCCESS) + { + $redirect = $request->variable('redirect', "{$phpbb_root_path}index.$phpEx"); + + /** + * This event allows an extension to modify the redirection when a user successfully logs in + * + * @event core.login_box_redirect + * @var string redirect Redirect string + * @var bool admin Is admin? + * @var array result Result from auth provider + * @since 3.1.0-RC5 + * @changed 3.1.9-RC1 Removed undefined return variable + * @changed 3.2.4-RC1 Added result + */ + $vars = array('redirect', 'admin', 'result'); + extract($phpbb_dispatcher->trigger_event('core.login_box_redirect', compact($vars))); + + // append/replace SID (may change during the session for AOL users) + $redirect = reapply_sid($redirect); + + // Special case... the user is effectively banned, but we allow founders to login + if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER) + { + return; + } + + redirect($redirect); + } + + // Something failed, determine what... + if ($result['status'] == LOGIN_BREAK) + { + trigger_error($result['error_msg']); + } + + // Special cases... determine + switch ($result['status']) + { + case LOGIN_ERROR_PASSWORD_CONVERT: + $err = sprintf( + $user->lang[$result['error_msg']], + ($config['email_enable']) ? '' : '', + ($config['email_enable']) ? '' : '', + '', + '' + ); + break; + + case LOGIN_ERROR_ATTEMPTS: + + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_LOGIN); + // $captcha->reset(); + + $template->assign_vars(array( + 'CAPTCHA_TEMPLATE' => $captcha->get_template(), + )); + // no break; + + // Username, password, etc... + default: + $err = $user->lang[$result['error_msg']]; + + // Assign admin contact to some error messages + if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD') + { + $err = sprintf($user->lang[$result['error_msg']], '', ''); + } + + break; + } + + /** + * This event allows an extension to process when a user fails a login attempt + * + * @event core.login_box_failed + * @var array result Login result data + * @var string username User name used to login + * @var string password Password used to login + * @var string err Error message + * @since 3.1.3-RC1 + */ + $vars = array('result', 'username', 'password', 'err'); + extract($phpbb_dispatcher->trigger_event('core.login_box_failed', compact($vars))); + } + + // Assign credential for username/password pair + $credential = ($admin) ? md5(unique_id()) : false; + + $s_hidden_fields = array( + 'sid' => $user->session_id, + ); + + if ($redirect) + { + $s_hidden_fields['redirect'] = $redirect; + } + + if ($admin) + { + $s_hidden_fields['credential'] = $credential; + } + + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_provider = $provider_collection->get_provider(); + + $auth_provider_data = $auth_provider->get_login_data(); + if ($auth_provider_data) + { + if (isset($auth_provider_data['VARS'])) + { + $template->assign_vars($auth_provider_data['VARS']); + } + + if (isset($auth_provider_data['BLOCK_VAR_NAME'])) + { + foreach ($auth_provider_data['BLOCK_VARS'] as $block_vars) + { + $template->assign_block_vars($auth_provider_data['BLOCK_VAR_NAME'], $block_vars); + } + } + + $template->assign_vars(array( + 'PROVIDER_TEMPLATE_FILE' => $auth_provider_data['TEMPLATE_FILE'], + )); + } + + $s_hidden_fields = build_hidden_fields($s_hidden_fields); + + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + + $login_box_template_data = array( + 'LOGIN_ERROR' => $err, + 'LOGIN_EXPLAIN' => $l_explain, + + 'U_SEND_PASSWORD' => ($config['email_enable']) ? $controller_helper->route('phpbb_ucp_forgot_password_controller') : '', + 'U_RESEND_ACTIVATION' => ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '', + 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), + 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), + 'UA_PRIVACY' => addslashes(append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy')), + + 'S_DISPLAY_FULL_LOGIN' => ($s_display) ? true : false, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + + 'S_ADMIN_AUTH' => $admin, + 'USERNAME' => ($admin) ? $user->data['username'] : '', + + 'USERNAME_CREDENTIAL' => 'username', + 'PASSWORD_CREDENTIAL' => ($admin) ? 'password_' . $credential : 'password', + ); + + /** + * Event to add/modify login box template data + * + * @event core.login_box_modify_template_data + * @var int admin Flag whether user is admin + * @var string username User name + * @var int autologin Flag whether autologin is enabled + * @var string redirect Redirect URL + * @var array login_box_template_data Array with the login box template data + * @since 3.2.3-RC2 + */ + $vars = array( + 'admin', + 'username', + 'autologin', + 'redirect', + 'login_box_template_data', + ); + extract($phpbb_dispatcher->trigger_event('core.login_box_modify_template_data', compact($vars))); + + $template->assign_vars($login_box_template_data); + + page_header($user->lang['LOGIN']); + + $template->set_filenames(array( + 'body' => 'login_body.html') + ); + make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + + page_footer(); +} + +/** +* Generate forum login box +*/ +function login_forum_box($forum_data) +{ + global $db, $phpbb_container, $request, $template, $user, $phpbb_dispatcher, $phpbb_root_path, $phpEx; + + $password = $request->variable('password', '', true); + + $sql = 'SELECT forum_id + FROM ' . FORUMS_ACCESS_TABLE . ' + WHERE forum_id = ' . $forum_data['forum_id'] . ' + AND user_id = ' . $user->data['user_id'] . " + AND session_id = '" . $db->sql_escape($user->session_id) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return true; + } + + if ($password) + { + // Remove expired authorised sessions + $sql = 'SELECT f.session_id + FROM ' . FORUMS_ACCESS_TABLE . ' f + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (f.session_id = s.session_id) + WHERE s.session_id IS NULL'; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $sql_in = array(); + do + { + $sql_in[] = (string) $row['session_id']; + } + while ($row = $db->sql_fetchrow($result)); + + // Remove expired sessions + $sql = 'DELETE FROM ' . FORUMS_ACCESS_TABLE . ' + WHERE ' . $db->sql_in_set('session_id', $sql_in); + $db->sql_query($sql); + } + $db->sql_freeresult($result); + + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + + if ($passwords_manager->check($password, $forum_data['forum_password'])) + { + $sql_ary = array( + 'forum_id' => (int) $forum_data['forum_id'], + 'user_id' => (int) $user->data['user_id'], + 'session_id' => (string) $user->session_id, + ); + + $db->sql_query('INSERT INTO ' . FORUMS_ACCESS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + return true; + } + + $template->assign_var('LOGIN_ERROR', $user->lang['WRONG_PASSWORD']); + } + + /** + * Performing additional actions, load additional data on forum login + * + * @event core.login_forum_box + * @var array forum_data Array with forum data + * @var string password Password entered + * @since 3.1.0-RC3 + */ + $vars = array('forum_data', 'password'); + extract($phpbb_dispatcher->trigger_event('core.login_forum_box', compact($vars))); + + page_header($user->lang['LOGIN']); + + $template->assign_vars(array( + 'FORUM_NAME' => isset($forum_data['forum_name']) ? $forum_data['forum_name'] : '', + 'S_LOGIN_ACTION' => build_url(array('f')), + 'S_HIDDEN_FIELDS' => build_hidden_fields(array('f' => $forum_data['forum_id']))) + ); + + $template->set_filenames(array( + 'body' => 'login_forum.html') + ); + + make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_data['forum_id']); + + page_footer(); +} + +// Little helpers + +/** +* Little helper for the build_hidden_fields function +*/ +function _build_hidden_fields($key, $value, $specialchar, $stripslashes) +{ + $hidden_fields = ''; + + if (!is_array($value)) + { + $value = ($stripslashes) ? stripslashes($value) : $value; + $value = ($specialchar) ? htmlspecialchars($value, ENT_COMPAT, 'UTF-8') : $value; + + $hidden_fields .= '' . "\n"; + } + else + { + foreach ($value as $_key => $_value) + { + $_key = ($stripslashes) ? stripslashes($_key) : $_key; + $_key = ($specialchar) ? htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') : $_key; + + $hidden_fields .= _build_hidden_fields($key . '[' . $_key . ']', $_value, $specialchar, $stripslashes); + } + } + + return $hidden_fields; +} + +/** +* Build simple hidden fields from array +* +* @param array $field_ary an array of values to build the hidden field from +* @param bool $specialchar if true, keys and values get specialchared +* @param bool $stripslashes if true, keys and values get stripslashed +* +* @return string the hidden fields +*/ +function build_hidden_fields($field_ary, $specialchar = false, $stripslashes = false) +{ + $s_hidden_fields = ''; + + foreach ($field_ary as $name => $vars) + { + $name = ($stripslashes) ? stripslashes($name) : $name; + $name = ($specialchar) ? htmlspecialchars($name, ENT_COMPAT, 'UTF-8') : $name; + + $s_hidden_fields .= _build_hidden_fields($name, $vars, $specialchar, $stripslashes); + } + + return $s_hidden_fields; +} + +/** +* Parse cfg file +*/ +function parse_cfg_file($filename, $lines = false) +{ + $parsed_items = array(); + + if ($lines === false) + { + $lines = file($filename); + } + + foreach ($lines as $line) + { + $line = trim($line); + + if (!$line || $line[0] == '#' || ($delim_pos = strpos($line, '=')) === false) + { + continue; + } + + // Determine first occurrence, since in values the equal sign is allowed + $key = htmlspecialchars(strtolower(trim(substr($line, 0, $delim_pos)))); + $value = trim(substr($line, $delim_pos + 1)); + + if (in_array($value, array('off', 'false', '0'))) + { + $value = false; + } + else if (in_array($value, array('on', 'true', '1'))) + { + $value = true; + } + else if (!trim($value)) + { + $value = ''; + } + else if (($value[0] == "'" && $value[strlen($value) - 1] == "'") || ($value[0] == '"' && $value[strlen($value) - 1] == '"')) + { + $value = htmlspecialchars(substr($value, 1, strlen($value)-2)); + } + else + { + $value = htmlspecialchars($value); + } + + $parsed_items[$key] = $value; + } + + if (isset($parsed_items['parent']) && isset($parsed_items['name']) && $parsed_items['parent'] == $parsed_items['name']) + { + unset($parsed_items['parent']); + } + + return $parsed_items; +} + +/** +* Return a nicely formatted backtrace. +* +* Turns the array returned by debug_backtrace() into HTML markup. +* Also filters out absolute paths to phpBB root. +* +* @return string HTML markup +*/ +function get_backtrace() +{ + $output = '
'; + $backtrace = debug_backtrace(); + + // We skip the first one, because it only shows this file/function + unset($backtrace[0]); + + foreach ($backtrace as $trace) + { + // Strip the current directory from path + $trace['file'] = (empty($trace['file'])) ? '(not given by php)' : htmlspecialchars(phpbb_filter_root_path($trace['file'])); + $trace['line'] = (empty($trace['line'])) ? '(not given by php)' : $trace['line']; + + // Only show function arguments for include etc. + // Other parameters may contain sensible information + $argument = ''; + if (!empty($trace['args'][0]) && in_array($trace['function'], array('include', 'require', 'include_once', 'require_once'))) + { + $argument = htmlspecialchars(phpbb_filter_root_path($trace['args'][0])); + } + + $trace['class'] = (!isset($trace['class'])) ? '' : $trace['class']; + $trace['type'] = (!isset($trace['type'])) ? '' : $trace['type']; + + $output .= '
'; + $output .= 'FILE: ' . $trace['file'] . '
'; + $output .= 'LINE: ' . ((!empty($trace['line'])) ? $trace['line'] : '') . '
'; + + $output .= 'CALL: ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function']); + $output .= '(' . (($argument !== '') ? "'$argument'" : '') . ')
'; + } + $output .= '
'; + return $output; +} + +/** +* This function returns a regular expression pattern for commonly used expressions +* Use with / as delimiter for email mode and # for url modes +* mode can be: email|bbcode_htm|url|url_inline|www_url|www_url_inline|relative_url|relative_url_inline|ipv4|ipv6 +*/ +function get_preg_expression($mode) +{ + switch ($mode) + { + case 'email': + // Regex written by James Watts and Francisco Jose Martin Moreno + // http://fightingforalostcause.net/misc/2006/compare-email-regex.php + return '((?:[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%\'\*\+\-\/\=\?\^\`{\|\}\~]|&)+)@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,63})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)'; + break; + + case 'bbcode_htm': + return array( + '#.*?#', + '#.*?#', + '#\2#', + '#.*?#', + '#(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?(?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:0|[1-9](?:(?:0|[1-9])+)*))(?:[.](?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:0|[1-9](?:(?:0|[1-9])+)*)))*))?(?:[+](?(?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:(?:0|[1-9])+))(?:[.](?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:(?:0|[1-9])+)))*))?)$/'; + break; + } + + return ''; +} + +/** +* Generate regexp for naughty words censoring +* Depends on whether installed PHP version supports unicode properties +* +* @param string $word word template to be replaced +* +* @return string $preg_expr regex to use with word censor +*/ +function get_censor_preg_expression($word) +{ + // Unescape the asterisk to simplify further conversions + $word = str_replace('\*', '*', preg_quote($word, '#')); + + // Replace asterisk(s) inside the pattern, at the start and at the end of it with regexes + $word = preg_replace(array('#(?<=[\p{Nd}\p{L}_])\*+(?=[\p{Nd}\p{L}_])#iu', '#^\*+#', '#\*+$#'), array('([\x20]*?|[\p{Nd}\p{L}_-]*?)', '[\p{Nd}\p{L}_-]*?', '[\p{Nd}\p{L}_-]*?'), $word); + + // Generate the final substitution + $preg_expr = '#(?getParameter('debug.show_errors') ? E_ALL : error_reporting())) == 0) + { + return; + } + + if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) + { + $errfile = phpbb_filter_root_path($errfile); + $msg_text = phpbb_filter_root_path($msg_text); + $error_name = ($errno === E_WARNING) ? 'PHP Warning' : 'PHP Notice'; + echo '[phpBB Debug] ' . $error_name . ': in file ' . $errfile . ' on line ' . $errline . ': ' . $msg_text . '
' . "\n"; + + // we are writing an image - the user won't see the debug, so let's place it in the log + if (defined('IMAGE_OUTPUT') || defined('IN_CRON')) + { + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_IMAGE_GENERATION_ERROR', false, array($errfile, $errline, $msg_text)); + } + // echo '

BACKTRACE
' . get_backtrace() . '
' . "\n"; + } + + return; + + break; + + case E_USER_ERROR: + + if (!empty($user) && $user->is_setup()) + { + $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; + $msg_title = (!isset($msg_title)) ? $user->lang['GENERAL_ERROR'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title); + + $l_return_index = sprintf($user->lang['RETURN_INDEX'], '', ''); + $l_notify = ''; + + if (!empty($config['board_contact'])) + { + $l_notify = '

' . sprintf($user->lang['NOTIFY_ADMIN_EMAIL'], $config['board_contact']) . '

'; + } + } + else + { + $msg_title = 'General Error'; + $l_return_index = 'Return to index page'; + $l_notify = ''; + + if (!empty($config['board_contact'])) + { + $l_notify = '

Please notify the board administrator or webmaster: ' . $config['board_contact'] . '

'; + } + } + + $log_text = $msg_text; + $backtrace = get_backtrace(); + if ($backtrace) + { + $log_text .= '

BACKTRACE
' . $backtrace; + } + + if (defined('IN_INSTALL') || ($phpbb_container != null && $phpbb_container->getParameter('debug.show_errors')) || isset($auth) && $auth->acl_get('a_')) + { + $msg_text = $log_text; + + // If this is defined there already was some output + // So let's not break it + if (defined('IN_DB_UPDATE')) + { + echo '
' . $msg_text . '
'; + + $db->sql_return_on_error(true); + phpbb_end_update($cache, $config); + } + } + + if ((defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) + { + // let's avoid loops + $db->sql_return_on_error(true); + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_GENERAL_ERROR', false, array($msg_title, $log_text)); + $db->sql_return_on_error(false); + } + + // Do not send 200 OK, but service unavailable on errors + send_status_line(503, 'Service Unavailable'); + + garbage_collection(); + + // Try to not call the adm page data... + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '' . $msg_title . ''; + echo ''; + echo ''; + echo ''; + echo '
'; + echo ' '; + echo '
'; + echo '
'; + echo '
'; + echo '

' . $msg_title . '

'; + + echo '
' . $msg_text . '
'; + + echo $l_notify; + + echo '
'; + echo '
'; + echo '
'; + echo ' '; + echo '
'; + echo ''; + echo ''; + + exit_handler(); + + // On a fatal error (and E_USER_ERROR *is* fatal) we never want other scripts to continue and force an exit here. + exit; + break; + + case E_USER_WARNING: + case E_USER_NOTICE: + + define('IN_ERROR_HANDLER', true); + + if (empty($user->data)) + { + $user->session_begin(); + } + + // We re-init the auth array to get correct results on login/logout + $auth->acl($user->data); + + if (!$user->is_setup()) + { + $user->setup(); + } + + if ($msg_text == 'ERROR_NO_ATTACHMENT' || $msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') + { + send_status_line(404, 'Not Found'); + } + + $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; + $msg_title = (!isset($msg_title)) ? $user->lang['INFORMATION'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title); + + if (!defined('HEADER_INC')) + { + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_header($msg_title); + } + else + { + page_header($msg_title); + } + } + + $template->set_filenames(array( + 'body' => 'message_body.html') + ); + + $template->assign_vars(array( + 'MESSAGE_TITLE' => $msg_title, + 'MESSAGE_TEXT' => $msg_text, + 'S_USER_WARNING' => ($errno == E_USER_WARNING) ? true : false, + 'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false) + ); + + if ($request->is_ajax()) + { + global $refresh_data; + + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $msg_title, + 'MESSAGE_TEXT' => $msg_text, + 'S_USER_WARNING' => ($errno == E_USER_WARNING) ? true : false, + 'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false, + 'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null + )); + } + + // We do not want the cron script to be called on error messages + define('IN_CRON', true); + + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_footer(); + } + else + { + page_footer(); + } + + exit_handler(); + break; + + // PHP4 compatibility + case E_DEPRECATED: + return true; + break; + } + + // If we notice an error not handled here we pass this back to PHP by returning false + // This may not work for all php versions + return false; +} + +/** +* Removes absolute path to phpBB root directory from error messages +* and converts backslashes to forward slashes. +* +* @param string $errfile Absolute file path +* (e.g. /var/www/phpbb3/phpBB/includes/functions.php) +* Please note that if $errfile is outside of the phpBB root, +* the root path will not be found and can not be filtered. +* @return string Relative file path +* (e.g. /includes/functions.php) +*/ +function phpbb_filter_root_path($errfile) +{ + global $phpbb_filesystem; + + static $root_path; + + if (empty($root_path)) + { + if ($phpbb_filesystem) + { + $root_path = $phpbb_filesystem->realpath(dirname(__FILE__) . '/../'); + } + else + { + $filesystem = new \phpbb\filesystem\filesystem(); + $root_path = $filesystem->realpath(dirname(__FILE__) . '/../'); + } + } + + return str_replace(array($root_path, '\\'), array('[ROOT]', '/'), $errfile); +} + +/** +* Queries the session table to get information about online guests +* @param int $item_id Limits the search to the item with this id +* @param string $item The name of the item which is stored in the session table as session_{$item}_id +* @return int The number of active distinct guest sessions +*/ +function obtain_guest_count($item_id = 0, $item = 'forum') +{ + global $db, $config; + + if ($item_id) + { + $reading_sql = ' AND s.session_' . $item . '_id = ' . (int) $item_id; + } + else + { + $reading_sql = ''; + } + $time = (time() - (intval($config['load_online_time']) * 60)); + + // Get number of online guests + + if ($db->get_sql_layer() === 'sqlite3') + { + $sql = 'SELECT COUNT(session_ip) as num_guests + FROM ( + SELECT DISTINCT s.session_ip + FROM ' . SESSIONS_TABLE . ' s + WHERE s.session_user_id = ' . ANONYMOUS . ' + AND s.session_time >= ' . ($time - ((int) ($time % 60))) . + $reading_sql . + ')'; + } + else + { + $sql = 'SELECT COUNT(DISTINCT s.session_ip) as num_guests + FROM ' . SESSIONS_TABLE . ' s + WHERE s.session_user_id = ' . ANONYMOUS . ' + AND s.session_time >= ' . ($time - ((int) ($time % 60))) . + $reading_sql; + } + $result = $db->sql_query($sql); + $guests_online = (int) $db->sql_fetchfield('num_guests'); + $db->sql_freeresult($result); + + return $guests_online; +} + +/** +* Queries the session table to get information about online users +* @param int $item_id Limits the search to the item with this id +* @param string $item The name of the item which is stored in the session table as session_{$item}_id +* @return array An array containing the ids of online, hidden and visible users, as well as statistical info +*/ +function obtain_users_online($item_id = 0, $item = 'forum') +{ + global $db, $config; + + $reading_sql = ''; + if ($item_id !== 0) + { + $reading_sql = ' AND s.session_' . $item . '_id = ' . (int) $item_id; + } + + $online_users = array( + 'online_users' => array(), + 'hidden_users' => array(), + 'total_online' => 0, + 'visible_online' => 0, + 'hidden_online' => 0, + 'guests_online' => 0, + ); + + if ($config['load_online_guests']) + { + $online_users['guests_online'] = obtain_guest_count($item_id, $item); + } + + // a little discrete magic to cache this for 30 seconds + $time = (time() - (intval($config['load_online_time']) * 60)); + + $sql = 'SELECT s.session_user_id, s.session_ip, s.session_viewonline + FROM ' . SESSIONS_TABLE . ' s + WHERE s.session_time >= ' . ($time - ((int) ($time % 30))) . + $reading_sql . + ' AND s.session_user_id <> ' . ANONYMOUS; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + // Skip multiple sessions for one user + if (!isset($online_users['online_users'][$row['session_user_id']])) + { + $online_users['online_users'][$row['session_user_id']] = (int) $row['session_user_id']; + if ($row['session_viewonline']) + { + $online_users['visible_online']++; + } + else + { + $online_users['hidden_users'][$row['session_user_id']] = (int) $row['session_user_id']; + $online_users['hidden_online']++; + } + } + } + $online_users['total_online'] = $online_users['guests_online'] + $online_users['visible_online'] + $online_users['hidden_online']; + $db->sql_freeresult($result); + + return $online_users; +} + +/** +* Uses the result of obtain_users_online to generate a localized, readable representation. +* @param mixed $online_users result of obtain_users_online - array with user_id lists for total, hidden and visible users, and statistics +* @param int $item_id Indicate that the data is limited to one item and not global +* @param string $item The name of the item which is stored in the session table as session_{$item}_id +* @return array An array containing the string for output to the template +*/ +function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum') +{ + global $config, $db, $user, $auth, $phpbb_dispatcher; + + $user_online_link = $rowset = array(); + // Need caps version of $item for language-strings + $item_caps = strtoupper($item); + + if (count($online_users['online_users'])) + { + $sql_ary = array( + 'SELECT' => 'u.username, u.username_clean, u.user_id, u.user_type, u.user_allow_viewonline, u.user_colour', + 'FROM' => array( + USERS_TABLE => 'u', + ), + 'WHERE' => $db->sql_in_set('u.user_id', $online_users['online_users']), + 'ORDER_BY' => 'u.username_clean ASC', + ); + + /** + * Modify SQL query to obtain online users data + * + * @event core.obtain_users_online_string_sql + * @var array online_users Array with online users data + * from obtain_users_online() + * @var int item_id Restrict online users to item id + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var array sql_ary SQL query array to obtain users online data + * @since 3.1.4-RC1 + * @changed 3.1.7-RC1 Change sql query into array and adjust var accordingly. Allows extension authors the ability to adjust the sql_ary. + */ + $vars = array('online_users', 'item_id', 'item', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + $rowset = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + foreach ($rowset as $row) + { + // User is logged in and therefore not a guest + if ($row['user_id'] != ANONYMOUS) + { + if (isset($online_users['hidden_users'][$row['user_id']])) + { + $row['username'] = '' . $row['username'] . ''; + } + + if (!isset($online_users['hidden_users'][$row['user_id']]) || $auth->acl_get('u_viewonline') || $row['user_id'] === $user->data['user_id']) + { + $user_online_link[$row['user_id']] = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']); + } + } + } + } + + /** + * Modify online userlist data + * + * @event core.obtain_users_online_string_before_modify + * @var array online_users Array with online users data + * from obtain_users_online() + * @var int item_id Restrict online users to item id + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var array rowset Array with online users data + * @var array user_online_link Array with online users items (usernames) + * @since 3.1.10-RC1 + */ + $vars = array( + 'online_users', + 'item_id', + 'item', + 'rowset', + 'user_online_link', + ); + extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_before_modify', compact($vars))); + + $online_userlist = implode(', ', $user_online_link); + + if (!$online_userlist) + { + $online_userlist = $user->lang['NO_ONLINE_USERS']; + } + + if ($item_id === 0) + { + $online_userlist = $user->lang['REGISTERED_USERS'] . ' ' . $online_userlist; + } + else if ($config['load_online_guests']) + { + $online_userlist = $user->lang('BROWSING_' . $item_caps . '_GUESTS', $online_users['guests_online'], $online_userlist); + } + else + { + $online_userlist = sprintf($user->lang['BROWSING_' . $item_caps], $online_userlist); + } + // Build online listing + $visible_online = $user->lang('REG_USERS_TOTAL', (int) $online_users['visible_online']); + $hidden_online = $user->lang('HIDDEN_USERS_TOTAL', (int) $online_users['hidden_online']); + + if ($config['load_online_guests']) + { + $guests_online = $user->lang('GUEST_USERS_TOTAL', (int) $online_users['guests_online']); + $l_online_users = $user->lang('ONLINE_USERS_TOTAL_GUESTS', (int) $online_users['total_online'], $visible_online, $hidden_online, $guests_online); + } + else + { + $l_online_users = $user->lang('ONLINE_USERS_TOTAL', (int) $online_users['total_online'], $visible_online, $hidden_online); + } + + /** + * Modify online userlist data + * + * @event core.obtain_users_online_string_modify + * @var array online_users Array with online users data + * from obtain_users_online() + * @var int item_id Restrict online users to item id + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var array rowset Array with online users data + * @var array user_online_link Array with online users items (usernames) + * @var string online_userlist String containing users online list + * @var string l_online_users String with total online users count info + * @since 3.1.4-RC1 + */ + $vars = array( + 'online_users', + 'item_id', + 'item', + 'rowset', + 'user_online_link', + 'online_userlist', + 'l_online_users', + ); + extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_modify', compact($vars))); + + return array( + 'online_userlist' => $online_userlist, + 'l_online_users' => $l_online_users, + ); +} + +/** +* Get option bitfield from custom data +* +* @param int $bit The bit/value to get +* @param int $data Current bitfield to check +* @return bool Returns true if value of constant is set in bitfield, else false +*/ +function phpbb_optionget($bit, $data) +{ + return ($data & 1 << (int) $bit) ? true : false; +} + +/** +* Set option bitfield +* +* @param int $bit The bit/value to set/unset +* @param bool $set True if option should be set, false if option should be unset. +* @param int $data Current bitfield to change +* +* @return int The new bitfield +*/ +function phpbb_optionset($bit, $set, $data) +{ + if ($set && !($data & 1 << $bit)) + { + $data += 1 << $bit; + } + else if (!$set && ($data & 1 << $bit)) + { + $data -= 1 << $bit; + } + + return $data; +} + +/** +* Login using http authenticate. +* +* @param array $param Parameter array, see $param_defaults array. +* +* @return null +*/ +function phpbb_http_login($param) +{ + global $auth, $user, $request; + global $config; + + $param_defaults = array( + 'auth_message' => '', + + 'autologin' => false, + 'viewonline' => true, + 'admin' => false, + ); + + // Overwrite default values with passed values + $param = array_merge($param_defaults, $param); + + // User is already logged in + // We will not overwrite his session + if (!empty($user->data['is_registered'])) + { + return; + } + + // $_SERVER keys to check + $username_keys = array( + 'PHP_AUTH_USER', + 'Authorization', + 'REMOTE_USER', 'REDIRECT_REMOTE_USER', + 'HTTP_AUTHORIZATION', 'REDIRECT_HTTP_AUTHORIZATION', + 'REMOTE_AUTHORIZATION', 'REDIRECT_REMOTE_AUTHORIZATION', + 'AUTH_USER', + ); + + $password_keys = array( + 'PHP_AUTH_PW', + 'REMOTE_PASSWORD', + 'AUTH_PASSWORD', + ); + + $username = null; + foreach ($username_keys as $k) + { + if ($request->is_set($k, \phpbb\request\request_interface::SERVER)) + { + $username = htmlspecialchars_decode($request->server($k)); + break; + } + } + + $password = null; + foreach ($password_keys as $k) + { + if ($request->is_set($k, \phpbb\request\request_interface::SERVER)) + { + $password = htmlspecialchars_decode($request->server($k)); + break; + } + } + + // Decode encoded information (IIS, CGI, FastCGI etc.) + if (!is_null($username) && is_null($password) && strpos($username, 'Basic ') === 0) + { + list($username, $password) = explode(':', base64_decode(substr($username, 6)), 2); + } + + if (!is_null($username) && !is_null($password)) + { + set_var($username, $username, 'string', true); + set_var($password, $password, 'string', true); + + $auth_result = $auth->login($username, $password, $param['autologin'], $param['viewonline'], $param['admin']); + + if ($auth_result['status'] == LOGIN_SUCCESS) + { + return; + } + else if ($auth_result['status'] == LOGIN_ERROR_ATTEMPTS) + { + send_status_line(401, 'Unauthorized'); + + trigger_error('NOT_AUTHORISED'); + } + } + + // Prepend sitename to auth_message + $param['auth_message'] = ($param['auth_message'] === '') ? $config['sitename'] : $config['sitename'] . ' - ' . $param['auth_message']; + + // We should probably filter out non-ASCII characters - RFC2616 + $param['auth_message'] = preg_replace('/[\x80-\xFF]/', '?', $param['auth_message']); + + header('WWW-Authenticate: Basic realm="' . $param['auth_message'] . '"'); + send_status_line(401, 'Unauthorized'); + + trigger_error('NOT_AUTHORISED'); +} + +/** +* Escapes and quotes a string for use as an HTML/XML attribute value. +* +* This is a port of Python xml.sax.saxutils quoteattr. +* +* The function will attempt to choose a quote character in such a way as to +* avoid escaping quotes in the string. If this is not possible the string will +* be wrapped in double quotes and double quotes will be escaped. +* +* @param string $data The string to be escaped +* @param array $entities Associative array of additional entities to be escaped +* @return string Escaped and quoted string +*/ +function phpbb_quoteattr($data, $entities = null) +{ + $data = str_replace('&', '&', $data); + $data = str_replace('>', '>', $data); + $data = str_replace('<', '<', $data); + + $data = str_replace("\n", ' ', $data); + $data = str_replace("\r", ' ', $data); + $data = str_replace("\t", ' ', $data); + + if (!empty($entities)) + { + $data = str_replace(array_keys($entities), array_values($entities), $data); + } + + if (strpos($data, '"') !== false) + { + if (strpos($data, "'") !== false) + { + $data = '"' . str_replace('"', '"', $data) . '"'; + } + else + { + $data = "'" . $data . "'"; + } + } + else + { + $data = '"' . $data . '"'; + } + + return $data; +} + +/** +* Converts query string (GET) parameters in request into hidden fields. +* +* Useful for forwarding GET parameters when submitting forms with GET method. +* +* It is possible to omit some of the GET parameters, which is useful if +* they are specified in the form being submitted. +* +* sid is always omitted. +* +* @param \phpbb\request\request $request Request object +* @param array $exclude A list of variable names that should not be forwarded +* @return string HTML with hidden fields +*/ +function phpbb_build_hidden_fields_for_query_params($request, $exclude = null) +{ + $names = $request->variable_names(\phpbb\request\request_interface::GET); + $hidden = ''; + foreach ($names as $name) + { + // Sessions are dealt with elsewhere, omit sid always + if ($name == 'sid') + { + continue; + } + + // Omit any additional parameters requested + if (!empty($exclude) && in_array($name, $exclude)) + { + continue; + } + + $escaped_name = phpbb_quoteattr($name); + + // Note: we might retrieve the variable from POST or cookies + // here. To avoid exposing cookies, skip variables that are + // overwritten somewhere other than GET entirely. + $value = $request->variable($name, '', true); + $get_value = $request->variable($name, '', true, \phpbb\request\request_interface::GET); + if ($value === $get_value) + { + $escaped_value = phpbb_quoteattr($value); + $hidden .= ""; + } + } + return $hidden; +} + +/** +* Get user avatar +* +* @param array $user_row Row from the users table +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar html +*/ +function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = false, $lazy = false) +{ + $row = \phpbb\avatar\manager::clean_row($user_row, 'user'); + return phpbb_get_avatar($row, $alt, $ignore_config, $lazy); +} + +/** +* Get group avatar +* +* @param array $group_row Row from the groups table +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar html +*/ +function phpbb_get_group_avatar($group_row, $alt = 'GROUP_AVATAR', $ignore_config = false, $lazy = false) +{ + $row = \phpbb\avatar\manager::clean_row($group_row, 'group'); + return phpbb_get_avatar($row, $alt, $ignore_config, $lazy); +} + +/** +* Get avatar +* +* @param array $row Row cleaned by \phpbb\avatar\manager::clean_row +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar html +*/ +function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false) +{ + global $user, $config; + global $phpbb_container, $phpbb_dispatcher; + + if (!$config['allow_avatar'] && !$ignore_config) + { + return ''; + } + + $avatar_data = array( + 'src' => $row['avatar'], + 'width' => $row['avatar_width'], + 'height' => $row['avatar_height'], + ); + + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + $driver = $phpbb_avatar_manager->get_driver($row['avatar_type'], !$ignore_config); + $html = ''; + + if ($driver) + { + $html = $driver->get_custom_html($user, $row, $alt); + $avatar_data = $driver->get_data($row); + } + else + { + $avatar_data['src'] = ''; + } + + if (empty($html) && !empty($avatar_data['src'])) + { + if ($lazy) + { + // Determine board url - we may need it later + $board_url = generate_board_url() . '/'; + // This path is sent with the base template paths in the assign_vars() + // call below. We need to correct it in case we are accessing from a + // controller because the web paths will be incorrect otherwise. + $phpbb_path_helper = $phpbb_container->get('path_helper'); + $corrected_path = $phpbb_path_helper->get_web_root_path(); + + $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path; + + $theme = "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme'; + + $src = 'src="' . $theme . '/images/no_avatar.gif" data-src="' . $avatar_data['src'] . '"'; + } + else + { + $src = 'src="' . $avatar_data['src'] . '"'; + } + + $html = ''; + } + + /** + * Event to modify HTML tag of avatar + * + * @event core.get_avatar_after + * @var array row Row cleaned by \phpbb\avatar\manager::clean_row + * @var string alt Optional language string for alt tag within image, can be a language key or text + * @var bool ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP + * @var array avatar_data The HTML attributes for avatar tag + * @var string html The HTML tag of generated avatar + * @since 3.1.6-RC1 + */ + $vars = array('row', 'alt', 'ignore_config', 'avatar_data', 'html'); + extract($phpbb_dispatcher->trigger_event('core.get_avatar_after', compact($vars))); + + return $html; +} + +/** +* Generate page header +*/ +function page_header($page_title = '', $display_online_list = false, $item_id = 0, $item = 'forum', $send_headers = true) +{ + global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path; + global $phpbb_dispatcher, $request, $phpbb_container, $phpbb_admin_path; + + if (defined('HEADER_INC')) + { + return; + } + + define('HEADER_INC', true); + + // A listener can set this variable to `true` when it overrides this function + $page_header_override = false; + + /** + * Execute code and/or overwrite page_header() + * + * @event core.page_header + * @var string page_title Page title + * @var bool display_online_list Do we display online users list + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var int item_id Restrict online users to item id + * @var bool page_header_override Shall we return instead of running + * the rest of page_header() + * @since 3.1.0-a1 + */ + $vars = array('page_title', 'display_online_list', 'item_id', 'item', 'page_header_override'); + extract($phpbb_dispatcher->trigger_event('core.page_header', compact($vars))); + + if ($page_header_override) + { + return; + } + + // gzip_compression + if ($config['gzip_compress']) + { + // to avoid partially compressed output resulting in blank pages in + // the browser or error messages, compression is disabled in a few cases: + // + // 1) if headers have already been sent, this indicates plaintext output + // has been started so further content must not be compressed + // 2) the length of the current output buffer is non-zero. This means + // there is already some uncompressed content in this output buffer + // so further output must not be compressed + // 3) if more than one level of output buffering is used because we + // cannot test all output buffer level content lengths. One level + // could be caused by php.ini output_buffering. Anything + // beyond that is manual, so the code wrapping phpBB in output buffering + // can easily compress the output itself. + // + if (@extension_loaded('zlib') && !headers_sent() && ob_get_level() <= 1 && ob_get_length() == 0) + { + ob_start('ob_gzhandler'); + } + } + + $user->update_session_infos(); + + // Generate logged in/logged out status + if ($user->data['user_id'] != ANONYMOUS) + { + $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id); + $l_login_logout = $user->lang['LOGOUT']; + } + else + { + $redirect = $request->variable('redirect', rawurlencode($user->page['page'])); + $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login&redirect=' . $redirect); + $l_login_logout = $user->lang['LOGIN']; + } + + // Last visit date/time + $s_last_visit = ($user->data['user_id'] != ANONYMOUS) ? $user->format_date($user->data['session_last_visit']) : ''; + + // Get users online list ... if required + $l_online_users = $online_userlist = $l_online_record = $l_online_time = ''; + + if ($config['load_online'] && $config['load_online_time'] && $display_online_list) + { + /** + * Load online data: + * For obtaining another session column use $item and $item_id in the function-parameter, whereby the column is session_{$item}_id. + */ + $item_id = max($item_id, 0); + + $online_users = obtain_users_online($item_id, $item); + $user_online_strings = obtain_users_online_string($online_users, $item_id, $item); + + $l_online_users = $user_online_strings['l_online_users']; + $online_userlist = $user_online_strings['online_userlist']; + $total_online_users = $online_users['total_online']; + + if ($total_online_users > $config['record_online_users']) + { + $config->set('record_online_users', $total_online_users, false); + $config->set('record_online_date', time(), false); + } + + $l_online_record = $user->lang('RECORD_ONLINE_USERS', (int) $config['record_online_users'], $user->format_date($config['record_online_date'], false, true)); + + $l_online_time = $user->lang('VIEW_ONLINE_TIMES', (int) $config['load_online_time']); + } + + $s_privmsg_new = false; + + // Check for new private messages if user is logged in + if (!empty($user->data['is_registered'])) + { + if ($user->data['user_new_privmsg']) + { + if (!$user->data['user_last_privmsg'] || $user->data['user_last_privmsg'] > $user->data['session_last_visit']) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_last_privmsg = ' . $user->data['session_last_visit'] . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + + $s_privmsg_new = true; + } + else + { + $s_privmsg_new = false; + } + } + else + { + $s_privmsg_new = false; + } + } + + $forum_id = $request->variable('f', 0); + $topic_id = $request->variable('t', 0); + + $s_feed_news = false; + + // Get option for news + if ($config['feed_enable']) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0'); + $result = $db->sql_query_limit($sql, 1, 0, 600); + $s_feed_news = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + } + + // Determine board url - we may need it later + $board_url = generate_board_url() . '/'; + // This path is sent with the base template paths in the assign_vars() + // call below. We need to correct it in case we are accessing from a + // controller because the web paths will be incorrect otherwise. + /* @var $phpbb_path_helper \phpbb\path_helper */ + $phpbb_path_helper = $phpbb_container->get('path_helper'); + $corrected_path = $phpbb_path_helper->get_web_root_path(); + $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path; + + // Send a proper content-language to the output + $user_lang = $user->lang['USER_LANG']; + if (strpos($user_lang, '-x-') !== false) + { + $user_lang = substr($user_lang, 0, strpos($user_lang, '-x-')); + } + + $s_search_hidden_fields = array(); + if ($_SID) + { + $s_search_hidden_fields['sid'] = $_SID; + } + + if (!empty($_EXTRA_URL)) + { + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; + } + } + + $dt = $user->create_datetime(); + $timezone_offset = $user->lang(array('timezones', 'UTC_OFFSET'), phpbb_format_timezone_offset($dt->getOffset())); + $timezone_name = $user->timezone->getName(); + if (isset($user->lang['timezones'][$timezone_name])) + { + $timezone_name = $user->lang['timezones'][$timezone_name]; + } + + // Output the notifications + $notifications = false; + if ($config['load_notifications'] && $config['allow_board_notifications'] && $user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_IGNORE) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $notifications = $phpbb_notifications->load_notifications('notification.method.board', array( + 'all_unread' => true, + 'limit' => 5, + )); + + foreach ($notifications['notifications'] as $notification) + { + $template->assign_block_vars('notifications', $notification->prepare_for_display()); + } + } + + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + $notification_mark_hash = generate_link_hash('mark_all_notifications_read'); + + $s_login_redirect = build_hidden_fields(array('redirect' => $phpbb_path_helper->remove_web_root_path(build_url()))); + + // Add form token for login box, in case page is presenting a login form. + add_form_key('login', '_LOGIN'); + + /** + * Workaround for missing template variable in pre phpBB 3.2.6 styles. + * @deprecated 3.2.7 (To be removed: 4.0.0-a1) + */ + $form_token_login = $template->retrieve_var('S_FORM_TOKEN_LOGIN'); + if (!empty($form_token_login)) + { + $s_login_redirect .= $form_token_login; + // Remove S_FORM_TOKEN_LOGIN as it's already appended to S_LOGIN_REDIRECT + $template->assign_var('S_FORM_TOKEN_LOGIN', ''); + } + + // The following assigns all _common_ variables that may be used at any point in a template. + $template->assign_vars(array( + 'SITENAME' => $config['sitename'], + 'SITE_DESCRIPTION' => $config['site_desc'], + 'PAGE_TITLE' => $page_title, + 'SCRIPT_NAME' => str_replace('.' . $phpEx, '', $user->page['page_name']), + 'LAST_VISIT_DATE' => sprintf($user->lang['YOU_LAST_VISIT'], $s_last_visit), + 'LAST_VISIT_YOU' => $s_last_visit, + 'CURRENT_TIME' => sprintf($user->lang['CURRENT_TIME'], $user->format_date(time(), false, true)), + 'TOTAL_USERS_ONLINE' => $l_online_users, + 'LOGGED_IN_USER_LIST' => $online_userlist, + 'RECORD_USERS' => $l_online_record, + + 'PRIVATE_MESSAGE_COUNT' => (!empty($user->data['user_unread_privmsg'])) ? $user->data['user_unread_privmsg'] : 0, + 'CURRENT_USER_AVATAR' => phpbb_get_user_avatar($user->data), + 'CURRENT_USERNAME_SIMPLE' => get_username_string('no_profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), + 'CURRENT_USERNAME_FULL' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), + 'UNREAD_NOTIFICATIONS_COUNT' => ($notifications !== false) ? $notifications['unread_count'] : '', + 'NOTIFICATIONS_COUNT' => ($notifications !== false) ? $notifications['unread_count'] : '', + 'U_VIEW_ALL_NOTIFICATIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_notifications'), + 'U_MARK_ALL_NOTIFICATIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_notifications&mode=notification_list&mark=all&token=' . $notification_mark_hash), + 'U_NOTIFICATION_SETTINGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_notifications&mode=notification_options'), + 'S_NOTIFICATIONS_DISPLAY' => $config['load_notifications'] && $config['allow_board_notifications'], + + 'S_USER_NEW_PRIVMSG' => $user->data['user_new_privmsg'], + 'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'], + 'S_USER_NEW' => $user->data['user_new'], + + 'SID' => $SID, + '_SID' => $_SID, + 'SESSION_ID' => $user->session_id, + 'ROOT_PATH' => $web_path, + 'BOARD_URL' => $board_url, + + 'L_LOGIN_LOGOUT' => $l_login_logout, + 'L_INDEX' => ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['FORUM_INDEX'], + 'L_SITE_HOME' => ($config['site_home_text'] !== '') ? $config['site_home_text'] : $user->lang['HOME'], + 'L_ONLINE_EXPLAIN' => $l_online_time, + + 'U_PRIVATEMSGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'), + 'U_RETURN_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'), + 'U_MEMBERLIST' => append_sid("{$phpbb_root_path}memberlist.$phpEx"), + 'U_VIEWONLINE' => ($auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) ? append_sid("{$phpbb_root_path}viewonline.$phpEx") : '', + 'U_LOGIN_LOGOUT' => $u_login_logout, + 'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"), + 'U_SEARCH' => append_sid("{$phpbb_root_path}search.$phpEx"), + 'U_SITE_HOME' => $config['site_home_url'], + 'U_REGISTER' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), + 'U_PROFILE' => append_sid("{$phpbb_root_path}ucp.$phpEx"), + 'U_USER_PROFILE' => get_username_string('profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), + 'U_MODCP' => append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id), + 'U_FAQ' => $controller_helper->route('phpbb_help_faq_controller'), + 'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'), + 'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'), + 'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'), + 'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'), + 'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'), + 'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'), + 'U_CONTACT_US' => ($config['contact_admin_form_enable'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin') : '', + 'U_TEAM' => (!$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=team'), + 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), + 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), + 'UA_PRIVACY' => addslashes(append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy')), + 'U_RESTORE_PERMISSIONS' => ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm') : '', + 'U_FEED' => $controller_helper->route('phpbb_feed_index'), + + 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false, + 'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false, + 'S_BOARD_DISABLED' => ($config['board_disable']) ? true : false, + 'S_REGISTERED_USER' => (!empty($user->data['is_registered'])) ? true : false, + 'S_IS_BOT' => (!empty($user->data['is_bot'])) ? true : false, + 'S_USER_LANG' => $user_lang, + 'S_USER_BROWSER' => (isset($user->data['session_browser'])) ? $user->data['session_browser'] : $user->lang['UNKNOWN_BROWSER'], + 'S_USERNAME' => $user->data['username'], + 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], + 'S_CONTENT_FLOW_BEGIN' => ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_TIMEZONE' => sprintf($user->lang['ALL_TIMES'], $timezone_offset, $timezone_name), + 'S_DISPLAY_ONLINE_LIST' => ($l_online_time) ? 1 : 0, + 'S_DISPLAY_SEARCH' => (!$config['load_search']) ? 0 : (isset($auth) ? ($auth->acl_get('u_search') && $auth->acl_getf_global('f_search')) : 1), + 'S_DISPLAY_PM' => ($config['allow_privmsg'] && !empty($user->data['is_registered']) && ($auth->acl_get('u_readpm') || $auth->acl_get('u_sendpm'))) ? true : false, + 'S_DISPLAY_MEMBERLIST' => (isset($auth)) ? $auth->acl_get('u_viewprofile') : 0, + 'S_NEW_PM' => ($s_privmsg_new) ? 1 : 0, + 'S_REGISTER_ENABLED' => ($config['require_activation'] != USER_ACTIVATION_DISABLE) ? true : false, + 'S_FORUM_ID' => $forum_id, + 'S_TOPIC_ID' => $topic_id, + + 'S_LOGIN_ACTION' => ((!defined('ADMIN_START')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id)), + 'S_LOGIN_REDIRECT' => $s_login_redirect, + + 'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false, + 'S_ENABLE_FEEDS_OVERALL' => ($config['feed_overall']) ? true : false, + 'S_ENABLE_FEEDS_FORUMS' => ($config['feed_overall_forums']) ? true : false, + 'S_ENABLE_FEEDS_TOPICS' => ($config['feed_topics_new']) ? true : false, + 'S_ENABLE_FEEDS_TOPICS_ACTIVE' => ($config['feed_topics_active']) ? true : false, + 'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false, + + 'S_LOAD_UNREADS' => ($config['load_unreads_search'] && ($config['load_anon_lastread'] || $user->data['is_registered'])) ? true : false, + + 'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), + + 'T_ASSETS_VERSION' => $config['assets_version'], + 'T_ASSETS_PATH' => "{$web_path}assets", + 'T_THEME_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme', + 'T_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template', + 'T_SUPER_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template', + 'T_IMAGES_PATH' => "{$web_path}images/", + 'T_SMILIES_PATH' => "{$web_path}{$config['smilies_path']}/", + 'T_AVATAR_PATH' => "{$web_path}{$config['avatar_path']}/", + 'T_AVATAR_GALLERY_PATH' => "{$web_path}{$config['avatar_gallery_path']}/", + 'T_ICONS_PATH' => "{$web_path}{$config['icons_path']}/", + 'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/", + 'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/", + 'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'], + 'T_STYLESHEET_LANG_LINK'=> "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'], + 'T_FONT_AWESOME_LINK' => !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$web_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'], + 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery-3.4.1.min.js?assets_version=" . $config['assets_version'], + 'S_ALLOW_CDN' => !empty($config['allow_cdn']), + 'S_COOKIE_NOTICE' => !empty($config['cookie_notice']), + + 'T_THEME_NAME' => rawurlencode($user->style['style_path']), + 'T_THEME_LANG_NAME' => $user->lang_name, + 'T_TEMPLATE_NAME' => $user->style['style_path'], + 'T_SUPER_TEMPLATE_NAME' => rawurlencode((isset($user->style['style_parent_tree']) && $user->style['style_parent_tree']) ? $user->style['style_parent_tree'] : $user->style['style_path']), + 'T_IMAGES' => 'images', + 'T_SMILIES' => $config['smilies_path'], + 'T_AVATAR' => $config['avatar_path'], + 'T_AVATAR_GALLERY' => $config['avatar_gallery_path'], + 'T_ICONS' => $config['icons_path'], + 'T_RANKS' => $config['ranks_path'], + 'T_UPLOAD' => $config['upload_path'], + + 'SITE_LOGO_IMG' => $user->img('site_logo'), + )); + + $http_headers = array(); + + if ($send_headers) + { + // An array of http headers that phpBB will set. The following event may override these. + $http_headers += array( + // application/xhtml+xml not used because of IE + 'Content-type' => 'text/html; charset=UTF-8', + 'Cache-Control' => 'private, no-cache="set-cookie"', + 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', + 'Referrer-Policy' => 'strict-origin-when-cross-origin', + ); + if (!empty($user->data['is_bot'])) + { + // Let reverse proxies know we detected a bot. + $http_headers['X-PHPBB-IS-BOT'] = 'yes'; + } + } + + /** + * Execute code and/or overwrite _common_ template variables after they have been assigned. + * + * @event core.page_header_after + * @var string page_title Page title + * @var bool display_online_list Do we display online users list + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var int item_id Restrict online users to item id + * @var array http_headers HTTP headers that should be set by phpbb + * + * @since 3.1.0-b3 + */ + $vars = array('page_title', 'display_online_list', 'item_id', 'item', 'http_headers'); + extract($phpbb_dispatcher->trigger_event('core.page_header_after', compact($vars))); + + foreach ($http_headers as $hname => $hval) + { + header((string) $hname . ': ' . (string) $hval); + } + + return; +} + +/** +* Check and display the SQL report if requested. +* +* @param \phpbb\request\request_interface $request Request object +* @param \phpbb\auth\auth $auth Auth object +* @param \phpbb\db\driver\driver_interface $db Database connection +*/ +function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $request, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db) +{ + global $phpbb_container; + + if ($phpbb_container->getParameter('debug.sql_explain') && $request->variable('explain', false) && $auth->acl_get('a_')) + { + $db->sql_report('display'); + } +} + +/** +* Generate the debug output string +* +* @param \phpbb\db\driver\driver_interface $db Database connection +* @param \phpbb\config\config $config Config object +* @param \phpbb\auth\auth $auth Auth object +* @param \phpbb\user $user User object +* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher +* @return string +*/ +function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\user $user, \phpbb\event\dispatcher_interface $phpbb_dispatcher) +{ + global $phpbb_container; + + $debug_info = array(); + + // Output page creation time + if ($phpbb_container->getParameter('debug.load_time')) + { + if (isset($GLOBALS['starttime'])) + { + $totaltime = microtime(true) - $GLOBALS['starttime']; + $debug_info[] = sprintf('Time: %.3fs', $db->get_sql_time(), ($totaltime - $db->get_sql_time()), $totaltime); + } + } + + if ($phpbb_container->getParameter('debug.memory')) + { + $memory_usage = memory_get_peak_usage(); + if ($memory_usage) + { + $memory_usage = get_formatted_filesize($memory_usage); + + $debug_info[] = 'Peak Memory Usage: ' . $memory_usage; + } + + $debug_info[] = 'GZIP: ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off'); + + if ($user->load) + { + $debug_info[] = 'Load: ' . $user->load; + } + } + + if ($phpbb_container->getParameter('debug.sql_explain')) + { + $debug_info[] = sprintf('Queries: %d', $db->sql_num_queries(true), $db->sql_num_queries()); + + if ($auth->acl_get('a_')) + { + $debug_info[] = 'SQL Explain'; + } + } + + /** + * Modify debug output information + * + * @event core.phpbb_generate_debug_output + * @var array debug_info Array of strings with debug information + * + * @since 3.1.0-RC3 + */ + $vars = array('debug_info'); + extract($phpbb_dispatcher->trigger_event('core.phpbb_generate_debug_output', compact($vars))); + + return implode(' | ', $debug_info); +} + +/** +* Generate page footer +* +* @param bool $run_cron Whether or not to run the cron +* @param bool $display_template Whether or not to display the template +* @param bool $exit_handler Whether or not to run the exit_handler() +*/ +function page_footer($run_cron = true, $display_template = true, $exit_handler = true) +{ + global $db, $config, $template, $user, $auth, $cache, $phpEx; + global $request, $phpbb_dispatcher, $phpbb_admin_path; + + // A listener can set this variable to `true` when it overrides this function + $page_footer_override = false; + + /** + * Execute code and/or overwrite page_footer() + * + * @event core.page_footer + * @var bool run_cron Shall we run cron tasks + * @var bool page_footer_override Shall we return instead of running + * the rest of page_footer() + * @since 3.1.0-a1 + */ + $vars = array('run_cron', 'page_footer_override'); + extract($phpbb_dispatcher->trigger_event('core.page_footer', compact($vars))); + + if ($page_footer_override) + { + return; + } + + phpbb_check_and_display_sql_report($request, $auth, $db); + + $template->assign_vars(array( + 'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher), + 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', + 'CREDIT_LINE' => $user->lang('POWERED_BY', 'phpBB® Forum Software © phpBB Limited'), + + 'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id) : '') + ); + + // Call cron-type script + $call_cron = false; + if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'] && !$cache->get('_cron.lock_check')) + { + $call_cron = true; + $time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time(); + + // Any old lock present? + if (!empty($config['cron_lock'])) + { + $cron_time = explode(' ', $config['cron_lock']); + + // If 1 hour lock is present we do not call cron.php + if ($cron_time[0] + 3600 >= $time_now) + { + $call_cron = false; + } + } + } + + // Call cron job? + if ($call_cron) + { + global $phpbb_container; + + /* @var $cron \phpbb\cron\manager */ + $cron = $phpbb_container->get('cron.manager'); + $task = $cron->find_one_ready_task(); + + if ($task) + { + $url = $task->get_url(); + $template->assign_var('RUN_CRON_TASK', 'cron'); + } + else + { + $cache->put('_cron.lock_check', true, 60); + } + } + + /** + * Execute code and/or modify output before displaying the template. + * + * @event core.page_footer_after + * @var bool display_template Whether or not to display the template + * @var bool exit_handler Whether or not to run the exit_handler() + * + * @since 3.1.0-RC5 + */ + $vars = array('display_template', 'exit_handler'); + extract($phpbb_dispatcher->trigger_event('core.page_footer_after', compact($vars))); + + if ($display_template) + { + $template->display('body'); + } + + garbage_collection(); + + if ($exit_handler) + { + exit_handler(); + } +} + +/** +* Closing the cache object and the database +* Cool function name, eh? We might want to add operations to it later +*/ +function garbage_collection() +{ + global $cache, $db; + global $phpbb_dispatcher; + + if (!empty($phpbb_dispatcher)) + { + /** + * Unload some objects, to free some memory, before we finish our task + * + * @event core.garbage_collection + * @since 3.1.0-a1 + */ + $phpbb_dispatcher->dispatch('core.garbage_collection'); + } + + // Unload cache, must be done before the DB connection if closed + if (!empty($cache)) + { + $cache->unload(); + } + + // Close our DB connection. + if (!empty($db)) + { + $db->sql_close(); + } +} + +/** +* Handler for exit calls in phpBB. +* This function supports hooks. +* +* Note: This function is called after the template has been outputted. +*/ +function exit_handler() +{ + global $phpbb_hook; + + if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__)) + { + if ($phpbb_hook->hook_return(__FUNCTION__)) + { + return $phpbb_hook->hook_return_result(__FUNCTION__); + } + } + + // As a pre-caution... some setups display a blank page if the flush() is not there. + (ob_get_level() > 0) ? @ob_flush() : @flush(); + + exit; +} + +/** +* Handler for init calls in phpBB. This function is called in \phpbb\user::setup(); +* This function supports hooks. +*/ +function phpbb_user_session_handler() +{ + global $phpbb_hook; + + if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__)) + { + if ($phpbb_hook->hook_return(__FUNCTION__)) + { + return $phpbb_hook->hook_return_result(__FUNCTION__); + } + } + + return; +} + +/** +* Casts a numeric string $input to an appropriate numeric type (i.e. integer or float) +* +* @param string $input A numeric string. +* +* @return int|float Integer $input if $input fits integer, +* float $input otherwise. +*/ +function phpbb_to_numeric($input) +{ + return ($input > PHP_INT_MAX) ? (float) $input : (int) $input; +} + +/** +* Get the board contact details (e.g. for emails) +* +* @param \phpbb\config\config $config +* @param string $phpEx +* @return string +*/ +function phpbb_get_board_contact(\phpbb\config\config $config, $phpEx) +{ + if ($config['contact_admin_form_enable']) + { + return generate_board_url() . '/memberlist.' . $phpEx . '?mode=contactadmin'; + } + else + { + return $config['board_contact']; + } +} + +/** +* Get a clickable board contact details link +* +* @param \phpbb\config\config $config +* @param string $phpbb_root_path +* @param string $phpEx +* @return string +*/ +function phpbb_get_board_contact_link(\phpbb\config\config $config, $phpbb_root_path, $phpEx) +{ + if ($config['contact_admin_form_enable'] && $config['email_enable']) + { + return append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); + } + else + { + return 'mailto:' . htmlspecialchars($config['board_contact']); + } +} diff --git a/install/update/new/includes/functions_acp.php b/install/update/new/includes/functions_acp.php new file mode 100644 index 0000000..4926351 --- /dev/null +++ b/install/update/new/includes/functions_acp.php @@ -0,0 +1,727 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Header for acp pages +*/ +function adm_page_header($page_title) +{ + global $config, $user, $template; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $SID, $_SID; + global $phpbb_dispatcher, $phpbb_container; + + if (defined('HEADER_INC')) + { + return; + } + + define('HEADER_INC', true); + + // A listener can set this variable to `true` when it overrides this function + $adm_page_header_override = false; + + /** + * Execute code and/or overwrite adm_page_header() + * + * @event core.adm_page_header + * @var string page_title Page title + * @var bool adm_page_header_override Shall we return instead of + * running the rest of adm_page_header() + * @since 3.1.0-a1 + */ + $vars = array('page_title', 'adm_page_header_override'); + extract($phpbb_dispatcher->trigger_event('core.adm_page_header', compact($vars))); + + if ($adm_page_header_override) + { + return; + } + + $user->update_session_infos(); + + // gzip_compression + if ($config['gzip_compress']) + { + if (@extension_loaded('zlib') && !headers_sent()) + { + ob_start('ob_gzhandler'); + } + } + + $template->assign_vars(array( + 'PAGE_TITLE' => $page_title, + 'USERNAME' => $user->data['username'], + + 'SID' => $SID, + '_SID' => $_SID, + 'SESSION_ID' => $user->session_id, + 'ROOT_PATH' => $phpbb_root_path, + 'ADMIN_ROOT_PATH' => $phpbb_admin_path, + + 'U_LOGOUT' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout'), + 'U_ADM_LOGOUT' => append_sid("{$phpbb_admin_path}index.$phpEx", 'action=admlogout'), + 'U_ADM_INDEX' => append_sid("{$phpbb_admin_path}index.$phpEx"), + 'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"), + + 'T_IMAGES_PATH' => "{$phpbb_root_path}images/", + 'T_SMILIES_PATH' => "{$phpbb_root_path}{$config['smilies_path']}/", + 'T_AVATAR_PATH' => "{$phpbb_root_path}{$config['avatar_path']}/", + 'T_AVATAR_GALLERY_PATH' => "{$phpbb_root_path}{$config['avatar_gallery_path']}/", + 'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/", + 'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/", + 'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/", + 'T_FONT_AWESOME_LINK' => !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$phpbb_root_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'], + + 'T_ASSETS_VERSION' => $config['assets_version'], + + 'ICON_MOVE_UP' => '' . $user->lang['MOVE_UP'] . '', + 'ICON_MOVE_UP_DISABLED' => '' . $user->lang['MOVE_UP'] . '', + 'ICON_MOVE_DOWN' => '' . $user->lang['MOVE_DOWN'] . '', + 'ICON_MOVE_DOWN_DISABLED' => '' . $user->lang['MOVE_DOWN'] . '', + 'ICON_EDIT' => '' . $user->lang['EDIT'] . '', + 'ICON_EDIT_DISABLED' => '' . $user->lang['EDIT'] . '', + 'ICON_DELETE' => '' . $user->lang['DELETE'] . '', + 'ICON_DELETE_DISABLED' => '' . $user->lang['DELETE'] . '', + 'ICON_SYNC' => '' . $user->lang['RESYNC'] . '', + 'ICON_SYNC_DISABLED' => '' . $user->lang['RESYNC'] . '', + + 'S_USER_LANG' => $user->lang['USER_LANG'], + 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_CONTENT_FLOW_BEGIN' => ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', + + 'CONTAINER_EXCEPTION' => $phpbb_container->hasParameter('container_exception') ? $phpbb_container->getParameter('container_exception') : false, + )); + + // An array of http headers that phpBB will set. The following event may override these. + $http_headers = array( + // application/xhtml+xml not used because of IE + 'Content-type' => 'text/html; charset=UTF-8', + 'Cache-Control' => 'private, no-cache="set-cookie"', + 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', + 'Referrer-Policy' => 'strict-origin-when-cross-origin', + ); + + /** + * Execute code and/or overwrite _common_ template variables after they have been assigned. + * + * @event core.adm_page_header_after + * @var string page_title Page title + * @var array http_headers HTTP headers that should be set by phpbb + * + * @since 3.1.0-RC3 + */ + $vars = array('page_title', 'http_headers'); + extract($phpbb_dispatcher->trigger_event('core.adm_page_header_after', compact($vars))); + + foreach ($http_headers as $hname => $hval) + { + header((string) $hname . ': ' . (string) $hval); + } + + return; +} + +/** +* Page footer for acp pages +*/ +function adm_page_footer($copyright_html = true) +{ + global $db, $config, $template, $user, $auth; + global $phpbb_root_path; + global $request, $phpbb_dispatcher; + + // A listener can set this variable to `true` when it overrides this function + $adm_page_footer_override = false; + + /** + * Execute code and/or overwrite adm_page_footer() + * + * @event core.adm_page_footer + * @var bool copyright_html Shall we display the copyright? + * @var bool adm_page_footer_override Shall we return instead of + * running the rest of adm_page_footer() + * @since 3.1.0-a1 + */ + $vars = array('copyright_html', 'adm_page_footer_override'); + extract($phpbb_dispatcher->trigger_event('core.adm_page_footer', compact($vars))); + + if ($adm_page_footer_override) + { + return; + } + + phpbb_check_and_display_sql_report($request, $auth, $db); + + $template->assign_vars(array( + 'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher), + 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', + 'S_COPYRIGHT_HTML' => $copyright_html, + 'CREDIT_LINE' => $user->lang('POWERED_BY', 'phpBB® Forum Software © phpBB Limited'), + 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery-3.4.1.min.js", + 'S_ALLOW_CDN' => !empty($config['allow_cdn']), + 'VERSION' => $config['version']) + ); + + $template->display('body'); + + garbage_collection(); + exit_handler(); +} + +/** +* Generate back link for acp pages +*/ +function adm_back_link($u_action) +{ + global $user; + return '

« ' . $user->lang['BACK_TO_PREV'] . ''; +} + +/** +* Build select field options in acp pages +*/ +function build_select($option_ary, $option_default = false) +{ + global $user; + + $html = ''; + foreach ($option_ary as $value => $title) + { + $selected = ($option_default !== false && $value == $option_default) ? ' selected="selected"' : ''; + $html .= ''; + } + + return $html; +} + +/** +* Build radio fields in acp pages +*/ +function h_radio($name, $input_ary, $input_default = false, $id = false, $key = false, $separator = '') +{ + global $user; + + $html = ''; + $id_assigned = false; + foreach ($input_ary as $value => $title) + { + $selected = ($input_default !== false && $value == $input_default) ? ' checked="checked"' : ''; + $html .= '' . $separator; + $id_assigned = true; + } + + return $html; +} + +/** +* Build configuration template for acp configuration pages +*/ +function build_cfg_template($tpl_type, $key, &$new_ary, $config_key, $vars) +{ + global $user, $module, $phpbb_dispatcher; + + $tpl = ''; + $name = 'config[' . $config_key . ']'; + + // Make sure there is no notice printed out for non-existent config options (we simply set them) + if (!isset($new_ary[$config_key])) + { + $new_ary[$config_key] = ''; + } + + switch ($tpl_type[0]) + { + case 'password': + if ($new_ary[$config_key] !== '') + { + // replace passwords with asterixes + $new_ary[$config_key] = '********'; + } + case 'text': + case 'url': + case 'email': + case 'tel': + case 'search': + // maxlength and size are only valid for these types and will be + // ignored for other input types. + $size = (int) $tpl_type[1]; + $maxlength = (int) $tpl_type[2]; + + $tpl = ''; + break; + + case 'color': + case 'datetime': + case 'datetime-local': + case 'month': + case 'week': + $tpl = ''; + break; + + case 'date': + case 'time': + case 'number': + case 'range': + $max = ''; + $min = ( isset($tpl_type[1]) ) ? (int) $tpl_type[1] : false; + if ( isset($tpl_type[2]) ) + { + $max = (int) $tpl_type[2]; + } + + $tpl = ''; + break; + + case 'dimension': + $max = ''; + + $min = (int) $tpl_type[1]; + + if ( isset($tpl_type[2]) ) + { + $max = (int) $tpl_type[2]; + } + + $tpl = ' x '; + break; + + case 'textarea': + $rows = (int) $tpl_type[1]; + $cols = (int) $tpl_type[2]; + + $tpl = ''; + break; + + case 'radio': + $key_yes = ($new_ary[$config_key]) ? ' checked="checked"' : ''; + $key_no = (!$new_ary[$config_key]) ? ' checked="checked"' : ''; + + $tpl_type_cond = explode('_', $tpl_type[1]); + $type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true; + + $tpl_no = ''; + $tpl_yes = ''; + + $tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . $tpl_no : $tpl_no . $tpl_yes; + break; + + case 'select': + case 'custom': + + if (isset($vars['method'])) + { + $call = array($module->module, $vars['method']); + } + else if (isset($vars['function'])) + { + $call = $vars['function']; + } + else + { + break; + } + + if (isset($vars['params'])) + { + $args = array(); + foreach ($vars['params'] as $value) + { + switch ($value) + { + case '{CONFIG_VALUE}': + $value = $new_ary[$config_key]; + break; + + case '{KEY}': + $value = $key; + break; + } + + $args[] = $value; + } + } + else + { + $args = array($new_ary[$config_key], $key); + } + + $return = call_user_func_array($call, $args); + + if ($tpl_type[0] == 'select') + { + $size = (isset($tpl_type[1])) ? (int) $tpl_type[1] : 1; + $data_toggle = (!empty($tpl_type[2])) ? ' data-togglable-settings="true"' : ''; + + $tpl = ''; + } + else + { + $tpl = $return; + } + + break; + + default: + break; + } + + if (isset($vars['append'])) + { + $tpl .= $vars['append']; + } + + $new = $new_ary; + /** + * Overwrite the html code we display for the config value + * + * @event core.build_config_template + * @var array tpl_type Config type array: + * 0 => data type + * 1 [optional] => string: size, int: minimum + * 2 [optional] => string: max. length, int: maximum + * @var string key Should be used for the id attribute in html + * @var array new Array with the config values we display + * @var string name Should be used for the name attribute + * @var array vars Array with the options for the config + * @var string tpl The resulting html code we display + * @since 3.1.0-a1 + */ + $vars = array('tpl_type', 'key', 'new', 'name', 'vars', 'tpl'); + extract($phpbb_dispatcher->trigger_event('core.build_config_template', compact($vars))); + $new_ary = $new; + unset($new); + + return $tpl; +} + +/** +* Going through a config array and validate values, writing errors to $error. The validation method accepts parameters separated by ':' for string and int. +* The first parameter defines the type to be used, the second the lower bound and the third the upper bound. Only the type is required. +*/ +function validate_config_vars($config_vars, &$cfg_array, &$error) +{ + global $phpbb_root_path, $user, $phpbb_dispatcher, $phpbb_filesystem, $language; + + $type = 0; + $min = 1; + $max = 2; + + foreach ($config_vars as $config_name => $config_definition) + { + if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) + { + continue; + } + + if (!isset($config_definition['validate'])) + { + continue; + } + + $validator = explode(':', $config_definition['validate']); + + // Validate a bit. ;) (0 = type, 1 = min, 2= max) + switch ($validator[$type]) + { + case 'url': + $cfg_array[$config_name] = trim($cfg_array[$config_name]); + + if (!empty($cfg_array[$config_name]) && !preg_match('#^' . get_preg_expression('url') . '$#iu', $cfg_array[$config_name])) + { + $error[] = $language->lang('URL_INVALID', $language->lang($config_definition['lang'])); + } + + // no break here + + case 'string': + $length = utf8_strlen($cfg_array[$config_name]); + + // the column is a VARCHAR + $validator[$max] = (isset($validator[$max])) ? min(255, $validator[$max]) : 255; + + if (isset($validator[$min]) && $length < $validator[$min]) + { + $error[] = sprintf($user->lang['SETTING_TOO_SHORT'], $user->lang[$config_definition['lang']], $validator[$min]); + } + else if (isset($validator[$max]) && $length > $validator[2]) + { + $error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$config_definition['lang']], $validator[$max]); + } + break; + + case 'bool': + $cfg_array[$config_name] = ($cfg_array[$config_name]) ? 1 : 0; + break; + + case 'int': + $cfg_array[$config_name] = (int) $cfg_array[$config_name]; + + if (isset($validator[$min]) && $cfg_array[$config_name] < $validator[$min]) + { + $error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$config_definition['lang']], $validator[$min]); + } + else if (isset($validator[$max]) && $cfg_array[$config_name] > $validator[$max]) + { + $error[] = sprintf($user->lang['SETTING_TOO_BIG'], $user->lang[$config_definition['lang']], $validator[$max]); + } + + if (strpos($config_name, '_max') !== false) + { + // Min/max pairs of settings should ensure that min <= max + // Replace _max with _min to find the name of the minimum + // corresponding configuration variable + $min_name = str_replace('_max', '_min', $config_name); + + if (isset($cfg_array[$min_name]) && is_numeric($cfg_array[$min_name]) && $cfg_array[$config_name] < $cfg_array[$min_name]) + { + // A minimum value exists and the maximum value is less than it + $error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$config_definition['lang']], (int) $cfg_array[$min_name]); + } + } + break; + + case 'email': + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $cfg_array[$config_name])) + { + $error[] = $user->lang['EMAIL_INVALID_EMAIL']; + } + break; + + // Absolute path + case 'script_path': + if (!$cfg_array[$config_name]) + { + break; + } + + $destination = str_replace('\\', '/', $cfg_array[$config_name]); + + if ($destination !== '/') + { + // Adjust destination path (no trailing slash) + if (substr($destination, -1, 1) == '/') + { + $destination = substr($destination, 0, -1); + } + + $destination = str_replace(array('../', './'), '', $destination); + + if ($destination[0] != '/') + { + $destination = '/' . $destination; + } + } + + $cfg_array[$config_name] = trim($destination); + + break; + + // Absolute path + case 'lang': + if (!$cfg_array[$config_name]) + { + break; + } + + $cfg_array[$config_name] = basename($cfg_array[$config_name]); + + if (!file_exists($phpbb_root_path . 'language/' . $cfg_array[$config_name] . '/')) + { + $error[] = $user->lang['WRONG_DATA_LANG']; + } + break; + + // Relative path (appended $phpbb_root_path) + case 'rpath': + case 'rwpath': + if (!$cfg_array[$config_name]) + { + break; + } + + $destination = $cfg_array[$config_name]; + + // Adjust destination path (no trailing slash) + if (substr($destination, -1, 1) == '/' || substr($destination, -1, 1) == '\\') + { + $destination = substr($destination, 0, -1); + } + + $destination = str_replace(array('../', '..\\', './', '.\\'), '', $destination); + if ($destination && ($destination[0] == '/' || $destination[0] == "\\")) + { + $destination = ''; + } + + $cfg_array[$config_name] = trim($destination); + + // Path being relative (still prefixed by phpbb_root_path), but with the ability to escape the root dir... + case 'path': + case 'wpath': + + if (!$cfg_array[$config_name]) + { + break; + } + + $cfg_array[$config_name] = trim($cfg_array[$config_name]); + + // Make sure no NUL byte is present... + if (strpos($cfg_array[$config_name], "\0") !== false || strpos($cfg_array[$config_name], '%00') !== false) + { + $cfg_array[$config_name] = ''; + break; + } + + $path = $phpbb_root_path . $cfg_array[$config_name]; + + if (!file_exists($path)) + { + $error[] = sprintf($user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]); + } + + if (file_exists($path) && !is_dir($path)) + { + $error[] = sprintf($user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]); + } + + // Check if the path is writable + if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath') + { + if (file_exists($path) && !$phpbb_filesystem->is_writable($path)) + { + $error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]); + } + } + + break; + + default: + /** + * Validate a config value + * + * @event core.validate_config_variable + * @var array cfg_array Array with config values + * @var string config_name Name of the config we validate + * @var array config_definition Array with the options for + * this config + * @var array error Array of errors, the errors should + * be strings only, language keys are + * not replaced afterwards + * @since 3.1.0-a1 + */ + $vars = array('cfg_array', 'config_name', 'config_definition', 'error'); + extract($phpbb_dispatcher->trigger_event('core.validate_config_variable', compact($vars))); + break; + } + } + + return; +} + +/** +* Checks whatever or not a variable is OK for use in the Database +* param mixed $value_ary An array of the form array(array('lang' => ..., 'value' => ..., 'column_type' =>))' +* param mixed $error The error array +*/ +function validate_range($value_ary, &$error) +{ + global $user; + + $column_types = array( + 'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1), + 'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535), + 'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff), + // Do not use (int) 0x80000000 - it evaluates to different + // values on 32-bit and 64-bit systems. + // Apparently -2147483648 is a float on 32-bit systems, + // despite fitting in an int, thus explicit cast is needed. + 'INT' => array('php_type' => 'int', 'min' => (int) -2147483648, 'max' => (int) 0x7fffffff), + 'TINT' => array('php_type' => 'int', 'min' => -128, 'max' => 127), + + 'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255), + ); + foreach ($value_ary as $value) + { + $column = explode(':', $value['column_type']); + if (!isset($column_types[$column[0]])) + { + continue; + } + else + { + $type = $column_types[$column[0]]; + } + + switch ($type['php_type']) + { + case 'string' : + $max = (isset($column[1])) ? min($column[1],$type['max']) : $type['max']; + if (utf8_strlen($value['value']) > $max) + { + $error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$value['lang']], $max); + } + break; + + case 'int': + $min = (isset($column[1])) ? max($column[1],$type['min']) : $type['min']; + $max = (isset($column[2])) ? min($column[2],$type['max']) : $type['max']; + if ($value['value'] < $min) + { + $error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$value['lang']], $min); + } + else if ($value['value'] > $max) + { + $error[] = sprintf($user->lang['SETTING_TOO_BIG'], $user->lang[$value['lang']], $max); + } + break; + } + } +} + +/** +* Inserts new config display_vars into an exisiting display_vars array +* at the given position. +* +* @param array $display_vars An array of existing config display vars +* @param array $add_config_vars An array of new config display vars +* @param array $where Where to place the new config vars, +* before or after an exisiting config, as an array +* of the form: array('after' => 'config_name') or +* array('before' => 'config_name'). +* @return array The array of config display vars +*/ +function phpbb_insert_config_array($display_vars, $add_config_vars, $where) +{ + if (is_array($where) && array_key_exists(current($where), $display_vars)) + { + $position = array_search(current($where), array_keys($display_vars)) + ((key($where) == 'before') ? 0 : 1); + $display_vars = array_merge( + array_slice($display_vars, 0, $position), + $add_config_vars, + array_slice($display_vars, $position) + ); + } + + return $display_vars; +} diff --git a/install/update/new/includes/functions_admin.php b/install/update/new/includes/functions_admin.php new file mode 100644 index 0000000..4629706 --- /dev/null +++ b/install/update/new/includes/functions_admin.php @@ -0,0 +1,3096 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Recalculate Nested Sets +* +* @param int $new_id first left_id (should start with 1) +* @param string $pkey primary key-column (containing the id for the parent_id of the children) +* @param string $table constant or fullname of the table +* @param int $parent_id parent_id of the current set (default = 0) +* @param array $where contains strings to compare closer on the where statement (additional) +*/ +function recalc_nested_sets(&$new_id, $pkey, $table, $parent_id = 0, $where = array()) +{ + global $db; + + $sql = 'SELECT * + FROM ' . $table . ' + WHERE parent_id = ' . (int) $parent_id . + ((!empty($where)) ? ' AND ' . implode(' AND ', $where) : '') . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + // First we update the left_id for this module + if ($row['left_id'] != $new_id) + { + $db->sql_query('UPDATE ' . $table . ' SET ' . $db->sql_build_array('UPDATE', array('left_id' => $new_id)) . " WHERE $pkey = {$row[$pkey]}"); + } + $new_id++; + + // Then we go through any children and update their left/right id's + recalc_nested_sets($new_id, $pkey, $table, $row[$pkey], $where); + + // Then we come back and update the right_id for this module + if ($row['right_id'] != $new_id) + { + $db->sql_query('UPDATE ' . $table . ' SET ' . $db->sql_build_array('UPDATE', array('right_id' => $new_id)) . " WHERE $pkey = {$row[$pkey]}"); + } + $new_id++; + } + $db->sql_freeresult($result); +} + +/** +* Simple version of jumpbox, just lists authed forums +*/ +function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $only_acl_post = false, $return_array = false) +{ + global $db, $auth, $phpbb_dispatcher; + + // This query is identical to the jumpbox one + $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, forum_flags, forum_options, left_id, right_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql, 600); + + $rowset = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rowset[(int) $row['forum_id']] = $row; + } + $db->sql_freeresult($result); + + $right = 0; + $padding_store = array('0' => ''); + $padding = ''; + $forum_list = ($return_array) ? array() : ''; + + /** + * Modify the forum list data + * + * @event core.make_forum_select_modify_forum_list + * @var array rowset Array with the forums list data + * @since 3.1.10-RC1 + */ + $vars = array('rowset'); + extract($phpbb_dispatcher->trigger_event('core.make_forum_select_modify_forum_list', compact($vars))); + + // Sometimes it could happen that forums will be displayed here not be displayed within the index page + // This is the result of forums not displayed at index, having list permissions and a parent of a forum with no permissions. + // If this happens, the padding could be "broken" + + foreach ($rowset as $row) + { + if ($row['left_id'] < $right) + { + $padding .= '   '; + $padding_store[$row['parent_id']] = $padding; + } + else if ($row['left_id'] > $right + 1) + { + $padding = (isset($padding_store[$row['parent_id']])) ? $padding_store[$row['parent_id']] : ''; + } + + $right = $row['right_id']; + $disabled = false; + + if (!$ignore_acl && $auth->acl_gets(array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel'), $row['forum_id'])) + { + if ($only_acl_post && !$auth->acl_get('f_post', $row['forum_id']) || (!$auth->acl_get('m_approve', $row['forum_id']) && !$auth->acl_get('f_noapprove', $row['forum_id']))) + { + $disabled = true; + } + } + else if (!$ignore_acl) + { + continue; + } + + if ( + ((is_array($ignore_id) && in_array($row['forum_id'], $ignore_id)) || $row['forum_id'] == $ignore_id) + || + // Non-postable forum with no subforums, don't display + ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']) && $ignore_emptycat) + || + ($row['forum_type'] != FORUM_POST && $ignore_nonpost) + ) + { + $disabled = true; + } + + if ($return_array) + { + // Include some more information... + $selected = (is_array($select_id)) ? ((in_array($row['forum_id'], $select_id)) ? true : false) : (($row['forum_id'] == $select_id) ? true : false); + $forum_list[$row['forum_id']] = array_merge(array('padding' => $padding, 'selected' => ($selected && !$disabled), 'disabled' => $disabled), $row); + } + else + { + $selected = (is_array($select_id)) ? ((in_array($row['forum_id'], $select_id)) ? ' selected="selected"' : '') : (($row['forum_id'] == $select_id) ? ' selected="selected"' : ''); + $forum_list .= ''; + } + } + unset($padding_store, $rowset); + + return $forum_list; +} + +/** +* Generate size select options +*/ +function size_select_options($size_compare) +{ + global $user; + + $size_types_text = array($user->lang['BYTES'], $user->lang['KIB'], $user->lang['MIB']); + $size_types = array('b', 'kb', 'mb'); + + $s_size_options = ''; + + for ($i = 0, $size = count($size_types_text); $i < $size; $i++) + { + $selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : ''; + $s_size_options .= ''; + } + + return $s_size_options; +} + +/** +* Generate list of groups (option fields without select) +* +* @param int $group_id The default group id to mark as selected +* @param array $exclude_ids The group ids to exclude from the list, false (default) if you whish to exclude no id +* @param int $manage_founder If set to false (default) all groups are returned, if 0 only those groups returned not being managed by founders only, if 1 only those groups returned managed by founders only. +* +* @return string The list of options. +*/ +function group_select_options($group_id, $exclude_ids = false, $manage_founder = false) +{ + global $db, $config, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $exclude_sql = ($exclude_ids !== false && count($exclude_ids)) ? 'WHERE ' . $db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; + $sql_and = (!$config['coppa_enable']) ? (($exclude_sql) ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : ''; + $sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ') . 'group_founder_manage = ' . (int) $manage_founder : ''; + + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE . " + $exclude_sql + $sql_and + $sql_founder + ORDER BY group_type DESC, group_name ASC"; + $result = $db->sql_query($sql); + + $s_group_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($row['group_id'] == $group_id) ? ' selected="selected"' : ''; + $s_group_options .= '' . $group_helper->get_name($row['group_name']) . ''; + } + $db->sql_freeresult($result); + + return $s_group_options; +} + +/** +* Obtain authed forums list +*/ +function get_forum_list($acl_list = 'f_list', $id_only = true, $postable_only = false, $no_cache = false) +{ + global $db, $auth, $phpbb_dispatcher; + static $forum_rows; + + if (!isset($forum_rows)) + { + // This query is identical to the jumpbox one + $expire_time = ($no_cache) ? 0 : 600; + + $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql, $expire_time); + + $forum_rows = array(); + + $right = $padding = 0; + $padding_store = array('0' => 0); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['left_id'] < $right) + { + $padding++; + $padding_store[$row['parent_id']] = $padding; + } + else if ($row['left_id'] > $right + 1) + { + // Ok, if the $padding_store for this parent is empty there is something wrong. For now we will skip over it. + // @todo digging deep to find out "how" this can happen. + $padding = (isset($padding_store[$row['parent_id']])) ? $padding_store[$row['parent_id']] : $padding; + } + + $right = $row['right_id']; + $row['padding'] = $padding; + + $forum_rows[] = $row; + } + $db->sql_freeresult($result); + unset($padding_store); + } + + $rowset = array(); + foreach ($forum_rows as $row) + { + if ($postable_only && $row['forum_type'] != FORUM_POST) + { + continue; + } + + if ($acl_list == '' || ($acl_list != '' && $auth->acl_gets($acl_list, $row['forum_id']))) + { + $rowset[] = ($id_only) ? (int) $row['forum_id'] : $row; + } + } + + /** + * Modify the forum list data + * + * @event core.get_forum_list_modify_data + * @var array rowset Array with the forum list data + * @since 3.1.10-RC1 + */ + $vars = array('rowset'); + extract($phpbb_dispatcher->trigger_event('core.get_forum_list_modify_data', compact($vars))); + + return $rowset; +} + +/** +* Get forum branch +*/ +function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $include_forum = true) +{ + global $db; + + switch ($type) + { + case 'parents': + $condition = 'f1.left_id BETWEEN f2.left_id AND f2.right_id'; + break; + + case 'children': + $condition = 'f2.left_id BETWEEN f1.left_id AND f1.right_id'; + break; + + default: + $condition = 'f2.left_id BETWEEN f1.left_id AND f1.right_id OR f1.left_id BETWEEN f2.left_id AND f2.right_id'; + break; + } + + $rows = array(); + + $sql = 'SELECT f2.* + FROM ' . FORUMS_TABLE . ' f1 + LEFT JOIN ' . FORUMS_TABLE . " f2 ON ($condition) + WHERE f1.forum_id = $forum_id + ORDER BY f2.left_id " . (($order == 'descending') ? 'ASC' : 'DESC'); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$include_forum && $row['forum_id'] == $forum_id) + { + continue; + } + + $rows[] = $row; + } + $db->sql_freeresult($result); + + return $rows; +} + +/** +* Copies permissions from one forum to others +* +* @param int $src_forum_id The source forum we want to copy permissions from +* @param array $dest_forum_ids The destination forum(s) we want to copy to +* @param bool $clear_dest_perms True if destination permissions should be deleted +* @param bool $add_log True if log entry should be added +* +* @return bool False on error +*/ +function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perms = true, $add_log = true) +{ + global $db, $user, $phpbb_log; + + // Only one forum id specified + if (!is_array($dest_forum_ids)) + { + $dest_forum_ids = array($dest_forum_ids); + } + + // Make sure forum ids are integers + $src_forum_id = (int) $src_forum_id; + $dest_forum_ids = array_map('intval', $dest_forum_ids); + + // No source forum or no destination forums specified + if (empty($src_forum_id) || empty($dest_forum_ids)) + { + return false; + } + + // Check if source forum exists + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $src_forum_id; + $result = $db->sql_query($sql); + $src_forum_name = $db->sql_fetchfield('forum_name'); + $db->sql_freeresult($result); + + // Source forum doesn't exist + if (empty($src_forum_name)) + { + return false; + } + + // Check if destination forums exists + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); + $result = $db->sql_query($sql); + + $dest_forum_ids = $dest_forum_names = array(); + while ($row = $db->sql_fetchrow($result)) + { + $dest_forum_ids[] = (int) $row['forum_id']; + $dest_forum_names[] = $row['forum_name']; + } + $db->sql_freeresult($result); + + // No destination forum exists + if (empty($dest_forum_ids)) + { + return false; + } + + // From the mysql documentation: + // Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear + // in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14. + // Due to this we stay on the safe side if we do the insertion "the manual way" + + // Rowsets we're going to insert + $users_sql_ary = $groups_sql_ary = array(); + + // Query acl users table for source forum data + $sql = 'SELECT user_id, auth_option_id, auth_role_id, auth_setting + FROM ' . ACL_USERS_TABLE . ' + WHERE forum_id = ' . $src_forum_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $row = array( + 'user_id' => (int) $row['user_id'], + 'auth_option_id' => (int) $row['auth_option_id'], + 'auth_role_id' => (int) $row['auth_role_id'], + 'auth_setting' => (int) $row['auth_setting'], + ); + + foreach ($dest_forum_ids as $dest_forum_id) + { + $users_sql_ary[] = $row + array('forum_id' => $dest_forum_id); + } + } + $db->sql_freeresult($result); + + // Query acl groups table for source forum data + $sql = 'SELECT group_id, auth_option_id, auth_role_id, auth_setting + FROM ' . ACL_GROUPS_TABLE . ' + WHERE forum_id = ' . $src_forum_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $row = array( + 'group_id' => (int) $row['group_id'], + 'auth_option_id' => (int) $row['auth_option_id'], + 'auth_role_id' => (int) $row['auth_role_id'], + 'auth_setting' => (int) $row['auth_setting'], + ); + + foreach ($dest_forum_ids as $dest_forum_id) + { + $groups_sql_ary[] = $row + array('forum_id' => $dest_forum_id); + } + } + $db->sql_freeresult($result); + + $db->sql_transaction('begin'); + + // Clear current permissions of destination forums + if ($clear_dest_perms) + { + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); + $db->sql_query($sql); + } + + $db->sql_multi_insert(ACL_USERS_TABLE, $users_sql_ary); + $db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary); + + if ($add_log) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_COPIED_PERMISSIONS', false, array($src_forum_name, implode(', ', $dest_forum_names))); + } + + $db->sql_transaction('commit'); + + return true; +} + +/** +* Get physical file listing +*/ +function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png') +{ + $matches = array($dir => array()); + + // Remove initial / if present + $rootdir = (substr($rootdir, 0, 1) == '/') ? substr($rootdir, 1) : $rootdir; + // Add closing / if not present + $rootdir = ($rootdir && substr($rootdir, -1) != '/') ? $rootdir . '/' : $rootdir; + + // Remove initial / if present + $dir = (substr($dir, 0, 1) == '/') ? substr($dir, 1) : $dir; + // Add closing / if not present + $dir = ($dir && substr($dir, -1) != '/') ? $dir . '/' : $dir; + + if (!is_dir($rootdir . $dir)) + { + return $matches; + } + + $dh = @opendir($rootdir . $dir); + + if (!$dh) + { + return $matches; + } + + while (($fname = readdir($dh)) !== false) + { + if (is_file("$rootdir$dir$fname")) + { + if (filesize("$rootdir$dir$fname") && preg_match('#\.' . $type . '$#i', $fname)) + { + $matches[$dir][] = $fname; + } + } + else if ($fname[0] != '.' && is_dir("$rootdir$dir$fname")) + { + $matches += filelist($rootdir, "$dir$fname", $type); + } + } + closedir($dh); + + return $matches; +} + +/** +* Move topic(s) +*/ +function move_topics($topic_ids, $forum_id, $auto_sync = true) +{ + global $db, $phpbb_dispatcher; + + if (empty($topic_ids)) + { + return; + } + + $forum_ids = array($forum_id); + + if (!is_array($topic_ids)) + { + $topic_ids = array($topic_ids); + } + + /** + * Perform additional actions before topics move + * + * @event core.move_topics_before + * @var array topic_ids Array of the moved topic ids + * @var string forum_id The forum id from where the topics are moved + * @since 3.2.9-RC1 + */ + $vars = array( + 'topic_ids', + 'forum_id', + ); + extract($phpbb_dispatcher->trigger_event('core.move_topics_before', compact($vars))); + + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids) . ' + AND forum_id = ' . $forum_id; + $db->sql_query($sql); + + if ($auto_sync) + { + $sql = 'SELECT DISTINCT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + } + + $table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); + + /** + * Perform additional actions before topics move + * + * @event core.move_topics_before_query + * @var array table_ary Array of tables from which forum_id will be updated for all rows that hold the moved topics + * @var array topic_ids Array of the moved topic ids + * @var string forum_id The forum id from where the topics are moved + * @var array forum_ids Array of the forums where the topics are moving (includes also forum_id) + * @var bool auto_sync Whether or not to perform auto sync + * @since 3.1.5-RC1 + */ + $vars = array( + 'table_ary', + 'topic_ids', + 'forum_id', + 'forum_ids', + 'auto_sync', + ); + extract($phpbb_dispatcher->trigger_event('core.move_topics_before_query', compact($vars))); + + foreach ($table_ary as $table) + { + $sql = "UPDATE $table + SET forum_id = $forum_id + WHERE " . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + unset($table_ary); + + /** + * Perform additional actions after topics move + * + * @event core.move_topics_after + * @var array topic_ids Array of the moved topic ids + * @var string forum_id The forum id from where the topics were moved + * @var array forum_ids Array of the forums where the topics were moved (includes also forum_id) + * @since 3.2.9-RC1 + */ + $vars = array( + 'topic_ids', + 'forum_id', + 'forum_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.move_topics_after', compact($vars))); + + if ($auto_sync) + { + sync('forum', 'forum_id', $forum_ids, true, true); + unset($forum_ids); + } +} + +/** +* Move post(s) +*/ +function move_posts($post_ids, $topic_id, $auto_sync = true) +{ + global $db, $phpbb_dispatcher; + + if (!is_array($post_ids)) + { + $post_ids = array($post_ids); + } + + $forum_ids = array(); + $topic_ids = array($topic_id); + + $sql = 'SELECT DISTINCT topic_id, forum_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_id', $post_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = (int) $row['forum_id']; + $topic_ids[] = (int) $row['topic_id']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $forum_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$forum_row) + { + trigger_error('NO_TOPIC'); + } + + /** + * Perform additional actions before moving posts + * + * @event core.move_posts_before + * @var array post_ids Array of post ids to move + * @var int topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync + * @var array forum_ids Array of the forum ids the posts are moved from + * @var array topic_ids Array of the topic ids the posts are moved from + * @var array forum_row Array with the forum id of the topic the posts are moved to + * @since 3.1.7-RC1 + */ + $vars = array( + 'post_ids', + 'topic_id', + 'auto_sync', + 'forum_ids', + 'topic_ids', + 'forum_row', + ); + extract($phpbb_dispatcher->trigger_event('core.move_posts_before', compact($vars))); + + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET forum_id = ' . (int) $forum_row['forum_id'] . ", topic_id = $topic_id + WHERE " . $db->sql_in_set('post_id', $post_ids); + $db->sql_query($sql); + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " + SET topic_id = $topic_id, in_message = 0 + WHERE " . $db->sql_in_set('post_msg_id', $post_ids); + $db->sql_query($sql); + + /** + * Perform additional actions after moving posts + * + * @event core.move_posts_after + * @var array post_ids Array of the moved post ids + * @var int topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync + * @var array forum_ids Array of the forum ids the posts are moved from + * @var array topic_ids Array of the topic ids the posts are moved from + * @var array forum_row Array with the forum id of the topic the posts are moved to + * @since 3.1.7-RC1 + */ + $vars = array( + 'post_ids', + 'topic_id', + 'auto_sync', + 'forum_ids', + 'topic_ids', + 'forum_row', + ); + extract($phpbb_dispatcher->trigger_event('core.move_posts_after', compact($vars))); + + if ($auto_sync) + { + $forum_ids[] = (int) $forum_row['forum_id']; + + sync('topic_reported', 'topic_id', $topic_ids); + sync('topic_attachment', 'topic_id', $topic_ids); + sync('topic', 'topic_id', $topic_ids, true); + sync('forum', 'forum_id', $forum_ids, true, true); + + /** + * Perform additional actions after move post sync + * + * @event core.move_posts_sync_after + * @var array post_ids Array of the moved post ids + * @var int topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync + * @var array forum_ids Array of the forum ids the posts are moved from + * @var array topic_ids Array of the topic ids the posts are moved from + * @var array forum_row Array with the forum id of the topic the posts are moved to + * @since 3.1.11-RC1 + */ + $vars = array( + 'post_ids', + 'topic_id', + 'auto_sync', + 'forum_ids', + 'topic_ids', + 'forum_row', + ); + extract($phpbb_dispatcher->trigger_event('core.move_posts_sync_after', compact($vars))); + } + + // Update posted information + update_posted_info($topic_ids); +} + +/** +* Remove topic(s) +*/ +function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true) +{ + global $db, $config, $phpbb_container, $phpbb_dispatcher; + + $approved_topics = 0; + $forum_ids = $topic_ids = array(); + + if ($where_type === 'range') + { + $where_clause = $where_ids; + } + else + { + $where_ids = (is_array($where_ids)) ? array_unique($where_ids) : array($where_ids); + + if (!count($where_ids)) + { + return array('topics' => 0, 'posts' => 0); + } + + $where_clause = $db->sql_in_set($where_type, $where_ids); + } + + // Making sure that delete_posts does not call delete_topics again... + $return = array( + 'posts' => ($call_delete_posts) ? delete_posts($where_type, $where_ids, false, true, $post_count_sync, false) : 0, + ); + + $sql = 'SELECT topic_id, forum_id, topic_visibility, topic_moved_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $where_clause; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + $topic_ids[] = $row['topic_id']; + + if ($row['topic_visibility'] == ITEM_APPROVED && !$row['topic_moved_id']) + { + $approved_topics++; + } + } + $db->sql_freeresult($result); + + $return['topics'] = count($topic_ids); + + if (!count($topic_ids)) + { + return $return; + } + + $db->sql_transaction('begin'); + + $table_ary = array(BOOKMARKS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE); + + /** + * Perform additional actions before topic(s) deletion + * + * @event core.delete_topics_before_query + * @var array table_ary Array of tables from which all rows will be deleted that hold a topic_id occuring in topic_ids + * @var array topic_ids Array of topic ids to delete + * @since 3.1.4-RC1 + */ + $vars = array( + 'table_ary', + 'topic_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_topics_before_query', compact($vars))); + + foreach ($table_ary as $table) + { + $sql = "DELETE FROM $table + WHERE " . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + unset($table_ary); + + /** + * Perform additional actions after topic(s) deletion + * + * @event core.delete_topics_after_query + * @var array topic_ids Array of topic ids that were deleted + * @since 3.1.4-RC1 + */ + $vars = array( + 'topic_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_topics_after_query', compact($vars))); + + $moved_topic_ids = array(); + + // update the other forums + $sql = 'SELECT topic_id, forum_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + $moved_topic_ids[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (count($moved_topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $moved_topic_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + if ($auto_sync) + { + sync('forum', 'forum_id', array_unique($forum_ids), true, true); + sync('topic_reported', $where_type, $where_ids); + } + + if ($approved_topics) + { + $config->increment('num_topics', $approved_topics * (-1), false); + } + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->delete_notifications(array( + 'notification.type.topic', + 'notification.type.approve_topic', + 'notification.type.topic_in_queue', + ), $topic_ids); + + return $return; +} + +/** +* Remove post(s) +*/ +function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true) +{ + global $db, $config, $phpbb_root_path, $phpEx, $auth, $user, $phpbb_container, $phpbb_dispatcher; + + // Notifications types to delete + $delete_notifications_types = array( + 'notification.type.quote', + 'notification.type.approve_post', + 'notification.type.post_in_queue', + 'notification.type.report_post', + ); + + /** + * Perform additional actions before post(s) deletion + * + * @event core.delete_posts_before + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of posts ids to delete + * @var bool auto_sync Flag indicating if topics/forums should be synchronized + * @var bool posted_sync Flag indicating if topics_posted table should be resynchronized + * @var bool post_count_sync Flag indicating if posts count should be resynchronized + * @var bool call_delete_topics Flag indicating if topics having no posts should be deleted + * @var array delete_notifications_types Array with notifications types to delete + * @since 3.1.0-a4 + */ + $vars = array( + 'where_type', + 'where_ids', + 'auto_sync', + 'posted_sync', + 'post_count_sync', + 'call_delete_topics', + 'delete_notifications_types', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_before', compact($vars))); + + if ($where_type === 'range') + { + $where_clause = $where_ids; + } + else + { + if (is_array($where_ids)) + { + $where_ids = array_unique($where_ids); + } + else + { + $where_ids = array($where_ids); + } + + if (!count($where_ids)) + { + return false; + } + + $where_ids = array_map('intval', $where_ids); + +/* Possible code for splitting post deletion + if (count($where_ids) >= 1001) + { + // Split into chunks of 1000 + $chunks = array_chunk($where_ids, 1000); + + foreach ($chunks as $_where_ids) + { + delete_posts($where_type, $_where_ids, $auto_sync, $posted_sync, $post_count_sync, $call_delete_topics); + } + + return; + }*/ + + $where_clause = $db->sql_in_set($where_type, $where_ids); + } + + $approved_posts = 0; + $post_ids = $topic_ids = $forum_ids = $post_counts = $remove_topics = array(); + + $sql = 'SELECT post_id, poster_id, post_visibility, post_postcount, topic_id, forum_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $where_clause; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $post_ids[] = (int) $row['post_id']; + $poster_ids[] = (int) $row['poster_id']; + $topic_ids[] = (int) $row['topic_id']; + $forum_ids[] = (int) $row['forum_id']; + + if ($row['post_postcount'] && $post_count_sync && $row['post_visibility'] == ITEM_APPROVED) + { + $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1; + } + + if ($row['post_visibility'] == ITEM_APPROVED) + { + $approved_posts++; + } + } + $db->sql_freeresult($result); + + if (!count($post_ids)) + { + return false; + } + + $db->sql_transaction('begin'); + + $table_ary = array(POSTS_TABLE, REPORTS_TABLE); + + /** + * Perform additional actions during post(s) deletion before running the queries + * + * @event core.delete_posts_in_transaction_before + * @var array post_ids Array with deleted posts' ids + * @var array poster_ids Array with deleted posts' author ids + * @var array topic_ids Array with deleted posts' topic ids + * @var array forum_ids Array with deleted posts' forum ids + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of post ids to delete + * @var array delete_notifications_types Array with notifications types to delete + * @var array table_ary Array with table names to delete data from + * @since 3.1.7-RC1 + */ + $vars = array( + 'post_ids', + 'poster_ids', + 'topic_ids', + 'forum_ids', + 'where_type', + 'where_ids', + 'delete_notifications_types', + 'table_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_in_transaction_before', compact($vars))); + + foreach ($table_ary as $table) + { + $sql = "DELETE FROM $table + WHERE " . $db->sql_in_set('post_id', $post_ids); + $db->sql_query($sql); + } + unset($table_ary); + + // Adjust users post counts + if (count($post_counts) && $post_count_sync) + { + foreach ($post_counts as $poster_id => $substract) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = 0 + WHERE user_id = ' . $poster_id . ' + AND user_posts < ' . $substract; + $db->sql_query($sql); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts - ' . $substract . ' + WHERE user_id = ' . $poster_id . ' + AND user_posts >= ' . $substract; + $db->sql_query($sql); + } + } + + // Remove topics now having no posts? + if (count($topic_ids)) + { + $sql = 'SELECT topic_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + GROUP BY topic_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $remove_topics[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + // Actually, those not within remove_topics should be removed. ;) + $remove_topics = array_diff($topic_ids, $remove_topics); + } + + // Remove the message from the search index + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if ($error) + { + trigger_error($error); + } + + $search->index_remove($post_ids, $poster_ids, $forum_ids); + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('post', $post_ids, false); + unset($attachment_manager); + + /** + * Perform additional actions during post(s) deletion + * + * @event core.delete_posts_in_transaction + * @var array post_ids Array with deleted posts' ids + * @var array poster_ids Array with deleted posts' author ids + * @var array topic_ids Array with deleted posts' topic ids + * @var array forum_ids Array with deleted posts' forum ids + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of posts ids to delete + * @var array delete_notifications_types Array with notifications types to delete + * @since 3.1.0-a4 + */ + $vars = array( + 'post_ids', + 'poster_ids', + 'topic_ids', + 'forum_ids', + 'where_type', + 'where_ids', + 'delete_notifications_types', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_in_transaction', compact($vars))); + + $db->sql_transaction('commit'); + + /** + * Perform additional actions after post(s) deletion + * + * @event core.delete_posts_after + * @var array post_ids Array with deleted posts' ids + * @var array poster_ids Array with deleted posts' author ids + * @var array topic_ids Array with deleted posts' topic ids + * @var array forum_ids Array with deleted posts' forum ids + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of posts ids to delete + * @var array delete_notifications_types Array with notifications types to delete + * @since 3.1.0-a4 + */ + $vars = array( + 'post_ids', + 'poster_ids', + 'topic_ids', + 'forum_ids', + 'where_type', + 'where_ids', + 'delete_notifications_types', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_after', compact($vars))); + + // Resync topics_posted table + if ($posted_sync) + { + update_posted_info($topic_ids); + } + + if ($auto_sync) + { + sync('topic_reported', 'topic_id', $topic_ids); + sync('topic', 'topic_id', $topic_ids, true); + sync('forum', 'forum_id', $forum_ids, true, true); + } + + if ($approved_posts && $post_count_sync) + { + $config->increment('num_posts', $approved_posts * (-1), false); + } + + // We actually remove topics now to not be inconsistent (the delete_topics function calls this function too) + if (count($remove_topics) && $call_delete_topics) + { + delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false); + } + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->delete_notifications($delete_notifications_types, $post_ids); + + return count($post_ids); +} + +/** +* Deletes shadow topics pointing to a specified forum. +* +* @param int $forum_id The forum id +* @param string $sql_more Additional WHERE statement, e.g. t.topic_time < (time() - 1234) +* @param bool $auto_sync Will call sync() if this is true +* +* @return array Array with affected forums +*/ +function delete_topic_shadows($forum_id, $sql_more = '', $auto_sync = true) +{ + global $db; + + if (!$forum_id) + { + // Nothing to do. + return; + } + + // Set of affected forums we have to resync + $sync_forum_ids = array(); + + // Amount of topics we select and delete at once. + $batch_size = 500; + + do + { + $sql = 'SELECT t2.forum_id, t2.topic_id + FROM ' . TOPICS_TABLE . ' t2, ' . TOPICS_TABLE . ' t + WHERE t2.topic_moved_id = t.topic_id + AND t.forum_id = ' . (int) $forum_id . ' + ' . (($sql_more) ? 'AND ' . $sql_more : ''); + $result = $db->sql_query_limit($sql, $batch_size); + + $topic_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = (int) $row['topic_id']; + + $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + + if (!empty($topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + } + while (count($topic_ids) == $batch_size); + + if ($auto_sync) + { + sync('forum', 'forum_id', $sync_forum_ids, true, true); + } + + return $sync_forum_ids; +} + +/** +* Update/Sync posted information for topics +*/ +function update_posted_info(&$topic_ids) +{ + global $db, $config; + + if (empty($topic_ids) || !$config['load_db_track']) + { + return; + } + + // First of all, let us remove any posted information for these topics + $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + + // Now, let us collect the user/topic combos for rebuilding the information + $sql = 'SELECT poster_id, topic_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + AND poster_id <> ' . ANONYMOUS . ' + GROUP BY poster_id, topic_id'; + $result = $db->sql_query($sql); + + $posted = array(); + while ($row = $db->sql_fetchrow($result)) + { + // Add as key to make them unique (grouping by) and circumvent empty keys on array_unique + $posted[$row['poster_id']][] = $row['topic_id']; + } + $db->sql_freeresult($result); + + // Now add the information... + $sql_ary = array(); + foreach ($posted as $user_id => $topic_row) + { + foreach ($topic_row as $topic_id) + { + $sql_ary[] = array( + 'user_id' => (int) $user_id, + 'topic_id' => (int) $topic_id, + 'topic_posted' => 1, + ); + } + } + unset($posted); + + $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); +} + +/** +* All-encompasing sync function +* +* Exaples: +* +* sync('topic', 'topic_id', 123); // resync topic #123 +* sync('topic', 'forum_id', array(2, 3)); // resync topics from forum #2 and #3 +* sync('topic'); // resync all topics +* sync('topic', 'range', 'topic_id BETWEEN 1 AND 60'); // resync a range of topics/forums (only available for 'topic' and 'forum' modes) +* +* +* Modes: +* - forum Resync complete forum +* - topic Resync topics +* - topic_moved Removes topic shadows that would be in the same forum as the topic they link to +* - topic_visibility Resyncs the topic_visibility flag according to the status of the first post +* - post_reported Resyncs the post_reported flag, relying on actual reports +* - topic_reported Resyncs the topic_reported flag, relying on post_reported flags +* - post_attachement Same as post_reported, but with attachment flags +* - topic_attachement Same as topic_reported, but with attachment flags +*/ +function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sync_extra = false) +{ + global $db; + + if (is_array($where_ids)) + { + $where_ids = array_unique($where_ids); + $where_ids = array_map('intval', $where_ids); + } + else if ($where_type != 'range') + { + $where_ids = ($where_ids) ? array((int) $where_ids) : array(); + } + + if ($mode == 'forum' || $mode == 'topic' || $mode == 'topic_visibility' || $mode == 'topic_reported' || $mode == 'post_reported') + { + if (!$where_type) + { + $where_sql = ''; + $where_sql_and = 'WHERE'; + } + else if ($where_type == 'range') + { + // Only check a range of topics/forums. For instance: 'topic_id BETWEEN 1 AND 60' + $where_sql = 'WHERE (' . $mode[0] . ".$where_ids)"; + $where_sql_and = $where_sql . "\n\tAND"; + } + else + { + // Do not sync the "global forum" + $where_ids = array_diff($where_ids, array(0)); + + if (!count($where_ids)) + { + // Empty array with IDs. This means that we don't have any work to do. Just return. + return; + } + + // Limit the topics/forums we are syncing, use specific topic/forum IDs. + // $where_type contains the field for the where clause (forum_id, topic_id) + $where_sql = 'WHERE ' . $db->sql_in_set($mode[0] . '.' . $where_type, $where_ids); + $where_sql_and = $where_sql . "\n\tAND"; + } + } + else + { + if (!count($where_ids)) + { + return; + } + + // $where_type contains the field for the where clause (forum_id, topic_id) + $where_sql = 'WHERE ' . $db->sql_in_set($mode[0] . '.' . $where_type, $where_ids); + $where_sql_and = $where_sql . "\n\tAND"; + } + + switch ($mode) + { + case 'topic_moved': + $db->sql_transaction('begin'); + switch ($db->get_sql_layer()) + { + case 'mysqli': + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + USING ' . TOPICS_TABLE . ' t1, ' . TOPICS_TABLE . " t2 + WHERE t1.topic_moved_id = t2.topic_id + AND t1.forum_id = t2.forum_id"; + $db->sql_query($sql); + break; + + default: + $sql = 'SELECT t1.topic_id + FROM ' .TOPICS_TABLE . ' t1, ' . TOPICS_TABLE . " t2 + WHERE t1.topic_moved_id = t2.topic_id + AND t1.forum_id = t2.forum_id"; + $result = $db->sql_query($sql); + + $topic_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_id_ary[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (!count($topic_id_ary)) + { + return; + } + + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_id_ary); + $db->sql_query($sql); + + break; + } + + $db->sql_transaction('commit'); + break; + + case 'topic_visibility': + + $db->sql_transaction('begin'); + + $sql = 'SELECT t.topic_id, p.post_visibility + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + $where_sql_and p.topic_id = t.topic_id + AND p.post_visibility = " . ITEM_APPROVED; + $result = $db->sql_query($sql); + + $topics_approved = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topics_approved[] = (int) $row['topic_id']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT t.topic_id, p.post_visibility + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + $where_sql_and " . $db->sql_in_set('t.topic_id', $topics_approved, true, true) . ' + AND p.topic_id = t.topic_id + AND p.post_visibility = ' . ITEM_DELETED; + $result = $db->sql_query($sql); + + $topics_softdeleted = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topics_softdeleted[] = (int) $row['topic_id']; + } + $db->sql_freeresult($result); + + $topics_softdeleted = array_diff($topics_softdeleted, $topics_approved); + $topics_not_unapproved = array_merge($topics_softdeleted, $topics_approved); + + $update_ary = array( + ITEM_UNAPPROVED => (!empty($topics_not_unapproved)) ? $where_sql_and . ' ' . $db->sql_in_set('topic_id', $topics_not_unapproved, true) : '', + ITEM_APPROVED => (!empty($topics_approved)) ? ' WHERE ' . $db->sql_in_set('topic_id', $topics_approved) : '', + ITEM_DELETED => (!empty($topics_softdeleted)) ? ' WHERE ' . $db->sql_in_set('topic_id', $topics_softdeleted) : '', + ); + + foreach ($update_ary as $visibility => $sql_where) + { + if ($sql_where) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_visibility = ' . $visibility . ' + ' . $sql_where; + $db->sql_query($sql); + } + } + + $db->sql_transaction('commit'); + break; + + case 'post_reported': + $post_ids = $post_reported = array(); + + $db->sql_transaction('begin'); + + $sql = 'SELECT p.post_id, p.post_reported + FROM ' . POSTS_TABLE . " p + $where_sql + GROUP BY p.post_id, p.post_reported"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $post_ids[$row['post_id']] = $row['post_id']; + if ($row['post_reported']) + { + $post_reported[$row['post_id']] = 1; + } + } + $db->sql_freeresult($result); + + $sql = 'SELECT DISTINCT(post_id) + FROM ' . REPORTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_id', $post_ids) . ' + AND report_closed = 0'; + $result = $db->sql_query($sql); + + $post_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($post_reported[$row['post_id']])) + { + $post_ids[] = $row['post_id']; + } + else + { + unset($post_reported[$row['post_id']]); + } + } + $db->sql_freeresult($result); + + // $post_reported should be empty by now, if it's not it contains + // posts that are falsely flagged as reported + foreach ($post_reported as $post_id => $void) + { + $post_ids[] = $post_id; + } + + if (count($post_ids)) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_reported = 1 - post_reported + WHERE ' . $db->sql_in_set('post_id', $post_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + break; + + case 'topic_reported': + if ($sync_extra) + { + sync('post_reported', $where_type, $where_ids); + } + + $topic_ids = $topic_reported = array(); + + $db->sql_transaction('begin'); + + $sql = 'SELECT DISTINCT(t.topic_id) + FROM ' . POSTS_TABLE . " t + $where_sql_and t.post_reported = 1"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_reported[$row['topic_id']] = 1; + } + $db->sql_freeresult($result); + + $sql = 'SELECT t.topic_id, t.topic_reported + FROM ' . TOPICS_TABLE . " t + $where_sql"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_reported'] ^ isset($topic_reported[$row['topic_id']])) + { + $topic_ids[] = $row['topic_id']; + } + } + $db->sql_freeresult($result); + + if (count($topic_ids)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_reported = 1 - topic_reported + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + break; + + case 'post_attachment': + $post_ids = $post_attachment = array(); + + $db->sql_transaction('begin'); + + $sql = 'SELECT p.post_id, p.post_attachment + FROM ' . POSTS_TABLE . " p + $where_sql + GROUP BY p.post_id, p.post_attachment"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $post_ids[$row['post_id']] = $row['post_id']; + if ($row['post_attachment']) + { + $post_attachment[$row['post_id']] = 1; + } + } + $db->sql_freeresult($result); + + $sql = 'SELECT DISTINCT(post_msg_id) + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $post_ids) . ' + AND in_message = 0'; + $result = $db->sql_query($sql); + + $post_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($post_attachment[$row['post_msg_id']])) + { + $post_ids[] = $row['post_msg_id']; + } + else + { + unset($post_attachment[$row['post_msg_id']]); + } + } + $db->sql_freeresult($result); + + // $post_attachment should be empty by now, if it's not it contains + // posts that are falsely flagged as having attachments + foreach ($post_attachment as $post_id => $void) + { + $post_ids[] = $post_id; + } + + if (count($post_ids)) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_attachment = 1 - post_attachment + WHERE ' . $db->sql_in_set('post_id', $post_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + break; + + case 'topic_attachment': + if ($sync_extra) + { + sync('post_attachment', $where_type, $where_ids); + } + + $topic_ids = $topic_attachment = array(); + + $db->sql_transaction('begin'); + + $sql = 'SELECT DISTINCT(t.topic_id) + FROM ' . POSTS_TABLE . " t + $where_sql_and t.post_attachment = 1"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_attachment[$row['topic_id']] = 1; + } + $db->sql_freeresult($result); + + $sql = 'SELECT t.topic_id, t.topic_attachment + FROM ' . TOPICS_TABLE . " t + $where_sql"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_attachment'] ^ isset($topic_attachment[$row['topic_id']])) + { + $topic_ids[] = $row['topic_id']; + } + } + $db->sql_freeresult($result); + + if (count($topic_ids)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_attachment = 1 - topic_attachment + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + break; + + case 'forum': + + $db->sql_transaction('begin'); + + // 1: Get the list of all forums + $sql = 'SELECT f.* + FROM ' . FORUMS_TABLE . " f + $where_sql"; + $result = $db->sql_query($sql); + + $forum_data = $forum_ids = $post_ids = $last_post_id = $post_info = array(); + while ($row = $db->sql_fetchrow($result)) + { + if ($row['forum_type'] == FORUM_LINK) + { + continue; + } + + $forum_id = (int) $row['forum_id']; + $forum_ids[$forum_id] = $forum_id; + + $forum_data[$forum_id] = $row; + if ($sync_extra) + { + $forum_data[$forum_id]['posts_approved'] = 0; + $forum_data[$forum_id]['posts_unapproved'] = 0; + $forum_data[$forum_id]['posts_softdeleted'] = 0; + $forum_data[$forum_id]['topics_approved'] = 0; + $forum_data[$forum_id]['topics_unapproved'] = 0; + $forum_data[$forum_id]['topics_softdeleted'] = 0; + } + $forum_data[$forum_id]['last_post_id'] = 0; + $forum_data[$forum_id]['last_post_subject'] = ''; + $forum_data[$forum_id]['last_post_time'] = 0; + $forum_data[$forum_id]['last_poster_id'] = 0; + $forum_data[$forum_id]['last_poster_name'] = ''; + $forum_data[$forum_id]['last_poster_colour'] = ''; + } + $db->sql_freeresult($result); + + if (!count($forum_ids)) + { + break; + } + + $forum_ids = array_values($forum_ids); + + // 2: Get topic counts for each forum (optional) + if ($sync_extra) + { + $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS total_topics + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . ' + GROUP BY forum_id, topic_visibility'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_id = (int) $row['forum_id']; + + if ($row['topic_visibility'] == ITEM_APPROVED) + { + $forum_data[$forum_id]['topics_approved'] = $row['total_topics']; + } + else if ($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) + { + $forum_data[$forum_id]['topics_unapproved'] = $row['total_topics']; + } + else if ($row['topic_visibility'] == ITEM_DELETED) + { + $forum_data[$forum_id]['topics_softdeleted'] = $row['total_topics']; + } + } + $db->sql_freeresult($result); + } + + // 3: Get post count for each forum (optional) + if ($sync_extra) + { + if (count($forum_ids) == 1) + { + $sql = 'SELECT SUM(t.topic_posts_approved) AS forum_posts_approved, SUM(t.topic_posts_unapproved) AS forum_posts_unapproved, SUM(t.topic_posts_softdeleted) AS forum_posts_softdeleted + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' + AND t.topic_status <> ' . ITEM_MOVED; + } + else + { + $sql = 'SELECT t.forum_id, SUM(t.topic_posts_approved) AS forum_posts_approved, SUM(t.topic_posts_unapproved) AS forum_posts_unapproved, SUM(t.topic_posts_softdeleted) AS forum_posts_softdeleted + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' + AND t.topic_status <> ' . ITEM_MOVED . ' + GROUP BY t.forum_id'; + } + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_id = (count($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; + + $forum_data[$forum_id]['posts_approved'] = (int) $row['forum_posts_approved']; + $forum_data[$forum_id]['posts_unapproved'] = (int) $row['forum_posts_unapproved']; + $forum_data[$forum_id]['posts_softdeleted'] = (int) $row['forum_posts_softdeleted']; + } + $db->sql_freeresult($result); + } + + // 4: Get last_post_id for each forum + if (count($forum_ids) == 1) + { + $sql = 'SELECT MAX(t.topic_last_post_id) as last_post_id + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' + AND t.topic_visibility = ' . ITEM_APPROVED; + } + else + { + $sql = 'SELECT t.forum_id, MAX(t.topic_last_post_id) as last_post_id + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' + AND t.topic_visibility = ' . ITEM_APPROVED . ' + GROUP BY t.forum_id'; + } + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_id = (count($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; + + $forum_data[$forum_id]['last_post_id'] = (int) $row['last_post_id']; + + $post_ids[] = $row['last_post_id']; + } + $db->sql_freeresult($result); + + // 5: Retrieve last_post infos + if (count($post_ids)) + { + $sql = 'SELECT p.post_id, p.poster_id, p.post_subject, p.post_time, p.post_username, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' + AND p.poster_id = u.user_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $post_info[$row['post_id']] = $row; + } + $db->sql_freeresult($result); + + foreach ($forum_data as $forum_id => $data) + { + if ($data['last_post_id']) + { + if (isset($post_info[$data['last_post_id']])) + { + $forum_data[$forum_id]['last_post_subject'] = $post_info[$data['last_post_id']]['post_subject']; + $forum_data[$forum_id]['last_post_time'] = $post_info[$data['last_post_id']]['post_time']; + $forum_data[$forum_id]['last_poster_id'] = $post_info[$data['last_post_id']]['poster_id']; + $forum_data[$forum_id]['last_poster_name'] = ($post_info[$data['last_post_id']]['poster_id'] != ANONYMOUS) ? $post_info[$data['last_post_id']]['username'] : $post_info[$data['last_post_id']]['post_username']; + $forum_data[$forum_id]['last_poster_colour'] = $post_info[$data['last_post_id']]['user_colour']; + } + else + { + // For some reason we did not find the post in the db + $forum_data[$forum_id]['last_post_id'] = 0; + $forum_data[$forum_id]['last_post_subject'] = ''; + $forum_data[$forum_id]['last_post_time'] = 0; + $forum_data[$forum_id]['last_poster_id'] = 0; + $forum_data[$forum_id]['last_poster_name'] = ''; + $forum_data[$forum_id]['last_poster_colour'] = ''; + } + } + } + unset($post_info); + } + + // 6: Now do that thing + $fieldnames = array('last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); + + if ($sync_extra) + { + array_push($fieldnames, 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'topics_approved', 'topics_unapproved', 'topics_softdeleted'); + } + + foreach ($forum_data as $forum_id => $row) + { + $sql_ary = array(); + + foreach ($fieldnames as $fieldname) + { + if ($row['forum_' . $fieldname] != $row[$fieldname]) + { + if (preg_match('#(name|colour|subject)$#', $fieldname)) + { + $sql_ary['forum_' . $fieldname] = (string) $row[$fieldname]; + } + else + { + $sql_ary['forum_' . $fieldname] = (int) $row[$fieldname]; + } + } + } + + if (count($sql_ary)) + { + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE forum_id = ' . $forum_id; + $db->sql_query($sql); + } + } + + $db->sql_transaction('commit'); + break; + + case 'topic': + $topic_data = $post_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array(); + + $db->sql_transaction('begin'); + + $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_visibility, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time + FROM ' . TOPICS_TABLE . " t + $where_sql"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_moved_id']) + { + $moved_topics[] = $row['topic_id']; + continue; + } + + $topic_id = (int) $row['topic_id']; + $topic_data[$topic_id] = $row; + $topic_data[$topic_id]['visibility'] = ITEM_UNAPPROVED; + $topic_data[$topic_id]['posts_approved'] = 0; + $topic_data[$topic_id]['posts_unapproved'] = 0; + $topic_data[$topic_id]['posts_softdeleted'] = 0; + $topic_data[$topic_id]['first_post_id'] = 0; + $topic_data[$topic_id]['last_post_id'] = 0; + unset($topic_data[$topic_id]['topic_id']); + + // This array holds all topic_ids + $delete_topics[$topic_id] = ''; + + if ($sync_extra) + { + $topic_data[$topic_id]['reported'] = 0; + $topic_data[$topic_id]['attachment'] = 0; + } + } + $db->sql_freeresult($result); + + // Use "t" as table alias because of the $where_sql clause + // NOTE: 't.post_visibility' in the GROUP BY is causing a major slowdown. + $sql = 'SELECT t.topic_id, t.post_visibility, COUNT(t.post_id) AS total_posts, MIN(t.post_id) AS first_post_id, MAX(t.post_id) AS last_post_id + FROM ' . POSTS_TABLE . " t + $where_sql + GROUP BY t.topic_id, t.post_visibility"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id = (int) $row['topic_id']; + + $row['first_post_id'] = (int) $row['first_post_id']; + $row['last_post_id'] = (int) $row['last_post_id']; + + if (!isset($topic_data[$topic_id])) + { + // Hey, these posts come from a topic that does not exist + $delete_posts[$topic_id] = ''; + } + else + { + // Unset the corresponding entry in $delete_topics + // When we'll be done, only topics with no posts will remain + unset($delete_topics[$topic_id]); + + if ($row['post_visibility'] == ITEM_APPROVED) + { + $topic_data[$topic_id]['posts_approved'] = $row['total_posts']; + } + else if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) + { + $topic_data[$topic_id]['posts_unapproved'] = $row['total_posts']; + } + else if ($row['post_visibility'] == ITEM_DELETED) + { + $topic_data[$topic_id]['posts_softdeleted'] = $row['total_posts']; + } + + if ($row['post_visibility'] == ITEM_APPROVED) + { + $topic_data[$topic_id]['visibility'] = ITEM_APPROVED; + $topic_data[$topic_id]['first_post_id'] = $row['first_post_id']; + $topic_data[$topic_id]['last_post_id'] = $row['last_post_id']; + } + else if ($topic_data[$topic_id]['visibility'] != ITEM_APPROVED) + { + // If there is no approved post, we take the min/max of the other visibilities + // for the last and first post info, because it is only visible to moderators anyway + $topic_data[$topic_id]['first_post_id'] = (!empty($topic_data[$topic_id]['first_post_id'])) ? min($topic_data[$topic_id]['first_post_id'], $row['first_post_id']) : $row['first_post_id']; + $topic_data[$topic_id]['last_post_id'] = max($topic_data[$topic_id]['last_post_id'], $row['last_post_id']); + + if ($topic_data[$topic_id]['visibility'] == ITEM_UNAPPROVED || $topic_data[$topic_id]['visibility'] == ITEM_REAPPROVE) + { + // Soft delete status is stronger than unapproved. + $topic_data[$topic_id]['visibility'] = $row['post_visibility']; + } + } + } + } + $db->sql_freeresult($result); + + foreach ($topic_data as $topic_id => $row) + { + $post_ids[] = $row['first_post_id']; + if ($row['first_post_id'] != $row['last_post_id']) + { + $post_ids[] = $row['last_post_id']; + } + } + + // Now we delete empty topics and orphan posts + if (count($delete_posts)) + { + delete_posts('topic_id', array_keys($delete_posts), false); + unset($delete_posts); + } + + if (!count($topic_data)) + { + // If we get there, topic ids were invalid or topics did not contain any posts + delete_topics($where_type, $where_ids, true); + return; + } + + if (count($delete_topics)) + { + $delete_topic_ids = array(); + foreach ($delete_topics as $topic_id => $void) + { + unset($topic_data[$topic_id]); + $delete_topic_ids[] = $topic_id; + } + + delete_topics('topic_id', $delete_topic_ids, false); + unset($delete_topics, $delete_topic_ids); + } + + $sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' + AND u.user_id = p.poster_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id = intval($row['topic_id']); + + if ($row['post_id'] == $topic_data[$topic_id]['first_post_id']) + { + $topic_data[$topic_id]['time'] = $row['post_time']; + $topic_data[$topic_id]['poster'] = $row['poster_id']; + $topic_data[$topic_id]['first_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; + $topic_data[$topic_id]['first_poster_colour'] = $row['user_colour']; + } + + if ($row['post_id'] == $topic_data[$topic_id]['last_post_id']) + { + $topic_data[$topic_id]['last_poster_id'] = $row['poster_id']; + $topic_data[$topic_id]['last_post_subject'] = $row['post_subject']; + $topic_data[$topic_id]['last_post_time'] = $row['post_time']; + $topic_data[$topic_id]['last_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; + $topic_data[$topic_id]['last_poster_colour'] = $row['user_colour']; + } + } + $db->sql_freeresult($result); + + // Make sure shadow topics do link to existing topics + if (count($moved_topics)) + { + $delete_topics = array(); + + $sql = 'SELECT t1.topic_id, t1.topic_moved_id + FROM ' . TOPICS_TABLE . ' t1 + LEFT JOIN ' . TOPICS_TABLE . ' t2 ON (t2.topic_id = t1.topic_moved_id) + WHERE ' . $db->sql_in_set('t1.topic_id', $moved_topics) . ' + AND t2.topic_id IS NULL'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $delete_topics[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (count($delete_topics)) + { + delete_topics('topic_id', $delete_topics, false); + } + unset($delete_topics); + + // Make sure shadow topics having no last post data being updated (this only rarely happens...) + $sql = 'SELECT topic_id, topic_moved_id, topic_last_post_id, topic_first_post_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $moved_topics) . ' + AND topic_last_post_time = 0'; + $result = $db->sql_query($sql); + + $shadow_topic_data = $post_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $shadow_topic_data[$row['topic_moved_id']] = $row; + $post_ids[] = $row['topic_last_post_id']; + $post_ids[] = $row['topic_first_post_id']; + } + $db->sql_freeresult($result); + + $sync_shadow_topics = array(); + if (count($post_ids)) + { + $sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' + AND u.user_id = p.poster_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id = (int) $row['topic_id']; + + // Ok, there should be a shadow topic. If there isn't, then there's something wrong with the db. + // However, there's not much we can do about it. + if (!empty($shadow_topic_data[$topic_id])) + { + if ($row['post_id'] == $shadow_topic_data[$topic_id]['topic_first_post_id']) + { + $orig_topic_id = $shadow_topic_data[$topic_id]['topic_id']; + + if (!isset($sync_shadow_topics[$orig_topic_id])) + { + $sync_shadow_topics[$orig_topic_id] = array(); + } + + $sync_shadow_topics[$orig_topic_id]['topic_time'] = $row['post_time']; + $sync_shadow_topics[$orig_topic_id]['topic_poster'] = $row['poster_id']; + $sync_shadow_topics[$orig_topic_id]['topic_first_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; + $sync_shadow_topics[$orig_topic_id]['topic_first_poster_colour'] = $row['user_colour']; + } + + if ($row['post_id'] == $shadow_topic_data[$topic_id]['topic_last_post_id']) + { + $orig_topic_id = $shadow_topic_data[$topic_id]['topic_id']; + + if (!isset($sync_shadow_topics[$orig_topic_id])) + { + $sync_shadow_topics[$orig_topic_id] = array(); + } + + $sync_shadow_topics[$orig_topic_id]['topic_last_poster_id'] = $row['poster_id']; + $sync_shadow_topics[$orig_topic_id]['topic_last_post_subject'] = $row['post_subject']; + $sync_shadow_topics[$orig_topic_id]['topic_last_post_time'] = $row['post_time']; + $sync_shadow_topics[$orig_topic_id]['topic_last_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; + $sync_shadow_topics[$orig_topic_id]['topic_last_poster_colour'] = $row['user_colour']; + } + } + } + $db->sql_freeresult($result); + + $shadow_topic_data = array(); + + // Update the information we collected + if (count($sync_shadow_topics)) + { + foreach ($sync_shadow_topics as $sync_topic_id => $sql_ary) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE topic_id = ' . $sync_topic_id; + $db->sql_query($sql); + } + } + } + + unset($sync_shadow_topics, $shadow_topic_data); + } + + // These are fields that will be synchronised + $fieldnames = array('time', 'visibility', 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); + + if ($sync_extra) + { + // This routine assumes that post_reported values are correct + // if they are not, use sync('post_reported') first + $sql = 'SELECT t.topic_id, p.post_id + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + $where_sql_and p.topic_id = t.topic_id + AND p.post_reported = 1 + GROUP BY t.topic_id, p.post_id"; + $result = $db->sql_query($sql); + + $fieldnames[] = 'reported'; + while ($row = $db->sql_fetchrow($result)) + { + $topic_data[intval($row['topic_id'])]['reported'] = 1; + } + $db->sql_freeresult($result); + + // This routine assumes that post_attachment values are correct + // if they are not, use sync('post_attachment') first + $sql = 'SELECT t.topic_id, p.post_id + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + $where_sql_and p.topic_id = t.topic_id + AND p.post_attachment = 1 + GROUP BY t.topic_id, p.post_id"; + $result = $db->sql_query($sql); + + $fieldnames[] = 'attachment'; + while ($row = $db->sql_fetchrow($result)) + { + $topic_data[intval($row['topic_id'])]['attachment'] = 1; + } + $db->sql_freeresult($result); + } + + foreach ($topic_data as $topic_id => $row) + { + $sql_ary = array(); + + foreach ($fieldnames as $fieldname) + { + if (isset($row[$fieldname]) && isset($row['topic_' . $fieldname]) && $row['topic_' . $fieldname] != $row[$fieldname]) + { + $sql_ary['topic_' . $fieldname] = $row[$fieldname]; + } + } + + if (count($sql_ary)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE topic_id = ' . $topic_id; + $db->sql_query($sql); + + $resync_forums[$row['forum_id']] = $row['forum_id']; + } + } + unset($topic_data); + + $db->sql_transaction('commit'); + + // if some topics have been resync'ed then resync parent forums + // except when we're only syncing a range, we don't want to sync forums during + // batch processing. + if ($resync_parents && count($resync_forums) && $where_type != 'range') + { + sync('forum', 'forum_id', array_values($resync_forums), true, true); + } + break; + } + + return; +} + +/** +* Prune function +*/ +function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync = true, $prune_limit = 0) +{ + global $db, $phpbb_dispatcher; + + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + if (!count($forum_id)) + { + return; + } + + $sql_and = ''; + + if (!($prune_flags & FORUM_FLAG_PRUNE_ANNOUNCE)) + { + $sql_and .= ' AND topic_type <> ' . POST_ANNOUNCE; + $sql_and .= ' AND topic_type <> ' . POST_GLOBAL; + } + + if (!($prune_flags & FORUM_FLAG_PRUNE_STICKY)) + { + $sql_and .= ' AND topic_type <> ' . POST_STICKY; + } + + if ($prune_mode == 'posted') + { + $sql_and .= " AND topic_last_post_time < $prune_date"; + } + + if ($prune_mode == 'viewed') + { + $sql_and .= " AND topic_last_view_time < $prune_date"; + } + + if ($prune_mode == 'shadow') + { + $sql_and .= ' AND topic_status = ' . ITEM_MOVED . " AND topic_last_post_time < $prune_date"; + } + + /** + * Use this event to modify the SQL that selects topics to be pruned + * + * @event core.prune_sql + * @var string forum_id The forum id + * @var string prune_mode The prune mode + * @var string prune_date The prune date + * @var int prune_flags The prune flags + * @var bool auto_sync Whether or not to perform auto sync + * @var string sql_and SQL text appended to where clause + * @var int prune_limit The prune limit + * @since 3.1.3-RC1 + * @changed 3.1.10-RC1 Added prune_limit + */ + $vars = array( + 'forum_id', + 'prune_mode', + 'prune_date', + 'prune_flags', + 'auto_sync', + 'sql_and', + 'prune_limit', + ); + extract($phpbb_dispatcher->trigger_event('core.prune_sql', compact($vars))); + + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id) . " + AND poll_start = 0 + $sql_and"; + $result = $db->sql_query_limit($sql, $prune_limit); + + $topic_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_list[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if ($prune_flags & FORUM_FLAG_PRUNE_POLL) + { + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id) . " + AND poll_start > 0 + AND poll_last_vote < $prune_date + $sql_and"; + $result = $db->sql_query_limit($sql, $prune_limit); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_list[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + $topic_list = array_unique($topic_list); + } + + /** + * Perform additional actions before topic deletion via pruning + * + * @event core.prune_delete_before + * @var int[] topic_list The IDs of the topics to be deleted + * @since 3.2.2-RC1 + */ + $vars = array('topic_list'); + extract($phpbb_dispatcher->trigger_event('core.prune_delete_before', compact($vars))); + + return delete_topics('topic_id', $topic_list, $auto_sync, false); +} + +/** +* Function auto_prune(), this function now relies on passed vars +*/ +function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_freq) +{ + global $db, $user, $phpbb_log; + + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql, 3600); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $prune_date = time() - ($prune_days * 86400); + $next_prune = time() + ($prune_freq * 86400); + + $result = prune($forum_id, $prune_mode, $prune_date, $prune_flags, true, 300); + + if ($result['topics'] == 0 && $result['posts'] == 0) + { + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET prune_next = $next_prune + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_AUTO_PRUNE', false, array($row['forum_name'])); + } + + return; +} + +/** +* Cache moderators. Called whenever permissions are changed +* via admin_permissions. Changes of usernames and group names +* must be carried through for the moderators table. +* +* @param \phpbb\db\driver\driver_interface $db Database connection +* @param \phpbb\cache\driver\driver_interface Cache driver +* @param \phpbb\auth\auth $auth Authentication object +* @return null +*/ +function phpbb_cache_moderators($db, $cache, $auth) +{ + // Remove cached sql results + $cache->destroy('sql', MODERATOR_CACHE_TABLE); + + // Clear table + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $db->sql_query('DELETE FROM ' . MODERATOR_CACHE_TABLE); + break; + + default: + $db->sql_query('TRUNCATE TABLE ' . MODERATOR_CACHE_TABLE); + break; + } + + // We add moderators who have forum moderator permissions without an explicit ACL_NEVER setting + $sql_ary = array(); + + // Grab all users having moderative options... + $hold_ary = $auth->acl_user_raw_data(false, 'm_%', false); + + // Add users? + if (!empty($hold_ary)) + { + // At least one moderative option warrants a display + $ug_id_ary = array_keys($hold_ary); + + // Remove users who have group memberships with DENY moderator permissions + $sql_ary_deny = array( + 'SELECT' => 'a.forum_id, ug.user_id, g.group_id', + + 'FROM' => array( + ACL_OPTIONS_TABLE => 'o', + USER_GROUP_TABLE => 'ug', + GROUPS_TABLE => 'g', + ACL_GROUPS_TABLE => 'a', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(ACL_ROLES_DATA_TABLE => 'r'), + 'ON' => 'a.auth_role_id = r.role_id', + ), + ), + + 'WHERE' => '(o.auth_option_id = a.auth_option_id OR o.auth_option_id = r.auth_option_id) + AND ((a.auth_setting = ' . ACL_NEVER . ' AND r.auth_setting IS NULL) + OR r.auth_setting = ' . ACL_NEVER . ') + AND a.group_id = ug.group_id + AND g.group_id = ug.group_id + AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) + AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . " + AND ug.user_pending = 0 + AND o.auth_option " . $db->sql_like_expression('m_' . $db->get_any_char()), + ); + $sql = $db->sql_build_query('SELECT', $sql_ary_deny); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (isset($hold_ary[$row['user_id']][$row['forum_id']])) + { + unset($hold_ary[$row['user_id']][$row['forum_id']]); + } + } + $db->sql_freeresult($result); + + if (count($hold_ary)) + { + // Get usernames... + $sql = 'SELECT user_id, username + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', array_keys($hold_ary)); + $result = $db->sql_query($sql); + + $usernames_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $usernames_ary[$row['user_id']] = $row['username']; + } + $db->sql_freeresult($result); + + foreach ($hold_ary as $user_id => $forum_id_ary) + { + // Do not continue if user does not exist + if (!isset($usernames_ary[$user_id])) + { + continue; + } + + foreach ($forum_id_ary as $forum_id => $auth_ary) + { + $sql_ary[] = array( + 'forum_id' => (int) $forum_id, + 'user_id' => (int) $user_id, + 'username' => (string) $usernames_ary[$user_id], + 'group_id' => 0, + 'group_name' => '' + ); + } + } + } + } + + // Now to the groups... + $hold_ary = $auth->acl_group_raw_data(false, 'm_%', false); + + if (!empty($hold_ary)) + { + $ug_id_ary = array_keys($hold_ary); + + // Make sure not hidden or special groups are involved... + $sql = 'SELECT group_name, group_id, group_type + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_id', $ug_id_ary); + $result = $db->sql_query($sql); + + $groupnames_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + if ($row['group_type'] == GROUP_HIDDEN || $row['group_type'] == GROUP_SPECIAL) + { + unset($hold_ary[$row['group_id']]); + } + + $groupnames_ary[$row['group_id']] = $row['group_name']; + } + $db->sql_freeresult($result); + + foreach ($hold_ary as $group_id => $forum_id_ary) + { + // If there is no group, we do not assign it... + if (!isset($groupnames_ary[$group_id])) + { + continue; + } + + foreach ($forum_id_ary as $forum_id => $auth_ary) + { + $flag = false; + foreach ($auth_ary as $auth_option => $setting) + { + // Make sure at least one ACL_YES option is set... + if ($setting == ACL_YES) + { + $flag = true; + break; + } + } + + if (!$flag) + { + continue; + } + + $sql_ary[] = array( + 'forum_id' => (int) $forum_id, + 'user_id' => 0, + 'username' => '', + 'group_id' => (int) $group_id, + 'group_name' => (string) $groupnames_ary[$group_id] + ); + } + } + } + + $db->sql_multi_insert(MODERATOR_CACHE_TABLE, $sql_ary); +} + +/** +* View log +* +* @param string $mode The mode defines which log_type is used and from which log the entry is retrieved +* @param array &$log The result array with the logs +* @param mixed &$log_count If $log_count is set to false, we will skip counting all entries in the database. +* Otherwise an integer with the number of total matching entries is returned. +* @param int $limit Limit the number of entries that are returned +* @param int $offset Offset when fetching the log entries, f.e. when paginating +* @param mixed $forum_id Restrict the log entries to the given forum_id (can also be an array of forum_ids) +* @param int $topic_id Restrict the log entries to the given topic_id +* @param int $user_id Restrict the log entries to the given user_id +* @param int $log_time Only get log entries newer than the given timestamp +* @param string $sort_by SQL order option, e.g. 'l.log_time DESC' +* @param string $keywords Will only return log entries that have the keywords in log_operation or log_data +* +* @return int Returns the offset of the last valid page, if the specified offset was invalid (too high) +*/ +function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC', $keywords = '') +{ + global $phpbb_log; + + $count_logs = ($log_count !== false); + + $log = $phpbb_log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $limit_days, $sort_by, $keywords); + $log_count = $phpbb_log->get_log_count(); + + return $phpbb_log->get_valid_offset(); +} + +/** +* Removes moderators and administrators from foe lists. +* +* @param \phpbb\db\driver\driver_interface $db Database connection +* @param \phpbb\auth\auth $auth Authentication object +* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore +* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore +* @return null +*/ +function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) +{ + // update foes for some user + if (is_array($user_id) && count($user_id)) + { + $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' + WHERE ' . $db->sql_in_set('zebra_id', $user_id) . ' + AND foe = 1'; + $db->sql_query($sql); + return; + } + + // update foes for some group + if (is_array($group_id) && count($group_id)) + { + // Grab group settings... + $sql_ary = array( + 'SELECT' => 'a.group_id', + + 'FROM' => array( + ACL_OPTIONS_TABLE => 'ao', + ACL_GROUPS_TABLE => 'a', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(ACL_ROLES_DATA_TABLE => 'r'), + 'ON' => 'a.auth_role_id = r.role_id', + ), + ), + + 'WHERE' => '(ao.auth_option_id = a.auth_option_id OR ao.auth_option_id = r.auth_option_id) + AND ' . $db->sql_in_set('a.group_id', $group_id) . " + AND ao.auth_option IN ('a_', 'm_')", + + 'GROUP_BY' => 'a.group_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $groups[] = (int) $row['group_id']; + } + $db->sql_freeresult($result); + + if (!count($groups)) + { + return; + } + + switch ($db->get_sql_layer()) + { + case 'mysqli': + $sql = 'DELETE z.* + FROM ' . ZEBRA_TABLE . ' z, ' . USER_GROUP_TABLE . ' ug + WHERE z.zebra_id = ug.user_id + AND z.foe = 1 + AND ' . $db->sql_in_set('ug.group_id', $groups); + $db->sql_query($sql); + break; + + default: + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . ' + WHERE ' . $db->sql_in_set('group_id', $groups); + $result = $db->sql_query($sql); + + $users = array(); + while ($row = $db->sql_fetchrow($result)) + { + $users[] = (int) $row['user_id']; + } + $db->sql_freeresult($result); + + if (count($users)) + { + $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' + WHERE ' . $db->sql_in_set('zebra_id', $users) . ' + AND foe = 1'; + $db->sql_query($sql); + } + break; + } + + return; + } + + // update foes for everyone + $perms = array(); + foreach ($auth->acl_get_list(false, array('a_', 'm_'), false) as $forum_id => $forum_ary) + { + foreach ($forum_ary as $auth_option => $user_ary) + { + $perms = array_merge($perms, $user_ary); + } + } + + if (count($perms)) + { + $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' + WHERE ' . $db->sql_in_set('zebra_id', array_unique($perms)) . ' + AND foe = 1'; + $db->sql_query($sql); + } + unset($perms); +} + +/** +* Lists inactive users +*/ +function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_inactive_time DESC') +{ + global $db, $user; + + $sql = 'SELECT COUNT(user_id) AS user_count + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_INACTIVE . + (($limit_days) ? " AND user_inactive_time >= $limit_days" : ''); + $result = $db->sql_query($sql); + $user_count = (int) $db->sql_fetchfield('user_count'); + $db->sql_freeresult($result); + + if ($user_count == 0) + { + // Save the queries, because there are no users to display + return 0; + } + + if ($offset >= $user_count) + { + $offset = ($offset - $limit < 0) ? 0 : $offset - $limit; + } + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_INACTIVE . + (($limit_days) ? " AND user_inactive_time >= $limit_days" : '') . " + ORDER BY $sort_by"; + $result = $db->sql_query_limit($sql, $limit, $offset); + + while ($row = $db->sql_fetchrow($result)) + { + $row['inactive_reason'] = $user->lang['INACTIVE_REASON_UNKNOWN']; + switch ($row['user_inactive_reason']) + { + case INACTIVE_REGISTER: + $row['inactive_reason'] = $user->lang['INACTIVE_REASON_REGISTER']; + break; + + case INACTIVE_PROFILE: + $row['inactive_reason'] = $user->lang['INACTIVE_REASON_PROFILE']; + break; + + case INACTIVE_MANUAL: + $row['inactive_reason'] = $user->lang['INACTIVE_REASON_MANUAL']; + break; + + case INACTIVE_REMIND: + $row['inactive_reason'] = $user->lang['INACTIVE_REASON_REMIND']; + break; + } + + $users[] = $row; + } + $db->sql_freeresult($result); + + return $offset; +} + +/** +* Lists warned users +*/ +function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_warnings DESC') +{ + global $db; + + $sql = 'SELECT user_id, username, user_colour, user_warnings, user_last_warning + FROM ' . USERS_TABLE . ' + WHERE user_warnings > 0 + ' . (($limit_days) ? "AND user_last_warning >= $limit_days" : '') . " + ORDER BY $sort_by"; + $result = $db->sql_query_limit($sql, $limit, $offset); + $users = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + $sql = 'SELECT count(user_id) AS user_count + FROM ' . USERS_TABLE . ' + WHERE user_warnings > 0 + ' . (($limit_days) ? "AND user_last_warning >= $limit_days" : ''); + $result = $db->sql_query($sql); + $user_count = (int) $db->sql_fetchfield('user_count'); + $db->sql_freeresult($result); + + return; +} + +/** +* Get database size +* Currently only mysql and mssql are supported +*/ +function get_database_size() +{ + global $db, $user, $table_prefix; + + $database_size = false; + + // This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0 + switch ($db->get_sql_layer()) + { + case 'mysqli': + $sql = 'SELECT VERSION() AS mysql_version'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $version = $row['mysql_version']; + + if (preg_match('#(3\.23|[45]\.|10\.[0-9]\.[0-9]{1,2}-+Maria)#', $version)) + { + $db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.|10\.[0-9]\.[0-9]{1,2}-+Maria#', $version)) ? "`{$db->get_db_name()}`" : $db->get_db_name(); + + $sql = 'SHOW TABLE STATUS + FROM ' . $db_name; + $result = $db->sql_query($sql, 7200); + + $database_size = 0; + while ($row = $db->sql_fetchrow($result)) + { + if ((isset($row['Type']) && $row['Type'] != 'MRG_MyISAM') || (isset($row['Engine']) && ($row['Engine'] == 'MyISAM' || $row['Engine'] == 'InnoDB' || $row['Engine'] == 'Aria'))) + { + if ($table_prefix != '') + { + if (strpos($row['Name'], $table_prefix) !== false) + { + $database_size += $row['Data_length'] + $row['Index_length']; + } + } + else + { + $database_size += $row['Data_length'] + $row['Index_length']; + } + } + } + $db->sql_freeresult($result); + } + } + break; + + case 'sqlite3': + global $dbhost; + + if (file_exists($dbhost)) + { + $database_size = filesize($dbhost); + } + + break; + + case 'mssql_odbc': + case 'mssqlnative': + $sql = 'SELECT @@VERSION AS mssql_version'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize + FROM sysfiles'; + + if ($row) + { + // Azure stats are stored elsewhere + if (strpos($row['mssql_version'], 'SQL Azure') !== false) + { + $sql = 'SELECT ((SUM(reserved_page_count) * 8.0) * 1024.0) as dbsize + FROM sys.dm_db_partition_stats'; + } + } + + $result = $db->sql_query($sql, 7200); + $database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false; + $db->sql_freeresult($result); + break; + + case 'postgres': + $sql = "SELECT proname + FROM pg_proc + WHERE proname = 'pg_database_size'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row['proname'] == 'pg_database_size') + { + $database = $db->get_db_name(); + if (strpos($database, '.') !== false) + { + list($database, ) = explode('.', $database); + } + + $sql = "SELECT oid + FROM pg_database + WHERE datname = '$database'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $oid = $row['oid']; + + $sql = 'SELECT pg_database_size(' . $oid . ') as size'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $database_size = $row['size']; + } + break; + + case 'oracle': + $sql = 'SELECT SUM(bytes) as dbsize + FROM user_segments'; + $result = $db->sql_query($sql, 7200); + $database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false; + $db->sql_freeresult($result); + break; + } + + $database_size = ($database_size !== false) ? get_formatted_filesize($database_size) : $user->lang['NOT_AVAILABLE']; + + return $database_size; +} + +/* +* Tidy Warnings +* Remove all warnings which have now expired from the database +* The duration of a warning can be defined by the administrator +* This only removes the warning and reduces the associated count, +* it does not remove the user note recording the contents of the warning +*/ +function tidy_warnings() +{ + global $db, $config; + + $expire_date = time() - ($config['warnings_expire_days'] * 86400); + $warning_list = $user_list = array(); + + $sql = 'SELECT * FROM ' . WARNINGS_TABLE . " + WHERE warning_time < $expire_date"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $warning_list[] = $row['warning_id']; + $user_list[$row['user_id']] = isset($user_list[$row['user_id']]) ? ++$user_list[$row['user_id']] : 1; + } + $db->sql_freeresult($result); + + if (count($warning_list)) + { + $db->sql_transaction('begin'); + + $sql = 'DELETE FROM ' . WARNINGS_TABLE . ' + WHERE ' . $db->sql_in_set('warning_id', $warning_list); + $db->sql_query($sql); + + foreach ($user_list as $user_id => $value) + { + $sql = 'UPDATE ' . USERS_TABLE . " SET user_warnings = user_warnings - $value + WHERE user_id = $user_id"; + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + } + + $config->set('warnings_last_gc', time(), false); +} + +/** +* Tidy database, doing some maintanance tasks +*/ +function tidy_database() +{ + global $config, $db; + + // Here we check permission consistency + + // Sometimes, it can happen permission tables having forums listed which do not exist + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + + $forum_ids = array(0); + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + $db->sql_transaction('begin'); + + // Delete those rows from the acl tables not having listed the forums above + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids, true); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids, true); + $db->sql_query($sql); + + $db->sql_transaction('commit'); + + $config->set('database_last_gc', time(), false); +} + +/** +* Add permission language - this will make sure custom files will be included +*/ +function add_permission_language() +{ + global $user, $phpEx, $phpbb_extension_manager; + + // add permission language files from extensions + $finder = $phpbb_extension_manager->get_finder(); + + $lang_files = $finder + ->prefix('permissions_') + ->suffix(".$phpEx") + ->core_path('language/') + ->extension_directory('/language') + ->find(); + + foreach ($lang_files as $lang_file => $ext_name) + { + if ($ext_name === '/') + { + $user->add_lang($lang_file); + } + else + { + $user->add_lang_ext($ext_name, $lang_file); + } + } +} + +/** + * Enables a particular flag in a bitfield column of a given table. + * + * @param string $table_name The table to update + * @param string $column_name The column containing a bitfield to update + * @param int $flag The binary flag which is OR-ed with the current column value + * @param string $sql_more This string is attached to the sql query generated to update the table. + * + * @return null + */ +function enable_bitfield_column_flag($table_name, $column_name, $flag, $sql_more = '') +{ + global $db; + + $sql = 'UPDATE ' . $table_name . ' + SET ' . $column_name . ' = ' . $db->sql_bit_or($column_name, $flag) . ' + ' . $sql_more; + $db->sql_query($sql); +} diff --git a/install/update/new/includes/functions_compatibility.php b/install/update/new/includes/functions_compatibility.php new file mode 100644 index 0000000..92e24c0 --- /dev/null +++ b/install/update/new/includes/functions_compatibility.php @@ -0,0 +1,675 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Get user avatar +* +* @deprecated 3.1.0-a1 (To be removed: 4.0.0) +* +* @param string $avatar Users assigned avatar name +* @param int $avatar_type Type of avatar +* @param string $avatar_width Width of users avatar +* @param string $avatar_height Height of users avatar +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar image +*/ +function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false, $lazy = false) +{ + // map arguments to new function phpbb_get_avatar() + $row = array( + 'avatar' => $avatar, + 'avatar_type' => $avatar_type, + 'avatar_width' => $avatar_width, + 'avatar_height' => $avatar_height, + ); + + return phpbb_get_avatar($row, $alt, $ignore_config, $lazy); +} + +/** +* Hash the password +* +* @deprecated 3.1.0-a2 (To be removed: 4.0.0) +* +* @param string $password Password to be hashed +* +* @return string|bool Password hash or false if something went wrong during hashing +*/ +function phpbb_hash($password) +{ + global $phpbb_container; + + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + return $passwords_manager->hash($password); +} + +/** +* Check for correct password +* +* @deprecated 3.1.0-a2 (To be removed: 4.0.0) +* +* @param string $password The password in plain text +* @param string $hash The stored password hash +* +* @return bool Returns true if the password is correct, false if not. +*/ +function phpbb_check_hash($password, $hash) +{ + global $phpbb_container; + + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + return $passwords_manager->check($password, $hash); +} + +/** +* Eliminates useless . and .. components from specified path. +* +* Deprecated, use filesystem class instead +* +* @param string $path Path to clean +* @return string Cleaned path +* +* @deprecated 3.1.0 (To be removed: 4.0.0) +*/ +function phpbb_clean_path($path) +{ + global $phpbb_path_helper, $phpbb_container; + + if (!$phpbb_path_helper && $phpbb_container) + { + /* @var $phpbb_path_helper \phpbb\path_helper */ + $phpbb_path_helper = $phpbb_container->get('path_helper'); + } + else if (!$phpbb_path_helper) + { + global $phpbb_root_path, $phpEx; + + // The container is not yet loaded, use a new instance + if (!class_exists('\phpbb\path_helper')) + { + require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx); + } + + $request = new phpbb\request\request(); + $phpbb_path_helper = new phpbb\path_helper( + new phpbb\symfony_request( + $request + ), + new phpbb\filesystem\filesystem(), + $request, + $phpbb_root_path, + $phpEx + ); + } + + return $phpbb_path_helper->clean_path($path); +} + +/** +* Pick a timezone +* +* @param string $default A timezone to select +* @param boolean $truncate Shall we truncate the options text +* +* @return string Returns the options for timezone selector only +* +* @deprecated 3.1.0 (To be removed: 4.0.0) +*/ +function tz_select($default = '', $truncate = false) +{ + global $template, $user; + + return phpbb_timezone_select($template, $user, $default, $truncate); +} + +/** +* Cache moderators. Called whenever permissions are changed +* via admin_permissions. Changes of usernames and group names +* must be carried through for the moderators table. +* +* @deprecated 3.1.0 (To be removed: 4.0.0) +* @return null +*/ +function cache_moderators() +{ + global $db, $cache, $auth; + return phpbb_cache_moderators($db, $cache, $auth); +} + +/** +* Removes moderators and administrators from foe lists. +* +* @deprecated 3.1.0 (To be removed: 4.0.0) +* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore +* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore +* @return null +*/ +function update_foes($group_id = false, $user_id = false) +{ + global $db, $auth; + return phpbb_update_foes($db, $auth, $group_id, $user_id); +} + +/** +* Get user rank title and image +* +* @param int $user_rank the current stored users rank id +* @param int $user_posts the users number of posts +* @param string &$rank_title the rank title will be stored here after execution +* @param string &$rank_img the rank image as full img tag is stored here after execution +* @param string &$rank_img_src the rank image source is stored here after execution +* +* @deprecated 3.1.0-RC5 (To be removed: 4.0.0) +* +* Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false +*/ +function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src) +{ + global $phpbb_root_path, $phpEx; + if (!function_exists('phpbb_get_user_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $rank_data = phpbb_get_user_rank(array('user_rank' => $user_rank), $user_posts); + $rank_title = $rank_data['title']; + $rank_img = $rank_data['img']; + $rank_img_src = $rank_data['img_src']; +} + +/** + * Retrieve contents from remotely stored file + * + * @deprecated 3.1.2 Use file_downloader instead + */ +function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6) +{ + global $phpbb_container; + + // Get file downloader and assign $errstr and $errno + /* @var $file_downloader \phpbb\file_downloader */ + $file_downloader = $phpbb_container->get('file_downloader'); + + $file_data = $file_downloader->get($host, $directory, $filename, $port, $timeout); + $errstr = $file_downloader->get_error_string(); + $errno = $file_downloader->get_error_number(); + + return $file_data; +} + +/** + * Add log entry + * + * @param string $mode The mode defines which log_type is used and from which log the entry is retrieved + * @param int $forum_id Mode 'mod' ONLY: forum id of the related item, NOT INCLUDED otherwise + * @param int $topic_id Mode 'mod' ONLY: topic id of the related item, NOT INCLUDED otherwise + * @param int $reportee_id Mode 'user' ONLY: user id of the reportee, NOT INCLUDED otherwise + * @param string $log_operation Name of the operation + * @param array $additional_data More arguments can be added, depending on the log_type + * + * @return int|bool Returns the log_id, if the entry was added to the database, false otherwise. + * + * @deprecated 3.1.0 (To be removed: 4.0.0) + */ +function add_log() +{ + global $phpbb_log, $user; + + $args = func_get_args(); + $mode = array_shift($args); + + // This looks kind of dirty, but add_log has some additional data before the log_operation + $additional_data = array(); + switch ($mode) + { + case 'admin': + case 'critical': + break; + case 'mod': + $additional_data['forum_id'] = array_shift($args); + $additional_data['topic_id'] = array_shift($args); + break; + case 'user': + $additional_data['reportee_id'] = array_shift($args); + break; + } + + $log_operation = array_shift($args); + $additional_data = array_merge($additional_data, $args); + + $user_id = (empty($user->data)) ? ANONYMOUS : $user->data['user_id']; + $user_ip = (empty($user->ip)) ? '' : $user->ip; + + return $phpbb_log->add($mode, $user_id, $user_ip, $log_operation, time(), $additional_data); +} + +/** + * Sets a configuration option's value. + * + * Please note that this function does not update the is_dynamic value for + * an already existing config option. + * + * @param string $config_name The configuration option's name + * @param string $config_value New configuration value + * @param bool $is_dynamic Whether this variable should be cached (false) or + * if it changes too frequently (true) to be + * efficiently cached. + * + * @return null + * + * @deprecated 3.1.0 (To be removed: 4.0.0) + */ +function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null) +{ + static $config = null; + + if ($set_config !== null) + { + $config = $set_config; + + if (empty($config_name)) + { + return; + } + } + + $config->set($config_name, $config_value, !$is_dynamic); +} + +/** + * Increments an integer config value directly in the database. + * + * @param string $config_name The configuration option's name + * @param int $increment Amount to increment by + * @param bool $is_dynamic Whether this variable should be cached (false) or + * if it changes too frequently (true) to be + * efficiently cached. + * + * @return null + * + * @deprecated 3.1.0 (To be removed: 4.0.0) + */ +function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\config\config $set_config = null) +{ + static $config = null; + if ($set_config !== null) + { + $config = $set_config; + if (empty($config_name)) + { + return; + } + } + $config->increment($config_name, $increment, !$is_dynamic); +} + +/** + * Wrapper function of \phpbb\request\request::variable which exists for backwards compatability. + * See {@link \phpbb\request\request_interface::variable \phpbb\request\request_interface::variable} for + * documentation of this function's use. + * + * @deprecated 3.1.0 (To be removed: 4.0.0) + * @param mixed $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * If you pass an instance of {@link \phpbb\request\request_interface phpbb_request_interface} + * as this parameter it will overwrite the current request class instance. If you do + * not do so, it will create its own instance (but leave superglobals enabled). + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param bool $cookie This param is mapped to \phpbb\request\request_interface::COOKIE as the last param for + * \phpbb\request\request_interface::variable for backwards compatability reasons. + * @param \phpbb\request\request_interface|null|false If an instance of \phpbb\request\request_interface is given the instance is stored in + * a static variable and used for all further calls where this parameters is null. Until + * the function is called with an instance it automatically creates a new \phpbb\request\request + * instance on every call. By passing false this per-call instantiation can be restored + * after having passed in a \phpbb\request\request_interface instance. + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ +function request_var($var_name, $default, $multibyte = false, $cookie = false, $request = null) +{ + // This is all just an ugly hack to add "Dependency Injection" to a function + // the only real code is the function call which maps this function to a method. + static $static_request = null; + if ($request instanceof \phpbb\request\request_interface) + { + $static_request = $request; + if (empty($var_name)) + { + return; + } + } + else if ($request === false) + { + $static_request = null; + if (empty($var_name)) + { + return; + } + } + $tmp_request = $static_request; + // no request class set, create a temporary one ourselves to keep backwards compatibility + if ($tmp_request === null) + { + // false param: enable super globals, so the created request class does not + // make super globals inaccessible everywhere outside this function. + $tmp_request = new \phpbb\request\request(new \phpbb\request\type_cast_helper(), false); + } + return $tmp_request->variable($var_name, $default, $multibyte, ($cookie) ? \phpbb\request\request_interface::COOKIE : \phpbb\request\request_interface::REQUEST); +} + +/** + * Get tables of a database + * + * @deprecated 3.1.0 (To be removed: 4.0.0) + */ +function get_tables($db) +{ + $db_tools_factory = new \phpbb\db\tools\factory(); + $db_tools = $db_tools_factory->get($db); + + return $db_tools->sql_list_tables(); +} + +/** + * Global function for chmodding directories and files for internal use + * + * This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions. + * The function determines owner and group from common.php file and sets the same to the provided file. + * The function uses bit fields to build the permissions. + * The function sets the appropiate execute bit on directories. + * + * Supported constants representing bit fields are: + * + * CHMOD_ALL - all permissions (7) + * CHMOD_READ - read permission (4) + * CHMOD_WRITE - write permission (2) + * CHMOD_EXECUTE - execute permission (1) + * + * NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions. + * + * @param string $filename The file/directory to be chmodded + * @param int $perms Permissions to set + * + * @return bool true on success, otherwise false + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::phpbb_chmod() instead + */ +function phpbb_chmod($filename, $perms = CHMOD_READ) +{ + global $phpbb_filesystem; + + try + { + $phpbb_filesystem->phpbb_chmod($filename, $perms); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + return false; + } + + return true; +} + +/** + * Test if a file/directory is writable + * + * This function calls the native is_writable() when not running under + * Windows and it is not disabled. + * + * @param string $file Path to perform write test on + * @return bool True when the path is writable, otherwise false. + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::is_writable() instead + */ +function phpbb_is_writable($file) +{ + global $phpbb_filesystem; + + return $phpbb_filesystem->is_writable($file); +} + +/** + * Checks if a path ($path) is absolute or relative + * + * @param string $path Path to check absoluteness of + * @return boolean + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::is_absolute_path() instead + */ +function phpbb_is_absolute($path) +{ + global $phpbb_filesystem; + + return $phpbb_filesystem->is_absolute_path($path); +} + +/** + * A wrapper for realpath + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::realpath() instead + */ +function phpbb_realpath($path) +{ + global $phpbb_filesystem; + + return $phpbb_filesystem->realpath($path); +} + +/** + * Determine which plural form we should use. + * For some languages this is not as simple as for English. + * + * @param $rule int ID of the plural rule we want to use, see https://area51.phpbb.com/docs/dev/32x/language/plurals.html + * @param $number int|float The number we want to get the plural case for. Float numbers are floored. + * @return int The plural-case we need to use for the number plural-rule combination + * + * @deprecated 3.2.0-dev (To be removed: 4.0.0) + */ +function phpbb_get_plural_form($rule, $number) +{ + global $phpbb_container; + + /** @var \phpbb\language\language $language */ + $language = $phpbb_container->get('language'); + return $language->get_plural_form($number, $rule); +} + +/** +* @return bool Always true +* @deprecated 3.2.0-dev +*/ +function phpbb_pcre_utf8_support() +{ + return true; +} + +/** + * Casts a variable to the given type. + * + * @deprecated 3.1 (To be removed 4.0.0) + */ +function set_var(&$result, $var, $type, $multibyte = false) +{ + // no need for dependency injection here, if you have the object, call the method yourself! + $type_cast_helper = new \phpbb\request\type_cast_helper(); + $type_cast_helper->set_var($result, $var, $type, $multibyte); +} + +/** + * Delete Attachments + * + * @deprecated 3.2.0-a1 (To be removed: 4.0.0) + * + * @param string $mode can be: post|message|topic|attach|user + * @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids + * @param bool $resync set this to false if you are deleting posts or topics + */ +function delete_attachments($mode, $ids, $resync = true) +{ + global $phpbb_container; + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $num_deleted = $attachment_manager->delete($mode, $ids, $resync); + + unset($attachment_manager); + + return $num_deleted; +} + +/** + * Delete attached file + * + * @deprecated 3.2.0-a1 (To be removed: 4.0.0) + */ +function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) +{ + global $phpbb_container; + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $unlink = $attachment_manager->unlink($filename, $mode, $entry_removed); + unset($attachment_manager); + + return $unlink; +} + +/** + * Display reasons + * + * @deprecated 3.2.0-dev (To be removed: 4.0.0) + */ +function display_reasons($reason_id = 0) +{ + global $phpbb_container; + + $phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id); +} + +/** + * Upload Attachment - filedata is generated here + * Uses upload class + * + * @deprecated 3.2.0-a1 (To be removed: 4.0.0) + * + * @param string $form_name The form name of the file upload input + * @param int $forum_id The id of the forum + * @param bool $local Whether the file is local or not + * @param string $local_storage The path to the local file + * @param bool $is_message Whether it is a PM or not + * @param array $local_filedata A filespec object created for the local file + * + * @return array File data array + */ +function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false) +{ + global $phpbb_container; + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $file = $attachment_manager->upload($form_name, $forum_id, $local, $local_storage, $is_message, $local_filedata); + unset($attachment_manager); + + return $file; +} + +/** +* Wrapper for php's checkdnsrr function. +* +* @param string $host Fully-Qualified Domain Name +* @param string $type Resource record type to lookup +* Supported types are: MX (default), A, AAAA, NS, TXT, CNAME +* Other types may work or may not work +* +* @return mixed true if entry found, +* false if entry not found, +* null if this function is not supported by this environment +* +* Since null can also be returned, you probably want to compare the result +* with === true or === false, +* +* @deprecated 3.3.0-b2 (To be removed: 4.0.0) +*/ +function phpbb_checkdnsrr($host, $type = 'MX') +{ + return checkdnsrr($host, $type); +} + +/* + * Wrapper for inet_ntop() + * + * Converts a packed internet address to a human readable representation + * inet_ntop() is supported by PHP since 5.1.0, since 5.3.0 also on Windows. + * + * @param string $in_addr A 32bit IPv4, or 128bit IPv6 address. + * + * @return mixed false on failure, + * string otherwise + * + * @deprecated 3.3.0-b2 (To be removed: 4.0.0) + */ +function phpbb_inet_ntop($in_addr) +{ + return inet_ntop($in_addr); +} + +/** + * Wrapper for inet_pton() + * + * Converts a human readable IP address to its packed in_addr representation + * inet_pton() is supported by PHP since 5.1.0, since 5.3.0 also on Windows. + * + * @param string $address A human readable IPv4 or IPv6 address. + * + * @return mixed false if address is invalid, + * in_addr representation of the given address otherwise (string) + * + * @deprecated 3.3.0-b2 (To be removed: 4.0.0) + */ +function phpbb_inet_pton($address) +{ + return inet_pton($address); +} + +/** + * Hashes an email address to a big integer + * + * @param string $email Email address + * + * @return string Unsigned Big Integer + * + * @deprecated 3.3.0-b2 (To be removed: 4.0.0) + */ +function phpbb_email_hash($email) +{ + return sprintf('%u', crc32(strtolower($email))) . strlen($email); +} diff --git a/install/update/new/includes/functions_compress.php b/install/update/new/includes/functions_compress.php new file mode 100644 index 0000000..56d64d3 --- /dev/null +++ b/install/update/new/includes/functions_compress.php @@ -0,0 +1,830 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Class for handling archives (compression/decompression) +*/ +class compress +{ + var $fp = 0; + + /** + * @var array + */ + protected $filelist = array(); + + /** + * Add file to archive + */ + function add_file($src, $src_rm_prefix = '', $src_add_prefix = '', $skip_files = '') + { + global $phpbb_root_path; + + $skip_files = explode(',', $skip_files); + + // Remove rm prefix from src path + $src_path = ($src_rm_prefix) ? preg_replace('#^(' . preg_quote($src_rm_prefix, '#') . ')#', '', $src) : $src; + // Add src prefix + $src_path = ($src_add_prefix) ? ($src_add_prefix . ((substr($src_add_prefix, -1) != '/') ? '/' : '') . $src_path) : $src_path; + // Remove initial "/" if present + $src_path = (substr($src_path, 0, 1) == '/') ? substr($src_path, 1) : $src_path; + + if (is_file($phpbb_root_path . $src)) + { + $this->data($src_path, file_get_contents("$phpbb_root_path$src"), stat("$phpbb_root_path$src"), false); + } + else if (is_dir($phpbb_root_path . $src)) + { + // Clean up path, add closing / if not present + $src_path = ($src_path && substr($src_path, -1) != '/') ? $src_path . '/' : $src_path; + + $filelist = filelist("$phpbb_root_path$src", '', '*'); + krsort($filelist); + + /** + * Commented out, as adding the folders produces corrupted archives + if ($src_path) + { + $this->data($src_path, '', true, stat("$phpbb_root_path$src")); + } + */ + + foreach ($filelist as $path => $file_ary) + { + /** + * Commented out, as adding the folders produces corrupted archives + if ($path) + { + // Same as for src_path + $path = (substr($path, 0, 1) == '/') ? substr($path, 1) : $path; + $path = ($path && substr($path, -1) != '/') ? $path . '/' : $path; + + $this->data("$src_path$path", '', true, stat("$phpbb_root_path$src$path")); + } + */ + + foreach ($file_ary as $file) + { + if (in_array($path . $file, $skip_files)) + { + continue; + } + + $this->data("$src_path$path$file", file_get_contents("$phpbb_root_path$src$path$file"), stat("$phpbb_root_path$src$path$file"), false); + } + } + } + else + { + // $src does not exist + return false; + } + + return true; + } + + /** + * Add custom file (the filepath will not be adjusted) + */ + function add_custom_file($src, $filename) + { + if (!file_exists($src)) + { + return false; + } + + $this->data($filename, file_get_contents($src), stat($src), false); + return true; + } + + /** + * Add file data + */ + function add_data($src, $name) + { + $stat = array(); + $stat[2] = 436; //384 + $stat[4] = $stat[5] = 0; + $stat[7] = strlen($src); + $stat[9] = time(); + $this->data($name, $src, $stat, false); + return true; + } + + /** + * Checks if a file by that name as already been added and, if it has, + * returns a new, unique name. + * + * @param string $name The filename + * @return string A unique filename + */ + protected function unique_filename($name) + { + if (isset($this->filelist[$name])) + { + $start = $name; + $ext = ''; + $this->filelist[$name]++; + + // Separate the extension off the end of the filename to preserve it + $pos = strrpos($name, '.'); + if ($pos !== false) + { + $start = substr($name, 0, $pos); + $ext = substr($name, $pos); + } + + return $start . '_' . $this->filelist[$name] . $ext; + } + + $this->filelist[$name] = 0; + return $name; + } + + /** + * Return available methods + * + * @return array Array of strings of available compression methods (.tar, .tar.gz, .zip, etc.) + */ + static public function methods() + { + $methods = array('.tar'); + $available_methods = array('.tar.gz' => 'zlib', '.tar.bz2' => 'bz2', '.zip' => 'zlib'); + + foreach ($available_methods as $type => $module) + { + if (!@extension_loaded($module)) + { + continue; + } + $methods[] = $type; + } + + return $methods; + } +} + +/** +* Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux, +* Marc Delisle, http://www.phpmyadmin.net/ +* +* Zip extraction function by Alexandre Tedeschi, alexandrebr at gmail dot com +* +* Modified extensively by psoTFX and DavidMJ, (c) phpBB Limited, 2003 +* +* Based on work by Eric Mueller and Denis125 +* Official ZIP file format: http://www.pkware.com/appnote.txt +*/ +class compress_zip extends compress +{ + var $datasec = array(); + var $ctrl_dir = array(); + var $eof_cdh = "\x50\x4b\x05\x06\x00\x00\x00\x00"; + + var $old_offset = 0; + var $datasec_len = 0; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Constructor + */ + function __construct($mode, $file) + { + global $phpbb_filesystem; + + $this->fp = @fopen($file, $mode . 'b'); + $this->filesystem = ($phpbb_filesystem instanceof \phpbb\filesystem\filesystem_interface) ? $phpbb_filesystem : new \phpbb\filesystem\filesystem(); + + if (!$this->fp) + { + trigger_error('Unable to open file ' . $file . ' [' . $mode . 'b]'); + } + } + + /** + * Convert unix to dos time + */ + function unix_to_dos_time($time) + { + $timearray = (!$time) ? getdate() : getdate($time); + + if ($timearray['year'] < 1980) + { + $timearray['year'] = 1980; + $timearray['mon'] = $timearray['mday'] = 1; + $timearray['hours'] = $timearray['minutes'] = $timearray['seconds'] = 0; + } + + return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); + } + + /** + * Extract archive + */ + function extract($dst) + { + // Loop the file, looking for files and folders + $dd_try = false; + rewind($this->fp); + + while (!feof($this->fp)) + { + // Check if the signature is valid... + $signature = fread($this->fp, 4); + + switch ($signature) + { + // 'Local File Header' + case "\x50\x4b\x03\x04": + // Lets get everything we need. + // We don't store the version needed to extract, the general purpose bit flag or the date and time fields + $data = unpack("@4/vc_method/@10/Vcrc/Vc_size/Vuc_size/vname_len/vextra_field", fread($this->fp, 26)); + $file_name = fread($this->fp, $data['name_len']); // filename + + if ($data['extra_field']) + { + fread($this->fp, $data['extra_field']); // extra field + } + + $target_filename = "$dst$file_name"; + + if (!$data['uc_size'] && !$data['crc'] && substr($file_name, -1, 1) == '/') + { + if (!is_dir($target_filename)) + { + $str = ''; + $folders = explode('/', $target_filename); + + // Create and folders and subfolders if they do not exist + foreach ($folders as $folder) + { + $folder = trim($folder); + if (!$folder) + { + continue; + } + + $str = (!empty($str)) ? $str . '/' . $folder : $folder; + if (!is_dir($str)) + { + if (!@mkdir($str, 0777)) + { + trigger_error("Could not create directory $folder"); + } + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + } + // This is a directory, we are not writing files + continue 2; + } + else + { + // Some archivers are punks, they don't include folders in their archives! + $str = ''; + $folders = explode('/', pathinfo($target_filename, PATHINFO_DIRNAME)); + + // Create and folders and subfolders if they do not exist + foreach ($folders as $folder) + { + $folder = trim($folder); + if (!$folder) + { + continue; + } + + $str = (!empty($str)) ? $str . '/' . $folder : $folder; + if (!is_dir($str)) + { + if (!@mkdir($str, 0777)) + { + trigger_error("Could not create directory $folder"); + } + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + } + + if (!$data['uc_size']) + { + $content = ''; + } + else + { + $content = fread($this->fp, $data['c_size']); + } + + $fp = fopen($target_filename, "w"); + + switch ($data['c_method']) + { + case 0: + // Not compressed + fwrite($fp, $content); + break; + + case 8: + // Deflate + fwrite($fp, gzinflate($content, $data['uc_size'])); + break; + + case 12: + // Bzip2 + fwrite($fp, bzdecompress($content)); + break; + } + + fclose($fp); + break; + + // We hit the 'Central Directory Header', we can stop because nothing else in here requires our attention + // or we hit the end of the central directory record, we can safely end the loop as we are totally finished with looking for files and folders + case "\x50\x4b\x01\x02": + // This case should simply never happen.. but it does exist.. + case "\x50\x4b\x05\x06": + break 2; + + // 'Packed to Removable Disk', ignore it and look for the next signature... + case 'PK00': + continue 2; + + // We have encountered a header that is weird. Lets look for better data... + default: + if (!$dd_try) + { + // Unexpected header. Trying to detect wrong placed 'Data Descriptor'; + $dd_try = true; + fseek($this->fp, 8, SEEK_CUR); // Jump over 'crc-32'(4) 'compressed-size'(4), 'uncompressed-size'(4) + continue 2; + } + trigger_error("Unexpected header, ending loop"); + break 2; + } + + $dd_try = false; + } + } + + /** + * Close archive + */ + function close() + { + // Write out central file directory and footer ... if it exists + if (count($this->ctrl_dir)) + { + fwrite($this->fp, $this->file()); + } + fclose($this->fp); + } + + /** + * Create the structures ... note we assume version made by is MSDOS + */ + function data($name, $data, $stat, $is_dir = false) + { + $name = str_replace('\\', '/', $name); + $name = $this->unique_filename($name); + + $hexdtime = pack('V', $this->unix_to_dos_time($stat[9])); + + if ($is_dir) + { + $unc_len = $c_len = $crc = 0; + $zdata = ''; + $var_ext = 10; + } + else + { + $unc_len = strlen($data); + $crc = crc32($data); + $zdata = gzdeflate($data); + $c_len = strlen($zdata); + $var_ext = 20; + + // Did we compress? No, then use data as is + if ($c_len >= $unc_len) + { + $zdata = $data; + $c_len = $unc_len; + $var_ext = 10; + } + } + unset($data); + + // If we didn't compress set method to store, else deflate + $c_method = ($c_len == $unc_len) ? "\x00\x00" : "\x08\x00"; + + // Are we a file or a directory? Set archive for file + $attrib = ($is_dir) ? 16 : 32; + + // File Record Header + $fr = "\x50\x4b\x03\x04"; // Local file header 4bytes + $fr .= pack('v', $var_ext); // ver needed to extract 2bytes + $fr .= "\x00\x00"; // gen purpose bit flag 2bytes + $fr .= $c_method; // compression method 2bytes + $fr .= $hexdtime; // last mod time and date 2+2bytes + $fr .= pack('V', $crc); // crc32 4bytes + $fr .= pack('V', $c_len); // compressed filesize 4bytes + $fr .= pack('V', $unc_len); // uncompressed filesize 4bytes + $fr .= pack('v', strlen($name));// length of filename 2bytes + + $fr .= pack('v', 0); // extra field length 2bytes + $fr .= $name; + $fr .= $zdata; + unset($zdata); + + $this->datasec_len += strlen($fr); + + // Add data to file ... by writing data out incrementally we save some memory + fwrite($this->fp, $fr); + unset($fr); + + // Central Directory Header + $cdrec = "\x50\x4b\x01\x02"; // header 4bytes + $cdrec .= "\x00\x00"; // version made by + $cdrec .= pack('v', $var_ext); // version needed to extract + $cdrec .= "\x00\x00"; // gen purpose bit flag + $cdrec .= $c_method; // compression method + $cdrec .= $hexdtime; // last mod time & date + $cdrec .= pack('V', $crc); // crc32 + $cdrec .= pack('V', $c_len); // compressed filesize + $cdrec .= pack('V', $unc_len); // uncompressed filesize + $cdrec .= pack('v', strlen($name)); // length of filename + $cdrec .= pack('v', 0); // extra field length + $cdrec .= pack('v', 0); // file comment length + $cdrec .= pack('v', 0); // disk number start + $cdrec .= pack('v', 0); // internal file attributes + $cdrec .= pack('V', $attrib); // external file attributes + $cdrec .= pack('V', $this->old_offset); // relative offset of local header + $cdrec .= $name; + + // Save to central directory + $this->ctrl_dir[] = $cdrec; + + $this->old_offset = $this->datasec_len; + } + + /** + * file + */ + function file() + { + $ctrldir = implode('', $this->ctrl_dir); + + return $ctrldir . $this->eof_cdh . + pack('v', count($this->ctrl_dir)) . // total # of entries "on this disk" + pack('v', count($this->ctrl_dir)) . // total # of entries overall + pack('V', strlen($ctrldir)) . // size of central dir + pack('V', $this->datasec_len) . // offset to start of central dir + "\x00\x00"; // .zip file comment length + } + + /** + * Download archive + */ + function download($filename, $download_name = false) + { + global $phpbb_root_path; + + if ($download_name === false) + { + $download_name = $filename; + } + + $mimetype = 'application/zip'; + + header('Cache-Control: private, no-cache'); + header("Content-Type: $mimetype; name=\"$download_name.zip\""); + header("Content-disposition: attachment; filename=$download_name.zip"); + + $fp = @fopen("{$phpbb_root_path}store/$filename.zip", 'rb'); + if ($fp) + { + while ($buffer = fread($fp, 1024)) + { + echo $buffer; + } + fclose($fp); + } + } +} + +/** +* Tar/tar.gz compression routine +* Header/checksum creation derived from tarfile.pl, (c) Tom Horsley, 1994 +*/ +class compress_tar extends compress +{ + var $isgz = false; + var $isbz = false; + var $filename = ''; + var $mode = ''; + var $type = ''; + var $wrote = false; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Constructor + */ + function __construct($mode, $file, $type = '') + { + global $phpbb_filesystem; + + $type = (!$type) ? $file : $type; + $this->isgz = preg_match('#(\.tar\.gz|\.tgz)$#', $type); + $this->isbz = preg_match('#\.tar\.bz2$#', $type); + + $this->mode = &$mode; + $this->file = &$file; + $this->type = &$type; + $this->open(); + + $this->filesystem = ($phpbb_filesystem instanceof \phpbb\filesystem\filesystem_interface) ? $phpbb_filesystem : new \phpbb\filesystem\filesystem(); + } + + /** + * Extract archive + */ + function extract($dst) + { + $fzread = ($this->isbz && function_exists('bzread')) ? 'bzread' : (($this->isgz && @extension_loaded('zlib')) ? 'gzread' : 'fread'); + + // Run through the file and grab directory entries + while ($buffer = $fzread($this->fp, 512)) + { + $tmp = unpack('A6magic', substr($buffer, 257, 6)); + + if (trim($tmp['magic']) == 'ustar') + { + $tmp = unpack('A100name', $buffer); + $filename = trim($tmp['name']); + + $tmp = unpack('Atype', substr($buffer, 156, 1)); + $filetype = (int) trim($tmp['type']); + + $tmp = unpack('A12size', substr($buffer, 124, 12)); + $filesize = octdec((int) trim($tmp['size'])); + + $target_filename = "$dst$filename"; + + if ($filetype == 5) + { + if (!is_dir($target_filename)) + { + $str = ''; + $folders = explode('/', $target_filename); + + // Create and folders and subfolders if they do not exist + foreach ($folders as $folder) + { + $folder = trim($folder); + if (!$folder) + { + continue; + } + + $str = (!empty($str)) ? $str . '/' . $folder : $folder; + if (!is_dir($str)) + { + if (!@mkdir($str, 0777)) + { + trigger_error("Could not create directory $folder"); + } + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + } + } + else if ($filesize >= 0 && ($filetype == 0 || $filetype == "\0")) + { + // Some archivers are punks, they don't properly order the folders in their archives! + $str = ''; + $folders = explode('/', pathinfo($target_filename, PATHINFO_DIRNAME)); + + // Create and folders and subfolders if they do not exist + foreach ($folders as $folder) + { + $folder = trim($folder); + if (!$folder) + { + continue; + } + + $str = (!empty($str)) ? $str . '/' . $folder : $folder; + if (!is_dir($str)) + { + if (!@mkdir($str, 0777)) + { + trigger_error("Could not create directory $folder"); + } + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + + // Write out the files + if (!($fp = fopen($target_filename, 'wb'))) + { + trigger_error("Couldn't create file $filename"); + } + + try + { + $this->filesystem->phpbb_chmod($target_filename, CHMOD_READ); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + + // Grab the file contents + fwrite($fp, ($filesize) ? $fzread($this->fp, ($filesize + 511) &~ 511) : '', $filesize); + fclose($fp); + } + } + } + } + + /** + * Close archive + */ + function close() + { + $fzclose = ($this->isbz && function_exists('bzclose')) ? 'bzclose' : (($this->isgz && @extension_loaded('zlib')) ? 'gzclose' : 'fclose'); + + if ($this->wrote) + { + $fzwrite = ($this->isbz && function_exists('bzwrite')) ? 'bzwrite' : (($this->isgz && @extension_loaded('zlib')) ? 'gzwrite' : 'fwrite'); + + // The end of a tar archive ends in two records of all NULLs (1024 bytes of \0) + $fzwrite($this->fp, str_repeat("\0", 1024)); + } + + $fzclose($this->fp); + } + + /** + * Create the structures + */ + function data($name, $data, $stat, $is_dir = false) + { + $name = $this->unique_filename($name); + $this->wrote = true; + $fzwrite = ($this->isbz && function_exists('bzwrite')) ? 'bzwrite' : (($this->isgz && @extension_loaded('zlib')) ? 'gzwrite' : 'fwrite'); + + $typeflag = ($is_dir) ? '5' : ''; + + // This is the header data, it contains all the info we know about the file or folder that we are about to archive + $header = ''; + $header .= pack('a100', $name); // file name + $header .= pack('a8', sprintf("%07o", $stat[2])); // file mode + $header .= pack('a8', sprintf("%07o", $stat[4])); // owner id + $header .= pack('a8', sprintf("%07o", $stat[5])); // group id + $header .= pack('a12', sprintf("%011o", $stat[7])); // file size + $header .= pack('a12', sprintf("%011o", $stat[9])); // last mod time + + // Checksum + $checksum = 0; + for ($i = 0; $i < 148; $i++) + { + $checksum += ord($header[$i]); + } + + // We precompute the rest of the hash, this saves us time in the loop and allows us to insert our hash without resorting to string functions + $checksum += 2415 + (($is_dir) ? 53 : 0); + + $header .= pack('a8', sprintf("%07o", $checksum)); // checksum + $header .= pack('a1', $typeflag); // link indicator + $header .= pack('a100', ''); // name of linked file + $header .= pack('a6', 'ustar'); // ustar indicator + $header .= pack('a2', '00'); // ustar version + $header .= pack('a32', 'Unknown'); // owner name + $header .= pack('a32', 'Unknown'); // group name + $header .= pack('a8', ''); // device major number + $header .= pack('a8', ''); // device minor number + $header .= pack('a155', ''); // filename prefix + $header .= pack('a12', ''); // end + + // This writes the entire file in one shot. Header, followed by data and then null padded to a multiple of 512 + $fzwrite($this->fp, $header . (($stat[7] !== 0 && !$is_dir) ? $data . str_repeat("\0", (($stat[7] + 511) &~ 511) - $stat[7]) : '')); + unset($data); + } + + /** + * Open archive + */ + function open() + { + $fzopen = ($this->isbz && function_exists('bzopen')) ? 'bzopen' : (($this->isgz && @extension_loaded('zlib')) ? 'gzopen' : 'fopen'); + $this->fp = @$fzopen($this->file, $this->mode . (($fzopen == 'bzopen') ? '' : 'b') . (($fzopen == 'gzopen') ? '9' : '')); + + if (!$this->fp) + { + trigger_error('Unable to open file ' . $this->file . ' [' . $fzopen . ' - ' . $this->mode . 'b]'); + } + } + + /** + * Download archive + */ + function download($filename, $download_name = false) + { + global $phpbb_root_path; + + if ($download_name === false) + { + $download_name = $filename; + } + + switch ($this->type) + { + case '.tar': + $mimetype = 'application/x-tar'; + break; + + case '.tar.gz': + $mimetype = 'application/x-gzip'; + break; + + case '.tar.bz2': + $mimetype = 'application/x-bzip2'; + break; + + default: + $mimetype = 'application/octet-stream'; + break; + } + + header('Cache-Control: private, no-cache'); + header("Content-Type: $mimetype; name=\"$download_name$this->type\""); + header("Content-disposition: attachment; filename=$download_name$this->type"); + + $fp = @fopen("{$phpbb_root_path}store/$filename$this->type", 'rb'); + if ($fp) + { + while ($buffer = fread($fp, 1024)) + { + echo $buffer; + } + fclose($fp); + } + } +} diff --git a/install/update/new/includes/functions_content.php b/install/update/new/includes/functions_content.php new file mode 100644 index 0000000..fd014c7 --- /dev/null +++ b/install/update/new/includes/functions_content.php @@ -0,0 +1,1788 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* gen_sort_selects() +* make_jumpbox() +* bump_topic_allowed() +* get_context() +* phpbb_clean_search_string() +* decode_message() +* strip_bbcode() +* generate_text_for_display() +* generate_text_for_storage() +* generate_text_for_edit() +* make_clickable_callback() +* make_clickable() +* censor_text() +* bbcode_nl2br() +* smiley_text() +* parse_attachments() +* extension_allowed() +* truncate_string() +* get_username_string() +* class bitfield +*/ + +/** +* Generate sort selection fields +*/ +function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, &$sort_dir, &$s_limit_days, &$s_sort_key, &$s_sort_dir, &$u_sort_param, $def_st = false, $def_sk = false, $def_sd = false) +{ + global $user, $phpbb_dispatcher; + + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + $sorts = array( + 'st' => array( + 'key' => 'sort_days', + 'default' => $def_st, + 'options' => $limit_days, + 'output' => &$s_limit_days, + ), + + 'sk' => array( + 'key' => 'sort_key', + 'default' => $def_sk, + 'options' => $sort_by_text, + 'output' => &$s_sort_key, + ), + + 'sd' => array( + 'key' => 'sort_dir', + 'default' => $def_sd, + 'options' => $sort_dir_text, + 'output' => &$s_sort_dir, + ), + ); + $u_sort_param = ''; + + foreach ($sorts as $name => $sort_ary) + { + $key = $sort_ary['key']; + $selected = ${$sort_ary['key']}; + + // Check if the key is selectable. If not, we reset to the default or first key found. + // This ensures the values are always valid. We also set $sort_dir/sort_key/etc. to the + // correct value, else the protection is void. ;) + if (!isset($sort_ary['options'][$selected])) + { + if ($sort_ary['default'] !== false) + { + $selected = ${$key} = $sort_ary['default']; + } + else + { + @reset($sort_ary['options']); + $selected = ${$key} = key($sort_ary['options']); + } + } + + $sort_ary['output'] = ''; + + $u_sort_param .= ($selected !== $sort_ary['default']) ? ((strlen($u_sort_param)) ? '&' : '') . "{$name}={$selected}" : ''; + } + + /** + * Run code before generated sort selects are returned + * + * @event core.gen_sort_selects_after + * @var int limit_days Days limit + * @var array sort_by_text Sort by text options + * @var int sort_days Sort by days flag + * @var string sort_key Sort key + * @var string sort_dir Sort dir + * @var string s_limit_days String of days limit + * @var string s_sort_key String of sort key + * @var string s_sort_dir String of sort dir + * @var string u_sort_param Sort URL params + * @var bool def_st Default sort days + * @var bool def_sk Default sort key + * @var bool def_sd Default sort dir + * @var array sorts Sorts + * @since 3.1.9-RC1 + */ + $vars = array( + 'limit_days', + 'sort_by_text', + 'sort_days', + 'sort_key', + 'sort_dir', + 's_limit_days', + 's_sort_key', + 's_sort_dir', + 'u_sort_param', + 'def_st', + 'def_sk', + 'def_sd', + 'sorts', + ); + extract($phpbb_dispatcher->trigger_event('core.gen_sort_selects_after', compact($vars))); + + return; +} + +/** +* Generate Jumpbox +*/ +function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list = false, $force_display = false) +{ + global $config, $auth, $template, $user, $db, $phpbb_path_helper, $phpbb_dispatcher; + + // We only return if the jumpbox is not forced to be displayed (in case it is needed for functionality) + if (!$config['load_jumpbox'] && $force_display === false) + { + return; + } + + $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql, 600); + + $rowset = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rowset[(int) $row['forum_id']] = $row; + } + $db->sql_freeresult($result); + + $right = $padding = 0; + $padding_store = array('0' => 0); + $display_jumpbox = false; + $iteration = 0; + + /** + * Modify the jumpbox forum list data + * + * @event core.make_jumpbox_modify_forum_list + * @var array rowset Array with the forums list data + * @since 3.1.10-RC1 + */ + $vars = array('rowset'); + extract($phpbb_dispatcher->trigger_event('core.make_jumpbox_modify_forum_list', compact($vars))); + + // Sometimes it could happen that forums will be displayed here not be displayed within the index page + // This is the result of forums not displayed at index, having list permissions and a parent of a forum with no permissions. + // If this happens, the padding could be "broken" + + foreach ($rowset as $row) + { + if ($row['left_id'] < $right) + { + $padding++; + $padding_store[$row['parent_id']] = $padding; + } + else if ($row['left_id'] > $right + 1) + { + // Ok, if the $padding_store for this parent is empty there is something wrong. For now we will skip over it. + // @todo digging deep to find out "how" this can happen. + $padding = (isset($padding_store[$row['parent_id']])) ? $padding_store[$row['parent_id']] : $padding; + } + + $right = $row['right_id']; + + if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) + { + // Non-postable forum with no subforums, don't display + continue; + } + + if (!$auth->acl_get('f_list', $row['forum_id'])) + { + // if the user does not have permissions to list this forum skip + continue; + } + + if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id'])) + { + continue; + } + + $tpl_ary = array(); + if (!$display_jumpbox) + { + $tpl_ary[] = array( + 'FORUM_ID' => ($select_all) ? 0 : -1, + 'FORUM_NAME' => ($select_all) ? $user->lang['ALL_FORUMS'] : $user->lang['SELECT_FORUM'], + 'S_FORUM_COUNT' => $iteration, + 'LINK' => $phpbb_path_helper->append_url_params($action, array('f' => $forum_id)), + ); + + $iteration++; + $display_jumpbox = true; + } + + $tpl_ary[] = array( + 'FORUM_ID' => $row['forum_id'], + 'FORUM_NAME' => $row['forum_name'], + 'SELECTED' => ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '', + 'S_FORUM_COUNT' => $iteration, + 'S_IS_CAT' => ($row['forum_type'] == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($row['forum_type'] == FORUM_POST) ? true : false, + 'LINK' => $phpbb_path_helper->append_url_params($action, array('f' => $row['forum_id'])), + ); + + /** + * Modify the jumpbox before it is assigned to the template + * + * @event core.make_jumpbox_modify_tpl_ary + * @var array row The data of the forum + * @var array tpl_ary Template data of the forum + * @since 3.1.10-RC1 + */ + $vars = array( + 'row', + 'tpl_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.make_jumpbox_modify_tpl_ary', compact($vars))); + + $template->assign_block_vars_array('jumpbox_forums', $tpl_ary); + + unset($tpl_ary); + + for ($i = 0; $i < $padding; $i++) + { + $template->assign_block_vars('jumpbox_forums.level', array()); + } + $iteration++; + } + unset($padding_store, $rowset); + + $url_parts = $phpbb_path_helper->get_url_parts($action); + + $template->assign_vars(array( + 'S_DISPLAY_JUMPBOX' => $display_jumpbox, + 'S_JUMPBOX_ACTION' => $action, + 'HIDDEN_FIELDS_FOR_JUMPBOX' => build_hidden_fields($url_parts['params']), + )); + + return; +} + +/** +* Bump Topic Check - used by posting and viewtopic +*/ +function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_poster, $last_topic_poster) +{ + global $config, $auth, $user; + + // Check permission and make sure the last post was not already bumped + if (!$auth->acl_get('f_bump', $forum_id) || $topic_bumped) + { + return false; + } + + // Check bump time range, is the user really allowed to bump the topic at this time? + $bump_time = ($config['bump_type'] == 'm') ? $config['bump_interval'] * 60 : (($config['bump_type'] == 'h') ? $config['bump_interval'] * 3600 : $config['bump_interval'] * 86400); + + // Check bump time + if ($last_post_time + $bump_time > time()) + { + return false; + } + + // Check bumper, only topic poster and last poster are allowed to bump + if ($topic_poster != $user->data['user_id'] && $last_topic_poster != $user->data['user_id']) + { + return false; + } + + // A bump time of 0 will completely disable the bump feature... not intended but might be useful. + return $bump_time; +} + +/** +* Generates a text with approx. the specified length which contains the specified words and their context +* +* @param string $text The full text from which context shall be extracted +* @param string $words An array of words which should be contained in the result, has to be a valid part of a PCRE pattern (escape with preg_quote!) +* @param int $length The desired length of the resulting text, however the result might be shorter or longer than this value +* +* @return string Context of the specified words separated by "..." +*/ +function get_context($text, $words, $length = 400) +{ + // first replace all whitespaces with single spaces + $text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", ' ')); + + // we need to turn the entities back into their original form, to not cut the message in between them + $entities = array('<', '>', '[', ']', '.', ':', ':'); + $characters = array('<', '>', '[', ']', '.', ':', ':'); + $text = str_replace($entities, $characters, $text); + + $word_indizes = array(); + if (count($words)) + { + $match = ''; + // find the starting indizes of all words + foreach ($words as $word) + { + if ($word) + { + if (preg_match('#(?:[^\w]|^)(' . $word . ')(?:[^\w]|$)#i', $text, $match)) + { + if (empty($match[1])) + { + continue; + } + + $pos = utf8_strpos($text, $match[1]); + if ($pos !== false) + { + $word_indizes[] = $pos; + } + } + } + } + unset($match); + + if (count($word_indizes)) + { + $word_indizes = array_unique($word_indizes); + sort($word_indizes); + + $wordnum = count($word_indizes); + // number of characters on the right and left side of each word + $sequence_length = (int) ($length / (2 * $wordnum)) - 2; + $final_text = ''; + $word = $j = 0; + $final_text_index = -1; + + // cycle through every character in the original text + for ($i = $word_indizes[$word], $n = utf8_strlen($text); $i < $n; $i++) + { + // if the current position is the start of one of the words then append $sequence_length characters to the final text + if (isset($word_indizes[$word]) && ($i == $word_indizes[$word])) + { + if ($final_text_index < $i - $sequence_length - 1) + { + $final_text .= '... ' . preg_replace('#^([^ ]*)#', '', utf8_substr($text, $i - $sequence_length, $sequence_length)); + } + else + { + // if the final text is already nearer to the current word than $sequence_length we only append the text + // from its current index on and distribute the unused length to all other sequenes + $sequence_length += (int) (($final_text_index - $i + $sequence_length + 1) / (2 * $wordnum)); + $final_text .= utf8_substr($text, $final_text_index + 1, $i - $final_text_index - 1); + } + $final_text_index = $i - 1; + + // add the following characters to the final text (see below) + $word++; + $j = 1; + } + + if ($j > 0) + { + // add the character to the final text and increment the sequence counter + $final_text .= utf8_substr($text, $i, 1); + $final_text_index++; + $j++; + + // if this is a whitespace then check whether we are done with this sequence + if (utf8_substr($text, $i, 1) == ' ') + { + // only check whether we have to exit the context generation completely if we haven't already reached the end anyway + if ($i + 4 < $n) + { + if (($j > $sequence_length && $word >= $wordnum) || utf8_strlen($final_text) > $length) + { + $final_text .= ' ...'; + break; + } + } + else + { + // make sure the text really reaches the end + $j -= 4; + } + + // stop context generation and wait for the next word + if ($j > $sequence_length) + { + $j = 0; + } + } + } + } + return str_replace($characters, $entities, $final_text); + } + } + + if (!count($words) || !count($word_indizes)) + { + return str_replace($characters, $entities, ((utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text)); + } +} + +/** +* Cleans a search string by removing single wildcards from it and replacing multiple spaces with a single one. +* +* @param string $search_string The full search string which should be cleaned. +* +* @return string The cleaned search string without any wildcards and multiple spaces. +*/ +function phpbb_clean_search_string($search_string) +{ + // This regular expressions matches every single wildcard. + // That means one after a whitespace or the beginning of the string or one before a whitespace or the end of the string. + $search_string = preg_replace('#(?<=^|\s)\*+(?=\s|$)#', '', $search_string); + $search_string = trim($search_string); + $search_string = preg_replace(array('#\s+#u', '#\*+#u'), array(' ', '*'), $search_string); + return $search_string; +} + +/** +* Decode text whereby text is coming from the db and expected to be pre-parsed content +* We are placing this outside of the message parser because we are often in need of it... +* +* NOTE: special chars are kept encoded +* +* @param string &$message Original message, passed by reference +* @param string $bbcode_uid BBCode UID +* @return null +*/ +function decode_message(&$message, $bbcode_uid = '') +{ + global $phpbb_container, $phpbb_dispatcher; + + /** + * Use this event to modify the message before it is decoded + * + * @event core.decode_message_before + * @var string message_text The message content + * @var string bbcode_uid The message BBCode UID + * @since 3.1.9-RC1 + */ + $message_text = $message; + $vars = array('message_text', 'bbcode_uid'); + extract($phpbb_dispatcher->trigger_event('core.decode_message_before', compact($vars))); + $message = $message_text; + + if (preg_match('#^<[rt][ >]#', $message)) + { + $message = htmlspecialchars($phpbb_container->get('text_formatter.utils')->unparse($message), ENT_COMPAT); + } + else + { + if ($bbcode_uid) + { + $match = array('
', "[/*:m:$bbcode_uid]", ":u:$bbcode_uid", ":o:$bbcode_uid", ":$bbcode_uid"); + $replace = array("\n", '', '', '', ''); + } + else + { + $match = array('
'); + $replace = array("\n"); + } + + $message = str_replace($match, $replace, $message); + + $match = get_preg_expression('bbcode_htm'); + $replace = array('\1', '\1', '\2', '\2', '\1', '', ''); + + $message = preg_replace($match, $replace, $message); + } + + /** + * Use this event to modify the message after it is decoded + * + * @event core.decode_message_after + * @var string message_text The message content + * @var string bbcode_uid The message BBCode UID + * @since 3.1.9-RC1 + */ + $message_text = $message; + $vars = array('message_text', 'bbcode_uid'); + extract($phpbb_dispatcher->trigger_event('core.decode_message_after', compact($vars))); + $message = $message_text; +} + +/** +* Strips all bbcode from a text in place +*/ +function strip_bbcode(&$text, $uid = '') +{ + global $phpbb_container; + + if (preg_match('#^<[rt][ >]#', $text)) + { + $text = $phpbb_container->get('text_formatter.utils')->clean_formatting($text); + } + else + { + if (!$uid) + { + $uid = '[0-9a-z]{5,}'; + } + + $text = preg_replace("#\[\/?[a-z0-9\*\+\-]+(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:$uid)\]#", ' ', $text); + + $match = get_preg_expression('bbcode_htm'); + $replace = array('\1', '\1', '\2', '\1', '', ''); + + $text = preg_replace($match, $replace, $text); + } +} + +/** +* For display of custom parsed text on user-facing pages +* Expects $text to be the value directly from the database (stored value) +*/ +function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text = true) +{ + static $bbcode; + global $auth, $config, $user; + global $phpbb_dispatcher, $phpbb_container; + + if ($text === '') + { + return ''; + } + + /** + * Use this event to modify the text before it is parsed + * + * @event core.modify_text_for_display_before + * @var string text The text to parse + * @var string uid The BBCode UID + * @var string bitfield The BBCode Bitfield + * @var int flags The BBCode Flags + * @var bool censor_text Whether or not to apply word censors + * @since 3.1.0-a1 + */ + $vars = array('text', 'uid', 'bitfield', 'flags', 'censor_text'); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_before', compact($vars))); + + if (preg_match('#^<[rt][ >]#', $text)) + { + $renderer = $phpbb_container->get('text_formatter.renderer'); + + // Temporarily switch off viewcensors if applicable + $old_censor = $renderer->get_viewcensors(); + + // Check here if the user is having viewing censors disabled (and also allowed to do so). + if (!$user->optionget('viewcensors') && $config['allow_nocensors'] && $auth->acl_get('u_chgcensors')) + { + $censor_text = false; + } + + if ($old_censor !== $censor_text) + { + $renderer->set_viewcensors($censor_text); + } + + $text = $renderer->render($text); + + // Restore the previous value + if ($old_censor !== $censor_text) + { + $renderer->set_viewcensors($old_censor); + } + } + else + { + if ($censor_text) + { + $text = censor_text($text); + } + + // Parse bbcode if bbcode uid stored and bbcode enabled + if ($uid && ($flags & OPTION_FLAG_BBCODE)) + { + if (!class_exists('bbcode')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/bbcode.' . $phpEx); + } + + if (empty($bbcode)) + { + $bbcode = new bbcode($bitfield); + } + else + { + $bbcode->bbcode_set_bitfield($bitfield); + } + + $bbcode->bbcode_second_pass($text, $uid); + } + + $text = bbcode_nl2br($text); + $text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES)); + } + + /** + * Use this event to modify the text after it is parsed + * + * @event core.modify_text_for_display_after + * @var string text The text to parse + * @var string uid The BBCode UID + * @var string bitfield The BBCode Bitfield + * @var int flags The BBCode Flags + * @since 3.1.0-a1 + */ + $vars = array('text', 'uid', 'bitfield', 'flags'); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_after', compact($vars))); + + return $text; +} + +/** +* For parsing custom parsed text to be stored within the database. +* This function additionally returns the uid and bitfield that needs to be stored. +* Expects $text to be the value directly from $request->variable() and in it's non-parsed form +* +* @param string $text The text to be replaced with the parsed one +* @param string $uid The BBCode uid for this parse +* @param string $bitfield The BBCode bitfield for this parse +* @param int $flags The allow_bbcode, allow_urls and allow_smilies compiled into a single integer. +* @param bool $allow_bbcode If BBCode is allowed (i.e. if BBCode is parsed) +* @param bool $allow_urls If urls is allowed +* @param bool $allow_smilies If smilies are allowed +* @param bool $allow_img_bbcode +* @param bool $allow_flash_bbcode +* @param bool $allow_quote_bbcode +* @param bool $allow_url_bbcode +* @param string $mode Mode to parse text as, e.g. post or sig +* +* @return array An array of string with the errors that occurred while parsing +*/ +function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $mode = 'post') +{ + global $phpbb_root_path, $phpEx, $phpbb_dispatcher; + + /** + * Use this event to modify the text before it is prepared for storage + * + * @event core.modify_text_for_storage_before + * @var string text The text to parse + * @var string uid The BBCode UID + * @var string bitfield The BBCode Bitfield + * @var int flags The BBCode Flags + * @var bool allow_bbcode Whether or not to parse BBCode + * @var bool allow_urls Whether or not to parse URLs + * @var bool allow_smilies Whether or not to parse Smilies + * @var bool allow_img_bbcode Whether or not to parse the [img] BBCode + * @var bool allow_flash_bbcode Whether or not to parse the [flash] BBCode + * @var bool allow_quote_bbcode Whether or not to parse the [quote] BBCode + * @var bool allow_url_bbcode Whether or not to parse the [url] BBCode + * @var string mode Mode to parse text as, e.g. post or sig + * @since 3.1.0-a1 + * @changed 3.2.0-a1 Added mode + */ + $vars = array( + 'text', + 'uid', + 'bitfield', + 'flags', + 'allow_bbcode', + 'allow_urls', + 'allow_smilies', + 'allow_img_bbcode', + 'allow_flash_bbcode', + 'allow_quote_bbcode', + 'allow_url_bbcode', + 'mode', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_before', compact($vars))); + + $uid = $bitfield = ''; + $flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0); + + if (!class_exists('parse_message')) + { + include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + } + + $message_parser = new parse_message($text); + $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode, true, $mode); + + $text = $message_parser->message; + $uid = $message_parser->bbcode_uid; + + // If the bbcode_bitfield is empty, there is no need for the uid to be stored. + if (!$message_parser->bbcode_bitfield) + { + $uid = ''; + } + + $bitfield = $message_parser->bbcode_bitfield; + + /** + * Use this event to modify the text after it is prepared for storage + * + * @event core.modify_text_for_storage_after + * @var string text The text to parse + * @var string uid The BBCode UID + * @var string bitfield The BBCode Bitfield + * @var int flags The BBCode Flags + * @var string message_parser The message_parser object + * @since 3.1.0-a1 + * @changed 3.1.11-RC1 Added message_parser to vars + */ + $vars = array('text', 'uid', 'bitfield', 'flags', 'message_parser'); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_after', compact($vars))); + + return $message_parser->warn_msg; +} + +/** +* For decoding custom parsed text for edits as well as extracting the flags +* Expects $text to be the value directly from the database (pre-parsed content) +*/ +function generate_text_for_edit($text, $uid, $flags) +{ + global $phpbb_dispatcher; + + /** + * Use this event to modify the text before it is decoded for editing + * + * @event core.modify_text_for_edit_before + * @var string text The text to parse + * @var string uid The BBCode UID + * @var int flags The BBCode Flags + * @since 3.1.0-a1 + */ + $vars = array('text', 'uid', 'flags'); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_edit_before', compact($vars))); + + decode_message($text, $uid); + + /** + * Use this event to modify the text after it is decoded for editing + * + * @event core.modify_text_for_edit_after + * @var string text The text to parse + * @var int flags The BBCode Flags + * @since 3.1.0-a1 + */ + $vars = array('text', 'flags'); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_edit_after', compact($vars))); + + return array( + 'allow_bbcode' => ($flags & OPTION_FLAG_BBCODE) ? 1 : 0, + 'allow_smilies' => ($flags & OPTION_FLAG_SMILIES) ? 1 : 0, + 'allow_urls' => ($flags & OPTION_FLAG_LINKS) ? 1 : 0, + 'text' => $text + ); +} + +/** +* A subroutine of make_clickable used with preg_replace +* It places correct HTML around an url, shortens the displayed text +* and makes sure no entities are inside URLs +*/ +function make_clickable_callback($type, $whitespace, $url, $relative_url, $class) +{ + $orig_url = $url; + $orig_relative = $relative_url; + $append = ''; + $url = htmlspecialchars_decode($url); + $relative_url = htmlspecialchars_decode($relative_url); + + // make sure no HTML entities were matched + $chars = array('<', '>', '"'); + $split = false; + + foreach ($chars as $char) + { + $next_split = strpos($url, $char); + if ($next_split !== false) + { + $split = ($split !== false) ? min($split, $next_split) : $next_split; + } + } + + if ($split !== false) + { + // an HTML entity was found, so the URL has to end before it + $append = substr($url, $split) . $relative_url; + $url = substr($url, 0, $split); + $relative_url = ''; + } + else if ($relative_url) + { + // same for $relative_url + $split = false; + foreach ($chars as $char) + { + $next_split = strpos($relative_url, $char); + if ($next_split !== false) + { + $split = ($split !== false) ? min($split, $next_split) : $next_split; + } + } + + if ($split !== false) + { + $append = substr($relative_url, $split); + $relative_url = substr($relative_url, 0, $split); + } + } + + // if the last character of the url is a punctuation mark, exclude it from the url + $last_char = ($relative_url) ? $relative_url[strlen($relative_url) - 1] : $url[strlen($url) - 1]; + + switch ($last_char) + { + case '.': + case '?': + case '!': + case ':': + case ',': + $append = $last_char; + if ($relative_url) + { + $relative_url = substr($relative_url, 0, -1); + } + else + { + $url = substr($url, 0, -1); + } + break; + + // set last_char to empty here, so the variable can be used later to + // check whether a character was removed + default: + $last_char = ''; + break; + } + + $short_url = (utf8_strlen($url) > 55) ? utf8_substr($url, 0, 39) . ' ... ' . utf8_substr($url, -10) : $url; + + switch ($type) + { + case MAGIC_URL_LOCAL: + $tag = 'l'; + $relative_url = preg_replace('/[&?]sid=[0-9a-f]{32}$/', '', preg_replace('/([&?])sid=[0-9a-f]{32}&/', '$1', $relative_url)); + $url = $url . '/' . $relative_url; + $text = $relative_url; + + // this url goes to http://domain.tld/path/to/board/ which + // would result in an empty link if treated as local so + // don't touch it and let MAGIC_URL_FULL take care of it. + if (!$relative_url) + { + return $whitespace . $orig_url . '/' . $orig_relative; // slash is taken away by relative url pattern + } + break; + + case MAGIC_URL_FULL: + $tag = 'm'; + $text = $short_url; + break; + + case MAGIC_URL_WWW: + $tag = 'w'; + $url = 'http://' . $url; + $text = $short_url; + break; + + case MAGIC_URL_EMAIL: + $tag = 'e'; + $text = $short_url; + $url = 'mailto:' . $url; + break; + } + + $url = htmlspecialchars($url); + $text = htmlspecialchars($text); + $append = htmlspecialchars($append); + + $html = "$whitespace$text$append"; + + return $html; +} + +/** +* make_clickable function +* +* Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx. +* Cuts down displayed size of link if over 50 chars, turns absolute links +* into relative versions when the server/script path matches the link +*/ +function make_clickable($text, $server_url = false, $class = 'postlink') +{ + if ($server_url === false) + { + $server_url = generate_board_url(); + } + + static $static_class; + static $magic_url_match_args; + + if (!isset($magic_url_match_args[$server_url]) || $static_class != $class) + { + $static_class = $class; + $class = ($static_class) ? ' class="' . $static_class . '"' : ''; + $local_class = ($static_class) ? ' class="' . $static_class . '-local"' : ''; + + if (!is_array($magic_url_match_args)) + { + $magic_url_match_args = array(); + } + + // relative urls for this board + $magic_url_match_args[$server_url][] = array( + '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#iu', + MAGIC_URL_LOCAL, + $local_class, + ); + + // matches a xxxx://aaaaa.bbb.cccc. ... + $magic_url_match_args[$server_url][] = array( + '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#iu', + MAGIC_URL_FULL, + $class, + ); + + // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing + $magic_url_match_args[$server_url][] = array( + '#(^|[\n\t (>])(' . get_preg_expression('www_url_inline') . ')#iu', + MAGIC_URL_WWW, + $class, + ); + + // matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode. + $magic_url_match_args[$server_url][] = array( + '/(^|[\n\t (>])(' . get_preg_expression('email') . ')/iu', + MAGIC_URL_EMAIL, + '', + ); + } + + foreach ($magic_url_match_args[$server_url] as $magic_args) + { + if (preg_match($magic_args[0], $text, $matches)) + { + $text = preg_replace_callback($magic_args[0], function($matches) use ($magic_args) + { + $relative_url = isset($matches[3]) ? $matches[3] : ''; + return make_clickable_callback($magic_args[1], $matches[1], $matches[2], $relative_url, $magic_args[2]); + }, $text); + } + } + + return $text; +} + +/** +* Censoring +*/ +function censor_text($text) +{ + static $censors; + + // Nothing to do? + if ($text === '') + { + return ''; + } + + // We moved the word censor checks in here because we call this function quite often - and then only need to do the check once + if (!isset($censors) || !is_array($censors)) + { + global $config, $user, $auth, $cache; + + // We check here if the user is having viewing censors disabled (and also allowed to do so). + if (!$user->optionget('viewcensors') && $config['allow_nocensors'] && $auth->acl_get('u_chgcensors')) + { + $censors = array(); + } + else + { + $censors = $cache->obtain_word_list(); + } + } + + if (count($censors)) + { + return preg_replace($censors['match'], $censors['replace'], $text); + } + + return $text; +} + +/** +* custom version of nl2br which takes custom BBCodes into account +*/ +function bbcode_nl2br($text) +{ + // custom BBCodes might contain carriage returns so they + // are not converted into
so now revert that + $text = str_replace(array("\n", "\r"), array('
', "\n"), $text); + return $text; +} + +/** +* Smiley processing +*/ +function smiley_text($text, $force_option = false) +{ + global $config, $user, $phpbb_path_helper, $phpbb_dispatcher; + + if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) + { + return preg_replace('##', ''; + } + } + + $filesize = get_formatted_filesize($attachment['filesize'], false); + + $comment = bbcode_nl2br(censor_text($attachment['attach_comment'])); + + $block_array += array( + 'UPLOAD_ICON' => $upload_icon, + 'FILESIZE' => $filesize['value'], + 'SIZE_LANG' => $filesize['unit'], + 'DOWNLOAD_NAME' => utf8_basename($attachment['real_filename']), + 'COMMENT' => $comment, + ); + + $denied = false; + + if (!extension_allowed($forum_id, $attachment['extension'], $extensions)) + { + $denied = true; + + $block_array += array( + 'S_DENIED' => true, + 'DENIED_MESSAGE' => sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']) + ); + } + + if (!$denied) + { + $display_cat = $extensions[$attachment['extension']]['display_cat']; + + if ($display_cat == ATTACHMENT_CATEGORY_IMAGE) + { + if ($attachment['thumbnail']) + { + $display_cat = ATTACHMENT_CATEGORY_THUMB; + } + else + { + if ($config['img_display_inlined']) + { + if ($config['img_link_width'] || $config['img_link_height']) + { + $dimension = @getimagesize($filename); + + // If the dimensions could not be determined or the image being 0x0 we display it as a link for safety purposes + if ($dimension === false || empty($dimension[0]) || empty($dimension[1])) + { + $display_cat = ATTACHMENT_CATEGORY_NONE; + } + else + { + $display_cat = ($dimension[0] <= $config['img_link_width'] && $dimension[1] <= $config['img_link_height']) ? ATTACHMENT_CATEGORY_IMAGE : ATTACHMENT_CATEGORY_NONE; + } + } + } + else + { + $display_cat = ATTACHMENT_CATEGORY_NONE; + } + } + } + + // Make some descisions based on user options being set. + if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !$user->optionget('viewimg')) + { + $display_cat = ATTACHMENT_CATEGORY_NONE; + } + + $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']); + $l_downloaded_viewed = 'VIEWED_COUNTS'; + + switch ($display_cat) + { + // Images + case ATTACHMENT_CATEGORY_IMAGE: + $inline_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']); + $download_link .= '&mode=view'; + + $block_array += array( + 'S_IMAGE' => true, + 'U_INLINE_LINK' => $inline_link, + ); + + $update_count_ary[] = $attachment['attach_id']; + break; + + // Images, but display Thumbnail + case ATTACHMENT_CATEGORY_THUMB: + $thumbnail_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id'] . '&t=1'); + $download_link .= '&mode=view'; + + $block_array += array( + 'S_THUMBNAIL' => true, + 'THUMB_IMAGE' => $thumbnail_link, + ); + + $update_count_ary[] = $attachment['attach_id']; + break; + + default: + $l_downloaded_viewed = 'DOWNLOAD_COUNTS'; + + $block_array += array( + 'S_FILE' => true, + ); + break; + } + + if (!isset($attachment['download_count'])) + { + $attachment['download_count'] = 0; + } + + $block_array += array( + 'U_DOWNLOAD_LINK' => $download_link, + 'L_DOWNLOAD_COUNT' => $user->lang($l_downloaded_viewed, (int) $attachment['download_count']), + ); + } + + $update_count = $update_count_ary; + /** + * Use this event to modify the attachment template data. + * + * This event is triggered once per attachment. + * + * @event core.parse_attachments_modify_template_data + * @var array attachment Array with attachment data + * @var array block_array Template data of the attachment + * @var int display_cat Attachment category data + * @var string download_link Attachment download link + * @var array extensions Array with attachment extensions data + * @var mixed forum_id The forum id the attachments are displayed in (false if in private message) + * @var bool preview Flag indicating if we are in post preview mode + * @var array update_count Array with attachment ids to update download count + * @since 3.1.0-RC5 + */ + $vars = array( + 'attachment', + 'block_array', + 'display_cat', + 'download_link', + 'extensions', + 'forum_id', + 'preview', + 'update_count', + ); + extract($phpbb_dispatcher->trigger_event('core.parse_attachments_modify_template_data', compact($vars))); + $update_count_ary = $update_count; + unset($update_count); + + $template->assign_block_vars('_file', $block_array); + + $compiled_attachments[] = $template->assign_display('attachment_tpl'); + } + + $attachments = $compiled_attachments; + unset($compiled_attachments); + + $unset_tpl = array(); + + preg_match_all('#(.*?)#', $message, $matches, PREG_PATTERN_ORDER); + + $replace = array(); + foreach ($matches[0] as $num => $capture) + { + $index = $matches[1][$num]; + + $replace['from'][] = $matches[0][$num]; + $replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]); + + $unset_tpl[] = $index; + } + + if (isset($replace['from'])) + { + $message = str_replace($replace['from'], $replace['to'], $message); + } + + $unset_tpl = array_unique($unset_tpl); + + // Sort correctly + if ($config['display_order']) + { + // Ascending sort + krsort($attachments); + } + else + { + // Descending sort + ksort($attachments); + } + + // Needed to let not display the inlined attachments at the end of the post again + foreach ($unset_tpl as $index) + { + unset($attachments[$index]); + } +} + +/** +* Check if extension is allowed to be posted. +* +* @param mixed $forum_id The forum id to check or false if private message +* @param string $extension The extension to check, for example zip. +* @param array &$extensions The extension array holding the information from the cache (will be obtained if empty) +* +* @return bool False if the extension is not allowed to be posted, else true. +*/ +function extension_allowed($forum_id, $extension, &$extensions) +{ + if (empty($extensions)) + { + global $cache; + $extensions = $cache->obtain_attach_extensions($forum_id); + } + + return (!isset($extensions['_allowed_'][$extension])) ? false : true; +} + +/** +* Truncates string while retaining special characters if going over the max length +* The default max length is 60 at the moment +* The maximum storage length is there to fit the string within the given length. The string may be further truncated due to html entities. +* For example: string given is 'a "quote"' (length: 9), would be a stored as 'a "quote"' (length: 19) +* +* @param string $string The text to truncate to the given length. String is specialchared. +* @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char) +* @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars). +* @param bool $allow_reply Allow Re: in front of string +* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated. +* @param string $append String to be appended +*/ +function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '') +{ + $strip_reply = false; + $stripped = false; + if ($allow_reply && strpos($string, 'Re: ') === 0) + { + $strip_reply = true; + $string = substr($string, 4); + } + + $_chars = utf8_str_split(htmlspecialchars_decode($string)); + $chars = array_map('utf8_htmlspecialchars', $_chars); + + // Now check the length ;) + if (count($chars) > $max_length) + { + // Cut off the last elements from the array + $string = implode('', array_slice($chars, 0, $max_length - utf8_strlen($append))); + $stripped = true; + } + + // Due to specialchars, we may not be able to store the string... + if (utf8_strlen($string) > $max_store_length) + { + // let's split again, we do not want half-baked strings where entities are split + $_chars = utf8_str_split(htmlspecialchars_decode($string)); + $chars = array_map('utf8_htmlspecialchars', $_chars); + + do + { + array_pop($chars); + $string = implode('', $chars); + } + while (!empty($chars) && utf8_strlen($string) > $max_store_length); + } + + if ($strip_reply) + { + $string = 'Re: ' . $string; + } + + if ($append != '' && $stripped) + { + $string = $string . $append; + } + + return $string; +} + +/** +* Get username details for placing into templates. +* This function caches all modes on first call, except for no_profile and anonymous user - determined by $user_id. +* +* @html Username spans and links +* +* @param string $mode Can be profile (for getting an url to the profile), username (for obtaining the username), colour (for obtaining the user colour), full (for obtaining a html string representing a coloured link to the users profile) or no_profile (the same as full but forcing no profile link) +* @param int $user_id The users id +* @param string $username The users name +* @param string $username_colour The users colour +* @param string $guest_username optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then. +* @param string $custom_profile_url optional parameter to specify a profile url. The user id get appended to this url as &u={user_id} +* +* @return string A string consisting of what is wanted based on $mode. +*/ +function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false) +{ + static $_profile_cache; + global $phpbb_dispatcher; + + // We cache some common variables we need within this function + if (empty($_profile_cache)) + { + global $phpbb_root_path, $phpEx; + + /** @html Username spans and links for usage in the template */ + $_profile_cache['base_url'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u={USER_ID}'); + $_profile_cache['tpl_noprofile'] = '{USERNAME}'; + $_profile_cache['tpl_noprofile_colour'] = '{USERNAME}'; + $_profile_cache['tpl_profile'] = '{USERNAME}'; + $_profile_cache['tpl_profile_colour'] = '{USERNAME}'; + } + + global $user, $auth; + + // This switch makes sure we only run code required for the mode + switch ($mode) + { + case 'full': + case 'no_profile': + case 'colour': + + // Build correct username colour + $username_colour = ($username_colour) ? '#' . $username_colour : ''; + + // Return colour + if ($mode == 'colour') + { + $username_string = $username_colour; + break; + } + + // no break; + + case 'username': + + // Build correct username + if ($guest_username === false) + { + $username = ($username) ? $username : $user->lang['GUEST']; + } + else + { + $username = ($user_id && $user_id != ANONYMOUS) ? $username : ((!empty($guest_username)) ? $guest_username : $user->lang['GUEST']); + } + + // Return username + if ($mode == 'username') + { + $username_string = $username; + break; + } + + // no break; + + case 'profile': + + // Build correct profile url - only show if not anonymous and permission to view profile if registered user + // For anonymous the link leads to a login page. + if ($user_id && $user_id != ANONYMOUS && ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('u_viewprofile'))) + { + $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&u=' . (int) $user_id : str_replace(array('={USER_ID}', '=%7BUSER_ID%7D'), '=' . (int) $user_id, $_profile_cache['base_url']); + } + else + { + $profile_url = ''; + } + + // Return profile + if ($mode == 'profile') + { + $username_string = $profile_url; + break; + } + + // no break; + } + + if (!isset($username_string)) + { + if (($mode == 'full' && !$profile_url) || $mode == 'no_profile') + { + $username_string = str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']); + } + else + { + $username_string = str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']); + } + } + + /** + * Use this event to change the output of get_username_string() + * + * @event core.modify_username_string + * @var string mode profile|username|colour|full|no_profile + * @var int user_id String or array of additional url + * parameters + * @var string username The user's username + * @var string username_colour The user's colour + * @var string guest_username Optional parameter to specify the + * guest username. + * @var string custom_profile_url Optional parameter to specify a + * profile url. + * @var string username_string The string that has been generated + * @var array _profile_cache Array of original return templates + * @since 3.1.0-a1 + */ + $vars = array( + 'mode', + 'user_id', + 'username', + 'username_colour', + 'guest_username', + 'custom_profile_url', + 'username_string', + '_profile_cache', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_username_string', compact($vars))); + + return $username_string; +} + +/** + * Add an option to the quick-mod tools. + * + * @param string $url The recepting URL for the quickmod actions. + * @param string $option The language key for the value of the option. + * @param string $lang_string The language string to use. + */ +function phpbb_add_quickmod_option($url, $option, $lang_string) +{ + global $template, $user, $phpbb_path_helper; + + $lang_string = $user->lang($lang_string); + $template->assign_block_vars('quickmod', array( + 'VALUE' => $option, + 'TITLE' => $lang_string, + 'LINK' => $phpbb_path_helper->append_url_params($url, array('action' => $option)), + )); +} + +/** +* Concatenate an array into a string list. +* +* @param array $items Array of items to concatenate +* @param object $user The phpBB $user object. +* +* @return string String list. Examples: "A"; "A and B"; "A, B, and C" +*/ +function phpbb_generate_string_list($items, $user) +{ + if (empty($items)) + { + return ''; + } + + $count = count($items); + $last_item = array_pop($items); + $lang_key = 'STRING_LIST_MULTI'; + + if ($count == 1) + { + return $last_item; + } + else if ($count == 2) + { + $lang_key = 'STRING_LIST_SIMPLE'; + } + $list = implode($user->lang['COMMA_SEPARATOR'], $items); + + return $user->lang($lang_key, $list, $last_item); +} + +class bitfield +{ + var $data; + + function __construct($bitfield = '') + { + $this->data = base64_decode($bitfield); + } + + /** + */ + function get($n) + { + // Get the ($n / 8)th char + $byte = $n >> 3; + + if (strlen($this->data) >= $byte + 1) + { + $c = $this->data[$byte]; + + // Lookup the ($n % 8)th bit of the byte + $bit = 7 - ($n & 7); + return (bool) (ord($c) & (1 << $bit)); + } + else + { + return false; + } + } + + function set($n) + { + $byte = $n >> 3; + $bit = 7 - ($n & 7); + + if (strlen($this->data) >= $byte + 1) + { + $this->data[$byte] = $this->data[$byte] | chr(1 << $bit); + } + else + { + $this->data .= str_repeat("\0", $byte - strlen($this->data)); + $this->data .= chr(1 << $bit); + } + } + + function clear($n) + { + $byte = $n >> 3; + + if (strlen($this->data) >= $byte + 1) + { + $bit = 7 - ($n & 7); + $this->data[$byte] = $this->data[$byte] &~ chr(1 << $bit); + } + } + + function get_blob() + { + return $this->data; + } + + function get_base64() + { + return base64_encode($this->data); + } + + function get_bin() + { + $bin = ''; + $len = strlen($this->data); + + for ($i = 0; $i < $len; ++$i) + { + $bin .= str_pad(decbin(ord($this->data[$i])), 8, '0', STR_PAD_LEFT); + } + + return $bin; + } + + function get_all_set() + { + return array_keys(array_filter(str_split($this->get_bin()))); + } + + function merge($bitfield) + { + $this->data = $this->data | $bitfield->get_blob(); + } +} + +/** + * Formats the quote according to the given BBCode status setting + * + * @param phpbb\language\language $language Language class + * @param parse_message $message_parser Message parser class + * @param phpbb\textformatter\utils_interface $text_formatter_utils Text formatter utilities + * @param bool $bbcode_status The status of the BBCode setting + * @param array $quote_attributes The attributes of the quoted post + * @param string $message_link Link of the original quoted post + */ +function phpbb_format_quote($language, $message_parser, $text_formatter_utils, $bbcode_status, $quote_attributes, $message_link = '') +{ + if ($bbcode_status) + { + $quote_text = $text_formatter_utils->generate_quote( + censor_text($message_parser->message), + $quote_attributes + ); + + $message_parser->message = $quote_text . "\n\n"; + } + else + { + $offset = 0; + $quote_string = "> "; + $message = censor_text(trim($message_parser->message)); + // see if we are nesting. It's easily tricked but should work for one level of nesting + if (strpos($message, ">") !== false) + { + $offset = 10; + } + $message = utf8_wordwrap($message, 75 + $offset, "\n"); + + $message = $quote_string . $message; + $message = str_replace("\n", "\n" . $quote_string, $message); + + $message_parser->message = $quote_attributes['author'] . " " . $language->lang('WROTE') . ":\n" . $message . "\n"; + } + + if ($message_link) + { + $message_parser->message = $message_link . $message_parser->message; + } +} diff --git a/install/update/new/includes/functions_convert.php b/install/update/new/includes/functions_convert.php new file mode 100644 index 0000000..96e1087 --- /dev/null +++ b/install/update/new/includes/functions_convert.php @@ -0,0 +1,2500 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Default avatar width/height +* @ignore +*/ +define('DEFAULT_AVATAR_X', 80); +define('DEFAULT_AVATAR_Y', 80); + +// Global functions - all functions can be used by convertors + +// SIMPLE FUNCTIONS + +/** +* Return the preceding value +*/ +function dec($var) +{ + return --$var; +} + +/** +* Return the next value +*/ +function inc($var) +{ + return ++$var; +} + +/** +* Return whether the value is positive +*/ +function is_positive($n) +{ + return ($n > 0) ? 1 : 0; +} + +/** +* Boolean inverse of the value +*/ +function not($var) +{ + return ($var) ? 0 : 1; +} + +/** +* Convert a textual value to it's equivalent boolean value +* +* @param string $str String to convert (converts yes, on, y, 1 and true to boolean true) +* @return boolean The equivalent value +*/ +function str_to_bool($str) +{ + $str = strtolower($str); + return ($str == 'yes' || $str == 'on' || $str == 'y' || $str == 'true' || $str == '1') ? true : false; +} + +/** +* Function to mimic php's empty() function (it is the same) +*/ +function is_empty($mixed) +{ + return empty($mixed); +} + +/** +* Convert the name of a user's primary group to the appropriate equivalent phpBB group id +* +* @param string $status The name of the group +* @return int The group_id corresponding to the equivalent group +*/ +function str_to_primary_group($status) +{ + switch (ucfirst(strtolower($status))) + { + case 'Administrator': + return get_group_id('administrators'); + break; + + case 'Super moderator': + case 'Global moderator': + case 'Moderator': + return get_group_id('global_moderators'); + break; + + case 'Guest': + case 'Anonymous': + return get_group_id('guests'); + break; + + default: + return get_group_id('registered'); + break; + } +} + +/** +* Convert a boolean into the appropriate phpBB constant indicating whether the item is locked +*/ +function is_item_locked($bool) +{ + return ($bool) ? ITEM_LOCKED : ITEM_UNLOCKED; +} + +/** +* Convert a value from days to seconds +*/ +function days_to_seconds($days) +{ + return ($days * 86400); +} + +/** +* Determine whether a user is anonymous and return the appropriate new user_id +*/ +function is_user_anonymous($user_id) +{ + return ($user_id > ANONYMOUS) ? $user_id : ANONYMOUS; +} + +/** +* Generate a key value based on existing values +* +* @param int $pad Amount to add to the maximum value +* @return int Key value +*/ +function auto_id($pad = 0) +{ + global $auto_id, $convert_row; + + if (!empty($convert_row['max_id'])) + { + return $convert_row['max_id'] + $pad; + } + + return $auto_id + $pad; +} + +/** +* Convert a boolean into the appropriate phpBB constant indicating whether the user is active +*/ +function set_user_type($user_active) +{ + return ($user_active) ? USER_NORMAL : USER_INACTIVE; +} + +/** +* Convert a value from minutes to hours +*/ +function minutes_to_hours($minutes) +{ + return ($minutes / 3600); +} + +/** +* Return the group_id for a given group name +*/ +function get_group_id($group_name) +{ + global $db, $group_mapping; + + if (empty($group_mapping)) + { + $sql = 'SELECT group_name, group_id + FROM ' . GROUPS_TABLE; + $result = $db->sql_query($sql); + + $group_mapping = array(); + while ($row = $db->sql_fetchrow($result)) + { + $group_mapping[strtoupper($row['group_name'])] = (int) $row['group_id']; + } + $db->sql_freeresult($result); + } + + if (!count($group_mapping)) + { + add_default_groups(); + return get_group_id($group_name); + } + + if (isset($group_mapping[strtoupper($group_name)])) + { + return $group_mapping[strtoupper($group_name)]; + } + + return $group_mapping['REGISTERED']; +} + +/** +* Convert a boolean into the appropriate phpBB constant indicating whether the topic is locked +*/ +function is_topic_locked($bool) +{ + return (!empty($bool)) ? ITEM_LOCKED : ITEM_UNLOCKED; +} + +/** +* Generate a bbcode_uid value +*/ +function make_uid($timestamp) +{ + static $last_timestamp, $last_uid; + + if (empty($last_timestamp) || $timestamp != $last_timestamp) + { + $last_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN); + } + $last_timestamp = $timestamp; + return $last_uid; +} + + +/** +* Validate a website address +*/ +function validate_website($url) +{ + if ($url === 'http://') + { + return ''; + } + else if (!preg_match('#^http[s]?://#i', $url) && strlen($url) > 0) + { + return 'http://' . $url; + } + return $url; +} + +/** +* Convert nulls to zeros for fields which allowed a NULL value in the source but not the destination +*/ +function null_to_zero($value) +{ + return ($value === NULL) ? 0 : $value; +} + +/** +* Convert nulls to empty strings for fields which allowed a NULL value in the source but not the destination +*/ +function null_to_str($value) +{ + return ($value === NULL) ? '' : $value; +} + +// EXTENDED FUNCTIONS + +/** +* Get old config value +*/ +function get_config_value($config_name) +{ + static $convert_config; + + if (!isset($convert_config)) + { + $convert_config = get_config(); + } + + if (!isset($convert_config[$config_name])) + { + return false; + } + + return (empty($convert_config[$config_name])) ? '' : $convert_config[$config_name]; +} + +/** +* Convert an IP address from the hexadecimal notation to normal dotted-quad notation +*/ +function decode_ip($int_ip) +{ + if (!$int_ip) + { + return $int_ip; + } + + $hexipbang = explode('.', chunk_split($int_ip, 2, '.')); + + // Any mod changing the way ips are stored? Then we are not able to convert and enter the ip "as is" to not "destroy" anything... + if (count($hexipbang) < 4) + { + return $int_ip; + } + + return hexdec($hexipbang[0]) . '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]); +} + +/** +* Reverse the encoding of wild-carded bans +*/ +function decode_ban_ip($int_ip) +{ + return str_replace('255', '*', decode_ip($int_ip)); +} + +/** +* Determine the MIME-type of a specified filename +* This does not actually inspect the file, but simply uses the file extension +*/ +function mimetype($filename) +{ + if (!preg_match('/\.([a-z0-9]+)$/i', $filename, $m)) + { + return 'application/octet-stream'; + } + + switch (strtolower($m[1])) + { + case 'zip': return 'application/zip'; + case 'jpeg': return 'image/jpeg'; + case 'jpg': return 'image/jpeg'; + case 'jpe': return 'image/jpeg'; + case 'png': return 'image/png'; + case 'gif': return 'image/gif'; + case 'htm': + case 'html': return 'text/html'; + case 'tif': return 'image/tiff'; + case 'tiff': return 'image/tiff'; + case 'ras': return 'image/x-cmu-raster'; + case 'pnm': return 'image/x-portable-anymap'; + case 'pbm': return 'image/x-portable-bitmap'; + case 'pgm': return 'image/x-portable-graymap'; + case 'ppm': return 'image/x-portable-pixmap'; + case 'rgb': return 'image/x-rgb'; + case 'xbm': return 'image/x-xbitmap'; + case 'xpm': return 'image/x-xpixmap'; + case 'xwd': return 'image/x-xwindowdump'; + case 'z': return 'application/x-compress'; + case 'gtar': return 'application/x-gtar'; + case 'tgz': return 'application/x-gtar'; + case 'gz': return 'application/x-gzip'; + case 'tar': return 'application/x-tar'; + case 'xls': return 'application/excel'; + case 'pdf': return 'application/pdf'; + case 'ppt': return 'application/powerpoint'; + case 'rm': return 'application/vnd.rn-realmedia'; + case 'wma': return 'audio/x-ms-wma'; + case 'swf': return 'application/x-shockwave-flash'; + case 'ief': return 'image/ief'; + case 'doc': + case 'dot': + case 'wrd': return 'application/msword'; + case 'ai': + case 'eps': + case 'ps': return 'application/postscript'; + case 'asc': + case 'txt': + case 'c': + case 'cc': + case 'h': + case 'hh': + case 'cpp': + case 'hpp': + case 'php': + case 'php3': return 'text/plain'; + default: return 'application/octet-stream'; + } +} + +/** +* Obtain the dimensions of all remotely hosted avatars +* This should only be called from execute_last +* There can be significant network overhead if there are a large number of remote avatars +* @todo Look at the option of allowing the user to decide whether this is called or to force the dimensions +*/ +function remote_avatar_dims() +{ + global $db; + + $sql = 'SELECT user_id, user_avatar + FROM ' . USERS_TABLE . ' + WHERE user_avatar_type = ' . AVATAR_REMOTE; + $result = $db->sql_query($sql); + + $remote_avatars = array(); + while ($row = $db->sql_fetchrow($result)) + { + $remote_avatars[(int) $row['user_id']] = $row['user_avatar']; + } + $db->sql_freeresult($result); + + foreach ($remote_avatars as $user_id => $avatar) + { + $width = (int) get_remote_avatar_dim($avatar, 0); + $height = (int) get_remote_avatar_dim($avatar, 1); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_avatar_width = ' . (int) $width . ', user_avatar_height = ' . (int) $height . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + } +} + +function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false) +{ + global $config, $convert, $user; + + $relative_path = empty($convert->convertor['source_path_absolute']); + + // check for trailing slash + if (rtrim($convert->convertor['avatar_gallery_path'], '/') === '') + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_GALLERY_PATH'], 'import_avatar_gallery()'), __LINE__, __FILE__); + } + + $src_path = relative_base(path($convert->convertor['avatar_gallery_path'], $relative_path), $relative_path); + + if (is_dir($src_path)) + { + // Do not die on failure... safe mode restrictions may be in effect. + copy_dir($convert->convertor['avatar_gallery_path'], path($config['avatar_gallery_path']) . $gallery_name, !$subdirs_as_galleries, false, false, $relative_path); + + // only doing 1 level deep. (ibf 1.x) + // notes: ibf has 2 tiers: directly in the avatar directory for base gallery (handled in the above statement), plus subdirs(handled below). + // recursive subdirs ignored. -- i don't know if other forums support recursive galleries. if they do, this following code could be upgraded to be recursive. + if ($subdirs_as_galleries) + { + $dirlist = array(); + if ($handle = @opendir($src_path)) + { + while ($entry = readdir($handle)) + { + if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm') + { + continue; + } + + if (is_dir($src_path . $entry)) + { + $dirlist[] = $entry; + } + } + closedir($handle); + } + else if ($dir = @dir($src_path)) + { + while ($entry = $dir->read()) + { + if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm') + { + continue; + } + + if (is_dir($src_path . $entry)) + { + $dirlist[] = $entry; + } + } + $dir->close(); + } + + for ($i = 0, $end = count($dirlist); $i < $end; ++$i) + { + $dir = $dirlist[$i]; + + // Do not die on failure... safe mode restrictions may be in effect. + copy_dir(path($convert->convertor['avatar_gallery_path'], $relative_path) . $dir, path($config['avatar_gallery_path']) . $dir, true, false, false, $relative_path); + } + } + } +} + +function import_attachment_files($category_name = '') +{ + global $config, $convert, $db, $user; + + $sql = 'SELECT config_value AS upload_path + FROM ' . CONFIG_TABLE . " + WHERE config_name = 'upload_path'"; + $result = $db->sql_query($sql); + $config['upload_path'] = $db->sql_fetchfield('upload_path'); + $db->sql_freeresult($result); + + $relative_path = empty($convert->convertor['source_path_absolute']); + + if (empty($convert->convertor['upload_path'])) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_UPLOAD_DIR'], 'import_attachment_files()'), __LINE__, __FILE__); + } + + if (is_dir(relative_base(path($convert->convertor['upload_path'], $relative_path), $relative_path))) + { + copy_dir($convert->convertor['upload_path'], path($config['upload_path']) . $category_name, true, false, true, $relative_path); + } +} + +function attachment_forum_perms($forum_id) +{ + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + return serialize($forum_id); +} + +// base64todec function +// -> from php manual? +function base64_unpack($string) +{ + $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-'; + $base = strlen($chars); + + $length = strlen($string); + $number = 0; + + for ($i = 1; $i <= $length; $i++) + { + $pos = $length - $i; + $operand = strpos($chars, substr($string, $pos, 1)); + $exponent = pow($base, $i-1); + $dec_value = $operand * $exponent; + $number += $dec_value; + } + + return $number; +} + +function _import_check($config_var, $source, $use_target) +{ + global $convert, $config; + + $result = array( + 'orig_source' => $source, + 'copied' => false, + 'relative_path' => (empty($convert->convertor['source_path_absolute'])) ? true : false, + ); + + // copy file will prepend $phpBB_root_path + $target = $config[$config_var] . '/' . utf8_basename(($use_target === false) ? $source : $use_target); + + if (!empty($convert->convertor[$config_var]) && strpos($source, $convert->convertor[$config_var]) !== 0) + { + $source = $convert->convertor[$config_var] . $source; + } + + $result['source'] = $source; + + if (file_exists(relative_base($source, $result['relative_path'], __LINE__, __FILE__))) + { + $result['copied'] = copy_file($source, $target, false, false, $result['relative_path']); + } + + if ($result['copied']) + { + $result['target'] = utf8_basename($target); + } + else + { + $result['target'] = ($use_target !== false) ? $result['orig_source'] : utf8_basename($target); + } + + return $result; +} + +function import_attachment($source, $use_target = false) +{ + if (empty($source)) + { + return ''; + } + + global $convert, $config, $user; + + // check for trailing slash + if (rtrim($convert->convertor['upload_path'], '/') === '') + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_UPLOAD_DIR'], 'import_attachment()'), __LINE__, __FILE__); + } + + $result = _import_check('upload_path', $source, $use_target); + + if ($result['copied']) + { + // Thumbnails? + if (is_array($convert->convertor['thumbnails'])) + { + $thumb_dir = $convert->convertor['thumbnails'][0]; + $thumb_prefix = $convert->convertor['thumbnails'][1]; + $thumb_source = $thumb_dir . $thumb_prefix . utf8_basename($result['source']); + + if (strpos($thumb_source, $convert->convertor['upload_path']) !== 0) + { + $thumb_source = $convert->convertor['upload_path'] . $thumb_source; + } + $thumb_target = $config['upload_path'] . '/thumb_' . $result['target']; + + if (file_exists(relative_base($thumb_source, $result['relative_path'], __LINE__, __FILE__))) + { + copy_file($thumb_source, $thumb_target, false, false, $result['relative_path']); + } + } + } + + return $result['target']; +} + +function import_rank($source, $use_target = false) +{ + if (empty($source)) + { + return ''; + } + + global $convert, $user; + + if (!isset($convert->convertor['ranks_path'])) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_RANKS_PATH'], 'import_rank()'), __LINE__, __FILE__); + } + + $result = _import_check('ranks_path', $source, $use_target); + return $result['target']; +} + +function import_smiley($source, $use_target = false) +{ + if (empty($source)) + { + return ''; + } + + global $convert, $user; + + // check for trailing slash + if (rtrim($convert->convertor['smilies_path'], '/') === '') + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_SMILIES_PATH'], 'import_smiley()'), __LINE__, __FILE__); + } + + $result = _import_check('smilies_path', $source, $use_target); + return $result['target']; +} + +/* +*/ +function import_avatar($source, $use_target = false, $user_id = false) +{ + if (empty($source) || preg_match('#^https?:#i', $source) || preg_match('#blank\.(gif|png)$#i', $source)) + { + return; + } + + global $convert, $config, $user; + + // check for trailing slash + if (rtrim($convert->convertor['avatar_path'], '/') === '') + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_AVATAR_PATH'], 'import_avatar()'), __LINE__, __FILE__); + } + + if ($use_target === false && $user_id !== false) + { + $use_target = $config['avatar_salt'] . '_' . $user_id . '.' . substr(strrchr($source, '.'), 1); + } + + _import_check('avatar_path', $source, $use_target); + + return ((!empty($user_id)) ? $user_id : $use_target) . '.' . substr(strrchr($source, '.'), 1); +} + +/** +* @todo all image dimension functions below (there are a *lot*) should get revisited and converted to one or two functions (no more needed, really). +*/ + +/** +* Calculate the size of the specified image +* Called from the following functions for calculating the size of specific image types +*/ +function get_image_dim($source) +{ + if (empty($source)) + { + return array(0, 0); + } + + global $convert; + + $relative_path = empty($convert->convertor['source_path_absolute']); + + if (file_exists(relative_base($source, $relative_path))) + { + $image = relative_base($source, $relative_path); + return @getimagesize($image); + } + + return false; +} + +/** +* Obtain the width of the specified smilie +*/ +function get_smiley_width($src) +{ + return get_smiley_dim($src, 0); +} + +/** +* Obtain the height of the specified smilie +*/ +function get_smiley_height($src) +{ + return get_smiley_dim($src, 1); +} + +/** +* Obtain the size of the specified smilie (using the cache if possible) and cache the value +*/ +function get_smiley_dim($source, $axis) +{ + if (empty($source)) + { + return 15; + } + + static $smiley_cache = array(); + + if (isset($smiley_cache[$source])) + { + return $smiley_cache[$source][$axis]; + } + + global $convert, $user; + + $orig_source = $source; + + if (!isset($convert->convertor['smilies_path'])) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_SMILIES_PATH'], 'get_smiley_dim()'), __LINE__, __FILE__); + } + + if (!empty($convert->convertor['smilies_path']) && strpos($source, $convert->convertor['smilies_path']) !== 0) + { + $source = $convert->convertor['smilies_path'] . $source; + } + + $smiley_cache[$orig_source] = get_image_dim($source); + + if (empty($smiley_cache[$orig_source]) || empty($smiley_cache[$orig_source][0]) || empty($smiley_cache[$orig_source][1])) + { + $smiley_cache[$orig_source] = array(15, 15); + return 15; + } + + return $smiley_cache[$orig_source][$axis]; +} + +/** +* Obtain the width of the specified avatar +*/ +function get_avatar_width($src, $func = false, $arg1 = false, $arg2 = false) +{ + return get_avatar_dim($src, 0, $func, $arg1, $arg2); +} + +/** +* Obtain the height of the specified avatar +*/ +function get_avatar_height($src, $func = false, $arg1 = false, $arg2 = false) +{ + return get_avatar_dim($src, 1, $func, $arg1, $arg2); +} + +/** +*/ +function get_avatar_dim($src, $axis, $func = false, $arg1 = false, $arg2 = false) +{ + $avatar_type = AVATAR_UPLOAD; + + if ($func) + { + if ($arg1 || $arg2) + { + $ary = array($arg1); + + if ($arg2) + { + $ary[] = $arg2; + } + + $avatar_type = call_user_func_array($func, $ary); + } + else + { + $avatar_type = call_user_func($func); + } + } + + switch ($avatar_type) + { + case AVATAR_UPLOAD: + return get_upload_avatar_dim($src, $axis); + break; + + case AVATAR_GALLERY: + return get_gallery_avatar_dim($src, $axis); + break; + + case AVATAR_REMOTE: + // see notes on this functions usage and (hopefully) model $func to avoid this accordingly + return get_remote_avatar_dim($src, $axis); + break; + + default: + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + + return $axis ? $default_y : $default_x; + break; + } +} + +/** +* Obtain the size of the specified uploaded avatar (using the cache if possible) and cache the value +*/ +function get_upload_avatar_dim($source, $axis) +{ + static $cachedims = false; + static $cachekey = false; + + if (empty($source)) + { + return 0; + } + + if ($cachekey == $source) + { + return $cachedims[$axis]; + } + + if (substr($source, 0, 7) == 'upload:') + { + $source = substr($source, 7); + } + + global $convert, $user; + + if (!isset($convert->convertor['avatar_path'])) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_AVATAR_PATH'], 'get_upload_avatar_dim()'), __LINE__, __FILE__); + } + + if (!empty($convert->convertor['avatar_path']) && strpos($source, $convert->convertor['avatar_path']) !== 0) + { + $source = path($convert->convertor['avatar_path'], empty($convert->convertor['source_path_absolute'])) . $source; + } + + $cachedims = get_image_dim($source); + + if (empty($cachedims) || empty($cachedims[0]) || empty($cachedims[1])) + { + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + + $cachedims = array($default_x, $default_y); + } + + return $cachedims[$axis]; +} + +/** +* Obtain the size of the specified gallery avatar (using the cache if possible) and cache the value +*/ +function get_gallery_avatar_dim($source, $axis) +{ + if (empty($source)) + { + return 0; + } + + static $avatar_cache = array(); + + if (isset($avatar_cache[$source])) + { + return $avatar_cache[$source][$axis]; + } + + global $convert, $user; + + $orig_source = $source; + + if (!isset($convert->convertor['avatar_gallery_path'])) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_GALLERY_PATH'], 'get_gallery_avatar_dim()'), __LINE__, __FILE__); + } + + if (!empty($convert->convertor['avatar_gallery_path']) && strpos($source, $convert->convertor['avatar_gallery_path']) !== 0) + { + $source = path($convert->convertor['avatar_gallery_path'], empty($convert->convertor['source_path_absolute'])) . $source; + } + + $avatar_cache[$orig_source] = get_image_dim($source); + + if (empty($avatar_cache[$orig_source]) || empty($avatar_cache[$orig_source][0]) || empty($avatar_cache[$orig_source][1])) + { + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + + $avatar_cache[$orig_source] = array($default_x, $default_y); + } + + return $avatar_cache[$orig_source][$axis]; +} + +/** +* Obtain the size of the specified remote avatar (using the cache if possible) and cache the value +* Whilst it's unlikely that remote avatars will be duplicated, it is possible so caching seems the best option +* This should only be called from a post processing step due to the possibility of network timeouts +*/ +function get_remote_avatar_dim($src, $axis) +{ + if (empty($src)) + { + return 0; + } + + static $remote_avatar_cache = array(); + + // an ugly hack: we assume that the dimensions of each remote avatar are accessed exactly twice (x and y) + if (isset($remote_avatar_cache[$src])) + { + $retval = $remote_avatar_cache[$src][$axis]; + unset($remote_avatar_cache); + return $retval; + } + + $url_info = @parse_url($src); + if (empty($url_info['host'])) + { + return 0; + } + $host = $url_info['host']; + $port = (isset($url_info['port'])) ? $url_info['port'] : 0; + $protocol = (isset($url_info['scheme'])) ? $url_info['scheme'] : 'http'; + if (empty($port)) + { + switch (strtolower($protocol)) + { + case 'ftp': + $port = 21; + break; + + case 'https': + $port = 443; + break; + + default: + $port = 80; + } + } + + $timeout = @ini_get('default_socket_timeout'); + @ini_set('default_socket_timeout', 2); + + // We're just trying to reach the server to avoid timeouts + $fp = @fsockopen($host, $port, $errno, $errstr, 1); + if ($fp) + { + $remote_avatar_cache[$src] = @getimagesize($src); + fclose($fp); + } + + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + $default = array($default_x, $default_y); + + if (empty($remote_avatar_cache[$src]) || empty($remote_avatar_cache[$src][0]) || empty($remote_avatar_cache[$src][1])) + { + $remote_avatar_cache[$src] = $default; + } + else + { + // We trust gallery and uploaded avatars to conform to the size settings; we might have to adjust here + if ($remote_avatar_cache[$src][0] > $default_x || $remote_avatar_cache[$src][1] > $default_y) + { + $bigger = ($remote_avatar_cache[$src][0] > $remote_avatar_cache[$src][1]) ? 0 : 1; + $ratio = $default[$bigger] / $remote_avatar_cache[$src][$bigger]; + $remote_avatar_cache[$src][0] = (int) ($remote_avatar_cache[$src][0] * $ratio); + $remote_avatar_cache[$src][1] = (int) ($remote_avatar_cache[$src][1] * $ratio); + } + } + + @ini_set('default_socket_timeout', $timeout); + return $remote_avatar_cache[$src][$axis]; +} + +function set_user_options() +{ + global $convert_row; + + // Key need to be set in row, else default value is chosen + $keyoptions = array( + 'viewimg' => array('bit' => 0, 'default' => 1), + 'viewflash' => array('bit' => 1, 'default' => 1), + 'viewsmilies' => array('bit' => 2, 'default' => 1), + 'viewsigs' => array('bit' => 3, 'default' => 1), + 'viewavatars' => array('bit' => 4, 'default' => 1), + 'viewcensors' => array('bit' => 5, 'default' => 1), + 'attachsig' => array('bit' => 6, 'default' => 0), + 'bbcode' => array('bit' => 8, 'default' => 1), + 'smilies' => array('bit' => 9, 'default' => 1), + 'sig_bbcode' => array('bit' => 15, 'default' => 1), + 'sig_smilies' => array('bit' => 16, 'default' => 1), + 'sig_links' => array('bit' => 17, 'default' => 1), + ); + + $option_field = 0; + + foreach ($keyoptions as $key => $key_ary) + { + $value = (isset($convert_row[$key])) ? (int) $convert_row[$key] : $key_ary['default']; + + if ($value && !($option_field & 1 << $key_ary['bit'])) + { + $option_field += 1 << $key_ary['bit']; + } + } + + return $option_field; +} + +/** +* Index messages on the fly as we convert them +* @todo naderman, can you check that this works with the new search plugins as it's use is currently disabled (and thus untested) +function search_indexing($message = '') +{ + global $fulltext_search, $convert_row; + + if (!isset($convert_row['post_id'])) + { + return; + } + + if (!$message) + { + if (!isset($convert_row['message'])) + { + return; + } + + $message = $convert_row['message']; + } + + $title = (isset($convert_row['title'])) ? $convert_row['title'] : ''; + + $fulltext_search->index('post', $convert_row['post_id'], $message, $title, $convert_row['poster_id'], $convert_row['forum_id']); +} +*/ + +function make_unique_filename($filename) +{ + if (!strlen($filename)) + { + $filename = md5(unique_id()) . '.dat'; + } + else if ($filename[0] == '.') + { + $filename = md5(unique_id()) . $filename; + } + else if (preg_match('/\.([a-z]+)$/i', $filename, $m)) + { + $filename = preg_replace('/\.([a-z]+)$/i', '_' . md5(unique_id()) . '.\1', $filename); + } + else + { + $filename .= '_' . md5(unique_id()) . '.dat'; + } + + return $filename; +} + +function words_unique(&$words) +{ + reset($words); + $return_array = array(); + + $word = current($words); + do + { + $return_array[$word] = $word; + } + while ($word = next($words)); + + return $return_array; +} + +/** +* Adds a user to the specified group and optionally makes them a group leader +* This function does not create the group if it does not exist and so should only be called after the groups have been created +*/ +function add_user_group($group_id, $user_id, $group_leader = false) +{ + global $db; + + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'group_id' => $group_id, + 'user_id' => $user_id, + 'group_leader' => ($group_leader) ? 1 : 0, + 'user_pending' => 0)); + $db->sql_query($sql); +} + +// STANDALONE FUNCTIONS + +/** +* Add users to the pre-defined "special" groups +* +* @param string $group The name of the special group to add to +* @param string $select_query An SQL query to retrieve the user(s) to add to the group +*/ +function user_group_auth($group, $select_query, $use_src_db) +{ + global $convert, $user, $db, $src_db, $same_db; + + if (!in_array($group, array('guests', 'registered', 'registered_coppa', 'global_moderators', 'administrators', 'bots'))) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_WRONG_GROUP'], $group, 'user_group_auth()'), __LINE__, __FILE__, true); + return; + } + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $db->sql_escape(strtoupper($group)) . "'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if (!$group_id) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_GROUP'], $group, 'user_group_auth()'), __LINE__, __FILE__, true); + return; + } + + if ($same_db || !$use_src_db) + { + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' (user_id, group_id, user_pending) + ' . str_replace('{' . strtoupper($group) . '}', $group_id . ', 0', $select_query); + $db->sql_query($sql); + } + else + { + $result = $src_db->sql_query(str_replace('{' . strtoupper($group) . '}', $group_id . ' ', $select_query)); + while ($row = $src_db->sql_fetchrow($result)) + { + // this might become quite a lot of INSERTS unfortunately + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, user_pending) + VALUES ({$row['user_id']}, $group_id, 0)"; + $db->sql_query($sql); + } + $src_db->sql_freeresult($result); + } +} + +/** +* Retrieves configuration information from the source forum and caches it as an array +* Both database and file driven configuration formats can be handled +* (the type used is specified in $config_schema, see convert_phpbb20.php for more details) +*/ +function get_config() +{ + static $convert_config; + global $user; + + if (isset($convert_config)) + { + return $convert_config; + } + + global $src_db, $same_db; + global $convert; + + if ($convert->config_schema['table_format'] != 'file') + { + if ($convert->mysql_convert && $same_db) + { + $src_db->sql_query("SET NAMES 'binary'"); + } + + $sql = 'SELECT * FROM ' . $convert->src_table_prefix . $convert->config_schema['table_name']; + $result = $src_db->sql_query($sql); + $row = $src_db->sql_fetchrow($result); + + if (!$row) + { + $convert->p_master->error($user->lang['CONV_ERROR_GET_CONFIG'], __LINE__, __FILE__); + } + } + + if (is_array($convert->config_schema['table_format'])) + { + $convert_config = array(); + $key = key($convert->config_schema['table_format']); + $val = current($convert->config_schema['table_format']); + + do + { + $convert_config[$row[$key]] = $row[$val]; + } + while ($row = $src_db->sql_fetchrow($result)); + $src_db->sql_freeresult($result); + + if ($convert->mysql_convert && $same_db) + { + $src_db->sql_query("SET NAMES 'utf8'"); + } + } + else if ($convert->config_schema['table_format'] == 'file') + { + $filename = $convert->options['forum_path'] . '/' . $convert->config_schema['filename']; + if (!file_exists($filename)) + { + $convert->p_master->error($user->lang('FILE_NOT_FOUND', $filename), __LINE__, __FILE__); + } + + if (isset($convert->config_schema['array_name'])) + { + unset($convert->config_schema['array_name']); + } + + $convert_config = extract_variables_from_file($filename); + if (!empty($convert->config_schema['array_name'])) + { + $convert_config = $convert_config[$convert->config_schema['array_name']]; + } + } + else + { + $convert_config = $row; + if ($convert->mysql_convert && $same_db) + { + $src_db->sql_query("SET NAMES 'utf8'"); + } + } + + if (!count($convert_config)) + { + $convert->p_master->error($user->lang['CONV_ERROR_CONFIG_EMPTY'], __LINE__, __FILE__); + } + + return $convert_config; +} + +/** +* Transfers the relevant configuration information from the source forum +* The mapping of fields is specified in $config_schema, see convert_phpbb20.php for more details +*/ +function restore_config($schema) +{ + global $config; + + $convert_config = get_config(); + + foreach ($schema['settings'] as $config_name => $src) + { + if (preg_match('/(.*)\((.*)\)/', $src, $m)) + { + $var = (empty($m[2]) || empty($convert_config[$m[2]])) ? "''" : "'" . addslashes($convert_config[$m[2]]) . "'"; + $exec = '$config_value = ' . $m[1] . '(' . $var . ');'; + // @codingStandardsIgnoreStart + eval($exec); + // @codingStandardsIgnoreEnd + } + else + { + if ($schema['table_format'] != 'file' || empty($schema['array_name'])) + { + $config_value = (isset($convert_config[$src])) ? $convert_config[$src] : ''; + } + else if (!empty($schema['array_name'])) + { + $src_ary = $schema['array_name']; + $config_value = (isset($convert_config[$src_ary][$src])) ? $convert_config[$src_ary][$src] : ''; + } + } + + if ($config_value !== '') + { + // Most are... + if (is_string($config_value)) + { + $config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, 255, false); + } + + $config->set($config_name, $config_value); + } + } +} + +/** +* Update the count of PM's in custom folders for all users +*/ +function update_folder_pm_count() +{ + global $db; + + $sql = 'SELECT user_id, folder_id, COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ', ' . PRIVMSGS_INBOX . ', ' . PRIVMSGS_OUTBOX . ', ' . PRIVMSGS_SENTBOX . ') + GROUP BY folder_id, user_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . PRIVMSGS_FOLDER_TABLE . ' SET pm_count = ' . $row['num_messages'] . ' + WHERE user_id = ' . $row['user_id'] . ' AND folder_id = ' . $row['folder_id']); + } + $db->sql_freeresult($result); +} + +// Functions mainly used by the main convertor script + +function path($path, $path_relative = true) +{ + if ($path === false) + { + return ''; + } + + if (substr($path, -1) != '/') + { + $path .= '/'; + } + + if (!$path_relative) + { + return $path; + } + + if (substr($path, 0, 1) == '/') + { + $path = substr($path, 1); + } + + return $path; +} + +/** +* Extract the variables defined in a configuration file +* @todo As noted by Xore we need to look at this from a security perspective +*/ +function extract_variables_from_file($_filename) +{ + include($_filename); + + $vars = get_defined_vars(); + unset($vars['_filename']); + + return $vars; +} + +function get_path($src_path, $src_url, $test_file) +{ + global $phpbb_root_path, $phpEx; + + $board_config = get_config(); + + $test_file = preg_replace('/\.php$/i', ".$phpEx", $test_file); + $src_path = path($src_path); + + if (@file_exists($phpbb_root_path . $src_path . $test_file)) + { + return $src_path; + } + + if (!empty($src_url) && !empty($board_config['server_name'])) + { + if (!preg_match('#https?://([^/]+)(.*)#i', $src_url, $m)) + { + return false; + } + + if ($m[1] != $board_config['server_name']) + { + return false; + } + + $url_parts = explode('/', $m[2]); + if (substr($src_url, -1) != '/') + { + if (preg_match('/.*\.([a-z0-9]{3,4})$/i', $url_parts[count($url_parts) - 1])) + { + $url_parts[count($url_parts) - 1] = ''; + } + else + { + $url_parts[] = ''; + } + } + + $script_path = $board_config['script_path']; + if (substr($script_path, -1) == '/') + { + $script_path = substr($script_path, 0, -1); + } + + $path_array = array(); + + $phpbb_parts = explode('/', $script_path); + for ($i = 0, $end = count($url_parts); $i < $end; ++$i) + { + if ($i < count($phpbb_parts[$i]) && $url_parts[$i] == $phpbb_parts[$i]) + { + $path_array[] = $url_parts[$i]; + unset($url_parts[$i]); + } + else + { + $path = ''; + for ($j = $i, $end2 = count($phpbb_parts); $j < $end2; ++$j) + { + $path .= '../'; + } + $path .= implode('/', $url_parts); + break; + } + } + + if (!empty($path)) + { + if (@file_exists($phpbb_root_path . $path . $test_file)) + { + return $path; + } + } + } + + return false; +} + +function compare_table($tables, $tablename, &$prefixes) +{ + for ($i = 0, $table_size = count($tables); $i < $table_size; ++$i) + { + if (preg_match('/(.*)' . $tables[$i] . '$/', $tablename, $m)) + { + if (empty($m[1])) + { + $m[1] = '*'; + } + + if (isset($prefixes[$m[1]])) + { + $prefixes[$m[1]]++; + } + else + { + $prefixes[$m[1]] = 1; + } + } + } +} + +/** +* Grant permissions to a specified user or group +* +* @param string $ug_type user|group|user_role|group_role +* @param mixed $forum_id forum ids (array|int|0) -> 0 == all forums +* @param mixed $ug_id [int] user_id|group_id : [string] usergroup name +* @param mixed $acl_list [string] acl entry : [array] acl entries : [string] role entry +* @param int $setting ACL_YES|ACL_NO|ACL_NEVER +*/ +function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO) +{ + global $db; + static $acl_option_ids, $group_ids; + + if (($ug_type == 'group' || $ug_type == 'group_role') && is_string($ug_id)) + { + if (!isset($group_ids[$ug_id])) + { + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $db->sql_escape(strtoupper($ug_id)) . "'"; + $result = $db->sql_query_limit($sql, 1); + $id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if (!$id) + { + return; + } + + $group_ids[$ug_id] = $id; + } + + $ug_id = (int) $group_ids[$ug_id]; + } + + $table = ($ug_type == 'user' || $ug_type == 'user_role') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; + $id_field = ($ug_type == 'user' || $ug_type == 'user_role') ? 'user_id' : 'group_id'; + + // Role based permissions are the simplest to handle so check for them first + if ($ug_type == 'user_role' || $ug_type == 'group_role') + { + if (is_numeric($forum_id)) + { + $sql = 'SELECT role_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_name = 'ROLE_" . $db->sql_escape($acl_list) . "'"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // If we have no role id there is something wrong here + if ($row) + { + $sql = "INSERT INTO $table ($id_field, forum_id, auth_role_id) VALUES ($ug_id, $forum_id, " . $row['role_id'] . ')'; + $db->sql_query($sql); + } + } + + return; + } + + // Build correct parameters + $auth = array(); + + if (!is_array($acl_list)) + { + $auth = array($acl_list => $setting); + } + else + { + foreach ($acl_list as $auth_option) + { + $auth[$auth_option] = $setting; + } + } + unset($acl_list); + + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + // Set any flags as required + foreach ($auth as $auth_option => $acl_setting) + { + $flag = substr($auth_option, 0, strpos($auth_option, '_') + 1); + if (empty($auth[$flag])) + { + $auth[$flag] = $acl_setting; + } + } + + if (!is_array($acl_option_ids) || empty($acl_option_ids)) + { + $sql = 'SELECT auth_option_id, auth_option + FROM ' . ACL_OPTIONS_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $acl_option_ids[$row['auth_option']] = $row['auth_option_id']; + } + $db->sql_freeresult($result); + } + + $sql_forum = 'AND ' . $db->sql_in_set('a.forum_id', array_map('intval', $forum_id), false, true); + + $sql = ($ug_type == 'user') ? 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting FROM ' . ACL_USERS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $sql_forum AND a.user_id = $ug_id" : 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting FROM ' . ACL_GROUPS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $sql_forum AND a.group_id = $ug_id"; + $result = $db->sql_query($sql); + + $cur_auth = array(); + while ($row = $db->sql_fetchrow($result)) + { + $cur_auth[$row['forum_id']][$row['auth_option_id']] = $row['auth_setting']; + } + $db->sql_freeresult($result); + + $sql_ary = array(); + foreach ($forum_id as $forum) + { + foreach ($auth as $auth_option => $setting) + { + $auth_option_id = $acl_option_ids[$auth_option]; + + if (!$auth_option_id) + { + continue; + } + + switch ($setting) + { + case ACL_NO: + if (isset($cur_auth[$forum][$auth_option_id])) + { + $sql_ary['delete'][] = "DELETE FROM $table + WHERE forum_id = $forum + AND auth_option_id = $auth_option_id + AND $id_field = $ug_id"; + } + break; + + default: + if (!isset($cur_auth[$forum][$auth_option_id])) + { + $sql_ary['insert'][] = "$ug_id, $forum, $auth_option_id, $setting"; + } + else if ($cur_auth[$forum][$auth_option_id] != $setting) + { + $sql_ary['update'][] = "UPDATE " . $table . " + SET auth_setting = $setting + WHERE $id_field = $ug_id + AND forum_id = $forum + AND auth_option_id = $auth_option_id"; + } + } + } + } + unset($cur_auth); + + $sql = ''; + foreach ($sql_ary as $sql_type => $sql_subary) + { + switch ($sql_type) + { + case 'insert': + switch ($db->get_sql_layer()) + { + case 'sqlite3': + case 'mssqlnative': + $sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary)); + break; + + default: + foreach ($sql_subary as $sql) + { + $sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) VALUES ($sql)"; + $db->sql_query($sql); + $sql = ''; + } + } + + if ($sql != '') + { + $sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) $sql"; + $db->sql_query($sql); + } + break; + + case 'update': + case 'delete': + foreach ($sql_subary as $sql) + { + $db->sql_query($sql); + $sql = ''; + } + break; + } + unset($sql_ary[$sql_type]); + } + unset($sql_ary); + +} + +/** +* Update the count of unread private messages for all users +*/ +function update_unread_count() +{ + global $db; + + $sql = 'SELECT user_id, COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE pm_unread = 1 + AND folder_id <> ' . PRIVMSGS_OUTBOX . ' + GROUP BY user_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_unread_privmsg = ' . $row['num_messages'] . ' + WHERE user_id = ' . $row['user_id']); + } + $db->sql_freeresult($result); +} + +/** +* Add any of the pre-defined "special" groups which are missing from the database +*/ +function add_default_groups() +{ + global $db; + + $default_groups = array( + 'GUESTS' => array('', 0, 0), + 'REGISTERED' => array('', 0, 0), + 'REGISTERED_COPPA' => array('', 0, 0), + 'GLOBAL_MODERATORS' => array('00AA00', 2, 0), + 'ADMINISTRATORS' => array('AA0000', 1, 1), + 'BOTS' => array('9E8DA7', 0, 0), + 'NEWLY_REGISTERED' => array('', 0, 0), + ); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_name', array_keys($default_groups)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + unset($default_groups[strtoupper($row['group_name'])]); + } + $db->sql_freeresult($result); + + $sql_ary = array(); + + foreach ($default_groups as $name => $data) + { + $sql_ary[] = array( + 'group_name' => (string) $name, + 'group_desc' => '', + 'group_desc_uid' => '', + 'group_desc_bitfield' => '', + 'group_type' => GROUP_SPECIAL, + 'group_colour' => (string) $data[0], + 'group_legend' => (int) $data[1], + 'group_founder_manage' => (int) $data[2], + ); + } + + if (count($sql_ary)) + { + $db->sql_multi_insert(GROUPS_TABLE, $sql_ary); + } +} + +function add_groups_to_teampage() +{ + global $db; + + $teampage_groups = array( + 'ADMINISTRATORS' => 1, + 'GLOBAL_MODERATORS' => 2, + ); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_name', array_keys($teampage_groups)); + $result = $db->sql_query($sql); + + $teampage_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $teampage_ary[] = array( + 'group_id' => (int) $row['group_id'], + 'teampage_name' => '', + 'teampage_position' => (int) $teampage_groups[$row['group_name']], + 'teampage_parent' => 0, + ); + } + $db->sql_freeresult($result); + + if (count($teampage_ary)) + { + $db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_ary); + } +} + + +/** +* Sync post count. We might need to do this in batches. +*/ +function sync_post_count($offset, $limit) +{ + global $db; + $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id + FROM ' . POSTS_TABLE . ' + WHERE post_postcount = 1 + AND post_visibility = ' . ITEM_APPROVED . ' + GROUP BY poster_id + ORDER BY poster_id'; + $result = $db->sql_query_limit($sql, $limit, $offset); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}"); + } + $db->sql_freeresult($result); +} + +/** +* Add the search bots into the database +* This code should be used in execute_last if the source database did not have bots +* If you are converting bots this function should not be called +* @todo We might want to look at sharing the bot list between the install code and this code for consistancy +*/ +function add_bots() +{ + global $db, $convert, $user, $config, $phpbb_root_path, $phpEx; + + $db->sql_query($convert->truncate_statement . BOTS_TABLE); + + $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id', false, $result); + $db->sql_freeresult($result); + + if (!$group_id) + { + add_default_groups(); + + $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id', false, $result); + $db->sql_freeresult($result); + + if (!$group_id) + { + global $install; + $install->error($user->lang['CONV_ERROR_INCONSISTENT_GROUPS'], __LINE__, __FILE__); + } + } + + $bots = array( + 'AdsBot [Google]' => array('AdsBot-Google', ''), + 'Alexa [Bot]' => array('ia_archiver', ''), + 'Alta Vista [Bot]' => array('Scooter/', ''), + 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), + 'Baidu [Spider]' => array('Baiduspider+(', ''), + 'Bing [Bot]' => array('bingbot/', ''), + 'Exabot [Bot]' => array('Exabot/', ''), + 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), + 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), + 'Francis [Bot]' => array('http://www.neomo.de/', ''), + 'Gigabot [Bot]' => array('Gigabot/', ''), + 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), + 'Google Desktop' => array('Google Desktop', ''), + 'Google Feedfetcher' => array('Feedfetcher-Google', ''), + 'Google [Bot]' => array('Googlebot', ''), + 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), + 'Heritrix [Crawler]' => array('heritrix/1.', ''), + 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), + 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), + 'ichiro [Crawler]' => array('ichiro/2', ''), + 'Majestic-12 [Bot]' => array('MJ12bot/', ''), + 'Metager [Bot]' => array('MetagerBot/', ''), + 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), + 'MSN [Bot]' => array('msnbot/', ''), + 'MSNbot Media' => array('msnbot-media/', ''), + 'NG-Search [Bot]' => array('NG-Search/', ''), + 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), + 'Nutch/CVS [Bot]' => array('NutchCVS/', ''), + 'OmniExplorer [Bot]' => array('OmniExplorer_Bot/', ''), + 'Online link [Validator]' => array('online link validator', ''), + 'psbot [Picsearch]' => array('psbot/0', ''), + 'Seekport [Bot]' => array('Seekbot/', ''), + 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), + 'SEO Crawler' => array('SEO search Crawler/', ''), + 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), + 'SEOSearch [Crawler]' => array('SEOsearch/', ''), + 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), + 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), + 'Synoo [Bot]' => array('SynooBot/', ''), + 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), + 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), + 'Voyager [Bot]' => array('voyager/1.0', ''), + 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), + 'W3C [Linkcheck]' => array('W3C-checklink/', ''), + 'W3C [Validator]' => array('W3C_*Validator', ''), + 'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''), + 'YaCy [Bot]' => array('yacybot', ''), + 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), + 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), + 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), + 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), + ); + + if (!function_exists('user_add')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + foreach ($bots as $bot_name => $bot_ary) + { + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_id, + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => '9E8DA7', + 'user_email' => '', + 'user_lang' => $config['default_lang'], + 'user_style' => 1, + 'user_timezone' => 'UTC', + 'user_allow_massemail' => 0, + ); + + $user_id = user_add($user_row); + + if ($user_id) + { + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => $bot_name, + 'user_id' => $user_id, + 'bot_agent' => $bot_ary[0], + 'bot_ip' => $bot_ary[1]) + ); + $db->sql_query($sql); + } + } +} + +/** +* Update any dynamic configuration variables after the conversion is finished +* @todo Confirm that this updates all relevant values since it has not necessarily been kept in sync with all changes +*/ +function update_dynamic_config() +{ + global $db, $config; + + // Get latest username + $sql = 'SELECT user_id, username, user_colour + FROM ' . USERS_TABLE . ' + WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + + if (!empty($config['increment_user_id'])) + { + $sql .= ' AND user_id <> ' . $config['increment_user_id']; + } + + $sql .= ' ORDER BY user_id DESC'; + + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $config->set('newest_user_id', $row['user_id'], false); + $config->set('newest_username', $row['username'], false); + $config->set('newest_user_colour', $row['user_colour'], false); + } + +// Also do not reset record online user/date. There will be old data or the fresh data from the schema. +// set_config('record_online_users', 1, true); +// set_config('record_online_date', time(), true); + + $sql = 'SELECT COUNT(post_id) AS stat + FROM ' . POSTS_TABLE . ' + WHERE post_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_posts', (int) $row['stat'], false); + + $sql = 'SELECT COUNT(topic_id) AS stat + FROM ' . TOPICS_TABLE . ' + WHERE topic_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_topics', (int) $row['stat'], false); + + $sql = 'SELECT COUNT(user_id) AS stat + FROM ' . USERS_TABLE . ' + WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_users', (int) $row['stat'], false); + + $sql = 'SELECT COUNT(attach_id) as stat + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 0'; + $result = $db->sql_query($sql); + $config->set('num_files', (int) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + $sql = 'SELECT SUM(filesize) as stat + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 0'; + $result = $db->sql_query($sql); + $config->set('upload_dir_size', (float) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + /** + * We do not resync users post counts - this can be done by the admin after conversion if wanted. + $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id + FROM ' . POSTS_TABLE . ' + WHERE post_postcount = 1 + GROUP BY poster_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}"); + } + $db->sql_freeresult($result); + */ +} + +/** +* Updates topics_posted entries +*/ +function update_topics_posted() +{ + global $db; + + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); + break; + + default: + $db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE); + break; + } + + // This can get really nasty... therefore we only do the last six months + $get_from_time = time() - (6 * 4 * 7 * 24 * 60 * 60); + + // Select forum ids, do not include categories + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type <> ' . FORUM_CAT; + $result = $db->sql_query($sql); + + $forum_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + // Any global announcements? ;) + $forum_ids[] = 0; + + // Now go through the forums and get us some topics... + foreach ($forum_ids as $forum_id) + { + $sql = 'SELECT p.poster_id, p.topic_id + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t + WHERE t.forum_id = ' . $forum_id . ' + AND t.topic_moved_id = 0 + AND t.topic_last_post_time > ' . $get_from_time . ' + AND t.topic_id = p.topic_id + AND p.poster_id <> ' . ANONYMOUS . ' + GROUP BY p.poster_id, p.topic_id'; + $result = $db->sql_query($sql); + + $posted = array(); + while ($row = $db->sql_fetchrow($result)) + { + $posted[$row['poster_id']][] = $row['topic_id']; + } + $db->sql_freeresult($result); + + $sql_ary = array(); + foreach ($posted as $user_id => $topic_row) + { + foreach ($topic_row as $topic_id) + { + $sql_ary[] = array( + 'user_id' => (int) $user_id, + 'topic_id' => (int) $topic_id, + 'topic_posted' => 1, + ); + } + } + unset($posted); + + if (count($sql_ary)) + { + $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); + } + } +} + +/** +* Ensure that all users have a default group specified and update related information such as their colour +*/ +function fix_empty_primary_groups() +{ + global $db; + + // Set group ids for users not already having it + $sql = 'UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('registered') . ' + WHERE group_id = 0 AND user_type = ' . USER_INACTIVE; + $db->sql_query($sql); + + $sql = 'UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('registered') . ' + WHERE group_id = 0 AND user_type = ' . USER_NORMAL; + $db->sql_query($sql); + + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('guests') . ' WHERE user_id = ' . ANONYMOUS); + + $sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . ' WHERE group_id = ' . get_group_id('administrators'); + $result = $db->sql_query($sql); + + $user_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (count($user_ids)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('administrators') . ' + WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids)); + } + + $sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . ' WHERE group_id = ' . get_group_id('global_moderators'); + $result = $db->sql_query($sql); + + $user_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (count($user_ids)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('global_moderators') . ' + WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids)); + } + + // Set user colour + $sql = 'SELECT group_id, group_colour FROM ' . GROUPS_TABLE . " + WHERE group_colour <> ''"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_colour = '{$row['group_colour']}' WHERE group_id = {$row['group_id']}"); + } + $db->sql_freeresult($result); +} + +/** +* Cleanly remove invalid user entries after converting the users table... +*/ +function remove_invalid_users() +{ + global $db, $phpEx, $phpbb_root_path; + + // username_clean is UNIQUE + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE username_clean = ''"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + if (!function_exists('user_delete')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + user_delete('remove', $row['user_id']); + } +} + +function convert_bbcode($message, $convert_size = true, $extended_bbcodes = false) +{ + static $orig, $repl, $origx, $replx, $str_from, $str_to; + + if (empty($orig)) + { + $orig = $repl = array(); + + $orig[] = '#\[(php|sql)\](.*?)\[/(php|sql)\]#is'; + $repl[] = '[code]\2[/code]'; + + $orig[] = '#\[font=[^\]]+\](.*?)\[/font\]#is'; + $repl[] = '\1'; + + $orig[] = '#\[align=[a-z]+\](.*?)\[/align\]#is'; + $repl[] = '\1'; + + $orig[] = '#\[/list=.*?\]#is'; + $repl[] = '[/list]'; + + $origx = array( + '#\[glow[^\]]+\](.*?)\[/glow\]#is', + '#\[shadow[^\]]+\](.*?)\[/shadow\]#is', + '#\[flash[^\]]+\](.*?)\[/flash\]#is' + ); + + $replx = array( + '\1', + '\1', + '[url=\1]Flash[/url]' + ); + + $str_from = array( + '[ftp]', '[/ftp]', + '[ftp=', '[/ftp]', + '[pre]', '[/pre]', + '[table]', '[/table]', + '[td]', '[/td]', + '[tr]', '[/tr]', + '[s]', '[/s]', + '[left]', '[/left]', + '[right]', '[/right]', + '[center]', '[/center]', + '[sub]', '[/sub]', + '[sup]', '[/sup]', + '[tt]', '[/tt]', + '[move]', '[/move]', + '[hr]' + ); + + $str_to = array( + '[url]', '[/url]', + '[url=', '[/url]', + '[code]', '[/code]', + "\n", '', + '', '', + "\n", '', + '', '', + '', '', + '', '', + '', '', + '', '', + '', '', + '', '', + '', '', + "\n\n" + ); + + for ($i = 0, $end = count($str_from); $i < $end; ++$i) + { + $origx[] = '#\\' . str_replace(']', '\\]', $str_from[$i]) . '#is'; + $replx[] = $str_to[$i]; + } + } + + if (preg_match_all('#\[email=([^\]]+)\](.*?)\[/email\]#i', $message, $m)) + { + for ($i = 0, $end = count($m[1]); $i < $end; ++$i) + { + if ($m[1][$i] == $m[2][$i]) + { + $message = str_replace($m[0][$i], '[email]' . $m[1][$i] . '[/email]', $message); + } + else + { + $message = str_replace($m[0][$i], $m[2][$i] . ' ([email]' . $m[1][$i] . '[/email])', $message); + } + } + } + + if ($convert_size && preg_match('#\[size=[0-9]+\].*?\[/size\]#i', $message)) + { + $size = array(9, 9, 12, 15, 18, 24, 29, 29, 29, 29); + $message = preg_replace('#\[size=([0-9]+)\](.*?)\[/size\]#i', '[size=\1]\2[/size]', $message); + $message = preg_replace('#\[size=[0-9]{2,}\](.*?)\[/size\]#i', '[size=29]\1[/size]', $message); + + for ($i = count($size); $i;) + { + $i--; + $message = str_replace('[size=' . $i . ']', '[size=' . $size[$i] . ']', $message); + } + } + + if ($extended_bbcodes) + { + $message = preg_replace($origx, $replx, $message); + } + + $message = preg_replace($orig, $repl, $message); + return $message; +} + + +function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $source_relative_path = true) +{ + global $convert, $phpbb_root_path, $user, $phpbb_filesystem; + + /** @var \phpbb\filesystem\filesystem_interface $filesystem */ + $filesystem = $phpbb_filesystem; + + if (substr($trg, -1) == '/') + { + $trg .= utf8_basename($src); + } + $src_path = relative_base($src, $source_relative_path, __LINE__, __FILE__); + $trg_path = $trg; + + if (!$overwrite && @file_exists($trg_path)) + { + return true; + } + + if (!@file_exists($src_path)) + { + return; + } + + $path = $phpbb_root_path; + $parts = explode('/', $trg); + unset($parts[count($parts) - 1]); + + for ($i = 0, $end = count($parts); $i < $end; ++$i) + { + $path .= $parts[$i] . '/'; + + if (!is_dir($path)) + { + @mkdir($path, 0777); + } + } + + if (!$filesystem->is_writable($path)) + { + @chmod($path, 0777); + } + + if (!@copy($src_path, $phpbb_root_path . $trg_path)) + { + $convert->p_master->error(sprintf($user->lang['COULD_NOT_COPY'], $src_path, $phpbb_root_path . $trg_path), __LINE__, __FILE__, !$die_on_failure); + return; + } + + if ($perm = @fileperms($src_path)) + { + @chmod($phpbb_root_path . $trg_path, $perm); + } + + return true; +} + +function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_failure = true, $source_relative_path = true) +{ + global $convert, $phpbb_root_path, $config, $user, $phpbb_filesystem; + + /** @var \phpbb\filesystem\filesystem_interface $filesystem */ + $filesystem = $phpbb_filesystem; + + $dirlist = $filelist = $bad_dirs = array(); + $src = path($src, $source_relative_path); + $trg = path($trg); + $src_path = relative_base($src, $source_relative_path, __LINE__, __FILE__); + $trg_path = $phpbb_root_path . $trg; + + if (!is_dir($trg_path)) + { + @mkdir($trg_path, 0777); + @chmod($trg_path, 0777); + } + + if (!$filesystem->is_writable($trg_path)) + { + $bad_dirs[] = path($config['script_path']) . $trg; + } + + if ($handle = @opendir($src_path)) + { + while ($entry = readdir($handle)) + { + if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm') + { + continue; + } + + if (is_dir($src_path . $entry)) + { + $dirlist[] = $entry; + } + else + { + $filelist[] = $entry; + } + } + closedir($handle); + } + else if ($dir = @dir($src_path)) + { + while ($entry = $dir->read()) + { + if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm') + { + continue; + } + + if (is_dir($src_path . $entry)) + { + $dirlist[] = $entry; + } + else + { + $filelist[] = $entry; + } + } + $dir->close(); + } + else + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_COULD_NOT_READ'], relative_base($src, $source_relative_path)), __LINE__, __FILE__); + } + + if ($copy_subdirs) + { + for ($i = 0, $end = count($dirlist); $i < $end; ++$i) + { + $dir = $dirlist[$i]; + + if ($dir == 'CVS') + { + continue; + } + + if (!is_dir($trg_path . $dir)) + { + @mkdir($trg_path . $dir, 0777); + @chmod($trg_path . $dir, 0777); + } + + if (!$filesystem->is_writable($trg_path . $dir)) + { + $bad_dirs[] = $trg . $dir; + $bad_dirs[] = $trg_path . $dir; + } + + if (!count($bad_dirs)) + { + copy_dir($src . $dir, $trg . $dir, true, $overwrite, $die_on_failure, $source_relative_path); + } + } + } + + if (count($bad_dirs)) + { + $str = (count($bad_dirs) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; + sort($bad_dirs); + $convert->p_master->error(sprintf($str, implode('
', $bad_dirs)), __LINE__, __FILE__); + } + + for ($i = 0, $end = count($filelist); $i < $end; ++$i) + { + copy_file($src . $filelist[$i], $trg . $filelist[$i], $overwrite, $die_on_failure, $source_relative_path); + } +} + +function relative_base($path, $is_relative = true, $line = false, $file = false) +{ + global $convert, $user; + + if (!$is_relative) + { + return $path; + } + + if (empty($convert->options['forum_path']) && $is_relative) + { + $line = $line ? $line : __LINE__; + $file = $file ? $file : __FILE__; + + $convert->p_master->error($user->lang['CONV_ERROR_NO_FORUM_PATH'], $line, $file); + } + + return $convert->options['forum_path'] . '/' . $path; +} + +function get_smiley_display() +{ + static $smiley_count = 0; + $smiley_count++; + return ($smiley_count < 50) ? 1 : 0; +} + + +function fill_dateformat($user_dateformat) +{ + global $config; + + return ((empty($user_dateformat)) ? $config['default_dateformat'] : $user_dateformat); +} diff --git a/install/update/new/includes/functions_display.php b/install/update/new/includes/functions_display.php new file mode 100644 index 0000000..44478db --- /dev/null +++ b/install/update/new/includes/functions_display.php @@ -0,0 +1,1725 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Display Forums +*/ +function display_forums($root_data = '', $display_moderators = true, $return_moderators = false) +{ + global $db, $auth, $user, $template; + global $phpbb_root_path, $phpEx, $config; + global $request, $phpbb_dispatcher, $phpbb_container; + + $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array(); + $parent_id = $visible_forums = 0; + $parent_subforum_limit = false; + + // Mark forums read? + $mark_read = $request->variable('mark', ''); + + if ($mark_read == 'all') + { + $mark_read = ''; + } + + if (!$root_data) + { + if ($mark_read == 'forums') + { + $mark_read = 'all'; + } + + $root_data = array('forum_id' => 0); + $sql_where = ''; + } + else + { + $sql_where = 'left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id']; + } + + // Handle marking everything read + if ($mark_read == 'all') + { + $redirect = build_url(array('mark', 'hash', 'mark_time')); + meta_refresh(3, $redirect); + + if (check_link_hash($request->variable('hash', ''), 'global')) + { + markread('all', false, false, $request->variable('mark_time', 0)); + + if ($request->is_ajax()) + { + // Tell the ajax script what language vars and URL need to be replaced + $data = array( + 'NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'], + 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'], + 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums&mark_time=' . time(), false) : '', + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED'] + ); + $json_response = new \phpbb\json_response(); + $json_response->send($data); + } + + trigger_error( + $user->lang['FORUMS_MARKED'] . '

' . + sprintf($user->lang['RETURN_INDEX'], '', '') + ); + } + else + { + trigger_error(sprintf($user->lang['RETURN_PAGE'], '', '')); + } + } + + // Display list of active topics for this category? + $show_active = (isset($root_data['forum_flags']) && ($root_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false; + + $sql_array = array( + 'SELECT' => 'f.*', + 'FROM' => array( + FORUMS_TABLE => 'f' + ), + 'LEFT_JOIN' => array(), + ); + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id'); + $sql_array['SELECT'] .= ', ft.mark_time'; + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + + if (!$user->data['is_registered']) + { + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + } + + if ($show_active) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(FORUMS_ACCESS_TABLE => 'fa'), + 'ON' => "fa.forum_id = f.forum_id AND fa.session_id = '" . $db->sql_escape($user->session_id) . "'" + ); + + $sql_array['SELECT'] .= ', fa.user_id'; + } + + $sql_ary = array( + 'SELECT' => $sql_array['SELECT'], + 'FROM' => $sql_array['FROM'], + 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], + + 'WHERE' => $sql_where, + + 'ORDER_BY' => 'f.left_id', + ); + + /** + * Event to modify the SQL query before the forum data is queried + * + * @event core.display_forums_modify_sql + * @var array sql_ary The SQL array to get the data of the forums + * @since 3.1.0-a1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $forum_tracking_info = $valid_categories = array(); + $branch_root_id = $root_data['forum_id']; + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + while ($row = $db->sql_fetchrow($result)) + { + /** + * Event to modify the data set of a forum + * + * This event is triggered once per forum + * + * @event core.display_forums_modify_row + * @var int branch_root_id Last top-level forum + * @var array row The data of the forum + * @since 3.1.0-a1 + */ + $vars = array('branch_root_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_row', compact($vars))); + + $forum_id = $row['forum_id']; + + // Mark forums read? + if ($mark_read == 'forums') + { + if ($auth->acl_get('f_list', $forum_id)) + { + $forum_ids[] = $forum_id; + } + + continue; + } + + // Category with no members + if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) + { + continue; + } + + // Skip branch + if (isset($right_id)) + { + if ($row['left_id'] < $right_id) + { + continue; + } + unset($right_id); + } + + if (!$auth->acl_get('f_list', $forum_id)) + { + // if the user does not have permissions to list this forum, skip everything until next branch + $right_id = $row['right_id']; + continue; + } + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $forum_tracking_info[$forum_id] = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark']; + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + if (!$user->data['is_registered']) + { + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + $forum_tracking_info[$forum_id] = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + } + + // Lets check whether there are unapproved topics/posts, so we can display an information to moderators + $row['forum_id_unapproved_topics'] = ($auth->acl_get('m_approve', $forum_id) && $row['forum_topics_unapproved']) ? $forum_id : 0; + $row['forum_id_unapproved_posts'] = ($auth->acl_get('m_approve', $forum_id) && $row['forum_posts_unapproved']) ? $forum_id : 0; + $row['forum_posts'] = $phpbb_content_visibility->get_count('forum_posts', $row, $forum_id); + $row['forum_topics'] = $phpbb_content_visibility->get_count('forum_topics', $row, $forum_id); + + // Display active topics from this forum? + if ($show_active && $row['forum_type'] == FORUM_POST && $auth->acl_get('f_read', $forum_id) && ($row['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) + { + if (!isset($active_forum_ary['forum_topics'])) + { + $active_forum_ary['forum_topics'] = 0; + } + + if (!isset($active_forum_ary['forum_posts'])) + { + $active_forum_ary['forum_posts'] = 0; + } + + $active_forum_ary['forum_id'][] = $forum_id; + $active_forum_ary['enable_icons'][] = $row['enable_icons']; + $active_forum_ary['forum_topics'] += $row['forum_topics']; + $active_forum_ary['forum_posts'] += $row['forum_posts']; + + // If this is a passworded forum we do not show active topics from it if the user is not authorised to view it... + if ($row['forum_password'] && $row['user_id'] != $user->data['user_id']) + { + $active_forum_ary['exclude_forum_id'][] = $forum_id; + } + } + + // Fill list of categories with forums + if (isset($forum_rows[$row['parent_id']])) + { + $valid_categories[$row['parent_id']] = true; + } + + // + if ($row['parent_id'] == $root_data['forum_id'] || $row['parent_id'] == $branch_root_id) + { + if ($row['forum_type'] != FORUM_CAT) + { + $forum_ids_moderator[] = (int) $forum_id; + } + + // Direct child of current branch + $parent_id = $forum_id; + $parent_subforum_limit = $row['display_subforum_limit']; + $forum_rows[$forum_id] = $row; + + if ($row['forum_type'] == FORUM_CAT && $row['parent_id'] == $root_data['forum_id']) + { + $branch_root_id = $forum_id; + } + $forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id']; + $forum_rows[$parent_id]['forum_password_last_post'] = $row['forum_password']; + $forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; + } + else if ($row['forum_type'] != FORUM_CAT) + { + $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index'] && (!$parent_subforum_limit || $parent_id == $row['parent_id'])); + $subforums[$parent_id][$forum_id]['name'] = $row['forum_name']; + $subforums[$parent_id][$forum_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; + $subforums[$parent_id][$forum_id]['children'] = array(); + $subforums[$parent_id][$forum_id]['type'] = $row['forum_type']; + + if (isset($subforums[$parent_id][$row['parent_id']]) && !$row['display_on_index']) + { + $subforums[$parent_id][$row['parent_id']]['children'][] = $forum_id; + } + + if (!$forum_rows[$parent_id]['forum_id_unapproved_topics'] && $row['forum_id_unapproved_topics']) + { + $forum_rows[$parent_id]['forum_id_unapproved_topics'] = $forum_id; + } + + if (!$forum_rows[$parent_id]['forum_id_unapproved_posts'] && $row['forum_id_unapproved_posts']) + { + $forum_rows[$parent_id]['forum_id_unapproved_posts'] = $forum_id; + } + + $forum_rows[$parent_id]['forum_topics'] += $row['forum_topics']; + + // Do not list redirects in LINK Forums as Posts. + if ($row['forum_type'] != FORUM_LINK) + { + $forum_rows[$parent_id]['forum_posts'] += $row['forum_posts']; + } + + if ($row['forum_last_post_time'] > $forum_rows[$parent_id]['forum_last_post_time']) + { + $forum_rows[$parent_id]['forum_last_post_id'] = $row['forum_last_post_id']; + $forum_rows[$parent_id]['forum_last_post_subject'] = $row['forum_last_post_subject']; + $forum_rows[$parent_id]['forum_last_post_time'] = $row['forum_last_post_time']; + $forum_rows[$parent_id]['forum_last_poster_id'] = $row['forum_last_poster_id']; + $forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name']; + $forum_rows[$parent_id]['forum_last_poster_colour'] = $row['forum_last_poster_colour']; + $forum_rows[$parent_id]['forum_id_last_post'] = $forum_id; + $forum_rows[$parent_id]['forum_password_last_post'] = $row['forum_password']; + } + } + + /** + * Event to modify the forum rows data set + * + * This event is triggered once per forum + * + * @event core.display_forums_modify_forum_rows + * @var array forum_rows Data array of all forums we display + * @var array subforums Data array of all subforums we display + * @var int branch_root_id Current top-level forum + * @var int parent_id Current parent forum + * @var array row The data of the forum + * @since 3.1.0-a1 + */ + $vars = array('forum_rows', 'subforums', 'branch_root_id', 'parent_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_forum_rows', compact($vars))); + } + $db->sql_freeresult($result); + + // Handle marking posts + if ($mark_read == 'forums') + { + $redirect = build_url(array('mark', 'hash', 'mark_time')); + $token = $request->variable('hash', ''); + if (check_link_hash($token, 'global')) + { + markread('topics', $forum_ids, false, $request->variable('mark_time', 0)); + $message = sprintf($user->lang['RETURN_FORUM'], '', ''); + meta_refresh(3, $redirect); + + if ($request->is_ajax()) + { + // Tell the ajax script what language vars and URL need to be replaced + $data = array( + 'NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'], + 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'], + 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . '&f=' . $root_data['forum_id'] . '&mark=forums&mark_time=' . time(), false) : '', + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED'] + ); + $json_response = new \phpbb\json_response(); + $json_response->send($data); + } + + trigger_error($user->lang['FORUMS_MARKED'] . '

' . $message); + } + else + { + $message = sprintf($user->lang['RETURN_PAGE'], '', ''); + meta_refresh(3, $redirect); + trigger_error($message); + } + + } + + // Grab moderators ... if necessary + if ($display_moderators) + { + if ($return_moderators) + { + $forum_ids_moderator[] = $root_data['forum_id']; + } + get_moderators($forum_moderators, $forum_ids_moderator); + } + + /** + * Event to perform additional actions before the forum list is being generated + * + * @event core.display_forums_before + * @var array active_forum_ary Array with forum data to display active topics + * @var bool display_moderators Flag indicating if we display forum moderators + * @var array forum_moderators Array with forum moderators list + * @var array forum_rows Data array of all forums we display + * @var bool return_moderators Flag indicating if moderators list should be returned + * @var array root_data Array with the root forum data + * @since 3.1.4-RC1 + */ + $vars = array( + 'active_forum_ary', + 'display_moderators', + 'forum_moderators', + 'forum_rows', + 'return_moderators', + 'root_data', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_before', compact($vars))); + + // Used to tell whatever we have to create a dummy category or not. + $last_catless = true; + foreach ($forum_rows as $row) + { + // Category + if ($row['parent_id'] == $root_data['forum_id'] && $row['forum_type'] == FORUM_CAT) + { + // Do not display categories without any forums to display + if (!isset($valid_categories[$row['forum_id']])) + { + continue; + } + + $cat_row = array( + 'S_IS_CAT' => true, + 'FORUM_ID' => $row['forum_id'], + 'FORUM_NAME' => $row['forum_name'], + 'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), + 'FORUM_FOLDER_IMG' => '', + 'FORUM_FOLDER_IMG_SRC' => '', + 'FORUM_IMAGE' => ($row['forum_image']) ? '' . $user->lang['FORUM_CAT'] . '' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', + 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']), + ); + + /** + * Modify the template data block of the 'category' + * + * This event is triggered once per 'category' + * + * @event core.display_forums_modify_category_template_vars + * @var array cat_row Template data of the 'category' + * @var bool last_catless The flag indicating whether the last forum had a parent category + * @var array root_data Array with the root forum data + * @var array row The data of the 'category' + * @since 3.1.0-RC4 + * @changed 3.1.7-RC1 Removed undefined catless variable + */ + $vars = array( + 'cat_row', + 'last_catless', + 'root_data', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_category_template_vars', compact($vars))); + + $template->assign_block_vars('forumrow', $cat_row); + + continue; + } + + $visible_forums++; + $forum_id = $row['forum_id']; + + $forum_unread = (isset($forum_tracking_info[$forum_id]) && $row['orig_forum_last_post_time'] > $forum_tracking_info[$forum_id]) ? true : false; + + $folder_image = $folder_alt = $l_subforums = ''; + $subforums_list = array(); + + // Generate list of subforums if we need to + if (isset($subforums[$forum_id])) + { + foreach ($subforums[$forum_id] as $subforum_id => $subforum_row) + { + $subforum_unread = (isset($forum_tracking_info[$subforum_id]) && $subforum_row['orig_forum_last_post_time'] > $forum_tracking_info[$subforum_id]) ? true : false; + + if (!$subforum_unread && !empty($subforum_row['children'])) + { + foreach ($subforum_row['children'] as $child_id) + { + if (isset($forum_tracking_info[$child_id]) && $subforums[$forum_id][$child_id]['orig_forum_last_post_time'] > $forum_tracking_info[$child_id]) + { + // Once we found an unread child forum, we can drop out of this loop + $subforum_unread = true; + break; + } + } + } + + if ($subforum_row['display'] && $subforum_row['name']) + { + $subforums_list[] = array( + 'link' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $subforum_id), + 'name' => $subforum_row['name'], + 'unread' => $subforum_unread, + 'type' => $subforum_row['type'], + ); + } + else + { + unset($subforums[$forum_id][$subforum_id]); + } + + // If one subforum is unread the forum gets unread too... + if ($subforum_unread) + { + $forum_unread = true; + } + } + + $l_subforums = (count($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS']; + $folder_image = ($forum_unread) ? 'forum_unread_subforum' : 'forum_read_subforum'; + } + else + { + switch ($row['forum_type']) + { + case FORUM_POST: + $folder_image = ($forum_unread) ? 'forum_unread' : 'forum_read'; + break; + + case FORUM_LINK: + $folder_image = 'forum_link'; + break; + } + } + + // Which folder should we display? + if ($row['forum_status'] == ITEM_LOCKED) + { + $folder_image = ($forum_unread) ? 'forum_unread_locked' : 'forum_read_locked'; + $folder_alt = 'FORUM_LOCKED'; + } + else + { + $folder_alt = ($forum_unread) ? 'UNREAD_POSTS' : 'NO_UNREAD_POSTS'; + } + + // Create last post link information, if appropriate + if ($row['forum_last_post_id']) + { + if ($row['forum_password_last_post'] === '' && $auth->acl_gets('f_read', 'f_list_topics', $row['forum_id_last_post'])) + { + $last_post_subject = utf8_decode_ncr(censor_text($row['forum_last_post_subject'])); + + $last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']); + } + else + { + $last_post_subject = $last_post_subject_truncated = ''; + } + $last_post_time = $user->format_date($row['forum_last_post_time']); + $last_post_time_rfc3339 = gmdate(DATE_RFC3339, $row['forum_last_post_time']); + $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; + } + else + { + $last_post_subject = $last_post_time = $last_post_time_rfc3339 = $last_post_url = $last_post_subject_truncated = ''; + } + + // Output moderator listing ... if applicable + $l_moderator = $moderators_list = ''; + if ($display_moderators && !empty($forum_moderators[$forum_id])) + { + $l_moderator = (count($forum_moderators[$forum_id]) == 1) ? $user->lang['MODERATOR'] : $user->lang['MODERATORS']; + $moderators_list = implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]); + } + + $l_post_click_count = ($row['forum_type'] == FORUM_LINK) ? 'CLICKS' : 'POSTS'; + $post_click_count = ($row['forum_type'] != FORUM_LINK || $row['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? $row['forum_posts'] : ''; + + $s_subforums_list = $subforums_row = array(); + foreach ($subforums_list as $subforum) + { + $s_subforums_list[] = '' . $subforum['name'] . ''; + $subforums_row[] = array( + 'U_SUBFORUM' => $subforum['link'], + 'SUBFORUM_NAME' => $subforum['name'], + 'S_UNREAD' => $subforum['unread'], + 'IS_LINK' => $subforum['type'] == FORUM_LINK, + ); + } + $s_subforums_list = (string) implode($user->lang['COMMA_SEPARATOR'], $s_subforums_list); + $catless = ($row['parent_id'] == $root_data['forum_id']) ? true : false; + + if ($row['forum_type'] != FORUM_LINK) + { + $u_viewforum = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']); + } + else + { + // If the forum is a link and we count redirects we need to visit it + // If the forum is having a password or no read access we do not expose the link, but instead handle it in viewforum + if (($row['forum_flags'] & FORUM_FLAG_LINK_TRACK) || $row['forum_password'] || !$auth->acl_get('f_read', $forum_id)) + { + $u_viewforum = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']); + } + else + { + $u_viewforum = $row['forum_link']; + } + } + + $forum_row = array( + 'S_IS_CAT' => false, + 'S_NO_CAT' => $catless && !$last_catless, + 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false, + 'S_UNREAD_FORUM' => $forum_unread, + 'S_AUTH_READ' => $auth->acl_get('f_read', $row['forum_id']), + 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, + 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, + 'S_SUBFORUMS' => (count($subforums_list)) ? true : false, + 'S_DISPLAY_SUBJECT' => ($last_post_subject !== '' && $config['display_last_subject']) ? true : false, + 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, + + 'FORUM_ID' => $row['forum_id'], + 'FORUM_NAME' => $row['forum_name'], + 'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), + 'TOPICS' => $row['forum_topics'], + $l_post_click_count => $post_click_count, + 'FORUM_IMG_STYLE' => $folder_image, + 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), + 'FORUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '', + 'FORUM_IMAGE' => ($row['forum_image']) ? '' . $user->lang[$folder_alt] . '' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', + 'LAST_POST_SUBJECT' => $last_post_subject, + 'LAST_POST_SUBJECT_TRUNCATED' => $last_post_subject_truncated, + 'LAST_POST_TIME' => $last_post_time, + 'LAST_POST_TIME_RFC3339'=> $last_post_time_rfc3339, + 'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'LAST_POSTER_FULL' => get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'MODERATORS' => $moderators_list, + 'SUBFORUMS' => $s_subforums_list, + + 'L_SUBFORUM_STR' => $l_subforums, + 'L_MODERATOR_STR' => $l_moderator, + + 'U_UNAPPROVED_TOPICS' => ($row['forum_id_unapproved_topics']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_topics&f=' . $row['forum_id_unapproved_topics']) : '', + 'U_UNAPPROVED_POSTS' => ($row['forum_id_unapproved_posts']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_posts&f=' . $row['forum_id_unapproved_posts']) : '', + 'U_VIEWFORUM' => $u_viewforum, + 'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'U_LAST_POST' => $last_post_url, + ); + + /** + * Modify the template data block of the forum + * + * This event is triggered once per forum + * + * @event core.display_forums_modify_template_vars + * @var array forum_row Template data of the forum + * @var array row The data of the forum + * @var array subforums_row Template data of subforums + * @since 3.1.0-a1 + * @changed 3.1.0-b5 Added var subforums_row + */ + $vars = array('forum_row', 'row', 'subforums_row'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars))); + + $template->assign_block_vars('forumrow', $forum_row); + + // Assign subforums loop for style authors + $template->assign_block_vars_array('forumrow.subforum', $subforums_row); + + /** + * Modify and/or assign additional template data for the forum + * after forumrow loop has been assigned. This can be used + * to create additional forumrow subloops in extensions. + * + * This event is triggered once per forum + * + * @event core.display_forums_add_template_data + * @var array forum_row Template data of the forum + * @var array row The data of the forum + * @var array subforums_list The data of subforums + * @var array subforums_row Template data of subforums + * @var bool catless The flag indicating whether a forum has a parent category + * @since 3.1.0-b5 + */ + $vars = array( + 'forum_row', + 'row', + 'subforums_list', + 'subforums_row', + 'catless', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_add_template_data', compact($vars))); + + $last_catless = $catless; + } + + $template->assign_vars(array( + 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . '&f=' . $root_data['forum_id'] . '&mark=forums&mark_time=' . time()) : '', + 'S_HAS_SUBFORUM' => ($visible_forums) ? true : false, + 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'], + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPICS_UNAPPROVED'), + 'UNAPPROVED_POST_IMG' => $user->img('icon_topic_unapproved', 'POSTS_UNAPPROVED_FORUM'), + )); + + /** + * Event to perform additional actions after the forum list has been generated + * + * @event core.display_forums_after + * @var array active_forum_ary Array with forum data to display active topics + * @var bool display_moderators Flag indicating if we display forum moderators + * @var array forum_moderators Array with forum moderators list + * @var array forum_rows Data array of all forums we display + * @var bool return_moderators Flag indicating if moderators list should be returned + * @var array root_data Array with the root forum data + * @since 3.1.0-RC5 + */ + $vars = array( + 'active_forum_ary', + 'display_moderators', + 'forum_moderators', + 'forum_rows', + 'return_moderators', + 'root_data', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_after', compact($vars))); + + if ($return_moderators) + { + return array($active_forum_ary, $forum_moderators); + } + + return array($active_forum_ary, array()); +} + +/** +* Create forum rules for given forum +*/ +function generate_forum_rules(&$forum_data) +{ + if ($forum_data['forum_rules']) + { + $forum_data['forum_rules'] = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']); + } + + if (!$forum_data['forum_rules'] && !$forum_data['forum_rules_link']) + { + return; + } + + global $template; + + $template->assign_vars(array( + 'S_FORUM_RULES' => true, + 'U_FORUM_RULES' => $forum_data['forum_rules_link'], + 'FORUM_RULES' => $forum_data['forum_rules']) + ); +} + +/** +* Create forum navigation links for given forum, create parent +* list if currently null, assign basic forum info to template +*/ +function generate_forum_nav(&$forum_data_ary) +{ + global $template, $auth, $config; + global $phpEx, $phpbb_root_path, $phpbb_dispatcher; + + if (!$auth->acl_get('f_list', $forum_data_ary['forum_id'])) + { + return; + } + + $navlinks_parents = $forum_template_data = array(); + + // Get forum parents + $forum_parents = get_forum_parents($forum_data_ary); + + $microdata_attr = 'data-forum-id'; + + // Build navigation links + if (!empty($forum_parents)) + { + foreach ($forum_parents as $parent_forum_id => $parent_data) + { + list($parent_name, $parent_type) = array_values($parent_data); + + // Skip this parent if the user does not have the permission to view it + if (!$auth->acl_get('f_list', $parent_forum_id)) + { + continue; + } + + $navlinks_parents[] = array( + 'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false, + 'BREADCRUMB_NAME' => $parent_name, + 'FORUM_ID' => $parent_forum_id, + 'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"', + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id), + ); + } + } + + $navlinks = array( + 'S_IS_CAT' => ($forum_data_ary['forum_type'] == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($forum_data_ary['forum_type'] == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($forum_data_ary['forum_type'] == FORUM_POST) ? true : false, + 'BREADCRUMB_NAME' => $forum_data_ary['forum_name'], + 'FORUM_ID' => $forum_data_ary['forum_id'], + 'MICRODATA' => $microdata_attr . '="' . $forum_data_ary['forum_id'] . '"', + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data_ary['forum_id']), + ); + + $forum_template_data = array( + 'FORUM_ID' => $forum_data_ary['forum_id'], + 'FORUM_NAME' => $forum_data_ary['forum_name'], + 'FORUM_DESC' => generate_text_for_display($forum_data_ary['forum_desc'], $forum_data_ary['forum_desc_uid'], $forum_data_ary['forum_desc_bitfield'], $forum_data_ary['forum_desc_options']), + + 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data_ary['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data_ary['forum_options'])) ? true : false, + ); + + $forum_data = $forum_data_ary; + /** + * Event to modify the navlinks text + * + * @event core.generate_forum_nav + * @var array forum_data Array with the forum data + * @var array forum_template_data Array with generic forum template data + * @var string microdata_attr The microdata attribute + * @var array navlinks_parents Array with the forum parents navlinks data + * @var array navlinks Array with the forum navlinks data + * @since 3.1.5-RC1 + */ + $vars = array( + 'forum_data', + 'forum_template_data', + 'microdata_attr', + 'navlinks_parents', + 'navlinks', + ); + extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); + + $template->assign_block_vars_array('navlinks', $navlinks_parents); + $template->assign_block_vars('navlinks', $navlinks); + $template->assign_vars($forum_template_data); + + return; +} + +/** +* Returns forum parents as an array. Get them from forum_data if available, or update the database otherwise +*/ +function get_forum_parents(&$forum_data) +{ + global $db; + + $forum_parents = array(); + + if ($forum_data['parent_id'] > 0) + { + if ($forum_data['forum_parents'] == '') + { + $sql = 'SELECT forum_id, forum_name, forum_type + FROM ' . FORUMS_TABLE . ' + WHERE left_id < ' . $forum_data['left_id'] . ' + AND right_id > ' . $forum_data['right_id'] . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_parents[$row['forum_id']] = array($row['forum_name'], (int) $row['forum_type']); + } + $db->sql_freeresult($result); + + $forum_data['forum_parents'] = serialize($forum_parents); + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET forum_parents = '" . $db->sql_escape($forum_data['forum_parents']) . "' + WHERE parent_id = " . $forum_data['parent_id']; + $db->sql_query($sql); + } + else + { + $forum_parents = unserialize($forum_data['forum_parents']); + } + } + + return $forum_parents; +} + +/** +* Obtain list of moderators of each forum +*/ +function get_moderators(&$forum_moderators, $forum_id = false) +{ + global $db, $phpbb_root_path, $phpEx, $user, $auth; + global $phpbb_container; + + $forum_id_ary = array(); + + if ($forum_id !== false) + { + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + // Exchange key/value pair to be able to faster check for the forum id existence + $forum_id_ary = array_flip($forum_id); + } + + $sql_array = array( + 'SELECT' => 'm.*, u.user_colour, g.group_colour, g.group_type', + + 'FROM' => array( + MODERATOR_CACHE_TABLE => 'm', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(USERS_TABLE => 'u'), + 'ON' => 'm.user_id = u.user_id', + ), + array( + 'FROM' => array(GROUPS_TABLE => 'g'), + 'ON' => 'm.group_id = g.group_id', + ), + ), + + 'WHERE' => 'm.display_on_index = 1', + ); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + // We query every forum here because for caching we should not have any parameter. + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql, 3600); + + while ($row = $db->sql_fetchrow($result)) + { + $f_id = (int) $row['forum_id']; + + if (!isset($forum_id_ary[$f_id])) + { + continue; + } + + if (!empty($row['user_id'])) + { + $forum_moderators[$f_id][] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); + } + else + { + $group_name = $group_helper->get_name($row['group_name']); + + if ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) + { + $forum_moderators[$f_id][] = '' . $group_name . ''; + } + else + { + $forum_moderators[$f_id][] = '' . $group_name . ''; + } + } + } + $db->sql_freeresult($result); + + return; +} + +/** +* User authorisation levels output +* +* @param string $mode Can be forum or topic. Not in use at the moment. +* @param int $forum_id The current forum the user is in. +* @param int $forum_status The forums status bit. +*/ +function gen_forum_auth_level($mode, $forum_id, $forum_status) +{ + global $template, $auth, $user, $config; + + $locked = ($forum_status == ITEM_LOCKED && !$auth->acl_get('m_edit', $forum_id)) ? true : false; + + $rules = array( + ($auth->acl_get('f_post', $forum_id) && !$locked) ? $user->lang['RULES_POST_CAN'] : $user->lang['RULES_POST_CANNOT'], + ($auth->acl_get('f_reply', $forum_id) && !$locked) ? $user->lang['RULES_REPLY_CAN'] : $user->lang['RULES_REPLY_CANNOT'], + ($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $forum_id) && !$locked) ? $user->lang['RULES_EDIT_CAN'] : $user->lang['RULES_EDIT_CANNOT'], + ($user->data['is_registered'] && ($auth->acl_gets('f_delete', 'm_delete', $forum_id) || $auth->acl_gets('f_softdelete', 'm_softdelete', $forum_id)) && !$locked) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'], + ); + + if ($config['allow_attachments']) + { + $rules[] = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && !$locked) ? $user->lang['RULES_ATTACH_CAN'] : $user->lang['RULES_ATTACH_CANNOT']; + } + + foreach ($rules as $rule) + { + $template->assign_block_vars('rules', array('RULE' => $rule)); + } + + return; +} + +/** +* Generate topic status +*/ +function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$folder_alt, &$topic_type) +{ + global $user, $config; + + if ($topic_row['topic_status'] == ITEM_MOVED) + { + $topic_type = $user->lang['VIEW_TOPIC_MOVED']; + $folder_img = 'topic_moved'; + $folder_alt = 'TOPIC_MOVED'; + } + else + { + switch ($topic_row['topic_type']) + { + case POST_GLOBAL: + $topic_type = $user->lang['VIEW_TOPIC_GLOBAL']; + $folder = 'global_read'; + $folder_new = 'global_unread'; + break; + + case POST_ANNOUNCE: + $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT']; + $folder = 'announce_read'; + $folder_new = 'announce_unread'; + break; + + case POST_STICKY: + $topic_type = $user->lang['VIEW_TOPIC_STICKY']; + $folder = 'sticky_read'; + $folder_new = 'sticky_unread'; + break; + + default: + $topic_type = ''; + $folder = 'topic_read'; + $folder_new = 'topic_unread'; + + // Hot topic threshold is for posts in a topic, which is replies + the first post. ;) + if ($config['hot_threshold'] && ($replies + 1) >= $config['hot_threshold'] && $topic_row['topic_status'] != ITEM_LOCKED) + { + $folder .= '_hot'; + $folder_new .= '_hot'; + } + break; + } + + if ($topic_row['topic_status'] == ITEM_LOCKED) + { + $topic_type = $user->lang['VIEW_TOPIC_LOCKED']; + $folder .= '_locked'; + $folder_new .= '_locked'; + } + + $folder_img = ($unread_topic) ? $folder_new : $folder; + $folder_alt = ($unread_topic) ? 'UNREAD_POSTS' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS'); + + // Posted image? + if (!empty($topic_row['topic_posted']) && $topic_row['topic_posted']) + { + $folder_img .= '_mine'; + } + } + + if ($topic_row['poll_start'] && $topic_row['topic_status'] != ITEM_MOVED) + { + $topic_type = $user->lang['VIEW_TOPIC_POLL']; + } +} + +/** +* Assign/Build custom bbcodes for display in screens supporting using of bbcodes +* The custom bbcodes buttons will be placed within the template block 'custom_tags' +*/ +function display_custom_bbcodes() +{ + global $db, $template, $user, $phpbb_dispatcher; + + // Start counting from 22 for the bbcode ids (every bbcode takes two ids - opening/closing) + $num_predefined_bbcodes = NUM_PREDEFINED_BBCODES; + + $sql_ary = array( + 'SELECT' => 'b.bbcode_id, b.bbcode_tag, b.bbcode_helpline', + 'FROM' => array(BBCODES_TABLE => 'b'), + 'WHERE' => 'b.display_on_posting = 1', + 'ORDER_BY' => 'b.bbcode_tag', + ); + + /** + * Event to modify the SQL query before custom bbcode data is queried + * + * @event core.display_custom_bbcodes_modify_sql + * @var array sql_ary The SQL array to get the bbcode data + * @var int num_predefined_bbcodes The number of predefined core bbcodes + * (multiplied by factor of 2) + * @since 3.1.0-a3 + */ + $vars = array('sql_ary', 'num_predefined_bbcodes'); + extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + $i = 0; + while ($row = $db->sql_fetchrow($result)) + { + // If the helpline is defined within the language file, we will use the localised version, else just use the database entry... + if (isset($user->lang[strtoupper($row['bbcode_helpline'])])) + { + $row['bbcode_helpline'] = $user->lang[strtoupper($row['bbcode_helpline'])]; + } + + $custom_tags = array( + 'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", + 'BBCODE_ID' => $num_predefined_bbcodes + ($i * 2), + 'BBCODE_TAG' => $row['bbcode_tag'], + 'BBCODE_TAG_CLEAN' => str_replace('=', '-', $row['bbcode_tag']), + 'BBCODE_HELPLINE' => $row['bbcode_helpline'], + ); + + /** + * Event to modify the template data block of a custom bbcode + * + * This event is triggered once per bbcode + * + * @event core.display_custom_bbcodes_modify_row + * @var array custom_tags Template data of the bbcode + * @var array row The data of the bbcode + * @since 3.1.0-a1 + */ + $vars = array('custom_tags', 'row'); + extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_row', compact($vars))); + + $template->assign_block_vars('custom_tags', $custom_tags); + + $i++; + } + $db->sql_freeresult($result); + + /** + * Display custom bbcodes + * + * @event core.display_custom_bbcodes + * @since 3.1.0-a1 + */ + $phpbb_dispatcher->dispatch('core.display_custom_bbcodes'); +} + +/** +* Display user activity (action forum/topic) +*/ +function display_user_activity(&$userdata_ary) +{ + global $auth, $template, $db, $user, $config; + global $phpbb_root_path, $phpEx; + global $phpbb_container, $phpbb_dispatcher; + + // Do not display user activity for users having too many posts... + $limit = $config['load_user_activity_limit']; + if ($userdata_ary['user_posts'] > $limit && $limit != 0) + { + return; + } + + $forum_ary = array(); + + $forum_read_ary = $auth->acl_getf('f_read'); + foreach ($forum_read_ary as $forum_id => $allowed) + { + if ($allowed['f_read']) + { + $forum_ary[] = (int) $forum_id; + } + } + + $forum_ary = array_diff($forum_ary, $user->get_passworded_forums()); + + $active_f_row = $active_t_row = array(); + if (!empty($forum_ary)) + { + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + // Obtain active forum + $sql = 'SELECT forum_id, COUNT(post_id) AS num_posts + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . $userdata_ary['user_id'] . ' + AND post_postcount = 1 + AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . ' + GROUP BY forum_id + ORDER BY num_posts DESC'; + $result = $db->sql_query_limit($sql, 1); + $active_f_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!empty($active_f_row)) + { + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $active_f_row['forum_id']; + $result = $db->sql_query($sql, 3600); + $active_f_row['forum_name'] = (string) $db->sql_fetchfield('forum_name'); + $db->sql_freeresult($result); + } + + // Obtain active topic + $sql = 'SELECT topic_id, COUNT(post_id) AS num_posts + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . $userdata_ary['user_id'] . ' + AND post_postcount = 1 + AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . ' + GROUP BY topic_id + ORDER BY num_posts DESC'; + $result = $db->sql_query_limit($sql, 1); + $active_t_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!empty($active_t_row)) + { + $sql = 'SELECT topic_title + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $active_t_row['topic_id']; + $result = $db->sql_query($sql); + $active_t_row['topic_title'] = (string) $db->sql_fetchfield('topic_title'); + $db->sql_freeresult($result); + } + } + + $userdata = $userdata_ary; + $show_user_activity = true; + /** + * Alter list of forums and topics to display as active + * + * @event core.display_user_activity_modify_actives + * @var array userdata User's data + * @var array active_f_row List of active forums + * @var array active_t_row List of active posts + * @var bool show_user_activity Show user forum and topic activity + * @since 3.1.0-RC3 + * @changed 3.2.5-RC1 Added show_user_activity into event + */ + $vars = array('userdata', 'active_f_row', 'active_t_row', 'show_user_activity'); + extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars))); + $userdata_ary = $userdata; + unset($userdata); + + $userdata_ary['active_t_row'] = $active_t_row; + $userdata_ary['active_f_row'] = $active_f_row; + + $active_f_name = $active_f_id = $active_f_count = $active_f_pct = ''; + if (!empty($active_f_row['num_posts'])) + { + $active_f_name = $active_f_row['forum_name']; + $active_f_id = $active_f_row['forum_id']; + $active_f_count = $active_f_row['num_posts']; + $active_f_pct = ($userdata_ary['user_posts']) ? ($active_f_count / $userdata_ary['user_posts']) * 100 : 0; + } + + $active_t_name = $active_t_id = $active_t_count = $active_t_pct = ''; + if (!empty($active_t_row['num_posts'])) + { + $active_t_name = $active_t_row['topic_title']; + $active_t_id = $active_t_row['topic_id']; + $active_t_count = $active_t_row['num_posts']; + $active_t_pct = ($userdata_ary['user_posts']) ? ($active_t_count / $userdata_ary['user_posts']) * 100 : 0; + } + + $l_active_pct = ($userdata_ary['user_id'] != ANONYMOUS && $userdata_ary['user_id'] == $user->data['user_id']) ? $user->lang['POST_PCT_ACTIVE_OWN'] : $user->lang['POST_PCT_ACTIVE']; + + $template->assign_vars(array( + 'ACTIVE_FORUM' => $active_f_name, + 'ACTIVE_FORUM_POSTS' => $user->lang('USER_POSTS', (int) $active_f_count), + 'ACTIVE_FORUM_PCT' => sprintf($l_active_pct, $active_f_pct), + 'ACTIVE_TOPIC' => censor_text($active_t_name), + 'ACTIVE_TOPIC_POSTS' => $user->lang('USER_POSTS', (int) $active_t_count), + 'ACTIVE_TOPIC_PCT' => sprintf($l_active_pct, $active_t_pct), + 'U_ACTIVE_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $active_f_id), + 'U_ACTIVE_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $active_t_id), + 'S_SHOW_ACTIVITY' => $show_user_activity) + ); +} + +/** +* Topic and forum watching common code +*/ +function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0, $item_title = '') +{ + global $db, $user, $phpEx, $start, $phpbb_root_path; + global $request; + + $table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE; + $where_sql = ($mode == 'forum') ? 'forum_id' : 'topic_id'; + $match_id = ($mode == 'forum') ? $forum_id : $topic_id; + $u_url = "uid={$user->data['user_id']}"; + $u_url .= ($mode == 'forum') ? '&f' : '&f=' . $forum_id . '&t'; + $is_watching = 0; + + // Is user watching this topic? + if ($user_id != ANONYMOUS) + { + $can_watch = true; + + if ($notify_status == 'unset') + { + $sql = "SELECT notify_status + FROM $table_sql + WHERE $where_sql = $match_id + AND user_id = $user_id"; + $result = $db->sql_query($sql); + + $notify_status = ($row = $db->sql_fetchrow($result)) ? $row['notify_status'] : NULL; + $db->sql_freeresult($result); + } + + if (!is_null($notify_status) && $notify_status !== '') + { + if (isset($_GET['unwatch'])) + { + $uid = $request->variable('uid', 0); + $token = $request->variable('hash', ''); + + if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) + { + if ($uid != $user_id || $request->variable('unwatch', '', false, \phpbb\request\request_interface::GET) != $mode) + { + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['ERR_UNWATCHING']; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); + } + trigger_error($message); + } + + $sql = 'DELETE FROM ' . $table_sql . " + WHERE $where_sql = $match_id + AND user_id = $user_id"; + $db->sql_query($sql); + + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)]; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); + } + meta_refresh(3, $redirect_url); + trigger_error($message); + } + else + { + $s_hidden_fields = array( + 'uid' => $user->data['user_id'], + 'unwatch' => $mode, + 'start' => $start, + 'f' => $forum_id, + ); + if ($mode != 'forum') + { + $s_hidden_fields['t'] = $topic_id; + } + + if ($item_title == '') + { + $confirm_box_message = 'UNWATCH_' . strtoupper($mode); + } + else + { + $confirm_box_message = $user->lang('UNWATCH_' . strtoupper($mode) . '_DETAILED', $item_title); + } + confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields)); + } + } + else + { + $is_watching = true; + + if ($notify_status != NOTIFY_YES) + { + $sql = 'UPDATE ' . $table_sql . " + SET notify_status = " . NOTIFY_YES . " + WHERE $where_sql = $match_id + AND user_id = $user_id"; + $db->sql_query($sql); + } + } + } + else + { + if (isset($_GET['watch'])) + { + $uid = $request->variable('uid', 0); + $token = $request->variable('hash', ''); + + if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) + { + if ($uid != $user_id || $request->variable('watch', '', false, \phpbb\request\request_interface::GET) != $mode) + { + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['ERR_WATCHING']; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); + } + trigger_error($message); + } + + $is_watching = true; + + $sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status) + VALUES ($user_id, $match_id, " . NOTIFY_YES . ')'; + $db->sql_query($sql); + + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)]; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); + } + meta_refresh(3, $redirect_url); + trigger_error($message); + } + else + { + $s_hidden_fields = array( + 'uid' => $user->data['user_id'], + 'watch' => $mode, + 'start' => $start, + 'f' => $forum_id, + ); + if ($mode != 'forum') + { + $s_hidden_fields['t'] = $topic_id; + } + + $confirm_box_message = (($item_title == '') ? 'WATCH_' . strtoupper($mode) : $user->lang('WATCH_' . strtoupper($mode) . '_DETAILED', $item_title)); + confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields)); + } + } + else + { + $is_watching = 0; + } + } + } + else + { + if ((isset($_GET['unwatch']) && $request->variable('unwatch', '', false, \phpbb\request\request_interface::GET) == $mode) || + (isset($_GET['watch']) && $request->variable('watch', '', false, \phpbb\request\request_interface::GET) == $mode)) + { + login_box(); + } + else + { + $can_watch = 0; + $is_watching = 0; + } + } + + if ($can_watch) + { + $s_watching['link'] = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&" . (($is_watching) ? 'unwatch' : 'watch') . "=$mode&start=$start&hash=" . generate_link_hash("{$mode}_$match_id")); + $s_watching['link_toggle'] = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&" . ((!$is_watching) ? 'unwatch' : 'watch') . "=$mode&start=$start&hash=" . generate_link_hash("{$mode}_$match_id")); + $s_watching['title'] = $user->lang[(($is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; + $s_watching['title_toggle'] = $user->lang[((!$is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; + $s_watching['is_watching'] = $is_watching; + } + + return; +} + +/** +* Get user rank title and image +* +* @param array $user_data the current stored users data +* @param int $user_posts the users number of posts +* +* @return array An associative array containing the rank title (title), the rank image as full img tag (img) and the rank image source (img_src) +* +* Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false +*/ +function phpbb_get_user_rank($user_data, $user_posts) +{ + global $ranks, $config, $phpbb_root_path, $phpbb_path_helper, $phpbb_dispatcher; + + $user_rank_data = array( + 'title' => null, + 'img' => null, + 'img_src' => null, + ); + + /** + * Preparing a user's rank before displaying + * + * @event core.modify_user_rank + * @var array user_data Array with user's data + * @var int user_posts User_posts to change + * @since 3.1.0-RC4 + */ + + $vars = array('user_data', 'user_posts'); + extract($phpbb_dispatcher->trigger_event('core.modify_user_rank', compact($vars))); + + if (empty($ranks)) + { + global $cache; + $ranks = $cache->obtain_ranks(); + } + + if (!empty($user_data['user_rank'])) + { + + $user_rank_data['title'] = (isset($ranks['special'][$user_data['user_rank']]['rank_title'])) ? $ranks['special'][$user_data['user_rank']]['rank_title'] : ''; + + $user_rank_data['img_src'] = (!empty($ranks['special'][$user_data['user_rank']]['rank_image'])) ? $phpbb_path_helper->update_web_root_path($phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_data['user_rank']]['rank_image']) : ''; + + $user_rank_data['img'] = (!empty($ranks['special'][$user_data['user_rank']]['rank_image'])) ? '' . $ranks['special'][$user_data['user_rank']]['rank_title'] . '' : ''; + } + else if ($user_posts !== false) + { + if (!empty($ranks['normal'])) + { + foreach ($ranks['normal'] as $rank) + { + if ($user_posts >= $rank['rank_min']) + { + $user_rank_data['title'] = $rank['rank_title']; + $user_rank_data['img_src'] = (!empty($rank['rank_image'])) ? $phpbb_path_helper->update_web_root_path($phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image']) : ''; + $user_rank_data['img'] = (!empty($rank['rank_image'])) ? '' . $rank['rank_title'] . '' : ''; + break; + } + } + } + } + + /** + * Modify a user's rank before displaying + * + * @event core.get_user_rank_after + * @var array user_data Array with user's data + * @var int user_posts User_posts to change + * @var array user_rank_data User rank data + * @since 3.1.11-RC1 + */ + + $vars = array( + 'user_data', + 'user_posts', + 'user_rank_data', + ); + extract($phpbb_dispatcher->trigger_event('core.get_user_rank_after', compact($vars))); + + return $user_rank_data; +} + +/** +* Prepare profile data +*/ +function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false, $check_can_receive_pm = true) +{ + global $config, $auth, $user, $phpEx, $phpbb_root_path, $phpbb_dispatcher; + + $username = $data['username']; + $user_id = $data['user_id']; + + $user_rank_data = phpbb_get_user_rank($data, (($user_id == ANONYMOUS) ? false : $data['user_posts'])); + + if ((!empty($data['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_user')) + { + $email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_user')) ? '' : 'mailto:' . $data['user_email']); + } + else + { + $email = ''; + } + + if ($config['load_onlinetrack']) + { + $update_time = $config['load_online_time'] * 60; + $online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; + } + else + { + $online = false; + } + + if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) + { + $last_active = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit']; + } + else + { + $last_active = ''; + } + + $age = ''; + + if ($config['allow_birthdays'] && $data['user_birthday']) + { + list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday'])); + + if ($bday_year) + { + $now = $user->create_datetime(); + $now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset()); + + $diff = $now['mon'] - $bday_month; + if ($diff == 0) + { + $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; + } + else + { + $diff = ($diff < 0) ? 1 : 0; + } + + $age = max(0, (int) ($now['year'] - $bday_year - $diff)); + } + } + + if (!function_exists('phpbb_get_banned_user_ids')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + // Can this user receive a Private Message? + $can_receive_pm = $check_can_receive_pm && ( + // They must be a "normal" user + $data['user_type'] != USER_IGNORE && + + // They must not be deactivated by the administrator + ($data['user_type'] != USER_INACTIVE || $data['user_inactive_reason'] != INACTIVE_MANUAL) && + + // They must be able to read PMs + count($auth->acl_get_list($user_id, 'u_readpm')) && + + // They must not be permanently banned + !count(phpbb_get_banned_user_ids($user_id, false)) && + + // They must allow users to contact via PM + (($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || $data['user_allow_pm']) + ); + + // Dump it out to the template + $template_data = array( + 'AGE' => $age, + 'RANK_TITLE' => $user_rank_data['title'], + 'JOINED' => $user->format_date($data['user_regdate']), + 'LAST_ACTIVE' => (empty($last_active)) ? ' - ' : $user->format_date($last_active), + 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0, + 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, + + 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']), + 'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']), + 'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']), + 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']), + + 'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])), + + 'AVATAR_IMG' => phpbb_get_user_avatar($data), + 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), + 'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false, + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], + 'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false, + + 'S_WARNINGS' => ($auth->acl_getf_global('m_') || $auth->acl_get('m_warn')) ? true : false, + + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '', + 'U_NOTES' => ($user_notes_enabled && $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', + 'U_WARN' => ($warn_user_enabled && $auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', + 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && $can_receive_pm) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $user_id) : '', + 'U_EMAIL' => $email, + 'U_JABBER' => ($data['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $user_id) : '', + + 'USER_JABBER' => ($config['jab_enable']) ? $data['user_jabber'] : '', + 'USER_JABBER_IMG' => ($config['jab_enable'] && $data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '', + + 'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $username), + 'L_CONTACT_USER' => $user->lang('CONTACT_USER', $username), + 'L_VIEWING_PROFILE' => $user->lang('VIEWING_PROFILE', $username), + ); + + /** + * Preparing a user's data before displaying it in profile and memberlist + * + * @event core.memberlist_prepare_profile_data + * @var array data Array with user's data + * @var array template_data Template array with user's data + * @since 3.1.0-a1 + */ + $vars = array('data', 'template_data'); + extract($phpbb_dispatcher->trigger_event('core.memberlist_prepare_profile_data', compact($vars))); + + return $template_data; +} + +function phpbb_sort_last_active($first, $second) +{ + global $id_cache, $sort_dir; + + $lesser_than = ($sort_dir === 'd') ? -1 : 1; + + if (isset($id_cache[$first]['group_leader']) && $id_cache[$first]['group_leader'] && (!isset($id_cache[$second]['group_leader']) || !$id_cache[$second]['group_leader'])) + { + return -1; + } + else if (isset($id_cache[$second]['group_leader']) && (!isset($id_cache[$first]['group_leader']) || !$id_cache[$first]['group_leader']) && $id_cache[$second]['group_leader']) + { + return 1; + } + else + { + return $lesser_than * (int) ($id_cache[$first]['last_visit'] - $id_cache[$second]['last_visit']); + } +} diff --git a/install/update/new/includes/functions_download.php b/install/update/new/includes/functions_download.php new file mode 100644 index 0000000..d2d3924 --- /dev/null +++ b/install/update/new/includes/functions_download.php @@ -0,0 +1,782 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* A simplified function to deliver avatars +* The argument needs to be checked before calling this function. +*/ +function send_avatar_to_browser($file, $browser) +{ + global $config, $phpbb_root_path; + + $prefix = $config['avatar_salt'] . '_'; + $image_dir = $config['avatar_path']; + + // Adjust image_dir path (no trailing slash) + if (substr($image_dir, -1, 1) == '/' || substr($image_dir, -1, 1) == '\\') + { + $image_dir = substr($image_dir, 0, -1) . '/'; + } + $image_dir = str_replace(array('../', '..\\', './', '.\\'), '', $image_dir); + + if ($image_dir && ($image_dir[0] == '/' || $image_dir[0] == '\\')) + { + $image_dir = ''; + } + $file_path = $phpbb_root_path . $image_dir . '/' . $prefix . $file; + + if ((@file_exists($file_path) && @is_readable($file_path)) && !headers_sent()) + { + header('Cache-Control: public'); + + $image_data = @getimagesize($file_path); + header('Content-Type: ' . image_type_to_mime_type($image_data[2])); + + if ((strpos(strtolower($browser), 'msie') !== false) && !phpbb_is_greater_ie_version($browser, 7)) + { + header('Content-Disposition: attachment; ' . header_filename($file)); + + if (strpos(strtolower($browser), 'msie 6.0') !== false) + { + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); + } + else + { + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); + } + } + else + { + header('Content-Disposition: inline; ' . header_filename($file)); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); + } + + $size = @filesize($file_path); + if ($size) + { + header("Content-Length: $size"); + } + + if (@readfile($file_path) == false) + { + $fp = @fopen($file_path, 'rb'); + + if ($fp !== false) + { + while (!feof($fp)) + { + echo fread($fp, 8192); + } + fclose($fp); + } + } + + flush(); + } + else + { + header('HTTP/1.0 404 Not Found'); + } +} + +/** +* Wraps an url into a simple html page. Used to display attachments in IE. +* this is a workaround for now; might be moved to template system later +* direct any complaints to 1 Microsoft Way, Redmond +*/ +function wrap_img_in_html($src, $title) +{ + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '' . $title . ''; + echo ''; + echo ''; + echo '
'; + echo '' . $title . ''; + echo '
'; + echo ''; + echo ''; +} + +/** +* Send file to browser +*/ +function send_file_to_browser($attachment, $upload_dir, $category) +{ + global $user, $db, $phpbb_dispatcher, $phpbb_root_path, $request; + + $filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename']; + + if (!@file_exists($filename)) + { + send_status_line(404, 'Not Found'); + trigger_error('ERROR_NO_ATTACHMENT'); + } + + // Correct the mime type - we force application/octetstream for all files, except images + // Please do not change this, it is a security precaution + if ($category != ATTACHMENT_CATEGORY_IMAGE || strpos($attachment['mimetype'], 'image') !== 0) + { + $attachment['mimetype'] = (strpos(strtolower($user->browser), 'msie') !== false || strpos(strtolower($user->browser), 'opera') !== false) ? 'application/octetstream' : 'application/octet-stream'; + } + + if (@ob_get_length()) + { + @ob_end_clean(); + } + + // Now send the File Contents to the Browser + $size = @filesize($filename); + + /** + * Event to alter attachment before it is sent to browser. + * + * @event core.send_file_to_browser_before + * @var array attachment Attachment data + * @var string upload_dir Relative path of upload directory + * @var int category Attachment category + * @var string filename Path to file, including filename + * @var int size File size + * @since 3.1.11-RC1 + */ + $vars = array( + 'attachment', + 'upload_dir', + 'category', + 'filename', + 'size', + ); + extract($phpbb_dispatcher->trigger_event('core.send_file_to_browser_before', compact($vars))); + + // To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work) + + // Check if headers already sent or not able to get the file contents. + if (headers_sent() || !@file_exists($filename) || !@is_readable($filename)) + { + // PHP track_errors setting On? + if (!empty($php_errormsg)) + { + send_status_line(500, 'Internal Server Error'); + trigger_error($user->lang['UNABLE_TO_DELIVER_FILE'] . '
' . sprintf($user->lang['TRACKED_PHP_ERROR'], $php_errormsg)); + } + + send_status_line(500, 'Internal Server Error'); + trigger_error('UNABLE_TO_DELIVER_FILE'); + } + + // Make sure the database record for the filesize is correct + if ($size > 0 && $size != $attachment['filesize'] && strpos($attachment['physical_filename'], 'thumb_') === false) + { + // Update database record + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET filesize = ' . (int) $size . ' + WHERE attach_id = ' . (int) $attachment['attach_id']; + $db->sql_query($sql); + } + + // Now the tricky part... let's dance + header('Cache-Control: private'); + + // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. + header('Content-Type: ' . $attachment['mimetype']); + + if (phpbb_is_greater_ie_version($user->browser, 7)) + { + header('X-Content-Type-Options: nosniff'); + } + + if (empty($user->browser) || ((strpos(strtolower($user->browser), 'msie') !== false) && !phpbb_is_greater_ie_version($user->browser, 7))) + { + header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); + if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) + { + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); + } + } + else + { + header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); + if (phpbb_is_greater_ie_version($user->browser, 7) && (strpos($attachment['mimetype'], 'image') !== 0)) + { + header('X-Download-Options: noopen'); + } + } + + // Close the db connection before sending the file etc. + file_gc(false); + + if (!set_modified_headers($attachment['filetime'], $user->browser)) + { + // We make sure those have to be enabled manually by defining a constant + // because of the potential disclosure of full attachment path + // in case support for features is absent in the webserver software. + if (defined('PHPBB_ENABLE_X_ACCEL_REDIRECT') && PHPBB_ENABLE_X_ACCEL_REDIRECT) + { + // X-Accel-Redirect - http://wiki.nginx.org/XSendfile + header('X-Accel-Redirect: ' . $user->page['root_script_path'] . $upload_dir . '/' . $attachment['physical_filename']); + exit; + } + else if (defined('PHPBB_ENABLE_X_SENDFILE') && PHPBB_ENABLE_X_SENDFILE && !phpbb_http_byte_range($size)) + { + // X-Sendfile - http://blog.lighttpd.net/articles/2006/07/02/x-sendfile + // Lighttpd's X-Sendfile does not support range requests as of 1.4.26 + // and always requires an absolute path. + header('X-Sendfile: ' . dirname(__FILE__) . "/../$upload_dir/{$attachment['physical_filename']}"); + exit; + } + + if ($size) + { + header("Content-Length: $size"); + } + + // Try to deliver in chunks + @set_time_limit(0); + + $fp = @fopen($filename, 'rb'); + + if ($fp !== false) + { + // Deliver file partially if requested + if ($range = phpbb_http_byte_range($size)) + { + fseek($fp, $range['byte_pos_start']); + + send_status_line(206, 'Partial Content'); + header('Content-Range: bytes ' . $range['byte_pos_start'] . '-' . $range['byte_pos_end'] . '/' . $range['bytes_total']); + header('Content-Length: ' . $range['bytes_requested']); + + // First read chunks + while (!feof($fp) && ftell($fp) < $range['byte_pos_end'] - 8192) + { + echo fread($fp, 8192); + } + // Then, read the remainder + echo fread($fp, $range['bytes_requested'] % 8192); + } + else + { + while (!feof($fp)) + { + echo fread($fp, 8192); + } + } + fclose($fp); + } + else + { + @readfile($filename); + } + + flush(); + } + + exit; +} + +/** +* Get a browser friendly UTF-8 encoded filename +*/ +function header_filename($file) +{ + global $request; + + $user_agent = $request->header('User-Agent'); + + // There be dragons here. + // Not many follows the RFC... + if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Konqueror') !== false) + { + return "filename=" . rawurlencode($file); + } + + // follow the RFC for extended filename for the rest + return "filename*=UTF-8''" . rawurlencode($file); +} + +/** +* Check if downloading item is allowed +*/ +function download_allowed() +{ + global $config, $user, $db, $request; + + if (!$config['secure_downloads']) + { + return true; + } + + $url = htmlspecialchars_decode($request->header('Referer')); + + if (!$url) + { + return ($config['secure_allow_empty_referer']) ? true : false; + } + + // Split URL into domain and script part + $url = @parse_url($url); + + if ($url === false) + { + return ($config['secure_allow_empty_referer']) ? true : false; + } + + $hostname = $url['host']; + unset($url); + + $allowed = ($config['secure_allow_deny']) ? false : true; + $iplist = array(); + + if (($ip_ary = @gethostbynamel($hostname)) !== false) + { + foreach ($ip_ary as $ip) + { + if ($ip) + { + $iplist[] = $ip; + } + } + } + + // Check for own server... + $server_name = $user->host; + + // Forcing server vars is the only way to specify/override the protocol + if ($config['force_server_vars'] || !$server_name) + { + $server_name = $config['server_name']; + } + + if (preg_match('#^.*?' . preg_quote($server_name, '#') . '.*?$#i', $hostname)) + { + $allowed = true; + } + + // Get IP's and Hostnames + if (!$allowed) + { + $sql = 'SELECT site_ip, site_hostname, ip_exclude + FROM ' . SITELIST_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $site_ip = trim($row['site_ip']); + $site_hostname = trim($row['site_hostname']); + + if ($site_ip) + { + foreach ($iplist as $ip) + { + if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($site_ip, '#')) . '$#i', $ip)) + { + if ($row['ip_exclude']) + { + $allowed = ($config['secure_allow_deny']) ? false : true; + break 2; + } + else + { + $allowed = ($config['secure_allow_deny']) ? true : false; + } + } + } + } + + if ($site_hostname) + { + if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($site_hostname, '#')) . '$#i', $hostname)) + { + if ($row['ip_exclude']) + { + $allowed = ($config['secure_allow_deny']) ? false : true; + break; + } + else + { + $allowed = ($config['secure_allow_deny']) ? true : false; + } + } + } + } + $db->sql_freeresult($result); + } + + return $allowed; +} + +/** +* Check if the browser has the file already and set the appropriate headers- +* @returns false if a resend is in order. +*/ +function set_modified_headers($stamp, $browser) +{ + global $request; + + // let's see if we have to send the file at all + $last_load = $request->header('If-Modified-Since') ? strtotime(trim($request->header('If-Modified-Since'))) : false; + + if (strpos(strtolower($browser), 'msie 6.0') === false && !phpbb_is_greater_ie_version($browser, 7)) + { + if ($last_load !== false && $last_load >= $stamp) + { + send_status_line(304, 'Not Modified'); + // seems that we need those too ... browsers + header('Cache-Control: private'); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); + return true; + } + else + { + header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $stamp) . ' GMT'); + } + } + return false; +} + +/** +* Garbage Collection +* +* @param bool $exit Whether to die or not. +* +* @return null +*/ +function file_gc($exit = true) +{ + global $cache, $db; + + if (!empty($cache)) + { + $cache->unload(); + } + + $db->sql_close(); + + if ($exit) + { + exit; + } +} + +/** +* HTTP range support (RFC 2616 Section 14.35) +* +* Allows browsers to request partial file content +* in case a download has been interrupted. +* +* @param int $filesize the size of the file in bytes we are about to deliver +* +* @return mixed false if the whole file has to be delivered +* associative array on success +*/ +function phpbb_http_byte_range($filesize) +{ + // Only call find_range_request() once. + static $request_array; + + if (!$filesize) + { + return false; + } + + if (!isset($request_array)) + { + $request_array = phpbb_find_range_request(); + } + + return (empty($request_array)) ? false : phpbb_parse_range_request($request_array, $filesize); +} + +/** +* Searches for HTTP range request in request headers. +* +* @return mixed false if no request found +* array of strings containing the requested ranges otherwise +* e.g. array(0 => '0-0', 1 => '123-125') +*/ +function phpbb_find_range_request() +{ + global $request; + + $value = $request->header('Range'); + + // Make sure range request starts with "bytes=" + if (strpos($value, 'bytes=') === 0) + { + // Strip leading 'bytes=' + // Multiple ranges can be separated by a comma + return explode(',', substr($value, 6)); + } + + return false; +} + +/** +* Analyses a range request array. +* +* A range request can contain multiple ranges, +* we however only handle the first request and +* only support requests from a given byte to the end of the file. +* +* @param array $request_array array of strings containing the requested ranges +* @param int $filesize the full size of the file in bytes that has been requested +* +* @return mixed false if the whole file has to be delivered +* associative array on success +* byte_pos_start the first byte position, can be passed to fseek() +* byte_pos_end the last byte position +* bytes_requested the number of bytes requested +* bytes_total the full size of the file +*/ +function phpbb_parse_range_request($request_array, $filesize) +{ + $first_byte_pos = -1; + $last_byte_pos = -1; + + // Go through all ranges + foreach ($request_array as $range_string) + { + $range = explode('-', trim($range_string)); + + // "-" is invalid, "0-0" however is valid and means the very first byte. + if (count($range) != 2 || $range[0] === '' && $range[1] === '') + { + continue; + } + + // Substitute defaults + if ($range[0] === '') + { + $range[0] = 0; + } + + if ($range[1] === '') + { + $range[1] = $filesize - 1; + } + + if ($last_byte_pos >= 0 && $last_byte_pos + 1 != $range[0]) + { + // We only support contiguous ranges, no multipart stuff :( + return false; + } + + if ($range[1] && $range[1] < $range[0]) + { + // The requested range contains 0 bytes. + continue; + } + + // Return bytes from $range[0] to $range[1] + if ($first_byte_pos < 0) + { + $first_byte_pos = (int) $range[0]; + } + + $last_byte_pos = (int) $range[1]; + + if ($first_byte_pos >= $filesize) + { + // Requested range not satisfiable + return false; + } + + // Adjust last-byte-pos if it is absent or greater than the content. + if ($range[1] === '' || $last_byte_pos >= $filesize) + { + $last_byte_pos = $filesize - 1; + } + } + + if ($first_byte_pos < 0 || $last_byte_pos < 0) + { + return false; + } + + return array( + 'byte_pos_start' => $first_byte_pos, + 'byte_pos_end' => $last_byte_pos, + 'bytes_requested' => $last_byte_pos - $first_byte_pos + 1, + 'bytes_total' => $filesize, + ); +} + +/** +* Increments the download count of all provided attachments +* +* @param \phpbb\db\driver\driver_interface $db The database object +* @param array|int $ids The attach_id of each attachment +* +* @return null +*/ +function phpbb_increment_downloads($db, $ids) +{ + if (!is_array($ids)) + { + $ids = array($ids); + } + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET download_count = download_count + 1 + WHERE ' . $db->sql_in_set('attach_id', $ids); + $db->sql_query($sql); +} + +/** +* Handles authentication when downloading attachments from a post or topic +* +* @param \phpbb\db\driver\driver_interface $db The database object +* @param \phpbb\auth\auth $auth The authentication object +* @param int $topic_id The id of the topic that we are downloading from +* +* @return null +*/ +function phpbb_download_handle_forum_auth($db, $auth, $topic_id) +{ + global $phpbb_container; + + $sql_array = array( + 'SELECT' => 't.topic_visibility, t.forum_id, f.forum_name, f.forum_password, f.parent_id', + 'FROM' => array( + TOPICS_TABLE => 't', + FORUMS_TABLE => 'f', + ), + 'WHERE' => 't.topic_id = ' . (int) $topic_id . ' + AND t.forum_id = f.forum_id', + ); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + if ($row && !$phpbb_content_visibility->is_visible('topic', $row['forum_id'], $row)) + { + send_status_line(404, 'Not Found'); + trigger_error('ERROR_NO_ATTACHMENT'); + } + else if ($row && $auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id'])) + { + if ($row['forum_password']) + { + // Do something else ... ? + login_forum_box($row); + } + } + else + { + send_status_line(403, 'Forbidden'); + trigger_error('SORRY_AUTH_VIEW_ATTACH'); + } +} + +/** +* Handles authentication when downloading attachments from PMs +* +* @param \phpbb\db\driver\driver_interface $db The database object +* @param \phpbb\auth\auth $auth The authentication object +* @param int $user_id The user id +* @param int $msg_id The id of the PM that we are downloading from +* +* @return null +*/ +function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id) +{ + global $phpbb_dispatcher; + + if (!$auth->acl_get('u_pm_download')) + { + send_status_line(403, 'Forbidden'); + trigger_error('SORRY_AUTH_VIEW_ATTACH'); + } + + $allowed = phpbb_download_check_pm_auth($db, $user_id, $msg_id); + + /** + * Event to modify PM attachments download auth + * + * @event core.modify_pm_attach_download_auth + * @var bool allowed Whether the user is allowed to download from that PM or not + * @var int msg_id The id of the PM to download from + * @var int user_id The user id for auth check + * @since 3.1.11-RC1 + */ + $vars = array('allowed', 'msg_id', 'user_id'); + extract($phpbb_dispatcher->trigger_event('core.modify_pm_attach_download_auth', compact($vars))); + + if (!$allowed) + { + send_status_line(403, 'Forbidden'); + trigger_error('ERROR_NO_ATTACHMENT'); + } +} + +/** +* Checks whether a user can download from a particular PM +* +* @param \phpbb\db\driver\driver_interface $db The database object +* @param int $user_id The user id +* @param int $msg_id The id of the PM that we are downloading from +* +* @return bool Whether the user is allowed to download from that PM or not +*/ +function phpbb_download_check_pm_auth($db, $user_id, $msg_id) +{ + // Check if the attachment is within the users scope... + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE msg_id = ' . (int) $msg_id . ' + AND ( + user_id = ' . (int) $user_id . ' + OR author_id = ' . (int) $user_id . ' + )'; + $result = $db->sql_query_limit($sql, 1); + $allowed = (bool) $db->sql_fetchfield('msg_id'); + $db->sql_freeresult($result); + + return $allowed; +} + +/** +* Check if the browser is internet explorer version 7+ +* +* @param string $user_agent User agent HTTP header +* @param int $version IE version to check against +* +* @return bool true if internet explorer version is greater than $version +*/ +function phpbb_is_greater_ie_version($user_agent, $version) +{ + if (preg_match('/msie (\d+)/', strtolower($user_agent), $matches)) + { + $ie_version = (int) $matches[1]; + return ($ie_version > $version); + } + else + { + return false; + } +} diff --git a/install/update/new/includes/functions_messenger.php b/install/update/new/includes/functions_messenger.php new file mode 100644 index 0000000..ec297b5 --- /dev/null +++ b/install/update/new/includes/functions_messenger.php @@ -0,0 +1,1935 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Messenger +*/ +class messenger +{ + var $msg, $replyto, $from, $subject; + var $addresses = array(); + var $extra_headers = array(); + + var $mail_priority = MAIL_NORMAL_PRIORITY; + var $use_queue = true; + + /** @var \phpbb\template\template */ + protected $template; + + /** + * Constructor + */ + function __construct($use_queue = true) + { + global $config; + + $this->use_queue = (!$config['email_package_size']) ? false : $use_queue; + $this->subject = ''; + } + + /** + * Resets all the data (address, template file, etc etc) to default + */ + function reset() + { + $this->addresses = $this->extra_headers = array(); + $this->msg = $this->replyto = $this->from = ''; + $this->mail_priority = MAIL_NORMAL_PRIORITY; + } + + /** + * Set addresses for to/im as available + * + * @param array $user User row + */ + function set_addresses($user) + { + if (isset($user['user_email']) && $user['user_email']) + { + $this->to($user['user_email'], (isset($user['username']) ? $user['username'] : '')); + } + + if (isset($user['user_jabber']) && $user['user_jabber']) + { + $this->im($user['user_jabber'], (isset($user['username']) ? $user['username'] : '')); + } + } + + /** + * Sets an email address to send to + */ + function to($address, $realname = '') + { + global $config; + + if (!trim($address)) + { + return; + } + + $pos = isset($this->addresses['to']) ? count($this->addresses['to']) : 0; + + $this->addresses['to'][$pos]['email'] = trim($address); + + // If empty sendmail_path on windows, PHP changes the to line + if (!$config['smtp_delivery'] && DIRECTORY_SEPARATOR == '\\') + { + $this->addresses['to'][$pos]['name'] = ''; + } + else + { + $this->addresses['to'][$pos]['name'] = trim($realname); + } + } + + /** + * Sets an cc address to send to + */ + function cc($address, $realname = '') + { + if (!trim($address)) + { + return; + } + + $pos = isset($this->addresses['cc']) ? count($this->addresses['cc']) : 0; + $this->addresses['cc'][$pos]['email'] = trim($address); + $this->addresses['cc'][$pos]['name'] = trim($realname); + } + + /** + * Sets an bcc address to send to + */ + function bcc($address, $realname = '') + { + if (!trim($address)) + { + return; + } + + $pos = isset($this->addresses['bcc']) ? count($this->addresses['bcc']) : 0; + $this->addresses['bcc'][$pos]['email'] = trim($address); + $this->addresses['bcc'][$pos]['name'] = trim($realname); + } + + /** + * Sets a im contact to send to + */ + function im($address, $realname = '') + { + // IM-Addresses could be empty + if (!trim($address)) + { + return; + } + + $pos = isset($this->addresses['im']) ? count($this->addresses['im']) : 0; + $this->addresses['im'][$pos]['uid'] = trim($address); + $this->addresses['im'][$pos]['name'] = trim($realname); + } + + /** + * Set the reply to address + */ + function replyto($address) + { + $this->replyto = trim($address); + } + + /** + * Set the from address + */ + function from($address) + { + $this->from = trim($address); + } + + /** + * set up subject for mail + */ + function subject($subject = '') + { + $this->subject = trim($subject); + } + + /** + * set up extra mail headers + */ + function headers($headers) + { + $this->extra_headers[] = trim($headers); + } + + /** + * Adds X-AntiAbuse headers + * + * @param \phpbb\config\config $config Config object + * @param \phpbb\user $user User object + * @return void + */ + function anti_abuse_headers($config, $user) + { + $this->headers('X-AntiAbuse: Board servername - ' . mail_encode($config['server_name'])); + $this->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); + $this->headers('X-AntiAbuse: Username - ' . mail_encode($user->data['username'])); + $this->headers('X-AntiAbuse: User IP - ' . $user->ip); + } + + /** + * Set the email priority + */ + function set_mail_priority($priority = MAIL_NORMAL_PRIORITY) + { + $this->mail_priority = $priority; + } + + /** + * Set email template to use + */ + function template($template_file, $template_lang = '', $template_path = '', $template_dir_prefix = '') + { + global $config, $phpbb_root_path, $user; + + $template_dir_prefix = (!$template_dir_prefix || $template_dir_prefix[0] === '/') ? $template_dir_prefix : '/' . $template_dir_prefix; + + $this->setup_template(); + + if (!trim($template_file)) + { + trigger_error('No template file for emailing set.', E_USER_ERROR); + } + + if (!trim($template_lang)) + { + // fall back to board default language if the user's language is + // missing $template_file. If this does not exist either, + // $this->template->set_filenames will do a trigger_error + $template_lang = basename($config['default_lang']); + } + + $ext_template_paths = array( + array( + 'name' => $template_lang . '_email', + 'ext_path' => 'language/' . $template_lang . '/email' . $template_dir_prefix, + ), + ); + + if ($template_path) + { + $template_paths = array( + $template_path . $template_dir_prefix, + ); + } + else + { + $template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; + $template_path .= $template_lang . '/email'; + + $template_paths = array( + $template_path . $template_dir_prefix, + ); + + $board_language = basename($config['default_lang']); + + // we can only specify default language fallback when the path is not a custom one for which we + // do not know the default language alternative + if ($template_lang !== $board_language) + { + $fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; + $fallback_template_path .= $board_language . '/email'; + + $template_paths[] = $fallback_template_path . $template_dir_prefix; + + $ext_template_paths[] = array( + 'name' => $board_language . '_email', + 'ext_path' => 'language/' . $board_language . '/email' . $template_dir_prefix, + ); + } + // If everything fails just fall back to en template + if ($template_lang !== 'en' && $board_language !== 'en') + { + $fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; + $fallback_template_path .= 'en/email'; + + $template_paths[] = $fallback_template_path . $template_dir_prefix; + + $ext_template_paths[] = array( + 'name' => 'en_email', + 'ext_path' => 'language/en/email' . $template_dir_prefix, + ); + } + } + + $this->set_template_paths($ext_template_paths, $template_paths); + + $this->template->set_filenames(array( + 'body' => $template_file . '.txt', + )); + + return true; + } + + /** + * assign variables to email template + */ + function assign_vars($vars) + { + $this->setup_template(); + + $this->template->assign_vars($vars); + } + + function assign_block_vars($blockname, $vars) + { + $this->setup_template(); + + $this->template->assign_block_vars($blockname, $vars); + } + + /** + * Send the mail out to the recipients set previously in var $this->addresses + * + * @param int $method User notification method NOTIFY_EMAIL|NOTIFY_IM|NOTIFY_BOTH + * @param bool $break Flag indicating if the function only formats the subject + * and the message without sending it + * + * @return bool + */ + function send($method = NOTIFY_EMAIL, $break = false) + { + global $config, $user, $phpbb_dispatcher; + + // We add some standard variables we always use, no need to specify them always + $this->assign_vars(array( + 'U_BOARD' => generate_board_url(), + 'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), + 'SITENAME' => htmlspecialchars_decode($config['sitename']), + )); + + $subject = $this->subject; + $template = $this->template; + /** + * Event to modify the template before parsing + * + * @event core.modify_notification_template + * @var int method User notification method NOTIFY_EMAIL|NOTIFY_IM|NOTIFY_BOTH + * @var bool break Flag indicating if the function only formats the subject + * and the message without sending it + * @var string subject The message subject + * @var \phpbb\template\template template The (readonly) template object + * @since 3.2.4-RC1 + */ + $vars = array('method', 'break', 'subject', 'template'); + extract($phpbb_dispatcher->trigger_event('core.modify_notification_template', compact($vars))); + + // Parse message through template + $message = trim($this->template->assign_display('body')); + + /** + * Event to modify notification message text after parsing + * + * @event core.modify_notification_message + * @var int method User notification method NOTIFY_EMAIL|NOTIFY_IM|NOTIFY_BOTH + * @var bool break Flag indicating if the function only formats the subject + * and the message without sending it + * @var string subject The message subject + * @var string message The message text + * @since 3.1.11-RC1 + */ + $vars = array('method', 'break', 'subject', 'message'); + extract($phpbb_dispatcher->trigger_event('core.modify_notification_message', compact($vars))); + + $this->subject = $subject; + $this->msg = $message; + unset($subject, $message, $template); + + // Because we use \n for newlines in the body message we need to fix line encoding errors for those admins who uploaded email template files in the wrong encoding + $this->msg = str_replace("\r\n", "\n", $this->msg); + + // We now try and pull a subject from the email body ... if it exists, + // do this here because the subject may contain a variable + $drop_header = ''; + $match = array(); + if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match)) + { + $this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']); + $drop_header .= '[\r\n]*?' . preg_quote($match[1], '#'); + } + else + { + $this->subject = (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']); + } + + if (preg_match('#^(List-Unsubscribe:(.*?))$#m', $this->msg, $match)) + { + $this->extra_headers[] = $match[1]; + $drop_header .= '[\r\n]*?' . preg_quote($match[1], '#'); + } + + if ($drop_header) + { + $this->msg = trim(preg_replace('#' . $drop_header . '#s', '', $this->msg)); + } + + if ($break) + { + return true; + } + + switch ($method) + { + case NOTIFY_EMAIL: + $result = $this->msg_email(); + break; + + case NOTIFY_IM: + $result = $this->msg_jabber(); + break; + + case NOTIFY_BOTH: + $result = $this->msg_email(); + $this->msg_jabber(); + break; + } + + $this->reset(); + return $result; + } + + /** + * Add error message to log + */ + function error($type, $msg) + { + global $user, $config, $request, $phpbb_log; + + // Session doesn't exist, create it + if (!isset($user->session_id) || $user->session_id === '') + { + $user->session_begin(); + } + + $calling_page = htmlspecialchars_decode($request->server('PHP_SELF')); + + switch ($type) + { + case 'EMAIL': + $message = 'EMAIL/' . (($config['smtp_delivery']) ? 'SMTP' : 'PHP/mail()') . ''; + break; + + default: + $message = "$type"; + break; + } + + $message .= '
' . htmlspecialchars($calling_page) . '

' . $msg . '
'; + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_' . $type, false, array($message)); + } + + /** + * Save to queue + */ + function save_queue() + { + global $config; + + if ($config['email_package_size'] && $this->use_queue && !empty($this->queue)) + { + $this->queue->save(); + return; + } + } + + /** + * Generates a valid message id to be used in emails + * + * @return string message id + */ + function generate_message_id() + { + global $config, $request; + + $domain = ($config['server_name']) ?: $request->server('SERVER_NAME', 'phpbb.generated'); + + return md5(unique_id(time())) . '@' . $domain; + } + + /** + * Return email header + */ + function build_header($to, $cc, $bcc) + { + global $config, $phpbb_dispatcher; + + // We could use keys here, but we won't do this for 3.0.x to retain backwards compatibility + $headers = array(); + + $headers[] = 'From: ' . $this->from; + + if ($cc) + { + $headers[] = 'Cc: ' . $cc; + } + + if ($bcc) + { + $headers[] = 'Bcc: ' . $bcc; + } + + $headers[] = 'Reply-To: ' . $this->replyto; + $headers[] = 'Return-Path: <' . $config['board_email'] . '>'; + $headers[] = 'Sender: <' . $config['board_email'] . '>'; + $headers[] = 'MIME-Version: 1.0'; + $headers[] = 'Message-ID: <' . $this->generate_message_id() . '>'; + $headers[] = 'Date: ' . date('r', time()); + $headers[] = 'Content-Type: text/plain; charset=UTF-8'; // format=flowed + $headers[] = 'Content-Transfer-Encoding: 8bit'; // 7bit + + $headers[] = 'X-Priority: ' . $this->mail_priority; + $headers[] = 'X-MSMail-Priority: ' . (($this->mail_priority == MAIL_LOW_PRIORITY) ? 'Low' : (($this->mail_priority == MAIL_NORMAL_PRIORITY) ? 'Normal' : 'High')); + $headers[] = 'X-Mailer: phpBB3'; + $headers[] = 'X-MimeOLE: phpBB3'; + $headers[] = 'X-phpBB-Origin: phpbb://' . str_replace(array('http://', 'https://'), array('', ''), generate_board_url()); + + /** + * Event to modify email header entries + * + * @event core.modify_email_headers + * @var array headers Array containing email header entries + * @since 3.1.11-RC1 + */ + $vars = array('headers'); + extract($phpbb_dispatcher->trigger_event('core.modify_email_headers', compact($vars))); + + if (count($this->extra_headers)) + { + $headers = array_merge($headers, $this->extra_headers); + } + + return $headers; + } + + /** + * Send out emails + */ + function msg_email() + { + global $config, $phpbb_dispatcher; + + if (empty($config['email_enable'])) + { + return false; + } + + // Addresses to send to? + if (empty($this->addresses) || (empty($this->addresses['to']) && empty($this->addresses['cc']) && empty($this->addresses['bcc']))) + { + // Send was successful. ;) + return true; + } + + $use_queue = false; + if ($config['email_package_size'] && $this->use_queue) + { + if (empty($this->queue)) + { + $this->queue = new queue(); + $this->queue->init('email', $config['email_package_size']); + } + $use_queue = true; + } + + $contact_name = htmlspecialchars_decode($config['board_contact_name']); + $board_contact = (($contact_name !== '') ? '"' . mail_encode($contact_name) . '" ' : '') . '<' . $config['board_contact'] . '>'; + + $break = false; + $addresses = $this->addresses; + $subject = $this->subject; + $msg = $this->msg; + /** + * Event to send message via external transport + * + * @event core.notification_message_email + * @var bool break Flag indicating if the function return after hook + * @var array addresses The message recipients + * @var string subject The message subject + * @var string msg The message text + * @since 3.2.4-RC1 + */ + $vars = array( + 'break', + 'addresses', + 'subject', + 'msg', + ); + extract($phpbb_dispatcher->trigger_event('core.notification_message_email', compact($vars))); + + if ($break) + { + return true; + } + + if (empty($this->replyto)) + { + $this->replyto = $board_contact; + } + + if (empty($this->from)) + { + $this->from = $board_contact; + } + + $encode_eol = ($config['smtp_delivery']) ? "\r\n" : PHP_EOL; + + // Build to, cc and bcc strings + $to = $cc = $bcc = ''; + foreach ($this->addresses as $type => $address_ary) + { + if ($type == 'im') + { + continue; + } + + foreach ($address_ary as $which_ary) + { + ${$type} .= ((${$type} != '') ? ', ' : '') . (($which_ary['name'] != '') ? mail_encode($which_ary['name'], $encode_eol) . ' <' . $which_ary['email'] . '>' : $which_ary['email']); + } + } + + // Build header + $headers = $this->build_header($to, $cc, $bcc); + + // Send message ... + if (!$use_queue) + { + $mail_to = ($to == '') ? 'undisclosed-recipients:;' : $to; + $err_msg = ''; + + if ($config['smtp_delivery']) + { + $result = smtpmail($this->addresses, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $err_msg, $headers); + } + else + { + $result = phpbb_mail($mail_to, $this->subject, $this->msg, $headers, PHP_EOL, $err_msg); + } + + if (!$result) + { + $this->error('EMAIL', $err_msg); + return false; + } + } + else + { + $this->queue->put('email', array( + 'to' => $to, + 'addresses' => $this->addresses, + 'subject' => $this->subject, + 'msg' => $this->msg, + 'headers' => $headers) + ); + } + + return true; + } + + /** + * Send jabber message out + */ + function msg_jabber() + { + global $config, $user, $phpbb_root_path, $phpEx; + + if (empty($config['jab_enable']) || empty($config['jab_host']) || empty($config['jab_username']) || empty($config['jab_password'])) + { + return false; + } + + if (empty($this->addresses['im'])) + { + // Send was successful. ;) + return true; + } + + $use_queue = false; + if ($config['jab_package_size'] && $this->use_queue) + { + if (empty($this->queue)) + { + $this->queue = new queue(); + $this->queue->init('jabber', $config['jab_package_size']); + } + $use_queue = true; + } + + $addresses = array(); + foreach ($this->addresses['im'] as $type => $uid_ary) + { + $addresses[] = $uid_ary['uid']; + } + $addresses = array_unique($addresses); + + if (!$use_queue) + { + include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); + $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl'], $config['jab_verify_peer'], $config['jab_verify_peer_name'], $config['jab_allow_self_signed']); + + if (!$this->jabber->connect()) + { + $this->error('JABBER', $user->lang['ERR_JAB_CONNECT'] . '
' . $this->jabber->get_log()); + return false; + } + + if (!$this->jabber->login()) + { + $this->error('JABBER', $user->lang['ERR_JAB_AUTH'] . '
' . $this->jabber->get_log()); + return false; + } + + foreach ($addresses as $address) + { + $this->jabber->send_message($address, $this->msg, $this->subject); + } + + $this->jabber->disconnect(); + } + else + { + $this->queue->put('jabber', array( + 'addresses' => $addresses, + 'subject' => $this->subject, + 'msg' => $this->msg) + ); + } + unset($addresses); + return true; + } + + /** + * Setup template engine + */ + protected function setup_template() + { + global $phpbb_container, $phpbb_dispatcher; + + if ($this->template instanceof \phpbb\template\template) + { + return; + } + + $template_environment = new \phpbb\template\twig\environment( + $phpbb_container->get('config'), + $phpbb_container->get('filesystem'), + $phpbb_container->get('path_helper'), + $phpbb_container->getParameter('core.template.cache_path'), + $phpbb_container->get('ext.manager'), + new \phpbb\template\twig\loader( + $phpbb_container->get('filesystem') + ), + $phpbb_dispatcher, + array() + ); + $template_environment->setLexer($phpbb_container->get('template.twig.lexer')); + + $this->template = new \phpbb\template\twig\twig( + $phpbb_container->get('path_helper'), + $phpbb_container->get('config'), + new \phpbb\template\context(), + $template_environment, + $phpbb_container->getParameter('core.template.cache_path'), + $phpbb_container->get('user'), + $phpbb_container->get('template.twig.extensions.collection'), + $phpbb_container->get('ext.manager') + ); + } + + /** + * Set template paths to load + */ + protected function set_template_paths($path_name, $paths) + { + $this->setup_template(); + + $this->template->set_custom_style($path_name, $paths); + } +} + +/** +* handling email and jabber queue +*/ +class queue +{ + var $data = array(); + var $queue_data = array(); + var $package_size = 0; + var $cache_file = ''; + var $eol = "\n"; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * constructor + */ + function __construct() + { + global $phpEx, $phpbb_root_path, $phpbb_filesystem, $phpbb_container; + + $this->data = array(); + $this->cache_file = $phpbb_container->getParameter('core.cache_dir') . "queue.$phpEx"; + $this->filesystem = $phpbb_filesystem; + } + + /** + * Init a queue object + */ + function init($object, $package_size) + { + $this->data[$object] = array(); + $this->data[$object]['package_size'] = $package_size; + $this->data[$object]['data'] = array(); + } + + /** + * Put object in queue + */ + function put($object, $scope) + { + $this->data[$object]['data'][] = $scope; + } + + /** + * Process queue + * Using lock file + */ + function process() + { + global $config, $phpEx, $phpbb_root_path, $user, $phpbb_dispatcher; + + $lock = new \phpbb\lock\flock($this->cache_file); + $lock->acquire(); + + // avoid races, check file existence once + $have_cache_file = file_exists($this->cache_file); + if (!$have_cache_file || $config['last_queue_run'] > time() - $config['queue_interval']) + { + if (!$have_cache_file) + { + $config->set('last_queue_run', time(), false); + } + + $lock->release(); + return; + } + + $config->set('last_queue_run', time(), false); + + include($this->cache_file); + + foreach ($this->queue_data as $object => $data_ary) + { + @set_time_limit(0); + + if (!isset($data_ary['package_size'])) + { + $data_ary['package_size'] = 0; + } + + $package_size = $data_ary['package_size']; + $num_items = (!$package_size || count($data_ary['data']) < $package_size) ? count($data_ary['data']) : $package_size; + + /* + * This code is commented out because it causes problems on some web hosts. + * The core problem is rather restrictive email sending limits. + * This code is nly useful if you have no such restrictions from the + * web host and the package size setting is wrong. + + // If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs... + if (count($data_ary['data']) > $package_size * 2.5) + { + $num_items = count($data_ary['data']); + } + */ + + switch ($object) + { + case 'email': + // Delete the email queued objects if mailing is disabled + if (!$config['email_enable']) + { + unset($this->queue_data['email']); + continue 2; + } + break; + + case 'jabber': + if (!$config['jab_enable']) + { + unset($this->queue_data['jabber']); + continue 2; + } + + include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); + $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl'], $config['jab_verify_peer'], $config['jab_verify_peer_name'], $config['jab_allow_self_signed']); + + if (!$this->jabber->connect()) + { + $messenger = new messenger(); + $messenger->error('JABBER', $user->lang['ERR_JAB_CONNECT']); + continue 2; + } + + if (!$this->jabber->login()) + { + $messenger = new messenger(); + $messenger->error('JABBER', $user->lang['ERR_JAB_AUTH']); + continue 2; + } + + break; + + default: + $lock->release(); + return; + } + + for ($i = 0; $i < $num_items; $i++) + { + // Make variables available... + extract(array_shift($this->queue_data[$object]['data'])); + + switch ($object) + { + case 'email': + $break = false; + /** + * Event to send message via external transport + * + * @event core.notification_message_process + * @var bool break Flag indicating if the function return after hook + * @var array addresses The message recipients + * @var string subject The message subject + * @var string msg The message text + * @since 3.2.4-RC1 + */ + $vars = array( + 'break', + 'addresses', + 'subject', + 'msg', + ); + extract($phpbb_dispatcher->trigger_event('core.notification_message_process', compact($vars))); + + if (!$break) + { + $err_msg = ''; + $to = (!$to) ? 'undisclosed-recipients:;' : $to; + + if ($config['smtp_delivery']) + { + $result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers); + } + else + { + $result = phpbb_mail($to, $subject, $msg, $headers, PHP_EOL, $err_msg); + } + + if (!$result) + { + $messenger = new messenger(); + $messenger->error('EMAIL', $err_msg); + continue 2; + } + } + break; + + case 'jabber': + foreach ($addresses as $address) + { + if ($this->jabber->send_message($address, $msg, $subject) === false) + { + $messenger = new messenger(); + $messenger->error('JABBER', $this->jabber->get_log()); + continue 3; + } + } + break; + } + } + + // No more data for this object? Unset it + if (!count($this->queue_data[$object]['data'])) + { + unset($this->queue_data[$object]); + } + + // Post-object processing + switch ($object) + { + case 'jabber': + // Hang about a couple of secs to ensure the messages are + // handled, then disconnect + $this->jabber->disconnect(); + break; + } + } + + if (!count($this->queue_data)) + { + @unlink($this->cache_file); + } + else + { + if ($fp = @fopen($this->cache_file, 'wb')) + { + fwrite($fp, "queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>"); + fclose($fp); + + if (function_exists('opcache_invalidate')) + { + @opcache_invalidate($this->cache_file); + } + + try + { + $this->filesystem->phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + + $lock->release(); + } + + /** + * Save queue + */ + function save() + { + if (!count($this->data)) + { + return; + } + + $lock = new \phpbb\lock\flock($this->cache_file); + $lock->acquire(); + + if (file_exists($this->cache_file)) + { + include($this->cache_file); + + foreach ($this->queue_data as $object => $data_ary) + { + if (isset($this->data[$object]) && count($this->data[$object])) + { + $this->data[$object]['data'] = array_merge($data_ary['data'], $this->data[$object]['data']); + } + else + { + $this->data[$object]['data'] = $data_ary['data']; + } + } + } + + if ($fp = @fopen($this->cache_file, 'w')) + { + fwrite($fp, "queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>"); + fclose($fp); + + if (function_exists('opcache_invalidate')) + { + @opcache_invalidate($this->cache_file); + } + + try + { + $this->filesystem->phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + + $this->data = array(); + } + + $lock->release(); + } +} + +/** +* Replacement or substitute for PHP's mail command +*/ +function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) +{ + global $config, $user; + + // Fix any bare linefeeds in the message to make it RFC821 Compliant. + $message = preg_replace("#(?lang['NO_EMAIL_SUBJECT'])) ? $user->lang['NO_EMAIL_SUBJECT'] : 'No email subject specified'; + return false; + } + + if (trim($message) == '') + { + $err_msg = (isset($user->lang['NO_EMAIL_MESSAGE'])) ? $user->lang['NO_EMAIL_MESSAGE'] : 'Email message was blank'; + return false; + } + + $mail_rcpt = $mail_to = $mail_cc = array(); + + // Build correct addresses for RCPT TO command and the client side display (TO, CC) + if (isset($addresses['to']) && count($addresses['to'])) + { + foreach ($addresses['to'] as $which_ary) + { + $mail_to[] = ($which_ary['name'] != '') ? mail_encode(trim($which_ary['name'])) . ' <' . trim($which_ary['email']) . '>' : '<' . trim($which_ary['email']) . '>'; + $mail_rcpt['to'][] = '<' . trim($which_ary['email']) . '>'; + } + } + + if (isset($addresses['bcc']) && count($addresses['bcc'])) + { + foreach ($addresses['bcc'] as $which_ary) + { + $mail_rcpt['bcc'][] = '<' . trim($which_ary['email']) . '>'; + } + } + + if (isset($addresses['cc']) && count($addresses['cc'])) + { + foreach ($addresses['cc'] as $which_ary) + { + $mail_cc[] = ($which_ary['name'] != '') ? mail_encode(trim($which_ary['name'])) . ' <' . trim($which_ary['email']) . '>' : '<' . trim($which_ary['email']) . '>'; + $mail_rcpt['cc'][] = '<' . trim($which_ary['email']) . '>'; + } + } + + $smtp = new smtp_class(); + + $errno = 0; + $errstr = ''; + + $smtp->add_backtrace('Connecting to ' . $config['smtp_host'] . ':' . $config['smtp_port']); + + // Ok we have error checked as much as we can to this point let's get on it already. + if (!class_exists('\phpbb\error_collector')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/error_collector.' . $phpEx); + } + $collector = new \phpbb\error_collector; + $collector->install(); + + $options = array(); + $verify_peer = (bool) $config['smtp_verify_peer']; + $verify_peer_name = (bool) $config['smtp_verify_peer_name']; + $allow_self_signed = (bool) $config['smtp_allow_self_signed']; + $remote_socket = $config['smtp_host'] . ':' . $config['smtp_port']; + + // Set ssl context options, see http://php.net/manual/en/context.ssl.php + $options['ssl'] = array('verify_peer' => $verify_peer, 'verify_peer_name' => $verify_peer_name, 'allow_self_signed' => $allow_self_signed); + $socket_context = stream_context_create($options); + + $smtp->socket = @stream_socket_client($remote_socket, $errno, $errstr, 20, STREAM_CLIENT_CONNECT, $socket_context); + $collector->uninstall(); + $error_contents = $collector->format_errors(); + + if (!$smtp->socket) + { + if ($errstr) + { + $errstr = utf8_convert_message($errstr); + } + + $err_msg = (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; + $err_msg .= ($error_contents) ? '

' . htmlspecialchars($error_contents) : ''; + return false; + } + + // Wait for reply + if ($err_msg = $smtp->server_parse('220', __LINE__)) + { + $smtp->close_session($err_msg); + return false; + } + + // Let me in. This function handles the complete authentication process + if ($err_msg = $smtp->log_into_server($config['smtp_host'], $config['smtp_username'], htmlspecialchars_decode($config['smtp_password']), $config['smtp_auth_method'])) + { + $smtp->close_session($err_msg); + return false; + } + + // From this point onward most server response codes should be 250 + // Specify who the mail is from.... + $smtp->server_send('MAIL FROM:<' . $config['board_email'] . '>'); + if ($err_msg = $smtp->server_parse('250', __LINE__)) + { + $smtp->close_session($err_msg); + return false; + } + + // Specify each user to send to and build to header. + $to_header = implode(', ', $mail_to); + $cc_header = implode(', ', $mail_cc); + + // Now tell the MTA to send the Message to the following people... [TO, BCC, CC] + $rcpt = false; + foreach ($mail_rcpt as $type => $mail_to_addresses) + { + foreach ($mail_to_addresses as $mail_to_address) + { + // Add an additional bit of error checking to the To field. + if (preg_match('#[^ ]+\@[^ ]+#', $mail_to_address)) + { + $smtp->server_send("RCPT TO:$mail_to_address"); + if ($err_msg = $smtp->server_parse('250', __LINE__)) + { + // We continue... if users are not resolved we do not care + if ($smtp->numeric_response_code != 550) + { + $smtp->close_session($err_msg); + return false; + } + } + else + { + $rcpt = true; + } + } + } + } + + // We try to send messages even if a few people do not seem to have valid email addresses, but if no one has, we have to exit here. + if (!$rcpt) + { + $user->session_begin(); + $err_msg .= '

'; + $err_msg .= (isset($user->lang['INVALID_EMAIL_LOG'])) ? sprintf($user->lang['INVALID_EMAIL_LOG'], htmlspecialchars($mail_to_address)) : '' . htmlspecialchars($mail_to_address) . ' possibly an invalid email address?'; + $smtp->close_session($err_msg); + return false; + } + + // Ok now we tell the server we are ready to start sending data + $smtp->server_send('DATA'); + + // This is the last response code we look for until the end of the message. + if ($err_msg = $smtp->server_parse('354', __LINE__)) + { + $smtp->close_session($err_msg); + return false; + } + + // Send the Subject Line... + $smtp->server_send("Subject: $subject"); + + // Now the To Header. + $to_header = ($to_header == '') ? 'undisclosed-recipients:;' : $to_header; + $smtp->server_send("To: $to_header"); + + // Now the CC Header. + if ($cc_header != '') + { + $smtp->server_send("CC: $cc_header"); + } + + // Now any custom headers.... + if ($headers !== false) + { + $smtp->server_send("$headers\r\n"); + } + + // Ok now we are ready for the message... + $smtp->server_send($message); + + // Ok the all the ingredients are mixed in let's cook this puppy... + $smtp->server_send('.'); + if ($err_msg = $smtp->server_parse('250', __LINE__)) + { + $smtp->close_session($err_msg); + return false; + } + + // Now tell the server we are done and close the socket... + $smtp->server_send('QUIT'); + $smtp->close_session($err_msg); + + return true; +} + +/** +* SMTP Class +* Auth Mechanisms originally taken from the AUTH Modules found within the PHP Extension and Application Repository (PEAR) +* See docs/AUTHORS for more details +*/ +class smtp_class +{ + var $server_response = ''; + var $socket = 0; + protected $socket_tls = false; + var $responses = array(); + var $commands = array(); + var $numeric_response_code = 0; + + var $backtrace = false; + var $backtrace_log = array(); + + function __construct() + { + // Always create a backtrace for admins to identify SMTP problems + $this->backtrace = true; + $this->backtrace_log = array(); + } + + /** + * Add backtrace message for debugging + */ + function add_backtrace($message) + { + if ($this->backtrace) + { + $this->backtrace_log[] = utf8_htmlspecialchars($message); + } + } + + /** + * Send command to smtp server + */ + function server_send($command, $private_info = false) + { + fputs($this->socket, $command . "\r\n"); + + (!$private_info) ? $this->add_backtrace("# $command") : $this->add_backtrace('# Omitting sensitive information'); + + // We could put additional code here + } + + /** + * We use the line to give the support people an indication at which command the error occurred + */ + function server_parse($response, $line) + { + global $user; + + $this->server_response = ''; + $this->responses = array(); + $this->numeric_response_code = 0; + + while (substr($this->server_response, 3, 1) != ' ') + { + if (!($this->server_response = fgets($this->socket, 256))) + { + return (isset($user->lang['NO_EMAIL_RESPONSE_CODE'])) ? $user->lang['NO_EMAIL_RESPONSE_CODE'] : 'Could not get mail server response codes'; + } + $this->responses[] = substr(rtrim($this->server_response), 4); + $this->numeric_response_code = (int) substr($this->server_response, 0, 3); + + $this->add_backtrace("LINE: $line <- {$this->server_response}"); + } + + if (!(substr($this->server_response, 0, 3) == $response)) + { + $this->numeric_response_code = (int) substr($this->server_response, 0, 3); + return (isset($user->lang['EMAIL_SMTP_ERROR_RESPONSE'])) ? sprintf($user->lang['EMAIL_SMTP_ERROR_RESPONSE'], $line, $this->server_response) : "Ran into problems sending Mail at Line $line. Response: $this->server_response"; + } + + return 0; + } + + /** + * Close session + */ + function close_session(&$err_msg) + { + fclose($this->socket); + + if ($this->backtrace) + { + $message = '

Backtrace

' . implode('
', $this->backtrace_log) . '

'; + $err_msg .= $message; + } + } + + /** + * Log into server and get possible auth codes if neccessary + */ + function log_into_server($hostname, $username, $password, $default_auth_method) + { + global $user; + + // Here we try to determine the *real* hostname (reverse DNS entry preferrably) + $local_host = $user->host; + + if (function_exists('php_uname')) + { + $local_host = php_uname('n'); + + // Able to resolve name to IP + if (($addr = @gethostbyname($local_host)) !== $local_host) + { + // Able to resolve IP back to name + if (($name = @gethostbyaddr($addr)) !== $addr) + { + $local_host = $name; + } + } + } + + // If we are authenticating through pop-before-smtp, we + // have to login ones before we get authenticated + // NOTE: on some configurations the time between an update of the auth database takes so + // long that the first email send does not work. This is not a biggie on a live board (only + // the install mail will most likely fail) - but on a dynamic ip connection this might produce + // severe problems and is not fixable! + if ($default_auth_method == 'POP-BEFORE-SMTP' && $username && $password) + { + global $config; + + $errno = 0; + $errstr = ''; + + $this->server_send("QUIT"); + fclose($this->socket); + + $this->pop_before_smtp($hostname, $username, $password); + $username = $password = $default_auth_method = ''; + + // We need to close the previous session, else the server is not + // able to get our ip for matching... + if (!$this->socket = @fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 10)) + { + if ($errstr) + { + $errstr = utf8_convert_message($errstr); + } + + $err_msg = (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; + return $err_msg; + } + + // Wait for reply + if ($err_msg = $this->server_parse('220', __LINE__)) + { + $this->close_session($err_msg); + return $err_msg; + } + } + + $hello_result = $this->hello($local_host); + if (!is_null($hello_result)) + { + return $hello_result; + } + + // SMTP STARTTLS (RFC 3207) + if (!$this->socket_tls) + { + $this->socket_tls = $this->starttls(); + + if ($this->socket_tls) + { + // Switched to TLS + // RFC 3207: "The client MUST discard any knowledge obtained from the server, [...]" + // So say hello again + $hello_result = $this->hello($local_host); + + if (!is_null($hello_result)) + { + return $hello_result; + } + } + } + + // If we are not authenticated yet, something might be wrong if no username and passwd passed + if (!$username || !$password) + { + return false; + } + + if (!isset($this->commands['AUTH'])) + { + return (isset($user->lang['SMTP_NO_AUTH_SUPPORT'])) ? $user->lang['SMTP_NO_AUTH_SUPPORT'] : 'SMTP server does not support authentication'; + } + + // Get best authentication method + $available_methods = explode(' ', $this->commands['AUTH']); + + // Define the auth ordering if the default auth method was not found + $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5'); + $method = ''; + + if (in_array($default_auth_method, $available_methods)) + { + $method = $default_auth_method; + } + else + { + foreach ($auth_methods as $_method) + { + if (in_array($_method, $available_methods)) + { + $method = $_method; + break; + } + } + } + + if (!$method) + { + return (isset($user->lang['NO_SUPPORTED_AUTH_METHODS'])) ? $user->lang['NO_SUPPORTED_AUTH_METHODS'] : 'No supported authentication methods'; + } + + $method = strtolower(str_replace('-', '_', $method)); + return $this->$method($username, $password); + } + + /** + * SMTP EHLO/HELO + * + * @return mixed Null if the authentication process is supposed to continue + * False if already authenticated + * Error message (string) otherwise + */ + protected function hello($hostname) + { + // Try EHLO first + $this->server_send("EHLO $hostname"); + if ($err_msg = $this->server_parse('250', __LINE__)) + { + // a 503 response code means that we're already authenticated + if ($this->numeric_response_code == 503) + { + return false; + } + + // If EHLO fails, we try HELO + $this->server_send("HELO $hostname"); + if ($err_msg = $this->server_parse('250', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + } + + foreach ($this->responses as $response) + { + $response = explode(' ', $response); + $response_code = $response[0]; + unset($response[0]); + $this->commands[$response_code] = implode(' ', $response); + } + } + + /** + * SMTP STARTTLS (RFC 3207) + * + * @return bool Returns true if TLS was started + * Otherwise false + */ + protected function starttls() + { + global $config; + + // allow SMTPS (what was used by phpBB 3.0) if hostname is prefixed with tls:// or ssl:// + if (strpos($config['smtp_host'], 'tls://') === 0 || strpos($config['smtp_host'], 'ssl://') === 0) + { + return true; + } + + if (!function_exists('stream_socket_enable_crypto')) + { + return false; + } + + if (!isset($this->commands['STARTTLS'])) + { + return false; + } + + $this->server_send('STARTTLS'); + + if ($err_msg = $this->server_parse('220', __LINE__)) + { + return false; + } + + $result = false; + $stream_meta = stream_get_meta_data($this->socket); + + if (socket_set_blocking($this->socket, 1)) + { + // https://secure.php.net/manual/en/function.stream-socket-enable-crypto.php#119122 + $crypto = (phpbb_version_compare(PHP_VERSION, '5.6.7', '<')) ? STREAM_CRYPTO_METHOD_TLS_CLIENT : STREAM_CRYPTO_METHOD_SSLv23_CLIENT; + $result = stream_socket_enable_crypto($this->socket, true, $crypto); + socket_set_blocking($this->socket, (int) $stream_meta['blocked']); + } + + return $result; + } + + /** + * Pop before smtp authentication + */ + function pop_before_smtp($hostname, $username, $password) + { + global $user; + + if (!$this->socket = @fsockopen($hostname, 110, $errno, $errstr, 10)) + { + if ($errstr) + { + $errstr = utf8_convert_message($errstr); + } + + return (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; + } + + $this->server_send("USER $username", true); + if ($err_msg = $this->server_parse('+OK', __LINE__)) + { + return $err_msg; + } + + $this->server_send("PASS $password", true); + if ($err_msg = $this->server_parse('+OK', __LINE__)) + { + return $err_msg; + } + + $this->server_send('QUIT'); + fclose($this->socket); + + return false; + } + + /** + * Plain authentication method + */ + function plain($username, $password) + { + $this->server_send('AUTH PLAIN'); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + + $base64_method_plain = base64_encode("\0" . $username . "\0" . $password); + $this->server_send($base64_method_plain, true); + if ($err_msg = $this->server_parse('235', __LINE__)) + { + return $err_msg; + } + + return false; + } + + /** + * Login authentication method + */ + function login($username, $password) + { + $this->server_send('AUTH LOGIN'); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + + $this->server_send(base64_encode($username), true); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return $err_msg; + } + + $this->server_send(base64_encode($password), true); + if ($err_msg = $this->server_parse('235', __LINE__)) + { + return $err_msg; + } + + return false; + } + + /** + * cram_md5 authentication method + */ + function cram_md5($username, $password) + { + $this->server_send('AUTH CRAM-MD5'); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + + $md5_challenge = base64_decode($this->responses[0]); + $password = (strlen($password) > 64) ? pack('H32', md5($password)) : ((strlen($password) < 64) ? str_pad($password, 64, chr(0)) : $password); + $md5_digest = md5((substr($password, 0, 64) ^ str_repeat(chr(0x5C), 64)) . (pack('H32', md5((substr($password, 0, 64) ^ str_repeat(chr(0x36), 64)) . $md5_challenge)))); + + $base64_method_cram_md5 = base64_encode($username . ' ' . $md5_digest); + + $this->server_send($base64_method_cram_md5, true); + if ($err_msg = $this->server_parse('235', __LINE__)) + { + return $err_msg; + } + + return false; + } + + /** + * digest_md5 authentication method + * A real pain in the *** + */ + function digest_md5($username, $password) + { + global $config, $user; + + $this->server_send('AUTH DIGEST-MD5'); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + + $md5_challenge = base64_decode($this->responses[0]); + + // Parse the md5 challenge - from AUTH_SASL (PEAR) + $tokens = array(); + while (preg_match('/^([a-z-]+)=("[^"]+(?host; + } + + // Maxbuf + if (empty($tokens['maxbuf'])) + { + $tokens['maxbuf'] = 65536; + } + + // Required: nonce, algorithm + if (empty($tokens['nonce']) || empty($tokens['algorithm'])) + { + $tokens = array(); + } + $md5_challenge = $tokens; + + if (!empty($md5_challenge)) + { + $str = ''; + for ($i = 0; $i < 32; $i++) + { + $str .= chr(mt_rand(0, 255)); + } + $cnonce = base64_encode($str); + + $digest_uri = 'smtp/' . $config['smtp_host']; + + $auth_1 = sprintf('%s:%s:%s', pack('H32', md5(sprintf('%s:%s:%s', $username, $md5_challenge['realm'], $password))), $md5_challenge['nonce'], $cnonce); + $auth_2 = 'AUTHENTICATE:' . $digest_uri; + $response_value = md5(sprintf('%s:%s:00000001:%s:auth:%s', md5($auth_1), $md5_challenge['nonce'], $cnonce, md5($auth_2))); + + $input_string = sprintf('username="%s",realm="%s",nonce="%s",cnonce="%s",nc="00000001",qop=auth,digest-uri="%s",response=%s,%d', $username, $md5_challenge['realm'], $md5_challenge['nonce'], $cnonce, $digest_uri, $response_value, $md5_challenge['maxbuf']); + } + else + { + return (isset($user->lang['INVALID_DIGEST_CHALLENGE'])) ? $user->lang['INVALID_DIGEST_CHALLENGE'] : 'Invalid digest challenge'; + } + + $base64_method_digest_md5 = base64_encode($input_string); + $this->server_send($base64_method_digest_md5, true); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return $err_msg; + } + + $this->server_send(' '); + if ($err_msg = $this->server_parse('235', __LINE__)) + { + return $err_msg; + } + + return false; + } +} + +/** +* Encodes the given string for proper display in UTF-8. +* +* This version is using base64 encoded data. The downside of this +* is if the mail client does not understand this encoding the user +* is basically doomed with an unreadable subject. +* +* Please note that this version fully supports RFC 2045 section 6.8. +* +* @param string $eol End of line we are using (optional to be backwards compatible) +*/ +function mail_encode($str, $eol = "\r\n") +{ + // define start delimimter, end delimiter and spacer + $start = "=?UTF-8?B?"; + $end = "?="; + $delimiter = "$eol "; + + // Maximum length is 75. $split_length *must* be a multiple of 4, but <= 75 - strlen($start . $delimiter . $end)!!! + $split_length = 60; + $encoded_str = base64_encode($str); + + // If encoded string meets the limits, we just return with the correct data. + if (strlen($encoded_str) <= $split_length) + { + return $start . $encoded_str . $end; + } + + // If there is only ASCII data, we just return what we want, correctly splitting the lines. + if (strlen($str) === utf8_strlen($str)) + { + return $start . implode($end . $delimiter . $start, str_split($encoded_str, $split_length)) . $end; + } + + // UTF-8 data, compose encoded lines + $array = utf8_str_split($str); + $str = ''; + + while (count($array)) + { + $text = ''; + + while (count($array) && intval((strlen($text . $array[0]) + 2) / 3) << 2 <= $split_length) + { + $text .= array_shift($array); + } + + $str .= $start . base64_encode($text) . $end . $delimiter; + } + + return substr($str, 0, -strlen($delimiter)); +} + +/** + * Wrapper for sending out emails with the PHP's mail function + */ +function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) +{ + global $config, $phpbb_root_path, $phpEx; + + // Convert Numeric Character References to UTF-8 chars (ie. Emojis) + $subject = utf8_decode_ncr($subject); + $msg = utf8_decode_ncr($msg); + + /** + * We use the EOL character for the OS here because the PHP mail function does not correctly transform line endings. + * On Windows SMTP is used (SMTP is \r\n), on UNIX a command is used... + * Reference: http://bugs.php.net/bug.php?id=15841 + */ + $headers = implode($eol, $headers); + + if (!class_exists('\phpbb\error_collector')) + { + include($phpbb_root_path . 'includes/error_collector.' . $phpEx); + } + + $collector = new \phpbb\error_collector; + $collector->install(); + + /** + * On some PHP Versions mail() *may* fail if there are newlines within the subject. + * Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8. + * Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space + * (Use '' as parameter to mail_encode() results in SPACE used) + */ + $additional_parameters = $config['email_force_sender'] ? '-f' . $config['board_email'] : ''; + + $result = mail($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, $additional_parameters); + + $collector->uninstall(); + $err_msg = $collector->format_errors(); + + return $result; +} diff --git a/install/update/new/includes/functions_module.php b/install/update/new/includes/functions_module.php new file mode 100644 index 0000000..e90c11f --- /dev/null +++ b/install/update/new/includes/functions_module.php @@ -0,0 +1,1153 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Class handling all types of 'plugins' (a future term) +*/ +class p_master +{ + var $p_id; + var $p_class; + var $p_name; + var $p_mode; + var $p_parent; + + var $include_path = false; + var $active_module = false; + var $active_module_row_id = false; + var $acl_forum_id = false; + var $module_ary = array(); + + /** + * Constuctor + * Set module include path + */ + function __construct($include_path = false) + { + global $phpbb_root_path; + + $this->include_path = ($include_path !== false) ? $include_path : $phpbb_root_path . 'includes/'; + + // Make sure the path ends with / + if (substr($this->include_path, -1) !== '/') + { + $this->include_path .= '/'; + } + } + + /** + * Set custom include path for modules + * Schema for inclusion is include_path . modulebase + * + * @param string $include_path include path to be used. + * @access public + */ + function set_custom_include_path($include_path) + { + $this->include_path = $include_path; + + // Make sure the path ends with / + if (substr($this->include_path, -1) !== '/') + { + $this->include_path .= '/'; + } + } + + /** + * List modules + * + * This creates a list, stored in $this->module_ary of all available + * modules for the given class (ucp, mcp and acp). Additionally + * $this->module_y_ary is created with indentation information for + * displaying the module list appropriately. Only modules for which + * the user has access rights are included in these lists. + */ + function list_modules($p_class) + { + global $db, $user, $cache; + global $phpbb_dispatcher; + + // Sanitise for future path use, it's escaped as appropriate for queries + $this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class)); + + // Get cached modules + if (($this->module_cache = $cache->get('_modules_' . $this->p_class)) === false) + { + // Get modules + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_class = '" . $db->sql_escape($this->p_class) . "' + ORDER BY left_id ASC"; + $result = $db->sql_query($sql); + + $rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rows[$row['module_id']] = $row; + } + $db->sql_freeresult($result); + + $this->module_cache = array(); + foreach ($rows as $module_id => $row) + { + $this->module_cache['modules'][] = $row; + $this->module_cache['parents'][$row['module_id']] = $this->get_parents($row['parent_id'], $row['left_id'], $row['right_id'], $rows); + } + unset($rows); + + $cache->put('_modules_' . $this->p_class, $this->module_cache); + } + + if (empty($this->module_cache)) + { + $this->module_cache = array('modules' => array(), 'parents' => array()); + } + + // We "could" build a true tree with this function - maybe mod authors want to use this... + // Functions for traversing and manipulating the tree are not available though + // We might re-structure the module system to use true trees in 4.0 + // $tree = $this->build_tree($this->module_cache['modules'], $this->module_cache['parents']); + + // Clean up module cache array to only let survive modules the user can access + $right_id = false; + + $hide_categories = array(); + foreach ($this->module_cache['modules'] as $key => $row) + { + // When the module has no mode (category) we check whether it has visible children + // before listing it as well. + if (!$row['module_mode']) + { + $hide_categories[(int) $row['module_id']] = $key; + } + + // Not allowed to view module? + if (!$this->module_auth_self($row['module_auth'])) + { + unset($this->module_cache['modules'][$key]); + continue; + } + + // Category with no members, ignore + if (!$row['module_basename'] && ($row['left_id'] + 1 == $row['right_id'])) + { + unset($this->module_cache['modules'][$key]); + continue; + } + + // Skip branch + if ($right_id !== false) + { + if ($row['left_id'] < $right_id) + { + unset($this->module_cache['modules'][$key]); + continue; + } + + $right_id = false; + } + + // Not enabled? + if (!$row['module_enabled']) + { + // If category is disabled then disable every child too + unset($this->module_cache['modules'][$key]); + $right_id = $row['right_id']; + continue; + } + + if ($row['module_mode']) + { + // The parent category has a visible child + // So remove it and all its parents from the hide array + unset($hide_categories[(int) $row['parent_id']]); + foreach ($this->module_cache['parents'][$row['module_id']] as $module_id => $row_id) + { + unset($hide_categories[$module_id]); + } + } + } + + foreach ($hide_categories as $module_id => $row_id) + { + unset($this->module_cache['modules'][$row_id]); + } + + // Re-index (this is needed, else we are not able to array_slice later) + $this->module_cache['modules'] = array_merge($this->module_cache['modules']); + + // Include MOD _info files for populating language entries within the menus + $this->add_mod_info($this->p_class); + + // Now build the module array, but exclude completely empty categories... + $right_id = false; + $names = array(); + + foreach ($this->module_cache['modules'] as $key => $row) + { + // Skip branch + if ($right_id !== false) + { + if ($row['left_id'] < $right_id) + { + continue; + } + + $right_id = false; + } + + // Category with no members on their way down (we have to check every level) + if (!$row['module_basename']) + { + $empty_category = true; + + // We go through the branch and look for an activated module + foreach (array_slice($this->module_cache['modules'], $key + 1) as $temp_row) + { + if ($temp_row['left_id'] > $row['left_id'] && $temp_row['left_id'] < $row['right_id']) + { + // Module there + if ($temp_row['module_basename'] && $temp_row['module_enabled']) + { + $empty_category = false; + break; + } + continue; + } + break; + } + + // Skip the branch + if ($empty_category) + { + $right_id = $row['right_id']; + continue; + } + } + + $depth = count($this->module_cache['parents'][$row['module_id']]); + + // We need to prefix the functions to not create a naming conflict + + // Function for building 'url_extra' + $short_name = $this->get_short_name($row['module_basename']); + + $url_func = 'phpbb_module_' . $short_name . '_url'; + if (!function_exists($url_func)) + { + $url_func = '_module_' . $short_name . '_url'; + } + + // Function for building the language name + $lang_func = 'phpbb_module_' . $short_name . '_lang'; + if (!function_exists($lang_func)) + { + $lang_func = '_module_' . $short_name . '_lang'; + } + + // Custom function for calling parameters on module init (for example assigning template variables) + $custom_func = 'phpbb_module_' . $short_name; + if (!function_exists($custom_func)) + { + $custom_func = '_module_' . $short_name; + } + + $names[$row['module_basename'] . '_' . $row['module_mode']][] = true; + + $module_row = array( + 'depth' => $depth, + + 'id' => (int) $row['module_id'], + 'parent' => (int) $row['parent_id'], + 'cat' => ($row['right_id'] > $row['left_id'] + 1) ? true : false, + + 'is_duplicate' => ($row['module_basename'] && count($names[$row['module_basename'] . '_' . $row['module_mode']]) > 1) ? true : false, + + 'name' => (string) $row['module_basename'], + 'mode' => (string) $row['module_mode'], + 'display' => (int) $row['module_display'], + + 'url_extra' => (function_exists($url_func)) ? $url_func($row['module_mode'], $row) : '', + + 'lang' => ($row['module_basename'] && function_exists($lang_func)) ? $lang_func($row['module_mode'], $row['module_langname']) : ((!empty($user->lang[$row['module_langname']])) ? $user->lang[$row['module_langname']] : $row['module_langname']), + 'langname' => $row['module_langname'], + + 'left' => $row['left_id'], + 'right' => $row['right_id'], + ); + + if (function_exists($custom_func)) + { + $custom_func($row['module_mode'], $module_row); + } + + /** + * This event allows to modify parameters for building modules list + * + * @event core.modify_module_row + * @var string url_func Function for building 'url_extra' + * @var string lang_func Function for building the language name + * @var string custom_func Custom function for calling parameters on module init + * @var array row Array holding the basic module data + * @var array module_row Array holding the module display parameters + * @since 3.1.0-b3 + */ + $vars = array('url_func', 'lang_func', 'custom_func', 'row', 'module_row'); + extract($phpbb_dispatcher->trigger_event('core.modify_module_row', compact($vars))); + + $this->module_ary[] = $module_row; + } + + unset($this->module_cache['modules'], $names); + } + + /** + * Check if a certain main module is accessible/loaded + * By giving the module mode you are able to additionally check for only one mode within the main module + * + * @param string $module_basename The module base name, for example logs, reports, main (for the mcp). + * @param mixed $module_mode The module mode to check. If provided the mode will be checked in addition for presence. + * + * @return bool Returns true if module is loaded and accessible, else returns false + */ + function loaded($module_basename, $module_mode = false) + { + if (!$this->is_full_class($module_basename)) + { + $module_basename = $this->p_class . '_' . $module_basename; + } + + if (empty($this->loaded_cache)) + { + $this->loaded_cache = array(); + + foreach ($this->module_ary as $row) + { + if (!$row['name']) + { + continue; + } + + if (!isset($this->loaded_cache[$row['name']])) + { + $this->loaded_cache[$row['name']] = array(); + } + + if (!$row['mode']) + { + continue; + } + + $this->loaded_cache[$row['name']][$row['mode']] = true; + } + } + + if ($module_mode === false) + { + return (isset($this->loaded_cache[$module_basename])) ? true : false; + } + + return (!empty($this->loaded_cache[$module_basename][$module_mode])) ? true : false; + } + + /** + * Check module authorisation. + * + * This is a non-static version that uses $this->acl_forum_id + * for the forum id. + */ + function module_auth_self($module_auth) + { + return self::module_auth($module_auth, $this->acl_forum_id); + } + + /** + * Check module authorisation. + * + * This is a static version, it must be given $forum_id. + * See also module_auth_self. + */ + static function module_auth($module_auth, $forum_id) + { + global $auth, $config; + global $request, $phpbb_extension_manager, $phpbb_dispatcher; + + $module_auth = trim($module_auth); + + // Generally allowed to access module if module_auth is empty + if (!$module_auth) + { + return true; + } + + // With the code below we make sure only those elements get eval'd we really want to be checked + preg_match_all('/(?: + "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | + \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | + [(),] | + [^\s(),]+)/x', $module_auth, $match); + + // Valid tokens for auth and their replacements + $valid_tokens = array( + 'acl_([a-z0-9_]+)(,\$id)?' => '(int) $auth->acl_get(\'\\1\'\\2)', + '\$id' => '(int) $forum_id', + 'aclf_([a-z0-9_]+)' => '(int) $auth->acl_getf_global(\'\\1\')', + 'cfg_([a-z0-9_]+)' => '(int) $config[\'\\1\']', + 'request_([a-zA-Z0-9_]+)' => '$request->variable(\'\\1\', false)', + 'ext_([a-zA-Z0-9_/]+)' => 'array_key_exists(\'\\1\', $phpbb_extension_manager->all_enabled())', + 'authmethod_([a-z0-9_\\\\]+)' => '($config[\'auth_method\'] === \'\\1\')', + ); + + /** + * Alter tokens for module authorisation check + * + * @event core.module_auth + * @var array valid_tokens Valid tokens and their auth check + * replacements + * @var string module_auth The module_auth of the current + * module + * @var int forum_id The current forum_id + * @since 3.1.0-a3 + */ + $vars = array('valid_tokens', 'module_auth', 'forum_id'); + extract($phpbb_dispatcher->trigger_event('core.module_auth', compact($vars))); + + $tokens = $match[0]; + for ($i = 0, $size = count($tokens); $i < $size; $i++) + { + $token = &$tokens[$i]; + + switch ($token) + { + case ')': + case '(': + case '&&': + case '||': + case ',': + break; + + default: + if (!preg_match('#(?:' . implode(')|(?:', array_keys($valid_tokens)) . ')#', $token)) + { + $token = ''; + } + break; + } + } + + $module_auth = implode(' ', $tokens); + + // Make sure $id separation is working fine + $module_auth = str_replace(' , ', ',', $module_auth); + + $module_auth = preg_replace( + // Array keys with # prepended/appended + array_map(function($value) { + return '#' . $value . '#'; + }, array_keys($valid_tokens)), + array_values($valid_tokens), + $module_auth + ); + + $is_auth = false; + // @codingStandardsIgnoreStart + eval('$is_auth = (int) (' . $module_auth . ');'); + // @codingStandardsIgnoreEnd + + return $is_auth; + } + + /** + * Set active module + */ + function set_active($id = false, $mode = false) + { + global $request; + + $icat = false; + $this->active_module = false; + + if ($request->variable('icat', '')) + { + $icat = $id; + $id = $request->variable('icat', ''); + } + + // Restore the backslashes in class names + if (strpos($id, '-') !== false) + { + $id = str_replace('-', '\\', $id); + } + + if ($id && !is_numeric($id) && !$this->is_full_class($id)) + { + $id = $this->p_class . '_' . $id; + } + + $category = false; + foreach ($this->module_ary as $row_id => $item_ary) + { + // If this is a module and it's selected, active + // If this is a category and the module is the first within it, active + // If this is a module and no mode selected, select first mode + // If no category or module selected, go active for first module in first category + if ( + (($item_ary['name'] === $id || $item_ary['name'] === $this->p_class . '_' . $id || $item_ary['id'] === (int) $id) && (($item_ary['mode'] == $mode && !$item_ary['cat']) || ($icat && $item_ary['cat']))) || + ($item_ary['parent'] === $category && !$item_ary['cat'] && !$icat && $item_ary['display']) || + (($item_ary['name'] === $id || $item_ary['name'] === $this->p_class . '_' . $id || $item_ary['id'] === (int) $id) && !$mode && !$item_ary['cat']) || + (!$id && !$mode && !$item_ary['cat'] && $item_ary['display']) + ) + { + if ($item_ary['cat']) + { + $id = $icat; + $icat = false; + + continue; + } + + $this->p_id = $item_ary['id']; + $this->p_parent = $item_ary['parent']; + $this->p_name = $item_ary['name']; + $this->p_mode = $item_ary['mode']; + $this->p_left = $item_ary['left']; + $this->p_right = $item_ary['right']; + + $this->module_cache['parents'] = $this->module_cache['parents'][$this->p_id]; + $this->active_module = $item_ary['id']; + $this->active_module_row_id = $row_id; + + break; + } + else if (($item_ary['cat'] && $item_ary['id'] === (int) $id) || ($item_ary['parent'] === $category && $item_ary['cat'])) + { + $category = $item_ary['id']; + } + } + } + + /** + * Loads currently active module + * + * This method loads a given module, passing it the relevant id and mode. + * + * @param string|false $mode mode, as passed through to the module + * @param string|false $module_url If supplied, we use this module url + * @param bool $execute_module If true, at the end we execute the main method for the new instance + */ + function load_active($mode = false, $module_url = false, $execute_module = true) + { + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $template, $request; + + $module_path = $this->include_path . $this->p_class; + $icat = $request->variable('icat', ''); + + if ($this->active_module === false) + { + trigger_error('MODULE_NOT_ACCESS', E_USER_ERROR); + } + + // new modules use the full class names, old ones are always called _, e.g. acp_board + if (!class_exists($this->p_name)) + { + if (!file_exists("$module_path/{$this->p_name}.$phpEx")) + { + trigger_error($user->lang('MODULE_NOT_FIND', "$module_path/{$this->p_name}.$phpEx"), E_USER_ERROR); + } + + include("$module_path/{$this->p_name}.$phpEx"); + + if (!class_exists($this->p_name)) + { + trigger_error($user->lang('MODULE_FILE_INCORRECT_CLASS', "$module_path/{$this->p_name}.$phpEx", $this->p_name), E_USER_ERROR); + } + } + + if (!empty($mode)) + { + $this->p_mode = $mode; + } + + // Create a new instance of the desired module ... + $class_name = $this->p_name; + + $this->module = new $class_name($this); + + // We pre-define the action parameter we are using all over the place + if (defined('IN_ADMIN')) + { + /* + * If this is an extension module, we'll try to automatically set + * the style paths for the extension (the ext author can change them + * if necessary). + */ + $module_dir = explode('\\', get_class($this->module)); + + // 0 vendor, 1 extension name, ... + if (isset($module_dir[1])) + { + $module_style_dir = $phpbb_root_path . 'ext/' . $module_dir[0] . '/' . $module_dir[1] . '/adm/style'; + + if (is_dir($module_style_dir)) + { + $template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), + ), array($module_style_dir, $phpbb_admin_path . 'style')); + } + } + + // Is first module automatically enabled a duplicate and the category not passed yet? + if (!$icat && $this->module_ary[$this->active_module_row_id]['is_duplicate']) + { + $icat = $this->module_ary[$this->active_module_row_id]['parent']; + } + + // Not being able to overwrite ;) + $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + } + else + { + /* + * If this is an extension module, we'll try to automatically set + * the style paths for the extension (the ext author can change them + * if necessary). + */ + $module_dir = explode('\\', get_class($this->module)); + + // 0 vendor, 1 extension name, ... + if (isset($module_dir[1])) + { + $module_style_dir = 'ext/' . $module_dir[0] . '/' . $module_dir[1] . '/styles'; + + if (is_dir($phpbb_root_path . $module_style_dir)) + { + $template->set_style(array($module_style_dir, 'styles')); + } + } + + // If user specified the module url we will use it... + if ($module_url !== false) + { + $this->module->u_action = $module_url; + } + else + { + $this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; + } + + $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + } + + // Add url_extra parameter to u_action url + if (!empty($this->module_ary) && $this->active_module !== false && $this->module_ary[$this->active_module_row_id]['url_extra']) + { + $this->module->u_action .= $this->module_ary[$this->active_module_row_id]['url_extra']; + } + + // Assign the module path for re-usage + $this->module->module_path = $module_path . '/'; + + // Execute the main method for the new instance, we send the module id and mode as parameters + // Users are able to call the main method after this function to be able to assign additional parameters manually + if ($execute_module) + { + $short_name = preg_replace("#^{$this->p_class}_#", '', $this->p_name); + $this->module->main($short_name, $this->p_mode); + } + } + + /** + * Appending url parameter to the currently active module. + * + * This function is called for adding specific url parameters while executing the current module. + * It is doing the same as the _module_{name}_url() function, apart from being able to be called after + * having dynamically parsed specific parameters. This allows more freedom in choosing additional parameters. + * One example can be seen in /includes/mcp/mcp_notes.php - $this->p_master->adjust_url() call. + * + * @param string $url_extra Extra url parameters, e.g.: &u=$user_id + * + */ + function adjust_url($url_extra) + { + if (empty($this->module_ary[$this->active_module_row_id])) + { + return; + } + + $row = &$this->module_ary[$this->active_module_row_id]; + + // We check for the same url_extra in $row['url_extra'] to overcome doubled additions... + if (strpos($row['url_extra'], $url_extra) === false) + { + $row['url_extra'] .= $url_extra; + } + } + + /** + * Check if a module is active + */ + function is_active($id, $mode = false) + { + // If we find a name by this id and being enabled we have our active one... + foreach ($this->module_ary as $row_id => $item_ary) + { + if (($item_ary['name'] === $id || $item_ary['id'] === (int) $id) && $item_ary['display'] || $item_ary['name'] === $this->p_class . '_' . $id) + { + if ($mode === false || $mode === $item_ary['mode']) + { + return true; + } + } + } + + return false; + } + + /** + * Get parents + */ + function get_parents($parent_id, $left_id, $right_id, &$all_parents) + { + $parents = array(); + + if ($parent_id > 0) + { + foreach ($all_parents as $module_id => $row) + { + if ($row['left_id'] < $left_id && $row['right_id'] > $right_id) + { + $parents[$module_id] = $row['parent_id']; + } + + if ($row['left_id'] > $left_id) + { + break; + } + } + } + + return $parents; + } + + /** + * Get tree branch + */ + function get_branch($left_id, $right_id, $remaining) + { + $branch = array(); + + foreach ($remaining as $key => $row) + { + if ($row['left_id'] > $left_id && $row['left_id'] < $right_id) + { + $branch[] = $row; + continue; + } + break; + } + + return $branch; + } + + /** + * Build true binary tree from given array + * Not in use + */ + function build_tree(&$modules, &$parents) + { + $tree = array(); + + foreach ($modules as $row) + { + $branch = &$tree; + + if ($row['parent_id']) + { + // Go through the tree to find our branch + $parent_tree = $parents[$row['module_id']]; + + foreach ($parent_tree as $id => $value) + { + if (!isset($branch[$id]) && isset($branch['child'])) + { + $branch = &$branch['child']; + } + $branch = &$branch[$id]; + } + $branch = &$branch['child']; + } + + $branch[$row['module_id']] = $row; + if (!isset($branch[$row['module_id']]['child'])) + { + $branch[$row['module_id']]['child'] = array(); + } + } + + return $tree; + } + + /** + * Build navigation structure + */ + function assign_tpl_vars($module_url) + { + global $template; + + $current_id = $right_id = false; + + // Make sure the module_url has a question mark set, effectively determining the delimiter to use + $delim = (strpos($module_url, '?') === false) ? '?' : '&'; + + $current_depth = 0; + $linear_offset = 'l_block1'; + $tabular_offset = 't_block2'; + + // Generate the list of modules, we'll do this in two ways ... + // 1) In a linear fashion + // 2) In a combined tabbed + linear fashion ... tabs for the categories + // and a linear list for subcategories/items + foreach ($this->module_ary as $row_id => $item_ary) + { + // Skip hidden modules + if (!$item_ary['display']) + { + continue; + } + + // Skip branch + if ($right_id !== false) + { + if ($item_ary['left'] < $right_id) + { + continue; + } + + $right_id = false; + } + + // Category with no members on their way down (we have to check every level) + if (!$item_ary['name']) + { + $empty_category = true; + + // We go through the branch and look for an activated module + foreach (array_slice($this->module_ary, $row_id + 1) as $temp_row) + { + if ($temp_row['left'] > $item_ary['left'] && $temp_row['left'] < $item_ary['right']) + { + // Module there and displayed? + if ($temp_row['name'] && $temp_row['display']) + { + $empty_category = false; + break; + } + continue; + } + break; + } + + // Skip the branch + if ($empty_category) + { + $right_id = $item_ary['right']; + continue; + } + } + + // Select first id we can get + if (!$current_id && (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id)) + { + $current_id = $item_ary['id']; + } + + $depth = $item_ary['depth']; + + if ($depth > $current_depth) + { + $linear_offset = $linear_offset . '.l_block' . ($depth + 1); + $tabular_offset = ($depth + 1 > 2) ? $tabular_offset . '.t_block' . ($depth + 1) : $tabular_offset; + } + else if ($depth < $current_depth) + { + for ($i = $current_depth - $depth; $i > 0; $i--) + { + $linear_offset = substr($linear_offset, 0, strrpos($linear_offset, '.')); + $tabular_offset = ($i + $depth > 1) ? substr($tabular_offset, 0, strrpos($tabular_offset, '.')) : $tabular_offset; + } + } + + $u_title = $module_url . $delim . 'i='; + // if the item has a name use it, else use its id + if (empty($item_ary['name'])) + { + $u_title .= $item_ary['id']; + } + else + { + // if the category has a name, then use it. + $u_title .= $this->get_module_identifier($item_ary['name']); + } + // If the item is not a category append the mode + if (!$item_ary['cat']) + { + if ($item_ary['is_duplicate']) + { + $u_title .= '&icat=' . $current_id; + } + $u_title .= '&mode=' . $item_ary['mode']; + } + + // Was not allowed in categories before - /*!$item_ary['cat'] && */ + $u_title .= (isset($item_ary['url_extra'])) ? $item_ary['url_extra'] : ''; + + // Only output a categories items if it's currently selected + if (!$depth || ($depth && (in_array($item_ary['parent'], array_values($this->module_cache['parents'])) || $item_ary['parent'] == $this->p_parent))) + { + $use_tabular_offset = (!$depth) ? 't_block1' : $tabular_offset; + + $tpl_ary = array( + 'L_TITLE' => $item_ary['lang'], + 'S_SELECTED' => (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) ? true : false, + 'U_TITLE' => $u_title + ); + + if (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) + { + $template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $item_ary['lang'], + 'U_BREADCRUMB' => $u_title, + )); + } + + $template->assign_block_vars($use_tabular_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER))); + } + + $tpl_ary = array( + 'L_TITLE' => $item_ary['lang'], + 'S_SELECTED' => (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) ? true : false, + 'U_TITLE' => $u_title + ); + + $template->assign_block_vars($linear_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER))); + + $current_depth = $depth; + } + } + + /** + * Returns desired template name + */ + function get_tpl_name() + { + return $this->module->tpl_name . '.html'; + } + + /** + * Returns the desired page title + */ + function get_page_title() + { + global $user; + + if (!isset($this->module->page_title)) + { + return ''; + } + + return (isset($user->lang[$this->module->page_title])) ? $user->lang[$this->module->page_title] : $this->module->page_title; + } + + /** + * Load module as the current active one without the need for registering it + * + * @param string $class module class (acp/mcp/ucp) + * @param string $name module name (class name of the module, or its basename + * phpbb_ext_foo_acp_bar_module, ucp_zebra or zebra) + * @param string $mode mode, as passed through to the module + * + */ + function load($class, $name, $mode = false) + { + // new modules use the full class names, old ones are always called _, e.g. acp_board + // in the latter case this function may be called as load('acp', 'board') + if (!class_exists($name) && substr($name, 0, strlen($class) + 1) !== $class . '_') + { + $name = $class . '_' . $name; + } + + $this->p_class = $class; + $this->p_name = $name; + + // Set active module to true instead of using the id + $this->active_module = true; + + $this->load_active($mode); + } + + /** + * Display module + */ + function display($page_title, $display_online_list = false) + { + global $template, $user; + + // Generate the page + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_header($page_title); + } + else + { + page_header($page_title, $display_online_list); + } + + $template->set_filenames(array( + 'body' => $this->get_tpl_name()) + ); + + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_footer(); + } + else + { + page_footer(); + } + } + + /** + * Toggle whether this module will be displayed or not + */ + function set_display($id, $mode = false, $display = true) + { + foreach ($this->module_ary as $row_id => $item_ary) + { + if (($item_ary['name'] === $id || $item_ary['name'] === $this->p_class . '_' . $id || $item_ary['id'] === (int) $id) && (!$mode || $item_ary['mode'] === $mode)) + { + $this->module_ary[$row_id]['display'] = (int) $display; + } + } + } + + /** + * Add custom MOD info language file + */ + function add_mod_info($module_class) + { + global $config, $user, $phpEx, $phpbb_extension_manager; + + $finder = $phpbb_extension_manager->get_finder(); + + // We grab the language files from the default, English and user's language. + // So we can fall back to the other files like we do when using add_lang() + $default_lang_files = $english_lang_files = $user_lang_files = array(); + + // Search for board default language if it's not the user language + if ($config['default_lang'] != $user->lang_name) + { + $default_lang_files = $finder + ->prefix('info_' . strtolower($module_class) . '_') + ->suffix(".$phpEx") + ->extension_directory('/language/' . basename($config['default_lang'])) + ->core_path('language/' . basename($config['default_lang']) . '/mods/') + ->find(); + } + + // Search for english, if its not the default or user language + if ($config['default_lang'] != 'en' && $user->lang_name != 'en') + { + $english_lang_files = $finder + ->prefix('info_' . strtolower($module_class) . '_') + ->suffix(".$phpEx") + ->extension_directory('/language/en') + ->core_path('language/en/mods/') + ->find(); + } + + // Find files in the user's language + $user_lang_files = $finder + ->prefix('info_' . strtolower($module_class) . '_') + ->suffix(".$phpEx") + ->extension_directory('/language/' . $user->lang_name) + ->core_path('language/' . $user->lang_name . '/mods/') + ->find(); + + $lang_files = array_merge($english_lang_files, $default_lang_files, $user_lang_files); + foreach ($lang_files as $lang_file => $ext_name) + { + $user->add_lang_ext($ext_name, $lang_file); + } + } + + /** + * Retrieve shortened module basename for legacy basenames (with xcp_ prefix) + * + * @param string $basename A module basename + * @return string The basename if it starts with phpbb_ or the basename with + * the current p_class (e.g. acp_) stripped. + */ + protected function get_short_name($basename) + { + if (substr($basename, 0, 6) === 'phpbb\\' || strpos($basename, '\\') !== false) + { + return $basename; + } + + // strip xcp_ prefix from old classes + return substr($basename, strlen($this->p_class) + 1); + } + + /** + * If the basename contains a \ we don't use that for the URL. + * + * Firefox is currently unable to correctly copy a urlencoded \ + * so users will be unable to post links to modules. + * However we can replace them with dashes and re-replace them later + * + * @param string $basename Basename of the module + * @return string Identifier that should be used for + * module link creation + */ + protected function get_module_identifier($basename) + { + if (strpos($basename, '\\') === false) + { + return $basename; + } + + return str_replace('\\', '-', $basename); + } + + /** + * Checks whether the given module basename is a correct class name + * + * @param string $basename A module basename + * @return bool True if the basename starts with phpbb_ or (x)cp_, false otherwise + */ + protected function is_full_class($basename) + { + return (strpos($basename, '\\') !== false || preg_match('/^(ucp|mcp|acp)_/', $basename)); + } +} diff --git a/install/update/new/includes/functions_posting.php b/install/update/new/includes/functions_posting.php new file mode 100644 index 0000000..45eda4b --- /dev/null +++ b/install/update/new/includes/functions_posting.php @@ -0,0 +1,2804 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Fill smiley templates (or just the variables) with smilies, either in a window or inline +*/ +function generate_smilies($mode, $forum_id) +{ + global $db, $user, $config, $template, $phpbb_dispatcher, $request; + global $phpEx, $phpbb_root_path, $phpbb_container, $phpbb_path_helper; + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $base_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=smilies&f=' . $forum_id); + $start = $request->variable('start', 0); + + if ($mode == 'window') + { + if ($forum_id) + { + $sql = 'SELECT forum_style + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $user->setup('posting', (int) $row['forum_style']); + } + else + { + $user->setup('posting'); + } + + page_header($user->lang['SMILIES']); + + $sql_ary = [ + 'SELECT' => 'COUNT(s.smiley_id) AS item_count', + 'FROM' => [ + SMILIES_TABLE => 's', + ], + 'GROUP_BY' => 's.smiley_url', + ]; + + /** + * Modify SQL query that fetches the total number of smilies in window mode + * + * @event core.generate_smilies_count_sql_before + * @var int forum_id Forum where smilies are generated + * @var array sql_ary Array with the SQL query + * @since 3.2.9-RC1 + */ + $vars = [ + 'forum_id', + 'sql_ary', + ]; + extract($phpbb_dispatcher->trigger_event('core.generate_smilies_count_sql_before', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql, 3600); + + $smiley_count = 0; + while ($row = $db->sql_fetchrow($result)) + { + ++$smiley_count; + } + $db->sql_freeresult($result); + + $template->set_filenames(array( + 'body' => 'posting_smilies.html') + ); + + $start = $pagination->validate_start($start, $config['smilies_per_page'], $smiley_count); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $smiley_count, $config['smilies_per_page'], $start); + } + + $display_link = false; + if ($mode == 'inline') + { + $sql = 'SELECT smiley_id + FROM ' . SMILIES_TABLE . ' + WHERE display_on_posting = 0'; + $result = $db->sql_query_limit($sql, 1, 0, 3600); + + if ($row = $db->sql_fetchrow($result)) + { + $display_link = true; + } + $db->sql_freeresult($result); + } + + if ($mode == 'window') + { + $sql = 'SELECT smiley_url, MIN(emotion) as emotion, MIN(code) AS code, smiley_width, smiley_height, MIN(smiley_order) AS min_smiley_order + FROM ' . SMILIES_TABLE . ' + GROUP BY smiley_url, smiley_width, smiley_height + ORDER BY min_smiley_order'; + $result = $db->sql_query_limit($sql, $config['smilies_per_page'], $start, 3600); + } + else + { + $sql = 'SELECT * + FROM ' . SMILIES_TABLE . ' + WHERE display_on_posting = 1 + ORDER BY smiley_order'; + $result = $db->sql_query($sql, 3600); + } + + $smilies = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (empty($smilies[$row['smiley_url']])) + { + $smilies[$row['smiley_url']] = $row; + } + } + $db->sql_freeresult($result); + + /** + * Modify smilies before they are assigned to the template + * + * @event core.generate_smilies_modify_rowset + * @var string mode Smiley mode, either window or inline + * @var int forum_id Forum where smilies are generated + * @var array smilies Smiley rows fetched from the database + * @since 3.2.9-RC1 + */ + $vars = [ + 'mode', + 'forum_id', + 'smilies', + ]; + extract($phpbb_dispatcher->trigger_event('core.generate_smilies_modify_rowset', compact($vars))); + + if (count($smilies)) + { + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); + + foreach ($smilies as $row) + { + /** + * Modify smiley root path before populating smiley list + * + * @event core.generate_smilies_before + * @var string root_path root_path for smilies + * @since 3.1.11-RC1 + */ + $vars = array('root_path'); + extract($phpbb_dispatcher->trigger_event('core.generate_smilies_before', compact($vars))); + $template->assign_block_vars('smiley', array( + 'SMILEY_CODE' => $row['code'], + 'A_SMILEY_CODE' => addslashes($row['code']), + 'SMILEY_IMG' => $root_path . $config['smilies_path'] . '/' . $row['smiley_url'], + 'SMILEY_WIDTH' => $row['smiley_width'], + 'SMILEY_HEIGHT' => $row['smiley_height'], + 'SMILEY_DESC' => $row['emotion']) + ); + } + } + + /** + * This event is called after the smilies are populated + * + * @event core.generate_smilies_after + * @var string mode Mode of the smilies: window|inline + * @var int forum_id The forum ID we are currently in + * @var bool display_link Shall we display the "more smilies" link? + * @since 3.1.0-a1 + */ + $vars = array('mode', 'forum_id', 'display_link'); + extract($phpbb_dispatcher->trigger_event('core.generate_smilies_after', compact($vars))); + + if ($mode == 'inline' && $display_link) + { + $template->assign_vars(array( + 'S_SHOW_SMILEY_LINK' => true, + 'U_MORE_SMILIES' => $base_url, + )); + } + + if ($mode == 'window') + { + page_footer(); + } +} + +/** +* Update last post information +* Should be used instead of sync() if only the last post information are out of sync... faster +* +* @param string $type Can be forum|topic +* @param mixed $ids topic/forum ids +* @param bool $return_update_sql true: SQL query shall be returned, false: execute SQL +*/ +function update_post_information($type, $ids, $return_update_sql = false) +{ + global $db; + + if (empty($ids)) + { + return; + } + if (!is_array($ids)) + { + $ids = array($ids); + } + + $update_sql = $empty_forums = $not_empty_forums = array(); + + if ($type != 'topic') + { + $topic_join = ', ' . TOPICS_TABLE . ' t'; + $topic_condition = 'AND t.topic_id = p.topic_id AND t.topic_visibility = ' . ITEM_APPROVED; + } + else + { + $topic_join = ''; + $topic_condition = ''; + } + + if (count($ids) == 1) + { + $sql = 'SELECT p.post_id as last_post_id + FROM ' . POSTS_TABLE . " p $topic_join + WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . " + $topic_condition + AND p.post_visibility = " . ITEM_APPROVED . " + ORDER BY p.post_id DESC"; + $result = $db->sql_query_limit($sql, 1); + } + else + { + $sql = 'SELECT p.' . $type . '_id, MAX(p.post_id) as last_post_id + FROM ' . POSTS_TABLE . " p $topic_join + WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . " + $topic_condition + AND p.post_visibility = " . ITEM_APPROVED . " + GROUP BY p.{$type}_id"; + $result = $db->sql_query($sql); + } + + $last_post_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (count($ids) == 1) + { + $row[$type . '_id'] = $ids[0]; + } + + if ($type == 'forum') + { + $not_empty_forums[] = $row['forum_id']; + + if (empty($row['last_post_id'])) + { + $empty_forums[] = $row['forum_id']; + } + } + + $last_post_ids[] = $row['last_post_id']; + } + $db->sql_freeresult($result); + + if ($type == 'forum') + { + $empty_forums = array_merge($empty_forums, array_diff($ids, $not_empty_forums)); + + foreach ($empty_forums as $void => $forum_id) + { + $update_sql[$forum_id][] = 'forum_last_post_id = 0'; + $update_sql[$forum_id][] = "forum_last_post_subject = ''"; + $update_sql[$forum_id][] = 'forum_last_post_time = 0'; + $update_sql[$forum_id][] = 'forum_last_poster_id = 0'; + $update_sql[$forum_id][] = "forum_last_poster_name = ''"; + $update_sql[$forum_id][] = "forum_last_poster_colour = ''"; + } + } + + if (count($last_post_ids)) + { + $sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE p.poster_id = u.user_id + AND ' . $db->sql_in_set('p.post_id', $last_post_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $update_sql[$row["{$type}_id"]][] = $type . '_last_post_id = ' . (int) $row['post_id']; + $update_sql[$row["{$type}_id"]][] = "{$type}_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'"; + $update_sql[$row["{$type}_id"]][] = $type . '_last_post_time = ' . (int) $row['post_time']; + $update_sql[$row["{$type}_id"]][] = $type . '_last_poster_id = ' . (int) $row['poster_id']; + $update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'"; + $update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'"; + } + $db->sql_freeresult($result); + } + unset($empty_forums, $ids, $last_post_ids); + + if ($return_update_sql || !count($update_sql)) + { + return $update_sql; + } + + $table = ($type == 'forum') ? FORUMS_TABLE : TOPICS_TABLE; + + foreach ($update_sql as $update_id => $update_sql_ary) + { + $sql = "UPDATE $table + SET " . implode(', ', $update_sql_ary) . " + WHERE {$type}_id = $update_id"; + $db->sql_query($sql); + } + + return; +} + +/** +* Generate Topic Icons for display +*/ +function posting_gen_topic_icons($mode, $icon_id) +{ + global $phpbb_root_path, $config, $template, $cache; + + // Grab icons + $icons = $cache->obtain_icons(); + + if (!$icon_id) + { + $template->assign_var('S_NO_ICON_CHECKED', ' checked="checked"'); + } + + if (count($icons)) + { + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; + + foreach ($icons as $id => $data) + { + if ($data['display']) + { + $template->assign_block_vars('topic_icon', array( + 'ICON_ID' => $id, + 'ICON_IMG' => $root_path . $config['icons_path'] . '/' . $data['img'], + 'ICON_WIDTH' => $data['width'], + 'ICON_HEIGHT' => $data['height'], + 'ICON_ALT' => $data['alt'], + + 'S_CHECKED' => ($id == $icon_id) ? true : false, + 'S_ICON_CHECKED' => ($id == $icon_id) ? ' checked="checked"' : '') + ); + } + } + + return true; + } + + return false; +} + +/** +* Build topic types able to be selected +*/ +function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) +{ + global $auth, $user, $template; + + $toggle = false; + + $topic_types = array( + 'sticky' => array('const' => POST_STICKY, 'lang' => 'POST_STICKY'), + 'announce' => array('const' => POST_ANNOUNCE, 'lang' => 'POST_ANNOUNCEMENT'), + 'announce_global' => array('const' => POST_GLOBAL, 'lang' => 'POST_GLOBAL') + ); + + $topic_type_array = array(); + + foreach ($topic_types as $auth_key => $topic_value) + { + if ($auth->acl_get('f_' . $auth_key, $forum_id)) + { + $toggle = true; + + $topic_type_array[] = array( + 'VALUE' => $topic_value['const'], + 'S_CHECKED' => ($cur_topic_type == $topic_value['const']) ? ' checked="checked"' : '', + 'L_TOPIC_TYPE' => $user->lang[$topic_value['lang']] + ); + } + } + + if ($toggle) + { + $topic_type_array = array_merge(array(0 => array( + 'VALUE' => POST_NORMAL, + 'S_CHECKED' => ($cur_topic_type == POST_NORMAL) ? ' checked="checked"' : '', + 'L_TOPIC_TYPE' => $user->lang['POST_NORMAL'])), + + $topic_type_array + ); + + foreach ($topic_type_array as $array) + { + $template->assign_block_vars('topic_type', $array); + } + + $template->assign_vars(array( + 'S_TOPIC_TYPE_STICKY' => ($auth->acl_get('f_sticky', $forum_id)), + 'S_TOPIC_TYPE_ANNOUNCE' => ($auth->acl_gets('f_announce', 'f_announce_global', $forum_id)), + )); + } + + return $toggle; +} + +// +// Attachment related functions +// +/** +* Calculate the needed size for Thumbnail +*/ +function get_img_size_format($width, $height) +{ + global $config; + + // Maximum Width the Image can take + $max_width = ($config['img_max_thumb_width']) ? $config['img_max_thumb_width'] : 400; + + if ($width > $height) + { + return array( + round($width * ($max_width / $width)), + round($height * ($max_width / $width)) + ); + } + else + { + return array( + round($width * ($max_width / $height)), + round($height * ($max_width / $height)) + ); + } +} + +/** +* Return supported image types +*/ +function get_supported_image_types($type = false) +{ + if (@extension_loaded('gd')) + { + $format = imagetypes(); + $new_type = 0; + + if ($type !== false) + { + // Type is one of the IMAGETYPE constants - it is fetched from getimagesize() + switch ($type) + { + // GIF + case IMAGETYPE_GIF: + $new_type = ($format & IMG_GIF) ? IMG_GIF : false; + break; + + // JPG, JPC, JP2 + case IMAGETYPE_JPEG: + case IMAGETYPE_JPC: + case IMAGETYPE_JPEG2000: + case IMAGETYPE_JP2: + case IMAGETYPE_JPX: + case IMAGETYPE_JB2: + $new_type = ($format & IMG_JPG) ? IMG_JPG : false; + break; + + // PNG + case IMAGETYPE_PNG: + $new_type = ($format & IMG_PNG) ? IMG_PNG : false; + break; + + // WBMP + case IMAGETYPE_WBMP: + $new_type = ($format & IMG_WBMP) ? IMG_WBMP : false; + break; + } + } + else + { + $new_type = array(); + $go_through_types = array(IMG_GIF, IMG_JPG, IMG_PNG, IMG_WBMP); + + foreach ($go_through_types as $check_type) + { + if ($format & $check_type) + { + $new_type[] = $check_type; + } + } + } + + return array( + 'gd' => ($new_type) ? true : false, + 'format' => $new_type, + 'version' => (function_exists('imagecreatetruecolor')) ? 2 : 1 + ); + } + + return array('gd' => false); +} + +/** +* Create Thumbnail +*/ +function create_thumbnail($source, $destination, $mimetype) +{ + global $config, $phpbb_filesystem, $phpbb_dispatcher; + + $min_filesize = (int) $config['img_min_thumb_filesize']; + $img_filesize = (file_exists($source)) ? @filesize($source) : false; + + if (!$img_filesize || $img_filesize <= $min_filesize) + { + return false; + } + + $dimension = @getimagesize($source); + + if ($dimension === false) + { + return false; + } + + list($width, $height, $type, ) = $dimension; + + if (empty($width) || empty($height)) + { + return false; + } + + list($new_width, $new_height) = get_img_size_format($width, $height); + + // Do not create a thumbnail if the resulting width/height is bigger than the original one + if ($new_width >= $width && $new_height >= $height) + { + return false; + } + + $thumbnail_created = false; + + /** + * Create thumbnail event to replace GD thumbnail creation with for example ImageMagick + * + * @event core.thumbnail_create_before + * @var string source Image source path + * @var string destination Thumbnail destination path + * @var string mimetype Image mime type + * @var float new_width Calculated thumbnail width + * @var float new_height Calculated thumbnail height + * @var bool thumbnail_created Set to true to skip default GD thumbnail creation + * @since 3.2.4 + */ + $vars = array( + 'source', + 'destination', + 'mimetype', + 'new_width', + 'new_height', + 'thumbnail_created', + ); + extract($phpbb_dispatcher->trigger_event('core.thumbnail_create_before', compact($vars))); + + if (!$thumbnail_created) + { + $type = get_supported_image_types($type); + + if ($type['gd']) + { + // If the type is not supported, we are not able to create a thumbnail + if ($type['format'] === false) + { + return false; + } + + switch ($type['format']) + { + case IMG_GIF: + $image = @imagecreatefromgif($source); + break; + + case IMG_JPG: + @ini_set('gd.jpeg_ignore_warning', 1); + $image = @imagecreatefromjpeg($source); + break; + + case IMG_PNG: + $image = @imagecreatefrompng($source); + break; + + case IMG_WBMP: + $image = @imagecreatefromwbmp($source); + break; + } + + if (empty($image)) + { + return false; + } + + if ($type['version'] == 1) + { + $new_image = imagecreate($new_width, $new_height); + + if ($new_image === false) + { + return false; + } + + imagecopyresized($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + } + else + { + $new_image = imagecreatetruecolor($new_width, $new_height); + + if ($new_image === false) + { + return false; + } + + // Preserve alpha transparency (png for example) + @imagealphablending($new_image, false); + @imagesavealpha($new_image, true); + + imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + } + + switch ($type['format']) + { + case IMG_GIF: + imagegif($new_image, $destination); + break; + + case IMG_JPG: + imagejpeg($new_image, $destination, 90); + break; + + case IMG_PNG: + imagepng($new_image, $destination); + break; + + case IMG_WBMP: + imagewbmp($new_image, $destination); + break; + } + + imagedestroy($new_image); + } + else + { + return false; + } + } + + if (!file_exists($destination)) + { + return false; + } + + try + { + $phpbb_filesystem->phpbb_chmod($destination, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + + return true; +} + +/** +* Assign Inline attachments (build option fields) +*/ +function posting_gen_inline_attachments(&$attachment_data) +{ + global $template; + + if (count($attachment_data)) + { + $s_inline_attachment_options = ''; + + foreach ($attachment_data as $i => $attachment) + { + $s_inline_attachment_options .= ''; + } + + $template->assign_var('S_INLINE_ATTACHMENT_OPTIONS', $s_inline_attachment_options); + + return true; + } + + return false; +} + +/** +* Generate inline attachment entry +*/ +function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true) +{ + global $template, $config, $phpbb_root_path, $phpEx, $user, $phpbb_dispatcher; + + // Some default template variables + $template->assign_vars(array( + 'S_SHOW_ATTACH_BOX' => $show_attach_box, + 'S_HAS_ATTACHMENTS' => count($attachment_data), + 'FILESIZE' => $config['max_filesize'], + 'FILE_COMMENT' => (isset($filename_data['filecomment'])) ? $filename_data['filecomment'] : '', + )); + + if (count($attachment_data)) + { + // We display the posted attachments within the desired order. + ($config['display_order']) ? krsort($attachment_data) : ksort($attachment_data); + + $attachrow_template_vars = []; + + foreach ($attachment_data as $count => $attach_row) + { + $hidden = ''; + $attach_row['real_filename'] = utf8_basename($attach_row['real_filename']); + + foreach ($attach_row as $key => $value) + { + $hidden .= ''; + } + + $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false); + + $attachrow_template_vars[(int) $attach_row['attach_id']] = array( + 'FILENAME' => utf8_basename($attach_row['real_filename']), + 'A_FILENAME' => addslashes(utf8_basename($attach_row['real_filename'])), + 'FILE_COMMENT' => $attach_row['attach_comment'], + 'ATTACH_ID' => $attach_row['attach_id'], + 'S_IS_ORPHAN' => $attach_row['is_orphan'], + 'ASSOC_INDEX' => $count, + 'FILESIZE' => get_formatted_filesize($attach_row['filesize']), + + 'U_VIEW_ATTACHMENT' => $download_link, + 'S_HIDDEN' => $hidden, + ); + } + + /** + * Modify inline attachments template vars + * + * @event core.modify_inline_attachments_template_vars + * @var array attachment_data Array containing attachments data + * @var array attachrow_template_vars Array containing attachments template vars + * @since 3.2.2-RC1 + */ + $vars = array('attachment_data', 'attachrow_template_vars'); + extract($phpbb_dispatcher->trigger_event('core.modify_inline_attachments_template_vars', compact($vars))); + + $template->assign_block_vars_array('attach_row', $attachrow_template_vars); + } + + return count($attachment_data); +} + +// +// General Post functions +// + +/** +* Load Drafts +*/ +function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $msg_id = 0) +{ + global $user, $db, $template, $auth; + global $phpbb_root_path, $phpbb_dispatcher, $phpEx; + + $topic_ids = $forum_ids = $draft_rows = array(); + + // Load those drafts not connected to forums/topics + // If forum_id == 0 AND topic_id == 0 then this is a PM draft + if (!$topic_id && !$forum_id) + { + $sql_and = ' AND d.forum_id = 0 AND d.topic_id = 0'; + } + else + { + $sql_and = ''; + $sql_and .= ($forum_id) ? ' AND d.forum_id = ' . (int) $forum_id : ''; + $sql_and .= ($topic_id) ? ' AND d.topic_id = ' . (int) $topic_id : ''; + } + + $sql = 'SELECT d.*, f.forum_id, f.forum_name + FROM ' . DRAFTS_TABLE . ' d + LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = d.forum_id) + WHERE d.user_id = ' . $user->data['user_id'] . " + $sql_and + ORDER BY d.save_time DESC"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_id']) + { + $topic_ids[] = (int) $row['topic_id']; + } + $draft_rows[] = $row; + } + $db->sql_freeresult($result); + + if (!count($draft_rows)) + { + return; + } + + $topic_rows = array(); + if (count($topic_ids)) + { + $sql = 'SELECT topic_id, forum_id, topic_title, topic_poster + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_rows[$row['topic_id']] = $row; + } + $db->sql_freeresult($result); + } + + /** + * Drafts found and their topics + * Edit $draft_rows in order to add or remove drafts loaded + * + * @event core.load_drafts_draft_list_result + * @var array draft_rows The drafts query result. Includes its forum id and everything about the draft + * @var array topic_ids The list of topics got from the topics table + * @var array topic_rows The topics that draft_rows references + * @since 3.1.0-RC3 + */ + $vars = array('draft_rows', 'topic_ids', 'topic_rows'); + extract($phpbb_dispatcher->trigger_event('core.load_drafts_draft_list_result', compact($vars))); + + unset($topic_ids); + + $template->assign_var('S_SHOW_DRAFTS', true); + + foreach ($draft_rows as $draft) + { + $link_topic = $link_forum = $link_pm = false; + $view_url = $title = ''; + + if (isset($topic_rows[$draft['topic_id']]) + && ( + ($topic_rows[$draft['topic_id']]['forum_id'] && $auth->acl_get('f_read', $topic_rows[$draft['topic_id']]['forum_id'])) + || + (!$topic_rows[$draft['topic_id']]['forum_id'] && $auth->acl_getf_global('f_read')) + )) + { + $topic_forum_id = ($topic_rows[$draft['topic_id']]['forum_id']) ? $topic_rows[$draft['topic_id']]['forum_id'] : $forum_id; + + $link_topic = true; + $view_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_forum_id . '&t=' . $draft['topic_id']); + $title = $topic_rows[$draft['topic_id']]['topic_title']; + + $insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $topic_forum_id . '&t=' . $draft['topic_id'] . '&mode=reply&d=' . $draft['draft_id']); + } + else if ($draft['forum_id'] && $auth->acl_get('f_read', $draft['forum_id'])) + { + $link_forum = true; + $view_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $draft['forum_id']); + $title = $draft['forum_name']; + + $insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id']); + } + else + { + // Either display as PM draft if forum_id and topic_id are empty or if access to the forums has been denied afterwards... + $link_pm = true; + $insert_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&d={$draft['draft_id']}" . (($pm_action) ? "&action=$pm_action" : '') . (($msg_id) ? "&p=$msg_id" : '')); + } + + $template->assign_block_vars('draftrow', array( + 'DRAFT_ID' => $draft['draft_id'], + 'DATE' => $user->format_date($draft['save_time']), + 'DRAFT_SUBJECT' => $draft['draft_subject'], + + 'TITLE' => $title, + 'U_VIEW' => $view_url, + 'U_INSERT' => $insert_url, + + 'S_LINK_PM' => $link_pm, + 'S_LINK_TOPIC' => $link_topic, + 'S_LINK_FORUM' => $link_forum) + ); + } +} + +/** +* Topic Review +*/ +function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true) +{ + global $user, $auth, $db, $template; + global $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher; + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + $sql_sort = ($mode == 'post_review') ? 'ASC' : 'DESC'; + + // Go ahead and pull all data for this topic + $sql = 'SELECT p.post_id + FROM ' . POSTS_TABLE . ' p' . " + WHERE p.topic_id = $topic_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . ' + ' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . ' + ' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . ' + ORDER BY p.post_time ' . $sql_sort . ', p.post_id ' . $sql_sort; + $result = $db->sql_query_limit($sql, $config['posts_per_page']); + + $post_list = array(); + + while ($row = $db->sql_fetchrow($result)) + { + $post_list[] = $row['post_id']; + } + + $db->sql_freeresult($result); + + if (!count($post_list)) + { + return false; + } + + // Handle 'post_review_edit' like 'post_review' from now on + if ($mode == 'post_review_edit') + { + $mode = 'post_review'; + } + + $sql_ary = array( + 'SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe, uu.username as post_delete_username, uu.user_colour as post_delete_user_colour', + + 'FROM' => array( + USERS_TABLE => 'u', + POSTS_TABLE => 'p', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(ZEBRA_TABLE => 'z'), + 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id', + ), + array( + 'FROM' => array(USERS_TABLE => 'uu'), + 'ON' => 'uu.user_id = p.post_delete_user', + ), + ), + + 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . ' + AND u.user_id = p.poster_id', + ); + + /** + * Event to modify the SQL query for topic reviews + * + * @event core.topic_review_modify_sql_ary + * @var int topic_id The topic ID that is being reviewed + * @var int forum_id The topic's forum ID + * @var string mode The topic review mode + * @var int cur_post_id Post offset ID + * @var bool show_quote_button Flag indicating if the quote button should be displayed + * @var array post_list Array with the post IDs + * @var array sql_ary Array with the SQL query + * @since 3.2.8-RC1 + */ + $vars = array( + 'topic_id', + 'forum_id', + 'mode', + 'cur_post_id', + 'show_quote_button', + 'post_list', + 'sql_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_sql_ary', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $rowset = array(); + $has_attachments = false; + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['post_id']] = $row; + + if ($row['post_attachment']) + { + $has_attachments = true; + } + } + $db->sql_freeresult($result); + + // Grab extensions + $attachments = array(); + if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) + { + // Get attachments... + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $post_list) . ' + AND in_message = 0 + ORDER BY filetime DESC, post_msg_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + } + + /** + * Event to modify the posts list for topic reviews + * + * @event core.topic_review_modify_post_list + * @var array attachments Array with the post attachments data + * @var int cur_post_id Post offset ID + * @var int forum_id The topic's forum ID + * @var string mode The topic review mode + * @var array post_list Array with the post IDs + * @var array rowset Array with the posts data + * @var bool show_quote_button Flag indicating if the quote button should be displayed + * @var int topic_id The topic ID that is being reviewed + * @since 3.1.9-RC1 + */ + $vars = array( + 'attachments', + 'cur_post_id', + 'forum_id', + 'mode', + 'post_list', + 'rowset', + 'show_quote_button', + 'topic_id', + ); + extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_post_list', compact($vars))); + + for ($i = 0, $end = count($post_list); $i < $end; ++$i) + { + // A non-existing rowset only happens if there was no user present for the entered poster_id + // This could be a broken posts table. + if (!isset($rowset[$post_list[$i]])) + { + continue; + } + + $row = $rowset[$post_list[$i]]; + + $poster_id = $row['user_id']; + $post_subject = $row['post_subject']; + + $decoded_message = false; + + if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) + { + $decoded_message = censor_text($row['post_text']); + decode_message($decoded_message, $row['bbcode_uid']); + + $decoded_message = bbcode_nl2br($decoded_message); + } + + $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']])) + { + $update_count = array(); + parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count); + } + + $post_subject = censor_text($post_subject); + + $post_anchor = ($mode == 'post_review') ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id']; + $u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f=$forum_id&t=$topic_id&p={$row['post_id']}&view=show#p{$row['post_id']}"); + + $l_deleted_message = ''; + if ($row['post_visibility'] == ITEM_DELETED) + { + $display_postername = get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + + // User having deleted the post also being the post author? + if (!$row['post_delete_user'] || $row['post_delete_user'] == $poster_id) + { + $display_username = $display_postername; + } + else + { + $display_username = get_username_string('full', $row['post_delete_user'], $row['post_delete_username'], $row['post_delete_user_colour']); + } + + if ($row['post_delete_reason']) + { + $l_deleted_message = $user->lang('POST_DELETED_BY_REASON', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true), $row['post_delete_reason']); + } + else + { + $l_deleted_message = $user->lang('POST_DELETED_BY', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true)); + } + } + + $post_row = array( + 'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + + 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, + 'S_FRIEND' => ($row['friend']) ? true : false, + 'S_IGNORE_POST' => ($row['foe']) ? true : false, + 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "", '') : '', + 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false, + 'L_DELETE_POST' => $l_deleted_message, + + 'POST_SUBJECT' => $post_subject, + 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), + 'POST_DATE' => $user->format_date($row['post_time']), + 'MESSAGE' => $message, + 'DECODED_MESSAGE' => $decoded_message, + 'POST_ID' => $row['post_id'], + 'POST_TIME' => $row['post_time'], + 'USER_ID' => $row['user_id'], + 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'], + 'U_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=post_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'POSTER_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '', + ); + + $current_row_number = $i; + + /** + * Event to modify the template data block for topic reviews + * + * @event core.topic_review_modify_row + * @var string mode The review mode + * @var int topic_id The topic that is being reviewed + * @var int forum_id The topic's forum + * @var int cur_post_id Post offset id + * @var int current_row_number Number of the current row being iterated + * @var array post_row Template block array of the current post + * @var array row Array with original post and user data + * @since 3.1.4-RC1 + */ + $vars = array( + 'mode', + 'topic_id', + 'forum_id', + 'cur_post_id', + 'current_row_number', + 'post_row', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_row', compact($vars))); + + $template->assign_block_vars($mode . '_row', $post_row); + + // Display not already displayed Attachments for this post, we already parsed them. ;) + if (!empty($attachments[$row['post_id']])) + { + foreach ($attachments[$row['post_id']] as $attachment) + { + $template->assign_block_vars($mode . '_row.attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + } + + unset($rowset[$post_list[$i]]); + } + + if ($mode == 'topic_review') + { + $template->assign_var('QUOTE_IMG', $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE'])); + } + + return true; +} + +// +// Post handling functions +// + +/** +* Delete Post +*/ +function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $softdelete_reason = '') +{ + global $db, $user, $phpbb_container, $phpbb_dispatcher; + global $config, $phpEx, $phpbb_root_path; + + // Specify our post mode + $post_mode = 'delete'; + if (($data['topic_first_post_id'] === $data['topic_last_post_id']) && ($data['topic_posts_approved'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1)) + { + $post_mode = 'delete_topic'; + } + else if ($data['topic_first_post_id'] == $post_id) + { + $post_mode = 'delete_first_post'; + } + else if ($data['topic_last_post_id'] == $post_id) + { + $post_mode = 'delete_last_post'; + } + $sql_data = array(); + $next_post_id = false; + + include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + + $db->sql_transaction('begin'); + + // we must make sure to update forums that contain the shadow'd topic + if ($post_mode == 'delete_topic') + { + $shadow_forum_ids = array(); + + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_moved_id', $topic_id); + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($shadow_forum_ids[(int) $row['forum_id']])) + { + $shadow_forum_ids[(int) $row['forum_id']] = 1; + } + else + { + $shadow_forum_ids[(int) $row['forum_id']]++; + } + } + $db->sql_freeresult($result); + } + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + // (Soft) delete the post + if ($is_soft && ($post_mode != 'delete_topic')) + { + $phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $post_id, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason, ($data['topic_first_post_id'] == $post_id), ($data['topic_last_post_id'] == $post_id)); + } + else if (!$is_soft) + { + if (!delete_posts('post_id', array($post_id), false, false, false)) + { + // Try to delete topic, we may had an previous error causing inconsistency + if ($post_mode == 'delete_topic') + { + delete_topics('topic_id', array($topic_id), false); + } + trigger_error('ALREADY_DELETED'); + } + } + + $db->sql_transaction('commit'); + + // Collect the necessary information for updating the tables + $sql_data[FORUMS_TABLE] = $sql_data[TOPICS_TABLE] = ''; + switch ($post_mode) + { + case 'delete_topic': + + foreach ($shadow_forum_ids as $updated_forum => $topic_count) + { + // counting is fun! we only have to do count($forum_ids) number of queries, + // even if the topic is moved back to where its shadow lives (we count how many times it is in a forum) + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_topics_approved = forum_topics_approved - ' . $topic_count . ' + WHERE forum_id = ' . $updated_forum; + $db->sql_query($sql); + update_post_information('forum', $updated_forum); + } + + if ($is_soft) + { + $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason); + } + else + { + delete_topics('topic_id', array($topic_id), false); + + $phpbb_content_visibility->remove_topic_from_statistic($data, $sql_data); + $config->increment('num_posts', -1, false); + + $update_sql = update_post_information('forum', $forum_id, true); + if (count($update_sql)) + { + $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : ''; + $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]); + } + } + + break; + + case 'delete_first_post': + $sql = 'SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE p.topic_id = $topic_id + AND p.poster_id = u.user_id + AND p.post_visibility = " . ITEM_APPROVED . ' + ORDER BY p.post_time ASC, p.post_id ASC'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + // No approved post, so the first is a not-approved post (unapproved or soft deleted) + $sql = 'SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE p.topic_id = $topic_id + AND p.poster_id = u.user_id + ORDER BY p.post_time ASC, p.post_id ASC"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + $next_post_id = (int) $row['post_id']; + + $sql_data[TOPICS_TABLE] = $db->sql_build_array('UPDATE', array( + 'topic_poster' => (int) $row['poster_id'], + 'topic_first_post_id' => (int) $row['post_id'], + 'topic_first_poster_colour' => $row['user_colour'], + 'topic_first_poster_name' => ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username'], + 'topic_time' => (int) $row['post_time'], + )); + break; + + case 'delete_last_post': + if (!$is_soft) + { + // Update last post information when hard deleting. Soft delete already did that by itself. + $update_sql = update_post_information('forum', $forum_id, true); + if (count($update_sql)) + { + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . implode(', ', $update_sql[$forum_id]); + } + + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_bumped = 0, topic_bumper = 0'; + + $update_sql = update_post_information('topic', $topic_id, true); + if (!empty($update_sql)) + { + $sql_data[TOPICS_TABLE] .= ', ' . implode(', ', $update_sql[$topic_id]); + $next_post_id = (int) str_replace('topic_last_post_id = ', '', $update_sql[$topic_id][0]); + } + } + + if (!$next_post_id) + { + $sql = 'SELECT MAX(post_id) as last_post_id + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id); + $result = $db->sql_query($sql); + $next_post_id = (int) $db->sql_fetchfield('last_post_id'); + $db->sql_freeresult($result); + } + break; + + case 'delete': + $sql = 'SELECT post_id + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . ' + AND post_time > ' . $data['post_time'] . ' + ORDER BY post_time ASC, post_id ASC'; + $result = $db->sql_query_limit($sql, 1); + $next_post_id = (int) $db->sql_fetchfield('post_id'); + $db->sql_freeresult($result); + break; + } + + if (($post_mode == 'delete') || ($post_mode == 'delete_last_post') || ($post_mode == 'delete_first_post')) + { + if (!$is_soft) + { + $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data); + } + + $sql = 'SELECT 1 AS has_attachments + FROM ' . ATTACHMENTS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query_limit($sql, 1); + $has_attachments = (int) $db->sql_fetchfield('has_attachments'); + $db->sql_freeresult($result); + + if (!$has_attachments) + { + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_attachment = 0'; + } + } + + $db->sql_transaction('begin'); + + $where_sql = array( + FORUMS_TABLE => "forum_id = $forum_id", + TOPICS_TABLE => "topic_id = $topic_id", + USERS_TABLE => 'user_id = ' . $data['poster_id'], + ); + + foreach ($sql_data as $table => $update_sql) + { + if ($update_sql) + { + $db->sql_query("UPDATE $table SET $update_sql WHERE " . $where_sql[$table]); + } + } + + // Adjust posted info for this user by looking for a post by him/her within this topic... + if ($post_mode != 'delete_topic' && $config['load_db_track'] && $data['poster_id'] != ANONYMOUS) + { + $sql = 'SELECT poster_id + FROM ' . POSTS_TABLE . ' + WHERE topic_id = ' . $topic_id . ' + AND poster_id = ' . $data['poster_id']; + $result = $db->sql_query_limit($sql, 1); + $poster_id = (int) $db->sql_fetchfield('poster_id'); + $db->sql_freeresult($result); + + // The user is not having any more posts within this topic + if (!$poster_id) + { + $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . ' + WHERE topic_id = ' . $topic_id . ' + AND user_id = ' . $data['poster_id']; + $db->sql_query($sql); + } + } + + $db->sql_transaction('commit'); + + if ($data['post_reported'] && ($post_mode != 'delete_topic')) + { + sync('topic_reported', 'topic_id', array($topic_id)); + } + + /** + * This event is used for performing actions directly after a post or topic + * has been deleted. + * + * @event core.delete_post_after + * @var int forum_id Post forum ID + * @var int topic_id Post topic ID + * @var int post_id Post ID + * @var array data Post data + * @var bool is_soft Soft delete flag + * @var string softdelete_reason Soft delete reason + * @var string post_mode delete_topic, delete_first_post, delete_last_post or delete + * @var mixed next_post_id Next post ID in the topic (post ID or false) + * + * @since 3.1.11-RC1 + */ + $vars = array( + 'forum_id', + 'topic_id', + 'post_id', + 'data', + 'is_soft', + 'softdelete_reason', + 'post_mode', + 'next_post_id', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_post_after', compact($vars))); + + return $next_post_id; +} + +/** +* Submit Post +* @todo Split up and create lightweight, simple API for this. +*/ +function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data_ary, $update_message = true, $update_search_index = true) +{ + global $db, $auth, $user, $config, $phpEx, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request; + + $poll = $poll_ary; + $data = $data_ary; + /** + * Modify the data for post submitting + * + * @event core.modify_submit_post_data + * @var string mode Variable containing posting mode value + * @var string subject Variable containing post subject value + * @var string username Variable containing post author name + * @var int topic_type Variable containing topic type value + * @var array poll Array with the poll data for the post + * @var array data Array with the data for the post + * @var bool update_message Flag indicating if the post will be updated + * @var bool update_search_index Flag indicating if the search index will be updated + * @since 3.1.0-a4 + */ + $vars = array( + 'mode', + 'subject', + 'username', + 'topic_type', + 'poll', + 'data', + 'update_message', + 'update_search_index', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_submit_post_data', compact($vars))); + $poll_ary = $poll; + $data_ary = $data; + unset($poll); + unset($data); + + // We do not handle erasing posts here + if ($mode == 'delete') + { + return false; + } + + if (!empty($data_ary['post_time'])) + { + $current_time = $data_ary['post_time']; + } + else + { + $current_time = time(); + } + + if ($mode == 'post') + { + $post_mode = 'post'; + $update_message = true; + } + else if ($mode != 'edit') + { + $post_mode = 'reply'; + $update_message = true; + } + else if ($mode == 'edit') + { + $post_mode = ($data_ary['topic_posts_approved'] + $data_ary['topic_posts_unapproved'] + $data_ary['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data_ary['topic_first_post_id'] == $data_ary['post_id']) ? 'edit_first_post' : (($data_ary['topic_last_post_id'] == $data_ary['post_id']) ? 'edit_last_post' : 'edit')); + } + + // First of all make sure the subject and topic title are having the correct length. + // To achieve this without cutting off between special chars we convert to an array and then count the elements. + $subject = truncate_string($subject, 120); + $data_ary['topic_title'] = truncate_string($data_ary['topic_title'], 120); + + // Collect some basic information about which tables and which rows to update/insert + $sql_data = $topic_row = array(); + $poster_id = ($mode == 'edit') ? $data_ary['poster_id'] : (int) $user->data['user_id']; + + // Retrieve some additional information if not present + if ($mode == 'edit' && (!isset($data_ary['post_visibility']) || !isset($data_ary['topic_visibility']) || $data_ary['post_visibility'] === false || $data_ary['topic_visibility'] === false)) + { + $sql = 'SELECT p.post_visibility, t.topic_type, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_visibility + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p + WHERE t.topic_id = p.topic_id + AND p.post_id = ' . $data_ary['post_id']; + $result = $db->sql_query($sql); + $topic_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $data_ary['topic_visibility'] = $topic_row['topic_visibility']; + $data_ary['post_visibility'] = $topic_row['post_visibility']; + } + + // This variable indicates if the user is able to post or put into the queue + $post_visibility = ITEM_APPROVED; + + // Check the permissions for post approval. + // Moderators must go through post approval like ordinary users. + if (!$auth->acl_get('f_noapprove', $data_ary['forum_id'])) + { + // Post not approved, but in queue + $post_visibility = ITEM_UNAPPROVED; + switch ($post_mode) + { + case 'edit_first_post': + case 'edit': + case 'edit_last_post': + case 'edit_topic': + $post_visibility = ITEM_REAPPROVE; + break; + } + } + else if (isset($data_ary['post_visibility']) && $data_ary['post_visibility'] !== false) + { + $post_visibility = $data_ary['post_visibility']; + } + + // MODs/Extensions are able to force any visibility on posts + if (isset($data_ary['force_approved_state'])) + { + $post_visibility = (in_array((int) $data_ary['force_approved_state'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED, ITEM_REAPPROVE))) ? (int) $data_ary['force_approved_state'] : $post_visibility; + } + if (isset($data_ary['force_visibility'])) + { + $post_visibility = (in_array((int) $data_ary['force_visibility'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED, ITEM_REAPPROVE))) ? (int) $data_ary['force_visibility'] : $post_visibility; + } + + // Start the transaction here + $db->sql_transaction('begin'); + + // Collect Information + switch ($post_mode) + { + case 'post': + case 'reply': + $sql_data[POSTS_TABLE]['sql'] = array( + 'forum_id' => $data_ary['forum_id'], + 'poster_id' => (int) $user->data['user_id'], + 'icon_id' => $data_ary['icon_id'], + 'poster_ip' => $user->ip, + 'post_time' => $current_time, + 'post_visibility' => $post_visibility, + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], + 'post_username' => (!$user->data['is_registered']) ? $username : '', + 'post_subject' => $subject, + 'post_text' => $data_ary['message'], + 'post_checksum' => $data_ary['message_md5'], + 'post_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'], + 'post_postcount' => ($auth->acl_get('f_postcount', $data_ary['forum_id'])) ? 1 : 0, + 'post_edit_locked' => $data_ary['post_edit_locked'] + ); + break; + + case 'edit_first_post': + case 'edit': + + case 'edit_last_post': + case 'edit_topic': + + // If edit reason is given always display edit info + + // If editing last post then display no edit info + // If m_edit permission then display no edit info + // If normal edit display edit info + + // Display edit info if edit reason given or user is editing his post, which is not the last within the topic. + if ($data_ary['post_edit_reason'] || (!$auth->acl_get('m_edit', $data_ary['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post'))) + { + $data_ary['post_edit_reason'] = truncate_string($data_ary['post_edit_reason'], 255, 255, false); + + $sql_data[POSTS_TABLE]['sql'] = array( + 'post_edit_time' => $current_time, + 'post_edit_reason' => $data_ary['post_edit_reason'], + 'post_edit_user' => (int) $data_ary['post_edit_user'], + ); + + $sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1'; + } + else if (!$data_ary['post_edit_reason'] && $mode == 'edit' && $auth->acl_get('m_edit', $data_ary['forum_id'])) + { + $sql_data[POSTS_TABLE]['sql'] = array( + 'post_edit_reason' => '', + ); + } + + // If the person editing this post is different to the one having posted then we will add a log entry stating the edit + // Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods + if ($user->data['user_id'] != $poster_id) + { + $log_subject = ($subject) ? $subject : $data_ary['topic_title']; + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_POST_EDITED', false, array( + 'forum_id' => $data_ary['forum_id'], + 'topic_id' => $data_ary['topic_id'], + 'post_id' => $data_ary['post_id'], + $log_subject, + (!empty($username)) ? $username : $user->lang['GUEST'], + $data_ary['post_edit_reason'] + )); + } + + if (!isset($sql_data[POSTS_TABLE]['sql'])) + { + $sql_data[POSTS_TABLE]['sql'] = array(); + } + + $sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array( + 'forum_id' => $data_ary['forum_id'], + 'poster_id' => $data_ary['poster_id'], + 'icon_id' => $data_ary['icon_id'], + // We will change the visibility later + //'post_visibility' => $post_visibility, + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], + 'post_username' => ($username && $data_ary['poster_id'] == ANONYMOUS) ? $username : '', + 'post_subject' => $subject, + 'post_checksum' => $data_ary['message_md5'], + 'post_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'], + 'post_edit_locked' => $data_ary['post_edit_locked']) + ); + + if ($update_message) + { + $sql_data[POSTS_TABLE]['sql']['post_text'] = $data_ary['message']; + } + + break; + } + + // And the topic ladies and gentlemen + switch ($post_mode) + { + case 'post': + $sql_data[TOPICS_TABLE]['sql'] = array( + 'topic_poster' => (int) $user->data['user_id'], + 'topic_time' => $current_time, + 'topic_last_view_time' => $current_time, + 'forum_id' => $data_ary['forum_id'], + 'icon_id' => $data_ary['icon_id'], + 'topic_posts_approved' => ($post_visibility == ITEM_APPROVED) ? 1 : 0, + 'topic_posts_softdeleted' => ($post_visibility == ITEM_DELETED) ? 1 : 0, + 'topic_posts_unapproved' => ($post_visibility == ITEM_UNAPPROVED) ? 1 : 0, + 'topic_visibility' => $post_visibility, + 'topic_delete_user' => ($post_visibility != ITEM_APPROVED) ? (int) $user->data['user_id'] : 0, + 'topic_title' => $subject, + 'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''), + 'topic_first_poster_colour' => $user->data['user_colour'], + 'topic_type' => $topic_type, + 'topic_time_limit' => $topic_type != POST_NORMAL ? ($data_ary['topic_time_limit'] * 86400) : 0, + 'topic_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'topic_status' => (isset($data_ary['topic_status'])) ? $data_ary['topic_status'] : ITEM_UNLOCKED, + ); + + if (isset($poll_ary['poll_options']) && !empty($poll_ary['poll_options'])) + { + $poll_start = ($poll_ary['poll_start']) ? $poll_ary['poll_start'] : $current_time; + $poll_length = $poll_ary['poll_length'] * 86400; + if ($poll_length < 0) + { + $poll_start = $poll_start + $poll_length; + if ($poll_start < 0) + { + $poll_start = 0; + } + $poll_length = 1; + } + + $sql_data[TOPICS_TABLE]['sql'] = array_merge($sql_data[TOPICS_TABLE]['sql'], array( + 'poll_title' => $poll_ary['poll_title'], + 'poll_start' => $poll_start, + 'poll_max_options' => $poll_ary['poll_max_options'], + 'poll_length' => $poll_length, + 'poll_vote_change' => $poll_ary['poll_vote_change']) + ); + } + + $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data_ary['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : ''); + + if ($post_visibility == ITEM_APPROVED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_approved = forum_topics_approved + 1'; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_approved = forum_posts_approved + 1'; + } + else if ($post_visibility == ITEM_UNAPPROVED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_unapproved = forum_topics_unapproved + 1'; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_unapproved = forum_posts_unapproved + 1'; + } + else if ($post_visibility == ITEM_DELETED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_softdeleted = forum_topics_softdeleted + 1'; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_softdeleted = forum_posts_softdeleted + 1'; + } + break; + + case 'reply': + $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_view_time = ' . $current_time . ', + topic_bumped = 0, + topic_bumper = 0' . + (($post_visibility == ITEM_APPROVED) ? ', topic_posts_approved = topic_posts_approved + 1' : '') . + (($post_visibility == ITEM_UNAPPROVED) ? ', topic_posts_unapproved = topic_posts_unapproved + 1' : '') . + (($post_visibility == ITEM_DELETED) ? ', topic_posts_softdeleted = topic_posts_softdeleted + 1' : '') . + ((!empty($data_ary['attachment_data']) || (isset($data_ary['topic_attachment']) && $data_ary['topic_attachment'])) ? ', topic_attachment = 1' : ''); + + $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data_ary['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : ''); + + if ($post_visibility == ITEM_APPROVED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_approved = forum_posts_approved + 1'; + } + else if ($post_visibility == ITEM_UNAPPROVED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_unapproved = forum_posts_unapproved + 1'; + } + else if ($post_visibility == ITEM_DELETED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_softdeleted = forum_posts_softdeleted + 1'; + } + break; + + case 'edit_topic': + case 'edit_first_post': + if (isset($poll_ary['poll_options'])) + { + $poll_start = ($poll_ary['poll_start'] || empty($poll_ary['poll_options'])) ? $poll_ary['poll_start'] : $current_time; + $poll_length = $poll_ary['poll_length'] * 86400; + if ($poll_length < 0) + { + $poll_start = $poll_start + $poll_length; + if ($poll_start < 0) + { + $poll_start = 0; + } + $poll_length = 1; + } + } + + $sql_data[TOPICS_TABLE]['sql'] = array( + 'forum_id' => $data_ary['forum_id'], + 'icon_id' => $data_ary['icon_id'], + 'topic_title' => $subject, + 'topic_first_poster_name' => $username, + 'topic_type' => $topic_type, + 'topic_time_limit' => $topic_type != POST_NORMAL ? ($data_ary['topic_time_limit'] * 86400) : 0, + 'poll_title' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_title'] : '', + 'poll_start' => (isset($poll_ary['poll_options'])) ? $poll_start : 0, + 'poll_max_options' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_max_options'] : 1, + 'poll_length' => (isset($poll_ary['poll_options'])) ? $poll_length : 0, + 'poll_vote_change' => (isset($poll_ary['poll_vote_change'])) ? $poll_ary['poll_vote_change'] : 0, + 'topic_last_view_time' => $current_time, + + 'topic_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : (isset($data_ary['topic_attachment']) ? $data_ary['topic_attachment'] : 0), + ); + + break; + } + + $poll = $poll_ary; + $data = $data_ary; + /** + * Modify sql query data for post submitting + * + * @event core.submit_post_modify_sql_data + * @var array data Array with the data for the post + * @var array poll Array with the poll data for the post + * @var string post_mode Variable containing posting mode value + * @var bool sql_data Array with the data for the posting SQL query + * @var string subject Variable containing post subject value + * @var int topic_type Variable containing topic type value + * @var string username Variable containing post author name + * @since 3.1.3-RC1 + */ + $vars = array( + 'data', + 'poll', + 'post_mode', + 'sql_data', + 'subject', + 'topic_type', + 'username', + ); + extract($phpbb_dispatcher->trigger_event('core.submit_post_modify_sql_data', compact($vars))); + $poll_ary = $poll; + $data_ary = $data; + unset($poll); + unset($data); + + // Submit new topic + if ($post_mode == 'post') + { + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . + $db->sql_build_array('INSERT', $sql_data[TOPICS_TABLE]['sql']); + $db->sql_query($sql); + + $data_ary['topic_id'] = $db->sql_nextid(); + + $sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array( + 'topic_id' => $data_ary['topic_id']) + ); + unset($sql_data[TOPICS_TABLE]['sql']); + } + + // Submit new post + if ($post_mode == 'post' || $post_mode == 'reply') + { + if ($post_mode == 'reply') + { + $sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array( + 'topic_id' => $data_ary['topic_id'], + )); + } + + $sql = 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data[POSTS_TABLE]['sql']); + $db->sql_query($sql); + $data_ary['post_id'] = $db->sql_nextid(); + + if ($post_mode == 'post' || $post_visibility == ITEM_APPROVED) + { + $sql_data[TOPICS_TABLE]['sql'] = array( + 'topic_last_post_id' => $data_ary['post_id'], + 'topic_last_post_time' => $current_time, + 'topic_last_poster_id' => $sql_data[POSTS_TABLE]['sql']['poster_id'], + 'topic_last_poster_name' => ($user->data['user_id'] == ANONYMOUS) ? $sql_data[POSTS_TABLE]['sql']['post_username'] : $user->data['username'], + 'topic_last_poster_colour' => $user->data['user_colour'], + 'topic_last_post_subject' => (string) $subject, + ); + } + + if ($post_mode == 'post') + { + $sql_data[TOPICS_TABLE]['sql']['topic_first_post_id'] = $data_ary['post_id']; + } + + // Update total post count and forum information + if ($post_visibility == ITEM_APPROVED) + { + if ($post_mode == 'post') + { + $config->increment('num_topics', 1, false); + } + $config->increment('num_posts', 1, false); + + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data_ary['post_id']; + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'"; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . $current_time; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $user->data['user_id']; + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape((!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '')) . "'"; + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($user->data['user_colour']) . "'"; + } + + unset($sql_data[POSTS_TABLE]['sql']); + } + + // Update the topics table + if (isset($sql_data[TOPICS_TABLE]['sql'])) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_data[TOPICS_TABLE]['sql']) . ' + WHERE topic_id = ' . $data_ary['topic_id']; + $db->sql_query($sql); + + unset($sql_data[TOPICS_TABLE]['sql']); + } + + // Update the posts table + if (isset($sql_data[POSTS_TABLE]['sql'])) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_data[POSTS_TABLE]['sql']) . ' + WHERE post_id = ' . $data_ary['post_id']; + $db->sql_query($sql); + + unset($sql_data[POSTS_TABLE]['sql']); + } + + // Update Poll Tables + if (isset($poll_ary['poll_options'])) + { + $cur_poll_options = array(); + + if ($mode == 'edit') + { + $sql = 'SELECT * + FROM ' . POLL_OPTIONS_TABLE . ' + WHERE topic_id = ' . $data_ary['topic_id'] . ' + ORDER BY poll_option_id'; + $result = $db->sql_query($sql); + + $cur_poll_options = array(); + while ($row = $db->sql_fetchrow($result)) + { + $cur_poll_options[] = $row; + } + $db->sql_freeresult($result); + } + + $sql_insert_ary = array(); + + for ($i = 0, $size = count($poll_ary['poll_options']); $i < $size; $i++) + { + if (strlen(trim($poll_ary['poll_options'][$i]))) + { + if (empty($cur_poll_options[$i])) + { + // If we add options we need to put them to the end to be able to preserve votes... + $sql_insert_ary[] = array( + 'poll_option_id' => (int) count($cur_poll_options) + 1 + count($sql_insert_ary), + 'topic_id' => (int) $data_ary['topic_id'], + 'poll_option_text' => (string) $poll_ary['poll_options'][$i] + ); + } + else if ($poll_ary['poll_options'][$i] != $cur_poll_options[$i]) + { + $sql = 'UPDATE ' . POLL_OPTIONS_TABLE . " + SET poll_option_text = '" . $db->sql_escape($poll_ary['poll_options'][$i]) . "' + WHERE poll_option_id = " . $cur_poll_options[$i]['poll_option_id'] . ' + AND topic_id = ' . $data_ary['topic_id']; + $db->sql_query($sql); + } + } + } + + $db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary); + + if (count($poll_ary['poll_options']) < count($cur_poll_options)) + { + $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ' + WHERE poll_option_id > ' . count($poll_ary['poll_options']) . ' + AND topic_id = ' . $data_ary['topic_id']; + $db->sql_query($sql); + } + + // If edited, we would need to reset votes (since options can be re-ordered above, you can't be sure if the change is for changing the text or adding an option + if ($mode == 'edit' && count($poll_ary['poll_options']) != count($cur_poll_options)) + { + $db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data_ary['topic_id']); + $db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data_ary['topic_id']); + } + } + + // Submit Attachments + if (!empty($data_ary['attachment_data']) && $data_ary['post_id'] && in_array($mode, array('post', 'reply', 'quote', 'edit'))) + { + $space_taken = $files_added = 0; + $orphan_rows = array(); + + foreach ($data_ary['attachment_data'] as $pos => $attach_row) + { + $orphan_rows[(int) $attach_row['attach_id']] = array(); + } + + if (count($orphan_rows)) + { + $sql = 'SELECT attach_id, filesize, physical_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan_rows)) . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + $orphan_rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $orphan_rows[$row['attach_id']] = $row; + } + $db->sql_freeresult($result); + } + + foreach ($data_ary['attachment_data'] as $pos => $attach_row) + { + if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']])) + { + continue; + } + + if (preg_match('/[\x{10000}-\x{10FFFF}]/u', $attach_row['attach_comment'])) + { + trigger_error('ATTACH_COMMENT_NO_EMOJIS'); + } + + if (!$attach_row['is_orphan']) + { + // update entry in db if attachment already stored in db and filespace + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " + SET attach_comment = '" . $db->sql_escape($attach_row['attach_comment']) . "' + WHERE attach_id = " . (int) $attach_row['attach_id'] . ' + AND is_orphan = 0'; + $db->sql_query($sql); + } + else + { + // insert attachment into db + if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + { + continue; + } + + $space_taken += $orphan_rows[$attach_row['attach_id']]['filesize']; + $files_added++; + + $attach_sql = array( + 'post_msg_id' => $data_ary['post_id'], + 'topic_id' => $data_ary['topic_id'], + 'is_orphan' => 0, + 'poster_id' => $poster_id, + 'attach_comment' => $attach_row['attach_comment'], + ); + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . ' + WHERE attach_id = ' . $attach_row['attach_id'] . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $db->sql_query($sql); + } + } + + if ($space_taken && $files_added) + { + $config->increment('upload_dir_size', $space_taken, false); + $config->increment('num_files', $files_added, false); + } + } + + $first_post_has_topic_info = ($post_mode == 'edit_first_post' && + (($post_visibility == ITEM_DELETED && $data_ary['topic_posts_softdeleted'] == 1) || + ($post_visibility == ITEM_UNAPPROVED && $data_ary['topic_posts_unapproved'] == 1) || + ($post_visibility == ITEM_REAPPROVE && $data_ary['topic_posts_unapproved'] == 1) || + ($post_visibility == ITEM_APPROVED && $data_ary['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_ary['post_visibility'] != $post_visibility) + { + // If the post was not approved, it could also be the starter, + // so we sync the starter after approving/restoring, to ensure that the stats are correct + // Same applies for the last post + $is_starter = ($post_mode == 'edit_first_post' || $post_mode == 'edit_topic' || $data_ary['post_visibility'] != ITEM_APPROVED); + $is_latest = ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $data_ary['post_visibility'] != ITEM_APPROVED); + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + $phpbb_content_visibility->set_post_visibility($post_visibility, $data_ary['post_id'], $data_ary['topic_id'], $data_ary['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest); + } + else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $first_post_has_topic_info) + { + if ($post_visibility == ITEM_APPROVED || $data_ary['topic_visibility'] == $post_visibility) + { + // only the subject can be changed from edit + $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'"; + + // Maybe not only the subject, but also changing anonymous usernames. ;) + if ($data_ary['poster_id'] == ANONYMOUS) + { + $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape($username) . "'"; + } + + if ($post_visibility == ITEM_APPROVED) + { + // this does not _necessarily_ mean that we must update the info again, + // it just means that we might have to + $sql = 'SELECT forum_last_post_id, forum_last_post_subject + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . (int) $data_ary['forum_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // this post is the latest post in the forum, better update + if ($row['forum_last_post_id'] == $data_ary['post_id'] && ($row['forum_last_post_subject'] !== $subject || $data_ary['poster_id'] == ANONYMOUS)) + { + // the post's subject changed + if ($row['forum_last_post_subject'] !== $subject) + { + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'"; + } + + // Update the user name if poster is anonymous... just in case a moderator changed it + if ($data_ary['poster_id'] == ANONYMOUS) + { + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape($username) . "'"; + } + } + } + } + } + + // Update forum stats + $where_sql = array( + POSTS_TABLE => 'post_id = ' . $data_ary['post_id'], + TOPICS_TABLE => 'topic_id = ' . $data_ary['topic_id'], + FORUMS_TABLE => 'forum_id = ' . $data_ary['forum_id'], + USERS_TABLE => 'user_id = ' . $poster_id + ); + + foreach ($sql_data as $table => $update_ary) + { + if (isset($update_ary['stat']) && implode('', $update_ary['stat'])) + { + $sql = "UPDATE $table SET " . implode(', ', $update_ary['stat']) . ' WHERE ' . $where_sql[$table]; + $db->sql_query($sql); + } + } + + // Delete topic shadows (if any exist). We do not need a shadow topic for an global announcement + if ($topic_type == POST_GLOBAL) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE topic_moved_id = ' . $data_ary['topic_id']; + $db->sql_query($sql); + } + + // Committing the transaction before updating search index + $db->sql_transaction('commit'); + + // Delete draft if post was loaded... + $draft_id = $request->variable('draft_loaded', 0); + if ($draft_id) + { + $sql = 'DELETE FROM ' . DRAFTS_TABLE . " + WHERE draft_id = $draft_id + AND user_id = {$user->data['user_id']}"; + $db->sql_query($sql); + } + + // Index message contents + if ($update_search_index && $data_ary['enable_indexing']) + { + // Select the search method and do some additional checks to ensure it can actually be utilised + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if ($error) + { + trigger_error($error); + } + + $search->index($mode, $data_ary['post_id'], $data_ary['message'], $subject, $poster_id, $data_ary['forum_id']); + } + + // Topic Notification, do not change if moderator is changing other users posts... + if ($user->data['user_id'] == $poster_id) + { + if (!$data_ary['notify_set'] && $data_ary['notify']) + { + $sql = 'INSERT INTO ' . TOPICS_WATCH_TABLE . ' (user_id, topic_id) + VALUES (' . $user->data['user_id'] . ', ' . $data_ary['topic_id'] . ')'; + $db->sql_query($sql); + } + else if (($config['email_enable'] || $config['jab_enable']) && $data_ary['notify_set'] && !$data_ary['notify']) + { + $sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . ' + AND topic_id = ' . $data_ary['topic_id']; + $db->sql_query($sql); + } + } + + if ($mode == 'post' || $mode == 'reply' || $mode == 'quote') + { + // Mark this topic as posted to + markread('post', $data_ary['forum_id'], $data_ary['topic_id']); + } + + // Mark this topic as read + // We do not use post_time here, this is intended (post_time can have a date in the past if editing a message) + markread('topic', $data_ary['forum_id'], $data_ary['topic_id'], time()); + + // + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $sql = 'SELECT mark_time + FROM ' . FORUMS_TRACK_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . ' + AND forum_id = ' . $data_ary['forum_id']; + $result = $db->sql_query($sql); + $f_mark_time = (int) $db->sql_fetchfield('mark_time'); + $db->sql_freeresult($result); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $f_mark_time = false; + } + + if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered']) + { + // Update forum info + $sql = 'SELECT forum_last_post_time + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $data_ary['forum_id']; + $result = $db->sql_query($sql); + $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time'); + $db->sql_freeresult($result); + + update_forum_tracking_info($data_ary['forum_id'], $forum_last_post_time, $f_mark_time, false); + } + + // If a username was supplied or the poster is a guest, we will use the supplied username. + // Doing it this way we can use "...post by guest-username..." in notifications when + // "guest-username" is supplied or ommit the username if it is not. + $username = ($username !== '' || !$user->data['is_registered']) ? $username : $user->data['username']; + + // Send Notifications + $notification_data = array_merge($data_ary, array( + 'topic_title' => (isset($data_ary['topic_title'])) ? $data_ary['topic_title'] : $subject, + 'post_username' => $username, + 'poster_id' => $poster_id, + 'post_text' => $data_ary['message'], + 'post_time' => $current_time, + 'post_subject' => $subject, + )); + + /** + * This event allows you to modify the notification data upon submission + * + * @event core.modify_submit_notification_data + * @var array notification_data The notification data to be inserted in to the database + * @var array data_ary The data array with a lot of the post submission data + * @var string mode The posting mode + * @var int poster_id The poster id + * @since 3.2.4-RC1 + */ + $vars = array('notification_data', 'data_ary', 'mode', 'poster_id'); + extract($phpbb_dispatcher->trigger_event('core.modify_submit_notification_data', compact($vars))); + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + if ($post_visibility == ITEM_APPROVED) + { + switch ($mode) + { + case 'post': + $phpbb_notifications->add_notifications(array( + 'notification.type.quote', + 'notification.type.topic', + ), $notification_data); + break; + + case 'reply': + case 'quote': + $phpbb_notifications->add_notifications(array( + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + ), $notification_data); + break; + + case 'edit_topic': + case 'edit_first_post': + case 'edit': + case 'edit_last_post': + if ($user->data['user_id'] == $poster_id) + { + $phpbb_notifications->update_notifications(array( + 'notification.type.quote', + ), $notification_data); + } + + $phpbb_notifications->update_notifications(array( + 'notification.type.bookmark', + 'notification.type.topic', + 'notification.type.post', + ), $notification_data); + break; + } + } + else if ($post_visibility == ITEM_UNAPPROVED) + { + switch ($mode) + { + case 'post': + $phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data); + break; + + case 'reply': + case 'quote': + $phpbb_notifications->add_notifications('notification.type.post_in_queue', $notification_data); + break; + + case 'edit_topic': + case 'edit_first_post': + case 'edit': + case 'edit_last_post': + // Nothing to do here + break; + } + } + else if ($post_visibility == ITEM_REAPPROVE) + { + switch ($mode) + { + case 'edit_topic': + case 'edit_first_post': + $phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data); + + // Delete the approve_post notification so we can notify the user again, + // when his post got reapproved + $phpbb_notifications->delete_notifications('notification.type.approve_post', $notification_data['post_id']); + break; + + case 'edit': + case 'edit_last_post': + $phpbb_notifications->add_notifications('notification.type.post_in_queue', $notification_data); + + // Delete the approve_post notification so we can notify the user again, + // when his post got reapproved + $phpbb_notifications->delete_notifications('notification.type.approve_post', $notification_data['post_id']); + break; + + case 'post': + case 'reply': + case 'quote': + // Nothing to do here + break; + } + } + else if ($post_visibility == ITEM_DELETED) + { + switch ($mode) + { + case 'post': + case 'reply': + case 'quote': + case 'edit_topic': + case 'edit_first_post': + case 'edit': + case 'edit_last_post': + // Nothing to do here + break; + } + } + + $params = $add_anchor = ''; + + if ($post_visibility == ITEM_APPROVED || + ($auth->acl_get('m_softdelete', $data_ary['forum_id']) && $post_visibility == ITEM_DELETED) || + ($auth->acl_get('m_approve', $data_ary['forum_id']) && in_array($post_visibility, array(ITEM_UNAPPROVED, ITEM_REAPPROVE)))) + { + $params .= '&t=' . $data_ary['topic_id']; + + if ($mode != 'post') + { + $params .= '&p=' . $data_ary['post_id']; + $add_anchor = '#p' . $data_ary['post_id']; + } + } + else if ($mode != 'post' && $post_mode != 'edit_first_post' && $post_mode != 'edit_topic') + { + $params .= '&t=' . $data_ary['topic_id']; + } + + $url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx"; + $url = append_sid($url, 'f=' . $data_ary['forum_id'] . $params) . $add_anchor; + + $poll = $poll_ary; + $data = $data_ary; + /** + * This event is used for performing actions directly after a post or topic + * has been submitted. When a new topic is posted, the topic ID is + * available in the $data array. + * + * The only action that can be done by altering data made available to this + * event is to modify the return URL ($url). + * + * @event core.submit_post_end + * @var string mode Variable containing posting mode value + * @var string subject Variable containing post subject value + * @var string username Variable containing post author name + * @var int topic_type Variable containing topic type value + * @var array poll Array with the poll data for the post + * @var array data Array with the data for the post + * @var int post_visibility Variable containing up to date post visibility + * @var bool update_message Flag indicating if the post will be updated + * @var bool update_search_index Flag indicating if the search index will be updated + * @var string url The "Return to topic" URL + * + * @since 3.1.0-a3 + * @changed 3.1.0-RC3 Added vars mode, subject, username, topic_type, + * poll, update_message, update_search_index + */ + $vars = array( + 'mode', + 'subject', + 'username', + 'topic_type', + 'poll', + 'data', + 'post_visibility', + 'update_message', + 'update_search_index', + 'url', + ); + extract($phpbb_dispatcher->trigger_event('core.submit_post_end', compact($vars))); + $data_ary = $data; + $poll_ary = $poll; + unset($data); + unset($poll); + + return $url; +} + +/** +* Handle topic bumping +* @param int $forum_id The ID of the forum the topic is being bumped belongs to +* @param int $topic_id The ID of the topic is being bumping +* @param array $post_data Passes some topic parameters: +* - 'topic_title' +* - 'topic_last_post_id' +* - 'topic_last_poster_id' +* - 'topic_last_post_subject' +* - 'topic_last_poster_name' +* - 'topic_last_poster_colour' +* @param int $bump_time The time at which topic was bumped, usually it is a current time as obtained via time(). +* @return string An URL to the bumped topic, example: ./viewtopic.php?forum_id=1&topic_id=2&p=3#p3 +*/ +function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false) +{ + global $config, $db, $user, $phpEx, $phpbb_root_path, $phpbb_log; + + if ($bump_time === false) + { + $bump_time = time(); + } + + // Begin bumping + $db->sql_transaction('begin'); + + // Update the topic's last post post_time + $sql = 'UPDATE ' . POSTS_TABLE . " + SET post_time = $bump_time + WHERE post_id = {$post_data['topic_last_post_id']} + AND topic_id = $topic_id"; + $db->sql_query($sql); + + // Sync the topic's last post time, the rest of the topic's last post data isn't changed + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_last_post_time = $bump_time, + topic_bumped = 1, + topic_bumper = " . $user->data['user_id'] . " + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + + // Update the forum's last post info + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET forum_last_post_id = " . $post_data['topic_last_post_id'] . ", + forum_last_poster_id = " . $post_data['topic_last_poster_id'] . ", + forum_last_post_subject = '" . $db->sql_escape($post_data['topic_last_post_subject']) . "', + forum_last_post_time = $bump_time, + forum_last_poster_name = '" . $db->sql_escape($post_data['topic_last_poster_name']) . "', + forum_last_poster_colour = '" . $db->sql_escape($post_data['topic_last_poster_colour']) . "' + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + // Update bumper's time of the last posting to prevent flood + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastpost_time = $bump_time + WHERE user_id = " . $user->data['user_id']; + $db->sql_query($sql); + + $db->sql_transaction('commit'); + + // Mark this topic as posted to + markread('post', $forum_id, $topic_id, $bump_time); + + // Mark this topic as read + markread('topic', $forum_id, $topic_id, $bump_time); + + // Update forum tracking info + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $sql = 'SELECT mark_time + FROM ' . FORUMS_TRACK_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . ' + AND forum_id = ' . $forum_id; + $result = $db->sql_query($sql); + $f_mark_time = (int) $db->sql_fetchfield('mark_time'); + $db->sql_freeresult($result); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $f_mark_time = false; + } + + if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered']) + { + // Update forum info + $sql = 'SELECT forum_last_post_time + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_id; + $result = $db->sql_query($sql); + $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time'); + $db->sql_freeresult($result); + + update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time, false); + } + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_BUMP_TOPIC', false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $post_data['topic_title'] + )); + + $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}"; + + return $url; +} + +/** +* Show upload popup (progress bar) +*/ +function phpbb_upload_popup($forum_style = 0) +{ + global $template, $user; + + ($forum_style) ? $user->setup('posting', $forum_style) : $user->setup('posting'); + + page_header($user->lang['PROGRESS_BAR']); + + $template->set_filenames(array( + 'popup' => 'posting_progress_bar.html') + ); + + $template->assign_vars(array( + 'PROGRESS_BAR' => $user->img('upload_bar', $user->lang['UPLOAD_IN_PROGRESS'])) + ); + + $template->display('popup'); + + garbage_collection(); + exit_handler(); +} + +/** +* Do the various checks required for removing posts as well as removing it +* +* @param int $forum_id The id of the forum +* @param int $topic_id The id of the topic +* @param int $post_id The id of the post +* @param array $post_data Array with the post data +* @param bool $is_soft The flag indicating whether it is the soft delete mode +* @param string $delete_reason Description for the post deletion reason +* +* @return null +*/ +function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '') +{ + global $user, $auth, $config, $request; + global $phpbb_root_path, $phpEx, $phpbb_log, $phpbb_dispatcher; + + $force_delete_allowed = $force_softdelete_allowed = false; + $perm_check = ($is_soft) ? 'softdelete' : 'delete'; + + /** + * This event allows to modify the conditions for the post deletion + * + * @event core.handle_post_delete_conditions + * @var int forum_id The id of the forum + * @var int topic_id The id of the topic + * @var int post_id The id of the post + * @var array post_data Array with the post data + * @var bool is_soft The flag indicating whether it is the soft delete mode + * @var string delete_reason Description for the post deletion reason + * @var bool force_delete_allowed Allow the user to delete the post (all permissions and conditions are ignored) + * @var bool force_softdelete_allowed Allow the user to softdelete the post (all permissions and conditions are ignored) + * @var string perm_check The deletion mode softdelete|delete + * @since 3.1.11-RC1 + */ + $vars = array( + 'forum_id', + 'topic_id', + 'post_id', + 'post_data', + 'is_soft', + 'delete_reason', + 'force_delete_allowed', + 'force_softdelete_allowed', + 'perm_check', + ); + extract($phpbb_dispatcher->trigger_event('core.handle_post_delete_conditions', compact($vars))); + + // If moderator removing post or user itself removing post, present a confirmation screen + if ($force_delete_allowed || ($is_soft && $force_softdelete_allowed) || $auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']))) + { + $s_hidden_fields = array( + 'p' => $post_id, + 'f' => $forum_id, + 'mode' => ($is_soft) ? 'soft_delete' : 'delete', + ); + + if (confirm_box(true)) + { + $data = array( + 'topic_first_post_id' => $post_data['topic_first_post_id'], + 'topic_last_post_id' => $post_data['topic_last_post_id'], + 'topic_posts_approved' => $post_data['topic_posts_approved'], + 'topic_posts_unapproved' => $post_data['topic_posts_unapproved'], + 'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'], + 'topic_visibility' => $post_data['topic_visibility'], + 'topic_type' => $post_data['topic_type'], + 'post_visibility' => $post_data['post_visibility'], + 'post_reported' => $post_data['post_reported'], + 'post_time' => $post_data['post_time'], + 'poster_id' => $post_data['poster_id'], + 'post_postcount' => $post_data['post_postcount'], + ); + + $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $delete_reason); + $post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username']; + + if ($next_post_id === false) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $post_data['topic_title'], + $post_username, + $delete_reason + )); + + $meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"); + $message = $user->lang['POST_DELETED']; + } + else + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + 'post_id' => $post_id, + $post_data['post_subject'], + $post_username, + $delete_reason + )); + + $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; + $message = $user->lang['POST_DELETED']; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); + } + } + + meta_refresh(3, $meta_info); + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_FORUM', '', ''); + } + trigger_error($message); + } + else + { + global $template; + + $can_delete = $force_delete_allowed || ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id))); + $can_softdelete = $force_softdelete_allowed || ($auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id))); + + $template->assign_vars(array( + 'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED, + 'S_CHECKED_PERMANENT' => $request->is_set_post('delete_permanent') ? ' checked="checked"' : '', + 'S_ALLOWED_DELETE' => $can_delete, + 'S_ALLOWED_SOFTDELETE' => $can_softdelete, + )); + + $l_confirm = 'DELETE_POST'; + if ($post_data['post_visibility'] == ITEM_DELETED) + { + $l_confirm .= '_PERMANENTLY'; + $s_hidden_fields['delete_permanent'] = '1'; + } + else if (!$can_softdelete) + { + $s_hidden_fields['delete_permanent'] = '1'; + } + + confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html'); + } + } + + // If we are here the user is not able to delete - present the correct error message + if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) + { + trigger_error('DELETE_OWN_POSTS'); + } + + if ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id']) + { + trigger_error('CANNOT_DELETE_REPLIED'); + } + + trigger_error('USER_CANNOT_DELETE'); +} diff --git a/install/update/new/includes/functions_privmsgs.php b/install/update/new/includes/functions_privmsgs.php new file mode 100644 index 0000000..f07512d --- /dev/null +++ b/install/update/new/includes/functions_privmsgs.php @@ -0,0 +1,2303 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/* + Ability to simply add own rules by doing three things: + 1) Add an appropriate constant + 2) Add a new check array to the global_privmsgs_rules variable and the condition array (if one is required) + 3) Implement the rule logic in the check_rule() function + 4) Add a new language variable to ucp.php + + The user is then able to select the new rule. It will be checked against and handled as specified. + To add new actions (yes, checks can be added here too) to the rule management, the core code has to be modified. +*/ + +define('RULE_IS_LIKE', 1); // Is Like +define('RULE_IS_NOT_LIKE', 2); // Is Not Like +define('RULE_IS', 3); // Is +define('RULE_IS_NOT', 4); // Is Not +define('RULE_BEGINS_WITH', 5); // Begins with +define('RULE_ENDS_WITH', 6); // Ends with +define('RULE_IS_FRIEND', 7); // Is Friend +define('RULE_IS_FOE', 8); // Is Foe +define('RULE_IS_USER', 9); // Is User +define('RULE_IS_GROUP', 10); // Is In Usergroup +define('RULE_ANSWERED', 11); // Answered +define('RULE_FORWARDED', 12); // Forwarded +define('RULE_TO_GROUP', 14); // Usergroup +define('RULE_TO_ME', 15); // Me + +define('ACTION_PLACE_INTO_FOLDER', 1); +define('ACTION_MARK_AS_READ', 2); +define('ACTION_MARK_AS_IMPORTANT', 3); +define('ACTION_DELETE_MESSAGE', 4); + +define('CHECK_SUBJECT', 1); +define('CHECK_SENDER', 2); +define('CHECK_MESSAGE', 3); +define('CHECK_STATUS', 4); +define('CHECK_TO', 5); + +/** +* Global private message rules +* These rules define what to do if a rule is hit +*/ +$global_privmsgs_rules = array( + CHECK_SUBJECT => array( + RULE_IS_LIKE => array('check0' => 'message_subject'), + RULE_IS_NOT_LIKE => array('check0' => 'message_subject'), + RULE_IS => array('check0' => 'message_subject'), + RULE_IS_NOT => array('check0' => 'message_subject'), + RULE_BEGINS_WITH => array('check0' => 'message_subject'), + RULE_ENDS_WITH => array('check0' => 'message_subject'), + ), + + CHECK_SENDER => array( + RULE_IS_LIKE => array('check0' => 'username'), + RULE_IS_NOT_LIKE => array('check0' => 'username'), + RULE_IS => array('check0' => 'username'), + RULE_IS_NOT => array('check0' => 'username'), + RULE_BEGINS_WITH => array('check0' => 'username'), + RULE_ENDS_WITH => array('check0' => 'username'), + RULE_IS_FRIEND => array('check0' => 'friend'), + RULE_IS_FOE => array('check0' => 'foe'), + RULE_IS_USER => array('check0' => 'author_id'), + RULE_IS_GROUP => array('check0' => 'author_in_group'), + ), + + CHECK_MESSAGE => array( + RULE_IS_LIKE => array('check0' => 'message_text'), + RULE_IS_NOT_LIKE => array('check0' => 'message_text'), + RULE_IS => array('check0' => 'message_text'), + RULE_IS_NOT => array('check0' => 'message_text'), + ), + + CHECK_STATUS => array( + RULE_ANSWERED => array('check0' => 'pm_replied'), + RULE_FORWARDED => array('check0' => 'pm_forwarded'), + ), + + CHECK_TO => array( + RULE_TO_GROUP => array('check0' => 'to', 'check1' => 'bcc', 'check2' => 'user_in_group'), + RULE_TO_ME => array('check0' => 'to', 'check1' => 'bcc'), + ) +); + +/** +* This is for defining which condition fields to show for which Rule +*/ +$global_rule_conditions = array( + RULE_IS_LIKE => 'text', + RULE_IS_NOT_LIKE => 'text', + RULE_IS => 'text', + RULE_IS_NOT => 'text', + RULE_BEGINS_WITH => 'text', + RULE_ENDS_WITH => 'text', + RULE_IS_USER => 'user', + RULE_IS_GROUP => 'group' +); + +/** +* Get all folder +*/ +function get_folder($user_id, $folder_id = false) +{ + global $db, $user, $template; + global $phpbb_root_path, $phpEx; + + $folder = array(); + + // Get folder information + $sql = 'SELECT folder_id, COUNT(msg_id) as num_messages, SUM(pm_unread) as num_unread + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id <> " . PRIVMSGS_NO_BOX . ' + GROUP BY folder_id'; + $result = $db->sql_query($sql); + + $num_messages = $num_unread = array(); + while ($row = $db->sql_fetchrow($result)) + { + $num_messages[(int) $row['folder_id']] = $row['num_messages']; + $num_unread[(int) $row['folder_id']] = $row['num_unread']; + } + $db->sql_freeresult($result); + + // Make sure the default boxes are defined + $available_folder = array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX); + + foreach ($available_folder as $default_folder) + { + if (!isset($num_messages[$default_folder])) + { + $num_messages[$default_folder] = 0; + } + + if (!isset($num_unread[$default_folder])) + { + $num_unread[$default_folder] = 0; + } + } + + // Adjust unread status for outbox + $num_unread[PRIVMSGS_OUTBOX] = $num_messages[PRIVMSGS_OUTBOX]; + + $folder[PRIVMSGS_INBOX] = array( + 'folder_name' => $user->lang['PM_INBOX'], + 'num_messages' => $num_messages[PRIVMSGS_INBOX], + 'unread_messages' => $num_unread[PRIVMSGS_INBOX] + ); + + // Custom Folder + $sql = 'SELECT folder_id, folder_name, pm_count + FROM ' . PRIVMSGS_FOLDER_TABLE . " + WHERE user_id = $user_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $folder[$row['folder_id']] = array( + 'folder_name' => $row['folder_name'], + 'num_messages' => $row['pm_count'], + 'unread_messages' => ((isset($num_unread[$row['folder_id']])) ? $num_unread[$row['folder_id']] : 0) + ); + } + $db->sql_freeresult($result); + + $folder[PRIVMSGS_OUTBOX] = array( + 'folder_name' => $user->lang['PM_OUTBOX'], + 'num_messages' => $num_messages[PRIVMSGS_OUTBOX], + 'unread_messages' => $num_unread[PRIVMSGS_OUTBOX] + ); + + $folder[PRIVMSGS_SENTBOX] = array( + 'folder_name' => $user->lang['PM_SENTBOX'], + 'num_messages' => $num_messages[PRIVMSGS_SENTBOX], + 'unread_messages' => $num_unread[PRIVMSGS_SENTBOX] + ); + + // Define Folder Array for template designers (and for making custom folders usable by the template too) + foreach ($folder as $f_id => $folder_ary) + { + $folder_id_name = ($f_id == PRIVMSGS_INBOX) ? 'inbox' : (($f_id == PRIVMSGS_OUTBOX) ? 'outbox' : 'sentbox'); + + $template->assign_block_vars('folder', array( + 'FOLDER_ID' => $f_id, + 'FOLDER_NAME' => $folder_ary['folder_name'], + 'NUM_MESSAGES' => $folder_ary['num_messages'], + 'UNREAD_MESSAGES' => $folder_ary['unread_messages'], + + 'U_FOLDER' => ($f_id > 0) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $f_id) : append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $folder_id_name), + + 'S_CUR_FOLDER' => ($f_id === $folder_id) ? true : false, + 'S_UNREAD_MESSAGES' => ($folder_ary['unread_messages']) ? true : false, + 'S_CUSTOM_FOLDER' => ($f_id > 0) ? true : false) + ); + } + + if ($folder_id !== false && $folder_id !== PRIVMSGS_HOLD_BOX && !isset($folder[$folder_id])) + { + trigger_error('UNKNOWN_FOLDER'); + } + + return $folder; +} + +/** +* Delete Messages From Sentbox +* we are doing this here because this saves us a bunch of checks and queries +*/ +function clean_sentbox($num_sentbox_messages) +{ + global $db, $user; + + // Check Message Limit + if ($user->data['message_limit'] && $num_sentbox_messages > $user->data['message_limit']) + { + // Delete old messages + $sql = 'SELECT t.msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p + WHERE t.msg_id = p.msg_id + AND t.user_id = ' . $user->data['user_id'] . ' + AND t.folder_id = ' . PRIVMSGS_SENTBOX . ' + ORDER BY p.message_time ASC'; + $result = $db->sql_query_limit($sql, ($num_sentbox_messages - $user->data['message_limit'])); + + $delete_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $delete_ids[] = $row['msg_id']; + } + $db->sql_freeresult($result); + delete_pm($user->data['user_id'], $delete_ids, PRIVMSGS_SENTBOX); + } +} + +/** +* Check Rule against Message Information +*/ +function check_rule(&$rules, &$rule_row, &$message_row, $user_id) +{ + if (!isset($rules[$rule_row['rule_check']][$rule_row['rule_connection']])) + { + return false; + } + + $check_ary = $rules[$rule_row['rule_check']][$rule_row['rule_connection']]; + + $result = false; + + $check0 = $message_row[$check_ary['check0']]; + + switch ($rule_row['rule_connection']) + { + case RULE_IS_LIKE: + $result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); + break; + + case RULE_IS_NOT_LIKE: + $result = !preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); + break; + + case RULE_IS: + $result = ($check0 == $rule_row['rule_string']); + break; + + case RULE_IS_NOT: + $result = ($check0 != $rule_row['rule_string']); + break; + + case RULE_BEGINS_WITH: + $result = preg_match("/^" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); + break; + + case RULE_ENDS_WITH: + $result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '$/i', $check0); + break; + + case RULE_IS_FRIEND: + case RULE_IS_FOE: + case RULE_ANSWERED: + case RULE_FORWARDED: + $result = ($check0 == 1); + break; + + case RULE_IS_USER: + $result = ($check0 == $rule_row['rule_user_id']); + break; + + case RULE_IS_GROUP: + $result = in_array($rule_row['rule_group_id'], $check0); + break; + + case RULE_TO_GROUP: + $result = (in_array('g_' . $message_row[$check_ary['check2']], $check0) || in_array('g_' . $message_row[$check_ary['check2']], $message_row[$check_ary['check1']])); + break; + + case RULE_TO_ME: + $result = (in_array('u_' . $user_id, $check0) || in_array('u_' . $user_id, $message_row[$check_ary['check1']])); + break; + } + + if (!$result) + { + return false; + } + + switch ($rule_row['rule_action']) + { + case ACTION_PLACE_INTO_FOLDER: + return array('action' => $rule_row['rule_action'], 'folder_id' => $rule_row['rule_folder_id']); + break; + + case ACTION_MARK_AS_READ: + case ACTION_MARK_AS_IMPORTANT: + return array('action' => $rule_row['rule_action'], 'pm_unread' => $message_row['pm_unread'], 'pm_marked' => $message_row['pm_marked']); + break; + + case ACTION_DELETE_MESSAGE: + global $db; + + // Check for admins/mods - users are not allowed to remove those messages... + // We do the check here to make sure the data we use is consistent + $sql = 'SELECT user_id, user_type, user_permissions + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $message_row['author_id']; + $result = $db->sql_query($sql); + $userdata = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $auth2 = new \phpbb\auth\auth(); + $auth2->acl($userdata); + + if (!$auth2->acl_get('a_') && !$auth2->acl_get('m_') && !$auth2->acl_getf_global('m_')) + { + return array('action' => $rule_row['rule_action'], 'pm_unread' => $message_row['pm_unread'], 'pm_marked' => $message_row['pm_marked']); + } + + return false; + break; + + default: + return false; + } + + return false; +} + +/** +* Update user PM count +*/ +function update_pm_counts() +{ + global $user, $db; + + // Update unread count + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE pm_unread = 1 + AND folder_id <> ' . PRIVMSGS_OUTBOX . ' + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $user->data['user_unread_privmsg'] = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + + // Update new pm count + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE pm_new = 1 + AND folder_id IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $user->data['user_new_privmsg'] = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + 'user_unread_privmsg' => (int) $user->data['user_unread_privmsg'], + 'user_new_privmsg' => (int) $user->data['user_new_privmsg'], + )) . ' WHERE user_id = ' . $user->data['user_id']); + + // Ok, here we need to repair something, other boxes than privmsgs_no_box and privmsgs_hold_box should not carry the pm_new flag. + if (!$user->data['user_new_privmsg']) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_new = 0 + WHERE pm_new = 1 + AND folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + } +} + +/** +* Place new messages into appropriate folder +*/ +function place_pm_into_folder(&$global_privmsgs_rules, $release = false) +{ + global $db, $user, $config; + + if (!$user->data['user_new_privmsg']) + { + return array('not_moved' => 0, 'removed' => 0); + } + + $user_message_rules = (int) $user->data['user_message_rules']; + $user_id = (int) $user->data['user_id']; + + $action_ary = $move_into_folder = array(); + $num_removed = 0; + + // Newly processing on-hold messages + if ($release) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET folder_id = ' . PRIVMSGS_NO_BOX . ' + WHERE folder_id = ' . PRIVMSGS_HOLD_BOX . " + AND user_id = $user_id"; + $db->sql_query($sql); + } + + // Get those messages not yet placed into any box + $retrieve_sql = 'SELECT t.*, p.*, u.username, u.user_id, u.group_id + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE t.user_id = $user_id + AND p.author_id = u.user_id + AND t.folder_id = " . PRIVMSGS_NO_BOX . ' + AND t.msg_id = p.msg_id'; + + // Just place into the appropriate arrays if no rules need to be checked + if (!$user_message_rules) + { + $result = $db->sql_query($retrieve_sql); + + while ($row = $db->sql_fetchrow($result)) + { + $action_ary[$row['msg_id']][] = array('action' => false); + } + $db->sql_freeresult($result); + } + else + { + $user_rules = $zebra = $check_rows = array(); + $user_ids = $memberships = array(); + + // First of all, grab all rules and retrieve friends/foes + $sql = 'SELECT * + FROM ' . PRIVMSGS_RULES_TABLE . " + WHERE user_id = $user_id"; + $result = $db->sql_query($sql); + $user_rules = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + if (count($user_rules)) + { + $sql = 'SELECT zebra_id, friend, foe + FROM ' . ZEBRA_TABLE . " + WHERE user_id = $user_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $zebra[$row['zebra_id']] = $row; + } + $db->sql_freeresult($result); + } + + // Now build a bare-bone check_row array + $result = $db->sql_query($retrieve_sql); + + while ($row = $db->sql_fetchrow($result)) + { + $check_rows[] = array_merge($row, array( + 'to' => explode(':', $row['to_address']), + 'bcc' => explode(':', $row['bcc_address']), + 'friend' => (isset($zebra[$row['author_id']])) ? $zebra[$row['author_id']]['friend'] : 0, + 'foe' => (isset($zebra[$row['author_id']])) ? $zebra[$row['author_id']]['foe'] : 0, + 'user_in_group' => $user->data['group_id'], + 'author_in_group' => array()) + ); + + $user_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + // Retrieve user memberships + if (count($user_ids)) + { + $sql = 'SELECT * + FROM ' . USER_GROUP_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_ids) . ' + AND user_pending = 0'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $memberships[$row['user_id']][] = $row['group_id']; + } + $db->sql_freeresult($result); + } + + // Now place into the appropriate folder + foreach ($check_rows as $row) + { + // Add membership if set + if (isset($memberships[$row['author_id']])) + { + $row['author_in_group'] = $memberships[$row['user_id']]; + } + + // Check Rule - this should be very quick since we have all information we need + $is_match = false; + foreach ($user_rules as $rule_row) + { + if (($action = check_rule($global_privmsgs_rules, $rule_row, $row, $user_id)) !== false) + { + $is_match = true; + $action_ary[$row['msg_id']][] = $action; + } + } + + if (!$is_match) + { + $action_ary[$row['msg_id']][] = array('action' => false); + } + } + + unset($user_rules, $zebra, $check_rows, $user_ids, $memberships); + } + + // We place actions into arrays, to save queries. + $unread_ids = $delete_ids = $important_ids = array(); + + foreach ($action_ary as $msg_id => $msg_ary) + { + // It is allowed to execute actions more than once, except placing messages into folder + $folder_action = $message_removed = false; + + foreach ($msg_ary as $pos => $rule_ary) + { + if ($folder_action && $rule_ary['action'] == ACTION_PLACE_INTO_FOLDER) + { + continue; + } + + switch ($rule_ary['action']) + { + case ACTION_PLACE_INTO_FOLDER: + // Folder actions have precedence, so we will remove any other ones + $folder_action = true; + $move_into_folder[(int) $rule_ary['folder_id']][] = $msg_id; + break; + + case ACTION_MARK_AS_READ: + if ($rule_ary['pm_unread']) + { + $unread_ids[] = $msg_id; + } + break; + + case ACTION_DELETE_MESSAGE: + $delete_ids[] = $msg_id; + $message_removed = true; + break; + + case ACTION_MARK_AS_IMPORTANT: + if (!$rule_ary['pm_marked']) + { + $important_ids[] = $msg_id; + } + break; + } + } + + // We place this here because it could happen that the messages are doubled if a rule marks a message and then moves it into a specific + // folder. Here we simply move the message into the INBOX if it gets not removed and also not put into a custom folder. + if (!$folder_action && !$message_removed) + { + $move_into_folder[PRIVMSGS_INBOX][] = $msg_id; + } + } + + // Do not change the order of processing + // The number of queries needed to be executed here highly depends on the defined rules and are + // only gone through if new messages arrive. + + // Delete messages + if (count($delete_ids)) + { + $num_removed += count($delete_ids); + delete_pm($user_id, $delete_ids, PRIVMSGS_NO_BOX); + } + + // Set messages to Unread + if (count($unread_ids)) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_unread = 0 + WHERE ' . $db->sql_in_set('msg_id', $unread_ids) . " + AND user_id = $user_id + AND folder_id = " . PRIVMSGS_NO_BOX; + $db->sql_query($sql); + } + + // mark messages as important + if (count($important_ids)) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_marked = 1 - pm_marked + WHERE folder_id = ' . PRIVMSGS_NO_BOX . " + AND user_id = $user_id + AND " . $db->sql_in_set('msg_id', $important_ids); + $db->sql_query($sql); + } + + // Move into folder + $folder = array(); + + if (count($move_into_folder)) + { + // Determine Full Folder Action - we need the move to folder id later eventually + $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; + + $sql_folder = array_keys($move_into_folder); + if ($full_folder_action >= 0) + { + $sql_folder[] = $full_folder_action; + } + + $sql = 'SELECT folder_id, pm_count + FROM ' . PRIVMSGS_FOLDER_TABLE . ' + WHERE ' . $db->sql_in_set('folder_id', $sql_folder) . " + AND user_id = $user_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $folder[(int) $row['folder_id']] = (int) $row['pm_count']; + } + $db->sql_freeresult($result); + + unset($sql_folder); + + if (isset($move_into_folder[PRIVMSGS_INBOX])) + { + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id = " . PRIVMSGS_INBOX; + $result = $db->sql_query($sql); + $folder[PRIVMSGS_INBOX] = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + } + } + + // Here we have ideally only one folder to move into + foreach ($move_into_folder as $folder_id => $msg_ary) + { + $dest_folder = $folder_id; + $full_folder_action = FULL_FOLDER_NONE; + + // Check Message Limit - we calculate with the complete array, most of the time it is one message + // But we are making sure that the other way around works too (more messages in queue than allowed to be stored) + if ($user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + count($msg_ary)) > $user->data['message_limit']) + { + $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; + + // If destination folder itself is full... + if ($full_folder_action >= 0 && ($folder[$full_folder_action] + count($msg_ary)) > $user->data['message_limit']) + { + $full_folder_action = $config['full_folder_action'] - (FULL_FOLDER_NONE*(-1)); + } + + // If Full Folder Action is to move to another folder, we simply adjust the destination folder + if ($full_folder_action >= 0) + { + $dest_folder = $full_folder_action; + } + else if ($full_folder_action == FULL_FOLDER_DELETE) + { + // Delete some messages. NOTE: Ordered by msg_id here instead of message_time! + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id = $dest_folder + ORDER BY msg_id ASC"; + $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + count($msg_ary)) - $user->data['message_limit'])); + + $delete_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $delete_ids[] = $row['msg_id']; + } + $db->sql_freeresult($result); + + $num_removed += count($delete_ids); + delete_pm($user_id, $delete_ids, $dest_folder); + } + } + + // + if ($full_folder_action == FULL_FOLDER_HOLD) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET folder_id = ' . PRIVMSGS_HOLD_BOX . ' + WHERE folder_id = ' . PRIVMSGS_NO_BOX . " + AND user_id = $user_id + AND " . $db->sql_in_set('msg_id', $msg_ary); + $db->sql_query($sql); + } + else + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " + SET folder_id = $dest_folder, pm_new = 0 + WHERE folder_id = " . PRIVMSGS_NO_BOX . " + AND user_id = $user_id + AND pm_new = 1 + AND " . $db->sql_in_set('msg_id', $msg_ary); + $db->sql_query($sql); + + if ($dest_folder != PRIVMSGS_INBOX) + { + $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . ' + SET pm_count = pm_count + ' . (int) $db->sql_affectedrows() . " + WHERE folder_id = $dest_folder + AND user_id = $user_id"; + $db->sql_query($sql); + } + } + } + + if (count($action_ary)) + { + // Move from OUTBOX to SENTBOX + // We are not checking any full folder status here... SENTBOX is a special treatment (old messages get deleted) + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET folder_id = ' . PRIVMSGS_SENTBOX . ' + WHERE folder_id = ' . PRIVMSGS_OUTBOX . ' + AND ' . $db->sql_in_set('msg_id', array_keys($action_ary)); + $db->sql_query($sql); + } + + // Update new/unread count + update_pm_counts(); + + // Now check how many messages got not moved... + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id = " . PRIVMSGS_HOLD_BOX; + $result = $db->sql_query($sql); + $num_not_moved = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + + return array('not_moved' => $num_not_moved, 'removed' => $num_removed); +} + +/** +* Move PM from one to another folder +*/ +function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_folder_id) +{ + global $db, $user; + global $phpbb_root_path, $phpEx; + + $num_moved = 0; + + if (!is_array($move_msg_ids)) + { + $move_msg_ids = array($move_msg_ids); + } + + if (count($move_msg_ids) && !in_array($dest_folder, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) && + !in_array($cur_folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)) && $cur_folder_id != $dest_folder) + { + // We have to check the destination folder ;) + if ($dest_folder != PRIVMSGS_INBOX) + { + $sql = 'SELECT folder_id, folder_name, pm_count + FROM ' . PRIVMSGS_FOLDER_TABLE . " + WHERE folder_id = $dest_folder + AND user_id = $user_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } + + if ($message_limit && $row['pm_count'] + count($move_msg_ids) > $message_limit) + { + $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $row['folder_name']) . '

'; + $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $row['folder_name']); + trigger_error($message); + } + } + else + { + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE folder_id = ' . PRIVMSGS_INBOX . " + AND user_id = $user_id"; + $result = $db->sql_query($sql); + $num_messages = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + + if ($message_limit && $num_messages + count($move_msg_ids) > $message_limit) + { + $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $user->lang['PM_INBOX']) . '

'; + $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_INBOX']); + trigger_error($message); + } + } + + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " + SET folder_id = $dest_folder + WHERE folder_id = $cur_folder_id + AND user_id = $user_id + AND " . $db->sql_in_set('msg_id', $move_msg_ids); + $db->sql_query($sql); + $num_moved = $db->sql_affectedrows(); + + // Update pm counts + if ($num_moved) + { + if (!in_array($cur_folder_id, array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX))) + { + $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . " + SET pm_count = pm_count - $num_moved + WHERE folder_id = $cur_folder_id + AND user_id = $user_id"; + $db->sql_query($sql); + } + + if ($dest_folder != PRIVMSGS_INBOX) + { + $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . " + SET pm_count = pm_count + $num_moved + WHERE folder_id = $dest_folder + AND user_id = $user_id"; + $db->sql_query($sql); + } + } + } + else if (in_array($cur_folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX))) + { + trigger_error('CANNOT_MOVE_SPECIAL'); + } + + return $num_moved; +} + +/** +* Update unread message status +*/ +function update_unread_status($unread, $msg_id, $user_id, $folder_id) +{ + if (!$unread) + { + return; + } + + global $db, $user, $phpbb_container; + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->mark_notifications('notification.type.pm', $msg_id, $user_id); + + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " + SET pm_unread = 0 + WHERE msg_id = $msg_id + AND user_id = $user_id + AND folder_id = $folder_id + AND pm_unread = 1"; + $db->sql_query($sql); + + // If the message is already marked as read, we just skip the rest to avoid negative PM count + if (!$db->sql_affectedrows()) + { + return; + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_unread_privmsg = user_unread_privmsg - 1 + WHERE user_id = $user_id"; + $db->sql_query($sql); + + if ($user->data['user_id'] == $user_id) + { + $user->data['user_unread_privmsg']--; + + // Try to cope with previous wrong conversions... + if ($user->data['user_unread_privmsg'] < 0) + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_unread_privmsg = 0 + WHERE user_id = $user_id"; + $db->sql_query($sql); + + $user->data['user_unread_privmsg'] = 0; + } + } +} + +function mark_folder_read($user_id, $folder_id) +{ + global $db; + + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE folder_id = ' . ((int) $folder_id) . ' + AND user_id = ' . ((int) $user_id) . ' + AND pm_unread = 1'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + update_unread_status(true, $row['msg_id'], $user_id, $folder_id); + } + $db->sql_freeresult($result); +} + +/** +* Handle all actions possible with marked messages +*/ +function handle_mark_actions($user_id, $mark_action) +{ + global $db, $user, $phpbb_root_path, $phpEx, $request; + + $msg_ids = $request->variable('marked_msg_id', array(0)); + $cur_folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); + + if (!count($msg_ids)) + { + return false; + } + + switch ($mark_action) + { + case 'mark_important': + + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " + SET pm_marked = 1 - pm_marked + WHERE folder_id = $cur_folder_id + AND user_id = $user_id + AND " . $db->sql_in_set('msg_id', $msg_ids); + $db->sql_query($sql); + + break; + + case 'delete_marked': + + global $auth; + + if (!$auth->acl_get('u_pm_delete')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_DELETE_MESSAGE'); + } + + if (confirm_box(true)) + { + delete_pm($user_id, $msg_ids, $cur_folder_id); + + $success_msg = (count($msg_ids) == 1) ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED'; + $redirect = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $cur_folder_id); + + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_FOLDER'], '', '')); + } + else + { + $s_hidden_fields = array( + 'cur_folder_id' => $cur_folder_id, + 'mark_option' => 'delete_marked', + 'submit_mark' => true, + 'marked_msg_id' => $msg_ids + ); + + confirm_box(false, 'DELETE_MARKED_PM', build_hidden_fields($s_hidden_fields)); + } + + break; + + default: + return false; + } + + return true; +} + +/** +* Delete PM(s) +*/ +function delete_pm($user_id, $msg_ids, $folder_id) +{ + global $db, $user, $phpbb_container, $phpbb_dispatcher; + + $user_id = (int) $user_id; + $folder_id = (int) $folder_id; + + if (!$user_id) + { + return false; + } + + if (!is_array($msg_ids)) + { + if (!$msg_ids) + { + return false; + } + $msg_ids = array($msg_ids); + } + + if (!count($msg_ids)) + { + return false; + } + + /** + * Get all info for PM(s) before they are deleted + * + * @event core.delete_pm_before + * @var int user_id ID of the user requested the message delete + * @var array msg_ids array of all messages to be deleted + * @var int folder_id ID of the user folder where the messages are stored + * @since 3.1.0-b5 + */ + $vars = array('user_id', 'msg_ids', 'folder_id'); + extract($phpbb_dispatcher->trigger_event('core.delete_pm_before', compact($vars))); + + // Get PM Information for later deleting + $sql = 'SELECT msg_id, pm_unread, pm_new + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', array_map('intval', $msg_ids)) . " + AND folder_id = $folder_id + AND user_id = $user_id"; + $result = $db->sql_query($sql); + + $delete_rows = array(); + $num_unread = $num_new = $num_deleted = 0; + while ($row = $db->sql_fetchrow($result)) + { + $num_unread += (int) $row['pm_unread']; + $num_new += (int) $row['pm_new']; + + $delete_rows[$row['msg_id']] = 1; + } + $db->sql_freeresult($result); + unset($msg_ids); + + if (!count($delete_rows)) + { + return false; + } + + $db->sql_transaction('begin'); + + // if no one has read the message yet (meaning it is in users outbox) + // then mark the message as deleted... + if ($folder_id == PRIVMSGS_OUTBOX) + { + // Remove PM from Outbox + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id AND folder_id = " . PRIVMSGS_OUTBOX . ' + AND ' . $db->sql_in_set('msg_id', array_keys($delete_rows)); + $db->sql_query($sql); + + // Update PM Information for safety + $sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET message_text = '' + WHERE " . $db->sql_in_set('msg_id', array_keys($delete_rows)); + $db->sql_query($sql); + + // Set delete flag for those intended to receive the PM + // We do not remove the message actually, to retain some basic information (sent time for example) + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_deleted = 1 + WHERE ' . $db->sql_in_set('msg_id', array_keys($delete_rows)); + $db->sql_query($sql); + + $num_deleted = $db->sql_affectedrows(); + } + else + { + // Delete private message data + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id = $folder_id + AND " . $db->sql_in_set('msg_id', array_keys($delete_rows)); + $db->sql_query($sql); + $num_deleted = $db->sql_affectedrows(); + } + + // if folder id is user defined folder then decrease pm_count + if (!in_array($folder_id, array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX, PRIVMSGS_NO_BOX))) + { + $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . " + SET pm_count = pm_count - $num_deleted + WHERE folder_id = $folder_id"; + $db->sql_query($sql); + } + + // Update unread and new status field + if ($num_unread || $num_new) + { + $set_sql = ($num_unread) ? 'user_unread_privmsg = user_unread_privmsg - ' . $num_unread : ''; + + if ($num_new) + { + $set_sql .= ($set_sql != '') ? ', ' : ''; + $set_sql .= 'user_new_privmsg = user_new_privmsg - ' . $num_new; + } + + $db->sql_query('UPDATE ' . USERS_TABLE . " SET $set_sql WHERE user_id = $user_id"); + + $user->data['user_new_privmsg'] -= $num_new; + $user->data['user_unread_privmsg'] -= $num_unread; + } + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->delete_notifications('notification.type.pm', array_keys($delete_rows)); + + // Now we have to check which messages we can delete completely + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', array_keys($delete_rows)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + unset($delete_rows[$row['msg_id']]); + } + $db->sql_freeresult($result); + + $delete_ids = array_keys($delete_rows); + + if (count($delete_ids)) + { + // Check if there are any attachments we need to remove + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('message', $delete_ids, false); + unset($attachment_manager); + + $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $delete_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + return true; +} + +/** +* Delete all PM(s) for a given user and delete the ones without references +* +* @param int $user_id ID of the user whose private messages we want to delete +* +* @return boolean False if there were no pms found, true otherwise. +*/ +function phpbb_delete_user_pms($user_id) +{ + $user_id = (int) $user_id; + + if (!$user_id) + { + return false; + } + + return phpbb_delete_users_pms(array($user_id)); +} + +/** +* Delete all PM(s) for given users and delete the ones without references +* +* @param array $user_ids IDs of the users whose private messages we want to delete +* +* @return boolean False if there were no pms found, true otherwise. +*/ +function phpbb_delete_users_pms($user_ids) +{ + global $db, $phpbb_container; + + $user_id_sql = $db->sql_in_set('user_id', $user_ids); + $author_id_sql = $db->sql_in_set('author_id', $user_ids); + + // Get PM Information for later deleting + // The two queries where split, so we can use our indexes + $undelivered_msg = $delete_ids = array(); + + // Part 1: get PMs the user received + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $user_id_sql; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $msg_id = (int) $row['msg_id']; + $delete_ids[$msg_id] = $msg_id; + } + $db->sql_freeresult($result); + + // Part 2: get PMs the users sent, but are yet to be received. + // We cannot simply delete them. First we have to check + // whether another user already received and read the message. + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $author_id_sql . ' + AND folder_id = ' . PRIVMSGS_NO_BOX; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $msg_id = (int) $row['msg_id']; + $undelivered_msg[$msg_id] = $msg_id; + } + $db->sql_freeresult($result); + + if (empty($delete_ids) && empty($undelivered_msg)) + { + return false; + } + + $db->sql_transaction('begin'); + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + if (!empty($undelivered_msg)) + { + // A pm is delivered, if for any recipient the message was moved + // from their NO_BOX to another folder. We do not delete such + // messages, but only delete them for users, who have not yet + // received them. + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $author_id_sql . ' + AND folder_id <> ' . PRIVMSGS_NO_BOX . ' + AND folder_id <> ' . PRIVMSGS_OUTBOX . ' + AND folder_id <> ' . PRIVMSGS_SENTBOX; + $result = $db->sql_query($sql); + + $delivered_msg = array(); + while ($row = $db->sql_fetchrow($result)) + { + $msg_id = (int) $row['msg_id']; + $delivered_msg[$msg_id] = $msg_id; + unset($undelivered_msg[$msg_id]); + } + $db->sql_freeresult($result); + + $undelivered_user = array(); + + // Count the messages we delete, so we can correct the user pm data + $sql = 'SELECT user_id, COUNT(msg_id) as num_undelivered_privmsgs + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $author_id_sql . ' + AND folder_id = ' . PRIVMSGS_NO_BOX . ' + AND ' . $db->sql_in_set('msg_id', array_merge($undelivered_msg, $delivered_msg)) . ' + GROUP BY user_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $num_pms = (int) $row['num_undelivered_privmsgs']; + $undelivered_user[$num_pms][] = (int) $row['user_id']; + + if (count($undelivered_user[$num_pms]) > 50) + { + // If there are too many users affected the query might get + // too long, so we update the value for the first bunch here. + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new_privmsg = user_new_privmsg - ' . $num_pms . ', + user_unread_privmsg = user_unread_privmsg - ' . $num_pms . ' + WHERE ' . $db->sql_in_set('user_id', $undelivered_user[$num_pms]); + $db->sql_query($sql); + unset($undelivered_user[$num_pms]); + } + } + $db->sql_freeresult($result); + + foreach ($undelivered_user as $num_pms => $undelivered_user_set) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new_privmsg = user_new_privmsg - ' . $num_pms . ', + user_unread_privmsg = user_unread_privmsg - ' . $num_pms . ' + WHERE ' . $db->sql_in_set('user_id', $undelivered_user_set); + $db->sql_query($sql); + } + + if (!empty($delivered_msg)) + { + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE folder_id = ' . PRIVMSGS_NO_BOX . ' + AND ' . $db->sql_in_set('msg_id', $delivered_msg); + $db->sql_query($sql); + + $phpbb_notifications->delete_notifications('notification.type.pm', $delivered_msg); + } + + if (!empty($undelivered_msg)) + { + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $undelivered_msg); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $undelivered_msg); + $db->sql_query($sql); + + $phpbb_notifications->delete_notifications('notification.type.pm', $undelivered_msg); + } + } + + // Reset the user's pm count to 0 + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new_privmsg = 0, + user_unread_privmsg = 0 + WHERE ' . $user_id_sql; + $db->sql_query($sql); + + // Delete private message data of the user + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $user_id_sql; + $db->sql_query($sql); + + if (!empty($delete_ids)) + { + // Now we have to check which messages we can delete completely + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $delete_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + unset($delete_ids[$row['msg_id']]); + } + $db->sql_freeresult($result); + + if (!empty($delete_ids)) + { + // Check if there are any attachments we need to remove + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('message', $delete_ids, false); + unset($attachment_manager); + + $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $delete_ids); + $db->sql_query($sql); + + $phpbb_notifications->delete_notifications('notification.type.pm', $delete_ids); + } + } + + // Set the remaining author id to anonymous + // This way users are still able to read messages from users being removed + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET author_id = ' . ANONYMOUS . ' + WHERE ' . $author_id_sql; + $db->sql_query($sql); + + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET author_id = ' . ANONYMOUS . ' + WHERE ' . $author_id_sql; + $db->sql_query($sql); + + $db->sql_transaction('commit'); + + return true; +} + +/** +* Rebuild message header +*/ +function rebuild_header($check_ary) +{ + $address = array(); + + foreach ($check_ary as $check_type => $address_field) + { + // Split Addresses into users and groups + preg_match_all('/:?(u|g)_([0-9]+):?/', $address_field, $match); + + $u = $g = array(); + foreach ($match[1] as $id => $type) + { + ${$type}[] = (int) $match[2][$id]; + } + + $_types = array('u', 'g'); + foreach ($_types as $type) + { + if (count(${$type})) + { + foreach (${$type} as $id) + { + $address[$type][$id] = $check_type; + } + } + } + } + + return $address; +} + +/** +* Print out/assign recipient information +*/ +function write_pm_addresses($check_ary, $author_id, $plaintext = false) +{ + global $db, $user, $template, $phpbb_root_path, $phpEx, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $addresses = array(); + + foreach ($check_ary as $check_type => $address_field) + { + if (!is_array($address_field)) + { + // Split Addresses into users and groups + preg_match_all('/:?(u|g)_([0-9]+):?/', $address_field, $match); + + $u = $g = array(); + foreach ($match[1] as $id => $type) + { + ${$type}[] = (int) $match[2][$id]; + } + } + else + { + $u = $address_field['u']; + $g = $address_field['g']; + } + + $address = array(); + if (count($u)) + { + $sql = 'SELECT user_id, username, user_colour + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $u); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) + { + if ($plaintext) + { + $address[] = $row['username']; + } + else + { + $address['user'][$row['user_id']] = array('name' => $row['username'], 'colour' => $row['user_colour']); + } + } + } + $db->sql_freeresult($result); + } + + if (count($g)) + { + if ($plaintext) + { + $sql = 'SELECT group_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_id', $g); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) + { + $address[] = $group_helper->get_name($row['group_name']); + } + } + $db->sql_freeresult($result); + } + else + { + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE ' . $db->sql_in_set('g.group_id', $g) . ' + AND g.group_id = ug.group_id + AND ug.user_pending = 0'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($address['group'][$row['group_id']])) + { + if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) + { + $row['group_name'] = $group_helper->get_name($row['group_name']); + $address['group'][$row['group_id']] = array('name' => $row['group_name'], 'colour' => $row['group_colour']); + } + } + + if (isset($address['user'][$row['user_id']])) + { + $address['user'][$row['user_id']]['in_group'] = $row['group_id']; + } + } + $db->sql_freeresult($result); + } + } + + if (count($address) && !$plaintext) + { + $template->assign_var('S_' . strtoupper($check_type) . '_RECIPIENT', true); + + foreach ($address as $type => $adr_ary) + { + foreach ($adr_ary as $id => $row) + { + $tpl_ary = array( + 'IS_GROUP' => ($type == 'group') ? true : false, + 'IS_USER' => ($type == 'user') ? true : false, + 'UG_ID' => $id, + 'NAME' => $row['name'], + 'COLOUR' => ($row['colour']) ? '#' . $row['colour'] : '', + 'TYPE' => $type, + ); + + if ($type == 'user') + { + $tpl_ary = array_merge($tpl_ary, array( + 'U_VIEW' => get_username_string('profile', $id, $row['name'], $row['colour']), + 'NAME_FULL' => get_username_string('full', $id, $row['name'], $row['colour']), + )); + } + else + { + $tpl_ary = array_merge($tpl_ary, array( + 'U_VIEW' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $id), + )); + } + + $template->assign_block_vars($check_type . '_recipient', $tpl_ary); + } + } + } + + $addresses[$check_type] = $address; + } + + return $addresses; +} + +/** +* Get folder status +*/ +function get_folder_status($folder_id, $folder) +{ + global $user; + + if (isset($folder[$folder_id])) + { + $folder = $folder[$folder_id]; + } + else + { + return false; + } + + $return = array( + 'folder_name' => $folder['folder_name'], + 'cur' => $folder['num_messages'], + 'remaining' => ($user->data['message_limit']) ? $user->data['message_limit'] - $folder['num_messages'] : 0, + 'max' => $user->data['message_limit'], + 'percent' => ($user->data['message_limit']) ? (($user->data['message_limit'] > 0) ? floor(($folder['num_messages'] / $user->data['message_limit']) * 100) : 100) : 0, + ); + + $return['message'] = $user->lang('FOLDER_STATUS_MSG', $user->lang('MESSAGES_COUNT', (int) $return['max']), (int) $return['cur'], $return['percent']); + + return $return; +} + +// +// COMPOSE MESSAGES +// + +/** +* Submit PM +*/ +function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) +{ + global $db, $auth, $config, $user, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $request; + + // We do not handle erasing pms here + if ($mode == 'delete') + { + return false; + } + + $current_time = time(); + + $data = $data_ary; + /** + * Get all parts of the PM that are to be submited to the DB. + * + * @event core.submit_pm_before + * @var string mode PM Post mode - post|reply|quote|quotepost|forward|edit + * @var string subject Subject of the private message + * @var array data The whole row data of the PM. + * @since 3.1.0-b3 + */ + $vars = array('mode', 'subject', 'data'); + extract($phpbb_dispatcher->trigger_event('core.submit_pm_before', compact($vars))); + $data_ary = $data; + unset($data); + + // Collect some basic information about which tables and which rows to update/insert + $sql_data = array(); + $root_level = 0; + + // Recipient Information + $recipients = $to = $bcc = array(); + + if ($mode != 'edit') + { + // Build Recipient List + // u|g => array($user_id => 'to'|'bcc') + $_types = array('u', 'g'); + foreach ($_types as $ug_type) + { + if (isset($data_ary['address_list'][$ug_type]) && count($data_ary['address_list'][$ug_type])) + { + foreach ($data_ary['address_list'][$ug_type] as $id => $field) + { + $id = (int) $id; + + // Do not rely on the address list being "valid" + if (!$id || ($ug_type == 'u' && $id == ANONYMOUS)) + { + continue; + } + + $field = ($field == 'to') ? 'to' : 'bcc'; + if ($ug_type == 'u') + { + $recipients[$id] = $field; + } + ${$field}[] = $ug_type . '_' . $id; + } + } + } + + if (isset($data_ary['address_list']['g']) && count($data_ary['address_list']['g'])) + { + // We need to check the PM status of group members (do they want to receive PM's?) + // Only check if not a moderator or admin, since they are allowed to override this user setting + $sql_allow_pm = (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) ? ' AND u.user_allow_pm = 1' : ''; + + $sql = 'SELECT u.user_type, ug.group_id, ug.user_id + FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug + WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data_ary['address_list']['g'])) . ' + AND ug.user_pending = 0 + AND u.user_id = ug.user_id + AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' . + $sql_allow_pm; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $field = ($data_ary['address_list']['g'][$row['group_id']] == 'to') ? 'to' : 'bcc'; + $recipients[$row['user_id']] = $field; + } + $db->sql_freeresult($result); + } + + if (!count($recipients)) + { + trigger_error('NO_RECIPIENT'); + } + } + + // First of all make sure the subject are having the correct length. + $subject = truncate_string($subject); + + $db->sql_transaction('begin'); + + $sql = ''; + + switch ($mode) + { + case 'reply': + case 'quote': + $root_level = ($data_ary['reply_from_root_level']) ? $data_ary['reply_from_root_level'] : $data_ary['reply_from_msg_id']; + + // Set message_replied switch for this user + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_replied = 1 + WHERE user_id = ' . $data_ary['from_user_id'] . ' + AND msg_id = ' . $data_ary['reply_from_msg_id']; + + // no break + + case 'forward': + case 'post': + case 'quotepost': + $sql_data = array( + 'root_level' => $root_level, + 'author_id' => $data_ary['from_user_id'], + 'icon_id' => $data_ary['icon_id'], + 'author_ip' => $data_ary['from_user_ip'], + 'message_time' => $current_time, + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], + 'message_subject' => $subject, + 'message_text' => $data_ary['message'], + 'message_attachment'=> (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'], + 'to_address' => implode(':', $to), + 'bcc_address' => implode(':', $bcc), + 'message_reported' => 0, + ); + break; + + case 'edit': + $sql_data = array( + 'icon_id' => $data_ary['icon_id'], + 'message_edit_time' => $current_time, + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], + 'message_subject' => $subject, + 'message_text' => $data_ary['message'], + 'message_attachment'=> (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'] + ); + break; + } + + if (count($sql_data)) + { + if ($mode == 'post' || $mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward') + { + $db->sql_query('INSERT INTO ' . PRIVMSGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data)); + $data_ary['msg_id'] = $db->sql_nextid(); + } + else if ($mode == 'edit') + { + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_edit_count = message_edit_count + 1, ' . $db->sql_build_array('UPDATE', $sql_data) . ' + WHERE msg_id = ' . $data_ary['msg_id']; + $db->sql_query($sql); + } + } + + if ($mode != 'edit') + { + if ($sql) + { + $db->sql_query($sql); + } + unset($sql); + + $sql_ary = array(); + foreach ($recipients as $user_id => $type) + { + $sql_ary[] = array( + 'msg_id' => (int) $data_ary['msg_id'], + 'user_id' => (int) $user_id, + 'author_id' => (int) $data_ary['from_user_id'], + 'folder_id' => PRIVMSGS_NO_BOX, + 'pm_new' => 1, + 'pm_unread' => 1, + 'pm_forwarded' => ($mode == 'forward') ? 1 : 0 + ); + } + + $db->sql_multi_insert(PRIVMSGS_TO_TABLE, $sql_ary); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new_privmsg = user_new_privmsg + 1, user_unread_privmsg = user_unread_privmsg + 1, user_last_privmsg = ' . time() . ' + WHERE ' . $db->sql_in_set('user_id', array_keys($recipients)); + $db->sql_query($sql); + + // Put PM into outbox + if ($put_in_outbox) + { + $db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'msg_id' => (int) $data_ary['msg_id'], + 'user_id' => (int) $data_ary['from_user_id'], + 'author_id' => (int) $data_ary['from_user_id'], + 'folder_id' => PRIVMSGS_OUTBOX, + 'pm_new' => 0, + 'pm_unread' => 0, + 'pm_forwarded' => ($mode == 'forward') ? 1 : 0)) + ); + } + } + + // Set user last post time + if ($mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward' || $mode == 'post') + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastpost_time = $current_time + WHERE user_id = " . $data_ary['from_user_id']; + $db->sql_query($sql); + } + + // Submit Attachments + if (!empty($data_ary['attachment_data']) && $data_ary['msg_id'] && in_array($mode, array('post', 'reply', 'quote', 'quotepost', 'edit', 'forward'))) + { + $space_taken = $files_added = 0; + $orphan_rows = array(); + + foreach ($data_ary['attachment_data'] as $pos => $attach_row) + { + $orphan_rows[(int) $attach_row['attach_id']] = array(); + } + + if (count($orphan_rows)) + { + $sql = 'SELECT attach_id, filesize, physical_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan_rows)) . ' + AND in_message = 1 + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + $orphan_rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $orphan_rows[$row['attach_id']] = $row; + } + $db->sql_freeresult($result); + } + + foreach ($data_ary['attachment_data'] as $pos => $attach_row) + { + if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']])) + { + continue; + } + + if (!$attach_row['is_orphan']) + { + // update entry in db if attachment already stored in db and filespace + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " + SET attach_comment = '" . $db->sql_escape($attach_row['attach_comment']) . "' + WHERE attach_id = " . (int) $attach_row['attach_id'] . ' + AND is_orphan = 0'; + $db->sql_query($sql); + } + else + { + // insert attachment into db + if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + { + continue; + } + + $space_taken += $orphan_rows[$attach_row['attach_id']]['filesize']; + $files_added++; + + $attach_sql = array( + 'post_msg_id' => $data_ary['msg_id'], + 'topic_id' => 0, + 'is_orphan' => 0, + 'poster_id' => $data_ary['from_user_id'], + 'attach_comment' => $attach_row['attach_comment'], + ); + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . ' + WHERE attach_id = ' . $attach_row['attach_id'] . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $db->sql_query($sql); + } + } + + if ($space_taken && $files_added) + { + $config->increment('upload_dir_size', $space_taken, false); + $config->increment('num_files', $files_added, false); + } + } + + // Delete draft if post was loaded... + $draft_id = $request->variable('draft_loaded', 0); + if ($draft_id) + { + $sql = 'DELETE FROM ' . DRAFTS_TABLE . " + WHERE draft_id = $draft_id + AND user_id = " . $data_ary['from_user_id']; + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + // Send Notifications + $pm_data = array_merge($data_ary, array( + 'message_subject' => $subject, + 'recipients' => $recipients, + )); + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + if ($mode == 'edit') + { + $phpbb_notifications->update_notifications('notification.type.pm', $pm_data); + } + else + { + $phpbb_notifications->add_notifications('notification.type.pm', $pm_data); + } + + $data = $data_ary; + /** + * Get PM message ID after submission to DB + * + * @event core.submit_pm_after + * @var string mode PM Post mode - post|reply|quote|quotepost|forward|edit + * @var string subject Subject of the private message + * @var array data The whole row data of the PM. + * @var array pm_data The data sent to notification class + * @since 3.1.0-b5 + */ + $vars = array('mode', 'subject', 'data', 'pm_data'); + extract($phpbb_dispatcher->trigger_event('core.submit_pm_after', compact($vars))); + $data_ary = $data; + unset($data); + + return $data_ary['msg_id']; +} + +/** +* Display Message History +*/ +function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode = false) +{ + global $db, $user, $template, $phpbb_root_path, $phpEx, $auth, $phpbb_dispatcher; + + // Select all receipts and the author from the pm we currently view, to only display their pm-history + $sql = 'SELECT author_id, user_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE msg_id = $msg_id + AND folder_id <> " . PRIVMSGS_HOLD_BOX; + $result = $db->sql_query($sql); + + $recipients = array(); + while ($row = $db->sql_fetchrow($result)) + { + $recipients[] = (int) $row['user_id']; + $recipients[] = (int) $row['author_id']; + } + $db->sql_freeresult($result); + $recipients = array_unique($recipients); + + // Get History Messages (could be newer) + $sql_where = 't.msg_id = p.msg_id + AND p.author_id = u.user_id + AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND ' . $db->sql_in_set('t.author_id', $recipients, false, true) . " + AND t.user_id = $user_id"; + + // We no longer need those. + unset($recipients); + + if (!$message_row['root_level']) + { + $sql_where .= " AND (p.root_level = $msg_id OR (p.root_level = 0 AND p.msg_id = $msg_id))"; + } + else + { + $sql_where .= " AND (p.root_level = " . $message_row['root_level'] . ' OR p.msg_id = ' . $message_row['root_level'] . ')'; + } + + $sql_ary = array( + 'SELECT' => 't.*, p.*, u.*', + 'FROM' => array( + PRIVMSGS_TABLE => 'p', + PRIVMSGS_TO_TABLE => 't', + USERS_TABLE => 'u' + ), + 'LEFT_JOIN' => array(), + 'WHERE' => $sql_where, + 'ORDER_BY' => 'p.message_time DESC', + ); + + /** + * Event to modify the SQL query before the message history in private message is queried + * + * @event core.message_history_modify_sql_ary + * @var array sql_ary The SQL array to get the data of the message history in private message + * @since 3.2.8-RC1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.message_history_modify_sql_ary', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + unset($sql_ary); + + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + + if (!$row) + { + $db->sql_freeresult($result); + return false; + } + + $title = $row['message_subject']; + + $rowset = array(); + $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&folder='; + + do + { + $folder_id = (int) $row['folder_id']; + + $row['folder'][] = (isset($folder[$folder_id])) ? '' . $folder[$folder_id]['folder_name'] . '' : $user->lang['UNKNOWN_FOLDER']; + + if (isset($rowset[$row['msg_id']])) + { + $rowset[$row['msg_id']]['folder'][] = (isset($folder[$folder_id])) ? '' . $folder[$folder_id]['folder_name'] . '' : $user->lang['UNKNOWN_FOLDER']; + } + else + { + $rowset[$row['msg_id']] = $row; + } + } + while ($row = $db->sql_fetchrow($result)); + $db->sql_freeresult($result); + + if (count($rowset) == 1 && !$in_post_mode) + { + return false; + } + + $title = censor_text($title); + + $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); + $next_history_pm = $previous_history_pm = $prev_id = 0; + + // Re-order rowset to be able to get the next/prev message rows... + $rowset = array_values($rowset); + + for ($i = 0, $size = count($rowset); $i < $size; $i++) + { + $row = &$rowset[$i]; + $id = (int) $row['msg_id']; + + $author_id = $row['author_id']; + $folder_id = (int) $row['folder_id']; + + $subject = $row['message_subject']; + $message = $row['message_text']; + + $message = censor_text($message); + + $decoded_message = false; + + if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) + { + $decoded_message = $message; + decode_message($decoded_message, $row['bbcode_uid']); + + $decoded_message = bbcode_nl2br($decoded_message); + } + + $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); + + if ($id == $msg_id) + { + $next_history_pm = (isset($rowset[$i + 1])) ? (int) $rowset[$i + 1]['msg_id'] : 0; + $previous_history_pm = $prev_id; + } + + $template_vars = array( + 'MESSAGE_AUTHOR_QUOTE' => (($decoded_message) ? addslashes(get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username'])) : ''), + 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $row['username'], $row['user_colour'], $row['username']), + 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $row['username'], $row['user_colour'], $row['username']), + 'MESSAGE_AUTHOR' => get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username']), + 'U_MESSAGE_AUTHOR' => get_username_string('profile', $author_id, $row['username'], $row['user_colour'], $row['username']), + + 'SUBJECT' => $subject, + 'SENT_DATE' => $user->format_date($row['message_time']), + 'MESSAGE' => $message, + 'FOLDER' => implode($user->lang['COMMA_SEPARATOR'], $row['folder']), + 'DECODED_MESSAGE' => $decoded_message, + + 'S_CURRENT_MSG' => ($row['msg_id'] == $msg_id), + 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, + 'S_IN_POST_MODE' => $in_post_mode, + + 'MSG_ID' => $row['msg_id'], + 'MESSAGE_TIME' => $row['message_time'], + 'USER_ID' => $row['user_id'], + 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], + 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', + 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '' + ); + + /** + * Modify the template vars for displaying the message history in private message + * + * @event core.message_history_modify_template_vars + * @var array template_vars Array containing the query + * @var array row Array containing the action user row + * @since 3.2.8-RC1 + */ + $vars = array( + 'template_vars', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.message_history_modify_template_vars', compact($vars))); + + $template->assign_block_vars('history_row', $template_vars); + + unset($rowset[$i]); + $prev_id = $id; + } + + $template->assign_vars(array( + 'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE']), + 'HISTORY_TITLE' => $title, + + 'U_VIEW_NEXT_HISTORY' => ($next_history_pm) ? "$url&p=" . $next_history_pm : '', + 'U_VIEW_PREVIOUS_HISTORY' => ($previous_history_pm) ? "$url&p=" . $previous_history_pm : '', + )); + + return true; +} + +/** +* Set correct users max messages in PM folder. +* If several group memberships define different amount of messages, the highest will be chosen. +*/ +function set_user_message_limit() +{ + global $user, $db, $config; + + // Get maximum about from user memberships + $message_limit = phpbb_get_max_setting_from_group($db, $user->data['user_id'], 'message_limit'); + + // If it is 0, there is no limit set and we use the maximum value within the config. + $user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit; +} + +/** + * Get the maximum PM setting for the groups of the user + * + * @param \phpbb\db\driver\driver_interface $db + * @param int $user_id + * @param string $setting Only 'max_recipients' and 'message_limit' are supported + * @return int The maximum setting for all groups of the user, unless one group has '0' + * @throws \InvalidArgumentException If selected group setting is not supported + */ +function phpbb_get_max_setting_from_group(\phpbb\db\driver\driver_interface $db, $user_id, $setting) +{ + if ($setting !== 'max_recipients' && $setting !== 'message_limit') + { + throw new InvalidArgumentException('Setting "' . $setting . '" is not supported'); + } + + // Get maximum number of allowed recipients + $sql = 'SELECT MAX(g.group_' . $setting . ') as max_setting + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE ug.user_id = ' . (int) $user_id . ' + AND ug.user_pending = 0 + AND ug.group_id = g.group_id'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $max_setting = (int) $row['max_setting']; + + return $max_setting; +} + +/** +* Generates an array of coloured recipient names from a list of PMs - (groups & users) +* +* @param array $pm_by_id An array of rows from PRIVMSGS_TABLE, keys are the msg_ids. +* +* @return array 2D Array: array(msg_id => array('username or group string', ...), ...) +* Usernames are generated with {@link get_username_string get_username_string} +* Groups are coloured and have a link to the membership page +*/ +function get_recipient_strings($pm_by_id) +{ + global $db, $phpbb_root_path, $phpEx, $user, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $address_list = $recipient_list = $address = array(); + + $_types = array('u', 'g'); + + foreach ($pm_by_id as $message_id => $row) + { + $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); + + foreach ($_types as $ug_type) + { + if (isset($address[$message_id][$ug_type]) && count($address[$message_id][$ug_type])) + { + foreach ($address[$message_id][$ug_type] as $ug_id => $in_to) + { + $recipient_list[$ug_type][$ug_id] = array('name' => $user->lang['NA'], 'colour' => ''); + } + } + } + } + + foreach ($_types as $ug_type) + { + if (!empty($recipient_list[$ug_type])) + { + if ($ug_type == 'u') + { + $sql = 'SELECT user_id as id, username as name, user_colour as colour + FROM ' . USERS_TABLE . ' + WHERE '; + } + else + { + $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type + FROM ' . GROUPS_TABLE . ' + WHERE '; + } + $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type]))); + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($ug_type == 'g') + { + $row['name'] = $group_helper->get_name($row['name']); + } + + $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); + } + $db->sql_freeresult($result); + } + } + + foreach ($address as $message_id => $adr_ary) + { + foreach ($adr_ary as $type => $id_ary) + { + foreach ($id_ary as $ug_id => $_id) + { + if ($type == 'u') + { + $address_list[$message_id][] = get_username_string('full', $ug_id, $recipient_list[$type][$ug_id]['name'], $recipient_list[$type][$ug_id]['colour']); + } + else + { + $user_colour = ($recipient_list[$type][$ug_id]['colour']) ? ' style="font-weight: bold; color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : ''; + $link = ''; + $address_list[$message_id][] = $link . $recipient_list[$type][$ug_id]['name'] . (($link) ? '' : ''); + } + } + } + } + + return $address_list; +} diff --git a/install/update/new/includes/functions_transfer.php b/install/update/new/includes/functions_transfer.php new file mode 100644 index 0000000..f0070b4 --- /dev/null +++ b/install/update/new/includes/functions_transfer.php @@ -0,0 +1,899 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Transfer class, wrapper for ftp/sftp/ssh +*/ +class transfer +{ + var $connection; + var $host; + var $port; + var $username; + var $password; + var $timeout; + var $root_path; + var $tmp_path; + var $file_perms; + var $dir_perms; + + /** + * Constructor - init some basic values + */ + function __construct() + { + global $phpbb_root_path; + + $this->file_perms = 0644; + $this->dir_perms = 0777; + + // We use the store directory as temporary path to circumvent open basedir restrictions + $this->tmp_path = $phpbb_root_path . 'store/'; + } + + /** + * Write file to location + */ + function write_file($destination_file = '', $contents = '') + { + global $phpbb_root_path; + + $destination_file = $this->root_path . str_replace($phpbb_root_path, '', $destination_file); + + // need to create a temp file and then move that temp file. + // ftp functions can only move files around and can't create. + // This means that the users will need to have access to write + // temporary files or have write access on a folder within phpBB + // like the cache folder. If the user can't do either, then + // he/she needs to use the fsock ftp method + $temp_name = tempnam($this->tmp_path, 'transfer_'); + @unlink($temp_name); + + $fp = @fopen($temp_name, 'w'); + + if (!$fp) + { + trigger_error('Unable to create temporary file ' . $temp_name, E_USER_ERROR); + } + + @fwrite($fp, $contents); + @fclose($fp); + + $result = $this->overwrite_file($temp_name, $destination_file); + + // remove temporary file now + @unlink($temp_name); + + return $result; + } + + /** + * Moving file into location. If the destination file already exists it gets overwritten + */ + function overwrite_file($source_file, $destination_file) + { + /** + * @todo generally think about overwriting files in another way, by creating a temporary file and then renaming it + * @todo check for the destination file existance too + */ + $this->_delete($destination_file); + $result = $this->_put($source_file, $destination_file); + $this->_chmod($destination_file, $this->file_perms); + + return $result; + } + + /** + * Create directory structure + */ + function make_dir($dir) + { + global $phpbb_root_path; + + $dir = str_replace($phpbb_root_path, '', $dir); + $dir = explode('/', $dir); + $dirs = ''; + + for ($i = 0, $total = count($dir); $i < $total; $i++) + { + $result = true; + + if (strpos($dir[$i], '.') === 0) + { + continue; + } + $cur_dir = $dir[$i] . '/'; + + if (!file_exists($phpbb_root_path . $dirs . $cur_dir)) + { + // create the directory + $result = $this->_mkdir($dir[$i]); + $this->_chmod($dir[$i], $this->dir_perms); + } + + $this->_chdir($this->root_path . $dirs . $dir[$i]); + $dirs .= $cur_dir; + } + + $this->_chdir($this->root_path); + + /** + * @todo stack result into array to make sure every path creation has been taken care of + */ + return $result; + } + + /** + * Copy file from source location to destination location + */ + function copy_file($from_loc, $to_loc) + { + global $phpbb_root_path; + + $from_loc = ((strpos($from_loc, $phpbb_root_path) !== 0) ? $phpbb_root_path : '') . $from_loc; + $to_loc = $this->root_path . str_replace($phpbb_root_path, '', $to_loc); + + if (!file_exists($from_loc)) + { + return false; + } + + $result = $this->overwrite_file($from_loc, $to_loc); + + return $result; + } + + /** + * Remove file + */ + function delete_file($file) + { + global $phpbb_root_path; + + $file = $this->root_path . str_replace($phpbb_root_path, '', $file); + + return $this->_delete($file); + } + + /** + * Remove directory + * @todo remove child directories? + */ + function remove_dir($dir) + { + global $phpbb_root_path; + + $dir = $this->root_path . str_replace($phpbb_root_path, '', $dir); + + return $this->_rmdir($dir); + } + + /** + * Rename a file or folder + */ + function rename($old_handle, $new_handle) + { + global $phpbb_root_path; + + $old_handle = $this->root_path . str_replace($phpbb_root_path, '', $old_handle); + + return $this->_rename($old_handle, $new_handle); + } + + /** + * Check if a specified file exist... + */ + function file_exists($directory, $filename) + { + global $phpbb_root_path; + + $directory = $this->root_path . str_replace($phpbb_root_path, '', $directory); + + $this->_chdir($directory); + $result = $this->_ls(); + + if ($result !== false && is_array($result)) + { + return (in_array($filename, $result)) ? true : false; + } + + return false; + } + + /** + * Open session + */ + function open_session() + { + return $this->_init(); + } + + /** + * Close current session + */ + function close_session() + { + return $this->_close(); + } + + /** + * Determine methods able to be used + */ + static public function methods() + { + $methods = array(); + $disabled_functions = explode(',', @ini_get('disable_functions')); + + if (@extension_loaded('ftp')) + { + $methods[] = 'ftp'; + } + + if (!in_array('fsockopen', $disabled_functions)) + { + $methods[] = 'ftp_fsock'; + } + + return $methods; + } +} + +/** +* FTP transfer class +*/ +class ftp extends transfer +{ + /** + * Standard parameters for FTP session + */ + function __construct($host, $username, $password, $root_path, $port = 21, $timeout = 10) + { + $this->host = $host; + $this->port = $port; + $this->username = $username; + $this->password = $password; + $this->timeout = $timeout; + + // Make sure $this->root_path is layed out the same way as the $user->page['root_script_path'] value (/ at the end) + $this->root_path = str_replace('\\', '/', $this->root_path); + + if (!empty($root_path)) + { + $this->root_path = (($root_path[0] != '/' ) ? '/' : '') . $root_path . ((substr($root_path, -1, 1) == '/') ? '' : '/'); + } + + // Init some needed values + $this->transfer(); + + return; + } + + /** + * Requests data + */ + static public function data() + { + global $user; + + return array( + 'host' => 'localhost', + 'username' => 'anonymous', + 'password' => '', + 'root_path' => $user->page['root_script_path'], + 'port' => 21, + 'timeout' => 10 + ); + } + + /** + * Init FTP Session + * @access private + */ + function _init() + { + // connect to the server + $this->connection = @ftp_connect($this->host, $this->port, $this->timeout); + + if (!$this->connection) + { + return 'ERR_CONNECTING_SERVER'; + } + + // login to the server + if (!@ftp_login($this->connection, $this->username, $this->password)) + { + return 'ERR_UNABLE_TO_LOGIN'; + } + + // attempt to turn pasv mode on + @ftp_pasv($this->connection, true); + + // change to the root directory + if (!$this->_chdir($this->root_path)) + { + return 'ERR_CHANGING_DIRECTORY'; + } + + return true; + } + + /** + * Create Directory (MKDIR) + * @access private + */ + function _mkdir($dir) + { + return @ftp_mkdir($this->connection, $dir); + } + + /** + * Remove directory (RMDIR) + * @access private + */ + function _rmdir($dir) + { + return @ftp_rmdir($this->connection, $dir); + } + + /** + * Rename file + * @access private + */ + function _rename($old_handle, $new_handle) + { + return @ftp_rename($this->connection, $old_handle, $new_handle); + } + + /** + * Change current working directory (CHDIR) + * @access private + */ + function _chdir($dir = '') + { + if ($dir && $dir !== '/') + { + if (substr($dir, -1, 1) == '/') + { + $dir = substr($dir, 0, -1); + } + } + + return @ftp_chdir($this->connection, $dir); + } + + /** + * change file permissions (CHMOD) + * @access private + */ + function _chmod($file, $perms) + { + if (function_exists('ftp_chmod')) + { + $err = @ftp_chmod($this->connection, $perms, $file); + } + else + { + // Unfortunatly CHMOD is not expecting an octal value... + // We need to transform the integer (which was an octal) to an octal representation (to get the int) and then pass as is. ;) + $chmod_cmd = 'CHMOD ' . base_convert($perms, 10, 8) . ' ' . $file; + $err = $this->_site($chmod_cmd); + } + + return $err; + } + + /** + * Upload file to location (PUT) + * @access private + */ + function _put($from_file, $to_file) + { + // We only use the BINARY file mode to cicumvent rewrite actions from ftp server (mostly linefeeds being replaced) + $mode = FTP_BINARY; + + $to_dir = dirname($to_file); + $to_file = basename($to_file); + $this->_chdir($to_dir); + + $result = @ftp_put($this->connection, $to_file, $from_file, $mode); + $this->_chdir($this->root_path); + + return $result; + } + + /** + * Delete file (DELETE) + * @access private + */ + function _delete($file) + { + return @ftp_delete($this->connection, $file); + } + + /** + * Close ftp session (CLOSE) + * @access private + */ + function _close() + { + if (!$this->connection) + { + return false; + } + + return @ftp_quit($this->connection); + } + + /** + * Return current working directory (CWD) + * At the moment not used by parent class + * @access private + */ + function _cwd() + { + return @ftp_pwd($this->connection); + } + + /** + * Return list of files in a given directory (LS) + * @access private + */ + function _ls($dir = './') + { + $list = @ftp_nlist($this->connection, $dir); + + // See bug #46295 - Some FTP daemons don't like './' + if ($dir === './') + { + // Let's try some alternatives + $list = (empty($list)) ? @ftp_nlist($this->connection, '.') : $list; + $list = (empty($list)) ? @ftp_nlist($this->connection, '') : $list; + } + + // Return on error + if ($list === false) + { + return false; + } + + // Remove path if prepended + foreach ($list as $key => $item) + { + // Use same separator for item and dir + $item = str_replace('\\', '/', $item); + $dir = str_replace('\\', '/', $dir); + + if (!empty($dir) && strpos($item, $dir) === 0) + { + $item = substr($item, strlen($dir)); + } + + $list[$key] = $item; + } + + return $list; + } + + /** + * FTP SITE command (ftp-only function) + * @access private + */ + function _site($command) + { + return @ftp_site($this->connection, $command); + } +} + +/** +* FTP fsock transfer class +*/ +class ftp_fsock extends transfer +{ + var $data_connection; + + /** + * Standard parameters for FTP session + */ + function __construct($host, $username, $password, $root_path, $port = 21, $timeout = 10) + { + $this->host = $host; + $this->port = $port; + $this->username = $username; + $this->password = $password; + $this->timeout = $timeout; + + // Make sure $this->root_path is layed out the same way as the $user->page['root_script_path'] value (/ at the end) + $this->root_path = str_replace('\\', '/', $this->root_path); + + if (!empty($root_path)) + { + $this->root_path = (($root_path[0] != '/' ) ? '/' : '') . $root_path . ((substr($root_path, -1, 1) == '/') ? '' : '/'); + } + + // Init some needed values + parent::__construct(); + + return; + } + + /** + * Requests data + */ + static public function data() + { + global $user; + + return array( + 'host' => 'localhost', + 'username' => 'anonymous', + 'password' => '', + 'root_path' => $user->page['root_script_path'], + 'port' => 21, + 'timeout' => 10 + ); + } + + /** + * Init FTP Session + * @access private + */ + function _init() + { + $errno = 0; + $errstr = ''; + + // connect to the server + $this->connection = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout); + + if (!$this->connection || !$this->_check_command()) + { + return 'ERR_CONNECTING_SERVER'; + } + + @stream_set_timeout($this->connection, $this->timeout); + + // login + if (!$this->_send_command('USER', $this->username)) + { + return 'ERR_UNABLE_TO_LOGIN'; + } + + if (!$this->_send_command('PASS', $this->password)) + { + return 'ERR_UNABLE_TO_LOGIN'; + } + + // change to the root directory + if (!$this->_chdir($this->root_path)) + { + return 'ERR_CHANGING_DIRECTORY'; + } + + return true; + } + + /** + * Create Directory (MKDIR) + * @access private + */ + function _mkdir($dir) + { + return $this->_send_command('MKD', $dir); + } + + /** + * Remove directory (RMDIR) + * @access private + */ + function _rmdir($dir) + { + return $this->_send_command('RMD', $dir); + } + + /** + * Rename File + * @access private + */ + function _rename($old_handle, $new_handle) + { + $this->_send_command('RNFR', $old_handle); + return $this->_send_command('RNTO', $new_handle); + } + + /** + * Change current working directory (CHDIR) + * @access private + */ + function _chdir($dir = '') + { + if ($dir && $dir !== '/') + { + if (substr($dir, -1, 1) == '/') + { + $dir = substr($dir, 0, -1); + } + } + + return $this->_send_command('CWD', $dir); + } + + /** + * change file permissions (CHMOD) + * @access private + */ + function _chmod($file, $perms) + { + // Unfortunatly CHMOD is not expecting an octal value... + // We need to transform the integer (which was an octal) to an octal representation (to get the int) and then pass as is. ;) + return $this->_send_command('SITE CHMOD', base_convert($perms, 10, 8) . ' ' . $file); + } + + /** + * Upload file to location (PUT) + * @access private + */ + function _put($from_file, $to_file) + { + // We only use the BINARY file mode to cicumvent rewrite actions from ftp server (mostly linefeeds being replaced) + // 'I' == BINARY + // 'A' == ASCII + if (!$this->_send_command('TYPE', 'I')) + { + return false; + } + + // open the connection to send file over + if (!$this->_open_data_connection()) + { + return false; + } + + $this->_send_command('STOR', $to_file, false); + + // send the file + $fp = @fopen($from_file, 'rb'); + while (!@feof($fp)) + { + @fwrite($this->data_connection, @fread($fp, 4096)); + } + @fclose($fp); + + // close connection + $this->_close_data_connection(); + + return $this->_check_command(); + } + + /** + * Delete file (DELETE) + * @access private + */ + function _delete($file) + { + return $this->_send_command('DELE', $file); + } + + /** + * Close ftp session (CLOSE) + * @access private + */ + function _close() + { + if (!$this->connection) + { + return false; + } + + return $this->_send_command('QUIT'); + } + + /** + * Return current working directory (CWD) + * At the moment not used by parent class + * @access private + */ + function _cwd() + { + $this->_send_command('PWD', '', false); + return preg_replace('#^[0-9]{3} "(.+)" .+\r\n#', '\\1', $this->_check_command(true)); + } + + /** + * Return list of files in a given directory (LS) + * @access private + */ + function _ls($dir = './') + { + if (!$this->_open_data_connection()) + { + return false; + } + + $this->_send_command('NLST', $dir); + + $list = array(); + while (!@feof($this->data_connection)) + { + $filename = preg_replace('#[\r\n]#', '', @fgets($this->data_connection, 512)); + + if ($filename !== '') + { + $list[] = $filename; + } + } + $this->_close_data_connection(); + + // Clear buffer + $this->_check_command(); + + // See bug #46295 - Some FTP daemons don't like './' + if ($dir === './' && empty($list)) + { + // Let's try some alternatives + $list = $this->_ls('.'); + + if (empty($list)) + { + $list = $this->_ls(''); + } + + return $list; + } + + // Remove path if prepended + foreach ($list as $key => $item) + { + // Use same separator for item and dir + $item = str_replace('\\', '/', $item); + $dir = str_replace('\\', '/', $dir); + + if (!empty($dir) && strpos($item, $dir) === 0) + { + $item = substr($item, strlen($dir)); + } + + $list[$key] = $item; + } + + return $list; + } + + /** + * Send a command to server (FTP fsock only function) + * @access private + */ + function _send_command($command, $args = '', $check = true) + { + if (!empty($args)) + { + $command = "$command $args"; + } + + fwrite($this->connection, $command . "\r\n"); + + if ($check === true && !$this->_check_command()) + { + return false; + } + + return true; + } + + /** + * Opens a connection to send data (FTP fosck only function) + * @access private + */ + function _open_data_connection() + { + // Try to find out whether we have a IPv4 or IPv6 (control) connection + if (function_exists('stream_socket_get_name')) + { + $socket_name = stream_socket_get_name($this->connection, true); + $server_ip = substr($socket_name, 0, strrpos($socket_name, ':')); + } + + if (isset($server_ip) && filter_var($server_ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) // ipv4 + { + // Passive mode + $this->_send_command('PASV', '', false); + + if (!$ip_port = $this->_check_command(true)) + { + return false; + } + + // open the connection to start sending the file + if (!preg_match('#[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+#', $ip_port, $temp)) + { + // bad ip and port + return false; + } + + $temp = explode(',', $temp[0]); + $server_ip = $temp[0] . '.' . $temp[1] . '.' . $temp[2] . '.' . $temp[3]; + $server_port = $temp[4] * 256 + $temp[5]; + } + else // ipv6 + { + // Extended Passive Mode - RFC2428 + $this->_send_command('EPSV', '', false); + + if (!$epsv_response = $this->_check_command(true)) + { + return false; + } + + // Response looks like "229 Entering Extended Passive Mode (|||12345|)" + // where 12345 is the tcp port for the data connection + if (!preg_match('#\(\|\|\|([0-9]+)\|\)#', $epsv_response, $match)) + { + return false; + } + $server_port = (int) $match[1]; + + // fsockopen expects IPv6 address in square brackets + $server_ip = "[$server_ip]"; + } + + $errno = 0; + $errstr = ''; + + if (!$this->data_connection = @fsockopen($server_ip, $server_port, $errno, $errstr, $this->timeout)) + { + return false; + } + @stream_set_timeout($this->data_connection, $this->timeout); + + return true; + } + + /** + * Closes a connection used to send data + * @access private + */ + function _close_data_connection() + { + return @fclose($this->data_connection); + } + + /** + * Check to make sure command was successful (FTP fsock only function) + * @access private + */ + function _check_command($return = false) + { + $response = ''; + + do + { + $result = @fgets($this->connection, 512); + $response .= $result; + } + while (substr($result, 3, 1) !== ' '); + + if (!preg_match('#^[123]#', $response)) + { + return false; + } + + return ($return) ? $response : true; + } +} diff --git a/install/update/new/includes/functions_user.php b/install/update/new/includes/functions_user.php new file mode 100644 index 0000000..dc6e092 --- /dev/null +++ b/install/update/new/includes/functions_user.php @@ -0,0 +1,3757 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Obtain user_ids from usernames or vice versa. Returns false on +* success else the error string +* +* @param array &$user_id_ary The user ids to check or empty if usernames used +* @param array &$username_ary The usernames to check or empty if user ids used +* @param mixed $user_type Array of user types to check, false if not restricting by user type +* @param boolean $update_references If false, the supplied array is unset and appears unchanged from where it was called +* @return boolean|string Returns false on success, error string on failure +*/ +function user_get_id_name(&$user_id_ary, &$username_ary, $user_type = false, $update_references = false) +{ + global $db; + + // Are both arrays already filled? Yep, return else + // are neither array filled? + if ($user_id_ary && $username_ary) + { + return false; + } + else if (!$user_id_ary && !$username_ary) + { + return 'NO_USERS'; + } + + $which_ary = ($user_id_ary) ? 'user_id_ary' : 'username_ary'; + + if (${$which_ary} && !is_array(${$which_ary})) + { + ${$which_ary} = array(${$which_ary}); + } + + $sql_in = ($which_ary == 'user_id_ary') ? array_map('intval', ${$which_ary}) : array_map('utf8_clean_string', ${$which_ary}); + + // By unsetting the array here, the values passed in at the point user_get_id_name() was called will be retained. + // Otherwise, if we don't unset (as the array was passed by reference) the original array will be updated below. + if ($update_references === false) + { + unset(${$which_ary}); + } + + $user_id_ary = $username_ary = array(); + + // Grab the user id/username records + $sql_where = ($which_ary == 'user_id_ary') ? 'user_id' : 'username_clean'; + $sql = 'SELECT user_id, username + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set($sql_where, $sql_in); + + if ($user_type !== false && !empty($user_type)) + { + $sql .= ' AND ' . $db->sql_in_set('user_type', $user_type); + } + + $result = $db->sql_query($sql); + + if (!($row = $db->sql_fetchrow($result))) + { + $db->sql_freeresult($result); + return 'NO_USERS'; + } + + do + { + $username_ary[$row['user_id']] = $row['username']; + $user_id_ary[] = $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + $db->sql_freeresult($result); + + return false; +} + +/** +* Get latest registered username and update database to reflect it +*/ +function update_last_username() +{ + global $config, $db; + + // Get latest username + $sql = 'SELECT user_id, username, user_colour + FROM ' . USERS_TABLE . ' + WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ') + ORDER BY user_id DESC'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $config->set('newest_user_id', $row['user_id'], false); + $config->set('newest_username', $row['username'], false); + $config->set('newest_user_colour', $row['user_colour'], false); + } +} + +/** +* Updates a username across all relevant tables/fields +* +* @param string $old_name the old/current username +* @param string $new_name the new username +*/ +function user_update_name($old_name, $new_name) +{ + global $config, $db, $cache, $phpbb_dispatcher; + + $update_ary = array( + FORUMS_TABLE => array( + 'forum_last_poster_id' => 'forum_last_poster_name', + ), + MODERATOR_CACHE_TABLE => array( + 'user_id' => 'username', + ), + POSTS_TABLE => array( + 'poster_id' => 'post_username', + ), + TOPICS_TABLE => array( + 'topic_poster' => 'topic_first_poster_name', + 'topic_last_poster_id' => 'topic_last_poster_name', + ), + ); + + foreach ($update_ary as $table => $field_ary) + { + foreach ($field_ary as $id_field => $name_field) + { + $sql = "UPDATE $table + SET $name_field = '" . $db->sql_escape($new_name) . "' + WHERE $name_field = '" . $db->sql_escape($old_name) . "' + AND $id_field <> " . ANONYMOUS; + $db->sql_query($sql); + } + } + + if ($config['newest_username'] == $old_name) + { + $config->set('newest_username', $new_name, false); + } + + /** + * Update a username when it is changed + * + * @event core.update_username + * @var string old_name The old username that is replaced + * @var string new_name The new username + * @since 3.1.0-a1 + */ + $vars = array('old_name', 'new_name'); + extract($phpbb_dispatcher->trigger_event('core.update_username', compact($vars))); + + // Because some tables/caches use username-specific data we need to purge this here. + $cache->destroy('sql', MODERATOR_CACHE_TABLE); +} + +/** +* Adds an user +* +* @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded. +* @param array $cp_data custom profile fields, see custom_profile::build_insert_sql_array +* @param array $notifications_data The notifications settings for the new user +* @return the new user's ID. +*/ +function user_add($user_row, $cp_data = false, $notifications_data = null) +{ + global $db, $config; + global $phpbb_dispatcher, $phpbb_container; + + if (empty($user_row['username']) || !isset($user_row['group_id']) || !isset($user_row['user_email']) || !isset($user_row['user_type'])) + { + return false; + } + + $username_clean = utf8_clean_string($user_row['username']); + + if (empty($username_clean)) + { + return false; + } + + $sql_ary = array( + 'username' => $user_row['username'], + 'username_clean' => $username_clean, + 'user_password' => (isset($user_row['user_password'])) ? $user_row['user_password'] : '', + 'user_email' => strtolower($user_row['user_email']), + 'group_id' => $user_row['group_id'], + 'user_type' => $user_row['user_type'], + ); + + // These are the additional vars able to be specified + $additional_vars = array( + 'user_permissions' => '', + 'user_timezone' => $config['board_timezone'], + 'user_dateformat' => $config['default_dateformat'], + 'user_lang' => $config['default_lang'], + 'user_style' => (int) $config['default_style'], + 'user_actkey' => '', + 'user_ip' => '', + 'user_regdate' => time(), + 'user_passchg' => time(), + 'user_options' => 230271, + // We do not set the new flag here - registration scripts need to specify it + 'user_new' => 0, + + 'user_inactive_reason' => 0, + 'user_inactive_time' => 0, + 'user_lastmark' => time(), + 'user_lastvisit' => 0, + 'user_lastpost_time' => 0, + 'user_lastpage' => '', + 'user_posts' => 0, + 'user_colour' => '', + 'user_avatar' => '', + 'user_avatar_type' => '', + 'user_avatar_width' => 0, + 'user_avatar_height' => 0, + 'user_new_privmsg' => 0, + 'user_unread_privmsg' => 0, + 'user_last_privmsg' => 0, + 'user_message_rules' => 0, + 'user_full_folder' => PRIVMSGS_NO_BOX, + 'user_emailtime' => 0, + + 'user_notify' => 0, + 'user_notify_pm' => 1, + 'user_notify_type' => NOTIFY_EMAIL, + 'user_allow_pm' => 1, + 'user_allow_viewonline' => 1, + 'user_allow_viewemail' => 1, + 'user_allow_massemail' => 1, + + 'user_sig' => '', + 'user_sig_bbcode_uid' => '', + 'user_sig_bbcode_bitfield' => '', + + 'user_form_salt' => unique_id(), + ); + + // Now fill the sql array with not required variables + foreach ($additional_vars as $key => $default_value) + { + $sql_ary[$key] = (isset($user_row[$key])) ? $user_row[$key] : $default_value; + } + + // Any additional variables in $user_row not covered above? + $remaining_vars = array_diff(array_keys($user_row), array_keys($sql_ary)); + + // Now fill our sql array with the remaining vars + if (count($remaining_vars)) + { + foreach ($remaining_vars as $key) + { + $sql_ary[$key] = $user_row[$key]; + } + } + + /** + * Use this event to modify the values to be inserted when a user is added + * + * @event core.user_add_modify_data + * @var array user_row Array of user details submitted to user_add + * @var array cp_data Array of Custom profile fields submitted to user_add + * @var array sql_ary Array of data to be inserted when a user is added + * @var array notifications_data Array of notification data to be inserted when a user is added + * @since 3.1.0-a1 + * @changed 3.1.0-b5 Added user_row and cp_data + * @changed 3.1.11-RC1 Added notifications_data + */ + $vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data'); + extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars))); + + $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + + $user_id = $db->sql_nextid(); + + // Insert Custom Profile Fields + if ($cp_data !== false && count($cp_data)) + { + $cp_data['user_id'] = (int) $user_id; + + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + $sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . + $db->sql_build_array('INSERT', $cp->build_insert_sql_array($cp_data)); + $db->sql_query($sql); + } + + // Place into appropriate group... + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'user_id' => (int) $user_id, + 'group_id' => (int) $user_row['group_id'], + 'user_pending' => 0) + ); + $db->sql_query($sql); + + // Now make it the users default group... + group_set_user_default($user_row['group_id'], array($user_id), false); + + // Add to newly registered users group if user_new is 1 + if ($config['new_member_post_limit'] && $sql_ary['user_new']) + { + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'NEWLY_REGISTERED' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $add_group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if ($add_group_id) + { + global $phpbb_log; + + // Because these actions only fill the log unnecessarily, we disable it + $phpbb_log->disable('admin'); + + // Add user to "newly registered users" group and set to default group if admin specified so. + if ($config['new_member_group_default']) + { + group_user_add($add_group_id, $user_id, false, false, true); + $user_row['group_id'] = $add_group_id; + } + else + { + group_user_add($add_group_id, $user_id); + } + + $phpbb_log->enable('admin'); + } + } + + // set the newest user and adjust the user count if the user is a normal user and no activation mail is sent + if ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_FOUNDER) + { + $config->set('newest_user_id', $user_id, false); + $config->set('newest_username', $user_row['username'], false); + $config->increment('num_users', 1, false); + + $sql = 'SELECT group_colour + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $user_row['group_id']; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('newest_user_colour', $row['group_colour'], false); + } + + // Use default notifications settings if notifications_data is not set + if ($notifications_data === null) + { + $notifications_data = array( + array( + 'item_type' => 'notification.type.post', + 'method' => 'notification.method.email', + ), + array( + 'item_type' => 'notification.type.topic', + 'method' => 'notification.method.email', + ), + ); + } + + /** + * Modify the notifications data to be inserted in the database when a user is added + * + * @event core.user_add_modify_notifications_data + * @var array user_row Array of user details submitted to user_add + * @var array cp_data Array of Custom profile fields submitted to user_add + * @var array sql_ary Array of data to be inserted when a user is added + * @var array notifications_data Array of notification data to be inserted when a user is added + * @since 3.2.2-RC1 + */ + $vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data'); + extract($phpbb_dispatcher->trigger_event('core.user_add_modify_notifications_data', compact($vars))); + + // Subscribe user to notifications if necessary + if (!empty($notifications_data)) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + foreach ($notifications_data as $subscription) + { + $phpbb_notifications->add_subscription($subscription['item_type'], 0, $subscription['method'], $user_id); + } + } + + /** + * Event that returns user id, user details and user CPF of newly registered user + * + * @event core.user_add_after + * @var int user_id User id of newly registered user + * @var array user_row Array of user details submitted to user_add + * @var array cp_data Array of Custom profile fields submitted to user_add + * @since 3.1.0-b5 + */ + $vars = array('user_id', 'user_row', 'cp_data'); + extract($phpbb_dispatcher->trigger_event('core.user_add_after', compact($vars))); + + return $user_id; +} + +/** + * Remove User + * + * @param string $mode Either 'retain' or 'remove' + * @param mixed $user_ids Either an array of integers or an integer + * @param bool $retain_username + * @return bool + */ +function user_delete($mode, $user_ids, $retain_username = true) +{ + global $cache, $config, $db, $user, $phpbb_dispatcher, $phpbb_container; + global $phpbb_root_path, $phpEx; + + $db->sql_transaction('begin'); + + $user_rows = array(); + if (!is_array($user_ids)) + { + $user_ids = array($user_ids); + } + + $user_id_sql = $db->sql_in_set('user_id', $user_ids); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE ' . $user_id_sql; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $user_rows[(int) $row['user_id']] = $row; + } + $db->sql_freeresult($result); + + if (empty($user_rows)) + { + return false; + } + + /** + * Event before a user is deleted + * + * @event core.delete_user_before + * @var string mode Mode of deletion (retain/delete posts) + * @var array user_ids IDs of the deleted user + * @var mixed retain_username True if username should be retained + * or false if not + * @var array user_rows Array containing data of the deleted users + * @since 3.1.0-a1 + * @changed 3.2.4-RC1 Added user_rows + */ + $vars = array('mode', 'user_ids', 'retain_username', 'user_rows'); + extract($phpbb_dispatcher->trigger_event('core.delete_user_before', compact($vars))); + + // Before we begin, we will remove the reports the user issued. + $sql = 'SELECT r.post_id, p.topic_id + FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p + WHERE ' . $db->sql_in_set('r.user_id', $user_ids) . ' + AND p.post_id = r.post_id'; + $result = $db->sql_query($sql); + + $report_posts = $report_topics = array(); + while ($row = $db->sql_fetchrow($result)) + { + $report_posts[] = $row['post_id']; + $report_topics[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (count($report_posts)) + { + $report_posts = array_unique($report_posts); + $report_topics = array_unique($report_topics); + + // Get a list of topics that still contain reported posts + $sql = 'SELECT DISTINCT topic_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $report_topics) . ' + AND post_reported = 1 + AND ' . $db->sql_in_set('post_id', $report_posts, true); + $result = $db->sql_query($sql); + + $keep_report_topics = array(); + while ($row = $db->sql_fetchrow($result)) + { + $keep_report_topics[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (count($keep_report_topics)) + { + $report_topics = array_diff($report_topics, $keep_report_topics); + } + unset($keep_report_topics); + + // Now set the flags back + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_reported = 0 + WHERE ' . $db->sql_in_set('post_id', $report_posts); + $db->sql_query($sql); + + if (count($report_topics)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_reported = 0 + WHERE ' . $db->sql_in_set('topic_id', $report_topics); + $db->sql_query($sql); + } + } + + // Remove reports + $db->sql_query('DELETE FROM ' . REPORTS_TABLE . ' WHERE ' . $user_id_sql); + + $num_users_delta = 0; + + // Get auth provider collection in case accounts might need to be unlinked + $provider_collection = $phpbb_container->get('auth.provider_collection'); + + // Some things need to be done in the loop (if the query changes based + // on which user is currently being deleted) + $added_guest_posts = 0; + foreach ($user_rows as $user_id => $user_row) + { + if ($user_row['user_avatar'] && $user_row['user_avatar_type'] == 'avatar.driver.upload') + { + avatar_delete('user', $user_row); + } + + // Unlink accounts + foreach ($provider_collection as $provider_name => $auth_provider) + { + $provider_data = $auth_provider->get_auth_link_data($user_id); + + if ($provider_data !== null) + { + $link_data = array( + 'user_id' => $user_id, + 'link_method' => 'user_delete', + ); + + // BLOCK_VARS might contain hidden fields necessary for unlinking accounts + if (isset($provider_data['BLOCK_VARS']) && is_array($provider_data['BLOCK_VARS'])) + { + foreach ($provider_data['BLOCK_VARS'] as $provider_service) + { + if (!array_key_exists('HIDDEN_FIELDS', $provider_service)) + { + $provider_service['HIDDEN_FIELDS'] = array(); + } + + $auth_provider->unlink_account(array_merge($link_data, $provider_service['HIDDEN_FIELDS'])); + } + } + else + { + $auth_provider->unlink_account($link_data); + } + } + } + + // Decrement number of users if this user is active + if ($user_row['user_type'] != USER_INACTIVE && $user_row['user_type'] != USER_IGNORE) + { + --$num_users_delta; + } + + switch ($mode) + { + case 'retain': + if ($retain_username === false) + { + $post_username = $user->lang['GUEST']; + } + else + { + $post_username = $user_row['username']; + } + + // If the user is inactive and newly registered + // we assume no posts from the user, and save + // the queries + if ($user_row['user_type'] != USER_INACTIVE || $user_row['user_inactive_reason'] != INACTIVE_REGISTER || $user_row['user_posts']) + { + // When we delete these users and retain the posts, we must assign all the data to the guest user + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_last_poster_id = ' . ANONYMOUS . ", forum_last_poster_name = '" . $db->sql_escape($post_username) . "', forum_last_poster_colour = '' + WHERE forum_last_poster_id = $user_id"; + $db->sql_query($sql); + + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET poster_id = ' . ANONYMOUS . ", post_username = '" . $db->sql_escape($post_username) . "' + WHERE poster_id = $user_id"; + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_poster = ' . ANONYMOUS . ", topic_first_poster_name = '" . $db->sql_escape($post_username) . "', topic_first_poster_colour = '' + WHERE topic_poster = $user_id"; + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_last_poster_id = ' . ANONYMOUS . ", topic_last_poster_name = '" . $db->sql_escape($post_username) . "', topic_last_poster_colour = '' + WHERE topic_last_poster_id = $user_id"; + $db->sql_query($sql); + + // Since we change every post by this author, we need to count this amount towards the anonymous user + + if ($user_row['user_posts']) + { + $added_guest_posts += $user_row['user_posts']; + } + } + break; + + case 'remove': + // there is nothing variant specific to deleting posts + break; + } + } + + if ($num_users_delta != 0) + { + $config->increment('num_users', $num_users_delta, false); + } + + // Now do the invariant tasks + // all queries performed in one call of this function are in a single transaction + // so this is kosher + if ($mode == 'retain') + { + // Assign more data to the Anonymous user + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET poster_id = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('poster_id', $user_ids); + $db->sql_query($sql); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts + ' . $added_guest_posts . ' + WHERE user_id = ' . ANONYMOUS; + $db->sql_query($sql); + } + else if ($mode == 'remove') + { + if (!function_exists('delete_posts')) + { + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + + // Delete posts, attachments, etc. + // delete_posts can handle any number of IDs in its second argument + delete_posts('poster_id', $user_ids); + } + + $table_ary = [ + USERS_TABLE, + USER_GROUP_TABLE, + TOPICS_WATCH_TABLE, + FORUMS_WATCH_TABLE, + ACL_USERS_TABLE, + TOPICS_TRACK_TABLE, + TOPICS_POSTED_TABLE, + FORUMS_TRACK_TABLE, + PROFILE_FIELDS_DATA_TABLE, + MODERATOR_CACHE_TABLE, + DRAFTS_TABLE, + BOOKMARKS_TABLE, + SESSIONS_KEYS_TABLE, + PRIVMSGS_FOLDER_TABLE, + PRIVMSGS_RULES_TABLE, + $phpbb_container->getParameter('tables.auth_provider_oauth_token_storage'), + $phpbb_container->getParameter('tables.auth_provider_oauth_states'), + $phpbb_container->getParameter('tables.auth_provider_oauth_account_assoc'), + $phpbb_container->getParameter('tables.user_notifications') + ]; + + // Ignore errors on deleting from non-existent tables, e.g. when migrating + $db->sql_return_on_error(true); + // Delete the miscellaneous (non-post) data for the user + foreach ($table_ary as $table) + { + $sql = "DELETE FROM $table + WHERE " . $user_id_sql; + $db->sql_query($sql); + } + $db->sql_return_on_error(); + + $cache->destroy('sql', MODERATOR_CACHE_TABLE); + + // Change user_id to anonymous for posts edited by this user + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_edit_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('post_edit_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for pms edited by this user + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_edit_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('message_edit_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for posts deleted by this user + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_delete_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('post_delete_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for topics deleted by this user + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_delete_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('topic_delete_user', $user_ids); + $db->sql_query($sql); + + // Delete user log entries about this user + $sql = 'DELETE FROM ' . LOG_TABLE . ' + WHERE ' . $db->sql_in_set('reportee_id', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for this users triggered events + $sql = 'UPDATE ' . LOG_TABLE . ' + SET user_id = ' . ANONYMOUS . ' + WHERE ' . $user_id_sql; + $db->sql_query($sql); + + // Delete the user_id from the zebra table + $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' + WHERE ' . $user_id_sql . ' + OR ' . $db->sql_in_set('zebra_id', $user_ids); + $db->sql_query($sql); + + // Delete the user_id from the banlist + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set('ban_userid', $user_ids); + $db->sql_query($sql); + + // Delete the user_id from the session table + $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' + WHERE ' . $db->sql_in_set('session_user_id', $user_ids); + $db->sql_query($sql); + + // Clean the private messages tables from the user + if (!function_exists('phpbb_delete_user_pms')) + { + include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + } + phpbb_delete_users_pms($user_ids); + + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_ids); + + $db->sql_transaction('commit'); + + /** + * Event after a user is deleted + * + * @event core.delete_user_after + * @var string mode Mode of deletion (retain/delete posts) + * @var array user_ids IDs of the deleted user + * @var mixed retain_username True if username should be retained + * or false if not + * @var array user_rows Array containing data of the deleted users + * @since 3.1.0-a1 + * @changed 3.2.2-RC1 Added user_rows + */ + $vars = array('mode', 'user_ids', 'retain_username', 'user_rows'); + extract($phpbb_dispatcher->trigger_event('core.delete_user_after', compact($vars))); + + // Reset newest user info if appropriate + if (in_array($config['newest_user_id'], $user_ids)) + { + update_last_username(); + } + + return false; +} + +/** +* Flips user_type from active to inactive and vice versa, handles group membership updates +* +* @param string $mode can be flip for flipping from active/inactive, activate or deactivate +*/ +function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) +{ + global $config, $db, $user, $auth, $phpbb_dispatcher; + + $deactivated = $activated = 0; + $sql_statements = array(); + + if (!is_array($user_id_ary)) + { + $user_id_ary = array($user_id_ary); + } + + if (!count($user_id_ary)) + { + return; + } + + $sql = 'SELECT user_id, group_id, user_type, user_inactive_reason + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary = array(); + + if ($row['user_type'] == USER_IGNORE || $row['user_type'] == USER_FOUNDER || + ($mode == 'activate' && $row['user_type'] != USER_INACTIVE) || + ($mode == 'deactivate' && $row['user_type'] == USER_INACTIVE)) + { + continue; + } + + if ($row['user_type'] == USER_INACTIVE) + { + $activated++; + } + else + { + $deactivated++; + + // Remove the users session key... + $user->reset_login_keys($row['user_id']); + } + + $sql_ary += array( + 'user_type' => ($row['user_type'] == USER_NORMAL) ? USER_INACTIVE : USER_NORMAL, + 'user_inactive_time' => ($row['user_type'] == USER_NORMAL) ? time() : 0, + 'user_inactive_reason' => ($row['user_type'] == USER_NORMAL) ? $reason : 0, + ); + + $sql_statements[$row['user_id']] = $sql_ary; + } + $db->sql_freeresult($result); + + /** + * Check or modify activated/deactivated users data before submitting it to the database + * + * @event core.user_active_flip_before + * @var string mode User type changing mode, can be: flip|activate|deactivate + * @var int reason Reason for changing user type, can be: INACTIVE_REGISTER|INACTIVE_PROFILE|INACTIVE_MANUAL|INACTIVE_REMIND + * @var int activated The number of users to be activated + * @var int deactivated The number of users to be deactivated + * @var array user_id_ary Array with user ids to change user type + * @var array sql_statements Array with users data to submit to the database, keys: user ids, values: arrays with user data + * @since 3.1.4-RC1 + */ + $vars = array('mode', 'reason', 'activated', 'deactivated', 'user_id_ary', 'sql_statements'); + extract($phpbb_dispatcher->trigger_event('core.user_active_flip_before', compact($vars))); + + if (count($sql_statements)) + { + foreach ($sql_statements as $user_id => $sql_ary) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + } + + $auth->acl_clear_prefetch(array_keys($sql_statements)); + } + + /** + * Perform additional actions after the users have been activated/deactivated + * + * @event core.user_active_flip_after + * @var string mode User type changing mode, can be: flip|activate|deactivate + * @var int reason Reason for changing user type, can be: INACTIVE_REGISTER|INACTIVE_PROFILE|INACTIVE_MANUAL|INACTIVE_REMIND + * @var int activated The number of users to be activated + * @var int deactivated The number of users to be deactivated + * @var array user_id_ary Array with user ids to change user type + * @var array sql_statements Array with users data to submit to the database, keys: user ids, values: arrays with user data + * @since 3.1.4-RC1 + */ + $vars = array('mode', 'reason', 'activated', 'deactivated', 'user_id_ary', 'sql_statements'); + extract($phpbb_dispatcher->trigger_event('core.user_active_flip_after', compact($vars))); + + if ($deactivated) + { + $config->increment('num_users', $deactivated * (-1), false); + } + + if ($activated) + { + $config->increment('num_users', $activated, false); + } + + // Update latest username + update_last_username(); +} + +/** +* Add a ban or ban exclusion to the banlist. Bans either a user, an IP or an email address +* +* @param string $mode Type of ban. One of the following: user, ip, email +* @param mixed $ban Banned entity. Either string or array with usernames, ips or email addresses +* @param int $ban_len Ban length in minutes +* @param string $ban_len_other Ban length as a date (YYYY-MM-DD) +* @param boolean $ban_exclude Exclude these entities from banning? +* @param string $ban_reason String describing the reason for this ban +* @return boolean +*/ +function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason = '') +{ + global $db, $user, $cache, $phpbb_log; + + // Delete stale bans + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ban_end < ' . time() . ' + AND ban_end <> 0'; + $db->sql_query($sql); + + $ban_list = (!is_array($ban)) ? array_unique(explode("\n", $ban)) : $ban; + $ban_list_log = implode(', ', $ban_list); + + $current_time = time(); + + // Set $ban_end to the unix time when the ban should end. 0 is a permanent ban. + if ($ban_len) + { + if ($ban_len != -1 || !$ban_len_other) + { + $ban_end = max($current_time, $current_time + ($ban_len) * 60); + } + else + { + $ban_other = explode('-', $ban_len_other); + if (count($ban_other) == 3 && ((int) $ban_other[0] < 9999) && + (strlen($ban_other[0]) == 4) && (strlen($ban_other[1]) == 2) && (strlen($ban_other[2]) == 2)) + { + $ban_end = max($current_time, $user->create_datetime() + ->setDate((int) $ban_other[0], (int) $ban_other[1], (int) $ban_other[2]) + ->setTime(0, 0, 0) + ->getTimestamp() + $user->timezone->getOffset(new DateTime('UTC'))); + } + else + { + trigger_error('LENGTH_BAN_INVALID', E_USER_WARNING); + } + } + } + else + { + $ban_end = 0; + } + + $founder = $founder_names = array(); + + if (!$ban_exclude) + { + // Create a list of founder... + $sql = 'SELECT user_id, user_email, username_clean + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_FOUNDER; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $founder[$row['user_id']] = $row['user_email']; + $founder_names[$row['user_id']] = $row['username_clean']; + } + $db->sql_freeresult($result); + } + + $banlist_ary = array(); + + switch ($mode) + { + case 'user': + $type = 'ban_userid'; + + // At the moment we do not support wildcard username banning + + // Select the relevant user_ids. + $sql_usernames = array(); + + foreach ($ban_list as $username) + { + $username = trim($username); + if ($username != '') + { + $clean_name = utf8_clean_string($username); + if ($clean_name == $user->data['username_clean']) + { + trigger_error('CANNOT_BAN_YOURSELF', E_USER_WARNING); + } + if (in_array($clean_name, $founder_names)) + { + trigger_error('CANNOT_BAN_FOUNDER', E_USER_WARNING); + } + $sql_usernames[] = $clean_name; + } + } + + // Make sure we have been given someone to ban + if (!count($sql_usernames)) + { + trigger_error('NO_USER_SPECIFIED', E_USER_WARNING); + } + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('username_clean', $sql_usernames); + + // Do not allow banning yourself, the guest account, or founders. + $non_bannable = array($user->data['user_id'], ANONYMOUS); + if (count($founder)) + { + $sql .= ' AND ' . $db->sql_in_set('user_id', array_merge(array_keys($founder), $non_bannable), true); + } + else + { + $sql .= ' AND ' . $db->sql_in_set('user_id', $non_bannable, true); + } + + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $banlist_ary[] = (int) $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + } + else + { + $db->sql_freeresult($result); + trigger_error('NO_USERS', E_USER_WARNING); + } + $db->sql_freeresult($result); + break; + + case 'ip': + $type = 'ban_ip'; + + foreach ($ban_list as $ban_item) + { + if (preg_match('#^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$#', trim($ban_item), $ip_range_explode)) + { + // This is an IP range + // Don't ask about all this, just don't ask ... ! + $ip_1_counter = $ip_range_explode[1]; + $ip_1_end = $ip_range_explode[5]; + + while ($ip_1_counter <= $ip_1_end) + { + $ip_2_counter = ($ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[2] : 0; + $ip_2_end = ($ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[6]; + + if ($ip_2_counter == 0 && $ip_2_end == 254) + { + $ip_2_counter = 256; + + $banlist_ary[] = "$ip_1_counter.*"; + } + + while ($ip_2_counter <= $ip_2_end) + { + $ip_3_counter = ($ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[3] : 0; + $ip_3_end = ($ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[7]; + + if ($ip_3_counter == 0 && $ip_3_end == 254) + { + $ip_3_counter = 256; + + $banlist_ary[] = "$ip_1_counter.$ip_2_counter.*"; + } + + while ($ip_3_counter <= $ip_3_end) + { + $ip_4_counter = ($ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[4] : 0; + $ip_4_end = ($ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end) ? 254 : $ip_range_explode[8]; + + if ($ip_4_counter == 0 && $ip_4_end == 254) + { + $ip_4_counter = 256; + + $banlist_ary[] = "$ip_1_counter.$ip_2_counter.$ip_3_counter.*"; + } + + while ($ip_4_counter <= $ip_4_end) + { + $banlist_ary[] = "$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter"; + $ip_4_counter++; + } + $ip_3_counter++; + } + $ip_2_counter++; + } + $ip_1_counter++; + } + } + else if (preg_match('#^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$#', trim($ban_item)) || preg_match('#^[a-f0-9:]+\*?$#i', trim($ban_item))) + { + // Normal IP address + $banlist_ary[] = trim($ban_item); + } + else if (preg_match('#^\*$#', trim($ban_item))) + { + // Ban all IPs + $banlist_ary[] = '*'; + } + else if (preg_match('#^([\w\-_]\.?){2,}$#is', trim($ban_item))) + { + // hostname + $ip_ary = gethostbynamel(trim($ban_item)); + + if (!empty($ip_ary)) + { + foreach ($ip_ary as $ip) + { + if ($ip) + { + if (strlen($ip) > 40) + { + continue; + } + + $banlist_ary[] = $ip; + } + } + } + } + + if (empty($banlist_ary)) + { + trigger_error('NO_IPS_DEFINED', E_USER_WARNING); + } + } + break; + + case 'email': + $type = 'ban_email'; + + foreach ($ban_list as $ban_item) + { + $ban_item = trim($ban_item); + + if (preg_match('#^.*?@*|(([a-z0-9\-]+\.)+([a-z]{2,3}))$#i', $ban_item)) + { + if (strlen($ban_item) > 100) + { + continue; + } + + if (!count($founder) || !in_array($ban_item, $founder)) + { + $banlist_ary[] = $ban_item; + } + } + } + + if (count($ban_list) == 0) + { + trigger_error('NO_EMAILS_DEFINED', E_USER_WARNING); + } + break; + + default: + trigger_error('NO_MODE', E_USER_WARNING); + break; + } + + // Fetch currently set bans of the specified type and exclude state. Prevent duplicate bans. + $sql_where = ($type == 'ban_userid') ? 'ban_userid <> 0' : "$type <> ''"; + + $sql = "SELECT $type + FROM " . BANLIST_TABLE . " + WHERE $sql_where + AND ban_exclude = " . (int) $ban_exclude; + $result = $db->sql_query($sql); + + // Reset $sql_where, because we use it later... + $sql_where = ''; + + if ($row = $db->sql_fetchrow($result)) + { + $banlist_ary_tmp = array(); + do + { + switch ($mode) + { + case 'user': + $banlist_ary_tmp[] = $row['ban_userid']; + break; + + case 'ip': + $banlist_ary_tmp[] = $row['ban_ip']; + break; + + case 'email': + $banlist_ary_tmp[] = $row['ban_email']; + break; + } + } + while ($row = $db->sql_fetchrow($result)); + + $banlist_ary_tmp = array_intersect($banlist_ary, $banlist_ary_tmp); + + if (count($banlist_ary_tmp)) + { + // One or more entities are already banned/excluded, delete the existing bans, so they can be re-inserted with the given new length + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set($type, $banlist_ary_tmp) . ' + AND ban_exclude = ' . (int) $ban_exclude; + $db->sql_query($sql); + } + + unset($banlist_ary_tmp); + } + $db->sql_freeresult($result); + + // We have some entities to ban + if (count($banlist_ary)) + { + $sql_ary = array(); + + foreach ($banlist_ary as $ban_entry) + { + $sql_ary[] = array( + $type => $ban_entry, + 'ban_start' => (int) $current_time, + 'ban_end' => (int) $ban_end, + 'ban_exclude' => (int) $ban_exclude, + 'ban_reason' => (string) $ban_reason, + 'ban_give_reason' => (string) $ban_give_reason, + ); + } + + $db->sql_multi_insert(BANLIST_TABLE, $sql_ary); + + // If we are banning we want to logout anyone matching the ban + if (!$ban_exclude) + { + switch ($mode) + { + case 'user': + $sql_where = 'WHERE ' . $db->sql_in_set('session_user_id', $banlist_ary); + break; + + case 'ip': + $sql_where = 'WHERE ' . $db->sql_in_set('session_ip', $banlist_ary); + break; + + case 'email': + $banlist_ary_sql = array(); + + foreach ($banlist_ary as $ban_entry) + { + $banlist_ary_sql[] = (string) str_replace('*', '%', $ban_entry); + } + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_email', $banlist_ary_sql); + $result = $db->sql_query($sql); + + $sql_in = array(); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $sql_in[] = $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $sql_where = 'WHERE ' . $db->sql_in_set('session_user_id', $sql_in); + } + $db->sql_freeresult($result); + break; + } + + if (isset($sql_where) && $sql_where) + { + $sql = 'DELETE FROM ' . SESSIONS_TABLE . " + $sql_where"; + $db->sql_query($sql); + + if ($mode == 'user') + { + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' ' . ((in_array('*', $banlist_ary)) ? '' : 'WHERE ' . $db->sql_in_set('user_id', $banlist_ary)); + $db->sql_query($sql); + } + } + } + + // Update log + $log_entry = ($ban_exclude) ? 'LOG_BAN_EXCLUDE_' : 'LOG_BAN_'; + + // Add to admin log, moderator log and user notes + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_entry . strtoupper($mode), false, array($ban_reason, $ban_list_log)); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, $log_entry . strtoupper($mode), false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $ban_reason, + $ban_list_log + )); + if ($mode == 'user') + { + foreach ($banlist_ary as $user_id) + { + $phpbb_log->add('user', $user->data['user_id'], $user->ip, $log_entry . strtoupper($mode), false, array( + 'reportee_id' => $user_id, + $ban_reason, + $ban_list_log + )); + } + } + + $cache->destroy('sql', BANLIST_TABLE); + + return true; + } + + // There was nothing to ban/exclude. But destroying the cache because of the removal of stale bans. + $cache->destroy('sql', BANLIST_TABLE); + + return false; +} + +/** +* Unban User +*/ +function user_unban($mode, $ban) +{ + global $db, $user, $cache, $phpbb_log, $phpbb_dispatcher; + + // Delete stale bans + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ban_end < ' . time() . ' + AND ban_end <> 0'; + $db->sql_query($sql); + + if (!is_array($ban)) + { + $ban = array($ban); + } + + $unban_sql = array_map('intval', $ban); + + if (count($unban_sql)) + { + // Grab details of bans for logging information later + switch ($mode) + { + case 'user': + $sql = 'SELECT u.username AS unban_info, u.user_id + FROM ' . USERS_TABLE . ' u, ' . BANLIST_TABLE . ' b + WHERE ' . $db->sql_in_set('b.ban_id', $unban_sql) . ' + AND u.user_id = b.ban_userid'; + break; + + case 'email': + $sql = 'SELECT ban_email AS unban_info + FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set('ban_id', $unban_sql); + break; + + case 'ip': + $sql = 'SELECT ban_ip AS unban_info + FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set('ban_id', $unban_sql); + break; + } + $result = $db->sql_query($sql); + + $l_unban_list = ''; + $user_ids_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $l_unban_list .= (($l_unban_list != '') ? ', ' : '') . $row['unban_info']; + if ($mode == 'user') + { + $user_ids_ary[] = $row['user_id']; + } + } + $db->sql_freeresult($result); + + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set('ban_id', $unban_sql); + $db->sql_query($sql); + + // Add to moderator log, admin log and user notes + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UNBAN_' . strtoupper($mode), false, array($l_unban_list)); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_UNBAN_' . strtoupper($mode), false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $l_unban_list + )); + if ($mode == 'user') + { + foreach ($user_ids_ary as $user_id) + { + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_UNBAN_' . strtoupper($mode), false, array( + 'reportee_id' => $user_id, + $l_unban_list + )); + } + } + + /** + * Use this event to perform actions after the unban has been performed + * + * @event core.user_unban + * @var string mode One of the following: user, ip, email + * @var array user_ids_ary Array with user_ids + * @since 3.1.11-RC1 + */ + $vars = array( + 'mode', + 'user_ids_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.user_unban', compact($vars))); + } + + $cache->destroy('sql', BANLIST_TABLE); + + return false; +} + +/** +* Internet Protocol Address Whois +* RFC3912: WHOIS Protocol Specification +* +* @param string $ip Ip address, either IPv4 or IPv6. +* +* @return string Empty string if not a valid ip address. +* Otherwise make_clickable()'ed whois result. +*/ +function user_ipwhois($ip) +{ + if (!filter_var($ip, FILTER_VALIDATE_IP)) + { + return ''; + } + + // IPv4 & IPv6 addresses + $whois_host = 'whois.arin.net.'; + + $ipwhois = ''; + + if (($fsk = @fsockopen($whois_host, 43))) + { + // CRLF as per RFC3912 + fputs($fsk, "$ip\r\n"); + while (!feof($fsk)) + { + $ipwhois .= fgets($fsk, 1024); + } + @fclose($fsk); + } + + $match = array(); + + // Test for referrals from $whois_host to other whois databases, roll on rwhois + if (preg_match('#ReferralServer:[\x20]*whois://(.+)#im', $ipwhois, $match)) + { + if (strpos($match[1], ':') !== false) + { + $pos = strrpos($match[1], ':'); + $server = substr($match[1], 0, $pos); + $port = (int) substr($match[1], $pos + 1); + unset($pos); + } + else + { + $server = $match[1]; + $port = 43; + } + + $buffer = ''; + + if (($fsk = @fsockopen($server, $port))) + { + fputs($fsk, "$ip\r\n"); + while (!feof($fsk)) + { + $buffer .= fgets($fsk, 1024); + } + @fclose($fsk); + } + + // Use the result from $whois_host if we don't get any result here + $ipwhois = (empty($buffer)) ? $ipwhois : $buffer; + } + + $ipwhois = htmlspecialchars($ipwhois); + + // Magic URL ;) + return trim(make_clickable($ipwhois, false, '')); +} + +/** +* Data validation ... used primarily but not exclusively by ucp modules +* +* "Master" function for validating a range of data types +*/ +function validate_data($data, $val_ary) +{ + global $user; + + $error = array(); + + foreach ($val_ary as $var => $val_seq) + { + if (!is_array($val_seq[0])) + { + $val_seq = array($val_seq); + } + + foreach ($val_seq as $validate) + { + $function = array_shift($validate); + array_unshift($validate, $data[$var]); + + if (is_array($function)) + { + $result = call_user_func_array(array($function[0], 'validate_' . $function[1]), $validate); + } + else + { + $function_prefix = (function_exists('phpbb_validate_' . $function)) ? 'phpbb_validate_' : 'validate_'; + $result = call_user_func_array($function_prefix . $function, $validate); + } + + if ($result) + { + // Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted. + $error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var); + } + } + } + + return $error; +} + +/** +* Validate String +* +* @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_string($string, $optional = false, $min = 0, $max = 0) +{ + if (empty($string) && $optional) + { + return false; + } + + if ($min && utf8_strlen(htmlspecialchars_decode($string)) < $min) + { + return 'TOO_SHORT'; + } + else if ($max && utf8_strlen(htmlspecialchars_decode($string)) > $max) + { + return 'TOO_LONG'; + } + + return false; +} + +/** +* Validate Number +* +* @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_num($num, $optional = false, $min = 0, $max = 1E99) +{ + if (empty($num) && $optional) + { + return false; + } + + if ($num < $min) + { + return 'TOO_SMALL'; + } + else if ($num > $max) + { + return 'TOO_LARGE'; + } + + return false; +} + +/** +* Validate Date +* @param String $string a date in the dd-mm-yyyy format +* @return boolean +*/ +function validate_date($date_string, $optional = false) +{ + $date = explode('-', $date_string); + if ((empty($date) || count($date) != 3) && $optional) + { + return false; + } + else if ($optional) + { + for ($field = 0; $field <= 1; $field++) + { + $date[$field] = (int) $date[$field]; + if (empty($date[$field])) + { + $date[$field] = 1; + } + } + $date[2] = (int) $date[2]; + // assume an arbitrary leap year + if (empty($date[2])) + { + $date[2] = 1980; + } + } + + if (count($date) != 3 || !checkdate($date[1], $date[0], $date[2])) + { + return 'INVALID'; + } + + return false; +} + + +/** +* Validate Match +* +* @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_match($string, $optional = false, $match = '') +{ + if (empty($string) && $optional) + { + return false; + } + + if (empty($match)) + { + return false; + } + + if (!preg_match($match, $string)) + { + return 'WRONG_DATA'; + } + + return false; +} + +/** +* Validate Language Pack ISO Name +* +* Tests whether a language name is valid and installed +* +* @param string $lang_iso The language string to test +* +* @return bool|string Either false if validation succeeded or +* a string which will be used as the error message +* (with the variable name appended) +*/ +function validate_language_iso_name($lang_iso) +{ + global $db; + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($lang_iso) . "'"; + $result = $db->sql_query($sql); + $lang_id = (int) $db->sql_fetchfield('lang_id'); + $db->sql_freeresult($result); + + return ($lang_id) ? false : 'WRONG_DATA'; +} + +/** +* Validate Timezone Name +* +* Tests whether a timezone name is valid +* +* @param string $timezone The timezone string to test +* +* @return bool|string Either false if validation succeeded or +* a string which will be used as the error message +* (with the variable name appended) +*/ +function phpbb_validate_timezone($timezone) +{ + return (in_array($timezone, phpbb_get_timezone_identifiers($timezone))) ? false : 'TIMEZONE_INVALID'; +} + +/*** + * Validate Username + * + * Check to see if the username has been taken, or if it is disallowed. + * Also checks if it includes the " character or the 4-bytes Unicode ones + * (aka emojis) which we don't allow in usernames. + * Used for registering, changing names, and posting anonymously with a username + * + * @param string $username The username to check + * @param string $allowed_username An allowed username, default being $user->data['username'] + * + * @return mixed Either false if validation succeeded or a string which will be + * used as the error message (with the variable name appended) + */ +function validate_username($username, $allowed_username = false, $allow_all_names = false) +{ + global $config, $db, $user, $cache; + + $clean_username = utf8_clean_string($username); + $allowed_username = ($allowed_username === false) ? $user->data['username_clean'] : utf8_clean_string($allowed_username); + + if ($allowed_username == $clean_username) + { + return false; + } + + // The very first check is for + // out-of-bounds characters that are currently + // not supported by utf8_bin in MySQL + if (preg_match('/[\x{10000}-\x{10FFFF}]/u', $username)) + { + return 'INVALID_EMOJIS'; + } + + // ... fast checks first. + if (strpos($username, '"') !== false || strpos($username, '"') !== false || empty($clean_username)) + { + return 'INVALID_CHARS'; + } + + switch ($config['allow_name_chars']) + { + case 'USERNAME_CHARS_ANY': + $regex = '.+'; + break; + + case 'USERNAME_ALPHA_ONLY': + $regex = '[A-Za-z0-9]+'; + break; + + case 'USERNAME_ALPHA_SPACERS': + $regex = '[A-Za-z0-9-[\]_+ ]+'; + break; + + case 'USERNAME_LETTER_NUM': + $regex = '[\p{Lu}\p{Ll}\p{N}]+'; + break; + + case 'USERNAME_LETTER_NUM_SPACERS': + $regex = '[-\]_+ [\p{Lu}\p{Ll}\p{N}]+'; + break; + + case 'USERNAME_ASCII': + default: + $regex = '[\x01-\x7F]+'; + break; + } + + if (!preg_match('#^' . $regex . '$#u', $username)) + { + return 'INVALID_CHARS'; + } + + $sql = 'SELECT username + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $db->sql_escape($clean_username) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return 'USERNAME_TAKEN'; + } + + $sql = 'SELECT group_name + FROM ' . GROUPS_TABLE . " + WHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($username)) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return 'USERNAME_TAKEN'; + } + + if (!$allow_all_names) + { + $bad_usernames = $cache->obtain_disallowed_usernames(); + + foreach ($bad_usernames as $bad_username) + { + if (preg_match('#^' . $bad_username . '$#', $clean_username)) + { + return 'USERNAME_DISALLOWED'; + } + } + } + + return false; +} + +/** +* Check to see if the password meets the complexity settings +* +* @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_password($password) +{ + global $config; + + if ($password === '' || $config['pass_complex'] === 'PASS_TYPE_ANY') + { + // Password empty or no password complexity required. + return false; + } + + $upp = '\p{Lu}'; + $low = '\p{Ll}'; + $num = '\p{N}'; + $sym = '[^\p{Lu}\p{Ll}\p{N}]'; + $chars = array(); + + switch ($config['pass_complex']) + { + // No break statements below ... + // We require strong passwords in case pass_complex is not set or is invalid + default: + + // Require mixed case letters, numbers and symbols + case 'PASS_TYPE_SYMBOL': + $chars[] = $sym; + + // Require mixed case letters and numbers + case 'PASS_TYPE_ALPHA': + $chars[] = $num; + + // Require mixed case letters + case 'PASS_TYPE_CASE': + $chars[] = $low; + $chars[] = $upp; + } + + foreach ($chars as $char) + { + if (!preg_match('#' . $char . '#u', $password)) + { + return 'INVALID_CHARS'; + } + } + + return false; +} + +/** +* Check to see if email address is a valid address and contains a MX record +* +* @param string $email The email to check +* +* @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function phpbb_validate_email($email, $config = null) +{ + if ($config === null) + { + global $config; + } + + $email = strtolower($email); + + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email)) + { + return 'EMAIL_INVALID'; + } + + // Check MX record. + // The idea for this is from reading the UseBB blog/announcement. :) + if ($config['email_check_mx']) + { + list(, $domain) = explode('@', $email); + + if (checkdnsrr($domain, 'A') === false && checkdnsrr($domain, 'MX') === false) + { + return 'DOMAIN_NO_MX_RECORD'; + } + } + + return false; +} + +/** +* Check to see if email address is banned or already present in the DB +* +* @param string $email The email to check +* @param string $allowed_email An allowed email, default being $user->data['user_email'] +* +* @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_user_email($email, $allowed_email = false) +{ + global $config, $db, $user; + + $email = strtolower($email); + $allowed_email = ($allowed_email === false) ? strtolower($user->data['user_email']) : strtolower($allowed_email); + + if ($allowed_email == $email) + { + return false; + } + + $validate_email = phpbb_validate_email($email, $config); + if ($validate_email) + { + return $validate_email; + } + + $ban = $user->check_ban(false, false, $email, true); + if (!empty($ban)) + { + return !empty($ban['ban_give_reason']) ? $ban['ban_give_reason'] : 'EMAIL_BANNED'; + } + + if (!$config['allow_emailreuse']) + { + $sql = 'SELECT user_email + FROM ' . USERS_TABLE . " + WHERE user_email = '" . $db->sql_escape($email) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return 'EMAIL_TAKEN'; + } + } + + return false; +} + +/** +* Validate jabber address +* Taken from the jabber class within flyspray (see author notes) +* +* @author flyspray.org +*/ +function validate_jabber($jid) +{ + if (!$jid) + { + return false; + } + + $separator_pos = strpos($jid, '@'); + + if ($separator_pos === false) + { + return 'WRONG_DATA'; + } + + $username = substr($jid, 0, $separator_pos); + $realm = substr($jid, $separator_pos + 1); + + if (strlen($username) == 0 || strlen($realm) < 3) + { + return 'WRONG_DATA'; + } + + $arr = explode('.', $realm); + + if (count($arr) == 0) + { + return 'WRONG_DATA'; + } + + foreach ($arr as $part) + { + if (substr($part, 0, 1) == '-' || substr($part, -1, 1) == '-') + { + return 'WRONG_DATA'; + } + + if (!preg_match("@^[a-zA-Z0-9-.]+$@", $part)) + { + return 'WRONG_DATA'; + } + } + + $boundary = array(array(0, 127), array(192, 223), array(224, 239), array(240, 247), array(248, 251), array(252, 253)); + + // Prohibited Characters RFC3454 + RFC3920 + $prohibited = array( + // Table C.1.1 + array(0x0020, 0x0020), // SPACE + // Table C.1.2 + array(0x00A0, 0x00A0), // NO-BREAK SPACE + array(0x1680, 0x1680), // OGHAM SPACE MARK + array(0x2000, 0x2001), // EN QUAD + array(0x2001, 0x2001), // EM QUAD + array(0x2002, 0x2002), // EN SPACE + array(0x2003, 0x2003), // EM SPACE + array(0x2004, 0x2004), // THREE-PER-EM SPACE + array(0x2005, 0x2005), // FOUR-PER-EM SPACE + array(0x2006, 0x2006), // SIX-PER-EM SPACE + array(0x2007, 0x2007), // FIGURE SPACE + array(0x2008, 0x2008), // PUNCTUATION SPACE + array(0x2009, 0x2009), // THIN SPACE + array(0x200A, 0x200A), // HAIR SPACE + array(0x200B, 0x200B), // ZERO WIDTH SPACE + array(0x202F, 0x202F), // NARROW NO-BREAK SPACE + array(0x205F, 0x205F), // MEDIUM MATHEMATICAL SPACE + array(0x3000, 0x3000), // IDEOGRAPHIC SPACE + // Table C.2.1 + array(0x0000, 0x001F), // [CONTROL CHARACTERS] + array(0x007F, 0x007F), // DELETE + // Table C.2.2 + array(0x0080, 0x009F), // [CONTROL CHARACTERS] + array(0x06DD, 0x06DD), // ARABIC END OF AYAH + array(0x070F, 0x070F), // SYRIAC ABBREVIATION MARK + array(0x180E, 0x180E), // MONGOLIAN VOWEL SEPARATOR + array(0x200C, 0x200C), // ZERO WIDTH NON-JOINER + array(0x200D, 0x200D), // ZERO WIDTH JOINER + array(0x2028, 0x2028), // LINE SEPARATOR + array(0x2029, 0x2029), // PARAGRAPH SEPARATOR + array(0x2060, 0x2060), // WORD JOINER + array(0x2061, 0x2061), // FUNCTION APPLICATION + array(0x2062, 0x2062), // INVISIBLE TIMES + array(0x2063, 0x2063), // INVISIBLE SEPARATOR + array(0x206A, 0x206F), // [CONTROL CHARACTERS] + array(0xFEFF, 0xFEFF), // ZERO WIDTH NO-BREAK SPACE + array(0xFFF9, 0xFFFC), // [CONTROL CHARACTERS] + array(0x1D173, 0x1D17A), // [MUSICAL CONTROL CHARACTERS] + // Table C.3 + array(0xE000, 0xF8FF), // [PRIVATE USE, PLANE 0] + array(0xF0000, 0xFFFFD), // [PRIVATE USE, PLANE 15] + array(0x100000, 0x10FFFD), // [PRIVATE USE, PLANE 16] + // Table C.4 + array(0xFDD0, 0xFDEF), // [NONCHARACTER CODE POINTS] + array(0xFFFE, 0xFFFF), // [NONCHARACTER CODE POINTS] + array(0x1FFFE, 0x1FFFF), // [NONCHARACTER CODE POINTS] + array(0x2FFFE, 0x2FFFF), // [NONCHARACTER CODE POINTS] + array(0x3FFFE, 0x3FFFF), // [NONCHARACTER CODE POINTS] + array(0x4FFFE, 0x4FFFF), // [NONCHARACTER CODE POINTS] + array(0x5FFFE, 0x5FFFF), // [NONCHARACTER CODE POINTS] + array(0x6FFFE, 0x6FFFF), // [NONCHARACTER CODE POINTS] + array(0x7FFFE, 0x7FFFF), // [NONCHARACTER CODE POINTS] + array(0x8FFFE, 0x8FFFF), // [NONCHARACTER CODE POINTS] + array(0x9FFFE, 0x9FFFF), // [NONCHARACTER CODE POINTS] + array(0xAFFFE, 0xAFFFF), // [NONCHARACTER CODE POINTS] + array(0xBFFFE, 0xBFFFF), // [NONCHARACTER CODE POINTS] + array(0xCFFFE, 0xCFFFF), // [NONCHARACTER CODE POINTS] + array(0xDFFFE, 0xDFFFF), // [NONCHARACTER CODE POINTS] + array(0xEFFFE, 0xEFFFF), // [NONCHARACTER CODE POINTS] + array(0xFFFFE, 0xFFFFF), // [NONCHARACTER CODE POINTS] + array(0x10FFFE, 0x10FFFF), // [NONCHARACTER CODE POINTS] + // Table C.5 + array(0xD800, 0xDFFF), // [SURROGATE CODES] + // Table C.6 + array(0xFFF9, 0xFFF9), // INTERLINEAR ANNOTATION ANCHOR + array(0xFFFA, 0xFFFA), // INTERLINEAR ANNOTATION SEPARATOR + array(0xFFFB, 0xFFFB), // INTERLINEAR ANNOTATION TERMINATOR + array(0xFFFC, 0xFFFC), // OBJECT REPLACEMENT CHARACTER + array(0xFFFD, 0xFFFD), // REPLACEMENT CHARACTER + // Table C.7 + array(0x2FF0, 0x2FFB), // [IDEOGRAPHIC DESCRIPTION CHARACTERS] + // Table C.8 + array(0x0340, 0x0340), // COMBINING GRAVE TONE MARK + array(0x0341, 0x0341), // COMBINING ACUTE TONE MARK + array(0x200E, 0x200E), // LEFT-TO-RIGHT MARK + array(0x200F, 0x200F), // RIGHT-TO-LEFT MARK + array(0x202A, 0x202A), // LEFT-TO-RIGHT EMBEDDING + array(0x202B, 0x202B), // RIGHT-TO-LEFT EMBEDDING + array(0x202C, 0x202C), // POP DIRECTIONAL FORMATTING + array(0x202D, 0x202D), // LEFT-TO-RIGHT OVERRIDE + array(0x202E, 0x202E), // RIGHT-TO-LEFT OVERRIDE + array(0x206A, 0x206A), // INHIBIT SYMMETRIC SWAPPING + array(0x206B, 0x206B), // ACTIVATE SYMMETRIC SWAPPING + array(0x206C, 0x206C), // INHIBIT ARABIC FORM SHAPING + array(0x206D, 0x206D), // ACTIVATE ARABIC FORM SHAPING + array(0x206E, 0x206E), // NATIONAL DIGIT SHAPES + array(0x206F, 0x206F), // NOMINAL DIGIT SHAPES + // Table C.9 + array(0xE0001, 0xE0001), // LANGUAGE TAG + array(0xE0020, 0xE007F), // [TAGGING CHARACTERS] + // RFC3920 + array(0x22, 0x22), // " + array(0x26, 0x26), // & + array(0x27, 0x27), // ' + array(0x2F, 0x2F), // / + array(0x3A, 0x3A), // : + array(0x3C, 0x3C), // < + array(0x3E, 0x3E), // > + array(0x40, 0x40) // @ + ); + + $pos = 0; + $result = true; + + while ($pos < strlen($username)) + { + $len = $uni = 0; + for ($i = 0; $i <= 5; $i++) + { + if (ord($username[$pos]) >= $boundary[$i][0] && ord($username[$pos]) <= $boundary[$i][1]) + { + $len = $i + 1; + $uni = (ord($username[$pos]) - $boundary[$i][0]) * pow(2, $i * 6); + + for ($k = 1; $k < $len; $k++) + { + $uni += (ord($username[$pos + $k]) - 128) * pow(2, ($i - $k) * 6); + } + + break; + } + } + + if ($len == 0) + { + return 'WRONG_DATA'; + } + + foreach ($prohibited as $pval) + { + if ($uni >= $pval[0] && $uni <= $pval[1]) + { + $result = false; + break 2; + } + } + + $pos = $pos + $len; + } + + if (!$result) + { + return 'WRONG_DATA'; + } + + return false; +} + +/** +* Validate hex colour value +* +* @param string $colour The hex colour value +* @param bool $optional Whether the colour value is optional. True if an empty +* string will be accepted as correct input, false if not. +* @return bool|string Error message if colour value is incorrect, false if it +* fits the hex colour code +*/ +function phpbb_validate_hex_colour($colour, $optional = false) +{ + if ($colour === '') + { + return (($optional) ? false : 'WRONG_DATA'); + } + + if (!preg_match('/^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/', $colour)) + { + return 'WRONG_DATA'; + } + + return false; +} + +/** +* Verifies whether a style ID corresponds to an active style. +* +* @param int $style_id The style_id of a style which should be checked if activated or not. +* @return boolean +*/ +function phpbb_style_is_active($style_id) +{ + global $db; + + $sql = 'SELECT style_active + FROM ' . STYLES_TABLE . ' + WHERE style_id = '. (int) $style_id; + $result = $db->sql_query($sql); + + $style_is_active = (bool) $db->sql_fetchfield('style_active'); + $db->sql_freeresult($result); + + return $style_is_active; +} + +/** +* Remove avatar +*/ +function avatar_delete($mode, $row, $clean_db = false) +{ + global $phpbb_root_path, $config; + + // Check if the users avatar is actually *not* a group avatar + if ($mode == 'user') + { + if (strpos($row['user_avatar'], 'g') === 0 || (((int) $row['user_avatar'] !== 0) && ((int) $row['user_avatar'] !== (int) $row['user_id']))) + { + return false; + } + } + + if ($clean_db) + { + avatar_remove_db($row[$mode . '_avatar']); + } + $filename = get_avatar_filename($row[$mode . '_avatar']); + + if (file_exists($phpbb_root_path . $config['avatar_path'] . '/' . $filename)) + { + @unlink($phpbb_root_path . $config['avatar_path'] . '/' . $filename); + return true; + } + + return false; +} + +/** +* Generates avatar filename from the database entry +*/ +function get_avatar_filename($avatar_entry) +{ + global $config; + + if ($avatar_entry[0] === 'g') + { + $avatar_group = true; + $avatar_entry = substr($avatar_entry, 1); + } + else + { + $avatar_group = false; + } + $ext = substr(strrchr($avatar_entry, '.'), 1); + $avatar_entry = intval($avatar_entry); + return $config['avatar_salt'] . '_' . (($avatar_group) ? 'g' : '') . $avatar_entry . '.' . $ext; +} + +/** +* Returns an explanation string with maximum avatar settings +* +* @return string +*/ +function phpbb_avatar_explanation_string() +{ + global $config, $user; + + return $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', + $user->lang('PIXELS', (int) $config['avatar_max_width']), + $user->lang('PIXELS', (int) $config['avatar_max_height']), + round($config['avatar_filesize'] / 1024)); +} + +// +// Usergroup functions +// + +/** +* Add or edit a group. If we're editing a group we only update user +* parameters such as rank, etc. if they are changed +*/ +function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow_desc_bbcode = false, $allow_desc_urls = false, $allow_desc_smilies = false) +{ + global $db, $user, $phpbb_container, $phpbb_log; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $error = array(); + + // Attributes which also affect the users table + $user_attribute_ary = array('group_colour', 'group_rank', 'group_avatar', 'group_avatar_type', 'group_avatar_width', 'group_avatar_height'); + + // Check data. Limit group name length. + if (!utf8_strlen($name) || utf8_strlen($name) > 60) + { + $error[] = (!utf8_strlen($name)) ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG']; + } + + $err = group_validate_groupname($group_id, $name); + if (!empty($err)) + { + $error[] = $user->lang[$err]; + } + + if (!in_array($type, array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE))) + { + $error[] = $user->lang['GROUP_ERR_TYPE']; + } + + $group_teampage = !empty($group_attributes['group_teampage']); + unset($group_attributes['group_teampage']); + + if (!count($error)) + { + $current_legend = \phpbb\groupposition\legend::GROUP_DISABLED; + $current_teampage = \phpbb\groupposition\teampage::GROUP_DISABLED; + + /* @var $legend \phpbb\groupposition\legend */ + $legend = $phpbb_container->get('groupposition.legend'); + + /* @var $teampage \phpbb\groupposition\teampage */ + $teampage = $phpbb_container->get('groupposition.teampage'); + + if ($group_id) + { + try + { + $current_legend = $legend->get_group_value($group_id); + $current_teampage = $teampage->get_group_value($group_id); + } + catch (\phpbb\groupposition\exception $exception) + { + trigger_error($user->lang($exception->getMessage())); + } + } + + if (!empty($group_attributes['group_legend'])) + { + if (($group_id && ($current_legend == \phpbb\groupposition\legend::GROUP_DISABLED)) || !$group_id) + { + // Old group currently not in the legend or new group, add at the end. + $group_attributes['group_legend'] = 1 + $legend->get_group_count(); + } + else + { + // Group stayes in the legend + $group_attributes['group_legend'] = $current_legend; + } + } + else if ($group_id && ($current_legend != \phpbb\groupposition\legend::GROUP_DISABLED)) + { + // Group is removed from the legend + try + { + $legend->delete_group($group_id, true); + } + catch (\phpbb\groupposition\exception $exception) + { + trigger_error($user->lang($exception->getMessage())); + } + $group_attributes['group_legend'] = \phpbb\groupposition\legend::GROUP_DISABLED; + } + else + { + $group_attributes['group_legend'] = \phpbb\groupposition\legend::GROUP_DISABLED; + } + + // Unset the objects, we don't need them anymore. + unset($legend); + + $user_ary = array(); + $sql_ary = array( + 'group_name' => (string) $name, + 'group_desc' => (string) $desc, + 'group_desc_uid' => '', + 'group_desc_bitfield' => '', + 'group_type' => (int) $type, + ); + + // Parse description + if ($desc) + { + generate_text_for_storage($sql_ary['group_desc'], $sql_ary['group_desc_uid'], $sql_ary['group_desc_bitfield'], $sql_ary['group_desc_options'], $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies); + } + + if (count($group_attributes)) + { + // Merge them with $sql_ary to properly update the group + $sql_ary = array_merge($sql_ary, $group_attributes); + } + + // Setting the log message before we set the group id (if group gets added) + $log = ($group_id) ? 'LOG_GROUP_UPDATED' : 'LOG_GROUP_CREATED'; + + if ($group_id) + { + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $user_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (isset($sql_ary['group_avatar'])) + { + remove_default_avatar($group_id, $user_ary); + } + + if (isset($sql_ary['group_rank'])) + { + remove_default_rank($group_id, $user_ary); + } + + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE group_id = $group_id"; + $db->sql_query($sql); + + // Since we may update the name too, we need to do this on other tables too... + $sql = 'UPDATE ' . MODERATOR_CACHE_TABLE . " + SET group_name = '" . $db->sql_escape($sql_ary['group_name']) . "' + WHERE group_id = $group_id"; + $db->sql_query($sql); + + // One special case is the group skip auth setting. If this was changed we need to purge permissions for this group + if (isset($group_attributes['group_skip_auth'])) + { + // Get users within this group... + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . ' + WHERE group_id = ' . $group_id . ' + AND user_pending = 0'; + $result = $db->sql_query($sql); + + $user_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_id_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (!empty($user_id_ary)) + { + global $auth; + + // Clear permissions cache of relevant users + $auth->acl_clear_prefetch($user_id_ary); + } + } + } + else + { + $sql = 'INSERT INTO ' . GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + } + + // Remove the group from the teampage, only if unselected and we are editing a group, + // which is currently displayed. + if (!$group_teampage && $group_id && $current_teampage != \phpbb\groupposition\teampage::GROUP_DISABLED) + { + try + { + $teampage->delete_group($group_id); + } + catch (\phpbb\groupposition\exception $exception) + { + trigger_error($user->lang($exception->getMessage())); + } + } + + if (!$group_id) + { + $group_id = $db->sql_nextid(); + + if (isset($sql_ary['group_avatar_type']) && $sql_ary['group_avatar_type'] == 'avatar.driver.upload') + { + group_correct_avatar($group_id, $sql_ary['group_avatar']); + } + } + + try + { + if ($group_teampage && $current_teampage == \phpbb\groupposition\teampage::GROUP_DISABLED) + { + $teampage->add_group($group_id); + } + + if ($group_teampage) + { + if ($current_teampage == \phpbb\groupposition\teampage::GROUP_DISABLED) + { + $teampage->add_group($group_id); + } + } + else if ($group_id && ($current_teampage != \phpbb\groupposition\teampage::GROUP_DISABLED)) + { + $teampage->delete_group($group_id); + } + } + catch (\phpbb\groupposition\exception $exception) + { + trigger_error($user->lang($exception->getMessage())); + } + unset($teampage); + + // Set user attributes + $sql_ary = array(); + if (count($group_attributes)) + { + // Go through the user attributes array, check if a group attribute matches it and then set it. ;) + foreach ($user_attribute_ary as $attribute) + { + if (!isset($group_attributes[$attribute])) + { + continue; + } + + // If we are about to set an avatar, we will not overwrite user avatars if no group avatar is set... + if (strpos($attribute, 'group_avatar') === 0 && !$group_attributes[$attribute]) + { + continue; + } + + $sql_ary[$attribute] = $group_attributes[$attribute]; + } + } + + if (count($sql_ary) && count($user_ary)) + { + group_set_user_default($group_id, $user_ary, $sql_ary); + } + + $name = $group_helper->get_name($name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($name)); + + group_update_listings($group_id); + } + + return (count($error)) ? $error : false; +} + + +/** +* Changes a group avatar's filename to conform to the naming scheme +*/ +function group_correct_avatar($group_id, $old_entry) +{ + global $config, $db, $phpbb_root_path; + + $group_id = (int) $group_id; + $ext = substr(strrchr($old_entry, '.'), 1); + $old_filename = get_avatar_filename($old_entry); + $new_filename = $config['avatar_salt'] . "_g$group_id.$ext"; + $new_entry = 'g' . $group_id . '_' . substr(time(), -5) . ".$ext"; + + $avatar_path = $phpbb_root_path . $config['avatar_path']; + if (@rename($avatar_path . '/'. $old_filename, $avatar_path . '/' . $new_filename)) + { + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_avatar = \'' . $db->sql_escape($new_entry) . "' + WHERE group_id = $group_id"; + $db->sql_query($sql); + } +} + + +/** +* Remove avatar also for users not having the group as default +*/ +function avatar_remove_db($avatar_name) +{ + global $db; + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_avatar = '', + user_avatar_type = '' + WHERE user_avatar = '" . $db->sql_escape($avatar_name) . '\''; + $db->sql_query($sql); +} + + +/** +* Group Delete +*/ +function group_delete($group_id, $group_name = false) +{ + global $db, $cache, $auth, $user, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_container, $phpbb_log; + + if (!$group_name) + { + $group_name = get_group_name($group_id); + } + + $start = 0; + + do + { + $user_id_ary = $username_ary = array(); + + // Batch query for group members, call group_user_del + $sql = 'SELECT u.user_id, u.username + FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . " u + WHERE ug.group_id = $group_id + AND u.user_id = ug.user_id"; + $result = $db->sql_query_limit($sql, 200, $start); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $user_id_ary[] = $row['user_id']; + $username_ary[] = $row['username']; + + $start++; + } + while ($row = $db->sql_fetchrow($result)); + + group_user_del($group_id, $user_id_ary, $username_ary, $group_name); + } + else + { + $start = 0; + } + $db->sql_freeresult($result); + } + while ($start); + + // Delete group from legend and teampage + try + { + /* @var $legend \phpbb\groupposition\legend */ + $legend = $phpbb_container->get('groupposition.legend'); + $legend->delete_group($group_id); + unset($legend); + } + catch (\phpbb\groupposition\exception $exception) + { + // The group we want to delete does not exist. + // No reason to worry, we just continue the deleting process. + //trigger_error($user->lang($exception->getMessage())); + } + + try + { + /* @var $teampage \phpbb\groupposition\teampage */ + $teampage = $phpbb_container->get('groupposition.teampage'); + $teampage->delete_group($group_id); + unset($teampage); + } + catch (\phpbb\groupposition\exception $exception) + { + // The group we want to delete does not exist. + // No reason to worry, we just continue the deleting process. + //trigger_error($user->lang($exception->getMessage())); + } + + // Delete group + $sql = 'DELETE FROM ' . GROUPS_TABLE . " + WHERE group_id = $group_id"; + $db->sql_query($sql); + + // Delete auth entries from the groups table + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " + WHERE group_id = $group_id"; + $db->sql_query($sql); + + /** + * Event after a group is deleted + * + * @event core.delete_group_after + * @var int group_id ID of the deleted group + * @var string group_name Name of the deleted group + * @since 3.1.0-a1 + */ + $vars = array('group_id', 'group_name'); + extract($phpbb_dispatcher->trigger_event('core.delete_group_after', compact($vars))); + + // Re-cache moderators + if (!function_exists('phpbb_cache_moderators')) + { + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + + phpbb_cache_moderators($db, $cache, $auth); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_GROUP_DELETE', false, array($group_name)); + + // Return false - no error + return false; +} + +/** +* Add user(s) to group +* +* @return mixed false if no errors occurred, else the user lang string for the relevant error, for example 'NO_USER' +*/ +function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $default = false, $leader = 0, $pending = 0, $group_attributes = false) +{ + global $db, $auth, $user, $phpbb_container, $phpbb_log, $phpbb_dispatcher; + + // We need both username and user_id info + $result = user_get_id_name($user_id_ary, $username_ary); + + if (empty($user_id_ary) || $result !== false) + { + return 'NO_USER'; + } + + // Because the item that gets passed into the previous function is unset, the reference is lost and our original + // array is retained - so we know there's a problem if there's a different number of ids to usernames now. + if (count($user_id_ary) != count($username_ary)) + { + return 'GROUP_USERS_INVALID'; + } + + // Remove users who are already members of this group + $sql = 'SELECT user_id, group_leader + FROM ' . USER_GROUP_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary) . " + AND group_id = $group_id"; + $result = $db->sql_query($sql); + + $add_id_ary = $update_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $add_id_ary[] = (int) $row['user_id']; + + if ($leader && !$row['group_leader']) + { + $update_id_ary[] = (int) $row['user_id']; + } + } + $db->sql_freeresult($result); + + // Do all the users exist in this group? + $add_id_ary = array_diff($user_id_ary, $add_id_ary); + + // If we have no users + if (!count($add_id_ary) && !count($update_id_ary)) + { + return 'GROUP_USERS_EXIST'; + } + + $db->sql_transaction('begin'); + + // Insert the new users + if (count($add_id_ary)) + { + $sql_ary = array(); + + foreach ($add_id_ary as $user_id) + { + $sql_ary[] = array( + 'user_id' => (int) $user_id, + 'group_id' => (int) $group_id, + 'group_leader' => (int) $leader, + 'user_pending' => (int) $pending, + ); + } + + $db->sql_multi_insert(USER_GROUP_TABLE, $sql_ary); + } + + if (count($update_id_ary)) + { + $sql = 'UPDATE ' . USER_GROUP_TABLE . ' + SET group_leader = 1 + WHERE ' . $db->sql_in_set('user_id', $update_id_ary) . " + AND group_id = $group_id"; + $db->sql_query($sql); + } + + if ($default) + { + group_user_attributes('default', $group_id, $user_id_ary, false, $group_name, $group_attributes); + } + + $db->sql_transaction('commit'); + + // Clear permissions cache of relevant users + $auth->acl_clear_prefetch($user_id_ary); + + /** + * Event after users are added to a group + * + * @event core.group_add_user_after + * @var int group_id ID of the group to which users are added + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users which are added + * @var array username_ary names of the users which are added + * @var int pending Pending setting, 1 if user(s) added are pending + * @since 3.1.7-RC1 + */ + $vars = array( + 'group_id', + 'group_name', + 'user_id_ary', + 'username_ary', + 'pending', + ); + extract($phpbb_dispatcher->trigger_event('core.group_add_user_after', compact($vars))); + + if (!$group_name) + { + $group_name = get_group_name($group_id); + } + + $log = ($leader) ? 'LOG_MODS_ADDED' : (($pending) ? 'LOG_USERS_PENDING' : 'LOG_USERS_ADDED'); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($group_name, implode(', ', $username_ary))); + + group_update_listings($group_id); + + if ($pending) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + foreach ($add_id_ary as $user_id) + { + $phpbb_notifications->add_notifications('notification.type.group_request', array( + 'group_id' => $group_id, + 'user_id' => $user_id, + 'group_name' => $group_name, + )); + } + } + + // Return false - no error + return false; +} + +/** +* Remove a user/s from a given group. When we remove users we update their +* default group_id. We do this by examining which "special" groups they belong +* to. The selection is made based on a reasonable priority system +* +* @return false if no errors occurred, else the user lang string for the relevant error, for example 'NO_USER' +*/ +function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $log_action = true) +{ + global $db, $auth, $config, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_log; + + if ($config['coppa_enable']) + { + $group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'NEWLY_REGISTERED', 'REGISTERED_COPPA', 'REGISTERED', 'BOTS', 'GUESTS'); + } + else + { + $group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'NEWLY_REGISTERED', 'REGISTERED', 'BOTS', 'GUESTS'); + } + + // We need both username and user_id info + $result = user_get_id_name($user_id_ary, $username_ary); + + if (empty($user_id_ary) || $result !== false) + { + return 'NO_USER'; + } + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_name', $group_order); + $result = $db->sql_query($sql); + + $group_order_id = $special_group_data = array(); + while ($row = $db->sql_fetchrow($result)) + { + $group_order_id[$row['group_name']] = $row['group_id']; + + $special_group_data[$row['group_id']] = array( + 'group_colour' => $row['group_colour'], + 'group_rank' => $row['group_rank'], + ); + + // Only set the group avatar if one is defined... + if ($row['group_avatar']) + { + $special_group_data[$row['group_id']] = array_merge($special_group_data[$row['group_id']], array( + 'group_avatar' => $row['group_avatar'], + 'group_avatar_type' => $row['group_avatar_type'], + 'group_avatar_width' => $row['group_avatar_width'], + 'group_avatar_height' => $row['group_avatar_height']) + ); + } + } + $db->sql_freeresult($result); + + // Get users default groups - we only need to reset default group membership if the group from which the user gets removed is set as default + $sql = 'SELECT user_id, group_id + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary); + $result = $db->sql_query($sql); + + $default_groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $default_groups[$row['user_id']] = $row['group_id']; + } + $db->sql_freeresult($result); + + // What special group memberships exist for these users? + $sql = 'SELECT g.group_id, g.group_name, ug.user_id + FROM ' . USER_GROUP_TABLE . ' ug, ' . GROUPS_TABLE . ' g + WHERE ' . $db->sql_in_set('ug.user_id', $user_id_ary) . " + AND g.group_id = ug.group_id + AND g.group_id <> $group_id + AND g.group_type = " . GROUP_SPECIAL . ' + ORDER BY ug.user_id, g.group_id'; + $result = $db->sql_query($sql); + + $temp_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + if ($default_groups[$row['user_id']] == $group_id && (!isset($temp_ary[$row['user_id']]) || $group_order_id[$row['group_name']] < $temp_ary[$row['user_id']])) + { + $temp_ary[$row['user_id']] = $row['group_id']; + } + } + $db->sql_freeresult($result); + + // sql_where_ary holds the new default groups and their users + $sql_where_ary = array(); + foreach ($temp_ary as $uid => $gid) + { + $sql_where_ary[$gid][] = $uid; + } + unset($temp_ary); + + foreach ($special_group_data as $gid => $default_data_ary) + { + if (isset($sql_where_ary[$gid]) && count($sql_where_ary[$gid])) + { + remove_default_rank($group_id, $sql_where_ary[$gid]); + remove_default_avatar($group_id, $sql_where_ary[$gid]); + group_set_user_default($gid, $sql_where_ary[$gid], $default_data_ary); + } + } + unset($special_group_data); + + /** + * Event before users are removed from a group + * + * @event core.group_delete_user_before + * @var int group_id ID of the group from which users are deleted + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users which are removed + * @var array username_ary names of the users which are removed + * @since 3.1.0-a1 + */ + $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); + extract($phpbb_dispatcher->trigger_event('core.group_delete_user_before', compact($vars))); + + $sql = 'DELETE FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + AND " . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + + // Clear permissions cache of relevant users + $auth->acl_clear_prefetch($user_id_ary); + + /** + * Event after users are removed from a group + * + * @event core.group_delete_user_after + * @var int group_id ID of the group from which users are deleted + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users which are removed + * @var array username_ary names of the users which are removed + * @since 3.1.7-RC1 + */ + $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); + extract($phpbb_dispatcher->trigger_event('core.group_delete_user_after', compact($vars))); + + if ($log_action) + { + if (!$group_name) + { + $group_name = get_group_name($group_id); + } + + $log = 'LOG_GROUP_REMOVE'; + + if ($group_name) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($group_name, implode(', ', $username_ary))); + } + } + + group_update_listings($group_id); + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->delete_notifications('notification.type.group_request', $user_id_ary, $group_id); + + // Return false - no error + return false; +} + + +/** +* Removes the group avatar of the default group from the users in user_ids who have that group as default. +*/ +function remove_default_avatar($group_id, $user_ids) +{ + global $db; + + if (!is_array($user_ids)) + { + $user_ids = array($user_ids); + } + if (empty($user_ids)) + { + return false; + } + + $user_ids = array_map('intval', $user_ids); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + if (!$row = $db->sql_fetchrow($result)) + { + $db->sql_freeresult($result); + return false; + } + $db->sql_freeresult($result); + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_avatar = '', + user_avatar_type = '', + user_avatar_width = 0, + user_avatar_height = 0 + WHERE group_id = " . (int) $group_id . " + AND user_avatar = '" . $db->sql_escape($row['group_avatar']) . "' + AND " . $db->sql_in_set('user_id', $user_ids); + + $db->sql_query($sql); +} + +/** +* Removes the group rank of the default group from the users in user_ids who have that group as default. +*/ +function remove_default_rank($group_id, $user_ids) +{ + global $db; + + if (!is_array($user_ids)) + { + $user_ids = array($user_ids); + } + if (empty($user_ids)) + { + return false; + } + + $user_ids = array_map('intval', $user_ids); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + if (!$row = $db->sql_fetchrow($result)) + { + $db->sql_freeresult($result); + return false; + } + $db->sql_freeresult($result); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_rank = 0 + WHERE group_id = ' . (int) $group_id . ' + AND user_rank <> 0 + AND user_rank = ' . (int) $row['group_rank'] . ' + AND ' . $db->sql_in_set('user_id', $user_ids); + $db->sql_query($sql); +} + +/** +* This is used to promote (to leader), demote or set as default a member/s +*/ +function group_user_attributes($action, $group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $group_attributes = false) +{ + global $db, $auth, $user, $phpbb_container, $phpbb_log, $phpbb_dispatcher; + + // We need both username and user_id info + $result = user_get_id_name($user_id_ary, $username_ary); + + if (empty($user_id_ary) || $result !== false) + { + return 'NO_USERS'; + } + + if (!$group_name) + { + $group_name = get_group_name($group_id); + } + + switch ($action) + { + case 'demote': + case 'promote': + + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + AND user_pending = 1 + AND " . $db->sql_in_set('user_id', $user_id_ary); + $result = $db->sql_query_limit($sql, 1); + $not_empty = ($db->sql_fetchrow($result)); + $db->sql_freeresult($result); + if ($not_empty) + { + return 'NO_VALID_USERS'; + } + + $sql = 'UPDATE ' . USER_GROUP_TABLE . ' + SET group_leader = ' . (($action == 'promote') ? 1 : 0) . " + WHERE group_id = $group_id + AND user_pending = 0 + AND " . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + + $log = ($action == 'promote') ? 'LOG_GROUP_PROMOTED' : 'LOG_GROUP_DEMOTED'; + break; + + case 'approve': + // Make sure we only approve those which are pending ;) + $sql = 'SELECT u.user_id, u.user_email, u.username, u.username_clean, u.user_notify_type, u.user_jabber, u.user_lang + FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug + WHERE ug.group_id = ' . $group_id . ' + AND ug.user_pending = 1 + AND ug.user_id = u.user_id + AND ' . $db->sql_in_set('ug.user_id', $user_id_ary); + $result = $db->sql_query($sql); + + $user_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_id_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (!count($user_id_ary)) + { + return false; + } + + $sql = 'UPDATE ' . USER_GROUP_TABLE . " + SET user_pending = 0 + WHERE group_id = $group_id + AND " . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->add_notifications('notification.type.group_request_approved', array( + 'user_ids' => $user_id_ary, + 'group_id' => $group_id, + 'group_name' => $group_name, + )); + $phpbb_notifications->delete_notifications('notification.type.group_request', $user_id_ary, $group_id); + + $log = 'LOG_USERS_APPROVED'; + break; + + case 'default': + // We only set default group for approved members of the group + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + AND user_pending = 0 + AND " . $db->sql_in_set('user_id', $user_id_ary); + $result = $db->sql_query($sql); + + $user_id_ary = $username_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_id_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + $result = user_get_id_name($user_id_ary, $username_ary); + if (!count($user_id_ary) || $result !== false) + { + return 'NO_USERS'; + } + + $sql = 'SELECT user_id, group_id + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary, false, true); + $result = $db->sql_query($sql); + + $groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($groups[$row['group_id']])) + { + $groups[$row['group_id']] = array(); + } + $groups[$row['group_id']][] = $row['user_id']; + } + $db->sql_freeresult($result); + + foreach ($groups as $gid => $uids) + { + remove_default_rank($gid, $uids); + remove_default_avatar($gid, $uids); + } + group_set_user_default($group_id, $user_id_ary, $group_attributes); + $log = 'LOG_GROUP_DEFAULTS'; + break; + } + + /** + * Event to perform additional actions on setting user group attributes + * + * @event core.user_set_group_attributes + * @var int group_id ID of the group + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users to set group attributes + * @var array username_ary Names of the users to set group attributes + * @var array group_attributes Group attributes which were changed + * @var string action Action to perform over the group members + * @since 3.1.10-RC1 + */ + $vars = array( + 'group_id', + 'group_name', + 'user_id_ary', + 'username_ary', + 'group_attributes', + 'action', + ); + extract($phpbb_dispatcher->trigger_event('core.user_set_group_attributes', compact($vars))); + + // Clear permissions cache of relevant users + $auth->acl_clear_prefetch($user_id_ary); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($group_name, implode(', ', $username_ary))); + + group_update_listings($group_id); + + return false; +} + +/** +* A small version of validate_username to check for a group name's existence. To be called directly. +*/ +function group_validate_groupname($group_id, $group_name) +{ + global $db; + + $group_name = utf8_clean_string($group_name); + + if (!empty($group_id)) + { + $sql = 'SELECT group_name + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + return false; + } + + $allowed_groupname = utf8_clean_string($row['group_name']); + + if ($allowed_groupname == $group_name) + { + return false; + } + } + + $sql = 'SELECT group_name + FROM ' . GROUPS_TABLE . " + WHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($group_name)) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return 'GROUP_NAME_TAKEN'; + } + + return false; +} + +/** +* Set users default group +* +* @access private +*/ +function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false) +{ + global $config, $phpbb_container, $db, $phpbb_dispatcher; + + if (empty($user_id_ary)) + { + return; + } + + $attribute_ary = array( + 'group_colour' => 'string', + 'group_rank' => 'int', + 'group_avatar' => 'string', + 'group_avatar_type' => 'string', + 'group_avatar_width' => 'int', + 'group_avatar_height' => 'int', + ); + + $sql_ary = array( + 'group_id' => $group_id + ); + + // Were group attributes passed to the function? If not we need to obtain them + if ($group_attributes === false) + { + $sql = 'SELECT ' . implode(', ', array_keys($attribute_ary)) . ' + FROM ' . GROUPS_TABLE . " + WHERE group_id = $group_id"; + $result = $db->sql_query($sql); + $group_attributes = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + foreach ($attribute_ary as $attribute => $type) + { + if (isset($group_attributes[$attribute])) + { + // If we are about to set an avatar or rank, we will not overwrite with empty, unless we are not actually changing the default group + if ((strpos($attribute, 'group_avatar') === 0 || strpos($attribute, 'group_rank') === 0) && !$group_attributes[$attribute]) + { + continue; + } + + settype($group_attributes[$attribute], $type); + $sql_ary[str_replace('group_', 'user_', $attribute)] = $group_attributes[$attribute]; + } + } + + $updated_sql_ary = $sql_ary; + + // Before we update the user attributes, we will update the rank for users that don't have a custom rank + if (isset($sql_ary['user_rank'])) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', array('user_rank' => $sql_ary['user_rank'])) . ' + WHERE user_rank = 0 + AND ' . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + unset($sql_ary['user_rank']); + } + + // Before we update the user attributes, we will update the avatar for users that don't have a custom avatar + $avatar_options = array('user_avatar', 'user_avatar_type', 'user_avatar_height', 'user_avatar_width'); + + if (isset($sql_ary['user_avatar'])) + { + $avatar_sql_ary = array(); + foreach ($avatar_options as $avatar_option) + { + if (isset($sql_ary[$avatar_option])) + { + $avatar_sql_ary[$avatar_option] = $sql_ary[$avatar_option]; + } + } + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $avatar_sql_ary) . " + WHERE user_avatar = '' + AND " . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + } + + // Remove the avatar options, as we already updated them + foreach ($avatar_options as $avatar_option) + { + unset($sql_ary[$avatar_option]); + } + + if (!empty($sql_ary)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + } + + if (isset($sql_ary['user_colour'])) + { + // Update any cached colour information for these users + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET forum_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('forum_last_poster_id', $user_id_ary); + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_first_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('topic_poster', $user_id_ary); + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('topic_last_poster_id', $user_id_ary); + $db->sql_query($sql); + + if (in_array($config['newest_user_id'], $user_id_ary)) + { + $config->set('newest_user_colour', $sql_ary['user_colour'], false); + } + } + + // Make all values available for the event + $sql_ary = $updated_sql_ary; + + /** + * Event when the default group is set for an array of users + * + * @event core.user_set_default_group + * @var int group_id ID of the group + * @var array user_id_ary IDs of the users + * @var array group_attributes Group attributes which were changed + * @var array update_listing Update the list of moderators and foes + * @var array sql_ary User attributes which were changed + * @since 3.1.0-a1 + */ + $vars = array('group_id', 'user_id_ary', 'group_attributes', 'update_listing', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.user_set_default_group', compact($vars))); + + if ($update_listing) + { + group_update_listings($group_id); + } + + // Because some tables/caches use usercolour-specific data we need to purge this here. + $phpbb_container->get('cache.driver')->destroy('sql', MODERATOR_CACHE_TABLE); +} + +/** +* Get group name +*/ +function get_group_name($group_id) +{ + global $db, $phpbb_container; + + $sql = 'SELECT group_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + return ''; + } + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + return $group_helper->get_name($row['group_name']); +} + +/** +* Obtain either the members of a specified group, the groups the specified user is subscribed to +* or checking if a specified user is in a specified group. This function does not return pending memberships. +* +* Note: Never use this more than once... first group your users/groups +*/ +function group_memberships($group_id_ary = false, $user_id_ary = false, $return_bool = false) +{ + global $db; + + if (!$group_id_ary && !$user_id_ary) + { + return true; + } + + if ($user_id_ary) + { + $user_id_ary = (!is_array($user_id_ary)) ? array($user_id_ary) : $user_id_ary; + } + + if ($group_id_ary) + { + $group_id_ary = (!is_array($group_id_ary)) ? array($group_id_ary) : $group_id_ary; + } + + $sql = 'SELECT ug.*, u.username, u.username_clean, u.user_email + FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u + WHERE ug.user_id = u.user_id + AND ug.user_pending = 0 AND '; + + if ($group_id_ary) + { + $sql .= ' ' . $db->sql_in_set('ug.group_id', $group_id_ary); + } + + if ($user_id_ary) + { + $sql .= ($group_id_ary) ? ' AND ' : ' '; + $sql .= $db->sql_in_set('ug.user_id', $user_id_ary); + } + + $result = ($return_bool) ? $db->sql_query_limit($sql, 1) : $db->sql_query($sql); + + $row = $db->sql_fetchrow($result); + + if ($return_bool) + { + $db->sql_freeresult($result); + return ($row) ? true : false; + } + + if (!$row) + { + return false; + } + + $return = array(); + + do + { + $return[] = $row; + } + while ($row = $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + + return $return; +} + +/** +* Re-cache moderators and foes if group has a_ or m_ permissions +*/ +function group_update_listings($group_id) +{ + global $db, $cache, $auth; + + $hold_ary = $auth->acl_group_raw_data($group_id, array('a_', 'm_')); + + if (empty($hold_ary)) + { + return; + } + + $mod_permissions = $admin_permissions = false; + + foreach ($hold_ary as $g_id => $forum_ary) + { + foreach ($forum_ary as $forum_id => $auth_ary) + { + foreach ($auth_ary as $auth_option => $setting) + { + if ($mod_permissions && $admin_permissions) + { + break 3; + } + + if ($setting != ACL_YES) + { + continue; + } + + if ($auth_option == 'm_') + { + $mod_permissions = true; + } + + if ($auth_option == 'a_') + { + $admin_permissions = true; + } + } + } + } + + if ($mod_permissions) + { + if (!function_exists('phpbb_cache_moderators')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + phpbb_cache_moderators($db, $cache, $auth); + } + + if ($mod_permissions || $admin_permissions) + { + if (!function_exists('phpbb_update_foes')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + phpbb_update_foes($db, $auth, array($group_id)); + } +} + + + +/** +* Funtion to make a user leave the NEWLY_REGISTERED system group. +* @access public +* @param $user_id The id of the user to remove from the group +*/ +function remove_newly_registered($user_id, $user_data = false) +{ + global $db; + + if ($user_data === false) + { + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + return false; + } + else + { + $user_data = $user_row; + } + } + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'NEWLY_REGISTERED' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if (!$group_id) + { + return false; + } + + // We need to call group_user_del here, because this function makes sure everything is correctly changed. + // Force function to not log the removal of users from newly registered users group + group_user_del($group_id, $user_id, false, false, false); + + // Set user_new to 0 to let this not be triggered again + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new = 0 + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + + // The new users group was the users default group? + if ($user_data['group_id'] == $group_id) + { + // Which group is now the users default one? + $sql = 'SELECT group_id + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $user_data['group_id'] = $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + } + + return $user_data['group_id']; +} + +/** +* Gets user ids of currently banned registered users. +* +* @param array $user_ids Array of users' ids to check for banning, +* leave empty to get complete list of banned ids +* @param bool|int $ban_end Bool True to get users currently banned +* Bool False to only get permanently banned users +* Int Unix timestamp to get users banned until that time +* @return array Array of banned users' ids if any, empty array otherwise +*/ +function phpbb_get_banned_user_ids($user_ids = array(), $ban_end = true) +{ + global $db; + + $sql_user_ids = (!empty($user_ids)) ? $db->sql_in_set('ban_userid', $user_ids) : 'ban_userid <> 0'; + + // Get banned User ID's + // Ignore stale bans which were not wiped yet + $banned_ids_list = array(); + $sql = 'SELECT ban_userid + FROM ' . BANLIST_TABLE . " + WHERE $sql_user_ids + AND ban_exclude <> 1"; + + if ($ban_end === true) + { + // Banned currently + $sql .= " AND (ban_end > " . time() . ' + OR ban_end = 0)'; + } + else if ($ban_end === false) + { + // Permanently banned + $sql .= " AND ban_end = 0"; + } + else + { + // Banned until a specified time + $sql .= " AND (ban_end > " . (int) $ban_end . ' + OR ban_end = 0)'; + } + + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $user_id = (int) $row['ban_userid']; + $banned_ids_list[$user_id] = $user_id; + } + $db->sql_freeresult($result); + + return $banned_ids_list; +} + +/** +* Function for assigning a template var if the zebra module got included +*/ +function phpbb_module_zebra($mode, &$module_row) +{ + global $template; + + $template->assign_var('S_ZEBRA_ENABLED', true); + + if ($mode == 'friends') + { + $template->assign_var('S_ZEBRA_FRIENDS_ENABLED', true); + } + + if ($mode == 'foes') + { + $template->assign_var('S_ZEBRA_FOES_ENABLED', true); + } +} diff --git a/install/update/new/includes/mcp/mcp_ban.php b/install/update/new/includes/mcp/mcp_ban.php new file mode 100644 index 0000000..6f748f5 --- /dev/null +++ b/install/update/new/includes/mcp/mcp_ban.php @@ -0,0 +1,301 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class mcp_ban +{ + var $u_action; + + function main($id, $mode) + { + global $db, $user, $auth, $template, $request, $phpbb_dispatcher; + global $phpbb_root_path, $phpEx; + + if (!function_exists('user_ban')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + // Include the admin banning interface... + if (!class_exists('acp_ban')) + { + include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx); + } + + $bansubmit = $request->is_set_post('bansubmit'); + $unbansubmit = $request->is_set_post('unbansubmit'); + + $user->add_lang(array('acp/ban', 'acp/users')); + $this->tpl_name = 'mcp_ban'; + + /** + * Use this event to pass perform actions when a ban is issued or revoked + * + * @event core.mcp_ban_main + * @var bool bansubmit True if a ban is issued + * @var bool unbansubmit True if a ban is removed + * @var string mode Mode of the ban that is being worked on + * @since 3.1.0-RC5 + */ + $vars = array( + 'bansubmit', + 'unbansubmit', + 'mode', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_main', compact($vars))); + + // Ban submitted? + if ($bansubmit) + { + // Grab the list of entries + $ban = $request->variable('ban', '', $mode === 'user'); + $ban_length = $request->variable('banlength', 0); + $ban_length_other = $request->variable('banlengthother', ''); + $ban_exclude = $request->variable('banexclude', 0); + $ban_reason = $request->variable('banreason', '', true); + $ban_give_reason = $request->variable('bangivereason', '', true); + + if ($ban) + { + if (confirm_box(true)) + { + $abort_ban = false; + /** + * Use this event to modify the ban details before the ban is performed + * + * @event core.mcp_ban_before + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @var mixed abort_ban Either false, or an error message that is displayed to the user. + * If a string is given the bans are not issued. + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + 'abort_ban', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_before', compact($vars))); + + if ($abort_ban) + { + trigger_error($abort_ban); + } + user_ban($mode, $ban, $ban_length, $ban_length_other, $ban_exclude, $ban_reason, $ban_give_reason); + + /** + * Use this event to perform actions after the ban has been performed + * + * @event core.mcp_ban_after + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_after', compact($vars))); + + trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '

« ' . $user->lang['BACK_TO_PREV'] . ''); + } + else + { + $hidden_fields = array( + 'mode' => $mode, + 'ban' => $ban, + 'bansubmit' => true, + 'banlength' => $ban_length, + 'banlengthother' => $ban_length_other, + 'banexclude' => $ban_exclude, + 'banreason' => $ban_reason, + 'bangivereason' => $ban_give_reason, + ); + + /** + * Use this event to pass data from the ban form to the confirmation screen + * + * @event core.mcp_ban_confirm + * @var array hidden_fields Hidden fields that are passed through the confirm screen + * @since 3.1.0-RC5 + */ + $vars = array('hidden_fields'); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_confirm', compact($vars))); + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($hidden_fields)); + } + } + } + else if ($unbansubmit) + { + $ban = $request->variable('unban', array('')); + + if ($ban) + { + if (confirm_box(true)) + { + user_unban($mode, $ban); + + trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '

« ' . $user->lang['BACK_TO_PREV'] . ''); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'mode' => $mode, + 'unbansubmit' => true, + 'unban' => $ban))); + } + } + } + + // Ban length options + $ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['UNTIL'] . ' -> '); + + $ban_end_options = ''; + foreach ($ban_end_text as $length => $text) + { + $ban_end_options .= ''; + } + + // Define language vars + $this->page_title = $user->lang[strtoupper($mode) . '_BAN']; + + $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN']; + $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN']; + $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN']; + $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN']; + $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED']; + + switch ($mode) + { + case 'user': + $l_ban_cell = $user->lang['USERNAME']; + break; + + case 'ip': + $l_ban_cell = $user->lang['IP_HOSTNAME']; + break; + + case 'email': + $l_ban_cell = $user->lang['EMAIL_ADDRESS']; + break; + } + + acp_ban::display_ban_options($mode); + + $template->assign_vars(array( + 'L_TITLE' => $this->page_title, + 'L_EXPLAIN' => $l_ban_explain, + 'L_UNBAN_TITLE' => $l_unban_title, + 'L_UNBAN_EXPLAIN' => $l_unban_explain, + 'L_BAN_CELL' => $l_ban_cell, + 'L_BAN_EXCLUDE_EXPLAIN' => $l_ban_exclude_explain, + 'L_NO_BAN_CELL' => $l_no_ban_cell, + + 'S_USERNAME_BAN' => ($mode == 'user') ? true : false, + + 'U_ACTION' => $this->u_action, + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp_ban&field=ban'), + )); + + if ($mode === 'email' && !$auth->acl_get('a_user')) + { + return; + } + + // As a "service" we will check if any post id is specified and populate the username of the poster id if given + $post_id = $request->variable('p', 0); + $user_id = $request->variable('u', 0); + $pre_fill = false; + + if ($user_id && $user_id <> ANONYMOUS) + { + $sql = 'SELECT username, user_email, user_ip + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + switch ($mode) + { + case 'user': + $pre_fill = (string) $db->sql_fetchfield('username'); + break; + + case 'ip': + $pre_fill = (string) $db->sql_fetchfield('user_ip'); + break; + + case 'email': + $pre_fill = (string) $db->sql_fetchfield('user_email'); + break; + } + $db->sql_freeresult($result); + } + else if ($post_id) + { + $post_info = phpbb_get_post_data(array($post_id), 'm_ban'); + + if (count($post_info) && !empty($post_info[$post_id])) + { + switch ($mode) + { + case 'user': + $pre_fill = $post_info[$post_id]['username']; + break; + + case 'ip': + $pre_fill = $post_info[$post_id]['poster_ip']; + break; + + case 'email': + $pre_fill = $post_info[$post_id]['user_email']; + break; + } + + } + } + + if ($pre_fill) + { + // left for legacy template compatibility + $template->assign_var('USERNAMES', $pre_fill); + $template->assign_var('BAN_QUANTIFIER', $pre_fill); + } + } +} diff --git a/install/update/new/includes/mcp/mcp_logs.php b/install/update/new/includes/mcp/mcp_logs.php new file mode 100644 index 0000000..dc098fc --- /dev/null +++ b/install/update/new/includes/mcp/mcp_logs.php @@ -0,0 +1,230 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* mcp_logs +* Handling warning the users +*/ +class mcp_logs +{ + var $u_action; + var $p_master; + + function __construct($p_master) + { + $this->p_master = $p_master; + } + + function main($id, $mode) + { + global $auth, $db, $user, $template, $request; + global $config, $phpbb_container, $phpbb_log; + + $user->add_lang('acp/common'); + + $action = $request->variable('action', array('' => '')); + + if (is_array($action)) + { + $action = key($action); + } + else + { + $action = $request->variable('action', ''); + } + + // Set up general vars + $start = $request->variable('start', 0); + $deletemark = ($action == 'del_marked') ? true : false; + $deleteall = ($action == 'del_all') ? true : false; + $marked = $request->variable('mark', array(0)); + + // Sort keys + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); + + $this->tpl_name = 'mcp_logs'; + $this->page_title = 'MCP_LOGS'; + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_'))); + $forum_list[] = 0; + + $forum_id = $topic_id = 0; + + switch ($mode) + { + case 'front': + break; + + case 'forum_logs': + $forum_id = $request->variable('f', 0); + + if (!in_array($forum_id, $forum_list)) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } + + $forum_list = array($forum_id); + break; + + case 'topic_logs': + $topic_id = $request->variable('t', 0); + + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $forum_id = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + if (!in_array($forum_id, $forum_list)) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } + + $forum_list = array($forum_id); + break; + } + + // Delete entries if requested and able + if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) + { + if (confirm_box(true)) + { + if ($deletemark && count($marked)) + { + $conditions = array( + 'forum_id' => array('IN' => $forum_list), + 'log_id' => array('IN' => $marked), + ); + + $phpbb_log->delete('mod', $conditions); + } + else if ($deleteall) + { + $keywords = $request->variable('keywords', '', true); + + $conditions = array( + 'forum_id' => array('IN' => $forum_list), + 'keywords' => $keywords, + ); + + if ($sort_days) + { + $conditions['log_time'] = array('>=', time() - ($sort_days * 86400)); + } + + if ($mode == 'topic_logs') + { + $conditions['topic_id'] = $topic_id; + } + + $phpbb_log->delete('mod', $conditions); + } + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'f' => $forum_id, + 't' => $topic_id, + 'start' => $start, + 'delmarked' => $deletemark, + 'delall' => $deleteall, + 'mark' => $marked, + 'st' => $sort_days, + 'sk' => $sort_key, + 'sd' => $sort_dir, + 'i' => $id, + 'mode' => $mode, + 'action' => $request->variable('action', array('' => '')))) + ); + } + } + + // Sorting + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); + $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + // Define where and sort sql for use in displaying logs + $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; + $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + + $keywords = $request->variable('keywords', '', true); + $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; + + // Grab log data + $log_data = array(); + $log_count = 0; + $start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords); + + $base_url = $this->u_action . "&$u_sort_param$keywords_param"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'TOTAL' => $user->lang('TOTAL_LOGS', (int) $log_count), + + 'L_TITLE' => $user->lang['MCP_LOGS'], + + 'U_POST_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start", + 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_LOGS' => ($log_count > 0), + 'S_KEYWORDS' => $keywords, + ) + ); + + foreach ($log_data as $row) + { + $data = array(); + + $checks = array('viewpost', 'viewtopic', 'viewforum'); + foreach ($checks as $check) + { + if (isset($row[$check]) && $row[$check]) + { + $data[] = '' . $user->lang['LOGVIEW_' . strtoupper($check)] . ''; + } + } + + $template->assign_block_vars('log', array( + 'USERNAME' => $row['username_full'], + 'IP' => $row['ip'], + 'DATE' => $user->format_date($row['time']), + 'ACTION' => $row['action'], + 'DATA' => (count($data)) ? implode(' | ', $data) : '', + 'ID' => $row['id'], + ) + ); + } + } +} diff --git a/install/update/new/includes/mcp/mcp_main.php b/install/update/new/includes/mcp/mcp_main.php new file mode 100644 index 0000000..744eaeb --- /dev/null +++ b/install/update/new/includes/mcp/mcp_main.php @@ -0,0 +1,1717 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* mcp_main +* Handling mcp actions +*/ +class mcp_main +{ + var $p_master; + var $u_action; + + function __construct($p_master) + { + $this->p_master = $p_master; + } + + function main($id, $mode) + { + global $auth, $user, $action; + global $phpbb_root_path, $phpEx, $request; + global $phpbb_dispatcher; + + $quickmod = ($mode == 'quickmod') ? true : false; + + /** + * Event to perform additional actions before an MCP action is executed. + * + * @event core.mcp_main_before + * @var string action The action that is about to be performed + * @var string mode The mode in which the MCP is accessed, e.g. front, forum_view, topic_view, post_details, quickmod + * @var boolean quickmod Whether or not the action is performed via QuickMod + * @since 3.2.8-RC1 + */ + $vars = [ + 'action', + 'mode', + 'quickmod', + ]; + extract($phpbb_dispatcher->trigger_event('core.mcp_main_before', compact($vars))); + + switch ($action) + { + case 'lock': + case 'unlock': + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + lock_unlock($action, $topic_ids); + break; + + case 'lock_post': + case 'unlock_post': + + $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0)); + + if (!count($post_ids)) + { + trigger_error('NO_POST_SELECTED'); + } + + lock_unlock($action, $post_ids); + break; + + case 'make_announce': + case 'make_sticky': + case 'make_global': + case 'make_normal': + + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + change_topic_type($action, $topic_ids); + break; + + case 'move': + $user->add_lang('viewtopic'); + + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + mcp_move_topic($topic_ids); + break; + + case 'fork': + $user->add_lang('viewtopic'); + + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + mcp_fork_topic($topic_ids); + break; + + case 'delete_topic': + $user->add_lang('viewtopic'); + + // f parameter is not reliable for permission usage, however we just use it to decide + // which permission we will check later on. So if it is manipulated, we will still catch it later on. + $forum_id = $request->variable('f', 0); + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + $soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false; + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + mcp_delete_topic($topic_ids, $soft_delete, $request->variable('delete_reason', '', true)); + break; + + case 'delete_post': + $user->add_lang('posting'); + + // f parameter is not reliable for permission usage, however we just use it to decide + // which permission we will check later on. So if it is manipulated, we will still catch it later on. + $forum_id = $request->variable('f', 0); + $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0)); + $soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false; + + if (!count($post_ids)) + { + trigger_error('NO_POST_SELECTED'); + } + + mcp_delete_post($post_ids, $soft_delete, $request->variable('delete_reason', '', true)); + break; + + case 'restore_topic': + $user->add_lang('posting'); + + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + mcp_restore_topic($topic_ids); + break; + + default: + /** + * This event allows you to handle custom quickmod options + * + * @event core.modify_quickmod_actions + * @var string action Topic quick moderation action name + * @var bool quickmod Flag indicating whether MCP is in quick moderation mode + * @since 3.1.0-a4 + * @changed 3.1.0-RC4 Added variables: action, quickmod + */ + $vars = array('action', 'quickmod'); + extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars))); + break; + } + + switch ($mode) + { + case 'front': + if (!function_exists('mcp_front_view')) + { + include($phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx); + } + + $user->add_lang('acp/common'); + + mcp_front_view($id, $mode, $action); + + $this->tpl_name = 'mcp_front'; + $this->page_title = 'MCP_MAIN'; + break; + + case 'forum_view': + if (!function_exists('mcp_forum_view')) + { + include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx); + } + + $user->add_lang('viewforum'); + + $forum_id = $request->variable('f', 0); + + $forum_info = phpbb_get_forum_data($forum_id, 'm_', true); + + if (!count($forum_info)) + { + $this->main('main', 'front'); + return; + } + + $forum_info = $forum_info[$forum_id]; + + mcp_forum_view($id, $mode, $action, $forum_info); + + $this->tpl_name = 'mcp_forum'; + $this->page_title = 'MCP_MAIN_FORUM_VIEW'; + break; + + case 'topic_view': + if (!function_exists('mcp_topic_view')) + { + include($phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx); + } + + mcp_topic_view($id, $mode, $action); + + $this->tpl_name = 'mcp_topic'; + $this->page_title = 'MCP_MAIN_TOPIC_VIEW'; + break; + + case 'post_details': + if (!function_exists('mcp_post_details')) + { + include($phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx); + } + + mcp_post_details($id, $mode, $action); + + $this->tpl_name = ($action == 'whois') ? 'mcp_whois' : 'mcp_post'; + $this->page_title = 'MCP_MAIN_POST_DETAILS'; + break; + + default: + if ($quickmod) + { + switch ($action) + { + case 'lock': + case 'unlock': + case 'make_announce': + case 'make_sticky': + case 'make_global': + case 'make_normal': + case 'make_onindex': + case 'move': + case 'fork': + case 'delete_topic': + trigger_error('TOPIC_NOT_EXIST'); + break; + + case 'lock_post': + case 'unlock_post': + case 'delete_post': + trigger_error('POST_NOT_EXIST'); + break; + } + } + + trigger_error('NO_MODE', E_USER_ERROR); + break; + } + } +} + +/** +* Lock/Unlock Topic/Post +*/ +function lock_unlock($action, $ids) +{ + global $user, $db, $request, $phpbb_log, $phpbb_dispatcher; + + if ($action == 'lock' || $action == 'unlock') + { + $table = TOPICS_TABLE; + $sql_id = 'topic_id'; + $set_id = 'topic_status'; + $l_prefix = 'TOPIC'; + } + else + { + $table = POSTS_TABLE; + $sql_id = 'post_id'; + $set_id = 'post_edit_locked'; + $l_prefix = 'POST'; + } + + $orig_ids = $ids; + + if (!phpbb_check_ids($ids, $table, $sql_id, array('m_lock'))) + { + // Make sure that for f_user_lock only the lock action is triggered. + if ($action != 'lock') + { + return; + } + + $ids = $orig_ids; + + if (!phpbb_check_ids($ids, $table, $sql_id, array('f_user_lock'))) + { + return; + } + } + unset($orig_ids); + + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $redirect = reapply_sid($redirect); + + $s_hidden_fields = build_hidden_fields(array( + $sql_id . '_list' => $ids, + 'action' => $action, + 'redirect' => $redirect) + ); + + if (confirm_box(true)) + { + $sql = "UPDATE $table + SET $set_id = " . (($action == 'lock' || $action == 'lock_post') ? ITEM_LOCKED : ITEM_UNLOCKED) . ' + WHERE ' . $db->sql_in_set($sql_id, $ids); + $db->sql_query($sql); + + $data = ($action == 'lock' || $action == 'unlock') ? phpbb_get_topic_data($ids) : phpbb_get_post_data($ids); + + foreach ($data as $id => $row) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($action), false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => isset($row['post_id']) ? $row['post_id'] : 0, + $row['topic_title'] + )); + } + + /** + * Perform additional actions after locking/unlocking posts/topics + * + * @event core.mcp_lock_unlock_after + * @var string action Variable containing the action we perform on the posts/topics ('lock', 'unlock', 'lock_post' or 'unlock_post') + * @var array ids Array containing the post/topic IDs that have been locked/unlocked + * @var array data Array containing posts/topics data + * @since 3.1.7-RC1 + */ + $vars = array( + 'action', + 'ids', + 'data', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_lock_unlock_after', compact($vars))); + + $success_msg = $l_prefix . ((count($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; + + meta_refresh(2, $redirect); + $message = $user->lang[$success_msg]; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + } + trigger_error($message); + } + else + { + confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((count($ids) == 1) ? '' : 'S'), $s_hidden_fields); + } + + redirect($redirect); +} + +/** +* Change Topic Type +*/ +function change_topic_type($action, $topic_ids) +{ + global $user, $db, $request, $phpbb_log, $phpbb_dispatcher; + + switch ($action) + { + case 'make_announce': + $new_topic_type = POST_ANNOUNCE; + $check_acl = 'f_announce'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS'; + break; + + case 'make_global': + $new_topic_type = POST_GLOBAL; + $check_acl = 'f_announce_global'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS'; + break; + + case 'make_sticky': + $new_topic_type = POST_STICKY; + $check_acl = 'f_sticky'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES'; + break; + + default: + $new_topic_type = POST_NORMAL; + $check_acl = false; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS'; + break; + } + + $forum_id = phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', $check_acl, true); + + if ($forum_id === false) + { + return; + } + + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $redirect = reapply_sid($redirect); + + $s_hidden_fields = array( + 'topic_id_list' => $topic_ids, + 'f' => $forum_id, + 'action' => $action, + 'redirect' => $redirect, + ); + + if (confirm_box(true)) + { + + /** + * Perform additional actions before changing topic(s) type + * + * @event core.mcp_change_topic_type_before + * @var int new_topic_type The candidated topic type. + * @var int forum_id The forum ID for the topic ID(s). + * @var array topic_ids Array containing the topic ID(s) that will be changed + * @since 3.2.6-RC1 + */ + $vars = array( + 'new_topic_type', + 'forum_id', + 'topic_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_change_topic_type_before', compact($vars))); + + $db->sql_transaction('begin'); + + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_type = $new_topic_type + WHERE " . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + + if (($new_topic_type == POST_GLOBAL) && count($topic_ids)) + { + // Delete topic shadows for global announcements + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED'; + + if (count($topic_ids)) + { + $data = phpbb_get_topic_data($topic_ids); + + foreach ($data as $topic_id => $row) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_TYPE_CHANGED', false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $row['topic_title'] + )); + } + } + + /** + * Perform additional actions after changing topic types + * + * @event core.mcp_change_topic_type_after + * @var int new_topic_type The newly changed topic type. + * @var int forum_id The forum ID where the newly changed topic type belongs to. + * @var array topic_ids Array containing the topic IDs that have been changed + * @since 3.2.6-RC1 + */ + $vars = array( + 'new_topic_type', + 'forum_id', + 'topic_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_change_topic_type_after', compact($vars))); + + meta_refresh(2, $redirect); + $message = $user->lang[$success_msg]; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + } + trigger_error($message); + } + else + { + confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields)); + } + + redirect($redirect); +} + +/** +* Move Topic +*/ +function mcp_move_topic($topic_ids) +{ + global $auth, $user, $db, $template, $phpbb_log, $request, $phpbb_dispatcher; + global $phpEx, $phpbb_root_path; + + // Here we limit the operation to one forum only + $forum_id = phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_move'), true); + + if ($forum_id === false) + { + return; + } + + $to_forum_id = $request->variable('to_forum_id', 0); + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $additional_msg = $success_msg = ''; + + $s_hidden_fields = build_hidden_fields(array( + 'topic_id_list' => $topic_ids, + 'f' => $forum_id, + 'action' => 'move', + 'redirect' => $redirect) + ); + + if ($to_forum_id) + { + $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post'); + + if (!count($forum_data)) + { + $additional_msg = $user->lang['FORUM_NOT_EXIST']; + } + else + { + $forum_data = $forum_data[$to_forum_id]; + + if ($forum_data['forum_type'] != FORUM_POST) + { + $additional_msg = $user->lang['FORUM_NOT_POSTABLE']; + } + else if (!$auth->acl_get('f_post', $to_forum_id) || (!$auth->acl_get('m_approve', $to_forum_id) && !$auth->acl_get('f_noapprove', $to_forum_id))) + { + $additional_msg = $user->lang['USER_CANNOT_POST']; + } + else if ($forum_id == $to_forum_id) + { + $additional_msg = $user->lang['CANNOT_MOVE_SAME_FORUM']; + } + } + } + else if (isset($_POST['confirm'])) + { + $additional_msg = $user->lang['FORUM_NOT_EXIST']; + } + + if (!$to_forum_id || $additional_msg) + { + $request->overwrite('confirm', null, \phpbb\request\request_interface::POST); + $request->overwrite('confirm_key', null); + } + + if (confirm_box(true)) + { + $topic_data = phpbb_get_topic_data($topic_ids); + $leave_shadow = (isset($_POST['move_leave_shadow'])) ? true : false; + + $forum_sync_data = array(); + + $forum_sync_data[$forum_id] = current($topic_data); + $forum_sync_data[$to_forum_id] = $forum_data; + + $topics_moved = $topics_moved_unapproved = $topics_moved_softdeleted = 0; + $posts_moved = $posts_moved_unapproved = $posts_moved_softdeleted = 0; + + foreach ($topic_data as $topic_id => $topic_info) + { + if ($topic_info['topic_visibility'] == ITEM_APPROVED) + { + $topics_moved++; + } + else if ($topic_info['topic_visibility'] == ITEM_UNAPPROVED || $topic_info['topic_visibility'] == ITEM_REAPPROVE) + { + $topics_moved_unapproved++; + } + else if ($topic_info['topic_visibility'] == ITEM_DELETED) + { + $topics_moved_softdeleted++; + } + + $posts_moved += $topic_info['topic_posts_approved']; + $posts_moved_unapproved += $topic_info['topic_posts_unapproved']; + $posts_moved_softdeleted += $topic_info['topic_posts_softdeleted']; + } + + $db->sql_transaction('begin'); + + // Move topics, but do not resync yet + move_topics($topic_ids, $to_forum_id, false); + + if ($request->is_set_post('move_lock_topics') && $auth->acl_get('m_lock', $to_forum_id)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_status = ' . ITEM_LOCKED . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + + $shadow_topics = 0; + $forum_ids = array($to_forum_id); + foreach ($topic_data as $topic_id => $row) + { + // Get the list of forums to resync + $forum_ids[] = $row['forum_id']; + + // We add the $to_forum_id twice, because 'forum_id' is updated + // when the topic is moved again later. + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MOVE', false, array( + 'forum_id' => (int) $to_forum_id, + 'topic_id' => (int) $topic_id, + $row['forum_name'], + $forum_data['forum_name'], + (int) $row['forum_id'], + (int) $forum_data['forum_id'], + )); + + // Leave a redirection if required and only if the topic is visible to users + if ($leave_shadow && $row['topic_visibility'] == ITEM_APPROVED && $row['topic_type'] != POST_GLOBAL) + { + $shadow = array( + 'forum_id' => (int) $row['forum_id'], + 'icon_id' => (int) $row['icon_id'], + 'topic_attachment' => (int) $row['topic_attachment'], + 'topic_visibility' => ITEM_APPROVED, // a shadow topic is always approved + 'topic_reported' => 0, // a shadow topic is never reported + 'topic_title' => (string) $row['topic_title'], + 'topic_poster' => (int) $row['topic_poster'], + 'topic_time' => (int) $row['topic_time'], + 'topic_time_limit' => (int) $row['topic_time_limit'], + 'topic_views' => (int) $row['topic_views'], + 'topic_posts_approved' => (int) $row['topic_posts_approved'], + 'topic_posts_unapproved'=> (int) $row['topic_posts_unapproved'], + 'topic_posts_softdeleted'=> (int) $row['topic_posts_softdeleted'], + 'topic_status' => ITEM_MOVED, + 'topic_type' => POST_NORMAL, + 'topic_first_post_id' => (int) $row['topic_first_post_id'], + 'topic_first_poster_colour'=>(string) $row['topic_first_poster_colour'], + 'topic_first_poster_name'=> (string) $row['topic_first_poster_name'], + 'topic_last_post_id' => (int) $row['topic_last_post_id'], + 'topic_last_poster_id' => (int) $row['topic_last_poster_id'], + 'topic_last_poster_colour'=>(string) $row['topic_last_poster_colour'], + 'topic_last_poster_name'=> (string) $row['topic_last_poster_name'], + 'topic_last_post_subject'=> (string) $row['topic_last_post_subject'], + 'topic_last_post_time' => (int) $row['topic_last_post_time'], + 'topic_last_view_time' => (int) $row['topic_last_view_time'], + 'topic_moved_id' => (int) $row['topic_id'], + 'topic_bumped' => (int) $row['topic_bumped'], + 'topic_bumper' => (int) $row['topic_bumper'], + 'poll_title' => (string) $row['poll_title'], + 'poll_start' => (int) $row['poll_start'], + 'poll_length' => (int) $row['poll_length'], + 'poll_max_options' => (int) $row['poll_max_options'], + 'poll_last_vote' => (int) $row['poll_last_vote'] + ); + + /** + * Perform actions before shadow topic is created. + * + * @event core.mcp_main_modify_shadow_sql + * @var array shadow SQL array to be used by $db->sql_build_array + * @var array row Topic data + * @since 3.1.11-RC1 + * @changed 3.1.11-RC1 Added variable: row + */ + $vars = array( + 'shadow', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_shadow_sql', compact($vars))); + + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow)); + + // Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts + $shadow_topics++; + } + } + unset($topic_data); + + $sync_sql = array(); + if ($posts_moved) + { + $sync_sql[$to_forum_id][] = 'forum_posts_approved = forum_posts_approved + ' . (int) $posts_moved; + $sync_sql[$forum_id][] = 'forum_posts_approved = forum_posts_approved - ' . (int) $posts_moved; + } + if ($posts_moved_unapproved) + { + $sync_sql[$to_forum_id][] = 'forum_posts_unapproved = forum_posts_unapproved + ' . (int) $posts_moved_unapproved; + $sync_sql[$forum_id][] = 'forum_posts_unapproved = forum_posts_unapproved - ' . (int) $posts_moved_unapproved; + } + if ($posts_moved_softdeleted) + { + $sync_sql[$to_forum_id][] = 'forum_posts_softdeleted = forum_posts_softdeleted + ' . (int) $posts_moved_softdeleted; + $sync_sql[$forum_id][] = 'forum_posts_softdeleted = forum_posts_softdeleted - ' . (int) $posts_moved_softdeleted; + } + + if ($topics_moved) + { + $sync_sql[$to_forum_id][] = 'forum_topics_approved = forum_topics_approved + ' . (int) $topics_moved; + if ($topics_moved - $shadow_topics > 0) + { + $sync_sql[$forum_id][] = 'forum_topics_approved = forum_topics_approved - ' . (int) ($topics_moved - $shadow_topics); + } + } + if ($topics_moved_unapproved) + { + $sync_sql[$to_forum_id][] = 'forum_topics_unapproved = forum_topics_unapproved + ' . (int) $topics_moved_unapproved; + $sync_sql[$forum_id][] = 'forum_topics_unapproved = forum_topics_unapproved - ' . (int) $topics_moved_unapproved; + } + if ($topics_moved_softdeleted) + { + $sync_sql[$to_forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted + ' . (int) $topics_moved_softdeleted; + $sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted; + } + + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS'; + + foreach ($sync_sql as $forum_id_key => $array) + { + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET ' . implode(', ', $array) . ' + WHERE forum_id = ' . $forum_id_key; + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + sync('forum', 'forum_id', array($forum_id, $to_forum_id)); + } + else + { + $template->assign_vars(array( + 'S_FORUM_SELECT' => make_forum_select($to_forum_id, $forum_id, false, true, true, true), + 'S_CAN_LEAVE_SHADOW' => true, + 'S_CAN_LOCK_TOPIC' => ($auth->acl_get('m_lock', $to_forum_id)) ? true : false, + 'ADDITIONAL_MSG' => $additional_msg) + ); + + confirm_box(false, 'MOVE_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); + } + + $redirect = $request->variable('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + + if (!$success_msg) + { + redirect($redirect); + } + else + { + meta_refresh(3, $redirect); + + $message = $user->lang[$success_msg]; + $message .= '

' . sprintf($user->lang['RETURN_PAGE'], '', ''); + $message .= '

' . sprintf($user->lang['RETURN_FORUM'], '', ''); + $message .= '

' . sprintf($user->lang['RETURN_NEW_FORUM'], '', ''); + + trigger_error($message); + } +} + +/** +* Restore Topics +*/ +function mcp_restore_topic($topic_ids) +{ + global $user, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log; + + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve'))) + { + return; + } + + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $forum_id = $request->variable('f', 0); + + $s_hidden_fields = build_hidden_fields(array( + 'topic_id_list' => $topic_ids, + 'f' => $forum_id, + 'action' => 'restore_topic', + 'redirect' => $redirect, + )); + $success_msg = ''; + + if (confirm_box(true)) + { + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS'; + + $data = phpbb_get_topic_data($topic_ids); + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + foreach ($data as $topic_id => $row) + { + $return = $phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), ''); + if (!empty($return)) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_RESTORE_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'], + $row['topic_first_poster_name'] + )); + } + } + } + else + { + confirm_box(false, (count($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields); + } + + $topic_id = $request->variable('t', 0); + if (!$request->is_set('quickmod', \phpbb\request\request_interface::REQUEST)) + { + $redirect = $request->variable('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + $redirect_message = 'PAGE'; + } + else if ($topic_id) + { + $redirect = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id); + $redirect_message = 'TOPIC'; + } + else + { + $redirect = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + $redirect_message = 'FORUM'; + } + + if (!$success_msg) + { + redirect($redirect); + } + else + { + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_' . $redirect_message], '', '')); + } +} + +/** +* Delete Topics +*/ +function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_topic') +{ + global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log; + + $check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete'; + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array($check_permission))) + { + return; + } + + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $forum_id = $request->variable('f', 0); + + $s_hidden_fields = array( + 'topic_id_list' => $topic_ids, + 'f' => $forum_id, + 'action' => $action, + 'redirect' => $redirect, + ); + $success_msg = ''; + + if (confirm_box(true)) + { + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS'; + + $data = phpbb_get_topic_data($topic_ids); + + foreach ($data as $topic_id => $row) + { + if ($row['topic_moved_id']) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_SHADOW_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'] + )); + } + else + { + // Only soft delete non-shadow topics + if ($is_soft) + { + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + $return = $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason); + if (!empty($return)) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SOFTDELETE_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'], + $row['topic_first_poster_name'], + $soft_delete_reason + )); + } + } + else + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'], + $row['topic_first_poster_name'], + $soft_delete_reason + )); + } + } + } + + if (!$is_soft) + { + delete_topics('topic_id', $topic_ids); + } + } + else + { + global $template; + + $user->add_lang('posting'); + + // If there are only shadow topics, we neither need a reason nor softdelete + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + AND topic_moved_id = 0'; + $result = $db->sql_query_limit($sql, 1); + $only_shadow = !$db->sql_fetchfield('topic_id'); + $db->sql_freeresult($result); + + $only_softdeleted = false; + if (!$only_shadow && $auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id)) + { + // If there are only soft deleted topics, we display a message why the option is not available + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + AND topic_visibility <> ' . ITEM_DELETED; + $result = $db->sql_query_limit($sql, 1); + $only_softdeleted = !$db->sql_fetchfield('topic_id'); + $db->sql_freeresult($result); + } + + $template->assign_vars(array( + 'S_SHADOW_TOPICS' => $only_shadow, + 'S_SOFTDELETED' => $only_softdeleted, + 'S_TOPIC_MODE' => true, + 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), + 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), + 'DELETE_TOPIC_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_TOPIC_PERMANENTLY', count($topic_ids)), + )); + + $count = count($topic_ids); + $l_confirm = $count === 1 ? 'DELETE_TOPIC' : 'DELETE_TOPICS'; + if ($only_softdeleted) + { + $l_confirm = array($l_confirm . '_PERMANENTLY', $count); + $s_hidden_fields['delete_permanent'] = '1'; + } + else if ($only_shadow || !$auth->acl_get('m_softdelete', $forum_id)) + { + $s_hidden_fields['delete_permanent'] = '1'; + } + + confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html'); + } + + $topic_id = $request->variable('t', 0); + if (!$request->is_set('quickmod', \phpbb\request\request_interface::REQUEST)) + { + $redirect = $request->variable('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + $redirect_message = 'PAGE'; + } + else if ($is_soft && $topic_id) + { + $redirect = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id); + $redirect_message = 'TOPIC'; + } + else + { + $redirect = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + $redirect_message = 'FORUM'; + } + + if (!$success_msg) + { + redirect($redirect); + } + else + { + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_' . $redirect_message], '', '')); + } +} + +/** +* Delete Posts +*/ +function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_post') +{ + global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log; + + $check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete'; + if (!phpbb_check_ids($post_ids, POSTS_TABLE, 'post_id', array($check_permission))) + { + return; + } + + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $forum_id = $request->variable('f', 0); + + $s_hidden_fields = array( + 'post_id_list' => $post_ids, + 'f' => $forum_id, + 'action' => $action, + 'redirect' => $redirect, + ); + $success_msg = ''; + + if (confirm_box(true) && $is_soft) + { + $post_info = phpbb_get_post_data($post_ids); + + $topic_info = $approve_log = array(); + + // Group the posts by topic_id + foreach ($post_info as $post_id => $post_data) + { + if ($post_data['post_visibility'] != ITEM_APPROVED) + { + continue; + } + $topic_id = (int) $post_data['topic_id']; + + $topic_info[$topic_id]['posts'][] = (int) $post_id; + $topic_info[$topic_id]['forum_id'] = (int) $post_data['forum_id']; + + if ($post_id == $post_data['topic_first_post_id']) + { + $topic_info[$topic_id]['first_post'] = true; + } + + if ($post_id == $post_data['topic_last_post_id']) + { + $topic_info[$topic_id]['last_post'] = true; + } + + $approve_log[] = array( + 'forum_id' => $post_data['forum_id'], + 'topic_id' => $post_data['topic_id'], + 'post_id' => $post_id, + 'post_subject' => $post_data['post_subject'], + 'poster_id' => $post_data['poster_id'], + 'post_username' => $post_data['post_username'], + 'username' => $post_data['username'], + ); + } + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + foreach ($topic_info as $topic_id => $topic_data) + { + $phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post'])); + } + $affected_topics = count($topic_info); + // None of the topics is really deleted, so a redirect won't hurt much. + $deleted_topics = 0; + + $success_msg = (count($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS']; + + foreach ($approve_log as $row) + { + $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SOFTDELETE_POST', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => $row['post_id'], + $row['post_subject'], + $post_username, + $soft_delete_reason + )); + } + + $topic_id = $request->variable('t', 0); + + // Return links + $return_link = array(); + if ($affected_topics == 1 && $topic_id) + { + $return_link[] = sprintf($user->lang['RETURN_TOPIC'], '', ''); + } + $return_link[] = sprintf($user->lang['RETURN_FORUM'], '', ''); + + } + else if (confirm_box(true)) + { + if (!function_exists('delete_posts')) + { + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + + // Count the number of topics that are affected + // I did not use COUNT(DISTINCT ...) because I remember having problems + // with it on older versions of MySQL -- Ashe + + $sql = 'SELECT DISTINCT topic_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_id', $post_ids); + $result = $db->sql_query($sql); + + $topic_id_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_id_list[] = $row['topic_id']; + } + $affected_topics = count($topic_id_list); + $db->sql_freeresult($result); + + $post_data = phpbb_get_post_data($post_ids); + + foreach ($post_data as $id => $row) + { + $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_POST', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => $row['post_id'], + $row['post_subject'], + $post_username, + $soft_delete_reason + )); + } + + // Now delete the posts, topics and forums are automatically resync'ed + delete_posts('post_id', $post_ids); + + $sql = 'SELECT COUNT(topic_id) AS topics_left + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_id_list); + $result = $db->sql_query_limit($sql, 1); + + $deleted_topics = ($row = $db->sql_fetchrow($result)) ? ($affected_topics - $row['topics_left']) : $affected_topics; + $db->sql_freeresult($result); + + $topic_id = $request->variable('t', 0); + + // Return links + $return_link = array(); + if ($affected_topics == 1 && !$deleted_topics && $topic_id) + { + $return_link[] = sprintf($user->lang['RETURN_TOPIC'], '', ''); + } + $return_link[] = sprintf($user->lang['RETURN_FORUM'], '', ''); + + if (count($post_ids) == 1) + { + if ($deleted_topics) + { + // We deleted the only post of a topic, which in turn has + // been removed from the database + $success_msg = $user->lang['TOPIC_DELETED_SUCCESS']; + } + else + { + $success_msg = $user->lang['POST_DELETED_SUCCESS']; + } + } + else + { + if ($deleted_topics) + { + // Some of topics disappeared + $success_msg = $user->lang['POSTS_DELETED_SUCCESS'] . '

' . $user->lang['EMPTY_TOPICS_REMOVED_WARNING']; + } + else + { + $success_msg = $user->lang['POSTS_DELETED_SUCCESS']; + } + } + } + else + { + global $template; + + $user->add_lang('posting'); + + $only_softdeleted = false; + if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id)) + { + // If there are only soft deleted posts, we display a message why the option is not available + $sql = 'SELECT post_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_id', $post_ids) . ' + AND post_visibility <> ' . ITEM_DELETED; + $result = $db->sql_query_limit($sql, 1); + $only_softdeleted = !$db->sql_fetchfield('post_id'); + $db->sql_freeresult($result); + } + + $template->assign_vars(array( + 'S_SOFTDELETED' => $only_softdeleted, + 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), + 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), + 'DELETE_POST_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_POST_PERMANENTLY', count($post_ids)), + )); + + $count = count($post_ids); + $l_confirm = $count === 1 ? 'DELETE_POST' : 'DELETE_POSTS'; + if ($only_softdeleted) + { + $l_confirm = array($l_confirm . '_PERMANENTLY', $count); + $s_hidden_fields['delete_permanent'] = '1'; + } + else if (!$auth->acl_get('m_softdelete', $forum_id)) + { + $s_hidden_fields['delete_permanent'] = '1'; + } + + confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html'); + } + + $redirect = $request->variable('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + + if (!$success_msg) + { + redirect($redirect); + } + else + { + if ($affected_topics != 1 || $deleted_topics || !$topic_id) + { + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", false); + } + + meta_refresh(3, $redirect); + trigger_error($success_msg . '

' . sprintf($user->lang['RETURN_PAGE'], '', '') . '

' . implode('

', $return_link)); + } +} + +/** +* Fork Topic +*/ +function mcp_fork_topic($topic_ids) +{ + global $auth, $user, $db, $template, $config; + global $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher; + + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) + { + return; + } + + $to_forum_id = $request->variable('to_forum_id', 0); + $forum_id = $request->variable('f', 0); + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $additional_msg = $success_msg = ''; + $counter = array(); + + $s_hidden_fields = build_hidden_fields(array( + 'topic_id_list' => $topic_ids, + 'f' => $forum_id, + 'action' => 'fork', + 'redirect' => $redirect) + ); + + if ($to_forum_id) + { + $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post'); + + if (!count($topic_ids)) + { + $additional_msg = $user->lang['NO_TOPIC_SELECTED']; + } + else if (!count($forum_data)) + { + $additional_msg = $user->lang['FORUM_NOT_EXIST']; + } + else + { + $forum_data = $forum_data[$to_forum_id]; + + if ($forum_data['forum_type'] != FORUM_POST) + { + $additional_msg = $user->lang['FORUM_NOT_POSTABLE']; + } + else if (!$auth->acl_get('f_post', $to_forum_id)) + { + $additional_msg = $user->lang['USER_CANNOT_POST']; + } + } + } + else if (isset($_POST['confirm'])) + { + $additional_msg = $user->lang['FORUM_NOT_EXIST']; + } + + if ($additional_msg) + { + $request->overwrite('confirm', null, \phpbb\request\request_interface::POST); + $request->overwrite('confirm_key', null); + } + + if (confirm_box(true)) + { + $topic_data = phpbb_get_topic_data($topic_ids, 'f_post'); + + $total_topics = $total_topics_unapproved = $total_topics_softdeleted = 0; + $total_posts = $total_posts_unapproved = $total_posts_softdeleted = 0; + $new_topic_id_list = array(); + + foreach ($topic_data as $topic_id => $topic_row) + { + if (!isset($search_type) && $topic_row['enable_indexing']) + { + // Select the search method and do some additional checks to ensure it can actually be utilised + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + $search_mode = 'post'; + + if ($error) + { + trigger_error($error); + } + } + else if (!isset($search_type) && !$topic_row['enable_indexing']) + { + $search_type = false; + } + + $sql_ary = array( + 'forum_id' => (int) $to_forum_id, + 'icon_id' => (int) $topic_row['icon_id'], + 'topic_attachment' => (int) $topic_row['topic_attachment'], + 'topic_visibility' => (int) $topic_row['topic_visibility'], + 'topic_reported' => 0, + 'topic_title' => (string) $topic_row['topic_title'], + 'topic_poster' => (int) $topic_row['topic_poster'], + 'topic_time' => (int) $topic_row['topic_time'], + 'topic_posts_approved' => (int) $topic_row['topic_posts_approved'], + 'topic_posts_unapproved' => (int) $topic_row['topic_posts_unapproved'], + 'topic_posts_softdeleted' => (int) $topic_row['topic_posts_softdeleted'], + 'topic_status' => (int) $topic_row['topic_status'], + 'topic_type' => (int) $topic_row['topic_type'], + 'topic_first_poster_name' => (string) $topic_row['topic_first_poster_name'], + 'topic_last_poster_id' => (int) $topic_row['topic_last_poster_id'], + 'topic_last_poster_name' => (string) $topic_row['topic_last_poster_name'], + 'topic_last_post_time' => (int) $topic_row['topic_last_post_time'], + 'topic_last_view_time' => (int) $topic_row['topic_last_view_time'], + 'topic_bumped' => (int) $topic_row['topic_bumped'], + 'topic_bumper' => (int) $topic_row['topic_bumper'], + 'poll_title' => (string) $topic_row['poll_title'], + 'poll_start' => (int) $topic_row['poll_start'], + 'poll_length' => (int) $topic_row['poll_length'], + 'poll_max_options' => (int) $topic_row['poll_max_options'], + 'poll_vote_change' => (int) $topic_row['poll_vote_change'], + ); + + /** + * Perform actions before forked topic is created. + * + * @event core.mcp_main_modify_fork_sql + * @var array sql_ary SQL array to be used by $db->sql_build_array + * @var array topic_row Topic data + * @since 3.1.11-RC1 + * @changed 3.1.11-RC1 Added variable: topic_row + */ + $vars = array( + 'sql_ary', + 'topic_row', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_fork_sql', compact($vars))); + + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + $new_topic_id = $db->sql_nextid(); + $new_topic_id_list[$topic_id] = $new_topic_id; + + switch ($topic_row['topic_visibility']) + { + case ITEM_APPROVED: + $total_topics++; + break; + case ITEM_UNAPPROVED: + case ITEM_REAPPROVE: + $total_topics_unapproved++; + break; + case ITEM_DELETED: + $total_topics_softdeleted++; + break; + } + + if ($topic_row['poll_start']) + { + $sql = 'SELECT * + FROM ' . POLL_OPTIONS_TABLE . " + WHERE topic_id = $topic_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary = array( + 'poll_option_id' => (int) $row['poll_option_id'], + 'topic_id' => (int) $new_topic_id, + 'poll_option_text' => (string) $row['poll_option_text'], + 'poll_option_total' => 0 + ); + + $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + } + $db->sql_freeresult($result); + } + + $sql = 'SELECT * + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + ORDER BY post_time ASC, post_id ASC"; + $result = $db->sql_query($sql); + + $post_rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $post_rows[] = $row; + } + $db->sql_freeresult($result); + + if (!count($post_rows)) + { + continue; + } + + foreach ($post_rows as $row) + { + $sql_ary = array( + 'topic_id' => (int) $new_topic_id, + 'forum_id' => (int) $to_forum_id, + 'poster_id' => (int) $row['poster_id'], + 'icon_id' => (int) $row['icon_id'], + 'poster_ip' => (string) $row['poster_ip'], + 'post_time' => (int) $row['post_time'], + 'post_visibility' => (int) $row['post_visibility'], + 'post_reported' => 0, + 'enable_bbcode' => (int) $row['enable_bbcode'], + 'enable_smilies' => (int) $row['enable_smilies'], + 'enable_magic_url' => (int) $row['enable_magic_url'], + 'enable_sig' => (int) $row['enable_sig'], + 'post_username' => (string) $row['post_username'], + 'post_subject' => (string) $row['post_subject'], + 'post_text' => (string) $row['post_text'], + 'post_edit_reason' => (string) $row['post_edit_reason'], + 'post_edit_user' => (int) $row['post_edit_user'], + 'post_checksum' => (string) $row['post_checksum'], + 'post_attachment' => (int) $row['post_attachment'], + 'bbcode_bitfield' => $row['bbcode_bitfield'], + 'bbcode_uid' => (string) $row['bbcode_uid'], + 'post_edit_time' => (int) $row['post_edit_time'], + 'post_edit_count' => (int) $row['post_edit_count'], + 'post_edit_locked' => (int) $row['post_edit_locked'], + 'post_postcount' => $row['post_postcount'], + ); + // Adjust post count only if the post can be incremented to the user counter + if ($row['post_postcount']) + { + if (isset($counter[$row['poster_id']])) + { + ++$counter[$row['poster_id']]; + } + else + { + $counter[$row['poster_id']] = 1; + } + } + $db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + $new_post_id = $db->sql_nextid(); + + /** + * Perform actions after forked topic is created. + * + * @event core.mcp_main_fork_sql_after + * @var int new_topic_id The newly created topic ID + * @var int to_forum_id The forum ID where the forked topic has been moved to + * @var int new_post_id The newly created post ID + * @var array row Post data + * @since 3.2.4-RC1 + */ + $vars = array( + 'new_topic_id', + 'to_forum_id', + 'new_post_id', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_fork_sql_after', compact($vars))); + + switch ($row['post_visibility']) + { + case ITEM_APPROVED: + $total_posts++; + break; + case ITEM_UNAPPROVED: + case ITEM_REAPPROVE: + $total_posts_unapproved++; + break; + case ITEM_DELETED: + $total_posts_softdeleted++; + break; + } + + // Copy whether the topic is dotted + markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']); + + if (!empty($search_type)) + { + $search->index($search_mode, $new_post_id, $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], ($topic_row['topic_type'] == POST_GLOBAL) ? 0 : $to_forum_id); + $search_mode = 'reply'; // After one we index replies + } + + // Copy Attachments + if ($row['post_attachment']) + { + $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . " + WHERE post_msg_id = {$row['post_id']} + AND topic_id = $topic_id + AND in_message = 0"; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($attach_row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'post_msg_id' => (int) $new_post_id, + 'topic_id' => (int) $new_topic_id, + 'in_message' => 0, + 'is_orphan' => (int) $attach_row['is_orphan'], + 'poster_id' => (int) $attach_row['poster_id'], + 'physical_filename' => (string) utf8_basename($attach_row['physical_filename']), + 'real_filename' => (string) utf8_basename($attach_row['real_filename']), + 'download_count' => (int) $attach_row['download_count'], + 'attach_comment' => (string) $attach_row['attach_comment'], + 'extension' => (string) $attach_row['extension'], + 'mimetype' => (string) $attach_row['mimetype'], + 'filesize' => (int) $attach_row['filesize'], + 'filetime' => (int) $attach_row['filetime'], + 'thumbnail' => (int) $attach_row['thumbnail'] + ); + } + $db->sql_freeresult($result); + + if (count($sql_ary)) + { + $db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary); + } + } + } + + // Copy topic subscriptions to new topic + $sql = 'SELECT user_id, notify_status + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $new_topic_id, + 'user_id' => (int) $row['user_id'], + 'notify_status' => (int) $row['notify_status'], + ); + } + $db->sql_freeresult($result); + + if (count($sql_ary)) + { + $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); + } + + // Copy bookmarks to new topic + $sql = 'SELECT user_id + FROM ' . BOOKMARKS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $new_topic_id, + 'user_id' => (int) $row['user_id'], + ); + } + $db->sql_freeresult($result); + + if (count($sql_ary)) + { + $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary); + } + } + + // Sync new topics, parent forums and board stats + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_posts_approved = forum_posts_approved + ' . $total_posts . ', + forum_posts_unapproved = forum_posts_unapproved + ' . $total_posts_unapproved . ', + forum_posts_softdeleted = forum_posts_softdeleted + ' . $total_posts_softdeleted . ', + forum_topics_approved = forum_topics_approved + ' . $total_topics . ', + forum_topics_unapproved = forum_topics_unapproved + ' . $total_topics_unapproved . ', + forum_topics_softdeleted = forum_topics_softdeleted + ' . $total_topics_softdeleted . ' + WHERE forum_id = ' . $to_forum_id; + $db->sql_query($sql); + + if (!empty($counter)) + { + // Do only one query per user and not a query per post. + foreach ($counter as $user_id => $count) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts + ' . (int) $count . ' + WHERE user_id = ' . (int) $user_id; + $db->sql_query($sql); + } + } + + sync('topic', 'topic_id', $new_topic_id_list); + sync('forum', 'forum_id', $to_forum_id); + + $config->increment('num_topics', count($new_topic_id_list), false); + $config->increment('num_posts', $total_posts, false); + + foreach ($new_topic_id_list as $topic_id => $new_topic_id) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_FORK', false, array( + 'forum_id' => $to_forum_id, + 'topic_id' => $new_topic_id, + $topic_row['forum_name'] + )); + } + + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS'; + } + else + { + $template->assign_vars(array( + 'S_FORUM_SELECT' => make_forum_select($to_forum_id, false, false, true, true, true), + 'S_CAN_LEAVE_SHADOW' => false, + 'ADDITIONAL_MSG' => $additional_msg) + ); + + confirm_box(false, 'FORK_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); + } + + $redirect = $request->variable('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + + if (!$success_msg) + { + redirect($redirect); + } + else + { + $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + meta_refresh(3, $redirect_url); + $return_link = sprintf($user->lang['RETURN_FORUM'], '', ''); + + if ($forum_id != $to_forum_id) + { + $return_link .= '

' . sprintf($user->lang['RETURN_NEW_FORUM'], '', ''); + } + + trigger_error($user->lang[$success_msg] . '

' . $return_link); + } +} diff --git a/install/update/new/includes/mcp/mcp_notes.php b/install/update/new/includes/mcp/mcp_notes.php new file mode 100644 index 0000000..74bd1f1 --- /dev/null +++ b/install/update/new/includes/mcp/mcp_notes.php @@ -0,0 +1,258 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* mcp_notes +* Displays notes about a user +*/ +class mcp_notes +{ + var $p_master; + var $u_action; + + function __construct($p_master) + { + $this->p_master = $p_master; + } + + function main($id, $mode) + { + global $user, $template, $request; + global $phpbb_root_path, $phpEx; + + $action = $request->variable('action', array('' => '')); + + if (is_array($action)) + { + $action = key($action); + } + + $this->page_title = 'MCP_NOTES'; + + switch ($mode) + { + case 'front': + $template->assign_vars(array( + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'), + 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes'), + + 'L_TITLE' => $user->lang['MCP_NOTES'], + )); + + $this->tpl_name = 'mcp_notes_front'; + break; + + case 'user_notes': + $user->add_lang('acp/common'); + + $this->mcp_notes_user_view($action); + $this->tpl_name = 'mcp_notes_user'; + break; + } + } + + /** + * Display user notes + */ + function mcp_notes_user_view($action) + { + global $config, $phpbb_log, $request; + global $template, $db, $user, $auth, $phpbb_container; + + $user_id = $request->variable('u', 0); + $username = $request->variable('username', '', true); + $start = $request->variable('start', 0); + $st = $request->variable('st', 0); + $sk = $request->variable('sk', 'b'); + $sd = $request->variable('sd', 'd'); + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + add_form_key('mcp_notes'); + + $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE $sql_where"; + $result = $db->sql_query($sql); + $userrow = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$userrow) + { + trigger_error('NO_USER'); + } + + $user_id = $userrow['user_id']; + + // Populate user id to the currently active module (this module) + // The following method is another way of adjusting module urls. It is the easy variant if we want + // to directly adjust the current module url based on data retrieved within the same module. + if (strpos($this->u_action, "&u=$user_id") === false) + { + $this->p_master->adjust_url('&u=' . $user_id); + $this->u_action .= "&u=$user_id"; + } + + $deletemark = ($action == 'del_marked') ? true : false; + $deleteall = ($action == 'del_all') ? true : false; + $marked = $request->variable('marknote', array(0)); + $usernote = $request->variable('usernote', '', true); + + // Handle any actions + if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) + { + $where_sql = ''; + if ($deletemark && $marked) + { + $sql_in = array(); + foreach ($marked as $mark) + { + $sql_in[] = $mark; + } + $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); + unset($sql_in); + } + + if ($where_sql || $deleteall) + { + if (check_form_key('mcp_notes')) + { + $sql = 'DELETE FROM ' . LOG_TABLE . ' + WHERE log_type = ' . LOG_USERS . " + AND reportee_id = $user_id + $where_sql"; + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CLEAR_USER', false, array($userrow['username'])); + + $msg = ($deletemark) ? 'MARKED_NOTES_DELETED' : 'ALL_NOTES_DELETED'; + } + else + { + $msg = 'FORM_INVALID'; + } + $redirect = $this->u_action . '&u=' . $user_id; + meta_refresh(3, $redirect); + trigger_error($user->lang[$msg] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + } + + if ($usernote && $action == 'add_feedback') + { + if (check_form_key('mcp_notes')) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array($userrow['username'])); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $userrow['username'] + )); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GENERAL', false, array( + 'reportee_id' => $user_id, + $usernote + )); + + $msg = $user->lang['USER_FEEDBACK_ADDED']; + } + else + { + $msg = $user->lang['FORM_INVALID']; + } + $redirect = $this->u_action; + meta_refresh(3, $redirect); + + trigger_error($msg . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + + // Generate the appropriate user information for the user we are looking at + + $rank_title = $rank_img = ''; + $avatar_img = phpbb_get_user_avatar($userrow); + + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_IP'], 'd' => $user->lang['SORT_ACTION']); + $sort_by_sql = array('a' => 'u.username_clean', 'b' => 'l.log_time', 'c' => 'l.log_ip', 'd' => 'l.log_operation'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + // Define where and sort sql for use in displaying logs + $sql_where = ($st) ? (time() - ($st * 86400)) : 0; + $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); + + $keywords = $request->variable('keywords', '', true); + $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; + + $log_data = array(); + $log_count = 0; + $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort, $keywords); + + if ($log_count) + { + $template->assign_var('S_USER_NOTES', true); + + foreach ($log_data as $row) + { + $template->assign_block_vars('usernotes', array( + 'REPORT_BY' => $row['username_full'], + 'REPORT_AT' => $user->format_date($row['time']), + 'ACTION' => $row['action'], + 'IP' => $row['ip'], + 'ID' => $row['id']) + ); + } + } + + $base_url = $this->u_action . "&$u_sort_param$keywords_param"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action, + 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_KEYWORDS' => $keywords, + + 'L_TITLE' => $user->lang['MCP_NOTES_USER'], + + 'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $log_count), + + 'RANK_TITLE' => $rank_title, + 'JOINED' => $user->format_date($userrow['user_regdate']), + 'POSTS' => ($userrow['user_posts']) ? $userrow['user_posts'] : 0, + 'WARNINGS' => ($userrow['user_warnings']) ? $userrow['user_warnings'] : 0, + + 'USERNAME_FULL' => get_username_string('full', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'USERNAME_COLOUR' => get_username_string('colour', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'USERNAME' => get_username_string('username', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'U_PROFILE' => get_username_string('profile', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $rank_img, + ) + ); + } + +} diff --git a/install/update/new/includes/mcp/mcp_topic.php b/install/update/new/includes/mcp/mcp_topic.php new file mode 100644 index 0000000..77db5f3 --- /dev/null +++ b/install/update/new/includes/mcp/mcp_topic.php @@ -0,0 +1,834 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* View topic in MCP +*/ +function mcp_topic_view($id, $mode, $action) +{ + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $auth, $phpbb_container, $phpbb_dispatcher; + + $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url()); + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $user->add_lang('viewtopic'); + + $topic_id = $request->variable('t', 0); + $topic_info = phpbb_get_topic_data(array($topic_id), false, true); + + if (!count($topic_info)) + { + trigger_error('TOPIC_NOT_EXIST'); + } + + $topic_info = $topic_info[$topic_id]; + + // Set up some vars + $icon_id = $request->variable('icon', 0); + $subject = $request->variable('subject', '', true); + $start = $request->variable('start', 0); + $sort_days_old = $request->variable('st_old', 0); + $forum_id = $request->variable('f', 0); + $to_topic_id = $request->variable('to_topic_id', 0); + $to_forum_id = $request->variable('to_forum_id', 0); + $sort = isset($_POST['sort']) ? true : false; + $submitted_id_list = $request->variable('post_ids', array(0)); + $checked_ids = $post_id_list = $request->variable('post_id_list', array(0)); + + // Resync Topic? + if ($action == 'resync') + { + if (!function_exists('mcp_resync_topics')) + { + include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx); + } + mcp_resync_topics(array($topic_id)); + } + + // Split Topic? + if ($action == 'split_all' || $action == 'split_beyond') + { + if (!$sort) + { + split_topic($action, $topic_id, $to_forum_id, $subject); + } + $action = 'split'; + } + + // Merge Posts? + if ($action == 'merge_posts') + { + if (!$sort) + { + merge_posts($topic_id, $to_topic_id); + } + $action = 'merge'; + } + + if ($action == 'split' && !$subject) + { + $subject = $topic_info['topic_title']; + } + + // Restore or pprove posts? + if (($action == 'restore' || $action == 'approve') && $auth->acl_get('m_approve', $topic_info['forum_id'])) + { + if (!class_exists('mcp_queue')) + { + include($phpbb_root_path . 'includes/mcp/mcp_queue.' . $phpEx); + } + + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + if (!count($post_id_list)) + { + trigger_error('NO_POST_SELECTED'); + } + + if (!$sort) + { + mcp_queue::approve_posts($action, $post_id_list, $id, $mode); + } + } + + // Jumpbox, sort selects and that kind of things + make_jumpbox($url . "&i=$id&mode=forum_view", $topic_info['forum_id'], false, 'm_', true); + $where_sql = ($action == 'reports') ? 'WHERE post_reported = 1 AND ' : 'WHERE'; + + $sort_days = $total = 0; + $sort_key = $sort_dir = ''; + $sort_by_sql = $sort_order_sql = array(); + phpbb_mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql); + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + $limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + + if ($total == -1) + { + $total = $phpbb_content_visibility->get_count('topic_posts', $topic_info, $topic_info['forum_id']); + } + + $posts_per_page = max(0, $request->variable('posts_per_page', intval($config['posts_per_page']))); + if ($posts_per_page == 0) + { + $posts_per_page = $total; + } + + if ((!empty($sort_days_old) && $sort_days_old != $sort_days) || $total <= $posts_per_page) + { + $start = 0; + } + $start = $pagination->validate_start($start, $posts_per_page, $total); + + $sql_where = (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . ' + p.topic_id = ' . $topic_id . ' + AND ' . $phpbb_content_visibility->get_visibility_sql('post', $topic_info['forum_id'], 'p.') . ' + AND p.poster_id = u.user_id ' . + $limit_time_sql; + + $sql_ary = array( + 'SELECT' => 'u.username, u.username_clean, u.user_colour, p.*', + 'FROM' => array( + POSTS_TABLE => 'p', + USERS_TABLE => 'u' + ), + 'LEFT_JOIN' => array(), + 'WHERE' => $sql_where, + 'ORDER_BY' => $sort_order_sql, + ); + + /** + * Event to modify the SQL query before the MCP topic review posts is queried + * + * @event core.mcp_topic_modify_sql_ary + * @var array sql_ary The SQL array to get the data of the MCP topic review posts + * @since 3.2.8-RC1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_sql_ary', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + unset($sql_ary); + + $result = $db->sql_query_limit($sql, $posts_per_page, $start); + + $rowset = $post_id_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rowset[] = $row; + $post_id_list[] = $row['post_id']; + } + $db->sql_freeresult($result); + + // Get topic tracking info + if ($config['load_db_lastread']) + { + $tmp_topic_data = array($topic_id => $topic_info); + $topic_tracking_info = get_topic_tracking($topic_info['forum_id'], $topic_id, $tmp_topic_data, array($topic_info['forum_id'] => $topic_info['forum_mark_time'])); + unset($tmp_topic_data); + } + else + { + $topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id); + } + + $has_unapproved_posts = $has_deleted_posts = false; + + // Grab extensions + $attachments = array(); + if ($topic_info['topic_attachment'] && count($post_id_list)) + { + // Get attachments... + if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id'])) + { + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $post_id_list) . ' + AND in_message = 0 + ORDER BY filetime DESC, post_msg_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + } + } + + /** + * Event to modify the post data for the MCP topic review before assigning the posts + * + * @event core.mcp_topic_modify_post_data + * @var array attachments List of attachments post_id => array of attachments + * @var int forum_id The forum ID we are currently in + * @var int id ID of the tab we are displaying + * @var string mode Mode of the MCP page we are displaying + * @var array post_id_list Array with post ids we are going to display + * @var array rowset Array with the posts data + * @var int topic_id The topic ID we are currently reviewing + * @since 3.1.7-RC1 + */ + $vars = array( + 'attachments', + 'forum_id', + 'id', + 'mode', + 'post_id_list', + 'rowset', + 'topic_id', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_post_data', compact($vars))); + + foreach ($rowset as $current_row_number => $row) + { + $message = $row['post_text']; + $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title']; + + $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']])) + { + $update_count = array(); + parse_attachments($topic_info['forum_id'], $message, $attachments[$row['post_id']], $update_count); + } + + if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) + { + $has_unapproved_posts = true; + } + + if ($row['post_visibility'] == ITEM_DELETED) + { + $has_deleted_posts = true; + } + + $post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false; + + $post_row = array( + 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + + 'POST_DATE' => $user->format_date($row['post_time']), + 'POST_SUBJECT' => $post_subject, + 'MESSAGE' => $message, + 'POST_ID' => $row['post_id'], + 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '', ''), + + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), + + 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $topic_info['forum_id'])), + 'S_POST_UNAPPROVED' => (($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $topic_info['forum_id'])), + 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED && $auth->acl_get('m_approve', $topic_info['forum_id'])), + 'S_CHECKED' => (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false, + 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, + + 'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details" . (($forum_id) ? "&f=$forum_id" : ''), + 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '', + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '', + ); + + /** + * Event to modify the template data block for topic reviews in the MCP + * + * @event core.mcp_topic_review_modify_row + * @var int id ID of the tab we are displaying + * @var string mode Mode of the MCP page we are displaying + * @var int topic_id The topic ID we are currently reviewing + * @var int forum_id The forum ID we are currently in + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var array post_row Template block array of the current post + * @var array row Array with original post and user data + * @var array topic_info Array with topic data + * @var int total Total posts count + * @since 3.1.4-RC1 + */ + $vars = array( + 'id', + 'mode', + 'topic_id', + 'forum_id', + 'start', + 'current_row_number', + 'post_row', + 'row', + 'topic_info', + 'total', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_topic_review_modify_row', compact($vars))); + + $template->assign_block_vars('postrow', $post_row); + + // Display not already displayed Attachments for this post, we already parsed them. ;) + if (!empty($attachments[$row['post_id']])) + { + foreach ($attachments[$row['post_id']] as $attachment) + { + $template->assign_block_vars('postrow.attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + } + + unset($rowset[$current_row_number]); + } + + // Display topic icons for split topic + $s_topic_icons = false; + + if ($auth->acl_gets('m_split', 'm_merge', (int) $topic_info['forum_id'])) + { + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + $s_topic_icons = posting_gen_topic_icons('', $icon_id); + + // Has the user selected a topic for merge? + if ($to_topic_id) + { + $to_topic_info = phpbb_get_topic_data(array($to_topic_id), 'm_merge'); + + if (!count($to_topic_info)) + { + $to_topic_id = 0; + } + else + { + $to_topic_info = $to_topic_info[$to_topic_id]; + + if (!$to_topic_info['enable_icons'] || $auth->acl_get('!f_icons', $topic_info['forum_id'])) + { + $s_topic_icons = false; + } + } + } + } + + $s_hidden_fields = build_hidden_fields(array( + 'st_old' => $sort_days, + 'post_ids' => $post_id_list, + )); + + $base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir"); + if ($posts_per_page) + { + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $posts_per_page, $start); + } + + $template->assign_vars(array( + 'TOPIC_TITLE' => $topic_info['topic_title'], + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']), + + 'TO_TOPIC_ID' => $to_topic_id, + 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '' . $to_topic_info['topic_title'] . '') : '', + + 'SPLIT_SUBJECT' => $subject, + 'POSTS_PER_PAGE' => $posts_per_page, + 'ACTION' => $action, + + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), + 'DELETED_IMG' => $user->img('icon_topic_deleted', 'POST_DELETED_RESTORE'), + 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'), + + 'S_MCP_ACTION' => "$url&i=$id&mode=$mode&action=$action&start=$start", + 'S_FORUM_SELECT' => ($to_forum_id) ? make_forum_select($to_forum_id, false, false, true, true, true) : make_forum_select($topic_info['forum_id'], false, false, true, true, true), + 'S_CAN_SPLIT' => ($auth->acl_get('m_split', $topic_info['forum_id'])) ? true : false, + 'S_CAN_MERGE' => ($auth->acl_get('m_merge', $topic_info['forum_id'])) ? true : false, + 'S_CAN_DELETE' => ($auth->acl_get('m_delete', $topic_info['forum_id'])) ? true : false, + 'S_CAN_APPROVE' => ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false, + 'S_CAN_RESTORE' => ($has_deleted_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false, + 'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false, + 'S_CAN_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? true : false, + 'S_CAN_SYNC' => $auth->acl_get('m_', $topic_info['forum_id']), + 'S_REPORT_VIEW' => ($action == 'reports') ? true : false, + 'S_MERGE_VIEW' => ($action == 'merge') ? true : false, + 'S_SPLIT_VIEW' => ($action == 'split') ? true : false, + + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + + 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, + 'S_TOPIC_ICON' => $icon_id, + + 'U_SELECT_TOPIC' => "$url&i=$id&mode=forum_view&action=merge_select" . (($forum_id) ? "&f=$forum_id" : ''), + + 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '', ''), + 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '', ''), + + 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total), + )); +} + +/** +* Split topic +*/ +function split_topic($action, $topic_id, $to_forum_id, $subject) +{ + global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config, $phpbb_log, $request, $phpbb_dispatcher; + + $post_id_list = $request->variable('post_id_list', array(0)); + $forum_id = $request->variable('forum_id', 0); + $start = $request->variable('start', 0); + + if (!count($post_id_list)) + { + $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); + return; + } + + if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_split'))) + { + return; + } + + $post_id = $post_id_list[0]; + $post_info = phpbb_get_post_data(array($post_id)); + + if (!count($post_info)) + { + $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); + return; + } + + $post_info = $post_info[$post_id]; + $subject = trim($subject); + + // Make some tests + if (!$subject) + { + $template->assign_var('MESSAGE', $user->lang['EMPTY_SUBJECT']); + return; + } + + if ($to_forum_id <= 0) + { + $template->assign_var('MESSAGE', $user->lang['NO_DESTINATION_FORUM']); + return; + } + + $forum_info = phpbb_get_forum_data(array($to_forum_id), 'f_post'); + + if (!count($forum_info)) + { + $template->assign_var('MESSAGE', $user->lang['USER_CANNOT_POST']); + return; + } + + $forum_info = $forum_info[$to_forum_id]; + + if ($forum_info['forum_type'] != FORUM_POST) + { + $template->assign_var('MESSAGE', $user->lang['FORUM_NOT_POSTABLE']); + return; + } + + $redirect = $request->variable('redirect', build_url(array('quickmod'))); + + $s_hidden_fields = build_hidden_fields(array( + 'i' => 'main', + 'post_id_list' => $post_id_list, + 'f' => $forum_id, + 'mode' => 'topic_view', + 'start' => $start, + 'action' => $action, + 't' => $topic_id, + 'redirect' => $redirect, + 'subject' => $subject, + 'to_forum_id' => $to_forum_id, + 'icon' => $request->variable('icon', 0)) + ); + + if (confirm_box(true)) + { + if ($action == 'split_beyond') + { + $sort_days = $total = 0; + $sort_key = $sort_dir = ''; + $sort_by_sql = $sort_order_sql = array(); + phpbb_mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); + + $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; + + if ($sort_order_sql[0] == 'u') + { + $sql = 'SELECT p.post_id, p.forum_id, p.post_visibility + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE p.topic_id = $topic_id + AND p.poster_id = u.user_id + $limit_time_sql + ORDER BY $sort_order_sql"; + } + else + { + $sql = 'SELECT p.post_id, p.forum_id, p.post_visibility + FROM ' . POSTS_TABLE . " p + WHERE p.topic_id = $topic_id + $limit_time_sql + ORDER BY $sort_order_sql"; + } + $result = $db->sql_query_limit($sql, 0, $start); + + $store = false; + $post_id_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + // If split from selected post (split_beyond), we split the unapproved items too. + if (($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) && !$auth->acl_get('m_approve', $row['forum_id'])) + { +// continue; + } + + // Start to store post_ids as soon as we see the first post that was selected + if ($row['post_id'] == $post_id) + { + $store = true; + } + + if ($store) + { + $post_id_list[] = $row['post_id']; + } + } + $db->sql_freeresult($result); + } + + if (!count($post_id_list)) + { + trigger_error('NO_POST_SELECTED'); + } + + $icon_id = $request->variable('icon', 0); + + $sql_ary = array( + 'forum_id' => $to_forum_id, + 'topic_title' => $subject, + 'icon_id' => $icon_id, + 'topic_visibility' => 1 + ); + + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + + $to_topic_id = $db->sql_nextid(); + move_posts($post_id_list, $to_topic_id); + + $topic_info = phpbb_get_topic_data(array($topic_id)); + $topic_info = $topic_info[$topic_id]; + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SPLIT_DESTINATION', false, array( + 'forum_id' => $to_forum_id, + 'topic_id' => $to_topic_id, + $subject + )); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SPLIT_SOURCE', false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $topic_info['topic_title'] + )); + + // Change topic title of first post + $sql = 'UPDATE ' . POSTS_TABLE . " + SET post_subject = '" . $db->sql_escape($subject) . "' + WHERE post_id = {$post_id_list[0]}"; + $db->sql_query($sql); + + // Grab data for first post in split topic + $sql_array = array( + 'SELECT' => 'p.post_id, p.forum_id, p.poster_id, p.post_text, f.enable_indexing', + 'FROM' => array( + POSTS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'p.forum_id = f.forum_id', + ) + ), + 'WHERE' => "post_id = {$post_id_list[0]}", + ); + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + $first_post_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Index first post as if it were edited + if ($first_post_data['enable_indexing']) + { + // Select the search method and do some additional checks to ensure it can actually be utilised + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if ($error) + { + trigger_error($error); + } + + $search->index('edit', $first_post_data['post_id'], $first_post_data['post_text'], $subject, $first_post_data['poster_id'], $first_post_data['forum_id']); + } + + // Copy topic subscriptions to new topic + $sql = 'SELECT user_id, notify_status + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $to_topic_id, + 'user_id' => (int) $row['user_id'], + 'notify_status' => (int) $row['notify_status'], + ); + } + $db->sql_freeresult($result); + + if (count($sql_ary)) + { + $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); + } + + // Copy bookmarks to new topic + $sql = 'SELECT user_id + FROM ' . BOOKMARKS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $to_topic_id, + 'user_id' => (int) $row['user_id'], + ); + } + $db->sql_freeresult($result); + + if (count($sql_ary)) + { + $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary); + } + + $success_msg = 'TOPIC_SPLIT_SUCCESS'; + + // Update forum statistics + $config->increment('num_topics', 1, false); + + // Link back to both topics + $return_link = sprintf($user->lang['RETURN_TOPIC'], '', '') . '

' . sprintf($user->lang['RETURN_NEW_TOPIC'], '', ''); + $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); + $redirect = reapply_sid($redirect); + + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '

' . $return_link); + } + else + { + confirm_box(false, ($action == 'split_all') ? 'SPLIT_TOPIC_ALL' : 'SPLIT_TOPIC_BEYOND', $s_hidden_fields); + } +} + +/** +* Merge selected posts into selected topic +*/ +function merge_posts($topic_id, $to_topic_id) +{ + global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher; + + if (!$to_topic_id) + { + $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); + return; + } + + $sync_topics = array($topic_id, $to_topic_id); + + $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); + + if (!count($topic_data) || empty($topic_data[$to_topic_id])) + { + $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); + return; + } + + $sync_forums = array(); + foreach ($topic_data as $data) + { + $sync_forums[$data['forum_id']] = $data['forum_id']; + } + + $topic_data = $topic_data[$to_topic_id]; + + $post_id_list = $request->variable('post_id_list', array(0)); + $start = $request->variable('start', 0); + + if (!count($post_id_list)) + { + $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); + return; + } + + if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge'))) + { + return; + } + + $redirect = $request->variable('redirect', build_url(array('quickmod'))); + + $s_hidden_fields = build_hidden_fields(array( + 'i' => 'main', + 'post_id_list' => $post_id_list, + 'to_topic_id' => $to_topic_id, + 'mode' => 'topic_view', + 'action' => 'merge_posts', + 'start' => $start, + 'redirect' => $redirect, + 't' => $topic_id) + ); + $return_link = ''; + + if (confirm_box(true)) + { + $to_forum_id = $topic_data['forum_id']; + + move_posts($post_id_list, $to_topic_id, false); + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array( + 'forum_id' => $to_forum_id, + 'topic_id' => $to_topic_id, + $topic_data['topic_title'] + )); + + // Message and return links + $success_msg = 'POSTS_MERGED_SUCCESS'; + + // Does the original topic still exist? If yes, link back to it + $sql = 'SELECT forum_id + FROM ' . POSTS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $return_link .= sprintf($user->lang['RETURN_TOPIC'], '', ''); + } + else + { + if (!function_exists('phpbb_update_rows_avoiding_duplicates_notify_status')) + { + include($phpbb_root_path . 'includes/functions_database_helper.' . $phpEx); + } + + // 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', 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', array($topic_id), $to_topic_id); + } + + // Re-sync the topics and forums because the auto-sync was deactivated in the call of move_posts() + sync('topic_reported', 'topic_id', $sync_topics); + sync('topic_attachment', 'topic_id', $sync_topics); + sync('topic', 'topic_id', $sync_topics, true); + sync('forum', 'forum_id', $sync_forums, true, true); + + // Link to the new topic + $return_link .= (($return_link) ? '

' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '', ''); + $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); + $redirect = reapply_sid($redirect); + + /** + * Perform additional actions after merging posts. + * + * @event core.mcp_topics_merge_posts_after + * @var int topic_id The topic ID from which posts are being moved + * @var int to_topic_id The topic ID to which posts are being moved + * @since 3.1.11-RC1 + */ + $vars = array( + 'topic_id', + 'to_topic_id', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_topics_merge_posts_after', compact($vars))); + + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '

' . $return_link); + } + else + { + confirm_box(false, 'MERGE_POSTS', $s_hidden_fields); + } +} diff --git a/install/update/new/includes/mcp/mcp_warn.php b/install/update/new/includes/mcp/mcp_warn.php new file mode 100644 index 0000000..7a8599f --- /dev/null +++ b/install/update/new/includes/mcp/mcp_warn.php @@ -0,0 +1,610 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* mcp_warn +* Handling warning the users +*/ +class mcp_warn +{ + var $p_master; + var $u_action; + + function __construct($p_master) + { + $this->p_master = $p_master; + } + + function main($id, $mode) + { + global $request; + + $action = $request->variable('action', array('' => '')); + + if (is_array($action)) + { + $action = key($action); + } + + $this->page_title = 'MCP_WARN'; + + add_form_key('mcp_warn'); + + switch ($mode) + { + case 'front': + $this->mcp_warn_front_view(); + $this->tpl_name = 'mcp_warn_front'; + break; + + case 'list': + $this->mcp_warn_list_view($action); + $this->tpl_name = 'mcp_warn_list'; + break; + + case 'warn_post': + $this->mcp_warn_post_view($action); + $this->tpl_name = 'mcp_warn_post'; + break; + + case 'warn_user': + $this->mcp_warn_user_view($action); + $this->tpl_name = 'mcp_warn_user'; + break; + } + } + + /** + * Generates the summary on the main page of the warning module + */ + function mcp_warn_front_view() + { + global $phpEx, $phpbb_root_path; + global $template, $db, $user; + + $template->assign_vars(array( + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'), + 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user'), + )); + + // Obtain a list of the 5 naughtiest users.... + // These are the 5 users with the highest warning count + $highest = array(); + $count = 0; + + view_warned_users($highest, $count, 5); + + foreach ($highest as $row) + { + $template->assign_block_vars('highest', array( + 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + + 'WARNING_TIME' => $user->format_date($row['user_last_warning']), + 'WARNINGS' => $row['user_warnings'], + )); + } + + // And now the 5 most recent users to get in trouble + $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_warnings, w.warning_time + FROM ' . USERS_TABLE . ' u, ' . WARNINGS_TABLE . ' w + WHERE u.user_id = w.user_id + ORDER BY w.warning_time DESC'; + $result = $db->sql_query_limit($sql, 5); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('latest', array( + 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + + 'WARNING_TIME' => $user->format_date($row['warning_time']), + 'WARNINGS' => $row['user_warnings'], + )); + } + $db->sql_freeresult($result); + } + + /** + * Lists all users with warnings + */ + function mcp_warn_list_view($action) + { + global $phpEx, $phpbb_root_path, $config, $phpbb_container; + global $template, $user, $auth, $request; + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $user->add_lang('memberlist'); + + $start = $request->variable('start', 0); + $st = $request->variable('st', 0); + $sk = $request->variable('sk', 'b'); + $sd = $request->variable('sd', 'd'); + + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']); + $sort_by_sql = array('a' => 'username_clean', 'b' => 'user_last_warning', 'c' => 'user_warnings'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + // Define where and sort sql for use in displaying logs + $sql_where = ($st) ? (time() - ($st * 86400)) : 0; + $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); + + $users = array(); + $user_count = 0; + + view_warned_users($users, $user_count, $config['topics_per_page'], $start, $sql_where, $sql_sort); + + foreach ($users as $row) + { + $template->assign_block_vars('user', array( + 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + + 'WARNING_TIME' => $user->format_date($row['user_last_warning']), + 'WARNINGS' => $row['user_warnings'], + )); + } + + $base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&mode=list&st=$st&sk=$sk&sd=$sd"); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $user_count, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action, + 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + + 'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $user_count), + )); + } + + /** + * Handles warning the user when the warning is for a specific post + */ + function mcp_warn_post_view($action) + { + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $phpbb_dispatcher; + + $post_id = $request->variable('p', 0); + $forum_id = $request->variable('f', 0); + $notify = (isset($_REQUEST['notify_user'])) ? true : false; + $warning = $request->variable('warning', '', true); + + $sql = 'SELECT u.*, p.* + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE p.post_id = $post_id + AND u.user_id = p.poster_id"; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + trigger_error('NO_POST'); + } + + // There is no point issuing a warning to ignored users (ie anonymous and bots) + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error('CANNOT_WARN_ANONYMOUS'); + } + + // Prevent someone from warning themselves + if ($user_row['user_id'] == $user->data['user_id']) + { + trigger_error('CANNOT_WARN_SELF'); + } + + // Check if there is already a warning for this post to prevent multiple + // warnings for the same offence + $sql = 'SELECT post_id + FROM ' . WARNINGS_TABLE . " + WHERE post_id = $post_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + trigger_error('ALREADY_WARNED'); + } + + $user_id = $user_row['user_id']; + + if (strpos($this->u_action, "&f=$forum_id&p=$post_id") === false) + { + $this->p_master->adjust_url("&f=$forum_id&p=$post_id"); + $this->u_action .= "&f=$forum_id&p=$post_id"; + } + + // Check if can send a notification + if ($config['allow_privmsg']) + { + $auth2 = new \phpbb\auth\auth(); + $auth2->acl($user_row); + $s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false; + unset($auth2); + } + else + { + $s_can_notify = false; + } + + // Prevent against clever people + if ($notify && !$s_can_notify) + { + $notify = false; + } + + if ($warning && $action == 'add_warning') + { + if (check_form_key('mcp_warn')) + { + $s_mcp_warn_post = true; + + /** + * Event for before warning a user for a post. + * + * @event core.mcp_warn_post_before + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, we notify the user for the warning + * @var int post_id The post id for which the warning is added + * @var bool s_mcp_warn_post If true, we add the warning else we omit it + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 'post_id', + 's_mcp_warn_post', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_post_before', compact($vars))); + + if ($s_mcp_warn_post) + { + add_warning($user_row, $warning, $notify, $post_id); + $message = $user->lang['USER_WARNING_ADDED']; + + /** + * Event for after warning a user for a post. + * + * @event core.mcp_warn_post_after + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, the user was notified for the warning + * @var int post_id The post id for which the warning is added + * @var string message Message displayed to the moderator + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 'post_id', + 'message', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_post_after', compact($vars))); + } + } + else + { + $message = $user->lang['FORM_INVALID']; + } + + if (!empty($message)) + { + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); + meta_refresh(2, $redirect); + trigger_error($message . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + } + + // OK, they didn't submit a warning so lets build the page for them to do so + + // We want to make the message available here as a reminder + // Parse the message and subject + $parse_flags = OPTION_FLAG_SMILIES | ($user_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_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']); + $avatar_img = phpbb_get_user_avatar($user_row); + + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action, + + 'POST' => $message, + 'USERNAME' => $user_row['username'], + 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', + 'RANK_TITLE' => $user_rank_data['title'], + 'JOINED' => $user->format_date($user_row['user_regdate']), + 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, + 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, + + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $user_rank_data['img'], + + 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&p=$post_id#p$post_id"), + + 'S_CAN_NOTIFY' => $s_can_notify, + )); + } + + /** + * Handles warning the user + */ + function mcp_warn_user_view($action) + { + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $phpbb_dispatcher; + + $user_id = $request->variable('u', 0); + $username = $request->variable('username', '', true); + $notify = (isset($_REQUEST['notify_user'])) ? true : false; + $warning = $request->variable('warning', '', true); + + $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE ' . $sql_where; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + trigger_error('NO_USER'); + } + + // Prevent someone from warning themselves + if ($user_row['user_id'] == $user->data['user_id']) + { + trigger_error('CANNOT_WARN_SELF'); + } + + $user_id = $user_row['user_id']; + + if (strpos($this->u_action, "&u=$user_id") === false) + { + $this->p_master->adjust_url('&u=' . $user_id); + $this->u_action .= "&u=$user_id"; + } + + // Check if can send a notification + if ($config['allow_privmsg']) + { + $auth2 = new \phpbb\auth\auth(); + $auth2->acl($user_row); + $s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false; + unset($auth2); + } + else + { + $s_can_notify = false; + } + + // Prevent against clever people + if ($notify && !$s_can_notify) + { + $notify = false; + } + + if ($warning && $action == 'add_warning') + { + if (check_form_key('mcp_warn')) + { + $s_mcp_warn_user = true; + + /** + * Event for before warning a user from MCP. + * + * @event core.mcp_warn_user_before + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, we notify the user for the warning + * @var bool s_mcp_warn_user If true, we add the warning else we omit it + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 's_mcp_warn_user', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_before', compact($vars))); + + if ($s_mcp_warn_user) + { + add_warning($user_row, $warning, $notify); + $message = $user->lang['USER_WARNING_ADDED']; + + /** + * Event for after warning a user from MCP. + * + * @event core.mcp_warn_user_after + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, the user was notified for the warning + * @var string message Message displayed to the moderator + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 'message', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_after', compact($vars))); + } + } + else + { + $message = $user->lang['FORM_INVALID']; + } + + if (!empty($message)) + { + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); + meta_refresh(2, $redirect); + trigger_error($message . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + } + + // Generate the appropriate user information for the user we are looking at + if (!function_exists('phpbb_get_user_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + $user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']); + $avatar_img = phpbb_get_user_avatar($user_row); + + // OK, they didn't submit a warning so lets build the page for them to do so + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action, + + 'RANK_TITLE' => $user_rank_data['title'], + 'JOINED' => $user->format_date($user_row['user_regdate']), + 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, + 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, + + 'USERNAME_FULL' => get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'USERNAME_COLOUR' => get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'USERNAME' => get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $user_rank_data['img'], + + 'S_CAN_NOTIFY' => $s_can_notify, + )); + + return $user_id; + } +} + +/** +* Insert the warning into the database +*/ +function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) +{ + global $phpEx, $phpbb_root_path, $config, $phpbb_log; + global $db, $user; + + if ($send_pm) + { + include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); + + // Attempt to translate warning to language of user being warned if user's language differs from issuer's language + if ($user_row['user_lang'] != $user->lang_name) + { + $lang = array(); + + $user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx)) ? $user_row['user_lang'] : $config['default_lang']; + include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx); + + $warn_pm_subject = $lang['WARNING_PM_SUBJECT']; + $warn_pm_body = sprintf($lang['WARNING_PM_BODY'], $warning); + + unset($lang); + } + else + { + $warn_pm_subject = $user->lang('WARNING_PM_SUBJECT'); + $warn_pm_body = $user->lang('WARNING_PM_BODY', $warning); + } + + $message_parser = new parse_message(); + + $message_parser->message = $warn_pm_body; + $message_parser->parse(true, true, true, false, false, true, true); + + $pm_data = array( + 'from_user_id' => $user->data['user_id'], + 'from_user_ip' => $user->ip, + 'from_username' => $user->data['username'], + 'enable_sig' => false, + 'enable_bbcode' => true, + 'enable_smilies' => true, + 'enable_urls' => false, + 'icon_id' => 0, + 'bbcode_bitfield' => $message_parser->bbcode_bitfield, + 'bbcode_uid' => $message_parser->bbcode_uid, + 'message' => $message_parser->message, + 'address_list' => array('u' => array($user_row['user_id'] => 'to')), + ); + + submit_pm('post', $warn_pm_subject, $pm_data, false); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array($user_row['username'])); + $log_id = $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING_BODY', false, array( + 'reportee_id' => $user_row['user_id'], + $warning + )); + + $sql_ary = array( + 'user_id' => $user_row['user_id'], + 'post_id' => $post_id, + 'log_id' => $log_id, + 'warning_time' => time(), + ); + + $db->sql_query('INSERT INTO ' . WARNINGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_warnings = user_warnings + 1, + user_last_warning = ' . time() . ' + WHERE user_id = ' . $user_row['user_id']; + $db->sql_query($sql); + + // We add this to the mod log too for moderators to see that a specific user got warned. + $sql = 'SELECT forum_id, topic_id + FROM ' . POSTS_TABLE . ' + WHERE post_id = ' . $post_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => $post_id, + $user_row['username'] + )); +} diff --git a/install/update/new/includes/message_parser.php b/install/update/new/includes/message_parser.php new file mode 100644 index 0000000..d6214c4 --- /dev/null +++ b/install/update/new/includes/message_parser.php @@ -0,0 +1,2087 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (!class_exists('bbcode')) +{ + // The following lines are for extensions which include message_parser.php + // while $phpbb_root_path and $phpEx are out of the script scope + // which may lead to the 'Undefined variable' and 'failed to open stream' errors + if (!isset($phpbb_root_path)) + { + global $phpbb_root_path; + } + + if (!isset($phpEx)) + { + global $phpEx; + } + + include($phpbb_root_path . 'includes/bbcode.' . $phpEx); +} + +/** +* BBCODE FIRSTPASS +* BBCODE first pass class (functions for parsing messages for db storage) +*/ +class bbcode_firstpass extends bbcode +{ + var $message = ''; + var $warn_msg = array(); + var $parsed_items = array(); + var $mode; + + /** + * Parse BBCode + */ + function parse_bbcode() + { + if (!$this->bbcodes) + { + $this->bbcode_init(); + } + + global $user; + + $this->bbcode_bitfield = ''; + $bitfield = new bitfield(); + + foreach ($this->bbcodes as $bbcode_name => $bbcode_data) + { + if (isset($bbcode_data['disabled']) && $bbcode_data['disabled']) + { + foreach ($bbcode_data['regexp'] as $regexp => $replacement) + { + if (preg_match($regexp, $this->message)) + { + $this->warn_msg[] = sprintf($user->lang['UNAUTHORISED_BBCODE'] , '[' . $bbcode_name . ']'); + continue; + } + } + } + else + { + foreach ($bbcode_data['regexp'] as $regexp => $replacement) + { + // The pattern gets compiled and cached by the PCRE extension, + // it should not demand recompilation + if (preg_match($regexp, $this->message)) + { + if (is_callable($replacement)) + { + $this->message = preg_replace_callback($regexp, $replacement, $this->message); + } + else + { + $this->message = preg_replace($regexp, $replacement, $this->message); + } + $bitfield->set($bbcode_data['bbcode_id']); + } + } + } + } + + $this->bbcode_bitfield = $bitfield->get_base64(); + } + + /** + * Prepare some bbcodes for better parsing + */ + function prepare_bbcodes() + { + // Ok, seems like users instead want the no-parsing of urls, smilies, etc. after and before and within quote tags being tagged as "not a bug". + // Fine by me ;) Will ease our live... but do not come back and cry at us, we won't hear you. + + /* Add newline at the end and in front of each quote block to prevent parsing errors (urls, smilies, etc.) + if (strpos($this->message, '[quote') !== false && strpos($this->message, '[/quote]') !== false) + { + $this->message = str_replace("\r\n", "\n", $this->message); + + // We strip newlines and spaces after and before quotes in quotes (trimming) and then add exactly one newline + $this->message = preg_replace('#\[quote(=".*?")?\]\s*(.*?)\s*\[/quote\]#siu', '[quote\1]' . "\n" . '\2' ."\n[/quote]", $this->message); + } + */ + + // Add other checks which needs to be placed before actually parsing anything (be it bbcodes, smilies, urls...) + } + + /** + * Init bbcode data for later parsing + */ + function bbcode_init($allow_custom_bbcode = true) + { + global $phpbb_dispatcher; + + static $rowset; + + $bbcode_class = $this; + + // This array holds all bbcode data. BBCodes will be processed in this + // order, so it is important to keep [code] in first position and + // [quote] in second position. + // To parse multiline URL we enable dotall option setting only for URL text + // but not for link itself, thus [url][/url] is not affected. + // + // To perform custom validation in extension, use $this->validate_bbcode_by_extension() + // method which accepts variable number of parameters + $this->bbcodes = array( + 'code' => array('bbcode_id' => BBCODE_ID_CODE, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_code($match[1], $match[2]); + } + )), + 'quote' => array('bbcode_id' => BBCODE_ID_QUOTE, 'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_quote($match[0]); + } + )), + 'attachment' => array('bbcode_id' => BBCODE_ID_ATTACH, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_attachment($match[1], $match[2]); + } + )), + 'b' => array('bbcode_id' => BBCODE_ID_B, 'regexp' => array('#\[b\](.*?)\[/b\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_strong($match[1]); + } + )), + 'i' => array('bbcode_id' => BBCODE_ID_I, 'regexp' => array('#\[i\](.*?)\[/i\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_italic($match[1]); + } + )), + 'url' => array('bbcode_id' => BBCODE_ID_URL, 'regexp' => array('#\[url(=(.*))?\](?(1)((?s).*(?-s))|(.*))\[/url\]#uiU' => function ($match) use($bbcode_class) + { + return $bbcode_class->validate_url($match[2], ($match[3]) ? $match[3] : $match[4]); + } + )), + 'img' => array('bbcode_id' => BBCODE_ID_IMG, 'regexp' => array('#\[img\](.*)\[/img\]#uiU' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_img($match[1]); + } + )), + 'size' => array('bbcode_id' => BBCODE_ID_SIZE, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_size($match[1], $match[2]); + } + )), + 'color' => array('bbcode_id' => BBCODE_ID_COLOR, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_color($match[1], $match[2]); + } + )), + 'u' => array('bbcode_id' => BBCODE_ID_U, 'regexp' => array('#\[u\](.*?)\[/u\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_underline($match[1]); + } + )), + 'list' => array('bbcode_id' => BBCODE_ID_LIST, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_parse_list($match[0]); + } + )), + 'email' => array('bbcode_id' => BBCODE_ID_EMAIL, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->validate_email($match[1], $match[2]); + } + )), + 'flash' => array('bbcode_id' => BBCODE_ID_FLASH, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ui' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_flash($match[1], $match[2], $match[3]); + } + )) + ); + + // Zero the parsed items array + $this->parsed_items = array(); + + foreach ($this->bbcodes as $tag => $bbcode_data) + { + $this->parsed_items[$tag] = 0; + } + + if (!$allow_custom_bbcode) + { + return; + } + + if (!is_array($rowset)) + { + global $db; + $rowset = array(); + + $sql = 'SELECT * + FROM ' . BBCODES_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $rowset[] = $row; + } + $db->sql_freeresult($result); + } + + foreach ($rowset as $row) + { + $this->bbcodes[$row['bbcode_tag']] = array( + 'bbcode_id' => (int) $row['bbcode_id'], + 'regexp' => array($row['first_pass_match'] => str_replace('$uid', $this->bbcode_uid, $row['first_pass_replace'])) + ); + } + + $bbcodes = $this->bbcodes; + + /** + * Event to modify the bbcode data for later parsing + * + * @event core.modify_bbcode_init + * @var array bbcodes Array of bbcode data for use in parsing + * @var array rowset Array of bbcode data from the database + * @since 3.1.0-a3 + */ + $vars = array('bbcodes', 'rowset'); + extract($phpbb_dispatcher->trigger_event('core.modify_bbcode_init', compact($vars))); + + $this->bbcodes = $bbcodes; + } + + /** + * Making some pre-checks for bbcodes as well as increasing the number of parsed items + */ + function check_bbcode($bbcode, &$in) + { + // when using the /e modifier, preg_replace slashes double-quotes but does not + // seem to slash anything else + $in = str_replace("\r\n", "\n", str_replace('\"', '"', $in)); + + // Trimming here to make sure no empty bbcodes are parsed accidently + if (trim($in) == '') + { + return false; + } + + $this->parsed_items[$bbcode]++; + + return true; + } + + /** + * Transform some characters in valid bbcodes + */ + function bbcode_specialchars($text) + { + $str_from = array('<', '>', '[', ']', '.', ':'); + $str_to = array('<', '>', '[', ']', '.', ':'); + + return str_replace($str_from, $str_to, $text); + } + + /** + * Parse size tag + */ + function bbcode_size($stx, $in) + { + global $user, $config; + + if (!$this->check_bbcode('size', $in)) + { + return $in; + } + + if ($config['max_' . $this->mode . '_font_size'] && $config['max_' . $this->mode . '_font_size'] < $stx) + { + $this->warn_msg[] = $user->lang('MAX_FONT_SIZE_EXCEEDED', (int) $config['max_' . $this->mode . '_font_size']); + + return '[size=' . $stx . ']' . $in . '[/size]'; + } + + // Do not allow size=0 + if ($stx <= 0) + { + return '[size=' . $stx . ']' . $in . '[/size]'; + } + + return '[size=' . $stx . ':' . $this->bbcode_uid . ']' . $in . '[/size:' . $this->bbcode_uid . ']'; + } + + /** + * Parse color tag + */ + function bbcode_color($stx, $in) + { + if (!$this->check_bbcode('color', $in)) + { + return $in; + } + + return '[color=' . $stx . ':' . $this->bbcode_uid . ']' . $in . '[/color:' . $this->bbcode_uid . ']'; + } + + /** + * Parse u tag + */ + function bbcode_underline($in) + { + if (!$this->check_bbcode('u', $in)) + { + return $in; + } + + return '[u:' . $this->bbcode_uid . ']' . $in . '[/u:' . $this->bbcode_uid . ']'; + } + + /** + * Parse b tag + */ + function bbcode_strong($in) + { + if (!$this->check_bbcode('b', $in)) + { + return $in; + } + + return '[b:' . $this->bbcode_uid . ']' . $in . '[/b:' . $this->bbcode_uid . ']'; + } + + /** + * Parse i tag + */ + function bbcode_italic($in) + { + if (!$this->check_bbcode('i', $in)) + { + return $in; + } + + return '[i:' . $this->bbcode_uid . ']' . $in . '[/i:' . $this->bbcode_uid . ']'; + } + + /** + * Parse img tag + */ + function bbcode_img($in) + { + global $user, $config; + + if (!$this->check_bbcode('img', $in)) + { + return $in; + } + + $in = trim($in); + $error = false; + + $in = str_replace(' ', '%20', $in); + + // Checking urls + if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $in) && !preg_match('#^' . get_preg_expression('www_url') . '$#iu', $in)) + { + return '[img]' . $in . '[/img]'; + } + + // Try to cope with a common user error... not specifying a protocol but only a subdomain + if (!preg_match('#^[a-z0-9]+://#i', $in)) + { + $in = 'http://' . $in; + } + + if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width']) + { + $imagesize = new \FastImageSize\FastImageSize(); + $size_info = $imagesize->getImageSize(htmlspecialchars_decode($in)); + + if ($size_info === false) + { + $error = true; + $this->warn_msg[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; + } + else + { + if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $size_info['height']) + { + $error = true; + $this->warn_msg[] = $user->lang('MAX_IMG_HEIGHT_EXCEEDED', (int) $config['max_' . $this->mode . '_img_height']); + } + + if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $size_info['width']) + { + $error = true; + $this->warn_msg[] = $user->lang('MAX_IMG_WIDTH_EXCEEDED', (int) $config['max_' . $this->mode . '_img_width']); + } + } + } + + if ($error || $this->path_in_domain($in)) + { + return '[img]' . $in . '[/img]'; + } + + return '[img:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($in) . '[/img:' . $this->bbcode_uid . ']'; + } + + /** + * Parse flash tag + */ + function bbcode_flash($width, $height, $in) + { + global $user, $config; + + if (!$this->check_bbcode('flash', $in)) + { + return $in; + } + + $in = trim($in); + $error = false; + + // Do not allow 0-sizes generally being entered + if ($width <= 0 || $height <= 0) + { + return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]'; + } + + $in = str_replace(' ', '%20', $in); + + // Make sure $in is a URL. + if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $in) && + !preg_match('#^' . get_preg_expression('www_url') . '$#iu', $in)) + { + return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]'; + } + + // Apply the same size checks on flash files as on images + if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width']) + { + if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $height) + { + $error = true; + $this->warn_msg[] = $user->lang('MAX_FLASH_HEIGHT_EXCEEDED', (int) $config['max_' . $this->mode . '_img_height']); + } + + if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $width) + { + $error = true; + $this->warn_msg[] = $user->lang('MAX_FLASH_WIDTH_EXCEEDED', (int) $config['max_' . $this->mode . '_img_width']); + } + } + + if ($error || $this->path_in_domain($in)) + { + return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]'; + } + + return '[flash=' . $width . ',' . $height . ':' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($in) . '[/flash:' . $this->bbcode_uid . ']'; + } + + /** + * Parse inline attachments [ia] + */ + function bbcode_attachment($stx, $in) + { + if (!$this->check_bbcode('attachment', $in)) + { + return $in; + } + + return '[attachment=' . $stx . ':' . $this->bbcode_uid . ']' . trim($in) . '[/attachment:' . $this->bbcode_uid . ']'; + } + + /** + * Parse code text from code tag + * @access private + */ + function bbcode_parse_code($stx, &$code) + { + switch (strtolower($stx)) + { + case 'php': + + $remove_tags = false; + + $str_from = array('<', '>', '[', ']', '.', ':', ':'); + $str_to = array('<', '>', '[', ']', '.', ':', ':'); + $code = str_replace($str_from, $str_to, $code); + + if (!preg_match('/\<\?.*?\?\>/is', $code)) + { + $remove_tags = true; + $code = ""; + } + + $conf = array('highlight.bg', 'highlight.comment', 'highlight.default', 'highlight.html', 'highlight.keyword', 'highlight.string'); + foreach ($conf as $ini_var) + { + @ini_set($ini_var, str_replace('highlight.', 'syntax', $ini_var)); + } + + // Because highlight_string is specialcharing the text (but we already did this before), we have to reverse this in order to get correct results + $code = htmlspecialchars_decode($code); + $code = highlight_string($code, true); + + $str_from = array('', '', '','[', ']', '.', ':'); + $str_to = array('', '', '', '[', ']', '.', ':'); + + if ($remove_tags) + { + $str_from[] = '<?php '; + $str_to[] = ''; + $str_from[] = '<?php '; + $str_to[] = ''; + } + + $code = str_replace($str_from, $str_to, $code); + $code = preg_replace('#^()\n?(.*?)\n?()$#is', '$1$2$3', $code); + + if ($remove_tags) + { + $code = preg_replace('#()?\?>()#', '$1 $2', $code); + } + + $code = preg_replace('#^(.*)#s', '$2', $code); + $code = preg_replace('#(?:\s++| )*+$#u', '', $code); + + // remove newline at the end + if (!empty($code) && substr($code, -1) == "\n") + { + $code = substr($code, 0, -1); + } + + return "[code=$stx:" . $this->bbcode_uid . ']' . $code . '[/code:' . $this->bbcode_uid . ']'; + break; + + default: + return '[code:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($code) . '[/code:' . $this->bbcode_uid . ']'; + break; + } + } + + /** + * Parse code tag + * Expects the argument to start right after the opening [code] tag and to end with [/code] + */ + function bbcode_code($stx, $in) + { + if (!$this->check_bbcode('code', $in)) + { + return $in; + } + + // We remove the hardcoded elements from the code block here because it is not used in code blocks + // Having it here saves us one preg_replace per message containing [code] blocks + // Additionally, magic url parsing should go after parsing bbcodes, but for safety those are stripped out too... + $htm_match = get_preg_expression('bbcode_htm'); + unset($htm_match[4], $htm_match[5]); + $htm_replace = array('\1', '\1', '\2', '\1'); + + $out = $code_block = ''; + $open = 1; + + while ($in) + { + // Determine position and tag length of next code block + preg_match('#(.*?)(\[code(?:=([a-z]+))?\])(.+)#is', $in, $buffer); + $pos = (isset($buffer[1])) ? strlen($buffer[1]) : false; + $tag_length = (isset($buffer[2])) ? strlen($buffer[2]) : false; + + // Determine position of ending code tag + $pos2 = stripos($in, '[/code]'); + + // Which is the next block, ending code or code block + if ($pos !== false && $pos < $pos2) + { + // Open new block + if (!$open) + { + $out .= substr($in, 0, $pos); + $in = substr($in, $pos); + $stx = (isset($buffer[3])) ? $buffer[3] : ''; + $code_block = ''; + } + else + { + // Already opened block, just append to the current block + $code_block .= substr($in, 0, $pos) . ((isset($buffer[2])) ? $buffer[2] : ''); + $in = substr($in, $pos); + } + + $in = substr($in, $tag_length); + $open++; + } + else + { + // Close the block + if ($open == 1) + { + $code_block .= substr($in, 0, $pos2); + $code_block = preg_replace($htm_match, $htm_replace, $code_block); + + // Parse this code block + $out .= $this->bbcode_parse_code($stx, $code_block); + $code_block = ''; + $open--; + } + else if ($open) + { + // Close one open tag... add to the current code block + $code_block .= substr($in, 0, $pos2 + 7); + $open--; + } + else + { + // end code without opening code... will be always outside code block + $out .= substr($in, 0, $pos2 + 7); + } + + $in = substr($in, $pos2 + 7); + } + } + + // if now $code_block has contents we need to parse the remaining code while removing the last closing tag to match up. + if ($code_block) + { + $code_block = substr($code_block, 0, -7); + $code_block = preg_replace($htm_match, $htm_replace, $code_block); + + $out .= $this->bbcode_parse_code($stx, $code_block); + } + + return $out; + } + + /** + * Parse list bbcode + * Expects the argument to start with a tag + */ + function bbcode_parse_list($in) + { + if (!$this->check_bbcode('list', $in)) + { + return $in; + } + + // $tok holds characters to stop at. Since the string starts with a '[' we'll get everything up to the first ']' which should be the opening [list] tag + $tok = ']'; + $out = '['; + + // First character is [ + $in = substr($in, 1); + $list_end_tags = $item_end_tags = array(); + + do + { + $pos = strlen($in); + + for ($i = 0, $tok_len = strlen($tok); $i < $tok_len; ++$i) + { + $tmp_pos = strpos($in, $tok[$i]); + + if ($tmp_pos !== false && $tmp_pos < $pos) + { + $pos = $tmp_pos; + } + } + + $buffer = substr($in, 0, $pos); + $tok = $in[$pos]; + + $in = substr($in, $pos + 1); + + if ($tok == ']') + { + // if $tok is ']' the buffer holds a tag + if (strtolower($buffer) == '/list' && count($list_end_tags)) + { + // valid [/list] tag, check nesting so that we don't hit false positives + if (count($item_end_tags) && count($item_end_tags) >= count($list_end_tags)) + { + // current li tag has not been closed + $out = preg_replace('/\n?\[$/', '[', $out) . array_pop($item_end_tags) . ']['; + } + + $out .= array_pop($list_end_tags) . ']'; + $tok = '['; + } + else if (preg_match('#^list(=[0-9a-z]+)?$#i', $buffer, $m)) + { + // sub-list, add a closing tag + if (empty($m[1]) || preg_match('/^=(?:disc|square|circle)$/i', $m[1])) + { + array_push($list_end_tags, '/list:u:' . $this->bbcode_uid); + } + else + { + array_push($list_end_tags, '/list:o:' . $this->bbcode_uid); + } + $out .= 'list' . substr($buffer, 4) . ':' . $this->bbcode_uid . ']'; + $tok = '['; + } + else + { + if (($buffer == '*' || substr($buffer, -2) == '[*') && count($list_end_tags)) + { + // the buffer holds a bullet tag and we have a [list] tag open + if (count($item_end_tags) >= count($list_end_tags)) + { + if (substr($buffer, -2) == '[*') + { + $out .= substr($buffer, 0, -2) . '['; + } + // current li tag has not been closed + if (preg_match('/\n\[$/', $out, $m)) + { + $out = preg_replace('/\n\[$/', '[', $out); + $buffer = array_pop($item_end_tags) . "]\n[*:" . $this->bbcode_uid; + } + else + { + $buffer = array_pop($item_end_tags) . '][*:' . $this->bbcode_uid; + } + } + else + { + $buffer = '*:' . $this->bbcode_uid; + } + + $item_end_tags[] = '/*:m:' . $this->bbcode_uid; + } + else if ($buffer == '/*') + { + array_pop($item_end_tags); + $buffer = '/*:' . $this->bbcode_uid; + } + + $out .= $buffer . $tok; + $tok = '[]'; + } + } + else + { + // Not within a tag, just add buffer to the return string + $out .= $buffer . $tok; + $tok = ($tok == '[') ? ']' : '[]'; + } + } + while ($in); + + // do we have some tags open? close them now + if (count($item_end_tags)) + { + $out .= '[' . implode('][', $item_end_tags) . ']'; + } + if (count($list_end_tags)) + { + $out .= '[' . implode('][', $list_end_tags) . ']'; + } + + return $out; + } + + /** + * Parse quote bbcode + * Expects the argument to start with a tag + */ + function bbcode_quote($in) + { + $in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in))); + + if (!$in) + { + return ''; + } + + // To let the parser not catch tokens within quote_username quotes we encode them before we start this... + $in = preg_replace_callback('#quote="(.*?)"\]#i', function ($match) { + return 'quote="' . str_replace(array('[', ']', '\\\"'), array('[', ']', '\"'), $match[1]) . '"]'; + }, $in); + + $tok = ']'; + $out = '['; + + $in = substr($in, 1); + $close_tags = $error_ary = array(); + $buffer = ''; + + do + { + $pos = strlen($in); + for ($i = 0, $tok_len = strlen($tok); $i < $tok_len; ++$i) + { + $tmp_pos = strpos($in, $tok[$i]); + if ($tmp_pos !== false && $tmp_pos < $pos) + { + $pos = $tmp_pos; + } + } + + $buffer .= substr($in, 0, $pos); + $tok = $in[$pos]; + $in = substr($in, $pos + 1); + + if ($tok == ']') + { + if (strtolower($buffer) == '/quote' && count($close_tags) && substr($out, -1, 1) == '[') + { + // we have found a closing tag + $out .= array_pop($close_tags) . ']'; + $tok = '['; + $buffer = ''; + + /* Add space at the end of the closing tag if not happened before to allow following urls/smilies to be parsed correctly + * Do not try to think for the user. :/ Do not parse urls/smilies if there is no space - is the same as with other bbcodes too. + * Also, we won't have any spaces within $in anyway, only adding up spaces -> #10982 + if (!$in || $in[0] !== ' ') + { + $out .= ' '; + }*/ + } + else if (preg_match('#^quote(?:="(.*?)")?$#is', $buffer, $m) && substr($out, -1, 1) == '[') + { + $this->parsed_items['quote']++; + array_push($close_tags, '/quote:' . $this->bbcode_uid); + + if (isset($m[1]) && $m[1]) + { + $username = str_replace(array('[', ']'), array('[', ']'), $m[1]); + $username = preg_replace('#\[(?!b|i|u|color|url|email|/b|/i|/u|/color|/url|/email)#iU', '[$1', $username); + + $end_tags = array(); + $error = false; + + preg_match_all('#\[((?:/)?(?:[a-z]+))#i', $username, $tags); + foreach ($tags[1] as $tag) + { + if ($tag[0] != '/') + { + $end_tags[] = '/' . $tag; + } + else + { + $end_tag = array_pop($end_tags); + $error = ($end_tag != $tag) ? true : false; + } + } + + if ($error) + { + $username = $m[1]; + } + + $out .= 'quote="' . $username . '":' . $this->bbcode_uid . ']'; + } + else + { + $out .= 'quote:' . $this->bbcode_uid . ']'; + } + + $tok = '['; + $buffer = ''; + } + else if (preg_match('#^quote="(.*?)#is', $buffer, $m)) + { + // the buffer holds an invalid opening tag + $buffer .= ']'; + } + else + { + $out .= $buffer . $tok; + $tok = '[]'; + $buffer = ''; + } + } + else + { +/** +* Old quote code working fine, but having errors listed in bug #3572 +* +* $out .= $buffer . $tok; +* $tok = ($tok == '[') ? ']' : '[]'; +* $buffer = ''; +*/ + + $out .= $buffer . $tok; + + if ($tok == '[') + { + // Search the text for the next tok... if an ending quote comes first, then change tok to [] + $pos1 = stripos($in, '[/quote'); + // If the token ] comes first, we change it to ] + $pos2 = strpos($in, ']'); + // If the token [ comes first, we change it to [ + $pos3 = strpos($in, '['); + + if ($pos1 !== false && ($pos2 === false || $pos1 < $pos2) && ($pos3 === false || $pos1 < $pos3)) + { + $tok = '[]'; + } + else if ($pos3 !== false && ($pos2 === false || $pos3 < $pos2)) + { + $tok = '['; + } + else + { + $tok = ']'; + } + } + else + { + $tok = '[]'; + } + $buffer = ''; + } + } + while ($in); + + $out .= $buffer; + + if (count($close_tags)) + { + $out .= '[' . implode('][', $close_tags) . ']'; + } + + foreach ($error_ary as $error_msg) + { + $this->warn_msg[] = $error_msg; + } + + return $out; + } + + /** + * Validate email + */ + function validate_email($var1, $var2) + { + $var1 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var1))); + $var2 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var2))); + + $txt = $var2; + $email = ($var1) ? $var1 : $var2; + + $validated = true; + + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email)) + { + $validated = false; + } + + if (!$validated) + { + return '[email' . (($var1) ? "=$var1" : '') . ']' . $var2 . '[/email]'; + } + + $this->parsed_items['email']++; + + if ($var1) + { + $retval = '[email=' . $this->bbcode_specialchars($email) . ':' . $this->bbcode_uid . ']' . $txt . '[/email:' . $this->bbcode_uid . ']'; + } + else + { + $retval = '[email:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($email) . '[/email:' . $this->bbcode_uid . ']'; + } + + return $retval; + } + + /** + * Validate url + * + * @param string $var1 optional url parameter for url bbcode: [url(=$var1)]$var2[/url] + * @param string $var2 url bbcode content: [url(=$var1)]$var2[/url] + */ + function validate_url($var1, $var2) + { + $var1 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var1))); + $var2 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var2))); + + $url = ($var1) ? $var1 : $var2; + + if ($var1 && !$var2) + { + $var2 = $var1; + } + + if (!$url) + { + return '[url' . (($var1) ? '=' . $var1 : '') . ']' . $var2 . '[/url]'; + } + + $valid = false; + + $url = str_replace(' ', '%20', $url); + + // Checking urls + if (preg_match('#^' . get_preg_expression('url') . '$#iu', $url) || + preg_match('#^' . get_preg_expression('www_url') . '$#iu', $url) || + preg_match('#^' . preg_quote(generate_board_url(), '#') . get_preg_expression('relative_url') . '$#iu', $url)) + { + $valid = true; + } + + if ($valid) + { + $this->parsed_items['url']++; + + // if there is no scheme, then add http schema + if (!preg_match('#^[a-z][a-z\d+\-.]*:/{2}#i', $url)) + { + $url = 'http://' . $url; + } + + // Is this a link to somewhere inside this board? If so then remove the session id from the url + if (strpos($url, generate_board_url()) !== false && strpos($url, 'sid=') !== false) + { + $url = preg_replace('/(&|\?)sid=[0-9a-f]{32}&/', '\1', $url); + $url = preg_replace('/(&|\?)sid=[0-9a-f]{32}$/', '', $url); + $url = append_sid($url); + } + + return ($var1) ? '[url=' . $this->bbcode_specialchars($url) . ':' . $this->bbcode_uid . ']' . $var2 . '[/url:' . $this->bbcode_uid . ']' : '[url:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($url) . '[/url:' . $this->bbcode_uid . ']'; + } + + return '[url' . (($var1) ? '=' . $var1 : '') . ']' . $var2 . '[/url]'; + } + + /** + * Check if url is pointing to this domain/script_path/php-file + * + * @param string $url the url to check + * @return true if the url is pointing to this domain/script_path/php-file, false if not + * + * @access private + */ + function path_in_domain($url) + { + global $config, $phpEx, $user; + + if ($config['force_server_vars']) + { + $check_path = !empty($config['script_path']) ? $config['script_path'] : '/'; + } + else + { + $check_path = ($user->page['root_script_path'] != '/') ? substr($user->page['root_script_path'], 0, -1) : '/'; + } + + // Is the user trying to link to a php file in this domain and script path? + if (strpos($url, ".{$phpEx}") !== false && strpos($url, $check_path) !== false) + { + $server_name = $user->host; + + // Forcing server vars is the only way to specify/override the protocol + if ($config['force_server_vars'] || !$server_name) + { + $server_name = $config['server_name']; + } + + // Check again in correct order... + $pos_ext = strpos($url, ".{$phpEx}"); + $pos_path = strpos($url, $check_path); + $pos_domain = strpos($url, $server_name); + + if ($pos_domain !== false && $pos_path >= $pos_domain && $pos_ext >= $pos_path) + { + // Ok, actually we allow linking to some files (this may be able to be extended in some way later...) + if (strpos($url, '/' . $check_path . '/download/file.' . $phpEx) !== 0) + { + return false; + } + + return true; + } + } + + return false; + } +} + +/** +* Main message parser for posting, pm, etc. takes raw message +* and parses it for attachments, bbcode and smilies +*/ +class parse_message extends bbcode_firstpass +{ + var $attachment_data = array(); + var $filename_data = array(); + + // Helps ironing out user error + var $message_status = ''; + + var $allow_img_bbcode = true; + var $allow_flash_bbcode = true; + var $allow_quote_bbcode = true; + var $allow_url_bbcode = true; + + /** + * The plupload object used for dealing with attachments + * @var \phpbb\plupload\plupload + */ + protected $plupload; + + /** + * Init - give message here or manually + */ + function __construct($message = '') + { + // Init BBCode UID + $this->bbcode_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN); + $this->message = $message; + } + + /** + * Parse Message + */ + function parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post') + { + global $config, $user, $phpbb_dispatcher, $phpbb_container; + + $this->mode = $mode; + + foreach (array('chars', 'smilies', 'urls', 'font_size', 'img_height', 'img_width') as $key) + { + if (!isset($config['max_' . $mode . '_' . $key])) + { + $config['max_' . $mode . '_' . $key] = 0; + } + } + + $this->allow_img_bbcode = $allow_img_bbcode; + $this->allow_flash_bbcode = $allow_flash_bbcode; + $this->allow_quote_bbcode = $allow_quote_bbcode; + $this->allow_url_bbcode = $allow_url_bbcode; + + // If false, then $this->message won't be altered, the text will be returned instead. + if (!$update_this_message) + { + $tmp_message = $this->message; + $return_message = &$this->message; + } + + if ($this->message_status == 'display') + { + $this->decode_message(); + } + + // Store message length... + $message_length = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message)); + + // Maximum message length check. 0 disables this check completely. + if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars']) + { + $this->warn_msg[] = $user->lang('CHARS_' . strtoupper($mode) . '_CONTAINS', $message_length) . '
' . $user->lang('TOO_MANY_CHARS_LIMIT', (int) $config['max_' . $mode . '_chars']); + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + + // Minimum message length check for post only + if ($mode === 'post') + { + if (!$message_length || $message_length < (int) $config['min_post_chars']) + { + $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : ($user->lang('CHARS_POST_CONTAINS', $message_length) . '
' . $user->lang('TOO_FEW_CHARS_LIMIT', (int) $config['min_post_chars'])); + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + } + + /** + * This event can be used for additional message checks/cleanup before parsing + * + * @event core.message_parser_check_message + * @var bool allow_bbcode Do we allow BBCodes + * @var bool allow_magic_url Do we allow magic urls + * @var bool allow_smilies Do we allow smilies + * @var bool allow_img_bbcode Do we allow image BBCode + * @var bool allow_flash_bbcode Do we allow flash BBCode + * @var bool allow_quote_bbcode Do we allow quote BBCode + * @var bool allow_url_bbcode Do we allow url BBCode + * @var bool update_this_message Do we alter the parsed message + * @var string mode Posting mode + * @var string message The message text to parse + * @var string bbcode_bitfield The bbcode_bitfield before parsing + * @var string bbcode_uid The bbcode_uid before parsing + * @var bool return Do we return after the event is triggered if $warn_msg is not empty + * @var array warn_msg Array of the warning messages + * @since 3.1.2-RC1 + * @changed 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid + */ + $message = $this->message; + $warn_msg = $this->warn_msg; + $return = false; + $bbcode_bitfield = $this->bbcode_bitfield; + $bbcode_uid = $this->bbcode_uid; + $vars = array( + 'allow_bbcode', + 'allow_magic_url', + 'allow_smilies', + 'allow_img_bbcode', + 'allow_flash_bbcode', + 'allow_quote_bbcode', + 'allow_url_bbcode', + 'update_this_message', + 'mode', + 'message', + 'bbcode_bitfield', + 'bbcode_uid', + 'return', + 'warn_msg', + ); + extract($phpbb_dispatcher->trigger_event('core.message_parser_check_message', compact($vars))); + $this->message = $message; + $this->warn_msg = $warn_msg; + $this->bbcode_bitfield = $bbcode_bitfield; + $this->bbcode_uid = $bbcode_uid; + if ($return && !empty($this->warn_msg)) + { + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + + // Get the parser + $parser = $phpbb_container->get('text_formatter.parser'); + + // Set the parser's options + ($allow_bbcode) ? $parser->enable_bbcodes() : $parser->disable_bbcodes(); + ($allow_magic_url) ? $parser->enable_magic_url() : $parser->disable_magic_url(); + ($allow_smilies) ? $parser->enable_smilies() : $parser->disable_smilies(); + ($allow_img_bbcode) ? $parser->enable_bbcode('img') : $parser->disable_bbcode('img'); + ($allow_flash_bbcode) ? $parser->enable_bbcode('flash') : $parser->disable_bbcode('flash'); + ($allow_quote_bbcode) ? $parser->enable_bbcode('quote') : $parser->disable_bbcode('quote'); + ($allow_url_bbcode) ? $parser->enable_bbcode('url') : $parser->disable_bbcode('url'); + + // Set some config values + $parser->set_vars(array( + 'max_font_size' => $config['max_' . $this->mode . '_font_size'], + 'max_img_height' => $config['max_' . $this->mode . '_img_height'], + 'max_img_width' => $config['max_' . $this->mode . '_img_width'], + 'max_smilies' => $config['max_' . $this->mode . '_smilies'], + 'max_urls' => $config['max_' . $this->mode . '_urls'] + )); + + // Parse this message + $this->message = $parser->parse(htmlspecialchars_decode($this->message, ENT_QUOTES)); + + // Remove quotes that are nested too deep + if ($config['max_quote_depth'] > 0) + { + $this->remove_nested_quotes($config['max_quote_depth']); + } + + // Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length. + // The maximum length check happened before any parsings. + if ($mode === 'post' && utf8_clean_string($this->message) === '') + { + $this->warn_msg[] = $user->lang['TOO_FEW_CHARS']; + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + + // Remove quotes that are nested too deep + if ($config['max_quote_depth'] > 0) + { + $this->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode( + $this->message, + 'quote', + $config['max_quote_depth'] + ); + } + + // Check for errors + $errors = $parser->get_errors(); + if ($errors) + { + foreach ($errors as $i => $args) + { + // Translate each error with $user->lang() + $errors[$i] = call_user_func_array(array($user, 'lang'), $args); + } + $this->warn_msg = array_merge($this->warn_msg, $errors); + + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + + if (!$update_this_message) + { + unset($this->message); + $this->message = $tmp_message; + return $return_message; + } + + $this->message_status = 'parsed'; + return false; + } + + /** + * Formatting text for display + */ + function format_display($allow_bbcode, $allow_magic_url, $allow_smilies, $update_this_message = true) + { + global $phpbb_container, $phpbb_dispatcher; + + // If false, then the parsed message get returned but internal message not processed. + if (!$update_this_message) + { + $tmp_message = $this->message; + $return_message = &$this->message; + } + + $text = $this->message; + $uid = $this->bbcode_uid; + + /** + * Event to modify the text before it is parsed + * + * @event core.modify_format_display_text_before + * @var string text The message text to parse + * @var string uid The bbcode uid + * @var bool allow_bbcode Do we allow bbcodes + * @var bool allow_magic_url Do we allow magic urls + * @var bool allow_smilies Do we allow smilies + * @var bool update_this_message Do we update the internal message + * with the parsed result + * @since 3.1.6-RC1 + */ + $vars = array('text', 'uid', 'allow_bbcode', 'allow_magic_url', 'allow_smilies', 'update_this_message'); + extract($phpbb_dispatcher->trigger_event('core.modify_format_display_text_before', compact($vars))); + + $this->message = $text; + $this->bbcode_uid = $uid; + unset($text, $uid); + + // NOTE: message_status is unreliable for detecting unparsed text because some callers + // change $this->message without resetting $this->message_status to 'plain' so we + // inspect the message instead + //if ($this->message_status == 'plain') + if (!preg_match('/^<[rt][ >]/', $this->message)) + { + // Force updating message - of course. + $this->parse($allow_bbcode, $allow_magic_url, $allow_smilies, $this->allow_img_bbcode, $this->allow_flash_bbcode, $this->allow_quote_bbcode, $this->allow_url_bbcode, true); + } + + // There's a bug when previewing a topic with no poll, because the empty title of the poll + // gets parsed but $this->message still ends up empty. This fixes it, until a proper fix is + // devised + if ($this->message === '') + { + $this->message = $phpbb_container->get('text_formatter.parser')->parse($this->message); + } + + $this->message = $phpbb_container->get('text_formatter.renderer')->render($this->message); + + $text = $this->message; + $uid = $this->bbcode_uid; + + /** + * Event to modify the text after it is parsed + * + * @event core.modify_format_display_text_after + * @var string text The message text to parse + * @var string uid The bbcode uid + * @var bool allow_bbcode Do we allow bbcodes + * @var bool allow_magic_url Do we allow magic urls + * @var bool allow_smilies Do we allow smilies + * @var bool update_this_message Do we update the internal message + * with the parsed result + * @since 3.1.0-a3 + */ + $vars = array('text', 'uid', 'allow_bbcode', 'allow_magic_url', 'allow_smilies', 'update_this_message'); + extract($phpbb_dispatcher->trigger_event('core.modify_format_display_text_after', compact($vars))); + + $this->message = $text; + $this->bbcode_uid = $uid; + + if (!$update_this_message) + { + unset($this->message); + $this->message = $tmp_message; + return $return_message; + } + + $this->message_status = 'display'; + return false; + } + + /** + * Decode message to be placed back into form box + */ + function decode_message($custom_bbcode_uid = '', $update_this_message = true) + { + // If false, then the parsed message get returned but internal message not processed. + if (!$update_this_message) + { + $tmp_message = $this->message; + $return_message = &$this->message; + } + + ($custom_bbcode_uid) ? decode_message($this->message, $custom_bbcode_uid) : decode_message($this->message, $this->bbcode_uid); + + if (!$update_this_message) + { + unset($this->message); + $this->message = $tmp_message; + return $return_message; + } + + $this->message_status = 'plain'; + return false; + } + + /** + * Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx. + * Cuts down displayed size of link if over 50 chars, turns absolute links + * into relative versions when the server/script path matches the link + */ + function magic_url($server_url) + { + // We use the global make_clickable function + $this->message = make_clickable($this->message, $server_url); + } + + /** + * Parse Smilies + */ + function smilies($max_smilies = 0) + { + global $db, $user; + static $match; + static $replace; + + // See if the static arrays have already been filled on an earlier invocation + if (!is_array($match)) + { + $match = $replace = array(); + + // NOTE: obtain_* function? chaching the table contents? + + // For now setting the ttl to 10 minutes + switch ($db->get_sql_layer()) + { + case 'mssql_odbc': + case 'mssqlnative': + $sql = 'SELECT * + FROM ' . SMILIES_TABLE . ' + ORDER BY LEN(code) DESC'; + break; + + // LENGTH supported by MySQL, IBM DB2, Oracle and Access for sure... + default: + $sql = 'SELECT * + FROM ' . SMILIES_TABLE . ' + ORDER BY LENGTH(code) DESC'; + break; + } + $result = $db->sql_query($sql, 600); + + while ($row = $db->sql_fetchrow($result)) + { + if (empty($row['code'])) + { + continue; + } + + // (assertion) + $match[] = preg_quote($row['code'], '#'); + $replace[] = '' . $row['code'] . ''; + } + $db->sql_freeresult($result); + } + + if (count($match)) + { + if ($max_smilies) + { + // 'u' modifier has been added to correctly parse smilies within unicode strings + // For details: http://tracker.phpbb.com/browse/PHPBB3-10117 + $num_matches = preg_match_all('#(?<=^|[\n .])(?:' . implode('|', $match) . ')(?![^<>]*>)#u', $this->message, $matches); + unset($matches); + + if ($num_matches !== false && $num_matches > $max_smilies) + { + $this->warn_msg[] = sprintf($user->lang['TOO_MANY_SMILIES'], $max_smilies); + return; + } + } + + // Make sure the delimiter # is added in front and at the end of every element within $match + // 'u' modifier has been added to correctly parse smilies within unicode strings + // For details: http://tracker.phpbb.com/browse/PHPBB3-10117 + + $this->message = trim(preg_replace(explode(chr(0), '#(?<=^|[\n .])' . implode('(?![^<>]*>)#u' . chr(0) . '#(?<=^|[\n .])', $match) . '(?![^<>]*>)#u'), $replace, $this->message)); + } + } + + /** + * Check attachment form token depending on submit type + * + * @param \phpbb\language\language $language Language + * @param \phpbb\request\request_interface $request Request + * @param string $form_name Form name for checking form key + * + * @return bool True if form token is not needed or valid, false if needed and invalid + */ + function check_attachment_form_token(\phpbb\language\language $language, \phpbb\request\request_interface $request, $form_name) + { + $add_file = $request->is_set_post('add_file'); + $delete_file = $request->is_set_post('delete_file'); + + if (($add_file || $delete_file) && !check_form_key($form_name)) + { + $this->warn_msg[] = $language->lang('FORM_INVALID'); + + if ($request->is_ajax() && $this->plupload) + { + $this->plupload->emit_error(-400, 'FORM_INVALID'); + } + + return false; + } + + return true; + } + + /** + * Parse Attachments + */ + function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) + { + global $config, $auth, $user, $phpbb_root_path, $phpEx, $db, $request; + global $phpbb_container, $phpbb_dispatcher; + + $error = array(); + + $num_attachments = count($this->attachment_data); + $this->filename_data['filecomment'] = $request->variable('filecomment', '', true); + $upload = $request->file($form_name); + $upload_file = (!empty($upload) && $upload['name'] !== 'none' && trim($upload['name'])); + + $add_file = (isset($_POST['add_file'])) ? true : false; + $delete_file = (isset($_POST['delete_file'])) ? true : false; + + // First of all adjust comments if changed + $actual_comment_list = $request->variable('comment_list', array(''), true); + + foreach ($actual_comment_list as $comment_key => $comment) + { + if (!isset($this->attachment_data[$comment_key])) + { + continue; + } + + if ($this->attachment_data[$comment_key]['attach_comment'] != $actual_comment_list[$comment_key]) + { + $this->attachment_data[$comment_key]['attach_comment'] = $actual_comment_list[$comment_key]; + } + } + + $cfg = array(); + $cfg['max_attachments'] = ($is_message) ? $config['max_attachments_pm'] : $config['max_attachments']; + $forum_id = ($is_message) ? 0 : $forum_id; + + if ($submit && in_array($mode, array('post', 'reply', 'quote', 'edit')) && $upload_file) + { + if ($num_attachments < $cfg['max_attachments'] || $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) + { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message); + $error = $filedata['error']; + + if ($filedata['post_attach'] && !count($error)) + { + $sql_ary = array( + 'physical_filename' => $filedata['physical_filename'], + 'attach_comment' => $this->filename_data['filecomment'], + 'real_filename' => $filedata['real_filename'], + 'extension' => $filedata['extension'], + 'mimetype' => $filedata['mimetype'], + 'filesize' => $filedata['filesize'], + 'filetime' => $filedata['filetime'], + 'thumbnail' => $filedata['thumbnail'], + 'is_orphan' => 1, + 'in_message' => ($is_message) ? 1 : 0, + 'poster_id' => $user->data['user_id'], + ); + + /** + * Modify attachment sql array on submit + * + * @event core.modify_attachment_sql_ary_on_submit + * @var array sql_ary Array containing SQL data + * @since 3.2.6-RC1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.modify_attachment_sql_ary_on_submit', compact($vars))); + + $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $new_entry = array( + 'attach_id' => $db->sql_nextid(), + 'is_orphan' => 1, + 'real_filename' => $filedata['real_filename'], + 'attach_comment'=> $this->filename_data['filecomment'], + 'filesize' => $filedata['filesize'], + ); + + $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); + + /** + * Modify attachment data on submit + * + * @event core.modify_attachment_data_on_submit + * @var array attachment_data Array containing attachment data + * @since 3.2.2-RC1 + */ + $attachment_data = $this->attachment_data; + $vars = array('attachment_data'); + extract($phpbb_dispatcher->trigger_event('core.modify_attachment_data_on_submit', compact($vars))); + $this->attachment_data = $attachment_data; + unset($attachment_data); + + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) { + return '[attachment='.($match[1] + 1).']' . $match[2] . '[/attachment]'; + }, $this->message); + + $this->filename_data['filecomment'] = ''; + + // This Variable is set to false here, because Attachments are entered into the + // Database in two modes, one if the id_list is 0 and the second one if post_attach is true + // Since post_attach is automatically switched to true if an Attachment got added to the filesystem, + // but we are assigning an id of 0 here, we have to reset the post_attach variable to false. + // + // This is very relevant, because it could happen that the post got not submitted, but we do not + // know this circumstance here. We could be at the posting page or we could be redirected to the entered + // post. :) + $filedata['post_attach'] = false; + } + } + else + { + $error[] = $user->lang('TOO_MANY_ATTACHMENTS', (int) $cfg['max_attachments']); + } + } + + if ($preview || $refresh || count($error)) + { + if (isset($this->plupload) && $this->plupload->is_active()) + { + $json_response = new \phpbb\json_response(); + } + + // Perform actions on temporary attachments + if ($delete_file) + { + include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + + $index = array_keys($request->variable('delete_file', array(0 => 0))); + $index = (!empty($index)) ? $index[0] : false; + + if ($index !== false && !empty($this->attachment_data[$index])) + { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + + // delete selected attachment + if ($this->attachment_data[$index]['is_orphan']) + { + $sql = 'SELECT attach_id, physical_filename, thumbnail + FROM ' . ATTACHMENTS_TABLE . ' + WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id'] . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $attachment_manager->unlink($row['physical_filename'], 'file'); + + if ($row['thumbnail']) + { + $attachment_manager->unlink($row['physical_filename'], 'thumbnail'); + } + + $db->sql_query('DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id']); + } + } + else + { + $attachment_manager->delete('attach', $this->attachment_data[$index]['attach_id']); + } + + unset($this->attachment_data[$index]); + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) use($index) { + return ($match[1] == $index) ? '' : (($match[1] > $index) ? '[attachment=' . ($match[1] - 1) . ']' . $match[2] . '[/attachment]' : $match[0]); + }, $this->message); + + // Reindex Array + $this->attachment_data = array_values($this->attachment_data); + if (isset($this->plupload) && $this->plupload->is_active()) + { + $json_response->send($this->attachment_data); + } + } + } + else if (($add_file || $preview) && $upload_file) + { + if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_', $forum_id)) + { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message); + $error = array_merge($error, $filedata['error']); + + if (!count($error)) + { + $sql_ary = array( + 'physical_filename' => $filedata['physical_filename'], + 'attach_comment' => $this->filename_data['filecomment'], + 'real_filename' => $filedata['real_filename'], + 'extension' => $filedata['extension'], + 'mimetype' => $filedata['mimetype'], + 'filesize' => $filedata['filesize'], + 'filetime' => $filedata['filetime'], + 'thumbnail' => $filedata['thumbnail'], + 'is_orphan' => 1, + 'in_message' => ($is_message) ? 1 : 0, + 'poster_id' => $user->data['user_id'], + ); + + /** + * Modify attachment sql array on upload + * + * @event core.modify_attachment_sql_ary_on_upload + * @var array sql_ary Array containing SQL data + * @since 3.2.6-RC1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.modify_attachment_sql_ary_on_upload', compact($vars))); + + $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $new_entry = array( + 'attach_id' => $db->sql_nextid(), + 'is_orphan' => 1, + 'real_filename' => $filedata['real_filename'], + 'attach_comment'=> $this->filename_data['filecomment'], + 'filesize' => $filedata['filesize'], + ); + + $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); + + /** + * Modify attachment data on upload + * + * @event core.modify_attachment_data_on_upload + * @var array attachment_data Array containing attachment data + * @since 3.2.2-RC1 + */ + $attachment_data = $this->attachment_data; + $vars = array('attachment_data'); + extract($phpbb_dispatcher->trigger_event('core.modify_attachment_data_on_upload', compact($vars))); + $this->attachment_data = $attachment_data; + unset($attachment_data); + + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) { + return '[attachment=' . ($match[1] + 1) . ']' . $match[2] . '[/attachment]'; + }, $this->message); + $this->filename_data['filecomment'] = ''; + + if (isset($this->plupload) && $this->plupload->is_active()) + { + $download_url = append_sid("{$phpbb_root_path}download/file.{$phpEx}", 'mode=view&id=' . $new_entry['attach_id']); + + // Send the client the attachment data to maintain state + $json_response->send(array('data' => $this->attachment_data, 'download_url' => $download_url)); + } + } + } + else + { + $error[] = $user->lang('TOO_MANY_ATTACHMENTS', (int) $cfg['max_attachments']); + } + + if (!empty($error) && isset($this->plupload) && $this->plupload->is_active()) + { + // If this is a plupload (and thus ajax) request, give the + // client the first error we have + $json_response->send(array( + 'jsonrpc' => '2.0', + 'id' => 'id', + 'error' => array( + 'code' => 105, + 'message' => current($error), + ), + )); + } + } + } + + foreach ($error as $error_msg) + { + $this->warn_msg[] = $error_msg; + } + } + + /** + * Get Attachment Data + */ + function get_submitted_attachment_data($check_user_id = false) + { + global $user, $db; + global $request; + + $this->filename_data['filecomment'] = $request->variable('filecomment', '', true); + $attachment_data = $request->variable('attachment_data', array(0 => array('' => '')), true, \phpbb\request\request_interface::POST); + $this->attachment_data = array(); + + $check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id; + + if (!count($attachment_data)) + { + return; + } + + $not_orphan = $orphan = array(); + + foreach ($attachment_data as $pos => $var_ary) + { + if ($var_ary['is_orphan']) + { + $orphan[(int) $var_ary['attach_id']] = $pos; + } + else + { + $not_orphan[(int) $var_ary['attach_id']] = $pos; + } + } + + // Regenerate already posted attachments + if (count($not_orphan)) + { + // Get the attachment data, based on the poster id... + $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($not_orphan)) . ' + AND poster_id = ' . $check_user_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $pos = $not_orphan[$row['attach_id']]; + $this->attachment_data[$pos] = $row; + $this->attachment_data[$pos]['attach_comment'] = $attachment_data[$pos]['attach_comment']; + + unset($not_orphan[$row['attach_id']]); + } + $db->sql_freeresult($result); + } + + if (count($not_orphan)) + { + trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR); + } + + // Regenerate newly uploaded attachments + if (count($orphan)) + { + $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan)) . ' + AND poster_id = ' . $user->data['user_id'] . ' + AND is_orphan = 1'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $pos = $orphan[$row['attach_id']]; + $this->attachment_data[$pos] = $row; + $this->attachment_data[$pos]['attach_comment'] = $attachment_data[$pos]['attach_comment']; + + unset($orphan[$row['attach_id']]); + } + $db->sql_freeresult($result); + } + + if (count($orphan)) + { + trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR); + } + + ksort($this->attachment_data); + } + + /** + * Parse Poll + */ + function parse_poll(&$poll) + { + global $user, $config; + + $poll_max_options = $poll['poll_max_options']; + + // Parse Poll Option text + $tmp_message = $this->message; + + $poll['poll_options'] = preg_split('/\s*?\n\s*/', trim($poll['poll_option_text'])); + $poll['poll_options_size'] = count($poll['poll_options']); + + foreach ($poll['poll_options'] as &$poll_option) + { + $this->message = $poll_option; + $poll_option = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll'); + } + unset($poll_option); + $poll['poll_option_text'] = implode("\n", $poll['poll_options']); + + // Parse Poll Title + $this->message = $poll['poll_title']; + if (!$poll['poll_title'] && $poll['poll_options_size']) + { + $this->warn_msg[] = $user->lang['NO_POLL_TITLE']; + } + else + { + if (utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message)) > 100) + { + $this->warn_msg[] = $user->lang['POLL_TITLE_TOO_LONG']; + } + $poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll'); + if (strlen($poll['poll_title']) > 255) + { + $this->warn_msg[] = $user->lang['POLL_TITLE_COMP_TOO_LONG']; + } + } + + if (count($poll['poll_options']) == 1) + { + $this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS']; + } + else if ($poll['poll_options_size'] > (int) $config['max_poll_options']) + { + $this->warn_msg[] = $user->lang['TOO_MANY_POLL_OPTIONS']; + } + else if ($poll_max_options > $poll['poll_options_size']) + { + $this->warn_msg[] = $user->lang['TOO_MANY_USER_OPTIONS']; + } + + $poll['poll_max_options'] = ($poll['poll_max_options'] < 1) ? 1 : (($poll['poll_max_options'] > $config['max_poll_options']) ? $config['max_poll_options'] : $poll['poll_max_options']); + + $this->message = $tmp_message; + } + + /** + * Remove nested quotes at given depth in current parsed message + * + * @param integer $max_depth Depth limit + * @return null + */ + public function remove_nested_quotes($max_depth) + { + global $phpbb_container; + + if (preg_match('#^<[rt][ >]#', $this->message)) + { + $this->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode( + $this->message, + 'quote', + $max_depth + ); + + return; + } + + // Capture all [quote] and [/quote] tags + preg_match_all('(\\[/?quote(?:="(.*?)")?:' . $this->bbcode_uid . '\\])', $this->message, $matches, PREG_OFFSET_CAPTURE); + + // Iterate over the quote tags to mark the ranges that must be removed + $depth = 0; + $ranges = array(); + $start_pos = 0; + foreach ($matches[0] as $match) + { + if ($match[0][1] === '/') + { + --$depth; + if ($depth == $max_depth) + { + $end_pos = $match[1] + strlen($match[0]); + $length = $end_pos - $start_pos; + $ranges[] = array($start_pos, $length); + } + } + else + { + ++$depth; + if ($depth == $max_depth + 1) + { + $start_pos = $match[1]; + } + } + } + + foreach (array_reverse($ranges) as $range) + { + list($start_pos, $length) = $range; + $this->message = substr_replace($this->message, '', $start_pos, $length); + } + } + + /** + * Setter function for passing the plupload object + * + * @param \phpbb\plupload\plupload $plupload The plupload object + * + * @return null + */ + public function set_plupload(\phpbb\plupload\plupload $plupload) + { + $this->plupload = $plupload; + } + + /** + * Function to perform custom bbcode validation by extensions + * can be used in bbcode_init() to assign regexp replacement + * Example: 'regexp' => array('#\[b\](.*?)\[/b\]#uise' => "\$this->validate_bbcode_by_extension('\$1')") + * + * Accepts variable number of parameters + * + * @return mixed Validation result + */ + public function validate_bbcode_by_extension() + { + global $phpbb_dispatcher; + + $return = false; + $params_array = func_get_args(); + + /** + * Event to validate bbcode with the custom validating methods + * provided by extensions + * + * @event core.validate_bbcode_by_extension + * @var array params_array Array with the function parameters + * @var mixed return Validation result to return + * + * @since 3.1.5-RC1 + */ + $vars = array('params_array', 'return'); + extract($phpbb_dispatcher->trigger_event('core.validate_bbcode_by_extension', compact($vars))); + + return $return; + } +} diff --git a/install/update/new/includes/questionnaire/questionnaire.php b/install/update/new/includes/questionnaire/questionnaire.php new file mode 100644 index 0000000..ec2e6fe --- /dev/null +++ b/install/update/new/includes/questionnaire/questionnaire.php @@ -0,0 +1,497 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* This class collects data which is used to create some usage statistics. +* +* The collected data is - after authorization of the administrator - submitted +* to a central server. For privacy reasons we try to collect only data which aren't private +* or don't give any information which might help to identify the user. +* +* @author Johannes Schlueter +* @copyright (c) 2007-2008 Johannes Schlueter +*/ +class phpbb_questionnaire_data_collector +{ + var $providers; + var $data = null; + var $install_id = ''; + + /** + * Constructor. + * + * @param string + */ + function __construct($install_id) + { + $this->install_id = $install_id; + $this->providers = array(); + } + + function add_data_provider($provider) + { + $this->providers[] = $provider; + } + + /** + * Get data as an array. + * + * @return array All Data + */ + function get_data_raw() + { + if (!$this->data) + { + $this->collect(); + } + + return $this->data; + } + + function get_data_for_form() + { + return base64_encode(json_encode($this->get_data_raw())); + } + + /** + * Collect info into the data property. + * + * @return null + */ + function collect() + { + foreach (array_keys($this->providers) as $key) + { + $provider = $this->providers[$key]; + $this->data[$provider->get_identifier()] = $provider->get_data(); + } + $this->data['install_id'] = $this->install_id; + } +} + +/** interface: get_indentifier(), get_data() */ + +/** +* Questionnaire PHP data provider +*/ +class phpbb_questionnaire_php_data_provider +{ + function get_identifier() + { + return 'PHP'; + } + + /** + * Get data about the PHP runtime setup. + * + * @return array + */ + function get_data() + { + return array( + 'version' => PHP_VERSION, + 'sapi' => PHP_SAPI, + 'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '', + 'open_basedir' => (int) @ini_get('open_basedir'), + 'memory_limit' => @ini_get('memory_limit'), + 'allow_url_fopen' => (int) @ini_get('allow_url_fopen'), + 'allow_url_include' => (int) @ini_get('allow_url_include'), + 'file_uploads' => (int) @ini_get('file_uploads'), + 'upload_max_filesize' => @ini_get('upload_max_filesize'), + 'post_max_size' => @ini_get('post_max_size'), + 'disable_functions' => @ini_get('disable_functions'), + 'disable_classes' => @ini_get('disable_classes'), + 'enable_dl' => (int) @ini_get('enable_dl'), + 'filter.default' => @ini_get('filter.default'), + 'zend.ze1_compatibility_mode' => (int) @ini_get('zend.ze1_compatibility_mode'), + 'unicode.semantics' => (int) @ini_get('unicode.semantics'), + 'zend_thread_safty' => (int) function_exists('zend_thread_id'), + 'extensions' => implode(',', get_loaded_extensions()), + ); + } +} + +/** +* Questionnaire System data provider +*/ +class phpbb_questionnaire_system_data_provider +{ + function get_identifier() + { + return 'System'; + } + + /** + * Get data about the general system information, like OS or IP (shortened). + * + * @return array + */ + function get_data() + { + global $request; + + // Start discovering the IPV4 server address, if available + // Try apache, IIS, fall back to 0.0.0.0 + $server_address = htmlspecialchars_decode($request->server('SERVER_ADDR', $request->server('LOCAL_ADDR', '0.0.0.0'))); + + return array( + 'os' => PHP_OS, + 'httpd' => htmlspecialchars_decode($request->server('SERVER_SOFTWARE')), + // we don't want the real IP address (for privacy policy reasons) but only + // a network address to see whether your installation is running on a private or public network. + 'private_ip' => $this->is_private_ip($server_address), + 'ipv6' => strpos($server_address, ':') !== false, + ); + } + + /** + * Checks whether the given IP is in a private network. + * + * @param string $ip IP in v4 dot-decimal or v6 hex format + * @return bool true if the IP is from a private network, else false + */ + function is_private_ip($ip) + { + // IPv4 + if (strpos($ip, ':') === false) + { + $ip_address_ary = explode('.', $ip); + + // build ip + if (!isset($ip_address_ary[0]) || !isset($ip_address_ary[1])) + { + $ip_address_ary = explode('.', '0.0.0.0'); + } + + // IANA reserved addresses for private networks (RFC 1918) are: + // - 10.0.0.0/8 + // - 172.16.0.0/12 + // - 192.168.0.0/16 + if ($ip_address_ary[0] == '10' || + ($ip_address_ary[0] == '172' && intval($ip_address_ary[1]) > 15 && intval($ip_address_ary[1]) < 32) || + ($ip_address_ary[0] == '192' && $ip_address_ary[1] == '168')) + { + return true; + } + } + // IPv6 + else + { + // unique local unicast + $prefix = substr($ip, 0, 2); + if ($prefix == 'fc' || $prefix == 'fd') + { + return true; + } + } + + return false; + } +} + +/** +* Questionnaire phpBB data provider +*/ +class phpbb_questionnaire_phpbb_data_provider +{ + var $config; + var $unique_id; + + /** + * Constructor. + * + * @param array $config + */ + function __construct($config) + { + // generate a unique id if necessary + if (empty($config['questionnaire_unique_id'])) + { + $this->unique_id = unique_id(); + $config->set('questionnaire_unique_id', $this->unique_id); + } + else + { + $this->unique_id = $config['questionnaire_unique_id']; + } + + $this->config = $config; + } + + /** + * Returns a string identifier for this data provider + * + * @return string "phpBB" + */ + function get_identifier() + { + return 'phpBB'; + } + + /** + * Get data about this phpBB installation. + * + * @return array Relevant anonymous config options + */ + function get_data() + { + global $phpbb_config_php_file; + + extract($phpbb_config_php_file->get_all()); + unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution + + $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); + + // Only send certain config vars + $config_vars = array( + 'active_sessions' => true, + 'allow_attachments' => true, + 'allow_autologin' => true, + 'allow_avatar' => true, + 'allow_avatar_local' => true, + 'allow_avatar_remote' => true, + 'allow_avatar_upload' => true, + 'allow_bbcode' => true, + 'allow_birthdays' => true, + 'allow_bookmarks' => true, + 'allow_emailreuse' => true, + 'allow_forum_notify' => true, + 'allow_mass_pm' => true, + 'allow_name_chars' => true, + 'allow_namechange' => true, + 'allow_nocensors' => true, + 'allow_pm_attach' => true, + 'allow_pm_report' => true, + 'allow_post_flash' => true, + 'allow_post_links' => true, + 'allow_privmsg' => true, + 'allow_quick_reply' => true, + 'allow_sig' => true, + 'allow_sig_bbcode' => true, + 'allow_sig_flash' => true, + 'allow_sig_img' => true, + 'allow_sig_links' => true, + 'allow_sig_pm' => true, + 'allow_sig_smilies' => true, + 'allow_smilies' => true, + 'allow_topic_notify' => true, + 'attachment_quota' => true, + 'auth_bbcode_pm' => true, + 'auth_flash_pm' => true, + 'auth_img_pm' => true, + 'auth_method' => true, + 'auth_smilies_pm' => true, + 'avatar_filesize' => true, + 'avatar_max_height' => true, + 'avatar_max_width' => true, + 'avatar_min_height' => true, + 'avatar_min_width' => true, + 'board_email_form' => true, + 'board_hide_emails' => true, + 'board_timezone' => true, + 'browser_check' => true, + 'bump_interval' => true, + 'bump_type' => true, + 'cache_gc' => true, + 'captcha_plugin' => true, + 'captcha_gd' => true, + 'captcha_gd_foreground_noise' => true, + 'captcha_gd_x_grid' => true, + 'captcha_gd_y_grid' => true, + 'captcha_gd_wave' => true, + 'captcha_gd_3d_noise' => true, + 'captcha_gd_fonts' => true, + 'confirm_refresh' => true, + 'check_attachment_content' => true, + 'check_dnsbl' => true, + 'chg_passforce' => true, + 'cookie_secure' => true, + 'coppa_enable' => true, + 'database_gc' => true, + 'dbms_version' => true, + 'default_dateformat' => true, + 'default_lang' => true, + 'display_last_edited' => true, + 'display_order' => true, + 'edit_time' => true, + 'email_check_mx' => true, + 'email_enable' => true, + 'email_force_sender' => true, + 'email_package_size' => true, + 'enable_confirm' => true, + 'enable_pm_icons' => true, + 'enable_post_confirm' => true, + 'feed_enable' => true, + 'feed_http_auth' => true, + 'feed_limit_post' => true, + 'feed_limit_topic' => true, + 'feed_overall' => true, + 'feed_overall_forums' => true, + 'feed_forum' => true, + 'feed_topic' => true, + 'feed_topics_new' => true, + 'feed_topics_active' => true, + 'feed_item_statistics' => true, + 'flood_interval' => true, + 'force_server_vars' => true, + 'form_token_lifetime' => true, + 'form_token_mintime' => true, + 'form_token_sid_guests' => true, + 'forward_pm' => true, + 'forwarded_for_check' => true, + 'full_folder_action' => true, + 'fulltext_native_common_thres' => true, + 'fulltext_native_load_upd' => true, + 'fulltext_native_max_chars' => true, + 'fulltext_native_min_chars' => true, + 'gzip_compress' => true, + 'hot_threshold' => true, + 'img_create_thumbnail' => true, + 'img_display_inlined' => true, + 'img_link_height' => true, + 'img_link_width' => true, + 'img_max_height' => true, + 'img_max_thumb_width' => true, + 'img_max_width' => true, + 'img_min_thumb_filesize' => true, + 'ip_check' => true, + 'jab_enable' => true, + 'jab_package_size' => true, + 'jab_use_ssl' => true, + 'limit_load' => true, + 'limit_search_load' => true, + 'load_anon_lastread' => true, + 'load_birthdays' => true, + 'load_cpf_memberlist' => true, + 'load_cpf_viewprofile' => true, + 'load_cpf_viewtopic' => true, + 'load_db_lastread' => true, + 'load_db_track' => true, + 'load_jumpbox' => true, + 'load_moderators' => true, + 'load_online' => true, + 'load_online_guests' => true, + 'load_online_time' => true, + 'load_onlinetrack' => true, + 'load_search' => true, + 'load_tplcompile' => true, + 'load_user_activity' => true, + 'max_attachments' => true, + 'max_attachments_pm' => true, + 'max_autologin_time' => true, + 'max_filesize' => true, + 'max_filesize_pm' => true, + 'max_login_attempts' => true, + 'max_name_chars' => true, + 'max_num_search_keywords' => true, + 'max_poll_options' => true, + 'max_post_chars' => true, + 'max_post_font_size' => true, + 'max_post_img_height' => true, + 'max_post_img_width' => true, + 'max_post_smilies' => true, + 'max_post_urls' => true, + 'max_quote_depth' => true, + 'max_reg_attempts' => true, + 'max_sig_chars' => true, + 'max_sig_font_size' => true, + 'max_sig_img_height' => true, + 'max_sig_img_width' => true, + 'max_sig_smilies' => true, + 'max_sig_urls' => true, + 'min_name_chars' => true, + 'min_pass_chars' => true, + 'min_post_chars' => true, + 'min_search_author_chars' => true, + 'mime_triggers' => true, + 'new_member_post_limit' => true, + 'new_member_group_default' => true, + 'override_user_style' => true, + 'pass_complex' => true, + 'pm_edit_time' => true, + 'pm_max_boxes' => true, + 'pm_max_msgs' => true, + 'pm_max_recipients' => true, + 'posts_per_page' => true, + 'print_pm' => true, + 'queue_interval' => true, + 'require_activation' => true, + 'referer_validation' => true, + 'search_block_size' => true, + 'search_gc' => true, + 'search_interval' => true, + 'search_anonymous_interval' => true, + 'search_type' => true, + 'search_store_results' => true, + 'secure_allow_deny' => true, + 'secure_allow_empty_referer' => true, + 'secure_downloads' => true, + 'session_gc' => true, + 'session_length' => true, + 'smtp_auth_method' => true, + 'smtp_delivery' => true, + 'topics_per_page' => true, + 'tpl_allow_php' => true, + 'version' => true, + 'warnings_expire_days' => true, + 'warnings_gc' => true, + + 'num_files' => true, + 'num_posts' => true, + 'num_topics' => true, + 'num_users' => true, + 'record_online_users' => true, + ); + + $result = array(); + foreach ($config_vars as $name => $void) + { + if (isset($this->config[$name])) + { + $result['config_' . $name] = $this->config[$name]; + } + } + + global $db, $request; + + $result['dbms'] = $dbms; + $result['acm_type'] = $acm_type; + $result['user_agent'] = 'Unknown'; + $result['dbms_version'] = $db->sql_server_info(true); + + // Try to get user agent vendor and version + $match = array(); + $user_agent = $request->header('User-Agent'); + $agents = array('firefox', 'msie', 'opera', 'chrome', 'safari', 'mozilla', 'seamonkey', 'konqueror', 'netscape', 'gecko', 'navigator', 'mosaic', 'lynx', 'amaya', 'omniweb', 'avant', 'camino', 'flock', 'aol'); + + // We check here 1 by 1 because some strings occur after others (for example Mozilla [...] Firefox/) + foreach ($agents as $agent) + { + if (preg_match('#(' . $agent . ')[/ ]?([0-9.]*)#i', $user_agent, $match)) + { + $result['user_agent'] = $match[1] . ' ' . $match[2]; + break; + } + } + + return $result; + } +} diff --git a/install/update/new/includes/startup.php b/install/update/new/includes/startup.php new file mode 100644 index 0000000..5ead3b7 --- /dev/null +++ b/install/update/new/includes/startup.php @@ -0,0 +1,86 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +// Report all errors, except notices and deprecation messages +$level = E_ALL & ~E_NOTICE & ~E_DEPRECATED; +error_reporting($level); + +/** +* Minimum Requirement: PHP 7.1.3 +*/ +if (version_compare(PHP_VERSION, '7.1.3', '<')) +{ + die('You are running an unsupported PHP version. Please upgrade to PHP 7.1.3 or higher before trying to install or update to phpBB 3.3'); +} +// Register globals and magic quotes have been dropped in PHP 5.4 so no need for extra checks + + +// In PHP 5.3.0 the error level has been raised to E_WARNING which causes problems +// because we show E_WARNING errors and do not set a default timezone. +// This is because we have our own timezone handling and work in UTC only anyway. + +// So what we basically want to do is set our timezone to UTC, +// but we don't know what other scripts (such as bridges) are involved, +// so we check whether a timezone is already set by calling date_default_timezone_get(). + +// Unfortunately, date_default_timezone_get() itself might throw E_WARNING +// if no timezone has been set, so we have to keep it quiet with @. + +// date_default_timezone_get() tries to guess the correct timezone first +// and then falls back to UTC when everything fails. +// We just set the timezone to whatever date_default_timezone_get() returns. +date_default_timezone_set(@date_default_timezone_get()); + +// Autoloading of dependencies. +// Three options are supported: +// 1. If dependencies are installed with Composer, Composer will create a +// vendor/autoload.php. If this file exists it will be +// automatically used by phpBB. This is the default mode that phpBB +// will use when shipped. +// 2. To disable composer autoloading, PHPBB_NO_COMPOSER_AUTOLOAD can be specified. +// Additionally specify PHPBB_AUTOLOAD=/path/to/autoload.php in the +// environment. This is useful for running CLI scripts and tests. +// /path/to/autoload.php should define and register class loaders +// for all of phpBB's dependencies. +// 3. You can also set PHPBB_NO_COMPOSER_AUTOLOAD without setting PHPBB_AUTOLOAD. +// In this case autoloading needs to be defined before running any phpBB +// script. This might be useful in cases when phpBB is integrated into a +// larger program. +if (getenv('PHPBB_NO_COMPOSER_AUTOLOAD')) +{ + if (getenv('PHPBB_AUTOLOAD')) + { + require(getenv('PHPBB_AUTOLOAD')); + } +} +else +{ + if (!file_exists($phpbb_root_path . 'vendor/autoload.php')) + { + trigger_error( + 'Composer dependencies have not been set up yet, run ' . + "'php ../composer.phar install' from the phpBB directory to do so.", + E_USER_ERROR + ); + } + require($phpbb_root_path . 'vendor/autoload.php'); +} + +$starttime = microtime(true); diff --git a/install/update/new/includes/ucp/ucp_attachments.php b/install/update/new/includes/ucp/ucp_attachments.php new file mode 100644 index 0000000..7808fed --- /dev/null +++ b/install/update/new/includes/ucp/ucp_attachments.php @@ -0,0 +1,219 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ucp_attachments +* User attachments +*/ +class ucp_attachments +{ + var $u_action; + + function main($id, $mode) + { + global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container, $request, $auth; + + $start = $request->variable('start', 0); + $sort_key = $request->variable('sk', 'a'); + $sort_dir = $request->variable('sd', 'a'); + + $delete = (isset($_POST['delete'])) ? true : false; + $delete_ids = array_keys($request->variable('attachment', array(0))); + + if ($delete && count($delete_ids)) + { + // Validate $delete_ids... + $sql = 'SELECT a.attach_id, p.post_edit_locked, t.topic_status, f.forum_id, f.forum_status + FROM ' . ATTACHMENTS_TABLE . ' a + LEFT JOIN ' . POSTS_TABLE . ' p + ON (a.post_msg_id = p.post_id AND a.in_message = 0) + LEFT JOIN ' . TOPICS_TABLE . ' t + ON (t.topic_id = p.topic_id AND a.in_message = 0) + LEFT JOIN ' . FORUMS_TABLE . ' f + ON (f.forum_id = t.forum_id AND a.in_message = 0) + WHERE a.poster_id = ' . $user->data['user_id'] . ' + AND a.is_orphan = 0 + AND ' . $db->sql_in_set('a.attach_id', $delete_ids); + $result = $db->sql_query($sql); + + $delete_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!$auth->acl_get('m_edit', $row['forum_id']) && ($row['forum_status'] == ITEM_LOCKED || $row['topic_status'] == ITEM_LOCKED || $row['post_edit_locked'])) + { + continue; + } + + $delete_ids[] = $row['attach_id']; + } + $db->sql_freeresult($result); + } + + if ($delete && count($delete_ids)) + { + $s_hidden_fields = array( + 'delete' => 1 + ); + + foreach ($delete_ids as $attachment_id) + { + $s_hidden_fields['attachment'][$attachment_id] = 1; + } + + if (confirm_box(true)) + { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('attach', $delete_ids); + unset($attachment_manager); + + meta_refresh(3, $this->u_action); + $message = ((count($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + else + { + confirm_box(false, (count($delete_ids) == 1) ? 'DELETE_ATTACHMENT' : 'DELETE_ATTACHMENTS', build_hidden_fields($s_hidden_fields)); + } + } + + // Select box eventually + $sort_key_text = array('a' => $user->lang['SORT_FILENAME'], 'b' => $user->lang['SORT_COMMENT'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']); + $sort_key_sql = array('a' => 'a.real_filename', 'b' => 'a.attach_comment', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title'); + + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + $s_sort_key = ''; + foreach ($sort_key_text as $key => $value) + { + $selected = ($sort_key == $key) ? ' selected="selected"' : ''; + $s_sort_key .= ''; + } + + $s_sort_dir = ''; + foreach ($sort_dir_text as $key => $value) + { + $selected = ($sort_dir == $key) ? ' selected="selected"' : ''; + $s_sort_dir .= ''; + } + + if (!isset($sort_key_sql[$sort_key])) + { + $sort_key = 'a'; + } + + $order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); + + $sql = 'SELECT COUNT(attach_id) as num_attachments + FROM ' . ATTACHMENTS_TABLE . ' + WHERE poster_id = ' . $user->data['user_id'] . ' + AND is_orphan = 0'; + $result = $db->sql_query($sql); + $num_attachments = $db->sql_fetchfield('num_attachments'); + $db->sql_freeresult($result); + + // Ensure start is a valid value + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $start = $pagination->validate_start($start, $config['topics_per_page'], $num_attachments); + + $sql = 'SELECT a.*, t.topic_title, pr.message_subject as message_title, p.post_edit_locked, t.topic_status, f.forum_id, f.forum_status + FROM ' . ATTACHMENTS_TABLE . ' a + LEFT JOIN ' . POSTS_TABLE . ' p ON (a.post_msg_id = p.post_id AND a.in_message = 0) + LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id AND a.in_message = 0) + LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id AND a.in_message = 0) + LEFT JOIN ' . PRIVMSGS_TABLE . ' pr ON (a.post_msg_id = pr.msg_id AND a.in_message = 1) + WHERE a.poster_id = ' . $user->data['user_id'] . " + AND a.is_orphan = 0 + ORDER BY $order_by"; + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + + $row_count = 0; + if ($row = $db->sql_fetchrow($result)) + { + $template->assign_var('S_ATTACHMENT_ROWS', true); + + do + { + if ($row['in_message']) + { + $view_topic = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&p={$row['post_msg_id']}"); + } + else + { + $view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . "#p{$row['post_msg_id']}"; + } + + $template->assign_block_vars('attachrow', array( + 'ROW_NUMBER' => $row_count + ($start + 1), + 'FILENAME' => $row['real_filename'], + 'COMMENT' => bbcode_nl2br($row['attach_comment']), + 'EXTENSION' => $row['extension'], + 'SIZE' => get_formatted_filesize($row['filesize']), + 'DOWNLOAD_COUNT' => $row['download_count'], + 'POST_TIME' => $user->format_date($row['filetime']), + 'TOPIC_TITLE' => ($row['in_message']) ? $row['message_title'] : $row['topic_title'], + + 'ATTACH_ID' => $row['attach_id'], + 'POST_ID' => $row['post_msg_id'], + 'TOPIC_ID' => $row['topic_id'], + + 'S_IN_MESSAGE' => $row['in_message'], + 'S_LOCKED' => !$row['in_message'] && !$auth->acl_get('m_edit', $row['forum_id']) && ($row['forum_status'] == ITEM_LOCKED || $row['topic_status'] == ITEM_LOCKED || $row['post_edit_locked']), + + 'U_VIEW_ATTACHMENT' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $row['attach_id']), + 'U_VIEW_TOPIC' => $view_topic) + ); + + $row_count++; + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + $base_url = $this->u_action . "&sk=$sort_key&sd=$sort_dir"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'TOTAL_ATTACHMENTS' => $num_attachments, + 'NUM_ATTACHMENTS' => $user->lang('NUM_ATTACHMENTS', $num_attachments), + + 'L_TITLE' => $user->lang['UCP_ATTACHMENTS'], + + 'U_SORT_FILENAME' => $this->u_action . "&sk=a&sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_FILE_COMMENT' => $this->u_action . "&sk=b&sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_EXTENSION' => $this->u_action . "&sk=c&sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_FILESIZE' => $this->u_action . "&sk=d&sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_DOWNLOADS' => $this->u_action . "&sk=e&sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_POST_TIME' => $this->u_action . "&sk=f&sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_TOPIC_TITLE' => $this->u_action . "&sk=g&sd=" . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'), + + 'S_DISPLAY_MARK_ALL' => ($num_attachments) ? true : false, + 'S_DISPLAY_PAGINATION' => ($num_attachments) ? true : false, + 'S_UCP_ACTION' => $this->u_action, + 'S_SORT_OPTIONS' => $s_sort_key, + 'S_ORDER_SELECT' => $s_sort_dir) + ); + + $this->tpl_name = 'ucp_attachments'; + $this->page_title = 'UCP_ATTACHMENTS'; + } +} diff --git a/install/update/new/includes/ucp/ucp_groups.php b/install/update/new/includes/ucp/ucp_groups.php new file mode 100644 index 0000000..6eba3a0 --- /dev/null +++ b/install/update/new/includes/ucp/ucp_groups.php @@ -0,0 +1,1142 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ucp_groups +*/ +class ucp_groups +{ + var $u_action; + + function main($id, $mode) + { + global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path; + global $db, $user, $auth, $cache, $template; + global $request, $phpbb_container, $phpbb_log; + + /** @var \phpbb\language\language $language Language object */ + $language = $phpbb_container->get('language'); + + $user->add_lang('groups'); + + $return_page = '

' . sprintf($user->lang['RETURN_PAGE'], '', ''); + + $mark_ary = $request->variable('mark', array(0)); + $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + switch ($mode) + { + case 'membership': + + $this->page_title = 'UCP_USERGROUPS_MEMBER'; + + if ($submit || isset($_POST['change_default'])) + { + $action = (isset($_POST['change_default'])) ? 'change_default' : $request->variable('action', ''); + $group_id = ($action == 'change_default') ? $request->variable('default', 0) : $request->variable('selected', 0); + + if (!$group_id) + { + trigger_error('NO_GROUP_SELECTED'); + } + + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE . " + WHERE group_id IN ($group_id, {$user->data['group_id']})"; + $result = $db->sql_query($sql); + + $group_row = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['group_name'] = $group_helper->get_name($row['group_name']); + $group_row[$row['group_id']] = $row; + } + $db->sql_freeresult($result); + + if (!count($group_row)) + { + trigger_error('GROUP_NOT_EXIST'); + } + + switch ($action) + { + case 'change_default': + // User already having this group set as default? + if ($group_id == $user->data['group_id']) + { + trigger_error($user->lang['ALREADY_DEFAULT_GROUP'] . $return_page); + } + + if (!$auth->acl_get('u_chggrp')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NOT_AUTHORISED'] . $return_page); + } + + // User needs to be member of the group in order to make it default + if (!group_memberships($group_id, $user->data['user_id'], true)) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + + if (confirm_box(true)) + { + group_user_attributes('default', $group_id, $user->data['user_id']); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_CHANGE', false, array( + 'reportee_id' => $user->data['user_id'], + sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$user->data['group_id']]['group_name'], $group_row[$group_id]['group_name']) + )); + + meta_refresh(3, $this->u_action); + trigger_error($user->lang['CHANGED_DEFAULT_GROUP'] . $return_page); + } + else + { + $s_hidden_fields = array( + 'default' => $group_id, + 'change_default'=> true + ); + + confirm_box(false, sprintf($user->lang['GROUP_CHANGE_DEFAULT'], $group_row[$group_id]['group_name']), build_hidden_fields($s_hidden_fields)); + } + + break; + + case 'resign': + + // User tries to resign from default group but is not allowed to change it? + if ($group_id == $user->data['group_id'] && !$auth->acl_get('u_chggrp')) + { + trigger_error($user->lang['NOT_RESIGN_FROM_DEFAULT_GROUP'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + $row = current($row); + + $sql = 'SELECT group_type + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $db->sql_query($sql); + $group_type = (int) $db->sql_fetchfield('group_type'); + $db->sql_freeresult($result); + + if ($group_type != GROUP_OPEN && $group_type != GROUP_FREE) + { + trigger_error($user->lang['CANNOT_RESIGN_GROUP'] . $return_page); + } + + if (confirm_box(true)) + { + group_user_del($group_id, $user->data['user_id']); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_RESIGN', false, array( + 'reportee_id' => $user->data['user_id'], + $group_row[$group_id]['group_name'] + )); + + meta_refresh(3, $this->u_action); + trigger_error($user->lang[($row['user_pending']) ? 'GROUP_RESIGNED_PENDING' : 'GROUP_RESIGNED_MEMBERSHIP'] . $return_page); + } + else + { + $s_hidden_fields = array( + 'selected' => $group_id, + 'action' => 'resign', + 'submit' => true + ); + + confirm_box(false, ($row['user_pending']) ? 'GROUP_RESIGN_PENDING' : 'GROUP_RESIGN_MEMBERSHIP', build_hidden_fields($s_hidden_fields)); + } + + break; + + case 'join': + + $sql = 'SELECT ug.*, u.username, u.username_clean, u.user_email + FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u + WHERE ug.user_id = u.user_id + AND ug.group_id = ' . $group_id . ' + AND ug.user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + if ($row['user_pending']) + { + trigger_error($user->lang['ALREADY_IN_GROUP_PENDING'] . $return_page); + } + + trigger_error($user->lang['ALREADY_IN_GROUP'] . $return_page); + } + + // Check permission to join (open group or request) + if ($group_row[$group_id]['group_type'] != GROUP_OPEN && $group_row[$group_id]['group_type'] != GROUP_FREE) + { + trigger_error($user->lang['CANNOT_JOIN_GROUP'] . $return_page); + } + + if (confirm_box(true)) + { + if ($group_row[$group_id]['group_type'] == GROUP_FREE) + { + group_user_add($group_id, $user->data['user_id']); + } + else + { + group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1); + } + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), false, array( + 'reportee_id' => $user->data['user_id'], + $group_row[$group_id]['group_name'] + )); + + meta_refresh(3, $this->u_action); + trigger_error($user->lang[($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOINED' : 'GROUP_JOINED_PENDING'] . $return_page); + } + else + { + $s_hidden_fields = array( + 'selected' => $group_id, + 'action' => 'join', + 'submit' => true + ); + + confirm_box(false, ($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOIN' : 'GROUP_JOIN_PENDING', build_hidden_fields($s_hidden_fields)); + } + + break; + + case 'demote': + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + $row = current($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + if (confirm_box(true)) + { + group_user_attributes('demote', $group_id, $user->data['user_id']); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_DEMOTE', false, array( + 'reportee_id' => $user->data['user_id'], + $group_row[$group_id]['group_name'] + )); + + meta_refresh(3, $this->u_action); + trigger_error($user->lang['USER_GROUP_DEMOTED'] . $return_page); + } + else + { + $s_hidden_fields = array( + 'selected' => $group_id, + 'action' => 'demote', + 'submit' => true + ); + + confirm_box(false, 'USER_GROUP_DEMOTE', build_hidden_fields($s_hidden_fields)); + } + + break; + } + } + + $sql = 'SELECT g.*, ug.group_leader, ug.user_pending + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE ug.user_id = ' . $user->data['user_id'] . ' + AND g.group_id = ug.group_id + ORDER BY g.group_type DESC, g.group_name'; + $result = $db->sql_query($sql); + + $group_id_ary = array(); + $leader_count = $member_count = $pending_count = 0; + while ($row = $db->sql_fetchrow($result)) + { + $block = ($row['group_leader']) ? 'leader' : (($row['user_pending']) ? 'pending' : 'member'); + + switch ($row['group_type']) + { + case GROUP_OPEN: + $group_status = 'OPEN'; + break; + + case GROUP_CLOSED: + $group_status = 'CLOSED'; + break; + + case GROUP_HIDDEN: + $group_status = 'HIDDEN'; + break; + + case GROUP_SPECIAL: + $group_status = 'SPECIAL'; + break; + + case GROUP_FREE: + $group_status = 'FREE'; + break; + } + + $template->assign_block_vars($block, array( + 'GROUP_ID' => $row['group_id'], + 'GROUP_NAME' => $group_helper->get_name($row['group_name']), + 'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'], + 'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true, + 'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status], + 'GROUP_COLOUR' => $row['group_colour'], + + 'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']), + + 'S_GROUP_DEFAULT' => ($row['group_id'] == $user->data['group_id']) ? true : false, + 'S_ROW_COUNT' => ${$block . '_count'}++) + ); + + $group_id_ary[] = (int) $row['group_id']; + } + $db->sql_freeresult($result); + + // Hide hidden groups unless user is an admin with group privileges + $sql_and = ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? '<> ' . GROUP_SPECIAL : 'NOT IN (' . GROUP_SPECIAL . ', ' . GROUP_HIDDEN . ')'; + + $sql = 'SELECT group_id, group_name, group_colour, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type, group_founder_manage + FROM ' . GROUPS_TABLE . ' + WHERE ' . ((count($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . " + group_type $sql_and + ORDER BY group_type DESC, group_name"; + $result = $db->sql_query($sql); + + $nonmember_count = 0; + while ($row = $db->sql_fetchrow($result)) + { + switch ($row['group_type']) + { + case GROUP_OPEN: + $group_status = 'OPEN'; + break; + + case GROUP_CLOSED: + $group_status = 'CLOSED'; + break; + + case GROUP_HIDDEN: + $group_status = 'HIDDEN'; + break; + + case GROUP_SPECIAL: + $group_status = 'SPECIAL'; + break; + + case GROUP_FREE: + $group_status = 'FREE'; + break; + } + + $template->assign_block_vars('nonmember', array( + 'GROUP_ID' => $row['group_id'], + 'GROUP_NAME' => $group_helper->get_name($row['group_name']), + 'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'], + 'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true, + 'GROUP_CLOSED' => ($row['group_type'] <> GROUP_CLOSED || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? false : true, + 'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status], + 'S_CAN_JOIN' => ($row['group_type'] == GROUP_OPEN || $row['group_type'] == GROUP_FREE) ? true : false, + 'GROUP_COLOUR' => $row['group_colour'], + + 'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']), + + 'S_ROW_COUNT' => $nonmember_count++) + ); + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_CHANGE_DEFAULT' => ($auth->acl_get('u_chggrp')) ? true : false, + 'S_LEADER_COUNT' => $leader_count, + 'S_MEMBER_COUNT' => $member_count, + 'S_PENDING_COUNT' => $pending_count, + 'S_NONMEMBER_COUNT' => $nonmember_count, + + 'S_UCP_ACTION' => $this->u_action) + ); + + break; + + case 'manage': + + $this->page_title = 'UCP_USERGROUPS_MANAGE'; + $action = (isset($_POST['addusers'])) ? 'addusers' : $request->variable('action', ''); + $group_id = $request->variable('g', 0); + + if (!function_exists('phpbb_get_user_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + add_form_key('ucp_groups'); + + if ($group_id) + { + $sql = 'SELECT g.*, t.teampage_position AS group_teampage + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . TEAMPAGE_TABLE . ' t + ON (t.group_id = g.group_id) + WHERE g.group_id = ' . $group_id; + $result = $db->sql_query($sql); + $group_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$group_row) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + // Check if the user is allowed to manage this group if set to founder only. + if ($user->data['user_type'] != USER_FOUNDER && $group_row['group_founder_manage']) + { + trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING); + } + + $group_name = $group_row['group_name']; + $group_type = $group_row['group_type']; + + $avatar = phpbb_get_group_avatar($group_row, 'GROUP_AVATAR', true); + + $template->assign_vars(array( + 'GROUP_NAME' => $group_helper->get_name($group_name), + 'GROUP_INTERNAL_NAME' => $group_name, + 'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '', + 'GROUP_DESC_DISP' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']), + 'GROUP_TYPE' => $group_row['group_type'], + + 'AVATAR' => (empty($avatar) ? '' : $avatar), + 'AVATAR_IMAGE' => (empty($avatar) ? '' : $avatar), + 'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '', + 'AVATAR_HEIGHT' => (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : '', + )); + } + + switch ($action) + { + case 'edit': + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + $row = current($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $user->add_lang(array('acp/groups', 'acp/common')); + + $update = (isset($_POST['update'])) ? true : false; + + $error = array(); + + // Setup avatar data for later + $avatars_enabled = false; + $avatar_drivers = null; + $avatar_data = null; + $avatar_error = array(); + + /** @var \phpbb\avatar\manager $phpbb_avatar_manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + + if ($config['allow_avatar']) + { + $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); + + // This is normalised data, without the group_ prefix + $avatar_data = \phpbb\avatar\manager::clean_row($group_row, 'group'); + } + + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (confirm_box(true)) + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, GROUPS_TABLE, 'group_'); + $cache->destroy('sql', GROUPS_TABLE); + + $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED'; + trigger_error($user->lang[$message] . $return_page); + } + else + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true, + 'i' => $id, + 'mode' => $mode, + 'g' => $group_id, + 'action' => $action)) + ); + } + } + + // Did we submit? + if ($update) + { + $group_name = $request->variable('group_name', '', true); + $group_desc = $request->variable('group_desc', '', true); + $group_type = $request->variable('group_type', GROUP_FREE); + + $allow_desc_bbcode = $request->variable('desc_parse_bbcode', false); + $allow_desc_urls = $request->variable('desc_parse_urls', false); + $allow_desc_smilies = $request->variable('desc_parse_smilies', false); + + $submit_ary = array( + 'colour' => $request->variable('group_colour', ''), + 'rank' => $request->variable('group_rank', 0), + 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, + 'message_limit' => $request->variable('group_message_limit', 0), + 'max_recipients'=> $request->variable('group_max_recipients', 0), + 'legend' => $group_row['group_legend'], + 'teampage' => $group_row['group_teampage'], + ); + + if (!check_form_key('ucp_groups')) + { + $error[] = $user->lang['FORM_INVALID']; + } + + if (!count($error) && $config['allow_avatar']) + { + // Handle avatar + $driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); + + if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) + { + $driver = $phpbb_avatar_manager->get_driver($driver_name); + $result = $driver->process_form($request, $template, $user, $avatar_data, $avatar_error); + + if ($result && empty($avatar_error)) + { + $result['avatar_type'] = $driver_name; + + $submit_ary = array_merge($submit_ary, $result); + } + } + + // Merge any avatars errors into the primary error array + $error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error)); + } + + // Validate submitted colour value + if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour', true)))) + { + // Replace "error" string with its real, localised form + $error = array_merge($error, $colour_error); + } + + if (!count($error)) + { + // Only set the rank, colour, etc. if it's changed or if we're adding a new + // group. This prevents existing group members being updated if no changes + // were made. + // However there are some attributes that need to be set everytime, + // otherwise the group gets removed from the feature. + $set_attributes = array('legend', 'teampage'); + + $group_attributes = array(); + $test_variables = array( + 'rank' => 'int', + 'colour' => 'string', + 'avatar' => 'string', + 'avatar_type' => 'string', + 'avatar_width' => 'int', + 'avatar_height' => 'int', + 'receive_pm' => 'int', + 'legend' => 'int', + 'teampage' => 'int', + 'message_limit' => 'int', + 'max_recipients'=> 'int', + ); + + foreach ($test_variables as $test => $type) + { + if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || isset($group_attributes['group_avatar']) && strpos($test, 'avatar') === 0 || in_array($test, $set_attributes))) + { + settype($submit_ary[$test], $type); + $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test]; + } + } + + if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies))) + { + $cache->destroy('sql', GROUPS_TABLE); + $cache->destroy('sql', TEAMPAGE_TABLE); + + $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED'; + trigger_error($user->lang[$message] . $return_page); + } + } + + if (count($error)) + { + $error = array_map(array(&$user, 'lang'), $error); + $group_rank = $submit_ary['rank']; + + $group_desc_data = array( + 'text' => $group_desc, + 'allow_bbcode' => $allow_desc_bbcode, + 'allow_smilies' => $allow_desc_smilies, + 'allow_urls' => $allow_desc_urls + ); + } + } + else if (!$group_id) + { + $group_desc_data = array( + 'text' => '', + 'allow_bbcode' => true, + 'allow_smilies' => true, + 'allow_urls' => true + ); + $group_rank = 0; + $group_type = GROUP_OPEN; + } + else + { + $group_desc_data = generate_text_for_edit($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_options']); + $group_rank = $group_row['group_rank']; + } + + $sql = 'SELECT * + FROM ' . RANKS_TABLE . ' + WHERE rank_special = 1 + ORDER BY rank_title'; + $result = $db->sql_query($sql); + + $rank_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($group_rank && $row['rank_id'] == $group_rank) ? ' selected="selected"' : ''; + $rank_options .= ''; + } + $db->sql_freeresult($result); + + $type_free = ($group_type == GROUP_FREE) ? ' checked="checked"' : ''; + $type_open = ($group_type == GROUP_OPEN) ? ' checked="checked"' : ''; + $type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : ''; + $type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : ''; + + // Load up stuff for avatars + if ($config['allow_avatar']) + { + $avatars_enabled = false; + $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $avatar_data['avatar_type'])); + + // Assign min and max values before generating avatar driver html + $template->assign_vars(array( + 'AVATAR_MIN_WIDTH' => $config['avatar_min_width'], + 'AVATAR_MAX_WIDTH' => $config['avatar_max_width'], + 'AVATAR_MIN_HEIGHT' => $config['avatar_min_height'], + 'AVATAR_MAX_HEIGHT' => $config['avatar_max_height'], + )); + + foreach ($avatar_drivers as $current_driver) + { + $driver = $phpbb_avatar_manager->get_driver($current_driver); + + $avatars_enabled = true; + $template->set_filenames(array( + 'avatar' => $driver->get_template_name(), + )); + + if ($driver->prepare_form($request, $template, $user, $avatar_data, $avatar_error)) + { + $driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver); + $driver_upper = strtoupper($driver_name); + $template->assign_block_vars('avatar_drivers', array( + 'L_TITLE' => $user->lang($driver_upper . '_TITLE'), + 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), + + 'DRIVER' => $driver_name, + 'SELECTED' => $current_driver == $selected_driver, + 'OUTPUT' => $template->assign_display('avatar'), + )); + } + } + } + + if (isset($phpbb_avatar_manager) && !$update) + { + // Merge any avatars errors into the primary error array + $error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error)); + } + + $template->assign_vars(array( + 'S_EDIT' => true, + 'S_INCLUDE_SWATCH' => true, + 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', + 'S_ERROR' => (count($error)) ? true : false, + 'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false, + 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), + 'S_GROUP_MANAGE' => true, + + 'ERROR_MSG' => (count($error)) ? implode('
', $error) : '', + 'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', + 'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0, + 'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0, + + 'GROUP_DESC' => $group_desc_data['text'], + 'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'], + 'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'], + 'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'], + + 'S_RANK_OPTIONS' => $rank_options, + + 'GROUP_TYPE_FREE' => GROUP_FREE, + 'GROUP_TYPE_OPEN' => GROUP_OPEN, + 'GROUP_TYPE_CLOSED' => GROUP_CLOSED, + 'GROUP_TYPE_HIDDEN' => GROUP_HIDDEN, + 'GROUP_TYPE_SPECIAL' => GROUP_SPECIAL, + + 'GROUP_FREE' => $type_free, + 'GROUP_OPEN' => $type_open, + 'GROUP_CLOSED' => $type_closed, + 'GROUP_HIDDEN' => $type_hidden, + + 'S_UCP_ACTION' => $this->u_action . "&action=$action&g=$group_id", + 'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(), + )); + + break; + + case 'list': + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + $row = current($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $user->add_lang(array('acp/groups', 'acp/common')); + $start = $request->variable('start', 0); + + // Grab the leaders - always, on every page... + $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending + FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug + WHERE ug.group_id = $group_id + AND u.user_id = ug.user_id + AND ug.group_leader = 1 + ORDER BY ug.user_pending DESC, u.username_clean"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('leader', array( + 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => $row['user_colour'], + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'U_USER_VIEW' => get_username_string('profile', $row['user_id'], $row['username']), + 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, + 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', + 'USER_POSTS' => $row['user_posts'], + 'USER_ID' => $row['user_id']) + ); + } + $db->sql_freeresult($result); + + // Total number of group members (non-leaders) + $sql = 'SELECT COUNT(user_id) AS total_members + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + AND group_leader = 0"; + $result = $db->sql_query($sql); + $total_members = (int) $db->sql_fetchfield('total_members'); + $db->sql_freeresult($result); + + // Grab the members + $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending + FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug + WHERE ug.group_id = $group_id + AND u.user_id = ug.user_id + AND ug.group_leader = 0 + ORDER BY ug.user_pending DESC, u.username_clean"; + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + + $pending = false; + $approved = false; + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['user_pending'] && !$pending) + { + $template->assign_block_vars('member', array( + 'S_PENDING' => true) + ); + $template->assign_var('S_PENDING_SET', true); + + $pending = true; + } + else if (!$row['user_pending'] && !$approved) + { + $template->assign_block_vars('member', array( + 'S_APPROVED' => true) + ); + $template->assign_var('S_APPROVED_SET', true); + + $approved = true; + } + + $template->assign_block_vars('member', array( + 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => $row['user_colour'], + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'U_USER_VIEW' => get_username_string('profile', $row['user_id'], $row['username']), + 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, + 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', + 'USER_POSTS' => $row['user_posts'], + 'USER_ID' => $row['user_id']) + ); + } + $db->sql_freeresult($result); + + $s_action_options = ''; + $options = array('default' => 'DEFAULT', 'approve' => 'APPROVE', 'deleteusers' => 'DELETE'); + + foreach ($options as $option => $lang) + { + $s_action_options .= ''; + } + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $base_url = $this->u_action . "&action=$action&g=$group_id"; + $start = $pagination->validate_start($start, $config['topics_per_page'], $total_members); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'S_LIST' => true, + 'S_ACTION_OPTIONS' => $s_action_options, + + 'U_ACTION' => $this->u_action . "&g=$group_id", + 'S_UCP_ACTION' => $this->u_action . "&g=$group_id", + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=usernames'), + )); + + break; + + case 'approve': + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + if (!check_form_key('ucp_groups')) + { + trigger_error($user->lang('FORM_INVALID') . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + $row = current($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $user->add_lang('acp/groups'); + + // Approve, demote or promote + group_user_attributes('approve', $group_id, $mark_ary, false, false); + + trigger_error($user->lang['USERS_APPROVED'] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + + break; + + case 'default': + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + $row = current($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $group_row['group_name'] = $group_helper->get_name($group_row['group_name']); + + if (confirm_box(true)) + { + if (!count($mark_ary)) + { + $start = 0; + + do + { + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + ORDER BY user_id"; + $result = $db->sql_query_limit($sql, 200, $start); + + $mark_ary = array(); + if ($row = $db->sql_fetchrow($result)) + { + do + { + $mark_ary[] = $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + + group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row); + + $start = (count($mark_ary) < 200) ? 0 : $start + 200; + } + else + { + $start = 0; + } + $db->sql_freeresult($result); + } + while ($start); + } + else + { + group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row); + } + + $user->add_lang('acp/groups'); + + trigger_error($user->lang['GROUP_DEFS_UPDATED'] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + else + { + $user->add_lang('acp/common'); + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'mark' => $mark_ary, + 'g' => $group_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action)) + ); + } + + // redirect to last screen + redirect($this->u_action . '&action=list&g=' . $group_id); + + break; + + case 'deleteusers': + + $user->add_lang(array('acp/groups', 'acp/common')); + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + $row = current($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $group_row['group_name'] = $group_helper->get_name($group_row['group_name']); + + if (confirm_box(true)) + { + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + $error = group_user_del($group_id, $mark_ary, false, $group_row['group_name']); + + if ($error) + { + trigger_error($user->lang[$error] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + + trigger_error($user->lang['GROUP_USERS_REMOVE'] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'mark' => $mark_ary, + 'g' => $group_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action)) + ); + } + + // redirect to last screen + redirect($this->u_action . '&action=list&g=' . $group_id); + + break; + + case 'addusers': + + $user->add_lang(array('acp/groups', 'acp/common')); + + $names = $request->variable('usernames', '', true); + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + if (!$names) + { + trigger_error($user->lang['NO_USERS'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + $row = current($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $name_ary = array_unique(explode("\n", $names)); + $group_name = $group_helper->get_name($group_row['group_name']); + + $default = $request->variable('default', 0); + + if (confirm_box(true)) + { + $return_manage_page = '

' . $language->lang('RETURN_PAGE', '', ''); + + // Add user/s to group + if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, 0, 0, $group_row)) + { + $display_message = $language->lang($error); + + if ($error == 'GROUP_USERS_INVALID') + { + // Find which users don't exist + $actual_name_ary = $name_ary; + $actual_user_id_ary = []; + user_get_id_name($actual_user_id_ary, $actual_name_ary, false, true); + + $display_message = $language->lang('GROUP_USERS_INVALID', implode($language->lang('COMMA_SEPARATOR'), array_udiff($name_ary, $actual_name_ary, 'strcasecmp'))); + } + + trigger_error($display_message . $return_manage_page); + } + + trigger_error($language->lang('GROUP_USERS_ADDED') . $return_manage_page); + } + else + { + $s_hidden_fields = array( + 'default' => $default, + 'usernames' => $names, + 'g' => $group_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action + ); + + confirm_box(false, $user->lang('GROUP_CONFIRM_ADD_USERS', count($name_ary), implode($user->lang['COMMA_SEPARATOR'], $name_ary)), build_hidden_fields($s_hidden_fields)); + } + + trigger_error($user->lang['NO_USERS_ADDED'] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + + break; + + default: + $user->add_lang('acp/common'); + + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_desc, g.group_desc_uid, g.group_desc_bitfield, g.group_desc_options, g.group_type, ug.group_leader + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE ug.user_id = ' . $user->data['user_id'] . ' + AND g.group_id = ug.group_id + AND ug.group_leader = 1 + ORDER BY g.group_type DESC, g.group_name'; + $result = $db->sql_query($sql); + + while ($value = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('leader', array( + 'GROUP_NAME' => $group_helper->get_name($value['group_name']), + 'GROUP_DESC' => generate_text_for_display($value['group_desc'], $value['group_desc_uid'], $value['group_desc_bitfield'], $value['group_desc_options']), + 'GROUP_TYPE' => $value['group_type'], + 'GROUP_ID' => $value['group_id'], + 'GROUP_COLOUR' => $value['group_colour'], + + 'U_LIST' => $this->u_action . "&action=list&g={$value['group_id']}", + 'U_EDIT' => $this->u_action . "&action=edit&g={$value['group_id']}") + ); + } + $db->sql_freeresult($result); + + break; + } + + break; + } + + $this->tpl_name = 'ucp_groups_' . $mode; + } +} diff --git a/install/update/new/includes/ucp/ucp_pm.php b/install/update/new/includes/ucp/ucp_pm.php new file mode 100644 index 0000000..00d1ce7 --- /dev/null +++ b/install/update/new/includes/ucp/ucp_pm.php @@ -0,0 +1,442 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Private Message Class +* +* $_REQUEST['folder'] display folder with the id used +* $_REQUEST['folder'] inbox|outbox|sentbox display folder with the associated name +* +* Display Messages (default to inbox) - mode=view +* Display single message - mode=view&p=[msg_id] or &p=[msg_id] (short linkage) +* +* if the folder id with (&f=[folder_id]) is used when displaying messages, one query will be saved. If it is not used, phpBB needs to grab +* the folder id first in order to display the input boxes and folder names and such things. ;) phpBB always checks this against the database to make +* sure the user is able to view the message. +* +* Composing Messages (mode=compose): +* To specific user (u=[user_id]) +* To specific group (g=[group_id]) +* Quoting a post (action=quotepost&p=[post_id]) +* Quoting a PM (action=quote&p=[msg_id]) +* Forwarding a PM (action=forward&p=[msg_id]) +*/ +class ucp_pm +{ + var $u_action; + + function main($id, $mode) + { + global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $config, $request; + + if (!$user->data['is_registered']) + { + trigger_error('NO_MESSAGE'); + } + + // Is PM disabled? + if (!$config['allow_privmsg']) + { + trigger_error('PM_DISABLED'); + } + + $user->add_lang('posting'); + $template->assign_var('S_PRIVMSGS', true); + + // Folder directly specified? + $folder_specified = $request->variable('folder', ''); + + if (!in_array($folder_specified, array('inbox', 'outbox', 'sentbox'))) + { + $folder_specified = (int) $folder_specified; + } + else + { + $folder_specified = ($folder_specified == 'inbox') ? PRIVMSGS_INBOX : (($folder_specified == 'outbox') ? PRIVMSGS_OUTBOX : PRIVMSGS_SENTBOX); + } + + if (!$folder_specified) + { + $mode = (!$mode) ? $request->variable('mode', 'view') : $mode; + } + else + { + $mode = 'view'; + } + + if (!function_exists('get_folder')) + { + include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + } + + switch ($mode) + { + // Compose message + case 'compose': + $action = $request->variable('action', 'post'); + + $user_folders = get_folder($user->data['user_id']); + + if ($action != 'delete' && !$auth->acl_get('u_sendpm')) + { + // trigger_error('NO_AUTH_SEND_MESSAGE'); + $template->assign_vars(array( + 'S_NO_AUTH_SEND_MESSAGE' => true, + 'S_COMPOSE_PM_VIEW' => true, + )); + + $tpl_file = 'ucp_pm_viewfolder'; + break; + } + + if (!function_exists('compose_pm')) + { + include($phpbb_root_path . 'includes/ucp/ucp_pm_compose.' . $phpEx); + } + compose_pm($id, $mode, $action, $user_folders); + + $tpl_file = 'posting_body'; + break; + + case 'options': + set_user_message_limit(); + get_folder($user->data['user_id']); + + if (!function_exists('message_options')) + { + include($phpbb_root_path . 'includes/ucp/ucp_pm_options.' . $phpEx); + } + message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions); + + $tpl_file = 'ucp_pm_options'; + break; + + case 'drafts': + + get_folder($user->data['user_id']); + $this->p_name = 'pm'; + + if (!class_exists('ucp_main')) + { + include($phpbb_root_path . 'includes/ucp/ucp_main.' . $phpEx); + } + + $module = new ucp_main($this); + $module->u_action = $this->u_action; + $module->main($id, $mode); + + $this->tpl_name = $module->tpl_name; + $this->page_title = 'UCP_PM_DRAFTS'; + + unset($module); + return; + + break; + + case 'view': + + set_user_message_limit(); + + if ($folder_specified) + { + $folder_id = $folder_specified; + $action = 'view_folder'; + } + else + { + $folder_id = $request->variable('f', PRIVMSGS_NO_BOX); + $action = $request->variable('action', 'view_folder'); + } + + $msg_id = $request->variable('p', 0); + $view = $request->variable('view', ''); + + // View message if specified + if ($msg_id) + { + $action = 'view_message'; + } + + if (!$auth->acl_get('u_readpm')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_READ_MESSAGE'); + } + + if ($view == 'print' && (!$config['print_pm'] || !$auth->acl_get('u_pm_printpm'))) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_PRINT_MESSAGE'); + } + + // Do not allow hold messages to be seen + if ($folder_id == PRIVMSGS_HOLD_BOX) + { + trigger_error('NO_AUTH_READ_HOLD_MESSAGE'); + } + + add_form_key('ucp_pm_view'); + + // First Handle Mark actions and moving messages + $submit_mark = (isset($_POST['submit_mark'])) ? true : false; + $move_pm = (isset($_POST['move_pm'])) ? true : false; + $mark_option = $request->variable('mark_option', ''); + $dest_folder = $request->variable('dest_folder', PRIVMSGS_NO_BOX); + + // Is moving PM triggered through mark options? + if (!in_array($mark_option, array('mark_important', 'delete_marked')) && $submit_mark) + { + $move_pm = true; + $dest_folder = (int) $mark_option; + $submit_mark = false; + } + + if (($move_pm || $submit_mark) && !check_form_key('ucp_pm_view')) + { + trigger_error('FORM_INVALID'); + } + + // Move PM + if ($move_pm) + { + $move_msg_ids = (isset($_POST['marked_msg_id'])) ? $request->variable('marked_msg_id', array(0)) : array(); + $cur_folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); + + if (move_pm($user->data['user_id'], $user->data['message_limit'], $move_msg_ids, $dest_folder, $cur_folder_id)) + { + // Return to folder view if single message moved + if ($action == 'view_message') + { + $msg_id = 0; + $folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); + $action = 'view_folder'; + } + } + } + + // Message Mark Options + if ($submit_mark) + { + handle_mark_actions($user->data['user_id'], $mark_option); + } + + // If new messages arrived, place them into the appropriate folder + $num_not_moved = $num_removed = 0; + $release = $request->variable('release', 0); + + if ($user->data['user_new_privmsg'] && ($action == 'view_folder' || $action == 'view_message')) + { + $return = place_pm_into_folder($global_privmsgs_rules, $release); + $num_not_moved = $return['not_moved']; + $num_removed = $return['removed']; + } + + if (!$msg_id && $folder_id == PRIVMSGS_NO_BOX) + { + $folder_id = PRIVMSGS_INBOX; + } + else if ($msg_id && $folder_id == PRIVMSGS_NO_BOX) + { + $sql = 'SELECT folder_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE msg_id = $msg_id + AND folder_id <> " . PRIVMSGS_NO_BOX . ' + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_MESSAGE'); + } + $folder_id = (int) $row['folder_id']; + } + + if ($request->variable('mark', '') == 'all' && check_link_hash($request->variable('token', ''), 'mark_all_pms_read')) + { + mark_folder_read($user->data['user_id'], $folder_id); + + meta_refresh(3, $this->u_action); + $message = $user->lang['PM_MARK_ALL_READ_SUCCESS']; + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'success' => true, + )); + } + $message .= '

' . $user->lang('RETURN_UCP', '', ''); + + trigger_error($message); + } + + $message_row = array(); + if ($action == 'view_message' && $msg_id) + { + // Get Message user want to see + if ($view == 'next' || $view == 'previous') + { + $sql_condition = ($view == 'next') ? '>' : '<'; + $sql_ordering = ($view == 'next') ? 'ASC' : 'DESC'; + + $sql = 'SELECT t.msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TABLE . " p2 + WHERE p2.msg_id = $msg_id + AND t.folder_id = $folder_id + AND t.user_id = " . $user->data['user_id'] . " + AND t.msg_id = p.msg_id + AND p.message_time $sql_condition p2.message_time + ORDER BY p.message_time $sql_ordering"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $message = ($view == 'next') ? 'NO_NEWER_PM' : 'NO_OLDER_PM'; + trigger_error($message); + } + else + { + $msg_id = $row['msg_id']; + } + } + + $sql = 'SELECT t.*, p.*, u.* + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE t.user_id = ' . $user->data['user_id'] . " + AND p.author_id = u.user_id + AND t.folder_id = $folder_id + AND t.msg_id = p.msg_id + AND p.msg_id = $msg_id"; + $result = $db->sql_query($sql); + $message_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$message_row) + { + trigger_error('NO_MESSAGE'); + } + + // Update unread status + update_unread_status($message_row['pm_unread'], $message_row['msg_id'], $user->data['user_id'], $folder_id); + } + + $folder = get_folder($user->data['user_id'], $folder_id); + + $s_folder_options = $s_to_folder_options = ''; + foreach ($folder as $f_id => $folder_ary) + { + $option = '' . $folder_ary['folder_name'] . (($folder_ary['unread_messages']) ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . ''; + + $s_to_folder_options .= ($f_id != PRIVMSGS_OUTBOX && $f_id != PRIVMSGS_SENTBOX) ? $option : ''; + $s_folder_options .= $option; + } + clean_sentbox($folder[PRIVMSGS_SENTBOX]['num_messages']); + + // Header for message view - folder and so on + $folder_status = get_folder_status($folder_id, $folder); + + $template->assign_vars(array( + 'CUR_FOLDER_ID' => $folder_id, + 'CUR_FOLDER_NAME' => $folder_status['folder_name'], + 'NUM_NOT_MOVED' => $num_not_moved, + 'NUM_REMOVED' => $num_removed, + 'RELEASE_MESSAGE_INFO' => sprintf($user->lang['RELEASE_MESSAGES'], '', ''), + 'NOT_MOVED_MESSAGES' => $user->lang('NOT_MOVED_MESSAGES', (int) $num_not_moved), + 'RULE_REMOVED_MESSAGES' => $user->lang('RULE_REMOVED_MESSAGES', (int) $num_removed), + + 'S_FOLDER_OPTIONS' => $s_folder_options, + 'S_TO_FOLDER_OPTIONS' => $s_to_folder_options, + 'S_FOLDER_ACTION' => $this->u_action . '&action=view_folder', + 'S_PM_ACTION' => $this->u_action . '&action=' . $action, + + 'U_INBOX' => $this->u_action . '&folder=inbox', + 'U_OUTBOX' => $this->u_action . '&folder=outbox', + 'U_SENTBOX' => $this->u_action . '&folder=sentbox', + 'U_CREATE_FOLDER' => $this->u_action . '&mode=options', + 'U_CURRENT_FOLDER' => $this->u_action . '&folder=' . $folder_id, + 'U_MARK_ALL' => $this->u_action . '&folder=' . $folder_id . '&mark=all&token=' . generate_link_hash('mark_all_pms_read'), + + 'S_IN_INBOX' => ($folder_id == PRIVMSGS_INBOX) ? true : false, + 'S_IN_OUTBOX' => ($folder_id == PRIVMSGS_OUTBOX) ? true : false, + 'S_IN_SENTBOX' => ($folder_id == PRIVMSGS_SENTBOX) ? true : false, + + 'FOLDER_STATUS' => $folder_status['message'], + 'FOLDER_MAX_MESSAGES' => $folder_status['max'], + 'FOLDER_CUR_MESSAGES' => $folder_status['cur'], + 'FOLDER_REMAINING_MESSAGES' => $folder_status['remaining'], + 'FOLDER_PERCENT' => $folder_status['percent']) + ); + + if ($action == 'view_folder') + { + if (!function_exists('view_folder')) + { + include($phpbb_root_path . 'includes/ucp/ucp_pm_viewfolder.' . $phpEx); + } + view_folder($id, $mode, $folder_id, $folder); + + $tpl_file = 'ucp_pm_viewfolder'; + } + else if ($action == 'view_message') + { + $template->assign_vars(array( + 'S_VIEW_MESSAGE' => true, + 'L_RETURN_TO_FOLDER' => $user->lang('RETURN_TO', $folder_status['folder_name']), + 'MSG_ID' => $msg_id, + )); + + if (!$msg_id) + { + trigger_error('NO_MESSAGE'); + } + + if (!function_exists('view_message')) + { + include($phpbb_root_path . 'includes/ucp/ucp_pm_viewmessage.' . $phpEx); + } + view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row); + + $tpl_file = ($view == 'print') ? 'ucp_pm_viewmessage_print' : 'ucp_pm_viewmessage'; + } + + break; + + default: + trigger_error('NO_ACTION_MODE', E_USER_ERROR); + break; + } + + $template->assign_vars(array( + 'L_TITLE' => $user->lang['UCP_PM_' . strtoupper($mode)], + 'S_UCP_ACTION' => $this->u_action . ((isset($action)) ? "&action=$action" : '')) + ); + + // Set desired template + $this->tpl_name = $tpl_file; + $this->page_title = 'UCP_PM_' . strtoupper($mode); + } +} diff --git a/install/update/new/includes/ucp/ucp_pm_compose.php b/install/update/new/includes/ucp/ucp_pm_compose.php new file mode 100644 index 0000000..87a8c91 --- /dev/null +++ b/install/update/new/includes/ucp/ucp_pm_compose.php @@ -0,0 +1,1562 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Compose private message +* Called from ucp_pm with mode == 'compose' +*/ +function compose_pm($id, $mode, $action, $user_folders = array()) +{ + global $template, $db, $auth, $user, $cache; + global $phpbb_root_path, $phpEx, $config, $language; + global $request, $phpbb_dispatcher, $phpbb_container; + + // Damn php and globals - i know, this is horrible + // Needed for handle_message_list_actions() + global $refresh, $submit, $preview; + + if (!function_exists('generate_smilies')) + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } + + if (!function_exists('display_custom_bbcodes')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + if (!class_exists('parse_message')) + { + include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + } + + if (!$action) + { + $action = 'post'; + } + add_form_key('ucp_pm_compose'); + + // Grab only parameters needed here + $to_user_id = $request->variable('u', 0); + $to_group_id = $request->variable('g', 0); + $msg_id = $request->variable('p', 0); + $draft_id = $request->variable('d', 0); + + // Reply to all triggered (quote/reply) + $reply_to_all = $request->variable('reply_to_all', 0); + + $address_list = $request->variable('address_list', array('' => array(0 => ''))); + + $preview = (isset($_POST['preview'])) ? true : false; + $save = (isset($_POST['save'])) ? true : false; + $load = (isset($_POST['load'])) ? true : false; + $cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false; + $delete = (isset($_POST['delete'])) ? true : false; + + $remove_u = (isset($_REQUEST['remove_u'])) ? true : false; + $remove_g = (isset($_REQUEST['remove_g'])) ? true : false; + $add_to = (isset($_REQUEST['add_to'])) ? true : false; + $add_bcc = (isset($_REQUEST['add_bcc'])) ? true : false; + + $refresh = isset($_POST['add_file']) || isset($_POST['delete_file']) || $save || $load + || $remove_u || $remove_g || $add_to || $add_bcc; + $submit = $request->is_set_post('post') && !$refresh && !$preview; + + $action = ($delete && !$preview && !$refresh && $submit) ? 'delete' : $action; + $select_single = ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? false : true; + + $error = array(); + $current_time = time(); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + // Was cancel pressed? If so then redirect to the appropriate page + if ($cancel) + { + if ($msg_id) + { + redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id)); + } + redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm')); + } + + // Since viewtopic.php language entries are used in several modes, + // we include the language file here + $user->add_lang('viewtopic'); + + /** + * Modify the default vars before composing a PM + * + * @event core.ucp_pm_compose_modify_data + * @var int msg_id post_id in the page request + * @var int to_user_id The id of whom the message is to + * @var int to_group_id The id of the group the message is to + * @var bool submit Whether the form has been submitted + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete Whether the user is deleting the PM + * @var int reply_to_all Value of reply_to_all request variable. + * @since 3.1.4-RC1 + */ + $vars = array( + 'msg_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_modify_data', compact($vars))); + + // Output PM_TO box if message composing + if ($action != 'edit') + { + // Add groups to PM box + if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) + { + $sql = 'SELECT g.group_id, g.group_name, g.group_type, g.group_colour + FROM ' . GROUPS_TABLE . ' g'; + + if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) + { + $sql .= ' LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + } + + $sql .= ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' WHERE ' : ' AND '; + + $sql .= 'g.group_receive_pm = 1 + ORDER BY g.group_type DESC, g.group_name ASC'; + $result = $db->sql_query($sql); + + $group_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $group_options .= '' . $group_helper->get_name($row['group_name']) . ''; + } + $db->sql_freeresult($result); + } + + $template->assign_vars(array( + 'S_SHOW_PM_BOX' => true, + 'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false, + 'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) ? $group_options : '', + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=" . (int) $select_single), + )); + } + + $sql = ''; + $folder_id = 0; + + // What is all this following SQL for? Well, we need to know + // some basic information in all cases before we do anything. + switch ($action) + { + case 'post': + if (!$auth->acl_get('u_sendpm')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_SEND_MESSAGE'); + } + break; + + case 'reply': + case 'quote': + case 'forward': + case 'quotepost': + if (!$msg_id) + { + trigger_error('NO_MESSAGE'); + } + + if (!$auth->acl_get('u_sendpm')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_SEND_MESSAGE'); + } + + if ($action == 'quotepost') + { + $sql = 'SELECT p.post_id as msg_id, p.forum_id, p.post_text as message_text, p.poster_id as author_id, p.post_time as message_time, p.bbcode_bitfield, p.bbcode_uid, p.enable_sig, p.enable_smilies, p.enable_magic_url, t.topic_title as message_subject, u.username as quote_username + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . " u + WHERE p.post_id = $msg_id + AND t.topic_id = p.topic_id + AND u.user_id = p.poster_id"; + } + else + { + $sql = 'SELECT t.folder_id, p.*, u.username as quote_username + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE t.user_id = ' . $user->data['user_id'] . " + AND p.author_id = u.user_id + AND t.msg_id = p.msg_id + AND p.msg_id = $msg_id"; + } + break; + + case 'edit': + if (!$msg_id) + { + trigger_error('NO_MESSAGE'); + } + + // check for outbox (not read) status, we do not allow editing if one user already having the message + $sql = 'SELECT p.*, t.folder_id + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p + WHERE t.user_id = ' . $user->data['user_id'] . ' + AND t.folder_id = ' . PRIVMSGS_OUTBOX . " + AND t.msg_id = $msg_id + AND t.msg_id = p.msg_id"; + break; + + case 'delete': + if (!$auth->acl_get('u_pm_delete')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_DELETE_MESSAGE'); + } + + if (!$msg_id) + { + trigger_error('NO_MESSAGE'); + } + + $sql = 'SELECT msg_id, pm_unread, pm_new, author_id, folder_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . " + AND msg_id = $msg_id"; + break; + + case 'smilies': + generate_smilies('window', 0); + break; + + default: + trigger_error('NO_ACTION_MODE', E_USER_ERROR); + break; + } + + if ($action == 'forward' && (!$config['forward_pm'] || !$auth->acl_get('u_pm_forward'))) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_FORWARD_MESSAGE'); + } + + if ($action == 'edit' && !$auth->acl_get('u_pm_edit')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_EDIT_MESSAGE'); + } + + if ($sql) + { + /** + * Alter sql query to get message for user to write the PM + * + * @event core.ucp_pm_compose_compose_pm_basic_info_query_before + * @var string sql String with the query to be executed + * @var int msg_id topic_id in the page request + * @var int to_user_id The id of whom the message is to + * @var int to_group_id The id of the group whom the message is to + * @var bool submit Whether the user is sending the PM or not + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete Whether the user is deleting the PM + * @var int reply_to_all Value of reply_to_all request variable. + * @since 3.1.0-RC5 + * @changed 3.2.0-a1 Removed undefined variables + */ + $vars = array( + 'sql', + 'msg_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_compose_pm_basic_info_query_before', compact($vars))); + + $result = $db->sql_query($sql); + $post = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$post) + { + // If editing it could be the recipient already read the message... + if ($action == 'edit') + { + $sql = 'SELECT p.*, t.folder_id + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p + WHERE t.user_id = ' . $user->data['user_id'] . " + AND t.msg_id = $msg_id + AND t.msg_id = p.msg_id"; + $result = $db->sql_query($sql); + $post = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($post) + { + trigger_error('NO_EDIT_READ_MESSAGE'); + } + } + + trigger_error('NO_MESSAGE'); + } + + if ($action == 'quotepost') + { + if (($post['forum_id'] && !$auth->acl_get('f_read', $post['forum_id'])) || (!$post['forum_id'] && !$auth->acl_getf_global('f_read'))) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } + + /** + * Get the result of querying for the post to be quoted in the pm message + * + * @event core.ucp_pm_compose_quotepost_query_after + * @var string sql The original SQL used in the query + * @var array post Associative array with the data of the quoted post + * @var array msg_id The post_id that was searched to get the message for quoting + * @var int to_user_id Users the message is sent to + * @var int to_group_id Groups the message is sent to + * @var bool submit Whether the user is sending the PM or not + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete If deleting message + * @var int reply_to_all Value of reply_to_all request variable. + * @since 3.1.0-RC5 + * @changed 3.2.0-a1 Removed undefined variables + */ + $vars = array( + 'sql', + 'post', + 'msg_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_quotepost_query_after', compact($vars))); + + // Passworded forum? + if ($post['forum_id']) + { + $sql = 'SELECT forum_id, forum_name, forum_password + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . (int) $post['forum_id']; + $result = $db->sql_query($sql); + $forum_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!empty($forum_data['forum_password'])) + { + login_forum_box($forum_data); + } + } + } + + $msg_id = (int) $post['msg_id']; + $folder_id = (isset($post['folder_id'])) ? $post['folder_id'] : 0; + $message_text = (isset($post['message_text'])) ? $post['message_text'] : ''; + + if ((!$post['author_id'] || ($post['author_id'] == ANONYMOUS && $action != 'delete')) && $msg_id) + { + trigger_error('NO_AUTHOR'); + } + + if ($action == 'quotepost') + { + // Decode text for message display + decode_message($message_text, $post['bbcode_uid']); + } + + if ($action != 'delete') + { + $enable_urls = $post['enable_magic_url']; + $enable_sig = (isset($post['enable_sig'])) ? $post['enable_sig'] : 0; + + $message_attachment = (isset($post['message_attachment'])) ? $post['message_attachment'] : 0; + $message_subject = $post['message_subject']; + $message_time = $post['message_time']; + $bbcode_uid = $post['bbcode_uid']; + + $quote_username = (isset($post['quote_username'])) ? $post['quote_username'] : ''; + $icon_id = (isset($post['icon_id'])) ? $post['icon_id'] : 0; + + if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !count($address_list) && !$refresh && !$submit && !$preview) + { + // Add the original author as the recipient if quoting a post or only replying and not having checked "reply to all" + if ($action == 'quotepost' || !$reply_to_all) + { + $address_list = array('u' => array($post['author_id'] => 'to')); + } + else + { + // We try to include every previously listed member from the TO Header - Reply to all + $address_list = rebuild_header(array('to' => $post['to_address'])); + + // Add the author (if he is already listed then this is no shame (it will be overwritten)) + $address_list['u'][$post['author_id']] = 'to'; + + // Now, make sure the user itself is not listed. ;) + if (isset($address_list['u'][$user->data['user_id']])) + { + unset($address_list['u'][$user->data['user_id']]); + } + } + } + else if ($action == 'edit' && !count($address_list) && !$refresh && !$submit && !$preview) + { + // Rebuild TO and BCC Header + $address_list = rebuild_header(array('to' => $post['to_address'], 'bcc' => $post['bcc_address'])); + } + + if ($action == 'quotepost') + { + $check_value = 0; + } + else + { + $check_value = (($post['enable_bbcode']+1) << 8) + (($post['enable_smilies']+1) << 4) + (($enable_urls+1) << 2) + (($post['enable_sig']+1) << 1); + } + } + } + else + { + $message_attachment = 0; + $message_text = $message_subject = ''; + + /** + * Predefine message text and subject + * + * @event core.ucp_pm_compose_predefined_message + * @var string message_text Message text + * @var string message_subject Messate subject + * @since 3.1.11-RC1 + */ + $vars = array('message_text', 'message_subject'); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_predefined_message', compact($vars))); + + if ($to_user_id && $to_user_id != ANONYMOUS && $action == 'post') + { + $address_list['u'][$to_user_id] = 'to'; + } + else if ($to_group_id && $action == 'post') + { + $address_list['g'][$to_group_id] = 'to'; + } + $check_value = 0; + } + + if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group'))) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_GROUP_MESSAGE'); + } + + if ($action == 'edit' && !$refresh && !$preview && !$submit) + { + if (!($message_time > time() - ($config['pm_edit_time'] * 60) || !$config['pm_edit_time'])) + { + trigger_error('CANNOT_EDIT_MESSAGE_TIME'); + } + } + + if ($action == 'post') + { + $template->assign_var('S_NEW_MESSAGE', true); + } + + if (!isset($icon_id)) + { + $icon_id = 0; + } + + /* @var $plupload \phpbb\plupload\plupload */ + $plupload = $phpbb_container->get('plupload'); + $message_parser = new parse_message(); + $message_parser->set_plupload($plupload); + + $message_parser->message = ($action == 'reply') ? '' : $message_text; + unset($message_text); + + $s_action = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=$mode&action=$action", true, $user->session_id); + $s_action .= (($folder_id) ? "&f=$folder_id" : '') . (($msg_id) ? "&p=$msg_id" : ''); + + // Delete triggered ? + if ($action == 'delete') + { + // Folder id has been determined by the SQL Statement + // $folder_id = $request->variable('f', PRIVMSGS_NO_BOX); + + // Do we need to confirm ? + if (confirm_box(true)) + { + delete_pm($user->data['user_id'], $msg_id, $folder_id); + + // jump to next message in "history"? nope, not for the moment. But able to be included later. + $meta_info = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&folder=$folder_id"); + $message = $user->lang['MESSAGE_DELETED']; + + meta_refresh(3, $meta_info); + $message .= '

' . sprintf($user->lang['RETURN_FOLDER'], '', ''); + trigger_error($message); + } + else + { + $s_hidden_fields = array( + 'p' => $msg_id, + 'f' => $folder_id, + 'action' => 'delete' + ); + + // "{$phpbb_root_path}ucp.$phpEx?i=pm&mode=compose" + confirm_box(false, 'DELETE_MESSAGE', build_hidden_fields($s_hidden_fields)); + } + + redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id)); + } + + // Get maximum number of allowed recipients + $max_recipients = phpbb_get_max_setting_from_group($db, $user->data['user_id'], 'max_recipients'); + + // If it is 0, there is no limit set and we use the maximum value within the config. + $max_recipients = (!$max_recipients) ? $config['pm_max_recipients'] : $max_recipients; + + // If this is a quote/reply "to all"... we may increase the max_recpients to the number of original recipients + if (($action == 'reply' || $action == 'quote') && $max_recipients && $reply_to_all) + { + // We try to include every previously listed member from the TO Header + $list = rebuild_header(array('to' => $post['to_address'])); + + // Can be an empty array too ;) + $list = (!empty($list['u'])) ? $list['u'] : array(); + $list[$post['author_id']] = 'to'; + + if (isset($list[$user->data['user_id']])) + { + unset($list[$user->data['user_id']]); + } + + $max_recipients = ($max_recipients < count($list)) ? count($list) : $max_recipients; + + unset($list); + } + + // Handle User/Group adding/removing + handle_message_list_actions($address_list, $error, $remove_u, $remove_g, $add_to, $add_bcc); + + // Check mass pm to group permission + if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group')) && !empty($address_list['g'])) + { + $address_list = array(); + $error[] = $user->lang['NO_AUTH_GROUP_MESSAGE']; + } + + // Check mass pm to users permission + if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1) + { + $address_list = get_recipients($address_list, 1); + $error[] = $user->lang('TOO_MANY_RECIPIENTS', 1); + } + + // Check for too many recipients + if (!empty($address_list['u']) && $max_recipients && count($address_list['u']) > $max_recipients) + { + $address_list = get_recipients($address_list, $max_recipients); + $error[] = $user->lang('TOO_MANY_RECIPIENTS', $max_recipients); + } + + // Always check if the submitted attachment data is valid and belongs to the user. + // Further down (especially in submit_post()) we do not check this again. + $message_parser->get_submitted_attachment_data(); + + if ($message_attachment && !$submit && !$refresh && !$preview && $action == 'edit') + { + // Do not change to SELECT * + $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename, filesize + FROM ' . ATTACHMENTS_TABLE . " + WHERE post_msg_id = $msg_id + AND in_message = 1 + AND is_orphan = 0 + ORDER BY filetime DESC"; + $result = $db->sql_query($sql); + $message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result)); + $db->sql_freeresult($result); + } + + if (!in_array($action, array('quote', 'edit', 'delete', 'forward'))) + { + $enable_sig = ($config['allow_sig'] && $config['allow_sig_pm'] && $auth->acl_get('u_sig') && $user->optionget('attachsig')); + $enable_smilies = ($config['allow_smilies'] && $auth->acl_get('u_pm_smilies') && $user->optionget('smilies')); + $enable_bbcode = ($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode') && $user->optionget('bbcode')); + $enable_urls = true; + } + + $drafts = false; + + // User own some drafts? + if ($auth->acl_get('u_savedrafts') && $action != 'delete') + { + $sql = 'SELECT draft_id + FROM ' . DRAFTS_TABLE . ' + WHERE forum_id = 0 + AND topic_id = 0 + AND user_id = ' . $user->data['user_id'] . + (($draft_id) ? " AND draft_id <> $draft_id" : ''); + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $drafts = true; + } + } + + if ($action == 'edit') + { + $message_parser->bbcode_uid = $bbcode_uid; + } + + $bbcode_status = ($config['allow_bbcode'] && $config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode')) ? true : false; + $smilies_status = ($config['allow_smilies'] && $config['auth_smilies_pm'] && $auth->acl_get('u_pm_smilies')) ? true : false; + $img_status = ($config['auth_img_pm'] && $auth->acl_get('u_pm_img')) ? true : false; + $flash_status = ($config['auth_flash_pm'] && $auth->acl_get('u_pm_flash')) ? true : false; + $url_status = ($config['allow_post_links']) ? true : false; + + // Save Draft + if ($save && $auth->acl_get('u_savedrafts')) + { + $subject = $request->variable('subject', '', true); + $subject = (!$subject && $action != 'post') ? $user->lang['NEW_MESSAGE'] : $subject; + $message = $request->variable('message', '', true); + + if ($subject && $message) + { + if (confirm_box(true)) + { + $message_parser->message = $message; + $message_parser->parse($bbcode_status, $url_status, $smilies_status, $img_status, $flash_status, true, $url_status); + + $sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'user_id' => $user->data['user_id'], + 'topic_id' => 0, + 'forum_id' => 0, + 'save_time' => $current_time, + 'draft_subject' => $subject, + 'draft_message' => $message_parser->message, + ) + ); + $db->sql_query($sql); + + $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=$mode"); + + meta_refresh(3, $redirect_url); + $message = $user->lang['DRAFT_SAVED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + + trigger_error($message); + } + else + { + $s_hidden_fields = build_hidden_fields(array( + 'mode' => $mode, + 'action' => $action, + 'save' => true, + 'subject' => $subject, + 'message' => $message, + 'u' => $to_user_id, + 'g' => $to_group_id, + 'p' => $msg_id) + ); + $s_hidden_fields .= build_address_field($address_list); + + confirm_box(false, 'SAVE_DRAFT', $s_hidden_fields); + } + } + else + { + if (utf8_clean_string($subject) === '') + { + $error[] = $user->lang['EMPTY_MESSAGE_SUBJECT']; + } + + if (utf8_clean_string($message) === '') + { + $error[] = $user->lang['TOO_FEW_CHARS']; + } + } + + unset($subject, $message); + } + + // Load Draft + if ($draft_id && $auth->acl_get('u_savedrafts')) + { + $sql = 'SELECT draft_subject, draft_message + FROM ' . DRAFTS_TABLE . " + WHERE draft_id = $draft_id + AND topic_id = 0 + AND forum_id = 0 + AND user_id = " . $user->data['user_id']; + $result = $db->sql_query_limit($sql, 1); + + if ($row = $db->sql_fetchrow($result)) + { + $message_parser->message = $row['draft_message']; + $message_subject = $row['draft_subject']; + + $template->assign_var('S_DRAFT_LOADED', true); + } + else + { + $draft_id = 0; + } + $db->sql_freeresult($result); + } + + // Load Drafts + if ($load && $drafts) + { + load_drafts(0, 0, $id, $action, $msg_id); + } + + if ($submit || $preview || $refresh) + { + if (($submit || $preview) && !check_form_key('ucp_pm_compose')) + { + $error[] = $user->lang['FORM_INVALID']; + } + $subject = $request->variable('subject', '', true); + $message_parser->message = $request->variable('message', '', true); + + $icon_id = $request->variable('icon', 0); + + $enable_bbcode = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true; + $enable_smilies = (!$smilies_status || isset($_POST['disable_smilies'])) ? false : true; + $enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1; + $enable_sig = (!$config['allow_sig'] ||!$config['allow_sig_pm']) ? false : ((isset($_POST['attach_sig'])) ? true : false); + + /** + * Modify private message + * + * @event core.ucp_pm_compose_modify_parse_before + * @var bool enable_bbcode Whether or not bbcode is enabled + * @var bool enable_smilies Whether or not smilies are enabled + * @var bool enable_urls Whether or not urls are enabled + * @var bool enable_sig Whether or not signature is enabled + * @var string subject PM subject text + * @var object message_parser The message parser object + * @var bool submit Whether or not the form has been sumitted + * @var bool preview Whether or not the signature is being previewed + * @var array error Any error strings + * @since 3.1.10-RC1 + */ + $vars = array( + 'enable_bbcode', + 'enable_smilies', + 'enable_urls', + 'enable_sig', + 'subject', + 'message_parser', + 'submit', + 'preview', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_modify_parse_before', compact($vars))); + + // Parse Attachments - before checksum is calculated + if ($message_parser->check_attachment_form_token($language, $request, 'ucp_pm_compose')) + { + $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); + } + + if (count($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) + { + $error[] = implode('
', $message_parser->warn_msg); + $message_parser->warn_msg = array(); + } + + // Parse message + $message_parser->parse($enable_bbcode, ($config['allow_post_links']) ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']); + + // On a refresh we do not care about message parsing errors + if (count($message_parser->warn_msg) && !$refresh) + { + $error[] = implode('
', $message_parser->warn_msg); + } + + if ($action != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('u_ignoreflood')) + { + // Flood check + $last_post_time = $user->data['user_lastpost_time']; + + if ($last_post_time) + { + if ($last_post_time && ($current_time - $last_post_time) < intval($config['flood_interval'])) + { + $error[] = $user->lang['FLOOD_ERROR']; + } + } + } + + // Subject defined + if ($submit) + { + if (utf8_clean_string($subject) === '') + { + $error[] = $user->lang['EMPTY_MESSAGE_SUBJECT']; + } + + if (!count($address_list)) + { + $error[] = $user->lang['NO_RECIPIENT']; + } + } + + // Store message, sync counters + if (!count($error) && $submit) + { + $pm_data = array( + 'msg_id' => (int) $msg_id, + 'from_user_id' => $user->data['user_id'], + 'from_user_ip' => $user->ip, + 'from_username' => $user->data['username'], + 'reply_from_root_level' => (isset($post['root_level'])) ? (int) $post['root_level'] : 0, + 'reply_from_msg_id' => (int) $msg_id, + 'icon_id' => (int) $icon_id, + 'enable_sig' => (bool) $enable_sig, + 'enable_bbcode' => (bool) $enable_bbcode, + 'enable_smilies' => (bool) $enable_smilies, + 'enable_urls' => (bool) $enable_urls, + 'bbcode_bitfield' => $message_parser->bbcode_bitfield, + 'bbcode_uid' => $message_parser->bbcode_uid, + 'message' => $message_parser->message, + 'attachment_data' => $message_parser->attachment_data, + 'filename_data' => $message_parser->filename_data, + 'address_list' => $address_list + ); + + // ((!$message_subject) ? $subject : $message_subject) + $msg_id = submit_pm($action, $subject, $pm_data); + + $return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&p=' . $msg_id); + $inbox_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'); + $outbox_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=outbox'); + + $folder_url = ''; + if (($folder_id > 0) && isset($user_folders[$folder_id])) + { + $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $folder_id); + } + + $return_box_url = ($action === 'post' || $action === 'edit') ? $outbox_folder_url : $inbox_folder_url; + $return_box_lang = ($action === 'post' || $action === 'edit') ? 'PM_OUTBOX' : 'PM_INBOX'; + + $save_message = ($action === 'edit') ? $user->lang['MESSAGE_EDITED'] : $user->lang['MESSAGE_STORED']; + $message = $save_message . '

' . $user->lang('VIEW_PRIVATE_MESSAGE', '', ''); + + $last_click_type = 'CLICK_RETURN_FOLDER'; + if ($folder_url) + { + $message .= '

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user_folders[$folder_id]['folder_name']); + $last_click_type = 'CLICK_GOTO_FOLDER'; + } + $message .= '

' . sprintf($user->lang[$last_click_type], '', '', $user->lang[$return_box_lang]); + + meta_refresh(3, $return_message_url); + trigger_error($message); + } + + $message_subject = $subject; + } + + // Preview + if (!count($error) && $preview) + { + $preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false); + + $preview_signature = $user->data['user_sig']; + $preview_signature_uid = $user->data['user_sig_bbcode_uid']; + $preview_signature_bitfield = $user->data['user_sig_bbcode_bitfield']; + + // Signature + if ($enable_sig && $config['allow_sig'] && $preview_signature) + { + $bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0); + $preview_signature = generate_text_for_display($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $bbcode_flags); + } + else + { + $preview_signature = ''; + } + + // Attachment Preview + if (count($message_parser->attachment_data)) + { + $template->assign_var('S_HAS_ATTACHMENTS', true); + + $update_count = array(); + $attachment_data = $message_parser->attachment_data; + + parse_attachments(false, $preview_message, $attachment_data, $update_count, true); + + foreach ($attachment_data as $i => $attachment) + { + $template->assign_block_vars('attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + unset($attachment_data); + } + + $preview_subject = censor_text($subject); + + if (!count($error)) + { + $template->assign_vars(array( + 'PREVIEW_SUBJECT' => $preview_subject, + 'PREVIEW_MESSAGE' => $preview_message, + 'PREVIEW_SIGNATURE' => $preview_signature, + + 'S_DISPLAY_PREVIEW' => true) + ); + } + unset($message_text); + } + + // Decode text for message display + $bbcode_uid = (($action == 'quote' || $action == 'forward') && !$preview && !$refresh && (!count($error) || (count($error) && !$submit))) ? $bbcode_uid : $message_parser->bbcode_uid; + + $message_parser->decode_message($bbcode_uid); + + if (($action == 'quote' || $action == 'quotepost') && !$preview && !$refresh && !$submit) + { + if ($action == 'quotepost') + { + $post_id = $request->variable('p', 0); + if ($config['allow_post_links']) + { + $message_link = generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}"; + $message_link_subject = "{$user->lang['SUBJECT']}{$user->lang['COLON']} {$message_subject}"; + if ($bbcode_status) + { + $message_link = "[url=" . $message_link . "]" . $message_link_subject . "[/url]\n\n"; + } + else + { + $message_link = $message_link . " - " . $message_link_subject . "\n\n"; + } + } + else + { + $message_link = $user->lang['SUBJECT'] . $user->lang['COLON'] . ' ' . $message_subject . " (" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id})\n\n"; + } + } + else + { + $message_link = ''; + } + $quote_attributes = array( + 'author' => $quote_username, + 'time' => $post['message_time'], + 'user_id' => $post['author_id'], + ); + if ($action === 'quotepost') + { + $quote_attributes['post_id'] = $post['msg_id']; + } + if ($action === 'quote') + { + $quote_attributes['msg_id'] = $post['msg_id']; + } + /** @var \phpbb\language\language $language */ + $language = $phpbb_container->get('language'); + /** @var \phpbb\textformatter\utils_interface $text_formatter_utils */ + $text_formatter_utils = $phpbb_container->get('text_formatter.utils'); + phpbb_format_quote($language, $message_parser, $text_formatter_utils, $bbcode_status, $quote_attributes, $message_link); + } + + if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh) + { + $message_subject = ((!preg_match('/^Re:/', $message_subject)) ? 'Re: ' : '') . censor_text($message_subject); + + /** + * This event allows you to modify the PM subject of the PM being quoted + * + * @event core.pm_modify_message_subject + * @var string message_subject String with the PM subject already censored. + * @since 3.2.8-RC1 + */ + $vars = array('message_subject'); + extract($phpbb_dispatcher->trigger_event('core.pm_modify_message_subject', compact($vars))); + } + + if ($action == 'forward' && !$preview && !$refresh && !$submit) + { + $fwd_to_field = write_pm_addresses(array('to' => $post['to_address']), 0, true); + + if ($config['allow_post_links']) + { + $quote_username_text = '[url=' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]"; + } + else + { + $quote_username_text = $quote_username . ' (' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']})"; + } + + $forward_text = array(); + $forward_text[] = $user->lang['FWD_ORIGINAL_MESSAGE']; + $forward_text[] = sprintf($user->lang['FWD_SUBJECT'], censor_text($message_subject)); + $forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time, false, true)); + $forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text); + $forward_text[] = sprintf($user->lang['FWD_TO'], implode($user->lang['COMMA_SEPARATOR'], $fwd_to_field['to'])); + + $quote_text = $phpbb_container->get('text_formatter.utils')->generate_quote( + censor_text($message_parser->message), + array('author' => $quote_username) + ); + $message_parser->message = implode("\n", $forward_text) . "\n\n" . $quote_text; + $message_subject = ((!preg_match('/^Fwd:/', $message_subject)) ? 'Fwd: ' : '') . censor_text($message_subject); + } + + $attachment_data = $message_parser->attachment_data; + $filename_data = $message_parser->filename_data; + $message_text = $message_parser->message; + + // MAIN PM PAGE BEGINS HERE + + // Generate smiley listing + generate_smilies('inline', 0); + + // Generate PM Icons + $s_pm_icons = false; + if ($config['enable_pm_icons']) + { + $s_pm_icons = posting_gen_topic_icons($action, $icon_id); + } + + // Generate inline attachment select box + posting_gen_inline_attachments($attachment_data); + + // Build address list for display + // array('u' => array($author_id => 'to')); + if (count($address_list)) + { + // Get Usernames and Group Names + $result = array(); + if (!empty($address_list['u'])) + { + $sql = 'SELECT user_id as id, username as name, user_colour as colour + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', array_map('intval', array_keys($address_list['u']))) . ' + ORDER BY username_clean ASC'; + $result['u'] = $db->sql_query($sql); + } + + if (!empty($address_list['g'])) + { + $sql = 'SELECT g.group_id AS id, g.group_name AS name, g.group_colour AS colour, g.group_type + FROM ' . GROUPS_TABLE . ' g'; + + if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) + { + $sql .= ' LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + } + + $sql .= ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' WHERE ' : ' AND '; + + $sql .= 'g.group_receive_pm = 1 + AND ' . $db->sql_in_set('g.group_id', array_map('intval', array_keys($address_list['g']))) . ' + ORDER BY g.group_name ASC'; + + $result['g'] = $db->sql_query($sql); + } + + $u = $g = array(); + $_types = array('u', 'g'); + foreach ($_types as $type) + { + if (isset($result[$type]) && $result[$type]) + { + while ($row = $db->sql_fetchrow($result[$type])) + { + if ($type == 'g') + { + $row['name'] = $group_helper->get_name($row['name']); + } + + ${$type}[$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); + } + $db->sql_freeresult($result[$type]); + } + } + + // Now Build the address list + foreach ($address_list as $type => $adr_ary) + { + foreach ($adr_ary as $id => $field) + { + if (!isset(${$type}[$id])) + { + unset($address_list[$type][$id]); + continue; + } + + $field = ($field == 'to') ? 'to' : 'bcc'; + $type = ($type == 'u') ? 'u' : 'g'; + $id = (int) $id; + + $tpl_ary = array( + 'IS_GROUP' => ($type == 'g') ? true : false, + 'IS_USER' => ($type == 'u') ? true : false, + 'UG_ID' => $id, + 'NAME' => ${$type}[$id]['name'], + 'COLOUR' => (${$type}[$id]['colour']) ? '#' . ${$type}[$id]['colour'] : '', + 'TYPE' => $type, + ); + + if ($type == 'u') + { + $tpl_ary = array_merge($tpl_ary, array( + 'U_VIEW' => get_username_string('profile', $id, ${$type}[$id]['name'], ${$type}[$id]['colour']), + 'NAME_FULL' => get_username_string('full', $id, ${$type}[$id]['name'], ${$type}[$id]['colour']), + )); + } + else + { + $tpl_ary = array_merge($tpl_ary, array( + 'U_VIEW' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $id), + )); + } + + $template->assign_block_vars($field . '_recipient', $tpl_ary); + } + } + } + + // Build hidden address list + $s_hidden_address_field = build_address_field($address_list); + + $bbcode_checked = (isset($enable_bbcode)) ? !$enable_bbcode : (($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode')) ? !$user->optionget('bbcode') : 1); + $smilies_checked = (isset($enable_smilies)) ? !$enable_smilies : (($config['allow_smilies'] && $auth->acl_get('u_pm_smilies')) ? !$user->optionget('smilies') : 1); + $urls_checked = (isset($enable_urls)) ? !$enable_urls : 0; + $sig_checked = $enable_sig; + + switch ($action) + { + case 'post': + $page_title = $user->lang['POST_NEW_PM']; + break; + + case 'quote': + $page_title = $user->lang['POST_QUOTE_PM']; + break; + + case 'quotepost': + $page_title = $user->lang['POST_PM_POST']; + break; + + case 'reply': + $page_title = $user->lang['POST_REPLY_PM']; + break; + + case 'edit': + $page_title = $user->lang['POST_EDIT_PM']; + break; + + case 'forward': + $page_title = $user->lang['POST_FORWARD_PM']; + break; + + default: + trigger_error('NO_ACTION_MODE', E_USER_ERROR); + break; + } + + $s_hidden_fields = (isset($check_value)) ? '' : ''; + $s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '' : ''; + + $form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"'; + + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + + // Start assigning vars for main posting page ... + $template_ary = array( + 'L_POST_A' => $page_title, + 'L_ICON' => $user->lang['PM_ICON'], + 'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']), + + 'SUBJECT' => (isset($message_subject)) ? $message_subject : '', + 'MESSAGE' => $message_text, + 'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), + 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], + 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'MAX_RECIPIENTS' => ($config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0, + + 'S_COMPOSE_PM' => true, + 'S_EDIT_POST' => ($action == 'edit'), + 'S_SHOW_PM_ICONS' => $s_pm_icons, + 'S_BBCODE_ALLOWED' => ($bbcode_status) ? 1 : 0, + 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', + 'S_SMILIES_ALLOWED' => $smilies_status, + 'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '', + 'S_SIG_ALLOWED' => ($config['allow_sig'] && $config['allow_sig_pm'] && $auth->acl_get('u_sig')), + 'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '', + 'S_LINKS_ALLOWED' => $url_status, + 'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '', + 'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $action != 'edit') ? true : false, + 'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $drafts), + 'S_FORM_ENCTYPE' => $form_enctype, + 'S_ATTACH_DATA' => json_encode($message_parser->attachment_data), + + 'S_BBCODE_IMG' => $img_status, + 'S_BBCODE_FLASH' => $flash_status, + 'S_BBCODE_QUOTE' => true, + 'S_BBCODE_URL' => $url_status, + + 'S_POST_ACTION' => $s_action, + 'S_HIDDEN_ADDRESS_FIELD' => $s_hidden_address_field, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + + 'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']), + 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup'), + 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup')), + ); + + /** + * Modify the default template vars + * + * @event core.ucp_pm_compose_template + * @var array template_ary Template variables + * @since 3.2.6-RC1 + */ + $vars = array('template_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_template', compact($vars))); + + $template->assign_vars($template_ary); + + // Build custom bbcodes array + display_custom_bbcodes(); + + // Show attachment box for adding attachments if true + $allowed = ($auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype); + + if ($allowed) + { + $max_files = ($auth->acl_gets('a_', 'm_')) ? 0 : (int) $config['max_attachments_pm']; + $plupload->configure($cache, $template, $s_action, false, $max_files); + } + + // Attachment entry + posting_gen_attachment_entry($attachment_data, $filename_data, $allowed); + + // Message History + if ($action == 'reply' || $action == 'quote' || $action == 'forward') + { + if (message_history($msg_id, $user->data['user_id'], $post, array(), true)) + { + $template->assign_var('S_DISPLAY_HISTORY', true); + } + } +} + +/** +* For composing messages, handle list actions +*/ +function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove_g, $add_to, $add_bcc) +{ + global $auth, $db, $user; + global $request, $phpbb_dispatcher; + + // Delete User [TO/BCC] + if ($remove_u && $request->variable('remove_u', array(0 => ''))) + { + $remove_user_id = array_keys($request->variable('remove_u', array(0 => ''))); + + if (isset($remove_user_id[0])) + { + unset($address_list['u'][(int) $remove_user_id[0]]); + } + } + + // Delete Group [TO/BCC] + if ($remove_g && $request->variable('remove_g', array(0 => ''))) + { + $remove_group_id = array_keys($request->variable('remove_g', array(0 => ''))); + + if (isset($remove_group_id[0])) + { + unset($address_list['g'][(int) $remove_group_id[0]]); + } + } + + // Add Selected Groups + $group_list = $request->variable('group_list', array(0)); + + // Build usernames to add + $usernames = $request->variable('username', '', true); + $usernames = (empty($usernames)) ? array() : array($usernames); + + $username_list = $request->variable('username_list', '', true); + if ($username_list) + { + $usernames = array_merge($usernames, explode("\n", $username_list)); + } + + // If add to or add bcc not pressed, users could still have usernames listed they want to add... + if (!$add_to && !$add_bcc && (count($group_list) || count($usernames))) + { + $add_to = true; + + global $refresh, $submit, $preview; + + $refresh = true; + $submit = false; + + // Preview is only true if there was also a message entered + if ($request->variable('message', '')) + { + $preview = true; + } + } + + // Add User/Group [TO] + if ($add_to || $add_bcc) + { + $type = ($add_to) ? 'to' : 'bcc'; + + if (count($group_list)) + { + foreach ($group_list as $group_id) + { + $address_list['g'][$group_id] = $type; + } + } + + // User ID's to add... + $user_id_ary = array(); + + // Reveal the correct user_ids + if (count($usernames)) + { + $user_id_ary = array(); + user_get_id_name($user_id_ary, $usernames, array(USER_NORMAL, USER_FOUNDER, USER_INACTIVE)); + + // If there are users not existing, we will at least print a notice... + if (!count($user_id_ary)) + { + $error[] = $user->lang['PM_NO_USERS']; + } + } + + // Add Friends if specified + $friend_list = array_keys($request->variable('add_' . $type, array(0))); + $user_id_ary = array_merge($user_id_ary, $friend_list); + + foreach ($user_id_ary as $user_id) + { + if ($user_id == ANONYMOUS) + { + continue; + } + + $address_list['u'][$user_id] = $type; + } + } + + // Check for disallowed recipients + if (!empty($address_list['u'])) + { + $can_ignore_allow_pm = $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'); + + // Administrator deactivated users check and we need to check their + // PM status (do they want to receive PM's?) + // Only check PM status if not a moderator or admin, since they + // are allowed to override this user setting + $sql = 'SELECT user_id, user_allow_pm + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', array_keys($address_list['u'])) . ' + AND ( + (user_type = ' . USER_INACTIVE . ' + AND user_inactive_reason = ' . INACTIVE_MANUAL . ') + ' . ($can_ignore_allow_pm ? '' : ' OR user_allow_pm = 0') . ' + )'; + + $result = $db->sql_query($sql); + + $removed_no_pm = $removed_no_permission = false; + while ($row = $db->sql_fetchrow($result)) + { + if (!$can_ignore_allow_pm && !$row['user_allow_pm']) + { + $removed_no_pm = true; + } + else + { + $removed_no_permission = true; + } + + unset($address_list['u'][$row['user_id']]); + } + $db->sql_freeresult($result); + + // print a notice about users not being added who do not want to receive pms + if ($removed_no_pm) + { + $error[] = $user->lang['PM_USERS_REMOVED_NO_PM']; + } + + // print a notice about users not being added who do not have permission to receive PMs + if ($removed_no_permission) + { + $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; + } + + if (!count(array_keys($address_list['u']))) + { + return; + } + + // Check if users have permission to read PMs + $can_read = $auth->acl_get_list(array_keys($address_list['u']), 'u_readpm'); + $can_read = (empty($can_read) || !isset($can_read[0]['u_readpm'])) ? array() : $can_read[0]['u_readpm']; + $cannot_read_list = array_diff(array_keys($address_list['u']), $can_read); + if (!empty($cannot_read_list)) + { + foreach ($cannot_read_list as $cannot_read) + { + unset($address_list['u'][$cannot_read]); + } + + $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; + } + + // Check if users are banned + $banned_user_list = phpbb_get_banned_user_ids(array_keys($address_list['u']), false); + if (!empty($banned_user_list)) + { + foreach ($banned_user_list as $banned_user) + { + unset($address_list['u'][$banned_user]); + } + + $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; + } + } + + /** + * Event for additional message list actions + * + * @event core.message_list_actions + * @var array address_list The assoc array with the recipient user/group ids + * @var array error The array containing error data + * @var bool remove_u The variable for removing a user + * @var bool remove_g The variable for removing a group + * @var bool add_to The variable for adding a user to the [TO] field + * @var bool add_bcc The variable for adding a user to the [BCC] field + * @since 3.2.4-RC1 + */ + $vars = array('address_list', 'error', 'remove_u', 'remove_g', 'add_to', 'add_bcc'); + extract($phpbb_dispatcher->trigger_event('core.message_list_actions', compact($vars))); +} + +/** +* Build the hidden field for the recipients. Needed, as the variable is not read via $request->variable(). +*/ +function build_address_field($address_list) +{ + $s_hidden_address_field = ''; + foreach ($address_list as $type => $adr_ary) + { + foreach ($adr_ary as $id => $field) + { + $s_hidden_address_field .= ''; + } + } + return $s_hidden_address_field; +} + +/** +* Return number of private message recipients +*/ +function num_recipients($address_list) +{ + $num_recipients = 0; + + foreach ($address_list as $field => $adr_ary) + { + $num_recipients += count($adr_ary); + } + + return $num_recipients; +} + +/** +* Get number of 'num_recipients' recipients from first position +*/ +function get_recipients($address_list, $num_recipients = 1) +{ + $recipient = array(); + + $count = 0; + foreach ($address_list as $field => $adr_ary) + { + foreach ($adr_ary as $id => $type) + { + if ($count >= $num_recipients) + { + break 2; + } + $recipient[$field][$id] = $type; + $count++; + } + } + + return $recipient; +} diff --git a/install/update/new/includes/ucp/ucp_pm_viewfolder.php b/install/update/new/includes/ucp/ucp_pm_viewfolder.php new file mode 100644 index 0000000..ce40a25 --- /dev/null +++ b/install/update/new/includes/ucp/ucp_pm_viewfolder.php @@ -0,0 +1,611 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* View message folder +* Called from ucp_pm with mode == 'view' && action == 'view_folder' +*/ +function view_folder($id, $mode, $folder_id, $folder) +{ + global $user, $template, $auth, $db, $cache, $request; + global $phpbb_root_path, $config, $phpEx; + + $submit_export = (isset($_POST['submit_export'])) ? true : false; + + $folder_info = get_pm_from($folder_id, $folder, $user->data['user_id']); + + add_form_key('ucp_pm_view_folder'); + + if (!$submit_export) + { + $user->add_lang('viewforum'); + + // Grab icons + $icons = $cache->obtain_icons(); + + $color_rows = array('message_reported', 'marked', 'replied'); + + $_module = new p_master(); + $_module->list_modules('ucp'); + $_module->set_active('zebra'); + + $zebra_enabled = ($_module->active_module === false) ? false : true; + + unset($_module); + + if ($zebra_enabled) + { + $color_rows = array_merge($color_rows, array('friend', 'foe')); + } + + foreach ($color_rows as $var) + { + $template->assign_block_vars('pm_colour_info', array( + 'IMG' => $user->img("pm_{$var}", ''), + 'CLASS' => "pm_{$var}_colour", + 'LANG' => $user->lang[strtoupper($var) . '_MESSAGE']) + ); + } + + $mark_options = array('mark_important', 'delete_marked'); + + // Minimise edits + if (!$auth->acl_get('u_pm_delete') && $key = array_search('delete_marked', $mark_options)) + { + unset($mark_options[$key]); + } + + $s_mark_options = ''; + foreach ($mark_options as $mark_option) + { + $s_mark_options .= ''; + } + + // We do the folder moving options here too, for template authors to use... + $s_folder_move_options = ''; + if ($folder_id != PRIVMSGS_NO_BOX && $folder_id != PRIVMSGS_OUTBOX) + { + foreach ($folder as $f_id => $folder_ary) + { + if ($f_id == PRIVMSGS_OUTBOX || $f_id == PRIVMSGS_SENTBOX || $f_id == $folder_id) + { + continue; + } + + $s_folder_move_options .= ''; + $s_folder_move_options .= sprintf($user->lang['MOVE_MARKED_TO_FOLDER'], $folder_ary['folder_name']); + $s_folder_move_options .= (($folder_ary['unread_messages']) ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . ''; + } + } + $friend = $foe = array(); + + // Get friends and foes + $sql = 'SELECT * + FROM ' . ZEBRA_TABLE . ' + WHERE user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $friend[$row['zebra_id']] = $row['friend']; + $foe[$row['zebra_id']] = $row['foe']; + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_MARK_OPTIONS' => $s_mark_options, + 'S_MOVE_MARKED_OPTIONS' => $s_folder_move_options) + ); + + // Okay, lets dump out the page ... + if (count($folder_info['pm_list'])) + { + $address_list = array(); + + // Build Recipient List if in outbox/sentbox - max two additional queries + if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) + { + $address_list = get_recipient_strings($folder_info['rowset']); + } + + foreach ($folder_info['pm_list'] as $message_id) + { + $row = &$folder_info['rowset'][$message_id]; + + $folder_img = ($row['pm_unread']) ? 'pm_unread' : 'pm_read'; + $folder_alt = ($row['pm_unread']) ? 'NEW_MESSAGES' : 'NO_NEW_MESSAGES'; + + // Generate all URIs ... + $view_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=view&f=$folder_id&p=$message_id"); + $remove_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&action=delete&p=$message_id"); + + $row_indicator = ''; + foreach ($color_rows as $var) + { + if (($var !== 'friend' && $var !== 'foe' && $row[($var === 'message_reported') ? $var : "pm_{$var}"]) + || + (($var === 'friend' || $var === 'foe') && isset(${$var}[$row['author_id']]) && ${$var}[$row['author_id']])) + { + $row_indicator = $var; + break; + } + } + + // Send vars to template + $template->assign_block_vars('messagerow', array( + 'PM_CLASS' => ($row_indicator) ? 'pm_' . $row_indicator . '_colour' : '', + + 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $row['author_id'], $row['username'], $row['user_colour'], $row['username']), + 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $row['author_id'], $row['username'], $row['user_colour'], $row['username']), + 'MESSAGE_AUTHOR' => get_username_string('username', $row['author_id'], $row['username'], $row['user_colour'], $row['username']), + 'U_MESSAGE_AUTHOR' => get_username_string('profile', $row['author_id'], $row['username'], $row['user_colour'], $row['username']), + + 'FOLDER_ID' => $folder_id, + 'MESSAGE_ID' => $message_id, + 'SENT_TIME' => $user->format_date($row['message_time']), + 'SUBJECT' => censor_text($row['message_subject']), + 'FOLDER' => (isset($folder[$row['folder_id']])) ? $folder[$row['folder_id']]['folder_name'] : '', + 'U_FOLDER' => (isset($folder[$row['folder_id']])) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'folder=' . $row['folder_id']) : '', + 'PM_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '' : '', + 'PM_ICON_URL' => (!empty($icons[$row['icon_id']])) ? $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] : '', + 'FOLDER_IMG' => $user->img($folder_img, $folder_alt), + 'FOLDER_IMG_STYLE' => $folder_img, + 'PM_IMG' => ($row_indicator) ? $user->img('pm_' . $row_indicator, '') : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_pm_download') && $row['message_attachment'] && $config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + + 'S_PM_UNREAD' => ($row['pm_unread']) ? true : false, + 'S_PM_DELETED' => ($row['pm_deleted']) ? true : false, + 'S_PM_REPORTED' => (isset($row['report_id'])) ? true : false, + 'S_AUTHOR_DELETED' => ($row['author_id'] == ANONYMOUS) ? true : false, + + 'U_VIEW_PM' => ($row['pm_deleted']) ? '' : $view_message_url, + 'U_REMOVE_PM' => ($row['pm_deleted']) ? $remove_message_url : '', + 'U_MCP_REPORT' => (isset($row['report_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&mode=pm_report_details&r=' . $row['report_id']) : '', + 'RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? implode($user->lang['COMMA_SEPARATOR'], $address_list[$message_id]) : '') + ); + } + unset($folder_info['rowset']); + + $template->assign_vars(array( + 'S_SHOW_RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? true : false, + 'S_SHOW_COLOUR_LEGEND' => true, + + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'PM_REPORTED'), + 'S_PM_ICONS' => ($config['enable_pm_icons']) ? true : false) + ); + } + } + else + { + $export_type = $request->variable('export_option', ''); + $enclosure = $request->variable('enclosure', ''); + $delimiter = $request->variable('delimiter', ''); + + if (!check_form_key('ucp_pm_view_folder')) + { + trigger_error('FORM_INVALID'); + } + + if ($export_type == 'CSV' && ($delimiter === '' || $enclosure === '')) + { + $template->assign_var('PROMPT', true); + } + else + { + // Build Recipient List if in outbox/sentbox + + $address_temp = $address = $data = array(); + + if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) + { + foreach ($folder_info['rowset'] as $message_id => $row) + { + $address_temp[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); + $address[$message_id] = array(); + } + } + + foreach ($folder_info['pm_list'] as $message_id) + { + $row = &$folder_info['rowset'][$message_id]; + + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + + $sql = 'SELECT p.message_text, p.bbcode_uid + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE t.user_id = ' . $user->data['user_id'] . " + AND p.author_id = u.user_id + AND t.folder_id = $folder_id + AND t.msg_id = p.msg_id + AND p.msg_id = $message_id"; + $result = $db->sql_query_limit($sql, 1); + $message_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_types = array('u', 'g'); + foreach ($_types as $ug_type) + { + if (isset($address_temp[$message_id][$ug_type]) && count($address_temp[$message_id][$ug_type])) + { + if (!isset($address[$message_id][$ug_type])) + { + $address[$message_id][$ug_type] = array(); + } + if ($ug_type == 'u') + { + $sql = 'SELECT user_id as id, username as name + FROM ' . USERS_TABLE . ' + WHERE '; + } + else + { + $sql = 'SELECT group_id as id, group_name as name + FROM ' . GROUPS_TABLE . ' + WHERE '; + } + $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address_temp[$message_id][$ug_type]))); + + $result = $db->sql_query($sql); + + while ($info_row = $db->sql_fetchrow($result)) + { + $address[$message_id][$ug_type][$address_temp[$message_id][$ug_type][$info_row['id']]][] = $info_row['name']; + unset($address_temp[$message_id][$ug_type][$info_row['id']]); + } + $db->sql_freeresult($result); + } + } + + // There is the chance that all recipients of the message got deleted. To avoid creating + // exports without recipients, we add a bogus "undisclosed recipient". + if (!(isset($address[$message_id]['g']) && count($address[$message_id]['g'])) && + !(isset($address[$message_id]['u']) && count($address[$message_id]['u']))) + { + $address[$message_id]['u'] = array(); + $address[$message_id]['u']['to'] = array(); + $address[$message_id]['u']['to'][] = $user->lang['UNDISCLOSED_RECIPIENT']; + } + + decode_message($message_row['message_text'], $message_row['bbcode_uid']); + + $data[] = array( + 'subject' => censor_text($row['message_subject']), + 'sender' => $row['username'], + // ISO 8601 date. For PHP4 we are able to hardcode the timezone because $user->format_date() does not set it. + 'date' => $user->format_date($row['message_time'], 'c', true), + 'to' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? $address[$message_id] : '', + 'message' => $message_row['message_text'] + ); + } + + switch ($export_type) + { + case 'CSV': + case 'CSV_EXCEL': + $mimetype = 'text/csv'; + $filetype = 'csv'; + + if ($export_type == 'CSV_EXCEL') + { + $enclosure = '"'; + $delimiter = ','; + $newline = "\r\n"; + } + else + { + $newline = "\n"; + } + + $string = ''; + foreach ($data as $value) + { + $recipients = $value['to']; + $value['to'] = $value['bcc'] = ''; + + if (is_array($recipients)) + { + foreach ($recipients as $values) + { + $value['bcc'] .= (isset($values['bcc']) && is_array($values['bcc'])) ? ',' . implode(',', $values['bcc']) : ''; + $value['to'] .= (isset($values['to']) && is_array($values['to'])) ? ',' . implode(',', $values['to']) : ''; + } + + // Remove the commas which will appear before the first entry. + $value['to'] = substr($value['to'], 1); + $value['bcc'] = substr($value['bcc'], 1); + } + + foreach ($value as $tag => $text) + { + $cell = str_replace($enclosure, $enclosure . $enclosure, $text); + + if (strpos($cell, $enclosure) !== false || strpos($cell, $delimiter) !== false || strpos($cell, $newline) !== false) + { + $string .= $enclosure . $text . $enclosure . $delimiter; + } + else + { + $string .= $cell . $delimiter; + } + } + $string = substr($string, 0, -1) . $newline; + } + break; + + case 'XML': + $mimetype = 'application/xml'; + $filetype = 'xml'; + $string = '' . "\n"; + $string .= "\n"; + + foreach ($data as $value) + { + $string .= "\t\n"; + + if (is_array($value['to'])) + { + foreach ($value['to'] as $key => $values) + { + foreach ($values as $type => $types) + { + foreach ($types as $name) + { + $string .= "\t\t$name\n"; + } + } + } + } + + unset($value['to']); + + foreach ($value as $tag => $text) + { + $string .= "\t\t<$tag>$text\n"; + } + + $string .= "\t\n"; + } + $string .= ''; + break; + } + + header('Cache-Control: private, no-cache'); + header("Content-Type: $mimetype; name=\"data.$filetype\""); + header("Content-disposition: attachment; filename=data.$filetype"); + echo $string; + exit; + } + } +} + +/** +* Get Messages from folder/user +*/ +function get_pm_from($folder_id, $folder, $user_id) +{ + global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $request, $phpbb_dispatcher; + + $start = $request->variable('start', 0); + + // Additional vars later, pm ordering is mostly different from post ordering. :/ + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + // PM ordering options + $limit_days = array(0 => $user->lang['ALL_MESSAGES'], 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']); + + // No sort by Author for sentbox/outbox (already only author available) + // Also, sort by msg_id for the time - private messages are not as prone to errors as posts are. + if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) + { + $sort_by_text = array('t' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_sql = array('t' => 'p.message_time', 's' => array('p.message_subject', 'p.message_time')); + } + else + { + $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_sql = array('a' => array('u.username_clean', 'p.message_time'), 't' => 'p.message_time', 's' => array('p.message_subject', 'p.message_time')); + } + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + $folder_sql = 't.folder_id = ' . (int) $folder_id; + + // Limit pms to certain time frame, obtain correct pm count + if ($sort_days) + { + $min_post_time = time() - ($sort_days * 86400); + + if (isset($_POST['sort'])) + { + $start = 0; + } + + $sql = 'SELECT COUNT(t.msg_id) AS pm_count + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . " p + WHERE $folder_sql + AND t.user_id = $user_id + AND t.msg_id = p.msg_id + AND p.message_time >= $min_post_time"; + $result = $db->sql_query_limit($sql, 1); + $pm_count = (int) $db->sql_fetchfield('pm_count'); + $db->sql_freeresult($result); + + $sql_limit_time = "AND p.message_time >= $min_post_time"; + } + else + { + $pm_count = (!empty($folder[$folder_id]['num_messages'])) ? $folder[$folder_id]['num_messages'] : 0; + $sql_limit_time = ''; + } + + $base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"); + $start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start); + + $template_vars = array( + 'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count), + + 'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'), + + 'S_NO_AUTH_SEND_MESSAGE' => !$auth->acl_get('u_sendpm'), + + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_TOPIC_ICONS' => ($config['enable_pm_icons']) ? true : false, + + 'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose') : '', + 'S_PM_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id" . (($start !== 0) ? "&start=$start" : '')), + ); + + /** + * Modify template variables before they are assigned + * + * @event core.ucp_pm_view_folder_get_pm_from_template + * @var int folder_id Folder ID + * @var array folder Folder data + * @var int user_id User ID + * @var string base_url Pagination base URL + * @var int start Pagination start + * @var int pm_count Count of PMs + * @var array template_vars Template variables to be assigned + * @since 3.1.11-RC1 + */ + $vars = array( + 'folder_id', + 'folder', + 'user_id', + 'base_url', + 'start', + 'pm_count', + 'template_vars', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_template', compact($vars))); + + $template->assign_vars($template_vars); + + // Grab all pm data + $rowset = $pm_list = array(); + + // If the user is trying to reach late pages, start searching from the end + $store_reverse = false; + $sql_limit = $config['topics_per_page']; + if ($start > $pm_count / 2) + { + $store_reverse = true; + + // Select the sort order + $direction = ($sort_dir == 'd') ? 'ASC' : 'DESC'; + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $pm_count); + $sql_start = $pagination->reverse_start($start, $sql_limit, $pm_count); + } + else + { + // Select the sort order + $direction = ($sort_dir == 'd') ? 'DESC' : 'ASC'; + $sql_start = $start; + } + + // Sql sort order + if (is_array($sort_by_sql[$sort_key])) + { + $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; + } + else + { + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; + } + + $sql_ary = array( + 'SELECT' => 't.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported', + 'FROM' => array( + PRIVMSGS_TO_TABLE => 't', + PRIVMSGS_TABLE => 'p', + USERS_TABLE => 'u', + ), + 'WHERE' => "t.user_id = $user_id + AND p.author_id = u.user_id + AND $folder_sql + AND t.msg_id = p.msg_id + $sql_limit_time", + 'ORDER_BY' => $sql_sort_order, + ); + + /** + * Modify SQL before it is executed + * + * @event core.ucp_pm_view_folder_get_pm_from_sql + * @var array sql_ary SQL array + * @var int sql_limit SQL limit + * @var int sql_start SQL start + * @since 3.1.11-RC1 + */ + $vars = array( + 'sql_ary', + 'sql_limit', + 'sql_start', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_sql', compact($vars))); + + $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), $sql_limit, $sql_start); + + $pm_reported = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['msg_id']] = $row; + $pm_list[] = $row['msg_id']; + if ($row['message_reported']) + { + $pm_reported[] = $row['msg_id']; + } + } + $db->sql_freeresult($result); + + // Fetch the report_ids, if there are any reported pms. + if (!empty($pm_reported) && $auth->acl_getf_global('m_report')) + { + $sql = 'SELECT pm_id, report_id + FROM ' . REPORTS_TABLE . ' + WHERE report_closed = 0 + AND ' . $db->sql_in_set('pm_id', $pm_reported); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['pm_id']]['report_id'] = $row['report_id']; + } + $db->sql_freeresult($result); + } + + $pm_list = ($store_reverse) ? array_reverse($pm_list) : $pm_list; + + return array( + 'pm_count' => $pm_count, + 'pm_list' => $pm_list, + 'rowset' => $rowset + ); +} diff --git a/install/update/new/includes/ucp/ucp_profile.php b/install/update/new/includes/ucp/ucp_profile.php new file mode 100644 index 0000000..dca7e7e --- /dev/null +++ b/install/update/new/includes/ucp/ucp_profile.php @@ -0,0 +1,847 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ucp_profile +* Changing profile settings +* +* @todo what about pertaining user_sig_options? +*/ +class ucp_profile +{ + var $u_action; + + function main($id, $mode) + { + global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; + global $request, $phpbb_container, $phpbb_log, $phpbb_dispatcher; + + $user->add_lang('posting'); + + $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); + $error = $data = array(); + $s_hidden_fields = ''; + + switch ($mode) + { + case 'reg_details': + + $data = array( + 'username' => $request->variable('username', $user->data['username'], true), + 'email' => strtolower($request->variable('email', $user->data['user_email'])), + 'new_password' => $request->variable('new_password', '', true), + 'cur_password' => $request->variable('cur_password', '', true), + 'password_confirm' => $request->variable('password_confirm', '', true), + ); + + /** + * Modify user registration data on editing account settings in UCP + * + * @event core.ucp_profile_reg_details_data + * @var array data Array with current or updated user registration data + * @var bool submit Flag indicating if submit button has been pressed + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_data', compact($vars))); + + add_form_key('ucp_reg_details'); + + if ($submit) + { + // Do not check cur_password, it is the old one. + $check_ary = array( + 'new_password' => array( + array('string', true, $config['min_pass_chars'], 0), + array('password')), + 'password_confirm' => array('string', true, $config['min_pass_chars'], 0), + 'email' => array( + array('string', false, 6, 60), + array('user_email')), + ); + + if ($auth->acl_get('u_chgname') && $config['allow_namechange']) + { + $check_ary['username'] = array( + array('string', false, $config['min_name_chars'], $config['max_name_chars']), + array('username'), + ); + } + + $error = validate_data($data, $check_ary); + + if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) + { + $error[] = ($data['password_confirm']) ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY'; + } + + // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + + // Only check the new password against the previous password if there have been no errors + if (!count($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && $passwords_manager->check($data['new_password'], $user->data['user_password'])) + { + $error[] = 'SAME_PASSWORD_ERROR'; + } + + if (!$passwords_manager->check($data['cur_password'], $user->data['user_password'])) + { + $error[] = ($data['cur_password']) ? 'CUR_PASSWORD_ERROR' : 'CUR_PASSWORD_EMPTY'; + } + + if (!check_form_key('ucp_reg_details')) + { + $error[] = 'FORM_INVALID'; + } + + /** + * Validate user data on editing registration data in UCP + * + * @event core.ucp_profile_reg_details_validate + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @var array error Array of any generated errors + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit', 'error'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_validate', compact($vars))); + + if (!count($error)) + { + $sql_ary = array( + 'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'], + 'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'], + 'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'], + 'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? $passwords_manager->hash($data['new_password']) : $user->data['user_password'], + ); + + if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username']) + { + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_NAME', false, array( + 'reportee_id' => $user->data['user_id'], + $user->data['username'], + $data['username'] + )); + } + + if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !$passwords_manager->check($data['new_password'], $user->data['user_password'])) + { + $sql_ary['user_passchg'] = time(); + + $user->reset_login_keys(); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array( + 'reportee_id' => $user->data['user_id'], + $user->data['username'] + )); + } + + if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) + { + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_EMAIL', false, array( + 'reportee_id' => $user->data['user_id'], + $user->data['username'], + $user->data['user_email'], + $data['email'] + )); + } + + $message = 'PROFILE_UPDATED'; + + if ($auth->acl_get('u_chgemail') && $config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN)) + { + $message = ($config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN'; + + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $server_url = generate_board_url(); + + $user_actkey = gen_rand_string(mt_rand(6, 10)); + + $messenger = new messenger(false); + + $template_file = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? 'user_activate_inactive' : 'user_activate'; + $messenger->template($template_file, $user->data['user_lang']); + + $messenger->to($data['email'], $data['username']); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($data['username']), + 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey") + ); + + $messenger->send(NOTIFY_EMAIL); + + if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + { + $notifications_manager = $phpbb_container->get('notification_manager'); + $notifications_manager->add_notifications('notification.type.admin_activate_user', array( + 'user_id' => $user->data['user_id'], + 'user_actkey' => $user_actkey, + 'user_regdate' => time(), // Notification time + )); + } + + user_active_flip('deactivate', $user->data['user_id'], INACTIVE_PROFILE); + + // Because we want the profile to be reactivated we set user_newpasswd to empty (else the reactivation will fail) + $sql_ary['user_actkey'] = $user_actkey; + $sql_ary['user_newpasswd'] = ''; + } + + /** + * Modify user registration data before submitting it to the database + * + * @event core.ucp_profile_reg_details_sql_ary + * @var array data Array with current or updated user registration data + * @var array sql_ary Array with user registration data to submit to the database + * @since 3.1.4-RC1 + */ + $vars = array('data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_sql_ary', compact($vars))); + + if (count($sql_ary)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + } + + // Need to update config, forum, topic, posting, messages, etc. + if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) + { + user_update_name($user->data['username'], $data['username']); + } + + // Now, we can remove the user completely (kill the session) - NOT BEFORE!!! + if (!empty($sql_ary['user_actkey'])) + { + meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx)); + $message = $user->lang[$message] . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + + // Because the user gets deactivated we log him out too, killing his session + $user->session_kill(); + } + else + { + meta_refresh(3, $this->u_action); + $message = $user->lang[$message] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + } + + trigger_error($message); + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + $template->assign_vars(array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + + 'USERNAME' => $data['username'], + 'EMAIL' => $data['email'], + 'PASSWORD_CONFIRM' => $data['password_confirm'], + 'NEW_PASSWORD' => $data['new_password'], + 'CUR_PASSWORD' => '', + + 'L_USERNAME_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), + 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars'])), + + 'S_FORCE_PASSWORD' => ($auth->acl_get('u_chgpasswd') && $config['chg_passforce'] && $user->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) ? true : false, + 'S_CHANGE_USERNAME' => ($config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false, + 'S_CHANGE_EMAIL' => ($auth->acl_get('u_chgemail')) ? true : false, + 'S_CHANGE_PASSWORD' => ($auth->acl_get('u_chgpasswd')) ? true : false) + ); + break; + + case 'profile_info': + // Do not display profile information panel if not authed to do so + if (!$auth->acl_get('u_chgprofileinfo')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_PROFILEINFO'); + } + + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + + $cp_data = $cp_error = array(); + + $data = array( + 'jabber' => $request->variable('jabber', $user->data['user_jabber'], true), + ); + + if ($config['allow_birthdays']) + { + $data['bday_day'] = $data['bday_month'] = $data['bday_year'] = 0; + + if ($user->data['user_birthday']) + { + list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user->data['user_birthday']); + } + + $data['bday_day'] = $request->variable('bday_day', $data['bday_day']); + $data['bday_month'] = $request->variable('bday_month', $data['bday_month']); + $data['bday_year'] = $request->variable('bday_year', $data['bday_year']); + $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']); + } + + /** + * Modify user data on editing profile in UCP + * + * @event core.ucp_profile_modify_profile_info + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_modify_profile_info', compact($vars))); + + add_form_key('ucp_profile_info'); + + if ($submit) + { + $validate_array = array( + 'jabber' => array( + array('string', true, 5, 255), + array('jabber')), + ); + + if ($config['allow_birthdays']) + { + $validate_array = array_merge($validate_array, array( + 'bday_day' => array('num', true, 1, 31), + 'bday_month' => array('num', true, 1, 12), + 'bday_year' => array('num', true, 1901, gmdate('Y', time()) + 50), + 'user_birthday' => array('date', true), + )); + } + + $error = validate_data($data, $validate_array); + + // validate custom profile fields + $cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error); + + if (count($cp_error)) + { + $error = array_merge($error, $cp_error); + } + + if (!check_form_key('ucp_profile_info')) + { + $error[] = 'FORM_INVALID'; + } + + /** + * Validate user data on editing profile in UCP + * + * @event core.ucp_profile_validate_profile_info + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @var array error Array of any generated errors + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit', 'error'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_validate_profile_info', compact($vars))); + + if (!count($error)) + { + $data['notify'] = $user->data['user_notify_type']; + + if ($data['notify'] == NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml'))) + { + // User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled) + // Disable notify by Jabber now for this user. + $data['notify'] = NOTIFY_EMAIL; + } + + $sql_ary = array( + 'user_jabber' => $data['jabber'], + 'user_notify_type' => $data['notify'], + ); + + if ($config['allow_birthdays']) + { + $sql_ary['user_birthday'] = $data['user_birthday']; + } + + /** + * Modify profile data in UCP before submitting to the database + * + * @event core.ucp_profile_info_modify_sql_ary + * @var array cp_data Array with the user custom profile fields data + * @var array data Array with user profile data + * @var array sql_ary user options data we update + * @since 3.1.4-RC1 + */ + $vars = array('cp_data', 'data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_info_modify_sql_ary', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + + // Update Custom Fields + $cp->update_profile_field_data($user->data['user_id'], $cp_data); + + meta_refresh(3, $this->u_action); + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + if ($config['allow_birthdays']) + { + $s_birthday_day_options = ''; + for ($i = 1; $i < 32; $i++) + { + $selected = ($i == $data['bday_day']) ? ' selected="selected"' : ''; + $s_birthday_day_options .= ""; + } + + $s_birthday_month_options = ''; + for ($i = 1; $i < 13; $i++) + { + $selected = ($i == $data['bday_month']) ? ' selected="selected"' : ''; + $s_birthday_month_options .= ""; + } + + $now = getdate(); + $s_birthday_year_options = ''; + for ($i = $now['year'] - 100; $i <= $now['year']; $i++) + { + $selected = ($i == $data['bday_year']) ? ' selected="selected"' : ''; + $s_birthday_year_options .= ""; + } + unset($now); + + $template->assign_vars(array( + 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, + 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, + 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, + 'S_BIRTHDAYS_ENABLED' => true, + )); + } + + $template->assign_vars(array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'S_JABBER_ENABLED' => $config['jab_enable'], + 'JABBER' => $data['jabber'], + )); + + // Get additional profile fields and assign them to the template block var 'profile_fields' + $user->get_profile_fields($user->data['user_id']); + + $cp->generate_profile_fields('profile', $user->get_iso_lang_id()); + + break; + + case 'signature': + + if (!$auth->acl_get('u_sig')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_SIGNATURE'); + } + + if (!function_exists('generate_smilies')) + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } + + if (!function_exists('display_custom_bbcodes')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $preview = $request->is_set_post('preview'); + + $enable_bbcode = ($config['allow_sig_bbcode']) ? $user->optionget('sig_bbcode') : false; + $enable_smilies = ($config['allow_sig_smilies']) ? $user->optionget('sig_smilies') : false; + $enable_urls = ($config['allow_sig_links']) ? $user->optionget('sig_links') : false; + + $bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0); + + $decoded_message = generate_text_for_edit($user->data['user_sig'], $user->data['user_sig_bbcode_uid'], $bbcode_flags); + $signature = $request->variable('signature', $decoded_message['text'], true); + $signature_preview = ''; + + if ($submit || $preview) + { + $enable_bbcode = ($config['allow_sig_bbcode']) ? !$request->variable('disable_bbcode', false) : false; + $enable_smilies = ($config['allow_sig_smilies']) ? !$request->variable('disable_smilies', false) : false; + $enable_urls = ($config['allow_sig_links']) ? !$request->variable('disable_magic_url', false) : false; + + if (!check_form_key('ucp_sig')) + { + $error[] = 'FORM_INVALID'; + } + } + + /** + * Modify user signature on editing profile in UCP + * + * @event core.ucp_profile_modify_signature + * @var bool enable_bbcode Whether or not bbcode is enabled + * @var bool enable_smilies Whether or not smilies are enabled + * @var bool enable_urls Whether or not urls are enabled + * @var string signature Users signature text + * @var array error Any error strings + * @var bool submit Whether or not the form has been sumitted + * @var bool preview Whether or not the signature is being previewed + * @since 3.1.10-RC1 + * @changed 3.2.0-RC2 Removed message parser + */ + $vars = array( + 'enable_bbcode', + 'enable_smilies', + 'enable_urls', + 'signature', + 'error', + 'submit', + 'preview', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_modify_signature', compact($vars))); + + $bbcode_uid = $bbcode_bitfield = $bbcode_flags = ''; + $warn_msg = generate_text_for_storage( + $signature, + $bbcode_uid, + $bbcode_bitfield, + $bbcode_flags, + $enable_bbcode, + $enable_urls, + $enable_smilies, + $config['allow_sig_img'], + $config['allow_sig_flash'], + true, + $config['allow_sig_links'], + 'sig' + ); + + if (count($warn_msg)) + { + $error += $warn_msg; + } + + if (!$submit) + { + // Parse it for displaying + $signature_preview = generate_text_for_display($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags); + } + else + { + if (!count($error)) + { + $user->optionset('sig_bbcode', $enable_bbcode); + $user->optionset('sig_smilies', $enable_smilies); + $user->optionset('sig_links', $enable_urls); + + $sql_ary = array( + 'user_sig' => $signature, + 'user_options' => $user->data['user_options'], + 'user_sig_bbcode_uid' => $bbcode_uid, + 'user_sig_bbcode_bitfield' => $bbcode_bitfield + ); + + /** + * Modify user registration data before submitting it to the database + * + * @event core.ucp_profile_modify_signature_sql_ary + * @var array sql_ary Array with user signature data to submit to the database + * @since 3.1.10-RC1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_modify_signature_sql_ary', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + + if ($request->is_set_post('preview')) + { + $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_flags); + } + + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + + $template->assign_vars(array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'SIGNATURE' => $decoded_message['text'], + 'SIGNATURE_PREVIEW' => $signature_preview, + + 'S_BBCODE_CHECKED' => (!$enable_bbcode) ? ' checked="checked"' : '', + 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', + 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', + + 'BBCODE_STATUS' => $user->lang(($config['allow_sig_bbcode'] ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), + 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + 'MAX_FONT_SIZE' => (int) $config['max_sig_font_size'], + + 'L_SIGNATURE_EXPLAIN' => $user->lang('SIGNATURE_EXPLAIN', (int) $config['max_sig_chars']), + + 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], + 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], + 'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false, + 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false, + 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false) + ); + + add_form_key('ucp_sig'); + + // Build custom bbcodes array + display_custom_bbcodes(); + + // Generate smiley listing + generate_smilies('inline', 0); + + break; + + case 'avatar': + + add_form_key('ucp_avatar'); + + $avatars_enabled = false; + + if ($config['allow_avatar'] && $auth->acl_get('u_chgavatar')) + { + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); + + // This is normalised data, without the user_ prefix + $avatar_data = \phpbb\avatar\manager::clean_row($user->data, 'user'); + + if ($submit) + { + if (check_form_key('ucp_avatar')) + { + $driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); + + if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) + { + $driver = $phpbb_avatar_manager->get_driver($driver_name); + $result = $driver->process_form($request, $template, $user, $avatar_data, $error); + + if ($result && empty($error)) + { + // Success! Lets save the result in the database + $result = array( + 'user_avatar_type' => $driver_name, + 'user_avatar' => $result['avatar'], + 'user_avatar_width' => $result['avatar_width'], + 'user_avatar_height' => $result['avatar_height'], + ); + + /** + * Trigger events on successfull avatar change + * + * @event core.ucp_profile_avatar_sql + * @var array result Array with data to be stored in DB + * @since 3.1.11-RC1 + */ + $vars = array('result'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_avatar_sql', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $result) . ' + WHERE user_id = ' . (int) $user->data['user_id']; + $db->sql_query($sql); + + meta_refresh(3, $this->u_action); + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + } + } + else + { + $error[] = 'FORM_INVALID'; + } + } + + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (!confirm_box(true)) + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true, + 'i' => $id, + 'mode' => $mode)) + ); + } + else + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, USERS_TABLE, 'user_'); + + meta_refresh(3, $this->u_action); + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + } + + $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user->data['user_avatar_type'])); + + $template->assign_vars(array( + 'AVATAR_MIN_WIDTH' => $config['avatar_min_width'], + 'AVATAR_MAX_WIDTH' => $config['avatar_max_width'], + 'AVATAR_MIN_HEIGHT' => $config['avatar_min_height'], + 'AVATAR_MAX_HEIGHT' => $config['avatar_max_height'], + )); + + foreach ($avatar_drivers as $current_driver) + { + $driver = $phpbb_avatar_manager->get_driver($current_driver); + + $avatars_enabled = true; + $template->set_filenames(array( + 'avatar' => $driver->get_template_name(), + )); + + if ($driver->prepare_form($request, $template, $user, $avatar_data, $error)) + { + $driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver); + $driver_upper = strtoupper($driver_name); + + $template->assign_block_vars('avatar_drivers', array( + 'L_TITLE' => $user->lang($driver_upper . '_TITLE'), + 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), + + 'DRIVER' => $driver_name, + 'SELECTED' => $current_driver == $selected_driver, + 'OUTPUT' => $template->assign_display('avatar'), + )); + } + } + + // Replace "error" strings with their real, localised form + $error = $phpbb_avatar_manager->localize_errors($user, $error); + } + + $avatar = phpbb_get_user_avatar($user->data, 'USER_AVATAR', true); + + $template->assign_vars(array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'AVATAR' => $avatar, + + 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', + + 'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(), + + 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), + )); + + break; + + case 'autologin_keys': + + add_form_key('ucp_autologin_keys'); + + if ($submit) + { + $keys = $request->variable('keys', array('')); + + if (!check_form_key('ucp_autologin_keys')) + { + $error[] = 'FORM_INVALID'; + } + + if (!count($error)) + { + if (!empty($keys)) + { + foreach ($keys as $key => $id) + { + $keys[$key] = $db->sql_like_expression($id . $db->get_any_char()); + } + $sql_where = '(key_id ' . implode(' OR key_id ', $keys) . ')'; + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE user_id = ' . (int) $user->data['user_id'] . ' + AND ' . $sql_where ; + + $db->sql_query($sql); + + meta_refresh(3, $this->u_action); + $message = $user->lang['AUTOLOGIN_SESSION_KEYS_DELETED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + $sql = 'SELECT key_id, last_ip, last_login + FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE user_id = ' . (int) $user->data['user_id'] . ' + ORDER BY last_login ASC'; + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('sessions', array( + 'KEY' => substr($row['key_id'], 0, 8), + 'IP' => $row['last_ip'], + 'LOGIN_TIME' => $user->format_date($row['last_login']), + )); + } + + $db->sql_freeresult($result); + + break; + } + + $template->assign_vars(array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + + 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], + + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_UCP_ACTION' => $this->u_action) + ); + + // Set desired template + $this->tpl_name = 'ucp_profile_' . $mode; + $this->page_title = 'UCP_PROFILE_' . strtoupper($mode); + } +} diff --git a/install/update/new/includes/ucp/ucp_register.php b/install/update/new/includes/ucp/ucp_register.php new file mode 100644 index 0000000..00fa803 --- /dev/null +++ b/install/update/new/includes/ucp/ucp_register.php @@ -0,0 +1,738 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ucp_register +* Board registration +*/ +class ucp_register +{ + var $u_action; + + function main($id, $mode) + { + global $config, $db, $user, $template, $phpbb_root_path, $phpEx; + global $request, $phpbb_container, $phpbb_dispatcher; + + // + if ($config['require_activation'] == USER_ACTIVATION_DISABLE || + (in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN)) && !$config['email_enable'])) + { + trigger_error('UCP_REGISTER_DISABLE'); + } + + $coppa = $request->is_set('coppa_yes') ? 1 : ($request->is_set('coppa_no') ? 0 : false); + $coppa = $request->is_set('coppa') ? $request->variable('coppa', 0) : $coppa; + $agreed = $request->variable('agreed', false); + $submit = $request->is_set_post('submit'); + $change_lang = $request->variable('change_lang', ''); + $user_lang = $request->variable('lang', $user->lang_name); + + if ($agreed && !check_form_key('ucp_register')) + { + $agreed = false; + } + + if ($coppa !== false && !check_form_key('ucp_register')) + { + $coppa = false; + } + + /** + * Add UCP register data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_requests_after + * @var bool coppa Is set coppa + * @var bool agreed Did user agree to coppa? + * @var bool submit Is set post submit? + * @var string change_lang Change language request + * @var string user_lang User language request + * @since 3.1.11-RC1 + */ + $vars = array( + 'coppa', + 'agreed', + 'submit', + 'change_lang', + 'user_lang', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_requests_after', compact($vars))); + + add_form_key('ucp_register'); + + if ($change_lang || $user_lang != $config['default_lang']) + { + $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang); + + if (!validate_language_iso_name($use_lang)) + { + if ($change_lang) + { + $submit = false; + + // Setting back agreed to let the user view the agreement in his/her language + $agreed = false; + } + + $user_lang = $use_lang; + } + else + { + $change_lang = ''; + $user_lang = $user->lang_name; + } + } + + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + + $error = $cp_data = $cp_error = array(); + $s_hidden_fields = array(); + + // Handle login_link data added to $_hidden_fields + $login_link_data = $this->get_login_link_data_array(); + + if (!empty($login_link_data)) + { + // Confirm that we have all necessary data + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_provider = $provider_collection->get_provider($request->variable('auth_provider', '')); + + $result = $auth_provider->login_link_has_necessary_data($login_link_data); + if ($result !== null) + { + $error[] = $user->lang[$result]; + } + + $s_hidden_fields = array_merge($s_hidden_fields, $this->get_login_link_data_for_hidden_fields($login_link_data)); + } + + if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable'])) + { + $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; + + $s_hidden_fields = array_merge($s_hidden_fields, array( + 'change_lang' => '', + )); + + // If we change the language, we want to pass on some more possible parameter. + if ($change_lang) + { + // We do not include the password + $s_hidden_fields = array_merge($s_hidden_fields, array( + 'username' => $request->variable('username', '', true), + 'email' => strtolower($request->variable('email', '')), + 'lang' => $user->lang_name, + 'tz' => $request->variable('tz', $config['board_timezone']), + )); + + } + + // Checking amount of available languages + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE; + $result = $db->sql_query($sql); + + $lang_row = array(); + while ($row = $db->sql_fetchrow($result)) + { + $lang_row[] = $row; + } + $db->sql_freeresult($result); + + if ($coppa === false && $config['coppa_enable']) + { + $now = getdate(); + $coppa_birthday = $user->create_datetime() + ->setDate($now['year'] - 13, $now['mon'], $now['mday'] - 1) + ->setTime(0, 0, 0) + ->format($user->lang['DATE_FORMAT'], true); + unset($now); + + $template_vars = array( + 'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '', + 'L_COPPA_NO' => $user->lang('UCP_COPPA_BEFORE', $coppa_birthday), + 'L_COPPA_YES' => $user->lang('UCP_COPPA_ON_AFTER', $coppa_birthday), + + 'S_SHOW_COPPA' => true, + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), + + 'COOKIE_NAME' => $config['cookie_name'], + 'COOKIE_PATH' => $config['cookie_path'], + ); + } + else + { + $template_vars = array( + 'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '', + 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), + + 'S_SHOW_COPPA' => false, + 'S_REGISTRATION' => true, + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_coppa), + + 'COOKIE_NAME' => $config['cookie_name'], + 'COOKIE_PATH' => $config['cookie_path'], + ); + } + + $tpl_name = 'ucp_agreement'; + + /** + * Allows to modify the agreements. + * + * @event core.ucp_register_agreement_modify_template_data + * @var string tpl_name Template file + * @var array template_vars Array with data about to be assigned to the template + * @var array s_hidden_fields Array with hidden form elements + * @var array lang_row Array with available languages, read only + * @since 3.2.2-RC1 + */ + $vars = array('tpl_name', 'template_vars', 's_hidden_fields', 'lang_row'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_agreement_modify_template_data', compact($vars))); + + unset($lang_row); + + $template_vars = array_merge($template_vars, array( + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + )); + + $template->assign_vars($template_vars); + + /** + * Allows to modify the agreements. + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_agreement + * @since 3.1.6-RC1 + * @deprecated 3.2.2-RC1 Replaced by core.ucp_register_agreement_modify_template_data and to be removed in 3.3.0-RC1 + */ + $phpbb_dispatcher->dispatch('core.ucp_register_agreement'); + + $this->tpl_name = $tpl_name; + return; + } + + // The CAPTCHA kicks in here. We can't help that the information gets lost on language change. + if ($config['enable_confirm']) + { + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_REG); + } + + $timezone = $config['board_timezone']; + + $data = array( + 'username' => $request->variable('username', '', true), + 'new_password' => $request->variable('new_password', '', true), + 'password_confirm' => $request->variable('password_confirm', '', true), + 'email' => strtolower($request->variable('email', '')), + 'lang' => basename($request->variable('lang', $user->lang_name)), + 'tz' => $request->variable('tz', $timezone), + ); + /** + * Add UCP register data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_data_before + * @var bool submit Do we display the form only + * or did the user press submit + * @var array data Array with current ucp registration data + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'data'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_data_before', compact($vars))); + + // Check and initialize some variables if needed + if ($submit) + { + $error = validate_data($data, array( + 'username' => array( + array('string', false, $config['min_name_chars'], $config['max_name_chars']), + array('username', '')), + 'new_password' => array( + array('string', false, $config['min_pass_chars'], 0), + array('password')), + 'password_confirm' => array('string', false, $config['min_pass_chars'], 0), + 'email' => array( + array('string', false, 6, 60), + array('user_email')), + 'tz' => array('timezone'), + 'lang' => array('language_iso_name'), + )); + + if (!check_form_key('ucp_register')) + { + $error[] = $user->lang['FORM_INVALID']; + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + + if ($config['enable_confirm']) + { + $vc_response = $captcha->validate($data); + if ($vc_response !== false) + { + $error[] = $vc_response; + } + + if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts']) + { + $error[] = $user->lang['TOO_MANY_REGISTERS']; + } + } + + // DNSBL check + if ($config['check_dnsbl']) + { + if (($dnsbl = $user->check_dnsbl('register')) !== false) + { + $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]); + } + } + + // validate custom profile fields + $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error); + + if (!count($error)) + { + if ($data['new_password'] != $data['password_confirm']) + { + $error[] = $user->lang['NEW_PASSWORD_ERROR']; + } + } + /** + * Check UCP registration data after they are submitted + * + * @event core.ucp_register_data_after + * @var bool submit Do we display the form only + * or did the user press submit + * @var array data Array with current ucp registration data + * @var array cp_data Array with custom profile fields data + * @var array error Array with list of errors + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'data', 'cp_data', 'error'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_data_after', compact($vars))); + + if (!count($error)) + { + $server_url = generate_board_url(); + + // Which group by default? + $group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED'; + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $db->sql_escape($group_name) . "' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + $group_id = $row['group_id']; + + if (($coppa || + $config['require_activation'] == USER_ACTIVATION_SELF || + $config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable']) + { + $user_actkey = gen_rand_string(mt_rand(6, 10)); + $user_type = USER_INACTIVE; + $user_inactive_reason = INACTIVE_REGISTER; + $user_inactive_time = time(); + } + else + { + $user_type = USER_NORMAL; + $user_actkey = ''; + $user_inactive_reason = 0; + $user_inactive_time = 0; + } + + // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + + $user_row = array( + 'username' => $data['username'], + 'user_password' => $passwords_manager->hash($data['new_password']), + 'user_email' => $data['email'], + 'group_id' => (int) $group_id, + 'user_timezone' => $data['tz'], + 'user_lang' => $data['lang'], + 'user_type' => $user_type, + 'user_actkey' => $user_actkey, + 'user_ip' => $user->ip, + 'user_regdate' => time(), + 'user_inactive_reason' => $user_inactive_reason, + 'user_inactive_time' => $user_inactive_time, + ); + + if ($config['new_member_post_limit']) + { + $user_row['user_new'] = 1; + } + /** + * Add into $user_row before user_add + * + * user_add allows adding more data into the users table + * + * @event core.ucp_register_user_row_after + * @var bool submit Do we display the form only + * or did the user press submit + * @var array cp_data Array with custom profile fields data + * @var array user_row Array with current ucp registration data + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'cp_data', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_user_row_after', compact($vars))); + + // Register user... + $user_id = user_add($user_row, $cp_data); + + // This should not happen, because the required variables are listed above... + if ($user_id === false) + { + trigger_error('NO_USER', E_USER_ERROR); + } + + // Okay, captcha, your job is done. + if ($config['enable_confirm'] && isset($captcha)) + { + $captcha->reset(); + } + + if ($coppa && $config['email_enable']) + { + $message = $user->lang['ACCOUNT_COPPA']; + $email_template = 'coppa_welcome_inactive'; + } + else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) + { + $message = $user->lang['ACCOUNT_INACTIVE']; + $email_template = 'user_welcome_inactive'; + } + else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable']) + { + $message = $user->lang['ACCOUNT_INACTIVE_ADMIN']; + $email_template = 'admin_welcome_inactive'; + } + else + { + $message = $user->lang['ACCOUNT_ADDED']; + $email_template = 'user_welcome'; + + // Autologin after registration + $user->session_create($user_id, 0, false, 1); + } + + if ($config['email_enable']) + { + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $messenger = new messenger(false); + + $messenger->template($email_template, $data['lang']); + + $messenger->to($data['email'], $data['username']); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'USERNAME' => htmlspecialchars_decode($data['username']), + 'PASSWORD' => htmlspecialchars_decode($data['new_password']), + 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey") + ); + + if ($coppa) + { + $messenger->assign_vars(array( + 'FAX_INFO' => $config['coppa_fax'], + 'MAIL_INFO' => $config['coppa_mail'], + 'EMAIL_ADDRESS' => $data['email']) + ); + } + + /** + * Modify messenger data before welcome mail is sent + * + * @event core.ucp_register_welcome_email_before + * @var array user_row Array with user registration data + * @var array cp_data Array with custom profile fields data + * @var array data Array with current ucp registration data + * @var string message Message to be displayed to the user after registration + * @var string server_url Server URL + * @var int user_id New user ID + * @var string user_actkey User activation key + * @var messenger messenger phpBB Messenger + * @since 3.2.4-RC1 + */ + $vars = array( + 'user_row', + 'cp_data', + 'data', + 'message', + 'server_url', + 'user_id', + 'user_actkey', + 'messenger', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_welcome_email_before', compact($vars))); + + $messenger->send(NOTIFY_EMAIL); + } + + if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->add_notifications('notification.type.admin_activate_user', array( + 'user_id' => $user_id, + 'user_actkey' => $user_row['user_actkey'], + 'user_regdate' => $user_row['user_regdate'], + )); + } + + // Perform account linking if necessary + if (!empty($login_link_data)) + { + $login_link_data['user_id'] = $user_id; + + $result = $auth_provider->link_account($login_link_data); + + if ($result) + { + $message = $message . '

' . $user->lang[$result]; + } + } + + /** + * Perform additional actions after user registration + * + * @event core.ucp_register_register_after + * @var array user_row Array with user registration data + * @var array cp_data Array with custom profile fields data + * @var array data Array with current ucp registration data + * @var string message Message to be displayed to the user after registration + * @var string server_url Server URL + * @var int user_id New user ID + * @var string user_actkey User activation key + * @since 3.2.4-RC1 + */ + $vars = array( + 'user_row', + 'cp_data', + 'data', + 'message', + 'server_url', + 'user_id', + 'user_actkey', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_register_after', compact($vars))); + + $message = $message . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + trigger_error($message); + } + } + + $s_hidden_fields = array_merge($s_hidden_fields, array( + 'agreed' => 'true', + 'change_lang' => 0, + )); + + if ($config['coppa_enable']) + { + $s_hidden_fields['coppa'] = $coppa; + } + + if ($config['enable_confirm']) + { + $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); + } + + // Visual Confirmation - Show images + if ($config['enable_confirm']) + { + $template->assign_vars(array( + 'CAPTCHA_TEMPLATE' => $captcha->get_template(), + )); + } + + // + $l_reg_cond = ''; + switch ($config['require_activation']) + { + case USER_ACTIVATION_SELF: + $l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE']; + break; + + case USER_ACTIVATION_ADMIN: + $l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE']; + break; + } + + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_provider = $provider_collection->get_provider(); + + $auth_provider_data = $auth_provider->get_login_data(); + if ($auth_provider_data) + { + if (isset($auth_provider_data['VARS'])) + { + $template->assign_vars($auth_provider_data['VARS']); + } + + if (isset($auth_provider_data['BLOCK_VAR_NAME'])) + { + foreach ($auth_provider_data['BLOCK_VARS'] as $block_vars) + { + $template->assign_block_vars($auth_provider_data['BLOCK_VAR_NAME'], $block_vars); + } + } + + $template->assign_vars(array( + 'PROVIDER_TEMPLATE_FILE' => $auth_provider_data['TEMPLATE_FILE'], + )); + } + + // Assign template vars for timezone select + phpbb_timezone_select($template, $user, $data['tz'], true); + + $template_vars = array( + 'USERNAME' => $data['username'], + 'PASSWORD' => $data['new_password'], + 'PASSWORD_CONFIRM' => $data['password_confirm'], + 'EMAIL' => $data['email'], + + 'L_REG_COND' => $l_reg_cond, + 'L_USERNAME_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), + 'L_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars'])), + + 'S_LANG_OPTIONS' => language_select($data['lang']), + 'S_TZ_PRESELECT' => !$submit, + 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false, + 'S_REGISTRATION' => true, + 'S_COPPA' => $coppa, + 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), + + 'COOKIE_NAME' => $config['cookie_name'], + 'COOKIE_PATH' => $config['cookie_path'], + ); + + $tpl_name = 'ucp_register'; + + /** + * Modify template data on the registration page + * + * @event core.ucp_register_modify_template_data + * @var array template_vars Array with template data + * @var array data Array with user data, read only + * @var array error Array with errors + * @var array s_hidden_fields Array with hidden field elements + * @var string tpl_name Template name + * @since 3.2.2-RC1 + */ + $vars = array( + 'template_vars', + 'data', + 'error', + 's_hidden_fields', + 'tpl_name', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_modify_template_data', compact($vars))); + + $template_vars = array_merge($template_vars, array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + )); + + $template->assign_vars($template_vars); + + // + $user->profile_fields = array(); + + // Generate profile fields -> Template Block Variable profile_fields + $cp->generate_profile_fields('register', $user->get_iso_lang_id()); + + // + $this->tpl_name = $tpl_name; + } + + /** + * Creates the login_link data array + * + * @return array Returns an array of all POST paramaters whose names + * begin with 'login_link_' + */ + protected function get_login_link_data_array() + { + global $request; + + $var_names = $request->variable_names(\phpbb\request\request_interface::POST); + $login_link_data = array(); + $string_start_length = strlen('login_link_'); + + foreach ($var_names as $var_name) + { + if (strpos($var_name, 'login_link_') === 0) + { + $key_name = substr($var_name, $string_start_length); + $login_link_data[$key_name] = $request->variable($var_name, '', false, \phpbb\request\request_interface::POST); + } + } + + return $login_link_data; + } + + /** + * Prepends they key names of an associative array with 'login_link_' for + * inclusion on the page as hidden fields. + * + * @param array $data The array to be modified + * @return array The modified array + */ + protected function get_login_link_data_for_hidden_fields($data) + { + $new_data = array(); + + foreach ($data as $key => $value) + { + $new_data['login_link_' . $key] = $value; + } + + return $new_data; + } +} diff --git a/install/update/new/includes/ucp/ucp_resend.php b/install/update/new/includes/ucp/ucp_resend.php new file mode 100644 index 0000000..5592366 --- /dev/null +++ b/install/update/new/includes/ucp/ucp_resend.php @@ -0,0 +1,163 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ucp_resend +* Resending activation emails +*/ +class ucp_resend +{ + var $u_action; + + function main($id, $mode) + { + global $config, $phpbb_root_path, $phpEx; + global $db, $user, $auth, $template, $request; + + $username = $request->variable('username', '', true); + $email = strtolower($request->variable('email', '')); + $submit = (isset($_POST['submit'])) ? true : false; + + add_form_key('ucp_resend'); + + if ($submit) + { + if (!check_form_key('ucp_resend')) + { + trigger_error('FORM_INVALID'); + } + + $sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_inactive_reason + FROM ' . USERS_TABLE . " + WHERE user_email = '" . $db->sql_escape($email) . "' + AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + trigger_error('NO_EMAIL_USER'); + } + + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error('NO_USER'); + } + + if (!$user_row['user_actkey'] && $user_row['user_type'] != USER_INACTIVE) + { + trigger_error('ACCOUNT_ALREADY_ACTIVATED'); + } + + if (!$user_row['user_actkey'] || ($user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL)) + { + trigger_error('ACCOUNT_DEACTIVATED'); + } + + // Determine coppa status on group (REGISTERED(_COPPA)) + $sql = 'SELECT group_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . $user_row['group_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + $coppa = ($row['group_name'] == 'REGISTERED_COPPA' && $row['group_type'] == GROUP_SPECIAL) ? true : false; + + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + $messenger = new messenger(false); + + if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa) + { + $messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']); + $messenger->set_addresses($user_row); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'USERNAME' => htmlspecialchars_decode($user_row['username']), + 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}") + ); + + if ($coppa) + { + $messenger->assign_vars(array( + 'FAX_INFO' => $config['coppa_fax'], + 'MAIL_INFO' => $config['coppa_mail'], + 'EMAIL_ADDRESS' => $user_row['user_email']) + ); + } + + $messenger->send(NOTIFY_EMAIL); + } + + if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + { + // Grab an array of user_id's with a_user permissions ... these users can activate a user + $admin_ary = $auth->acl_get_list(false, 'a_user', false); + + $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $messenger->template('admin_activate', $row['user_lang']); + $messenger->set_addresses($row); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($user_row['username']), + 'U_USER_DETAILS' => generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$user_row['user_id']}", + 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}") + ); + + $messenger->send($row['user_notify_type']); + } + $db->sql_freeresult($result); + } + + meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); + + $message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACTIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT']; + $message .= '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + trigger_error($message); + } + + $template->assign_vars(array( + 'USERNAME' => $username, + 'EMAIL' => $email, + 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=resend_act')) + ); + + $this->tpl_name = 'ucp_resend'; + $this->page_title = 'UCP_RESEND'; + } +} diff --git a/install/update/new/includes/utf/utf_tools.php b/install/update/new/includes/utf/utf_tools.php new file mode 100644 index 0000000..bb155ae --- /dev/null +++ b/install/update/new/includes/utf/utf_tools.php @@ -0,0 +1,1469 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +// Enforce ASCII only string handling +setlocale(LC_CTYPE, 'C'); + +/** +* Setup the UTF-8 portability layer +*/ +Patchwork\Utf8\Bootup::initUtf8Encode(); +Patchwork\Utf8\Bootup::initMbstring(); +Patchwork\Utf8\Bootup::initIntl(); + +/** +* UTF-8 tools +* +* Whenever possible, these functions will try to use PHP's built-in functions or +* extensions, otherwise they will default to custom routines. +* +*/ + +/** +* UTF-8 aware alternative to strrpos +* @ignore +*/ +function utf8_strrpos($str, $needle, $offset = null) +{ + // Emulate behaviour of strrpos rather than raising warning + if (empty($str)) + { + return false; + } + + if (is_null($offset)) + { + return mb_strrpos($str, $needle); + } + else + { + return mb_strrpos($str, $needle, $offset); + } +} + +/** +* UTF-8 aware alternative to strpos +* @ignore +*/ +function utf8_strpos($str, $needle, $offset = null) +{ + if (is_null($offset)) + { + return mb_strpos($str, $needle); + } + else + { + return mb_strpos($str, $needle, $offset); + } +} + +/** +* UTF-8 aware alternative to strtolower +* @ignore +*/ +function utf8_strtolower($str) +{ + return mb_strtolower($str); +} + +/** +* UTF-8 aware alternative to strtoupper +* @ignore +*/ +function utf8_strtoupper($str) +{ + return mb_strtoupper($str); +} + +/** +* UTF-8 aware alternative to substr +* @ignore +*/ +function utf8_substr($str, $offset, $length = null) +{ + if (is_null($length)) + { + return mb_substr($str, $offset); + } + else + { + return mb_substr($str, $offset, $length); + } +} + +/** +* Return the length (in characters) of a UTF-8 string +* @ignore +*/ +function utf8_strlen($text) +{ + return mb_strlen($text, 'utf-8'); +} + +/** +* UTF-8 aware alternative to str_split +* Convert a string to an array +* +* @author Harry Fuecks +* @param string $str UTF-8 encoded +* @param int $split_len number to characters to split string by +* @return array characters in string reverses +*/ +function utf8_str_split($str, $split_len = 1) +{ + if (!is_int($split_len) || $split_len < 1) + { + return false; + } + + $len = utf8_strlen($str); + if ($len <= $split_len) + { + return array($str); + } + + preg_match_all('/.{' . $split_len . '}|[^\x00]{1,' . $split_len . '}$/us', $str, $ar); + return $ar[0]; +} + +/** +* UTF-8 aware alternative to strspn +* Find length of initial segment matching the mask +* +* @author Harry Fuecks +*/ +function utf8_strspn($str, $mask, $start = null, $length = null) +{ + if ($start !== null || $length !== null) + { + $str = utf8_substr($str, $start, $length); + } + + preg_match('/^[' . $mask . ']+/u', $str, $matches); + + if (isset($matches[0])) + { + return utf8_strlen($matches[0]); + } + + return 0; +} + +/** +* UTF-8 aware alternative to ucfirst +* Make a string's first character uppercase +* +* @author Harry Fuecks +* @param string +* @return string with first character as upper case (if applicable) +*/ +function utf8_ucfirst($str) +{ + switch (utf8_strlen($str)) + { + case 0: + return ''; + break; + + case 1: + return utf8_strtoupper($str); + break; + + default: + preg_match('/^(.{1})(.*)$/us', $str, $matches); + return utf8_strtoupper($matches[1]) . $matches[2]; + break; + } +} + +/** +* Recode a string to UTF-8 +* +* If the encoding is not supported, the string is returned as-is +* +* @param string $string Original string +* @param string $encoding Original encoding (lowered) +* @return string The string, encoded in UTF-8 +*/ +function utf8_recode($string, $encoding) +{ + $encoding = strtolower($encoding); + + if ($encoding == 'utf-8' || !is_string($string) || empty($string)) + { + return $string; + } + + // we force iso-8859-1 to be cp1252 + if ($encoding == 'iso-8859-1') + { + $encoding = 'cp1252'; + } + // convert iso-8859-8-i to iso-8859-8 + else if ($encoding == 'iso-8859-8-i') + { + $encoding = 'iso-8859-8'; + $string = hebrev($string); + } + + // First, try iconv() + if (function_exists('iconv')) + { + $ret = @iconv($encoding, 'utf-8', $string); + + if (!empty($ret)) + { + return $ret; + } + } + + // Try the mb_string extension + if (function_exists('mb_convert_encoding')) + { + // mbstring is nasty on PHP4, we must make *sure* that we send a good encoding + switch ($encoding) + { + case 'iso-8859-1': + case 'iso-8859-2': + case 'iso-8859-4': + case 'iso-8859-7': + case 'iso-8859-9': + case 'iso-8859-15': + case 'windows-1251': + case 'windows-1252': + case 'cp1252': + case 'shift_jis': + case 'euc-kr': + case 'big5': + case 'gb2312': + $ret = @mb_convert_encoding($string, 'utf-8', $encoding); + + if (!empty($ret)) + { + return $ret; + } + } + } + + // Try the recode extension + if (function_exists('recode_string')) + { + $ret = @recode_string($encoding . '..utf-8', $string); + + if (!empty($ret)) + { + return $ret; + } + } + + // If nothing works, check if we have a custom transcoder available + if (!preg_match('#^[a-z0-9_ \\-]+$#', $encoding)) + { + // Make sure the encoding name is alphanumeric, we don't want it to be abused into loading arbitrary files + trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); + } + + global $phpbb_root_path, $phpEx; + + // iso-8859-* character encoding + if (preg_match('/iso[_ -]?8859[_ -]?(\\d+)/', $encoding, $array)) + { + switch ($array[1]) + { + case '1': + case '2': + case '4': + case '7': + case '8': + case '9': + case '15': + if (!function_exists('iso_8859_' . $array[1])) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx)) + { + trigger_error('Basic reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx); + } + return call_user_func('iso_8859_' . $array[1], $string); + break; + + default: + trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); + break; + } + } + + // CP/WIN character encoding + if (preg_match('/(?:cp|windows)[_\- ]?(\\d+)/', $encoding, $array)) + { + switch ($array[1]) + { + case '932': + break; + case '1250': + case '1251': + case '1252': + case '1254': + case '1255': + case '1256': + case '1257': + case '874': + if (!function_exists('cp' . $array[1])) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx)) + { + trigger_error('Basic reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx); + } + return call_user_func('cp' . $array[1], $string); + break; + + default: + trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); + break; + } + } + + // TIS-620 + if (preg_match('/tis[_ -]?620/', $encoding)) + { + if (!function_exists('tis_620')) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx)) + { + trigger_error('Basic reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx); + } + return tis_620($string); + } + + // SJIS + if (preg_match('/sjis(?:[_ -]?win)?|(?:cp|ibm)[_ -]?932|shift[_ -]?jis/', $encoding)) + { + if (!function_exists('sjis')) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx)) + { + trigger_error('CJK reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx); + } + return sjis($string); + } + + // EUC_KR + if (preg_match('/euc[_ -]?kr/', $encoding)) + { + if (!function_exists('euc_kr')) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx)) + { + trigger_error('CJK reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx); + } + return euc_kr($string); + } + + // BIG-5 + if (preg_match('/big[_ -]?5/', $encoding)) + { + if (!function_exists('big5')) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx)) + { + trigger_error('CJK reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx); + } + return big5($string); + } + + // GB2312 + if (preg_match('/gb[_ -]?2312/', $encoding)) + { + if (!function_exists('gb2312')) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx)) + { + trigger_error('CJK reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx); + } + return gb2312($string); + } + + // Trigger an error?! Fow now just give bad data :-( + trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); +} + +/** + * Replace some special UTF-8 chars that are not in ASCII with their UCR. + * using their Numeric Character Reference's Hexadecimal notation. + * + * Doesn't interfere with Japanese or Cyrillic etc. + * Unicode character visualization will depend on the character support + * of your web browser and the fonts installed on your system. + * + * @see https://en.wikibooks.org/wiki/Unicode/Character_reference/1F000-1FFFF + * + * @param string $text UTF-8 string in NFC + * @return string ASCII string using NCR for non-ASCII chars + */ +function utf8_encode_ucr($text) +{ + return preg_replace_callback('/[\\xF0-\\xF4].../', 'utf8_encode_ncr_callback', $text); +} + +/** + * Replace all UTF-8 chars that are not in ASCII with their NCR + * using their Numeric Character Reference's Hexadecimal notation. + * + * @param string $text UTF-8 string in NFC + * @return string ASCII string using NCRs for non-ASCII chars + */ +function utf8_encode_ncr($text) +{ + return preg_replace_callback('#[\\xC2-\\xF4][\\x80-\\xBF]{1,3}#', 'utf8_encode_ncr_callback', $text); +} + +/** + * Callback used in utf8_encode_ncr() and utf8_encode_ucr() + * + * Takes a UTF-8 char and replaces it with its NCR. Attention, $m is an array + * + * @param array $m 0-based numerically indexed array passed by preg_replace_callback() + * @return string A HTML NCR if the character is valid, or the original string otherwise + */ +function utf8_encode_ncr_callback($m) +{ + return '&#' . utf8_ord($m[0]) . ';'; +} + +/** +* Converts a UTF-8 char to an NCR +* +* @param string $chr UTF-8 char +* @return integer UNICODE code point +*/ +function utf8_ord($chr) +{ + switch (strlen($chr)) + { + case 1: + return ord($chr); + break; + + case 2: + return ((ord($chr[0]) & 0x1F) << 6) | (ord($chr[1]) & 0x3F); + break; + + case 3: + return ((ord($chr[0]) & 0x0F) << 12) | ((ord($chr[1]) & 0x3F) << 6) | (ord($chr[2]) & 0x3F); + break; + + case 4: + return ((ord($chr[0]) & 0x07) << 18) | ((ord($chr[1]) & 0x3F) << 12) | ((ord($chr[2]) & 0x3F) << 6) | (ord($chr[3]) & 0x3F); + break; + + default: + return $chr; + } +} + +/** +* Converts an NCR to a UTF-8 char +* +* @param int $cp UNICODE code point +* @return string UTF-8 char +*/ +function utf8_chr($cp) +{ + if ($cp > 0xFFFF) + { + return chr(0xF0 | ($cp >> 18)) . chr(0x80 | (($cp >> 12) & 0x3F)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); + } + else if ($cp > 0x7FF) + { + return chr(0xE0 | ($cp >> 12)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); + } + else if ($cp > 0x7F) + { + return chr(0xC0 | ($cp >> 6)) . chr(0x80 | ($cp & 0x3F)); + } + else + { + return chr($cp); + } +} + +/** +* Convert Numeric Character References to UTF-8 chars +* +* Notes: +* - we do not convert NCRs recursively, if you pass &#38; it will return & +* - we DO NOT check for the existence of the Unicode characters, therefore an entity may be converted to an inexistent codepoint +* +* @param string $text String to convert, encoded in UTF-8 (no normal form required) +* @return string UTF-8 string where NCRs have been replaced with the actual chars +*/ +function utf8_decode_ncr($text) +{ + return preg_replace_callback('/&#([0-9]{1,6}|x[0-9A-F]{1,5});/i', 'utf8_decode_ncr_callback', $text); +} + +/** +* Callback used in decode_ncr() +* +* Takes a NCR (in decimal or hexadecimal) and returns a UTF-8 char. Attention, $m is an array. +* It will ignore most of invalid NCRs, but not all! +* +* @param array $m 0-based numerically indexed array passed by preg_replace_callback() +* @return string UTF-8 char +*/ +function utf8_decode_ncr_callback($m) +{ + $cp = (strncasecmp($m[1], 'x', 1)) ? $m[1] : hexdec(substr($m[1], 1)); + + return utf8_chr($cp); +} + +/** +* Case folds a unicode string as per Unicode 5.0, section 3.13 +* +* @param string $text text to be case folded +* @param string $option determines how we will fold the cases +* @return string case folded text +*/ +function utf8_case_fold($text, $option = 'full') +{ + static $uniarray = array(); + global $phpbb_root_path, $phpEx; + + // common is always set + if (!isset($uniarray['c'])) + { + $uniarray['c'] = include($phpbb_root_path . 'includes/utf/data/case_fold_c.' . $phpEx); + } + + // only set full if we need to + if ($option === 'full' && !isset($uniarray['f'])) + { + $uniarray['f'] = include($phpbb_root_path . 'includes/utf/data/case_fold_f.' . $phpEx); + } + + // only set simple if we need to + if ($option !== 'full' && !isset($uniarray['s'])) + { + $uniarray['s'] = include($phpbb_root_path . 'includes/utf/data/case_fold_s.' . $phpEx); + } + + // common is always replaced + $text = strtr($text, $uniarray['c']); + + if ($option === 'full') + { + // full replaces a character with multiple characters + $text = strtr($text, $uniarray['f']); + } + else + { + // simple replaces a character with another character + $text = strtr($text, $uniarray['s']); + } + + return $text; +} + +/** +* Takes the input and does a "special" case fold. It does minor normalization +* and returns NFKC compatable text +* +* @param string $text text to be case folded +* @param string $option determines how we will fold the cases +* @return string case folded text +*/ +function utf8_case_fold_nfkc($text, $option = 'full') +{ + static $fc_nfkc_closure = array( + "\xCD\xBA" => "\x20\xCE\xB9", + "\xCF\x92" => "\xCF\x85", + "\xCF\x93" => "\xCF\x8D", + "\xCF\x94" => "\xCF\x8B", + "\xCF\xB2" => "\xCF\x83", + "\xCF\xB9" => "\xCF\x83", + "\xE1\xB4\xAC" => "\x61", + "\xE1\xB4\xAD" => "\xC3\xA6", + "\xE1\xB4\xAE" => "\x62", + "\xE1\xB4\xB0" => "\x64", + "\xE1\xB4\xB1" => "\x65", + "\xE1\xB4\xB2" => "\xC7\x9D", + "\xE1\xB4\xB3" => "\x67", + "\xE1\xB4\xB4" => "\x68", + "\xE1\xB4\xB5" => "\x69", + "\xE1\xB4\xB6" => "\x6A", + "\xE1\xB4\xB7" => "\x6B", + "\xE1\xB4\xB8" => "\x6C", + "\xE1\xB4\xB9" => "\x6D", + "\xE1\xB4\xBA" => "\x6E", + "\xE1\xB4\xBC" => "\x6F", + "\xE1\xB4\xBD" => "\xC8\xA3", + "\xE1\xB4\xBE" => "\x70", + "\xE1\xB4\xBF" => "\x72", + "\xE1\xB5\x80" => "\x74", + "\xE1\xB5\x81" => "\x75", + "\xE1\xB5\x82" => "\x77", + "\xE2\x82\xA8" => "\x72\x73", + "\xE2\x84\x82" => "\x63", + "\xE2\x84\x83" => "\xC2\xB0\x63", + "\xE2\x84\x87" => "\xC9\x9B", + "\xE2\x84\x89" => "\xC2\xB0\x66", + "\xE2\x84\x8B" => "\x68", + "\xE2\x84\x8C" => "\x68", + "\xE2\x84\x8D" => "\x68", + "\xE2\x84\x90" => "\x69", + "\xE2\x84\x91" => "\x69", + "\xE2\x84\x92" => "\x6C", + "\xE2\x84\x95" => "\x6E", + "\xE2\x84\x96" => "\x6E\x6F", + "\xE2\x84\x99" => "\x70", + "\xE2\x84\x9A" => "\x71", + "\xE2\x84\x9B" => "\x72", + "\xE2\x84\x9C" => "\x72", + "\xE2\x84\x9D" => "\x72", + "\xE2\x84\xA0" => "\x73\x6D", + "\xE2\x84\xA1" => "\x74\x65\x6C", + "\xE2\x84\xA2" => "\x74\x6D", + "\xE2\x84\xA4" => "\x7A", + "\xE2\x84\xA8" => "\x7A", + "\xE2\x84\xAC" => "\x62", + "\xE2\x84\xAD" => "\x63", + "\xE2\x84\xB0" => "\x65", + "\xE2\x84\xB1" => "\x66", + "\xE2\x84\xB3" => "\x6D", + "\xE2\x84\xBB" => "\x66\x61\x78", + "\xE2\x84\xBE" => "\xCE\xB3", + "\xE2\x84\xBF" => "\xCF\x80", + "\xE2\x85\x85" => "\x64", + "\xE3\x89\x90" => "\x70\x74\x65", + "\xE3\x8B\x8C" => "\x68\x67", + "\xE3\x8B\x8E" => "\x65\x76", + "\xE3\x8B\x8F" => "\x6C\x74\x64", + "\xE3\x8D\xB1" => "\x68\x70\x61", + "\xE3\x8D\xB3" => "\x61\x75", + "\xE3\x8D\xB5" => "\x6F\x76", + "\xE3\x8D\xBA" => "\x69\x75", + "\xE3\x8E\x80" => "\x70\x61", + "\xE3\x8E\x81" => "\x6E\x61", + "\xE3\x8E\x82" => "\xCE\xBC\x61", + "\xE3\x8E\x83" => "\x6D\x61", + "\xE3\x8E\x84" => "\x6B\x61", + "\xE3\x8E\x85" => "\x6B\x62", + "\xE3\x8E\x86" => "\x6D\x62", + "\xE3\x8E\x87" => "\x67\x62", + "\xE3\x8E\x8A" => "\x70\x66", + "\xE3\x8E\x8B" => "\x6E\x66", + "\xE3\x8E\x8C" => "\xCE\xBC\x66", + "\xE3\x8E\x90" => "\x68\x7A", + "\xE3\x8E\x91" => "\x6B\x68\x7A", + "\xE3\x8E\x92" => "\x6D\x68\x7A", + "\xE3\x8E\x93" => "\x67\x68\x7A", + "\xE3\x8E\x94" => "\x74\x68\x7A", + "\xE3\x8E\xA9" => "\x70\x61", + "\xE3\x8E\xAA" => "\x6B\x70\x61", + "\xE3\x8E\xAB" => "\x6D\x70\x61", + "\xE3\x8E\xAC" => "\x67\x70\x61", + "\xE3\x8E\xB4" => "\x70\x76", + "\xE3\x8E\xB5" => "\x6E\x76", + "\xE3\x8E\xB6" => "\xCE\xBC\x76", + "\xE3\x8E\xB7" => "\x6D\x76", + "\xE3\x8E\xB8" => "\x6B\x76", + "\xE3\x8E\xB9" => "\x6D\x76", + "\xE3\x8E\xBA" => "\x70\x77", + "\xE3\x8E\xBB" => "\x6E\x77", + "\xE3\x8E\xBC" => "\xCE\xBC\x77", + "\xE3\x8E\xBD" => "\x6D\x77", + "\xE3\x8E\xBE" => "\x6B\x77", + "\xE3\x8E\xBF" => "\x6D\x77", + "\xE3\x8F\x80" => "\x6B\xCF\x89", + "\xE3\x8F\x81" => "\x6D\xCF\x89", + "\xE3\x8F\x83" => "\x62\x71", + "\xE3\x8F\x86" => "\x63\xE2\x88\x95\x6B\x67", + "\xE3\x8F\x87" => "\x63\x6F\x2E", + "\xE3\x8F\x88" => "\x64\x62", + "\xE3\x8F\x89" => "\x67\x79", + "\xE3\x8F\x8B" => "\x68\x70", + "\xE3\x8F\x8D" => "\x6B\x6B", + "\xE3\x8F\x8E" => "\x6B\x6D", + "\xE3\x8F\x97" => "\x70\x68", + "\xE3\x8F\x99" => "\x70\x70\x6D", + "\xE3\x8F\x9A" => "\x70\x72", + "\xE3\x8F\x9C" => "\x73\x76", + "\xE3\x8F\x9D" => "\x77\x62", + "\xE3\x8F\x9E" => "\x76\xE2\x88\x95\x6D", + "\xE3\x8F\x9F" => "\x61\xE2\x88\x95\x6D", + "\xF0\x9D\x90\x80" => "\x61", + "\xF0\x9D\x90\x81" => "\x62", + "\xF0\x9D\x90\x82" => "\x63", + "\xF0\x9D\x90\x83" => "\x64", + "\xF0\x9D\x90\x84" => "\x65", + "\xF0\x9D\x90\x85" => "\x66", + "\xF0\x9D\x90\x86" => "\x67", + "\xF0\x9D\x90\x87" => "\x68", + "\xF0\x9D\x90\x88" => "\x69", + "\xF0\x9D\x90\x89" => "\x6A", + "\xF0\x9D\x90\x8A" => "\x6B", + "\xF0\x9D\x90\x8B" => "\x6C", + "\xF0\x9D\x90\x8C" => "\x6D", + "\xF0\x9D\x90\x8D" => "\x6E", + "\xF0\x9D\x90\x8E" => "\x6F", + "\xF0\x9D\x90\x8F" => "\x70", + "\xF0\x9D\x90\x90" => "\x71", + "\xF0\x9D\x90\x91" => "\x72", + "\xF0\x9D\x90\x92" => "\x73", + "\xF0\x9D\x90\x93" => "\x74", + "\xF0\x9D\x90\x94" => "\x75", + "\xF0\x9D\x90\x95" => "\x76", + "\xF0\x9D\x90\x96" => "\x77", + "\xF0\x9D\x90\x97" => "\x78", + "\xF0\x9D\x90\x98" => "\x79", + "\xF0\x9D\x90\x99" => "\x7A", + "\xF0\x9D\x90\xB4" => "\x61", + "\xF0\x9D\x90\xB5" => "\x62", + "\xF0\x9D\x90\xB6" => "\x63", + "\xF0\x9D\x90\xB7" => "\x64", + "\xF0\x9D\x90\xB8" => "\x65", + "\xF0\x9D\x90\xB9" => "\x66", + "\xF0\x9D\x90\xBA" => "\x67", + "\xF0\x9D\x90\xBB" => "\x68", + "\xF0\x9D\x90\xBC" => "\x69", + "\xF0\x9D\x90\xBD" => "\x6A", + "\xF0\x9D\x90\xBE" => "\x6B", + "\xF0\x9D\x90\xBF" => "\x6C", + "\xF0\x9D\x91\x80" => "\x6D", + "\xF0\x9D\x91\x81" => "\x6E", + "\xF0\x9D\x91\x82" => "\x6F", + "\xF0\x9D\x91\x83" => "\x70", + "\xF0\x9D\x91\x84" => "\x71", + "\xF0\x9D\x91\x85" => "\x72", + "\xF0\x9D\x91\x86" => "\x73", + "\xF0\x9D\x91\x87" => "\x74", + "\xF0\x9D\x91\x88" => "\x75", + "\xF0\x9D\x91\x89" => "\x76", + "\xF0\x9D\x91\x8A" => "\x77", + "\xF0\x9D\x91\x8B" => "\x78", + "\xF0\x9D\x91\x8C" => "\x79", + "\xF0\x9D\x91\x8D" => "\x7A", + "\xF0\x9D\x91\xA8" => "\x61", + "\xF0\x9D\x91\xA9" => "\x62", + "\xF0\x9D\x91\xAA" => "\x63", + "\xF0\x9D\x91\xAB" => "\x64", + "\xF0\x9D\x91\xAC" => "\x65", + "\xF0\x9D\x91\xAD" => "\x66", + "\xF0\x9D\x91\xAE" => "\x67", + "\xF0\x9D\x91\xAF" => "\x68", + "\xF0\x9D\x91\xB0" => "\x69", + "\xF0\x9D\x91\xB1" => "\x6A", + "\xF0\x9D\x91\xB2" => "\x6B", + "\xF0\x9D\x91\xB3" => "\x6C", + "\xF0\x9D\x91\xB4" => "\x6D", + "\xF0\x9D\x91\xB5" => "\x6E", + "\xF0\x9D\x91\xB6" => "\x6F", + "\xF0\x9D\x91\xB7" => "\x70", + "\xF0\x9D\x91\xB8" => "\x71", + "\xF0\x9D\x91\xB9" => "\x72", + "\xF0\x9D\x91\xBA" => "\x73", + "\xF0\x9D\x91\xBB" => "\x74", + "\xF0\x9D\x91\xBC" => "\x75", + "\xF0\x9D\x91\xBD" => "\x76", + "\xF0\x9D\x91\xBE" => "\x77", + "\xF0\x9D\x91\xBF" => "\x78", + "\xF0\x9D\x92\x80" => "\x79", + "\xF0\x9D\x92\x81" => "\x7A", + "\xF0\x9D\x92\x9C" => "\x61", + "\xF0\x9D\x92\x9E" => "\x63", + "\xF0\x9D\x92\x9F" => "\x64", + "\xF0\x9D\x92\xA2" => "\x67", + "\xF0\x9D\x92\xA5" => "\x6A", + "\xF0\x9D\x92\xA6" => "\x6B", + "\xF0\x9D\x92\xA9" => "\x6E", + "\xF0\x9D\x92\xAA" => "\x6F", + "\xF0\x9D\x92\xAB" => "\x70", + "\xF0\x9D\x92\xAC" => "\x71", + "\xF0\x9D\x92\xAE" => "\x73", + "\xF0\x9D\x92\xAF" => "\x74", + "\xF0\x9D\x92\xB0" => "\x75", + "\xF0\x9D\x92\xB1" => "\x76", + "\xF0\x9D\x92\xB2" => "\x77", + "\xF0\x9D\x92\xB3" => "\x78", + "\xF0\x9D\x92\xB4" => "\x79", + "\xF0\x9D\x92\xB5" => "\x7A", + "\xF0\x9D\x93\x90" => "\x61", + "\xF0\x9D\x93\x91" => "\x62", + "\xF0\x9D\x93\x92" => "\x63", + "\xF0\x9D\x93\x93" => "\x64", + "\xF0\x9D\x93\x94" => "\x65", + "\xF0\x9D\x93\x95" => "\x66", + "\xF0\x9D\x93\x96" => "\x67", + "\xF0\x9D\x93\x97" => "\x68", + "\xF0\x9D\x93\x98" => "\x69", + "\xF0\x9D\x93\x99" => "\x6A", + "\xF0\x9D\x93\x9A" => "\x6B", + "\xF0\x9D\x93\x9B" => "\x6C", + "\xF0\x9D\x93\x9C" => "\x6D", + "\xF0\x9D\x93\x9D" => "\x6E", + "\xF0\x9D\x93\x9E" => "\x6F", + "\xF0\x9D\x93\x9F" => "\x70", + "\xF0\x9D\x93\xA0" => "\x71", + "\xF0\x9D\x93\xA1" => "\x72", + "\xF0\x9D\x93\xA2" => "\x73", + "\xF0\x9D\x93\xA3" => "\x74", + "\xF0\x9D\x93\xA4" => "\x75", + "\xF0\x9D\x93\xA5" => "\x76", + "\xF0\x9D\x93\xA6" => "\x77", + "\xF0\x9D\x93\xA7" => "\x78", + "\xF0\x9D\x93\xA8" => "\x79", + "\xF0\x9D\x93\xA9" => "\x7A", + "\xF0\x9D\x94\x84" => "\x61", + "\xF0\x9D\x94\x85" => "\x62", + "\xF0\x9D\x94\x87" => "\x64", + "\xF0\x9D\x94\x88" => "\x65", + "\xF0\x9D\x94\x89" => "\x66", + "\xF0\x9D\x94\x8A" => "\x67", + "\xF0\x9D\x94\x8D" => "\x6A", + "\xF0\x9D\x94\x8E" => "\x6B", + "\xF0\x9D\x94\x8F" => "\x6C", + "\xF0\x9D\x94\x90" => "\x6D", + "\xF0\x9D\x94\x91" => "\x6E", + "\xF0\x9D\x94\x92" => "\x6F", + "\xF0\x9D\x94\x93" => "\x70", + "\xF0\x9D\x94\x94" => "\x71", + "\xF0\x9D\x94\x96" => "\x73", + "\xF0\x9D\x94\x97" => "\x74", + "\xF0\x9D\x94\x98" => "\x75", + "\xF0\x9D\x94\x99" => "\x76", + "\xF0\x9D\x94\x9A" => "\x77", + "\xF0\x9D\x94\x9B" => "\x78", + "\xF0\x9D\x94\x9C" => "\x79", + "\xF0\x9D\x94\xB8" => "\x61", + "\xF0\x9D\x94\xB9" => "\x62", + "\xF0\x9D\x94\xBB" => "\x64", + "\xF0\x9D\x94\xBC" => "\x65", + "\xF0\x9D\x94\xBD" => "\x66", + "\xF0\x9D\x94\xBE" => "\x67", + "\xF0\x9D\x95\x80" => "\x69", + "\xF0\x9D\x95\x81" => "\x6A", + "\xF0\x9D\x95\x82" => "\x6B", + "\xF0\x9D\x95\x83" => "\x6C", + "\xF0\x9D\x95\x84" => "\x6D", + "\xF0\x9D\x95\x86" => "\x6F", + "\xF0\x9D\x95\x8A" => "\x73", + "\xF0\x9D\x95\x8B" => "\x74", + "\xF0\x9D\x95\x8C" => "\x75", + "\xF0\x9D\x95\x8D" => "\x76", + "\xF0\x9D\x95\x8E" => "\x77", + "\xF0\x9D\x95\x8F" => "\x78", + "\xF0\x9D\x95\x90" => "\x79", + "\xF0\x9D\x95\xAC" => "\x61", + "\xF0\x9D\x95\xAD" => "\x62", + "\xF0\x9D\x95\xAE" => "\x63", + "\xF0\x9D\x95\xAF" => "\x64", + "\xF0\x9D\x95\xB0" => "\x65", + "\xF0\x9D\x95\xB1" => "\x66", + "\xF0\x9D\x95\xB2" => "\x67", + "\xF0\x9D\x95\xB3" => "\x68", + "\xF0\x9D\x95\xB4" => "\x69", + "\xF0\x9D\x95\xB5" => "\x6A", + "\xF0\x9D\x95\xB6" => "\x6B", + "\xF0\x9D\x95\xB7" => "\x6C", + "\xF0\x9D\x95\xB8" => "\x6D", + "\xF0\x9D\x95\xB9" => "\x6E", + "\xF0\x9D\x95\xBA" => "\x6F", + "\xF0\x9D\x95\xBB" => "\x70", + "\xF0\x9D\x95\xBC" => "\x71", + "\xF0\x9D\x95\xBD" => "\x72", + "\xF0\x9D\x95\xBE" => "\x73", + "\xF0\x9D\x95\xBF" => "\x74", + "\xF0\x9D\x96\x80" => "\x75", + "\xF0\x9D\x96\x81" => "\x76", + "\xF0\x9D\x96\x82" => "\x77", + "\xF0\x9D\x96\x83" => "\x78", + "\xF0\x9D\x96\x84" => "\x79", + "\xF0\x9D\x96\x85" => "\x7A", + "\xF0\x9D\x96\xA0" => "\x61", + "\xF0\x9D\x96\xA1" => "\x62", + "\xF0\x9D\x96\xA2" => "\x63", + "\xF0\x9D\x96\xA3" => "\x64", + "\xF0\x9D\x96\xA4" => "\x65", + "\xF0\x9D\x96\xA5" => "\x66", + "\xF0\x9D\x96\xA6" => "\x67", + "\xF0\x9D\x96\xA7" => "\x68", + "\xF0\x9D\x96\xA8" => "\x69", + "\xF0\x9D\x96\xA9" => "\x6A", + "\xF0\x9D\x96\xAA" => "\x6B", + "\xF0\x9D\x96\xAB" => "\x6C", + "\xF0\x9D\x96\xAC" => "\x6D", + "\xF0\x9D\x96\xAD" => "\x6E", + "\xF0\x9D\x96\xAE" => "\x6F", + "\xF0\x9D\x96\xAF" => "\x70", + "\xF0\x9D\x96\xB0" => "\x71", + "\xF0\x9D\x96\xB1" => "\x72", + "\xF0\x9D\x96\xB2" => "\x73", + "\xF0\x9D\x96\xB3" => "\x74", + "\xF0\x9D\x96\xB4" => "\x75", + "\xF0\x9D\x96\xB5" => "\x76", + "\xF0\x9D\x96\xB6" => "\x77", + "\xF0\x9D\x96\xB7" => "\x78", + "\xF0\x9D\x96\xB8" => "\x79", + "\xF0\x9D\x96\xB9" => "\x7A", + "\xF0\x9D\x97\x94" => "\x61", + "\xF0\x9D\x97\x95" => "\x62", + "\xF0\x9D\x97\x96" => "\x63", + "\xF0\x9D\x97\x97" => "\x64", + "\xF0\x9D\x97\x98" => "\x65", + "\xF0\x9D\x97\x99" => "\x66", + "\xF0\x9D\x97\x9A" => "\x67", + "\xF0\x9D\x97\x9B" => "\x68", + "\xF0\x9D\x97\x9C" => "\x69", + "\xF0\x9D\x97\x9D" => "\x6A", + "\xF0\x9D\x97\x9E" => "\x6B", + "\xF0\x9D\x97\x9F" => "\x6C", + "\xF0\x9D\x97\xA0" => "\x6D", + "\xF0\x9D\x97\xA1" => "\x6E", + "\xF0\x9D\x97\xA2" => "\x6F", + "\xF0\x9D\x97\xA3" => "\x70", + "\xF0\x9D\x97\xA4" => "\x71", + "\xF0\x9D\x97\xA5" => "\x72", + "\xF0\x9D\x97\xA6" => "\x73", + "\xF0\x9D\x97\xA7" => "\x74", + "\xF0\x9D\x97\xA8" => "\x75", + "\xF0\x9D\x97\xA9" => "\x76", + "\xF0\x9D\x97\xAA" => "\x77", + "\xF0\x9D\x97\xAB" => "\x78", + "\xF0\x9D\x97\xAC" => "\x79", + "\xF0\x9D\x97\xAD" => "\x7A", + "\xF0\x9D\x98\x88" => "\x61", + "\xF0\x9D\x98\x89" => "\x62", + "\xF0\x9D\x98\x8A" => "\x63", + "\xF0\x9D\x98\x8B" => "\x64", + "\xF0\x9D\x98\x8C" => "\x65", + "\xF0\x9D\x98\x8D" => "\x66", + "\xF0\x9D\x98\x8E" => "\x67", + "\xF0\x9D\x98\x8F" => "\x68", + "\xF0\x9D\x98\x90" => "\x69", + "\xF0\x9D\x98\x91" => "\x6A", + "\xF0\x9D\x98\x92" => "\x6B", + "\xF0\x9D\x98\x93" => "\x6C", + "\xF0\x9D\x98\x94" => "\x6D", + "\xF0\x9D\x98\x95" => "\x6E", + "\xF0\x9D\x98\x96" => "\x6F", + "\xF0\x9D\x98\x97" => "\x70", + "\xF0\x9D\x98\x98" => "\x71", + "\xF0\x9D\x98\x99" => "\x72", + "\xF0\x9D\x98\x9A" => "\x73", + "\xF0\x9D\x98\x9B" => "\x74", + "\xF0\x9D\x98\x9C" => "\x75", + "\xF0\x9D\x98\x9D" => "\x76", + "\xF0\x9D\x98\x9E" => "\x77", + "\xF0\x9D\x98\x9F" => "\x78", + "\xF0\x9D\x98\xA0" => "\x79", + "\xF0\x9D\x98\xA1" => "\x7A", + "\xF0\x9D\x98\xBC" => "\x61", + "\xF0\x9D\x98\xBD" => "\x62", + "\xF0\x9D\x98\xBE" => "\x63", + "\xF0\x9D\x98\xBF" => "\x64", + "\xF0\x9D\x99\x80" => "\x65", + "\xF0\x9D\x99\x81" => "\x66", + "\xF0\x9D\x99\x82" => "\x67", + "\xF0\x9D\x99\x83" => "\x68", + "\xF0\x9D\x99\x84" => "\x69", + "\xF0\x9D\x99\x85" => "\x6A", + "\xF0\x9D\x99\x86" => "\x6B", + "\xF0\x9D\x99\x87" => "\x6C", + "\xF0\x9D\x99\x88" => "\x6D", + "\xF0\x9D\x99\x89" => "\x6E", + "\xF0\x9D\x99\x8A" => "\x6F", + "\xF0\x9D\x99\x8B" => "\x70", + "\xF0\x9D\x99\x8C" => "\x71", + "\xF0\x9D\x99\x8D" => "\x72", + "\xF0\x9D\x99\x8E" => "\x73", + "\xF0\x9D\x99\x8F" => "\x74", + "\xF0\x9D\x99\x90" => "\x75", + "\xF0\x9D\x99\x91" => "\x76", + "\xF0\x9D\x99\x92" => "\x77", + "\xF0\x9D\x99\x93" => "\x78", + "\xF0\x9D\x99\x94" => "\x79", + "\xF0\x9D\x99\x95" => "\x7A", + "\xF0\x9D\x99\xB0" => "\x61", + "\xF0\x9D\x99\xB1" => "\x62", + "\xF0\x9D\x99\xB2" => "\x63", + "\xF0\x9D\x99\xB3" => "\x64", + "\xF0\x9D\x99\xB4" => "\x65", + "\xF0\x9D\x99\xB5" => "\x66", + "\xF0\x9D\x99\xB6" => "\x67", + "\xF0\x9D\x99\xB7" => "\x68", + "\xF0\x9D\x99\xB8" => "\x69", + "\xF0\x9D\x99\xB9" => "\x6A", + "\xF0\x9D\x99\xBA" => "\x6B", + "\xF0\x9D\x99\xBB" => "\x6C", + "\xF0\x9D\x99\xBC" => "\x6D", + "\xF0\x9D\x99\xBD" => "\x6E", + "\xF0\x9D\x99\xBE" => "\x6F", + "\xF0\x9D\x99\xBF" => "\x70", + "\xF0\x9D\x9A\x80" => "\x71", + "\xF0\x9D\x9A\x81" => "\x72", + "\xF0\x9D\x9A\x82" => "\x73", + "\xF0\x9D\x9A\x83" => "\x74", + "\xF0\x9D\x9A\x84" => "\x75", + "\xF0\x9D\x9A\x85" => "\x76", + "\xF0\x9D\x9A\x86" => "\x77", + "\xF0\x9D\x9A\x87" => "\x78", + "\xF0\x9D\x9A\x88" => "\x79", + "\xF0\x9D\x9A\x89" => "\x7A", + "\xF0\x9D\x9A\xA8" => "\xCE\xB1", + "\xF0\x9D\x9A\xA9" => "\xCE\xB2", + "\xF0\x9D\x9A\xAA" => "\xCE\xB3", + "\xF0\x9D\x9A\xAB" => "\xCE\xB4", + "\xF0\x9D\x9A\xAC" => "\xCE\xB5", + "\xF0\x9D\x9A\xAD" => "\xCE\xB6", + "\xF0\x9D\x9A\xAE" => "\xCE\xB7", + "\xF0\x9D\x9A\xAF" => "\xCE\xB8", + "\xF0\x9D\x9A\xB0" => "\xCE\xB9", + "\xF0\x9D\x9A\xB1" => "\xCE\xBA", + "\xF0\x9D\x9A\xB2" => "\xCE\xBB", + "\xF0\x9D\x9A\xB3" => "\xCE\xBC", + "\xF0\x9D\x9A\xB4" => "\xCE\xBD", + "\xF0\x9D\x9A\xB5" => "\xCE\xBE", + "\xF0\x9D\x9A\xB6" => "\xCE\xBF", + "\xF0\x9D\x9A\xB7" => "\xCF\x80", + "\xF0\x9D\x9A\xB8" => "\xCF\x81", + "\xF0\x9D\x9A\xB9" => "\xCE\xB8", + "\xF0\x9D\x9A\xBA" => "\xCF\x83", + "\xF0\x9D\x9A\xBB" => "\xCF\x84", + "\xF0\x9D\x9A\xBC" => "\xCF\x85", + "\xF0\x9D\x9A\xBD" => "\xCF\x86", + "\xF0\x9D\x9A\xBE" => "\xCF\x87", + "\xF0\x9D\x9A\xBF" => "\xCF\x88", + "\xF0\x9D\x9B\x80" => "\xCF\x89", + "\xF0\x9D\x9B\x93" => "\xCF\x83", + "\xF0\x9D\x9B\xA2" => "\xCE\xB1", + "\xF0\x9D\x9B\xA3" => "\xCE\xB2", + "\xF0\x9D\x9B\xA4" => "\xCE\xB3", + "\xF0\x9D\x9B\xA5" => "\xCE\xB4", + "\xF0\x9D\x9B\xA6" => "\xCE\xB5", + "\xF0\x9D\x9B\xA7" => "\xCE\xB6", + "\xF0\x9D\x9B\xA8" => "\xCE\xB7", + "\xF0\x9D\x9B\xA9" => "\xCE\xB8", + "\xF0\x9D\x9B\xAA" => "\xCE\xB9", + "\xF0\x9D\x9B\xAB" => "\xCE\xBA", + "\xF0\x9D\x9B\xAC" => "\xCE\xBB", + "\xF0\x9D\x9B\xAD" => "\xCE\xBC", + "\xF0\x9D\x9B\xAE" => "\xCE\xBD", + "\xF0\x9D\x9B\xAF" => "\xCE\xBE", + "\xF0\x9D\x9B\xB0" => "\xCE\xBF", + "\xF0\x9D\x9B\xB1" => "\xCF\x80", + "\xF0\x9D\x9B\xB2" => "\xCF\x81", + "\xF0\x9D\x9B\xB3" => "\xCE\xB8", + "\xF0\x9D\x9B\xB4" => "\xCF\x83", + "\xF0\x9D\x9B\xB5" => "\xCF\x84", + "\xF0\x9D\x9B\xB6" => "\xCF\x85", + "\xF0\x9D\x9B\xB7" => "\xCF\x86", + "\xF0\x9D\x9B\xB8" => "\xCF\x87", + "\xF0\x9D\x9B\xB9" => "\xCF\x88", + "\xF0\x9D\x9B\xBA" => "\xCF\x89", + "\xF0\x9D\x9C\x8D" => "\xCF\x83", + "\xF0\x9D\x9C\x9C" => "\xCE\xB1", + "\xF0\x9D\x9C\x9D" => "\xCE\xB2", + "\xF0\x9D\x9C\x9E" => "\xCE\xB3", + "\xF0\x9D\x9C\x9F" => "\xCE\xB4", + "\xF0\x9D\x9C\xA0" => "\xCE\xB5", + "\xF0\x9D\x9C\xA1" => "\xCE\xB6", + "\xF0\x9D\x9C\xA2" => "\xCE\xB7", + "\xF0\x9D\x9C\xA3" => "\xCE\xB8", + "\xF0\x9D\x9C\xA4" => "\xCE\xB9", + "\xF0\x9D\x9C\xA5" => "\xCE\xBA", + "\xF0\x9D\x9C\xA6" => "\xCE\xBB", + "\xF0\x9D\x9C\xA7" => "\xCE\xBC", + "\xF0\x9D\x9C\xA8" => "\xCE\xBD", + "\xF0\x9D\x9C\xA9" => "\xCE\xBE", + "\xF0\x9D\x9C\xAA" => "\xCE\xBF", + "\xF0\x9D\x9C\xAB" => "\xCF\x80", + "\xF0\x9D\x9C\xAC" => "\xCF\x81", + "\xF0\x9D\x9C\xAD" => "\xCE\xB8", + "\xF0\x9D\x9C\xAE" => "\xCF\x83", + "\xF0\x9D\x9C\xAF" => "\xCF\x84", + "\xF0\x9D\x9C\xB0" => "\xCF\x85", + "\xF0\x9D\x9C\xB1" => "\xCF\x86", + "\xF0\x9D\x9C\xB2" => "\xCF\x87", + "\xF0\x9D\x9C\xB3" => "\xCF\x88", + "\xF0\x9D\x9C\xB4" => "\xCF\x89", + "\xF0\x9D\x9D\x87" => "\xCF\x83", + "\xF0\x9D\x9D\x96" => "\xCE\xB1", + "\xF0\x9D\x9D\x97" => "\xCE\xB2", + "\xF0\x9D\x9D\x98" => "\xCE\xB3", + "\xF0\x9D\x9D\x99" => "\xCE\xB4", + "\xF0\x9D\x9D\x9A" => "\xCE\xB5", + "\xF0\x9D\x9D\x9B" => "\xCE\xB6", + "\xF0\x9D\x9D\x9C" => "\xCE\xB7", + "\xF0\x9D\x9D\x9D" => "\xCE\xB8", + "\xF0\x9D\x9D\x9E" => "\xCE\xB9", + "\xF0\x9D\x9D\x9F" => "\xCE\xBA", + "\xF0\x9D\x9D\xA0" => "\xCE\xBB", + "\xF0\x9D\x9D\xA1" => "\xCE\xBC", + "\xF0\x9D\x9D\xA2" => "\xCE\xBD", + "\xF0\x9D\x9D\xA3" => "\xCE\xBE", + "\xF0\x9D\x9D\xA4" => "\xCE\xBF", + "\xF0\x9D\x9D\xA5" => "\xCF\x80", + "\xF0\x9D\x9D\xA6" => "\xCF\x81", + "\xF0\x9D\x9D\xA7" => "\xCE\xB8", + "\xF0\x9D\x9D\xA8" => "\xCF\x83", + "\xF0\x9D\x9D\xA9" => "\xCF\x84", + "\xF0\x9D\x9D\xAA" => "\xCF\x85", + "\xF0\x9D\x9D\xAB" => "\xCF\x86", + "\xF0\x9D\x9D\xAC" => "\xCF\x87", + "\xF0\x9D\x9D\xAD" => "\xCF\x88", + "\xF0\x9D\x9D\xAE" => "\xCF\x89", + "\xF0\x9D\x9E\x81" => "\xCF\x83", + "\xF0\x9D\x9E\x90" => "\xCE\xB1", + "\xF0\x9D\x9E\x91" => "\xCE\xB2", + "\xF0\x9D\x9E\x92" => "\xCE\xB3", + "\xF0\x9D\x9E\x93" => "\xCE\xB4", + "\xF0\x9D\x9E\x94" => "\xCE\xB5", + "\xF0\x9D\x9E\x95" => "\xCE\xB6", + "\xF0\x9D\x9E\x96" => "\xCE\xB7", + "\xF0\x9D\x9E\x97" => "\xCE\xB8", + "\xF0\x9D\x9E\x98" => "\xCE\xB9", + "\xF0\x9D\x9E\x99" => "\xCE\xBA", + "\xF0\x9D\x9E\x9A" => "\xCE\xBB", + "\xF0\x9D\x9E\x9B" => "\xCE\xBC", + "\xF0\x9D\x9E\x9C" => "\xCE\xBD", + "\xF0\x9D\x9E\x9D" => "\xCE\xBE", + "\xF0\x9D\x9E\x9E" => "\xCE\xBF", + "\xF0\x9D\x9E\x9F" => "\xCF\x80", + "\xF0\x9D\x9E\xA0" => "\xCF\x81", + "\xF0\x9D\x9E\xA1" => "\xCE\xB8", + "\xF0\x9D\x9E\xA2" => "\xCF\x83", + "\xF0\x9D\x9E\xA3" => "\xCF\x84", + "\xF0\x9D\x9E\xA4" => "\xCF\x85", + "\xF0\x9D\x9E\xA5" => "\xCF\x86", + "\xF0\x9D\x9E\xA6" => "\xCF\x87", + "\xF0\x9D\x9E\xA7" => "\xCF\x88", + "\xF0\x9D\x9E\xA8" => "\xCF\x89", + "\xF0\x9D\x9E\xBB" => "\xCF\x83", + "\xF0\x9D\x9F\x8A" => "\xCF\x9D", + ); + + // do the case fold + $text = utf8_case_fold($text, $option); + + // convert to NFKC + Normalizer::normalize($text, Normalizer::NFKC); + + // FC_NFKC_Closure, http://www.unicode.org/Public/5.0.0/ucd/DerivedNormalizationProps.txt + $text = strtr($text, $fc_nfkc_closure); + + return $text; +} + +/** +* Assume the input is NFC: +* Takes the input and does a "special" case fold. It does minor normalization as well. +* +* @param string $text text to be case folded +* @param string $option determines how we will fold the cases +* @return string case folded text +*/ +function utf8_case_fold_nfc($text, $option = 'full') +{ + static $uniarray = array(); + static $ypogegrammeni = array( + "\xCD\xBA" => "\x20\xCD\x85", + "\xE1\xBE\x80" => "\xE1\xBC\x80\xCD\x85", + "\xE1\xBE\x81" => "\xE1\xBC\x81\xCD\x85", + "\xE1\xBE\x82" => "\xE1\xBC\x82\xCD\x85", + "\xE1\xBE\x83" => "\xE1\xBC\x83\xCD\x85", + "\xE1\xBE\x84" => "\xE1\xBC\x84\xCD\x85", + "\xE1\xBE\x85" => "\xE1\xBC\x85\xCD\x85", + "\xE1\xBE\x86" => "\xE1\xBC\x86\xCD\x85", + "\xE1\xBE\x87" => "\xE1\xBC\x87\xCD\x85", + "\xE1\xBE\x88" => "\xE1\xBC\x88\xCD\x85", + "\xE1\xBE\x89" => "\xE1\xBC\x89\xCD\x85", + "\xE1\xBE\x8A" => "\xE1\xBC\x8A\xCD\x85", + "\xE1\xBE\x8B" => "\xE1\xBC\x8B\xCD\x85", + "\xE1\xBE\x8C" => "\xE1\xBC\x8C\xCD\x85", + "\xE1\xBE\x8D" => "\xE1\xBC\x8D\xCD\x85", + "\xE1\xBE\x8E" => "\xE1\xBC\x8E\xCD\x85", + "\xE1\xBE\x8F" => "\xE1\xBC\x8F\xCD\x85", + "\xE1\xBE\x90" => "\xE1\xBC\xA0\xCD\x85", + "\xE1\xBE\x91" => "\xE1\xBC\xA1\xCD\x85", + "\xE1\xBE\x92" => "\xE1\xBC\xA2\xCD\x85", + "\xE1\xBE\x93" => "\xE1\xBC\xA3\xCD\x85", + "\xE1\xBE\x94" => "\xE1\xBC\xA4\xCD\x85", + "\xE1\xBE\x95" => "\xE1\xBC\xA5\xCD\x85", + "\xE1\xBE\x96" => "\xE1\xBC\xA6\xCD\x85", + "\xE1\xBE\x97" => "\xE1\xBC\xA7\xCD\x85", + "\xE1\xBE\x98" => "\xE1\xBC\xA8\xCD\x85", + "\xE1\xBE\x99" => "\xE1\xBC\xA9\xCD\x85", + "\xE1\xBE\x9A" => "\xE1\xBC\xAA\xCD\x85", + "\xE1\xBE\x9B" => "\xE1\xBC\xAB\xCD\x85", + "\xE1\xBE\x9C" => "\xE1\xBC\xAC\xCD\x85", + "\xE1\xBE\x9D" => "\xE1\xBC\xAD\xCD\x85", + "\xE1\xBE\x9E" => "\xE1\xBC\xAE\xCD\x85", + "\xE1\xBE\x9F" => "\xE1\xBC\xAF\xCD\x85", + "\xE1\xBE\xA0" => "\xE1\xBD\xA0\xCD\x85", + "\xE1\xBE\xA1" => "\xE1\xBD\xA1\xCD\x85", + "\xE1\xBE\xA2" => "\xE1\xBD\xA2\xCD\x85", + "\xE1\xBE\xA3" => "\xE1\xBD\xA3\xCD\x85", + "\xE1\xBE\xA4" => "\xE1\xBD\xA4\xCD\x85", + "\xE1\xBE\xA5" => "\xE1\xBD\xA5\xCD\x85", + "\xE1\xBE\xA6" => "\xE1\xBD\xA6\xCD\x85", + "\xE1\xBE\xA7" => "\xE1\xBD\xA7\xCD\x85", + "\xE1\xBE\xA8" => "\xE1\xBD\xA8\xCD\x85", + "\xE1\xBE\xA9" => "\xE1\xBD\xA9\xCD\x85", + "\xE1\xBE\xAA" => "\xE1\xBD\xAA\xCD\x85", + "\xE1\xBE\xAB" => "\xE1\xBD\xAB\xCD\x85", + "\xE1\xBE\xAC" => "\xE1\xBD\xAC\xCD\x85", + "\xE1\xBE\xAD" => "\xE1\xBD\xAD\xCD\x85", + "\xE1\xBE\xAE" => "\xE1\xBD\xAE\xCD\x85", + "\xE1\xBE\xAF" => "\xE1\xBD\xAF\xCD\x85", + "\xE1\xBE\xB2" => "\xE1\xBD\xB0\xCD\x85", + "\xE1\xBE\xB3" => "\xCE\xB1\xCD\x85", + "\xE1\xBE\xB4" => "\xCE\xAC\xCD\x85", + "\xE1\xBE\xB7" => "\xE1\xBE\xB6\xCD\x85", + "\xE1\xBE\xBC" => "\xCE\x91\xCD\x85", + "\xE1\xBF\x82" => "\xE1\xBD\xB4\xCD\x85", + "\xE1\xBF\x83" => "\xCE\xB7\xCD\x85", + "\xE1\xBF\x84" => "\xCE\xAE\xCD\x85", + "\xE1\xBF\x87" => "\xE1\xBF\x86\xCD\x85", + "\xE1\xBF\x8C" => "\xCE\x97\xCD\x85", + "\xE1\xBF\xB2" => "\xE1\xBD\xBC\xCD\x85", + "\xE1\xBF\xB3" => "\xCF\x89\xCD\x85", + "\xE1\xBF\xB4" => "\xCF\x8E\xCD\x85", + "\xE1\xBF\xB7" => "\xE1\xBF\xB6\xCD\x85", + "\xE1\xBF\xBC" => "\xCE\xA9\xCD\x85", + ); + + // perform a small trick, avoid further normalization on composed points that contain U+0345 in their decomposition + $text = strtr($text, $ypogegrammeni); + + // do the case fold + $text = utf8_case_fold($text, $option); + + return $text; +} + +/** +* wrapper around PHP's native normalizer from intl +* previously a PECL extension, included in the core since PHP 5.3.0 +* http://php.net/manual/en/normalizer.normalize.php +* +* @param mixed $strings a string or an array of strings to normalize +* @return mixed the normalized content, preserving array keys if array given. +*/ +function utf8_normalize_nfc($strings) +{ + if (empty($strings)) + { + return $strings; + } + + if (!is_array($strings)) + { + if (Normalizer::isNormalized($strings)) + { + return $strings; + } + return (string) Normalizer::normalize($strings); + } + else + { + foreach ($strings as $key => $string) + { + if (is_array($string)) + { + foreach ($string as $_key => $_string) + { + if (Normalizer::isNormalized($strings[$key][$_key])) + { + continue; + } + $strings[$key][$_key] = (string) Normalizer::normalize($strings[$key][$_key]); + } + } + else + { + if (Normalizer::isNormalized($strings[$key])) + { + continue; + } + $strings[$key] = (string) Normalizer::normalize($strings[$key]); + } + } + } + + return $strings; +} + +/** +* This function is used to generate a "clean" version of a string. +* Clean means that it is a case insensitive form (case folding) and that it is normalized (NFC). +* Additionally a homographs of one character are transformed into one specific character (preferably ASCII +* if it is an ASCII character). +* +* Please be aware that if you change something within this function or within +* functions used here you need to rebuild/update the username_clean column in the users table. And all other +* columns that store a clean string otherwise you will break this functionality. +* +* @param string $text An unclean string, mabye user input (has to be valid UTF-8!) +* @return string Cleaned up version of the input string +*/ +function utf8_clean_string($text) +{ + global $phpbb_root_path, $phpEx; + + static $homographs = array(); + if (empty($homographs)) + { + $homographs = include($phpbb_root_path . 'includes/utf/data/confusables.' . $phpEx); + } + + $text = utf8_case_fold_nfkc($text); + $text = strtr($text, $homographs); + // Other control characters + $text = preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $text); + + // we need to reduce multiple spaces to a single one + $text = preg_replace('# {2,}#', ' ', $text); + + // we can use trim here as all the other space characters should have been turned + // into normal ASCII spaces by now + return trim($text); +} + +/** +* A wrapper for htmlspecialchars($value, ENT_COMPAT, 'UTF-8') +*/ +function utf8_htmlspecialchars($value) +{ + return htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); +} + +/** +* Trying to convert returned system message to utf8 +* +* PHP assumes such messages are ISO-8859-1 so we'll do that too +* and if it breaks messages we'll blame it on them ;-) +*/ +function utf8_convert_message($message) +{ + // First of all check if conversion is neded at all, as there is no point + // in converting ASCII messages from ISO-8859-1 to UTF-8 + if (!preg_match('/[\x80-\xFF]/', $message)) + { + return utf8_htmlspecialchars($message); + } + + // else we need to convert some part of the message + return utf8_htmlspecialchars(utf8_recode($message, 'ISO-8859-1')); +} + +/** +* UTF8-compatible wordwrap replacement +* +* @param string $string The input string +* @param int $width The column width. Defaults to 75. +* @param string $break The line is broken using the optional break parameter. Defaults to '\n'. +* @param bool $cut If the cut is set to TRUE, the string is always wrapped at the specified width. So if you have a word that is larger than the given width, it is broken apart. +* +* @return string the given string wrapped at the specified column. +* +*/ +function utf8_wordwrap($string, $width = 75, $break = "\n", $cut = false) +{ + // We first need to explode on $break, not destroying existing (intended) breaks + $lines = explode($break, $string); + $new_lines = array(0 => ''); + $index = 0; + + foreach ($lines as $line) + { + $words = explode(' ', $line); + + for ($i = 0, $size = count($words); $i < $size; $i++) + { + $word = $words[$i]; + + // If cut is true we need to cut the word if it is > width chars + if ($cut && utf8_strlen($word) > $width) + { + $words[$i] = utf8_substr($word, $width); + $word = utf8_substr($word, 0, $width); + $i--; + } + + if (utf8_strlen($new_lines[$index] . $word) > $width) + { + $new_lines[$index] = substr($new_lines[$index], 0, -1); + $index++; + $new_lines[$index] = ''; + } + + $new_lines[$index] .= $word . ' '; + } + + $new_lines[$index] = substr($new_lines[$index], 0, -1); + $index++; + $new_lines[$index] = ''; + } + + unset($new_lines[$index]); + return implode($break, $new_lines); +} + +/** +* UTF8-safe basename() function +* +* basename() has some limitations and is dependent on the locale setting +* according to the PHP manual. Therefore we provide our own locale independent +* basename function. +* +* @param string $filename The filename basename() should be applied to +* @return string The basenamed filename +*/ +function utf8_basename($filename) +{ + // We always check for forward slash AND backward slash + // because they could be mixed or "sneaked" in. ;) + // You know, never trust user input... + if (strpos($filename, '/') !== false) + { + $filename = utf8_substr($filename, utf8_strrpos($filename, '/') + 1); + } + + if (strpos($filename, '\\') !== false) + { + $filename = utf8_substr($filename, utf8_strrpos($filename, '\\') + 1); + } + + return $filename; +} diff --git a/install/update/new/index.php b/install/update/new/index.php new file mode 100644 index 0000000..5622bc3 --- /dev/null +++ b/install/update/new/index.php @@ -0,0 +1,252 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('viewforum'); + +// Mark notifications read +if (($mark_notification = $request->variable('mark_notification', 0))) +{ + if ($user->data['user_id'] == ANONYMOUS) + { + if ($request->is_ajax()) + { + trigger_error('LOGIN_REQUIRED'); + } + login_box('', $user->lang['LOGIN_REQUIRED']); + } + + if (check_link_hash($request->variable('hash', ''), 'mark_notification_read')) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $notification = $phpbb_notifications->load_notifications('notification.method.board', array( + 'notification_id' => $mark_notification, + )); + + if (isset($notification['notifications'][$mark_notification])) + { + $notification = $notification['notifications'][$mark_notification]; + + $notification->mark_read(); + + /** + * You can use this event to perform additional tasks or redirect user elsewhere. + * + * @event core.index_mark_notification_after + * @var int mark_notification Notification ID + * @var \phpbb\notification\type\type_interface notification Notification instance + * @since 3.2.6-RC1 + */ + $vars = array('mark_notification', 'notification'); + extract($phpbb_dispatcher->trigger_event('core.index_mark_notification_after', compact($vars))); + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'success' => true, + )); + } + + if (($redirect = $request->variable('redirect', ''))) + { + redirect(append_sid($phpbb_root_path . $redirect)); + } + + redirect($notification->get_redirect_url()); + } + } +} + +display_forums('', $config['load_moderators']); + +$order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; +// Grab group details for legend display +if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) +{ + $sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend + FROM ' . GROUPS_TABLE . ' + WHERE group_legend > 0 + ORDER BY ' . $order_legend . ' ASC'; +} +else +{ + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE g.group_legend > 0 + AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ') + ORDER BY g.' . $order_legend . ' ASC'; +} +$result = $db->sql_query($sql); + +/** @var \phpbb\group\helper $group_helper */ +$group_helper = $phpbb_container->get('group_helper'); + +$legend = array(); +while ($row = $db->sql_fetchrow($result)) +{ + $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : ''; + $group_name = $group_helper->get_name($row['group_name']); + + if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile'))) + { + $legend[] = '' . $group_name . '
'; + } + else + { + $legend[] = '' . $group_name . ''; + } +} +$db->sql_freeresult($result); + +$legend = implode($user->lang['COMMA_SEPARATOR'], $legend); + +// Generate birthday list if required ... +$show_birthdays = ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')); + +$birthdays = $birthday_list = array(); +if ($show_birthdays) +{ + $time = $user->create_datetime(); + $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset()); + + // Display birthdays of 29th february on 28th february in non-leap-years + $leap_year_birthdays = ''; + if ($now['mday'] == 28 && $now['mon'] == 2 && !$time->format('L')) + { + $leap_year_birthdays = " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'"; + } + + $sql_ary = array( + 'SELECT' => 'u.user_id, u.username, u.user_colour, u.user_birthday', + 'FROM' => array( + USERS_TABLE => 'u', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(BANLIST_TABLE => 'b'), + 'ON' => 'u.user_id = b.ban_userid', + ), + ), + 'WHERE' => "(b.ban_id IS NULL OR b.ban_exclude = 1) + AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' $leap_year_birthdays) + AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')', + ); + + /** + * Event to modify the SQL query to get birthdays data + * + * @event core.index_modify_birthdays_sql + * @var array now The assoc array with the 'now' local timestamp data + * @var array sql_ary The SQL array to get the birthdays data + * @var object time The user related Datetime object + * @since 3.1.7-RC1 + */ + $vars = array('now', 'sql_ary', 'time'); + extract($phpbb_dispatcher->trigger_event('core.index_modify_birthdays_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + $rows = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + foreach ($rows as $row) + { + $birthday_username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); + $birthday_year = (int) substr($row['user_birthday'], -4); + $birthday_age = ($birthday_year) ? max(0, $now['year'] - $birthday_year) : ''; + + $birthdays[] = array( + 'USERNAME' => $birthday_username, + 'AGE' => $birthday_age, + ); + + // For 3.0 compatibility + $birthday_list[] = $birthday_username . (($birthday_age) ? " ({$birthday_age})" : ''); + } + + /** + * Event to modify the birthdays list + * + * @event core.index_modify_birthdays_list + * @var array birthdays Array with the users birthdays data + * @var array rows Array with the birthdays SQL query result + * @since 3.1.7-RC1 + */ + $vars = array('birthdays', 'rows'); + extract($phpbb_dispatcher->trigger_event('core.index_modify_birthdays_list', compact($vars))); + + $template->assign_block_vars_array('birthdays', $birthdays); +} + +// Assign index specific vars +$template->assign_vars(array( + 'TOTAL_POSTS' => $user->lang('TOTAL_POSTS_COUNT', (int) $config['num_posts']), + 'TOTAL_TOPICS' => $user->lang('TOTAL_TOPICS', (int) $config['num_topics']), + 'TOTAL_USERS' => $user->lang('TOTAL_USERS', (int) $config['num_users']), + 'NEWEST_USER' => $user->lang('NEWEST_USER', get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])), + + 'LEGEND' => $legend, + 'BIRTHDAY_LIST' => (empty($birthday_list)) ? '' : implode($user->lang['COMMA_SEPARATOR'], $birthday_list), + + 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), + 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '', + 'S_DISPLAY_BIRTHDAY_LIST' => $show_birthdays, + 'S_INDEX' => true, + + 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums&mark_time=' . time()) : '', + 'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '') +); + +$page_title = ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['INDEX']; + +/** +* You can use this event to modify the page title and load data for the index +* +* @event core.index_modify_page_title +* @var string page_title Title of the index page +* @since 3.1.0-a1 +*/ +$vars = array('page_title'); +extract($phpbb_dispatcher->trigger_event('core.index_modify_page_title', compact($vars))); + +// Output page +page_header($page_title, true); + +$template->set_filenames(array( + 'body' => 'index_body.html') +); + +page_footer(); diff --git a/install/update/new/language/en/acp/attachments.php b/install/update/new/language/en/acp/attachments.php new file mode 100644 index 0000000..67454f8 --- /dev/null +++ b/install/update/new/language/en/acp/attachments.php @@ -0,0 +1,167 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'ACP_ATTACHMENT_SETTINGS_EXPLAIN' => 'Here you can configure the main settings for attachments and the associated special categories.', + 'ACP_EXTENSION_GROUPS_EXPLAIN' => 'Here you can add, delete, modify or disable your extension groups. Further options include the assignment of a special category to them, changing the download mechanism and defining an upload icon which will be displayed in front of the attachment which belongs to the group.', + 'ACP_MANAGE_EXTENSIONS_EXPLAIN' => 'Here you can manage your allowed extensions. To activate your extensions, please refer to the extension groups management panel. We strongly recommend not to allow scripting extensions (such as php, php3, php4, phtml, pl, cgi, py, rb, asp, aspx, and so forth…).', + 'ACP_ORPHAN_ATTACHMENTS_EXPLAIN' => 'Here you are able to see orphaned files. This happens mostly if users are attaching files but not submitting the post. You are able to delete the files or attach them to existing posts. Attaching to posts requires a valid post ID, you have to determine this ID by yourself. This will assign the already uploaded attachment to the post you entered.', + 'ADD_EXTENSION' => 'Add extension', + 'ADD_EXTENSION_GROUP' => 'Add extension group', + 'ADMIN_UPLOAD_ERROR' => 'Errors while trying to attach file: “%s”.', + 'ALLOWED_FORUMS' => 'Allowed forums', + 'ALLOWED_FORUMS_EXPLAIN' => 'Able to post the assigned extensions at the selected (or all if selected) forums.', + 'ALLOWED_IN_PM_POST' => 'Allowed', + 'ALLOW_ATTACHMENTS' => 'Allow attachments', + 'ALLOW_ALL_FORUMS' => 'Allow all forums', + 'ALLOW_IN_PM' => 'Allowed in private messaging', + 'ALLOW_PM_ATTACHMENTS' => 'Allow attachments in private messages', + 'ALLOW_SELECTED_FORUMS' => 'Only forums selected below', + 'ASSIGNED_EXTENSIONS' => 'Assigned extensions', + 'ASSIGNED_GROUP' => 'Assigned extension group', + 'ATTACH_EXTENSIONS_URL' => 'Extensions', + 'ATTACH_EXT_GROUPS_URL' => 'Extension groups', + 'ATTACH_ID' => 'ID', + 'ATTACH_MAX_FILESIZE' => 'Maximum file size', + 'ATTACH_MAX_FILESIZE_EXPLAIN' => 'Maximum size of each file. If this value is 0, the uploadable filesize is only limited by your PHP configuration.', + 'ATTACH_MAX_PM_FILESIZE' => 'Maximum file size messaging', + 'ATTACH_MAX_PM_FILESIZE_EXPLAIN' => 'Maximum size of each file, with 0 being unlimited, attached to a private message.', + 'ATTACH_ORPHAN_URL' => 'Orphan attachments', + 'ATTACH_POST_ID' => 'Post ID', + 'ATTACH_POST_TYPE' => 'Post type', + 'ATTACH_QUOTA' => 'Total attachment quota', + 'ATTACH_QUOTA_EXPLAIN' => 'Maximum drive space available for attachments for the whole board, with 0 being unlimited.', + 'ATTACH_TO_POST' => 'Attach file to post', + + 'CAT_IMAGES' => 'Images', + 'CHECK_CONTENT' => 'Check attachment files', + 'CHECK_CONTENT_EXPLAIN' => 'Some browsers can be tricked to assume an incorrect mimetype for uploaded files. This option ensures that such files likely to cause this are rejected.', + 'CREATE_GROUP' => 'Create new group', + 'CREATE_THUMBNAIL' => 'Create thumbnail', + 'CREATE_THUMBNAIL_EXPLAIN' => 'Create a thumbnail in all possible situations.', + + 'DEFINE_ALLOWED_IPS' => 'Define allowed IPs/hostnames', + 'DEFINE_DISALLOWED_IPS' => 'Define disallowed IPs/hostnames', + 'DOWNLOAD_ADD_IPS_EXPLAIN' => 'To specify several different IPs or hostnames enter each on a new line. To specify a range of IP addresses separate the start and end with a hyphen (-), to specify a wildcard use “*”.', + 'DOWNLOAD_REMOVE_IPS_EXPLAIN' => 'You can remove (or un-exclude) multiple IP addresses in one go using the appropriate combination of mouse and keyboard for your computer and browser. Excluded IPs have a blue background.', + 'DISPLAY_INLINED' => 'Display images inline', + 'DISPLAY_INLINED_EXPLAIN' => 'If set to No image attachments will show as a link.', + 'DISPLAY_ORDER' => 'Attachment display order', + 'DISPLAY_ORDER_EXPLAIN' => 'Display attachments ordered by time.', + + 'EDIT_EXTENSION_GROUP' => 'Edit extension group', + 'EXCLUDE_ENTERED_IP' => 'Enable this to exclude the entered IP/hostname.', + 'EXCLUDE_FROM_ALLOWED_IP' => 'Exclude IP from allowed IPs/hostnames', + 'EXCLUDE_FROM_DISALLOWED_IP' => 'Exclude IP from disallowed IPs/hostnames', + 'EXTENSIONS_UPDATED' => 'Extensions successfully updated.', + 'EXTENSION_EXIST' => 'The extension %s already exists.', + 'EXTENSION_GROUP' => 'Extension group', + 'EXTENSION_GROUPS' => 'Extension groups', + 'EXTENSION_GROUP_DELETED' => 'Extension group successfully deleted.', + 'EXTENSION_GROUP_EXIST' => 'The extension group %s already exists.', + + 'EXT_GROUP_ARCHIVES' => 'Archives', + 'EXT_GROUP_DOCUMENTS' => 'Documents', + 'EXT_GROUP_DOWNLOADABLE_FILES' => 'Downloadable Files', + 'EXT_GROUP_IMAGES' => 'Images', + 'EXT_GROUP_PLAIN_TEXT' => 'Plain Text', + + 'FILES_GONE' => 'Some of the attachments you selected for deletion do not exist. They may have been already deleted. Attachments that did exist were deleted.', + 'FILES_STATS_WRONG' => 'Your file statistics are likely inaccurate and need to be resynchronised. Actual values: number of attachments = %1$d, total size of attachments = %2$s.
Click %3$shere%4$s to resynchronise them.', + + 'GO_TO_EXTENSIONS' => 'Go to extension management screen', + 'GROUP_NAME' => 'Group name', + + 'IMAGE_LINK_SIZE' => 'Image link dimensions', + 'IMAGE_LINK_SIZE_EXPLAIN' => 'Display image attachment as an inline text link if image is larger than this. To disable this behaviour, set the values to 0px by 0px.', + + 'MAX_ATTACHMENTS' => 'Maximum number of attachments per post', + 'MAX_ATTACHMENTS_PM' => 'Maximum number of attachments per private message', + 'MAX_EXTGROUP_FILESIZE' => 'Maximum file size', + 'MAX_IMAGE_SIZE' => 'Maximum image dimensions', + 'MAX_IMAGE_SIZE_EXPLAIN' => 'Maximum size of image attachments. Set both values to 0px by 0px to disable dimension checking.', + 'MAX_THUMB_WIDTH' => 'Maximum thumbnail width/height in pixel', + 'MAX_THUMB_WIDTH_EXPLAIN' => 'A generated thumbnail will not exceed the width set here.', + 'MIN_THUMB_FILESIZE' => 'Minimum thumbnail file size', + 'MIN_THUMB_FILESIZE_EXPLAIN' => 'Do not create a thumbnail for images smaller than this.', + 'MODE_INLINE' => 'Inline', + 'MODE_PHYSICAL' => 'Physical', + + 'NOT_ALLOWED_IN_PM' => 'Only allowed in posts', + 'NOT_ALLOWED_IN_PM_POST' => 'Not allowed', + 'NOT_ASSIGNED' => 'Not assigned', + 'NO_ATTACHMENTS' => 'No attachments found for this period.', + 'NO_EXT_GROUP' => 'None', + 'NO_EXT_GROUP_NAME' => 'No group name entered', + 'NO_EXT_GROUP_SPECIFIED' => 'No extension group specified.', + 'NO_FILE_CAT' => 'None', + 'NO_IMAGE' => 'No image', + 'NO_UPLOAD_DIR' => 'The upload directory you specified does not exist.', + 'NO_WRITE_UPLOAD' => 'The upload directory you specified cannot be written to. Please alter the permissions to allow the webserver to write to it.', + + 'ONLY_ALLOWED_IN_PM' => 'Only allowed in private messages', + 'ORDER_ALLOW_DENY' => 'Allow', + 'ORDER_DENY_ALLOW' => 'Deny', + + 'REMOVE_ALLOWED_IPS' => 'Remove or un-exclude allowed IPs/hostnames', + 'REMOVE_DISALLOWED_IPS' => 'Remove or un-exclude disallowed IPs/hostnames', + 'RESYNC_FILES_STATS_CONFIRM' => 'Are you sure you wish to resynchronise file statistics?', + + 'SECURE_ALLOW_DENY' => 'Allow/Deny list', + 'SECURE_ALLOW_DENY_EXPLAIN' => 'Change the default behaviour when secure downloads are enabled of the Allow/Deny list to that of a whitelist (Allow) or a blacklist (Deny).', + 'SECURE_DOWNLOADS' => 'Enable secure downloads', + 'SECURE_DOWNLOADS_EXPLAIN' => 'With this option enabled, downloads are limited to IP’s/hostnames you define.', + 'SECURE_DOWNLOAD_NOTICE' => 'Secure Downloads are not enabled. The settings below will be applied after enabling secure downloads.', + 'SECURE_DOWNLOAD_UPDATE_SUCCESS'=> 'The IP list has been updated successfully.', + 'SECURE_EMPTY_REFERRER' => 'Allow empty referrer', + 'SECURE_EMPTY_REFERRER_EXPLAIN' => 'Secure downloads are based on referrers. Do you want to allow downloads for those omitting the referrer?', + 'SETTINGS_CAT_IMAGES' => 'Image category settings', + 'SPECIAL_CATEGORY' => 'Special category', + 'SPECIAL_CATEGORY_EXPLAIN' => 'Special categories differ between the way presented within posts.', + 'SUCCESSFULLY_UPLOADED' => 'Successfully uploaded.', + 'SUCCESS_EXTENSION_GROUP_ADD' => 'Extension group successfully added.', + 'SUCCESS_EXTENSION_GROUP_EDIT' => 'Extension group successfully updated.', + + 'UPLOADING_FILES' => 'Uploading files', + 'UPLOADING_FILE_TO' => 'Uploading file “%1$s” to post number %2$d…', + 'UPLOAD_DENIED_FORUM' => 'You do not have the permission to upload files to forum “%s”.', + 'UPLOAD_DIR' => 'Upload directory', + 'UPLOAD_DIR_EXPLAIN' => 'Storage path for attachments. Please note that if you change this directory while already having uploaded attachments you need to manually copy the files to their new location.', + 'UPLOAD_ICON' => 'Upload icon', + 'UPLOAD_NOT_DIR' => 'The upload location you specified does not appear to be a directory.', +)); diff --git a/install/update/new/language/en/acp/board.php b/install/update/new/language/en/acp/board.php new file mode 100644 index 0000000..a01a4f1 --- /dev/null +++ b/install/update/new/language/en/acp/board.php @@ -0,0 +1,635 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Board Settings +$lang = array_merge($lang, array( + 'ACP_BOARD_SETTINGS_EXPLAIN' => 'Here you can determine the basic operation of your board, give it a fitting name and description, and among other settings adjust the default values for timezone and language.', + 'BOARD_INDEX_TEXT' => 'Board index text', + 'BOARD_INDEX_TEXT_EXPLAIN' => 'This text is displayed as the board index in the board’s breadcrumbs. If not specified, it will default to “Board index”.', + 'BOARD_STYLE' => 'Board style', + 'CUSTOM_DATEFORMAT' => 'Custom…', + 'DEFAULT_DATE_FORMAT' => 'Date format', + 'DEFAULT_DATE_FORMAT_EXPLAIN' => 'The date format is the same as the PHP date() function.', + 'DEFAULT_LANGUAGE' => 'Default language', + 'DEFAULT_STYLE' => 'Default style', + 'DEFAULT_STYLE_EXPLAIN' => 'The default style for new users.', + 'DISABLE_BOARD' => 'Disable board', + 'DISABLE_BOARD_EXPLAIN' => 'This will make the board unavailable to users who are neither administrators nor moderators. You can also enter a short (255 character) message to display if you wish.', + 'DISPLAY_LAST_SUBJECT' => 'Display subject of last added post on forum list', + 'DISPLAY_LAST_SUBJECT_EXPLAIN' => 'The subject of the last added post will be displayed in the forum list with a hyperlink to the post. Subjects from password protected forums and forums in which user doesn’t have read access are not shown.', + 'DISPLAY_UNAPPROVED_POSTS' => 'Display unapproved posts to the author', + 'DISPLAY_UNAPPROVED_POSTS_EXPLAIN' => 'Unapproved posts can be viewed by the author. Does not apply to Guest posts.', + 'GUEST_STYLE' => 'Guest style', + 'GUEST_STYLE_EXPLAIN' => 'The board style for guests.', + 'OVERRIDE_STYLE' => 'Override user style', + 'OVERRIDE_STYLE_EXPLAIN' => 'Replaces user’s (and guest’s) style with the style as defined under "Default style".', + 'SITE_DESC' => 'Site description', + 'SITE_HOME_TEXT' => 'Main website text', + 'SITE_HOME_TEXT_EXPLAIN' => 'This text will be displayed as a link to your website homepage in the board’s breadcrumbs. If not specified, it will default to “Home”.', + 'SITE_HOME_URL' => 'Main website URL', + 'SITE_HOME_URL_EXPLAIN' => 'If specified, a link to this URL will be prepended to your board’s breadcrumbs and the board logo will link to this URL instead of the forum index. An absolute URL is required, e.g. http://www.phpbb.com.', + 'SITE_NAME' => 'Site name', + 'SYSTEM_TIMEZONE' => 'Guest timezone', + 'SYSTEM_TIMEZONE_EXPLAIN' => 'Timezone to use for displaying times to users who are not logged in (guests, bots). Logged in users set their timezone during registration and can change it in their user control panel.', + 'WARNINGS_EXPIRE' => 'Warning duration', + 'WARNINGS_EXPIRE_EXPLAIN' => 'Number of days that will elapse before a warning will automatically expire from a user’s record. Set this value to 0 to make warnings permanent.', +)); + +// Board Features +$lang = array_merge($lang, array( + 'ACP_BOARD_FEATURES_EXPLAIN' => 'Here you can enable/disable several board features.', + + 'ALLOW_ATTACHMENTS' => 'Allow attachments', + 'ALLOW_BIRTHDAYS' => 'Allow birthdays', + 'ALLOW_BIRTHDAYS_EXPLAIN' => 'Allow birthdays to be entered and age being displayed in profiles. Please note the birthday list within the board index is controlled by a separate load setting.', + 'ALLOW_BOOKMARKS' => 'Allow bookmarking topics', + 'ALLOW_BOOKMARKS_EXPLAIN' => 'User is able to store personal bookmarks.', + 'ALLOW_BBCODE' => 'Allow BBCode', + 'ALLOW_FORUM_NOTIFY' => 'Allow subscribing to forums', + 'ALLOW_NAME_CHANGE' => 'Allow username changes', + 'ALLOW_NO_CENSORS' => 'Allow disabling of word censoring', + 'ALLOW_NO_CENSORS_EXPLAIN' => 'Users can choose to disable the automatic word censoring of posts and private messages.', + 'ALLOW_PM_ATTACHMENTS' => 'Allow attachments in private messages', + 'ALLOW_PM_REPORT' => 'Allow users to report private messages', + 'ALLOW_PM_REPORT_EXPLAIN' => 'If this setting is enabled, users have the option of reporting a private message they have received or sent to the board’s moderators. These private messages will then be visible in the Moderator Control Panel.', + 'ALLOW_QUICK_REPLY' => 'Allow quick reply', + 'ALLOW_QUICK_REPLY_EXPLAIN' => 'This switch allows for the quick reply to be disabled board-wide. When enabled, forum specific settings will be used to determine whether the quick reply is displayed in individual forums.', + 'ALLOW_QUICK_REPLY_BUTTON' => 'Submit and enable quick reply in all forums', + 'ALLOW_SIG' => 'Allow signatures', + 'ALLOW_SIG_BBCODE' => 'Allow BBCode in user signatures', + 'ALLOW_SIG_FLASH' => 'Allow use of [FLASH] BBCode tag in user signatures', + 'ALLOW_SIG_IMG' => 'Allow use of [IMG] BBCode tag in user signatures', + 'ALLOW_SIG_LINKS' => 'Allow use of links in user signatures', + 'ALLOW_SIG_LINKS_EXPLAIN' => 'If disallowed the [URL] BBCode tag and automatic/magic URLs are disabled.', + 'ALLOW_SIG_SMILIES' => 'Allow use of smilies in user signatures', + 'ALLOW_SMILIES' => 'Allow smilies', + 'ALLOW_TOPIC_NOTIFY' => 'Allow subscribing to topics', + 'BOARD_PM' => 'Private messaging', + 'BOARD_PM_EXPLAIN' => 'Enable private messaging for all users.', + 'ALLOW_BOARD_NOTIFICATIONS' => 'Allow board notifications', +)); + +// Avatar Settings +$lang = array_merge($lang, array( + 'ACP_AVATAR_SETTINGS_EXPLAIN' => 'Avatars are generally small, unique images a user can associate with themselves. Depending on the style they are usually displayed below the username when viewing topics. Here you can determine how users can define their avatars. Please note that in order to upload avatars you need to have created the directory you name below and ensure it can be written to by the web server. Please also note that file size limits are only imposed on uploaded avatars, they do not apply to remotely linked images.', + + 'ALLOW_AVATARS' => 'Enable avatars', + 'ALLOW_AVATARS_EXPLAIN' => 'Allow general usage of avatars;
If you disable avatars in general or avatars of a certain mode, the disabled avatars will no longer be shown on the board, but users will still be able to download their own avatars in the User Control Panel.', + 'ALLOW_GRAVATAR' => 'Enable gravatar avatars', + 'ALLOW_LOCAL' => 'Enable gallery avatars', + 'ALLOW_REMOTE' => 'Enable remote avatars', + 'ALLOW_REMOTE_EXPLAIN' => 'Avatars linked to from another website.
Warning: Enabling this feature might allow users to check for the existence of files and services that are only accessible on the local network.', + 'ALLOW_REMOTE_UPLOAD' => 'Enable remote avatar uploading', + 'ALLOW_REMOTE_UPLOAD_EXPLAIN' => 'Allow uploading of avatars from another website.
Warning: Enabling this feature might allow users to check for the existence of files and services that are only accessible on the local network.', + 'ALLOW_UPLOAD' => 'Enable avatar uploading', + 'AVATAR_GALLERY_PATH' => 'Avatar gallery path', + 'AVATAR_GALLERY_PATH_EXPLAIN' => 'Path under your phpBB root directory for pre-loaded images, e.g. images/avatars/gallery.
Double dots like ../ will be stripped from the path for security reasons.', + 'AVATAR_STORAGE_PATH' => 'Avatar storage path', + 'AVATAR_STORAGE_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/avatars/upload.
Avatar uploading will not be available if this path is not writable.
Double dots like ../ will be stripped from the path for security reasons.', + 'MAX_AVATAR_SIZE' => 'Maximum avatar dimensions', + 'MAX_AVATAR_SIZE_EXPLAIN' => 'Width x Height in pixels.', + 'MAX_FILESIZE' => 'Maximum avatar file size', + 'MAX_FILESIZE_EXPLAIN' => 'For uploaded avatar files. If this value is 0, the uploaded filesize is only limited by your PHP configuration.', + 'MIN_AVATAR_SIZE' => 'Minimum avatar dimensions', + 'MIN_AVATAR_SIZE_EXPLAIN' => 'Width x Height in pixels.', +)); + +// Message Settings +$lang = array_merge($lang, array( + 'ACP_MESSAGE_SETTINGS_EXPLAIN' => 'Here you can set all default settings for private messaging.', + + 'ALLOW_BBCODE_PM' => 'Allow BBCode in private messages', + 'ALLOW_FLASH_PM' => 'Allow use of [FLASH] BBCode tag', + 'ALLOW_FLASH_PM_EXPLAIN' => 'Note that the ability to use flash in private messages, if enabled here, also depends on the permissions.', + 'ALLOW_FORWARD_PM' => 'Allow forwarding of private messages', + 'ALLOW_IMG_PM' => 'Allow use of [IMG] BBCode tag', + 'ALLOW_MASS_PM' => 'Allow sending of private messages to multiple users and groups', + 'ALLOW_MASS_PM_EXPLAIN' => 'Sending to groups can be adjusted per group within the group settings page.', + 'ALLOW_PRINT_PM' => 'Allow print view in private messaging', + 'ALLOW_QUOTE_PM' => 'Allow quotes in private messages', + 'ALLOW_SIG_PM' => 'Allow signature in private messages', + 'ALLOW_SMILIES_PM' => 'Allow smilies in private messages', + 'BOXES_LIMIT' => 'Maximum private messages per box', + 'BOXES_LIMIT_EXPLAIN' => 'Users may receive no more than this many messages in each of their private message boxes. Set this value to 0 to allow unlimited messages.', + 'BOXES_MAX' => 'Maximum private message folders', + 'BOXES_MAX_EXPLAIN' => 'By default users may create this many personal folders for private messages.', + 'ENABLE_PM_ICONS' => 'Enable use of topic icons in private messages', + 'FULL_FOLDER_ACTION' => 'Full folder default action', + 'FULL_FOLDER_ACTION_EXPLAIN'=> 'Default action to take if a user’s folder is full assuming the user’s folder action, if set at all, is not applicable. The only exception is for the “Sent messages” folder where the default action is always to delete old messages.', + 'HOLD_NEW_MESSAGES' => 'Hold new messages', + 'PM_EDIT_TIME' => 'Limit editing time', + 'PM_EDIT_TIME_EXPLAIN' => 'Limits the time available to edit a private message not already delivered. Setting the value to 0 disables this behaviour.', + 'PM_MAX_RECIPIENTS' => 'Maximum number of allowed recipients', + 'PM_MAX_RECIPIENTS_EXPLAIN' => 'The maximum number of allowed recipients in a private message. If 0 is entered, an unlimited number is allowed. This setting can be adjusted for every group within the group settings page.', +)); + +// Post Settings +$lang = array_merge($lang, array( + 'ACP_POST_SETTINGS_EXPLAIN' => 'Here you can set all default settings for posting.', + 'ALLOW_POST_LINKS' => 'Allow links in posts/private messages', + 'ALLOW_POST_LINKS_EXPLAIN' => 'If disallowed the [URL] BBCode tag and automatic/magic URLs are disabled.', + 'ALLOWED_SCHEMES_LINKS' => 'Allowed schemes in links', + 'ALLOWED_SCHEMES_LINKS_EXPLAIN' => 'Users can only post schemeless URLs or one of the comma-separated list of allowed schemes.', + 'ALLOW_POST_FLASH' => 'Allow use of [FLASH] BBCode tag in posts', + 'ALLOW_POST_FLASH_EXPLAIN' => 'If disallowed the [FLASH] BBCode tag is disabled in posts. Otherwise the permission system controls which users can use the [FLASH] BBCode tag.', + + 'BUMP_INTERVAL' => 'Bump interval', + 'BUMP_INTERVAL_EXPLAIN' => 'Number of minutes, hours or days between the last post to a topic and the ability to bump that topic. Setting the value to 0 disables bumping entirely.', + 'CHAR_LIMIT' => 'Maximum characters per post/message', + 'CHAR_LIMIT_EXPLAIN' => 'The number of characters allowed within a post/private message. Set to 0 for unlimited characters.', + 'DELETE_TIME' => 'Limit deleting time', + 'DELETE_TIME_EXPLAIN' => 'Limits the time available to delete a new post. Setting the value to 0 disables this behaviour.', + 'DISPLAY_LAST_EDITED' => 'Display last edited time information', + 'DISPLAY_LAST_EDITED_EXPLAIN' => 'Choose if the last edited by information to be displayed on posts.', + 'EDIT_TIME' => 'Limit editing time', + 'EDIT_TIME_EXPLAIN' => 'Limits the time available to edit a new post. Setting the value to 0 disables this behaviour.', + 'FLOOD_INTERVAL' => 'Flood interval', + 'FLOOD_INTERVAL_EXPLAIN' => 'Number of seconds a user must wait between posting new messages. To enable users to ignore this alter their permissions.', + 'HOT_THRESHOLD' => 'Popular topic threshold', + 'HOT_THRESHOLD_EXPLAIN' => 'Posts per topic threshold required for the popular topic annotation. Set to 0 to disable popular topics.', + 'MAX_POLL_OPTIONS' => 'Maximum number of poll options', + 'MAX_POST_FONT_SIZE' => 'Maximum font size per post', + 'MAX_POST_FONT_SIZE_EXPLAIN' => 'Maximum font size allowed in a post. Set to 0 for unlimited font size.', + 'MAX_POST_IMG_HEIGHT' => 'Maximum image height per post', + 'MAX_POST_IMG_HEIGHT_EXPLAIN' => 'Maximum height of an image/flash file in postings. Set to 0 for unlimited size.', + 'MAX_POST_IMG_WIDTH' => 'Maximum image width per post', + 'MAX_POST_IMG_WIDTH_EXPLAIN' => 'Maximum width of an image/flash file in postings. Set to 0 for unlimited size.', + 'MAX_POST_URLS' => 'Maximum links per post', + 'MAX_POST_URLS_EXPLAIN' => 'Maximum number of URLs in a post. Set to 0 for unlimited links.', + 'MIN_CHAR_LIMIT' => 'Minimum characters per post/message', + 'MIN_CHAR_LIMIT_EXPLAIN' => 'The minimum number of characters the user need to enter within a post/private message. The minimum for this setting is 1.', + 'POSTING' => 'Posting', + 'POSTS_PER_PAGE' => 'Posts per page', + 'QUOTE_DEPTH_LIMIT' => 'Maximum nesting depth for quotes', + 'QUOTE_DEPTH_LIMIT_EXPLAIN' => 'Maximum quote nesting depth in a post. Set to 0 for unlimited depth.', + 'SMILIES_LIMIT' => 'Maximum smilies per post', + 'SMILIES_LIMIT_EXPLAIN' => 'Maximum number of smilies in a post. Set to 0 for unlimited smilies.', + 'SMILIES_PER_PAGE' => 'Smilies per page', + 'TOPICS_PER_PAGE' => 'Topics per page', +)); + +// Signature Settings +$lang = array_merge($lang, array( + 'ACP_SIGNATURE_SETTINGS_EXPLAIN' => 'Here you can set all default settings for signatures.', + + 'MAX_SIG_FONT_SIZE' => 'Maximum signature font size', + 'MAX_SIG_FONT_SIZE_EXPLAIN' => 'Maximum font size allowed in user signatures. Set to 0 for unlimited size.', + 'MAX_SIG_IMG_HEIGHT' => 'Maximum signature image height', + 'MAX_SIG_IMG_HEIGHT_EXPLAIN' => 'Maximum height of an image/flash file in user signatures. Set to 0 for unlimited height.', + 'MAX_SIG_IMG_WIDTH' => 'Maximum signature image width', + 'MAX_SIG_IMG_WIDTH_EXPLAIN' => 'Maximum width of an image/flash file in user signatures. Set to 0 for unlimited width.', + 'MAX_SIG_LENGTH' => 'Maximum signature length', + 'MAX_SIG_LENGTH_EXPLAIN' => 'Maximum number of characters in user signatures.', + 'MAX_SIG_SMILIES' => 'Maximum smilies per signature', + 'MAX_SIG_SMILIES_EXPLAIN' => 'Maximum smilies allowed in user signatures. Set to 0 for unlimited smilies.', + 'MAX_SIG_URLS' => 'Maximum signature links', + 'MAX_SIG_URLS_EXPLAIN' => 'Maximum number of links in user signatures. Set to 0 for unlimited links.', +)); + +// Registration Settings +$lang = array_merge($lang, array( + 'ACP_REGISTER_SETTINGS_EXPLAIN' => 'Here you are able to define registration and profile related settings.', + + 'ACC_ACTIVATION' => 'Account activation', + 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations. “Board-wide email” must be enabled in order to use user or admin activation.', + 'ACC_ACTIVATION_WARNING' => 'Please note that the currently selected activation method requires emails to be enabled, otherwise registration will be disabled. We recommend to either select a different activation method or reenable emails.', + 'NEW_MEMBER_POST_LIMIT' => 'New member post limit', + 'NEW_MEMBER_POST_LIMIT_EXPLAIN' => 'New members are within the Newly Registered Users group until they reach this number of posts. You can use this group to keep them from using the PM system or to review their posts. A value of 0 disables this feature.', + 'NEW_MEMBER_GROUP_DEFAULT' => 'Set Newly Registered Users group to default', + 'NEW_MEMBER_GROUP_DEFAULT_EXPLAIN' => 'If set to yes, and a new member post limit is specified, newly registered users will not only be put into the Newly Registered Users group, but this group will also be their default one. This may come in handy if you want to assign a group default rank and/or avatar the user then inherits.', + + 'ACC_ADMIN' => 'By admin', + 'ACC_DISABLE' => 'Disable registration', + 'ACC_NONE' => 'No activation (immediate access)', + 'ACC_USER' => 'By user (email verification)', +// 'ACC_USER_ADMIN' => 'User + Admin', + 'ALLOW_EMAIL_REUSE' => 'Allow email address re-use', + 'ALLOW_EMAIL_REUSE_EXPLAIN' => 'Different users can register with the same email address.', + 'COPPA' => 'COPPA', + 'COPPA_FAX' => 'COPPA fax number', + 'COPPA_MAIL' => 'COPPA mailing address', + 'COPPA_MAIL_EXPLAIN' => 'This is the mailing address where parents will send COPPA registration forms.', + 'ENABLE_COPPA' => 'Enable COPPA', + 'ENABLE_COPPA_EXPLAIN' => 'This requires users to declare whether they are 13 or over for compliance with the U.S. COPPA. If this is disabled the COPPA specific groups will no longer be displayed.', + 'MAX_CHARS' => 'Max', + 'MIN_CHARS' => 'Min', + 'NO_AUTH_PLUGIN' => 'No suitable auth plugin found.', + 'PASSWORD_LENGTH' => 'Password length', + 'PASSWORD_LENGTH_EXPLAIN' => 'Minimum and maximum number of characters in passwords.', + 'REG_LIMIT' => 'Registration attempts', + 'REG_LIMIT_EXPLAIN' => 'Number of attempts users can make at solving the anti-spambot task before being locked out of that session.', + 'USERNAME_ALPHA_ONLY' => 'Alphanumeric only', + 'USERNAME_ALPHA_SPACERS' => 'Alphanumeric and spacers', + 'USERNAME_ASCII' => 'ASCII (no international unicode)', + 'USERNAME_LETTER_NUM' => 'Any letter and number', + 'USERNAME_LETTER_NUM_SPACERS' => 'Any letter, number, and spacer', + 'USERNAME_CHARS' => 'Limit username chars', + 'USERNAME_CHARS_ANY' => 'Any character', + 'USERNAME_CHARS_EXPLAIN' => 'Restrict type of characters that may be used in usernames, spacers are: space, -, +, _, [ and ].', + 'USERNAME_LENGTH' => 'Username length', + 'USERNAME_LENGTH_EXPLAIN' => 'Minimum and maximum number of characters in usernames.', +)); + +// Feeds +$lang = array_merge($lang, array( + 'ACP_FEED_MANAGEMENT' => 'General syndication feeds settings', + 'ACP_FEED_MANAGEMENT_EXPLAIN' => 'This module makes available various ATOM feeds, parsing any BBCode in posts to make them readable in external feeds.', + + 'ACP_FEED_GENERAL' => 'General feed settings', + 'ACP_FEED_POST_BASED' => 'Post-based feed settings', + 'ACP_FEED_TOPIC_BASED' => 'Topic-based feed settings', + 'ACP_FEED_SETTINGS_OTHER' => 'Other feeds and settings', + + 'ACP_FEED_ENABLE' => 'Enable feeds', + 'ACP_FEED_ENABLE_EXPLAIN' => 'Turns on or off ATOM feeds for the entire board.
Disabling this switches off all feeds, no matter how the options below are set.', + 'ACP_FEED_LIMIT' => 'Number of items', + 'ACP_FEED_LIMIT_EXPLAIN' => 'The maximum number of feed items to display.', + + 'ACP_FEED_OVERALL' => 'Enable board-wide feed', + 'ACP_FEED_OVERALL_EXPLAIN' => 'Board-wide new posts.', + 'ACP_FEED_FORUM' => 'Enable per-forum feeds', + 'ACP_FEED_FORUM_EXPLAIN' => 'Single forum and subforums new posts.', + 'ACP_FEED_TOPIC' => 'Enable per-topic feeds', + 'ACP_FEED_TOPIC_EXPLAIN' => 'Single topics new posts.', + + 'ACP_FEED_TOPICS_NEW' => 'Enable new topics feed', + 'ACP_FEED_TOPICS_NEW_EXPLAIN' => 'Enables the “New Topics” feed, which displays the last created topics including the first post.', + 'ACP_FEED_TOPICS_ACTIVE' => 'Enable active topics feed', + 'ACP_FEED_TOPICS_ACTIVE_EXPLAIN' => 'Enables the “Active Topics” feed, which displays the last active topics including the last post.', + 'ACP_FEED_NEWS' => 'News feed', + 'ACP_FEED_NEWS_EXPLAIN' => 'Pull the first post from these forums. Select no forums to disable news feed.
Select multiple forums by holding CTRL and clicking.', + + 'ACP_FEED_OVERALL_FORUMS' => 'Enable forums feed', + 'ACP_FEED_OVERALL_FORUMS_EXPLAIN' => 'Enables the “All forums” feed, which displays a list of forums.', + + 'ACP_FEED_HTTP_AUTH' => 'Allow HTTP Authentication', + 'ACP_FEED_HTTP_AUTH_EXPLAIN' => 'Enables HTTP authentication, which allows users to receive content that is hidden to guest users by adding the auth=http parameter to the feed URL. Please note that some PHP setups require additional changes to the .htaccess file. Instructions can be found in that file.', + 'ACP_FEED_ITEM_STATISTICS' => 'Item statistics', + 'ACP_FEED_ITEM_STATISTICS_EXPLAIN' => 'Display individual statistics underneath feed items
(e.g. posted by, date and time, replies, views)', + 'ACP_FEED_EXCLUDE_ID' => 'Exclude these forums', + 'ACP_FEED_EXCLUDE_ID_EXPLAIN' => 'Content from these will be not included in feeds. Select no forum to pull data from all forums.
Select/Deselect multiple forums by holding CTRL and clicking.', +)); + +// Visual Confirmation Settings +$lang = array_merge($lang, array( + 'ACP_VC_SETTINGS_EXPLAIN' => 'Here you can select and configure plugins, which are designed to block automated form submissions by spambots. These plugins typically work by challenging the user with a CAPTCHA, a test which is designed to be difficult for computers to solve.', + 'ACP_VC_EXT_GET_MORE' => 'For additional (and possibly better) anti-spam plugins, visit the phpBB.com Extensions Database. For more information on preventing spam on your board, visit the phpBB.com Knowledge Base.', + 'AVAILABLE_CAPTCHAS' => 'Available plugins', + 'CAPTCHA_UNAVAILABLE' => 'The plugin cannot be selected as its requirements are not met.', + 'CAPTCHA_GD' => 'GD image', + 'CAPTCHA_GD_3D' => 'GD 3D image', + 'CAPTCHA_GD_FOREGROUND_NOISE' => 'Foreground noise', + 'CAPTCHA_GD_EXPLAIN' => 'Uses GD to make a more advanced anti-spambot image.', + 'CAPTCHA_GD_FOREGROUND_NOISE_EXPLAIN' => 'Use foreground noise to make the image harder to read.', + 'CAPTCHA_GD_X_GRID' => 'Background noise x-axis', + 'CAPTCHA_GD_X_GRID_EXPLAIN' => 'Use lower settings of this to make the image harder to read. 0 will disable x-axis background noise.', + 'CAPTCHA_GD_Y_GRID' => 'Background noise y-axis', + 'CAPTCHA_GD_Y_GRID_EXPLAIN' => 'Use lower settings of this to make the image harder to read. 0 will disable y-axis background noise.', + 'CAPTCHA_GD_WAVE' => 'Wave distortion', + 'CAPTCHA_GD_WAVE_EXPLAIN' => 'This applies a wave distortion to the image.', + 'CAPTCHA_GD_3D_NOISE' => 'Add 3D-noise objects', + 'CAPTCHA_GD_3D_NOISE_EXPLAIN' => 'This adds additional objects to the image, over the letters.', + 'CAPTCHA_GD_FONTS' => 'Use different fonts', + 'CAPTCHA_GD_FONTS_EXPLAIN' => 'This setting controls how many different letter shapes are used. You can just use the default shapes or introduce altered letters. Adding lowercase letters is also possible.', + 'CAPTCHA_FONT_DEFAULT' => 'Default', + 'CAPTCHA_FONT_NEW' => 'New Shapes', + 'CAPTCHA_FONT_LOWER' => 'Also use lowercase', + 'CAPTCHA_NO_GD' => 'Simple image', + 'CAPTCHA_PREVIEW_MSG' => 'Your changes have not been saved, this is just a preview.', + 'CAPTCHA_PREVIEW_EXPLAIN' => 'The plugin as it would look like using the current selection.', + + 'CAPTCHA_SELECT' => 'Installed plugins', + 'CAPTCHA_SELECT_EXPLAIN' => 'The dropdown holds the plugins recognised by the board. Grey entries are not available right now and might need configuration prior to use.', + 'CAPTCHA_CONFIGURE' => 'Configure plugins', + 'CAPTCHA_CONFIGURE_EXPLAIN' => 'Change the settings for the selected plugin.', + 'CONFIGURE' => 'Configure', + 'CAPTCHA_NO_OPTIONS' => 'This plugin has no configuration options.', + + 'VISUAL_CONFIRM_POST' => 'Enable spambot countermeasures for guest postings', + 'VISUAL_CONFIRM_POST_EXPLAIN' => 'Requires guest users to pass the anti-spambot task to help prevent automated postings.', + 'VISUAL_CONFIRM_REG' => 'Enable spambot countermeasures for registrations', + 'VISUAL_CONFIRM_REG_EXPLAIN' => 'Requires new users to pass the anti-spambot task to help prevent automated registrations.', + 'VISUAL_CONFIRM_REFRESH' => 'Allow users to refresh the anti-spambot task', + 'VISUAL_CONFIRM_REFRESH_EXPLAIN' => 'Allows users to request a new anti-spambot task if they are unable to solve the current task during registration. Some plugins might not support this option.', +)); + +// Cookie Settings +$lang = array_merge($lang, array( + 'ACP_COOKIE_SETTINGS_EXPLAIN' => 'These details define the data used to send cookies to your users browsers. In most cases the default values for the cookie settings should be sufficient. If you do need to change any do so with care, incorrect settings can prevent users logging in. If you have problems with users staying logging in to your board, visit the phpBB.com Knowledge Base - Fixing incorrect cookie settings.', + + 'COOKIE_DOMAIN' => 'Cookie domain', + 'COOKIE_DOMAIN_EXPLAIN' => 'In most cases the cookie domain is optional. Leave it blank if you are unsure.

In the case where you have a board integrated with other software or have multiple domains, then to determine the cookie domain you need to do the following. If you have something like example.com and forums.example.com, or perhaps forums.example.com and blog.example.com. Remove the subdomains until you find the common domain, example.com. Now add a dot in front of the common domain and you would enter .example.com (note the dot at the beginning).', + 'COOKIE_NAME' => 'Cookie name', + 'COOKIE_NAME_EXPLAIN' => 'This can be anything what you want, make it original. Whenever the cookie settings are changed the name of the cookie should be changed.', + 'COOKIE_NOTICE' => 'Cookie notice', + 'COOKIE_NOTICE_EXPLAIN' => 'If enabled a cookie notice will be displayed to users when visiting your board. This might be required by law depending on the content of your board and enabled extensions.', + 'COOKIE_PATH' => 'Cookie path', + 'COOKIE_PATH_EXPLAIN' => 'This will usually be the same as your script path or simply a slash to make the cookie accessible across the site domain.', + 'COOKIE_SECURE' => 'Cookie secure', + 'COOKIE_SECURE_EXPLAIN' => 'If your server is running via SSL set this to enabled else leave as disabled. Having this enabled and not running via SSL will result in server errors during redirects.', + 'ONLINE_LENGTH' => 'View online time span', + 'ONLINE_LENGTH_EXPLAIN' => 'Number of minutes after which inactive users will not appear in “Who is online” listings. The higher this value the greater is the processing required to generate the listing.', + 'SESSION_LENGTH' => 'Session length', + 'SESSION_LENGTH_EXPLAIN' => 'Sessions will expire after this time, in seconds.', +)); + +// Contact Settings +$lang = array_merge($lang, array( + 'ACP_CONTACT_SETTINGS_EXPLAIN' => 'Here you can enable and disable the contact page and also add a text that is displayed on the page.', + + 'CONTACT_US_ENABLE' => 'Enable contact page', + 'CONTACT_US_ENABLE_EXPLAIN' => 'This page allows users to send emails to board administrators. Please note that board-wide emails option must be enabled as well. You can find this option in General > Client Communication > Email settings.', + + 'CONTACT_US_INFO' => 'Contact information', + 'CONTACT_US_INFO_EXPLAIN' => 'The message is displayed on the contact page', + 'CONTACT_US_INFO_PREVIEW' => 'Contact page information - Preview', + 'CONTACT_US_INFO_UPDATED' => 'Contact page information has been updated.', +)); + +// Load Settings +$lang = array_merge($lang, array( + 'ACP_LOAD_SETTINGS_EXPLAIN' => 'Here you can enable and disable certain board functions to reduce the amount of processing required. On most servers there is no need to disable any functions. However on certain systems or in shared hosting environments it may be beneficial to disable capabilities you do not really need. You can also specify limits for system load and active sessions beyond which the board will go offline.', + + 'ALLOW_CDN' => 'Allow usage of third party content delivery networks', + 'ALLOW_CDN_EXPLAIN' => 'If this setting is enabled, some files will be served from external third party servers instead of your server. This reduces the network bandwidth required by your server, but may present a privacy issue for some board administrators. In a default phpBB installation, this includes loading “jQuery” and the font “Open Sans” from Google’s content delivery network.', + 'ALLOW_LIVE_SEARCHES' => 'Allow live searches', + 'ALLOW_LIVE_SEARCHES_EXPLAIN' => 'If this setting is enabled, users are provided with keyword suggestions as they type in certain fields throughout the board.', + 'CUSTOM_PROFILE_FIELDS' => 'Custom profile fields', + 'LIMIT_LOAD' => 'Limit system load', + 'LIMIT_LOAD_EXPLAIN' => 'If the system’s 1-minute load average exceeds this value the board will automatically go offline. A value of 1.0 equals ~100% utilisation of one processor. This only functions on UNIX based servers and where this information is accessible. The value here resets itself to 0 if phpBB was unable to get the load limit.', + 'LIMIT_SESSIONS' => 'Limit sessions', + 'LIMIT_SESSIONS_EXPLAIN' => 'If the number of sessions exceeds this value within a one minute period the board will go offline. Set to 0 for unlimited sessions.', + 'LOAD_CPF_MEMBERLIST' => 'Allow styles to display custom profile fields in memberlist', + 'LOAD_CPF_PM' => 'Display custom profile fields in private messages', + 'LOAD_CPF_VIEWPROFILE' => 'Display custom profile fields in user profiles', + 'LOAD_CPF_VIEWTOPIC' => 'Display custom profile fields on topic pages', + 'LOAD_USER_ACTIVITY' => 'Show user’s activity', + 'LOAD_USER_ACTIVITY_EXPLAIN' => 'Displays active topic/forum in user profiles and user control panel. It is recommended to disable this on boards with more than one million posts.', + 'LOAD_USER_ACTIVITY_LIMIT' => 'User’s activity post limit', + 'LOAD_USER_ACTIVITY_LIMIT_EXPLAIN' => 'The active topic/forum won’t be shown for users having more than this number of posts. Set to 0 to disable the limit.', + 'READ_NOTIFICATION_EXPIRE_DAYS' => 'Read Notification Expiration', + 'READ_NOTIFICATION_EXPIRE_DAYS_EXPLAIN' => 'Number of days that will elapse before a read notification will automatically be deleted. Set this value to 0 to make notifications permanent.', + 'RECOMPILE_STYLES' => 'Recompile stale style components', + 'RECOMPILE_STYLES_EXPLAIN' => 'Check for updated style components on filesystem and recompile.', + 'YES_ACCURATE_PM_BUTTON' => 'Enable permission specific PM button in topic pages', + 'YES_ACCURATE_PM_BUTTON_EXPLAIN' => 'If this setting is enabled, only post profiles of users who are permitted to read private messages will have a private message button.', + 'YES_ANON_READ_MARKING' => 'Enable topic marking for guests', + 'YES_ANON_READ_MARKING_EXPLAIN' => 'Stores read/unread status information for guests. If disabled, posts are always marked read for guests.', + 'YES_BIRTHDAYS' => 'Enable birthday listing', + 'YES_BIRTHDAYS_EXPLAIN' => 'If disabled the birthday listing is no longer displayed. To let this setting take effect the birthday feature needs to be enabled too.', + 'YES_JUMPBOX' => 'Enable display of jumpbox', + 'YES_MODERATORS' => 'Enable display of moderators', + 'YES_ONLINE' => 'Enable online user listings', + 'YES_ONLINE_EXPLAIN' => 'Display online user information on index, forum and topic pages.', + 'YES_ONLINE_GUESTS' => 'Enable online guest listings in viewonline', + 'YES_ONLINE_GUESTS_EXPLAIN' => 'Allow display of guest user information in viewonline.', + 'YES_ONLINE_TRACK' => 'Enable display of user online/offline information', + 'YES_ONLINE_TRACK_EXPLAIN' => 'Display online information for user in profiles and topic pages.', + 'YES_POST_MARKING' => 'Enable dotted topics', + 'YES_POST_MARKING_EXPLAIN' => 'Indicates whether user has posted to a topic.', + 'YES_READ_MARKING' => 'Enable server-side topic marking', + 'YES_READ_MARKING_EXPLAIN' => 'Stores read/unread status information in the database rather than a cookie.', + 'YES_UNREAD_SEARCH' => 'Enable search for unread posts', +)); + +// Auth settings +$lang = array_merge($lang, array( + 'ACP_AUTH_SETTINGS_EXPLAIN' => 'phpBB supports authentication plug-ins, or modules. These allow you determine how users are authenticated when they log into the board. By default four plug-ins are provided: DB, LDAP, Apache, and OAuth. Not all methods require additional information so only fill out fields if they are relevant to the selected method.', + + 'AUTH_METHOD' => 'Select an authentication method', + + 'AUTH_PROVIDER_OAUTH_ERROR_ELEMENT_MISSING' => 'Both the key and secret of each enabled OAuth service provider must be provided. Only one was provided for an OAuth service provider.', + 'AUTH_PROVIDER_OAUTH_EXPLAIN' => 'Each OAuth provider requires a unique secret and key in order to authenticate with the external server. These should be supplied by the OAuth service when you register your website with them and should be entered exactly as provided to you.
Any service that does not have both a key and a secret entered here will not be available for use by the forum users. Also note, that user can still register and login using the DB authentication plug-in.', + 'AUTH_PROVIDER_OAUTH_KEY' => 'Key', + 'AUTH_PROVIDER_OAUTH_TITLE' => 'OAuth', + 'AUTH_PROVIDER_OAUTH_SECRET' => 'Secret', + + 'APACHE_SETUP_BEFORE_USE' => 'You have to setup apache authentication before you switch phpBB to this authentication method. Keep in mind that the username you use for apache authentication has to be the same as your phpBB username. Apache authentication can only be used with mod_php (not with a CGI version).', + + 'LDAP' => 'LDAP', + 'LDAP_DN' => 'LDAP base dn', + 'LDAP_DN_EXPLAIN' => 'This is the Distinguished Name, locating the user information, e.g. o=My Company,c=US.', + 'LDAP_EMAIL' => 'LDAP email attribute', + 'LDAP_EMAIL_EXPLAIN' => 'Set this to the name of your user entry email attribute (if one exists) in order to automatically set the email address for new users. Leaving this empty results in empty email address for users who log in for the first time.', + 'LDAP_INCORRECT_USER_PASSWORD' => 'Binding to LDAP server failed with specified user/password.', + 'LDAP_NO_EMAIL' => 'The specified email attribute does not exist.', + 'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.', + 'LDAP_PASSWORD' => 'LDAP password', + 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding, otherwise fill in the password for the above user. Required for Active Directory Servers.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', + 'LDAP_PORT' => 'LDAP server port', + 'LDAP_PORT_EXPLAIN' => 'Optionally you can specify a port which should be used to connect to the LDAP server instead of the default port 389.', + 'LDAP_SERVER' => 'LDAP server name', + 'LDAP_SERVER_EXPLAIN' => 'If using LDAP this is the hostname or IP address of the LDAP server. Alternatively you can specify an URL like ldap://hostname:port/', + 'LDAP_UID' => 'LDAP uid', + 'LDAP_UID_EXPLAIN' => 'This is the key under which to search for a given login identity, e.g. uid, sn, etc.', + 'LDAP_USER' => 'LDAP user dn', + 'LDAP_USER_EXPLAIN' => 'Leave blank to use anonymous binding. If filled in phpBB uses the specified distinguished name on login attempts to find the correct user, e.g. uid=Username,ou=MyUnit,o=MyCompany,c=US. Required for Active Directory Servers.', + 'LDAP_USER_FILTER' => 'LDAP user filter', + 'LDAP_USER_FILTER_EXPLAIN' => 'Optionally you can further limit the searched objects with additional filters. For example objectClass=posixGroup would result in the use of (&(uid=$username)(objectClass=posixGroup))', +)); + +// Server Settings +$lang = array_merge($lang, array( + 'ACP_SERVER_SETTINGS_EXPLAIN' => 'Here you define server and domain dependent settings. Please ensure the data you enter is accurate, errors will result in emails containing incorrect information. When entering the domain name remember it does include http:// or other protocol term. Only alter the port number if you know your server uses a different value, port 80 is correct in most cases.', + + 'ENABLE_GZIP' => 'Enable GZip compression', + 'ENABLE_GZIP_EXPLAIN' => 'Generated content will be compressed prior to sending it to the user. This can reduce network traffic but will also increase CPU usage on both server and client side. Requires zlib PHP extension to be loaded.', + 'FORCE_SERVER_VARS' => 'Force server URL settings', + 'FORCE_SERVER_VARS_EXPLAIN' => 'If set to yes the server settings defined here will be used in favour of the automatically determined values.', + 'ICONS_PATH' => 'Post icons storage path', + 'ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/icons.', + 'MOD_REWRITE_ENABLE' => 'Enable URL Rewriting', + 'MOD_REWRITE_ENABLE_EXPLAIN' => 'When enabled, URLs containing ’app.php’ will be rewritten to remove the filename (i.e. app.php/foo will become /foo). Apache server’s mod_rewrite module is required for this functionality to work; if this option is enabled without mod_rewrite support, URLs on your board may be broken.', + 'MOD_REWRITE_DISABLED' => 'The mod_rewrite module on your Apache web server is disabled. Enable the module or contact your web hosting provider if you wish to enable this feature.', + 'MOD_REWRITE_INFORMATION_UNAVAILABLE' => 'We are unable to determine whether or not this server supports URL rewriting. This setting may be enabled but if URL rewriting is not available, paths generated by this board (such as for use in links) may be broken. Contact your web hosting provider if you are unsure whether or not you can safely enable this feature.', + 'PATH_SETTINGS' => 'Path settings', + 'RANKS_PATH' => 'Rank image storage path', + 'RANKS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/ranks.', + 'SCRIPT_PATH' => 'Script path', + 'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB is located relative to the domain name, e.g. /phpBB3.', + 'SERVER_NAME' => 'Domain name', + 'SERVER_NAME_EXPLAIN' => 'The domain name this board runs from (for example: www.example.com).', + 'SERVER_PORT' => 'Server port', + 'SERVER_PORT_EXPLAIN' => 'The port your server is running on, usually 80, only change if different.', + 'SERVER_PROTOCOL' => 'Server protocol', + 'SERVER_PROTOCOL_EXPLAIN' => 'This is used as the server protocol if these settings are forced. If empty or not forced the protocol is determined by the cookie secure settings (http:// or https://).', + 'SERVER_URL_SETTINGS' => 'Server URL settings', + 'SMILIES_PATH' => 'Smilies storage path', + 'SMILIES_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/smilies.', + 'UPLOAD_ICONS_PATH' => 'Extension group icons storage path', + 'UPLOAD_ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/upload_icons.', + 'USE_SYSTEM_CRON' => 'Run periodic tasks from system cron', + 'USE_SYSTEM_CRON_EXPLAIN' => 'When off, phpBB will arrange for periodic tasks to be run automatically. When on, phpBB will not schedule any periodic tasks by itself; a system administrator must arrange for bin/phpbbcli.php cron:run to be run by the system cron facility at regular intervals (e.g. every 5 minutes).', +)); + +// Security Settings +$lang = array_merge($lang, array( + 'ACP_SECURITY_SETTINGS_EXPLAIN' => 'Here you are able to define session and login related settings.', + + 'ALL' => 'All', + 'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins', + 'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.', + 'ALLOW_PASSWORD_RESET' => 'Allow password reset ("Forgot Password")', + 'ALLOW_PASSWORD_RESET_EXPLAIN' => 'Determines whether or not users are able to use the "I forgot my password" link on the login page to recover their account. If you use an external authentication mechanism you may wish to disable this feature.', + 'AUTOLOGIN_LENGTH' => '"Remember Me" login key expiration length (in days)', + 'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which "Remember Me" login keys are removed or zero to disable.', + 'BROWSER_VALID' => 'Validate browser', + 'BROWSER_VALID_EXPLAIN' => 'Enables browser validation for each session improving security.', + 'CHECK_DNSBL' => 'Check IP against DNS Blackhole List', + 'CHECK_DNSBL_EXPLAIN' => 'If enabled the user’s IP address is checked against the following DNSBL services on registration and posting: spamcop.net and www.spamhaus.org. This lookup may take a while, depending on the server’s configuration. If slowdowns are experienced or too many false positives reported it is recommended to disable this check.', + 'CLASS_B' => 'A.B', + 'CLASS_C' => 'A.B.C', + 'EMAIL_CHECK_MX' => 'Check email domain for valid MX record', + 'EMAIL_CHECK_MX_EXPLAIN' => 'If enabled, the email domain provided on registration and profile changes is checked for a valid MX record.', + 'FORCE_PASS_CHANGE' => 'Force password change', + 'FORCE_PASS_CHANGE_EXPLAIN' => 'Require user to change their password after a set number of days. Setting this value to 0 disables this behaviour.', + 'FORM_TIME_MAX' => 'Maximum time to submit forms', + 'FORM_TIME_MAX_EXPLAIN' => 'The time a user has to submit a form. Use -1 to disable. Note that a form might become invalid if the session expires, regardless of this setting.', + 'FORM_SID_GUESTS' => 'Tie forms to guest sessions', + 'FORM_SID_GUESTS_EXPLAIN' => 'If enabled, the form token issued to guests will be session-exclusive. This can cause problems with some ISPs.', + 'FORWARDED_FOR_VALID' => 'Validate X_FORWARDED_FOR header', + 'FORWARDED_FOR_VALID_EXPLAIN' => 'Sessions will only be continued if the sent X_FORWARDED_FOR header equals the one sent with the previous request. Bans will be checked against IPs in X_FORWARDED_FOR too.', + 'IP_VALID' => 'Session IP validation', + 'IP_VALID_EXPLAIN' => 'Determines how much of the users IP is used to validate a session; All compares the complete address, A.B.C the first x.x.x, A.B the first x.x, None disables checking. On IPv6 addresses A.B.C compares the first 4 blocks and A.B the first 3 blocks.', + 'IP_LOGIN_LIMIT_MAX' => 'Maximum number of login attempts per IP address', + 'IP_LOGIN_LIMIT_MAX_EXPLAIN' => 'The threshold of login attempts allowed from a single IP address before an anti-spambot task is triggered. Enter 0 to prevent the anti-spambot task from being triggered by IP addresses.', + 'IP_LOGIN_LIMIT_TIME' => 'IP address login attempt expiration time', + 'IP_LOGIN_LIMIT_TIME_EXPLAIN' => 'Login attempts expire after this period.', + 'IP_LOGIN_LIMIT_USE_FORWARDED' => 'Limit login attempts by X_FORWARDED_FOR header', + 'IP_LOGIN_LIMIT_USE_FORWARDED_EXPLAIN' => 'Instead of limiting login attempts by IP address they are limited by X_FORWARDED_FOR values.
Warning: Only enable this if you are operating a proxy server that sets X_FORWARDED_FOR to trustworthy values.', + 'MAX_LOGIN_ATTEMPTS' => 'Maximum number of login attempts per username', + 'MAX_LOGIN_ATTEMPTS_EXPLAIN' => 'The number of login attempts allowed for a single account before the anti-spambot task is triggered. Enter 0 to prevent the anti-spambot task from being triggered for distinct user accounts.', + 'NO_IP_VALIDATION' => 'None', + 'NO_REF_VALIDATION' => 'None', + 'PASSWORD_TYPE' => 'Password complexity', + 'PASSWORD_TYPE_EXPLAIN' => 'Determines how complex a password needs to be when set or altered, subsequent options include the previous ones.', + 'PASS_TYPE_ALPHA' => 'Must contain letters and numbers', + 'PASS_TYPE_ANY' => 'No requirements', + 'PASS_TYPE_CASE' => 'Must be mixed case', + 'PASS_TYPE_SYMBOL' => 'Must contain symbols', + 'REF_HOST' => 'Only validate host', + 'REF_PATH' => 'Also validate path', + 'REFERRER_VALID' => 'Validate Referrer', + 'REFERRER_VALID_EXPLAIN' => 'If enabled, the referrer of POST requests will be checked against the host/script path settings. This may cause issues with boards using several domains and or external logins.', + 'TPL_ALLOW_PHP' => 'Allow php in templates', + 'TPL_ALLOW_PHP_EXPLAIN' => 'If this option is enabled, PHP and INCLUDEPHP statements will be recognised and parsed in templates.', + 'UPLOAD_CERT_VALID' => 'Validate upload certificate', + 'UPLOAD_CERT_VALID_EXPLAIN' => 'If enabled, certificates of remote uploads will be validated. This requires the CA bundle to be defined by the openssl.cafile or curl.cainfo setting in your php.ini.', +)); + +// Email Settings +$lang = array_merge($lang, array( + 'ACP_EMAIL_SETTINGS_EXPLAIN' => 'This information is used when the board sends emails to your users. Please ensure the email address you specify is valid, any bounced or undeliverable messages will likely be sent to that address. If your host does not provide a native (PHP based) email service you can instead send messages directly using SMTP. This requires the address of an appropriate server (ask your provider if necessary). If the server requires authentication (and only if it does) enter the necessary username, password and authentication method.', + + 'ADMIN_EMAIL' => 'From email address', + 'ADMIN_EMAIL_EXPLAIN' => 'This will be used as the from address on all emails, the technical contact email address. It will always be used as the Sender address in emails.', + 'BOARD_EMAIL_FORM' => 'Users send email via board', + 'BOARD_EMAIL_FORM_EXPLAIN' => 'Instead of showing the users email address users are able to send emails via the board.', + 'BOARD_HIDE_EMAILS' => 'Hide email addresses', + 'BOARD_HIDE_EMAILS_EXPLAIN' => 'This function keeps email addresses completely private.', + 'CONTACT_EMAIL' => 'Contact email address', + 'CONTACT_EMAIL_EXPLAIN' => 'This address will be used whenever a specific contact point is needed, e.g. spam, error output, etc. It will always be used as the From and Reply-To address in emails.', + 'CONTACT_EMAIL_NAME' => 'Contact name', + 'CONTACT_EMAIL_NAME_EXPLAIN' => 'This is the contact name that e-mail recipients will see. If you don’t want to have a contact name, leave this field empty.', + 'EMAIL_FORCE_SENDER' => 'Force from email address', + 'EMAIL_FORCE_SENDER_EXPLAIN' => 'This will set the Return-Path to the from email address instead of using the local user and hostname of the server. This setting does not apply when using SMTP.
Warning: Requires the user that the webserver runs as to be added as trusted user to the sendmail configuration.', + 'EMAIL_PACKAGE_SIZE' => 'Email package size', + 'EMAIL_PACKAGE_SIZE_EXPLAIN' => 'This is the number of maximum emails sent out in one package. This setting is applied to the internal message queue; set this value to 0 if you have problems with non-delivered notification emails.', + 'EMAIL_MAX_CHUNK_SIZE' => 'Maximum allowed email recipients', + 'EMAIL_MAX_CHUNK_SIZE_EXPLAIN' => 'If necessary, set this to not exceed the maximum number of recipients that your email server will allow in one email message.', + 'EMAIL_SIG' => 'Email signature', + 'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends.', + 'ENABLE_EMAIL' => 'Enable board-wide emails', + 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all. Note the user and admin account activation settings require this setting to be enabled. If currently using “user” or “admin” activation in the activation settings, disabling this setting will disable registration.', + 'SEND_TEST_EMAIL' => 'Send a test email', + 'SEND_TEST_EMAIL_EXPLAIN' => 'This will send a test email to the address defined in your account.', + 'SMTP_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', + 'SMTP_ALLOW_SELF_SIGNED_EXPLAIN'=> 'Allow connections to SMTP server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', + 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', + 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', + 'SMTP_CRAM_MD5' => 'CRAM-MD5', + 'SMTP_DIGEST_MD5' => 'DIGEST-MD5', + 'SMTP_LOGIN' => 'LOGIN', + 'SMTP_PASSWORD' => 'SMTP password', + 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', + 'SMTP_PLAIN' => 'PLAIN', + 'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP', + 'SMTP_PORT' => 'SMTP server port', + 'SMTP_PORT_EXPLAIN' => 'Only change this if you know your SMTP server is on a different port.', + 'SMTP_SERVER' => 'SMTP server address', + 'SMTP_SERVER_EXPLAIN' => 'Do not provide a protocol (ssl:// or tls://) unless your mail host tells you to do so.', + 'SMTP_SETTINGS' => 'SMTP settings', + 'SMTP_USERNAME' => 'SMTP username', + 'SMTP_USERNAME_EXPLAIN' => 'Only enter a username if your SMTP server requires it.', + 'SMTP_VERIFY_PEER' => 'Verify SSL certificate', + 'SMTP_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by SMTP server.
Warning: Connecting peers with unverified SSL certificates may cause security implications.', + 'SMTP_VERIFY_PEER_NAME' => 'Verify SMTP peer name', + 'SMTP_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for SMTP servers using SSL / TLS connections.
Warning: Connecting to unverified peers may cause security implications.', + 'TEST_EMAIL_SENT' => 'The test email has been sent.
If you don’t receive it, please check your emails configuration.

If you require assistance, please visit the phpBB support forums.', + + 'USE_SMTP' => 'Use SMTP server for email', + 'USE_SMTP_EXPLAIN' => 'Select “Yes” if you want or have to send email via a named server instead of the local mail function.', +)); + +// Jabber settings +$lang = array_merge($lang, array( + 'ACP_JABBER_SETTINGS_EXPLAIN' => 'Here you can enable and control the use of Jabber for instant messaging and board notifications. Jabber is an open source protocol and therefore available for use by anyone. Some Jabber servers include gateways or transports which allow you to contact users on other networks. Not all servers offer all transports and changes in protocols can prevent transports from operating. Please be sure to enter already registered account details - phpBB will use the details you enter here as is.', + + 'JAB_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', + 'JAB_ALLOW_SELF_SIGNED_EXPLAIN' => 'Allow connections to Jabber server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', + 'JAB_ENABLE' => 'Enable Jabber', + 'JAB_ENABLE_EXPLAIN' => 'Enables use of Jabber messaging and notifications.', + 'JAB_GTALK_NOTE' => 'Please note that GTalk will not work because the dns_get_record function could not be found. This function is not available in PHP4, and is not implemented on Windows platforms. It currently does not work on BSD-based systems, including Mac OS.', + 'JAB_PACKAGE_SIZE' => 'Jabber package size', + 'JAB_PACKAGE_SIZE_EXPLAIN' => 'This is the number of messages sent in one package. If set to 0 the message is sent immediately and will not be queued for later sending.', + 'JAB_PASSWORD' => 'Jabber password', + 'JAB_PASSWORD_EXPLAIN' => 'Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', + 'JAB_PORT' => 'Jabber port', + 'JAB_PORT_EXPLAIN' => 'Leave blank unless you know it is not port 5222.', + 'JAB_SERVER' => 'Jabber server', + 'JAB_SERVER_EXPLAIN' => 'See %sjabber.org%s for a list of servers.', + 'JAB_SETTINGS_CHANGED' => 'Jabber settings changed successfully.', + 'JAB_USE_SSL' => 'Use SSL to connect', + 'JAB_USE_SSL_EXPLAIN' => 'If enabled a secure connection is tried to be established. The Jabber port will be modified to 5223 if port 5222 is specified.', + 'JAB_USERNAME' => 'Jabber username or JID', + 'JAB_USERNAME_EXPLAIN' => 'Specify a registered username or a valid JID. The username will not be checked for validity. If you only specify a username, then your JID will be the username and the server you specified above. Else, specify a valid JID, for example user@jabber.org.', + 'JAB_VERIFY_PEER' => 'Verify SSL certificate', + 'JAB_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by Jabber server.
Warning: Connecting peers with unverified SSL certificates may cause security implications.', + 'JAB_VERIFY_PEER_NAME' => 'Verify Jabber peer name', + 'JAB_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for Jabber servers using SSL / TLS connections.
Warning: Connecting to unverified peers may cause security implications.', +)); diff --git a/install/update/new/language/en/acp/common.php b/install/update/new/language/en/acp/common.php new file mode 100644 index 0000000..5ac4b44 --- /dev/null +++ b/install/update/new/language/en/acp/common.php @@ -0,0 +1,823 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Common +$lang = array_merge($lang, array( + 'ACP_ADMINISTRATORS' => 'Administrators', + 'ACP_ADMIN_LOGS' => 'Admin log', + 'ACP_ADMIN_ROLES' => 'Admin roles', + 'ACP_ATTACHMENTS' => 'Attachments', + 'ACP_ATTACHMENT_SETTINGS' => 'Attachment settings', + 'ACP_AUTH_SETTINGS' => 'Authentication', + 'ACP_AUTOMATION' => 'Automation', + 'ACP_AVATAR_SETTINGS' => 'Avatar settings', + + 'ACP_BACKUP' => 'Backup', + 'ACP_BAN' => 'Banning', + 'ACP_BAN_EMAILS' => 'Ban emails', + 'ACP_BAN_IPS' => 'Ban IPs', + 'ACP_BAN_USERNAMES' => 'Ban users', + 'ACP_BBCODES' => 'BBCodes', + 'ACP_BOARD_CONFIGURATION' => 'Board configuration', + 'ACP_BOARD_FEATURES' => 'Board features', + 'ACP_BOARD_MANAGEMENT' => 'Board management', + 'ACP_BOARD_SETTINGS' => 'Board settings', + 'ACP_BOTS' => 'Spiders/Robots', + + 'ACP_CAPTCHA' => 'CAPTCHA', + + 'ACP_CAT_CUSTOMISE' => 'Customise', + 'ACP_CAT_DATABASE' => 'Database', + 'ACP_CAT_DOT_MODS' => 'Extensions', + 'ACP_CAT_FORUMS' => 'Forums', + 'ACP_CAT_GENERAL' => 'General', + 'ACP_CAT_MAINTENANCE' => 'Maintenance', + 'ACP_CAT_PERMISSIONS' => 'Permissions', + 'ACP_CAT_POSTING' => 'Posting', + 'ACP_CAT_STYLES' => 'Styles', + 'ACP_CAT_SYSTEM' => 'System', + 'ACP_CAT_USERGROUP' => 'Users and Groups', + 'ACP_CAT_USERS' => 'Users', + 'ACP_CLIENT_COMMUNICATION' => 'Client communication', + 'ACP_COOKIE_SETTINGS' => 'Cookie settings', + 'ACP_CONTACT' => 'Contact page', + 'ACP_CONTACT_SETTINGS' => 'Contact page settings', + 'ACP_CRITICAL_LOGS' => 'Error log', + 'ACP_CUSTOM_PROFILE_FIELDS' => 'Custom profile fields', + + 'ACP_DATABASE' => 'Database management', + 'ACP_DISALLOW' => 'Disallow', + 'ACP_DISALLOW_USERNAMES' => 'Disallow usernames', + + 'ACP_EMAIL_SETTINGS' => 'Email settings', + 'ACP_EXTENSION_GROUPS' => 'Manage attachment extension groups', + 'ACP_EXTENSION_MANAGEMENT' => 'Extension management', + 'ACP_EXTENSIONS' => 'Manage extensions', + + 'ACP_FORUM_BASED_PERMISSIONS' => 'Forum based permissions', + 'ACP_FORUM_LOGS' => 'Forum logs', + 'ACP_FORUM_MANAGEMENT' => 'Forum management', + 'ACP_FORUM_MODERATORS' => 'Forum moderators', + 'ACP_FORUM_PERMISSIONS' => 'Forum permissions', + 'ACP_FORUM_PERMISSIONS_COPY' => 'Copy forum permissions', + 'ACP_FORUM_ROLES' => 'Forum roles', + + 'ACP_GENERAL_CONFIGURATION' => 'General configuration', + 'ACP_GENERAL_TASKS' => 'General tasks', + 'ACP_GLOBAL_MODERATORS' => 'Global moderators', + 'ACP_GLOBAL_PERMISSIONS' => 'Global permissions', + 'ACP_GROUPS' => 'Groups', + 'ACP_GROUPS_FORUM_PERMISSIONS' => 'Group forum permissions', + 'ACP_GROUPS_MANAGE' => 'Manage groups', + 'ACP_GROUPS_MANAGEMENT' => 'Group management', + 'ACP_GROUPS_PERMISSIONS' => 'Group permissions', + 'ACP_GROUPS_POSITION' => 'Manage group positions', + + 'ACP_HELP_PHPBB' => 'Help support phpBB', + + 'ACP_ICONS' => 'Topic icons', + 'ACP_ICONS_SMILIES' => 'Topic icons/smilies', + 'ACP_INACTIVE_USERS' => 'Inactive users', + 'ACP_INDEX' => 'ACP index', + + 'ACP_JABBER_SETTINGS' => 'Jabber settings', + + 'ACP_LANGUAGE' => 'Language management', + 'ACP_LANGUAGE_PACKS' => 'Language packs', + 'ACP_LOAD_SETTINGS' => 'Load settings', + 'ACP_LOGGING' => 'Logging', + + 'ACP_MAIN' => 'ACP index', + + 'ACP_MANAGE_ATTACHMENTS' => 'Manage attachments', + 'ACP_MANAGE_ATTACHMENTS_EXPLAIN' => 'Here you can list and delete files attached to posts and private messages.', + + 'ACP_MANAGE_EXTENSIONS' => 'Manage attachment extensions', + 'ACP_MANAGE_FORUMS' => 'Manage forums', + 'ACP_MANAGE_RANKS' => 'Manage ranks', + 'ACP_MANAGE_REASONS' => 'Manage report/denial reasons', + 'ACP_MANAGE_USERS' => 'Manage users', + 'ACP_MASS_EMAIL' => 'Mass email', + 'ACP_MESSAGES' => 'Messages', + 'ACP_MESSAGE_SETTINGS' => 'Private message settings', + 'ACP_MODULE_MANAGEMENT' => 'Module management', + 'ACP_MOD_LOGS' => 'Moderator log', + 'ACP_MOD_ROLES' => 'Moderator roles', + + 'ACP_NO_ITEMS' => 'There are no items yet.', + + 'ACP_ORPHAN_ATTACHMENTS' => 'Orphaned attachments', + + 'ACP_PERMISSIONS' => 'Permissions', + 'ACP_PERMISSION_MASKS' => 'Permission masks', + 'ACP_PERMISSION_ROLES' => 'Permission roles', + 'ACP_PERMISSION_TRACE' => 'Permission trace', + 'ACP_PHP_INFO' => 'PHP information', + 'ACP_POST_SETTINGS' => 'Post settings', + 'ACP_PRUNE_FORUMS' => 'Prune forums', + 'ACP_PRUNE_USERS' => 'Prune users', + 'ACP_PRUNING' => 'Pruning', + + 'ACP_QUICK_ACCESS' => 'Quick access', + + 'ACP_RANKS' => 'Ranks', + 'ACP_REASONS' => 'Report/denial reasons', + 'ACP_REGISTER_SETTINGS' => 'User registration settings', + + 'ACP_RESTORE' => 'Restore', + + 'ACP_FEED' => 'Feed management', + 'ACP_FEED_SETTINGS' => 'Feed settings', + + 'ACP_SEARCH' => 'Search configuration', + 'ACP_SEARCH_INDEX' => 'Search index', + 'ACP_SEARCH_SETTINGS' => 'Search settings', + + 'ACP_SECURITY_SETTINGS' => 'Security settings', + 'ACP_SERVER_CONFIGURATION' => 'Server configuration', + 'ACP_SERVER_SETTINGS' => 'Server settings', + 'ACP_SIGNATURE_SETTINGS' => 'Signature settings', + 'ACP_SMILIES' => 'Smilies', + 'ACP_STYLE_MANAGEMENT' => 'Style management', + 'ACP_STYLES' => 'Styles', + 'ACP_STYLES_CACHE' => 'Purge Cache', + 'ACP_STYLES_INSTALL' => 'Install Styles', + + 'ACP_SUBMIT_CHANGES' => 'Submit changes', + + 'ACP_TEMPLATES' => 'Templates', + 'ACP_THEMES' => 'Themes', + + 'ACP_UPDATE' => 'Updating', + 'ACP_USERS_FORUM_PERMISSIONS' => 'User forum permissions', + 'ACP_USERS_LOGS' => 'User logs', + 'ACP_USERS_PERMISSIONS' => 'User permissions', + 'ACP_USER_ATTACH' => 'Attachments', + 'ACP_USER_AVATAR' => 'Avatar', + 'ACP_USER_FEEDBACK' => 'Feedback', + 'ACP_USER_GROUPS' => 'Groups', + 'ACP_USER_MANAGEMENT' => 'User management', + 'ACP_USER_OVERVIEW' => 'Overview', + 'ACP_USER_PERM' => 'Permissions', + 'ACP_USER_PREFS' => 'Preferences', + 'ACP_USER_PROFILE' => 'Profile', + 'ACP_USER_RANK' => 'Rank', + 'ACP_USER_ROLES' => 'User roles', + 'ACP_USER_SECURITY' => 'User security', + 'ACP_USER_SIG' => 'Signature', + 'ACP_USER_WARNINGS' => 'Warnings', + + 'ACP_VC_SETTINGS' => 'Spambot countermeasures', + 'ACP_VC_CAPTCHA_DISPLAY' => 'CAPTCHA image preview', + 'ACP_VERSION_CHECK' => 'Check for updates', + 'ACP_VIEW_ADMIN_PERMISSIONS' => 'View administrative permissions', + 'ACP_VIEW_FORUM_MOD_PERMISSIONS' => 'View forum moderation permissions', + 'ACP_VIEW_FORUM_PERMISSIONS' => 'View forum-based permissions', + 'ACP_VIEW_GLOBAL_MOD_PERMISSIONS' => 'View global moderation permissions', + 'ACP_VIEW_USER_PERMISSIONS' => 'View user-based permissions', + + 'ACP_WORDS' => 'Word censoring', + + 'ACTION' => 'Action', + 'ACTIONS' => 'Actions', + 'ACTIVATE' => 'Activate', + 'ADD' => 'Add', + 'ADMIN' => 'Administration', + 'ADMIN_INDEX' => 'Admin index', + 'ADMIN_PANEL' => 'Administration Control Panel', + + 'ADM_LOGOUT' => 'ACP Logout', + 'ADM_LOGGED_OUT' => 'Successfully logged out from Administration Control Panel', + + 'BACK' => 'Back', + + 'CONTAINER_EXCEPTION' => 'phpBB encountered an error building the container due to an installed extension. For this reason, all extensions have been temporarily disabled. Please try purging your forum cache. All extensions will automatically be re-enabled once the container error is resolved. If this error continues, please visit phpBB.com for support.', + 'EXCEPTION' => 'Exception', + + 'COLOUR_SWATCH' => 'Web-safe colour swatch', + 'CONFIG_UPDATED' => 'Configuration updated successfully.', + 'CRON_LOCK_ERROR' => 'Could not obtain cron lock.', + 'CRON_NO_SUCH_TASK' => 'Could not find cron task “%s”.', + 'CRON_NO_TASK' => 'No cron tasks need to be run right now.', + 'CRON_NO_TASKS' => 'No cron tasks could be found.', + 'CURRENT_VERSION' => 'Current version', + + 'DEACTIVATE' => 'Deactivate', + 'DIRECTORY_DOES_NOT_EXIST' => 'The entered path “%s” does not exist.', + 'DIRECTORY_NOT_DIR' => 'The entered path “%s” is not a directory.', + 'DIRECTORY_NOT_WRITABLE' => 'The entered path “%s” is not writable.', + 'DISABLE' => 'Disable', + 'DOWNLOAD' => 'Download', + 'DOWNLOAD_AS' => 'Download as', + 'DOWNLOAD_STORE' => 'Download or store file', + 'DOWNLOAD_STORE_EXPLAIN' => 'You may directly download the file or save it in your store/ folder.', + 'DOWNLOADS' => 'Downloads', + + 'EDIT' => 'Edit', + 'ENABLE' => 'Enable', + 'EXPORT_DOWNLOAD' => 'Download', + 'EXPORT_STORE' => 'Store', + + 'GENERAL_OPTIONS' => 'General options', + 'GENERAL_SETTINGS' => 'General settings', + 'GLOBAL_MASK' => 'Global permission mask', + + 'INSTALL' => 'Install', + 'IP' => 'User IP', + 'IP_HOSTNAME' => 'IP addresses or hostnames', + + 'LATEST_VERSION' => 'Latest version', + 'LOAD_NOTIFICATIONS' => 'Display Notifications', + 'LOAD_NOTIFICATIONS_EXPLAIN' => 'Display the notifications list on every page (typically in the header).', + 'LOGGED_IN_AS' => 'You are logged in as:', + 'LOGIN_ADMIN' => 'To administer the board you must be an authenticated user.', + 'LOGIN_ADMIN_CONFIRM' => 'To administer the board you must re-authenticate yourself.', + 'LOGIN_ADMIN_SUCCESS' => 'You have successfully authenticated and will now be redirected to the Administration Control Panel.', + 'LOOK_UP_FORUM' => 'Select a forum', + 'LOOK_UP_FORUMS_EXPLAIN'=> 'You are able to select more than one forum.', + + 'MANAGE' => 'Manage', + 'MENU_TOGGLE' => 'Hide or display the side menu', + 'MORE' => 'More', // Not used at the moment + 'MORE_INFORMATION' => 'More information »', + 'MOVE_DOWN' => 'Move down', + 'MOVE_UP' => 'Move up', + + 'NOTIFY' => 'Notification', + 'NO_ADMIN' => 'You are not authorised to administer this board.', + 'NO_EMAILS_DEFINED' => 'No valid email addresses found.', + 'NO_FILES_TO_DELETE' => 'Attachments you selected for deletion do not exist.', + 'NO_PASSWORD_SUPPLIED' => 'You need to enter your password to access the Administration Control Panel.', + + 'OFF' => 'Off', + 'ON' => 'On', + + 'PARSE_BBCODE' => 'Parse BBCode', + 'PARSE_SMILIES' => 'Parse smilies', + 'PARSE_URLS' => 'Parse links', + 'PERMISSIONS_TRANSFERRED' => 'Permissions transferred', + 'PERMISSIONS_TRANSFERRED_EXPLAIN' => 'You currently have the permissions from %1$s. You are able to browse the board with this user’s permissions, but not access the administration control panel since admin permissions were not transferred. You can revert to your permission set at any time.', + 'PROCEED_TO_ACP' => '%sProceed to the ACP%s', + + 'RELEASE_ANNOUNCEMENT' => 'Announcement', + 'REMIND' => 'Remind', + 'REPARSE_LOCK_ERROR' => 'Reparsing is already in progress by another process.', + 'RESYNC' => 'Resynchronise', + + 'RUNNING_TASK' => 'Running task: %s.', + 'SELECT_ANONYMOUS' => 'Select anonymous user', + 'SELECT_OPTION' => 'Select option', + + 'SETTING_TOO_LOW' => 'The provided value for the setting “%1$s” is too low. The minimum acceptable value is %2$d.', + 'SETTING_TOO_BIG' => 'The provided value for the setting “%1$s” is too high. The maximum acceptable value is %2$d.', + 'SETTING_TOO_LONG' => 'The provided value for the setting “%1$s” is too long. The maximum acceptable length is %2$d.', + 'SETTING_TOO_SHORT' => 'The provided value for the setting “%1$s” is too short. The minimum acceptable length is %2$d.', + + 'SHOW_ALL_OPERATIONS' => 'Show all operations', + + 'TASKS_NOT_READY' => 'Not ready tasks:', + 'TASKS_READY' => 'Ready tasks:', + 'TOTAL_SIZE' => 'Total size', + + 'UCP' => 'User Control Panel', + 'URL_INVALID' => 'The provided URL for the setting “%1$s” is invalid.', + 'USERNAMES_EXPLAIN' => 'Place each username on a separate line.', + 'USER_CONTROL_PANEL' => 'User Control Panel', + + 'UPDATE_NEEDED' => 'The board is not up to date.', + 'UPDATE_NOT_NEEDED' => 'The board is up to date.', + 'UPDATES_AVAILABLE' => 'Updates available:', + + 'WARNING' => 'Warning', +)); + +// PHP info +$lang = array_merge($lang, array( + 'ACP_PHP_INFO_EXPLAIN' => 'This page lists information on the version of PHP installed on this server. It includes details of loaded modules, available variables and default settings. This information may be useful when diagnosing problems. Please be aware that some hosting companies will limit what information is displayed here for security reasons. You are advised to not give out any details on this page except when asked by official team members on the support forums.', + + 'NO_PHPINFO_AVAILABLE' => 'Information about your PHP configuration is unable to be determined. Phpinfo() has been disabled for security reasons.', +)); + +// Logs +$lang = array_merge($lang, array( + 'ACP_ADMIN_LOGS_EXPLAIN' => 'This lists all the actions carried out by board administrators. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.', + 'ACP_CRITICAL_LOGS_EXPLAIN' => 'This lists the actions carried out by the board itself. This log provides you with information you are able to use for solving specific problems, for example non-delivery of emails. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.', + 'ACP_MOD_LOGS_EXPLAIN' => 'This lists all actions done on forums, topics and posts as well as actions carried out on users by moderators, including banning. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.', + 'ACP_USERS_LOGS_EXPLAIN' => 'This lists all actions carried out by users or on users (reports, warnings and user notes).', + 'ALL_ENTRIES' => 'All entries', + + 'DISPLAY_LOG' => 'Display entries from previous', + + 'NO_ENTRIES' => 'No log entries for this period.', + + 'SORT_IP' => 'IP address', + 'SORT_DATE' => 'Date', + 'SORT_ACTION' => 'Log action', +)); + +// Index page +$lang = array_merge($lang, array( + 'ADMIN_INTRO' => 'Thank you for choosing phpBB as your board solution. This screen will give you a quick overview of all the various statistics of your board. The links on the left hand side of this screen allow you to control every aspect of your board experience. Each page will have instructions on how to use the tools.', + 'ADMIN_LOG' => 'Logged administrator actions', + 'ADMIN_LOG_INDEX_EXPLAIN' => 'This gives an overview of the last five actions carried out by board administrators. A full copy of the log can be viewed from the appropriate menu item or following the link below.', + 'AVATAR_DIR_SIZE' => 'Avatar directory size', + + 'BOARD_STARTED' => 'Board started', + 'BOARD_VERSION' => 'Board version', + + 'DATABASE_SERVER_INFO' => 'Database server', + 'DATABASE_SIZE' => 'Database size', + + // Environment configuration checks, mbstring related + 'ERROR_MBSTRING_FUNC_OVERLOAD' => 'Function overloading is improperly configured', + 'ERROR_MBSTRING_FUNC_OVERLOAD_EXPLAIN' => 'mbstring.func_overload must be set to either 0 or 4. You can check the current value on the PHP information page.', + 'ERROR_MBSTRING_ENCODING_TRANSLATION' => 'Transparent character encoding is improperly configured', + 'ERROR_MBSTRING_ENCODING_TRANSLATION_EXPLAIN' => 'mbstring.encoding_translation must be set to 0. You can check the current value on the PHP information page.', + 'ERROR_MBSTRING_HTTP_INPUT' => 'HTTP input character conversion is improperly configured', + 'ERROR_MBSTRING_HTTP_INPUT_EXPLAIN' => 'mbstring.http_input must be set to pass. You can check the current value on the PHP information page.', + 'ERROR_MBSTRING_HTTP_OUTPUT' => 'HTTP output character conversion is improperly configured', + 'ERROR_MBSTRING_HTTP_OUTPUT_EXPLAIN' => 'mbstring.http_output must be set to pass. You can check the current value on the PHP information page.', + + 'FILES_PER_DAY' => 'Attachments per day', + 'FORUM_STATS' => 'Board statistics', + + 'GZIP_COMPRESSION' => 'GZip compression', + + 'NO_SEARCH_INDEX' => 'The selected search backend does not have a search index.
Please create the index for “%1$s” in the %2$ssearch index%3$s section.', + 'NOT_AVAILABLE' => 'Not available', + 'NUMBER_FILES' => 'Number of attachments', + 'NUMBER_POSTS' => 'Number of posts', + 'NUMBER_TOPICS' => 'Number of topics', + 'NUMBER_USERS' => 'Number of users', + 'NUMBER_ORPHAN' => 'Orphan attachments', + + 'PHP_VERSION' => 'PHP version', + 'PHP_VERSION_OLD' => 'The version of PHP on this server (%1$s) will no longer be supported by future versions of phpBB. The minimum required version will be PHP %2$s. %3$sDetails%4$s', + + 'POSTS_PER_DAY' => 'Posts per day', + + 'PURGE_CACHE' => 'Purge the cache', + 'PURGE_CACHE_CONFIRM' => 'Are you sure you wish to purge the cache?', + 'PURGE_CACHE_EXPLAIN' => 'Purge all cache related items, this includes any cached template files or queries.', + 'PURGE_CACHE_SUCCESS' => 'Cache successfully purged.', + + 'PURGE_SESSIONS' => 'Purge all sessions', + 'PURGE_SESSIONS_CONFIRM' => 'Are you sure you wish to purge all sessions? This will log out all users.', + 'PURGE_SESSIONS_EXPLAIN' => 'Purge all sessions. This will log out all users by truncating the session table.', + 'PURGE_SESSIONS_SUCCESS' => 'Sessions successfully purged.', + + 'RESET_DATE' => 'Reset board’s start date', + 'RESET_DATE_CONFIRM' => 'Are you sure you wish to reset the board’s start date?', + 'RESET_DATE_SUCCESS' => 'Board’s start date reset', + 'RESET_ONLINE' => 'Reset most users ever online', + 'RESET_ONLINE_CONFIRM' => 'Are you sure you wish to reset the most users ever online counter?', + 'RESET_ONLINE_SUCCESS' => 'Most users ever online reset', + 'RESYNC_POSTCOUNTS' => 'Resynchronise post counts', + 'RESYNC_POSTCOUNTS_EXPLAIN' => 'Only existing posts will be taken into consideration. Pruned posts will not be counted.', + 'RESYNC_POSTCOUNTS_CONFIRM' => 'Are you sure you wish to resynchronise post counts?', + 'RESYNC_POSTCOUNTS_SUCCESS' => 'Resynchronised post counts', + 'RESYNC_POST_MARKING' => 'Resynchronise dotted topics', + 'RESYNC_POST_MARKING_CONFIRM' => 'Are you sure you wish to resynchronise dotted topics?', + 'RESYNC_POST_MARKING_EXPLAIN' => 'First unmarks all topics and then correctly marks topics that have seen any activity during the past six months.', + 'RESYNC_POST_MARKING_SUCCESS' => 'Resynchronised dotted topics', + 'RESYNC_STATS' => 'Resynchronise statistics', + 'RESYNC_STATS_CONFIRM' => 'Are you sure you wish to resynchronise statistics?', + 'RESYNC_STATS_EXPLAIN' => 'Recalculates the total number of posts, topics, users and files.', + 'RESYNC_STATS_SUCCESS' => 'Resynchronised statistics', + 'RUN' => 'Run now', + + 'STATISTIC' => 'Statistic', + 'STATISTIC_RESYNC_OPTIONS' => 'Resynchronise or reset statistics', + + 'TIMEZONE_INVALID' => 'The timezone you selected is invalid.', + 'TIMEZONE_SELECTED' => '(currently selected)', + 'TOPICS_PER_DAY' => 'Topics per day', + + 'UPLOAD_DIR_SIZE' => 'Size of posted attachments', + 'USERS_PER_DAY' => 'Users per day', + + 'VALUE' => 'Value', + 'VERSIONCHECK_FAIL' => 'Failed to obtain latest version information.', + 'VERSIONCHECK_FORCE_UPDATE' => 'Re-Check version', + 'VERSION_CHECK' => 'Version check', + 'VERSION_CHECK_EXPLAIN' => 'Checks to see if your phpBB installation is up to date.', + 'VERSIONCHECK_INVALID_ENTRY' => 'Latest version information contains an unsupported entry.', + 'VERSIONCHECK_INVALID_URL' => 'Latest version information contains invalid URL.', + 'VERSIONCHECK_INVALID_VERSION' => 'Latest version information contains an invalid version.', + 'VERSION_NOT_UP_TO_DATE_ACP' => 'Your phpBB installation is not up to date.
Below is a link to the release announcement, which contains more information as well as instructions on updating.', + 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your phpBB installation is not up to date.', + 'VERSION_UP_TO_DATE_ACP' => 'Your phpBB installation is up to date. There are no updates available at this time.', + 'VIEW_ADMIN_LOG' => 'View administrator log', + 'VIEW_INACTIVE_USERS' => 'View inactive users', + + 'WELCOME_PHPBB' => 'Welcome to phpBB', + 'WRITABLE_CONFIG' => 'Your config file (config.php) is currently world-writable. We strongly encourage you to change the permissions to 640 or at least to 644 (for example: chmod 640 config.php).', +)); + +// Inactive Users +$lang = array_merge($lang, array( + 'INACTIVE_DATE' => 'Inactive date', + 'INACTIVE_REASON' => 'Reason', + 'INACTIVE_REASON_MANUAL' => 'Account deactivated by administrator', + 'INACTIVE_REASON_PROFILE' => 'Profile details changed', + 'INACTIVE_REASON_REGISTER' => 'Newly registered account', + 'INACTIVE_REASON_REMIND' => 'Forced user account reactivation', + 'INACTIVE_REASON_UNKNOWN' => 'Unknown', + 'INACTIVE_USERS' => 'Inactive users', + 'INACTIVE_USERS_EXPLAIN' => 'This is a list of users who have registered but whose accounts are inactive. You can activate, delete or remind (by sending an email) these users if you wish.', + 'INACTIVE_USERS_EXPLAIN_INDEX' => 'This is a list of the last 10 registered users who have inactive accounts. Accounts are inactive either because account activation was enabled in user registration settings and these users’ accounts have not yet been activated, or because these accounts have been deactivated. A full list is available by following the link below from where you can activate, delete or remind (by sending an email) these users if you wish.', + + 'NO_INACTIVE_USERS' => 'No inactive users', + + 'SORT_INACTIVE' => 'Inactive date', + 'SORT_LAST_VISIT' => 'Last visit', + 'SORT_REASON' => 'Reason', + 'SORT_REG_DATE' => 'Registration date', + 'SORT_LAST_REMINDER'=> 'Last reminded', + 'SORT_REMINDER' => 'Reminder sent', + + 'USER_IS_INACTIVE' => 'User is inactive', +)); + +// Help support phpBB page +$lang = array_merge($lang, array( + 'EXPLAIN_SEND_STATISTICS' => 'Please send information about your server and board configurations to phpBB for statistical analysis. All information that could identify you or your website has been removed - the data is entirely anonymous. We base decisions about future phpBB versions on this information. The statistics are made available publically. We also share this data with the PHP project, the programming language phpBB is made with.', + 'EXPLAIN_SHOW_STATISTICS' => 'Using the button below you can preview all variables that will be transmitted.', + 'DONT_SEND_STATISTICS' => 'Return to the ACP if you do not wish to send statistical information to phpBB.', + 'GO_ACP_MAIN' => 'Go to the ACP start page', + 'HIDE_STATISTICS' => 'Hide details', + 'SEND_STATISTICS' => 'Send statistics', + 'SEND_STATISTICS_LONG' => 'Send statistical information', + 'SHOW_STATISTICS' => 'Show details', + 'THANKS_SEND_STATISTICS' => 'Thank you for submitting your information.', + 'FAIL_SEND_STATISTICS' => 'phpBB was unable to send statistics', +)); + +// Log Entries +$lang = array_merge($lang, array( + 'LOG_ACL_ADD_USER_GLOBAL_U_' => 'Added or edited users’ user permissions
» %s', + 'LOG_ACL_ADD_GROUP_GLOBAL_U_' => 'Added or edited groups’ user permissions
» %s', + 'LOG_ACL_ADD_USER_GLOBAL_M_' => 'Added or edited users’ global moderator permissions
» %s', + 'LOG_ACL_ADD_GROUP_GLOBAL_M_' => 'Added or edited groups’ global moderator permissions
» %s', + 'LOG_ACL_ADD_USER_GLOBAL_A_' => 'Added or edited users’ administrator permissions
» %s', + 'LOG_ACL_ADD_GROUP_GLOBAL_A_' => 'Added or edited groups’ administrator permissions
» %s', + + 'LOG_ACL_ADD_ADMIN_GLOBAL_A_' => 'Added or edited Administrators
» %s', + 'LOG_ACL_ADD_MOD_GLOBAL_M_' => 'Added or edited Global Moderators
» %s', + + 'LOG_ACL_ADD_USER_LOCAL_F_' => 'Added or edited users’ forum access from %1$s
» %2$s', + 'LOG_ACL_ADD_USER_LOCAL_M_' => 'Added or edited users’ forum moderator access from %1$s
» %2$s', + 'LOG_ACL_ADD_GROUP_LOCAL_F_' => 'Added or edited groups’ forum access from %1$s
» %2$s', + 'LOG_ACL_ADD_GROUP_LOCAL_M_' => 'Added or edited groups’ forum moderator access from %1$s
» %2$s', + + 'LOG_ACL_ADD_MOD_LOCAL_M_' => 'Added or edited Moderators from %1$s
» %2$s', + 'LOG_ACL_ADD_FORUM_LOCAL_F_' => 'Added or edited forum permissions from %1$s
» %2$s', + + 'LOG_ACL_DEL_ADMIN_GLOBAL_A_' => 'Removed Administrators
» %s', + 'LOG_ACL_DEL_MOD_GLOBAL_M_' => 'Removed Global Moderators
» %s', + 'LOG_ACL_DEL_MOD_LOCAL_M_' => 'Removed Moderators from %1$s
» %2$s', + 'LOG_ACL_DEL_FORUM_LOCAL_F_' => 'Removed User/Group forum permissions from %1$s
» %2$s', + + 'LOG_ACL_TRANSFER_PERMISSIONS' => 'Permissions transferred from
» %s', + 'LOG_ACL_RESTORE_PERMISSIONS' => 'Own permissions restored after using permissions from
» %s', + + 'LOG_ADMIN_AUTH_FAIL' => 'Failed administration login attempt', + 'LOG_ADMIN_AUTH_SUCCESS' => 'Successful administration login', + + 'LOG_ATTACHMENTS_DELETED' => 'Removed user attachments
» %s', + + 'LOG_ATTACH_EXT_ADD' => 'Added or edited attachment extension
» %s', + 'LOG_ATTACH_EXT_DEL' => 'Removed attachment extension
» %s', + 'LOG_ATTACH_EXT_UPDATE' => 'Updated attachment extension
» %s', + 'LOG_ATTACH_EXTGROUP_ADD' => 'Added extension group
» %s', + 'LOG_ATTACH_EXTGROUP_EDIT' => 'Edited extension group
» %s', + 'LOG_ATTACH_EXTGROUP_DEL' => 'Removed extension group
» %s', + 'LOG_ATTACH_FILEUPLOAD' => 'Orphan File uploaded to Post
» ID %1$d - %2$s', + 'LOG_ATTACH_ORPHAN_DEL' => 'Orphan Files deleted
» %s', + + 'LOG_BAN_EXCLUDE_USER' => 'Excluded user from ban for reason “%1$s
» %2$s', + 'LOG_BAN_EXCLUDE_IP' => 'Excluded IP from ban for reason “%1$s
» %2$s', + 'LOG_BAN_EXCLUDE_EMAIL' => 'Excluded email from ban for reason “%1$s
» %2$s', + 'LOG_BAN_USER' => 'Banned user for reason “%1$s
» %2$s', + 'LOG_BAN_IP' => 'Banned IP for reason “%1$s
» %2$s', + 'LOG_BAN_EMAIL' => 'Banned email for reason “%1$s
» %2$s', + 'LOG_UNBAN_USER' => 'Unbanned user
» %s', + 'LOG_UNBAN_IP' => 'Unbanned IP
» %s', + 'LOG_UNBAN_EMAIL' => 'Unbanned email
» %s', + + 'LOG_BBCODE_ADD' => 'Added new BBCode
» %s', + 'LOG_BBCODE_EDIT' => 'Edited BBCode
» %s', + 'LOG_BBCODE_DELETE' => 'Deleted BBCode
» %s', + 'LOG_BBCODE_CONFIGURATION_ERROR' => 'Error while configuring BBCode: %1$s
» %2$s', + + 'LOG_BOT_ADDED' => 'New bot added
» %s', + 'LOG_BOT_DELETE' => 'Deleted bot
» %s', + 'LOG_BOT_UPDATED' => 'Existing bot updated
» %s', + + 'LOG_CLEAR_ADMIN' => 'Cleared admin log', + 'LOG_CLEAR_CRITICAL' => 'Cleared error log', + 'LOG_CLEAR_MOD' => 'Cleared moderator log', + 'LOG_CLEAR_USER' => 'Cleared user log
» %s', + 'LOG_CLEAR_USERS' => 'Cleared user logs', + + 'LOG_CONFIG_ATTACH' => 'Altered attachment settings', + 'LOG_CONFIG_AUTH' => 'Altered authentication settings', + 'LOG_CONFIG_AVATAR' => 'Altered avatar settings', + 'LOG_CONFIG_COOKIE' => 'Altered cookie settings', + 'LOG_CONFIG_EMAIL' => 'Altered email settings', + 'LOG_CONFIG_FEATURES' => 'Altered board features', + 'LOG_CONFIG_LOAD' => 'Altered load settings', + 'LOG_CONFIG_MESSAGE' => 'Altered private message settings', + 'LOG_CONFIG_POST' => 'Altered post settings', + 'LOG_CONFIG_REGISTRATION' => 'Altered user registration settings', + 'LOG_CONFIG_FEED' => 'Altered syndication feeds settings', + 'LOG_CONFIG_SEARCH' => 'Altered search settings', + 'LOG_CONFIG_SECURITY' => 'Altered security settings', + 'LOG_CONFIG_SERVER' => 'Altered server settings', + 'LOG_CONFIG_SETTINGS' => 'Altered board settings', + 'LOG_CONFIG_SIGNATURE' => 'Altered signature settings', + 'LOG_CONFIG_VISUAL' => 'Altered anti-spambot settings', + + 'LOG_APPROVE_TOPIC' => 'Approved topic
» %s', + 'LOG_BUMP_TOPIC' => 'User bumped topic
» %s', + 'LOG_DELETE_POST' => 'Deleted post “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_DELETE_SHADOW_TOPIC' => 'Deleted shadow topic
» %s', + 'LOG_DELETE_TOPIC' => 'Deleted topic “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_FORK' => 'Copied topic
» from %s', + 'LOG_LOCK' => 'Locked topic
» %s', + 'LOG_LOCK_POST' => 'Locked post
» %s', + 'LOG_MERGE' => 'Merged posts into topic
» %s', + 'LOG_MOVE' => 'Moved topic
» from %1$s to %2$s', + 'LOG_MOVED_TOPIC' => 'Moved topic
» %s', + 'LOG_PM_REPORT_CLOSED' => 'Closed PM report
» %s', + 'LOG_PM_REPORT_DELETED' => 'Deleted PM report
» %s', + 'LOG_POST_APPROVED' => 'Approved post
» %s', + 'LOG_POST_DISAPPROVED' => 'Disapproved post “%1$s” written by “%3$s” for the following reason
» %2$s', + 'LOG_POST_EDITED' => 'Edited post “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_POST_RESTORED' => 'Restored post
» %s', + 'LOG_REPORT_CLOSED' => 'Closed report
» %s', + 'LOG_REPORT_DELETED' => 'Deleted report
» %s', + 'LOG_RESTORE_TOPIC' => 'Restored topic “%1$s” written by
» %2$s', + 'LOG_SOFTDELETE_POST' => 'Soft deleted post “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_SOFTDELETE_TOPIC' => 'Soft deleted topic “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_SPLIT_DESTINATION' => 'Moved split posts
» to %s', + 'LOG_SPLIT_SOURCE' => 'Split posts
» from %s', + + 'LOG_TOPIC_APPROVED' => 'Approved topic
» %s', + 'LOG_TOPIC_RESTORED' => 'Restored topic
» %s', + 'LOG_TOPIC_DISAPPROVED' => 'Disapproved topic “%1$s” written by “%3$s” for the following reason
» %2$s', + 'LOG_TOPIC_RESYNC' => 'Resynchronised topic counters
» %s', + 'LOG_TOPIC_TYPE_CHANGED' => 'Changed topic type
» %s', + 'LOG_UNLOCK' => 'Unlocked topic
» %s', + 'LOG_UNLOCK_POST' => 'Unlocked post
» %s', + + 'LOG_DISALLOW_ADD' => 'Added disallowed username
» %s', + 'LOG_DISALLOW_DELETE' => 'Deleted disallowed username', + + 'LOG_DB_BACKUP' => 'Database backup', + 'LOG_DB_DELETE' => 'Deleted database backup', + 'LOG_DB_RESTORE' => 'Restored database backup', + + 'LOG_DOWNLOAD_EXCLUDE_IP' => 'Excluded IP/hostname from download list
» %s', + 'LOG_DOWNLOAD_IP' => 'Added IP/hostname to download list
» %s', + 'LOG_DOWNLOAD_REMOVE_IP' => 'Removed IP/hostname from download list
» %s', + + 'LOG_ERROR_JABBER' => 'Jabber error
» %s', + 'LOG_ERROR_EMAIL' => 'Email error
» %s', + 'LOG_ERROR_CAPTCHA' => 'CAPTCHA error
» %s', + + 'LOG_FORUM_ADD' => 'Created new forum
» %s', + 'LOG_FORUM_COPIED_PERMISSIONS' => 'Copied forum permissions from %1$s
» %2$s', + 'LOG_FORUM_DEL_FORUM' => 'Deleted forum
» %s', + 'LOG_FORUM_DEL_FORUMS' => 'Deleted forum and its subforums
» %s', + 'LOG_FORUM_DEL_MOVE_FORUMS' => 'Deleted forum and moved subforums to %1$s
» %2$s', + 'LOG_FORUM_DEL_MOVE_POSTS' => 'Deleted forum and moved posts to %1$s
» %2$s', + 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS' => 'Deleted forum and its subforums, moved posts to %1$s
» %2$s', + 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS' => 'Deleted forum, moved posts to %1$s and subforums to %2$s
» %3$s', + 'LOG_FORUM_DEL_POSTS' => 'Deleted forum and its posts
» %s', + 'LOG_FORUM_DEL_POSTS_FORUMS' => 'Deleted forum, its posts and subforums
» %s', + 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS' => 'Deleted forum and its posts, moved subforums to %1$s
» %2$s', + 'LOG_FORUM_EDIT' => 'Edited forum details
» %s', + 'LOG_FORUM_MOVE_DOWN' => 'Moved forum %1$s below %2$s', + 'LOG_FORUM_MOVE_UP' => 'Moved forum %1$s above %2$s', + 'LOG_FORUM_SYNC' => 'Re-synchronised forum
» %s', + + 'LOG_GENERAL_ERROR' => 'A general error occurred: %1$s
» %2$s', + + 'LOG_GROUP_CREATED' => 'New usergroup created
» %s', + 'LOG_GROUP_DEFAULTS' => 'Group “%1$s” made default for members
» %2$s', + 'LOG_GROUP_DELETE' => 'Usergroup deleted
» %s', + 'LOG_GROUP_DEMOTED' => 'Leaders demoted in usergroup %1$s
» %2$s', + 'LOG_GROUP_PROMOTED' => 'Members promoted to leader in usergroup %1$s
» %2$s', + 'LOG_GROUP_REMOVE' => 'Members removed from usergroup %1$s
» %2$s', + 'LOG_GROUP_UPDATED' => 'Usergroup details updated
» %s', + 'LOG_MODS_ADDED' => 'Added new leaders to usergroup %1$s
» %2$s', + 'LOG_USERS_ADDED' => 'Added new members to usergroup %1$s
» %2$s', + 'LOG_USERS_APPROVED' => 'Users approved in usergroup %1$s
» %2$s', + 'LOG_USERS_PENDING' => 'Users requested to join group “%1$s” and need to be approved
» %2$s', + + 'LOG_IMAGE_GENERATION_ERROR' => 'Error while creating image
» Error in %1$s on line %2$s: %3$s', + + 'LOG_INACTIVE_ACTIVATE' => 'Activated inactive users
» %s', + 'LOG_INACTIVE_DELETE' => 'Deleted inactive users
» %s', + 'LOG_INACTIVE_REMIND' => 'Sent reminder emails to inactive users
» %s', + 'LOG_INSTALL_CONVERTED' => 'Converted from %1$s to phpBB %2$s', + 'LOG_INSTALL_INSTALLED' => 'Installed phpBB %s', + + 'LOG_IP_BROWSER_FORWARDED_CHECK' => 'Session IP/browser/X_FORWARDED_FOR check failed
»User IP “%1$s” checked against session IP “%2$s”, user browser string “%3$s” checked against session browser string “%4$s” and user X_FORWARDED_FOR string “%5$s” checked against session X_FORWARDED_FOR string “%6$s”.', + + 'LOG_JAB_CHANGED' => 'Jabber account changed', + 'LOG_JAB_PASSCHG' => 'Jabber password changed', + 'LOG_JAB_REGISTER' => 'Jabber account registered', + 'LOG_JAB_SETTINGS_CHANGED' => 'Jabber settings changed', + + 'LOG_LANGUAGE_PACK_DELETED' => 'Deleted language pack
» %s', + 'LOG_LANGUAGE_PACK_INSTALLED' => 'Installed language pack
» %s', + 'LOG_LANGUAGE_PACK_UPDATED' => 'Updated language pack details
» %s', + 'LOG_LANGUAGE_FILE_REPLACED' => 'Replaced language file
» %s', + 'LOG_LANGUAGE_FILE_SUBMITTED' => 'Submitted language file and placed in store folder
» %s', + + 'LOG_MASS_EMAIL' => 'Sent mass email
» %s', + + 'LOG_MCP_CHANGE_POSTER' => 'Changed poster in topic “%1$s”
» from %2$s to %3$s', + + 'LOG_MODULE_DISABLE' => 'Module disabled
» %s', + 'LOG_MODULE_ENABLE' => 'Module enabled
» %s', + 'LOG_MODULE_MOVE_DOWN' => 'Module moved down
» %1$s below %2$s', + 'LOG_MODULE_MOVE_UP' => 'Module moved up
» %1$s above %2$s', + 'LOG_MODULE_REMOVED' => 'Module removed
» %s', + 'LOG_MODULE_ADD' => 'Module added
» %s', + 'LOG_MODULE_EDIT' => 'Module edited
» %s', + + 'LOG_A_ROLE_ADD' => 'Admin role added
» %s', + 'LOG_A_ROLE_EDIT' => 'Admin role edited
» %s', + 'LOG_A_ROLE_REMOVED' => 'Admin role removed
» %s', + 'LOG_F_ROLE_ADD' => 'Forum role added
» %s', + 'LOG_F_ROLE_EDIT' => 'Forum role edited
» %s', + 'LOG_F_ROLE_REMOVED' => 'Forum role removed
» %s', + 'LOG_M_ROLE_ADD' => 'Moderator role added
» %s', + 'LOG_M_ROLE_EDIT' => 'Moderator role edited
» %s', + 'LOG_M_ROLE_REMOVED' => 'Moderator role removed
» %s', + 'LOG_U_ROLE_ADD' => 'User role added
» %s', + 'LOG_U_ROLE_EDIT' => 'User role edited
» %s', + 'LOG_U_ROLE_REMOVED' => 'User role removed
» %s', + + 'LOG_PLUPLOAD_TIDY_FAILED' => 'Unable to open %1$s for tidying, check permissions.
Exception: %2$s
Trace: %3$s', + + 'LOG_PROFILE_FIELD_ACTIVATE' => 'Profile field activated
» %s', + 'LOG_PROFILE_FIELD_CREATE' => 'Profile field added
» %s', + 'LOG_PROFILE_FIELD_DEACTIVATE' => 'Profile field deactivated
» %s', + 'LOG_PROFILE_FIELD_EDIT' => 'Profile field changed
» %s', + 'LOG_PROFILE_FIELD_REMOVED' => 'Profile field removed
» %s', + + 'LOG_PRUNE' => 'Pruned forums
» %s', + 'LOG_AUTO_PRUNE' => 'Auto-pruned forums
» %s', + 'LOG_PRUNE_SHADOW' => 'Auto-pruned shadow topics
» %s', + 'LOG_PRUNE_USER_DEAC' => 'Users deactivated
» %s', + 'LOG_PRUNE_USER_DEL_DEL' => 'Users pruned and posts deleted
» %s', + 'LOG_PRUNE_USER_DEL_ANON' => 'Users pruned and posts retained
» %s', + + 'LOG_PURGE_CACHE' => 'Purged cache', + 'LOG_PURGE_SESSIONS' => 'Purged sessions', + + 'LOG_RANK_ADDED' => 'Added new rank
» %s', + 'LOG_RANK_REMOVED' => 'Removed rank
» %s', + 'LOG_RANK_UPDATED' => 'Updated rank
» %s', + + 'LOG_REASON_ADDED' => 'Added report/denial reason
» %s', + 'LOG_REASON_REMOVED' => 'Removed report/denial reason
» %s', + 'LOG_REASON_UPDATED' => 'Updated report/denial reason
» %s', + + 'LOG_REFERER_INVALID' => 'Referrer validation failed
»Referrer was “%1$s”. The request was rejected and the session killed.', + 'LOG_RESET_DATE' => 'Board start date reset', + 'LOG_RESET_ONLINE' => 'Most users online reset', + 'LOG_RESYNC_FILES_STATS' => 'File statistics resynchronised', + 'LOG_RESYNC_POSTCOUNTS' => 'User post counts resynchronised', + 'LOG_RESYNC_POST_MARKING' => 'Dotted topics resynchronised', + 'LOG_RESYNC_STATS' => 'Post, topic and user statistics resynchronised', + + 'LOG_SEARCH_INDEX_CREATED' => 'Created search index for
» %s', + 'LOG_SEARCH_INDEX_REMOVED' => 'Removed search index for
» %s', + 'LOG_SPHINX_ERROR' => 'Sphinx Error
» %s', + 'LOG_STYLE_ADD' => 'Added new style
» %s', + 'LOG_STYLE_DELETE' => 'Deleted style
» %s', + 'LOG_STYLE_EDIT_DETAILS' => 'Edited style
» %s', + 'LOG_STYLE_EXPORT' => 'Exported style
» %s', + + // @deprecated 3.1 + 'LOG_TEMPLATE_ADD_DB' => 'Added new template set to database
» %s', + // @deprecated 3.1 + 'LOG_TEMPLATE_ADD_FS' => 'Add new template set on filesystem
» %s', + 'LOG_TEMPLATE_CACHE_CLEARED' => 'Deleted cached versions of template files in template set %1$s
» %2$s', + 'LOG_TEMPLATE_DELETE' => 'Deleted template set
» %s', + 'LOG_TEMPLATE_EDIT' => 'Edited template set %1$s
» %2$s', + 'LOG_TEMPLATE_EDIT_DETAILS' => 'Edited template details
» %s', + 'LOG_TEMPLATE_EXPORT' => 'Exported template set
» %s', + // @deprecated 3.1 + 'LOG_TEMPLATE_REFRESHED' => 'Refreshed template set
» %s', + + // @deprecated 3.1 + 'LOG_THEME_ADD_DB' => 'Added new theme to database
» %s', + // @deprecated 3.1 + 'LOG_THEME_ADD_FS' => 'Add new theme on filesystem
» %s', + 'LOG_THEME_DELETE' => 'Theme deleted
» %s', + 'LOG_THEME_EDIT_DETAILS' => 'Edited theme details
» %s', + 'LOG_THEME_EDIT' => 'Edited theme %1$s', + 'LOG_THEME_EDIT_FILE' => 'Edited theme %1$s
» Modified file %2$s', + 'LOG_THEME_EXPORT' => 'Exported theme
» %s', + // @deprecated 3.1 + 'LOG_THEME_REFRESHED' => 'Refreshed theme
» %s', + + 'LOG_UPDATE_DATABASE' => 'Updated Database from version %1$s to version %2$s', + 'LOG_UPDATE_PHPBB' => 'Updated phpBB from version %1$s to version %2$s', + + 'LOG_USER_ACTIVE' => 'User activated
» %s', + 'LOG_USER_BAN_USER' => 'Banned User via user management for reason “%1$s
» %2$s', + 'LOG_USER_BAN_IP' => 'Banned IP via user management for reason “%1$s
» %2$s', + 'LOG_USER_BAN_EMAIL' => 'Banned email via user management for reason “%1$s
» %2$s', + 'LOG_USER_DELETED' => 'Deleted user
» %s', + 'LOG_USER_DEL_ATTACH' => 'Removed all attachments made by the user
» %s', + 'LOG_USER_DEL_AVATAR' => 'Removed user avatar
» %s', + 'LOG_USER_DEL_OUTBOX' => 'Emptied user outbox
» %s', + 'LOG_USER_DEL_POSTS' => 'Removed all posts made by the user
» %s', + 'LOG_USER_DEL_SIG' => 'Removed user signature
» %s', + 'LOG_USER_INACTIVE' => 'User deactivated
» %s', + 'LOG_USER_MOVE_POSTS' => 'Moved user posts
» posts by “%1$s” to forum “%2$s”', + 'LOG_USER_NEW_PASSWORD' => 'Changed user password
» %s', + 'LOG_USER_REACTIVATE' => 'Forced user account reactivation
» %s', + 'LOG_USER_REMOVED_NR' => 'Removed newly registered flag from user
» %s', + + 'LOG_USER_UPDATE_EMAIL' => 'User “%1$s” changed email
» from “%2$s” to “%3$s”', + 'LOG_USER_UPDATE_NAME' => 'Changed username
» from “%1$s” to “%2$s”', + 'LOG_USER_USER_UPDATE' => 'Updated user details
» %s', + + 'LOG_USER_ACTIVE_USER' => 'User account activated', + 'LOG_USER_DEL_AVATAR_USER' => 'User avatar removed', + 'LOG_USER_DEL_SIG_USER' => 'User signature removed', + 'LOG_USER_FEEDBACK' => 'Added user feedback
» %s', + 'LOG_USER_GENERAL' => 'Entry added:
» %s', + 'LOG_USER_INACTIVE_USER' => 'User account de-activated', + 'LOG_USER_LOCK' => 'User locked own topic
» %s', + 'LOG_USER_MOVE_POSTS_USER' => 'Moved all posts to forum» %s', + 'LOG_USER_REACTIVATE_USER' => 'Forced user account reactivation', + 'LOG_USER_UNLOCK' => 'User unlocked own topic
» %s', + 'LOG_USER_WARNING' => 'Added user warning
» %s', + 'LOG_USER_WARNING_BODY' => 'The following warning was issued to this user
» %s', + + 'LOG_USER_GROUP_CHANGE' => 'User changed default group
» %s', + 'LOG_USER_GROUP_DEMOTE' => 'User demoted as leaders from usergroup
» %s', + 'LOG_USER_GROUP_JOIN' => 'User joined group
» %s', + 'LOG_USER_GROUP_JOIN_PENDING' => 'User joined group and needs to be approved
» %s', + 'LOG_USER_GROUP_RESIGN' => 'User resigned membership from group
» %s', + + 'LOG_WARNING_DELETED' => 'Deleted user warning
» %s', + 'LOG_WARNINGS_DELETED' => array( + 1 => 'Deleted user warning
» %1$s', + 2 => 'Deleted %2$d user warnings
» %1$s', // Example: 'Deleted 2 user warnings
» username' + ), + 'LOG_WARNINGS_DELETED_ALL' => 'Deleted all user warnings
» %s', + + 'LOG_WORD_ADD' => 'Added word censor
» %s', + 'LOG_WORD_DELETE' => 'Deleted word censor
» %s', + 'LOG_WORD_EDIT' => 'Edited word censor
» %s', + + 'LOG_EXT_ENABLE' => 'Extension enabled
» %s', + 'LOG_EXT_DISABLE' => 'Extension disabled
» %s', + 'LOG_EXT_PURGE' => 'Extension’s data deleted
» %s', + 'LOG_EXT_UPDATE' => 'Extension updated
» %s', +)); diff --git a/install/update/new/language/en/acp/forums.php b/install/update/new/language/en/acp/forums.php new file mode 100644 index 0000000..3ab1523 --- /dev/null +++ b/install/update/new/language/en/acp/forums.php @@ -0,0 +1,168 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Forum Admin +$lang = array_merge($lang, array( + 'AUTO_PRUNE_DAYS' => 'Auto-prune post age', + 'AUTO_PRUNE_DAYS_EXPLAIN' => 'Number of days since last post after which topic is removed.', + 'AUTO_PRUNE_FREQ' => 'Auto-prune frequency', + 'AUTO_PRUNE_FREQ_EXPLAIN' => 'Time in days between pruning events.', + 'AUTO_PRUNE_VIEWED' => 'Auto-prune post viewed age', + 'AUTO_PRUNE_VIEWED_EXPLAIN' => 'Number of days since topic was viewed after which topic is removed.', + 'AUTO_PRUNE_SHADOW_FREQ' => 'Auto-prune shadow topics frequency', + 'AUTO_PRUNE_SHADOW_DAYS' => 'Auto-prune shadow topics age', + 'AUTO_PRUNE_SHADOW_DAYS_EXPLAIN' => 'Number of days after which shadow topic is removed.', + 'AUTO_PRUNE_SHADOW_FREQ_EXPLAIN' => 'Time in days between pruning events.', + + 'CONTINUE' => 'Continue', + 'COPY_PERMISSIONS' => 'Copy permissions from', + 'COPY_PERMISSIONS_EXPLAIN' => 'To ease up the permission setup for your new forum, you can copy the permissions of an existing forum.', + 'COPY_PERMISSIONS_ADD_EXPLAIN' => 'Once created, the forum will have the same permissions as the one you select here. If no forum is selected the newly created forum will not be visible until permissions had been set.', + 'COPY_PERMISSIONS_EDIT_EXPLAIN' => 'If you select to copy permissions, the forum will have the same permissions as the one you select here. This will overwrite any permissions you have previously set for this forum with the permissions of the forum you select here. If no forum is selected the current permissions will be kept.', + 'COPY_TO_ACL' => 'Alternatively, you are also able to %sset up new permissions%s for this forum.', + 'CREATE_FORUM' => 'Create new forum', + + 'DECIDE_MOVE_DELETE_CONTENT' => 'Delete content or move to forum', + 'DECIDE_MOVE_DELETE_SUBFORUMS' => 'Delete subforums or move to forum', + 'DEFAULT_STYLE' => 'Default style', + 'DELETE_ALL_POSTS' => 'Delete posts', + 'DELETE_SUBFORUMS' => 'Delete subforums and posts', + 'DISPLAY_ACTIVE_TOPICS' => 'Enable active topics', + 'DISPLAY_ACTIVE_TOPICS_EXPLAIN' => 'If set to yes active topics in selected subforums will be displayed under this category.', + + 'EDIT_FORUM' => 'Edit forum', + 'ENABLE_INDEXING' => 'Enable search indexing', + 'ENABLE_INDEXING_EXPLAIN' => 'If set to yes posts made to this forum will be indexed for searching.', + 'ENABLE_POST_REVIEW' => 'Enable post review', + 'ENABLE_POST_REVIEW_EXPLAIN' => 'If set to yes users are able to review their post if new posts were made to the topic while users wrote theirs. This should be disabled for chat forums.', + 'ENABLE_QUICK_REPLY' => 'Enable quick reply', + 'ENABLE_QUICK_REPLY_EXPLAIN' => 'Enables the quick reply in this forum. This setting is not considered if the quick reply is disabled board wide. The quick reply will only be displayed for users who have permission to post in this forum.', + 'ENABLE_RECENT' => 'Display active topics', + 'ENABLE_RECENT_EXPLAIN' => 'If set to yes topics made to this forum will be shown in the active topics list.', + 'ENABLE_TOPIC_ICONS' => 'Enable topic icons', + + 'FORUM_ADMIN' => 'Forum administration', + 'FORUM_ADMIN_EXPLAIN' => 'In phpBB3 everything is forum based. A category is just a special type of forum. Each forum can have an unlimited number of sub-forums and you can determine whether each may be posted to or not (i.e. whether it acts like an old category). Here you can add, edit, delete, lock, unlock individual forums as well as set certain additional controls. If your posts and topics have got out of sync you can also resynchronise a forum. You need to copy or set appropriate permissions for newly created forums to have them displayed.', + 'FORUM_AUTO_PRUNE' => 'Enable auto-pruning', + 'FORUM_AUTO_PRUNE_EXPLAIN' => 'Prunes the forum of topics, set the frequency/age parameters below.', + 'FORUM_CREATED' => 'Forum created successfully.', + 'FORUM_DATA_NEGATIVE' => 'Pruning parameters cannot be negative.', + 'FORUM_DESC_TOO_LONG' => 'The forum description is too long, it must be less than 4000 characters.', + 'FORUM_DELETE' => 'Delete forum', + 'FORUM_DELETE_EXPLAIN' => 'The form below will allow you to delete a forum. If the forum is postable you are able to decide where you want to put all topics (or forums) it contained.', + 'FORUM_DELETED' => 'Forum successfully deleted.', + 'FORUM_DESC' => 'Description', + 'FORUM_DESC_EXPLAIN' => 'Any HTML markup entered here will be displayed as is. If the selected forum type is a category the description is not used.', + 'FORUM_EDIT_EXPLAIN' => 'The form below will allow you to customise this forum. Please note that moderation and post count controls are set via forum permissions for each user or usergroup.', + 'FORUM_IMAGE' => 'Forum image', + 'FORUM_IMAGE_EXPLAIN' => 'Location, relative to the phpBB root directory, of an additional image to associate with this forum.', + 'FORUM_IMAGE_NO_EXIST' => 'The specified forum image does not exist', + 'FORUM_LINK_EXPLAIN' => 'Full URL (including the protocol, i.e.: http://) to the destination location that clicking this forum will take the user, e.g.: http://www.phpbb.com/.', + 'FORUM_LINK_TRACK' => 'Track link redirects', + 'FORUM_LINK_TRACK_EXPLAIN' => 'Records the number of times a forum link was clicked.', + 'FORUM_NAME' => 'Forum name', + 'FORUM_NAME_EMPTY' => 'You must enter a name for this forum.', + 'FORUM_NAME_EMOJI' => 'The forum name you entered is invalid.
It contains the following unsupported characters:
%s', + 'FORUM_PARENT' => 'Parent forum', + 'FORUM_PASSWORD' => 'Forum password', + 'FORUM_PASSWORD_CONFIRM' => 'Confirm forum password', + 'FORUM_PASSWORD_CONFIRM_EXPLAIN' => 'Only needs to be set if a forum password is entered.', + 'FORUM_PASSWORD_EXPLAIN' => 'Defines a password for this forum, use the permission system in preference.', + 'FORUM_PASSWORD_UNSET' => 'Remove forum password', + 'FORUM_PASSWORD_UNSET_EXPLAIN' => 'Check here if you want to remove the forum password.', + 'FORUM_PASSWORD_OLD' => 'The forum password is using an old hashing method and should be changed.', + 'FORUM_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', + 'FORUM_PRUNE_SETTINGS' => 'Forum prune settings', + 'FORUM_PRUNE_SHADOW' => 'Enable auto-pruning of shadow topics', + 'FORUM_PRUNE_SHADOW_EXPLAIN' => 'Prunes the forum of shadow topics, set the frequency/age parameters below.', + 'FORUM_RESYNCED' => 'Forum “%s” successfully resynced', + 'FORUM_RULES_EXPLAIN' => 'Forum rules are displayed at any page within the given forum.', + 'FORUM_RULES_LINK' => 'Link to forum rules', + 'FORUM_RULES_LINK_EXPLAIN' => 'You are able to enter the URL of the page/post containing your forum rules here. This setting will override the forum rules text you specified.', + 'FORUM_RULES_PREVIEW' => 'Forum rules preview', + 'FORUM_RULES_TOO_LONG' => 'The forum rules must be less than 4000 characters.', + 'FORUM_SETTINGS' => 'Forum settings', + 'FORUM_STATUS' => 'Forum status', + 'FORUM_STYLE' => 'Forum style', + 'FORUM_TOPICS_PAGE' => 'Topics per page', + 'FORUM_TOPICS_PAGE_EXPLAIN' => 'If non-zero this value will override the default topics per page setting.', + 'FORUM_TYPE' => 'Forum type', + 'FORUM_UPDATED' => 'Forum information updated successfully.', + + 'FORUM_WITH_SUBFORUMS_NOT_TO_LINK' => 'You want to change a postable forum having subforums to a link. Please move all subforums out of this forum before you proceed, because after changing to a link you are no longer able to see the subforums currently connected to this forum.', + + 'GENERAL_FORUM_SETTINGS' => 'General forum settings', + + 'LINK' => 'Link', + 'LIMIT_SUBFORUMS' => 'Limit legend to direct child-subforums', + 'LIMIT_SUBFORUMS_EXPLAIN' => 'Limits the subforums to be displayed to subforums that are direct descendants (children) of the current forum. Disabling this will display all subforums with the “List subforums in legend” option enabled, regardless of depth.', + 'LIST_INDEX' => 'List subforum in parent-forum’s legend', + 'LIST_INDEX_EXPLAIN' => 'Displays this forum on the index and elsewhere as a link within the legend of its parent-forum if the parent-forum’s “List subforums in legend” option is enabled.', + 'LIST_SUBFORUMS' => 'List subforums in legend', + 'LIST_SUBFORUMS_EXPLAIN' => 'Displays this forum’s subforums on the index and elsewhere as a link within the legend if their “List subforum in parent-forum’s legend” option is enabled.', + 'LOCKED' => 'Locked', + + 'MOVE_POSTS_NO_POSTABLE_FORUM' => 'The forum you selected for moving the posts to is not postable. Please select a postable forum.', + 'MOVE_POSTS_TO' => 'Move posts to', + 'MOVE_SUBFORUMS_TO' => 'Move subforums to', + + 'NO_DESTINATION_FORUM' => 'You have not specified a forum to move content to.', + 'NO_FORUM_ACTION' => 'No action defined for what happens with the forum content.', + 'NO_PARENT' => 'No parent', + 'NO_PERMISSIONS' => 'Do not copy permissions', + 'NO_PERMISSION_FORUM_ADD' => 'You do not have the necessary permissions to add forums.', + 'NO_PERMISSION_FORUM_DELETE' => 'You do not have the necessary permissions to delete forums.', + + 'PARENT_IS_LINK_FORUM' => 'The parent you specified is a forum link. Link forums are not able to hold other forums, please specify a category or forum as the parent forum.', + 'PARENT_NOT_EXIST' => 'Parent does not exist.', + 'PRUNE_ANNOUNCEMENTS' => 'Prune announcements', + 'PRUNE_STICKY' => 'Prune stickies', + 'PRUNE_OLD_POLLS' => 'Prune old polls', + 'PRUNE_OLD_POLLS_EXPLAIN' => 'Removes topics with polls not voted in for post age days.', + + 'REDIRECT_ACL' => 'Now you are able to %sset permissions%s for this forum.', + + 'SYNC_IN_PROGRESS' => 'Synchronizing forum', + 'SYNC_IN_PROGRESS_EXPLAIN' => 'Currently resyncing topic range %1$d/%2$d.', + + 'TYPE_CAT' => 'Category', + 'TYPE_FORUM' => 'Forum', + 'TYPE_LINK' => 'Link', + + 'UNLOCKED' => 'Unlocked', +)); diff --git a/install/update/new/language/en/acp/permissions.php b/install/update/new/language/en/acp/permissions.php new file mode 100644 index 0000000..875e424 --- /dev/null +++ b/install/update/new/language/en/acp/permissions.php @@ -0,0 +1,287 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'ACP_PERMISSIONS_EXPLAIN' => ' +

Permissions are highly granular and grouped into four major sections, which are:

+ +

Global Permissions

+

These are used to control access on a global level and apply to the entire bulletin board. They are further divided into User Permissions, Group Permissions, Administrators and Global Moderators.

+ +

Forum Based Permissions

+

These are used to control access on a per forum basis. They are further divided into Forum Permissions, Forum Moderators, User Forum Permissions and Group Forum Permissions.

+ +

Permission Roles

+

These are used to create different sets of permissions for the different permission types later being able to be assigned on a role-based basis. The default roles should cover the administration of bulletin boards large and small, though within each of the four divisions, you can add/edit/delete roles as you see fit.

+ +

Permission Masks

+

These are used to view the effective permissions assigned to Users, Moderators (Local and Global), Administrators or Forums.

+ +
+ +

For further information on setting up and managing permissions on your phpBB3 board, please see the section on Setting permissions of our Quick Start Guide.

+ ', + + 'ACL_NEVER' => 'Never', + 'ACL_SET' => 'Setting permissions', + 'ACL_SET_EXPLAIN' => 'Permissions are based on a simple YES/NO system. Setting an option to NEVER for a user or usergroup overrides any other value assigned to it. If you do not wish to assign a value for an option for this user or group select NO. If values are assigned for this option elsewhere they will be used in preference, else NEVER is assumed. All objects marked (with the checkbox in front of them) will copy the permission set you defined.', + 'ACL_SETTING' => 'Setting', + + 'ACL_TYPE_A_' => 'Administrative permissions', + 'ACL_TYPE_F_' => 'Forum permissions', + 'ACL_TYPE_M_' => 'Moderative permissions', + 'ACL_TYPE_U_' => 'User permissions', + + 'ACL_TYPE_GLOBAL_A_' => 'Administrative permissions', + 'ACL_TYPE_GLOBAL_U_' => 'User permissions', + 'ACL_TYPE_GLOBAL_M_' => 'Global Moderator permissions', + 'ACL_TYPE_LOCAL_M_' => 'Forum Moderator permissions', + 'ACL_TYPE_LOCAL_F_' => 'Forum permissions', + + 'ACL_NO' => 'No', + 'ACL_VIEW' => 'Viewing permissions', + 'ACL_VIEW_EXPLAIN' => 'Here you can see the effective permissions the user/group is having. A red square indicates that the user/group does not have the permission, a green square indicates that the user/group does have the permission.', + 'ACL_YES' => 'Yes', + + 'ACP_ADMINISTRATORS_EXPLAIN' => 'Here you can assign administrator permissions to users or groups. All users with administrator permissions can view the administration control panel.', + 'ACP_FORUM_MODERATORS_EXPLAIN' => 'Here you can assign users and groups as forum moderators. To assign users access to forums, to define global moderative permissions or administrators please use the appropriate page.', + 'ACP_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can alter which users and groups can access which forums. To assign moderators or define administrators please use the appropriate page.', + 'ACP_FORUM_PERMISSIONS_COPY_EXPLAIN' => 'Here you can copy forum permissions from one forum to one or more other forums.', + 'ACP_GLOBAL_MODERATORS_EXPLAIN' => 'Here you can assign global moderator permissions to users or groups. These moderators are like ordinary moderators except they have access to every forum on your board.', + 'ACP_GROUPS_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can assign forum permissions to groups.', + 'ACP_GROUPS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to groups - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. Individual user permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group permissions.', + 'ACP_ADMIN_ROLES_EXPLAIN' => 'Here you are able to manage the roles for administrative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', + 'ACP_FORUM_ROLES_EXPLAIN' => 'Here you are able to manage the roles for forum permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', + 'ACP_MOD_ROLES_EXPLAIN' => 'Here you are able to manage the roles for moderative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', + 'ACP_USER_ROLES_EXPLAIN' => 'Here you are able to manage the roles for user permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', + 'ACP_USERS_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can assign forum permissions to users.', + 'ACP_USERS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to users - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. To alter these settings for large numbers of users the Group permissions system is the preferred method. User permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group permissions.', + 'ACP_VIEW_ADMIN_PERMISSIONS_EXPLAIN' => 'Here you can view the effective administrative permissions assigned to the selected users/groups.', + 'ACP_VIEW_GLOBAL_MOD_PERMISSIONS_EXPLAIN' => 'Here you can view the global moderative permissions assigned to the selected users/groups.', + 'ACP_VIEW_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can view the forum permissions assigned to the selected users/groups and forums.', + 'ACP_VIEW_FORUM_MOD_PERMISSIONS_EXPLAIN' => 'Here you can view the forum moderator permissions assigned to the selected users/groups and forums.', + 'ACP_VIEW_USER_PERMISSIONS_EXPLAIN' => 'Here you can view the effective user permissions assigned to the selected users/groups.', + + 'ADD_GROUPS' => 'Add groups', + 'ADD_PERMISSIONS' => 'Add permissions', + 'ADD_USERS' => 'Add users', + 'ADVANCED_PERMISSIONS' => 'Advanced Permissions', + 'ALL_GROUPS' => 'Select all groups', + 'ALL_NEVER' => 'All NEVER', + 'ALL_NO' => 'All NO', + 'ALL_USERS' => 'Select all users', + 'ALL_YES' => 'All YES', + 'APPLY_ALL_PERMISSIONS' => 'Apply all permissions', + 'APPLY_PERMISSIONS' => 'Apply permissions', + 'APPLY_PERMISSIONS_EXPLAIN' => 'The permissions and role defined for this item will only be applied to this item and all checked items.', + 'AUTH_UPDATED' => 'Permissions have been updated.', + + 'COPY_PERMISSIONS_CONFIRM' => 'Are you sure you wish to carry out this operation? Please be aware that this will overwrite any existing permissions on the selected targets.', + 'COPY_PERMISSIONS_FORUM_FROM_EXPLAIN' => 'The source forum you want to copy permissions from.', + 'COPY_PERMISSIONS_FORUM_TO_EXPLAIN' => 'The destination forums you want the copied permissions applied to.', + 'COPY_PERMISSIONS_FROM' => 'Copy permissions from', + 'COPY_PERMISSIONS_TO' => 'Apply permissions to', + + 'CREATE_ROLE' => 'Create role', + 'CREATE_ROLE_FROM' => 'Use settings from…', + 'CUSTOM' => 'Custom…', + + 'DEFAULT' => 'Default', + 'DELETE_ROLE' => 'Delete role', + 'DELETE_ROLE_CONFIRM' => 'Are you sure you want to remove this role? Items having this role assigned will not lose their permission settings.', + 'DISPLAY_ROLE_ITEMS' => 'View items using this role', + + 'EDIT_PERMISSIONS' => 'Edit permissions', + 'EDIT_ROLE' => 'Edit role', + + 'GROUPS_NOT_ASSIGNED' => 'No group assigned to this role', + + 'LOOK_UP_GROUP' => 'Look up usergroup', + 'LOOK_UP_USER' => 'Look up user', + + 'MANAGE_GROUPS' => 'Manage groups', + 'MANAGE_USERS' => 'Manage users', + + 'NO_AUTH_SETTING_FOUND' => 'Permission settings not defined.', + 'NO_ROLE_ASSIGNED' => 'No role assigned…', + 'NO_ROLE_ASSIGNED_EXPLAIN' => 'Setting to this role does not change permissions on the right. If you want to unset/remove all permissions you should use the “All NO” link.', + 'NO_ROLE_AVAILABLE' => 'No role available', + 'NO_ROLE_NAME_SPECIFIED' => 'Please give the role a name.', + 'NO_ROLE_SELECTED' => 'Role could not be found.', + 'NO_USER_GROUP_SELECTED' => 'You haven’t selected any user or group.', + + 'ONLY_FORUM_DEFINED' => 'You only defined forums in your selection. Please also select at least one user or one group.', + + 'PERMISSION_APPLIED_TO_ALL' => 'Permissions and role will also be applied to all checked objects', + 'PLUS_SUBFORUMS' => '+Subforums', + + 'REMOVE_PERMISSIONS' => 'Remove permissions', + 'REMOVE_ROLE' => 'Remove role', + 'RESULTING_PERMISSION' => 'Resulting permission', + 'ROLE' => 'Role', + 'ROLE_ADD_SUCCESS' => 'Role successfully added.', + 'ROLE_ASSIGNED_TO' => 'Users/Groups assigned to %s', + 'ROLE_DELETED' => 'Role successfully removed.', + 'ROLE_DESCRIPTION' => 'Role description', + + 'ROLE_ADMIN_FORUM' => 'Forum Admin', + 'ROLE_ADMIN_FULL' => 'Full Admin', + 'ROLE_ADMIN_STANDARD' => 'Standard Admin', + 'ROLE_ADMIN_USERGROUP' => 'User and Groups Admin', + 'ROLE_FORUM_BOT' => 'Bot Access', + 'ROLE_FORUM_FULL' => 'Full Access', + 'ROLE_FORUM_LIMITED' => 'Limited Access', + 'ROLE_FORUM_LIMITED_POLLS' => 'Limited Access + Polls', + 'ROLE_FORUM_NOACCESS' => 'No Access', + 'ROLE_FORUM_ONQUEUE' => 'On Moderation Queue', + 'ROLE_FORUM_POLLS' => 'Standard Access + Polls', + 'ROLE_FORUM_READONLY' => 'Read Only Access', + 'ROLE_FORUM_STANDARD' => 'Standard Access', + 'ROLE_FORUM_NEW_MEMBER' => 'Newly Registered User Access', + 'ROLE_MOD_FULL' => 'Full Moderator', + 'ROLE_MOD_QUEUE' => 'Queue Moderator', + 'ROLE_MOD_SIMPLE' => 'Simple Moderator', + 'ROLE_MOD_STANDARD' => 'Standard Moderator', + 'ROLE_USER_FULL' => 'All Features', + 'ROLE_USER_LIMITED' => 'Limited Features', + 'ROLE_USER_NOAVATAR' => 'No Avatar', + 'ROLE_USER_NOPM' => 'No Private Messages', + 'ROLE_USER_STANDARD' => 'Standard Features', + 'ROLE_USER_NEW_MEMBER' => 'Newly Registered User Features', + + 'ROLE_DESCRIPTION_ADMIN_FORUM' => 'Can access the forum management and forum permission settings.', + 'ROLE_DESCRIPTION_ADMIN_FULL' => 'Has access to all administrative functions of this board.
Not recommended.', + 'ROLE_DESCRIPTION_ADMIN_STANDARD' => 'Has access to most administrative features but is not allowed to use server or system related tools.', + 'ROLE_DESCRIPTION_ADMIN_USERGROUP' => 'Can manage groups and users: Able to change permissions, settings, manage bans, and manage ranks.', + 'ROLE_DESCRIPTION_FORUM_BOT' => 'This role is recommended for bots and search spiders.', + 'ROLE_DESCRIPTION_FORUM_FULL' => 'Can use all forum features, including posting of announcements and stickies. Can also ignore the flood limit.
Not recommended for normal users.', + 'ROLE_DESCRIPTION_FORUM_LIMITED' => 'Can use some forum features, but cannot attach files or use post icons.', + 'ROLE_DESCRIPTION_FORUM_LIMITED_POLLS' => 'As per Limited Access but can also create polls.', + 'ROLE_DESCRIPTION_FORUM_NOACCESS' => 'Can neither see nor access the forum.', + 'ROLE_DESCRIPTION_FORUM_ONQUEUE' => 'Can use most forum features including attachments, but posts and topics need to be approved by a moderator.', + 'ROLE_DESCRIPTION_FORUM_POLLS' => 'Like Standard Access but can also create polls.', + 'ROLE_DESCRIPTION_FORUM_READONLY' => 'Can read the forum, but cannot create new topics or reply to posts.', + 'ROLE_DESCRIPTION_FORUM_STANDARD' => 'Can use most forum features including attachments and deleting own topics, but cannot lock own topics, and cannot create polls.', + 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains NEVER permissions to lock features for new users.', + 'ROLE_DESCRIPTION_MOD_FULL' => 'Can use all moderating features, including banning.', + 'ROLE_DESCRIPTION_MOD_QUEUE' => 'Can use the Moderation Queue to validate and edit posts, but nothing else.', + 'ROLE_DESCRIPTION_MOD_SIMPLE' => 'Can only use basic topic actions. Cannot send warnings or use moderation queue.', + 'ROLE_DESCRIPTION_MOD_STANDARD' => 'Can use most moderating tools, but cannot ban users or change the post author.', + 'ROLE_DESCRIPTION_USER_FULL' => 'Can use all available forum features for users, including changing the user name or ignoring the flood limit.
Not recommended.', + 'ROLE_DESCRIPTION_USER_LIMITED' => 'Can access some of the user features. Attachments, emails, or instant messages are not allowed.', + 'ROLE_DESCRIPTION_USER_NOAVATAR' => 'Has a limited feature set and is not allowed to use the Avatar feature.', + 'ROLE_DESCRIPTION_USER_NOPM' => 'Has a limited feature set, and is not allowed to use Private Messages.', + 'ROLE_DESCRIPTION_USER_STANDARD' => 'Can access most but not all user features. Cannot change user name or ignore the flood limit, for instance.', + 'ROLE_DESCRIPTION_USER_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains NEVER permissions to lock features for new users.', + + 'ROLE_DESCRIPTION_EXPLAIN' => 'You are able to enter a short explanation of what the role is doing or for what it is meant for. The text you enter here will be displayed within the permissions screens too.', + 'ROLE_DESCRIPTION_LONG' => 'The role description is too long, please limit it to 4000 characters.', + 'ROLE_DETAILS' => 'Role details', + 'ROLE_EDIT_SUCCESS' => 'Role successfully edited.', + 'ROLE_NAME' => 'Role name', + 'ROLE_NAME_ALREADY_EXIST' => 'A role named %s already exist for the specified permission type.', + 'ROLE_NOT_ASSIGNED' => 'Role has not been assigned yet.', + + 'SELECTED_FORUM_NOT_EXIST' => 'The selected forum(s) do not exist.', + 'SELECTED_GROUP_NOT_EXIST' => 'The selected group(s) do not exist.', + 'SELECTED_USER_NOT_EXIST' => 'The selected user(s) do not exist.', + 'SELECT_FORUM_SUBFORUM_EXPLAIN' => 'The forum you select here will include all subforums into the selection.', + 'SELECT_ROLE' => 'Select role…', + 'SELECT_TYPE' => 'Select type', + 'SET_PERMISSIONS' => 'Set permissions', + 'SET_ROLE_PERMISSIONS' => 'Set role permissions', + 'SET_USERS_PERMISSIONS' => 'Set user permissions', + 'SET_USERS_FORUM_PERMISSIONS' => 'Set user forum permissions', + + 'TRACE_DEFAULT' => 'By default every permission is NO (unset). So the permission can be overwritten by other settings.', + 'TRACE_FOR' => 'Trace for', + 'TRACE_GLOBAL_SETTING' => '%s (global)', + 'TRACE_GROUP_NEVER_TOTAL_NEVER' => 'This group’s permission is set to NEVER like the total result so the old result is kept.', + 'TRACE_GROUP_NEVER_TOTAL_NEVER_LOCAL' => 'This group’s permission for this forum is set to NEVER like the total result so the old result is kept.', + 'TRACE_GROUP_NEVER_TOTAL_NO' => 'This group’s permission is set to NEVER which becomes the new total value because it wasn’t set yet (set to NO).', + 'TRACE_GROUP_NEVER_TOTAL_NO_LOCAL' => 'This group’s permission for this forum is set to NEVER which becomes the new total value because it wasn’t set yet (set to NO).', + 'TRACE_GROUP_NEVER_TOTAL_YES' => 'This group’s permission is set to NEVER which overwrites the total YES to a NEVER for this user.', + 'TRACE_GROUP_NEVER_TOTAL_YES_LOCAL' => 'This group’s permission for this forum is set to NEVER which overwrites the total YES to a NEVER for this user.', + 'TRACE_GROUP_NO' => 'The permission is NO for this group so the old total value is kept.', + 'TRACE_GROUP_NO_LOCAL' => 'The permission is NO for this group within this forum so the old total value is kept.', + 'TRACE_GROUP_YES_TOTAL_NEVER' => 'This group’s permission is set to YES but the total NEVER cannot be overwritten.', + 'TRACE_GROUP_YES_TOTAL_NEVER_LOCAL' => 'This group’s permission for this forum is set to YES but the total NEVER cannot be overwritten.', + 'TRACE_GROUP_YES_TOTAL_NO' => 'This group’s permission is set to YES which becomes the new total value because it wasn’t set yet (set to NO).', + 'TRACE_GROUP_YES_TOTAL_NO_LOCAL' => 'This group’s permission for this forum is set to YES which becomes the new total value because it wasn’t set yet (set to NO).', + 'TRACE_GROUP_YES_TOTAL_YES' => 'This group’s permission is set to YES and the total permission is already set to YES, so the total result is kept.', + 'TRACE_GROUP_YES_TOTAL_YES_LOCAL' => 'This group’s permission for this forum is set to YES and the total permission is already set to YES, so the total result is kept.', + 'TRACE_PERMISSION' => 'Trace permission - %s', + 'TRACE_RESULT' => 'Trace result', + 'TRACE_SETTING' => 'Trace setting', + + 'TRACE_USER_GLOBAL_YES_TOTAL_YES' => 'The forum independent user permission evaluates to YES but the total permission is already set to YES, so the total result is kept. %sTrace global permission%s', + 'TRACE_USER_GLOBAL_YES_TOTAL_NEVER' => 'The forum independent user permission evaluates to YES which overwrites the current local result NEVER. %sTrace global permission%s', + 'TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT' => 'The forum independent user permission evaluates to NEVER which doesn’t influence the local permission. %sTrace global permission%s', + + 'TRACE_USER_FOUNDER' => 'The user is a founder, therefore admin permissions are always set to YES.', + 'TRACE_USER_KEPT' => 'The user’s permission is NO so the old total value is kept.', + 'TRACE_USER_KEPT_LOCAL' => 'The user’s permission for this forum is NO so the old total value is kept.', + 'TRACE_USER_NEVER_TOTAL_NEVER' => 'The user’s permission is set to NEVER and the total value is set to NEVER, so nothing is changed.', + 'TRACE_USER_NEVER_TOTAL_NEVER_LOCAL' => 'The user’s permission for this forum is set to NEVER and the total value is set to NEVER, so nothing is changed.', + 'TRACE_USER_NEVER_TOTAL_NO' => 'The user’s permission is set to NEVER which becomes the total value because it was set to NO.', + 'TRACE_USER_NEVER_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is set to NEVER which becomes the total value because it was set to NO.', + 'TRACE_USER_NEVER_TOTAL_YES' => 'The user’s permission is set to NEVER and overwrites the previous YES.', + 'TRACE_USER_NEVER_TOTAL_YES_LOCAL' => 'The user’s permission for this forum is set to NEVER and overwrites the previous YES.', + 'TRACE_USER_NO_TOTAL_NO' => 'The user’s permission is NO and the total value was set to NO so it defaults to NEVER.', + 'TRACE_USER_NO_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is NO and the total value was set to NO so it defaults to NEVER.', + 'TRACE_USER_YES_TOTAL_NEVER' => 'The user’s permission is set to YES but the total NEVER cannot be overwritten.', + 'TRACE_USER_YES_TOTAL_NEVER_LOCAL' => 'The user’s permission for this forum is set to YES but the total NEVER cannot be overwritten.', + 'TRACE_USER_YES_TOTAL_NO' => 'The user’s permission is set to YES which becomes the total value because it was set to NO.', + 'TRACE_USER_YES_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is set to YES which becomes the total value because it was set to NO.', + 'TRACE_USER_YES_TOTAL_YES' => 'The user’s permission is set to YES and the total value is set to YES, so nothing is changed.', + 'TRACE_USER_YES_TOTAL_YES_LOCAL' => 'The user’s permission for this forum is set to YES and the total value is set to YES, so nothing is changed.', + 'TRACE_WHO' => 'Who', + 'TRACE_TOTAL' => 'Total', + + 'USERS_NOT_ASSIGNED' => 'No users are assigned to this role', + 'USER_IS_MEMBER_OF_DEFAULT' => 'is a member of the following pre-defined groups', + 'USER_IS_MEMBER_OF_CUSTOM' => 'is a member of the following user defined groups', + + 'VIEW_ASSIGNED_ITEMS' => 'View assigned items', + 'VIEW_LOCAL_PERMS' => 'Local permissions', + 'VIEW_GLOBAL_PERMS' => 'Global permissions', + 'VIEW_PERMISSIONS' => 'View permissions', + + 'WRONG_PERMISSION_TYPE' => 'Wrong permission type selected.', + 'WRONG_PERMISSION_SETTING_FORMAT' => 'The permission settings are in a wrong format, phpBB is not able to process them correctly.', +)); diff --git a/install/update/new/language/en/acp/permissions_phpbb.php b/install/update/new/language/en/acp/permissions_phpbb.php new file mode 100644 index 0000000..ab89399 --- /dev/null +++ b/install/update/new/language/en/acp/permissions_phpbb.php @@ -0,0 +1,215 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +/** +* EXTENSION-DEVELOPERS PLEASE NOTE +* +* 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. +*/ + +$lang = array_merge($lang, array( + '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' => '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_EMOJI' => 'Can use emoji and rich text characters in topic title', + + 'ACL_U_SENDPM' => 'Can send private messages', + 'ACL_U_MASSPM' => 'Can send private messages to multiple users', + 'ACL_U_MASSPM_GROUP'=> 'Can send private 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' => 'Can see forum', + 'ACL_F_LIST_TOPICS' => 'Can see topics', + '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_ANNOUNCE_GLOBAL' => 'Can post global 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
Moderators, who have the approve posts permission, can restore soft deleted posts.', + 'ACL_F_IGNOREFLOOD' => 'Can ignore flood limit', + 'ACL_F_POSTCOUNT' => 'Increment post counter
Please note that this setting only affects new posts.', + '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' => 'Can edit posts', + 'ACL_M_DELETE' => 'Can permanently delete posts', + 'ACL_M_SOFTDELETE' => 'Can soft delete posts
Moderators, who have the approve posts permission, can restore soft deleted posts.', + 'ACL_M_APPROVE' => 'Can approve and restore 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
This setting is only assigned globally. It is not forum based.', // This moderator setting is only global (and not local) + 'ACL_M_PM_REPORT' => 'Can close and delete reports of private messages
This setting is only assigned globally. It is not forum based.', // This moderator setting is only global (and not local) + 'ACL_M_BAN' => 'Can manage bans
This setting is only assigned globally. It is not forum based.', // This moderator setting is only global (and not local) +)); + +// Admin Permissions +$lang = array_merge($lang, array( + '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
This also includes seeing the users browser agent within the viewonline list.', + '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/install/update/new/language/en/acp/posting.php b/install/update/new/language/en/acp/posting.php new file mode 100644 index 0000000..3bff6b9 --- /dev/null +++ b/install/update/new/language/en/acp/posting.php @@ -0,0 +1,291 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// BBCodes +// Note to translators: you can translate everything but what's between { and } +$lang = array_merge($lang, array( + 'ACP_BBCODES_EXPLAIN' => 'BBCode is a special implementation of HTML offering greater control over what and how something is displayed. From this page you can add, remove and edit custom BBCodes.', + 'ADD_BBCODE' => 'Add a new BBCode', + + 'BBCODE_DANGER' => 'The BBCode you are trying to add seems unsafe. If the BBCode uses a {TEXT} token in a sensitive context, try using a more restrictive type instead. Only proceed if you understand the risks involved.', + 'BBCODE_DANGER_PROCEED' => 'Proceed', //'I understand the risk', + + 'BBCODE_ADDED' => 'BBCode added successfully.', + 'BBCODE_EDITED' => 'BBCode edited successfully.', + 'BBCODE_DELETED' => 'The BBCode has been removed successfully.', + 'BBCODE_NOT_EXIST' => 'The BBCode you selected does not exist.', + 'BBCODE_HELPLINE' => 'Help line', + 'BBCODE_HELPLINE_EXPLAIN' => 'This field contains the mouse over text of the BBCode.', + 'BBCODE_HELPLINE_TEXT' => 'Help line text', + 'BBCODE_HELPLINE_TOO_LONG' => 'The help line you entered is too long.', + + 'BBCODE_INVALID_TAG_NAME' => 'The BBCode tag name that you selected already exists.', + 'BBCODE_INVALID' => 'Your BBCode is constructed in an invalid form.', + 'BBCODE_INVALID_TEMPLATE' => 'Your BBCode’s template is invalid.', + 'BBCODE_TAG' => 'Tag', + 'BBCODE_TAG_TOO_LONG' => 'The tag name you selected is too long.', + 'BBCODE_TAG_DEF_TOO_LONG' => 'The tag definition that you have entered is too long, please shorten your tag definition.', + 'BBCODE_USAGE' => 'BBCode usage', + 'BBCODE_USAGE_EXAMPLE' => '[highlight={COLOR}]{TEXT}[/highlight]

[font={SIMPLETEXT1}]{SIMPLETEXT2}[/font]', + 'BBCODE_USAGE_EXPLAIN' => 'Here you define how to use the BBCode. Replace any variable input by the corresponding token (%ssee below%s).', + + 'EXAMPLE' => 'Example:', + 'EXAMPLES' => 'Examples:', + + 'HTML_REPLACEMENT' => 'HTML replacement', + 'HTML_REPLACEMENT_EXAMPLE' => '<span style="background-color: {COLOR};">{TEXT}</span>

<span style="font-family: {SIMPLETEXT1};">{SIMPLETEXT2}</span>', + 'HTML_REPLACEMENT_EXPLAIN' => 'Here you define the default HTML replacement. Do not forget to put back tokens you used above!', + + 'TOKEN' => 'Token', + 'TOKENS' => 'Tokens', + 'TOKENS_EXPLAIN' => 'Tokens are placeholders for user input. The input will be validated only if it matches the corresponding definition. If needed, you can number them by adding a number as the last character between the braces, e.g. {TEXT1}, {TEXT2}.

Within the HTML replacement you can also use any language string present in your language/ directory like this: {L_<STRINGNAME>} where <STRINGNAME> is the name of the translated string you want to add. For example, {L_WROTE} will be displayed as “wrote” or its translation according to user’s locale.

Please note that only tokens listed below are able to be used within custom BBCodes.', + 'TOKEN_DEFINITION' => 'What can it be?', + 'TOO_MANY_BBCODES' => 'You cannot create any more BBCodes. Please remove one or more BBCodes then try again.', + + 'tokens' => array( + 'TEXT' => 'Any text, including foreign characters, numbers, etc…', + 'SIMPLETEXT' => 'Characters from the latin alphabet (A-Z), numbers, spaces, commas, dots, minus, plus, hyphen and underscore', + 'INTTEXT' => 'Unicode letter characters, numbers, spaces, commas, dots, minus, plus, hyphen, underscore and whitespaces.', + 'IDENTIFIER' => 'Characters from the latin alphabet (A-Z), numbers, hyphen and underscore', + 'NUMBER' => 'Any series of digits', + 'EMAIL' => 'A valid email address', + 'URL' => 'A valid URL using any allowed protocol (http, ftp, etc… cannot be used for javascript exploits). If none is given, “http://” is prefixed to the string.', + 'LOCAL_URL' => 'A local URL. The URL must be relative to the topic page and cannot contain a server name or protocol, as links are prefixed with “%s”', + 'RELATIVE_URL' => 'A relative URL. You can use this to match parts of a URL, but be careful: a full URL is a valid relative URL. When you want to use relative URLs of your board, use the LOCAL_URL token.', + 'COLOR' => 'A HTML colour, can be either in the numeric form #FF1234 or a CSS colour keyword such as fuchsia or InactiveBorder', + ), +)); + +// Smilies and topic icons +$lang = array_merge($lang, array( + 'ACP_ICONS_EXPLAIN' => 'From this page you can add, remove and edit the icons users may add to their topics or posts. These icons are generally displayed next to topic titles on the forum listing, or the post subjects in topic listings. You can also install and create new packages of icons.', + 'ACP_SMILIES_EXPLAIN' => 'Smilies or emoticons are typically small, sometimes animated images used to convey an emotion or feeling. From this page you can add, remove and edit the emoticons users can use in their posts and private messages. You can also install and create new packages of smilies.', + 'ADD_SMILIES' => 'Add multiple smilies', + 'ADD_SMILEY_CODE' => 'Add additional smiley code', + 'ADD_ICONS' => 'Add multiple icons', + 'AFTER_ICONS' => 'After %s', + 'AFTER_SMILIES' => 'After %s', + + 'CODE' => 'Code', + 'CURRENT_ICONS' => 'Current icons', + 'CURRENT_ICONS_EXPLAIN' => 'Choose what to do with the currently installed icons.', + 'CURRENT_SMILIES' => 'Current smilies', + 'CURRENT_SMILIES_EXPLAIN' => 'Choose what to do with the currently installed smilies.', + + 'DISPLAY_ON_POSTING' => 'Display on posting page', + 'DISPLAY_POSTING' => 'On posting page', + 'DISPLAY_POSTING_NO' => 'Not on posting page', + + 'EDIT_ICONS' => 'Edit icons', + 'EDIT_SMILIES' => 'Edit smilies', + 'EMOTION' => 'Emotion', + 'EXPORT_ICONS' => 'Export and download icons.pak', + 'EXPORT_ICONS_EXPLAIN' => '%sOn clicking this link, the configuration for your installed icons will be packaged into icons.pak which once downloaded can be used to create a .zip or .tgz file containing all of your icons plus this icons.pak configuration file%s.', + 'EXPORT_SMILIES' => 'Export and download smilies.pak', + 'EXPORT_SMILIES_EXPLAIN' => '%sOn clicking this link, the configuration for your installed smilies will be packaged into smilies.pak which once downloaded can be used to create a .zip or .tgz file containing all of your smilies plus this smilies.pak configuration file%s.', + + 'FIRST' => 'First', + + 'ICONS_ADD' => 'Add a new icon', + 'ICONS_ADDED' => array( + 0 => 'No icons were added.', + 1 => 'The icon has been added successfully.', + 2 => 'The icons have been added successfully.', + ), + 'ICONS_CONFIG' => 'Icon configuration', + 'ICONS_DELETED' => 'The icon has been removed successfully.', + 'ICONS_EDIT' => 'Edit icon', + 'ICONS_EDITED' => array( + 0 => 'No icons were updated.', + 1 => 'The icon has been updated successfully.', + 2 => 'The icons have been updated successfully.', + ), + 'ICONS_HEIGHT' => 'Icon height', + 'ICONS_IMAGE' => 'Icon image', + 'ICONS_IMPORTED' => 'The icons pack has been installed successfully.', + 'ICONS_IMPORT_SUCCESS' => 'The icons pack was imported successfully.', + 'ICONS_LOCATION' => 'Icon location', + 'ICONS_NOT_DISPLAYED' => 'The following icons are not displayed on the posting page', + 'ICONS_ORDER' => 'Icon order', + 'ICONS_URL' => 'Icon image file', + 'ICONS_WIDTH' => 'Icon width', + 'IMPORT_ICONS' => 'Install icons package', + 'IMPORT_SMILIES' => 'Install smilies package', + + 'KEEP_ALL' => 'Keep all', + + 'MASS_ADD_SMILIES' => 'Add multiple smilies', + + 'NO_ICONS_ADD' => 'There are no icons available for adding.', + 'NO_ICONS_EDIT' => 'There are no icons available for modifying.', + 'NO_ICONS_EXPORT' => 'You have no icons with which to create a package.', + 'NO_ICONS_PAK' => 'No icon packages found.', + 'NO_SMILIES_ADD' => 'There are no smilies available for adding.', + 'NO_SMILIES_EDIT' => 'There are no smilies available for modifying.', + 'NO_SMILIES_EXPORT' => 'You have no smilies with which to create a package.', + 'NO_SMILIES_PAK' => 'No smiley packages found.', + + 'PAK_FILE_NOT_READABLE' => 'Could not read .pak file.', + + 'REPLACE_MATCHES' => 'Replace matches', + + 'SELECT_PACKAGE' => 'Select a package file', + 'SMILIES_ADD' => 'Add a new smiley', + 'SMILIES_ADDED' => array( + 0 => 'No smilies were added.', + 1 => 'The smiley has been added successfully.', + 2 => 'The smilies have been added successfully.', + ), + 'SMILIES_CODE' => 'Smiley code', + 'SMILIES_CONFIG' => 'Smiley configuration', + 'SMILIES_DELETED' => 'The smiley has been removed successfully.', + 'SMILIES_EDIT' => 'Edit smiley', + 'SMILIE_NO_CODE' => 'The smiley “%s” was ignored, as there was no code entered.', + 'SMILIE_NO_EMOTION' => 'The smiley “%s” was ignored, as there was no emotion entered.', + 'SMILIE_NO_FILE' => 'The smiley “%s” was ignored, as the file is missing.', + 'SMILIES_EDITED' => array( + 0 => 'No smilies were updated.', + 1 => 'The smiley has been updated successfully.', + 2 => 'The smilies have been updated successfully.', + ), + 'SMILIES_EMOTION' => 'Emotion', + 'SMILIES_HEIGHT' => 'Smiley height', + 'SMILIES_IMAGE' => 'Smiley image', + 'SMILIES_IMPORTED' => 'The smilies pack has been installed successfully.', + 'SMILIES_IMPORT_SUCCESS' => 'The smilies pack was imported successfully.', + 'SMILIES_LOCATION' => 'Smiley location', + 'SMILIES_NOT_DISPLAYED' => 'The following smilies are not displayed on the posting page', + 'SMILIES_ORDER' => 'Smiley order', + 'SMILIES_URL' => 'Smiley image file', + 'SMILIES_WIDTH' => 'Smiley width', + + 'TOO_MANY_SMILIES' => array( + 1 => 'Limit of %d smiley reached.', + 2 => 'Limit of %d smilies reached.', + ), + + 'WRONG_PAK_TYPE' => 'The specified package does not contain the appropriate data.', +)); + +// Word censors +$lang = array_merge($lang, array( + 'ACP_WORDS_EXPLAIN' => 'From this control panel you can add, edit, and remove words that will be automatically censored on your forums. People are still allowed to register with usernames containing these words. Wildcards (*) are accepted in the word field, e.g. *test* will match detestable, test* would match testing, *test would match detest.', + 'ADD_WORD' => 'Add new word', + + 'EDIT_WORD' => 'Edit word censor', + 'ENTER_WORD' => 'You must enter a word and its replacement.', + + 'NO_WORD' => 'No word selected for editing.', + + 'REPLACEMENT' => 'Replacement', + + 'UPDATE_WORD' => 'Update word censor', + + 'WORD' => 'Word', + 'WORD_ADDED' => 'The word censor has been successfully added.', + 'WORD_REMOVED' => 'The selected word censor has been successfully removed.', + 'WORD_UPDATED' => 'The selected word censor has been successfully updated.', +)); + +// Ranks +$lang = array_merge($lang, array( + 'ACP_RANKS_EXPLAIN' => 'Using this form you can add, edit, view and delete ranks. You can also create special ranks which can be applied to a user via the user management facility.', + 'ADD_RANK' => 'Add new rank', + + 'MUST_SELECT_RANK' => 'You must select a rank.', + + 'NO_ASSIGNED_RANK' => 'No special rank assigned.', + 'NO_RANK_TITLE' => 'You haven’t specified a title for the rank.', + 'NO_UPDATE_RANKS' => 'The rank was successfully deleted. However user accounts using this rank were not updated. You will need to manually reset the rank on these accounts.', + + 'RANK_ADDED' => 'The rank was successfully added.', + 'RANK_IMAGE' => 'Rank image', + 'RANK_IMAGE_EXPLAIN' => 'Use this to define a small image associated with the rank. The path is relative to the root phpBB directory.', + 'RANK_IMAGE_IN_USE' => '(In use)', + 'RANK_MINIMUM' => 'Minimum posts', + 'RANK_REMOVED' => 'The rank was successfully deleted.', + 'RANK_SPECIAL' => 'Set as special rank', + 'RANK_TITLE' => 'Rank title', + 'RANK_UPDATED' => 'The rank was successfully updated.', +)); + +// Disallow Usernames +$lang = array_merge($lang, array( + 'ACP_DISALLOW_EXPLAIN' => 'Here you can control usernames which will not be allowed to be used. Disallowed usernames are allowed to contain a wildcard character of *.', + 'ADD_DISALLOW_EXPLAIN' => 'You can disallow a username using the wildcard character * to match any character.', + 'ADD_DISALLOW_TITLE' => 'Add a disallowed username', + + 'DELETE_DISALLOW_EXPLAIN' => 'You can remove a disallowed username by selecting the username from this list and clicking submit.', + 'DELETE_DISALLOW_TITLE' => 'Remove a disallowed username', + 'DISALLOWED_ALREADY' => 'The name you entered is already disallowed.', + 'DISALLOWED_DELETED' => 'The disallowed username has been successfully removed.', + 'DISALLOW_SUCCESSFUL' => 'The disallowed username has been successfully added.', + + 'NO_DISALLOWED' => 'No disallowed usernames', + 'NO_USERNAME_SPECIFIED' => 'You haven’t selected or entered a username to operate with.', +)); + +// Reasons +$lang = array_merge($lang, array( + 'ACP_REASONS_EXPLAIN' => 'Here you can manage the reasons used in reports and denial messages when disapproving posts. There is one default reason (marked with a *) you are not able to remove, this reason is normally used for custom messages if no reason fits.', + 'ADD_NEW_REASON' => 'Add new reason', + 'AVAILABLE_TITLES' => 'Available localised reason titles', + + 'IS_NOT_TRANSLATED' => 'Reason has not been localised.', + 'IS_NOT_TRANSLATED_EXPLAIN' => 'Reason has not been localised. If you want to provide the localised form, specify the correct key from the language files report reasons section.', + 'IS_TRANSLATED' => 'Reason has been localised.', + 'IS_TRANSLATED_EXPLAIN' => 'Reason has been localised. If the title you enter here is specified within the language files report reasons section, the localised form of the title and description will be used.', + + 'NO_REASON' => 'Reason could not be found.', + 'NO_REASON_INFO' => 'You have to specify a title and a description for this reason.', + 'NO_REMOVE_DEFAULT_REASON' => 'You are not able to remove the default reason “Other”.', + + 'REASON_ADD' => 'Add report/denial reason', + 'REASON_ADDED' => 'Report/denial reason successfully added.', + 'REASON_ALREADY_EXIST' => 'A reason with this title already exist, please enter another title for this reason.', + 'REASON_DESCRIPTION' => 'Reason description', + 'REASON_DESC_TRANSLATED' => 'Displayed reason description', + 'REASON_EDIT' => 'Edit report/denial reason', + 'REASON_EDIT_EXPLAIN' => 'Here you are able to add or edit a reason. If the reason is translated the localised version is used instead of the description entered here.', + 'REASON_REMOVED' => 'Report/denial reason successfully removed.', + 'REASON_TITLE' => 'Reason title', + 'REASON_TITLE_TRANSLATED' => 'Displayed reason title', + 'REASON_UPDATED' => 'Report/denial reason successfully updated.', + + 'USED_IN_REPORTS' => 'Used in reports', +)); diff --git a/install/update/new/language/en/acp/profile.php b/install/update/new/language/en/acp/profile.php new file mode 100644 index 0000000..87c9505 --- /dev/null +++ b/install/update/new/language/en/acp/profile.php @@ -0,0 +1,176 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Custom profile fields +$lang = array_merge($lang, array( + 'ADDED_PROFILE_FIELD' => 'Successfully added custom profile field.', + 'ALPHA_DOTS' => 'Alphanumeric and dots (periods)', + 'ALPHA_ONLY' => 'Alphanumeric only', + 'ALPHA_SPACERS' => 'Alphanumeric and spacers', + 'ALPHA_UNDERSCORE' => 'Alphanumeric and underscores', + 'ALPHA_PUNCTUATION' => 'Alphanumeric with comma, dots, underscore and dashes beginning with a letter', + 'ALWAYS_TODAY' => 'Always the current date', + + 'BOOL_ENTRIES_EXPLAIN' => 'Enter your options now', + 'BOOL_TYPE_EXPLAIN' => 'Define the type, either a checkbox or radio buttons. A checkbox will only be displayed if it is checked for a given user. In that case the second language option will be used. Radio buttons will display regardless of their value.', + + 'CHANGED_PROFILE_FIELD' => 'Successfully changed profile field.', + 'CHARS_ANY' => 'Any character', + 'CHECKBOX' => 'Checkbox', + 'COLUMNS' => 'Columns', + 'CP_LANG_DEFAULT_VALUE' => 'Default value', + 'CP_LANG_EXPLAIN' => 'Field description', + 'CP_LANG_EXPLAIN_EXPLAIN' => 'The explanation for this field presented to the user.', + 'CP_LANG_NAME' => 'Field name/title presented to the user', + 'CP_LANG_OPTIONS' => 'Options', + 'CREATE_NEW_FIELD' => 'Create new field', + 'CUSTOM_FIELDS_NOT_TRANSLATED' => 'At least one custom profile field has not yet been translated. Please enter the required information by clicking on the “Translate” link.', + + 'DEFAULT_ISO_LANGUAGE' => 'Default language [%s]', + 'DEFAULT_LANGUAGE_NOT_FILLED' => 'The language entries for the default language are not filled for this profile field.', + 'DEFAULT_VALUE' => 'Default value', + 'DELETE_PROFILE_FIELD' => 'Remove profile field', + 'DELETE_PROFILE_FIELD_CONFIRM' => 'Are you sure you want to delete this profile field?', + 'DISPLAY_AT_PROFILE' => 'Display in user control panel', + 'DISPLAY_AT_PROFILE_EXPLAIN' => 'The user is able to change this profile field within the user control panel.', + 'DISPLAY_AT_REGISTER' => 'Display on registration screen', + 'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration.', + 'DISPLAY_ON_MEMBERLIST' => 'Display on memberlist screen', + 'DISPLAY_ON_MEMBERLIST_EXPLAIN' => 'If this option is enabled, the field will be displayed in the user rows on the memberlist screen.', + 'DISPLAY_ON_PM' => 'Display on view private message screen', + 'DISPLAY_ON_PM_EXPLAIN' => 'If this option is enabled, the field will be displayed in the mini-profile on the private message screen.', + 'DISPLAY_ON_VT' => 'Display on viewtopic screen', + 'DISPLAY_ON_VT_EXPLAIN' => 'If this option is enabled, the field will be displayed in the mini-profile on the topic screen.', + 'DISPLAY_PROFILE_FIELD' => 'Publicly display profile field', + 'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown in all locations allowed within the load settings. Setting this to “no” will hide the field from topic pages, profiles and the memberlist.', + 'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line.', + + 'EDIT_DROPDOWN_LANG_EXPLAIN' => 'Please note that you are able to change your options text and also able to add new options to the end. It is not advised to add new options between existing options - this could result in wrong options assigned to your users. This can also happen if you remove options in-between. Removing options from the end result in users having assigned this item now reverting back to the default one.', + 'EMPTY_FIELD_IDENT' => 'Empty field identification', + 'EMPTY_USER_FIELD_NAME' => 'Please enter a field name/title', + 'ENTRIES' => 'Entries', + 'EVERYTHING_OK' => 'Everything OK', + + 'FIELD_BOOL' => 'Boolean (Yes/No)', + 'FIELD_CONTACT_DESC' => 'Contact description', + 'FIELD_CONTACT_URL' => 'Contact link', + 'FIELD_DATE' => 'Date', + 'FIELD_DESCRIPTION' => 'Field description', + 'FIELD_DESCRIPTION_EXPLAIN' => 'The explanation for this field presented to the user.', + 'FIELD_DROPDOWN' => 'Dropdown box', + 'FIELD_GOOGLEPLUS' => 'Google+', + 'FIELD_IDENT' => 'Field identification', + 'FIELD_IDENT_ALREADY_EXIST' => 'The chosen field identification already exist. Please choose another name.', + 'FIELD_IDENT_EXPLAIN' => 'The field identification is a name to identify the profile field within the database and the templates.', + 'FIELD_INT' => 'Numbers', + 'FIELD_IS_CONTACT' => 'Display field as a contact field', + 'FIELD_IS_CONTACT_EXPLAIN' => 'Contact fields are displayed within the contact section of the user profile and are displayed differently in the mini profile next to posts and private messages. You can use %s as a placeholder variable which will be replaced by a value provided by the user.', + 'FIELD_LENGTH' => 'Length of input box', + 'FIELD_NOT_FOUND' => 'Profile field not found.', + 'FIELD_STRING' => 'Single text field', + 'FIELD_TEXT' => 'Textarea', + 'FIELD_TYPE' => 'Field type', + 'FIELD_TYPE_EXPLAIN' => 'You are not able to change the field type later.', + 'FIELD_URL' => 'URL (Link)', + 'FIELD_VALIDATION' => 'Field validation', + 'FIRST_OPTION' => 'First option', + + 'HIDE_PROFILE_FIELD' => 'Hide profile field', + 'HIDE_PROFILE_FIELD_EXPLAIN' => 'Hide the profile field from all users except administrators and moderators, who are still able to see this field. If the Display in user control panel option is disabled, the user will not be able to see or change this field and the field can only be changed by administrators.', + + 'INVALID_CHARS_FIELD_IDENT' => 'Field identification can only contain lowercase a-z and _', + 'INVALID_FIELD_IDENT_LEN' => 'Field identification can only be 17 characters long', + 'ISO_LANGUAGE' => 'Language [%s]', + + 'LANG_SPECIFIC_OPTIONS' => 'Language specific options [%s]', + + 'LETTER_NUM_DOTS' => 'Any letters, numbers and dots (periods)', + 'LETTER_NUM_ONLY' => 'Any letters and numbers', + 'LETTER_NUM_PUNCTUATION' => 'Any letters, numbers, comma, dots, underscores and dashes beginning with any letter', + 'LETTER_NUM_SPACERS' => 'Any letters, numbers and spacers', + 'LETTER_NUM_UNDERSCORE' => 'Any letters, numbers and underscores', + + 'MAX_FIELD_CHARS' => 'Maximum number of characters', + 'MAX_FIELD_NUMBER' => 'Highest allowed number', + 'MIN_FIELD_CHARS' => 'Minimum number of characters', + 'MIN_FIELD_NUMBER' => 'Lowest allowed number', + + 'NO_FIELD_ENTRIES' => 'No entries defined', + 'NO_FIELD_ID' => 'No field id specified.', + 'NO_FIELD_TYPE' => 'No Field type specified.', + 'NO_VALUE_OPTION' => 'Option equal to non entered value', + 'NO_VALUE_OPTION_EXPLAIN' => 'Value for a non-entry. If the field is required, the user gets an error if he choose the option selected here.', + 'NUMBERS_ONLY' => 'Only numbers (0-9)', + + 'PROFILE_BASIC_OPTIONS' => 'Basic options', + 'PROFILE_FIELD_ACTIVATED' => 'Profile field successfully activated.', + 'PROFILE_FIELD_DEACTIVATED' => 'Profile field successfully deactivated.', + 'PROFILE_LANG_OPTIONS' => 'Language specific options', + 'PROFILE_TYPE_OPTIONS' => 'Profile type specific options', + + 'RADIO_BUTTONS' => 'Radio buttons', + 'REMOVED_PROFILE_FIELD' => 'Successfully removed profile field.', + 'REQUIRED_FIELD' => 'Required field', + 'REQUIRED_FIELD_EXPLAIN' => 'Force profile field to be filled out or specified by user or administrator. If display at registration screen option is disabled, the field will only be required when the user edits their profile.', + 'ROWS' => 'Rows', + + 'SAVE' => 'Save', + 'SECOND_OPTION' => 'Second option', + 'SHOW_NOVALUE_FIELD' => 'Show field if no value was selected', + 'SHOW_NOVALUE_FIELD_EXPLAIN' => 'Determines if the profile field should be displayed if no value was selected for optional fields or if no value has been selected yet for required fields.', + 'STEP_1_EXPLAIN_CREATE' => 'Here you can enter the first basic parameters of your new profile field. This information is needed for the second step where you’ll be able to set remaining options and tweak your profile field further.', + 'STEP_1_EXPLAIN_EDIT' => 'Here you can change the basic parameters of your profile field. The relevant options are re-calculated within the second step.', + 'STEP_1_TITLE_CREATE' => 'Add profile field', + 'STEP_1_TITLE_EDIT' => 'Edit profile field', + 'STEP_2_EXPLAIN_CREATE' => 'Here you are able to define some common options you may want to adjust.', + 'STEP_2_EXPLAIN_EDIT' => 'Here you are able to change some common options.
Please note that changes to profile fields will not affect existing profile fields entered by your users.', + 'STEP_2_TITLE_CREATE' => 'Profile type specific options', + 'STEP_2_TITLE_EDIT' => 'Profile type specific options', + 'STEP_3_EXPLAIN_CREATE' => 'Since you have more than one board language installed, you have to fill out the remaining language items too. If you don’t, then default language setting for this custom profile field will be used, you are able to fill out the remaining language items later too.', + 'STEP_3_EXPLAIN_EDIT' => 'Since you have more than one board language installed, you now can change or add the remaining language items too. If you don’t, then default language setting for this custom profile field will be used.', + 'STEP_3_TITLE_CREATE' => 'Remaining language definitions', + 'STEP_3_TITLE_EDIT' => 'Language definitions', + 'STRING_DEFAULT_VALUE_EXPLAIN' => 'Enter a default phrase to be displayed, a default value. Leave empty if you want to show it empty at the first place.', + + 'TEXT_DEFAULT_VALUE_EXPLAIN' => 'Enter a default text to be displayed, a default value. Leave empty if you want to show it empty at the first place.', + 'TRANSLATE' => 'Translate', + + 'USER_FIELD_NAME' => 'Field name/title presented to the user', + + 'VISIBILITY_OPTION' => 'Visibility options', +)); diff --git a/install/update/new/language/en/acp/styles.php b/install/update/new/language/en/acp/styles.php new file mode 100644 index 0000000..44be3c1 --- /dev/null +++ b/install/update/new/language/en/acp/styles.php @@ -0,0 +1,91 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = []; +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, [ + 'ACP_STYLES_EXPLAIN' => 'Here you can manage the styles available on your board.
Please note you cannot uninstall the “prosilver” style as it is phpBB’s default and primary parent style.', + + 'CANNOT_BE_INSTALLED' => 'Cannot be installed', + 'CONFIRM_UNINSTALL_STYLES' => 'Are you sure you wish to uninstall selected styles?', + 'COPYRIGHT' => 'Copyright', + + 'DEACTIVATE_DEFAULT' => 'You cannot deactivate the default style.', + 'DELETE_FROM_FS' => 'Delete from filesystem', + 'DELETE_STYLE_FILES_FAILED' => 'Error deleting files for style "%s".', + 'DELETE_STYLE_FILES_SUCCESS' => 'Files for style "%s" have been deleted.', + 'DETAILS' => 'Details', + + 'INHERITING_FROM' => 'Inherits from', + 'INSTALL_STYLE' => 'Install style', + 'INSTALL_STYLES' => 'Install styles', + 'INSTALL_STYLES_EXPLAIN' => 'Here you can install new styles.
If you cannot find a specific style in list below, check to make sure style is already installed. If it is not installed, check if it was uploaded correctly.', + 'INVALID_STYLE_ID' => 'Invalid style ID.', + + 'NO_MATCHING_STYLES_FOUND' => 'No styles match your query.', + 'NO_UNINSTALLED_STYLE' => 'No uninstalled styles detected.', + + 'PURGED_CACHE' => 'Cache was purged.', + + 'REQUIRES_STYLE' => 'This style requires the style "%s" to be installed.', + + 'STYLE_ACTIVATE' => 'Activate', + 'STYLE_ACTIVE' => 'Active', + 'STYLE_DEACTIVATE' => 'Deactivate', + 'STYLE_DEFAULT' => 'Make default style', + 'STYLE_DEFAULT_CHANGE_INACTIVE' => 'You must activate style before making it default style.', + 'STYLE_ERR_INVALID_PARENT' => 'Invalid parent style.', + 'STYLE_ERR_NAME_EXIST' => 'A style with that name already exists.', + 'STYLE_ERR_STYLE_NAME' => 'You must supply a name for this style.', + 'STYLE_INSTALLED' => 'Style "%s" has been installed.', + 'STYLE_INSTALLED_RETURN_INSTALLED_STYLES' => 'Return to installed styles list', + 'STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES' => 'Install more styles', + 'STYLE_NAME' => 'Style name', + 'STYLE_NAME_RESERVED' => 'Style "%s" can not be installed, because the name is reserved.', + 'STYLE_NOT_INSTALLED' => 'Style "%s" was not installed.', + 'STYLE_PATH' => 'Style path', + 'STYLE_UNINSTALL' => 'Uninstall', + 'STYLE_UNINSTALL_DEPENDENT' => 'Style "%s" cannot be uninstalled because it has one or more child styles.', + 'STYLE_UNINSTALLED' => 'Style "%s" uninstalled successfully.', + 'STYLE_PHPBB_VERSION' => 'phpBB Version', + 'STYLE_USED_BY' => 'Used by (including robots)', + 'STYLE_VERSION' => 'Style version', + + 'UNINSTALL_PROSILVER' => 'You cannot uninstall the style “prosilver”.', + 'UNINSTALL_DEFAULT' => 'You cannot uninstall the default style.', + + 'BROWSE_STYLES_DATABASE' => 'Browse styles database', +]); diff --git a/install/update/new/language/en/captcha_recaptcha.php b/install/update/new/language/en/captcha_recaptcha.php new file mode 100644 index 0000000..68546ae --- /dev/null +++ b/install/update/new/language/en/captcha_recaptcha.php @@ -0,0 +1,52 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'RECAPTCHA_LANG' => 'en-GB', // Find the language/country code on https://developers.google.com/recaptcha/docs/language - If no code exists for your language you can use "en" or leave the string empty + 'RECAPTCHA_NOT_AVAILABLE' => 'In order to use reCaptcha, you must create an account on www.google.com/recaptcha.', + 'CAPTCHA_RECAPTCHA' => 'reCaptcha', + 'RECAPTCHA_INCORRECT' => 'The solution you provided was incorrect', + 'RECAPTCHA_NOSCRIPT' => 'Please enable JavaScript in your browser to load the challenge.', + + 'RECAPTCHA_PUBLIC' => 'Site key', + 'RECAPTCHA_PUBLIC_EXPLAIN' => 'Your site reCAPTCHA key. Keys can be obtained on www.google.com/recaptcha. Please, use reCAPTCHA v2 > Invisible reCAPTCHA badge type.', + 'RECAPTCHA_PRIVATE' => 'Secret key', + 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your secret reCAPTCHA key. Keys can be obtained on www.google.com/recaptcha. Please, use reCAPTCHA v2 > Invisible reCAPTCHA badge type.', + + 'RECAPTCHA_INVISIBLE' => 'This CAPTCHA is actually invisible. To verify that it works, a small icon should appear in right bottom corner of this page.', +)); diff --git a/install/update/new/language/en/cli.php b/install/update/new/language/en/cli.php new file mode 100644 index 0000000..122010d --- /dev/null +++ b/install/update/new/language/en/cli.php @@ -0,0 +1,175 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* DO NOT CHANGE +*/ +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'CLI_CONFIG_CANNOT_CACHED' => 'Set this option if the configuration option changes too frequently to be efficiently cached.', + 'CLI_CONFIG_CURRENT' => 'Current configuration value, use 0 and 1 to specify boolean values', + 'CLI_CONFIG_DELETE_SUCCESS' => 'Successfully deleted config %s.', + 'CLI_CONFIG_NEW' => 'New configuration value, use 0 and 1 to specify boolean values', + 'CLI_CONFIG_NOT_EXISTS' => 'Config %s does not exist', + 'CLI_CONFIG_OPTION_NAME' => 'The configuration option’s name', + 'CLI_CONFIG_PRINT_WITHOUT_NEWLINE' => 'Set this option if the value should be printed without a new line at the end.', + 'CLI_CONFIG_INCREMENT_BY' => 'Amount to increment by', + 'CLI_CONFIG_INCREMENT_SUCCESS' => 'Successfully incremented config %s', + 'CLI_CONFIG_SET_FAILURE' => 'Could not set config %s', + 'CLI_CONFIG_SET_SUCCESS' => 'Successfully set config %s', + + 'CLI_DESCRIPTION_CRON_LIST' => 'Prints a list of ready and unready cron jobs.', + 'CLI_DESCRIPTION_CRON_RUN' => 'Runs all ready cron tasks.', + 'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'Name of the task to be run', + 'CLI_DESCRIPTION_DB_LIST' => 'List all installed and available migrations.', + 'CLI_DESCRIPTION_DB_MIGRATE' => 'Updates the database by applying migrations.', + 'CLI_DESCRIPTION_DB_REVERT' => 'Revert a migration.', + 'CLI_DESCRIPTION_DELETE_CONFIG' => 'Deletes a configuration option', + 'CLI_DESCRIPTION_DISABLE_EXTENSION' => 'Disables the specified extension.', + 'CLI_DESCRIPTION_ENABLE_EXTENSION' => 'Enables the specified extension.', + 'CLI_DESCRIPTION_FIND_MIGRATIONS' => 'Finds migrations that are not depended upon.', + 'CLI_DESCRIPTION_FIX_LEFT_RIGHT_IDS' => 'Repairs the tree structure of the forums and modules.', + 'CLI_DESCRIPTION_GET_CONFIG' => 'Gets a configuration option’s value', + 'CLI_DESCRIPTION_INCREMENT_CONFIG' => 'Increments a configuration option’s integer value', + 'CLI_DESCRIPTION_LIST_EXTENSIONS' => 'Lists all extensions in the database and on the filesystem.', + + 'CLI_DESCRIPTION_OPTION_ENV' => 'The Environment name.', + 'CLI_DESCRIPTION_OPTION_SAFE_MODE' => 'Run in Safe Mode (without extensions).', + 'CLI_DESCRIPTION_OPTION_SHELL' => 'Launch the shell.', + + 'CLI_DESCRIPTION_PURGE_EXTENSION' => 'Purges the specified extension.', + + 'CLI_DESCRIPTION_REPARSER_LIST' => 'Lists the types of text that can be reparsed.', + 'CLI_DESCRIPTION_REPARSER_AVAILABLE' => 'Available reparsers:', + 'CLI_DESCRIPTION_REPARSER_REPARSE' => 'Reparses stored text with the current text_formatter services.', + 'CLI_DESCRIPTION_REPARSER_REPARSE_ARG_1' => 'Type of text to reparse. Leave blank to reparse everything.', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_DRY_RUN' => 'Do not save any changes; just print what would happen', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_MIN' => 'Lowest record ID to process', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_MAX' => 'Highest record ID to process', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_SIZE' => 'Approximate number of records to process at a time', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RESUME' => 'Start reparsing where the last execution stopped', + + 'CLI_DESCRIPTION_SET_ATOMIC_CONFIG' => 'Sets a configuration option’s value only if the old matches the current value', + 'CLI_DESCRIPTION_SET_CONFIG' => 'Sets a configuration option’s value', + + 'CLI_DESCRIPTION_THUMBNAIL_DELETE' => 'Delete all existing thumbnails.', + 'CLI_DESCRIPTION_THUMBNAIL_GENERATE' => 'Generate all missing thumbnails.', + 'CLI_DESCRIPTION_THUMBNAIL_RECREATE' => 'Recreate all thumbnails.', + + 'CLI_DESCRIPTION_UPDATE_CHECK' => 'Check if the board is up to date.', + 'CLI_DESCRIPTION_UPDATE_CHECK_ARGUMENT_1' => 'Name of the extension to check (if all, checks all the extensions)', + 'CLI_DESCRIPTION_UPDATE_CHECK_OPTION_CACHE' => 'Run check command with cache.', + 'CLI_DESCRIPTION_UPDATE_CHECK_OPTION_STABILITY' => 'Run command choosing to check only stable or unstable versions.', + + 'CLI_DESCRIPTION_UPDATE_HASH_BCRYPT' => 'Updates outdated password hashes to be hashed with bcrypt.', + + 'CLI_ERROR_INVALID_STABILITY' => '"%s" needs to be set to "stable" or "unstable".', + + 'CLI_DESCRIPTION_USER_ACTIVATE' => 'Activate (or deactivate) a user account.', + 'CLI_DESCRIPTION_USER_ACTIVATE_USERNAME' => 'Username of the account to activate.', + 'CLI_DESCRIPTION_USER_ACTIVATE_DEACTIVATE' => 'Deactivate the user’s account', + 'CLI_DESCRIPTION_USER_ACTIVATE_ACTIVE' => 'The user is already active.', + 'CLI_DESCRIPTION_USER_ACTIVATE_INACTIVE' => 'The user is already inactive.', + 'CLI_DESCRIPTION_USER_ADD' => 'Add a new user.', + 'CLI_DESCRIPTION_USER_ADD_OPTION_USERNAME' => 'Username of the new user', + 'CLI_DESCRIPTION_USER_ADD_OPTION_PASSWORD' => 'Password of the new user', + 'CLI_DESCRIPTION_USER_ADD_OPTION_EMAIL' => 'E-mail address of the new user', + 'CLI_DESCRIPTION_USER_ADD_OPTION_NOTIFY' => 'Send account activation email to the new user (not sent by default)', + 'CLI_DESCRIPTION_USER_DELETE' => 'Delete a user account.', + 'CLI_DESCRIPTION_USER_DELETE_USERNAME' => 'Username of the user to delete', + 'CLI_DESCRIPTION_USER_DELETE_OPTION_POSTS' => 'Delete all posts by the user. Without this option, the user’s posts will be retained.', + 'CLI_DESCRIPTION_USER_RECLEAN' => 'Re-clean usernames.', + + 'CLI_EXTENSION_DISABLE_FAILURE' => 'Could not disable extension %s', + 'CLI_EXTENSION_DISABLE_SUCCESS' => 'Successfully disabled extension %s', + 'CLI_EXTENSION_DISABLED' => 'Extension %s is not enabled', + 'CLI_EXTENSION_ENABLE_FAILURE' => 'Could not enable extension %s', + 'CLI_EXTENSION_ENABLE_SUCCESS' => 'Successfully enabled extension %s', + 'CLI_EXTENSION_ENABLED' => 'Extension %s is already enabled', + 'CLI_EXTENSION_NOT_EXIST' => 'Extension %s does not exist', + 'CLI_EXTENSION_NAME' => 'Name of the extension', + 'CLI_EXTENSION_PURGE_FAILURE' => 'Could not purge extension %s', + 'CLI_EXTENSION_PURGE_SUCCESS' => 'Successfully purged extension %s', + 'CLI_EXTENSION_UPDATE_FAILURE' => 'Could not update extension %s', + 'CLI_EXTENSION_UPDATE_SUCCESS' => 'Successfully updated extension %s', + 'CLI_EXTENSION_NOT_FOUND' => 'No extensions were found.', + 'CLI_EXTENSION_NOT_ENABLEABLE' => 'Extension %s is not enableable.', + 'CLI_EXTENSIONS_AVAILABLE' => 'Available', + 'CLI_EXTENSIONS_DISABLED' => 'Disabled', + 'CLI_EXTENSIONS_ENABLED' => 'Enabled', + + 'CLI_FIXUP_FIX_LEFT_RIGHT_IDS_SUCCESS' => 'Successfully repaired the tree structure of the forums and modules.', + 'CLI_FIXUP_UPDATE_HASH_BCRYPT_SUCCESS' => 'Successfully updated outdated password hashes to bcrypt.', + + 'CLI_MIGRATION_NAME' => 'Migration name, including the namespace (use forward slashes instead of backslashes to avoid problems).', + 'CLI_MIGRATIONS_AVAILABLE' => 'Available migrations', + 'CLI_MIGRATIONS_INSTALLED' => 'Installed migrations', + 'CLI_MIGRATIONS_ONLY_AVAILABLE' => 'Show only available migrations', + 'CLI_MIGRATIONS_EMPTY' => 'No migrations.', + + 'CLI_REPARSER_REPARSE_REPARSING' => 'Reparsing %1$s (range %2$d..%3$d)', + 'CLI_REPARSER_REPARSE_REPARSING_START' => 'Reparsing %s...', + 'CLI_REPARSER_REPARSE_SUCCESS' => 'Reparsing ended with success', + + // In all the case %1$s is the logical name of the file and %2$s the real name on the filesystem + // eg: big_image.png (2_a51529ae7932008cf8454a95af84cacd) generated. + 'CLI_THUMBNAIL_DELETED' => '%1$s (%2$s) deleted.', + 'CLI_THUMBNAIL_DELETING' => 'Deleting thumbnails', + 'CLI_THUMBNAIL_SKIPPED' => '%1$s (%2$s) skipped.', + 'CLI_THUMBNAIL_GENERATED' => '%1$s (%2$s) generated.', + 'CLI_THUMBNAIL_GENERATING' => 'Generating thumbnails', + 'CLI_THUMBNAIL_GENERATING_DONE' => 'All thumbnails have been regenerated.', + 'CLI_THUMBNAIL_DELETING_DONE' => 'All thumbnails have been deleted.', + + 'CLI_THUMBNAIL_NOTHING_TO_GENERATE' => 'No thumbnails to generate.', + 'CLI_THUMBNAIL_NOTHING_TO_DELETE' => 'No thumbnails to delete.', + + 'CLI_USER_ADD_SUCCESS' => 'Successfully added user %s.', + 'CLI_USER_DELETE_CONFIRM' => 'Are you sure you want to delete ‘%s’? [y/N]', + 'CLI_USER_RECLEAN_START' => 'Re-cleaning usernames', + 'CLI_USER_RECLEAN_DONE' => [ + 0 => 'Re-cleaning complete. No usernames needed to be cleaned.', + 1 => 'Re-cleaning complete. %d username was cleaned.', + 2 => 'Re-cleaning complete. %d usernames were cleaned.', + ], +)); + +// Additional help for commands. +$lang = array_merge($lang, array( + 'CLI_HELP_CRON_RUN' => $lang['CLI_DESCRIPTION_CRON_RUN'] . ' Optionally you can specify a cron task name to run only the specified cron task.', + 'CLI_HELP_USER_ACTIVATE' => 'Activate a user account, or deactivate an account using the --deactivate option. +To optionally send an activation email to the user, use the --send-email option.', + 'CLI_HELP_USER_ADD' => 'The %command.name% command adds a new user: +If this command is run without options, you will be prompted to enter them. +To optionally send an email to the new user, use the --send-email option.', + 'CLI_HELP_USER_RECLEAN' => 'Re-clean usernames will check all stored usernames and ensure clean versions are also stored. Cleaned usernames are a case insensitive form, NFC normalized and transformed to ASCII.', +)); diff --git a/install/update/new/language/en/common.php b/install/update/new/language/en/common.php new file mode 100644 index 0000000..31914cf --- /dev/null +++ b/install/update/new/language/en/common.php @@ -0,0 +1,1453 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine +// +// Some characters you may want to copy&paste: +// ’ » “ ” … +// + +$lang = array_merge($lang, array( + 'TRANSLATION_INFO' => '', + 'DIRECTION' => 'ltr', + 'DATE_FORMAT' => '|d M Y|', // 01 Jan 2007 (with Relative days enabled) + 'DATETIME_FORMAT' => '|d M Y, H:i|', // 01 Jan 2007, 13:37 (with Relative days enabled) + 'USER_LANG' => 'en-gb', + + // You can define different rules for the determination of plural forms here. + // See https://area51.phpbb.com/docs/dev/32x/language/plurals.html for more information + // or ask the translation manager for help. + 'PLURAL_RULE' => 1, + + '1_DAY' => '1 day', + '1_MONTH' => '1 month', + '1_YEAR' => '1 year', + '2_WEEKS' => '2 weeks', + '3_MONTHS' => '3 months', + '6_MONTHS' => '6 months', + '7_DAYS' => '7 days', + + 'ACCOUNT_ALREADY_ACTIVATED' => 'Your account has already been activated.', + 'ACCOUNT_DEACTIVATED' => 'Your account has been manually deactivated and is only able to be reactivated by an administrator.', + 'ACP' => 'Administration Control Panel', + 'ACP_SHORT' => 'ACP', + 'ACTIVE' => 'active', + 'ACTIVE_ERROR' => 'The specified username is currently inactive. If you have problems activating your account, please contact a board administrator.', + 'ADMINISTRATOR' => 'Administrator', + 'ADMINISTRATORS' => 'Administrators', + 'AGE' => 'Age', + 'AIM' => 'AIM', + 'AJAX_ERROR_TITLE' => 'AJAX error', + 'AJAX_ERROR_TEXT' => 'Something went wrong when processing your request.', + 'AJAX_ERROR_TEXT_ABORT' => 'User aborted request.', + 'AJAX_ERROR_TEXT_TIMEOUT' => 'Your request timed out; please try again.', + 'AJAX_ERROR_TEXT_PARSERERROR' => 'Something went wrong with the request and the server returned an invalid reply.', + 'ALLOWED' => 'Allowed', + 'ALL_FILES' => 'All files', + 'ALL_FORUMS' => 'All forums', + 'ALL_MESSAGES' => 'All messages', + 'ALL_POSTS' => 'All posts', + 'ALL_TIMES' => 'All times are %1$s', + 'ALL_TOPICS' => 'All Topics', + 'ALT_TEXT' => 'Alternative text', + 'AND' => 'And', + 'ARE_WATCHING_FORUM' => 'You have subscribed to be notified of new posts in this forum.', + 'ARE_WATCHING_TOPIC' => 'You have subscribed to be notified of new posts in this topic.', + 'ASCENDING' => 'Ascending', + 'ATTACHMENTS' => 'Attachments', + 'ATTACHED_IMAGE_NOT_IMAGE' => 'The image file you tried to attach is invalid.', + 'AUTHOR' => 'Author', + 'AUTH_NO_PROFILE_CREATED' => 'The creation of a user profile was unsuccessful.', + 'AUTH_PROVIDER_OAUTH_ERROR_ALREADY_LINKED' => 'This external service is already associated with another board account.', + 'AUTH_PROVIDER_OAUTH_ERROR_INVALID_ENTRY' => 'Invalid database entry.', + 'AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE' => 'Invalid service type provided to OAuth service handler.', + 'AUTH_PROVIDER_OAUTH_ERROR_REQUEST' => 'Something went wrong when processing your OAuth request.', + 'AUTH_PROVIDER_OAUTH_ERROR_SERVICE_NOT_CREATED' => 'OAuth service not created', + 'AUTH_PROVIDER_OAUTH_SERVICE_BITLY' => 'Bitly', + 'AUTH_PROVIDER_OAUTH_SERVICE_FACEBOOK' => 'Facebook', + 'AUTH_PROVIDER_OAUTH_SERVICE_GOOGLE' => 'Google', + 'AUTH_PROVIDER_OAUTH_SERVICE_TWITTER' => 'Twitter', + 'AUTH_PROVIDER_OAUTH_TOKEN_ERROR_NOT_STORED' => 'OAuth token not stored.', + 'AUTH_PROVIDER_OAUTH_TOKEN_ERROR_INCORRECTLY_STORED' => 'OAuth token incorrectly stored.', + 'AVATAR_DISALLOWED_CONTENT' => 'The upload was rejected because the uploaded file was identified as a possible attack vector.', + 'AVATAR_DISALLOWED_EXTENSION' => 'This file cannot be displayed because the extension %s is not allowed.', + 'AVATAR_EMPTY_REMOTE_DATA' => 'The specified avatar could not be uploaded because the remote data appears to be invalid or corrupted.', + 'AVATAR_EMPTY_FILEUPLOAD' => 'The uploaded avatar file is empty.', + 'AVATAR_INVALID_FILENAME' => '%s is an invalid filename.', + 'AVATAR_NOT_UPLOADED' => 'Avatar could not be uploaded.', + 'AVATAR_NO_TEMP_DIR' => 'Temporary folder could not be found or is not writable.', + 'AVATAR_NO_SIZE' => 'The width or height of the linked avatar could not be determined. Please enter them manually.', + 'AVATAR_PARTIAL_UPLOAD' => 'The specified file was only partially uploaded.', + 'AVATAR_PHP_SIZE_NA' => 'The avatar’s filesize is too large.
The maximum allowed filesize set in php.ini could not be determined.', + 'AVATAR_PHP_SIZE_OVERRUN' => 'The avatar’s filesize is too large. The maximum allowed upload size is %1$d %2$s.
Please note this is set in php.ini and cannot be overridden.', + 'AVATAR_REMOTE_UPLOAD_TIMEOUT' => 'The specified avatar could not be uploaded because the request timed out.', + 'AVATAR_PHP_UPLOAD_STOPPED' => 'A PHP extension has stopped the file upload.', + 'AVATAR_URL_INVALID' => 'The URL you specified is invalid.', + 'AVATAR_URL_NOT_FOUND' => 'The file specified could not be found.', + 'AVATAR_WRONG_FILESIZE' => 'The avatar’s filesize must be between 0 and %1$d %2$s.', + 'AVATAR_WRONG_SIZE' => 'The submitted avatar is %5$s wide and %6$s high. Avatars must be at least %1$s wide and %2$s high, but no larger than %3$s wide and %4$s high.', + + 'BACK_TO_TOP' => 'Top', + 'BACK_TO_PREV' => 'Back to previous page', + 'BAN_TRIGGERED_BY_EMAIL'=> 'A ban has been issued on your email address.', + 'BAN_TRIGGERED_BY_IP' => 'A ban has been issued on your IP address.', + 'BAN_TRIGGERED_BY_USER' => 'A ban has been issued on your username.', + 'BBCODE_GUIDE' => 'BBCode guide', + 'BCC' => 'BCC', + 'BIRTHDAYS' => 'Birthdays', + 'BOARD_BAN_PERM' => 'You have been permanently banned from this board.

Please contact the %2$sBoard Administrator%3$s for more information.', + 'BOARD_BAN_REASON' => 'Reason given for ban: %s', + 'BOARD_BAN_TIME' => 'You have been banned from this board until %1$s.

Please contact the %2$sBoard Administrator%3$s for more information.', + 'BOARD_DISABLE' => 'Sorry but this board is currently unavailable.', + 'BOARD_DISABLED' => 'This board is currently disabled.', + 'BOARD_UNAVAILABLE' => 'Sorry but the board is temporarily unavailable, please try again in a few minutes.', + 'BROWSING_FORUM' => 'Users browsing this forum: %1$s', + 'BROWSING_FORUM_GUESTS' => array( + 1 => 'Users browsing this forum: %2$s and %1$d guest', + 2 => 'Users browsing this forum: %2$s and %1$d guests', + ), + 'BUTTON_DELETE' => 'Delete', + 'BUTTON_EDIT' => 'Edit', + 'BUTTON_FORUM_LOCKED' => 'Locked', + 'BUTTON_INFORMATION' => 'Information', + 'BUTTON_NEW_TOPIC' => 'New Topic', + 'BUTTON_PM' => 'PM', + 'BUTTON_PM_FORWARD' => 'Forward', + 'BUTTON_PM_NEW' => 'New PM', + 'BUTTON_PM_REPLY' => 'Send Reply', + 'BUTTON_PM_REPLY_ALL' => 'Reply All', + 'BUTTON_POST_REPLY' => 'Post Reply', + 'BUTTON_QUOTE' => 'Quote', + 'BUTTON_REPORT' => 'Report', + 'BUTTON_TOPIC_LOCKED' => 'Locked', + 'BUTTON_WARN' => 'Warn', + 'BYTES' => 'Bytes', + 'BYTES_SHORT' => 'B', + + 'CANCEL' => 'Cancel', + 'CHANGE' => 'Change', + 'CHANGE_FONT_SIZE' => 'Change font size', + 'CHANGING_PREFERENCES' => 'Changing board preferences', + 'CHANGING_PROFILE' => 'Changing profile settings', + 'CHARACTERS' => array( + 1 => '%d character', + 2 => '%d characters', + ), + 'COLLAPSE_VIEW' => 'Collapse view', + 'CLOSE_WINDOW' => 'Close window', + 'COLOUR_SWATCH' => 'Colour swatch', + 'COLON' => ':', + 'COMMA_SEPARATOR' => ', ', // Comma used to join lists into a single string, use localised comma if appropriate, eg: Ideographic or Arabic + 'CONFIRM' => 'Confirm', + 'CONFIRM_CODE' => 'Confirmation code', + 'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as it appears. All letters are case insensitive.', + 'CONFIRM_CODE_WRONG' => 'The confirmation code you entered was incorrect.', + 'CONFIRM_OPERATION' => 'Are you sure you wish to carry out this operation?', + 'CONFIRM_AVATAR_DELETE' => 'Are you sure you wish to delete this avatar?', + 'CONGRATULATIONS' => 'Congratulations to', + 'CONNECTION_FAILED' => 'Connection failed.', + 'CONNECTION_SUCCESS' => 'Connection was successful!', + 'CONTACT' => 'Contact', + 'CONTACT_USER' => 'Contact %s', + 'CONTACT_US' => 'Contact us', + 'COOKIE_CONSENT_INFO' => 'Learn more', + 'COOKIE_CONSENT_MSG' => 'This website uses cookies to ensure you get the best experience on our website.', + 'COOKIE_CONSENT_OK' => 'Got it!', + 'COOKIE_CONSENT_HREF' => 'http://cookiesandyou.com', + 'COOKIES_DELETED' => 'All board cookies successfully deleted.', + 'CURRENT_TIME' => 'It is currently %s', + + 'DAY' => 'Day', + 'DAYS' => 'Days', + 'DELETE' => 'Delete', + 'DELETE_ALL' => 'Delete all', + 'DELETE_COOKIES' => 'Delete cookies', + 'DELETE_MARKED' => 'Delete marked', + 'DELETE_POST' => 'Delete post', + 'DELIMITER' => 'Delimiter', + 'DESCENDING' => 'Descending', + 'DISABLED' => 'Disabled', + 'DISPLAY' => 'Display', + 'DISPLAY_GUESTS' => 'Display guests', + 'DISPLAY_MESSAGES' => 'Display messages from previous', + 'DISPLAY_POSTS' => 'Display posts from previous', + 'DISPLAY_TOPICS' => 'Display topics from previous', + 'DOWNLOADED' => 'Downloaded', + 'DOWNLOADING_FILE' => 'Downloading file', + 'DOWNLOAD_COUNTS' => array( + 0 => 'Not downloaded yet', + 1 => 'Downloaded %d time', + 2 => 'Downloaded %d times', + ), + + 'EDIT_POST' => 'Edit post', + 'ELLIPSIS' => '…', + 'EMAIL' => 'Email', // Short form for EMAIL_ADDRESS + 'EMAIL_ADDRESS' => 'Email address', + 'EMAIL_INVALID_EMAIL' => 'The email address you entered is invalid.', + 'EMAIL_SMTP_ERROR_RESPONSE' => 'Ran into problems sending email at Line %1$s. Response: %2$s.', + 'EMPTY_SUBJECT' => 'You must specify a subject when posting a new topic.', + 'EMPTY_MESSAGE_SUBJECT' => 'You must specify a subject when composing a new message.', + 'ENABLED' => 'Enabled', + 'ENCLOSURE' => 'Enclosure', + 'ENTER_USERNAME' => 'Enter username', + 'ERR_CHANGING_DIRECTORY' => 'Unable to change directory.', + 'ERR_CONNECTING_SERVER' => 'Error connecting to the server.', + 'ERR_JAB_AUTH' => 'Could not authorise on Jabber server.', + 'ERR_JAB_CONNECT' => 'Could not connect to Jabber server.', + 'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.', + 'ERR_UNWATCHING' => 'An error occurred while trying to unsubscribe.', + 'ERR_WATCHING' => 'An error occurred while trying to subscribe.', + 'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path specified appears to be invalid.', + 'ERROR' => 'Error', + 'EXPAND_VIEW' => 'Expand view', + 'EXTENSION' => 'Extension', + 'EXTENSION_DISABLED' => 'The extension %s is not enabled.', + 'EXTENSION_DISABLED_AFTER_POSTING' => 'The extension %s has been deactivated and can no longer be displayed.', + 'EXTENSION_DOES_NOT_EXIST' => 'The extension %s does not exist.', + + 'FACEBOOK' => 'Facebook', + 'FAQ' => 'FAQ', + 'FAQ_EXPLAIN' => 'Frequently Asked Questions', + 'FEATURE_NOT_AVAILABLE' => 'The requested feature is not available on this board.', + 'FILENAME' => 'Filename', + 'FILESIZE' => 'File size', + 'FILEDATE' => 'File date', + 'FILE_COMMENT' => 'File comment', + 'FILE_CONTENT_ERR' => 'Could not read the contents of file: %s', + 'FILE_JSON_DECODE_ERR' => 'Failed to decode json file: %s', + 'FILE_NOT_FOUND' => 'The requested file could not be found: %s', + 'FIND_USERNAME' => 'Find a member', + 'FOLDER' => 'Folder', + 'FORGOT_PASS' => 'I forgot my password', + 'FORM_INVALID' => 'The submitted form was invalid. Try submitting again.', + 'FORUM' => 'Forum', + 'FORUMS' => 'Forums', + 'FORUMS_MARKED' => 'Forums have been marked read.', + 'FORUM_CAT' => 'Forum category', + 'FORUM_INDEX' => 'Board index', + 'FORUM_LINK' => 'Forum link', + 'FORUM_LOCATION' => 'Forum location', + 'FORUM_LOCKED' => 'Forum locked', + 'FORUM_RULES' => 'Forum rules', + 'FORUM_RULES_LINK' => 'Please click here to view the forum rules', + 'FROM' => 'from', + 'FSOCK_DISABLED' => 'The operation could not be completed because the fsockopen function has been disabled or the server being queried could not be found.', + 'FSOCK_TIMEOUT' => 'A timeout occurred while reading from the network stream.', + + 'FILESYSTEM_CANNOT_CHANGE_FILE_GROUP' => 'Unable to change file group', + 'FILESYSTEM_CANNOT_CHANGE_FILE_PERMISSIONS' => 'Unable to change file permissions', + 'FILESYSTEM_CANNOT_COPY_FILES' => 'Unable to copy files', + 'FILESYSTEM_CANNOT_CREATE_SYMLINK' => 'Unable to create a symlink', + 'FILESYSTEM_CANNOT_CREATE_DIRECTORY' => 'Unable to create directory', + 'FILESYSTEM_CANNOT_DELETE_FILES' => 'Unable to delete files from the system', + 'FILESYSTEM_CANNOT_DUMP_FILE' => 'Unable to dump into file', + 'FILESYSTEM_CANNOT_MIRROR_DIRECTORY' => 'Unable to mirror directory', + 'FILESYSTEM_CANNOT_RENAME_FILE' => 'Unable to rename a file from the system', + 'FILESYSTEM_CANNOT_TOUCH_FILES' => 'Unable to create file or change file timestamps', + + 'FTP_FSOCK_HOST' => 'FTP host', + 'FTP_FSOCK_HOST_EXPLAIN' => 'FTP server used to connect your site.', + 'FTP_FSOCK_PASSWORD' => 'FTP password', + 'FTP_FSOCK_PASSWORD_EXPLAIN' => 'Password for your FTP username.', + 'FTP_FSOCK_PORT' => 'FTP port', + 'FTP_FSOCK_PORT_EXPLAIN' => 'Port used to connect to your server.', + 'FTP_FSOCK_ROOT_PATH' => 'Path to phpBB', + 'FTP_FSOCK_ROOT_PATH_EXPLAIN' => 'Path from the root to your phpBB board.', + 'FTP_FSOCK_TIMEOUT' => 'FTP timeout', + 'FTP_FSOCK_TIMEOUT_EXPLAIN' => 'The amount of time, in seconds, that the system will wait for a reply from your server.', + 'FTP_FSOCK_USERNAME' => 'FTP username', + 'FTP_FSOCK_USERNAME_EXPLAIN' => 'Username used to connect to your server.', + + 'FTP_HOST' => 'FTP host', + 'FTP_HOST_EXPLAIN' => 'FTP server used to connect your site.', + 'FTP_PASSWORD' => 'FTP password', + 'FTP_PASSWORD_EXPLAIN' => 'Password for your FTP username.', + 'FTP_PORT' => 'FTP port', + 'FTP_PORT_EXPLAIN' => 'Port used to connect to your server.', + 'FTP_ROOT_PATH' => 'Path to phpBB', + 'FTP_ROOT_PATH_EXPLAIN' => 'Path from the root to your phpBB board.', + 'FTP_TIMEOUT' => 'FTP timeout', + 'FTP_TIMEOUT_EXPLAIN' => 'The amount of time, in seconds, that the system will wait for a reply from your server.', + 'FTP_USERNAME' => 'FTP username', + 'FTP_USERNAME_EXPLAIN' => 'Username used to connect to your server.', + + 'GENERAL_ERROR' => 'General Error', + 'GB' => 'GB', + 'GIB' => 'GiB', + 'GO' => 'Go', + 'GOOGLEPLUS' => 'Google+', + 'GOTO_FIRST_POST' => 'Go to first post', + 'GOTO_LAST_POST' => 'Go to last post', + 'GOTO_PAGE' => 'Go to page', + 'GROUP' => 'Group', + 'GROUPS' => 'Groups', + 'GROUP_ERR_TYPE' => 'Inappropriate group type specified.', + 'GROUP_ERR_USERNAME' => 'No group name specified.', + 'GROUP_ERR_USER_LONG' => 'Group names cannot exceed 60 characters. The specified group name is too long.', + 'GUEST' => 'Guest', + 'GUEST_USERS_ONLINE' => array( + 1 => 'There is %d guest user online', + 2 => 'There are %d guest users online', + ), + 'GUEST_USERS_TOTAL' => array( + 1 => '%d guest', + 2 => '%d guests', + ), + 'G_ADMINISTRATORS' => 'Administrators', + 'G_BOTS' => 'Bots', + 'G_GUESTS' => 'Guests', + 'G_REGISTERED' => 'Registered users', + 'G_REGISTERED_COPPA' => 'Registered COPPA users', + 'G_GLOBAL_MODERATORS' => 'Global moderators', + 'G_NEWLY_REGISTERED' => 'Newly registered users', + + 'HIDDEN_USERS_ONLINE' => array( + 1 => '%d hidden user', + 2 => '%d hidden users', + ), + 'HIDDEN_USERS_TOTAL' => array( + 1 => '%d hidden', + 2 => '%d hidden', + ), + 'HIDE_GUESTS' => 'Hide guests', + 'HIDE_ME' => 'Hide my online status this session', + 'HOURS' => 'Hours', + 'HOME' => 'Home', + + 'ICQ' => 'ICQ', + 'IF' => 'If', + 'IMAGE' => 'Image', + 'IMAGE_FILETYPE_INVALID' => 'Image file type %d for mimetype %s not supported.', + 'IMAGE_FILETYPE_MISMATCH' => 'Image file type mismatch: expected extension %1$s but extension %2$s given.', + 'IN' => 'in', + 'INACTIVE' => 'Inactive', + 'INDEX' => 'Index page', + 'INFORMATION' => 'Information', + 'INSECURE_REDIRECT' => 'Tried to redirect to potentially insecure url.', + 'INTERESTS' => 'Interests', + 'INVALID_DIGEST_CHALLENGE' => 'Invalid digest challenge.', + 'INVALID_EMAIL_LOG' => '%s possibly an invalid email address?', + 'INVALID_FEED_ATTACHMENTS' => 'The selected feed tried fetching attachments with invalid constraints.', + 'INVALID_PLURAL_RULE' => 'The chosen plural rule is invalid. Valid values are integers between 0 and 15.', + 'IP' => 'IP', + 'IP_BLACKLISTED' => 'Your IP %1$s has been blocked because it is blacklisted. For details please see %2$s.', + + 'JABBER' => 'Jabber', + 'JOINED' => 'Joined', + 'JUMP_PAGE' => 'Enter the page number you wish to go to', + 'JUMP_TO' => 'Jump to', + 'JUMP_TO_PAGE' => 'Jump to page', + 'JUMP_TO_PAGE_CLICK' => 'Click to jump to page…', + + 'KB' => 'KB', + 'KIB' => 'KiB', + + 'LAST_POST' => 'Last post', + 'LAST_UPDATED' => 'Last updated', + 'LAST_VISIT' => 'Last visit', + 'LDAP_NO_LDAP_EXTENSION' => 'LDAP extension not available.', + 'LDAP_NO_SERVER_CONNECTION' => 'Could not connect to LDAP server.', + 'LDAP_SEARCH_FAILED' => 'An error occurred while searching the LDAP directory.', + 'LEGEND' => 'Legend', + 'LIVE_SEARCHES_NOT_ALLOWED' => 'Live searches are not allowed.', + 'LOADING' => 'Loading', + 'LOCATION' => 'Location', + 'LOCK_POST' => 'Lock post', + 'LOCK_POST_EXPLAIN' => 'Prevent editing', + 'LOCK_TOPIC' => 'Lock topic', + 'LOGIN' => 'Login', + 'LOGIN_CHECK_PM' => 'Log in to check your private messages.', + 'LOGIN_CONFIRMATION' => 'Confirmation of login', + 'LOGIN_CONFIRM_EXPLAIN' => 'To prevent brute forcing accounts the board requires you to enter a confirmation code after a maximum amount of failed logins. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', // unused + 'LOGIN_ERROR_ATTEMPTS' => 'You exceeded the maximum allowed number of login attempts. In addition to your username and password you now also have to pass the CAPTCHA test.', + 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE' => 'You have not been authenticated by Apache.', + 'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST' => 'A non-existant OAuth service has been requested.', + 'LOGIN_ERROR_PASSWORD' => 'You have specified an incorrect password. Please check your password and try again. If you continue to have problems please contact the %sBoard Administrator%s.', + 'LOGIN_ERROR_PASSWORD_CONVERT' => 'It was not possible to convert your password when updating this bulletin board’s software. Please %srequest a new password%s. If you continue to have problems please contact the %sBoard Administrator%s.', + 'LOGIN_ERROR_USERNAME' => 'You have specified an incorrect username. Please check your username and try again. If you continue to have problems please contact the %sBoard Administrator%s.', + 'LOGIN_FORUM' => 'To view or post in this forum you must enter its password.', + 'LOGIN_INFO' => 'In order to login you must be registered. Registering takes only a few moments but gives you increased capabilities. The board administrator may also grant additional permissions to registered users. Before you register please ensure you are familiar with our terms of use and related policies. Please ensure you read any forum rules as you navigate around the board.', + 'LOGIN_VIEWFORUM' => 'The board requires you to be registered and logged in to view this forum.', + 'LOGIN_EXPLAIN_EDIT' => 'In order to edit posts in this forum you have to be registered and logged in.', + 'LOGIN_EXPLAIN_VIEWONLINE' => 'In order to view the online list you have to be registered and logged in.', + 'LOGIN_REQUIRED' => 'You need to login to perform this action.', + 'LOGOUT' => 'Logout', + 'LOGOUT_USER' => 'Logout [ %s ]', + 'LOG_ME_IN' => 'Remember me', + + 'MAIN' => 'Main', + 'MARK' => 'Mark', + 'MARK_ALL' => 'Mark all', + 'MARK_ALL_READ' => 'Mark all read', + 'MARK_FORUMS_READ' => 'Mark forums read', + 'MARK_READ' => 'Mark read', + 'MARK_SUBFORUMS_READ' => 'Mark subforums read', + 'MB' => 'MB', + 'MIB' => 'MiB', + 'MCP' => 'Moderator Control Panel', + 'MCP_SHORT' => 'MCP', + 'MEMBERLIST' => 'Members', + 'MEMBERLIST_EXPLAIN' => 'View complete list of members', + 'MERGE' => 'Merge', + 'MERGE_POSTS' => 'Move posts', + 'MERGE_TOPIC' => 'Merge topic', + 'MESSAGE' => 'Message', + 'MESSAGES' => 'Messages', + 'MESSAGES_COUNT' => array( + 1 => '%d message', + 2 => '%d messages', + ), + 'MESSAGE_BODY' => 'Message body', + 'MINUTES' => 'Minutes', + 'MODERATE' => 'Moderate', + 'MODERATOR' => 'Moderator', + 'MODERATORS' => 'Moderators', + 'MODULE_NOT_ACCESS' => 'Module not accessible', + 'MODULE_NOT_FIND' => 'Cannot find module %s', + 'MODULE_FILE_INCORRECT_CLASS' => 'Module file %s does not contain correct class [%s]', + 'MONTH' => 'Month', + 'MOVE' => 'Move', + + 'NA' => 'N/A', + 'NEWEST_USER' => 'Our newest member %s', + 'NEW_MESSAGE' => 'New message', + 'NEW_MESSAGES' => 'New messages', + 'NEW_POST' => 'New post', // Not used anymore + 'NEW_POSTS' => 'New posts', // Not used anymore + 'NEXT' => 'Next', // Used in pagination + 'NEXT_STEP' => 'Next', + 'NEVER' => 'Never', + 'NO' => 'No', + 'NO_NOTIFICATIONS' => 'You have no notifications', + 'NOT_ALLOWED_MANAGE_GROUP' => 'You are not allowed to manage this group.', + 'NOT_AUTHORISED' => 'You are not authorised to access this area.', + 'NOT_WATCHING_FORUM' => 'You are no longer subscribed to updates on this forum.', + 'NOT_WATCHING_TOPIC' => 'You are no longer subscribed to this topic.', + 'NOTIFICATIONS' => 'Notifications', + // This applies for NOTIFICATION_BOOKMARK and NOTIFICATION_POST. + // %1$s will return a list of users that's concatenated using "," and "and" - see STRING_LIST + // Once the user count reaches 5 users or more, the list is trimmed using NOTIFICATION_X_OTHERS + // Once the user count reaches 20 users or more, the list is trimmed using NOTIFICATION_MANY_OTHERS + // Examples: + // A replied... + // A and B replied... + // A, B and C replied... + // A, B, C and 2 others replied... + // A, B, C and others replied... + 'NOTIFICATION_BOOKMARK' => array( + 1 => 'Reply from %1$s in bookmarked topic:', + ), + 'NOTIFICATION_FORUM' => 'Forum: %1$s', + 'NOTIFICATION_GROUP_REQUEST' => 'Group request from %1$s to join the group %2$s.', + 'NOTIFICATION_GROUP_REQUEST_APPROVED' => 'Group request approved to join the group %1$s.', + 'NOTIFICATION_METHOD_INVALID' => 'The method "%s" does not refer to a valid notification method.', + 'NOTIFICATION_PM' => 'Private Message from %1$s:', + 'NOTIFICATION_POST' => array( + 1 => 'Reply from %1$s in topic:', + ), + 'NOTIFICATION_POST_APPROVED' => 'Post approved:', + 'NOTIFICATION_POST_DISAPPROVED' => 'Post disapproved:', + 'NOTIFICATION_POST_IN_QUEUE' => 'Post approval request by %1$s:', + 'NOTIFICATION_QUOTE' => array( + 1 => 'Quoted by %1$s in:', + ), + 'NOTIFICATION_REFERENCE' => '"%1$s"', + 'NOTIFICATION_REASON' => 'Reason: %1$s.', + 'NOTIFICATION_REPORT_PM' => 'Private Message reported by %1$s:', + 'NOTIFICATION_REPORT_POST' => 'Post reported by %1$s:', + 'NOTIFICATION_REPORT_CLOSED' => 'Report closed by %1$s for:', + 'NOTIFICATION_TOPIC' => 'New topic by %1$s:', + 'NOTIFICATION_TOPIC_APPROVED' => 'Topic approved:', + 'NOTIFICATION_TOPIC_DISAPPROVED' => 'Topic disapproved:', + 'NOTIFICATION_TOPIC_IN_QUEUE' => 'Topic approval request by %1$s:', + 'NOTIFICATION_TYPE_NOT_EXIST' => 'The notification type "%s" is missing from the file system.', + 'NOTIFICATION_ADMIN_ACTIVATE_USER' => 'Activation required for deactivated or newly registered user: “%1$s”', + // Used in conjunction with NOTIFICATION_BOOKMARK and NOTIFICATION_POST. + 'NOTIFICATION_MANY_OTHERS' => 'others', + 'NOTIFICATION_X_OTHERS' => array( + 2 => '%d others', + ), + 'NOTIFY_ADMIN' => 'Please notify the board administrator or webmaster.', + 'NOTIFY_ADMIN_EMAIL' => 'Please notify the board administrator or webmaster: %1$s', + 'NO_ACCESS_ATTACHMENT' => 'You are not allowed to access this file.', + 'NO_ACTION' => 'No action specified.', + 'NO_ADMINISTRATORS' => 'There are no administrators.', + 'NO_AUTH_ADMIN' => 'Access to the Administration Control Panel is not allowed as you do not have administrative permissions.', + 'NO_AUTH_ADMIN_USER_DIFFER' => 'You are not able to re-authenticate as a different user.', + 'NO_AUTH_OPERATION' => 'You do not have the necessary permissions to complete this operation.', + 'NO_AVATARS' => 'No avatars currently available', + 'NO_CONNECT_TO_SMTP_HOST' => 'Could not connect to smtp host : %1$s : %2$s', + 'NO_BIRTHDAYS' => 'No birthdays today', + 'NO_EMAIL_MESSAGE' => 'Email message was blank.', + 'NO_EMAIL_RESPONSE_CODE' => 'Could not get mail server response codes.', + 'NO_EMAIL_SUBJECT' => 'No email subject specified.', + 'NO_FORUM' => 'The forum you selected does not exist.', + 'NO_FORUMS' => 'This board has no forums.', + 'NO_GROUP' => 'The requested usergroup does not exist.', + 'NO_GROUP_MEMBERS' => 'This group currently has no members.', + 'NO_IPS_DEFINED' => 'No IP addresses or hostnames defined', + 'NO_MEMBERS' => 'No members found for this search criterion.', + 'NO_MESSAGES' => 'No messages', + 'NO_MODE' => 'No mode specified.', + 'NO_MODERATORS' => 'There are no moderators.', + 'NO_NEW_MESSAGES' => 'No new messages', + 'NO_NEW_POSTS' => 'No new posts', // Not used anymore + 'NO_ONLINE_USERS' => 'No registered users', + 'NO_POSTS' => 'No posts', + 'NO_POSTS_TIME_FRAME' => 'No posts exist inside this topic for the selected time frame.', + 'NO_FEED_ENABLED' => 'Feeds are not available on this board.', + 'NO_FEED' => 'The requested feed is not available.', + 'NO_STYLE_DATA' => 'Could not get style data for user_style %s and set for user_id %s', + 'NO_STYLE_CFG' => 'Could not get the style configuration file for: %s', + 'NO_SUBJECT' => 'No subject specified', // Used for posts having no subject defined but displayed within management pages. + 'NO_SUCH_SEARCH_MODULE' => 'The specified search backend doesn’t exist.', + 'NO_SUPPORTED_AUTH_METHODS' => 'No supported authentication methods.', + 'NO_TOPIC' => 'The requested topic does not exist.', + 'NO_TOPIC_FORUM' => 'The topic or forum no longer exists.', + 'NO_TOPICS' => 'There are no topics or posts in this forum.', + 'NO_TOPICS_TIME_FRAME' => 'No topics exist inside this forum for the selected time frame.', + 'NO_UNREAD_POSTS' => 'No unread posts', + 'NO_UPLOAD_FORM_FOUND' => 'Upload initiated but no valid file upload form found.', + 'NO_USER' => 'The requested user does not exist.', + 'NO_USERS' => 'The requested users do not exist.', + 'NO_USER_SPECIFIED' => 'No username was specified.', + + // Nullar/Singular/Plural language entry. The key numbers define the number range in which a certain grammatical expression is valid. + 'NUM_ATTACHMENTS' => array( + 1 => '%d attachment', + 2 => '%d attachments', + ), + 'NUM_POSTS_IN_QUEUE' => array( + 0 => 'No posts in queue', // 0 + 1 => '1 post in queue', // 1 + 2 => '%d posts in queue', // 2+ + ), + + 'OCCUPATION' => 'Occupation', + 'OFFLINE' => 'Offline', + 'ONLINE' => 'Online', + 'ONLINE_BUDDIES' => 'Online friends', + // "... :: x registered and y hidden" + 'ONLINE_USERS_TOTAL' => array( + 1 => 'In total there is %1$d user online :: %2$s and %3$s', + 2 => 'In total there are %1$d users online :: %2$s and %3$s', + ), + // "... :: x registered, y hidden and z guests" + 'ONLINE_USERS_TOTAL_GUESTS' => array( + 1 => 'In total there is %1$d user online :: %2$s, %3$s and %4$s', + 2 => 'In total there are %1$d users online :: %2$s, %3$s and %4$s', + ), + 'OPTIONS' => 'Options', + + 'PAGE_NOT_FOUND' => 'The requested page could not be found.', + 'PAGE_OF' => 'Page %1$d of %2$d', + 'PAGE_TITLE_NUMBER' => 'Page %s', + 'PASSWORD' => 'Password', + 'PIXEL' => 'px', + 'PIXELS' => array( + 1 => '%d pixel', + 2 => '%d pixels', + ), + 'PLEASE_WAIT' => 'Please wait.', + 'PM' => 'PM', + 'PM_REPORTED' => 'Click to view report', + 'POSTING_MESSAGE' => 'Posting message in %s', + 'POSTING_PRIVATE_MESSAGE' => 'Composing private message', + 'POST' => 'Post', + 'POST_ANNOUNCEMENT' => 'Announce', + 'POST_STICKY' => 'Sticky', + 'POSTED' => 'Posted', + 'POSTED_IN_FORUM' => 'in', + 'POSTED_ON_DATE' => 'on', + 'POSTS' => 'Posts', + 'POSTS_UNAPPROVED' => 'At least one post in this topic has not been approved.', + 'POSTS_UNAPPROVED_FORUM'=> 'At least one post in this forum has not been approved.', + 'POST_BY_AUTHOR' => 'by', + 'POST_BY_FOE' => '%1$s, who is currently on your ignore list, made this post.', + 'POST_DISPLAY' => '%1$sDisplay this post%2$s.', + 'POST_DAY' => '%.2f posts per day', + 'POST_DELETED_ACTION' => 'Deleted post:', + 'POST_DELETED' => 'This post has been deleted.', + 'POST_DELETED_BY' => '%2$s deleted the post by %1$s on %3$s.', + 'POST_DELETED_BY_REASON'=> '%2$s deleted the post by %1$s on %3$s for the following reason: %4$s', + 'POST_DETAILS' => 'Post details', + 'POST_NEW_TOPIC' => 'Post new topic', + 'POST_PCT' => '%.2f%% of all posts', + 'POST_PCT_ACTIVE' => '%.2f%% of user’s posts', + 'POST_PCT_ACTIVE_OWN' => '%.2f%% of your posts', + 'POST_REPLY' => 'Post a reply', + 'POST_REPORTED' => 'Click to view report', + 'POST_SUBJECT' => 'Post subject', + 'POST_TIME' => 'Post time', + 'POST_TOPIC' => 'Post a new topic', + 'POST_UNAPPROVED_ACTION' => 'Post awaiting approval:', + 'POST_UNAPPROVED' => 'This post has not been approved.', + 'POST_UNAPPROVED_EXPLAIN' => 'This post is not visible to other users until it has been approved by a moderator.', + 'POWERED_BY' => 'Powered by %s', + 'PREVIEW' => 'Preview', + 'PREVIOUS' => 'Previous', // Used in pagination + 'PREVIOUS_STEP' => 'Previous', + 'PRIVACY' => 'Privacy policy', + 'PRIVACY_LINK' => 'Privacy', + 'PRIVATE_MESSAGE' => 'Private message', + 'PRIVATE_MESSAGES' => 'Private messages', + 'PRIVATE_MESSAGING' => 'Private messaging', + 'PROFILE' => 'User Control Panel', + + 'QUICK_LINKS' => 'Quick links', + + 'RANK' => 'Rank', + 'READING_FORUM' => 'Viewing topics in %s', + 'READING_GLOBAL_ANNOUNCE' => 'Reading global announcement', + 'READING_LINK' => 'Following forum link %s', + 'READING_TOPIC' => 'Reading topic in %s', + 'READ_PROFILE' => 'Profile', + 'REASON' => 'Reason', + 'RECORD_ONLINE_USERS' => 'Most users ever online was %1$s on %2$s', + 'REDIRECT' => 'Redirect', + 'REDIRECTS' => 'Total redirects', + 'REGISTER' => 'Register', + 'REGISTERED_USERS' => 'Registered users:', + // "... and 2 hidden users online" + 'REG_USERS_ONLINE' => array( + 1 => 'There is %1$d registered user and %2$s online', + 2 => 'There are %1$d registered users and %2$s online', + ), + 'REG_USERS_TOTAL' => array( + 1 => '%d registered', + 2 => '%d registered', + ), + 'REMOVE' => 'Remove', + 'REMOVE_INSTALL' => 'Please delete, move or rename the install directory before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible.', + 'REPLIES' => 'Replies', + 'REPLY_WITH_QUOTE' => 'Reply with quote', + 'REPLYING_GLOBAL_ANNOUNCE' => 'Replying to global announcement', + 'REPLYING_MESSAGE' => 'Replying to message in %s', + 'REPORT_BY' => 'Report by', + 'REPORT_POST' => 'Report this post', + 'REPORTING_POST' => 'Reporting post', + 'RESEND_ACTIVATION' => 'Resend activation email', + 'RESET' => 'Reset', + 'RESTORE_PERMISSIONS' => 'Restore permissions', + 'RETURN_INDEX' => '%sReturn to the index page%s', + 'RETURN_FORUM' => '%sReturn to the forum last visited%s', + 'RETURN_PAGE' => '%sReturn to the previous page%s', + 'RETURN_TOPIC' => '%sReturn to the topic last visited%s', + 'RETURN_TO' => 'Return to “%s”', + 'RETURN_TO_INDEX' => 'Return to Board Index', + 'FEED' => 'Feed', + 'FEED_NEWS' => 'News', + 'FEED_TOPICS_ACTIVE' => 'Active Topics', + 'FEED_TOPICS_NEW' => 'New Topics', + 'RULES_ATTACH_CAN' => 'You can post attachments in this forum', + 'RULES_ATTACH_CANNOT' => 'You cannot post attachments in this forum', + 'RULES_DELETE_CAN' => 'You can delete your posts in this forum', + 'RULES_DELETE_CANNOT' => 'You cannot delete your posts in this forum', + 'RULES_DOWNLOAD_CAN' => 'You can download attachments in this forum', + 'RULES_DOWNLOAD_CANNOT' => 'You cannot download attachments in this forum', + 'RULES_EDIT_CAN' => 'You can edit your posts in this forum', + 'RULES_EDIT_CANNOT' => 'You cannot edit your posts in this forum', + 'RULES_LOCK_CAN' => 'You can lock your topics in this forum', + 'RULES_LOCK_CANNOT' => 'You cannot lock your topics in this forum', + 'RULES_POST_CAN' => 'You can post new topics in this forum', + 'RULES_POST_CANNOT' => 'You cannot post new topics in this forum', + 'RULES_REPLY_CAN' => 'You can reply to topics in this forum', + 'RULES_REPLY_CANNOT' => 'You cannot reply to topics in this forum', + 'RULES_VOTE_CAN' => 'You can vote in polls in this forum', + 'RULES_VOTE_CANNOT' => 'You cannot vote in polls in this forum', + + 'SEARCH' => 'Search', + 'SEARCH_MINI' => 'Search…', + 'SEARCH_ADV' => 'Advanced search', + 'SEARCH_ADV_EXPLAIN' => 'View the advanced search options', + 'SEARCH_KEYWORDS' => 'Search for keywords', + 'SEARCHING_FORUMS' => 'Searching forums', + 'SEARCH_ACTIVE_TOPICS' => 'Active topics', + 'SEARCH_FOR' => 'Search for', + 'SEARCH_FORUM' => 'Search this forum…', + 'SEARCH_NEW' => 'New posts', + 'SEARCH_POSTS_BY' => 'Search posts by', + 'SEARCH_SELF' => 'Your posts', + 'SEARCH_TOPIC' => 'Search this topic…', + 'SEARCH_UNANSWERED' => 'Unanswered topics', + 'SEARCH_UNREAD' => 'Unread posts', + 'SEARCH_USER_POSTS' => 'Search user’s posts', + 'SECONDS' => 'Seconds', + 'SEE_ALL' => 'See All', + 'SELECT' => 'Select', + 'SELECT_ALL_CODE' => 'Select all', + 'SELECT_DESTINATION_FORUM' => 'Please select a destination forum', + 'SELECT_FORUM' => 'Select a forum', + 'SEND_EMAIL' => 'Send email', // Used for submit buttons + 'SEND_EMAIL_USER' => 'Send email to %s', + 'SEND_PRIVATE_MESSAGE' => 'Send private message', + 'SETTINGS' => 'Settings', + 'SIGNATURE' => 'Signature', + 'SKIP' => 'Skip to content', + 'SKYPE' => 'Skype', + 'SMTP_NO_AUTH_SUPPORT' => 'SMTP server does not support authentication.', + 'SORRY_AUTH_READ' => 'You are not authorised to read this forum.', + 'SORRY_AUTH_READ_TOPIC' => 'You are not authorised to read this topic.', + 'SORRY_AUTH_VIEW_ATTACH' => 'You are not authorised to download this attachment.', + 'SORT_BY' => 'Sort by', + 'SORT_DIRECTION' => 'Direction', + 'SORT_JOINED' => 'Joined date', + 'SORT_LOCATION' => 'Location', + 'SORT_OPTIONS' => 'Display and sorting options', + 'SORT_RANK' => 'Rank', + 'SORT_POSTS' => 'Posts', + 'SORT_TOPIC_TITLE' => 'Topic title', + 'SORT_USERNAME' => 'Username', + 'SPLIT_TOPIC' => 'Split topic', + 'SQL_ERROR_OCCURRED' => 'An SQL error occurred while fetching this page. Please contact the %sBoard Administrator%s if this problem persists.', + 'STATISTICS' => 'Statistics', + 'START_WATCHING_FORUM' => 'Subscribe forum', + 'START_WATCHING_TOPIC' => 'Subscribe topic', + 'STOP_WATCHING_FORUM' => 'Unsubscribe forum', + 'STOP_WATCHING_TOPIC' => 'Unsubscribe topic', + 'STRING_LIST_MULTI' => '%1$s, and %2$s', + 'STRING_LIST_SIMPLE' => '%1$s and %2$s', + 'SUBFORUM' => 'Subforum', + 'SUBFORUMS' => 'Subforums', + 'SUBJECT' => 'Subject', + 'SUBMIT' => 'Submit', + + 'TB' => 'TB', + 'TERMS_LINK' => 'Terms', + 'TERMS_USE' => 'Terms of use', + 'TEST_CONNECTION' => 'Test connection', + 'THE_TEAM' => 'The team', + 'TIB' => 'TiB', + 'TIME' => 'Time', + 'TIMEOUT_PROCESSING_REQ' => 'Request timed out.', + + 'TOO_LARGE' => 'The value you entered is too large.', + 'TOO_LARGE_MAX_RECIPIENTS' => 'The value of Maximum number of allowed recipients per private message setting you entered is too large.', + + 'TOO_LONG' => 'The value you entered is too long.', + + 'TOO_LONG_CONFIRM_CODE' => 'The confirm code you entered is too long.', + 'TOO_LONG_DATEFORMAT' => 'The date format you entered is too long.', + 'TOO_LONG_JABBER' => 'The Jabber account name you entered is too long.', + 'TOO_LONG_NEW_PASSWORD' => 'The password you entered is too long.', + 'TOO_LONG_PASSWORD_CONFIRM' => 'The password confirmation you entered is too long.', + 'TOO_LONG_USER_PASSWORD' => 'The password you entered is too long.', + 'TOO_LONG_USERNAME' => 'The username you entered is too long.', + 'TOO_LONG_EMAIL' => 'The email address you entered is too long.', + + 'TOO_MANY_VOTE_OPTIONS' => 'You have tried to vote for too many options.', + + 'TOO_SHORT' => 'The value you entered is too short.', + + 'TOO_SHORT_CONFIRM_CODE' => 'The confirm code you entered is too short.', + 'TOO_SHORT_DATEFORMAT' => 'The date format you entered is too short.', + 'TOO_SHORT_JABBER' => 'The Jabber account name you entered is too short.', + 'TOO_SHORT_NEW_PASSWORD' => 'The password you entered is too short.', + 'TOO_SHORT_PASSWORD_CONFIRM' => 'The password confirmation you entered is too short.', + 'TOO_SHORT_USER_PASSWORD' => 'The password you entered is too short.', + 'TOO_SHORT_USERNAME' => 'The username you entered is too short.', + 'TOO_SHORT_EMAIL' => 'The email address you entered is too short.', + 'TOO_SHORT_EMAIL_CONFIRM' => 'The email address confirmation you entered is too short.', + 'TOO_SMALL' => 'The value you entered is too small.', + 'TOO_SMALL_MAX_RECIPIENTS' => 'The value of Maximum number of allowed recipients per private message setting you entered is too small.', + + 'TOPIC' => 'Topic', + 'TOPICS' => 'Topics', + 'TOPICS_UNAPPROVED' => 'At least one topic in this forum has not been approved.', + 'TOPIC_ICON' => 'Topic icon', + 'TOPIC_LOCKED' => 'This topic is locked, you cannot edit posts or make further replies.', + 'TOPIC_LOCKED_SHORT'=> 'Topic locked', + 'TOPIC_MOVED' => 'Moved topic', + 'TOPIC_REVIEW' => 'Topic review', + 'TOPIC_TITLE' => 'Topic title', + 'TOPIC_UNAPPROVED' => 'This topic has not been approved.', + 'TOPIC_UNAPPROVED_FORUM' => array( + 1 => 'Topic awaiting approval', + 2 => 'Topics awaiting approval', + ), + 'TOPIC_DELETED' => 'This topic has been deleted.', + 'TOTAL_ATTACHMENTS' => 'Attachment(s)', + 'TOTAL_LOGS' => array( + 1 => '%d log', + 2 => '%d logs', + ), + 'TOTAL_PMS' => array( + 1 => '%d private message in total', + 2 => '%d private messages in total', + ), + 'TOPIC_POLL' => 'This topic has a poll.', + 'TOTAL_POSTS' => 'Total posts', + 'TOTAL_POSTS_COUNT' => array( + 2 => 'Total posts %d', + ), + 'TOPIC_REPORTED' => 'This topic has been reported', + 'TOTAL_TOPICS' => array( + 2 => 'Total topics %d', + ), + 'TOTAL_USERS' => array( + 2 => 'Total members %d', + ), + 'TRACKED_PHP_ERROR' => 'Tracked PHP errors: %s', + 'TWITTER' => 'Twitter', + + 'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image. Please verify that the URL you entered is correct.', + 'UNABLE_TO_DELIVER_FILE'=> 'Unable to deliver file.', + 'UNKNOWN_BROWSER' => 'Unknown browser', + 'UNMARK_ALL' => 'Unmark all', + 'UNREAD_MESSAGES' => 'Unread messages', + 'UNREAD_POST' => 'Unread post', + 'UNREAD_POSTS' => 'Unread posts', + 'UNWATCH_FORUM_CONFIRM' => 'Are you sure you wish to unsubscribe from this forum?', + 'UNWATCH_FORUM_DETAILED' => 'Are you sure you wish to unsubscribe from the forum “%s”?', + 'UNWATCH_TOPIC_CONFIRM' => 'Are you sure you wish to unsubscribe from this topic?', + 'UNWATCH_TOPIC_DETAILED' => 'Are you sure you wish to unsubscribe from the topic “%s”?', + 'UNWATCHED_FORUMS' => 'You are no longer subscribed to the selected forums.', + 'UNWATCHED_TOPICS' => 'You are no longer subscribed to the selected topics.', + 'UNWATCHED_FORUMS_TOPICS' => 'You are no longer subscribed to the selected entries.', + 'UPDATE' => 'Update', + 'UPLOAD_IN_PROGRESS' => 'The upload is currently in progress.', + 'URL_REDIRECT' => 'If your browser does not support meta redirection %splease click HERE to be redirected%s.', + 'USERGROUPS' => 'Groups', + 'USERNAME' => 'Username', + 'USERNAMES' => 'Usernames', + 'USER_AVATAR' => 'User avatar', + 'USER_CANNOT_READ' => 'You cannot read posts in this forum.', + 'USER_POSTS' => array( + 1 => '%d Post', + 2 => '%d Posts', + ), + 'USERS' => 'Users', + 'USE_PERMISSIONS' => 'Test out user’s permissions', + + 'USER_NEW_PERMISSION_DISALLOWED' => 'We are sorry, but you are not authorised to use this feature. You may have just registered here and may need to participate more in discussions to be able to use this feature.', + + 'VARIANT_DATE_SEPARATOR' => ' / ', // Used in date format dropdown, eg: "Today, 13:37 / 01 Jan 2007, 13:37" ... to join a relative date with calendar date + 'VIEWED' => 'Viewed', + 'VIEWED_COUNTS' => array( + 0 => 'Not viewed yet', + 1 => 'Viewed %d time', + 2 => 'Viewed %d times', + ), + 'VIEWING_CONTACT_ADMIN' => 'Viewing contact page', + 'VIEWING_FAQ' => 'Viewing FAQ', + 'VIEWING_MEMBERS' => 'Viewing member details', + 'VIEWING_ONLINE' => 'Viewing who is online', + 'VIEWING_MCP' => 'Viewing moderator control panel', + 'VIEWING_MEMBER_PROFILE' => 'Viewing member profile', + 'VIEWING_PRIVATE_MESSAGES' => 'Viewing private messages', + 'VIEWING_REGISTER' => 'Registering account', + 'VIEWING_UCP' => 'Viewing user control panel', + 'VIEWS' => 'Views', + 'VIEW_BOOKMARKS' => 'View bookmarks', + 'VIEW_FORUM_LOGS' => 'View Logs', + 'VIEW_LATEST_POST' => 'View the latest post', + 'VIEW_NEWEST_POST' => 'View first unread post', + 'VIEW_NOTES' => 'View user notes', + 'VIEW_ONLINE_TIMES' => array( + 1 => 'based on users active over the past %d minute', + 2 => 'based on users active over the past %d minutes', + ), + 'VIEW_TOPIC' => 'View topic', + 'VIEW_TOPIC_ANNOUNCEMENT' => 'Announcement: ', + 'VIEW_TOPIC_GLOBAL' => 'Global Announcement: ', + 'VIEW_TOPIC_LOCKED' => 'Locked: ', + 'VIEW_TOPIC_LOGS' => 'View logs', + 'VIEW_TOPIC_MOVED' => 'Moved: ', + 'VIEW_TOPIC_POLL' => 'Poll: ', + 'VIEW_TOPIC_STICKY' => 'Sticky: ', + 'VISIT_WEBSITE' => 'Visit website', + + 'WARNINGS' => 'Warnings', + 'WARN_USER' => 'Warn user', + 'WATCH_FORUM_CONFIRM' => 'Are you sure you wish to subscribe to this forum?', + 'WATCH_FORUM_DETAILED' => 'Are you sure you wish to subscribe to the forum “%s”?', + 'WATCH_TOPIC_CONFIRM' => 'Are you sure you wish to subscribe to this topic?', + 'WATCH_TOPIC_DETAILED' => 'Are you sure you wish to subscribe to the topic “%s”?', + 'WELCOME_SUBJECT' => 'Welcome to %s forums', + 'WEBSITE' => 'Website', + 'WHOIS' => 'Whois', + 'WHO_IS_ONLINE' => 'Who is online', + 'WRONG_PASSWORD' => 'You entered an incorrect password.', + + 'WRONG_DATA_COLOUR' => 'The colour value you entered is invalid.', + 'WRONG_DATA_JABBER' => 'The name you entered is not a valid Jabber account name.', + 'WRONG_DATA_LANG' => 'The language you specified is not valid.', + 'WRONG_DATA_POST_SD' => 'The post sort direction you specified is not valid.', + 'WRONG_DATA_POST_SK' => 'The post sort option you specified is not valid.', + 'WRONG_DATA_TOPIC_SD' => 'The topic sort direction you specified is not valid.', + 'WRONG_DATA_TOPIC_SK' => 'The topic sort option you specified is not valid.', + 'WROTE' => 'wrote', + + 'YAHOO' => 'Yahoo Messenger', + 'YOUTUBE' => 'YouTube', + 'YEAR' => 'Year', + 'YEAR_MONTH_DAY' => '(YYYY-MM-DD)', + 'YES' => 'Yes', + 'YOU_LAST_VISIT' => 'Last visit was: %s', + + 'datetime' => array( + 'TODAY' => 'Today', + 'TOMORROW' => 'Tomorrow', + 'YESTERDAY' => 'Yesterday', + 'AGO' => array( + 0 => 'less than a minute ago', + 1 => '%d minute ago', + 2 => '%d minutes ago', + ), + + 'Sunday' => 'Sunday', + 'Monday' => 'Monday', + 'Tuesday' => 'Tuesday', + 'Wednesday' => 'Wednesday', + 'Thursday' => 'Thursday', + 'Friday' => 'Friday', + 'Saturday' => 'Saturday', + + 'Sun' => 'Sun', + 'Mon' => 'Mon', + 'Tue' => 'Tue', + 'Wed' => 'Wed', + 'Thu' => 'Thu', + 'Fri' => 'Fri', + 'Sat' => 'Sat', + + 'January' => 'January', + 'February' => 'February', + 'March' => 'March', + 'April' => 'April', + 'May' => 'May', + 'June' => 'June', + 'July' => 'July', + 'August' => 'August', + 'September' => 'September', + 'October' => 'October', + 'November' => 'November', + 'December' => 'December', + + 'Jan' => 'Jan', + 'Feb' => 'Feb', + 'Mar' => 'Mar', + 'Apr' => 'Apr', + 'May_short' => 'May', // Short representation of "May". May_short used because in English the short and long date are the same for May. + 'Jun' => 'Jun', + 'Jul' => 'Jul', + 'Aug' => 'Aug', + 'Sep' => 'Sep', + 'Oct' => 'Oct', + 'Nov' => 'Nov', + 'Dec' => 'Dec', + ), + + // Timezones can be translated. We use this for the Etc/GMT timezones here, + // because they are named invers to their offset. + 'timezones' => array( + 'UTC' => 'UTC', + 'UTC_OFFSET' => 'UTC%1$s', + 'UTC_OFFSET_CURRENT' => 'UTC%1$s - %2$s', + + 'Etc/GMT-12' => 'UTC+12', + 'Etc/GMT-11' => 'UTC+11', + 'Etc/GMT-10' => 'UTC+10', + 'Etc/GMT-9' => 'UTC+9', + 'Etc/GMT-8' => 'UTC+8', + 'Etc/GMT-7' => 'UTC+7', + 'Etc/GMT-6' => 'UTC+6', + 'Etc/GMT-5' => 'UTC+5', + 'Etc/GMT-4' => 'UTC+4', + 'Etc/GMT-3' => 'UTC+3', + 'Etc/GMT-2' => 'UTC+2', + 'Etc/GMT-1' => 'UTC+1', + 'Etc/GMT+1' => 'UTC-1', + 'Etc/GMT+2' => 'UTC-2', + 'Etc/GMT+3' => 'UTC-3', + 'Etc/GMT+4' => 'UTC-4', + 'Etc/GMT+5' => 'UTC-5', + 'Etc/GMT+6' => 'UTC-6', + 'Etc/GMT+7' => 'UTC-7', + 'Etc/GMT+8' => 'UTC-8', + 'Etc/GMT+9' => 'UTC-9', + 'Etc/GMT+10' => 'UTC-10', + 'Etc/GMT+11' => 'UTC-11', + 'Etc/GMT+12' => 'UTC-12', + + 'Africa/Abidjan' => 'Africa/Abidjan', + 'Africa/Accra' => 'Africa/Accra', + 'Africa/Addis_Ababa' => 'Africa/Addis Ababa', + 'Africa/Algiers' => 'Africa/Algiers', + 'Africa/Asmara' => 'Africa/Asmara', + 'Africa/Bamako' => 'Africa/Bamako', + 'Africa/Bangui' => 'Africa/Bangui', + 'Africa/Banjul' => 'Africa/Banjul', + 'Africa/Bissau' => 'Africa/Bissau', + 'Africa/Blantyre' => 'Africa/Blantyre', + 'Africa/Brazzaville' => 'Africa/Brazzaville', + 'Africa/Bujumbura' => 'Africa/Bujumbura', + 'Africa/Cairo' => 'Africa/Cairo', + 'Africa/Casablanca' => 'Africa/Casablanca', + 'Africa/Ceuta' => 'Africa/Ceuta', + 'Africa/Conakry' => 'Africa/Conakry', + 'Africa/Dakar' => 'Africa/Dakar', + 'Africa/Dar_es_Salaam' => 'Africa/Dar es Salaam', + 'Africa/Djibouti' => 'Africa/Djibouti', + 'Africa/Douala' => 'Africa/Douala', + 'Africa/El_Aaiun' => 'Africa/El Aaiun', + 'Africa/Freetown' => 'Africa/Freetown', + 'Africa/Gaborone' => 'Africa/Gaborone', + 'Africa/Harare' => 'Africa/Harare', + 'Africa/Johannesburg' => 'Africa/Johannesburg', + 'Africa/Juba' => 'Africa/Juba', + 'Africa/Kampala' => 'Africa/Kampala', + 'Africa/Khartoum' => 'Africa/Khartoum', + 'Africa/Kigali' => 'Africa/Kigali', + 'Africa/Kinshasa' => 'Africa/Kinshasa', + 'Africa/Lagos' => 'Africa/Lagos', + 'Africa/Libreville' => 'Africa/Libreville', + 'Africa/Lome' => 'Africa/Lome', + 'Africa/Luanda' => 'Africa/Luanda', + 'Africa/Lubumbashi' => 'Africa/Lubumbashi', + 'Africa/Lusaka' => 'Africa/Lusaka', + 'Africa/Malabo' => 'Africa/Malabo', + 'Africa/Maputo' => 'Africa/Maputo', + 'Africa/Maseru' => 'Africa/Maseru', + 'Africa/Mbabane' => 'Africa/Mbabane', + 'Africa/Mogadishu' => 'Africa/Mogadishu', + 'Africa/Monrovia' => 'Africa/Monrovia', + 'Africa/Nairobi' => 'Africa/Nairobi', + 'Africa/Ndjamena' => 'Africa/Ndjamena', + 'Africa/Niamey' => 'Africa/Niamey', + 'Africa/Nouakchott' => 'Africa/Nouakchott', + 'Africa/Ouagadougou' => 'Africa/Ouagadougou', + 'Africa/Porto-Novo' => 'Africa/Porto-Novo', + 'Africa/Sao_Tome' => 'Africa/Sao Tome', + 'Africa/Tripoli' => 'Africa/Tripoli', + 'Africa/Tunis' => 'Africa/Tunis', + 'Africa/Windhoek' => 'Africa/Windhoek', + + 'America/Adak' => 'America/Adak', + 'America/Anchorage' => 'America/Anchorage', + 'America/Anguilla' => 'America/Anguilla', + 'America/Antigua' => 'America/Antigua', + 'America/Araguaina' => 'America/Araguaina', + + 'America/Argentina/Buenos_Aires' => 'America/Argentina/Buenos Aires', + 'America/Argentina/Catamarca' => 'America/Argentina/Catamarca', + 'America/Argentina/Cordoba' => 'America/Argentina/Cordoba', + 'America/Argentina/Jujuy' => 'America/Argentina/Jujuy', + 'America/Argentina/La_Rioja' => 'America/Argentina/La Rioja', + 'America/Argentina/Mendoza' => 'America/Argentina/Mendoza', + 'America/Argentina/Rio_Gallegos' => 'America/Argentina/Rio Gallegos', + 'America/Argentina/Salta' => 'America/Argentina/Salta', + 'America/Argentina/San_Juan' => 'America/Argentina/San Juan', + 'America/Argentina/San_Luis' => 'America/Argentina/San Luis', + 'America/Argentina/Tucuman' => 'America/Argentina/Tucuman', + 'America/Argentina/Ushuaia' => 'America/Argentina/Ushuaia', + + 'America/Aruba' => 'America/Aruba', + 'America/Asuncion' => 'America/Asuncion', + 'America/Atikokan' => 'America/Atikokan', + 'America/Bahia' => 'America/Bahia', + 'America/Bahia_Banderas' => 'America/Bahia Banderas', + 'America/Barbados' => 'America/Barbados', + 'America/Belem' => 'America/Belem', + 'America/Belize' => 'America/Belize', + 'America/Blanc-Sablon' => 'America/Blanc-Sablon', + 'America/Boa_Vista' => 'America/Boa Vista', + 'America/Bogota' => 'America/Bogota', + 'America/Boise' => 'America/Boise', + 'America/Cambridge_Bay' => 'America/Cambridge Bay', + 'America/Campo_Grande' => 'America/Campo Grande', + 'America/Cancun' => 'America/Cancun', + 'America/Caracas' => 'America/Caracas', + 'America/Cayenne' => 'America/Cayenne', + 'America/Cayman' => 'America/Cayman', + 'America/Chicago' => 'America/Chicago', + 'America/Chihuahua' => 'America/Chihuahua', + 'America/Costa_Rica' => 'America/Costa Rica', + 'America/Creston' => 'America/Creston', + 'America/Cuiaba' => 'America/Cuiaba', + 'America/Curacao' => 'America/Curacao', + 'America/Danmarkshavn' => 'America/Danmarkshavn', + 'America/Dawson' => 'America/Dawson', + 'America/Dawson_Creek' => 'America/Dawson Creek', + 'America/Denver' => 'America/Denver', + 'America/Detroit' => 'America/Detroit', + 'America/Dominica' => 'America/Dominica', + 'America/Edmonton' => 'America/Edmonton', + 'America/Eirunepe' => 'America/Eirunepe', + 'America/El_Salvador' => 'America/El Salvador', + 'America/Fortaleza' => 'America/Fortaleza', + 'America/Glace_Bay' => 'America/Glace Bay', + 'America/Godthab' => 'America/Godthab', + 'America/Goose_Bay' => 'America/Goose Bay', + 'America/Grand_Turk' => 'America/Grand Turk', + 'America/Grenada' => 'America/Grenada', + 'America/Guadeloupe' => 'America/Guadeloupe', + 'America/Guatemala' => 'America/Guatemala', + 'America/Guayaquil' => 'America/Guayaquil', + 'America/Guyana' => 'America/Guyana', + 'America/Halifax' => 'America/Halifax', + 'America/Havana' => 'America/Havana', + 'America/Hermosillo' => 'America/Hermosillo', + 'America/Indiana/Indianapolis' => 'America/Indiana/Indianapolis', + 'America/Indiana/Knox' => 'America/Indiana/Knox', + 'America/Indiana/Marengo' => 'America/Indiana/Marengo', + 'America/Indiana/Petersburg' => 'America/Indiana/Petersburg', + 'America/Indiana/Tell_City' => 'America/Indiana/Tell City', + 'America/Indiana/Vevay' => 'America/Indiana/Vevay', + 'America/Indiana/Vincennes' => 'America/Indiana/Vincennes', + 'America/Indiana/Winamac' => 'America/Indiana/Winamac', + 'America/Inuvik' => 'America/Inuvik', + 'America/Iqaluit' => 'America/Iqaluit', + 'America/Jamaica' => 'America/Jamaica', + 'America/Juneau' => 'America/Juneau', + 'America/Kentucky/Louisville' => 'America/Kentucky/Louisville', + 'America/Kentucky/Monticello' => 'America/Kentucky/Monticello', + 'America/Kralendijk' => 'America/Kralendijk', + 'America/La_Paz' => 'America/La Paz', + 'America/Lima' => 'America/Lima', + 'America/Los_Angeles' => 'America/Los Angeles', + 'America/Lower_Princes' => 'America/Lower Princes', + 'America/Maceio' => 'America/Maceio', + 'America/Managua' => 'America/Managua', + 'America/Manaus' => 'America/Manaus', + 'America/Marigot' => 'America/Marigot', + 'America/Martinique' => 'America/Martinique', + 'America/Matamoros' => 'America/Matamoros', + 'America/Mazatlan' => 'America/Mazatlan', + 'America/Menominee' => 'America/Menominee', + 'America/Merida' => 'America/Merida', + 'America/Metlakatla' => 'America/Metlakatla', + 'America/Mexico_City' => 'America/Mexico City', + 'America/Miquelon' => 'America/Miquelon', + 'America/Moncton' => 'America/Moncton', + 'America/Monterrey' => 'America/Monterrey', + 'America/Montevideo' => 'America/Montevideo', + 'America/Montreal' => 'America/Montreal', + 'America/Montserrat' => 'America/Montserrat', + 'America/Nassau' => 'America/Nassau', + 'America/New_York' => 'America/New York', + 'America/Nipigon' => 'America/Nipigon', + 'America/Nome' => 'America/Nome', + 'America/Noronha' => 'America/Noronha', + 'America/North_Dakota/Beulah' => 'America/North Dakota/Beulah', + 'America/North_Dakota/Center' => 'America/North Dakota/Center', + 'America/North_Dakota/New_Salem' => 'America/North Dakota/New Salem', + 'America/Ojinaga' => 'America/Ojinaga', + 'America/Panama' => 'America/Panama', + 'America/Pangnirtung' => 'America/Pangnirtung', + 'America/Paramaribo' => 'America/Paramaribo', + 'America/Phoenix' => 'America/Phoenix', + 'America/Port-au-Prince' => 'America/Port-au-Prince', + 'America/Port_of_Spain' => 'America/Port of Spain', + 'America/Porto_Velho' => 'America/Porto Velho', + 'America/Puerto_Rico' => 'America/Puerto Rico', + 'America/Rainy_River' => 'America/Rainy River', + 'America/Rankin_Inlet' => 'America/Rankin Inlet', + 'America/Recife' => 'America/Recife', + 'America/Regina' => 'America/Regina', + 'America/Resolute' => 'America/Resolute', + 'America/Rio_Branco' => 'America/Rio Branco', + 'America/Santa_Isabel' => 'America/Santa Isabel', + 'America/Santarem' => 'America/Santarem', + 'America/Santiago' => 'America/Santiago', + 'America/Santo_Domingo' => 'America/Santo Domingo', + 'America/Sao_Paulo' => 'America/Sao Paulo', + 'America/Scoresbysund' => 'America/Scoresbysund', + 'America/Shiprock' => 'America/Shiprock', + 'America/Sitka' => 'America/Sitka', + 'America/St_Barthelemy' => 'America/St. Barthelemy', + 'America/St_Johns' => 'America/St. Johns', + 'America/St_Kitts' => 'America/St. Kitts', + 'America/St_Lucia' => 'America/St. Lucia', + 'America/St_Thomas' => 'America/St. Thomas', + 'America/St_Vincent' => 'America/St. Vincent', + 'America/Swift_Current' => 'America/Swift Current', + 'America/Tegucigalpa' => 'America/Tegucigalpa', + 'America/Thule' => 'America/Thule', + 'America/Thunder_Bay' => 'America/Thunder Bay', + 'America/Tijuana' => 'America/Tijuana', + 'America/Toronto' => 'America/Toronto', + 'America/Tortola' => 'America/Tortola', + 'America/Vancouver' => 'America/Vancouver', + 'America/Whitehorse' => 'America/Whitehorse', + 'America/Winnipeg' => 'America/Winnipeg', + 'America/Yakutat' => 'America/Yakutat', + 'America/Yellowknife' => 'America/Yellowknife', + + 'Antarctica/Casey' => 'Antarctica/Casey', + 'Antarctica/Davis' => 'Antarctica/Davis', + 'Antarctica/DumontDUrville' => 'Antarctica/DumontDUrville', + 'Antarctica/Macquarie' => 'Antarctica/Macquarie', + 'Antarctica/Mawson' => 'Antarctica/Mawson', + 'Antarctica/McMurdo' => 'Antarctica/McMurdo', + 'Antarctica/Palmer' => 'Antarctica/Palmer', + 'Antarctica/Rothera' => 'Antarctica/Rothera', + 'Antarctica/South_Pole' => 'Antarctica/South Pole', + 'Antarctica/Syowa' => 'Antarctica/Syowa', + 'Antarctica/Vostok' => 'Antarctica/Vostok', + + 'Arctic/Longyearbyen' => 'Arctic/Longyearbyen', + + 'Asia/Aden' => 'Asia/Aden', + 'Asia/Almaty' => 'Asia/Almaty', + 'Asia/Amman' => 'Asia/Amman', + 'Asia/Anadyr' => 'Asia/Anadyr', + 'Asia/Aqtau' => 'Asia/Aqtau', + 'Asia/Aqtobe' => 'Asia/Aqtobe', + 'Asia/Ashgabat' => 'Asia/Ashgabat', + 'Asia/Baghdad' => 'Asia/Baghdad', + 'Asia/Bahrain' => 'Asia/Bahrain', + 'Asia/Baku' => 'Asia/Baku', + 'Asia/Bangkok' => 'Asia/Bangkok', + 'Asia/Beirut' => 'Asia/Beirut', + 'Asia/Bishkek' => 'Asia/Bishkek', + 'Asia/Brunei' => 'Asia/Brunei', + 'Asia/Choibalsan' => 'Asia/Choibalsan', + 'Asia/Chongqing' => 'Asia/Chongqing', + 'Asia/Colombo' => 'Asia/Colombo', + 'Asia/Damascus' => 'Asia/Damascus', + 'Asia/Dhaka' => 'Asia/Dhaka', + 'Asia/Dili' => 'Asia/Dili', + 'Asia/Dubai' => 'Asia/Dubai', + 'Asia/Dushanbe' => 'Asia/Dushanbe', + 'Asia/Gaza' => 'Asia/Gaza', + 'Asia/Harbin' => 'Asia/Harbin', + 'Asia/Hebron' => 'Asia/Hebron', + 'Asia/Ho_Chi_Minh' => 'Asia/Ho Chi Minh', + 'Asia/Hong_Kong' => 'Asia/Hong Kong', + 'Asia/Hovd' => 'Asia/Hovd', + 'Asia/Irkutsk' => 'Asia/Irkutsk', + 'Asia/Jakarta' => 'Asia/Jakarta', + 'Asia/Jayapura' => 'Asia/Jayapura', + 'Asia/Jerusalem' => 'Asia/Jerusalem', + 'Asia/Kabul' => 'Asia/Kabul', + 'Asia/Kamchatka' => 'Asia/Kamchatka', + 'Asia/Karachi' => 'Asia/Karachi', + 'Asia/Kashgar' => 'Asia/Kashgar', + 'Asia/Kathmandu' => 'Asia/Kathmandu', + 'Asia/Khandyga' => 'Asia/Khandyga', + 'Asia/Kolkata' => 'Asia/Kolkata', + 'Asia/Krasnoyarsk' => 'Asia/Krasnoyarsk', + 'Asia/Kuala_Lumpur' => 'Asia/Kuala Lumpur', + 'Asia/Kuching' => 'Asia/Kuching', + 'Asia/Kuwait' => 'Asia/Kuwait', + 'Asia/Macau' => 'Asia/Macau', + 'Asia/Magadan' => 'Asia/Magadan', + 'Asia/Makassar' => 'Asia/Makassar', + 'Asia/Manila' => 'Asia/Manila', + 'Asia/Muscat' => 'Asia/Muscat', + 'Asia/Nicosia' => 'Asia/Nicosia', + 'Asia/Novokuznetsk' => 'Asia/Novokuznetsk', + 'Asia/Novosibirsk' => 'Asia/Novosibirsk', + 'Asia/Omsk' => 'Asia/Omsk', + 'Asia/Oral' => 'Asia/Oral', + 'Asia/Phnom_Penh' => 'Asia/Phnom Penh', + 'Asia/Pontianak' => 'Asia/Pontianak', + 'Asia/Pyongyang' => 'Asia/Pyongyang', + 'Asia/Qatar' => 'Asia/Qatar', + 'Asia/Qyzylorda' => 'Asia/Qyzylorda', + 'Asia/Rangoon' => 'Asia/Rangoon', + 'Asia/Riyadh' => 'Asia/Riyadh', + 'Asia/Sakhalin' => 'Asia/Sakhalin', + 'Asia/Samarkand' => 'Asia/Samarkand', + 'Asia/Seoul' => 'Asia/Seoul', + 'Asia/Shanghai' => 'Asia/Shanghai', + 'Asia/Singapore' => 'Asia/Singapore', + 'Asia/Taipei' => 'Asia/Taipei', + 'Asia/Tashkent' => 'Asia/Tashkent', + 'Asia/Tbilisi' => 'Asia/Tbilisi', + 'Asia/Tehran' => 'Asia/Tehran', + 'Asia/Thimphu' => 'Asia/Thimphu', + 'Asia/Tokyo' => 'Asia/Tokyo', + 'Asia/Ulaanbaatar' => 'Asia/Ulaanbaatar', + 'Asia/Urumqi' => 'Asia/Urumqi', + 'Asia/Ust-Nera' => 'Asia/Ust-Nera', + 'Asia/Vientiane' => 'Asia/Vientiane', + 'Asia/Vladivostok' => 'Asia/Vladivostok', + 'Asia/Yakutsk' => 'Asia/Yakutsk', + 'Asia/Yekaterinburg' => 'Asia/Yekaterinburg', + 'Asia/Yerevan' => 'Asia/Yerevan', + + 'Atlantic/Azores' => 'Atlantic/Azores', + 'Atlantic/Bermuda' => 'Atlantic/Bermuda', + 'Atlantic/Canary' => 'Atlantic/Canary', + 'Atlantic/Cape_Verde' => 'Atlantic/Cape Verde', + 'Atlantic/Faroe' => 'Atlantic/Faroe', + 'Atlantic/Madeira' => 'Atlantic/Madeira', + 'Atlantic/Reykjavik' => 'Atlantic/Reykjavik', + 'Atlantic/South_Georgia' => 'Atlantic/South Georgia', + 'Atlantic/St_Helena' => 'Atlantic/St. Helena', + 'Atlantic/Stanley' => 'Atlantic/Stanley', + + 'Australia/Adelaide' => 'Australia/Adelaide', + 'Australia/Brisbane' => 'Australia/Brisbane', + 'Australia/Broken_Hill' => 'Australia/Broken Hill', + 'Australia/Currie' => 'Australia/Currie', + 'Australia/Darwin' => 'Australia/Darwin', + 'Australia/Eucla' => 'Australia/Eucla', + 'Australia/Hobart' => 'Australia/Hobart', + 'Australia/Lindeman' => 'Australia/Lindeman', + 'Australia/Lord_Howe' => 'Australia/Lord Howe', + 'Australia/Melbourne' => 'Australia/Melbourne', + 'Australia/Perth' => 'Australia/Perth', + 'Australia/Sydney' => 'Australia/Sydney', + + 'Europe/Amsterdam' => 'Europe/Amsterdam', + 'Europe/Andorra' => 'Europe/Andorra', + 'Europe/Athens' => 'Europe/Athens', + 'Europe/Belgrade' => 'Europe/Belgrade', + 'Europe/Berlin' => 'Europe/Berlin', + 'Europe/Bratislava' => 'Europe/Bratislava', + 'Europe/Brussels' => 'Europe/Brussels', + 'Europe/Bucharest' => 'Europe/Bucharest', + 'Europe/Budapest' => 'Europe/Budapest', + 'Europe/Busingen' => 'Europe/Busingen', + 'Europe/Chisinau' => 'Europe/Chisinau', + 'Europe/Copenhagen' => 'Europe/Copenhagen', + 'Europe/Dublin' => 'Europe/Dublin', + 'Europe/Gibraltar' => 'Europe/Gibraltar', + 'Europe/Guernsey' => 'Europe/Guernsey', + 'Europe/Helsinki' => 'Europe/Helsinki', + 'Europe/Isle_of_Man' => 'Europe/Isle of Man', + 'Europe/Istanbul' => 'Europe/Istanbul', + 'Europe/Jersey' => 'Europe/Jersey', + 'Europe/Kaliningrad' => 'Europe/Kaliningrad', + 'Europe/Kiev' => 'Europe/Kiev', + 'Europe/Lisbon' => 'Europe/Lisbon', + 'Europe/Ljubljana' => 'Europe/Ljubljana', + 'Europe/London' => 'Europe/London', + 'Europe/Luxembourg' => 'Europe/Luxembourg', + 'Europe/Madrid' => 'Europe/Madrid', + 'Europe/Malta' => 'Europe/Malta', + 'Europe/Mariehamn' => 'Europe/Mariehamn', + 'Europe/Minsk' => 'Europe/Minsk', + 'Europe/Monaco' => 'Europe/Monaco', + 'Europe/Moscow' => 'Europe/Moscow', + 'Europe/Oslo' => 'Europe/Oslo', + 'Europe/Paris' => 'Europe/Paris', + 'Europe/Podgorica' => 'Europe/Podgorica', + 'Europe/Prague' => 'Europe/Prague', + 'Europe/Riga' => 'Europe/Riga', + 'Europe/Rome' => 'Europe/Rome', + 'Europe/Samara' => 'Europe/Samara', + 'Europe/San_Marino' => 'Europe/San Marino', + 'Europe/Sarajevo' => 'Europe/Sarajevo', + 'Europe/Simferopol' => 'Europe/Simferopol', + 'Europe/Skopje' => 'Europe/Skopje', + 'Europe/Sofia' => 'Europe/Sofia', + 'Europe/Stockholm' => 'Europe/Stockholm', + 'Europe/Tallinn' => 'Europe/Tallinn', + 'Europe/Tirane' => 'Europe/Tirane', + 'Europe/Uzhgorod' => 'Europe/Uzhgorod', + 'Europe/Vaduz' => 'Europe/Vaduz', + 'Europe/Vatican' => 'Europe/Vatican', + 'Europe/Vienna' => 'Europe/Vienna', + 'Europe/Vilnius' => 'Europe/Vilnius', + 'Europe/Volgograd' => 'Europe/Volgograd', + 'Europe/Warsaw' => 'Europe/Warsaw', + 'Europe/Zagreb' => 'Europe/Zagreb', + 'Europe/Zaporozhye' => 'Europe/Zaporozhye', + 'Europe/Zurich' => 'Europe/Zurich', + + 'Indian/Antananarivo' => 'Indian/Antananarivo', + 'Indian/Chagos' => 'Indian/Chagos', + 'Indian/Christmas' => 'Indian/Christmas', + 'Indian/Cocos' => 'Indian/Cocos', + 'Indian/Comoro' => 'Indian/Comoro', + 'Indian/Kerguelen' => 'Indian/Kerguelen', + 'Indian/Mahe' => 'Indian/Mahe', + 'Indian/Maldives' => 'Indian/Maldives', + 'Indian/Mauritius' => 'Indian/Mauritius', + 'Indian/Mayotte' => 'Indian/Mayotte', + 'Indian/Reunion' => 'Indian/Reunion', + + 'Pacific/Apia' => 'Pacific/Apia', + 'Pacific/Auckland' => 'Pacific/Auckland', + 'Pacific/Chatham' => 'Pacific/Chatham', + 'Pacific/Chuuk' => 'Pacific/Chuuk', + 'Pacific/Easter' => 'Pacific/Easter', + 'Pacific/Efate' => 'Pacific/Efate', + 'Pacific/Enderbury' => 'Pacific/Enderbury', + 'Pacific/Fakaofo' => 'Pacific/Fakaofo', + 'Pacific/Fiji' => 'Pacific/Fiji', + 'Pacific/Funafuti' => 'Pacific/Funafuti', + 'Pacific/Galapagos' => 'Pacific/Galapagos', + 'Pacific/Gambier' => 'Pacific/Gambier', + 'Pacific/Guadalcanal' => 'Pacific/Guadalcanal', + 'Pacific/Guam' => 'Pacific/Guam', + 'Pacific/Honolulu' => 'Pacific/Honolulu', + 'Pacific/Johnston' => 'Pacific/Johnston', + 'Pacific/Kiritimati' => 'Pacific/Kiritimati', + 'Pacific/Kosrae' => 'Pacific/Kosrae', + 'Pacific/Kwajalein' => 'Pacific/Kwajalein', + 'Pacific/Majuro' => 'Pacific/Majuro', + 'Pacific/Marquesas' => 'Pacific/Marquesas', + 'Pacific/Midway' => 'Pacific/Midway', + 'Pacific/Nauru' => 'Pacific/Nauru', + 'Pacific/Niue' => 'Pacific/Niue', + 'Pacific/Norfolk' => 'Pacific/Norfolk', + 'Pacific/Noumea' => 'Pacific/Noumea', + 'Pacific/Pago_Pago' => 'Pacific/Pago Pago', + 'Pacific/Palau' => 'Pacific/Palau', + 'Pacific/Pitcairn' => 'Pacific/Pitcairn', + 'Pacific/Pohnpei' => 'Pacific/Pohnpei', + 'Pacific/Port_Moresby' => 'Pacific/Port Moresby', + 'Pacific/Rarotonga' => 'Pacific/Rarotonga', + 'Pacific/Saipan' => 'Pacific/Saipan', + 'Pacific/Tahiti' => 'Pacific/Tahiti', + 'Pacific/Tarawa' => 'Pacific/Tarawa', + 'Pacific/Tongatapu' => 'Pacific/Tongatapu', + 'Pacific/Wake' => 'Pacific/Wake', + 'Pacific/Wallis' => 'Pacific/Wallis', + ), + + // The value is only an example and will get replaced by the current time on view + 'dateformats' => array( + 'd M Y, H:i' => '01 Jan 2007, 13:37', + 'd M Y H:i' => '01 Jan 2007 13:37', + 'M jS, \'y, H:i' => 'Jan 1st, \'07, 13:37', + 'D M d, Y g:i a' => 'Mon Jan 01, 2007 1:37 pm', + 'F jS, Y, g:i a' => 'January 1st, 2007, 1:37 pm', + '|d M Y|, H:i' => 'Today, 13:37 / 01 Jan 2007, 13:37', + '|F jS, Y|, g:i a' => 'Today, 1:37 pm / January 1st, 2007, 1:37 pm', + ), + + // The default dateformat which will be used on new installs in this language + // Translators should change this if a the usual date format is different + 'default_dateformat' => 'D M d, Y g:i a', // Mon Jan 01, 2007 1:37 pm + +)); diff --git a/install/update/new/language/en/email/admin_activate.txt b/install/update/new/language/en/email/admin_activate.txt new file mode 100644 index 0000000..71faca7 --- /dev/null +++ b/install/update/new/language/en/email/admin_activate.txt @@ -0,0 +1,13 @@ +Subject: Activate user account + +Hello, + +The account owned by "{USERNAME}" has been deactivated or newly created, you should check the details of this user (if required) and handle it appropriately. + +Use this link to view the user's profile: +{U_USER_DETAILS} + +You may activate the account immediately by clicking on this link: +{U_ACTIVATE} + +{EMAIL_SIG} diff --git a/install/update/new/language/en/email/user_forgot_password.txt b/install/update/new/language/en/email/user_forgot_password.txt new file mode 100644 index 0000000..4826a7b --- /dev/null +++ b/install/update/new/language/en/email/user_forgot_password.txt @@ -0,0 +1,13 @@ +Subject: Account password reset + +Hello {USERNAME} + +You are receiving this notification because you have requested to recover a forgotten password for your account on "{SITENAME}". + +To reset your password, please click the link provided below: + +{U_RESET_PASSWORD} + +If you did not authorize the request you can ignore this email. Please contact the board administrator if you keep receiving it. + +{EMAIL_SIG} diff --git a/install/update/new/language/en/install.php b/install/update/new/language/en/install.php new file mode 100644 index 0000000..530c003 --- /dev/null +++ b/install/update/new/language/en/install.php @@ -0,0 +1,598 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * DO NOT CHANGE + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Common installer pages +$lang = array_merge($lang, array( + 'INSTALL_PANEL' => 'Installation Panel', + 'SELECT_LANG' => 'Select language', + + 'STAGE_INSTALL' => 'Installing phpBB', + + // Introduction page + 'INTRODUCTION_TITLE' => 'Introduction', + 'INTRODUCTION_BODY' => 'Welcome to phpBB3!

phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.

This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.

To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', + + // Support page + 'SUPPORT_TITLE' => 'Support', + 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

  • installation
  • configuration
  • technical questions
  • problems relating to potential bugs in the software
  • updating from Release Candidate (RC) versions to the latest stable version
  • converting from phpBB 2.0.x to phpBB3
  • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

Extensions / Styles

For issues relating to Extensions, please post in the appropriate Extensions Forum.
For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

If your question relates to a specific package, please post directly in the topic dedicated to the package.

Obtaining Support

Support Section
Quick Start Guide

To ensure you stay up to date with the latest news and releases, follow us on Twitter and Facebook

', + + // License + 'LICENSE_TITLE' => 'General Public License', + + // Install page + 'INSTALL_INTRO' => 'Welcome to Installation', + 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

+ +
    +
  • The Database Type - the database you will be using.
  • +
  • The Database server hostname or DSN - the address of the database server.
  • +
  • The Database server port - the port of the database server (most of the time this is not needed).
  • +
  • The Database name - the name of the database on the server.
  • +
  • The Database username and Database password - the login data to access the database.
  • +
+ +

Note: if you are installing using SQLite, you should enter the full path to your database file in the DSN field and leave the username and password fields blank. For security reasons, you should make sure that the database file is not stored in a location accessible from the web.

+ +

phpBB3 supports the following databases:

+
    +
  • MySQL 4.1.3 or above (MySQLi required)
  • +
  • PostgreSQL 8.3+
  • +
  • SQLite 3.6.15+
  • +
  • MS SQL Server 2000 or above (directly or via ODBC)
  • +
  • MS SQL Server 2005 or above (native)
  • +
  • Oracle
  • +
+ +

Only those databases supported on your server will be displayed.', + + 'ACP_LINK' => 'Take me to the ACP', + + 'INSTALL_PHPBB_INSTALLED' => 'phpBB is already installed.', + 'INSTALL_PHPBB_NOT_INSTALLED' => 'phpBB is not installed yet.', +)); + +// Requirements translation +$lang = array_merge($lang, array( + // Filesystem requirements + 'FILE_NOT_EXISTS' => 'File does not exist', + 'FILE_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB the %1$s file needs to exist.', + 'FILE_NOT_EXISTS_EXPLAIN_OPTIONAL' => 'It is recommended that the %1$s file exist for a better forum user experience.', + 'FILE_NOT_WRITABLE' => 'File is not writable', + 'FILE_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB the %1$s file needs to be writable.', + 'FILE_NOT_WRITABLE_EXPLAIN_OPTIONAL' => 'It is recommended that the %1$s file be writable for a better forum user experience.', + + 'DIRECTORY_NOT_EXISTS' => 'Directory does not exist', + 'DIRECTORY_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB the %1$s directory needs to exist.', + 'DIRECTORY_NOT_EXISTS_EXPLAIN_OPTIONAL' => 'It is recommended that the %1$s directory exist for a better forum user experience.', + 'DIRECTORY_NOT_WRITABLE' => 'Directory is not writable', + 'DIRECTORY_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB the %1$s directory needs to be writable.', + 'DIRECTORY_NOT_WRITABLE_EXPLAIN_OPTIONAL' => 'It is recommended that the %1$s directory be writable for a better forum user experience.', + + // Server requirements + 'PHP_VERSION_REQD' => 'PHP version', + 'PHP_VERSION_REQD_EXPLAIN' => 'phpBB requires PHP version 7.1.3 or higher.', + 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP getimagesize() function is required', + 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the getimagesize function needs to be available.', + 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', + 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', + 'PHP_JSON_SUPPORT' => 'PHP JSON support', + 'PHP_JSON_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the PHP JSON extension needs to be available.', + 'PHP_XML_SUPPORT' => 'PHP XML/DOM support', + 'PHP_XML_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the PHP XML/DOM extension needs to be available.', + 'PHP_SUPPORTED_DB' => 'Supported databases', + 'PHP_SUPPORTED_DB_EXPLAIN' => 'You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', + + 'RETEST_REQUIREMENTS' => 'Retest requirements', + + 'STAGE_REQUIREMENTS' => 'Check requirements', +)); + +// General error messages +$lang = array_merge($lang, array( + 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', + + 'TIMEOUT_DETECTED_TITLE' => 'The installer detected a timeout', + 'TIMEOUT_DETECTED_MESSAGE' => 'The installer has detected a timeout, you may try to refresh the page, which may lead to data corruption. We suggest that you either increase your timeout settings or try to use the CLI.', +)); + +// Data obtaining translations +$lang = array_merge($lang, array( + 'STAGE_OBTAIN_DATA' => 'Set installation data', + + // + // Admin data + // + 'STAGE_ADMINISTRATOR' => 'Administrator details', + + // Form labels + 'ADMIN_CONFIG' => 'Administrator configuration', + 'ADMIN_PASSWORD' => 'Administrator password', + 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', + 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', + 'ADMIN_USERNAME' => 'Administrator username', + 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', + + // Errors + 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', + 'INST_ERR_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', + 'INST_ERR_PASSWORD_TOO_LONG' => 'The password you entered is too long. The maximum length is 30 characters.', + 'INST_ERR_PASSWORD_TOO_SHORT' => 'The password you entered is too short. The minimum length is 6 characters.', + 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', + 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', + + // + // Board data + // + // Form labels + 'BOARD_CONFIG' => 'Bulletin board configuration', + 'DEFAULT_LANGUAGE' => 'Default language', + 'BOARD_NAME' => 'Title of the board', + 'BOARD_DESCRIPTION' => 'Short description of the board', + + // + // Database data + // + 'STAGE_DATABASE' => 'Database settings', + + // Form labels + 'DB_CONFIG' => 'Database configuration', + 'DBMS' => 'Database type', + 'DB_HOST' => 'Database server hostname or DSN', + 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', + 'DB_PORT' => 'Database server port', + 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', + 'DB_PASSWORD' => 'Database password', + 'DB_NAME' => 'Database name', + 'DB_USERNAME' => 'Database username', + 'DATABASE_VERSION' => 'Database version', + 'TABLE_PREFIX' => 'Prefix for tables in database', + 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', + + // Database options + 'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', + 'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', + 'DB_OPTION_MYSQLI' => 'MySQL with MySQLi Extension', + 'DB_OPTION_ORACLE' => 'Oracle', + 'DB_OPTION_POSTGRES' => 'PostgreSQL', + 'DB_OPTION_SQLITE3' => 'SQLite 3', + + // Errors + 'INST_ERR_DB' => 'Database installation error', + 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', + 'INST_ERR_DB_INVALID_PREFIX' => 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', + 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', + 'INST_ERR_DB_NO_NAME' => 'No database name specified.', + 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', + 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', + 'INST_ERR_DB_NO_WRITABLE' => 'Both the database and the directory containing it must be writable.', + 'INST_ERR_DB_NO_ERROR' => 'No error message given.', + 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', + 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.', + 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', + 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the NLS_CHARACTERSET parameter to UTF8. Either upgrade your installation to 9.2+ or change the parameter.', + 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in UNICODE or UTF8 encoding. Try installing with a database in UNICODE or UTF8 encoding.', + 'INST_SCHEMA_FILE_NOT_WRITABLE' => 'The schema file is not writable', + + // + // Email data + // + 'EMAIL_CONFIG' => 'E-mail configuration', + + // Package info + 'PACKAGE_VERSION' => 'Package version installed', + 'UPDATE_INCOMPLETE' => 'Your phpBB installation has not been correctly updated.', + 'UPDATE_INCOMPLETE_MORE' => 'Please read the information below in order to fix this error.', + 'UPDATE_INCOMPLETE_EXPLAIN' => '

Incomplete update

+ +

We noticed that the last update of your phpBB installation hasn’t been completed. Visit the database updater, ensure Update database only is selected and click on Submit. Don\'t forget to delete the "install"-directory after you have updated the database successfully.

', + + // + // Server data + // + // Form labels + 'UPGRADE_INSTRUCTIONS' => 'A new feature release %1$s is available. Please read the release announcement to learn about what it has to offer, and how to upgrade.', + 'SERVER_CONFIG' => 'Server configuration', + 'SCRIPT_PATH' => 'Script path', + 'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB is located relative to the domain name, e.g. /phpBB3.', +)); + +// Default database schema entries... +$lang = array_merge($lang, array( + 'CONFIG_BOARD_EMAIL_SIG' => 'Thanks, The Management', + 'CONFIG_SITE_DESC' => 'A short text to describe your forum', + 'CONFIG_SITENAME' => 'yourdomain.com', + + 'DEFAULT_INSTALL_POST' => 'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. During the installation process your first category and your first forum are assigned an appropriate set of permissions for the predefined usergroups administrators, bots, global moderators, guests, registered users and registered COPPA users. If you also choose to delete your first category and your first forum, do not forget to assign permissions for all these usergroups for all new categories and forums you create. It is recommended to rename your first category and your first forum and copy permissions from these while creating new categories and forums. Have fun!', + + 'FORUMS_FIRST_CATEGORY' => 'Your first category', + 'FORUMS_TEST_FORUM_DESC' => 'Description of your first forum.', + 'FORUMS_TEST_FORUM_TITLE' => 'Your first forum', + + 'RANKS_SITE_ADMIN_TITLE' => 'Site Admin', + 'REPORT_WAREZ' => 'The post contains links to illegal or pirated software.', + 'REPORT_SPAM' => 'The reported post has the only purpose to advertise for a website or another product.', + 'REPORT_OFF_TOPIC' => 'The reported post is off topic.', + 'REPORT_OTHER' => 'The reported post does not fit into any other category, please use the further information field.', + + 'SMILIES_ARROW' => 'Arrow', + 'SMILIES_CONFUSED' => 'Confused', + 'SMILIES_COOL' => 'Cool', + 'SMILIES_CRYING' => 'Crying or Very Sad', + 'SMILIES_EMARRASSED' => 'Embarrassed', + 'SMILIES_EVIL' => 'Evil or Very Mad', + 'SMILIES_EXCLAMATION' => 'Exclamation', + 'SMILIES_GEEK' => 'Geek', + 'SMILIES_IDEA' => 'Idea', + 'SMILIES_LAUGHING' => 'Laughing', + 'SMILIES_MAD' => 'Mad', + 'SMILIES_MR_GREEN' => 'Mr. Green', + 'SMILIES_NEUTRAL' => 'Neutral', + 'SMILIES_QUESTION' => 'Question', + 'SMILIES_RAZZ' => 'Razz', + 'SMILIES_ROLLING_EYES' => 'Rolling Eyes', + 'SMILIES_SAD' => 'Sad', + 'SMILIES_SHOCKED' => 'Shocked', + 'SMILIES_SMILE' => 'Smile', + 'SMILIES_SURPRISED' => 'Surprised', + 'SMILIES_TWISTED_EVIL' => 'Twisted Evil', + 'SMILIES_UBER_GEEK' => 'Uber Geek', + 'SMILIES_VERY_HAPPY' => 'Very Happy', + 'SMILIES_WINK' => 'Wink', + + 'TOPICS_TOPIC_TITLE' => 'Welcome to phpBB3', +)); + +// Common navigation items' translation +$lang = array_merge($lang, array( + 'MENU_OVERVIEW' => 'Overview', + 'MENU_INTRO' => 'Introduction', + 'MENU_LICENSE' => 'License', + 'MENU_SUPPORT' => 'Support', +)); + +// Task names +$lang = array_merge($lang, array( + // Install filesystem + 'TASK_CREATE_CONFIG_FILE' => 'Creating configuration file', + + // Install database + 'TASK_ADD_CONFIG_SETTINGS' => 'Adding configuration settings', + 'TASK_ADD_DEFAULT_DATA' => 'Adding default settings to the database', + 'TASK_CREATE_DATABASE_SCHEMA_FILE' => 'Creating database schema file', + 'TASK_SETUP_DATABASE' => 'Setting up database', + 'TASK_CREATE_TABLES' => 'Creating tables', + + // Install data + 'TASK_ADD_BOTS' => 'Registering bots', + 'TASK_ADD_LANGUAGES' => 'Installing available languages', + 'TASK_ADD_MODULES' => 'Installing modules', + 'TASK_CREATE_SEARCH_INDEX' => 'Creating search index', + + // Install finish tasks + 'TASK_INSTALL_EXTENSIONS' => 'Installing packaged extensions', + 'TASK_NOTIFY_USER' => 'Sending notification e-mail', + 'TASK_POPULATE_MIGRATIONS' => 'Populating migrations', + + // Installer general progress messages + 'INSTALLER_FINISHED' => 'The installer has finished successfully', +)); + +// Installer's general messages +$lang = array_merge($lang, array( + 'MODULE_NOT_FOUND' => 'Module not found', + 'MODULE_NOT_FOUND_DESCRIPTION' => 'A module could not be found because the service, %s, is undefined.', + + 'TASK_NOT_FOUND' => 'Task not found', + 'TASK_NOT_FOUND_DESCRIPTION' => 'A task could not be found because the service, %s, is undefined.', + + 'SKIP_MODULE' => 'Skip “%s” module', + 'SKIP_TASK' => 'Skip “%s” task', + + 'TASK_SERVICE_INSTALLER_MISSING' => 'All installer task services should start with “installer”', + 'TASK_CLASS_NOT_FOUND' => 'Installer task service definition is invalid. Service name “%1$s” given, the expected class namespace is “%2$s” for that. For more information please see the documentation of task_interface.', + + 'INSTALLER_CONFIG_NOT_WRITABLE' => 'The installer config file is not writable.', +)); + +// CLI messages +$lang = array_merge($lang, array( + 'CLI_INSTALL_BOARD' => 'Install phpBB', + 'CLI_UPDATE_BOARD' => 'Update phpBB', + 'CLI_INSTALL_SHOW_CONFIG' => 'Show the configuration which will be used', + 'CLI_INSTALL_VALIDATE_CONFIG' => 'Validate a configuration file', + 'CLI_CONFIG_FILE' => 'Config file to use', + 'MISSING_FILE' => 'Unable to access file %1$s', + 'MISSING_DATA' => 'Config file is missing data or might contain invalid settings.', + 'INVALID_YAML_FILE' => 'Could not parse YAML file %1$s', + 'CONFIGURATION_VALID' => 'The configuration file is valid', +)); + +// Common updater messages +$lang = array_merge($lang, array( + 'UPDATE_INSTALLATION' => 'Update phpBB installation', + 'UPDATE_INSTALLATION_EXPLAIN' => 'With this option, it is possible to update your phpBB installation to the latest version.
During the process all of your files will be checked for their integrity. You are able to review all differences and files before the update.

The file update itself can be done in two different ways.

Manual Update

With this update you only download your personal set of changed files to make sure you do not lose your file modifications you may have done. After you downloaded this package you need to manually upload the files to their correct position under your phpBB root directory. Once done, you are able to do the file check stage again to see if you moved the files to their correct location.

Automatic Update with FTP

This method is similar to the first one but without the need to download the changed files and uploading them on your own. This will be done for you. In order to use this method you need to know your FTP login details since you will be asked for them. Once finished you will be redirected to the file check again to make sure everything got updated correctly.

', + 'UPDATE_INSTRUCTIONS' => ' + +

Release announcement

+ +

Please read the release announcement for the latest version before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.

+ +
+ +

How to update your installation with the Full Package

+ +

The recommended way of updating your installation is using the full package. If core phpBB files have been modified in your installation you may wish to use the automatic update package in order to not lose these changes. You are also able to update your installation using the other methods listed within the INSTALL.html document. The steps for updating phpBB3 using the full package are:

+ +
    +
  1. Backup all board files and the database.
  2. +
  3. Go to the phpBB.com downloads page and download the latest "Full Package" archive.
  4. +
  5. Unpack the archive.
  6. +
  7. Remove (delete) the config.php file, and the /images, /store and /files folders from the package (not your site).
  8. +
  9. Go to the ACP, Board settings, and make sure prosilver is set as the default style. If not, set it to prosilver.
  10. +
  11. Delete the /vendor and /cache folders from the board’s root folder on the host.
  12. +
  13. Via FTP or SSH upload the remaining files and folders (that is, the remaining CONTENTS of the phpBB3 folder) to the root folder of your board installation on the server, overwriting the existing files. (Note: take care not to delete any extensions in your /ext folder when uploading the new phpBB3 contents.)
  14. +
  15. Now start the update process by pointing your browser to the install folder.
  16. +
  17. Follow the steps to update the database and let that run to completion.
  18. +
  19. Via FTP or SSH delete the /install folder from the root of your board installation.

  20. +
+ +

You now have a new up to date board containing all your users and posts. Follow up tasks:

+
    +
  • Update your language pack
  • +
  • Update your style

  • +
+ +

How to update your installation with the Automatic Update Package

+ +

The automatic update package is only recommended in case core phpBB files have been modified in your installation. You are also able to update your installation using the methods listed within the INSTALL.html document. The steps for updating phpBB3 using the automatic update package are:

+ +
    +
  1. Go to the phpBB.com downloads page and download the "Automatic Update Package" archive.
  2. +
  3. Unpack the archive.
  4. +
  5. Upload the complete uncompressed "install" and "vendor" folders to your phpBB root directory (where your config.php file is).

  6. +
+ +

Once uploaded your board will be offline for normal users due to the install directory you uploaded now being present.

+ Now start the update process by pointing your browser to the install folder.
+
+ You will then be guided through the update process. You will be notified once the update is complete. +

+ ', +)); + +// Updater forms +$lang = array_merge($lang, array( + // Updater types + 'UPDATE_TYPE' => 'Type of update to run', + + 'UPDATE_TYPE_ALL' => 'Update filesystem and database', + 'UPDATE_TYPE_DB_ONLY' => 'Update database only', + + // File updater methods + 'UPDATE_FILE_METHOD_TITLE' => 'File updater methods', + + 'UPDATE_FILE_METHOD' => 'File updater method', + 'UPDATE_FILE_METHOD_DOWNLOAD' => 'Download modified files in an archive', + 'UPDATE_FILE_METHOD_FTP' => 'Update files via FTP (Automatic)', + 'UPDATE_FILE_METHOD_FILESYSTEM' => 'Update files via direct file access (Automatic)', + + // File updater archives + 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', + + // FTP settings + 'FTP_SETTINGS' => 'FTP settings', +)); + +// Requirements messages +$lang = array_merge($lang, array( + 'UPDATE_FILES_NOT_FOUND' => 'No valid update directory was found, please make sure you uploaded the relevant files.', + + 'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.', + 'OLD_UPDATE_FILES' => 'Update files are out of date. The update files found are for updating from phpBB %1$s to phpBB %2$s but the latest version of phpBB is %3$s.', + 'INCOMPATIBLE_UPDATE_FILES' => 'The update files found are incompatible with your installed version. Your installed version is %1$s and the update file is for updating phpBB %2$s to %3$s.', +)); + +// Update files +$lang = array_merge($lang, array( + 'STAGE_UPDATE_FILES' => 'Update files', + + // Check files + 'UPDATE_CHECK_FILES' => 'Check files to update', + + // Update file differ + 'FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ' => 'The file differ failed to open %s.', + + 'UPDATE_FILE_DIFF' => 'Diffing changed files', + 'ALL_FILES_DIFFED' => 'All modified files has been diffed.', + + // File status + 'UPDATE_CONTINUE_FILE_UPDATE' => 'Update files', + + 'DOWNLOAD' => 'Download', + 'DOWNLOAD_CONFLICTS' => 'Download merge conflicts archive', + 'DOWNLOAD_CONFLICTS_EXPLAIN' => 'Search for <<< to spot conflicts', + '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, you may continue with the update process.', + + 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', + 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', + 'FILE_USED' => 'Information used from', // Single file + 'FILES_CONFLICT' => 'Conflict files', + 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in losing the changes from the newer file.', + 'FILES_DELETED' => 'Deleted files', + 'FILES_DELETED_EXPLAIN' => 'The following files do not exist in the new version. These files have to be deleted from your installation.', + 'FILES_MODIFIED' => 'Modified files', + 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', + 'FILES_NEW' => 'New files', + 'FILES_NEW_EXPLAIN' => 'The following files currently do not exist within your installation. These files will be added to your installation.', + 'FILES_NEW_CONFLICT' => 'New conflicting files', + 'FILES_NEW_CONFLICT_EXPLAIN' => 'The following files are new within the latest version but it has been determined that there is already a file with the same name within the same position. This file will be overwritten by the new file.', + 'FILES_NOT_MODIFIED' => 'Not modified files', + 'FILES_NOT_MODIFIED_EXPLAIN' => 'The following files are not modified and represent the original phpBB files from the version you want to update from.', + 'FILES_UP_TO_DATE' => 'Already updated files', + 'FILES_UP_TO_DATE_EXPLAIN' => 'The following files are already up to date and do not need to be updated.', + 'FILES_VERSION' => 'Files Version', + 'TOGGLE_DISPLAY' => 'View/Hide file list', + + // File updater + 'UPDATE_UPDATING_FILES' => 'Updating files', + + 'UPDATE_FILE_UPDATER_HAS_FAILED' => 'File updater “%1$s“ has failed. The installer will try to fallback to “%2$s“.', + 'UPDATE_FILE_UPDATERS_HAVE_FAILED' => 'The file updater failed. No further fallback methods are available.', + + 'UPDATE_CONTINUE_UPDATE_PROCESS' => 'Continue update process', + 'UPDATE_RECHECK_UPDATE_FILES' => 'Check files again', +)); + +// Update database +$lang = array_merge($lang, array( + 'STAGE_UPDATE_DATABASE' => 'Update database', + + 'INLINE_UPDATE_SUCCESSFUL' => 'The database update was successful.', + + 'TASK_UPDATE_EXTENSIONS' => 'Updating extensions', +)); + +// Converter +$lang = array_merge($lang, array( + // Common converter messages + 'CONVERT_NOT_EXIST' => 'The specified convertor does not exist.', + 'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source board to allow the path to it to be verified.', + 'COULD_NOT_FIND_PATH' => 'Could not find path to your former board. Please check your settings and try again.
» %s was specified as the source path.', + 'CONFIG_PHPBB_EMPTY' => 'The phpBB3 config variable for “%s” is empty.', + + 'MAKE_FOLDER_WRITABLE' => 'Please make sure that this folder exists and is writable by the webserver then try again:
»%s.', + 'MAKE_FOLDERS_WRITABLE' => 'Please make sure that these folders exist and are writable by the webserver then try again:
»%s.', + + 'INSTALL_TEST' => 'Test again', + + 'NO_TABLES_FOUND' => 'No tables found.', + 'TABLES_MISSING' => 'Could not find these tables
» %s.', + 'CHECK_TABLE_PREFIX' => 'Please check your table prefix and try again.', + + // Conversion in progress + 'CONTINUE_CONVERT' => 'Continue conversion', + 'CONTINUE_CONVERT_BODY' => 'A previous conversion attempt has been determined. You are now able to choose between starting a new conversion or continuing the conversion.', + 'CONVERT_NEW_CONVERSION' => 'New conversion', + 'CONTINUE_OLD_CONVERSION' => 'Continue previously started conversion', + + // Start conversion + 'SUB_INTRO' => 'Introduction', + 'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework', + 'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.', + 'AVAILABLE_CONVERTORS' => 'Available convertors', + 'NO_CONVERTORS' => 'No convertors are available for use.', + 'CONVERT_OPTIONS' => 'Options', + 'SOFTWARE' => 'Board software', + 'VERSION' => 'Version', + 'CONVERT' => 'Convert', + + // Settings + 'STAGE_SETTINGS' => 'Settings', + 'TABLE_PREFIX_SAME' => 'The table prefix needs to be the one used by the software you are converting from.
» Specified table prefix was %s.', + 'DEFAULT_PREFIX_IS' => 'The convertor was not able to find tables with the specified prefix. Please make sure you have entered the correct details for the board you are converting from. The default table prefix for %1$s is %2$s.', + 'SPECIFY_OPTIONS' => 'Specify conversion options', + 'FORUM_PATH' => 'Board path', + 'FORUM_PATH_EXPLAIN' => 'This is the relative path on disk to your former board from the root of this phpBB3 installation.', + 'REFRESH_PAGE' => 'Refresh page to continue conversion', + 'REFRESH_PAGE_EXPLAIN' => 'If set to yes, the convertor will refresh the page to continue the conversion after having finished a step. If this is your first conversion for testing purposes and to determine any errors in advance, we suggest to set this to No.', + + // Conversion + 'STAGE_IN_PROGRESS' => 'Conversion in progress', + + 'AUTHOR_NOTES' => 'Author notes
» %s', + 'STARTING_CONVERT' => 'Starting conversion process', + 'CONFIG_CONVERT' => 'Converting the configuration', + 'DONE' => 'Done', + 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', + 'FILLING_TABLE' => 'Filling table %s', + 'FILLING_TABLES' => 'Filling tables', + 'DB_ERR_INSERT' => 'Error while processing INSERT query.', + 'DB_ERR_LAST' => 'Error while processing query_last.', + 'DB_ERR_QUERY_FIRST' => 'Error while executing query_first.', + 'DB_ERR_QUERY_FIRST_TABLE' => 'Error while executing query_first, %s (“%s”).', + 'DB_ERR_SELECT' => 'Error while running SELECT query.', + 'STEP_PERCENT_COMPLETED' => 'Step %d of %d', + 'FINAL_STEP' => 'Process final step', + 'SYNC_FORUMS' => 'Starting to synchronise forums', + 'SYNC_POST_COUNT' => 'Synchronising post_counts', + 'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from entry %1$s to %2$s.', + 'SYNC_TOPICS' => 'Starting to synchronise topics', + 'SYNC_TOPIC_ID' => 'Synchronising topics from topic_id %1$s to %2$s.', + 'PROCESS_LAST' => 'Processing last statements', + 'UPDATE_TOPICS_POSTED' => 'Generating topics posted information', + 'UPDATE_TOPICS_POSTED_ERR' => 'An error occurred while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.', + 'CONTINUE_LAST' => 'Continue last statements', + 'CLEAN_VERIFY' => 'Cleaning up and verifying the final structure', + 'NOT_UNDERSTAND' => 'Could not understand %s #%d, table %s (“%s”)', + 'NAMING_CONFLICT' => 'Naming conflict: %s and %s are both aliases

%s', + + // Finish conversion + 'CONVERT_COMPLETE' => 'Conversion completed', + 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.3. You can now login and access your board. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the Documentation and the support forums.', + + 'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.', + 'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.', + 'CONV_ERROR_FORUM_ACCESS' => 'Unable to get forum access information.', + 'CONV_ERROR_GET_CATEGORIES' => 'Unable to get categories.', + 'CONV_ERROR_GET_CONFIG' => 'Could not retrieve your board configuration.', + 'CONV_ERROR_COULD_NOT_READ' => 'Unable to access/read “%s”.', + 'CONV_ERROR_GROUP_ACCESS' => 'Unable to get group authentication information.', + 'CONV_ERROR_INCONSISTENT_GROUPS' => 'Inconsistency in groups table detected in add_bots() - you need to add all special groups if you do it manually.', + 'CONV_ERROR_INSERT_BOT' => 'Unable to insert bot into users table.', + 'CONV_ERROR_INSERT_BOTGROUP' => 'Unable to insert bot into bots table.', + 'CONV_ERROR_INSERT_USER_GROUP' => 'Unable to insert user into user_group table.', + 'CONV_ERROR_MESSAGE_PARSER' => 'Message parser error', + 'CONV_ERROR_NO_AVATAR_PATH' => 'Note to developer: you must specify $convertor[\'avatar_path\'] to use %s.', + 'CONV_ERROR_NO_FORUM_PATH' => 'The relative path to the source board has not been specified.', + 'CONV_ERROR_NO_GALLERY_PATH' => 'Note to developer: you must specify $convertor[\'avatar_gallery_path\'] to use %s.', + 'CONV_ERROR_NO_GROUP' => 'Group “%1$s” could not be found in %2$s.', + 'CONV_ERROR_NO_RANKS_PATH' => 'Note to developer: you must specify $convertor[\'ranks_path\'] to use %s.', + 'CONV_ERROR_NO_SMILIES_PATH' => 'Note to developer: you must specify $convertor[\'smilies_path\'] to use %s.', + 'CONV_ERROR_NO_UPLOAD_DIR' => 'Note to developer: you must specify $convertor[\'upload_path\'] to use %s.', + 'CONV_ERROR_PERM_SETTING' => 'Unable to insert/update permission setting.', + 'CONV_ERROR_PM_COUNT' => 'Unable to select folder pm count.', + 'CONV_ERROR_REPLACE_CATEGORY' => 'Unable to insert new forum replacing old category.', + 'CONV_ERROR_REPLACE_FORUM' => 'Unable to insert new forum replacing old forum.', + 'CONV_ERROR_USER_ACCESS' => 'Unable to get user authentication information.', + 'CONV_ERROR_WRONG_GROUP' => 'Wrong group “%1$s” defined in %2$s.', + 'CONV_OPTIONS_BODY' => 'This page collects the data required to access the source board. Enter the database details of your former board; the converter will not change anything in the database given below. The source board should be disabled to allow a consistent conversion.', + 'CONV_SAVED_MESSAGES' => 'Saved messages', + + 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process. Please note that you may have to manually do and adjust several things. After conversion, especially check the permissions assigned, rebuild your search index which is not converted and also make sure files got copied correctly, for example avatars and smilies.', +)); diff --git a/install/update/new/language/en/migrator.php b/install/update/new/language/en/migrator.php new file mode 100644 index 0000000..0380254 --- /dev/null +++ b/install/update/new/language/en/migrator.php @@ -0,0 +1,81 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'CONFIG_NOT_EXIST' => 'The config setting "%s" unexpectedly does not exist.', + + 'GROUP_NOT_EXIST' => 'The group "%s" unexpectedly does not exist.', + + 'MIGRATION_APPLY_DEPENDENCIES' => 'Apply dependencies of %s.', + 'MIGRATION_DATA_DONE' => 'Installed Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_DATA_IN_PROGRESS' => 'Installing Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_DATA_RUNNING' => 'Installing Data: %s.', + 'MIGRATION_EFFECTIVELY_INSTALLED' => 'Migration already effectively installed (skipped): %s', + 'MIGRATION_EXCEPTION_ERROR' => 'Something went wrong during the request and an exception was thrown. The changes made before the error occurred were reversed to the best of our abilities, but you should check the board for errors:

%s', + 'MIGRATION_NOT_FULFILLABLE' => 'The migration "%1$s" is not fulfillable, missing migration "%2$s".', + 'MIGRATION_NOT_INSTALLED' => 'The migration "%s" is not installed.', + 'MIGRATION_NOT_VALID' => '%s is not a valid migration.', + 'MIGRATION_SCHEMA_DONE' => 'Installed Schema: %1$s; Time: %2$.2f seconds', + 'MIGRATION_SCHEMA_IN_PROGRESS' => 'Installing Schema: %1$s; Time: %2$.2f seconds', + 'MIGRATION_SCHEMA_RUNNING' => 'Installing Schema: %s.', + + 'MIGRATION_REVERT_DATA_DONE' => 'Reverted Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_DATA_IN_PROGRESS' => 'Reverting Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_DATA_RUNNING' => 'Reverting Data: %s.', + 'MIGRATION_REVERT_SCHEMA_DONE' => 'Reverted Schema: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_SCHEMA_IN_PROGRESS' => 'Reverting Schema: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_SCHEMA_RUNNING' => 'Reverting Schema: %s.', + + 'MIGRATION_INVALID_DATA_MISSING_CONDITION' => 'A migration is invalid. An if statement helper is missing a condition.', + 'MIGRATION_INVALID_DATA_MISSING_STEP' => 'A migration is invalid. An if statement helper is missing a valid call to a migration step.', + 'MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE' => 'A migration is invalid. A custom callable function could not be called.', + 'MIGRATION_INVALID_DATA_UNKNOWN_TYPE' => 'A migration is invalid. An unknown migration tool type was encountered.', + 'MIGRATION_INVALID_DATA_UNDEFINED_TOOL' => 'A migration is invalid. An undefined migration tool was encountered.', + 'MIGRATION_INVALID_DATA_UNDEFINED_METHOD' => 'A migration is invalid. An undefined migration tool method was encountered.', + + 'MODULE_ERROR' => 'An error occurred while creating a module: %s', + 'MODULE_EXISTS' => 'A module already exists: %s', + 'MODULE_EXIST_MULTIPLE' => 'Several modules with the given parent module langname already exist: %s. Try using before/after keys to clarify the module placement.', + 'MODULE_INFO_FILE_NOT_EXIST' => 'A required module info file is missing: %2$s', + 'MODULE_NOT_EXIST' => 'A required module does not exist: %s', + + 'PARENT_MODULE_FIND_ERROR' => 'Unable to determine the parent module identifier: %s', + 'PERMISSION_NOT_EXIST' => 'The permission setting "%s" unexpectedly does not exist.', + + 'ROLE_NOT_EXIST' => 'The permission role "%s" unexpectedly does not exist.', +)); diff --git a/install/update/new/language/en/posting.php b/install/update/new/language/en/posting.php new file mode 100644 index 0000000..639b8d8 --- /dev/null +++ b/install/update/new/language/en/posting.php @@ -0,0 +1,287 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'ADD_ATTACHMENT' => 'Upload attachment', + 'ADD_ATTACHMENT_EXPLAIN' => 'If you wish to attach one or more files enter the details below.', + 'ADD_FILE' => 'Add the file', + 'ADD_POLL' => 'Poll creation', + 'ADD_POLL_EXPLAIN' => 'If you do not want to add a poll to your topic leave the fields blank.', + 'ALREADY_DELETED' => 'Sorry but this message is already deleted.', + 'ATTACH_COMMENT_NO_EMOJIS' => 'The attachment comment contains forbidden characters (Emoji).', + 'ATTACH_DISK_FULL' => 'There is not enough free disk space to post this attachment.', + 'ATTACH_QUOTA_REACHED' => 'Sorry, the board attachment quota has been reached.', + 'ATTACH_SIG' => 'Attach a signature (signatures can be altered via the UCP)', + + 'BBCODE_A_HELP' => 'Inline uploaded attachment: [attachment=]filename.ext[/attachment]', + 'BBCODE_B_HELP' => 'Bold text: [b]text[/b]', + 'BBCODE_C_HELP' => 'Code display: [code]code[/code]', + 'BBCODE_D_HELP' => 'Flash: [flash=width,height]http://url[/flash]', + 'BBCODE_F_HELP' => 'Font size: [size=85]small text[/size]', + 'BBCODE_IS_OFF' => '%sBBCode%s is OFF', + 'BBCODE_IS_ON' => '%sBBCode%s is ON', + 'BBCODE_I_HELP' => 'Italic text: [i]text[/i]', + 'BBCODE_L_HELP' => 'List: [list][*]text[/list]', + 'BBCODE_LISTITEM_HELP' => 'List item: [*]text', + 'BBCODE_O_HELP' => 'Ordered list: e.g. [list=1][*]First point[/list] or [list=a][*]Point a[/list]', + 'BBCODE_P_HELP' => 'Insert image: [img]http://image_url[/img]', + 'BBCODE_Q_HELP' => 'Quote text: [quote]text[/quote]', + 'BBCODE_S_HELP' => 'Font colour: [color=red]text[/color] or [color=#FF0000]text[/color]', + 'BBCODE_U_HELP' => 'Underline text: [u]text[/u]', + 'BBCODE_W_HELP' => 'Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]', + 'BBCODE_Y_HELP' => 'List: Add list element', + 'BUMP_ERROR' => 'You cannot bump this topic so soon after the last post.', + + 'CANNOT_DELETE_REPLIED' => 'Sorry but you may only delete posts which have not been replied to.', + 'CANNOT_EDIT_POST_LOCKED' => 'This post has been locked. You can no longer edit that post.', + 'CANNOT_EDIT_TIME' => 'You can no longer edit or delete that post.', + 'CANNOT_POST_ANNOUNCE' => 'Sorry but you cannot post announcements.', + 'CANNOT_POST_STICKY' => 'Sorry but you cannot post sticky topics.', + 'CHANGE_TOPIC_TO' => 'Change topic type to', + 'CHARS_POST_CONTAINS' => array( + 1 => 'Your message contains %1$d character.', + 2 => 'Your message contains %1$d characters.', + ), + 'CHARS_SIG_CONTAINS' => array( + 1 => 'Your signature contains %1$d character.', + 2 => 'Your signature contains %1$d characters.', + ), + 'CLOSE_TAGS' => 'Close tags', + 'CURRENT_TOPIC' => 'Current topic', + + 'DELETE_FILE' => 'Delete file', + 'DELETE_MESSAGE' => 'Delete message', + 'DELETE_MESSAGE_CONFIRM' => 'Are you sure you want to delete this message?', + 'DELETE_OWN_POSTS' => 'Sorry but you can only delete your own posts.', + 'DELETE_PERMANENTLY' => 'Delete permanently', + 'DELETE_POST_CONFIRM' => 'Are you sure you want to delete this post?', + 'DELETE_POST_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete this post?', + 'DELETE_POST_PERMANENTLY' => array( + 1 => 'Permanently delete this post so it can not be recovered', + 2 => 'Permanently delete %1$d posts so they can not be recovered', + ), + 'DELETE_POSTS_CONFIRM' => 'Are you sure you want to delete these posts?', + 'DELETE_POSTS_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete these posts?', + 'DELETE_REASON' => 'Reason for deletion', + 'DELETE_REASON_EXPLAIN' => 'The specified reason for deletion will be visible to moderators.', + 'DELETE_POST_WARN' => 'Delete this post', + 'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?', + 'DELETE_TOPIC_PERMANENTLY' => array( + 1 => 'Permanently delete this topic so it can not be recovered', + 2 => 'Permanently delete %1$d topics so they can not be recovered', + ), + 'DELETE_TOPIC_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete this topic?', + 'DELETE_TOPICS_CONFIRM' => 'Are you sure you want to delete these topics?', + 'DELETE_TOPICS_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete these topics?', + 'DISABLE_BBCODE' => 'Disable BBCode', + 'DISABLE_MAGIC_URL' => 'Do not automatically parse URLs', + 'DISABLE_SMILIES' => 'Disable smilies', + 'DISALLOWED_CONTENT' => 'The upload was rejected because the uploaded file was identified as a possible attack vector.', + 'DISALLOWED_EXTENSION' => 'The extension %s is not allowed.', + 'DRAFT_LOADED' => 'Draft loaded into posting area, you may want to finish your post now.
Your draft will be deleted after submitting this post.', + 'DRAFT_LOADED_PM' => 'Draft loaded into message area, you may want to finish your private message now.
Your draft will be deleted after submitting this private message.', + 'DRAFT_SAVED' => 'Draft successfully saved.', + 'DRAFT_TITLE' => 'Draft title', + + 'EDIT_REASON' => 'Reason for editing this post', + 'EMPTY_FILEUPLOAD' => 'The uploaded file is empty.', + 'EMPTY_MESSAGE' => 'You must enter a message when posting.', + 'EMPTY_REMOTE_DATA' => 'File could not be uploaded, please try uploading the file manually.', + + 'FLASH_IS_OFF' => '[flash] is OFF', + 'FLASH_IS_ON' => '[flash] is ON', + 'FLOOD_ERROR' => 'You cannot make another post so soon after your last.', + 'FONT_COLOR' => 'Font colour', + 'FONT_COLOR_HIDE' => 'Hide font colour', + 'FONT_HUGE' => 'Huge', + 'FONT_LARGE' => 'Large', + 'FONT_NORMAL' => 'Normal', + 'FONT_SIZE' => 'Font size', + 'FONT_SMALL' => 'Small', + 'FONT_TINY' => 'Tiny', + + 'GENERAL_UPLOAD_ERROR' => 'Could not upload attachment to %s.', + + 'IMAGES_ARE_OFF' => '[img] is OFF', + 'IMAGES_ARE_ON' => '[img] is ON', + 'INVALID_FILENAME' => '%s is an invalid filename.', + + 'LOAD' => 'Load', + 'LOAD_DRAFT' => 'Load draft', + 'LOAD_DRAFT_EXPLAIN' => 'Here you are able to select the draft you want to continue writing. Your current post will be cancelled, all current post contents will be deleted. View, edit and delete drafts within your User Control Panel.', + 'LOGIN_EXPLAIN_BUMP' => 'You need to login in order to bump topics within this forum.', + 'LOGIN_EXPLAIN_DELETE' => 'You need to login in order to delete posts within this forum.', + 'LOGIN_EXPLAIN_SOFT_DELETE' => 'You need to login in order to soft-delete posts within this forum.', + 'LOGIN_EXPLAIN_POST' => 'You need to login in order to post within this forum.', + 'LOGIN_EXPLAIN_QUOTE' => 'You need to login in order to quote posts within this forum.', + 'LOGIN_EXPLAIN_REPLY' => 'You need to login in order to reply to topics within this forum.', + + 'MAX_FONT_SIZE_EXCEEDED' => 'You may only use fonts up to size %d.', + 'MAX_FLASH_HEIGHT_EXCEEDED' => array( + 1 => 'Your flash files may only be up to %d pixel high.', + 2 => 'Your flash files may only be up to %d pixels high.', + ), + 'MAX_FLASH_WIDTH_EXCEEDED' => array( + 1 => 'Your flash files may only be up to %d pixel wide.', + 2 => 'Your flash files may only be up to %d pixels wide.', + ), + 'MAX_IMG_HEIGHT_EXCEEDED' => array( + 1 => 'Your images may only be up to %1$d pixel high.', + 2 => 'Your images may only be up to %1$d pixels high.', + ), + 'MAX_IMG_WIDTH_EXCEEDED' => array( + 1 => 'Your images may only be up to %d pixel wide.', + 2 => 'Your images may only be up to %d pixels wide.', + ), + + 'MESSAGE_BODY_EXPLAIN' => array( + 0 => '', // zero means no limit, so we don't view a message here. + 1 => 'Enter your message here, it may contain no more than %d character.', + 2 => 'Enter your message here, it may contain no more than %d characters.', + ), + 'MESSAGE_DELETED' => 'This message has been deleted successfully.', + 'MORE_SMILIES' => 'View more smilies', + + 'NOTIFY_REPLY' => 'Notify me when a reply is posted', + 'NOT_UPLOADED' => 'File could not be uploaded.', + 'NO_DELETE_POLL_OPTIONS' => 'You cannot delete existing poll options.', + 'NO_PM_ICON' => 'No PM icon', + 'NO_POLL_TITLE' => 'You have to enter a poll title.', + 'NO_POST' => 'The requested post does not exist.', + 'NO_POST_MODE' => 'No post mode specified.', + 'NO_TEMP_DIR' => 'Temporary folder could not be found or is not writable.', + + 'PARTIAL_UPLOAD' => 'The uploaded file was only partially uploaded.', + 'PHP_UPLOAD_STOPPED' => 'A PHP extension has stopped the file upload.', + 'PHP_SIZE_NA' => 'The attachment’s file size is too large.
Could not determine the maximum size defined by PHP in php.ini.', + 'PHP_SIZE_OVERRUN' => 'The attachment’s file size is too large, the maximum upload size is %1$d %2$s.
Please note this is set in php.ini and cannot be overridden.', + 'PLACE_INLINE' => 'Place inline', + 'POLL_DELETE' => 'Delete poll', + 'POLL_FOR' => 'Run poll for', + 'POLL_FOR_EXPLAIN' => 'Enter 0 for a never ending poll.', + 'POLL_MAX_OPTIONS' => 'Options per user', + 'POLL_MAX_OPTIONS_EXPLAIN' => 'This is the number of options each user may select when voting.', + 'POLL_OPTIONS' => 'Poll options', + 'POLL_OPTIONS_EXPLAIN' => array( + 1 => 'Place each option on a new line. You may enter %d option.', + 2 => 'Place each option on a new line. You may enter up to %d options.', + ), + 'POLL_OPTIONS_EDIT_EXPLAIN' => array( + 1 => 'Place each option on a new line. You may enter %d option. If you remove or add options all previous votes will be reset.', + 2 => 'Place each option on a new line. You may enter up to %d options. If you remove or add options all previous votes will be reset.', + ), + 'POLL_QUESTION' => 'Poll question', + 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.', + 'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies.', + 'POLL_VOTE_CHANGE' => 'Allow re-voting', + 'POLL_VOTE_CHANGE_EXPLAIN' => 'If enabled users are able to change their vote.', + 'POSTED_ATTACHMENTS' => 'Posted attachments', + 'POST_APPROVAL_NOTIFY' => 'You will be notified when your post has been approved.', + 'POST_CONFIRMATION' => 'Confirmation of post', + 'POST_CONFIRM_EXPLAIN' => 'To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', + 'POST_DELETED' => 'This post has been deleted successfully.', + 'POST_EDITED' => 'This post has been edited successfully.', + 'POST_EDITED_MOD' => 'This post has been edited successfully, but it will need to be approved by a moderator before it is publicly viewable.', + 'POST_GLOBAL' => 'Global', + 'POST_ICON' => 'Post icon', + 'POST_NORMAL' => 'Normal', + 'POST_REVIEW' => 'Post review', + 'POST_REVIEW_EDIT' => 'Post review', + 'POST_REVIEW_EDIT_EXPLAIN' => 'This post has been altered by another user while you were editing it. You may wish to review the current version of this post and adjust your edits.', + 'POST_REVIEW_EXPLAIN' => 'At least one new post has been made to this topic. You may wish to review your post in light of this.', + 'POST_STORED' => 'This message has been posted successfully.', + 'POST_STORED_MOD' => 'This message has been submitted successfully, but it will need to be approved by a moderator before it is publicly viewable.', + 'POST_TOPIC_AS' => 'Post topic as', + 'PROGRESS_BAR' => 'Progress bar', + + 'QUOTE_DEPTH_EXCEEDED' => array( + 1 => 'You may embed only %d quote within each other.', + 2 => 'You may embed only %d quotes within each other.', + ), + 'QUOTE_NO_NESTING' => 'You may not embed quotes within each other.', + + 'REMOTE_UPLOAD_TIMEOUT' => 'The specified file could not be uploaded because the request timed out.', + 'SAVE' => 'Save', + 'SAVE_DATE' => 'Saved at', + 'SAVE_DRAFT' => 'Save draft', + 'SAVE_DRAFT_CONFIRM' => 'Please note that saved drafts only include the subject and the message, any other element will be removed. Do you want to save your draft now?', + 'SMILIES' => 'Smilies', + 'SMILIES_ARE_OFF' => 'Smilies are OFF', + 'SMILIES_ARE_ON' => 'Smilies are ON', + 'STICKY_ANNOUNCE_TIME_LIMIT'=> 'Sticky/Announcement/Global time limit', + 'STICK_TOPIC_FOR' => 'Stick topic for', + 'STICK_TOPIC_FOR_EXPLAIN' => 'Enter 0 for a never ending Sticky/Announcement/Global. Please note that this number is relative to the date of the post.', + 'STYLES_TIP' => 'Tip: Styles can be applied quickly to selected text.', + + 'TOO_FEW_CHARS' => 'Your message contains too few characters.', + 'TOO_FEW_CHARS_LIMIT' => array( + 1 => 'You need to enter at least %1$d character.', + 2 => 'You need to enter at least %1$d characters.', + ), + 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', + 'TOO_MANY_ATTACHMENTS' => 'Cannot add another attachment, %d is the maximum.', + 'TOO_MANY_CHARS' => 'Your message contains too many characters.', + 'TOO_MANY_CHARS_LIMIT' => array( + 2 => 'The maximum number of allowed characters is %1$d.', + ), + 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', + 'TOO_MANY_SMILIES' => 'Your message contains too many smilies. The maximum number of smilies allowed is %d.', + 'TOO_MANY_URLS' => 'Your message contains too many URLs. The maximum number of URLs allowed is %d.', + 'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.', + 'TOPIC_BUMPED' => 'Topic has been bumped successfully.', + + 'UNAUTHORISED_BBCODE' => 'You cannot use certain BBCodes: %s.', + 'UNSUPPORTED_CHARACTERS_MESSAGE' => 'Your message contains the following unsupported characters:
%s', + 'UNSUPPORTED_CHARACTERS_SUBJECT' => 'Your subject contains the following unsupported characters:
%s', + 'UPDATE_COMMENT' => 'Update comment', + 'URL_INVALID' => 'The URL you specified is invalid.', + 'URL_NOT_FOUND' => 'The file specified could not be found.', + 'URL_IS_OFF' => '[url] is OFF', + 'URL_IS_ON' => '[url] is ON', + 'USER_CANNOT_BUMP' => 'You cannot bump topics in this forum.', + 'USER_CANNOT_DELETE' => 'You cannot delete posts in this forum.', + 'USER_CANNOT_EDIT' => 'You cannot edit posts in this forum.', + 'USER_CANNOT_REPLY' => 'You cannot reply in this forum.', + 'USER_CANNOT_FORUM_POST' => 'You are not able to do posting operations on this forum due to the forum type not supporting it.', + + 'VIEW_MESSAGE' => '%sView your submitted message%s', + 'VIEW_PRIVATE_MESSAGE' => '%sView your submitted private message%s', + + 'WRONG_FILESIZE' => 'The file is too big, maximum allowed size is %1$d %2$s.', + 'WRONG_SIZE' => 'The image must be at least %1$s wide, %2$s high and at most %3$s wide and %4$s high. The submitted image is %5$s wide and %6$s high.', +)); diff --git a/install/update/new/language/en/ucp.php b/install/update/new/language/en/ucp.php new file mode 100644 index 0000000..57319ae --- /dev/null +++ b/install/update/new/language/en/ucp.php @@ -0,0 +1,666 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Privacy policy and T&C +$lang = array_merge($lang, array( + 'TERMS_OF_USE_CONTENT' => 'By accessing “%1$s” (hereinafter “we”, “us”, “our”, “%1$s”, “%2$s”), you agree to be legally bound by the following terms. If you do not agree to be legally bound by all of the following terms then please do not access and/or use “%1$s”. We may change these at any time and we’ll do our utmost in informing you, though it would be prudent to review this regularly yourself as your continued usage of “%1$s” after changes mean you agree to be legally bound by these terms as they are updated and/or amended.
+
+ Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Limited”, “phpBB Teams”) which is a bulletin board solution released under the “GNU General Public License v2” (hereinafter “GPL”) and can be downloaded from www.phpbb.com. The phpBB software only facilitates internet based discussions; phpBB Limited is not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: https://www.phpbb.com/.
+
+ You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any laws be it of your country, the country where “%1$s” is hosted or International Law. Doing so may lead to you being immediately and permanently banned, with notification of your Internet Service Provider if deemed required by us. The IP address of all posts are recorded to aid in enforcing these conditions. You agree that “%1$s” have the right to remove, edit, move or close any topic at any time should we see fit. As a user you agree to any information you have entered to being stored in a database. While this information will not be disclosed to any third party without your consent, neither “%1$s” nor phpBB shall be held responsible for any hacking attempt that may lead to the data being compromised. + ', + + 'PRIVACY_POLICY' => 'This policy explains in detail how “%1$s” along with its affiliated companies (hereinafter “we”, “us”, “our”, “%1$s”, “%2$s”) and phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Limited”, “phpBB Teams”) use any information collected during any session of usage by you (hereinafter “your information”).
+
+ Your information is collected via two ways. Firstly, by browsing “%1$s” will cause the phpBB software to create a number of cookies, which are small text files that are downloaded on to your computer’s web browser temporary files. The first two cookies just contain a user identifier (hereinafter “user-id”) and an anonymous session identifier (hereinafter “session-id”), automatically assigned to you by the phpBB software. A third cookie will be created once you have browsed topics within “%1$s” and is used to store which topics have been read, thereby improving your user experience.
+
+ We may also create cookies external to the phpBB software whilst browsing “%1$s”, though these are outside the scope of this document which is intended to only cover the pages created by the phpBB software. The second way in which we collect your information is by what you submit to us. This can be, and is not limited to: posting as an anonymous user (hereinafter “anonymous posts”), registering on “%1$s” (hereinafter “your account”) and posts submitted by you after registration and whilst logged in (hereinafter “your posts”).
+
+ Your account will at a bare minimum contain a uniquely identifiable name (hereinafter “your user name”), a personal password used for logging into your account (hereinafter “your password”) and a personal, valid email address (hereinafter “your email”). Your information for your account at “%1$s” is protected by data-protection laws applicable in the country that hosts us. Any information beyond your user name, your password, and your email address required by “%1$s” during the registration process is either mandatory or optional, at the discretion of “%1$s”. In all cases, you have the option of what information in your account is publicly displayed. Furthermore, within your account, you have the option to opt-in or opt-out of automatically generated emails from the phpBB software.
+
+ Your password is ciphered (a one-way hash) so that it is secure. However, it is recommended that you do not reuse the same password across a number of different websites. Your password is the means of accessing your account at “%1$s”, so please guard it carefully and under no circumstance will anyone affiliated with “%1$s”, phpBB or another 3rd party, legitimately ask you for your password. Should you forget your password for your account, you can use the “I forgot my password” feature provided by the phpBB software. This process will ask you to submit your user name and your email, then the phpBB software will generate a new password to reclaim your account.
+ ', +)); + +// Common language entries +$lang = array_merge($lang, array( + 'ACCOUNT_ACTIVE' => 'Your account has now been activated. Thank you for registering.', + 'ACCOUNT_ACTIVE_ADMIN' => 'The account has now been activated.', + 'ACCOUNT_ACTIVE_PROFILE' => 'Your account has now been successfully reactivated.', + 'ACCOUNT_ADDED' => 'Thank you for registering, your account has been created.', + 'ACCOUNT_COPPA' => 'Your account has been created but has to be approved, please check your email for details.', + 'ACCOUNT_EMAIL_CHANGED' => 'Your account has been updated. However, this board requires account reactivation on email changes. An activation key has been sent to the new email address you provided. Please check your email for further information.', + 'ACCOUNT_EMAIL_CHANGED_ADMIN' => 'Your account has been updated. However, this board requires account reactivation by the administrators on email changes. An email has been sent to them and you will be informed when your account has been reactivated.', + 'ACCOUNT_INACTIVE' => 'Your account has been created. However, this board requires account activation. An activation key has been sent to the email address you provided. Please check your email for further information and also be sure to check your junk mail box. It may take a while to get the email depending on your email provider.', + 'ACCOUNT_INACTIVE_ADMIN' => 'Your account has been created. However, this board requires account activation by the administrator group. An email has been sent to them and you will be informed when your account has been activated.', + 'ACTIVATION_EMAIL_SENT' => 'The activation email has been sent to your email address.', + 'ACTIVATION_EMAIL_SENT_ADMIN' => 'The activation email has been sent to the administrators email addresses.', + 'ADD' => 'Add', + 'ADD_BCC' => 'Add [BCC]', + 'ADD_FOES' => 'Add new foes', + 'ADD_FOES_EXPLAIN' => 'You may enter several usernames each on a different line.', + 'ADD_FOLDER' => 'Add folder', + 'ADD_FRIENDS' => 'Add new friends', + 'ADD_FRIENDS_EXPLAIN' => 'You may enter several usernames each on a different line.', + 'ADD_NEW_RULE' => 'Add new rule', + 'ADD_RULE' => 'Add rule', + 'ADD_TO' => 'Add [To]', + 'ADD_USERS_UCP_EXPLAIN' => 'Here you can add new users to the group. You may select whether this group becomes the new default for the selected users. Please enter each username on a separate line.', + 'ADMIN_EMAIL' => 'Administrators can email me information', + 'AGREE' => 'I agree to these terms', + 'ALLOW_PM' => 'Allow users to send you private messages', + 'ALLOW_PM_EXPLAIN' => 'Note that administrators and moderators will always be able to send you messages.', + 'ALREADY_ACTIVATED' => 'You have already activated your account.', + 'ATTACHMENTS_EXPLAIN' => 'This is a list of attachments you have made in posts to this board.', + 'ATTACHMENTS_DELETED' => 'Attachments successfully deleted.', + 'ATTACHMENT_DELETED' => 'Attachment successfully deleted.', + 'ATTACHMENT_LOCKED' => 'This topic is locked, you cannot delete the attachment.', + 'AUTOLOGIN_SESSION_KEYS_DELETED'=> 'The selected "Remember Me" login keys were successfully deleted.', + 'AVATAR_CATEGORY' => 'Category', + 'AVATAR_DRIVER_GRAVATAR_TITLE' => 'Gravatar', + 'AVATAR_DRIVER_GRAVATAR_EXPLAIN'=> 'Gravatar is a service that allows you to maintain the same avatar across multiple websites. Visit Gravatar for more information.', + 'AVATAR_DRIVER_LOCAL_TITLE' => 'Gallery avatar', + 'AVATAR_DRIVER_LOCAL_EXPLAIN' => 'You can choose your avatar from a locally available set of avatars.', + 'AVATAR_DRIVER_REMOTE_TITLE' => 'Remote avatar', + 'AVATAR_DRIVER_REMOTE_EXPLAIN' => 'Link to avatar images from another website.', + 'AVATAR_DRIVER_UPLOAD_TITLE' => 'Upload avatar', + 'AVATAR_DRIVER_UPLOAD_EXPLAIN' => 'Upload your own custom avatar.', + 'AVATAR_EXPLAIN' => 'Maximum dimensions; width: %1$s, height: %2$s, file size: %3$.2f KiB.', + 'AVATAR_EXPLAIN_NO_FILESIZE' => 'Maximum dimensions; width: %1$s, height: %2$s.', + 'AVATAR_FEATURES_DISABLED' => 'The avatar functionality is currently disabled.', + 'AVATAR_GALLERY' => 'Local gallery', + 'AVATAR_GENERAL_UPLOAD_ERROR' => 'Could not upload avatar to %s.', + 'AVATAR_NOT_ALLOWED' => 'Your avatar cannot be displayed because avatars have been disallowed.', + 'AVATAR_PAGE' => 'Page', + 'AVATAR_SELECT' => 'Select your avatar', + 'AVATAR_TYPE' => 'Avatar type', + 'AVATAR_TYPE_NOT_ALLOWED' => 'Your current avatar cannot be displayed because its type has been disallowed.', + + 'BACK_TO_DRAFTS' => 'Back to saved drafts', + 'BACK_TO_LOGIN' => 'Back to login screen', + 'BIRTHDAY' => 'Birthday', + 'BIRTHDAY_EXPLAIN' => 'Setting a year will list your age when it is your birthday.', + 'BOARD_DATE_FORMAT' => 'My date format', + 'BOARD_DATE_FORMAT_EXPLAIN' => 'The syntax used is identical to the PHP date() function.', + 'BOARD_LANGUAGE' => 'My language', + 'BOARD_STYLE' => 'My board style', + 'BOARD_TIMEZONE' => 'My timezone', + 'BOOKMARKS' => 'Bookmarks', + 'BOOKMARKS_EXPLAIN' => 'You can bookmark topics for future reference. Select the checkbox for any bookmark you wish to delete, then press the Remove marked bookmarks button.', + 'BOOKMARKS_DISABLED' => 'Bookmarks are disabled on this board.', + 'BOOKMARKS_REMOVED' => 'Bookmarks removed successfully.', + + 'CANNOT_EDIT_MESSAGE_TIME' => 'You can no longer edit or delete that message.', + 'CANNOT_MOVE_TO_SAME_FOLDER'=> 'Messages cannot be moved to the folder you want to remove.', + 'CANNOT_MOVE_FROM_SPECIAL' => 'Messages cannot be moved from the outbox.', + 'CANNOT_RENAME_FOLDER' => 'This folder cannot be renamed.', + 'CANNOT_REMOVE_FOLDER' => 'This folder cannot be removed.', + 'CHANGE_DEFAULT_GROUP' => 'Change default group', + 'CHANGE_PASSWORD' => 'Change password', + 'CLICK_GOTO_FOLDER' => '%1$sGo to your “%3$s” folder%2$s', + 'CLICK_RETURN_FOLDER' => '%1$sReturn to your “%3$s” folder%2$s', + 'CONFIRMATION' => 'Confirmation of registration', + 'CONFIRM_CHANGES' => 'Confirm changes', + 'CONFIRM_EXPLAIN' => 'To prevent automated registrations the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', + 'VC_REFRESH' => 'Refresh confirmation code', + 'VC_REFRESH_EXPLAIN' => 'If you cannot read the code you can request a new one by clicking the button.', + + 'CONFIRM_PASSWORD' => 'Confirm password', + 'CONFIRM_PASSWORD_EXPLAIN' => 'You only need to confirm your password if you changed it above.', + 'COPPA_BIRTHDAY' => 'To continue with the registration procedure please tell us when you were born.', + 'COPPA_COMPLIANCE' => 'COPPA compliance', + 'COPPA_EXPLAIN' => 'Please note that clicking submit will create your account. However it cannot be activated until a parent or guardian approves your registration. You will be emailed a copy of the necessary form with details of where to send it.', + 'CREATE_FOLDER' => 'Add folder…', + 'CURRENT_IMAGE' => 'Current image', + 'CURRENT_PASSWORD' => 'Current password', + 'CURRENT_PASSWORD_EXPLAIN' => 'You must enter your current password if you wish to alter your email address or username.', + 'CURRENT_CHANGE_PASSWORD_EXPLAIN' => 'To change your password, your email address, or your username, you must enter your current password.', + 'CUR_PASSWORD_EMPTY' => 'You did not enter your current password.', + 'CUR_PASSWORD_ERROR' => 'The current password you entered is incorrect.', + 'CUSTOM_DATEFORMAT' => 'Custom…', + + 'DEFAULT_ACTION' => 'Default action', + 'DEFAULT_ACTION_EXPLAIN' => 'This action will be triggered if none of the above is applicable.', + 'DEFAULT_ADD_SIG' => 'Attach my signature by default', + 'DEFAULT_BBCODE' => 'Enable BBCode by default', + 'DEFAULT_NOTIFY' => 'Notify me upon replies by default', + 'DEFAULT_SMILIES' => 'Enable smilies by default', + 'DEFINED_RULES' => 'Defined rules', + 'DELETED_TOPIC' => 'Topic has been removed.', + 'DELETE_ATTACHMENT' => 'Delete attachment', + 'DELETE_ATTACHMENTS' => 'Delete attachments', + 'DELETE_ATTACHMENT_CONFIRM' => 'Are you sure you want to delete this attachment?', + 'DELETE_ATTACHMENTS_CONFIRM'=> 'Are you sure you want to delete these attachments?', + 'DELETE_AVATAR' => 'Delete image', + 'DELETE_COOKIES_CONFIRM' => 'Are you sure you want to delete all cookies set by this board?', + 'DELETE_MARKED_PM' => 'Delete marked messages', + 'DELETE_MARKED_PM_CONFIRM' => 'Are you sure you want to delete all marked messages?', + 'DELETE_OLDEST_MESSAGES' => 'Delete oldest messages', + 'DELETE_MESSAGE' => 'Delete message', + 'DELETE_MESSAGE_CONFIRM' => 'Are you sure you want to delete this private message?', + 'DELETE_MESSAGES_IN_FOLDER' => 'Delete all messages within removed folder', + 'DELETE_RULE' => 'Delete rule', + 'DELETE_RULE_CONFIRM' => 'Are you sure you want to delete this rule?', + 'DEMOTE_SELECTED' => 'Demote selected', + 'DISABLE_CENSORS' => 'Enable word censoring', + 'DISPLAY_GALLERY' => 'Display gallery', + 'DOMAIN_NO_MX_RECORD_EMAIL' => 'The entered email domain has no valid MX record.', + 'DOWNLOADS' => 'Downloads', + 'DRAFTS_DELETED' => 'All selected drafts were successfully deleted.', + 'DRAFTS_EXPLAIN' => 'Here you can view, edit and delete your saved drafts.', + 'DRAFT_UPDATED' => 'Draft successfully updated.', + + 'EDIT_DRAFT_EXPLAIN' => 'Here you are able to edit your draft. Drafts do not contain attachment and poll information.', + 'EMAIL_BANNED_EMAIL' => 'The email address you entered is not allowed to be used.', + 'EMAIL_REMIND' => 'This must be the email address associated with your account. If you have not changed this via your user control panel then it is the email address you registered your account with.', + 'EMAIL_TAKEN_EMAIL' => 'The entered email address is already in use.', + 'EMPTY_DRAFT' => 'You must enter a message to submit your changes.', + 'EMPTY_DRAFT_TITLE' => 'You must enter a draft title.', + 'EXPORT_AS_XML' => 'Export as XML', + 'EXPORT_AS_CSV' => 'Export as CSV', + 'EXPORT_AS_CSV_EXCEL' => 'Export as CSV (Excel)', + 'EXPORT_AS_TXT' => 'Export as TXT', + 'EXPORT_AS_MSG' => 'Export as MSG', + 'EXPORT_FOLDER' => 'Export this view', + + 'FIELD_REQUIRED' => 'The field “%s” must be completed.', + 'FIELD_TOO_SHORT' => array( + 1 => 'The field “%2$s” is too short, a minimum of %1$d character is required.', + 2 => 'The field “%2$s” is too short, a minimum of %1$d characters is required.', + ), + 'FIELD_TOO_LONG' => array( + 1 => 'The field “%2$s” is too long, a maximum of %1$d character is allowed.', + 2 => 'The field “%2$s” is too long, a maximum of %1$d characters is allowed.', + ), + 'FIELD_TOO_SMALL' => 'The value of “%2$s” is too small, a minimum value of %1$d is required.', + 'FIELD_TOO_LARGE' => 'The value of “%2$s” is too large, a maximum value of %1$d is allowed.', + 'FIELD_INVALID_CHARS_INVALID' => 'The field “%s” has invalid characters.', + 'FIELD_INVALID_CHARS_NUMBERS_ONLY' => 'The field “%s” has invalid characters, only numbers are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_DOTS' => 'The field “%s” has invalid characters, only alphanumeric or . characters are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_ONLY' => 'The field “%s” has invalid characters, only alphanumeric characters are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_PUNCTUATION' => 'The field “%s” has invalid characters, only alphanumeric or _,-. characters are allowed and the first character must be alphabetic.', + 'FIELD_INVALID_CHARS_ALPHA_SPACERS' => 'The field “%s” has invalid characters, only alphanumeric, space or -+_[] characters are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_UNDERSCORE' => 'The field “%s” has invalid characters, only alphanumeric or _ characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_DOTS' => 'The field “%s” has invalid characters, only letter, number or . characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_ONLY' => 'The field “%s” has invalid characters, only letter and number characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_PUNCTUATION' => 'The field “%s” has invalid characters, only letter, number or _,-. characters are allowed and the first character must be alphabetic.', + 'FIELD_INVALID_CHARS_LETTER_NUM_SPACERS' => 'The field “%s” has invalid characters, only letter, number, space or -+_[] characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_UNDERSCORE' => 'The field “%s” has invalid characters, only letter, number or _ characters are allowed.', + 'FIELD_INVALID_DATE' => 'The field “%s” has an invalid date.', + 'FIELD_INVALID_URL' => 'The field “%s” has an invalid url.', + 'FIELD_INVALID_VALUE' => 'The field “%s” has an invalid value.', + + 'FOE_MESSAGE' => 'Message from foe', + 'FOES_EXPLAIN' => 'Foes are users which will be ignored by default. Posts by these users will not be fully visible. Personal messages from foes are still permitted. Please note that you cannot ignore moderators or administrators.', + 'FOES_UPDATED' => 'Your foes list has been updated successfully.', + 'FOLDER_ADDED' => 'Folder successfully added.', + 'FOLDER_MESSAGE_STATUS' => array( + 1 => '%2$d out of %1$s stored', + 2 => '%2$d out of %1$s stored', + ), + 'FOLDER_NAME_EMPTY' => 'You must enter a name for this folder.', + 'FOLDER_NAME_EXIST' => 'Folder %s already exists.', + 'FOLDER_OPTIONS' => 'Folder options', + 'FOLDER_RENAMED' => 'Folder successfully renamed.', + 'FOLDER_REMOVED' => 'Folder successfully removed.', + 'FOLDER_STATUS_MSG' => array( + 1 => 'Folder is %3$d%% full (%2$d out of %1$s stored)', + 2 => 'Folder is %3$d%% full (%2$d out of %1$s stored)', + ), + 'FORWARD_PM' => 'Forward PM', + 'FORCE_PASSWORD_EXPLAIN' => 'Before you may continue browsing the board you are required to change your password.', + 'FRIEND_MESSAGE' => 'Message from friend', + 'FRIENDS' => 'Friends', + 'FRIENDS_EXPLAIN' => 'Friends enable you quick access to members you communicate with frequently. If the template has relevant support any posts made by a friend may be highlighted.', + 'FRIENDS_OFFLINE' => 'Offline', + 'FRIENDS_ONLINE' => 'Online', + 'FRIENDS_UPDATED' => 'Your friends list has been updated successfully.', + 'FULL_FOLDER_OPTION_CHANGED'=> 'The action to take when a folder is full has been changed successfully.', + 'FWD_ORIGINAL_MESSAGE' => '-------- Original Message --------', + 'FWD_SUBJECT' => 'Subject: %s', + 'FWD_DATE' => 'Date: %s', + 'FWD_FROM' => 'From: %s', + 'FWD_TO' => 'To: %s', + + 'GLOBAL_ANNOUNCEMENT' => 'Global announcement', + + 'GRAVATAR_AVATAR_EMAIL' => 'Gravatar email', + 'GRAVATAR_AVATAR_EMAIL_EXPLAIN' => 'Enter the email address you used for registering your account on Gravatar.', + 'GRAVATAR_AVATAR_SIZE' => 'Avatar dimensions', + 'GRAVATAR_AVATAR_SIZE_EXPLAIN' => 'Specify the width and height of the avatar, leave blank to attempt automatic verification.', + + 'HIDE_ONLINE' => 'Hide my online status', + 'HIDE_ONLINE_EXPLAIN' => 'Changing this setting won’t become effective until your next visit to the board.', + 'HOLD_NEW_MESSAGES' => 'Do not accept new messages (New messages will be held back until enough space is available)', + 'HOLD_NEW_MESSAGES_SHORT' => 'New messages will be held back', + + 'IF_FOLDER_FULL' => 'If folder is full', + 'IMPORTANT_NEWS' => 'Important announcements', + 'INVALID_USER_BIRTHDAY' => 'The entered birthday is not a valid date.', + 'INVALID_CHARS_USERNAME' => 'The username contains forbidden characters.', + 'INVALID_EMOJIS_USERNAME' => 'The username contains forbidden characters (Emoji).', + 'INVALID_CHARS_NEW_PASSWORD'=> 'The password does not contain the required characters.', + 'ITEMS_REQUIRED' => 'The items marked with * are required profile fields and need to be filled out.', + + 'JOIN_SELECTED' => 'Join selected', + + 'LANGUAGE' => 'Language', + 'LINK_REMOTE_AVATAR' => 'Link off-site', + 'LINK_REMOTE_AVATAR_EXPLAIN'=> 'Enter the URL of the location containing the avatar image you wish to link to.', + 'LINK_REMOTE_SIZE' => 'Avatar dimensions', + 'LINK_REMOTE_SIZE_EXPLAIN' => 'Specify the width and height of the avatar, leave blank to attempt automatic verification.', + 'LOGIN_EXPLAIN_UCP' => 'Please login in order to access the User Control Panel.', + 'LOGIN_LINK' => 'Link or register your account on an external service with your board account', + 'LOGIN_LINK_EXPLAIN' => 'You have attempted to login with an external service that is not yet connected to an account on this board. You must now either link this account to an existing account or create a new account.', + 'LOGIN_LINK_MISSING_DATA' => 'Data that is necessary to link your account with an external service is not available. Please restart the login process.', + 'LOGIN_LINK_NO_DATA_PROVIDED' => 'No data has been provided to this page to link an external account to a forum account. Please contact the board administrator if you continue to experience problems.', + 'LOGIN_KEY' => 'Login Key', + 'LOGIN_TIME' => 'Login Time', + 'LOGIN_REDIRECT' => 'You have been successfully logged in.', + 'LOGOUT_FAILED' => 'You were not logged out, as the request did not match your session. Please contact the board administrator if you continue to experience problems.', + 'LOGOUT_REDIRECT' => 'You have been successfully logged out.', + + 'MARK_IMPORTANT' => 'Mark/Unmark as important', + 'MARKED_MESSAGE' => 'Marked message', + 'MAX_FOLDER_REACHED' => 'Maximum number of allowed user defined folders reached.', + 'MESSAGE_BY_AUTHOR' => 'by', + 'MESSAGE_COLOURS' => 'Message colours', + 'MESSAGE_DELETED' => 'Message successfully deleted.', + 'MESSAGE_EDITED' => 'Message successfully edited.', + 'MESSAGE_HISTORY' => 'Message history', + 'MESSAGE_REMOVED_FROM_OUTBOX' => 'This message was deleted by its author.', + 'MESSAGE_REPORTED_MESSAGE' => 'Reported message', + 'MESSAGE_SENT_ON' => 'on', + 'MESSAGE_STORED' => 'This message has been sent successfully.', + 'MESSAGE_TO' => 'To', + 'MESSAGES_DELETED' => 'Messages successfully deleted', + 'MOVE_DELETED_MESSAGES_TO' => 'Move messages from removed folder to', + 'MOVE_DOWN' => 'Move down', + 'MOVE_MARKED_TO_FOLDER' => 'Move marked to %s', + 'MOVE_PM_ERROR' => array( + 1 => 'An error occurred while moving the messages to the new folder, only %2$d out of %1$s was moved.', + 2 => 'An error occurred while moving the messages to the new folder, only %2$d out of %1$s were moved.', + ), + 'MOVE_TO_FOLDER' => 'Move to folder', + 'MOVE_UP' => 'Move up', + + 'NEW_FOLDER_NAME' => 'New folder name', + 'NEW_PASSWORD' => 'New password', + 'NEW_PASSWORD_CONFIRM_EMPTY' => 'You did not enter a confirm password.', + 'NEW_PASSWORD_ERROR' => 'The passwords you entered do not match.', + + 'NOTIFICATIONS_MARK_ALL_READ' => 'Mark all notifications read', + 'NOTIFICATIONS_MARK_ALL_READ_CONFIRM' => 'Are you sure you want to mark all notifications read?', + 'NOTIFICATIONS_MARK_ALL_READ_SUCCESS' => 'All notifications have been marked read.', + 'NOTIFICATION_GROUP_MISCELLANEOUS' => 'Miscellaneous Notifications', + 'NOTIFICATION_GROUP_MODERATION' => 'Moderation Notifications', + 'NOTIFICATION_GROUP_ADMINISTRATION' => 'Administration Notifications', + 'NOTIFICATION_GROUP_POSTING' => 'Posting Notifications', + 'NOTIFICATION_METHOD_BOARD' => 'Notifications', + 'NOTIFICATION_METHOD_EMAIL' => 'Email', + 'NOTIFICATION_METHOD_JABBER' => 'Jabber', + 'NOTIFICATION_TYPE' => 'Notification type', + 'NOTIFICATION_TYPE_BOOKMARK' => 'Someone replies to a topic you have bookmarked', + 'NOTIFICATION_TYPE_GROUP_REQUEST' => 'Someone requests to join a group you lead', + 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE' => 'A post or topic needs approval', + 'NOTIFICATION_TYPE_MODERATION_QUEUE' => 'Your topics/posts are approved or disapproved by a moderator', + 'NOTIFICATION_TYPE_PM' => 'Someone sends you a private message', + 'NOTIFICATION_TYPE_POST' => 'Someone replies to a topic to which you are subscribed', + 'NOTIFICATION_TYPE_QUOTE' => 'Someone quotes you in a post', + 'NOTIFICATION_TYPE_REPORT' => 'Someone reports a post', + 'NOTIFICATION_TYPE_TOPIC' => 'Someone creates a topic in a forum to which you are subscribed', + 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER' => 'User requiring activation', + + 'NOTIFY_METHOD' => 'Notification method', + 'NOTIFY_METHOD_BOTH' => 'Both', + 'NOTIFY_METHOD_EMAIL' => 'Email only', + 'NOTIFY_METHOD_EXPLAIN' => 'Method for sending messages sent via this board.', + 'NOTIFY_METHOD_IM' => 'Jabber only', + 'NOTIFY_ON_PM' => 'Notify me on new private messages', + 'NOT_ADDED_FRIENDS_ANONYMOUS' => 'You cannot add the anonymous user to your friends list.', + 'NOT_ADDED_FRIENDS_BOTS' => 'You cannot add bots to your friends list.', + 'NOT_ADDED_FRIENDS_FOES' => 'You cannot add users to your friends list who are on your foes list.', + 'NOT_ADDED_FRIENDS_SELF' => 'You cannot add yourself to the friends list.', + 'NOT_ADDED_FOES_MOD_ADMIN' => 'You cannot add administrators and moderators to your foes list.', + 'NOT_ADDED_FOES_ANONYMOUS' => 'You cannot add the anonymous user to your foes list.', + 'NOT_ADDED_FOES_BOTS' => 'You cannot add bots to your foes list.', + 'NOT_ADDED_FOES_FRIENDS' => 'You cannot add users to your foes list who are on your friends list.', + 'NOT_ADDED_FOES_SELF' => 'You cannot add yourself to the foes list.', + 'NOT_AGREE' => 'I do not agree to these terms', + 'NOT_ENOUGH_SPACE_FOLDER' => 'The destination folder “%s” seems to be full. The requested action has not been taken.', + 'NOT_MOVED_MESSAGES' => array( + 1 => 'You have %d private message currently on hold because of full folder.', + 2 => 'You have %d private messages currently on hold because of full folder.', + ), + 'NO_ACTION_MODE' => 'No message action specified.', + 'NO_AUTHOR' => 'No author defined for this message', + 'NO_AVATAR' => 'No avatar selected', + 'NO_AVATAR_CATEGORY' => 'None', + + 'NO_AUTH_DELETE_MESSAGE' => 'You are not authorised to delete private messages.', + 'NO_AUTH_EDIT_MESSAGE' => 'You are not authorised to edit private messages.', + 'NO_AUTH_FORWARD_MESSAGE' => 'You are not authorised to forward private messages.', + 'NO_AUTH_GROUP_MESSAGE' => 'You are not authorised to send private messages to groups.', + 'NO_AUTH_PROFILEINFO' => 'You are not authorised to change your profile information.', + 'NO_AUTH_READ_HOLD_MESSAGE' => 'You are not authorised to read private messages that are on hold.', + 'NO_AUTH_READ_MESSAGE' => 'You are not authorised to read private messages.', + 'NO_AUTH_PRINT_MESSAGE' => 'You are not authorised to print private messages.', + 'NO_AUTH_READ_REMOVED_MESSAGE' => 'You are not able to read this message because it was removed by the author.', + 'NO_AUTH_SEND_MESSAGE' => 'You are not authorised to send private messages.', + 'NO_AUTH_SIGNATURE' => 'You are not authorised to define a signature.', + + 'NO_BCC_RECIPIENT' => 'None', + 'NO_BOOKMARKS' => 'You have no bookmarks.', + 'NO_BOOKMARKS_SELECTED' => 'You have selected no bookmarks.', + 'NO_EDIT_READ_MESSAGE' => 'Private message cannot be edited because it has already been read.', + 'NO_EMAIL_USER' => 'The email/username information submitted could not be found.', + 'EMAIL_NOT_UNIQUE' => 'Email you specified is used by multiple users. You must specify username as well.', + 'NO_FOES' => 'No foes currently defined', + 'NO_FRIENDS' => 'No friends currently defined', + 'NO_FRIENDS_OFFLINE' => 'No friends offline', + 'NO_FRIENDS_ONLINE' => 'No friends online', + 'NO_GROUP_SELECTED' => 'No group specified.', + 'NO_IMPORTANT_NEWS' => 'No important announcements present.', + 'NO_MESSAGE' => 'Private message could not be found.', + 'NO_NEW_FOLDER_NAME' => 'You have to specify a new folder name.', + 'NO_NEWER_PM' => 'No newer messages.', + 'NO_OLDER_PM' => 'No older messages.', + 'NO_PASSWORD_SUPPLIED' => 'You cannot login without a password.', + 'NO_RECIPIENT' => 'No recipient defined.', + 'NO_RESET_TOKEN' => 'You did not provide a password reset token.', + 'NO_RULES_DEFINED' => 'No rules defined.', + 'NO_SAVED_DRAFTS' => 'No drafts saved.', + 'NO_TO_RECIPIENT' => 'None', + 'NO_WATCHED_FORUMS' => 'You are not subscribed to any forums.', + 'NO_WATCHED_SELECTED' => 'You have not selected any subscribed topics or forums.', + 'NO_WATCHED_TOPICS' => 'You are not subscribed to any topics.', + + 'PASS_TYPE_ALPHA_EXPLAIN' => 'Password must be at least %1$s long, must contain letters in mixed case and must contain numbers.', + 'PASS_TYPE_ANY_EXPLAIN' => 'Must be at least %1$s long.', + 'PASS_TYPE_CASE_EXPLAIN' => 'Password must be at least %1$s long and must contain letters in mixed case.', + 'PASS_TYPE_SYMBOL_EXPLAIN' => 'Password must be at least %1$s long, must contain letters in mixed case, must contain numbers and must contain symbols.', + 'PASSWORD' => 'Password', + 'PASSWORD_ACTIVATED' => 'Your new password has been activated.', + 'PASSWORD_RESET' => 'Your password has been successfully reset.', + 'PASSWORD_RESET_LINK_SENT' => 'If your account exists, a password reset link was sent to your registered email address. If you do not receive an email, it may be because you are banned, your account is not activated, you have requested multiple password resets within a short time frame, or you are not allowed to change your password. Contact an administrator if any of those reasons apply. Also, please check your spam filter.', + 'PERMISSIONS_RESTORED' => 'Successfully restored original permissions.', + 'PERMISSIONS_TRANSFERRED' => 'Successfully transferred permissions from %s, you are now able to browse the board with this user’s permissions.
Please note that admin permissions were not transferred. You are able to revert to your permission set at any time.', + 'PM_DISABLED' => 'Private messaging has been disabled on this board.', + 'PM_FROM' => 'From', + 'PM_FROM_REMOVED_AUTHOR' => 'This message was sent by a user no longer registered.', + 'PM_ICON' => 'PM icon', + 'PM_INBOX' => 'Inbox', + 'PM_MARK_ALL_READ' => 'Mark all messages read', + 'PM_MARK_ALL_READ_SUCCESS' => 'All private messages in this folder have been marked read', + 'PM_NO_USERS' => 'The requested users to be added do not exist.', + 'PM_OUTBOX' => 'Outbox', + 'PM_SENTBOX' => 'Sent messages', + 'PM_SUBJECT' => 'Message subject', + 'PM_TO' => 'Send to', + 'PM_TOOLS' => 'Message tools', + 'PM_USERS_REMOVED_NO_PERMISSION' => 'Some users couldn’t be added as they do not have permission to read private messages.', + 'PM_USERS_REMOVED_NO_PM' => 'Some users couldn’t be added as they have disabled private message receipt.', + 'POST_EDIT_PM' => 'Edit message', + 'POST_FORWARD_PM' => 'Forward message', + 'POST_NEW_PM' => 'Compose message', + 'POST_PM_LOCKED' => 'Private messaging is locked.', + 'POST_PM_POST' => 'Quote post', + 'POST_QUOTE_PM' => 'Quote message', + 'POST_REPLY_PM' => 'Reply to message', + 'PRINT_PM' => 'Print view', + 'PREFERENCES_UPDATED' => 'Your preferences have been updated.', + 'PROFILE_INFO_NOTICE' => 'Please note that this information may be viewable to other members. Be careful when including any personal details. Any fields marked with a * must be completed.', + 'PROFILE_UPDATED' => 'Your profile has been updated.', + 'PROFILE_AUTOLOGIN_KEYS' => 'The "Remember Me" login keys automatically log you in when you visit the board. If you logout, the remember me login key is deleted only on the computer you are using to logout. Here you can see remember login keys created on other computers you used to access this site.', + 'PROFILE_NO_AUTOLOGIN_KEYS' => 'There are no saved "Remember Me" login keys.', + + 'RECIPIENT' => 'Recipient', + 'RECIPIENTS' => 'Recipients', + 'REGISTRATION' => 'Registration', + 'OAUTH_REGISTRATION' => 'Registration using external services', + 'RELEASE_MESSAGES' => '%sRelease all on-hold messages%s… they will be re-sorted into the appropriate folder if enough space is made available.', + 'REMOVE_ADDRESS' => 'Remove address', + 'REMOVE_SELECTED_BOOKMARKS' => 'Remove selected bookmarks', + 'REMOVE_SELECTED_BOOKMARKS_CONFIRM' => 'Are you sure you want to delete all selected bookmarks?', + 'REMOVE_BOOKMARK_MARKED' => 'Remove marked bookmarks', + 'REMOVE_FOLDER' => 'Remove folder', + 'REMOVE_FOLDER_CONFIRM' => 'Are you sure you want to remove this folder?', + 'RENAME' => 'Rename', + 'RENAME_FOLDER' => 'Rename folder', + 'REPLIED_MESSAGE' => 'Replied to message', + 'REPLY_TO_ALL' => 'Reply to sender and all recipients.', + 'REPORT_PM' => 'Report private message', + 'RESET_PASSWORD' => 'Reset password', + 'RESET_TOKEN_EXPIRED_OR_INVALID' => 'The password reset token you supplied is invalid or has expired.', + 'RESIGN_SELECTED' => 'Resign selected', + 'RETURN_FOLDER' => '%1$sReturn to previous folder%2$s', + 'RETURN_UCP' => '%sReturn to the User Control Panel%s', + 'RULE_ADDED' => 'Rule successfully added.', + 'RULE_ALREADY_DEFINED' => 'This rule was defined previously.', + 'RULE_DELETED' => 'Rule successfully removed.', + 'RULE_LIMIT_REACHED' => 'You cannot add more PM rules. You have reached the maximum number of rules.', + 'RULE_NOT_DEFINED' => 'Rule not correctly specified.', + 'RULE_REMOVED_MESSAGES' => array( + 1 => '%d private message was removed due to private message filters.', + 2 => '%d private messages were removed due to private message filters.', + ), + + 'SAME_PASSWORD_ERROR' => 'The new password you entered is the same as your current password.', + 'SEARCH_YOUR_POSTS' => 'Show your posts', + 'SENT_AT' => 'Sent', // Used before dates in private messages + 'SHOW_EMAIL' => 'Users can contact me by email', + 'SIGNATURE_EXPLAIN' => 'This is a block of text that can be added to posts you make. There is a %d character limit.', + 'SIGNATURE_PREVIEW' => 'Your signature will appear like this in posts', + 'SIGNATURE_TOO_LONG' => 'Your signature is too long.', + 'SELECT_CURRENT_TIME' => 'Select current time', + 'SELECT_TIMEZONE' => 'Select timezone', + 'SORT' => 'Sort', + 'SORT_COMMENT' => 'File comment', + 'SORT_DOWNLOADS' => 'Downloads', + 'SORT_EXTENSION' => 'Extension', + 'SORT_FILENAME' => 'Filename', + 'SORT_POST_TIME' => 'Post time', + 'SORT_SIZE' => 'File size', + + 'TIMEZONE' => 'Timezone', + 'TIMEZONE_DATE_SUGGESTION' => 'Suggestion: %s', + 'TIMEZONE_INVALID' => 'The timezone you selected is invalid.', + 'TO' => 'Recipient', + 'TO_MASS' => 'Recipients', + 'TO_ADD' => 'Add recipient', + 'TO_ADD_MASS' => 'Add recipients', + 'TO_ADD_GROUPS' => 'Add groups', + 'TOO_MANY_RECIPIENTS' => 'You tried to send a private message to too many recipients.', + 'TOO_MANY_REGISTERS' => 'You have exceeded the maximum number of registration attempts for this session. Please try again later.', + + 'UCP' => 'User Control Panel', + 'UCP_ACTIVATE' => 'Activate account', + 'UCP_ADMIN_ACTIVATE' => 'Please note that you will need to enter a valid email address before your account is activated. The administrator will review your account and if approved you will receive an email at the address you specified.', + 'UCP_ATTACHMENTS' => 'Attachments', + 'UCP_AUTH_LINK' => 'External accounts', + 'UCP_AUTH_LINK_ASK' => 'You currently have no account associated with this external service. Click the button below to link your board account to an account with this external service.', + 'UCP_AUTH_LINK_ID' => 'Unique identifier', + 'UCP_AUTH_LINK_LINK' => 'Link', + 'UCP_AUTH_LINK_MANAGE' => 'Manage external account associations', + 'UCP_AUTH_LINK_NOT_SUPPORTED' => 'Linking board accounts to external services is not supported by this board’s current authentication method.', + 'UCP_AUTH_LINK_TITLE' => 'Manage your external account associations', + 'UCP_AUTH_LINK_UNLINK' => 'Unlink', + 'UCP_COPPA_BEFORE' => 'Before %s', + 'UCP_COPPA_ON_AFTER' => 'On or after %s', + 'UCP_EMAIL_ACTIVATE' => 'Please note that you will need to enter a valid email address before your account is activated. You will receive an email at the address you provide that contains an account activation link.', + 'UCP_JABBER' => 'Jabber address', + 'UCP_LOGIN_LINK' => 'Set up an external account association', + + 'UCP_MAIN' => 'Overview', + 'UCP_MAIN_ATTACHMENTS' => 'Manage attachments', + 'UCP_MAIN_BOOKMARKS' => 'Manage bookmarks', + 'UCP_MAIN_DRAFTS' => 'Manage drafts', + 'UCP_MAIN_FRONT' => 'Front page', + 'UCP_MAIN_SUBSCRIBED' => 'Manage subscriptions', + + 'UCP_NO_ATTACHMENTS' => 'You have posted no files.', + + 'UCP_NOTIFICATION_LIST' => 'Manage notifications', + 'UCP_NOTIFICATION_LIST_EXPLAIN' => 'Here you may view all past notifications.', + 'UCP_NOTIFICATION_OPTIONS' => 'Edit notification options', + 'UCP_NOTIFICATION_OPTIONS_EXPLAIN' => 'Here you can set your preferred notification methods for the board.', + + 'UCP_PREFS' => 'Board preferences', + 'UCP_PREFS_PERSONAL' => 'Edit global settings', + 'UCP_PREFS_POST' => 'Edit posting defaults', + 'UCP_PREFS_VIEW' => 'Edit display options', + + 'UCP_PM' => 'Private messages', + 'UCP_PM_COMPOSE' => 'Compose message', + 'UCP_PM_DRAFTS' => 'Manage PM drafts', + 'UCP_PM_OPTIONS' => 'Rules, folders & settings', + 'UCP_PM_UNREAD' => 'Unread messages', + 'UCP_PM_VIEW' => 'View messages', + + 'UCP_PROFILE' => 'Profile', + 'UCP_PROFILE_AVATAR' => 'Edit avatar', + 'UCP_PROFILE_PROFILE_INFO' => 'Edit profile', + 'UCP_PROFILE_REG_DETAILS' => 'Edit account settings', + 'UCP_PROFILE_SIGNATURE' => 'Edit signature', + 'UCP_PROFILE_AUTOLOGIN_KEYS'=> 'Manage “Remember Me” login keys', + + 'UCP_USERGROUPS' => 'Usergroups', + 'UCP_USERGROUPS_MEMBER' => 'Edit memberships', + 'UCP_USERGROUPS_MANAGE' => 'Manage groups', + + 'UCP_PASSWORD_RESET_DISABLED' => 'The password reset functionality has been disabled. If you need help accessing your account, please contact the %sBoard Administrator%s', + 'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.', + 'UCP_RESEND' => 'Send activation email', + 'UCP_WELCOME' => 'Welcome to the User Control Panel. From here you can monitor, view and update your profile, preferences, subscribed forums and topics. You can also send messages to other users (if permitted). Please ensure you read any announcements before continuing.', + 'UCP_ZEBRA' => 'Friends & Foes', + 'UCP_ZEBRA_FOES' => 'Manage foes', + 'UCP_ZEBRA_FRIENDS' => 'Manage friends', + 'UNDISCLOSED_RECIPIENT' => 'Undisclosed Recipient', + 'UNKNOWN_FOLDER' => 'Unknown folder', + 'UNWATCH_MARKED' => 'Unwatch marked', + 'UPLOAD_AVATAR_FILE' => 'Upload from your machine', + 'UPLOAD_AVATAR_URL' => 'Upload from a URL', + 'UPLOAD_AVATAR_URL_EXPLAIN' => 'Enter the URL of the location containing the image. The image will be copied to this site.', + 'USERNAME_ALPHA_ONLY_EXPLAIN' => 'Username must be between %1$s and %2$s long and use only alphanumeric characters.', + 'USERNAME_ALPHA_SPACERS_EXPLAIN'=> 'Username must be between %1$s and %2$s long and use alphanumeric, space or -+_[] characters.', + 'USERNAME_ASCII_EXPLAIN' => 'Username must be between %1$s and %2$s long and use only ASCII characters, so no special symbols.', + 'USERNAME_LETTER_NUM_EXPLAIN' => 'Username must be between %1$s and %2$s long and use only letter or number characters.', + 'USERNAME_LETTER_NUM_SPACERS_EXPLAIN'=> 'Username must be between %1$s and %2$s long and use letter, number, space or -+_[] characters.', + 'USERNAME_CHARS_ANY_EXPLAIN' => 'Length must be between %1$s and %2$s.', + 'USERNAME_TAKEN_USERNAME' => 'The username you entered is already in use, please select an alternative.', + 'USERNAME_DISALLOWED_USERNAME' => 'The username you entered has been disallowed or contains a disallowed word. Please choose a different name.', + 'USER_NOT_FOUND_OR_INACTIVE' => 'The usernames you specified could either not be found or are not activated users.', + + 'VIEW_AVATARS' => 'Display avatars', + 'VIEW_EDIT' => 'View/Edit', + 'VIEW_FLASH' => 'Display Flash animations', + 'VIEW_IMAGES' => 'Display images within posts', + 'VIEW_NEXT_HISTORY' => 'Next PM in history', + 'VIEW_NEXT_PM' => 'Next PM', + 'VIEW_PM' => 'View message', + 'VIEW_PM_INFO' => 'Message details', + 'VIEW_PM_MESSAGES' => array( + 1 => '%d message', + 2 => '%d messages', + ), + 'VIEW_PREVIOUS_HISTORY' => 'Previous PM in history', + 'VIEW_PREVIOUS_PM' => 'Previous PM', + 'VIEW_PROFILE' => 'View profile', + 'VIEW_SIGS' => 'Display signatures', + 'VIEW_SMILIES' => 'Display smilies as images', + 'VIEW_TOPICS_DAYS' => 'Display topics from previous days', + 'VIEW_TOPICS_DIR' => 'Display topic order direction', + 'VIEW_TOPICS_KEY' => 'Display topics ordering by', + 'VIEW_POSTS_DAYS' => 'Display posts from previous days', + 'VIEW_POSTS_DIR' => 'Display post order direction', + 'VIEW_POSTS_KEY' => 'Display posts ordering by', + + 'WATCHED_EXPLAIN' => 'Below is a list of forums and topics you are subscribed to. You will be notified of new posts in either. To unsubscribe mark the forum or topic and then press the Unwatch marked button.', + 'WATCHED_FORUMS' => 'Watched forums', + 'WATCHED_TOPICS' => 'Watched topics', + 'WRONG_ACTIVATION' => 'The activation key you supplied does not match any in the database.', + + 'YOUR_DETAILS' => 'Your activity', + 'YOUR_FOES' => 'Your foes', + 'YOUR_FOES_EXPLAIN' => 'To remove usernames select them and click submit.', + 'YOUR_FRIENDS' => 'Your friends', + 'YOUR_FRIENDS_EXPLAIN' => 'To remove usernames select them and click submit.', + 'YOUR_WARNINGS' => 'Your warning level', + + 'PM_ACTION' => array( + 'PLACE_INTO_FOLDER' => 'Place into folder', + 'MARK_AS_READ' => 'Mark as read', + 'MARK_AS_IMPORTANT' => 'Mark message', + 'DELETE_MESSAGE' => 'Delete message', + ), + 'PM_CHECK' => array( + 'SUBJECT' => 'Subject', + 'SENDER' => 'Sender', + 'MESSAGE' => 'Message', + 'STATUS' => 'Message status', + 'TO' => 'Sent To', + ), + 'PM_RULE' => array( + 'IS_LIKE' => 'is like', + 'IS_NOT_LIKE' => 'is not like', + 'IS' => 'is', + 'IS_NOT' => 'is not', + 'BEGINS_WITH' => 'begins with', + 'ENDS_WITH' => 'ends with', + 'IS_FRIEND' => 'is friend', + 'IS_FOE' => 'is foe', + 'IS_USER' => 'is user', + 'IS_GROUP' => 'is in usergroup', + 'ANSWERED' => 'answered', + 'FORWARDED' => 'forwarded', + 'TO_GROUP' => 'to my default usergroup', + 'TO_ME' => 'to me', + ), + + 'GROUPS_EXPLAIN' => 'Usergroups enable board admins to better administer users. By default you will be placed in a specific group, this is your default group. This group defines how you may appear to other users, for example your username colouration, avatar, rank, etc. Depending on whether the administrator allows it you may be allowed to change your default group. You may also be placed in or allowed to join other groups. Some groups may give you additional permissions to view content or increase your capabilities in other areas.', + 'GROUP_LEADER' => 'Leaderships', + 'GROUP_MEMBER' => 'Memberships', + 'GROUP_PENDING' => 'Pending memberships', + 'GROUP_NONMEMBER' => 'Non-memberships', + 'GROUP_DETAILS' => 'Group details', + + 'NO_LEADER' => 'No group leaderships', + 'NO_MEMBER' => 'No group memberships', + 'NO_PENDING' => 'No pending memberships', + 'NO_NONMEMBER' => 'No non-member groups', +)); diff --git a/install/update/new/mcp.php b/install/update/new/mcp.php new file mode 100644 index 0000000..c8fb023 --- /dev/null +++ b/install/update/new/mcp.php @@ -0,0 +1,331 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); +include($phpbb_root_path . 'includes/functions_mcp.' . $phpEx); +require($phpbb_root_path . 'includes/functions_module.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('mcp'); + +$module = new p_master(); + +// Setting a variable to let the style designer know where he is... +$template->assign_var('S_IN_MCP', true); + +// Basic parameter data +$id = $request->variable('i', ''); + +$mode = $request->variable('mode', array('')); +$mode = count($mode) ? array_shift($mode) : $request->variable('mode', ''); + +// Only Moderators can go beyond this point +if (!$user->data['is_registered']) +{ + if ($user->data['is_bot']) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + login_box('', $user->lang['LOGIN_EXPLAIN_MCP']); +} + +$quickmod = (isset($_REQUEST['quickmod'])) ? true : false; +$action = $request->variable('action', ''); +$action_ary = $request->variable('action', array('' => 0)); + +$forum_action = $request->variable('forum_action', ''); +if ($forum_action !== '' && $request->variable('sort', false, false, \phpbb\request\request_interface::POST)) +{ + $action = $forum_action; +} + +if (count($action_ary)) +{ + $action = key($action_ary); +} +unset($action_ary); + +if ($mode == 'topic_logs') +{ + $id = 'logs'; + $quickmod = false; +} + +$post_id = $request->variable('p', 0); +$topic_id = $request->variable('t', 0); +$forum_id = $request->variable('f', 0); +$report_id = $request->variable('r', 0); +$user_id = $request->variable('u', 0); +$username = $request->variable('username', '', true); + +if ($post_id) +{ + // We determine the topic and forum id here, to make sure the moderator really has moderative rights on this post + $sql = 'SELECT topic_id, forum_id + FROM ' . POSTS_TABLE . " + WHERE post_id = $post_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $topic_id = (int) $row['topic_id']; + $forum_id = (int) $row['forum_id']; +} +else if ($topic_id) +{ + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . " + WHERE topic_id = $topic_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $forum_id = (int) $row['forum_id']; +} + +// If the user doesn't have any moderator powers (globally or locally) he can't access the mcp +if (!$auth->acl_getf_global('m_')) +{ + // Except he is using one of the quickmod tools for users + $user_quickmod_actions = array( + 'lock' => 'f_user_lock', + 'make_sticky' => 'f_sticky', + 'make_announce' => 'f_announce', + 'make_global' => 'f_announce_global', + 'make_normal' => array('f_announce', 'f_announce_global', 'f_sticky') + ); + + $allow_user = false; + if ($quickmod && isset($user_quickmod_actions[$action]) && $user->data['is_registered'] && $auth->acl_gets($user_quickmod_actions[$action], $forum_id)) + { + $topic_info = phpbb_get_topic_data(array($topic_id)); + if ($topic_info[$topic_id]['topic_poster'] == $user->data['user_id']) + { + $allow_user = true; + } + } + + if (!$allow_user) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } +} + +// if the user cannot read the forum he tries to access then we won't allow mcp access either +if ($forum_id && !$auth->acl_get('f_read', $forum_id)) +{ + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); +} + +/** +* Allow applying additional permissions to MCP access besides f_read +* +* @event core.mcp_global_f_read_auth_after +* @var string action The action the user tried to execute +* @var int forum_id The forum the user tried to access +* @var string mode The MCP module the user is trying to access +* @var p_master module Module system class +* @var bool quickmod True if the user is accessing using quickmod tools +* @var int topic_id The topic the user tried to access +* @since 3.1.3-RC1 +*/ +$vars = array( + 'action', + 'forum_id', + 'mode', + 'module', + 'quickmod', + 'topic_id', +); +extract($phpbb_dispatcher->trigger_event('core.mcp_global_f_read_auth_after', compact($vars))); + +if ($forum_id) +{ + $module->acl_forum_id = $forum_id; +} + +// Instantiate module system and generate list of available modules +$module->list_modules('mcp'); + +if ($quickmod) +{ + $mode = 'quickmod'; + + switch ($action) + { + case 'lock': + case 'unlock': + case 'lock_post': + case 'unlock_post': + case 'make_sticky': + case 'make_announce': + case 'make_global': + case 'make_normal': + case 'fork': + case 'move': + case 'delete_post': + case 'delete_topic': + case 'restore_topic': + $module->load('mcp', 'main', 'quickmod'); + return; + break; + + case 'topic_logs': + // Reset start parameter if we jumped from the quickmod dropdown + if ($request->variable('start', 0)) + { + $request->overwrite('start', 0); + } + + $module->set_active('logs', 'topic_logs'); + break; + + case 'merge_topic': + $module->set_active('main', 'forum_view'); + break; + + case 'split': + case 'merge': + $module->set_active('main', 'topic_view'); + break; + + default: + // If needed, the flag can be set to true within event listener + // to indicate that the action was handled properly + // and to pass by the trigger_error() call below + $is_valid_action = false; + + /** + * This event allows you to add custom quickmod options + * + * @event core.modify_quickmod_options + * @var object module Instance of module system class + * @var string action Quickmod option + * @var bool is_valid_action Flag indicating if the action was handled properly + * @since 3.1.0-a4 + */ + $vars = array('module', 'action', 'is_valid_action'); + extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_options', compact($vars))); + + if (!$is_valid_action) + { + trigger_error($user->lang('QUICKMOD_ACTION_NOT_ALLOWED', $action), E_USER_ERROR); + } + break; + } +} +else +{ + // Select the active module + $module->set_active($id, $mode); +} + +// Hide some of the options if we don't have the relevant information to use them +if (!$post_id) +{ + $module->set_display('main', 'post_details', false); + $module->set_display('warn', 'warn_post', false); +} + +if ($mode == '' || $mode == 'unapproved_topics' || $mode == 'unapproved_posts' || $mode == 'deleted_topics' || $mode == 'deleted_posts') +{ + $module->set_display('queue', 'approve_details', false); +} + +if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' || $mode == 'pm_reports' || $mode == 'pm_reports_closed' || $mode == 'pm_report_details') +{ + $module->set_display('reports', 'report_details', false); +} + +if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' || $mode == 'pm_reports' || $mode == 'pm_reports_closed' || $mode == 'report_details') +{ + $module->set_display('pm_reports', 'pm_report_details', false); +} + +if (!$topic_id) +{ + $module->set_display('main', 'topic_view', false); + $module->set_display('logs', 'topic_logs', false); +} + +if (!$forum_id) +{ + $module->set_display('main', 'forum_view', false); + $module->set_display('logs', 'forum_logs', false); +} + +if (!$user_id && $username == '') +{ + $module->set_display('notes', 'user_notes', false); + $module->set_display('warn', 'warn_user', false); +} + +/** +* This event allows you to set display option for custom MCP modules +* +* @event core.modify_mcp_modules_display_option +* @var p_master module Module system class +* @var string mode MCP mode +* @var int user_id User id +* @var int forum_id Forum id +* @var int topic_id Topic id +* @var int post_id Post id +* @var string username User name +* @var int id Parent module id +* @since 3.1.0-b2 +*/ +$vars = array( + 'module', + 'mode', + 'user_id', + 'forum_id', + 'topic_id', + 'post_id', + 'username', + 'id', +); +extract($phpbb_dispatcher->trigger_event('core.modify_mcp_modules_display_option', compact($vars))); + +$template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $user->lang('MCP'), + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}mcp.$phpEx"), +)); + +// Load and execute the relevant module +$module->load_active(); + +// Assign data to the template engine for the list of modules +$module->assign_tpl_vars(append_sid("{$phpbb_root_path}mcp.$phpEx")); + +// Generate urls for letting the moderation control panel being accessed in different modes +$template->assign_vars(array( + 'U_MCP' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main'), + 'U_MCP_FORUM' => ($forum_id) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=forum_view&f=$forum_id") : '', + 'U_MCP_TOPIC' => ($forum_id && $topic_id) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&t=$topic_id") : '', + 'U_MCP_POST' => ($forum_id && $topic_id && $post_id) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&t=$topic_id&p=$post_id") : '', +)); + +// Generate the page, do not display/query online list +$module->display($module->get_page_title()); diff --git a/install/update/new/memberlist.php b/install/update/new/memberlist.php new file mode 100644 index 0000000..e933b54 --- /dev/null +++ b/install/update/new/memberlist.php @@ -0,0 +1,1852 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + +$mode = $request->variable('mode', ''); + +if ($mode === 'contactadmin') +{ + define('SKIP_CHECK_BAN', true); + define('SKIP_CHECK_DISABLED', true); +} + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup(array('memberlist', 'groups')); + +// Setting a variable to let the style designer know where he is... +$template->assign_var('S_IN_MEMBERLIST', true); + +// Grab data +$action = $request->variable('action', ''); +$user_id = $request->variable('u', ANONYMOUS); +$username = $request->variable('un', '', true); +$group_id = $request->variable('g', 0); +$topic_id = $request->variable('t', 0); + +// Redirect when old mode is used +if ($mode == 'leaders') +{ + send_status_line(301, 'Moved Permanently'); + redirect(append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=team')); +} + +// Check our mode... +if (!in_array($mode, array('', 'group', 'viewprofile', 'email', 'contact', 'contactadmin', 'searchuser', 'team', 'livesearch'))) +{ + trigger_error('NO_MODE'); +} + +switch ($mode) +{ + case 'email': + case 'contactadmin': + break; + + case 'livesearch': + if (!$config['allow_live_searches']) + { + trigger_error('LIVE_SEARCHES_NOT_ALLOWED'); + } + // No break + + default: + // Can this user view profiles/memberlist? + if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) + { + if ($user->data['user_id'] != ANONYMOUS) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_VIEW_USERS'); + } + + login_box('', ((isset($user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $user->lang['LOGIN_EXPLAIN_MEMBERLIST'])); + } + break; +} + +/** @var \phpbb\group\helper $group_helper */ +$group_helper = $phpbb_container->get('group_helper'); + +$start = $request->variable('start', 0); +$submit = (isset($_POST['submit'])) ? true : false; + +$default_key = 'c'; +$sort_key = $request->variable('sk', $default_key); +$sort_dir = $request->variable('sd', 'a'); + +$user_types = array(USER_NORMAL, USER_FOUNDER); +if ($auth->acl_get('a_user')) +{ + $user_types[] = USER_INACTIVE; +} + +// What do you want to do today? ... oops, I think that line is taken ... +switch ($mode) +{ + case 'team': + // Display a listing of board admins, moderators + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $page_title = $user->lang['THE_TEAM']; + $template_html = 'memberlist_team.html'; + + $sql = 'SELECT * + FROM ' . TEAMPAGE_TABLE . ' + ORDER BY teampage_position ASC'; + $result = $db->sql_query($sql, 3600); + $teampage_data = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + $sql_ary = array( + 'SELECT' => 'g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id as ug_user_id, t.teampage_id', + + 'FROM' => array(GROUPS_TABLE => 'g'), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TEAMPAGE_TABLE => 't'), + 'ON' => 't.group_id = g.group_id', + ), + array( + 'FROM' => array(USER_GROUP_TABLE => 'ug'), + 'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . (int) $user->data['user_id'], + ), + ), + ); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + $group_ids = $groups_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id']) + { + $row['group_name'] = $user->lang['GROUP_UNDISCLOSED']; + $row['u_group'] = ''; + } + else + { + $row['group_name'] = $group_helper->get_name($row['group_name']); + $row['u_group'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']); + } + + if ($row['teampage_id']) + { + // Only put groups into the array we want to display. + // We are fetching all groups, to ensure we got all data for default groups. + $group_ids[] = (int) $row['group_id']; + } + $groups_ary[(int) $row['group_id']] = $row; + } + $db->sql_freeresult($result); + + $sql_ary = array( + 'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.username_clean, u.user_colour, u.user_type, u.user_rank, u.user_posts, u.user_allow_pm, g.group_id', + + 'FROM' => array( + USER_GROUP_TABLE => 'ug', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(USERS_TABLE => 'u'), + 'ON' => 'ug.user_id = u.user_id', + ), + array( + 'FROM' => array(GROUPS_TABLE => 'g'), + 'ON' => 'ug.group_id = g.group_id', + ), + ), + + 'WHERE' => $db->sql_in_set('g.group_id', $group_ids, false, true) . ' AND ug.user_pending = 0', + + 'ORDER_BY' => 'u.username_clean ASC', + ); + + /** + * Modify the query used to get the users for the team page + * + * @event core.memberlist_team_modify_query + * @var array sql_ary Array containing the query + * @var array group_ids Array of group ids + * @var array teampage_data The teampage data + * @since 3.1.3-RC1 + */ + $vars = array( + 'sql_ary', + 'group_ids', + 'teampage_data', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_team_modify_query', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + $user_ary = $user_ids = $group_users = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['forums'] = ''; + $row['forums_ary'] = array(); + $user_ary[(int) $row['user_id']] = $row; + $user_ids[] = (int) $row['user_id']; + $group_users[(int) $row['group_id']][] = (int) $row['user_id']; + } + $db->sql_freeresult($result); + + $user_ids = array_unique($user_ids); + + if (!empty($user_ids) && $config['teampage_forums']) + { + $template->assign_var('S_DISPLAY_MODERATOR_FORUMS', true); + // Get all moderators + $perm_ary = $auth->acl_get_list($user_ids, array('m_'), false); + + foreach ($perm_ary as $forum_id => $forum_ary) + { + foreach ($forum_ary as $auth_option => $id_ary) + { + foreach ($id_ary as $id) + { + if (!$forum_id) + { + $user_ary[$id]['forums'] = $user->lang['ALL_FORUMS']; + } + else + { + $user_ary[$id]['forums_ary'][] = $forum_id; + } + } + } + } + + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + + $forums = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forums[$row['forum_id']] = $row['forum_name']; + } + $db->sql_freeresult($result); + + foreach ($user_ary as $user_id => $user_data) + { + if (!$user_data['forums']) + { + foreach ($user_data['forums_ary'] as $forum_id) + { + $user_ary[$user_id]['forums_options'] = true; + if (isset($forums[$forum_id])) + { + if ($auth->acl_get('f_list', $forum_id)) + { + $user_ary[$user_id]['forums'] .= ''; + } + } + } + } + } + } + + $parent_team = 0; + foreach ($teampage_data as $team_data) + { + // If this team entry has no group, it's a category + if (!$team_data['group_id']) + { + $template->assign_block_vars('group', array( + 'GROUP_NAME' => $team_data['teampage_name'], + )); + + $parent_team = (int) $team_data['teampage_id']; + continue; + } + + $group_data = $groups_ary[(int) $team_data['group_id']]; + $group_id = (int) $team_data['group_id']; + + if (!$team_data['teampage_parent']) + { + // If the group does not have a parent category, we display the groupname as category + $template->assign_block_vars('group', array( + 'GROUP_NAME' => $group_data['group_name'], + 'GROUP_COLOR' => $group_data['group_colour'], + 'U_GROUP' => $group_data['u_group'], + )); + } + + // Display group members. + if (!empty($group_users[$group_id])) + { + foreach ($group_users[$group_id] as $user_id) + { + if (isset($user_ary[$user_id])) + { + $row = $user_ary[$user_id]; + if ($config['teampage_memberships'] == 1 && ($group_id != $groups_ary[$row['default_group']]['group_id']) && $groups_ary[$row['default_group']]['teampage_id']) + { + // Display users in their primary group, instead of the first group, when it is displayed on the teampage. + continue; + } + + $user_rank_data = phpbb_get_user_rank($row, (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts'])); + + $template_vars = array( + 'USER_ID' => $row['user_id'], + 'FORUMS' => $row['forums'], + 'FORUM_OPTIONS' => (isset($row['forums_options'])) ? true : false, + 'RANK_TITLE' => $user_rank_data['title'], + + 'GROUP_NAME' => $groups_ary[$row['default_group']]['group_name'], + 'GROUP_COLOR' => $groups_ary[$row['default_group']]['group_colour'], + 'U_GROUP' => $groups_ary[$row['default_group']]['u_group'], + + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], + + 'S_INACTIVE' => $row['user_type'] == USER_INACTIVE, + + 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $row['user_id']) : '', + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), + 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + 'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), + ); + + /** + * Modify the template vars for displaying the user in the groups on the teampage + * + * @event core.memberlist_team_modify_template_vars + * @var array template_vars Array containing the query + * @var array row Array containing the action user row + * @var array groups_ary Array of groups with all users that should be displayed + * @since 3.1.3-RC1 + */ + $vars = array( + 'template_vars', + 'row', + 'groups_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_team_modify_template_vars', compact($vars))); + + $template->assign_block_vars('group.user', $template_vars); + + if ($config['teampage_memberships'] != 2) + { + unset($user_ary[$user_id]); + } + } + } + } + } + + $template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $page_title, + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=team"), + )); + + $template->assign_vars(array( + 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE'])) + ); + break; + + case 'contact': + + $page_title = $user->lang['IM_USER']; + $template_html = 'memberlist_im.html'; + + if (!$auth->acl_get('u_sendim')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } + + $presence_img = ''; + switch ($action) + { + case 'jabber': + $lang = 'JABBER'; + $sql_field = 'user_jabber'; + $s_select = (@extension_loaded('xml') && $config['jab_enable']) ? 'S_SEND_JABBER' : 'S_NO_SEND_JABBER'; + $s_action = append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=$action&u=$user_id"); + break; + + default: + trigger_error('NO_MODE', E_USER_ERROR); + break; + } + + // Grab relevant data + $sql = "SELECT user_id, username, user_email, user_lang, $sql_field + FROM " . USERS_TABLE . " + WHERE user_id = $user_id + AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_USER'); + } + else if (empty($row[$sql_field])) + { + trigger_error('IM_NO_DATA'); + } + + // Post data grab actions + switch ($action) + { + case 'jabber': + add_form_key('memberlist_messaging'); + + if ($submit && @extension_loaded('xml') && $config['jab_enable']) + { + if (check_form_key('memberlist_messaging')) + { + + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $subject = sprintf($user->lang['IM_JABBER_SUBJECT'], $user->data['username'], $config['server_name']); + $message = $request->variable('message', '', true); + + if (empty($message)) + { + trigger_error('EMPTY_MESSAGE_IM'); + } + + $messenger = new messenger(false); + + $messenger->template('profile_send_im', $row['user_lang']); + $messenger->subject(htmlspecialchars_decode($subject)); + + $messenger->replyto($user->data['user_email']); + $messenger->set_addresses($row); + + $messenger->assign_vars(array( + 'BOARD_CONTACT' => phpbb_get_board_contact($config, $phpEx), + 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), + 'TO_USERNAME' => htmlspecialchars_decode($row['username']), + 'MESSAGE' => htmlspecialchars_decode($message)) + ); + + $messenger->send(NOTIFY_IM); + + $s_select = 'S_SENT_JABBER'; + } + else + { + trigger_error('FORM_INVALID'); + } + } + break; + } + + $template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $page_title, + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=$action&u=$user_id"), + )); + + // Send vars to the template + $template->assign_vars(array( + 'IM_CONTACT' => $row[$sql_field], + 'A_IM_CONTACT' => addslashes($row[$sql_field]), + + 'USERNAME' => $row['username'], + 'CONTACT_NAME' => $row[$sql_field], + 'SITENAME' => $config['sitename'], + + 'PRESENCE_IMG' => $presence_img, + + 'L_SEND_IM_EXPLAIN' => $user->lang['IM_' . $lang], + 'L_IM_SENT_JABBER' => sprintf($user->lang['IM_SENT_JABBER'], $row['username']), + + $s_select => true, + 'S_IM_ACTION' => $s_action) + ); + + break; + + case 'viewprofile': + // Display a profile + if ($user_id == ANONYMOUS && !$username) + { + trigger_error('NO_USER'); + } + + // Get user... + $sql_array = array( + 'SELECT' => 'u.*', + 'FROM' => array( + USERS_TABLE => 'u' + ), + 'WHERE' => (($username) ? "u.username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "u.user_id = $user_id"), + ); + + /** + * Modify user data SQL before member profile row is created + * + * @event core.memberlist_modify_viewprofile_sql + * @var int user_id The user ID + * @var string username The username + * @var array sql_array Array containing the main query + * @since 3.2.6-RC1 + */ + $vars = array( + 'user_id', + 'username', + 'sql_array', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_viewprofile_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + $member = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$member) + { + trigger_error('NO_USER'); + } + + // a_user admins and founder are able to view inactive users and bots to be able to manage them more easily + // Normal users are able to see at least users having only changed their profile settings but not yet reactivated. + if (!$auth->acl_get('a_user') && $user->data['user_type'] != USER_FOUNDER) + { + if ($member['user_type'] == USER_IGNORE) + { + trigger_error('NO_USER'); + } + else if ($member['user_type'] == USER_INACTIVE && $member['user_inactive_reason'] != INACTIVE_PROFILE) + { + trigger_error('NO_USER'); + } + } + + $user_id = (int) $member['user_id']; + + // Get group memberships + // Also get visiting user's groups to determine hidden group memberships if necessary. + $auth_hidden_groups = ($user_id === (int) $user->data['user_id'] || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? true : false; + $sql_uid_ary = ($auth_hidden_groups) ? array($user_id) : array($user_id, (int) $user->data['user_id']); + + // Do the SQL thang + $sql_ary = [ + 'SELECT' => 'g.group_id, g.group_name, g.group_type, ug.user_id', + + 'FROM' => [ + GROUPS_TABLE => 'g', + ], + + 'LEFT_JOIN' => [ + [ + 'FROM' => [USER_GROUP_TABLE => 'ug'], + 'ON' => 'g.group_id = ug.group_id', + ], + ], + + 'WHERE' => $db->sql_in_set('ug.user_id', $sql_uid_ary) . ' + AND ug.user_pending = 0', + ]; + + /** + * Modify the query used to get the group data + * + * @event core.modify_memberlist_viewprofile_group_sql + * @var array sql_ary Array containing the query + * @since 3.2.6-RC1 + */ + $vars = array( + 'sql_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_memberlist_viewprofile_group_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + // Divide data into profile data and current user data + $profile_groups = $user_groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['user_id'] = (int) $row['user_id']; + $row['group_id'] = (int) $row['group_id']; + + if ($row['user_id'] == $user_id) + { + $profile_groups[] = $row; + } + else + { + $user_groups[$row['group_id']] = $row['group_id']; + } + } + $db->sql_freeresult($result); + + // Filter out hidden groups and sort groups by name + $group_data = $group_sort = array(); + foreach ($profile_groups as $row) + { + if (!$auth_hidden_groups && $row['group_type'] == GROUP_HIDDEN && !isset($user_groups[$row['group_id']])) + { + // Skip over hidden groups the user cannot see + continue; + } + + $row['group_name'] = $group_helper->get_name($row['group_name']); + + $group_sort[$row['group_id']] = utf8_clean_string($row['group_name']); + $group_data[$row['group_id']] = $row; + } + unset($profile_groups); + unset($user_groups); + asort($group_sort); + + /** + * Modify group data before options is created and data is unset + * + * @event core.modify_memberlist_viewprofile_group_data + * @var array group_data Array containing the group data + * @var array group_sort Array containing the sorted group data + * @since 3.2.6-RC1 + */ + $vars = array( + 'group_data', + 'group_sort', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_memberlist_viewprofile_group_data', compact($vars))); + + $group_options = ''; + foreach ($group_sort as $group_id => $null) + { + $row = $group_data[$group_id]; + + $group_options .= ''; + } + unset($group_data); + unset($group_sort); + + // What colour is the zebra + $sql = 'SELECT friend, foe + FROM ' . ZEBRA_TABLE . " + WHERE zebra_id = $user_id + AND user_id = {$user->data['user_id']}"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + + $foe = $row ? (bool) $row['foe'] : false; + $friend = $row ? (bool) $row['friend'] : false; + + $db->sql_freeresult($result); + + if ($config['load_onlinetrack']) + { + $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline + FROM ' . SESSIONS_TABLE . " + WHERE session_user_id = $user_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $member['session_time'] = (isset($row['session_time'])) ? $row['session_time'] : 0; + $member['session_viewonline'] = (isset($row['session_viewonline'])) ? $row['session_viewonline'] : 0; + unset($row); + } + + if ($config['load_user_activity']) + { + display_user_activity($member); + } + + // Do the relevant calculations + $memberdays = max(1, round((time() - $member['user_regdate']) / 86400)); + $posts_per_day = $member['user_posts'] / $memberdays; + $percentage = ($config['num_posts']) ? min(100, ($member['user_posts'] / $config['num_posts']) * 100) : 0; + + + if ($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); + } + + // We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links + $zebra_enabled = $friends_enabled = $foes_enabled = $user_notes_enabled = $warn_user_enabled = false; + + // Only check if the user is logged in + if ($user->data['is_registered']) + { + if (!class_exists('p_master')) + { + include($phpbb_root_path . 'includes/functions_module.' . $phpEx); + } + $module = new p_master(); + + $module->list_modules('ucp'); + $module->list_modules('mcp'); + + $user_notes_enabled = ($module->loaded('mcp_notes', 'user_notes')) ? true : false; + $warn_user_enabled = ($module->loaded('mcp_warn', 'warn_user')) ? true : false; + $zebra_enabled = ($module->loaded('ucp_zebra')) ? true : false; + $friends_enabled = ($module->loaded('ucp_zebra', 'friends')) ? true : false; + $foes_enabled = ($module->loaded('ucp_zebra', 'foes')) ? true : false; + + unset($module); + } + + // Custom Profile Fields + $profile_fields = array(); + if ($config['load_cpf_viewprofile']) + { + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + $profile_fields = $cp->grab_profile_fields_data($user_id); + $profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields[$user_id]) : array(); + } + + /** + * Modify user data before we display the profile + * + * @event core.memberlist_view_profile + * @var array member Array with user's data + * @var bool user_notes_enabled Is the mcp user notes module enabled? + * @var bool warn_user_enabled Is the mcp warnings module enabled? + * @var bool zebra_enabled Is the ucp zebra module enabled? + * @var bool friends_enabled Is the ucp friends module enabled? + * @var bool foes_enabled Is the ucp foes module enabled? + * @var bool friend Is the user friend? + * @var bool foe Is the user foe? + * @var array profile_fields Array with user's profile field data + * @since 3.1.0-a1 + * @changed 3.1.0-b2 Added friend and foe status + * @changed 3.1.0-b3 Added profile fields data + */ + $vars = array( + 'member', + 'user_notes_enabled', + 'warn_user_enabled', + 'zebra_enabled', + 'friends_enabled', + 'foes_enabled', + 'friend', + 'foe', + 'profile_fields', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_view_profile', compact($vars))); + + $template->assign_vars(phpbb_show_profile($member, $user_notes_enabled, $warn_user_enabled)); + + // If the user has m_approve permission or a_user permission, then list then display unapproved posts + if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user')) + { + $sql = 'SELECT COUNT(post_id) as posts_in_queue + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . $user_id . ' + AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)); + $result = $db->sql_query($sql); + $member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); + $db->sql_freeresult($result); + } + else + { + $member['posts_in_queue'] = 0; + } + + // Define the main array of vars to assign to memberlist_view.html + $template_ary = array( + 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $member['posts_in_queue']), + + 'POSTS_DAY' => $user->lang('POST_DAY', $posts_per_day), + 'POSTS_PCT' => $user->lang('POST_PCT', $percentage), + + 'SIGNATURE' => $member['user_sig'], + 'POSTS_IN_QUEUE' => $member['posts_in_queue'], + + 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']), + 'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $member['username']), + 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']), + 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']), + 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), + + 'S_PROFILE_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group'), + 'S_GROUP_OPTIONS' => $group_options, + 'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && count($profile_fields['row'])) ? true : false, + + 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', + 'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '', + 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', + + 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}&hash=" . generate_link_hash('switchperm')) : '', + 'U_EDIT_SELF' => ($user_id == $user->data['user_id'] && $auth->acl_get('u_chgprofileinfo')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_profile&mode=profile_info') : '', + + 'S_USER_NOTES' => ($user_notes_enabled) ? true : false, + 'S_WARN_USER' => ($warn_user_enabled) ? true : false, + 'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false, + 'U_ADD_FRIEND' => (!$friend && !$foe && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', + 'U_ADD_FOE' => (!$friend && !$foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', + 'U_REMOVE_FRIEND' => ($friend && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '', + 'U_REMOVE_FOE' => ($foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : '', + + 'U_CANONICAL' => generate_board_url() . '/' . append_sid("memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id, true, ''), + ); + + /** + * Modify user's template vars before we display the profile + * + * @event core.memberlist_modify_view_profile_template_vars + * @var array template_ary Array with user's template vars + * @since 3.2.6-RC1 + */ + $vars = array( + 'template_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_view_profile_template_vars', compact($vars))); + + // Assign vars to memberlist_view.html + $template->assign_vars($template_ary); + + if (!empty($profile_fields['row'])) + { + $template->assign_vars($profile_fields['row']); + } + + if (!empty($profile_fields['blockrow'])) + { + foreach ($profile_fields['blockrow'] as $field_data) + { + $template->assign_block_vars('custom_fields', $field_data); + } + } + + // Inactive reason/account? + if ($member['user_type'] == USER_INACTIVE) + { + $user->add_lang('acp/common'); + + $inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN']; + + switch ($member['user_inactive_reason']) + { + case INACTIVE_REGISTER: + $inactive_reason = $user->lang['INACTIVE_REASON_REGISTER']; + break; + + case INACTIVE_PROFILE: + $inactive_reason = $user->lang['INACTIVE_REASON_PROFILE']; + break; + + case INACTIVE_MANUAL: + $inactive_reason = $user->lang['INACTIVE_REASON_MANUAL']; + break; + + case INACTIVE_REMIND: + $inactive_reason = $user->lang['INACTIVE_REASON_REMIND']; + break; + } + + $template->assign_vars(array( + 'S_USER_INACTIVE' => true, + 'USER_INACTIVE_REASON' => $inactive_reason) + ); + } + + // Now generate page title + $page_title = sprintf($user->lang['VIEWING_PROFILE'], $member['username']); + $template_html = 'memberlist_view.html'; + + $template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $user->lang('MEMBERLIST'), + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}memberlist.$phpEx"), + )); + $template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $member['username'], + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$user_id"), + )); + + break; + + case 'contactadmin': + case 'email': + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } + + $user_id = $request->variable('u', 0); + $topic_id = $request->variable('t', 0); + + if ($user_id) + { + $form_name = 'user'; + } + else if ($topic_id) + { + $form_name = 'topic'; + } + else if ($mode === 'contactadmin') + { + $form_name = 'admin'; + } + else + { + trigger_error('NO_EMAIL'); + } + + /** @var $form \phpbb\message\form */ + $form = $phpbb_container->get('message.form.' . $form_name); + + $form->bind($request); + $error = $form->check_allow(); + if ($error) + { + trigger_error($error); + } + + if ($request->is_set_post('submit')) + { + $messenger = new messenger(false); + $form->submit($messenger); + } + + $page_title = $form->get_page_title(); + $template_html = $form->get_template_file(); + $form->render($template); + + if ($user_id) + { + $navlink_name = $user->lang('SEND_EMAIL'); + $navlink_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$user_id"); + } + else if ($topic_id) + { + $sql = 'SELECT f.parent_id, f.forum_parents, f.left_id, f.right_id, f.forum_type, f.forum_name, f.forum_id, f.forum_desc, f.forum_desc_uid, f.forum_desc_bitfield, f.forum_desc_options, f.forum_options, t.topic_title + FROM ' . FORUMS_TABLE . ' as f, + ' . TOPICS_TABLE . ' as t + WHERE t.forum_id = f.forum_id'; + $result = $db->sql_query($sql); + $topic_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + generate_forum_nav($topic_data); + $template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $topic_data['topic_title'], + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id"), + )); + + $navlink_name = $user->lang('EMAIL_TOPIC'); + $navlink_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&t=$topic_id"); + } + else if ($mode === 'contactadmin') + { + $navlink_name = $user->lang('CONTACT_ADMIN'); + $navlink_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contactadmin"); + } + + $template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $navlink_name, + 'U_BREADCRUMB' => $navlink_url, + )); + + break; + + case 'livesearch': + + $username_chars = $request->variable('username', '', true); + + $sql = 'SELECT username, user_id, user_colour + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_type', $user_types) . ' + AND username_clean ' . $db->sql_like_expression(utf8_clean_string($username_chars) . $db->get_any_char()); + $result = $db->sql_query_limit($sql, 10); + $user_list = array(); + + while ($row = $db->sql_fetchrow($result)) + { + $user_list[] = array( + 'user_id' => (int) $row['user_id'], + 'result' => $row['username'], + 'username_full' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'display' => get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']), + ); + } + $db->sql_freeresult($result); + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'keyword' => $username_chars, + 'results' => $user_list, + )); + + break; + + case 'group': + default: + // The basic memberlist + $page_title = $user->lang['MEMBERLIST']; + $template_html = 'memberlist_body.html'; + + $template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $page_title, + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}memberlist.$phpEx"), + )); + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + // Sorting + $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT']); + $sort_key_sql = array('a' => 'u.username_clean', 'c' => 'u.user_regdate', 'd' => 'u.user_posts'); + + if ($config['jab_enable']) + { + $sort_key_text['k'] = $user->lang['JABBER']; + $sort_key_sql['k'] = 'u.user_jabber'; + } + + if ($auth->acl_get('a_user')) + { + $sort_key_text['e'] = $user->lang['SORT_EMAIL']; + $sort_key_sql['e'] = 'u.user_email'; + } + + if ($auth->acl_get('u_viewonline')) + { + $sort_key_text['l'] = $user->lang['SORT_LAST_ACTIVE']; + $sort_key_sql['l'] = 'u.user_lastvisit'; + } + + $sort_key_text['m'] = $user->lang['SORT_RANK']; + $sort_key_sql['m'] = 'u.user_rank'; + + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + $s_sort_key = ''; + foreach ($sort_key_text as $key => $value) + { + $selected = ($sort_key == $key) ? ' selected="selected"' : ''; + $s_sort_key .= ''; + } + + $s_sort_dir = ''; + foreach ($sort_dir_text as $key => $value) + { + $selected = ($sort_dir == $key) ? ' selected="selected"' : ''; + $s_sort_dir .= ''; + } + + // Additional sorting options for user search ... if search is enabled, if not + // then only admins can make use of this (for ACP functionality) + $sql_select = $sql_where_data = $sql_from = $sql_where = $order_by = ''; + + + $form = $request->variable('form', ''); + $field = $request->variable('field', ''); + $select_single = $request->variable('select_single', false); + + // Search URL parameters, if any of these are in the URL we do a search + $search_params = array('username', 'email', 'jabber', 'search_group_id', 'joined_select', 'active_select', 'count_select', 'joined', 'active', 'count', 'ip'); + + // We validate form and field here, only id/class allowed + $form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form; + $field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field; + if ((($mode == '' || $mode == 'searchuser') || count(array_intersect($request->variable_names(\phpbb\request\request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_'))) + { + $username = $request->variable('username', '', true); + $email = strtolower($request->variable('email', '')); + $jabber = $request->variable('jabber', ''); + $search_group_id = $request->variable('search_group_id', 0); + + // when using these, make sure that we actually have values defined in $find_key_match + $joined_select = $request->variable('joined_select', 'lt'); + $active_select = $request->variable('active_select', 'lt'); + $count_select = $request->variable('count_select', 'eq'); + + $joined = explode('-', $request->variable('joined', '')); + $active = explode('-', $request->variable('active', '')); + $count = ($request->variable('count', '') !== '') ? $request->variable('count', 0) : ''; + $ipdomain = $request->variable('ip', ''); + + $find_key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); + + $find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']); + $s_find_count = ''; + foreach ($find_count as $key => $value) + { + $selected = ($count_select == $key) ? ' selected="selected"' : ''; + $s_find_count .= ''; + } + + $find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']); + $s_find_join_time = ''; + foreach ($find_time as $key => $value) + { + $selected = ($joined_select == $key) ? ' selected="selected"' : ''; + $s_find_join_time .= ''; + } + + $s_find_active_time = ''; + foreach ($find_time as $key => $value) + { + $selected = ($active_select == $key) ? ' selected="selected"' : ''; + $s_find_active_time .= ''; + } + + $sql_where .= ($username) ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($username))) : ''; + $sql_where .= ($auth->acl_get('a_user') && $email) ? ' AND u.user_email ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $email)) . ' ' : ''; + $sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $jabber)) . ' ' : ''; + $sql_where .= (is_numeric($count) && isset($find_key_match[$count_select])) ? ' AND u.user_posts ' . $find_key_match[$count_select] . ' ' . (int) $count . ' ' : ''; + + if (isset($find_key_match[$joined_select]) && count($joined) == 3) + { + $joined_time = gmmktime(0, 0, 0, (int) $joined[1], (int) $joined[2], (int) $joined[0]); + + if ($joined_time !== false) + { + $sql_where .= " AND u.user_regdate " . $find_key_match[$joined_select] . ' ' . $joined_time; + } + } + + if (isset($find_key_match[$active_select]) && count($active) == 3 && $auth->acl_get('u_viewonline')) + { + $active_time = gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]); + + if ($active_time !== false) + { + if ($active_select === 'lt' && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) + { + $sql_where .= ' AND u.user_lastvisit = 0'; + } + else if ($active_select === 'gt') + { + $sql_where .= ' AND u.user_lastvisit ' . $find_key_match[$active_select] . ' ' . $active_time; + } + else + { + $sql_where .= ' AND (u.user_lastvisit > 0 AND u.user_lastvisit < ' . $active_time . ')'; + } + } + } + + $sql_where .= ($search_group_id) ? " AND u.user_id = ug.user_id AND ug.group_id = $search_group_id AND ug.user_pending = 0 " : ''; + + if ($search_group_id) + { + $sql_from = ', ' . USER_GROUP_TABLE . ' ug '; + } + + if ($ipdomain && $auth->acl_getf_global('m_info')) + { + if (strspn($ipdomain, 'abcdefghijklmnopqrstuvwxyz')) + { + $hostnames = gethostbynamel($ipdomain); + + if ($hostnames !== false) + { + $ips = "'" . implode('\', \'', array_map(array($db, 'sql_escape'), preg_replace('#([0-9]{1,3}\.[0-9]{1,3}[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#', "\\1", gethostbynamel($ipdomain)))) . "'"; + } + else + { + $ips = false; + } + } + else + { + $ips = "'" . str_replace('*', '%', $db->sql_escape($ipdomain)) . "'"; + } + + if ($ips === false) + { + // A minor fudge but it does the job :D + $sql_where .= " AND u.user_id = 0"; + } + else + { + $ip_forums = array_keys($auth->acl_getf('m_info', true)); + + $sql = 'SELECT DISTINCT poster_id + FROM ' . POSTS_TABLE . ' + WHERE poster_ip ' . ((strpos($ips, '%') !== false) ? 'LIKE' : 'IN') . " ($ips) + AND " . $db->sql_in_set('forum_id', $ip_forums); + + /** + * Modify sql query for members search by ip address / hostname + * + * @event core.memberlist_modify_ip_search_sql_query + * @var string ipdomain The host name + * @var string ips IP address list for the given host name + * @var string sql The SQL query for searching members by IP address + * @since 3.1.7-RC1 + */ + $vars = array( + 'ipdomain', + 'ips', + 'sql', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_ip_search_sql_query', compact($vars))); + + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $ip_sql = array(); + do + { + $ip_sql[] = $row['poster_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $sql_where .= ' AND ' . $db->sql_in_set('u.user_id', $ip_sql); + } + else + { + // A minor fudge but it does the job :D + $sql_where .= " AND u.user_id = 0"; + } + unset($ip_forums); + + $db->sql_freeresult($result); + } + } + } + + $first_char = $request->variable('first_char', ''); + + if ($first_char == 'other') + { + for ($i = 97; $i < 123; $i++) + { + $sql_where .= ' AND u.username_clean NOT ' . $db->sql_like_expression(chr($i) . $db->get_any_char()); + } + } + else if ($first_char) + { + $sql_where .= ' AND u.username_clean ' . $db->sql_like_expression(substr($first_char, 0, 1) . $db->get_any_char()); + } + + // Are we looking at a usergroup? If so, fetch additional info + // and further restrict the user info query + if ($mode == 'group') + { + // We JOIN here to save a query for determining membership for hidden groups. ;) + $sql = 'SELECT g.*, ug.user_id, ug.group_leader + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id'] . " AND ug.group_id = $group_id) + WHERE g.group_id = $group_id"; + $result = $db->sql_query($sql); + $group_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$group_row) + { + trigger_error('NO_GROUP'); + } + + switch ($group_row['group_type']) + { + case GROUP_OPEN: + $group_row['l_group_type'] = 'OPEN'; + break; + + case GROUP_CLOSED: + $group_row['l_group_type'] = 'CLOSED'; + break; + + case GROUP_HIDDEN: + $group_row['l_group_type'] = 'HIDDEN'; + + // Check for membership or special permissions + if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $group_row['user_id'] != $user->data['user_id']) + { + trigger_error('NO_GROUP'); + } + break; + + case GROUP_SPECIAL: + $group_row['l_group_type'] = 'SPECIAL'; + break; + + case GROUP_FREE: + $group_row['l_group_type'] = 'FREE'; + break; + } + + $avatar_img = phpbb_get_group_avatar($group_row); + + // ... same for group rank + $group_rank_data = array( + 'title' => null, + 'img' => null, + 'img_src' => null, + ); + if ($group_row['group_rank']) + { + $group_rank_data = $group_helper->get_rank($group_row); + + if ($group_rank_data['img']) + { + $group_rank_data['img'] .= '
'; + } + } + // include modules for manage groups link display or not + // need to ensure the module is active + $can_manage_group = false; + if ($user->data['is_registered'] && $group_row['group_leader']) + { + if (!class_exists('p_master')) + { + include($phpbb_root_path . 'includes/functions_module.' . $phpEx); + } + $module = new p_master; + $module->list_modules('ucp'); + + if ($module->is_active('ucp_groups', 'manage')) + { + $can_manage_group = true; + } + unset($module); + } + + $template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $group_helper->get_name($group_row['group_name']), + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=group&g=$group_id"), + )); + + $template->assign_vars(array( + 'GROUP_DESC' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']), + 'GROUP_NAME' => $group_helper->get_name($group_row['group_name']), + 'GROUP_COLOR' => $group_row['group_colour'], + 'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']], + 'GROUP_RANK' => $group_rank_data['title'], + + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $group_rank_data['img'], + 'RANK_IMG_SRC' => $group_rank_data['img_src'], + + 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&g=' . $group_id) : '', + 'U_MANAGE' => ($can_manage_group) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_groups&mode=manage') : false,) + ); + + $sql_select = ', ug.group_leader'; + $sql_from = ', ' . USER_GROUP_TABLE . ' ug '; + $order_by = 'ug.group_leader DESC, '; + + $sql_where .= " AND ug.user_pending = 0 AND u.user_id = ug.user_id AND ug.group_id = $group_id"; + $sql_where_data = " AND u.user_id = ug.user_id AND ug.group_id = $group_id"; + } + + // Sorting and order + if (!isset($sort_key_sql[$sort_key])) + { + $sort_key = $default_key; + } + + $order_by .= $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); + + // Unfortunately we must do this here for sorting by rank, else the sort order is applied wrongly + if ($sort_key == 'm') + { + $order_by .= ', u.user_posts DESC'; + } + + /** + * Modify sql query data for members search + * + * @event core.memberlist_modify_sql_query_data + * @var string order_by SQL ORDER BY clause condition + * @var string sort_dir The sorting direction + * @var string sort_key The sorting key + * @var array sort_key_sql Arraty with the sorting conditions data + * @var string sql_from SQL FROM clause condition + * @var string sql_select SQL SELECT fields list + * @var string sql_where SQL WHERE clause condition + * @var string sql_where_data SQL WHERE clause additional conditions data + * @since 3.1.7-RC1 + */ + $vars = array( + 'order_by', + 'sort_dir', + 'sort_key', + 'sort_key_sql', + 'sql_from', + 'sql_select', + 'sql_where', + 'sql_where_data', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_sql_query_data', compact($vars))); + + // Count the users ... + $sql = 'SELECT COUNT(u.user_id) AS total_users + FROM ' . USERS_TABLE . " u$sql_from + WHERE " . $db->sql_in_set('u.user_type', $user_types) . " + $sql_where"; + $result = $db->sql_query($sql); + $total_users = (int) $db->sql_fetchfield('total_users'); + $db->sql_freeresult($result); + + // Build a relevant pagination_url + $params = $sort_params = array(); + + // We do not use $request->variable() here directly to save some calls (not all variables are set) + $check_params = array( + 'g' => array('g', 0), + 'sk' => array('sk', $default_key), + 'sd' => array('sd', 'a'), + 'form' => array('form', ''), + 'field' => array('field', ''), + 'select_single' => array('select_single', $select_single), + 'username' => array('username', '', true), + 'email' => array('email', ''), + 'jabber' => array('jabber', ''), + 'search_group_id' => array('search_group_id', 0), + 'joined_select' => array('joined_select', 'lt'), + 'active_select' => array('active_select', 'lt'), + 'count_select' => array('count_select', 'eq'), + 'joined' => array('joined', ''), + 'active' => array('active', ''), + 'count' => ($request->variable('count', '') !== '') ? array('count', 0) : array('count', ''), + 'ip' => array('ip', ''), + 'first_char' => array('first_char', ''), + ); + + $u_first_char_params = array(); + foreach ($check_params as $key => $call) + { + if (!isset($_REQUEST[$key])) + { + continue; + } + + $param = call_user_func_array(array($request, 'variable'), $call); + // Encode strings, convert everything else to int in order to prevent empty parameters. + $param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : (int) $param); + $params[] = $param; + + if ($key != 'first_char') + { + $u_first_char_params[] = $param; + } + if ($key != 'sk' && $key != 'sd') + { + $sort_params[] = $param; + } + } + + $u_hide_find_member = append_sid("{$phpbb_root_path}memberlist.$phpEx", "start=$start" . (!empty($params) ? '&' . implode('&', $params) : '')); + + if ($mode) + { + $params[] = "mode=$mode"; + $u_first_char_params[] = "mode=$mode"; + } + $sort_params[] = "mode=$mode"; + + $u_first_char_params = implode('&', $u_first_char_params); + $u_first_char_params .= ($u_first_char_params) ? '&' : ''; + + $first_characters = array(); + $first_characters[''] = $user->lang['ALL']; + for ($i = 97; $i < 123; $i++) + { + $first_characters[chr($i)] = chr($i - 32); + } + $first_characters['other'] = $user->lang['OTHER']; + + $first_char_block_vars = []; + + foreach ($first_characters as $char => $desc) + { + $first_char_block_vars[] = [ + 'DESC' => $desc, + 'VALUE' => $char, + 'S_SELECTED' => ($first_char == $char) ? true : false, + 'U_SORT' => append_sid("{$phpbb_root_path}memberlist.$phpEx", $u_first_char_params . 'first_char=' . $char) . '#memberlist', + ]; + } + + /** + * Modify memberlist sort and pagination parameters + * + * @event core.memberlist_modify_sort_pagination_params + * @var array sort_params Array with URL parameters for sorting + * @var array params Array with URL parameters for pagination + * @var array first_characters Array that maps each letter in a-z, 'other' and the empty string to their display representation + * @var string u_first_char_params Concatenated URL parameters for first character search links + * @var array first_char_block_vars Template block variables for each first character + * @var int total_users Total number of users found in this search + * @since 3.2.6-RC1 + */ + $vars = [ + 'sort_params', + 'params', + 'first_characters', + 'u_first_char_params', + 'first_char_block_vars', + 'total_users', + ]; + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_sort_pagination_params', compact($vars))); + + $template->assign_block_vars_array('first_char', $first_char_block_vars); + + $pagination_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $params)); + $sort_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $sort_params)); + + unset($search_params, $sort_params); + + // Some search user specific data + if (($mode == '' || $mode == 'searchuser') && ($config['load_search'] || $auth->acl_get('a_'))) + { + $group_selected = $request->variable('search_group_id', 0); + $s_group_select = ''; + $group_ids = array(); + + /** + * @todo add this to a separate function (function is responsible for returning the groups the user is able to see based on the users group membership) + */ + + if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) + { + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE; + + if (!$config['coppa_enable']) + { + $sql .= " WHERE group_name <> 'REGISTERED_COPPA'"; + } + + $sql .= ' ORDER BY group_name ASC'; + } + else + { + $sql = 'SELECT g.group_id, g.group_name, g.group_type + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + + if (!$config['coppa_enable']) + { + $sql .= " AND g.group_name <> 'REGISTERED_COPPA'"; + } + + $sql .= ' ORDER BY g.group_name ASC'; + } + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $group_ids[] = $row['group_id']; + $s_group_select .= ''; + } + $db->sql_freeresult($result); + + if ($group_selected !== 0 && !in_array($group_selected, $group_ids)) + { + trigger_error('NO_GROUP'); + } + + $template->assign_vars(array( + 'USERNAME' => $username, + 'EMAIL' => $email, + 'JABBER' => $jabber, + 'JOINED' => implode('-', $joined), + 'ACTIVE' => implode('-', $active), + 'COUNT' => $count, + 'IP' => $ipdomain, + + 'S_IP_SEARCH_ALLOWED' => ($auth->acl_getf_global('m_info')) ? true : false, + 'S_EMAIL_SEARCH_ALLOWED'=> ($auth->acl_get('a_user')) ? true : false, + 'S_JABBER_ENABLED' => $config['jab_enable'], + 'S_IN_SEARCH_POPUP' => ($form && $field) ? true : false, + 'S_SEARCH_USER' => ($mode == 'searchuser' || ($mode == '' && $submit)), + 'S_FORM_NAME' => $form, + 'S_FIELD_NAME' => $field, + 'S_SELECT_SINGLE' => $select_single, + 'S_COUNT_OPTIONS' => $s_find_count, + 'S_SORT_OPTIONS' => $s_sort_key, + 'S_JOINED_TIME_OPTIONS' => $s_find_join_time, + 'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time, + 'S_GROUP_SELECT' => $s_group_select, + 'S_USER_SEARCH_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=$form&field=$field")) + ); + } + + $start = $pagination->validate_start($start, $config['topics_per_page'], $total_users); + + // Get us some users :D + $sql = "SELECT u.user_id + FROM " . USERS_TABLE . " u + $sql_from + WHERE " . $db->sql_in_set('u.user_type', $user_types) . " + $sql_where + ORDER BY $order_by"; + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + + $user_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_list[] = (int) $row['user_id']; + } + $db->sql_freeresult($result); + + // Load custom profile fields + if ($config['load_cpf_memberlist']) + { + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + + $cp_row = $cp->generate_profile_fields_template_headlines('field_show_on_ml'); + foreach ($cp_row as $profile_field) + { + $template->assign_block_vars('custom_fields', $profile_field); + } + } + + $leaders_set = false; + // So, did we get any users? + if (count($user_list)) + { + // Session time?! Session time... + $sql = 'SELECT session_user_id, MAX(session_time) AS session_time + FROM ' . SESSIONS_TABLE . ' + WHERE session_time >= ' . (time() - $config['session_length']) . ' + AND ' . $db->sql_in_set('session_user_id', $user_list) . ' + GROUP BY session_user_id'; + $result = $db->sql_query($sql); + + $session_times = array(); + while ($row = $db->sql_fetchrow($result)) + { + $session_times[$row['session_user_id']] = $row['session_time']; + } + $db->sql_freeresult($result); + + // Do the SQL thang + if ($mode == 'group') + { + $sql_from_ary = explode(',', $sql_from); + $extra_tables = []; + foreach ($sql_from_ary as $entry) + { + $table_data = explode(' ', trim($entry)); + + if (empty($table_data[0]) || empty($table_data[1])) + { + continue; + } + + $extra_tables[$table_data[0]] = $table_data[1]; + } + + $sql_array = array( + 'SELECT' => 'u.*' . $sql_select, + 'FROM' => array_merge([USERS_TABLE => 'u'], $extra_tables), + 'WHERE' => $db->sql_in_set('u.user_id', $user_list) . $sql_where_data . '', + ); + } + else + { + $sql_array = array( + 'SELECT' => 'u.*', + 'FROM' => array( + USERS_TABLE => 'u' + ), + 'WHERE' => $db->sql_in_set('u.user_id', $user_list), + ); + } + + /** + * Modify user data SQL before member row is created + * + * @event core.memberlist_modify_memberrow_sql + * @var string mode Memberlist mode + * @var string sql_select Additional select statement + * @var string sql_from Additional from statement + * @var array sql_array Array containing the main query + * @var array user_list Array containing list of users + * @since 3.2.6-RC1 + */ + $vars = array( + 'mode', + 'sql_select', + 'sql_from', + 'sql_array', + 'user_list', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_memberrow_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + + $id_cache = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['session_time'] = (!empty($session_times[$row['user_id']])) ? $session_times[$row['user_id']] : 0; + $row['last_visit'] = (!empty($row['session_time'])) ? $row['session_time'] : $row['user_lastvisit']; + + $id_cache[$row['user_id']] = $row; + } + + $db->sql_freeresult($result); + + // Load custom profile fields if required + if ($config['load_cpf_memberlist']) + { + // Grab all profile fields from users in id cache for later use - similar to the poster cache + $profile_fields_cache = $cp->grab_profile_fields_data($user_list); + + // Filter the fields we don't want to show + foreach ($profile_fields_cache as $user_id => $user_profile_fields) + { + foreach ($user_profile_fields as $field_ident => $profile_field) + { + if (!$profile_field['data']['field_show_on_ml']) + { + unset($profile_fields_cache[$user_id][$field_ident]); + } + } + } + } + + // If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date... + if ($sort_key == 'l') + { +// uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));")); + usort($user_list, 'phpbb_sort_last_active'); + } + + // do we need to display contact fields as such + $use_contact_fields = true; + + /** + * Modify list of users before member row is created + * + * @event core.memberlist_memberrow_before + * @var array user_list Array containing list of users + * @var bool use_contact_fields Should we display contact fields as such? + * @since 3.1.7-RC1 + */ + $vars = array('user_list', 'use_contact_fields'); + extract($phpbb_dispatcher->trigger_event('core.memberlist_memberrow_before', compact($vars))); + + for ($i = 0, $end = count($user_list); $i < $end; ++$i) + { + $user_id = $user_list[$i]; + $row = $id_cache[$user_id]; + $is_leader = (isset($row['group_leader']) && $row['group_leader']) ? true : false; + $leaders_set = ($leaders_set || $is_leader); + + $cp_row = array(); + if ($config['load_cpf_memberlist']) + { + $cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$user_id], $use_contact_fields) : array(); + } + + $memberrow = array_merge(phpbb_show_profile($row, false, false, false), array( + 'ROW_NUMBER' => $i + ($start + 1), + + 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, + 'S_GROUP_LEADER' => $is_leader, + 'S_INACTIVE' => $row['user_type'] == USER_INACTIVE, + + 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $row['username']), + )); + + if (isset($cp_row['row']) && count($cp_row['row'])) + { + $memberrow = array_merge($memberrow, $cp_row['row']); + } + + $template->assign_block_vars('memberrow', $memberrow); + + if (isset($cp_row['blockrow']) && count($cp_row['blockrow'])) + { + foreach ($cp_row['blockrow'] as $field_data) + { + $template->assign_block_vars('memberrow.custom_fields', $field_data); + } + } + + unset($id_cache[$user_id]); + } + } + + $pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_users, $config['topics_per_page'], $start); + + // Generate page + $template_vars = array( + 'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $total_users), + + 'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['PROFILE']), + 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']), + 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']), + 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']), + 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), + + 'U_FIND_MEMBER' => ($config['load_search'] || $auth->acl_get('a_')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser' . (($start) ? "&start=$start" : '') . (!empty($params) ? '&' . implode('&', $params) : '')) : '', + 'U_HIDE_FIND_MEMBER' => ($mode == 'searchuser' || ($mode == '' && $submit)) ? $u_hide_find_member : '', + 'U_LIVE_SEARCH' => ($config['allow_live_searches']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=livesearch') : false, + 'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_SORT_EMAIL' => $sort_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_SORT_ACTIVE' => ($auth->acl_get('u_viewonline')) ? $sort_url . '&sk=l&sd=' . (($sort_key == 'l' && $sort_dir == 'd') ? 'a' : 'd') : '', + 'U_SORT_RANK' => $sort_url . '&sk=m&sd=' . (($sort_key == 'm' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_LIST_CHAR' => $sort_url . '&sk=a&sd=' . (($sort_key == 'l' && $sort_dir == 'd') ? 'a' : 'd'), + + 'S_SHOW_GROUP' => ($mode == 'group') ? true : false, + 'S_VIEWONLINE' => $auth->acl_get('u_viewonline'), + 'S_LEADERS_SET' => $leaders_set, + 'S_MODE_SELECT' => $s_sort_key, + 'S_ORDER_SELECT' => $s_sort_dir, + 'S_MODE_ACTION' => $pagination_url, + ); + + /** + * Modify memberlist page template vars + * + * @event core.memberlist_modify_template_vars + * @var array params Array containing URL parameters + * @var string sort_url Sorting URL base + * @var array template_vars Array containing template vars + * @since 3.2.2-RC1 + */ + $vars = array('params', 'sort_url', 'template_vars'); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_template_vars', compact($vars))); + + $template->assign_vars($template_vars); +} + +// Output the page +page_header($page_title); + +$template->set_filenames(array( + 'body' => $template_html) +); +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + +page_footer(); diff --git a/install/update/new/phpbb/auth/provider/apache.php b/install/update/new/phpbb/auth/provider/apache.php new file mode 100644 index 0000000..a713674 --- /dev/null +++ b/install/update/new/phpbb/auth/provider/apache.php @@ -0,0 +1,285 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider; + +use phpbb\config\config; +use phpbb\db\driver\driver_interface; +use phpbb\language\language; +use phpbb\request\request_interface; +use phpbb\request\type_cast_helper; +use phpbb\user; + +/** +* Apache authentication provider for phpBB3 +*/ +class apache extends base +{ + /** @var config phpBB config */ + protected $config; + + /** @var driver_interface Database object */ + protected $db; + + /** @var language Language object */ + protected $language; + + /** @var request_interface Request object */ + protected $request; + + /** @var user User object */ + protected $user; + + /** @var string Relative path to phpBB root */ + protected $phpbb_root_path; + + /** @var string PHP file extension */ + protected $php_ext; + + /** + * Apache Authentication Constructor + * + * @param config $config Config object + * @param driver_interface $db Database object + * @param language $language Language object + * @param request_interface $request Request object + * @param user $user User object + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension + */ + public function __construct(config $config, driver_interface $db, language $language, request_interface $request, user $user, $phpbb_root_path, $php_ext) + { + $this->config = $config; + $this->db = $db; + $this->language = $language; + $this->request = $request; + $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * {@inheritdoc} + */ + public function init() + { + if (!$this->request->is_set('PHP_AUTH_USER', request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'))) + { + return $this->language->lang('APACHE_SETUP_BEFORE_USE'); + } + return false; + } + + /** + * {@inheritdoc} + */ + public function login($username, $password) + { + // do not allow empty password + if (!$password) + { + return array( + 'status' => LOGIN_ERROR_PASSWORD, + 'error_msg' => 'NO_PASSWORD_SUPPLIED', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!$username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!$this->request->is_set('PHP_AUTH_USER', request_interface::SERVER)) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $php_auth_user = htmlspecialchars_decode($this->request->server('PHP_AUTH_USER')); + $php_auth_pw = htmlspecialchars_decode($this->request->server('PHP_AUTH_PW')); + + if (!empty($php_auth_user) && !empty($php_auth_pw)) + { + if ($php_auth_user !== $username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type + FROM ' . USERS_TABLE . " + WHERE username = '" . $this->db->sql_escape($php_auth_user) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + // User inactive... + if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) + { + return array( + 'status' => LOGIN_ERROR_ACTIVE, + 'error_msg' => 'ACTIVE_ERROR', + 'user_row' => $row, + ); + } + + // Successful login... + return array( + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ); + } + + // this is the user's first login so create an empty profile + return array( + 'status' => LOGIN_SUCCESS_CREATE_PROFILE, + 'error_msg' => false, + 'user_row' => $this->user_row($php_auth_user), + ); + } + + // Not logged into apache + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + /** + * {@inheritdoc} + */ + public function autologin() + { + if (!$this->request->is_set('PHP_AUTH_USER', request_interface::SERVER)) + { + return array(); + } + + $php_auth_user = htmlspecialchars_decode($this->request->server('PHP_AUTH_USER')); + $php_auth_pw = htmlspecialchars_decode($this->request->server('PHP_AUTH_PW')); + + if (!empty($php_auth_user) && !empty($php_auth_pw)) + { + $type_cast_helper = new type_cast_helper(); + $type_cast_helper->set_var($php_auth_user, $php_auth_user, 'string', true); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE username = '" . $this->db->sql_escape($php_auth_user) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? array() : $row; + } + + if (!function_exists('user_add')) + { + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + // create the user if he does not exist yet + user_add($this->user_row($php_auth_user)); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($php_auth_user)) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + return $row; + } + } + + return array(); + } + + /** + * This function generates an array which can be passed to the user_add + * function in order to create a user + * + * @param string $username The username of the new user. + * + * @return array Contains data that can be passed directly to + * the user_add function. + */ + private function user_row($username) + { + // first retrieve default group id + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "' + AND group_type = " . GROUP_SPECIAL; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + // generate user account data + return array( + 'username' => $username, + 'user_password' => '', + 'user_email' => '', + 'group_id' => (int) $row['group_id'], + 'user_type' => USER_NORMAL, + 'user_ip' => $this->user->ip, + 'user_new' => ($this->config['new_member_post_limit']) ? 1 : 0, + ); + } + + /** + * {@inheritdoc} + */ + public function validate_session($user) + { + // Check if PHP_AUTH_USER is set and handle this case + if ($this->request->is_set('PHP_AUTH_USER', request_interface::SERVER)) + { + $php_auth_user = $this->request->server('PHP_AUTH_USER'); + + return ($php_auth_user === $user['username']) ? true : false; + } + + // PHP_AUTH_USER is not set. A valid session is now determined by the user type (anonymous/bot or not) + if ($user['user_type'] == USER_IGNORE) + { + return true; + } + + return false; + } +} diff --git a/install/update/new/phpbb/auth/provider/base.php b/install/update/new/phpbb/auth/provider/base.php new file mode 100644 index 0000000..30e0a0f --- /dev/null +++ b/install/update/new/phpbb/auth/provider/base.php @@ -0,0 +1,108 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider; + +/** +* Base authentication provider class that all other providers should implement +*/ +abstract class base implements provider_interface +{ + /** + * {@inheritdoc} + */ + public function init() + { + return; + } + + /** + * {@inheritdoc} + */ + public function autologin() + { + return; + } + + /** + * {@inheritdoc} + */ + public function acp() + { + return; + } + + /** + * {@inheritdoc} + */ + public function get_acp_template($new_config) + { + return; + } + + /** + * {@inheritdoc} + */ + public function get_login_data() + { + return; + } + + /** + * {@inheritdoc} + */ + public function get_auth_link_data($user_id = 0) + { + return; + } + + /** + * {@inheritdoc} + */ + public function logout($data, $new_session) + { + return; + } + + /** + * {@inheritdoc} + */ + public function validate_session($user) + { + return; + } + + /** + * {@inheritdoc} + */ + public function login_link_has_necessary_data($login_link_data) + { + return; + } + + /** + * {@inheritdoc} + */ + public function link_account(array $link_data) + { + return; + } + + /** + * {@inheritdoc} + */ + public function unlink_account(array $link_data) + { + return; + } +} diff --git a/install/update/new/phpbb/auth/provider/db.php b/install/update/new/phpbb/auth/provider/db.php new file mode 100644 index 0000000..a70734f --- /dev/null +++ b/install/update/new/phpbb/auth/provider/db.php @@ -0,0 +1,259 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider; + +use phpbb\captcha\factory; +use phpbb\config\config; +use phpbb\db\driver\driver_interface; +use phpbb\passwords\manager; +use phpbb\request\request_interface; +use phpbb\user; + +/** + * Database authentication provider for phpBB3 + * This is for authentication via the integrated user table + */ +class db extends base +{ + /** @var factory CAPTCHA factory */ + protected $captcha_factory; + + /** @var config phpBB config */ + protected $config; + + /** @var driver_interface DBAL driver instance */ + protected $db; + + /** @var request_interface Request object */ + protected $request; + + /** @var user User object */ + protected $user; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var string PHP file extension */ + protected $php_ext; + + /** + * phpBB passwords manager + * + * @var manager + */ + protected $passwords_manager; + + /** + * Database Authentication Constructor + * + * @param factory $captcha_factory + * @param config $config + * @param driver_interface $db + * @param manager $passwords_manager + * @param request_interface $request + * @param user $user + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(factory $captcha_factory, config $config, driver_interface $db, manager $passwords_manager, request_interface $request, user $user, $phpbb_root_path, $php_ext) + { + $this->captcha_factory = $captcha_factory; + $this->config = $config; + $this->db = $db; + $this->passwords_manager = $passwords_manager; + $this->request = $request; + $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * {@inheritdoc} + */ + public function login($username, $password) + { + // Auth plugins get the password untrimmed. + // For compatibility we trim() here. + $password = trim($password); + + // do not allow empty password + if (!$password) + { + return array( + 'status' => LOGIN_ERROR_PASSWORD, + 'error_msg' => 'NO_PASSWORD_SUPPLIED', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!$username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $username_clean = utf8_clean_string($username); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $this->db->sql_escape($username_clean) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (($this->user->ip && !$this->config['ip_login_limit_use_forwarded']) || + ($this->user->forwarded_for && $this->config['ip_login_limit_use_forwarded'])) + { + $sql = 'SELECT COUNT(*) AS attempts + FROM ' . LOGIN_ATTEMPT_TABLE . ' + WHERE attempt_time > ' . (time() - (int) $this->config['ip_login_limit_time']); + if ($this->config['ip_login_limit_use_forwarded']) + { + $sql .= " AND attempt_forwarded_for = '" . $this->db->sql_escape($this->user->forwarded_for) . "'"; + } + else + { + $sql .= " AND attempt_ip = '" . $this->db->sql_escape($this->user->ip) . "' "; + } + + $result = $this->db->sql_query($sql); + $attempts = (int) $this->db->sql_fetchfield('attempts'); + $this->db->sql_freeresult($result); + + $attempt_data = array( + 'attempt_ip' => $this->user->ip, + 'attempt_browser' => trim(substr($this->user->browser, 0, 149)), + 'attempt_forwarded_for' => $this->user->forwarded_for, + 'attempt_time' => time(), + 'user_id' => ($row) ? (int) $row['user_id'] : 0, + 'username' => $username, + 'username_clean' => $username_clean, + ); + $sql = 'INSERT INTO ' . LOGIN_ATTEMPT_TABLE . $this->db->sql_build_array('INSERT', $attempt_data); + $this->db->sql_query($sql); + } + else + { + $attempts = 0; + } + + if (!$row) + { + if ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max']) + { + return array( + 'status' => LOGIN_ERROR_ATTEMPTS, + 'error_msg' => 'LOGIN_ERROR_ATTEMPTS', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $show_captcha = ($this->config['max_login_attempts'] && $row['user_login_attempts'] >= $this->config['max_login_attempts']) || + ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max']); + + // If there are too many login attempts, we need to check for a confirm image + // Every auth module is able to define what to do by itself... + if ($show_captcha) + { + $captcha = $this->captcha_factory->get_instance($this->config['captcha_plugin']); + $captcha->init(CONFIRM_LOGIN); + $vc_response = $captcha->validate($row); + if ($vc_response) + { + return array( + 'status' => LOGIN_ERROR_ATTEMPTS, + 'error_msg' => 'LOGIN_ERROR_ATTEMPTS', + 'user_row' => $row, + ); + } + else + { + $captcha->reset(); + } + + } + + // Check password ... + if ($this->passwords_manager->check($password, $row['user_password'], $row)) + { + // Check for old password hash... + if ($this->passwords_manager->convert_flag || strlen($row['user_password']) == 32) + { + $hash = $this->passwords_manager->hash($password); + + // Update the password in the users table to the new format + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_password = '" . $this->db->sql_escape($hash) . "' + WHERE user_id = {$row['user_id']}"; + $this->db->sql_query($sql); + + $row['user_password'] = $hash; + } + + $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . ' + WHERE user_id = ' . $row['user_id']; + $this->db->sql_query($sql); + + if ($row['user_login_attempts'] != 0) + { + // Successful, reset login attempts (the user passed all stages) + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_login_attempts = 0 + WHERE user_id = ' . $row['user_id']; + $this->db->sql_query($sql); + } + + // User inactive... + if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) + { + return array( + 'status' => LOGIN_ERROR_ACTIVE, + 'error_msg' => 'ACTIVE_ERROR', + 'user_row' => $row, + ); + } + + // Successful login... set user_login_attempts to zero... + return array( + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ); + } + + // Password incorrect - increase login attempts + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_login_attempts = user_login_attempts + 1 + WHERE user_id = ' . (int) $row['user_id'] . ' + AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX; + $this->db->sql_query($sql); + + // Give status about wrong password... + return array( + 'status' => ($show_captcha) ? LOGIN_ERROR_ATTEMPTS : LOGIN_ERROR_PASSWORD, + 'error_msg' => 'LOGIN_ERROR_PASSWORD', + 'user_row' => $row, + ); + } +} diff --git a/install/update/new/phpbb/auth/provider/ldap.php b/install/update/new/phpbb/auth/provider/ldap.php new file mode 100644 index 0000000..43699f7 --- /dev/null +++ b/install/update/new/phpbb/auth/provider/ldap.php @@ -0,0 +1,359 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider; + +use phpbb\config\config; +use phpbb\db\driver\driver_interface; +use phpbb\language\language; +use phpbb\user; + +/** + * Database authentication provider for phpBB3 + * This is for authentication via the integrated user table + */ +class ldap extends base +{ + /** @var config phpBB config */ + protected $config; + + /** @var driver_interface DBAL driver interface */ + protected $db; + + /** @var language phpBB language class */ + protected $language; + + /** @var user phpBB user */ + protected $user; + + /** + * LDAP Authentication Constructor + * + * @param config $config Config object + * @param driver_interface $db DBAL driver interface + * @param language $language Language object + * @param user $user User object + */ + public function __construct(config $config, driver_interface $db, language $language, user $user) + { + $this->config = $config; + $this->db = $db; + $this->language = $language; + $this->user = $user; + } + + /** + * {@inheritdoc} + */ + public function init() + { + if (!@extension_loaded('ldap')) + { + return $this->language->lang('LDAP_NO_LDAP_EXTENSION'); + } + + $this->config['ldap_port'] = (int) $this->config['ldap_port']; + if ($this->config['ldap_port']) + { + $ldap = @ldap_connect($this->config['ldap_server'], $this->config['ldap_port']); + } + else + { + $ldap = @ldap_connect($this->config['ldap_server']); + } + + if (!$ldap) + { + return $this->language->lang('LDAP_NO_SERVER_CONNECTION'); + } + + @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); + @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); + + if ($this->config['ldap_user'] || $this->config['ldap_password']) + { + if (!@ldap_bind($ldap, htmlspecialchars_decode($this->config['ldap_user']), htmlspecialchars_decode($this->config['ldap_password']))) + { + return $this->language->lang('LDAP_INCORRECT_USER_PASSWORD'); + } + } + + // ldap_connect only checks whether the specified server is valid, so the connection might still fail + $search = @ldap_search( + $ldap, + htmlspecialchars_decode($this->config['ldap_base_dn']), + $this->ldap_user_filter($this->user->data['username']), + (empty($this->config['ldap_email'])) ? + array(htmlspecialchars_decode($this->config['ldap_uid'])) : + array(htmlspecialchars_decode($this->config['ldap_uid']), htmlspecialchars_decode($this->config['ldap_email'])), + 0, + 1 + ); + + if ($search === false) + { + return $this->language->lang('LDAP_SEARCH_FAILED'); + } + + $result = @ldap_get_entries($ldap, $search); + + @ldap_close($ldap); + + if (!is_array($result) || count($result) < 2) + { + return $this->language->lang('LDAP_NO_IDENTITY', $this->user->data['username']); + } + + if (!empty($this->config['ldap_email']) && !isset($result[0][htmlspecialchars_decode($this->config['ldap_email'])])) + { + return $this->language->lang('LDAP_NO_EMAIL'); + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function login($username, $password) + { + // do not allow empty password + if (!$password) + { + return array( + 'status' => LOGIN_ERROR_PASSWORD, + 'error_msg' => 'NO_PASSWORD_SUPPLIED', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!$username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!@extension_loaded('ldap')) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LDAP_NO_LDAP_EXTENSION', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $this->config['ldap_port'] = (int) $this->config['ldap_port']; + if ($this->config['ldap_port']) + { + $ldap = @ldap_connect($this->config['ldap_server'], $this->config['ldap_port']); + } + else + { + $ldap = @ldap_connect($this->config['ldap_server']); + } + + if (!$ldap) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LDAP_NO_SERVER_CONNECTION', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); + @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); + + if ($this->config['ldap_user'] || $this->config['ldap_password']) + { + if (!@ldap_bind($ldap, htmlspecialchars_decode($this->config['ldap_user']), htmlspecialchars_decode($this->config['ldap_password']))) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LDAP_NO_SERVER_CONNECTION', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + } + + $search = @ldap_search( + $ldap, + htmlspecialchars_decode($this->config['ldap_base_dn']), + $this->ldap_user_filter($username), + (empty($this->config['ldap_email'])) ? + array(htmlspecialchars_decode($this->config['ldap_uid'])) : + array(htmlspecialchars_decode($this->config['ldap_uid']), htmlspecialchars_decode($this->config['ldap_email'])), + 0, + 1 + ); + + $ldap_result = @ldap_get_entries($ldap, $search); + + if (is_array($ldap_result) && count($ldap_result) > 1) + { + if (@ldap_bind($ldap, $ldap_result[0]['dn'], htmlspecialchars_decode($password))) + { + @ldap_close($ldap); + + $sql ='SELECT user_id, username, user_password, user_passchg, user_email, user_type + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + unset($ldap_result); + + // User inactive... + if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) + { + return array( + 'status' => LOGIN_ERROR_ACTIVE, + 'error_msg' => 'ACTIVE_ERROR', + 'user_row' => $row, + ); + } + + // Successful login... set user_login_attempts to zero... + return array( + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ); + } + else + { + // retrieve default group id + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "' + AND group_type = " . GROUP_SPECIAL; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + // generate user account data + $ldap_user_row = array( + 'username' => $username, + 'user_password' => '', + 'user_email' => (!empty($this->config['ldap_email'])) ? utf8_htmlspecialchars($ldap_result[0][htmlspecialchars_decode($this->config['ldap_email'])][0]) : '', + 'group_id' => (int) $row['group_id'], + 'user_type' => USER_NORMAL, + 'user_ip' => $this->user->ip, + 'user_new' => ($this->config['new_member_post_limit']) ? 1 : 0, + ); + + unset($ldap_result); + + // this is the user's first login so create an empty profile + return array( + 'status' => LOGIN_SUCCESS_CREATE_PROFILE, + 'error_msg' => false, + 'user_row' => $ldap_user_row, + ); + } + } + else + { + unset($ldap_result); + @ldap_close($ldap); + + // Give status about wrong password... + return array( + 'status' => LOGIN_ERROR_PASSWORD, + 'error_msg' => 'LOGIN_ERROR_PASSWORD', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + } + + @ldap_close($ldap); + + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + /** + * {@inheritdoc} + */ + public function acp() + { + // These are fields required in the config table + return array( + 'ldap_server', 'ldap_port', 'ldap_base_dn', 'ldap_uid', 'ldap_user_filter', 'ldap_email', 'ldap_user', 'ldap_password', + ); + } + + /** + * {@inheritdoc} + */ + public function get_acp_template($new_config) + { + return array( + 'TEMPLATE_FILE' => 'auth_provider_ldap.html', + 'TEMPLATE_VARS' => array( + 'AUTH_LDAP_BASE_DN' => $new_config['ldap_base_dn'], + 'AUTH_LDAP_EMAIL' => $new_config['ldap_email'], + 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'] !== '' ? '********' : '', + 'AUTH_LDAP_PORT' => $new_config['ldap_port'], + 'AUTH_LDAP_SERVER' => $new_config['ldap_server'], + 'AUTH_LDAP_UID' => $new_config['ldap_uid'], + 'AUTH_LDAP_USER' => $new_config['ldap_user'], + 'AUTH_LDAP_USER_FILTER' => $new_config['ldap_user_filter'], + ), + ); + } + + /** + * Generates a filter string for ldap_search to find a user + * + * @param $username string Username identifying the searched user + * + * @return string A filter string for ldap_search + */ + private function ldap_user_filter($username) + { + $filter = '(' . $this->config['ldap_uid'] . '=' . $this->ldap_escape(htmlspecialchars_decode($username)) . ')'; + if ($this->config['ldap_user_filter']) + { + $_filter = ($this->config['ldap_user_filter'][0] == '(' && substr($this->config['ldap_user_filter'], -1) == ')') ? $this->config['ldap_user_filter'] : "({$this->config['ldap_user_filter']})"; + $filter = "(&{$filter}{$_filter})"; + } + return $filter; + } + + /** + * Escapes an LDAP AttributeValue + * + * @param string $string The string to be escaped + * @return string The escaped string + */ + private function ldap_escape($string) + { + return str_replace(array('*', '\\', '(', ')'), array('\\*', '\\\\', '\\(', '\\)'), $string); + } +} diff --git a/install/update/new/phpbb/auth/provider/oauth/oauth.php b/install/update/new/phpbb/auth/provider/oauth/oauth.php new file mode 100644 index 0000000..29ffe6d --- /dev/null +++ b/install/update/new/phpbb/auth/provider/oauth/oauth.php @@ -0,0 +1,859 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\auth\provider\oauth; + +use OAuth\Common\Http\Exception\TokenResponseException; +use OAuth\ServiceFactory; +use OAuth\Common\Consumer\Credentials; +use OAuth\Common\Service\ServiceInterface; +use OAuth\OAuth1\Service\AbstractService as OAuth1Service; +use OAuth\OAuth2\Service\AbstractService as OAuth2Service; +use phpbb\auth\provider\base; +use phpbb\auth\provider\db; +use phpbb\auth\provider\oauth\service\exception; +use phpbb\config\config; +use phpbb\db\driver\driver_interface; +use phpbb\di\service_collection; +use phpbb\event\dispatcher; +use phpbb\language\language; +use phpbb\request\request_interface; +use phpbb\user; + +/** + * OAuth authentication provider for phpBB3 + */ +class oauth extends base +{ + /** @var config */ + protected $config; + + /** @var driver_interface */ + protected $db; + + /** @var db */ + protected $db_auth; + + /** @var dispatcher */ + protected $dispatcher; + + /** @var language */ + protected $language; + + /** @var request_interface */ + protected $request; + + /** @var service_collection */ + protected $service_providers; + + /** @var user */ + protected $user; + + /** @var string OAuth table: token storage */ + protected $oauth_token_table; + + /** @var string OAuth table: state */ + protected $oauth_state_table; + + /** @var string OAuth table: account association */ + protected $oauth_account_table; + + /** @var string Users table */ + protected $users_table; + + /** @var string phpBB root path */ + protected $root_path; + + /** @var string php File extension */ + protected $php_ext; + + /** + * Constructor. + * + * @param config $config Config object + * @param driver_interface $db Database object + * @param db $db_auth DB auth provider + * @param dispatcher $dispatcher Event dispatcher object + * @param language $language Language object + * @param request_interface $request Request object + * @param service_collection $service_providers OAuth providers service collection + * @param user $user User object + * @param string $oauth_token_table OAuth table: token storage + * @param string $oauth_state_table OAuth table: state + * @param string $oauth_account_table OAuth table: account association + * @param string $users_table User table + * @param string $root_path phpBB root path + * @param string $php_ext php File extension + */ + public function __construct( + config $config, + driver_interface $db, + db $db_auth, + dispatcher $dispatcher, + language $language, + request_interface $request, + service_collection $service_providers, + user $user, + $oauth_token_table, + $oauth_state_table, + $oauth_account_table, + $users_table, + $root_path, + $php_ext + ) + { + $this->config = $config; + $this->db = $db; + $this->db_auth = $db_auth; + $this->dispatcher = $dispatcher; + $this->language = $language; + $this->service_providers = $service_providers; + $this->request = $request; + $this->user = $user; + + $this->oauth_token_table = $oauth_token_table; + $this->oauth_state_table = $oauth_state_table; + $this->oauth_account_table = $oauth_account_table; + $this->users_table = $users_table; + $this->root_path = $root_path; + $this->php_ext = $php_ext; + } + + /** + * {@inheritdoc} + */ + public function init() + { + // This does not test whether or not the key and secret provided are valid. + foreach ($this->service_providers as $service_provider) + { + $credentials = $service_provider->get_service_credentials(); + + if (($credentials['key'] && !$credentials['secret']) || (!$credentials['key'] && $credentials['secret'])) + { + return $this->language->lang('AUTH_PROVIDER_OAUTH_ERROR_ELEMENT_MISSING'); + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function login($username, $password) + { + // Temporary workaround for only having one authentication provider available + if (!$this->request->is_set('oauth_service')) + { + return $this->db_auth->login($username, $password); + } + + // Request the name of the OAuth service + $provider = $this->request->variable('oauth_service', '', false); + $service_name = $this->get_service_name($provider); + + if ($provider === '' || !array_key_exists($service_name, $this->service_providers)) + { + return [ + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST', + 'user_row' => ['user_id' => ANONYMOUS], + ]; + } + + // Get the service credentials for the given service + $storage = new token_storage($this->db, $this->user, $this->oauth_token_table, $this->oauth_state_table); + $query = 'mode=login&login=external&oauth_service=' . $provider; + + try + { + /** @var OAuth1Service|OAuth2Service $service */ + $service = $this->get_service($provider, $storage, $query); + } + catch (\Exception $e) + { + return [ + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => $e->getMessage(), + 'user_row' => ['user_id' => ANONYMOUS], + ]; + } + + if ($this->is_set_code($service)) + { + $this->service_providers[$service_name]->set_external_service_provider($service); + + try + { + $unique_id = $this->service_providers[$service_name]->perform_auth_login(); + } + catch (exception $e) + { + return [ + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => $e->getMessage(), + 'user_row' => ['user_id' => ANONYMOUS], + ]; + } + + /** + * Check to see if this provider is already associated with an account. + * + * Enforcing a data type to make sure it are strings and not integers, + * so values are quoted in the SQL WHERE statement. + */ + $data = [ + 'provider' => (string) utf8_strtolower($provider), + 'oauth_provider_id' => (string) $unique_id + ]; + + $sql = 'SELECT user_id + FROM ' . $this->oauth_account_table . ' + WHERE ' . $this->db->sql_build_array('SELECT', $data); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $redirect_data = array( + 'auth_provider' => 'oauth', + 'login_link_oauth_service' => $provider, + ); + + /** + * Event is triggered before check if provider is already associated with an account + * + * @event core.oauth_login_after_check_if_provider_id_has_match + * @var array row User row + * @var array data Provider data + * @var array redirect_data Data to be appended to the redirect url + * @var ServiceInterface service OAuth service + * @since 3.2.3-RC1 + * @changed 3.2.6-RC1 Added redirect_data + */ + $vars = [ + 'row', + 'data', + 'redirect_data', + 'service', + ]; + extract($this->dispatcher->trigger_event('core.oauth_login_after_check_if_provider_id_has_match', compact($vars))); + + if (!$row) + { + // The user does not yet exist, ask to link or create profile + return [ + 'status' => LOGIN_SUCCESS_LINK_PROFILE, + 'error_msg' => 'LOGIN_OAUTH_ACCOUNT_NOT_LINKED', + 'user_row' => [], + 'redirect_data' => $redirect_data, + ]; + } + + // Retrieve the user's account + $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_ip, user_type, user_login_attempts + FROM ' . $this->users_table . ' + WHERE user_id = ' . (int) $row['user_id']; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + return [ + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'AUTH_PROVIDER_OAUTH_ERROR_INVALID_ENTRY', + 'user_row' => ['user_id' => ANONYMOUS], + ]; + } + + /** + * Check if the user is banned. + * The fourth parameter (return) has to be true, otherwise the OAuth login is still called and + * an uncaught exception is thrown as there is no token stored in the database. + */ + $ban = $this->user->check_ban($row['user_id'], $row['user_ip'], $row['user_email'], true); + + if (!empty($ban)) + { + $till_date = !empty($ban['ban_end']) ? $this->user->format_date($ban['ban_end']) : ''; + $message = !empty($ban['ban_end']) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM'; + + $contact_link = phpbb_get_board_contact_link($this->config, $this->root_path, $this->php_ext); + + $message = $this->language->lang($message, $till_date, '', ''); + $message .= !empty($ban['ban_give_reason']) ? '

' . $this->language->lang('BOARD_BAN_REASON', $ban['ban_give_reason']) : ''; + $message .= !empty($ban['ban_triggered_by']) ? '

' . $this->language->lang('BAN_TRIGGERED_BY_' . utf8_strtoupper($ban['ban_triggered_by'])) . '' : ''; + + return [ + 'status' => LOGIN_BREAK, + 'error_msg' => $message, + 'user_row' => $row, + ]; + } + + // Update token storage to store the user_id + $storage->set_user_id($row['user_id']); + + /** + * Event is triggered after user is successfully logged in via OAuth. + * + * @event core.auth_oauth_login_after + * @var array row User row + * @since 3.1.11-RC1 + */ + $vars = [ + 'row', + ]; + extract($this->dispatcher->trigger_event('core.auth_oauth_login_after', compact($vars))); + + // The user is now authenticated and can be logged in + return [ + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ]; + } + else + { + return $this->set_redirect($service); + } + } + + /** + * {@inheritdoc} + */ + public function get_login_data() + { + $login_data = [ + 'TEMPLATE_FILE' => 'login_body_oauth.html', + 'BLOCK_VAR_NAME' => 'oauth', + 'BLOCK_VARS' => [], + ]; + + foreach ($this->service_providers as $service_name => $service_provider) + { + // Only include data if the credentials are set + $credentials = $service_provider->get_service_credentials(); + + if ($credentials['key'] && $credentials['secret']) + { + $provider = $this->get_provider($service_name); + $redirect_url = generate_board_url() . '/ucp.' . $this->php_ext . '?mode=login&login=external&oauth_service=' . $provider; + + $login_data['BLOCK_VARS'][$service_name] = [ + 'REDIRECT_URL' => redirect($redirect_url, true), + 'SERVICE_NAME' => $this->get_provider_title($provider), + ]; + } + } + + return $login_data; + } + + /** + * {@inheritdoc} + */ + public function acp() + { + $ret = []; + + foreach ($this->service_providers as $service_name => $service_provider) + { + $provider = $this->get_provider($service_name); + + $provider = utf8_strtolower($provider); + + $ret[] = 'auth_oauth_' . $provider . '_key'; + $ret[] = 'auth_oauth_' . $provider . '_secret'; + } + + return $ret; + } + + /** + * {@inheritdoc} + */ + public function get_acp_template($new_config) + { + $ret = [ + 'BLOCK_VAR_NAME' => 'oauth_services', + 'BLOCK_VARS' => [], + 'TEMPLATE_FILE' => 'auth_provider_oauth.html', + 'TEMPLATE_VARS' => [], + ]; + + foreach ($this->service_providers as $service_name => $service_provider) + { + $provider = $this->get_provider($service_name); + + $ret['BLOCK_VARS'][$provider] = [ + 'NAME' => $provider, + 'ACTUAL_NAME' => $this->get_provider_title($provider), + 'KEY' => $new_config['auth_oauth_' . utf8_strtolower($provider) . '_key'], + 'SECRET' => $new_config['auth_oauth_' . utf8_strtolower($provider) . '_secret'], + ]; + } + + return $ret; + } + + /** + * {@inheritdoc} + */ + public function login_link_has_necessary_data($login_link_data) + { + if (empty($login_link_data)) + { + return 'LOGIN_LINK_NO_DATA_PROVIDED'; + } + + if (!array_key_exists('oauth_service', $login_link_data) || !$login_link_data['oauth_service'] || + !array_key_exists('link_method', $login_link_data) || !$login_link_data['link_method']) + { + return 'LOGIN_LINK_MISSING_DATA'; + } + + return null; + } + + /** + * {@inheritdoc} + */ + public function link_account(array $link_data) + { + // Check for a valid link method (auth_link or login_link) + if (!array_key_exists('link_method', $link_data) || + !in_array($link_data['link_method'], ['auth_link', 'login_link'])) + { + return 'LOGIN_LINK_MISSING_DATA'; + } + + // We must have an oauth_service listed, check for it two ways + if (!array_key_exists('oauth_service', $link_data) || !$link_data['oauth_service']) + { + $link_data['oauth_service'] = $this->request->variable('oauth_service', ''); + + if (!$link_data['oauth_service']) + { + return 'LOGIN_LINK_MISSING_DATA'; + } + } + + $service_name = $this->get_service_name($link_data['oauth_service']); + + if (!array_key_exists($service_name, $this->service_providers)) + { + return 'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST'; + } + + switch ($link_data['link_method']) + { + case 'auth_link': + return $this->link_account_auth_link($link_data, $service_name); + case 'login_link': + return $this->link_account_login_link($link_data, $service_name); + default: + return 'LOGIN_LINK_MISSING_DATA'; + } + } + + /** + * {@inheritdoc} + */ + public function logout($data, $new_session) + { + // Clear all tokens belonging to the user + $storage = new token_storage($this->db, $this->user, $this->oauth_token_table, $this->oauth_state_table); + $storage->clearAllTokens(); + + return; + } + + /** + * {@inheritdoc} + */ + public function get_auth_link_data($user_id = 0) + { + $user_ids = []; + $block_vars = []; + + $sql = 'SELECT oauth_provider_id, provider + FROM ' . $this->oauth_account_table . ' + WHERE user_id = ' . ($user_id > 0 ? (int) $user_id : (int) $this->user->data['user_id']); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $user_ids[$row['provider']] = $row['oauth_provider_id']; + } + $this->db->sql_freeresult($result); + + foreach ($this->service_providers as $service_name => $service_provider) + { + // Only include data if the credentials are set + $credentials = $service_provider->get_service_credentials(); + + if ($credentials['key'] && $credentials['secret']) + { + $provider = $this->get_provider($service_name); + + $block_vars[$service_name] = [ + 'SERVICE_NAME' => $this->get_provider_title($provider), + 'UNIQUE_ID' => isset($user_ids[$provider]) ? $user_ids[$provider] : null, + 'HIDDEN_FIELDS' => [ + 'link' => !isset($user_ids[$provider]), + 'oauth_service' => $provider, + ], + ]; + } + } + + return [ + 'BLOCK_VAR_NAME' => 'oauth', + 'BLOCK_VARS' => $block_vars, + + 'TEMPLATE_FILE' => 'ucp_auth_link_oauth.html', + ]; + } + + /** + * {@inheritdoc} + */ + public function unlink_account(array $link_data) + { + if (!array_key_exists('oauth_service', $link_data) || !$link_data['oauth_service']) + { + return 'LOGIN_LINK_MISSING_DATA'; + } + + // Remove user specified in $link_data if possible + $user_id = isset($link_data['user_id']) ? $link_data['user_id'] : $this->user->data['user_id']; + + // Remove the link + $sql = 'DELETE FROM ' . $this->oauth_account_table . " + WHERE provider = '" . $this->db->sql_escape($link_data['oauth_service']) . "' + AND user_id = " . (int) $user_id; + $this->db->sql_query($sql); + + $service_name = $this->get_service_name($link_data['oauth_service']); + + // Clear all tokens belonging to the user on this service + $storage = new token_storage($this->db, $this->user, $this->oauth_token_table, $this->oauth_state_table); + $storage->clearToken($service_name); + + return false; + } + + /** + * Performs the account linking for login_link. + * + * @param array $link_data The same variable given to + * {@see \phpbb\auth\provider\provider_interface::link_account} + * @param string $service_name The name of the service being used in linking. + * @return string|false Returns a language key (string) if an error is encountered, + * or false on success. + */ + protected function link_account_login_link(array $link_data, $service_name) + { + $storage = new token_storage($this->db, $this->user, $this->oauth_token_table, $this->oauth_state_table); + + // Check for an access token, they should have one + if (!$storage->has_access_token_by_session($service_name)) + { + return 'LOGIN_LINK_ERROR_OAUTH_NO_ACCESS_TOKEN'; + } + + // Prepare for an authentication request + $query = 'mode=login_link&login_link_oauth_service=' . $link_data['oauth_service']; + + try + { + $service = $this->get_service($link_data['oauth_service'], $storage, $query); + } + catch (\Exception $e) + { + return $e->getMessage(); + } + + $this->service_providers[$service_name]->set_external_service_provider($service); + + try + { + // The user has already authenticated successfully, request to authenticate again + $unique_id = $this->service_providers[$service_name]->perform_token_auth(); + } + catch (exception $e) + { + return $e->getMessage(); + } + + // Insert into table, they will be able to log in after this + $data = [ + 'user_id' => $link_data['user_id'], + 'provider' => utf8_strtolower($link_data['oauth_service']), + 'oauth_provider_id' => $unique_id, + ]; + + $this->link_account_perform_link($data); + + // Update token storage to store the user_id + $storage->set_user_id($link_data['user_id']); + + return false; + } + + /** + * Performs the account linking for auth_link. + * + * @param array $link_data The same variable given to + * {@see \phpbb\auth\provider\provider_interface::link_account} + * @param string $service_name The name of the service being used in linking. + * @return string|false Returns a language constant (string) if an error is encountered, + * or false on success. + */ + protected function link_account_auth_link(array $link_data, $service_name) + { + $storage = new token_storage($this->db, $this->user, $this->oauth_token_table, $this->oauth_state_table); + $query = 'i=ucp_auth_link&mode=auth_link&link=1&oauth_service=' . $link_data['oauth_service']; + + try + { + /** @var OAuth1Service|OAuth2Service $service */ + $service = $this->get_service($link_data['oauth_service'], $storage, $query); + } + catch (\Exception $e) + { + return $e->getMessage(); + } + + if ($this->is_set_code($service)) + { + $this->service_providers[$service_name]->set_external_service_provider($service); + + try + { + $unique_id = $this->service_providers[$service_name]->perform_auth_login(); + } + catch (exception $e) + { + return $e->getMessage(); + } + + // Insert into table, they will be able to log in after this + $data = [ + 'user_id' => $this->user->data['user_id'], + 'provider' => utf8_strtolower($link_data['oauth_service']), + 'oauth_provider_id' => $unique_id, + ]; + + $this->link_account_perform_link($data); + + return false; + } + else + { + return $this->set_redirect($service); + } + } + + /** + * Performs the query that inserts an account link + * + * @param array $data This array is passed to db->sql_build_array + */ + protected function link_account_perform_link(array $data) + { + // Check if the external account is already associated with other user + $sql = 'SELECT user_id + FROM ' . $this->oauth_account_table . " + WHERE provider = '" . $this->db->sql_escape($data['provider']) . "' + AND oauth_provider_id = '" . $this->db->sql_escape($data['oauth_provider_id']) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + trigger_error('AUTH_PROVIDER_OAUTH_ERROR_ALREADY_LINKED'); + } + + // Link account + $sql = 'INSERT INTO ' . $this->oauth_account_table . ' ' . $this->db->sql_build_array('INSERT', $data); + $this->db->sql_query($sql); + + /** + * Event is triggered after user links account. + * + * @event core.auth_oauth_link_after + * @var array data User row + * @since 3.1.11-RC1 + */ + $vars = [ + 'data', + ]; + extract($this->dispatcher->trigger_event('core.auth_oauth_link_after', compact($vars))); + } + + /** + * Returns a new service object. + * + * @param string $provider The name of the provider + * @param token_storage $storage Token storage object + * @param string $query The query string used for the redirect uri + * @return ServiceInterface + * @throws exception When OAuth service was not created + */ + protected function get_service($provider, token_storage $storage, $query) + { + $service_name = $this->get_service_name($provider); + + /** @see \phpbb\auth\provider\oauth\service\service_interface::get_service_credentials */ + $service_credentials = $this->service_providers[$service_name]->get_service_credentials(); + + /** @see \phpbb\auth\provider\oauth\service\service_interface::get_auth_scope */ + $scopes = $this->service_providers[$service_name]->get_auth_scope(); + + $callback = generate_board_url() . "/ucp.{$this->php_ext}?{$query}"; + + // Setup the credentials for the requests + $credentials = new Credentials( + $service_credentials['key'], + $service_credentials['secret'], + $callback + ); + + $service_factory = new ServiceFactory; + + // Allow providers to register a custom class or override the provider name + if ($class = $this->service_providers[$service_name]->get_external_service_class()) + { + if (class_exists($class)) + { + try + { + $service_factory->registerService($provider, $class); + } + catch (\OAuth\Common\Exception\Exception $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + } + else + { + $provider = $class; + } + } + + $service = $service_factory->createService($provider, $credentials, $storage, $scopes); + + if (!$service) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_SERVICE_NOT_CREATED'); + } + + return $service; + } + + /** + * Returns the service name for an OAuth provider name. + * + * @param string $provider The OAuth provider name + * @return string The service name + */ + protected function get_service_name($provider) + { + if (strpos($provider, 'auth.provider.oauth.service.') !== 0) + { + $provider = 'auth.provider.oauth.service.' . utf8_strtolower($provider); + } + + return $provider; + } + + /** + * Returns the OAuth provider name from a service name. + * + * @param string $service_name The service name + * @return string The OAuth provider name + */ + protected function get_provider($service_name) + { + return str_replace('auth.provider.oauth.service.', '', $service_name); + } + + /** + * Returns the localized title for the OAuth provider. + * + * @param string $provider The OAuth provider name + * @return string The OAuth provider title + */ + protected function get_provider_title($provider) + { + return $this->language->lang('AUTH_PROVIDER_OAUTH_SERVICE_' . utf8_strtoupper($provider)); + } + + /** + * Returns whether or not the authorization code is set. + * + * @param OAuth1Service|OAuth2Service $service The external OAuth service + * @return bool Whether or not the authorization code is set in the URL + * for the respective OAuth service's version + */ + protected function is_set_code($service) + { + switch ($service::OAUTH_VERSION) + { + case 1: + return $this->request->is_set('oauth_token', request_interface::GET); + + case 2: + return $this->request->is_set('code', request_interface::GET); + + default: + return false; + } + } + + /** + * Sets a redirect to the authorization uri. + * + * @param OAuth1Service|OAuth2Service $service The external OAuth service + * @return array|false Array if an error occurred, + * false on success + */ + protected function set_redirect($service) + { + $parameters = []; + + if ($service::OAUTH_VERSION === 1) + { + try + { + $token = $service->requestRequestToken(); + $parameters = ['oauth_token' => $token->getRequestToken()]; + } + catch (TokenResponseException $e) + { + return [ + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => $e->getMessage(), + 'user_row' => ['user_id' => ANONYMOUS], + ]; + } + } + + redirect($service->getAuthorizationUri($parameters), false, true); + + return false; + } +} diff --git a/install/update/new/phpbb/auth/provider/oauth/service/base.php b/install/update/new/phpbb/auth/provider/oauth/service/base.php new file mode 100644 index 0000000..5ab426a --- /dev/null +++ b/install/update/new/phpbb/auth/provider/oauth/service/base.php @@ -0,0 +1,59 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\auth\provider\oauth\service; + +/** + * Base OAuth abstract class that all OAuth services should implement + */ +abstract class base implements service_interface +{ + /** + * External OAuth service provider + * + * @var \OAuth\Common\Service\ServiceInterface + */ + protected $service_provider; + + /** + * {@inheritdoc} + */ + public function get_auth_scope() + { + return []; + } + + /** + * {@inheritdoc} + */ + public function get_external_service_class() + { + return ''; + } + + /** + * {@inheritdoc} + */ + public function get_external_service_provider() + { + return $this->service_provider; + } + + /** + * {@inheritdoc} + */ + public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider) + { + $this->service_provider = $service_provider; + } +} diff --git a/install/update/new/phpbb/auth/provider/oauth/service/bitly.php b/install/update/new/phpbb/auth/provider/oauth/service/bitly.php new file mode 100644 index 0000000..ca131b2 --- /dev/null +++ b/install/update/new/phpbb/auth/provider/oauth/service/bitly.php @@ -0,0 +1,107 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\auth\provider\oauth\service; + +/** + * Bitly OAuth service + */ +class bitly extends base +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** + * Constructor. + * + * @param \phpbb\config\config $config Config object + * @param \phpbb\request\request_interface $request Request object + */ + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) + { + $this->config = $config; + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public function get_service_credentials() + { + return [ + 'key' => $this->config['auth_oauth_bitly_key'], + 'secret' => $this->config['auth_oauth_bitly_secret'], + ]; + } + + /** + * {@inheritdoc} + */ + public function perform_auth_login() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + try + { + // This was a callback request, get the token + $this->service_provider->requestAccessToken($this->request->variable('code', '')); + } + catch (\OAuth\Common\Http\Exception\TokenResponseException $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + try + { + // Send a request with it + $result = (array) json_decode($this->service_provider->request('user/info'), true); + } + catch (\OAuth\Common\Exception\Exception $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + // Return the unique identifier returned from bitly + return $result['data']['login']; + } + + /** + * {@inheritdoc} + */ + public function perform_token_auth() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + try + { + // Send a request with it + $result = (array) json_decode($this->service_provider->request('user/info'), true); + } + catch (\OAuth\Common\Exception\Exception $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + // Return the unique identifier + return $result['data']['login']; + } +} diff --git a/install/update/new/phpbb/auth/provider/oauth/service/facebook.php b/install/update/new/phpbb/auth/provider/oauth/service/facebook.php new file mode 100644 index 0000000..f7dbe30 --- /dev/null +++ b/install/update/new/phpbb/auth/provider/oauth/service/facebook.php @@ -0,0 +1,107 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\auth\provider\oauth\service; + +/** + * Facebook OAuth service + */ +class facebook extends base +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** + * Constructor. + * + * @param \phpbb\config\config $config Config object + * @param \phpbb\request\request_interface $request Request object + */ + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) + { + $this->config = $config; + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public function get_service_credentials() + { + return [ + 'key' => $this->config['auth_oauth_facebook_key'], + 'secret' => $this->config['auth_oauth_facebook_secret'], + ]; + } + + /** + * {@inheritdoc} + */ + public function perform_auth_login() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + try + { + // This was a callback request, get the token + $this->service_provider->requestAccessToken($this->request->variable('code', '')); + } + catch (\OAuth\Common\Http\Exception\TokenResponseException $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + try + { + // Send a request with it + $result = (array) json_decode($this->service_provider->request('/me'), true); + } + catch (\OAuth\Common\Exception\Exception $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + // Return the unique identifier + return $result['id']; + } + + /** + * {@inheritdoc} + */ + public function perform_token_auth() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + try + { + // Send a request with it + $result = (array) json_decode($this->service_provider->request('/me'), true); + } + catch (\OAuth\Common\Exception\Exception $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + // Return the unique identifier + return $result['id']; + } +} diff --git a/install/update/new/phpbb/auth/provider/oauth/service/google.php b/install/update/new/phpbb/auth/provider/oauth/service/google.php new file mode 100644 index 0000000..6e671ab --- /dev/null +++ b/install/update/new/phpbb/auth/provider/oauth/service/google.php @@ -0,0 +1,118 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\auth\provider\oauth\service; + +/** + * Google OAuth service + */ +class google extends base +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** + * Constructor. + * + * @param \phpbb\config\config $config Config object + * @param \phpbb\request\request_interface $request Request object + */ + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) + { + $this->config = $config; + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public function get_auth_scope() + { + return [ + 'userinfo_email', + 'userinfo_profile', + ]; + } + + /** + * {@inheritdoc} + */ + public function get_service_credentials() + { + return [ + 'key' => $this->config['auth_oauth_google_key'], + 'secret' => $this->config['auth_oauth_google_secret'], + ]; + } + + /** + * {@inheritdoc} + */ + public function perform_auth_login() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + try + { + // This was a callback request, get the token + $this->service_provider->requestAccessToken($this->request->variable('code', '')); + } + catch (\OAuth\Common\Http\Exception\TokenResponseException $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + try + { + // Send a request with it + $result = (array) json_decode($this->service_provider->request('https://www.googleapis.com/oauth2/v1/userinfo'), true); + } + catch (\OAuth\Common\Exception\Exception $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + // Return the unique identifier + return $result['id']; + } + + /** + * {@inheritdoc} + */ + public function perform_token_auth() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + try + { + // Send a request with it + $result = (array) json_decode($this->service_provider->request('https://www.googleapis.com/oauth2/v1/userinfo'), true); + } + catch (\OAuth\Common\Exception\Exception $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + // Return the unique identifier + return $result['id']; + } +} diff --git a/install/update/new/phpbb/auth/provider/oauth/service/service_interface.php b/install/update/new/phpbb/auth/provider/oauth/service/service_interface.php new file mode 100644 index 0000000..239e661 --- /dev/null +++ b/install/update/new/phpbb/auth/provider/oauth/service/service_interface.php @@ -0,0 +1,85 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\auth\provider\oauth\service; + +/** + * OAuth service interface + */ +interface service_interface +{ + /** + * Returns an array of the scopes necessary for auth + * + * @return array An array of the required scopes + */ + public function get_auth_scope(); + + /** + * Returns an array containing the service credentials belonging to requested + * service. + * + * @return array An array containing the 'key' and the 'secret' of the + * service in the form: + * array( + * 'key' => string + * 'secret' => string + * ) + */ + public function get_service_credentials(); + + /** + * Returns the results of the authentication in json format + * + * @throws \phpbb\auth\provider\oauth\service\exception + * @return string The unique identifier returned by the service provider + * that is used to authenticate the user with phpBB. + */ + public function perform_auth_login(); + + /** + * Returns the results of the authentication in json format + * Use this function when the user already has an access token + * + * @throws \phpbb\auth\provider\oauth\service\exception + * @return string The unique identifier returned by the service provider + * that is used to authenticate the user with phpBB. + */ + public function perform_token_auth(); + + /** + * Returns the class of external library service provider that has to be used. + * + * @return string If the string is a class, it will register the provided string as a class, + * which later will be generated as the OAuth external service provider. + * If the string is not a class, it will use this string, + * trying to generate a service for the version 2 and 1 respectively: + * \OAuth\OAuth2\Service\ + * If the string is empty, it will default to OAuth's standard service classes, + * trying to generate a service for the version 2 and 1 respectively: + * \OAuth\OAuth2\Service\Facebook + */ + public function get_external_service_class(); + + /** + * Returns the external library service provider once it has been set + */ + public function get_external_service_provider(); + + /** + * Sets the external library service provider + * + * @param \OAuth\Common\Service\ServiceInterface $service_provider + */ + public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider); +} diff --git a/install/update/new/phpbb/auth/provider/oauth/service/twitter.php b/install/update/new/phpbb/auth/provider/oauth/service/twitter.php new file mode 100644 index 0000000..35cbc9e --- /dev/null +++ b/install/update/new/phpbb/auth/provider/oauth/service/twitter.php @@ -0,0 +1,111 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\auth\provider\oauth\service; + +/** + * Twitter OAuth service + */ +class twitter extends base +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** + * Constructor. + * + * @param \phpbb\config\config $config Config object + * @param \phpbb\request\request_interface $request Request object + */ + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) + { + $this->config = $config; + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public function get_service_credentials() + { + return [ + 'key' => $this->config['auth_oauth_twitter_key'], + 'secret' => $this->config['auth_oauth_twitter_secret'], + ]; + } + + /** + * {@inheritdoc} + */ + public function perform_auth_login() + { + if (!($this->service_provider instanceof \OAuth\OAuth1\Service\Twitter)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + $storage = $this->service_provider->getStorage(); + + try + { + /** @var \OAuth\OAuth1\Token\TokenInterface $token */ + $token = $storage->retrieveAccessToken('Twitter'); + } + catch (\OAuth\Common\Storage\Exception\TokenNotFoundException $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + $secret = $token->getRequestTokenSecret(); + + try + { + // This was a callback request, get the token + $this->service_provider->requestAccessToken( + $this->request->variable('oauth_token', ''), + $this->request->variable('oauth_verifier', ''), + $secret + ); + } + catch (\OAuth\Common\Http\Exception\TokenResponseException $e) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_REQUEST'); + } + + // Send a request with it + $result = (array) json_decode($this->service_provider->request('account/verify_credentials.json'), true); + + // Return the unique identifier + return $result['id']; + } + + /** + * {@inheritdoc} + */ + public function perform_token_auth() + { + if (!($this->service_provider instanceof \OAuth\OAuth1\Service\Twitter)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + // Send a request with it + $result = (array) json_decode($this->service_provider->request('account/verify_credentials.json'), true); + + // Return the unique identifier + return $result['id']; + } +} diff --git a/install/update/new/phpbb/auth/provider/oauth/token_storage.php b/install/update/new/phpbb/auth/provider/oauth/token_storage.php new file mode 100644 index 0000000..c0f585d --- /dev/null +++ b/install/update/new/phpbb/auth/provider/oauth/token_storage.php @@ -0,0 +1,620 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\auth\provider\oauth; + +use OAuth\OAuth1\Token\StdOAuth1Token; +use OAuth\Common\Token\TokenInterface; +use OAuth\Common\Storage\TokenStorageInterface; +use OAuth\Common\Storage\Exception\TokenNotFoundException; +use OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException; + +/** + * OAuth storage wrapper for phpBB's cache + */ +class token_storage implements TokenStorageInterface +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\user */ + protected $user; + + /** @var string OAuth table: token storage */ + protected $oauth_token_table; + + /** @var string OAuth table: state */ + protected $oauth_state_table; + + /** @var TokenInterface OAuth token */ + protected $cachedToken; + + /** @var string OAuth state */ + protected $cachedState; + + /** + * Constructor. + * + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\user $user User object + * @param string $oauth_token_table OAuth table: token storage + * @param string $oauth_state_table OAuth table: state + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $oauth_token_table, $oauth_state_table) + { + $this->db = $db; + $this->user = $user; + + $this->oauth_token_table = $oauth_token_table; + $this->oauth_state_table = $oauth_state_table; + } + + /** + * {@inheritdoc} + */ + public function retrieveAccessToken($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedToken instanceof TokenInterface) + { + return $this->cachedToken; + } + + $data = [ + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + ]; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $data['session_id'] = $this->user->data['session_id']; + } + + return $this->_retrieve_access_token($data); + } + + /** + * {@inheritdoc} + */ + public function storeAccessToken($service, TokenInterface $token) + { + $service = $this->get_service_name_for_db($service); + + $this->cachedToken = $token; + + $data = [ + 'oauth_token' => $this->json_encode_token($token), + ]; + + $sql = 'UPDATE ' . $this->oauth_token_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $data) . ' + WHERE user_id = ' . (int) $this->user->data['user_id'] . " + AND provider = '" . $this->db->sql_escape($service) . "'"; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + if (!$this->db->sql_affectedrows()) + { + $data = [ + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + 'oauth_token' => $this->json_encode_token($token), + 'session_id' => $this->user->data['session_id'], + ]; + + $sql = 'INSERT INTO ' . $this->oauth_token_table . $this->db->sql_build_array('INSERT', $data); + + $this->db->sql_query($sql); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function hasAccessToken($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedToken) + { + return true; + } + + $data = [ + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + ]; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $data['session_id'] = $this->user->data['session_id']; + } + + return $this->has_access_token($data); + } + + /** + * {@inheritdoc} + */ + public function clearToken($service) + { + $service = $this->get_service_name_for_db($service); + + $this->cachedToken = null; + + $sql = 'DELETE FROM ' . $this->oauth_token_table . ' + WHERE user_id = ' . (int) $this->user->data['user_id'] . " + AND provider = '" . $this->db->sql_escape($service) . "'"; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function clearAllTokens() + { + $this->cachedToken = null; + + $sql = 'DELETE FROM ' . $this->oauth_token_table . ' + WHERE user_id = ' . (int) $this->user->data['user_id']; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function storeAuthorizationState($service, $state) + { + $service = $this->get_service_name_for_db($service); + + $this->cachedState = $state; + + $data = [ + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + 'oauth_state' => $state, + 'session_id' => $this->user->data['session_id'], + ]; + + $sql = 'INSERT INTO ' . $this->oauth_state_table . ' ' . $this->db->sql_build_array('INSERT', $data); + $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function hasAuthorizationState($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return true; + } + + $data = [ + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + ]; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $data['session_id'] = $this->user->data['session_id']; + } + + return (bool) $this->get_state_row($data); + } + + /** + * {@inheritdoc} + */ + public function retrieveAuthorizationState($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return $this->cachedState; + } + + $data = [ + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + ]; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $data['session_id'] = $this->user->data['session_id']; + } + + return $this->get_state_row($data); + } + + /** + * {@inheritdoc} + */ + public function clearAuthorizationState($service) + { + $service = $this->get_service_name_for_db($service); + + $this->cachedState = null; + + $sql = 'DELETE FROM ' . $this->oauth_state_table . ' + WHERE user_id = ' . (int) $this->user->data['user_id'] . " + AND provider = '" . $this->db->sql_escape($service) . "'"; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function clearAllAuthorizationStates() + { + $this->cachedState = null; + + $sql = 'DELETE FROM ' . $this->oauth_state_table . ' + WHERE user_id = ' . (int) $this->user->data['user_id']; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + return $this; + } + + /** + * Updates the user_id field in the database associated with the token. + * + * @param int $user_id The user identifier + * @return void + */ + public function set_user_id($user_id) + { + if (!$this->cachedToken) + { + return; + } + + $data = [ + 'user_id' => (int) $user_id, + ]; + + $sql = 'UPDATE ' . $this->oauth_token_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $data) . ' + WHERE user_id = ' . (int) $this->user->data['user_id'] . " + AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + $this->db->sql_query($sql); + } + + /** + * Checks to see if an access token exists solely by the session_id of the user. + * + * @param string $service The OAuth service name + * @return bool true if the user's access token exists, + * false if the user's access token does not exist + */ + public function has_access_token_by_session($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedToken) + { + return true; + } + + $data = [ + 'session_id' => $this->user->data['session_id'], + 'provider' => $service, + ]; + + return $this->has_access_token($data); + } + + /** + * Checks to see if a state exists solely by the session_id of the user. + * + * @param string $service The OAuth service name + * @return bool true if the user's state exists, + * false if the user's state does not exist + */ + public function has_state_by_session($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return true; + } + + $data = [ + 'session_id' => $this->user->data['session_id'], + 'provider' => $service, + ]; + + return (bool) $this->get_state_row($data); + } + + /** + * A helper function that performs the query for has access token functions. + * + * @param array $data The SQL WHERE data + * @return bool true if the user's access token exists, + * false if the user's access token does not exist + */ + protected function has_access_token($data) + { + return (bool) $this->get_access_token_row($data); + } + + /** + * A helper function that performs the query for retrieving access token functions by session. + * Also checks if the token is a valid token. + * + * @param string $service The OAuth service provider name + * @return TokenInterface + * @throws TokenNotFoundException + */ + public function retrieve_access_token_by_session($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedToken instanceof TokenInterface) + { + return $this->cachedToken; + } + + $data = [ + 'session_id' => $this->user->data['session_id'], + 'provider' => $service, + ]; + + return $this->_retrieve_access_token($data); + } + + /** + * A helper function that performs the query for retrieving state functions by session. + * + * @param string $service The OAuth service provider name + * @return string The OAuth state + * @throws AuthorizationStateNotFoundException + */ + public function retrieve_state_by_session($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return $this->cachedState; + } + + $data = [ + 'session_id' => $this->user->data['session_id'], + 'provider' => $service, + ]; + + return $this->_retrieve_state($data); + } + + /** + * A helper function that performs the query for retrieve access token functions. + * Also checks if the token is a valid token. + * + * @param array $data The SQL WHERE data + * @return TokenInterface + * @throws TokenNotFoundException + */ + protected function _retrieve_access_token($data) + { + $row = $this->get_access_token_row($data); + + if (!$row) + { + throw new TokenNotFoundException('AUTH_PROVIDER_OAUTH_TOKEN_ERROR_NOT_STORED'); + } + + $token = $this->json_decode_token($row['oauth_token']); + + // Ensure that the token was serialized/unserialized correctly + if (!($token instanceof TokenInterface)) + { + $this->clearToken($data['provider']); + + throw new TokenNotFoundException('AUTH_PROVIDER_OAUTH_TOKEN_ERROR_INCORRECTLY_STORED'); + } + + $this->cachedToken = $token; + + return $token; + } + + /** + * A helper function that performs the query for retrieve state functions. + * + * @param array $data The SQL WHERE data + * @return string The OAuth state + * @throws AuthorizationStateNotFoundException + */ + protected function _retrieve_state($data) + { + $row = $this->get_state_row($data); + + if (!$row) + { + throw new AuthorizationStateNotFoundException(); + } + + $this->cachedState = $row['oauth_state']; + + return $this->cachedState; + } + + /** + * A helper function that performs the query for retrieving an access token. + * + * @param array $data The SQL WHERE data + * @return array|false array with the OAuth token row, + * false if the token does not exist + */ + protected function get_access_token_row($data) + { + $sql = 'SELECT oauth_token + FROM ' . $this->oauth_token_table . ' + WHERE ' . $this->db->sql_build_array('SELECT', $data); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + return $row; + } + + /** + * A helper function that performs the query for retrieving a state. + * + * @param array $data The SQL WHERE data + * @return array|false array with the OAuth state row, + * false if the state does not exist + */ + protected function get_state_row($data) + { + $sql = 'SELECT oauth_state + FROM ' . $this->oauth_state_table . ' + WHERE ' . $this->db->sql_build_array('SELECT', $data); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + return $row; + } + + /** + * A helper function that JSON encodes a TokenInterface's data. + * + * @param TokenInterface $token + * @return string The json encoded TokenInterface's data + */ + public function json_encode_token(TokenInterface $token) + { + $members = [ + 'accessToken' => $token->getAccessToken(), + 'endOfLife' => $token->getEndOfLife(), + 'extraParams' => $token->getExtraParams(), + 'refreshToken' => $token->getRefreshToken(), + + 'token_class' => get_class($token), + ]; + + // Handle additional data needed for OAuth1 tokens + if ($token instanceof StdOAuth1Token) + { + $members['requestToken'] = $token->getRequestToken(); + $members['requestTokenSecret'] = $token->getRequestTokenSecret(); + $members['accessTokenSecret'] = $token->getAccessTokenSecret(); + } + + return json_encode($members); + } + + /** + * A helper function that JSON decodes a data string and creates a TokenInterface. + * + * @param string $json The json encoded TokenInterface's data + * @return TokenInterface + * @throws TokenNotFoundException + */ + public function json_decode_token($json) + { + $token_data = json_decode($json, true); + + if ($token_data === null) + { + throw new TokenNotFoundException('AUTH_PROVIDER_OAUTH_TOKEN_ERROR_INCORRECTLY_STORED'); + } + + $token_class = $token_data['token_class']; + $access_token = $token_data['accessToken']; + $refresh_token = $token_data['refreshToken']; + $endOfLife = $token_data['endOfLife']; + $extra_params = $token_data['extraParams']; + + /** + * Create the token + * @var TokenInterface $token + */ + $token = new $token_class($access_token, $refresh_token, TokenInterface::EOL_NEVER_EXPIRES, $extra_params); + $token->setEndOfLife($endOfLife); + + // Handle OAuth 1.0 specific elements + if ($token instanceof StdOAuth1Token) + { + $token->setRequestToken($token_data['requestToken']); + $token->setRequestTokenSecret($token_data['requestTokenSecret']); + $token->setAccessTokenSecret($token_data['accessTokenSecret']); + } + + return $token; + } + + /** + * Returns the service name as it must be stored in the database. + * + * @param string $provider The OAuth provider name + * @return string The OAuth service name + */ + protected function get_service_name_for_db($provider) + { + // Enforce the naming convention for oauth services + if (strpos($provider, 'auth.provider.oauth.service.') !== 0) + { + $provider = 'auth.provider.oauth.service.' . strtolower($provider); + } + + return $provider; + } +} diff --git a/install/update/new/phpbb/auth/provider/provider_interface.php b/install/update/new/phpbb/auth/provider/provider_interface.php new file mode 100644 index 0000000..21c73a3 --- /dev/null +++ b/install/update/new/phpbb/auth/provider/provider_interface.php @@ -0,0 +1,198 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider; + +/** +* The interface authentication provider classes have to implement. +*/ +interface provider_interface +{ + /** + * Checks whether the user is currently identified to the authentication + * provider. + * Called in acp_board while setting authentication plugins. + * Changing to an authentication provider will not be permitted in acp_board + * if there is an error. + * + * @return boolean|string False if the user is identified, otherwise an + * error message, or null if not implemented. + */ + public function init(); + + /** + * Performs login. + * + * @param string $username The name of the user being authenticated. + * @param string $password The password of the user. + * @return array An associative array of the format: + * array( + * 'status' => status constant + * 'error_msg' => string + * 'user_row' => array + * ) + * A fourth key of the array may be present: + * 'redirect_data' This key is only used when 'status' is + * equal to LOGIN_SUCCESS_LINK_PROFILE and its value is an + * associative array that is turned into GET variables on + * the redirect url. + */ + public function login($username, $password); + + /** + * Autologin function + * + * @return array|null containing the user row, empty if no auto login + * should take place, or null if not implemented. + */ + public function autologin(); + + /** + * This function is used to output any required fields in the authentication + * admin panel. It also defines any required configuration table fields. + * + * @return array|null Returns null if not implemented or an array of the + * configuration fields of the provider. + */ + public function acp(); + + /** + * This function updates the template with variables related to the acp + * options with whatever configuration values are passed to it as an array. + * It then returns the name of the acp file related to this authentication + * provider. + * + * @param \phpbb\config\config $new_config Contains the new configuration values + * that have been set in acp_board. + * @return array|null Returns null if not implemented or an array with + * the template file name and an array of the vars + * that the template needs that must conform to the + * following example: + * array( + * 'TEMPLATE_FILE' => string, + * 'TEMPLATE_VARS' => array(...), + * ) + * An optional third element may be added to this + * array: 'BLOCK_VAR_NAME'. If this is present, + * then its value should be a string that is used + * to designate the name of the loop used in the + * ACP template file. When this is present, an + * additional key named 'BLOCK_VARS' is required. + * This must be an array containing at least one + * array of variables that will be assigned during + * the loop in the template. An example of this is + * presented below: + * array( + * 'BLOCK_VAR_NAME' => string, + * 'BLOCK_VARS' => array( + * 'KEY IS UNIMPORTANT' => array(...), + * ), + * 'TEMPLATE_FILE' => string, + * 'TEMPLATE_VARS' => array(...), + * ) + */ + public function get_acp_template($new_config); + + /** + * Returns an array of data necessary to build custom elements on the login + * form. + * + * @return array|null If this function is not implemented on an auth + * provider then it returns null. If it is implemented + * it will return an array of up to four elements of + * which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is + * present then 'BLOCK_VARS' must also be present in + * the array. The fourth element 'VARS' is also + * optional. The array, with all four elements present + * looks like the following: + * array( + * 'TEMPLATE_FILE' => string, + * 'BLOCK_VAR_NAME' => string, + * 'BLOCK_VARS' => array(...), + * 'VARS' => array(...), + * ) + */ + public function get_login_data(); + + /** + * Performs additional actions during logout. + * + * @param array $data An array corresponding to + * \phpbb\session::data + * @param boolean $new_session True for a new session, false for no new + * session. + */ + public function logout($data, $new_session); + + /** + * The session validation function checks whether the user is still logged + * into phpBB. + * + * @param array $user + * @return boolean true if the given user is authenticated, false if the + * session should be closed, or null if not implemented. + */ + public function validate_session($user); + + /** + * Checks to see if $login_link_data contains all information except for the + * user_id of an account needed to successfully link an external account to + * a forum account. + * + * @param array $login_link_data Any data needed to link a phpBB account to + * an external account. + * @return string|null Returns a string with a language constant if there + * is data missing or null if there is no error. + */ + public function login_link_has_necessary_data($login_link_data); + + /** + * Links an external account to a phpBB account. + * + * @param array $link_data Any data needed to link a phpBB account to + * an external account. + */ + public function link_account(array $link_data); + + /** + * Returns an array of data necessary to build the ucp_auth_link page + * + * @param int $user_id User ID for whom the data should be retrieved. + * defaults to 0, which is not a valid ID. The method + * should fall back to the current user's ID in this + * case. + * @return array|null If this function is not implemented on an auth + * provider then it returns null. If it is implemented + * it will return an array of up to four elements of + * which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is + * present then 'BLOCK_VARS' must also be present in + * the array. The fourth element 'VARS' is also + * optional. The array, with all four elements present + * looks like the following: + * array( + * 'TEMPLATE_FILE' => string, + * 'BLOCK_VAR_NAME' => string, + * 'BLOCK_VARS' => array(...), + * 'VARS' => array(...), + * ) + */ + public function get_auth_link_data($user_id = 0); + + /** + * Unlinks an external account from a phpBB account. + * + * @param array $link_data Any data needed to unlink a phpBB account + * from a phpbb account. + */ + public function unlink_account(array $link_data); +} diff --git a/install/update/new/phpbb/avatar/driver/remote.php b/install/update/new/phpbb/avatar/driver/remote.php new file mode 100644 index 0000000..b16549f --- /dev/null +++ b/install/update/new/phpbb/avatar/driver/remote.php @@ -0,0 +1,236 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\avatar\driver; + +/** +* Handles avatars hosted remotely +*/ +class remote extends \phpbb\avatar\driver\driver +{ + /** + * {@inheritdoc} + */ + public function get_data($row) + { + return array( + 'src' => $row['avatar'], + 'width' => $row['avatar_width'], + 'height' => $row['avatar_height'], + ); + } + + /** + * {@inheritdoc} + */ + public function prepare_form($request, $template, $user, $row, &$error) + { + $template->assign_vars(array( + 'AVATAR_REMOTE_WIDTH' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar_width']) ? $row['avatar_width'] : $request->variable('avatar_remote_width', ''), + 'AVATAR_REMOTE_HEIGHT' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar_height']) ? $row['avatar_height'] : $request->variable('avatar_remote_width', ''), + 'AVATAR_REMOTE_URL' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar']) ? $row['avatar'] : '', + )); + + return true; + } + + /** + * {@inheritdoc} + */ + public function process_form($request, $template, $user, $row, &$error) + { + global $phpbb_dispatcher; + + $url = $request->variable('avatar_remote_url', ''); + $width = $request->variable('avatar_remote_width', 0); + $height = $request->variable('avatar_remote_height', 0); + + if (empty($url)) + { + return false; + } + + if (!preg_match('#^(http|https|ftp)://#i', $url)) + { + $url = 'http://' . $url; + } + + if (!function_exists('validate_data')) + { + require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $validate_array = validate_data( + array( + 'url' => $url, + ), + array( + 'url' => array('string', true, 5, 255), + ) + ); + + $error = array_merge($error, $validate_array); + + if (!empty($error)) + { + return false; + } + + /** + * Event to make custom validation of avatar upload + * + * @event core.ucp_profile_avatar_upload_validation + * @var string url Image url + * @var string width Image width + * @var string height Image height + * @var array error Error message array + * @since 3.2.9-RC1 + */ + $vars = array('url', 'width', 'height', 'error'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_avatar_upload_validation', compact($vars))); + + if (!empty($error)) + { + return false; + } + + // Check if this url looks alright + // Do not allow specifying the port (see RFC 3986) or IP addresses + if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.('. implode('|', $this->allowed_extensions) . ')$#i', $url) || + preg_match('@^(http|https|ftp)://[^/:?#]+:[0-9]+[/:?#]@i', $url) || + preg_match('#^(http|https|ftp)://(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])#i', $url) || + preg_match('#^(http|https|ftp)://(?:(?:(?:[\dA-F]{1,4}:){6}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:::(?:[\dA-F]{1,4}:){0,5}(?:[\dA-F]{1,4}(?::[\dA-F]{1,4})?|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:):(?:[\dA-F]{1,4}:){4}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,2}:(?:[\dA-F]{1,4}:){3}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,3}:(?:[\dA-F]{1,4}:){2}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,4}:(?:[\dA-F]{1,4}:)(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,5}:(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,6}:[\dA-F]{1,4})|(?:(?:[\dA-F]{1,4}:){1,7}:)|(?:::))#i', $url)) + { + $error[] = 'AVATAR_URL_INVALID'; + return false; + } + + // Get image dimensions + if (($width <= 0 || $height <= 0) && (($image_data = $this->imagesize->getImageSize($url)) === false)) + { + $error[] = 'UNABLE_GET_IMAGE_SIZE'; + return false; + } + + if (!empty($image_data) && ($image_data['width'] <= 0 || $image_data['height'] <= 0)) + { + $error[] = 'AVATAR_NO_SIZE'; + return false; + } + + $width = ($width && $height) ? $width : $image_data['width']; + $height = ($width && $height) ? $height : $image_data['height']; + + if ($width <= 0 || $height <= 0) + { + $error[] = 'AVATAR_NO_SIZE'; + return false; + } + + $types = \phpbb\files\upload::image_types(); + $extension = strtolower(\phpbb\files\filespec::get_extension($url)); + + // Check if this is actually an image + if ($file_stream = @fopen($url, 'r')) + { + // Timeout after 1 second + stream_set_timeout($file_stream, 1); + // read some data to ensure headers are present + fread($file_stream, 1024); + $meta = stream_get_meta_data($file_stream); + + if (isset($meta['wrapper_data']['headers']) && is_array($meta['wrapper_data']['headers'])) + { + $headers = $meta['wrapper_data']['headers']; + } + else if (isset($meta['wrapper_data']) && is_array($meta['wrapper_data'])) + { + $headers = $meta['wrapper_data']; + } + else + { + $headers = array(); + } + + foreach ($headers as $header) + { + $header = preg_split('/ /', $header, 2); + if (strtr(strtolower(trim($header[0], ':')), '_', '-') === 'content-type') + { + if (strpos($header[1], 'image/') !== 0) + { + $error[] = 'AVATAR_URL_INVALID'; + fclose($file_stream); + return false; + } + else + { + fclose($file_stream); + break; + } + } + } + } + else + { + $error[] = 'AVATAR_URL_INVALID'; + return false; + } + + if (!empty($image_data) && (!isset($types[$image_data['type']]) || !in_array($extension, $types[$image_data['type']]))) + { + if (!isset($types[$image_data['type']])) + { + $error[] = 'UNABLE_GET_IMAGE_SIZE'; + } + else + { + $error[] = array('IMAGE_FILETYPE_MISMATCH', $types[$image_data['type']][0], $extension); + } + + return false; + } + + if ($this->config['avatar_max_width'] || $this->config['avatar_max_height']) + { + if ($width > $this->config['avatar_max_width'] || $height > $this->config['avatar_max_height']) + { + $error[] = array('AVATAR_WRONG_SIZE', $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], $width, $height); + return false; + } + } + + if ($this->config['avatar_min_width'] || $this->config['avatar_min_height']) + { + if ($width < $this->config['avatar_min_width'] || $height < $this->config['avatar_min_height']) + { + $error[] = array('AVATAR_WRONG_SIZE', $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], $width, $height); + return false; + } + } + + return array( + 'avatar' => $url, + 'avatar_width' => $width, + 'avatar_height' => $height, + ); + } + + /** + * {@inheritdoc} + */ + public function get_template_name() + { + return 'ucp_avatar_options_remote.html'; + } +} diff --git a/install/update/new/phpbb/avatar/driver/upload.php b/install/update/new/phpbb/avatar/driver/upload.php new file mode 100644 index 0000000..a5b704b --- /dev/null +++ b/install/update/new/phpbb/avatar/driver/upload.php @@ -0,0 +1,332 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\avatar\driver; + +/** +* Handles avatars uploaded to the board +*/ +class upload extends \phpbb\avatar\driver\driver +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \phpbb\files\factory + */ + protected $files_factory; + + /** + * Construct a driver object + * + * @param \phpbb\config\config $config phpBB configuration + * @param string $phpbb_root_path Path to the phpBB root + * @param string $php_ext PHP file extension + * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem helper + * @param \phpbb\path_helper $path_helper phpBB path helper + * @param \phpbb\event\dispatcher_interface $dispatcher phpBB Event dispatcher object + * @param \phpbb\files\factory $files_factory File classes factory + * @param \phpbb\cache\driver\driver_interface $cache Cache driver + */ + public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\filesystem\filesystem_interface $filesystem, \phpbb\path_helper $path_helper, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\files\factory $files_factory, \phpbb\cache\driver\driver_interface $cache = null) + { + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->filesystem = $filesystem; + $this->path_helper = $path_helper; + $this->dispatcher = $dispatcher; + $this->files_factory = $files_factory; + $this->cache = $cache; + } + + /** + * {@inheritdoc} + */ + public function get_data($row) + { + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $this->path_helper->get_web_root_path(); + + return array( + 'src' => $root_path . 'download/file.' . $this->php_ext . '?avatar=' . $row['avatar'], + 'width' => $row['avatar_width'], + 'height' => $row['avatar_height'], + ); + } + + /** + * {@inheritdoc} + */ + public function prepare_form($request, $template, $user, $row, &$error) + { + if (!$this->can_upload()) + { + return false; + } + + $template->assign_vars(array( + 'S_UPLOAD_AVATAR_URL' => ($this->config['allow_avatar_remote_upload']) ? true : false, + 'AVATAR_UPLOAD_SIZE' => $this->config['avatar_filesize'], + 'AVATAR_ALLOWED_EXTENSIONS' => implode(',', preg_replace('/^/', '.', $this->allowed_extensions)), + )); + + return true; + } + + /** + * {@inheritdoc} + */ + public function process_form($request, $template, $user, $row, &$error) + { + if (!$this->can_upload()) + { + return false; + } + + /** @var \phpbb\files\upload $upload */ + $upload = $this->files_factory->get('upload') + ->set_error_prefix('AVATAR_') + ->set_allowed_extensions($this->allowed_extensions) + ->set_max_filesize($this->config['avatar_filesize']) + ->set_allowed_dimensions( + $this->config['avatar_min_width'], + $this->config['avatar_min_height'], + $this->config['avatar_max_width'], + $this->config['avatar_max_height']) + ->set_disallowed_content((isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false)); + + $url = $request->variable('avatar_upload_url', ''); + $upload_file = $request->file('avatar_upload_file'); + + if (!empty($upload_file['name'])) + { + $file = $upload->handle_upload('files.types.form', 'avatar_upload_file'); + } + else if (!empty($this->config['allow_avatar_remote_upload']) && !empty($url)) + { + if (!preg_match('#^(http|https|ftp)://#i', $url)) + { + $url = 'http://' . $url; + } + + if (!function_exists('validate_data')) + { + require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $validate_array = validate_data( + array( + 'url' => $url, + ), + array( + 'url' => array('string', true, 5, 255), + ) + ); + + $error = array_merge($error, $validate_array); + + if (!empty($error)) + { + return false; + } + + // Do not allow specifying the port (see RFC 3986) or IP addresses + // remote_upload() will do its own check for allowed filetypes + if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.('. implode('|', $this->allowed_extensions) . ')$#i', $url) || + preg_match('@^(http|https|ftp)://[^/:?#]+:[0-9]+[/:?#]@i', $url) || + preg_match('#^(http|https|ftp)://(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])#i', $url) || + preg_match('#^(http|https|ftp)://(?:(?:(?:[\dA-F]{1,4}:){6}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:::(?:[\dA-F]{1,4}:){0,5}(?:[\dA-F]{1,4}(?::[\dA-F]{1,4})?|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:):(?:[\dA-F]{1,4}:){4}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,2}:(?:[\dA-F]{1,4}:){3}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,3}:(?:[\dA-F]{1,4}:){2}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,4}:(?:[\dA-F]{1,4}:)(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,5}:(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,6}:[\dA-F]{1,4})|(?:(?:[\dA-F]{1,4}:){1,7}:)|(?:::))#i', $url)) + { + $error[] = 'AVATAR_URL_INVALID'; + return false; + } + + $file = $upload->handle_upload('files.types.remote', $url); + } + else + { + return false; + } + + $prefix = $this->config['avatar_salt'] . '_'; + $file->clean_filename('avatar', $prefix, $row['id']); + + // If there was an error during upload, then abort operation + if (count($file->error)) + { + $file->remove(); + $error = $file->error; + return false; + } + + // Calculate new destination + $destination = $this->config['avatar_path']; + + // Adjust destination path (no trailing slash) + if (substr($destination, -1, 1) == '/' || substr($destination, -1, 1) == '\\') + { + $destination = substr($destination, 0, -1); + } + + $destination = str_replace(array('../', '..\\', './', '.\\'), '', $destination); + if ($destination && ($destination[0] == '/' || $destination[0] == "\\")) + { + $destination = ''; + } + + $filedata = array( + 'filename' => $file->get('filename'), + 'filesize' => $file->get('filesize'), + 'mimetype' => $file->get('mimetype'), + 'extension' => $file->get('extension'), + 'physical_filename' => $file->get('realname'), + 'real_filename' => $file->get('uploadname'), + ); + + /** + * Before moving new file in place (and eventually overwriting the existing avatar with the newly uploaded avatar) + * + * @event core.avatar_driver_upload_move_file_before + * @var array filedata Array containing uploaded file data + * @var \phpbb\files\filespec file Instance of filespec class + * @var string destination Destination directory where the file is going to be moved + * @var string prefix Prefix for the avatar filename + * @var array row Array with avatar row data + * @var array error Array of errors, if filled in by this event file will not be moved + * @since 3.1.6-RC1 + * @changed 3.1.9-RC1 Added filedata + * @changed 3.2.3-RC1 Added file + */ + $vars = array( + 'filedata', + 'file', + 'destination', + 'prefix', + 'row', + 'error', + ); + extract($this->dispatcher->trigger_event('core.avatar_driver_upload_move_file_before', compact($vars))); + + unset($filedata); + + if (!count($error)) + { + // Move file and overwrite any existing image + $file->move_file($destination, true); + } + + // If there was an error during move, then clean up leftovers + $error = array_merge($error, $file->error); + if (count($error)) + { + $file->remove(); + return false; + } + + // Delete current avatar if not overwritten + $ext = substr(strrchr($row['avatar'], '.'), 1); + if ($ext && $ext !== $file->get('extension')) + { + $this->delete($row); + } + + return array( + 'avatar' => $row['id'] . '_' . time() . '.' . $file->get('extension'), + 'avatar_width' => $file->get('width'), + 'avatar_height' => $file->get('height'), + ); + } + + /** + * {@inheritdoc} + */ + public function prepare_form_acp($user) + { + return array( + 'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), + 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), + ); + } + + /** + * {@inheritdoc} + */ + public function delete($row) + { + + $error = array(); + $destination = $this->config['avatar_path']; + $prefix = $this->config['avatar_salt'] . '_'; + $ext = substr(strrchr($row['avatar'], '.'), 1); + $filename = $this->phpbb_root_path . $destination . '/' . $prefix . $row['id'] . '.' . $ext; + + /** + * Before deleting an existing avatar + * + * @event core.avatar_driver_upload_delete_before + * @var string destination Destination directory where the file is going to be deleted + * @var string prefix Prefix for the avatar filename + * @var array row Array with avatar row data + * @var array error Array of errors, if filled in by this event file will not be deleted + * @since 3.1.6-RC1 + */ + $vars = array( + 'destination', + 'prefix', + 'row', + 'error', + ); + extract($this->dispatcher->trigger_event('core.avatar_driver_upload_delete_before', compact($vars))); + + if (!count($error) && $this->filesystem->exists($filename)) + { + try + { + $this->filesystem->remove($filename); + return true; + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Fail is covered by return statement below + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function get_template_name() + { + return 'ucp_avatar_options_upload.html'; + } + + /** + * Check if user is able to upload an avatar + * + * @return bool True if user can upload, false if not + */ + protected function can_upload() + { + return ($this->filesystem->exists($this->phpbb_root_path . $this->config['avatar_path']) && $this->filesystem->is_writable($this->phpbb_root_path . $this->config['avatar_path']) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')); + } +} diff --git a/install/update/new/phpbb/cache/driver/memcached.php b/install/update/new/phpbb/cache/driver/memcached.php new file mode 100644 index 0000000..fbb587a --- /dev/null +++ b/install/update/new/phpbb/cache/driver/memcached.php @@ -0,0 +1,148 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\cache\driver; + +if (!defined('PHPBB_ACM_MEMCACHED_PORT')) +{ + define('PHPBB_ACM_MEMCACHED_PORT', 11211); +} + +if (!defined('PHPBB_ACM_MEMCACHED_COMPRESS')) +{ + define('PHPBB_ACM_MEMCACHED_COMPRESS', true); +} + +if (!defined('PHPBB_ACM_MEMCACHED_HOST')) +{ + define('PHPBB_ACM_MEMCACHED_HOST', 'localhost'); +} + +if (!defined('PHPBB_ACM_MEMCACHED')) +{ + //can define multiple servers with host1/port1,host2/port2 format + define('PHPBB_ACM_MEMCACHED', PHPBB_ACM_MEMCACHED_HOST . '/' . PHPBB_ACM_MEMCACHED_PORT); +} + +/** +* ACM for Memcached +*/ +class memcached extends \phpbb\cache\driver\memory +{ + /** @var string Extension to use */ + protected $extension = 'memcached'; + + /** @var \Memcached Memcached class */ + protected $memcached; + + /** @var int Flags */ + protected $flags = 0; + + /** + * Memcached constructor + * + * @param string $memcached_servers Memcached servers string (optional) + */ + public function __construct($memcached_servers = '') + { + // Call the parent constructor + parent::__construct(); + + $memcached_servers = $memcached_servers ?: PHPBB_ACM_MEMCACHED; + + $this->memcached = new \Memcached(); + $this->memcached->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); + // Memcached defaults to using compression, disable if we don't want + // to use it + if (!PHPBB_ACM_MEMCACHED_COMPRESS) + { + $this->memcached->setOption(\Memcached::OPT_COMPRESSION, false); + } + + $server_list = []; + foreach (explode(',', $memcached_servers) as $u) + { + if (preg_match('#(.*)/(\d+)#', $u, $parts)) + { + $server_list[] = [trim($parts[1]), (int) trim($parts[2])]; + } + } + + $this->memcached->addServers($server_list); + + if (empty($server_list) || empty($this->memcached->getStats())) + { + trigger_error('Could not connect to memcached server(s).'); + } + } + + /** + * {@inheritDoc} + */ + public function unload() + { + parent::unload(); + + unset($this->memcached); + } + + /** + * {@inheritDoc} + */ + public function purge() + { + $this->memcached->flush(); + + parent::purge(); + } + + /** + * Fetch an item from the cache + * + * @param string $var Cache key + * + * @return mixed Cached data + */ + protected function _read($var) + { + return $this->memcached->get($this->key_prefix . $var); + } + + /** + * Store data in the cache + * + * @param string $var Cache key + * @param mixed $data Data to store + * @param int $ttl Time-to-live of cached data + * @return bool True if the operation succeeded + */ + protected function _write($var, $data, $ttl = 2592000) + { + if (!$this->memcached->replace($this->key_prefix . $var, $data, $ttl)) + { + return $this->memcached->set($this->key_prefix . $var, $data, $ttl); + } + return true; + } + + /** + * Remove an item from the cache + * + * @param string $var Cache key + * @return bool True if the operation succeeded + */ + protected function _delete($var) + { + return $this->memcached->delete($this->key_prefix . $var); + } +} diff --git a/install/update/new/phpbb/cache/driver/memory.php b/install/update/new/phpbb/cache/driver/memory.php new file mode 100644 index 0000000..956936b --- /dev/null +++ b/install/update/new/phpbb/cache/driver/memory.php @@ -0,0 +1,282 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\cache\driver; + +/** +* ACM Abstract Memory Class +*/ +abstract class memory extends \phpbb\cache\driver\base +{ + var $key_prefix; + + /** + * Set cache path + */ + function __construct() + { + global $dbname, $table_prefix, $phpbb_container; + + $this->cache_dir = $phpbb_container->getParameter('core.cache_dir'); + $this->key_prefix = substr(md5($dbname . $table_prefix), 0, 8) . '_'; + + if (!isset($this->extension) || !extension_loaded($this->extension)) + { + global $acm_type; + + trigger_error("Could not find required extension [{$this->extension}] for the ACM module $acm_type.", E_USER_ERROR); + } + + if (isset($this->function) && !function_exists($this->function)) + { + global $acm_type; + + trigger_error("The required function [{$this->function}] is not available for the ACM module $acm_type.", E_USER_ERROR); + } + } + + /** + * {@inheritDoc} + */ + function load() + { + // grab the global cache + $data = $this->_read('global'); + + if ($data !== false) + { + $this->vars = $data; + return true; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function save() + { + if (!$this->is_modified) + { + return; + } + + $this->_write('global', $this->vars, 2592000); + + $this->is_modified = false; + } + + /** + * {@inheritDoc} + */ + function tidy() + { + global $config; + + // cache has auto GC, no need to have any code here :) + $config->set('cache_last_gc', time(), false); + } + + /** + * {@inheritDoc} + */ + function get($var_name) + { + if ($var_name[0] == '_') + { + if (!$this->_exists($var_name)) + { + return false; + } + + return $this->_read($var_name); + } + else + { + return ($this->_exists($var_name)) ? $this->vars[$var_name] : false; + } + } + + /** + * {@inheritDoc} + */ + function put($var_name, $var, $ttl = 2592000) + { + if ($var_name[0] == '_') + { + $this->_write($var_name, $var, $ttl); + } + else + { + $this->vars[$var_name] = $var; + $this->is_modified = true; + } + } + + /** + * {@inheritDoc} + */ + function destroy($var_name, $table = '') + { + if ($var_name == 'sql' && !empty($table)) + { + if (!is_array($table)) + { + $table = array($table); + } + + foreach ($table as $table_name) + { + // gives us the md5s that we want + $temp = $this->_read('sql_' . $table_name); + + if ($temp === false) + { + continue; + } + + // delete each query ref + foreach ($temp as $md5_id => $void) + { + $this->_delete('sql_' . $md5_id); + } + + // delete the table ref + $this->_delete('sql_' . $table_name); + } + + return; + } + + if (!$this->_exists($var_name)) + { + return; + } + + if ($var_name[0] == '_') + { + $this->_delete($var_name); + } + else if (isset($this->vars[$var_name])) + { + $this->is_modified = true; + unset($this->vars[$var_name]); + + // We save here to let the following cache hits succeed + $this->save(); + } + } + + /** + * {@inheritDoc} + */ + function _exists($var_name) + { + if ($var_name[0] == '_') + { + return $this->_isset($var_name); + } + else + { + if (!count($this->vars)) + { + $this->load(); + } + + return isset($this->vars[$var_name]); + } + } + + /** + * {@inheritDoc} + */ + function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl) + { + // Remove extra spaces and tabs + $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); + $query_id = md5($query); + + // determine which tables this query belongs to + // Some queries use backticks, namely the get_database_size() query + // don't check for conformity, the SQL would error and not reach here. + if (!preg_match_all('/(?:FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?)|(?:JOIN (`?\\w+`?(?: \\w+)?))/', $query, $regs, PREG_SET_ORDER)) + { + // Bail out if the match fails. + return $query_result; + } + + $tables = array(); + foreach ($regs as $match) + { + if ($match[0][0] == 'F') + { + $tables = array_merge($tables, array_map('trim', explode(',', $match[1]))); + } + else + { + $tables[] = $match[2]; + } + } + + foreach ($tables as $table_name) + { + // Remove backticks + $table_name = ($table_name[0] == '`') ? substr($table_name, 1, -1) : $table_name; + + if (($pos = strpos($table_name, ' ')) !== false) + { + $table_name = substr($table_name, 0, $pos); + } + + $temp = $this->_read('sql_' . $table_name); + + if ($temp === false) + { + $temp = array(); + } + + $temp[$query_id] = true; + + // This must never expire + $this->_write('sql_' . $table_name, $temp, 0); + } + + // store them in the right place + $this->sql_rowset[$query_id] = array(); + $this->sql_row_pointer[$query_id] = 0; + + while ($row = $db->sql_fetchrow($query_result)) + { + $this->sql_rowset[$query_id][] = $row; + } + $db->sql_freeresult($query_result); + + $this->_write('sql_' . $query_id, $this->sql_rowset[$query_id], $ttl); + + return $query_id; + } + + /** + * Check if a cache var exists + * + * @access protected + * @param string $var Cache key + * @return bool True if it exists, otherwise false + */ + function _isset($var) + { + // Most caches don't need to check + return true; + } +} diff --git a/install/update/new/phpbb/captcha/non_gd.php b/install/update/new/phpbb/captcha/non_gd.php new file mode 100644 index 0000000..8105187 --- /dev/null +++ b/install/update/new/phpbb/captcha/non_gd.php @@ -0,0 +1,386 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha; + +/** +* Main non-gd captcha class +* @ignore +*/ +class non_gd +{ + var $filtered_pngs; + var $width = 320; + var $height = 50; + + /** + * Define filtered pngs on init + */ + function __construct() + { + // If we can we will generate a single filtered png, we avoid nastiness via emulation of some Zlib stuff + $this->define_filtered_pngs(); + } + + /** + * Create the image containing $code with a seed of $seed + */ + function execute($code, $seed) + { + $img_height = $this->height - 10; + $img_width = 0; + + mt_srand($seed); + + $char_widths = $hold_chars = array(); + $code_len = strlen($code); + + for ($i = 0; $i < $code_len; $i++) + { + $char = $code[$i]; + + $width = mt_rand(0, 4); + $raw_width = $this->filtered_pngs[$char]['width']; + $char_widths[$i] = $width; + $img_width += $raw_width - $width; + + // Split the char into chunks of $raw_width + 1 length + if (empty($hold_chars[$char])) + { + $hold_chars[$char] = str_split(base64_decode($this->filtered_pngs[$char]['data']), $raw_width + 1); + } + } + + $offset_x = mt_rand(0, $this->width - $img_width); + $offset_y = mt_rand(0, $this->height - $img_height); + + $image = ''; + for ($i = 0; $i < $this->height; $i++) + { + $image .= chr(0); + + if ($i > $offset_y && $i < $offset_y + $img_height) + { + for ($j = 0; $j < $offset_x; $j++) + { + $image .= chr(mt_rand(140, 255)); + } + + for ($j = 0; $j < $code_len; $j++) + { + $image .= $this->randomise(substr($hold_chars[$code[$j]][$i - $offset_y - 1], 1), $char_widths[$j]); + } + + for ($j = $offset_x + $img_width; $j < $this->width; $j++) + { + $image .= chr(mt_rand(140, 255)); + } + } + else + { + for ($j = 0; $j < $this->width; $j++) + { + $image .= chr(mt_rand(140, 255)); + } + } + } + unset($hold_chars); + + $image = $this->create_png($image, $this->width, $this->height); + + // Output image + header('Content-Type: image/png'); + header('Cache-control: no-cache, no-store'); + echo $image; + exit; + } + + /** + * This is designed to randomise the pixels of the image data within + * certain limits so as to keep it readable. It also varies the image + * width a little + */ + function randomise($scanline, $width) + { + $new_line = ''; + + $end = strlen($scanline) - ceil($width/2); + for ($i = (int) floor($width / 2); $i < $end; $i++) + { + $pixel = ord($scanline[$i]); + + if ($pixel < 190) + { + $new_line .= chr(mt_rand(0, 205)); + } + else if ($pixel > 190) + { + $new_line .= chr(mt_rand(145, 255)); + } + else + { + $new_line .= $scanline[$i]; + } + } + + return $new_line; + } + + /** + * This creates a chunk of the given type, with the given data + * of the given length adding the relevant crc + */ + function png_chunk($length, $type, $data) + { + $raw = $type . $data; + + return pack('N', $length) . $raw . pack('N', crc32($raw)); + } + + /** + * Creates greyscale 8bit png - The PNG spec can be found at + * http://www.libpng.org/pub/png/spec/PNG-Contents.html we use + * png because it's a fully recognised open standard and supported + * by practically all modern browsers and OSs + */ + function create_png($raw_image, $width, $height) + { + // SIG + $image = pack('C8', 137, 80, 78, 71, 13, 10, 26, 10); + + // IHDR + $raw = pack('N2', $width, $height); + $raw .= pack('C5', 8, 0, 0, 0, 0); + $image .= $this->png_chunk(13, 'IHDR', $raw); + + // IDAT + if (@extension_loaded('zlib')) + { + $raw_image = gzcompress($raw_image); + $length = strlen($raw_image); + } + else + { + // The total length of this image, uncompressed, is just a calculation of pixels + $length = ($width + 1) * $height; + + // Adler-32 hash generation + // Note: The hash is _backwards_ so we must reverse it + + if (@extension_loaded('hash')) + { + $adler_hash = strrev(hash('adler32', $raw_image, true)); + } + else if (@extension_loaded('mhash')) + { + $adler_hash = strrev(mhash(MHASH_ADLER32, $raw_image)); + } + else + { + // Optimized Adler-32 loop ported from the GNU Classpath project + $temp_length = $length; + $s1 = 1; + $s2 = $index = 0; + + while ($temp_length > 0) + { + // We can defer the modulo operation: + // s1 maximally grows from 65521 to 65521 + 255 * 3800 + // s2 maximally grows by 3800 * median(s1) = 2090079800 < 2^31 + $substract_value = ($temp_length < 3800) ? $temp_length : 3800; + $temp_length -= $substract_value; + + while (--$substract_value >= 0) + { + $s1 += ord($raw_image[$index]); + $s2 += $s1; + + $index++; + } + + $s1 %= 65521; + $s2 %= 65521; + } + $adler_hash = pack('N', ($s2 << 16) | $s1); + } + + // This is the same thing as gzcompress($raw_image, 0) but does not need zlib + $raw_image = pack('C3v2', 0x78, 0x01, 0x01, $length, ~$length) . $raw_image . $adler_hash; + + // The Zlib header + Adler hash make us add on 11 + $length += 11; + } + + // IDAT + $image .= $this->png_chunk($length, 'IDAT', $raw_image); + + // IEND + $image .= $this->png_chunk(0, 'IEND', ''); + + return $image; + } + + /** + * png image data + * Each 'data' element is base64_encoded uncompressed IDAT + */ + function define_filtered_pngs() + { + $this->filtered_pngs = array( + '0' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A///////////////////olFAkBAAAGDyA4P///M31/////////////wD////////////////0dAgAAAAAAAAAAAAEcPipFGHn////////////AP//////////////6DAAAAAAAAAAAAAAAAAALSEAN+T///////////8A//////////////xAAAAAAAAAAAAAAAAAAAAAACPA/////////////wD/////////////oAAAAAAAAAAAAAAAAAAAAAAAev//////////////AP////////////8oAAAAAAAAPNj/zDAAAAAAAABD//////////////8A////////////1AAAAAAAABjw////5BAAAAAAAADo/////////////wD///////////+QAAAAAAAAbP//////QgAAAAAAAKj/////////////AP///////////1wAAAAAAACs/////8AXAAAAAAAAcP////////////8A////////////OAAAAAAAAND////dNwAAAAAAAABI/////////////wD///////////8gAAAAAAAA4P//7koACwAAAAAAACT/////////////AP///////////wgAAAAAAAD///VqAwaPAAAAAAAAEP////////////8A////////////AAAAAAAAAP/8kQYDavUAAAAAAAAA/////////////wD///////////8AAAAAAAAA/6kNAEru/wAAAAAAAAD/////////////AP///////////wAAAAAAAADAIwA33f//AAAAAAAAAP////////////8A////////////FAAAAAAAADYAI8D///8AAAAAAAAQ/////////////wD///////////8kAAAAAAAAAA2p////5AAAAAAAACD/////////////AP///////////0gAAAAAAAAFkfz////UAAAAAAAAQP////////////8A////////////cAAAAAAAAET1/////7AAAAAAAABo/////////////wD///////////+oAAAAAAAAXfX/////sAAAAAAAAGj/////////////AAAAALgAAAAAAAAwAAAAAAAAAAAAAAD////////////oAAAAAAAACOT////oEAAAAAAAAOD/////////////AP////////////8+AAAAAAAAKMz/zDQAAAAAAAA0//////////////8A////////////7jgAAAAAAAAAAAAAAAAAAAAAAKT//////////////wD///////////VqAwIAAAAAAAAAAAAAAAAAAAA8////////////////AP//////////rQcDaVEAAAAAAAAAAAAAAAAAKOj///////////////8A///////////nblnu/IAIAAAAAAAAAAAAAFzw/////////////////wD////////////79////+iITCAAAAAgSITg////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////w==', + 'width' => 40 + ), + '1' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////8BAAAAAAAP//////////////////AP////////////////////////9sAAAAAAAA//////////////////8A////////////////////////pAAAAAAAAAD//////////////////wD//////////////////////6wEAAAAAAAAAP//////////////////AP////////////////////h4AAAAAAAAAAAA//////////////////8A//////////////////ygJAAAAAAAAAAAAAD//////////////////wD//////////////9x8HAAAAAAAAAAAAAAAAP//////////////////AP//////////////AAAAAAAAAAAAAAAAAAAA//////////////////8A//////////////8AAAAAAAAAAAAAAAAAAAD//////////////////wD//////////////wAAAAAAAAR4AAAAAAAAAP//////////////////AP//////////////AAAAAAA4zP8AAAAAAAAA//////////////////8A//////////////8AAAA4sP///wAAAAAAAAD//////////////////wD//////////////yR80P//////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '2' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP/////////////////okFAkCAAABCBIfNT///////////////////8A///////////////8hAgAAAAAAAAAAAAAAFTo/////////////////wD//////////////1QAAAAAAAAAAAAAAAAAACjo////////////////AP////////////+MAAAAAAAAAAAAAAAAAAAAADj///////////////8A////////////9BAAAAAAAAAAAAAAAAAAAAAAALD//////////////wD///////////+gAAAAAAAAAHjs+KwMAAAAAAAAVP//////////////AP///////////1gAAAAAAABM/////6QAAAAAAAAU//////////////8A////////////KAAAAAAAALj/////+AAAAAAAAAD//////////////wD///////////+MfGBMOCAI8P/////wAAAAAAAACP//////////////AP///////////////////////////5wAAAAAAAAw//////////////8A///////////////////////////oFAAAAAAAAHz//////////////wD/////////////////////////6CgAAAAAAAAE3P//////////////AP///////////////////////9ggAAAAAAAAAHT///////////////8A//////////////////////+0DAAAAAAAAAA8+P///////////////wD/////////////////////gAAAAAAAAAAAKOj/////////////////AP//////////////////9FAAAAAAAAAAADzw//////////////////8A/////////////////+g4AAAAAAAAAABk/P///////////////////wD////////////////oKAAAAAAAAAAMqP//////////////////////AP//////////////6CgAAAAAAAAAMNz///////////////////////8A//////////////g4AAAAAAAAAFT0/////////////////////////wD/////////////bAAAAAAAAABU/P//////////////////////////AP///////////8wAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A////////////SAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////9wAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////hAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////9AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////xAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '3' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD////////////////8sGg0FAAAACA4cLz8////////////////////AP//////////////rBgAAAAAAAAAAAAAACTA//////////////////8A/////////////3QAAAAAAAAAAAAAAAAAAASs/////////////////wD///////////+YAAAAAAAAAAAAAAAAAAAAAAjc////////////////AP//////////6AwAAAAAAAAAAAAAAAAAAAAAAGT///////////////8A//////////94AAAAAAAABJDw/8g4AAAAAAAAHP///////////////wD//////////yAAAAAAAACE/////9gAAAAAAAAA////////////////AP///////////NSwiGQ4FOT//////AAAAAAAABD///////////////8A//////////////////////////+YAAAAAAAAVP///////////////wD//////////////////////P/ggAQAAAAAAATM////////////////AP////////////////////9gAAAAAAAAAAAElP////////////////8A/////////////////////0AAAAAAAAAAHLj//////////////////wD/////////////////////OAAAAAAAAAAwkPj/////////////////AP////////////////////8gAAAAAAAAAAAAINj///////////////8A/////////////////////xAAAAAAAAAAAAAAIPD//////////////wD/////////////////////uOz/4HgEAAAAAAAAhP//////////////AP///////////////////////////3wAAAAAAAAw//////////////8A////////////////////////////6AAAAAAAAAj//////////////wD/////////////////////////////AAAAAAAAAP//////////////AP//////////tJh8YEQoDNz//////+AAAAAAAAAY//////////////8A//////////88AAAAAAAAaP//////dAAAAAAAAEz//////////////wD//////////6QAAAAAAAAAdOD/5HQAAAAAAAAApP//////////////AP///////////CgAAAAAAAAAAAAAAAAAAAAAACD4//////////////8A////////////yAQAAAAAAAAAAAAAAAAAAAAEuP///////////////wD/////////////rAQAAAAAAAAAAAAAAAAABJD/////////////////AP//////////////zDQAAAAAAAAAAAAAACTA//////////////////8A/////////////////8BwOCAAAAAUNGi0/P///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '4' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////////////////nAAAAAAAAAD///////////////8A/////////////////////////8AEAAAAAAAAAP///////////////wD////////////////////////gGAAAAAAAAAAA////////////////AP//////////////////////9DAAAAAAAAAAAAD///////////////8A//////////////////////9UAAAAAAAAAAAAAP///////////////wD/////////////////////hAAAAAAAAAAAAAAA////////////////AP///////////////////7QAAAAAAAAAAAAAAAD///////////////8A///////////////////UDAAAAAAUAAAAAAAAAP///////////////wD/////////////////7CQAAAAABMAAAAAAAAAA////////////////AP////////////////xEAAAAAACU/wAAAAAAAAD///////////////8A////////////////cAAAAAAAZP//AAAAAAAAAP///////////////wD//////////////6AAAAAAADz8//8AAAAAAAAA////////////////AP/////////////IBAAAAAAc6P///wAAAAAAAAD///////////////8A////////////5BgAAAAADMz/////AAAAAAAAAP///////////////wD///////////g0AAAAAACk//////8AAAAAAAAA////////////////AP//////////XAAAAAAAfP///////wAAAAAAAAD///////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A////////////////////////////AAAAAAAAAP///////////////wD///////////////////////////8AAAAAAAAA////////////////AP///////////////////////////wAAAAAAAAD///////////////8A////////////////////////////AAAAAAAAAP///////////////wD///////////////////////////8AAAAAAAAA////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '5' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////8AAAAAAAAAAAAAAAAAAAAAAA//////////////8A///////////////MAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////////6wAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////////iAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////////9kAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////////0QAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////////IAAAAAAAYP////////////////////////////8A//////////////wAAAAAAAB8/////////////////////////////wD/////////////3AAAAAAAAIj/////////////////////////////AP////////////+4AAAAAAAAoLRYHAAEKGTE//////////////////8A/////////////5QAAAAAAAAQAAAAAAAAAABY9P///////////////wD/////////////dAAAAAAAAAAAAAAAAAAAAAA89P//////////////AP////////////9QAAAAAAAAAAAAAAAAAAAAAABg//////////////8A/////////////zAAAAAAAAAAAAAAAAAAAAAAAADQ/////////////wD/////////////IAAAAAAAAGjY/+h4BAAAAAAAAGz/////////////AP//////////////9NS0lHSc//////90AAAAAAAALP////////////8A/////////////////////////////9QAAAAAAAAE/////////////wD//////////////////////////////wAAAAAAAAD/////////////AP/////////////////////////////8AAAAAAAAEP////////////8A////////////pIRwWEAgDOD//////8wAAAAAAAA8/////////////wD///////////9EAAAAAAAAaP//////ZAAAAAAAAHz/////////////AP///////////6QAAAAAAAAAaOD/4GQAAAAAAAAE4P////////////8A/////////////CQAAAAAAAAAAAAAAAAAAAAAAGD//////////////wD/////////////yAQAAAAAAAAAAAAAAAAAAAAc7P//////////////AP//////////////rAwAAAAAAAAAAAAAAAAAGNj///////////////8A////////////////0EAAAAAAAAAAAAAAAFTo/////////////////wD//////////////////8h4QCAAAAAcQHzU////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '6' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////////////+0ZCwMAAAUNGjI////////////////////AP/////////////////EMAAAAAAAAAAAAABM6P////////////////8A////////////////lAQAAAAAAAAAAAAAAAAo6P///////////////wD//////////////6wAAAAAAAAAAAAAAAAAAABI////////////////AP/////////////oEAAAAAAAAAAAAAAAAAAAAACw//////////////8A/////////////3AAAAAAAAAoxP/YPAAAAAAAAEj//////////////wD////////////4EAAAAAAACOD////YDCBAVGiAoP//////////////AP///////////7gAAAAAAABY//////////////////////////////8A////////////eAAAAAAAAJT//////////////////////////////wD///////////9MAAAAAAAAvP/IXBgABCx03P//////////////////AP///////////ygAAAAAAADcdAAAAAAAAAAEiP////////////////8A////////////FAAAAAAAAFAAAAAAAAAAAAAAcP///////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAlP//////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAQ8P////////////8A////////////AAAAAAAAAABAyP/kZAAAAAAAAACQ/////////////wD///////////8MAAAAAAAALPj/////WAAAAAAAAET/////////////AP///////////yQAAAAAAACY///////MAAAAAAAAFP////////////8A////////////SAAAAAAAAMD///////wAAAAAAAAA/////////////wD///////////9wAAAAAAAAvP///////wAAAAAAAAD/////////////AP///////////7QAAAAAAACI///////UAAAAAAAAJP////////////8A////////////+AwAAAAAACDw/////2wAAAAAAABY/////////////wD/////////////cAAAAAAAADC8/Ox4AAAAAAAAAKj/////////////AP/////////////oEAAAAAAAAAAAAAAAAAAAAAAk/P////////////8A//////////////+oAAAAAAAAAAAAAAAAAAAABLj//////////////wD///////////////+QAAAAAAAAAAAAAAAAAACQ////////////////AP////////////////+0JAAAAAAAAAAAAAAkuP////////////////8A///////////////////8sGg0FAAADCxgqPz//////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '7' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAABP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAy4/////////////wD//////////////////////////+QUAAAAAAAEuP//////////////AP/////////////////////////8QAAAAAAAAKT///////////////8A/////////////////////////4wAAAAAAAB0/////////////////wD////////////////////////cCAAAAAAANPz/////////////////AP///////////////////////0QAAAAAAATY//////////////////8A//////////////////////+0AAAAAAAAeP///////////////////wD//////////////////////CQAAAAAABTw////////////////////AP////////////////////+gAAAAAAAAkP////////////////////8A/////////////////////ywAAAAAABDw/////////////////////wD///////////////////+4AAAAAAAAbP//////////////////////AP///////////////////1wAAAAAAADQ//////////////////////8A///////////////////4DAAAAAAAMP///////////////////////wD//////////////////7QAAAAAAAB8////////////////////////AP//////////////////aAAAAAAAAMj///////////////////////8A//////////////////8oAAAAAAAM/P///////////////////////wD/////////////////8AAAAAAAAET/////////////////////////AP////////////////+0AAAAAAAAcP////////////////////////8A/////////////////4wAAAAAAACY/////////////////////////wD/////////////////WAAAAAAAAMD/////////////////////////AP////////////////80AAAAAAAA4P////////////////////////8A/////////////////xAAAAAAAAD4/////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '8' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD////////////////////IdDQUAAAEIEiA1P//////////////////AP/////////////////gRAAAAAAAAAAAAAAAROD///////////////8A////////////////0BgAAAAAAAAAAAAAAAAAEMj//////////////wD///////////////AcAAAAAAAAAAAAAAAAAAAAHPD/////////////AP//////////////hAAAAAAAAAAAAAAAAAAAAAAAhP////////////8A//////////////8sAAAAAAAAKMz/zCgAAAAAAAAs/////////////wD//////////////wAAAAAAAADM////zAAAAAAAAAD/////////////AP//////////////BAAAAAAAAP//////AAAAAAAABP////////////8A//////////////8sAAAAAAAAzP///9QAAAAAAAAw/////////////wD//////////////3wAAAAAAAAoyP/YNAAAAAAAAIT/////////////AP//////////////7BgAAAAAAAAAAAAAAAAAAAAc8P////////////8A////////////////xBgAAAAAAAAAAAAAAAAAGNj//////////////wD/////////////////tAQAAAAAAAAAAAAAAACo////////////////AP///////////////HAAAAAAAAAAAAAAAAAAAAB8//////////////8A//////////////9gAAAAAAAAAAAAAAAAAAAAAAB8/////////////wD/////////////wAAAAAAAAABk4P/UWAAAAAAAAATQ////////////AP////////////9UAAAAAAAAaP//////XAAAAAAAAGT///////////8A/////////////xgAAAAAAADg///////cAAAAAAAAJP///////////wD/////////////AAAAAAAAAP////////8AAAAAAAAA////////////AP////////////8AAAAAAAAA4P//////3AAAAAAAAAT///////////8A/////////////ygAAAAAAABg//////9cAAAAAAAALP///////////wD/////////////ZAAAAAAAAABY1P/cXAAAAAAAAABw////////////AP/////////////QAAAAAAAAAAAAAAAAAAAAAAAABNz///////////8A//////////////9gAAAAAAAAAAAAAAAAAAAAAAB0/////////////wD///////////////Q8AAAAAAAAAAAAAAAAAAAAUPz/////////////AP////////////////x4CAAAAAAAAAAAAAAAEIT8//////////////8A///////////////////smFQwGAAAABg0ZKT0/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '9' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////////////ysYCwMAAAUNGiw/P//////////////////AP////////////////+4JAAAAAAAAAAAAAAkuP////////////////8A////////////////lAQAAAAAAAAAAAAAAAAAkP///////////////wD//////////////8AEAAAAAAAAAAAAAAAAAAAAqP//////////////AP/////////////8JAAAAAAAAAAAAAAAAAAAAAAQ7P////////////8A/////////////6wAAAAAAAAAfOz8vCwAAAAAAABw/////////////wD/////////////WAAAAAAAAHD/////7BgAAAAAAAz4////////////AP////////////8kAAAAAAAA1P//////hAAAAAAAALT///////////8A/////////////wAAAAAAAAD///////+4AAAAAAAAcP///////////wD/////////////AAAAAAAAAPz//////8AAAAAAAABI////////////AP////////////8UAAAAAAAAzP//////lAAAAAAAACT///////////8A/////////////0QAAAAAAABY//////gsAAAAAAAADP///////////wD/////////////kAAAAAAAAABw5P/IPAAAAAAAAAAA////////////AP/////////////wEAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A//////////////+UAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD///////////////9wAAAAAAAAAAAAAFAAAAAAAAAU////////////AP////////////////+IBAAAAAAAAABw3AAAAAAAACj///////////8A///////////////////cdCwEABhcxP+8AAAAAAAATP///////////wD//////////////////////////////5AAAAAAAAB4////////////AP//////////////////////////////UAAAAAAAALj///////////8A//////////////+kgGxUQCAM2P///+AIAAAAAAAQ+P///////////wD//////////////0gAAAAAAAA42P/EKAAAAAAAAHD/////////////AP//////////////sAAAAAAAAAAAAAAAAAAAAAAQ6P////////////8A////////////////TAAAAAAAAAAAAAAAAAAAAKz//////////////wD////////////////oKAAAAAAAAAAAAAAAAASU////////////////AP/////////////////sUAAAAAAAAAAAAAAwxP////////////////8A////////////////////yHA0FAAADCxktP///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'A' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////////////////+QAAAAAAAAAAAAAAOT/////////////////AP//////////////////kAAAAAAAAAAAAAAAkP////////////////8A//////////////////88AAAAAAAAAAAAAAA8/////////////////wD/////////////////5AAAAAAAAAAAAAAAAADk////////////////AP////////////////+QAAAAAAAAAAAAAAAAAJD///////////////8A/////////////////zwAAAAAAAAAAAAAAAAAPP///////////////wD////////////////kAAAAAAAAAAgAAAAAAAAA5P//////////////AP///////////////5AAAAAAAAAAgAAAAAAAAACQ//////////////8A////////////////PAAAAAAAAAz8HAAAAAAAADz//////////////wD//////////////+QAAAAAAAAAWP9kAAAAAAAAANz/////////////AP//////////////kAAAAAAAAACk/7wAAAAAAAAAhP////////////8A//////////////88AAAAAAAABOz//BQAAAAAAAAw/////////////wD/////////////4AAAAAAAAAA8////ZAAAAAAAAADc////////////AP////////////+EAAAAAAAAAIj///+8AAAAAAAAAIT///////////8A/////////////zAAAAAAAAAA2P////wQAAAAAAAAMP///////////wD////////////cAAAAAAAAACT//////1wAAAAAAAAA3P//////////AP///////////4QAAAAAAAAAAAAAAAAAAAAAAAAAAACE//////////8A////////////MAAAAAAAAAAAAAAAAAAAAAAAAAAAADD//////////wD//////////9wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANz/////////AP//////////hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhP////////8A//////////8wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAw/////////wD/////////3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADc////////AP////////+EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIT///////8A/////////zAAAAAAAAAAhP///////////2QAAAAAAAAAMP///////wD////////cAAAAAAAAAADM////////////vAAAAAAAAAAA3P//////AP///////4QAAAAAAAAAHP/////////////4DAAAAAAAAACE//////8A////////MAAAAAAAAABk//////////////9cAAAAAAAAADD//////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'B' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAEDh83P///////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAEhP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAeP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAABY////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAABT///////////8A//////////8AAAAAAAAAAP/////4zEwAAAAAAAAAAP///////////wD//////////wAAAAAAAAAA////////7AAAAAAAAAAQ////////////AP//////////AAAAAAAAAAD////////sAAAAAAAAAEj///////////8A//////////8AAAAAAAAAAP/////4zEQAAAAAAAAAtP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAFz/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAiA/P////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAIjPj//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAGKz/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJT///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAABNz//////////wD//////////wAAAAAAAAAA///////sqCAAAAAAAAAAbP//////////AP//////////AAAAAAAAAAD/////////yAAAAAAAAAAs//////////8A//////////8AAAAAAAAAAP//////////AAAAAAAAAAT//////////wD//////////wAAAAAAAAAA/////////7wAAAAAAAAAAP//////////AP//////////AAAAAAAAAAD//////+ikGAAAAAAAAAAY//////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFT//////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsP//////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAADj///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAc6P///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAATOj/////////////AP//////////AAAAAAAAAAAAAAAAAAAEIEBkkNj///////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'C' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////////5JRULBAAAAgkTIDQ//////////////////8A////////////////1FAAAAAAAAAAAAAAAABAyP///////////////wD//////////////4gEAAAAAAAAAAAAAAAAAAAElP//////////////AP////////////9wAAAAAAAAAAAAAAAAAAAAAAAAlP////////////8A////////////kAAAAAAAAAAAAAAAAAAAAAAAAAAEyP///////////wD//////////9wIAAAAAAAAAAAAAAAAAAAAAAAAAAAw////////////AP//////////WAAAAAAAAAAAWMz/8JwQAAAAAAAAAACw//////////8A/////////+wEAAAAAAAAAID//////9QMAAAAAAAAAET//////////wD/////////nAAAAAAAAAAo/P///////3wAAAAABDBspP//////////AP////////9gAAAAAAAAAIz/////////3BxQjMT0//////////////8A/////////zQAAAAAAAAAzP///////////////////////////////wD/////////GAAAAAAAAADo////////////////////////////////AP////////8AAAAAAAAAAP////////////////////////////////8A/////////wAAAAAAAAAA/////////////////////////////////wD/////////AAAAAAAAAAD/////////////////////////////////AP////////8cAAAAAAAAAOj///////////////////////////////8A/////////zgAAAAAAAAA0P/////////kIGio7P///////////////wD/////////bAAAAAAAAACg/////////5wAAAAAMHS49P//////////AP////////+oAAAAAAAAAEz/////////PAAAAAAAAAAc//////////8A//////////QIAAAAAAAAALz//////6QAAAAAAAAAAGT//////////wD//////////3AAAAAAAAAADIzo/+SEBAAAAAAAAAAAyP//////////AP//////////7BAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A////////////rAAAAAAAAAAAAAAAAAAAAAAAAAAE0P///////////wD/////////////fAAAAAAAAAAAAAAAAAAAAAAAAJz/////////////AP//////////////iAQAAAAAAAAAAAAAAAAAAASY//////////////8A////////////////yEAAAAAAAAAAAAAAAAA8yP///////////////wD//////////////////9yIUCwQAAAAIEB4yP//////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'D' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////8AAAAAAAAAAAAAAAAADChQkOT/////////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAABGjw//////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAACDY/////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAABjk////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKj//////////wD///////////8AAAAAAAAAAP///+isSAAAAAAAAAAANP//////////AP///////////wAAAAAAAAAA////////hAAAAAAAAAAA2P////////8A////////////AAAAAAAAAAD/////////MAAAAAAAAACQ/////////wD///////////8AAAAAAAAAAP////////+MAAAAAAAAAFj/////////AP///////////wAAAAAAAAAA/////////8gAAAAAAAAAMP////////8A////////////AAAAAAAAAAD/////////5AAAAAAAAAAY/////////wD///////////8AAAAAAAAAAP//////////AAAAAAAAAAD/////////AP///////////wAAAAAAAAAA//////////8AAAAAAAAAAP////////8A////////////AAAAAAAAAAD//////////wAAAAAAAAAA/////////wD///////////8AAAAAAAAAAP/////////wAAAAAAAAABD/////////AP///////////wAAAAAAAAAA/////////9QAAAAAAAAAJP////////8A////////////AAAAAAAAAAD/////////qAAAAAAAAABI/////////wD///////////8AAAAAAAAAAP////////9QAAAAAAAAAHj/////////AP///////////wAAAAAAAAAA////////uAAAAAAAAAAAvP////////8A////////////AAAAAAAAAAD////w0HwEAAAAAAAAACT8/////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAADz8//////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAY6P///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAKNz/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAACHT0//////////////8A////////////AAAAAAAAAAAAAAAAABg4bKj0/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'E' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'F' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'G' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////////////////MB8TCgQAAAACCA4YJzs////////////////AP///////////////JQcAAAAAAAAAAAAAAAAAAhw8P////////////8A/////////////9gwAAAAAAAAAAAAAAAAAAAAAAAk2P///////////wD////////////EDAAAAAAAAAAAAAAAAAAAAAAAAAAc7P//////////AP//////////2AwAAAAAAAAAAAAAAAAAAAAAAAAAAABY//////////8A//////////wwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQ/////////wD/////////kAAAAAAAAAAAEHzQ/P/gmCAAAAAAAAAAAFz/////////AP////////wcAAAAAAAAACjg////////8CwAAAAAAAAgWP////////8A////////vAAAAAAAAAAI2P//////////yBRAcJjI8P///////////wD///////94AAAAAAAAAGD/////////////////////////////////AP///////0AAAAAAAAAAsP////////////////////////////////8A////////IAAAAAAAAADc/////////////////////////////////wD///////8AAAAAAAAAAP///////wAAAAAAAAAAAAAAAAD/////////AP///////wAAAAAAAAAA////////AAAAAAAAAAAAAAAAAP////////8A////////AAAAAAAAAAD///////8AAAAAAAAAAAAAAAAA/////////wD///////8gAAAAAAAAAOD//////wAAAAAAAAAAAAAAAAD/////////AP///////0AAAAAAAAAAtP//////AAAAAAAAAAAAAAAAAP////////8A////////cAAAAAAAAABw//////8AAAAAAAAAAAAAAAAA/////////wD///////+8AAAAAAAAABDs////////////AAAAAAAAAAD/////////AP////////wYAAAAAAAAADz0//////////AAAAAAAAAAAP////////8A/////////5AAAAAAAAAAACCY4P//3KhcCAAAAAAAAAAA/////////wD/////////+CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////AP//////////xAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIP////////8A////////////rAQAAAAAAAAAAAAAAAAAAAAAAAAAAGTw/////////wD/////////////vBQAAAAAAAAAAAAAAAAAAAAAADjI////////////AP//////////////8HAQAAAAAAAAAAAAAAAAAEiw//////////////8A//////////////////iwcEAgBAAABCA4aKDk/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'H' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'I' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'J' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAj//////////////wD//////////+zMrIxwUDAQ//////wAAAAAAAAAIP//////////////AP//////////DAAAAAAAAADo////2AAAAAAAAAA0//////////////8A//////////8wAAAAAAAAAKj///+YAAAAAAAAAFj//////////////wD//////////2gAAAAAAAAAIND/yBgAAAAAAAAAkP//////////////AP//////////vAAAAAAAAAAAAAAAAAAAAAAAAADc//////////////8A////////////MAAAAAAAAAAAAAAAAAAAAAAAUP///////////////wD////////////EBAAAAAAAAAAAAAAAAAAAABjk////////////////AP////////////+sBAAAAAAAAAAAAAAAAAAY2P////////////////8A///////////////EMAAAAAAAAAAAAAAAVOj//////////////////wD/////////////////vHBAIAAAABg8fNT/////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'K' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////8AAAAAAAAAAP//////////wAQAAAAAAAAAAABw////////AP///////wAAAAAAAAAA/////////9AMAAAAAAAAAAAAcP////////8A////////AAAAAAAAAAD////////cGAAAAAAAAAAAAHD//////////wD///////8AAAAAAAAAAP//////6CgAAAAAAAAAAABs////////////AP///////wAAAAAAAAAA//////Q0AAAAAAAAAAAAVPz///////////8A////////AAAAAAAAAAD////8RAAAAAAAAAAAAFT8/////////////wD///////8AAAAAAAAAAP///1gAAAAAAAAAAABU/P//////////////AP///////wAAAAAAAAAA//9wAAAAAAAAAAAASPz///////////////8A////////AAAAAAAAAAD/jAAAAAAAAAAAADz0/////////////////wD///////8AAAAAAAAAAKQAAAAAAAAAAAA89P//////////////////AP///////wAAAAAAAAAABAAAAAAAAAAAFPT///////////////////8A////////AAAAAAAAAAAAAAAAAAAAAAAApP///////////////////wD///////8AAAAAAAAAAAAAAAAAAAAAAAAU8P//////////////////AP///////wAAAAAAAAAAAAAAAAAAAAAAAABk//////////////////8A////////AAAAAAAAAAAAAAAAAAAAAAAAAADE/////////////////wD///////8AAAAAAAAAAAAAAAAoEAAAAAAAACz8////////////////AP///////wAAAAAAAAAAAAAAGNiAAAAAAAAAAIj///////////////8A////////AAAAAAAAAAAAABjY//gYAAAAAAAACOD//////////////wD///////8AAAAAAAAAAAAY2P///5wAAAAAAAAASP//////////////AP///////wAAAAAAAAAAGNj//////CgAAAAAAAAAqP////////////8A////////AAAAAAAAAADI////////sAAAAAAAAAAc8P///////////wD///////8AAAAAAAAAAP//////////QAAAAAAAAABs////////////AP///////wAAAAAAAAAA///////////IAAAAAAAAAATI//////////8A////////AAAAAAAAAAD///////////9YAAAAAAAAADD8/////////wD///////8AAAAAAAAAAP///////////9wEAAAAAAAAAJD/////////AP///////wAAAAAAAAAA/////////////3AAAAAAAAAADOT///////8A////////AAAAAAAAAAD/////////////7BAAAAAAAAAAUP///////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'L' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'M' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////8AAAAAAAAAAAAAAHz//////3wAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAAAAAATP//////UAAAAAAAAAAAAAAA////////AP//////AAAAAAAAAAAAAAAc//////8cAAAAAAAAAAAAAAD///////8A//////8AAAAAAAAAAAAAAADw////8AAAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAAAAAAALz////AAAAAAAAAAAAAAAAA////////AP//////AAAAAAAAAAAAAAAAkP///5AAAAAAAAAAAAAAAAD///////8A//////8AAAAAAAAAAAAAAABc////ZAAAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAoAAAAADD///8wAAAAACQAAAAAAAAA////////AP//////AAAAAAAAAFwAAAAABPz//AgAAAAAXAAAAAAAAAD///////8A//////8AAAAAAAAAkAAAAAAA0P/UAAAAAACQAAAAAAAAAP///////wD//////wAAAAAAAADMAAAAAACg/6gAAAAAAMQAAAAAAAAA////////AP//////AAAAAAAAAPgEAAAAAHD/dAAAAAAE+AAAAAAAAAD///////8A//////8AAAAAAAAA/zQAAAAAQP9IAAAAADD/AAAAAAAAAP///////wD//////wAAAAAAAAD/bAAAAAAQ/xQAAAAAaP8AAAAAAAAA////////AP//////AAAAAAAAAP+gAAAAAADQAAAAAACc/wAAAAAAAAD///////8A//////8AAAAAAAAA/9QAAAAAAGgAAAAAAND/AAAAAAAAAP///////wD//////wAAAAAAAAD//wwAAAAAFAAAAAAM/P8AAAAAAAAA////////AP//////AAAAAAAAAP//RAAAAAAAAAAAADz//wAAAAAAAAD///////8A//////8AAAAAAAAA//94AAAAAAAAAAAAcP//AAAAAAAAAP///////wD//////wAAAAAAAAD//7AAAAAAAAAAAACo//8AAAAAAAAA////////AP//////AAAAAAAAAP//5AAAAAAAAAAAANz//wAAAAAAAAD///////8A//////8AAAAAAAAA////HAAAAAAAAAAQ////AAAAAAAAAP///////wD//////wAAAAAAAAD///9QAAAAAAAAAEz///8AAAAAAAAA////////AP//////AAAAAAAAAP///4gAAAAAAAAAfP///wAAAAAAAAD///////8A//////8AAAAAAAAA////vAAAAAAAAACw////AAAAAAAAAP///////wD//////wAAAAAAAAD////wAAAAAAAAAOz///8AAAAAAAAA////////AP//////AAAAAAAAAP////8sAAAAAAAc/////wAAAAAAAAD///////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'N' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////AAAAAAAAALD/////////////AAAAAAAAAP//////////AP////////8AAAAAAAAAFOj///////////8AAAAAAAAA//////////8A/////////wAAAAAAAAAASP///////////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAkP//////////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAI1P////////8AAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAw+P///////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAABw////////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAC8//////8AAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAABzs/////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAFD/////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAJz///8AAAAAAAAA//////////8A/////////wAAAAAAAAAUAAAAAAAADNz//wAAAAAAAAD//////////wD/////////AAAAAAAAALQAAAAAAAAANPz/AAAAAAAAAP//////////AP////////8AAAAAAAAA/2wAAAAAAAAAfP8AAAAAAAAA//////////8A/////////wAAAAAAAAD/+CwAAAAAAAAExAAAAAAAAAD//////////wD/////////AAAAAAAAAP//0AQAAAAAAAAgAAAAAAAAAP//////////AP////////8AAAAAAAAA////jAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD/////RAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP/////kFAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAA//////+sAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD///////9kAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP////////QkAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAA/////////8wEAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD//////////4QAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP///////////DwAAAAAAAAAAP//////////AP////////8AAAAAAAAA////////////4BAAAAAAAAAA//////////8A/////////wAAAAAAAAD/////////////qAAAAAAAAAD//////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'O' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A///////////////////0qGw4HAAAABw4aKT0/////////////////wD////////////////wcAwAAAAAAAAAAAAAAAho6P//////////////AP//////////////uBQAAAAAAAAAAAAAAAAAAAAMoP////////////8A/////////////6AEAAAAAAAAAAAAAAAAAAAAAAAAkP///////////wD///////////+4BAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP//////////8BQAAAAAAAAAAAAAAAAAAAAAAAAAAAAM5P////////8A//////////9wAAAAAAAAAAAsrPD/7KQsAAAAAAAAAABg/////////wD/////////+BAAAAAAAAAAUPj///////hQAAAAAAAAAAjs////////AP////////+sAAAAAAAAABDw//////////AYAAAAAAAAAKD///////8A/////////2wAAAAAAAAAdP///////////3wAAAAAAAAAYP///////wD/////////OAAAAAAAAAC4////////////xAAAAAAAAAAw////////AP////////8cAAAAAAAAAOD////////////oAAAAAAAAABT///////8A/////////wAAAAAAAAAA//////////////8AAAAAAAAAAP///////wD/////////AAAAAAAAAAD//////////////wAAAAAAAAAA////////AP////////8AAAAAAAAAAP/////////////8AAAAAAAAAAD///////8A/////////xwAAAAAAAAA5P///////////+AAAAAAAAAAHP///////wD/////////NAAAAAAAAAC8////////////uAAAAAAAAAA4////////AP////////9oAAAAAAAAAHj///////////98AAAAAAAAAGT///////8A/////////6gAAAAAAAAAGPD/////////+BgAAAAAAAAApP///////wD/////////9AwAAAAAAAAAUPz///////xcAAAAAAAAAAjs////////AP//////////cAAAAAAAAAAALKjs//CwOAAAAAAAAAAAYP////////8A///////////wFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzk/////////wD///////////+4BAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP////////////+QAAAAAAAAAAAAAAAAAAAAAAAAAJD///////////8A//////////////+sEAAAAAAAAAAAAAAAAAAAAAyg/////////////wD////////////////oZAgAAAAAAAAAAAAAAARg4P//////////////AP//////////////////9KhsOCAAAAAUMFyc7P////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'P' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////////wAAAAAAAAAAAAAAAAAACCxguP////////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAOOD//////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAGOD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAARP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAABo////////////AP///////////wAAAAAAAAAA////6JwMAAAAAAAAADD///////////8A////////////AAAAAAAAAAD//////6AAAAAAAAAADP///////////wD///////////8AAAAAAAAAAP//////9AAAAAAAAAAA////////////AP///////////wAAAAAAAAAA///////0AAAAAAAAAAD///////////8A////////////AAAAAAAAAAD//////5gAAAAAAAAAHP///////////wD///////////8AAAAAAAAAAP///9iICAAAAAAAAABI////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAJD///////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAI6P///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAIT/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAABU/P////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAIhPz//////////////wD///////////8AAAAAAAAAAAAAAAAABCRMkOz/////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'Q' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////SoaDQcAAAAHDhoqPT///////////////////8A//////////////BwDAAAAAAAAAAAAAAACHDo/////////////////wD///////////+4FAAAAAAAAAAAAAAAAAAAABCo////////////////AP//////////nAQAAAAAAAAAAAAAAAAAAAAAAACQ//////////////8A/////////7gEAAAAAAAAAAAAAAAAAAAAAAAAAACg/////////////wD////////wFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzo////////////AP///////3AAAAAAAAAAACyo8P/sqCwAAAAAAAAAAGT///////////8A///////4EAAAAAAAAABM+P///////FQAAAAAAAAACPT//////////wD//////7AAAAAAAAAAFPD/////////9BgAAAAAAAAApP//////////AP//////bAAAAAAAAAB4////////////fAAAAAAAAABk//////////8A//////84AAAAAAAAALz///////////+8AAAAAAAAADT//////////wD//////xwAAAAAAAAA6P///////////+QAAAAAAAAAHP//////////AP//////AAAAAAAAAAD//////////////wAAAAAAAAAA//////////8A//////8AAAAAAAAAAP//////////////AAAAAAAAAAD//////////wD//////wAAAAAAAAAA/P////////////8AAAAAAAAAAP//////////AP//////GAAAAAAAAADg////////////4AAAAAAAAAAc//////////8A//////84AAAAAAAAALT////MJHTo//+8AAAAAAAAADT//////////wD//////2wAAAAAAAAAdP///2AAABCg/3wAAAAAAAAAZP//////////AP//////rAAAAAAAAAAY9P/sCAAAAABMGAAAAAAAAACk//////////8A///////4EAAAAAAAAABU/P+0OAAAAAAAAAAAAAAACPT//////////wD///////94AAAAAAAAAAA4sPD/gAAAAAAAAAAAAABk////////////AP////////AcAAAAAAAAAAAAAAAAAAAAAAAAAAAADOT///////////8A/////////7wEAAAAAAAAAAAAAAAAAAAAAAAAAACQ/////////////wD//////////6wEAAAAAAAAAAAAAAAAAAAAAAAAABSs////////////AP///////////7gUAAAAAAAAAAAAAAAAAAAAAAAAAABAwP////////8A//////////////BwDAAAAAAAAAAAAAAABAgAAAAAAAA8/////////wD////////////////0qGg0GAAAABgwXJjkxBgAAAAAALD/////////AP//////////////////////////////////5DQAAAAk/P////////8A////////////////////////////////////+GwAAJD//////////wD//////////////////////////////////////8A49P//////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'R' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////wAAAAAAAAAAAAAAAAAAAAQgOGSk+P///////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAcuP//////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAEsP////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ6P///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB8////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAADD///////////8A/////////wAAAAAAAAAA///////svDgAAAAAAAAACP///////////wD/////////AAAAAAAAAAD/////////7AAAAAAAAAAA////////////AP////////8AAAAAAAAAAP/////////cAAAAAAAAABD///////////8A/////////wAAAAAAAAAA//////DQoCQAAAAAAAAAQP///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAACU////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAIPj///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAzU/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAA02P//////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAxctPz///////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAEDY/////////////////wD/////////AAAAAAAAAAD/9LAsAAAAAAAAAAzc////////////////AP////////8AAAAAAAAAAP///+wkAAAAAAAAADD8//////////////8A/////////wAAAAAAAAAA/////8QAAAAAAAAAAJD//////////////wD/////////AAAAAAAAAAD//////1QAAAAAAAAAFPD/////////////AP////////8AAAAAAAAAAP//////3AQAAAAAAAAAgP////////////8A/////////wAAAAAAAAAA////////aAAAAAAAAAAM6P///////////wD/////////AAAAAAAAAAD////////oCAAAAAAAAABs////////////AP////////8AAAAAAAAAAP////////+AAAAAAAAAAATc//////////8A/////////wAAAAAAAAAA//////////AUAAAAAAAAAFj//////////wD/////////AAAAAAAAAAD//////////5AAAAAAAAAAAND/////////AP////////8AAAAAAAAAAP//////////+CQAAAAAAAAAQP////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'S' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP/////////////////8vHBEIAgAAAQgQHC8/P////////////////8A////////////////pCQAAAAAAAAAAAAAAAAcoP///////////////wD//////////////FwAAAAAAAAAAAAAAAAAAAAAXP//////////////AP////////////9oAAAAAAAAAAAAAAAAAAAAAAAAhP////////////8A////////////zAAAAAAAAAAAAAAAAAAAAAAAAAAI6P///////////wD///////////9cAAAAAAAAAAAAAAAAAAAAAAAAAACA////////////AP///////////xgAAAAAAAAAUOD/8KwkAAAAAAAAADj///////////8A////////////AAAAAAAAAAD0/////8wABCAgICxASP///////////wD///////////8MAAAAAAAAAMz/////////////////////////////AP///////////0AAAAAAAAAACFiQxPT///////////////////////8A////////////oAAAAAAAAAAAAAAAADBwtPT//////////////////wD////////////8QAAAAAAAAAAAAAAAAAAACFTA////////////////AP/////////////oOAAAAAAAAAAAAAAAAAAAAABM6P////////////8A///////////////4fAgAAAAAAAAAAAAAAAAAAAAY2P///////////wD/////////////////7IwwAAAAAAAAAAAAAAAAAAAo+P//////////AP/////////////////////koGw0BAAAAAAAAAAAAACU//////////8A///////////////////////////4uFgAAAAAAAAAADz//////////wD//////////2BgSEA0IBwA6P///////5QAAAAAAAAADP//////////AP//////////JAAAAAAAAACc/////////AAAAAAAAAAA//////////8A//////////9YAAAAAAAAACDo///////AAAAAAAAAABT//////////wD//////////6QAAAAAAAAAACCk7P/snBQAAAAAAAAAUP//////////AP//////////+BAAAAAAAAAAAAAAAAAAAAAAAAAAAACs//////////8A////////////kAAAAAAAAAAAAAAAAAAAAAAAAAAAOP///////////wD////////////8RAAAAAAAAAAAAAAAAAAAAAAAABjc////////////AP/////////////0PAAAAAAAAAAAAAAAAAAAAAAg2P////////////8A///////////////8hBQAAAAAAAAAAAAAAAAMdPT//////////////wD/////////////////+LRwSCAMAAAAHDhoqPT/////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'T' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'U' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////JAAAAAAAAADk/////////+gAAAAAAAAAHP//////////AP////////9MAAAAAAAAAJz/////////nAAAAAAAAABE//////////8A/////////4gAAAAAAAAAHOj//////+ggAAAAAAAAAHz//////////wD/////////0AAAAAAAAAAAIJzs/+ykIAAAAAAAAAAA0P//////////AP//////////QAAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A///////////IBAAAAAAAAAAAAAAAAAAAAAAAAAAE0P///////////wD///////////+YAAAAAAAAAAAAAAAAAAAAAAAAAJj/////////////AP////////////+UBAAAAAAAAAAAAAAAAAAAAASU//////////////8A///////////////IPAAAAAAAAAAAAAAAAAAwyP///////////////wD/////////////////0IxYOCAIAAAEIEiAyP//////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'V' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////zAAAAAAAAAAYP//////////////ZAAAAAAAAAAw////////AP//////kAAAAAAAAAAU/P////////////8UAAAAAAAAAJD///////8A///////oBAAAAAAAAADE////////////xAAAAAAAAAAE7P///////wD///////9MAAAAAAAAAHD///////////94AAAAAAAAAEz/////////AP///////6gAAAAAAAAAJP///////////yQAAAAAAAAArP////////8A////////+BAAAAAAAAAA1P/////////YAAAAAAAAABT4/////////wD/////////aAAAAAAAAACE/////////4QAAAAAAAAAbP//////////AP/////////EAAAAAAAAADT/////////OAAAAAAAAADM//////////8A//////////8kAAAAAAAAAOT//////+QAAAAAAAAAKP///////////wD//////////4QAAAAAAAAAmP//////nAAAAAAAAACI////////////AP//////////5AAAAAAAAABE//////9EAAAAAAAABOT///////////8A////////////QAAAAAAAAAT0////9AgAAAAAAABI/////////////wD///////////+gAAAAAAAAAKT///+kAAAAAAAAAKj/////////////AP////////////QIAAAAAAAAXP///1wAAAAAAAAM+P////////////8A/////////////1wAAAAAAAAM+P/8DAAAAAAAAGT//////////////wD/////////////vAAAAAAAAAC8/7wAAAAAAAAAxP//////////////AP//////////////HAAAAAAAAGj/aAAAAAAAACT///////////////8A//////////////94AAAAAAAAHP8cAAAAAAAAhP///////////////wD//////////////9gAAAAAAAAAkAAAAAAAAADk////////////////AP///////////////zgAAAAAAAAQAAAAAAAAQP////////////////8A////////////////lAAAAAAAAAAAAAAAAACg/////////////////wD////////////////sCAAAAAAAAAAAAAAADPT/////////////////AP////////////////9QAAAAAAAAAAAAAABg//////////////////8A/////////////////7AAAAAAAAAAAAAAAMD//////////////////wD//////////////////BQAAAAAAAAAAAAc////////////////////AP//////////////////cAAAAAAAAAAAAHz///////////////////8A///////////////////MAAAAAAAAAAAA3P///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'W' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//8cAAAAAAAAALz/////4AAAAAAAAAAA6P////+8AAAAAAAAABz//wD//1QAAAAAAAAAjP////+gAAAAAAAAAACo/////4wAAAAAAAAAUP//AP//jAAAAAAAAABU/////2AAAAAAAAAAAGj/////VAAAAAAAAACM//8A///EAAAAAAAAACT/////IAAAAAAAAAAAKP////8kAAAAAAAAAMT//wD///gEAAAAAAAAAPD//+AAAAAAAAAAAAAA6P//8AAAAAAAAAAE9P//AP///zAAAAAAAAAAvP//oAAAAAAAAAAAAACo//+8AAAAAAAAADD///8A////bAAAAAAAAACM//9gAAAAAAAAAAAAAGT//4wAAAAAAAAAaP///wD///+kAAAAAAAAAFT//yAAAAAAAAAAAAAAIP//VAAAAAAAAACc////AP///9gAAAAAAAAAJP/gAAAAAAAAAAAAAAAA4P8kAAAAAAAAANT///8A/////xAAAAAAAAAA8KAAAAAAAAAAAAAAAACg8AAAAAAAAAAQ/////wD/////TAAAAAAAAAC8YAAAAAAAAAAAAAAAAGC8AAAAAAAAAET/////AP////+AAAAAAAAAAIwgAAAAAAAAAAAAAAAAIIwAAAAAAAAAfP////8A/////7gAAAAAAAAANAAAAAAAACwwAAAAAAAANAAAAAAAAACw/////wD/////8AAAAAAAAAAAAAAAAAAAdHgAAAAAAAAAAAAAAAAAAOz/////AP//////KAAAAAAAAAAAAAAAAAC4vAAAAAAAAAAAAAAAAAAg//////8A//////9gAAAAAAAAAAAAAAAACPj4CAAAAAAAAAAAAAAAAFj//////wD//////5QAAAAAAAAAAAAAAABE//9IAAAAAAAAAAAAAAAAkP//////AP//////0AAAAAAAAAAAAAAAAIj//4wAAAAAAAAAAAAAAADI//////8A///////8DAAAAAAAAAAAAAAAzP//1AAAAAAAAAAAAAAABPj//////wD///////88AAAAAAAAAAAAABT/////GAAAAAAAAAAAAAA0////////AP///////3QAAAAAAAAAAAAAWP////9gAAAAAAAAAAAAAHD///////8A////////sAAAAAAAAAAAAACg/////6QAAAAAAAAAAAAApP///////wD////////kAAAAAAAAAAAAAOT/////6AAAAAAAAAAAAADc////////AP////////8cAAAAAAAAAAAo////////MAAAAAAAAAAAEP////////8A/////////1QAAAAAAAAAAHD///////94AAAAAAAAAABM/////////wD/////////jAAAAAAAAAAAtP///////7wAAAAAAAAAAID/////////AP/////////EAAAAAAAAAAT0////////+AgAAAAAAAAAuP////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'X' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////9UAAAAAAAAAKz///////////+sAAAAAAAAAFD/////////AP///////+QQAAAAAAAAFOT/////////8BwAAAAAAAAM5P////////8A/////////5gAAAAAAAAATP////////9kAAAAAAAAAJD//////////wD//////////0AAAAAAAAAAoP//////wAAAAAAAAAA0/P//////////AP//////////2AgAAAAAAAAQ4P////gkAAAAAAAABMz///////////8A////////////iAAAAAAAAABA////dAAAAAAAAABw/////////////wD////////////8MAAAAAAAAACU/9AEAAAAAAAAHPD/////////////AP/////////////IBAAAAAAAAAzYMAAAAAAAAACs//////////////8A//////////////90AAAAAAAAABAAAAAAAAAATP///////////////wD///////////////QgAAAAAAAAAAAAAAAAAAzg////////////////AP///////////////7wAAAAAAAAAAAAAAAAAjP////////////////8A/////////////////2AAAAAAAAAAAAAAADD8/////////////////wD/////////////////7BQAAAAAAAAAAAAEyP//////////////////AP/////////////////gDAAAAAAAAAAAAAjY//////////////////8A/////////////////0AAAAAAAAAAAAAAADj8/////////////////wD///////////////+UAAAAAAAAAAAAAAAAAJD/////////////////AP//////////////4AwAAAAAAAAAAAAAAAAADOD///////////////8A//////////////9AAAAAAAAAAAAAAAAAAAAAQP///////////////wD/////////////nAAAAAAAAAAAWAAAAAAAAAAAlP//////////////AP///////////+QQAAAAAAAAAGD/YAAAAAAAAAAM4P////////////8A////////////TAAAAAAAAAAs9P/0LAAAAAAAAABM/////////////wD//////////6AAAAAAAAAADNT////UDAAAAAAAAACg////////////AP/////////kEAAAAAAAAACg//////+gAAAAAAAAABDk//////////8A/////////0wAAAAAAAAAYP////////9gAAAAAAAAAEz//////////wD///////+oAAAAAAAAACz0//////////QsAAAAAAAAAKT/////////AP//////7BQAAAAAAAAM1P///////////9QMAAAAAAAAFOz///////8A//////9UAAAAAAAAAKD//////////////6AAAAAAAAAAVP///////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'Y' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////1QAAAAAAAAAAGj//////////2gAAAAAAAAAAFT///////8A////////5BAAAAAAAAAAAMT////////EAAAAAAAAAAAQ5P///////wD/////////mAAAAAAAAAAAKPj/////+CgAAAAAAAAAAJj/////////AP//////////PAAAAAAAAAAAgP////+AAAAAAAAAAAA8//////////8A///////////YCAAAAAAAAAAE2P//2AQAAAAAAAAACNj//////////wD///////////+AAAAAAAAAAAA4//84AAAAAAAAAACA////////////AP////////////woAAAAAAAAAACUlAAAAAAAAAAAKPz///////////8A/////////////8gAAAAAAAAAABAQAAAAAAAAAADI/////////////wD//////////////2wAAAAAAAAAAAAAAAAAAAAAbP//////////////AP//////////////8BwAAAAAAAAAAAAAAAAAABzw//////////////8A////////////////tAAAAAAAAAAAAAAAAAAAtP///////////////wD/////////////////VAAAAAAAAAAAAAAAAFT/////////////////AP/////////////////oEAAAAAAAAAAAAAAQ6P////////////////8A//////////////////+cAAAAAAAAAAAAAJz//////////////////wD///////////////////9AAAAAAAAAAABA////////////////////AP///////////////////9gAAAAAAAAAANj///////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'Z' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAQ//////////////8A/////////////////////////1AAAAAAAAAABLz//////////////wD///////////////////////98AAAAAAAAAACY////////////////AP//////////////////////pAAAAAAAAAAAaP////////////////8A/////////////////////8QIAAAAAAAAAET8/////////////////wD////////////////////gGAAAAAAAAAAo9P//////////////////AP//////////////////9CwAAAAAAAAAFNz///////////////////8A//////////////////xMAAAAAAAAAATA/////////////////////wD/////////////////eAAAAAAAAAAAnP//////////////////////AP///////////////5wAAAAAAAAAAHT///////////////////////8A///////////////ABAAAAAAAAABM/P///////////////////////wD/////////////3BQAAAAAAAAALPT/////////////////////////AP////////////QoAAAAAAAAABjg//////////////////////////8A///////////8SAAAAAAAAAAExP///////////////////////////wD//////////2wAAAAAAAAAAKD/////////////////////////////AP////////+YAAAAAAAAAAB8//////////////////////////////8A/////////wQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + ); + } +} diff --git a/install/update/new/phpbb/captcha/plugins/qa.php b/install/update/new/phpbb/captcha/plugins/qa.php new file mode 100644 index 0000000..966b8d3 --- /dev/null +++ b/install/update/new/phpbb/captcha/plugins/qa.php @@ -0,0 +1,1040 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha\plugins; + +/** +* And now to something completely different. Let's make a captcha without extending the abstract class. +* QA CAPTCHA sample implementation +*/ +class qa +{ + var $confirm_id; + var $answer; + var $question_ids = []; + var $question_text; + var $question_lang; + var $question_strict; + var $attempts = 0; + var $type; + // dirty trick: 0 is false, but can still encode that the captcha is not yet validated + var $solved = 0; + + protected $table_captcha_questions; + protected $table_captcha_answers; + protected $table_qa_confirm; + + /** + * @var string name of the service. + */ + protected $service_name; + + /** + * Constructor + * + * @param string $table_captcha_questions + * @param string $table_captcha_answers + * @param string $table_qa_confirm + */ + function __construct($table_captcha_questions, $table_captcha_answers, $table_qa_confirm) + { + $this->table_captcha_questions = $table_captcha_questions; + $this->table_captcha_answers = $table_captcha_answers; + $this->table_qa_confirm = $table_qa_confirm; + } + + /** + * @param int $type as per the CAPTCHA API docs, the type + */ + function init($type) + { + global $config, $db, $user, $request; + + // load our language file + $user->add_lang('captcha_qa'); + + // read input + $this->confirm_id = $request->variable('qa_confirm_id', ''); + $this->answer = $request->variable('qa_answer', '', true); + + $this->type = (int) $type; + $this->question_lang = $user->lang_name; + + // we need all defined questions - shouldn't be too many, so we can just grab them + // try the user's lang first + $sql = 'SELECT question_id + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($user->lang_name) . "'"; + $result = $db->sql_query($sql, 3600); + + while ($row = $db->sql_fetchrow($result)) + { + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + + // fallback to the board default lang + if (!count($this->question_ids)) + { + $this->question_lang = $config['default_lang']; + + $sql = 'SELECT question_id + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + $result = $db->sql_query($sql, 7200); + + while ($row = $db->sql_fetchrow($result)) + { + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + } + + // final fallback to any language + if (!count($this->question_ids)) + { + $this->question_lang = ''; + + $sql = 'SELECT q.question_id, q.lang_iso + FROM ' . $this->table_captcha_questions . ' q, ' . $this->table_captcha_answers . ' a + WHERE q.question_id = a.question_id'; + $result = $db->sql_query($sql, 7200); + + while ($row = $db->sql_fetchrow($result)) + { + if (empty($this->question_lang)) + { + $this->question_lang = $row['lang_iso']; + } + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + } + + // okay, if there is a confirm_id, we try to load that confirm's state. If not, we try to find one + if (!$this->load_answer() && (!$this->load_confirm_id() || !$this->load_answer())) + { + // we have no valid confirm ID, better get ready to ask something + $this->select_question(); + } + } + + /** + * See if the captcha has created its tables. + */ + public function is_installed() + { + global $phpbb_container; + + $db_tool = $phpbb_container->get('dbal.tools'); + + return $db_tool->sql_table_exists($this->table_captcha_questions); + } + + /** + * API function - for the captcha to be available, it must have installed itself and there has to be at least one question in the board's default lang + */ + public function is_available() + { + global $config, $db, $user; + + // load language file for pretty display in the ACP dropdown + $user->add_lang('captcha_qa'); + + if (!$this->is_installed()) + { + return false; + } + + $sql = 'SELECT COUNT(question_id) AS question_count + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + return ((bool) $row['question_count']); + } + + /** + * API function + */ + function has_config() + { + return true; + } + + /** + * API function + */ + static public function get_name() + { + return 'CAPTCHA_QA'; + } + + /** + * @return string the name of the service corresponding to the plugin + */ + function get_service_name() + { + return $this->service_name; + } + + /** + * Set the name of the plugin + * + * @param string $name + */ + public function set_name($name) + { + $this->service_name = $name; + } + + /** + * API function - not needed as we don't display an image + */ + function execute_demo() + { + } + + /** + * API function - not needed as we don't display an image + */ + function execute() + { + } + + /** + * API function - send the question to the template + */ + function get_template() + { + global $phpbb_log, $template, $user; + + if ($this->is_solved()) + { + return false; + } + else if (empty($this->question_text) || !count($this->question_ids)) + { + /** @var \phpbb\log\log_interface $phpbb_log */ + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); + return false; + } + else + { + $template->assign_vars(array( + 'QA_CONFIRM_QUESTION' => $this->question_text, + 'QA_CONFIRM_ID' => $this->confirm_id, + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, + )); + + return 'captcha_qa.html'; + } + } + + /** + * API function - we just display a mockup so that the captcha doesn't need to be installed + */ + function get_demo_template() + { + global $config, $db, $template; + + if ($this->is_available()) + { + $sql = 'SELECT question_text + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + $result = $db->sql_query_limit($sql, 1); + if ($row = $db->sql_fetchrow($result)) + { + $template->assign_vars(array( + 'QA_CONFIRM_QUESTION' => $row['question_text'], + )); + } + $db->sql_freeresult($result); + } + return 'captcha_qa_acp_demo.html'; + } + + /** + * API function + */ + function get_hidden_fields() + { + $hidden_fields = array(); + + // this is required - otherwise we would forget about the captcha being already solved + if ($this->solved) + { + $hidden_fields['qa_answer'] = $this->answer; + } + $hidden_fields['qa_confirm_id'] = $this->confirm_id; + + return $hidden_fields; + } + + /** + * API function + */ + function garbage_collect($type = 0) + { + global $db; + + $sql = 'SELECT c.confirm_id + FROM ' . $this->table_qa_confirm . ' c + LEFT JOIN ' . SESSIONS_TABLE . ' s + ON (c.session_id = s.session_id) + WHERE s.session_id IS NULL' . + ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $sql_in = array(); + + do + { + $sql_in[] = (string) $row['confirm_id']; + } + while ($row = $db->sql_fetchrow($result)); + + if (count($sql_in)) + { + $sql = 'DELETE FROM ' . $this->table_qa_confirm . ' + WHERE ' . $db->sql_in_set('confirm_id', $sql_in); + $db->sql_query($sql); + } + } + $db->sql_freeresult($result); + } + + /** + * API function - we don't drop the tables here, as that would cause the loss of all entered questions. + */ + function uninstall() + { + $this->garbage_collect(0); + } + + /** + * API function - set up shop + */ + function install() + { + global $phpbb_container; + + $db_tool = $phpbb_container->get('dbal.tools'); + $schemas = array( + $this->table_captcha_questions => array ( + 'COLUMNS' => array( + 'question_id' => array('UINT', null, 'auto_increment'), + 'strict' => array('BOOL', 0), + 'lang_id' => array('UINT', 0), + 'lang_iso' => array('VCHAR:30', ''), + 'question_text' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'question_id', + 'KEYS' => array( + 'lang' => array('INDEX', 'lang_iso'), + ), + ), + $this->table_captcha_answers => array ( + 'COLUMNS' => array( + 'question_id' => array('UINT', 0), + 'answer_text' => array('STEXT_UNI', ''), + ), + 'KEYS' => array( + 'qid' => array('INDEX', 'question_id'), + ), + ), + $this->table_qa_confirm => array ( + 'COLUMNS' => array( + 'session_id' => array('CHAR:32', ''), + 'confirm_id' => array('CHAR:32', ''), + 'lang_iso' => array('VCHAR:30', ''), + 'question_id' => array('UINT', 0), + 'attempts' => array('UINT', 0), + 'confirm_type' => array('USINT', 0), + ), + 'KEYS' => array( + 'session_id' => array('INDEX', 'session_id'), + 'lookup' => array('INDEX', array('confirm_id', 'session_id', 'lang_iso')), + ), + 'PRIMARY_KEY' => 'confirm_id', + ), + ); + + foreach ($schemas as $table => $schema) + { + if (!$db_tool->sql_table_exists($table)) + { + $db_tool->sql_create_table($table, $schema); + } + } + } + + /** + * API function - see what has to be done to validate + */ + function validate() + { + global $phpbb_log, $user; + + $error = ''; + + if (!count($this->question_ids)) + { + /** @var \phpbb\log\log_interface $phpbb_log */ + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); + return $user->lang('CONFIRM_QUESTION_MISSING'); + } + + if (!$this->confirm_id) + { + $error = $user->lang['CONFIRM_QUESTION_WRONG']; + } + else + { + if ($this->check_answer()) + { + $this->solved = true; + } + else + { + $error = $user->lang['CONFIRM_QUESTION_WRONG']; + } + } + + if (strlen($error)) + { + // okay, incorrect answer. Let's ask a new question. + $this->new_attempt(); + $this->solved = false; + + return $error; + } + else + { + return false; + } + } + + /** + * Select a question + */ + function select_question() + { + global $db, $user; + + if (!count($this->question_ids)) + { + return; + } + $this->confirm_id = md5(unique_id($user->ip)); + $this->question = (int) array_rand($this->question_ids); + + $sql = 'INSERT INTO ' . $this->table_qa_confirm . ' ' . $db->sql_build_array('INSERT', array( + 'confirm_id' => (string) $this->confirm_id, + 'session_id' => (string) $user->session_id, + 'lang_iso' => (string) $this->question_lang, + 'confirm_type' => (int) $this->type, + 'question_id' => (int) $this->question, + )); + $db->sql_query($sql); + + $this->load_answer(); + } + + /** + * New Question, if desired. + */ + function reselect_question() + { + global $db, $user; + + if (!count($this->question_ids)) + { + return; + } + + $this->question = (int) array_rand($this->question_ids); + $this->solved = 0; + + $sql = 'UPDATE ' . $this->table_qa_confirm . ' + SET question_id = ' . (int) $this->question . " + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "'"; + $db->sql_query($sql); + + $this->load_answer(); + } + + /** + * Wrong answer, so we increase the attempts and use a different question. + */ + function new_attempt() + { + global $db, $user; + + // yah, I would prefer a stronger rand, but this should work + $this->question = (int) array_rand($this->question_ids); + $this->solved = 0; + + $sql = 'UPDATE ' . $this->table_qa_confirm . ' + SET question_id = ' . (int) $this->question . ", + attempts = attempts + 1 + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "'"; + $db->sql_query($sql); + + $this->load_answer(); + } + + + /** + * See if there is already an entry for the current session. + */ + function load_confirm_id() + { + global $db, $user; + + $sql = 'SELECT confirm_id + FROM ' . $this->table_qa_confirm . " + WHERE + session_id = '" . $db->sql_escape($user->session_id) . "' + AND lang_iso = '" . $db->sql_escape($this->question_lang) . "' + AND confirm_type = " . $this->type; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $this->confirm_id = $row['confirm_id']; + return true; + } + return false; + } + + /** + * Look up everything we need and populate the instance variables. + */ + function load_answer() + { + global $db, $user; + + if (!strlen($this->confirm_id) || !count($this->question_ids)) + { + return false; + } + + $sql = 'SELECT con.question_id, attempts, question_text, strict + FROM ' . $this->table_qa_confirm . ' con, ' . $this->table_captcha_questions . " qes + WHERE con.question_id = qes.question_id + AND confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND qes.lang_iso = '" . $db->sql_escape($this->question_lang) . "' + AND confirm_type = " . $this->type; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $this->question = $row['question_id']; + + $this->attempts = $row['attempts']; + $this->question_strict = $row['strict']; + $this->question_text = $row['question_text']; + + return true; + } + + return false; + } + + /** + * The actual validation + */ + function check_answer() + { + global $db, $request; + + $answer = ($this->question_strict) ? $request->variable('qa_answer', '', true) : utf8_clean_string($request->variable('qa_answer', '', true)); + + $sql = 'SELECT answer_text + FROM ' . $this->table_captcha_answers . ' + WHERE question_id = ' . (int) $this->question; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $solution = ($this->question_strict) ? $row['answer_text'] : utf8_clean_string($row['answer_text']); + + if ($solution === $answer) + { + $this->solved = true; + + break; + } + } + $db->sql_freeresult($result); + + return $this->solved; + } + + /** + * API function + */ + function get_attempt_count() + { + return $this->attempts; + } + + /** + * API function + */ + function reset() + { + global $db, $user; + + $sql = 'DELETE FROM ' . $this->table_qa_confirm . " + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . (int) $this->type; + $db->sql_query($sql); + + // we leave the class usable by generating a new question + $this->select_question(); + } + + /** + * API function + */ + function is_solved() + { + global $request; + + if ($request->variable('qa_answer', false) && $this->solved === 0) + { + $this->validate(); + } + + return (bool) $this->solved; + } + + /** + * API function - The ACP backend, this marks the end of the easy methods + */ + function acp_page($id, $module) + { + global $config, $request, $phpbb_log, $template, $user; + + $user->add_lang('acp/board'); + $user->add_lang('captcha_qa'); + + if (!self::is_installed()) + { + $this->install(); + } + + $module->tpl_name = 'captcha_qa_acp'; + $module->page_title = 'ACP_VC_SETTINGS'; + $form_key = 'acp_captcha'; + add_form_key($form_key); + + $submit = $request->variable('submit', false); + $question_id = $request->variable('question_id', 0); + $action = $request->variable('action', ''); + + // we have two pages, so users might want to navigate from one to the other + $list_url = $module->u_action . "&configure=1&select_captcha=" . $this->get_service_name(); + + $template->assign_vars(array( + 'U_ACTION' => $module->u_action, + 'QUESTION_ID' => $question_id , + 'CLASS' => $this->get_service_name(), + )); + + // show the list? + if (!$question_id && $action != 'add') + { + $this->acp_question_list($module); + } + else if ($question_id && $action == 'delete') + { + if ($this->get_service_name() !== $config['captcha_plugin'] || !$this->acp_is_last($question_id)) + { + if (confirm_box(true)) + { + $this->acp_delete_question($question_id); + + trigger_error($user->lang['QUESTION_DELETED'] . adm_back_link($list_url)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'question_id' => $question_id, + 'action' => $action, + 'configure' => 1, + 'select_captcha' => $this->get_service_name(), + )) + ); + } + } + else + { + trigger_error($user->lang['QA_LAST_QUESTION'] . adm_back_link($list_url), E_USER_WARNING); + } + } + else + { + // okay, show the editor + $question_input = $this->acp_get_question_input(); + $langs = $this->get_languages(); + + foreach ($langs as $lang => $entry) + { + $template->assign_block_vars('langs', array( + 'ISO' => $lang, + 'NAME' => $entry['name'], + )); + } + + $template->assign_vars(array( + 'U_LIST' => $list_url, + )); + + if ($question_id) + { + if ($question = $this->acp_get_question_data($question_id)) + { + $template->assign_vars(array( + 'QUESTION_TEXT' => ($question_input['question_text']) ? $question_input['question_text'] : $question['question_text'], + 'LANG_ISO' => ($question_input['lang_iso']) ? $question_input['lang_iso'] : $question['lang_iso'], + 'STRICT' => (isset($_REQUEST['strict'])) ? $question_input['strict'] : $question['strict'], + 'ANSWERS' => implode("\n", $question['answers']), + )); + } + else + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($list_url)); + } + } + else + { + $template->assign_vars(array( + 'QUESTION_TEXT' => $question_input['question_text'], + 'LANG_ISO' => $question_input['lang_iso'], + 'STRICT' => $question_input['strict'], + 'ANSWERS' => (is_array($question_input['answers'])) ? implode("\n", $question_input['answers']) : '', + )); + } + + if ($submit && check_form_key($form_key)) + { + if (!$this->validate_input($question_input)) + { + $template->assign_vars(array( + 'S_ERROR' => true, + )); + } + else + { + if ($question_id) + { + $this->acp_update_question($question_input, $question_id); + } + else + { + $this->acp_add_question($question_input); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_VISUAL'); + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($list_url)); + } + } + else if ($submit) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($list_url), E_USER_WARNING); + } + } + } + + /** + * This handles the list overview + */ + function acp_question_list($module) + { + global $db, $template; + + $sql = 'SELECT * + FROM ' . $this->table_captcha_questions; + $result = $db->sql_query($sql); + + $template->assign_vars(array( + 'S_LIST' => true, + )); + + while ($row = $db->sql_fetchrow($result)) + { + $url = $module->u_action . "&question_id={$row['question_id']}&configure=1&select_captcha=" . $this->get_service_name() . '&'; + + $template->assign_block_vars('questions', array( + 'QUESTION_TEXT' => $row['question_text'], + 'QUESTION_ID' => $row['question_id'], + 'QUESTION_LANG' => $row['lang_iso'], + 'U_DELETE' => "{$url}action=delete", + 'U_EDIT' => "{$url}action=edit", + )); + } + $db->sql_freeresult($result); + } + + /** + * Grab a question and bring it into a format the editor understands + */ + function acp_get_question_data($question_id) + { + global $db; + + if ($question_id) + { + $sql = 'SELECT * + FROM ' . $this->table_captcha_questions . ' + WHERE question_id = ' . $question_id; + $result = $db->sql_query($sql); + $question = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$question) + { + return false; + } + + $question['answers'] = array(); + + $sql = 'SELECT * + FROM ' . $this->table_captcha_answers . ' + WHERE question_id = ' . $question_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $question['answers'][] = $row['answer_text']; + } + $db->sql_freeresult($result); + + return $question; + } + + return false; + } + + /** + * Grab a question from input and bring it into a format the editor understands + */ + function acp_get_question_input() + { + global $request; + + $answers = $request->variable('answers', '', true); + + // Convert answers into array and filter if answers are set + if (strlen($answers)) + { + $answers = array_filter(array_map('trim', explode("\n", $answers)), function ($value) { + return $value !== ''; + }); + } + + $question = array( + 'question_text' => $request->variable('question_text', '', true), + 'strict' => $request->variable('strict', false), + 'lang_iso' => $request->variable('lang_iso', ''), + 'answers' => $answers, + ); + return $question; + } + + /** + * Update a question. + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function acp_update_question($data, $question_id) + { + global $db, $cache; + + // easier to delete all answers than to figure out which to update + $sql = 'DELETE FROM ' . $this->table_captcha_answers . " WHERE question_id = $question_id"; + $db->sql_query($sql); + + $langs = $this->get_languages(); + $question_ary = $data; + $question_ary['lang_id'] = $langs[$question_ary['lang_iso']]['id']; + unset($question_ary['answers']); + + $sql = 'UPDATE ' . $this->table_captcha_questions . ' + SET ' . $db->sql_build_array('UPDATE', $question_ary) . " + WHERE question_id = $question_id"; + $db->sql_query($sql); + + $this->acp_insert_answers($data, $question_id); + + $cache->destroy('sql', $this->table_captcha_questions); + } + + /** + * Insert a question. + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function acp_add_question($data) + { + global $db, $cache; + + $langs = $this->get_languages(); + $question_ary = $data; + + $question_ary['lang_id'] = $langs[$data['lang_iso']]['id']; + unset($question_ary['answers']); + + $sql = 'INSERT INTO ' . $this->table_captcha_questions . ' ' . $db->sql_build_array('INSERT', $question_ary); + $db->sql_query($sql); + + $question_id = $db->sql_nextid(); + + $this->acp_insert_answers($data, $question_id); + + $cache->destroy('sql', $this->table_captcha_questions); + } + + /** + * Insert the answers. + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function acp_insert_answers($data, $question_id) + { + global $db, $cache; + + foreach ($data['answers'] as $answer) + { + $answer_ary = array( + 'question_id' => $question_id, + 'answer_text' => $answer, + ); + + $sql = 'INSERT INTO ' . $this->table_captcha_answers . ' ' . $db->sql_build_array('INSERT', $answer_ary); + $db->sql_query($sql); + } + + $cache->destroy('sql', $this->table_captcha_answers); + } + + /** + * Delete a question. + */ + function acp_delete_question($question_id) + { + global $db, $cache; + + $tables = array($this->table_captcha_questions, $this->table_captcha_answers); + + foreach ($tables as $table) + { + $sql = "DELETE FROM $table + WHERE question_id = $question_id"; + $db->sql_query($sql); + } + + $cache->destroy('sql', $tables); + } + + /** + * Check if the entered data can be inserted/used + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function validate_input($question_data) + { + $langs = $this->get_languages(); + + if (!isset($question_data['lang_iso']) || + !isset($question_data['question_text']) || + !isset($question_data['strict']) || + !isset($question_data['answers'])) + { + return false; + } + + if (!isset($langs[$question_data['lang_iso']]) || + !strlen($question_data['question_text']) || + !count($question_data['answers']) || + !is_array($question_data['answers'])) + { + return false; + } + + return true; + } + + /** + * List the installed language packs + */ + function get_languages() + { + global $db; + + $sql = 'SELECT * + FROM ' . LANG_TABLE; + $result = $db->sql_query($sql); + + $langs = array(); + while ($row = $db->sql_fetchrow($result)) + { + $langs[$row['lang_iso']] = array( + 'name' => $row['lang_local_name'], + 'id' => (int) $row['lang_id'], + ); + } + $db->sql_freeresult($result); + + return $langs; + } + + + + /** + * See if there is a question other than the one we have + */ + function acp_is_last($question_id) + { + global $config, $db; + + if ($question_id) + { + $sql = 'SELECT question_id + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "' + AND question_id <> " . (int) $question_id; + $result = $db->sql_query_limit($sql, 1); + $question = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$question) + { + return true; + } + return false; + } + } +} diff --git a/install/update/new/phpbb/class_loader.php b/install/update/new/phpbb/class_loader.php new file mode 100644 index 0000000..a4b6931 --- /dev/null +++ b/install/update/new/phpbb/class_loader.php @@ -0,0 +1,164 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* The class loader resolves class names to file system paths and loads them if +* necessary. +* +* Classes have to be of the form phpbb_(dir_)*(classpart_)*, so directory names +* must never contain underscores. Example: phpbb_dir_subdir_class_name is a +* valid class name, while phpbb_dir_sub_dir_class_name is not. +* +* If every part of the class name is a directory, the last directory name is +* also used as the filename, e.g. phpbb_dir would resolve to dir/dir.php. +*/ +class class_loader +{ + private $namespace; + private $path; + private $php_ext; + private $cache; + + /** + * A map of looked up class names to paths relative to $this->path. + * This map is stored in cache and looked up if the cache is available. + * + * @var array + */ + private $cached_paths = array(); + + /** + * Creates a new \phpbb\class_loader, which loads files with the given + * file extension from the given path. + * + * @param string $namespace Required namespace for files to be loaded + * @param string $path Directory to load files from + * @param string $php_ext The file extension for PHP files + * @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface. + */ + public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null) + { + if ($namespace[0] !== '\\') + { + $namespace = '\\' . $namespace; + } + + $this->namespace = $namespace; + $this->path = $path; + $this->php_ext = $php_ext; + + $this->set_cache($cache); + } + + /** + * Provide the class loader with a cache to store paths. If set to null, the + * the class loader will resolve paths by checking for the existence of every + * directory in the class name every time. + * + * @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface. + */ + public function set_cache(\phpbb\cache\driver\driver_interface $cache = null) + { + if ($cache) + { + $this->cached_paths = $cache->get('class_loader_' . str_replace('\\', '__', $this->namespace)); + + if ($this->cached_paths === false) + { + $this->cached_paths = array(); + } + } + + $this->cache = $cache; + } + + /** + * Registers the class loader as an autoloader using SPL. + */ + public function register() + { + spl_autoload_register(array($this, 'load_class')); + } + + /** + * Removes the class loader from the SPL autoloader stack. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'load_class')); + } + + /** + * Resolves a phpBB class name to a relative path which can be included. + * + * @param string $class The class name to resolve, must be in the + * namespace the loader was constructed with. + * Has to begin with \ + * @return string|bool A relative path to the file containing the + * class or false if looking it up failed. + */ + public function resolve_path($class) + { + if (isset($this->cached_paths[$class])) + { + return $this->path . $this->cached_paths[$class] . '.' . $this->php_ext; + } + + if (!preg_match('/^' . preg_quote($this->namespace, '/') . '[a-zA-Z0-9_\\\\]+$/', $class)) + { + return false; + } + + $relative_path = str_replace('\\', '/', substr($class, strlen($this->namespace))); + + if (!file_exists($this->path . $relative_path . '.' . $this->php_ext)) + { + return false; + } + + if ($this->cache) + { + $this->cached_paths[$class] = $relative_path; + $this->cache->put('class_loader_' . str_replace('\\', '__', $this->namespace), $this->cached_paths); + } + + return $this->path . $relative_path . '.' . $this->php_ext; + } + + /** + * Resolves a class name to a path and then includes it. + * + * @param string $class The class name which is being loaded. + */ + public function load_class($class) + { + // In general $class is not supposed to contain a leading backslash, + // but sometimes it does. See tickets PHP-50731 and HHVM-1840. + if ($class[0] !== '\\') + { + $class = '\\' . $class; + } + + if (substr($class, 0, strlen($this->namespace)) === $this->namespace) + { + $path = $this->resolve_path($class); + + if ($path) + { + require $path; + } + } + } +} diff --git a/install/update/new/phpbb/config/config.php b/install/update/new/phpbb/config/config.php new file mode 100644 index 0000000..c619cae --- /dev/null +++ b/install/update/new/phpbb/config/config.php @@ -0,0 +1,186 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\config; + +/** +* Configuration container class +*/ +class config implements \ArrayAccess, \IteratorAggregate, \Countable +{ + /** + * The configuration data + * @var array(string => string) + */ + protected $config; + + /** + * Creates a configuration container with a default set of values + * + * @param array(string => string) $config The configuration data. + */ + public function __construct(array $config) + { + $this->config = $config; + } + + /** + * Retrieves an ArrayIterator over the configuration values. + * + * @return \ArrayIterator An iterator over all config data + */ + public function getIterator() + { + return new \ArrayIterator($this->config); + } + + /** + * Checks if the specified config value exists. + * + * @param string $key The configuration option's name. + * @return bool Whether the configuration option exists. + */ + public function offsetExists($key) + { + return isset($this->config[$key]); + } + + /** + * Retrieves a configuration value. + * + * @param string $key The configuration option's name. + * @return string The configuration value + */ + public function offsetGet($key) + { + return (isset($this->config[$key])) ? $this->config[$key] : ''; + } + + /** + * Temporarily overwrites the value of a configuration variable. + * + * The configuration change will not persist. It will be lost + * after the request. + * + * @param string $key The configuration option's name. + * @param string $value The temporary value. + */ + public function offsetSet($key, $value) + { + $this->config[$key] = $value; + } + + /** + * Called when deleting a configuration value directly, triggers an error. + * + * @param string $key The configuration option's name. + */ + public function offsetUnset($key) + { + trigger_error('Config values have to be deleted explicitly with the \phpbb\config\config::delete($key) method.', E_USER_ERROR); + } + + /** + * Retrieves the number of configuration options currently set. + * + * @return int Number of config options + */ + public function count() + { + return count($this->config); + } + + /** + * Removes a configuration option + * + * @param String $key The configuration option's name + * @param bool $use_cache Whether this variable should be cached or if it + * changes too frequently to be efficiently cached + * @return null + */ + public function delete($key, $use_cache = true) + { + unset($this->config[$key]); + } + + /** + * Sets a configuration option's value + * + * @param string $key The configuration option's name + * @param string $value New configuration value + * @param bool $use_cache Whether this variable should be cached or if it + * changes too frequently to be efficiently cached. + */ + public function set($key, $value, $use_cache = true) + { + $this->config[$key] = $value; + } + + /** + * Sets a configuration option's value only if the old_value matches the + * current configuration value or the configuration value does not exist yet. + * + * @param string $key The configuration option's name + * @param string $old_value Current configuration value + * @param string $new_value New configuration value + * @param bool $use_cache Whether this variable should be cached or if it + * changes too frequently to be efficiently cached. + * @return bool True if the value was changed, false otherwise. + */ + public function set_atomic($key, $old_value, $new_value, $use_cache = true) + { + if (!isset($this->config[$key]) || $this->config[$key] == $old_value) + { + $this->config[$key] = $new_value; + return true; + } + return false; + } + + /** + * Checks configuration option's value only if the new_value matches the + * current configuration value and the configuration value does exist.Called + * only after set_atomic has been called. + * + * @param string $key The configuration option's name + * @param string $new_value New configuration value + * @throws \phpbb\exception\http_exception when config value is set and not equal to new_value. + * @return bool True if the value was changed, false otherwise. + */ + public function ensure_lock($key, $new_value) + { + if (isset($this->config[$key]) && $this->config[$key] == $new_value) + { + return true; + } + throw new \phpbb\exception\http_exception(500, 'Failure while aqcuiring locks.'); + } + + /** + * Increments an integer configuration value. + * + * @param string $key The configuration option's name + * @param int $increment Amount to increment by + * @param bool $use_cache Whether this variable should be cached or if it + * changes too frequently to be efficiently cached. + */ + function increment($key, $increment, $use_cache = true) + { + if (!isset($this->config[$key])) + { + $this->config[$key] = 0; + } + + $this->config[$key] += $increment; + } +} diff --git a/install/update/new/phpbb/config_php_file.php b/install/update/new/phpbb/config_php_file.php new file mode 100644 index 0000000..e3f7357 --- /dev/null +++ b/install/update/new/phpbb/config_php_file.php @@ -0,0 +1,166 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +class config_php_file +{ + /** @var string phpBB Root Path */ + protected $phpbb_root_path; + + /** @var string php file extension */ + protected $php_ext; + + /** + * Indicates whether the php config file has been loaded. + * + * @var bool + */ + protected $config_loaded = false; + + /** + * The content of the php config file + * + * @var array + */ + protected $config_data = array(); + + /** + * The path to the config file. (Default: $phpbb_root_path . 'config.' . $php_ext) + * + * @var string + */ + protected $config_file; + + private $defined_vars; + + /** + * Constructor + * + * @param string $phpbb_root_path phpBB Root Path + * @param string $php_ext php file extension + */ + function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->config_file = $this->phpbb_root_path . 'config.' . $this->php_ext; + } + + /** + * Set the path to the config file. + * + * @param string $config_file + */ + public function set_config_file($config_file) + { + $this->config_file = $config_file; + $this->config_loaded = false; + } + + /** + * Returns an associative array containing the variables defined by the config file. + * + * @return array Return the content of the config file or an empty array if the file does not exists. + */ + public function get_all() + { + $this->load_config_file(); + + return $this->config_data; + } + + /** + * Return the value of a variable defined into the config.php file or null if the variable does not exist. + * + * @param string $variable The name of the variable + * @return mixed Value of the variable or null if the variable is not defined. + */ + public function get($variable) + { + $this->load_config_file(); + + return isset($this->config_data[$variable]) ? $this->config_data[$variable] : null; + } + + /** + * Load the config file and store the information. + * + * @return null + */ + protected function load_config_file() + { + if (!$this->config_loaded && file_exists($this->config_file)) + { + $this->defined_vars = get_defined_vars(); + + require($this->config_file); + $this->config_data = array_diff_key(get_defined_vars(), $this->defined_vars); + + $this->config_loaded = true; + } + } + + /** + * Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name. + * + * If $dbms is a valid 3.1 db driver class name, returns it unchanged. + * Otherwise prepends phpbb\db\driver\ to the dbms to convert a 3.0 dbms + * to 3.1 db driver class name. + * + * @param string $dbms dbms parameter + * @return string driver class + * @throws \RuntimeException + */ + public function convert_30_dbms_to_31($dbms) + { + // Note: this check is done first because mysqli extension + // supplies a mysqli class, and class_exists($dbms) would return + // true for mysqli class. + // However, per the docblock any valid 3.1 driver name should be + // recognized by this function, and have priority over 3.0 dbms. + if (strpos($dbms, 'phpbb\db\driver') === false && class_exists('phpbb\db\driver\\' . $dbms)) + { + return 'phpbb\db\driver\\' . $dbms; + } + + if (class_exists($dbms)) + { + // Additionally we could check that $dbms extends phpbb\db\driver\driver. + // http://php.net/manual/en/class.reflectionclass.php + // Beware of possible performance issues: + // http://stackoverflow.com/questions/294582/php-5-reflection-api-performance + // We could check for interface implementation in all paths or + // only when we do not prepend phpbb\db\driver\. + + /* + $reflection = new \ReflectionClass($dbms); + + if ($reflection->isSubclassOf('phpbb\db\driver\driver')) + { + return $dbms; + } + */ + + return $dbms; + } + + // Force use of mysqli when specifying mysql + if (preg_match('/(phpbb\\\db\\\driver\\\)?mysql$/i', $dbms)) + { + return 'phpbb\db\driver\mysqli'; + } + + throw new \RuntimeException("You have specified an invalid dbms driver: $dbms"); + } +} diff --git a/install/update/new/phpbb/console/command/cron/run.php b/install/update/new/phpbb/console/command/cron/run.php new file mode 100644 index 0000000..511c6bc --- /dev/null +++ b/install/update/new/phpbb/console/command/cron/run.php @@ -0,0 +1,173 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\cron; + +use phpbb\exception\runtime_exception; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Output\OutputInterface; + +class run extends \phpbb\console\command\command +{ + /** @var \phpbb\cron\manager */ + protected $cron_manager; + + /** @var \phpbb\lock\db */ + protected $lock_db; + + /** + * Construct method + * + * @param \phpbb\user $user The user object (used to get language information) + * @param \phpbb\cron\manager $cron_manager The cron manager containing + * the cron tasks to be executed. + * @param \phpbb\lock\db $lock_db The lock for accessing database. + */ + public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db) + { + $this->cron_manager = $cron_manager; + $this->lock_db = $lock_db; + parent::__construct($user); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('cron:run') + ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_RUN')) + ->setHelp($this->user->lang('CLI_HELP_CRON_RUN')) + ->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1')) + ; + } + + /** + * Executes the command cron:run. + * + * Tries to acquire the cron lock, then if no argument has been given runs all ready cron tasks. + * If the cron lock can not be obtained, an error message is printed + * and the exit status is set to 1. + * If the verbose option is specified, each start of a task is printed. + * Otherwise there is no output. + * If an argument is given to the command, only the task whose name matches the + * argument will be started. If verbose option is specified, + * an info message containing the name of the task is printed. + * If no task matches the argument given, an error message is printed + * and the exit status is set to 2. + * + * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * + * @return int 0 if all is ok, 1 if a lock error occurred and 2 if no task matching the argument was found. + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if ($this->lock_db->acquire()) + { + $task_name = $input->getArgument('name'); + if ($task_name) + { + $exit_status = $this->run_one($input, $output, $task_name); + } + else + { + $exit_status = $this->run_all($input, $output); + } + + $this->lock_db->release(); + return $exit_status; + } + else + { + throw new runtime_exception('CRON_LOCK_ERROR', array(), null, 1); + } + } + + /** + * Executes all ready cron tasks. + * + * If verbose mode is set, an info message will be printed if there is no task to + * be run, or else for each starting task. + * + * @see execute + * @param InputInterface $input The input stream used to get the argument and verbose option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * @return int 0 + */ + protected function run_all(InputInterface $input, OutputInterface $output) + { + $run_tasks = $this->cron_manager->find_all_ready_tasks(); + + if ($run_tasks) + { + foreach ($run_tasks as $task) + { + if ($input->getOption('verbose')) + { + $output->writeln('' . $this->user->lang('RUNNING_TASK', $task->get_name()) . ''); + } + + $task->run(); + } + } + else + { + if ($input->getOption('verbose')) + { + $output->writeln('' . $this->user->lang('CRON_NO_TASK') . ''); + } + } + + return 0; + } + + /** + * Executes a given cron task, if it is ready. + * + * If there is a task whose name matches $task_name, it is run and 0 is returned. + * and if verbose mode is set, print an info message with the name of the task. + * If there is no task matching $task_name, the function prints an error message + * and returns with status 2. + * + * @see execute + * + * @param InputInterface $input The input stream used to get the argument and verbose option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * @param string $task_name The name of the task that should be run. + * + * @return int 0 if all is well, 2 if no task matches $task_name. + */ + protected function run_one(InputInterface $input, OutputInterface $output, $task_name) + { + $task = $this->cron_manager->find_task($task_name); + if ($task) + { + if ($input->getOption('verbose')) + { + $output->writeln('' . $this->user->lang('RUNNING_TASK', $task_name) . ''); + } + + $task->run(); + return 0; + } + else + { + throw new runtime_exception('CRON_NO_SUCH_TASK', array( $task_name), null, 2); + } + } +} diff --git a/install/update/new/phpbb/console/command/extension/enable.php b/install/update/new/phpbb/console/command/extension/enable.php new file mode 100644 index 0000000..504b554 --- /dev/null +++ b/install/update/new/phpbb/console/command/extension/enable.php @@ -0,0 +1,78 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\extension; + +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; + +class enable extends command +{ + protected function configure() + { + $this + ->setName('extension:enable') + ->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION')) + ->addArgument( + 'extension-name', + InputArgument::REQUIRED, + $this->user->lang('CLI_EXTENSION_NAME') + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + $name = $input->getArgument('extension-name'); + + if (!$this->manager->is_available($name)) + { + $io->error($this->user->lang('CLI_EXTENSION_NOT_EXIST', $name)); + return 1; + } + + $extension = $this->manager->get_extension($name); + + if (($enableable = $extension->is_enableable()) !== true) + { + $message = !empty($enableable) ? $enableable : $this->user->lang('CLI_EXTENSION_NOT_ENABLEABLE', $name); + $message = is_array($message) ? implode(PHP_EOL, $message) : $message; + $io->error($message); + return 1; + } + + if ($this->manager->is_enabled($name)) + { + $io->error($this->user->lang('CLI_EXTENSION_ENABLED', $name)); + return 1; + } + + $this->manager->enable($name); + $this->manager->load_extensions(); + + if ($this->manager->is_enabled($name)) + { + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); + $io->success($this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name)); + return 0; + } + else + { + $io->error($this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name)); + return 1; + } + } +} diff --git a/install/update/new/phpbb/console/command/update/check.php b/install/update/new/phpbb/console/command/update/check.php new file mode 100644 index 0000000..4cd7d21 --- /dev/null +++ b/install/update/new/phpbb/console/command/update/check.php @@ -0,0 +1,332 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\update; + +use phpbb\config\config; +use phpbb\exception\exception_interface; +use phpbb\language\language; +use phpbb\user; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\DependencyInjection\ContainerInterface; + +class check extends \phpbb\console\command\command +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \Symfony\Component\DependencyInjection\ContainerBuilder */ + protected $phpbb_container; + /** + * @var language + */ + private $language; + + /** + * Construct method + */ + public function __construct(user $user, config $config, ContainerInterface $phpbb_container, language $language) + { + $this->config = $config; + $this->phpbb_container = $phpbb_container; + $this->language = $language; + + $this->language->add_lang(array('acp/common', 'acp/extensions')); + + parent::__construct($user); + } + + /** + * Configures the service. + * + * Sets the name and description of the command. + * + * @return null + */ + protected function configure() + { + $this + ->setName('update:check') + ->setDescription($this->language->lang('CLI_DESCRIPTION_UPDATE_CHECK')) + ->addArgument('ext-name', InputArgument::OPTIONAL, $this->language->lang('CLI_DESCRIPTION_UPDATE_CHECK_ARGUMENT_1')) + ->addOption('stability', null, InputOption::VALUE_REQUIRED, $this->language->lang('CLI_DESCRIPTION_UPDATE_CHECK_OPTION_STABILITY')) + ->addOption('cache', 'c', InputOption::VALUE_NONE, $this->language->lang('CLI_DESCRIPTION_UPDATE_CHECK_OPTION_CACHE')) + ; + } + + /** + * Executes the command. + * + * Checks if an update is available. + * If at least one is available, a message is printed and if verbose mode is set the list of possible updates is printed. + * If their is none, nothing is printed unless verbose mode is set. + * + * @param InputInterface $input Input stream, used to get the options. + * @param OutputInterface $output Output stream, used to print messages. + * @return int 0 if the board is up to date, 1 if it is not and 2 if an error occurred. + * @throws \RuntimeException + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + $recheck = true; + if ($input->getOption('cache')) + { + $recheck = false; + } + + $stability = null; + if ($input->getOption('stability')) + { + $stability = $input->getOption('stability'); + if (!($stability == 'stable') && !($stability == 'unstable')) + { + $io->error($this->language->lang('CLI_ERROR_INVALID_STABILITY', $stability)); + return 3; + } + } + + $ext_name = $input->getArgument('ext-name'); + if ($ext_name != null) + { + if ($ext_name == 'all') + { + return $this->check_all_ext($io, $stability, $recheck); + } + else + { + return $this->check_ext($input, $io, $stability, $recheck, $ext_name); + } + } + else + { + return $this->check_core($input, $io, $stability, $recheck); + } + } + + /** + * Check if a given extension is up to date + * + * @param InputInterface $input Input stream, used to get the options. + * @param SymfonyStyle $io IO handler, for formatted and unified IO + * @param string $stability Force a given stability + * @param bool $recheck Disallow the use of the cache + * @param string $ext_name The extension name + * @return int + */ + protected function check_ext(InputInterface $input, SymfonyStyle $io, $stability, $recheck, $ext_name) + { + try + { + $ext_manager = $this->phpbb_container->get('ext.manager'); + $md_manager = $ext_manager->create_extension_metadata_manager($ext_name); + $updates_available = $ext_manager->version_check($md_manager, $recheck, false, $stability); + + $metadata = $md_manager->get_metadata('all'); + if ($input->getOption('verbose')) + { + $io->title($md_manager->get_metadata('display-name')); + + $io->note($this->language->lang('CURRENT_VERSION') . $this->language->lang('COLON') . ' ' . $metadata['version']); + } + + if (!empty($updates_available)) + { + if ($input->getOption('verbose')) + { + $io->caution($this->language->lang('NOT_UP_TO_DATE', $metadata['name'])); + + $this->display_versions($io, $updates_available); + } + + return 1; + } + else + { + if ($input->getOption('verbose')) + { + $io->success($this->language->lang('UPDATE_NOT_NEEDED')); + } + + return 0; + } + } + catch (\RuntimeException $e) + { + $io->error($this->language->lang('EXTENSION_NOT_INSTALLED', $ext_name)); + + return 1; + } + } + + /** + * Check if the core is up to date + * + * @param InputInterface $input Input stream, used to get the options. + * @param SymfonyStyle $io IO handler, for formatted and unified IO + * @param string $stability Force a given stability + * @param bool $recheck Disallow the use of the cache + * @return int + */ + protected function check_core(InputInterface $input, SymfonyStyle $io, $stability, $recheck) + { + $version_helper = $this->phpbb_container->get('version_helper'); + $version_helper->force_stability($stability); + + $updates_available = $version_helper->get_suggested_updates($recheck); + + if ($input->getOption('verbose')) + { + $io->title('phpBB core'); + + $io->note( $this->language->lang('CURRENT_VERSION') . $this->language->lang('COLON') . ' ' . $this->config['version']); + } + + if (!empty($updates_available)) + { + $io->caution($this->language->lang('UPDATE_NEEDED')); + + if ($input->getOption('verbose')) + { + $this->display_versions($io, $updates_available); + } + + return 1; + } + else + { + if ($input->getOption('verbose')) + { + $io->success($this->language->lang('UPDATE_NOT_NEEDED')); + } + + return 0; + } + } + + /** + * Check if all the available extensions are up to date + * + * @param SymfonyStyle $io IO handler, for formatted and unified IO + * @param string $stability Stability specifier string + * @param bool $recheck Disallow the use of the cache + * @return int + */ + protected function check_all_ext(SymfonyStyle $io, $stability, $recheck) + { + /** @var \phpbb\extension\manager $ext_manager */ + $ext_manager = $this->phpbb_container->get('ext.manager'); + + $rows = []; + + foreach ($ext_manager->all_available() as $ext_name => $ext_path) + { + $row = []; + $row[] = sprintf("%s", $ext_name); + $md_manager = $ext_manager->create_extension_metadata_manager($ext_name); + try + { + $metadata = $md_manager->get_metadata('all'); + if (isset($metadata['extra']['version-check'])) + { + try { + $updates_available = $ext_manager->version_check($md_manager, $recheck, false, $stability); + if (!empty($updates_available)) + { + $versions = array_map(function($entry) + { + return $entry['current']; + }, $updates_available); + + $row[] = sprintf("%s", $metadata['version']); + $row[] = implode(', ', $versions); + } + else + { + $row[] = sprintf("%s", $metadata['version']); + $row[] = ''; + } + } catch (\RuntimeException $e) { + $row[] = $metadata['version']; + $row[] = ''; + } + } + else + { + $row[] = $metadata['version']; + $row[] = ''; + } + } + catch (exception_interface $e) + { + $exception_message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $row[] = '' . $exception_message . ''; + } + catch (\RuntimeException $e) + { + $row[] = '' . $e->getMessage() . ''; + } + + $rows[] = $row; + } + + $io->table([ + $this->language->lang('EXTENSION_NAME'), + $this->language->lang('CURRENT_VERSION'), + $this->language->lang('LATEST_VERSION'), + ], $rows); + + return 0; + } + + /** + * Display the details of the available updates + * + * @param SymfonyStyle $io IO handler, for formatted and unified IO + * @param array $updates_available The list of the available updates + */ + protected function display_versions(SymfonyStyle $io, $updates_available) + { + $io->section($this->language->lang('UPDATES_AVAILABLE')); + + $rows = []; + foreach ($updates_available as $version_data) + { + $row = ['', '', '']; + $row[0] = $version_data['current']; + + if (isset($version_data['announcement'])) + { + $row[1] = $version_data['announcement']; + } + + if (isset($version_data['download'])) + { + $row[2] = $version_data['download']; + } + + $rows[] = $row; + } + + $io->table([ + $this->language->lang('VERSION'), + $this->language->lang('ANNOUNCEMENT_TOPIC'), + $this->language->lang('DOWNLOAD_LATEST'), + ], $rows); + } +} diff --git a/install/update/new/phpbb/console/command/user/add.php b/install/update/new/phpbb/console/command/user/add.php new file mode 100644 index 0000000..303216a --- /dev/null +++ b/install/update/new/phpbb/console/command/user/add.php @@ -0,0 +1,334 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\console\command\user; + +use phpbb\config\config; +use phpbb\console\command\command; +use phpbb\db\driver\driver_interface; +use phpbb\exception\runtime_exception; +use phpbb\language\language; +use phpbb\passwords\manager; +use phpbb\user; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Style\SymfonyStyle; + +class add extends command +{ + /** @var array Array of interactively acquired options */ + protected $data; + + /** @var driver_interface */ + protected $db; + + /** @var config */ + protected $config; + + /** @var language */ + protected $language; + + /** @var manager */ + protected $password_manager; + + /** + * phpBB root path + * + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP extension. + * + * @var string + */ + protected $php_ext; + + /** + * Construct method + * + * @param user $user + * @param driver_interface $db + * @param config $config + * @param language $language + * @param manager $password_manager + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(user $user, driver_interface $db, config $config, language $language, manager $password_manager, $phpbb_root_path, $php_ext) + { + $this->db = $db; + $this->config = $config; + $this->language = $language; + $this->password_manager = $password_manager; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->language->add_lang('ucp'); + parent::__construct($user); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('user:add') + ->setDescription($this->language->lang('CLI_DESCRIPTION_USER_ADD')) + ->setHelp($this->language->lang('CLI_HELP_USER_ADD')) + ->addOption( + 'username', + 'U', + InputOption::VALUE_REQUIRED, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_USERNAME') + ) + ->addOption( + 'password', + 'P', + InputOption::VALUE_REQUIRED, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_PASSWORD') + ) + ->addOption( + 'email', + 'E', + InputOption::VALUE_REQUIRED, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_EMAIL') + ) + ->addOption( + 'send-email', + null, + InputOption::VALUE_NONE, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_NOTIFY') + ) + ; + } + + /** + * Executes the command user:add + * + * Adds a new user to the database. If options are not provided, it will ask for the username, password and email. + * User is added to the registered user group. Language and timezone default to $config settings. + * + * @param InputInterface $input The input stream used to get the options + * @param OutputInterface $output The output stream, used to print messages + * + * @return int 0 if all is well, 1 if any errors occurred + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + try + { + $this->validate_user_data(); + $group_id = $this->get_group_id(); + } + catch (runtime_exception $e) + { + $io->error($e->getMessage()); + return 1; + } + + $user_row = array( + 'username' => $this->data['username'], + 'user_password' => $this->password_manager->hash($this->data['new_password']), + 'user_email' => $this->data['email'], + 'group_id' => $group_id, + 'user_timezone' => $this->config['board_timezone'], + 'user_lang' => $this->config['default_lang'], + 'user_type' => USER_NORMAL, + 'user_regdate' => time(), + ); + + $user_id = (int) user_add($user_row); + + if (!$user_id) + { + $io->error($this->language->lang('AUTH_NO_PROFILE_CREATED')); + return 1; + } + + if ($input->getOption('send-email') && $this->config['email_enable']) + { + $this->send_activation_email($user_id); + } + + $io->success($this->language->lang('CLI_USER_ADD_SUCCESS', $this->data['username'])); + + return 0; + } + + /** + * Interacts with the user. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $helper = $this->getHelper('question'); + + $this->data = array( + 'username' => $input->getOption('username'), + 'new_password' => $input->getOption('password'), + 'email' => $input->getOption('email'), + ); + + if (!$this->data['username']) + { + $question = new Question($this->ask_user('USERNAME')); + $this->data['username'] = $helper->ask($input, $output, $question); + } + + if (!$this->data['new_password']) + { + $question = new Question($this->ask_user('PASSWORD')); + $question->setValidator(function ($value) use ($helper, $input, $output) { + $question = new Question($this->ask_user('CONFIRM_PASSWORD')); + $question->setHidden(true); + if ($helper->ask($input, $output, $question) != $value) + { + throw new runtime_exception($this->language->lang('NEW_PASSWORD_ERROR')); + } + return $value; + }); + $question->setHidden(true); + $question->setMaxAttempts(5); + + $this->data['new_password'] = $helper->ask($input, $output, $question); + } + + if (!$this->data['email']) + { + $question = new Question($this->ask_user('EMAIL_ADDRESS')); + $this->data['email'] = $helper->ask($input, $output, $question); + } + } + + /** + * Validate the submitted user data + * + * @throws runtime_exception if any data fails validation + * @return null + */ + protected function validate_user_data() + { + if (!function_exists('validate_data')) + { + require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $error = validate_data($this->data, array( + 'username' => array( + array('string', false, $this->config['min_name_chars'], $this->config['max_name_chars']), + array('username', '')), + 'new_password' => array( + array('string', false, $this->config['min_pass_chars'], 0), + array('password')), + 'email' => array( + array('string', false, 6, 60), + array('user_email')), + )); + + if ($error) + { + throw new runtime_exception(implode("\n", array_map(array($this->language, 'lang'), $error))); + } + } + + /** + * Get the group id + * + * Go and find in the database the group_id corresponding to 'REGISTERED' + * + * @throws runtime_exception if the group id does not exist in database. + * @return null + */ + protected function get_group_id() + { + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "' + AND group_type = " . GROUP_SPECIAL; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row || !$row['group_id']) + { + throw new runtime_exception($this->language->lang('NO_GROUP')); + } + + return $row['group_id']; + } + + /** + * Send account activation email + * + * @param int $user_id The new user's id + * @return null + */ + protected function send_activation_email($user_id) + { + switch ($this->config['require_activation']) + { + case USER_ACTIVATION_SELF: + $email_template = 'user_welcome_inactive'; + $user_actkey = gen_rand_string(mt_rand(6, 10)); + break; + case USER_ACTIVATION_ADMIN: + $email_template = 'admin_welcome_inactive'; + $user_actkey = gen_rand_string(mt_rand(6, 10)); + break; + default: + $email_template = 'user_welcome'; + $user_actkey = ''; + break; + } + + if (!class_exists('messenger')) + { + require($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext); + } + + $messenger = new \messenger(false); + $messenger->template($email_template, $this->user->lang_name); + $messenger->to($this->data['email'], $this->data['username']); + $messenger->anti_abuse_headers($this->config, $this->user); + $messenger->assign_vars(array( + 'WELCOME_MSG' => htmlspecialchars_decode($this->language->lang('WELCOME_SUBJECT', $this->config['sitename'])), + 'USERNAME' => htmlspecialchars_decode($this->data['username']), + 'PASSWORD' => htmlspecialchars_decode($this->data['new_password']), + 'U_ACTIVATE' => generate_board_url() . "/ucp.{$this->php_ext}?mode=activate&u=$user_id&k=$user_actkey") + ); + + $messenger->send(NOTIFY_EMAIL); + } + + /** + * Helper to translate questions to the user + * + * @param string $key The language key + * @return string The language key translated with a colon and space appended + */ + protected function ask_user($key) + { + return $this->language->lang($key) . $this->language->lang('COLON') . ' '; + } +} diff --git a/install/update/new/phpbb/content_visibility.php b/install/update/new/phpbb/content_visibility.php new file mode 100644 index 0000000..fbc56f3 --- /dev/null +++ b/install/update/new/phpbb/content_visibility.php @@ -0,0 +1,899 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* phpbb_visibility +* Handle fetching and setting the visibility for topics and posts +*/ +class content_visibility +{ + /** + * Database object + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Auth object + * @var \phpbb\auth\auth + */ + protected $auth; + + /** + * config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * phpBB root path + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP Extension + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\user $user User object + * @param string $phpbb_root_path Root path + * @param string $php_ext PHP Extension + * @param string $forums_table Forums table name + * @param string $posts_table Posts table name + * @param string $topics_table Topics table name + * @param string $users_table Users table name + */ + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table) + { + $this->auth = $auth; + $this->config = $config; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->db = $db; + $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->forums_table = $forums_table; + $this->posts_table = $posts_table; + $this->topics_table = $topics_table; + $this->users_table = $users_table; + } + + /** + * Can the current logged-in user soft-delete posts? + * + * @param $forum_id int Forum ID whose permissions to check + * @param $poster_id int Poster ID of the post in question + * @param $post_locked bool Is the post locked? + * @return bool + */ + public function can_soft_delete($forum_id, $poster_id, $post_locked) + { + if ($this->auth->acl_get('m_softdelete', $forum_id)) + { + return true; + } + else if ($this->auth->acl_get('f_softdelete', $forum_id) && $poster_id == $this->user->data['user_id'] && !$post_locked) + { + return true; + } + + return false; + } + + /** + * Get the topics post count or the forums post/topic count based on permissions + * + * @param $mode string One of topic_posts, forum_posts or forum_topics + * @param $data array Array with the topic/forum data to calculate from + * @param $forum_id int The forum id is used for permission checks + * @return int Number of posts/topics the user can see in the topic/forum + */ + public function get_count($mode, $data, $forum_id) + { + if (!$this->auth->acl_get('m_approve', $forum_id)) + { + return (int) $data[$mode . '_approved']; + } + + return (int) $data[$mode . '_approved'] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted']; + } + + + /** + * Check topic/post visibility for a given forum ID + * + * Note: Read permissions are not checked. + * + * @param $mode string Either "topic" or "post" + * @param $forum_id int The forum id is used for permission checks + * @param $data array Array with item information to check visibility + * @return bool True if the item is visible, false if not + */ + public function is_visible($mode, $forum_id, $data) + { + $visibility = $data[$mode . '_visibility']; + $poster_key = ($mode === 'topic') ? 'topic_poster' : 'poster_id'; + $is_visible = ($visibility == ITEM_APPROVED) || + ($this->config['display_unapproved_posts'] && + ($this->user->data['user_id'] != ANONYMOUS) && + ($visibility == ITEM_UNAPPROVED || $visibility == ITEM_REAPPROVE) && + ($this->user->data['user_id'] == $data[$poster_key])) || + $this->auth->acl_get('m_approve', $forum_id); + + /** + * Allow changing the result of calling is_visible + * + * @event core.phpbb_content_visibility_is_visible + * @var bool is_visible Default visibility condition, to be modified by extensions if needed. + * @var string mode Either "topic" or "post" + * @var int forum_id Forum id of the current item + * @var array data Array of item information + * @since 3.2.2-RC1 + */ + $vars = array( + 'is_visible', + 'mode', + 'forum_id', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_is_visible', compact($vars))); + + return $is_visible; + } + + /** + * Create topic/post visibility SQL for a given forum ID + * + * Note: Read permissions are not checked. + * + * @param $mode string Either "topic" or "post" + * @param $forum_id int The forum id is used for permission checks + * @param $table_alias string Table alias to prefix in SQL queries + * @return string The appropriate combination SQL logic for topic/post_visibility + */ + public function get_visibility_sql($mode, $forum_id, $table_alias = '') + { + $where_sql = ''; + + $get_visibility_sql_overwrite = false; + + /** + * Allow changing the result of calling get_visibility_sql + * + * @event core.phpbb_content_visibility_get_visibility_sql_before + * @var string where_sql Extra visibility conditions. It must end with either an SQL "AND" or an "OR" + * @var string mode Either "topic" or "post" depending on the query this is being used in + * @var array forum_id The forum id in which the search is made. + * @var string table_alias Table alias to prefix in SQL queries + * @var mixed get_visibility_sql_overwrite If a string, forces the function to return get_forums_visibility_sql_overwrite after executing the event + * If false, get_visibility_sql continues normally + * It must be either boolean or string + * @since 3.1.4-RC1 + */ + $vars = array( + 'where_sql', + 'mode', + 'forum_id', + 'table_alias', + 'get_visibility_sql_overwrite', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_visibility_sql_before', compact($vars))); + + if ($get_visibility_sql_overwrite !== false) + { + return $get_visibility_sql_overwrite; + } + + if ($this->auth->acl_get('m_approve', $forum_id)) + { + $where_sql .= '1 = 1'; + } + else + { + $visibility_query = $table_alias . $mode . '_visibility = '; + + $where_sql .= '(' . $visibility_query . ITEM_APPROVED . ')'; + if ($this->config['display_unapproved_posts'] && ($this->user->data['user_id'] != ANONYMOUS)) + { + $poster_key = ($mode === 'topic') ? 'topic_poster' : 'poster_id'; + $where_sql .= ' OR ((' . $visibility_query . ITEM_UNAPPROVED . ' OR ' . $visibility_query . ITEM_REAPPROVE .')'; + $where_sql .= ' AND ' . $table_alias . $poster_key . ' = ' . ((int) $this->user->data['user_id']) . ')'; + } + } + return '(' . $where_sql . ')'; + } + + /** + * Create topic/post visibility SQL for a set of forums + * + * Note: Read permissions are not checked. Forums without read permissions + * should not be in $forum_ids + * + * @param $mode string Either "topic" or "post" + * @param $forum_ids array Array of forum ids which the posts/topics are limited to + * @param $table_alias string Table alias to prefix in SQL queries + * @return string The appropriate combination SQL logic for topic/post_visibility + */ + public function get_forums_visibility_sql($mode, $forum_ids = array(), $table_alias = '') + { + $where_sql = ''; + + $approve_forums = array_keys($this->auth->acl_getf('m_approve', true)); + if (!empty($forum_ids) && !empty($approve_forums)) + { + $approve_forums = array_intersect($forum_ids, $approve_forums); + $forum_ids = array_diff($forum_ids, $approve_forums); + } + + $get_forums_visibility_sql_overwrite = false; + /** + * Allow changing the result of calling get_forums_visibility_sql + * + * @event core.phpbb_content_visibility_get_forums_visibility_before + * @var string where_sql Extra visibility conditions. It must end with either an SQL "AND" or an "OR" + * @var string mode Either "topic" or "post" depending on the query this is being used in + * @var array forum_ids Array of forum ids which the posts/topics are limited to + * @var string table_alias Table alias to prefix in SQL queries + * @var array approve_forums Array of forums where the user has m_approve permissions + * @var mixed get_forums_visibility_sql_overwrite If a string, forces the function to return get_forums_visibility_sql_overwrite after executing the event + * If false, get_forums_visibility_sql continues normally + * It must be either boolean or string + * @since 3.1.3-RC1 + */ + $vars = array( + 'where_sql', + 'mode', + 'forum_ids', + 'table_alias', + 'approve_forums', + 'get_forums_visibility_sql_overwrite', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_forums_visibility_before', compact($vars))); + + if ($get_forums_visibility_sql_overwrite !== false) + { + return $get_forums_visibility_sql_overwrite; + } + + // Moderator can view all posts/topics in the moderated forums + $where_sql .= '(' . $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums, false, true) . ' OR '; + // Normal user can view approved items only + $where_sql .= '(' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ' + AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true) . '))'; + + return '(' . $where_sql . ')'; + } + + /** + * Create topic/post visibility SQL for all forums on the board + * + * Note: Read permissions are not checked. Forums without read permissions + * should be in $exclude_forum_ids + * + * @param $mode string Either "topic" or "post" + * @param $exclude_forum_ids array Array of forum ids which are excluded + * @param $table_alias string Table alias to prefix in SQL queries + * @return string The appropriate combination SQL logic for topic/post_visibility + */ + public function get_global_visibility_sql($mode, $exclude_forum_ids = array(), $table_alias = '') + { + $where_sqls = array(); + + $approve_forums = array_diff(array_keys($this->auth->acl_getf('m_approve', true)), $exclude_forum_ids); + + $visibility_sql_overwrite = null; + + /** + * Allow changing the result of calling get_global_visibility_sql + * + * @event core.phpbb_content_visibility_get_global_visibility_before + * @var array where_sqls Array of extra visibility conditions. Will be joined by imploding with "OR". + * @var string mode Either "topic" or "post" depending on the query this is being used in + * @var array exclude_forum_ids Array of forum ids the current user doesn't have access to + * @var string table_alias Table alias to prefix in SQL queries + * @var array approve_forums Array of forums where the user has m_approve permissions + * @var string visibility_sql_overwrite If not empty, forces the function to return visibility_sql_overwrite after executing the event + * @since 3.1.3-RC1 + */ + $vars = array( + 'where_sqls', + 'mode', + 'exclude_forum_ids', + 'table_alias', + 'approve_forums', + 'visibility_sql_overwrite', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_global_visibility_before', compact($vars))); + + if ($visibility_sql_overwrite) + { + return $visibility_sql_overwrite; + } + + // Include approved items in all forums but the excluded + $where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true, true) . ' + AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')'; + + // If user has moderator permissions, add everything in the moderated forums + if (count($approve_forums)) + { + $where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums); + } + + return '(' . implode(' OR ', $where_sqls) . ')'; + } + + /** + * Change visibility status of one post or all posts of a topic + * + * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @param $post_id mixed Post ID or array of post IDs to act on, + * if it is empty, all posts of topic_id will be modified + * @param $topic_id int Topic where $post_id is found + * @param $forum_id int Forum where $topic_id is found + * @param $user_id int User performing the action + * @param $time int Timestamp when the action is performed + * @param $reason string Reason why the visibility was changed. + * @param $is_starter bool Is this the first post of the topic changed? + * @param $is_latest bool Is this the last post of the topic changed? + * @param $limit_visibility mixed Limit updating per topic_id to a certain visibility + * @param $limit_delete_time mixed Limit updating per topic_id to a certain deletion time + * @return array Changed post data, empty array if an error occurred. + */ + public function set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest, $limit_visibility = false, $limit_delete_time = false) + { + if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE))) + { + return array(); + } + + if ($post_id) + { + if (is_array($post_id)) + { + $where_sql = $this->db->sql_in_set('post_id', array_map('intval', $post_id)); + } + else + { + $where_sql = 'post_id = ' . (int) $post_id; + } + $where_sql .= ' AND topic_id = ' . (int) $topic_id; + } + else + { + $where_sql = 'topic_id = ' . (int) $topic_id; + + // Limit the posts to a certain visibility and deletion time + // This allows us to only restore posts, that were approved + // when the topic got soft deleted. So previous soft deleted + // and unapproved posts are still soft deleted/unapproved + if ($limit_visibility !== false) + { + $where_sql .= ' AND post_visibility = ' . (int) $limit_visibility; + } + + if ($limit_delete_time !== false) + { + $where_sql .= ' AND post_delete_time = ' . (int) $limit_delete_time; + } + } + + $sql = 'SELECT poster_id, post_id, post_postcount, post_visibility + FROM ' . $this->posts_table . ' + WHERE ' . $where_sql; + $result = $this->db->sql_query($sql); + + $post_ids = $poster_postcounts = $postcounts = $postcount_visibility = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $post_ids[] = (int) $row['post_id']; + + if ($row['post_visibility'] != $visibility) + { + if ($row['post_postcount'] && !isset($poster_postcounts[(int) $row['poster_id']])) + { + $poster_postcounts[(int) $row['poster_id']] = 1; + } + else if ($row['post_postcount']) + { + $poster_postcounts[(int) $row['poster_id']]++; + } + + if (!isset($postcount_visibility[$row['post_visibility']])) + { + $postcount_visibility[$row['post_visibility']] = 1; + } + else + { + $postcount_visibility[$row['post_visibility']]++; + } + } + } + $this->db->sql_freeresult($result); + + if (empty($post_ids)) + { + return array(); + } + + if (!function_exists('truncate_string')) + { + include($this->phpbb_root_path . 'includes/functions_content.' . $this->php_ext); + } + + $data = array( + 'post_visibility' => (int) $visibility, + 'post_delete_user' => (int) $user_id, + 'post_delete_time' => ((int) $time) ?: time(), + 'post_delete_reason' => truncate_string($reason, 255, 255, false), + ); + /** + * Perform actions right before the query to change post visibility + * + * @event core.set_post_visibility_before_sql + * @var int visibility Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @var array post_id Array containing all post IDs to be modified. If blank, all posts within the topic are modified. + * @var int topic_id Topic of the post IDs to be modified. + * @var int forum_id Forum ID that the topic_id resides in. + * @var int user_id User ID doing this action. + * @var int time Timestamp of this action. + * @var string reason Reason specified by the user for this change. + * @var bool is_starter Are we changing the topic's starter? + * @var bool is_latest Are we changing the topic's latest post? + * @var array data The data array for this action. + * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp + */ + $vars = array( + 'visibility', + 'post_id', + 'topic_id', + 'forum_id', + 'user_id', + 'time', + 'reason', + 'is_starter', + 'is_latest', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.set_post_visibility_before_sql', compact($vars))); + $sql = 'UPDATE ' . $this->posts_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $data) . ' + WHERE ' . $this->db->sql_in_set('post_id', $post_ids); + $this->db->sql_query($sql); + + // Group the authors by post count, to reduce the number of queries + foreach ($poster_postcounts as $poster_id => $num_posts) + { + $postcounts[$num_posts][] = $poster_id; + } + + // Update users postcounts + foreach ($postcounts as $num_posts => $poster_ids) + { + if (in_array($visibility, array(ITEM_REAPPROVE, ITEM_DELETED))) + { + $sql = 'UPDATE ' . $this->users_table . ' + SET user_posts = 0 + WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . ' + AND user_posts < ' . $num_posts; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->users_table . ' + SET user_posts = user_posts - ' . $num_posts . ' + WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . ' + AND user_posts >= ' . $num_posts; + $this->db->sql_query($sql); + } + else + { + $sql = 'UPDATE ' . $this->users_table . ' + SET user_posts = user_posts + ' . $num_posts . ' + WHERE ' . $this->db->sql_in_set('user_id', $poster_ids); + $this->db->sql_query($sql); + } + } + + $update_topic_postcount = true; + + // Sync the first/last topic information if needed + if (!$is_starter && $is_latest) + { + 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) + { + update_post_information('topic', $topic_id, false); + } + if ($forum_id) + { + update_post_information('forum', $forum_id, false); + } + } + else if ($is_starter && $topic_id) + { + if (!function_exists('sync')) + { + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext); + } + + // ... so we need to use sync, if the first post is changed. + // The forum is resynced recursive by sync() itself. + sync('topic', 'topic_id', $topic_id, true); + + // sync recalculates the topic replies and forum posts by itself, so we don't do that. + $update_topic_postcount = false; + } + + $topic_update_array = array(); + // Update the topic's reply count and the forum's post count + if ($update_topic_postcount) + { + $field_alias = array( + ITEM_APPROVED => 'posts_approved', + ITEM_UNAPPROVED => 'posts_unapproved', + ITEM_DELETED => 'posts_softdeleted', + ITEM_REAPPROVE => 'posts_unapproved', + ); + $cur_posts = array_fill_keys($field_alias, 0); + + foreach ($postcount_visibility as $post_visibility => $visibility_posts) + { + $cur_posts[$field_alias[(int) $post_visibility]] += $visibility_posts; + } + + $sql_ary = array(); + $recipient_field = $field_alias[$visibility]; + + foreach ($cur_posts as $field => $count) + { + // Decrease the count for the old statuses. + if ($count && $field != $recipient_field) + { + $sql_ary[$field] = " - $count"; + } + } + // Add up the count from all statuses excluding the recipient status. + $count_increase = array_sum(array_diff($cur_posts, array($recipient_field))); + + if ($count_increase) + { + $sql_ary[$recipient_field] = " + $count_increase"; + } + + if (count($sql_ary)) + { + $forum_sql = array(); + + foreach ($sql_ary as $field => $value_change) + { + $topic_update_array[] = 'topic_' . $field . ' = topic_' . $field . $value_change; + $forum_sql[] = 'forum_' . $field . ' = forum_' . $field . $value_change; + } + + $sql = 'UPDATE ' . $this->forums_table . ' + SET ' . implode(', ', $forum_sql) . ' + WHERE forum_id = ' . (int) $forum_id; + $this->db->sql_query($sql); + } + } + + if ($post_id) + { + $sql = 'SELECT 1 AS has_attachments + FROM ' . POSTS_TABLE . ' + WHERE topic_id = ' . (int) $topic_id . ' + AND post_attachment = 1 + AND post_visibility = ' . ITEM_APPROVED . ' + AND ' . $this->db->sql_in_set('post_id', $post_id, true); + $result = $this->db->sql_query_limit($sql, 1); + + $has_attachment = (bool) $this->db->sql_fetchfield('has_attachments'); + $this->db->sql_freeresult($result); + + if ($has_attachment && $visibility == ITEM_APPROVED) + { + $topic_update_array[] = 'topic_attachment = 1'; + } + else if (!$has_attachment && $visibility != ITEM_APPROVED) + { + $topic_update_array[] = 'topic_attachment = 0'; + } + } + + if (!empty($topic_update_array)) + { + // Update the number for replies and posts, and update the attachments flag + $sql = 'UPDATE ' . $this->topics_table . ' + SET ' . implode(', ', $topic_update_array) . ' + WHERE topic_id = ' . (int) $topic_id; + $this->db->sql_query($sql); + } + /** + * Perform actions after all steps to changing post visibility + * + * @event core.set_post_visibility_after + * @var int visibility Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @var array post_id Array containing all post IDs to be modified. If blank, all posts within the topic are modified. + * @var int topic_id Topic of the post IDs to be modified. + * @var int forum_id Forum ID that the topic_id resides in. + * @var int user_id User ID doing this action. + * @var int time Timestamp of this action. + * @var string reason Reason specified by the user for this change. + * @var bool is_starter Are we changing the topic's starter? + * @var bool is_latest Are we changing the topic's latest post? + * @var array data The data array for this action. + * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp + */ + $vars = array( + 'visibility', + 'post_id', + 'topic_id', + 'forum_id', + 'user_id', + 'time', + 'reason', + 'is_starter', + 'is_latest', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.set_post_visibility_after', compact($vars))); + return $data; + } + + /** + * Set topic visibility + * + * Allows approving (which is akin to undeleting/restore) or soft deleting an entire topic. + * Calls set_post_visibility as needed. + * + * Note: By default, when a soft deleted topic is restored. Only posts that + * were approved at the time of soft deleting, are being restored. + * Same applies to soft deleting. Only approved posts will be marked + * as soft deleted. + * If you want to update all posts, use the force option. + * + * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @param $topic_id mixed Topic ID to act on + * @param $forum_id int Forum where $topic_id is found + * @param $user_id int User performing the action + * @param $time int Timestamp when the action is performed + * @param $reason string Reason why the visibilty was changed. + * @param $force_update_all bool Force to update all posts within the topic + * @return array Changed topic data, empty array if an error occurred. + */ + public function set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all = false) + { + if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE))) + { + return array(); + } + + if (!$force_update_all) + { + $sql = 'SELECT topic_visibility, topic_delete_time + FROM ' . $this->topics_table . ' + WHERE topic_id = ' . (int) $topic_id; + $result = $this->db->sql_query($sql); + $original_topic_data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$original_topic_data) + { + // The topic does not exist... + return array(); + } + } + + if (!function_exists('truncate_string')) + { + include($this->phpbb_root_path . 'includes/functions_content.' . $this->php_ext); + } + + // Note, we do not set a reason for the posts, just for the topic + $data = array( + 'topic_visibility' => (int) $visibility, + 'topic_delete_user' => (int) $user_id, + 'topic_delete_time' => ((int) $time) ?: time(), + 'topic_delete_reason' => truncate_string($reason, 255, 255, false), + ); + /** + * Perform actions right before the query to change topic visibility + * + * @event core.set_topic_visibility_before_sql + * @var int visibility Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @var int topic_id Topic of the post IDs to be modified. + * @var int forum_id Forum ID that the topic_id resides in. + * @var int user_id User ID doing this action. + * @var int time Timestamp of this action. + * @var string reason Reason specified by the user for this change. + * @var bool force_update_all Force an update on all posts within the topic, regardless of their current approval state. + * @var array data The data array for this action. + * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp + */ + $vars = array( + 'visibility', + 'topic_id', + 'forum_id', + 'user_id', + 'time', + 'reason', + 'force_update_all', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.set_topic_visibility_before_sql', compact($vars))); + $sql = 'UPDATE ' . $this->topics_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $data) . ' + WHERE topic_id = ' . (int) $topic_id; + $this->db->sql_query($sql); + + if (!$this->db->sql_affectedrows()) + { + return array(); + } + + if (!$force_update_all && $original_topic_data['topic_delete_time'] && $original_topic_data['topic_visibility'] == ITEM_DELETED && $visibility == ITEM_APPROVED) + { + // If we're restoring a topic we only restore posts, that were soft deleted through the topic soft deletion. + $this->set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility'], $original_topic_data['topic_delete_time']); + } + else if (!$force_update_all && $original_topic_data['topic_visibility'] == ITEM_APPROVED && $visibility == ITEM_DELETED) + { + // If we're soft deleting a topic we only mark approved posts as soft deleted. + $this->set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility']); + } + else + { + $this->set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true); + } + /** + * Perform actions after all steps to changing topic visibility + * + * @event core.set_topic_visibility_after + * @var int visibility Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @var int topic_id Topic of the post IDs to be modified. + * @var int forum_id Forum ID that the topic_id resides in. + * @var int user_id User ID doing this action. + * @var int time Timestamp of this action. + * @var string reason Reason specified by the user for this change. + * @var bool force_update_all Force an update on all posts within the topic, regardless of their current approval state. + * @var array data The data array for this action. + * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp + */ + $vars = array( + 'visibility', + 'topic_id', + 'forum_id', + 'user_id', + 'time', + 'reason', + 'force_update_all', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.set_topic_visibility_after', compact($vars))); + return $data; + } + + /** + * Add post to topic and forum statistics + * + * @param $data array Contains information from the topics table about given topic + * @param &$sql_data array Populated with the SQL changes, may be empty at call time + * @return null + */ + public function add_post_to_statistic($data, &$sql_data) + { + $sql_data[$this->topics_table] = (($sql_data[$this->topics_table]) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved + 1'; + + $sql_data[$this->forums_table] = (($sql_data[$this->forums_table]) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved + 1'; + + if ($data['post_postcount']) + { + $sql_data[$this->users_table] = (($sql_data[$this->users_table]) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts + 1'; + } + + $this->config->increment('num_posts', 1, false); + } + + /** + * Remove post from topic and forum statistics + * + * @param $data array Contains information from the topics table about given topic + * @param &$sql_data array Populated with the SQL changes, may be empty at call time + * @return null + */ + public function remove_post_from_statistic($data, &$sql_data) + { + if ($data['post_visibility'] == ITEM_APPROVED) + { + $sql_data[$this->topics_table] = ((!empty($sql_data[$this->topics_table])) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved - 1'; + $sql_data[$this->forums_table] = ((!empty($sql_data[$this->forums_table])) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved - 1'; + + if ($data['post_postcount']) + { + $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1'; + } + + $this->config->increment('num_posts', -1, false); + } + else if ($data['post_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE) + { + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_unapproved = forum_posts_unapproved - 1'; + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_unapproved = topic_posts_unapproved - 1'; + } + else if ($data['post_visibility'] == ITEM_DELETED) + { + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_softdeleted = forum_posts_softdeleted - 1'; + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_softdeleted = topic_posts_softdeleted - 1'; + } + } + + /** + * Remove topic from forum statistics + * + * @param $data array Post and topic data + * @param &$sql_data array Populated with the SQL changes, may be empty at call time + * @return null + */ + public function remove_topic_from_statistic($data, &$sql_data) + { + if ($data['topic_visibility'] == ITEM_APPROVED) + { + $sql_data[FORUMS_TABLE] .= 'forum_posts_approved = forum_posts_approved - 1, forum_topics_approved = forum_topics_approved - 1'; + + if ($data['post_postcount']) + { + $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1'; + } + } + else if ($data['topic_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE) + { + $sql_data[FORUMS_TABLE] .= 'forum_posts_unapproved = forum_posts_unapproved - 1, forum_topics_unapproved = forum_topics_unapproved - 1'; + } + else if ($data['topic_visibility'] == ITEM_DELETED) + { + $sql_data[FORUMS_TABLE] .= 'forum_posts_softdeleted = forum_posts_softdeleted - 1, forum_topics_softdeleted = forum_topics_softdeleted - 1'; + } + + } +} diff --git a/install/update/new/phpbb/controller/helper.php b/install/update/new/phpbb/controller/helper.php new file mode 100644 index 0000000..58a4a49 --- /dev/null +++ b/install/update/new/phpbb/controller/helper.php @@ -0,0 +1,195 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\controller; + +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + +/** +* Controller helper class, contains methods that do things for controllers +*/ +class helper +{ + /** + * Template object + * @var \phpbb\template\template + */ + protected $template; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * config object + * @var \phpbb\config\config + */ + protected $config; + + /* @var \phpbb\symfony_request */ + protected $symfony_request; + + /* @var \phpbb\request\request_interface */ + protected $request; + + /** + * @var \phpbb\routing\helper + */ + protected $routing_helper; + + /** + * Constructor + * + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object + * @param \phpbb\config\config $config Config object + * @param \phpbb\symfony_request $symfony_request Symfony Request object + * @param \phpbb\request\request_interface $request phpBB request object + * @param \phpbb\routing\helper $routing_helper Helper to generate the routes + */ + public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\symfony_request $symfony_request, \phpbb\request\request_interface $request, \phpbb\routing\helper $routing_helper) + { + $this->template = $template; + $this->user = $user; + $this->config = $config; + $this->symfony_request = $symfony_request; + $this->request = $request; + $this->routing_helper = $routing_helper; + } + + /** + * Automate setting up the page and creating the response object. + * + * @param string $template_file The template handle to render + * @param string $page_title The title of the page to output + * @param int $status_code The status code to be sent to the page header + * @param bool $display_online_list Do we display online users list + * @param int $item_id Restrict online users to item id + * @param string $item Restrict online users to a certain session item, e.g. forum for session_forum_id + * @param bool $send_headers Whether headers should be sent by page_header(). Defaults to false for controllers. + * + * @return Response object containing rendered page + */ + public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false, $item_id = 0, $item = 'forum', $send_headers = false) + { + page_header($page_title, $display_online_list, $item_id, $item, $send_headers); + + $this->template->set_filenames(array( + 'body' => $template_file, + )); + + page_footer(true, false, false); + + $headers = !empty($this->user->data['is_bot']) ? array('X-PHPBB-IS-BOT' => 'yes') : array(); + + return new Response($this->template->assign_display('body'), $status_code, $headers); + } + + /** + * Generate a URL to a route + * + * @param string $route Name of the route to travel + * @param array $params String or array of additional url parameters + * @param bool $is_amp Is url using & (true) or & (false) + * @param string|bool $session_id Possibility to use a custom session id instead of the global one + * @param bool|string $reference_type The type of reference to be generated (one of the constants) + * @return string The URL already passed through append_sid() + */ + public function route($route, array $params = array(), $is_amp = true, $session_id = false, $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH) + { + return $this->routing_helper->route($route, $params, $is_amp, $session_id, $reference_type); + } + + /** + * Output an error, effectively the same thing as trigger_error + * + * @param string $message The error message + * @param int $code The error code (e.g. 404, 500, 503, etc.) + * @return Response A Response instance + * + * @deprecated 3.1.3 (To be removed: 4.0.0) Use exceptions instead. + */ + public function error($message, $code = 500) + { + return $this->message($message, array(), 'INFORMATION', $code); + } + + /** + * Output a message + * + * In case of an error, please throw an exception instead + * + * @param string $message The message to display (must be a language variable) + * @param array $parameters The parameters to use with the language var + * @param string $title Title for the message (must be a language variable) + * @param int $code The HTTP status code (e.g. 404, 500, 503, etc.) + * @return Response A Response instance + */ + public function message($message, array $parameters = array(), $title = 'INFORMATION', $code = 200) + { + array_unshift($parameters, $message); + $message_text = call_user_func_array(array($this->user, 'lang'), $parameters); + $message_title = $this->user->lang($title); + + if ($this->request->is_ajax()) + { + global $refresh_data; + + return new JsonResponse( + array( + 'MESSAGE_TITLE' => $message_title, + 'MESSAGE_TEXT' => $message_text, + 'S_USER_WARNING' => false, + 'S_USER_NOTICE' => false, + 'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null + ), + $code + ); + } + + $this->template->assign_vars(array( + 'MESSAGE_TEXT' => $message_text, + 'MESSAGE_TITLE' => $message_title, + )); + + return $this->render('message_body.html', $message_title, $code); + } + + /** + * Assigns automatic refresh time meta tag in template + * + * @param int $time time in seconds, when redirection should occur + * @param string $url the URL where the user should be redirected + * @return null + */ + public function assign_meta_refresh_var($time, $url) + { + $this->template->assign_vars(array( + 'META' => '', + )); + } + + /** + * Return the current url + * + * @return string + */ + public function get_current_url() + { + return generate_board_url(true) . $this->request->escape($this->symfony_request->getRequestUri(), true); + } +} diff --git a/install/update/new/phpbb/cron/controller/cron.php b/install/update/new/phpbb/cron/controller/cron.php new file mode 100644 index 0000000..6f0e35e --- /dev/null +++ b/install/update/new/phpbb/cron/controller/cron.php @@ -0,0 +1,40 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\cron\controller; + +use Symfony\Component\HttpFoundation\Response; + +/** + * Controller for running cron jobs + */ +class cron +{ + /** + * Handles CRON requests + * + * @param string $cron_type + * + * @return Response + */ + public function handle($cron_type) + { + $response = new Response(); + $response->headers->set('Cache-Control', 'no-cache'); + $response->headers->set('Content-type', 'image/gif'); + $response->headers->set('Content-length', '43'); + $response->setContent(base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')); + + return $response; + } +} diff --git a/install/update/new/phpbb/cron/event/cron_runner_listener.php b/install/update/new/phpbb/cron/event/cron_runner_listener.php new file mode 100644 index 0000000..9e9ecf0 --- /dev/null +++ b/install/update/new/phpbb/cron/event/cron_runner_listener.php @@ -0,0 +1,103 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\cron\event; + +use phpbb\cron\manager; +use phpbb\lock\db; +use phpbb\request\request_interface; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Event\PostResponseEvent; + +/** + * Event listener that executes cron tasks, after the response was served + */ +class cron_runner_listener implements EventSubscriberInterface +{ + /** + * @var \phpbb\lock\db + */ + private $cron_lock; + + /** + * @var \phpbb\cron\manager + */ + private $cron_manager; + + /** + * @var \phpbb\request\request_interface + */ + private $request; + + /** + * Constructor + * + * @param db $lock + * @param manager $manager + * @param request_interface $request + */ + public function __construct(db $lock, manager $manager, request_interface $request) + { + $this->cron_lock = $lock; + $this->cron_manager = $manager; + $this->request = $request; + } + + /** + * Runs the cron job after the response was sent + * + * @param PostResponseEvent $event The event + */ + public function on_kernel_terminate(PostResponseEvent $event) + { + $request = $event->getRequest(); + $controller_name = $request->get('_route'); + + if ($controller_name !== 'phpbb_cron_run') + { + return; + } + + $cron_type = $request->get('cron_type'); + + if ($this->cron_lock->acquire()) + { + $task = $this->cron_manager->find_task($cron_type); + if ($task) + { + if ($task->is_parametrized()) + { + $task->parse_parameters($this->request); + } + + if ($task->is_ready()) + { + $task->run(); + } + + $this->cron_lock->release(); + } + } + } + + /** + * {@inheritdoc} + */ + static public function getSubscribedEvents() + { + return array( + KernelEvents::TERMINATE => 'on_kernel_terminate', + ); + } +} diff --git a/install/update/new/phpbb/cron/manager.php b/install/update/new/phpbb/cron/manager.php new file mode 100644 index 0000000..59ee693 --- /dev/null +++ b/install/update/new/phpbb/cron/manager.php @@ -0,0 +1,164 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\cron; + +use phpbb\cron\task\wrapper; +use phpbb\routing\helper; + +/** +* Cron manager class. +* +* Finds installed cron tasks, stores task objects, provides task selection. +*/ +class manager +{ + /** + * @var helper + */ + protected $routing_helper; + + /** + * Set of \phpbb\cron\task\wrapper objects. + * Array holding all tasks that have been found. + * + * @var array + */ + protected $tasks = array(); + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor. Loads all available tasks. + * + * @param array|\Traversable $tasks Provides an iterable set of task names + * @param helper $routing_helper Routing helper + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension + */ + public function __construct($tasks, helper $routing_helper, $phpbb_root_path, $php_ext) + { + $this->routing_helper = $routing_helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->load_tasks($tasks); + } + + /** + * Loads tasks given by name, wraps them + * and puts them into $this->tasks. + * + * @param array|\Traversable $tasks Array of instances of \phpbb\cron\task\task + * + * @return null + */ + public function load_tasks($tasks) + { + foreach ($tasks as $task) + { + $this->tasks[] = $this->wrap_task($task); + } + } + + /** + * Finds a task that is ready to run. + * + * If several tasks are ready, any one of them could be returned. + * + * If no tasks are ready, null is returned. + * + * @return \phpbb\cron\task\wrapper|null + */ + public function find_one_ready_task() + { + shuffle($this->tasks); + foreach ($this->tasks as $task) + { + if ($task->is_ready()) + { + return $task; + } + } + return null; + } + + /** + * Finds all tasks that are ready to run. + * + * @return array List of tasks which are ready to run (wrapped in \phpbb\cron\task\wrapper). + */ + public function find_all_ready_tasks() + { + $tasks = array(); + foreach ($this->tasks as $task) + { + if ($task->is_ready()) + { + $tasks[] = $task; + } + } + return $tasks; + } + + /** + * Finds a task by name. + * + * If there is no task with the specified name, null is returned. + * + * Web runner uses this method to resolve names to tasks. + * + * @param string $name Name of the task to look up. + * @return \phpbb\cron\task\wrapper A wrapped task corresponding to the given name, or null. + */ + public function find_task($name) + { + foreach ($this->tasks as $task) + { + if ($task->get_name() == $name) + { + return $task; + } + } + return null; + } + + /** + * Find all tasks and return them. + * + * @return array List of all tasks. + */ + public function get_tasks() + { + return $this->tasks; + } + + /** + * Wraps a task inside an instance of \phpbb\cron\task\wrapper. + * + * @param \phpbb\cron\task\task $task The task. + * @return \phpbb\cron\task\wrapper The wrapped task. + */ + public function wrap_task(\phpbb\cron\task\task $task) + { + return new wrapper($task, $this->routing_helper, $this->phpbb_root_path, $this->php_ext); + } +} diff --git a/install/update/new/phpbb/cron/task/core/update_hashes.php b/install/update/new/phpbb/cron/task/core/update_hashes.php new file mode 100644 index 0000000..9e938f7 --- /dev/null +++ b/install/update/new/phpbb/cron/task/core/update_hashes.php @@ -0,0 +1,130 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\cron\task\core; + +/** + * Update old hashes to the current default hashing algorithm + * + * It is intended to gradually update all "old" style hashes to the + * current default hashing algorithm. + */ +class update_hashes extends \phpbb\cron\task\base +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\lock\db */ + protected $update_lock; + + /** @var \phpbb\passwords\manager */ + protected $passwords_manager; + + /** @var string Default hashing type */ + protected $default_type; + + /** + * Constructor. + * + * @param \phpbb\config\config $config + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\lock\db $update_lock + * @param \phpbb\passwords\manager $passwords_manager + * @param array $hashing_algorithms Hashing driver + * service collection + * @param array $defaults Default password types + */ + public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\lock\db $update_lock, \phpbb\passwords\manager $passwords_manager, $hashing_algorithms, $defaults) + { + $this->config = $config; + $this->db = $db; + $this->passwords_manager = $passwords_manager; + $this->update_lock = $update_lock; + + foreach ($defaults as $type) + { + if ($hashing_algorithms[$type]->is_supported() && !$hashing_algorithms[$type] instanceof \phpbb\passwords\driver\base_native) + { + $this->default_type = $type; + break; + } + } + } + + /** + * {@inheritdoc} + */ + public function is_runnable() + { + return !$this->config['use_system_cron']; + } + + /** + * {@inheritdoc} + */ + public function should_run() + { + if (!empty($this->config['update_hashes_lock'])) + { + $last_run = explode(' ', $this->config['update_hashes_lock']); + if ($last_run[0] + 60 >= time()) + { + return false; + } + } + + return $this->config['enable_update_hashes'] && $this->config['update_hashes_last_cron'] < (time() - 60); + } + + /** + * {@inheritdoc} + */ + public function run() + { + if ($this->update_lock->acquire()) + { + $sql = 'SELECT user_id, user_password + FROM ' . USERS_TABLE . ' + WHERE user_password ' . $this->db->sql_like_expression('$H$' . $this->db->get_any_char()) . ' + OR user_password ' . $this->db->sql_like_expression('$CP$' . $this->db->get_any_char()); + $result = $this->db->sql_query_limit($sql, 20); + + $affected_rows = 0; + + while ($row = $this->db->sql_fetchrow($result)) + { + $new_hash = $this->passwords_manager->hash($row['user_password'], array($this->default_type)); + + // Increase number so we know that users were selected from the database + $affected_rows++; + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_password = '" . $this->db->sql_escape($new_hash) . "' + WHERE user_id = " . (int) $row['user_id']; + $this->db->sql_query($sql); + } + + $this->config->set('update_hashes_last_cron', time()); + $this->update_lock->release(); + + // Stop cron for good once all hashes are converted + if ($affected_rows === 0) + { + $this->config->set('enable_update_hashes', '0'); + } + } + } +} diff --git a/install/update/new/phpbb/cron/task/wrapper.php b/install/update/new/phpbb/cron/task/wrapper.php new file mode 100644 index 0000000..4dc3a7f --- /dev/null +++ b/install/update/new/phpbb/cron/task/wrapper.php @@ -0,0 +1,117 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\cron\task; + +use phpbb\routing\helper; + +/** +* Cron task wrapper class. +* Enhances cron tasks with convenience methods that work identically for all tasks. +*/ +class wrapper +{ + /** + * @var helper + */ + protected $routing_helper; + + /** + * @var task + */ + protected $task; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor. + * + * Wraps a task $task, which must implement cron_task interface. + * + * @param task $task The cron task to wrap. + * @param helper $routing_helper Routing helper for route generation + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension + */ + public function __construct(task $task, helper $routing_helper, $phpbb_root_path, $php_ext) + { + $this->task = $task; + $this->routing_helper = $routing_helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Returns whether the wrapped task is parametrised. + * + * Parametrized tasks accept parameters during initialization and must + * normally be scheduled with parameters. + * + * @return bool Whether or not this task is parametrized. + */ + public function is_parametrized() + { + return $this->task instanceof parametrized; + } + + /** + * Returns whether the wrapped task is ready to run. + * + * A task is ready to run when it is runnable according to current configuration + * and enough time has passed since it was last run. + * + * @return bool Whether the wrapped task is ready to run. + */ + public function is_ready() + { + return $this->task->is_runnable() && $this->task->should_run(); + } + + /** + * Returns a url through which this task may be invoked via web. + * + * When system cron is not in use, running a cron task is accomplished + * by outputting an image with the url returned by this function as + * source. + * + * @return string URL through which this task may be invoked. + */ + public function get_url() + { + $params['cron_type'] = $this->get_name(); + if ($this->is_parametrized()) + { + $params = array_merge($params, $this->task->get_parameters()); + } + + return $this->routing_helper->route('phpbb_cron_run', $params); + } + + /** + * Forwards all other method calls to the wrapped task implementation. + * + * @return mixed + */ + public function __call($name, $args) + { + return call_user_func_array(array($this->task, $name), $args); + } +} diff --git a/install/update/new/phpbb/db/driver/driver.php b/install/update/new/phpbb/db/driver/driver.php new file mode 100644 index 0000000..93f0a74 --- /dev/null +++ b/install/update/new/phpbb/db/driver/driver.php @@ -0,0 +1,1246 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* Database Abstraction Layer +*/ +abstract class driver implements driver_interface +{ + var $db_connect_id; + var $query_result; + var $return_on_error = false; + var $transaction = false; + var $sql_time = 0; + var $num_queries = array(); + var $open_queries = array(); + + var $curtime = 0; + var $query_hold = ''; + var $html_hold = ''; + var $sql_report = ''; + + var $persistency = false; + var $user = ''; + var $server = ''; + var $dbname = ''; + + // Set to true if error triggered + var $sql_error_triggered = false; + + // Holding the last sql query on sql error + var $sql_error_sql = ''; + // Holding the error information - only populated if sql_error_triggered is set + var $sql_error_returned = array(); + + // Holding transaction count + var $transactions = 0; + + // Supports multi inserts? + var $multi_insert = false; + + /** + * Current sql layer + */ + var $sql_layer = ''; + + /** + * Wildcards for matching any (%) or exactly one (_) character within LIKE expressions + */ + var $any_char; + var $one_char; + + /** + * Exact version of the DBAL, directly queried + */ + var $sql_server_version = false; + + const LOGICAL_OP = 0; + const STATEMENTS = 1; + const LEFT_STMT = 0; + const COMPARE_OP = 1; + const RIGHT_STMT = 2; + const SUBQUERY_OP = 3; + const SUBQUERY_SELECT_TYPE = 4; + const SUBQUERY_BUILD = 5; + + /** + * @var bool + */ + protected $debug_load_time = false; + + /** + * @var bool + */ + protected $debug_sql_explain = false; + + /** + * Constructor + */ + function __construct() + { + $this->num_queries = array( + 'cached' => 0, + 'normal' => 0, + 'total' => 0, + ); + + // Fill default sql layer based on the class being called. + // This can be changed by the specified layer itself later if needed. + $this->sql_layer = substr(get_class($this), strlen('phpbb\db\driver\\')); + + // Do not change this please! This variable is used to easy the use of it - and is hardcoded. + $this->any_char = chr(0) . '%'; + $this->one_char = chr(0) . '_'; + } + + /** + * {@inheritdoc} + */ + public function set_debug_load_time($value) + { + $this->debug_load_time = $value; + } + + /** + * {@inheritdoc} + */ + public function set_debug_sql_explain($value) + { + $this->debug_sql_explain = $value; + } + + /** + * {@inheritdoc} + */ + public function get_sql_layer() + { + return $this->sql_layer; + } + + /** + * {@inheritdoc} + */ + public function get_db_name() + { + return $this->dbname; + } + + /** + * {@inheritdoc} + */ + public function get_any_char() + { + return $this->any_char; + } + + /** + * {@inheritdoc} + */ + public function get_one_char() + { + return $this->one_char; + } + + /** + * {@inheritdoc} + */ + public function get_db_connect_id() + { + return $this->db_connect_id; + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_triggered() + { + return $this->sql_error_triggered; + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_sql() + { + return $this->sql_error_sql; + } + + /** + * {@inheritdoc} + */ + public function get_transaction() + { + return $this->transaction; + } + + /** + * {@inheritdoc} + */ + public function get_sql_time() + { + return $this->sql_time; + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_returned() + { + return $this->sql_error_returned; + } + + /** + * {@inheritdoc} + */ + public function get_multi_insert() + { + return $this->multi_insert; + } + + /** + * {@inheritdoc} + */ + public function set_multi_insert($multi_insert) + { + $this->multi_insert = $multi_insert; + } + + /** + * {@inheritDoc} + */ + function sql_return_on_error($fail = false) + { + $this->sql_error_triggered = false; + $this->sql_error_sql = ''; + + $this->return_on_error = $fail; + } + + /** + * {@inheritDoc} + */ + function sql_num_queries($cached = false) + { + return ($cached) ? $this->num_queries['cached'] : $this->num_queries['normal']; + } + + /** + * {@inheritDoc} + */ + function sql_add_num_queries($cached = false) + { + $this->num_queries['cached'] += ($cached !== false) ? 1 : 0; + $this->num_queries['normal'] += ($cached !== false) ? 0 : 1; + $this->num_queries['total'] += 1; + } + + /** + * {@inheritDoc} + */ + function sql_close() + { + if (!$this->db_connect_id) + { + return false; + } + + if ($this->transaction) + { + do + { + $this->sql_transaction('commit'); + } + while ($this->transaction); + } + + foreach ($this->open_queries as $query_id) + { + $this->sql_freeresult($query_id); + } + + // Connection closed correctly. Set db_connect_id to false to prevent errors + if ($result = $this->_sql_close()) + { + $this->db_connect_id = false; + } + + return $result; + } + + /** + * {@inheritDoc} + */ + function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + if (empty($query)) + { + return false; + } + + // Never use a negative total or offset + $total = ($total < 0) ? 0 : $total; + $offset = ($offset < 0) ? 0 : $offset; + + return $this->_sql_query_limit($query, $total, $offset, $cache_ttl); + } + + /** + * {@inheritDoc} + */ + function sql_fetchrowset($query_id = false) + { + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($query_id) + { + $result = array(); + while ($row = $this->sql_fetchrow($query_id)) + { + $result[] = $row; + } + + return $result; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_rowseek($rownum, &$query_id) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + if (!$query_id) + { + return false; + } + + $this->sql_freeresult($query_id); + $query_id = $this->sql_query($this->last_query_text); + + if (!$query_id) + { + return false; + } + + // We do not fetch the row for rownum == 0 because then the next resultset would be the second row + for ($i = 0; $i < $rownum; $i++) + { + if (!$this->sql_fetchrow($query_id)) + { + return false; + } + } + + return true; + } + + /** + * {@inheritDoc} + */ + function sql_fetchfield($field, $rownum = false, $query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($query_id) + { + if ($rownum !== false) + { + $this->sql_rowseek($rownum, $query_id); + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchfield($query_id, $field); + } + + $row = $this->sql_fetchrow($query_id); + return (isset($row[$field])) ? $row[$field] : false; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_like_expression($expression) + { + $expression = str_replace(array('_', '%'), array("\_", "\%"), $expression); + $expression = str_replace(array(chr(0) . "\_", chr(0) . "\%"), array('_', '%'), $expression); + + return $this->_sql_like_expression('LIKE \'' . $this->sql_escape($expression) . '\''); + } + + /** + * {@inheritDoc} + */ + function sql_not_like_expression($expression) + { + $expression = str_replace(array('_', '%'), array("\_", "\%"), $expression); + $expression = str_replace(array(chr(0) . "\_", chr(0) . "\%"), array('_', '%'), $expression); + + return $this->_sql_not_like_expression('NOT LIKE \'' . $this->sql_escape($expression) . '\''); + } + + /** + * {@inheritDoc} + */ + public function sql_case($condition, $action_true, $action_false = false) + { + $sql_case = 'CASE WHEN ' . $condition; + $sql_case .= ' THEN ' . $action_true; + $sql_case .= ($action_false !== false) ? ' ELSE ' . $action_false : ''; + $sql_case .= ' END'; + return $sql_case; + } + + /** + * {@inheritDoc} + */ + public function sql_concatenate($expr1, $expr2) + { + return $expr1 . ' || ' . $expr2; + } + + /** + * {@inheritDoc} + */ + function sql_buffer_nested_transactions() + { + return false; + } + + /** + * {@inheritDoc} + */ + function sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + // If we are within a transaction we will not open another one, but enclose the current one to not loose data (preventing auto commit) + if ($this->transaction) + { + $this->transactions++; + return true; + } + + $result = $this->_sql_transaction('begin'); + + if (!$result) + { + $this->sql_error(); + } + + $this->transaction = true; + break; + + case 'commit': + // If there was a previously opened transaction we do not commit yet... + // but count back the number of inner transactions + if ($this->transaction && $this->transactions) + { + $this->transactions--; + return true; + } + + // Check if there is a transaction (no transaction can happen if + // there was an error, with a combined rollback and error returning enabled) + // This implies we have transaction always set for autocommit db's + if (!$this->transaction) + { + return false; + } + + $result = $this->_sql_transaction('commit'); + + if (!$result) + { + $this->sql_error(); + } + + $this->transaction = false; + $this->transactions = 0; + break; + + case 'rollback': + $result = $this->_sql_transaction('rollback'); + $this->transaction = false; + $this->transactions = 0; + break; + + default: + $result = $this->_sql_transaction($status); + break; + } + + return $result; + } + + /** + * {@inheritDoc} + */ + function sql_build_array($query, $assoc_ary = false) + { + if (!is_array($assoc_ary)) + { + return false; + } + + $fields = $values = array(); + + if ($query == 'INSERT' || $query == 'INSERT_SELECT') + { + foreach ($assoc_ary as $key => $var) + { + $fields[] = $key; + + if (is_array($var) && is_string($var[0])) + { + // This is used for INSERT_SELECT(s) + $values[] = $var[0]; + } + else + { + $values[] = $this->_sql_validate_value($var); + } + } + + $query = ($query == 'INSERT') ? ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')' : ' (' . implode(', ', $fields) . ') SELECT ' . implode(', ', $values) . ' '; + } + else if ($query == 'MULTI_INSERT') + { + trigger_error('The MULTI_INSERT query value is no longer supported. Please use sql_multi_insert() instead.', E_USER_ERROR); + } + else if ($query == 'UPDATE' || $query == 'SELECT' || $query == 'DELETE') + { + $values = array(); + foreach ($assoc_ary as $key => $var) + { + $values[] = "$key = " . $this->_sql_validate_value($var); + } + $query = implode(($query == 'UPDATE') ? ', ' : ' AND ', $values); + } + + return $query; + } + + /** + * {@inheritDoc} + */ + function sql_in_set($field, $array, $negate = false, $allow_empty_set = false) + { + $array = (array) $array; + + if (!count($array)) + { + if (!$allow_empty_set) + { + // Print the backtrace to help identifying the location of the problematic code + $this->sql_error('No values specified for SQL IN comparison'); + } + else + { + // NOT IN () actually means everything so use a tautology + if ($negate) + { + return '1=1'; + } + // IN () actually means nothing so use a contradiction + else + { + return '1=0'; + } + } + } + + if (count($array) == 1) + { + @reset($array); + $var = current($array); + + return $field . ($negate ? ' <> ' : ' = ') . $this->_sql_validate_value($var); + } + else + { + return $field . ($negate ? ' NOT IN ' : ' IN ') . '(' . implode(', ', array_map(array($this, '_sql_validate_value'), $array)) . ')'; + } + } + + /** + * {@inheritDoc} + */ + function sql_bit_and($column_name, $bit, $compare = '') + { + if (method_exists($this, '_sql_bit_and')) + { + return $this->_sql_bit_and($column_name, $bit, $compare); + } + + return $column_name . ' & ' . (1 << $bit) . (($compare) ? ' ' . $compare : ''); + } + + /** + * {@inheritDoc} + */ + function sql_bit_or($column_name, $bit, $compare = '') + { + if (method_exists($this, '_sql_bit_or')) + { + return $this->_sql_bit_or($column_name, $bit, $compare); + } + + return $column_name . ' | ' . (1 << $bit) . (($compare) ? ' ' . $compare : ''); + } + + /** + * {@inheritDoc} + */ + function cast_expr_to_bigint($expression) + { + return $expression; + } + + /** + * {@inheritDoc} + */ + function cast_expr_to_string($expression) + { + return $expression; + } + + /** + * {@inheritDoc} + */ + function sql_lower_text($column_name) + { + return "LOWER($column_name)"; + } + + /** + * {@inheritDoc} + */ + function sql_multi_insert($table, $sql_ary) + { + if (!count($sql_ary)) + { + return false; + } + + if ($this->multi_insert) + { + $ary = array(); + foreach ($sql_ary as $id => $_sql_ary) + { + // If by accident the sql array is only one-dimensional we build a normal insert statement + if (!is_array($_sql_ary)) + { + return $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $sql_ary)); + } + + $values = array(); + foreach ($_sql_ary as $key => $var) + { + $values[] = $this->_sql_validate_value($var); + } + $ary[] = '(' . implode(', ', $values) . ')'; + } + + return $this->sql_query('INSERT INTO ' . $table . ' ' . ' (' . implode(', ', array_keys($sql_ary[0])) . ') VALUES ' . implode(', ', $ary)); + } + else + { + foreach ($sql_ary as $ary) + { + if (!is_array($ary)) + { + return false; + } + + $result = $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $ary)); + + if (!$result) + { + return false; + } + } + } + + return true; + } + + /** + * Function for validating values + * @access private + */ + function _sql_validate_value($var) + { + if (is_null($var)) + { + return 'NULL'; + } + else if (is_string($var)) + { + return "'" . $this->sql_escape($var) . "'"; + } + else + { + return (is_bool($var)) ? intval($var) : $var; + } + } + + /** + * {@inheritDoc} + */ + function sql_build_query($query, $array) + { + $sql = ''; + switch ($query) + { + case 'SELECT': + case 'SELECT_DISTINCT'; + + $sql = str_replace('_', ' ', $query) . ' ' . $array['SELECT'] . ' FROM '; + + // Build table array. We also build an alias array for later checks. + $table_array = $aliases = array(); + $used_multi_alias = false; + + foreach ($array['FROM'] as $table_name => $alias) + { + if (is_array($alias)) + { + $used_multi_alias = true; + + foreach ($alias as $multi_alias) + { + $table_array[] = $table_name . ' ' . $multi_alias; + $aliases[] = $multi_alias; + } + } + else + { + $table_array[] = $table_name . ' ' . $alias; + $aliases[] = $alias; + } + } + + // We run the following code to determine if we need to re-order the table array. ;) + // The reason for this is that for multi-aliased tables (two equal tables) in the FROM statement the last table need to match the first comparison. + // DBMS who rely on this: Oracle, PostgreSQL and MSSQL. For all other DBMS it makes absolutely no difference in which order the table is. + if (!empty($array['LEFT_JOIN']) && count($array['FROM']) > 1 && $used_multi_alias !== false) + { + // Take first LEFT JOIN + $join = current($array['LEFT_JOIN']); + + // Determine the table used there (even if there are more than one used, we only want to have one + preg_match('/(' . implode('|', $aliases) . ')\.[^\s]+/U', str_replace(array('(', ')', 'AND', 'OR', ' '), '', $join['ON']), $matches); + + // If there is a first join match, we need to make sure the table order is correct + if (!empty($matches[1])) + { + $first_join_match = trim($matches[1]); + $table_array = $last = array(); + + foreach ($array['FROM'] as $table_name => $alias) + { + if (is_array($alias)) + { + foreach ($alias as $multi_alias) + { + ($multi_alias === $first_join_match) ? $last[] = $table_name . ' ' . $multi_alias : $table_array[] = $table_name . ' ' . $multi_alias; + } + } + else + { + ($alias === $first_join_match) ? $last[] = $table_name . ' ' . $alias : $table_array[] = $table_name . ' ' . $alias; + } + } + + $table_array = array_merge($table_array, $last); + } + } + + $sql .= $this->_sql_custom_build('FROM', implode(' CROSS JOIN ', $table_array)); + + if (!empty($array['LEFT_JOIN'])) + { + foreach ($array['LEFT_JOIN'] as $join) + { + $sql .= ' LEFT JOIN ' . key($join['FROM']) . ' ' . current($join['FROM']) . ' ON (' . $join['ON'] . ')'; + } + } + + if (!empty($array['WHERE'])) + { + $sql .= ' WHERE '; + + if (is_array($array['WHERE'])) + { + $sql_where = $this->_process_boolean_tree_first($array['WHERE']); + } + else + { + $sql_where = $array['WHERE']; + } + + $sql .= $this->_sql_custom_build('WHERE', $sql_where); + } + + if (!empty($array['GROUP_BY'])) + { + $sql .= ' GROUP BY ' . $array['GROUP_BY']; + } + + if (!empty($array['ORDER_BY'])) + { + $sql .= ' ORDER BY ' . $array['ORDER_BY']; + } + + break; + } + + return $sql; + } + + + protected function _process_boolean_tree_first($operations_ary) + { + // In cases where an array exists but there is no head condition, + // it should be because there's only 1 WHERE clause. This seems the best way to deal with it. + if ($operations_ary[self::LOGICAL_OP] !== 'AND' && + $operations_ary[self::LOGICAL_OP] !== 'OR') + { + $operations_ary = array('AND', array($operations_ary)); + } + return $this->_process_boolean_tree($operations_ary) . "\n"; + } + + protected function _process_boolean_tree($operations_ary) + { + $operation = $operations_ary[self::LOGICAL_OP]; + + foreach ($operations_ary[self::STATEMENTS] as &$condition) + { + switch ($condition[self::LOGICAL_OP]) + { + case 'AND': + case 'OR': + + $condition = ' ( ' . $this->_process_boolean_tree($condition) . ') '; + + break; + case 'NOT': + + $condition = ' NOT (' . $this->_process_boolean_tree($condition) . ') '; + + break; + + default: + + switch (count($condition)) + { + case 3: + + // Typical 3 element clause with {left hand} {operator} {right hand} + switch ($condition[self::COMPARE_OP]) + { + case 'IN': + case 'NOT_IN': + + // As this is used with an IN, assume it is a set of elements for sql_in_set() + $condition = $this->sql_in_set($condition[self::LEFT_STMT], $condition[self::RIGHT_STMT], $condition[self::COMPARE_OP] === 'NOT_IN', true); + + break; + + case 'LIKE': + + $condition = $condition[self::LEFT_STMT] . ' ' . $this->sql_like_expression($condition[self::RIGHT_STMT]) . ' '; + + break; + + case 'NOT_LIKE': + + $condition = $condition[self::LEFT_STMT] . ' ' . $this->sql_not_like_expression($condition[self::RIGHT_STMT]) . ' '; + + break; + + case 'IS_NOT': + + $condition[self::COMPARE_OP] = 'IS NOT'; + + // no break + case 'IS': + + // If the value is NULL, the string of it is the empty string ('') which is not the intended result. + // this should solve that + if ($condition[self::RIGHT_STMT] === null) + { + $condition[self::RIGHT_STMT] = 'NULL'; + } + + $condition = implode(' ', $condition); + + break; + + default: + + $condition = implode(' ', $condition); + + break; + } + + break; + + case 5: + + // Subquery with {left hand} {operator} {compare kind} {SELECT Kind } {Sub Query} + + $result = $condition[self::LEFT_STMT] . ' ' . $condition[self::COMPARE_OP] . ' ' . $condition[self::SUBQUERY_OP] . ' ( '; + $result .= $this->sql_build_query($condition[self::SUBQUERY_SELECT_TYPE], $condition[self::SUBQUERY_BUILD]); + $result .= ' )'; + $condition = $result; + + break; + + default: + // This is an unpredicted clause setup. Just join all elements. + $condition = implode(' ', $condition); + + break; + } + + break; + } + + } + + if ($operation === 'NOT') + { + $operations_ary = implode("", $operations_ary[self::STATEMENTS]); + } + else + { + $operations_ary = implode(" \n $operation ", $operations_ary[self::STATEMENTS]); + } + + return $operations_ary; + } + + + /** + * {@inheritDoc} + */ + function sql_error($sql = '') + { + global $auth, $user, $config; + + // Set var to retrieve errored status + $this->sql_error_triggered = true; + $this->sql_error_sql = $sql; + + $this->sql_error_returned = $this->_sql_error(); + + if (!$this->return_on_error) + { + $message = 'SQL ERROR [ ' . $this->sql_layer . ' ]

' . $this->sql_error_returned['message'] . ' [' . $this->sql_error_returned['code'] . ']'; + + // Show complete SQL error and path to administrators only + // Additionally show complete error on installation or if extended debug mode is enabled + // The DEBUG constant is for development only! + if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || $this->debug_sql_explain) + { + $message .= ($sql) ? '

SQL

' . htmlspecialchars($sql) : ''; + } + else + { + // If error occurs in initiating the session we need to use a pre-defined language string + // This could happen if the connection could not be established for example (then we are not able to grab the default language) + if (!isset($user->lang['SQL_ERROR_OCCURRED'])) + { + $message .= '

An sql error occurred while fetching this page. Please contact an administrator if this problem persists.'; + } + else + { + if (!empty($config['board_contact'])) + { + $message .= '

' . sprintf($user->lang['SQL_ERROR_OCCURRED'], '', ''); + } + else + { + $message .= '

' . sprintf($user->lang['SQL_ERROR_OCCURRED'], '', ''); + } + } + } + + if ($this->transaction) + { + $this->sql_transaction('rollback'); + } + + if (strlen($message) > 1024) + { + // We need to define $msg_long_text here to circumvent text stripping. + global $msg_long_text; + $msg_long_text = $message; + + trigger_error(false, E_USER_ERROR); + } + + trigger_error($message, E_USER_ERROR); + } + + if ($this->transaction) + { + $this->sql_transaction('rollback'); + } + + return $this->sql_error_returned; + } + + /** + * {@inheritDoc} + */ + function sql_report($mode, $query = '') + { + global $cache, $starttime, $phpbb_root_path, $phpbb_path_helper; + global $request; + + if (is_object($request) && !$request->variable('explain', false)) + { + return false; + } + + if (!$query && $this->query_hold != '') + { + $query = $this->query_hold; + } + + switch ($mode) + { + case 'display': + if (!empty($cache)) + { + $cache->unload(); + } + $this->sql_close(); + + $mtime = explode(' ', microtime()); + $totaltime = $mtime[0] + $mtime[1] - $starttime; + + echo ' + + + + + SQL Report + + + +
+ +
+
+
+ +
+

SQL Report

+
+

Page generated in ' . round($totaltime, 4) . " seconds with {$this->num_queries['normal']} queries" . (($this->num_queries['cached']) ? " + {$this->num_queries['cached']} " . (($this->num_queries['cached'] == 1) ? 'query' : 'queries') . ' returning data from cache' : '') . '

+ +

Time spent on ' . $this->sql_layer . ' queries: ' . round($this->sql_time, 5) . 's | Time spent on PHP: ' . round($totaltime - $this->sql_time, 5) . 's

+ +

+ ' . $this->sql_report . ' +
+ +
+
+
+ +
+ + '; + + exit_handler(); + + break; + + case 'stop': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $this->sql_report .= ' + + + + + + + + + + + + +
Query #' . $this->num_queries['total'] . '
+ + ' . $this->html_hold . ' + +

+ '; + + if ($this->query_result) + { + if (preg_match('/^(UPDATE|DELETE|REPLACE)/', $query)) + { + $this->sql_report .= 'Affected rows: ' . $this->sql_affectedrows() . ' | '; + } + $this->sql_report .= 'Before: ' . sprintf('%.5f', $this->curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed: ' . sprintf('%.5f', $endtime - $this->curtime) . 's'; + } + else + { + $error = $this->sql_error(); + $this->sql_report .= 'FAILED - ' . $this->sql_layer . ' Error ' . $error['code'] . ': ' . htmlspecialchars($error['message']); + } + + $this->sql_report .= '



'; + + $this->sql_time += $endtime - $this->curtime; + break; + + case 'start': + $this->query_hold = $query; + $this->html_hold = ''; + + $this->_sql_report($mode, $query); + + $this->curtime = explode(' ', microtime()); + $this->curtime = $this->curtime[0] + $this->curtime[1]; + + break; + + case 'add_select_row': + + $html_table = func_get_arg(2); + $row = func_get_arg(3); + + if (!$html_table && count($row)) + { + $html_table = true; + $this->html_hold .= ''; + + foreach (array_keys($row) as $val) + { + $this->html_hold .= ''; + } + $this->html_hold .= ''; + } + $this->html_hold .= ''; + + $class = 'row1'; + foreach (array_values($row) as $val) + { + $class = ($class == 'row1') ? 'row2' : 'row1'; + $this->html_hold .= ''; + } + $this->html_hold .= ''; + + return $html_table; + + break; + + case 'fromcache': + + $this->_sql_report($mode, $query); + + break; + + case 'record_fromcache': + + $endtime = func_get_arg(2); + $splittime = func_get_arg(3); + + $time_cache = $endtime - $this->curtime; + $time_db = $splittime - $endtime; + $color = ($time_db > $time_cache) ? 'green' : 'red'; + + $this->sql_report .= '
' . (($val) ? ucwords(str_replace('_', ' ', $val)) : ' ') . '
' . (($val) ? $val : ' ') . '
'; + $this->sql_report .= '
Query results obtained from the cache
'; + $this->sql_report .= '

'; + $this->sql_report .= 'Before: ' . sprintf('%.5f', $this->curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed [cache]: ' . sprintf('%.5f', ($time_cache)) . 's | Elapsed [db]: ' . sprintf('%.5f', $time_db) . 's



'; + + // Pad the start time to not interfere with page timing + $starttime += $time_db; + + break; + + default: + + $this->_sql_report($mode, $query); + + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + function get_estimated_row_count($table_name) + { + return $this->get_row_count($table_name); + } + + /** + * {@inheritDoc} + */ + function get_row_count($table_name) + { + $sql = 'SELECT COUNT(*) AS rows_total + FROM ' . $this->sql_escape($table_name); + $result = $this->sql_query($sql); + $rows_total = $this->sql_fetchfield('rows_total'); + $this->sql_freeresult($result); + + return $rows_total; + } +} diff --git a/install/update/new/phpbb/db/driver/driver_interface.php b/install/update/new/phpbb/db/driver/driver_interface.php new file mode 100644 index 0000000..05ff5ef --- /dev/null +++ b/install/update/new/phpbb/db/driver/driver_interface.php @@ -0,0 +1,467 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +interface driver_interface +{ + /** + * Set value for load_time debug parameter + * + * @param bool $value + */ + public function set_debug_load_time($value); + + /** + * Set value for sql_explain debug parameter + * + * @param bool $value + */ + public function set_debug_sql_explain($value); + + /** + * Gets the name of the sql layer. + * + * @return string + */ + public function get_sql_layer(); + + /** + * Gets the name of the database. + * + * @return string + */ + public function get_db_name(); + + /** + * Wildcards for matching any (%) character within LIKE expressions + * + * @return string + */ + public function get_any_char(); + + /** + * Wildcards for matching exactly one (_) character within LIKE expressions + * + * @return string + */ + public function get_one_char(); + + /** + * Gets the time spent into the queries + * + * @return int + */ + public function get_sql_time(); + + /** + * Gets the connect ID. + * + * @return mixed + */ + public function get_db_connect_id(); + + /** + * Indicates if an error was triggered. + * + * @return bool + */ + public function get_sql_error_triggered(); + + /** + * Gets the last faulty query + * + * @return string + */ + public function get_sql_error_sql(); + + /** + * Indicates if we are in a transaction. + * + * @return bool + */ + public function get_transaction(); + + /** + * Gets the returned error. + * + * @return array + */ + public function get_sql_error_returned(); + + /** + * Indicates if multiple insertion can be used + * + * @return bool + */ + public function get_multi_insert(); + + /** + * Set if multiple insertion can be used + * + * @param bool $multi_insert + */ + public function set_multi_insert($multi_insert); + + /** + * Gets the exact number of rows in a specified table. + * + * @param string $table_name Table name + * @return string Exact number of rows in $table_name. + */ + public function get_row_count($table_name); + + /** + * Gets the estimated number of rows in a specified table. + * + * @param string $table_name Table name + * @return string Number of rows in $table_name. + * Prefixed with ~ if estimated (otherwise exact). + */ + public function get_estimated_row_count($table_name); + + /** + * Run LOWER() on DB column of type text (i.e. neither varchar nor char). + * + * @param string $column_name The column name to use + * @return string A SQL statement like "LOWER($column_name)" + */ + public function sql_lower_text($column_name); + + /** + * Display sql error page + * + * @param string $sql The SQL query causing the error + * @return mixed Returns the full error message, if $this->return_on_error + * is set, null otherwise + */ + public function sql_error($sql = ''); + + /** + * Returns whether results of a query need to be buffered to run a + * transaction while iterating over them. + * + * @return bool Whether buffering is required. + */ + public function sql_buffer_nested_transactions(); + + /** + * Run binary OR operator on DB column. + * + * @param string $column_name The column name to use + * @param int $bit The value to use for the OR operator, + * will be converted to (1 << $bit). Is used by options, + * using the number schema... 0, 1, 2...29 + * @param string $compare Any custom SQL code after the check (e.g. "= 0") + * @return string A SQL statement like "$column | (1 << $bit) {$compare}" + */ + public function sql_bit_or($column_name, $bit, $compare = ''); + + /** + * Version information about used database + * + * @param bool $raw Only return the fetched sql_server_version + * @param bool $use_cache Is it safe to retrieve the value from the cache + * @return string sql server version + */ + public function sql_server_info($raw = false, $use_cache = true); + + /** + * Return on error or display error message + * + * @param bool $fail Should we return on errors, or stop + * @return null + */ + public function sql_return_on_error($fail = false); + + /** + * Build sql statement from an array + * + * @param string $query Should be on of the following strings: + * INSERT, INSERT_SELECT, UPDATE, SELECT, DELETE + * @param array $assoc_ary Array with "column => value" pairs + * @return string A SQL statement like "c1 = 'a' AND c2 = 'b'" + */ + public function sql_build_array($query, $assoc_ary = array()); + + /** + * Fetch all rows + * + * @param mixed $query_id Already executed query to get the rows from, + * if false, the last query will be used. + * @return mixed Nested array if the query had rows, false otherwise + */ + public function sql_fetchrowset($query_id = false); + + /** + * SQL Transaction + * + * @param string $status Should be one of the following strings: + * begin, commit, rollback + * @return mixed Buffered, seekable result handle, false on error + */ + public function sql_transaction($status = 'begin'); + + /** + * Build a concatenated expression + * + * @param string $expr1 Base SQL expression where we append the second one + * @param string $expr2 SQL expression that is appended to the first expression + * @return string Concatenated string + */ + public function sql_concatenate($expr1, $expr2); + + /** + * Build a case expression + * + * Note: The two statements action_true and action_false must have the same + * data type (int, vchar, ...) in the database! + * + * @param string $condition The condition which must be true, + * to use action_true rather then action_else + * @param string $action_true SQL expression that is used, if the condition is true + * @param mixed $action_false SQL expression that is used, if the condition is false + * @return string CASE expression including the condition and statements + */ + public function sql_case($condition, $action_true, $action_false = false); + + /** + * Build sql statement from array for select and select distinct statements + * + * Possible query values: SELECT, SELECT_DISTINCT + * + * @param string $query Should be one of: SELECT, SELECT_DISTINCT + * @param array $array Array with the query data: + * SELECT A comma imploded list of columns to select + * FROM Array with "table => alias" pairs, + * (alias can also be an array) + * Optional: LEFT_JOIN Array of join entries: + * FROM Table that should be joined + * ON Condition for the join + * Optional: WHERE Where SQL statement + * Optional: GROUP_BY Group by SQL statement + * Optional: ORDER_BY Order by SQL statement + * @return string A SQL statement ready for execution + */ + public function sql_build_query($query, $array); + + /** + * Fetch field + * if rownum is false, the current row is used, else it is pointing to the row (zero-based) + * + * @param string $field Name of the column + * @param mixed $rownum Row number, if false the current row will be used + * and the row curser will point to the next row + * Note: $rownum is 0 based + * @param mixed $query_id Already executed query to get the rows from, + * if false, the last query will be used. + * @return mixed String value of the field in the selected row, + * false, if the row does not exist + */ + public function sql_fetchfield($field, $rownum = false, $query_id = false); + + /** + * Fetch current row + * + * @param mixed $query_id Already executed query to get the rows from, + * if false, the last query will be used. + * @return mixed Array with the current row, + * false, if the row does not exist + */ + public function sql_fetchrow($query_id = false); + + /** + * Returns SQL string to cast a string expression to an int. + * + * @param string $expression An expression evaluating to string + * @return string Expression returning an int + */ + public function cast_expr_to_bigint($expression); + + /** + * Get last inserted id after insert statement + * + * @return string Autoincrement value of the last inserted row + */ + public function sql_nextid(); + + /** + * Add to query count + * + * @param bool $cached Is this query cached? + * @return null + */ + public function sql_add_num_queries($cached = false); + + /** + * Build LIMIT query + * + * @param string $query The SQL query to execute + * @param int $total The number of rows to select + * @param int $offset + * @param int $cache_ttl Either 0 to avoid caching or + * the time in seconds which the result shall be kept in cache + * @return mixed Buffered, seekable result handle, false on error + */ + public function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0); + + /** + * Base query method + * + * @param string $query The SQL query to execute + * @param int $cache_ttl Either 0 to avoid caching or + * the time in seconds which the result shall be kept in cache + * @return mixed Buffered, seekable result handle, false on error + */ + public function sql_query($query = '', $cache_ttl = 0); + + /** + * Returns SQL string to cast an integer expression to a string. + * + * @param string $expression An expression evaluating to int + * @return string Expression returning a string + */ + public function cast_expr_to_string($expression); + + /** + * Connect to server + * + * @param string $sqlserver Address of the database server + * @param string $sqluser User name of the SQL user + * @param string $sqlpassword Password of the SQL user + * @param string $database Name of the database + * @param mixed $port Port of the database server + * @param bool $persistency + * @param bool $new_link Should a new connection be established + * @return mixed Connection ID on success, string error message otherwise + */ + public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false); + + /** + * Run binary AND operator on DB column. + * Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}" + * + * @param string $column_name The column name to use + * @param int $bit The value to use for the AND operator, + * will be converted to (1 << $bit). Is used by + * options, using the number schema: 0, 1, 2...29 + * @param string $compare Any custom SQL code after the check (for example "= 0") + * @return string A SQL statement like: "{$column} & (1 << {$bit}) {$compare}" + */ + public function sql_bit_and($column_name, $bit, $compare = ''); + + /** + * Free sql result + * + * @param mixed $query_id Already executed query result, + * if false, the last query will be used. + * @return null + */ + public function sql_freeresult($query_id = false); + + /** + * Return number of sql queries and cached sql queries used + * + * @param bool $cached Should we return the number of cached or normal queries? + * @return int Number of queries that have been executed + */ + public function sql_num_queries($cached = false); + + /** + * Run more than one insert statement. + * + * @param string $table Table name to run the statements on + * @param array $sql_ary Multi-dimensional array holding the statement data + * @return bool false if no statements were executed. + */ + public function sql_multi_insert($table, $sql_ary); + + /** + * Return number of affected rows + * + * @return mixed Number of the affected rows by the last query + * false if no query has been run before + */ + public function sql_affectedrows(); + + /** + * DBAL garbage collection, close SQL connection + * + * @return mixed False if no connection was opened before, + * Server response otherwise + */ + public function sql_close(); + + /** + * Seek to given row number + * + * @param mixed $rownum Row number the curser should point to + * Note: $rownum is 0 based + * @param mixed $query_id ID of the query to set the row cursor on + * if false, the last query will be used. + * $query_id will then be set correctly + * @return bool False if something went wrong + */ + public function sql_rowseek($rownum, &$query_id); + + /** + * Escape string used in sql query + * + * @param string $msg String to be escaped + * @return string Escaped version of $msg + */ + public function sql_escape($msg); + + /** + * Correctly adjust LIKE expression for special characters + * Some DBMS are handling them in a different way + * + * @param string $expression The expression to use. Every wildcard is + * escaped, except $this->any_char and $this->one_char + * @return string A SQL statement like: "LIKE 'bertie_%'" + */ + public function sql_like_expression($expression); + + /** + * Correctly adjust NOT LIKE expression for special characters + * Some DBMS are handling them in a different way + * + * @param string $expression The expression to use. Every wildcard is + * escaped, except $this->any_char and $this->one_char + * @return string A SQL statement like: "NOT LIKE 'bertie_%'" + */ + public function sql_not_like_expression($expression); + + /** + * Explain queries + * + * @param string $mode Available modes: display, start, stop, + * add_select_row, fromcache, record_fromcache + * @param string $query The Query that should be explained + * @return mixed Either a full HTML page, boolean or null + */ + public function sql_report($mode, $query = ''); + + /** + * Build IN or NOT IN sql comparison string, uses <> or = on single element + * arrays to improve comparison speed + * + * @param string $field Name of the sql column that shall be compared + * @param array $array Array of values that are (not) allowed + * @param bool $negate true for NOT IN (), false for IN () + * @param bool $allow_empty_set If true, allow $array to be empty, + * this function will return 1=1 or 1=0 then. + * @return string A SQL statement like: "IN (1, 2, 3, 4)" or "= 1" + */ + public function sql_in_set($field, $array, $negate = false, $allow_empty_set = false); +} diff --git a/install/update/new/phpbb/db/driver/factory.php b/install/update/new/phpbb/db/driver/factory.php new file mode 100644 index 0000000..bb6e7a2 --- /dev/null +++ b/install/update/new/phpbb/db/driver/factory.php @@ -0,0 +1,459 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +use \Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* Database Abstraction Layer +*/ +class factory implements driver_interface +{ + /** + * @var driver_interface + */ + protected $driver = null; + + /** + * @var ContainerInterface + */ + protected $container; + + /** + * Constructor. + * + * @param ContainerInterface $container A ContainerInterface instance + */ + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + /** + * Return the current driver (and retrieved it from the container if necessary) + * + * @return driver_interface + */ + protected function get_driver() + { + if ($this->driver === null) + { + $this->driver = $this->container->get('dbal.conn.driver'); + } + + return $this->driver; + } + + /** + * Set the current driver + * + * @param driver_interface $driver + */ + public function set_driver(driver_interface $driver) + { + $this->driver = $driver; + } + + /** + * {@inheritdoc} + */ + public function set_debug_load_time($value) + { + $this->get_driver()->set_debug_load_time($value); + } + + /** + * {@inheritdoc} + */ + public function set_debug_sql_explain($value) + { + $this->get_driver()->set_debug_sql_explain($value); + } + + /** + * {@inheritdoc} + */ + public function get_sql_layer() + { + return $this->get_driver()->get_sql_layer(); + } + + /** + * {@inheritdoc} + */ + public function get_db_name() + { + return $this->get_driver()->get_db_name(); + } + + /** + * {@inheritdoc} + */ + public function get_any_char() + { + return $this->get_driver()->get_any_char(); + } + + /** + * {@inheritdoc} + */ + public function get_one_char() + { + return $this->get_driver()->get_one_char(); + } + + /** + * {@inheritdoc} + */ + public function get_db_connect_id() + { + return $this->get_driver()->get_db_connect_id(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_triggered() + { + return $this->get_driver()->get_sql_error_triggered(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_sql() + { + return $this->get_driver()->get_sql_error_sql(); + } + + /** + * {@inheritdoc} + */ + public function get_transaction() + { + return $this->get_driver()->get_transaction(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_time() + { + return $this->get_driver()->get_sql_time(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_returned() + { + return $this->get_driver()->get_sql_error_returned(); + } + + /** + * {@inheritdoc} + */ + public function get_multi_insert() + { + return $this->get_driver()->get_multi_insert(); + } + + /** + * {@inheritdoc} + */ + public function set_multi_insert($multi_insert) + { + $this->get_driver()->set_multi_insert($multi_insert); + } + + /** + * {@inheritdoc} + */ + public function get_row_count($table_name) + { + return $this->get_driver()->get_row_count($table_name); + } + + /** + * {@inheritdoc} + */ + public function get_estimated_row_count($table_name) + { + return $this->get_driver()->get_estimated_row_count($table_name); + } + + /** + * {@inheritdoc} + */ + public function sql_lower_text($column_name) + { + return $this->get_driver()->sql_lower_text($column_name); + } + + /** + * {@inheritdoc} + */ + public function sql_error($sql = '') + { + return $this->get_driver()->sql_error($sql); + } + + /** + * {@inheritdoc} + */ + public function sql_buffer_nested_transactions() + { + return $this->get_driver()->sql_buffer_nested_transactions(); + } + + /** + * {@inheritdoc} + */ + public function sql_bit_or($column_name, $bit, $compare = '') + { + return $this->get_driver()->sql_bit_or($column_name, $bit, $compare); + } + + /** + * {@inheritdoc} + */ + public function sql_server_info($raw = false, $use_cache = true) + { + return $this->get_driver()->sql_server_info($raw, $use_cache); + } + + /** + * {@inheritdoc} + */ + public function sql_return_on_error($fail = false) + { + return $this->get_driver()->sql_return_on_error($fail); + } + + /** + * {@inheritdoc} + */ + public function sql_build_array($query, $assoc_ary = array()) + { + return $this->get_driver()->sql_build_array($query, $assoc_ary); + } + + /** + * {@inheritdoc} + */ + public function sql_fetchrowset($query_id = false) + { + return $this->get_driver()->sql_fetchrowset($query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_transaction($status = 'begin') + { + return $this->get_driver()->sql_transaction($status); + } + + /** + * {@inheritdoc} + */ + public function sql_concatenate($expr1, $expr2) + { + return $this->get_driver()->sql_concatenate($expr1, $expr2); + } + + /** + * {@inheritdoc} + */ + public function sql_case($condition, $action_true, $action_false = false) + { + return $this->get_driver()->sql_case($condition, $action_true, $action_false); + } + + /** + * {@inheritdoc} + */ + public function sql_build_query($query, $array) + { + return $this->get_driver()->sql_build_query($query, $array); + } + + /** + * {@inheritdoc} + */ + public function sql_fetchfield($field, $rownum = false, $query_id = false) + { + return $this->get_driver()->sql_fetchfield($field, $rownum, $query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_fetchrow($query_id = false) + { + return $this->get_driver()->sql_fetchrow($query_id); + } + + /** + * {@inheritdoc} + */ + public function cast_expr_to_bigint($expression) + { + return $this->get_driver()->cast_expr_to_bigint($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_nextid() + { + return $this->get_driver()->sql_nextid(); + } + + /** + * {@inheritdoc} + */ + public function sql_add_num_queries($cached = false) + { + return $this->get_driver()->sql_add_num_queries($cached); + } + + /** + * {@inheritdoc} + */ + public function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + return $this->get_driver()->sql_query_limit($query, $total, $offset, $cache_ttl); + } + + /** + * {@inheritdoc} + */ + public function sql_query($query = '', $cache_ttl = 0) + { + return $this->get_driver()->sql_query($query, $cache_ttl); + } + + /** + * {@inheritdoc} + */ + public function cast_expr_to_string($expression) + { + return $this->get_driver()->cast_expr_to_string($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + throw new \Exception('Disabled method.'); + } + + /** + * {@inheritdoc} + */ + public function sql_bit_and($column_name, $bit, $compare = '') + { + return $this->get_driver()->sql_bit_and($column_name, $bit, $compare); + } + + /** + * {@inheritdoc} + */ + public function sql_freeresult($query_id = false) + { + return $this->get_driver()->sql_freeresult($query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_num_queries($cached = false) + { + return $this->get_driver()->sql_num_queries($cached); + } + + /** + * {@inheritdoc} + */ + public function sql_multi_insert($table, $sql_ary) + { + return $this->get_driver()->sql_multi_insert($table, $sql_ary); + } + + /** + * {@inheritdoc} + */ + public function sql_affectedrows() + { + return $this->get_driver()->sql_affectedrows(); + } + + /** + * {@inheritdoc} + */ + public function sql_close() + { + return $this->get_driver()->sql_close(); + } + + /** + * {@inheritdoc} + */ + public function sql_rowseek($rownum, &$query_id) + { + return $this->get_driver()->sql_rowseek($rownum, $query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_escape($msg) + { + return $this->get_driver()->sql_escape($msg); + } + + /** + * {@inheritdoc} + */ + public function sql_like_expression($expression) + { + return $this->get_driver()->sql_like_expression($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_not_like_expression($expression) + { + return $this->get_driver()->sql_not_like_expression($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_report($mode, $query = '') + { + return $this->get_driver()->sql_report($mode, $query); + } + + /** + * {@inheritdoc} + */ + public function sql_in_set($field, $array, $negate = false, $allow_empty_set = false) + { + return $this->get_driver()->sql_in_set($field, $array, $negate, $allow_empty_set); + } +} diff --git a/install/update/new/phpbb/db/driver/mssql_odbc.php b/install/update/new/phpbb/db/driver/mssql_odbc.php new file mode 100644 index 0000000..06cdce7 --- /dev/null +++ b/install/update/new/phpbb/db/driver/mssql_odbc.php @@ -0,0 +1,384 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* Unified ODBC functions +* Unified ODBC functions support any database having ODBC driver, for example Adabas D, IBM DB2, iODBC, Solid, Sybase SQL Anywhere... +* Here we only support MSSQL Server 2000+ because of the provided schema +* +* @note number of bytes returned for returning data depends on odbc.defaultlrl php.ini setting. +* If it is limited to 4K for example only 4K of data is returned max, resulting in incomplete theme data for example. +* @note odbc.defaultbinmode may affect UTF8 characters +*/ +class mssql_odbc extends \phpbb\db\driver\mssql_base +{ + var $last_query_text = ''; + var $connect_error = ''; + + /** + * {@inheritDoc} + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + $this->persistency = $persistency; + $this->user = $sqluser; + $this->dbname = $database; + + $port_delimiter = (defined('PHP_OS') && substr(PHP_OS, 0, 3) === 'WIN') ? ',' : ':'; + $this->server = $sqlserver . (($port) ? $port_delimiter . $port : ''); + + $max_size = @ini_get('odbc.defaultlrl'); + if (!empty($max_size)) + { + $unit = strtolower(substr($max_size, -1, 1)); + $max_size = (int) $max_size; + + if ($unit == 'k') + { + $max_size = floor($max_size / 1024); + } + else if ($unit == 'g') + { + $max_size *= 1024; + } + else if (is_numeric($unit)) + { + $max_size = floor((int) ($max_size . $unit) / 1048576); + } + $max_size = max(8, $max_size) . 'M'; + + @ini_set('odbc.defaultlrl', $max_size); + } + + if ($this->persistency) + { + if (!function_exists('odbc_pconnect')) + { + $this->connect_error = 'odbc_pconnect function does not exist, is odbc extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @odbc_pconnect($this->server, $this->user, $sqlpassword); + } + else + { + if (!function_exists('odbc_connect')) + { + $this->connect_error = 'odbc_connect function does not exist, is odbc extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @odbc_connect($this->server, $this->user, $sqlpassword); + } + + return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); + } + + /** + * {@inheritDoc} + */ + function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mssqlodbc_version')) === false) + { + $result_id = @odbc_exec($this->db_connect_id, "SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('productlevel'), SERVERPROPERTY('edition')"); + + $row = false; + if ($result_id) + { + $row = odbc_fetch_array($result_id); + odbc_free_result($result_id); + } + + $this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0; + + if (!empty($cache) && $use_cache) + { + $cache->put('mssqlodbc_version', $this->sql_server_version); + } + } + + if ($raw) + { + return $this->sql_server_version; + } + + return ($this->sql_server_version) ? 'MSSQL (ODBC)
' . $this->sql_server_version : 'MSSQL (ODBC)'; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return @odbc_exec($this->db_connect_id, 'BEGIN TRANSACTION'); + break; + + case 'commit': + return @odbc_exec($this->db_connect_id, 'COMMIT TRANSACTION'); + break; + + case 'rollback': + return @odbc_exec($this->db_connect_id, 'ROLLBACK TRANSACTION'); + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + if ($this->debug_sql_explain) + { + $this->sql_report('start', $query); + } + else if ($this->debug_load_time) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if (($this->query_result = @odbc_exec($this->db_connect_id, $query)) === false) + { + $this->sql_error($query); + } + + if ($this->debug_sql_explain) + { + $this->sql_report('stop', $query); + } + else if ($this->debug_load_time) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if ($this->debug_sql_explain) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * Build LIMIT query + */ + function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + // Since TOP is only returning a set number of rows we won't need it if total is set to 0 (return all rows) + if ($total) + { + // We need to grab the total number of rows + the offset number of rows to get the correct result + if (strpos($query, 'SELECT DISTINCT') === 0) + { + $query = 'SELECT DISTINCT TOP ' . ($total + $offset) . ' ' . substr($query, 15); + } + else + { + $query = 'SELECT TOP ' . ($total + $offset) . ' ' . substr($query, 6); + } + } + + $result = $this->sql_query($query, $cache_ttl); + + // Seek by $offset rows + if ($offset) + { + $this->sql_rowseek($offset, $result); + } + + return $result; + } + + /** + * {@inheritDoc} + */ + function sql_affectedrows() + { + return ($this->db_connect_id) ? @odbc_num_rows($this->query_result) : false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + return ($query_id) ? odbc_fetch_array($query_id) : false; + } + + /** + * {@inheritDoc} + */ + function sql_nextid() + { + $result_id = @odbc_exec($this->db_connect_id, 'SELECT @@IDENTITY'); + + if ($result_id) + { + if (odbc_fetch_array($result_id)) + { + $id = odbc_result($result_id, 1); + odbc_free_result($result_id); + return $id; + } + odbc_free_result($result_id); + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[(int) $query_id])) + { + unset($this->open_queries[(int) $query_id]); + return odbc_free_result($query_id); + } + + return false; + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + if (function_exists('odbc_errormsg')) + { + $error = array( + 'message' => @odbc_errormsg(), + 'code' => @odbc_error(), + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @odbc_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @odbc_exec($this->db_connect_id, $query); + if ($result) + { + while ($void = odbc_fetch_array($result)) + { + // Take the time spent on parsing rows into account + } + odbc_free_result($result); + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/install/update/new/phpbb/db/driver/mssqlnative.php b/install/update/new/phpbb/db/driver/mssqlnative.php new file mode 100644 index 0000000..30ef9d9 --- /dev/null +++ b/install/update/new/phpbb/db/driver/mssqlnative.php @@ -0,0 +1,450 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* This is the MS SQL Server Native database abstraction layer. +* PHP mssql native driver required. +* @author Chris Pucci +* +*/ + +namespace phpbb\db\driver; + +class mssqlnative extends \phpbb\db\driver\mssql_base +{ + var $m_insert_id = null; + var $last_query_text = ''; + var $query_options = array(); + var $connect_error = ''; + + /** + * {@inheritDoc} + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + // Test for driver support, to avoid suppressed fatal error + if (!function_exists('sqlsrv_connect')) + { + $this->connect_error = 'Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx'; + return $this->sql_error(''); + } + + //set up connection variables + $this->persistency = $persistency; + $this->user = $sqluser; + $this->dbname = $database; + $port_delimiter = (defined('PHP_OS') && substr(PHP_OS, 0, 3) === 'WIN') ? ',' : ':'; + $this->server = $sqlserver . (($port) ? $port_delimiter . $port : ''); + + //connect to database + $this->db_connect_id = sqlsrv_connect($this->server, array( + 'Database' => $this->dbname, + 'UID' => $this->user, + 'PWD' => $sqlpassword, + 'CharacterSet' => 'UTF-8' + )); + + return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); + } + + /** + * {@inheritDoc} + */ + function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) + { + $arr_server_info = sqlsrv_server_info($this->db_connect_id); + $this->sql_server_version = $arr_server_info['SQLServerVersion']; + + if (!empty($cache) && $use_cache) + { + $cache->put('mssql_version', $this->sql_server_version); + } + } + + if ($raw) + { + return $this->sql_server_version; + } + + return ($this->sql_server_version) ? 'MSSQL
' . $this->sql_server_version : 'MSSQL'; + } + + /** + * {@inheritDoc} + */ + function sql_buffer_nested_transactions() + { + return true; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return sqlsrv_begin_transaction($this->db_connect_id); + break; + + case 'commit': + return sqlsrv_commit($this->db_connect_id); + break; + + case 'rollback': + return sqlsrv_rollback($this->db_connect_id); + break; + } + return true; + } + + /** + * {@inheritDoc} + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + if ($this->debug_sql_explain) + { + $this->sql_report('start', $query); + } + else if ($this->debug_load_time) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if (($this->query_result = @sqlsrv_query($this->db_connect_id, $query, array(), $this->query_options)) === false) + { + $this->sql_error($query); + } + // reset options for next query + $this->query_options = array(); + + if ($this->debug_sql_explain) + { + $this->sql_report('stop', $query); + } + else if ($this->debug_load_time) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if ($this->debug_sql_explain) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + return $this->query_result; + } + + /** + * Build LIMIT query + */ + function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + // total == 0 means all results - not zero results + if ($offset == 0 && $total !== 0) + { + if (strpos($query, "SELECT") === false) + { + $query = "TOP {$total} " . $query; + } + else + { + $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP '.$total, $query); + } + } + else if ($offset > 0) + { + $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP(10000000) ', $query); + $query = 'SELECT * + FROM (SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3 + FROM (SELECT 1 AS line2, sub1.* FROM (' . $query . ') AS sub1) as sub2) AS sub3'; + + if ($total > 0) + { + $query .= ' WHERE line3 BETWEEN ' . ($offset+1) . ' AND ' . ($offset + $total); + } + else + { + $query .= ' WHERE line3 > ' . $offset; + } + } + + $result = $this->sql_query($query, $cache_ttl); + + return $result; + } + + /** + * {@inheritDoc} + */ + function sql_affectedrows() + { + return ($this->db_connect_id) ? @sqlsrv_rows_affected($this->query_result) : false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + if (!$query_id) + { + return false; + } + + $row = sqlsrv_fetch_array($query_id, SQLSRV_FETCH_ASSOC); + + if ($row) + { + foreach ($row as $key => $value) + { + $row[$key] = ($value === ' ' || $value === null) ? '' : $value; + } + + // remove helper values from LIMIT queries + if (isset($row['line2'])) + { + unset($row['line2'], $row['line3']); + } + } + return ($row !== null) ? $row : false; + } + + /** + * {@inheritDoc} + */ + function sql_nextid() + { + $result_id = @sqlsrv_query($this->db_connect_id, 'SELECT @@IDENTITY'); + + if ($result_id) + { + $row = sqlsrv_fetch_array($result_id); + $id = $row[0]; + sqlsrv_free_stmt($result_id); + return $id; + } + else + { + return false; + } + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[(int) $query_id])) + { + unset($this->open_queries[(int) $query_id]); + return sqlsrv_free_stmt($query_id); + } + + return false; + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + if (function_exists('sqlsrv_errors')) + { + $errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS); + $error_message = ''; + $code = 0; + + if ($errors != null) + { + foreach ($errors as $error) + { + $error_message .= "SQLSTATE: " . $error['SQLSTATE'] . "\n"; + $error_message .= "code: " . $error['code'] . "\n"; + $code = $error['code']; + $error_message .= "message: " . $error['message'] . "\n"; + } + $this->last_error_result = $error_message; + $error = $this->last_error_result; + } + else + { + $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); + } + + $error = array( + 'message' => $error, + 'code' => $code, + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @sqlsrv_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + $html_table = false; + @sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT ON;'); + if ($result = @sqlsrv_query($this->db_connect_id, $query)) + { + sqlsrv_next_result($result); + while ($row = sqlsrv_fetch_array($result)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + sqlsrv_free_stmt($result); + } + @sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT OFF;'); + + if ($html_table) + { + $this->html_hold .= ''; + } + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @sqlsrv_query($this->db_connect_id, $query); + if ($result) + { + while ($void = sqlsrv_fetch_array($result)) + { + // Take the time spent on parsing rows into account + } + sqlsrv_free_stmt($result); + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } + + /** + * Utility method used to retrieve number of rows + * Emulates mysql_num_rows + * Used in acp_database.php -> write_data_mssqlnative() + * Requires a static or keyset cursor to be definde via + * mssqlnative_set_query_options() + */ + function mssqlnative_num_rows($res) + { + if ($res !== false) + { + return sqlsrv_num_rows($res); + } + else + { + return false; + } + } + + /** + * Allows setting mssqlnative specific query options passed to sqlsrv_query as 4th parameter. + */ + function mssqlnative_set_query_options($options) + { + $this->query_options = $options; + } +} diff --git a/install/update/new/phpbb/db/driver/mysqli.php b/install/update/new/phpbb/db/driver/mysqli.php new file mode 100644 index 0000000..0c1c063 --- /dev/null +++ b/install/update/new/phpbb/db/driver/mysqli.php @@ -0,0 +1,492 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* MySQLi Database Abstraction Layer +* mysqli-extension has to be compiled with: +* MySQL 4.1+ or MySQL 5.0+ +*/ +class mysqli extends \phpbb\db\driver\mysql_base +{ + var $multi_insert = true; + var $connect_error = ''; + + /** + * {@inheritDoc} + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + if (!function_exists('mysqli_connect')) + { + $this->connect_error = 'mysqli_connect function does not exist, is mysqli extension installed?'; + return $this->sql_error(''); + } + + $this->persistency = $persistency; + $this->user = $sqluser; + + // If persistent connection, set dbhost to localhost when empty and prepend it with 'p:' prefix + $this->server = ($this->persistency) ? 'p:' . (($sqlserver) ? $sqlserver : 'localhost') : $sqlserver; + + $this->dbname = $database; + $port = (!$port) ? null : $port; + + // If port is set and it is not numeric, most likely mysqli socket is set. + // Try to map it to the $socket parameter. + $socket = null; + if ($port) + { + if (is_numeric($port)) + { + $port = (int) $port; + } + else + { + $socket = $port; + $port = null; + } + } + + $this->db_connect_id = mysqli_init(); + + if (!@mysqli_real_connect($this->db_connect_id, $this->server, $this->user, $sqlpassword, $this->dbname, $port, $socket, MYSQLI_CLIENT_FOUND_ROWS)) + { + $this->db_connect_id = ''; + } + + if ($this->db_connect_id && $this->dbname != '') + { + // Disable loading local files on client side + @mysqli_options($this->db_connect_id, MYSQLI_OPT_LOCAL_INFILE, false); + + @mysqli_query($this->db_connect_id, "SET NAMES 'utf8'"); + + // enforce strict mode on databases that support it + if (version_compare($this->sql_server_info(true), '5.0.2', '>=')) + { + $result = @mysqli_query($this->db_connect_id, 'SELECT @@session.sql_mode AS sql_mode'); + if ($result) + { + $row = mysqli_fetch_assoc($result); + mysqli_free_result($result); + + $modes = array_map('trim', explode(',', $row['sql_mode'])); + } + else + { + $modes = array(); + } + + // TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES + if (!in_array('TRADITIONAL', $modes)) + { + if (!in_array('STRICT_ALL_TABLES', $modes)) + { + $modes[] = 'STRICT_ALL_TABLES'; + } + + if (!in_array('STRICT_TRANS_TABLES', $modes)) + { + $modes[] = 'STRICT_TRANS_TABLES'; + } + } + + $mode = implode(',', $modes); + @mysqli_query($this->db_connect_id, "SET SESSION sql_mode='{$mode}'"); + } + return $this->db_connect_id; + } + + return $this->sql_error(''); + } + + /** + * {@inheritDoc} + */ + function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false) + { + $result = @mysqli_query($this->db_connect_id, 'SELECT VERSION() AS version'); + if ($result) + { + $row = mysqli_fetch_assoc($result); + mysqli_free_result($result); + + $this->sql_server_version = $row['version']; + + if (!empty($cache) && $use_cache) + { + $cache->put('mysqli_version', $this->sql_server_version); + } + } + } + + return ($raw) ? $this->sql_server_version : 'MySQL(i) ' . $this->sql_server_version; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return @mysqli_autocommit($this->db_connect_id, false); + break; + + case 'commit': + $result = @mysqli_commit($this->db_connect_id); + @mysqli_autocommit($this->db_connect_id, true); + return $result; + break; + + case 'rollback': + $result = @mysqli_rollback($this->db_connect_id); + @mysqli_autocommit($this->db_connect_id, true); + return $result; + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + if ($this->debug_sql_explain) + { + $this->sql_report('start', $query); + } + else if ($this->debug_load_time) + { + $this->curtime = microtime(true); + } + + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if (($this->query_result = @mysqli_query($this->db_connect_id, $query)) === false) + { + $this->sql_error($query); + } + + if ($this->debug_sql_explain) + { + $this->sql_report('stop', $query); + } + else if ($this->debug_load_time) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + } + else if ($this->debug_sql_explain) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * {@inheritDoc} + */ + function sql_affectedrows() + { + return ($this->db_connect_id) ? @mysqli_affected_rows($this->db_connect_id) : false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + if ($query_id) + { + $result = mysqli_fetch_assoc($query_id); + return $result !== null ? $result : false; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_rowseek($rownum, &$query_id) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + return ($query_id) ? @mysqli_data_seek($query_id, $rownum) : false; + } + + /** + * {@inheritDoc} + */ + function sql_nextid() + { + return ($this->db_connect_id) ? @mysqli_insert_id($this->db_connect_id) : false; + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if (!$query_id) + { + return false; + } + + if ($query_id === true) + { + return true; + } + + return mysqli_free_result($query_id); + } + + /** + * {@inheritDoc} + */ + function sql_escape($msg) + { + return @mysqli_real_escape_string($this->db_connect_id, $msg); + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + if ($this->db_connect_id) + { + $error = array( + 'message' => @mysqli_error($this->db_connect_id), + 'code' => @mysqli_errno($this->db_connect_id) + ); + } + else if (function_exists('mysqli_connect_error')) + { + $error = array( + 'message' => @mysqli_connect_error(), + 'code' => @mysqli_connect_errno(), + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @mysqli_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + static $test_prof; + + // current detection method, might just switch to see the existence of INFORMATION_SCHEMA.PROFILING + if ($test_prof === null) + { + $test_prof = false; + if (strpos(mysqli_get_server_info($this->db_connect_id), 'community') !== false) + { + $ver = mysqli_get_server_version($this->db_connect_id); + if ($ver >= 50037 && $ver < 50100) + { + $test_prof = true; + } + } + } + + switch ($mode) + { + case 'start': + + $explain_query = $query; + if (preg_match('/UPDATE ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + else if (preg_match('/DELETE FROM ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + + if (preg_match('/^SELECT/', $explain_query)) + { + $html_table = false; + + // begin profiling + if ($test_prof) + { + @mysqli_query($this->db_connect_id, 'SET profiling = 1;'); + } + + if ($result = @mysqli_query($this->db_connect_id, "EXPLAIN $explain_query")) + { + while ($row = mysqli_fetch_assoc($result)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + mysqli_free_result($result); + } + + if ($html_table) + { + $this->html_hold .= ''; + } + + if ($test_prof) + { + $html_table = false; + + // get the last profile + if ($result = @mysqli_query($this->db_connect_id, 'SHOW PROFILE ALL;')) + { + $this->html_hold .= '
'; + while ($row = mysqli_fetch_assoc($result)) + { + // make HTML safe + if (!empty($row['Source_function'])) + { + $row['Source_function'] = str_replace(array('<', '>'), array('<', '>'), $row['Source_function']); + } + + // remove unsupported features + foreach ($row as $key => $val) + { + if ($val === null) + { + unset($row[$key]); + } + } + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + mysqli_free_result($result); + } + + if ($html_table) + { + $this->html_hold .= ''; + } + + @mysqli_query($this->db_connect_id, 'SET profiling = 0;'); + } + } + + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @mysqli_query($this->db_connect_id, $query); + if ($result) + { + while ($void = mysqli_fetch_assoc($result)) + { + // Take the time spent on parsing rows into account + } + mysqli_free_result($result); + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/install/update/new/phpbb/db/driver/oracle.php b/install/update/new/phpbb/db/driver/oracle.php new file mode 100644 index 0000000..f2a0bb5 --- /dev/null +++ b/install/update/new/phpbb/db/driver/oracle.php @@ -0,0 +1,821 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* Oracle Database Abstraction Layer +*/ +class oracle extends \phpbb\db\driver\driver +{ + var $last_query_text = ''; + var $connect_error = ''; + + /** + * {@inheritDoc} + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + $this->persistency = $persistency; + $this->user = $sqluser; + $this->server = $sqlserver . (($port) ? ':' . $port : ''); + $this->dbname = $database; + + $connect = $database; + + // support for "easy connect naming" + if ($sqlserver !== '' && $sqlserver !== '/') + { + if (substr($sqlserver, -1, 1) == '/') + { + $sqlserver == substr($sqlserver, 0, -1); + } + $connect = $sqlserver . (($port) ? ':' . $port : '') . '/' . $database; + } + + if ($new_link) + { + if (!function_exists('ocinlogon')) + { + $this->connect_error = 'ocinlogon function does not exist, is oci extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8'); + } + else if ($this->persistency) + { + if (!function_exists('ociplogon')) + { + $this->connect_error = 'ociplogon function does not exist, is oci extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @ociplogon($this->user, $sqlpassword, $connect, 'UTF8'); + } + else + { + if (!function_exists('ocilogon')) + { + $this->connect_error = 'ocilogon function does not exist, is oci extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'); + } + + return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); + } + + /** + * {@inheritDoc} + */ + function sql_server_info($raw = false, $use_cache = true) + { + /** + * force $use_cache false. I didn't research why the caching code below is commented out + * but I assume its because the Oracle extension provides a direct method to access it + * without a query. + */ +/* + global $cache; + + if (empty($cache) || ($this->sql_server_version = $cache->get('oracle_version')) === false) + { + $result = @ociparse($this->db_connect_id, 'SELECT * FROM v$version WHERE banner LIKE \'Oracle%\''); + @ociexecute($result, OCI_DEFAULT); + @ocicommit($this->db_connect_id); + + $row = array(); + @ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS); + @ocifreestatement($result); + $this->sql_server_version = trim($row['BANNER']); + + $cache->put('oracle_version', $this->sql_server_version); + } +*/ + $this->sql_server_version = @ociserverversion($this->db_connect_id); + + return $this->sql_server_version; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return true; + break; + + case 'commit': + return @ocicommit($this->db_connect_id); + break; + + case 'rollback': + return @ocirollback($this->db_connect_id); + break; + } + + return true; + } + + /** + * Oracle specific code to handle the fact that it does not compare columns properly + * @access private + */ + function _rewrite_col_compare($args) + { + if (count($args) == 4) + { + if ($args[2] == '=') + { + return '(' . $args[0] . ' OR (' . $args[1] . ' is NULL AND ' . $args[3] . ' is NULL))'; + } + else if ($args[2] == '<>') + { + // really just a fancy way of saying foo <> bar or (foo is NULL XOR bar is NULL) but SQL has no XOR :P + return '(' . $args[0] . ' OR ((' . $args[1] . ' is NULL AND ' . $args[3] . ' is NOT NULL) OR (' . $args[1] . ' is NOT NULL AND ' . $args[3] . ' is NULL)))'; + } + } + else + { + return $this->_rewrite_where($args[0]); + } + } + + /** + * Oracle specific code to handle it's lack of sanity + * @access private + */ + function _rewrite_where($where_clause) + { + preg_match_all('/\s*(AND|OR)?\s*([\w_.()]++)\s*(?:(=|<[=>]?|>=?|LIKE)\s*((?>\'(?>[^\']++|\'\')*+\'|[\d-.()]+))|((NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]+,? ?)*+\)))/', $where_clause, $result, PREG_SET_ORDER); + $out = ''; + foreach ($result as $val) + { + if (!isset($val[5])) + { + if ($val[4] !== "''") + { + $out .= $val[0]; + } + else + { + $out .= ' ' . $val[1] . ' ' . $val[2]; + if ($val[3] == '=') + { + $out .= ' is NULL'; + } + else if ($val[3] == '<>') + { + $out .= ' is NOT NULL'; + } + } + } + else + { + $in_clause = array(); + $sub_exp = substr($val[5], strpos($val[5], '(') + 1, -1); + $extra = false; + preg_match_all('/\'(?>[^\']++|\'\')*+\'|[\d-.]++/', $sub_exp, $sub_vals, PREG_PATTERN_ORDER); + $i = 0; + foreach ($sub_vals[0] as $sub_val) + { + // two things: + // 1) This determines if an empty string was in the IN clausing, making us turn it into a NULL comparison + // 2) This fixes the 1000 list limit that Oracle has (ORA-01795) + if ($sub_val !== "''") + { + $in_clause[(int) $i++/1000][] = $sub_val; + } + else + { + $extra = true; + } + } + if (!$extra && $i < 1000) + { + $out .= $val[0]; + } + else + { + $out .= ' ' . $val[1] . '('; + $in_array = array(); + + // constuct each IN() clause + foreach ($in_clause as $in_values) + { + $in_array[] = $val[2] . ' ' . (isset($val[6]) ? $val[6] : '') . 'IN(' . implode(', ', $in_values) . ')'; + } + + // Join the IN() clauses against a few ORs (IN is just a nicer OR anyway) + $out .= implode(' OR ', $in_array); + + // handle the empty string case + if ($extra) + { + $out .= ' OR ' . $val[2] . ' is ' . (isset($val[6]) ? $val[6] : '') . 'NULL'; + } + $out .= ')'; + + unset($in_array, $in_clause); + } + } + } + + return $out; + } + + /** + * {@inheritDoc} + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + if ($this->debug_sql_explain) + { + $this->sql_report('start', $query); + } + else if ($this->debug_load_time) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + $in_transaction = false; + if (!$this->transaction) + { + $this->sql_transaction('begin'); + } + else + { + $in_transaction = true; + } + + $array = array(); + + // We overcome Oracle's 4000 char limit by binding vars + if (strlen($query) > 4000) + { + if (preg_match('/^(INSERT INTO[^(]++)\\(([^()]+)\\) VALUES[^(]++\\((.*?)\\)$/sU', $query, $regs)) + { + if (strlen($regs[3]) > 4000) + { + $cols = explode(', ', $regs[2]); + + preg_match_all('/\'(?:[^\']++|\'\')*+\'|[\d-.]+/', $regs[3], $vals, PREG_PATTERN_ORDER); + +/* The code inside this comment block breaks clob handling, but does allow the + database restore script to work. If you want to allow no posts longer than 4KB + and/or need the db restore script, uncomment this. + + + if (count($cols) !== count($vals)) + { + // Try to replace some common data we know is from our restore script or from other sources + $regs[3] = str_replace("'||chr(47)||'", '/', $regs[3]); + $_vals = explode(', ', $regs[3]); + + $vals = array(); + $is_in_val = false; + $i = 0; + $string = ''; + + foreach ($_vals as $value) + { + if (strpos($value, "'") === false && !$is_in_val) + { + $vals[$i++] = $value; + continue; + } + + if (substr($value, -1) === "'") + { + $vals[$i] = $string . (($is_in_val) ? ', ' : '') . $value; + $string = ''; + $is_in_val = false; + + if ($vals[$i][0] !== "'") + { + $vals[$i] = "''" . $vals[$i]; + } + $i++; + continue; + } + else + { + $string .= (($is_in_val) ? ', ' : '') . $value; + $is_in_val = true; + } + } + + if ($string) + { + // New value if cols != value + $vals[(count($cols) !== count($vals)) ? $i : $i - 1] .= $string; + } + + $vals = array(0 => $vals); + } +*/ + + $inserts = $vals[0]; + unset($vals); + + foreach ($inserts as $key => $value) + { + if (!empty($value) && $value[0] === "'" && strlen($value) > 4002) // check to see if this thing is greater than the max + 'x2 + { + $inserts[$key] = ':' . strtoupper($cols[$key]); + $array[$inserts[$key]] = str_replace("''", "'", substr($value, 1, -1)); + } + } + + $query = $regs[1] . '(' . $regs[2] . ') VALUES (' . implode(', ', $inserts) . ')'; + } + } + else if (preg_match_all('/^(UPDATE [\\w_]++\\s+SET )([\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+)(?:,\\s*[\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+)\\s+(WHERE.*)$/s', $query, $data, PREG_SET_ORDER)) + { + if (strlen($data[0][2]) > 4000) + { + $update = $data[0][1]; + $where = $data[0][3]; + preg_match_all('/([\\w_]++)\\s*=\\s*(\'(?:[^\']++|\'\')*+\'|[\d-.]++)/', $data[0][2], $temp, PREG_SET_ORDER); + unset($data); + + $cols = array(); + foreach ($temp as $value) + { + if (!empty($value[2]) && $value[2][0] === "'" && strlen($value[2]) > 4002) // check to see if this thing is greater than the max + 'x2 + { + $cols[] = $value[1] . '=:' . strtoupper($value[1]); + $array[$value[1]] = str_replace("''", "'", substr($value[2], 1, -1)); + } + else + { + $cols[] = $value[1] . '=' . $value[2]; + } + } + + $query = $update . implode(', ', $cols) . ' ' . $where; + unset($cols); + } + } + } + + switch (substr($query, 0, 6)) + { + case 'DELETE': + if (preg_match('/^(DELETE FROM [\w_]++ WHERE)((?:\s*(?:AND|OR)?\s*[\w_]+\s*(?:(?:=|<>)\s*(?>\'(?>[^\']++|\'\')*+\'|[\d-.]+)|(?:NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]+,? ?)*+\)))*+)$/', $query, $regs)) + { + $query = $regs[1] . $this->_rewrite_where($regs[2]); + unset($regs); + } + break; + + case 'UPDATE': + if (preg_match('/^(UPDATE [\\w_]++\\s+SET [\\w_]+\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]++|:\w++)(?:, [\\w_]+\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]++|:\w++))*+\\s+WHERE)(.*)$/s', $query, $regs)) + { + $query = $regs[1] . $this->_rewrite_where($regs[2]); + unset($regs); + } + break; + + case 'SELECT': + $query = preg_replace_callback('/([\w_.]++)\s*(?:(=|<>)\s*(?>\'(?>[^\']++|\'\')*+\'|[\d-.]++|([\w_.]++))|(?:NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]++,? ?)*+\))/', array($this, '_rewrite_col_compare'), $query); + break; + } + + $this->query_result = @ociparse($this->db_connect_id, $query); + + foreach ($array as $key => $value) + { + @ocibindbyname($this->query_result, $key, $array[$key], -1); + } + + $success = @ociexecute($this->query_result, OCI_DEFAULT); + + if (!$success) + { + $this->sql_error($query); + $this->query_result = false; + } + else + { + if (!$in_transaction) + { + $this->sql_transaction('commit'); + } + } + + if ($this->debug_sql_explain) + { + $this->sql_report('stop', $query); + } + else if ($this->debug_load_time) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if ($this->debug_sql_explain) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * Build LIMIT query + */ + function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + $query = 'SELECT * FROM (SELECT /*+ FIRST_ROWS */ rownum AS xrownum, a.* FROM (' . $query . ') a WHERE rownum <= ' . ($offset + $total) . ') WHERE xrownum >= ' . $offset; + + return $this->sql_query($query, $cache_ttl); + } + + /** + * {@inheritDoc} + */ + function sql_affectedrows() + { + return ($this->query_result) ? @ocirowcount($this->query_result) : false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + if ($query_id) + { + $row = array(); + $result = ocifetchinto($query_id, $row, OCI_ASSOC + OCI_RETURN_NULLS); + + if (!$result || !$row) + { + return false; + } + + $result_row = array(); + foreach ($row as $key => $value) + { + // Oracle treats empty strings as null + if (is_null($value)) + { + $value = ''; + } + + // OCI->CLOB? + if (is_object($value)) + { + $value = $value->load(); + } + + $result_row[strtolower($key)] = $value; + } + + return $result_row; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_rowseek($rownum, &$query_id) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + if (!$query_id) + { + return false; + } + + // Reset internal pointer + @ociexecute($query_id, OCI_DEFAULT); + + // We do not fetch the row for rownum == 0 because then the next resultset would be the second row + for ($i = 0; $i < $rownum; $i++) + { + if (!$this->sql_fetchrow($query_id)) + { + return false; + } + } + + return true; + } + + /** + * {@inheritDoc} + */ + function sql_nextid() + { + $query_id = $this->query_result; + + if ($query_id !== false && $this->last_query_text != '') + { + if (preg_match('#^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)#is', $this->last_query_text, $tablename)) + { + $query = 'SELECT ' . $tablename[1] . '_seq.currval FROM DUAL'; + $stmt = @ociparse($this->db_connect_id, $query); + if ($stmt) + { + $success = @ociexecute($stmt, OCI_DEFAULT); + + if ($success) + { + $temp_result = ocifetchinto($stmt, $temp_array, OCI_ASSOC + OCI_RETURN_NULLS); + ocifreestatement($stmt); + + if ($temp_result) + { + return $temp_array['CURRVAL']; + } + else + { + return false; + } + } + } + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[(int) $query_id])) + { + unset($this->open_queries[(int) $query_id]); + return ocifreestatement($query_id); + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_escape($msg) + { + return str_replace(array("'", "\0"), array("''", ''), $msg); + } + + /** + * Build LIKE expression + * @access private + */ + function _sql_like_expression($expression) + { + return $expression . " ESCAPE '\\'"; + } + + /** + * Build NOT LIKE expression + * @access private + */ + function _sql_not_like_expression($expression) + { + return $expression . " ESCAPE '\\'"; + } + + function _sql_custom_build($stage, $data) + { + return $data; + } + + function _sql_bit_and($column_name, $bit, $compare = '') + { + return 'BITAND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); + } + + function _sql_bit_or($column_name, $bit, $compare = '') + { + return 'BITOR(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + if (function_exists('ocierror')) + { + $error = @ocierror(); + $error = (!$error) ? @ocierror($this->query_result) : $error; + $error = (!$error) ? @ocierror($this->db_connect_id) : $error; + + if ($error) + { + $this->last_error_result = $error; + } + else + { + $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); + } + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @ocilogoff($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + + $html_table = false; + + // Grab a plan table, any will do + $sql = "SELECT table_name + FROM USER_TABLES + WHERE table_name LIKE '%PLAN_TABLE%'"; + $stmt = ociparse($this->db_connect_id, $sql); + ociexecute($stmt); + $result = array(); + + if (ocifetchinto($stmt, $result, OCI_ASSOC + OCI_RETURN_NULLS)) + { + $table = $result['TABLE_NAME']; + + // This is the statement_id that will allow us to track the plan + $statement_id = substr(md5($query), 0, 30); + + // Remove any stale plans + $stmt2 = ociparse($this->db_connect_id, "DELETE FROM $table WHERE statement_id='$statement_id'"); + ociexecute($stmt2); + ocifreestatement($stmt2); + + // Explain the plan + $sql = "EXPLAIN PLAN + SET STATEMENT_ID = '$statement_id' + FOR $query"; + $stmt2 = ociparse($this->db_connect_id, $sql); + ociexecute($stmt2); + ocifreestatement($stmt2); + + // Get the data from the plan + $sql = "SELECT operation, options, object_name, object_type, cardinality, cost + FROM plan_table + START WITH id = 0 AND statement_id = '$statement_id' + CONNECT BY PRIOR id = parent_id + AND statement_id = '$statement_id'"; + $stmt2 = ociparse($this->db_connect_id, $sql); + ociexecute($stmt2); + + $row = array(); + while (ocifetchinto($stmt2, $row, OCI_ASSOC + OCI_RETURN_NULLS)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + + ocifreestatement($stmt2); + + // Remove the plan we just made, we delete them on request anyway + $stmt2 = ociparse($this->db_connect_id, "DELETE FROM $table WHERE statement_id='$statement_id'"); + ociexecute($stmt2); + ocifreestatement($stmt2); + } + + ocifreestatement($stmt); + + if ($html_table) + { + $this->html_hold .= ''; + } + + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @ociparse($this->db_connect_id, $query); + if ($result) + { + $success = @ociexecute($result, OCI_DEFAULT); + if ($success) + { + $row = array(); + + while (ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS)) + { + // Take the time spent on parsing rows into account + } + @ocifreestatement($result); + } + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/install/update/new/phpbb/db/driver/postgres.php b/install/update/new/phpbb/db/driver/postgres.php new file mode 100644 index 0000000..ed330bc --- /dev/null +++ b/install/update/new/phpbb/db/driver/postgres.php @@ -0,0 +1,500 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* PostgreSQL Database Abstraction Layer +* Minimum Requirement is Version 8.3+ +*/ +class postgres extends \phpbb\db\driver\driver +{ + var $multi_insert = true; + var $last_query_text = ''; + var $connect_error = ''; + + /** + * {@inheritDoc} + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + $connect_string = ''; + + if ($sqluser) + { + $connect_string .= "user=$sqluser "; + } + + if ($sqlpassword) + { + $connect_string .= "password=$sqlpassword "; + } + + if ($sqlserver) + { + // $sqlserver can carry a port separated by : for compatibility reasons + // If $sqlserver has more than one : it's probably an IPv6 address. + // In this case we only allow passing a port via the $port variable. + if (substr_count($sqlserver, ':') === 1) + { + list($sqlserver, $port) = explode(':', $sqlserver); + } + + if ($sqlserver !== 'localhost') + { + $connect_string .= "host=$sqlserver "; + } + + if ($port) + { + $connect_string .= "port=$port "; + } + } + + $schema = ''; + + if ($database) + { + $this->dbname = $database; + if (strpos($database, '.') !== false) + { + list($database, $schema) = explode('.', $database); + } + $connect_string .= "dbname=$database"; + } + + $this->persistency = $persistency; + + if ($this->persistency) + { + if (!function_exists('pg_pconnect')) + { + $this->connect_error = 'pg_pconnect function does not exist, is pgsql extension installed?'; + return $this->sql_error(''); + } + $collector = new \phpbb\error_collector; + $collector->install(); + $this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW); + } + else + { + if (!function_exists('pg_connect')) + { + $this->connect_error = 'pg_connect function does not exist, is pgsql extension installed?'; + return $this->sql_error(''); + } + $collector = new \phpbb\error_collector; + $collector->install(); + $this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW); + } + + $collector->uninstall(); + + if ($this->db_connect_id) + { + if ($schema !== '') + { + @pg_query($this->db_connect_id, 'SET search_path TO ' . $schema); + } + return $this->db_connect_id; + } + + $this->connect_error = $collector->format_errors(); + return $this->sql_error(''); + } + + /** + * {@inheritDoc} + */ + function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('pgsql_version')) === false) + { + $query_id = @pg_query($this->db_connect_id, 'SELECT VERSION() AS version'); + if ($query_id) + { + $row = pg_fetch_assoc($query_id, null); + pg_free_result($query_id); + + $this->sql_server_version = (!empty($row['version'])) ? trim(substr($row['version'], 10)) : 0; + + if (!empty($cache) && $use_cache) + { + $cache->put('pgsql_version', $this->sql_server_version); + } + } + } + + return ($raw) ? $this->sql_server_version : 'PostgreSQL ' . $this->sql_server_version; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return @pg_query($this->db_connect_id, 'BEGIN'); + break; + + case 'commit': + return @pg_query($this->db_connect_id, 'COMMIT'); + break; + + case 'rollback': + return @pg_query($this->db_connect_id, 'ROLLBACK'); + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + if ($this->debug_sql_explain) + { + $this->sql_report('start', $query); + } + else if ($this->debug_load_time) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if (($this->query_result = @pg_query($this->db_connect_id, $query)) === false) + { + $this->sql_error($query); + } + + if ($this->debug_sql_explain) + { + $this->sql_report('stop', $query); + } + else if ($this->debug_load_time) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if ($this->debug_sql_explain) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * Build db-specific query data + * @access private + */ + function _sql_custom_build($stage, $data) + { + return $data; + } + + /** + * Build LIMIT query + */ + function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + // if $total is set to 0 we do not want to limit the number of rows + if ($total == 0) + { + $total = 'ALL'; + } + + $query .= "\n LIMIT $total OFFSET $offset"; + + return $this->sql_query($query, $cache_ttl); + } + + /** + * {@inheritDoc} + */ + function sql_affectedrows() + { + return ($this->query_result) ? @pg_affected_rows($this->query_result) : false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + return ($query_id) ? pg_fetch_assoc($query_id, null) : false; + } + + /** + * {@inheritDoc} + */ + function sql_rowseek($rownum, &$query_id) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + return ($query_id) ? @pg_result_seek($query_id, $rownum) : false; + } + + /** + * {@inheritDoc} + */ + function sql_nextid() + { + $query_id = $this->query_result; + + if ($query_id !== false && $this->last_query_text != '') + { + if (preg_match("/^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)/is", $this->last_query_text, $tablename)) + { + $query = "SELECT currval('" . $tablename[1] . "_seq') AS last_value"; + $temp_q_id = @pg_query($this->db_connect_id, $query); + + if (!$temp_q_id) + { + return false; + } + + $temp_result = pg_fetch_assoc($temp_q_id, null); + pg_free_result($query_id); + + return ($temp_result) ? $temp_result['last_value'] : false; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[(int) $query_id])) + { + unset($this->open_queries[(int) $query_id]); + return pg_free_result($query_id); + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_escape($msg) + { + return @pg_escape_string($msg); + } + + /** + * Build LIKE expression + * @access private + */ + function _sql_like_expression($expression) + { + return $expression; + } + + /** + * Build NOT LIKE expression + * @access private + */ + function _sql_not_like_expression($expression) + { + return $expression; + } + + /** + * {@inheritDoc} + */ + function cast_expr_to_bigint($expression) + { + return 'CAST(' . $expression . ' as DECIMAL(255, 0))'; + } + + /** + * {@inheritDoc} + */ + function cast_expr_to_string($expression) + { + return 'CAST(' . $expression . ' as VARCHAR(255))'; + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + // pg_last_error only works when there is an established connection. + // Connection errors have to be tracked by us manually. + if ($this->db_connect_id) + { + $message = @pg_last_error($this->db_connect_id); + } + else + { + $message = $this->connect_error; + } + + return array( + 'message' => $message, + 'code' => '' + ); + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @pg_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + + $explain_query = $query; + if (preg_match('/UPDATE ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + else if (preg_match('/DELETE FROM ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + + if (preg_match('/^SELECT/', $explain_query)) + { + $html_table = false; + + if ($result = @pg_query($this->db_connect_id, "EXPLAIN $explain_query")) + { + while ($row = pg_fetch_assoc($result, null)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + pg_free_result($result); + } + + if ($html_table) + { + $this->html_hold .= ''; + } + } + + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @pg_query($this->db_connect_id, $query); + if ($result) + { + while ($void = pg_fetch_assoc($result, null)) + { + // Take the time spent on parsing rows into account + } + pg_free_result($result); + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/install/update/new/phpbb/db/driver/sqlite3.php b/install/update/new/phpbb/db/driver/sqlite3.php new file mode 100644 index 0000000..43906f1 --- /dev/null +++ b/install/update/new/phpbb/db/driver/sqlite3.php @@ -0,0 +1,430 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* SQLite3 Database Abstraction Layer +* Minimum Requirement: 3.6.15+ +*/ +class sqlite3 extends \phpbb\db\driver\driver +{ + /** + * @var string Stores errors during connection setup in case the driver is not available + */ + protected $connect_error = ''; + + /** + * @var \SQLite3 The SQLite3 database object to operate against + */ + protected $dbo = null; + + /** + * {@inheritDoc} + */ + public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + $this->persistency = false; + $this->user = $sqluser; + $this->server = $sqlserver . (($port) ? ':' . $port : ''); + $this->dbname = $database; + + if (!class_exists('SQLite3', false)) + { + $this->connect_error = 'SQLite3 not found, is the extension installed?'; + return $this->sql_error(''); + } + + try + { + $this->dbo = new \SQLite3($this->server, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE); + $this->dbo->busyTimeout(60000); + $this->db_connect_id = true; + } + catch (\Exception $e) + { + $this->connect_error = $e->getMessage(); + return array('message' => $this->connect_error); + } + + return true; + } + + /** + * {@inheritDoc} + */ + public function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('sqlite_version')) === false) + { + $version = \SQLite3::version(); + + $this->sql_server_version = $version['versionString']; + + if (!empty($cache) && $use_cache) + { + $cache->put('sqlite_version', $this->sql_server_version); + } + } + + return ($raw) ? $this->sql_server_version : 'SQLite ' . $this->sql_server_version; + } + + /** + * SQL Transaction + * + * @param string $status Should be one of the following strings: + * begin, commit, rollback + * @return bool Success/failure of the transaction query + */ + protected function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return $this->dbo->exec('BEGIN IMMEDIATE'); + break; + + case 'commit': + return $this->dbo->exec('COMMIT'); + break; + + case 'rollback': + return @$this->dbo->exec('ROLLBACK'); + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + public function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + if ($this->debug_sql_explain) + { + $this->sql_report('start', $query); + } + else if ($this->debug_load_time) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if ($this->transaction === true && strpos($query, 'INSERT') === 0) + { + $query = preg_replace('/^INSERT INTO/', 'INSERT OR ROLLBACK INTO', $query); + } + + if (($this->query_result = @$this->dbo->query($query)) === false) + { + // Try to recover a lost database connection + if ($this->dbo && !@$this->dbo->lastErrorMsg()) + { + if ($this->sql_connect($this->server, $this->user, '', $this->dbname)) + { + $this->query_result = @$this->dbo->query($query); + } + } + + if ($this->query_result === false) + { + $this->sql_error($query); + } + } + + if ($this->debug_sql_explain) + { + $this->sql_report('stop', $query); + } + else if ($this->debug_load_time) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + } + else if ($this->debug_sql_explain) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * Build LIMIT query + * + * @param string $query The SQL query to execute + * @param int $total The number of rows to select + * @param int $offset + * @param int $cache_ttl Either 0 to avoid caching or + * the time in seconds which the result shall be kept in cache + * @return mixed Buffered, seekable result handle, false on error + */ + protected function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + // if $total is set to 0 we do not want to limit the number of rows + if ($total == 0) + { + $total = -1; + } + + $query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total); + + return $this->sql_query($query, $cache_ttl); + } + + /** + * {@inheritDoc} + */ + public function sql_affectedrows() + { + return ($this->db_connect_id) ? $this->dbo->changes() : false; + } + + /** + * {@inheritDoc} + */ + public function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + /** @var \SQLite3Result $query_id */ + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + return is_object($query_id) ? @$query_id->fetchArray(SQLITE3_ASSOC) : false; + } + + /** + * {@inheritDoc} + */ + public function sql_nextid() + { + return ($this->db_connect_id) ? $this->dbo->lastInsertRowID() : false; + } + + /** + * {@inheritDoc} + */ + public function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if ($query_id) + { + return @$query_id->finalize(); + } + } + + /** + * {@inheritDoc} + */ + public function sql_escape($msg) + { + return \SQLite3::escapeString($msg); + } + + /** + * {@inheritDoc} + * + * For SQLite an underscore is an unknown character. + */ + public function sql_like_expression($expression) + { + // Unlike LIKE, GLOB is unfortunately case sensitive. + // We only catch * and ? here, not the character map possible on file globbing. + $expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression); + + $expression = str_replace(array('?', '*'), array("\?", "\*"), $expression); + $expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression); + + return 'GLOB \'' . $this->sql_escape($expression) . '\''; + } + + /** + * {@inheritDoc} + * + * For SQLite an underscore is an unknown character. + */ + public function sql_not_like_expression($expression) + { + // Unlike NOT LIKE, NOT GLOB is unfortunately case sensitive + // We only catch * and ? here, not the character map possible on file globbing. + $expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression); + + $expression = str_replace(array('?', '*'), array("\?", "\*"), $expression); + $expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression); + + return 'NOT GLOB \'' . $this->sql_escape($expression) . '\''; + } + + /** + * return sql error array + * + * @return array + */ + protected function _sql_error() + { + if (class_exists('SQLite3', false) && isset($this->dbo)) + { + $error = array( + 'message' => $this->dbo->lastErrorMsg(), + 'code' => $this->dbo->lastErrorCode(), + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Build db-specific query data + * + * @param string $stage Available stages: FROM, WHERE + * @param mixed $data A string containing the CROSS JOIN query or an array of WHERE clauses + * + * @return string The db-specific query fragment + */ + protected function _sql_custom_build($stage, $data) + { + return $data; + } + + /** + * Close sql connection + * + * @return bool False if failure + */ + protected function _sql_close() + { + return $this->dbo->close(); + } + + /** + * Build db-specific report + * + * @param string $mode Available modes: display, start, stop, + * add_select_row, fromcache, record_fromcache + * @param string $query The Query that should be explained + * @return mixed Either a full HTML page, boolean or null + */ + protected function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + + $explain_query = $query; + if (preg_match('/UPDATE ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + else if (preg_match('/DELETE FROM ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + + if (preg_match('/^SELECT/', $explain_query)) + { + $html_table = false; + + if ($result = $this->dbo->query("EXPLAIN QUERY PLAN $explain_query")) + { + while ($row = $result->fetchArray(SQLITE3_ASSOC)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + } + + if ($html_table) + { + $this->html_hold .= ''; + } + } + + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = $this->dbo->query($query); + if ($result) + { + while ($void = $result->fetchArray(SQLITE3_ASSOC)) + { + // Take the time spent on parsing rows into account + } + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/install/update/new/phpbb/db/extractor/mysql_extractor.php b/install/update/new/phpbb/db/extractor/mysql_extractor.php new file mode 100644 index 0000000..f3cb0db --- /dev/null +++ b/install/update/new/phpbb/db/extractor/mysql_extractor.php @@ -0,0 +1,301 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +use phpbb\db\extractor\exception\extractor_not_initialized_exception; + +class mysql_extractor extends base_extractor +{ + /** + * {@inheritdoc} + */ + public function write_start($table_prefix) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = "#\n"; + $sql_data .= "# phpBB Backup Script\n"; + $sql_data .= "# Dump of tables for $table_prefix\n"; + $sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; + $sql_data .= "#\n"; + $this->flush($sql_data); + } + + /** + * {@inheritdoc} + */ + public function write_table($table_name) + { + static $new_extract; + + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + if ($new_extract === null) + { + if ($this->db->get_sql_layer() === 'mysqli' || version_compare($this->db->sql_server_info(true), '3.23.20', '>=')) + { + $new_extract = true; + } + else + { + $new_extract = false; + } + } + + if ($new_extract) + { + $this->new_write_table($table_name); + } + else + { + $this->old_write_table($table_name); + } + } + + /** + * {@inheritdoc} + */ + public function write_data($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $this->write_data_mysqli($table_name); + } + + /** + * Extracts data from database table (for MySQLi driver) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function write_data_mysqli($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql = "SELECT * + FROM $table_name"; + $result = mysqli_query($this->db->get_db_connect_id(), $sql, MYSQLI_USE_RESULT); + if ($result != false) + { + $fields_cnt = mysqli_num_fields($result); + + // Get field information + $field = mysqli_fetch_fields($result); + $field_set = array(); + + for ($j = 0; $j < $fields_cnt; $j++) + { + $field_set[] = $field[$j]->name; + } + + $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); + $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); + $fields = implode(', ', $field_set); + $sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES '; + $first_set = true; + $query_len = 0; + $max_len = get_usable_memory(); + + while ($row = mysqli_fetch_row($result)) + { + $values = array(); + if ($first_set) + { + $query = $sql_data . '('; + } + else + { + $query .= ',('; + } + + for ($j = 0; $j < $fields_cnt; $j++) + { + if (!isset($row[$j]) || is_null($row[$j])) + { + $values[$j] = 'NULL'; + } + else if (($field[$j]->flags & 32768) && !($field[$j]->flags & 1024)) + { + $values[$j] = $row[$j]; + } + else + { + $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'"; + } + } + $query .= implode(', ', $values) . ')'; + + $query_len += strlen($query); + if ($query_len > $max_len) + { + $this->flush($query . ";\n\n"); + $query = ''; + $query_len = 0; + $first_set = true; + } + else + { + $first_set = false; + } + } + mysqli_free_result($result); + + // check to make sure we have nothing left to flush + if (!$first_set && $query) + { + $this->flush($query . ";\n\n"); + } + } + } + + /** + * Extracts database table structure (for MySQLi or MySQL 3.23.20+) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function new_write_table($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql = 'SHOW CREATE TABLE ' . $table_name; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + + $sql_data = '# Table: ' . $table_name . "\n"; + $sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; + $this->flush($sql_data . $row['Create Table'] . ";\n\n"); + + $this->db->sql_freeresult($result); + } + + /** + * Extracts database table structure (for MySQL versions older than 3.23.20) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function old_write_table($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = '# Table: ' . $table_name . "\n"; + $sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; + $sql_data .= "CREATE TABLE $table_name(\n"; + $rows = array(); + + $sql = "SHOW FIELDS + FROM $table_name"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $line = ' ' . $row['Field'] . ' ' . $row['Type']; + + if (!is_null($row['Default'])) + { + $line .= " DEFAULT '{$row['Default']}'"; + } + + if ($row['Null'] != 'YES') + { + $line .= ' NOT NULL'; + } + + if ($row['Extra'] != '') + { + $line .= ' ' . $row['Extra']; + } + + $rows[] = $line; + } + $this->db->sql_freeresult($result); + + $sql = "SHOW KEYS + FROM $table_name"; + + $result = $this->db->sql_query($sql); + + $index = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $kname = $row['Key_name']; + + if ($kname != 'PRIMARY') + { + if ($row['Non_unique'] == 0) + { + $kname = "UNIQUE|$kname"; + } + } + + if ($row['Sub_part']) + { + $row['Column_name'] .= '(' . $row['Sub_part'] . ')'; + } + $index[$kname][] = $row['Column_name']; + } + $this->db->sql_freeresult($result); + + foreach ($index as $key => $columns) + { + $line = ' '; + + if ($key == 'PRIMARY') + { + $line .= 'PRIMARY KEY (' . implode(', ', $columns) . ')'; + } + else if (strpos($key, 'UNIQUE') === 0) + { + $line .= 'UNIQUE ' . substr($key, 7) . ' (' . implode(', ', $columns) . ')'; + } + else if (strpos($key, 'FULLTEXT') === 0) + { + $line .= 'FULLTEXT ' . substr($key, 9) . ' (' . implode(', ', $columns) . ')'; + } + else + { + $line .= "KEY $key (" . implode(', ', $columns) . ')'; + } + + $rows[] = $line; + } + + $sql_data .= implode(",\n", $rows); + $sql_data .= "\n);\n\n"; + + $this->flush($sql_data); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php b/install/update/new/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php new file mode 100644 index 0000000..247ccc7 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php @@ -0,0 +1,129 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v30x; + +class release_3_0_4_rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.0.4-RC1', '>='); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_3'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_profile' => array('BOOL', 0), + ), + ), + 'change_columns' => array( + $this->table_prefix . 'styles' => array( + 'style_id' => array('UINT', NULL, 'auto_increment'), + 'template_id' => array('UINT', 0), + 'theme_id' => array('UINT', 0), + 'imageset_id' => array('UINT', 0), + ), + $this->table_prefix . 'styles_imageset' => array( + 'imageset_id' => array('UINT', NULL, 'auto_increment'), + ), + $this->table_prefix . 'styles_imageset_data' => array( + 'image_id' => array('UINT', NULL, 'auto_increment'), + 'imageset_id' => array('UINT', 0), + ), + $this->table_prefix . 'styles_theme' => array( + 'theme_id' => array('UINT', NULL, 'auto_increment'), + ), + $this->table_prefix . 'styles_template' => array( + 'template_id' => array('UINT', NULL, 'auto_increment'), + ), + $this->table_prefix . 'styles_template_data' => array( + 'template_id' => array('UINT', 0), + ), + $this->table_prefix . 'forums' => array( + 'forum_style' => array('UINT', 0), + ), + $this->table_prefix . 'users' => array( + 'user_style' => array('UINT', 0), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_profile', + ), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'update_custom_profile_fields'))), + + array('config.update', array('version', '3.0.4-RC1')), + ); + } + + public function update_custom_profile_fields() + { + // Update the Custom Profile Fields based on previous settings to the new \format + $sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide + FROM ' . PROFILE_FIELDS_TABLE; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $sql_ary = array( + 'field_required' => 0, + 'field_show_on_reg' => 0, + 'field_hide' => 0, + 'field_show_profile'=> 0, + ); + + if ($row['field_required']) + { + $sql_ary['field_required'] = $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1; + } + else if ($row['field_show_on_reg']) + { + $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1; + } + else if ($row['field_hide']) + { + // Only administrators and moderators can see this CPF, if the view is enabled, they can see it, otherwise just admins in the acp_users module + $sql_ary['field_hide'] = 1; + } + else + { + // equivalent to "none", which is the "Display in user control panel" option + $sql_ary['field_show_profile'] = 1; + } + + $this->sql_query('UPDATE ' . $this->table_prefix . 'profile_fields SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary); + } + + $this->db->sql_freeresult($result); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v310/softdelete_p1.php b/install/update/new/phpbb/db/migration/data/v310/softdelete_p1.php new file mode 100644 index 0000000..877cdc2 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v310/softdelete_p1.php @@ -0,0 +1,211 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class softdelete_p1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_visibility'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'forums' => array( + 'forum_posts_approved' => array('UINT', 0), + 'forum_posts_unapproved' => array('UINT', 0), + 'forum_posts_softdeleted' => array('UINT', 0), + 'forum_topics_approved' => array('UINT', 0), + 'forum_topics_unapproved' => array('UINT', 0), + 'forum_topics_softdeleted' => array('UINT', 0), + ), + $this->table_prefix . 'posts' => array( + 'post_visibility' => array('TINT:3', 0), + 'post_delete_time' => array('TIMESTAMP', 0), + 'post_delete_reason' => array('STEXT_UNI', ''), + 'post_delete_user' => array('UINT', 0), + ), + $this->table_prefix . 'topics' => array( + 'topic_visibility' => array('TINT:3', 0), + 'topic_delete_time' => array('TIMESTAMP', 0), + 'topic_delete_reason' => array('STEXT_UNI', ''), + 'topic_delete_user' => array('UINT', 0), + 'topic_posts_approved' => array('UINT', 0), + 'topic_posts_unapproved' => array('UINT', 0), + 'topic_posts_softdeleted' => array('UINT', 0), + ), + ), + 'add_index' => array( + $this->table_prefix . 'posts' => array( + 'post_visibility' => array('post_visibility'), + ), + $this->table_prefix . 'topics' => array( + 'topic_visibility' => array('topic_visibility'), + 'forum_vis_last' => array('forum_id', 'topic_visibility', 'topic_last_post_id'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'forums' => array( + 'forum_posts_approved', + 'forum_posts_unapproved', + 'forum_posts_softdeleted', + 'forum_topics_approved', + 'forum_topics_unapproved', + 'forum_topics_softdeleted', + ), + $this->table_prefix . 'posts' => array( + 'post_visibility', + 'post_delete_time', + 'post_delete_reason', + 'post_delete_user', + ), + $this->table_prefix . 'topics' => array( + 'topic_visibility', + 'topic_delete_time', + 'topic_delete_reason', + 'topic_delete_user', + 'topic_posts_approved', + 'topic_posts_unapproved', + 'topic_posts_softdeleted', + ), + ), + 'drop_keys' => array( + $this->table_prefix . 'posts' => array('post_visibility'), + $this->table_prefix . 'topics' => array('topic_visibility', 'forum_vis_last'), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_post_visibility'))), + array('custom', array(array($this, 'update_topic_visibility'))), + array('custom', array(array($this, 'update_topics_post_counts'))), + array('custom', array(array($this, 'update_forums_topic_and_post_counts'))), + + array('permission.add', array('f_softdelete', false)), + array('permission.add', array('m_softdelete', false)), + ); + } + + public function update_post_visibility() + { + $sql = 'UPDATE ' . $this->table_prefix . 'posts + SET post_visibility = post_approved'; + $this->sql_query($sql); + } + + public function update_topic_visibility() + { + $sql = 'UPDATE ' . $this->table_prefix . 'topics + SET topic_visibility = topic_approved'; + $this->sql_query($sql); + } + + public function update_topics_post_counts() + { + /* + * Using sql_case here to avoid "BIGINT UNSIGNED value is out of range" errors. + * As we update all topics in 2 queries, one broken topic would stop the conversion + * for all topics and the suppressed error will cause the admin to not even notice it. + */ + $sql = 'UPDATE ' . $this->table_prefix . 'topics + SET topic_posts_approved = topic_replies + 1, + topic_posts_unapproved = ' . $this->db->sql_case('topic_replies_real > topic_replies', 'topic_replies_real - topic_replies', '0') . ' + WHERE topic_visibility = ' . ITEM_APPROVED; + $this->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . 'topics + SET topic_posts_approved = 0, + topic_posts_unapproved = (' . $this->db->sql_case('topic_replies_real > topic_replies', 'topic_replies_real - topic_replies', '0') . ') + 1 + WHERE topic_visibility = ' . ITEM_UNAPPROVED; + $this->sql_query($sql); + } + + public function update_forums_topic_and_post_counts($start) + { + $start = (int) $start; + $limit = 10; + $converted_forums = 0; + + if (!$start) + { + // Preserve the forum_posts value for link forums as it represents redirects. + $sql = 'UPDATE ' . $this->table_prefix . 'forums + SET forum_posts_approved = forum_posts + WHERE forum_type = ' . FORUM_LINK; + $this->db->sql_query($sql); + } + + $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS sum_topics, SUM(topic_posts_approved) AS sum_posts_approved, SUM(topic_posts_unapproved) AS sum_posts_unapproved + FROM ' . $this->table_prefix . 'topics + GROUP BY forum_id, topic_visibility + ORDER BY forum_id, topic_visibility'; + $result = $this->db->sql_query_limit($sql, $limit, $start); + + $update_forums = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $converted_forums++; + + $forum_id = (int) $row['forum_id']; + if (!isset($update_forums[$forum_id])) + { + $update_forums[$forum_id] = array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + ); + } + + $update_forums[$forum_id]['forum_posts_approved'] += (int) $row['sum_posts_approved']; + $update_forums[$forum_id]['forum_posts_unapproved'] += (int) $row['sum_posts_unapproved']; + + $update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics_approved' : 'forum_topics_unapproved')] += (int) $row['sum_topics']; + } + $this->db->sql_freeresult($result); + + foreach ($update_forums as $forum_id => $forum_data) + { + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $forum_data) . ' + WHERE forum_id = ' . $forum_id; + $this->sql_query($sql); + } + + if ($converted_forums < $limit) + { + // There are no more topics, we are done + return; + } + + // There are still more topics to query, return the next start value + return $start + $limit; + } +} diff --git a/install/update/new/phpbb/db/migration/data/v32x/timezone_p3.php b/install/update/new/phpbb/db/migration/data/v32x/timezone_p3.php new file mode 100644 index 0000000..433f62a --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v32x/timezone_p3.php @@ -0,0 +1,29 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class timezone_p3 extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\timezone'); + } + + public function update_data() + { + return array( + array('config.remove', array('board_dst')), + ); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v32x/user_emoji_permission.php b/install/update/new/phpbb/db/migration/data/v32x/user_emoji_permission.php new file mode 100644 index 0000000..98759c7 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v32x/user_emoji_permission.php @@ -0,0 +1,44 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class user_emoji_permission extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + $sql = 'SELECT auth_option_id + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option = 'u_emoji'"; + $result = $this->db->sql_query($sql); + $auth_option_id = $this->db->sql_fetchfield('auth_option_id'); + $this->db->sql_freeresult($result); + + return $auth_option_id !== false; + } + + static public function depends_on() + { + return [ + '\phpbb\db\migration\data\v32x\v329rc1', + ]; + } + + public function update_data() + { + return [ + ['permission.add', ['u_emoji']], + ['permission.permission_set', ['REGISTERED', 'u_emoji', 'group']], + ]; + } +} diff --git a/install/update/new/phpbb/db/migration/data/v32x/v328.php b/install/update/new/phpbb/db/migration/data/v32x/v328.php new file mode 100644 index 0000000..28ff2c7 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v32x/v328.php @@ -0,0 +1,36 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class v328 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.8', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v328rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.8')), + ); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v32x/v328rc1.php b/install/update/new/phpbb/db/migration/data/v32x/v328rc1.php new file mode 100644 index 0000000..fa43cf3 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v32x/v328rc1.php @@ -0,0 +1,37 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class v328rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.8-RC1', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\timezone_p3', + '\phpbb\db\migration\data\v32x\v327', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.8-RC1')), + ); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v32x/v329.php b/install/update/new/phpbb/db/migration/data/v32x/v329.php new file mode 100644 index 0000000..e88e264 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v32x/v329.php @@ -0,0 +1,37 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class v329 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.9', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v329rc1', + '\phpbb\db\migration\data\v32x\user_emoji_permission', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.9')), + ); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v32x/v329rc1.php b/install/update/new/phpbb/db/migration/data/v32x/v329rc1.php new file mode 100644 index 0000000..271bf62 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v32x/v329rc1.php @@ -0,0 +1,36 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v32x; + +class v329rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.2.9-RC1', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v328', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.2.9-RC1')), + ); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php b/install/update/new/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php new file mode 100644 index 0000000..209aba3 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/add_display_unapproved_posts_config.php @@ -0,0 +1,34 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v330; + +class add_display_unapproved_posts_config extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->config->offsetExists('display_unapproved_posts'); + } + + public static function depends_on() + { + return ['\phpbb\db\migration\data\v330\dev',]; + } + + public function update_data() + { + return [ + ['config.add', ['display_unapproved_posts', 1]], + ]; + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/dev.php b/install/update/new/phpbb/db/migration/data/v330/dev.php new file mode 100644 index 0000000..209f9fc --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/dev.php @@ -0,0 +1,36 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v330; + +class dev extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return version_compare($this->config['version'], '3.3.0-dev', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v327', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.3.0-dev')), + ); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/forums_legend_limit.php b/install/update/new/phpbb/db/migration/data/v330/forums_legend_limit.php new file mode 100644 index 0000000..c5a4bee --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/forums_legend_limit.php @@ -0,0 +1,49 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v330; + +class forums_legend_limit extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->db_tools->sql_column_exists($this->table_prefix . 'forums', 'display_subforum_limit'); + } + + static public function depends_on() + { + return ['\phpbb\db\migration\data\v330\v330b1']; + } + + public function update_schema() + { + return [ + 'add_columns' => [ + $this->table_prefix . 'forums' => [ + 'display_subforum_limit' => ['BOOL', 0, 'after' => 'display_subforum_list'], + ], + ], + ]; + } + + public function revert_schema() + { + return [ + 'drop_columns' => [ + $this->table_prefix . 'forums' => [ + 'display_subforum_limit', + ], + ], + ]; + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/jquery_update.php b/install/update/new/phpbb/db/migration/data/v330/jquery_update.php new file mode 100644 index 0000000..f1ac6cd --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/jquery_update.php @@ -0,0 +1,37 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v330; + +class jquery_update extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->config['load_jquery_url'] === '//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js'; + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v330\dev', + ); + } + + public function update_data() + { + return array( + array('config.update', array('load_jquery_url', '//ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js')), + ); + } + +} diff --git a/install/update/new/phpbb/db/migration/data/v330/remove_attachment_flash.php b/install/update/new/phpbb/db/migration/data/v330/remove_attachment_flash.php new file mode 100644 index 0000000..c136960 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/remove_attachment_flash.php @@ -0,0 +1,89 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v330; + +class remove_attachment_flash extends \phpbb\db\migration\migration +{ + // Following constants were deprecated in 3.3 + // and moved from constants.php to compatibility_globals.php, + // thus define them as class constants + const ATTACHMENT_CATEGORY_FLASH = 5; + + protected $cat_id = array( + self::ATTACHMENT_CATEGORY_FLASH, + ); + + public static function depends_on() + { + return ['\phpbb\db\migration\data\v330\dev',]; + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'remove_flash_group'))), + ); + } + + public function remove_flash_group() + { + // select group ids of outdated media + $sql = 'SELECT group_id + FROM ' . EXTENSION_GROUPS_TABLE . ' + WHERE ' . $this->db->sql_in_set('cat_id', $this->cat_id); + $result = $this->db->sql_query($sql); + + $group_ids = array(); + while ($group_id = (int) $this->db->sql_fetchfield('group_id')) + { + $group_ids[] = $group_id; + } + $this->db->sql_freeresult($result); + + // nothing to do, admin has removed all the outdated media extension groups + if (empty($group_ids)) + { + return true; + } + + // get the group id of downloadable files + $sql = 'SELECT group_id + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE group_name = 'DOWNLOADABLE_FILES'"; + $result = $this->db->sql_query($sql); + $download_id = (int) $this->db->sql_fetchfield('group_id'); + $this->db->sql_freeresult($result); + + if (empty($download_id)) + { + $sql = 'UPDATE ' . EXTENSIONS_TABLE . ' + SET group_id = 0 + WHERE ' . $this->db->sql_in_set('group_id', $group_ids); + } + else + { + // move outdated media extensions to downloadable files + $sql = 'UPDATE ' . EXTENSIONS_TABLE . " + SET group_id = $download_id" . ' + WHERE ' . $this->db->sql_in_set('group_id', $group_ids); + } + + $this->db->sql_query($sql); + + // delete the now empty, outdated media extension groups + $sql = 'DELETE FROM ' . EXTENSION_GROUPS_TABLE . ' + WHERE ' . $this->db->sql_in_set('group_id', $group_ids); + $this->db->sql_query($sql); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/remove_email_hash.php b/install/update/new/phpbb/db/migration/data/v330/remove_email_hash.php new file mode 100644 index 0000000..8ac8f4e --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/remove_email_hash.php @@ -0,0 +1,62 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v330; + +class remove_email_hash extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return ['\phpbb\db\migration\data\v30x\release_3_0_0']; + } + + public function update_schema() + { + return [ + 'add_index' => [ + $this->table_prefix . 'users' => [ + 'user_email' => ['user_email'], + ], + ], + 'drop_keys' => [ + $this->table_prefix . 'users' => [ + 'user_email_hash', + ], + ], + 'drop_columns' => [ + $this->table_prefix . 'users' => ['user_email_hash'], + ], + ]; + } + + public function revert_schema() + { + return [ + 'add_columns' => [ + $this->table_prefix . 'users' => [ + 'user_email_hash' => ['BINT', 0], + ], + ], + 'add_index' => [ + $this->table_prefix . 'users' => [ + 'user_email_hash', + ], + ], + 'drop_keys' => [ + $this->table_prefix . 'users' => [ + 'user_email' => ['user_email'], + ], + ], + ]; + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/remove_max_pass_chars.php b/install/update/new/phpbb/db/migration/data/v330/remove_max_pass_chars.php new file mode 100644 index 0000000..10e5ee3 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/remove_max_pass_chars.php @@ -0,0 +1,43 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v330; + +class remove_max_pass_chars extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return !$this->config->offsetExists('max_pass_chars'); + } + + public static function depends_on() + { + return [ + '\phpbb\db\migration\data\v330\dev', + ]; + } + + public function update_data() + { + return [ + ['config.remove', ['max_pass_chars']], + ]; + } + + public function revert_data() + { + return [ + ['config.add', ['max_pass_chars', 100]], + ]; + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/reset_password.php b/install/update/new/phpbb/db/migration/data/v330/reset_password.php new file mode 100644 index 0000000..953d478 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/reset_password.php @@ -0,0 +1,48 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\migration\data\v330; + +class reset_password extends \phpbb\db\migration\migration +{ + static public function depends_on() + { + return [ + '\phpbb\db\migration\data\v330\dev', + ]; + } + + public function update_schema() + { + return [ + 'add_columns' => [ + $this->table_prefix . 'users' => [ + 'reset_token' => ['VCHAR:64', '', 'after' => 'user_actkey'], + 'reset_token_expiration' => ['TIMESTAMP', 0, 'after' => 'reset_token'], + ], + ], + ]; + } + + public function revert_schema() + { + return [ + 'drop_columns' => [ + $this->table_prefix . 'users' => [ + 'reset_token', + 'reset_token_expiration', + ], + ], + ]; + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/v330.php b/install/update/new/phpbb/db/migration/data/v330/v330.php new file mode 100644 index 0000000..05baffb --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/v330.php @@ -0,0 +1,37 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v330; + +class v330 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return version_compare($this->config['version'], '3.3.0', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v32x\v329', + '\phpbb\db\migration\data\v330\v330rc1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.3.0')), + ); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/v330b1.php b/install/update/new/phpbb/db/migration/data/v330/v330b1.php new file mode 100644 index 0000000..3df4450 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/v330b1.php @@ -0,0 +1,41 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v330; + +class v330b1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return version_compare($this->config['version'], '3.3.0-b1', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v330\jquery_update', + '\phpbb\db\migration\data\v330\reset_password', + '\phpbb\db\migration\data\v330\remove_attachment_flash', + '\phpbb\db\migration\data\v330\remove_max_pass_chars', + '\phpbb\db\migration\data\v32x\v328', + '\phpbb\db\migration\data\v330\dev', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.3.0-b1')), + ); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/v330b2.php b/install/update/new/phpbb/db/migration/data/v330/v330b2.php new file mode 100644 index 0000000..cb2198a --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/v330b2.php @@ -0,0 +1,39 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v330; + +class v330b2 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return version_compare($this->config['version'], '3.3.0-b2', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v330\add_display_unapproved_posts_config', + '\phpbb\db\migration\data\v330\forums_legend_limit', + '\phpbb\db\migration\data\v330\remove_email_hash', + '\phpbb\db\migration\data\v330\v330b1', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.3.0-b2')), + ); + } +} diff --git a/install/update/new/phpbb/db/migration/data/v330/v330rc1.php b/install/update/new/phpbb/db/migration/data/v330/v330rc1.php new file mode 100644 index 0000000..5219375 --- /dev/null +++ b/install/update/new/phpbb/db/migration/data/v330/v330rc1.php @@ -0,0 +1,36 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v330; + +class v330rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return version_compare($this->config['version'], '3.3.0-RC1', '>='); + } + + static public function depends_on() + { + return array( + '\phpbb\db\migration\data\v330\v330b2', + ); + } + + public function update_data() + { + return array( + array('config.update', array('version', '3.3.0-RC1')), + ); + } +} diff --git a/install/update/new/phpbb/db/migration/tool/module.php b/install/update/new/phpbb/db/migration/tool/module.php new file mode 100644 index 0000000..93c3384 --- /dev/null +++ b/install/update/new/phpbb/db/migration/tool/module.php @@ -0,0 +1,556 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\tool; + +use phpbb\module\exception\module_exception; + +/** +* Migration module management tool +*/ +class module implements \phpbb\db\migration\tool\tool_interface +{ + /** @var \phpbb\cache\service */ + protected $cache; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\module\module_manager */ + protected $module_manager; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** @var string */ + protected $modules_table; + + /** @var array */ + protected $module_categories = array(); + + /** + * Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\cache\service $cache + * @param \phpbb\user $user + * @param \phpbb\module\module_manager $module_manager + * @param string $phpbb_root_path + * @param string $php_ext + * @param string $modules_table + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\user $user, \phpbb\module\module_manager $module_manager, $phpbb_root_path, $php_ext, $modules_table) + { + $this->db = $db; + $this->cache = $cache; + $this->user = $user; + $this->module_manager = $module_manager; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->modules_table = $modules_table; + } + + /** + * {@inheritdoc} + */ + public function get_name() + { + return 'module'; + } + + /** + * Module Exists + * + * Check if a module exists + * + * @param string $class The module class(acp|mcp|ucp) + * @param int|string|bool $parent The parent module_id|module_langname (0 for no parent). + * Use false to ignore the parent check and check class wide. + * @param int|string $module The module_id|module_langname you would like to + * check for to see if it exists + * @param bool $lazy Checks lazily if the module exists. Returns true if it exists in at + * least one given parent. + * @return bool true if module exists in *all* given parents, false if not in any given parent; + * true if ignoring parent check and module exists class wide, false if not found at all. + */ + public function exists($class, $parent, $module, $lazy = false) + { + // the main root directory should return true + if (!$module) + { + return true; + } + + $parent_sqls = []; + if ($parent !== false) + { + $parents = $this->get_parent_module_id($parent, $module, false); + if ($parents === false) + { + return false; + } + + foreach ((array) $parents as $parent_id) + { + $parent_sqls[] = 'AND parent_id = ' . (int) $parent_id; + } + } + else + { + $parent_sqls[] = ''; + } + + foreach ($parent_sqls as $parent_sql) + { + $sql = 'SELECT module_id + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + $parent_sql + AND " . ((is_numeric($module)) ? 'module_id = ' . (int) $module : "module_langname = '" . $this->db->sql_escape($module) . "'"); + $result = $this->db->sql_query($sql); + $module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + if (!$lazy && !$module_id) + { + return false; + } + if ($lazy && $module_id) + { + return true; + } + } + + // Returns true, if modules exist in all parents and false otherwise + return !$lazy; + } + + /** + * Module Add + * + * Add a new module + * + * @param string $class The module class(acp|mcp|ucp) + * @param int|string $parent The parent module_id|module_langname (0 for no parent) + * @param array $data an array of the data on the new \module. + * This can be setup in two different ways. + * 1. The "manual" way. For inserting a category or one at a time. + * It will be merged with the base array shown a bit below, + * but at the least requires 'module_langname' to be sent, and, + * if you want to create a module (instead of just a category) you must + * send module_basename and module_mode. + * array( + * 'module_enabled' => 1, + * 'module_display' => 1, + * 'module_basename' => '', + * 'module_class' => $class, + * 'parent_id' => (int) $parent, + * 'module_langname' => '', + * 'module_mode' => '', + * 'module_auth' => '', + * ) + * 2. The "automatic" way. For inserting multiple at a time based on the + * specs in the info file for the module(s). For this to work the + * modules must be correctly setup in the info file. + * An example follows (this would insert the settings, log, and flag + * modes from the includes/acp/info/acp_asacp.php file): + * array( + * 'module_basename' => 'asacp', + * 'modes' => array('settings', 'log', 'flag'), + * ) + * Optionally you may not send 'modes' and it will insert all of the + * modules in that info file. + * path, specify that here + * @return null + * @throws \phpbb\db\migration\exception + */ + public function add($class, $parent = 0, $data = array()) + { + global $user, $phpbb_log; + + // allow sending the name as a string in $data to create a category + if (!is_array($data)) + { + $data = array('module_langname' => $data); + } + + $parents = (array) $this->get_parent_module_id($parent, $data); + + if (!isset($data['module_langname'])) + { + // The "automatic" way + $basename = (isset($data['module_basename'])) ? $data['module_basename'] : ''; + $module = $this->get_module_info($class, $basename); + + foreach ($module['modes'] as $mode => $module_info) + { + if (!isset($data['modes']) || in_array($mode, $data['modes'])) + { + $new_module = array( + 'module_basename' => $basename, + 'module_langname' => $module_info['title'], + 'module_mode' => $mode, + 'module_auth' => $module_info['auth'], + 'module_display' => (isset($module_info['display'])) ? $module_info['display'] : true, + 'before' => (isset($module_info['before'])) ? $module_info['before'] : false, + 'after' => (isset($module_info['after'])) ? $module_info['after'] : false, + ); + + // Run the "manual" way with the data we've collected. + foreach ($parents as $parent) + { + $this->add($class, $parent, $new_module); + } + } + } + + return; + } + + foreach ($parents as $parent) + { + $data['parent_id'] = $parent; + + // The "manual" way + if (!$this->exists($class, false, $parent)) + { + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent); + } + + if ($this->exists($class, $parent, $data['module_langname'])) + { + throw new \phpbb\db\migration\exception('MODULE_EXISTS', $data['module_langname']); + } + + $module_data = array( + 'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1, + 'module_display' => (isset($data['module_display'])) ? $data['module_display'] : 1, + 'module_basename' => (isset($data['module_basename'])) ? $data['module_basename'] : '', + 'module_class' => $class, + 'parent_id' => (int) $parent, + 'module_langname' => (isset($data['module_langname'])) ? $data['module_langname'] : '', + 'module_mode' => (isset($data['module_mode'])) ? $data['module_mode'] : '', + 'module_auth' => (isset($data['module_auth'])) ? $data['module_auth'] : '', + ); + + try + { + $this->module_manager->update_module_data($module_data); + + // Success + $module_log_name = ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname']); + $phpbb_log->add('admin', (isset($user->data['user_id'])) ? $user->data['user_id'] : ANONYMOUS, $user->ip, 'LOG_MODULE_ADD', false, array($module_log_name)); + + // Move the module if requested above/below an existing one + if (isset($data['before']) && $data['before']) + { + $before_mode = $before_langname = ''; + if (is_array($data['before'])) + { + // Restore legacy-legacy behaviour from phpBB 3.0 + list($before_mode, $before_langname) = $data['before']; + } + else + { + // Legacy behaviour from phpBB 3.1+ + $before_langname = $data['before']; + } + + $sql = 'SELECT left_id + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND parent_id = " . (int) $parent . " + AND module_langname = '" . $this->db->sql_escape($before_langname) . "'" + . (($before_mode) ? " AND module_mode = '" . $this->db->sql_escape($before_mode) . "'" : ''); + $result = $this->db->sql_query($sql); + $to_left = (int) $this->db->sql_fetchfield('left_id'); + $this->db->sql_freeresult($result); + + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = left_id + 2, right_id = right_id + 2 + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND left_id >= $to_left + AND left_id < {$module_data['left_id']}"; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = $to_left, right_id = " . ($to_left + 1) . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND module_id = {$module_data['module_id']}"; + $this->db->sql_query($sql); + } + else if (isset($data['after']) && $data['after']) + { + $after_mode = $after_langname = ''; + if (is_array($data['after'])) + { + // Restore legacy-legacy behaviour from phpBB 3.0 + list($after_mode, $after_langname) = $data['after']; + } + else + { + // Legacy behaviour from phpBB 3.1+ + $after_langname = $data['after']; + } + + $sql = 'SELECT right_id + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND parent_id = " . (int) $parent . " + AND module_langname = '" . $this->db->sql_escape($after_langname) . "'" + . (($after_mode) ? " AND module_mode = '" . $this->db->sql_escape($after_mode) . "'" : ''); + $result = $this->db->sql_query($sql); + $to_right = (int) $this->db->sql_fetchfield('right_id'); + $this->db->sql_freeresult($result); + + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = left_id + 2, right_id = right_id + 2 + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND left_id >= $to_right + AND left_id < {$module_data['left_id']}"; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->modules_table . ' + SET left_id = ' . ($to_right + 1) . ', right_id = ' . ($to_right + 2) . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND module_id = {$module_data['module_id']}"; + $this->db->sql_query($sql); + } + } + catch (module_exception $e) + { + // Error + throw new \phpbb\db\migration\exception('MODULE_ERROR', $e->getMessage()); + } + } + + // Clear the Modules Cache + $this->module_manager->remove_cache_file($class); + } + + /** + * Module Remove + * + * Remove a module + * + * @param string $class The module class(acp|mcp|ucp) + * @param int|string|bool $parent The parent module_id|module_langname(0 for no parent). + * Use false to ignore the parent check and check class wide. + * @param int|string $module The module id|module_langname + * specify that here + * @return null + * @throws \phpbb\db\migration\exception + */ + public function remove($class, $parent = 0, $module = '') + { + // Imitation of module_add's "automatic" and "manual" method so the uninstaller works from the same set of instructions for umil_auto + if (is_array($module)) + { + if (isset($module['module_langname'])) + { + // Manual Method + return $this->remove($class, $parent, $module['module_langname']); + } + + // Failed. + if (!isset($module['module_basename'])) + { + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST'); + } + + // Automatic method + $basename = $module['module_basename']; + $module_info = $this->get_module_info($class, $basename); + + foreach ($module_info['modes'] as $mode => $info) + { + if (!isset($module['modes']) || in_array($mode, $module['modes'])) + { + $this->remove($class, $parent, $info['title']); + } + } + } + else + { + if (!$this->exists($class, $parent, $module, true)) + { + return; + } + + $parent_sql = ''; + if ($parent !== false) + { + $parents = (array) $this->get_parent_module_id($parent, $module); + $parent_sql = 'AND ' . $this->db->sql_in_set('parent_id', $parents); + } + + $module_ids = array(); + if (!is_numeric($module)) + { + $sql = 'SELECT module_id + FROM ' . $this->modules_table . " + WHERE module_langname = '" . $this->db->sql_escape($module) . "' + AND module_class = '" . $this->db->sql_escape($class) . "' + $parent_sql"; + $result = $this->db->sql_query($sql); + while ($module_id = $this->db->sql_fetchfield('module_id')) + { + $module_ids[] = (int) $module_id; + } + $this->db->sql_freeresult($result); + } + else + { + $module_ids[] = (int) $module; + } + + foreach ($module_ids as $module_id) + { + $this->module_manager->delete_module($module_id, $class); + } + + $this->module_manager->remove_cache_file($class); + } + } + + /** + * {@inheritdoc} + */ + public function reverse() + { + $arguments = func_get_args(); + $original_call = array_shift($arguments); + + $call = false; + switch ($original_call) + { + case 'add': + $call = 'remove'; + break; + + case 'remove': + $call = 'add'; + break; + + case 'reverse': + // Reversing a reverse is just the call itself + $call = array_shift($arguments); + break; + } + + if ($call) + { + return call_user_func_array(array(&$this, $call), $arguments); + } + } + + /** + * Wrapper for \acp_modules::get_module_infos() + * + * @param string $class Module Class + * @param string $basename Module Basename + * @return array Module Information + * @throws \phpbb\db\migration\exception + */ + protected function get_module_info($class, $basename) + { + $module = $this->module_manager->get_module_infos($class, $basename, true); + + if (empty($module)) + { + throw new \phpbb\db\migration\exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename); + } + + return array_pop($module); + } + + /** + * Get the list of installed module categories + * key - module_id + * value - module_langname + * + * @return null + */ + protected function get_categories_list() + { + // Select the top level categories + // and 2nd level [sub]categories + $sql = 'SELECT m2.module_id, m2.module_langname + FROM ' . $this->modules_table . ' m1, ' . $this->modules_table . " m2 + WHERE m1.parent_id = 0 + AND (m1.module_id = m2.module_id OR m2.parent_id = m1.module_id) + ORDER BY m1.module_id, m2.module_id ASC"; + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $this->module_categories[(int) $row['module_id']] = $row['module_langname']; + } + $this->db->sql_freeresult($result); + } + + /** + * Get parent module id + * + * @param string|int $parent_id The parent module_id|module_langname + * @param int|string|array $data The module_id, module_langname for existence checking or module data array for adding + * @param bool $throw_exception The flag indicating if exception should be thrown on error + * @return mixed The int parent module_id, an array of int parent module_id values or false + * @throws \phpbb\db\migration\exception + */ + public function get_parent_module_id($parent_id, $data = '', $throw_exception = true) + { + // Allow '' to be sent as 0 + $parent_id = $parent_id ?: 0; + + if (!is_numeric($parent_id)) + { + // Refresh the $module_categories array + $this->get_categories_list(); + + // Search for the parent module_langname + $ids = array_keys($this->module_categories, $parent_id); + + switch (count($ids)) + { + // No parent with the given module_langname exist + case 0: + if ($throw_exception) + { + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent_id); + } + + return false; + break; + + // Return the module id + case 1: + return (int) $ids[0]; + break; + + default: + // This represents the old behaviour of phpBB 3.0 + return $ids; + break; + } + } + + return $parent_id; + } +} diff --git a/install/update/new/phpbb/db/migrator.php b/install/update/new/phpbb/db/migrator.php new file mode 100644 index 0000000..3a1ee75 --- /dev/null +++ b/install/update/new/phpbb/db/migrator.php @@ -0,0 +1,1037 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db; + +use phpbb\db\output_handler\migrator_output_handler_interface; +use phpbb\db\output_handler\null_migrator_output_handler; +use Symfony\Component\DependencyInjection\ContainerAwareInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* The migrator is responsible for applying new migrations in the correct order. +*/ +class migrator +{ + /** + * @var ContainerInterface + */ + protected $container; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\db\tools\tools_interface */ + protected $db_tools; + + /** @var \phpbb\db\migration\helper */ + protected $helper; + + /** @var string */ + protected $table_prefix; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** @var string */ + protected $migrations_table; + + /** + * State of all migrations + * + * (SELECT * FROM migrations table) + * + * @var array + */ + protected $migration_state = array(); + + /** + * Array of all migrations available to be run + * + * @var array + */ + protected $migrations = array(); + + /** + * Array of migrations that have been determined to be fulfillable + * + * @var array + */ + protected $fulfillable_migrations = array(); + + /** + * 'name,' 'class,' and 'state' of the last migration run + * + * 'effectively_installed' set and set to true if the migration was effectively_installed + * + * @var array + */ + protected $last_run_migration = false; + + /** + * The output handler. A null handler is configured by default. + * + * @var migrator_output_handler_interface + */ + protected $output_handler; + + /** + * Constructor of the database migrator + */ + public function __construct(ContainerInterface $container, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools, \phpbb\db\migration\helper $helper) + { + $this->container = $container; + $this->config = $config; + $this->db = $db; + $this->db_tools = $db_tools; + $this->helper = $helper; + + $this->migrations_table = $migrations_table; + + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->table_prefix = $table_prefix; + + $this->output_handler = new null_migrator_output_handler(); + + foreach ($tools as $tool) + { + $this->tools[$tool->get_name()] = $tool; + } + + $this->tools['dbtools'] = $this->db_tools; + + $this->load_migration_state(); + } + + /** + * Set the output handler. + * + * @param migrator_output_handler_interface $handler The output handler + */ + public function set_output_handler(migrator_output_handler_interface $handler) + { + $this->output_handler = $handler; + } + + /** + * Loads all migrations and their application state from the database. + * + * @return null + */ + public function load_migration_state() + { + $this->migration_state = array(); + + // prevent errors in case the table does not exist yet + $this->db->sql_return_on_error(true); + + $sql = "SELECT * + FROM " . $this->migrations_table; + $result = $this->db->sql_query($sql); + + if (!$this->db->get_sql_error_triggered()) + { + while ($migration = $this->db->sql_fetchrow($result)) + { + $this->migration_state[$migration['migration_name']] = $migration; + + $this->migration_state[$migration['migration_name']]['migration_depends_on'] = unserialize($migration['migration_depends_on']); + $this->migration_state[$migration['migration_name']]['migration_data_state'] = !empty($migration['migration_data_state']) ? unserialize($migration['migration_data_state']) : ''; + } + } + + $this->db->sql_freeresult($result); + + $this->db->sql_return_on_error(false); + } + + /** + * Get an array with information about the last migration run. + * + * The array contains 'name', 'class' and 'state'. 'effectively_installed' is set + * and set to true if the last migration was effectively_installed. + * + * @return array + */ + public function get_last_run_migration() + { + return $this->last_run_migration; + } + + /** + * Sets the list of available migration class names to the given array. + * + * @param array $class_names An array of migration class names + * @return null + */ + public function set_migrations($class_names) + { + foreach ($class_names as $key => $class) + { + if (!self::is_migration($class)) + { + unset($class_names[$key]); + } + } + + $this->migrations = $class_names; + } + + /** + * Get the list of available migration class names + * + * @return array Array of all migrations available to be run + */ + public function get_migrations() + { + return $this->migrations; + } + + /** + * Get the list of available and not installed migration class names + * + * @return array + */ + public function get_installable_migrations() + { + $unfinished_migrations = array(); + + foreach ($this->migrations as $name) + { + if (!isset($this->migration_state[$name]) || + !$this->migration_state[$name]['migration_schema_done'] || + !$this->migration_state[$name]['migration_data_done']) + { + $unfinished_migrations[] = $name; + } + } + + return $unfinished_migrations; + } + + /** + * Runs a single update step from the next migration to be applied. + * + * The update step can either be a schema or a (partial) data update. To + * check if update() needs to be called again use the finished() method. + * + * @return null + */ + public function update() + { + $this->container->get('dispatcher')->disable(); + $this->update_do(); + $this->container->get('dispatcher')->enable(); + } + + /** + * Get a valid migration name from the migration state array in case the + * supplied name is not in the migration state list. + * + * @param string $name Migration name + * @return string Migration name + */ + protected function get_valid_name($name) + { + // Try falling back to a valid migration name with or without leading backslash + if (!isset($this->migration_state[$name])) + { + $prepended_name = ($name[0] == '\\' ? '' : '\\') . $name; + $prefixless_name = $name[0] == '\\' ? substr($name, 1) : $name; + + if (isset($this->migration_state[$prepended_name])) + { + $name = $prepended_name; + } + else if (isset($this->migration_state[$prefixless_name])) + { + $name = $prefixless_name; + } + } + + return $name; + } + + /** + * Effectively runs a single update step from the next migration to be applied. + * + * @return null + */ + protected function update_do() + { + foreach ($this->migrations as $name) + { + $name = $this->get_valid_name($name); + + if (!isset($this->migration_state[$name]) || + !$this->migration_state[$name]['migration_schema_done'] || + !$this->migration_state[$name]['migration_data_done']) + { + if (!$this->try_apply($name)) + { + continue; + } + else + { + return; + } + } + else + { + $this->output_handler->write(array('MIGRATION_EFFECTIVELY_INSTALLED', $name), migrator_output_handler_interface::VERBOSITY_DEBUG); + } + } + } + + /** + * Attempts to apply a step of the given migration or one of its dependencies + * + * @param string $name The class name of the migration + * @return bool Whether any update step was successfully run + * @throws \phpbb\db\migration\exception + */ + protected function try_apply($name) + { + if (!class_exists($name)) + { + $this->output_handler->write(array('MIGRATION_NOT_VALID', $name), migrator_output_handler_interface::VERBOSITY_DEBUG); + return false; + } + + $migration = $this->get_migration($name); + + $state = (isset($this->migration_state[$name])) ? + $this->migration_state[$name] : + array( + 'migration_depends_on' => $migration->depends_on(), + 'migration_schema_done' => false, + 'migration_data_done' => false, + 'migration_data_state' => '', + 'migration_start_time' => 0, + 'migration_end_time' => 0, + ); + + if (!empty($state['migration_depends_on'])) + { + $this->output_handler->write(array('MIGRATION_APPLY_DEPENDENCIES', $name), migrator_output_handler_interface::VERBOSITY_DEBUG); + } + + foreach ($state['migration_depends_on'] as $depend) + { + $depend = $this->get_valid_name($depend); + + // Test all possible namings before throwing exception + if ($this->unfulfillable($depend) !== false) + { + throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $depend); + } + + if (!isset($this->migration_state[$depend]) || + !$this->migration_state[$depend]['migration_schema_done'] || + !$this->migration_state[$depend]['migration_data_done']) + { + return $this->try_apply($depend); + } + } + + $this->last_run_migration = array( + 'name' => $name, + 'class' => $migration, + 'state' => $state, + 'task' => '', + ); + + if (!isset($this->migration_state[$name])) + { + if ($state['migration_start_time'] == 0 && $migration->effectively_installed()) + { + $state = array( + 'migration_depends_on' => $migration->depends_on(), + 'migration_schema_done' => true, + 'migration_data_done' => true, + 'migration_data_state' => '', + 'migration_start_time' => 0, + 'migration_end_time' => 0, + ); + + $this->last_run_migration['effectively_installed'] = true; + + $this->output_handler->write(array('MIGRATION_EFFECTIVELY_INSTALLED', $name), migrator_output_handler_interface::VERBOSITY_VERBOSE); + } + else + { + $state['migration_start_time'] = time(); + } + } + + $this->set_migration_state($name, $state); + + if (!$state['migration_schema_done']) + { + $verbosity = empty($state['migration_data_state']) ? + migrator_output_handler_interface::VERBOSITY_VERBOSE : migrator_output_handler_interface::VERBOSITY_DEBUG; + $this->output_handler->write(array('MIGRATION_SCHEMA_RUNNING', $name), $verbosity); + + $this->last_run_migration['task'] = 'process_schema_step'; + + $total_time = (is_array($state['migration_data_state']) && isset($state['migration_data_state']['_total_time'])) ? + $state['migration_data_state']['_total_time'] : 0.0; + $elapsed_time = microtime(true); + + $steps = $this->helper->get_schema_steps($migration->update_schema()); + $result = $this->process_data_step($steps, $state['migration_data_state']); + + $elapsed_time = microtime(true) - $elapsed_time; + $total_time += $elapsed_time; + + if (is_array($result)) + { + $result['_total_time'] = $total_time; + } + + $state['migration_data_state'] = ($result === true) ? '' : $result; + $state['migration_schema_done'] = ($result === true); + + if ($state['migration_schema_done']) + { + $this->output_handler->write(array('MIGRATION_SCHEMA_DONE', $name, $total_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->output_handler->write(array('MIGRATION_SCHEMA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } + } + else if (!$state['migration_data_done']) + { + try + { + $verbosity = empty($state['migration_data_state']) ? + migrator_output_handler_interface::VERBOSITY_VERBOSE : migrator_output_handler_interface::VERBOSITY_DEBUG; + $this->output_handler->write(array('MIGRATION_DATA_RUNNING', $name), $verbosity); + + $this->last_run_migration['task'] = 'process_data_step'; + + $total_time = (is_array($state['migration_data_state']) && isset($state['migration_data_state']['_total_time'])) ? + $state['migration_data_state']['_total_time'] : 0.0; + $elapsed_time = microtime(true); + + $result = $this->process_data_step($migration->update_data(), $state['migration_data_state']); + + $elapsed_time = microtime(true) - $elapsed_time; + $total_time += $elapsed_time; + + if (is_array($result)) + { + $result['_total_time'] = $total_time; + } + + $state['migration_data_state'] = ($result === true) ? '' : $result; + $state['migration_data_done'] = ($result === true); + $state['migration_end_time'] = ($result === true) ? time() : 0; + + if ($state['migration_data_done']) + { + $this->output_handler->write(array('MIGRATION_DATA_DONE', $name, $total_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->output_handler->write(array('MIGRATION_DATA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } + } + catch (\phpbb\db\migration\exception $e) + { + // Reset data state and revert the schema changes + $state['migration_data_state'] = ''; + $this->set_migration_state($name, $state); + + $this->revert_do($name); + + throw $e; + } + } + + $this->set_migration_state($name, $state); + + return true; + } + + /** + * Runs a single revert step from the last migration installed + * + * YOU MUST ADD/SET ALL MIGRATIONS THAT COULD BE DEPENDENT ON THE MIGRATION TO REVERT TO BEFORE CALLING THIS METHOD! + * The revert step can either be a schema or a (partial) data revert. To + * check if revert() needs to be called again use the migration_state() method. + * + * @param string $migration String migration name to revert (including any that depend on this migration) + */ + public function revert($migration) + { + $this->container->get('dispatcher')->disable(); + $this->revert_do($migration); + $this->container->get('dispatcher')->enable(); + } + + /** + * Effectively runs a single revert step from the last migration installed + * + * @param string $migration String migration name to revert (including any that depend on this migration) + * @return null + */ + protected function revert_do($migration) + { + if (!isset($this->migration_state[$migration])) + { + // Not installed + return; + } + + foreach ($this->migrations as $name) + { + $state = $this->migration_state($name); + + if ($state && in_array($migration, $state['migration_depends_on']) && ($state['migration_schema_done'] || $state['migration_data_done'])) + { + $this->revert_do($name); + return; + } + } + + $this->try_revert($migration); + } + + /** + * Attempts to revert a step of the given migration or one of its dependencies + * + * @param string $name The class name of the migration + * @return bool Whether any update step was successfully run + */ + protected function try_revert($name) + { + if (!class_exists($name)) + { + return false; + } + + $migration = $this->get_migration($name); + + $state = $this->migration_state[$name]; + + $this->last_run_migration = array( + 'name' => $name, + 'class' => $migration, + 'task' => '', + ); + + if ($state['migration_data_done']) + { + $verbosity = empty($state['migration_data_state']) ? + migrator_output_handler_interface::VERBOSITY_VERBOSE : migrator_output_handler_interface::VERBOSITY_DEBUG; + $this->output_handler->write(array('MIGRATION_REVERT_DATA_RUNNING', $name), $verbosity); + + $total_time = (is_array($state['migration_data_state']) && isset($state['migration_data_state']['_total_time'])) ? + $state['migration_data_state']['_total_time'] : 0.0; + $elapsed_time = microtime(true); + + $steps = array_merge($this->helper->reverse_update_data($migration->update_data()), $migration->revert_data()); + $result = $this->process_data_step($steps, $state['migration_data_state']); + + $elapsed_time = microtime(true) - $elapsed_time; + $total_time += $elapsed_time; + + if (is_array($result)) + { + $result['_total_time'] = $total_time; + } + + $state['migration_data_state'] = ($result === true) ? '' : $result; + $state['migration_data_done'] = ($result === true) ? false : true; + + $this->set_migration_state($name, $state); + + if (!$state['migration_data_done']) + { + $this->output_handler->write(array('MIGRATION_REVERT_DATA_DONE', $name, $total_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->output_handler->write(array('MIGRATION_REVERT_DATA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } + } + else if ($state['migration_schema_done']) + { + $verbosity = empty($state['migration_data_state']) ? + migrator_output_handler_interface::VERBOSITY_VERBOSE : migrator_output_handler_interface::VERBOSITY_DEBUG; + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_RUNNING', $name), $verbosity); + + $total_time = (is_array($state['migration_data_state']) && isset($state['migration_data_state']['_total_time'])) ? + $state['migration_data_state']['_total_time'] : 0.0; + $elapsed_time = microtime(true); + + $steps = $this->helper->get_schema_steps($migration->revert_schema()); + $result = $this->process_data_step($steps, $state['migration_data_state']); + + $elapsed_time = microtime(true) - $elapsed_time; + $total_time += $elapsed_time; + + if (is_array($result)) + { + $result['_total_time'] = $total_time; + } + + $state['migration_data_state'] = ($result === true) ? '' : $result; + $state['migration_schema_done'] = ($result === true) ? false : true; + + if (!$state['migration_schema_done']) + { + $sql = 'DELETE FROM ' . $this->migrations_table . " + WHERE migration_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + + $this->last_run_migration = false; + unset($this->migration_state[$name]); + + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_DONE', $name, $total_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->set_migration_state($name, $state); + + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } + } + + return true; + } + + /** + * Process the data step of the migration + * + * @param array $steps The steps to run + * @param bool|string $state Current state of the migration + * @param bool $revert true to revert a data step + * @return bool|string migration state. True if completed, serialized array if not finished + * @throws \phpbb\db\migration\exception + */ + protected function process_data_step($steps, $state, $revert = false) + { + if (count($steps) === 0) + { + return true; + } + + $state = is_array($state) ? $state : false; + + // reverse order of steps if reverting + if ($revert === true) + { + $steps = array_reverse($steps); + } + + $step = $last_result = 0; + if ($state) + { + $step = $state['step']; + + // We send the result from last time to the callable function + $last_result = $state['result']; + } + + try + { + // Result will be null or true if everything completed correctly + // Stop after each update step, to let the updater control the script runtime + $result = $this->run_step($steps[$step], $last_result, $revert); + if (($result !== null && $result !== true) || $step + 1 < count($steps)) + { + return array( + 'result' => $result, + // Move on if the last call finished + 'step' => ($result !== null && $result !== true) ? $step : $step + 1, + ); + } + } + catch (\phpbb\db\migration\exception $e) + { + // We should try rolling back here + foreach ($steps as $reverse_step_identifier => $reverse_step) + { + // If we've reached the current step we can break because we reversed everything that was run + if ($reverse_step_identifier == $step) + { + break; + } + + // Reverse the step that was run + $result = $this->run_step($reverse_step, false, !$revert); + } + + throw $e; + } + + return true; + } + + /** + * Run a single step + * + * An exception should be thrown if an error occurs + * + * @param mixed $step Data step from migration + * @param mixed $last_result Result to pass to the callable (only for 'custom' method) + * @param bool $reverse False to install, True to attempt uninstallation by reversing the call + * @return null + */ + protected function run_step($step, $last_result = 0, $reverse = false) + { + $callable_and_parameters = $this->get_callable_from_step($step, $last_result, $reverse); + + if ($callable_and_parameters === false) + { + return; + } + + $callable = $callable_and_parameters[0]; + $parameters = $callable_and_parameters[1]; + + return call_user_func_array($callable, $parameters); + } + + /** + * Get a callable statement from a data step + * + * @param array $step Data step from migration + * @param mixed $last_result Result to pass to the callable (only for 'custom' method) + * @param bool $reverse False to install, True to attempt uninstallation by reversing the call + * @return array Array with parameters for call_user_func_array(), 0 is the callable, 1 is parameters + * @throws \phpbb\db\migration\exception + */ + protected function get_callable_from_step(array $step, $last_result = 0, $reverse = false) + { + $type = $step[0]; + $parameters = $step[1]; + + $parts = explode('.', $type); + + $class = $parts[0]; + $method = false; + + if (isset($parts[1])) + { + $method = $parts[1]; + } + + switch ($class) + { + case 'if': + if (!isset($parameters[0])) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step); + } + + if (!isset($parameters[1])) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step); + } + + if ($reverse) + { + // We might get unexpected results when trying + // to revert this, so just avoid it + return false; + } + + $condition = $parameters[0]; + + if (!$condition || (is_array($condition) && !$this->run_step($condition, $last_result, $reverse))) + { + return false; + } + + $step = $parameters[1]; + + return $this->get_callable_from_step($step); + break; + + case 'custom': + if (!is_callable($parameters[0])) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step); + } + + if ($reverse) + { + return false; + } + else + { + return array( + $parameters[0], + isset($parameters[1]) ? array_merge($parameters[1], array($last_result)) : array($last_result), + ); + } + break; + + default: + if (!$method) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step); + } + + if (!isset($this->tools[$class])) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step); + } + + if (!method_exists(get_class($this->tools[$class]), $method)) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step); + } + + // Attempt to reverse operations + if ($reverse) + { + array_unshift($parameters, $method); + + return array( + array($this->tools[$class], 'reverse'), + $parameters, + ); + } + + return array( + array($this->tools[$class], $method), + $parameters, + ); + break; + } + } + + /** + * Insert/Update migration row into the database + * + * @param string $name Name of the migration + * @param array $state + * @return null + */ + protected function set_migration_state($name, $state) + { + $migration_row = $state; + $migration_row['migration_depends_on'] = serialize($state['migration_depends_on']); + $migration_row['migration_data_state'] = !empty($state['migration_data_state']) ? serialize($state['migration_data_state']) : ''; + + if (isset($this->migration_state[$name])) + { + $sql = 'UPDATE ' . $this->migrations_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $migration_row) . " + WHERE migration_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + } + else + { + $migration_row['migration_name'] = $name; + $sql = 'INSERT INTO ' . $this->migrations_table . ' + ' . $this->db->sql_build_array('INSERT', $migration_row); + $this->db->sql_query($sql); + } + + $this->migration_state[$name] = $state; + + $this->last_run_migration['state'] = $state; + } + + /** + * Checks if a migration's dependencies can even theoretically be satisfied. + * + * @param string $name The class name of the migration + * @return bool|string False if fulfillable, string of missing migration name if unfulfillable + */ + public function unfulfillable($name) + { + $name = $this->get_valid_name($name); + + if (isset($this->migration_state[$name]) || isset($this->fulfillable_migrations[$name])) + { + return false; + } + + if (!class_exists($name)) + { + return $name; + } + + $migration = $this->get_migration($name); + $depends = $migration->depends_on(); + + foreach ($depends as $depend) + { + $depend = $this->get_valid_name($depend); + $unfulfillable = $this->unfulfillable($depend); + if ($unfulfillable !== false) + { + return $unfulfillable; + } + } + $this->fulfillable_migrations[$name] = true; + + return false; + } + + /** + * Checks whether all available, fulfillable migrations have been applied. + * + * @return bool Whether the migrations have been applied + */ + public function finished() + { + foreach ($this->migrations as $name) + { + if (!isset($this->migration_state[$name])) + { + // skip unfulfillable migrations, but fulfillables mean we + // are not finished yet + if ($this->unfulfillable($name) !== false) + { + continue; + } + + return false; + } + + $migration = $this->migration_state[$name]; + + if (!$migration['migration_schema_done'] || !$migration['migration_data_done']) + { + return false; + } + } + + return true; + } + + /** + * Gets a migration state (whether it is installed and to what extent) + * + * @param string $migration String migration name to check if it is installed + * @return bool|array False if the migration has not at all been installed, array + */ + public function migration_state($migration) + { + if (!isset($this->migration_state[$migration])) + { + return false; + } + + return $this->migration_state[$migration]; + } + + /** + * Helper to get a migration + * + * @param string $name Name of the migration + * @return \phpbb\db\migration\migration + */ + protected function get_migration($name) + { + $migration = new $name($this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix); + + if ($migration instanceof ContainerAwareInterface) + { + $migration->setContainer($this->container); + } + + return $migration; + } + + /** + * This function adds all migrations sent to it to the migrations table + * + * THIS SHOULD NOT GENERALLY BE USED! THIS IS FOR THE PHPBB INSTALLER. + * THIS WILL THROW ERRORS IF MIGRATIONS ALREADY EXIST IN THE TABLE, DO NOT CALL MORE THAN ONCE! + * + * @param array $migrations Array of migrations (names) to add to the migrations table + * @return null + */ + public function populate_migrations($migrations) + { + foreach ($migrations as $name) + { + if ($this->migration_state($name) === false) + { + $state = array( + 'migration_depends_on' => $name::depends_on(), + 'migration_schema_done' => true, + 'migration_data_done' => true, + 'migration_data_state' => '', + 'migration_start_time' => time(), + 'migration_end_time' => time(), + ); + $this->set_migration_state($name, $state); + } + } + } + + /** + * Creates the migrations table if it does not exist. + * @return null + */ + public function create_migrations_table() + { + // Make sure migrations have been installed. + if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations')) + { + $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array( + 'COLUMNS' => array( + 'migration_name' => array('VCHAR', ''), + 'migration_depends_on' => array('TEXT', ''), + 'migration_schema_done' => array('BOOL', 0), + 'migration_data_done' => array('BOOL', 0), + 'migration_data_state' => array('TEXT', ''), + 'migration_start_time' => array('TIMESTAMP', 0), + 'migration_end_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => 'migration_name', + )); + } + } + + /** + * Check if a class is a migration. + * + * @param string $migration A migration class name + * @return bool Return true if class is a migration, false otherwise + */ + static public function is_migration($migration) + { + if (class_exists($migration)) + { + // Migration classes should extend the abstract class + // phpbb\db\migration\migration (which implements the + // migration_interface) and be instantiable. + $reflector = new \ReflectionClass($migration); + if ($reflector->implementsInterface('\phpbb\db\migration\migration_interface') && $reflector->isInstantiable()) + { + return true; + } + } + + return false; + } +} diff --git a/install/update/new/phpbb/db/tools/mssql.php b/install/update/new/phpbb/db/tools/mssql.php new file mode 100644 index 0000000..29f816a --- /dev/null +++ b/install/update/new/phpbb/db/tools/mssql.php @@ -0,0 +1,880 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\tools; + +/** + * Database Tools for handling cross-db actions such as altering columns, etc. + * Currently not supported is returning SQL for creating tables. + */ +class mssql extends tools +{ + /** + * Is the used MS SQL Server a SQL Server 2000? + * @var bool + */ + protected $is_sql_server_2000; + + /** + * Get the column types for mssql based databases + * + * @return array + */ + public static function get_dbms_type_map() + { + return array( + 'mssql' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'ULINT' => '[int]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[nvarchar] (100)', + 'STEXT_UNI' => '[nvarchar] (255)', + 'TEXT_UNI' => '[nvarchar] (4000)', + 'MTEXT_UNI' => '[ntext]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[nvarchar] (255)', + 'VCHAR_UNI:'=> '[nvarchar] (%d)', + 'VCHAR_CI' => '[nvarchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + + 'mssqlnative' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'ULINT' => '[int]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[nvarchar] (100)', + 'STEXT_UNI' => '[nvarchar] (255)', + 'TEXT_UNI' => '[nvarchar] (4000)', + 'MTEXT_UNI' => '[ntext]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[nvarchar] (255)', + 'VCHAR_UNI:'=> '[nvarchar] (%d)', + 'VCHAR_CI' => '[nvarchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + ); + } + + /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param bool $return_statements True if only statements should be returned and no SQL being executed + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false) + { + parent::__construct($db, $return_statements); + + // Determine mapping database type + switch ($this->db->get_sql_layer()) + { + case 'mssql_odbc': + $this->sql_layer = 'mssql'; + break; + + case 'mssqlnative': + $this->sql_layer = 'mssqlnative'; + break; + } + + $this->dbms_type_map = self::get_dbms_type_map(); + } + + /** + * {@inheritDoc} + */ + function sql_list_tables() + { + $sql = "SELECT name + FROM sysobjects + WHERE type='U'"; + $result = $this->db->sql_query($sql); + + $tables = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $name = current($row); + $tables[$name] = $name; + } + $this->db->sql_freeresult($result); + + return $tables; + } + + /** + * {@inheritDoc} + */ + function sql_create_table($table_name, $table_data) + { + // holds the DDL for a column + $columns = $statements = array(); + + if ($this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // Begin transaction + $statements[] = 'begin'; + + // Determine if we have created a PRIMARY KEY in the earliest + $primary_key_gen = false; + + // Determine if the table requires a sequence + $create_sequence = false; + + // Begin table sql statement + $table_sql = 'CREATE TABLE [' . $table_name . '] (' . "\n"; + + if (!isset($table_data['PRIMARY_KEY'])) + { + $table_data['COLUMNS']['mssqlindex'] = array('UINT', null, 'auto_increment'); + $table_data['PRIMARY_KEY'] = 'mssqlindex'; + } + + // Iterate through the columns to create a table + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // here lies an array, filled with information compiled on the column's data + $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + + if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); + } + + // here we add the definition of the new column to the list of columns + $columns[] = "\t [{$column_name}] " . $prepared_column['column_type_sql_default']; + + // see if we have found a primary key set due to a column definition if we have found it, we can stop looking + if (!$primary_key_gen) + { + $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; + } + + // create sequence DDL based off of the existence of auto incrementing columns + if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) + { + $create_sequence = $column_name; + } + } + + // this makes up all the columns in the create table statement + $table_sql .= implode(",\n", $columns); + + // Close the table for two DBMS and add to the statements + $table_sql .= "\n);"; + $statements[] = $table_sql; + + // we have yet to create a primary key for this table, + // this means that we can add the one we really wanted instead + if (!$primary_key_gen) + { + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $primary_key_stmts = $this->sql_create_primary_key($table_name, $table_data['PRIMARY_KEY']); + foreach ($primary_key_stmts as $pk_stmt) + { + $statements[] = $pk_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); + + foreach ($key_stmts as $key_stmt) + { + $statements[] = $key_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Commit Transaction + $statements[] = 'commit'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_list_columns($table_name) + { + $columns = array(); + + $sql = "SELECT c.name + FROM syscolumns c + LEFT JOIN sysobjects o ON c.id = o.id + WHERE o.name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $column = strtolower(current($row)); + $columns[$column] = $column; + } + $this->db->sql_freeresult($result); + + return $columns; + } + + /** + * {@inheritDoc} + */ + function sql_index_exists($table_name, $index_name) + { + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['TYPE'] == 3) + { + if (strtolower($row['INDEX_NAME']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_unique_index_exists($table_name, $index_name) + { + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // Usually NON_UNIQUE is the column we want to check, but we allow for both + if ($row['TYPE'] == 3) + { + if (strtolower($row['INDEX_NAME']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_prepare_column_data($table_name, $column_name, $column_data) + { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + // Get type + list($column_type, ) = $this->get_column_type($column_data[0]); + + // Adjust default value if db-dependent specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; + } + + $sql = ''; + + $return_array = array(); + + $sql .= " {$column_type} "; + $sql_default = " {$column_type} "; + + // For adding columns we need the default definition + if (!is_null($column_data[1])) + { + // For hexadecimal values do not use single quotes + if (strpos($column_data[1], '0x') === 0) + { + $return_array['default'] = 'DEFAULT (' . $column_data[1] . ') '; + $sql_default .= $return_array['default']; + } + else + { + $return_array['default'] = 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; + $sql_default .= $return_array['default']; + } + } + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + // $sql .= 'IDENTITY (1, 1) '; + $sql_default .= 'IDENTITY (1, 1) '; + } + + $return_array['textimage'] = $column_type === '[text]'; + + if (!is_null($column_data[1]) || (isset($column_data[2]) && $column_data[2] == 'auto_increment')) + { + $sql .= 'NOT NULL'; + $sql_default .= 'NOT NULL'; + } + else + { + $sql .= 'NULL'; + $sql_default .= 'NULL'; + } + + $return_array['column_type_sql_default'] = $sql_default; + + $return_array['column_type_sql'] = $sql; + + return $return_array; + } + + /** + * {@inheritDoc} + */ + function sql_column_add($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + // Does not support AFTER, only through temporary table + $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_column_remove($table_name, $column_name, $inline = false) + { + $statements = array(); + + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $indexes = $this->get_existing_indexes($table_name, $column_name); + $indexes = array_merge($indexes, $this->get_existing_indexes($table_name, $column_name, true)); + + // Drop any indexes + $recreate_indexes = array(); + if (!empty($indexes)) + { + foreach ($indexes as $index_name => $index_data) + { + $result = $this->sql_index_drop($table_name, $index_name); + $statements = array_merge($statements, $result); + if (count($index_data) > 1) + { + // Remove this column from the index and recreate it + $recreate_indexes[$index_name] = array_diff($index_data, array($column_name)); + } + } + } + + // Drop primary keys depending on this column + $result = $this->mssql_get_drop_default_primary_key_queries($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Drop default value constraint + $result = $this->mssql_get_drop_default_constraints_queries($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Remove the column + $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; + + if (!empty($recreate_indexes)) + { + // Recreate indexes after we removed the column + foreach ($recreate_indexes as $index_name => $index_data) + { + $result = $this->sql_create_index($table_name, $index_name, $index_data); + $statements = array_merge($statements, $result); + } + } + + $this->return_statements = $old_return_statements; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_index_drop($table_name, $index_name) + { + $statements = array(); + + $statements[] = 'DROP INDEX [' . $table_name . '].[' . $index_name . ']'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_table_drop($table_name) + { + $statements = array(); + + if (!$this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // the most basic operation, get rid of the table + $statements[] = 'DROP TABLE ' . $table_name; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_primary_key($table_name, $column, $inline = false) + { + $statements = array(); + + $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; + $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; + $sql .= '[' . implode("],\n\t\t[", $column) . ']'; + $sql .= ')'; + + $statements[] = $sql; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_unique_index($table_name, $index_name, $column) + { + $statements = array(); + + if ($this->mssql_is_sql_server_2000()) + { + $this->check_index_name_length($table_name, $index_name); + } + + $statements[] = 'CREATE UNIQUE INDEX [' . $index_name . '] ON [' . $table_name . ']([' . implode('], [', $column) . '])'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + // remove index length + $column = preg_replace('#:.*$#', '', $column); + + $statements[] = 'CREATE INDEX [' . $index_name . '] ON [' . $table_name . ']([' . implode('], [', $column) . '])'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritdoc} + */ + protected function get_max_index_name_length() + { + if ($this->mssql_is_sql_server_2000()) + { + return parent::get_max_index_name_length(); + } + else + { + return 128; + } + } + + /** + * {@inheritDoc} + */ + function sql_list_index($table_name) + { + $index_array = array(); + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['TYPE'] == 3) + { + $index_array[] = strtolower($row['INDEX_NAME']); + } + } + $this->db->sql_freeresult($result); + + return $index_array; + } + + /** + * {@inheritDoc} + */ + function sql_column_change($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $indexes = $this->get_existing_indexes($table_name, $column_name); + $unique_indexes = $this->get_existing_indexes($table_name, $column_name, true); + + // Drop any indexes + if (!empty($indexes) || !empty($unique_indexes)) + { + $drop_indexes = array_merge(array_keys($indexes), array_keys($unique_indexes)); + foreach ($drop_indexes as $index_name) + { + $result = $this->sql_index_drop($table_name, $index_name); + $statements = array_merge($statements, $result); + } + } + + // Drop default value constraint + $result = $this->mssql_get_drop_default_constraints_queries($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Change the column + $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; + + if (!empty($column_data['default']) && !$this->mssql_is_column_identity($table_name, $column_name)) + { + // Add new default value constraint + $statements[] = 'ALTER TABLE [' . $table_name . '] ADD CONSTRAINT [DF_' . $table_name . '_' . $column_name . '_1] ' . $column_data['default'] . ' FOR [' . $column_name . ']'; + } + + if (!empty($indexes)) + { + // Recreate indexes after we changed the column + foreach ($indexes as $index_name => $index_data) + { + $result = $this->sql_create_index($table_name, $index_name, $index_data); + $statements = array_merge($statements, $result); + } + } + + if (!empty($unique_indexes)) + { + // Recreate unique indexes after we changed the column + foreach ($unique_indexes as $index_name => $index_data) + { + $result = $this->sql_create_unique_index($table_name, $index_name, $index_data); + $statements = array_merge($statements, $result); + } + } + + $this->return_statements = $old_return_statements; + + return $this->_sql_run_sql($statements); + } + + /** + * Get queries to drop the default constraints of a column + * + * We need to drop the default constraints of a column, + * before being able to change their type or deleting them. + * + * @param string $table_name + * @param string $column_name + * @return array Array with SQL statements + */ + protected function mssql_get_drop_default_constraints_queries($table_name, $column_name) + { + $statements = array(); + if ($this->mssql_is_sql_server_2000()) + { + // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx + // Deprecated in SQL Server 2005 + $sql = "SELECT so.name AS def_name + FROM sysobjects so + JOIN sysconstraints sc ON so.id = sc.constid + WHERE object_name(so.parent_obj) = '{$table_name}' + AND so.xtype = 'D' + AND sc.colid = (SELECT colid FROM syscolumns + WHERE id = object_id('{$table_name}') + AND name = '{$column_name}')"; + } + else + { + $sql = "SELECT dobj.name AS def_name + FROM sys.columns col + LEFT OUTER JOIN sys.objects dobj ON (dobj.object_id = col.default_object_id AND dobj.type = 'D') + WHERE col.object_id = object_id('{$table_name}') + AND col.name = '{$column_name}' + AND dobj.name IS NOT NULL"; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $statements[] = 'ALTER TABLE [' . $table_name . '] DROP CONSTRAINT [' . $row['def_name'] . ']'; + } + $this->db->sql_freeresult($result); + + return $statements; + } + + /** + * Get queries to drop the primary keys depending on the specified column + * + * We need to drop primary keys depending on this column before being able + * to delete them. + * + * @param string $table_name + * @param string $column_name + * @return array Array with SQL statements + */ + protected function mssql_get_drop_default_primary_key_queries($table_name, $column_name) + { + $statements = array(); + + $sql = "SELECT ccu.CONSTRAINT_NAME, ccu.COLUMN_NAME + FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc + JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu ON tc.CONSTRAINT_NAME = ccu.Constraint_name + WHERE tc.TABLE_NAME = '{$table_name}' + AND tc.CONSTRAINT_TYPE = 'Primary Key' + AND ccu.COLUMN_NAME = '{$column_name}'"; + + $result = $this->db->sql_query($sql); + + while ($primary_key = $this->db->sql_fetchrow($result)) + { + $statements[] = 'ALTER TABLE [' . $table_name . '] DROP CONSTRAINT [' . $primary_key['CONSTRAINT_NAME'] . ']'; + } + $this->db->sql_freeresult($result); + + return $statements; + } + + /** + * Checks to see if column is an identity column + * + * Identity columns cannot have defaults set for them. + * + * @param string $table_name + * @param string $column_name + * @return bool true if identity, false if not + */ + protected function mssql_is_column_identity($table_name, $column_name) + { + if ($this->mssql_is_sql_server_2000()) + { + // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx + // Deprecated in SQL Server 2005 + $sql = "SELECT COLUMNPROPERTY(object_id('{$table_name}'), '{$column_name}', 'IsIdentity') AS is_identity"; + } + else + { + $sql = "SELECT is_identity FROM sys.columns + WHERE object_id = object_id('{$table_name}') + AND name = '{$column_name}'"; + } + + $result = $this->db->sql_query($sql); + $is_identity = $this->db->sql_fetchfield('is_identity'); + $this->db->sql_freeresult($result); + + return (bool) $is_identity; + } + + /** + * Get a list with existing indexes for the column + * + * @param string $table_name + * @param string $column_name + * @param bool $unique Should we get unique indexes or normal ones + * @return array Array with Index name => columns + */ + public function get_existing_indexes($table_name, $column_name, $unique = false) + { + $existing_indexes = array(); + if ($this->mssql_is_sql_server_2000()) + { + // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx + // Deprecated in SQL Server 2005 + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name + FROM sysindexes ix + INNER JOIN sysindexkeys ixc + ON ixc.id = ix.id + AND ixc.indid = ix.indid + INNER JOIN syscolumns cols + ON cols.colid = ixc.colid + AND cols.id = ix.id + WHERE ix.id = object_id('{$table_name}') + AND cols.name = '{$column_name}' + AND INDEXPROPERTY(ix.id, ix.name, 'IsUnique') = " . ($unique ? '1' : '0'); + } + else + { + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name + FROM sys.indexes ix + INNER JOIN sys.index_columns ixc + ON ixc.object_id = ix.object_id + AND ixc.index_id = ix.index_id + INNER JOIN sys.columns cols + ON cols.column_id = ixc.column_id + AND cols.object_id = ix.object_id + WHERE ix.object_id = object_id('{$table_name}') + AND cols.name = '{$column_name}' + AND ix.is_primary_key = 0 + AND ix.is_unique = " . ($unique ? '1' : '0'); + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (!isset($row['is_unique']) || ($unique && $row['is_unique'] == 'UNIQUE') || (!$unique && $row['is_unique'] == 'NONUNIQUE')) + { + $existing_indexes[$row['phpbb_index_name']] = array(); + } + } + $this->db->sql_freeresult($result); + + if (empty($existing_indexes)) + { + return array(); + } + + if ($this->mssql_is_sql_server_2000()) + { + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name + FROM sysindexes ix + INNER JOIN sysindexkeys ixc + ON ixc.id = ix.id + AND ixc.indid = ix.indid + INNER JOIN syscolumns cols + ON cols.colid = ixc.colid + AND cols.id = ix.id + WHERE ix.id = object_id('{$table_name}') + AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes)); + } + else + { + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name + FROM sys.indexes ix + INNER JOIN sys.index_columns ixc + ON ixc.object_id = ix.object_id + AND ixc.index_id = ix.index_id + INNER JOIN sys.columns cols + ON cols.column_id = ixc.column_id + AND cols.object_id = ix.object_id + WHERE ix.object_id = object_id('{$table_name}') + AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes)); + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $existing_indexes[$row['phpbb_index_name']][] = $row['phpbb_column_name']; + } + $this->db->sql_freeresult($result); + + return $existing_indexes; + } + + /** + * Is the used MS SQL Server a SQL Server 2000? + * + * @return bool + */ + protected function mssql_is_sql_server_2000() + { + if ($this->is_sql_server_2000 === null) + { + $sql = "SELECT CAST(SERVERPROPERTY('productversion') AS VARCHAR(25)) AS mssql_version"; + $result = $this->db->sql_query($sql); + $properties = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + $this->is_sql_server_2000 = $properties['mssql_version'][0] == '8'; + } + + return $this->is_sql_server_2000; + } + +} diff --git a/install/update/new/phpbb/db/tools/postgres.php b/install/update/new/phpbb/db/tools/postgres.php new file mode 100644 index 0000000..276ac13 --- /dev/null +++ b/install/update/new/phpbb/db/tools/postgres.php @@ -0,0 +1,614 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\tools; + +/** + * Database Tools for handling cross-db actions such as altering columns, etc. + * Currently not supported is returning SQL for creating tables. + */ +class postgres extends tools +{ + /** + * Get the column types for postgres only + * + * @return array + */ + public static function get_dbms_type_map() + { + return array( + 'postgres' => array( + 'INT:' => 'INT4', + 'BINT' => 'INT8', + 'ULINT' => 'INT4', // unsigned + 'UINT' => 'INT4', // unsigned + 'UINT:' => 'INT4', // unsigned + 'USINT' => 'INT2', // unsigned + 'BOOL' => 'INT2', // unsigned + 'TINT:' => 'INT2', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'varchar(1000)', + 'STEXT' => 'varchar(3000)', + 'TEXT' => 'varchar(8000)', + 'MTEXT' => 'TEXT', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT_UNI' => 'varchar(4000)', + 'MTEXT_UNI' => 'TEXT', + 'TIMESTAMP' => 'INT4', // unsigned + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar_ci', + 'VARBINARY' => 'bytea', + ), + ); + } + + /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param bool $return_statements True if only statements should be returned and no SQL being executed + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false) + { + parent::__construct($db, $return_statements); + + // Determine mapping database type + $this->sql_layer = 'postgres'; + + $this->dbms_type_map = self::get_dbms_type_map(); + } + + /** + * {@inheritDoc} + */ + function sql_list_tables() + { + $sql = 'SELECT relname + FROM pg_stat_user_tables'; + $result = $this->db->sql_query($sql); + + $tables = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $name = current($row); + $tables[$name] = $name; + } + $this->db->sql_freeresult($result); + + return $tables; + } + + /** + * {@inheritDoc} + */ + function sql_create_table($table_name, $table_data) + { + // holds the DDL for a column + $columns = $statements = array(); + + if ($this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // Begin transaction + $statements[] = 'begin'; + + // Determine if we have created a PRIMARY KEY in the earliest + $primary_key_gen = false; + + // Determine if the table requires a sequence + $create_sequence = false; + + // Begin table sql statement + $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + + // Iterate through the columns to create a table + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // here lies an array, filled with information compiled on the column's data + $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + + if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); + } + + // here we add the definition of the new column to the list of columns + $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; + + // see if we have found a primary key set due to a column definition if we have found it, we can stop looking + if (!$primary_key_gen) + { + $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; + } + + // create sequence DDL based off of the existence of auto incrementing columns + if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) + { + $create_sequence = $column_name; + } + } + + // this makes up all the columns in the create table statement + $table_sql .= implode(",\n", $columns); + + // we have yet to create a primary key for this table, + // this means that we can add the one we really wanted instead + if (!$primary_key_gen) + { + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + $table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + } + } + + // do we need to add a sequence for auto incrementing columns? + if ($create_sequence) + { + $statements[] = "CREATE SEQUENCE {$table_name}_seq;"; + } + + // close the table + $table_sql .= "\n);"; + $statements[] = $table_sql; + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); + + foreach ($key_stmts as $key_stmt) + { + $statements[] = $key_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Commit Transaction + $statements[] = 'commit'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_list_columns($table_name) + { + $columns = array(); + + $sql = "SELECT a.attname + FROM pg_class c, pg_attribute a + WHERE c.relname = '{$table_name}' + AND a.attnum > 0 + AND a.attrelid = c.oid"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $column = strtolower(current($row)); + $columns[$column] = $column; + } + $this->db->sql_freeresult($result); + + return $columns; + } + + /** + * {@inheritDoc} + */ + function sql_index_exists($table_name, $index_name) + { + $sql = "SELECT ic.relname as index_name + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisunique != 't') + AND (i.indisprimary != 't')"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // This DBMS prefixes index names with the table name + $row['index_name'] = $this->strip_table_name_from_index_name($table_name, $row['index_name']); + + if (strtolower($row['index_name']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_unique_index_exists($table_name, $index_name) + { + $sql = "SELECT ic.relname as index_name, i.indisunique + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisprimary != 't')"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['indisunique'] != 't') + { + continue; + } + + // This DBMS prefixes index names with the table name + $row['index_name'] = $this->strip_table_name_from_index_name($table_name, $row['index_name']); + + if (strtolower($row['index_name']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * Function to prepare some column information for better usage + * @access private + */ + function sql_prepare_column_data($table_name, $column_name, $column_data) + { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + // Get type + list($column_type, $orig_column_type) = $this->get_column_type($column_data[0]); + + // Adjust default value if db-dependent specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; + } + + $sql = " {$column_type} "; + + $return_array = array( + 'column_type' => $column_type, + 'auto_increment' => false, + ); + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $default_val = "nextval('{$table_name}_seq')"; + $return_array['auto_increment'] = true; + } + else if (!is_null($column_data[1])) + { + $default_val = "'" . $column_data[1] . "'"; + $return_array['null'] = 'NOT NULL'; + $sql .= 'NOT NULL '; + } + else + { + // Integers need to have 0 instead of empty string as default + if (strpos($column_type, 'INT') === 0) + { + $default_val = '0'; + } + else + { + $default_val = "'" . $column_data[1] . "'"; + } + $return_array['null'] = 'NULL'; + $sql .= 'NULL '; + } + + $return_array['default'] = $default_val; + + $sql .= "DEFAULT {$default_val}"; + + // Unsigned? Then add a CHECK contraint + if (in_array($orig_column_type, $this->unsigned_types)) + { + $return_array['constraint'] = "CHECK ({$column_name} >= 0)"; + $sql .= " CHECK ({$column_name} >= 0)"; + } + + $return_array['column_type_sql'] = $sql; + + return $return_array; + } + + /** + * {@inheritDoc} + */ + function sql_column_add($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + // Does not support AFTER, only through temporary table + if (version_compare($this->db->sql_server_info(true), '8.0', '>=')) + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; + } + else + { + // old versions cannot add columns with default and null information + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type'] . ' ' . $column_data['constraint']; + + if (isset($column_data['null'])) + { + if ($column_data['null'] == 'NOT NULL') + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET NOT NULL'; + } + } + + if (isset($column_data['default'])) + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; + } + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_column_remove($table_name, $column_name, $inline = false) + { + $statements = array(); + + $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN "' . $column_name . '"'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_index_drop($table_name, $index_name) + { + $statements = array(); + + $statements[] = 'DROP INDEX ' . $table_name . '_' . $index_name; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_table_drop($table_name) + { + $statements = array(); + + if (!$this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // the most basic operation, get rid of the table + $statements[] = 'DROP TABLE ' . $table_name; + + // PGSQL does not "tightly" bind sequences and tables, we must guess... + $sql = "SELECT relname + FROM pg_class + WHERE relkind = 'S' + AND relname = '{$table_name}_seq'"; + $result = $this->db->sql_query($sql); + + // We don't even care about storing the results. We already know the answer if we get rows back. + if ($this->db->sql_fetchrow($result)) + { + $statements[] = "DROP SEQUENCE IF EXISTS {$table_name}_seq;\n"; + } + $this->db->sql_freeresult($result); + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_primary_key($table_name, $column, $inline = false) + { + $statements = array(); + + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_unique_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + $statements[] = 'CREATE UNIQUE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + // remove index length + $column = preg_replace('#:.*$#', '', $column); + + $statements[] = 'CREATE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + + return $this->_sql_run_sql($statements); + } + + + /** + * {@inheritDoc} + */ + function sql_list_index($table_name) + { + $index_array = array(); + + $sql = "SELECT ic.relname as index_name + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisunique != 't') + AND (i.indisprimary != 't')"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $row['index_name'] = $this->strip_table_name_from_index_name($table_name, $row['index_name']); + + $index_array[] = $row['index_name']; + } + $this->db->sql_freeresult($result); + + return array_map('strtolower', $index_array); + } + + /** + * {@inheritDoc} + */ + function sql_column_change($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + $sql = 'ALTER TABLE ' . $table_name . ' '; + + $sql_array = array(); + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' TYPE ' . $column_data['column_type']; + + if (isset($column_data['null'])) + { + if ($column_data['null'] == 'NOT NULL') + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET NOT NULL'; + } + else if ($column_data['null'] == 'NULL') + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' DROP NOT NULL'; + } + } + + if (isset($column_data['default'])) + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; + } + + // we don't want to double up on constraints if we change different number data types + if (isset($column_data['constraint'])) + { + $constraint_sql = "SELECT consrc as constraint_data + FROM pg_constraint, pg_class bc + WHERE conrelid = bc.oid + AND bc.relname = '{$table_name}' + AND NOT EXISTS ( + SELECT * + FROM pg_constraint as c, pg_inherits as i + WHERE i.inhrelid = pg_constraint.conrelid + AND c.conname = pg_constraint.conname + AND c.consrc = pg_constraint.consrc + AND c.conrelid = i.inhparent + )"; + + $constraint_exists = false; + + $result = $this->db->sql_query($constraint_sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (trim($row['constraint_data']) == trim($column_data['constraint'])) + { + $constraint_exists = true; + break; + } + } + $this->db->sql_freeresult($result); + + if (!$constraint_exists) + { + $sql_array[] = 'ADD ' . $column_data['constraint']; + } + } + + $sql .= implode(', ', $sql_array); + + $statements[] = $sql; + + return $this->_sql_run_sql($statements); + } + + /** + * Get a list with existing indexes for the column + * + * @param string $table_name + * @param string $column_name + * @param bool $unique Should we get unique indexes or normal ones + * @return array Array with Index name => columns + */ + public function get_existing_indexes($table_name, $column_name, $unique = false) + { + // Not supported + throw new \Exception('DBMS is not supported'); + } +} diff --git a/install/update/new/phpbb/db/tools/tools.php b/install/update/new/phpbb/db/tools/tools.php new file mode 100644 index 0000000..1250a89 --- /dev/null +++ b/install/update/new/phpbb/db/tools/tools.php @@ -0,0 +1,1879 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\tools; + +/** +* Database Tools for handling cross-db actions such as altering columns, etc. +* Currently not supported is returning SQL for creating tables. +*/ +class tools implements tools_interface +{ + /** + * Current sql layer + */ + var $sql_layer = ''; + + /** + * @var object DB object + */ + var $db = null; + + /** + * The Column types for every database we support + * @var array + */ + var $dbms_type_map = array(); + + /** + * Get the column types for every database we support + * + * @return array + */ + static public function get_dbms_type_map() + { + return array( + 'mysql_41' => array( + 'INT:' => 'int(%d)', + 'BINT' => 'bigint(20)', + 'ULINT' => 'INT(10) UNSIGNED', + 'UINT' => 'mediumint(8) UNSIGNED', + 'UINT:' => 'int(%d) UNSIGNED', + 'TINT:' => 'tinyint(%d)', + 'USINT' => 'smallint(4) UNSIGNED', + 'BOOL' => 'tinyint(1) UNSIGNED', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'text', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT' => 'text', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT' => 'text', + 'TEXT_UNI' => 'text', + 'MTEXT' => 'mediumtext', + 'MTEXT_UNI' => 'mediumtext', + 'TIMESTAMP' => 'int(11) UNSIGNED', + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar(255)', + 'VARBINARY' => 'varbinary(255)', + ), + + 'oracle' => array( + 'INT:' => 'number(%d)', + 'BINT' => 'number(20)', + 'ULINT' => 'number(10)', + 'UINT' => 'number(8)', + 'UINT:' => 'number(%d)', + 'TINT:' => 'number(%d)', + 'USINT' => 'number(4)', + 'BOOL' => 'number(1)', + 'VCHAR' => 'varchar2(255)', + 'VCHAR:' => 'varchar2(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'varchar2(1000)', + 'STEXT' => 'varchar2(3000)', + 'TEXT' => 'clob', + 'MTEXT' => 'clob', + 'XSTEXT_UNI'=> 'varchar2(300)', + 'STEXT_UNI' => 'varchar2(765)', + 'TEXT_UNI' => 'clob', + 'MTEXT_UNI' => 'clob', + 'TIMESTAMP' => 'number(11)', + 'DECIMAL' => 'number(5, 2)', + 'DECIMAL:' => 'number(%d, 2)', + 'PDECIMAL' => 'number(6, 3)', + 'PDECIMAL:' => 'number(%d, 3)', + 'VCHAR_UNI' => 'varchar2(765)', + 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')), + 'VCHAR_CI' => 'varchar2(255)', + 'VARBINARY' => 'raw(255)', + ), + + 'sqlite3' => array( + 'INT:' => 'INT(%d)', + 'BINT' => 'BIGINT(20)', + 'ULINT' => 'INTEGER UNSIGNED', + 'UINT' => 'INTEGER UNSIGNED', + 'UINT:' => 'INTEGER UNSIGNED', + 'TINT:' => 'TINYINT(%d)', + 'USINT' => 'INTEGER UNSIGNED', + 'BOOL' => 'INTEGER UNSIGNED', + 'VCHAR' => 'VARCHAR(255)', + 'VCHAR:' => 'VARCHAR(%d)', + 'CHAR:' => 'CHAR(%d)', + 'XSTEXT' => 'TEXT(65535)', + 'STEXT' => 'TEXT(65535)', + 'TEXT' => 'TEXT(65535)', + 'MTEXT' => 'MEDIUMTEXT(16777215)', + 'XSTEXT_UNI'=> 'TEXT(65535)', + 'STEXT_UNI' => 'TEXT(65535)', + 'TEXT_UNI' => 'TEXT(65535)', + 'MTEXT_UNI' => 'MEDIUMTEXT(16777215)', + 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED', + 'DECIMAL' => 'DECIMAL(5,2)', + 'DECIMAL:' => 'DECIMAL(%d,2)', + 'PDECIMAL' => 'DECIMAL(6,3)', + 'PDECIMAL:' => 'DECIMAL(%d,3)', + 'VCHAR_UNI' => 'VARCHAR(255)', + 'VCHAR_UNI:'=> 'VARCHAR(%d)', + 'VCHAR_CI' => 'VARCHAR(255)', + 'VARBINARY' => 'BLOB', + ), + ); + } + + /** + * A list of types being unsigned for better reference in some db's + * @var array + */ + var $unsigned_types = array('ULINT', 'UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP'); + + /** + * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). + * This mode has no effect on some methods (inserting of data for example). This is expressed within the methods command. + */ + var $return_statements = false; + + /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param bool $return_statements True if only statements should be returned and no SQL being executed + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false) + { + $this->db = $db; + $this->return_statements = $return_statements; + + $this->dbms_type_map = self::get_dbms_type_map(); + + // Determine mapping database type + switch ($this->db->get_sql_layer()) + { + case 'mysqli': + $this->sql_layer = 'mysql_41'; + break; + + default: + $this->sql_layer = $this->db->get_sql_layer(); + break; + } + } + + /** + * Setter for {@link $return_statements return_statements}. + * + * @param bool $return_statements True if SQL should not be executed but returned as strings + * @return null + */ + public function set_return_statements($return_statements) + { + $this->return_statements = $return_statements; + } + + /** + * {@inheritDoc} + */ + function sql_list_tables() + { + switch ($this->db->get_sql_layer()) + { + case 'mysqli': + $sql = 'SHOW TABLES'; + break; + + case 'sqlite3': + $sql = 'SELECT name + FROM sqlite_master + WHERE type = "table" + AND name <> "sqlite_sequence"'; + break; + + case 'oracle': + $sql = 'SELECT table_name + FROM USER_TABLES'; + break; + } + + $result = $this->db->sql_query($sql); + + $tables = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $name = current($row); + $tables[$name] = $name; + } + $this->db->sql_freeresult($result); + + return $tables; + } + + /** + * {@inheritDoc} + */ + function sql_table_exists($table_name) + { + $this->db->sql_return_on_error(true); + $result = $this->db->sql_query_limit('SELECT * FROM ' . $table_name, 1); + $this->db->sql_return_on_error(false); + + if ($result) + { + $this->db->sql_freeresult($result); + return true; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_create_table($table_name, $table_data) + { + // holds the DDL for a column + $columns = $statements = array(); + + if ($this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // Begin transaction + $statements[] = 'begin'; + + // Determine if we have created a PRIMARY KEY in the earliest + $primary_key_gen = false; + + // Determine if the table requires a sequence + $create_sequence = false; + + // Begin table sql statement + $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + + // Iterate through the columns to create a table + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // here lies an array, filled with information compiled on the column's data + $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + + if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); + } + + // here we add the definition of the new column to the list of columns + $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; + + // see if we have found a primary key set due to a column definition if we have found it, we can stop looking + if (!$primary_key_gen) + { + $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; + } + + // create sequence DDL based off of the existence of auto incrementing columns + if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) + { + $create_sequence = $column_name; + } + } + + // this makes up all the columns in the create table statement + $table_sql .= implode(",\n", $columns); + + // we have yet to create a primary key for this table, + // this means that we can add the one we really wanted instead + if (!$primary_key_gen) + { + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + switch ($this->sql_layer) + { + case 'mysql_41': + case 'sqlite3': + $table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + break; + + case 'oracle': + $table_sql .= ",\n\t CONSTRAINT pk_{$table_name} PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + break; + } + } + } + + // close the table + switch ($this->sql_layer) + { + case 'mysql_41': + // make sure the table is in UTF-8 mode + $table_sql .= "\n) CHARACTER SET `utf8` COLLATE `utf8_bin`;"; + $statements[] = $table_sql; + break; + + case 'sqlite3': + $table_sql .= "\n);"; + $statements[] = $table_sql; + break; + + case 'oracle': + $table_sql .= "\n)"; + $statements[] = $table_sql; + + // do we need to add a sequence and a tigger for auto incrementing columns? + if ($create_sequence) + { + // create the actual sequence + $statements[] = "CREATE SEQUENCE {$table_name}_seq"; + + // the trigger is the mechanism by which we increment the counter + $trigger = "CREATE OR REPLACE TRIGGER t_{$table_name}\n"; + $trigger .= "BEFORE INSERT ON {$table_name}\n"; + $trigger .= "FOR EACH ROW WHEN (\n"; + $trigger .= "\tnew.{$create_sequence} IS NULL OR new.{$create_sequence} = 0\n"; + $trigger .= ")\n"; + $trigger .= "BEGIN\n"; + $trigger .= "\tSELECT {$table_name}_seq.nextval\n"; + $trigger .= "\tINTO :new.{$create_sequence}\n"; + $trigger .= "\tFROM dual;\n"; + $trigger .= "END;"; + + $statements[] = $trigger; + } + break; + } + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); + + foreach ($key_stmts as $key_stmt) + { + $statements[] = $key_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Commit Transaction + $statements[] = 'commit'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function perform_schema_changes($schema_changes) + { + if (empty($schema_changes)) + { + return; + } + + $statements = array(); + $sqlite = false; + + // For SQLite we need to perform the schema changes in a much more different way + if ($this->db->get_sql_layer() == 'sqlite3' && $this->return_statements) + { + $sqlite_data = array(); + $sqlite = true; + } + + // Drop tables? + if (!empty($schema_changes['drop_tables'])) + { + foreach ($schema_changes['drop_tables'] as $table) + { + // only drop table if it exists + if ($this->sql_table_exists($table)) + { + $result = $this->sql_table_drop($table); + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Add tables? + if (!empty($schema_changes['add_tables'])) + { + foreach ($schema_changes['add_tables'] as $table => $table_data) + { + $result = $this->sql_create_table($table, $table_data); + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + + // Change columns? + if (!empty($schema_changes['change_columns'])) + { + foreach ($schema_changes['change_columns'] as $table => $columns) + { + foreach ($columns as $column_name => $column_data) + { + // If the column exists we change it, else we add it ;) + if ($column_exists = $this->sql_column_exists($table, $column_name)) + { + $result = $this->sql_column_change($table, $column_name, $column_data, true); + } + else + { + $result = $this->sql_column_add($table, $column_name, $column_data, true); + } + + if ($sqlite) + { + if ($column_exists) + { + $sqlite_data[$table]['change_columns'][] = $result; + } + else + { + $sqlite_data[$table]['add_columns'][] = $result; + } + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Add columns? + if (!empty($schema_changes['add_columns'])) + { + foreach ($schema_changes['add_columns'] as $table => $columns) + { + foreach ($columns as $column_name => $column_data) + { + // Only add the column if it does not exist yet + if ($column_exists = $this->sql_column_exists($table, $column_name)) + { + continue; + // This is commented out here because it can take tremendous time on updates +// $result = $this->sql_column_change($table, $column_name, $column_data, true); + } + else + { + $result = $this->sql_column_add($table, $column_name, $column_data, true); + } + + if ($sqlite) + { + if ($column_exists) + { + continue; +// $sqlite_data[$table]['change_columns'][] = $result; + } + else + { + $sqlite_data[$table]['add_columns'][] = $result; + } + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Remove keys? + if (!empty($schema_changes['drop_keys'])) + { + foreach ($schema_changes['drop_keys'] as $table => $indexes) + { + foreach ($indexes as $index_name) + { + if (!$this->sql_index_exists($table, $index_name) && !$this->sql_unique_index_exists($table, $index_name)) + { + continue; + } + + $result = $this->sql_index_drop($table, $index_name); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Drop columns? + if (!empty($schema_changes['drop_columns'])) + { + foreach ($schema_changes['drop_columns'] as $table => $columns) + { + foreach ($columns as $column) + { + // Only remove the column if it exists... + if ($this->sql_column_exists($table, $column)) + { + $result = $this->sql_column_remove($table, $column, true); + + if ($sqlite) + { + $sqlite_data[$table]['drop_columns'][] = $result; + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + } + + // Add primary keys? + if (!empty($schema_changes['add_primary_keys'])) + { + foreach ($schema_changes['add_primary_keys'] as $table => $columns) + { + $result = $this->sql_create_primary_key($table, $columns, true); + + if ($sqlite) + { + $sqlite_data[$table]['primary_key'] = $result; + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + + // Add unique indexes? + if (!empty($schema_changes['add_unique_index'])) + { + foreach ($schema_changes['add_unique_index'] as $table => $index_array) + { + foreach ($index_array as $index_name => $column) + { + if ($this->sql_unique_index_exists($table, $index_name)) + { + continue; + } + + $result = $this->sql_create_unique_index($table, $index_name, $column); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Add indexes? + if (!empty($schema_changes['add_index'])) + { + foreach ($schema_changes['add_index'] as $table => $index_array) + { + foreach ($index_array as $index_name => $column) + { + if ($this->sql_index_exists($table, $index_name)) + { + continue; + } + + $result = $this->sql_create_index($table, $index_name, $column); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + if ($sqlite) + { + foreach ($sqlite_data as $table_name => $sql_schema_changes) + { + // Create temporary table with original data + $statements[] = 'begin'; + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}' + ORDER BY type DESC, name;"; + $result = $this->db->sql_query($sql); + + if (!$result) + { + continue; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + // Get the columns... + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $plain_table_cols = trim($matches[1]); + $new_table_cols = preg_split('/,(?![\s\w]+\))/m', $plain_table_cols); + $column_list = array(); + + foreach ($new_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + // note down the primary key notation because sqlite only supports adding it to the end for the new table + $primary_key = false; + $_new_cols = array(); + + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + $primary_key = $declaration; + continue; + } + $_new_cols[] = $declaration; + } + + $new_table_cols = $_new_cols; + + // First of all... change columns + if (!empty($sql_schema_changes['change_columns'])) + { + foreach ($sql_schema_changes['change_columns'] as $column_sql) + { + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if (strpos($column_sql, $entities[0] . ' ') === 0) + { + $new_table_cols[$key] = $column_sql; + } + } + } + } + + if (!empty($sql_schema_changes['add_columns'])) + { + foreach ($sql_schema_changes['add_columns'] as $column_sql) + { + $new_table_cols[] = $column_sql; + } + } + + // Now drop them... + if (!empty($sql_schema_changes['drop_columns'])) + { + foreach ($sql_schema_changes['drop_columns'] as $column_name) + { + // Remove from column list... + $new_column_list = array(); + foreach ($column_list as $key => $value) + { + if ($value === $column_name) + { + continue; + } + + $new_column_list[] = $value; + } + + $column_list = $new_column_list; + + // Remove from table... + $_new_cols = array(); + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if (strpos($column_name . ' ', $entities[0] . ' ') === 0) + { + continue; + } + $_new_cols[] = $declaration; + } + $new_table_cols = $_new_cols; + } + } + + // Primary key... + if (!empty($sql_schema_changes['primary_key'])) + { + $new_table_cols[] = 'PRIMARY KEY (' . implode(', ', $sql_schema_changes['primary_key']) . ')'; + } + // Add a new one or the old primary key + else if ($primary_key !== false) + { + $new_table_cols[] = $primary_key; + } + + $columns = implode(',', $column_list); + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $new_table_cols) . ');'; + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + } + } + + if ($this->return_statements) + { + return $statements; + } + } + + /** + * {@inheritDoc} + */ + function sql_list_columns($table_name) + { + $columns = array(); + + switch ($this->sql_layer) + { + case 'mysql_41': + $sql = "SHOW COLUMNS FROM $table_name"; + break; + + case 'oracle': + $sql = "SELECT column_name + FROM user_tab_columns + WHERE LOWER(table_name) = '" . strtolower($table_name) . "'"; + break; + + case 'sqlite3': + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}'"; + + $result = $this->db->sql_query($sql); + + if (!$result) + { + return false; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $cols = trim($matches[1]); + $col_array = preg_split('/,(?![\s\w]+\))/m', $cols); + + foreach ($col_array as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + + $column = strtolower($entities[0]); + $columns[$column] = $column; + } + + return $columns; + break; + } + + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $column = strtolower(current($row)); + $columns[$column] = $column; + } + $this->db->sql_freeresult($result); + + return $columns; + } + + /** + * {@inheritDoc} + */ + function sql_column_exists($table_name, $column_name) + { + $columns = $this->sql_list_columns($table_name); + + return isset($columns[$column_name]); + } + + /** + * {@inheritDoc} + */ + function sql_index_exists($table_name, $index_name) + { + switch ($this->sql_layer) + { + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name + FROM user_indexes + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'NONUNIQUE'"; + $col = 'index_name'; + break; + + case 'sqlite3': + $sql = "PRAGMA index_list('" . $table_name . "');"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if ($this->sql_layer == 'mysql_41' && !$row['Non_unique']) + { + continue; + } + + switch ($this->sql_layer) + { + // These DBMS prefix index name with the table name + case 'oracle': + case 'sqlite3': + $new_index_name = $this->check_index_name_length($table_name, $table_name . '_' . $index_name, false); + break; + default: + $new_index_name = $this->check_index_name_length($table_name, $index_name, false); + break; + } + + if (strtolower($row[$col]) == strtolower($new_index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_unique_index_exists($table_name, $index_name) + { + switch ($this->sql_layer) + { + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name, table_owner + FROM user_indexes + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'UNIQUE'"; + $col = 'index_name'; + break; + + case 'sqlite3': + $sql = "PRAGMA index_list('" . $table_name . "');"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if ($this->sql_layer == 'mysql_41' && ($row['Non_unique'] || $row[$col] == 'PRIMARY')) + { + continue; + } + + if ($this->sql_layer == 'sqlite3' && !$row['unique']) + { + continue; + } + + // These DBMS prefix index name with the table name + switch ($this->sql_layer) + { + case 'oracle': + // Two cases here... prefixed with U_[table_owner] and not prefixed with table_name + if (strpos($row[$col], 'U_') === 0) + { + $row[$col] = substr($row[$col], strlen('U_' . $row['table_owner']) + 1); + } + else if (strpos($row[$col], strtoupper($table_name)) === 0) + { + $row[$col] = substr($row[$col], strlen($table_name) + 1); + } + break; + + case 'sqlite3': + $row[$col] = substr($row[$col], strlen($table_name) + 1); + break; + } + + if (strtolower($row[$col]) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * Private method for performing sql statements (either execute them or return them) + * @access private + */ + function _sql_run_sql($statements) + { + if ($this->return_statements) + { + return $statements; + } + + // We could add error handling here... + foreach ($statements as $sql) + { + if ($sql === 'begin') + { + $this->db->sql_transaction('begin'); + } + else if ($sql === 'commit') + { + $this->db->sql_transaction('commit'); + } + else + { + $this->db->sql_query($sql); + } + } + + return true; + } + + /** + * Function to prepare some column information for better usage + * @access private + */ + function sql_prepare_column_data($table_name, $column_name, $column_data) + { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + // Get type + list($column_type) = $this->get_column_type($column_data[0]); + + // Adjust default value if db-dependent specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; + } + + $sql = ''; + + $return_array = array(); + + switch ($this->sql_layer) + { + case 'mysql_41': + $sql .= " {$column_type} "; + + // For hexadecimal values do not use single quotes + if (!is_null($column_data[1]) && substr($column_type, -4) !== 'text' && substr($column_type, -4) !== 'blob') + { + $sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; + } + + if (!is_null($column_data[1]) || (isset($column_data[2]) && $column_data[2] == 'auto_increment')) + { + $sql .= 'NOT NULL'; + } + else + { + $sql .= 'NULL'; + } + + if (isset($column_data[2])) + { + if ($column_data[2] == 'auto_increment') + { + $sql .= ' auto_increment'; + } + else if ($this->sql_layer === 'mysql_41' && $column_data[2] == 'true_sort') + { + $sql .= ' COLLATE utf8_unicode_ci'; + } + } + + if (isset($column_data['after'])) + { + $return_array['after'] = $column_data['after']; + } + + break; + + case 'oracle': + $sql .= " {$column_type} "; + $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; + + // In Oracle empty strings ('') are treated as NULL. + // Therefore in oracle we allow NULL's for all DEFAULT '' entries + // Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields) + if (!preg_match('/number/i', $column_type)) + { + $sql .= ($column_data[1] === '' || $column_data[1] === null) ? '' : 'NOT NULL'; + } + + $return_array['auto_increment'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $return_array['auto_increment'] = true; + } + + break; + + case 'sqlite3': + $return_array['primary_key_set'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $sql .= ' INTEGER PRIMARY KEY AUTOINCREMENT'; + $return_array['primary_key_set'] = true; + } + else + { + $sql .= ' ' . $column_type; + } + + if (!is_null($column_data[1])) + { + $sql .= ' NOT NULL '; + $sql .= "DEFAULT '{$column_data[1]}'"; + } + + break; + } + + $return_array['column_type_sql'] = $sql; + + return $return_array; + } + + /** + * Get the column's database type from the type map + * + * @param string $column_map_type + * @return array column type for this database + * and map type without length + */ + function get_column_type($column_map_type) + { + $column_type = ''; + if (strpos($column_map_type, ':') !== false) + { + list($orig_column_type, $column_length) = explode(':', $column_map_type); + if (!is_array($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'])) + { + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'], $column_length); + } + else + { + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'])) + { + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][0]) + { + case 'div': + $column_length /= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][1]; + $column_length = ceil($column_length); + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); + break; + } + } + + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'])) + { + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][0]) + { + case 'mult': + $column_length *= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][1]; + if ($column_length > $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][2]) + { + $column_type = $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][3]; + } + else + { + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); + } + break; + } + } + } + $orig_column_type .= ':'; + } + else + { + $orig_column_type = $column_map_type; + $column_type = $this->dbms_type_map[$this->sql_layer][$column_map_type]; + } + + return array($column_type, $orig_column_type); + } + + /** + * {@inheritDoc} + */ + function sql_column_add($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_41': + $after = (!empty($column_data['after'])) ? ' AFTER ' . $column_data['after'] : ''; + $statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql'] . $after; + break; + + case 'oracle': + // Does not support AFTER, only through temporary table + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; + break; + + case 'sqlite3': + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_column_remove($table_name, $column_name, $inline = false) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_41': + $statements[] = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`'; + break; + + case 'oracle': + $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN ' . $column_name; + break; + + case 'sqlite3': + + if ($inline && $this->return_statements) + { + return $column_name; + } + + $recreate_queries = $this->sqlite_get_recreate_table_queries($table_name, $column_name); + if (empty($recreate_queries)) + { + break; + } + + $statements[] = 'begin'; + + $sql_create_table = array_shift($recreate_queries); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $sql_create_table); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $sql_create_table, $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY' || $entities[0] === $column_name) + { + continue; + } + $column_list[] = $entities[0]; + } + + $columns = implode(',', $column_list); + + $new_table_cols = trim(preg_replace('/' . $column_name . '\b[^,]+(?:,|$)/m', '', $new_table_cols)); + if (substr($new_table_cols, -1) === ',') + { + // Remove the comma from the last entry again + $new_table_cols = substr($new_table_cols, 0, -1); + } + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; + $statements = array_merge($statements, $recreate_queries); + + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_index_drop($table_name, $index_name) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_41': + $index_name = $this->check_index_name_length($table_name, $index_name, false); + $statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name; + break; + + case 'oracle': + case 'sqlite3': + $index_name = $this->check_index_name_length($table_name, $table_name . '_' . $index_name, false); + $statements[] = 'DROP INDEX ' . $index_name; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_table_drop($table_name) + { + $statements = array(); + + if (!$this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // the most basic operation, get rid of the table + $statements[] = 'DROP TABLE ' . $table_name; + + switch ($this->sql_layer) + { + case 'oracle': + $sql = 'SELECT A.REFERENCED_NAME + FROM USER_DEPENDENCIES A, USER_TRIGGERS B + WHERE A.REFERENCED_TYPE = \'SEQUENCE\' + AND A.NAME = B.TRIGGER_NAME + AND B.TABLE_NAME = \'' . strtoupper($table_name) . "'"; + $result = $this->db->sql_query($sql); + + // any sequences ref'd to this table's triggers? + while ($row = $this->db->sql_fetchrow($result)) + { + $statements[] = "DROP SEQUENCE {$row['referenced_name']}"; + } + $this->db->sql_freeresult($result); + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_primary_key($table_name, $column, $inline = false) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_41': + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; + break; + + case 'oracle': + $statements[] = 'ALTER TABLE ' . $table_name . ' add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')'; + break; + + case 'sqlite3': + + if ($inline && $this->return_statements) + { + return $column; + } + + $recreate_queries = $this->sqlite_get_recreate_table_queries($table_name); + if (empty($recreate_queries)) + { + break; + } + + $statements[] = 'begin'; + + $sql_create_table = array_shift($recreate_queries); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $sql_create_table); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $sql_create_table, $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + $columns = implode(',', $column_list); + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ', PRIMARY KEY (' . implode(', ', $column) . '));'; + $statements = array_merge($statements, $recreate_queries); + + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_unique_index($table_name, $index_name, $column) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'oracle': + case 'sqlite3': + $index_name = $this->check_index_name_length($table_name, $table_name . '_' . $index_name); + $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + break; + + case 'mysql_41': + $index_name = $this->check_index_name_length($table_name, $index_name); + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD UNIQUE INDEX ' . $index_name . '(' . implode(', ', $column) . ')'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_index($table_name, $index_name, $column) + { + $statements = array(); + + $column = preg_replace('#:.*$#', '', $column); + + switch ($this->sql_layer) + { + case 'oracle': + case 'sqlite3': + $index_name = $this->check_index_name_length($table_name, $table_name . '_' . $index_name); + $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + break; + + case 'mysql_41': + $index_name = $this->check_index_name_length($table_name, $index_name); + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . ' (' . implode(', ', $column) . ')'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Check whether the index name is too long + * + * @param string $table_name + * @param string $index_name + * @param bool $throw_error + * @return string The index name, shortened if too long + */ + protected function check_index_name_length($table_name, $index_name, $throw_error = true) + { + $max_index_name_length = $this->get_max_index_name_length(); + if (strlen($index_name) > $max_index_name_length) + { + // Try removing the table prefix if it's at the beginning + $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config) + if (strpos($index_name, $table_prefix) === 0) + { + $index_name = substr($index_name, strlen($table_prefix)); + return $this->check_index_name_length($table_name, $index_name, $throw_error); + } + + // Try removing the remaining suffix part of table name then + $table_suffix = substr($table_name, strlen($table_prefix)); + if (strpos($index_name, $table_suffix) === 0) + { + // Remove the suffix and underscore separator between table_name and index_name + $index_name = substr($index_name, strlen($table_suffix) + 1); + return $this->check_index_name_length($table_name, $index_name, $throw_error); + } + + if ($throw_error) + { + trigger_error("Index name '$index_name' on table '$table_name' is too long. The maximum is $max_index_name_length characters.", E_USER_ERROR); + } + } + + return $index_name; + } + + /** + * Get maximum index name length. Might vary depending on db type + * + * @return int Maximum index name length + */ + protected function get_max_index_name_length() + { + return 30; + } + + /** + * {@inheritDoc} + */ + function sql_list_index($table_name) + { + $index_array = array(); + + switch ($this->sql_layer) + { + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name + FROM user_indexes + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'NONUNIQUE'"; + $col = 'index_name'; + break; + + case 'sqlite3': + $sql = "PRAGMA index_info('" . $table_name . "');"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if ($this->sql_layer == 'mysql_41' && !$row['Non_unique']) + { + continue; + } + + switch ($this->sql_layer) + { + case 'oracle': + case 'sqlite3': + $row[$col] = substr($row[$col], strlen($table_name) + 1); + break; + } + + $index_array[] = $row[$col]; + } + $this->db->sql_freeresult($result); + + return array_map('strtolower', $index_array); + } + + /** + * Removes table_name from the index_name if it is at the beginning + * + * @param $table_name + * @param $index_name + * @return string + */ + protected function strip_table_name_from_index_name($table_name, $index_name) + { + return (strpos(strtoupper($index_name), strtoupper($table_name)) === 0) ? substr($index_name, strlen($table_name) + 1) : $index_name; + } + + /** + * {@inheritDoc} + */ + function sql_column_change($table_name, $column_name, $column_data, $inline = false) + { + $original_column_data = $column_data; + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_41': + $statements[] = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $column_name . '` `' . $column_name . '` ' . $column_data['column_type_sql']; + break; + + case 'oracle': + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + // Get list of existing indexes + $indexes = $this->get_existing_indexes($table_name, $column_name); + $unique_indexes = $this->get_existing_indexes($table_name, $column_name, true); + + // Drop any indexes + if (!empty($indexes) || !empty($unique_indexes)) + { + $drop_indexes = array_merge(array_keys($indexes), array_keys($unique_indexes)); + foreach ($drop_indexes as $index_name) + { + $result = $this->sql_index_drop($table_name, $this->strip_table_name_from_index_name($table_name, $index_name)); + $statements = array_merge($statements, $result); + } + } + + $temp_column_name = 'temp_' . substr(md5($column_name), 0, 25); + // Add a temporary table with the new type + $result = $this->sql_column_add($table_name, $temp_column_name, $original_column_data); + $statements = array_merge($statements, $result); + + // Copy the data to the new column + $statements[] = 'UPDATE ' . $table_name . ' SET ' . $temp_column_name . ' = ' . $column_name; + + // Drop the original column + $result = $this->sql_column_remove($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Recreate the original column with the new type + $result = $this->sql_column_add($table_name, $column_name, $original_column_data); + $statements = array_merge($statements, $result); + + if (!empty($indexes)) + { + // Recreate indexes after we changed the column + foreach ($indexes as $index_name => $index_data) + { + $result = $this->sql_create_index($table_name, $this->strip_table_name_from_index_name($table_name, $index_name), $index_data); + $statements = array_merge($statements, $result); + } + } + + if (!empty($unique_indexes)) + { + // Recreate unique indexes after we changed the column + foreach ($unique_indexes as $index_name => $index_data) + { + $result = $this->sql_create_unique_index($table_name, $this->strip_table_name_from_index_name($table_name, $index_name), $index_data); + $statements = array_merge($statements, $result); + } + } + + // Copy the data to the original column + $statements[] = 'UPDATE ' . $table_name . ' SET ' . $column_name . ' = ' . $temp_column_name; + + // Drop the temporary column again + $result = $this->sql_column_remove($table_name, $temp_column_name); + $statements = array_merge($statements, $result); + + $this->return_statements = $old_return_statements; + break; + + case 'sqlite3': + + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + + $recreate_queries = $this->sqlite_get_recreate_table_queries($table_name); + if (empty($recreate_queries)) + { + break; + } + + $statements[] = 'begin'; + + $sql_create_table = array_shift($recreate_queries); + + // Create a temp table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $sql_create_table); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $sql_create_table, $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $key => $declaration) + { + $declaration = trim($declaration); + + // Check for the beginning of the constraint section and stop + if (preg_match('/[^\(]*\s*PRIMARY KEY\s+\(/', $declaration) || + preg_match('/[^\(]*\s*UNIQUE\s+\(/', $declaration) || + preg_match('/[^\(]*\s*FOREIGN KEY\s+\(/', $declaration) || + preg_match('/[^\(]*\s*CHECK\s+\(/', $declaration)) + { + break; + } + + $entities = preg_split('#\s+#', $declaration); + $column_list[] = $entities[0]; + if ($entities[0] == $column_name) + { + $old_table_cols[$key] = $column_name . ' ' . $column_data['column_type_sql']; + } + } + + $columns = implode(',', $column_list); + + // Create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $old_table_cols) . ');'; + $statements = array_merge($statements, $recreate_queries); + + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Get a list with existing indexes for the column + * + * @param string $table_name + * @param string $column_name + * @param bool $unique Should we get unique indexes or normal ones + * @return array Array with Index name => columns + */ + public function get_existing_indexes($table_name, $column_name, $unique = false) + { + switch ($this->sql_layer) + { + case 'mysql_41': + case 'sqlite3': + // Not supported + throw new \Exception('DBMS is not supported'); + break; + } + + $sql = ''; + $existing_indexes = array(); + + switch ($this->sql_layer) + { + case 'oracle': + $sql = "SELECT ix.index_name AS phpbb_index_name, ix.uniqueness AS is_unique + FROM all_ind_columns ixc, all_indexes ix + WHERE ix.index_name = ixc.index_name + AND ixc.table_name = '" . strtoupper($table_name) . "' + AND ixc.column_name = '" . strtoupper($column_name) . "'"; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (!isset($row['is_unique']) || ($unique && $row['is_unique'] == 'UNIQUE') || (!$unique && $row['is_unique'] == 'NONUNIQUE')) + { + $existing_indexes[$row['phpbb_index_name']] = array(); + } + } + $this->db->sql_freeresult($result); + + if (empty($existing_indexes)) + { + return array(); + } + + switch ($this->sql_layer) + { + case 'oracle': + $sql = "SELECT index_name AS phpbb_index_name, column_name AS phpbb_column_name + FROM all_ind_columns + WHERE table_name = '" . strtoupper($table_name) . "' + AND " . $this->db->sql_in_set('index_name', array_keys($existing_indexes)); + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $existing_indexes[$row['phpbb_index_name']][] = $row['phpbb_column_name']; + } + $this->db->sql_freeresult($result); + + return $existing_indexes; + } + + /** + * Returns the Queries which are required to recreate a table including indexes + * + * @param string $table_name + * @param string $remove_column When we drop a column, we remove the column + * from all indexes. If the index has no other + * column, we drop it completly. + * @return array + */ + protected function sqlite_get_recreate_table_queries($table_name, $remove_column = '') + { + $queries = array(); + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + $sql_create_table = $this->db->sql_fetchfield('sql'); + $this->db->sql_freeresult($result); + + if (!$sql_create_table) + { + return array(); + } + $queries[] = $sql_create_table; + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'index' + AND tbl_name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + while ($sql_create_index = $this->db->sql_fetchfield('sql')) + { + if ($remove_column) + { + $match = array(); + preg_match('#(?:[\w ]+)\((.*)\)#', $sql_create_index, $match); + if (!isset($match[1])) + { + continue; + } + + // Find and remove $remove_column from the index + $columns = explode(', ', $match[1]); + $found_column = array_search($remove_column, $columns); + if ($found_column !== false) + { + unset($columns[$found_column]); + + // If the column list is not empty add the index to the list + if (!empty($columns)) + { + $queries[] = str_replace($match[1], implode(', ', $columns), $sql_create_index); + } + } + else + { + $queries[] = $sql_create_index; + } + } + else + { + $queries[] = $sql_create_index; + } + } + $this->db->sql_freeresult($result); + + return $queries; + } +} diff --git a/install/update/new/phpbb/di/container_builder.php b/install/update/new/phpbb/di/container_builder.php new file mode 100644 index 0000000..70ceb9b --- /dev/null +++ b/install/update/new/phpbb/di/container_builder.php @@ -0,0 +1,678 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di; + +use phpbb\filesystem\filesystem; +use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper; +use Symfony\Component\Config\ConfigCache; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\PhpDumper; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass; +use Symfony\Component\Filesystem\Exception\IOException; +use Symfony\Component\Finder\Finder; +use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; + +class container_builder +{ + /** + * @var string The environment to use. + */ + protected $environment; + + /** + * @var string phpBB Root Path + */ + protected $phpbb_root_path; + + /** + * @var string php file extension + */ + protected $php_ext; + + /** + * The container under construction + * + * @var ContainerBuilder + */ + protected $container; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $dbal_connection = null; + + /** + * Indicates whether extensions should be used (default to true). + * + * @var bool + */ + protected $use_extensions = true; + + /** + * Defines a custom path to find the configuration of the container (default to $this->phpbb_root_path . 'config') + * + * @var string + */ + protected $config_path = null; + + /** + * Indicates whether the container should be dumped to the filesystem (default to true). + * + * If DEBUG_CONTAINER is set this option is ignored and a new container is build. + * + * @var bool + */ + protected $use_cache = true; + + /** + * Indicates if the container should be compiled automatically (default to true). + * + * @var bool + */ + protected $compile_container = true; + + /** + * Custom parameters to inject into the container. + * + * Default to: + * array( + * 'core.root_path', $this->phpbb_root_path, + * 'core.php_ext', $this->php_ext, + * ); + * + * @var array + */ + protected $custom_parameters = []; + + /** + * @var \phpbb\config_php_file + */ + protected $config_php_file; + + /** + * @var string + */ + protected $cache_dir; + + /** + * @var array + */ + private $container_extensions; + + /** @var \Exception */ + private $build_exception; + + /** + * Constructor + * + * @param string $phpbb_root_path Path to the phpbb includes directory. + * @param string $php_ext php file extension + */ + public function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Build and return a new Container respecting the current configuration + * + * @return \phpbb_cache_container|ContainerBuilder + */ + public function get_container() + { + try + { + $container_filename = $this->get_container_filename(); + $config_cache = new ConfigCache($container_filename, defined('DEBUG')); + if ($this->use_cache && $config_cache->isFresh()) + { + if ($this->use_extensions) + { + $autoload_cache = new ConfigCache($this->get_autoload_filename(), defined('DEBUG')); + if (!$autoload_cache->isFresh()) + { + // autoload cache should be refreshed + $this->load_extensions(); + } + + require($this->get_autoload_filename()); + } + + require($config_cache->getPath()); + $this->container = new \phpbb_cache_container(); + } + else + { + $this->container_extensions = [ + new extension\core($this->get_config_path()), + ]; + + if ($this->use_extensions) + { + $this->load_extensions(); + } + + // Add tables extension after all extensions + $this->container_extensions[] = new extension\tables(); + + // Inject the config + if ($this->config_php_file) + { + $this->container_extensions[] = new extension\config($this->config_php_file); + } + + $this->container = $this->create_container($this->container_extensions); + + // Easy collections through tags + $this->container->addCompilerPass(new pass\collection_pass()); + + // Event listeners "phpBB style" + $this->container->addCompilerPass(new RegisterListenersPass('dispatcher', 'event.listener_listener', 'event.listener')); + + // Event listeners "Symfony style" + $this->container->addCompilerPass(new RegisterListenersPass('dispatcher')); + + if ($this->use_extensions) + { + $this->register_ext_compiler_pass(); + } + + $filesystem = new filesystem(); + $loader = new YamlFileLoader($this->container, new FileLocator($filesystem->realpath($this->get_config_path()))); + $loader->load($this->container->getParameter('core.environment') . '/config.yml'); + + $this->inject_custom_parameters(); + + if ($this->compile_container) + { + $this->container->compile(); + + if ($this->use_cache) + { + $this->dump_container($config_cache); + } + } + } + + if ($this->compile_container && $this->config_php_file) + { + $this->container->set('config.php', $this->config_php_file); + } + + $this->inject_dbal_driver(); + + return $this->container; + } + catch (\Exception $e) + { + // Don't try to recover if we are in the development environment + if ($this->get_environment() === 'development') + { + throw $e; + } + + if ($this->build_exception === null) + { + $this->build_exception = $e; + + return $this + ->without_extensions() + ->without_cache() + ->with_custom_parameters(array_merge($this->custom_parameters, [ + 'container_exception' => $e, + ])) + ->get_container(); + } + else + { + // Rethrow the original exception if it's still failing + throw $this->build_exception; + } + } + } + + /** + * Enable the extensions. + * + * @param string $environment The environment to use + * @return $this + */ + public function with_environment($environment) + { + $this->environment = $environment; + + return $this; + } + + /** + * Enable the extensions. + * + * @return $this + */ + public function with_extensions() + { + $this->use_extensions = true; + + return $this; + } + + /** + * Disable the extensions. + * + * @return $this + */ + public function without_extensions() + { + $this->use_extensions = false; + + return $this; + } + + /** + * Enable the caching of the container. + * + * If DEBUG_CONTAINER is set this option is ignored and a new container is build. + * + * @return $this + */ + public function with_cache() + { + $this->use_cache = true; + + return $this; + } + + /** + * Disable the caching of the container. + * + * @return $this + */ + public function without_cache() + { + $this->use_cache = false; + + return $this; + } + + /** + * Set the cache directory. + * + * @param string $cache_dir The cache directory. + * @return $this + */ + public function with_cache_dir($cache_dir) + { + $this->cache_dir = $cache_dir; + + return $this; + } + + /** + * Enable the compilation of the container. + * + * @return $this + */ + public function with_compiled_container() + { + $this->compile_container = true; + + return $this; + } + + /** + * Disable the compilation of the container. + * + * @return $this + */ + public function without_compiled_container() + { + $this->compile_container = false; + + return $this; + } + + /** + * Set a custom path to find the configuration of the container. + * + * @param string $config_path + * @return $this + */ + public function with_config_path($config_path) + { + $this->config_path = $config_path; + + return $this; + } + + /** + * Set custom parameters to inject into the container. + * + * @param array $custom_parameters + * @return $this + */ + public function with_custom_parameters($custom_parameters) + { + $this->custom_parameters = $custom_parameters; + + return $this; + } + + /** + * Set custom parameters to inject into the container. + * + * @param \phpbb\config_php_file $config_php_file + * @return $this + */ + public function with_config(\phpbb\config_php_file $config_php_file) + { + $this->config_php_file = $config_php_file; + + return $this; + } + + /** + * Returns the path to the container configuration (default: root_path/config) + * + * @return string + */ + protected function get_config_path() + { + return $this->config_path ?: $this->phpbb_root_path . 'config'; + } + + /** + * Returns the path to the cache directory (default: root_path/cache/environment). + * + * @return string Path to the cache directory. + */ + protected function get_cache_dir() + { + return $this->cache_dir ?: $this->phpbb_root_path . 'cache/' . $this->get_environment() . '/'; + } + + /** + * Load the enabled extensions. + */ + protected function load_extensions() + { + if ($this->config_php_file !== null) + { + // Build an intermediate container to load the ext list from the database + $container_builder = new container_builder($this->phpbb_root_path, $this->php_ext); + $ext_container = $container_builder + ->without_cache() + ->without_extensions() + ->with_config($this->config_php_file) + ->with_config_path($this->get_config_path()) + ->with_environment('production') + ->without_compiled_container() + ->get_container() + ; + + $ext_container->register('cache.driver', '\\phpbb\\cache\\driver\\dummy'); + $ext_container->compile(); + + $extensions = $ext_container->get('ext.manager')->all_enabled(); + + // Load each extension found + $autoloaders = ' $path) + { + $extension_class = '\\' . str_replace('/', '\\', $ext_name) . '\\di\\extension'; + + if (!class_exists($extension_class)) + { + $extension_class = '\\phpbb\\extension\\di\\extension_base'; + } + + $this->container_extensions[] = new $extension_class($ext_name, $path); + + // Load extension autoloader + $filename = $path . 'vendor/autoload.php'; + if (file_exists($filename)) + { + $autoloaders .= "require('{$filename}');\n"; + } + } + + $configCache = new ConfigCache($this->get_autoload_filename(), false); + $configCache->write($autoloaders); + + require($this->get_autoload_filename()); + } + else + { + // To load the extensions we need the database credentials. + // Automatically disable the extensions if we don't have them. + $this->use_extensions = false; + } + } + + /** + * Dump the container to the disk. + * + * @param ConfigCache $cache The config cache + */ + protected function dump_container($cache) + { + try + { + $dumper = new PhpDumper($this->container); + $proxy_dumper = new ProxyDumper(); + $dumper->setProxyDumper($proxy_dumper); + + $cached_container_dump = $dumper->dump(array( + 'class' => 'phpbb_cache_container', + 'base_class' => 'Symfony\\Component\\DependencyInjection\\Container', + )); + + $cache->write($cached_container_dump, $this->container->getResources()); + } + catch (IOException $e) + { + // Don't fail if the cache isn't writeable + } + } + + /** + * Create the ContainerBuilder object + * + * @param array $extensions Array of Container extension objects + * @return ContainerBuilder object + */ + protected function create_container(array $extensions) + { + $container = new ContainerBuilder(new ParameterBag($this->get_core_parameters())); + $container->setProxyInstantiator(new proxy_instantiator($this->get_cache_dir())); + + $extensions_alias = array(); + + foreach ($extensions as $extension) + { + $container->registerExtension($extension); + $extensions_alias[] = $extension->getAlias(); + } + + $container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions_alias)); + + return $container; + } + + /** + * Inject the customs parameters into the container + */ + protected function inject_custom_parameters() + { + foreach ($this->custom_parameters as $key => $value) + { + $this->container->setParameter($key, $value); + } + } + + /** + * Inject the dbal connection driver into container + */ + protected function inject_dbal_driver() + { + if (empty($this->config_php_file)) + { + return; + } + + $config_data = $this->config_php_file->get_all(); + if (!empty($config_data)) + { + if ($this->dbal_connection === null) + { + $dbal_driver_class = $this->config_php_file->convert_30_dbms_to_31($this->config_php_file->get('dbms')); + /** @var \phpbb\db\driver\driver_interface $dbal_connection */ + $this->dbal_connection = new $dbal_driver_class(); + $this->dbal_connection->sql_connect( + $this->config_php_file->get('dbhost'), + $this->config_php_file->get('dbuser'), + $this->config_php_file->get('dbpasswd'), + $this->config_php_file->get('dbname'), + $this->config_php_file->get('dbport'), + false, + defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK + ); + } + $this->container->set('dbal.conn.driver', $this->dbal_connection); + } + } + + /** + * Returns the core parameters. + * + * @return array An array of core parameters + */ + protected function get_core_parameters() + { + return array_merge( + array( + 'core.root_path' => $this->phpbb_root_path, + 'core.php_ext' => $this->php_ext, + 'core.environment' => $this->get_environment(), + 'core.debug' => defined('DEBUG') ? DEBUG : false, + 'core.cache_dir' => $this->get_cache_dir(), + ), + $this->get_env_parameters() + ); + } + + /** + * Gets the environment parameters. + * + * Only the parameters starting with "PHPBB__" are considered. + * + * @return array An array of parameters + */ + protected function get_env_parameters() + { + $parameters = array(); + foreach ($_SERVER as $key => $value) + { + if (0 === strpos($key, 'PHPBB__')) + { + $parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value; + } + } + + return $parameters; + } + + /** + * Get the filename under which the dumped container will be stored. + * + * @return string Path for dumped container + */ + protected function get_container_filename() + { + $container_params = [ + 'phpbb_root_path' => $this->phpbb_root_path, + 'use_extensions' => $this->use_extensions, + 'config_path' => $this->config_path, + ]; + + return $this->get_cache_dir() . 'container_' . md5(implode(',', $container_params)) . '.' . $this->php_ext; + } + + /** + * Get the filename under which the dumped extensions autoloader will be stored. + * + * @return string Path for dumped extensions autoloader + */ + protected function get_autoload_filename() + { + $container_params = [ + 'phpbb_root_path' => $this->phpbb_root_path, + 'use_extensions' => $this->use_extensions, + 'config_path' => $this->config_path, + ]; + + return $this->get_cache_dir() . 'autoload_' . md5(implode(',', $container_params)) . '.' . $this->php_ext; + } + + /** + * Return the name of the current environment. + * + * @return string + */ + protected function get_environment() + { + return $this->environment ?: PHPBB_ENVIRONMENT; + } + + private function register_ext_compiler_pass() + { + $finder = new Finder(); + $finder + ->name('*_pass.php') + ->path('di/pass') + ->files() + ->ignoreDotFiles(true) + ->ignoreUnreadableDirs(true) + ->ignoreVCS(true) + ->followLinks() + ->in($this->phpbb_root_path . 'ext') + ; + + /** @var \SplFileInfo $pass */ + foreach ($finder as $pass) + { + $filename = $pass->getPathname(); + $filename = substr($filename, 0, -strlen('.' . $pass->getExtension())); + $filename = str_replace(DIRECTORY_SEPARATOR, '/', $filename); + $className = preg_replace('#^.*ext/#', '', $filename); + $className = '\\' . str_replace('/', '\\', $className); + + if (class_exists($className) && in_array('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface', class_implements($className), true)) + { + $this->container->addCompilerPass(new $className()); + } + } + } +} diff --git a/install/update/new/phpbb/di/extension/container_configuration.php b/install/update/new/phpbb/di/extension/container_configuration.php new file mode 100644 index 0000000..57e7ef6 --- /dev/null +++ b/install/update/new/phpbb/di/extension/container_configuration.php @@ -0,0 +1,63 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di\extension; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +class container_configuration implements ConfigurationInterface +{ + + /** + * Generates the configuration tree builder. + * + * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('core'); + $rootNode + ->children() + ->booleanNode('require_dev_dependencies')->defaultValue(false)->end() + ->booleanNode('allow_install_dir')->defaultValue(false)->end() + ->arrayNode('debug') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('exceptions')->defaultValue(false)->end() + ->booleanNode('load_time')->defaultValue(false)->end() + ->booleanNode('sql_explain')->defaultValue(false)->end() + ->booleanNode('memory')->defaultValue(false)->end() + ->booleanNode('show_errors')->defaultValue(false)->end() + ->end() + ->end() + ->arrayNode('twig') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('debug')->defaultValue(null)->end() + ->booleanNode('auto_reload')->defaultValue(null)->end() + ->booleanNode('enable_debug_extension')->defaultValue(false)->end() + ->end() + ->end() + ->arrayNode('session') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('log_errors')->defaultValue(false)->end() + ->end() + ->end() + ->end() + ; + return $treeBuilder; + } +} diff --git a/install/update/new/phpbb/di/extension/core.php b/install/update/new/phpbb/di/extension/core.php new file mode 100644 index 0000000..0497c90 --- /dev/null +++ b/install/update/new/phpbb/di/extension/core.php @@ -0,0 +1,132 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di\extension; + +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; + +/** +* Container core extension +*/ +class core extends Extension +{ + const TWIG_OPTIONS_POSITION = 7; + + /** + * Config path + * @var string + */ + protected $config_path; + + /** + * Constructor + * + * @param string $config_path Config path + */ + public function __construct($config_path) + { + $this->config_path = $config_path; + } + + /** + * Loads a specific configuration. + * + * @param array $configs An array of configuration values + * @param ContainerBuilder $container A ContainerBuilder instance + * + * @throws \InvalidArgumentException When provided tag is not defined in this extension + */ + public function load(array $configs, ContainerBuilder $container) + { + $filesystem = new \phpbb\filesystem\filesystem(); + $loader = new YamlFileLoader($container, new FileLocator($filesystem->realpath($this->config_path))); + $loader->load($container->getParameter('core.environment') . '/container/environment.yml'); + + $config = $this->getConfiguration($configs, $container); + $config = $this->processConfiguration($config, $configs); + + if ($config['require_dev_dependencies']) + { + if (!class_exists('Goutte\Client', true)) + { + trigger_error( + 'Composer development dependencies have not been set up for the ' . $container->getParameter('core.environment') . ' environment yet, run ' . + "'php ../composer.phar install --dev' from the phpBB directory to do so.", + E_USER_ERROR + ); + } + } + + $container->setParameter('allow_install_dir', $config['allow_install_dir']); + + // Set the Twig options if defined in the environment + $definition = $container->getDefinition('template.twig.environment'); + $twig_environment_options = $definition->getArgument(static::TWIG_OPTIONS_POSITION); + if ($config['twig']['debug']) + { + $twig_environment_options['debug'] = true; + } + if ($config['twig']['auto_reload']) + { + $twig_environment_options['auto_reload'] = true; + } + + // Replace the 7th argument, the options passed to the environment + $definition->replaceArgument(static::TWIG_OPTIONS_POSITION, $twig_environment_options); + + if ($config['twig']['enable_debug_extension']) + { + $definition = $container->getDefinition('template.twig.extensions.debug'); + $definition->addTag('twig.extension'); + } + + // Set the debug options + foreach ($config['debug'] as $name => $value) + { + $container->setParameter('debug.' . $name, $value); + } + + // Set the log options + foreach ($config['session'] as $name => $value) + { + $container->setParameter('session.' . $name, $value); + } + } + + /** + * {@inheritdoc} + */ + public function getConfiguration(array $config, ContainerBuilder $container) + { + $r = new \ReflectionClass('\phpbb\di\extension\container_configuration'); + $container->addResource(new FileResource($r->getFileName())); + + return new container_configuration(); + } + + /** + * Returns the recommended alias to use in XML. + * + * This alias is also the mandatory prefix to use when using YAML. + * + * @return string The alias + */ + public function getAlias() + { + return 'core'; + } +} diff --git a/install/update/new/phpbb/di/extension/tables.php b/install/update/new/phpbb/di/extension/tables.php new file mode 100644 index 0000000..40684b6 --- /dev/null +++ b/install/update/new/phpbb/di/extension/tables.php @@ -0,0 +1,59 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\di\extension; + +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; + +/** + * Container tables extension + */ +class tables extends Extension +{ + /** + * {@inheritDoc} + */ + public function load(array $configs, ContainerBuilder $container) + { + // Tables is a reserved parameter and will be overwritten at all times + $tables = []; + + // Add access via 'tables' parameter to acquire array with all tables + $parameterBag = $container->getParameterBag(); + $parameters = $parameterBag->all(); + foreach ($parameters as $parameter_name => $parameter_value) + { + if (!preg_match('/tables\.(.+)/', $parameter_name, $matches)) + { + continue; + } + + $tables[$matches[1]] = $parameter_value; + } + + $container->setParameter('tables', $tables); + } + + /** + * Returns the recommended alias to use in XML. + * + * This alias is also the mandatory prefix to use when using YAML. + * + * @return string The alias + */ + public function getAlias() + { + return 'tables'; + } +} diff --git a/install/update/new/phpbb/di/service_collection.php b/install/update/new/phpbb/di/service_collection.php new file mode 100644 index 0000000..6298670 --- /dev/null +++ b/install/update/new/phpbb/di/service_collection.php @@ -0,0 +1,122 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di; + +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* Collection of services to be configured at container compile time. +*/ +class service_collection extends \ArrayObject +{ + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * @var array + */ + protected $service_classes; + + /** + * Constructor + * + * @param ContainerInterface $container Container object + */ + public function __construct(ContainerInterface $container) + { + $this->container = $container; + $this->service_classes = array(); + } + + /** + * {@inheritdoc} + */ + public function getIterator() + { + return new service_collection_iterator($this); + } + + /** + * {@inheritdoc} + */ + public function offsetGet($index) + { + return $this->container->get($index); + } + + /** + * Add a service to the collection + * + * @param string $name The service name + * @return void + */ + public function add($name) + { + $this->offsetSet($name, false); + } + + /** + * Add a service's class to the collection + * + * @param string $service_id + * @param string $class + */ + public function add_service_class($service_id, $class) + { + $this->service_classes[$service_id] = $class; + } + + /** + * Get services' classes + * + * @return array + */ + public function get_service_classes() + { + return $this->service_classes; + } + + /** + * Returns the service associated to a class + * + * @return mixed + * @throw \RuntimeException if the + */ + public function get_by_class($class) + { + $service_id = null; + + foreach ($this->service_classes as $id => $service_class) + { + if ($service_class === $class) + { + if ($service_id !== null) + { + throw new \RuntimeException('More than one service definitions found for class "'.$class.'" in collection.'); + } + + $service_id = $id; + } + } + + if ($service_id === null) + { + throw new \RuntimeException('No service found for class "'.$class.'" in collection.'); + } + + return $this->offsetGet($service_id); + } +} diff --git a/install/update/new/phpbb/event/md_exporter.php b/install/update/new/phpbb/event/md_exporter.php new file mode 100644 index 0000000..1a2d7c9 --- /dev/null +++ b/install/update/new/phpbb/event/md_exporter.php @@ -0,0 +1,568 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\event; + +/** +* Crawls through a markdown file and grabs all events +*/ +class md_exporter +{ + /** @var string Path where we look for files*/ + protected $path; + + /** @var string phpBB Root Path */ + protected $root_path; + + /** @var string The minimum version for the events to return */ + protected $min_version; + + /** @var string The maximum version for the events to return */ + protected $max_version; + + /** @var string */ + protected $filter; + + /** @var string */ + protected $current_event; + + /** @var array */ + protected $events; + + /** + * @param string $phpbb_root_path + * @param mixed $extension String 'vendor/ext' to filter, null for phpBB core + * @param string $min_version + * @param string $max_version + */ + public function __construct($phpbb_root_path, $extension = null, $min_version = null, $max_version = null) + { + $this->root_path = $phpbb_root_path; + $this->path = $this->root_path; + if ($extension) + { + $this->path .= 'ext/' . $extension . '/'; + } + + $this->events = array(); + $this->events_by_file = array(); + $this->filter = $this->current_event = ''; + $this->min_version = $min_version; + $this->max_version = $max_version; + } + + /** + * Get the list of all events + * + * @return array Array with events: name => details + */ + public function get_events() + { + return $this->events; + } + + /** + * @param string $md_file Relative from phpBB root + * @return int Number of events found + * @throws \LogicException + */ + public function crawl_phpbb_directory_adm($md_file) + { + $this->crawl_eventsmd($md_file, 'adm'); + + $file_list = $this->get_recursive_file_list($this->path . 'adm/style/'); + foreach ($file_list as $file) + { + $file_name = 'adm/style/' . $file; + $this->validate_events_from_file($file_name, $this->crawl_file_for_events($file_name)); + } + + return count($this->events); + } + + /** + * @param string $md_file Relative from phpBB root + * @return int Number of events found + * @throws \LogicException + */ + public function crawl_phpbb_directory_styles($md_file) + { + $this->crawl_eventsmd($md_file, 'styles'); + + $styles = array('prosilver'); + foreach ($styles as $style) + { + $file_list = $this->get_recursive_file_list( + $this->path . 'styles/' . $style . '/template/' + ); + + foreach ($file_list as $file) + { + $file_name = 'styles/' . $style . '/template/' . $file; + $this->validate_events_from_file($file_name, $this->crawl_file_for_events($file_name)); + } + } + + return count($this->events); + } + + /** + * @param string $md_file Relative from phpBB root + * @param string $filter Should be 'styles' or 'adm' + * @return int Number of events found + * @throws \LogicException + */ + public function crawl_eventsmd($md_file, $filter) + { + if (!file_exists($this->path . $md_file)) + { + throw new \LogicException("The event docs file '{$md_file}' could not be found"); + } + + $file_content = file_get_contents($this->path . $md_file); + $this->filter = $filter; + + $events = explode("\n\n", $file_content); + foreach ($events as $event) + { + // Last row of the file + if (strpos($event, "\n===\n") === false) + { + continue; + } + + list($event_name, $details) = explode("\n===\n", $event, 2); + $this->validate_event_name($event_name); + $sorted_events = [$this->current_event, $event_name]; + natsort($sorted_events); + $this->current_event = $event_name; + + if (isset($this->events[$this->current_event])) + { + throw new \LogicException("The event '{$this->current_event}' is defined multiple times"); + } + + // Use array_values() to get actual first element and check against natural order + if (array_values($sorted_events)[0] === $event_name) + { + throw new \LogicException("The event '{$sorted_events[1]}' should be defined before '{$sorted_events[0]}'"); + } + + if (($this->filter == 'adm' && strpos($this->current_event, 'acp_') !== 0) + || ($this->filter == 'styles' && strpos($this->current_event, 'acp_') === 0)) + { + continue; + } + + list($file_details, $details) = explode("\n* Since: ", $details, 2); + + $changed_versions = array(); + if (strpos($details, "\n* Changed: ") !== false) + { + list($since, $details) = explode("\n* Changed: ", $details, 2); + while (strpos($details, "\n* Changed: ") !== false) + { + list($changed, $details) = explode("\n* Changed: ", $details, 2); + $changed_versions[] = $changed; + } + list($changed, $description) = explode("\n* Purpose: ", $details, 2); + $changed_versions[] = $changed; + } + else + { + list($since, $description) = explode("\n* Purpose: ", $details, 2); + $changed_versions = array(); + } + + $files = $this->validate_file_list($file_details); + $since = $this->validate_since($since); + $changes = array(); + foreach ($changed_versions as $changed) + { + list($changed_version, $changed_description) = $this->validate_changed($changed); + + if (isset($changes[$changed_version])) + { + throw new \LogicException("Duplicate change information found for event '{$this->current_event}'"); + } + + $changes[$changed_version] = $changed_description; + } + $description = trim($description, "\n") . "\n"; + + if (!$this->version_is_filtered($since)) + { + $is_filtered = false; + foreach ($changes as $version => $null) + { + if ($this->version_is_filtered($version)) + { + $is_filtered = true; + break; + } + } + + if (!$is_filtered) + { + continue; + } + } + + $this->events[$event_name] = array( + 'event' => $this->current_event, + 'files' => $files, + 'since' => $since, + 'changed' => $changes, + 'description' => $description, + ); + } + + return count($this->events); + } + + /** + * The version to check + * + * @param string $version + * @return bool + */ + protected function version_is_filtered($version) + { + return (!$this->min_version || phpbb_version_compare($this->min_version, $version, '<=')) + && (!$this->max_version || phpbb_version_compare($this->max_version, $version, '>=')); + } + + /** + * Format the php events as a wiki table + * + * @param string $action + * @return string Number of events found + */ + public function export_events_for_wiki($action = '') + { + if ($this->filter === 'adm') + { + if ($action === 'diff') + { + $wiki_page = '=== ACP Template Events ===' . "\n"; + } + else + { + $wiki_page = '= ACP Template Events =' . "\n"; + } + $wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n"; + $wiki_page .= '! Identifier !! Placement !! Added in Release !! Explanation' . "\n"; + } + else + { + if ($action === 'diff') + { + $wiki_page = '=== Template Events ===' . "\n"; + } + else + { + $wiki_page = '= Template Events =' . "\n"; + } + $wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n"; + $wiki_page .= '! Identifier !! Prosilver Placement (If applicable) !! Added in Release !! Explanation' . "\n"; + } + + foreach ($this->events as $event_name => $event) + { + $wiki_page .= "|- id=\"{$event_name}\"\n"; + $wiki_page .= "| [[#{$event_name}|{$event_name}]] || "; + + if ($this->filter === 'adm') + { + $wiki_page .= implode(', ', $event['files']['adm']); + } + else + { + $wiki_page .= implode(', ', $event['files']['prosilver']); + } + + $wiki_page .= " || {$event['since']} || " . str_replace("\n", ' ', $event['description']) . "\n"; + } + $wiki_page .= '|}' . "\n"; + + return $wiki_page; + } + + /** + * Validates a template event name + * + * @param $event_name + * @return null + * @throws \LogicException + */ + public function validate_event_name($event_name) + { + if (!preg_match('#^([a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)+)$#', $event_name)) + { + throw new \LogicException("Invalid event name '{$event_name}'"); + } + } + + /** + * Validate "Since" Information + * + * @param string $since + * @return string + * @throws \LogicException + */ + public function validate_since($since) + { + if (!$this->validate_version($since)) + { + throw new \LogicException("Invalid since information found for event '{$this->current_event}'"); + } + + return $since; + } + + /** + * Validate "Changed" Information + * + * @param string $changed + * @return string + * @throws \LogicException + */ + public function validate_changed($changed) + { + if (strpos($changed, ' ') !== false) + { + list($version, $description) = explode(' ', $changed, 2); + } + else + { + $version = $changed; + $description = ''; + } + + if (!$this->validate_version($version)) + { + throw new \LogicException("Invalid changed information found for event '{$this->current_event}'"); + } + + return array($version, $description); + } + + /** + * Validate "version" Information + * + * @param string $version + * @return bool True if valid, false otherwise + */ + public function validate_version($version) + { + return preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $version); + } + + /** + * Validate the files list + * + * @param string $file_details + * @return array + * @throws \LogicException + */ + public function validate_file_list($file_details) + { + $files_list = array( + 'prosilver' => array(), + 'adm' => array(), + ); + + // Multi file list + if (strpos($file_details, "* Locations:\n + ") === 0) + { + $file_details = substr($file_details, strlen("* Locations:\n + ")); + $files = explode("\n + ", $file_details); + foreach ($files as $file) + { + if (!preg_match('#^([^ ]+)( \([0-9]+\))?$#', $file)) + { + throw new \LogicException("Invalid event instances for file '{$file}' found for event '{$this->current_event}'", 1); + } + + list($file) = explode(" ", $file); + + if (!file_exists($this->path . $file) || substr($file, -5) !== '.html') + { + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 2); + } + + if (($this->filter !== 'adm') && strpos($file, 'styles/prosilver/template/') === 0) + { + $files_list['prosilver'][] = substr($file, strlen('styles/prosilver/template/')); + } + else if (($this->filter === 'adm') && strpos($file, 'adm/style/') === 0) + { + $files_list['adm'][] = substr($file, strlen('adm/style/')); + } + else + { + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 3); + } + + $this->events_by_file[$file][] = $this->current_event; + } + } + else if ($this->filter == 'adm') + { + $file = substr($file_details, strlen('* Location: ')); + if (!file_exists($this->path . $file) || substr($file, -5) !== '.html') + { + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 1); + } + + $files_list['adm'][] = substr($file, strlen('adm/style/')); + + $this->events_by_file[$file][] = $this->current_event; + } + else + { + throw new \LogicException("Invalid file list found for event '{$this->current_event}'", 1); + } + + return $files_list; + } + + /** + * Get all template events in a template file + * + * @param string $file + * @return array + * @throws \LogicException + */ + public function crawl_file_for_events($file) + { + if (!file_exists($this->path . $file)) + { + throw new \LogicException("File '{$file}' does not exist", 1); + } + + $event_list = array(); + $file_content = file_get_contents($this->path . $file); + + preg_match_all('/(?:{%|)/U', $file_content, $event_list); + + return $event_list[1]; + } + + /** + * Validates whether all events from $file are in the md file and vice-versa + * + * @param string $file + * @param array $events + * @return true + * @throws \LogicException + */ + public function validate_events_from_file($file, array $events) + { + if (empty($this->events_by_file[$file]) && empty($events)) + { + return true; + } + else if (empty($this->events_by_file[$file])) + { + $event_list = implode("', '", $events); + throw new \LogicException("File '{$file}' should not contain events, but contains: " + . "'{$event_list}'", 1); + } + else if (empty($events)) + { + $event_list = implode("', '", $this->events_by_file[$file]); + throw new \LogicException("File '{$file}' contains no events, but should contain: " + . "'{$event_list}'", 1); + } + + $missing_events_from_file = array(); + foreach ($this->events_by_file[$file] as $event) + { + if (!in_array($event, $events)) + { + $missing_events_from_file[] = $event; + } + } + + if (!empty($missing_events_from_file)) + { + $event_list = implode("', '", $missing_events_from_file); + throw new \LogicException("File '{$file}' does not contain events: '{$event_list}'", 2); + } + + $missing_events_from_md = array(); + foreach ($events as $event) + { + if (!in_array($event, $this->events_by_file[$file])) + { + $missing_events_from_md[] = $event; + } + } + + if (!empty($missing_events_from_md)) + { + $event_list = implode("', '", $missing_events_from_md); + throw new \LogicException("File '{$file}' contains additional events: '{$event_list}'", 3); + } + + return true; + } + + /** + * Returns a list of files in $dir + * + * Works recursive with any depth + * + * @param string $dir Directory to go through + * @return array List of files (including directories) + */ + public function get_recursive_file_list($dir) + { + try + { + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $dir, + \FilesystemIterator::SKIP_DOTS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + } + catch (\Exception $e) + { + return array(); + } + + $files = array(); + foreach ($iterator as $file_info) + { + /** @var \RecursiveDirectoryIterator $file_info */ + if ($file_info->isDir()) + { + continue; + } + + $relative_path = $iterator->getInnerIterator()->getSubPathname(); + + if (substr($relative_path, -5) == '.html') + { + $files[] = str_replace(DIRECTORY_SEPARATOR, '/', $relative_path); + } + } + + return $files; + } +} diff --git a/install/update/new/phpbb/extension/extension_interface.php b/install/update/new/phpbb/extension/extension_interface.php new file mode 100644 index 0000000..46072d4 --- /dev/null +++ b/install/update/new/phpbb/extension/extension_interface.php @@ -0,0 +1,71 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\extension; + +/** +* The interface extension meta classes have to implement to run custom code +* on enable/disable/purge. +*/ +interface extension_interface +{ + /** + * Indicate whether or not the extension can be enabled. + * + * @return bool|array True if extension is enableable, array of reasons + * if not, false for generic reason. + */ + public function is_enableable(); + + /** + * enable_step is executed on enabling an extension until it returns false. + * + * Calls to this function can be made in subsequent requests, when the + * function is invoked through a webserver with a too low max_execution_time. + * + * @param mixed $old_state The return value of the previous call + * of this method, or false on the first call + * @return mixed Returns false after last step, otherwise + * temporary state which is passed as an + * argument to the next step + */ + public function enable_step($old_state); + + /** + * Disables the extension. + * + * Calls to this function can be made in subsequent requests, when the + * function is invoked through a webserver with a too low max_execution_time. + * + * @param mixed $old_state The return value of the previous call + * of this method, or false on the first call + * @return mixed Returns false after last step, otherwise + * temporary state which is passed as an + * argument to the next step + */ + public function disable_step($old_state); + + /** + * purge_step is executed on purging an extension until it returns false. + * + * Calls to this function can be made in subsequent requests, when the + * function is invoked through a webserver with a too low max_execution_time. + * + * @param mixed $old_state The return value of the previous call + * of this method, or false on the first call + * @return mixed Returns false after last step, otherwise + * temporary state which is passed as an + * argument to the next step + */ + public function purge_step($old_state); +} diff --git a/install/update/new/phpbb/extension/manager.php b/install/update/new/phpbb/extension/manager.php new file mode 100644 index 0000000..1ce8425 --- /dev/null +++ b/install/update/new/phpbb/extension/manager.php @@ -0,0 +1,591 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\extension; + +use phpbb\exception\runtime_exception; +use phpbb\file_downloader; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* The extension manager provides means to activate/deactivate extensions. +*/ +class manager +{ + /** @var ContainerInterface */ + protected $container; + + protected $db; + protected $config; + protected $cache; + protected $php_ext; + protected $extensions; + protected $extension_table; + protected $phpbb_root_path; + protected $cache_name; + + /** + * Creates a manager and loads information from database + * + * @param ContainerInterface $container A container + * @param \phpbb\db\driver\driver_interface $db A database connection + * @param \phpbb\config\config $config Config object + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param string $extension_table The name of the table holding extensions + * @param string $phpbb_root_path Path to the phpbb includes directory. + * @param string $php_ext php file extension, defaults to php + * @param \phpbb\cache\service $cache A cache instance or null + * @param string $cache_name The name of the cache variable, defaults to _ext + */ + public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\filesystem\filesystem_interface $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\service $cache = null, $cache_name = '_ext') + { + $this->cache = $cache; + $this->cache_name = $cache_name; + $this->config = $config; + $this->container = $container; + $this->db = $db; + $this->extension_table = $extension_table; + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->extensions = ($this->cache) ? $this->cache->get($this->cache_name) : false; + + if ($this->extensions === false) + { + $this->load_extensions(); + } + } + + /** + * Loads all extension information from the database + * + * @return null + */ + public function load_extensions() + { + $this->extensions = array(); + + // Do not try to load any extensions if the extension table + // does not exist or when installing or updating. + // Note: database updater invokes this code, and in 3.0 + // there is no extension table therefore the rest of this function + // fails + if (defined('IN_INSTALL') || version_compare($this->config['version'], '3.1.0-dev', '<')) + { + return; + } + + $sql = 'SELECT * + FROM ' . $this->extension_table; + + $result = $this->db->sql_query($sql); + $extensions = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + foreach ($extensions as $extension) + { + $extension['ext_path'] = $this->get_extension_path($extension['ext_name']); + $this->extensions[$extension['ext_name']] = $extension; + } + + ksort($this->extensions); + + if ($this->cache) + { + $this->cache->put($this->cache_name, $this->extensions); + } + } + + /** + * Generates the path to an extension + * + * @param string $name The name of the extension + * @param bool $phpbb_relative Whether the path should be relative to phpbb root + * @return string Path to an extension + */ + public function get_extension_path($name, $phpbb_relative = false) + { + $name = str_replace('.', '', $name); + + return (($phpbb_relative) ? $this->phpbb_root_path : '') . 'ext/' . $name . '/'; + } + + /** + * Instantiates the extension meta class for the extension with the given name + * + * @param string $name The extension name + * @return \phpbb\extension\extension_interface Instance of the extension meta class or + * \phpbb\extension\base if the class does not exist + */ + public function get_extension($name) + { + $extension_class_name = str_replace('/', '\\', $name) . '\\ext'; + + $migrator = $this->container->get('migrator'); + + if (class_exists($extension_class_name)) + { + return new $extension_class_name($this->container, $this->get_finder(), $migrator, $name, $this->get_extension_path($name, true)); + } + else + { + return new \phpbb\extension\base($this->container, $this->get_finder(), $migrator, $name, $this->get_extension_path($name, true)); + } + } + + /** + * Instantiates the metadata manager for the extension with the given name + * + * @param string $name The extension name + * @return \phpbb\extension\metadata_manager Instance of the metadata manager + */ + public function create_extension_metadata_manager($name) + { + if (!isset($this->extensions[$name]['metadata'])) + { + $metadata = new \phpbb\extension\metadata_manager($name, $this->get_extension_path($name, true)); + $this->extensions[$name]['metadata'] = $metadata; + } + return $this->extensions[$name]['metadata']; + } + + /** + * Update the database entry for an extension + * + * @param string $name Extension name to update + * @param array $data Data to update in the database + * @param string $action Action to perform, by default 'update', may be also 'insert' or 'delete' + */ + protected function update_state($name, $data, $action = 'update') + { + switch ($action) + { + case 'insert': + $this->extensions[$name] = $data; + $this->extensions[$name]['ext_path'] = $this->get_extension_path($name); + ksort($this->extensions); + $sql = 'INSERT INTO ' . $this->extension_table . ' ' . $this->db->sql_build_array('INSERT', $data); + $this->db->sql_query($sql); + break; + + case 'update': + $this->extensions[$name] = array_merge($this->extensions[$name], $data); + $sql = 'UPDATE ' . $this->extension_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $data) . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + break; + + case 'delete': + unset($this->extensions[$name]); + $sql = 'DELETE FROM ' . $this->extension_table . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + break; + } + + if ($this->cache) + { + $this->cache->purge(); + } + } + + /** + * Runs a step of the extension enabling process. + * + * Allows the exentension to enable in a long running script that works + * in multiple steps across requests. State is kept for the extension + * in the extensions table. + * + * @param string $name The extension's name + * @return bool False if enabling is finished, true otherwise + */ + public function enable_step($name) + { + // ignore extensions that are already enabled + if ($this->is_enabled($name)) + { + return false; + } + + $old_state = (isset($this->extensions[$name]['ext_state'])) ? unserialize($this->extensions[$name]['ext_state']) : false; + + $extension = $this->get_extension($name); + + if (!$extension->is_enableable()) + { + return false; + } + + $state = $extension->enable_step($old_state); + + $active = ($state === false); + + $extension_data = array( + 'ext_name' => $name, + 'ext_active' => $active, + 'ext_state' => serialize($state), + ); + + $this->update_state($name, $extension_data, $this->is_configured($name) ? 'update' : 'insert'); + + if ($active) + { + $this->config->increment('assets_version', 1); + } + + return !$active; + } + + /** + * Enables an extension + * + * This method completely enables an extension. But it could be long running + * so never call this in a script that has a max_execution time. + * + * @param string $name The extension's name + * @return null + */ + public function enable($name) + { + // @codingStandardsIgnoreStart + while ($this->enable_step($name)); + // @codingStandardsIgnoreEnd + } + + /** + * Disables an extension + * + * Calls the disable method on the extension's meta class to allow it to + * process the event. + * + * @param string $name The extension's name + * @return bool False if disabling is finished, true otherwise + */ + public function disable_step($name) + { + // ignore extensions that are not enabled + if (!$this->is_enabled($name)) + { + return false; + } + + $old_state = unserialize($this->extensions[$name]['ext_state']); + + $extension = $this->get_extension($name); + $state = $extension->disable_step($old_state); + $active = ($state !== false); + + $extension_data = array( + 'ext_active' => $active, + 'ext_state' => serialize($state), + ); + $this->update_state($name, $extension_data); + + return $active; + } + + /** + * Disables an extension + * + * Disables an extension completely at once. This process could run for a + * while so never call this in a script that has a max_execution time. + * + * @param string $name The extension's name + * @return null + */ + public function disable($name) + { + // @codingStandardsIgnoreStart + while ($this->disable_step($name)); + // @codingStandardsIgnoreEnd + } + + /** + * Purge an extension + * + * Disables the extension first if active, and then calls purge on the + * extension's meta class to delete the extension's database content. + * + * @param string $name The extension's name + * @return bool False if purging is finished, true otherwise + */ + public function purge_step($name) + { + // ignore extensions that are not configured + if (!$this->is_configured($name)) + { + return false; + } + + // disable first if necessary + if ($this->extensions[$name]['ext_active']) + { + $this->disable($name); + } + + $old_state = unserialize($this->extensions[$name]['ext_state']); + + $extension = $this->get_extension($name); + $state = $extension->purge_step($old_state); + $purged = ($state === false); + + $extension_data = array( + 'ext_state' => serialize($state), + ); + + $this->update_state($name, $extension_data, $purged ? 'delete' : 'update'); + + // continue until the state is false + return !$purged; + } + + /** + * Purge an extension + * + * Purges an extension completely at once. This process could run for a while + * so never call this in a script that has a max_execution time. + * + * @param string $name The extension's name + * @return null + */ + public function purge($name) + { + // @codingStandardsIgnoreStart + while ($this->purge_step($name)); + // @codingStandardsIgnoreEnd + } + + /** + * Retrieves a list of all available extensions on the filesystem + * + * @return array An array with extension names as keys and paths to the + * extension as values + */ + public function all_available() + { + $available = array(); + if (!is_dir($this->phpbb_root_path . 'ext/')) + { + return $available; + } + + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/', \FilesystemIterator::NEW_CURRENT_AND_KEY | \FilesystemIterator::FOLLOW_SYMLINKS) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + $iterator->setMaxDepth(2); + + foreach ($iterator as $file_info) + { + if ($file_info->isFile() && $file_info->getFilename() == 'composer.json') + { + $ext_name = $iterator->getInnerIterator()->getSubPath(); + $ext_name = str_replace(DIRECTORY_SEPARATOR, '/', $ext_name); + if ($this->is_available($ext_name)) + { + $available[$ext_name] = $this->get_extension_path($ext_name, true); + } + } + } + ksort($available); + return $available; + } + + /** + * Retrieves all configured extensions. + * + * All enabled and disabled extensions are considered configured. A purged + * extension that is no longer in the database is not configured. + * + * @param bool $phpbb_relative Whether the path should be relative to phpbb root + * + * @return array An array with extension names as keys and and the + * database stored extension information as values + */ + public function all_configured($phpbb_relative = true) + { + $configured = array(); + foreach ($this->extensions as $name => $data) + { + if ($this->is_configured($name)) + { + unset($data['metadata']); + $data['ext_path'] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path']; + $configured[$name] = $data; + } + } + return $configured; + } + + /** + * Retrieves all enabled extensions. + * @param bool $phpbb_relative Whether the path should be relative to phpbb root + * + * @return array An array with extension names as keys and and the + * database stored extension information as values + */ + public function all_enabled($phpbb_relative = true) + { + $enabled = array(); + foreach ($this->extensions as $name => $data) + { + if ($this->is_enabled($name)) + { + $enabled[$name] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path']; + } + } + return $enabled; + } + + /** + * Retrieves all disabled extensions. + * + * @param bool $phpbb_relative Whether the path should be relative to phpbb root + * + * @return array An array with extension names as keys and and the + * database stored extension information as values + */ + public function all_disabled($phpbb_relative = true) + { + $disabled = array(); + foreach ($this->extensions as $name => $data) + { + if ($this->is_disabled($name)) + { + $disabled[$name] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path']; + } + } + return $disabled; + } + + /** + * Check to see if a given extension is available on the filesystem + * + * @param string $name Extension name to check NOTE: Can be user input + * @return bool Depending on whether or not the extension is available + */ + public function is_available($name) + { + $md_manager = $this->create_extension_metadata_manager($name); + try + { + return $md_manager->get_metadata('all') && $md_manager->validate_enable(); + } + catch (\phpbb\extension\exception $e) + { + return false; + } + } + + /** + * Check to see if a given extension is enabled + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is enabled + */ + public function is_enabled($name) + { + return isset($this->extensions[$name]['ext_active']) && $this->extensions[$name]['ext_active']; + } + + /** + * Check to see if a given extension is disabled + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is disabled + */ + public function is_disabled($name) + { + return isset($this->extensions[$name]['ext_active']) && !$this->extensions[$name]['ext_active']; + } + + /** + * Check to see if a given extension is configured + * + * All enabled and disabled extensions are considered configured. A purged + * extension that is no longer in the database is not configured. + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is configured + */ + public function is_configured($name) + { + return isset($this->extensions[$name]['ext_active']); + } + + /** + * Check the version and return the available updates (for an extension). + * + * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check. + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @param string $stability Force the stability (null by default). + * @return array + * @throws runtime_exception + */ + public function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false, $stability = null) + { + $meta = $md_manager->get_metadata('all'); + + if (!isset($meta['extra']['version-check'])) + { + throw new runtime_exception('NO_VERSIONCHECK'); + } + + $version_check = $meta['extra']['version-check']; + + $version_helper = new \phpbb\version_helper($this->cache, $this->config, new file_downloader()); + $version_helper->set_current_version($meta['version']); + $version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename'], isset($version_check['ssl']) ? $version_check['ssl'] : false); + $version_helper->force_stability($stability); + + return $version_helper->get_ext_update_on_branch($force_update, $force_cache); + } + + /** + * Check to see if a given extension is purged + * + * An extension is purged if it is available, not enabled and not disabled. + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is purged + */ + public function is_purged($name) + { + return $this->is_available($name) && !$this->is_configured($name); + } + + /** + * Instantiates a \phpbb\finder. + * + * @param bool $use_all_available Should we load all extensions, or just enabled ones + * @return \phpbb\finder An extension finder instance + */ + public function get_finder($use_all_available = false) + { + $finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder'); + if ($use_all_available) + { + $finder->set_extensions(array_keys($this->all_available())); + } + else + { + $finder->set_extensions(array_keys($this->all_enabled())); + } + return $finder; + } +} diff --git a/install/update/new/phpbb/feed/controller/feed.php b/install/update/new/phpbb/feed/controller/feed.php new file mode 100644 index 0000000..7826d19 --- /dev/null +++ b/install/update/new/phpbb/feed/controller/feed.php @@ -0,0 +1,410 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\feed\controller; + +use phpbb\auth\auth; +use phpbb\config\config; +use phpbb\db\driver\driver_interface; +use \phpbb\event\dispatcher_interface; +use phpbb\exception\http_exception; +use phpbb\feed\feed_interface; +use phpbb\feed\exception\feed_unavailable_exception; +use phpbb\feed\exception\unauthorized_exception; +use phpbb\feed\helper as feed_helper; +use phpbb\controller\helper as controller_helper; +use phpbb\symfony_request; +use phpbb\user; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + +class feed +{ + /** + * @var \Twig_Environment + */ + protected $template; + + /** + * @var symfony_request + */ + protected $request; + + /** + * @var controller_helper + */ + protected $controller_helper; + + /** + * @var config + */ + protected $config; + + /** + * @var driver_interface + */ + protected $db; + + /** + * @var ContainerInterface + */ + protected $container; + + /** + * @var feed_helper + */ + protected $feed_helper; + + /** + * @var user + */ + protected $user; + + /** + * @var auth + */ + protected $auth; + + /** + * @var dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \Twig_Environment $twig + * @param symfony_request $request + * @param controller_helper $controller_helper + * @param config $config + * @param driver_interface $db + * @param ContainerInterface $container + * @param feed_helper $feed_helper + * @param user $user + * @param auth $auth + * @param dispatcher_interface $phpbb_dispatcher + * @param string $php_ext + */ + public function __construct(\Twig_Environment $twig, symfony_request $request, controller_helper $controller_helper, config $config, driver_interface $db, ContainerInterface $container, feed_helper $feed_helper, user $user, auth $auth, dispatcher_interface $phpbb_dispatcher, $php_ext) + { + $this->request = $request; + $this->controller_helper = $controller_helper; + $this->config = $config; + $this->db = $db; + $this->container = $container; + $this->feed_helper = $feed_helper; + $this->user = $user; + $this->auth = $auth; + $this->php_ext = $php_ext; + $this->template = $twig; + $this->phpbb_dispatcher = $phpbb_dispatcher; + } + + /** + * Controller for /feed/forums route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function forums() + { + if (!$this->config['feed_overall_forums']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.forums')); + } + + /** + * Controller for /feed/news route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function news() + { + // Get at least one news forum + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0'); + $result = $this->db->sql_query_limit($sql, 1, 0, 600); + $s_feed_news = (int) $this->db->sql_fetchfield('forum_id'); + $this->db->sql_freeresult($result); + + if (!$s_feed_news) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.news')); + } + + /** + * Controller for /feed/topics route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topics() + { + if (!$this->config['feed_topics_new']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.topics')); + } + + /** + * Controller for /feed/topics_new route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topics_new() + { + return $this->topics(); + } + + /** + * Controller for /feed/topics_active route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topics_active() + { + if (!$this->config['feed_topics_active']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.topics_active')); + } + + /** + * Controller for /feed/forum/{forum_id} route + * + * @param int $forum_id + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function forum($forum_id) + { + if (!$this->config['feed_forum']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.forum')->set_forum_id($forum_id)); + } + + /** + * Controller for /feed/topic/{topic_id} route + * + * @param int $topic_id + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topic($topic_id) + { + if (!$this->config['feed_topic']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.topic')->set_topic_id($topic_id)); + } + + /** + * Controller for /feed/{mode] route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function overall() + { + if (!$this->config['feed_overall']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.overall')); + } + + /** + * Display a given feed + * + * @param feed_interface $feed + * + * @return Response + */ + protected function send_feed(feed_interface $feed) + { + try + { + return $this->send_feed_do($feed); + } + catch (feed_unavailable_exception $e) + { + throw new http_exception(Response::HTTP_NOT_FOUND, $e->getMessage(), $e->get_parameters(), $e); + } + catch (unauthorized_exception $e) + { + throw new http_exception(Response::HTTP_FORBIDDEN, $e->getMessage(), $e->get_parameters(), $e); + } + } + + /** + * Really send the feed + * + * @param feed_interface $feed + * + * @return Response + * + * @throw exception\feed_exception + */ + protected function send_feed_do(feed_interface $feed) + { + $feed_updated_time = 0; + $item_vars = array(); + + $board_url = $this->feed_helper->get_board_url(); + + // Open Feed + $feed->open(); + + // Iterate through items + while ($row = $feed->get_item()) + { + /** + * Event to modify the feed row + * + * @event core.feed_modify_feed_row + * @var feed_interface feed Feed instance + * @var array row Array with feed data + * + * @since 3.1.10-RC1 + * @changed 3.3.0 Replace forum_id, mode, topic_id with feed instance + */ + $vars = array('feed', 'row'); + extract($this->phpbb_dispatcher->trigger_event('core.feed_modify_feed_row', compact($vars))); + + // BBCode options to correctly disable urls, smilies, bbcode... + if ($feed->get('options') === null) + { + // Allow all combinations + $options = 7; + + if ($feed->get('enable_bbcode') !== null && $feed->get('enable_smilies') !== null && $feed->get('enable_magic_url') !== null) + { + $options = (($row[$feed->get('enable_bbcode')]) ? OPTION_FLAG_BBCODE : 0) + (($row[$feed->get('enable_smilies')]) ? OPTION_FLAG_SMILIES : 0) + (($row[$feed->get('enable_magic_url')]) ? OPTION_FLAG_LINKS : 0); + } + } + else + { + $options = $row[$feed->get('options')]; + } + + $title = (isset($row[$feed->get('title')]) && $row[$feed->get('title')] !== '') ? $row[$feed->get('title')] : ((isset($row[$feed->get('title2')])) ? $row[$feed->get('title2')] : ''); + + $published = ($feed->get('published') !== null) ? (int) $row[$feed->get('published')] : 0; + $updated = ($feed->get('updated') !== null) ? (int) $row[$feed->get('updated')] : 0; + + $display_attachments = ($this->auth->acl_get('u_download') && $this->auth->acl_get('f_download', $row['forum_id']) && isset($row['post_attachment']) && $row['post_attachment']) ? true : false; + + $item_row = array( + 'author' => ($feed->get('creator') !== null) ? $row[$feed->get('creator')] : '', + 'published' => ($published > 0) ? $this->feed_helper->format_date($published) : '', + 'updated' => ($updated > 0) ? $this->feed_helper->format_date($updated) : '', + 'link' => '', + 'title' => censor_text($title), + 'category' => ($this->config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $this->php_ext . '?f=' . $row['forum_id'] : '', + 'category_name' => ($this->config['feed_item_statistics'] && isset($row['forum_name'])) ? $row['forum_name'] : '', + 'description' => censor_text($this->feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], ($display_attachments ? $feed->get_attachments($row['post_id']) : array()))), + 'statistics' => '', + ); + + // Adjust items, fill link, etc. + $feed->adjust_item($item_row, $row); + + $item_vars[] = $item_row; + + $feed_updated_time = max($feed_updated_time, $published, $updated); + } + + // If we do not have any items at all, sending the current time is better than sending no time. + if (!$feed_updated_time) + { + $feed_updated_time = time(); + } + + $feed->close(); + + $content = $this->template->render('feed.xml.twig', array( + // Some default assignments + // FEED_IMAGE is not used (atom) + 'FEED_IMAGE' => '', + 'SELF_LINK' => $this->controller_helper->route($this->request->attributes->get('_route'), $this->request->attributes->get('_route_params'), true, '', UrlGeneratorInterface::ABSOLUTE_URL), + 'FEED_LINK' => $board_url . '/index.' . $this->php_ext, + 'FEED_TITLE' => $this->config['sitename'], + 'FEED_SUBTITLE' => $this->config['site_desc'], + 'FEED_UPDATED' => $this->feed_helper->format_date($feed_updated_time), + 'FEED_LANG' => $this->user->lang['USER_LANG'], + 'FEED_AUTHOR' => $this->config['sitename'], + + // Feed entries + 'FEED_ROWS' => $item_vars, + )); + + $response = new Response($content); + $response->headers->set('Content-Type', 'application/atom+xml'); + $response->setCharset('UTF-8'); + $response->setLastModified(new \DateTime('@' . $feed_updated_time)); + + if (!empty($this->user->data['is_bot'])) + { + // Let reverse proxies know we detected a bot. + $response->headers->set('X-PHPBB-IS-BOT', 'yes'); + } + + return $response; + } + + /** + * Throw and exception saying that the feed isn't available + * + * @throw http_exception + */ + protected function send_unavailable() + { + throw new http_exception(404, 'FEATURE_NOT_AVAILABLE'); + } +} diff --git a/install/update/new/phpbb/feed/topics_active.php b/install/update/new/phpbb/feed/topics_active.php new file mode 100644 index 0000000..ee7fe17 --- /dev/null +++ b/install/update/new/phpbb/feed/topics_active.php @@ -0,0 +1,147 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed; + +/** + * Active Topics feed + * + * This will give you the last {$this->num_items} topics + * with replies made within the last {$this->sort_days} days + * including the last post. + */ +class topics_active extends topic_base +{ + protected $sort_days = 7; + + /** + * {@inheritdoc} + */ + public function set_keys() + { + parent::set_keys(); + + $this->set('author_id', 'topic_last_poster_id'); + $this->set('creator', 'topic_last_poster_name'); + } + + /** + * {@inheritdoc} + */ + protected function get_sql() + { + $forum_ids_read = $this->get_readable_forums(); + if (empty($forum_ids_read)) + { + return false; + } + + $in_fid_ary = array_intersect($forum_ids_read, $this->get_forum_ids()); + $in_fid_ary = array_diff($in_fid_ary, $this->get_passworded_forums()); + if (empty($in_fid_ary)) + { + return false; + } + + // Search for topics in last X days + $last_post_time_sql = ($this->sort_days) ? ' AND topic_last_post_time > ' . (time() - ($this->sort_days * 24 * 3600)) : ''; + + // We really have to get the post ids first! + $sql = 'SELECT topic_last_post_id, topic_last_post_time + FROM ' . TOPICS_TABLE . ' + WHERE topic_moved_id = 0 + AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . ' + ' . $last_post_time_sql . ' + ORDER BY topic_last_post_time DESC, topic_last_post_id DESC'; + $result = $this->db->sql_query_limit($sql, $this->num_items); + + $post_ids = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $post_ids[] = (int) $row['topic_last_post_id']; + } + $this->db->sql_freeresult($result); + + if (empty($post_ids)) + { + return false; + } + + parent::fetch_attachments($post_ids); + + $this->sql = array( + 'SELECT' => 'f.forum_id, f.forum_name, + t.topic_id, t.topic_title, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, + t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time, + p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, t.topic_visibility', + 'FROM' => array( + TOPICS_TABLE => 't', + POSTS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'p.forum_id = f.forum_id', + ), + ), + 'WHERE' => 'p.topic_id = t.topic_id + AND ' . $this->db->sql_in_set('p.post_id', $post_ids), + 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC', + ); + + return true; + } + + /** + * Returns the ids of the forums not excluded from the active list + * + * @return int[] + */ + private function get_forum_ids() + { + static $forum_ids; + + $cache_name = 'feed_topic_active_forum_ids'; + + if (!isset($forum_ids) && ($forum_ids = $this->cache->get('_' . $cache_name)) === false) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST . ' + AND ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_EXCLUDE, '= 0') . ' + AND ' . $this->db->sql_bit_and('forum_flags', round(log(FORUM_FLAG_ACTIVE_TOPICS, 2)), '<> 0'); + $result = $this->db->sql_query($sql); + + $forum_ids = array(); + while ($forum_id = (int) $this->db->sql_fetchfield('forum_id')) + { + $forum_ids[$forum_id] = $forum_id; + } + $this->db->sql_freeresult($result); + + $this->cache->put('_' . $cache_name, $forum_ids, 180); + } + + return $forum_ids; + } + + /** + * {@inheritdoc} + */ + public function adjust_item(&$item_row, &$row) + { + parent::adjust_item($item_row, $row); + + $item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title']; + } +} diff --git a/install/update/new/phpbb/files/filespec.php b/install/update/new/phpbb/files/filespec.php new file mode 100644 index 0000000..1e6771a --- /dev/null +++ b/install/update/new/phpbb/files/filespec.php @@ -0,0 +1,584 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files; + +use phpbb\language\language; + +/** + * Responsible for holding all file relevant information, as well as doing file-specific operations. + * The {@link fileupload fileupload class} can be used to upload several files, each of them being this object to operate further on. + */ +class filespec +{ + /** @var string File name */ + protected $filename = ''; + + /** @var string Real name of file */ + protected $realname = ''; + + /** @var string Upload name of file */ + protected $uploadname = ''; + + /** @var string Mimetype of file */ + protected $mimetype = ''; + + /** @var string File extension */ + protected $extension = ''; + + /** @var int File size */ + protected $filesize = 0; + + /** @var int Width of file */ + protected $width = 0; + + /** @var int Height of file */ + protected $height = 0; + + /** @var array Image info including type and size */ + protected $image_info = array(); + + /** @var string Destination file name */ + protected $destination_file = ''; + + /** @var string Destination file path */ + protected $destination_path = ''; + + /** @var bool Whether file was moved */ + protected $file_moved = false; + + /** @var bool Whether file is local */ + protected $local = false; + + /** @var bool Class initialization flag */ + protected $class_initialized = false; + + /** @var array Error array */ + public $error = array(); + + /** @var upload Instance of upload class */ + public $upload; + + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + /** @var \bantu\IniGetWrapper\IniGetWrapper ini_get() wrapper class */ + protected $php_ini; + + /** @var \FastImageSize\FastImageSize */ + protected $imagesize; + + /** @var language Language class */ + protected $language; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var \phpbb\plupload\plupload The plupload object */ + protected $plupload; + + /** @var \phpbb\mimetype\guesser phpBB Mimetype guesser */ + protected $mimetype_guesser; + + /** + * File upload class + * + * @param \phpbb\filesystem\filesystem_interface $phpbb_filesystem Filesystem + * @param language $language Language + * @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper + * @param \FastImageSize\FastImageSize $imagesize Imagesize class + * @param string $phpbb_root_path phpBB root path + * @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser + * @param \phpbb\plupload\plupload $plupload Plupload + */ + public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) + { + $this->filesystem = $phpbb_filesystem; + $this->language = $language; + $this->php_ini = $php_ini; + $this->imagesize = $imagesize; + $this->phpbb_root_path = $phpbb_root_path; + $this->plupload = $plupload; + $this->mimetype_guesser = $mimetype_guesser; + } + + /** + * Set upload ary + * + * @param array $upload_ary Upload ary + * + * @return filespec This instance of the filespec class + */ + public function set_upload_ary($upload_ary) + { + if (!isset($upload_ary) || !count($upload_ary)) + { + return $this; + } + + $this->class_initialized = true; + $this->filename = $upload_ary['tmp_name']; + $this->filesize = $upload_ary['size']; + $name = $upload_ary['name']; + $name = trim(utf8_basename($name)); + $this->realname = $this->uploadname = $name; + $this->mimetype = $upload_ary['type']; + + // Opera adds the name to the mime type + $this->mimetype = (strpos($this->mimetype, '; name') !== false) ? str_replace(strstr($this->mimetype, '; name'), '', $this->mimetype) : $this->mimetype; + + if (!$this->mimetype) + { + $this->mimetype = 'application/octet-stream'; + } + + $this->extension = strtolower(self::get_extension($this->realname)); + + // Try to get real filesize from temporary folder (not always working) ;) + $this->filesize = ($this->get_filesize($this->filename)) ?: $this->filesize; + + $this->width = $this->height = 0; + $this->file_moved = false; + + $this->local = (isset($upload_ary['local_mode'])) ? true : false; + + return $this; + } + + /** + * Set the upload namespace + * + * @param upload $namespace Instance of upload class + * + * @return filespec This instance of the filespec class + */ + public function set_upload_namespace($namespace) + { + $this->upload = $namespace; + + return $this; + } + + /** + * Check if class members were not properly initialised yet + * + * @return bool True if there was an init error, false if not + */ + public function init_error() + { + return !$this->class_initialized; + } + + /** + * Set error in error array + * + * @param mixed $error Content for error array + * + * @return \phpbb\files\filespec This instance of the filespec class + */ + public function set_error($error) + { + $this->error[] = $error; + + return $this; + } + + /** + * Cleans destination filename + * + * @param string $mode Either real, unique, or unique_ext. Real creates a + * realname, filtering some characters, lowering every + * character. Unique creates a unique filename. + * @param string $prefix Prefix applied to filename + * @param string $user_id The user_id is only needed for when cleaning a user's avatar + */ + public function clean_filename($mode = 'unique', $prefix = '', $user_id = '') + { + if ($this->init_error()) + { + return; + } + + switch ($mode) + { + case 'real': + // Remove every extension from filename (to not let the mime bug being exposed) + if (strpos($this->realname, '.') !== false) + { + $this->realname = substr($this->realname, 0, strpos($this->realname, '.')); + } + + // Replace any chars which may cause us problems with _ + $bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|'); + + $this->realname = rawurlencode(str_replace($bad_chars, '_', strtolower($this->realname))); + $this->realname = preg_replace("/%(\w{2})/", '_', $this->realname); + + $this->realname = $prefix . $this->realname . '.' . $this->extension; + break; + + case 'unique': + $this->realname = $prefix . md5(unique_id()); + break; + + case 'avatar': + $this->extension = strtolower($this->extension); + $this->realname = $prefix . $user_id . '.' . $this->extension; + + break; + + case 'unique_ext': + default: + $this->realname = $prefix . md5(unique_id()) . '.' . $this->extension; + } + } + + /** + * Get property from file object + * + * @param string $property Name of property + * + * @return mixed Content of property + */ + public function get($property) + { + if ($this->init_error() || !isset($this->$property)) + { + return false; + } + + return $this->$property; + } + + /** + * Check if file is an image (mime type) + * + * @return bool true if it is an image, false if not + */ + public function is_image() + { + return (strpos($this->mimetype, 'image/') === 0); + } + + /** + * Check if the file got correctly uploaded + * + * @return bool true if it is a valid upload, false if not + */ + public function is_uploaded() + { + $is_plupload = $this->plupload && $this->plupload->is_active(); + + if (!$this->local && !$is_plupload && !is_uploaded_file($this->filename)) + { + return false; + } + + if (($this->local || $is_plupload) && !file_exists($this->filename)) + { + return false; + } + + return true; + } + + /** + * Remove file + */ + public function remove() + { + if ($this->file_moved) + { + @unlink($this->destination_file); + } + } + + /** + * Get file extension + * + * @param string $filename Filename that needs to be checked + * + * @return string Extension of the supplied filename + */ + static public function get_extension($filename) + { + $filename = utf8_basename($filename); + + if (strpos($filename, '.') === false) + { + return ''; + } + + $filename = explode('.', $filename); + return array_pop($filename); + } + + /** + * Get mime type + * + * @param string $filename Filename that needs to be checked + * @return string Mime type of supplied filename + */ + public function get_mimetype($filename) + { + if ($this->mimetype_guesser !== null) + { + $mimetype = $this->mimetype_guesser->guess($filename, $this->uploadname); + + if ($mimetype !== 'application/octet-stream') + { + $this->mimetype = $mimetype; + } + } + + return $this->mimetype; + } + + /** + * Get file size + * + * @param string $filename File name of file to check + * + * @return int File size + */ + public function get_filesize($filename) + { + return @filesize($filename); + } + + + /** + * Check the first 256 bytes for forbidden content + * + * @param array $disallowed_content Array containg disallowed content + * + * @return bool False if disallowed content found, true if not + */ + public function check_content($disallowed_content) + { + if (empty($disallowed_content)) + { + return true; + } + + $fp = @fopen($this->filename, 'rb'); + + if ($fp !== false) + { + $ie_mime_relevant = fread($fp, 256); + fclose($fp); + foreach ($disallowed_content as $forbidden) + { + if (stripos($ie_mime_relevant, '<' . $forbidden) !== false) + { + return false; + } + } + } + return true; + } + + /** + * Move file to destination folder + * The phpbb_root_path variable will be applied to the destination path + * + * @param string $destination Destination path, for example $config['avatar_path'] + * @param bool $overwrite If set to true, an already existing file will be overwritten + * @param bool $skip_image_check If set to true, the check for the file to be a valid image is skipped + * @param string|bool $chmod Permission mask for chmodding the file after a successful move. + * The mode entered here reflects the mode defined by {@link phpbb_chmod()} + * + * @return bool True if file was moved, false if not + * @access public + */ + public function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false) + { + if (count($this->error)) + { + return false; + } + + $chmod = ($chmod === false) ? CHMOD_READ | CHMOD_WRITE : $chmod; + + // We need to trust the admin in specifying valid upload directories and an attacker not being able to overwrite it... + $this->destination_path = $this->phpbb_root_path . $destination; + + // Check if the destination path exist... + if (!file_exists($this->destination_path)) + { + @unlink($this->filename); + return false; + } + + $upload_mode = ($this->php_ini->getBool('open_basedir')) ? 'move' : 'copy'; + $upload_mode = ($this->local) ? 'local' : $upload_mode; + $this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname); + + // Check if the file already exist, else there is something wrong... + if (file_exists($this->destination_file) && !$overwrite) + { + @unlink($this->filename); + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + $this->file_moved = false; + return false; + } + else + { + if (file_exists($this->destination_file)) + { + @unlink($this->destination_file); + } + + switch ($upload_mode) + { + case 'copy': + + if (!@copy($this->filename, $this->destination_file)) + { + if (!@move_uploaded_file($this->filename, $this->destination_file)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + } + } + + break; + + case 'move': + + if (!@move_uploaded_file($this->filename, $this->destination_file)) + { + if (!@copy($this->filename, $this->destination_file)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + } + } + + break; + + case 'local': + + if (!@copy($this->filename, $this->destination_file)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + } + + break; + } + + // Remove temporary filename + @unlink($this->filename); + + if (count($this->error)) + { + return false; + } + + try + { + $this->filesystem->phpbb_chmod($this->destination_file, $chmod); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + + // Try to get real filesize from destination folder + $this->filesize = ($this->get_filesize($this->destination_file)) ?: $this->filesize; + + // Get mimetype of supplied file + $this->mimetype = $this->get_mimetype($this->destination_file); + + if ($this->is_image() && !$skip_image_check) + { + $this->width = $this->height = 0; + + $this->image_info = $this->imagesize->getImageSize($this->destination_file, $this->mimetype); + + if ($this->image_info !== false) + { + $this->width = $this->image_info['width']; + $this->height = $this->image_info['height']; + + // Check image type + $types = upload::image_types(); + + if (!isset($types[$this->image_info['type']]) || !in_array($this->extension, $types[$this->image_info['type']])) + { + if (!isset($types[$this->image_info['type']])) + { + $this->error[] = $this->language->lang('IMAGE_FILETYPE_INVALID', $this->image_info['type'], $this->mimetype); + } + else + { + $this->error[] = $this->language->lang('IMAGE_FILETYPE_MISMATCH', $types[$this->image_info['type']][0], $this->extension); + } + } + + // Make sure the dimensions match a valid image + if (empty($this->width) || empty($this->height)) + { + $this->error[] = $this->language->lang('ATTACHED_IMAGE_NOT_IMAGE'); + } + } + else + { + $this->error[] = $this->language->lang('UNABLE_GET_IMAGE_SIZE'); + } + } + + $this->file_moved = true; + $this->additional_checks(); + unset($this->upload); + + return true; + } + + /** + * Performing additional checks + * + * @return bool False if issue was found, true if not + */ + public function additional_checks() + { + if (!$this->file_moved) + { + return false; + } + + // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form + if ($this->upload->max_filesize && ($this->get('filesize') > $this->upload->max_filesize || $this->filesize == 0)) + { + $max_filesize = get_formatted_filesize($this->upload->max_filesize, false); + + $this->error[] = $this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit']); + + return false; + } + + if (!$this->upload->valid_dimensions($this)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'WRONG_SIZE', + $this->language->lang('PIXELS', (int) $this->upload->min_width), + $this->language->lang('PIXELS', (int) $this->upload->min_height), + $this->language->lang('PIXELS', (int) $this->upload->max_width), + $this->language->lang('PIXELS', (int) $this->upload->max_height), + $this->language->lang('PIXELS', (int) $this->width), + $this->language->lang('PIXELS', (int) $this->height)); + + return false; + } + + return true; + } +} diff --git a/install/update/new/phpbb/filesystem.php b/install/update/new/phpbb/filesystem.php new file mode 100644 index 0000000..6ac9459 --- /dev/null +++ b/install/update/new/phpbb/filesystem.php @@ -0,0 +1,21 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** + * @deprecated 3.2.0-dev (To be removed 4.0.0) use \phpbb\filesystem\filesystem instead + */ +class filesystem extends \phpbb\filesystem\filesystem +{ +} diff --git a/install/update/new/phpbb/filesystem/filesystem.php b/install/update/new/phpbb/filesystem/filesystem.php new file mode 100644 index 0000000..9acead0 --- /dev/null +++ b/install/update/new/phpbb/filesystem/filesystem.php @@ -0,0 +1,916 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\filesystem; + +use phpbb\filesystem\exception\filesystem_exception; + +/** + * A class with various functions that are related to paths, files and the filesystem + */ +class filesystem implements filesystem_interface +{ + /** + * Store some information about file ownership for phpBB's chmod function + * + * @var array + */ + protected $chmod_info; + + /** + * Stores current working directory + * + * @var string|bool current working directory or false if it cannot be recovered + */ + protected $working_directory; + + /** + * Symfony's Filesystem component + * + * @var \Symfony\Component\Filesystem\Filesystem + */ + protected $symfony_filesystem; + + /** + * Constructor + */ + public function __construct() + { + $this->chmod_info = array(); + $this->symfony_filesystem = new \Symfony\Component\Filesystem\Filesystem(); + $this->working_directory = null; + } + + /** + * {@inheritdoc} + */ + public function chgrp($files, $group, $recursive = false) + { + try + { + $this->symfony_filesystem->chgrp($files, $group, $recursive); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('FILESYSTEM_CANNOT_CHANGE_FILE_GROUP', $file, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function chmod($files, $perms = null, $recursive = false, $force_chmod_link = false) + { + if (is_null($perms)) + { + // Default to read permission for compatibility reasons + $perms = self::CHMOD_READ; + } + + // Check if we got a permission flag + if ($perms > self::CHMOD_ALL) + { + $file_perm = $perms; + + // Extract permissions + //$owner = ($file_perm >> 6) & 7; // This will be ignored + $group = ($file_perm >> 3) & 7; + $other = ($file_perm >> 0) & 7; + + // Does any permissions provided? if so we add execute bit for directories + $group = ($group !== 0) ? ($group | self::CHMOD_EXECUTE) : $group; + $other = ($other !== 0) ? ($other | self::CHMOD_EXECUTE) : $other; + + // Compute directory permissions + $dir_perm = (self::CHMOD_ALL << 6) + ($group << 3) + ($other << 3); + } + else + { + // Add execute bit to owner if execute bit is among perms + $owner_perm = (self::CHMOD_READ | self::CHMOD_WRITE) | ($perms & self::CHMOD_EXECUTE); + $file_perm = ($owner_perm << 6) + ($perms << 3) + ($perms << 0); + + // Compute directory permissions + $perm = ($perms !== 0) ? ($perms | self::CHMOD_EXECUTE) : $perms; + $dir_perm = (($owner_perm | self::CHMOD_EXECUTE) << 6) + ($perm << 3) + ($perm << 0); + } + + // Symfony's filesystem component does not support extra execution flags on directories + // so we need to implement it again + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + $this->chmod(new \FilesystemIterator($file), $perms, true); + } + + // Don't chmod links as mostly those require 0777 and that cannot be changed + if (is_dir($file) || (is_link($file) && $force_chmod_link)) + { + if (true !== @chmod($file, $dir_perm)) + { + throw new filesystem_exception('FILESYSTEM_CANNOT_CHANGE_FILE_PERMISSIONS', $file, array()); + } + } + else if (is_file($file)) + { + if (true !== @chmod($file, $file_perm)) + { + throw new filesystem_exception('FILESYSTEM_CANNOT_CHANGE_FILE_PERMISSIONS', $file, array()); + } + } + } + } + + /** + * {@inheritdoc} + */ + public function chown($files, $user, $recursive = false) + { + try + { + $this->symfony_filesystem->chown($files, $user, $recursive); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('FILESYSTEM_CANNOT_CHANGE_FILE_GROUP', $file, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function clean_path($path) + { + $exploded = explode('/', $path); + $filtered = array(); + foreach ($exploded as $part) + { + if ($part === '.' && !empty($filtered)) + { + continue; + } + + if ($part === '..' && !empty($filtered) && $filtered[count($filtered) - 1] !== '.' && $filtered[count($filtered) - 1] !== '..') + { + array_pop($filtered); + } + else + { + $filtered[] = $part; + } + } + $path = implode('/', $filtered); + return $path; + } + + /** + * {@inheritdoc} + */ + public function copy($origin_file, $target_file, $override = false) + { + try + { + $this->symfony_filesystem->copy($origin_file, $target_file, $override); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + throw new filesystem_exception('FILESYSTEM_CANNOT_COPY_FILES', '', array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function dump_file($filename, $content) + { + try + { + $this->symfony_filesystem->dumpFile($filename, $content); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + throw new filesystem_exception('FILESYSTEM_CANNOT_DUMP_FILE', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function exists($files) + { + return $this->symfony_filesystem->exists($files); + } + + /** + * {@inheritdoc} + */ + public function is_absolute_path($path) + { + return (isset($path[0]) && $path[0] === '/' || preg_match('#^[a-z]:[/\\\]#i', $path)) ? true : false; + } + + /** + * {@inheritdoc} + */ + public function is_readable($files, $recursive = false) + { + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + if (!$this->is_readable(new \FilesystemIterator($file), true)) + { + return false; + } + } + + if (!is_readable($file)) + { + return false; + } + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function is_writable($files, $recursive = false) + { + if (defined('PHP_WINDOWS_VERSION_MAJOR') || !function_exists('is_writable')) + { + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + if (!$this->is_writable(new \FilesystemIterator($file), true)) + { + return false; + } + } + + if (!$this->phpbb_is_writable($file)) + { + return false; + } + } + } + else + { + // use built in is_writable + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + if (!$this->is_writable(new \FilesystemIterator($file), true)) + { + return false; + } + } + + if (!is_writable($file)) + { + return false; + } + } + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function make_path_relative($end_path, $start_path) + { + return $this->symfony_filesystem->makePathRelative($end_path, $start_path); + } + + /** + * {@inheritdoc} + */ + public function mirror($origin_dir, $target_dir, \Traversable $iterator = null, $options = array()) + { + try + { + $this->symfony_filesystem->mirror($origin_dir, $target_dir, $iterator, $options); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + $msg = $e->getMessage(); + $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); + + throw new filesystem_exception('FILESYSTEM_CANNOT_MIRROR_DIRECTORY', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function mkdir($dirs, $mode = 0777) + { + try + { + $this->symfony_filesystem->mkdir($dirs, $mode); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + $msg = $e->getMessage(); + $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); + + throw new filesystem_exception('FILESYSTEM_CANNOT_CREATE_DIRECTORY', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function phpbb_chmod($files, $perms = null, $recursive = false, $force_chmod_link = false) + { + if (is_null($perms)) + { + // Default to read permission for compatibility reasons + $perms = self::CHMOD_READ; + } + + if (empty($this->chmod_info)) + { + if (!function_exists('fileowner') || !function_exists('filegroup')) + { + $this->chmod_info['process'] = false; + } + else + { + $common_php_owner = @fileowner(__FILE__); + $common_php_group = @filegroup(__FILE__); + + // And the owner and the groups PHP is running under. + $php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false; + $php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false; + + // If we are unable to get owner/group, then do not try to set them by guessing + if (!$php_uid || empty($php_gids) || !$common_php_owner || !$common_php_group) + { + $this->chmod_info['process'] = false; + } + else + { + $this->chmod_info = array( + 'process' => true, + 'common_owner' => $common_php_owner, + 'common_group' => $common_php_group, + 'php_uid' => $php_uid, + 'php_gids' => $php_gids, + ); + } + } + } + + if ($this->chmod_info['process']) + { + try + { + foreach ($this->to_iterator($files) as $file) + { + $file_uid = @fileowner($file); + $file_gid = @filegroup($file); + + // Change owner + if ($file_uid !== $this->chmod_info['common_owner']) + { + $this->chown($file, $this->chmod_info['common_owner'], $recursive); + } + + // Change group + if ($file_gid !== $this->chmod_info['common_group']) + { + $this->chgrp($file, $this->chmod_info['common_group'], $recursive); + } + + clearstatcache(); + $file_uid = @fileowner($file); + $file_gid = @filegroup($file); + } + } + catch (filesystem_exception $e) + { + $this->chmod_info['process'] = false; + } + } + + // Still able to process? + if ($this->chmod_info['process']) + { + if ($file_uid === $this->chmod_info['php_uid']) + { + $php = 'owner'; + } + else if (in_array($file_gid, $this->chmod_info['php_gids'])) + { + $php = 'group'; + } + else + { + // Since we are setting the everyone bit anyway, no need to do expensive operations + $this->chmod_info['process'] = false; + } + } + + // We are not able to determine or change something + if (!$this->chmod_info['process']) + { + $php = 'other'; + } + + switch ($php) + { + case 'owner': + try + { + $this->chmod($files, $perms, $recursive, $force_chmod_link); + clearstatcache(); + if ($this->is_readable($files) && $this->is_writable($files)) + { + break; + } + } + catch (filesystem_exception $e) + { + // Do nothing + } + case 'group': + try + { + $this->chmod($files, $perms, $recursive, $force_chmod_link); + clearstatcache(); + if ((!($perms & self::CHMOD_READ) || $this->is_readable($files, $recursive)) && (!($perms & self::CHMOD_WRITE) || $this->is_writable($files, $recursive))) + { + break; + } + } + catch (filesystem_exception $e) + { + // Do nothing + } + case 'other': + default: + $this->chmod($files, $perms, $recursive, $force_chmod_link); + break; + } + } + + /** + * {@inheritdoc} + */ + public function realpath($path) + { + if (!function_exists('realpath')) + { + return $this->phpbb_own_realpath($path); + } + + $realpath = realpath($path); + + // Strangely there are provider not disabling realpath but returning strange values. :o + // We at least try to cope with them. + if ((!$this->is_absolute_path($path) && $realpath === $path) || $realpath === false) + { + return $this->phpbb_own_realpath($path); + } + + // Check for DIRECTORY_SEPARATOR at the end (and remove it!) + if (substr($realpath, -1) === DIRECTORY_SEPARATOR) + { + $realpath = substr($realpath, 0, -1); + } + + return $realpath; + } + + /** + * {@inheritdoc} + */ + public function remove($files) + { + try + { + $this->symfony_filesystem->remove($files); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('FILESYSTEM_CANNOT_DELETE_FILES', $file, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function rename($origin, $target, $overwrite = false) + { + try + { + $this->symfony_filesystem->rename($origin, $target, $overwrite); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + $msg = $e->getMessage(); + $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); + + throw new filesystem_exception('FILESYSTEM_CANNOT_RENAME_FILE', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function symlink($origin_dir, $target_dir, $copy_on_windows = false) + { + try + { + $this->symfony_filesystem->symlink($origin_dir, $target_dir, $copy_on_windows); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + throw new filesystem_exception('FILESYSTEM_CANNOT_CREATE_SYMLINK', $origin_dir, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function touch($files, $time = null, $access_time = null) + { + try + { + $this->symfony_filesystem->touch($files, $time, $access_time); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('FILESYSTEM_CANNOT_TOUCH_FILES', $file, array(), $e); + } + } + + /** + * phpBB's implementation of is_writable + * + * @todo Investigate if is_writable is still buggy + * + * @param string $file file/directory to check if writable + * + * @return bool true if the given path is writable + */ + protected function phpbb_is_writable($file) + { + if (file_exists($file)) + { + // Canonicalise path to absolute path + $file = $this->realpath($file); + + if (is_dir($file)) + { + // Test directory by creating a file inside the directory + $result = @tempnam($file, 'i_w'); + + if (is_string($result) && file_exists($result)) + { + unlink($result); + + // Ensure the file is actually in the directory (returned realpathed) + return (strpos($result, $file) === 0) ? true : false; + } + } + else + { + $handle = @fopen($file, 'c'); + + if (is_resource($handle)) + { + fclose($handle); + return true; + } + } + } + else + { + // file does not exist test if we can write to the directory + $dir = dirname($file); + + if (file_exists($dir) && is_dir($dir) && $this->phpbb_is_writable($dir)) + { + return true; + } + } + + return false; + } + + /** + * Try to resolve real path when PHP's realpath failes to do so + * + * @param string $path + * @return bool|string + */ + protected function phpbb_own_realpath($path) + { + // Replace all directory separators with '/' + $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); + + $is_absolute_path = false; + $path_prefix = ''; + + if ($this->is_absolute_path($path)) + { + $is_absolute_path = true; + } + else + { + // Resolve working directory and store it + if (is_null($this->working_directory)) + { + if (function_exists('getcwd')) + { + $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', getcwd()); + } + + // + // From this point on we really just guessing + // If chdir were called we screwed + // + else if (function_exists('debug_backtrace')) + { + $call_stack = debug_backtrace(0); + $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[count($call_stack) - 1]['file'])); + } + else + { + // + // Assuming that the working directory is phpBB root + // we could use this as a fallback, when phpBB will use controllers + // everywhere this will be a safe assumption + // + //$dir_parts = explode(DIRECTORY_SEPARATOR, __DIR__); + //$namespace_parts = explode('\\', trim(__NAMESPACE__, '\\')); + + //$namespace_part_count = count($namespace_parts); + + // Check if we still loading from root + //if (array_slice($dir_parts, -$namespace_part_count) === $namespace_parts) + //{ + // $this->working_directory = implode('/', array_slice($dir_parts, 0, -$namespace_part_count)); + //} + //else + //{ + // $this->working_directory = false; + //} + + $this->working_directory = false; + } + } + + if ($this->working_directory !== false) + { + $is_absolute_path = true; + $path = $this->working_directory . '/' . $path; + } + } + + if ($is_absolute_path) + { + if (defined('PHP_WINDOWS_VERSION_MAJOR')) + { + $path_prefix = $path[0] . ':'; + $path = substr($path, 2); + } + else + { + $path_prefix = ''; + } + } + + $resolved_path = $this->resolve_path($path, $path_prefix, $is_absolute_path); + if ($resolved_path === false) + { + return false; + } + + if (!@file_exists($resolved_path) || (!@is_dir($resolved_path . '/') && !is_file($resolved_path))) + { + return false; + } + + // Return OS specific directory separators + $resolved = str_replace('/', DIRECTORY_SEPARATOR, $resolved_path); + + // Check for DIRECTORY_SEPARATOR at the end (and remove it!) + if (substr($resolved, -1) === DIRECTORY_SEPARATOR) + { + return substr($resolved, 0, -1); + } + + return $resolved; + } + + /** + * Convert file(s) to \Traversable object + * + * This is the same function as Symfony's toIterator, but that is private + * so we cannot use it. + * + * @param string|array|\Traversable $files filename/list of filenames + * @return \Traversable + */ + protected function to_iterator($files) + { + if (!$files instanceof \Traversable) + { + $files = new \ArrayObject(is_array($files) ? $files : array($files)); + } + + return $files; + } + + /** + * Try to resolve symlinks in path + * + * @param string $path The path to resolve + * @param string $prefix The path prefix (on windows the drive letter) + * @param bool $absolute Whether or not the path is absolute + * @param bool $return_array Whether or not to return path parts + * + * @return string|array|bool returns the resolved path or an array of parts of the path if $return_array is true + * or false if path cannot be resolved + */ + protected function resolve_path($path, $prefix = '', $absolute = false, $return_array = false) + { + if ($return_array) + { + $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); + } + + trim ($path, '/'); + $path_parts = explode('/', $path); + $resolved = array(); + $resolved_path = $prefix; + $file_found = false; + + foreach ($path_parts as $path_part) + { + if ($file_found) + { + return false; + } + + if (empty($path_part) || ($path_part === '.' && ($absolute || !empty($resolved)))) + { + continue; + } + else if ($absolute && $path_part === '..') + { + if (empty($resolved)) + { + // No directories above root + return false; + } + + array_pop($resolved); + $resolved_path = false; + } + else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[count($resolved) - 1], array('.', '..'))) + { + array_pop($resolved); + $resolved_path = false; + } + else + { + if ($resolved_path === false) + { + if (empty($resolved)) + { + $resolved_path = ($absolute) ? $prefix . '/' . $path_part : $path_part; + } + else + { + $tmp_array = $resolved; + if ($absolute) + { + array_unshift($tmp_array, $prefix); + } + + $resolved_path = implode('/', $tmp_array); + } + } + + $current_path = $resolved_path . '/' . $path_part; + + // Resolve symlinks + if (@is_link($current_path)) + { + if (!function_exists('readlink')) + { + return false; + } + + $link = readlink($current_path); + + // Is link has an absolute path in it? + if ($this->is_absolute_path($link)) + { + if (defined('PHP_WINDOWS_VERSION_MAJOR')) + { + $prefix = $link[0] . ':'; + $link = substr($link, 2); + } + else + { + $prefix = ''; + } + + $resolved = $this->resolve_path($link, $prefix, true, true); + $absolute = true; + } + else + { + $resolved = $this->resolve_path($resolved_path . '/' . $link, $prefix, $absolute, true); + } + + if (!$resolved) + { + return false; + } + + $resolved_path = false; + } + else if (@is_dir($current_path . '/')) + { + $resolved[] = $path_part; + $resolved_path = $current_path; + } + else if (@is_file($current_path)) + { + $resolved[] = $path_part; + $resolved_path = $current_path; + $file_found = true; + } + else + { + return false; + } + } + } + + // If at the end of the path there were a .. or . + // we need to build the path again. + // Only doing this when a string is expected in return + if ($resolved_path === false && $return_array === false) + { + if (empty($resolved)) + { + $resolved_path = ($absolute) ? $prefix . '/' : './'; + } + else + { + $tmp_array = $resolved; + if ($absolute) + { + array_unshift($tmp_array, $prefix); + } + + $resolved_path = implode('/', $tmp_array); + } + } + + return ($return_array) ? $resolved : $resolved_path; + } +} diff --git a/install/update/new/phpbb/filesystem/filesystem_interface.php b/install/update/new/phpbb/filesystem/filesystem_interface.php new file mode 100644 index 0000000..39ae0c3 --- /dev/null +++ b/install/update/new/phpbb/filesystem/filesystem_interface.php @@ -0,0 +1,284 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\filesystem; + +/** + * Interface for phpBB's filesystem service + */ +interface filesystem_interface +{ + /** + * chmod all permissions flag + * + * @var int + */ + const CHMOD_ALL = 7; + + /** + * chmod read permissions flag + * + * @var int + */ + const CHMOD_READ = 4; + + /** + * chmod write permissions flag + * + * @var int + */ + const CHMOD_WRITE = 2; + + /** + * chmod execute permissions flag + * + * @var int + */ + const CHMOD_EXECUTE = 1; + + /** + * Change owner group of files/directories + * + * @param string|array|\Traversable $files The file(s)/directorie(s) to change group + * @param string $group The group that should own the files/directories + * @param bool $recursive If the group should be changed recursively + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function chgrp($files, $group, $recursive = false); + + /** + * Global function for chmodding directories and files for internal use + * + * The function accepts filesystem_interface::CHMOD_ flags in the permission argument + * or the user can specify octal values (or any integer if it makes sense). All directories will have + * an execution bit appended, if the user group (owner, group or other) has any bit specified. + * + * @param string|array|\Traversable $files The file/directory to be chmodded + * @param int $perms Permissions to set + * @param bool $recursive If the permissions should be changed recursively + * @param bool $force_chmod_link Try to apply permissions to symlinks as well + * + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function chmod($files, $perms = null, $recursive = false, $force_chmod_link = false); + + /** + * Change owner group of files/directories + * + * @param string|array|\Traversable $files The file(s)/directorie(s) to change group + * @param string $user The owner user name + * @param bool $recursive Whether change the owner recursively or not + * + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function chown($files, $user, $recursive = false); + + /** + * Eliminates useless . and .. components from specified path. + * + * @param string $path Path to clean + * + * @return string Cleaned path + */ + public function clean_path($path); + + /** + * Copies a file. + * + * This method only copies the file if the origin file is newer than the target file. + * + * By default, if the target already exists, it is not overridden. + * + * @param string $origin_file The original filename + * @param string $target_file The target filename + * @param bool $override Whether to override an existing file or not + * + * @throws \phpbb\filesystem\exception\filesystem_exception When the file cannot be copied + */ + public function copy($origin_file, $target_file, $override = false); + + /** + * Atomically dumps content into a file. + * + * @param string $filename The file to be written to. + * @param string $content The data to write into the file. + * + * @throws \phpbb\filesystem\exception\filesystem_exception When the file cannot be written + */ + public function dump_file($filename, $content); + + /** + * Checks the existence of files or directories. + * + * @param string|array|\Traversable $files files/directories to check + * + * @return bool Returns true if all files/directories exist, false otherwise + */ + public function exists($files); + + /** + * Checks if a path is absolute or not + * + * @param string $path Path to check + * + * @return bool true if the path is absolute, false otherwise + */ + public function is_absolute_path($path); + + /** + * Checks if files/directories are readable + * + * @param string|array|\Traversable $files files/directories to check + * @param bool $recursive Whether or not directories should be checked recursively + * + * @return bool True when the files/directories are readable, otherwise false. + */ + public function is_readable($files, $recursive = false); + + /** + * Test if a file/directory is writable + * + * @param string|array|\Traversable $files files/directories to perform write test on + * @param bool $recursive Whether or not directories should be checked recursively + * + * @return bool True when the files/directories are writable, otherwise false. + */ + public function is_writable($files, $recursive = false); + + /** + * Given an existing path, convert it to a path relative to a given starting path + * + * @param string $end_path Absolute path of target + * @param string $start_path Absolute path where traversal begins + * + * @return string Path of target relative to starting path + */ + public function make_path_relative($end_path, $start_path); + + /** + * Mirrors a directory to another. + * + * @param string $origin_dir The origin directory + * @param string $target_dir The target directory + * @param \Traversable $iterator A Traversable instance + * @param array $options An array of boolean options + * Valid options are: + * - $options['override'] Whether to override an existing file on copy or not (see copy()) + * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink()) + * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false) + * + * @throws \phpbb\filesystem\exception\filesystem_exception When the file cannot be copied. + * The filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function mirror($origin_dir, $target_dir, \Traversable $iterator = null, $options = array()); + + /** + * Creates a directory recursively. + * + * @param string|array|\Traversable $dirs The directory path + * @param int $mode The directory mode + * + * @throws \phpbb\filesystem\exception\filesystem_exception On any directory creation failure + * The filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function mkdir($dirs, $mode = 0777); + + /** + * Global function for chmodding directories and files for internal use + * + * This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions. + * The function determines owner and group from common.php file and sets the same to the provided file. + * The function uses bit fields to build the permissions. + * The function sets the appropriate execute bit on directories. + * + * Supported constants representing bit fields are: + * + * filesystem_interface::CHMOD_ALL - all permissions (7) + * filesystem_interface::CHMOD_READ - read permission (4) + * filesystem_interface::CHMOD_WRITE - write permission (2) + * filesystem_interface::CHMOD_EXECUTE - execute permission (1) + * + * NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions. + * + * @param string|array|\Traversable $file The file/directory to be chmodded + * @param int $perms Permissions to set + * @param bool $recursive If the permissions should be changed recursively + * @param bool $force_chmod_link Try to apply permissions to symlinks as well + * + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function phpbb_chmod($file, $perms = null, $recursive = false, $force_chmod_link = false); + + /** + * A wrapper for PHP's realpath + * + * Try to resolve realpath when PHP's realpath is not available, or + * known to be buggy. + * + * @param string $path Path to resolve + * + * @return string Resolved path + */ + public function realpath($path); + + /** + * Removes files or directories. + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to remove + * + * @throws \phpbb\filesystem\exception\filesystem_exception When removal fails. + * The filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function remove($files); + + /** + * Renames a file or a directory. + * + * @param string $origin The origin filename or directory + * @param string $target The new filename or directory + * @param bool $overwrite Whether to overwrite the target if it already exists + * + * @throws \phpbb\filesystem\exception\filesystem_exception When target file or directory already exists, + * or origin cannot be renamed. + */ + public function rename($origin, $target, $overwrite = false); + + /** + * Creates a symbolic link or copy a directory. + * + * @param string $origin_dir The origin directory path + * @param string $target_dir The symbolic link name + * @param bool $copy_on_windows Whether to copy files if on Windows + * + * @throws \phpbb\filesystem\exception\filesystem_exception When symlink fails + */ + public function symlink($origin_dir, $target_dir, $copy_on_windows = false); + + /** + * Sets access and modification time of file. + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to create + * @param int $time The touch time as a Unix timestamp + * @param int $access_time The access time as a Unix timestamp + * + * @throws \phpbb\filesystem\exception\filesystem_exception When touch fails + */ + public function touch($files, $time = null, $access_time = null); +} diff --git a/install/update/new/phpbb/finder.php b/install/update/new/phpbb/finder.php new file mode 100644 index 0000000..0a2b67a --- /dev/null +++ b/install/update/new/phpbb/finder.php @@ -0,0 +1,547 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* The finder provides a simple way to locate files in the core and a set of extensions +*/ +class finder +{ + protected $extensions; + protected $filesystem; + protected $phpbb_root_path; + protected $cache; + protected $php_ext; + + /** + * The cache variable name used to store $this->cached_queries in $this->cache. + * + * Allows the use of multiple differently configured finders with the same cache. + * @var string + */ + protected $cache_name; + + /** + * An associative array, containing all search parameters set in methods. + * @var array + */ + protected $query; + + /** + * A map from md5 hashes of serialized queries to their previously retrieved + * results. + * @var array + */ + protected $cached_queries; + + /** + * Creates a new finder instance with its dependencies + * + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem instance + * @param string $phpbb_root_path Path to the phpbb root directory + * @param \phpbb\cache\service $cache A cache instance or null + * @param string $php_ext php file extension + * @param string $cache_name The name of the cache variable, defaults to + * _ext_finder + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path = '', \phpbb\cache\service $cache = null, $php_ext = 'php', $cache_name = '_ext_finder') + { + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + $this->cache = $cache; + $this->php_ext = $php_ext; + $this->cache_name = $cache_name; + + $this->query = array( + 'core_path' => false, + 'core_suffix' => false, + 'core_prefix' => false, + 'core_directory' => false, + 'extension_suffix' => false, + 'extension_prefix' => false, + 'extension_directory' => false, + ); + $this->extensions = array(); + + $this->cached_queries = ($this->cache) ? $this->cache->get($this->cache_name) : false; + } + + /** + * Set the array of extensions + * + * @param array $extensions A list of extensions that should be searched as well + * @param bool $replace_list Should the list be emptied before adding the extensions + * @return \phpbb\finder This object for chaining calls + */ + public function set_extensions(array $extensions, $replace_list = true) + { + if ($replace_list) + { + $this->extensions = array(); + } + + foreach ($extensions as $ext_name) + { + $this->extensions[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/'; + } + return $this; + } + + /** + * Sets a core path to be searched in addition to extensions + * + * @param string $core_path The path relative to phpbb_root_path + * @return \phpbb\finder This object for chaining calls + */ + public function core_path($core_path) + { + $this->query['core_path'] = $core_path; + return $this; + } + + /** + * Sets the suffix all files found in extensions and core must match. + * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * + * @param string $suffix A filename suffix + * @return \phpbb\finder This object for chaining calls + */ + public function suffix($suffix) + { + $this->core_suffix($suffix); + $this->extension_suffix($suffix); + return $this; + } + + /** + * Sets a suffix all files found in extensions must match + * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * + * @param string $extension_suffix A filename suffix + * @return \phpbb\finder This object for chaining calls + */ + public function extension_suffix($extension_suffix) + { + $this->query['extension_suffix'] = $extension_suffix; + return $this; + } + + /** + * Sets a suffix all files found in the core path must match + * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * + * @param string $core_suffix A filename suffix + * @return \phpbb\finder This object for chaining calls + */ + public function core_suffix($core_suffix) + { + $this->query['core_suffix'] = $core_suffix; + return $this; + } + + /** + * Sets the prefix all files found in extensions and core must match + * + * @param string $prefix A filename prefix + * @return \phpbb\finder This object for chaining calls + */ + public function prefix($prefix) + { + $this->core_prefix($prefix); + $this->extension_prefix($prefix); + return $this; + } + + /** + * Sets a prefix all files found in extensions must match + * + * @param string $extension_prefix A filename prefix + * @return \phpbb\finder This object for chaining calls + */ + public function extension_prefix($extension_prefix) + { + $this->query['extension_prefix'] = $extension_prefix; + return $this; + } + + /** + * Sets a prefix all files found in the core path must match + * + * @param string $core_prefix A filename prefix + * @return \phpbb\finder This object for chaining calls + */ + public function core_prefix($core_prefix) + { + $this->query['core_prefix'] = $core_prefix; + return $this; + } + + /** + * Sets a directory all files found in extensions and core must be contained in + * + * Automatically sets the core_directory if its value does not differ from + * the current directory. + * + * @param string $directory + * @return \phpbb\finder This object for chaining calls + */ + public function directory($directory) + { + $this->core_directory($directory); + $this->extension_directory($directory); + return $this; + } + + /** + * Sets a directory all files found in extensions must be contained in + * + * @param string $extension_directory + * @return \phpbb\finder This object for chaining calls + */ + public function extension_directory($extension_directory) + { + $this->query['extension_directory'] = $this->sanitise_directory($extension_directory); + return $this; + } + + /** + * Sets a directory all files found in the core path must be contained in + * + * @param string $core_directory + * @return \phpbb\finder This object for chaining calls + */ + public function core_directory($core_directory) + { + $this->query['core_directory'] = $this->sanitise_directory($core_directory); + return $this; + } + + /** + * Removes occurrences of /./ and makes sure path ends without trailing slash + * + * @param string $directory A directory pattern + * @return string A cleaned up directory pattern + */ + protected function sanitise_directory($directory) + { + $directory = $this->filesystem->clean_path($directory); + $dir_len = strlen($directory); + + if ($dir_len > 1 && $directory[$dir_len - 1] === '/') + { + $directory = substr($directory, 0, -1); + } + + return $directory; + } + + /** + * Finds classes matching the configured options if they follow phpBB naming rules. + * + * The php file extension is automatically added to suffixes. + * + * Note: If a file is matched but contains a class name not following the + * phpBB naming rules an incorrect class name will be returned. + * + * @param bool $cache Whether the result should be cached + * @return array An array of found class names + */ + public function get_classes($cache = true) + { + $this->query['extension_suffix'] .= '.' . $this->php_ext; + $this->query['core_suffix'] .= '.' . $this->php_ext; + + $files = $this->find($cache, false); + + return $this->get_classes_from_files($files); + } + + /** + * Get class names from a list of files + * + * @param array $files Array of files (from find()) + * @return array Array of class names + */ + public function get_classes_from_files($files) + { + $classes = array(); + foreach ($files as $file => $ext_name) + { + $class = substr($file, 0, -strlen('.' . $this->php_ext)); + if ($ext_name === '/' && preg_match('#^includes/#', $file)) + { + $class = preg_replace('#^includes/#', '', $class); + $classes[] = 'phpbb_' . str_replace('/', '_', $class); + } + else + { + $class = preg_replace('#^ext/#', '', $class); + $classes[] = '\\' . str_replace('/', '\\', $class); + } + } + return $classes; + } + + /** + * Finds all directories matching the configured options + * + * @param bool $cache Whether the result should be cached + * @param bool $extension_keys Whether the result should have extension name as array key + * @return array An array of paths to found directories + */ + public function get_directories($cache = true, $extension_keys = false) + { + return $this->find_with_root_path($cache, true, $extension_keys); + } + + /** + * Finds all files matching the configured options. + * + * @param bool $cache Whether the result should be cached + * @return array An array of paths to found files + */ + public function get_files($cache = true) + { + return $this->find_with_root_path($cache, false); + } + + /** + * A wrapper around the general find which prepends a root path to results + * + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @param bool $extension_keys If true, result will be associative array + * with extension name as key + * @return array An array of paths to found items + */ + protected function find_with_root_path($cache = true, $is_dir = false, $extension_keys = false) + { + $items = $this->find($cache, $is_dir); + + $result = array(); + foreach ($items as $item => $ext_name) + { + if ($extension_keys) + { + $result[$ext_name] = $this->phpbb_root_path . $item; + } + else + { + $result[] = $this->phpbb_root_path . $item; + } + } + + return $result; + } + + /** + * Finds all file system entries matching the configured options + * + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @return array An array of paths to found items + */ + public function find($cache = true, $is_dir = false) + { + $extensions = $this->extensions; + if ($this->query['core_path']) + { + $extensions['/'] = $this->phpbb_root_path . $this->query['core_path']; + } + + $files = array(); + $file_list = $this->find_from_paths($extensions, $cache, $is_dir); + + foreach ($file_list as $file) + { + $files[$file['named_path']] = $file['ext_name']; + } + + return $files; + } + + /** + * Finds all file system entries matching the configured options for one + * specific extension + * + * @param string $extension_name Name of the extension + * @param string $extension_path Relative path to the extension root directory + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @return array An array of paths to found items + */ + public function find_from_extension($extension_name, $extension_path, $cache = true, $is_dir = false) + { + $extensions = array( + $extension_name => $extension_path, + ); + + $files = array(); + $file_list = $this->find_from_paths($extensions, $cache, $is_dir); + + foreach ($file_list as $file) + { + $files[$file['named_path']] = $file['ext_name']; + } + + return $files; + } + + /** + * Finds all file system entries matching the configured options from + * an array of paths + * + * @param array $extensions Array of extensions (name => full relative path) + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @return array An array of paths to found items + */ + public function find_from_paths($extensions, $cache = true, $is_dir = false) + { + $this->query['is_dir'] = $is_dir; + $query = md5(serialize($this->query) . serialize($extensions)); + + if (!defined('DEBUG') && $cache && isset($this->cached_queries[$query])) + { + return $this->cached_queries[$query]; + } + + $files = array(); + + foreach ($extensions as $name => $path) + { + $ext_name = $name; + + if (!file_exists($path)) + { + continue; + } + + if ($name === '/') + { + $location = $this->query['core_path']; + $name = ''; + $suffix = $this->query['core_suffix']; + $prefix = $this->query['core_prefix']; + $directory = $this->query['core_directory']; + } + else + { + $location = 'ext/'; + $name .= '/'; + $suffix = $this->query['extension_suffix']; + $prefix = $this->query['extension_prefix']; + $directory = $this->query['extension_directory']; + } + + // match only first directory if leading slash is given + if ($directory === '/') + { + $directory_pattern = '^' . preg_quote(DIRECTORY_SEPARATOR, '#'); + } + else if ($directory && $directory[0] === '/') + { + if (!$is_dir) + { + $path .= substr($directory, 1); + } + $directory_pattern = '^' . preg_quote(str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); + } + else + { + $directory_pattern = preg_quote(DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); + } + if ($is_dir) + { + $directory_pattern .= '$'; + } + $directory_pattern = '#' . $directory_pattern . '#'; + + if (is_dir($path)) + { + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $path, + \FilesystemIterator::SKIP_DOTS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + + foreach ($iterator as $file_info) + { + $filename = $file_info->getFilename(); + + if ($file_info->isDir() == $is_dir) + { + if ($is_dir) + { + $relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($filename) . DIRECTORY_SEPARATOR; + if ($relative_path[0] !== DIRECTORY_SEPARATOR) + { + $relative_path = DIRECTORY_SEPARATOR . $relative_path; + } + } + else + { + $relative_path = $iterator->getInnerIterator()->getSubPathname(); + if ($directory && $directory[0] === '/') + { + $relative_path = str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR . $relative_path; + } + else + { + $relative_path = DIRECTORY_SEPARATOR . $relative_path; + } + } + + if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) && + (!$prefix || substr($filename, 0, strlen($prefix)) === $prefix) && + (!$directory || preg_match($directory_pattern, $relative_path))) + { + $files[] = array( + 'named_path' => str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . substr($relative_path, 1)), + 'ext_name' => $ext_name, + 'path' => str_replace(array(DIRECTORY_SEPARATOR, $this->phpbb_root_path), array('/', ''), $file_info->getPath()) . '/', + 'filename' => $filename, + ); + } + } + } + } + } + + if ($cache && $this->cache) + { + $this->cached_queries[$query] = $files; + $this->cache->put($this->cache_name, $this->cached_queries); + } + + return $files; + } +} diff --git a/install/update/new/phpbb/group/helper.php b/install/update/new/phpbb/group/helper.php new file mode 100644 index 0000000..aa3876b --- /dev/null +++ b/install/update/new/phpbb/group/helper.php @@ -0,0 +1,294 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\group; + +use phpbb\auth\auth; +use phpbb\cache\service as cache; +use phpbb\config\config; +use phpbb\language\language; +use phpbb\event\dispatcher_interface; +use phpbb\path_helper; +use phpbb\user; + +class helper +{ + /** @var auth */ + protected $auth; + + /** @var cache */ + protected $cache; + + /** @var config */ + protected $config; + + /** @var language */ + protected $language; + + /** @var dispatcher_interface */ + protected $dispatcher; + + /** @var path_helper */ + protected $path_helper; + + /** @var user */ + protected $user; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var array Return templates for a group name string */ + protected $name_strings; + + /** + * Constructor + * + * @param auth $auth Authentication object + * @param cache $cache Cache service object + * @param config $config Configuration object + * @param language $language Language object + * @param dispatcher_interface $dispatcher Event dispatcher object + * @param path_helper $path_helper Path helper object + * @param user $user User object + */ + public function __construct(auth $auth, cache $cache, config $config, language $language, dispatcher_interface $dispatcher, path_helper $path_helper, user $user) + { + $this->auth = $auth; + $this->cache = $cache; + $this->config = $config; + $this->language = $language; + $this->dispatcher = $dispatcher; + $this->path_helper = $path_helper; + $this->user = $user; + + $this->phpbb_root_path = $path_helper->get_phpbb_root_path(); + + /** @html Group name spans and links for usage in the template */ + $this->name_strings = array( + 'base_url' => "{$path_helper->get_phpbb_root_path()}memberlist.{$path_helper->get_php_ext()}?mode=group&g={GROUP_ID}", + 'tpl_noprofile' => '{GROUP_NAME}', + 'tpl_noprofile_colour' => '{GROUP_NAME}', + 'tpl_profile' => '{GROUP_NAME}', + 'tpl_profile_colour' => '{GROUP_NAME}', + ); + } + + /** + * @param $group_name string The stored group name + * + * @return string Group name or translated group name if it exists + */ + public function get_name($group_name) + { + return $this->language->is_set('G_' . utf8_strtoupper($group_name)) ? $this->language->lang('G_' . utf8_strtoupper($group_name)) : $group_name; + } + + /** + * Get group name details for placing into templates. + * + * @html Group name spans and links + * + * @param string $mode Profile (for getting an url to the profile), + * group_name (for obtaining the group name), + * colour (for obtaining the group colour), + * full (for obtaining a coloured group name link to the group's profile), + * no_profile (the same as full but forcing no profile link) + * @param int $group_id The group id + * @param string $group_name The group name + * @param string $group_colour The group colour + * @param mixed $custom_profile_url optional parameter to specify a profile url. The group id gets appended to this url as &g={group_id} + * + * @return string A string consisting of what is wanted based on $mode. + */ + public function get_name_string($mode, $group_id, $group_name, $group_colour = '', $custom_profile_url = false) + { + $s_is_bots = ($group_name === 'BOTS'); + + // This switch makes sure we only run code required for the mode + switch ($mode) + { + case 'full': + case 'no_profile': + case 'colour': + + // Build correct group colour + $group_colour = $group_colour ? '#' . $group_colour : ''; + + // Return colour + if ($mode === 'colour') + { + $group_name_string = $group_colour; + break; + } + + // no break; + + case 'group_name': + + // Build correct group name + $group_name = $this->get_name($group_name); + + // Return group name + if ($mode === 'group_name') + { + $group_name_string = $group_name; + break; + } + + // no break; + + case 'profile': + + // Build correct profile url - only show if not anonymous and permission to view profile if registered user + // For anonymous the link leads to a login page. + if ($group_id && !$s_is_bots && ($this->user->data['user_id'] == ANONYMOUS || $this->auth->acl_get('u_viewprofile'))) + { + $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&g=' . (int) $group_id : str_replace(array('={GROUP_ID}', '=%7BGROUP_ID%7D'), '=' . (int) $group_id, append_sid($this->name_strings['base_url'])); + } + else + { + $profile_url = ''; + } + + // Return profile + if ($mode === 'profile') + { + $group_name_string = $profile_url; + break; + } + + // no break; + } + + if (!isset($group_name_string)) + { + if (($mode === 'full' && empty($profile_url)) || $mode === 'no_profile' || $s_is_bots) + { + $group_name_string = str_replace(array('{GROUP_COLOUR}', '{GROUP_NAME}'), array($group_colour, $group_name), (!$group_colour) ? $this->name_strings['tpl_noprofile'] : $this->name_strings['tpl_noprofile_colour']); + } + else + { + $group_name_string = str_replace(array('{PROFILE_URL}', '{GROUP_COLOUR}', '{GROUP_NAME}'), array($profile_url, $group_colour, $group_name), (!$group_colour) ? $this->name_strings['tpl_profile'] : $this->name_strings['tpl_profile_colour']); + } + } + + $name_strings = $this->name_strings; + + /** + * Use this event to change the output of the group name + * + * @event core.modify_group_name_string + * @var string mode profile|group_name|colour|full|no_profile + * @var int group_id The group identifier + * @var string group_name The group name + * @var string group_colour The group colour + * @var string custom_profile_url Optional parameter to specify a profile url. + * @var string group_name_string The string that has been generated + * @var array name_strings Array of original return templates + * @since 3.2.8-RC1 + */ + $vars = array( + 'mode', + 'group_id', + 'group_name', + 'group_colour', + 'custom_profile_url', + 'group_name_string', + 'name_strings', + ); + extract($this->dispatcher->trigger_event('core.modify_group_name_string', compact($vars))); + + return $group_name_string; + } + + /** + * Get group rank title and image + * + * @html Group rank image element + * + * @param array $group_data The current stored group data + * + * @return array An associative array containing the rank title (title), + * the rank image as full img tag (img) and the rank image source (img_src) + */ + public function get_rank($group_data) + { + $group_rank_data = array( + 'title' => null, + 'img' => null, + 'img_src' => null, + ); + + /** + * Preparing a group's rank before displaying + * + * @event core.get_group_rank_before + * @var array group_data Array with group's data + * @since 3.2.8-RC1 + */ + + $vars = array('group_data'); + extract($this->dispatcher->trigger_event('core.get_group_rank_before', compact($vars))); + + if (!empty($group_data['group_rank'])) + { + // Only obtain ranks if group rank is set + $ranks = $this->cache->obtain_ranks(); + + if (isset($ranks['special'][$group_data['group_rank']])) + { + $rank = $ranks['special'][$group_data['group_rank']]; + + $group_rank_data['title'] = $rank['rank_title']; + + $group_rank_data['img_src'] = (!empty($rank['rank_image'])) ? $this->path_helper->update_web_root_path($this->phpbb_root_path . $this->config['ranks_path'] . '/' . $rank['rank_image']) : ''; + + /** @html Group rank image element for usage in the template */ + $group_rank_data['img'] = (!empty($rank['rank_image'])) ? '' . $rank['rank_title'] . '' : ''; + } + } + + /** + * Modify a group's rank before displaying + * + * @event core.get_group_rank_after + * @var array group_data Array with group's data + * @var array group_rank_data Group rank data + * @since 3.2.8-RC1 + */ + + $vars = array( + 'group_data', + 'group_rank_data', + ); + extract($this->dispatcher->trigger_event('core.get_group_rank_after', compact($vars))); + + return $group_rank_data; + } + + /** + * Get group avatar. + * Wrapper function for phpbb_get_group_avatar() + * + * @param array $group_row Row from the groups table + * @param string $alt Optional language string for alt tag within image, can be a language key or text + * @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP + * @param bool $lazy If true, will be lazy loaded (requires JS) + * + * @return string Avatar html + */ + function get_avatar($group_row, $alt = 'GROUP_AVATAR', $ignore_config = false, $lazy = false) + { + return phpbb_get_group_avatar($group_row, $alt, $ignore_config, $lazy); + } +} diff --git a/install/update/new/phpbb/help/controller/bbcode.php b/install/update/new/phpbb/help/controller/bbcode.php new file mode 100644 index 0000000..560b0c0 --- /dev/null +++ b/install/update/new/phpbb/help/controller/bbcode.php @@ -0,0 +1,90 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\help\controller; + +/** + * BBCode help page + */ +class bbcode extends controller +{ + /** + * @return string The title of the page + */ + public function display() + { + $this->language->add_lang('help/bbcode'); + + $this->template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $this->language->lang('BBCODE_GUIDE'), + 'U_BREADCRUMB' => $this->helper->route('phpbb_help_bbcode_controller'), + )); + + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_INTRO', + false, + array( + 'HELP_BBCODE_INTRO_BBCODE_QUESTION' => 'HELP_BBCODE_INTRO_BBCODE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_TEXT', + false, + array( + 'HELP_BBCODE_TEXT_BASIC_QUESTION' => 'HELP_BBCODE_TEXT_BASIC_ANSWER', + 'HELP_BBCODE_TEXT_COLOR_QUESTION' => 'HELP_BBCODE_TEXT_COLOR_ANSWER', + 'HELP_BBCODE_TEXT_COMBINE_QUESTION' => 'HELP_BBCODE_TEXT_COMBINE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_QUOTES', + false, + array( + 'HELP_BBCODE_QUOTES_TEXT_QUESTION' => 'HELP_BBCODE_QUOTES_TEXT_ANSWER', + 'HELP_BBCODE_QUOTES_CODE_QUESTION' => 'HELP_BBCODE_QUOTES_CODE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_LISTS', + false, + array( + 'HELP_BBCODE_LISTS_UNORDERER_QUESTION' => 'HELP_BBCODE_LISTS_UNORDERER_ANSWER', + 'HELP_BBCODE_LISTS_ORDERER_QUESTION' => 'HELP_BBCODE_LISTS_ORDERER_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_LINKS', + true, + array( + 'HELP_BBCODE_LINKS_BASIC_QUESTION' => 'HELP_BBCODE_LINKS_BASIC_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_IMAGES', + false, + array( + 'HELP_BBCODE_IMAGES_BASIC_QUESTION' => 'HELP_BBCODE_IMAGES_BASIC_ANSWER', + 'HELP_BBCODE_IMAGES_ATTACHMENT_QUESTION' => 'HELP_BBCODE_IMAGES_ATTACHMENT_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_OTHERS', + false, + array( + 'HELP_BBCODE_OTHERS_CUSTOM_QUESTION' => 'HELP_BBCODE_OTHERS_CUSTOM_ANSWER', + ) + ); + + return $this->language->lang('BBCODE_GUIDE'); + } +} diff --git a/install/update/new/phpbb/help/controller/faq.php b/install/update/new/phpbb/help/controller/faq.php new file mode 100644 index 0000000..0f63be5 --- /dev/null +++ b/install/update/new/phpbb/help/controller/faq.php @@ -0,0 +1,170 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\help\controller; + +/** + * FAQ help page + */ +class faq extends controller +{ + /** + * @return string The title of the page + */ + public function display() + { + $this->language->add_lang('help/faq'); + + $this->template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $this->language->lang('FAQ_EXPLAIN'), + 'U_BREADCRUMB' => $this->helper->route('phpbb_help_faq_controller'), + )); + + $this->manager->add_block( + 'HELP_FAQ_BLOCK_LOGIN', + false, + array( + 'HELP_FAQ_LOGIN_REGISTER_QUESTION' => 'HELP_FAQ_LOGIN_REGISTER_ANSWER', + 'HELP_FAQ_LOGIN_COPPA_QUESTION' => 'HELP_FAQ_LOGIN_COPPA_ANSWER', + 'HELP_FAQ_LOGIN_CANNOT_REGISTER_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_REGISTER_ANSWER', + 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_QUESTION' => 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_ANSWER', + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANSWER', + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_ANSWER', + 'HELP_FAQ_LOGIN_LOST_PASSWORD_QUESTION' => 'HELP_FAQ_LOGIN_LOST_PASSWORD_ANSWER', + 'HELP_FAQ_LOGIN_AUTO_LOGOUT_QUESTION' => 'HELP_FAQ_LOGIN_AUTO_LOGOUT_ANSWER', + 'HELP_FAQ_LOGIN_DELETE_COOKIES_QUESTION' => 'HELP_FAQ_LOGIN_DELETE_COOKIES_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_USERSETTINGS', + false, + array( + 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_QUESTION' => 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_ANSWER', + 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_QUESTION' => 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_ANSWER', + 'HELP_FAQ_USERSETTINGS_TIMEZONE_QUESTION' => 'HELP_FAQ_USERSETTINGS_TIMEZONE_ANSWER', + 'HELP_FAQ_USERSETTINGS_SERVERTIME_QUESTION' => 'HELP_FAQ_USERSETTINGS_SERVERTIME_ANSWER', + 'HELP_FAQ_USERSETTINGS_LANGUAGE_QUESTION' => 'HELP_FAQ_USERSETTINGS_LANGUAGE_ANSWER', + 'HELP_FAQ_USERSETTINGS_AVATAR_QUESTION' => 'HELP_FAQ_USERSETTINGS_AVATAR_ANSWER', + 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_QUESTION' => 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_ANSWER', + 'HELP_FAQ_USERSETTINGS_RANK_QUESTION' => 'HELP_FAQ_USERSETTINGS_RANK_ANSWER', + 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_QUESTION' => 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_POSTING', + false, + array( + 'HELP_FAQ_POSTING_CREATE_QUESTION' => 'HELP_FAQ_POSTING_CREATE_ANSWER', + 'HELP_FAQ_POSTING_EDIT_DELETE_QUESTION' => 'HELP_FAQ_POSTING_EDIT_DELETE_ANSWER', + 'HELP_FAQ_POSTING_SIGNATURE_QUESTION' => 'HELP_FAQ_POSTING_SIGNATURE_ANSWER', + 'HELP_FAQ_POSTING_POLL_CREATE_QUESTION' => 'HELP_FAQ_POSTING_POLL_CREATE_ANSWER', + 'HELP_FAQ_POSTING_POLL_ADD_QUESTION' => 'HELP_FAQ_POSTING_POLL_ADD_ANSWER', + 'HELP_FAQ_POSTING_POLL_EDIT_QUESTION' => 'HELP_FAQ_POSTING_POLL_EDIT_ANSWER', + 'HELP_FAQ_POSTING_FORUM_RESTRICTED_QUESTION' => 'HELP_FAQ_POSTING_FORUM_RESTRICTED_ANSWER', + 'HELP_FAQ_POSTING_NO_ATTACHMENTS_QUESTION' => 'HELP_FAQ_POSTING_NO_ATTACHMENTS_ANSWER', + 'HELP_FAQ_POSTING_WARNING_QUESTION' => 'HELP_FAQ_POSTING_WARNING_ANSWER', + 'HELP_FAQ_POSTING_REPORT_QUESTION' => 'HELP_FAQ_POSTING_REPORT_ANSWER', + 'HELP_FAQ_POSTING_DRAFT_QUESTION' => 'HELP_FAQ_POSTING_DRAFT_ANSWER', + 'HELP_FAQ_POSTING_QUEUE_QUESTION' => 'HELP_FAQ_POSTING_QUEUE_ANSWER', + 'HELP_FAQ_POSTING_BUMP_QUESTION' => 'HELP_FAQ_POSTING_BUMP_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_FORMATTING', + false, + array( + 'HELP_FAQ_FORMATTING_BBOCDE_QUESTION' => 'HELP_FAQ_FORMATTING_BBOCDE_ANSWER', + 'HELP_FAQ_FORMATTING_HTML_QUESTION' => 'HELP_FAQ_FORMATTING_HTML_ANSWER', + 'HELP_FAQ_FORMATTING_SMILIES_QUESTION' => 'HELP_FAQ_FORMATTING_SMILIES_ANSWER', + 'HELP_FAQ_FORMATTING_IMAGES_QUESTION' => 'HELP_FAQ_FORMATTING_IMAGES_ANSWER', + 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_QUESTION' => 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_ANSWER', + 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_QUESTION' => 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_ANSWER', + 'HELP_FAQ_FORMATTING_STICKIES_QUESTION' => 'HELP_FAQ_FORMATTING_STICKIES_ANSWER', + 'HELP_FAQ_FORMATTING_LOCKED_QUESTION' => 'HELP_FAQ_FORMATTING_LOCKED_ANSWER', + 'HELP_FAQ_FORMATTING_ICONS_QUESTION' => 'HELP_FAQ_FORMATTING_ICONS_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_GROUPS', + true, + array( + 'HELP_FAQ_GROUPS_ADMINISTRATORS_QUESTION' => 'HELP_FAQ_GROUPS_ADMINISTRATORS_ANSWER', + 'HELP_FAQ_GROUPS_MODERATORS_QUESTION' => 'HELP_FAQ_GROUPS_MODERATORS_ANSWER', + 'HELP_FAQ_GROUPS_USERGROUPS_QUESTION' => 'HELP_FAQ_GROUPS_USERGROUPS_ANSWER', + 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_QUESTION' => 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_ANSWER', + 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_QUESTION' => 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_ANSWER', + 'HELP_FAQ_GROUPS_COLORS_QUESTION' => 'HELP_FAQ_GROUPS_COLORS_ANSWER', + 'HELP_FAQ_GROUPS_DEFAULT_QUESTION' => 'HELP_FAQ_GROUPS_DEFAULT_ANSWER', + 'HELP_FAQ_GROUPS_TEAM_QUESTION' => 'HELP_FAQ_GROUPS_TEAM_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_PMS', + false, + array( + 'HELP_FAQ_PMS_CANNOT_SEND_QUESTION' => 'HELP_FAQ_PMS_CANNOT_SEND_ANSWER', + 'HELP_FAQ_PMS_UNWANTED_QUESTION' => 'HELP_FAQ_PMS_UNWANTED_ANSWER', + 'HELP_FAQ_PMS_SPAM_QUESTION' => 'HELP_FAQ_PMS_SPAM_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_FRIENDS', + false, + array( + 'HELP_FAQ_FRIENDS_BASIC_QUESTION' => 'HELP_FAQ_FRIENDS_BASIC_ANSWER', + 'HELP_FAQ_FRIENDS_MANAGE_QUESTION' => 'HELP_FAQ_FRIENDS_MANAGE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_SEARCH', + false, + array( + 'HELP_FAQ_SEARCH_FORUM_QUESTION' => 'HELP_FAQ_SEARCH_FORUM_ANSWER', + 'HELP_FAQ_SEARCH_NO_RESULT_QUESTION' => 'HELP_FAQ_SEARCH_NO_RESULT_ANSWER', + 'HELP_FAQ_SEARCH_BLANK_QUESTION' => 'HELP_FAQ_SEARCH_BLANK_ANSWER', + 'HELP_FAQ_SEARCH_MEMBERS_QUESTION' => 'HELP_FAQ_SEARCH_MEMBERS_ANSWER', + 'HELP_FAQ_SEARCH_OWN_QUESTION' => 'HELP_FAQ_SEARCH_OWN_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_BOOKMARKS', + false, + array( + 'HELP_FAQ_BOOKMARKS_DIFFERENCE_QUESTION' => 'HELP_FAQ_BOOKMARKS_DIFFERENCE_ANSWER', + 'HELP_FAQ_BOOKMARKS_TOPIC_QUESTION' => 'HELP_FAQ_BOOKMARKS_TOPIC_ANSWER', + 'HELP_FAQ_BOOKMARKS_FORUM_QUESTION' => 'HELP_FAQ_BOOKMARKS_FORUM_ANSWER', + 'HELP_FAQ_BOOKMARKS_REMOVE_QUESTION' => 'HELP_FAQ_BOOKMARKS_REMOVE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_ATTACHMENTS', + false, + array( + 'HELP_FAQ_ATTACHMENTS_ALLOWED_QUESTION' => 'HELP_FAQ_ATTACHMENTS_ALLOWED_ANSWER', + 'HELP_FAQ_ATTACHMENTS_OWN_QUESTION' => 'HELP_FAQ_ATTACHMENTS_OWN_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_ISSUES', + false, + array( + 'HELP_FAQ_ISSUES_WHOIS_PHPBB_QUESTION' => 'HELP_FAQ_ISSUES_WHOIS_PHPBB_ANSWER', + 'HELP_FAQ_ISSUES_FEATURE_QUESTION' => 'HELP_FAQ_ISSUES_FEATURE_ANSWER', + 'HELP_FAQ_ISSUES_LEGAL_QUESTION' => 'HELP_FAQ_ISSUES_LEGAL_ANSWER', + 'HELP_FAQ_ISSUES_ADMIN_QUESTION' => 'HELP_FAQ_ISSUES_ADMIN_ANSWER', + ) + ); + + return $this->language->lang('FAQ_EXPLAIN'); + } +} diff --git a/install/update/new/phpbb/install/controller/helper.php b/install/update/new/phpbb/install/controller/helper.php new file mode 100644 index 0000000..f61c7de --- /dev/null +++ b/install/update/new/phpbb/install/controller/helper.php @@ -0,0 +1,413 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\controller; + +use phpbb\install\helper\config; +use phpbb\install\helper\navigation\navigation_provider; +use phpbb\language\language; +use phpbb\language\language_file_helper; +use phpbb\path_helper; +use phpbb\request\request; +use phpbb\request\request_interface; +use phpbb\routing\router; +use phpbb\symfony_request; +use phpbb\template\template; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Cookie; + +/** + * A duplicate of \phpbb\controller\helper + * + * This class is necessary because of controller\helper's legacy function calls + * to page_header() page_footer() functions which has unavailable dependencies. + */ +class helper +{ + /** + * @var config + */ + protected $installer_config; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var bool|string + */ + protected $language_cookie; + + /** + * @var \phpbb\language\language_file_helper + */ + protected $lang_helper; + + /** + * @var \phpbb\install\helper\navigation\navigation_provider + */ + protected $navigation_provider; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var \phpbb\path_helper + */ + protected $path_helper; + + /** + * @var \phpbb\request\request + */ + protected $phpbb_request; + + /** + * @var \phpbb\symfony_request + */ + protected $request; + + /** + * @var \phpbb\routing\router + */ + protected $router; + + /** + * @var string + */ + protected $phpbb_admin_path; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param config $config + * @param language $language + * @param language_file_helper $lang_helper + * @param navigation_provider $nav + * @param template $template + * @param path_helper $path_helper + * @param request $phpbb_request + * @param symfony_request $request + * @param router $router + * @param string $phpbb_root_path + */ + public function __construct(config $config, language $language, language_file_helper $lang_helper, navigation_provider $nav, template $template, path_helper $path_helper, request $phpbb_request, symfony_request $request, router $router, $phpbb_root_path) + { + $this->installer_config = $config; + $this->language = $language; + $this->language_cookie = false; + $this->lang_helper = $lang_helper; + $this->navigation_provider = $nav; + $this->template = $template; + $this->path_helper = $path_helper; + $this->phpbb_request = $phpbb_request; + $this->request = $request; + $this->router = $router; + $this->phpbb_root_path = $phpbb_root_path; + $this->phpbb_admin_path = $phpbb_root_path . 'adm/'; + } + + /** + * Automate setting up the page and creating the response object. + * + * @param string $template_file The template handle to render + * @param string $page_title The title of the page to output + * @param bool $selected_language True to enable language selector it, false otherwise + * @param int $status_code The status code to be sent to the page header + * + * @return Response object containing rendered page + */ + public function render($template_file, $page_title = '', $selected_language = false, $status_code = 200) + { + $this->page_header($page_title, $selected_language); + + $this->template->set_filenames(array( + 'body' => $template_file, + )); + + $response = new Response($this->template->assign_display('body'), $status_code); + + // Set language cookie + if ($this->language_cookie !== false) + { + $cookie = new Cookie('lang', $this->language_cookie, time() + 3600); + $response->headers->setCookie($cookie); + + $this->language_cookie = false; + } + + return $response; + } + + /** + * Returns path from route name + * + * @param string $route_name + * @param array $parameters + * + * @return string + */ + public function route($route_name, $parameters = array()) + { + $url = $this->router->generate($route_name, $parameters); + + return $url; + } + + /** + * Handles language selector form + */ + public function handle_language_select() + { + $lang = null; + + // Check if language form has been submited + $submit = $this->phpbb_request->variable('change_lang', ''); + if (!empty($submit)) + { + $lang = $this->phpbb_request->variable('language', ''); + } + + // Retrieve language from cookie + $lang_cookie = $this->phpbb_request->variable('lang', '', false, request_interface::COOKIE); + if (empty($lang) && !empty($lang_cookie)) + { + $lang = $lang_cookie; + } + + $lang = (!empty($lang) && strpos($lang, '/') === false) ? $lang : null; + $this->language_cookie = $lang; + + $this->render_language_select($lang); + + if ($lang !== null) + { + $this->language->set_user_language($lang, true); + $this->installer_config->set('user_language', $lang); + } + } + + /** + * Process navigation data to reflect active/completed stages + * + * @param \phpbb\install\helper\iohandler\iohandler_interface|null $iohandler + */ + public function handle_navigation($iohandler = null) + { + $nav_data = $this->installer_config->get_navigation_data(); + + // Set active navigation stage + if (isset($nav_data['active']) && is_array($nav_data['active'])) + { + if ($iohandler !== null) + { + $iohandler->set_active_stage_menu($nav_data['active']); + } + + $this->navigation_provider->set_nav_property($nav_data['active'], array( + 'selected' => true, + 'completed' => false, + )); + } + + // Set finished navigation stages + if (isset($nav_data['finished']) && is_array($nav_data['finished'])) + { + foreach ($nav_data['finished'] as $finished_stage) + { + if ($iohandler !== null) + { + $iohandler->set_finished_stage_menu($finished_stage); + } + + $this->navigation_provider->set_nav_property($finished_stage, array( + 'selected' => false, + 'completed' => true, + )); + } + } + } + + /** + * Set default template variables + * + * @param string $page_title Title of the page + * @param bool $selected_language True to enable language selector it, false otherwise + */ + protected function page_header($page_title, $selected_language = false) + { + // Path to templates + $paths = array($this->phpbb_root_path . 'install/update/new/adm/', $this->phpbb_admin_path); + $paths = array_filter($paths, 'is_dir'); + $path = array_shift($paths); + $path = substr($path, strlen($this->phpbb_root_path)); + + $this->template->assign_vars(array( + 'L_CHANGE' => $this->language->lang('CHANGE'), + 'L_COLON' => $this->language->lang('COLON'), + 'L_INSTALL_PANEL' => $this->language->lang('INSTALL_PANEL'), + 'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'), + 'L_SKIP' => $this->language->lang('SKIP'), + 'PAGE_TITLE' => $this->language->lang($page_title), + 'T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . $path . 'images', + 'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . $path . '../assets/javascript/jquery-3.4.1.min.js', + 'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . $path . 'style', + 'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . $path . '../assets', + + 'S_CONTENT_DIRECTION' => $this->language->lang('DIRECTION'), + 'S_CONTENT_FLOW_BEGIN' => ($this->language->lang('DIRECTION') === 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($this->language->lang('DIRECTION') === 'ltr') ? 'right' : 'left', + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_LANG_SELECT' => $selected_language, + + 'S_USER_LANG' => $this->language->lang('USER_LANG'), + )); + + $this->render_navigation(); + } + + /** + * Render navigation + */ + protected function render_navigation() + { + // Get navigation items + $nav_array = $this->navigation_provider->get(); + $nav_array = $this->sort_navigation_level($nav_array); + + $active_main_menu = $this->get_active_main_menu($nav_array); + + // Pass navigation to template + foreach ($nav_array as $key => $entry) + { + $this->template->assign_block_vars('t_block1', array( + 'L_TITLE' => $this->language->lang($entry['label']), + 'S_SELECTED' => ($active_main_menu === $key), + 'U_TITLE' => $this->route($entry['route']), + )); + + if (is_array($entry[0]) && $active_main_menu === $key) + { + $entry[0] = $this->sort_navigation_level($entry[0]); + + foreach ($entry[0] as $name => $sub_entry) + { + if (isset($sub_entry['stage']) && $sub_entry['stage'] === true) + { + $this->template->assign_block_vars('l_block2', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['selected']) && $sub_entry['selected'] === true), + 'S_COMPLETE' => (isset($sub_entry['completed']) && $sub_entry['completed'] === true), + 'STAGE_NAME' => $name, + )); + } + else + { + $this->template->assign_block_vars('l_block1', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), + 'U_TITLE' => $this->route($sub_entry['route']), + )); + } + } + } + } + } + + /** + * Render language select form + * + * @param string $selected_language + */ + protected function render_language_select($selected_language = null) + { + $langs = $this->lang_helper->get_available_languages(); + foreach ($langs as $lang) + { + $this->template->assign_block_vars('language_select_item', array( + 'VALUE' => $lang['iso'], + 'NAME' => $lang['local_name'], + 'SELECTED' => ($lang['iso'] === $selected_language), + )); + } + } + + /** + * Returns the name of the active main menu item + * + * @param array $nav_array + * + * @return string|bool Returns the name of the active main menu element, if the element not found, returns false + */ + protected function get_active_main_menu($nav_array) + { + $active_route = $this->request->get('_route'); + + foreach ($nav_array as $nav_name => $nav_options) + { + $current_menu = $nav_name; + + if (isset($nav_options['route']) && $nav_options['route'] === $active_route) + { + return $nav_name; + } + + if (is_array($nav_options[0])) + { + foreach ($nav_options[0] as $sub_menus) + { + if (isset($sub_menus['route']) && $sub_menus['route'] === $active_route) + { + return $current_menu; + } + } + } + } + + return false; + } + + /** + * Sorts the top level of navigation array + * + * @param array $nav_array Navigation array + * + * @return array + */ + protected function sort_navigation_level($nav_array) + { + $sorted = array(); + foreach ($nav_array as $key => $nav) + { + $order = (isset($nav['order'])) ? $nav['order'] : 0; + $sorted[$order][$key] = $nav; + } + + // Linearization of navigation array + $nav_array = array(); + ksort($sorted); + foreach ($sorted as $nav) + { + $nav_array = array_merge($nav_array, $nav); + } + + return $nav_array; + } +} diff --git a/install/update/new/phpbb/install/helper/container_factory.php b/install/update/new/phpbb/install/helper/container_factory.php new file mode 100644 index 0000000..6557602 --- /dev/null +++ b/install/update/new/phpbb/install/helper/container_factory.php @@ -0,0 +1,191 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper; + +use phpbb\install\exception\cannot_build_container_exception; +use phpbb\language\language; +use phpbb\request\request; + +class container_factory +{ + /** + * @var language + */ + protected $language; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * @var \phpbb\request\request + */ + protected $request; + + /** + * @var update_helper + */ + protected $update_helper; + + /** + * The full phpBB container + * + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * Constructor + * + * @param language $language Language service + * @param request $request Request interface + * @param update_helper $update_helper Update helper + * @param string $phpbb_root_path Path to phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct(language $language, request $request, update_helper $update_helper, $phpbb_root_path, $php_ext) + { + $this->language = $language; + $this->request = $request; + $this->update_helper = $update_helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->container = null; + } + + /** + * Container getter + * + * @param null|string $service_name Name of the service to return + * + * @return \Symfony\Component\DependencyInjection\ContainerInterface|Object phpBB's dependency injection container + * or the service specified in $service_name + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + * @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException If the service is not defined + * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException When a circular reference is detected + * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException When the service is not defined + */ + public function get($service_name = null) + { + // Check if container was built, if not try to build it + if ($this->container === null) + { + $this->build_container(); + } + + return ($service_name === null) ? $this->container : $this->container->get($service_name); + } + + /** + * Returns the specified parameter from the container + * + * @param string $param_name + * + * @return mixed + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + */ + public function get_parameter($param_name) + { + // Check if container was built, if not try to build it + if ($this->container === null) + { + $this->build_container(); + } + + return $this->container->getParameter($param_name); + } + + /** + * Build dependency injection container + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + */ + protected function build_container() + { + // If the container has been already built just return. + // Although this should never happen + if ($this->container instanceof \Symfony\Component\DependencyInjection\ContainerInterface) + { + return; + } + + // Check whether container can be built + // We need config.php for that so let's check if it has been set up yet + if (!filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) + { + throw new cannot_build_container_exception(); + } + + $phpbb_config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext); + $phpbb_container_builder = new \phpbb\di\container_builder($this->phpbb_root_path, $this->php_ext); + + // For BC with functions that we need during install + global $phpbb_container, $table_prefix; + + $disable_super_globals = $this->request->super_globals_disabled(); + + // This is needed because container_builder::get_env_parameters() uses $_SERVER + if ($disable_super_globals) + { + $this->request->enable_super_globals(); + } + + $other_config_path = $this->phpbb_root_path . 'install/update/new/config'; + $config_path = (is_dir($other_config_path)) ? $other_config_path : $this->phpbb_root_path . 'config'; + + $this->container = $phpbb_container_builder + ->with_environment('production') + ->with_config($phpbb_config_php_file) + ->with_config_path($config_path) + ->without_compiled_container() + ->get_container(); + + // Setting request is required for the compatibility globals as those are generated from + // this container + if (!$this->container->isFrozen()) + { + $this->container->register('request')->setSynthetic(true); + $this->container->register('language')->setSynthetic(true); + } + + $this->container->set('request', $this->request); + $this->container->set('language', $this->language); + + $this->container->compile(); + + $phpbb_container = $this->container; + $table_prefix = $phpbb_config_php_file->get('table_prefix'); + + // Restore super globals to previous state + if ($disable_super_globals) + { + $this->request->disable_super_globals(); + } + + // Get compatibility globals and constants + $this->update_helper->include_file('includes/compatibility_globals.' . $this->php_ext); + + register_compatibility_globals(); + + $this->update_helper->include_file('includes/constants.' . $this->php_ext); + } +} diff --git a/install/update/new/phpbb/install/helper/database.php b/install/update/new/phpbb/install/helper/database.php new file mode 100644 index 0000000..51fd18f --- /dev/null +++ b/install/update/new/phpbb/install/helper/database.php @@ -0,0 +1,421 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper; + +use phpbb\install\exception\invalid_dbms_exception; + +/** + * Database related general functionality for installer + */ +class database +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var array + */ + protected $supported_dbms = array( + // Note: php 5.5 alpha 2 deprecated mysql. + // Keep mysqli before mysql in this list. + 'mysqli' => array( + 'LABEL' => 'MySQL with MySQLi Extension', + 'SCHEMA' => 'mysql_41', + 'MODULE' => 'mysqli', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mysqli', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssql_odbc'=> array( + 'LABEL' => 'MS SQL Server [ ODBC ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'odbc', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mssql_odbc', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssqlnative' => array( + 'LABEL' => 'MS SQL Server 2005+ [ Native ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'sqlsrv', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mssqlnative', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'oracle' => array( + 'LABEL' => 'Oracle', + 'SCHEMA' => 'oracle', + 'MODULE' => 'oci8', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\oracle', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'postgres' => array( + 'LABEL' => 'PostgreSQL 8.3+', + 'SCHEMA' => 'postgres', + 'MODULE' => 'pgsql', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\postgres', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'sqlite3' => array( + 'LABEL' => 'SQLite3', + 'SCHEMA' => 'sqlite', + 'MODULE' => 'sqlite3', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\sqlite3', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + ); + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem interface + * @param string $phpbb_root_path Path to phpBB's root + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path) + { + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + } + + /** + * Returns an array of available DBMS supported by phpBB + * + * If a DBMS is specified it will only return data for that DBMS + * and will load its extension if necessary. + * + * @param mixed $dbms name of the DBMS that's info is required or false for all DBMS info + * @param bool $return_unavailable set it to true if you expect unavailable but supported DBMS + * returned as well + * @param bool $only_20x_options set it to true if you only want to recover 2.0.x options + * + * @return array Array of available and supported DBMS + */ + public function get_available_dbms($dbms = false, $return_unavailable = false, $only_20x_options = false) + { + $available_dbms = $this->supported_dbms; + + if ($dbms) + { + if (isset($this->supported_dbms[$dbms])) + { + $available_dbms = array($dbms => $this->supported_dbms[$dbms]); + } + else + { + return array(); + } + } + + $any_dbms_available = false; + foreach ($available_dbms as $db_name => $db_array) + { + if ($only_20x_options && !$db_array['2.0.x']) + { + if ($return_unavailable) + { + $available_dbms[$db_name]['AVAILABLE'] = false; + } + else + { + unset($available_dbms[$db_name]); + } + + continue; + } + + $dll = $db_array['MODULE']; + if (!@extension_loaded($dll)) + { + if ($return_unavailable) + { + $available_dbms[$db_name]['AVAILABLE'] = false; + } + else + { + unset($available_dbms[$db_name]); + } + + continue; + } + + $any_dbms_available = true; + } + + if ($return_unavailable) + { + $available_dbms['ANY_DB_SUPPORT'] = $any_dbms_available; + } + + return $available_dbms; + } + + /** + * Removes "/* style" as well as "# style" comments from $input. + * + * @param string $sql_query Input string + * + * @return string Input string with comments removed + */ + public function remove_comments($sql_query) + { + // Remove /* */ comments (http://ostermiller.org/findcomment.html) + $sql_query = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $sql_query); + + // Remove # style comments + $sql_query = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql_query)); + + return $sql_query; + } + + /** + * split_sql_file() will split an uploaded sql file into single sql statements. + * + * Note: expects trim() to have already been run on $sql. + * + * @param string $sql SQL statements + * @param string $delimiter Delimiter between sql statements + * + * @return array Array of sql statements + */ + public function split_sql_file($sql, $delimiter) + { + $sql = str_replace("\r" , '', $sql); + $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql); + + $data = array_map('trim', $data); + + // The empty case + $end_data = end($data); + + if (empty($end_data)) + { + unset($data[key($data)]); + } + + return $data; + } + + /** + * Validates table prefix + * + * @param string $dbms The selected dbms + * @param string $table_prefix The table prefix to validate + * + * @return bool|array true if table prefix is valid, array of errors otherwise + * + * @throws \phpbb\install\exception\invalid_dbms_exception When $dbms is not a valid + */ + public function validate_table_prefix($dbms, $table_prefix) + { + $errors = array(); + + if (!preg_match('#^[a-zA-Z][a-zA-Z0-9_]*$#', $table_prefix)) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_INVALID_PREFIX', + ); + } + + // Do dbms specific checks + $dbms_info = $this->get_available_dbms($dbms); + switch ($dbms_info[$dbms]['SCHEMA']) + { + case 'mysql_41': + $prefix_length = 36; + break; + case 'mssql': + $prefix_length = 90; + break; + case 'oracle': + $prefix_length = 6; + break; + case 'postgres': + $prefix_length = 36; + break; + case 'sqlite': + $prefix_length = 200; + break; + default: + throw new invalid_dbms_exception(); + break; + } + + // Check the prefix length to ensure that index names are not too long + if (strlen($table_prefix) > $prefix_length) + { + $errors[] = array( + 'title' => array('INST_ERR_PREFIX_TOO_LONG', $prefix_length), + ); + } + + return (empty($errors)) ? true : $errors; + } + + /** + * Check if the user provided database parameters are correct + * + * This function checks the database connection data and also checks for + * any other problems that could cause an error during the installation + * such as if there is any database table names conflicting. + * + * Note: The function assumes that $table_prefix has been already validated + * with validate_table_prefix(). + * + * @param string $dbms Selected database type + * @param string $dbhost Database host address + * @param int $dbport Database port number + * @param string $dbuser Database username + * @param string $dbpass Database password + * @param string $dbname Database name + * @param string $table_prefix Database table prefix + * + * @return array|bool Returns true if test is successful, array of errors otherwise + */ + public function check_database_connection($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix) + { + $dbms_info = $this->get_available_dbms($dbms); + $dbms_info = $dbms_info[$dbms]; + $errors = array(); + + // Instantiate it and set return on error true + /** @var \phpbb\db\driver\driver_interface $db */ + $db = new $dbms_info['DRIVER']; + $db->sql_return_on_error(true); + + // Check that we actually have a database name before going any further + if (!in_array($dbms_info['SCHEMA'], array('sqlite', 'oracle'), true) && $dbname === '') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_NAME', + ); + } + + // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea + if ($dbms_info['SCHEMA'] === 'sqlite' + && stripos($this->filesystem->realpath($dbhost), $this->filesystem->realpath($this->phpbb_root_path) === 0)) + { + $errors[] = array( + 'title' =>'INST_ERR_DB_FORUM_PATH', + ); + } + + // Check if SQLite database is writable + if ($dbms_info['SCHEMA'] === 'sqlite' + && (($this->filesystem->exists($dbhost) && !$this->filesystem->is_writable($dbhost)) || !$this->filesystem->is_writable(pathinfo($dbhost, PATHINFO_DIRNAME)))) + { + $errors[] = array( + 'title' =>'INST_ERR_DB_NO_WRITABLE', + ); + } + + // Try to connect to db + if (is_array($db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, false, true))) + { + $db_error = $db->sql_error(); + $errors[] = array( + 'title' => 'INST_ERR_DB_CONNECT', + 'description' => ($db_error['message']) ? utf8_convert_message($db_error['message']) : 'INST_ERR_DB_NO_ERROR', + ); + } + else + { + // Check if there is any table name collisions + $temp_prefix = strtolower($table_prefix); + $table_ary = array( + $temp_prefix . 'attachments', + $temp_prefix . 'config', + $temp_prefix . 'sessions', + $temp_prefix . 'topics', + $temp_prefix . 'users', + ); + + $db_tools_factory = new \phpbb\db\tools\factory(); + $db_tools = $db_tools_factory->get($db); + $tables = $db_tools->sql_list_tables(); + $tables = array_map('strtolower', $tables); + $table_intersect = array_intersect($tables, $table_ary); + + if (count($table_intersect)) + { + $errors[] = array( + 'title' => 'INST_ERR_PREFIX', + ); + } + + // Check if database version is supported + switch ($dbms) + { + case 'sqlite3': + if (version_compare($db->sql_server_info(true), '3.6.15', '<')) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_SQLITE3', + ); + } + break; + case 'oracle': + $sql = "SELECT * + FROM NLS_DATABASE_PARAMETERS + WHERE PARAMETER = 'NLS_RDBMS_VERSION' + OR PARAMETER = 'NLS_CHARACTERSET'"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $stats[$row['parameter']] = $row['value']; + } + $db->sql_freeresult($result); + + if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_ORACLE', + ); + } + break; + case 'postgres': + $sql = "SHOW server_encoding;"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_POSTGRES', + ); + } + break; + } + } + + return (empty($errors)) ? true : $errors; + } +} diff --git a/install/update/new/phpbb/install/helper/iohandler/iohandler_interface.php b/install/update/new/phpbb/install/helper/iohandler/iohandler_interface.php new file mode 100644 index 0000000..3df9a91 --- /dev/null +++ b/install/update/new/phpbb/install/helper/iohandler/iohandler_interface.php @@ -0,0 +1,222 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\iohandler; + +/** + * Input-Output handler interface for the installer + */ +interface iohandler_interface +{ + /** + * Renders or returns response message + * + * @param bool $no_more_output Whether or not there will be more output in this output unit + */ + public function send_response($no_more_output = false); + + /** + * Returns input variable + * + * @param string $name Name of the input variable to obtain + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this parameter has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * + * @return mixed Value of the input variable + */ + public function get_input($name, $default, $multibyte = false); + + /** + * Returns raw input variable + * + * @param string $name Name of the input variable to obtain + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * + * @return mixed Value of the raw input variable + */ + public function get_raw_input($name, $default); + + /** + * Returns server variable + * + * This function should work the same as request_interface::server(). + * + * @param string $name Name of the server variable + * @param mixed $default Default value to return when the requested variable does not exist + * + * @return mixed Value of the server variable + */ + public function get_server_variable($name, $default = ''); + + /** + * Wrapper function for request_interface::header() + * + * @param string $name Name of the request header variable + * @param mixed $default Default value to return when the requested variable does not exist + * + * @return mixed + */ + public function get_header_variable($name, $default = ''); + + /** + * Returns true if the connection is encrypted + * + * @return bool + */ + public function is_secure(); + + /** + * Adds an error message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $error_title Title of the error message. + * @param string|bool|array $error_description Description of the error (and possibly guidelines to resolve it), + * or false if the error description is not available. + */ + public function add_error_message($error_title, $error_description = false); + + /** + * Adds a warning message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $warning_title Title of the warning message + * @param string|bool|array $warning_description Description of the warning (and possibly guidelines to resolve it), + * or false if the warning description is not available + */ + public function add_warning_message($warning_title, $warning_description = false); + + /** + * Adds a log message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $log_title Title of the log message + * @param string|bool|array $log_description Description of the log, + * or false if the log description is not available + */ + public function add_log_message($log_title, $log_description = false); + + /** + * Adds a success message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $success_title Title of the success message + * @param string|bool|array $success_description Description of the success, + * or false if the success description is not available + * + * @return null + */ + public function add_success_message($success_title, $success_description = false); + + /** + * Adds a requested data group to the rendering queue + * + * @param string $title Language variable with the title of the form + * @param array $form An array describing the required data (options etc) + */ + public function add_user_form_group($title, $form); + + /** + * Returns the rendering information for the form + * + * @param string $title Language variable with the title of the form + * @param array $form An array describing the required data (options etc) + * + * @return string Information to render the form + */ + public function generate_form_render_data($title, $form); + + /** + * Sets the number of tasks belonging to the installer in the current mode. + * + * @param int $task_count Number of tasks + * @param bool $restart Whether or not to restart the progress bar, false by default + */ + public function set_task_count($task_count, $restart = false); + + /** + * Sets the progress information + * + * @param string $task_lang_key Language key for the name of the task + * @param int $task_number Position of the current task in the task queue + */ + public function set_progress($task_lang_key, $task_number); + + /** + * Sends refresh request to the client + */ + public function request_refresh(); + + /** + * Marks stage as active in the navigation bar + * + * @param array $menu_path Array to the navigation elem + */ + public function set_active_stage_menu($menu_path); + + /** + * Marks stage as completed in the navigation bar + * + * @param array $menu_path Array to the navigation elem + */ + public function set_finished_stage_menu($menu_path); + + /** + * Finish the progress bar + * + * @param string $message_lang_key Language key for the message + */ + public function finish_progress($message_lang_key); + + /** + * Adds a download link + * + * @param string $route Route for the link + * @param string $title Language key for the title + * @param string|null|array $msg Language key for the message + */ + public function add_download_link($route, $title, $msg = null); + + /** + * Redirects the user to a new page + * + * @param string $url URL to redirect to + * @param bool $use_ajax Whether or not to use AJAX redirect + */ + public function redirect($url, $use_ajax = false); + + /** + * Renders the status of update files + * + * @param array $status_array Array containing files in groups to render + */ + public function render_update_file_status($status_array); + + /** + * Sends and sets cookies + * + * @param string $cookie_name Name of the cookie to set + * @param string $cookie_value Value of the cookie to set + */ + public function set_cookie($cookie_name, $cookie_value); +} diff --git a/install/update/new/phpbb/install/installer_configuration.php b/install/update/new/phpbb/install/installer_configuration.php new file mode 100644 index 0000000..dfafc40 --- /dev/null +++ b/install/update/new/phpbb/install/installer_configuration.php @@ -0,0 +1,146 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\install; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +class installer_configuration implements ConfigurationInterface +{ + + /** + * Generates the configuration tree builder. + * + * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('installer'); + $rootNode + ->children() + ->arrayNode('admin') + ->children() + ->scalarNode('name')->defaultValue('admin')->cannotBeEmpty()->end() + ->scalarNode('password')->defaultValue('adminadmin')->cannotBeEmpty()->end() + ->scalarNode('email')->defaultValue('admin@example.org')->cannotBeEmpty()->end() + ->end() + ->end() + ->arrayNode('board') + ->children() + ->scalarNode('lang') + ->defaultValue('en') + ->cannotBeEmpty() + ->end() + ->scalarNode('name') + ->defaultValue('My Board') + ->cannotBeEmpty() + ->end() + ->scalarNode('description') + ->defaultValue('My amazing new phpBB board') + ->cannotBeEmpty() + ->end() + ->end() + ->end() + ->arrayNode('database') + ->children() + ->scalarNode('dbms') + ->defaultValue('sqlite3') + ->cannotBeEmpty() + ->isRequired() + ->end() + ->scalarNode('dbhost') + ->defaultValue(null) + ->end() + ->scalarNode('dbport') + ->defaultValue(null) + ->end() + ->scalarNode('dbuser') + ->defaultValue(null) + ->end() + ->scalarNode('dbpasswd') + ->defaultValue(null) + ->end() + ->scalarNode('dbname') + ->defaultValue(null) + ->end() + ->scalarNode('table_prefix') + ->defaultValue('phpbb_') + ->cannotBeEmpty() + ->isRequired() + ->end() + ->end() + ->end() + ->arrayNode('email') + ->canBeEnabled() + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('smtp_delivery') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('smtp_host') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_port') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_auth') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_user') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_pass') + ->defaultValue(null) + ->end() + ->end() + ->end() + ->arrayNode('server') + ->children() + ->booleanNode('cookie_secure') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('server_protocol') + ->defaultValue('http://') + ->cannotBeEmpty() + ->end() + ->booleanNode('force_server_vars') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('server_name') + ->defaultValue('localhost') + ->cannotBeEmpty() + ->end() + ->integerNode('server_port') + ->defaultValue(80) + ->min(1) + ->end() + ->scalarNode('script_path') + ->defaultValue('/') + ->cannotBeEmpty() + ->end() + ->end() + ->end() + ->arrayNode('extensions') + ->prototype('scalar')->end() + ->defaultValue([]) + ->end() + ->end() + ; + return $treeBuilder; + } +} diff --git a/install/update/new/phpbb/install/module/install_database/task/add_config_settings.php b/install/update/new/phpbb/install/module/install_database/task/add_config_settings.php new file mode 100644 index 0000000..91d7884 --- /dev/null +++ b/install/update/new/phpbb/install/module/install_database/task/add_config_settings.php @@ -0,0 +1,367 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_database\task; + +use phpbb\install\exception\resource_limit_reached_exception; + +/** + * Create database schema + */ +class add_config_settings extends \phpbb\install\task_base +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var \phpbb\passwords\manager + */ + protected $password_manager; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $config_table; + + /** + * @var string + */ + protected $user_table; + + /** + * @var string + */ + protected $topics_table; + + /** + * @var string + */ + protected $forums_table; + + /** + * @var string + */ + protected $posts_table; + + /** + * @var string + */ + protected $moderator_cache_table; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem service + * @param \phpbb\install\helper\config $install_config Installer's config helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param \phpbb\install\helper\container_factory $container Installer's DI container + * @param \phpbb\language\language $language Language service + * @param string $phpbb_root_path Path to phpBB's root + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\config $install_config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\install\helper\container_factory $container, + \phpbb\language\language $language, + $phpbb_root_path) + { + $this->db = $container->get('dbal.conn'); + $this->filesystem = $filesystem; + $this->install_config = $install_config; + $this->iohandler = $iohandler; + $this->language = $language; + $this->password_manager = $container->get('passwords.manager'); + $this->phpbb_root_path = $phpbb_root_path; + + // Table names + $this->config_table = $container->get_parameter('tables.config'); + $this->forums_table = $container->get_parameter('tables.forums'); + $this->topics_table = $container->get_parameter('tables.topics'); + $this->user_table = $container->get_parameter('tables.users'); + $this->moderator_cache_table = $container->get_parameter('tables.moderator_cache'); + $this->posts_table = $container->get_parameter('tables.posts'); + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $server_name = $this->install_config->get('server_name'); + $current_time = time(); + $user_ip = phpbb_ip_normalise($this->iohandler->get_server_variable('REMOTE_ADDR')); + $user_ip = ($user_ip === false) ? '' : $user_ip; + $referer = $this->iohandler->get_server_variable('REFERER'); + + // Calculate cookie domain + $cookie_domain = $server_name; + + if (strpos($cookie_domain, 'www.') === 0) + { + $cookie_domain = substr($cookie_domain, 3); + } + + // Set default config and post data, this applies to all DB's + $sql_ary = array( + 'INSERT INTO ' . $this->config_table . " (config_name, config_value) + VALUES ('board_startdate', '$current_time')", + + 'INSERT INTO ' . $this->config_table . " (config_name, config_value) + VALUES ('default_lang', '" . $this->db->sql_escape($this->install_config->get('default_lang')) . "')", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_name')) . "' + WHERE config_name = 'server_name'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_port')) . "' + WHERE config_name = 'server_port'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "' + WHERE config_name = 'board_email'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "' + WHERE config_name = 'board_contact'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($cookie_domain) . "' + WHERE config_name = 'cookie_domain'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "' + WHERE config_name = 'default_dateformat'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('email_enable')) . "' + WHERE config_name = 'email_enable'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_delivery')) . "' + WHERE config_name = 'smtp_delivery'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_host')) . "' + WHERE config_name = 'smtp_host'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_port')) . "' + WHERE config_name = 'smtp_port'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_auth')) . "' + WHERE config_name = 'smtp_auth_method'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_user')) . "' + WHERE config_name = 'smtp_username'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_pass')) . "' + WHERE config_name = 'smtp_password'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('cookie_secure')) . "' + WHERE config_name = 'cookie_secure'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('force_server_vars')) . "' + WHERE config_name = 'force_server_vars'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('script_path')) . "' + WHERE config_name = 'script_path'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_protocol')) . "' + WHERE config_name = 'server_protocol'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE config_name = 'newest_username'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . md5(mt_rand()) . "' + WHERE config_name = 'avatar_salt'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . md5(mt_rand()) . "' + WHERE config_name = 'plupload_salt'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_name')) . "' + WHERE config_name = 'sitename'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_description')) . "' + WHERE config_name = 'site_desc'", + + 'UPDATE ' . $this->user_table . " + SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "', + user_password='" . $this->password_manager->hash($this->install_config->get('admin_passwd')) . "', + user_ip = '" . $this->db->sql_escape($user_ip) . "', + user_lang = '" . $this->db->sql_escape($this->install_config->get('user_language', 'en')) . "', + user_email='" . $this->db->sql_escape($this->install_config->get('board_email')) . "', + user_dateformat='" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "', + username_clean = '" . $this->db->sql_escape(utf8_clean_string($this->install_config->get('admin_name'))) . "' + WHERE username = 'Admin'", + + 'UPDATE ' . $this->moderator_cache_table . " + SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE username = 'Admin'", + + 'UPDATE ' . $this->forums_table . " + SET forum_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE forum_last_poster_name = 'Admin'", + + 'UPDATE ' . $this->topics_table . " + SET topic_first_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "', + topic_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE topic_first_poster_name = 'Admin' + OR topic_last_poster_name = 'Admin'", + + 'UPDATE ' . $this->user_table . " + SET user_regdate = $current_time", + + 'UPDATE ' . $this->posts_table . " + SET post_time = $current_time, poster_ip = '" . $this->db->sql_escape($user_ip) . "'", + + 'UPDATE ' . $this->topics_table . " + SET topic_time = $current_time, topic_last_post_time = $current_time", + + 'UPDATE ' . $this->forums_table . " + SET forum_last_post_time = $current_time", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->db->sql_server_info(true)) . "' + WHERE config_name = 'dbms_version'", + ); + + if (@extension_loaded('gd')) + { + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = 'core.captcha.plugins.gd' + WHERE config_name = 'captcha_plugin'"; + + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '1' + WHERE config_name = 'captcha_gd'"; + } + + $ref = substr($referer, strpos($referer, '://') + 3); + if (!(stripos($ref, $server_name) === 0)) + { + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '0' + WHERE config_name = 'referer_validation'"; + } + + // We set a (semi-)unique cookie name to bypass login issues related to the cookie name. + $cookie_name = 'phpbb3_'; + $rand_str = md5(mt_rand()); + $rand_str = str_replace('0', 'z', base_convert($rand_str, 16, 35)); + $rand_str = substr($rand_str, 0, 5); + $cookie_name .= strtolower($rand_str); + + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($cookie_name) . "' + WHERE config_name = 'cookie_name'"; + + // Disable avatars if upload directory is not writable + if (!$this->filesystem->is_writable($this->phpbb_root_path . 'images/avatars/upload/')) + { + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '0' + WHERE config_name = 'allow_avatar'"; + + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '0' + WHERE config_name = 'allow_avatar_upload'"; + } + + $i = $this->install_config->get('add_config_settings_index', 0); + $total = count($sql_ary); + $sql_ary = array_slice($sql_ary, $i); + + foreach ($sql_ary as $sql) + { + if (!$this->db->sql_query($sql)) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + + $i++; + + // Stop execution if resource limit is reached + if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) + { + break; + } + } + + if ($i < $total) + { + $this->install_config->set('add_config_settings_index', $i); + throw new resource_limit_reached_exception(); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_CONFIG_SETTINGS'; + } +} diff --git a/install/update/new/phpbb/install/module/install_database/task/create_schema.php b/install/update/new/phpbb/install/module/install_database/task/create_schema.php new file mode 100644 index 0000000..983bb42 --- /dev/null +++ b/install/update/new/phpbb/install/module/install_database/task/create_schema.php @@ -0,0 +1,227 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_database\task; + +use phpbb\install\exception\resource_limit_reached_exception; + +/** + * Create database schema + */ +class create_schema extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\config + */ + protected $config; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\db\tools\tools_interface + */ + protected $db_tools; + + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config provider + * @param \phpbb\install\helper\database $db_helper Installer's database helper + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem service + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param string $phpbb_root_path Path phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\database $db_helper, + \phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + $phpbb_root_path, + $php_ext) + { + $dbms = $db_helper->get_available_dbms($config->get('dbms')); + $dbms = $dbms[$config->get('dbms')]['DRIVER']; + $factory = new \phpbb\db\tools\factory(); + + $this->db = new $dbms(); + $this->db->sql_connect( + $config->get('dbhost'), + $config->get('dbuser'), + $config->get('dbpasswd'), + $config->get('dbname'), + $config->get('dbport'), + false, + false + ); + + $this->config = $config; + $this->db_tools = $factory->get($this->db); + $this->database_helper = $db_helper; + $this->filesystem = $filesystem; + $this->iohandler = $iohandler; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // As this task may take a large amount of time to complete refreshing the page might be necessary for some + // server configurations with limited resources + if (!$this->config->get('pre_schema_forced_refresh')) + { + if ($this->config->get_time_remaining() < 5) + { + $this->config->set('pre_schema_forced_refresh', true); + throw new resource_limit_reached_exception(); + } + } + + $this->db->sql_return_on_error(true); + + $dbms = $this->config->get('dbms'); + $dbms_info = $this->database_helper->get_available_dbms($dbms); + $schema_name = $dbms_info[$dbms]['SCHEMA']; + $delimiter = $dbms_info[$dbms]['DELIM']; + $table_prefix = $this->config->get('table_prefix'); + + if ($dbms === 'mysql') + { + $schema_name .= '_41'; + } + + $db_schema_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql'; + + // Load database vendor specific code if there is any + if ($this->filesystem->exists($db_schema_path)) + { + $sql_query = @file_get_contents($db_schema_path); + $sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query); + $sql_query = $this->database_helper->remove_comments($sql_query); + $sql_query = $this->database_helper->split_sql_file($sql_query, $delimiter); + + foreach ($sql_query as $sql) + { + if (!$this->db->sql_query($sql)) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + + unset($sql_query); + } + + $change_prefix = false; + + // Generate database schema + if ($this->filesystem->exists($this->phpbb_root_path . 'install/schemas/schema.json')) + { + $db_table_schema = @file_get_contents($this->phpbb_root_path . 'install/schemas/schema.json'); + $db_table_schema = json_decode($db_table_schema, true); + $change_prefix = true; + } + else + { + global $table_prefix; + + $table_prefix = $this->config->get('table_prefix'); + + if (!defined('CONFIG_TABLE')) + { + // We need to include the constants file for the table constants + // when we generate the schema from the migration files. + include ($this->phpbb_root_path . 'includes/constants.' . $this->php_ext); + } + + $finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, null, $this->php_ext); + $migrator_classes = $finder->core_path('phpbb/db/migration/data/')->get_classes(); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($this->db, true); + $schema_generator = new \phpbb\db\migration\schema_generator( + $migrator_classes, + new \phpbb\config\config(array()), + $this->db, + $db_tools, + $this->phpbb_root_path, + $this->php_ext, + $table_prefix + ); + $db_table_schema = $schema_generator->get_schema(); + } + + if (!defined('CONFIG_TABLE')) + { + // CONFIG_TABLE is required by sql_create_index() to check the + // length of index names. However table_prefix is not defined + // here yet, so we need to create the constant ourselves. + define('CONFIG_TABLE', $table_prefix . 'config'); + } + + foreach ($db_table_schema as $table_name => $table_data) + { + $this->db_tools->sql_create_table( + ( ($change_prefix) ? ($table_prefix . substr($table_name, 6)) : $table_name ), + $table_data + ); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_CREATE_DATABASE_SCHEMA'; + } +} diff --git a/install/update/new/phpbb/install/module/install_database/task/set_up_database.php b/install/update/new/phpbb/install/module/install_database/task/set_up_database.php new file mode 100644 index 0000000..4da5ece --- /dev/null +++ b/install/update/new/phpbb/install/module/install_database/task/set_up_database.php @@ -0,0 +1,157 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_database\task; + +/** + * Set up database for table generation + */ +class set_up_database extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\config + */ + protected $config; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $schema_file_path; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config + * @param \phpbb\install\helper\database $db_helper + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * @param string $phpbb_root_path + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\database $db_helper, + \phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + $phpbb_root_path) + { + $dbms = $db_helper->get_available_dbms($config->get('dbms')); + $dbms = $dbms[$config->get('dbms')]['DRIVER']; + + $this->db = new $dbms(); + $this->db->sql_connect( + $config->get('dbhost'), + $config->get('dbuser'), + $config->get('dbpasswd'), + $config->get('dbname'), + $config->get('dbport'), + false, + false + ); + + $this->config = $config; + $this->database_helper = $db_helper; + $this->filesystem = $filesystem; + $this->iohandler = $iohandler; + $this->phpbb_root_path = $phpbb_root_path; + + parent::__construct(false); + } + + /** + * {@inheritdoc} + */ + public function check_requirements() + { + $dbms = $this->config->get('dbms'); + $dbms_info = $this->database_helper->get_available_dbms($dbms); + $schema_name = $dbms_info[$dbms]['SCHEMA']; + + if ($dbms === 'mysql') + { + $schema_name .= '_41'; + } + + $this->schema_file_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql'; + + return $this->filesystem->exists($this->schema_file_path); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $dbms = $this->config->get('dbms'); + $dbms_info = $this->database_helper->get_available_dbms($dbms); + $delimiter = $dbms_info[$dbms]['DELIM']; + $table_prefix = $this->config->get('table_prefix'); + + $sql_query = @file_get_contents($this->schema_file_path); + $sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query); + $sql_query = $this->database_helper->remove_comments($sql_query); + $sql_query = $this->database_helper->split_sql_file($sql_query, $delimiter); + + foreach ($sql_query as $sql) + { + if (!$this->db->sql_query($sql)) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + + unset($sql_query); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_SETUP_DATABASE'; + } +} diff --git a/install/update/new/phpbb/install/module/install_filesystem/task/create_config_file.php b/install/update/new/phpbb/install/module/install_filesystem/task/create_config_file.php new file mode 100644 index 0000000..900d5b9 --- /dev/null +++ b/install/update/new/phpbb/install/module/install_filesystem/task/create_config_file.php @@ -0,0 +1,243 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_filesystem\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * Dumps config file + */ +class create_config_file extends \phpbb\install\task_base +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\database + */ + protected $db_helper; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * @var array + */ + protected $options; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param \phpbb\install\helper\config $install_config + * @param \phpbb\install\helper\database $db_helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * @param string $phpbb_root_path + * @param string $php_ext + * @param array $options + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\config $install_config, + \phpbb\install\helper\database $db_helper, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + $phpbb_root_path, + $php_ext, + $options = array()) + { + $this->install_config = $install_config; + $this->db_helper = $db_helper; + $this->filesystem = $filesystem; + $this->iohandler = $iohandler; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->options = array_merge(array( + 'debug' => false, + 'debug_container' => false, + 'environment' => null, + ), $options); + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $config_written = true; + + // Create config.php + $path_to_config = $this->phpbb_root_path . 'config.' . $this->php_ext; + + $fp = @fopen($path_to_config, 'w'); + if (!$fp) + { + $config_written = false; + } + + $config_content = $this->get_config_data($this->options['debug'], $this->options['debug_container'], $this->options['environment']); + + if (!@fwrite($fp, $config_content)) + { + $config_written = false; + } + + @fclose($fp); + + // chmod config.php to be only readable + if ($config_written) + { + try + { + $this->filesystem->phpbb_chmod($path_to_config, \phpbb\filesystem\filesystem_interface::CHMOD_READ); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing, the user will get a notice later + } + } + else + { + $this->iohandler->add_error_message('UNABLE_TO_WRITE_CONFIG_FILE'); + throw new user_interaction_required_exception(); + } + + // Create a lock file to indicate that there is an install in progress + $fp = @fopen($this->phpbb_root_path . 'cache/install_lock', 'wb'); + if ($fp === false) + { + // We were unable to create the lock file - abort + $this->iohandler->add_error_message('UNABLE_TO_WRITE_LOCK'); + throw new user_interaction_required_exception(); + } + @fclose($fp); + + try + { + $this->filesystem->phpbb_chmod($this->phpbb_root_path . 'cache/install_lock', 0777); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing, the user will get a notice later + } + } + + /** + * Returns the content which should be dumped to config.php + * + * @param bool $debug If the debug constants should be enabled by default or not + * @param bool $debug_container If the container should be compiled on + * every page load or not + * @param string $environment The environment to use + * + * @return string content to be written to the config file + */ + protected function get_config_data($debug = false, $debug_container = false, $environment = null) + { + $config_content = "install_config->get('dbms'); + $db_driver = $this->db_helper->get_available_dbms($dbms); + $db_driver = $db_driver[$dbms]['DRIVER']; + + $config_data_array = array( + 'dbms' => $db_driver, + 'dbhost' => $this->install_config->get('dbhost'), + 'dbport' => $this->install_config->get('dbport'), + 'dbname' => $this->install_config->get('dbname'), + 'dbuser' => $this->install_config->get('dbuser'), + 'dbpasswd' => $this->install_config->get('dbpasswd'), + 'table_prefix' => $this->install_config->get('table_prefix'), + + 'phpbb_adm_relative_path' => 'adm/', + + 'acm_type' => 'phpbb\cache\driver\file', + ); + + foreach ($config_data_array as $key => $value) + { + $config_content .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n"; + } + + $config_content .= "\n@define('PHPBB_INSTALLED', true);\n"; + + if ($environment) + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'test');\n"; + } + else if ($debug) + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'development');\n"; + } + else + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'production');\n"; + } + + if ($debug_container) + { + $config_content .= "@define('DEBUG_CONTAINER', true);\n"; + } + else + { + $config_content .= "// @define('DEBUG_CONTAINER', true);\n"; + } + + if ($environment === 'test') + { + $config_content .= "@define('DEBUG_TEST', true);\n"; + + // Mandatory for the functional tests, will be removed by PHPBB3-12623 + $config_content .= "@define('DEBUG', true);\n"; + } + + return $config_content; + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_CREATE_CONFIG_FILE'; + } +} diff --git a/install/update/new/phpbb/install/module/requirements/task/check_server_environment.php b/install/update/new/phpbb/install/module/requirements/task/check_server_environment.php new file mode 100644 index 0000000..41aa826 --- /dev/null +++ b/install/update/new/phpbb/install/module/requirements/task/check_server_environment.php @@ -0,0 +1,207 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\requirements\task; + +/** + * Installer task that checks if the server meats phpBB requirements + */ +class check_server_environment extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $response_helper; + + /** + * @var bool + */ + protected $tests_passed; + + /** + * Constructor + * + * @param \phpbb\install\helper\database $database_helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $response + */ + public function __construct(\phpbb\install\helper\database $database_helper, + \phpbb\install\helper\iohandler\iohandler_interface $response) + { + $this->database_helper = $database_helper; + $this->response_helper = $response; + $this->tests_passed = true; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // + // Check requirements + // The error messages should be set in the check_ functions + // + + // Check PHP version + $this->check_php_version(); + + // Check for getimagesize() + $this->check_image_size(); + + // Check for PCRE support + $this->check_pcre(); + + // Check for JSON support + $this->check_json(); + + // XML extension support check + $this->check_xml(); + + // Check for dbms support + $this->check_available_dbms(); + + return $this->tests_passed; + } + + /** + * Sets $this->tests_passed + * + * @param bool $is_passed + */ + protected function set_test_passed($is_passed) + { + // If one test failed, tests_passed should be false + $this->tests_passed = (!$this->tests_passed) ? false : $is_passed; + } + + /** + * Check if the requirements for PHP version is met + */ + protected function check_php_version() + { + if (version_compare(PHP_VERSION, '7.1.3', '<')) + { + $this->response_helper->add_error_message('PHP_VERSION_REQD', 'PHP_VERSION_REQD_EXPLAIN'); + + $this->set_test_passed(false); + return; + } + + $this->set_test_passed(true); + } + + /** + * Checks if the installed PHP has getimagesize() available + */ + protected function check_image_size() + { + if (!@function_exists('getimagesize')) + { + $this->response_helper->add_error_message('PHP_GETIMAGESIZE_SUPPORT', 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + return; + } + + $this->set_test_passed(true); + } + + /** + * Checks if the installed PHP supports PCRE + */ + protected function check_pcre() + { + if (@preg_match('//u', '')) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PCRE_UTF_SUPPORT', 'PCRE_UTF_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * Checks whether PHP's JSON extension is available or not + */ + protected function check_json() + { + if (@extension_loaded('json')) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PHP_JSON_SUPPORT', 'PHP_JSON_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * Checks whether or not the XML PHP extension is available (Required by the text formatter) + */ + protected function check_xml() + { + if (class_exists('DOMDocument')) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PHP_XML_SUPPORT', 'PHP_XML_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * Check if any supported DBMS is available + */ + protected function check_available_dbms() + { + $available_dbms = $this->database_helper->get_available_dbms(false, true); + + if ($available_dbms['ANY_DB_SUPPORT']) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PHP_SUPPORTED_DB', 'PHP_SUPPORTED_DB_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/install/update/new/phpbb/install/module_base.php b/install/update/new/phpbb/install/module_base.php new file mode 100644 index 0000000..4464a89 --- /dev/null +++ b/install/update/new/phpbb/install/module_base.php @@ -0,0 +1,213 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install; + +use phpbb\di\ordered_service_collection; +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; + +/** + * Base class for installer module + */ +abstract class module_base implements module_interface +{ + /** + * @var config + */ + protected $install_config; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var bool + */ + protected $is_essential; + + /** + * Array of tasks for installer module + * + * @var ordered_service_collection + */ + protected $task_collection; + + /** + * @var array + */ + protected $task_step_count; + + /** + * @var bool + */ + protected $allow_progress_bar; + + /** + * Installer module constructor + * + * @param ordered_service_collection $tasks array of installer tasks for installer module + * @param bool $essential flag indicating whether the module is essential or not + * @param bool $allow_progress_bar flag indicating whether or not to send progress information from within the module + */ + public function __construct(ordered_service_collection $tasks, $essential = true, $allow_progress_bar = true) + { + $this->task_collection = $tasks; + $this->is_essential = $essential; + $this->allow_progress_bar = $allow_progress_bar; + } + + /** + * Dependency getter + * + * @param config $config + * @param iohandler_interface $iohandler + */ + public function setup(config $config, iohandler_interface $iohandler) + { + $this->install_config = $config; + $this->iohandler = $iohandler; + } + + /** + * {@inheritdoc} + */ + public function is_essential() + { + return $this->is_essential; + } + + /** + * {@inheritdoc} + * + * Overwrite this method if your task is non-essential! + */ + public function check_requirements() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Recover install progress + $task_index = $this->recover_progress(); + $iterator = $this->task_collection->getIterator(); + + if ($task_index < $iterator->count()) + { + $iterator->seek($task_index); + } + else + { + $this->install_config->set_finished_task(0); + return; + } + + while ($iterator->valid()) + { + $task = $iterator->current(); + $name = $iterator->key(); + + // Check if we can run the task + if (!$task->is_essential() && !$task->check_requirements()) + { + $this->iohandler->add_log_message(array( + 'SKIP_TASK', + $name, + )); + + $this->install_config->increment_current_task_progress($this->task_step_count[$name] ?? false); + } + else + { + // Send progress information + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + + $this->iohandler->send_response(); + } + + $task->run(); + + if ($this->allow_progress_bar) + { + // Only increment progress by one, as if a task has more than one steps + // then that should be incremented in the task itself + $this->install_config->increment_current_task_progress(); + } + } + + $task_index++; + $this->install_config->set_finished_task($task_index); + $iterator->next(); + + // Send progress information + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + } + + $this->iohandler->send_response(); + + // Stop execution if resource limit is reached + if ($iterator->valid() && ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)) + { + throw new resource_limit_reached_exception(); + } + } + + // Module finished, so clear task progress + $this->install_config->set_finished_task(0); + } + + /** + * Returns the next task's name + * + * @return string Index of the array element of the next task + */ + protected function recover_progress() + { + $progress_array = $this->install_config->get_progress_data(); + return $progress_array['last_task_index']; + } + + /** + * {@inheritdoc} + */ + public function get_step_count() + { + $task_step_count = 0; + $task_class_names = $this->task_collection->get_service_classes(); + + foreach ($task_class_names as $name => $task_class) + { + $step_count = $task_class::get_step_count(); + $task_step_count += $step_count; + $this->task_step_count[$name] = $step_count; + } + + return $task_step_count; + } +} diff --git a/install/update/new/phpbb/language/language_file_loader.php b/install/update/new/phpbb/language/language_file_loader.php new file mode 100644 index 0000000..2910dd3 --- /dev/null +++ b/install/update/new/phpbb/language/language_file_loader.php @@ -0,0 +1,207 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\language; + +use \phpbb\language\exception\language_file_not_found; + +/** + * Language file loader + */ +class language_file_loader +{ + /** + * @var string Path to phpBB's root + */ + protected $phpbb_root_path; + + /** + * @var string Extension of PHP files + */ + protected $php_ext; + + /** + * @var \phpbb\extension\manager Extension manager + */ + protected $extension_manager; + + /** + * Constructor + * + * @param string $phpbb_root_path Path to phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->extension_manager = null; + } + + /** + * Extension manager setter + * + * @param \phpbb\extension\manager $extension_manager Extension manager + */ + public function set_extension_manager(\phpbb\extension\manager $extension_manager) + { + $this->extension_manager = $extension_manager; + } + + /** + * Loads language array for the given component + * + * @param string $component Name of the language component + * @param string|array $locale ISO code of the language to load, or array of ISO codes if you want to + * specify additional language fallback steps + * @param array $lang Array reference containing language strings + */ + public function load($component, $locale, &$lang) + { + $locale = (array) $locale; + + // Determine path to language directory + $path = $this->phpbb_root_path . 'language/'; + + $this->load_file($path, $component, $locale, $lang); + } + + /** + * Loads language array for the given extension component + * + * @param string $extension Name of the extension + * @param string $component Name of the language component + * @param string|array $locale ISO code of the language to load, or array of ISO codes if you want to + * specify additional language fallback steps + * @param array $lang Array reference containing language strings + */ + public function load_extension($extension, $component, $locale, &$lang) + { + // Check if extension manager was loaded + if ($this->extension_manager === null) + { + // If not, let's return + return; + } + + $locale = (array) $locale; + + // Determine path to language directory + $path = $this->extension_manager->get_extension_path($extension, true) . 'language/'; + + $this->load_file($path, $component, $locale, $lang); + } + + /** + * Prepares language file loading + * + * @param string $path Path to search for file in + * @param string $component Name of the language component + * @param array $locale Array containing language fallback options + * @param array $lang Array reference of language strings + */ + protected function load_file($path, $component, $locale, &$lang) + { + // This is BC stuff and not the best idea as it makes language fallback + // implementation quite hard like below. + if (strpos($this->phpbb_root_path . $component, $path) === 0) + { + // Filter out the path + $path_diff = str_replace($path, '', dirname($this->phpbb_root_path . $component)); + $language_file = basename($component, '.' . $this->php_ext); + $component = ''; + + // This step is needed to resolve language/en/subdir style $component + // $path already points to the language base directory so we need to eliminate + // the first directory from the path (that should be the language directory) + $path_diff_parts = explode('/', $path_diff); + + if (count($path_diff_parts) > 1) + { + array_shift($path_diff_parts); + $component = implode('/', $path_diff_parts) . '/'; + } + + $component .= $language_file; + } + + // Determine filename + $filename = $component . '.' . $this->php_ext; + + // Determine path to file + $file_path = $this->get_language_file_path($path, $filename, $locale); + + // Load language array + $this->load_language_file($file_path, $lang); + } + + /** + * This function implements language fallback logic + * + * @param string $path Path to language directory + * @param string $filename Filename to load language strings from + * @param array $locales Array containing language fallback options + * + * @return string Relative path to language file + * + * @throws language_file_not_found When the path to the file cannot be resolved + */ + protected function get_language_file_path($path, $filename, $locales) + { + $language_file_path = $filename; + + // Language fallback logic + foreach ($locales as $locale) + { + $language_file_path = $path . $locale . '/' . $filename; + + // If we are in install, try to use the updated version, when available + if (defined('IN_INSTALL')) + { + $install_language_path = str_replace('language/', 'install/update/new/language/', $language_file_path); + if (file_exists($install_language_path)) + { + return $install_language_path; + } + } + + if (file_exists($language_file_path)) + { + return $language_file_path; + } + } + + // The language file is not exist + throw new language_file_not_found('Language file ' . $language_file_path . ' couldn\'t be opened.'); + } + + /** + * Loads language file + * + * @param string $path Path to language file to load + * @param array $lang Reference of the array of language strings + */ + protected function load_language_file($path, &$lang) + { + // Do not suppress error if in DEBUG mode + if (defined('DEBUG')) + { + include $path; + } + else + { + @include $path; + } + } +} diff --git a/install/update/new/phpbb/lock/db.php b/install/update/new/phpbb/lock/db.php new file mode 100644 index 0000000..eea919f --- /dev/null +++ b/install/update/new/phpbb/lock/db.php @@ -0,0 +1,153 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\lock; + +/** +* Database locking class +*/ +class db +{ + /** + * Name of the config variable this lock uses + * @var string + */ + private $config_name; + + /** + * Unique identifier for this lock. + * + * @var string + */ + private $unique_id; + + /** + * Stores the state of this lock + * @var bool + */ + private $locked; + + /** + * The phpBB configuration + * @var \phpbb\config\config + */ + private $config; + + /** + * A database connection + * @var \phpbb\db\driver\driver_interface + */ + private $db; + + /** + * Creates a named released instance of the lock. + * + * You have to call acquire() to actually create the lock. + * + * @param string $config_name A config variable to be used for locking + * @param \phpbb\config\config $config The phpBB configuration + * @param \phpbb\db\driver\driver_interface $db A database connection + */ + public function __construct($config_name, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db) + { + $this->config_name = $config_name; + $this->config = $config; + $this->db = $db; + } + + /** + * Tries to acquire the lock by updating + * the configuration variable in the database. + * + * As a lock may only be held by one process at a time, lock + * acquisition may fail if another process is holding the lock + * or if another process obtained the lock but never released it. + * Locks are forcibly released after a timeout of 1 hour. + * + * @return bool true if lock was acquired + * false otherwise + */ + public function acquire() + { + if ($this->locked) + { + return false; + } + + if (!isset($this->config[$this->config_name])) + { + $this->config->set($this->config_name, '0', false); + } + $lock_value = $this->config[$this->config_name]; + + // make sure lock cannot be acquired by multiple processes + if ($lock_value) + { + // if the other process is running more than an hour already we have to assume it + // aborted without cleaning the lock + $time = explode(' ', $lock_value); + $time = $time[0]; + + if ($time + 3600 >= time()) + { + return false; + } + } + + $this->unique_id = time() . ' ' . unique_id(); + + // try to update the config value, if it was already modified by another + // process we failed to acquire the lock. + $this->locked = $this->config->set_atomic($this->config_name, $lock_value, $this->unique_id, false); + + if ($this->locked == true) + { + if ($this->config->ensure_lock($this->config_name, $this->unique_id)) + { + return true; + } + } + return $this->locked; + } + + /** + * Does this process own the lock? + * + * @return bool true if lock is owned + * false otherwise + */ + public function owns_lock() + { + return (bool) $this->locked; + } + + /** + * Releases the lock. + * + * The lock must have been previously obtained, that is, acquire() call + * was issued and returned true. + * + * Note: Attempting to release a lock that is already released, + * that is, calling release() multiple times, is harmless. + * + * @return null + */ + public function release() + { + if ($this->locked) + { + $this->config->set_atomic($this->config_name, $this->unique_id, '0', false); + $this->locked = false; + } + } +} diff --git a/install/update/new/phpbb/lock/flock.php b/install/update/new/phpbb/lock/flock.php new file mode 100644 index 0000000..af051af --- /dev/null +++ b/install/update/new/phpbb/lock/flock.php @@ -0,0 +1,144 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\lock; + +/** +* File locking class +*/ +class flock +{ + /** + * Path to the file to which access is controlled + * + * @var string + */ + private $path; + + /** + * File pointer for the lock file + * @var string + */ + private $lock_fp; + + /** + * Constructor. + * + * You have to call acquire() to actually acquire the lock. + * + * @param string $path Path to the file to which access is controlled + */ + public function __construct($path) + { + $this->path = $path; + $this->lock_fp = null; + } + + /** + * Tries to acquire the lock. + * + * If the lock is already held by another process, this call will block + * until the other process releases the lock. If a lock is acquired and + * is not released before script finishes but the process continues to + * live (apache/fastcgi) then subsequent processes trying to acquire + * the same lock will be blocked forever. + * + * If the lock is already held by the same process via another instance + * of this class, this call will block forever. + * + * If flock function is disabled in php or fails to work, lock + * acquisition will fail and false will be returned. + * + * @return bool true if lock was acquired + * false otherwise + */ + public function acquire() + { + if ($this->lock_fp) + { + return false; + } + + // For systems that can't have two processes opening + // one file for writing simultaneously + if (file_exists($this->path . '.lock')) + { + $mode = 'rb'; + } + else + { + $mode = 'wb'; + } + + $this->lock_fp = @fopen($this->path . '.lock', $mode); + + if ($mode == 'wb') + { + if (!$this->lock_fp) + { + // Two processes may attempt to create lock file at the same time. + // Have the losing process try opening the lock file again for reading + // on the assumption that the winning process created it + $mode = 'rb'; + $this->lock_fp = @fopen($this->path . '.lock', $mode); + } + else + { + // Only need to set mode when the lock file is written + @chmod($this->path . '.lock', 0666); + } + } + + if ($this->lock_fp) + { + if (!@flock($this->lock_fp, LOCK_EX)) + { + throw new \phpbb\exception\http_exception(500, 'Failure while aqcuiring locks.'); + } + } + + return (bool) $this->lock_fp; + } + + /** + * Does this process own the lock? + * + * @return bool true if lock is owned + * false otherwise + */ + public function owns_lock() + { + return (bool) $this->lock_fp; + } + + /** + * Releases the lock. + * + * The lock must have been previously obtained, that is, acquire() call + * was issued and returned true. + * + * Note: Attempting to release a lock that is already released, + * that is, calling release() multiple times, is harmless. + * + * @return null + */ + public function release() + { + if ($this->lock_fp) + { + @flock($this->lock_fp, LOCK_UN); + fclose($this->lock_fp); + $this->lock_fp = null; + } + } +} diff --git a/install/update/new/phpbb/message/form.php b/install/update/new/phpbb/message/form.php new file mode 100644 index 0000000..6573a04 --- /dev/null +++ b/install/update/new/phpbb/message/form.php @@ -0,0 +1,175 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\message; + +/** +* Abstract class form +*/ +abstract class form +{ + /** @var \phpbb\auth\auth */ + protected $auth; + /** @var \phpbb\config\config */ + protected $config; + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + /** @var \phpbb\message\message */ + protected $message; + /** @var \phpbb\user */ + protected $user; + + /** @var string */ + protected $phpbb_root_path; + /** @var string */ + protected $phpEx; + + /** @var array */ + protected $errors = array(); + /** @var bool */ + protected $cc_sender; + /** @var string */ + protected $body; + + /** + * Construct + * + * @param \phpbb\auth\auth $auth + * @param \phpbb\config\config $config + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\user $user + * @param string $phpbb_root_path + * @param string $phpEx + */ + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $phpEx) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + $this->user = $user; + $this->auth = $auth; + $this->config = $config; + $this->db = $db; + + $this->message = new message($config['server_name']); + $this->message->set_sender_from_user($this->user); + } + + /** + * Returns the title for the email form page + * + * @return string + */ + public function get_page_title() + { + return $this->user->lang['SEND_EMAIL']; + } + + /** + * Returns the file name of the form template + * + * @return string + */ + public function get_template_file() + { + return 'memberlist_email.html'; + } + + /** + * Checks whether the user is allowed to use the form + * + * @return false|string Error string if not allowed, false otherwise + */ + public function check_allow() + { + if (!$this->config['email_enable']) + { + return 'EMAIL_DISABLED'; + } + + if (time() - $this->user->data['user_emailtime'] < $this->config['flood_interval']) + { + return 'FLOOD_EMAIL_LIMIT'; + } + + return false; + } + + /** + * Get the return link after the message has been sent + * + * @return string + */ + public function get_return_message() + { + return sprintf($this->user->lang['RETURN_INDEX'], '', ''); + } + + /** + * Bind the values of the request to the form + * + * @param \phpbb\request\request_interface $request + * @return null + */ + public function bind(\phpbb\request\request_interface $request) + { + $this->cc_sender = $request->is_set_post('cc_sender'); + $this->body = $request->variable('message', '', true); + } + + /** + * Submit form, generate the email and send it + * + * @param \messenger $messenger + * @return null + */ + public function submit(\messenger $messenger) + { + if (!check_form_key('memberlist_email')) + { + $this->errors[] = $this->user->lang('FORM_INVALID'); + } + + if (!count($this->errors)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_emailtime = ' . time() . ' + WHERE user_id = ' . $this->user->data['user_id']; + $this->db->sql_query($sql); + + if ($this->cc_sender && $this->user->data['is_registered']) + { + $this->message->cc_sender(); + } + + $this->message->send($messenger, phpbb_get_board_contact($this->config, $this->phpEx)); + + meta_refresh(3, append_sid($this->phpbb_root_path . 'index.' . $this->phpEx)); + trigger_error($this->user->lang['EMAIL_SENT'] . '

' . $this->get_return_message()); + } + } + + /** + * Render the template of the form + * + * @param \phpbb\template\template $template + * @return null + */ + public function render(\phpbb\template\template $template) + { + add_form_key('memberlist_email'); + + $template->assign_vars(array( + 'ERROR_MESSAGE' => (count($this->errors)) ? implode('
', $this->errors) : '', + )); + } +} diff --git a/install/update/new/phpbb/mimetype/guesser.php b/install/update/new/phpbb/mimetype/guesser.php new file mode 100644 index 0000000..f8cbffe --- /dev/null +++ b/install/update/new/phpbb/mimetype/guesser.php @@ -0,0 +1,156 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\mimetype; + +class guesser +{ + /** + * @const Default priority for mimetype guessers + */ + const PRIORITY_DEFAULT = 0; + + /** + * @var array guessers + */ + protected $guessers; + + /** + * Construct a mimetype guesser object + * + * @param array $mimetype_guessers Mimetype guesser service collection + */ + public function __construct($mimetype_guessers) + { + $this->register_guessers($mimetype_guessers); + } + + /** + * Register MimeTypeGuessers and sort them by priority + * + * @param array $mimetype_guessers Mimetype guesser service collection + * + * @throws \LogicException If incorrect or not mimetype guessers have + * been supplied to class + */ + protected function register_guessers($mimetype_guessers) + { + foreach ($mimetype_guessers as $guesser) + { + $is_supported = (method_exists($guesser, 'is_supported')) ? 'is_supported' : ''; + $is_supported = (method_exists($guesser, 'isSupported')) ? 'isSupported' : $is_supported; + + if (empty($is_supported)) + { + throw new \LogicException('Incorrect mimetype guesser supplied.'); + } + + if ($guesser->$is_supported()) + { + $this->guessers[] = $guesser; + } + } + + if (empty($this->guessers)) + { + throw new \LogicException('No mimetype guesser supplied.'); + } + + // Sort guessers by priority + usort($this->guessers, array($this, 'sort_priority')); + } + + /** + * Sort the priority of supplied guessers + * This is a compare function for usort. A guesser with higher priority + * should be used first and vice versa. usort() orders the array values + * from low to high depending on what the comparison function returns + * to it. Return value should be smaller than 0 if value a is smaller + * than value b. This has been reversed in the comparison function in + * order to sort the guessers from high to low. + * Method has been set to public in order to allow proper testing. + * + * @param object $guesser_a Mimetype guesser a + * @param object $guesser_b Mimetype guesser b + * + * @return int If both guessers have the same priority 0, bigger + * than 0 if first guesser has lower priority, and lower + * than 0 if first guesser has higher priority + */ + public function sort_priority($guesser_a, $guesser_b) + { + $priority_a = (int) (method_exists($guesser_a, 'get_priority')) ? $guesser_a->get_priority() : self::PRIORITY_DEFAULT; + $priority_b = (int) (method_exists($guesser_b, 'get_priority')) ? $guesser_b->get_priority() : self::PRIORITY_DEFAULT; + + return $priority_b - $priority_a; + } + + /** + * Guess mimetype of supplied file + * + * @param string $file Path to file + * @param string $file_name The real file name + * + * @return string Guess for mimetype of file + */ + public function guess($file, $file_name = '') + { + if (!is_file($file)) + { + return false; + } + + if (!is_readable($file)) + { + return false; + } + + $mimetype = 'application/octet-stream'; + + foreach ($this->guessers as $guesser) + { + $mimetype_guess = $guesser->guess($file, $file_name); + + $mimetype = $this->choose_mime_type($mimetype, $mimetype_guess); + } + // Return any mimetype if we got a result or the fallback value + return $mimetype; + } + + /** + * Choose the best mime type based on the current mime type and the guess + * If a guesser returns nulls or application/octet-stream, we will keep + * the current guess. Guesses with a slash inside them will be favored over + * already existing ones. However, any guess that will pass the first check + * will always overwrite the default application/octet-stream. + * + * @param string $mime_type The current mime type + * @param string $guess The current mime type guess + * + * @return string The best mime type based on current mime type and guess + */ + public function choose_mime_type($mime_type, $guess) + { + if ($guess === null || $guess == 'application/octet-stream') + { + return $mime_type; + } + + if ($mime_type == 'application/octet-stream' || strpos($guess, '/') !== false) + { + $mime_type = $guess; + } + + return $mime_type; + } +} diff --git a/install/update/new/phpbb/notification/type/approve_post.php b/install/update/new/phpbb/notification/type/approve_post.php new file mode 100644 index 0000000..139b5fa --- /dev/null +++ b/install/update/new/phpbb/notification/type/approve_post.php @@ -0,0 +1,146 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Post approved notifications class +* This class handles notifications for posts when they are approved (to their authors) +*/ + +class approve_post extends \phpbb\notification\type\post +{ + /** + * Get notification type name + * + * @return string + */ + public function get_type() + { + return 'notification.type.approve_post'; + } + + /** + * Language key used to output the text + * + * @var string + */ + protected $language_key = 'NOTIFICATION_POST_APPROVED'; + + /** + * Inherit notification read status from post. + * + * @var bool + */ + protected $inherit_read_status = false; + + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use it's default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + static public $notification_option = array( + 'id' => 'moderation_queue', + 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', + 'group' => 'NOTIFICATION_GROUP_POSTING', + ); + + /** + * Is available + */ + public function is_available() + { + return !$this->auth->acl_get('m_approve'); + } + + /** + * Find the users who want to receive notifications + * + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification + * + * @return array + */ + public function find_users_for_notification($post, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + ), $options); + + return $this->get_authorised_recipients(array($post['poster_id']), $post['forum_id'], array_merge($options, array( + 'item_type' => static::$notification_option['id'], + ))); + } + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $post Post data from submit_post + * @param array $notify_users Notify users list + * Formatted from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($post, $notify_users) + { + // In the parent class, this is used to check if the post is already + // read by a user and marks the notification read if it was marked read. + // Returning an empty array in effect, forces it to be marked as unread + // (and also saves a query) + return array(); + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($post, $pre_create_data = array()) + { + $this->set_data('post_subject', $post['post_subject']); + + parent::create_insert_array($post, $pre_create_data); + + $this->notification_time = time(); + } + + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; + + return $data; + } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'post_approved'; + } + + /** + * {inheritDoc} + */ + public function get_redirect_url() + { + return $this->get_url(); + } +} diff --git a/install/update/new/phpbb/notification/type/approve_topic.php b/install/update/new/phpbb/notification/type/approve_topic.php new file mode 100644 index 0000000..0c34364 --- /dev/null +++ b/install/update/new/phpbb/notification/type/approve_topic.php @@ -0,0 +1,137 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Topic approved notifications class +* This class handles notifications for topics when they are approved (for authors) +*/ + +class approve_topic extends \phpbb\notification\type\topic +{ + /** + * Get notification type name + * + * @return string + */ + public function get_type() + { + return 'notification.type.approve_topic'; + } + + /** + * Language key used to output the text + * + * @var string + */ + protected $language_key = 'NOTIFICATION_TOPIC_APPROVED'; + + /** + * Inherit notification read status from topic. + * + * @var bool + */ + protected $inherit_read_status = false; + + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use it's default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + static public $notification_option = array( + 'id' => 'moderation_queue', + 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', + 'group' => 'NOTIFICATION_GROUP_POSTING', + ); + + /** + * Is available + */ + public function is_available() + { + return !$this->auth->acl_get('m_approve'); + } + + /** + * Find the users who want to receive notifications + * + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification + * + * @return array + */ + public function find_users_for_notification($post, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + ), $options); + + return $this->get_authorised_recipients(array($post['poster_id']), $post['forum_id'], array_merge($options, array( + 'item_type' => static::$notification_option['id'], + ))); + } + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $post Post data from submit_post + * @param array $notify_users Notify users list + * Formatted from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($post, $notify_users) + { + // In the parent class, this is used to check if the post is already + // read by a user and marks the notification read if it was marked read. + // Returning an empty array in effect, forces it to be marked as unread + // (and also saves a query) + return array(); + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($post, $pre_create_data = array()) + { + + parent::create_insert_array($post, $pre_create_data); + + $this->notification_time = time(); + } + + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; + + return $data; + } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'topic_approved'; + } +} diff --git a/install/update/new/phpbb/notification/type/base.php b/install/update/new/phpbb/notification/type/base.php new file mode 100644 index 0000000..e4600ad --- /dev/null +++ b/install/update/new/phpbb/notification/type/base.php @@ -0,0 +1,577 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Base notifications class +*/ +abstract class base implements \phpbb\notification\type\type_interface +{ + /** @var \phpbb\notification\manager */ + protected $notification_manager; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\auth\auth */ + protected $auth; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** @var string */ + protected $user_notifications_table; + + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use its default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + static public $notification_option = false; + + /** + * The notification_type_id, set upon creation of the class + * This is the notification_type_id from the notification_types table + * + * @var int + */ + protected $notification_type_id; + + /** + * Identification data + * notification_type_id - ID of the item type (auto generated, from notification types table) + * item_id - ID of the item (e.g. post_id, msg_id) + * item_parent_id - Parent item id (ex: for topic => forum_id, for post => topic_id, etc) + * user_id + * notification_read + * notification_time + * notification_data (special serialized field that each notification type can use to store stuff) + * + * @var array $data Notification row from the database + * This must be private, all interaction should use __get(), __set(), get_data(), set_data() + */ + private $data = array(); + + /** + * Notification Type Base Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\language\language $language + * @param \phpbb\user $user + * @param \phpbb\auth\auth $auth + * @param string $phpbb_root_path + * @param string $php_ext + * @param string $user_notifications_table + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\language\language $language, \phpbb\user $user, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext, $user_notifications_table) + { + $this->db = $db; + $this->language = $language; + $this->user = $user; + $this->auth = $auth; + + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->user_notifications_table = $user_notifications_table; + } + + /** + * Set notification manager (required) + * + * @param \phpbb\notification\manager $notification_manager + */ + public function set_notification_manager(\phpbb\notification\manager $notification_manager) + { + $this->notification_manager = $notification_manager; + + $this->notification_type_id = $this->notification_manager->get_notification_type_id($this->get_type()); + } + + /** + * Set initial data from the database + * + * @param array $data Row directly from the database + */ + public function set_initial_data($data = array()) + { + // The row from the database (unless this is a new notification we're going to add) + $this->data = $data; + $this->data['notification_data'] = (isset($this->data['notification_data'])) ? unserialize($this->data['notification_data']) : array(); + } + + /** + * Magic method to get data from this notification + * + * @param mixed $name + * @return mixed + */ + public function __get($name) + { + return (!isset($this->data[$name])) ? null : $this->data[$name]; + } + + + /** + * Magic method to set data on this notification + * + * @param mixed $name + * @param mixed $value + * + * @return null + */ + public function __set($name, $value) + { + $this->data[$name] = $value; + } + + + /** + * Magic method to get a string of this notification + * + * Primarily for testing + * + * @return mixed + */ + public function __toString() + { + return (!empty($this->data)) ? var_export($this->data, true) : $this->get_type(); + } + + /** + * Get special data (only important for the classes that extend this) + * + * @param string $name Name of the variable to get + * @return mixed + */ + protected function get_data($name) + { + return ($name === false) ? $this->data['notification_data'] : ((isset($this->data['notification_data'][$name])) ? $this->data['notification_data'][$name] : null); + } + + /** + * Set special data (only important for the classes that extend this) + * + * @param string $name Name of the variable to set + * @param mixed $value Value to set to the variable + * @return mixed + */ + protected function set_data($name, $value) + { + $this->data['notification_data'][$name] = $value; + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($type_data, $pre_create_data = array()) + { + // Defaults + $this->data = array_merge(array( + 'item_id' => static::get_item_id($type_data), + 'notification_type_id' => $this->notification_type_id, + 'item_parent_id' => static::get_item_parent_id($type_data), + + 'notification_time' => time(), + 'notification_read' => false, + + 'notification_data' => array(), + ), $this->data); + } + + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = $this->data; + + $data['notification_data'] = serialize($data['notification_data']); + + return $data; + } + + /** + * Function for preparing the data for update in an SQL query + * (The service handles insertion) + * + * @param array $type_data Data unique to this notification type + * @return array Array of data ready to be updated in the database + */ + public function create_update_array($type_data) + { + $this->create_insert_array($type_data); + $data = $this->get_insert_array(); + + // Unset data unique to each row + unset( + $data['notification_time'], // Also unsetting time, since it always tries to change the time to current (if you actually need to change the time, over-ride this function) + $data['notification_id'], + $data['notification_read'], + $data['user_id'] + ); + + return $data; + } + + /** + * Mark this item read + * + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string|null If $return is False, nothing will be returned, else the sql code to update this item + */ + public function mark_read($return = false) + { + return $this->mark(false, $return); + } + + /** + * Mark this item unread + * + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string|null If $return is False, nothing will be returned, else the sql code to update this item + */ + public function mark_unread($return = false) + { + return $this->mark(true, $return); + } + + /** + * {inheritDoc} + */ + public function get_redirect_url() + { + return $this->get_url(); + } + + /** + * Prepare to output the notification to the template + * + * @return array Template variables + */ + public function prepare_for_display() + { + $mark_hash = generate_link_hash('mark_notification_read'); + + if ($this->get_url()) + { + $u_mark_read = append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id . '&hash=' . $mark_hash); + } + else + { + $redirect = (($this->user->page['page_dir']) ? $this->user->page['page_dir'] . '/' : '') . $this->user->page['page_name'] . (($this->user->page['query_string']) ? '?' . $this->user->page['query_string'] : ''); + + $u_mark_read = append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id . '&hash=' . $mark_hash . '&redirect=' . urlencode($redirect)); + } + + return array( + 'NOTIFICATION_ID' => $this->notification_id, + 'STYLING' => $this->get_style_class(), + 'AVATAR' => $this->get_avatar(), + 'FORMATTED_TITLE' => $this->get_title(), + 'REFERENCE' => $this->get_reference(), + 'FORUM' => $this->get_forum(), + 'REASON' => $this->get_reason(), + 'URL' => $this->get_url(), + 'TIME' => $this->user->format_date($this->notification_time), + 'UNREAD' => !$this->notification_read, + 'U_MARK_READ' => (!$this->notification_read) ? $u_mark_read : '', + ); + } + + /** + * -------------- Fall back functions ------------------- + */ + + /** + * URL to unsubscribe to this notification (fall back) + * + * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item + * @return false + */ + public function get_unsubscribe_url($method = false) + { + return false; + } + + /** + * Get the CSS style class of the notification (fall back) + * + * @return string + */ + public function get_style_class() + { + return ''; + } + + /** + * Get the user's avatar (fall back) + * + * @return string + */ + public function get_avatar() + { + return ''; + } + + /** + * Get the reference of the notification (fall back) + * + * @return string + */ + public function get_reference() + { + return ''; + } + + /** + * Get the forum of the notification reference (fall back) + * + * @return string + */ + public function get_forum() + { + return ''; + } + + /** + * Get the reason for the notification (fall back) + * + * @return string + */ + public function get_reason() + { + return ''; + } + + /** + * Get the special items to load (fall back) + * + * @return array + */ + public function get_load_special() + { + return array(); + } + + /** + * Load the special items (fall back) + * + * @param array $data + * @param array $notifications + */ + public function load_special($data, $notifications) + { + return; + } + + /** + * Is available (fall back) + * + * @return bool + */ + public function is_available() + { + return true; + } + + /** + * Pre create insert array function (fall back) + * + * @param array $type_data + * @param array $notify_users + * @return array + */ + public function pre_create_insert_array($type_data, $notify_users) + { + return array(); + } + + /** + * -------------- Helper functions ------------------- + */ + + /** + * Find the users who want to receive notifications (helper) + * + * @param array|bool $user_ids User IDs to check if they want to receive notifications + * (Bool False to check all users besides anonymous and bots (USER_IGNORE)) + * @param array $options + * @return array + */ + protected function check_user_notification_options($user_ids = false, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + 'item_type' => $this->get_type(), + 'item_id' => 0, // Global by default + ), $options); + + if ($user_ids === false) + { + $user_ids = array(); + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_id <> ' . ANONYMOUS . ' + AND user_type <> ' . USER_IGNORE; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $user_ids[] = $row['user_id']; + } + $this->db->sql_freeresult($result); + } + + if (empty($user_ids)) + { + return array(); + } + + $rowset = $output = array(); + + $sql = 'SELECT user_id, method, notify + FROM ' . $this->user_notifications_table . ' + WHERE ' . $this->db->sql_in_set('user_id', $user_ids) . " + AND item_type = '" . $this->db->sql_escape($options['item_type']) . "' + AND item_id = " . (int) $options['item_id']; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']])) + { + continue; + } + + if (!isset($rowset[$row['user_id']])) + { + $rowset[$row['user_id']] = array(); + } + $rowset[$row['user_id']][$row['method']] = $row['notify']; + + if (!isset($output[$row['user_id']])) + { + $output[$row['user_id']] = array(); + } + if ($row['notify']) + { + $output[$row['user_id']][] = $row['method']; + } + } + + $this->db->sql_freeresult($result); + + $default_methods = $this->notification_manager->get_default_methods(); + + foreach ($user_ids as $user_id) + { + if (isset($options['ignore_users'][$user_id])) + { + continue; + } + if (!array_key_exists($user_id, $rowset)) + { + // No rows at all for this user, use the default methods + $output[$user_id] = $default_methods; + } + else + { + foreach ($default_methods as $default_method) + { + if (!array_key_exists($default_method, $rowset[$user_id])) + { + // No user preference for this type recorded, but it should be enabled by default. + $output[$user_id][] = $default_method; + } + } + } + } + + return $output; + } + + /** + * Mark this item read/unread helper + * + * @param bool $unread Unread (True/False) (Default: False) + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string|null If $return is False, nothing will be returned, else the sql code to update this item + */ + protected function mark($unread = true, $return = false) + { + $this->notification_read = (bool) !$unread; + + if ($return) + { + $where = array( + 'notification_type_id = ' . (int) $this->notification_type_id, + 'item_id = ' . (int) $this->item_id, + 'user_id = ' . (int) $this->user_id, + ); + + $where = implode(' AND ', $where); + return $where; + } + else + { + $this->notification_manager->mark_notifications($this->get_type(), (int) $this->item_id, (int) $this->user_id, false, $this->notification_read); + } + + return null; + } + + /** + * Get a list of users that are authorised to receive notifications + * + * @param array $users Array of users that have subscribed to a notification + * @param int $forum_id Forum ID of the forum + * @param array $options Array of notification options + * @param bool $sort Whether the users array should be sorted. Default: false + * @return array Array of users that are authorised recipients + */ + protected function get_authorised_recipients($users, $forum_id, $options, $sort = false) + { + if (empty($users)) + { + return array(); + } + + $users = array_unique($users); + + if ($sort) + { + sort($users); + } + + $auth_read = $this->auth->acl_get_list($users, 'f_read', $forum_id); + + if (empty($auth_read)) + { + return array(); + } + + return $this->check_user_notification_options($auth_read[$forum_id]['f_read'], $options); + } +} diff --git a/install/update/new/phpbb/notification/type/post.php b/install/update/new/phpbb/notification/type/post.php new file mode 100644 index 0000000..f0e938d --- /dev/null +++ b/install/update/new/phpbb/notification/type/post.php @@ -0,0 +1,467 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Post notifications class +* This class handles notifications for replies to a topic +*/ + +class post extends \phpbb\notification\type\base +{ + /** + * Get notification type name + * + * @return string + */ + public function get_type() + { + return 'notification.type.post'; + } + + /** + * Language key used to output the text + * + * @var string + */ + protected $language_key = 'NOTIFICATION_POST'; + + /** + * Inherit notification read status from post. + * + * @var bool + */ + protected $inherit_read_status = true; + + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use it's default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + static public $notification_option = array( + 'lang' => 'NOTIFICATION_TYPE_POST', + 'group' => 'NOTIFICATION_GROUP_POSTING', + ); + + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var \phpbb\config\config */ + protected $config; + + public function set_config(\phpbb\config\config $config) + { + $this->config = $config; + } + + public function set_user_loader(\phpbb\user_loader $user_loader) + { + $this->user_loader = $user_loader; + } + + /** + * Is available + */ + public function is_available() + { + return $this->config['allow_topic_notify']; + } + + /** + * Get the id of the item + * + * @param array $post The data from the post + * @return int The post id + */ + static public function get_item_id($post) + { + return (int) $post['post_id']; + } + + /** + * Get the id of the parent + * + * @param array $post The data from the post + * @return int The topic id + */ + static public function get_item_parent_id($post) + { + return (int) $post['topic_id']; + } + + /** + * Find the users who want to receive notifications + * + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification + * + * @return array + */ + public function find_users_for_notification($post, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + ), $options); + + $users = array(); + + $sql = 'SELECT user_id + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . (int) $post['topic_id'] . ' + AND notify_status = ' . NOTIFY_YES . ' + AND user_id <> ' . (int) $post['poster_id']; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $users[] = (int) $row['user_id']; + } + $this->db->sql_freeresult($result); + + $sql = 'SELECT user_id + FROM ' . FORUMS_WATCH_TABLE . ' + WHERE forum_id = ' . (int) $post['forum_id'] . ' + AND notify_status = ' . NOTIFY_YES . ' + AND user_id <> ' . (int) $post['poster_id']; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $users[] = (int) $row['user_id']; + } + $this->db->sql_freeresult($result); + + $notify_users = $this->get_authorised_recipients($users, $post['forum_id'], $options, true); + + if (empty($notify_users)) + { + return array(); + } + + // Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications + $notified_users = $this->notification_manager->get_notified_users($this->get_type(), array( + 'item_parent_id' => static::get_item_parent_id($post), + 'read' => 0, + )); + + foreach ($notified_users as $user => $notification_data) + { + unset($notify_users[$user]); + + /** @var post $notification */ + $notification = $this->notification_manager->get_item_type_class($this->get_type(), $notification_data); + $update_responders = $notification->add_responders($post); + if (!empty($update_responders)) + { + $this->notification_manager->update_notification($notification, $update_responders, array( + 'item_parent_id' => self::get_item_parent_id($post), + 'read' => 0, + 'user_id' => $user, + )); + } + } + + return $notify_users; + } + + /** + * Get the user's avatar + */ + public function get_avatar() + { + return $this->user_loader->get_avatar($this->get_data('poster_id'), false, true); + } + + /** + * Get the HTML formatted title of this notification + * + * @return string + */ + public function get_title() + { + $responders = $this->get_data('responders'); + $usernames = array(); + + if (!is_array($responders)) + { + $responders = array(); + } + + $responders = array_merge(array(array( + 'poster_id' => $this->get_data('poster_id'), + 'username' => $this->get_data('post_username'), + )), $responders); + + $responders_cnt = count($responders); + $responders = $this->trim_user_ary($responders); + $trimmed_responders_cnt = $responders_cnt - count($responders); + + foreach ($responders as $responder) + { + if ($responder['username']) + { + $usernames[] = $responder['username']; + } + else + { + $usernames[] = $this->user_loader->get_username($responder['poster_id'], 'no_profile'); + } + } + + if ($trimmed_responders_cnt > 20) + { + $usernames[] = $this->language->lang('NOTIFICATION_MANY_OTHERS'); + } + else if ($trimmed_responders_cnt) + { + $usernames[] = $this->language->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt); + } + + return $this->language->lang( + $this->language_key, + phpbb_generate_string_list($usernames, $this->user), + $responders_cnt + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('topic_title')) + ); + } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'topic_notify'; + } + + /** + * Get email template variables + * + * @return array + */ + public function get_email_template_variables() + { + if ($this->get_data('post_username')) + { + $username = $this->get_data('post_username'); + } + else + { + $username = $this->user_loader->get_username($this->get_data('poster_id'), 'username'); + } + + return array( + 'AUTHOR_NAME' => htmlspecialchars_decode($username), + 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('post_subject'))), + 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))), + + 'U_VIEW_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?p={$this->item_id}#p{$this->item_id}", + 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}&e=1&view=unread#unread", + 'U_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}", + 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}", + 'U_FORUM' => generate_board_url() . "/viewforum.{$this->php_ext}?f={$this->get_data('forum_id')}", + 'U_STOP_WATCHING_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?uid={$this->user_id}&f={$this->get_data('forum_id')}&t={$this->item_parent_id}&unwatch=topic", + ); + } + + /** + * Get the url to this item + * + * @return string URL + */ + public function get_url() + { + return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "p={$this->item_id}#p{$this->item_id}"); + } + + /** + * {inheritDoc} + */ + public function get_redirect_url() + { + return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "t={$this->item_parent_id}&view=unread#unread"); + } + + /** + * Users needed to query before this notification can be displayed + * + * @return array Array of user_ids + */ + public function users_to_query() + { + $responders = $this->get_data('responders'); + $users = array( + $this->get_data('poster_id'), + ); + + if (is_array($responders)) + { + foreach ($responders as $responder) + { + $users[] = $responder['poster_id']; + } + } + + return $this->trim_user_ary($users); + } + + /** + * Trim the user array passed down to 3 users if the array contains + * more than 4 users. + * + * @param array $users Array of users + * @return array Trimmed array of user_ids + */ + public function trim_user_ary($users) + { + if (count($users) > 4) + { + array_splice($users, 3); + } + return $users; + } + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $post Post data from submit_post + * @param array $notify_users Notify users list + * Formatted from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($post, $notify_users) + { + if (!count($notify_users) || !$this->inherit_read_status) + { + return array(); + } + + $tracking_data = array(); + $sql = 'SELECT user_id, mark_time FROM ' . TOPICS_TRACK_TABLE . ' + WHERE topic_id = ' . (int) $post['topic_id'] . ' + AND ' . $this->db->sql_in_set('user_id', array_keys($notify_users)); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $tracking_data[$row['user_id']] = $row['mark_time']; + } + $this->db->sql_freeresult($result); + + return $tracking_data; + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($post, $pre_create_data = array()) + { + $this->set_data('poster_id', $post['poster_id']); + + $this->set_data('topic_title', $post['topic_title']); + + $this->set_data('post_subject', $post['post_subject']); + + $this->set_data('post_username', (($post['poster_id'] == ANONYMOUS) ? $post['post_username'] : '')); + + $this->set_data('forum_id', $post['forum_id']); + + $this->set_data('forum_name', $post['forum_name']); + + $this->notification_time = $post['post_time']; + + // Topics can be "read" before they are public (while awaiting approval). + // Make sure that if the user has read the topic, it's marked as read in the notification + if ($this->inherit_read_status && isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time) + { + $this->notification_read = true; + } + + parent::create_insert_array($post, $pre_create_data); + } + + /** + * Add responders to the notification + * + * @param mixed $post + * @return array Array of responder data + */ + public function add_responders($post) + { + // Do not add them as a responder if they were the original poster that created the notification + if ($this->get_data('poster_id') == $post['poster_id']) + { + return array(); + } + + $responders = $this->get_data('responders'); + + $responders = ($responders === null) ? array() : $responders; + + // Do not add more than 25 responders, + // we trim the username list to "a, b, c and x others" anyway + // so there is no use to add all of them anyway. + if (count($responders) > 25) + { + return array(); + } + + foreach ($responders as $responder) + { + // Do not add them as a responder multiple times + if ($responder['poster_id'] == $post['poster_id']) + { + return array(); + } + } + + $responders[] = array( + 'poster_id' => $post['poster_id'], + 'username' => (($post['poster_id'] == ANONYMOUS) ? $post['post_username'] : ''), + ); + + $this->set_data('responders', $responders); + + $serialized_data = serialize($this->get_data(false)); + + // If the data is longer then 4000 characters, it would cause a SQL error. + // We don't add the username to the list if this is the case. + if (utf8_strlen($serialized_data) >= 4000) + { + return array(); + } + + $data_array = array_merge(array( + 'post_time' => $post['post_time'], + 'post_id' => $post['post_id'], + 'topic_id' => $post['topic_id'] + ), $this->get_data(false)); + + return $data_array; + } +} diff --git a/install/update/new/phpbb/notification/type/topic.php b/install/update/new/phpbb/notification/type/topic.php new file mode 100644 index 0000000..2535cda --- /dev/null +++ b/install/update/new/phpbb/notification/type/topic.php @@ -0,0 +1,307 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Topic notifications class +* This class handles notifications for new topics +*/ + +class topic extends \phpbb\notification\type\base +{ + /** + * Get notification type name + * + * @return string + */ + public function get_type() + { + return 'notification.type.topic'; + } + + /** + * Language key used to output the text + * + * @var string + */ + protected $language_key = 'NOTIFICATION_TOPIC'; + + /** + * Inherit notification read status from topic. + * + * @var bool + */ + protected $inherit_read_status = true; + + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use it's default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + static public $notification_option = array( + 'lang' => 'NOTIFICATION_TYPE_TOPIC', + 'group' => 'NOTIFICATION_GROUP_POSTING', + ); + + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var \phpbb\config\config */ + protected $config; + + public function set_config(\phpbb\config\config $config) + { + $this->config = $config; + } + + public function set_user_loader(\phpbb\user_loader $user_loader) + { + $this->user_loader = $user_loader; + } + + /** + * Is available + */ + public function is_available() + { + return $this->config['allow_forum_notify']; + } + + /** + * Get the id of the item + * + * @param array $post The data from the post + * @return int The topic id + */ + static public function get_item_id($post) + { + return (int) $post['topic_id']; + } + + /** + * Get the id of the parent + * + * @param array $post The data from the post + * @return int The forum id + */ + static public function get_item_parent_id($post) + { + return (int) $post['forum_id']; + } + + /** + * Find the users who want to receive notifications + * + * @param array $topic Data from the topic + * @param array $options Options for finding users for notification + * + * @return array + */ + public function find_users_for_notification($topic, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + ), $options); + + $users = array(); + + $sql = 'SELECT user_id + FROM ' . FORUMS_WATCH_TABLE . ' + WHERE forum_id = ' . (int) $topic['forum_id'] . ' + AND notify_status = ' . NOTIFY_YES . ' + AND user_id <> ' . (int) $topic['poster_id']; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $users[] = (int) $row['user_id']; + } + $this->db->sql_freeresult($result); + + return $this->get_authorised_recipients($users, $topic['forum_id'], $options); + } + + /** + * Get the user's avatar + */ + public function get_avatar() + { + return $this->user_loader->get_avatar($this->get_data('poster_id'), false, true); + } + + /** + * Get the HTML formatted title of this notification + * + * @return string + */ + public function get_title() + { + if ($this->get_data('post_username')) + { + $username = $this->get_data('post_username'); + } + else + { + $username = $this->user_loader->get_username($this->get_data('poster_id'), 'no_profile'); + } + + return $this->language->lang( + $this->language_key, + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('topic_title')) + ); + } + + /** + * Get the forum of the notification reference + * + * @return string + */ + public function get_forum() + { + return $this->language->lang( + 'NOTIFICATION_FORUM', + $this->get_data('forum_name') + ); + } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'newtopic_notify'; + } + + /** + * Get email template variables + * + * @return array + */ + public function get_email_template_variables() + { + $board_url = generate_board_url(); + + if ($this->get_data('post_username')) + { + $username = $this->get_data('post_username'); + } + else + { + $username = $this->user_loader->get_username($this->get_data('poster_id'), 'username'); + } + + return array( + 'AUTHOR_NAME' => htmlspecialchars_decode($username), + 'FORUM_NAME' => htmlspecialchars_decode($this->get_data('forum_name')), + 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))), + + 'U_TOPIC' => "{$board_url}/viewtopic.{$this->php_ext}?f={$this->item_parent_id}&t={$this->item_id}", + 'U_VIEW_TOPIC' => "{$board_url}/viewtopic.{$this->php_ext}?f={$this->item_parent_id}&t={$this->item_id}", + 'U_FORUM' => "{$board_url}/viewforum.{$this->php_ext}?f={$this->item_parent_id}", + 'U_STOP_WATCHING_FORUM' => "{$board_url}/viewforum.{$this->php_ext}?uid={$this->user_id}&f={$this->item_parent_id}&unwatch=forum", + ); + } + + /** + * Get the url to this item + * + * @return string URL + */ + public function get_url() + { + return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "f={$this->item_parent_id}&t={$this->item_id}"); + } + + /** + * Users needed to query before this notification can be displayed + * + * @return array Array of user_ids + */ + public function users_to_query() + { + return array($this->get_data('poster_id')); + } + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $post Post data from submit_post + * @param array $notify_users Notify users list + * Formatted from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($post, $notify_users) + { + if (!count($notify_users) || !$this->inherit_read_status) + { + return array(); + } + + $tracking_data = array(); + $sql = 'SELECT user_id, mark_time FROM ' . TOPICS_TRACK_TABLE . ' + WHERE topic_id = ' . (int) $post['topic_id'] . ' + AND ' . $this->db->sql_in_set('user_id', array_keys($notify_users)); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $tracking_data[$row['user_id']] = $row['mark_time']; + } + $this->db->sql_freeresult($result); + + return $tracking_data; + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($post, $pre_create_data = array()) + { + $this->set_data('poster_id', $post['poster_id']); + + $this->set_data('topic_title', $post['topic_title']); + + $this->set_data('post_username', (($post['poster_id'] == ANONYMOUS) ? $post['post_username'] : '')); + + $this->set_data('forum_name', $post['forum_name']); + + $this->notification_time = $post['post_time']; + + // Topics can be "read" before they are public (while awaiting approval). + // Make sure that if the user has read the topic, it's marked as read in the notification + if ($this->inherit_read_status && isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time) + { + $this->notification_read = true; + } + + parent::create_insert_array($post, $pre_create_data); + } +} diff --git a/install/update/new/phpbb/notification/type/type_interface.php b/install/update/new/phpbb/notification/type/type_interface.php new file mode 100644 index 0000000..ed77335 --- /dev/null +++ b/install/update/new/phpbb/notification/type/type_interface.php @@ -0,0 +1,218 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Base notifications interface +*/ +interface type_interface +{ + /** + * Get notification type name + * + * @return string + */ + public function get_type(); + + /** + * Set initial data from the database + * + * @param array $data Row directly from the database + */ + public function set_initial_data($data); + + /** + * Get the id of the item + * + * @param array $type_data The type specific data + */ + static public function get_item_id($type_data); + + /** + * Get the id of the parent + * + * @param array $type_data The type specific data + */ + static public function get_item_parent_id($type_data); + + /** + * Is this type available to the current user (defines whether or not it will be shown in the UCP Edit notification options) + * + * @return bool True/False whether or not this is available to the user + */ + public function is_available(); + + /** + * Find the users who want to receive notifications + * + * @param array $type_data The type specific data + * @param array $options Options for finding users for notification + * ignore_users => array of users and user types that should not receive notifications from this type because they've already been notified + * e.g.: array(2 => array(''), 3 => array('', 'email'), ...) + * + * @return array + */ + public function find_users_for_notification($type_data, $options); + + /** + * Users needed to query before this notification can be displayed + * + * @return array Array of user_ids + */ + public function users_to_query(); + + /** + * Get the special items to load + * + * @return array Data will be combined sent to load_special() so you can run a single query and get data required for this notification type + */ + public function get_load_special(); + + /** + * Load the special items + * + * @param array $data Data from get_load_special() + * @param array $notifications Array of notifications (key is notification_id, value is the notification objects) + */ + public function load_special($data, $notifications); + + /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class(); + + /** + * Get the HTML formatted title of this notification + * + * @return string + */ + public function get_title(); + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference(); + + /** + * Get the forum of the notification reference + * + * @return string + */ + public function get_forum(); + + /** + * Get the url to this item + * + * @return string URL + */ + public function get_url(); + + /** + * Get the url to redirect after the item has been marked as read + * + * @return string URL + */ + public function get_redirect_url(); + + /** + * URL to unsubscribe to this notification + * + * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item + */ + public function get_unsubscribe_url($method); + + /** + * Get the user's avatar (the user who caused the notification typically) + * + * @return string + */ + public function get_avatar(); + + /** + * Prepare to output the notification to the template + */ + public function prepare_for_display(); + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template(); + + /** + * Get email template variables + * + * @return array + */ + public function get_email_template_variables(); + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $type_data The type specific data + * @param array $notify_users Notify users list + * Formatted from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($type_data, $notify_users); + + /** + * Function for preparing the data for insertion in an SQL query + * + * @param array $type_data The type specific data + * @param array $pre_create_data Data from pre_create_insert_array() + */ + public function create_insert_array($type_data, $pre_create_data); + + /** + * Function for getting the data for insertion in an SQL query + * + * @return array Array of data ready to be inserted into the database + */ + public function get_insert_array(); + + /** + * Function for preparing the data for update in an SQL query + * (The service handles insertion) + * + * @param array $type_data Data unique to this notification type + * + * @return array Array of data ready to be updated in the database + */ + public function create_update_array($type_data); + + /** + * Mark this item read + * + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string + */ + public function mark_read($return = false); + + /** + * Mark this item unread + * + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string + */ + public function mark_unread($return = false); +} diff --git a/install/update/new/phpbb/passwords/driver/argon2i.php b/install/update/new/phpbb/passwords/driver/argon2i.php new file mode 100644 index 0000000..03368f6 --- /dev/null +++ b/install/update/new/phpbb/passwords/driver/argon2i.php @@ -0,0 +1,78 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class argon2i extends base_native +{ + /** @var int Maximum memory (in bytes) that may be used to compute the Argon2 hash */ + protected $memory_cost; + + /** @var int Number of threads to use for computing the Argon2 hash */ + protected $threads; + + /** @var int Maximum amount of time it may take to compute the Argon2 hash */ + protected $time_cost; + + /** + * Constructor of passwords driver object + * + * @param \phpbb\config\config $config phpBB config + * @param \phpbb\passwords\driver\helper $helper Password driver helper + * @param int $memory_cost Maximum memory (optional) + * @param int $threads Number of threads to use (optional) + * @param int $time_cost Maximum amount of time (optional) + */ + public function __construct(\phpbb\config\config $config, helper $helper, $memory_cost = 1024, $threads = 2, $time_cost = 2) + { + parent::__construct($config, $helper); + + /** + * For Sodium implementation of argon2 algorithm (since PHP 7.4), set special value of 1 for "threads" cost factor + * See https://wiki.php.net/rfc/sodium.argon.hash and PHPBB3-16266 + * Don't allow cost factors to be below default settings where possible + */ + $this->memory_cost = max($memory_cost, defined('PASSWORD_ARGON2_DEFAULT_MEMORY_COST') ? PASSWORD_ARGON2_DEFAULT_MEMORY_COST : 1024); + $this->time_cost = max($time_cost, defined('PASSWORD_ARGON2_DEFAULT_TIME_COST') ? PASSWORD_ARGON2_DEFAULT_TIME_COST : 2); + $this->threads = (defined('PASSWORD_ARGON2_PROVIDER') && PASSWORD_ARGON2_PROVIDER == 'sodium') ? + PASSWORD_ARGON2_DEFAULT_THREADS : max($threads, defined('PASSWORD_ARGON2_DEFAULT_THREADS') ? PASSWORD_ARGON2_DEFAULT_THREADS : 1); + } + + /** + * {@inheritdoc} + */ + public function get_algo_name() + { + return 'PASSWORD_ARGON2I'; + } + + /** + * {@inheritdoc} + */ + public function get_options() + { + return [ + 'memory_cost' => $this->memory_cost, + 'time_cost' => $this->time_cost, + 'threads' => $this->threads + ]; + } + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return '$argon2i$'; + } +} diff --git a/install/update/new/phpbb/passwords/driver/argon2id.php b/install/update/new/phpbb/passwords/driver/argon2id.php new file mode 100644 index 0000000..9e4b08b --- /dev/null +++ b/install/update/new/phpbb/passwords/driver/argon2id.php @@ -0,0 +1,33 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +class argon2id extends argon2i +{ + /** + * {@inheritdoc} + */ + public function get_algo_name() + { + return 'PASSWORD_ARGON2ID'; + } + + /** + * {@inheritdoc} + */ + public function get_prefix() + { + return '$argon2id$'; + } +} diff --git a/install/update/new/phpbb/passwords/driver/base_native.php b/install/update/new/phpbb/passwords/driver/base_native.php new file mode 100644 index 0000000..8749832 --- /dev/null +++ b/install/update/new/phpbb/passwords/driver/base_native.php @@ -0,0 +1,75 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords\driver; + +abstract class base_native extends base +{ + /** + * Return the constant name for this driver's algorithm + * + * @link https://www.php.net/manual/en/password.constants.php + * + * @return string + */ + abstract public function get_algo_name(); + + /** + * Return the options set for this driver instance + * + * @return array + */ + abstract public function get_options(); + + /** + * {@inheritdoc} + */ + public function check($password, $hash, $user_row = []) + { + return password_verify($password, $hash); + } + + /** + * Return the value for this driver's algorithm + * + * @return integer + */ + public function get_algo_value() + { + return constant($this->get_algo_name()); + } + + /** + * {@inheritdoc} + */ + public function hash($password) + { + return password_hash($password, $this->get_algo_value(), $this->get_options()); + } + + /** + * {@inheritdoc} + */ + public function is_supported() + { + return defined($this->get_algo_name()) && function_exists('password_hash') && function_exists('password_needs_rehash') && function_exists('password_verify'); + } + + /** + * {@inheritdoc} + */ + public function needs_rehash($hash) + { + return password_needs_rehash($hash, $this->get_algo_value(), $this->get_options()); + } +} diff --git a/install/update/new/phpbb/passwords/manager.php b/install/update/new/phpbb/passwords/manager.php new file mode 100644 index 0000000..54e6dce --- /dev/null +++ b/install/update/new/phpbb/passwords/manager.php @@ -0,0 +1,407 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords; + +class manager +{ + /** + * Default hashing method + */ + protected $type = false; + + /** + * Hashing algorithm type map + * Will be used to map hash prefix to type + */ + protected $type_map = false; + + /** + * Service collection of hashing algorithms + * Needs to be public for passwords helper + */ + public $algorithms = false; + + /** + * Password convert flag. Signals that password should be converted + */ + public $convert_flag = false; + + /** + * Passwords helper + * @var \phpbb\passwords\helper + */ + protected $helper; + + /** + * phpBB configuration + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var bool Whether or not initialized() has been called + */ + private $initialized = false; + + /** + * @var array Hashing driver service collection + */ + private $hashing_algorithms; + + /** + * @var array List of default driver types + */ + private $defaults; + + /** + * Construct a passwords object + * + * @param \phpbb\config\config $config phpBB configuration + * @param array $hashing_algorithms Hashing driver service collection + * @param \phpbb\passwords\helper $helper Passwords helper object + * @param array $defaults List of default driver types + */ + public function __construct(\phpbb\config\config $config, $hashing_algorithms, helper $helper, $defaults) + { + $this->config = $config; + $this->helper = $helper; + $this->hashing_algorithms = $hashing_algorithms; + $this->defaults = $defaults; + } + + /** + * Initialize the internal state + */ + protected function initialize() + { + if (!$this->initialized) + { + $this->initialized = true; + $this->fill_type_map($this->hashing_algorithms); + $this->register_default_type($this->defaults); + } + } + + /** + * Register default type + * Will register the first supported type from the list of default types + * + * @param array $defaults List of default types in order from first to + * use to last to use + */ + protected function register_default_type($defaults) + { + foreach ($defaults as $type) + { + if ($this->algorithms[$type]->is_supported()) + { + $this->type = $this->algorithms[$type]->get_prefix(); + break; + } + } + } + + /** + * Fill algorithm type map + * + * @param \phpbb\di\service_collection $hashing_algorithms + */ + protected function fill_type_map($hashing_algorithms) + { + foreach ($hashing_algorithms as $algorithm) + { + if (!isset($this->type_map[$algorithm->get_prefix()])) + { + $this->type_map[$algorithm->get_prefix()] = $algorithm; + } + } + $this->algorithms = $hashing_algorithms; + } + + /** + * Get the algorithm specified by a specific prefix + * + * @param string $prefix Password hash prefix + * + * @return object|bool The hash type object or false if prefix is not + * supported + */ + protected function get_algorithm($prefix) + { + if (isset($this->type_map[$prefix])) + { + return $this->type_map[$prefix]; + } + else + { + return false; + } + } + + /** + * Detect the hash type of the supplied hash + * + * @param string $hash Password hash that should be checked + * + * @return object|bool The hash type object or false if the specified + * type is not supported + */ + public function detect_algorithm($hash) + { + /* + * preg_match() will also show hashing algos like $2a\H$, which + * is a combination of bcrypt and phpass. Legacy algorithms + * like md5 will not be matched by this and need to be treated + * differently. + */ + if (!preg_match('#^\$([a-zA-Z0-9\\\]*?)\$#', $hash, $match)) + { + return false; + } + + $this->initialize(); + + // Be on the lookout for multiple hashing algorithms + // 2 is correct: H\2a > 2, H\P > 2 + if (strlen($match[1]) > 2 && strpos($match[1], '\\') !== false) + { + $hash_types = explode('\\', $match[1]); + $return_ary = array(); + foreach ($hash_types as $type) + { + // we do not support the same hashing + // algorithm more than once + if (isset($return_ary[$type])) + { + return false; + } + + $return_ary[$type] = $this->get_algorithm('$' . $type . '$'); + + if (empty($return_ary[$type])) + { + return false; + } + } + return $return_ary; + } + + // get_algorithm() will automatically return false if prefix + // is not supported + return $this->get_algorithm($match[0]); + } + + /** + * Hash supplied password + * + * @param string $password Password that should be hashed + * @param string $type Hash type. Will default to standard hash type if + * none is supplied + * @return string|bool Password hash of supplied password or false if + * if something went wrong during hashing + */ + public function hash($password, $type = '') + { + if (strlen($password) > 4096) + { + // If the password is too huge, we will simply reject it + // and not let the server try to hash it. + return false; + } + + $this->initialize(); + + // Try to retrieve algorithm by service name if type doesn't + // start with dollar sign + if (!is_array($type) && strpos($type, '$') !== 0 && isset($this->algorithms[$type])) + { + $type = $this->algorithms[$type]->get_prefix(); + } + + $type = ($type === '') ? $this->type : $type; + + if (is_array($type)) + { + return $this->combined_hash_password($password, $type); + } + + if (isset($this->type_map[$type])) + { + $hashing_algorithm = $this->type_map[$type]; + } + else + { + return false; + } + + return $hashing_algorithm->hash($password); + } + + /** + * Check supplied password against hash and set convert_flag if password + * needs to be converted to different format (preferably newer one) + * + * @param string $password Password that should be checked + * @param string $hash Stored hash + * @param array $user_row User's row in users table + * @return string|bool True if password is correct, false if not + */ + public function check($password, $hash, $user_row = array()) + { + if (strlen($password) > 4096) + { + // If the password is too huge, we will simply reject it + // and not let the server try to hash it. + return false; + } + + // Empty hashes can't be checked + if (empty($hash)) + { + return false; + } + + $this->initialize(); + + // First find out what kind of hash we're dealing with + $stored_hash_type = $this->detect_algorithm($hash); + if ($stored_hash_type == false) + { + // Still check MD5 hashes as that is what the installer + // will default to for the admin user + return $this->get_algorithm('$H$')->check($password, $hash); + } + + // Multiple hash passes needed + if (is_array($stored_hash_type)) + { + $correct = $this->check_combined_hash($password, $stored_hash_type, $hash); + $this->convert_flag = ($correct === true) ? true : false; + return $correct; + } + + if ($stored_hash_type->get_prefix() !== $this->type) + { + $this->convert_flag = true; + } + else + { + if ($stored_hash_type instanceof driver\rehashable_driver_interface) + { + $this->convert_flag = $stored_hash_type->needs_rehash($hash); + } + else + { + $this->convert_flag = false; + } + } + + // Check all legacy hash types if prefix is $CP$ + if ($stored_hash_type->get_prefix() === '$CP$') + { + // Remove $CP$ prefix for proper checking + $hash = substr($hash, 4); + + foreach ($this->type_map as $algorithm) + { + if ($algorithm->is_legacy() && $algorithm->check($password, $hash, $user_row) === true) + { + return true; + } + } + } + + return $stored_hash_type->check($password, $hash); + } + + /** + * Create combined hash from already hashed password + * + * @param string $password_hash Complete current password hash + * @param string $type Type of the hashing algorithm the password hash + * should be combined with + * @return string|bool Combined password hash if combined hashing was + * successful, else false + */ + public function combined_hash_password($password_hash, $type) + { + $this->initialize(); + + $data = array( + 'prefix' => '$', + 'settings' => '$', + ); + $hash_settings = $this->helper->get_combined_hash_settings($password_hash); + $hash = $hash_settings[0]; + + // Put settings of current hash into data array + $stored_hash_type = $this->detect_algorithm($password_hash); + $this->helper->combine_hash_output($data, 'prefix', $stored_hash_type->get_prefix()); + $this->helper->combine_hash_output($data, 'settings', $stored_hash_type->get_settings_only($password_hash)); + + // Hash current hash with the defined types + foreach ($type as $cur_type) + { + if (isset($this->algorithms[$cur_type])) + { + $new_hash_type = $this->algorithms[$cur_type]; + } + else + { + $new_hash_type = $this->get_algorithm($cur_type); + } + + if (!$new_hash_type) + { + return false; + } + + $new_hash = $new_hash_type->hash(str_replace($stored_hash_type->get_settings_only($password_hash), '', $hash)); + $this->helper->combine_hash_output($data, 'prefix', $new_hash_type->get_prefix()); + $this->helper->combine_hash_output($data, 'settings', substr(str_replace('$', '\\', $new_hash_type->get_settings_only($new_hash, true)), 0)); + $hash = str_replace($new_hash_type->get_settings_only($new_hash), '', $this->helper->obtain_hash_only($new_hash)); + } + return $this->helper->combine_hash_output($data, 'hash', $hash); + } + + /** + * Check combined password hash against the supplied password + * + * @param string $password Password entered by user + * @param array $stored_hash_type An array containing the hash types + * as described by stored password hash + * @param string $hash Stored password hash + * + * @return bool True if password is correct, false if not + */ + public function check_combined_hash($password, $stored_hash_type, $hash) + { + $i = 0; + $data = array( + 'prefix' => '$', + 'settings' => '$', + ); + $hash_settings = $this->helper->get_combined_hash_settings($hash); + foreach ($stored_hash_type as $key => $hash_type) + { + $rebuilt_hash = $this->helper->rebuild_hash($hash_type->get_prefix(), $hash_settings[$i]); + $this->helper->combine_hash_output($data, 'prefix', $key); + $this->helper->combine_hash_output($data, 'settings', $hash_settings[$i]); + $cur_hash = $hash_type->hash($password, $rebuilt_hash); + $password = str_replace($rebuilt_hash, '', $cur_hash); + $i++; + } + return ($hash === $this->helper->combine_hash_output($data, 'hash', $password)); + } +} diff --git a/install/update/new/phpbb/permissions.php b/install/update/new/phpbb/permissions.php new file mode 100644 index 0000000..236535c --- /dev/null +++ b/install/update/new/phpbb/permissions.php @@ -0,0 +1,365 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +class permissions +{ + /** + * Event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher + * @param \phpbb\user $user User Object + */ + public function __construct(\phpbb\event\dispatcher_interface $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: + * '' => array( + * 'lang' => 'Language Key with a Short description', // Optional, if not set, + * // the permissions identifier '' 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.0-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: + * '' => array( + * 'lang' => 'Language Key with a Short description', // Optional, if not set, + * // the permissions identifier '' 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'; + } + + /** + * Checks if a category has been defined + * + * @param string $category Identifier of the category + * @return bool True if the category is defined, false otherwise + */ + public function category_defined($category) + { + return isset($this->categories[$category]); + } + + /** + * Checks if a permission has been defined + * + * @param string $permission Identifier of the permission + * @return bool True if the permission is defined, false otherwise + */ + public function permission_defined($permission) + { + return isset($this->permissions[$permission]); + } + + /** + * 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_emoji' => array('lang' => 'ACL_U_EMOJI', '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_list_topics' => array('lang' => 'ACL_F_LIST_TOPICS', '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_announce_global' => array('lang' => 'ACL_F_ANNOUNCE_GLOBAL', '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_softdelete' => array('lang' => 'ACL_F_SOFTDELETE', '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_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'post_actions'), + 'm_softdelete' => array('lang' => 'ACL_M_SOFTDELETE', 'cat' => 'post_actions'), + + 'm_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'), + 'm_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'), + 'm_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'), + 'm_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'), + + 'm_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'), + 'm_pm_report' => array('lang' => 'ACL_M_PM_REPORT', '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/install/update/new/phpbb/plupload/plupload.php b/install/update/new/phpbb/plupload/plupload.php new file mode 100644 index 0000000..80d7e91 --- /dev/null +++ b/install/update/new/phpbb/plupload/plupload.php @@ -0,0 +1,417 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\plupload; + +/** +* This class handles all server-side plupload functions +*/ +class plupload +{ + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * @var \bantu\IniGetWrapper\IniGetWrapper + */ + protected $php_ini; + + /** + * @var \phpbb\mimetype\guesser + */ + protected $mimetype_guesser; + + /** + * Final destination for uploaded files, i.e. the "files" directory. + * @var string + */ + protected $upload_directory; + + /** + * Temporary upload directory for plupload uploads. + * @var string + */ + protected $temporary_directory; + + /** + * Constructor. + * + * @param string $phpbb_root_path + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request + * @param \phpbb\user $user + * @param \bantu\IniGetWrapper\IniGetWrapper $php_ini + * @param \phpbb\mimetype\guesser $mimetype_guesser + */ + public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \phpbb\mimetype\guesser $mimetype_guesser) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->config = $config; + $this->request = $request; + $this->user = $user; + $this->php_ini = $php_ini; + $this->mimetype_guesser = $mimetype_guesser; + + $this->set_default_directories(); + } + + /** + * Plupload allows for chunking so we must check for that and assemble + * the whole file first before performing any checks on it. + * + * @param string $form_name The name of the file element in the upload form + * + * @return array|null null if there are no chunks to piece together + * otherwise array containing the path to the + * pieced-together file and its size + */ + public function handle_upload($form_name) + { + $chunks_expected = $this->request->variable('chunks', 0); + + // If chunking is disabled or we are not using plupload, just return + // and handle the file as usual + if ($chunks_expected < 2) + { + return; + } + + $file_name = $this->request->variable('name', ''); + $chunk = $this->request->variable('chunk', 0); + + $this->user->add_lang('plupload'); + $this->prepare_temporary_directory(); + + $file_path = $this->temporary_filepath($file_name); + $this->integrate_uploaded_file($form_name, $chunk, $file_path); + + // If we are done with all the chunks, strip the .part suffix and then + // handle the resulting file as normal, otherwise die and await the + // next chunk. + if ($chunk == $chunks_expected - 1) + { + rename("{$file_path}.part", $file_path); + + // Reset upload directories to defaults once completed + $this->set_default_directories(); + + // Need to modify some of the $_FILES values to reflect the new file + return array( + 'tmp_name' => $file_path, + 'name' => $this->request->variable('real_filename', '', true), + 'size' => filesize($file_path), + 'type' => $this->mimetype_guesser->guess($file_path, $file_name), + ); + } + else + { + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'jsonrpc' => '2.0', + 'id' => 'id', + 'result' => null, + )); + } + } + + /** + * Fill in the plupload configuration options in the template + * + * @param \phpbb\cache\service $cache + * @param \phpbb\template\template $template + * @param string $s_action The URL to submit the POST data to + * @param int $forum_id The ID of the forum + * @param int $max_files Maximum number of files allowed. 0 for unlimited. + * + * @return null + */ + public function configure(\phpbb\cache\service $cache, \phpbb\template\template $template, $s_action, $forum_id, $max_files) + { + $filters = $this->generate_filter_string($cache, $forum_id); + $chunk_size = $this->get_chunk_size(); + $resize = $this->generate_resize_string(); + + $template->assign_vars(array( + 'S_RESIZE' => $resize, + 'S_PLUPLOAD' => true, + 'FILTERS' => $filters, + 'CHUNK_SIZE' => $chunk_size, + 'S_PLUPLOAD_URL' => htmlspecialchars_decode($s_action), + 'MAX_ATTACHMENTS' => $max_files, + 'ATTACH_ORDER' => ($this->config['display_order']) ? 'asc' : 'desc', + 'L_TOO_MANY_ATTACHMENTS' => $this->user->lang('TOO_MANY_ATTACHMENTS', $max_files), + )); + + $this->user->add_lang('plupload'); + } + + /** + * Checks whether the page request was sent by plupload or not + * + * @return bool + */ + public function is_active() + { + return $this->request->header('X-PHPBB-USING-PLUPLOAD', false); + } + + /** + * Returns whether the current HTTP request is a multipart request. + * + * @return bool + */ + public function is_multipart() + { + $content_type = $this->request->server('CONTENT_TYPE'); + + return strpos($content_type, 'multipart') === 0; + } + + /** + * Sends an error message back to the client via JSON response + * + * @param int $code The error code + * @param string $msg The translation string of the message to be sent + * + * @return null + */ + public function emit_error($code, $msg) + { + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'jsonrpc' => '2.0', + 'id' => 'id', + 'error' => array( + 'code' => $code, + 'message' => $this->user->lang($msg), + ), + )); + } + + /** + * Looks at the list of allowed extensions and generates a string + * appropriate for use in configuring plupload with + * + * @param \phpbb\cache\service $cache Cache service object + * @param string $forum_id The forum identifier + * + * @return string + */ + public function generate_filter_string(\phpbb\cache\service $cache, $forum_id) + { + $groups = []; + $filters = []; + + $attach_extensions = $cache->obtain_attach_extensions($forum_id); + unset($attach_extensions['_allowed_']); + + // Re-arrange the extension array to $groups[$group_name][] + foreach ($attach_extensions as $extension => $extension_info) + { + $groups[$extension_info['group_name']]['extensions'][] = $extension; + $groups[$extension_info['group_name']]['max_file_size'] = (int) $extension_info['max_filesize']; + } + + foreach ($groups as $group => $group_info) + { + $filters[] = sprintf( + "{title: '%s', extensions: '%s', max_file_size: %s}", + addslashes(ucfirst(strtolower($group))), + addslashes(implode(',', $group_info['extensions'])), + $group_info['max_file_size'] + ); + } + + return implode(',', $filters); + } + + /** + * Generates a string that is used to tell plupload to automatically resize + * files before uploading them. + * + * @return string + */ + public function generate_resize_string() + { + $resize = ''; + if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0) + { + $resize = sprintf( + 'resize: {width: %d, height: %d, quality: 85},', + (int) $this->config['img_max_width'], + (int) $this->config['img_max_height'] + ); + } + + return $resize; + } + + /** + * Checks various php.ini values to determine the maximum chunk + * size a file should be split into for upload. + * + * The intention is to calculate a value which reflects whatever + * the most restrictive limit is set to. And to then set the chunk + * size to half that value, to ensure any required transfer overhead + * and POST data remains well within the limit. Or, if all of the + * limits are set to unlimited, the chunk size will also be unlimited. + * + * @return int + * + * @access public + */ + public function get_chunk_size() + { + $max = 0; + + $limits = [ + $this->php_ini->getBytes('memory_limit'), + $this->php_ini->getBytes('upload_max_filesize'), + $this->php_ini->getBytes('post_max_size'), + ]; + + foreach ($limits as $limit_type) + { + if ($limit_type > 0) + { + $max = ($max !== 0) ? min($limit_type, $max) : $limit_type; + } + } + + return floor($max / 2); + } + + protected function temporary_filepath($file_name) + { + // Must preserve the extension for plupload to work. + return sprintf( + '%s/%s_%s%s', + $this->temporary_directory, + $this->config['plupload_salt'], + md5($file_name), + \phpbb\files\filespec::get_extension($file_name) + ); + } + + /** + * Checks whether the chunk we are about to deal with was actually uploaded + * by PHP and actually exists, if not, it generates an error + * + * @param string $form_name The name of the file in the form data + * @param int $chunk Chunk number + * @param string $file_path File path + * + * @return null + */ + protected function integrate_uploaded_file($form_name, $chunk, $file_path) + { + $is_multipart = $this->is_multipart(); + $upload = $this->request->file($form_name); + if ($is_multipart && (!isset($upload['tmp_name']) || !is_uploaded_file($upload['tmp_name']))) + { + $this->emit_error(103, 'PLUPLOAD_ERR_MOVE_UPLOADED'); + } + + $tmp_file = $this->temporary_filepath($upload['tmp_name']); + + if (!phpbb_is_writable($this->temporary_directory) || !move_uploaded_file($upload['tmp_name'], $tmp_file)) + { + $this->emit_error(103, 'PLUPLOAD_ERR_MOVE_UPLOADED'); + } + + $out = fopen("{$file_path}.part", $chunk == 0 ? 'wb' : 'ab'); + if (!$out) + { + $this->emit_error(102, 'PLUPLOAD_ERR_OUTPUT'); + } + + $in = fopen(($is_multipart) ? $tmp_file : 'php://input', 'rb'); + if (!$in) + { + $this->emit_error(101, 'PLUPLOAD_ERR_INPUT'); + } + + while ($buf = fread($in, 4096)) + { + fwrite($out, $buf); + } + + fclose($in); + fclose($out); + + if ($is_multipart) + { + unlink($tmp_file); + } + } + + /** + * Creates the temporary directory if it does not already exist. + * + * @return null + */ + protected function prepare_temporary_directory() + { + if (!file_exists($this->temporary_directory)) + { + mkdir($this->temporary_directory); + + copy( + $this->upload_directory . '/index.htm', + $this->temporary_directory . '/index.htm' + ); + } + } + + /** + * Sets the default directories for uploads + * + * @return null + */ + protected function set_default_directories() + { + $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path']; + $this->temporary_directory = $this->upload_directory . '/plupload'; + } + + /** + * Sets the upload directories to the specified paths + * + * @param string $upload_directory Upload directory + * @param string $temporary_directory Temporary directory + * + * @return null + */ + public function set_upload_directories($upload_directory, $temporary_directory) + { + $this->upload_directory = $upload_directory; + $this->temporary_directory = $temporary_directory; + } +} diff --git a/install/update/new/phpbb/report/report_handler.php b/install/update/new/phpbb/report/report_handler.php new file mode 100644 index 0000000..97acc17 --- /dev/null +++ b/install/update/new/phpbb/report/report_handler.php @@ -0,0 +1,104 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report; + +abstract class report_handler implements report_handler_interface +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var \phpbb\auth\auth + */ + protected $auth; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * @var \phpbb\notification\manager + */ + protected $notifications; + + /** + * @var array + */ + protected $report_data; + + /** + * Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\event\dispatcher_interface $dispatcher + * @param \phpbb\config\db $config + * @param \phpbb\auth\auth $auth + * @param \phpbb\user $user + * @param \phpbb\notification\manager $notification + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\user $user, \phpbb\notification\manager $notification) + { + $this->db = $db; + $this->dispatcher = $dispatcher; + $this->config = $config; + $this->auth = $auth; + $this->user = $user; + $this->notifications = $notification; + $this->report_data = array(); + } + + /** + * Creates a report entity in the database + * + * @param array $report_data + * @return int the ID of the created entity + */ + protected function create_report(array $report_data) + { + $sql_ary = array( + 'reason_id' => (int) $report_data['reason_id'], + 'post_id' => $report_data['post_id'], + 'pm_id' => $report_data['pm_id'], + 'user_id' => (int) $this->user->data['user_id'], + 'user_notify' => (int) $report_data['user_notify'], + 'report_closed' => 0, + 'report_time' => (int) time(), + 'report_text' => (string) $report_data['report_text'], + 'reported_post_text' => $report_data['reported_post_text'], + 'reported_post_uid' => $report_data['reported_post_uid'], + 'reported_post_bitfield' => $report_data['reported_post_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'], + ); + + $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); + $this->db->sql_query($sql); + + return $this->db->sql_nextid(); + } +} diff --git a/install/update/new/phpbb/request/request.php b/install/update/new/phpbb/request/request.php new file mode 100644 index 0000000..4d7bc9e --- /dev/null +++ b/install/update/new/phpbb/request/request.php @@ -0,0 +1,454 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\request; + +/** +* All application input is accessed through this class. +* +* It provides a method to disable access to input data through super globals. +* This should force MOD authors to read about data validation. +*/ +class request implements \phpbb\request\request_interface +{ + /** + * @var array The names of super global variables that this class should protect if super globals are disabled. + */ + protected $super_globals = array( + \phpbb\request\request_interface::POST => '_POST', + \phpbb\request\request_interface::GET => '_GET', + \phpbb\request\request_interface::REQUEST => '_REQUEST', + \phpbb\request\request_interface::COOKIE => '_COOKIE', + \phpbb\request\request_interface::SERVER => '_SERVER', + \phpbb\request\request_interface::FILES => '_FILES', + ); + + /** + * @var array Stores original contents of $_REQUEST array. + */ + protected $original_request = null; + + /** + * @var + */ + protected $super_globals_disabled = false; + + /** + * @var array An associative array that has the value of super global constants as keys and holds their data as values. + */ + protected $input; + + /** + * @var \phpbb\request\type_cast_helper_interface An instance of a type cast helper providing convenience methods for type conversions. + */ + protected $type_cast_helper; + + /** + * Initialises the request class, that means it stores all input data in {@link $input input} + * and then calls {@link \phpbb\request\deactivated_super_global \phpbb\request\deactivated_super_global} + */ + public function __construct(\phpbb\request\type_cast_helper_interface $type_cast_helper = null, $disable_super_globals = true) + { + if ($type_cast_helper) + { + $this->type_cast_helper = $type_cast_helper; + } + else + { + $this->type_cast_helper = new \phpbb\request\type_cast_helper(); + } + + foreach ($this->super_globals as $const => $super_global) + { + $this->input[$const] = isset($GLOBALS[$super_global]) ? $GLOBALS[$super_global] : array(); + } + + // simulate request_order = GP + $this->original_request = $this->input[\phpbb\request\request_interface::REQUEST]; + $this->input[\phpbb\request\request_interface::REQUEST] = $this->input[\phpbb\request\request_interface::POST] + $this->input[\phpbb\request\request_interface::GET]; + + if ($disable_super_globals) + { + $this->disable_super_globals(); + } + } + + /** + * Getter for $super_globals_disabled + * + * @return bool Whether super globals are disabled or not. + */ + public function super_globals_disabled() + { + return $this->super_globals_disabled; + } + + /** + * Disables access of super globals specified in $super_globals. + * This is achieved by overwriting the super globals with instances of {@link \phpbb\request\deactivated_super_global \phpbb\request\deactivated_super_global} + */ + public function disable_super_globals() + { + if (!$this->super_globals_disabled) + { + foreach ($this->super_globals as $const => $super_global) + { + unset($GLOBALS[$super_global]); + $GLOBALS[$super_global] = new \phpbb\request\deactivated_super_global($this, $super_global, $const); + } + + $this->super_globals_disabled = true; + } + } + + /** + * Enables access of super globals specified in $super_globals if they were disabled by {@link disable_super_globals disable_super_globals}. + * This is achieved by making the super globals point to the data stored within this class in {@link $input input}. + */ + public function enable_super_globals() + { + if ($this->super_globals_disabled) + { + foreach ($this->super_globals as $const => $super_global) + { + $GLOBALS[$super_global] = $this->input[$const]; + } + + $GLOBALS['_REQUEST'] = $this->original_request; + + $this->super_globals_disabled = false; + } + } + + /** + * This function allows overwriting or setting a value in one of the super global arrays. + * + * Changes which are performed on the super globals directly will not have any effect on the results of + * other methods this class provides. Using this function should be avoided if possible! It will + * consume twice the the amount of memory of the value + * + * @param string $var_name The name of the variable that shall be overwritten + * @param mixed $value The value which the variable shall contain. + * If this is null the variable will be unset. + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global shall be changed + */ + public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST) + { + if (!isset($this->super_globals[$super_global])) + { + return; + } + + // setting to null means unsetting + if ($value === null) + { + unset($this->input[$super_global][$var_name]); + if (!$this->super_globals_disabled()) + { + unset($GLOBALS[$this->super_globals[$super_global]][$var_name]); + } + } + else + { + $this->input[$super_global][$var_name] = $value; + if (!$this->super_globals_disabled()) + { + $GLOBALS[$this->super_globals[$super_global]][$var_name] = $value; + } + } + } + + /** + * Central type safe input handling function. + * All variables in GET or POST requests should be retrieved through this function to maximise security. + * + * @param string|array $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this parameter has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST) + { + return $this->_variable($var_name, $default, $multibyte, $super_global, true); + } + + /** + * Get a variable, but without trimming strings. + * Same functionality as variable(), except does not run trim() on strings. + * This method should be used when handling passwords. + * + * @param string|array $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this parameter has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + public function untrimmed_variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST) + { + return $this->_variable($var_name, $default, $multibyte, $super_global, false); + } + + /** + * {@inheritdoc} + */ + public function raw_variable($var_name, $default, $super_global = \phpbb\request\request_interface::REQUEST) + { + $path = false; + + // deep direct access to multi dimensional arrays + if (is_array($var_name)) + { + $path = $var_name; + // make sure at least the variable name is specified + if (empty($path)) + { + return (is_array($default)) ? array() : $default; + } + // the variable name is the first element on the path + $var_name = array_shift($path); + } + + if (!isset($this->input[$super_global][$var_name])) + { + return (is_array($default)) ? array() : $default; + } + $var = $this->input[$super_global][$var_name]; + + if ($path) + { + // walk through the array structure and find the element we are looking for + foreach ($path as $key) + { + if (is_array($var) && isset($var[$key])) + { + $var = $var[$key]; + } + else + { + return (is_array($default)) ? array() : $default; + } + } + } + + return $var; + } + + /** + * Shortcut method to retrieve SERVER variables. + * + * Also fall back to getenv(), some CGI setups may need it (probably not, but + * whatever). + * + * @param string|array $var_name See \phpbb\request\request_interface::variable + * @param mixed $default See \phpbb\request\request_interface::variable + * + * @return mixed The server variable value. + */ + public function server($var_name, $default = '') + { + $multibyte = true; + + if ($this->is_set($var_name, \phpbb\request\request_interface::SERVER)) + { + return $this->variable($var_name, $default, $multibyte, \phpbb\request\request_interface::SERVER); + } + else + { + $var = getenv($var_name); + $this->type_cast_helper->recursive_set_var($var, $default, $multibyte); + return $var; + } + } + + /** + * Shortcut method to retrieve the value of client HTTP headers. + * + * @param string|array $header_name The name of the header to retrieve. + * @param mixed $default See \phpbb\request\request_interface::variable + * + * @return mixed The header value. + */ + public function header($header_name, $default = '') + { + $var_name = 'HTTP_' . str_replace('-', '_', strtoupper($header_name)); + return $this->server($var_name, $default); + } + + /** + * Shortcut method to retrieve $_FILES variables + * + * @param string $form_name The name of the file input form element + * + * @return array The uploaded file's information or an empty array if the + * variable does not exist in _FILES. + */ + public function file($form_name) + { + return $this->variable($form_name, array('name' => 'none'), true, \phpbb\request\request_interface::FILES); + } + + /** + * Checks whether a certain variable was sent via POST. + * To make sure that a request was sent using POST you should call this function + * on at least one variable. + * + * @param string $name The name of the form variable which should have a + * _p suffix to indicate the check in the code that creates the form too. + * + * @return bool True if the variable was set in a POST request, false otherwise. + */ + public function is_set_post($name) + { + return $this->is_set($name, \phpbb\request\request_interface::POST); + } + + /** + * Checks whether a certain variable is set in one of the super global + * arrays. + * + * @param string $var Name of the variable + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies the super global which shall be checked + * + * @return bool True if the variable was sent as input + */ + public function is_set($var, $super_global = \phpbb\request\request_interface::REQUEST) + { + return isset($this->input[$super_global][$var]); + } + + /** + * Checks whether the current request is an AJAX request (XMLHttpRequest) + * + * @return bool True if the current request is an ajax request + */ + public function is_ajax() + { + return $this->header('X-Requested-With') == 'XMLHttpRequest'; + } + + /** + * Checks if the current request is happening over HTTPS. + * + * @return bool True if the request is secure. + */ + public function is_secure() + { + $https = $this->server('HTTPS'); + $https = $this->server('HTTP_X_FORWARDED_PROTO') === 'https' ? 'on' : $https; + return !empty($https) && $https !== 'off'; + } + + /** + * Returns all variable names for a given super global + * + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * The super global from which names shall be taken + * + * @return array All variable names that are set for the super global. + * Pay attention when using these, they are unsanitised! + */ + public function variable_names($super_global = \phpbb\request\request_interface::REQUEST) + { + if (!isset($this->input[$super_global])) + { + return array(); + } + + return array_keys($this->input[$super_global]); + } + + /** + * Helper function used by variable() and untrimmed_variable(). + * + * @param string|array $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this parameter has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * @param bool $trim Indicates whether trim() should be applied to string values. + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + protected function _variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST, $trim = true) + { + $var = $this->raw_variable($var_name, $default, $super_global); + + // Return prematurely if raw variable is empty array or the same as + // the default. Using strict comparison to ensure that one can't + // prevent proper type checking on any input variable + if ($var === array() || $var === $default) + { + return $var; + } + + $this->type_cast_helper->recursive_set_var($var, $default, $multibyte, $trim); + + return $var; + } + + /** + * {@inheritdoc} + */ + public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST) + { + return $this->input[$super_global]; + } + + /** + * {@inheritdoc} + */ + public function escape($var, $multibyte) + { + if (is_array($var)) + { + $result = array(); + foreach ($var as $key => $value) + { + $this->type_cast_helper->set_var($key, $key, gettype($key), $multibyte); + $result[$key] = $this->escape($value, $multibyte); + } + $var = $result; + } + else + { + $this->type_cast_helper->set_var($var, $var, 'string', $multibyte); + } + + return $var; + } +} diff --git a/install/update/new/phpbb/request/request_interface.php b/install/update/new/phpbb/request/request_interface.php new file mode 100644 index 0000000..a1fbf0a --- /dev/null +++ b/install/update/new/phpbb/request/request_interface.php @@ -0,0 +1,177 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\request; + +/** +* An interface through which all application input can be accessed. +*/ +interface request_interface +{ + /**#@+ + * Constant identifying the super global with the same name. + */ + const POST = 0; + const GET = 1; + const REQUEST = 2; + const COOKIE = 3; + const SERVER = 4; + const FILES = 5; + /**#@-*/ + + /** + * This function allows overwriting or setting a value in one of the super global arrays. + * + * Changes which are performed on the super globals directly will not have any effect on the results of + * other methods this class provides. Using this function should be avoided if possible! It will + * consume twice the the amount of memory of the value + * + * @param string $var_name The name of the variable that shall be overwritten + * @param mixed $value The value which the variable shall contain. + * If this is null the variable will be unset. + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global shall be changed + */ + public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Central type safe input handling function. + * All variables in GET or POST requests should be retrieved through this function to maximise security. + * + * @param string|array $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this parameter has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Get a variable without trimming strings and without escaping. + * This method MUST NOT be used with queries. + * Same functionality as variable(), except does not run trim() on strings + * and does not escape input. + * This method should only be used when the raw input is needed without + * any escaping, i.e. for database password during the installation. + * + * @param string|array $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + public function raw_variable($var_name, $default, $super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Shortcut method to retrieve SERVER variables. + * + * @param string|array $var_name See \phpbb\request\request_interface::variable + * @param mixed $default See \phpbb\request\request_interface::variable + * + * @return mixed The server variable value. + */ + public function server($var_name, $default = ''); + + /** + * Shortcut method to retrieve the value of client HTTP headers. + * + * @param string|array $header_name The name of the header to retrieve. + * @param mixed $default See \phpbb\request\request_interface::variable + * + * @return mixed The header value. + */ + public function header($header_name, $default = ''); + + /** + * Checks whether a certain variable was sent via POST. + * To make sure that a request was sent using POST you should call this function + * on at least one variable. + * + * @param string $name The name of the form variable which should have a + * _p suffix to indicate the check in the code that creates the form too. + * + * @return bool True if the variable was set in a POST request, false otherwise. + */ + public function is_set_post($name); + + /** + * Checks whether a certain variable is set in one of the super global + * arrays. + * + * @param string $var Name of the variable + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies the super global which shall be checked + * + * @return bool True if the variable was sent as input + */ + public function is_set($var, $super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Checks whether the current request is an AJAX request (XMLHttpRequest) + * + * @return bool True if the current request is an ajax request + */ + public function is_ajax(); + + /** + * Checks if the current request is happening over HTTPS. + * + * @return bool True if the request is secure. + */ + public function is_secure(); + + /** + * Returns all variable names for a given super global + * + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * The super global from which names shall be taken + * + * @return array All variable names that are set for the super global. + * Pay attention when using these, they are unsanitised! + */ + public function variable_names($super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Returns the original array of the requested super global + * + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * The super global which will be returned + * + * @return array The original array of the requested super global. + */ + public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Escape a string variable. + * + * @param mixed $value The contents to fill with + * @param bool $multibyte Indicates whether string values may contain UTF-8 characters. + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks. + * @return string|array + */ + public function escape($value, $multibyte); +} diff --git a/install/update/new/phpbb/request/type_cast_helper.php b/install/update/new/phpbb/request/type_cast_helper.php new file mode 100644 index 0000000..39d5908 --- /dev/null +++ b/install/update/new/phpbb/request/type_cast_helper.php @@ -0,0 +1,125 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\request; + +/** +* A helper class that provides convenience methods for type casting. +*/ +class type_cast_helper implements \phpbb\request\type_cast_helper_interface +{ + /** + * Set variable $result to a particular type. + * + * @param mixed &$result The variable to fill + * @param mixed $var The contents to fill with + * @param mixed $type The variable type. Will be used with {@link settype()} + * @param bool $multibyte Indicates whether string values may contain UTF-8 characters. + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks. + * @param bool $trim Indicates whether trim() should be applied to string values. + * Default is true. + */ + public function set_var(&$result, $var, $type, $multibyte = false, $trim = true) + { + settype($var, $type); + $result = $var; + + if ($type == 'string') + { + $result = str_replace(array("\r\n", "\r", "\0"), array("\n", "\n", ''), $result); + + if ($trim) + { + $result = trim($result); + } + + $result = htmlspecialchars($result, ENT_COMPAT, 'UTF-8'); + + if ($multibyte) + { + $result = utf8_normalize_nfc($result); + } + + if (!empty($result)) + { + // Make sure multibyte characters are wellformed + if ($multibyte) + { + if (!preg_match('/^./u', $result)) + { + $result = ''; + } + } + else + { + // no multibyte, allow only ASCII (0-127) + $result = preg_replace('/[\x80-\xFF]/', '?', $result); + } + } + } + } + + /** + * Recursively sets a variable to a given type using {@link set_var set_var} + * + * @param string $var The value which shall be sanitised (passed by reference). + * @param mixed $default Specifies the type $var shall have. + * If it is an array and $var is not one, then an empty array is returned. + * Otherwise var is cast to the same type, and if $default is an array all + * keys and values are cast recursively using this function too. + * @param bool $multibyte Indicates whether string keys and values may contain UTF-8 characters. + * Default is false, causing all bytes outside the ASCII range (0-127) to + * be replaced with question marks. + * @param bool $trim Indicates whether trim() should be applied to string values. + * Default is true. + */ + public function recursive_set_var(&$var, $default, $multibyte, $trim = true) + { + if (is_array($var) !== is_array($default)) + { + $var = (is_array($default)) ? array() : $default; + return; + } + + if (!is_array($default)) + { + $type = gettype($default); + $this->set_var($var, $var, $type, $multibyte, $trim); + } + else + { + // make sure there is at least one key/value pair to use get the + // types from + if (empty($default)) + { + $var = array(); + return; + } + + $default_key = key($default); + $default_value = current($default); + $key_type = gettype($default_key); + + $_var = $var; + $var = array(); + + foreach ($_var as $k => $v) + { + $this->set_var($k, $k, $key_type, $multibyte); + + $this->recursive_set_var($v, $default_value, $multibyte, $trim); + $var[$k] = $v; + } + } + } +} diff --git a/install/update/new/phpbb/search/fulltext_mysql.php b/install/update/new/phpbb/search/fulltext_mysql.php new file mode 100644 index 0000000..42ac6ea --- /dev/null +++ b/install/update/new/phpbb/search/fulltext_mysql.php @@ -0,0 +1,1220 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\search; + +/** +* Fulltext search for MySQL +*/ +class fulltext_mysql extends \phpbb\search\base +{ + /** + * Associative array holding index stats + * @var array + */ + protected $stats = array(); + + /** + * Holds the words entered by user, obtained by splitting the entered query on whitespace + * @var array + */ + protected $split_words = array(); + + /** + * Config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Database connection + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Associative array stores the min and max word length to be searched + * @var array + */ + protected $word_length = array(); + + /** + * Contains tidied search query. + * Operators are prefixed in search query and common words excluded + * @var string + */ + protected $search_query; + + /** + * Contains common words. + * Common words are words with length less/more than min/max length + * @var array + */ + protected $common_words = array(); + + /** + * Constructor + * Creates a new \phpbb\search\fulltext_mysql, which is used as a search backend + * + * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\user $user User object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + */ + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) + { + $this->config = $config; + $this->db = $db; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->user = $user; + + $this->word_length = array('min' => $this->config['fulltext_mysql_min_word_len'], 'max' => $this->config['fulltext_mysql_max_word_len']); + + /** + * Load the UTF tools + */ + if (!function_exists('utf8_strlen')) + { + include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + } + + $error = false; + } + + /** + * Returns the name of this search backend to be displayed to administrators + * + * @return string Name + */ + public function get_name() + { + return 'MySQL Fulltext'; + } + + /** + * Returns the search_query + * + * @return string search query + */ + public function get_search_query() + { + return $this->search_query; + } + + /** + * Returns the common_words array + * + * @return array common words that are ignored by search backend + */ + public function get_common_words() + { + return $this->common_words; + } + + /** + * Returns the word_length array + * + * @return array min and max word length for searching + */ + public function get_word_length() + { + return $this->word_length; + } + + /** + * Checks for correct MySQL version and stores min/max word length in the config + * + * @return string|bool Language key of the error/incompatibility occurred + */ + public function init() + { + if ($this->db->get_sql_layer() != 'mysqli') + { + return $this->user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_DATABASE']; + } + + $result = $this->db->sql_query('SHOW TABLE STATUS LIKE \'' . POSTS_TABLE . '\''); + $info = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $engine = ''; + if (isset($info['Engine'])) + { + $engine = $info['Engine']; + } + else if (isset($info['Type'])) + { + $engine = $info['Type']; + } + + $fulltext_supported = + $engine === 'MyISAM' || + // FULLTEXT is supported on InnoDB since MySQL 5.6.4 according to + // http://dev.mysql.com/doc/refman/5.6/en/innodb-storage-engine.html + // We also require https://bugs.mysql.com/bug.php?id=67004 to be + // fixed for proper overall operation. Hence we require 5.6.8. + $engine === 'InnoDB' && + phpbb_version_compare($this->db->sql_server_info(true), '5.6.8', '>='); + + if (!$fulltext_supported) + { + return $this->user->lang['FULLTEXT_MYSQL_NOT_SUPPORTED']; + } + + $sql = 'SHOW VARIABLES + LIKE \'%ft\_%\''; + $result = $this->db->sql_query($sql); + + $mysql_info = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $mysql_info[$row['Variable_name']] = $row['Value']; + } + $this->db->sql_freeresult($result); + + if ($engine === 'MyISAM') + { + $this->config->set('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']); + $this->config->set('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']); + } + else if ($engine === 'InnoDB') + { + $this->config->set('fulltext_mysql_max_word_len', $mysql_info['innodb_ft_max_token_size']); + $this->config->set('fulltext_mysql_min_word_len', $mysql_info['innodb_ft_min_token_size']); + } + + return false; + } + + /** + * Splits keywords entered by a user into an array of words stored in $this->split_words + * Stores the tidied search query in $this->search_query + * + * @param string &$keywords Contains the keyword as entered by the user + * @param string $terms is either 'all' or 'any' + * @return bool false if no valid keywords were found and otherwise true + */ + public function split_keywords(&$keywords, $terms) + { + if ($terms == 'all') + { + $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#(^|\s)\+#', '#(^|\s)-#', '#(^|\s)\|#'); + $replace = array(' +', ' |', ' -', ' +', ' -', ' |'); + + $keywords = preg_replace($match, $replace, $keywords); + } + + // Filter out as above + $split_keywords = preg_replace("#[\n\r\t]+#", ' ', trim(htmlspecialchars_decode($keywords))); + + // Split words + $split_keywords = preg_replace('#([^\p{L}\p{N}\'*"()])#u', '$1$1', str_replace('\'\'', '\' \'', trim($split_keywords))); + $matches = array(); + preg_match_all('#(?:[^\p{L}\p{N}*"()]|^)([+\-|]?(?:[\p{L}\p{N}*"()]+\'?)*[\p{L}\p{N}*"()])(?:[^\p{L}\p{N}*"()]|$)#u', $split_keywords, $matches); + $this->split_words = $matches[1]; + + // We limit the number of allowed keywords to minimize load on the database + if ($this->config['max_num_search_keywords'] && count($this->split_words) > $this->config['max_num_search_keywords']) + { + trigger_error($this->user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', (int) $this->config['max_num_search_keywords'], count($this->split_words))); + } + + // to allow phrase search, we need to concatenate quoted words + $tmp_split_words = array(); + $phrase = ''; + foreach ($this->split_words as $word) + { + if ($phrase) + { + $phrase .= ' ' . $word; + if (strpos($word, '"') !== false && substr_count($word, '"') % 2 == 1) + { + $tmp_split_words[] = $phrase; + $phrase = ''; + } + } + else if (strpos($word, '"') !== false && substr_count($word, '"') % 2 == 1) + { + $phrase = $word; + } + else + { + $tmp_split_words[] = $word; + } + } + if ($phrase) + { + $tmp_split_words[] = $phrase; + } + + $this->split_words = $tmp_split_words; + + unset($tmp_split_words); + unset($phrase); + + foreach ($this->split_words as $i => $word) + { + // Check for not allowed search queries for InnoDB. + // We assume similar restrictions for MyISAM, which is usually even + // slower but not as restrictive as InnoDB. + // InnoDB full-text search does not support the use of a leading + // plus sign with wildcard ('+*'), a plus and minus sign + // combination ('+-'), or leading a plus and minus sign combination. + // InnoDB full-text search only supports leading plus or minus signs. + // For example, InnoDB supports '+apple' but does not support 'apple+'. + // Specifying a trailing plus or minus sign causes InnoDB to report + // a syntax error. InnoDB full-text search does not support the use + // of multiple operators on a single search word, as in this example: + // '++apple'. Use of multiple operators on a single search word + // returns a syntax error to standard out. + // Also, ensure that the wildcard character is only used at the + // end of the line as it's intended by MySQL. + if (preg_match('#^(\+[+-]|\+\*|.+[+-]$|.+\*(?!$))#', $word)) + { + unset($this->split_words[$i]); + continue; + } + + $clean_word = preg_replace('#^[+\-|"]#', '', $word); + + // check word length + $clean_len = utf8_strlen(str_replace('*', '', $clean_word)); + if (($clean_len < $this->config['fulltext_mysql_min_word_len']) || ($clean_len > $this->config['fulltext_mysql_max_word_len'])) + { + $this->common_words[] = $word; + unset($this->split_words[$i]); + } + } + + if ($terms == 'any') + { + $this->search_query = ''; + foreach ($this->split_words as $word) + { + if ((strpos($word, '+') === 0) || (strpos($word, '-') === 0) || (strpos($word, '|') === 0)) + { + $word = substr($word, 1); + } + $this->search_query .= $word . ' '; + } + } + else + { + $this->search_query = ''; + foreach ($this->split_words as $word) + { + if ((strpos($word, '+') === 0) || (strpos($word, '-') === 0)) + { + $this->search_query .= $word . ' '; + } + else if (strpos($word, '|') === 0) + { + $this->search_query .= substr($word, 1) . ' '; + } + else + { + $this->search_query .= '+' . $word . ' '; + } + } + } + + $this->search_query = utf8_htmlspecialchars($this->search_query); + + if ($this->search_query) + { + $this->split_words = array_values($this->split_words); + sort($this->split_words); + return true; + } + return false; + } + + /** + * Turns text into an array of words + * @param string $text contains post text/subject + */ + public function split_message($text) + { + // Split words + $text = preg_replace('#([^\p{L}\p{N}\'*])#u', '$1$1', str_replace('\'\'', '\' \'', trim($text))); + $matches = array(); + preg_match_all('#(?:[^\p{L}\p{N}*]|^)([+\-|]?(?:[\p{L}\p{N}*]+\'?)*[\p{L}\p{N}*])(?:[^\p{L}\p{N}*]|$)#u', $text, $matches); + $text = $matches[1]; + + // remove too short or too long words + $text = array_values($text); + for ($i = 0, $n = count($text); $i < $n; $i++) + { + $text[$i] = trim($text[$i]); + if (utf8_strlen($text[$i]) < $this->config['fulltext_mysql_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_mysql_max_word_len']) + { + unset($text[$i]); + } + } + + return array_values($text); + } + + /** + * Performs a search on keywords depending on display specific params. You have to run split_keywords() first + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param string $fields contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched) + * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @return boolean|int total number of results + */ + public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No keywords? No posts + if (!$this->search_query) + { + return false; + } + + // generate a search_key from all the options to identify the results + $search_key_array = array( + implode(', ', $this->split_words), + $type, + $fields, + $terms, + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary) + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_mysql_by_keyword_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_by_keyword_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + if ($start < 0) + { + $start = 0; + } + + // try reading the results from cache + $result_count = 0; + if ($this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $result_count; + } + + $id_ary = array(); + + $join_topic = ($type == 'posts') ? false : true; + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_sort_table = $sql_sort_join = ''; + + switch ($sql_sort[0]) + { + case 'u': + $sql_sort_table = USERS_TABLE . ' u, '; + $sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster '; + break; + + case 't': + $join_topic = true; + break; + + case 'f': + $sql_sort_table = FORUMS_TABLE . ' f, '; + $sql_sort_join = ' AND f.forum_id = p.forum_id '; + break; + } + + // Build some display specific sql strings + switch ($fields) + { + case 'titleonly': + $sql_match = 'p.post_subject'; + $sql_match_where = ' AND p.post_id = t.topic_first_post_id'; + $join_topic = true; + break; + + case 'msgonly': + $sql_match = 'p.post_text'; + $sql_match_where = ''; + break; + + case 'firstpost': + $sql_match = 'p.post_subject, p.post_text'; + $sql_match_where = ' AND p.post_id = t.topic_first_post_id'; + $join_topic = true; + break; + + default: + $sql_match = 'p.post_subject, p.post_text'; + $sql_match_where = ''; + break; + } + + $search_query = $this->search_query; + + /** + * Allow changing the query used to search for posts using fulltext_mysql + * + * @event core.search_mysql_keywords_main_query_before + * @var string search_query The parsed keywords used for this search + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var bool join_topic Weather or not TOPICS_TABLE should be CROSS JOIN'ED + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant) + * @var array ex_fid_ary Which forums not to search on + * @var int topic_id Limit the search to this topic_id only + * @var string sql_sort_table Extra tables to include in the SQL query. + * Used in conjunction with sql_sort_join + * @var string sql_sort_join SQL conditions to join all the tables used together. + * Used in conjunction with sql_sort_table + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sql_match Which columns to do the search on. + * @var string sql_match_where Extra conditions to use to properly filter the matching process + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'search_query', + 'result_count', + 'join_topic', + 'author_ary', + 'author_name', + 'ex_fid_ary', + 'topic_id', + 'sql_sort_table', + 'sql_sort_join', + 'sort_days', + 'sql_match', + 'sql_match_where', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_keywords_main_query_before', compact($vars))); + + $sql_select = (!$result_count) ? 'SQL_CALC_FOUND_ROWS ' : ''; + $sql_select = ($type == 'posts') ? $sql_select . 'p.post_id' : 'DISTINCT ' . $sql_select . 't.topic_id'; + $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; + $field = ($type == 'posts') ? 'post_id' : 'topic_id'; + if (count($author_ary) && $author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = ' AND (' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else if (count($author_ary)) + { + $sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary); + } + else + { + $sql_author = ''; + } + + $sql_where_options = $sql_sort_join; + $sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : ''; + $sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : ''; + $sql_where_options .= (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_where_options .= ' AND ' . $post_visibility; + $sql_where_options .= $sql_author; + $sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $sql_where_options .= $sql_match_where; + + $sql = "SELECT $sql_select + FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p + WHERE MATCH ($sql_match) AGAINST ('" . $this->db->sql_escape(htmlspecialchars_decode($this->search_query)) . "' IN BOOLEAN MODE) + $sql_where_options + ORDER BY $sql_sort"; + $this->db->sql_return_on_error(true); + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + + // if the total result count is not cached yet, retrieve it from the db + if (!$result_count && count($id_ary)) + { + $sql_found_rows = 'SELECT FOUND_ROWS() as result_count'; + $result = $this->db->sql_query($sql_found_rows); + $result_count = (int) $this->db->sql_fetchfield('result_count'); + $this->db->sql_freeresult($result); + + if (!$result_count) + { + return false; + } + } + + if ($start >= $result_count) + { + $start = floor(($result_count - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + } + + // store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page + $this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, (int) $per_page); + + return $result_count; + } + + /** + * Performs a search on an author's posts without caring about message contents. Depends on display specific params + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param boolean $firstpost_only if true, only topic starting posts will be considered + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @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, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No author? No posts + if (!count($author_ary)) + { + return 0; + } + + // generate a search_key from all the options to identify the results + $search_key_array = array( + '', + $type, + ($firstpost_only) ? 'firstpost' : '', + '', + '', + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary), + $author_name, + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_mysql_by_author_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var boolean firstpost_only Flag indicating if only topic starting posts are considered + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'firstpost_only', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_by_author_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + if ($start < 0) + { + $start = 0; + } + + // try reading the results from cache + $result_count = 0; + if ($this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $result_count; + } + + $id_ary = array(); + + // Create some display specific sql strings + if ($author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else + { + $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); + } + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; + $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_sort_table = $sql_sort_join = ''; + switch ($sql_sort[0]) + { + case 'u': + $sql_sort_table = USERS_TABLE . ' u, '; + $sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster '; + break; + + case 't': + $sql_sort_table = ($type == 'posts' && !$firstpost_only) ? TOPICS_TABLE . ' t, ' : ''; + $sql_sort_join = ($type == 'posts' && !$firstpost_only) ? ' AND t.topic_id = p.topic_id ' : ''; + break; + + case 'f': + $sql_sort_table = FORUMS_TABLE . ' f, '; + $sql_sort_join = ' AND f.forum_id = p.forum_id '; + break; + } + + $m_approve_fid_sql = ' AND ' . $post_visibility; + + /** + * Allow changing the query used to search for posts by author in fulltext_mysql + * + * @event core.search_mysql_author_query_before + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen + * @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table + * @var string type Either "posts" or "topics" specifying the type of search being made + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on + * @var string sql_author SQL WHERE condition for the post author ids + * @var int topic_id Limit the search to this topic_id only + * @var string sql_topic_id SQL of topic_id + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var string sort_days Time, in days, that the oldest post showing can have + * @var string sql_time The SQL to search on the time specifyed by sort_days + * @var bool firstpost_only Wether or not to search only on the first post of the topics + * @var string sql_firstpost The SQL with the conditions to join the tables when using firstpost_only + * @var array ex_fid_ary Forum ids that must not be searched on + * @var array sql_fora SQL query for ex_fid_ary + * @var string m_approve_fid_sql WHERE clause condition on post_visibility restrictions + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'result_count', + 'sql_sort_table', + 'sql_sort_join', + 'type', + 'author_ary', + 'author_name', + 'sql_author', + 'topic_id', + 'sql_topic_id', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'sort_days', + 'sql_time', + 'firstpost_only', + 'sql_firstpost', + 'ex_fid_ary', + 'sql_fora', + 'm_approve_fid_sql', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_author_query_before', compact($vars))); + + // If the cache was completely empty count the results + $calc_results = ($result_count) ? '' : 'SQL_CALC_FOUND_ROWS '; + + // Build the query for really selecting the post_ids + if ($type == 'posts') + { + $sql = "SELECT {$calc_results}p.post_id + FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . " + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + $sql_sort_join + $sql_time + ORDER BY $sql_sort"; + $field = 'post_id'; + } + else + { + $sql = "SELECT {$calc_results}t.topic_id + FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + AND t.topic_id = p.topic_id + $sql_sort_join + $sql_time + GROUP BY t.topic_id + ORDER BY $sql_sort"; + $field = 'topic_id'; + } + + // Only read one block of posts from the db and then cache it + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + // retrieve the total result count if needed + if (!$result_count) + { + $sql_found_rows = 'SELECT FOUND_ROWS() as result_count'; + $result = $this->db->sql_query($sql_found_rows); + $result_count = (int) $this->db->sql_fetchfield('result_count'); + $this->db->sql_freeresult($result); + + if (!$result_count) + { + return false; + } + } + + if ($start >= $result_count) + { + $start = floor(($result_count - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + } + + if (count($id_ary)) + { + $this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, $per_page); + + return $result_count; + } + return false; + } + + /** + * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated + * + * @param string $mode contains the post mode: edit, post, reply, quote ... + * @param int $post_id contains the post id of the post to index + * @param string $message contains the post text of the post + * @param string $subject contains the subject of the post to index + * @param int $poster_id contains the user id of the poster + * @param int $forum_id contains the forum id of parent forum of the post + */ + public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) + { + // Split old and new post/subject to obtain array of words + $split_text = $this->split_message($message); + $split_title = ($subject) ? $this->split_message($subject) : array(); + + $words = array_unique(array_merge($split_text, $split_title)); + + /** + * Event to modify method arguments and words before the MySQL search index is updated + * + * @event core.search_mysql_index_before + * @var string mode Contains the post mode: edit, post, reply, quote + * @var int post_id The id of the post which is modified/created + * @var string message New or updated post content + * @var string subject New or updated post subject + * @var int poster_id Post author's user id + * @var int forum_id The id of the forum in which the post is located + * @var array words List of words added to the index + * @var array split_text Array of words from the message + * @var array split_title Array of words from the title + * @since 3.2.3-RC1 + */ + $vars = array( + 'mode', + 'post_id', + 'message', + 'subject', + 'poster_id', + 'forum_id', + 'words', + 'split_text', + 'split_title', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_index_before', compact($vars))); + + unset($split_text); + unset($split_title); + + // destroy cached search results containing any of the words removed or added + $this->destroy_cache($words, array($poster_id)); + + unset($words); + } + + /** + * Destroy cached results, that might be outdated after deleting a post + */ + public function index_remove($post_ids, $author_ids, $forum_ids) + { + $this->destroy_cache(array(), array_unique($author_ids)); + } + + /** + * Destroy old cache entries + */ + public function tidy() + { + // destroy too old cached search results + $this->destroy_cache(array()); + + $this->config->set('search_last_gc', time(), false); + } + + /** + * Create fulltext index + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function create_index($acp_module, $u_action) + { + // Make sure we can actually use MySQL with fulltext indexes + if ($error = $this->init()) + { + return $error; + } + + if (empty($this->stats)) + { + $this->get_stats(); + } + + $alter_list = array(); + + if (!isset($this->stats['post_subject'])) + { + $alter_entry = array(); + $alter_entry[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL'; + $alter_entry[] = 'ADD FULLTEXT (post_subject)'; + $alter_list[] = $alter_entry; + } + + if (!isset($this->stats['post_content'])) + { + $alter_entry = array(); + $alter_entry[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL'; + $alter_entry[] = 'ADD FULLTEXT post_content (post_text, post_subject)'; + $alter_list[] = $alter_entry; + } + + $sql_queries = []; + + foreach ($alter_list as $alter) + { + $sql_queries[] = 'ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter); + } + + if (!isset($this->stats['post_text'])) + { + $sql_queries[] = 'ALTER TABLE ' . POSTS_TABLE . ' ADD FULLTEXT post_text (post_text)'; + } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the MySQL search index is created + * + * @event core.search_mysql_create_index_before + * @var array sql_queries Array with queries for creating the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_create_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } + + $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); + + return false; + } + + /** + * Drop fulltext index + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function delete_index($acp_module, $u_action) + { + // Make sure we can actually use MySQL with fulltext indexes + if ($error = $this->init()) + { + return $error; + } + + if (empty($this->stats)) + { + $this->get_stats(); + } + + $alter = array(); + + if (isset($this->stats['post_subject'])) + { + $alter[] = 'DROP INDEX post_subject'; + } + + if (isset($this->stats['post_content'])) + { + $alter[] = 'DROP INDEX post_content'; + } + + if (isset($this->stats['post_text'])) + { + $alter[] = 'DROP INDEX post_text'; + } + + $sql_queries = []; + + if (count($alter)) + { + $sql_queries[] = 'ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter); + } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the MySQL search index is deleted + * + * @event core.search_mysql_delete_index_before + * @var array sql_queries Array with queries for deleting the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_delete_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } + + $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); + + return false; + } + + /** + * Returns true if both FULLTEXT indexes exist + */ + public function index_created() + { + if (empty($this->stats)) + { + $this->get_stats(); + } + + return isset($this->stats['post_subject']) && isset($this->stats['post_content']) && isset($this->stats['post_text']); + } + + /** + * Returns an associative array containing information about the indexes + */ + public function index_stats() + { + if (empty($this->stats)) + { + $this->get_stats(); + } + + return array( + $this->user->lang['FULLTEXT_MYSQL_TOTAL_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] : 0, + ); + } + + /** + * Computes the stats and store them in the $this->stats associative array + */ + protected function get_stats() + { + if (strpos($this->db->get_sql_layer(), 'mysql') === false) + { + $this->stats = array(); + return; + } + + $sql = 'SHOW INDEX + FROM ' . POSTS_TABLE; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // deal with older MySQL versions which didn't use Index_type + $index_type = (isset($row['Index_type'])) ? $row['Index_type'] : $row['Comment']; + + if ($index_type == 'FULLTEXT') + { + if ($row['Key_name'] == 'post_subject') + { + $this->stats['post_subject'] = $row; + } + else if ($row['Key_name'] == 'post_text') + { + $this->stats['post_text'] = $row; + } + else if ($row['Key_name'] == 'post_content') + { + $this->stats['post_content'] = $row; + } + } + } + $this->db->sql_freeresult($result); + + $this->stats['total_posts'] = empty($this->stats) ? 0 : $this->db->get_estimated_row_count(POSTS_TABLE); + } + + /** + * Display a note, that UTF-8 support is not available with certain versions of PHP + * + * @return associative array containing template and config variables + */ + public function acp() + { + $tpl = ' +
+

' . $this->user->lang['FULLTEXT_MYSQL_MIN_SEARCH_CHARS_EXPLAIN'] . '
+
' . $this->config['fulltext_mysql_min_word_len'] . '
+
+
+

' . $this->user->lang['FULLTEXT_MYSQL_MAX_SEARCH_CHARS_EXPLAIN'] . '
+
' . $this->config['fulltext_mysql_max_word_len'] . '
+
+ '; + + // These are fields required in the config table + return array( + 'tpl' => $tpl, + 'config' => array() + ); + } +} diff --git a/install/update/new/phpbb/search/fulltext_native.php b/install/update/new/phpbb/search/fulltext_native.php new file mode 100644 index 0000000..23460d3 --- /dev/null +++ b/install/update/new/phpbb/search/fulltext_native.php @@ -0,0 +1,2068 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\search; + +/** +* phpBB's own db driven fulltext search, version 2 +*/ +class fulltext_native extends \phpbb\search\base +{ + const UTF8_HANGUL_FIRST = "\xEA\xB0\x80"; + const UTF8_HANGUL_LAST = "\xED\x9E\xA3"; + const UTF8_CJK_FIRST = "\xE4\xB8\x80"; + const UTF8_CJK_LAST = "\xE9\xBE\xBB"; + const UTF8_CJK_B_FIRST = "\xF0\xA0\x80\x80"; + const UTF8_CJK_B_LAST = "\xF0\xAA\x9B\x96"; + + /** + * Associative array holding index stats + * @var array + */ + protected $stats = array(); + + /** + * Associative array stores the min and max word length to be searched + * @var array + */ + protected $word_length = array(); + + /** + * Contains tidied search query. + * Operators are prefixed in search query and common words excluded + * @var string + */ + protected $search_query; + + /** + * Contains common words. + * Common words are words with length less/more than min/max length + * @var array + */ + protected $common_words = array(); + + /** + * Post ids of posts containing words that are to be included + * @var array + */ + protected $must_contain_ids = array(); + + /** + * Post ids of posts containing words that should not be included + * @var array + */ + protected $must_not_contain_ids = array(); + + /** + * Post ids of posts containing at least one word that needs to be excluded + * @var array + */ + protected $must_exclude_one_ids = array(); + + /** + * Relative path to board root + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP Extension + * @var string + */ + protected $php_ext; + + /** + * Config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Database connection + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Initialises the fulltext_native search backend with min/max word length + * + * @param boolean|string &$error is passed by reference and should either be set to false on success or an error message on failure + * @param string $phpbb_root_path phpBB root path + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\user $user User object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + */ + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $phpEx; + $this->config = $config; + $this->db = $db; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->user = $user; + + $this->word_length = array('min' => (int) $this->config['fulltext_native_min_chars'], 'max' => (int) $this->config['fulltext_native_max_chars']); + + /** + * Load the UTF tools + */ + if (!function_exists('utf8_decode_ncr')) + { + include($this->phpbb_root_path . 'includes/utf/utf_tools.' . $this->php_ext); + } + + $error = false; + } + + /** + * Returns the name of this search backend to be displayed to administrators + * + * @return string Name + */ + public function get_name() + { + return 'phpBB Native Fulltext'; + } + + /** + * Returns the search_query + * + * @return string search query + */ + public function get_search_query() + { + return $this->search_query; + } + + /** + * Returns the common_words array + * + * @return array common words that are ignored by search backend + */ + public function get_common_words() + { + return $this->common_words; + } + + /** + * Returns the word_length array + * + * @return array min and max word length for searching + */ + public function get_word_length() + { + return $this->word_length; + } + + /** + * This function fills $this->search_query with the cleaned user search query + * + * If $terms is 'any' then the words will be extracted from the search query + * and combined with | inside brackets. They will afterwards be treated like + * an standard search query. + * + * Then it analyses the query and fills the internal arrays $must_not_contain_ids, + * $must_contain_ids and $must_exclude_one_ids which are later used by keyword_search() + * + * @param string $keywords contains the search query string as entered by the user + * @param string $terms is either 'all' (use search query as entered, default words to 'must be contained in post') + * or 'any' (find all posts containing at least one of the given words) + * @return boolean false if no valid keywords were found and otherwise true + */ + public function split_keywords($keywords, $terms) + { + $tokens = '+-|()* '; + + $keywords = trim($this->cleanup($keywords, $tokens)); + + // allow word|word|word without brackets + if ((strpos($keywords, ' ') === false) && (strpos($keywords, '|') !== false) && (strpos($keywords, '(') === false)) + { + $keywords = '(' . $keywords . ')'; + } + + $open_bracket = $space = false; + for ($i = 0, $n = strlen($keywords); $i < $n; $i++) + { + if ($open_bracket !== false) + { + switch ($keywords[$i]) + { + case ')': + if ($open_bracket + 1 == $i) + { + $keywords[$i - 1] = '|'; + $keywords[$i] = '|'; + } + $open_bracket = false; + break; + case '(': + $keywords[$i] = '|'; + break; + case '+': + case '-': + case ' ': + $keywords[$i] = '|'; + break; + case '*': + // $i can never be 0 here since $open_bracket is initialised to false + if (strpos($tokens, $keywords[$i - 1]) !== false && ($i + 1 === $n || strpos($tokens, $keywords[$i + 1]) !== false)) + { + $keywords[$i] = '|'; + } + break; + } + } + else + { + switch ($keywords[$i]) + { + case ')': + $keywords[$i] = ' '; + break; + case '(': + $open_bracket = $i; + $space = false; + break; + case '|': + $keywords[$i] = ' '; + break; + case '-': + case '+': + $space = $keywords[$i]; + break; + case ' ': + if ($space !== false) + { + $keywords[$i] = $space; + } + break; + default: + $space = false; + } + } + } + + if ($open_bracket !== false) + { + $keywords .= ')'; + } + + $match = array( + '# +#', + '#\|\|+#', + '#(\+|\-)(?:\+|\-)+#', + '#\(\|#', + '#\|\)#', + ); + $replace = array( + ' ', + '|', + '$1', + '(', + ')', + ); + + $keywords = preg_replace($match, $replace, $keywords); + $num_keywords = count(explode(' ', $keywords)); + + // We limit the number of allowed keywords to minimize load on the database + if ($this->config['max_num_search_keywords'] && $num_keywords > $this->config['max_num_search_keywords']) + { + trigger_error($this->user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', (int) $this->config['max_num_search_keywords'], $num_keywords)); + } + + // $keywords input format: each word separated by a space, words in a bracket are not separated + + // the user wants to search for any word, convert the search query + if ($terms == 'any') + { + $words = array(); + + preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $words); + if (count($words[1])) + { + $keywords = '(' . implode('|', $words[1]) . ')'; + } + } + + // Remove non trailing wildcards from each word to prevent a full table scan (it's now using the database index) + $match = '#\*(?!$|\s)#'; + $replace = '$1'; + $keywords = preg_replace($match, $replace, $keywords); + + // Only allow one wildcard in the search query to limit the database load + $match = '#\*#'; + $replace = '$1'; + $count_wildcards = substr_count($keywords, '*'); + + // Reverse the string to remove all wildcards except the first one + $keywords = strrev(preg_replace($match, $replace, strrev($keywords), $count_wildcards - 1)); + unset($count_wildcards); + + // set the search_query which is shown to the user + $this->search_query = $keywords; + + $exact_words = array(); + preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words); + $exact_words = $exact_words[1]; + + $common_ids = $words = array(); + + if (count($exact_words)) + { + $sql = 'SELECT word_id, word_text, word_common + FROM ' . SEARCH_WORDLIST_TABLE . ' + WHERE ' . $this->db->sql_in_set('word_text', $exact_words) . ' + ORDER BY word_count ASC'; + $result = $this->db->sql_query($sql); + + // store an array of words and ids, remove common words + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['word_common']) + { + $this->common_words[] = $row['word_text']; + $common_ids[$row['word_text']] = (int) $row['word_id']; + continue; + } + + $words[$row['word_text']] = (int) $row['word_id']; + } + $this->db->sql_freeresult($result); + } + + // Handle +, - without preceding whitespace character + $match = array('#(\S)\+#', '#(\S)-#'); + $replace = array('$1 +', '$1 +'); + + $keywords = preg_replace($match, $replace, $keywords); + + // now analyse the search query, first split it using the spaces + $query = explode(' ', $keywords); + + $this->must_contain_ids = array(); + $this->must_not_contain_ids = array(); + $this->must_exclude_one_ids = array(); + + foreach ($query as $word) + { + if (empty($word)) + { + continue; + } + + // words which should not be included + if ($word[0] == '-') + { + $word = substr($word, 1); + + // a group of which at least one may not be in the resulting posts + if ($word[0] == '(') + { + $word = array_unique(explode('|', substr($word, 1, -1))); + $mode = 'must_exclude_one'; + } + // one word which should not be in the resulting posts + else + { + $mode = 'must_not_contain'; + } + $ignore_no_id = true; + } + // words which have to be included + else + { + // no prefix is the same as a +prefix + if ($word[0] == '+') + { + $word = substr($word, 1); + } + + // a group of words of which at least one word should be in every resulting post + if ($word[0] == '(') + { + $word = array_unique(explode('|', substr($word, 1, -1))); + } + $ignore_no_id = false; + $mode = 'must_contain'; + } + + if (empty($word)) + { + continue; + } + + // if this is an array of words then retrieve an id for each + if (is_array($word)) + { + $non_common_words = array(); + $id_words = array(); + foreach ($word as $i => $word_part) + { + if (strpos($word_part, '*') !== false) + { + $len = utf8_strlen(str_replace('*', '', $word_part)); + if ($len >= $this->word_length['min'] && $len <= $this->word_length['max']) + { + $id_words[] = '\'' . $this->db->sql_escape(str_replace('*', '%', $word_part)) . '\''; + $non_common_words[] = $word_part; + } + else + { + $this->common_words[] = $word_part; + } + } + else if (isset($words[$word_part])) + { + $id_words[] = $words[$word_part]; + $non_common_words[] = $word_part; + } + else + { + $len = utf8_strlen($word_part); + if ($len < $this->word_length['min'] || $len > $this->word_length['max']) + { + $this->common_words[] = $word_part; + } + } + } + if (count($id_words)) + { + sort($id_words); + if (count($id_words) > 1) + { + $this->{$mode . '_ids'}[] = $id_words; + } + else + { + $mode = ($mode == 'must_exclude_one') ? 'must_not_contain' : $mode; + $this->{$mode . '_ids'}[] = $id_words[0]; + } + } + // throw an error if we shall not ignore unexistant words + else if (!$ignore_no_id && count($non_common_words)) + { + trigger_error(sprintf($this->user->lang['WORDS_IN_NO_POST'], implode($this->user->lang['COMMA_SEPARATOR'], $non_common_words))); + } + unset($non_common_words); + } + // else we only need one id + else if (($wildcard = strpos($word, '*') !== false) || isset($words[$word])) + { + if ($wildcard) + { + $len = utf8_strlen(str_replace('*', '', $word)); + if ($len >= $this->word_length['min'] && $len <= $this->word_length['max']) + { + $this->{$mode . '_ids'}[] = '\'' . $this->db->sql_escape(str_replace('*', '%', $word)) . '\''; + } + else + { + $this->common_words[] = $word; + } + } + else + { + $this->{$mode . '_ids'}[] = $words[$word]; + } + } + else + { + if (!isset($common_ids[$word])) + { + $len = utf8_strlen($word); + if ($len < $this->word_length['min'] || $len > $this->word_length['max']) + { + $this->common_words[] = $word; + } + } + } + } + + // Return true if all words are not common words + if (count($exact_words) - count($this->common_words) > 0) + { + return true; + } + return false; + } + + /** + * Performs a search on keywords depending on display specific params. You have to run split_keywords() first + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param string $fields contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched) + * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @return boolean|int total number of results + */ + public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No keywords? No posts. + if (empty($this->search_query)) + { + return false; + } + + // we can't search for negatives only + if (empty($this->must_contain_ids)) + { + return false; + } + + $must_contain_ids = $this->must_contain_ids; + $must_not_contain_ids = $this->must_not_contain_ids; + $must_exclude_one_ids = $this->must_exclude_one_ids; + + sort($must_contain_ids); + sort($must_not_contain_ids); + sort($must_exclude_one_ids); + + // generate a search_key from all the options to identify the results + $search_key_array = array( + serialize($must_contain_ids), + serialize($must_not_contain_ids), + serialize($must_exclude_one_ids), + $type, + $fields, + $terms, + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary), + $author_name, + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_native_by_keyword_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var array must_contain_ids Array with post ids of posts containing words that are to be included + * @var array must_not_contain_ids Array with post ids of posts containing words that should not be included + * @var array must_exclude_one_ids Array with post ids of posts containing at least one word that needs to be excluded + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'must_contain_ids', + 'must_not_contain_ids', + 'must_exclude_one_ids', + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_by_keyword_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + // try reading the results from cache + $total_results = 0; + if ($this->obtain_ids($search_key, $total_results, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $total_results; + } + + $id_ary = array(); + + $sql_where = array(); + $m_num = 0; + $w_num = 0; + + $sql_array = array( + 'SELECT' => ($type == 'posts') ? 'p.post_id' : 'p.topic_id', + 'FROM' => array( + SEARCH_WORDMATCH_TABLE => array(), + SEARCH_WORDLIST_TABLE => array(), + ), + 'LEFT_JOIN' => array(array( + 'FROM' => array(POSTS_TABLE => 'p'), + 'ON' => 'm0.post_id = p.post_id', + )), + ); + + $title_match = ''; + $left_join_topics = false; + $group_by = true; + // Build some display specific sql strings + switch ($fields) + { + case 'titleonly': + $title_match = 'title_match = 1'; + $group_by = false; + // no break + case 'firstpost': + $left_join_topics = true; + $sql_where[] = 'p.post_id = t.topic_first_post_id'; + break; + + case 'msgonly': + $title_match = 'title_match = 0'; + $group_by = false; + break; + } + + if ($type == 'topics') + { + $left_join_topics = true; + $group_by = true; + } + + /** + * @todo Add a query optimizer (handle stuff like "+(4|3) +4") + */ + + foreach ($this->must_contain_ids as $subquery) + { + if (is_array($subquery)) + { + $group_by = true; + + $word_id_sql = array(); + $word_ids = array(); + foreach ($subquery as $id) + { + if (is_string($id)) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(SEARCH_WORDLIST_TABLE => 'w' . $w_num), + 'ON' => "w$w_num.word_text LIKE $id" + ); + $word_ids[] = "w$w_num.word_id"; + + $w_num++; + } + else + { + $word_ids[] = $id; + } + } + + $sql_where[] = $this->db->sql_in_set("m$m_num.word_id", $word_ids); + + unset($word_id_sql); + unset($word_ids); + } + else if (is_string($subquery)) + { + $sql_array['FROM'][SEARCH_WORDLIST_TABLE][] = 'w' . $w_num; + + $sql_where[] = "w$w_num.word_text LIKE $subquery"; + $sql_where[] = "m$m_num.word_id = w$w_num.word_id"; + + $group_by = true; + $w_num++; + } + else + { + $sql_where[] = "m$m_num.word_id = $subquery"; + } + + $sql_array['FROM'][SEARCH_WORDMATCH_TABLE][] = 'm' . $m_num; + + if ($title_match) + { + $sql_where[] = "m$m_num.$title_match"; + } + + if ($m_num != 0) + { + $sql_where[] = "m$m_num.post_id = m0.post_id"; + } + $m_num++; + } + + foreach ($this->must_not_contain_ids as $key => $subquery) + { + if (is_string($subquery)) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(SEARCH_WORDLIST_TABLE => 'w' . $w_num), + 'ON' => "w$w_num.word_text LIKE $subquery" + ); + + $this->must_not_contain_ids[$key] = "w$w_num.word_id"; + + $group_by = true; + $w_num++; + } + } + + if (count($this->must_not_contain_ids)) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(SEARCH_WORDMATCH_TABLE => 'm' . $m_num), + 'ON' => $this->db->sql_in_set("m$m_num.word_id", $this->must_not_contain_ids) . (($title_match) ? " AND m$m_num.$title_match" : '') . " AND m$m_num.post_id = m0.post_id" + ); + + $sql_where[] = "m$m_num.word_id IS NULL"; + $m_num++; + } + + foreach ($this->must_exclude_one_ids as $ids) + { + $is_null_joins = array(); + foreach ($ids as $id) + { + if (is_string($id)) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(SEARCH_WORDLIST_TABLE => 'w' . $w_num), + 'ON' => "w$w_num.word_text LIKE $id" + ); + $id = "w$w_num.word_id"; + + $group_by = true; + $w_num++; + } + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(SEARCH_WORDMATCH_TABLE => 'm' . $m_num), + 'ON' => "m$m_num.word_id = $id AND m$m_num.post_id = m0.post_id" . (($title_match) ? " AND m$m_num.$title_match" : '') + ); + $is_null_joins[] = "m$m_num.word_id IS NULL"; + + $m_num++; + } + $sql_where[] = '(' . implode(' OR ', $is_null_joins) . ')'; + } + + $sql_where[] = $post_visibility; + + $search_query = $this->search_query; + $must_exclude_one_ids = $this->must_exclude_one_ids; + $must_not_contain_ids = $this->must_not_contain_ids; + $must_contain_ids = $this->must_contain_ids; + + $sql_sort_table = $sql_sort_join = $sql_match = $sql_match_where = $sql_sort = ''; + + /** + * Allow changing the query used for counting for posts using fulltext_native + * + * @event core.search_native_keywords_count_query_before + * @var string search_query The parsed keywords used for this search + * @var array must_not_contain_ids Ids that cannot be taken into account for the results + * @var array must_exclude_one_ids Ids that cannot be on the results + * @var array must_contain_ids Ids that must be on the results + * @var int total_results The previous result count for the format of the query + * Set to 0 to force a re-count + * @var array sql_array The data on how to search in the DB at this point + * @var bool left_join_topics Whether or not TOPICS_TABLE should be CROSS JOIN'ED + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant) + * @var array ex_fid_ary Which forums not to search on + * @var int topic_id Limit the search to this topic_id only + * @var string sql_sort_table Extra tables to include in the SQL query. + * Used in conjunction with sql_sort_join + * @var string sql_sort_join SQL conditions to join all the tables used together. + * Used in conjunction with sql_sort_table + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sql_where An array of the current WHERE clause conditions + * @var string sql_match Which columns to do the search on + * @var string sql_match_where Extra conditions to use to properly filter the matching process + * @var bool group_by Whether or not the SQL query requires a GROUP BY for the elements in the SELECT clause + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'search_query', + 'must_not_contain_ids', + 'must_exclude_one_ids', + 'must_contain_ids', + 'total_results', + 'sql_array', + 'left_join_topics', + 'author_ary', + 'author_name', + 'ex_fid_ary', + 'topic_id', + 'sql_sort_table', + 'sql_sort_join', + 'sort_days', + 'sql_where', + 'sql_match', + 'sql_match_where', + 'group_by', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_keywords_count_query_before', compact($vars))); + + if ($topic_id) + { + $sql_where[] = 'p.topic_id = ' . $topic_id; + } + + if (count($author_ary)) + { + if ($author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else + { + $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); + } + $sql_where[] = $sql_author; + } + + if (count($ex_fid_ary)) + { + $sql_where[] = $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true); + } + + if ($sort_days) + { + $sql_where[] = 'p.post_time >= ' . (time() - ($sort_days * 86400)); + } + + $sql_array['WHERE'] = implode(' AND ', $sql_where); + + $is_mysql = false; + // if the total result count is not cached yet, retrieve it from the db + if (!$total_results) + { + $sql = ''; + $sql_array_count = $sql_array; + + if ($left_join_topics) + { + $sql_array_count['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'p.topic_id = t.topic_id' + ); + } + + switch ($this->db->get_sql_layer()) + { + case 'mysqli': + + // 3.x does not support SQL_CALC_FOUND_ROWS + // $sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT']; + $is_mysql = true; + + break; + + case 'sqlite3': + $sql_array_count['SELECT'] = ($type == 'posts') ? 'DISTINCT p.post_id' : 'DISTINCT p.topic_id'; + $sql = 'SELECT COUNT(' . (($type == 'posts') ? 'post_id' : 'topic_id') . ') as total_results + FROM (' . $this->db->sql_build_query('SELECT', $sql_array_count) . ')'; + + // no break + + default: + $sql_array_count['SELECT'] = ($type == 'posts') ? 'COUNT(DISTINCT p.post_id) AS total_results' : 'COUNT(DISTINCT p.topic_id) AS total_results'; + $sql = (!$sql) ? $this->db->sql_build_query('SELECT', $sql_array_count) : $sql; + + $result = $this->db->sql_query($sql); + $total_results = (int) $this->db->sql_fetchfield('total_results'); + $this->db->sql_freeresult($result); + + if (!$total_results) + { + return false; + } + break; + } + + unset($sql_array_count, $sql); + } + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + + switch ($sql_sort[0]) + { + case 'u': + $sql_array['FROM'][USERS_TABLE] = 'u'; + $sql_where[] = 'u.user_id = p.poster_id '; + break; + + case 't': + $left_join_topics = true; + break; + + case 'f': + $sql_array['FROM'][FORUMS_TABLE] = 'f'; + $sql_where[] = 'f.forum_id = p.forum_id'; + break; + } + + if ($left_join_topics) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'p.topic_id = t.topic_id' + ); + } + + // if using mysql and the total result count is not calculated yet, get it from the db + if (!$total_results && $is_mysql) + { + // Also count rows for the query as if there was not LIMIT. Add SQL_CALC_FOUND_ROWS to SQL + $sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT']; + } + + $sql_array['WHERE'] = implode(' AND ', $sql_where); + $sql_array['GROUP_BY'] = ($group_by) ? (($type == 'posts') ? 'p.post_id' : 'p.topic_id') . ', ' . $sort_by_sql[$sort_key] : ''; + $sql_array['ORDER_BY'] = $sql_sort; + + unset($sql_where, $sql_sort, $group_by); + + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[(($type == 'posts') ? 'post_id' : 'topic_id')]; + } + $this->db->sql_freeresult($result); + + if (!$total_results && $is_mysql) + { + // Get the number of results as calculated by MySQL + $sql_count = 'SELECT FOUND_ROWS() as total_results'; + $result = $this->db->sql_query($sql_count); + $total_results = (int) $this->db->sql_fetchfield('total_results'); + $this->db->sql_freeresult($result); + + if (!$total_results) + { + return false; + } + } + + if ($start >= $total_results) + { + $start = floor(($total_results - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[(($type == 'posts') ? 'post_id' : 'topic_id')]; + } + $this->db->sql_freeresult($result); + + } + + // store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page + $this->save_ids($search_key, $this->search_query, $author_ary, $total_results, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, (int) $per_page); + + return $total_results; + } + + /** + * Performs a search on an author's posts without caring about message contents. Depends on display specific params + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param boolean $firstpost_only if true, only topic starting posts will be considered + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @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, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No author? No posts + if (!count($author_ary)) + { + return 0; + } + + // generate a search_key from all the options to identify the results + $search_key_array = array( + '', + $type, + ($firstpost_only) ? 'firstpost' : '', + '', + '', + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary), + $author_name, + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_native_by_author_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var boolean firstpost_only Flag indicating if only topic starting posts are considered + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'firstpost_only', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_by_author_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + // try reading the results from cache + $total_results = 0; + if ($this->obtain_ids($search_key, $total_results, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $total_results; + } + + $id_ary = array(); + + // Create some display specific sql strings + if ($author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else + { + $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); + } + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; + $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; + $post_visibility = ($post_visibility) ? ' AND ' . $post_visibility : ''; + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_sort_table = $sql_sort_join = ''; + switch ($sql_sort[0]) + { + case 'u': + $sql_sort_table = USERS_TABLE . ' u, '; + $sql_sort_join = ' AND u.user_id = p.poster_id '; + break; + + case 't': + $sql_sort_table = ($type == 'posts' && !$firstpost_only) ? TOPICS_TABLE . ' t, ' : ''; + $sql_sort_join = ($type == 'posts' && !$firstpost_only) ? ' AND t.topic_id = p.topic_id ' : ''; + break; + + case 'f': + $sql_sort_table = FORUMS_TABLE . ' f, '; + $sql_sort_join = ' AND f.forum_id = p.forum_id '; + break; + } + + $select = ($type == 'posts') ? 'p.post_id' : 't.topic_id'; + $is_mysql = false; + + /** + * Allow changing the query used to search for posts by author in fulltext_native + * + * @event core.search_native_author_count_query_before + * @var int total_results The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var string type The type of search being made + * @var string select SQL SELECT clause for what to get + * @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen + * @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table + * @var array sql_author SQL WHERE condition for the post author ids + * @var int topic_id Limit the search to this topic_id only + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var string sort_days Time, in days, that the oldest post showing can have + * @var string sql_time The SQL to search on the time specifyed by sort_days + * @var bool firstpost_only Wether or not to search only on the first post of the topics + * @var string sql_firstpost The SQL used in the WHERE claused to filter by firstpost. + * @var array ex_fid_ary Forum ids that must not be searched on + * @var array sql_fora SQL query for ex_fid_ary + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'total_results', + 'type', + 'select', + 'sql_sort_table', + 'sql_sort_join', + 'sql_author', + 'topic_id', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'sort_days', + 'sql_time', + 'firstpost_only', + 'sql_firstpost', + 'ex_fid_ary', + 'sql_fora', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_author_count_query_before', compact($vars))); + + // If the cache was completely empty count the results + if (!$total_results) + { + switch ($this->db->get_sql_layer()) + { + case 'mysqli': +// $select = 'SQL_CALC_FOUND_ROWS ' . $select; + $is_mysql = true; + break; + + default: + if ($type == 'posts') + { + $sql = 'SELECT COUNT(p.post_id) as total_results + FROM ' . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . " + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $post_visibility + $sql_fora + $sql_time"; + } + else + { + if ($this->db->get_sql_layer() == 'sqlite3') + { + $sql = 'SELECT COUNT(topic_id) as total_results + FROM (SELECT DISTINCT t.topic_id'; + } + else + { + $sql = 'SELECT COUNT(DISTINCT t.topic_id) as total_results'; + } + + $sql .= ' FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $post_visibility + $sql_fora + AND t.topic_id = p.topic_id + $sql_time" . ($this->db->get_sql_layer() == 'sqlite3' ? ')' : ''); + } + $result = $this->db->sql_query($sql); + + $total_results = (int) $this->db->sql_fetchfield('total_results'); + $this->db->sql_freeresult($result); + + if (!$total_results) + { + return false; + } + break; + } + } + + // Build the query for really selecting the post_ids + if ($type == 'posts') + { + $sql = "SELECT $select + FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t' : '') . " + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $post_visibility + $sql_fora + $sql_sort_join + $sql_time + ORDER BY $sql_sort"; + $field = 'post_id'; + } + else + { + $sql = "SELECT $select + FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $post_visibility + $sql_fora + AND t.topic_id = p.topic_id + $sql_sort_join + $sql_time + GROUP BY t.topic_id, " . $sort_by_sql[$sort_key] . ' + ORDER BY ' . $sql_sort; + $field = 'topic_id'; + } + + // Only read one block of posts from the db and then cache it + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + if (!$total_results && $is_mysql) + { + // Count rows for the executed queries. Replace $select within $sql with SQL_CALC_FOUND_ROWS, and run it. + $sql_calc = str_replace('SELECT ' . $select, 'SELECT SQL_CALC_FOUND_ROWS ' . $select, $sql); + + $result = $this->db->sql_query($sql_calc); + $this->db->sql_freeresult($result); + + $sql_count = 'SELECT FOUND_ROWS() as total_results'; + $result = $this->db->sql_query($sql_count); + $total_results = (int) $this->db->sql_fetchfield('total_results'); + $this->db->sql_freeresult($result); + + if (!$total_results) + { + return false; + } + } + + if ($start >= $total_results) + { + $start = floor(($total_results - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + } + + if (count($id_ary)) + { + $this->save_ids($search_key, '', $author_ary, $total_results, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, $per_page); + + return $total_results; + } + return false; + } + + /** + * Split a text into words of a given length + * + * The text is converted to UTF-8, cleaned up, and split. Then, words that + * conform to the defined length range are returned in an array. + * + * NOTE: duplicates are NOT removed from the return array + * + * @param string $text Text to split, encoded in UTF-8 + * @return array Array of UTF-8 words + */ + public function split_message($text) + { + $match = $words = array(); + + /** + * Taken from the original code + */ + // Do not index code + $match[] = '#\[code(?:=.*?)?(\:?[0-9a-z]{5,})\].*?\[\/code(\:?[0-9a-z]{5,})\]#is'; + // BBcode + $match[] = '#\[\/?[a-z0-9\*\+\-]+(?:=.*?)?(?::[a-z])?(\:?[0-9a-z]{5,})\]#'; + + $min = $this->word_length['min']; + + $isset_min = $min - 1; + + /** + * Clean up the string, remove HTML tags, remove BBCodes + */ + $word = strtok($this->cleanup(preg_replace($match, ' ', strip_tags($text)), -1), ' '); + + while (strlen($word)) + { + if (strlen($word) > 255 || strlen($word) <= $isset_min) + { + /** + * Words longer than 255 bytes are ignored. This will have to be + * changed whenever we change the length of search_wordlist.word_text + * + * Words shorter than $isset_min bytes are ignored, too + */ + $word = strtok(' '); + continue; + } + + $len = utf8_strlen($word); + + /** + * Test whether the word is too short to be indexed. + * + * Note that this limit does NOT apply to CJK and Hangul + */ + if ($len < $min) + { + /** + * Note: this could be optimized. If the codepoint is lower than Hangul's range + * we know that it will also be lower than CJK ranges + */ + if ((strncmp($word, self::UTF8_HANGUL_FIRST, 3) < 0 || strncmp($word, self::UTF8_HANGUL_LAST, 3) > 0) + && (strncmp($word, self::UTF8_CJK_FIRST, 3) < 0 || strncmp($word, self::UTF8_CJK_LAST, 3) > 0) + && (strncmp($word, self::UTF8_CJK_B_FIRST, 4) < 0 || strncmp($word, self::UTF8_CJK_B_LAST, 4) > 0)) + { + $word = strtok(' '); + continue; + } + } + + $words[] = $word; + $word = strtok(' '); + } + + return $words; + } + + /** + * Updates wordlist and wordmatch tables when a message is posted or changed + * + * @param string $mode Contains the post mode: edit, post, reply, quote + * @param int $post_id The id of the post which is modified/created + * @param string &$message New or updated post content + * @param string &$subject New or updated post subject + * @param int $poster_id Post author's user id + * @param int $forum_id The id of the forum in which the post is located + */ + public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) + { + if (!$this->config['fulltext_native_load_upd']) + { + /** + * The search indexer is disabled, return + */ + return; + } + + // Split old and new post/subject to obtain array of 'words' + $split_text = $this->split_message($message); + $split_title = $this->split_message($subject); + + $cur_words = array('post' => array(), 'title' => array()); + + $words = array(); + if ($mode == 'edit') + { + $words['add']['post'] = array(); + $words['add']['title'] = array(); + $words['del']['post'] = array(); + $words['del']['title'] = array(); + + $sql = 'SELECT w.word_id, w.word_text, m.title_match + FROM ' . SEARCH_WORDLIST_TABLE . ' w, ' . SEARCH_WORDMATCH_TABLE . " m + WHERE m.post_id = $post_id + AND w.word_id = m.word_id"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $which = ($row['title_match']) ? 'title' : 'post'; + $cur_words[$which][$row['word_text']] = $row['word_id']; + } + $this->db->sql_freeresult($result); + + $words['add']['post'] = array_diff($split_text, array_keys($cur_words['post'])); + $words['add']['title'] = array_diff($split_title, array_keys($cur_words['title'])); + $words['del']['post'] = array_diff(array_keys($cur_words['post']), $split_text); + $words['del']['title'] = array_diff(array_keys($cur_words['title']), $split_title); + } + else + { + $words['add']['post'] = $split_text; + $words['add']['title'] = $split_title; + $words['del']['post'] = array(); + $words['del']['title'] = array(); + } + + /** + * Event to modify method arguments and words before the native search index is updated + * + * @event core.search_native_index_before + * @var string mode Contains the post mode: edit, post, reply, quote + * @var int post_id The id of the post which is modified/created + * @var string message New or updated post content + * @var string subject New or updated post subject + * @var int poster_id Post author's user id + * @var int forum_id The id of the forum in which the post is located + * @var array words Grouped lists of words added to or remove from the index + * @var array split_text Array of words from the message + * @var array split_title Array of words from the title + * @var array cur_words Array of words currently in the index for comparing to new words + * when mode is edit. Empty for other modes. + * @since 3.2.3-RC1 + */ + $vars = array( + 'mode', + 'post_id', + 'message', + 'subject', + 'poster_id', + 'forum_id', + 'words', + 'split_text', + 'split_title', + 'cur_words', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_index_before', compact($vars))); + + unset($split_text); + unset($split_title); + + // Get unique words from the above arrays + $unique_add_words = array_unique(array_merge($words['add']['post'], $words['add']['title'])); + + // We now have unique arrays of all words to be added and removed and + // individual arrays of added and removed words for text and title. What + // we need to do now is add the new words (if they don't already exist) + // and then add (or remove) matches between the words and this post + if (count($unique_add_words)) + { + $sql = 'SELECT word_id, word_text + FROM ' . SEARCH_WORDLIST_TABLE . ' + WHERE ' . $this->db->sql_in_set('word_text', $unique_add_words); + $result = $this->db->sql_query($sql); + + $word_ids = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $word_ids[$row['word_text']] = $row['word_id']; + } + $this->db->sql_freeresult($result); + $new_words = array_diff($unique_add_words, array_keys($word_ids)); + + $this->db->sql_transaction('begin'); + if (count($new_words)) + { + $sql_ary = array(); + + foreach ($new_words as $word) + { + $sql_ary[] = array('word_text' => (string) $word, 'word_count' => 0); + } + $this->db->sql_return_on_error(true); + $this->db->sql_multi_insert(SEARCH_WORDLIST_TABLE, $sql_ary); + $this->db->sql_return_on_error(false); + } + unset($new_words, $sql_ary); + } + else + { + $this->db->sql_transaction('begin'); + } + + // now update the search match table, remove links to removed words and add links to new words + foreach ($words['del'] as $word_in => $word_ary) + { + $title_match = ($word_in == 'title') ? 1 : 0; + + if (count($word_ary)) + { + $sql_in = array(); + foreach ($word_ary as $word) + { + $sql_in[] = $cur_words[$word_in][$word]; + } + + $sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . ' + WHERE ' . $this->db->sql_in_set('word_id', $sql_in) . ' + AND post_id = ' . intval($post_id) . " + AND title_match = $title_match"; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' + SET word_count = word_count - 1 + WHERE ' . $this->db->sql_in_set('word_id', $sql_in) . ' + AND word_count > 0'; + $this->db->sql_query($sql); + + unset($sql_in); + } + } + + $this->db->sql_return_on_error(true); + foreach ($words['add'] as $word_in => $word_ary) + { + $title_match = ($word_in == 'title') ? 1 : 0; + + if (count($word_ary)) + { + $sql = 'INSERT INTO ' . SEARCH_WORDMATCH_TABLE . ' (post_id, word_id, title_match) + SELECT ' . (int) $post_id . ', word_id, ' . (int) $title_match . ' + FROM ' . SEARCH_WORDLIST_TABLE . ' + WHERE ' . $this->db->sql_in_set('word_text', $word_ary); + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' + SET word_count = word_count + 1 + WHERE ' . $this->db->sql_in_set('word_text', $word_ary); + $this->db->sql_query($sql); + } + } + $this->db->sql_return_on_error(false); + + $this->db->sql_transaction('commit'); + + // destroy cached search results containing any of the words removed or added + $this->destroy_cache(array_unique(array_merge($words['add']['post'], $words['add']['title'], $words['del']['post'], $words['del']['title'])), array($poster_id)); + + unset($unique_add_words); + unset($words); + unset($cur_words); + } + + /** + * Removes entries from the wordmatch table for the specified post_ids + */ + public function index_remove($post_ids, $author_ids, $forum_ids) + { + if (count($post_ids)) + { + $sql = 'SELECT w.word_id, w.word_text, m.title_match + FROM ' . SEARCH_WORDMATCH_TABLE . ' m, ' . SEARCH_WORDLIST_TABLE . ' w + WHERE ' . $this->db->sql_in_set('m.post_id', $post_ids) . ' + AND w.word_id = m.word_id'; + $result = $this->db->sql_query($sql); + + $message_word_ids = $title_word_ids = $word_texts = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['title_match']) + { + $title_word_ids[] = $row['word_id']; + } + else + { + $message_word_ids[] = $row['word_id']; + } + $word_texts[] = $row['word_text']; + } + $this->db->sql_freeresult($result); + + if (count($title_word_ids)) + { + $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' + SET word_count = word_count - 1 + WHERE ' . $this->db->sql_in_set('word_id', $title_word_ids) . ' + AND word_count > 0'; + $this->db->sql_query($sql); + } + + if (count($message_word_ids)) + { + $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' + SET word_count = word_count - 1 + WHERE ' . $this->db->sql_in_set('word_id', $message_word_ids) . ' + AND word_count > 0'; + $this->db->sql_query($sql); + } + + unset($title_word_ids); + unset($message_word_ids); + + $sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . ' + WHERE ' . $this->db->sql_in_set('post_id', $post_ids); + $this->db->sql_query($sql); + } + + $this->destroy_cache(array_unique($word_texts), array_unique($author_ids)); + } + + /** + * Tidy up indexes: Tag 'common words' and remove + * words no longer referenced in the match table + */ + public function tidy() + { + // Is the fulltext indexer disabled? If yes then we need not + // carry on ... it's okay ... I know when I'm not wanted boo hoo + if (!$this->config['fulltext_native_load_upd']) + { + $this->config->set('search_last_gc', time(), false); + return; + } + + $destroy_cache_words = array(); + + // Remove common words + if ($this->config['num_posts'] >= 100 && $this->config['fulltext_native_common_thres']) + { + $common_threshold = ((double) $this->config['fulltext_native_common_thres']) / 100.0; + // First, get the IDs of common words + $sql = 'SELECT word_id, word_text + FROM ' . SEARCH_WORDLIST_TABLE . ' + WHERE word_count > ' . floor($this->config['num_posts'] * $common_threshold) . ' + OR word_common = 1'; + $result = $this->db->sql_query($sql); + + $sql_in = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $sql_in[] = $row['word_id']; + $destroy_cache_words[] = $row['word_text']; + } + $this->db->sql_freeresult($result); + + if (count($sql_in)) + { + // Flag the words + $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' + SET word_common = 1 + WHERE ' . $this->db->sql_in_set('word_id', $sql_in); + $this->db->sql_query($sql); + + // by setting search_last_gc to the new time here we make sure that if a user reloads because the + // following query takes too long, he won't run into it again + $this->config->set('search_last_gc', time(), false); + + // Delete the matches + $sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . ' + WHERE ' . $this->db->sql_in_set('word_id', $sql_in); + $this->db->sql_query($sql); + } + unset($sql_in); + } + + if (count($destroy_cache_words)) + { + // destroy cached search results containing any of the words that are now common or were removed + $this->destroy_cache(array_unique($destroy_cache_words)); + } + + $this->config->set('search_last_gc', time(), false); + } + + /** + * Deletes all words from the index + */ + public function delete_index($acp_module, $u_action) + { + $sql_queries = []; + + switch ($this->db->get_sql_layer()) + { + case 'sqlite3': + $sql_queries[] = 'DELETE FROM ' . SEARCH_WORDLIST_TABLE; + $sql_queries[] = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE; + $sql_queries[] = 'DELETE FROM ' . SEARCH_RESULTS_TABLE; + break; + + default: + $sql_queries[] = 'TRUNCATE TABLE ' . SEARCH_WORDLIST_TABLE; + $sql_queries[] = 'TRUNCATE TABLE ' . SEARCH_WORDMATCH_TABLE; + $sql_queries[] = 'TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE; + break; + } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the native search index is deleted + * + * @event core.search_native_delete_index_before + * @var array sql_queries Array with queries for deleting the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_delete_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } + } + + /** + * Returns true if both FULLTEXT indexes exist + */ + public function index_created() + { + if (!count($this->stats)) + { + $this->get_stats(); + } + + return ($this->stats['total_words'] && $this->stats['total_matches']) ? true : false; + } + + /** + * Returns an associative array containing information about the indexes + */ + public function index_stats() + { + if (!count($this->stats)) + { + $this->get_stats(); + } + + return array( + $this->user->lang['TOTAL_WORDS'] => $this->stats['total_words'], + $this->user->lang['TOTAL_MATCHES'] => $this->stats['total_matches']); + } + + protected function get_stats() + { + $this->stats['total_words'] = $this->db->get_estimated_row_count(SEARCH_WORDLIST_TABLE); + $this->stats['total_matches'] = $this->db->get_estimated_row_count(SEARCH_WORDMATCH_TABLE); + } + + /** + * Clean up a text to remove non-alphanumeric characters + * + * This method receives a UTF-8 string, normalizes and validates it, replaces all + * non-alphanumeric characters with strings then returns the result. + * + * Any number of "allowed chars" can be passed as a UTF-8 string in NFC. + * + * @param string $text Text to split, in UTF-8 (not normalized or sanitized) + * @param string $allowed_chars String of special chars to allow + * @param string $encoding Text encoding + * @return string Cleaned up text, only alphanumeric chars are left + */ + protected function cleanup($text, $allowed_chars = null, $encoding = 'utf-8') + { + static $conv = array(), $conv_loaded = array(); + $allow = array(); + + // Convert the text to UTF-8 + $encoding = strtolower($encoding); + if ($encoding != 'utf-8') + { + $text = utf8_recode($text, $encoding); + } + + $utf_len_mask = array( + "\xC0" => 2, + "\xD0" => 2, + "\xE0" => 3, + "\xF0" => 4 + ); + + /** + * Replace HTML entities and NCRs + */ + $text = htmlspecialchars_decode(utf8_decode_ncr($text), ENT_QUOTES); + + /** + * Normalize to NFC + */ + $text = \Normalizer::normalize($text); + + /** + * The first thing we do is: + * + * - convert ASCII-7 letters to lowercase + * - remove the ASCII-7 non-alpha characters + * - remove the bytes that should not appear in a valid UTF-8 string: 0xC0, + * 0xC1 and 0xF5-0xFF + * + * @todo in theory, the third one is already taken care of during normalization and those chars should have been replaced by Unicode replacement chars + */ + $sb_match = "ISTCPAMELRDOJBNHFGVWUQKYXZ\r\n\t!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\xC0\xC1\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"; + $sb_replace = 'istcpamelrdojbnhfgvwuqkyxz '; + + /** + * This is the list of legal ASCII chars, it is automatically extended + * with ASCII chars from $allowed_chars + */ + $legal_ascii = ' eaisntroludcpmghbfvq10xy2j9kw354867z'; + + /** + * Prepare an array containing the extra chars to allow + */ + if (isset($allowed_chars[0])) + { + $pos = 0; + $len = strlen($allowed_chars); + do + { + $c = $allowed_chars[$pos]; + + if ($c < "\x80") + { + /** + * ASCII char + */ + $sb_pos = strpos($sb_match, $c); + if (is_int($sb_pos)) + { + /** + * Remove the char from $sb_match and its corresponding + * replacement in $sb_replace + */ + $sb_match = substr($sb_match, 0, $sb_pos) . substr($sb_match, $sb_pos + 1); + $sb_replace = substr($sb_replace, 0, $sb_pos) . substr($sb_replace, $sb_pos + 1); + $legal_ascii .= $c; + } + + ++$pos; + } + else + { + /** + * UTF-8 char + */ + $utf_len = $utf_len_mask[$c & "\xF0"]; + $allow[substr($allowed_chars, $pos, $utf_len)] = 1; + $pos += $utf_len; + } + } + while ($pos < $len); + } + + $text = strtr($text, $sb_match, $sb_replace); + $ret = ''; + + $pos = 0; + $len = strlen($text); + + do + { + /** + * Do all consecutive ASCII chars at once + */ + if ($spn = strspn($text, $legal_ascii, $pos)) + { + $ret .= substr($text, $pos, $spn); + $pos += $spn; + } + + if ($pos >= $len) + { + return $ret; + } + + /** + * Capture the UTF char + */ + $utf_len = $utf_len_mask[$text[$pos] & "\xF0"]; + $utf_char = substr($text, $pos, $utf_len); + $pos += $utf_len; + + if (($utf_char >= self::UTF8_HANGUL_FIRST && $utf_char <= self::UTF8_HANGUL_LAST) + || ($utf_char >= self::UTF8_CJK_FIRST && $utf_char <= self::UTF8_CJK_LAST) + || ($utf_char >= self::UTF8_CJK_B_FIRST && $utf_char <= self::UTF8_CJK_B_LAST)) + { + /** + * All characters within these ranges are valid + * + * We separate them with a space in order to index each character + * individually + */ + $ret .= ' ' . $utf_char . ' '; + continue; + } + + if (isset($allow[$utf_char])) + { + /** + * The char is explicitly allowed + */ + $ret .= $utf_char; + continue; + } + + if (isset($conv[$utf_char])) + { + /** + * The char is mapped to something, maybe to itself actually + */ + $ret .= $conv[$utf_char]; + continue; + } + + /** + * The char isn't mapped, but did we load its conversion table? + * + * The search indexer table is split into blocks. The block number of + * each char is equal to its codepoint right-shifted for 11 bits. It + * means that out of the 11, 16 or 21 meaningful bits of a 2-, 3- or + * 4- byte sequence we only keep the leftmost 0, 5 or 10 bits. Thus, + * all UTF chars encoded in 2 bytes are in the same first block. + */ + if (isset($utf_char[2])) + { + if (isset($utf_char[3])) + { + /** + * 1111 0nnn 10nn nnnn 10nx xxxx 10xx xxxx + * 0000 0111 0011 1111 0010 0000 + */ + $idx = ((ord($utf_char[0]) & 0x07) << 7) | ((ord($utf_char[1]) & 0x3F) << 1) | ((ord($utf_char[2]) & 0x20) >> 5); + } + else + { + /** + * 1110 nnnn 10nx xxxx 10xx xxxx + * 0000 0111 0010 0000 + */ + $idx = ((ord($utf_char[0]) & 0x07) << 1) | ((ord($utf_char[1]) & 0x20) >> 5); + } + } + else + { + /** + * 110x xxxx 10xx xxxx + * 0000 0000 0000 0000 + */ + $idx = 0; + } + + /** + * Check if the required conv table has been loaded already + */ + if (!isset($conv_loaded[$idx])) + { + $conv_loaded[$idx] = 1; + $file = $this->phpbb_root_path . 'includes/utf/data/search_indexer_' . $idx . '.' . $this->php_ext; + + if (file_exists($file)) + { + $conv += include($file); + } + } + + if (isset($conv[$utf_char])) + { + $ret .= $conv[$utf_char]; + } + else + { + /** + * We add an entry to the conversion table so that we + * don't have to convert to codepoint and perform the checks + * that are above this block + */ + $conv[$utf_char] = ' '; + $ret .= ' '; + } + } + while (1); + + return $ret; + } + + /** + * Returns a list of options for the ACP to display + */ + public function acp() + { + /** + * if we need any options, copied from fulltext_native for now, will have to be adjusted or removed + */ + + $tpl = ' +
+

' . $this->user->lang['YES_SEARCH_UPDATE_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['MIN_SEARCH_CHARS_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['MAX_SEARCH_CHARS_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['COMMON_WORD_THRESHOLD_EXPLAIN'] . '
+
%
+
+ '; + + // These are fields required in the config table + return array( + 'tpl' => $tpl, + 'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:255', 'fulltext_native_max_chars' => 'integer:0:255', 'fulltext_native_common_thres' => 'double:0:100') + ); + } +} diff --git a/install/update/new/phpbb/search/fulltext_postgres.php b/install/update/new/phpbb/search/fulltext_postgres.php new file mode 100644 index 0000000..6241f21 --- /dev/null +++ b/install/update/new/phpbb/search/fulltext_postgres.php @@ -0,0 +1,1178 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\search; + +/** +* Fulltext search for PostgreSQL +*/ +class fulltext_postgres extends \phpbb\search\base +{ + /** + * Associative array holding index stats + * @var array + */ + protected $stats = array(); + + /** + * Holds the words entered by user, obtained by splitting the entered query on whitespace + * @var array + */ + protected $split_words = array(); + + /** + * Stores the tsearch query + * @var string + */ + protected $tsearch_query; + + /** + * True if phrase search is supported. + * PostgreSQL fulltext currently doesn't support it + * @var boolean + */ + protected $phrase_search = false; + + /** + * Config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Database connection + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Contains tidied search query. + * Operators are prefixed in search query and common words excluded + * @var string + */ + protected $search_query; + + /** + * Contains common words. + * Common words are words with length less/more than min/max length + * @var array + */ + protected $common_words = array(); + + /** + * Associative array stores the min and max word length to be searched + * @var array + */ + protected $word_length = array(); + + /** + * Constructor + * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend + * + * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + */ + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) + { + $this->config = $config; + $this->db = $db; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->user = $user; + + $this->word_length = array('min' => $this->config['fulltext_postgres_min_word_len'], 'max' => $this->config['fulltext_postgres_max_word_len']); + + /** + * Load the UTF tools + */ + if (!function_exists('utf8_strlen')) + { + include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + } + + $error = false; + } + + /** + * Returns the name of this search backend to be displayed to administrators + * + * @return string Name + */ + public function get_name() + { + return 'PostgreSQL Fulltext'; + } + + /** + * Returns the search_query + * + * @return string search query + */ + public function get_search_query() + { + return $this->search_query; + } + + /** + * Returns the common_words array + * + * @return array common words that are ignored by search backend + */ + public function get_common_words() + { + return $this->common_words; + } + + /** + * Returns the word_length array + * + * @return array min and max word length for searching + */ + public function get_word_length() + { + return $this->word_length; + } + + /** + * Returns if phrase search is supported or not + * + * @return bool + */ + public function supports_phrase_search() + { + return $this->phrase_search; + } + + /** + * Checks for correct PostgreSQL version and stores min/max word length in the config + * + * @return string|bool Language key of the error/incompatibility occurred + */ + public function init() + { + if ($this->db->get_sql_layer() != 'postgres') + { + return $this->user->lang['FULLTEXT_POSTGRES_INCOMPATIBLE_DATABASE']; + } + + return false; + } + + /** + * Splits keywords entered by a user into an array of words stored in $this->split_words + * Stores the tidied search query in $this->search_query + * + * @param string &$keywords Contains the keyword as entered by the user + * @param string $terms is either 'all' or 'any' + * @return bool false if no valid keywords were found and otherwise true + */ + public function split_keywords(&$keywords, $terms) + { + if ($terms == 'all') + { + $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#(^|\s)\+#', '#(^|\s)-#', '#(^|\s)\|#'); + $replace = array(' +', ' |', ' -', ' +', ' -', ' |'); + + $keywords = preg_replace($match, $replace, $keywords); + } + + // Filter out as above + $split_keywords = preg_replace("#[\"\n\r\t]+#", ' ', trim(htmlspecialchars_decode($keywords))); + + // Split words + $split_keywords = preg_replace('#([^\p{L}\p{N}\'*"()])#u', '$1$1', str_replace('\'\'', '\' \'', trim($split_keywords))); + $matches = array(); + preg_match_all('#(?:[^\p{L}\p{N}*"()]|^)([+\-|]?(?:[\p{L}\p{N}*"()]+\'?)*[\p{L}\p{N}*"()])(?:[^\p{L}\p{N}*"()]|$)#u', $split_keywords, $matches); + $this->split_words = $matches[1]; + + foreach ($this->split_words as $i => $word) + { + $clean_word = preg_replace('#^[+\-|"]#', '', $word); + + // check word length + $clean_len = utf8_strlen(str_replace('*', '', $clean_word)); + if (($clean_len < $this->config['fulltext_postgres_min_word_len']) || ($clean_len > $this->config['fulltext_postgres_max_word_len'])) + { + $this->common_words[] = $word; + unset($this->split_words[$i]); + } + } + + if ($terms == 'any') + { + $this->search_query = ''; + $this->tsearch_query = ''; + foreach ($this->split_words as $word) + { + if ((strpos($word, '+') === 0) || (strpos($word, '-') === 0) || (strpos($word, '|') === 0)) + { + $word = substr($word, 1); + } + $this->search_query .= $word . ' '; + $this->tsearch_query .= '|' . $word . ' '; + } + } + else + { + $this->search_query = ''; + $this->tsearch_query = ''; + foreach ($this->split_words as $word) + { + if (strpos($word, '+') === 0) + { + $this->search_query .= $word . ' '; + $this->tsearch_query .= '&' . substr($word, 1) . ' '; + } + else if (strpos($word, '-') === 0) + { + $this->search_query .= $word . ' '; + $this->tsearch_query .= '&!' . substr($word, 1) . ' '; + } + else if (strpos($word, '|') === 0) + { + $this->search_query .= $word . ' '; + $this->tsearch_query .= '|' . substr($word, 1) . ' '; + } + else + { + $this->search_query .= '+' . $word . ' '; + $this->tsearch_query .= '&' . $word . ' '; + } + } + } + + $this->tsearch_query = substr($this->tsearch_query, 1); + $this->search_query = utf8_htmlspecialchars($this->search_query); + + if ($this->search_query) + { + $this->split_words = array_values($this->split_words); + sort($this->split_words); + return true; + } + return false; + } + + /** + * Turns text into an array of words + * @param string $text contains post text/subject + */ + public function split_message($text) + { + // Split words + $text = preg_replace('#([^\p{L}\p{N}\'*])#u', '$1$1', str_replace('\'\'', '\' \'', trim($text))); + $matches = array(); + preg_match_all('#(?:[^\p{L}\p{N}*]|^)([+\-|]?(?:[\p{L}\p{N}*]+\'?)*[\p{L}\p{N}*])(?:[^\p{L}\p{N}*]|$)#u', $text, $matches); + $text = $matches[1]; + + // remove too short or too long words + $text = array_values($text); + for ($i = 0, $n = count($text); $i < $n; $i++) + { + $text[$i] = trim($text[$i]); + if (utf8_strlen($text[$i]) < $this->config['fulltext_postgres_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_postgres_max_word_len']) + { + unset($text[$i]); + } + } + + return array_values($text); + } + + /** + * Performs a search on keywords depending on display specific params. You have to run split_keywords() first + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param string $fields contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched) + * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @return boolean|int total number of results + */ + public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No keywords? No posts + if (!$this->search_query) + { + return false; + } + + // When search query contains queries like -foo + if (strpos($this->search_query, '+') === false) + { + return false; + } + + // generate a search_key from all the options to identify the results + $search_key_array = array( + implode(', ', $this->split_words), + $type, + $fields, + $terms, + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary) + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_postgres_by_keyword_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_by_keyword_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + if ($start < 0) + { + $start = 0; + } + + // try reading the results from cache + $result_count = 0; + if ($this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $result_count; + } + + $id_ary = array(); + + $join_topic = ($type == 'posts') ? false : true; + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_sort_table = $sql_sort_join = ''; + + switch ($sql_sort[0]) + { + case 'u': + $sql_sort_table = USERS_TABLE . ' u, '; + $sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster '; + break; + + case 't': + $join_topic = true; + break; + + case 'f': + $sql_sort_table = FORUMS_TABLE . ' f, '; + $sql_sort_join = ' AND f.forum_id = p.forum_id '; + break; + } + + // Build some display specific sql strings + switch ($fields) + { + case 'titleonly': + $sql_match = 'p.post_subject'; + $sql_match_where = ' AND p.post_id = t.topic_first_post_id'; + $join_topic = true; + break; + + case 'msgonly': + $sql_match = 'p.post_text'; + $sql_match_where = ''; + break; + + case 'firstpost': + $sql_match = 'p.post_subject, p.post_text'; + $sql_match_where = ' AND p.post_id = t.topic_first_post_id'; + $join_topic = true; + break; + + default: + $sql_match = 'p.post_subject, p.post_text'; + $sql_match_where = ''; + break; + } + + $tsearch_query = $this->tsearch_query; + + /** + * Allow changing the query used to search for posts using fulltext_postgres + * + * @event core.search_postgres_keywords_main_query_before + * @var string tsearch_query The parsed keywords used for this search + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var bool join_topic Weather or not TOPICS_TABLE should be CROSS JOIN'ED + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant) + * @var array ex_fid_ary Which forums not to search on + * @var int topic_id Limit the search to this topic_id only + * @var string sql_sort_table Extra tables to include in the SQL query. + * Used in conjunction with sql_sort_join + * @var string sql_sort_join SQL conditions to join all the tables used together. + * Used in conjunction with sql_sort_table + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sql_match Which columns to do the search on. + * @var string sql_match_where Extra conditions to use to properly filter the matching process + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'tsearch_query', + 'result_count', + 'join_topic', + 'author_ary', + 'author_name', + 'ex_fid_ary', + 'topic_id', + 'sql_sort_table', + 'sql_sort_join', + 'sort_days', + 'sql_match', + 'sql_match_where', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_keywords_main_query_before', compact($vars))); + + $sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id, ' . $sort_by_sql[$sort_key]; + $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; + $field = ($type == 'posts') ? 'post_id' : 'topic_id'; + + if (count($author_ary) && $author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else if (count($author_ary)) + { + $sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary); + } + else + { + $sql_author = ''; + } + + $sql_where_options = $sql_sort_join; + $sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : ''; + $sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : ''; + $sql_where_options .= (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_where_options .= ' AND ' . $post_visibility; + $sql_where_options .= $sql_author; + $sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $sql_where_options .= $sql_match_where; + + $sql_match = str_replace(',', " || ' ' ||", $sql_match); + $tmp_sql_match = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')"; + + $this->db->sql_transaction('begin'); + + $sql_from = "FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p"; + $sql_where = "WHERE (" . $tmp_sql_match . ") + $sql_where_options"; + $sql = "SELECT $sql_select + $sql_from + $sql_where + ORDER BY $sql_sort"; + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + + // if the total result count is not cached yet, retrieve it from the db + if (!$result_count) + { + $sql_count = "SELECT COUNT(*) as result_count + $sql_from + $sql_where"; + $result = $this->db->sql_query($sql_count); + $result_count = (int) $this->db->sql_fetchfield('result_count'); + $this->db->sql_freeresult($result); + + if (!$result_count) + { + return false; + } + } + + $this->db->sql_transaction('commit'); + + if ($start >= $result_count) + { + $start = floor(($result_count - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + } + + // store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page + $this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, (int) $per_page); + + return $result_count; + } + + /** + * Performs a search on an author's posts without caring about message contents. Depends on display specific params + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param boolean $firstpost_only if true, only topic starting posts will be considered + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @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, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No author? No posts + if (!count($author_ary)) + { + return 0; + } + + // generate a search_key from all the options to identify the results + $search_key_array = array( + '', + $type, + ($firstpost_only) ? 'firstpost' : '', + '', + '', + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary), + $author_name, + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_postgres_by_author_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var boolean firstpost_only Flag indicating if only topic starting posts are considered + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'firstpost_only', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_by_author_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + if ($start < 0) + { + $start = 0; + } + + // try reading the results from cache + $result_count = 0; + if ($this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $result_count; + } + + $id_ary = array(); + + // Create some display specific sql strings + if ($author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else + { + $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); + } + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; + $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_sort_table = $sql_sort_join = ''; + switch ($sql_sort[0]) + { + case 'u': + $sql_sort_table = USERS_TABLE . ' u, '; + $sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster '; + break; + + case 't': + $sql_sort_table = ($type == 'posts' && !$firstpost_only) ? TOPICS_TABLE . ' t, ' : ''; + $sql_sort_join = ($type == 'posts' && !$firstpost_only) ? ' AND t.topic_id = p.topic_id ' : ''; + break; + + case 'f': + $sql_sort_table = FORUMS_TABLE . ' f, '; + $sql_sort_join = ' AND f.forum_id = p.forum_id '; + break; + } + + $m_approve_fid_sql = ' AND ' . $post_visibility; + + /** + * Allow changing the query used to search for posts by author in fulltext_postgres + * + * @event core.search_postgres_author_count_query_before + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen + * @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on + * @var string sql_author SQL WHERE condition for the post author ids + * @var int topic_id Limit the search to this topic_id only + * @var string sql_topic_id SQL of topic_id + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var string sort_days Time, in days, that the oldest post showing can have + * @var string sql_time The SQL to search on the time specifyed by sort_days + * @var bool firstpost_only Wether or not to search only on the first post of the topics + * @var array ex_fid_ary Forum ids that must not be searched on + * @var array sql_fora SQL query for ex_fid_ary + * @var string m_approve_fid_sql WHERE clause condition on post_visibility restrictions + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'result_count', + 'sql_sort_table', + 'sql_sort_join', + 'author_ary', + 'author_name', + 'sql_author', + 'topic_id', + 'sql_topic_id', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'sort_days', + 'sql_time', + 'firstpost_only', + 'ex_fid_ary', + 'sql_fora', + 'm_approve_fid_sql', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_author_count_query_before', compact($vars))); + + // Build the query for really selecting the post_ids + if ($type == 'posts') + { + $sql = "SELECT p.post_id + FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . " + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + $sql_sort_join + $sql_time + ORDER BY $sql_sort"; + $field = 'post_id'; + } + else + { + $sql = "SELECT t.topic_id + FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + AND t.topic_id = p.topic_id + $sql_sort_join + $sql_time + GROUP BY t.topic_id, $sort_by_sql[$sort_key] + ORDER BY $sql_sort"; + $field = 'topic_id'; + } + + $this->db->sql_transaction('begin'); + + // Only read one block of posts from the db and then cache it + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = $row[$field]; + } + $this->db->sql_freeresult($result); + + // retrieve the total result count if needed + if (!$result_count) + { + if ($type == 'posts') + { + $sql_count = "SELECT COUNT(*) as result_count + FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . " + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + $sql_sort_join + $sql_time"; + } + else + { + $sql_count = "SELECT COUNT(*) as result_count + FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + AND t.topic_id = p.topic_id + $sql_sort_join + $sql_time + GROUP BY t.topic_id, $sort_by_sql[$sort_key]"; + } + + $this->db->sql_query($sql_count); + $result_count = (int) $this->db->sql_fetchfield('result_count'); + + if (!$result_count) + { + return false; + } + } + + $this->db->sql_transaction('commit'); + + if ($start >= $result_count) + { + $start = floor(($result_count - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + } + + if (count($id_ary)) + { + $this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, $per_page); + + return $result_count; + } + return false; + } + + /** + * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated + * + * @param string $mode contains the post mode: edit, post, reply, quote ... + * @param int $post_id contains the post id of the post to index + * @param string $message contains the post text of the post + * @param string $subject contains the subject of the post to index + * @param int $poster_id contains the user id of the poster + * @param int $forum_id contains the forum id of parent forum of the post + */ + public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) + { + // Split old and new post/subject to obtain array of words + $split_text = $this->split_message($message); + $split_title = ($subject) ? $this->split_message($subject) : array(); + + $words = array_unique(array_merge($split_text, $split_title)); + + /** + * Event to modify method arguments and words before the PostgreSQL search index is updated + * + * @event core.search_postgres_index_before + * @var string mode Contains the post mode: edit, post, reply, quote + * @var int post_id The id of the post which is modified/created + * @var string message New or updated post content + * @var string subject New or updated post subject + * @var int poster_id Post author's user id + * @var int forum_id The id of the forum in which the post is located + * @var array words Array of words added to the index + * @var array split_text Array of words from the message + * @var array split_title Array of words from the title + * @since 3.2.3-RC1 + */ + $vars = array( + 'mode', + 'post_id', + 'message', + 'subject', + 'poster_id', + 'forum_id', + 'words', + 'split_text', + 'split_title', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_index_before', compact($vars))); + + unset($split_text); + unset($split_title); + + // destroy cached search results containing any of the words removed or added + $this->destroy_cache($words, array($poster_id)); + + unset($words); + } + + /** + * Destroy cached results, that might be outdated after deleting a post + */ + public function index_remove($post_ids, $author_ids, $forum_ids) + { + $this->destroy_cache(array(), $author_ids); + } + + /** + * Destroy old cache entries + */ + public function tidy() + { + // destroy too old cached search results + $this->destroy_cache(array()); + + $this->config->set('search_last_gc', time(), false); + } + + /** + * Create fulltext index + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function create_index($acp_module, $u_action) + { + // Make sure we can actually use PostgreSQL with fulltext indexes + if ($error = $this->init()) + { + return $error; + } + + if (empty($this->stats)) + { + $this->get_stats(); + } + + $sql_queries = []; + + if (!isset($this->stats['post_subject'])) + { + $sql_queries[] = "CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_subject ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_subject))"; + } + + if (!isset($this->stats['post_content'])) + { + $sql_queries[] = "CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_content ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_text || ' ' || post_subject))"; + } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the Postgres search index is created + * + * @event core.search_postgres_create_index_before + * @var array sql_queries Array with queries for creating the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_create_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } + + $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); + + return false; + } + + /** + * Drop fulltext index + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function delete_index($acp_module, $u_action) + { + // Make sure we can actually use PostgreSQL with fulltext indexes + if ($error = $this->init()) + { + return $error; + } + + if (empty($this->stats)) + { + $this->get_stats(); + } + + $sql_queries = []; + + if (isset($this->stats['post_subject'])) + { + $sql_queries[] = 'DROP INDEX ' . $this->stats['post_subject']['relname']; + } + + if (isset($this->stats['post_content'])) + { + $sql_queries[] = 'DROP INDEX ' . $this->stats['post_content']['relname']; + } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the Postgres search index is created + * + * @event core.search_postgres_delete_index_before + * @var array sql_queries Array with queries for deleting the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_delete_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } + + $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); + + return false; + } + + /** + * Returns true if both FULLTEXT indexes exist + */ + public function index_created() + { + if (empty($this->stats)) + { + $this->get_stats(); + } + + return (isset($this->stats['post_subject']) && isset($this->stats['post_content'])) ? true : false; + } + + /** + * Returns an associative array containing information about the indexes + */ + public function index_stats() + { + if (empty($this->stats)) + { + $this->get_stats(); + } + + return array( + $this->user->lang['FULLTEXT_POSTGRES_TOTAL_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] : 0, + ); + } + + /** + * Computes the stats and store them in the $this->stats associative array + */ + protected function get_stats() + { + if ($this->db->get_sql_layer() != 'postgres') + { + $this->stats = array(); + return; + } + + $sql = "SELECT c2.relname, pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) AS indexdef + FROM pg_catalog.pg_class c1, pg_catalog.pg_index i, pg_catalog.pg_class c2 + WHERE c1.relname = '" . POSTS_TABLE . "' + AND pg_catalog.pg_table_is_visible(c1.oid) + AND c1.oid = i.indrelid + AND i.indexrelid = c2.oid"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // deal with older PostgreSQL versions which didn't use Index_type + if (strpos($row['indexdef'], 'to_tsvector') !== false) + { + if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_subject' || $row['relname'] == POSTS_TABLE . '_post_subject') + { + $this->stats['post_subject'] = $row; + } + else if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_content' || $row['relname'] == POSTS_TABLE . '_post_content') + { + $this->stats['post_content'] = $row; + } + } + } + $this->db->sql_freeresult($result); + + $this->stats['total_posts'] = $this->config['num_posts']; + } + + /** + * Display various options that can be configured for the backend from the acp + * + * @return associative array containing template and config variables + */ + public function acp() + { + $tpl = ' +
+

' . $this->user->lang['FULLTEXT_POSTGRES_VERSION_CHECK_EXPLAIN'] . '
+
' . (($this->db->get_sql_layer() == 'postgres') ? $this->user->lang['YES'] : $this->user->lang['NO']) . '
+
+
+

' . $this->user->lang['FULLTEXT_POSTGRES_TS_NAME_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN_EXPLAIN'] . '
+
+
+ '; + + // These are fields required in the config table + return array( + 'tpl' => $tpl, + 'config' => array('fulltext_postgres_ts_name' => 'string', 'fulltext_postgres_min_word_len' => 'integer:0:255', 'fulltext_postgres_max_word_len' => 'integer:0:255') + ); + } +} diff --git a/install/update/new/phpbb/search/fulltext_sphinx.php b/install/update/new/phpbb/search/fulltext_sphinx.php new file mode 100644 index 0000000..d2e12fd --- /dev/null +++ b/install/update/new/phpbb/search/fulltext_sphinx.php @@ -0,0 +1,993 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\search; + +define('SPHINX_MAX_MATCHES', 20000); +define('SPHINX_CONNECT_RETRIES', 3); +define('SPHINX_CONNECT_WAIT_TIME', 300); + +/** +* Fulltext search based on the sphinx search daemon +*/ +class fulltext_sphinx +{ + /** + * Associative array holding index stats + * @var array + */ + protected $stats = array(); + + /** + * Holds the words entered by user, obtained by splitting the entered query on whitespace + * @var array + */ + protected $split_words = array(); + + /** + * Holds unique sphinx id + * @var string + */ + protected $id; + + /** + * Stores the names of both main and delta sphinx indexes + * separated by a semicolon + * @var string + */ + protected $indexes; + + /** + * Sphinx searchd client object + * @var SphinxClient + */ + protected $sphinx; + + /** + * Relative path to board root + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP Extension + * @var string + */ + protected $php_ext; + + /** + * Auth object + * @var \phpbb\auth\auth + */ + protected $auth; + + /** + * Config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Database connection + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * Database Tools object + * @var \phpbb\db\tools\tools_interface + */ + protected $db_tools; + + /** + * Stores the database type if supported by sphinx + * @var string + */ + protected $dbtype; + + /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Stores the generated content of the sphinx config file + * @var string + */ + protected $config_file_data = ''; + + /** + * Contains tidied search query. + * Operators are prefixed in search query and common words excluded + * @var string + */ + protected $search_query; + + /** + * Constructor + * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend + * + * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + */ + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $phpEx; + $this->config = $config; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->user = $user; + $this->db = $db; + $this->auth = $auth; + + // Initialize \phpbb\db\tools\tools object + global $phpbb_container; // TODO inject into object + $this->db_tools = $phpbb_container->get('dbal.tools'); + + if (!$this->config['fulltext_sphinx_id']) + { + $this->config->set('fulltext_sphinx_id', unique_id()); + } + $this->id = $this->config['fulltext_sphinx_id']; + $this->indexes = 'index_phpbb_' . $this->id . '_delta;index_phpbb_' . $this->id . '_main'; + + if (!class_exists('SphinxClient')) + { + require($this->phpbb_root_path . 'includes/sphinxapi.' . $this->php_ext); + } + + // Initialize sphinx client + $this->sphinx = new \SphinxClient(); + + $this->sphinx->SetServer(($this->config['fulltext_sphinx_host'] ? $this->config['fulltext_sphinx_host'] : 'localhost'), ($this->config['fulltext_sphinx_port'] ? (int) $this->config['fulltext_sphinx_port'] : 9312)); + + $error = false; + } + + /** + * Returns the name of this search backend to be displayed to administrators + * + * @return string Name + */ + public function get_name() + { + return 'Sphinx Fulltext'; + } + + /** + * Returns the search_query + * + * @return string search query + */ + public function get_search_query() + { + return $this->search_query; + } + + /** + * Returns false as there is no word_len array + * + * @return false + */ + public function get_word_length() + { + return false; + } + + /** + * Returns an empty array as there are no common_words + * + * @return array common words that are ignored by search backend + */ + public function get_common_words() + { + return array(); + } + + /** + * Checks permissions and paths, if everything is correct it generates the config file + * + * @return string|bool Language key of the error/incompatibility encountered, or false if successful + */ + public function init() + { + if ($this->db->get_sql_layer() != 'mysqli' && $this->db->get_sql_layer() != 'postgres') + { + return $this->user->lang['FULLTEXT_SPHINX_WRONG_DATABASE']; + } + + // Move delta to main index each hour + $this->config->set('search_gc', 3600); + + return false; + } + + /** + * Generates content of sphinx.conf + * + * @return bool True if sphinx.conf content is correctly generated, false otherwise + */ + protected function config_generate() + { + // Check if Database is supported by Sphinx + if ($this->db->get_sql_layer() == 'mysqli') + { + $this->dbtype = 'mysql'; + } + else if ($this->db->get_sql_layer() == 'postgres') + { + $this->dbtype = 'pgsql'; + } + else + { + $this->config_file_data = $this->user->lang('FULLTEXT_SPHINX_WRONG_DATABASE'); + return false; + } + + // Check if directory paths have been filled + if (!$this->config['fulltext_sphinx_data_path']) + { + $this->config_file_data = $this->user->lang('FULLTEXT_SPHINX_NO_CONFIG_DATA'); + return false; + } + + include($this->phpbb_root_path . 'config.' . $this->php_ext); + + /* Now that we're sure everything was entered correctly, + generate a config for the index. We use a config value + fulltext_sphinx_id for this, as it should be unique. */ + $config_object = new \phpbb\search\sphinx\config($this->config_file_data); + $config_data = array( + 'source source_phpbb_' . $this->id . '_main' => array( + array('type', $this->dbtype . ' # mysql or pgsql'), + // This config value sql_host needs to be changed incase sphinx and sql are on different servers + array('sql_host', $dbhost . ' # SQL server host sphinx connects to'), + array('sql_user', '[dbuser]'), + array('sql_pass', '[dbpassword]'), + array('sql_db', $dbname), + array('sql_port', $dbport . ' # optional, default is 3306 for mysql and 5432 for pgsql'), + array('sql_query_pre', 'SET NAMES \'utf8\''), + array('sql_query_pre', 'UPDATE ' . SPHINX_TABLE . ' SET max_doc_id = (SELECT MAX(post_id) FROM ' . POSTS_TABLE . ') WHERE counter_id = 1'), + array('sql_query_range', 'SELECT MIN(post_id), MAX(post_id) FROM ' . POSTS_TABLE . ''), + array('sql_range_step', '5000'), + array('sql_query', 'SELECT + p.post_id AS id, + p.forum_id, + p.topic_id, + p.poster_id, + p.post_visibility, + CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post, + p.post_time, + p.post_subject, + p.post_subject as title, + p.post_text as data, + t.topic_last_post_time, + 0 as deleted + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t + WHERE + p.topic_id = t.topic_id + AND p.post_id >= $start AND p.post_id <= $end'), + array('sql_query_post', ''), + array('sql_query_post_index', 'UPDATE ' . SPHINX_TABLE . ' SET max_doc_id = $maxid WHERE counter_id = 1'), + array('sql_attr_uint', 'forum_id'), + array('sql_attr_uint', 'topic_id'), + array('sql_attr_uint', 'poster_id'), + array('sql_attr_uint', 'post_visibility'), + array('sql_attr_bool', 'topic_first_post'), + array('sql_attr_bool', 'deleted'), + array('sql_attr_timestamp', 'post_time'), + array('sql_attr_timestamp', 'topic_last_post_time'), + array('sql_attr_string', 'post_subject'), + ), + 'source source_phpbb_' . $this->id . '_delta : source_phpbb_' . $this->id . '_main' => array( + array('sql_query_pre', 'SET NAMES \'utf8\''), + array('sql_query_range', ''), + array('sql_range_step', ''), + array('sql_query', 'SELECT + p.post_id AS id, + p.forum_id, + p.topic_id, + p.poster_id, + p.post_visibility, + CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post, + p.post_time, + p.post_subject, + p.post_subject as title, + p.post_text as data, + t.topic_last_post_time, + 0 as deleted + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t + WHERE + p.topic_id = t.topic_id + AND p.post_id >= ( SELECT max_doc_id FROM ' . SPHINX_TABLE . ' WHERE counter_id=1 )'), + array('sql_query_post_index', ''), + ), + 'index index_phpbb_' . $this->id . '_main' => array( + array('path', $this->config['fulltext_sphinx_data_path'] . 'index_phpbb_' . $this->id . '_main'), + array('source', 'source_phpbb_' . $this->id . '_main'), + array('docinfo', 'extern'), + array('morphology', 'none'), + array('stopwords', ''), + array('min_word_len', '2'), + array('charset_table', 'U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153, U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159, U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161, U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167, U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F, U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175, U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C, U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F, U+4E00..U+9FFF'), + array('min_prefix_len', '0'), + array('min_infix_len', '0'), + array('html_strip', '1'), + ), + 'index index_phpbb_' . $this->id . '_delta : index_phpbb_' . $this->id . '_main' => array( + array('path', $this->config['fulltext_sphinx_data_path'] . 'index_phpbb_' . $this->id . '_delta'), + array('source', 'source_phpbb_' . $this->id . '_delta'), + ), + 'indexer' => array( + array('mem_limit', $this->config['fulltext_sphinx_indexer_mem_limit'] . 'M'), + ), + 'searchd' => array( + array('listen' , ($this->config['fulltext_sphinx_host'] ? $this->config['fulltext_sphinx_host'] : 'localhost') . ':' . ($this->config['fulltext_sphinx_port'] ? $this->config['fulltext_sphinx_port'] : '9312')), + array('log', $this->config['fulltext_sphinx_data_path'] . 'log/searchd.log'), + array('query_log', $this->config['fulltext_sphinx_data_path'] . 'log/sphinx-query.log'), + array('read_timeout', '5'), + array('max_children', '30'), + array('pid_file', $this->config['fulltext_sphinx_data_path'] . 'searchd.pid'), + array('binlog_path', $this->config['fulltext_sphinx_data_path']), + ), + ); + + $non_unique = array('sql_query_pre' => true, 'sql_attr_uint' => true, 'sql_attr_timestamp' => true, 'sql_attr_str2ordinal' => true, 'sql_attr_bool' => true); + $delete = array('sql_group_column' => true, 'sql_date_column' => true, 'sql_str2ordinal_column' => true); + + /** + * Allow adding/changing the Sphinx configuration data + * + * @event core.search_sphinx_modify_config_data + * @var array config_data Array with the Sphinx configuration data + * @var array non_unique Array with the Sphinx non-unique variables to delete + * @var array delete Array with the Sphinx variables to delete + * @since 3.1.7-RC1 + */ + $vars = array( + 'config_data', + 'non_unique', + 'delete', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_sphinx_modify_config_data', compact($vars))); + + foreach ($config_data as $section_name => $section_data) + { + $section = $config_object->get_section_by_name($section_name); + if (!$section) + { + $section = $config_object->add_section($section_name); + } + + foreach ($delete as $key => $void) + { + $section->delete_variables_by_name($key); + } + + foreach ($non_unique as $key => $void) + { + $section->delete_variables_by_name($key); + } + + foreach ($section_data as $entry) + { + $key = $entry[0]; + $value = $entry[1]; + + if (!isset($non_unique[$key])) + { + $variable = $section->get_variable_by_name($key); + if (!$variable) + { + $section->create_variable($key, $value); + } + else + { + $variable->set_value($value); + } + } + else + { + $section->create_variable($key, $value); + } + } + } + $this->config_file_data = $config_object->get_data(); + + return true; + } + + /** + * Splits keywords entered by a user into an array of words stored in $this->split_words + * Stores the tidied search query in $this->search_query + * + * @param string $keywords Contains the keyword as entered by the user + * @param string $terms is either 'all' or 'any' + * @return false if no valid keywords were found and otherwise true + */ + public function split_keywords(&$keywords, $terms) + { + if ($terms == 'all') + { + $match = array('#\sand\s#i', '#\sor\s#i', '#\snot\s#i', '#\+#', '#-#', '#\|#', '#@#'); + $replace = array(' & ', ' | ', ' - ', ' +', ' -', ' |', ''); + + $keywords = preg_replace($match, $replace, $keywords); + $this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED); + } + else + { + $this->sphinx->SetMatchMode(SPH_MATCH_ANY); + } + + // Keep quotes and new lines + $keywords = str_replace(array('"', "\n"), array('"', ' '), trim($keywords)); + + if (strlen($keywords) > 0) + { + $this->search_query = str_replace('"', '"', $keywords); + return true; + } + + return false; + } + + /** + * Performs a search on keywords depending on display specific params. You have to run split_keywords() first + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param string $fields contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched) + * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @return boolean|int total number of results + */ + public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + global $user, $phpbb_log; + + // No keywords? No posts. + if (!strlen($this->search_query) && !count($author_ary)) + { + return false; + } + + $id_ary = array(); + + // Sorting + + if ($type == 'topics') + { + switch ($sort_key) + { + case 'a': + $this->sphinx->SetGroupBy('topic_id', SPH_GROUPBY_ATTR, 'poster_id ' . (($sort_dir == 'a') ? 'ASC' : 'DESC')); + break; + + case 'f': + $this->sphinx->SetGroupBy('topic_id', SPH_GROUPBY_ATTR, 'forum_id ' . (($sort_dir == 'a') ? 'ASC' : 'DESC')); + break; + + case 'i': + + case 's': + $this->sphinx->SetGroupBy('topic_id', SPH_GROUPBY_ATTR, 'post_subject ' . (($sort_dir == 'a') ? 'ASC' : 'DESC')); + break; + + case 't': + + default: + $this->sphinx->SetGroupBy('topic_id', SPH_GROUPBY_ATTR, 'topic_last_post_time ' . (($sort_dir == 'a') ? 'ASC' : 'DESC')); + break; + } + } + else + { + switch ($sort_key) + { + case 'a': + $this->sphinx->SetSortMode(($sort_dir == 'a') ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC, 'poster_id'); + break; + + case 'f': + $this->sphinx->SetSortMode(($sort_dir == 'a') ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC, 'forum_id'); + break; + + case 'i': + + case 's': + $this->sphinx->SetSortMode(($sort_dir == 'a') ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC, 'post_subject'); + break; + + case 't': + + default: + $this->sphinx->SetSortMode(($sort_dir == 'a') ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC, 'post_time'); + break; + } + } + + // Most narrow filters first + if ($topic_id) + { + $this->sphinx->SetFilter('topic_id', array($topic_id)); + } + + /** + * Allow modifying the Sphinx search options + * + * @event core.search_sphinx_keywords_modify_options + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @var object sphinx The Sphinx searchd client object + * @since 3.1.7-RC1 + */ + $sphinx = $this->sphinx; + $vars = array( + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + 'sphinx', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_sphinx_keywords_modify_options', compact($vars))); + $this->sphinx = $sphinx; + unset($sphinx); + + $search_query_prefix = ''; + + switch ($fields) + { + case 'titleonly': + // Only search the title + if ($terms == 'all') + { + $search_query_prefix = '@title '; + } + // Weight for the title + $this->sphinx->SetFieldWeights(array("title" => 5, "data" => 1)); + // 1 is first_post, 0 is not first post + $this->sphinx->SetFilter('topic_first_post', array(1)); + break; + + case 'msgonly': + // Only search the body + if ($terms == 'all') + { + $search_query_prefix = '@data '; + } + // Weight for the body + $this->sphinx->SetFieldWeights(array("title" => 1, "data" => 5)); + break; + + case 'firstpost': + // More relative weight for the title, also search the body + $this->sphinx->SetFieldWeights(array("title" => 5, "data" => 1)); + // 1 is first_post, 0 is not first post + $this->sphinx->SetFilter('topic_first_post', array(1)); + break; + + default: + // More relative weight for the title, also search the body + $this->sphinx->SetFieldWeights(array("title" => 5, "data" => 1)); + break; + } + + if (count($author_ary)) + { + $this->sphinx->SetFilter('poster_id', $author_ary); + } + + // As this is not simply possible at the moment, we limit the result to approved posts. + // This will make it impossible for moderators to search unapproved and softdeleted posts, + // but at least it will also cause the same for normal users. + $this->sphinx->SetFilter('post_visibility', array(ITEM_APPROVED)); + + if (count($ex_fid_ary)) + { + // All forums that a user is allowed to access + $fid_ary = array_unique(array_intersect(array_keys($this->auth->acl_getf('f_read', true)), array_keys($this->auth->acl_getf('f_search', true)))); + // All forums that the user wants to and can search in + $search_forums = array_diff($fid_ary, $ex_fid_ary); + + if (count($search_forums)) + { + $this->sphinx->SetFilter('forum_id', $search_forums); + } + } + + $this->sphinx->SetFilter('deleted', array(0)); + + $this->sphinx->SetLimits((int) $start, (int) $per_page, max(SPHINX_MAX_MATCHES, (int) $start + $per_page)); + $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes); + + // Could be connection to localhost:9312 failed (errno=111, + // msg=Connection refused) during rotate, retry if so + $retries = SPHINX_CONNECT_RETRIES; + while (!$result && (strpos($this->sphinx->GetLastError(), "errno=111,") !== false) && $retries--) + { + usleep(SPHINX_CONNECT_WAIT_TIME); + $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes); + } + + if ($this->sphinx->GetLastError()) + { + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_SPHINX_ERROR', false, array($this->sphinx->GetLastError())); + if ($this->auth->acl_get('a_')) + { + trigger_error($this->user->lang('SPHINX_SEARCH_FAILED', $this->sphinx->GetLastError())); + } + else + { + trigger_error($this->user->lang('SPHINX_SEARCH_FAILED_LOG')); + } + } + + $result_count = $result['total_found']; + + if ($result_count && $start >= $result_count) + { + $start = floor(($result_count - 1) / $per_page) * $per_page; + + $this->sphinx->SetLimits((int) $start, (int) $per_page, max(SPHINX_MAX_MATCHES, (int) $start + $per_page)); + $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes); + + // Could be connection to localhost:9312 failed (errno=111, + // msg=Connection refused) during rotate, retry if so + $retries = SPHINX_CONNECT_RETRIES; + while (!$result && (strpos($this->sphinx->GetLastError(), "errno=111,") !== false) && $retries--) + { + usleep(SPHINX_CONNECT_WAIT_TIME); + $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes); + } + } + + $id_ary = array(); + if (isset($result['matches'])) + { + if ($type == 'posts') + { + $id_ary = array_keys($result['matches']); + } + else + { + foreach ($result['matches'] as $key => $value) + { + $id_ary[] = $value['attrs']['topic_id']; + } + } + } + else + { + return false; + } + + $id_ary = array_slice($id_ary, 0, (int) $per_page); + + return $result_count; + } + + /** + * Performs a search on an author's posts without caring about message contents. Depends on display specific params + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param boolean $firstpost_only if true, only topic starting posts will be considered + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @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, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page) + { + $this->search_query = ''; + + $this->sphinx->SetMatchMode(SPH_MATCH_FULLSCAN); + $fields = ($firstpost_only) ? 'firstpost' : 'all'; + $terms = 'all'; + return $this->keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page); + } + + /** + * Updates wordlist and wordmatch tables when a message is posted or changed + * + * @param string $mode Contains the post mode: edit, post, reply, quote + * @param int $post_id The id of the post which is modified/created + * @param string &$message New or updated post content + * @param string &$subject New or updated post subject + * @param int $poster_id Post author's user id + * @param int $forum_id The id of the forum in which the post is located + */ + public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) + { + /** + * Event to modify method arguments before the Sphinx search index is updated + * + * @event core.search_sphinx_index_before + * @var string mode Contains the post mode: edit, post, reply, quote + * @var int post_id The id of the post which is modified/created + * @var string message New or updated post content + * @var string subject New or updated post subject + * @var int poster_id Post author's user id + * @var int forum_id The id of the forum in which the post is located + * @since 3.2.3-RC1 + */ + $vars = array( + 'mode', + 'post_id', + 'message', + 'subject', + 'poster_id', + 'forum_id', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_sphinx_index_before', compact($vars))); + + if ($mode == 'edit') + { + $this->sphinx->UpdateAttributes($this->indexes, array('forum_id', 'poster_id'), array((int) $post_id => array((int) $forum_id, (int) $poster_id))); + } + else if ($mode != 'post' && $post_id) + { + // Update topic_last_post_time for full topic + $sql_array = array( + 'SELECT' => 'p1.post_id', + 'FROM' => array( + POSTS_TABLE => 'p1', + ), + 'LEFT_JOIN' => array(array( + 'FROM' => array( + POSTS_TABLE => 'p2' + ), + 'ON' => 'p1.topic_id = p2.topic_id', + )), + 'WHERE' => 'p2.post_id = ' . ((int) $post_id), + ); + + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query($sql); + + $post_updates = array(); + $post_time = time(); + while ($row = $this->db->sql_fetchrow($result)) + { + $post_updates[(int) $row['post_id']] = array($post_time); + } + $this->db->sql_freeresult($result); + + if (count($post_updates)) + { + $this->sphinx->UpdateAttributes($this->indexes, array('topic_last_post_time'), $post_updates); + } + } + } + + /** + * Delete a post from the index after it was deleted + */ + public function index_remove($post_ids, $author_ids, $forum_ids) + { + $values = array(); + foreach ($post_ids as $post_id) + { + $values[$post_id] = array(1); + } + + $this->sphinx->UpdateAttributes($this->indexes, array('deleted'), $values); + } + + /** + * Nothing needs to be destroyed + */ + public function tidy($create = false) + { + $this->config->set('search_last_gc', time(), false); + } + + /** + * Create sphinx table + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function create_index($acp_module, $u_action) + { + if (!$this->index_created()) + { + $table_data = array( + 'COLUMNS' => array( + 'counter_id' => array('UINT', 0), + 'max_doc_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'counter_id', + ); + $this->db_tools->sql_create_table(SPHINX_TABLE, $table_data); + + $sql = 'TRUNCATE TABLE ' . SPHINX_TABLE; + $this->db->sql_query($sql); + + $data = array( + 'counter_id' => '1', + 'max_doc_id' => '0', + ); + $sql = 'INSERT INTO ' . SPHINX_TABLE . ' ' . $this->db->sql_build_array('INSERT', $data); + $this->db->sql_query($sql); + } + + return false; + } + + /** + * Drop sphinx table + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function delete_index($acp_module, $u_action) + { + if (!$this->index_created()) + { + return false; + } + + $this->db_tools->sql_table_drop(SPHINX_TABLE); + + return false; + } + + /** + * Returns true if the sphinx table was created + * + * @return bool true if sphinx table was created + */ + public function index_created($allow_new_files = true) + { + $created = false; + + if ($this->db_tools->sql_table_exists(SPHINX_TABLE)) + { + $created = true; + } + + return $created; + } + + /** + * Returns an associative array containing information about the indexes + * + * @return string|bool Language string of error false otherwise + */ + public function index_stats() + { + if (empty($this->stats)) + { + $this->get_stats(); + } + + return array( + $this->user->lang['FULLTEXT_SPHINX_MAIN_POSTS'] => ($this->index_created()) ? $this->stats['main_posts'] : 0, + $this->user->lang['FULLTEXT_SPHINX_DELTA_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] - $this->stats['main_posts'] : 0, + $this->user->lang['FULLTEXT_MYSQL_TOTAL_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] : 0, + ); + } + + /** + * Collects stats that can be displayed on the index maintenance page + */ + protected function get_stats() + { + if ($this->index_created()) + { + $sql = 'SELECT COUNT(post_id) as total_posts + FROM ' . POSTS_TABLE; + $result = $this->db->sql_query($sql); + $this->stats['total_posts'] = (int) $this->db->sql_fetchfield('total_posts'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT COUNT(p.post_id) as main_posts + FROM ' . POSTS_TABLE . ' p, ' . SPHINX_TABLE . ' m + WHERE p.post_id <= m.max_doc_id + AND m.counter_id = 1'; + $result = $this->db->sql_query($sql); + $this->stats['main_posts'] = (int) $this->db->sql_fetchfield('main_posts'); + $this->db->sql_freeresult($result); + } + } + + /** + * Returns a list of options for the ACP to display + * + * @return associative array containing template and config variables + */ + public function acp() + { + $config_vars = array( + 'fulltext_sphinx_data_path' => 'string', + 'fulltext_sphinx_host' => 'string', + 'fulltext_sphinx_port' => 'string', + 'fulltext_sphinx_indexer_mem_limit' => 'int', + ); + + $tpl = ' + ' . $this->user->lang['FULLTEXT_SPHINX_CONFIGURE']. ' +
+

' . $this->user->lang['FULLTEXT_SPHINX_DATA_PATH_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['FULLTEXT_SPHINX_HOST_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['FULLTEXT_SPHINX_PORT_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '
+
' . $this->user->lang['MIB'] . '
+
+
+

' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '
+
' . (($this->config_generate()) ? '' : $this->config_file_data) . '
+
+ '; + + // These are fields required in the config table + return array( + 'tpl' => $tpl, + 'config' => $config_vars + ); + } +} diff --git a/install/update/new/phpbb/session.php b/install/update/new/phpbb/session.php new file mode 100644 index 0000000..6851bc8 --- /dev/null +++ b/install/update/new/phpbb/session.php @@ -0,0 +1,1667 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* Session class +*/ +class session +{ + var $cookie_data = array(); + var $page = array(); + var $data = array(); + var $browser = ''; + var $forwarded_for = ''; + var $host = ''; + var $session_id = ''; + var $ip = ''; + var $load = 0; + var $time_now = 0; + var $update_session_page = true; + + /** + * Extract current session page + * + * @param string $root_path current root path (phpbb_root_path) + * @return array + */ + static function extract_current_page($root_path) + { + global $request, $symfony_request, $phpbb_filesystem; + + $page_array = array(); + + // First of all, get the request uri... + $script_name = $request->escape($symfony_request->getScriptName(), true); + $args = $request->escape(explode('&', $symfony_request->getQueryString()), true); + + // If we are unable to get the script name we use REQUEST_URI as a failover and note it within the page array for easier support... + if (!$script_name) + { + $script_name = htmlspecialchars_decode($request->server('REQUEST_URI')); + $script_name = (($pos = strpos($script_name, '?')) !== false) ? substr($script_name, 0, $pos) : $script_name; + $page_array['failover'] = 1; + } + + // Replace backslashes and doubled slashes (could happen on some proxy setups) + $script_name = str_replace(array('\\', '//'), '/', $script_name); + + // Now, remove the sid and let us get a clean query string... + $use_args = array(); + + // Since some browser do not encode correctly we need to do this with some "special" characters... + // " -> %22, ' => %27, < -> %3C, > -> %3E + $find = array('"', "'", '<', '>', '"', '<', '>'); + $replace = array('%22', '%27', '%3C', '%3E', '%22', '%3C', '%3E'); + + foreach ($args as $key => $argument) + { + if (strpos($argument, 'sid=') === 0) + { + continue; + } + + $use_args[] = str_replace($find, $replace, $argument); + } + unset($args); + + // The following examples given are for an request uri of {path to the phpbb directory}/adm/index.php?i=10&b=2 + + // The current query string + $query_string = trim(implode('&', $use_args)); + + // basenamed page name (for example: index.php) + $page_name = (substr($script_name, -1, 1) == '/') ? '' : basename($script_name); + $page_name = urlencode(htmlspecialchars($page_name)); + + $symfony_request_path = $phpbb_filesystem->clean_path($symfony_request->getPathInfo()); + if ($symfony_request_path !== '/') + { + $page_name .= str_replace('%2F', '/', urlencode($symfony_request_path)); + } + + if (substr($root_path, 0, 2) === './' && strpos($root_path, '..') === false) + { + $root_dirs = explode('/', str_replace('\\', '/', rtrim($root_path, '/'))); + $page_dirs = explode('/', str_replace('\\', '/', '.')); + } + else + { + // current directory within the phpBB root (for example: adm) + $root_dirs = explode('/', str_replace('\\', '/', $phpbb_filesystem->realpath($root_path))); + $page_dirs = explode('/', str_replace('\\', '/', $phpbb_filesystem->realpath('./'))); + } + + $intersection = array_intersect_assoc($root_dirs, $page_dirs); + + $root_dirs = array_diff_assoc($root_dirs, $intersection); + $page_dirs = array_diff_assoc($page_dirs, $intersection); + + $page_dir = str_repeat('../', count($root_dirs)) . implode('/', $page_dirs); + + if ($page_dir && substr($page_dir, -1, 1) == '/') + { + $page_dir = substr($page_dir, 0, -1); + } + + // Current page from phpBB root (for example: adm/index.php?i=10&b=2) + $page = (($page_dir) ? $page_dir . '/' : '') . $page_name; + if ($query_string) + { + $page .= '?' . $query_string; + } + + // The script path from the webroot to the current directory (for example: /phpBB3/adm/) : always prefixed with / and ends in / + $script_path = $symfony_request->getBasePath(); + + // The script path from the webroot to the phpBB root (for example: /phpBB3/) + $script_dirs = explode('/', $script_path); + array_splice($script_dirs, -count($page_dirs)); + $root_script_path = implode('/', $script_dirs) . (count($root_dirs) ? '/' . implode('/', $root_dirs) : ''); + + // We are on the base level (phpBB root == webroot), lets adjust the variables a bit... + if (!$root_script_path) + { + $root_script_path = ($page_dir) ? str_replace($page_dir, '', $script_path) : $script_path; + } + + $script_path .= (substr($script_path, -1, 1) == '/') ? '' : '/'; + $root_script_path .= (substr($root_script_path, -1, 1) == '/') ? '' : '/'; + + $forum_id = $request->variable('f', 0); + // maximum forum id value is maximum value of mediumint unsigned column + $forum_id = ($forum_id > 0 && $forum_id < 16777215) ? $forum_id : 0; + + $page_array += array( + 'page_name' => $page_name, + 'page_dir' => $page_dir, + + 'query_string' => $query_string, + 'script_path' => str_replace(' ', '%20', htmlspecialchars($script_path)), + 'root_script_path' => str_replace(' ', '%20', htmlspecialchars($root_script_path)), + + 'page' => $page, + 'forum' => $forum_id, + ); + + return $page_array; + } + + /** + * Get valid hostname/port. HTTP_HOST is used, SERVER_NAME if HTTP_HOST not present. + */ + function extract_current_hostname() + { + global $config, $request; + + // Get hostname + $host = htmlspecialchars_decode($request->header('Host', $request->server('SERVER_NAME'))); + + // Should be a string and lowered + $host = (string) strtolower($host); + + // If host is equal the cookie domain or the server name (if config is set), then we assume it is valid + if ((isset($config['cookie_domain']) && $host === $config['cookie_domain']) || (isset($config['server_name']) && $host === $config['server_name'])) + { + return $host; + } + + // Is the host actually a IP? If so, we use the IP... (IPv4) + if (long2ip(ip2long($host)) === $host) + { + return $host; + } + + // Now return the hostname (this also removes any port definition). The http:// is prepended to construct a valid URL, hosts never have a scheme assigned + $host = @parse_url('http://' . $host); + $host = (!empty($host['host'])) ? $host['host'] : ''; + + // Remove any portions not removed by parse_url (#) + $host = str_replace('#', '', $host); + + // If, by any means, the host is now empty, we will use a "best approach" way to guess one + if (empty($host)) + { + if (!empty($config['server_name'])) + { + $host = $config['server_name']; + } + else if (!empty($config['cookie_domain'])) + { + $host = (strpos($config['cookie_domain'], '.') === 0) ? substr($config['cookie_domain'], 1) : $config['cookie_domain']; + } + else + { + // Set to OS hostname or localhost + $host = (function_exists('php_uname')) ? php_uname('n') : 'localhost'; + } + } + + // It may be still no valid host, but for sure only a hostname (we may further expand on the cookie domain... if set) + return $host; + } + + /** + * Start session management + * + * This is where all session activity begins. We gather various pieces of + * information from the client and server. We test to see if a session already + * exists. If it does, fine and dandy. If it doesn't we'll go on to create a + * new one ... pretty logical heh? We also examine the system load (if we're + * running on a system which makes such information readily available) and + * halt if it's above an admin definable limit. + * + * @param bool $update_session_page if true the session page gets updated. + * This can be set to circumvent certain scripts to update the users last visited page. + */ + function session_begin($update_session_page = true) + { + global $phpEx, $SID, $_SID, $_EXTRA_URL, $db, $config, $phpbb_root_path; + global $request, $phpbb_container, $user, $phpbb_log, $phpbb_dispatcher; + + // Give us some basic information + $this->time_now = time(); + $this->cookie_data = array('u' => 0, 'k' => ''); + $this->update_session_page = $update_session_page; + $this->browser = $request->header('User-Agent'); + $this->referer = $request->header('Referer'); + $this->forwarded_for = $request->header('X-Forwarded-For'); + + $this->host = $this->extract_current_hostname(); + $this->page = $this->extract_current_page($phpbb_root_path); + + // if the forwarded for header shall be checked we have to validate its contents + if ($config['forwarded_for_check']) + { + $this->forwarded_for = preg_replace('# {2,}#', ' ', str_replace(',', ' ', $this->forwarded_for)); + + // split the list of IPs + $ips = explode(' ', $this->forwarded_for); + foreach ($ips as $ip) + { + if (!filter_var($ip, FILTER_VALIDATE_IP)) + { + // contains invalid data, don't use the forwarded for header + $this->forwarded_for = ''; + break; + } + } + } + else + { + $this->forwarded_for = ''; + } + + if ($request->is_set($config['cookie_name'] . '_sid', \phpbb\request\request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', \phpbb\request\request_interface::COOKIE)) + { + $this->cookie_data['u'] = $request->variable($config['cookie_name'] . '_u', 0, false, \phpbb\request\request_interface::COOKIE); + $this->cookie_data['k'] = $request->variable($config['cookie_name'] . '_k', '', false, \phpbb\request\request_interface::COOKIE); + $this->session_id = $request->variable($config['cookie_name'] . '_sid', '', false, \phpbb\request\request_interface::COOKIE); + + $SID = (defined('NEED_SID')) ? '?sid=' . $this->session_id : '?sid='; + $_SID = (defined('NEED_SID')) ? $this->session_id : ''; + + if (empty($this->session_id)) + { + $this->session_id = $_SID = $request->variable('sid', ''); + $SID = '?sid=' . $this->session_id; + $this->cookie_data = array('u' => 0, 'k' => ''); + } + } + else + { + $this->session_id = $_SID = $request->variable('sid', ''); + $SID = '?sid=' . $this->session_id; + } + + $_EXTRA_URL = array(); + + // Why no forwarded_for et al? Well, too easily spoofed. With the results of my recent requests + // it's pretty clear that in the majority of cases you'll at least be left with a proxy/cache ip. + $ip = htmlspecialchars_decode($request->server('REMOTE_ADDR')); + $ip = preg_replace('# {2,}#', ' ', str_replace(',', ' ', $ip)); + + /** + * Event to alter user IP address + * + * @event core.session_ip_after + * @var string ip REMOTE_ADDR + * @since 3.1.10-RC1 + */ + $vars = array('ip'); + extract($phpbb_dispatcher->trigger_event('core.session_ip_after', compact($vars))); + + // split the list of IPs + $ips = explode(' ', trim($ip)); + + // Default IP if REMOTE_ADDR is invalid + $this->ip = '127.0.0.1'; + + foreach ($ips as $ip) + { + // Normalise IP address + $ip = phpbb_ip_normalise($ip); + + if ($ip === false) + { + // IP address is invalid. + break; + } + + // IP address is valid. + $this->ip = $ip; + } + + $this->load = false; + + // Load limit check (if applicable) + if ($config['limit_load'] || $config['limit_search_load']) + { + if ((function_exists('sys_getloadavg') && $load = sys_getloadavg()) || ($load = explode(' ', @file_get_contents('/proc/loadavg')))) + { + $this->load = array_slice($load, 0, 1); + $this->load = floatval($this->load[0]); + } + else + { + $config->set('limit_load', '0'); + $config->set('limit_search_load', '0'); + } + } + + // if no session id is set, redirect to index.php + $session_id = $request->variable('sid', ''); + if (defined('NEED_SID') && (empty($session_id) || $this->session_id !== $session_id)) + { + send_status_line(401, 'Unauthorized'); + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + // if session id is set + if (!empty($this->session_id)) + { + $sql = 'SELECT u.*, s.* + FROM ' . SESSIONS_TABLE . ' s, ' . USERS_TABLE . " u + WHERE s.session_id = '" . $db->sql_escape($this->session_id) . "' + AND u.user_id = s.session_user_id"; + $result = $db->sql_query($sql); + $this->data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Did the session exist in the DB? + if (isset($this->data['user_id'])) + { + // Validate IP length according to admin ... enforces an IP + // check on bots if admin requires this +// $quadcheck = ($config['ip_check_bot'] && $this->data['user_type'] & USER_BOT) ? 4 : $config['ip_check']; + + if (strpos($this->ip, ':') !== false && strpos($this->data['session_ip'], ':') !== false) + { + $s_ip = short_ipv6($this->data['session_ip'], $config['ip_check']); + $u_ip = short_ipv6($this->ip, $config['ip_check']); + } + else + { + $s_ip = implode('.', array_slice(explode('.', $this->data['session_ip']), 0, $config['ip_check'])); + $u_ip = implode('.', array_slice(explode('.', $this->ip), 0, $config['ip_check'])); + } + + $s_browser = ($config['browser_check']) ? trim(strtolower(substr($this->data['session_browser'], 0, 149))) : ''; + $u_browser = ($config['browser_check']) ? trim(strtolower(substr($this->browser, 0, 149))) : ''; + + $s_forwarded_for = ($config['forwarded_for_check']) ? substr($this->data['session_forwarded_for'], 0, 254) : ''; + $u_forwarded_for = ($config['forwarded_for_check']) ? substr($this->forwarded_for, 0, 254) : ''; + + // referer checks + // The @ before $config['referer_validation'] suppresses notices present while running the updater + $check_referer_path = (@$config['referer_validation'] == REFERER_VALIDATE_PATH); + $referer_valid = true; + + // we assume HEAD and TRACE to be foul play and thus only whitelist GET + if (@$config['referer_validation'] && strtolower($request->server('REQUEST_METHOD')) !== 'get') + { + $referer_valid = $this->validate_referer($check_referer_path); + } + + if ($u_ip === $s_ip && $s_browser === $u_browser && $s_forwarded_for === $u_forwarded_for && $referer_valid) + { + $session_expired = false; + + // Check whether the session is still valid if we have one + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $provider = $provider_collection->get_provider(); + + if (!($provider instanceof \phpbb\auth\provider\provider_interface)) + { + throw new \RuntimeException($provider . ' must implement \phpbb\auth\provider\provider_interface'); + } + + $ret = $provider->validate_session($this->data); + if ($ret !== null && !$ret) + { + $session_expired = true; + } + + if (!$session_expired) + { + // Check the session length timeframe if autologin is not enabled. + // Else check the autologin length... and also removing those having autologin enabled but no longer allowed board-wide. + if (!$this->data['session_autologin']) + { + if ($this->data['session_time'] < $this->time_now - ($config['session_length'] + 60)) + { + $session_expired = true; + } + } + else if (!$config['allow_autologin'] || ($config['max_autologin_time'] && $this->data['session_time'] < $this->time_now - (86400 * (int) $config['max_autologin_time']) + 60)) + { + $session_expired = true; + } + } + + if (!$session_expired) + { + $this->data['is_registered'] = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false; + $this->data['is_bot'] = (!$this->data['is_registered'] && $this->data['user_id'] != ANONYMOUS) ? true : false; + $this->data['user_lang'] = basename($this->data['user_lang']); + + // Is user banned? Are they excluded? Won't return on ban, exists within method + $this->check_ban_for_current_session($config); + + return true; + } + } + else + { + // Added logging temporarily to help debug bugs... + if ($phpbb_container->getParameter('session.log_errors') && $this->data['user_id'] != ANONYMOUS) + { + if ($referer_valid) + { + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_IP_BROWSER_FORWARDED_CHECK', false, array( + $u_ip, + $s_ip, + $u_browser, + $s_browser, + htmlspecialchars($u_forwarded_for), + htmlspecialchars($s_forwarded_for) + )); + } + else + { + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_REFERER_INVALID', false, array($this->referer)); + } + } + } + } + } + + // If we reach here then no (valid) session exists. So we'll create a new one + return $this->session_create(); + } + + /** + * Create a new session + * + * If upon trying to start a session we discover there is nothing existing we + * jump here. Additionally this method is called directly during login to regenerate + * the session for the specific user. In this method we carry out a number of tasks; + * garbage collection, (search)bot checking, banned user comparison. Basically + * though this method will result in a new session for a specific user. + */ + function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) + { + global $SID, $_SID, $db, $config, $cache, $phpbb_container, $phpbb_dispatcher; + + $this->data = array(); + + /* Garbage collection ... remove old sessions updating user information + // if necessary. It means (potentially) 11 queries but only infrequently + if ($this->time_now > $config['session_last_gc'] + $config['session_gc']) + { + $this->session_gc(); + }*/ + + // Do we allow autologin on this board? No? Then override anything + // that may be requested here + if (!$config['allow_autologin']) + { + $this->cookie_data['k'] = $persist_login = false; + } + + /** + * Here we do a bot check, oh er saucy! No, not that kind of bot + * check. We loop through the list of bots defined by the admin and + * see if we have any useragent and/or IP matches. If we do, this is a + * bot, act accordingly + */ + $bot = false; + $active_bots = $cache->obtain_bots(); + + foreach ($active_bots as $row) + { + if ($row['bot_agent'] && preg_match('#' . str_replace('\*', '.*?', preg_quote($row['bot_agent'], '#')) . '#i', $this->browser)) + { + $bot = $row['user_id']; + } + + // If ip is supplied, we will make sure the ip is matching too... + if ($row['bot_ip'] && ($bot || !$row['bot_agent'])) + { + // Set bot to false, then we only have to set it to true if it is matching + $bot = false; + + foreach (explode(',', $row['bot_ip']) as $bot_ip) + { + $bot_ip = trim($bot_ip); + + if (!$bot_ip) + { + continue; + } + + if (strpos($this->ip, $bot_ip) === 0) + { + $bot = (int) $row['user_id']; + break; + } + } + } + + if ($bot) + { + break; + } + } + + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $provider = $provider_collection->get_provider(); + $this->data = $provider->autologin(); + + if ($user_id !== false && isset($this->data['user_id']) && $this->data['user_id'] != $user_id) + { + $this->data = array(); + } + + if (isset($this->data['user_id'])) + { + $this->cookie_data['k'] = ''; + $this->cookie_data['u'] = $this->data['user_id']; + } + + // If we're presented with an autologin key we'll join against it. + // Else if we've been passed a user_id we'll grab data based on that + if (isset($this->cookie_data['k']) && $this->cookie_data['k'] && $this->cookie_data['u'] && empty($this->data)) + { + $sql = 'SELECT u.* + FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k + WHERE u.user_id = ' . (int) $this->cookie_data['u'] . ' + AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ") + AND k.user_id = u.user_id + AND k.key_id = '" . $db->sql_escape(md5($this->cookie_data['k'])) . "'"; + $result = $db->sql_query($sql); + $user_data = $db->sql_fetchrow($result); + + if ($user_id === false || (isset($user_data['user_id']) && $user_id == $user_data['user_id'])) + { + $this->data = $user_data; + $bot = false; + } + + $db->sql_freeresult($result); + } + + if ($user_id !== false && empty($this->data)) + { + $this->cookie_data['k'] = ''; + $this->cookie_data['u'] = $user_id; + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $this->cookie_data['u'] . ' + AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + $result = $db->sql_query($sql); + $this->data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $bot = false; + } + + // Bot user, if they have a SID in the Request URI we need to get rid of it + // otherwise they'll index this page with the SID, duplicate content oh my! + if ($bot && isset($_GET['sid'])) + { + send_status_line(301, 'Moved Permanently'); + redirect(build_url(array('sid'))); + } + + // If no data was returned one or more of the following occurred: + // Key didn't match one in the DB + // User does not exist + // User is inactive + // User is bot + if (!is_array($this->data) || !count($this->data)) + { + $this->cookie_data['k'] = ''; + $this->cookie_data['u'] = ($bot) ? $bot : ANONYMOUS; + + if (!$bot) + { + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $this->cookie_data['u']; + } + else + { + // We give bots always the same session if it is not yet expired. + $sql = 'SELECT u.*, s.* + FROM ' . USERS_TABLE . ' u + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) + WHERE u.user_id = ' . (int) $bot; + } + + $result = $db->sql_query($sql); + $this->data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + if ($this->data['user_id'] != ANONYMOUS && !$bot) + { + $this->data['session_last_visit'] = (isset($this->data['session_time']) && $this->data['session_time']) ? $this->data['session_time'] : (($this->data['user_lastvisit']) ? $this->data['user_lastvisit'] : time()); + } + else + { + $this->data['session_last_visit'] = $this->time_now; + } + + // Force user id to be integer... + $this->data['user_id'] = (int) $this->data['user_id']; + + // At this stage we should have a filled data array, defined cookie u and k data. + // data array should contain recent session info if we're a real user and a recent + // session exists in which case session_id will also be set + + // Is user banned? Are they excluded? Won't return on ban, exists within method + $this->check_ban_for_current_session($config); + + $this->data['is_registered'] = (!$bot && $this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false; + $this->data['is_bot'] = ($bot) ? true : false; + + // If our friend is a bot, we re-assign a previously assigned session + if ($this->data['is_bot'] && $bot == $this->data['user_id'] && $this->data['session_id']) + { + // Only assign the current session if the ip, browser and forwarded_for match... + if (strpos($this->ip, ':') !== false && strpos($this->data['session_ip'], ':') !== false) + { + $s_ip = short_ipv6($this->data['session_ip'], $config['ip_check']); + $u_ip = short_ipv6($this->ip, $config['ip_check']); + } + else + { + $s_ip = implode('.', array_slice(explode('.', $this->data['session_ip']), 0, $config['ip_check'])); + $u_ip = implode('.', array_slice(explode('.', $this->ip), 0, $config['ip_check'])); + } + + $s_browser = ($config['browser_check']) ? trim(strtolower(substr($this->data['session_browser'], 0, 149))) : ''; + $u_browser = ($config['browser_check']) ? trim(strtolower(substr($this->browser, 0, 149))) : ''; + + $s_forwarded_for = ($config['forwarded_for_check']) ? substr($this->data['session_forwarded_for'], 0, 254) : ''; + $u_forwarded_for = ($config['forwarded_for_check']) ? substr($this->forwarded_for, 0, 254) : ''; + + if ($u_ip === $s_ip && $s_browser === $u_browser && $s_forwarded_for === $u_forwarded_for) + { + $this->session_id = $this->data['session_id']; + + // Only update session DB a minute or so after last update or if page changes + if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) + { + // Update the last visit time + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $this->data['session_time'] . ' + WHERE user_id = ' . (int) $this->data['user_id']; + $db->sql_query($sql); + } + + $SID = '?sid='; + $_SID = ''; + return true; + } + else + { + // If the ip and browser does not match make sure we only have one bot assigned to one session + $db->sql_query('DELETE FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = ' . $this->data['user_id']); + } + } + + $session_autologin = (($this->cookie_data['k'] || $persist_login) && $this->data['is_registered']) ? true : false; + $set_admin = ($set_admin && $this->data['is_registered']) ? true : false; + + // Create or update the session + $sql_ary = array( + 'session_user_id' => (int) $this->data['user_id'], + 'session_start' => (int) $this->time_now, + 'session_last_visit' => (int) $this->data['session_last_visit'], + 'session_time' => (int) $this->time_now, + 'session_browser' => (string) trim(substr($this->browser, 0, 149)), + 'session_forwarded_for' => (string) $this->forwarded_for, + 'session_ip' => (string) $this->ip, + 'session_autologin' => ($session_autologin) ? 1 : 0, + 'session_admin' => ($set_admin) ? 1 : 0, + 'session_viewonline' => ($viewonline) ? 1 : 0, + ); + + if ($this->update_session_page) + { + $sql_ary['session_page'] = (string) substr($this->page['page'], 0, 199); + $sql_ary['session_forum_id'] = $this->page['forum']; + } + + $db->sql_return_on_error(true); + + $sql = 'DELETE + FROM ' . SESSIONS_TABLE . ' + WHERE session_id = \'' . $db->sql_escape($this->session_id) . '\' + AND session_user_id = ' . ANONYMOUS; + + if (!defined('IN_ERROR_HANDLER') && (!$this->session_id || !$db->sql_query($sql) || !$db->sql_affectedrows())) + { + // Limit new sessions in 1 minute period (if required) + if (empty($this->data['session_time']) && $config['active_sessions']) + { +// $db->sql_return_on_error(false); + + $sql = 'SELECT COUNT(session_id) AS sessions + FROM ' . SESSIONS_TABLE . ' + WHERE session_time >= ' . ($this->time_now - 60); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ((int) $row['sessions'] > (int) $config['active_sessions']) + { + send_status_line(503, 'Service Unavailable'); + trigger_error('BOARD_UNAVAILABLE'); + } + } + } + + // Since we re-create the session id here, the inserted row must be unique. Therefore, we display potential errors. + // Commented out because it will not allow forums to update correctly +// $db->sql_return_on_error(false); + + // Something quite important: session_page always holds the *last* page visited, except for the *first* visit. + // We are not able to simply have an empty session_page btw, therefore we need to tell phpBB how to detect this special case. + // If the session id is empty, we have a completely new one and will set an "identifier" here. This identifier is able to be checked later. + if (empty($this->data['session_id'])) + { + // This is a temporary variable, only set for the very first visit + $this->data['session_created'] = true; + } + + $this->session_id = $this->data['session_id'] = md5(unique_id()); + + $sql_ary['session_id'] = (string) $this->session_id; + $sql_ary['session_page'] = (string) substr($this->page['page'], 0, 199); + $sql_ary['session_forum_id'] = $this->page['forum']; + + $sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + + $db->sql_return_on_error(false); + + // Regenerate autologin/persistent login key + if ($session_autologin) + { + $this->set_login_key(); + } + + // refresh data + $SID = '?sid=' . $this->session_id; + $_SID = $this->session_id; + $this->data = array_merge($this->data, $sql_ary); + + if (!$bot) + { + $cookie_expire = $this->time_now + (($config['max_autologin_time']) ? 86400 * (int) $config['max_autologin_time'] : 31536000); + + $this->set_cookie('u', $this->cookie_data['u'], $cookie_expire); + $this->set_cookie('k', $this->cookie_data['k'], $cookie_expire); + $this->set_cookie('sid', $this->session_id, $cookie_expire); + + unset($cookie_expire); + + $sql = 'SELECT COUNT(session_id) AS sessions + FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . (int) $this->data['user_id'] . ' + AND session_time >= ' . (int) ($this->time_now - (max((int) $config['session_length'], (int) $config['form_token_lifetime']))); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ((int) $row['sessions'] <= 1 || empty($this->data['user_form_salt'])) + { + $this->data['user_form_salt'] = unique_id(); + // Update the form key + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_form_salt = \'' . $db->sql_escape($this->data['user_form_salt']) . '\' + WHERE user_id = ' . (int) $this->data['user_id']; + $db->sql_query($sql); + } + } + else + { + $this->data['session_time'] = $this->data['session_last_visit'] = $this->time_now; + + // Update the last visit time + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $this->data['session_time'] . ' + WHERE user_id = ' . (int) $this->data['user_id']; + $db->sql_query($sql); + + $SID = '?sid='; + $_SID = ''; + } + + $session_data = $sql_ary; + /** + * Event to send new session data to extension + * Read-only event + * + * @event core.session_create_after + * @var array session_data Associative array of session keys to be updated + * @since 3.1.6-RC1 + */ + $vars = array('session_data'); + extract($phpbb_dispatcher->trigger_event('core.session_create_after', compact($vars))); + unset($session_data); + + return true; + } + + /** + * Kills a session + * + * This method does what it says on the tin. It will delete a pre-existing session. + * It resets cookie information (destroying any autologin key within that cookie data) + * and update the users information from the relevant session data. It will then + * grab guest user information. + */ + function session_kill($new_session = true) + { + global $SID, $_SID, $db, $phpbb_container, $phpbb_dispatcher; + + $sql = 'DELETE FROM ' . SESSIONS_TABLE . " + WHERE session_id = '" . $db->sql_escape($this->session_id) . "' + AND session_user_id = " . (int) $this->data['user_id']; + $db->sql_query($sql); + + $user_id = (int) $this->data['user_id']; + $session_id = $this->session_id; + /** + * Event to send session kill information to extension + * Read-only event + * + * @event core.session_kill_after + * @var int user_id user_id of the session user. + * @var string session_id current user's session_id + * @var bool new_session should we create new session for user + * @since 3.1.6-RC1 + */ + $vars = array('user_id', 'session_id', 'new_session'); + extract($phpbb_dispatcher->trigger_event('core.session_kill_after', compact($vars))); + unset($user_id); + unset($session_id); + + // Allow connecting logout with external auth method logout + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $provider = $provider_collection->get_provider(); + $provider->logout($this->data, $new_session); + + if ($this->data['user_id'] != ANONYMOUS) + { + // Delete existing session, update last visit info first! + if (!isset($this->data['session_time'])) + { + $this->data['session_time'] = time(); + } + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $this->data['session_time'] . ' + WHERE user_id = ' . (int) $this->data['user_id']; + $db->sql_query($sql); + + if ($this->cookie_data['k']) + { + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE user_id = ' . (int) $this->data['user_id'] . " + AND key_id = '" . $db->sql_escape(md5($this->cookie_data['k'])) . "'"; + $db->sql_query($sql); + } + + // Reset the data array + $this->data = array(); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . ANONYMOUS; + $result = $db->sql_query($sql); + $this->data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + $cookie_expire = $this->time_now - 31536000; + $this->set_cookie('u', '', $cookie_expire); + $this->set_cookie('k', '', $cookie_expire); + $this->set_cookie('sid', '', $cookie_expire); + unset($cookie_expire); + + $SID = '?sid='; + $this->session_id = $_SID = ''; + + // To make sure a valid session is created we create one for the anonymous user + if ($new_session) + { + $this->session_create(ANONYMOUS); + } + + return true; + } + + /** + * Session garbage collection + * + * This looks a lot more complex than it really is. Effectively we are + * deleting any sessions older than an admin definable limit. Due to the + * way in which we maintain session data we have to ensure we update user + * data before those sessions are destroyed. In addition this method + * removes autologin key information that is older than an admin defined + * limit. + */ + function session_gc() + { + global $db, $config, $phpbb_container, $phpbb_dispatcher; + + if (!$this->time_now) + { + $this->time_now = time(); + } + + /** + * Get expired sessions for registered users, only most recent for each user + * Inner SELECT gets most recent expired sessions for unique session_user_id + * Outer SELECT gets data for them + */ + $sql_select = 'SELECT s1.session_page, s1.session_user_id, s1.session_time AS recent_time + FROM ' . SESSIONS_TABLE . ' AS s1 + INNER JOIN ( + SELECT session_user_id, MAX(session_time) AS recent_time + FROM ' . SESSIONS_TABLE . ' + WHERE session_time < ' . ($this->time_now - (int) $config['session_length']) . ' + AND session_user_id <> ' . ANONYMOUS . ' + GROUP BY session_user_id + ) AS s2 + ON s1.session_user_id = s2.session_user_id + AND s1.session_time = s2.recent_time'; + + switch ($db->get_sql_layer()) + { + case 'sqlite3': + if (phpbb_version_compare($db->sql_server_info(true), '3.8.3', '>=')) + { + // For SQLite versions 3.8.3+ which support Common Table Expressions (CTE) + $sql = "WITH s3 (session_page, session_user_id, session_time) AS ($sql_select) + UPDATE " . USERS_TABLE . ' + SET (user_lastpage, user_lastvisit) = (SELECT session_page, session_time FROM s3 WHERE session_user_id = user_id) + WHERE EXISTS (SELECT session_user_id FROM s3 WHERE session_user_id = user_id)'; + $db->sql_query($sql); + + break; + } + + // No break, for SQLite versions prior to 3.8.3 and Oracle + case 'oracle': + $result = $db->sql_query($sql_select); + while ($row = $db->sql_fetchrow($result)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $row['recent_time'] . ", user_lastpage = '" . $db->sql_escape($row['session_page']) . "' + WHERE user_id = " . (int) $row['session_user_id']; + $db->sql_query($sql); + } + $db->sql_freeresult($result); + break; + + case 'mysqli': + $sql = 'UPDATE ' . USERS_TABLE . " u, + ($sql_select) s3 + SET u.user_lastvisit = s3.recent_time, u.user_lastpage = s3.session_page + WHERE u.user_id = s3.session_user_id"; + $db->sql_query($sql); + break; + + default: + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastvisit = s3.recent_time, user_lastpage = s3.session_page + FROM ($sql_select) s3 + WHERE user_id = s3.session_user_id"; + $db->sql_query($sql); + break; + } + + // Delete all expired sessions + $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' + WHERE session_time < ' . ($this->time_now - (int) $config['session_length']); + $db->sql_query($sql); + + // Update gc timer + $config->set('session_last_gc', $this->time_now, false); + + if ($config['max_autologin_time']) + { + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE last_login < ' . (time() - (86400 * (int) $config['max_autologin_time'])); + $db->sql_query($sql); + } + + // only called from CRON; should be a safe workaround until the infrastructure gets going + /* @var \phpbb\captcha\factory $captcha_factory */ + $captcha_factory = $phpbb_container->get('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']); + $db->sql_query($sql); + + /** + * Event to trigger extension on session_gc + * + * @event core.session_gc_after + * @since 3.1.6-RC1 + */ + $phpbb_dispatcher->dispatch('core.session_gc_after'); + + return; + } + + /** + * Sets a cookie + * + * Sets a cookie of the given name with the specified data for the given length of time. If no time is specified, a session cookie will be set. + * + * @param string $name Name of the cookie, will be automatically prefixed with the phpBB cookie name. track becomes [cookie_name]_track then. + * @param string $cookiedata The data to hold within the cookie + * @param int $cookietime The expiration time as UNIX timestamp. If 0 is provided, a session cookie is set. + * @param bool $httponly Use HttpOnly. Defaults to true. Use false to make cookie accessible by client-side scripts. + */ + function set_cookie($name, $cookiedata, $cookietime, $httponly = true) + { + global $config, $phpbb_dispatcher; + + // If headers are already set, we just return + if (headers_sent()) + { + return; + } + + $disable_cookie = false; + /** + * Event to modify or disable setting cookies + * + * @event core.set_cookie + * @var bool disable_cookie Set to true to disable setting this cookie + * @var string name Name of the cookie + * @var string cookiedata The data to hold within the cookie + * @var int cookietime The expiration time as UNIX timestamp + * @var bool httponly Use HttpOnly? + * @since 3.2.9-RC1 + */ + $vars = array( + 'disable_cookie', + 'name', + 'cookiedata', + 'cookietime', + 'httponly', + ); + extract($phpbb_dispatcher->trigger_event('core.set_cookie', compact($vars))); + + if ($disable_cookie) + { + return; + } + + $name_data = rawurlencode($config['cookie_name'] . '_' . $name) . '=' . rawurlencode($cookiedata); + $expire = gmdate('D, d-M-Y H:i:s \\G\\M\\T', $cookietime); + $domain = (!$config['cookie_domain'] || $config['cookie_domain'] == '127.0.0.1' || strpos($config['cookie_domain'], '.') === false) ? '' : '; domain=' . $config['cookie_domain']; + + header('Set-Cookie: ' . $name_data . (($cookietime) ? '; expires=' . $expire : '') . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . ';' . (($httponly) ? ' HttpOnly' : ''), false); + } + + /** + * Check for banned user + * + * Checks whether the supplied user is banned by id, ip or email. If no parameters + * are passed to the method pre-existing session data is used. + * + * @param int|false $user_id The user id + * @param mixed $user_ips Can contain a string with one IP or an array of multiple IPs + * @param string|false $user_email The user email + * @param bool $return If $return is false this routine does not return on finding a banned user, + * it outputs a relevant message and stops execution. + */ + function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) + { + global $config, $db, $phpbb_dispatcher; + + if (defined('IN_CHECK_BAN') || defined('SKIP_CHECK_BAN')) + { + return; + } + + $banned = false; + $cache_ttl = 3600; + $where_sql = array(); + + $sql = 'SELECT ban_ip, ban_userid, ban_email, ban_exclude, ban_give_reason, ban_end + FROM ' . BANLIST_TABLE . ' + WHERE '; + + // Determine which entries to check, only return those + if ($user_email === false) + { + $where_sql[] = "ban_email = ''"; + } + + if ($user_ips === false) + { + $where_sql[] = "(ban_ip = '' OR ban_exclude = 1)"; + } + + if ($user_id === false) + { + $where_sql[] = '(ban_userid = 0 OR ban_exclude = 1)'; + } + else + { + $cache_ttl = ($user_id == ANONYMOUS) ? 3600 : 0; + $_sql = '(ban_userid = ' . $user_id; + + if ($user_email !== false) + { + $_sql .= " OR ban_email <> ''"; + } + + if ($user_ips !== false) + { + $_sql .= " OR ban_ip <> ''"; + } + + $_sql .= ')'; + + $where_sql[] = $_sql; + } + + $sql .= (count($where_sql)) ? implode(' AND ', $where_sql) : ''; + $result = $db->sql_query($sql, $cache_ttl); + + $ban_triggered_by = 'user'; + while ($row = $db->sql_fetchrow($result)) + { + if ($row['ban_end'] && $row['ban_end'] < time()) + { + continue; + } + + $ip_banned = false; + if (!empty($row['ban_ip'])) + { + if (!is_array($user_ips)) + { + $ip_banned = preg_match('#^' . str_replace('\*', '.*?', preg_quote($row['ban_ip'], '#')) . '$#i', $user_ips); + } + else + { + foreach ($user_ips as $user_ip) + { + if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($row['ban_ip'], '#')) . '$#i', $user_ip)) + { + $ip_banned = true; + break; + } + } + } + } + + if ((!empty($row['ban_userid']) && intval($row['ban_userid']) == $user_id) || + $ip_banned || + (!empty($row['ban_email']) && preg_match('#^' . str_replace('\*', '.*?', preg_quote($row['ban_email'], '#')) . '$#i', $user_email))) + { + if (!empty($row['ban_exclude'])) + { + $banned = false; + break; + } + else + { + $banned = true; + $ban_row = $row; + + if (!empty($row['ban_userid']) && intval($row['ban_userid']) == $user_id) + { + $ban_triggered_by = 'user'; + } + else if ($ip_banned) + { + $ban_triggered_by = 'ip'; + } + else + { + $ban_triggered_by = 'email'; + } + + // Don't break. Check if there is an exclude rule for this user + } + } + } + $db->sql_freeresult($result); + + /** + * Event to set custom ban type + * + * @event core.session_set_custom_ban + * @var bool return If $return is false this routine does not return on finding a banned user, it outputs a relevant message and stops execution + * @var bool banned Check if user already banned + * @var array|false ban_row Ban data + * @var string ban_triggered_by Method that caused ban, can be your custom method + * @since 3.1.3-RC1 + */ + $ban_row = isset($ban_row) ? $ban_row : false; + $vars = array('return', 'banned', 'ban_row', 'ban_triggered_by'); + extract($phpbb_dispatcher->trigger_event('core.session_set_custom_ban', compact($vars))); + + if ($banned && !$return) + { + global $phpbb_root_path, $phpEx; + + // If the session is empty we need to create a valid one... + if (empty($this->session_id)) + { + // This seems to be no longer needed? - #14971 +// $this->session_create(ANONYMOUS); + } + + // Initiate environment ... since it won't be set at this stage + $this->setup(); + + // Logout the user, banned users are unable to use the normal 'logout' link + if ($this->data['user_id'] != ANONYMOUS) + { + $this->session_kill(); + } + + // We show a login box here to allow founders accessing the board if banned by IP + if (defined('IN_LOGIN') && $this->data['user_id'] == ANONYMOUS) + { + $this->setup('ucp'); + $this->data['is_registered'] = $this->data['is_bot'] = false; + + // Set as a precaution to allow login_box() handling this case correctly as well as this function not being executed again. + define('IN_CHECK_BAN', 1); + + login_box("index.$phpEx"); + + // The false here is needed, else the user is able to circumvent the ban. + $this->session_kill(false); + } + + // Ok, we catch the case of an empty session id for the anonymous user... + // This can happen if the user is logging in, banned by username and the login_box() being called "again". + if (empty($this->session_id) && defined('IN_CHECK_BAN')) + { + $this->session_create(ANONYMOUS); + } + + // Determine which message to output + $till_date = ($ban_row['ban_end']) ? $this->format_date($ban_row['ban_end']) : ''; + $message = ($ban_row['ban_end']) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM'; + + $contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx); + $message = sprintf($this->lang[$message], $till_date, '', ''); + $message .= ($ban_row['ban_give_reason']) ? '

' . sprintf($this->lang['BOARD_BAN_REASON'], $ban_row['ban_give_reason']) : ''; + $message .= '

' . $this->lang['BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)] . ''; + + // A very special case... we are within the cron script which is not supposed to print out the ban message... show blank page + if (defined('IN_CRON')) + { + garbage_collection(); + exit_handler(); + exit; + } + + // To circumvent session_begin returning a valid value and the check_ban() not called on second page view, we kill the session again + $this->session_kill(false); + + trigger_error($message); + } + + if (!empty($ban_row)) + { + $ban_row['ban_triggered_by'] = $ban_triggered_by; + } + + return ($banned && $ban_row) ? $ban_row : $banned; + } + + /** + * Check the current session for bans + * + * @return true if session user is banned. + */ + protected function check_ban_for_current_session($config) + { + if (!defined('SKIP_CHECK_BAN') && $this->data['user_type'] != USER_FOUNDER) + { + if (!$config['forwarded_for_check']) + { + $this->check_ban($this->data['user_id'], $this->ip); + } + else + { + $ips = explode(' ', $this->forwarded_for); + $ips[] = $this->ip; + $this->check_ban($this->data['user_id'], $ips); + } + } + } + + /** + * Check if ip is blacklisted + * This should be called only where absolutely necessary + * + * Only IPv4 (rbldns does not support AAAA records/IPv6 lookups) + * + * @author satmd (from the php manual) + * @param string $mode register/post - spamcop for example is omitted for posting + * @param string|false $ip the IPv4 address to check + * + * @return false if ip is not blacklisted, else an array([checked server], [lookup]) + */ + function check_dnsbl($mode, $ip = false) + { + if ($ip === false) + { + $ip = $this->ip; + } + + // Neither Spamhaus nor Spamcop supports IPv6 addresses. + if (strpos($ip, ':') !== false) + { + return false; + } + + $dnsbl_check = array( + 'sbl.spamhaus.org' => 'http://www.spamhaus.org/query/bl?ip=', + ); + + if ($mode == 'register') + { + $dnsbl_check['bl.spamcop.net'] = 'http://spamcop.net/bl.shtml?'; + } + + if ($ip) + { + $quads = explode('.', $ip); + $reverse_ip = $quads[3] . '.' . $quads[2] . '.' . $quads[1] . '.' . $quads[0]; + + // Need to be listed on all servers... + $listed = true; + $info = array(); + + foreach ($dnsbl_check as $dnsbl => $lookup) + { + if (checkdnsrr($reverse_ip . '.' . $dnsbl . '.', 'A') === true) + { + $info = array($dnsbl, $lookup . $ip); + } + else + { + $listed = false; + } + } + + if ($listed) + { + return $info; + } + } + + return false; + } + + /** + * Check if URI is blacklisted + * This should be called only where absolutely necessary, for example on the submitted website field + * This function is not in use at the moment and is only included for testing purposes, it may not work at all! + * This means it is untested at the moment and therefore commented out + * + * @param string $uri URI to check + * @return true if uri is on blacklist, else false. Only blacklist is checked (~zero FP), no grey lists + function check_uribl($uri) + { + // Normally parse_url() is not intended to parse uris + // We need to get the top-level domain name anyway... change. + $uri = parse_url($uri); + + if ($uri === false || empty($uri['host'])) + { + return false; + } + + $uri = trim($uri['host']); + + if ($uri) + { + // One problem here... the return parameter for the "windows" method is different from what + // we expect... this may render this check useless... + if (checkdnsrr($uri . '.multi.uribl.com.', 'A') === true) + { + return true; + } + } + + return false; + } + */ + + /** + * Set/Update a persistent login key + * + * This method creates or updates a persistent session key. When a user makes + * use of persistent (formerly auto-) logins a key is generated and stored in the + * DB. When they revisit with the same key it's automatically updated in both the + * DB and cookie. Multiple keys may exist for each user representing different + * browsers or locations. As with _any_ non-secure-socket no passphrase login this + * remains vulnerable to exploit. + */ + function set_login_key($user_id = false, $key = false, $user_ip = false) + { + global $db; + + $user_id = ($user_id === false) ? $this->data['user_id'] : $user_id; + $user_ip = ($user_ip === false) ? $this->ip : $user_ip; + $key = ($key === false) ? (($this->cookie_data['k']) ? $this->cookie_data['k'] : false) : $key; + + $key_id = unique_id(hexdec(substr($this->session_id, 0, 8))); + + $sql_ary = array( + 'key_id' => (string) md5($key_id), + 'last_ip' => (string) $user_ip, + 'last_login' => (int) time() + ); + + if (!$key) + { + $sql_ary += array( + 'user_id' => (int) $user_id + ); + } + + if ($key) + { + $sql = 'UPDATE ' . SESSIONS_KEYS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . (int) $user_id . " + AND key_id = '" . $db->sql_escape(md5($key)) . "'"; + } + else + { + $sql = 'INSERT INTO ' . SESSIONS_KEYS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + } + $db->sql_query($sql); + + $this->cookie_data['k'] = $key_id; + + return false; + } + + /** + * Reset all login keys for the specified user + * + * This method removes all current login keys for a specified (or the current) + * user. It will be called on password change to render old keys unusable + */ + function reset_login_keys($user_id = false) + { + global $db; + + $user_id = ($user_id === false) ? (int) $this->data['user_id'] : (int) $user_id; + + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE user_id = ' . (int) $user_id; + $db->sql_query($sql); + + // If the user is logged in, update last visit info first before deleting sessions + $sql = 'SELECT session_time, session_page + FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . (int) $user_id . ' + ORDER BY session_time DESC'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $row['session_time'] . ", user_lastpage = '" . $db->sql_escape($row['session_page']) . "' + WHERE user_id = " . (int) $user_id; + $db->sql_query($sql); + } + + // Let's also clear any current sessions for the specified user_id + // If it's the current user then we'll leave this session intact + $sql_where = 'session_user_id = ' . (int) $user_id; + $sql_where .= ($user_id === (int) $this->data['user_id']) ? " AND session_id <> '" . $db->sql_escape($this->session_id) . "'" : ''; + + $sql = 'DELETE FROM ' . SESSIONS_TABLE . " + WHERE $sql_where"; + $db->sql_query($sql); + + // We're changing the password of the current user and they have a key + // Lets regenerate it to be safe + if ($user_id === (int) $this->data['user_id'] && $this->cookie_data['k']) + { + $this->set_login_key($user_id); + } + } + + + /** + * Check if the request originated from the same page. + * @param bool $check_script_path If true, the path will be checked as well + */ + function validate_referer($check_script_path = false) + { + global $config, $request; + + // no referer - nothing to validate, user's fault for turning it off (we only check on POST; so meta can't be the reason) + if (empty($this->referer) || empty($this->host)) + { + return true; + } + + $host = htmlspecialchars($this->host); + $ref = substr($this->referer, strpos($this->referer, '://') + 3); + + if (!(stripos($ref, $host) === 0) && (!$config['force_server_vars'] || !(stripos($ref, $config['server_name']) === 0))) + { + return false; + } + else if ($check_script_path && rtrim($this->page['root_script_path'], '/') !== '') + { + $ref = substr($ref, strlen($host)); + $server_port = $request->server('SERVER_PORT', 0); + + if ($server_port !== 80 && $server_port !== 443 && stripos($ref, ":$server_port") === 0) + { + $ref = substr($ref, strlen(":$server_port")); + } + + if (!(stripos(rtrim($ref, '/'), rtrim($this->page['root_script_path'], '/')) === 0)) + { + return false; + } + } + + return true; + } + + + function unset_admin() + { + global $db; + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET session_admin = 0 + WHERE session_id = \'' . $db->sql_escape($this->session_id) . '\''; + $db->sql_query($sql); + } + + /** + * Update the session data + * + * @param array $session_data associative array of session keys to be updated + * @param string $session_id optional session_id, defaults to current user's session_id + */ + public function update_session($session_data, $session_id = null) + { + global $db, $phpbb_dispatcher; + + $session_id = ($session_id) ? $session_id : $this->session_id; + + $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $session_data) . " + WHERE session_id = '" . $db->sql_escape($session_id) . "'"; + $db->sql_query($sql); + + /** + * Event to send update session information to extension + * Read-only event + * + * @event core.update_session_after + * @var array session_data Associative array of session keys to be updated + * @var string session_id current user's session_id + * @since 3.1.6-RC1 + */ + $vars = array('session_data', 'session_id'); + extract($phpbb_dispatcher->trigger_event('core.update_session_after', compact($vars))); + } + + public function update_session_infos() + { + global $config, $db, $request; + + // No need to update if it's a new session. Informations are already inserted by session_create() + if (isset($this->data['session_created']) && $this->data['session_created']) + { + return; + } + + // Do not update the session page for ajax requests, so the view online still works as intended + $page_changed = $this->update_session_page && $this->data['session_page'] != $this->page['page'] && !$request->is_ajax(); + + // Only update session DB a minute or so after last update or if page changes + if ($this->time_now - (isset($this->data['session_time']) ? $this->data['session_time'] : 0) > 60 || $page_changed) + { + $sql_ary = array('session_time' => $this->time_now); + + if ($page_changed) + { + $sql_ary['session_page'] = substr($this->page['page'], 0, 199); + $sql_ary['session_forum_id'] = $this->page['forum']; + } + + $db->sql_return_on_error(true); + + $this->update_session($sql_ary); + + $db->sql_return_on_error(false); + + $this->data = array_merge($this->data, $sql_ary); + + if ($this->data['user_id'] != ANONYMOUS && isset($config['new_member_post_limit']) && $this->data['user_new'] && $config['new_member_post_limit'] <= $this->data['user_posts']) + { + $this->leave_newly_registered(); + } + } + } +} diff --git a/install/update/new/phpbb/template/asset.php b/install/update/new/phpbb/template/asset.php new file mode 100644 index 0000000..d6b4623 --- /dev/null +++ b/install/update/new/phpbb/template/asset.php @@ -0,0 +1,203 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template; + +class asset +{ + protected $components = array(); + + /** @var \phpbb\path_helper **/ + protected $path_helper; + + /** @var \phpbb\filesystem\filesystem */ + protected $filesystem; + + /** + * Constructor + * + * @param string $url URL + * @param \phpbb\path_helper $path_helper Path helper object + * @param \phpbb\filesystem\filesystem $filesystem + */ + public function __construct($url, \phpbb\path_helper $path_helper, \phpbb\filesystem\filesystem $filesystem) + { + $this->path_helper = $path_helper; + $this->filesystem = $filesystem; + + $this->set_url($url); + } + + /** + * Set URL + * + * @param string $url URL + */ + public function set_url($url) + { + $this->components = parse_url($url); + } + + /** + * Convert URL components into string + * + * @param array $components URL components + * @return string URL + */ + protected function join_url($components) + { + $path = ''; + if (isset($components['scheme'])) + { + $path = $components['scheme'] === '' ? '//' : $components['scheme'] . '://'; + } + + if (isset($components['user']) || isset($components['pass'])) + { + if ($path === '' && !isset($components['port'])) + { + $path = '//'; + } + $path .= $components['user']; + if (isset($components['pass'])) + { + $path .= ':' . $components['pass']; + } + $path .= '@'; + } + + if (isset($components['host'])) + { + if ($path === '' && !isset($components['port'])) + { + $path = '//'; + } + $path .= $components['host']; + if (isset($components['port'])) + { + $path .= ':' . $components['port']; + } + } + + if (isset($components['path'])) + { + $path .= $components['path']; + } + + if (isset($components['query'])) + { + $path .= '?' . $components['query']; + } + + if (isset($components['fragment'])) + { + $path .= '#' . $components['fragment']; + } + + return $path; + } + + /** + * Get URL + * + * @return string URL + */ + public function get_url() + { + return $this->path_helper->update_web_root_path($this->join_url($this->components)); + } + + /** + * Checks if URL is local and relative + * + * @return boolean True if URL is local and relative + */ + public function is_relative() + { + if (empty($this->components) || !isset($this->components['path'])) + { + // Invalid URL + return false; + } + return !isset($this->components['scheme']) && !isset($this->components['host']) && substr($this->components['path'], 0, 1) !== '/'; + } + + /** + * Get path component of current URL + * + * @return string Path + */ + public function get_path() + { + return isset($this->components['path']) ? $this->components['path'] : ''; + } + + /** + * Set path component + * + * @param string $path Path component + * @param boolean $urlencode If true, parts of path should be encoded with rawurlencode() + */ + public function set_path($path, $urlencode = false) + { + // Since 1.7.0 Twig returns the real path of the file. We need it to be relative. + $real_root_path = $this->filesystem->realpath($this->path_helper->get_phpbb_root_path()) . DIRECTORY_SEPARATOR; + + // If the asset is under the phpBB root path we need to remove its path and then prepend $phpbb_root_path + if ($real_root_path && substr($path . DIRECTORY_SEPARATOR, 0, strlen($real_root_path)) === $real_root_path) + { + $path = $this->path_helper->get_phpbb_root_path() . str_replace('\\', '/', substr($path, strlen($real_root_path))); + } + else + { + // Else we make the path relative to the current working directory + $real_root_path = $this->filesystem->realpath('.') . DIRECTORY_SEPARATOR; + if ($real_root_path && substr($path . DIRECTORY_SEPARATOR, 0, strlen($real_root_path)) === $real_root_path) + { + $path = str_replace('\\', '/', substr($path, strlen($real_root_path))); + } + } + + if ($urlencode) + { + $paths = explode('/', $path); + foreach ($paths as &$dir) + { + $dir = rawurlencode($dir); + } + $path = implode('/', $paths); + } + + $this->components['path'] = $path; + } + + /** + * Add assets_version parameter to URL. + * Parameter will not be added if assets_version already exists in URL + * + * @param string $version Version + */ + public function add_assets_version($version) + { + if (!isset($this->components['query'])) + { + $this->components['query'] = 'assets_version=' . $version; + return; + } + $query = $this->components['query']; + if (!preg_match('/(^|[&;])assets_version=/', $query)) + { + $this->components['query'] = $query . '&assets_version=' . $version; + } + } +} diff --git a/install/update/new/phpbb/template/context.php b/install/update/new/phpbb/template/context.php new file mode 100644 index 0000000..f059c32 --- /dev/null +++ b/install/update/new/phpbb/template/context.php @@ -0,0 +1,631 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template; + +/** +* Stores variables assigned to template. +*/ +class context +{ + /** + * variable that holds all the data we'll be substituting into + * the compiled templates. Takes form: + * --> $this->tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value + * if it's a root-level variable, it'll be like this: + * --> $this->tpldata[.][0][varname] == value + * + * @var array + */ + private $tpldata = array('.' => array(0 => array())); + + /** + * @var array Reference to template->tpldata['.'][0] + */ + private $rootref; + + /** + * @var bool + */ + private $num_rows_is_set; + + public function __construct() + { + $this->clear(); + } + + /** + * Clears template data set. + */ + public function clear() + { + $this->tpldata = array('.' => array(0 => array())); + $this->rootref = &$this->tpldata['.'][0]; + $this->num_rows_is_set = false; + } + + /** + * 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 true + */ + public function assign_var($varname, $varval) + { + $this->rootref[$varname] = $varval; + + return true; + } + + /** + * 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 true + */ + public function append_var($varname, $varval) + { + $this->rootref[$varname] = (isset($this->rootref[$varname]) ? $this->rootref[$varname] : '') . $varval; + + return true; + } + + /** + * Retrieve a single scalar value from a single key. + * + * @param string $varname Variable name + * @return mixed Variable value, or null if not set + */ + public function retrieve_var($varname) + { + return isset($this->rootref[$varname]) ? $this->rootref[$varname] : null; + } + + /** + * Returns a reference to template data array. + * + * This function is public so that template renderer may invoke it. + * Users should alter template variables via functions in \phpbb\template\template. + * + * Note: modifying returned array will affect data stored in the context. + * + * @return array template data + */ + public function &get_data_ref() + { + // returning a reference directly is not + // something php is capable of doing + $ref = &$this->tpldata; + + if (!$this->num_rows_is_set) + { + /* + * We do not set S_NUM_ROWS while adding a row, to reduce the complexity + * If we would set it on adding, each subsequent adding would cause + * n modifications, resulting in a O(n!) complexity, rather then O(n) + */ + foreach ($ref as $loop_name => &$loop_data) + { + if ($loop_name === '.') + { + continue; + } + + $this->set_num_rows($loop_data); + } + $this->num_rows_is_set = true; + } + + return $ref; + } + + /** + * Set S_NUM_ROWS for each row in this template block + * + * @param array $loop_data + */ + protected function set_num_rows(&$loop_data) + { + $s_num_rows = count($loop_data); + foreach ($loop_data as &$mod_block) + { + foreach ($mod_block as $sub_block_name => &$sub_block) + { + // If the key name is lowercase and the data is an array, + // it could be a template loop. So we set the S_NUM_ROWS there + // as well. + if ($sub_block_name === strtolower($sub_block_name) && is_array($sub_block)) + { + $this->set_num_rows($sub_block); + } + } + + // Check whether we are inside a block before setting the variable + if (isset($mod_block['S_BLOCK_NAME'])) + { + $mod_block['S_NUM_ROWS'] = $s_num_rows; + } + } + } + + /** + * Returns a reference to template root scope. + * + * This function is public so that template renderer may invoke it. + * Users should not need to invoke this function. + * + * Note: modifying returned array will affect data stored in the context. + * + * @return array template data + */ + public function &get_root_ref() + { + // rootref is already a reference + return $this->rootref; + } + + /** + * 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 true + */ + public function assign_block_vars($blockname, array $vararray) + { + $this->num_rows_is_set = false; + + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; + + $block = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + $pos = strpos($blocks[$i], '['); + $name = ($pos !== false) ? substr($blocks[$i], 0, $pos) : $blocks[$i]; + $block = &$block[$name]; + $block_count = empty($block) ? 0 : count($block) - 1; + $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? $block_count : (min((int) substr($blocks[$i], $pos + 1, -1), $block_count)); + $block = &$block[$index]; + } + + // $block = &$block[$blocks[$i]]; // Do not traverse the last block as it might be empty + $name = $blocks[$i]; + + // Assign S_ROW_COUNT and S_ROW_NUM + $s_row_count = isset($block[$name]) ? count($block[$name]) : 0; + $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; + + // Assign S_FIRST_ROW + if (!$s_row_count) + { + $vararray['S_FIRST_ROW'] = true; + } + + // Assign S_BLOCK_NAME + $vararray['S_BLOCK_NAME'] = $name; + + // Now the tricky part, we always assign S_LAST_ROW and remove the entry before + // This is much more clever than going through the complete template data on display (phew) + $vararray['S_LAST_ROW'] = true; + if ($s_row_count > 0) + { + unset($block[$name][($s_row_count - 1)]['S_LAST_ROW']); + } + + // Now we add the block that we're actually assigning to. + // We're adding a new iteration to this block with the given + // variable assignments. + $block[$name][] = $vararray; + + return true; + } + + /** + * Assign key variable pairs from an array to a whole specified block loop + * + * @param string $blockname Name of block to assign $block_vars_array to + * @param array $block_vars_array An array of hashes of variable name => value pairs + * @return true + */ + public function assign_block_vars_array($blockname, array $block_vars_array) + { + foreach ($block_vars_array as $vararray) + { + $this->assign_block_vars($blockname, $vararray); + } + + return true; + } + + /** + * Retrieve key variable pairs from the specified block + * + * @param string $blockname Name of block to retrieve $vararray from + * @param array $vararray An array of variable names, empty array retrieves all vars + * @return array of hashes with variable name as key and retrieved value or null as value + */ + public function retrieve_block_vars($blockname, array $vararray) + { + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; + + $block = $this->tpldata; + for ($i = 0; $i <= $blockcount; $i++) + { + if (($pos = strpos($blocks[$i], '[')) !== false) + { + $name = substr($blocks[$i], 0, $pos); + + if (empty($block[$name])) + { + return array(); + } + + if (strpos($blocks[$i], '[]') === $pos) + { + $index = count($block[$name]) - 1; + } + else + { + $index = min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1); + } + } + else + { + $name = $blocks[$i]; + if (empty($block[$name])) + { + return array(); + } + + $index = count($block[$name]) - 1; + } + $block = $block[$name]; + $block = $block[$index]; + } + + $result = array(); + if ($vararray === array()) + { + // The calculated vars that depend on the block position are excluded from the complete block returned results + $excluded_vars = array('S_FIRST_ROW', 'S_LAST_ROW', 'S_BLOCK_NAME', 'S_NUM_ROWS', 'S_ROW_COUNT', 'S_ROW_NUM'); + + foreach ($block as $varname => $varvalue) + { + if ($varname === strtoupper($varname) && !is_array($varvalue) && !in_array($varname, $excluded_vars)) + { + $result[$varname] = $varvalue; + } + } + } + else + { + foreach ($vararray as $varname) + { + $result[$varname] = isset($block[$varname]) ? $block[$varname] : null; + } + } + return $result; + } + + /** + * Find the index for a specified key in the innermost specified block + * + * @param string $blockname the blockname, for example 'loop' + * @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 search for] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @return mixed false if not found, index position otherwise; be sure to test with === + */ + public function find_key_index($blockname, $key) + { + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; + + $block = $this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + $pos = strpos($blocks[$i], '['); + $name = ($pos !== false) ? substr($blocks[$i], 0, $pos) : $blocks[$i]; + + if (!isset($block[$name])) + { + return false; + } + + $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? (count($block[$name]) - 1) : (min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1)); + + if (!isset($block[$name][$index])) + { + return false; + } + $block = $block[$name][$index]; + } + + if (!isset($block[$blocks[$i]])) + { + return false; + } + $block = $block[$blocks[$i]]; // Traverse the last block + + // Change key to zero (change first position) if false and to last position if true + if (is_bool($key)) + { + return (!$key) ? 0 : count($block) - 1; + } + + // Get correct position if array given + if (is_array($key)) + { + // Search array to get correct position + list($search_key, $search_value) = @each($key); + foreach ($block as $i => $val_ary) + { + if ($val_ary[$search_key] === $search_value) + { + return $i; + } + } + } + + return (is_int($key) && ((0 <= $key) && ($key < count($block)))) ? $key : false; + } + + /** + * 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', 'change' and 'delete') + * + * 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). + * If delete, the vararray is ignored, and the block at the given position (counting from zero) is removed. + * + * 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') + { + $this->num_rows_is_set = false; + + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; + + $block = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + if (($pos = strpos($blocks[$i], '[')) !== false) + { + $name = substr($blocks[$i], 0, $pos); + + if (strpos($blocks[$i], '[]') === $pos) + { + $index = count($block[$name]) - 1; + } + else + { + $index = min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1); + } + } + else + { + $name = $blocks[$i]; + $index = count($block[$name]) - 1; + } + $block = &$block[$name]; + $block = &$block[$index]; + } + $name = $blocks[$i]; + + // If last block does not exist and we are inserting, and not searching for key, we create it empty; otherwise, nothing to do + if (!isset($block[$name])) + { + if ($mode != 'insert' || is_array($key)) + { + return false; + } + $block[$name] = array(); + } + + $block = &$block[$name]; // Now we can traverse the last block + + // Change key to zero (change first position) if false and to last position if true + if ($key === false || $key === true) + { + $key = ($key === false) ? 0 : count($block); + } + + // Get correct position if array given + if (is_array($key)) + { + // Search array to get correct position + list($search_key, $search_value) = @each($key); + + $key = null; + foreach ($block as $i => $val_ary) + { + if ($val_ary[$search_key] === $search_value) + { + $key = $i; + break; + } + } + + // key/value pair not found + if ($key === null) + { + return false; + } + } + + // Insert Block + if ($mode == 'insert') + { + // Make sure we are not exceeding the last iteration + if ($key >= count($block)) + { + $key = count($block); + unset($block[($key - 1)]['S_LAST_ROW']); + $vararray['S_LAST_ROW'] = true; + } + if ($key <= 0) + { + $key = 0; + unset($block[0]['S_FIRST_ROW']); + $vararray['S_FIRST_ROW'] = true; + } + + // Assign S_BLOCK_NAME + $vararray['S_BLOCK_NAME'] = $name; + + // Re-position template blocks + for ($i = count($block); $i > $key; $i--) + { + $block[$i] = $block[$i-1]; + + $block[$i]['S_ROW_COUNT'] = $block[$i]['S_ROW_NUM'] = $i; + } + + // Insert vararray at given position + $block[$key] = $vararray; + $block[$key]['S_ROW_COUNT'] = $block[$key]['S_ROW_NUM'] = $key; + + return true; + } + + // Which block to change? + if ($mode == 'change') + { + // If key is out of bounds, do not change anything + if ($key > count($block) || $key < 0) + { + return false; + } + + if ($key == count($block)) + { + $key--; + } + + $block[$key] = array_merge($block[$key], $vararray); + + return true; + } + + // Delete Block + if ($mode == 'delete') + { + // If we are exceeding last iteration, do not delete anything + if ($key > count($block) || $key < 0) + { + return false; + } + + // If we are positioned at the end, we remove the last element + if ($key == count($block)) + { + $key--; + } + + // We are deleting the last element in the block, so remove the block + if (count($block) === 1) + { + $block = null; // unset($block); does not work on references + return true; + } + + // Re-position template blocks + for ($i = $key; $i < count($block)-1; $i++) + { + $block[$i] = $block[$i+1]; + $block[$i]['S_ROW_COUNT'] = $block[$i]['S_ROW_NUM'] = $i; + } + + // Remove the last element + unset($block[$i]); + + // Set first and last elements again, in case they were removed + $block[0]['S_FIRST_ROW'] = true; + $block[count($block)-1]['S_LAST_ROW'] = true; + + return true; + } + + return false; + } + + /** + * Reset/empty complete block + * + * @param string $blockname Name of block to destroy + * @return true + */ + public function destroy_block_vars($blockname) + { + $this->num_rows_is_set = false; + if (strpos($blockname, '.') !== false) + { + // Nested block. + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; + + $str = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + $str = &$str[$blocks[$i]]; + $str = &$str[count($str) - 1]; + } + + unset($str[$blocks[$blockcount]]); + } + else + { + // Top-level block. + unset($this->tpldata[$blockname]); + } + + return true; + } +} diff --git a/install/update/new/phpbb/template/template.php b/install/update/new/phpbb/template/template.php new file mode 100644 index 0000000..6634c28 --- /dev/null +++ b/install/update/new/phpbb/template/template.php @@ -0,0 +1,224 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template; + +interface template +{ + + /** + * Clear the cache + * + * @return \phpbb\template\template + */ + public function clear_cache(); + + /** + * Sets the template filenames for handles. + * + * @param array $filename_array Should be a hash of handle => filename pairs. + * @return \phpbb\template\template $this + */ + public function set_filenames(array $filename_array); + + /** + * Get the style tree of the style preferred by the current user + * + * @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\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\template $this + */ + public function set_custom_style($names, $paths); + + /** + * Clears all variables and blocks assigned to this template. + * + * @return \phpbb\template\template $this + */ + public function destroy(); + + /** + * Reset/empty complete block + * + * @param string $blockname Name of block to destroy + * @return \phpbb\template\template $this + */ + public function destroy_block_vars($blockname); + + /** + * Display a template for provided handle. + * + * The template will be loaded and compiled, if necessary, first. + * + * This function calls hooks. + * + * @param string $handle Handle to display + * @return \phpbb\template\template $this + */ + public function display($handle); + + /** + * Display the handle and assign the output to a template variable + * or return the compiled result. + * + * @param string $handle Handle to operate on + * @param string $template_var Template variable to assign compiled handle to + * @param bool $return_content If true return compiled handle, otherwise assign to $template_var + * @return \phpbb\template\template|string if $return_content is true return string of the compiled handle, otherwise return $this + */ + public function assign_display($handle, $template_var = '', $return_content = true); + + /** + * Assign key variable pairs from an array + * + * @param array $vararray A hash of variable name => value pairs + * @return \phpbb\template\template $this + */ + public function assign_vars(array $vararray); + + /** + * Assign a single scalar value to a single key. + * + * Value can be a string, an integer or a boolean. + * + * @param string $varname Variable name + * @param string $varval Value to assign to variable + * @return \phpbb\template\template $this + */ + public function assign_var($varname, $varval); + + /** + * Append text to the string value stored in a key. + * + * Text is appended using the string concatenation operator (.). + * + * @param string $varname Variable name + * @param string $varval Value to append to variable + * @return \phpbb\template\template $this + */ + public function append_var($varname, $varval); + + /** + * Retrieve multiple template values + * + * @param array $vararray An array with variable names + * @return array A hash of variable name => value pairs (value is null if not set) + */ + public function retrieve_vars(array $vararray); + + /** + * Retrieve a single scalar value from a single key. + * + * @param string $varname Variable name + * @return mixed Variable value, or null if not set + */ + public function retrieve_var($varname); + + /** + * 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\template $this + */ + public function assign_block_vars($blockname, array $vararray); + + /** + * Assign key variable pairs from an array to a whole specified block loop + * @param string $blockname Name of block to assign $block_vars_array to + * @param array $block_vars_array An array of hashes of variable name => value pairs + * @return \phpbb\template\template $this + */ + public function assign_block_vars_array($blockname, array $block_vars_array); + + /** + * Retrieve variable values from an specified block + * @param string $blockname Name of block to retrieve $vararray from + * @param array $vararray An array with variable names, empty array gets all vars + * @return array A hash of variable name => value pairs (value is null if not set) + */ + public function retrieve_block_vars($blockname, array $vararray); + + /** + * Change already assigned key variable pair (one-dimensional - single loop entry) + * + * An example of how to use this function: + * {@example alter_block_array.php} + * + * @param string $blockname the blockname, for example 'loop' + * @param array $vararray the var array to insert/add or merge + * @param mixed $key Key to search for + * + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] + * + * int: Position [the position to change or insert at directly given] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @param string $mode Mode to execute (valid modes are 'insert', 'change' and 'delete') + * + * 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). + * If delete, the vararray is ignored, and the block at the given position (counting from zero) is removed. + * + * 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'); + + /** + * Find the index for a specified key in the innermost specified block + * + * @param string $blockname the blockname, for example 'loop' + * @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 search for] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @return mixed false if not found, index position otherwise; be sure to test with === + */ + public function find_key_index($blockname, $key); + + /** + * Get path to template for handle (required for BBCode parser) + * + * @param string $handle Handle to retrieve the source file + * @return string + */ + public function get_source_file_for_handle($handle); +} diff --git a/install/update/new/phpbb/template/twig/extension.php b/install/update/new/phpbb/template/twig/extension.php new file mode 100644 index 0000000..1131a7f --- /dev/null +++ b/install/update/new/phpbb/template/twig/extension.php @@ -0,0 +1,201 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig; + +class extension extends \Twig_Extension +{ + /** @var \phpbb\template\context */ + protected $context; + + /** @var \phpbb\template\twig\environment */ + protected $environment; + + /** @var \phpbb\language\language */ + protected $language; + + /** + * Constructor + * + * @param \phpbb\template\context $context + * @param \phpbb\template\twig\environment $environment + * @param \phpbb\language\language $language + */ + public function __construct(\phpbb\template\context $context, \phpbb\template\twig\environment $environment, $language) + { + $this->context = $context; + $this->environment = $environment; + $this->language = $language; + } + + /** + * Get the name of this extension + * + * @return string + */ + public function getName() + { + return 'phpbb'; + } + + /** + * Returns the token parser instance to add to the existing list. + * + * @return array An array of Twig_TokenParser instances + */ + public function getTokenParsers() + { + return array( + new \phpbb\template\twig\tokenparser\defineparser, + new \phpbb\template\twig\tokenparser\includeparser, + new \phpbb\template\twig\tokenparser\includejs, + new \phpbb\template\twig\tokenparser\includecss, + new \phpbb\template\twig\tokenparser\event($this->environment), + new \phpbb\template\twig\tokenparser\includephp($this->environment), + new \phpbb\template\twig\tokenparser\php($this->environment), + ); + } + + /** + * Returns a list of filters to add to the existing list. + * + * @return array An array of filters + */ + public function getFilters() + { + return array( + new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), + // @deprecated 3.2.0 Uses twig's JS escape method instead of addslashes + new \Twig_SimpleFilter('addslashes', 'addslashes'), + ); + } + + /** + * Returns a list of global functions to add to the existing list. + * + * @return array An array of global functions + */ + public function getFunctions() + { + return array( + new \Twig_SimpleFunction('lang', array($this, 'lang')), + new \Twig_SimpleFunction('lang_defined', array($this, 'lang_defined')), + new \Twig_SimpleFunction('get_class', 'get_class'), + ); + } + + /** + * Returns a list of operators to add to the existing list. + * + * @return array An array of operators + */ + public function getOperators() + { + return array( + array( + '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), + ), + array( + // precedence settings are copied from similar operators in Twig core extension + '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + + 'eq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + + 'ne' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'neq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '<>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + + '===' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\equalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '!==' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\notequalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + + 'gt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'gte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'ge' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'lt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'lte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'le' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + + 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + ), + ); + } + + /** + * Grabs a subset of a loop + * + * @param \Twig_Environment $env A Twig_Environment instance + * @param mixed $item A variable + * @param integer $start Start of the subset + * @param integer $end End of the subset + * @param Boolean $preserveKeys Whether to preserve key or not (when the input is an array) + * + * @return mixed The sliced variable + */ + public function loop_subset(\Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false) + { + // We do almost the same thing as Twig's slice (array_slice), except when $end is positive + if ($end >= 1) + { + // When end is > 1, subset will end on the last item in an array with the specified $end + // This is different from slice in that it is the number we end on rather than the number + // of items to grab (length) + + // Start must always be the actual starting number for this calculation (not negative) + $start = ($start < 0) ? count($item) + $start : $start; + $end = $end - $start; + } + + // We always include the last element (this was the past design) + $end = ($end == -1 || $end === null) ? null : $end + 1; + + return twig_slice($env, $item, $start, $end, $preserveKeys); + } + + /** + * Get output for a language variable (L_FOO, LA_FOO) + * + * This function checks to see if the language var was outputted to $context + * (e.g. in the ACP, L_TITLE) + * If not, we return the result of $user->lang() + * + * @return string + */ + public function lang() + { + $args = func_get_args(); + $key = $args[0]; + + $context_vars = $this->context->get_root_ref(); + + if (is_string($key) && isset($context_vars['L_' . $key])) + { + return $context_vars['L_' . $key]; + } + + // LA_ is transformed into lang(\'$1\')|escape('js'), so we should not + // need to check for it + + return call_user_func_array(array($this->language, 'lang'), $args); + } + + /** + * Check if a language variable exists + * + * @return bool + */ + public function lang_defined($key) + { + return call_user_func_array([$this->language, 'is_set'], [$key]); + } +} diff --git a/install/update/new/phpbb/template/twig/extension/avatar.php b/install/update/new/phpbb/template/twig/extension/avatar.php new file mode 100644 index 0000000..7a17fd4 --- /dev/null +++ b/install/update/new/phpbb/template/twig/extension/avatar.php @@ -0,0 +1,80 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\template\twig\extension; + +class avatar extends \Twig_Extension +{ + /** + * Get the name of this extension + * + * @return string + */ + public function getName() + { + return 'avatar'; + } + + /** + * Returns a list of global functions to add to the existing list. + * + * @return array An array of global functions + */ + public function getFunctions() + { + return array( + new \Twig_SimpleFunction('avatar', array($this, 'get_avatar')), + ); + } + + /** + * Get avatar for placing into templates. + * + * How to use in a template: + * - {{ avatar('mode', row, alt, ignore_config, lazy) }} + * + * The mode and row (group_row or user_row) are required. + * The other fields (alt|ignore_config|lazy) are optional. + * + * @uses \phpbb_get_group_avatar() + * @uses \phpbb_get_user_avatar() + * + * @return string The avatar HTML for the specified mode + */ + public function get_avatar() + { + $args = func_get_args(); + + $mode = (string) $args[0]; + $row = (array) $args[1]; + $alt = isset($args[2]) ? (string) $args[2] : false; + $ignore_config = isset($args[3]) ? (bool) $args[3] : false; + $lazy = isset($args[4]) ? (bool) $args[4] : false; + + // To prevent having to redefine alt attribute ('USER_AVATAR'|'GROUP_AVATAR'), we check if an alternative has been provided + switch ($mode) + { + case 'group': + return $alt ? phpbb_get_group_avatar($row, $alt, $ignore_config, $lazy) : phpbb_get_group_avatar($row); + break; + + case 'user': + return $alt ? phpbb_get_user_avatar($row, $alt, $ignore_config, $lazy) : phpbb_get_user_avatar($row); + break; + + default: + return ''; + break; + } + } +} diff --git a/install/update/new/phpbb/template/twig/extension/config.php b/install/update/new/phpbb/template/twig/extension/config.php new file mode 100644 index 0000000..cbf6e50 --- /dev/null +++ b/install/update/new/phpbb/template/twig/extension/config.php @@ -0,0 +1,64 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\template\twig\extension; + +class config extends \Twig_Extension +{ + /** @var \phpbb\config\config */ + protected $config; + + /** + * Constructor. + * + * @param \phpbb\config\config $config Configuration object + */ + public function __construct(\phpbb\config\config $config) + { + $this->config = $config; + } + + /** + * Get the name of this extension + * + * @return string + */ + public function getName() + { + return 'config'; + } + + /** + * Returns a list of global functions to add to the existing list. + * + * @return array An array of global functions + */ + public function getFunctions() + { + return array( + new \Twig_SimpleFunction('config', array($this, 'get_config')), + ); + } + + /** + * Retrieves a configuration value for use in templates. + * + * @return string The configuration value + */ + public function get_config() + { + $args = func_get_args(); + + return $this->config->offsetGet($args[0]); + } +} diff --git a/install/update/new/phpbb/template/twig/extension/username.php b/install/update/new/phpbb/template/twig/extension/username.php new file mode 100644 index 0000000..ef14969 --- /dev/null +++ b/install/update/new/phpbb/template/twig/extension/username.php @@ -0,0 +1,84 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\template\twig\extension; + +class username extends \Twig_Extension +{ + /** + * Get the name of this extension + * + * @return string + */ + public function getName() + { + return 'username'; + } + + /** + * Returns a list of global functions to add to the existing list. + * + * @return array An array of global functions + */ + public function getFunctions() + { + return array( + new \Twig_SimpleFunction('username', array($this, 'get_username')), + ); + } + + /** + * Get username details for placing into templates. + * + * How to use in a template: + * - {{ username('mode', user_id, username, user_colour, guest_username, custom_profile_url) }} + * - {{ username('mode', user_row, guest_username, custom_profile_url) }} + * It's possible to provide the user identifier, name and colour separately, + * or provide the entire user row at once as an array. + * + * The mode, user_id and username are required (separately or through a user row). + * The other fields (user_colour|guest_username|custom_profile_url) are optional. + * + * @uses \get_username_string() + * + * @return string A string based on what is wanted depending on $mode + */ + public function get_username() + { + $args = func_get_args(); + + $mode = $args[0]; + $user = $args[1]; + + // If the entire user row is provided + if (is_array($user)) + { + $user_id = isset($user['user_id']) ? $user['user_id'] : ''; + $username = isset($user['username']) ? $user['username'] : ''; + $user_colour = isset($user['user_colour']) ? $user['user_colour'] : ''; + $guest_username = isset($args[2]) ? $args[2] : false; + $custom_profile_url = isset($args[3]) ? $args[3] : false; + } + else + { + // Options are provided separately + $user_id = $user; + $username = $args[2]; + $user_colour = isset($args[3]) ? $args[3] : ''; + $guest_username = isset($args[4]) ? $args[4] : false; + $custom_profile_url = isset($args[5]) ? $args[5] : false; + } + + return get_username_string($mode, $user_id, $username, $user_colour, $guest_username, $custom_profile_url); + } +} diff --git a/install/update/new/phpbb/template/twig/lexer.php b/install/update/new/phpbb/template/twig/lexer.php new file mode 100644 index 0000000..6615a46 --- /dev/null +++ b/install/update/new/phpbb/template/twig/lexer.php @@ -0,0 +1,358 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig; + +class lexer extends \Twig_Lexer +{ + public function tokenize(\Twig_Source $source) + { + $code = $source->getCode(); + $filename = $source->getName(); + + // Our phpBB tags + // Commented out tokens are handled separately from the main replace + $phpbb_tags = array( + /*'BEGIN', + 'BEGINELSE', + 'END', + 'IF', + 'ELSE', + 'ELSEIF', + 'ENDIF', + 'DEFINE', + 'UNDEFINE',*/ + 'ENDDEFINE', + 'INCLUDE', + 'INCLUDEPHP', + 'INCLUDEJS', + 'INCLUDECSS', + 'PHP', + 'ENDPHP', + 'EVENT', + ); + + // Twig tag masks + $twig_tags = array( + 'autoescape', + 'endautoescape', + 'if', + 'elseif', + 'else', + 'endif', + 'block', + 'endblock', + 'use', + 'extends', + 'embed', + 'filter', + 'endfilter', + 'flush', + 'for', + 'endfor', + 'macro', + 'endmacro', + 'import', + 'from', + 'sandbox', + 'endsandbox', + 'set', + 'endset', + 'spaceless', + 'endspaceless', + 'verbatim', + 'endverbatim', + ); + + // Fix tokens that may have inline variables (e.g. with Twig style, {% TOKEN %} + // This also strips outer parenthesis, becomes + $code = preg_replace('##', '{% $1 $2 %}', $code); + + // Replace all of our twig masks with Twig code (e.g. with {% block $1 %}) + $code = $this->replace_twig_tag_masks($code, $twig_tags); + + // Replace all of our language variables, {L_VARNAME}, with Twig style, {{ lang('NAME') }} + // Appends any filters after lang() + $code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2 }}', $code); + + // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|escape('js') }} + // Appends any filters after lang(), but before escape('js') + $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2|escape(\'js\') }}', $code); + + // Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }} + // Appends any filters + $code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ $1$2 }}', $code); + + // Tokenize \Twig_Source instance + return parent::tokenize(new \Twig_Source($code, $filename)); + } + + /** + * Strip surrounding quotes + * + * First step to fix tokens that may have inline variables + * E.g. #', '', $code); + } + + /** + * Fix tokens that may have inline variables + * + * Second step to fix tokens that may have inline variables + * E.g. "; + }; + + return preg_replace_callback('##', $callback, $code); + } + + /** + * Add surrounding quotes + * + * Last step to fix tokens that may have inline variables + * E.g. #', '', $code); + } + + /** + * Fix begin tokens (convert our BEGIN to Twig for) + * + * Not meant to be used outside of this context, public because the anonymous function calls this + * + * @param string $code + * @param array $parent_nodes (used in recursion) + * @return string + */ + public function fix_begin_tokens($code, $parent_nodes = array()) + { + // PHP 5.3 cannot use $this in an anonymous function, so use this as a work-around + $parent_class = $this; + $callback = function ($matches) use ($parent_class, $parent_nodes) + { + $hard_parents = explode('.', $matches[1]); + array_pop($hard_parents); // ends with . + if ($hard_parents) + { + $parent_nodes = array_merge($hard_parents, $parent_nodes); + } + + $name = $matches[2]; + $subset = trim(substr($matches[3], 1, -1)); // Remove parenthesis + $body = $matches[4]; + + // Replace + $body = str_replace('', '{% else %}', $body); + + // Is the designer wanting to call another loop in a loop? + // + // + // + // + // 'loop2' is actually on the same nesting level as 'loop' you assign + // variables to it with template->assign_block_vars('loop2', array(...)) + if (strpos($name, '!') === 0) + { + // Count the number if ! occurrences + $count = substr_count($name, '!'); + for ($i = 0; $i < $count; $i++) + { + array_pop($parent_nodes); + $name = substr($name, 1); + } + } + + // Remove all parent nodes, e.g. foo, bar from foo.bar.foobar.VAR + foreach ($parent_nodes as $node) + { + $body = preg_replace('#([^a-zA-Z0-9_])' . $node . '\.([a-zA-Z0-9_]+)\.#', '$1$2.', $body); + } + + // Add current node to list of parent nodes for child nodes + $parent_nodes[] = $name; + + // Recursive...fix any child nodes + $body = $parent_class->fix_begin_tokens($body, $parent_nodes); + + // Need the parent variable name + array_pop($parent_nodes); + $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '.' : ''; + + if ($subset !== '') + { + $subset = '|subset(' . $subset . ')'; + } + + $parent = ($parent) ?: 'loops.'; + // Turn into a Twig for loop + return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; + }; + + return preg_replace_callback('#(.+?)#s', $callback, $code); + } + + /** + * Fix IF statements + * + * @param string $code + * @return string + */ + protected function fix_if_tokens($code) + { + // Replace ELSE IF with ELSEIF + $code = preg_replace('##', '', $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 + $inner = preg_replace('#(\s\(*!?)\$([a-zA-Z_0-9]+)#', '$1definition.$2', $inner); + + // Replace .foo with loops.foo|length + $inner = preg_replace('#(\s\(*!?)\.([a-zA-Z_0-9]+)([^a-zA-Z_0-9\.])#', '$1loops.$2|length$3', $inner); + + // Replace .foo.bar with foo.bar|length + $inner = preg_replace('#(\s\(*!?)\.([a-zA-Z_0-9\.]+)([^a-zA-Z_0-9\.])#', '$1$2|length$3', $inner); + + return ""; + }; + + return preg_replace_callback('##', $callback, $code); + } + + /** + * Fix DEFINE statements and {$VARNAME} variables + * + * @param string $code + * @return string + */ + protected function fix_define_tokens($code) + { + /** + * Changing $VARNAME to definition.varname because set is only local + * context (e.g. DEFINE $TEST will only make $TEST available in current + * template and any child templates, but not any parent templates). + * + * DEFINE handles setting it properly to definition in its node, but the + * variables reading FROM it need to be altered to definition.VARNAME + * + * Setting up definition as a class in the array passed to Twig + * ($context) makes set definition.TEST available in the global context + */ + + // Replace #', '{% DEFINE $1 %}', $code); + + // Changing UNDEFINE NAME to DEFINE NAME = null to save from creating an extra token parser/node + $code = preg_replace('##', '{% DEFINE $1= null %}', $code); + + // Replace all of our variables, {$VARNAME}, with Twig style, {{ definition.VARNAME }} + $code = preg_replace('#{\$([a-zA-Z0-9_\.]+)}#', '{{ definition.$1 }}', $code); + + // Replace all of our variables, ~ $VARNAME ~, with Twig style, ~ definition.VARNAME ~ + $code = preg_replace('#~ \$([a-zA-Z0-9_\.]+) ~#', '~ definition.$1 ~', $code); + + return $code; + } + + /** + * Replace Twig tag masks with Twig tag calls + * + * E.g. with {% block foo %} + * + * @param string $code + * @param array $twig_tags All tags we want to create a mask for + * @return string + */ + protected function replace_twig_tag_masks($code, $twig_tags) + { + $callback = function ($matches) + { + $matches[1] = strtolower($matches[1]); + + return "{% {$matches[1]}{$matches[2]}%}"; + }; + + foreach ($twig_tags as &$tag) + { + $tag = strtoupper($tag); + } + + // twig_tags is an array of the twig tags, which are all lowercase, but we use all uppercase tags + $code = preg_replace_callback('##',$callback, $code); + + return $code; + } +} diff --git a/install/update/new/phpbb/template/twig/loader.php b/install/update/new/phpbb/template/twig/loader.php new file mode 100644 index 0000000..0f193db --- /dev/null +++ b/install/update/new/phpbb/template/twig/loader.php @@ -0,0 +1,176 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig; + +/** +* Twig Template loader +*/ +class loader extends \Twig_Loader_Filesystem +{ + protected $safe_directories = array(); + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param string|array $paths + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $paths = array()) + { + $this->filesystem = $filesystem; + + parent::__construct($paths, __DIR__); + } + + /** + * Set safe directories + * + * @param array $directories Array of directories that are safe (empty to clear) + * @return \Twig_Loader_Filesystem + */ + public function setSafeDirectories($directories = array()) + { + $this->safe_directories = array(); + + if (!empty($directories)) + { + foreach ($directories as $directory) + { + $this->addSafeDirectory($directory); + } + } + + return $this; + } + + /** + * Add safe directory + * + * @param string $directory Directory that should be added + * @return \Twig_Loader_Filesystem + */ + public function addSafeDirectory($directory) + { + $directory = $this->filesystem->realpath($directory); + + if ($directory !== false) + { + $this->safe_directories[] = $directory; + } + + return $this; + } + + /** + * Get current safe directories + * + * @return array + */ + public function getSafeDirectories() + { + return $this->safe_directories; + } + + /** + * Override for parent::validateName() + * + * This is done because we added support for safe directories, and when Twig + * findTemplate() is called, validateName() is called first, which would + * always throw an exception if the file is outside of the configured + * template directories. + */ + protected function validateName($name) + { + return; + } + + /** + * Adds a realpath call to fix a BC break in Twig 1.26 (https://github.com/twigphp/Twig/issues/2145) + * + * {@inheritdoc} + */ + public function addPath($path, $namespace = self::MAIN_NAMESPACE) + { + return parent::addPath($this->filesystem->realpath($path), $namespace); + } + + /** + * Find the template + * + * Override for Twig_Loader_Filesystem::findTemplate to add support + * for loading from safe directories. + */ + protected function findTemplate($name, $throw = true) + { + $name = (string) $name; + + // normalize name + $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')); + + // If this is in the cache we can skip the entire process below + // as it should have already been validated + if (isset($this->cache[$name])) + { + return $this->cache[$name]; + } + + // First, find the template name. The override above of validateName + // causes the validateName process to be skipped for this call + $file = parent::findTemplate($name, $throw); + + try + { + // Try validating the name (which may throw an exception) + $this->validateName($name); + } + catch (\Twig_Error_Loader $e) + { + if (strpos($e->getRawMessage(), 'Looks like you try to load a template outside configured directories') === 0) + { + // Ok, so outside of the configured template directories, we + // can now check if we're within a "safe" directory + + // Find the real path of the directory the file is in + $directory = $this->filesystem->realpath(dirname($file)); + + if ($directory === false) + { + // Some sort of error finding the actual path, must throw the exception + throw $e; + } + + foreach ($this->safe_directories as $safe_directory) + { + if (strpos($directory, $safe_directory) === 0) + { + // The directory being loaded is below a directory + // that is "safe". We're good to load it! + return $file; + } + } + } + + // Not within any safe directories + throw $e; + } + + // No exception from validateName, safe to load. + return $file; + } +} diff --git a/install/update/new/phpbb/template/twig/node/definenode.php b/install/update/new/phpbb/template/twig/node/definenode.php new file mode 100644 index 0000000..1c51596 --- /dev/null +++ b/install/update/new/phpbb/template/twig/node/definenode.php @@ -0,0 +1,57 @@ + +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\node; + +class definenode extends \Twig_Node +{ + public function __construct($capture, \Twig_Node $name, \Twig_Node $value, $lineno, $tag = null) + { + parent::__construct(array('name' => $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ + public function compile(\Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + if ($this->getAttribute('capture')) + { + $compiler + ->write("ob_start();\n") + ->subcompile($this->getNode('value')) + ; + + $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new \Twig_Markup(\$value, \$this->env->getCharset());\n"); + } + else + { + $compiler + ->write("\$value = ") + ->subcompile($this->getNode('value')) + ->raw(";\n") + ; + } + + $compiler + ->write("\$context['definition']->set('") + ->raw($this->getNode('name')->getAttribute('name')) + ->raw("', \$value);\n") + ; + } +} diff --git a/install/update/new/phpbb/template/twig/node/includeasset.php b/install/update/new/phpbb/template/twig/node/includeasset.php new file mode 100644 index 0000000..69bfd58 --- /dev/null +++ b/install/update/new/phpbb/template/twig/node/includeasset.php @@ -0,0 +1,65 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\node; + +abstract class includeasset extends \Twig_Node +{ + public function __construct(\Twig_Node_Expression $expr, $lineno, $tag = null) + { + parent::__construct(array('expr' => $expr), array(), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ + public function compile(\Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + $compiler + ->write("\$asset_file = ") + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ->write("\$asset = new \phpbb\\template\\asset(\$asset_file, \$this->env->get_path_helper(), \$this->env->get_filesystem());\n") + ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n") + ->indent() + ->write("\$asset_path = \$asset->get_path();") + ->write("\$local_file = \$this->env->get_phpbb_root_path() . \$asset_path;\n") + ->write("if (!file_exists(\$local_file)) {\n") + ->indent() + ->write("\$local_file = \$this->env->findTemplate(\$asset_path);\n") + ->write("\$asset->set_path(\$local_file, true);\n") + ->outdent() + ->write("}\n") + ->outdent() + ->write("}\n") + ->write("\n") + ->write("if (\$asset->is_relative()) {\n") + ->indent() + ->write("\$asset->add_assets_version(\$this->env->get_phpbb_config()['assets_version']);\n") + ->outdent() + ->write("}\n") + ->write("\$this->env->get_assets_bag()->add_{$this->get_setters_name()}(\$asset);") + ; + } + + /** + * Get the name of the assets bag setter + * + * @return string (e.g. 'script') + */ + abstract public function get_setters_name(); +} diff --git a/install/update/new/phpbb/template/twig/node/includephp.php b/install/update/new/phpbb/template/twig/node/includephp.php new file mode 100644 index 0000000..0cf95ab --- /dev/null +++ b/install/update/new/phpbb/template/twig/node/includephp.php @@ -0,0 +1,91 @@ + +* Sections (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\node; + +class includephp extends \Twig_Node +{ + /** @var \Twig_Environment */ + protected $environment; + + public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null) + { + $this->environment = $environment; + + parent::__construct(array('expr' => $expr), array('ignore_missing' => (Boolean) $ignoreMissing), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ + public function compile(\Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + $config = $this->environment->get_phpbb_config(); + + if (!$config['tpl_allow_php']) + { + $compiler + ->write("// INCLUDEPHP Disabled\n") + ; + + return; + } + + if ($this->getAttribute('ignore_missing')) + { + $compiler + ->write("try {\n") + ->indent() + ; + } + + $compiler + ->write("\$location = ") + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ->write("if (phpbb_is_absolute(\$location)) {\n") + ->indent() + // Absolute path specified + ->write("require(\$location);\n") + ->outdent() + ->write("} else if (file_exists(\$this->env->get_phpbb_root_path() . \$location)) {\n") + ->indent() + // PHP file relative to phpbb_root_path + ->write("require(\$this->env->get_phpbb_root_path() . \$location);\n") + ->outdent() + ->write("} else {\n") + ->indent() + // Local path (behaves like INCLUDE) + ->write("require(\$this->env->getLoader()->getCacheKey(\$location));\n") + ->outdent() + ->write("}\n") + ; + + if ($this->getAttribute('ignore_missing')) + { + $compiler + ->outdent() + ->write("} catch (\Twig_Error_Loader \$e) {\n") + ->indent() + ->write("// ignore missing template\n") + ->outdent() + ->write("}\n\n") + ; + } + } +} diff --git a/install/update/new/phpbb/template/twig/tokenparser/defineparser.php b/install/update/new/phpbb/template/twig/tokenparser/defineparser.php new file mode 100644 index 0000000..6285091 --- /dev/null +++ b/install/update/new/phpbb/template/twig/tokenparser/defineparser.php @@ -0,0 +1,76 @@ + +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class defineparser extends \Twig_TokenParser +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_Node A Twig_Node instance + * @throws \Twig_Error_Syntax + * @throws \phpbb\template\twig\node\definenode + */ + public function parse(\Twig_Token $token) + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + $name = $this->parser->getExpressionParser()->parseExpression(); + + $capture = false; + if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) + { + $stream->next(); + $value = $this->parser->getExpressionParser()->parseExpression(); + + if ($value instanceof \Twig_Node_Expression_Name) + { + // This would happen if someone improperly formed their DEFINE syntax + // e.g. + throw new \Twig_Error_Syntax('Invalid DEFINE', $token->getLine(), $this->parser->getStream()->getSourceContext()->getPath()); + } + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + } + else + { + $capture = true; + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + } + + return new \phpbb\template\twig\node\definenode($capture, $name, $value, $lineno, $this->getTag()); + } + + public function decideBlockEnd(\Twig_Token $token) + { + return $token->test('ENDDEFINE'); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'DEFINE'; + } +} diff --git a/install/update/new/phpbb/template/twig/tokenparser/event.php b/install/update/new/phpbb/template/twig/tokenparser/event.php new file mode 100644 index 0000000..92ecff4 --- /dev/null +++ b/install/update/new/phpbb/template/twig/tokenparser/event.php @@ -0,0 +1,57 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class event extends \Twig_TokenParser +{ + /** @var \phpbb\template\twig\environment */ + protected $environment; + + /** + * Constructor + * + * @param \phpbb\template\twig\environment $environment + */ + public function __construct(\phpbb\template\twig\environment $environment) + { + $this->environment = $environment; + } + + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_Node A Twig_Node instance + */ + public function parse(\Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $stream = $this->parser->getStream(); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new \phpbb\template\twig\node\event($expr, $this->environment, $token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'EVENT'; + } +} diff --git a/install/update/new/phpbb/template/twig/tokenparser/includecss.php b/install/update/new/phpbb/template/twig/tokenparser/includecss.php new file mode 100644 index 0000000..f7e55a4 --- /dev/null +++ b/install/update/new/phpbb/template/twig/tokenparser/includecss.php @@ -0,0 +1,44 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class includecss extends \Twig_TokenParser +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_Node A Twig_Node instance + */ + public function parse(\Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $stream = $this->parser->getStream(); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new \phpbb\template\twig\node\includecss($expr, $token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDECSS'; + } +} diff --git a/install/update/new/phpbb/template/twig/tokenparser/includejs.php b/install/update/new/phpbb/template/twig/tokenparser/includejs.php new file mode 100644 index 0000000..598ea0a --- /dev/null +++ b/install/update/new/phpbb/template/twig/tokenparser/includejs.php @@ -0,0 +1,44 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class includejs extends \Twig_TokenParser +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_Node A Twig_Node instance + */ + public function parse(\Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $stream = $this->parser->getStream(); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new \phpbb\template\twig\node\includejs($expr, $token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDEJS'; + } +} diff --git a/install/update/new/phpbb/template/twig/tokenparser/includeparser.php b/install/update/new/phpbb/template/twig/tokenparser/includeparser.php new file mode 100644 index 0000000..2fba4ac --- /dev/null +++ b/install/update/new/phpbb/template/twig/tokenparser/includeparser.php @@ -0,0 +1,44 @@ + +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class includeparser extends \Twig_TokenParser_Include +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_Node A Twig_Node instance + */ + public function parse(\Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + list($variables, $only, $ignoreMissing) = $this->parseArguments(); + + return new \phpbb\template\twig\node\includenode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDE'; + } +} diff --git a/install/update/new/phpbb/template/twig/tokenparser/includephp.php b/install/update/new/phpbb/template/twig/tokenparser/includephp.php new file mode 100644 index 0000000..2fdf396 --- /dev/null +++ b/install/update/new/phpbb/template/twig/tokenparser/includephp.php @@ -0,0 +1,68 @@ + +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class includephp extends \Twig_TokenParser +{ + /** @var \phpbb\template\twig\environment */ + protected $environment; + + /** + * Constructor + * + * @param \phpbb\template\twig\environment $environment + */ + public function __construct(\phpbb\template\twig\environment $environment) + { + $this->environment = $environment; + } + + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_Node A Twig_Node instance + */ + public function parse(\Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $stream = $this->parser->getStream(); + + $ignoreMissing = false; + if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) + { + $stream->next(); + $stream->expect(\Twig_Token::NAME_TYPE, 'missing'); + + $ignoreMissing = true; + } + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new \phpbb\template\twig\node\includephp($expr, $this->environment, $token->getLine(), $ignoreMissing, $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDEPHP'; + } +} diff --git a/install/update/new/phpbb/template/twig/tokenparser/php.php b/install/update/new/phpbb/template/twig/tokenparser/php.php new file mode 100644 index 0000000..3007912 --- /dev/null +++ b/install/update/new/phpbb/template/twig/tokenparser/php.php @@ -0,0 +1,65 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class php extends \Twig_TokenParser +{ + /** @var \phpbb\template\twig\environment */ + protected $environment; + + /** + * Constructor + * + * @param \phpbb\template\twig\environment $environment + */ + public function __construct(\phpbb\template\twig\environment $environment) + { + $this->environment = $environment; + } + + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_Node A Twig_Node instance + */ + public function parse(\Twig_Token $token) + { + $stream = $this->parser->getStream(); + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + $body = $this->parser->subparse(array($this, 'decideEnd'), true); + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new \phpbb\template\twig\node\php($body, $this->environment, $token->getLine(), $this->getTag()); + } + + public function decideEnd(\Twig_Token $token) + { + return $token->test('ENDPHP'); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'PHP'; + } +} diff --git a/install/update/new/phpbb/textformatter/acp_utils_interface.php b/install/update/new/phpbb/textformatter/acp_utils_interface.php new file mode 100644 index 0000000..cdee56f --- /dev/null +++ b/install/update/new/phpbb/textformatter/acp_utils_interface.php @@ -0,0 +1,54 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter; + +interface acp_utils_interface +{ + /** + * There is an issue with the definition + */ + const BBCODE_STATUS_INVALID_DEFINITION = 'invalid_definition'; + + /** + * There is an issue with the template + */ + const BBCODE_STATUS_INVALID_TEMPLATE = 'invalid_template'; + + /** + * The BBCode is valid and can be safely used by anyone + */ + const BBCODE_STATUS_SAFE = 'safe'; + + /** + * The BBCode is valid but may be unsafe to use + */ + const BBCODE_STATUS_UNSAFE = 'unsafe'; + + /** + * Analyse given BBCode definition for issues and safeness + * + * Required elements in the return array: + * - status: see BBCODE_STATUS_* constants + * + * Optional elements in the return array: + * - name: Name of the BBCode based on the definition. Required if status is "safe". + * - error_text: Textual description of the issue in plain text or as a L_* string. + * - error_html: Visual description of the issue in HTML. + * + * @param string $definition BBCode definition, e.g. [b]{TEXT}[/b] + * @param string $template BBCode template, e.g. {TEXT} + * @return array + */ + public function analyse_bbcode(string $definition, string $template): array; +} diff --git a/install/update/new/phpbb/textformatter/s9e/acp_utils.php b/install/update/new/phpbb/textformatter/s9e/acp_utils.php new file mode 100644 index 0000000..c4a6680 --- /dev/null +++ b/install/update/new/phpbb/textformatter/s9e/acp_utils.php @@ -0,0 +1,67 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +use phpbb\textformatter\acp_utils_interface; +use s9e\TextFormatter\Configurator\Exceptions\UnsafeTemplateException; + +class acp_utils implements acp_utils_interface +{ + /** + * @var factory $factory + */ + protected $factory; + + /** + * @param factory $factory + */ + public function __construct(factory $factory) + { + $this->factory = $factory; + } + + /** + * {@inheritdoc} + */ + public function analyse_bbcode(string $definition, string $template): array + { + $configurator = $this->factory->get_configurator(); + $return = ['status' => self::BBCODE_STATUS_SAFE]; + + // Capture and normalize the BBCode name manually because there's no easy way to retrieve + // it in TextFormatter <= 2.x + if (preg_match('(\\[([-\\w]++))', $definition, $m)) + { + $return['name'] = strtoupper($m[1]); + } + + try + { + $configurator->BBCodes->addCustom($definition, $template); + } + catch (UnsafeTemplateException $e) + { + $return['status'] = self::BBCODE_STATUS_UNSAFE; + $return['error_text'] = $e->getMessage(); + $return['error_html'] = $e->highlightNode(''); + } + catch (\Exception $e) + { + $return['status'] = (preg_match('(xml|xpath|xsl)i', $e->getMessage())) ? self::BBCODE_STATUS_INVALID_TEMPLATE : self::BBCODE_STATUS_INVALID_DEFINITION; + $return['error_text'] = $e->getMessage(); + } + + return $return; + } +} diff --git a/install/update/new/phpbb/textformatter/s9e/bbcode_merger.php b/install/update/new/phpbb/textformatter/s9e/bbcode_merger.php new file mode 100644 index 0000000..d1bedb0 --- /dev/null +++ b/install/update/new/phpbb/textformatter/s9e/bbcode_merger.php @@ -0,0 +1,199 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +use phpbb\textformatter\s9e\factory; +use s9e\TextFormatter\Configurator\Helpers\TemplateLoader; +use s9e\TextFormatter\Configurator\Items\UnsafeTemplate; + +class bbcode_merger +{ + /** + * @var \s9e\TextFormatter\Configurator $configurator Configurator instance used to inspect BBCodes + */ + protected $configurator; + + /** + * @param \phpbb\textformatter\s9e\factory $factory + */ + public function __construct(factory $factory) + { + $this->configurator = $factory->get_configurator(); + } + + /** + * Merge two BBCode definitions + * + * All of the arrays contain a "usage" element and a "template" element + * + * @throws InvalidArgumentException if a definition cannot be interpreted + * @throws RuntimeException if something unexpected occurs + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + public function merge_bbcodes(array $without, array $with) + { + $without = $this->create_bbcode($without); + $with = $this->create_bbcode($with); + + // Select the appropriate strategy for merging this BBCode + if (!$this->is_optional_bbcode($without, $with) && $this->is_content_bbcode($without, $with)) + { + $merged = $this->merge_content_bbcode($without, $with); + } + else + { + $merged = $this->merge_optional_bbcode($without, $with); + } + + $merged['template'] = $this->normalize_template($merged['template']); + + return $merged; + } + + /** + * Create a custom BBCode for inspection + * + * @param array $definition Original BBCode definition + * @return array Updated definition containing a BBCode object and a Tag + */ + protected function create_bbcode(array $definition) + { + $bbcode = $this->configurator->BBCodes->addCustom( + $definition['usage'], + new UnsafeTemplate($definition['template']) + ); + + $definition['bbcode'] = $bbcode; + $definition['tag'] = $this->configurator->tags[$bbcode->tagName]; + + return $definition; + } + + /** + * Indent given template for readability + * + * @param string $template + * @return string + */ + protected function indent_template($template) + { + $dom = TemplateLoader::load($template); + $dom->formatOutput = true; + $template = TemplateLoader::save($dom); + + // Remove the first level of indentation if the template starts with whitespace + if (preg_match('(^\\n +)', $template, $m)) + { + $template = str_replace($m[0], "\n", $template); + } + + return trim($template); + } + + /** + * Test whether the two definitions form a "content"-style BBCode + * + * Such BBCodes include the [url] BBCode, which uses its text content as + * attribute if none is provided + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return bool + */ + protected function is_content_bbcode(array $without, array $with) + { + // Test whether we find the same non-TEXT token between "]" and "[" in the usage + // as between ">" and "<" in the template + return (preg_match('(\\]\\s*(\\{(?!TEXT)[^}]+\\})\\s*\\[)', $without['usage'], $m) + && preg_match('(>[^<]*?' . preg_quote($m[1]) . '[^>]*?<)s', $without['template'])); + } + + /** + * Test whether the two definitions form BBCode with an optional attribute + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return bool + */ + protected function is_optional_bbcode(array $without, array $with) + { + // Remove the default attribute from the definition + $with['usage'] = preg_replace('(=[^\\]]++)', '', $with['usage']); + + // Test whether both definitions are the same, regardless of case + return strcasecmp($without['usage'], $with['usage']) === 0; + } + + /** + * Merge the two BBCode definitions of a "content"-style BBCode + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + protected function merge_content_bbcode(array $without, array $with) + { + // Convert [x={X}] into [x={X;useContent}] + $usage = preg_replace('(\\})', ';useContent}', $with['usage'], 1); + + // Use the template from the definition that uses an attribute + $template = $with['tag']->template; + + return ['usage' => $usage, 'template' => $template]; + } + + /** + * Merge the two BBCode definitions of a BBCode with an optional argument + * + * Such BBCodes include the [quote] BBCode, which takes an optional argument + * but otherwise does not behave differently + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + protected function merge_optional_bbcode(array $without, array $with) + { + // Convert [X={X}] into [X={X?}] + $usage = preg_replace('(\\})', '?}', $with['usage'], 1); + + // Build a template for both versions + $template = '' . $with['tag']->template . '' . $without['tag']->template . ''; + + return ['usage' => $usage, 'template' => $template]; + } + + /** + * Normalize a template + * + * @param string $template + * @return string + */ + protected function normalize_template($template) + { + // Normalize the template to simplify it + $template = $this->configurator->templateNormalizer->normalizeTemplate($template); + + // Convert xsl:value-of elements back to {L_} tokens where applicable + $template = preg_replace('()', '{$1}', $template); + + // Beautify the template + $template = $this->indent_template($template); + + return $template; + } +} diff --git a/install/update/new/phpbb/textformatter/s9e/factory.php b/install/update/new/phpbb/textformatter/s9e/factory.php new file mode 100644 index 0000000..f82c7b0 --- /dev/null +++ b/install/update/new/phpbb/textformatter/s9e/factory.php @@ -0,0 +1,678 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +use s9e\TextFormatter\Configurator; +use s9e\TextFormatter\Configurator\Items\AttributeFilters\RegexpFilter; +use s9e\TextFormatter\Configurator\Items\UnsafeTemplate; + +/** +* Creates s9e\TextFormatter objects +*/ +class factory implements \phpbb\textformatter\cache_interface +{ + /** + * @var \phpbb\textformatter\s9e\link_helper + */ + protected $link_helper; + + /** + * @var \phpbb\cache\driver\driver_interface + */ + protected $cache; + + /** + * @var string Path to the cache dir + */ + protected $cache_dir; + + /** + * @var string Cache key used for the parser + */ + protected $cache_key_parser; + + /** + * @var string Cache key used for the renderer + */ + protected $cache_key_renderer; + + /** + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var array Custom tokens used in bbcode.html and their corresponding token from the definition + */ + protected $custom_tokens = array( + 'email' => array('{DESCRIPTION}' => '{TEXT}'), + 'flash' => array('{WIDTH}' => '{NUMBER1}', '{HEIGHT}' => '{NUMBER2}'), + 'img' => array('{URL}' => '{IMAGEURL}'), + 'list' => array('{LIST_TYPE}' => '{HASHMAP}'), + 'quote' => array('{USERNAME}' => '{TEXT1}'), + 'size' => array('{SIZE}' => '{FONTSIZE}'), + 'url' => array('{DESCRIPTION}' => '{TEXT}'), + ); + + /** + * @var \phpbb\textformatter\data_access + */ + protected $data_access; + + /** + * @var array Default BBCode definitions + */ + protected $default_definitions = array( + 'attachment' => '[ATTACHMENT index={NUMBER} filename={TEXT;useContent}]', + 'b' => '[B]{TEXT}[/B]', + 'code' => '[CODE lang={IDENTIFIER;optional}]{TEXT}[/CODE]', + 'color' => '[COLOR={COLOR}]{TEXT}[/COLOR]', + 'email' => '[EMAIL={EMAIL;useContent} subject={TEXT1;optional;postFilter=rawurlencode} body={TEXT2;optional;postFilter=rawurlencode}]{TEXT}[/EMAIL]', + 'flash' => '[FLASH={NUMBER1},{NUMBER2} width={NUMBER1;postFilter=#flashwidth} height={NUMBER2;postFilter=#flashheight} url={URL;useContent} /]', + 'i' => '[I]{TEXT}[/I]', + 'img' => '[IMG src={IMAGEURL;useContent}]', + 'list' => '[LIST type={HASHMAP=1:decimal,a:lower-alpha,A:upper-alpha,i:lower-roman,I:upper-roman;optional;postFilter=#simpletext} #createChild=LI]{TEXT}[/LIST]', + 'li' => '[* $tagName=LI]{TEXT}[/*]', + 'quote' => + "[QUOTE + author={TEXT1;optional} + post_id={UINT;optional} + post_url={URL;optional;postFilter=#false} + msg_id={UINT;optional} + msg_url={URL;optional;postFilter=#false} + profile_url={URL;optional;postFilter=#false} + time={UINT;optional} + url={URL;optional} + user_id={UINT;optional} + author={PARSE=/^\\[url=(?'url'.*?)](?'author'.*)\\[\\/url]$/i} + author={PARSE=/^\\[url](?'author'(?'url'.*?))\\[\\/url]$/i} + author={PARSE=/(?'url'https?:\\/\\/[^[\\]]+)/i} + ]{TEXT2}[/QUOTE]", + 'size' => '[SIZE={FONTSIZE}]{TEXT}[/SIZE]', + 'u' => '[U]{TEXT}[/U]', + 'url' => '[URL={URL;useContent} $forceLookahead=true]{TEXT}[/URL]', + ); + + /** + * @var array Default templates, taken from bbcode::bbcode_tpl() + */ + protected $default_templates = array( + 'b' => '', + 'i' => '', + 'u' => '', + 'img' => '{L_IMAGE}', + 'size' => 'font-size: %; line-height: normal', + 'color' => '', + 'email' => ' + + mailto: + + + ? + subject= + &body= + + + + ', + ); + + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \phpbb\log\log_interface + */ + protected $log; + + /** + * Constructor + * + * @param \phpbb\textformatter\data_access $data_access + * @param \phpbb\cache\driver\driver_interface $cache + * @param \phpbb\event\dispatcher_interface $dispatcher + * @param \phpbb\config\config $config + * @param \phpbb\textformatter\s9e\link_helper $link_helper + * @param \phpbb\log\log_interface $log + * @param string $cache_dir Path to the cache dir + * @param string $cache_key_parser Cache key used for the parser + * @param string $cache_key_renderer Cache key used for the renderer + */ + public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\link_helper $link_helper, \phpbb\log\log_interface $log, $cache_dir, $cache_key_parser, $cache_key_renderer) + { + $this->link_helper = $link_helper; + $this->cache = $cache; + $this->cache_dir = $cache_dir; + $this->cache_key_parser = $cache_key_parser; + $this->cache_key_renderer = $cache_key_renderer; + $this->config = $config; + $this->data_access = $data_access; + $this->dispatcher = $dispatcher; + $this->log = $log; + } + + /** + * {@inheritdoc} + */ + public function invalidate() + { + $this->regenerate(); + } + + /** + * {@inheritdoc} + * + * Will remove old renderers from the cache dir but won't touch the current renderer + */ + public function tidy() + { + // Get the name of current renderer + $renderer_data = $this->cache->get($this->cache_key_renderer); + $renderer_file = ($renderer_data) ? $renderer_data['class'] . '.php' : null; + + foreach (glob($this->cache_dir . 's9e_*') as $filename) + { + // Only remove the file if it's not the current renderer + if (!$renderer_file || substr($filename, -strlen($renderer_file)) !== $renderer_file) + { + unlink($filename); + } + } + } + + /** + * Generate and return a new configured instance of s9e\TextFormatter\Configurator + * + * @return Configurator + */ + public function get_configurator() + { + // Create a new Configurator + $configurator = new Configurator; + + /** + * Modify the s9e\TextFormatter configurator before the default settings are set + * + * @event core.text_formatter_s9e_configure_before + * @var \s9e\TextFormatter\Configurator configurator Configurator instance + * @since 3.2.0-a1 + */ + $vars = array('configurator'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_before', compact($vars))); + + // Reset the list of allowed schemes + foreach ($configurator->urlConfig->getAllowedSchemes() as $scheme) + { + $configurator->urlConfig->disallowScheme($scheme); + } + foreach (explode(',', $this->config['allowed_schemes_links']) as $scheme) + { + $configurator->urlConfig->allowScheme(trim($scheme)); + } + + // Convert newlines to br elements by default + $configurator->rootRules->enableAutoLineBreaks(); + + // Don't automatically ignore text in places where text is not allowed + $configurator->rulesGenerator->remove('IgnoreTextIfDisallowed'); + + // Don't remove comments and instead convert them to xsl:comment elements + $configurator->templateNormalizer->remove('RemoveComments'); + $configurator->templateNormalizer->add('TransposeComments'); + + // Set the rendering engine and configure it to save to the cache dir + $configurator->rendering->engine = 'PHP'; + $configurator->rendering->engine->cacheDir = $this->cache_dir; + $configurator->rendering->engine->defaultClassPrefix = 's9e_renderer_'; + $configurator->rendering->engine->enableQuickRenderer = true; + + // Create custom filters for BBCode tokens that are supported in phpBB but not in + // s9e\TextFormatter + $filter = new RegexpFilter('#^' . get_preg_expression('relative_url') . '$#Du'); + $configurator->attributeFilters->add('#local_url', $filter); + $configurator->attributeFilters->add('#relative_url', $filter); + + // INTTEXT regexp from acp_bbcodes + $filter = new RegexpFilter('!^([\p{L}\p{N}\-+,_. ]+)$!Du'); + $configurator->attributeFilters->add('#inttext', $filter); + + // Create custom filters for Flash restrictions, which use the same values as the image + // restrictions but have their own error message + $configurator->attributeFilters + ->add('#flashheight', __NAMESPACE__ . '\\parser::filter_flash_height') + ->addParameterByName('max_img_height') + ->addParameterByName('logger'); + + $configurator->attributeFilters + ->add('#flashwidth', __NAMESPACE__ . '\\parser::filter_flash_width') + ->addParameterByName('max_img_width') + ->addParameterByName('logger'); + + // Create a custom filter for phpBB's per-mode font size limits + $configurator->attributeFilters + ->add('#fontsize', __NAMESPACE__ . '\\parser::filter_font_size') + ->addParameterByName('max_font_size') + ->addParameterByName('logger') + ->markAsSafeInCSS(); + + // Create a custom filter for image URLs + $configurator->attributeFilters + ->add('#imageurl', __NAMESPACE__ . '\\parser::filter_img_url') + ->addParameterByName('urlConfig') + ->addParameterByName('logger') + ->addParameterByName('max_img_height') + ->addParameterByName('max_img_width') + ->markAsSafeAsURL() + ->setJS('UrlFilter.filter'); + + // Add default BBCodes + foreach ($this->get_default_bbcodes($configurator) as $bbcode) + { + $this->add_bbcode($configurator, $bbcode['usage'], $bbcode['template']); + } + if (isset($configurator->tags['QUOTE'])) + { + // Remove the nesting limit and let other services remove quotes at parsing time + $configurator->tags['QUOTE']->nestingLimit = PHP_INT_MAX; + } + + // Modify the template to disable images/flash depending on user's settings + foreach (array('FLASH', 'IMG') as $name) + { + $tag = $configurator->tags[$name]; + $tag->template = '' . $tag->template . ''; + } + + // Load custom BBCodes + foreach ($this->data_access->get_bbcodes() as $row) + { + // Insert the board's URL before {LOCAL_URL} tokens + $tpl = preg_replace_callback( + '#\\{LOCAL_URL\\d*\\}#', + function ($m) + { + return generate_board_url() . '/' . $m[0]; + }, + $row['bbcode_tpl'] + ); + $this->add_bbcode($configurator, $row['bbcode_match'], $tpl); + } + + // Load smilies + foreach ($this->data_access->get_smilies() as $row) + { + $configurator->Emoticons->set( + $row['code'], + '{.}' + ); + } + + if (isset($configurator->Emoticons)) + { + // Force emoticons to be rendered as text if $S_VIEWSMILIES is not set + $configurator->Emoticons->notIfCondition = 'not($S_VIEWSMILIES)'; + + // Only parse emoticons at the beginning of the text or if they're preceded by any + // one of: a new line, a space, a dot, or a right square bracket + $configurator->Emoticons->notAfter = '[^\\n .\\]]'; + + // Ignore emoticons that are immediately followed by a "word" character + $configurator->Emoticons->notBefore = '\\w'; + } + + // Load the censored words + $censor = $this->data_access->get_censored_words(); + if (!empty($censor)) + { + // Use a namespaced tag to avoid collisions + $configurator->plugins->load('Censor', array('tagName' => 'censor:tag')); + foreach ($censor as $row) + { + $configurator->Censor->add($row['word'], $row['replacement']); + } + } + + // Load the magic links plugins. We do that after BBCodes so that they use the same tags + $this->configure_autolink($configurator); + + // Register some vars with a default value. Those should be set at runtime by whatever calls + // the parser + $configurator->registeredVars['max_font_size'] = 0; + $configurator->registeredVars['max_img_height'] = 0; + $configurator->registeredVars['max_img_width'] = 0; + + // Load the Emoji plugin and modify its tag's template to obey viewsmilies + $tag = $configurator->Emoji->getTag(); + $tag->template = ' + + {.} + + + {.} + + '; + $tag->template = '' . str_replace('class="emoji"', 'class="emoji smilies"', $tag->template) . ''; + + /** + * Modify the s9e\TextFormatter configurator after the default settings are set + * + * @event core.text_formatter_s9e_configure_after + * @var \s9e\TextFormatter\Configurator configurator Configurator instance + * @since 3.2.0-a1 + */ + $vars = array('configurator'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_after', compact($vars))); + + return $configurator; + } + + /** + * Regenerate and cache a new parser and renderer + * + * @return array Associative array with at least two elements: "parser" and "renderer" + */ + public function regenerate() + { + $configurator = $this->get_configurator(); + + // Get the censor helper and remove the Censor plugin if applicable + if (isset($configurator->Censor)) + { + $censor = $configurator->Censor->getHelper(); + unset($configurator->Censor); + unset($configurator->tags['censor:tag']); + } + + $objects = $configurator->finalize(); + + /** + * Access the objects returned by finalize() before they are saved to cache + * + * @event core.text_formatter_s9e_configure_finalize + * @var array objects Array containing a "parser" object, a "renderer" object and optionally a "js" string + * @since 3.2.2-RC1 + */ + $vars = array('objects'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_finalize', compact($vars))); + + $parser = $objects['parser']; + $renderer = $objects['renderer']; + + // Cache the parser as-is + $this->cache->put($this->cache_key_parser, $parser); + + // We need to cache the name of the renderer's generated class + $renderer_data = array('class' => get_class($renderer)); + if (isset($censor)) + { + $renderer_data['censor'] = $censor; + } + $this->cache->put($this->cache_key_renderer, $renderer_data); + + return array('parser' => $parser, 'renderer' => $renderer); + } + + /** + * Add a BBCode to given configurator + * + * @param Configurator $configurator + * @param string $usage + * @param string $template + * @return void + */ + protected function add_bbcode(Configurator $configurator, $usage, $template) + { + try + { + $configurator->BBCodes->addCustom($usage, new UnsafeTemplate($template)); + } + catch (\Exception $e) + { + $this->log->add('critical', null, null, 'LOG_BBCODE_CONFIGURATION_ERROR', false, [$usage, $e->getMessage()]); + } + } + + /** + * Configure the Autolink / Autoemail plugins used to linkify text + * + * @param \s9e\TextFormatter\Configurator $configurator + * @return void + */ + protected function configure_autolink(Configurator $configurator) + { + $configurator->plugins->load('Autoemail'); + $configurator->plugins->load('Autolink', array('matchWww' => true)); + + // Add a tag filter that creates a tag that stores and replace the + // content of a link created by the Autolink plugin + $configurator->Autolink->getTag()->filterChain + ->add(array($this->link_helper, 'generate_link_text_tag')) + ->resetParameters() + ->addParameterByName('tag') + ->addParameterByName('parser'); + + // Create a tag that will be used to display the truncated text by + // replacing the original content with the content of the @text attribute + $tag = $configurator->tags->add('LINK_TEXT'); + $tag->attributes->add('text'); + $tag->template = ''; + + $tag->filterChain + ->add(array($this->link_helper, 'truncate_local_url')) + ->resetParameters() + ->addParameterByName('tag') + ->addParameterByValue(generate_board_url() . '/'); + $tag->filterChain + ->add(array($this->link_helper, 'truncate_text')) + ->resetParameters() + ->addParameterByName('tag'); + $tag->filterChain + ->add(array($this->link_helper, 'cleanup_tag')) + ->resetParameters() + ->addParameterByName('tag') + ->addParameterByName('parser'); + } + + /** + * Escape a literal to be used in an HTML attribute in an XSL template + * + * Escapes "HTML special chars" for obvious reasons and curly braces to avoid them + * being interpreted as an attribute value template + * + * @param string $value Original string + * @return string Escaped string + */ + protected function escape_html_attribute($value) + { + return htmlspecialchars(strtr($value, ['{' => '{{', '}' => '}}']), ENT_COMPAT | ENT_XML1, 'UTF-8'); + } + + /** + * Return the default BBCodes configuration + * + * @return array 2D array. Each element has a 'usage' key, a 'template' key, and an optional 'options' key + */ + protected function get_default_bbcodes($configurator) + { + // For each BBCode, build an associative array matching style_ids to their template + $templates = array(); + foreach ($this->data_access->get_styles_templates() as $style_id => $data) + { + foreach ($this->extract_templates($data['template']) as $bbcode_name => $template) + { + $templates[$bbcode_name][$style_id] = $template; + } + + // Add default templates wherever missing, or for BBCodes that were not specified in + // this template's bitfield. For instance, prosilver has a custom template for b but its + // bitfield does not enable it so the default template is used instead + foreach ($this->default_templates as $bbcode_name => $template) + { + if (!isset($templates[$bbcode_name][$style_id]) || !in_array($bbcode_name, $data['bbcodes'], true)) + { + $templates[$bbcode_name][$style_id] = $template; + } + } + } + + // Replace custom tokens and normalize templates + foreach ($templates as $bbcode_name => $style_templates) + { + foreach ($style_templates as $i => $template) + { + if (isset($this->custom_tokens[$bbcode_name])) + { + $template = strtr($template, $this->custom_tokens[$bbcode_name]); + } + + $templates[$bbcode_name][$i] = $configurator->templateNormalizer->normalizeTemplate($template); + } + } + + $bbcodes = array(); + foreach ($this->default_definitions as $bbcode_name => $usage) + { + $bbcodes[$bbcode_name] = array( + 'usage' => $usage, + 'template' => $this->merge_templates($templates[$bbcode_name]), + ); + } + + return $bbcodes; + } + + /** + * Extract and recompose individual BBCode templates from a style's template file + * + * @param string $template Style template (bbcode.html) + * @return array Associative array matching BBCode names to their template + */ + protected function extract_templates($template) + { + // Capture the template fragments + // Allow either phpBB template or the Twig syntax + preg_match_all('#(.*?)#s', $template, $matches, PREG_SET_ORDER) ?: + preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $template, $matches, PREG_SET_ORDER); + + $fragments = array(); + foreach ($matches as $match) + { + // Normalize the whitespace + $fragment = preg_replace('#>\\n\\t*<#', '><', trim($match[2])); + + $fragments[$match[1]] = $fragment; + } + + // Automatically recompose templates split between *_open and *_close + foreach ($fragments as $fragment_name => $fragment) + { + if (preg_match('#^(\\w+)_close$#', $fragment_name, $match)) + { + $bbcode_name = $match[1]; + + if (isset($fragments[$bbcode_name . '_open'])) + { + $templates[$bbcode_name] = $fragments[$bbcode_name . '_open'] . '' . $fragment; + } + } + } + + // Manually recompose and overwrite irregular templates + $templates['list'] = + ' + + ' . $fragments['ulist_open_default'] . '' . $fragments['ulist_close'] . ' + + + ' . $fragments['olist_open'] . '' . $fragments['olist_close'] . ' + + + ' . $fragments['ulist_open'] . '' . $fragments['ulist_close'] . ' + + '; + + $templates['li'] = $fragments['listitem'] . '' . $fragments['listitem_close']; + + // Replace the regular quote template with the extended quote template if available + if (isset($fragments['quote_extended'])) + { + $templates['quote'] = $fragments['quote_extended']; + } + + // The [attachment] BBCode uses the inline_attachment template to output a comment that + // is post-processed by parse_attachments() + $templates['attachment'] = $fragments['inline_attachment_open'] . ' ia ia ' . $fragments['inline_attachment_close']; + + // Add fragments as templates + foreach ($fragments as $fragment_name => $fragment) + { + if (preg_match('#^\\w+$#', $fragment_name)) + { + $templates[$fragment_name] = $fragment; + } + } + + // Keep only templates that are named after an existing BBCode + $templates = array_intersect_key($templates, $this->default_definitions); + + return $templates; + } + + /** + * Merge the templates from any number of styles into one BBCode template + * + * When multiple templates are available for the same BBCode (because of multiple styles) we + * merge them into a single template that uses an xsl:choose construct that determines which + * style to use at rendering time. + * + * @param array $style_templates Associative array matching style_ids to their template + * @return string + */ + protected function merge_templates(array $style_templates) + { + // Return the template as-is if there's only one style or all styles share the same template + if (count(array_unique($style_templates)) === 1) + { + return end($style_templates); + } + + // Group identical templates together + $grouped_templates = array(); + foreach ($style_templates as $style_id => $style_template) + { + $grouped_templates[$style_template][] = '$STYLE_ID=' . $style_id; + } + + // Sort templates by frequency descending + $templates_cnt = array_map('sizeof', $grouped_templates); + array_multisort($grouped_templates, $templates_cnt); + + // Remove the most frequent template from the list; It becomes the default + reset($grouped_templates); + $default_template = key($grouped_templates); + unset($grouped_templates[$default_template]); + + // Build an xsl:choose switch + $template = ''; + foreach ($grouped_templates as $style_template => $exprs) + { + $template .= '' . $style_template . ''; + } + $template .= '' . $default_template . ''; + + return $template; + } +} diff --git a/install/update/new/phpbb/textformatter/s9e/link_helper.php b/install/update/new/phpbb/textformatter/s9e/link_helper.php new file mode 100644 index 0000000..1cd5dd2 --- /dev/null +++ b/install/update/new/phpbb/textformatter/s9e/link_helper.php @@ -0,0 +1,115 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +class link_helper +{ + /** + * Clean up and invalidate a LINK_TEXT tag if applicable + * + * Will invalidate the tag if its replacement text is the same as the original + * text and would have no visible effect + * + * @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag + * @param \s9e\TextFormatter\Parser $parser Parser + * @return void + */ + public function cleanup_tag(\s9e\TextFormatter\Parser\Tag $tag, \s9e\TextFormatter\Parser $parser) + { + // Invalidate if the content of the tag matches the text attribute + $text = substr($parser->getText(), $tag->getPos(), $tag->getLen()); + if ($text === $tag->getAttribute('text')) + { + $tag->invalidate(); + } + } + + /** + * Create a LINK_TEXT tag inside of a link + * + * Meant to only apply to linkified URLs and [url] BBCodes without a parameter + * + * @param \s9e\TextFormatter\Parser\Tag $tag URL tag (start tag) + * @param \s9e\TextFormatter\Parser $parser Parser + * @return void + */ + public function generate_link_text_tag(\s9e\TextFormatter\Parser\Tag $tag, \s9e\TextFormatter\Parser $parser) + { + // Only create a LINK_TEXT tag if the start tag is paired with an end + // tag, which is the case with tags from the Autolink plugins and with + // the [url] BBCode when its content is used for the URL + if (!$tag->getEndTag() || !$this->should_shorten($tag, $parser->getText())) + { + return; + } + + // Capture the text between the start tag and its end tag + $start = $tag->getPos() + $tag->getLen(); + $end = $tag->getEndTag()->getPos(); + $length = $end - $start; + $text = substr($parser->getText(), $start, $length); + + // Create a tag that consumes the link's text and make it depends on this tag + $link_text_tag = $parser->addSelfClosingTag('LINK_TEXT', $start, $length, 10); + $link_text_tag->setAttribute('text', $text); + $tag->cascadeInvalidationTo($link_text_tag); + } + + /** + * Test whether we should shorten this tag's text + * + * Will test whether the tag either does not use any markup or uses a single + * [url] BBCode + * + * @param \s9e\TextFormatter\Parser\Tag $tag URL tag + * @param string $text Original text + * @return bool + */ + protected function should_shorten(\s9e\TextFormatter\Parser\Tag $tag, $text) + { + return ($tag->getLen() === 0 || strtolower(substr($text, $tag->getPos(), $tag->getLen())) === '[url]'); + } + + /** + * Remove the board's root URL from a the start of a string + * + * @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag + * @param string $board_url Forum's root URL (with trailing slash) + * @return void + */ + public function truncate_local_url(\s9e\TextFormatter\Parser\Tag $tag, $board_url) + { + $text = $tag->getAttribute('text'); + if (stripos($text, $board_url) === 0 && strlen($text) > strlen($board_url)) + { + $tag->setAttribute('text', substr($text, strlen($board_url))); + } + } + + /** + * Truncate the replacement text set in a LINK_TEXT tag + * + * @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag + * @return void + */ + public function truncate_text(\s9e\TextFormatter\Parser\Tag $tag) + { + $text = $tag->getAttribute('text'); + if (utf8_strlen($text) > 55) + { + $text = utf8_substr($text, 0, 39) . ' ... ' . utf8_substr($text, -10); + $tag->setAttribute('text', $text); + } + } +} diff --git a/install/update/new/phpbb/textformatter/s9e/parser.php b/install/update/new/phpbb/textformatter/s9e/parser.php new file mode 100644 index 0000000..f7e4668 --- /dev/null +++ b/install/update/new/phpbb/textformatter/s9e/parser.php @@ -0,0 +1,417 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +use s9e\TextFormatter\Parser\AttributeFilters\UrlFilter; +use s9e\TextFormatter\Parser\Logger; +use s9e\TextFormatter\Parser\Tag; + +/** +* s9e\TextFormatter\Parser adapter +*/ +class parser implements \phpbb\textformatter\parser_interface +{ + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \s9e\TextFormatter\Parser + */ + protected $parser; + + /** + * Constructor + * + * @param \phpbb\cache\driver_interface $cache + * @param string $key Cache key + * @param factory $factory + * @param \phpbb\event\dispatcher_interface $dispatcher + */ + public function __construct(\phpbb\cache\driver\driver_interface $cache, $key, factory $factory, \phpbb\event\dispatcher_interface $dispatcher) + { + $parser = $cache->get($key); + if (!$parser) + { + $objects = $factory->regenerate(); + $parser = $objects['parser']; + } + + $this->dispatcher = $dispatcher; + $this->parser = $parser; + + $parser = $this; + + /** + * Configure the parser service + * + * Can be used to: + * - toggle features or BBCodes + * - register variables or custom parsers in the s9e\TextFormatter parser + * - configure the s9e\TextFormatter parser's runtime settings + * + * @event core.text_formatter_s9e_parser_setup + * @var \phpbb\textformatter\s9e\parser parser This parser service + * @since 3.2.0-a1 + */ + $vars = array('parser'); + extract($dispatcher->trigger_event('core.text_formatter_s9e_parser_setup', compact($vars))); + } + + /** + * {@inheritdoc} + */ + public function parse($text) + { + $parser = $this; + + /** + * Modify a text before it is parsed + * + * @event core.text_formatter_s9e_parse_before + * @var \phpbb\textformatter\s9e\parser parser This parser service + * @var string text The original text + * @since 3.2.0-a1 + */ + $vars = array('parser', 'text'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_parse_before', compact($vars))); + + $xml = $this->parser->parse($text); + + /** + * Modify a parsed text in its XML form + * + * @event core.text_formatter_s9e_parse_after + * @var \phpbb\textformatter\s9e\parser parser This parser service + * @var string xml The parsed text, in XML + * @since 3.2.0-a1 + */ + $vars = array('parser', 'xml'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_parse_after', compact($vars))); + + return $xml; + } + + /** + * {@inheritdoc} + */ + public function disable_bbcode($name) + { + $this->parser->disableTag(strtoupper($name)); + } + + /** + * {@inheritdoc} + */ + public function disable_bbcodes() + { + $this->parser->disablePlugin('BBCodes'); + } + + /** + * {@inheritdoc} + */ + public function disable_censor() + { + $this->parser->disablePlugin('Censor'); + } + + /** + * {@inheritdoc} + */ + public function disable_magic_url() + { + $this->parser->disablePlugin('Autoemail'); + $this->parser->disablePlugin('Autolink'); + } + + /** + * {@inheritdoc} + */ + public function disable_smilies() + { + $this->parser->disablePlugin('Emoticons'); + $this->parser->disablePlugin('Emoji'); + } + + /** + * {@inheritdoc} + */ + public function enable_bbcode($name) + { + $this->parser->enableTag(strtoupper($name)); + } + + /** + * {@inheritdoc} + */ + public function enable_bbcodes() + { + $this->parser->enablePlugin('BBCodes'); + } + + /** + * {@inheritdoc} + */ + public function enable_censor() + { + $this->parser->enablePlugin('Censor'); + } + + /** + * {@inheritdoc} + */ + public function enable_magic_url() + { + $this->parser->enablePlugin('Autoemail'); + $this->parser->enablePlugin('Autolink'); + } + + /** + * {@inheritdoc} + */ + public function enable_smilies() + { + $this->parser->enablePlugin('Emoticons'); + $this->parser->enablePlugin('Emoji'); + } + + /** + * {@inheritdoc} + * + * This will convert the log entries found in s9e\TextFormatter's logger into phpBB error + * messages + */ + public function get_errors() + { + $errors = array(); + foreach ($this->parser->getLogger()->getLogs() as $entry) + { + list(, $msg, $context) = $entry; + + if ($msg === 'Tag limit exceeded') + { + if ($context['tagName'] === 'E') + { + $errors[] = array('TOO_MANY_SMILIES', $context['tagLimit']); + } + else if ($context['tagName'] === 'URL') + { + $errors[] = array('TOO_MANY_URLS', $context['tagLimit']); + } + } + else if ($msg === 'MAX_FONT_SIZE_EXCEEDED') + { + $errors[] = array($msg, $context['max_size']); + } + else if (preg_match('/^MAX_(?:FLASH|IMG)_(HEIGHT|WIDTH)_EXCEEDED$/D', $msg, $m)) + { + $errors[] = array($msg, $context['max_' . strtolower($m[1])]); + } + else if ($msg === 'Tag is disabled' && $this->is_a_bbcode($context['tag'])) + { + $name = strtolower($context['tag']->getName()); + $errors[] = array('UNAUTHORISED_BBCODE', '[' . $name . ']'); + } + else if ($msg === 'UNABLE_GET_IMAGE_SIZE') + { + $errors[] = array($msg); + } + } + + // Deduplicate error messages. array_unique() only works on strings so we have to serialize + if (!empty($errors)) + { + $errors = array_map('unserialize', array_unique(array_map('serialize', $errors))); + } + + return $errors; + } + + /** + * Return the instance of s9e\TextFormatter\Parser used by this object + * + * @return \s9e\TextFormatter\Parser + */ + public function get_parser() + { + return $this->parser; + } + + /** + * {@inheritdoc} + */ + public function set_var($name, $value) + { + if ($name === 'max_smilies') + { + $this->parser->setTagLimit('E', $value ?: PHP_INT_MAX); + } + else if ($name === 'max_urls') + { + $this->parser->setTagLimit('URL', $value ?: PHP_INT_MAX); + } + else + { + $this->parser->registeredVars[$name] = $value; + } + } + + /** + * {@inheritdoc} + */ + public function set_vars(array $vars) + { + foreach ($vars as $name => $value) + { + $this->set_var($name, $value); + } + } + + /** + * Filter a flash object's height + * + * @see bbcode_firstpass::bbcode_flash() + * + * @param string $height + * @param integer $max_height + * @param Logger $logger + * @return mixed Original value if valid, FALSE otherwise + */ + static public function filter_flash_height($height, $max_height, Logger $logger) + { + if ($max_height && $height > $max_height) + { + $logger->err('MAX_FLASH_HEIGHT_EXCEEDED', array('max_height' => $max_height)); + + return false; + } + + return $height; + } + + /** + * Filter a flash object's width + * + * @see bbcode_firstpass::bbcode_flash() + * + * @param string $width + * @param integer $max_width + * @param Logger $logger + * @return mixed Original value if valid, FALSE otherwise + */ + static public function filter_flash_width($width, $max_width, Logger $logger) + { + if ($max_width && $width > $max_width) + { + $logger->err('MAX_FLASH_WIDTH_EXCEEDED', array('max_width' => $max_width)); + + return false; + } + + return $width; + } + + /** + * Filter the value used in a [size] BBCode + * + * @see bbcode_firstpass::bbcode_size() + * + * @param string $size Original size + * @param integer $max_size Maximum allowed size + * @param Logger $logger + * @return mixed Original value if valid, FALSE otherwise + */ + static public function filter_font_size($size, $max_size, Logger $logger) + { + if ($max_size && $size > $max_size) + { + $logger->err('MAX_FONT_SIZE_EXCEEDED', array('max_size' => $max_size)); + + return false; + } + + if ($size < 1 || !is_numeric($size)) + { + return false; + } + + return $size; + } + + /** + * Filter an image's URL to enforce restrictions on its dimensions + * + * @see bbcode_firstpass::bbcode_img() + * + * @param string $url Original URL + * @param array $url_config Config used by the URL filter + * @param Logger $logger + * @param integer $max_height Maximum height allowed + * @param integer $max_width Maximum width allowed + * @return string|bool Original value if valid, FALSE otherwise + */ + static public function filter_img_url($url, array $url_config, Logger $logger, $max_height, $max_width) + { + // Validate the URL + $url = UrlFilter::filter($url, $url_config, $logger); + if ($url === false) + { + return false; + } + + if ($max_height || $max_width) + { + $imagesize = new \FastImageSize\FastImageSize(); + $size_info = $imagesize->getImageSize($url); + if ($size_info === false) + { + $logger->err('UNABLE_GET_IMAGE_SIZE'); + return false; + } + + if ($max_height && $max_height < $size_info['height']) + { + $logger->err('MAX_IMG_HEIGHT_EXCEEDED', array('max_height' => $max_height)); + return false; + } + + if ($max_width && $max_width < $size_info['width']) + { + $logger->err('MAX_IMG_WIDTH_EXCEEDED', array('max_width' => $max_width)); + return false; + } + } + + return $url; + } + + /** + * Test whether given tag consumes text that looks like BBCode-styled markup + * + * @param Tag $tag Original tag + * @return bool + */ + protected function is_a_bbcode(Tag $tag) + { + if ($tag->getLen() < 3) + { + return false; + } + $markup = substr($this->parser->getText(), $tag->getPos(), $tag->getLen()); + + return (bool) preg_match('(^\\[\\w++.*?\\]$)s', $markup); + } +} diff --git a/install/update/new/phpbb/textformatter/s9e/quote_helper.php b/install/update/new/phpbb/textformatter/s9e/quote_helper.php new file mode 100644 index 0000000..3011ec8 --- /dev/null +++ b/install/update/new/phpbb/textformatter/s9e/quote_helper.php @@ -0,0 +1,87 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +class quote_helper +{ + /** + * @var string Base URL for a post link, uses {POST_ID} as placeholder + */ + protected $post_url; + + /** + * @var string Base URL for a private message link, uses {MSG_ID} as placeholder + */ + protected $msg_url; + + /** + * @var string Base URL for a profile link, uses {USER_ID} as placeholder + */ + protected $profile_url; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\user $user + * @param string $root_path + * @param string $php_ext + */ + public function __construct(\phpbb\user $user, $root_path, $php_ext) + { + $this->post_url = append_sid($root_path . 'viewtopic.' . $php_ext, 'p={POST_ID}#p{POST_ID}', false); + $this->msg_url = append_sid($root_path . 'ucp.' . $php_ext, 'i=pm&mode=view&p={MSG_ID}', false); + $this->profile_url = append_sid($root_path . 'memberlist.' . $php_ext, 'mode=viewprofile&u={USER_ID}', false); + $this->user = $user; + } + + /** + * Inject dynamic metadata into QUOTE tags in given XML + * + * @param string $xml Original XML + * @return string Modified XML + */ + public function inject_metadata($xml) + { + return \s9e\TextFormatter\Utils::replaceAttributes( + $xml, + 'QUOTE', + function ($attributes) + { + if (isset($attributes['post_id'])) + { + $attributes['post_url'] = str_replace('{POST_ID}', $attributes['post_id'], $this->post_url); + } + if (isset($attributes['msg_id'])) + { + $attributes['msg_url'] = str_replace('{MSG_ID}', $attributes['msg_id'], $this->msg_url); + } + if (isset($attributes['time'])) + { + $attributes['date'] = $this->user->format_date($attributes['time']); + } + if (isset($attributes['user_id'])) + { + $attributes['profile_url'] = str_replace('{USER_ID}', $attributes['user_id'], $this->profile_url); + } + + return $attributes; + } + ); + } +} diff --git a/install/update/new/phpbb/ucp/controller/reset_password.php b/install/update/new/phpbb/ucp/controller/reset_password.php new file mode 100644 index 0000000..5c27c4f --- /dev/null +++ b/install/update/new/phpbb/ucp/controller/reset_password.php @@ -0,0 +1,443 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\ucp\controller; + +use phpbb\auth\auth; +use phpbb\config\config; +use phpbb\controller\helper; +use phpbb\db\driver\driver_interface; +use phpbb\event\dispatcher; +use phpbb\exception\http_exception; +use phpbb\language\language; +use phpbb\log\log_interface; +use phpbb\passwords\manager; +use phpbb\request\request_interface; +use phpbb\template\template; +use phpbb\user; +use Symfony\Component\HttpFoundation\Response; + +/** +* Handling forgotten passwords via reset password functionality +*/ +class reset_password +{ + /** @var config */ + protected $config; + + /** @var driver_interface */ + protected $db; + + /** @var dispatcher */ + protected $dispatcher; + + /** @var helper */ + protected $helper; + + /** @var language */ + protected $language; + + /** @var log_interface */ + protected $log; + + /** @var manager */ + protected $passwords_manager; + + /** @var request_interface */ + protected $request; + + /** @var template */ + protected $template; + + /** @var user */ + protected $user; + + /** @var array phpBB DB table names */ + protected $users_table; + + /** @var string phpBB root path */ + protected $root_path; + + /** @var string PHP extension */ + protected $php_ext; + + /** + * Reset password controller constructor. + * + * @param config $config + * @param driver_interface $db + * @param dispatcher $dispatcher + * @param helper $helper + * @param language $language + * @param log_interface $log + * @param manager $passwords_manager + * @param request_interface $request + * @param template $template + * @param user $user + * @param string $users_table + * @param string $root_path + * @param string $php_ext + */ + public function __construct(config $config, driver_interface $db, dispatcher $dispatcher, helper $helper, + language $language, log_interface $log, manager $passwords_manager, + request_interface $request, template $template, user $user, string $users_table, + string $root_path, string $php_ext) + { + $this->config = $config; + $this->db = $db; + $this->dispatcher = $dispatcher; + $this->helper = $helper; + $this->language = $language; + $this->log = $log; + $this->passwords_manager = $passwords_manager; + $this->request = $request; + $this->template = $template; + $this->user = $user; + $this->users_table = $users_table; + $this->root_path = $root_path; + $this->php_ext = $php_ext; + } + + /** + * Init controller + */ + protected function init_controller() + { + $this->language->add_lang('ucp'); + + if (!$this->config['allow_password_reset']) + { + throw new http_exception(Response::HTTP_OK, 'UCP_PASSWORD_RESET_DISABLED', [ + '', + '' + ]); + } + } + + /** + * Remove reset token for specified user + * + * @param int $user_id User ID + */ + protected function remove_reset_token(int $user_id) + { + $sql_ary = [ + 'reset_token' => '', + 'reset_token_expiration' => 0, + ]; + + $sql = 'UPDATE ' . $this->users_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user_id; + $this->db->sql_query($sql); + } + + /** + * Handle password reset request + * + * @return Response + */ + public function request() + { + $this->init_controller(); + + $submit = $this->request->is_set_post('submit'); + $username = $this->request->variable('username', '', true); + $email = strtolower($this->request->variable('email', '')); + + add_form_key('ucp_reset_password'); + + if ($submit) + { + if (!check_form_key('ucp_reset_password')) + { + throw new http_exception(Response::HTTP_UNAUTHORIZED, 'FORM_INVALID'); + } + + if (empty($email)) + { + return $this->helper->message('NO_EMAIL_USER'); + } + + $sql_array = [ + 'SELECT' => 'user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type,' + . ' user_lang, user_inactive_reason, reset_token, reset_token_expiration', + 'FROM' => [$this->users_table => 'u'], + 'WHERE' => "user_email = '" . $this->db->sql_escape($email) . "'" . + (!empty($username) ? " AND username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'" : ''), + ]; + + /** + * Change SQL query for fetching user data + * + * @event core.ucp_remind_modify_select_sql + * @var string email User's email from the form + * @var string username User's username from the form + * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, WHERE + * @since 3.1.11-RC1 + * @changed 3.3.0-b1 Moved to reset password controller + */ + $vars = [ + 'email', + 'username', + 'sql_array', + ]; + extract($this->dispatcher->trigger_event('core.ucp_remind_modify_select_sql', compact($vars))); + + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query_limit($sql, 2); // don't waste resources on more rows than we need + $rowset = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + if (count($rowset) > 1) + { + $this->template->assign_vars([ + 'USERNAME_REQUIRED' => true, + 'EMAIL' => $email, + ]); + } + else + { + $message = $this->language->lang('PASSWORD_RESET_LINK_SENT') . '

' . $this->language->lang('RETURN_INDEX', 'root_path}index.{$this->php_ext}") . '">', ''); + + if (empty($rowset)) + { + return $this->helper->message($message); + } + + $user_row = $rowset[0]; + + if ($user_row['user_type'] == USER_IGNORE || $user_row['user_type'] == USER_INACTIVE) + { + return $this->helper->message($message); + } + + // Do not create multiple valid reset tokens + if (!empty($user_row['reset_token']) && (int) $user_row['reset_token_expiration'] >= time()) + { + return $this->helper->message($message); + } + + // Check users permissions + $auth = new auth(); + $auth->acl($user_row); + + if (!$auth->acl_get('u_chgpasswd')) + { + return $this->helper->message($message); + } + + // Generate reset token + $reset_token = strtolower(gen_rand_string(32)); + + $sql_ary = [ + 'reset_token' => $reset_token, + 'reset_token_expiration' => strtotime('+1 day'), + ]; + + $sql = 'UPDATE ' . $this->users_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user_row['user_id']; + $this->db->sql_query($sql); + + if (!class_exists('messenger')) + { + include($this->root_path . 'includes/functions_messenger.' . $this->php_ext); + } + + /** @var \messenger $messenger */ + $messenger = new \messenger(false); + + $messenger->template('user_forgot_password', $user_row['user_lang']); + + $messenger->set_addresses($user_row); + + $messenger->anti_abuse_headers($this->config, $this->user); + + $messenger->assign_vars([ + 'USERNAME' => htmlspecialchars_decode($user_row['username']), + 'U_RESET_PASSWORD' => generate_board_url(true) . $this->helper->route('phpbb_ucp_reset_password_controller', [ + 'u' => $user_row['user_id'], + 'token' => $reset_token, + ], false) + ]); + + $messenger->send($user_row['user_notify_type']); + + return $this->helper->message($message); + } + } + + $this->template->assign_vars([ + 'USERNAME' => $username, + 'EMAIL' => $email, + 'U_RESET_PASSWORD_ACTION' => $this->helper->route('phpbb_ucp_forgot_password_controller'), + ]); + + return $this->helper->render('ucp_reset_password.html', $this->language->lang('RESET_PASSWORD')); + } + + /** + * Handle controller requests + * + * @return Response + */ + public function reset() + { + $this->init_controller(); + + $submit = $this->request->is_set_post('submit'); + $reset_token = $this->request->variable('token', ''); + $user_id = $this->request->variable('u', 0); + + if (empty($reset_token)) + { + return $this->helper->message('NO_RESET_TOKEN'); + } + + if (!$user_id) + { + return $this->helper->message('NO_USER'); + } + + add_form_key('ucp_reset_password'); + + $sql_array = [ + 'SELECT' => 'user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type,' + . ' user_lang, user_inactive_reason, reset_token, reset_token_expiration', + 'FROM' => [$this->users_table => 'u'], + 'WHERE' => 'user_id = ' . $user_id, + ]; + + /** + * Change SQL query for fetching user data + * + * @event core.ucp_reset_password_modify_select_sql + * @var int user_id User ID from the form + * @var string reset_token Reset token + * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, WHERE + * @since 3.3.0-b1 + */ + $vars = [ + 'user_id', + 'reset_token', + 'sql_array', + ]; + extract($this->dispatcher->trigger_event('core.ucp_reset_password_modify_select_sql', compact($vars))); + + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query_limit($sql, 1); + $user_row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $message = $this->language->lang('RESET_TOKEN_EXPIRED_OR_INVALID') . '

' . $this->language->lang('RETURN_INDEX', 'root_path}index.{$this->php_ext}") . '">', ''); + + if (empty($user_row)) + { + return $this->helper->message($message); + } + + if (!hash_equals($reset_token, $user_row['reset_token'])) + { + return $this->helper->message($message); + } + + if ($user_row['reset_token_expiration'] < time()) + { + $this->remove_reset_token($user_id); + + return $this->helper->message($message); + } + + $errors = []; + + if ($submit) + { + if (!check_form_key('ucp_reset_password')) + { + return $this->helper->message('FORM_INVALID'); + } + + if ($user_row['user_type'] == USER_IGNORE || $user_row['user_type'] == USER_INACTIVE) + { + return $this->helper->message($message); + } + + // Check users permissions + $auth = new auth(); + $auth->acl($user_row); + + if (!$auth->acl_get('u_chgpasswd')) + { + return $this->helper->message($message); + } + + if (!function_exists('validate_data')) + { + include($this->root_path . 'includes/functions_user.' . $this->php_ext); + } + + $data = [ + 'new_password' => $this->request->untrimmed_variable('new_password', '', true), + 'password_confirm' => $this->request->untrimmed_variable('new_password_confirm', '', true), + ]; + $check_data = [ + 'new_password' => [ + ['string', false, $this->config['min_pass_chars'], 0], + ['password'], + ], + 'password_confirm' => ['string', true, $this->config['min_pass_chars'], 0], + ]; + $errors = array_merge($errors, validate_data($data, $check_data)); + if (strcmp($data['new_password'], $data['password_confirm']) !== 0) + { + $errors[] = $data['password_confirm'] ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY'; + } + if (empty($errors)) + { + $sql_ary = [ + 'user_password' => $this->passwords_manager->hash($data['new_password']), + 'user_login_attempts' => 0, + 'reset_token' => '', + 'reset_token_expiration' => 0, + ]; + $sql = 'UPDATE ' . $this->users_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . (int) $user_row['user_id']; + $this->db->sql_query($sql); + $this->log->add('user', $user_row['user_id'], $this->user->ip, 'LOG_USER_NEW_PASSWORD', false, [ + 'reportee_id' => $user_row['user_id'], + $user_row['username'] + ]); + meta_refresh(3, append_sid("{$this->root_path}index.{$this->php_ext}")); + return $this->helper->message($this->language->lang('PASSWORD_RESET')); + } + } + + if (!empty($errors)) + { + $this->template->assign_block_vars_array('PASSWORD_RESET_ERRORS', array_map([$this->language, 'lang'], $errors)); + } + + $this->template->assign_vars([ + 'S_IS_PASSWORD_RESET' => true, + 'U_RESET_PASSWORD_ACTION' => $this->helper->route('phpbb_ucp_reset_password_controller'), + 'S_HIDDEN_FIELDS' => build_hidden_fields([ + 'u' => $user_id, + 'token' => $reset_token, + ]), + ]); + + return $this->helper->render('ucp_reset_password.html', $this->language->lang('RESET_PASSWORD')); + } +} diff --git a/install/update/new/phpbb/user.php b/install/update/new/phpbb/user.php new file mode 100644 index 0000000..21d156e --- /dev/null +++ b/install/update/new/phpbb/user.php @@ -0,0 +1,848 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* Base user class +* +* This is the overarching class which contains (through session extend) +* all methods utilised for user functionality during a session. +*/ +class user extends \phpbb\session +{ + /** + * @var \phpbb\language\language + */ + protected $language; + + var $style = array(); + var $date_format; + + /** + * DateTimeZone object holding the timezone of the user + */ + public $timezone; + + /** + * @var string Class name of datetime object + */ + protected $datetime; + + var $lang_name = false; + var $lang_id = false; + var $lang_path; + var $img_lang; + var $img_array = array(); + + /** @var bool */ + protected $is_setup_flag; + + // Able to add new options (up to id 31) + var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17); + + /** + * Constructor to set the lang path + * + * @param \phpbb\language\language $lang phpBB's Language loader + * @param string $datetime_class Class name of datetime class + */ + function __construct(\phpbb\language\language $lang, $datetime_class) + { + global $phpbb_root_path; + + $this->lang_path = $phpbb_root_path . 'language/'; + $this->language = $lang; + $this->datetime = $datetime_class; + + $this->is_setup_flag = false; + } + + /** + * Returns whether user::setup was called + * + * @return bool + */ + public function is_setup() + { + return $this->is_setup_flag; + } + + /** + * Magic getter for BC compatibility + * + * Implement array access for user::lang. + * + * @param string $param_name Name of the BC component the user want to access + * + * @return array The appropriate array + * + * @deprecated 3.2.0-dev (To be removed: 4.0.0) + */ + public function __get($param_name) + { + if ($param_name === 'lang') + { + return $this->language->get_lang_array(); + } + else if ($param_name === 'help') + { + $help_array = $this->language->get_lang_array(); + return $help_array['__help']; + } + + return array(); + } + + /** + * Setup basic user-specific items (style, language, ...) + */ + function setup($lang_set = false, $style_id = false) + { + global $db, $request, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; + global $phpbb_dispatcher, $phpbb_container; + + $this->language->set_default_language($config['default_lang']); + + if ($this->data['user_id'] != ANONYMOUS) + { + $user_lang_name = (file_exists($this->lang_path . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : basename($config['default_lang']); + $user_date_format = $this->data['user_dateformat']; + $user_timezone = $this->data['user_timezone']; + } + else + { + $lang_override = $request->variable('language', ''); + if ($lang_override) + { + $this->set_cookie('lang', $lang_override, 0, false); + } + else + { + $lang_override = $request->variable($config['cookie_name'] . '_lang', '', true, \phpbb\request\request_interface::COOKIE); + } + + if ($lang_override) + { + $use_lang = basename($lang_override); + $user_lang_name = (file_exists($this->lang_path . $use_lang . "/common.$phpEx")) ? $use_lang : basename($config['default_lang']); + $this->data['user_lang'] = $user_lang_name; + } + else + { + $user_lang_name = basename($config['default_lang']); + } + + $user_date_format = $config['default_dateformat']; + $user_timezone = $config['board_timezone']; + + /** + * If a guest user is surfing, we try to guess his/her language first by obtaining the browser language + * If re-enabled we need to make sure only those languages installed are checked + * Commented out so we do not loose the code. + + if ($request->header('Accept-Language')) + { + $accept_lang_ary = explode(',', $request->header('Accept-Language')); + + foreach ($accept_lang_ary as $accept_lang) + { + // Set correct format ... guess full xx_YY form + $accept_lang = substr($accept_lang, 0, 2) . '_' . strtoupper(substr($accept_lang, 3, 2)); + $accept_lang = basename($accept_lang); + + if (file_exists($this->lang_path . $accept_lang . "/common.$phpEx")) + { + $user_lang_name = $config['default_lang'] = $accept_lang; + break; + } + else + { + // No match on xx_YY so try xx + $accept_lang = substr($accept_lang, 0, 2); + $accept_lang = basename($accept_lang); + + if (file_exists($this->lang_path . $accept_lang . "/common.$phpEx")) + { + $user_lang_name = $config['default_lang'] = $accept_lang; + break; + } + } + } + } + */ + } + + $user_data = $this->data; + $lang_set_ext = array(); + + /** + * Event to load language files and modify user data on every page + * + * Note: To load language file with this event, see description + * of lang_set_ext variable. + * + * @event core.user_setup + * @var array user_data Array with user's data row + * @var string user_lang_name Basename of the user's langauge + * @var string user_date_format User's date/time format + * @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.0-a1 + */ + $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; + $this->lang_name = $user_lang_name; + $this->date_format = $user_date_format; + + $this->language->set_user_language($user_lang_name); + + try + { + $this->timezone = new \DateTimeZone($user_timezone); + } + catch (\Exception $e) + { + // If the timezone the user has selected is invalid, we fall back to UTC. + $this->timezone = new \DateTimeZone('UTC'); + } + + $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->variable('style', 0); + if ($style_request && (!$config['override_user_style'] || $auth->acl_get('a_styles')) && !defined('ADMIN_START')) + { + global $SID, $_EXTRA_URL; + + $style_id = $style_request; + $SID .= '&style=' . $style_id; + $_EXTRA_URL = array('style=' . $style_id); + } + else + { + // Set up style + $style_id = ($style_id) ? $style_id : ((!$config['override_user_style']) ? $this->data['user_style'] : $config['default_style']); + } + + $sql = 'SELECT * + FROM ' . STYLES_TABLE . " s + WHERE s.style_id = $style_id"; + $result = $db->sql_query($sql, 3600); + $this->style = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Fallback to user's standard style + if (!$this->style && $style_id != $this->data['user_style']) + { + $style_id = $this->data['user_style']; + + $sql = 'SELECT * + FROM ' . STYLES_TABLE . " s + WHERE s.style_id = $style_id"; + $result = $db->sql_query($sql, 3600); + $this->style = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + // Fallback to board's default style + if (!$this->style) + { + // Verify default style exists in the database + $sql = 'SELECT style_id + FROM ' . STYLES_TABLE . ' + WHERE style_id = ' . (int) $config['default_style']; + $result = $db->sql_query($sql); + $style_id = (int) $db->sql_fetchfield('style_id'); + $db->sql_freeresult($result); + + if ($style_id > 0) + { + $db->sql_transaction('begin'); + + // Update $user row + $sql = 'SELECT * + FROM ' . STYLES_TABLE . ' + WHERE style_id = ' . (int) $config['default_style']; + $result = $db->sql_query($sql); + $this->style = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Update user style preference + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $style_id . ' + WHERE user_id = ' . (int) $this->data['user_id']; + $db->sql_query($sql); + + $db->sql_transaction('commit'); + } + } + + // This should never happen + if (!$this->style) + { + trigger_error($this->language->lang('NO_STYLE_DATA', $this->data['user_style'], $this->data['user_id']), E_USER_ERROR); + } + + // Now parse the cfg file and cache it + $parsed_items = $cache->obtain_cfg_items($this->style); + + $check_for = array( + 'pagination_sep' => (string) ', ' + ); + + foreach ($check_for as $key => $default_value) + { + $this->style[$key] = (isset($parsed_items[$key])) ? $parsed_items[$key] : $default_value; + settype($this->style[$key], gettype($default_value)); + + if (is_string($default_value)) + { + $this->style[$key] = htmlspecialchars($this->style[$key]); + } + } + + $template->set_style(); + + $this->img_lang = $this->lang_name; + + // Call phpbb_user_session_handler() in case external application want to "bend" some variables or replace classes... + // After calling it we continue script execution... + phpbb_user_session_handler(); + + /** + * Execute code at the end of user setup + * + * @event core.user_setup_after + * @since 3.1.6-RC1 + */ + $phpbb_dispatcher->dispatch('core.user_setup_after'); + + // If this function got called from the error handler we are finished here. + if (defined('IN_ERROR_HANDLER')) + { + return; + } + + // Disable board if the install/ directory is still present + // For the brave development army we do not care about this, else we need to comment out this every time we develop locally + if (!$phpbb_container->getParameter('allow_install_dir') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install')) + { + // Adjust the message slightly according to the permissions + if ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) + { + $message = 'REMOVE_INSTALL'; + } + else + { + $message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE'; + } + trigger_error($message); + } + + // Is board disabled and user not an admin or moderator? + if ($config['board_disable'] && !defined('IN_INSTALL') && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) + { + if ($this->data['is_bot']) + { + send_status_line(503, 'Service Unavailable'); + } + + $message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE'; + trigger_error($message); + } + + // Is load exceeded? + if ($config['limit_load'] && $this->load !== false) + { + if ($this->load > floatval($config['limit_load']) && !defined('IN_LOGIN') && !defined('IN_ADMIN')) + { + // Set board disabled to true to let the admins/mods get the proper notification + $config['board_disable'] = '1'; + + if (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) + { + if ($this->data['is_bot']) + { + send_status_line(503, 'Service Unavailable'); + } + trigger_error('BOARD_UNAVAILABLE'); + } + } + } + + if (isset($this->data['session_viewonline'])) + { + // Make sure the user is able to hide his session + if (!$this->data['session_viewonline']) + { + // Reset online status if not allowed to hide the session... + if (!$auth->acl_get('u_hideonline')) + { + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET session_viewonline = 1 + WHERE session_user_id = ' . $this->data['user_id']; + $db->sql_query($sql); + $this->data['session_viewonline'] = 1; + } + } + else if (!$this->data['user_allow_viewonline']) + { + // the user wants to hide and is allowed to -> cloaking device on. + if ($auth->acl_get('u_hideonline')) + { + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET session_viewonline = 0 + WHERE session_user_id = ' . $this->data['user_id']; + $db->sql_query($sql); + $this->data['session_viewonline'] = 0; + } + } + } + + // Does the user need to change their password? If so, redirect to the + // ucp profile reg_details page ... of course do not redirect if we're already in the ucp + if (!defined('IN_ADMIN') && !defined('ADMIN_START') && $config['chg_passforce'] && !empty($this->data['is_registered']) && $auth->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) + { + if (strpos($this->page['query_string'], 'mode=reg_details') === false && $this->page['page_name'] != "ucp.$phpEx") + { + redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&mode=reg_details')); + } + } + + $this->is_setup_flag = true; + + return; + } + + /** + * More advanced language substitution + * Function to mimic sprintf() with the possibility of using phpBB's language system to substitute nullar/singular/plural forms. + * Params are the language key and the parameters to be substituted. + * This function/functionality is inspired by SHS` and Ashe. + * + * Example call: $user->lang('NUM_POSTS_IN_QUEUE', 1); + * + * If the first parameter is an array, the elements are used as keys and subkeys to get the language entry: + * Example: $user->lang(array('datetime', 'AGO'), 1) uses $user->lang['datetime']['AGO'] as language entry. + * + * @deprecated 3.2.0-dev (To be removed 4.0.0) + */ + function lang() + { + $args = func_get_args(); + return call_user_func_array(array($this->language, 'lang'), $args); + } + + /** + * Determine which plural form we should use. + * For some languages this is not as simple as for English. + * + * @param $number int|float The number we want to get the plural case for. Float numbers are floored. + * @param $force_rule mixed False to use the plural rule of the language package + * or an integer to force a certain plural rule + * @return int|bool The plural-case we need to use for the number plural-rule combination, false if $force_rule + * was invalid. + * + * @deprecated: 3.2.0-dev (To be removed: 4.0.0) + */ + function get_plural_form($number, $force_rule = false) + { + return $this->language->get_plural_form($number, $force_rule); + } + + /** + * Add Language Items - use_db and use_help are assigned where needed (only use them to force inclusion) + * + * @param mixed $lang_set specifies the language entries to include + * @param bool $use_db internal variable for recursion, do not use @deprecated 3.2.0-dev (To be removed: 4.0.0) + * @param bool $use_help internal variable for recursion, do not use @deprecated 3.2.0-dev (To be removed: 4.0.0) + * @param string $ext_name The extension to load language from, or empty for core files + * + * Examples: + * + * $lang_set = array('posting', 'help' => 'faq'); + * $lang_set = array('posting', 'viewtopic', 'help' => array('bbcode', 'faq')) + * $lang_set = array(array('posting', 'viewtopic'), 'help' => array('bbcode', 'faq')) + * $lang_set = 'posting' + * $lang_set = array('help' => 'faq', 'db' => array('help:faq', 'posting')) + * + * + * Note: $use_db and $use_help should be removed. The old function was kept for BC purposes, + * so the BC logic is handled here. + * + * @deprecated: 3.2.0-dev (To be removed: 4.0.0) + */ + function add_lang($lang_set, $use_db = false, $use_help = false, $ext_name = '') + { + if (is_array($lang_set)) + { + foreach ($lang_set as $key => $lang_file) + { + // Please do not delete this line. + // We have to force the type here, else [array] language inclusion will not work + $key = (string) $key; + + if ($key == 'db') + { + // This is never used + $this->add_lang($lang_file, true, $use_help, $ext_name); + } + else if ($key == 'help') + { + $this->add_lang($lang_file, $use_db, true, $ext_name); + } + else if (!is_array($lang_file)) + { + $this->set_lang($lang_file, $use_help, $ext_name); + } + else + { + $this->add_lang($lang_file, $use_db, $use_help, $ext_name); + } + } + unset($lang_set); + } + else if ($lang_set) + { + $this->set_lang($lang_set, $use_help, $ext_name); + } + } + + /** + * BC function for loading language files + * + * @deprecated 3.2.0-dev (To be removed: 4.0.0) + */ + private function set_lang($lang_set, $use_help, $ext_name) + { + if (empty($ext_name)) + { + $ext_name = null; + } + + if ($use_help && strpos($lang_set, '/') !== false) + { + $component = dirname($lang_set) . '/help_' . basename($lang_set); + + if ($component[0] === '/') + { + $component = substr($component, 1); + } + } + else + { + $component = (($use_help) ? 'help_' : '') . $lang_set; + } + + $this->language->add_lang($component, $ext_name); + } + + /** + * Add Language Items from an extension - use_db and use_help are assigned where needed (only use them to force inclusion) + * + * @param string $ext_name The extension to load language from, or empty for core files + * @param mixed $lang_set specifies the language entries to include + * @param bool $use_db internal variable for recursion, do not use + * @param bool $use_help internal variable for recursion, do not use + * + * Note: $use_db and $use_help should be removed. Kept for BC purposes. + * + * @deprecated: 3.2.0-dev (To be removed: 4.0.0) + */ + function add_lang_ext($ext_name, $lang_set, $use_db = false, $use_help = false) + { + if ($ext_name === '/') + { + $ext_name = ''; + } + + $this->add_lang($lang_set, $use_db, $use_help, $ext_name); + } + + /** + * Format user date + * + * @param int $gmepoch unix timestamp + * @param string $format date format in date() notation. | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i. + * @param bool $forcedate force non-relative date format. + * + * @return mixed translated date + */ + function format_date($gmepoch, $format = false, $forcedate = false) + { + global $phpbb_dispatcher; + static $utc; + + if (!isset($utc)) + { + $utc = new \DateTimeZone('UTC'); + } + + $format_date_override = false; + $function_arguments = func_get_args(); + /** + * Execute code and/or override format_date() + * + * To override the format_date() function generated value + * set $format_date_override to new return value + * + * @event core.user_format_date_override + * @var DateTimeZone utc Is DateTimeZone in UTC + * @var array function_arguments is array comprising a function's argument list + * @var string format_date_override Shall we return custom format (string) or not (false) + * @since 3.2.1-RC1 + */ + $vars = array('utc', 'function_arguments', 'format_date_override'); + extract($phpbb_dispatcher->trigger_event('core.user_format_date_override', compact($vars))); + + if (!$format_date_override) + { + $time = new $this->datetime($this, '@' . (int) $gmepoch, $utc); + $time->setTimezone($this->timezone); + + return $time->format($format, $forcedate); + } + else + { + return $format_date_override; + } + } + + /** + * Create a \phpbb\datetime object in the context of the current user + * + * @since 3.1 + * @param string $time String in a format accepted by strtotime(). + * @param DateTimeZone $timezone Time zone of the time. + * @return \phpbb\datetime Date time object linked to the current users locale + */ + public function create_datetime($time = 'now', \DateTimeZone $timezone = null) + { + $timezone = $timezone ?: $this->timezone; + return new $this->datetime($this, $time, $timezone); + } + + /** + * Get the UNIX timestamp for a datetime in the users timezone, so we can store it in the database. + * + * @param string $format Format of the entered date/time + * @param string $time Date/time with the timezone applied + * @param DateTimeZone $timezone Timezone of the date/time, falls back to timezone of current user + * @return int Returns the unix timestamp + */ + public function get_timestamp_from_format($format, $time, \DateTimeZone $timezone = null) + { + $timezone = $timezone ?: $this->timezone; + $date = \DateTime::createFromFormat($format, $time, $timezone); + return ($date !== false) ? $date->format('U') : false; + } + + /** + * Get language id currently used by the user + */ + function get_iso_lang_id() + { + global $config, $db; + + if (!empty($this->lang_id)) + { + return $this->lang_id; + } + + if (!$this->lang_name) + { + $this->lang_name = $config['default_lang']; + } + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($this->lang_name) . "'"; + $result = $db->sql_query($sql); + $this->lang_id = (int) $db->sql_fetchfield('lang_id'); + $db->sql_freeresult($result); + + return $this->lang_id; + } + + /** + * Get users profile fields + */ + function get_profile_fields($user_id) + { + global $db; + + if (isset($this->profile_fields)) + { + return; + } + + $sql = 'SELECT * + FROM ' . PROFILE_FIELDS_DATA_TABLE . " + WHERE user_id = $user_id"; + $result = $db->sql_query_limit($sql, 1); + $this->profile_fields = (!($row = $db->sql_fetchrow($result))) ? array() : $row; + $db->sql_freeresult($result); + } + + /** + * Specify/Get image + */ + function img($img, $alt = '') + { + $title = ''; + + if ($alt) + { + $alt = $this->language->lang($alt); + $title = ' title="' . $alt . '"'; + } + return '' . $alt . ''; + } + + /** + * Get option bit field from user options. + * + * @param int $key option key, as defined in $keyoptions property. + * @param int $data bit field value to use, or false to use $this->data['user_options'] + * @return bool true if the option is set in the bit field, false otherwise + */ + function optionget($key, $data = false) + { + $var = ($data !== false) ? $data : $this->data['user_options']; + return phpbb_optionget($this->keyoptions[$key], $var); + } + + /** + * Set option bit field for user options. + * + * @param int $key Option key, as defined in $keyoptions property. + * @param bool $value True to set the option, false to clear the option. + * @param int $data Current bit field value, or false to use $this->data['user_options'] + * @return int|bool If $data is false, the bit field is modified and + * written back to $this->data['user_options'], and + * return value is true if the bit field changed and + * false otherwise. If $data is not false, the new + * bitfield value is returned. + */ + function optionset($key, $value, $data = false) + { + $var = ($data !== false) ? $data : $this->data['user_options']; + + $new_var = phpbb_optionset($this->keyoptions[$key], $value, $var); + + if ($data === false) + { + if ($new_var != $var) + { + $this->data['user_options'] = $new_var; + return true; + } + else + { + return false; + } + } + else + { + return $new_var; + } + } + + /** + * Function to make the user leave the NEWLY_REGISTERED system group. + * @access public + */ + function leave_newly_registered() + { + if (empty($this->data['user_new'])) + { + return false; + } + + if (!function_exists('remove_newly_registered')) + { + global $phpbb_root_path, $phpEx; + + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + if ($group = remove_newly_registered($this->data['user_id'], $this->data)) + { + $this->data['group_id'] = $group; + + } + $this->data['user_permissions'] = ''; + $this->data['user_new'] = 0; + + return true; + } + + /** + * Returns all password protected forum ids the user is currently NOT authenticated for. + * + * @return array Array of forum ids + * @access public + */ + function get_passworded_forums() + { + global $db; + + $sql = 'SELECT f.forum_id, fa.user_id + FROM ' . FORUMS_TABLE . ' f + LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa + ON (fa.forum_id = f.forum_id + AND fa.session_id = '" . $db->sql_escape($this->session_id) . "') + WHERE f.forum_password <> ''"; + $result = $db->sql_query($sql); + + $forum_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_id = (int) $row['forum_id']; + + if ($row['user_id'] != $this->data['user_id']) + { + $forum_ids[$forum_id] = $forum_id; + } + } + $db->sql_freeresult($result); + + return $forum_ids; + } +} diff --git a/install/update/new/phpbb/user_loader.php b/install/update/new/phpbb/user_loader.php new file mode 100644 index 0000000..3dacf07 --- /dev/null +++ b/install/update/new/phpbb/user_loader.php @@ -0,0 +1,238 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* User loader class +* +* This handles loading users from the database and +* storing in them in a temporary cache so we do not +* have to query the same user multiple times in +* different services. +*/ +class user_loader +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db = null; + + /** @var string */ + protected $phpbb_root_path = null; + + /** @var string */ + protected $php_ext = null; + + /** @var string */ + protected $users_table = null; + + /** + * Users loaded from the DB + * + * @var array Array of user data that we've loaded from the DB + */ + protected $users = array(); + + /** + * User loader constructor + * + * @param \phpbb\db\driver\driver_interface $db A database connection + * @param string $phpbb_root_path Path to the phpbb includes directory. + * @param string $php_ext php file extension + * @param string $users_table The name of the database table (phpbb_users) + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext, $users_table) + { + $this->db = $db; + + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->users_table = $users_table; + } + + /** + * Load user helper + * + * @param array $user_ids + * @param array $ignore_types user types to ignore + */ + public function load_users(array $user_ids, array $ignore_types = array()) + { + $user_ids[] = ANONYMOUS; + + // Make user_ids unique and convert to integer. + $user_ids = array_map('intval', array_unique($user_ids)); + + // Do not load users we already have in $this->users + $user_ids = array_diff($user_ids, array_keys($this->users)); + + if (count($user_ids)) + { + $sql = 'SELECT * + FROM ' . $this->users_table . ' + WHERE ' . $this->db->sql_in_set('user_id', $user_ids) . ' + AND ' . $this->db->sql_in_set('user_type', $ignore_types, true, true); + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $this->users[$row['user_id']] = $row; + } + $this->db->sql_freeresult($result); + } + } + + /** + * Load a user by username + * + * Stores the full data in the user cache so they do not need to be loaded again + * Returns the user id so you may use get_user() from the returned value + * + * @param string $username Raw username to load (will be cleaned) + * @return int User ID for the username + */ + public function load_user_by_username($username) + { + $sql = 'SELECT * + FROM ' . $this->users_table . " + WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + $this->users[$row['user_id']] = $row; + + return $row['user_id']; + } + + return ANONYMOUS; + } + + /** + * Get a user row from our users cache + * + * @param int $user_id User ID of the user you want to retrieve + * @param bool $query Should we query the database if this user has not yet been loaded? + * Typically this should be left as false and you should make sure + * you load users ahead of time with load_users() + * @return array|bool Row from the database of the user or Anonymous if the user wasn't loaded/does not exist + * or bool False if the anonymous user was not loaded + */ + public function get_user($user_id, $query = false) + { + if (isset($this->users[$user_id])) + { + return $this->users[$user_id]; + } + // Query them if we must (if ANONYMOUS is sent as the user_id and we have not loaded Anonymous yet, we must load Anonymous as a last resort) + else if ($query || $user_id == ANONYMOUS) + { + $this->load_users(array($user_id)); + + return $this->get_user($user_id); + } + + return $this->get_user(ANONYMOUS); + } + + /** + * Get username + * + * @param int $user_id User ID of the user you want to retrieve the username for + * @param string $mode The mode to load (same as get_username_string). One of the following: + * profile (for getting an url to the profile) + * username (for obtaining the username) + * colour (for obtaining the user colour) + * full (for obtaining a html string representing a coloured link to the users profile) + * no_profile (the same as full but forcing no profile link) + * @param string $guest_username Optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then. + * @param string $custom_profile_url Optional parameter to specify a profile url. The user id get appended to this url as &u={user_id} + * @param bool $query Should we query the database if this user has not yet been loaded? + * Typically this should be left as false and you should make sure + * you load users ahead of time with load_users() + * @return string + */ + public function get_username($user_id, $mode, $guest_username = false, $custom_profile_url = false, $query = false) + { + if (!($user = $this->get_user($user_id, $query))) + { + return ''; + } + + return get_username_string($mode, $user['user_id'], $user['username'], $user['user_colour'], $guest_username, $custom_profile_url); + } + + /** + * Get avatar + * + * @param int $user_id User ID of the user you want to retrieve the avatar for + * @param bool $query Should we query the database if this user has not yet been loaded? + * Typically this should be left as false and you should make sure + * you load users ahead of time with load_users() + * @param bool @lazy If true, will be lazy loaded (requires JS) + * @return string + */ + public function get_avatar($user_id, $query = false, $lazy = false) + { + if (!($user = $this->get_user($user_id, $query))) + { + return ''; + } + + $row = array( + 'avatar' => $user['user_avatar'], + 'avatar_type' => $user['user_avatar_type'], + 'avatar_width' => $user['user_avatar_width'], + 'avatar_height' => $user['user_avatar_height'], + ); + + return phpbb_get_avatar($row, 'USER_AVATAR', false, $lazy); + } + + /** + * Get rank + * + * @param int $user_id User ID of the user you want to retrieve the rank for + * @param bool $query Should we query the database if this user has not yet been loaded? + * Typically this should be left as false and you should make sure + * you load users ahead of time with load_users() + * @return array Array with keys 'rank_title', 'rank_img', and 'rank_img_src' + */ + public function get_rank($user_id, $query = false) + { + if (!($user = $this->get_user($user_id, $query))) + { + return ''; + } + + if (!function_exists('phpbb_get_user_rank')) + { + include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); + } + + $rank = array( + 'rank_title', + 'rank_img', + 'rank_img_src', + ); + + $user_rank_data = phpbb_get_user_rank($user, (($user['user_id'] == ANONYMOUS) ? false : $user['user_posts'])); + $rank['rank_title'] = $user_rank_data['title']; + $rank['rank_img'] = $user_rank_data['img']; + $rank['rank_img_src'] = $user_rank_data['img_src']; + + return $rank; + } +} diff --git a/install/update/new/posting.php b/install/update/new/posting.php new file mode 100644 index 0000000..c4042e4 --- /dev/null +++ b/install/update/new/posting.php @@ -0,0 +1,2041 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); +include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + + +// Start session management +$user->session_begin(); +$auth->acl($user->data); + + +// Grab only parameters needed here +$post_id = $request->variable('p', 0); +$topic_id = $request->variable('t', 0); +$forum_id = $request->variable('f', 0); +$draft_id = $request->variable('d', 0); + +$preview = (isset($_POST['preview'])) ? true : false; +$save = (isset($_POST['save'])) ? true : false; +$load = (isset($_POST['load'])) ? true : false; +$confirm = $request->is_set_post('confirm'); +$cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false; + +$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || $save || $load || $preview); +$submit = $request->is_set_post('post') && !$refresh && !$preview; +$mode = $request->variable('mode', ''); + +// If the user is not allowed to delete the post, we try to soft delete it, so we overwrite the mode here. +if ($mode == 'delete' && (($confirm && !$request->is_set_post('delete_permanent')) || !$auth->acl_gets('f_delete', 'm_delete', $forum_id))) +{ + $mode = 'soft_delete'; +} + +$error = $post_data = array(); +$current_time = time(); + +/** +* This event allows you to alter the above parameters, such as submit and mode +* +* Note: $refresh must be true to retain previously submitted form data. +* +* Note: The template class will not work properly until $user->setup() is +* called, and it has not been called yet. Extensions requiring template +* assignments should use an event that comes later in this file. +* +* @event core.modify_posting_parameters +* @var int post_id ID of the post +* @var int topic_id ID of the topic +* @var int forum_id ID of the forum +* @var int draft_id ID of the draft +* @var bool submit Whether or not the form has been submitted +* @var bool preview Whether or not the post is being previewed +* @var bool save Whether or not a draft is being saved +* @var bool load Whether or not a draft is being loaded +* @var bool cancel Whether or not to cancel the form (returns to +* viewtopic or viewforum depending on if the user +* is posting a new topic or editing a post) +* @var bool refresh Whether or not to retain previously submitted data +* @var string mode What action to take if the form has been submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var array error Any error strings; a non-empty array aborts +* form submission. +* NOTE: Should be actual language strings, NOT +* language keys. +* @since 3.1.0-a1 +* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist +* @changed 3.2.4-RC1 Remove unused 'lastclick' var +*/ +$vars = array( + 'post_id', + 'topic_id', + 'forum_id', + 'draft_id', + 'submit', + 'preview', + 'save', + 'load', + 'cancel', + 'refresh', + 'mode', + 'error', +); +extract($phpbb_dispatcher->trigger_event('core.modify_posting_parameters', compact($vars))); + +// Was cancel pressed? If so then redirect to the appropriate page +if ($cancel) +{ + $f = ($forum_id) ? 'f=' . $forum_id . '&' : ''; + $redirect = ($post_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 'p=' . $post_id) . '#p' . $post_id : (($topic_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 't=' . $topic_id) : (($forum_id) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}index.$phpEx"))); + redirect($redirect); +} + +if (in_array($mode, array('post', 'reply', 'quote', 'edit', 'delete')) && !$forum_id) +{ + trigger_error('NO_FORUM'); +} + +/* @var $phpbb_content_visibility \phpbb\content_visibility */ +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +// We need to know some basic information in all cases before we do anything. +switch ($mode) +{ + case 'post': + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + break; + + case 'bump': + case 'reply': + if (!$topic_id) + { + trigger_error('NO_TOPIC'); + } + + // Force forum id + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $f_id = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + $forum_id = (!$f_id) ? $forum_id : $f_id; + + $sql = 'SELECT f.*, t.* + FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f + WHERE t.topic_id = $topic_id + AND f.forum_id = t.forum_id + AND " . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'); + break; + + case 'quote': + case 'edit': + case 'delete': + case 'soft_delete': + if (!$post_id) + { + $user->setup('posting'); + trigger_error('NO_POST'); + } + + // Force forum id + $sql = 'SELECT forum_id + FROM ' . POSTS_TABLE . ' + WHERE post_id = ' . $post_id; + $result = $db->sql_query($sql); + $f_id = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + $forum_id = (!$f_id) ? $forum_id : $f_id; + + $sql = 'SELECT f.*, t.*, p.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_sig_bbcode_bitfield + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . " u + WHERE p.post_id = $post_id + AND t.topic_id = p.topic_id + AND u.user_id = p.poster_id + AND f.forum_id = t.forum_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.'); + break; + + case 'smilies': + $sql = ''; + generate_smilies('window', $forum_id); + break; + + case 'popup': + if ($forum_id) + { + $sql = 'SELECT forum_style + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_id; + } + else + { + phpbb_upload_popup(); + return; + } + break; + + default: + $sql = ''; + break; +} + +if (!$sql) +{ + $user->setup('posting'); + trigger_error('NO_POST_MODE'); +} + +$result = $db->sql_query($sql); +$post_data = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +if (!$post_data) +{ + if (!($mode == 'post' || $mode == 'bump' || $mode == 'reply')) + { + $user->setup('posting'); + } + trigger_error(($mode == 'post' || $mode == 'bump' || $mode == 'reply') ? 'NO_TOPIC' : 'NO_POST'); +} + +/** +* This event allows you to bypass reply/quote test of an unapproved post. +* +* @event core.posting_modify_row_data +* @var array post_data All post data from database +* @var string mode What action to take if the form has been submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var int topic_id ID of the topic +* @var int forum_id ID of the forum +* @since 3.2.8-RC1 +*/ +$vars = array( + 'post_data', + 'mode', + 'topic_id', + 'forum_id', +); +extract($phpbb_dispatcher->trigger_event('core.posting_modify_row_data', compact($vars))); + +// Not able to reply to unapproved posts/topics +// TODO: add more descriptive language key +if ($auth->acl_get('m_approve', $forum_id) && ((($mode == 'reply' || $mode == 'bump') && $post_data['topic_visibility'] != ITEM_APPROVED) || ($mode == 'quote' && $post_data['post_visibility'] != ITEM_APPROVED))) +{ + trigger_error(($mode == 'reply' || $mode == 'bump') ? 'TOPIC_UNAPPROVED' : 'POST_UNAPPROVED'); +} + +if ($mode == 'popup') +{ + phpbb_upload_popup($post_data['forum_style']); + return; +} + +$user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']); + +// Use post_row values in favor of submitted ones... +$forum_id = (!empty($post_data['forum_id'])) ? (int) $post_data['forum_id'] : (int) $forum_id; +$topic_id = (!empty($post_data['topic_id'])) ? (int) $post_data['topic_id'] : (int) $topic_id; +$post_id = (!empty($post_data['post_id'])) ? (int) $post_data['post_id'] : (int) $post_id; + +// Need to login to passworded forum first? +if ($post_data['forum_password']) +{ + login_forum_box(array( + 'forum_id' => $forum_id, + 'forum_name' => $post_data['forum_name'], + 'forum_password' => $post_data['forum_password']) + ); +} + +// Check permissions +if ($user->data['is_bot']) +{ + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); +} + +// Is the user able to read within this forum? +if (!$auth->acl_get('f_read', $forum_id)) +{ + if ($user->data['user_id'] != ANONYMOUS) + { + trigger_error('USER_CANNOT_READ'); + } + $message = $user->lang['LOGIN_EXPLAIN_POST']; + + if ($request->is_ajax()) + { + $json = new phpbb\json_response(); + $json->send(array( + 'title' => $user->lang['INFORMATION'], + 'message' => $message, + )); + } + + login_box('', $message); +} + +// Permission to do the action asked? +$is_authed = false; + +switch ($mode) +{ + case 'post': + if ($auth->acl_get('f_post', $forum_id)) + { + $is_authed = true; + } + break; + + case 'bump': + if ($auth->acl_get('f_bump', $forum_id)) + { + $is_authed = true; + } + break; + + case 'quote': + + $post_data['post_edit_locked'] = 0; + + // no break; + + case 'reply': + if ($auth->acl_get('f_reply', $forum_id)) + { + $is_authed = true; + } + break; + + case 'edit': + if ($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $forum_id)) + { + $is_authed = true; + } + break; + + case 'delete': + if ($user->data['is_registered'] && ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)))) + { + $is_authed = true; + } + + // no break; + + case 'soft_delete': + if (!$is_authed && $user->data['is_registered'] && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked'])) + { + // Fall back to soft_delete if we have no permissions to delete posts but to soft delete them + $is_authed = true; + $mode = 'soft_delete'; + } + break; +} +/** +* This event allows you to do extra auth checks and verify if the user +* has the required permissions +* +* Extensions should only change the error and is_authed variables. +* +* @event core.modify_posting_auth +* @var int post_id ID of the post +* @var int topic_id ID of the topic +* @var int forum_id ID of the forum +* @var int draft_id ID of the draft +* @var bool submit Whether or not the form has been submitted +* @var bool preview Whether or not the post is being previewed +* @var bool save Whether or not a draft is being saved +* @var bool load Whether or not a draft is being loaded +* @var bool refresh Whether or not to retain previously submitted data +* @var string mode What action to take if the form has been submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var array error Any error strings; a non-empty array aborts +* form submission. +* NOTE: Should be actual language strings, NOT +* language keys. +* @var bool is_authed Does the user have the required permissions? +* @var array post_data All post data from database +* @since 3.1.3-RC1 +* @changed 3.1.10-RC1 Added post_data +* @changed 3.2.4-RC1 Remove unused 'lastclick' var +*/ +$vars = array( + 'post_id', + 'topic_id', + 'forum_id', + 'draft_id', + 'submit', + 'preview', + 'save', + 'load', + 'refresh', + 'mode', + 'error', + 'is_authed', + 'post_data', +); +extract($phpbb_dispatcher->trigger_event('core.modify_posting_auth', compact($vars))); + +if (!$is_authed || !empty($error)) +{ + $check_auth = ($mode == 'quote') ? 'reply' : (($mode == 'soft_delete') ? 'delete' : $mode); + + if ($user->data['is_registered']) + { + trigger_error(empty($error) ? 'USER_CANNOT_' . strtoupper($check_auth) : implode('
', $error)); + } + $message = $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]; + + if ($request->is_ajax()) + { + $json = new phpbb\json_response(); + $json->send(array( + 'title' => $user->lang['INFORMATION'], + 'message' => $message, + )); + } + + login_box('', $message); +} + +if ($config['enable_post_confirm'] && !$user->data['is_registered']) +{ + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_POST); +} + +// Is the user able to post within this forum? +if ($post_data['forum_type'] != FORUM_POST && in_array($mode, array('post', 'bump', 'quote', 'reply'))) +{ + trigger_error('USER_CANNOT_FORUM_POST'); +} + +// Forum/Topic locked? +if (($post_data['forum_status'] == ITEM_LOCKED || (isset($post_data['topic_status']) && $post_data['topic_status'] == ITEM_LOCKED)) && !$auth->acl_get('m_edit', $forum_id)) +{ + trigger_error(($post_data['forum_status'] == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'TOPIC_LOCKED'); +} + +// Can we edit this post ... if we're a moderator with rights then always yes +// else it depends on editing times, lock status and if we're the correct user +if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id)) +{ + $force_edit_allowed = false; + + $s_cannot_edit = $user->data['user_id'] != $post_data['poster_id']; + $s_cannot_edit_time = $config['edit_time'] && $post_data['post_time'] <= time() - ($config['edit_time'] * 60); + $s_cannot_edit_locked = $post_data['post_edit_locked']; + + /** + * This event allows you to modify the conditions for the "cannot edit post" checks + * + * @event core.posting_modify_cannot_edit_conditions + * @var array post_data Array with post data + * @var bool force_edit_allowed Allow the user to edit the post (all permissions and conditions are ignored) + * @var bool s_cannot_edit User can not edit the post because it's not his + * @var bool s_cannot_edit_locked User can not edit the post because it's locked + * @var bool s_cannot_edit_time User can not edit the post because edit_time has passed + * @since 3.1.0-b4 + */ + $vars = array( + 'post_data', + 'force_edit_allowed', + 's_cannot_edit', + 's_cannot_edit_locked', + 's_cannot_edit_time', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_cannot_edit_conditions', compact($vars))); + + if (!$force_edit_allowed) + { + if ($s_cannot_edit) + { + trigger_error('USER_CANNOT_EDIT'); + } + else if ($s_cannot_edit_time) + { + trigger_error('CANNOT_EDIT_TIME'); + } + else if ($s_cannot_edit_locked) + { + trigger_error('CANNOT_EDIT_POST_LOCKED'); + } + } +} + +// Handle delete mode... +if ($mode == 'delete' || $mode == 'soft_delete') +{ + if ($mode == 'soft_delete' && $post_data['post_visibility'] == ITEM_DELETED) + { + $user->setup('posting'); + trigger_error('NO_POST'); + } + + $delete_reason = $request->variable('delete_reason', '', true); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete' && !$request->is_set_post('delete_permanent')), $delete_reason); + return; +} + +// Handle bump mode... +if ($mode == 'bump') +{ + if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id']) + && check_link_hash($request->variable('hash', ''), "topic_{$post_data['topic_id']}")) + { + $meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time); + meta_refresh(3, $meta_url); + $message = $user->lang['TOPIC_BUMPED']; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('VIEW_MESSAGE', '', ''); + $message .= '

' . $user->lang('RETURN_FORUM', '', ''); + } + + trigger_error($message); + } + + trigger_error('BUMP_ERROR'); +} + +// Subject length limiting to 60 characters if first post... +if ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_data['post_id'])) +{ + $template->assign_var('S_NEW_MESSAGE', true); +} + +// Determine some vars +if (isset($post_data['poster_id']) && $post_data['poster_id'] == ANONYMOUS) +{ + $post_data['quote_username'] = (!empty($post_data['post_username'])) ? $post_data['post_username'] : $user->lang['GUEST']; +} +else +{ + $post_data['quote_username'] = isset($post_data['username']) ? $post_data['username'] : ''; +} + +$post_data['post_edit_locked'] = (isset($post_data['post_edit_locked'])) ? (int) $post_data['post_edit_locked'] : 0; +$post_data['post_subject_md5'] = (isset($post_data['post_subject']) && $mode == 'edit') ? md5($post_data['post_subject']) : ''; +$post_data['post_subject'] = (in_array($mode, array('quote', 'edit'))) ? $post_data['post_subject'] : ((isset($post_data['topic_title'])) ? $post_data['topic_title'] : ''); +$post_data['topic_time_limit'] = (isset($post_data['topic_time_limit'])) ? (($post_data['topic_time_limit']) ? (int) $post_data['topic_time_limit'] / 86400 : (int) $post_data['topic_time_limit']) : 0; +$post_data['poll_length'] = (!empty($post_data['poll_length'])) ? (int) $post_data['poll_length'] / 86400 : 0; +$post_data['poll_start'] = (!empty($post_data['poll_start'])) ? (int) $post_data['poll_start'] : 0; +$post_data['icon_id'] = (!isset($post_data['icon_id']) || in_array($mode, array('quote', 'reply'))) ? 0 : (int) $post_data['icon_id']; +$post_data['poll_options'] = array(); + +// Get Poll Data +if ($post_data['poll_start']) +{ + $sql = 'SELECT poll_option_text + FROM ' . POLL_OPTIONS_TABLE . " + WHERE topic_id = $topic_id + ORDER BY poll_option_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $post_data['poll_options'][] = trim($row['poll_option_text']); + } + $db->sql_freeresult($result); +} + +/** +* This event allows you to modify the post data before parsing +* +* @event core.posting_modify_post_data +* @var int forum_id ID of the forum +* @var string mode What action to take if the form has been submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var array post_data Array with post data +* @var int post_id ID of the post +* @var int topic_id ID of the topic +* @since 3.2.2-RC1 +*/ +$vars = array( + 'forum_id', + 'mode', + 'post_data', + 'post_id', + 'topic_id', +); +extract($phpbb_dispatcher->trigger_event('core.posting_modify_post_data', compact($vars))); + +if ($mode == 'edit') +{ + $original_poll_data = array( + 'poll_title' => $post_data['poll_title'], + 'poll_length' => $post_data['poll_length'], + 'poll_max_options' => $post_data['poll_max_options'], + 'poll_option_text' => implode("\n", $post_data['poll_options']), + 'poll_start' => $post_data['poll_start'], + 'poll_last_vote' => $post_data['poll_last_vote'], + 'poll_vote_change' => $post_data['poll_vote_change'], + ); +} + +$orig_poll_options_size = count($post_data['poll_options']); + +$message_parser = new parse_message(); +/* @var $plupload \phpbb\plupload\plupload */ +$plupload = $phpbb_container->get('plupload'); + +/* @var $mimetype_guesser \phpbb\mimetype\guesser */ +$mimetype_guesser = $phpbb_container->get('mimetype.guesser'); +$message_parser->set_plupload($plupload); + +if (isset($post_data['post_text'])) +{ + $message_parser->message = &$post_data['post_text']; + unset($post_data['post_text']); +} + +// Set some default variables +$uninit = array('post_attachment' => 0, 'poster_id' => $user->data['user_id'], 'enable_magic_url' => 0, 'topic_status' => 0, 'topic_type' => POST_NORMAL, 'post_subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '', 'notify_set' => 0); + +/** +* This event allows you to modify the default variables for post_data, and unset them in post_data if needed +* +* @event core.posting_modify_default_variables +* @var array post_data Array with post data +* @var array uninit Array with default vars to put into post_data, if they aren't there +* @since 3.2.5-RC1 +*/ +$vars = array( + 'post_data', + 'uninit', +); +extract($phpbb_dispatcher->trigger_event('core.posting_modify_default_variables', compact($vars))); + +foreach ($uninit as $var_name => $default_value) +{ + if (!isset($post_data[$var_name])) + { + $post_data[$var_name] = $default_value; + } +} +unset($uninit); + +// Always check if the submitted attachment data is valid and belongs to the user. +// Further down (especially in submit_post()) we do not check this again. +$message_parser->get_submitted_attachment_data($post_data['poster_id']); + +if ($post_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode == 'edit') +{ + // Do not change to SELECT * + $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename, filesize + FROM ' . ATTACHMENTS_TABLE . " + WHERE post_msg_id = $post_id + AND in_message = 0 + AND is_orphan = 0 + ORDER BY attach_id DESC"; + $result = $db->sql_query($sql); + $message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result)); + $db->sql_freeresult($result); +} + +if ($post_data['poster_id'] == ANONYMOUS) +{ + $post_data['username'] = ($mode == 'quote' || $mode == 'edit') ? trim($post_data['post_username']) : ''; +} +else +{ + $post_data['username'] = ($mode == 'quote' || $mode == 'edit') ? trim($post_data['username']) : ''; +} + +$post_data['enable_urls'] = $post_data['enable_magic_url']; + +if ($mode != 'edit') +{ + $post_data['enable_sig'] = ($config['allow_sig'] && $user->optionget('attachsig')) ? true: false; + $post_data['enable_smilies'] = ($config['allow_smilies'] && $user->optionget('smilies')) ? true : false; + $post_data['enable_bbcode'] = ($config['allow_bbcode'] && $user->optionget('bbcode')) ? true : false; + $post_data['enable_urls'] = true; +} + +if ($mode == 'post') +{ + $post_data['topic_status'] = ($request->is_set_post('lock_topic') && $auth->acl_gets('m_lock', 'f_user_lock', $forum_id)) ? ITEM_LOCKED : ITEM_UNLOCKED; +} + +$post_data['enable_magic_url'] = $post_data['drafts'] = false; + +// User own some drafts? +if ($user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) +{ + $sql = 'SELECT draft_id + FROM ' . DRAFTS_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . + (($forum_id) ? ' AND forum_id = ' . (int) $forum_id : '') . + (($topic_id) ? ' AND topic_id = ' . (int) $topic_id : '') . + (($draft_id) ? " AND draft_id <> $draft_id" : ''); + $result = $db->sql_query_limit($sql, 1); + + if ($db->sql_fetchrow($result)) + { + $post_data['drafts'] = true; + } + $db->sql_freeresult($result); +} + +$check_value = (($post_data['enable_bbcode']+1) << 8) + (($post_data['enable_smilies']+1) << 4) + (($post_data['enable_urls']+1) << 2) + (($post_data['enable_sig']+1) << 1); + +// Check if user is watching this topic +if ($mode != 'post' && $config['allow_topic_notify'] && $user->data['is_registered']) +{ + $sql = 'SELECT topic_id + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . $topic_id . ' + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $post_data['notify_set'] = (int) $db->sql_fetchfield('topic_id'); + $db->sql_freeresult($result); +} + +// Do we want to edit our post ? +if ($mode == 'edit' && $post_data['bbcode_uid']) +{ + $message_parser->bbcode_uid = $post_data['bbcode_uid']; +} + +// HTML, BBCode, Smilies, Images and Flash status +$bbcode_status = ($config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id)) ? true : false; +$smilies_status = ($config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id)) ? true : false; +$img_status = ($bbcode_status && $auth->acl_get('f_img', $forum_id)) ? true : false; +$url_status = ($config['allow_post_links']) ? true : false; +$flash_status = ($bbcode_status && $auth->acl_get('f_flash', $forum_id) && $config['allow_post_flash']) ? true : false; +$quote_status = true; + +// Save Draft +if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) +{ + $subject = $request->variable('subject', '', true); + $subject = (!$subject && $mode != 'post') ? $post_data['topic_title'] : $subject; + $message = $request->variable('message', '', true); + + if ($subject && $message) + { + if (confirm_box(true)) + { + $message_parser->message = $message; + $message_parser->parse($post_data['enable_bbcode'], ($config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']); + + $sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'user_id' => (int) $user->data['user_id'], + 'topic_id' => (int) $topic_id, + 'forum_id' => (int) $forum_id, + 'save_time' => (int) $current_time, + 'draft_subject' => (string) $subject, + 'draft_message' => (string) $message_parser->message) + ); + $db->sql_query($sql); + + $meta_info = ($mode == 'post') ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); + + meta_refresh(3, $meta_info); + + $message = $user->lang['DRAFT_SAVED'] . '

'; + $message .= ($mode != 'post') ? sprintf($user->lang['RETURN_TOPIC'], '', '') . '

' : ''; + $message .= sprintf($user->lang['RETURN_FORUM'], '', ''); + + trigger_error($message); + } + else + { + $s_hidden_fields = build_hidden_fields(array( + 'mode' => $mode, + 'save' => true, + 'f' => $forum_id, + 't' => $topic_id, + 'subject' => $subject, + 'message' => $message, + 'attachment_data' => $message_parser->attachment_data, + ) + ); + + $hidden_fields = array( + 'icon_id' => 0, + + 'disable_bbcode' => false, + 'disable_smilies' => false, + 'disable_magic_url' => false, + 'attach_sig' => true, + 'lock_topic' => false, + + 'topic_type' => POST_NORMAL, + 'topic_time_limit' => 0, + + 'poll_title' => '', + 'poll_option_text' => '', + 'poll_max_options' => 1, + 'poll_length' => 0, + 'poll_vote_change' => false, + ); + + foreach ($hidden_fields as $name => $default) + { + if (!isset($_POST[$name])) + { + // Don't include it, if its not available + unset($hidden_fields[$name]); + continue; + } + + if (is_bool($default)) + { + // Use the string representation + $hidden_fields[$name] = $request->variable($name, ''); + } + else + { + $hidden_fields[$name] = $request->variable($name, $default); + } + } + + $s_hidden_fields .= build_hidden_fields($hidden_fields); + + confirm_box(false, 'SAVE_DRAFT', $s_hidden_fields); + } + } + else + { + if (utf8_clean_string($subject) === '') + { + $error[] = $user->lang['EMPTY_SUBJECT']; + } + + if (utf8_clean_string($message) === '') + { + $error[] = $user->lang['TOO_FEW_CHARS']; + } + } + unset($subject, $message); +} + +// Load requested Draft +if ($draft_id && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $user->data['is_registered'] && $auth->acl_get('u_savedrafts')) +{ + $sql = 'SELECT draft_subject, draft_message + FROM ' . DRAFTS_TABLE . " + WHERE draft_id = $draft_id + AND user_id = " . $user->data['user_id']; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $post_data['post_subject'] = $row['draft_subject']; + $message_parser->message = $row['draft_message']; + + $template->assign_var('S_DRAFT_LOADED', true); + } + else + { + $draft_id = 0; + } +} + +// Load draft overview +if ($load && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_data['drafts']) +{ + load_drafts($topic_id, $forum_id); +} + +/** @var \phpbb\textformatter\utils_interface $bbcode_utils */ +$bbcode_utils = $phpbb_container->get('text_formatter.utils'); + +if ($submit || $preview || $refresh) +{ + $post_data['topic_cur_post_id'] = $request->variable('topic_cur_post_id', 0); + $post_data['post_subject'] = $request->variable('subject', '', true); + $message_parser->message = $request->variable('message', '', true); + + $post_data['username'] = $request->variable('username', $post_data['username'], true); + $post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? $request->variable('edit_reason', '', true) : ''; + + $post_data['orig_topic_type'] = $post_data['topic_type']; + $post_data['topic_type'] = $request->variable('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL)); + $post_data['topic_time_limit'] = $request->variable('topic_time_limit', (($mode != 'post') ? (int) $post_data['topic_time_limit'] : 0)); + + if ($post_data['enable_icons'] && $auth->acl_get('f_icons', $forum_id)) + { + $post_data['icon_id'] = $request->variable('icon', (int) $post_data['icon_id']); + } + + $post_data['enable_bbcode'] = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true; + $post_data['enable_smilies'] = (!$smilies_status || isset($_POST['disable_smilies'])) ? false : true; + $post_data['enable_urls'] = (isset($_POST['disable_magic_url'])) ? 0 : 1; + $post_data['enable_sig'] = (!$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig')) ? false : ((isset($_POST['attach_sig']) && $user->data['is_registered']) ? true : false); + + if ($config['allow_topic_notify'] && $user->data['is_registered']) + { + $notify = (isset($_POST['notify'])) ? true : false; + } + else + { + $notify = false; + } + + $topic_lock = (isset($_POST['lock_topic'])) ? true : false; + $post_lock = (isset($_POST['lock_post'])) ? true : false; + $poll_delete = (isset($_POST['poll_delete'])) ? true : false; + + if ($submit) + { + $status_switch = (($post_data['enable_bbcode']+1) << 8) + (($post_data['enable_smilies']+1) << 4) + (($post_data['enable_urls']+1) << 2) + (($post_data['enable_sig']+1) << 1); + $status_switch = ($status_switch != $check_value); + } + else + { + $status_switch = 1; + } + + // Delete Poll + if ($poll_delete && $mode == 'edit' && count($post_data['poll_options']) && + ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))) + { + if ($submit && check_form_key('posting')) + { + $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . " + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . POLL_VOTES_TABLE . " + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + + $topic_sql = array( + 'poll_title' => '', + 'poll_start' => 0, + 'poll_length' => 0, + 'poll_last_vote' => 0, + 'poll_max_options' => 0, + 'poll_vote_change' => 0 + ); + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $topic_sql) . " + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + } + + $post_data['poll_title'] = $post_data['poll_option_text'] = ''; + $post_data['poll_vote_change'] = $post_data['poll_max_options'] = $post_data['poll_length'] = 0; + } + else + { + $post_data['poll_title'] = $request->variable('poll_title', '', true); + $post_data['poll_length'] = $request->variable('poll_length', 0); + $post_data['poll_option_text'] = $request->variable('poll_option_text', '', true); + $post_data['poll_max_options'] = $request->variable('poll_max_options', 1); + $post_data['poll_vote_change'] = ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0; + } + + // If replying/quoting and last post id has changed + // give user option to continue submit or return to post + // notify and show user the post made between his request and the final submit + if (($mode == 'reply' || $mode == 'quote') && $post_data['topic_cur_post_id'] && $post_data['topic_cur_post_id'] != $post_data['topic_last_post_id']) + { + // Only do so if it is allowed forum-wide + if ($post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) + { + if (topic_review($topic_id, $forum_id, 'post_review', $post_data['topic_cur_post_id'])) + { + $template->assign_var('S_POST_REVIEW', true); + } + + $submit = false; + $refresh = true; + } + } + + // Parse Attachments - before checksum is calculated + if ($message_parser->check_attachment_form_token($language, $request, 'posting')) + { + $message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh); + } + + /** + * This event allows you to modify message text before parsing + * + * @event core.posting_modify_message_text + * @var array post_data Array with post data + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete|bump|smilies|popup + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var bool submit Whether or not the form has been submitted + * @var bool preview Whether or not the post is being previewed + * @var bool save Whether or not a draft is being saved + * @var bool load Whether or not a draft is being loaded + * @var bool cancel Whether or not to cancel the form (returns to + * viewtopic or viewforum depending on if the user + * is posting a new topic or editing a post) + * @var bool refresh Whether or not to retain previously submitted data + * @var object message_parser The message parser object + * @var array error Array of errors + * @since 3.1.2-RC1 + * @changed 3.1.11-RC1 Added error + */ + $vars = array( + 'post_data', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'submit', + 'preview', + 'save', + 'load', + 'cancel', + 'refresh', + 'message_parser', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars))); + + // Grab md5 'checksum' of new message + $message_md5 = md5($message_parser->message); + + // If editing and checksum has changed we know the post was edited while we're editing + // Notify and show user the changed post + if ($mode == 'edit' && $post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) + { + $edit_post_message_checksum = $request->variable('edit_post_message_checksum', ''); + $edit_post_subject_checksum = $request->variable('edit_post_subject_checksum', ''); + + // $post_data['post_checksum'] is the checksum of the post submitted in the meantime + // $message_md5 is the checksum of the post we're about to submit + // $edit_post_message_checksum is the checksum of the post we're editing + // ... + + // We make sure nobody else made exactly the same change + // we're about to submit by also checking $message_md5 != $post_data['post_checksum'] + if ($edit_post_message_checksum !== '' && + $edit_post_message_checksum != $post_data['post_checksum'] && + $message_md5 != $post_data['post_checksum'] + || + $edit_post_subject_checksum !== '' && + $edit_post_subject_checksum != $post_data['post_subject_md5'] && + md5($post_data['post_subject']) != $post_data['post_subject_md5']) + { + if (topic_review($topic_id, $forum_id, 'post_review_edit', $post_id)) + { + $template->assign_vars(array( + 'S_POST_REVIEW' => true, + + 'L_POST_REVIEW' => $user->lang['POST_REVIEW_EDIT'], + 'L_POST_REVIEW_EXPLAIN' => $user->lang['POST_REVIEW_EDIT_EXPLAIN'], + )); + } + + $submit = false; + $refresh = true; + } + } + + // Check checksum ... don't re-parse message if the same + $update_message = ($mode != 'edit' || $message_md5 != $post_data['post_checksum'] || $status_switch || strlen($post_data['bbcode_uid']) < BBCODE_UID_LEN) ? true : false; + + // Also check if subject got updated... + $update_subject = $mode != 'edit' || ($post_data['post_subject_md5'] && $post_data['post_subject_md5'] != md5($post_data['post_subject'])); + + // Parse message + if ($update_message) + { + if (count($message_parser->warn_msg)) + { + $error[] = implode('
', $message_parser->warn_msg); + $message_parser->warn_msg = array(); + } + + if (!$preview || !empty($message_parser->message)) + { + $message_parser->parse($post_data['enable_bbcode'], ($config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']); + } + + // On a refresh we do not care about message parsing errors + if (count($message_parser->warn_msg) && $refresh && !$preview) + { + $message_parser->warn_msg = array(); + } + } + else + { + $message_parser->bbcode_bitfield = $post_data['bbcode_bitfield']; + } + + $ignore_flood = $auth->acl_get('u_ignoreflood') ? true : $auth->acl_get('f_ignoreflood', $forum_id); + if ($mode != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$ignore_flood) + { + // Flood check + $last_post_time = 0; + + if ($user->data['is_registered']) + { + $last_post_time = $user->data['user_lastpost_time']; + } + else + { + $sql = 'SELECT post_time AS last_post_time + FROM ' . POSTS_TABLE . " + WHERE poster_ip = '" . $user->ip . "' + AND post_time > " . ($current_time - $config['flood_interval']); + $result = $db->sql_query_limit($sql, 1); + if ($row = $db->sql_fetchrow($result)) + { + $last_post_time = $row['last_post_time']; + } + $db->sql_freeresult($result); + } + + if ($last_post_time && ($current_time - $last_post_time) < intval($config['flood_interval'])) + { + $error[] = $user->lang['FLOOD_ERROR']; + } + } + + // Validate username + if (($post_data['username'] && !$user->data['is_registered']) || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS && $post_data['username'] && $post_data['post_username'] && $post_data['post_username'] != $post_data['username'])) + { + if (!function_exists('validate_username')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $user->add_lang('ucp'); + + if (($result = validate_username($post_data['username'], (!empty($post_data['post_username'])) ? $post_data['post_username'] : '')) !== false) + { + $error[] = $user->lang[$result . '_USERNAME']; + } + + if (($result = validate_string($post_data['username'], false, $config['min_name_chars'], $config['max_name_chars'])) !== false) + { + $min_max_amount = ($result == 'TOO_SHORT') ? $config['min_name_chars'] : $config['max_name_chars']; + $error[] = $user->lang('FIELD_' . $result, $min_max_amount, $user->lang['USERNAME']); + } + } + + if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) + { + $captcha_data = array( + 'message' => $request->variable('message', '', true), + 'subject' => $request->variable('subject', '', true), + 'username' => $request->variable('username', '', true), + ); + $vc_response = $captcha->validate($captcha_data); + if ($vc_response) + { + $error[] = $vc_response; + } + } + + // check form + if (($submit || $preview) && !check_form_key('posting')) + { + $error[] = $user->lang['FORM_INVALID']; + } + + if ($submit && $mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED && !isset($_POST['soft_delete']) && $auth->acl_get('m_approve', $forum_id)) + { + $is_first_post = ($post_id == $post_data['topic_first_post_id'] || !$post_data['topic_posts_approved']); + $is_last_post = ($post_id == $post_data['topic_last_post_id'] || !$post_data['topic_posts_approved']); + $updated_post_data = $phpbb_content_visibility->set_post_visibility(ITEM_APPROVED, $post_id, $post_data['topic_id'], $post_data['forum_id'], $user->data['user_id'], time(), '', $is_first_post, $is_last_post); + + if (!empty($updated_post_data)) + { + // Update the post_data, so we don't need to refetch it. + $post_data = array_merge($post_data, $updated_post_data); + } + } + + // Parse subject + if (!$preview && !$refresh && utf8_clean_string($post_data['post_subject']) === '' && ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id))) + { + $error[] = $user->lang['EMPTY_SUBJECT']; + } + + /** + * Replace Emojis and other 4bit UTF-8 chars not allowed by MySQL to UCR/NCR. + * Using their Numeric Character Reference's Hexadecimal notation. + * Check the permissions for posting Emojis first. + */ + if ($auth->acl_get('u_emoji')) + { + $post_data['post_subject'] = utf8_encode_ucr($post_data['post_subject']); + } + else + { + /** + * Check for out-of-bounds characters that are currently + * not supported by utf8_bin in MySQL + */ + if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $post_data['post_subject'], $matches)) + { + $character_list = implode('
', $matches[0]); + + $error[] = $user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list); + } + } + + $post_data['poll_last_vote'] = (isset($post_data['poll_last_vote'])) ? $post_data['poll_last_vote'] : 0; + + if ($post_data['poll_option_text'] && + ($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/)) + && $auth->acl_get('f_poll', $forum_id)) + { + $poll = array( + 'poll_title' => $post_data['poll_title'], + 'poll_length' => $post_data['poll_length'], + 'poll_max_options' => $post_data['poll_max_options'], + 'poll_option_text' => $post_data['poll_option_text'], + 'poll_start' => $post_data['poll_start'], + 'poll_last_vote' => $post_data['poll_last_vote'], + 'poll_vote_change' => $post_data['poll_vote_change'], + 'enable_bbcode' => $post_data['enable_bbcode'], + 'enable_urls' => $post_data['enable_urls'], + 'enable_smilies' => $post_data['enable_smilies'], + 'img_status' => $img_status + ); + + $message_parser->parse_poll($poll); + + $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : array(); + $post_data['poll_title'] = (isset($poll['poll_title'])) ? $poll['poll_title'] : ''; + + /* We reset votes, therefore also allow removing options + if ($post_data['poll_last_vote'] && ($poll['poll_options_size'] < $orig_poll_options_size)) + { + $message_parser->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS']; + }*/ + } + else if ($mode == 'edit' && $post_id == $post_data['topic_first_post_id'] && $auth->acl_get('f_poll', $forum_id)) + { + // The user removed all poll options, this is equal to deleting the poll. + $poll = array( + 'poll_title' => '', + 'poll_length' => 0, + 'poll_max_options' => 0, + 'poll_option_text' => '', + 'poll_start' => 0, + 'poll_last_vote' => 0, + 'poll_vote_change' => 0, + 'poll_options' => array(), + ); + + $post_data['poll_options'] = array(); + $post_data['poll_title'] = ''; + $post_data['poll_start'] = $post_data['poll_length'] = $post_data['poll_max_options'] = $post_data['poll_last_vote'] = $post_data['poll_vote_change'] = 0; + } + else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && !$bbcode_utils->is_empty($original_poll_data['poll_title'])) + { + // We have a poll but the editing user is not permitted to create/edit it. + // So we just keep the original poll-data. + // Decode the poll title and options text fisrt. + $original_poll_data['poll_title'] = $bbcode_utils->unparse($original_poll_data['poll_title']); + $original_poll_data['poll_option_text'] = $bbcode_utils->unparse($original_poll_data['poll_option_text']); + $original_poll_data['poll_options'] = explode("\n", $original_poll_data['poll_option_text']); + + $poll = array_merge($original_poll_data, array( + 'enable_bbcode' => $post_data['enable_bbcode'], + 'enable_urls' => $post_data['enable_urls'], + 'enable_smilies' => $post_data['enable_smilies'], + 'img_status' => $img_status, + )); + + $message_parser->parse_poll($poll); + + $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : array(); + $post_data['poll_title'] = (isset($poll['poll_title'])) ? $poll['poll_title'] : ''; + } + else + { + $poll = array(); + } + + // Check topic type + if ($post_data['topic_type'] != POST_NORMAL && ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id))) + { + switch ($post_data['topic_type']) + { + case POST_GLOBAL: + $auth_option = 'f_announce_global'; + break; + + case POST_ANNOUNCE: + $auth_option = 'f_announce'; + break; + + case POST_STICKY: + $auth_option = 'f_sticky'; + break; + + default: + $auth_option = ''; + break; + } + + if ($auth_option != '' && !$auth->acl_get($auth_option, $forum_id)) + { + // There is a special case where a user edits his post whereby the topic type got changed by an admin/mod. + // Another case would be a mod not having sticky permissions for example but edit permissions. + if ($mode == 'edit') + { + // To prevent non-authed users messing around with the topic type we reset it to the original one. + $post_data['topic_type'] = $post_data['orig_topic_type']; + } + else + { + $error[] = $user->lang['CANNOT_POST_' . str_replace('F_', '', strtoupper($auth_option))]; + } + } + } + + if (count($message_parser->warn_msg)) + { + $error[] = implode('
', $message_parser->warn_msg); + } + + // DNSBL check + if ($config['check_dnsbl'] && !$refresh) + { + if (($dnsbl = $user->check_dnsbl('post')) !== false) + { + $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]); + } + } + + /** + * This event allows you to define errors before the post action is performed + * + * @event core.posting_modify_submission_errors + * @var array post_data Array with post data + * @var array poll Array with poll data from post (must be used instead of the post_data equivalent) + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete|bump|smilies|popup + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var bool submit Whether or not the form has been submitted + * @var array error Any error strings; a non-empty array aborts form submission. + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + * @changed 3.1.5-RC1 Added poll array to the event + * @changed 3.2.0-a1 Removed undefined page_title + */ + $vars = array( + 'post_data', + 'poll', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'submit', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submission_errors', compact($vars))); + + // Store message, sync counters + if (!count($error) && $submit) + { + if ($submit) + { + // Lock/Unlock Topic + $change_topic_status = $post_data['topic_status']; + $perm_lock_unlock = ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED)) ? true : false; + + if ($post_data['topic_status'] == ITEM_LOCKED && !$topic_lock && $perm_lock_unlock) + { + $change_topic_status = ITEM_UNLOCKED; + } + else if ($post_data['topic_status'] == ITEM_UNLOCKED && $topic_lock && $perm_lock_unlock) + { + $change_topic_status = ITEM_LOCKED; + } + + if ($change_topic_status != $post_data['topic_status']) + { + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_status = $change_topic_status + WHERE topic_id = $topic_id + AND topic_moved_id = 0"; + $db->sql_query($sql); + + $user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster']) ? 'USER_' : ''; + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $post_data['topic_title'] + )); + } + + // Lock/Unlock Post Edit + if ($mode == 'edit' && $post_data['post_edit_locked'] == ITEM_LOCKED && !$post_lock && $auth->acl_get('m_edit', $forum_id)) + { + $post_data['post_edit_locked'] = ITEM_UNLOCKED; + } + else if ($mode == 'edit' && $post_data['post_edit_locked'] == ITEM_UNLOCKED && $post_lock && $auth->acl_get('m_edit', $forum_id)) + { + $post_data['post_edit_locked'] = ITEM_LOCKED; + } + + $data = array( + 'topic_title' => (empty($post_data['topic_title'])) ? $post_data['post_subject'] : $post_data['topic_title'], + 'topic_first_post_id' => (isset($post_data['topic_first_post_id'])) ? (int) $post_data['topic_first_post_id'] : 0, + 'topic_last_post_id' => (isset($post_data['topic_last_post_id'])) ? (int) $post_data['topic_last_post_id'] : 0, + 'topic_time_limit' => (int) $post_data['topic_time_limit'], + 'topic_attachment' => (isset($post_data['topic_attachment'])) ? (int) $post_data['topic_attachment'] : 0, + 'post_id' => (int) $post_id, + 'topic_id' => (int) $topic_id, + 'forum_id' => (int) $forum_id, + 'icon_id' => (int) $post_data['icon_id'], + 'poster_id' => (int) $post_data['poster_id'], + 'enable_sig' => (bool) $post_data['enable_sig'], + 'enable_bbcode' => (bool) $post_data['enable_bbcode'], + 'enable_smilies' => (bool) $post_data['enable_smilies'], + 'enable_urls' => (bool) $post_data['enable_urls'], + 'enable_indexing' => (bool) $post_data['enable_indexing'], + 'message_md5' => (string) $message_md5, + 'post_checksum' => (isset($post_data['post_checksum'])) ? (string) $post_data['post_checksum'] : '', + 'post_edit_reason' => $post_data['post_edit_reason'], + 'post_edit_user' => ($mode == 'edit') ? $user->data['user_id'] : ((isset($post_data['post_edit_user'])) ? (int) $post_data['post_edit_user'] : 0), + 'forum_parents' => $post_data['forum_parents'], + 'forum_name' => $post_data['forum_name'], + 'notify' => $notify, + 'notify_set' => $post_data['notify_set'], + 'poster_ip' => (isset($post_data['poster_ip'])) ? $post_data['poster_ip'] : $user->ip, + 'post_edit_locked' => (int) $post_data['post_edit_locked'], + 'bbcode_bitfield' => $message_parser->bbcode_bitfield, + 'bbcode_uid' => $message_parser->bbcode_uid, + 'message' => $message_parser->message, + 'attachment_data' => $message_parser->attachment_data, + 'filename_data' => $message_parser->filename_data, + 'topic_status' => $post_data['topic_status'], + + 'topic_visibility' => (isset($post_data['topic_visibility'])) ? $post_data['topic_visibility'] : false, + 'post_visibility' => (isset($post_data['post_visibility'])) ? $post_data['post_visibility'] : false, + ); + + if ($mode == 'edit') + { + $data['topic_posts_approved'] = $post_data['topic_posts_approved']; + $data['topic_posts_unapproved'] = $post_data['topic_posts_unapproved']; + $data['topic_posts_softdeleted'] = $post_data['topic_posts_softdeleted']; + } + + // Only return the username when it is either a guest posting or we are editing a post and + // the username was supplied; otherwise post_data might hold the data of the post that is + // being quoted (which could result in the username being returned being that of the quoted + // post's poster, not the poster of the current post). See: PHPBB3-11769 for more information. + $post_author_name = ((!$user->data['is_registered'] || $mode == 'edit') && $post_data['username'] !== '') ? $post_data['username'] : ''; + + /** + * This event allows you to define errors before the post action is performed + * + * @event core.posting_modify_submit_post_before + * @var array post_data Array with post data + * @var array poll Array with poll data + * @var array data Array with post data going to be stored in the database + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var string post_author_name Author name for guest posts + * @var bool update_message Boolean if the post message was changed + * @var bool update_subject Boolean if the post subject was changed + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.2.0-a1 Removed undefined page_title + */ + $vars = array( + 'post_data', + 'poll', + 'data', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'post_author_name', + 'update_message', + 'update_subject', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submit_post_before', compact($vars))); + + // The last parameter tells submit_post if search indexer has to be run + $redirect_url = submit_post($mode, $post_data['post_subject'], $post_author_name, $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false); + + /** + * This event allows you to define errors after the post action is performed + * + * @event core.posting_modify_submit_post_after + * @var array post_data Array with post data + * @var array poll Array with poll data + * @var array data Array with post data going to be stored in the database + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var string post_author_name Author name for guest posts + * @var bool update_message Boolean if the post message was changed + * @var bool update_subject Boolean if the post subject was changed + * @var string redirect_url URL the user is going to be redirected to + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.2.0-a1 Removed undefined page_title + */ + $vars = array( + 'post_data', + 'poll', + 'data', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'post_author_name', + 'update_message', + 'update_subject', + 'redirect_url', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submit_post_after', compact($vars))); + + if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === true) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) + { + $captcha->reset(); + } + + // Handle delete mode... + if ($request->is_set_post('delete') || $request->is_set_post('delete_permanent')) + { + $delete_reason = $request->variable('delete_reason', '', true); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $delete_reason); + return; + } + + // Check the permissions for post approval. + // Moderators must go through post approval like ordinary users. + if ((!$auth->acl_get('f_noapprove', $data['forum_id']) && empty($data['force_approved_state'])) || (isset($data['force_approved_state']) && !$data['force_approved_state'])) + { + meta_refresh(10, $redirect_url); + $message = ($mode == 'edit') ? $user->lang['POST_EDITED_MOD'] : $user->lang['POST_STORED_MOD']; + $message .= (($user->data['user_id'] == ANONYMOUS) ? '' : ' '. $user->lang['POST_APPROVAL_NOTIFY']); + $message .= '

' . sprintf($user->lang['RETURN_FORUM'], '', ''); + trigger_error($message); + } + + redirect($redirect_url); + } + } +} + +// Preview +if (!count($error) && $preview) +{ + $post_data['post_time'] = ($mode == 'edit') ? $post_data['post_time'] : $current_time; + + $preview_message = $message_parser->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies'], false); + + $preview_signature = ($mode == 'edit') ? $post_data['user_sig'] : $user->data['user_sig']; + $preview_signature_uid = ($mode == 'edit') ? $post_data['user_sig_bbcode_uid'] : $user->data['user_sig_bbcode_uid']; + $preview_signature_bitfield = ($mode == 'edit') ? $post_data['user_sig_bbcode_bitfield'] : $user->data['user_sig_bbcode_bitfield']; + + // Signature + if ($post_data['enable_sig'] && $config['allow_sig'] && $preview_signature && $auth->acl_get('f_sigs', $forum_id)) + { + $flags = ($config['allow_sig_bbcode']) ? OPTION_FLAG_BBCODE : 0; + $flags |= ($config['allow_sig_links']) ? OPTION_FLAG_LINKS : 0; + $flags |= ($config['allow_sig_smilies']) ? OPTION_FLAG_SMILIES : 0; + + $preview_signature = generate_text_for_display($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $flags, false); + } + else + { + $preview_signature = ''; + } + + $preview_subject = censor_text($post_data['post_subject']); + + // Poll Preview + if (!$poll_delete && ($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/)) + && $auth->acl_get('f_poll', $forum_id)) + { + $parse_poll = new parse_message($post_data['poll_title']); + $parse_poll->bbcode_uid = $message_parser->bbcode_uid; + $parse_poll->bbcode_bitfield = $message_parser->bbcode_bitfield; + + $parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']); + + if ($post_data['poll_length']) + { + $poll_end = ($post_data['poll_length'] * 86400) + (($post_data['poll_start']) ? $post_data['poll_start'] : time()); + } + + $template->assign_vars(array( + 'S_HAS_POLL_OPTIONS' => (count($post_data['poll_options'])), + 'S_IS_MULTI_CHOICE' => ($post_data['poll_max_options'] > 1) ? true : false, + + 'POLL_QUESTION' => $parse_poll->message, + + 'L_POLL_LENGTH' => ($post_data['poll_length']) ? sprintf($user->lang['POLL_RUN_TILL'], $user->format_date($poll_end)) : '', + 'L_MAX_VOTES' => $user->lang('MAX_OPTIONS_SELECT', (int) $post_data['poll_max_options']), + )); + + $preview_poll_options = array(); + foreach ($post_data['poll_options'] as $poll_option) + { + $parse_poll->message = $poll_option; + $parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']); + $preview_poll_options[] = $parse_poll->message; + } + unset($parse_poll); + + foreach ($preview_poll_options as $key => $option) + { + $template->assign_block_vars('poll_option', array( + 'POLL_OPTION_CAPTION' => $option, + 'POLL_OPTION_ID' => $key + 1) + ); + } + unset($preview_poll_options); + } + + // Attachment Preview + if (count($message_parser->attachment_data)) + { + $template->assign_var('S_HAS_ATTACHMENTS', true); + + $update_count = array(); + $attachment_data = $message_parser->attachment_data; + + parse_attachments($forum_id, $preview_message, $attachment_data, $update_count, true); + + foreach ($attachment_data as $i => $attachment) + { + $template->assign_block_vars('attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + unset($attachment_data); + } + + if (!count($error)) + { + $template->assign_vars(array( + 'PREVIEW_SUBJECT' => $preview_subject, + 'PREVIEW_MESSAGE' => $preview_message, + 'PREVIEW_SIGNATURE' => $preview_signature, + + 'S_DISPLAY_PREVIEW' => !empty($preview_message), + )); + } +} + +// Remove quotes that would become nested too deep before decoding the text +$generate_quote = ($mode == 'quote' && !$submit && !$preview && !$refresh); +if ($generate_quote && $config['max_quote_depth'] > 0) +{ + $tmp_bbcode_uid = $message_parser->bbcode_uid; + $message_parser->bbcode_uid = $post_data['bbcode_uid']; + $message_parser->remove_nested_quotes($config['max_quote_depth'] - 1); + $message_parser->bbcode_uid = $tmp_bbcode_uid; +} + +// Decode text for message display +$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !count($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid; +$message_parser->decode_message($post_data['bbcode_uid']); + +if ($generate_quote) +{ + // Remove attachment bbcode tags from the quoted message to avoid mixing with the new post attachments if any + $message_parser->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#uis', '\\2', $message_parser->message); + + $quote_attributes = array( + 'author' => $post_data['quote_username'], + 'post_id' => $post_data['post_id'], + 'time' => $post_data['post_time'], + 'user_id' => $post_data['poster_id'], + ); + + /** + * This event allows you to modify the quote attributes of the post being quoted + * + * @event core.posting_modify_quote_attributes + * @var array quote_attributes Array with quote attributes + * @var array post_data Array with post data + * @since 3.2.6-RC1 + */ + $vars = array( + 'quote_attributes', + 'post_data', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_quote_attributes', compact($vars))); + + /** @var \phpbb\language\language $language */ + $language = $phpbb_container->get('language'); + phpbb_format_quote($language, $message_parser, $bbcode_utils, $bbcode_status, $quote_attributes); +} + +if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh) +{ + $post_data['post_subject'] = ((strpos($post_data['post_subject'], 'Re: ') !== 0) ? 'Re: ' : '') . censor_text($post_data['post_subject']); + + $post_subject = $post_data['post_subject']; + + /** + * This event allows you to modify the post subject of the post being quoted + * + * @event core.posting_modify_post_subject + * @var string post_subject String with the post subject already censored. + * @since 3.2.8-RC1 + */ + $vars = array('post_subject'); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_post_subject', compact($vars))); + + $post_data['post_subject'] = $post_subject; +} + +$attachment_data = $message_parser->attachment_data; +$filename_data = $message_parser->filename_data; +$post_data['post_text'] = $message_parser->message; + +if (count($post_data['poll_options']) || (isset($post_data['poll_title']) && !$bbcode_utils->is_empty($post_data['poll_title']))) +{ + $message_parser->message = $post_data['poll_title']; + $message_parser->bbcode_uid = $post_data['bbcode_uid']; + + $message_parser->decode_message(); + $post_data['poll_title'] = $message_parser->message; + + $message_parser->message = implode("\n", $post_data['poll_options']); + $message_parser->decode_message(); + $post_data['poll_options'] = explode("\n", $message_parser->message); +} + +// MAIN POSTING PAGE BEGINS HERE + +// Forum moderators? +$moderators = array(); +if ($config['load_moderators']) +{ + get_moderators($moderators, $forum_id); +} + +// Generate smiley listing +generate_smilies('inline', $forum_id); + +// Generate inline attachment select box +posting_gen_inline_attachments($attachment_data); + +// Do show topic type selection only in first post. +$topic_type_toggle = false; + +if ($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id'])) +{ + $topic_type_toggle = posting_gen_topic_types($forum_id, $post_data['topic_type']); +} + +$s_topic_icons = false; +if ($post_data['enable_icons'] && $auth->acl_get('f_icons', $forum_id)) +{ + $s_topic_icons = posting_gen_topic_icons($mode, $post_data['icon_id']); +} + +$bbcode_checked = (isset($post_data['enable_bbcode'])) ? !$post_data['enable_bbcode'] : (($config['allow_bbcode']) ? !$user->optionget('bbcode') : 1); +$smilies_checked = (isset($post_data['enable_smilies'])) ? !$post_data['enable_smilies'] : (($config['allow_smilies']) ? !$user->optionget('smilies') : 1); +$urls_checked = (isset($post_data['enable_urls'])) ? !$post_data['enable_urls'] : 0; +$sig_checked = $post_data['enable_sig']; +$lock_topic_checked = (isset($topic_lock) && $topic_lock) ? $topic_lock : (($post_data['topic_status'] == ITEM_LOCKED) ? 1 : 0); +$lock_post_checked = (isset($post_lock)) ? $post_lock : $post_data['post_edit_locked']; + +// If the user is replying or posting and not already watching this topic but set to always being notified we need to overwrite this setting +$notify_set = ($mode != 'edit' && $config['allow_topic_notify'] && $user->data['is_registered'] && !$post_data['notify_set']) ? $user->data['user_notify'] : $post_data['notify_set']; +$notify_checked = (isset($notify)) ? $notify : (($mode == 'post') ? $user->data['user_notify'] : $notify_set); + +// Page title & action URL +$s_action = append_sid("{$phpbb_root_path}posting.$phpEx", "mode=$mode&f=$forum_id"); +$s_action .= ($topic_id) ? "&t=$topic_id" : ''; +$s_action .= ($post_id) ? "&p=$post_id" : ''; + +switch ($mode) +{ + case 'post': + $page_title = $user->lang['POST_TOPIC']; + break; + + case 'quote': + case 'reply': + $page_title = $user->lang['POST_REPLY']; + break; + + case 'delete': + case 'edit': + $page_title = $user->lang['EDIT_POST']; + break; +} + +// Build Navigation Links +generate_forum_nav($post_data); + +// Build Forum Rules +generate_forum_rules($post_data); + +// Posting uses is_solved for legacy reasons. Plugins have to use is_solved to force themselves to be displayed. +if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === false) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) +{ + + $template->assign_vars(array( + 'S_CONFIRM_CODE' => true, + 'CAPTCHA_TEMPLATE' => $captcha->get_template(), + )); +} + +$s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '' : ''; +$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '' : ''; + +if ($mode == 'edit') +{ + $s_hidden_fields .= build_hidden_fields(array( + 'edit_post_message_checksum' => $post_data['post_checksum'], + 'edit_post_subject_checksum' => $post_data['post_subject_md5'], + )); +} + +// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview +if (isset($captcha) && $captcha->is_solved() !== false) +{ + $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields()); +} + +$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"'; +add_form_key('posting'); + +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); + +// Build array of variables for main posting page +$page_data = array( + 'L_POST_A' => $page_title, + 'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'], + 'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']), + 'L_DELETE_POST_PERMANENTLY' => $user->lang('DELETE_POST_PERMANENTLY', 1), + + 'FORUM_NAME' => $post_data['forum_name'], + 'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '', + 'TOPIC_TITLE' => censor_text($post_data['topic_title']), + 'MODERATORS' => (count($moderators)) ? implode($user->lang['COMMA_SEPARATOR'], $moderators[$forum_id]) : '', + 'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '', + 'SUBJECT' => $post_data['post_subject'], + 'MESSAGE' => $post_data['post_text'], + 'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), + 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'URL_STATUS' => ($bbcode_status && $url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], + 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), + 'POST_DATE' => ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'], + 'EDIT_REASON' => $request->variable('edit_reason', '', true), + 'SHOW_PANEL' => $request->variable('show_panel', ''), + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), + 'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") : '', + 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup"), + 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup")), + + 'S_PRIVMSGS' => false, + 'S_CLOSE_PROGRESS_WINDOW' => (isset($_POST['add_file'])) ? true : false, + 'S_EDIT_POST' => ($mode == 'edit') ? true : false, + 'S_EDIT_REASON' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, + 'S_DISPLAY_USERNAME' => (!$user->data['is_registered'] || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS)) ? true : false, + 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, + 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])) || $auth->acl_get('m_delete', $forum_id))) ? true : false, + 'S_BBCODE_ALLOWED' => ($bbcode_status) ? 1 : 0, + 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', + 'S_SMILIES_ALLOWED' => $smilies_status, + 'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '', + 'S_SIG_ALLOWED' => ($auth->acl_get('f_sigs', $forum_id) && $config['allow_sig'] && $user->data['is_registered']) ? true : false, + 'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '', + 'S_NOTIFY_ALLOWED' => (!$user->data['is_registered'] || ($mode == 'edit' && $user->data['user_id'] != $post_data['poster_id']) || !$config['allow_topic_notify'] || !$config['email_enable']) ? false : true, + 'S_NOTIFY_CHECKED' => ($notify_checked) ? ' checked="checked"' : '', + 'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote' || $mode == 'post') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false, + 'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '', + 'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, + 'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '', + 'S_SOFTDELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '', + 'S_SOFTDELETE_ALLOWED' => ($mode == 'edit' && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false, + 'S_RESTORE_ALLOWED' => $auth->acl_get('m_approve', $forum_id), + 'S_IS_DELETED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? true : false, + 'S_LINKS_ALLOWED' => $url_status, + 'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '', + 'S_TYPE_TOGGLE' => $topic_type_toggle, + 'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $mode != 'edit') ? true : false, + 'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $post_data['drafts']) ? true : false, + 'S_FORM_ENCTYPE' => $form_enctype, + + 'S_BBCODE_IMG' => $img_status, + 'S_BBCODE_URL' => $url_status, + 'S_BBCODE_FLASH' => $flash_status, + 'S_BBCODE_QUOTE' => $quote_status, + + 'S_POST_ACTION' => $s_action, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_ATTACH_DATA' => json_encode($message_parser->attachment_data), + 'S_IN_POSTING' => true, +); + +// Build custom bbcodes array +display_custom_bbcodes(); + +// Poll entry +if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/)) + && $auth->acl_get('f_poll', $forum_id)) +{ + $page_data = array_merge($page_data, array( + 'S_SHOW_POLL_BOX' => true, + 'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)), + 'S_POLL_DELETE' => ($mode == 'edit' && count($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))), + 'S_POLL_DELETE_CHECKED' => (!empty($poll_delete)) ? true : false, + + 'L_POLL_OPTIONS_EXPLAIN' => $user->lang('POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN', (int) $config['max_poll_options']), + + 'VOTE_CHANGE_CHECKED' => (!empty($post_data['poll_vote_change'])) ? ' checked="checked"' : '', + 'POLL_TITLE' => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '', + 'POLL_OPTIONS' => (!empty($post_data['poll_options'])) ? implode("\n", $post_data['poll_options']) : '', + 'POLL_MAX_OPTIONS' => (isset($post_data['poll_max_options'])) ? (int) $post_data['poll_max_options'] : 1, + 'POLL_LENGTH' => $post_data['poll_length'], + ) + ); +} + +/** +* This event allows you to modify template variables for the posting screen +* +* @event core.posting_modify_template_vars +* @var array post_data Array with post data +* @var array moderators Array with forum moderators +* @var string mode What action to take if the form is submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var string page_title Title of the mode page +* @var bool s_topic_icons Whether or not to show the topic icons +* @var string form_enctype If attachments are allowed for this form +* "multipart/form-data" or empty string +* @var string s_action The URL to submit the POST data to +* @var string s_hidden_fields Concatenated hidden input tags of posting form +* @var int post_id ID of the post +* @var int topic_id ID of the topic +* @var int forum_id ID of the forum +* @var int draft_id ID of the draft +* @var bool submit Whether or not the form has been submitted +* @var bool preview Whether or not the post is being previewed +* @var bool save Whether or not a draft is being saved +* @var bool load Whether or not a draft is being loaded +* @var bool cancel Whether or not to cancel the form (returns to +* viewtopic or viewforum depending on if the user +* is posting a new topic or editing a post) +* @var array error Any error strings; a non-empty array aborts +* form submission. +* NOTE: Should be actual language strings, NOT +* language keys. +* @var bool refresh Whether or not to retain previously submitted data +* @var array page_data Posting page data that should be passed to the +* posting page via $template->assign_vars() +* @var object message_parser The message parser object +* @since 3.1.0-a1 +* @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title, +* s_topic_icons, form_enctype, s_action, s_hidden_fields, +* post_id, topic_id, forum_id, submit, preview, save, load, +* delete, cancel, refresh, error, page_data, message_parser +* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist +* @changed 3.1.5-RC1 Added poll variables to the page_data array +* @changed 3.1.6-RC1 Added 'draft_id' var +*/ +$vars = array( + 'post_data', + 'moderators', + 'mode', + 'page_title', + 's_topic_icons', + 'form_enctype', + 's_action', + 's_hidden_fields', + 'post_id', + 'topic_id', + 'forum_id', + 'draft_id', + 'submit', + 'preview', + 'save', + 'load', + 'cancel', + 'refresh', + 'error', + 'page_data', + 'message_parser', +); +extract($phpbb_dispatcher->trigger_event('core.posting_modify_template_vars', compact($vars))); + +// Start assigning vars for main posting page ... +$template->assign_vars($page_data); + +// Show attachment box for adding attachments if true +$allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype); + +if ($allowed) +{ + $max_files = ($auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) ? 0 : (int) $config['max_attachments']; + $plupload->configure($cache, $template, $s_action, $forum_id, $max_files); +} + +// Attachment entry +posting_gen_attachment_entry($attachment_data, $filename_data, $allowed); + +// Output page ... +page_header($page_title); + +$template->set_filenames(array( + 'body' => 'posting_body.html') +); + +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + +// Topic review +if ($mode == 'reply' || $mode == 'quote') +{ + if (topic_review($topic_id, $forum_id)) + { + $template->assign_var('S_DISPLAY_REVIEW', true); + } +} + +page_footer(); diff --git a/install/update/new/report.php b/install/update/new/report.php new file mode 100644 index 0000000..d0d7b37 --- /dev/null +++ b/install/update/new/report.php @@ -0,0 +1,41 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use Symfony\Component\HttpFoundation\RedirectResponse; + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); + +$post_id = $request->variable('p', 0); +$pm_id = $request->variable('pm', 0); + +$redirect_route_name = ($pm_id === 0) ? 'phpbb_report_post_controller' : 'phpbb_report_pm_controller'; + +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); +$response = new RedirectResponse( + $controller_helper->route($redirect_route_name, array( + 'id' => ($pm_id === 0) ? $post_id : $pm_id, + ), false), + 301 +); +$response->send(); diff --git a/install/update/new/search.php b/install/update/new/search.php new file mode 100644 index 0000000..5d5e9f5 --- /dev/null +++ b/install/update/new/search.php @@ -0,0 +1,1569 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('search'); + +// Define initial vars +$mode = $request->variable('mode', ''); +$search_id = $request->variable('search_id', ''); +$start = max($request->variable('start', 0), 0); +$post_id = $request->variable('p', 0); +$topic_id = $request->variable('t', 0); +$view = $request->variable('view', ''); + +$submit = $request->variable('submit', false); +$keywords = $request->variable('keywords', '', true); +$add_keywords = $request->variable('add_keywords', '', true); +$author = $request->variable('author', '', true); +$author_id = $request->variable('author_id', 0); +$show_results = ($topic_id) ? 'posts' : $request->variable('sr', 'posts'); +$show_results = ($show_results == 'posts') ? 'posts' : 'topics'; +$search_terms = $request->variable('terms', 'all'); +$search_fields = $request->variable('sf', 'all'); +$search_child = $request->variable('sc', true); + +$sort_days = $request->variable('st', 0); +$sort_key = $request->variable('sk', 't'); +$sort_dir = $request->variable('sd', 'd'); + +$return_chars = $request->variable('ch', ($topic_id) ? -1 : 300); +$search_forum = $request->variable('fid', array(0)); + +// We put login boxes for the case if search_id is newposts, egosearch or unreadposts +// because a guest should be able to log in even if guests search is not permitted + +switch ($search_id) +{ + // Egosearch is an author search + case 'egosearch': + $author_id = $user->data['user_id']; + if ($user->data['user_id'] == ANONYMOUS) + { + login_box('', $user->lang['LOGIN_EXPLAIN_EGOSEARCH']); + } + break; + + // Search for unread posts needs to be allowed and user to be logged in if topics tracking for guests is disabled + case 'unreadposts': + if (!$config['load_unreads_search']) + { + $template->assign_var('S_NO_SEARCH', true); + trigger_error('NO_SEARCH_UNREADS'); + } + else if (!$config['load_anon_lastread'] && !$user->data['is_registered']) + { + login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']); + } + break; + + // The "new posts" search uses user_lastvisit which is user based, so it should require user to log in. + case 'newposts': + if ($user->data['user_id'] == ANONYMOUS) + { + login_box('', $user->lang['LOGIN_EXPLAIN_NEWPOSTS']); + } + break; + + default: + // There's nothing to do here for now ;) + break; +} + +// Is user able to search? Has search been disabled? +if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !$config['load_search']) +{ + $template->assign_var('S_NO_SEARCH', true); + trigger_error('NO_SEARCH'); +} + +// Check search load limit +if ($user->load && $config['limit_search_load'] && ($user->load > doubleval($config['limit_search_load']))) +{ + $template->assign_var('S_NO_SEARCH', true); + trigger_error('NO_SEARCH_LOAD'); +} + +// It is applicable if the configuration setting is non-zero, and the user cannot +// ignore the flood setting, and the search is a keyword search. +$interval = ($user->data['user_id'] == ANONYMOUS) ? $config['search_anonymous_interval'] : $config['search_interval']; +if ($interval && !in_array($search_id, array('unreadposts', 'unanswered', 'active_topics', 'egosearch')) && !$auth->acl_get('u_ignoreflood')) +{ + if ($user->data['user_last_search'] > time() - $interval) + { + $template->assign_var('S_NO_SEARCH', true); + trigger_error($user->lang('NO_SEARCH_TIME', (int) ($user->data['user_last_search'] + $interval - time()))); + } +} + +// Define some vars +$limit_days = array(0 => $user->lang['ALL_RESULTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); +$sort_by_text = array('a' => $user->lang['SORT_AUTHOR'], 't' => $user->lang['SORT_TIME'], 'f' => $user->lang['SORT_FORUM'], 'i' => $user->lang['SORT_TOPIC_TITLE'], 's' => $user->lang['SORT_POST_SUBJECT']); + +$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; +gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + +/* @var $phpbb_content_visibility \phpbb\content_visibility */ +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +/* @var $pagination \phpbb\pagination */ +$pagination = $phpbb_container->get('pagination'); + +$template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $user->lang('SEARCH'), + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}search.$phpEx"), +)); + +/** +* This event allows you to alter the above parameters, such as keywords and submit +* +* @event core.search_modify_submit_parameters +* @var string keywords The search keywords +* @var string author Specifies the author match, when ANONYMOUS is also a search-match +* @var int author_id ID of the author to search by +* @var string search_id Predefined search type name +* @var bool submit Whether or not the form has been submitted +* @since 3.1.10-RC1 +*/ +$vars = array( + 'keywords', + 'author', + 'author_id', + 'search_id', + 'submit', +); +extract($phpbb_dispatcher->trigger_event('core.search_modify_submit_parameters', compact($vars))); + +if ($keywords || $author || $author_id || $search_id || $submit) +{ + // clear arrays + $id_ary = array(); + + // If we are looking for authors get their ids + $author_id_ary = array(); + $sql_author_match = ''; + if ($author_id) + { + $author_id_ary[] = $author_id; + } + else if ($author) + { + if ((strpos($author, '*') !== false) && (utf8_strlen(str_replace(array('*', '%'), '', $author)) < $config['min_search_author_chars'])) + { + trigger_error($user->lang('TOO_FEW_AUTHOR_CHARS', (int) $config['min_search_author_chars'])); + } + + $sql_where = (strpos($author, '*') !== false) ? ' username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE $sql_where + AND user_type <> " . USER_IGNORE; + $result = $db->sql_query_limit($sql, 100); + + while ($row = $db->sql_fetchrow($result)) + { + $author_id_ary[] = (int) $row['user_id']; + } + $db->sql_freeresult($result); + + $sql_where = (strpos($author, '*') !== false) ? ' post_username ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " post_username = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; + + $sql = 'SELECT 1 as guest_post + FROM ' . POSTS_TABLE . " + WHERE $sql_where + AND poster_id = " . ANONYMOUS; + $result = $db->sql_query_limit($sql, 1); + $found_guest_post = $db->sql_fetchfield('guest_post'); + $db->sql_freeresult($result); + + if ($found_guest_post) + { + $author_id_ary[] = ANONYMOUS; + $sql_author_match = (strpos($author, '*') !== false) ? ' ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; + } + + if (!count($author_id_ary)) + { + trigger_error('NO_SEARCH_RESULTS'); + } + } + + // if we search in an existing search result just add the additional keywords. But we need to use "all search terms"-mode + // so we can keep the old keywords in their old mode, but add the new ones as required words + if ($add_keywords) + { + if ($search_terms == 'all') + { + $keywords .= ' ' . $add_keywords; + } + else + { + $search_terms = 'all'; + $keywords = implode(' |', explode(' ', preg_replace('#\s+#u', ' ', $keywords))) . ' ' .$add_keywords; + } + } + + // Which forums should not be searched? Author searches are also carried out in unindexed forums + if (empty($keywords) && count($author_id_ary)) + { + $ex_fid_ary = array_keys($auth->acl_getf('!f_read', true)); + } + else + { + $ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true)))); + } + + $not_in_fid = (count($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : ""; + + $sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, f.forum_flags, fa.user_id + FROM ' . FORUMS_TABLE . ' f + LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id + AND fa.session_id = '" . $db->sql_escape($user->session_id) . "') + $not_in_fid + ORDER BY f.left_id"; + $result = $db->sql_query($sql); + + $right_id = 0; + $reset_search_forum = true; + while ($row = $db->sql_fetchrow($result)) + { + if ($row['forum_password'] && $row['user_id'] != $user->data['user_id']) + { + $ex_fid_ary[] = (int) $row['forum_id']; + continue; + } + + // Exclude forums from active topics + if (!($row['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) && ($search_id == 'active_topics')) + { + $ex_fid_ary[] = (int) $row['forum_id']; + continue; + } + + if (count($search_forum)) + { + if ($search_child) + { + if (in_array($row['forum_id'], $search_forum) && $row['right_id'] > $right_id) + { + $right_id = (int) $row['right_id']; + } + else if ($row['right_id'] < $right_id) + { + continue; + } + } + + if (!in_array($row['forum_id'], $search_forum)) + { + $ex_fid_ary[] = (int) $row['forum_id']; + $reset_search_forum = false; + } + } + } + $db->sql_freeresult($result); + + // find out in which forums the user is allowed to view posts + $m_approve_posts_fid_sql = $phpbb_content_visibility->get_global_visibility_sql('post', $ex_fid_ary, 'p.'); + $m_approve_topics_fid_sql = $phpbb_content_visibility->get_global_visibility_sql('topic', $ex_fid_ary, 't.'); + + if ($reset_search_forum) + { + $search_forum = array(); + } + + // Select which method we'll use to obtain the post_id or topic_id information + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + // We do some additional checks in the module to ensure it can actually be utilised + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if ($error) + { + trigger_error($error); + } + + // let the search module split up the keywords + if ($keywords) + { + $correct_query = $search->split_keywords($keywords, $search_terms); + $common_words = $search->get_common_words(); + if (!$correct_query || (!$search->get_search_query() && !count($author_id_ary) && !$search_id)) + { + $ignored = (count($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '
' : ''; + $word_length = $search->get_word_length(); + if ($word_length) + { + trigger_error($ignored . $user->lang('NO_KEYWORDS', $user->lang('CHARACTERS', (int) $word_length['min']), $user->lang('CHARACTERS', (int) $word_length['max']))); + } + else + { + trigger_error($ignored); + } + } + } + + if (!$keywords && count($author_id_ary)) + { + // if it is an author search we want to show topics by default + $show_results = ($topic_id) ? 'posts' : $request->variable('sr', ($search_id == 'egosearch') ? 'topics' : 'posts'); + $show_results = ($show_results == 'posts') ? 'posts' : 'topics'; + } + + // define some variables needed for retrieving post_id/topic_id information + $sort_by_sql = array('a' => 'u.username_clean', 't' => (($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'), 'f' => 'f.forum_id', 'i' => 't.topic_title', 's' => (($show_results == 'posts') ? 'p.post_subject' : 't.topic_title')); + + /** + * Event to modify the SQL parameters before pre-made searches + * + * @event core.search_modify_param_before + * @var string keywords String of the specified keywords + * @var array sort_by_sql Array of SQL sorting instructions + * @var array ex_fid_ary Array of excluded forum ids + * @var array author_id_ary Array of exclusive author ids + * @var string search_id The id of the search request + * @var array id_ary Array of post or topic ids for search result + * @var string show_results 'posts' or 'topics' type of ids + * @since 3.1.3-RC1 + * @changed 3.1.10-RC1 Added id_ary, show_results + */ + $vars = array( + 'keywords', + 'sort_by_sql', + 'ex_fid_ary', + 'author_id_ary', + 'search_id', + 'id_ary', + 'show_results', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_param_before', compact($vars))); + + // pre-made searches + $sql = $field = $l_search_title = ''; + if ($search_id) + { + switch ($search_id) + { + // Oh holy Bob, bring us some activity... + case 'active_topics': + $l_search_title = $user->lang['SEARCH_ACTIVE_TOPICS']; + $show_results = 'topics'; + $sort_key = 't'; + $sort_dir = 'd'; + $sort_days = $request->variable('st', 7); + $sort_by_sql['t'] = 't.topic_last_post_time'; + + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + $s_sort_key = $s_sort_dir = ''; + + $last_post_time_sql = ($sort_days) ? ' AND t.topic_last_post_time > ' . (time() - ($sort_days * 24 * 3600)) : ''; + + $sql = 'SELECT t.topic_last_post_time, t.topic_id + FROM ' . TOPICS_TABLE . " t + WHERE t.topic_moved_id = 0 + $last_post_time_sql + AND " . $m_approve_topics_fid_sql . ' + ' . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . ' + ORDER BY t.topic_last_post_time DESC'; + $field = 'topic_id'; + break; + + case 'unanswered': + $l_search_title = $user->lang['SEARCH_UNANSWERED']; + $show_results = $request->variable('sr', 'topics'); + $show_results = ($show_results == 'posts') ? 'posts' : 'topics'; + $sort_by_sql['t'] = ($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'; + $sort_by_sql['s'] = ($show_results == 'posts') ? 'p.post_subject' : 't.topic_title'; + $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + + $sort_join = ($sort_key == 'f') ? FORUMS_TABLE . ' f, ' : ''; + $sql_sort = ($sort_key == 'f') ? ' AND f.forum_id = p.forum_id ' . $sql_sort : $sql_sort; + + if ($sort_days) + { + $last_post_time = 'AND p.post_time > ' . (time() - ($sort_days * 24 * 3600)); + } + else + { + $last_post_time = ''; + } + + if ($sort_key == 'a') + { + $sort_join = USERS_TABLE . ' u, '; + $sql_sort = ' AND u.user_id = p.poster_id ' . $sql_sort; + } + if ($show_results == 'posts') + { + $sql = "SELECT p.post_id + FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t + WHERE t.topic_posts_approved = 1 + AND p.topic_id = t.topic_id + $last_post_time + AND $m_approve_posts_fid_sql + " . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; + $field = 'post_id'; + } + else + { + $sql = 'SELECT DISTINCT ' . $sort_by_sql[$sort_key] . ", p.topic_id + FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t + WHERE t.topic_posts_approved = 1 + AND t.topic_moved_id = 0 + AND p.topic_id = t.topic_id + $last_post_time + AND $m_approve_topics_fid_sql + " . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; + $field = 'topic_id'; + } + break; + + case 'unreadposts': + $l_search_title = $user->lang['SEARCH_UNREAD']; + // force sorting + $show_results = 'topics'; + $sort_key = 't'; + $sort_by_sql['t'] = 't.topic_last_post_time'; + $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + + $sql_where = 'AND t.topic_moved_id = 0 + AND ' . $m_approve_topics_fid_sql . ' + ' . ((count($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); + + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; + + $template->assign_var('U_MARK_ALL_READ', ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums&mark_time=' . time()) : ''); + break; + + case 'newposts': + $l_search_title = $user->lang['SEARCH_NEW']; + // force sorting + $show_results = ($request->variable('sr', 'topics') == 'posts') ? 'posts' : 'topics'; + $sort_key = 't'; + $sort_dir = 'd'; + $sort_by_sql['t'] = ($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'; + $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; + + if ($show_results == 'posts') + { + $sql = 'SELECT p.post_id + FROM ' . POSTS_TABLE . ' p + WHERE p.post_time > ' . $user->data['user_lastvisit'] . ' + AND ' . $m_approve_posts_fid_sql . ' + ' . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; + $field = 'post_id'; + } + else + { + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . ' + AND t.topic_moved_id = 0 + AND ' . $m_approve_topics_fid_sql . ' + ' . ((count($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; +/* + [Fix] queued replies missing from "view new posts" (Bug #42705 - Patch by Paul) + - Creates temporary table, query is far from optimized + + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p + WHERE p.post_time > ' . $user->data['user_lastvisit'] . ' + AND t.topic_id = p.topic_id + AND t.topic_moved_id = 0 + AND ' . $m_approve_topics_fid_sql . " + GROUP BY t.topic_id + $sql_sort"; +*/ + $field = 'topic_id'; + } + break; + + case 'egosearch': + $l_search_title = $user->lang['SEARCH_SELF']; + break; + } + + $template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $l_search_title, + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}search.$phpEx", "search_id=$search_id"), + )); + } + + /** + * Event to modify data after pre-made searches + * + * @event core.search_modify_param_after + * @var string l_search_title The title of the search page + * @var string search_id Predefined search type name + * @var string show_results Display topics or posts + * @var string sql SQL query corresponding to the pre-made search id + * @since 3.1.7-RC1 + */ + $vars = array( + 'l_search_title', + 'search_id', + 'show_results', + 'sql', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_param_after', compact($vars))); + + // show_results should not change after this + $per_page = ($show_results == 'posts') ? $config['posts_per_page'] : $config['topics_per_page']; + $total_match_count = 0; + + // Set limit for the $total_match_count to reduce server load + $total_matches_limit = 1000; + $found_more_search_matches = false; + + if ($search_id) + { + if ($sql) + { + // Only return up to $total_matches_limit+1 ids (the last one will be removed later) + $result = $db->sql_query_limit($sql, $total_matches_limit + 1); + + while ($row = $db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $db->sql_freeresult($result); + } + else if ($search_id == 'unreadposts') + { + // Only return up to $total_matches_limit+1 ids (the last one will be removed later) + $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, $total_matches_limit + 1)); + } + else + { + $search_id = ''; + } + + $total_match_count = count($id_ary); + if ($total_match_count) + { + // Limit the number to $total_matches_limit for pre-made searches + if ($total_match_count > $total_matches_limit) + { + $found_more_search_matches = true; + $total_match_count = $total_matches_limit; + } + + // Make sure $start is set to the last page if it exceeds the amount + $start = $pagination->validate_start($start, $per_page, $total_match_count); + + $id_ary = array_slice($id_ary, $start, $per_page); + } + else + { + // Set $start to 0 if no matches were found + $start = 0; + } + } + + // make sure that some arrays are always in the same order + sort($ex_fid_ary); + sort($author_id_ary); + + if ($search->get_search_query()) + { + $total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); + } + else if (count($author_id_ary)) + { + $firstpost_only = ($search_fields === 'firstpost' || $search_fields == 'titleonly') ? true : false; + $total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); + } + + /** + * Event to search otherwise than by keywords or author + * + * @event core.search_backend_search_after + * @var string show_results 'posts' or 'topics' type of ids + * @var string search_fields The data fields to search in + * @var string search_terms Is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @var array sort_by_sql Array of SQL sorting instructions + * @var string sort_key The sort key + * @var string sort_dir The sort direction + * @var int sort_days Limit the age of results + * @var array ex_fid_ary Array of excluded forum ids + * @var string m_approve_posts_fid_sql Specifies which types of posts the user can view in which forums + * @var int topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @var array author_id_ary Array of exclusive author ids + * @var string sql_author_match Specifies the author match, when ANONYMOUS is also a search-match + * @var array id_ary Array of post or topic ids for search result + * @var int start The starting id of the results + * @var int per_page Number of ids each page is supposed to contain + * @var int total_match_count The total number of search matches + * @since 3.1.10-RC1 + */ + $vars = array( + 'show_results', + 'search_fields', + 'search_terms', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sort_days', + 'ex_fid_ary', + 'm_approve_posts_fid_sql', + 'topic_id', + 'author_id_ary', + 'sql_author_match', + 'id_ary', + 'start', + 'per_page', + 'total_match_count', + ); + extract($phpbb_dispatcher->trigger_event('core.search_backend_search_after', compact($vars))); + + $sql_where = ''; + + if (count($id_ary)) + { + $sql_where .= $db->sql_in_set(($show_results == 'posts') ? 'p.post_id' : 't.topic_id', $id_ary); + $sql_where .= (count($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : ''; + $sql_where .= ' AND ' . (($show_results == 'posts') ? $m_approve_posts_fid_sql : $m_approve_topics_fid_sql); + } + + if ($show_results == 'posts') + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } + else + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $user->add_lang('viewtopic'); + + // Grab icons + $icons = $cache->obtain_icons(); + + // define some vars for urls + // A single wildcard will make the search results look ugly + $hilit = phpbb_clean_search_string(str_replace(array('+', '-', '|', '(', ')', '"'), ' ', $keywords)); + $hilit = str_replace(' ', '|', $hilit); + + $u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit))); + $u_show_results = '&sr=' . $show_results; + $u_search_forum = implode('&fid%5B%5D=', $search_forum); + + $u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results); + $u_search .= ($search_id) ? '&search_id=' . $search_id : ''; + $u_search .= ($u_hilit) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; + $u_search .= ($search_terms != 'all') ? '&terms=' . $search_terms : ''; + $u_search .= ($topic_id) ? '&t=' . $topic_id : ''; + $u_search .= ($author) ? '&author=' . urlencode(htmlspecialchars_decode($author)) : ''; + $u_search .= ($author_id) ? '&author_id=' . $author_id : ''; + $u_search .= ($u_search_forum) ? '&fid%5B%5D=' . $u_search_forum : ''; + $u_search .= (!$search_child) ? '&sc=0' : ''; + $u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : ''; + $u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : ''; + + /** + * Event to add or modify search URL parameters + * + * @event core.search_modify_url_parameters + * @var string u_search Search URL parameters string + * @var string search_id Predefined search type name + * @var string show_results String indicating the show results mode + * @var string sql_where The SQL WHERE string used by search to get topic data + * @var int total_match_count The total number of search matches + * @var array ex_fid_ary Array of excluded forum ids + * @since 3.1.7-RC1 + * @changed 3.1.10-RC1 Added show_results, sql_where, total_match_count + * @changed 3.1.11-RC1 Added ex_fid_ary + */ + $vars = array( + 'u_search', + 'search_id', + 'show_results', + 'sql_where', + 'total_match_count', + 'ex_fid_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_url_parameters', compact($vars))); + + if ($sql_where) + { + $zebra = []; + + if ($show_results == 'posts') + { + // @todo Joining this query to the one below? + $sql = 'SELECT zebra_id, friend, foe + FROM ' . ZEBRA_TABLE . ' + WHERE user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $zebra[($row['friend']) ? 'friend' : 'foe'][] = $row['zebra_id']; + } + $db->sql_freeresult($result); + + $sql_array = array( + 'SELECT' => 'p.*, f.forum_id, f.forum_name, t.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_colour', + 'FROM' => array( + POSTS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'p.topic_id = t.topic_id', + ), + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'p.forum_id = f.forum_id', + ), + array( + 'FROM' => array(USERS_TABLE => 'u'), + 'ON' => 'p.poster_id = u.user_id', + ), + ), + 'WHERE' => $sql_where, + 'ORDER_BY' => $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'), + ); + + /** + * Event to modify the SQL query before the posts data is retrieved + * + * @event core.search_get_posts_data + * @var array sql_array The SQL array + * @var array zebra Array of zebra data for the current user + * @var int total_match_count The total number of search matches + * @var string keywords String of the specified keywords + * @var array sort_by_sql Array of SQL sorting instructions + * @var string s_sort_dir The sort direction + * @var string s_sort_key The sort key + * @var string s_limit_days Limit the age of results + * @var array ex_fid_ary Array of excluded forum ids + * @var array author_id_ary Array of exclusive author ids + * @var string search_fields The data fields to search in + * @var int search_id The id of the search request + * @var int start The starting id of the results + * @since 3.1.0-b3 + */ + $vars = array( + 'sql_array', + 'zebra', + 'total_match_count', + 'keywords', + 'sort_by_sql', + 's_sort_dir', + 's_sort_key', + 's_limit_days', + 'ex_fid_ary', + 'author_id_ary', + 'search_fields', + 'search_id', + 'start', + ); + extract($phpbb_dispatcher->trigger_event('core.search_get_posts_data', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); + } + else + { + $sql_from = TOPICS_TABLE . ' t + LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id) + ' . (($sort_key == 'a') ? ' LEFT JOIN ' . USERS_TABLE . ' u ON (u.user_id = t.topic_poster) ' : ''); + $sql_select = 't.*, f.forum_id, f.forum_name'; + + if ($user->data['is_registered']) + { + if ($config['load_db_track'] && $author_id !== $user->data['user_id']) + { + $sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.user_id = ' . $user->data['user_id'] . ' + AND t.topic_id = tp.topic_id)'; + $sql_select .= ', tp.topic_posted'; + } + + if ($config['load_db_lastread']) + { + $sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.user_id = ' . $user->data['user_id'] . ' + AND t.topic_id = tt.topic_id) + LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' + AND ft.forum_id = f.forum_id)'; + $sql_select .= ', tt.mark_time, ft.mark_time as f_mark_time'; + } + } + + if ($config['load_anon_lastread'] || ($user->data['is_registered'] && !$config['load_db_lastread'])) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + } + + $sql_order_by = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + + /** + * 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 + * @var int total_match_count The total number of search matches + * @var array sort_by_sql Array of SQL sorting instructions + * @var string sort_dir The sorting direction + * @var string sort_key The sorting key + * @var string sql_order_by The SQL ORDER BY string used by search to get topic data + * @since 3.1.0-a1 + * @changed 3.1.0-RC5 Added total_match_count + * @changed 3.1.7-RC1 Added sort_by_sql, sort_dir, sort_key, sql_order_by + */ + $vars = array( + 'sql_select', + 'sql_from', + 'sql_where', + 'total_match_count', + 'sort_by_sql', + 'sort_dir', + 'sort_key', + 'sql_order_by', + ); + extract($phpbb_dispatcher->trigger_event('core.search_get_topic_data', compact($vars))); + + $sql = "SELECT $sql_select + FROM $sql_from + WHERE $sql_where + ORDER BY $sql_order_by"; + } + $result = $db->sql_query($sql); + $result_topic_id = 0; + + $rowset = $attachments = $topic_tracking_info = array(); + + if ($show_results == 'topics') + { + $forums = $rowset = $shadow_topic_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['forum_id'] = (int) $row['forum_id']; + $row['topic_id'] = (int) $row['topic_id']; + + if ($row['topic_status'] == ITEM_MOVED) + { + $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id']; + } + + $rowset[$row['topic_id']] = $row; + + if (!isset($forums[$row['forum_id']]) && $user->data['is_registered'] && $config['load_db_lastread']) + { + $forums[$row['forum_id']]['mark_time'] = $row['f_mark_time']; + } + $forums[$row['forum_id']]['topic_list'][] = $row['topic_id']; + $forums[$row['forum_id']]['rowset'][$row['topic_id']] = &$rowset[$row['topic_id']]; + } + $db->sql_freeresult($result); + + // If we have some shadow topics, update the rowset to reflect their topic information + if (count($shadow_topic_list)) + { + $sql = 'SELECT * + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', array_keys($shadow_topic_list)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $orig_topic_id = $shadow_topic_list[$row['topic_id']]; + + // We want to retain some values + $row = array_merge($row, array( + 'topic_moved_id' => $rowset[$orig_topic_id]['topic_moved_id'], + 'topic_status' => $rowset[$orig_topic_id]['topic_status'], + 'forum_name' => $rowset[$orig_topic_id]['forum_name']) + ); + + $rowset[$orig_topic_id] = $row; + } + $db->sql_freeresult($result); + } + unset($shadow_topic_list); + + foreach ($forums as $forum_id => $forum) + { + if ($user->data['is_registered'] && $config['load_db_lastread']) + { + $topic_tracking_info[$forum_id] = get_topic_tracking($forum_id, $forum['topic_list'], $forum['rowset'], array($forum_id => $forum['mark_time'])); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $forum['topic_list']); + + if (!$user->data['is_registered']) + { + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + } + } + unset($forums); + } + else + { + $text_only_message = ''; + $attach_list = array(); + + while ($row = $db->sql_fetchrow($result)) + { + /** + * Modify the row of a post result before the post_text is trimmed + * + * @event core.search_modify_post_row + * @var string hilit String to highlight + * @var array row Array with the post data + * @var string u_hilit Highlight string to be injected into URL + * @var string view Search results view mode + * @var array zebra Array with zebra data for the current user + * @since 3.2.2-RC1 + */ + $vars = array( + 'hilit', + 'row', + 'u_hilit', + 'view', + 'zebra', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_post_row', compact($vars))); + + // We pre-process some variables here for later usage + $row['post_text'] = censor_text($row['post_text']); + + $text_only_message = $row['post_text']; + // make list items visible as such + if ($row['bbcode_uid']) + { + $text_only_message = str_replace('[*:' . $row['bbcode_uid'] . ']', '⋅ ', $text_only_message); + // no BBCode in text only message + strip_bbcode($text_only_message, $row['bbcode_uid']); + } + + if ($return_chars == -1 || utf8_strlen($text_only_message) < ($return_chars + 3)) + { + $row['display_text_only'] = false; + + // Does this post have an attachment? If so, add it to the list + if ($row['post_attachment'] && $config['allow_attachments']) + { + $attach_list[$row['forum_id']][] = $row['post_id']; + } + } + else + { + $row['post_text'] = $text_only_message; + $row['display_text_only'] = true; + } + + $rowset[] = $row; + } + $db->sql_freeresult($result); + + unset($text_only_message); + + // Pull attachment data + if (count($attach_list)) + { + $use_attach_list = $attach_list; + $attach_list = array(); + + foreach ($use_attach_list as $forum_id => $_list) + { + if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) + { + $attach_list = array_merge($attach_list, $_list); + } + } + } + + if (count($attach_list)) + { + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . ' + AND in_message = 0 + ORDER BY filetime DESC, post_msg_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + } + } + + if ($hilit) + { + // Remove bad highlights + $hilit_array = array_filter(explode('|', $hilit), 'strlen'); + foreach ($hilit_array as $key => $value) + { + $hilit_array[$key] = phpbb_clean_search_string($value); + $hilit_array[$key] = str_replace('\*', '\w*?', preg_quote($hilit_array[$key], '#')); + $hilit_array[$key] = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $hilit_array[$key]); + } + $hilit = implode('|', $hilit_array); + } + + /** + * Modify the rowset data + * + * @event core.search_modify_rowset + * @var array attachments Array with posts attachments data + * @var string hilit String to highlight + * @var array rowset Array with the search results data + * @var string show_results String indicating the show results mode + * @var array topic_tracking_info Array with the topics tracking data + * @var string u_hilit Highlight string to be injected into URL + * @var string view Search results view mode + * @var array zebra Array with zebra data for the current user + * @since 3.1.0-b4 + * @changed 3.1.0-b5 Added var show_results + */ + $vars = array( + 'attachments', + 'hilit', + 'rowset', + 'show_results', + 'topic_tracking_info', + 'u_hilit', + 'view', + 'zebra', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_rowset', compact($vars))); + + foreach ($rowset as $row) + { + $forum_id = $row['forum_id']; + $result_topic_id = $row['topic_id']; + $topic_title = censor_text($row['topic_title']); + $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1; + + $view_topic_url_params = "f=$forum_id&t=$result_topic_id" . (($u_hilit) ? "&hilit=$u_hilit" : ''); + $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params); + + $folder_img = $folder_alt = $u_mcp_queue = ''; + $topic_type = $posts_unapproved = 0; + $unread_topic = $topic_unapproved = $topic_deleted = false; + + if ($show_results == 'topics') + { + if ($config['load_db_track'] && $author_id === $user->data['user_id']) + { + $row['topic_posted'] = 1; + } + + topic_status($row, $replies, (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false, $folder_img, $folder_alt, $topic_type); + + $unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false; + + $topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $topic_deleted = $row['topic_visibility'] == ITEM_DELETED; + $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; + $u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&mode=deleted_topics&t=$result_topic_id", true, $user->session_id) : $u_mcp_queue; + + $row['topic_title'] = preg_replace('#(?!<.*)(?]*(?:)#isu', '$1', $row['topic_title']); + + $tpl_ary = array( + 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'FIRST_POST_TIME_RFC3339' => gmdate(DATE_RFC3339, $row['topic_time']), + 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_POST_TIME_RFC3339' => gmdate(DATE_RFC3339, $row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_VIEW_TIME_RFC3339' => gmdate(DATE_RFC3339, $row['topic_last_view_time']), + 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + + 'TOPIC_TYPE' => $topic_type, + + 'TOPIC_IMG_STYLE' => $folder_img, + 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), + 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], + + 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', + 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', + 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + + 'S_TOPIC_TYPE' => $row['topic_type'], + 'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false, + 'S_UNREAD_TOPIC' => $unread_topic, + + 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false, + 'S_TOPIC_UNAPPROVED' => $topic_unapproved, + 'S_POSTS_UNAPPROVED' => $posts_unapproved, + 'S_TOPIC_DELETED' => $topic_deleted, + 'S_HAS_POLL' => ($row['poll_start']) ? true : false, + + 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread', + 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&t=' . $result_topic_id, true, $user->session_id), + 'U_MCP_QUEUE' => $u_mcp_queue, + ); + } + else + { + if ((isset($zebra['foe']) && in_array($row['poster_id'], $zebra['foe'])) && (!$view || $view != 'show' || $post_id != $row['post_id'])) + { + $template->assign_block_vars('searchresults', array( + 'S_IGNORE_POST' => true, + + 'L_IGNORE_POST' => sprintf($user->lang['POST_BY_FOE'], $row['username'], "', '')) + ); + + continue; + } + + // Replace naughty words such as farty pants + $row['post_subject'] = censor_text($row['post_subject']); + + if ($row['display_text_only']) + { + // now find context for the searched words + $row['post_text'] = get_context($row['post_text'], array_filter(explode('|', $hilit), 'strlen'), $return_chars); + $row['post_text'] = bbcode_nl2br($row['post_text']); + } + else + { + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); + + if (!empty($attachments[$row['post_id']])) + { + parse_attachments($forum_id, $row['post_text'], $attachments[$row['post_id']], $update_count); + + // we only display inline attachments + unset($attachments[$row['post_id']]); + } + } + + if ($hilit) + { + // post highlighting + $row['post_text'] = preg_replace('#(?!<.*)(?]*(?:)#isu', '$1', $row['post_text']); + $row['post_subject'] = preg_replace('#(?!<.*)(?]*(?:)#isu', '$1', $row['post_subject']); + } + + $tpl_ary = array( + 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + + 'POST_SUBJECT' => $row['post_subject'], + 'POST_DATE' => (!empty($row['post_time'])) ? $user->format_date($row['post_time']) : '', + 'MESSAGE' => $row['post_text'] + ); + } + + $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, + + 'FORUM_TITLE' => $row['forum_name'], + 'TOPIC_TITLE' => $topic_title, + 'TOPIC_REPLIES' => $replies, + 'TOPIC_VIEWS' => $row['topic_views'], + + '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'] : '', + )); + + /** + * 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 + * @var string show_results Display topics or posts + * @var string topic_title Cleaned topic title + * @var int replies The number of topic replies + * @var string view_topic_url The URL to the topic + * @var string folder_img The folder image of the topic + * @var string folder_alt The alt attribute of the topic folder img + * @var int topic_type The topic type + * @var bool unread_topic Whether the topic has unread posts + * @var bool topic_unapproved Whether the topic is unapproved + * @var int posts_unapproved The number of unapproved posts + * @var bool topic_deleted Whether the topic has been deleted + * @var string u_mcp_queue The URL to the corresponding MCP queue page + * @var array zebra The zebra data of the current user + * @var array attachments All the attachments of the search results + * @since 3.1.0-a1 + * @changed 3.1.0-b3 Added vars show_results, topic_title, replies, + * view_topic_url, folder_img, folder_alt, topic_type, unread_topic, + * topic_unapproved, posts_unapproved, topic_deleted, u_mcp_queue, + * zebra, attachments + */ + $vars = array( + 'row', + 'tpl_ary', + 'show_results', + 'topic_title', + 'replies', + 'view_topic_url', + 'folder_img', + 'folder_alt', + 'topic_type', + 'unread_topic', + 'topic_unapproved', + 'posts_unapproved', + 'topic_deleted', + 'u_mcp_queue', + 'zebra', + 'attachments', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars))); + + $template->assign_block_vars('searchresults', $tpl_ary); + + if ($show_results == 'topics') + { + $pagination->generate_template_pagination($view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); + } + } + + if ($topic_id && ($topic_id == $result_topic_id)) + { + $template->assign_vars(array( + 'SEARCH_TOPIC' => $topic_title, + 'L_RETURN_TO_TOPIC' => $user->lang('RETURN_TO', $topic_title), + 'U_SEARCH_TOPIC' => $view_topic_url + )); + } + } + unset($rowset); + + // Output header + if ($found_more_search_matches) + { + $l_search_matches = $user->lang('FOUND_MORE_SEARCH_MATCHES', (int) $total_match_count); + } + else + { + $l_search_matches = $user->lang('FOUND_SEARCH_MATCHES', (int) $total_match_count); + } + + // Check if search backend supports phrase search or not + $phrase_search_disabled = ''; + if (strpos(html_entity_decode($keywords), '"') !== false && method_exists($search, 'supports_phrase_search')) + { + $phrase_search_disabled = $search->supports_phrase_search() ? false : true; + } + + $pagination->generate_template_pagination($u_search, 'pagination', 'start', $total_match_count, $per_page, $start); + + $template->assign_vars(array( + 'SEARCH_TITLE' => $l_search_title, + 'SEARCH_MATCHES' => $l_search_matches, + 'SEARCH_WORDS' => $keywords, + 'SEARCHED_QUERY' => $search->get_search_query(), + 'IGNORED_WORDS' => (!empty($common_words)) ? implode(' ', $common_words) : '', + + 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, + + 'TOTAL_MATCHES' => $total_match_count, + 'SEARCH_IN_RESULTS' => ($search_id) ? false : true, + + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_SEARCH_ACTION' => $u_search, + 'S_SHOW_TOPICS' => ($show_results == 'posts') ? false : true, + + 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), + 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'), + 'POLL_IMG' => $user->img('icon_topic_poll', 'TOPIC_POLL'), + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + + 'U_SEARCH_WORDS' => $u_search, + )); + + /** + * Modify the title and/or load data for the search results page + * + * @event core.search_results_modify_search_title + * @var int author_id ID of the author to search by + * @var string l_search_title The title of the search page + * @var string search_id Predefined search type name + * @var string show_results Search results output mode - topics or posts + * @var int start The starting id of the results + * @var int total_match_count The count of search results + * @var string keywords The search keywords + * @since 3.1.0-RC4 + * @changed 3.1.6-RC1 Added total_match_count and keywords + */ + $vars = array( + 'author_id', + 'l_search_title', + 'search_id', + 'show_results', + 'start', + 'total_match_count', + 'keywords', + ); + extract($phpbb_dispatcher->trigger_event('core.search_results_modify_search_title', compact($vars))); + + page_header(($l_search_title) ? $l_search_title : $user->lang['SEARCH']); + + $template->set_filenames(array( + 'body' => 'search_results.html') + ); + make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + + page_footer(); +} + +// Search forum +$rowset = array(); +$s_forums = ''; +$sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id, f.forum_password, f.enable_indexing, fa.user_id + FROM ' . FORUMS_TABLE . ' f + LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id + AND fa.session_id = '" . $db->sql_escape($user->session_id) . "') + ORDER BY f.left_id ASC"; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + $rowset[(int) $row['forum_id']] = $row; +} +$db->sql_freeresult($result); + +$right = $cat_right = $padding_inc = 0; +$padding = $forum_list = $holding = ''; +$pad_store = array('0' => ''); + +/** +* Modify the forum select list for advanced search page +* +* @event core.search_modify_forum_select_list +* @var array rowset Array with the forums list data +* @since 3.1.10-RC1 +*/ +$vars = array('rowset'); +extract($phpbb_dispatcher->trigger_event('core.search_modify_forum_select_list', compact($vars))); + +foreach ($rowset as $row) +{ + if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) + { + // Non-postable forum with no subforums, don't display + continue; + } + + if ($row['forum_type'] == FORUM_POST && ($row['left_id'] + 1 == $row['right_id']) && !$row['enable_indexing']) + { + // Postable forum with no subforums and indexing disabled, don't display + continue; + } + + if ($row['forum_type'] == FORUM_LINK || ($row['forum_password'] && !$row['user_id'])) + { + // if this forum is a link or password protected (user has not entered the password yet) then skip to the next branch + continue; + } + + if ($row['left_id'] < $right) + { + $padding .= '   '; + $pad_store[$row['parent_id']] = $padding; + } + else if ($row['left_id'] > $right + 1) + { + if (isset($pad_store[$row['parent_id']])) + { + $padding = $pad_store[$row['parent_id']]; + } + else + { + continue; + } + } + + $right = $row['right_id']; + + if ($auth->acl_gets('!f_search', '!f_list', $row['forum_id'])) + { + // if the user does not have permissions to search or see this forum skip only this forum/category + continue; + } + + $selected = (in_array($row['forum_id'], $search_forum)) ? ' selected="selected"' : ''; + + if ($row['left_id'] > $cat_right) + { + // make sure we don't forget anything + $s_forums .= $holding; + $holding = ''; + } + + if ($row['right_id'] - $row['left_id'] > 1) + { + $cat_right = max($cat_right, $row['right_id']); + + $holding .= ''; + } + else + { + $s_forums .= $holding . ''; + $holding = ''; + } +} + +if ($holding) +{ + $s_forums .= $holding; +} + +unset($pad_store); +unset($rowset); + +if (!$s_forums) +{ + trigger_error('NO_SEARCH'); +} + +// Number of chars returned +$s_characters = ''; +$s_characters .= ''; +$s_characters .= ''; +$s_characters .= ''; + +for ($i = 100; $i <= 1000; $i += 100) +{ + $selected = ($i == 300) ? ' selected="selected"' : ''; + $s_characters .= ''; +} + +$s_hidden_fields = array('t' => $topic_id); + +if ($_SID) +{ + $s_hidden_fields['sid'] = $_SID; +} + +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + +$template->assign_vars(array( + 'S_SEARCH_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", false, true, 0), // We force no ?sid= appending by using 0 + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + 'S_CHARACTER_OPTIONS' => $s_characters, + 'S_FORUM_OPTIONS' => $s_forums, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_IN_SEARCH' => true, +)); + +// only show recent searches to search administrators +if ($auth->acl_get('a_search')) +{ + // Handle large objects differently for Oracle and MSSQL + switch ($db->get_sql_layer()) + { + case 'oracle': + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE dbms_lob.getlength(search_keywords) > 0 + ORDER BY search_time DESC'; + break; + + case 'mssql_odbc': + case 'mssqlnative': + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE DATALENGTH(search_keywords) > 0 + ORDER BY search_time DESC'; + break; + + default: + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE search_keywords <> \'\' + ORDER BY search_time DESC'; + break; + } + $result = $db->sql_query_limit($sql, 5); + + while ($row = $db->sql_fetchrow($result)) + { + $keywords = $row['search_keywords']; + + $template->assign_block_vars('recentsearch', array( + 'KEYWORDS' => $keywords, + 'TIME' => $user->format_date($row['search_time']), + + 'U_KEYWORDS' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode(htmlspecialchars_decode($keywords))) + )); + } + $db->sql_freeresult($result); +} + +// Output the basic page +page_header($user->lang['SEARCH']); + +$template->set_filenames(array( + 'body' => 'search_body.html') +); +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + +page_footer(); diff --git a/install/update/new/styles/prosilver/style.cfg b/install/update/new/styles/prosilver/style.cfg new file mode 100644 index 0000000..0c7eba6 --- /dev/null +++ b/install/update/new/styles/prosilver/style.cfg @@ -0,0 +1,32 @@ +# +# phpBB Style Configuration File +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +# At the left is the name, please do not change this +# At the right the value is entered +# +# Values get trimmed, if you want to add a space in front or at the end of +# the value, then enclose the value with single or double quotes. +# Single and double quotes do not need to be escaped. +# +# + +# General Information about this style +name = prosilver +copyright = © phpBB Limited, 2007 +style_version = 3.3.0 +phpbb_version = 3.3.0 + +# Defining a different template bitfield +# template_bitfield = //g= + +# Parent style +# Set value to empty or to this style's name if this style does not have a parent style +parent = prosilver diff --git a/install/update/new/styles/prosilver/template/attachment.html b/install/update/new/styles/prosilver/template/attachment.html new file mode 100644 index 0000000..45b9dc2 --- /dev/null +++ b/install/update/new/styles/prosilver/template/attachment.html @@ -0,0 +1,35 @@ + + + + +

[{_file.DENIED_MESSAGE}]

+ + + + +
+
{% if _file.COMMENT %}{{ _file.COMMENT|e('html') }}{% else %}{{ _file.DOWNLOAD_NAME }}{% endif %}
+
{_file.COMMENT}
+
+ + + +
+
{% if _file.COMMENT %}{{ _file.COMMENT|e('html') }}{% else %}{{ _file.DOWNLOAD_NAME }}{% endif %}
+
{_file.COMMENT}
+
{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}
+
+ + + +
+
{_file.UPLOAD_ICON} {_file.DOWNLOAD_NAME}
+
{_file.COMMENT}
+
({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}
+
+ + + + + + diff --git a/install/update/new/styles/prosilver/template/bbcode.html b/install/update/new/styles/prosilver/template/bbcode.html new file mode 100644 index 0000000..b37ba23 --- /dev/null +++ b/install/update/new/styles/prosilver/template/bbcode.html @@ -0,0 +1,79 @@ +
    +
      +
    + +
      +
    + +
  • +
  • + +
    {USERNAME} {L_WROTE}{L_COLON} +
    +
    + +
    + + uncited + +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +
    + + +

    {L_CODE}{L_COLON} {L_SELECT_ALL_CODE}

    
    +
    + +
    +
    + + + + + + + + + + +{TEXT} + +{TEXT} + +{L_IMAGE} + +{DESCRIPTION} + +{DESCRIPTION} + + diff --git a/install/update/new/styles/prosilver/template/captcha_recaptcha.html b/install/update/new/styles/prosilver/template/captcha_recaptcha.html new file mode 100644 index 0000000..8fc7faa --- /dev/null +++ b/install/update/new/styles/prosilver/template/captcha_recaptcha.html @@ -0,0 +1,9 @@ + + + {% INCLUDEJS RECAPTCHA_SERVER ~ '.js?onload=phpbbRecaptchaOnLoad&hl=' ~ lang('RECAPTCHA_LANG') %} +
    + +{L_RECAPTCHA_NOT_AVAILABLE} + diff --git a/install/update/new/styles/prosilver/template/forum_fn.js b/install/update/new/styles/prosilver/template/forum_fn.js new file mode 100644 index 0000000..2e39365 --- /dev/null +++ b/install/update/new/styles/prosilver/template/forum_fn.js @@ -0,0 +1,937 @@ +/* global phpbb */ + +/** +* phpBB3 forum functions +*/ + +/** +* Find a member +*/ +function find_username(url) { + 'use strict'; + + popup(url, 760, 570, '_usersearch'); + return false; +} + +/** +* Window popup +*/ +function popup(url, width, height, name) { + 'use strict'; + + if (!name) { + name = '_popup'; + } + + window.open(url.replace(/&/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes, width=' + width); + return false; +} + +/** +* Jump to page +*/ +function pageJump(item) { + 'use strict'; + + var page = parseInt(item.val(), 10), + perPage = item.attr('data-per-page'), + baseUrl = item.attr('data-base-url'), + startName = item.attr('data-start-name'); + + if (page !== null && !isNaN(page) && page === Math.floor(page) && page > 0) { + if (baseUrl.indexOf('?') === -1) { + document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage); + } else { + document.location.href = baseUrl.replace(/&/g, '&') + '&' + startName + '=' + ((page - 1) * perPage); + } + } +} + +/** +* Mark/unmark checklist +* id = ID of parent container, name = name prefix, state = state [true/false] +*/ +function marklist(id, name, state) { + 'use strict'; + + jQuery('#' + id + ' input[type=checkbox][name]').each(function() { + var $this = jQuery(this); + if ($this.attr('name').substr(0, name.length) === name && !$this.prop('disabled')) { + $this.prop('checked', state); + } + }); +} + +/** +* Resize viewable area for attached image or topic review panel (possibly others to come) +* e = element +*/ +function viewableArea(e, itself) { + 'use strict'; + + if (!e) { + return; + } + + if (!itself) { + e = e.parentNode; + } + + if (!e.vaHeight) { + // Store viewable area height before changing style to auto + e.vaHeight = e.offsetHeight; + e.vaMaxHeight = e.style.maxHeight; + e.style.height = 'auto'; + e.style.maxHeight = 'none'; + e.style.overflow = 'visible'; + } else { + // Restore viewable area height to the default + e.style.height = e.vaHeight + 'px'; + e.style.overflow = 'auto'; + e.style.maxHeight = e.vaMaxHeight; + e.vaHeight = false; + } +} + +/** +* Alternate display of subPanels +*/ +jQuery(function($) { + 'use strict'; + + $('.sub-panels').each(function() { + + var $childNodes = $('a[data-subpanel]', this), + panels = $childNodes.map(function () { + return this.getAttribute('data-subpanel'); + }), + showPanel = this.getAttribute('data-show-panel'); + + if (panels.length) { + activateSubPanel(showPanel, panels); + $childNodes.click(function () { + activateSubPanel(this.getAttribute('data-subpanel'), panels); + return false; + }); + } + }); +}); + +/** +* Activate specific subPanel +*/ +function activateSubPanel(p, panels) { + 'use strict'; + + var i, showPanel; + + if (typeof p === 'string') { + showPanel = p; + } + $('input[name="show_panel"]').val(showPanel); + + if (typeof panels === 'undefined') { + panels = jQuery('.sub-panels a[data-subpanel]').map(function() { + return this.getAttribute('data-subpanel'); + }); + } + + for (i = 0; i < panels.length; i++) { + jQuery('#' + panels[i]).css('display', panels[i] === showPanel ? 'block' : 'none'); + jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === showPanel); + } +} + +function selectCode(a) { + 'use strict'; + + // Get ID of code block + var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0]; + var s, r; + + // Not IE and IE9+ + if (window.getSelection) { + s = window.getSelection(); + // Safari and Chrome + if (s.setBaseAndExtent) { + var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1; + try { + s.setBaseAndExtent(e, 0, e, l); + } catch (error) { + r = document.createRange(); + r.selectNodeContents(e); + s.removeAllRanges(); + s.addRange(r); + } + } + // Firefox and Opera + else { + // workaround for bug # 42885 + if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) === '
    ') { + e.innerHTML = e.innerHTML + ' '; + } + + r = document.createRange(); + r.selectNodeContents(e); + s.removeAllRanges(); + s.addRange(r); + } + } + // Some older browsers + else if (document.getSelection) { + s = document.getSelection(); + r = document.createRange(); + r.selectNodeContents(e); + s.removeAllRanges(); + s.addRange(r); + } + // IE + else if (document.selection) { + r = document.body.createTextRange(); + r.moveToElementText(e); + r.select(); + } +} + +var inAutocomplete = false; +var lastKeyEntered = ''; + +/** +* Check event key +*/ +function phpbbCheckKey(event) { + 'use strict'; + + // Keycode is array down or up? + if (event.keyCode && (event.keyCode === 40 || event.keyCode === 38)) { + inAutocomplete = true; + } + + // Make sure we are not within an "autocompletion" field + if (inAutocomplete) { + // If return pressed and key changed we reset the autocompletion + if (!lastKeyEntered || lastKeyEntered === event.which) { + inAutocomplete = false; + return true; + } + } + + // Keycode is not return, then return. ;) + if (event.which !== 13) { + lastKeyEntered = event.which; + return true; + } + + return false; +} + +/** +* Apply onkeypress event for forcing default submit button on ENTER key press +*/ +jQuery(function($) { + 'use strict'; + + $('form input[type=text], form input[type=password]').on('keypress', function (e) { + var defaultButton = $(this).parents('form').find('input[type=submit].default-submit-action'); + + if (!defaultButton || defaultButton.length <= 0) { + return true; + } + + if (phpbbCheckKey(e)) { + return true; + } + + if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) { + defaultButton.click(); + return false; + } + + return true; + }); +}); + +/** +* Functions for user search popup +*/ +function insertUser(formId, value) { + 'use strict'; + + var $form = jQuery(formId), + formName = $form.attr('data-form-name'), + fieldName = $form.attr('data-field-name'), + item = opener.document.forms[formName][fieldName]; + + if (item.value.length && item.type === 'textarea') { + value = item.value + '\n' + value; + } + + item.value = value; +} + +function insert_marked_users(formId, users) { + 'use strict'; + + $(users).filter(':checked').each(function() { + insertUser(formId, this.value); + }); + + window.close(); +} + +function insert_single_user(formId, user) { + 'use strict'; + + insertUser(formId, user); + window.close(); +} + +/** +* Parse document block +*/ +function parseDocument($container) { + 'use strict'; + + var test = document.createElement('div'), + oldBrowser = (typeof test.style.borderRadius === 'undefined'), + $body = $('body'); + + /** + * Reset avatar dimensions when changing URL or EMAIL + */ + $container.find('input[data-reset-on-edit]').on('keyup', function() { + $(this.getAttribute('data-reset-on-edit')).val(''); + }); + + /** + * Pagination + */ + $container.find('.pagination .page-jump-form :button').click(function() { + var $input = $(this).siblings('input.inputbox'); + pageJump($input); + }); + + $container.find('.pagination .page-jump-form input.inputbox').on('keypress', function(event) { + if (event.which === 13 || event.keyCode === 13) { + event.preventDefault(); + pageJump($(this)); + } + }); + + $container.find('.pagination .dropdown-trigger').click(function() { + var $dropdownContainer = $(this).parent(); + // Wait a little bit to make sure the dropdown has activated + setTimeout(function() { + if ($dropdownContainer.hasClass('dropdown-visible')) { + $dropdownContainer.find('input.inputbox').focus(); + } + }, 100); + }); + + /** + * Adjust HTML code for IE8 and older versions + */ + // if (oldBrowser) { + // // Fix .linklist.bulletin lists + // $container + // .find('ul.linklist.bulletin > li') + // .filter(':first-child, .rightside:last-child') + // .addClass('no-bulletin'); + // } + + /** + * Resize navigation (breadcrumbs) block to keep all links on same line + */ + $container.find('.navlinks').each(function() { + var $this = $(this), + $left = $this.children().not('.rightside'), + $right = $this.children('.rightside'); + + if ($left.length !== 1 || !$right.length) { + return; + } + + function resize() { + var width = 0, + diff = $left.outerWidth(true) - $left.width(), + minWidth = Math.max($this.width() / 3, 240), + maxWidth; + + $right.each(function() { + var $this = $(this); + if ($this.is(':visible')) { + width += $this.outerWidth(true); + } + }); + + maxWidth = $this.width() - width - diff; + $left.css('max-width', Math.floor(Math.max(maxWidth, minWidth)) + 'px'); + } + + resize(); + $(window).resize(resize); + }); + + /** + * Makes breadcrumbs responsive + */ + $container.find('.breadcrumbs:not([data-skip-responsive])').each(function() { + var $this = $(this), + $links = $this.find('.crumb'), + length = $links.length, + classes = ['wrapped-max', 'wrapped-wide', 'wrapped-medium', 'wrapped-small', 'wrapped-tiny'], + classesLength = classes.length, + maxHeight = 0, + lastWidth = false, + wrapped = false; + + // Set tooltips + $this.find('a').each(function() { + var $link = $(this); + $link.attr('title', $link.text()); + }); + + // Function that checks breadcrumbs + function check() { + var height = $this.height(), + width; + + // Test max-width set in code for .navlinks above + width = parseInt($this.css('max-width'), 10); + if (!width) { + width = $body.width(); + } + + maxHeight = parseInt($this.css('line-height'), 10); + $links.each(function() { + if ($(this).height() > 0) { + maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); + } + }); + + if (height <= maxHeight) { + if (!wrapped || lastWidth === false || lastWidth >= width) { + return; + } + } + lastWidth = width; + + if (wrapped) { + $this.removeClass('wrapped').find('.crumb.wrapped').removeClass('wrapped ' + classes.join(' ')); + if ($this.height() <= maxHeight) { + return; + } + } + + wrapped = true; + $this.addClass('wrapped'); + if ($this.height() <= maxHeight) { + return; + } + + for (var i = 0; i < classesLength; i++) { + for (var j = length - 1; j >= 0; j--) { + $links.eq(j).addClass('wrapped ' + classes[i]); + if ($this.height() <= maxHeight) { + return; + } + } + } + } + + // Run function and set event + check(); + $(window).resize(check); + }); + + /** + * Responsive link lists + */ + var selector = '.linklist:not(.navlinks, [data-skip-responsive]),' + + '.postbody .post-buttons:not([data-skip-responsive])'; + $container.find(selector).each(function() { + var $this = $(this), + filterSkip = '.breadcrumbs, [data-skip-responsive]', + filterLast = '.edit-icon, .quote-icon, [data-last-responsive]', + $linksAll = $this.children(), + $linksNotSkip = $linksAll.not(filterSkip), // All items that can potentially be hidden + $linksFirst = $linksNotSkip.not(filterLast), // The items that will be hidden first + $linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last + persistent = $this.attr('id') === 'nav-main', // Does this list already have a menu (such as quick-links)? + html = '', + slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occurred. + + // Add a hidden drop-down menu to each links list (except those that already have one) + if (!persistent) { + if ($linksNotSkip.is('.rightside')) { + $linksNotSkip.filter('.rightside:first').before(html); + $this.children('.responsive-menu').addClass('rightside'); + } else { + $this.append(html); + } + } + + // Set some object references and initial states + var $menu = $this.children('.responsive-menu'), + $menuContents = $menu.find('.dropdown-contents'), + persistentContent = $menuContents.find('li:not(.separator)').length, + lastWidth = false, + compact = false, + responsive1 = false, + responsive2 = false, + copied1 = false, + copied2 = false, + maxHeight = 0; + + // Find the tallest element in the list (we assume that all elements are roughly the same height) + $linksAll.each(function() { + if (!$(this).height()) { + return; + } + maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); + }); + if (maxHeight < 1) { + return; // Shouldn't be possible, but just in case, abort + } else { + maxHeight = maxHeight + slack; + } + + function check() { + var width = $body.width(); + // We can't make it any smaller than this, so just skip + if (responsive2 && compact && (width <= lastWidth)) { + return; + } + lastWidth = width; + + // Reset responsive and compact layout + if (responsive1 || responsive2) { + $linksNotSkip.removeClass('hidden'); + $menuContents.children('.clone').addClass('hidden'); + responsive1 = responsive2 = false; + } + if (compact) { + $this.removeClass('compact'); + compact = false; + } + + // Unhide the quick-links menu if it has "persistent" content + if (persistent && persistentContent) { + $menu.removeClass('hidden'); + } else { + $menu.addClass('hidden'); + } + + // Nothing to resize if block's height is not bigger than tallest element's height + if ($this.height() <= maxHeight) { + return; + } + + // STEP 1: Compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 2: First responsive set - compact + if (compact) { + $this.removeClass('compact'); + compact = false; + } + // Copy the list items to the dropdown + if (!copied1) { + var $clones1 = $linksFirst.clone(); + $menuContents.prepend($clones1.addClass('clone clone-first').removeClass('leftside rightside')); + + if ($this.hasClass('post-buttons')) { + $('.button', $menuContents).removeClass('button'); + $('.sr-only', $menuContents).removeClass('sr-only'); + $('.js-responsive-menu-link').addClass('button').addClass('button-icon-only'); + $('.js-responsive-menu-link .icon').removeClass('fa-bars').addClass('fa-ellipsis-h'); + } + copied1 = true; + } + if (!responsive1) { + $linksFirst.addClass('hidden'); + responsive1 = true; + $menuContents.children('.clone-first').removeClass('hidden'); + $menu.removeClass('hidden'); + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 3: First responsive set + compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 4: Last responsive set - compact + if (!$linksLast.length) { + return; // No other links to hide, can't do more + } + if (compact) { + $this.removeClass('compact'); + compact = false; + } + // Copy the list items to the dropdown + if (!copied2) { + var $clones2 = $linksLast.clone(); + $menuContents.prepend($clones2.addClass('clone clone-last').removeClass('leftside rightside')); + copied2 = true; + } + if (!responsive2) { + $linksLast.addClass('hidden'); + responsive2 = true; + $menuContents.children('.clone-last').removeClass('hidden'); + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 5: Last responsive set + compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + } + + if (!persistent) { + phpbb.registerDropdown($menu.find('a.js-responsive-menu-link'), $menu.find('.dropdown'), false); + } + + // If there are any images in the links list, run the check again after they have loaded + $linksAll.find('img').each(function() { + $(this).on('load', function() { + check(); + }); + }); + + check(); + $(window).resize(check); + }); + + /** + * Do not run functions below for old browsers + */ + if (oldBrowser) { + return; + } + + /** + * Adjust topiclist lists with check boxes + */ + $container.find('ul.topiclist dd.mark').siblings('dt').children('.list-inner').addClass('with-mark'); + + /** + * Appends contents of all extra columns to first column in + * .topiclist lists for mobile devices. Copies contents as is. + * + * To add that functionality to .topiclist list simply add + * responsive-show-all to list of classes + */ + $container.find('.topiclist.responsive-show-all > li > dl').each(function() { + var $this = $(this), + $block = $this.find('dt .responsive-show:last-child'), + first = true; + + // Create block that is visible only on mobile devices + if (!$block.length) { + $this.find('dt > .list-inner').append('
+ +
+
+ + + + +
+
+ +
    + + + + + +
  • + +
    +
    + +
    + + + + + + {forumrow.FORUM_IMAGE} + + + {forumrow.FORUM_NAME} +
    {forumrow.FORUM_DESC} + +
    {forumrow.L_MODERATOR_STR}{L_COLON} {forumrow.MODERATORS} + + + +
    {forumrow.L_SUBFORUM_STR}{L_COLON} + + + {forumrow.subforum.SUBFORUM_NAME}{L_COMMA_SEPARATOR} + + + + + + + +
    +
    + +
    {L_REDIRECTS}{L_COLON} {forumrow.CLICKS}
    + +
    {forumrow.TOPICS} {L_TOPICS}
    +
    {forumrow.POSTS} {L_POSTS}
    +
    + + + + {L_TOPICS_UNAPPROVED} + + + + {L_POSTS_UNAPPROVED_FORUM} + + + + {L_LAST_POST} + + + {forumrow.LAST_POST_SUBJECT_TRUNCATED}
    + + {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL} + + + {L_VIEW_LATEST_POST} + + +
    + + {% if forumrow.U_UNAPPROVED_TOPICS %} + {{ lang('TOPIC_UNAPPROVED_FORUM', forumrow.TOPICS) }} + {% else %} + {{ lang('NO_POSTS') }} + {% endif %} + +
    +
    + +
     
    + +
    + +
  • + + + + +
+ +
+
+ + + + +
+
+ {L_NO_FORUMS} +
+
+ diff --git a/install/update/new/styles/prosilver/template/mcp_forum.html b/install/update/new/styles/prosilver/template/mcp_forum.html new file mode 100644 index 0000000..82df5d5 --- /dev/null +++ b/install/update/new/styles/prosilver/template/mcp_forum.html @@ -0,0 +1,155 @@ + + + + + +

{L_FORUM}{L_COLON} {FORUM_NAME}

+ +
+ +
+
+ +
+ +
+ + +
    +
  • +
    +
    {L_TOPICS}
    +
    {L_REPLIES}
    +
    {L_LAST_POST}
    +
    {L_MARK}
    +
    +
  • +
+
    + + +
  • +
    +
    style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"> + +
    + + [ {L_SELECT_MERGE} ]   + + {topicrow.TOPIC_TITLE} + + + + {L_TOPIC_UNAPPROVED} + + + + + {L_TOPIC_DELETED} + + + + + {L_TOPIC_REPORTED} + + +  [ {L_DELETE_SHADOW_TOPIC} ] +
    + + + + + + + + +
    + + {% EVENT topiclist_row_topic_by_author_before %} + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} + {% EVENT topiclist_row_topic_by_author_after %} +
    + +
    +
    +
    {topicrow.REPLIES} {L_REPLIES}
    +
    {L_LAST_POST} {L_POST_BY_AUTHOR} {topicrow.LAST_POST_AUTHOR_FULL}
    {topicrow.LAST_POST_TIME}
    + +
    + checked="checked" />  +
    + +
    +
  • + +
+ +
    +
  • {L_NO_TOPICS}

  • +
+ + +
+ + + +
+ +
+
+ + +
+ + + + + + {S_FORM_TOKEN} +
+ +
+ + diff --git a/install/update/new/styles/prosilver/template/mcp_move.html b/install/update/new/styles/prosilver/template/mcp_move.html new file mode 100644 index 0000000..63197ef --- /dev/null +++ b/install/update/new/styles/prosilver/template/mcp_move.html @@ -0,0 +1,73 @@ + + +

{MESSAGE_TITLE}

+

{MESSAGE_TEXT}

+ +

{ADDITIONAL_MSG}

+ + + + + + + + + + + +
+   + +
+ + + + + + + +
+ +
+
+ +
+

{MESSAGE_TITLE}

+

{ADDITIONAL_MSG}

+ +
+ {% EVENT mcp_move_destination_forum_before %} +
+
+
+
+
+
+ {% EVENT mcp_move_destination_forum_after %} +
+
 
+
{MESSAGE_TEXT}
+
+
+ +
+ {S_HIDDEN_FIELDS}  + + {S_FORM_TOKEN} +
+ +
+ +
+
+
+ + + diff --git a/install/update/new/styles/prosilver/template/mcp_topic.html b/install/update/new/styles/prosilver/template/mcp_topic.html new file mode 100644 index 0000000..889cab8 --- /dev/null +++ b/install/update/new/styles/prosilver/template/mcp_topic.html @@ -0,0 +1,202 @@ + + + + +
+ +
+
+ +
+
+

{L_POSTS_PER_PAGE_EXPLAIN}
+
+
+
+
+
{S_SELECT_SORT_DAYS}  
+
+
+ + +
+

{L_SPLIT_TOPIC_EXPLAIN}

+ + +
+
+
+
+
+ + + +
+
+
+
+ +
+
+
+
+
+ + + +
+

{L_MERGE_TOPIC_EXPLAIN}

+
+
+
+ + {L_SELECT_TOPIC} +
+
{TO_TOPIC_INFO}
+
+
+ + +
+
+ +
+
+ +

+ {L_EXPAND_VIEW} + {L_TOPIC_REVIEW}{L_COLON} {TOPIC_TITLE} +

+ +
+ + +
+
+ +
+ + + +

{postrow.POST_SUBJECT}

+ + + +

+ + {postrow.MINI_POST} + {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} {% EVENT mcp_topic_post_author_full_prepend %}{postrow.POST_AUTHOR_FULL}{% EVENT mcp_topic_post_author_full_append %} [ {L_POST_DETAILS} ] +

+ + + +

+ {L_POST_UNAPPROVED} +

+ + + +

+ {L_POST_DELETED} +

+ + + +

+ {L_POST_REPORTED} +

+ + +
{postrow.MESSAGE}
+ + + + +
+
{L_ATTACHMENTS}
+ +
{postrow.attachment.DISPLAY_ATTACHMENT}
+ +
+ + + + +
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+   + + +{S_HIDDEN_FIELDS} +{S_FORM_TOKEN} +
+ +
+ + diff --git a/install/update/new/styles/prosilver/template/memberlist_body.html b/install/update/new/styles/prosilver/template/memberlist_body.html new file mode 100644 index 0000000..b8ff092 --- /dev/null +++ b/install/update/new/styles/prosilver/template/memberlist_body.html @@ -0,0 +1,190 @@ + + + +
+ + + + + + + + +{% EVENT memberlist_body_page_header_after %} + + + {% EVENT memberlist_body_group_name_before %} +

style="color:#{GROUP_COLOR};">{GROUP_NAME}

+ {% EVENT memberlist_body_group_name_after %} + +

{L_MANAGE_GROUP}

+ +

{GROUP_DESC} {GROUP_TYPE}

+ + {% EVENT memberlist_body_group_desc_after %} + +

+ {AVATAR_IMG} + {% EVENT memberlist_body_group_rank_before %} + {% if RANK_IMG %}{{ RANK_IMG }}{% endif %} + {% if GROUP_RANK %} + {% if not RANK_IMG %} + {{ lang('GROUP_RANK') ~ lang('COLON') }} + {% endif %} + {{ GROUP_RANK }} + {% endif %} + {% EVENT memberlist_body_group_rank_after %} +

+ + {% EVENT memberlist_body_page_title_before %} +

{PAGE_TITLE}{L_COLON} {SEARCH_WORDS}

+ +
+ + + +
+ + + +
+
+ + + + + + + + + + {% EVENT memberlist_body_memberlist_after %} + + + + + + + + + + + + + + +
{L_RANK}{L_GROUP_LEADER}{L_USERNAME}{L_POSTS}{L_COMMA_SEPARATOR} {custom_fields.PROFILE_FIELD_NAME}{L_JOINED}{L_LAST_ACTIVE}
 
+ +
+
+ +
+
+ + + + + + + + + + + {% EVENT memberlist_body_leaders_set_after %} + + + + + + + {% EVENT memberlist_body_show_group_after %} + + + + + + + + + + + + + + + {% EVENT memberlist_body_memberrow_after %} + + + + + + + +
{L_RANK}{L_GROUP_MEMBERS}{L_USERNAME}{L_POSTS}{% for field in custom_fields %}{% if not loop.first %}{L_COMMA_SEPARATOR} {% endif %}{{ field.PROFILE_FIELD_NAME }}{% endfor %}{L_JOINED}{L_LAST_ACTIVE}{L_GROUP_MEMBERS}{L_POSTS}{L_COMMA_SEPARATOR} {custom_fields.PROFILE_FIELD_NAME}{L_JOINED}{L_LAST_ACTIVE}
{memberrow.RANK_IMG}{memberrow.RANK_TITLE} {memberrow.USERNAME_FULL} ({L_INACTIVE})
{L_SELECT} ]
{memberrow.POSTS}{memberrow.POSTS} + {%- for field in memberrow.custom_fields -%} + + {%- else -%} +   + {%- endfor -%} + {memberrow.JOINED}{memberrow.LAST_ACTIVE} 
{L_NO_MEMBERS}
+ +
+
+ + +
+ + +
+ + + +
+
+ + + +
+ + + +
+ + +
+ +
+ +
+ +{% EVENT memberlist_body_page_footer_before %} + + + + + + + diff --git a/install/update/new/styles/prosilver/template/memberlist_search.html b/install/update/new/styles/prosilver/template/memberlist_search.html new file mode 100644 index 0000000..34915eb --- /dev/null +++ b/install/update/new/styles/prosilver/template/memberlist_search.html @@ -0,0 +1,87 @@ +

{L_FIND_USERNAME}

+ +
+
+
+ +

{L_FIND_USERNAME_EXPLAIN}

+ + +
+
+
+
+ + +
+
+ +
+
+
+
+ + +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ + +
+ +
+ +
+ +
+   + + {S_FORM_TOKEN} +
+ +
+
+ +
diff --git a/install/update/new/styles/prosilver/template/navbar_header.html b/install/update/new/styles/prosilver/template/navbar_header.html new file mode 100644 index 0000000..4a1a436 --- /dev/null +++ b/install/update/new/styles/prosilver/template/navbar_header.html @@ -0,0 +1,212 @@ + diff --git a/install/update/new/styles/prosilver/template/overall_footer.html b/install/update/new/styles/prosilver/template/overall_footer.html new file mode 100644 index 0000000..d1b8863 --- /dev/null +++ b/install/update/new/styles/prosilver/template/overall_footer.html @@ -0,0 +1,120 @@ + +
+ + + + + +
+ +
+ + {RUN_CRON_TASK} +
+ + + + + + + + + + + + + + + + + + +{$SCRIPTS} + + + + + diff --git a/install/update/new/styles/prosilver/template/overall_header.html b/install/update/new/styles/prosilver/template/overall_header.html new file mode 100644 index 0000000..2867802 --- /dev/null +++ b/install/update/new/styles/prosilver/template/overall_header.html @@ -0,0 +1,133 @@ + + + + + + +{META} +<!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{$STYLESHEETS} + + + + + + + + +
+ + + + + + +
+ +
+
+ {L_INFORMATION}{L_COLON} {L_BOARD_DISABLED} +
+
+ + + diff --git a/install/update/new/styles/prosilver/template/plupload.html b/install/update/new/styles/prosilver/template/plupload.html new file mode 100644 index 0000000..9425b7d --- /dev/null +++ b/install/update/new/styles/prosilver/template/plupload.html @@ -0,0 +1,75 @@ + + + diff --git a/install/update/new/styles/prosilver/template/posting_attach_body.html b/install/update/new/styles/prosilver/template/posting_attach_body.html new file mode 100644 index 0000000..0363fe0 --- /dev/null +++ b/install/update/new/styles/prosilver/template/posting_attach_body.html @@ -0,0 +1,93 @@ +
+
+ +

{L_ADD_ATTACHMENT_EXPLAIN}

+ +
+
+
+
+ + +
+
+
+
+
+
+
+ +
+ +
+ + {% EVENT posting_attach_body_file_list_before %} +
+
+ + + + + + + + + + + + + + + + + {% EVENT posting_attach_body_attach_row_before %} + + {% EVENT posting_attach_body_attach_row_prepend %} + + + + + + + {% EVENT posting_attach_body_attach_row_append %} + + {% EVENT posting_attach_body_attach_row_after %} + +
{L_PLUPLOAD_FILENAME}{L_FILE_COMMENT}{L_PLUPLOAD_SIZE}{L_PLUPLOAD_STATUS}
+ + + {% if S_BBCODE_ALLOWED %} {% endif %} + + + + + + + + + + + + +
+ {attach_row.FILENAME} + {% EVENT posting_attach_body_attach_row_controls_prepend %} + + {% if S_BBCODE_ALLOWED and S_INLINE_ATTACHMENT_OPTIONS %} {% endif %} + + + {% EVENT posting_attach_body_attach_row_controls_append %} + + + + {attach_row.S_HIDDEN} + + {attach_row.FILESIZE} + + +
+
+
+ {% EVENT posting_attach_body_file_list_after %} +
+
diff --git a/install/update/new/styles/prosilver/template/posting_buttons.html b/install/update/new/styles/prosilver/template/posting_buttons.html new file mode 100644 index 0000000..1564b5f --- /dev/null +++ b/install/update/new/styles/prosilver/template/posting_buttons.html @@ -0,0 +1,105 @@ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/install/update/new/styles/prosilver/template/posting_layout.html b/install/update/new/styles/prosilver/template/posting_layout.html new file mode 100644 index 0000000..7c9deb5 --- /dev/null +++ b/install/update/new/styles/prosilver/template/posting_layout.html @@ -0,0 +1,65 @@ + + + +

{TOPIC_TITLE}

+ +

{FORUM_NAME}

+ + + +
+
+ + + {L_FORUM_RULES} + + {L_FORUM_RULES}
+ {FORUM_RULES} + + +
+
+ + +
+ + +
+
+ +

{L_INFORMATION}

+

{L_DRAFT_LOADED}

+ +
+
+ + + + + + + + +
+
+ +

{L_POST_A}

+ + + + + {S_FORM_TOKEN} +
+
+ + + + + + + + + +
+ + diff --git a/install/update/new/styles/prosilver/template/posting_poll_body.html b/install/update/new/styles/prosilver/template/posting_poll_body.html new file mode 100644 index 0000000..7956496 --- /dev/null +++ b/install/update/new/styles/prosilver/template/posting_poll_body.html @@ -0,0 +1,53 @@ +
+
+ + +

{L_ADD_POLL_EXPLAIN}

+ + +
+ +
+
+
+
+ + + +
+
+
+
+
+

{L_POLL_OPTIONS_EXPLAIN}
+
+
+ +
+ +
+
+
+
{L_POLL_MAX_OPTIONS_EXPLAIN}
+
+
+
+
+
{L_POLL_FOR_EXPLAIN}
+
+ + +
+ +
+
+
+
+ + + + +
+ +
+
diff --git a/install/update/new/styles/prosilver/template/posting_review.html b/install/update/new/styles/prosilver/template/posting_review.html new file mode 100644 index 0000000..e5d285e --- /dev/null +++ b/install/update/new/styles/prosilver/template/posting_review.html @@ -0,0 +1,44 @@ +

{L_POST_REVIEW}

+ +

{L_POST_REVIEW_EXPLAIN}

+ + + +
+
+ {post_review_row.L_IGNORE_POST} + +
+
+ + +
+

{post_review_row.POST_SUBJECT}

+

+ + {post_review_row.MINI_POST} + + + {post_review_row.MINI_POST} + + + {L_POST_BY_AUTHOR} {post_review_row.POST_AUTHOR_FULL} » {post_review_row.POST_DATE} +

+
{post_review_row.MESSAGE}
+ + +
+
{L_ATTACHMENTS}
+ +
{post_review_row.attachment.DISPLAY_ATTACHMENT}
+ +
+ + +
+ +
+
+ + +
diff --git a/install/update/new/styles/prosilver/template/posting_topic_review.html b/install/update/new/styles/prosilver/template/posting_topic_review.html new file mode 100644 index 0000000..209dadf --- /dev/null +++ b/install/update/new/styles/prosilver/template/posting_topic_review.html @@ -0,0 +1,89 @@ + +

+ {L_EXPAND_VIEW} + {L_TOPIC_REVIEW}{L_COLON} {TOPIC_TITLE} +

+ +
+ + + + +
+
+ {topic_review_row.L_IGNORE_POST} + +
+
+ {topic_review_row.L_DELETE_POST} + +
+
+ + +
+

{topic_review_row.POST_SUBJECT}

+ + + + + + +

+ + {topic_review_row.MINI_POST} + + + {topic_review_row.MINI_POST} + + + {L_POST_BY_AUTHOR} {topic_review_row.POST_AUTHOR_FULL} » {topic_review_row.POST_DATE} +

+ + +
{topic_review_row.MESSAGE}
+ + + + +
+
{L_ATTACHMENTS}
+ +
{topic_review_row.attachment.DISPLAY_ATTACHMENT}
+ +
+ + + + + +
+
+
+ +
+ +
+ +

+ + {L_BACK_TO_TOP} + +

diff --git a/install/update/new/styles/prosilver/template/search_results.html b/install/update/new/styles/prosilver/template/search_results.html new file mode 100644 index 0000000..9ee13a4 --- /dev/null +++ b/install/update/new/styles/prosilver/template/search_results.html @@ -0,0 +1,244 @@ + + + + +

{SEARCH_TITLE}{SEARCH_MATCHES}{L_COLON} {SEARCH_WORDS}

+

{L_SEARCHED_QUERY}{L_COLON} {SEARCHED_QUERY}

+

{L_IGNORED_TERMS}{L_COLON} {IGNORED_WORDS}

+

{L_PHRASE_SEARCH_DISABLED}

+ + + + + + + + + + +
+ + + + + + + + +
+ + + + + +
+ +
+
    +
  • +
    +
    {L_TOPICS}
    +
    {L_REPLIES}
    +
    {L_VIEWS}
    +
    {L_LAST_POST}
    +
    +
  • +
+ + +
+
+ +
+
+ {L_NO_SEARCH_RESULTS} +
+
+ + + + + + +
+
+ + +
+ {searchresults.L_IGNORE_POST} +
+ +
+ +
{L_POST_BY_AUTHOR} {searchresults.POST_AUTHOR_FULL}
+
{searchresults.POST_DATE}
+
{L_FORUM}{L_COLON} {searchresults.FORUM_TITLE}
+
{L_TOPIC}{L_COLON} {searchresults.TOPIC_TITLE}
+ +
{L_REPLIES}{L_COLON} {searchresults.TOPIC_REPLIES}
+
{L_VIEWS}{L_COLON} {searchresults.TOPIC_VIEWS}
+ +
+ +
+

{searchresults.POST_SUBJECT}

+
{searchresults.MESSAGE}
+ +
+ + + + + + +
+
+ + +
+
+ {L_NO_SEARCH_RESULTS} +
+
+ + + +
+ +
+ +
+ + + +
+ + + + diff --git a/install/update/new/styles/prosilver/template/simple_footer.html b/install/update/new/styles/prosilver/template/simple_footer.html new file mode 100644 index 0000000..fde162a --- /dev/null +++ b/install/update/new/styles/prosilver/template/simple_footer.html @@ -0,0 +1,40 @@ +
+ + + +
+
 
+
+
+ +
+ + + +

+
+
+ + + +
+
+
+ + + + + + + + + +{$SCRIPTS} + +{% EVENT simple_footer_body_after %} + + + diff --git a/install/update/new/styles/prosilver/template/ucp_agreement.html b/install/update/new/styles/prosilver/template/ucp_agreement.html new file mode 100644 index 0000000..7959925 --- /dev/null +++ b/install/update/new/styles/prosilver/template/ucp_agreement.html @@ -0,0 +1,72 @@ + + + + + + + +
+

+ + {S_HIDDEN_FIELDS} +

+
+ +
+ + + +
+ +
+
+
+

{SITENAME} - {L_REGISTRATION}

+ +

{L_COPPA_BIRTHDAY}{L_TERMS_OF_USE}

+ +
+
+
+ +
+
+
+ + + + +   + + + {S_HIDDEN_FIELDS} + {S_FORM_TOKEN} +
+
+
+
+ + + +
+
+
+

{SITENAME} - {AGREEMENT_TITLE}

+

{AGREEMENT_TEXT}

+
+
+
+ + + + diff --git a/install/update/new/styles/prosilver/template/ucp_attachments.html b/install/update/new/styles/prosilver/template/ucp_attachments.html new file mode 100644 index 0000000..cfdbf9c --- /dev/null +++ b/install/update/new/styles/prosilver/template/ucp_attachments.html @@ -0,0 +1,83 @@ + + +
+ +

{L_TITLE}

+ +
+
+ +

{L_ATTACHMENTS_EXPLAIN}

+ + +
+ +
+ + + + +
+ + {S_FORM_TOKEN} + + +
+ + +

{L_UCP_NO_ATTACHMENTS}

+ + +
+
+ + +
+ + + {S_FORM_TOKEN} +
+ +
+ + diff --git a/install/update/new/styles/prosilver/template/ucp_avatar_options_upload.html b/install/update/new/styles/prosilver/template/ucp_avatar_options_upload.html new file mode 100644 index 0000000..666950e --- /dev/null +++ b/install/update/new/styles/prosilver/template/ucp_avatar_options_upload.html @@ -0,0 +1,11 @@ +
+
+
+
+ + +
+

{L_UPLOAD_AVATAR_URL_EXPLAIN}
+
+
+ diff --git a/install/update/new/styles/prosilver/template/ucp_groups_manage.html b/install/update/new/styles/prosilver/template/ucp_groups_manage.html new file mode 100644 index 0000000..adc8c61 --- /dev/null +++ b/install/update/new/styles/prosilver/template/ucp_groups_manage.html @@ -0,0 +1,247 @@ + + + style="color:#{GROUP_COLOR};">{L_USERGROUPS} :: {GROUP_NAME} + +
+ +
+
+ + +
+

{ERROR_MSG}

+
+ + +

{L_GROUPS_EXPLAIN}

+ + +

{L_GROUP_DETAILS}

+ +
+
+
+
style="color: #{GROUP_COLOUR};">{GROUP_NAME} +
+
+
+
+
+
  
+
+ +
+

{L_GROUP_TYPE_EXPLAIN}
+
+ + + + +
+
+ + + +
+ +
+
+ +
+
+

{L_GROUP_SETTINGS_SAVE}

+ +
+
+

{L_GROUP_COLOR_EXPLAIN}
+
+ +     + [ {L_COLOUR_SWATCH} ] + +
+
+
+
+
+
+
+ +
+
+ + + +
+ {S_HIDDEN_FIELDS} +   + + {S_FORM_TOKEN} +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{L_GROUP_LEAD}{L_GROUP_DEFAULT}{L_POSTS}{L_JOINED}{L_MARK}
{leader.USERNAME_FULL}{L_YES}{L_NO}{leader.USER_POSTS}{leader.JOINED} 
+ + + + + + + + + + + + + + + + + + +
{L_GROUP_PENDING}{L_GROUP_DEFAULT}{L_POSTS}{L_JOINED}{L_MARK}
+ + + + + + + + + + + + + + + + + + + + + + +
{L_GROUP_APPROVED}{L_GROUP_DEFAULT}{L_POSTS}{L_JOINED}{L_MARK}
{member.USERNAME_FULL}{L_YES}{L_NO}{member.USER_POSTS}{member.JOINED}
+ + + + + + + + + + + +
{L_MEMBERS}
{L_GROUPS_NO_MEMBERS}
+ + +
+ +
+ + +
+
+ +
+ + + +
+ +
+
+ +

{L_ADD_USERS}

+ +

{L_ADD_USERS_UCP_EXPLAIN}

+ +
+
+

{L_USER_GROUP_DEFAULT_EXPLAIN}
+
+ + +
+
+
+

{L_USERNAMES_EXPLAIN}
+
+
{L_FIND_USERNAME}
+
+
+ +
+
+ +
+ + {S_FORM_TOKEN} +
+ + + + +
    +
  • +
    +
    {L_GROUP_LEADER}
    +
    {L_OPTIONS}
    +
    +
  • +
+ + +

{L_NO_LEADERS}

+ + +
+
+ + + + + diff --git a/install/update/new/styles/prosilver/template/ucp_pm_history.html b/install/update/new/styles/prosilver/template/ucp_pm_history.html new file mode 100644 index 0000000..b53eb0c --- /dev/null +++ b/install/update/new/styles/prosilver/template/ucp_pm_history.html @@ -0,0 +1,56 @@ + +

+ {L_EXPAND_VIEW} + {L_MESSAGE_HISTORY}{L_COLON} +

+ + +
+ + +
+
+ +
+

class="current">{history_row.SUBJECT}

+ + + + + + + + +

+ {history_row.MINI_POST} {L_SENT_AT}{L_COLON} {history_row.SENT_DATE} +
+ {L_MESSAGE_BY_AUTHOR} {history_row.MESSAGE_AUTHOR_FULL} +

+
{history_row.MESSAGE}{L_MESSAGE_REMOVED_FROM_OUTBOX}
+ +
+ +
+
+ +
+ + +
+

+ + {L_BACK_TO_TOP} + +

diff --git a/install/update/new/styles/prosilver/template/ucp_pm_viewmessage_print.html b/install/update/new/styles/prosilver/template/ucp_pm_viewmessage_print.html new file mode 100644 index 0000000..41ff5b8 --- /dev/null +++ b/install/update/new/styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -0,0 +1,57 @@ + + + + + + +{META} +{SITENAME} • {PAGE_TITLE} + + + + + + +
+ + + + +
+
{PAGE_NUMBER}
+
+

{SUBJECT}

+
{L_SENT_AT} {SENT_DATE}
+
{L_PM_FROM} {MESSAGE_AUTHOR}
+ +
{L_TO} {to_recipient.NAME} 
+ + +
{L_BCC} {bcc_recipient.NAME} 
+ +
+
{MESSAGE}
+
+
+
+ + +
+ + + diff --git a/install/update/new/styles/prosilver/template/ucp_profile_profile_info.html b/install/update/new/styles/prosilver/template/ucp_profile_profile_info.html new file mode 100644 index 0000000..ac0cd15 --- /dev/null +++ b/install/update/new/styles/prosilver/template/ucp_profile_profile_info.html @@ -0,0 +1,51 @@ + + +
+ +

{L_TITLE} [ {L_VIEW_PROFILE} ]

+ +
+
+

{L_PROFILE_INFO_NOTICE}

+ +
+

{ERROR}

+ + +
+

{L_BIRTHDAY_EXPLAIN}
+
+ + + +
+
+ + +
+
+
+
+ + +
+
for="{profile_fields.FIELD_ID}">{profile_fields.LANG_NAME}{L_COLON} * +
{profile_fields.LANG_EXPLAIN}
+
{profile_fields.ERROR}
+
{profile_fields.FIELD}
+
+ + +
+ +
+
+ +
+ {S_HIDDEN_FIELDS}  + + {S_FORM_TOKEN} +
+
+ + diff --git a/install/update/new/styles/prosilver/template/ucp_register.html b/install/update/new/styles/prosilver/template/ucp_register.html new file mode 100644 index 0000000..f44382f --- /dev/null +++ b/install/update/new/styles/prosilver/template/ucp_register.html @@ -0,0 +1,117 @@ + + + + +{% if PROVIDER_TEMPLATE_FILE %} +
+
+ +

{{ SITENAME }} - {{ lang('OAUTH_REGISTRATION') }}

+ + {% include PROVIDER_TEMPLATE_FILE %} +
+
+{% endif %} + +
+ +
+
+ +

{SITENAME} - {L_REGISTRATION}

+ +
+
{ERROR}
+ +
{L_REG_COND}
+ + +
+

{L_USERNAME_EXPLAIN}
+
+
+
+
+
+
+
+

{L_PASSWORD_EXPLAIN}
+
+
+
+
+
+
+ + +
+ + +
+
+
+
+ + + + + +
{L_ITEMS_REQUIRED}
+ + +
+
for="{profile_fields.FIELD_ID}">{profile_fields.LANG_NAME}{L_COLON} * +
{profile_fields.LANG_EXPLAIN} +
{profile_fields.ERROR}
+
{profile_fields.FIELD}
+
+ + + + +
+
+
+ + + + + + +
+
+ +

{L_COPPA_COMPLIANCE}

+ +

{L_COPPA_EXPLAIN}

+
+
+ + + + +
+
+ +
+ {S_HIDDEN_FIELDS} +   + + {S_FORM_TOKEN} +
+ +
+
+
+ + diff --git a/install/update/new/styles/prosilver/template/ucp_reset_password.html b/install/update/new/styles/prosilver/template/ucp_reset_password.html new file mode 100644 index 0000000..0a05f69 --- /dev/null +++ b/install/update/new/styles/prosilver/template/ucp_reset_password.html @@ -0,0 +1,49 @@ + + +
+ +
+
+ +
+

{{ lang('RESET_PASSWORD') }}

+ +
+ {% if S_IS_PASSWORD_RESET %} + {% if PASSWORD_RESET_ERRORS %}

{{ PASSWORD_RESET_ERRORS | join('
') }}

{% endif %} +
+
+
+
+
+
+
+
+ {% else %} + {% if USERNAME_REQUIRED %} +

{{ lang('EMAIL_NOT_UNIQUE') }}

+ {% endif %} +
+

{{ lang('EMAIL_REMIND') }}
+
+
+ {% if USERNAME_REQUIRED %} +
+
+
+
+ {% endif %} + {% endif %} +
+
 
+
{{ S_HIDDEN_FIELDS }} 
+
+ {{ S_FORM_TOKEN }} +
+
+ +
+
+
+ + diff --git a/install/update/new/styles/prosilver/template/viewforum_body.html b/install/update/new/styles/prosilver/template/viewforum_body.html new file mode 100644 index 0000000..40beb78 --- /dev/null +++ b/install/update/new/styles/prosilver/template/viewforum_body.html @@ -0,0 +1,315 @@ + + +

{FORUM_NAME}

+ + +
+ +
{FORUM_DESC}
+

{L_MODERATOR}{L_MODERATORS}{L_COLON} {MODERATORS}

+
+ + + +
+
+ + + {L_FORUM_RULES} + + {L_FORUM_RULES}
+ {FORUM_RULES} + + +
+
+ + + + + + + + + + +
+ + + + + + + {L_BUTTON_FORUM_LOCKED} + + {L_BUTTON_NEW_TOPIC} + + + + + + + + + + + +
+ + + + +
+
+ {L_NO_READ_ACCESS} +
+
+ + + +
+ +
+
+ +
+

{L_LOGIN_LOGOUT}  •  {L_REGISTER}

+ +
+
+
+
+
+
+
+
+
+
+
+
+
 
+
+
+ {S_LOGIN_REDIRECT} + {S_FORM_TOKEN_LOGIN} +
+
+ +
+
+ +
+ + + + + + + + + + + +
+
+ + + +
+
+
    +
  • +
    + id="active_topics">
    {L_ACTIVE_TOPICS}{L_ANNOUNCEMENTS}{L_TOPICS}
    +
    {L_REPLIES}
    +
    {L_VIEWS}
    +
    {L_LAST_POST}
    +
    +
  • +
+ +
+
+ + + + +
+
+ {L_NO_TOPICS} +
+
+ +
+
+ {L_NO_FORUMS_IN_CATEGORY} +
+
+ + + + +
+ + + + + + {L_BUTTON_FORUM_LOCKED} + + {L_BUTTON_NEW_TOPIC} + + + + + + + +
+ +
+ + + +
+ + + + + +
+

{L_WHO_IS_ONLINE}

+

{LOGGED_IN_USER_LIST}

+
+ + + +
+

{L_FORUM_PERMISSIONS}

+

{rules.RULE}

+
+ + + diff --git a/install/update/new/styles/prosilver/template/viewtopic_body.html b/install/update/new/styles/prosilver/template/viewtopic_body.html new file mode 100644 index 0000000..6af33f2 --- /dev/null +++ b/install/update/new/styles/prosilver/template/viewtopic_body.html @@ -0,0 +1,459 @@ + + + +

{TOPIC_TITLE}

+ + +
{FORUM_DESC}
+ + +

+ {L_MODERATOR}{L_MODERATORS}{L_COLON} {MODERATORS} +

+ + + +
+
+ + + {L_FORUM_RULES} + + {L_FORUM_RULES}
+ {FORUM_RULES} + + +
+
+ + +
+ + + + + + {L_BUTTON_TOPIC_LOCKED} + + {L_BUTTON_POST_REPLY} + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+
+ +
+

{POLL_QUESTION}

+

{L_POLL_LENGTH}
{L_MAX_VOTES}

+ +
+ + +
title="{L_POLL_VOTED_OPTION}" data-alt-text="{L_POLL_VOTED_OPTION}" data-poll-option-id="{poll_option.POLL_OPTION_ID}"> +
{poll_option.POLL_OPTION_CAPTION}
+
checked="checked" /> checked="checked" />
+
{poll_option.POLL_OPTION_RESULT}
+
{L_NO_VOTES}{poll_option.POLL_OPTION_PERCENT}
+
+ + + +
+
 
+
{L_TOTAL_VOTES}{L_COLON} {TOTAL_VOTES}
+
+ + +
+
 
+
+
+ + + +
+
 
+
{L_VIEW_RESULTS}
+
+ +
+ +
+ +
+ {S_FORM_TOKEN} + {S_HIDDEN_FIELDS} +
+ +
+
+ + + + + + + + data-url="{postrow.U_MINI_POST}"> + +
+
+ +
style="display: none;"> +
+
+ + + {postrow.POSTER_AVATAR}{postrow.POSTER_AVATAR} + + +
+ + {postrow.POST_AUTHOR_FULL}{postrow.POST_AUTHOR_FULL} + +
+ + +
{postrow.RANK_TITLE}
{postrow.RANK_IMG}
+ + +
{L_POSTS}{L_COLON} {postrow.POSTER_POSTS}
+
{L_JOINED}{L_COLON} {postrow.POSTER_JOINED}
+
{L_WARNINGS}{L_COLON} {postrow.POSTER_WARNINGS}
+ + + +
{postrow.PROFILE_FIELD1_NAME}{L_COLON} {postrow.PROFILE_FIELD1_VALUE}
+ + + + + +
{postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON} {postrow.custom_fields.PROFILE_FIELD_VALUE}
+ + + + + + +
+ {L_CONTACT}{L_COLON} + +
+ + + +
+ +
+ + +
+ {postrow.L_POST_DELETED_MESSAGE}
+ {postrow.L_POST_DISPLAY} +
+ +
+ {postrow.L_IGNORE_POST}
+ {postrow.L_POST_DISPLAY} +
+ + +
style="display: none;"> + + +

class="first">{postrow.POST_ICON_IMG_ALT} {postrow.POST_SUBJECT}

+ + + + + + + + + + + +

+ + {postrow.MINI_POST} + + + {postrow.MINI_POST} + + + {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} » +

+ + + + +
+

+ + {L_POST_UNAPPROVED_ACTION} + + + + {S_FORM_TOKEN} +

+
+ +

+ + {L_POST_UNAPPROVED_EXPLAIN} +

+ + +
+

+ {L_POST_DELETED_ACTION} + + + + + + {S_FORM_TOKEN} +

+
+ + + +

+ {L_POST_REPORTED} +

+ + +
{postrow.MESSAGE}
+ + + + +
+
+ {L_ATTACHMENTS} +
+ +
{postrow.attachment.DISPLAY_ATTACHMENT}
+ +
+ + + +
{L_DOWNLOAD_NOTICE}
+ +
+ {postrow.DELETED_MESSAGE} +
{L_REASON}{L_COLON} {postrow.DELETE_REASON} +
+ +
+ {postrow.EDITED_MESSAGE} +
{L_REASON}{L_COLON} {postrow.EDIT_REASON} +
+ + +


{postrow.BUMPED_MESSAGE}
+ +
{postrow.SIGNATURE}
+ + +
+ +
+ + + + + +
+
+ +
+ + + + + + + + +
+ + + + + + {L_BUTTON_TOPIC_LOCKED} + + {L_BUTTON_POST_REPLY} + + + + + + + + +
+ +
+ + + + + + + + + + + +
+ + + + + +
+

{L_WHO_IS_ONLINE}

+

{LOGGED_IN_USER_LIST}

+
+ + + diff --git a/install/update/new/styles/prosilver/template/viewtopic_print.html b/install/update/new/styles/prosilver/template/viewtopic_print.html new file mode 100644 index 0000000..658062f --- /dev/null +++ b/install/update/new/styles/prosilver/template/viewtopic_print.html @@ -0,0 +1,53 @@ + + + + + + +{META} +{SITENAME} • {PAGE_TITLE} + + + + + + +
+ + + + +
+
{PAGE_NUMBER}
+ +
+

{postrow.POST_SUBJECT}

+
{L_POSTED}{L_COLON} {postrow.POST_DATE}
+
{L_POST_BY_AUTHOR} {postrow.POST_AUTHOR}
+
{postrow.MESSAGE}
+
+
+ +
+ + +
+ + + diff --git a/install/update/new/styles/prosilver/theme/colours.css b/install/update/new/styles/prosilver/theme/colours.css new file mode 100644 index 0000000..04a8958 --- /dev/null +++ b/install/update/new/styles/prosilver/theme/colours.css @@ -0,0 +1,1168 @@ +/* +-------------------------------------------------------------- +Colours and backgrounds for common.css +-------------------------------------------------------------- */ + +html, body { + color: #536482; + background-color: #F5F7FA; +} + +h1 { + color: #FFFFFF; +} + +h2 { + color: #28313F; +} + +h3 { + border-bottom-color: #CCCCCC; + color: #115098; +} + +hr { + border-color: #FFFFFF; + border-top-color: #CCCCCC; +} + +/* +-------------------------------------------------------------- +Colours and backgrounds for links.css +-------------------------------------------------------------- */ + +a { color: #105289; } +a:hover { color: #D31141; } + +/* Links on gradient backgrounds */ +.forumbg .header a, .forabg .header a, th a { + color: #FFFFFF; +} + +.forumbg .header a:hover, .forabg .header a:hover, th a:hover { + color: #A8D8FF; +} + +/* Notification mark read link */ +.dropdown-extended a.mark_read { + background-color: #FFFFFF; +} + +/* Post body links */ +.postlink { + border-bottom-color: #368AD2; + color: #368AD2; +} + +.postlink:visited { + border-bottom-color: #5D8FBD; + color: #5D8FBD; +} + +.postlink:hover { + background-color: #D0E4F6; + color: #0D4473; +} + +.signature a, .signature a:hover { + background-color: transparent; +} + +/* Back to top of page */ +.top i { + color: #999999; +} + +/* Arrow links */ +.arrow-left:hover, .arrow-right:hover { + color: #368AD2; +} + +/* Round cornered boxes and backgrounds +---------------------------------------- */ +.wrap { + background-color: #FFF; + border-color: #E6E9ED; +} + +.headerbar { + color: #FFFFFF; +} + +.headerbar, .forumbg { + background-color: #12A3EB; + background-image: -webkit-linear-gradient(top, #6ACEFF 0%, #0076B1 2px, #12A3EB 92px, #12A3EB 100%); + background-image: linear-gradient(to bottom, #6ACEFF 0%,#0076B1 2px,#12A3EB 92px,#12A3EB 100%); + background-repeat: repeat-x; +} + +.forabg { + background-color: #0076B1; + background-image: -webkit-linear-gradient(top, #6ACEFF 0%, #12A3EB 2px, #0076B1 92px, #0076B1 100%); + background-image: linear-gradient(to bottom, #6ACEFF 0%,#12A3EB 2px,#0076B1 92px,#0076B1 100%); + background-repeat: repeat-x; +} + +.navbar { + background-color: #CADCEB; +} + +.panel { + background-color: #ECF1F3; + color: #28313F; +} + +.post:target .content { + color: #000000; +} + +.post:target h3 a { + color: #000000; +} + +.bg1 { + background-color: #ECF3F7; +} + +table.zebra-list tr:nth-child(odd) td, ul.zebra-list li:nth-child(odd) { + background-color: #ECF3F7; +} + +.bg2 { + background-color: #E1EBF2; +} + +table.zebra-list tr:nth-child(even) td, ul.zebra-list li:nth-child(even) { + background-color: #E1EBF2; +} + +.bg3 { + background-color: #CADCEB; +} + +.ucprowbg { + background-color: #DCDEE2; +} + +.fieldsbg { + background-color: #E7E8EA; +} + +.site_logo { + background-image: url("./images/site_logo.svg"); +} + +/* Horizontal lists +----------------------------------------*/ + +ul.navlinks { + border-top-color: #FFFFFF; +} + +/* Table styles +----------------------------------------*/ +table.table1 thead th { + color: #FFFFFF; +} + +table.table1 tbody tr { + border-color: #BFC1CF; +} + +table.table1 tbody tr:hover, table.table1 tbody tr.hover { + background-color: #CFE1F6; + color: #000; +} + +table.table1 td { + color: #536482; +} + +table.table1 tbody td { + border-top-color: #FAFAFA; +} + +table.table1 tbody th { + border-bottom-color: #000000; + color: #333333; + background-color: #FFFFFF; +} + +table.info tbody th { + color: #000000; +} + +/* Misc layout styles +---------------------------------------- */ +dl.details dt { + color: #000000; +} + +dl.details dd { + color: #536482; +} + +.sep { + color: #1198D9; +} + +/* Icon styles +---------------------------------------- */ +.icon.icon-blue, a:hover .icon.icon-blue { + color: #196db5; +} + +.icon.icon-green, a:hover .icon.icon-green{ + color: #1b9A1B; +} + +.icon.icon-red, a:hover .icon.icon-red{ + color: #BC2A4D; +} + +.icon.icon-orange, a:hover .icon.icon-orange{ + color: #FF6600; +} + +.icon.icon-bluegray, a:hover .icon.icon-bluegray{ + color: #536482; +} + +.icon.icon-gray, a:hover .icon.icon-gray{ + color: #777777; +} + +.icon.icon-lightgray, a:hover .icon.icon-lightgray{ + color: #999999; +} + +.icon.icon-black, a:hover .icon.icon-black{ + color: #333333; +} + +.alert_close .icon:before { + background-color: #FFFFFF; +} + +/* Jumpbox */ +.jumpbox .dropdown li { + border-top-color: #CCCCCC; +} + +.jumpbox-cat-link { + background-color: #0076b1; + border-top-color: #0076B1; + color: #FFFFFF; +} + +.jumpbox-cat-link:hover { + background-color: #12A3EB; + border-top-color: #12A3EB; + color: #FFFFFF; +} + +.jumpbox-forum-link { + background-color: #E1EBF2; +} + +.jumpbox-forum-link:hover { + background-color: #F6F4D0; +} + +.jumpbox .dropdown .pointer-inner { + border-color: #E1EBF2 transparent; +} + +.jumpbox-sub-link { + background-color: #E1EBF2; +} + +.jumpbox-sub-link:hover { + background-color: #F1F8FF; +} + +/* Miscellaneous styles +---------------------------------------- */ + +.copyright { + color: #555555; +} + +.error { + color: #BC2A4D; +} + +.reported { + background-color: #F7ECEF; +} + +li.reported:hover { + background-color: #ECD5D8 !important; +} +.sticky, .announce { + /* you can add a background for stickies and announcements*/ +} + +div.rules { + background-color: #ECD5D8; + color: #BC2A4D; +} + +p.post-notice { + background-color: #ECD5D8; + background-image: none; +} + +/* +-------------------------------------------------------------- +Colours and backgrounds for content.css +-------------------------------------------------------------- */ + +ul.forums { + background-color: #EEF5F9; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #D2E0EB 0%, #EEF5F9 100%); + background-image: linear-gradient(to bottom, #D2E0EB 0%,#EEF5F9 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D2E0EB', endColorstr='#EEF5F9',GradientType=0 ); /* IE6-9 */ +} + +ul.topiclist li { + color: #4C5D77; +} + +ul.topiclist dd { + border-left-color: #FFFFFF; +} + +.rtl ul.topiclist dd { + border-right-color: #FFFFFF; + border-left-color: transparent; +} + +li.row { + border-top-color: #FFFFFF; + border-bottom-color: #00608F; +} + +li.row strong { + color: #000000; +} + +li.row:hover { + background-color: #F6F4D0; +} + +li.row:hover dd { + border-left-color: #CCCCCC; +} + +.rtl li.row:hover dd { + border-right-color: #CCCCCC; + border-left-color: transparent; +} + +li.header dt, li.header dd { + color: #FFFFFF; +} + +/* Post body styles +----------------------------------------*/ +.postbody { + color: #333333; +} + +/* Content container styles +----------------------------------------*/ +.content { + color: #333333; +} + +.content h2, .panel h2 { + color: #115098; + border-bottom-color: #CCCCCC; +} + +dl.faq dt { + color: #333333; +} + +.posthilit { + background-color: #F3BFCC; + color: #BC2A4D; +} + +.announce, .unreadpost { + /* Highlight the announcements & unread posts box */ +} + +/* Post signature */ +.signature { + border-top-color: #CCCCCC; +} + +/* Post noticies */ +.notice { + border-top-color: #CCCCCC; +} + +/* BB Code styles +----------------------------------------*/ +/* Quote block */ +blockquote { + background-color: #EBEADD; + border-color:#DBDBCE; +} + +blockquote blockquote { + /* Nested quotes */ + background-color:#EFEED9; +} + +blockquote blockquote blockquote { + /* Nested quotes */ + background-color: #EBEADD; +} + +/* Code block */ +.codebox { + background-color: #FFFFFF; + border-color: #C9D2D8; +} + +.codebox p { + border-bottom-color: #CCCCCC; +} + +.codebox code { + color: #2E8B57; +} + +/* Attachments +----------------------------------------*/ +.attachbox { + background-color: #FFFFFF; + border-color: #C9D2D8; +} + +.pm-message .attachbox { + background-color: #F2F3F3; +} + +.attachbox dd { + border-top-color: #C9D2D8; +} + +.attachbox p { + color: #666666; +} + +.attachbox p.stats { + color: #666666; +} + +.attach-image img { + border-color: #999999; +} + +/* Inline image thumbnails */ + +dl.file dd { + color: #666666; +} + +dl.thumbnail img { + border-color: #666666; + background-color: #FFFFFF; +} + +dl.thumbnail dd { + color: #666666; +} + +dl.thumbnail dt a:hover { + background-color: #EEEEEE; +} + +dl.thumbnail dt a:hover img { + border-color: #368AD2; +} + +/* Post poll styles +----------------------------------------*/ + +fieldset.polls dl { + border-top-color: #DCDEE2; + color: #666666; +} + +fieldset.polls dl.voted { + color: #000000; +} + +fieldset.polls dd div { + color: #FFFFFF; +} + +.rtl .pollbar1, .rtl .pollbar2, .rtl .pollbar3, .rtl .pollbar4, .rtl .pollbar5 { + border-right-color: transparent; +} + +.pollbar1 { + background-color: #AA2346; + border-bottom-color: #74162C; + border-right-color: #74162C; +} + +.rtl .pollbar1 { + border-left-color: #74162C; +} + +.pollbar2 { + background-color: #BE1E4A; + border-bottom-color: #8C1C38; + border-right-color: #8C1C38; +} + +.rtl .pollbar2 { + border-left-color: #8C1C38; +} + +.pollbar3 { + background-color: #D11A4E; + border-bottom-color: #AA2346; + border-right-color: #AA2346; +} + +.rtl .pollbar3 { + border-left-color: #AA2346; +} + +.pollbar4 { + background-color: #E41653; + border-bottom-color: #BE1E4A; + border-right-color: #BE1E4A; +} + +.rtl .pollbar4 { + border-left-color: #BE1E4A; +} + +.pollbar5 { + background-color: #F81157; + border-bottom-color: #D11A4E; + border-right-color: #D11A4E; +} + +.rtl .pollbar5 { + border-left-color: #D11A4E; +} + +/* Poster profile block +----------------------------------------*/ +.postprofile { + color: #666666; + border-color: #FFFFFF; +} + +.pm .postprofile { + border-color: #DDDDDD; +} + +.postprofile strong { + color: #000000; +} + +.online { + background-image: url("./en/icon_user_online.gif"); +} + +dd.profile-warnings { + color: #BC2A4D; +} + +/* +-------------------------------------------------------------- +Colours and backgrounds for buttons.css +-------------------------------------------------------------- */ +.button { + border-color: #C7C3BF; + background-color: #E9E9E9; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #FFFFFF 0%, #E9E9E9 100%); + background-image: linear-gradient(to bottom, #FFFFFF 0%,#E9E9E9 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#FFFFFF', endColorstr='#E9E9E9',GradientType=0 ); /* IE6-9 */ + box-shadow: 0 0 0 1px #FFFFFF inset; + -webkit-box-shadow: 0 0 0 1px #FFFFFF inset; + color: #D31141; +} + +.button:hover, +.button:focus { + border-color: #0A8ED0; + background-color: #FFFFFF; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #E9E9E9 0%, #FFFFFF 100%); + background-image: linear-gradient(to bottom, #E9E9E9 0%,#FFFFFF 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#E9E9E9', endColorstr='#FFFFFF',GradientType=0 ); /* IE6-9 */ + text-shadow: 1px 1px 0 #FFFFFF, -1px -1px 0 #FFFFFF, -1px -1px 0 rgba(188, 42, 77, 0.2); +} + + +.button .icon, +.button-secondary { + color: #8f8f8f; +} + +.button-secondary:focus, +.button-secondary:hover, +.button:focus .icon, +.button:hover .icon { + color: #0A8ED0; +} + +.button-search:hover, +.button-search-end:hover { + border-color: #C7C3BF; +} + +.caret { border-color: #DADADA; } +.caret { border-color: #C7C3BF; } + +.contact-icons a { border-color: #DCDCDC; } +.contact-icons a:hover { background-color: #F2F6F9; } + +/* Pagination +---------------------------------------- */ + +.pagination li a { + background: #ECEDEE; + filter: none; + border-color: #B4BAC0; + box-shadow: none; + -webkit-box-shadow: none; + color: #5C758C; +} + +.pagination li.ellipsis span { + background: transparent; + color: #000000; +} + +.pagination li.active span { + background: #4692BF; + border-color: #4692BF; + color: #FFFFFF; +} + +.pagination li a:hover, .pagination li a:hover .icon, .pagination .dropdown-visible a.dropdown-trigger, .nojs .pagination .dropdown-container:hover a.dropdown-trigger { + background: #368AD2; + border-color: #368AD2; + filter: none; + color: #FFFFFF; + text-shadow: none; +} + +/* Search box +--------------------------------------------- */ + +.search-box .inputbox, +.search-box .inputbox:hover, +.search-box .inputbox:focus { + border-color: #C7C3BF; +} + +.search-header { + box-shadow: 0 0 10px #0075B0; +} + +.search-results li:hover, +.search-results li.active { + background-color: #CFE1F6; +} + +/* Icon images +---------------------------------------- */ + +.contact-icon { background-image: url("./images/icons_contact.png"); } + +/* Profile & navigation icons */ +.pm-icon { background-position: 0 0; } +.email-icon { background-position: -21px 0; } +.jabber-icon { background-position: -80px 0; } +.phpbb_icq-icon { background-position: -61px 0 ; } +.phpbb_wlm-icon { background-position: -182px 0; } +.phpbb_aol-icon { background-position: -244px 0; } +.phpbb_website-icon { background-position: -40px 0; } +.phpbb_youtube-icon { background-position: -98px 0; } +.phpbb_facebook-icon { background-position: -119px 0; } +.phpbb_googleplus-icon { background-position: -140px 0; } +.phpbb_skype-icon { background-position: -161px 0; } +.phpbb_twitter-icon { background-position: -203px 0; } +.phpbb_yahoo-icon { background-position: -224px 0; } + +/* Forum icons & Topic icons */ +.global_read { background-image: url("./images/announce_read.gif"); } +.global_read_mine { background-image: url("./images/announce_read_mine.gif"); } +.global_read_locked { background-image: url("./images/announce_read_locked.gif"); } +.global_read_locked_mine { background-image: url("./images/announce_read_locked_mine.gif"); } +.global_unread { background-image: url("./images/announce_unread.gif"); } +.global_unread_mine { background-image: url("./images/announce_unread_mine.gif"); } +.global_unread_locked { background-image: url("./images/announce_unread_locked.gif"); } +.global_unread_locked_mine { background-image: url("./images/announce_unread_locked_mine.gif"); } + +.announce_read { background-image: url("./images/announce_read.gif"); } +.announce_read_mine { background-image: url("./images/announce_read_mine.gif"); } +.announce_read_locked { background-image: url("./images/announce_read_locked.gif"); } +.announce_read_locked_mine { background-image: url("./images/announce_read_locked_mine.gif"); } +.announce_unread { background-image: url("./images/announce_unread.gif"); } +.announce_unread_mine { background-image: url("./images/announce_unread_mine.gif"); } +.announce_unread_locked { background-image: url("./images/announce_unread_locked.gif"); } +.announce_unread_locked_mine { background-image: url("./images/announce_unread_locked_mine.gif"); } + +.forum_link { background-image: url("./images/forum_link.gif"); } +.forum_read { background-image: url("./images/forum_read.gif"); } +.forum_read_locked { background-image: url("./images/forum_read_locked.gif"); } +.forum_read_subforum { background-image: url("./images/forum_read_subforum.gif"); } +.forum_unread { background-image: url("./images/forum_unread.gif"); } +.forum_unread_locked { background-image: url("./images/forum_unread_locked.gif"); } +.forum_unread_subforum { background-image: url("./images/forum_unread_subforum.gif"); } + +.sticky_read { background-image: url("./images/sticky_read.gif"); } +.sticky_read_mine { background-image: url("./images/sticky_read_mine.gif"); } +.sticky_read_locked { background-image: url("./images/sticky_read_locked.gif"); } +.sticky_read_locked_mine { background-image: url("./images/sticky_read_locked_mine.gif"); } +.sticky_unread { background-image: url("./images/sticky_unread.gif"); } +.sticky_unread_mine { background-image: url("./images/sticky_unread_mine.gif"); } +.sticky_unread_locked { background-image: url("./images/sticky_unread_locked.gif"); } +.sticky_unread_locked_mine { background-image: url("./images/sticky_unread_locked_mine.gif"); } + +.topic_moved { background-image: url("./images/topic_moved.gif"); } +.pm_read, +.topic_read { background-image: url("./images/topic_read.gif"); } +.topic_read_mine { background-image: url("./images/topic_read_mine.gif"); } +.topic_read_hot { background-image: url("./images/topic_read_hot.gif"); } +.topic_read_hot_mine { background-image: url("./images/topic_read_hot_mine.gif"); } +.topic_read_locked { background-image: url("./images/topic_read_locked.gif"); } +.topic_read_locked_mine { background-image: url("./images/topic_read_locked_mine.gif"); } +.pm_unread, +.topic_unread { background-image: url("./images/topic_unread.gif"); } +.topic_unread_mine { background-image: url("./images/topic_unread_mine.gif"); } +.topic_unread_hot { background-image: url("./images/topic_unread_hot.gif"); } +.topic_unread_hot_mine { background-image: url("./images/topic_unread_hot_mine.gif"); } +.topic_unread_locked { background-image: url("./images/topic_unread_locked.gif"); } +.topic_unread_locked_mine { background-image: url("./images/topic_unread_locked_mine.gif"); } + + +/* +-------------------------------------------------------------- +Colours and backgrounds for cp.css +-------------------------------------------------------------- */ + +/* Main CP box +----------------------------------------*/ + +.panel-container h3, .panel-container hr, .cp-menu hr { + border-color: #A4B3BF; +} + +.panel-container .panel li.row { + border-bottom-color: #B5C1CB; + border-top-color: #F9F9F9; +} + +ul.cplist { + border-top-color: #B5C1CB; +} + +.panel-container .panel li.header dd, .panel-container .panel li.header dt { + color: #000000; +} + +.panel-container table.table1 thead th { + color: #333333; + border-bottom-color: #333333; +} + +.cp-main .pm-message { + border-color: #DBDEE2; + background-color: #FFFFFF; +} + +/* CP tabbed menu +----------------------------------------*/ +.tabs .tab > a { + background: #BACCD9; + color: #536482; +} + +.tabs .tab > a:hover { + background: #DDEDFB; + color: #D31141; +} + +.tabs .activetab > a, +.tabs .activetab > a:hover { + background-color: #CADCEB; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #E2F2FF 0%, #CADCEB 100%); + background-image: linear-gradient(to bottom, #E2F2FF 0%,#CADCEB 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#E2F2FF', endColorstr='#CADCEB',GradientType=0 ); /* IE6-9 */ + border-color: #CADCEB; + box-shadow: 0 1px 1px #F2F9FF inset; + color: #333333; +} + +.tabs .activetab > a:hover { + color: #000000; +} + +/* Mini tabbed menu used in MCP +----------------------------------------*/ +.minitabs .tab > a { + background-color: #E1EBF2; +} + +.minitabs .activetab > a, +.minitabs .activetab > a:hover { + background-color: #F9F9F9; + color: #333333; +} + +/* Responsive tabs +----------------------------------------*/ +.responsive-tab .responsive-tab-link:before { + border-color: #536482; +} + +.responsive-tab .responsive-tab-link:hover:before { + border-color: #D31141; +} + +/* UCP navigation menu +----------------------------------------*/ + +/* Link styles for the sub-section links */ +.navigation a { + color: #333; + background: #CADCEB; /* Old browsers */ /* FF3.6+ */ + background: -webkit-linear-gradient(left, #B4C4D1 50%, #CADCEB 100%); + background: linear-gradient(to right, #B4C4D1 50%,#CADCEB 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#B4C4D1', endColorstr='#CADCEB',GradientType=1 ); /* IE6-9 */ +} + +.rtl .navigation a { + background: #B4C4D1; /* Old browsers */ /* FF3.6+ */ + background: -webkit-linear-gradient(left, #CADCEB 50%, #B4C4D1 100%); + background: linear-gradient(to right, #CADCEB 50%,#B4C4D1 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#CADCEB', endColorstr='#B4C4D1',GradientType=1 ); /* IE6-9 */ +} + +.navigation a:hover { + background: #AABAC6; + color: #BC2A4D; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} + +.navigation .active-subsection a { + background: #F9F9F9; + color: #D31141; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} + +.navigation .active-subsection a:hover { + color: #D31141; +} + +@media only screen and (max-width: 900px), only screen and (max-device-width: 900px) +{ + #navigation a, .rtl #navigation a { + background: #B2C2CF; + } +} + +/* Preferences pane layout +----------------------------------------*/ +.panel-container h2 { + color: #333333; +} + +.panel-container .panel { + background-color: #F9F9F9; +} + +.cp-main .pm { + background-color: #FFFFFF; +} + +/* Friends list */ +.cp-mini { + background-color: #EEF5F9; +} + +dl.mini dt { + color: #425067; +} + +/* PM Styles +----------------------------------------*/ +/* PM Message history */ +.current { + color: #000000 !important; +} + +/* PM marking colours */ +.pmlist li.pm_message_reported_colour, .pm_message_reported_colour { + border-left-color: #BC2A4D; + border-right-color: #BC2A4D; +} + +.pmlist li.pm_marked_colour, .pm_marked_colour { + border-color: #FF6600; +} + +.pmlist li.pm_replied_colour, .pm_replied_colour { + border-color: #A9B8C2; +} + +.pmlist li.pm_friend_colour, .pm_friend_colour { + border-color: #5D8FBD; +} + +.pmlist li.pm_foe_colour, .pm_foe_colour { + border-color: #000000; +} + +/* Avatar gallery */ +.gallery label { + background: #FFFFFF; + border-color: #CCC; +} + +.gallery label:hover { + background-color: #EEE; +} + +/* +-------------------------------------------------------------- +Colours and backgrounds for forms.css +-------------------------------------------------------------- */ + +/* General form styles +----------------------------------------*/ +select { + border-color: #666666; + background-color: #FAFAFA; + color: #000; +} + +label { + color: #425067; +} + +option.disabled-option { + color: graytext; +} + +/* Definition list layout for forms +---------------------------------------- */ +dd label { + color: #333; +} + +fieldset.fields1 { + background-color: transparent; +} + +/* Hover effects */ +fieldset dl:hover dt label { + color: #000000; +} + +fieldset.fields2 dl:hover dt label { + color: inherit; +} + +/* Quick-login on index page */ +fieldset.quick-login input.inputbox { + background-color: #F2F3F3; +} + +/* Posting page styles +----------------------------------------*/ + +.message-box textarea { + color: #333333; +} + +.message-box textarea.drag-n-drop { + outline-color: rgba(102, 102, 102, 0.5); +} + +.message-box textarea.drag-n-drop-highlight { + outline-color: rgba(17, 163, 234, 0.5); +} + +/* Input field styles +---------------------------------------- */ +.inputbox { + background-color: #FFFFFF; + border-color: #B4BAC0; + color: #333333; +} + +.inputbox:-moz-placeholder { + color: #333333; +} + +.inputbox::-webkit-input-placeholder { + color: #333333; +} + +.inputbox:hover { + border-color: #11A3EA; +} + +.inputbox:focus { + border-color: #11A3EA; +} + +.inputbox:focus:-moz-placeholder { + color: transparent; +} + +.inputbox:focus::-webkit-input-placeholder { + color: transparent; +} + + +/* Form button styles +---------------------------------------- */ + +a.button1, input.button1, input.button3, a.button2, input.button2 { + color: #000; + background-color: #EFEFEF; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #D2D2D2 0%, #EFEFEF 100%); + background-image: linear-gradient(to bottom, #D2D2D2 0%,#EFEFEF 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D2D2D2', endColorstr='#EFEFEF',GradientType=0 ); /* IE6-9 */ +} + +a.button1, input.button1 { + border-color: #666666; +} + +input.button3 { + background-image: none; +} + +/* Alternative button */ +a.button2, input.button2, input.button3 { + border-color: #666666; +} + +/* button in the style of the form buttons */ +a.button1, a.button2 { + color: #000000; +} + +/* Hover states */ +a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover { + border-color: #D31141; + color: #D31141; + background-color: #D2D2D2; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #EFEFEF 0%, #D2D2D2 100%); + background-image: linear-gradient(to bottom, #EFEFEF 0%,#D2D2D2 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#EFEFEF', endColorstr='#D2D2D2',GradientType=0 ); /* IE6-9 */ +} + +/* Focus states */ +input.button1:focus, input.button2:focus, input.button3:focus { + border-color: #11A3EA; + color: #0F4987; +} + +input.disabled { + color: #666666; +} + +/* jQuery popups +---------------------------------------- */ +.phpbb_alert { + background-color: #FFFFFF; + border-color: #999999; +} +.darken { + background-color: #000000; +} + +.loading_indicator { + background-color: #000000; + background-image: url("./images/loading.gif"); +} + +.dropdown-extended ul li { + border-top-color: #B9B9B9; +} + +.dropdown-extended ul li:hover { + background-color: #CFE1F6; + color: #000000; +} + +.dropdown-extended .header, .dropdown-extended .footer { + border-color: #B9B9B9; + color: #000000; +} + +.dropdown-extended .footer { + border-top-style: solid; + border-top-width: 1px; +} + +.dropdown-extended .header { + background-color: #F1F8FF; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #F1F8FF 0%, #CADCEB 100%); + background-image: linear-gradient(to bottom, #F1F8FF 0%,#CADCEB 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F1F8FF', endColorstr='#CADCEB',GradientType=0 ); /* IE6-9 */ +} + +.dropdown .pointer { + border-color: #B9B9B9 transparent; +} + +.dropdown .pointer-inner { + border-color: #FFF transparent; +} + +.dropdown-extended .pointer-inner { + border-color: #F1F8FF transparent; +} + +.dropdown .dropdown-contents { + background: #fff; + border-color: #B9B9B9; + box-shadow: 1px 3px 5px rgba(0, 0, 0, 0.2); +} + +.dropdown-up .dropdown-contents { + box-shadow: 1px 0 5px rgba(0, 0, 0, 0.2); +} + +.dropdown li, .dropdown li li { + border-color: #DCDCDC; +} + +.dropdown li.separator { + border-color: #DCDCDC; +} + +/* Notifications +---------------------------------------- */ + +.notification_list p.notification-time { + color: #4C5D77; +} + +li.notification-reported strong, li.notification-disapproved strong { + color: #D31141; +} + +.badge { + background-color: #D31141; + color: #ffffff; +} diff --git a/install/update/new/styles/prosilver/theme/common.css b/install/update/new/styles/prosilver/theme/common.css new file mode 100644 index 0000000..eb04c66 --- /dev/null +++ b/install/update/new/styles/prosilver/theme/common.css @@ -0,0 +1,1288 @@ +/* General Markup Styles +---------------------------------------- */ +html { + font-size: 100%; + /* Always show a scrollbar for short pages - stops the jump when the scrollbar appears. non-IE browsers */ + height: 101%; +} + +body { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 10px; + line-height: normal; + margin: 0; + padding: 12px 0; + word-wrap: break-word; + -webkit-print-color-adjust: exact; +} + +h1 { + /* Forum name */ + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + margin-right: 200px; + margin-top: 15px; + font-weight: bold; + font-size: 2em; +} + +h2 { + /* Forum header titles */ + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + font-weight: normal; + font-size: 2em; + margin: 0.8em 0 0.2em 0; +} + +h2.solo { + margin-bottom: 1em; +} + +h3 { + /* Sub-headers (also used as post headers, but defined later) */ + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + text-transform: uppercase; + border-bottom: 1px solid transparent; + margin-bottom: 3px; + padding-bottom: 2px; + font-size: 1.05em; + margin-top: 20px; +} + +h4 { + /* Forum and topic list titles */ + font-family: "Trebuchet MS", Verdana, Helvetica, Arial, Sans-serif; + font-size: 1.3em; +} + +p { + line-height: 1.3em; + font-size: 1.1em; + margin-bottom: 1.5em; +} + +img { + border-width: 0; +} + +hr { + border: 0 solid transparent; + border-top-width: 1px; + height: 1px; + margin: 5px 0; + display: block; + clear: both; +} + +hr.dashed { + border-top-style: dashed; + margin: 10px 0; +} + +hr.divider { + display: none; +} + +p.right { + text-align: right; +} + +p.jumpbox-return { + margin-top: 10px; + margin-bottom: 0; + float: left; +} + +b, strong { + font-weight: bold; +} + +.text-strong { + font-weight: bold; +} + +i, em { + font-style: italic; +} + +.text-italics { + font-style: italic; +} + +u { + text-decoration: underline; +} + +ul { + list-style-type: disc; +} + +ol { + list-style-type: decimal; +} + +li { + display: list-item; +} + +ul ul, ol ul { + list-style-type: circle; +} + +ol ol ul, ol ul ul, ul ol ul, ul ul ul { + list-style-type: square; +} + +a:hover { text-decoration: underline; } + +/* Main blocks +---------------------------------------- */ +.wrap { + border: 1px solid transparent; + border-radius: 8px; + margin: 0 auto; + max-width: 1152px; + min-width: 625px; + padding: 15px; +} + +@media only screen and (max-width: 1220px), only screen and (max-device-width: 1220px) { + .wrap { + margin: 0 12px; + } +} + +.page-body { + margin: 4px 0; + clear: both; +} + +.page-footer { + clear: both; +} + +.page-footer h3 { + margin-top: 20px; +} + +.logo { + float: left; + width: auto; + padding: 10px 13px 0 10px; +} + +.logo:hover { + text-decoration: none; +} + +.site_logo { + background-repeat: no-repeat; + display: inline-block; + width: 149px; + height: 52px; +} + +/* Site description and logo */ +.site-description { + float: left; + width: 65%; +} + +.site-description h1 { + margin-right: 0; +} + +/* Round cornered boxes and backgrounds +---------------------------------------- */ +.headerbar { + margin-bottom: 4px; + padding: 5px; + border-radius: 7px; +} + +.navbar { + padding: 3px 10px; + border-radius: 7px; +} + +.forabg { + margin-bottom: 4px; + padding: 5px; + clear: both; + border-radius: 7px; +} + +.forumbg { + margin-bottom: 4px; + padding: 5px; + clear: both; + border-radius: 7px; +} + +.panel { + margin-bottom: 4px; + padding: 5px 10px; + border-radius: 7px; +} + +.post { + padding: 5px 10px; + margin-bottom: 4px; + background-repeat: no-repeat; + background-position: 100% 0; + border-radius: 7px; + position: relative; +} + +.rowbg { + margin: 5px 5px 2px 5px; +} + +/* Horizontal lists +----------------------------------------*/ +.navbar ul.linklist { + padding: 2px 0; + list-style-type: none; +} + +ul.linklist { + display: block; + margin: 0; +} + +.cp-main .panel { + padding: 5px 10px; +} + +ul.linklist > li { + float: left; + font-size: 1.1em; + line-height: 2.2em; + list-style-type: none; + margin-right: 7px; + padding-top: 1px; + width: auto; +} + +ul.linklist > li.rightside, p.rightside, a.rightside { + float: right; + margin-right: 0; + margin-left: 7px; + text-align: right; +} + +ul.navlinks { + border-top: 1px solid transparent; +} + +ul.leftside { + float: left; + margin-left: 0; + margin-right: 5px; + text-align: left; +} + +ul.rightside { + float: right; + margin-left: 5px; + margin-right: -5px; + text-align: right; +} + +ul.linklist li.responsive-menu { + position: relative; + margin: 0 5px 0 0; +} + +.hasjs ul.linklist.leftside, .hasjs ul.linklist.rightside { + max-width: 48%; +} + +.hasjs ul.linklist.fullwidth { + max-width: none; +} + +li.responsive-menu.dropdown-right .dropdown { + left: -9px; +} + +li.responsive-menu.dropdown-left .dropdown { + right: -6px; +} + +ul.linklist .dropdown { + top: 22px; +} + +ul.linklist .dropdown-up .dropdown { + bottom: 18px; + top: auto; +} + +/* Bulletin icons for list items +----------------------------------------*/ +ul.linklist.bulletin > li:before { + display: inline-block; + content: "\2022"; + font-size: inherit; + line-height: inherit; + padding-right: 4px; +} + +ul.linklist.bulletin > li:first-child:before, +ul.linklist.bulletin > li.rightside:last-child:before { + content: none; +} + +ul.linklist.bulletin > li.no-bulletin:before { + content: none; +} + +.responsive-menu:before { + display: none !important; +} + +/* Profile in overall_header.html */ +.header-profile { + display: inline-block; + vertical-align: top; +} + +a.header-avatar, +a.header-avatar:hover { + text-decoration: none; +} + +a.header-avatar img { + margin-bottom: 2px; + max-height: 20px; + vertical-align: middle; + width: auto; +} + +a.header-avatar span:after { + content: '\f0dd'; + display: inline-block; + font: normal normal normal 14px/1 FontAwesome; + padding-left: 6px; + padding-top: 2px; + vertical-align: top; +} + +/* Dropdown menu +----------------------------------------*/ +.dropdown-container { + position: relative; +} + +.dropdown-container-right { + float: right; +} + +.dropdown-container-left { + float: left; +} + +.nojs .dropdown-container:hover .dropdown { + display: block !important; +} + +.dropdown { + display: none; + position: absolute; + left: 0; + top: 1.2em; + z-index: 2; + border: 1px solid transparent; + border-radius: 5px; + padding: 9px 0 0; + margin-right: -500px; +} + +.dropdown.live-search { + top: auto; +} + +.dropdown-container.topic-tools { + float: left; +} + +.dropdown-up .dropdown { + top: auto; + bottom: 1.2em; + padding: 0 0 9px; +} + +.dropdown-left .dropdown, .nojs .rightside .dropdown { + left: auto; + right: 0; + margin-left: -500px; + margin-right: 0; +} + +.dropdown-button-control .dropdown { + top: 24px; +} + +.dropdown-button-control.dropdown-up .dropdown { + top: auto; + bottom: 24px; +} + +.dropdown .pointer, .dropdown .pointer-inner { + position: absolute; + width: 0; + height: 0; + border-top-width: 0; + border-bottom: 10px solid transparent; + border-left: 10px dashed transparent; + border-right: 10px dashed transparent; + -webkit-transform: rotate(360deg); /* better anti-aliasing in webkit */ + display: block; +} + +.dropdown-up .pointer, .dropdown-up .pointer-inner { + border-bottom-width: 0; + border-top: 10px solid transparent; +} + +.dropdown .pointer { + right: auto; + left: 10px; + top: -1px; + z-index: 3; +} + +.dropdown-up .pointer { + bottom: -1px; + top: auto; +} + +.dropdown-left .dropdown .pointer, .nojs .rightside .dropdown .pointer { + left: auto; + right: 10px; +} + +.dropdown .pointer-inner { + top: auto; + bottom: -11px; + left: -10px; +} + +.dropdown-up .pointer-inner { + bottom: auto; + top: -11px; +} + +.dropdown .dropdown-contents { + z-index: 2; + overflow: hidden; + overflow-y: auto; + border: 1px solid transparent; + border-radius: 5px; + padding: 5px; + position: relative; + max-height: 300px; +} + +.dropdown-contents a { + display: block; + padding: 5px; +} + +.jumpbox { + margin: 5px 0; +} + +.jumpbox .dropdown li { + border-top: 1px solid transparent; +} + +.jumpbox .dropdown-select { + margin: 0; +} + +.jumpbox .dropdown-contents { + padding: 0; + text-decoration: none; +} + +.jumpbox .dropdown-contents li { + padding: 0; +} + +.jumpbox .dropdown-contents a { + margin-right: 20px; + padding: 5px 10px; + text-decoration: none; + width: 100%; +} + +.jumpbox .spacer { + display: inline-block; + width: 0px; +} + +.jumpbox .spacer + .spacer { + width: 20px; +} + +.dropdown-contents a { + display: block; + padding: 5px; +} + +.jumpbox .dropdown-select { + margin: 0; +} + +.jumpbox .dropdown-contents a { + text-decoration: none; +} + +.dropdown li { + display: list-item; + border-top: 1px dotted transparent; + float: none !important; + line-height: normal !important; + font-size: 1em !important; + list-style: none; + margin: 0; + white-space: nowrap; + text-align: left; +} + +.dropdown-contents > li { + padding-right: 15px; +} + +.dropdown-nonscroll > li { + padding-right: 0; +} + +.dropdown li:first-child, .dropdown li.separator + li, .dropdown li li { + border-top: 0; +} + +.dropdown li li:first-child { + margin-top: 4px; +} + +.dropdown li li:last-child { + padding-bottom: 0; +} + +.dropdown li li { + border-top: 1px dotted transparent; + padding-left: 18px; +} + +.wrap .dropdown li, .dropdown.wrap li, .dropdown-extended li { + white-space: normal; +} + +.dropdown li.separator { + border-top: 1px solid transparent; + padding: 0; +} + +.dropdown li.separator:first-child, .dropdown li.separator:last-child { + display: none !important; +} + +/* Responsive breadcrumbs +----------------------------------------*/ +.breadcrumbs .crumb { + float: left; + font-weight: bold; + word-wrap: normal; +} + +.breadcrumbs .crumb:before { + content: '\2039'; + font-weight: bold; + padding: 0 0.5em; +} + +.breadcrumbs .crumb:first-child:before { + content: none; +} + +.breadcrumbs .crumb a { + white-space: nowrap; + text-overflow: ellipsis; + vertical-align: bottom; + overflow: hidden; +} + +.breadcrumbs.wrapped .crumb a { letter-spacing: -.3px; } +.breadcrumbs.wrapped .crumb.wrapped-medium a { letter-spacing: -.4px; } +.breadcrumbs.wrapped .crumb.wrapped-tiny a { letter-spacing: -.5px; } + +.breadcrumbs .crumb.wrapped-max a { max-width: 120px; } +.breadcrumbs .crumb.wrapped-wide a { max-width: 100px; } +.breadcrumbs .crumb.wrapped-medium a { max-width: 80px; } +.breadcrumbs .crumb.wrapped-small a { max-width: 60px; } +.breadcrumbs .crumb.wrapped-tiny a { max-width: 40px; } + +/* Table styles +----------------------------------------*/ +table.table1 { + width: 100%; +} + +.ucp-main table.table1 { + padding: 2px; +} + +table.table1 thead th { + font-weight: normal; + text-transform: uppercase; + line-height: 1.3em; + font-size: 1em; + padding: 0 0 4px 3px; +} + +table.table1 thead th span { + padding-left: 7px; +} + +table.table1 tbody tr { + border: 1px solid transparent; +} + +table.table1 td { + font-size: 1.1em; +} + +table.table1 tbody td { + padding: 5px; + border-top: 1px solid transparent; +} + +table.table1 tbody th { + padding: 5px; + border-bottom: 1px solid transparent; + text-align: left; +} + +/* Specific column styles */ +table.table1 .name { text-align: left; } +table.table1 .center { text-align: center; } +table.table1 .reportby { width: 15%; } +table.table1 .posts { text-align: center; width: 7%; } +table.table1 .joined { text-align: left; width: 15%; } +table.table1 .active { text-align: left; width: 15%; } +table.table1 .mark { text-align: center; width: 7%; } +table.table1 .info { text-align: left; width: 30%; } +table.table1 .info div { width: 100%; white-space: normal; overflow: hidden; } +table.table1 .autocol { line-height: 2em; white-space: nowrap; } +table.table1 thead .autocol { padding-left: 1em; } + +table.table1 span.rank-img { + float: right; + width: auto; +} + +table.info td { + padding: 3px; +} + +table.info tbody th { + padding: 3px; + text-align: right; + vertical-align: top; + font-weight: normal; +} + +.forumbg table.table1 { + margin: 0; +} + +.forumbg-table > .inner { + margin: 0 -1px; +} + +.color_palette_placeholder table { + border-collapse: separate; + border-spacing: 1px; +} + +/* Misc layout styles +---------------------------------------- */ +/* column[1-2] styles are containers for two column layouts */ +.column1 { + float: left; + clear: left; + width: 49%; +} + +.column2 { + float: right; + clear: right; + width: 49%; +} + +/* General classes for placing floating blocks */ +.left-box { + float: left; + width: auto; + text-align: left; + max-width: 100%; +} + +.left-box.profile-details { + width: 80%; +} + +.right-box { + float: right; + width: auto; + text-align: right; + max-width: 100%; +} + +dl.details { + /*font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;*/ + font-size: 1.1em; +} + +dl.details dt { + float: left; + clear: left; + width: 30%; + text-align: right; + display: block; +} + +dl.details dd { + margin-left: 0; + padding-left: 5px; + margin-bottom: 5px; + float: left; + width: 65%; + overflow: hidden; + text-overflow: ellipsis; +} + +.clearfix, fieldset dl, ul.topiclist dl, dl.polls { + overflow: hidden; +} + +fieldset.fields1 ul.recipients { + list-style-type: none; + line-height: 1.8; + max-height: 150px; + overflow-y: auto; +} + +fieldset.fields1 dd.recipients { + clear: left; + margin-left: 1em; +} + +fieldset.fields1 ul.recipients input.button2{ + font-size: 0.8em; + margin-right: 0; + padding: 0; +} + +fieldset.fields1 dl.pmlist > dt { + width: auto !important; +} + +fieldset.fields1 dl.pmlist dd.recipients { + margin-left: 0 !important; +} + +/* Action-bars (container for post/reply buttons, pagination, etc.) +---------------------------------------- */ +.action-bar { + font-size: 11px; + margin: 4px 0; +} + +.forabg + .action-bar { + margin-top: 2em; +} + +.action-bar .button { + margin-right: 5px; + float: left; +} + +.action-bar .button-search { + margin-right: 0; +} + +/* Pagination +---------------------------------------- */ +.pagination { + float: right; + text-align: right; + width: auto; +} + +.action-bar.bar-bottom .pagination { + margin-top: 0; +} + +.action-bar .pagination .button { + margin-right: 0; + float: none; +} + +.pagination > ul { + display: inline-block; + list-style: none !important; + margin-left: 5px; +} + +.pagination > ul > li { + display: inline-block !important; + padding: 0; + font-size: 100%; + line-height: normal; + vertical-align: middle; +} + +.pagination li a, .pagination li span { + border-radius: 2px; + padding: 2px 5px; +} + +.pagination li.active span { + display: inline-block; + font-size: 13px; + font-weight: normal; + font-family: "Open Sans", "Droid Sans", Verdana, Arial, Helvetica; + line-height: 1.4; + text-align: center; + white-space: nowrap; + vertical-align: middle; + border: 1px solid transparent; +} + +.pagination li.ellipsis span { + border: none; + padding: 0; +} + +.pagination li.page-jump { + margin-right: 5px; +} + +.pagination li.page-jump a { + padding: 0 8px; +} + +.pagination li.page-jump a i { + font-size: 21px; +} + +.pagination .arrow a { + padding: 2px 0; +} + +/* Pagination in viewforum for multipage topics */ +.row .pagination { + display: block; + margin-top: 3px; + margin-bottom: 3px; +} + +.row .pagination > ul { + margin: 0; +} + +.row .pagination li a, .row .pagination li span { + border-radius: 2px; + padding: 1px 3px; + font-size: 9px; +} + +/* jQuery popups +---------------------------------------- */ +.phpbb_alert { + border: 1px solid transparent; + display: none; + left: 0; + padding: 0 25px 20px 25px; + position: fixed; + right: 0; + top: 150px; + z-index: 50; + width: 620px; + margin: 0 auto; +} + +@media only screen and (max-height: 500px), only screen and (max-device-width: 500px) +{ + .phpbb_alert { + top: 25px; + } +} + +.phpbb_alert .alert_close { + float: right; + margin-right: -36px; + margin-top: -8px; +} + +.phpbb_alert p { + margin: 8px 0; + padding-bottom: 8px; +} + +.phpbb_alert label { + display: block; + margin: 8px 0; + padding-bottom: 8px; +} + +.phpbb_alert div.alert_text > p, +.phpbb_alert div.alert_text > label, +.phpbb_alert div.alert_text > select, +.phpbb_alert div.alert_text > textarea, +.phpbb_alert div.alert_text > input { + font-size: 1.1em; +} + +.darkenwrapper { + display: none; + position: relative; + z-index: 44; +} + +.darken { + position: fixed; + left: 0; + top: 0; + width: 100%; + height: 100%; + opacity: 0.5; + z-index: 45; +} + +.loading_indicator { + background: center center no-repeat; + border-radius: 5px; + display: none; + opacity: 0.8; + margin-top: -50px; + margin-left: -50px; + height: 50px; + width: 50px; + position: fixed; + left: 50%; + top: 50%; + z-index: 51; +} + +/* Miscellaneous styles +---------------------------------------- */ +.copyright { + font-size: 10px; + text-align: center; + padding: 10px; +} + +.footer-row { + font-size: 10px; + line-height: 1.8; + margin: 0; +} + +.small { + font-size: 0.9em !important; +} + +.titlespace { + margin-bottom: 15px; +} + +.headerspace { + margin-top: 20px; +} + +.error { + font-weight: bold; + font-size: 1em; +} + +div.rules { + margin: 10px 0; + font-size: 1.1em; + padding: 5px 10px; + border-radius: 7px; +} + +div.rules ul, div.rules ol { + margin-left: 20px; +} + +p.post-notice { + position: relative; + padding: 5px; + min-height: 14px; + margin-bottom: 1em; +} + +form > p.post-notice strong { + line-height: 20px; +} + +.stat-block { + clear: both; +} + +.top-anchor { + display: block; + position: absolute; + top: -20px; +} + +.clear { + display: block; + clear: both; + font-size: 1px; + line-height: 1px; + background: transparent; +} + +/* Inner box-model clearing */ +.inner:after, +ul.linklist:after, +.action-bar:after, +.notification_text:after, +.tabs-container:after, +.tabs > ul:after, +.minitabs > ul:after, +.postprofile .avatar-container:after { + clear: both; + content: ''; + display: block; +} + +.emoji { + min-height: 18px; + min-width: 18px; + height: 1em; + width: 1em; +} + +.smilies { + vertical-align: text-bottom; +} + +.icon-notification { + position: relative; +} + +.member-search { + float: left; + margin: 0; + padding: 6px 10px; +} + +.member-search strong { + font-size: 0.95em; +} + +.dropdown-extended { + display: none; + z-index: 1; +} + +.dropdown-extended ul { + max-height: 350px; + overflow-y: auto; + overflow-x: hidden; + clear: both; +} + +.dropdown-extended ul li { + padding: 0; + margin: 0 !important; + float: none; + border-top: 1px solid; + list-style-type: none; + font-size: 0.95em; + clear: both; + position: relative; +} + +.dropdown-extended ul li:first-child { + border-top: none; +} + +.dropdown-extended ul li.no_notifications { + padding: 10px; +} + +.dropdown-extended .dropdown-contents { + max-height: none; + padding: 0; + position: absolute; + width: 340px; +} + +.nojs .dropdown-extended .dropdown-contents { + position: relative; +} + +.dropdown-extended .header { + padding: 0 10px; + font-family: Arial, "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: bold; + text-align: left; + text-shadow: 1px 1px 1px white; + text-transform: uppercase; + line-height: 3em; + border-bottom: 1px solid; + border-radius: 5px 5px 0 0; +} + +.dropdown-extended .header .header_settings { + float: right; + font-weight: normal; + text-transform: none; +} + +.dropdown-extended .header .header_settings a { + display: inline-block; + padding: 0 5px; +} + +.dropdown-extended .header:after { + content: ''; + display: table; + clear: both; +} + +.dropdown-extended .footer { + text-align: center; + font-size: 1.1em; +} + +.dropdown-extended ul li a, .dropdown-extended ul li.no-url { + padding: 8px; +} + +.dropdown-extended .footer > a { + padding: 5px 0; +} + +.dropdown-extended ul li a, .notification_list dt > a, .dropdown-extended .footer > a { + display: block; + text-decoration: none; +} + +.notification_list ul li img { + float: left; + max-height: 50px; + max-width: 50px; + width: auto !important; + height: auto !important; + margin-right: 5px; +} + +.notification_list ul li p { + margin-bottom: 4px; + font-size: 1em; +} + +.notification_list p.notification-reference, +.notification_list p.notification-location, +.notification_list li a p.notification-reason { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.notification_list p.notification-time { + font-size: 0.9em; + margin: 0; + text-align: right; +} + +.notification_list div.notifications { + margin-left: 50px; + padding: 5px; +} + +.notification_list div.notifications a { + display: block; +} + +.notification_list p.notifications_title { + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + font-size: 1.2em !important; +} + +.notification_list p.notifications_title strong { + font-weight: bold; +} + +.notification_list p.notifications_time { + font-size: 0.9em !important; +} + +.notification_text { + margin-left: 58px; +} + +.badge { + border-radius: 10px; + opacity: 0.8; + text-align: center; + white-space: nowrap; + font-size: 10px; + line-height: 1; + float: right; + display: inline-block; + margin-left: 3px; + vertical-align: baseline; + position: relative; + top: 3px; + padding: 4px 6px; +} + +.badge.hidden { + display: none; +} + +/* Navbar specific list items +----------------------------------------*/ + +.linklist .quick-links { + margin: 0 7px 0 0; +} + +.linklist.compact .rightside > a > span { + display: none; +} + +.dropdown-page-jump .dropdown { + top: 20px; +} + +.dropdown-page-jump.dropdown-up .dropdown { + bottom: 20px; +} + +.dropdown-page-jump input.tiny { + width: 50px; +} + +.dropdown .clone.hidden { + display: none; +} + +.dropdown .clone.hidden + li.separator { + display: none; +} + +.dropdown .clone.hidden + li { + border-top: none; +} diff --git a/install/update/new/styles/prosilver/theme/forms.css b/install/update/new/styles/prosilver/theme/forms.css new file mode 100644 index 0000000..99c898f --- /dev/null +++ b/install/update/new/styles/prosilver/theme/forms.css @@ -0,0 +1,429 @@ +/* Form Styles +---------------------------------------- */ + +/* General form styles +----------------------------------------*/ +fieldset { + border-width: 0; + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 1.1em; +} + +input { + font-weight: normal; + vertical-align: middle; + padding: 0 3px; + font-size: 1em; + font-family: Verdana, Helvetica, Arial, sans-serif; +} + +select { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-weight: normal; + cursor: pointer; + vertical-align: middle; + border: 1px solid transparent; + padding: 1px; + font-size: 1em; +} + +select:focus { + outline-style: none; +} + +option { + padding-right: 1em; +} + +select optgroup option { + padding-right: 1em; + font-family: Verdana, Helvetica, Arial, sans-serif; +} + +textarea { + font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + width: 60%; + padding: 2px; + font-size: 1em; + line-height: 1.4em; +} + +label { + cursor: default; + padding-right: 5px; +} + +label input { + vertical-align: middle; +} + +label img { + vertical-align: middle; +} + +/* Definition list layout for forms +---------------------------------------- */ +fieldset dl { + padding: 4px 0; +} + +fieldset dt { + float: left; + width: 40%; + text-align: left; + display: block; +} + +fieldset dd { + margin-left: 41%; + vertical-align: top; + margin-bottom: 3px; +} + +/* Specific layout 1 */ +fieldset.fields1 dt { + width: 15em; + border-right-width: 0; +} + +fieldset.fields1 dd { + margin-left: 15em; + border-left-width: 0; +} + +fieldset.fields1 div { + margin-bottom: 3px; +} + +/* Set it back to 0px for the reCaptcha divs: PHPBB3-9587 */ +fieldset.fields1 .live-search div { + margin-bottom: 0; +} + +/* Specific layout 2 */ +fieldset.fields2 dt { + width: 15em; + border-right-width: 0; +} + +fieldset.fields2 dd { + margin-left: 16em; + border-left-width: 0; +} + +/* Form elements */ +dt label { + font-weight: bold; + text-align: left; +} + +dd label { + white-space: nowrap; +} + +dd input, dd textarea { + margin-right: 3px; +} + +dd select { + width: auto; +} + +dd select[multiple] { + width: 100%; +} + +dd textarea { + width: 85%; +} + +/* Hover effects */ +.timezone { + width: 95%; +} + +/* Browser-specific tweaks */ +button::-moz-focus-inner { + padding: 0; + border: 0 +} + +/* Quick-login on index page */ +fieldset.quick-login { + margin-top: 5px; +} + +fieldset.quick-login input { + width: auto; +} + +fieldset.quick-login input.inputbox { + width: 15%; + vertical-align: middle; + margin-right: 5px; +} + +fieldset.quick-login label { + white-space: nowrap; + padding-right: 2px; +} + +/* Display options on viewtopic/viewforum pages */ +fieldset.display-options { + text-align: center; + margin: 3px 0 5px 0; +} + +fieldset.display-options label { + white-space: nowrap; + padding-right: 2px; +} + +fieldset.display-options a { + margin-top: 3px; +} + +.dropdown fieldset.display-options { + font-size: 1em; + margin: 0; + padding: 0; +} + +.dropdown fieldset.display-options label { + display: block; + margin: 4px; + padding: 0; + text-align: right; + white-space: nowrap; +} + +.dropdown fieldset.display-options select { + min-width: 120px; +} + +/* Display actions for ucp and mcp pages */ +fieldset.display-actions { + text-align: right; + line-height: 2em; + white-space: nowrap; + padding-right: 1em; +} + +fieldset.display-actions label { + white-space: nowrap; + padding-right: 2px; +} + +fieldset.sort-options { + line-height: 2em; +} + +/* MCP forum selection*/ +fieldset.forum-selection { + margin: 5px 0 3px 0; + float: right; +} + +fieldset.forum-selection2 { + margin: 13px 0 3px 0; + float: right; +} + +/* Submit button fieldset */ +fieldset.submit-buttons { + text-align: center; + vertical-align: middle; + margin: 5px 0; +} + +fieldset.submit-buttons input { + vertical-align: middle; +} + +/* Posting page styles +----------------------------------------*/ + +/* Buttons used in the editor */ +.format-buttons { + margin: 15px 0 2px 0; +} + +.format-buttons input, .format-buttons select { + vertical-align: middle; +} + +/* Main message box */ +.message-box { + width: 80%; +} + +.message-box textarea { + font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; + width: 450px; + height: 270px; + min-width: 100%; + max-width: 100%; + font-size: 1.2em; + resize: vertical; + outline: 3px dashed transparent; + outline-offset: -4px; + -webkit-transition: all .5s ease, height 1ms linear; + -moz-transition: all .5s ease, height 1ms linear; + -ms-transition: all .5s ease, height 1ms linear; + -o-transition: all .5s ease, height 1ms linear; + transition: all .5s ease, height 1ms linear; +} + +/* Emoticons panel */ +.smiley-box { + width: 18%; + float: right; +} + +.smiley-box img { + margin: 3px; +} + +/* Input field styles +---------------------------------------- */ +.inputbox { + border: 1px solid transparent; + padding: 2px; +} + +.inputbox:hover, .inputbox:focus { + border: 1px solid transparent; + outline-style: none; +} + +input.inputbox { width: 85%; } +input.medium { width: 50%; } +input.narrow { width: 25%; } +input.tiny { width: 150px; } + +textarea.inputbox { + width: 85%; +} + +.autowidth { + width: auto !important; +} + +input[type="number"] { + -moz-padding-end: 0; +} + +input[type="search"] { + -webkit-appearance: textfield; + -webkit-box-sizing: content-box; +} + +input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-results-button, input[type="search"]::-webkit-search-results-decoration { + display: none; +} + +input[type="search"]::-webkit-search-cancel-button { + cursor: pointer; +} + +/* Form button styles +---------------------------------------- */ +input.button1, input.button2 { + font-size: 1em; +} + +a.button1, input.button1, input.button3, a.button2, input.button2 { + width: auto !important; + padding-top: 1px; + padding-bottom: 1px; + font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + background: transparent none repeat-x top left; + line-height: 1.5; +} + +a.button1, input.button1 { + font-weight: bold; + border: 1px solid transparent; +} + +input.button3 { + padding: 0; + margin: 0; + line-height: 5px; + height: 12px; + background-image: none; + font-variant: small-caps; +} + +input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"], .search-results li { + cursor: pointer; +} + +/* Alternative button */ +a.button2, input.button2, input.button3 { + border: 1px solid transparent; +} + +/* button in the style of the form buttons */ +a.button1, a.button2 { + text-decoration: none; + padding: 0 3px; + vertical-align: text-bottom; +} + +/* Hover states */ +a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover { + border: 1px solid transparent; +} + +input.disabled { + font-weight: normal; +} + +/* Focus states */ +input.button1:focus, input.button2:focus, input.button3:focus { + outline-style: none; +} + +/* Topic and forum Search */ +.search-box { + float: left; +} + +.search-box .inputbox { + background-image: none; + border-right-width: 0; + border-radius: 4px 0 0 4px; + float: left; + height: 24px; + padding: 3px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +/* Search box (header) +--------------------------------------------- */ +.search-header { + border-radius: 4px; + display: block; + float: right; + margin-right: 5px; + margin-top: 30px; +} + +.search-header .inputbox { border: 0; } + +.navbar .linklist > li.responsive-search { display: none; } + +input.search { + background-image: none; + background-repeat: no-repeat; + background-position: left 1px; + padding-left: 17px; +} + +.full { width: 95%; } +.medium { width: 50%;} +.narrow { width: 25%;} +.tiny { width: 10%;} diff --git a/install/update/new/styles/prosilver/theme/icons.css b/install/update/new/styles/prosilver/theme/icons.css new file mode 100644 index 0000000..3ac5984 --- /dev/null +++ b/install/update/new/styles/prosilver/theme/icons.css @@ -0,0 +1,96 @@ +/* -------------------------------------------------------------- + $Icons +-------------------------------------------------------------- */ + +/* Global module setup +--------------------------------*/ + +/* Renamed version of .fa class for agnostic usage of icon fonts. + * Just change the name of the font after the 14/1 to the name of + * the font you wish to use. + */ +.icon, .button .icon, blockquote cite:before, .uncited:before { + display: inline-block; + font-weight: normal; + font-style: normal; + font-variant: normal; + font-family: FontAwesome; + font-size: 14px; + line-height: 1; + text-rendering: auto; /* optimizelegibility throws things off #1094 */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon:before { padding-right: 2px; } + +.button .icon:before { + padding-right: 0; +} + +/* Icon size classes - Default size is 14px, use these for small variations */ + +.icon.icon-xl { + font-size: 20px; +} + +.icon.icon-lg { + font-size: 16px; +} + +.icon.icon-md { + font-size: 10px; +} + +.icon.icon-sm { + font-size: 8px; +} + +/* icon modifiers */ +.icon-tiny { + width: 12px; + transform: scale(0.65, 0.75); + vertical-align: text-bottom; + font-size: 16px; +} + +.arrow-left .icon { + float: left; +} + +.arrow-left:hover .icon { + margin-left: -5px; + margin-right: 5px; +} + +.arrow-right .icon { + float: right; +} + +.arrow-right:hover .icon { + margin-left: 5px; + margin-right: -5px; +} + +.post-buttons .dropdown-contents .icon { + float: right; + margin-left: 5px; +} + +.alert_close .icon:before { + padding: 0; + border-radius: 50%; + width: 11px; + display: block; + line-height: .9; + height: 12px; +} + +blockquote cite:before, .uncited:before { + content: '\f10d'; /* Font Awesome quote-left */ +} + +.rtl blockquote cite:before, .rtl .uncited:before { + content: '\f10e'; /* Font Awesome quote-right */ +} + diff --git a/install/update/new/styles/prosilver/theme/images/site_logo.svg b/install/update/new/styles/prosilver/theme/images/site_logo.svg new file mode 100644 index 0000000..4ce8903 --- /dev/null +++ b/install/update/new/styles/prosilver/theme/images/site_logo.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/install/update/new/styles/prosilver/theme/plupload.css b/install/update/new/styles/prosilver/theme/plupload.css new file mode 100644 index 0000000..b1f3ae2 --- /dev/null +++ b/install/update/new/styles/prosilver/theme/plupload.css @@ -0,0 +1,90 @@ +.attach-panel-multi { + display: none; + margin-bottom: 1em; +} + +.attach-row-tpl { + display: none; +} + +.file-list td { + vertical-align: middle; +} + +.attach-name { + width: 50%; +} + +.attach-comment { + width: 30%; +} + +.attach-comment .inputbox { + resize: vertical; + width: 100%; +} + +.attach-filesize { + width: 15%; +} + +.attach-status { + width: 5%; +} + +.attach-filesize, .attach-status { + text-align: center; +} + +.attach-controls { + display: inline-block; + float: right; +} + +.nojs .file-inline-bbcode { + display: none; +} + +.file-total-progress { + height: 2px; + display: block; + position: relative; + margin: 4px -10px -6px -10px; +} + +.file-progress { + background-color: #CCCCCC; + display:inline-block; + height: 8px; + width: 50px; +} + +.file-progress-bar, .file-total-progress-bar { + background-color: green; + display: block; + height: 100%; + width: 0; +} + +.file-status.file-working { + background: url('./images/plupload/throbber.gif'); +} + +.file-status.file-uploaded { + background: url('./images/plupload/done.gif'); +} + +.file-status.file-error { + background: url('./images/plupload/error.gif'); +} + +.file-status { + display: inline-block; + height: 16px; + width: 16px; +} + +.file-name { + max-width: 65%; + vertical-align: bottom; +} diff --git a/install/update/new/styles/prosilver/theme/print.css b/install/update/new/styles/prosilver/theme/print.css new file mode 100644 index 0000000..ee916dc --- /dev/null +++ b/install/update/new/styles/prosilver/theme/print.css @@ -0,0 +1,150 @@ +/* Print Style Sheet +---------------------------------------- */ + + +/* Lots still TODO here! */ + +/* General markup styles */ +* { + padding: 0; + margin: 0; +} + +body { + font: 11pt Verdana, Arial, Helvetica, sans-serif; + color:#000000; +} + +a:link { color: #000000; text-decoration: none; } +a:visited { color: #000000; text-decoration: none; } +a:active { color: #000000; text-decoration: none; } + +img, .noprint, .navbar, .box1, .divider, .signature { display: none; } +/* Display smilies (Bug #47265) */ +.content img { + display: inline; +} + +/* Container for the main body */ +.wrap { + margin: 0 2em; +} + +p { font-size: 85%; } +.copyright { font-size: 75%; } +.page-number { float:right; width: auto; text-align: right; font-size: 75%; } + +h1, h2, h3, h1 a, h2 a, h3 a { + font-family: "Trebuchet MS",georgia,Verdana,Sans-serif; + color: #000000; + background: none; + text-decoration: none; + font-weight: bold; +} + +h1 { font-size: 20pt; } +h2 { font-size: 16pt; margin-top: 1em; } +h3 { font-size: 14pt; margin-top: 1em; } + +.content { + font-size: 11pt; + line-height: 14pt; + margin-bottom: 1em; + font-family: "Lucida Grande", "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + overflow: hidden; +} + +/* CSS2 Print tip from: http://www.alistapart.com/articles/goingtoprint/ */ +.postbody a:link, .postbody a:visited, .postbody a:hover, .postbody a:active { + text-decoration: underline; + padding: 0.1em 0.2em; + margin: -0.1em -0.2em; + color: #666; + background: none; + font-size: 100%; +} + +html>body .postbody a:link:after, html>body .postbody a:visited:after { + content: " (" attr(href) ") "; + font-size: 90%; + text-decoration: none; +} + +hr { + height: 1px; + background-color: #999999; + border-width: 0; +} + +.author { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 75%; + margin-bottom: 0.6em; +} + +.date { + font-family: Verdana, Arial, Helvetica, sans-serif; + float: right; + position: relative; + text-align: right; + font-size: 75%; +} + +/* Don't want to print url for names or titles in content area */ +.postbody .author a:link, .postbody .author a:visited, +html>body .postbody .author a:link:after, +html>body .postbody .author a:visited:after, +.postquote .quote-by a:link, .postquote .quote-by a:visited, +html>body .postquote .quote-by a:link:after, +html>body .postquote .quote-by a:visited:after, +html>body .postbody h1 a:link:after, html>body .postbody h2 a:link:after { + text-decoration: none; + content: ""; +} + +/* Poster profile */ +.postprofile { display: none; } +.grip-show { display:none; } + +/* Quote */ +.postquote, blockquote { + font-size: 85%; + margin: 1em 18% 1em 4%; + padding: 0.5em; + position: relative; + line-height: 1.5em; + border: 1px #999999 solid; +} + +.postquote img { display: none; } +.postquote span { display: block; } +.postquote span .postquote { font-size: 100%; } +.quote-by, blockquote cite { + color: black; + display : block; + font-weight: bold; +} + +/* List */ +ol, ul { + margin-left: 15pt +} + +/* Misc page elements */ +div.spacer { clear: both; } + +code { display: block; } + +/* Accessibility tweaks: Mozilla.org */ +.skip_link { display: none; } + +.codebox p { display: none; } + +/* stylelint-disable declaration-property-unit-whitelist */ +.emoji { + min-height: 18px; + min-width: 18px; + height: 1em; + width: 1em; +} +/* stylelint-enable declaration-property-unit-whitelist */ diff --git a/install/update/new/styles/prosilver/theme/stylesheet.css b/install/update/new/styles/prosilver/theme/stylesheet.css new file mode 100644 index 0000000..c402d56 --- /dev/null +++ b/install/update/new/styles/prosilver/theme/stylesheet.css @@ -0,0 +1,21 @@ +/* phpBB3 Style Sheet + -------------------------------------------------------------- + Style name: prosilver (the default phpBB 3.3.x style) + Based on style: + Original author: Tom Beddard ( http://www.subblue.com/ ) + Modified by: phpBB Limited ( https://www.phpbb.com/ ) + -------------------------------------------------------------- +*/ + +@import url("normalize.css?v=3.3"); +@import url("base.css?v=3.3"); +@import url("utilities.css?v=3.3"); +@import url("common.css?v=3.3"); +@import url("links.css?v=3.3"); +@import url("content.css?v=3.3"); +@import url("buttons.css?v=3.3"); +@import url("cp.css?v=3.3"); +@import url("forms.css?v=3.3"); +@import url("icons.css?v=3.3"); +@import url("colours.css?v=3.3"); +@import url("responsive.css?v=3.3"); diff --git a/install/update/new/ucp.php b/install/update/new/ucp.php new file mode 100644 index 0000000..0992e3e --- /dev/null +++ b/install/update/new/ucp.php @@ -0,0 +1,413 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +require($phpbb_root_path . 'common.' . $phpEx); +require($phpbb_root_path . 'includes/functions_user.' . $phpEx); +require($phpbb_root_path . 'includes/functions_module.' . $phpEx); + +// Basic parameter data +$id = $request->variable('i', ''); +$mode = $request->variable('mode', ''); + +if (in_array($mode, array('login', 'login_link', 'logout', 'confirm', 'sendpassword', 'activate'))) +{ + define('IN_LOGIN', true); +} + +if ($mode === 'delete_cookies') +{ + define('SKIP_CHECK_BAN', true); + define('SKIP_CHECK_DISABLED', true); +} + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('ucp'); + +// Setting a variable to let the style designer know where he is... +$template->assign_var('S_IN_UCP', true); + +$module = new p_master(); +$default = false; + +// Basic "global" modes +switch ($mode) +{ + case 'activate': + $module->load('ucp', 'activate'); + $module->display($user->lang['UCP_ACTIVATE']); + + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + break; + + case 'resend_act': + $module->load('ucp', 'resend'); + $module->display($user->lang['UCP_RESEND']); + break; + + case 'sendpassword': + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + + redirect($controller_helper->route('phpbb_ucp_forgot_password_controller')); + break; + + case 'register': + if ($user->data['is_registered'] || isset($_REQUEST['not_agreed'])) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + $module->load('ucp', 'register'); + $module->display($user->lang['REGISTER']); + break; + + case 'confirm': + $module->load('ucp', 'confirm'); + break; + + case 'login': + if ($user->data['is_registered']) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + login_box($request->variable('redirect', "index.$phpEx")); + break; + + case 'login_link': + if ($user->data['is_registered']) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + $module->load('ucp', 'login_link'); + $module->display($user->lang['UCP_LOGIN_LINK']); + break; + + case 'logout': + if ($user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $user->session_id) + { + $user->session_kill(); + } + else if ($user->data['user_id'] != ANONYMOUS) + { + meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); + + $message = $user->lang['LOGOUT_FAILED'] . '

' . sprintf($user->lang['RETURN_INDEX'], '
', ' '); + trigger_error($message); + } + + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + break; + + case 'terms': + case 'privacy': + + $message = ($mode == 'terms') ? 'TERMS_OF_USE_CONTENT' : 'PRIVACY_POLICY'; + $title = ($mode == 'terms') ? 'TERMS_USE' : 'PRIVACY'; + + if (empty($user->lang[$message])) + { + if ($user->data['is_registered']) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + login_box(); + } + + $template->set_filenames(array( + 'body' => 'ucp_agreement.html') + ); + + // Disable online list + page_header($user->lang[$title]); + + $template->assign_vars(array( + 'S_AGREEMENT' => true, + 'AGREEMENT_TITLE' => $user->lang[$title], + 'AGREEMENT_TEXT' => sprintf($user->lang[$message], $config['sitename'], generate_board_url()), + 'U_BACK' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), + 'L_BACK' => $user->lang['BACK_TO_PREV'], + )); + + page_footer(); + + break; + + case 'delete_cookies': + + // Delete Cookies with dynamic names (do NOT delete poll cookies) + if (confirm_box(true)) + { + $set_time = time() - 31536000; + + foreach ($request->variable_names(\phpbb\request\request_interface::COOKIE) as $cookie_name) + { + $cookie_data = $request->variable($cookie_name, '', true, \phpbb\request\request_interface::COOKIE); + + // Only delete board cookies, no other ones... + if (strpos($cookie_name, $config['cookie_name'] . '_') !== 0) + { + continue; + } + + $cookie_name = str_replace($config['cookie_name'] . '_', '', $cookie_name); + + /** + * Event to save custom cookies from deletion + * + * @event core.ucp_delete_cookies + * @var string cookie_name Cookie name to checking + * @var bool retain_cookie Do we retain our cookie or not, true if retain + * @since 3.1.3-RC1 + */ + $retain_cookie = false; + $vars = array('cookie_name', 'retain_cookie'); + extract($phpbb_dispatcher->trigger_event('core.ucp_delete_cookies', compact($vars))); + if ($retain_cookie) + { + continue; + } + + // Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_ + if (strpos($cookie_name, 'poll_') !== 0) + { + $user->set_cookie($cookie_name, '', $set_time); + } + } + + $user->set_cookie('track', '', $set_time); + $user->set_cookie('u', '', $set_time); + $user->set_cookie('k', '', $set_time); + $user->set_cookie('sid', '', $set_time); + + // We destroy the session here, the user will be logged out nevertheless + $user->session_kill(); + $user->session_begin(); + + meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); + + $message = $user->lang['COOKIES_DELETED'] . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + trigger_error($message); + } + else + { + confirm_box(false, 'DELETE_COOKIES', ''); + } + + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + + break; + + case 'switch_perm': + + $user_id = $request->variable('u', 0); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $user_id; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$auth->acl_get('a_switchperm') || !$user_row || $user_id == $user->data['user_id'] || !check_link_hash($request->variable('hash', ''), 'switchperm')) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + + $auth_admin = new auth_admin(); + if (!$auth_admin->ghost_permissions($user_id, $user->data['user_id'])) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_TRANSFER_PERMISSIONS', false, array($user_row['username'])); + + $message = sprintf($user->lang['PERMISSIONS_TRANSFERRED'], $user_row['username']) . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + + /** + * Event to run code after permissions are switched + * + * @event core.ucp_switch_permissions + * @var int user_id User ID to switch permission to + * @var array user_row User data + * @var string message Success message + * @since 3.1.11-RC1 + */ + $vars = array('user_id', 'user_row', 'message'); + extract($phpbb_dispatcher->trigger_event('core.ucp_switch_permissions', compact($vars))); + + trigger_error($message); + + break; + + case 'restore_perm': + + if (!$user->data['user_perm_from'] || !$auth->acl_get('a_switchperm')) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + $auth->acl_cache($user->data); + + $sql = 'SELECT username + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user->data['user_perm_from']; + $result = $db->sql_query($sql); + $username = $db->sql_fetchfield('username'); + $db->sql_freeresult($result); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_RESTORE_PERMISSIONS', false, array($username)); + + $message = $user->lang['PERMISSIONS_RESTORED'] . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + + /** + * Event to run code after permissions are restored + * + * @event core.ucp_restore_permissions + * @var string username User name + * @var string message Success message + * @since 3.1.11-RC1 + */ + $vars = array('username', 'message'); + extract($phpbb_dispatcher->trigger_event('core.ucp_restore_permissions', compact($vars))); + + trigger_error($message); + + break; + + default: + $default = true; + break; +} + +// We use this approach because it does not impose large code changes +if (!$default) +{ + return true; +} + +// Only registered users can go beyond this point +if (!$user->data['is_registered']) +{ + if ($user->data['is_bot']) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + if ($id == 'pm' && $mode == 'view' && isset($_GET['p'])) + { + $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx?i=pm&p=" . $request->variable('p', 0)); + login_box($redirect_url, $user->lang['LOGIN_EXPLAIN_UCP']); + } + + login_box('', $user->lang['LOGIN_EXPLAIN_UCP']); +} + +// Instantiate module system and generate list of available modules +$module->list_modules('ucp'); + +// Check if the zebra module is set +if ($module->is_active('zebra', 'friends')) +{ + // Output listing of friends online + $update_time = $config['load_online_time'] * 60; + + $sql_ary = array( + 'SELECT' => 'u.user_id, u.username, u.username_clean, u.user_colour, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline', + + 'FROM' => array( + USERS_TABLE => 'u', + ZEBRA_TABLE => 'z', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(SESSIONS_TABLE => 's'), + 'ON' => 's.session_user_id = z.zebra_id', + ), + ), + + 'WHERE' => 'z.user_id = ' . $user->data['user_id'] . ' + AND z.friend = 1 + AND u.user_id = z.zebra_id', + + 'GROUP_BY' => 'z.zebra_id, u.user_id, u.username_clean, u.user_colour, u.username', + + 'ORDER_BY' => 'u.username_clean ASC', + ); + + $sql = $db->sql_build_query('SELECT_DISTINCT', $sql_ary); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $which = (time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline'))) ? 'online' : 'offline'; + + $template->assign_block_vars("friends_{$which}", array( + 'USER_ID' => $row['user_id'], + + 'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), + 'USER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'])) + ); + } + $db->sql_freeresult($result); +} + +// Do not display subscribed topics/forums if not allowed +if (!$config['allow_topic_notify'] && !$config['allow_forum_notify']) +{ + $module->set_display('main', 'subscribed', false); +} + +/** +* Use this event to enable and disable additional UCP modules +* +* @event core.ucp_display_module_before +* @var p_master module Object holding all modules and their status +* @var mixed id Active module category (can be the int or string) +* @var string mode Active module +* @since 3.1.0-a1 +*/ +$vars = array('module', 'id', 'mode'); +extract($phpbb_dispatcher->trigger_event('core.ucp_display_module_before', compact($vars))); + +$template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $user->lang('UCP'), + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}ucp.$phpEx"), +)); + +// Select the active module +$module->set_active($id, $mode); + +// Load and execute the relevant module +$module->load_active(); + +// Assign data to the template engine for the list of modules +$module->assign_tpl_vars(append_sid("{$phpbb_root_path}ucp.$phpEx")); + +// Generate the page, do not display/query online list +$module->display($module->get_page_title()); diff --git a/install/update/new/viewforum.php b/install/update/new/viewforum.php new file mode 100644 index 0000000..eb6b37a --- /dev/null +++ b/install/update/new/viewforum.php @@ -0,0 +1,1064 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + +// Start session +$user->session_begin(); +$auth->acl($user->data); + +// Start initial var setup +$forum_id = $request->variable('f', 0); +$mark_read = $request->variable('mark', ''); +$start = $request->variable('start', 0); + +$default_sort_days = (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0; +$default_sort_key = (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'; +$default_sort_dir = (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'; + +$sort_days = $request->variable('st', $default_sort_days); +$sort_key = $request->variable('sk', $default_sort_key); +$sort_dir = $request->variable('sd', $default_sort_dir); + +/* @var $pagination \phpbb\pagination */ +$pagination = $phpbb_container->get('pagination'); + +// Check if the user has actually sent a forum ID with his/her request +// If not give them a nice error page. +if (!$forum_id) +{ + trigger_error('NO_FORUM'); +} + +$sql_from = FORUMS_TABLE . ' f'; +$lastread_select = ''; + +// Grab appropriate forum data +if ($config['load_db_lastread'] && $user->data['is_registered']) +{ + $sql_from .= ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' + AND ft.forum_id = f.forum_id)'; + $lastread_select .= ', ft.mark_time'; +} + +if ($user->data['is_registered']) +{ + $sql_from .= ' LEFT JOIN ' . FORUMS_WATCH_TABLE . ' fw ON (fw.forum_id = f.forum_id AND fw.user_id = ' . $user->data['user_id'] . ')'; + $lastread_select .= ', fw.notify_status'; +} + +$sql = "SELECT f.* $lastread_select + FROM $sql_from + WHERE f.forum_id = $forum_id"; +$result = $db->sql_query($sql); +$forum_data = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +if (!$forum_data) +{ + trigger_error('NO_FORUM'); +} + + +// Configure style, language, etc. +$user->setup('viewforum', $forum_data['forum_style']); + +// Redirect to login upon emailed notification links +if (isset($_GET['e']) && !$user->data['is_registered']) +{ + login_box('', $user->lang['LOGIN_NOTIFY_FORUM']); +} + +// Permissions check +if (!$auth->acl_gets('f_list', 'f_list_topics', 'f_read', $forum_id) || ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'] && !$auth->acl_get('f_read', $forum_id))) +{ + if ($user->data['user_id'] != ANONYMOUS) + { + send_status_line(403, 'Forbidden'); + trigger_error('SORRY_AUTH_READ'); + } + + login_box('', $user->lang['LOGIN_VIEWFORUM']); +} + +// Forum is passworded ... check whether access has been granted to this +// user this session, if not show login box +if ($forum_data['forum_password']) +{ + login_forum_box($forum_data); +} + +// Is this forum a link? ... User got here either because the +// number of clicks is being tracked or they guessed the id +if ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link']) +{ + // Does it have click tracking enabled? + if ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) + { + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_posts_approved = forum_posts_approved + 1 + WHERE forum_id = ' . $forum_id; + $db->sql_query($sql); + } + + // We redirect to the url. The third parameter indicates that external redirects are allowed. + redirect($forum_data['forum_link'], false, true); + return; +} + +// Build navigation links +generate_forum_nav($forum_data); + +// Forum Rules +if ($auth->acl_get('f_read', $forum_id)) +{ + generate_forum_rules($forum_data); +} + +// Do we have subforums? +$active_forum_ary = $moderators = array(); + +if ($forum_data['left_id'] != $forum_data['right_id'] - 1) +{ + list($active_forum_ary, $moderators) = display_forums($forum_data, $config['load_moderators'], $config['load_moderators']); +} +else +{ + $template->assign_var('S_HAS_SUBFORUM', false); + if ($config['load_moderators']) + { + get_moderators($moderators, $forum_id); + } +} + +// Is a forum specific topic count required? +if ($forum_data['forum_topics_per_page']) +{ + $config['topics_per_page'] = $forum_data['forum_topics_per_page']; +} + +/* @var $phpbb_content_visibility \phpbb\content_visibility */ +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +// Dump out the page header and load viewforum template +$topics_count = $phpbb_content_visibility->get_count('forum_topics', $forum_data, $forum_id); +$start = $pagination->validate_start($start, $config['topics_per_page'], $topics_count); + +$page_title = $forum_data['forum_name'] . ($start ? ' - ' . $user->lang('PAGE_TITLE_NUMBER', $pagination->get_on_page($config['topics_per_page'], $start)) : ''); + +/** +* You can use this event to modify the page title of the viewforum page +* +* @event core.viewforum_modify_page_title +* @var string page_title Title of the viewforum page +* @var array forum_data Array with forum data +* @var int forum_id The forum ID +* @var int start Start offset used to calculate the page +* @since 3.2.2-RC1 +*/ +$vars = array('page_title', 'forum_data', 'forum_id', 'start'); +extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_page_title', compact($vars))); + +page_header($page_title, true, $forum_id); + +$template->set_filenames(array( + 'body' => 'viewforum_body.html') +); + +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_id); + +$template->assign_vars(array( + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . (($start == 0) ? '' : "&start=$start")), +)); + +// Not postable forum or showing active topics? +if (!($forum_data['forum_type'] == FORUM_POST || (($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) && $forum_data['forum_type'] == FORUM_CAT))) +{ + page_footer(); +} + +// Ok, if someone has only list-access, we only display the forum list. +// We also make this circumstance available to the template in case we want to display a notice. ;) +if (!$auth->acl_gets('f_read', 'f_list_topics', $forum_id)) +{ + $template->assign_vars(array( + 'S_NO_READ_ACCESS' => true, + )); + + page_footer(); +} + +// Handle marking posts +if ($mark_read == 'topics') +{ + $token = $request->variable('hash', ''); + if (check_link_hash($token, 'global')) + { + markread('topics', array($forum_id), false, $request->variable('mark_time', 0)); + } + $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + meta_refresh(3, $redirect_url); + + if ($request->is_ajax()) + { + // Tell the ajax script what language vars and URL need to be replaced + $data = array( + 'NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'], + 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'], + 'U_MARK_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics&mark_time=" . time(), false) : '', + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['TOPICS_MARKED'] + ); + $json_response = new \phpbb\json_response(); + $json_response->send($data); + } + + trigger_error($user->lang['TOPICS_MARKED'] . '

' . sprintf($user->lang['RETURN_FORUM'], '', '')); +} + +// Do the forum Prune thang - cron type job ... +if (!$config['use_system_cron']) +{ + /* @var $cron \phpbb\cron\manager */ + $cron = $phpbb_container->get('cron.manager'); + + $task = $cron->find_task('cron.task.core.prune_forum'); + $task->set_forum_data($forum_data); + + if ($task->is_ready()) + { + $url = $task->get_url(); + $template->assign_var('RUN_CRON_TASK', 'cron'); + } + else + { + // See if we should prune the shadow topics instead + $task = $cron->find_task('cron.task.core.prune_shadow_topics'); + $task->set_forum_data($forum_data); + + if ($task->is_ready()) + { + $url = $task->get_url(); + $template->assign_var('RUN_CRON_TASK', 'cron'); + } + } +} + +// Forum rules and subscription info +$s_watching_forum = array( + 'link' => '', + 'link_toggle' => '', + 'title' => '', + 'title_toggle' => '', + 'is_watching' => false, +); + +if ($config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_subscribe', $forum_id) || $user->data['user_id'] == ANONYMOUS)) +{ + $notify_status = (isset($forum_data['notify_status'])) ? $forum_data['notify_status'] : NULL; + watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0, $notify_status, $start, $forum_data['forum_name']); +} + +$s_forum_rules = ''; +gen_forum_auth_level('forum', $forum_id, $forum_data['forum_status']); + +// Topic ordering options +$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + +$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); +$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 'LOWER(t.topic_title)', 'v' => 't.topic_views'); + +/** + * Modify the topic ordering if needed + * + * @event core.viewforum_modify_topic_ordering + * @var array sort_by_text Topic ordering options + * @var array sort_by_sql Topic orderings options SQL equivalent + * @since 3.2.5-RC1 + */ +$vars = array( + 'sort_by_text', + 'sort_by_sql', +); +extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topic_ordering', compact($vars))); + +$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; +gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); + +// Limit topics to certain time frame, obtain correct topic count +if ($sort_days) +{ + $min_post_time = time() - ($sort_days * 86400); + + $sql_array = array( + 'SELECT' => 'COUNT(t.topic_id) AS num_topics', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'WHERE' => 't.forum_id = ' . $forum_id . ' + AND (t.topic_last_post_time >= ' . $min_post_time . ' + OR t.topic_type = ' . POST_ANNOUNCE . ' + OR t.topic_type = ' . POST_GLOBAL . ') + AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'), + ); + + /** + * Modify the sort data SQL query for getting additional fields if needed + * + * @event core.viewforum_modify_sort_data_sql + * @var int forum_id The forum_id whose topics are being listed + * @var int start Variable containing start for pagination + * @var int sort_days The oldest topic displayable in elapsed days + * @var string sort_key The sorting by. It is one of the first character of (in low case): + * Author, Post time, Replies, Subject, Views + * @var string sort_dir Either "a" for ascending or "d" for descending + * @var array sql_array The SQL array to get the data of all topics + * @since 3.1.9-RC1 + */ + $vars = array( + 'forum_id', + 'start', + 'sort_days', + 'sort_key', + 'sort_dir', + 'sql_array', + ); + extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_sort_data_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_array)); + $topics_count = (int) $db->sql_fetchfield('num_topics'); + $db->sql_freeresult($result); + + if (isset($_POST['sort'])) + { + $start = 0; + } + $sql_limit_time = "AND t.topic_last_post_time >= $min_post_time"; + + // Make sure we have information about day selection ready + $template->assign_var('S_SORT_DAYS', true); +} +else +{ + $sql_limit_time = ''; +} + +// Basic pagewide vars +$post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LOCKED'] : $user->lang['POST_NEW_TOPIC']; + +// Display active topics? +$s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false; + +$s_search_hidden_fields = array('fid' => array($forum_id)); +if ($_SID) +{ + $s_search_hidden_fields['sid'] = $_SID; +} + +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + +$template->assign_vars(array( + 'MODERATORS' => (!empty($moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $moderators[$forum_id]) : '', + + 'POST_IMG' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', $post_alt) : $user->img('button_topic_new', $post_alt), + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'FOLDER_IMG' => $user->img('topic_read', 'NO_UNREAD_POSTS'), + 'FOLDER_UNREAD_IMG' => $user->img('topic_unread', 'UNREAD_POSTS'), + 'FOLDER_HOT_IMG' => $user->img('topic_read_hot', 'NO_UNREAD_POSTS_HOT'), + 'FOLDER_HOT_UNREAD_IMG' => $user->img('topic_unread_hot', 'UNREAD_POSTS_HOT'), + 'FOLDER_LOCKED_IMG' => $user->img('topic_read_locked', 'NO_UNREAD_POSTS_LOCKED'), + 'FOLDER_LOCKED_UNREAD_IMG' => $user->img('topic_unread_locked', 'UNREAD_POSTS_LOCKED'), + 'FOLDER_STICKY_IMG' => $user->img('sticky_read', 'POST_STICKY'), + 'FOLDER_STICKY_UNREAD_IMG' => $user->img('sticky_unread', 'POST_STICKY'), + 'FOLDER_ANNOUNCE_IMG' => $user->img('announce_read', 'POST_ANNOUNCEMENT'), + 'FOLDER_ANNOUNCE_UNREAD_IMG'=> $user->img('announce_unread', 'POST_ANNOUNCEMENT'), + 'FOLDER_MOVED_IMG' => $user->img('topic_moved', 'TOPIC_MOVED'), + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), + 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'), + 'POLL_IMG' => $user->img('icon_topic_poll', 'TOPIC_POLL'), + 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), + + 'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['POST_FORUM_LOCKED'] : $user->lang['NO_TOPICS'], + + 'S_DISPLAY_POST_INFO' => ($forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, + + 'S_IS_POSTABLE' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, + 'S_USER_CAN_POST' => ($auth->acl_get('f_post', $forum_id)) ? true : false, + 'S_DISPLAY_ACTIVE' => $s_display_active, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_TOPIC_ICONS' => ($s_display_active && count($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false), + 'U_WATCH_FORUM_LINK' => $s_watching_forum['link'], + 'U_WATCH_FORUM_TOGGLE' => $s_watching_forum['link_toggle'], + 'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'], + 'S_WATCH_FORUM_TOGGLE' => $s_watching_forum['title_toggle'], + 'S_WATCHING_FORUM' => $s_watching_forum['is_watching'], + 'S_FORUM_ACTION' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . (($start == 0) ? '' : "&start=$start")), + 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, + 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"), + 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), + 'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && count($moderators[$forum_id]) > 1) ? false : true, + 'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false, + 'S_VIEWFORUM' => true, + + 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", true, $user->session_id) : '', + 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=post&f=' . $forum_id) : '', + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($start == 0) ? '' : "&start=$start")), + 'U_CANONICAL' => generate_board_url() . '/' . append_sid("viewforum.$phpEx", "f=$forum_id" . (($start) ? "&start=$start" : ''), true, ''), + 'U_MARK_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics&mark_time=" . time()) : '', +)); + +// Grab icons +$icons = $cache->obtain_icons(); + +// Grab all topic data +$rowset = $announcement_list = $topic_list = $global_announce_forums = array(); + +$sql_array = array( + 'SELECT' => 't.*', + 'FROM' => array( + TOPICS_TABLE => 't' + ), + 'LEFT_JOIN' => array(), +); + +/** +* Event to modify the SQL query before the topic data is retrieved +* +* It may also be used to override the above assigned template vars +* +* @event core.viewforum_get_topic_data +* @var array forum_data Array with forum data +* @var array sql_array The SQL array to get the data of all topics +* @var int forum_id The forum_id whose topics are being listed +* @var int topics_count The total number of topics for display +* @var int sort_days The oldest topic displayable in elapsed days +* @var string sort_key The sorting by. It is one of the first character of (in low case): +* Author, Post time, Replies, Subject, Views +* @var string sort_dir Either "a" for ascending or "d" for descending +* @since 3.1.0-a1 +* @changed 3.1.0-RC4 Added forum_data var +* @changed 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars +* @changed 3.1.9-RC1 Fix types of properties +*/ +$vars = array( + 'forum_data', + 'sql_array', + 'forum_id', + 'topics_count', + 'sort_days', + 'sort_key', + 'sort_dir', +); +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']) +{ + if ($config['load_db_track']) + { + $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . $user->data['user_id']); + $sql_array['SELECT'] .= ', tp.topic_posted'; + } + + if ($config['load_db_lastread']) + { + $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']); + $sql_array['SELECT'] .= ', tt.mark_time'; + + if ($s_display_active && count($active_forum_ary)) + { + $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id']); + $sql_array['SELECT'] .= ', ft.mark_time AS forum_mark_time'; + } + } +} + +if ($forum_data['forum_type'] == FORUM_POST) +{ + // Get global announcement forums + $g_forum_ary = $auth->acl_getf('f_read', true); + $g_forum_ary = array_unique(array_keys($g_forum_ary)); + + $sql_anounce_array['LEFT_JOIN'] = $sql_array['LEFT_JOIN']; + $sql_anounce_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id'); + $sql_anounce_array['SELECT'] = $sql_array['SELECT'] . ', f.forum_name'; + + // Obtain announcements ... removed sort ordering, sort by time in all cases + $sql_ary = array( + 'SELECT' => $sql_anounce_array['SELECT'], + 'FROM' => $sql_array['FROM'], + 'LEFT_JOIN' => $sql_anounce_array['LEFT_JOIN'], + + 'WHERE' => '(t.forum_id = ' . $forum_id . ' + AND t.topic_type = ' . POST_ANNOUNCE . ') OR + (' . $db->sql_in_set('t.forum_id', $g_forum_ary, false, true) . ' + AND t.topic_type = ' . POST_GLOBAL . ')', + + 'ORDER_BY' => 't.topic_time DESC', + ); + + /** + * Event to modify the SQL query before the announcement topic ids data is retrieved + * + * @event core.viewforum_get_announcement_topic_ids_data + * @var array forum_data Data about the forum + * @var array g_forum_ary Global announcement forums array + * @var array sql_anounce_array SQL announcement array + * @var array sql_ary SQL query array to get the announcement topic ids data + * @var int forum_id The forum ID + * + * @since 3.1.10-RC1 + */ + $vars = array( + 'forum_data', + 'g_forum_ary', + 'sql_anounce_array', + 'sql_ary', + 'forum_id', + ); + extract($phpbb_dispatcher->trigger_event('core.viewforum_get_announcement_topic_ids_data', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$phpbb_content_visibility->is_visible('topic', $row['forum_id'], $row)) + { + // Do not display announcements that are waiting for approval or soft deleted. + continue; + } + + $rowset[$row['topic_id']] = $row; + $announcement_list[] = $row['topic_id']; + + if ($forum_id != $row['forum_id']) + { + $topics_count++; + $global_announce_forums[] = $row['forum_id']; + } + } + $db->sql_freeresult($result); +} + +$forum_tracking_info = array(); + +if ($user->data['is_registered'] && $config['load_db_lastread']) +{ + $forum_tracking_info[$forum_id] = $forum_data['mark_time']; + + if (!empty($global_announce_forums)) + { + $sql = 'SELECT forum_id, mark_time + FROM ' . FORUMS_TRACK_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $global_announce_forums) . ' + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_tracking_info[$row['forum_id']] = $row['mark_time']; + } + $db->sql_freeresult($result); + } +} + +// If the user is trying to reach late pages, start searching from the end +$store_reverse = false; +$sql_limit = $config['topics_per_page']; +if ($start > $topics_count / 2) +{ + $store_reverse = true; + + // Select the sort order + $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC'); + + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count - count($announcement_list)); + $sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count - count($announcement_list)); +} +else +{ + // Select the sort order + $direction = (($sort_dir == 'd') ? 'DESC' : 'ASC'); + $sql_start = $start; +} + +/** + * Modify the topics sort ordering if needed + * + * @event core.viewforum_modify_sort_direction + * @var string direction Topics sort order + * @since 3.2.5-RC1 + */ +$vars = array( + 'direction', +); +extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_sort_direction', compact($vars))); + +if (is_array($sort_by_sql[$sort_key])) +{ + $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; +} +else +{ + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; +} + +if ($forum_data['forum_type'] == FORUM_POST || !count($active_forum_ary)) +{ + $sql_where = 't.forum_id = ' . $forum_id; +} +else if (empty($active_forum_ary['exclude_forum_id'])) +{ + $sql_where = $db->sql_in_set('t.forum_id', $active_forum_ary['forum_id']); +} +else +{ + $get_forum_ids = array_diff($active_forum_ary['forum_id'], $active_forum_ary['exclude_forum_id']); + $sql_where = (count($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id; +} + +// Grab just the sorted topic ids +$sql_ary = array( + 'SELECT' => 't.topic_id', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'WHERE' => "$sql_where + AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ") + $sql_approved + $sql_limit_time", + 'ORDER_BY' => 't.topic_type ' . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order, +); + +/** +* Event to modify the SQL query before the topic ids data is retrieved +* +* @event core.viewforum_get_topic_ids_data +* @var array forum_data Data about the forum +* @var array sql_ary SQL query array to get the topic ids data +* @var string sql_approved Topic visibility SQL string +* @var int sql_limit Number of records to select +* @var string sql_limit_time SQL string to limit topic_last_post_time data +* @var array sql_sort_order SQL sorting string +* @var int sql_start Offset point to start selection from +* @var string sql_where SQL WHERE clause string +* @var bool store_reverse Flag indicating if we select from the late pages +* +* @since 3.1.0-RC4 +* +* @changed 3.1.3 Added forum_data +*/ +$vars = array( + 'forum_data', + 'sql_ary', + 'sql_approved', + 'sql_limit', + 'sql_limit_time', + 'sql_sort_order', + 'sql_start', + 'sql_where', + 'store_reverse', +); +extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_ids_data', compact($vars))); + +$sql = $db->sql_build_query('SELECT', $sql_ary); +$result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + +while ($row = $db->sql_fetchrow($result)) +{ + $topic_list[] = (int) $row['topic_id']; +} +$db->sql_freeresult($result); + +// For storing shadow topics +$shadow_topic_list = array(); + +if (count($topic_list)) +{ + // SQL array for obtaining topics/stickies + $sql_array = array( + 'SELECT' => $sql_array['SELECT'], + 'FROM' => $sql_array['FROM'], + 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], + + 'WHERE' => $db->sql_in_set('t.topic_id', $topic_list), + ); + + // If store_reverse, then first obtain topics, then stickies, else the other way around... + // Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because + // the number of stickies are not known + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_status'] == ITEM_MOVED) + { + $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id']; + } + + $rowset[$row['topic_id']] = $row; + } + $db->sql_freeresult($result); +} + +// If we have some shadow topics, update the rowset to reflect their topic information +if (count($shadow_topic_list)) +{ + // SQL array for obtaining shadow topics + $sql_array = array( + 'SELECT' => 't.*', + 'FROM' => array( + TOPICS_TABLE => 't' + ), + 'WHERE' => $db->sql_in_set('t.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 array sql_array SQL array to get the data of any shadowtopics + * @since 3.1.0-a1 + */ + $vars = array('sql_array'); + extract($phpbb_dispatcher->trigger_event('core.viewforum_get_shadowtopic_data', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $orig_topic_id = $shadow_topic_list[$row['topic_id']]; + + // If the shadow topic is already listed within the rowset (happens for active topics for example), then do not include it... + if (isset($rowset[$row['topic_id']])) + { + // We need to remove any trace regarding this topic. :) + unset($rowset[$orig_topic_id]); + unset($topic_list[array_search($orig_topic_id, $topic_list)]); + $topics_count--; + + continue; + } + + // Do not include those topics the user has no permission to access + if (!$auth->acl_gets('f_read', 'f_list_topics', $row['forum_id'])) + { + // We need to remove any trace regarding this topic. :) + unset($rowset[$orig_topic_id]); + unset($topic_list[array_search($orig_topic_id, $topic_list)]); + $topics_count--; + + continue; + } + + // We want to retain some values + $row = array_merge($row, array( + 'topic_moved_id' => $rowset[$orig_topic_id]['topic_moved_id'], + 'topic_status' => $rowset[$orig_topic_id]['topic_status'], + 'topic_type' => $rowset[$orig_topic_id]['topic_type'], + 'topic_title' => $rowset[$orig_topic_id]['topic_title'], + )); + + // Shadow topics are never reported + $row['topic_reported'] = 0; + + $rowset[$orig_topic_id] = $row; + } + $db->sql_freeresult($result); +} +unset($shadow_topic_list); + +// Ok, adjust topics count for active topics list +if ($s_display_active) +{ + $topics_count = 1; +} + +// We need to remove the global announcements from the forums total topic count, +// otherwise the number is different from the one on the forum list +$total_topic_count = $topics_count - count($announcement_list); + +$base_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')); +$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_topic_count, $config['topics_per_page'], $start); + +$template->assign_vars(array( + 'TOTAL_TOPICS' => ($s_display_active) ? false : $user->lang('VIEW_FORUM_TOPICS', (int) $total_topic_count), +)); + +$topic_list = ($store_reverse) ? array_merge($announcement_list, array_reverse($topic_list)) : array_merge($announcement_list, $topic_list); +$topic_tracking_info = $tracking_topics = array(); + +/** +* Modify topics data before we display the viewforum page +* +* @event core.viewforum_modify_topics_data +* @var array topic_list Array with current viewforum page topic ids +* @var array rowset Array with topics data (in topic_id => topic_data format) +* @var int total_topic_count Forum's total topic count +* @var int forum_id Forum identifier +* @since 3.1.0-b3 +* @changed 3.1.11-RC1 Added forum_id +*/ +$vars = array('topic_list', 'rowset', 'total_topic_count', 'forum_id'); +extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_data', compact($vars))); + +// Okay, lets dump out the page ... +if (count($topic_list)) +{ + $mark_forum_read = true; + $mark_time_forum = 0; + + // Generate topic forum list... + $topic_forum_list = array(); + foreach ($rowset as $t_id => $row) + { + if (isset($forum_tracking_info[$row['forum_id']])) + { + $row['forum_mark_time'] = $forum_tracking_info[$row['forum_id']]; + } + + $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread'] && $user->data['is_registered'] && isset($row['forum_mark_time'])) ? $row['forum_mark_time'] : 0; + $topic_forum_list[$row['forum_id']]['topics'][] = (int) $t_id; + } + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + foreach ($topic_forum_list as $f_id => $topic_row) + { + $topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time'])); + } + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + foreach ($topic_forum_list as $f_id => $topic_row) + { + $topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics']); + } + } + + unset($topic_forum_list); + + if (!$s_display_active) + { + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $mark_time_forum = (!empty($forum_data['mark_time'])) ? $forum_data['mark_time'] : $user->data['user_lastmark']; + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + if (!$user->data['is_registered']) + { + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + $mark_time_forum = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + } + } + + $s_type_switch = 0; + foreach ($topic_list as $topic_id) + { + $row = &$rowset[$topic_id]; + + $topic_forum_id = ($row['forum_id']) ? (int) $row['forum_id'] : $forum_id; + + // This will allow the style designer to output a different header + // or even separate the list of announcements from sticky and normal topics + $s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; + + // Replies + $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $topic_forum_id) - 1; + // Correction for case of unapproved topic visible to poster + if ($replies < 0) + { + $replies = 0; + } + + if ($row['topic_status'] == ITEM_MOVED) + { + $topic_id = $row['topic_moved_id']; + $unread_topic = false; + } + else + { + $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false; + } + + // Get folder img, topic status/type related information + $folder_img = $folder_alt = $topic_type = ''; + topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type); + + // Generate all the URIs ... + $view_topic_url_params = 'f=' . $row['forum_id'] . '&t=' . $topic_id; + $view_topic_url = $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params) : false; + + $topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row['forum_id'])); + $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id'])); + $topic_deleted = $row['topic_visibility'] == ITEM_DELETED; + + $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$topic_id", true, $user->session_id) : ''; + $u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=deleted_topics&t=' . $topic_id, true, $user->session_id) : $u_mcp_queue; + + // Send vars to template + $topic_row = array( + 'FORUM_ID' => $row['forum_id'], + 'TOPIC_ID' => $topic_id, + 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'FIRST_POST_TIME_RFC3339' => gmdate(DATE_RFC3339, $row['topic_time']), + 'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']), + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_POST_TIME_RFC3339' => gmdate(DATE_RFC3339, $row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_VIEW_TIME_RFC3339' => gmdate(DATE_RFC3339, $row['topic_last_view_time']), + 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + + 'REPLIES' => $replies, + 'VIEWS' => $row['topic_views'], + 'TOPIC_TITLE' => censor_text($row['topic_title']), + 'TOPIC_TYPE' => $topic_type, + 'FORUM_NAME' => (isset($row['forum_name'])) ? $row['forum_name'] : $forum_data['forum_name'], + + 'TOPIC_IMG_STYLE' => $folder_img, + 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), + 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], + + 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', + 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', + 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + + 'S_TOPIC_TYPE' => $row['topic_type'], + 'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false, + 'S_UNREAD_TOPIC' => $unread_topic, + 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false, + 'S_TOPIC_UNAPPROVED' => $topic_unapproved, + 'S_POSTS_UNAPPROVED' => $posts_unapproved, + 'S_TOPIC_DELETED' => $topic_deleted, + 'S_HAS_POLL' => ($row['poll_start']) ? true : false, + 'S_POST_ANNOUNCE' => ($row['topic_type'] == POST_ANNOUNCE) ? true : false, + 'S_POST_GLOBAL' => ($row['topic_type'] == POST_GLOBAL) ? true : false, + 'S_POST_STICKY' => ($row['topic_type'] == POST_STICKY) ? true : false, + 'S_TOPIC_LOCKED' => ($row['topic_status'] == ITEM_LOCKED) ? true : false, + 'S_TOPIC_MOVED' => ($row['topic_status'] == ITEM_MOVED) ? true : false, + + 'U_NEWEST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread' : false, + 'U_LAST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'] : false, + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'U_VIEW_TOPIC' => $view_topic_url, + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']), + 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $row['forum_id'] . '&t=' . $topic_id, true, $user->session_id), + 'U_MCP_QUEUE' => $u_mcp_queue, + + 'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test, + ); + + /** + * Modify the topic data before it is assigned to the template + * + * @event core.viewforum_modify_topicrow + * @var array row Array with topic data + * @var array topic_row Template array with topic data + * @var bool s_type_switch Flag indicating if the topic type is [global] announcement + * @var bool s_type_switch_test Flag indicating if the test topic type is [global] announcement + * @since 3.1.0-a1 + * + * @changed 3.1.10-RC1 Added s_type_switch, s_type_switch_test + */ + $vars = array('row', 'topic_row', 's_type_switch', 's_type_switch_test'); + extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topicrow', compact($vars))); + + $template->assign_block_vars('topicrow', $topic_row); + + $pagination->generate_template_pagination($view_topic_url, 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); + + $s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; + + /** + * Event after the topic data has been assigned to the template + * + * @event core.viewforum_topic_row_after + * @var array row Array with the topic data + * @var array rowset Array with topics data (in topic_id => topic_data format) + * @var bool s_type_switch Flag indicating if the topic type is [global] announcement + * @var int topic_id The topic ID + * @var array topic_list Array with current viewforum page topic ids + * @var array topic_row Template array with topic data + * @since 3.1.3-RC1 + */ + $vars = array( + 'row', + 'rowset', + 's_type_switch', + 'topic_id', + 'topic_list', + 'topic_row', + ); + extract($phpbb_dispatcher->trigger_event('core.viewforum_topic_row_after', compact($vars))); + + if ($unread_topic) + { + $mark_forum_read = false; + } + + unset($rowset[$topic_id]); + } +} + +/** +* This event is to perform additional actions on viewforum page +* +* @event core.viewforum_generate_page_after +* @var array forum_data Array with the forum data +* @since 3.2.2-RC1 +*/ +$vars = array('forum_data'); +extract($phpbb_dispatcher->trigger_event('core.viewforum_generate_page_after', compact($vars))); + +// This is rather a fudge but it's the best I can think of without requiring information +// on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find +// any it updates the forum last read cookie. This requires that the user visit the forum +// after reading a topic +if ($forum_data['forum_type'] == FORUM_POST && count($topic_list) && $mark_forum_read) +{ + update_forum_tracking_info($forum_id, $forum_data['forum_last_post_time'], false, $mark_time_forum); +} + +page_footer(); diff --git a/install/update/new/viewonline.php b/install/update/new/viewonline.php new file mode 100644 index 0000000..1b28750 --- /dev/null +++ b/install/update/new/viewonline.php @@ -0,0 +1,522 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('memberlist'); + +// Get and set some variables +$mode = $request->variable('mode', ''); +$session_id = $request->variable('s', ''); +$start = $request->variable('start', 0); +$sort_key = $request->variable('sk', 'b'); +$sort_dir = $request->variable('sd', 'd'); +$show_guests = ($config['load_online_guests']) ? $request->variable('sg', 0) : 0; + +// Can this user view profiles/memberlist? +if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) +{ + if ($user->data['user_id'] != ANONYMOUS) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_VIEW_USERS'); + } + + login_box('', $user->lang['LOGIN_EXPLAIN_VIEWONLINE']); +} + +/* @var $pagination \phpbb\pagination */ +$pagination = $phpbb_container->get('pagination'); + +/* @var $viewonline_helper \phpbb\viewonline_helper */ +$viewonline_helper = $phpbb_container->get('viewonline_helper'); + +$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_JOINED'], 'c' => $user->lang['SORT_LOCATION']); +$sort_key_sql = array('a' => 'u.username_clean', 'b' => 's.session_time', 'c' => 's.session_page'); + +// Sorting and order +if (!isset($sort_key_text[$sort_key])) +{ + $sort_key = 'b'; +} + +$order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); + +// Whois requested +if ($mode == 'whois' && $auth->acl_get('a_') && $session_id) +{ + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $sql = 'SELECT u.user_id, u.username, u.user_type, s.session_ip + FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . " s + WHERE s.session_id = '" . $db->sql_escape($session_id) . "' + AND u.user_id = s.session_user_id"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $template->assign_var('WHOIS', user_ipwhois($row['session_ip'])); + } + $db->sql_freeresult($result); + + // Output the page + page_header($user->lang['WHO_IS_ONLINE']); + + $template->set_filenames(array( + 'body' => 'viewonline_whois.html') + ); + make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + + page_footer(); +} + +$user->update_session_infos(); + +// Forum info +$sql_ary = array( + 'SELECT' => 'f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id', + 'FROM' => array( + FORUMS_TABLE => 'f', + ), + 'ORDER_BY' => 'f.left_id ASC', +); + +/** +* Modify the forum data SQL query for getting additional fields if needed +* +* @event core.viewonline_modify_forum_data_sql +* @var array sql_ary The SQL array +* @since 3.1.5-RC1 +*/ +$vars = array('sql_ary'); +extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_forum_data_sql', compact($vars))); + +$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary), 600); +unset($sql_ary); + +$forum_data = array(); +while ($row = $db->sql_fetchrow($result)) +{ + $forum_data[$row['forum_id']] = $row; +} +$db->sql_freeresult($result); + +$guest_counter = 0; + +// Get number of online guests (if we do not display them) +if (!$show_guests) +{ + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $sql = 'SELECT COUNT(session_ip) as num_guests + FROM ( + SELECT DISTINCT session_ip + FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . ANONYMOUS . ' + AND session_time >= ' . (time() - ($config['load_online_time'] * 60)) . + ')'; + break; + + default: + $sql = 'SELECT COUNT(DISTINCT session_ip) as num_guests + FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . ANONYMOUS . ' + AND session_time >= ' . (time() - ($config['load_online_time'] * 60)); + break; + } + $result = $db->sql_query($sql); + $guest_counter = (int) $db->sql_fetchfield('num_guests'); + $db->sql_freeresult($result); +} + +// Get user list +$sql_ary = array( + 'SELECT' => 'u.user_id, u.username, u.username_clean, u.user_type, u.user_colour, s.session_id, s.session_time, s.session_page, s.session_ip, s.session_browser, s.session_viewonline, s.session_forum_id', + 'FROM' => array( + USERS_TABLE => 'u', + SESSIONS_TABLE => 's', + ), + 'WHERE' => 'u.user_id = s.session_user_id + AND s.session_time >= ' . (time() - ($config['load_online_time'] * 60)) . + ((!$show_guests) ? ' AND s.session_user_id <> ' . ANONYMOUS : ''), + 'ORDER_BY' => $order_by, +); + +/** +* Modify the SQL query for getting the user data to display viewonline list +* +* @event core.viewonline_modify_sql +* @var array sql_ary The SQL array +* @var bool show_guests Do we display guests in the list +* @var int guest_counter Number of guests displayed +* @var array forum_data Array with forum data +* @since 3.1.0-a1 +* @changed 3.1.0-a2 Added vars guest_counter and forum_data +*/ +$vars = array('sql_ary', 'show_guests', 'guest_counter', 'forum_data'); +extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_sql', compact($vars))); + +$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + +$prev_id = $prev_ip = $user_list = array(); +$logged_visible_online = $logged_hidden_online = $counter = 0; + +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); + +/** @var \phpbb\group\helper $group_helper */ +$group_helper = $phpbb_container->get('group_helper'); + +while ($row = $db->sql_fetchrow($result)) +{ + if ($row['user_id'] != ANONYMOUS && !isset($prev_id[$row['user_id']])) + { + $view_online = $s_user_hidden = false; + $user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] . '" class="username-coloured"' : ''; + + $username_full = ($row['user_type'] != USER_IGNORE) ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '' . $row['username'] . ''; + + if (!$row['session_viewonline']) + { + $view_online = ($auth->acl_get('u_viewonline') || $row['user_id'] === $user->data['user_id']) ? true : false; + $logged_hidden_online++; + + $username_full = '' . $username_full . ''; + $s_user_hidden = true; + } + else + { + $view_online = true; + $logged_visible_online++; + } + + $prev_id[$row['user_id']] = 1; + + if ($view_online) + { + $counter++; + } + + if (!$view_online || $counter > $start + $config['topics_per_page'] || $counter <= $start) + { + continue; + } + } + else if ($show_guests && $row['user_id'] == ANONYMOUS && !isset($prev_ip[$row['session_ip']])) + { + $prev_ip[$row['session_ip']] = 1; + $guest_counter++; + $counter++; + + if ($counter > $start + $config['topics_per_page'] || $counter <= $start) + { + continue; + } + + $s_user_hidden = false; + $username_full = get_username_string('full', $row['user_id'], $user->lang['GUEST']); + } + else + { + continue; + } + + $on_page = $viewonline_helper->get_user_page($row['session_page']); + + switch ($on_page[1]) + { + case 'index': + $location = $user->lang['INDEX']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + case $phpbb_adm_relative_path . 'index': + $location = $user->lang['ACP']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + case 'posting': + case 'viewforum': + case 'viewtopic': + $forum_id = $row['session_forum_id']; + + if ($forum_id && $auth->acl_get('f_list', $forum_id)) + { + $location = ''; + $location_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + + if ($forum_data[$forum_id]['forum_type'] == FORUM_LINK) + { + $location = sprintf($user->lang['READING_LINK'], $forum_data[$forum_id]['forum_name']); + break; + } + + switch ($on_page[1]) + { + case 'posting': + preg_match('#mode=([a-z]+)#', $row['session_page'], $on_page); + $posting_mode = (!empty($on_page[1])) ? $on_page[1] : ''; + + switch ($posting_mode) + { + case 'reply': + case 'quote': + $location = sprintf($user->lang['REPLYING_MESSAGE'], $forum_data[$forum_id]['forum_name']); + break; + + default: + $location = sprintf($user->lang['POSTING_MESSAGE'], $forum_data[$forum_id]['forum_name']); + break; + } + break; + + case 'viewtopic': + $location = sprintf($user->lang['READING_TOPIC'], $forum_data[$forum_id]['forum_name']); + break; + + case 'viewforum': + $location = sprintf($user->lang['READING_FORUM'], $forum_data[$forum_id]['forum_name']); + break; + } + } + else + { + $location = $user->lang['INDEX']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + } + break; + + case 'search': + $location = $user->lang['SEARCHING_FORUMS']; + $location_url = append_sid("{$phpbb_root_path}search.$phpEx"); + break; + + case 'viewonline': + $location = $user->lang['VIEWING_ONLINE']; + $location_url = append_sid("{$phpbb_root_path}viewonline.$phpEx"); + break; + + case 'memberlist': + $location_url = append_sid("{$phpbb_root_path}memberlist.$phpEx"); + + if (strpos($row['session_page'], 'mode=viewprofile') !== false) + { + $location = $user->lang['VIEWING_MEMBER_PROFILE']; + } + else if (strpos($row['session_page'], 'mode=contactadmin') !== false) + { + $location = $user->lang['VIEWING_CONTACT_ADMIN']; + $location_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); + } + else + { + $location = $user->lang['VIEWING_MEMBERS']; + } + break; + + case 'mcp': + $location = $user->lang['VIEWING_MCP']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + case 'ucp': + $location = $user->lang['VIEWING_UCP']; + + // Grab some common modules + $url_params = array( + 'mode=register' => 'VIEWING_REGISTER', + 'i=pm&mode=compose' => 'POSTING_PRIVATE_MESSAGE', + 'i=pm&' => 'VIEWING_PRIVATE_MESSAGES', + 'i=profile&' => 'CHANGING_PROFILE', + 'i=prefs&' => 'CHANGING_PREFERENCES', + ); + + foreach ($url_params as $param => $lang) + { + if (strpos($row['session_page'], $param) !== false) + { + $location = $user->lang[$lang]; + break; + } + } + + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + case 'download/file': + $location = $user->lang['DOWNLOADING_FILE']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + case 'report': + $location = $user->lang['REPORTING_POST']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + default: + $location = $user->lang['INDEX']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + + if ($row['session_page'] === 'app.' . $phpEx . '/help/faq' || + $row['session_page'] === 'app.' . $phpEx . '/help/bbcode') + { + $location = $user->lang['VIEWING_FAQ']; + $location_url = $controller_helper->route('phpbb_help_faq_controller'); + } + break; + } + + /** + * Overwrite the location's name and URL, which are displayed in the list + * + * @event core.viewonline_overwrite_location + * @var array on_page File name and query string + * @var array row Array with the users sql row + * @var string location Page name to displayed in the list + * @var string location_url Page url to displayed in the list + * @var array forum_data Array with forum data + * @since 3.1.0-a1 + * @changed 3.1.0-a2 Added var forum_data + */ + $vars = array('on_page', 'row', 'location', 'location_url', 'forum_data'); + extract($phpbb_dispatcher->trigger_event('core.viewonline_overwrite_location', compact($vars))); + + $template_row = array( + 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => $row['user_colour'], + 'USERNAME_FULL' => $username_full, + 'LASTUPDATE' => $user->format_date($row['session_time']), + 'FORUM_LOCATION' => $location, + 'USER_IP' => ($auth->acl_get('a_')) ? (($mode == 'lookup' && $session_id == $row['session_id']) ? gethostbyaddr($row['session_ip']) : $row['session_ip']) : '', + 'USER_BROWSER' => ($auth->acl_get('a_user')) ? $row['session_browser'] : '', + + 'U_USER_PROFILE' => ($row['user_type'] != USER_IGNORE) ? get_username_string('profile', $row['user_id'], '') : '', + 'U_USER_IP' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'mode=lookup' . (($mode != 'lookup' || $row['session_id'] != $session_id) ? '&s=' . $row['session_id'] : '') . "&sg=$show_guests&start=$start&sk=$sort_key&sd=$sort_dir"), + 'U_WHOIS' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'mode=whois&s=' . $row['session_id']), + 'U_FORUM_LOCATION' => $location_url, + + 'S_USER_HIDDEN' => $s_user_hidden, + 'S_GUEST' => ($row['user_id'] == ANONYMOUS) ? true : false, + 'S_USER_TYPE' => $row['user_type'], + ); + + /** + * Modify viewonline template data before it is displayed in the list + * + * @event core.viewonline_modify_user_row + * @var array on_page File name and query string + * @var array row Array with the users sql row + * @var array forum_data Array with forum data + * @var array template_row Array with template variables for the user row + * @since 3.1.0-RC4 + */ + $vars = array('on_page', 'row', 'forum_data', 'template_row'); + extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_user_row', compact($vars))); + + $template->assign_block_vars('user_row', $template_row); +} +$db->sql_freeresult($result); +unset($prev_id, $prev_ip); + +$order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; +// Grab group details for legend display +if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) +{ + $sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend + FROM ' . GROUPS_TABLE . ' + WHERE group_legend > 0 + ORDER BY ' . $order_legend . ' ASC'; +} +else +{ + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE g.group_legend > 0 + AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ') + ORDER BY g.' . $order_legend . ' ASC'; +} +$result = $db->sql_query($sql); + +$legend = ''; +while ($row = $db->sql_fetchrow($result)) +{ + if ($row['group_name'] == 'BOTS') + { + $legend .= (($legend != '') ? ', ' : '') . '' . $user->lang['G_BOTS'] . ''; + } + else + { + $legend .= (($legend != '') ? ', ' : '') . '' . $group_helper->get_name($row['group_name']) . ''; + } +} +$db->sql_freeresult($result); + +// Refreshing the page every 60 seconds... +meta_refresh(60, append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir&start=$start")); + +$start = $pagination->validate_start($start, $config['topics_per_page'], $counter); +$base_url = append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir"); +$pagination->generate_template_pagination($base_url, 'pagination', 'start', $counter, $config['topics_per_page'], $start); + +$template->assign_block_vars('navlinks', array( + 'BREADCRUMB_NAME' => $user->lang('WHO_IS_ONLINE'), + 'U_BREADCRUMB' => append_sid("{$phpbb_root_path}viewonline.$phpEx"), +)); + +// Send data to template +$template->assign_vars(array( + 'TOTAL_REGISTERED_USERS_ONLINE' => $user->lang('REG_USERS_ONLINE', (int) $logged_visible_online, $user->lang('HIDDEN_USERS_ONLINE', (int) $logged_hidden_online)), + 'TOTAL_GUEST_USERS_ONLINE' => $user->lang('GUEST_USERS_ONLINE', (int) $guest_counter), + 'LEGEND' => $legend, + + 'U_SORT_USERNAME' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), + 'U_SORT_UPDATED' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), + 'U_SORT_LOCATION' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), + + 'U_SWITCH_GUEST_DISPLAY' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sg=' . ((int) !$show_guests)), + 'L_SWITCH_GUEST_DISPLAY' => ($show_guests) ? $user->lang['HIDE_GUESTS'] : $user->lang['DISPLAY_GUESTS'], + 'S_SWITCH_GUEST_DISPLAY' => ($config['load_online_guests']) ? true : false, + 'S_VIEWONLINE' => true, +)); + +// We do not need to load the who is online box here. ;) +$config['load_online'] = false; + +// Output the page +page_header($user->lang['WHO_IS_ONLINE']); + +$template->set_filenames(array( + 'body' => 'viewonline_body.html') +); +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + +page_footer(); diff --git a/install/update/new/viewtopic.php b/install/update/new/viewtopic.php new file mode 100644 index 0000000..df241a5 --- /dev/null +++ b/install/update/new/viewtopic.php @@ -0,0 +1,2427 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); +include($phpbb_root_path . 'includes/bbcode.' . $phpEx); +include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); + +// Initial var setup +$forum_id = $request->variable('f', 0); +$topic_id = $request->variable('t', 0); +$post_id = $request->variable('p', 0); +$voted_id = $request->variable('vote_id', array('' => 0)); + +$voted_id = (count($voted_id) > 1) ? array_unique($voted_id) : $voted_id; + + +$start = $request->variable('start', 0); +$view = $request->variable('view', ''); + +$default_sort_days = (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0; +$default_sort_key = (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'; +$default_sort_dir = (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'; + +$sort_days = $request->variable('st', $default_sort_days); +$sort_key = $request->variable('sk', $default_sort_key); +$sort_dir = $request->variable('sd', $default_sort_dir); + +$update = $request->variable('update', false); + +/* @var $pagination \phpbb\pagination */ +$pagination = $phpbb_container->get('pagination'); + +$s_can_vote = false; +/** +* @todo normalize? +*/ +$hilit_words = $request->variable('hilit', '', true); + +// Do we have a topic or post id? +if (!$topic_id && !$post_id) +{ + trigger_error('NO_TOPIC'); +} + +/* @var $phpbb_content_visibility \phpbb\content_visibility */ +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +// Find topic id if user requested a newer or older topic +if ($view && !$post_id) +{ + if (!$forum_id) + { + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . " + WHERE topic_id = $topic_id"; + $result = $db->sql_query($sql); + $forum_id = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + if (!$forum_id) + { + trigger_error('NO_TOPIC'); + } + } + + if ($view == 'unread') + { + // Get topic tracking info + $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id); + $topic_last_read = (isset($topic_tracking_info[$topic_id])) ? $topic_tracking_info[$topic_id] : 0; + + $sql = 'SELECT post_id, topic_id, forum_id + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . " + AND post_time > $topic_last_read + AND forum_id = $forum_id + ORDER BY post_time ASC, post_id ASC"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $sql = 'SELECT topic_last_post_id as post_id, topic_id, forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + if (!$row) + { + // Setup user environment so we can process lang string + $user->setup('viewtopic'); + + trigger_error('NO_TOPIC'); + } + + $post_id = $row['post_id']; + $topic_id = $row['topic_id']; + } + else if ($view == 'next' || $view == 'previous') + { + $sql_condition = ($view == 'next') ? '>' : '<'; + $sql_ordering = ($view == 'next') ? 'ASC' : 'DESC'; + + $sql = 'SELECT forum_id, topic_last_post_time + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $user->setup('viewtopic'); + // OK, the topic doesn't exist. This error message is not helpful, but technically correct. + trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS'); + } + else + { + $sql = 'SELECT topic_id, forum_id + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = ' . $row['forum_id'] . " + AND topic_moved_id = 0 + AND topic_last_post_time $sql_condition {$row['topic_last_post_time']} + AND " . $phpbb_content_visibility->get_visibility_sql('topic', $row['forum_id']) . " + ORDER BY topic_last_post_time $sql_ordering, topic_last_post_id $sql_ordering"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $sql = 'SELECT forum_style + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $forum_style = (int) $db->sql_fetchfield('forum_style'); + $db->sql_freeresult($result); + + $user->setup('viewtopic', $forum_style); + trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS'); + } + else + { + $topic_id = $row['topic_id']; + $forum_id = $row['forum_id']; + } + } + } + + if (isset($row) && $row['forum_id']) + { + $forum_id = $row['forum_id']; + } +} + +// This rather complex gaggle of code handles querying for topics but +// also allows for direct linking to a post (and the calculation of which +// page the post is on and the correct display of viewtopic) +$sql_array = array( + 'SELECT' => 't.*, f.*', + + 'FROM' => array(FORUMS_TABLE => 'f'), +); + +// The FROM-Order is quite important here, else t.* columns can not be correctly bound. +if ($post_id) +{ + $sql_array['SELECT'] .= ', p.post_visibility, p.post_time, p.post_id'; + $sql_array['FROM'][POSTS_TABLE] = 'p'; +} + +// Topics table need to be the last in the chain +$sql_array['FROM'][TOPICS_TABLE] = 't'; + +if ($user->data['is_registered']) +{ + $sql_array['SELECT'] .= ', tw.notify_status'; + $sql_array['LEFT_JOIN'] = array(); + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_WATCH_TABLE => 'tw'), + 'ON' => 'tw.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tw.topic_id' + ); + + if ($config['allow_bookmarks']) + { + $sql_array['SELECT'] .= ', bm.topic_id as bookmarked'; + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(BOOKMARKS_TABLE => 'bm'), + 'ON' => 'bm.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = bm.topic_id' + ); + } + + if ($config['load_db_lastread']) + { + $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time'; + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), + 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id' + ); + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id' + ); + } +} + +if (!$post_id) +{ + $sql_array['WHERE'] = "t.topic_id = $topic_id"; +} +else +{ + $sql_array['WHERE'] = "p.post_id = $post_id AND t.topic_id = p.topic_id"; +} + +$sql_array['WHERE'] .= ' AND f.forum_id = t.forum_id'; + +$sql = $db->sql_build_query('SELECT', $sql_array); +$result = $db->sql_query($sql); +$topic_data = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +// link to unapproved post or incorrect link +if (!$topic_data) +{ + // If post_id was submitted, we try at least to display the topic as a last resort... + if ($post_id && $topic_id) + { + redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id" . (($forum_id) ? "&f=$forum_id" : ''))); + } + + trigger_error('NO_TOPIC'); +} + +$forum_id = (int) $topic_data['forum_id']; + +/** + * Modify the forum ID to handle the correct display of viewtopic if needed + * + * @event core.viewtopic_modify_forum_id + * @var string forum_id forum ID + * @var array topic_data array of topic's data + * @since 3.2.5-RC1 + */ +$vars = array( + 'forum_id', + 'topic_data', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_forum_id', compact($vars))); + +// If the request is missing the f parameter, the forum id in the user session data is 0 at the moment. +// Let's fix that now so that the user can't hide from the forum's Who Is Online list. +$user->page['forum'] = $forum_id; + +// Now we know the forum_id and can check the permissions +if (!$phpbb_content_visibility->is_visible('topic', $forum_id, $topic_data)) +{ + trigger_error('NO_TOPIC'); +} + +// This is for determining where we are (page) +if ($post_id) +{ + // are we where we are supposed to be? + if (($topic_data['post_visibility'] == ITEM_UNAPPROVED || $topic_data['post_visibility'] == ITEM_REAPPROVE) && !$auth->acl_get('m_approve', $topic_data['forum_id'])) + { + // If post_id was submitted, we try at least to display the topic as a last resort... + if ($topic_id) + { + redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id" . (($forum_id) ? "&f=$forum_id" : ''))); + } + + trigger_error('NO_TOPIC'); + } + if ($post_id == $topic_data['topic_first_post_id'] || $post_id == $topic_data['topic_last_post_id']) + { + $check_sort = ($post_id == $topic_data['topic_first_post_id']) ? 'd' : 'a'; + + if ($sort_dir == $check_sort) + { + $topic_data['prev_posts'] = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1; + } + else + { + $topic_data['prev_posts'] = 0; + } + } + else + { + $sql = 'SELECT COUNT(p.post_id) AS prev_posts + FROM ' . POSTS_TABLE . " p + WHERE p.topic_id = {$topic_data['topic_id']} + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.'); + + if ($sort_dir == 'd') + { + $sql .= " AND (p.post_time > {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id >= {$topic_data['post_id']}))"; + } + else + { + $sql .= " AND (p.post_time < {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id <= {$topic_data['post_id']}))"; + } + + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $topic_data['prev_posts'] = $row['prev_posts'] - 1; + } +} + +$topic_id = (int) $topic_data['topic_id']; +$topic_replies = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1; + +// Check sticky/announcement/global time limit +if (($topic_data['topic_type'] != POST_NORMAL) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time()) +{ + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_type = ' . POST_NORMAL . ', topic_time_limit = 0 + WHERE topic_id = ' . $topic_id; + $db->sql_query($sql); + + $topic_data['topic_type'] = POST_NORMAL; + $topic_data['topic_time_limit'] = 0; +} + +// Setup look and feel +$user->setup('viewtopic', $topic_data['forum_style']); + +if ($view == 'print' && !$auth->acl_get('f_print', $forum_id)) +{ + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_PRINT_TOPIC'); +} + +$overrides_f_read_check = false; +$overrides_forum_password_check = false; +$topic_tracking_info = isset($topic_tracking_info) ? $topic_tracking_info : null; + +/** +* Event to apply extra permissions and to override original phpBB's f_read permission and forum password check +* on viewtopic access +* +* @event core.viewtopic_before_f_read_check +* @var int forum_id The forum id from where the topic belongs +* @var int topic_id The id of the topic the user tries to access +* @var int post_id The id of the post the user tries to start viewing at. +* It may be 0 for none given. +* @var array topic_data All the information from the topic and forum tables for this topic +* It includes posts information if post_id is not 0 +* @var bool overrides_f_read_check Set true to remove f_read check afterwards +* @var bool overrides_forum_password_check Set true to remove forum_password check afterwards +* @var array topic_tracking_info Information upon calling get_topic_tracking() +* Set it to NULL to allow auto-filling later. +* Set it to an array to override original data. +* @since 3.1.3-RC1 +*/ +$vars = array( + 'forum_id', + 'topic_id', + 'post_id', + 'topic_data', + 'overrides_f_read_check', + 'overrides_forum_password_check', + 'topic_tracking_info', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_before_f_read_check', compact($vars))); + +// Start auth check +if (!$overrides_f_read_check && !$auth->acl_get('f_read', $forum_id)) +{ + if ($user->data['user_id'] != ANONYMOUS) + { + send_status_line(403, 'Forbidden'); + trigger_error('SORRY_AUTH_READ'); + } + + login_box('', $user->lang['LOGIN_VIEWFORUM']); +} + +// Forum is passworded ... check whether access has been granted to this +// user this session, if not show login box +if (!$overrides_forum_password_check && $topic_data['forum_password']) +{ + login_forum_box($topic_data); +} + +// Redirect to login upon emailed notification links if user is not logged in. +if (isset($_GET['e']) && $user->data['user_id'] == ANONYMOUS) +{ + login_box(build_url('e') . '#unread', $user->lang['LOGIN_NOTIFY_TOPIC']); +} + +// What is start equal to? +if ($post_id) +{ + $start = floor(($topic_data['prev_posts']) / $config['posts_per_page']) * $config['posts_per_page']; +} + +// Get topic tracking info +if (!isset($topic_tracking_info)) +{ + $topic_tracking_info = array(); + + // Get topic tracking info + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $tmp_topic_data = array($topic_id => $topic_data); + $topic_tracking_info = get_topic_tracking($forum_id, $topic_id, $tmp_topic_data, array($forum_id => $topic_data['forum_mark_time'])); + unset($tmp_topic_data); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id); + } +} + +// Post ordering options +$limit_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']); + +$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); +$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => array('p.post_time', 'p.post_id'), 's' => array('p.post_subject', 'p.post_id')); +$join_user_sql = array('a' => true, 't' => false, 's' => false); + +$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + +/** +* Event to add new sorting options +* +* @event core.viewtopic_gen_sort_selects_before +* @var array limit_days Limit results by time +* @var array sort_by_text Language strings for sorting options +* @var array sort_by_sql SQL conditions for sorting options +* @var array join_user_sql SQL joins required for sorting options +* @var int sort_days User selected sort days +* @var string sort_key User selected sort key +* @var string sort_dir User selected sort direction +* @var string s_limit_days Initial value of limit days selectbox +* @var string s_sort_key Initial value of sort key selectbox +* @var string s_sort_dir Initial value of sort direction selectbox +* @var string u_sort_param Initial value of sorting form action +* @since 3.2.8-RC1 +*/ +$vars = array( + 'limit_days', + 'sort_by_text', + 'sort_by_sql', + 'join_user_sql', + 'sort_days', + 'sort_key', + 'sort_dir', + 's_limit_days', + 's_sort_key', + 's_sort_dir', + 'u_sort_param', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_gen_sort_selects_before', compact($vars))); + +gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); + +// Obtain correct post count and ordering SQL if user has +// requested anything different +if ($sort_days) +{ + $min_post_time = time() - ($sort_days * 86400); + + $sql = 'SELECT COUNT(post_id) AS num_posts + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + AND post_time >= $min_post_time + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id); + $result = $db->sql_query($sql); + $total_posts = (int) $db->sql_fetchfield('num_posts'); + $db->sql_freeresult($result); + + $limit_posts_time = "AND p.post_time >= $min_post_time "; + + if (isset($_POST['sort'])) + { + $start = 0; + } +} +else +{ + $total_posts = $topic_replies + 1; + $limit_posts_time = ''; +} + +// Was a highlight request part of the URI? +$highlight_match = $highlight = ''; +if ($hilit_words) +{ + $highlight_match = phpbb_clean_search_string($hilit_words); + $highlight = urlencode($highlight_match); + $highlight_match = str_replace('\*', '\w+?', preg_quote($highlight_match, '#')); + $highlight_match = preg_replace('#(?<=^|\s)\\\\w\*\?(?=\s|$)#', '\w+?', $highlight_match); + $highlight_match = str_replace(' ', '|', $highlight_match); +} + +// Make sure $start is set to the last page if it exceeds the amount +$start = $pagination->validate_start($start, $config['posts_per_page'], $total_posts); + +// General Viewtopic URL for return links +$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); + +// Are we watching this topic? +$s_watching_topic = array( + 'link' => '', + 'link_toggle' => '', + 'title' => '', + 'title_toggle' => '', + 'is_watching' => false, +); + +if ($config['allow_topic_notify']) +{ + $notify_status = (isset($topic_data['notify_status'])) ? $topic_data['notify_status'] : null; + watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $notify_status, $start, $topic_data['topic_title']); + + // Reset forum notification if forum notify is set + if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id)) + { + $s_watching_forum = $s_watching_topic; + watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0); + } +} + +/** +* Event to modify highlight. +* +* @event core.viewtopic_highlight_modify +* @var string highlight String to be highlighted +* @var string highlight_match Highlight string to be used in preg_replace +* @var array topic_data Topic data +* @var int start Pagination start +* @var int total_posts Number of posts +* @var string viewtopic_url Current viewtopic URL +* @since 3.1.11-RC1 +*/ +$vars = array( + 'highlight', + 'highlight_match', + 'topic_data', + 'start', + 'total_posts', + 'viewtopic_url', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_highlight_modify', compact($vars))); + +// Bookmarks +if ($config['allow_bookmarks'] && $user->data['is_registered'] && $request->variable('bookmark', 0)) +{ + if (check_link_hash($request->variable('hash', ''), "topic_$topic_id")) + { + if (!$topic_data['bookmarked']) + { + $sql = 'INSERT INTO ' . BOOKMARKS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'user_id' => $user->data['user_id'], + 'topic_id' => $topic_id, + )); + $db->sql_query($sql); + } + else + { + $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND topic_id = $topic_id"; + $db->sql_query($sql); + } + $message = (($topic_data['bookmarked']) ? $user->lang['BOOKMARK_REMOVED'] : $user->lang['BOOKMARK_ADDED']); + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); + } + } + else + { + $message = $user->lang['BOOKMARK_ERR']; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); + } + } + meta_refresh(3, $viewtopic_url); + + trigger_error($message); +} + +// Grab ranks +$ranks = $cache->obtain_ranks(); + +// Grab icons +$icons = $cache->obtain_icons(); + +// Grab extensions +$extensions = array(); +if ($topic_data['topic_attachment']) +{ + $extensions = $cache->obtain_attach_extensions($forum_id); +} + +// Forum rules listing +$s_forum_rules = ''; +gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); + +// Quick mod tools +$allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; + +$s_quickmod_action = append_sid( + "{$phpbb_root_path}mcp.$phpEx", + array( + 'f' => $forum_id, + 't' => $topic_id, + 'start' => $start, + 'quickmod' => 1, + 'redirect' => urlencode(str_replace('&', '&', $viewtopic_url)), + ), + true, + $user->session_id +); + +$quickmod_array = array( +// 'key' => array('LANG_KEY', $userHasPermissions), + + 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster']))), + 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id))), + 'delete_topic' => array('DELETE_TOPIC', ($auth->acl_get('m_delete', $forum_id) || (($topic_data['topic_visibility'] != ITEM_DELETED) && $auth->acl_get('m_softdelete', $forum_id)))), + 'restore_topic' => array('RESTORE_TOPIC', (($topic_data['topic_visibility'] == ITEM_DELETED) && $auth->acl_get('m_approve', $forum_id))), + 'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED), + 'split' => array('SPLIT_TOPIC', $auth->acl_get('m_split', $forum_id)), + 'merge' => array('MERGE_POSTS', $auth->acl_get('m_merge', $forum_id)), + 'merge_topic' => array('MERGE_TOPIC', $auth->acl_get('m_merge', $forum_id)), + 'fork' => array('FORK_TOPIC', $auth->acl_get('m_move', $forum_id)), + 'make_normal' => array('MAKE_NORMAL', ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', 'f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_NORMAL)), + 'make_sticky' => array('MAKE_STICKY', ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY)), + 'make_announce' => array('MAKE_ANNOUNCE', ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE)), + 'make_global' => array('MAKE_GLOBAL', ($allow_change_type && $auth->acl_get('f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL)), + 'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)), +); + +/** +* Event to modify data in the quickmod_array before it gets sent to the +* phpbb_add_quickmod_option function. +* +* @event core.viewtopic_add_quickmod_option_before +* @var int forum_id Forum ID +* @var int post_id Post ID +* @var array quickmod_array Array with quick moderation options data +* @var array topic_data Array with topic data +* @var int topic_id Topic ID +* @var array topic_tracking_info Array with topic tracking data +* @var string viewtopic_url URL to the topic page +* @var bool allow_change_type Topic change permissions check +* @since 3.1.9-RC1 +*/ +$vars = array( + 'forum_id', + 'post_id', + 'quickmod_array', + 'topic_data', + 'topic_id', + 'topic_tracking_info', + 'viewtopic_url', + 'allow_change_type', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_add_quickmod_option_before', compact($vars))); + +foreach ($quickmod_array as $option => $qm_ary) +{ + if (!empty($qm_ary[1])) + { + phpbb_add_quickmod_option($s_quickmod_action, $option, $qm_ary[0]); + } +} + +// Navigation links +generate_forum_nav($topic_data); + +// Forum Rules +generate_forum_rules($topic_data); + +// Moderators +$forum_moderators = array(); +if ($config['load_moderators']) +{ + get_moderators($forum_moderators, $forum_id); +} + +// This is only used for print view so ... +$server_path = (!$view) ? $phpbb_root_path : generate_board_url() . '/'; + +// Replace naughty words in title +$topic_data['topic_title'] = censor_text($topic_data['topic_title']); + +$s_search_hidden_fields = array( + 't' => $topic_id, + 'sf' => 'msgonly', +); +if ($_SID) +{ + $s_search_hidden_fields['sid'] = $_SID; +} + +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + +// If we've got a hightlight set pass it on to pagination. +$base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); + +/** +* Event to modify data before template variables are being assigned +* +* @event core.viewtopic_assign_template_vars_before +* @var string base_url URL to be passed to generate pagination +* @var int forum_id Forum ID +* @var int post_id Post ID +* @var array quickmod_array Array with quick moderation options data +* @var int start Pagination information +* @var array topic_data Array with topic data +* @var int topic_id Topic ID +* @var array topic_tracking_info Array with topic tracking data +* @var int total_posts Topic total posts count +* @var string viewtopic_url URL to the topic page +* @since 3.1.0-RC4 +* @changed 3.1.2-RC1 Added viewtopic_url +*/ +$vars = array( + 'base_url', + 'forum_id', + 'post_id', + 'quickmod_array', + 'start', + 'topic_data', + 'topic_id', + 'topic_tracking_info', + 'total_posts', + 'viewtopic_url', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_assign_template_vars_before', compact($vars))); + +$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start); + +// Send vars to template +$template->assign_vars(array( + 'FORUM_ID' => $forum_id, + 'FORUM_NAME' => $topic_data['forum_name'], + 'FORUM_DESC' => generate_text_for_display($topic_data['forum_desc'], $topic_data['forum_desc_uid'], $topic_data['forum_desc_bitfield'], $topic_data['forum_desc_options']), + 'TOPIC_ID' => $topic_id, + 'TOPIC_TITLE' => $topic_data['topic_title'], + 'TOPIC_POSTER' => $topic_data['topic_poster'], + + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), + 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), + + 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), + 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', + 'MODERATORS' => (isset($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', + + 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), + 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), + 'REPLY_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'TOPIC_LOCKED') : $user->img('button_topic_reply', 'REPLY_TO_TOPIC'), + 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'), + 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'), + 'DELETED_IMG' => $user->img('icon_topic_deleted', 'POST_DELETED_RESTORE'), + 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'), + 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'), + 'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'), + 'PM_IMG' => $user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), + 'EMAIL_IMG' => $user->img('icon_contact_email', 'SEND_EMAIL'), + 'JABBER_IMG' => $user->img('icon_contact_jabber', 'JABBER') , + 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'), + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), + 'WARN_IMG' => $user->img('icon_user_warn', 'WARN_USER'), + + 'S_IS_LOCKED' => ($topic_data['topic_status'] == ITEM_UNLOCKED && $topic_data['forum_status'] == ITEM_UNLOCKED) ? false : true, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id]) > 1) ? false : true, + 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")), + 'S_MOD_ACTION' => $s_quickmod_action, + + 'L_RETURN_TO_FORUM' => $user->lang('RETURN_TO', $topic_data['forum_name']), + 'S_VIEWTOPIC' => true, + 'S_UNREAD_VIEW' => $view == 'unread', + 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, + 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"), + 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), + + 'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, + 'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, + 'S_ENABLE_FEEDS_TOPIC' => ($config['feed_topic'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $topic_data['forum_options'])) ? true : false, + + 'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id", + 'U_FORUM' => $server_path, + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . (strlen($u_sort_param) ? "&$u_sort_param" : '')), + 'U_CANONICAL' => generate_board_url() . '/' . append_sid("viewtopic.$phpEx", "t=$topic_id" . (($start) ? "&start=$start" : ''), true, ''), + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), + 'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=previous"), + 'U_VIEW_NEWER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=next"), + 'U_PRINT_TOPIC' => ($auth->acl_get('f_print', $forum_id)) ? $viewtopic_url . '&view=print' : '', + 'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&t=$topic_id") : '', + + 'U_WATCH_TOPIC' => $s_watching_topic['link'], + 'U_WATCH_TOPIC_TOGGLE' => $s_watching_topic['link_toggle'], + 'S_WATCH_TOPIC_TITLE' => $s_watching_topic['title'], + 'S_WATCH_TOPIC_TOGGLE' => $s_watching_topic['title_toggle'], + 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], + + 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', + 'S_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], + 'S_BOOKMARK_TOGGLE' => (!$user->data['is_registered'] || !$config['allow_bookmarks'] || !$topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], + 'S_BOOKMARKED_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? true : false, + + 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=post&f=$forum_id") : '', + 'U_POST_REPLY_TOPIC' => ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id") : '', + 'U_BUMP_TOPIC' => (bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=bump&f=$forum_id&t=$topic_id&hash=" . generate_link_hash("topic_$topic_id")) : '') +); + +// Does this topic contain a poll? +if (!empty($topic_data['poll_start'])) +{ + $sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid + FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p + WHERE o.topic_id = $topic_id + AND p.post_id = {$topic_data['topic_first_post_id']} + AND p.topic_id = o.topic_id + ORDER BY o.poll_option_id"; + $result = $db->sql_query($sql); + + $poll_info = $vote_counts = array(); + while ($row = $db->sql_fetchrow($result)) + { + $poll_info[] = $row; + $option_id = (int) $row['poll_option_id']; + $vote_counts[$option_id] = (int) $row['poll_option_total']; + } + $db->sql_freeresult($result); + + $cur_voted_id = array(); + if ($user->data['is_registered']) + { + $sql = 'SELECT poll_option_id + FROM ' . POLL_VOTES_TABLE . ' + WHERE topic_id = ' . $topic_id . ' + AND vote_user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $cur_voted_id[] = $row['poll_option_id']; + } + $db->sql_freeresult($result); + } + else + { + // Cookie based guest tracking ... I don't like this but hum ho + // it's oft requested. This relies on "nice" users who don't feel + // the need to delete cookies to mess with results. + if ($request->is_set($config['cookie_name'] . '_poll_' . $topic_id, \phpbb\request\request_interface::COOKIE)) + { + $cur_voted_id = explode(',', $request->variable($config['cookie_name'] . '_poll_' . $topic_id, '', true, \phpbb\request\request_interface::COOKIE)); + $cur_voted_id = array_map('intval', $cur_voted_id); + } + } + + // Can not vote at all if no vote permission + $s_can_vote = ($auth->acl_get('f_vote', $forum_id) && + (($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) && + $topic_data['topic_status'] != ITEM_LOCKED && + $topic_data['forum_status'] != ITEM_LOCKED && + (!count($cur_voted_id) || + ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']))) ? true : false; + $s_display_results = (!$s_can_vote || ($s_can_vote && count($cur_voted_id)) || $view == 'viewpoll') ? true : false; + + /** + * Event to manipulate the poll data + * + * @event core.viewtopic_modify_poll_data + * @var array cur_voted_id Array with options' IDs current user has voted for + * @var int forum_id The topic's forum id + * @var array poll_info Array with the poll information + * @var bool s_can_vote Flag indicating if a user can vote + * @var bool s_display_results Flag indicating if results or poll options should be displayed + * @var int topic_id The id of the topic the user tries to access + * @var array topic_data All the information from the topic and forum tables for this topic + * @var string viewtopic_url URL to the topic page + * @var array vote_counts Array with the vote counts for every poll option + * @var array voted_id Array with updated options' IDs current user is voting for + * @since 3.1.5-RC1 + */ + $vars = array( + 'cur_voted_id', + 'forum_id', + 'poll_info', + 's_can_vote', + 's_display_results', + 'topic_id', + 'topic_data', + 'viewtopic_url', + 'vote_counts', + 'voted_id', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_data', compact($vars))); + + if ($update && $s_can_vote) + { + + if (!count($voted_id) || count($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) + { + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); + + meta_refresh(5, $redirect_url); + if (!count($voted_id)) + { + $message = 'NO_VOTE_OPTION'; + } + else if (count($voted_id) > $topic_data['poll_max_options']) + { + $message = 'TOO_MANY_VOTE_OPTIONS'; + } + else if (in_array(VOTE_CONVERTED, $cur_voted_id)) + { + $message = 'VOTE_CONVERTED'; + } + else + { + $message = 'FORM_INVALID'; + } + + $message = $user->lang[$message] . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + trigger_error($message); + } + + foreach ($voted_id as $option) + { + if (in_array($option, $cur_voted_id)) + { + continue; + } + + $sql = 'UPDATE ' . POLL_OPTIONS_TABLE . ' + SET poll_option_total = poll_option_total + 1 + WHERE poll_option_id = ' . (int) $option . ' + AND topic_id = ' . (int) $topic_id; + $db->sql_query($sql); + + $vote_counts[$option]++; + + if ($user->data['is_registered']) + { + $sql_ary = array( + 'topic_id' => (int) $topic_id, + 'poll_option_id' => (int) $option, + 'vote_user_id' => (int) $user->data['user_id'], + 'vote_user_ip' => (string) $user->ip, + ); + + $sql = 'INSERT INTO ' . POLL_VOTES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + } + } + + foreach ($cur_voted_id as $option) + { + if (!in_array($option, $voted_id)) + { + $sql = 'UPDATE ' . POLL_OPTIONS_TABLE . ' + SET poll_option_total = poll_option_total - 1 + WHERE poll_option_id = ' . (int) $option . ' + AND topic_id = ' . (int) $topic_id; + $db->sql_query($sql); + + $vote_counts[$option]--; + + if ($user->data['is_registered']) + { + $sql = 'DELETE FROM ' . POLL_VOTES_TABLE . ' + WHERE topic_id = ' . (int) $topic_id . ' + AND poll_option_id = ' . (int) $option . ' + AND vote_user_id = ' . (int) $user->data['user_id']; + $db->sql_query($sql); + } + } + } + + if ($user->data['user_id'] == ANONYMOUS && !$user->data['is_bot']) + { + $user->set_cookie('poll_' . $topic_id, implode(',', $voted_id), time() + 31536000); + } + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET poll_last_vote = ' . time() . " + WHERE topic_id = $topic_id"; + //, topic_last_post_time = ' . time() . " -- for bumping topics with new votes, ignore for now + $db->sql_query($sql); + + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); + $message = $user->lang['VOTE_SUBMITTED'] . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + + if ($request->is_ajax()) + { + // Filter out invalid options + $valid_user_votes = array_intersect(array_keys($vote_counts), $voted_id); + + $data = array( + 'NO_VOTES' => $user->lang['NO_VOTES'], + 'success' => true, + 'user_votes' => array_flip($valid_user_votes), + 'vote_counts' => $vote_counts, + 'total_votes' => array_sum($vote_counts), + 'can_vote' => !count($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']), + ); + + /** + * Event to manipulate the poll data sent by AJAX response + * + * @event core.viewtopic_modify_poll_ajax_data + * @var array data JSON response data + * @var array valid_user_votes Valid user votes + * @var array vote_counts Vote counts + * @var int forum_id Forum ID + * @var array topic_data Topic data + * @var array poll_info Array with the poll information + * @since 3.2.4-RC1 + */ + $vars = array( + 'data', + 'valid_user_votes', + 'vote_counts', + 'forum_id', + 'topic_data', + 'poll_info', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_ajax_data', compact($vars))); + + $json_response = new \phpbb\json_response(); + $json_response->send($data); + } + + meta_refresh(5, $redirect_url); + trigger_error($message); + } + + $poll_total = 0; + $poll_most = 0; + foreach ($poll_info as $poll_option) + { + $poll_total += $poll_option['poll_option_total']; + $poll_most = ($poll_option['poll_option_total'] >= $poll_most) ? $poll_option['poll_option_total'] : $poll_most; + } + + $parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + + for ($i = 0, $size = count($poll_info); $i < $size; $i++) + { + $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'] = generate_text_for_display($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield'], $parse_flags, true); + + $poll_template_data = $poll_options_template_data = array(); + foreach ($poll_info as $poll_option) + { + $option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0; + $option_pct_txt = sprintf("%.1d%%", round($option_pct * 100)); + $option_pct_rel = ($poll_most > 0) ? $poll_option['poll_option_total'] / $poll_most : 0; + $option_pct_rel_txt = sprintf("%.1d%%", round($option_pct_rel * 100)); + $option_most_votes = ($poll_option['poll_option_total'] > 0 && $poll_option['poll_option_total'] == $poll_most) ? true : false; + + $poll_options_template_data[] = array( + 'POLL_OPTION_ID' => $poll_option['poll_option_id'], + 'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'], + 'POLL_OPTION_RESULT' => $poll_option['poll_option_total'], + 'POLL_OPTION_PERCENT' => $option_pct_txt, + 'POLL_OPTION_PERCENT_REL' => $option_pct_rel_txt, + 'POLL_OPTION_PCT' => round($option_pct * 100), + 'POLL_OPTION_WIDTH' => round($option_pct * 250), + 'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false, + 'POLL_OPTION_MOST_VOTES' => $option_most_votes, + ); + } + + $poll_end = $topic_data['poll_length'] + $topic_data['poll_start']; + + $poll_template_data = array( + 'POLL_QUESTION' => $topic_data['poll_title'], + 'TOTAL_VOTES' => $poll_total, + 'POLL_LEFT_CAP_IMG' => $user->img('poll_left'), + 'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'), + + 'L_MAX_VOTES' => $user->lang('MAX_OPTIONS_SELECT', (int) $topic_data['poll_max_options']), + 'L_POLL_LENGTH' => ($topic_data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '', + + 'S_HAS_POLL' => true, + 'S_CAN_VOTE' => $s_can_vote, + 'S_DISPLAY_RESULTS' => $s_display_results, + 'S_IS_MULTI_CHOICE' => ($topic_data['poll_max_options'] > 1) ? true : false, + 'S_POLL_ACTION' => $viewtopic_url, + + 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll', + ); + + /** + * Event to add/modify poll template data + * + * @event core.viewtopic_modify_poll_template_data + * @var array cur_voted_id Array with options' IDs current user has voted for + * @var int poll_end The poll end time + * @var array poll_info Array with the poll information + * @var array poll_options_template_data Array with the poll options template data + * @var array poll_template_data Array with the common poll template data + * @var int poll_total Total poll votes count + * @var int poll_most Mostly voted option votes count + * @var array topic_data All the information from the topic and forum tables for this topic + * @var string viewtopic_url URL to the topic page + * @var array vote_counts Array with the vote counts for every poll option + * @var array voted_id Array with updated options' IDs current user is voting for + * @since 3.1.5-RC1 + */ + $vars = array( + 'cur_voted_id', + 'poll_end', + 'poll_info', + 'poll_options_template_data', + 'poll_template_data', + 'poll_total', + 'poll_most', + 'topic_data', + 'viewtopic_url', + 'vote_counts', + 'voted_id', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_template_data', compact($vars))); + + $template->assign_block_vars_array('poll_option', $poll_options_template_data); + + $template->assign_vars($poll_template_data); + + unset($poll_end, $poll_info, $poll_options_template_data, $poll_template_data, $voted_id); +} + +// If the user is trying to reach the second half of the topic, fetch it starting from the end +$store_reverse = false; +$sql_limit = $config['posts_per_page']; +$sql_sort_order = $direction = ''; + +if ($start > $total_posts / 2) +{ + $store_reverse = true; + + // Select the sort order + $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC'); + + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $total_posts); + $sql_start = $pagination->reverse_start($start, $sql_limit, $total_posts); +} +else +{ + // Select the sort order + $direction = (($sort_dir == 'd') ? 'DESC' : 'ASC'); + $sql_start = $start; +} + +if (is_array($sort_by_sql[$sort_key])) +{ + $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; +} +else +{ + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; +} + +// Container for user details, only process once +$post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = $post_delete_list = array(); +$has_unapproved_attachments = $has_approved_attachments = $display_notice = false; +$i = $i_total = 0; + +// Go ahead and pull all data for this topic +$sql = 'SELECT p.post_id + FROM ' . POSTS_TABLE . ' p' . (($join_user_sql[$sort_key]) ? ', ' . USERS_TABLE . ' u': '') . " + WHERE p.topic_id = $topic_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . " + " . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . " + $limit_posts_time + ORDER BY $sql_sort_order"; + +/** +* Event to modify the SQL query that gets post_list +* +* @event core.viewtopic_modify_post_list_sql +* @var string sql The SQL query to generate the post_list +* @var int sql_limit The number of posts the query fetches +* @var int sql_start The index the query starts to fetch from +* @var string sort_key Key the posts are sorted by +* @var string sort_days Display posts of previous x days +* @var int forum_id Forum ID +* @since 3.2.4-RC1 +*/ +$vars = array( + 'sql', + 'sql_limit', + 'sql_start', + 'sort_key', + 'sort_days', + 'forum_id', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_list_sql', compact($vars))); + +$result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + +$i = ($store_reverse) ? $sql_limit - 1 : 0; +while ($row = $db->sql_fetchrow($result)) +{ + $post_list[$i] = (int) $row['post_id']; + ($store_reverse) ? $i-- : $i++; +} +$db->sql_freeresult($result); + +if (!count($post_list)) +{ + if ($sort_days) + { + trigger_error('NO_POSTS_TIME_FRAME'); + } + else + { + trigger_error('NO_TOPIC'); + } +} + +// Holding maximum post time for marking topic read +// We need to grab it because we do reverse ordering sometimes +$max_post_time = 0; + +$sql_ary = array( + 'SELECT' => 'u.*, z.friend, z.foe, p.*', + + 'FROM' => array( + USERS_TABLE => 'u', + POSTS_TABLE => 'p', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(ZEBRA_TABLE => 'z'), + 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id', + ), + ), + + 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . ' + AND u.user_id = p.poster_id', +); + +/** +* Event to modify the SQL query before the post and poster data is retrieved +* +* @event core.viewtopic_get_post_data +* @var int forum_id Forum ID +* @var int topic_id Topic ID +* @var array topic_data Array with topic data +* @var array post_list Array with post_ids we are going to retrieve +* @var int sort_days Display posts of previous x days +* @var string sort_key Key the posts are sorted by +* @var string sort_dir Direction the posts are sorted by +* @var int start Pagination information +* @var array sql_ary The SQL array to get the data of posts and posters +* @since 3.1.0-a1 +* @changed 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start +*/ +$vars = array( + 'forum_id', + 'topic_id', + 'topic_data', + 'post_list', + 'sort_days', + 'sort_key', + 'sort_dir', + 'start', + 'sql_ary', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_post_data', compact($vars))); + +$sql = $db->sql_build_query('SELECT', $sql_ary); +$result = $db->sql_query($sql); + +$now = $user->create_datetime(); +$now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset()); + +// Posts are stored in the $rowset array while $attach_list, $user_cache +// and the global bbcode_bitfield are built +while ($row = $db->sql_fetchrow($result)) +{ + // Set max_post_time + if ($row['post_time'] > $max_post_time) + { + $max_post_time = $row['post_time']; + } + + $poster_id = (int) $row['poster_id']; + + // Does post have an attachment? If so, add it to the list + if ($row['post_attachment'] && $config['allow_attachments']) + { + $attach_list[] = (int) $row['post_id']; + + if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) + { + $has_unapproved_attachments = true; + } + else if ($row['post_visibility'] == ITEM_APPROVED) + { + $has_approved_attachments = true; + } + } + + $rowset_data = array( + 'hide_post' => (($row['foe'] || $row['post_visibility'] == ITEM_DELETED) && ($view != 'show' || $post_id != $row['post_id'])) ? true : false, + + 'post_id' => $row['post_id'], + 'post_time' => $row['post_time'], + 'user_id' => $row['user_id'], + 'username' => $row['username'], + 'user_colour' => $row['user_colour'], + 'topic_id' => $row['topic_id'], + 'forum_id' => $row['forum_id'], + 'post_subject' => $row['post_subject'], + 'post_edit_count' => $row['post_edit_count'], + 'post_edit_time' => $row['post_edit_time'], + 'post_edit_reason' => $row['post_edit_reason'], + 'post_edit_user' => $row['post_edit_user'], + 'post_edit_locked' => $row['post_edit_locked'], + 'post_delete_time' => $row['post_delete_time'], + 'post_delete_reason'=> $row['post_delete_reason'], + 'post_delete_user' => $row['post_delete_user'], + + // Make sure the icon actually exists + 'icon_id' => (isset($icons[$row['icon_id']]['img'], $icons[$row['icon_id']]['height'], $icons[$row['icon_id']]['width'])) ? $row['icon_id'] : 0, + 'post_attachment' => $row['post_attachment'], + 'post_visibility' => $row['post_visibility'], + 'post_reported' => $row['post_reported'], + 'post_username' => $row['post_username'], + 'post_text' => $row['post_text'], + 'bbcode_uid' => $row['bbcode_uid'], + 'bbcode_bitfield' => $row['bbcode_bitfield'], + 'enable_smilies' => $row['enable_smilies'], + 'enable_sig' => $row['enable_sig'], + 'friend' => $row['friend'], + 'foe' => $row['foe'], + ); + + /** + * Modify the post rowset containing data to be displayed with posts + * + * @event core.viewtopic_post_rowset_data + * @var array rowset_data Array with the rowset data for this post + * @var array row Array with original user and post data + * @since 3.1.0-a1 + */ + $vars = array('rowset_data', 'row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_rowset_data', compact($vars))); + + $rowset[$row['post_id']] = $rowset_data; + + // Cache various user specific data ... so we don't have to recompute + // this each time the same user appears on this page + if (!isset($user_cache[$poster_id])) + { + if ($poster_id == ANONYMOUS) + { + $user_cache_data = array( + 'user_type' => USER_IGNORE, + 'joined' => '', + 'posts' => '', + + 'sig' => '', + 'sig_bbcode_uid' => '', + 'sig_bbcode_bitfield' => '', + + 'online' => false, + 'avatar' => ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($row) : '', + 'rank_title' => '', + 'rank_image' => '', + 'rank_image_src' => '', + 'pm' => '', + 'email' => '', + 'jabber' => '', + 'search' => '', + 'age' => '', + + 'username' => $row['username'], + 'user_colour' => $row['user_colour'], + 'contact_user' => '', + + 'warnings' => 0, + 'allow_pm' => 0, + ); + + /** + * Modify the guest user's data displayed with the posts + * + * @event core.viewtopic_cache_guest_data + * @var array user_cache_data Array with the user's data + * @var int poster_id Poster's user id + * @var array row Array with original user and post data + * @since 3.1.0-a1 + */ + $vars = array('user_cache_data', 'poster_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_guest_data', compact($vars))); + + $user_cache[$poster_id] = $user_cache_data; + + $user_rank_data = phpbb_get_user_rank($row, false); + $user_cache[$poster_id]['rank_title'] = $user_rank_data['title']; + $user_cache[$poster_id]['rank_image'] = $user_rank_data['img']; + $user_cache[$poster_id]['rank_image_src'] = $user_rank_data['img_src']; + } + else + { + $user_sig = ''; + + // We add the signature to every posters entry because enable_sig is post dependent + if ($row['user_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) + { + $user_sig = $row['user_sig']; + } + + $id_cache[] = $poster_id; + + $user_cache_data = array( + 'user_type' => $row['user_type'], + 'user_inactive_reason' => $row['user_inactive_reason'], + + 'joined' => $user->format_date($row['user_regdate']), + 'posts' => $row['user_posts'], + 'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0, + + 'sig' => $user_sig, + 'sig_bbcode_uid' => (!empty($row['user_sig_bbcode_uid'])) ? $row['user_sig_bbcode_uid'] : '', + 'sig_bbcode_bitfield' => (!empty($row['user_sig_bbcode_bitfield'])) ? $row['user_sig_bbcode_bitfield'] : '', + + 'viewonline' => $row['user_allow_viewonline'], + 'allow_pm' => $row['user_allow_pm'], + + 'avatar' => ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($row) : '', + 'age' => '', + + 'rank_title' => '', + 'rank_image' => '', + 'rank_image_src' => '', + + 'username' => $row['username'], + 'user_colour' => $row['user_colour'], + 'contact_user' => $user->lang('CONTACT_USER', get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['username'])), + + 'online' => false, + 'jabber' => ($config['jab_enable'] && $row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', + 'search' => ($config['load_search'] && $auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '', + + 'author_full' => get_username_string('full', $poster_id, $row['username'], $row['user_colour']), + 'author_colour' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour']), + 'author_username' => get_username_string('username', $poster_id, $row['username'], $row['user_colour']), + 'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']), + ); + + /** + * Modify the users' data displayed with their posts + * + * @event core.viewtopic_cache_user_data + * @var array user_cache_data Array with the user's data + * @var int poster_id Poster's user id + * @var array row Array with original user and post data + * @since 3.1.0-a1 + */ + $vars = array('user_cache_data', 'poster_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_user_data', compact($vars))); + + $user_cache[$poster_id] = $user_cache_data; + + $user_rank_data = phpbb_get_user_rank($row, $row['user_posts']); + $user_cache[$poster_id]['rank_title'] = $user_rank_data['title']; + $user_cache[$poster_id]['rank_image'] = $user_rank_data['img']; + $user_cache[$poster_id]['rank_image_src'] = $user_rank_data['img_src']; + + if ((!empty($row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) + { + $user_cache[$poster_id]['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$poster_id") : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); + } + else + { + $user_cache[$poster_id]['email'] = ''; + } + + if ($config['allow_birthdays'] && !empty($row['user_birthday'])) + { + list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday'])); + + if ($bday_year) + { + $diff = $now['mon'] - $bday_month; + if ($diff == 0) + { + $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; + } + else + { + $diff = ($diff < 0) ? 1 : 0; + } + + $user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff); + } + } + } + } +} +$db->sql_freeresult($result); + +// Load custom profile fields +if ($config['load_cpf_viewtopic']) +{ + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + + // Grab all profile fields from users in id cache for later use - similar to the poster cache + $profile_fields_tmp = $cp->grab_profile_fields_data($id_cache); + + // filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs. + $profile_fields_cache = array(); + foreach ($profile_fields_tmp as $profile_user_id => $profile_fields) + { + $profile_fields_cache[$profile_user_id] = array(); + foreach ($profile_fields as $used_ident => $profile_field) + { + if ($profile_field['data']['field_show_on_vt']) + { + $profile_fields_cache[$profile_user_id][$used_ident] = $profile_field; + } + } + } + unset($profile_fields_tmp); +} + +// Generate online information for user +if ($config['load_onlinetrack'] && count($id_cache)) +{ + $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline + FROM ' . SESSIONS_TABLE . ' + WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . ' + GROUP BY session_user_id'; + $result = $db->sql_query($sql); + + $update_time = $config['load_online_time'] * 60; + while ($row = $db->sql_fetchrow($result)) + { + $user_cache[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; + } + $db->sql_freeresult($result); +} +unset($id_cache); + +// Pull attachment data +if (count($attach_list)) +{ + if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) + { + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . ' + AND in_message = 0 + ORDER BY attach_id DESC, post_msg_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + + // No attachments exist, but post table thinks they do so go ahead and reset post_attach flags + if (!count($attachments)) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_attachment = 0 + WHERE ' . $db->sql_in_set('post_id', $attach_list); + $db->sql_query($sql); + + // We need to update the topic indicator too if the complete topic is now without an attachment + if (count($rowset) != $total_posts) + { + // Not all posts are displayed so we query the db to find if there's any attachment for this topic + $sql = 'SELECT a.post_msg_id as post_id + FROM ' . ATTACHMENTS_TABLE . ' a, ' . POSTS_TABLE . " p + WHERE p.topic_id = $topic_id + AND p.post_visibility = " . ITEM_APPROVED . ' + AND p.topic_id = a.topic_id'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_attachment = 0 + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + } + } + else + { + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_attachment = 0 + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + } + } + else if ($has_approved_attachments && !$topic_data['topic_attachment']) + { + // Topic has approved attachments but its flag is wrong + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_attachment = 1 + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + + $topic_data['topic_attachment'] = 1; + } + else if ($has_unapproved_attachments && !$topic_data['topic_attachment']) + { + // Topic has only unapproved attachments but we have the right to see and download them + $topic_data['topic_attachment'] = 1; + } + } + else + { + $display_notice = true; + } +} + +if ($config['enable_accurate_pm_button']) +{ + // Get the list of users who can receive private messages + $can_receive_pm_list = $auth->acl_get_list(array_keys($user_cache), 'u_readpm'); + $can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_list[0]['u_readpm'])) ? array() : $can_receive_pm_list[0]['u_readpm']; + + // Get the list of permanently banned users + $permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false); +} +else +{ + $can_receive_pm_list = array_keys($user_cache); + $permanently_banned_users = []; +} + +$i_total = count($rowset) - 1; +$prev_post_id = ''; + +$template->assign_vars(array( + 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], + 'S_NUM_POSTS' => count($post_list)) +); + +/** +* Event to modify the post, poster and attachment data before assigning the posts +* +* @event core.viewtopic_modify_post_data +* @var int forum_id Forum ID +* @var int topic_id Topic ID +* @var array topic_data Array with topic data +* @var array post_list Array with post_ids we are going to display +* @var array rowset Array with post_id => post data +* @var array user_cache Array with prepared user data +* @var int start Pagination information +* @var int sort_days Display posts of previous x days +* @var string sort_key Key the posts are sorted by +* @var string sort_dir Direction the posts are sorted by +* @var bool display_notice Shall we display a notice instead of attachments +* @var bool has_approved_attachments Does the topic have approved attachments +* @var array attachments List of attachments post_id => array of attachments +* @var array permanently_banned_users List of permanently banned users +* @var array can_receive_pm_list Array with posters that can receive pms +* @since 3.1.0-RC3 +*/ +$vars = array( + 'forum_id', + 'topic_id', + 'topic_data', + 'post_list', + 'rowset', + 'user_cache', + 'sort_days', + 'sort_key', + 'sort_dir', + 'start', + 'permanently_banned_users', + 'can_receive_pm_list', + 'display_notice', + 'has_approved_attachments', + 'attachments', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_data', compact($vars))); + +// Output the posts +$first_unread = $post_unread = false; +for ($i = 0, $end = count($post_list); $i < $end; ++$i) +{ + // A non-existing rowset only happens if there was no user present for the entered poster_id + // This could be a broken posts table. + if (!isset($rowset[$post_list[$i]])) + { + continue; + } + + $row = $rowset[$post_list[$i]]; + $poster_id = $row['user_id']; + + // End signature parsing, only if needed + if ($user_cache[$poster_id]['sig'] && $row['enable_sig'] && empty($user_cache[$poster_id]['sig_parsed'])) + { + $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); + $user_cache[$poster_id]['sig_parsed'] = true; + } + + // Parse the message and subject + $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']])) + { + parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count); + } + + // Replace naughty words such as farty pants + $row['post_subject'] = censor_text($row['post_subject']); + + // Highlight active words (primarily for search) + if ($highlight_match) + { + $message = preg_replace('#(?!<.*)(?]*(?:)#is', '\1', $message); + $row['post_subject'] = preg_replace('#(?!<.*)(?]*(?:)#is', '\1', $row['post_subject']); + } + + // Editing information + if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason']) + { + // Get usernames for all following posts if not already stored + if (!count($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])))) + { + // Remove all post_ids already parsed (we do not have to check them) + $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i); + + $sql = 'SELECT DISTINCT u.user_id, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . $db->sql_in_set('p.post_id', $post_storage_list) . ' + AND p.post_edit_count <> 0 + AND p.post_edit_user <> 0 + AND p.post_edit_user = u.user_id'; + $result2 = $db->sql_query($sql); + while ($user_edit_row = $db->sql_fetchrow($result2)) + { + $post_edit_list[$user_edit_row['user_id']] = $user_edit_row; + } + $db->sql_freeresult($result2); + + unset($post_storage_list); + } + + if ($row['post_edit_reason']) + { + // User having edited the post also being the post author? + if (!$row['post_edit_user'] || $row['post_edit_user'] == $poster_id) + { + $display_username = get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + } + else + { + $display_username = get_username_string('full', $row['post_edit_user'], $post_edit_list[$row['post_edit_user']]['username'], $post_edit_list[$row['post_edit_user']]['user_colour']); + } + + $l_edited_by = $user->lang('EDITED_TIMES_TOTAL', (int) $row['post_edit_count'], $display_username, $user->format_date($row['post_edit_time'], false, true)); + } + else + { + if ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])) + { + $user_cache[$row['post_edit_user']] = $post_edit_list[$row['post_edit_user']]; + } + + // User having edited the post also being the post author? + if (!$row['post_edit_user'] || $row['post_edit_user'] == $poster_id) + { + $display_username = get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + } + else + { + $display_username = get_username_string('full', $row['post_edit_user'], $user_cache[$row['post_edit_user']]['username'], $user_cache[$row['post_edit_user']]['user_colour']); + } + + $l_edited_by = $user->lang('EDITED_TIMES_TOTAL', (int) $row['post_edit_count'], $display_username, $user->format_date($row['post_edit_time'], false, true)); + } + } + else + { + $l_edited_by = ''; + } + + // Deleting information + if ($row['post_visibility'] == ITEM_DELETED && $row['post_delete_user']) + { + // Get usernames for all following posts if not already stored + if (!count($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']])))) + { + // Remove all post_ids already parsed (we do not have to check them) + $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i); + + $sql = 'SELECT DISTINCT u.user_id, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . $db->sql_in_set('p.post_id', $post_storage_list) . ' + AND p.post_delete_user <> 0 + AND p.post_delete_user = u.user_id'; + $result2 = $db->sql_query($sql); + while ($user_delete_row = $db->sql_fetchrow($result2)) + { + $post_delete_list[$user_delete_row['user_id']] = $user_delete_row; + } + $db->sql_freeresult($result2); + + unset($post_storage_list); + } + + if ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']])) + { + $user_cache[$row['post_delete_user']] = $post_delete_list[$row['post_delete_user']]; + } + + $display_postername = get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + + // User having deleted the post also being the post author? + if (!$row['post_delete_user'] || $row['post_delete_user'] == $poster_id) + { + $display_username = $display_postername; + } + else + { + $display_username = get_username_string('full', $row['post_delete_user'], $user_cache[$row['post_delete_user']]['username'], $user_cache[$row['post_delete_user']]['user_colour']); + } + + if ($row['post_delete_reason']) + { + $l_deleted_message = $user->lang('POST_DELETED_BY_REASON', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true), $row['post_delete_reason']); + } + else + { + $l_deleted_message = $user->lang('POST_DELETED_BY', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true)); + } + $l_deleted_by = $user->lang('DELETED_INFORMATION', $display_username, $user->format_date($row['post_delete_time'], false, true)); + } + else + { + $l_deleted_by = $l_deleted_message = ''; + } + + // Bump information + if ($topic_data['topic_bumped'] && $row['post_id'] == $topic_data['topic_last_post_id'] && isset($user_cache[$topic_data['topic_bumper']]) ) + { + // It is safe to grab the username from the user cache array, we are at the last + // post and only the topic poster and last poster are allowed to bump. + // Admins and mods are bound to the above rules too... + $l_bumped_by = sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time'], false, true)); + } + else + { + $l_bumped_by = ''; + } + + $cp_row = array(); + + // + if ($config['load_cpf_viewtopic']) + { + $cp_row = (isset($profile_fields_cache[$poster_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$poster_id]) : array(); + } + + $post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false; + + $s_first_unread = false; + if (!$first_unread && $post_unread) + { + $s_first_unread = $first_unread = true; + } + + $force_edit_allowed = $force_delete_allowed = $force_softdelete_allowed = false; + + $s_cannot_edit = !$auth->acl_get('f_edit', $forum_id) || $user->data['user_id'] != $poster_id; + $s_cannot_edit_time = $config['edit_time'] && $row['post_time'] <= time() - ($config['edit_time'] * 60); + $s_cannot_edit_locked = $topic_data['topic_status'] == ITEM_LOCKED || $row['post_edit_locked']; + + $s_cannot_delete = $user->data['user_id'] != $poster_id || ( + !$auth->acl_get('f_delete', $forum_id) && + (!$auth->acl_get('f_softdelete', $forum_id) || $row['post_visibility'] == ITEM_DELETED) + ); + $s_cannot_delete_lastpost = $topic_data['topic_last_post_id'] != $row['post_id']; + $s_cannot_delete_time = $config['delete_time'] && $row['post_time'] <= time() - ($config['delete_time'] * 60); + // we do not want to allow removal of the last post if a moderator locked it! + $s_cannot_delete_locked = $topic_data['topic_status'] == ITEM_LOCKED || $row['post_edit_locked']; + + /** + * This event allows you to modify the conditions for the "can edit post" and "can delete post" checks + * + * @event core.viewtopic_modify_post_action_conditions + * @var array row Array with post data + * @var array topic_data Array with topic data + * @var bool force_edit_allowed Allow the user to edit the post (all permissions and conditions are ignored) + * @var bool s_cannot_edit User can not edit the post because it's not his + * @var bool s_cannot_edit_locked User can not edit the post because it's locked + * @var bool s_cannot_edit_time User can not edit the post because edit_time has passed + * @var bool force_delete_allowed Allow the user to delete the post (all permissions and conditions are ignored) + * @var bool s_cannot_delete User can not delete the post because it's not his + * @var bool s_cannot_delete_lastpost User can not delete the post because it's not the last post of the topic + * @var bool s_cannot_delete_locked User can not delete the post because it's locked + * @var bool s_cannot_delete_time User can not delete the post because edit_time has passed + * @var bool force_softdelete_allowed Allow the user to ыoftdelete the post (all permissions and conditions are ignored) + * @since 3.1.0-b4 + * @changed 3.1.11-RC1 Added force_softdelete_allowed var + */ + $vars = array( + 'row', + 'topic_data', + 'force_edit_allowed', + 's_cannot_edit', + 's_cannot_edit_locked', + 's_cannot_edit_time', + 'force_delete_allowed', + 's_cannot_delete', + 's_cannot_delete_lastpost', + 's_cannot_delete_locked', + 's_cannot_delete_time', + 'force_softdelete_allowed', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_action_conditions', compact($vars))); + + $edit_allowed = $force_edit_allowed || ($user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || ( + !$s_cannot_edit && + !$s_cannot_edit_time && + !$s_cannot_edit_locked + ))); + + $quote_allowed = $auth->acl_get('m_edit', $forum_id) || ($topic_data['topic_status'] != ITEM_LOCKED && + ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('f_reply', $forum_id)) + ); + + // Only display the quote button if the post is quotable. Posts not approved are not quotable. + $quote_allowed = ($quote_allowed && $row['post_visibility'] == ITEM_APPROVED) ? true : false; + + $delete_allowed = $force_delete_allowed || ($user->data['is_registered'] && ( + ($auth->acl_get('m_delete', $forum_id) || ($auth->acl_get('m_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) || + (!$s_cannot_delete && !$s_cannot_delete_lastpost && !$s_cannot_delete_time && !$s_cannot_delete_locked) + )); + + $softdelete_allowed = $force_softdelete_allowed || (($auth->acl_get('m_softdelete', $forum_id) || + ($auth->acl_get('f_softdelete', $forum_id) && $user->data['user_id'] == $poster_id)) && ($row['post_visibility'] != ITEM_DELETED)); + + $permanent_delete_allowed = $force_delete_allowed || ($auth->acl_get('m_delete', $forum_id) || + ($auth->acl_get('f_delete', $forum_id) && $user->data['user_id'] == $poster_id)); + + // Can this user receive a Private Message? + $can_receive_pm = ( + // They must be a "normal" user + $user_cache[$poster_id]['user_type'] != USER_IGNORE && + + // They must not be deactivated by the administrator + ($user_cache[$poster_id]['user_type'] != USER_INACTIVE || $user_cache[$poster_id]['user_inactive_reason'] != INACTIVE_MANUAL) && + + // They must be able to read PMs + in_array($poster_id, $can_receive_pm_list) && + + // They must not be permanently banned + !in_array($poster_id, $permanently_banned_users) && + + // They must allow users to contact via PM + (($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || $user_cache[$poster_id]['allow_pm']) + ); + + $u_pm = ''; + + if ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && $can_receive_pm) + { + $u_pm = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']); + } + + // + $post_row = array( + 'POST_AUTHOR_FULL' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_full'] : get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_colour'] : get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_username'] : get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_profile'] : get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + + 'RANK_TITLE' => $user_cache[$poster_id]['rank_title'], + 'RANK_IMG' => $user_cache[$poster_id]['rank_image'], + 'RANK_IMG_SRC' => $user_cache[$poster_id]['rank_image_src'], + 'POSTER_JOINED' => $user_cache[$poster_id]['joined'], + 'POSTER_POSTS' => $user_cache[$poster_id]['posts'], + 'POSTER_AVATAR' => $user_cache[$poster_id]['avatar'], + 'POSTER_WARNINGS' => $auth->acl_get('m_warn') ? $user_cache[$poster_id]['warnings'] : '', + 'POSTER_AGE' => $user_cache[$poster_id]['age'], + 'CONTACT_USER' => $user_cache[$poster_id]['contact_user'], + + 'POST_DATE' => $user->format_date($row['post_time'], false, ($view == 'print') ? true : false), + 'POST_DATE_RFC3339' => gmdate(DATE_RFC3339, $row['post_time']), + 'POST_SUBJECT' => $row['post_subject'], + 'MESSAGE' => $message, + 'SIGNATURE' => ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '', + 'EDITED_MESSAGE' => $l_edited_by, + 'EDIT_REASON' => $row['post_edit_reason'], + 'DELETED_MESSAGE' => $l_deleted_by, + 'DELETE_REASON' => $row['post_delete_reason'], + 'BUMPED_MESSAGE' => $l_bumped_by, + + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), + 'POST_ICON_IMG' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '', + 'POST_ICON_IMG_WIDTH' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '', + 'POST_ICON_IMG_HEIGHT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '', + 'POST_ICON_IMG_ALT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['alt'] : '', + 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), + 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), + + 'U_EDIT' => ($edit_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : '', + 'U_QUOTE' => ($quote_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f=$forum_id&p={$row['post_id']}") : '', + 'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '', + 'U_DELETE' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=' . (($softdelete_allowed) ? 'soft_delete' : 'delete') . "&f=$forum_id&p={$row['post_id']}") : '', + + 'U_SEARCH' => $user_cache[$poster_id]['search'], + 'U_PM' => $u_pm, + 'U_EMAIL' => $user_cache[$poster_id]['email'], + 'U_JABBER' => $user_cache[$poster_id]['jabber'], + + 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p={$row['post_id']}&f=$forum_id&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url . '&p=' . $row['post_id'] . '#p' . $row['post_id']))), + 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? $phpbb_container->get('controller.helper')->route('phpbb_report_post_controller', array('id' => $row['post_id'])) : '', + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_MCP_RESTORE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_data['topic_visibility'] != ITEM_DELETED) ? 'deleted_posts' : 'deleted_topics') . '&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'], + 'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '', + 'U_PREV_POST_ID' => $prev_post_id, + 'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $poster_id, true, $user->session_id) : '', + 'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + + 'POST_ID' => $row['post_id'], + 'POST_NUMBER' => $i + $start + 1, + 'POSTER_ID' => $poster_id, + 'MINI_POST' => ($post_unread) ? $user->lang['UNREAD_POST'] : $user->lang['POST'], + + + 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, + 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && count($attachments[$row['post_id']]) > 1, + 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) ? true : false, + 'S_CAN_APPROVE' => $auth->acl_get('m_approve', $forum_id), + 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false, + 'L_POST_DELETED_MESSAGE' => $l_deleted_message, + 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false, + 'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'], + 'S_FRIEND' => ($row['friend']) ? true : false, + 'S_UNREAD_POST' => $post_unread, + 'S_FIRST_UNREAD' => $s_first_unread, + 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, + 'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false, + 'S_FIRST_POST' => ($topic_data['topic_first_post_id'] == $row['post_id']) ? true : false, + + 'S_IGNORE_POST' => ($row['foe']) ? true : false, + 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '', + 'S_POST_HIDDEN' => $row['hide_post'], + 'L_POST_DISPLAY' => ($row['hide_post']) ? $user->lang('POST_DISPLAY', '', '') : '', + 'S_DELETE_PERMANENT' => $permanent_delete_allowed, + ); + + $user_poster_data = $user_cache[$poster_id]; + + $current_row_number = $i; + + /** + * Modify the posts template block + * + * @event core.viewtopic_modify_post_row + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var int end Number of posts on this page + * @var int total_posts Total posts count + * @var int poster_id Post author id + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @var array attachments List of attachments + * @var array user_poster_data Poster's data from user cache + * @var array post_row Template block array of the post + * @var array topic_data Array with topic data + * @var array user_cache Array with cached user data + * @var array post_edit_list Array with post edited list + * @since 3.1.0-a1 + * @changed 3.1.0-a3 Added vars start, current_row_number, end, attachments + * @changed 3.1.0-b3 Added topic_data array, total_posts + * @changed 3.1.0-RC3 Added poster_id + * @changed 3.2.2-RC1 Added user_cache and post_edit_list + */ + $vars = array( + 'start', + 'current_row_number', + 'end', + 'total_posts', + 'poster_id', + 'row', + 'cp_row', + 'attachments', + 'user_poster_data', + 'post_row', + 'topic_data', + 'user_cache', + 'post_edit_list', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); + + $i = $current_row_number; + + if (isset($cp_row['row']) && count($cp_row['row'])) + { + $post_row = array_merge($post_row, $cp_row['row']); + } + + // Dump vars into template + $template->assign_block_vars('postrow', $post_row); + + $contact_fields = array( + array( + 'ID' => 'pm', + 'NAME' => $user->lang['SEND_PRIVATE_MESSAGE'], + 'U_CONTACT' => $post_row['U_PM'], + ), + array( + 'ID' => 'email', + 'NAME' => $user->lang['SEND_EMAIL'], + 'U_CONTACT' => $user_cache[$poster_id]['email'], + ), + array( + 'ID' => 'jabber', + 'NAME' => $user->lang['JABBER'], + 'U_CONTACT' => $user_cache[$poster_id]['jabber'], + ), + ); + + foreach ($contact_fields as $field) + { + if ($field['U_CONTACT']) + { + $template->assign_block_vars('postrow.contact', $field); + } + } + + if (!empty($cp_row['blockrow'])) + { + foreach ($cp_row['blockrow'] as $field_data) + { + $template->assign_block_vars('postrow.custom_fields', $field_data); + + if ($field_data['S_PROFILE_CONTACT']) + { + $template->assign_block_vars('postrow.contact', array( + 'ID' => $field_data['PROFILE_FIELD_IDENT'], + 'NAME' => $field_data['PROFILE_FIELD_NAME'], + 'U_CONTACT' => $field_data['PROFILE_FIELD_CONTACT'], + )); + } + } + } + + // Display not already displayed Attachments for this post, we already parsed them. ;) + if (!empty($attachments[$row['post_id']])) + { + foreach ($attachments[$row['post_id']] as $attachment) + { + $template->assign_block_vars('postrow.attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + } + + $current_row_number = $i; + + /** + * Event after the post data has been assigned to the template + * + * @event core.viewtopic_post_row_after + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var int end Number of posts on this page + * @var int total_posts Total posts count + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @var array attachments List of attachments + * @var array user_poster_data Poster's data from user cache + * @var array post_row Template block array of the post + * @var array topic_data Array with topic data + * @since 3.1.0-a3 + * @changed 3.1.0-b3 Added topic_data array, total_posts + */ + $vars = array( + 'start', + 'current_row_number', + 'end', + 'total_posts', + 'row', + 'cp_row', + 'attachments', + 'user_poster_data', + 'post_row', + 'topic_data', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_row_after', compact($vars))); + + $i = $current_row_number; + + $prev_post_id = $row['post_id']; + + unset($rowset[$post_list[$i]]); + unset($attachments[$row['post_id']]); +} +unset($rowset, $user_cache); + +// Update topic view and if necessary attachment view counters ... but only for humans and if this is the first 'page view' +if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($user->data['session_page'], '&t=' . $topic_id) === false || isset($user->data['session_created']))) +{ + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . " + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + + // Update the attachment download counts + if (count($update_count)) + { + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET download_count = download_count + 1 + WHERE ' . $db->sql_in_set('attach_id', array_unique($update_count)); + $db->sql_query($sql); + } +} + +// Only mark topic if it's currently unread. Also make sure we do not set topic tracking back if earlier pages are viewed. +if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $max_post_time > $topic_tracking_info[$topic_id]) +{ + markread('topic', $forum_id, $topic_id, $max_post_time); + + // Update forum info + $all_marked_read = update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); +} +else +{ + $all_marked_read = true; +} + +// If there are absolutely no more unread posts in this forum +// and unread posts shown, we can safely show the #unread link +if ($all_marked_read) +{ + if ($post_unread) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => '#unread', + )); + } + else if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id]) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', + )); + } +} +else if (!$all_marked_read) +{ + $last_page = ((floor($start / $config['posts_per_page']) + 1) == max(ceil($total_posts / $config['posts_per_page']), 1)) ? true : false; + + // What can happen is that we are at the last displayed page. If so, we also display the #unread link based in $post_unread + if ($last_page && $post_unread) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => '#unread', + )); + } + else if (!$last_page) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', + )); + } +} + +// let's set up quick_reply +$s_quick_reply = false; +if ($user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id)) +{ + // Quick reply enabled forum + $s_quick_reply = (($topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED) || $auth->acl_get('m_edit', $forum_id)) ? true : false; +} + +if ($s_can_vote || $s_quick_reply) +{ + add_form_key('posting'); + + if ($s_quick_reply) + { + $s_attach_sig = $config['allow_sig'] && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); + $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); + $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); + $s_notify = $config['allow_topic_notify'] && ($user->data['user_notify'] || $s_watching_topic['is_watching']); + + $qr_hidden_fields = array( + 'topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], + 'topic_id' => (int) $topic_data['topic_id'], + 'forum_id' => (int) $forum_id, + ); + + // Originally we use checkboxes and check with isset(), so we only provide them if they would be checked + (!$s_bbcode) ? $qr_hidden_fields['disable_bbcode'] = 1 : true; + (!$s_smilies) ? $qr_hidden_fields['disable_smilies'] = 1 : true; + (!$config['allow_post_links']) ? $qr_hidden_fields['disable_magic_url'] = 1 : true; + ($s_attach_sig) ? $qr_hidden_fields['attach_sig'] = 1 : true; + ($s_notify) ? $qr_hidden_fields['notify'] = 1 : true; + ($topic_data['topic_status'] == ITEM_LOCKED) ? $qr_hidden_fields['lock_topic'] = 1 : true; + + $tpl_ary = [ + 'S_QUICK_REPLY' => true, + 'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"), + 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), + 'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']), + ]; + + /** + * Event after the quick-reply has been setup + * + * @event core.viewtopic_modify_quick_reply_template_vars + * @var array tpl_ary Array with template data + * @var array topic_data Array with topic data + * @since 3.2.9-RC1 + */ + $vars = ['tpl_ary', 'topic_data']; + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_quick_reply_template_vars', compact($vars))); + + $template->assign_vars($tpl_ary); + } +} +// now I have the urge to wash my hands :( + + +// We overwrite $_REQUEST['f'] if there is no forum specified +// to be able to display the correct online list. +// One downside is that the user currently viewing this topic/post is not taken into account. +if (!$request->variable('f', 0)) +{ + $request->overwrite('f', $forum_id); +} + +// We need to do the same with the topic_id. See #53025. +if (!$request->variable('t', 0) && !empty($topic_id)) +{ + $request->overwrite('t', $topic_id); +} + +$page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], $pagination->get_on_page($config['posts_per_page'], $start)) : ''); + +/** +* You can use this event to modify the page title of the viewtopic page +* +* @event core.viewtopic_modify_page_title +* @var string page_title Title of the viewtopic page +* @var array topic_data Array with topic data +* @var int forum_id Forum ID of the topic +* @var int start Start offset used to calculate the page +* @var array post_list Array with post_ids we are going to display +* @since 3.1.0-a1 +* @changed 3.1.0-RC4 Added post_list var +*/ +$vars = array('page_title', 'topic_data', 'forum_id', 'start', 'post_list'); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars))); + +// Output the page +page_header($page_title, true, $forum_id); + +$template->set_filenames(array( + 'body' => ($view == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html') +); +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_id); + +page_footer(); diff --git a/install/update/old/.htaccess b/install/update/old/.htaccess new file mode 100644 index 0000000..53bce76 --- /dev/null +++ b/install/update/old/.htaccess @@ -0,0 +1,85 @@ + +RewriteEngine on + +# +# Uncomment the statement below if URL rewriting doesn't +# work properly. If you installed phpBB in a subdirectory +# of your site, properly set the argument for the statement. +# e.g.: if your domain is test.com and you installed phpBB +# in http://www.test.com/phpBB/index.php you have to set +# the statement RewriteBase /phpBB/ +# +#RewriteBase / + +# +# Uncomment the statement below if you want to make use of +# HTTP authentication and it does not already work. +# This could be required if you are for example using PHP via Apache CGI. +# +#RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L] + +# +# The following 3 lines will rewrite URLs passed through the front controller +# to not require app.php in the actual URL. In other words, a controller is +# by default accessed at /app.php/my/controller, but can also be accessed at +# /my/controller +# +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d +RewriteRule ^(.*)$ app.php [QSA,L] + +# +# If symbolic links are not already being followed, +# uncomment the line below. +# http://anothersysadmin.wordpress.com/2008/06/10/mod_rewrite-forbidden-403-with-apache-228/ +# +#Options +FollowSymLinks + + +# With Apache 2.4 the "Order, Deny" syntax has been deprecated and moved from +# module mod_authz_host to a new module called mod_access_compat (which may be +# disabled) and a new "Require" syntax has been introduced to mod_authz_host. +# We could just conditionally provide both versions, but unfortunately Apache +# does not explicitly tell us its version if the module mod_version is not +# available. In this case, we check for the availability of module +# mod_authz_core (which should be on 2.4 or higher only) as a best guess. + + + + Order Allow,Deny + Deny from All + + + Order Allow,Deny + Deny from All + + + = 2.4> + + Require all denied + + + Require all denied + + + + + + + Order Allow,Deny + Deny from All + + + Order Allow,Deny + Deny from All + + + + + Require all denied + + + Require all denied + + + diff --git a/install/update/old/adm/index.php b/install/update/old/adm/index.php new file mode 100644 index 0000000..d27f56f --- /dev/null +++ b/install/update/old/adm/index.php @@ -0,0 +1,91 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +define('IN_PHPBB', true); +define('ADMIN_START', true); +define('NEED_SID', true); + +// Include files +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +require($phpbb_root_path . 'common.' . $phpEx); +require($phpbb_root_path . 'includes/functions_acp.' . $phpEx); +require($phpbb_root_path . 'includes/functions_admin.' . $phpEx); +require($phpbb_root_path . 'includes/functions_module.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('acp/common'); +// End session management + +// Have they authenticated (again) as an admin for this session? +if (!isset($user->data['session_admin']) || !$user->data['session_admin']) +{ + login_box('', $user->lang['LOGIN_ADMIN_CONFIRM'], $user->lang['LOGIN_ADMIN_SUCCESS'], true, false); +} + +// Is user any type of admin? No, then stop here, each script needs to +// check specific permissions but this is a catchall +if (!$auth->acl_get('a_')) +{ + send_status_line(403, 'Forbidden'); + trigger_error('NO_ADMIN'); +} + +// We define the admin variables now, because the user is now able to use the admin related features... +define('IN_ADMIN', true); + +// Some oft used variables +$safe_mode = (@ini_get('safe_mode') == '1' || strtolower(@ini_get('safe_mode')) === 'on') ? true : false; +$file_uploads = (@ini_get('file_uploads') == '1' || strtolower(@ini_get('file_uploads')) === 'on') ? true : false; +$module_id = $request->variable('i', ''); +$mode = $request->variable('mode', ''); + +// Set custom style for admin area +$template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), +), $phpbb_admin_path . 'style'); + +$template->assign_var('T_ASSETS_PATH', $phpbb_root_path . 'assets'); +$template->assign_var('T_TEMPLATE_PATH', $phpbb_admin_path . 'style'); + +// Instantiate new module +$module = new p_master(); + +// Instantiate module system and generate list of available modules +$module->list_modules('acp'); + +// Select the active module +$module->set_active($module_id, $mode); + +// Assign data to the template engine for the list of modules +// We do this before loading the active module for correct menu display in trigger_error +$module->assign_tpl_vars(append_sid("{$phpbb_admin_path}index.$phpEx")); + +// Load and execute the relevant module +$module->load_active(); + +// Generate the page +adm_page_header($module->get_page_title()); + +$template->set_filenames(array( + 'body' => $module->get_tpl_name(), +)); + +adm_page_footer(); diff --git a/install/update/old/adm/style/acp_attachments.html b/install/update/old/adm/style/acp_attachments.html new file mode 100644 index 0000000..868e256 --- /dev/null +++ b/install/update/old/adm/style/acp_attachments.html @@ -0,0 +1,487 @@ + + + + + + « {L_BACK} + + +

{L_TITLE}

+ +

{L_TITLE_EXPLAIN}

+ + +
+

{L_WARNING}

+

{WARNING_MSG}

+
+ + + +
+

{L_NOTIFY}

+

{NOTIFY_MSG}

+
+ + + +

{L_UPLOADING_FILES}

+ + + :: {upload.FILE_INFO}
+ {upload.DENIED}{upload.ERROR_MSG}{L_SUCCESSFULLY_UPLOADED} +

+ + + + + + +
+ + + + + +
+ {options.LEGEND} + + +
+

{options.TITLE_EXPLAIN}
+
{options.CONTENT}
+
+ + + +
+ +
+ {L_SUBMIT} +   + +
+ + +
+

{L_SECURE_DOWNLOAD_NOTICE}

+
+ + +
+ {L_SECURE_TITLE} +

{L_DOWNLOAD_ADD_IPS_EXPLAIN}

+
+
+
+
+
+

{L_EXCLUDE_ENTERED_IP}
+
+
+
+ +

+ +

+
+ +
+ {L_REMOVE_IPS} + +

{L_DOWNLOAD_REMOVE_IPS_EXPLAIN}

+
+
+
+
+ +

+ +

+
+ + +

{L_NO_IPS_DEFINED}

+ + {S_FORM_TOKEN} + +
+ + + + + + +
+
+ + + + {L_LEGEND} +
+
+
+
+
+

{L_SPECIAL_CATEGORY_EXPLAIN}
+
{S_CATEGORY_SELECT}
+
+
+
+
checked="checked" />
+
+
+
+
checked="checked" />
+
+
+
+
+
 src="{ROOT_PATH}images/spacer.gif"src="{UPLOAD_ICON_SRC}" id="image_upload_icon" alt="" title="" /> 
+
+
+
+
+
+
+
+
{ASSIGNED_EXTENSIONS}
[{L_GO_TO_EXTENSIONS} ]
+
+
+
+

{L_ALLOWED_FORUMS_EXPLAIN}
+
+
+
+
+ +

+   + +

+ {S_FORM_TOKEN} +
+ +
+ + +
+
+ {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + + +
{L_EXTENSION_GROUP}{L_SPECIAL_CATEGORY}{L_OPTIONS}
 
{groups.GROUP_NAME} +
» {L_NOT_ALLOWED_IN_PM} +
» {L_ONLY_ALLOWED_IN_PM} +
» {L_NOT_ALLOWED_IN_PM_POST} +
» {L_ALLOWED_IN_PM_POST} +
{groups.CATEGORY} {ICON_EDIT}  {ICON_DELETE} 
+

+ {L_CREATE_GROUP}{L_COLON} + +

+ {S_FORM_TOKEN} +
+
+ + + + + +
+
+ {L_ADD_EXTENSION} +
+
+
+
+
+
+
{GROUP_SELECT_OPTIONS}
+
+ +

+ +

+ {S_FORM_TOKEN} +
+
+ +
+ +
+ {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + + +
{L_EXTENSION}{L_EXTENSION_GROUP}{L_DELETE}
 
{extensions.EXTENSION}{extensions.GROUP_OPTIONS}
+ +

+   + +

+ {S_FORM_TOKEN} +
+
+ + + +
+ +
+ {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_FILENAME}{L_FILEDATE}{L_FILESIZE}{L_ATTACH_POST_ID}{L_ATTACH_TO_POST}{L_DELETE}
{orphan.REAL_FILENAME}{orphan.FILETIME}{orphan.FILESIZE}{L_ATTACH_ID}{L_COLON}
 {L_MARK_ALL} :: {L_UNMARK_ALL}{L_MARK_ALL} :: {L_UNMARK_ALL}
+ +
+

{L_NO_ATTACHMENTS}

+
+ + + + + + + +

+   + +

+ + + {S_FORM_TOKEN} +
+
+ + + +
+ +
+ {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + +
{L_FILENAME}{L_POSTED}{L_FILESIZE}{L_MARK}
+ {L_EXTENSION_GROUP}{L_COLON} {attachments.EXT_GROUP_NAME}{L_NO_EXT_GROUP}
{attachments.L_DOWNLOAD_COUNT}
{L_IN} {L_PRIVATE_MESSAGE} + {attachments.REAL_FILENAME}
{attachments.COMMENT}
{attachments.L_DOWNLOAD_COUNT}
{L_TOPIC}{L_COLON} {attachments.TOPIC_TITLE} +
{attachments.FILETIME}
{L_POST_BY_AUTHOR} {attachments.ATTACHMENT_POSTER}
{attachments.FILESIZE}
+ +
+

{L_NO_ATTACHMENTS}

+
+ + + + + + +
+ {L_DISPLAY_LOG}{L_COLON}  {S_LIMIT_DAYS} {L_SORT_BY}{L_COLON} {S_SORT_KEY} {S_SORT_DIR} + +
+ +
+ + +
+
+

+ {L_MARK_ALL} • + {L_UNMARK_ALL} +

+
+ + {S_FORM_TOKEN} +
+
+ + +
+ {L_RESYNC_STATS} +
+
+

{L_RESYNC_FILES_STATS_EXPLAIN}
+
+
+
+
+ + + + diff --git a/install/update/old/adm/style/acp_avatar_options_upload.html b/install/update/old/adm/style/acp_avatar_options_upload.html new file mode 100644 index 0000000..63a734e --- /dev/null +++ b/install/update/old/adm/style/acp_avatar_options_upload.html @@ -0,0 +1,11 @@ +
+
+
+
+ + +
+

{L_UPLOAD_AVATAR_URL_EXPLAIN}
+
+
+ diff --git a/install/update/old/adm/style/acp_ban.html b/install/update/old/adm/style/acp_ban.html new file mode 100644 index 0000000..f224994 --- /dev/null +++ b/install/update/old/adm/style/acp_ban.html @@ -0,0 +1,131 @@ + + + + +

{L_ACP_BAN_EXPLAIN}

+ +

{L_TITLE}

+ +

{L_EXPLAIN}

+ + + +
+ +
+ {L_TITLE} +
+
+
+
[ {L_FIND_USERNAME} ]
+
+
+
+
+ +
+
+

{L_BAN_EXCLUDE_EXPLAIN}
+
+
+
+
+
+
+
+
+
+
+
+ +

+   + +

+{S_FORM_TOKEN} +
+
+ +

+ +

{L_UNBAN_TITLE}

+ +

{L_UNBAN_EXPLAIN}

+ +
+ +
+ {L_UNBAN_TITLE} + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +

+   + +

+ {S_FORM_TOKEN} +
+ + + +

{L_NO_BAN_CELL}

+ {S_FORM_TOKEN} + + + + +
+ + diff --git a/install/update/old/adm/style/acp_contact.html b/install/update/old/adm/style/acp_contact.html new file mode 100644 index 0000000..828fd4b --- /dev/null +++ b/install/update/old/adm/style/acp_contact.html @@ -0,0 +1,76 @@ + + + + + + +

{L_ACP_CONTACT_SETTINGS}

+ +

{L_ACP_CONTACT_SETTINGS_EXPLAIN}

+ +
+
+ {L_GENERAL_OPTIONS} +
+

{L_CONTACT_US_ENABLE_EXPLAIN}
+
+ + +
+
+
+ + +
+ {L_CONTACT_US_INFO_PREVIEW} +

{CONTACT_US_INFO_PREVIEW}

+
+ + +
+ {L_CONTACT_US_INFO} +

{L_CONTACT_US_INFO_EXPLAIN}

+ + + +
+
+
+ +
+ +
+ +
+ + + + + + + + + +
+
{L_OPTIONS}{L_COLON} {BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {URL_STATUS} :: {SMILIES_STATUS}
+
+
+ +
+   + + {S_FORM_TOKEN} +
+
+ + diff --git a/install/update/old/adm/style/acp_database.html b/install/update/old/adm/style/acp_database.html new file mode 100644 index 0000000..ed0f4dd --- /dev/null +++ b/install/update/old/adm/style/acp_database.html @@ -0,0 +1,96 @@ + + + + + +

{L_ACP_RESTORE}

+ +

{L_ACP_RESTORE_EXPLAIN}

+ + +
+ +
+ {L_RESTORE_OPTIONS} +
+
+
+
+ +

+   +   +

+ {S_FORM_TOKEN} +
+
+ +
+

{L_ACP_NO_ITEMS}

+
+ + + +

{L_ACP_BACKUP}

+ +

{L_ACP_BACKUP_EXPLAIN}

+ + + +
+ +
+ {L_BACKUP_OPTIONS} +
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+
{L_SELECT_ALL} :: {L_DESELECT_ALL}
+
+ +

+   + +

+ {S_FORM_TOKEN} +
+
+ + + + diff --git a/install/update/old/adm/style/acp_ext_list.html b/install/update/old/adm/style/acp_ext_list.html new file mode 100644 index 0000000..8e2c745 --- /dev/null +++ b/install/update/old/adm/style/acp_ext_list.html @@ -0,0 +1,123 @@ + + + + +

{L_EXTENSIONS_ADMIN}

+ +

{L_EXTENSIONS_EXPLAIN}

+ +
+ {L_BROWSE_EXTENSIONS_DATABASE}{L_VERSIONCHECK_FORCE_UPDATE_ALL}{L_SETTINGS} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_EXTENSION_NAME}{L_CURRENT_VERSION}{L_EXTENSION_OPTIONS}{L_EXTENSION_ACTIONS}
{L_EXTENSIONS_ENABLED}
{enabled.META_DISPLAY_NAME} + + {enabled.META_VERSION} + + + {enabled.META_VERSION} + + {L_DETAILS} + + title="{enabled.actions.L_ACTION_EXPLAIN}">{enabled.actions.L_ACTION} +  |  + +
{L_EXTENSIONS_DISABLED}
{disabled.META_DISPLAY_NAME} + + {disabled.META_VERSION} + + + {disabled.META_VERSION} + + + {L_DETAILS} + + + title="{disabled.actions.L_ACTION_EXPLAIN}">{disabled.actions.L_ACTION} +  |  + +
+ + + + + + + + + + + + + + + + + + + + + +
{L_EXTENSION_INSTALL_HEADLINE}
{L_EXTENSION_INSTALL_EXPLAIN}
{L_EXTENSION_UPDATE_HEADLINE}
{L_EXTENSION_UPDATE_EXPLAIN}
{L_EXTENSION_REMOVE_HEADLINE}
{L_EXTENSION_REMOVE_EXPLAIN}
+ + diff --git a/install/update/old/adm/style/acp_forums.html b/install/update/old/adm/style/acp_forums.html new file mode 100644 index 0000000..965438f --- /dev/null +++ b/install/update/old/adm/style/acp_forums.html @@ -0,0 +1,519 @@ + + + + + + + + + « {L_BACK} + +

{L_TITLE} :: {FORUM_NAME}

+ +

{L_FORUM_EDIT_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + +
+ +
+ {L_FORUM_SETTINGS} + +
+
+
+
+ +
+
+
+
+
+
+
+ + + + +
+
+
+
+ +
+

{L_COPY_PERMISSIONS_EXPLAIN}
+
+
+ +
+
+
+
+
+

{L_FORUM_DESC_EXPLAIN}
+
+
+ +
+
+
+

{L_FORUM_IMAGE_EXPLAIN}
+
+ +
{L_FORUM_IMAGE}
+ +
+
+

{L_FORUM_PASSWORD_EXPLAIN}
+
+
+
+

{L_FORUM_PASSWORD_CONFIRM_EXPLAIN}
+
+
+ +
+

{L_FORUM_PASSWORD_UNSET_EXPLAIN}
+
+
+ +
+
+
+
+ +
+ +
+
+ {L_GENERAL_FORUM_SETTINGS} +
+

{L_DISPLAY_ACTIVE_TOPICS_EXPLAIN}
+
+
+
+
+
+ +
+
+ {L_GENERAL_FORUM_SETTINGS} + +
+
+
+
+
+

{L_LIST_SUBFORUMS_EXPLAIN}
+
+
+
+
+

{L_LIST_INDEX_EXPLAIN}
+
+
+
+
+

{L_ENABLE_POST_REVIEW_EXPLAIN}
+
+
+
+
+

{L_ENABLE_QUICK_REPLY_EXPLAIN}
+
+
+
+
+

{L_ENABLE_INDEXING_EXPLAIN}
+
+
+
+
+
+
+
+
+
+

{L_ENABLE_RECENT_EXPLAIN}
+
+
+
+
+

{L_FORUM_TOPICS_PAGE_EXPLAIN}
+
+
+ +
+ +
+ {L_FORUM_PRUNE_SETTINGS} + +
+

{L_FORUM_AUTO_PRUNE_EXPLAIN}
+
+
+
+
+

{L_AUTO_PRUNE_FREQ_EXPLAIN}
+
{L_DAYS}
+
+
+

{L_AUTO_PRUNE_DAYS_EXPLAIN}
+
{L_DAYS}
+
+
+

{L_AUTO_PRUNE_VIEWED_EXPLAIN}
+
{L_DAYS}
+
+
+

{L_PRUNE_OLD_POLLS_EXPLAIN}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

{L_FORUM_PRUNE_SHADOW_EXPLAIN}
+
+
+
+
+

{L_AUTO_PRUNE_SHADOW_FREQ_EXPLAIN}
+
{L_DAYS}
+
+
+

{L_AUTO_PRUNE_SHADOW_DAYS_EXPLAIN}
+
{L_DAYS}
+
+ +
+
+ + + +
+
+ {L_FORUM_RULES} + +
+

{L_FORUM_RULES_LINK_EXPLAIN}
+
+
+ +
+
+
{FORUM_RULES_PREVIEW}
+
+ +
+

{L_FORUM_RULES_EXPLAIN}
+
+
+ +
+
+ +
+
+ + + +
+ {L_SUBMIT} +   + + {S_FORM_TOKEN} +
+
+ + + + « {L_BACK} + +

{L_FORUM_DELETE}

+ +

{L_FORUM_DELETE_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + +
+ +
+ {L_FORUM_DELETE} +
+
+
{FORUM_NAME}
+
+ +
+
+
+ +
+ +
+ + +
+
+
+ +
+ +
+ + +

+ +

+ {S_FORM_TOKEN} +
+
+ + + + + +

{L_FORUM_ADMIN}

+ +

{L_FORUM_ADMIN_EXPLAIN}

+ +

{L_PROGRESS_EXPLAIN}

+ + + + + +

{L_FORUM_ADMIN}

+ +

{L_FORUM_ADMIN_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + + + + +
+

{L_NOTIFY}

+

{L_FORUM_RESYNCED}

+
+ + +

{NAVIGATION} [{L_EDIT} | {L_DELETE} | {L_RESYNC}]

+ + + + + + + + + + + + + +
{forums.FOLDER_IMAGE} +
{forums.FORUM_IMAGE}
+ {forums.FORUM_NAME}{forums.FORUM_NAME} +
{forums.FORUM_DESCRIPTION} +

{L_TOPICS}{L_COLON} {forums.FORUM_TOPICS} / {L_POSTS}{L_COLON} {forums.FORUM_POSTS} +
+ + {ICON_MOVE_UP} + + {ICON_MOVE_DOWN} + {ICON_EDIT} + + {ICON_SYNC} + + {ICON_SYNC_DISABLED} + + {ICON_DELETE} +
+ + +
+ +
+ {L_SELECT_FORUM}{L_COLON} + + + {S_FORM_TOKEN} +
+
+ +
+ +
+ + + + + {S_FORM_TOKEN} +
+
+ + + + diff --git a/install/update/old/adm/style/acp_groups.html b/install/update/old/adm/style/acp_groups.html new file mode 100644 index 0000000..d009637 --- /dev/null +++ b/install/update/old/adm/style/acp_groups.html @@ -0,0 +1,333 @@ + + + + + + + « {L_BACK} + +

{L_ACP_GROUPS_MANAGE}

+ +

{L_GROUP_EDIT_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + +
+ +
+ {L_GROUP_DETAILS} +
+
for="group_name">{L_GROUP_NAME}{L_COLON}
+
{GROUP_NAME}
+
+
+
+
+
+ +
+
+ +
+

{L_GROUP_TYPE_EXPLAIN}
+
+ + + + +
+
+ + + + + +
+

{L_COPY_PERMISSIONS_EXPLAIN}
+
+
+ +
+ +
+ {L_GROUP_OPTIONS_SAVE} + + +
+

{L_GROUP_FOUNDER_MANAGE_EXPLAIN}
+
+
+ +
+

{L_GROUP_SKIP_AUTH_EXPLAIN}
+
+
+
+
+
+
+
+
+
+
+
+

{L_GROUP_RECEIVE_PM_EXPLAIN}
+
+
+ +
+ +
+ {L_GROUP_SETTINGS_SAVE} +
+

{L_GROUP_MESSAGE_LIMIT_EXPLAIN}
+
+
+
+

{L_GROUP_MAX_RECIPIENTS_EXPLAIN}
+
+
+
+

{L_GROUP_COLOR_EXPLAIN}
+
+ +        + [ {L_COLOUR_SWATCH} ] + +
+
+
+
+
+
+
+ +
+ {L_GROUP_AVATAR} +
+

{L_AVATAR_EXPLAIN}
+
{AVATAR}
+
+
+
+
+
+
+
+ +
+

{avatar_drivers.L_EXPLAIN}

+ {avatar_drivers.OUTPUT} +
+ +
+
+ +
+ {L_SUBMIT} +   + + {S_FORM_TOKEN} +
+
+ + + + « {L_BACK} + +

{L_GROUP_MEMBERS} :: {GROUP_NAME}

+ +

{L_GROUP_MEMBERS_EXPLAIN}

+ +
+ +
+ » {L_MAKE_DEFAULT_FOR_ALL} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_USERNAME}{L_GROUP_DEFAULT}{L_JOINED}{L_POSTS}{L_MARK}
{L_GROUP_LEAD}
{leader.USERNAME}{leader.USERNAME}{L_YES}{L_NO}{leader.JOINED}{leader.USER_POSTS}
{L_GROUPS_NO_MODS}
{L_GROUP_APPROVED}
{L_GROUP_PENDING}
{member.USERNAME}{member.USERNAME}{L_YES}{L_NO}{member.JOINED}{member.USER_POSTS}
{L_GROUPS_NO_MEMBERS}
+ + +
+ + +

{L_MARK_ALL}{L_UNMARK_ALL}

+
+ +

{L_ADD_USERS}

+ +

{L_ADD_USERS_EXPLAIN}

+ +
+ {L_ADD_USERS} +
+
+
+
+
+
+

{L_USER_GROUP_DEFAULT_EXPLAIN}
+
+
+
+
+

{L_USERNAMES_EXPLAIN}
+
+
[ {L_FIND_USERNAME} ]
+
+ +

+ +

+ {S_FORM_TOKEN} +
+
+ + + +

{L_ACP_GROUPS_MANAGE}

+ +

{L_ACP_GROUPS_MANAGE_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + +

{L_USER_DEF_GROUPS}

+ +

{L_USER_DEF_GROUPS_EXPLAIN}

+ +
+ + + + + + + + + + + + + + + + + + + + + + +
{L_GROUP}{L_TOTAL_MEMBERS}{L_PENDING_MEMBERS}{L_OPTIONS}{L_ACTION}
{L_NO_GROUPS_CREATED}
+ + +
+ + {L_CREATE_GROUP}{L_COLON} + + + {S_FORM_TOKEN} +
+
+ +

{L_SPECIAL_GROUPS}

+ +

{L_SPECIAL_GROUPS_EXPLAIN}

+ + + + + + + + + + + + + + + + + + + + + + + + + +
{L_GROUP}{L_TOTAL_MEMBERS}{L_PENDING_MEMBERS}{L_OPTIONS}{L_ACTION}
style="color: #{groups.GROUP_COLOR}">{groups.GROUP_NAME}{groups.TOTAL_MEMBERS}{groups.PENDING_MEMBERS}{L_SETTINGS}{L_MEMBERS}{L_DELETE}{L_DELETE}
+ + + + diff --git a/install/update/old/adm/style/acp_help_phpbb.html b/install/update/old/adm/style/acp_help_phpbb.html new file mode 100644 index 0000000..478ecc1 --- /dev/null +++ b/install/update/old/adm/style/acp_help_phpbb.html @@ -0,0 +1,61 @@ + + + + +

{L_ACP_HELP_PHPBB}

+ +
+
+ +
+

{L_SEND_STATISTICS}

+

{L_EXPLAIN_SEND_STATISTICS}

+
+ +
+
+ +
+ {providers.NAME} + +
+
{providers.values.KEY}
+
{providers.values.VALUE}
+
+ +
+ +
+
+
+
+
+ checked="checked" /> + +
+
{L_SEND_STATISTICS_LONG}
+
+
+ +
+

+ + + +

+ {S_FORM_TOKEN} +
+
+
+
+
+

+ + +

+
+
+ + diff --git a/install/update/old/adm/style/acp_icons.html b/install/update/old/adm/style/acp_icons.html new file mode 100644 index 0000000..5493cbd --- /dev/null +++ b/install/update/old/adm/style/acp_icons.html @@ -0,0 +1,282 @@ + + + + + + + + + « {L_BACK} + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ +
+ {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_CONFIG}
{L_URL}{L_LOCATION}{L_SMILIES_CODE}{L_SMILIES_EMOTION}{L_WIDTH}{L_HEIGHT}{L_ALT_TEXT}{L_DISPLAY_ON_POSTING}{L_ORDER}{L_ADD} ({L_MARK_ALL})
{items.TEXT_ALT}[{items.IMG}] + + + + +
{L_ADD_SMILEY_CODE}
{L_NO_ICONS}
+ +

+   + +

+ {S_FORM_TOKEN} +
+
+ + + + « {L_BACK} + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ +
+ {L_IMPORT} + + +

{L_NO_PAK_OPTIONS}

+ + +
+
+
+
+

{L_CURRENT_EXPLAIN}
+
+ +
+ + +

+ +

+ + {S_FORM_TOKEN} +
+
+ + + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ + +
+

{L_NOTIFY}

+

{NOTICE}

+
+ + +
+ + + +
+ + {L_TITLE} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_TITLE}{L_CODE}{L_EMOTION}{L_OPTIONS}
{L_NOT_DISPLAYED}
{items.ALT_TEXT}{items.CODE}{items.EMOTION} + + {ICON_MOVE_UP} + + {ICON_MOVE_DOWN} + {ICON_EDIT} {ICON_DELETE} +
{L_ACP_NO_ITEMS}
+ +

+     +

+ {S_FORM_TOKEN} +
+
+ + + + diff --git a/install/update/old/adm/style/acp_language.html b/install/update/old/adm/style/acp_language.html new file mode 100644 index 0000000..79fef94 --- /dev/null +++ b/install/update/old/adm/style/acp_language.html @@ -0,0 +1,116 @@ + + + + + + + « {L_BACK} + +

{L_LANGUAGE_PACK_DETAILS}

+ +
+ +
+ {LANG_LOCAL_NAME} +
+
+
+
+
+
+
+
+
+
+
{LANG_ISO}
+
+
+
+
+
+ +

+ +

+ {S_FORM_TOKEN} +
+
+ + +

{L_MISSING_FILES}

+ +
+ {L_MISSING_LANG_FILES} + + » {missing_files.FILE_NAME}
+ +
+ + + +

{L_MISSING_VARS_EXPLAIN}

+ +
+ {L_MISSING_LANG_VARIABLES} + +
+
+ +
{missing_varfile.variable.VAR_NAME}
+ +
+ +
+ + + +

{L_ACP_LANGUAGE_PACKS}

+ +

{L_ACP_LANGUAGE_PACKS_EXPLAIN}

+ +
+ {L_BROWSE_LANGUAGE_PACKS_DATABASE} +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_LANGUAGE_PACK_NAME}{L_LANGUAGE_PACK_LOCALNAME}{L_LANGUAGE_PACK_ISO}{L_LANGUAGE_PACK_USED_BY}{L_OPTIONS}
{L_INSTALLED_LANGUAGE_PACKS}
{lang.ENGLISH_NAME} {lang.TAG}{lang.LOCAL_NAME}{lang.ISO}{lang.USED_BY}{L_DELETE}
{L_UNINSTALLED_LANGUAGE_PACKS}
{notinst.NAME}{notinst.LOCAL_NAME}{notinst.ISO}{L_INSTALL}
+ + + + diff --git a/install/update/old/adm/style/acp_main.html b/install/update/old/adm/style/acp_main.html new file mode 100644 index 0000000..12477a4 --- /dev/null +++ b/install/update/old/adm/style/acp_main.html @@ -0,0 +1,312 @@ + + + + + + +

{L_PERMISSIONS_TRANSFERRED}

+ +

{L_PERMISSIONS_TRANSFERRED_EXPLAIN}

+ + + +

{L_WELCOME_PHPBB}

+ +

{L_ADMIN_INTRO}

+ + +
+

{L_UPDATE_INCOMPLETE} {L_MORE_INFORMATION}

+
+ +
+

{L_VERSIONCHECK_FAIL}

+

{VERSIONCHECK_FAIL_REASON}

+

{L_VERSIONCHECK_FORCE_UPDATE} · {L_MORE_INFORMATION}

+
+ +
+

{L_VERSION_NOT_UP_TO_DATE_TITLE}

+

{L_VERSIONCHECK_FORCE_UPDATE} · {L_MORE_INFORMATION}

+
+ + +
+

{UPGRADE_INSTRUCTIONS}

+
+ + + +
+

{L_WARNING}

+

{L_NO_SEARCH_INDEX}

+
+ + + +
+

{L_WARNING}

+

{L_REMOVE_INSTALL}

+
+ + + + +
+

{L_ERROR_MBSTRING_FUNC_OVERLOAD}

+

{L_ERROR_MBSTRING_FUNC_OVERLOAD_EXPLAIN}

+
+ + + +
+

{L_ERROR_MBSTRING_ENCODING_TRANSLATION}

+

{L_ERROR_MBSTRING_ENCODING_TRANSLATION_EXPLAIN}

+
+ + + +
+

{L_ERROR_MBSTRING_HTTP_INPUT}

+

{L_ERROR_MBSTRING_HTTP_INPUT_EXPLAIN}

+
+ + + +
+

{L_ERROR_MBSTRING_HTTP_OUTPUT}

+

{L_ERROR_MBSTRING_HTTP_OUTPUT_EXPLAIN}

+
+ + + + +
+

{L_WRITABLE_CONFIG}

+
+ + + +
+

{L_PHP_VERSION_OLD}

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_FORUM_STATS}
{L_STATISTIC}{L_VALUE}{L_STATISTIC}{L_VALUE}
{L_NUMBER_POSTS}{L_COLON} {TOTAL_POSTS}{L_POSTS_PER_DAY}{L_COLON} {POSTS_PER_DAY}
{L_NUMBER_TOPICS}{L_COLON} {TOTAL_TOPICS}{L_TOPICS_PER_DAY}{L_COLON} {TOPICS_PER_DAY}
{L_NUMBER_USERS}{L_COLON} {TOTAL_USERS}{L_USERS_PER_DAY}{L_COLON} {USERS_PER_DAY}
{L_NUMBER_FILES}{L_COLON} {TOTAL_FILES}{L_FILES_PER_DAY}{L_COLON} {FILES_PER_DAY}
{L_BOARD_STARTED}{L_COLON} {START_DATE}{L_AVATAR_DIR_SIZE}{L_COLON} {AVATAR_DIR_SIZE}
{L_DATABASE_SIZE}{L_COLON} {DBSIZE}{L_UPLOAD_DIR_SIZE}{L_COLON} {UPLOAD_DIR_SIZE}
{L_DATABASE_SERVER_INFO}{L_COLON} {DATABASE_INFO}{L_GZIP_COMPRESSION}{L_COLON} {GZIP_COMPRESSION}
{L_PHP_VERSION}{L_COLON} {PHP_VERSION_INFO}{L_NUMBER_ORPHAN}{L_COLON} + + {TOTAL_ORPHAN} + + {TOTAL_ORPHAN} + +   
{L_BOARD_VERSION}{L_COLON} + style="color: #228822;" style="color: #BC2A4D;" title="{L_MORE_INFORMATION}">{BOARD_VERSION}{L_VERSIONCHECK_FORCE_UPDATE} ] +   
+ + +
+ {L_STATISTIC_RESYNC_OPTIONS} + +
+
+

 
+
+
+
+ +
+
+

 
+
+
+
+ +
+
+

{L_RESYNC_STATS_EXPLAIN}
+
+
+
+ +
+
+

{L_RESYNC_POSTCOUNTS_EXPLAIN}
+
+
+
+ +
+
+

{L_RESYNC_POST_MARKING_EXPLAIN}
+
+
+
+ + +
+
+

{L_PURGE_SESSIONS_EXPLAIN}
+
+
+
+ + +
+
+

{L_PURGE_CACHE_EXPLAIN}
+
+
+
+ + +
+ + + +

{L_ADMIN_LOG}

+ +

{L_ADMIN_LOG_INDEX_EXPLAIN}

+ + + + + + + + + + + + + + + + + + + + + + +
{L_USERNAME}{L_IP}{L_TIME}{L_ACTION}
{log.USERNAME}{log.IP}{log.DATE}{log.ACTION}
+ + + +

{L_INACTIVE_USERS}

+ +

{L_INACTIVE_USERS_EXPLAIN_INDEX}

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_USERNAME}{L_JOINED}{L_INACTIVE_DATE}{L_LAST_VISIT}{L_INACTIVE_REASON}
+ {inactive.USERNAME_FULL} +
{L_POSTS}{L_COLON} {inactive.POSTS} [{L_SEARCH_USER_POSTS}] +
{inactive.JOINED}{inactive.INACTIVE_DATE}{inactive.LAST_VISIT} + {inactive.REASON} +
{inactive.REMINDED_EXPLAIN} +
{L_NO_INACTIVE_USERS}
+ + + + + diff --git a/install/update/old/adm/style/acp_modules.html b/install/update/old/adm/style/acp_modules.html new file mode 100644 index 0000000..3c97706 --- /dev/null +++ b/install/update/old/adm/style/acp_modules.html @@ -0,0 +1,203 @@ + + + + + + + + + « {L_BACK} + +

{L_TITLE} :: {MODULENAME}

+ +

{L_EDIT_MODULE_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + +
+ +
+ {L_GENERAL_OPTIONS} +
+

+ {L_MODULE_LANGNAME_EXPLAIN}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
style="display: none;"> +
+

{L_MODULE_DISPLAYED_EXPLAIN}
+
+
+
+
+

+ {L_CHOOSE_MODULE_EXPLAIN}
+
+
+
+

+ {L_CHOOSE_MODE_EXPLAIN}
+
+
+
+ +

+ + + +   + +

+ {S_FORM_TOKEN} +
+
+ + + +

{L_ACP_MODULE_MANAGEMENT}

+ +

{L_ACP_MODULE_MANAGEMENT_EXPLAIN}

+ + +
+

{L_WARNING}

+

{ERROR_MSG}

+
+ + + + + + + + +
{NAVIGATION} [{L_EDIT} | {L_DELETE} | {L_DISABLE}{L_ENABLE}]
+ + + + + + + + + + + + + + +
{modules.MODULE_IMAGE}{modules.MODULE_TITLE} [{L_HIDDEN_MODULE}] {L_DISABLE}{L_ENABLE}  + + {ICON_MOVE_UP} + + {ICON_MOVE_DOWN} + {ICON_EDIT} + {ICON_DELETE} +
+ + +
 
+ +
+ +
+ + + + +
+ +
+ +
+ +
+ + + + + +
+ +
+ +
 

+ +
+
+ {L_SELECT_MODULE}{L_COLON} + + +
+
+ + + + diff --git a/install/update/old/adm/style/acp_permission_roles.html b/install/update/old/adm/style/acp_permission_roles.html new file mode 100644 index 0000000..b3137f1 --- /dev/null +++ b/install/update/old/adm/style/acp_permission_roles.html @@ -0,0 +1,191 @@ + + + + + + + + + + + « {L_BACK} + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ » {L_SET_ROLE_PERMISSIONS} + +
+ +
+ {L_ROLE_DETAILS} +
+
+
+
+
+

{L_ROLE_DESCRIPTION_EXPLAIN}
+
+
+ +

+ + {S_FORM_TOKEN} +

+
+ + + +

{L_ROLE_ASSIGNED_TO}

+ + + + + +

+ + + + » {L_BACK_TO_TOP}
+

+ +

+ +

{L_ACL_TYPE}

+ +
+ +
+
+ +
+ +
style="display: none;"> +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
{L_ACL_SETTING}{L_ACL_YES}{L_ACL_NO}{L_ACL_NEVER}
{auth.mask.PERMISSION}
+
+
+ +
+ +
+ +
+ + {S_FORM_TOKEN} +
+
+ + » {L_BACK_TO_TOP}
+
+ + + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ + + + + + + + + + + + + + + + + + +
{L_ROLE_NAME}{L_OPTIONS}
{roles.ROLE_NAME} +
{roles.ROLE_DESCRIPTION} +
{L_VIEW_ASSIGNED_ITEMS}{L_VIEW_ASSIGNED_ITEMS} + + {ICON_MOVE_UP} + + {ICON_MOVE_DOWN} + {ICON_EDIT} + {ICON_DELETE} +
+ +
+ {L_CREATE_ROLE}{L_COLON}
+ {S_FORM_TOKEN} +
+
+ + + + + +

{L_ROLE_ASSIGNED_TO}

+ + + + + + + + diff --git a/install/update/old/adm/style/acp_posting_buttons.html b/install/update/old/adm/style/acp_posting_buttons.html new file mode 100644 index 0000000..c3c42f8 --- /dev/null +++ b/install/update/old/adm/style/acp_posting_buttons.html @@ -0,0 +1,71 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + +
+ diff --git a/install/update/old/adm/style/acp_ranks.html b/install/update/old/adm/style/acp_ranks.html new file mode 100644 index 0000000..e67c9ac --- /dev/null +++ b/install/update/old/adm/style/acp_ranks.html @@ -0,0 +1,107 @@ + + + + + + + « {L_BACK} + + + +

{L_ACP_MANAGE_RANKS}

+ +

{L_ACP_RANKS_EXPLAIN}

+ +
+ +
+ {L_ACP_RANKS} + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
style="display: none;"> +
+
+
+
+
+ + + +

+ + +   + + {S_FORM_TOKEN} +

+
+
+ + + +

{L_ACP_MANAGE_RANKS}

+ +

{L_ACP_RANKS_EXPLAIN}

+ +
+
+ {L_ACP_MANAGE_RANKS} + + + + + + + + + + + + + + + + + + + + + + + + +
{L_RANK_IMAGE}{L_RANK_TITLE}{L_RANK_MINIMUM}{L_ACTION}
{ranks.RANK_TITLE}  -  {ranks.RANK_TITLE}  -  {ranks.MIN_POSTS}{ICON_EDIT} {ICON_DELETE}
+ +

+ + {S_FORM_TOKEN} +

+
+
+ + + + diff --git a/install/update/old/adm/style/acp_search.html b/install/update/old/adm/style/acp_search.html new file mode 100644 index 0000000..f7ad3c5 --- /dev/null +++ b/install/update/old/adm/style/acp_search.html @@ -0,0 +1,159 @@ + + + + + +

{L_ACP_SEARCH_SETTINGS}

+ +

{L_ACP_SEARCH_SETTINGS_EXPLAIN}

+ + + + + + + +

{L_ACP_SEARCH_INDEX}

+ + +

{L_CONTINUE_EXPLAIN}

+ +
+
+ {L_SUBMIT} +   + + {S_FORM_TOKEN} +
+
+ + +

{L_ACP_SEARCH_INDEX_EXPLAIN}

+ + + + + +
+ +
+ + {backend.S_HIDDEN_FIELDS} + + {L_INDEX_STATS}{L_COLON} {backend.L_NAME} ({L_ACTIVE}) + + + + + + + + + + + + + + + + + + + + + + +
{backend.L_NAME} ({L_ACTIVE})
{L_STATISTIC}{L_VALUE}{L_STATISTIC}{L_VALUE}
{backend.data.STATISTIC_1}{L_COLON}{backend.data.VALUE_1}{backend.data.STATISTIC_2}{L_COLON}{backend.data.VALUE_2}
+ + + +

+ + + + + + + +

+ {S_FORM_TOKEN} +
+ +
+ + + + + + + diff --git a/install/update/old/adm/style/acp_styles.html b/install/update/old/adm/style/acp_styles.html new file mode 100644 index 0000000..38bec5a --- /dev/null +++ b/install/update/old/adm/style/acp_styles.html @@ -0,0 +1,176 @@ + + + + + + « {L_BACK} + + + +
+ +
+

{MESSAGE_TITLE}

+

{MESSAGE_TEXT}

+ + + + + {S_HIDDEN_FIELDS} + +
+   + +
+ +
+ +
+ + +

{L_TITLE}

+ +

{L_EXPLAIN}

+ +
+ {L_BROWSE_STYLES_DATABASE} +
+ +
+{S_HIDDEN_FIELDS} +{S_FORM_TOKEN} + + + +
+
+
+
+
+
+
+
{STYLE_PATH}
+
+
+
+
{STYLE_VERSION}
+
+
+
+
{STYLE_COPYRIGHT}
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ +
+ +
+ {L_SUBMIT} +   + + {S_FORM_TOKEN} +
+ + + + + + + + + + + + {STYLES_LIST_EXTRA} + + + + + + + + + + + + + + + + + + {styles_list.EXTRA} + + + + +
{L_STYLE_NAME}{L_STYLE_PHPBB_VERSION}{L_STYLE_USED_BY}{L_ACTIONS} 
+ + + + + {styles_list.STYLE_NAME} +
{styles_list.STYLE_COPYRIGHT}
+ + {styles_list.STYLE_NAME} + + +
{styles_list.COMMENT}
+ + +
{L_STYLE_PATH}{L_COLON} {styles_list.STYLE_PATH_FULL}
+ +
{styles_list.STYLE_PHPBB_VERSION}{styles_list.USERS} + + | + + {styles_list.actions.L_ACTION} + + {styles_list.actions.HTML} + + + + + + +   + + + + +
+ + + +
+ + + +
+ + +
+ + + + diff --git a/install/update/old/adm/style/acp_users_overview.html b/install/update/old/adm/style/acp_users_overview.html new file mode 100644 index 0000000..506101c --- /dev/null +++ b/install/update/old/adm/style/acp_users_overview.html @@ -0,0 +1,169 @@ +
+ +
+ {L_ACP_USER_OVERVIEW} +
+

{L_NAME_CHARS_EXPLAIN}
+
+
[ {L_USE_PERMISSIONS} ]
+
+ +
+
+
{USER_INACTIVE_REASON}
+
+ +
+
+
{USER_REGISTERED}
+
+ +
+
+
{REGISTERED_IP}
+
[ {L_WHOIS} ]
+
+ +
+
+
{USER_LASTACTIVE}
+
+
+
+
+ + + {USER_POSTS} + + {USER_POSTS} + + + + ({L_POSTS_IN_QUEUE}) + + ({L_POSTS_IN_QUEUE}) + +
+
+
+
+
{USER_WARNINGS}
+
+
+

{L_FOUNDER_EXPLAIN}
+
+
+
+
+
+
+
+
+

{L_CHANGE_PASSWORD_EXPLAIN}
+
+
+
+

{L_CONFIRM_PASSWORD_EXPLAIN}
+
+
+ + +

+ + + {S_FORM_TOKEN} +

+ +
+
+ + + + + +
+ +
+ {L_USER_TOOLS} +
+
+
+
+ + +

+ + {S_FORM_TOKEN} +

+ +
+ +
+ + +
+
+ {L_DELETE_USER} +
+

{L_DELETE_USER_EXPLAIN}
+
+ + + + {L_USER_NO_POSTS_TO_DELETE} + +
+
+

+ + + {S_FORM_TOKEN} +

+
+
+ + diff --git a/install/update/old/adm/style/acp_users_prefs.html b/install/update/old/adm/style/acp_users_prefs.html new file mode 100644 index 0000000..484c5b3 --- /dev/null +++ b/install/update/old/adm/style/acp_users_prefs.html @@ -0,0 +1,151 @@ + + +
+ +
+ {L_UCP_PREFS_PERSONAL} + +
+
+
+
+
+
+
+
+
+
+
+

{L_ALLOW_PM_EXPLAIN}
+
+
+
+
+
+
+
+
+
+

{L_NOTIFY_METHOD_EXPLAIN}
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+

{L_BOARD_DATE_FORMAT_EXPLAIN}
+
+
style="display:none;">
+
+ +
+ +
+ {L_UCP_PREFS_POST} + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ +
+ {L_UCP_PREFS_VIEW} + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{S_TOPIC_SORT_DAYS}
+
+
+
+
{S_TOPIC_SORT_KEY}
+
+
+
+
{S_TOPIC_SORT_DIR}
+
+
+
+
{S_POST_SORT_DAYS}
+
+
+
+
{S_POST_SORT_KEY}
+
+
+
+
{S_POST_SORT_DIR}
+
+ +
+ +
+ + {S_FORM_TOKEN} +
+ +
diff --git a/install/update/old/adm/style/acp_users_signature.html b/install/update/old/adm/style/acp_users_signature.html new file mode 100644 index 0000000..c7ec5cc --- /dev/null +++ b/install/update/old/adm/style/acp_users_signature.html @@ -0,0 +1,52 @@ + + +
+ + +
+ {L_ADMIN_SIG_PREVIEW} +

{SIGNATURE_PREVIEW}

+
+ + +
+ {L_SIGNATURE} +

{L_SIGNATURE_EXPLAIN}

+ + + +
+
+
+
+
+ + + + + + + + + +
+
{L_OPTIONS}{L_COLON} {BBCODE_STATUS} :: {IMG_STATUS} :: {FLASH_STATUS} :: {URL_STATUS} :: {SMILIES_STATUS}
+
+
+ +
+   + + {S_FORM_TOKEN} +
+
diff --git a/install/update/old/adm/style/admin.css b/install/update/old/adm/style/admin.css new file mode 100644 index 0000000..7cf6c22 --- /dev/null +++ b/install/update/old/adm/style/admin.css @@ -0,0 +1,2720 @@ +/* phpBB 3.2 Admin Style Sheet + ------------------------------------------------------------------------ + Original author: subBlue ( http://www.subblue.com/ ) + Copyright (c) phpBB Limited + + For full copyright and license information, please see + the docs/CREDITS.txt file. + ------------------------------------------------------------------------ +*/ + +/* General markup styles +---------------------------------------- */ +* { + /* Reset browsers default margin, padding and font sizes */ + margin: 0; + padding: 0; + font-size: 100%; +} + +abbr { + text-decoration: none; +} + +body, div, p, th, td, li, dd { + font-size: x-small; + voice-family: "\"}\""; + voice-family: inherit; + font-size: small; +} + +html>body, html>div, html>p, html>th, html>td, html>li, html>dd { + font-size: small; +} + +html { + color: #536482; + background: #DBD7D1; + /* Always show a scrollbar for short pages - stops the jump when the scrollbar appears. non-ie browsers */ + height: 100%; + margin-bottom: 1px; + word-wrap: break-word; +} + +body { + /* Text-Sizing with ems: http://www.clagnut.com/blog/348/ */ + font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + color: #536482; + background: #DBD7D1; + font-size: 62.5%; /* This sets the default font size to be equivalent to 10px */ + margin: 10px 15px; +} + +code, samp { + font-size: 1.2em; +} + +img { + border: 0; +} + +h1 { + font-family: "Trebuchet MS", Helvetica, sans-serif; + font-size: 1.70em; + font-weight: normal; + color: #333333; +} + +h2, caption { + font-family: "Trebuchet MS", Helvetica, sans-serif; + font-size: 1.40em; + font-weight: normal; + color: #115098; + text-align: left; + margin-top: 25px; +} + +.rtl h2, .rtl caption { + text-align: right; +} + +h3, h4 { + font-family: "Trebuchet MS", Helvetica, sans-serif; + font-size: 1.20em; + text-decoration: none; + line-height: 1.20em; + margin-top: 25px; +} + +p { + margin-bottom: 0.7em; + line-height: 1.40em; + font-size: 0.90em; +} + +ul { + list-style: disc; + margin: 0 0 1em 2em; +} + +.rtl ul { + margin: 0 2em 1em 0; +} + +hr { + border: 0 none; + border-top: 1px dashed #999999; + margin-bottom: 5px; + padding-bottom: 5px; + height: 1px; +} + +.centered-text { + text-align: center; +} + +.search-box { + float: left; +} + +.rtl .search-box { + float: right; +} + +.small { + font-size: 0.85em; +} + +.hidden { + display: none; +} + +@media only screen and (max-width: 800px), only screen and (max-device-width: 800px) +{ + body { + margin: 5px 5px 0; + } +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + html, body { + height: auto; + margin: 0; + padding: 0; + } +} + + +/* General links */ +a:link, a:visited { + color: #105289; + text-decoration: none; +} + +a:hover { + color: #BC2A4D; + text-decoration: underline; +} + +a:active { + color: #368AD2; + text-decoration: none; +} + +.install-body p a { + font-weight: bold; +} + +a#maincontent, a#acl, a#assigned_to { + display: block; +} + +/* List items */ +ul, ol { + list-style-position: inside; + margin-left: 1em; +} + +li { + display: list-item; + list-style-type: inherit; +} + + +/* Main blocks +---------------------------------------- */ +#wrap { + padding: 0 0 15px 0; + min-width: 615px; +} + +#page-header { + text-align: right; + background: url("../images/phpbb_logo.png") top left no-repeat; + height: 54px; + font-size: 0.85em; + margin-bottom: 10px; +} + +.rtl #page-header { + text-align: left; + background: url("../images/phpbb_logo.png") top right no-repeat; +} + +#page-header h1 { + color: #767676; + font-family: "Trebuchet MS",Helvetica,sans-serif; + font-size: 1.70em; + padding-top: 10px; +} + +#page-header p { + font-size: 1.00em; +} + +#page-header p#skip { + display: none; +} + +#page-body { + min-width: 650px; +} + +.copyright { + font-size: 0.75em; + text-align: center; +} + +#content { + padding: 30px 10px 10px; + position: relative; +} + +#content h1 { + color: #115098; + line-height: 1.2em; + margin-bottom: 0; +} + +#main { + float: right; + width: 100%; + margin: 0 0 0 -210px; +} + +.rtl #main { + float: left; + margin: 0 -210px 0 0; +} + +.main { + margin-left: 210px; +} + +.rtl .main { + margin-left: 0; + margin-right: 210px; +} + +#page-body.simple-page-body { + padding: 0; + padding-right: 10px; + min-width: 0; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + #wrap, #page-body, #page-body.simple-page-body { + padding: 0; + min-width: 300px; + } + + #page-header { + margin: 5px; + padding-left: 160px; + height: auto; + min-height: 54px; + overflow: hidden; + } + + .rtl #page-header { + padding-right: 160px; + padding-left: 0; + } + + #page-header h1 { + font-size: 1.2em; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + } + + #page-header fieldset { + margin-top: 5px; + } + + #main, .rtl #main, .main, .rtl .main { + float: none; + width: auto; + margin: 0; + } + + #content { + background: #F3F3F3 url("../images/innerbox_bg.gif") repeat-x top; + padding: 5px; + } + + #page-footer { + padding: 0 5px 5px; + } +} + +@media only screen and (max-width: 400px), only screen and (max-device-width: 400px) +{ + #page-header { + background-size: 76px 26.5px; + padding-left: 80px; + min-height: 30px; + } + + .rtl #page-header { + padding-right: 80px; + } + + #page-header h1 { + padding-top: 0; + font-size: 1.1em; + } +} + + +/* Tabbed menu +----------------------------------------*/ +#tabs { + font-family: Arial, Helvetica, sans-serif; + line-height: normal; + margin: 0 7px; + position: relative; + z-index: 2; +} + +#tabs > ul { + list-style: none; + margin: 0; + padding: 0; +} + +#tabs .tab { + display: inline-block; + float: left; + font-size: 0.85em; + font-weight: bold; + line-height: 14px; +} + +.rtl #tabs .tab { + float: right; +} + +#tabs .tab > a { + background: #D4D6DA; + background: -moz-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #CACBCF), color-stop(100%, #D4D6DA)); + background: -webkit-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: -o-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: -ms-linear-gradient(top, #CACBCF 0%, #D4D6DA 100%); + background: linear-gradient(to bottom, #CACBCF 0%, #D4D6DA 100%); + border: 1px solid #BBB; + border-bottom-width: 0; + border-radius: 5px 5px 0 0; + color: #767676; + display: block; + font-weight: bold; + margin: 1px 1px 2px 0; + padding: 6px 9px 4px; + position: relative; + text-decoration: none; + text-transform: uppercase; + white-space: nowrap; + cursor: pointer; +} + +#tabs .tab > a:hover { + background: #F1F1EE; + border-color: #C0BFBB; + color: #BC2A4D; +} + +#tabs .activetab > a, +#tabs .activetab > a:hover { + background: #DCDEE2; + background: -moz-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #F2F2F2), color-stop(100%, #DCDEE2)); + background: -webkit-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: -o-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: -ms-linear-gradient(top, #F2F2F2 0%, #DCDEE2 100%); + background: linear-gradient(to bottom, #F2F2F2 0%, #DCDEE2 100%); + border-color: #999; + border-bottom: 2px solid #DCDEE2; + box-shadow: 0 1px 1px #FFF inset; + color: #23649F; + margin: 0 1px 0 0; + padding: 7px 10px 4px; +} + +#tabs .activetab > a:hover { + color: #115098; +} + +/* Responsive tabs +----------------------------------------*/ +.responsive-tab { + position: relative; +} + +.responsive-tab > a.responsive-tab-link { + display: block; + font-size: 16px; + position: relative; + width: 16px; + line-height: 14px; + text-decoration: none; + padding-left: 9px !important; + padding-right: 9px !important; +} + +.responsive-tab .responsive-tab-link:before { + content: ''; + position: absolute; + left: 10px; + top: 7px; + height: .125em; + width: 14px; + border-bottom: 0.125em solid #767676; + border-top: 0.375em double #767676; +} + +.responsive-tab .responsive-tab-link:hover:before { + border-color: #BC2A4D; +} + +.responsive-tab.activetab .responsive-tab-link:before { + border-color: #23649F; +} + +.responsive-tab.activetab .responsive-tab-link:hover:before { + border-color: #115098; +} + +#tabs .dropdown, #minitabs .dropdown { + top: 20px; + margin-right: -2px; + font-weight: normal; +} + +#tabs .dropdown-right .dropdown { + margin-left: -2px; +} + +#tabs .dropdown-contents { + list-style: none; + margin: 0; +} + +#tabs .dropdown li { + border-bottom: 1px dotted #DCDCDC; +} + +#tabs .dropdown li:last-child { + border-bottom: none; +} + +#tabs .dropdown a { + display: block; + padding: 4px 8px; + text-align: right; +} + +/* Main Panel +---------------------------------------- */ +#acp { + position: relative; + top: -2px; + margin: 0 0 2px; + padding: 3px 1px; + min-width: 550px; + background: #F3F3F3 url("../images/innerbox_bg.gif") repeat-x top; + border: 1px #999999 solid; + border-radius: 5px; + box-shadow: #FFF 0 0 0 1px inset; +} + +#acp:first-child { + top: 0; +} + +.panel { + background: #F3F3F3 url("../images/innerbox_bg.gif") repeat-x top; + padding: 5px 0; + border-radius: 5px; + overflow: hidden; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + #acp { + min-width: 0; + min-height: 0; + border-radius: 0; + border-width: 1px 0; + background: #fff; + padding: 1px 0; + box-shadow: none; + } +} + +/* Sub-navigation Menu +---------------------------------------- */ + +/* Menu */ +#menu { + float: left; + width: 200px; + font-size: 1.00em; + padding: 0; + border-right: 1px solid #CCCFD3; + position: relative; +} + +.rtl #menu { + float: right; + border: none; + border-left: 1px solid #CCCFD3; +} + +#menu p { + font-size: 0.85em; +} + +#menu ul { + list-style: none; + margin: 0; + padding: 0; + word-wrap: normal; +} + +/* Default list state */ +#menu li, #menu .header { + padding: 0; + margin: 0; + font-size: 0.85em; + font-weight: bold; + display: block; +} + +/* Link styles for the sub-section links */ +#menu li span { + display: block; + padding: 3px 3px 3px 8px; + margin: 1px 0; + text-decoration: none; + font-weight: normal; + color: #138ECB; +} + +.rtl #menu li span { + padding: 3px 8px 3px 3px; +} + +#menu li a:hover, #menu li a:hover span { + text-decoration: none; + background-color: #FFFFFF; + color: #BC2A4D; +} + +#menu li a:active, #menu li a:active span { + color: #F632A0; +} + +#menu li#activemenu a span { + text-decoration: none; + font-weight: bold; + color: #1180B7; + background: transparent url("../images/arrow_right.gif") 0% 50% no-repeat; +} + +.rtl #menu li#activemenu a span { + background: transparent url("../images/arrow_left.gif") 100% 50% no-repeat; +} + +#menu li#activemenu a:hover span, #menu li#activemenu span { + text-decoration: none; + font-weight: bold; + color: #BC2A4D; + background: #FFFFFF url("../images/arrow_right.gif") 1% 50% no-repeat; +} + +.rtl #menu li#activemenu a:hover span, .rtl #menu li#activemenu span { + background: #FFFFFF url("../images/arrow_left.gif") 99% 50% no-repeat; +} + +#menu li a:active, #menu li a:active span, #menu li#activemenu a:active span { + color: #F632A0; +} + +#menu li span.completed { + text-decoration: none; + padding: 3px 3px 3px 12px; + background: url("../images/arrow_down.gif") 1% 50% no-repeat; +} + +.rtl #menu li span.completed { + text-decoration: none; + padding: 3px 12px 3px 3px; + background: url("../images/arrow_down.gif") 99% 50% no-repeat; +} + +#menu .header { + font-family: Tahoma, Helvetica, sans-serif; + display: block; + font-weight: bold; + color: #115098; + border-bottom: 1px solid #327AA5; + padding: 4px 0 2px; + margin-top: 15px; + text-transform: uppercase; + font-size: 0.75em; + text-decoration: none; + cursor: inherit; + outline-style: none; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + #menu, .rtl #menu { + float: none; + width: auto; + border-width: 0; + max-width: 200px; + margin: 0 auto 10px; + } + + #menu p { + text-align: center; + } + + #menu .menu-block.active { + margin: 0 -5px; + padding: 0 5px 3px; + background: rgba(255, 255, 255, .5); + border-radius: 5px; + } + + #menu .menu-block.no-header.active { + padding-top: 3px; + } + + #menu .menu-block .header { + margin-top: 5px; + cursor: pointer; + border-bottom-width: 0; + position: relative; + text-decoration: underline; + } + + #menu .menu-block .header:focus, #menu .menu-block.active .header { + color: #D31141; + text-decoration: none; + } + + #menu .menu-block ul { + display: none; + } + + .nojs #menu .menu-block:hover ul, #menu .menu-block.active ul, #menu .menu-block.no-header ul { + display: block; + } + + #menu .menu-block li:last-child { + border-bottom: 1px solid #327AA5; + } + + #menu .menu-block:last-child li:last-child, #menu .menu-block.active li:last-child { + border-bottom-width: 0; + } + + #menu .menu-block li a span { + border-radius: 2px; + } +} + + +/* Table styles +---------------------------------------- */ + +table { + width: 100%; + border: 1px solid #CCCFD3; + background-color: #FFFFFF; + padding: 1px; +} + +th { + padding: 3px 4px; + color: #FFFFFF; + background: #70AED3 url("../images/gradient2b.gif") bottom left repeat-x; + border-top: 1px solid #6DACD2; + border-bottom: 1px solid #327AA5; + text-align: left; + font-size: 0.75em; + text-transform: uppercase; +} + +td { + text-align: left; + font-size: 0.85em; + padding: 4px; + line-height: 1.20em; +} + +.rtl th, .rtl td { + text-align: right; +} + +.table1 { + border-collapse: separate; + border-spacing: 1px; + clear: both; +} + +dt#color_palette_placeholder table { + margin-right: 5px; + width: 80px; +} + +#color_palette_placeholder td { + padding: 0; +} + +table.type2 { + border: none; + background: none; + padding: 0; +} + +table.type2 th { + background: none; + border-top: none; + text-align: center; + color: #115098; + padding: 2px 0; +} + +table.type2 td { + padding: 0; + font-size: 1em; +} + +table.type2 td.name { + padding: 2px; + vertical-align: middle; +} + +table.type3 { + float: right; + width: 300px; + border: none; + background-color: transparent; + padding: 0; +} + +.rtl table.type3 { + float: left; +} + +table.type3 thead th { + background-color: transparent; + border-top: none; + text-align: center; + color: #115098; + padding: 0 3px; + font-size: 0.85em; + font-weight: normal; + text-transform: none; +} + +table.type3 tbody th { + border-top: none; + text-align: left; + text-transform: none; + padding: 0; + border: none; + font-size: 0.90em; + font-weight: normal; + width: 100%; +} + +.rtl table.type3 tbody th { + text-align: right; +} + +table.type3 td { + text-align: center; + padding: 1px; +} + +th.name { + text-align: left; + width: auto; +} + +.rtl th.name { + text-align: right; +} + +td.name { + text-align: left; + font-weight: bold; +} + +.rtl td.name { + text-align: right; +} + +.entry { + text-align: left; + font-weight: normal; +} + +.rtl .entry { + text-align: right; +} + +.row1 { + background-color: #F9F9F9; +} + +table.zebra-table tbody tr:nth-child(odd) { + background-color: #F9F9F9; +} + +.row2 { + word-break: break-all; + background-color: #DCEBFE; +} + +table.zebra-table tbody tr:nth-child(even) { + background-color: #DCEBFE; +} + +.row3 { background-color: #DBDFE2; } +.row4 { background-color: #E4E8EB; } +.col1 { background-color: #DCEBFE; } +.col2 { background-color: #F9F9F9; } + +/* 4 row background colours for trees */ +.row1a { background-color: #F9F9F9; } +.row1b { background-color: #F6F6F6; } +.row2a { background-color: #E7EEF4; } +.row2b { background-color: #E3EBF2; } + +tr.row-highlight:hover td { background-color: #DBDFE2; } + +.spacer { + background-color: #DBDFE2; + height: 1px; + line-height: 1px; +} + +/* Deactivated row */ +.row-inactive { + color: #999; +} +.row-inactive a, .row-inactive strong { + color: #888; +} +.row-inactive a:hover { + color: #BC2A4D; +} + +/* Specific tables */ +table.forums td.folder { + width: 27px; + text-align: center; +} + +table td.actions { + vertical-align: middle; + width: 100px; + text-align: center; + white-space: nowrap; +} + +table tr:first-child td.actions .up, table tr:last-child td.actions .down { + display: none; +} + +table tr:first-child td.actions .up-disabled, table tr:last-child td.actions .down-disabled { + display: inline !important; +} + +table.styles td.users, table td.mark { + text-align: center; +} + +table.fixed-width-table { + table-layout: fixed; + word-break: break-word; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { + display: block; + } + + table.responsive thead, table.responsive th, table.responsive colgroup { + display: none; + } + + table.responsive.show-header thead, table.responsive.show-header th:first-child, table.responsive caption { + display: block; + width: auto !important; + text-align: left !important; + margin: 0; + } + + table.responsive { + background: transparent none; + border-width: 0; + padding: 0; + } + + table.responsive caption { + padding: 3px 4px; + color: #FFFFFF; + background: #70AED3 url("../images/gradient2b.gif") bottom left repeat-x; + border-top: 1px solid #6DACD2; + border-bottom: 1px solid #327AA5; + text-align: left; + font-size: 0.75em; + font-weight: bold; + text-transform: uppercase; + } + + table.responsive.show-header th:first-child span.rank-img, table.responsive.no-caption caption, table.responsive.no-header thead { + display: none; + } + + table.responsive tr { + margin: 2px 0; + border: 1px solid #CCCFD3; + background-color: #FFFFFF; + padding: 1px 1px 0; + overflow: hidden; + } + + table.responsive tr.row1 td { background-color: #F9F9F9; } + table.responsive tr.row2 td { background-color: #DCEBFE; } + table.responsive tr.row3 td { background-color: #DBDFE2; } + table.responsive tr.row4 td { background-color: #E4E8EB; } + table.responsive tr.col1 td { background-color: #DCEBFE; } + table.responsive tr.col2 td { background-color: #F9F9F9; } + table.responsive tr.row1a td { background-color: #F9F9F9; } + table.responsive tr.row1b td { background-color: #F6F6F6; } + table.responsive tr.row2a td { background-color: #E7EEF4; } + table.responsive tr.row2b td { background-color: #E3EBF2; } + + table.responsive td { + width: auto !important; + text-align: left !important; + padding: 4px; + margin-bottom: 1px; + } + + .rtl table.responsive td { + text-align: right !important; + } + + table.responsive td.empty { + display: none !important; + } + + table.responsive td > dfn { + display: inline-block !important; + } + + table.responsive td > dfn:after { + content: ':'; + padding-right: 5px; + } + + table.responsive.two-columns td { + width: 50% !important; + float: left; + -moz-box-sizing: border-box; + box-sizing: border-box; + } + + .rtl table.responsive.two-columns td { + float: right; + } + + table.responsive.two-columns td:nth-child(2n+1) { + clear: left; + } + + table.responsive span.rank-img { + float: none; + padding-right: 5px; + } + + table.responsive#memberlist td:first-child input[type="checkbox"] { + float: right; + } + + /* Specific tables */ + table.responsive.forums td.folder { + float: left; + width: 27px; + background: transparent; + } + .rtl table.responsive.forums td.folder { + float: right; + } + + table.responsive.forums td.forum-desc { + margin-left: 35px; + min-height: 27px; + background: transparent; + } + + .rtl table.responsive.forums td.forum-desc { + margin-left: 0; + margin-right: 35px; + } + + table.responsive td.actions { + clear: both; + text-align: right !important; + } + + .rtl table.responsive td.actions { + text-align: left !important; + } + + table.responsive.styles tr.responsive-style-row td:first-child { + padding-left: 4px !important; + padding-right: 4px !important; + } + + table.responsive.styles td:first-child > dfn, table.responsive td.actions > dfn { + display: none !important; + } + + .horizontal-palette td:nth-child(2n), .vertical-palette tr:nth-child(2n) { + display: none; + } + + .colour-palette a { + display: inline-block !important; + } +} + +/* General form styles +----------------------------------------*/ +fieldset { + margin: 15px 0; + padding: 10px; + border-top: 1px solid #D7D7D7; + border-right: 1px solid #CCCCCC; + border-bottom: 1px solid #CCCCCC; + border-left: 1px solid #D7D7D7; + background-color: #FFFFFF; + position: relative; + border-radius: 3px; +} + +fieldset h2 { + margin-top: 0; +} + +.rtl fieldset { + border-top: 1px solid #D7D7D7; + border-right: 1px solid #D7D7D7; + border-bottom: 1px solid #CCCCCC; + border-left: 1px solid #CCCCCC; +} + +fieldset p { + font-size: 0.85em; +} + +legend { + padding: 1px 0; + font-family: Tahoma,arial,Verdana,Sans-serif; + font-size: .9em; + font-weight: bold; + color: #115098; + margin-top: -.4em; + position: relative; + text-transform: none; + line-height: 1.2em; + top: -.2em; + vertical-align: middle; +} + +input, textarea { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 0.90em; + font-weight: normal; + vertical-align: middle; + padding: 2px; + color: #111111; + border-left: 1px solid #AFAEAA; + border-top: 1px solid #AFAEAA; + border-right: 1px solid #D5D5C8; + border-bottom: 1px solid #D5D5C8; + background-color: #E3DFD8; +} + +.rtl input, .rtl textarea { + border-left: 1px solid #D5D5C8; + border-top: 1px solid #AFAEAA; + border-right: 1px solid #AFAEAA; + border-bottom: 1px solid #D5D5C8; +} + +input:hover, textarea:hover { + border-left: 1px solid #AFAEAA; + border-top: 1px solid #AFAEAA; + border-right: 1px solid #AFAEAA; + border-bottom: 1px solid #AFAEAA; + background-color: #E9E9E2; +} + +input.langvalue, textarea.langvalue { + width: 90%; +} + +input[type="number"] { + width: 60px; + -moz-padding-end: 0; +} + +optgroup, select { + background-color: #FAFAFA; + border: 1px solid #666666; + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 0.85em; + font-weight: normal; + font-style: normal; + cursor: pointer; + padding: 1px; + vertical-align: middle; + width: auto; + color: #000; +} + +select:focus { + outline-style: none; +} + +optgroup { + font-size: 1.00em; + font-weight: bold; +} + +optgroup.disabled-options { + display: none; + background-color: gray; +} + +option { + padding: 0 1em 0 0; + color: #000; +} + +option.disabled-option { + color: graytext; +} + +.rtl option { + padding: 0 0 0 1em; +} + +.sep { + font-weight: bold; +} + +.username-coloured { + font-weight: bold; +} + +textarea { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 0.85em; + width: 60%; + padding: 2px; +} + +label { + cursor: pointer; + font-size: 0.85em; + padding: 0 5px 0 0; +} + +.rtl label { + padding: 0 0 0 5px; +} + +label input { + font-size: 1.00em; + vertical-align: middle; +} + +label img { + vertical-align: middle; +} + +fieldset.quick, p.quick { + margin: 0 0 5px; + padding: 5px 0 0; + border: none; + background-color: transparent; + text-align: right; +} + +.rtl fieldset.quick, .rtl p.quick { + text-align: left; +} + +fieldset.quick legend { + display: none; +} + +fieldset.tabulated { + background: none; + margin: 0; + margin-top: 5px; + padding: 0; + border: 0; +} + +fieldset.tabulated legend { + display: none; +} + +fieldset.nobg { + margin: 15px 0 0 0; + padding: 0; + border: none; + background-color: transparent; +} + +fieldset.display-options { + margin: 15px 0 2px 0; + padding: 0 0 4px 0; + border: none; + background-color: transparent; + text-align: center; + font-size: 0.85em; +} + +fieldset.display-options select, fieldset.display-options input, fieldset.display-options label { + font-size: 1.00em; + vertical-align: middle; +} + +select option.disabled { + background-color: #bbb; + color: #fff; +} + +/* Special case inputs */ +select#board_timezone, +select#full_folder_action { + width: 95%; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + fieldset { + padding: 5px; + } + + fieldset.quick, p.quick { + float: none !important; + text-align: center; + } + + fieldset.display-options { + clear: both; + } +} + +/* Definition list layout for forms + Other general def. list properties defined in prosilver_main.css +---------------------------------------- */ +dl { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 1.00em; +} + +dt { + float: left; + width: auto; +} + +.rtl dt { + float: right; +} + +dd { color: #666666;} +dd + dd { padding-top: 5px;} +dt span { padding: 0 5px 0 0;} +.rtl dt span { padding: 0 0 0 5px;} + +dt .explain { font-style: italic;} + +dt label { + font-size: 1.00em; + text-align: left; + font-weight: bold; + color: #4A5A73; +} + +.rtl dt label { + text-align: right; +} + +dd label { + font-size: 1.00em; + white-space: nowrap; + margin: 0 10px 0 0; + color: #4A5A73; +} + +.rtl dd label { + margin: 0 0 0 10px; +} + +html>body dd label input { vertical-align: text-bottom;} /* Tweak for Moz to align checkboxes/radio buttons nicely */ + +dd input { + font-size: 1.00em; + max-width: 100%; + margin: 2px 0; +} + +dd select { + font-size: 100%; + font-size: 1em; + width: auto; + max-width: 100%; + margin: 2px 0; +} + +dd textarea { + font-size: 0.90em; + width: 90%; +} + +fieldset dl { + margin-bottom: 10px; + font-size: 0.85em; +} + +fieldset dt { + width: 45%; + text-align: left; + border: none; + border-right: 1px solid #CCCCCC; + padding-top: 3px; +} + +.rtl fieldset dt { + text-align: right; + border: none; + border-left: 1px solid #CCCCCC; +} + +fieldset #color_palette_placeholder { + padding-top: 0; +} + +fieldset dd { + margin: 0 0 0 45%; + padding: 0 0 0 5px; + border: none; + border-left: 1px solid #CCCCCC; + vertical-align: top; + font-size: 1.00em; +} + +.rtl fieldset dd { + margin: 0 45% 0 0; + padding: 0 5px 0 0; + border: none; + border-right: 1px solid #CCCCCC; +} + +dd.full, .rtl dd.full { + margin: 0; + border: 0; + padding: 0; + padding-top: 3px; + text-align: center; + width: 95%; +} + +/* Hover highlights for form rows */ +fieldset dl:hover dt, fieldset dl:hover dd { + border-color: #666666; +} + +fieldset dl:hover dt label { + color: #000000; +} + +fieldset dl dd label:hover { + color: #BC2A4D; +} + +input:focus, textarea:focus { + border: 1px solid #BC2A4D; + background-color: #E9E9E2; + color: #BC2A4D; + outline-style: none; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + fieldset dl { + margin-bottom: 5px; + padding-bottom: 5px; + border-bottom: 1px solid #e8e8e8; + } + + fieldset > dl:last-child, fieldset > form:last-child > dl:last-child { + border-bottom-width: 0; + margin-bottom: 0; + } + + fieldset dt, .rtl fieldset dt, fieldset dd, .rtl fieldset dd { + border-width: 0; + margin-left: 0; + margin-right: 0; + float: none; + width: auto; + } + + fieldset .responsive-columns dt { + float: left; + } + + .ltr fieldset dd { + padding-left: 20px; + } + + .rtl fieldset dd { + padding-right: 20px; + } + + select, dd select, dd input { + max-width: 300px; + } + + input[type="number"], dd input[type="number"] { + max-width: 70px; + } +} + +@media only screen and (max-width: 400px), only screen and (max-device-width: 400px) +{ + select, dd select, dd input { + max-width: 240px; + } +} + +/* Submit button fieldset or paragraph +---------------------------------------- */ +fieldset.submit-buttons { + text-align: center; + border: none; + background-color: transparent; + margin: 0; + padding: 4px; + margin-top: -1px; +} + +p.submit-buttons { + text-align: center; + margin: 0; + padding: 4px; + margin-top: 10px; +} + +fieldset.submit-buttons input, p.submit-buttons input { + padding: 3px 2px; +} + +fieldset.submit-buttons legend { + display: none; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + p.submit-buttons { + margin-top: 0; + } +} + +/* Input field styles +---------------------------------------- */ + +input.radio, input.checkbox, input.permissions-checkbox { + width: auto !important; + background-color: transparent; + border: none; + cursor: pointer; +} + +input.full, +textarea.full { + width: 99%; +} + +input.medium { width: 50%;} +input.narrow { width: 25%;} +input.tiny { width: 10%;} +input.autowidth { width: auto !important;} +.box2 .inputbox { background-color: #E9E9E9;} + +/* Form button styles +---------------------------------------- */ +a.button1, input.button1, +a.button2, input.button2 { + width: auto !important; + padding: 1px 3px 0 3px; + font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + color: #000; + font-size: 0.85em; + background: #EFEFEF url("../images/bg_button.gif") repeat-x top; + cursor: pointer; +} + +a.button1, input.button1 { + font-weight: bold; + border: 1px solid #666666; +} + +/* Alternative button */ +a.button2, input.button2 { + border: 1px solid #666666; +} + +/* button in the style of the form buttons */ +a.button1, a.button1:link, a.button1:visited, a.button1:active, +a.button2, a.button2:link, a.button2:visited, a.button2:active { + text-decoration: none; + color: #000000; + padding: 4px 8px; +} + +/* Hover states */ +a.button1:hover, input.button1:hover, +a.button2:hover, input.button2:hover { + border: 1px solid #BC2A4D; + background: #EFEFEF url("../images/bg_button.gif") repeat bottom; + color: #BC2A4D; +} + +input.disabled { + font-weight: normal; + color: #666666; +} + +/* Focus states */ +input.button1:focus, input.button2:focus { + outline-style: none; +} + +/* jQuery popups +---------------------------------------- */ +.phpbb_alert { + background-color: #FFFFFF; + border: 1px solid #999999; + position: fixed; + display: none; + top: 150px; + left: 0; + right: 0; + width: 620px; + margin: 0 auto; + z-index: 50; + padding: 25px; + padding: 0 25px 20px 25px; +} + +.phpbb_alert .alert_close { + display: block; + float: right; + width: 16px; + height: 16px; + overflow: hidden; + text-decoration: none !important; + background: transparent url("../images/alert_close.png") 0 0 no-repeat; + margin-top: -7px; + margin-right: -31px; +} +.phpbb_alert .alert_close:hover { + background-position: 0 -16px; +} + + +.phpbb_alert p { + margin: 8px 0; + padding-bottom: 8px; +} + +.phpbb_alert label { + display: block; + margin: 8px 0; + padding-bottom: 8px; +} + +.phpbb_alert div.alert_text > p, +.phpbb_alert div.alert_text > label, +.phpbb_alert div.alert_text > select, +.phpbb_alert div.alert_text > textarea, +.phpbb_alert div.alert_text > input { + font-size: 0.9em; +} + +#darkenwrapper { + display: none; + position: relative; + z-index: 44; +} + +#darken { + position: fixed; + left: 0; + top: 0; + width: 100%; + height: 100%; + background-color: #000000; + opacity: 0.5; + z-index: 45; +} + +@media only screen and (max-height: 500px), only screen and (max-device-width: 500px) +{ + .phpbb_alert { + top: 25px; + } +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + .phpbb_alert { + width: auto; + margin: 0 25px; + } +} + +#loading_indicator { + background: #000000 url("../images/loading.gif") center center no-repeat; + border-radius: 5px; + display: none; + opacity: 0.8; + margin-top: -50px; + margin-left: -50px; + height: 50px; + width: 50px; + position: fixed; + left: 50%; + top: 50%; + z-index: 51; +} + +/* Pagination +---------------------------------------- */ +.pagination { + font-size: .85em; + height: 1%; /* IE tweak (holly hack) */ + width: auto; + text-align: right; + margin: 5px 0; +} + +.top-pagination { + float: right; + margin: 15px 0 5px 0; +} + +.rtl .pagination { + text-align: left; + float: left; +} + +li.pagination { + margin-top: 0; +} + +.pagination img { + vertical-align: middle; +} + +.pagination ul { + display: inline-block; + *display: inline; /* IE7 inline-block hack */ + *zoom: 1; + margin-left: 0; + margin-bottom: 0; +} + +li.pagination ul { + margin-top: -2px; + vertical-align: middle; +} + +.pagination ul li, dl .pagination ul li, dl.icon .pagination ul li { + display: inline; + padding: 0; + font-size: 100%; + line-height: normal; +} + +.pagination li a, .pagnation li span, li .pagination li a, li .pagnation li span, .pagination li.active span, .pagination li.ellipsis span { + font-weight: normal; + text-decoration: none; + padding: 0 2px; + border: 1px solid transparent; + font-size: 0.9em; + line-height: 1.5em; +} + +.pagination li a, .pagination li a:link, .pagination li a:visited { + color: #5C758C; + background-color: #ECEDEE; + border-color: #B4BAC0; +} + +.pagination li.ellipsis span { + background-color: transparent; + color: #000000; +} + +.pagination li.active span { + color: #FFFFFF; + background-color: #4692BF; + border-color: #4692BF; +} + +.pagination li a:hover, .pagination .active a:hover { + color: #FFFFFF; + background-color: #368AD2; + border-color: #368AD2; +} + +.pagination li a:active, .pagination li.active a:active { + color: #5C758C; + background-color: #ECEDEE; + border-color: #B4BAC0; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + .pagination, .rtl .pagination { + float: none; + text-align: center; + margin: 5px 0; + } + + .pagination li a, .pagination li span { + display: inline-block; + min-width: 10px; + } +} + +/* Action Highlighting +---------------------------------------- */ +.successbox, .errorbox, .warningbox { + padding: 8px; + margin: 10px 0; + color: #FFFFFF; + text-align: center; + clear: both; +} + +.success { + color: #228822; +} + +.error { + color: #BC2A4D; +} + +.successbox { + background-color: #228822; +} + +.errorbox { + background-color: #BC2A4D; +} + +.warningbox { + background-color: #fca600; +} + +.successbox h3, .errorbox h3 { + color: #FFFFFF; + margin: 0 0 0.5em; + font-size: 1.10em; + font-family: "Lucida Grande",Verdana,Helvetica,Arial,sans-serif; +} + +.successbox p, .errorbox p { + color: #FFFFFF; + font-size: 0.85em; + margin-bottom: 0; +} + +.errorbox a:link, .errorbox a:active, .errorbox a:visited, +.successbox a:link, .successbox a:active, .successbox a:visited { + color: #DBD7D1; + text-decoration: underline; + font-weight: bold; +} + +.errorbox a:hover, .successbox a:hover { + color: #FFFFFF; + text-decoration: none; + font-weight: bold; +} + +#log-container { + display: none; + max-height: 300px; + padding: 8px; + margin: 10px 0; + clear: both; + overflow-y: auto; + background-color: #FFFFFF; +} + +#log-container.show_log_container { + display: block; + border: 1px solid #DBD7D1; +} + +.log { + font-size: 0.8em; +} + +.notice { + background-color: #62A5CC; +} + +.download-box { + margin: 10px 0 10px 0; +} + +/* Special cases for the error page */ +#errorpage #page-header a { + font-weight: bold; + line-height: 6em; +} + +#errorpage #content { + padding-top: 10px; +} + +#errorpage #content h1 { + color: #DF075C; +} + +#errorpage #content h2 { + margin-top: 20px; + margin-bottom: 5px; + border-bottom: 1px solid #CCCCCC; + padding-bottom: 5px; + color: #333333; +} + +/* Tooltip for permission roles */ +.tooltip { + width: 200px; + color: #000; + text-align: center; + border: 1px solid #AAA; +} + +.tooltip span.top { + background: #EFEFEF; + font-weight: bold; + padding: 2px; +} + +.tooltip span.bottom { + padding: 5px; + color: #000000; + background: #FFFFFF; +} + +/* + Format Buttons for signature editor +*/ +#format-buttons { + margin: 15px 0 2px 0; +} + +#format-buttons input, #format-buttons select { + vertical-align: middle; +} + +.row, fieldset dl { + overflow: hidden; +} + +/* Syntax Highlighting +---------------------------------------- */ +.sourcenum { + color: gray; + font-family: Monaco, 'Courier New', monospace; + font-size: 1.25em; + font-weight: bold; + line-height: 1.20em; + text-align: right; + padding: 0; +} + +.rtl .sourcenum { + text-align: left; +} + +.source { + font-family: Monaco, 'Courier New', monospace; + font-size: 1.25em; + line-height: 1.20em; + padding: 0; +} + +.syntaxbg { + color: #FFFFFF; +} + +.syntaxcomment { + color: #FF8000; +} + +.syntaxdefault { + color: #0000BB; +} + +.syntaxhtml { + color: #000000; +} + +.syntaxkeyword { + color: #007700; +} + +.syntaxstring { + color: #DD0000; +} + +/* Permission interface +---------------------------------------- */ + +.column1, .column2 { + width: 48%; + float: left; +} + +.ltr .column2, .rtl .column1 { + float: right; +} + +fieldset.permissions legend { + text-transform: none; +} + +fieldset.permissions legend input{ + height: 1.1em; +} + +/* Permission sections */ +fieldset.permissions .permissions-simple { + text-align: left; + padding-top: 3px; +} + +.rtl fieldset.permissions .permissions-simple { + text-align: right; +} + +fieldset.permissions .permissions-advanced { + padding: 10px 0 0 5px; + vertical-align: top; + clear: right; +} + +.rtl fieldset.permissions .permissions-advanced { + padding: 10px 5px 0 0; + clear: left; +} + +fieldset.permissions .permissions-switch { + float: right; +} + +.rtl fieldset.permissions .permissions-switch { + float: left; +} + +fieldset.permissions .padding { +} + +.permissions-switch { + margin-top: -6px; + font-size: .9em; +} + +.permissions-switch a { + text-decoration: underline; +} + +.permissions-reset { + padding-bottom: 10px; +} + +.permissions-reset a { + font-size: .85em; +} + +/* Tabbed menu */ +.permissions-category { + line-height: normal; + margin: 0 0 -1px 7px; + min-width: 570px; + font-size: 0.85em; +} + +.rtl .permissions-category { + margin: 0 7px -1px 0; +} + +.permissions-category ul { + margin: 0; + padding: 0; + list-style: none; +} + +.permissions-category li { + display: inline; + margin: 0; + padding: 0; + font-size: 1em; + font-weight: bold; +} + +.permissions-category a { + float: left; + background: url("../images/bg_tabs_alt1.gif") no-repeat 0% -35px; + margin: 0 1px 0 0; + padding: 0 0 0 6px; + text-decoration: none; + position: relative; +} + +.rtl .permissions-category a { + float: right; +} + +.permissions-category a span.tabbg { + float: left; + display: block; + background: url("../images/bg_tabs_alt2.gif") no-repeat 100% -35px; + padding: 7px 12px 6px 6px; + color: #536482; + white-space: nowrap; +} + +.rtl .permissions-category a span.tabbg { + float: right; +} + +/* Commented Backslash Hack hides rule from IE5-Mac \*/ +.permissions-category a span.tabbg, .rtl .permissions-category a span.tabbg { float: none;} +/* End hack */ + +.permissions-category a:hover span.tabbg { + color: #DD6900; +} + +.permissions-category .activetab a { + background-position: 0 0; +} + +.permissions-category .activetab a span.tabbg { + background-position: 100% 0; + padding-bottom: 7px; + color: #333333; +} + +.permissions-category a:hover { + background-position: 0 -70px; +} + +.permissions-category a:hover span.tabbg { + background-position: 100% -70px; +} + +.permissions-category .activetab a:hover span.tabbg { + color: #333333; + background-position: 100% 0; +} + +.permissions-category .activetab a:hover { + background-position: 0 0; +} + +.permissions-category a span.colour { + border: 1px solid #536482; + display: block; + float: left; + width: 10px; + height: 10px; + margin: 0 5px 0 0; +} + +/* Most browsers will have to live with a left aligned icon in RTL mode, as (currently) only Firefox 3.0 Alpha 3 renders it correctly without destroying it +.rtl .permissions-category a span.colour { + float: right; + margin: 0 0 0 5px; +} +*/ + +.permissions-category .activetab span.colour { + border-color: #333333; +} + +.permissions-category a:hover span.colour { + border-color: #DD6900; +} + +.permissions-category .activetab a:hover span.colour { + border-color: #333333; +} + +/* Permission preset colours */ +.permissions-preset-yes span.colour, +.yes { + background-color: #86F786; +} + +.permissions-preset-custom span.colour { + background-color: #B2BBDD; +} + +.permissions-preset-never span.colour { + background-color: #DD0000; +} + +.permissions-preset-no span.colour, +.never { + background-color: #EFB0B2; +} + +/* Permission panel +---------------------------------------- */ +.permissions-panel { + float: left; + background-color: #CADCEB; + width: 100%; + border-radius: 5px; + overflow: hidden; + padding: 5px 0; +} + +.rtl .permissions-panel { + float: right; +} + +/* Permission table +---------------------------------------- */ +.permissions-panel .tablewrap { + margin: 0 10px; +} + +.permissions-panel table { + width: 100%; +} + +.permissions-panel th { + text-transform: none; +} + +.permissions-panel th.value { + text-align: center; +} + +.permissions-panel th.name { + text-align: left; + width: auto; + text-transform: none; +} + +.rtl .permissions-panel th.name { + text-align: right; +} + +.permissions-panel th.permissions-name { + border: none; + color: #536482; + font-weight: normal; +} + +.permissions-panel th.permissions-name a.trace { + display: inline; +} + +.permissions-panel th.row3 { + background-image: none; + background-color: #D1D7DC; + color: #536482; + border: none; +} + +.permissions-panel th.row4 { + background-image: none; + background-color: #E4E8EB; + color: #536482; + border: none; +} + +.permissions-panel th a:link, .permissions-panel th a:hover, .permissions-panel th a:visited { + display: block; + color: #FFFFFF; + text-decoration: underline; +} + +.permissions-panel td.permissions-yes label:hover { + background-color: #86F786; +} + +.permissions-panel td.permissions-no label:hover { + background-color: #EFB0B2; +} + +.permissions-panel td.permissions-never label:hover { + background-color: #DD0000; +} + +.permissions-panel td { + padding: 0; + text-align: center; + width: 10%; +} + +.permissions-panel td label { + display: block; + margin: 0; + padding: 0; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + .column1, .column2 { + float: none !important; + width: auto; + } + + .permissions-simple { + clear: both; + } + + .permissions-simple td, .permissions-simple dd { + width: auto !important; + margin-left: 0 !important; + margin-right: 0 !important; + } + + .permissions-simple dd { + margin-top: 5px; + } + + .permissions-panel .tablewrap { + margin: 0 5px; + } + + .permissions-category { + min-width: 0; + margin: 0 !important; + } + + .permissions-category a, .permissions-category a span.tabbg { + display: block; + float: none !important; + background: transparent none; + } + + .permissions-category a { + background: #d9e5ee; + margin: 5px 0; + padding: 0 !important; + border-radius: 3px; + text-decoration: underline; + } + + .permissions-category .activetab a { + background-color: #dd6900; + color: #fff; + } + + .permissions-category a span.tabbg { + color: inherit !important; + padding-top: 6px !important; + padding-bottom: 6px !important; + } + + .permissions-category .activetab span.colour { + border-color: #fff; + } +} + +/* Avatars gallery +---------------------------------------- */ +#gallery { + display: block; + margin: 0 -5px; + padding: 0; + overflow: hidden; +} + +#gallery li { + display: block; + float: left; + border: 1px solid #ccc; + border-radius: 2px; + background: #fff; + padding: 5px; + margin: 5px; +} + +#gallery li:hover { + background-color: #eee; +} + +#gallery li label { + display: block; + text-align: center; + padding: 0; +} + +/* Dropdown menu +----------------------------------------*/ +.dropdown { + position: absolute; + left: 0; + top: 22px; + z-index: 2; + border: 1px solid transparent; + border-radius: 5px; + padding: 9px 0 0; +} + +.dropdown-up .dropdown { + top: auto; + bottom: 18px; + padding: 0 0 9px; +} + +.dropdown-left .dropdown { + left: auto; + right: 0; +} + +.dropdown .pointer, .dropdown .pointer-inner { + position: absolute; + width: 0; + height: 0; + border-top-width: 0; + border-bottom: 10px solid transparent; + border-left: 10px dashed transparent; + border-right: 10px dashed transparent; + -webkit-transform: rotate(360deg); /* better anti-aliasing in webkit */ + display: block; +} + +.dropdown-up .pointer, .dropdown-up .pointer-inner { + border-bottom-width: 0; + border-top: 10px solid transparent; +} + +.dropdown .pointer { + right: auto; + left: 10px; + top: 0; + z-index: 3; +} + +.dropdown-up .pointer { + bottom: 0; + top: auto; +} + +.dropdown-left .dropdown .pointer { + left: auto; + right: 10px; +} + +.dropdown .pointer-inner { + top: auto; + bottom: -11px; + left: -10px; +} + +.dropdown-up .pointer-inner { + bottom: auto; + top: -11px; +} + +.dropdown .pointer { + border-color: #B9B9B9 transparent; +} + +.dropdown .pointer-inner { + border-color: #FFF transparent; +} + +.dropdown .dropdown-contents { + z-index: 2; + overflow: hidden; + overflow-y: auto; + background: #fff; + border: 1px solid #b9b9b9; + border-radius: 5px; + padding: 5px; + position: relative; + min-width: 40px; + max-height: 200px; + box-shadow: 1px 3px 5px rgba(0, 0, 0, 0.2); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +.dropdown-up .dropdown-contents { + box-shadow: 1px 0 5px rgba(0, 0, 0, 0.2); +} + +.dropdown li { + float: none; + margin: 0; + white-space: nowrap; + text-align: left; +} + +.rtl .dropdown li { + text-align: right; +} +.wrap .dropdown li, .dropdown.wrap li { + white-space: normal; +} + +.dropdown li:before, .dropdown li:after { + display: none !important; +} + +.roles-options > .dropdown { + left: auto; + top: 3.2em; + width: 250px; +} + +.rtl .roles-options > .dropdown { + right: auto; +} + +.roles-options { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + -o-user-select: none; + user-select: none; + width: 250px; +} + +.roles-options > span { + border: 1px solid #DEDEDE; + border-radius: 3px; + padding: 4px; + width: 250px; + display: none; + background: url('../images/arrow_down.gif') no-repeat 245px .7em; +} + +.rtl .roles-options > span { + background: url('../images/arrow_down.gif') no-repeat 7px .7em; +} + +.roles-options li { + list-style: none; +} + +.roles-highlight { + background-color: #1e90ff; + color: #fff; +} + + +/* Classes for additional tasks +---------------------------------------- */ + +.current-ext { + color: #228822; +} + +.outdated-ext { + color: #BC2A4D; +} + +.phpinfo { + overflow: auto; + width: 99%; + direction: ltr; +} + +.phpinfo td, .phpinfo th, .phpinfo h2, .phpinfo h1 { + text-align: left; +} + +.requirements_not_met { + padding: 5px; + background-color: #BC2A4D; +} + +.requirements_not_met dt label, .requirements_not_met dd p { + color: #FFFFFF; + font-size: 1.4em; +} + +@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) +{ + .responsive-hide { display: none !important; } + .responsive-show { display: block !important; } + .responsive-show-inline { display: inline !important; } + .responsive-show-inline-block { display: inline-block !important; } +} + +.clearfix { + overflow: hidden; +} + +.pagination:after, +#page-header:after, +#page-body:after, +#tabs:after, +#tabs > ul:after, +#tabs li:after, +#acp:after, +#content:after { + content: ''; + clear: both; + display: block; +} + +#progress-bar { + position: relative; + width: 90%; + text-align: center; + height: 25px; + margin: 20px auto; + border: 1px solid #cecece; +} + +#progress-bar #progress-bar-text { + position: absolute; + top: 0; + width: 100%; + color: #000; +} + +#progress-bar #progress-bar-filler { + display: block; + position: relative; + top: 0; + left: 0; + background-color: #3c84ad; + width: 0; + height: 25px; + overflow: hidden; + color: #fff; +} + +#progress-bar p { + line-height: 25px; + font-weight: bold; +} + +.send-stats-row { + margin: 15px 0; +} + +.send-stats-row:before { + display: table; + content: " "; +} + +.send-stats-tile { + position: relative; + padding: 14px; + margin-bottom: 20px; + background-color: #eff0f2; + border-radius: 6px; + box-shadow: rgba(0,0,0,0.3) 1px 1px 5px; +} + +.send-stats-tile h2 { + margin-top: 0; + text-align: center; + padding-bottom: 1em; +} + +.send-stats-tile i { + padding-right: 0.3em; +} + +.icon { + font-family: FontAwesome; + font-style: normal; +} + +.send-stats-data-row { + background: #f9f9f9; + border-radius: 6px; + border: #DEDEDE 1px solid; + padding: 10px; + border-top-width: 0; + border-top-right-radius: 0; + border-top-left-radius: 0; +} + +.send-stats-data-hidden .configlist { + display: none; +} + +.send-stats-data-only-row { + border-radius: 6px !important; + border-bottom-width: 1px !important; +} + +.send-stats-data-hidden { + padding: 0; + border: none; +} + +.send-stats-row > .send-stats-data-row:first-child { + background-color: #d9edf7; + border-bottom-width: 0; + border-top-right-radius: 6px; + border-top-left-radius: 6px; + border-top-width: 1px; + border-bottom-left-radius: 0; + border-bottom-right-radius: 0; +} + +.send-stats-settings dt, .send-stats-settings dd { + min-width: 25px; +} + +.send-stats-settings dd { + line-height: 1.5em; +} + +.send-stats-settings input { + display: none; +} + +.send-stats-settings input[type=checkbox] + label:before { + content: "\f096"; + font-family: FontAwesome; + font-size: 1.5em; +} + +.send-stats-settings input[type=checkbox]:checked + label:before { + content: "\f14a"; + color: #3c763d; +} + +.send-stats-data-row a:hover span { + text-decoration: underline; +} + +.send-stats-data-row a { + text-decoration: none; + cursor: default; +} + +.send-stats-data-row i { + padding-left: 6px; +} + +.configlist { + word-wrap: break-word; + word-break: break-all; +} + +/* stylelint-disable declaration-property-unit-whitelist */ +.emoji { + min-height: 18px; + min-width: 18px; + height: 1em; + width: 1em; +} +/* stylelint-enable declaration-property-unit-whitelist */ diff --git a/install/update/old/adm/style/admin.js b/install/update/old/adm/style/admin.js new file mode 100644 index 0000000..551c78a --- /dev/null +++ b/install/update/old/adm/style/admin.js @@ -0,0 +1,258 @@ +/** +* phpBB3 ACP functions +*/ + +/** +* Parse document block +*/ +function parse_document(container) +{ + var test = document.createElement('div'), + oldBrowser = (typeof test.style.borderRadius == 'undefined'); + + delete test; + + /** + * Navigation + */ + container.find('#menu').each(function() { + var menu = $(this), + blocks = menu.children('.menu-block'); + + if (!blocks.length) { + return; + } + + // Set onclick event + blocks.children('a.header').click(function() { + var parent = $(this).parent(); + if (!parent.hasClass('active')) { + parent.siblings().removeClass('active'); + } + parent.toggleClass('active'); + }); + + // Set active menu + menu.find('#activemenu').parents('.menu-block').addClass('active'); + + // Check if there is active menu + if (!blocks.filter('.active').length) { + blocks.filter(':first').addClass('active'); + } + }); + + /** + * Responsive tables + */ + container.find('table').not('.not-responsive').each(function() { + var $this = $(this), + th = $this.find('thead > tr > th'), + columns = th.length, + headers = [], + totalHeaders = 0, + i, headersLength; + + // Find columns + $this.find('colgroup:first').children().each(function(i) { + var column = $(this); + $this.find('td:nth-child(' + (i + 1) + ')').addClass(column.prop('className')); + }); + + // Styles table + if ($this.hasClass('styles')) { + $this.find('td:first-child[style]').each(function() { + var style = $(this).attr('style'); + if (style.length) { + $(this).parent('tr').attr('style', style.toLowerCase().replace('padding', 'margin')).addClass('responsive-style-row'); + } + }); + } + + // Find each header + if (!$this.data('no-responsive-header')) + { + th.each(function(column) { + var cell = $(this), + colspan = parseInt(cell.attr('colspan')), + dfn = cell.attr('data-dfn'), + text = dfn ? dfn : $.trim(cell.text()); + + if (text == ' ') text = ''; + colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; + + for (i=0; i + $this.addClass('responsive'); + + if (totalHeaders < 2) { + $this.addClass('show-header'); + return; + } + + $this.find('tbody > tr').each(function() { + var row = $(this), + cells = row.children('td'), + column = 0; + + if (cells.length == 1) { + row.addClass('big-column'); + return; + } + + cells.each(function() { + var cell = $(this), + colspan = parseInt(cell.attr('colspan')), + text = $.trim(cell.text()); + + if (headersLength <= column) { + return; + } + + if ((text.length && text !== '-') || cell.children().length) { + if (headers[column] != '') { + cell.prepend('' + headers[column] + ''); + } + } + else { + cell.addClass('empty'); + } + + colspan = isNaN(colspan) || colspan < 1 ? 1 : colspan; + column += colspan; + }); + }); + + // Remove in disabled extensions list + $this.find('tr.ext_disabled > .empty:nth-child(2) + .empty').siblings(':first-child').children('dfn').remove(); + }); + + /** + * Hide empty responsive tables + */ + container.find('table.responsive > tbody').each(function() { + var items = $(this).children('tr'); + if (items.length == 0) + { + $(this).parent('table:first').addClass('responsive-hide'); + } + }); + + /** + * Fieldsets with empty + */ + container.find('fieldset dt > span:last-child').each(function() { + var $this = $(this); + if ($this.html() == ' ') { + $this.addClass('responsive-hide'); + } + + }); + + /** + * Responsive tabs + */ + container.find('#tabs').not('[data-skip-responsive]').each(function() { + var $this = $(this), + $body = $('body'), + ul = $this.children(), + tabs = ul.children().not('[data-skip-responsive]'), + links = tabs.children('a'), + item = ul.append('').find('li.responsive-tab'), + menu = item.find('.dropdown-contents'), + maxHeight = 0, + lastWidth = false, + responsive = false; + + links.each(function() { + var link = $(this); + maxHeight = Math.max(maxHeight, Math.max(link.outerHeight(true), link.parent().outerHeight(true))); + }) + + function check() { + var width = $body.width(), + height = $this.height(); + + if (arguments.length == 0 && (!responsive || width <= lastWidth) && height <= maxHeight) { + return; + } + + tabs.show(); + item.hide(); + + lastWidth = width; + height = $this.height(); + if (height <= maxHeight) { + responsive = false; + if (item.hasClass('dropdown-visible')) { + phpbb.toggleDropdown.call(item.find('a.responsive-tab-link').get(0)); + } + return; + } + + responsive = true; + item.show(); + menu.html(''); + + var availableTabs = tabs.filter(':not(.activetab, .responsive-tab)'), + total = availableTabs.length, + i, tab; + + for (i = total - 1; i >= 0; i --) { + tab = availableTabs.eq(i); + menu.prepend(tab.clone(true).removeClass('tab')); + tab.hide(); + if ($this.height() <= maxHeight) { + menu.find('a').click(function() { check(true); }); + return; + } + } + menu.find('a').click(function() { check(true); }); + } + + phpbb.registerDropdown(item.find('a.responsive-tab-link'), item.find('.dropdown'), {visibleClass: 'activetab', verticalDirection: 'down'}); + + check(true); + $(window).resize(check); + }); +} + +/** +* Run onload functions +*/ +(function($) { + $(document).ready(function() { + // Swap .nojs and .hasjs + $('body.nojs').toggleClass('nojs hasjs'); + + // Focus forms + $('form[data-focus]:first').each(function() { + $('#' + this.getAttribute('data-focus')).focus(); + }); + + parse_document($('body')); + + $('#questionnaire-form').css('display', 'none'); + var $triggerConfiglist = $('#trigger-configlist'); + + $triggerConfiglist.on('click', function () { + var $configlist = $('#configlist'); + $configlist.closest('.send-stats-data-row').toggleClass('send-stats-data-hidden'); + $configlist.closest('.send-stats-row').find('.send-stats-data-row:first-child').toggleClass('send-stats-data-only-row'); + $(this).find('i').toggleClass('fa-angle-down fa-angle-up'); + }); + + $('#configlist').closest('.send-stats-data-row').addClass('send-stats-data-hidden'); + }); +})(jQuery); diff --git a/install/update/old/adm/style/ajax.js b/install/update/old/adm/style/ajax.js new file mode 100644 index 0000000..895bb05 --- /dev/null +++ b/install/update/old/adm/style/ajax.js @@ -0,0 +1,332 @@ +/* global phpbb */ + +(function($) { // Avoid conflicts with other libraries + +'use strict'; + + +phpbb.prepareSendStats = function () { + var $form = $('#acp_help_phpbb'); + var $dark = $('#darkenwrapper'); + var $loadingIndicator; + + $form.on('submit', function (event) { + var $this = $(this), + currentTime = Math.floor(new Date().getTime() / 1000), + statsTime = parseInt($this.find('input[name=help_send_statistics_time]').val(), 10); + + event.preventDefault(); + $this.unbind('submit'); + + // Skip ajax request if form is submitted too early or send stats + // checkbox is not checked + if (!$this.find('input[name=help_send_statistics]').is(':checked') || + statsTime > currentTime) { + $form.find('input[type=submit]').click(); + setTimeout(function () { + $form.find('input[type=submit]').click(); + }, 300); + return; + } + + /** + * Handler for AJAX errors + */ + function errorHandler(jqXHR, textStatus, errorThrown) { + if (typeof console !== 'undefined' && console.log) { + console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown); + } + phpbb.clearLoadingTimeout(); + var errorText = ''; + + if (typeof errorThrown === 'string' && errorThrown.length > 0) { + errorText = errorThrown; + } else { + errorText = $dark.attr('data-ajax-error-text-' + textStatus); + if (typeof errorText !== 'string' || !errorText.length) { + errorText = $dark.attr('data-ajax-error-text'); + } + } + phpbb.alert($dark.attr('data-ajax-error-title'), errorText); + } + + /** + * This is a private function used to handle the callbacks, refreshes + * and alert. It calls the callback, refreshes the page if necessary, and + * displays an alert to the user and removes it after an amount of time. + * + * It cannot be called from outside this function, and is purely here to + * avoid repetition of code. + * + * @param {object} res The object sent back by the server. + */ + function returnHandler(res) { + phpbb.clearLoadingTimeout(); + + // If a confirmation is not required, display an alert and call the + // callbacks. + $dark.fadeOut(phpbb.alertTime); + + if ($loadingIndicator) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + + var $sendStatisticsSuccess = $('', { + type: 'hidden', + name: 'send_statistics_response', + value: res + }); + $sendStatisticsSuccess.appendTo('p.submit-buttons'); + + // Finish actual form submission + $form.find('input[type=submit]').click(); + } + + $loadingIndicator = phpbb.loadingIndicator(); + + $.ajax({ + url: $this.attr('data-ajax-action').replace('&', '&'), + type: 'POST', + data: 'systemdata=' + encodeURIComponent($this.find('input[name=systemdata]').val()), + success: returnHandler, + error: errorHandler, + cache: false + }).always(function() { + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + }); + }); +}; + +/** + * The following callbacks are for reording items. row_down + * is triggered when an item is moved down, and row_up is triggered when + * an item is moved up. It moves the row up or down, and deactivates / + * activates any up / down icons that require it (the ones at the top or bottom). + */ +phpbb.addAjaxCallback('row_down', function(res) { + if (typeof res.success === 'undefined' || !res.success) { + return; + } + + var $firstTr = $(this).parents('tr'), + $secondTr = $firstTr.next(); + + $firstTr.insertAfter($secondTr); +}); + +phpbb.addAjaxCallback('row_up', function(res) { + if (typeof res.success === 'undefined' || !res.success) { + return; + } + + var $secondTr = $(this).parents('tr'), + $firstTr = $secondTr.prev(); + + $secondTr.insertBefore($firstTr); +}); + +/** + * This callback replaces activate links with deactivate links and vice versa. + * It does this by replacing the text, and replacing all instances of "activate" + * in the href with "deactivate", and vice versa. + */ +phpbb.addAjaxCallback('activate_deactivate', function(res) { + var $this = $(this), + newHref = $this.attr('href'); + + $this.text(res.text); + + if (newHref.indexOf('deactivate') !== -1) { + newHref = newHref.replace('deactivate', 'activate'); + } else { + newHref = newHref.replace('activate', 'deactivate'); + } + + $this.attr('href', newHref); +}); + +/** + * 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(res) { + if (res.SUCCESS !== false) { + $(this).parents('tr').remove(); + } +}); + +/** + * Handler for submitting permissions form in chunks + * This call will submit permissions forms in chunks of 5 fieldsets. + */ +function submitPermissions() { + var $form = $('form#set-permissions'), + fieldsetList = $form.find('fieldset[id^=perm]'), + formDataSets = [], + dataSetIndex = 0, + $submitAllButton = $form.find('input[type=submit][name^=action]')[0], + $submitButton = $form.find('input[type=submit][data-clicked=true]')[0]; + + // Set proper start values for handling refresh of page + var permissionSubmitSize = 0, + permissionRequestCount = 0, + forumIds = [], + permissionSubmitFailed = false; + + if ($submitAllButton !== $submitButton) { + fieldsetList = $form.find('fieldset#' + $submitButton.closest('fieldset.permissions').id); + } + + $.each(fieldsetList, function (key, value) { + dataSetIndex = Math.floor(key / 5); + var $fieldset = $('fieldset#' + value.id); + if (key % 5 === 0) { + formDataSets[dataSetIndex] = $fieldset.find('select:visible, input:not([data-name])').serialize(); + } else { + formDataSets[dataSetIndex] += '&' + $fieldset.find('select:visible, input:not([data-name])').serialize(); + } + + // Find proper role value + var roleInput = $fieldset.find('input[name^=role][data-name]'); + if (roleInput.val()) { + formDataSets[dataSetIndex] += '&' + roleInput.attr('name') + '=' + roleInput.val(); + } else { + formDataSets[dataSetIndex] += '&' + roleInput.attr('name') + '=' + + $fieldset.find('select[name="' + roleInput.attr('name') + '"]').val(); + } + }); + + permissionSubmitSize = formDataSets.length; + + // Add each forum ID to forum ID list to preserve selected forums + $.each($form.find('input[type=hidden][name^=forum_id]'), function (key, value) { + if (value.name.match(/^forum_id\[([0-9]+)\]$/)) { + forumIds.push(value.value); + } + }); + + /** + * Handler for submitted permissions form chunk + * + * @param {object} res Object returned by AJAX call + */ + function handlePermissionReturn(res) { + permissionRequestCount++; + var $dark = $('#darkenwrapper'); + + if (res.S_USER_WARNING) { + phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + permissionSubmitFailed = true; + } else if (!permissionSubmitFailed && res.S_USER_NOTICE) { + // Display success message at the end of submitting the form + if (permissionRequestCount >= permissionSubmitSize) { + var $alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + var $alertBoxLink = $alert.find('p.alert_text > a'); + + // Create form to submit instead of normal "Back to previous page" link + if ($alertBoxLink) { + // Remove forum_id[] from URL + $alertBoxLink.attr('href', $alertBoxLink.attr('href').replace(/(&forum_id\[\]=[0-9]+)/g, '')); + var previousPageForm = '
'; + $.each(forumIds, function (key, value) { + previousPageForm += ''; + }); + previousPageForm += '
'; + + $alertBoxLink.on('click', function (e) { + var $previousPageForm = $(previousPageForm); + $('body').append($previousPageForm); + e.preventDefault(); + $previousPageForm.submit(); + }); + } + + // Do not allow closing alert + $dark.off('click'); + $alert.find('.alert_close').hide(); + + if (typeof res.REFRESH_DATA !== 'undefined') { + setTimeout(function () { + // Create forum to submit using POST. This will prevent + // exceeding the maximum length of URLs + var form = '
'; + $.each(forumIds, function (key, value) { + form += ''; + }); + form += '
'; + $form = $(form); + $('body').append($form); + + // Hide the alert even if we refresh the page, in case the user + // presses the back button. + $dark.fadeOut(phpbb.alertTime, function () { + if (typeof $alert !== 'undefined') { + $alert.hide(); + } + }); + + // Submit form + $form.submit(); + }, res.REFRESH_DATA.time * 1000); // Server specifies time in seconds + } + } + } + } + + // Create AJAX request for each form data set + $.each(formDataSets, function (key, formData) { + $.ajax({ + url: $form.action, + type: 'POST', + data: formData + '&' + $submitButton.name + '=' + encodeURIComponent($submitButton.value) + + '&creation_time=' + $form.find('input[type=hidden][name=creation_time]')[0].value + + '&form_token=' + $form.find('input[type=hidden][name=form_token]')[0].value + + '&' + $form.children('input[type=hidden]').serialize() + + '&' + $form.find('input[type=checkbox][name^=inherit]').serialize(), + success: handlePermissionReturn, + error: handlePermissionReturn + }); + }); +} + +$('[data-ajax]').each(function() { + var $this = $(this), + ajax = $this.attr('data-ajax'); + + if (ajax !== 'false') { + var fn = (ajax !== 'true') ? ajax : null; + phpbb.ajaxify({ + selector: this, + refresh: $this.attr('data-refresh') !== undefined, + callback: fn + }); + } +}); + +/** +* Automatically resize textarea +*/ +$(function() { + phpbb.resizeTextArea($('textarea:not(.no-auto-resize)'), {minHeight: 75}); + + var $setPermissionsForm = $('form#set-permissions'); + if ($setPermissionsForm.length) { + $setPermissionsForm.on('submit', function (e) { + submitPermissions(); + e.preventDefault(); + }); + $setPermissionsForm.find('input[type=submit]').click(function() { + $('input[type=submit]', $(this).parents($('form#set-permissions'))).removeAttr('data-clicked'); + $(this).attr('data-clicked', true); + }); + } + + if ($('#acp_help_phpbb')) { + phpbb.prepareSendStats(); + } +}); + + +})(jQuery); // Avoid conflicts with other libraries diff --git a/install/update/old/adm/style/captcha_recaptcha.html b/install/update/old/adm/style/captcha_recaptcha.html new file mode 100644 index 0000000..3f61c76 --- /dev/null +++ b/install/update/old/adm/style/captcha_recaptcha.html @@ -0,0 +1,14 @@ + +
+
+ + + +
+
+
+ +{L_RECAPTCHA_NOT_AVAILABLE} + diff --git a/install/update/old/adm/style/installer_footer.html b/install/update/old/adm/style/installer_footer.html new file mode 100644 index 0000000..fefa8f6 --- /dev/null +++ b/install/update/old/adm/style/installer_footer.html @@ -0,0 +1,30 @@ +
+
+
+
+
+ + +
+ + + + + + + +{$SCRIPTS} + + + diff --git a/install/update/old/adm/style/overall_footer.html b/install/update/old/adm/style/overall_footer.html new file mode 100644 index 0000000..8745286 --- /dev/null +++ b/install/update/old/adm/style/overall_footer.html @@ -0,0 +1,46 @@ +
+
+
+
+
+ + +
+ + + + + + + + +{$SCRIPTS} + + + diff --git a/install/update/old/adm/style/overall_header.html b/install/update/old/adm/style/overall_header.html new file mode 100644 index 0000000..8279ac3 --- /dev/null +++ b/install/update/old/adm/style/overall_header.html @@ -0,0 +1,157 @@ + + + + + + +{META} +{PAGE_TITLE} + + + + + + + + +{$STYLESHEETS} + + + + + + + + + +
+ + +
+
+ +
+ +
+
+ + + +
+ +
+
+ {% if CONTAINER_EXCEPTION !== false %} +
+

{{ lang('CONTAINER_EXCEPTION') }}


+

{{ lang('EXCEPTION') }}{{ lang('COLON') }} {{ CONTAINER_EXCEPTION.getMessage() }}

+
{{ CONTAINER_EXCEPTION.getTraceAsString() }}
+
+ {% endif %} diff --git a/install/update/old/adm/style/permission_forum_copy.html b/install/update/old/adm/style/permission_forum_copy.html new file mode 100644 index 0000000..b1539af --- /dev/null +++ b/install/update/old/adm/style/permission_forum_copy.html @@ -0,0 +1,40 @@ + + + + +

{L_ACP_FORUM_PERMISSIONS_COPY}

+ + {L_ACP_FORUM_PERMISSIONS_COPY_EXPLAIN} + +
+ +
+ {L_LOOK_UP_FORUM} + +
+

{L_COPY_PERMISSIONS_FORUM_FROM_EXPLAIN}
+
+
+
+ +
+ {L_LOOK_UP_FORUM} +

{L_LOOK_UP_FORUMS_EXPLAIN}

+ +
+

{L_COPY_PERMISSIONS_FORUM_TO_EXPLAIN}
+
+
+
+ +
+ {L_SUBMIT} +   + + {S_HIDDEN_FIELDS} + {S_FORM_TOKEN} +
+ +
+ + diff --git a/install/update/old/adm/style/permission_mask.html b/install/update/old/adm/style/permission_mask.html new file mode 100644 index 0000000..c556664 --- /dev/null +++ b/install/update/old/adm/style/permission_mask.html @@ -0,0 +1,150 @@ + + + + + +
+

{p_mask.NAME} [{p_mask.L_ACL_TYPE}]

+ + +
+
+ + + + + + {p_mask.f_mask.PADDING}{p_mask.f_mask.PADDING}{p_mask.f_mask.NAME} + + + +
+
+ {% if p_mask.f_mask.role_options %} +
+ +
+ {% else %} +
{L_NO_ROLE_AVAILABLE}
+ {% endif %} +
+ + + + + +
+ + + diff --git a/install/update/old/adm/style/permissions.js b/install/update/old/adm/style/permissions.js new file mode 100644 index 0000000..9178ada --- /dev/null +++ b/install/update/old/adm/style/permissions.js @@ -0,0 +1,300 @@ +/** +* Hide and show all checkboxes +* status = true (show boxes), false (hide boxes) +*/ +function display_checkboxes(status) { + var form = document.getElementById('set-permissions'); + var cb = document.getElementsByTagName('input'); + var display; + + //show + if (status) { + display = 'inline'; + } + //hide + else { + display = 'none'; + } + + for (var i = 0; i < cb.length; i++ ) { + if (cb[i].className === 'permissions-checkbox') { + cb[i].style.display = display; + } + } +} + +/** +* Change opacity of element +* e = element +* value = 0 (hidden) till 10 (fully visible) +*/ +function set_opacity(e, value) { + e.style.opacity = value/10; + + //IE opacity currently turned off, because of its astronomical stupidity + //e.style.filter = 'alpha(opacity=' + value*10 + ')'; +} + +/** +* Reset the opacity and checkboxes +* block_id = id of the element that needs to be toggled +*/ +function toggle_opacity(block_id) { + var cb = document.getElementById('checkbox' + block_id); + var fs = document.getElementById('perm' + block_id); + + if (cb.checked) { + set_opacity(fs, 5); + } else { + set_opacity(fs, 10); + } +} + +/** +* Reset the opacity and checkboxes +* value = 0 (checked) and 1 (unchecked) +* except_id = id of the element not to hide +*/ +function reset_opacity(status, except_id) { + var perm = document.getElementById('set-permissions'); + var fs = perm.getElementsByTagName('fieldset'); + var opacity = 5; + + if (status) { + opacity = 10; + } + + for (var i = 0; i < fs.length; i++ ) { + if (fs[i].className !== 'quick') { + set_opacity(fs[i], opacity); + } + } + + if (typeof(except_id) !== 'undefined') { + set_opacity(document.getElementById('perm' + except_id), 10); + } + + //reset checkboxes too + marklist('set-permissions', 'inherit', !status); +} + +/** +* Check whether we have a full radiobutton row of true +* index = offset for the row of inputs (0 == first row, 1 == second, 2 == third), +* rb = array of radiobuttons +*/ +function get_radio_status(index, rb) { + for (var i = index; i < rb.length; i = i + 3 ) { + if (rb[i].checked !== true) { + if (i > index) { + //at least one is true, but not all (custom) + return 2; + } + //first one is not true + return 0; + } + } + + // all radiobuttons true + return 1; +} + +/** +* Set tab colours +* id = panel the tab needs to be set for, +* init = initialising on open, +* quick = If no calculation needed, this contains the colour +*/ +function set_colours(id, init, quick) { + var table = document.getElementById('table' + id); + var tab = document.getElementById('tab' + id); + + if (typeof(quick) !== 'undefined') { + tab.className = 'permissions-preset-' + quick + ' activetab'; + return; + } + + var rb = table.getElementsByTagName('input'); + var colour = 'custom'; + + var status = get_radio_status(0, rb); + + if (status === 1) { + colour = 'yes'; + } else if (status === 0) { + // We move on to No + status = get_radio_status(1, rb); + + if (status === 1) { + colour = 'no'; + } else if (status === 0) { + // We move on to Never + status = get_radio_status(2, rb); + + if (status === 1) { + colour = 'never'; + } + } + } + + if (init) { + tab.className = 'permissions-preset-' + colour; + } else { + tab.className = 'permissions-preset-' + colour + ' activetab'; + } +} + +/** +* Initialise advanced tab colours on first load +* block_id = block that is opened +*/ +function init_colours(block_id) { + var block = document.getElementById('advanced' + block_id); + var panels = block.getElementsByTagName('div'); + var tab = document.getElementById('tab' + id); + + for (var i = 0; i < panels.length; i++) { + if (panels[i].className === 'permissions-panel') { + set_colours(panels[i].id.replace(/options/, ''), true); + } + } + + tab.className = tab.className + ' activetab'; +} + +/** +* Show/hide option panels +* value = suffix for ID to show +* adv = we are opening advanced permissions +* view = called from view permissions +*/ +function swap_options(pmask, fmask, cat, adv, view) { + id = pmask + fmask + cat; + active_option = active_pmask + active_fmask + active_cat; + + var old_tab = document.getElementById('tab' + active_option); + var new_tab = document.getElementById('tab' + id); + var adv_block = document.getElementById('advanced' + pmask + fmask); + + if (adv_block.style.display === 'block' && adv === true) { + phpbb.toggleDisplay('advanced' + pmask + fmask, -1); + reset_opacity(1); + display_checkboxes(false); + return; + } + + // no need to set anything if we are clicking on the same tab again + if (new_tab === old_tab && !adv) { + return; + } + + // init colours + if (adv && (pmask + fmask) !== (active_pmask + active_fmask)) { + init_colours(pmask + fmask); + display_checkboxes(true); + reset_opacity(1); + } else if (adv) { + //Checkbox might have been clicked, but we need full visibility + display_checkboxes(true); + reset_opacity(1); + } + + // set active tab + old_tab.className = old_tab.className.replace(/\ activetab/g, ''); + new_tab.className = new_tab.className + ' activetab'; + + if (id === active_option && adv !== true) { + return; + } + + phpbb.toggleDisplay('options' + active_option, -1); + + //hiding and showing the checkbox + if (document.getElementById('checkbox' + active_pmask + active_fmask)) { + phpbb.toggleDisplay('checkbox' + pmask + fmask, -1); + + if ((pmask + fmask) !== (active_pmask + active_fmask)) { + document.getElementById('checkbox' + active_pmask + active_fmask).style.display = 'inline'; + } + } + + if (!view) { + phpbb.toggleDisplay('advanced' + active_pmask + active_fmask, -1); + } + + if (!view) { + phpbb.toggleDisplay('advanced' + pmask + fmask, 1); + } + phpbb.toggleDisplay('options' + id, 1); + + active_pmask = pmask; + active_fmask = fmask; + active_cat = cat; +} + +/** +* Mark all radio buttons in one panel +* id = table ID container, s = status ['y'/'u'/'n'] +*/ +function mark_options(id, s) { + var t = document.getElementById(id); + + if (!t) { + return; + } + + var rb = t.getElementsByTagName('input'); + + for (var r = 0; r < rb.length; r++) { + if (rb[r].id.substr(rb[r].id.length-1) === s) { + rb[r].checked = true; + } + } +} + +function mark_one_option(id, field_name, s) { + var t = document.getElementById(id); + + if (!t) { + return; + } + + var rb = t.getElementsByTagName('input'); + + for (var r = 0; r < rb.length; r++) { + if (rb[r].id.substr(rb[r].id.length-field_name.length-3, field_name.length) === field_name && rb[r].id.substr(rb[r].id.length-1) === s) { + rb[r].checked = true; + } + } +} + +/** +* Reset role dropdown field to Select role... if an option gets changed +*/ +function reset_role(id) { + var t = document.getElementById(id); + + if (!t) { + return; + } + + t.options[0].selected = true; +} + +/** +* Load role and set options accordingly +*/ +function set_role_settings(role_id, target_id) { + settings = role_options[role_id]; + + if (!settings) { + return; + } + + // Mark all options to no (unset) first... + mark_options(target_id, 'u'); + + for (var r in settings) { + mark_one_option(target_id, r, (settings[r] === 1) ? 'y' : 'n'); + } +} diff --git a/install/update/old/adm/style/progress_bar.html b/install/update/old/adm/style/progress_bar.html new file mode 100644 index 0000000..1822675 --- /dev/null +++ b/install/update/old/adm/style/progress_bar.html @@ -0,0 +1,40 @@ + + + + +
+

{L_PROGRESS}

+ {L_PROGRESS} +

{L_PROGRESS_EXPLAIN}

+
+ + + + diff --git a/install/update/old/adm/style/simple_footer.html b/install/update/old/adm/style/simple_footer.html new file mode 100644 index 0000000..08ee0a7 --- /dev/null +++ b/install/update/old/adm/style/simple_footer.html @@ -0,0 +1,27 @@ + +

+
+ + + + + + + + +{$SCRIPTS} + + + diff --git a/install/update/old/adm/style/simple_header.html b/install/update/old/adm/style/simple_header.html new file mode 100644 index 0000000..439645a --- /dev/null +++ b/install/update/old/adm/style/simple_header.html @@ -0,0 +1,96 @@ + + + + + + +{META} +{PAGE_TITLE} + + + + + +{$STYLESHEETS} + + + + + + + +
diff --git a/install/update/old/assets/cookieconsent/cookieconsent.min.css b/install/update/old/assets/cookieconsent/cookieconsent.min.css new file mode 100644 index 0000000..03c69fe --- /dev/null +++ b/install/update/old/assets/cookieconsent/cookieconsent.min.css @@ -0,0 +1,6 @@ +.cc-window{opacity:1;transition:opacity 1s ease}.cc-window.cc-invisible{opacity:0}.cc-animate.cc-revoke{transition:transform 1s ease}.cc-animate.cc-revoke.cc-top{transform:translateY(-2em)}.cc-animate.cc-revoke.cc-bottom{transform:translateY(2em)}.cc-animate.cc-revoke.cc-active.cc-bottom,.cc-animate.cc-revoke.cc-active.cc-top,.cc-revoke:hover{transform:translateY(0)}.cc-grower{max-height:0;overflow:hidden;transition:max-height 1s} +.cc-link,.cc-revoke:hover{text-decoration:underline}.cc-revoke,.cc-window{position:fixed;overflow:hidden;box-sizing:border-box;font-family:Helvetica,Calibri,Arial,sans-serif;font-size:16px;line-height:1.5em;display:-ms-flexbox;display:flex;-ms-flex-wrap:nowrap;flex-wrap:nowrap;z-index:9999}.cc-window.cc-static{position:static}.cc-window.cc-floating{padding:2em;max-width:24em;-ms-flex-direction:column;flex-direction:column}.cc-window.cc-banner{padding:1em 1.8em;width:100%;-ms-flex-direction:row;flex-direction:row}.cc-revoke{padding:.5em}.cc-header{font-size:18px;font-weight:700}.cc-btn,.cc-close,.cc-link,.cc-revoke{cursor:pointer}.cc-link{opacity:.8;display:inline-block;padding:.2em}.cc-link:hover{opacity:1}.cc-link:active,.cc-link:visited{color:initial}.cc-btn{display:block;padding:.4em .8em;font-size:.9em;font-weight:700;border-width:2px;border-style:solid;text-align:center;white-space:nowrap}.cc-banner .cc-btn:last-child{min-width:140px}.cc-highlight .cc-btn:first-child{background-color:transparent;border-color:transparent}.cc-highlight .cc-btn:first-child:focus,.cc-highlight .cc-btn:first-child:hover{background-color:transparent;text-decoration:underline}.cc-close{display:block;position:absolute;top:.5em;right:.5em;font-size:1.6em;opacity:.9;line-height:.75}.cc-close:focus,.cc-close:hover{opacity:1} +.cc-revoke.cc-top{top:0;left:3em;border-bottom-left-radius:.5em;border-bottom-right-radius:.5em}.cc-revoke.cc-bottom{bottom:0;left:3em;border-top-left-radius:.5em;border-top-right-radius:.5em}.cc-revoke.cc-left{left:3em;right:unset}.cc-revoke.cc-right{right:3em;left:unset}.cc-top{top:1em}.cc-left{left:1em}.cc-right{right:1em}.cc-bottom{bottom:1em}.cc-floating>.cc-link{margin-bottom:1em}.cc-floating .cc-message{display:block;margin-bottom:1em}.cc-window.cc-floating .cc-compliance{-ms-flex:1;flex:1}.cc-window.cc-banner{-ms-flex-align:center;align-items:center}.cc-banner.cc-top{left:0;right:0;top:0}.cc-banner.cc-bottom{left:0;right:0;bottom:0}.cc-banner .cc-message{-ms-flex:1;flex:1}.cc-compliance{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-line-pack:justify;align-content:space-between}.cc-compliance>.cc-btn{-ms-flex:1;flex:1}.cc-btn+.cc-btn{margin-left:.5em} +@media print{.cc-revoke,.cc-window{display:none}}@media screen and (max-width:900px){.cc-btn{white-space:normal}}@media screen and (max-width:414px) and (orientation:portrait),screen and (max-width:736px) and (orientation:landscape){.cc-window.cc-top{top:0}.cc-window.cc-bottom{bottom:0}.cc-window.cc-banner,.cc-window.cc-left,.cc-window.cc-right{left:0;right:0}.cc-window.cc-banner{-ms-flex-direction:column;flex-direction:column}.cc-window.cc-banner .cc-compliance{-ms-flex:1;flex:1}.cc-window.cc-floating{max-width:none}.cc-window .cc-message{margin-bottom:1em}.cc-window.cc-banner{-ms-flex-align:unset;align-items:unset}} +.cc-floating.cc-theme-classic{padding:1.2em;border-radius:5px}.cc-floating.cc-type-info.cc-theme-classic .cc-compliance{text-align:center;display:inline;-ms-flex:none;flex:none}.cc-theme-classic .cc-btn{border-radius:5px}.cc-theme-classic .cc-btn:last-child{min-width:140px}.cc-floating.cc-type-info.cc-theme-classic .cc-btn{display:inline-block} +.cc-theme-edgeless.cc-window{padding:0}.cc-floating.cc-theme-edgeless .cc-message{margin:2em 2em 1.5em}.cc-banner.cc-theme-edgeless .cc-btn{margin:0;padding:.8em 1.8em;height:100%}.cc-banner.cc-theme-edgeless .cc-message{margin-left:1em}.cc-floating.cc-theme-edgeless .cc-btn+.cc-btn{margin-left:0} \ No newline at end of file diff --git a/install/update/old/assets/cookieconsent/cookieconsent.min.js b/install/update/old/assets/cookieconsent/cookieconsent.min.js new file mode 100644 index 0000000..8e44bdd --- /dev/null +++ b/install/update/old/assets/cookieconsent/cookieconsent.min.js @@ -0,0 +1 @@ +!function(e){if(!e.hasInitialised){var t={escapeRegExp:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},hasClass:function(e,t){var i=" ";return 1===e.nodeType&&(i+e.className+i).replace(/[\n\t]/g,i).indexOf(i+t+i)>=0},addClass:function(e,t){e.className+=" "+t},removeClass:function(e,t){var i=new RegExp("\\b"+this.escapeRegExp(t)+"\\b");e.className=e.className.replace(i,"")},interpolateString:function(e,t){var i=/{{([a-z][a-z0-9\-_]*)}}/gi;return e.replace(i,function(e){return t(arguments[1])||""})},getCookie:function(e){var t="; "+document.cookie,i=t.split("; "+e+"=");return 2!=i.length?void 0:i.pop().split(";").shift()},setCookie:function(e,t,i,n,o){var s=new Date;s.setDate(s.getDate()+(i||365));var r=[e+"="+t,"expires="+s.toUTCString(),"path="+(o||"/")];n&&r.push("domain="+n),document.cookie=r.join(";")},deepExtend:function(e,t){for(var i in t)t.hasOwnProperty(i)&&(i in e&&this.isPlainObject(e[i])&&this.isPlainObject(t[i])?this.deepExtend(e[i],t[i]):e[i]=t[i]);return e},throttle:function(e,t){var i=!1;return function(){i||(e.apply(this,arguments),i=!0,setTimeout(function(){i=!1},t))}},hash:function(e){var t,i,n,o=0;if(0===e.length)return o;for(t=0,n=e.length;t=128?"#000":"#fff"},getLuminance:function(e){var t=parseInt(this.normaliseHex(e),16),i=38,n=(t>>16)+i,o=(t>>8&255)+i,s=(255&t)+i,r=(16777216+65536*(n<255?n<1?0:n:255)+256*(o<255?o<1?0:o:255)+(s<255?s<1?0:s:255)).toString(16).slice(1);return"#"+r},isMobile:function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},isPlainObject:function(e){return"object"==typeof e&&null!==e&&e.constructor==Object}};e.status={deny:"deny",allow:"allow",dismiss:"dismiss"},e.transitionEnd=function(){var e=document.createElement("div"),t={t:"transitionend",OT:"oTransitionEnd",msT:"MSTransitionEnd",MozT:"transitionend",WebkitT:"webkitTransitionEnd"};for(var i in t)if(t.hasOwnProperty(i)&&"undefined"!=typeof e.style[i+"ransition"])return t[i];return""}(),e.hasTransition=!!e.transitionEnd;var i=Object.keys(e.status).map(t.escapeRegExp);e.customStyles={},e.Popup=function(){function n(){this.initialise.apply(this,arguments)}function o(e){this.openingTimeout=null,t.removeClass(e,"cc-invisible")}function s(t){t.style.display="none",t.removeEventListener(e.transitionEnd,this.afterTransition),this.afterTransition=null}function r(){var t=this.options.onInitialise.bind(this);if(!window.navigator.cookieEnabled)return t(e.status.deny),!0;if(window.CookiesOK||window.navigator.CookiesOK)return t(e.status.allow),!0;var i=Object.keys(e.status),n=this.getStatus(),o=i.indexOf(n)>=0;return o&&t(n),o}function a(){var e=this.options.position.split("-"),t=[];return e.forEach(function(e){t.push("cc-"+e)}),t}function c(){var e=this.options,i="top"==e.position||"bottom"==e.position?"banner":"floating";t.isMobile()&&(i="floating");var n=["cc-"+i,"cc-type-"+e.type,"cc-theme-"+e.theme];e["static"]&&n.push("cc-static"),n.push.apply(n,a.call(this));p.call(this,this.options.palette);return this.customStyleSelector&&n.push(this.customStyleSelector),n}function l(){var e={},i=this.options;i.showLink||(i.elements.link="",i.elements.messagelink=i.elements.message),Object.keys(i.elements).forEach(function(n){e[n]=t.interpolateString(i.elements[n],function(e){var t=i.content[e];return e&&"string"==typeof t&&t.length?t:""})});var n=i.compliance[i.type];n||(n=i.compliance.info),e.compliance=t.interpolateString(n,function(t){return e[t]});var o=i.layouts[i.layout];return o||(o=i.layouts.basic),t.interpolateString(o,function(t){return e[t]})}function u(i){var n=this.options,o=document.createElement("div"),s=n.container&&1===n.container.nodeType?n.container:document.body;o.innerHTML=i;var r=o.children[0];return r.style.display="none",t.hasClass(r,"cc-window")&&e.hasTransition&&t.addClass(r,"cc-invisible"),this.onButtonClick=h.bind(this),r.addEventListener("click",this.onButtonClick),n.autoAttach&&(s.firstChild?s.insertBefore(r,s.firstChild):s.appendChild(r)),r}function h(n){var o=n.target;if(t.hasClass(o,"cc-btn")){var s=o.className.match(new RegExp("\\bcc-("+i.join("|")+")\\b")),r=s&&s[1]||!1;r&&(this.setStatus(r),this.close(!0))}t.hasClass(o,"cc-close")&&(this.setStatus(e.status.dismiss),this.close(!0)),t.hasClass(o,"cc-revoke")&&this.revokeChoice()}function p(e){var i=t.hash(JSON.stringify(e)),n="cc-color-override-"+i,o=t.isPlainObject(e);return this.customStyleSelector=o?n:null,o&&d(i,e,"."+n),o}function d(i,n,o){if(e.customStyles[i])return void++e.customStyles[i].references;var s={},r=n.popup,a=n.button,c=n.highlight;r&&(r.text=r.text?r.text:t.getContrast(r.background),r.link=r.link?r.link:r.text,s[o+".cc-window"]=["color: "+r.text,"background-color: "+r.background],s[o+".cc-revoke"]=["color: "+r.text,"background-color: "+r.background],s[o+" .cc-link,"+o+" .cc-link:active,"+o+" .cc-link:visited"]=["color: "+r.link],a&&(a.text=a.text?a.text:t.getContrast(a.background),a.border=a.border?a.border:"transparent",s[o+" .cc-btn"]=["color: "+a.text,"border-color: "+a.border,"background-color: "+a.background],"transparent"!=a.background&&(s[o+" .cc-btn:hover, "+o+" .cc-btn:focus"]=["background-color: "+v(a.background)]),c?(c.text=c.text?c.text:t.getContrast(c.background),c.border=c.border?c.border:"transparent",s[o+" .cc-highlight .cc-btn:first-child"]=["color: "+c.text,"border-color: "+c.border,"background-color: "+c.background]):s[o+" .cc-highlight .cc-btn:first-child"]=["color: "+r.text]));var l=document.createElement("style");document.head.appendChild(l),e.customStyles[i]={references:1,element:l.sheet};var u=-1;for(var h in s)s.hasOwnProperty(h)&&l.sheet.insertRule(h+"{"+s[h].join(";")+"}",++u)}function v(e){return e=t.normaliseHex(e),"000000"==e?"#222":t.getLuminance(e)}function f(i){if(t.isPlainObject(i)){var n=t.hash(JSON.stringify(i)),o=e.customStyles[n];if(o&&!--o.references){var s=o.element.ownerNode;s&&s.parentNode&&s.parentNode.removeChild(s),e.customStyles[n]=null}}}function m(e,t){for(var i=0,n=e.length;i=0&&(this.dismissTimeout=window.setTimeout(function(){t(e.status.dismiss)},Math.floor(i)));var n=this.options.dismissOnScroll;if("number"==typeof n&&n>=0){var o=function(i){window.pageYOffset>Math.floor(n)&&(t(e.status.dismiss),window.removeEventListener("scroll",o),this.onWindowScroll=null)};this.onWindowScroll=o,window.addEventListener("scroll",o)}}function y(){if("info"!=this.options.type&&(this.options.revokable=!0),t.isMobile()&&(this.options.animateRevokable=!1),this.options.revokable){var e=a.call(this);this.options.animateRevokable&&e.push("cc-animate"),this.customStyleSelector&&e.push(this.customStyleSelector);var i=this.options.revokeBtn.replace("{{classes}}",e.join(" "));this.revokeBtn=u.call(this,i);var n=this.revokeBtn;if(this.options.animateRevokable){var o=t.throttle(function(e){var i=!1,o=20,s=window.innerHeight-20;t.hasClass(n,"cc-top")&&e.clientYs&&(i=!0),i?t.hasClass(n,"cc-active")||t.addClass(n,"cc-active"):t.hasClass(n,"cc-active")&&t.removeClass(n,"cc-active")},200);this.onMouseMove=o,window.addEventListener("mousemove",o)}}}var g={enabled:!0,container:null,cookie:{name:"cookieconsent_status",path:"/",domain:"",expiryDays:365},onPopupOpen:function(){},onPopupClose:function(){},onInitialise:function(e){},onStatusChange:function(e,t){},onRevokeChoice:function(){},content:{header:"Cookies used on the website!",message:"This website uses cookies to ensure you get the best experience on our website.",dismiss:"Got it!",allow:"Allow cookies",deny:"Decline",link:"Learn more",href:"http://cookiesandyou.com",close:"❌"},elements:{header:'{{header}} ',message:'{{message}}',messagelink:'{{message}} {{link}}',dismiss:'{{dismiss}}',allow:'{{allow}}',deny:'{{deny}}',link:'{{link}}',close:'{{close}}'},window:'',revokeBtn:'
Cookie Policy
',compliance:{info:'
{{dismiss}}
',"opt-in":'
{{dismiss}}{{allow}}
',"opt-out":'
{{deny}}{{dismiss}}
'},type:"info",layouts:{basic:"{{messagelink}}{{compliance}}","basic-close":"{{messagelink}}{{compliance}}{{close}}","basic-header":"{{header}}{{message}}{{link}}{{compliance}}"},layout:"basic",position:"bottom",theme:"block","static":!1,palette:null,revokable:!1,animateRevokable:!0,showLink:!0,dismissOnScroll:!1,dismissOnTimeout:!1,autoOpen:!0,autoAttach:!0,whitelistPage:[],blacklistPage:[],overrideHTML:null};return n.prototype.initialise=function(e){this.options&&this.destroy(),t.deepExtend(this.options={},g),t.isPlainObject(e)&&t.deepExtend(this.options,e),r.call(this)&&(this.options.enabled=!1),m(this.options.blacklistPage,location.pathname)&&(this.options.enabled=!1),m(this.options.whitelistPage,location.pathname)&&(this.options.enabled=!0);var i=this.options.window.replace("{{classes}}",c.call(this).join(" ")).replace("{{children}}",l.call(this)),n=this.options.overrideHTML;if("string"==typeof n&&n.length&&(i=n),this.options["static"]){var o=u.call(this,'
'+i+"
");o.style.display="",this.element=o.firstChild,this.element.style.display="none",t.addClass(this.element,"cc-invisible")}else this.element=u.call(this,i);b.call(this),y.call(this),this.options.autoOpen&&this.autoOpen()},n.prototype.destroy=function(){this.onButtonClick&&this.element&&(this.element.removeEventListener("click",this.onButtonClick),this.onButtonClick=null),this.dismissTimeout&&(clearTimeout(this.dismissTimeout),this.dismissTimeout=null),this.onWindowScroll&&(window.removeEventListener("scroll",this.onWindowScroll),this.onWindowScroll=null),this.onMouseMove&&(window.removeEventListener("mousemove",this.onMouseMove),this.onMouseMove=null),this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element),this.element=null,this.revokeBtn&&this.revokeBtn.parentNode&&this.revokeBtn.parentNode.removeChild(this.revokeBtn),this.revokeBtn=null,f(this.options.palette),this.options=null},n.prototype.open=function(t){if(this.element)return this.isOpen()||(e.hasTransition?this.fadeIn():this.element.style.display="",this.options.revokable&&this.toggleRevokeButton(),this.options.onPopupOpen.call(this)),this},n.prototype.close=function(t){if(this.element)return this.isOpen()&&(e.hasTransition?this.fadeOut():this.element.style.display="none",t&&this.options.revokable&&this.toggleRevokeButton(!0),this.options.onPopupClose.call(this)),this},n.prototype.fadeIn=function(){var i=this.element;if(e.hasTransition&&i&&(this.afterTransition&&s.call(this,i),t.hasClass(i,"cc-invisible"))){if(i.style.display="",this.options["static"]){var n=this.element.clientHeight;this.element.parentNode.style.maxHeight=n+"px"}var r=20;this.openingTimeout=setTimeout(o.bind(this,i),r)}},n.prototype.fadeOut=function(){var i=this.element;e.hasTransition&&i&&(this.openingTimeout&&(clearTimeout(this.openingTimeout),o.bind(this,i)),t.hasClass(i,"cc-invisible")||(this.options["static"]&&(this.element.parentNode.style.maxHeight=""),this.afterTransition=s.bind(this,i),i.addEventListener(e.transitionEnd,this.afterTransition),t.addClass(i,"cc-invisible")))},n.prototype.isOpen=function(){return this.element&&""==this.element.style.display&&(!e.hasTransition||!t.hasClass(this.element,"cc-invisible"))},n.prototype.toggleRevokeButton=function(e){this.revokeBtn&&(this.revokeBtn.style.display=e?"":"none")},n.prototype.revokeChoice=function(e){this.options.enabled=!0,this.clearStatus(),this.options.onRevokeChoice.call(this),e||this.autoOpen()},n.prototype.hasAnswered=function(t){return Object.keys(e.status).indexOf(this.getStatus())>=0},n.prototype.hasConsented=function(t){var i=this.getStatus();return i==e.status.allow||i==e.status.dismiss},n.prototype.autoOpen=function(e){!this.hasAnswered()&&this.options.enabled&&this.open()},n.prototype.setStatus=function(i){var n=this.options.cookie,o=t.getCookie(n.name),s=Object.keys(e.status).indexOf(o)>=0;Object.keys(e.status).indexOf(i)>=0?(t.setCookie(n.name,i,n.expiryDays,n.domain,n.path),this.options.onStatusChange.call(this,i,s)):this.clearStatus()},n.prototype.getStatus=function(){return t.getCookie(this.options.cookie.name)},n.prototype.clearStatus=function(){var e=this.options.cookie;t.setCookie(e.name,"",-1,e.domain,e.path)},n}(),e.Location=function(){function e(e){t.deepExtend(this.options={},s),t.isPlainObject(e)&&t.deepExtend(this.options,e),this.currentServiceIndex=-1}function i(e,t,i){var n,o=document.createElement("script");o.type="text/"+(e.type||"javascript"),o.src=e.src||e,o.async=!1,o.onreadystatechange=o.onload=function(){var e=o.readyState;clearTimeout(n),t.done||e&&!/loaded|complete/.test(e)||(t.done=!0,t(),o.onreadystatechange=o.onload=null)},document.body.appendChild(o),n=setTimeout(function(){t.done=!0,t(),o.onreadystatechange=o.onload=null},i)}function n(e,t,i,n,o){var s=new(window.XMLHttpRequest||window.ActiveXObject)("MSXML2.XMLHTTP.3.0");if(s.open(n?"POST":"GET",e,1),s.setRequestHeader("X-Requested-With","XMLHttpRequest"),s.setRequestHeader("Content-type","application/x-www-form-urlencoded"),Array.isArray(o))for(var r=0,a=o.length;r3&&t(s)}),s.send(n)}function o(e){return new Error("Error ["+(e.code||"UNKNOWN")+"]: "+e.error)}var s={timeout:5e3,services:["freegeoip","ipinfo","maxmind"],serviceDefinitions:{freegeoip:function(){return{url:"//freegeoip.net/json/?callback={callback}",isScript:!0,callback:function(e,t){try{var i=JSON.parse(t);return i.error?o(i):{code:i.country_code}}catch(n){return o({error:"Invalid response ("+n+")"})}}}},ipinfo:function(){return{url:"//ipinfo.io",headers:["Accept: application/json"],callback:function(e,t){try{var i=JSON.parse(t);return i.error?o(i):{code:i.country}}catch(n){return o({error:"Invalid response ("+n+")"})}}}},ipinfodb:function(e){return{url:"//api.ipinfodb.com/v3/ip-country/?key={api_key}&format=json&callback={callback}",isScript:!0,callback:function(e,t){try{var i=JSON.parse(t);return"ERROR"==i.statusCode?o({error:i.statusMessage}):{code:i.countryCode}}catch(n){return o({error:"Invalid response ("+n+")"})}}}},maxmind:function(){return{url:"//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js",isScript:!0,callback:function(e){return window.geoip2?void geoip2.country(function(t){try{e({code:t.country.iso_code})}catch(i){e(o(i))}},function(t){e(o(t))}):void e(new Error("Unexpected response format. The downloaded script should have exported `geoip2` to the global scope"))}}}}};return e.prototype.getNextService=function(){var e;do e=this.getServiceByIdx(++this.currentServiceIndex);while(this.currentServiceIndex=0,revokable:t.revokable.indexOf(e)>=0,explicitAction:t.explicitAction.indexOf(e)>=0}},e.prototype.applyLaw=function(e,t){var i=this.get(t);return i.hasLaw||(e.enabled=!1),this.options.regionalLaw&&(i.revokable&&(e.revokable=!0),i.explicitAction&&(e.dismissOnScroll=!1,e.dismissOnTimeout=!1)),e},e}(),e.initialise=function(t,i,n){var o=new e.Law(t.law);i||(i=function(){}),n||(n=function(){}),e.getCountryCode(t,function(n){delete t.law,delete t.location,n.code&&(t=o.applyLaw(t,n.code)),i(new e.Popup(t))},function(i){delete t.law,delete t.location,n(i,new e.Popup(t))})},e.getCountryCode=function(t,i,n){if(t.law&&t.law.countryCode)return void i({code:t.law.countryCode});if(t.location){var o=new e.Location(t.location);return void o.locate(function(e){i(e||{})},n)}i({})},e.utils=t,e.hasInitialised=!0,window.cookieconsent=e}}(window.cookieconsent||{}); \ No newline at end of file diff --git a/install/update/old/assets/javascript/core.js b/install/update/old/assets/javascript/core.js new file mode 100644 index 0000000..5218a8c --- /dev/null +++ b/install/update/old/assets/javascript/core.js @@ -0,0 +1,1684 @@ +/* global bbfontstyle */ + +var phpbb = {}; +phpbb.alertTime = 100; + +(function($) { // Avoid conflicts with other libraries + +'use strict'; + +// define a couple constants for keydown functions. +var keymap = { + TAB: 9, + ENTER: 13, + ESC: 27 +}; + +var $dark = $('#darkenwrapper'); +var $loadingIndicator; +var phpbbAlertTimer = null; + +phpbb.isTouch = (window && typeof window.ontouchstart !== 'undefined'); + +// Add ajax pre-filter to prevent cross-domain script execution +$.ajaxPrefilter(function(s) { + if (s.crossDomain) { + s.contents.script = false; + } +}); + +/** + * Display a loading screen + * + * @returns {object} Returns loadingIndicator. + */ +phpbb.loadingIndicator = function() { + if (!$loadingIndicator) { + $loadingIndicator = $('
', { + 'id': 'loading_indicator', + 'class': 'loading_indicator' + }); + $loadingIndicator.appendTo('#page-footer'); + } + + if (!$loadingIndicator.is(':visible')) { + $loadingIndicator.fadeIn(phpbb.alertTime); + // Wait 60 seconds and display an error if nothing has been returned by then. + phpbb.clearLoadingTimeout(); + phpbbAlertTimer = setTimeout(function() { + phpbb.showTimeoutMessage(); + }, 60000); + } + + return $loadingIndicator; +}; + +/** + * Show timeout message + */ +phpbb.showTimeoutMessage = function () { + var $alert = $('#phpbb_alert'); + + if ($loadingIndicator.is(':visible')) { + phpbb.alert($alert.attr('data-l-err'), $alert.attr('data-l-timeout-processing-req')); + } +}; + +/** + * Clear loading alert timeout +*/ +phpbb.clearLoadingTimeout = function() { + if (phpbbAlertTimer !== null) { + clearTimeout(phpbbAlertTimer); + phpbbAlertTimer = null; + } +}; + + +/** +* Close popup alert after a specified delay +* +* @param {int} delay Delay in ms until darkenwrapper's click event is triggered +*/ +phpbb.closeDarkenWrapper = function(delay) { + phpbbAlertTimer = setTimeout(function() { + $('#darkenwrapper').trigger('click'); + }, delay); +}; + +/** + * Display a simple alert similar to JSs native alert(). + * + * You can only call one alert or confirm box at any one time. + * + * @param {string} title Title of the message, eg "Information" (HTML). + * @param {string} msg Message to display (HTML). + * + * @returns {object} Returns the div created. + */ +phpbb.alert = function(title, msg) { + var $alert = $('#phpbb_alert'); + $alert.find('.alert_title').html(title); + $alert.find('.alert_text').html(msg); + + $(document).on('keydown.phpbb.alert', function(e) { + if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { + phpbb.alert.close($alert, true); + e.preventDefault(); + e.stopPropagation(); + } + }); + phpbb.alert.open($alert); + + return $alert; +}; + +/** +* Handler for opening an alert box. +* +* @param {jQuery} $alert jQuery object. +*/ +phpbb.alert.open = function($alert) { + if (!$dark.is(':visible')) { + $dark.fadeIn(phpbb.alertTime); + } + + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime, function() { + $dark.append($alert); + $alert.fadeIn(phpbb.alertTime); + }); + } else if ($dark.is(':visible')) { + $dark.append($alert); + $alert.fadeIn(phpbb.alertTime); + } else { + $dark.append($alert); + $alert.show(); + $dark.fadeIn(phpbb.alertTime); + } + + $alert.on('click', function(e) { + e.stopPropagation(); + }); + + $dark.one('click', function(e) { + phpbb.alert.close($alert, true); + e.preventDefault(); + e.stopPropagation(); + }); + + $alert.find('.alert_close').one('click', function(e) { + phpbb.alert.close($alert, true); + e.preventDefault(); + }); +}; + +/** +* Handler for closing an alert box. +* +* @param {jQuery} $alert jQuery object. +* @param {bool} fadedark Whether to remove dark background. +*/ +phpbb.alert.close = function($alert, fadedark) { + var $fade = (fadedark) ? $dark : $alert; + + $fade.fadeOut(phpbb.alertTime, function() { + $alert.hide(); + }); + + $alert.find('.alert_close').off('click'); + $(document).off('keydown.phpbb.alert'); +}; + +/** + * Display a simple yes / no box to the user. + * + * You can only call one alert or confirm box at any one time. + * + * @param {string} msg Message to display (HTML). + * @param {function} callback Callback. Bool param, whether the user pressed + * yes or no (or whatever their language is). + * @param {bool} fadedark Remove the dark background when done? Defaults + * to yes. + * + * @returns {object} Returns the div created. + */ +phpbb.confirm = function(msg, callback, fadedark) { + var $confirmDiv = $('#phpbb_confirm'); + $confirmDiv.find('.alert_text').html(msg); + fadedark = typeof fadedark !== 'undefined' ? fadedark : true; + + $(document).on('keydown.phpbb.alert', function(e) { + if (e.keyCode === keymap.ENTER || e.keyCode === keymap.ESC) { + var name = (e.keyCode === keymap.ENTER) ? 'confirm' : 'cancel'; + + $('input[name="' + name + '"]').trigger('click'); + e.preventDefault(); + e.stopPropagation(); + } + }); + + $confirmDiv.find('input[type="button"]').one('click.phpbb.confirmbox', function(e) { + var confirmed = this.name === 'confirm'; + + callback(confirmed); + $confirmDiv.find('input[type="button"]').off('click.phpbb.confirmbox'); + phpbb.alert.close($confirmDiv, fadedark || !confirmed); + + e.preventDefault(); + e.stopPropagation(); + }); + + phpbb.alert.open($confirmDiv); + + return $confirmDiv; +}; + +/** + * Turn a querystring into an array. + * + * @argument {string} string The querystring to parse. + * @returns {object} The object created. + */ +phpbb.parseQuerystring = function(string) { + var params = {}, i, split; + + string = string.split('&'); + for (i = 0; i < string.length; i++) { + split = string[i].split('='); + params[split[0]] = decodeURIComponent(split[1]); + } + return params; +}; + + +/** + * Makes a link use AJAX instead of loading an entire page. + * + * This function will work for links (both standard links and links which + * invoke confirm_box) and forms. It will be called automatically for links + * and forms with the data-ajax attribute set, and will call the necessary + * callback. + * + * For more info, view the following page on the phpBB wiki: + * http://wiki.phpbb.com/JavaScript_Function.phpbb.ajaxify + * + * @param {object} options Options. + */ +phpbb.ajaxify = function(options) { + var $elements = $(options.selector), + refresh = options.refresh, + callback = options.callback, + overlay = (typeof options.overlay !== 'undefined') ? options.overlay : true, + isForm = $elements.is('form'), + isText = $elements.is('input[type="text"], textarea'), + eventName; + + if (isForm) { + eventName = 'submit'; + } else if (isText) { + eventName = 'keyup'; + } else { + eventName = 'click'; + } + + $elements.on(eventName, function(event) { + var action, method, data, submit, that = this, $this = $(this); + + if ($this.find('input[type="submit"][data-clicked]').attr('data-ajax') === 'false') { + return; + } + + /** + * Handler for AJAX errors + */ + function errorHandler(jqXHR, textStatus, errorThrown) { + if (typeof console !== 'undefined' && console.log) { + console.log('AJAX error. status: ' + textStatus + ', message: ' + errorThrown); + } + phpbb.clearLoadingTimeout(); + var responseText, errorText = false; + try { + responseText = JSON.parse(jqXHR.responseText); + responseText = responseText.message; + } catch (e) {} + if (typeof responseText === 'string' && responseText.length > 0) { + errorText = responseText; + } else if (typeof errorThrown === 'string' && errorThrown.length > 0) { + errorText = errorThrown; + } else { + errorText = $dark.attr('data-ajax-error-text-' + textStatus); + if (typeof errorText !== 'string' || !errorText.length) { + errorText = $dark.attr('data-ajax-error-text'); + } + } + phpbb.alert($dark.attr('data-ajax-error-title'), errorText); + } + + /** + * This is a private function used to handle the callbacks, refreshes + * and alert. It calls the callback, refreshes the page if necessary, and + * displays an alert to the user and removes it after an amount of time. + * + * It cannot be called from outside this function, and is purely here to + * avoid repetition of code. + * + * @param {object} res The object sent back by the server. + */ + function returnHandler(res) { + var alert; + + phpbb.clearLoadingTimeout(); + + // Is a confirmation required? + if (typeof res.S_CONFIRM_ACTION === 'undefined') { + // If a confirmation is not required, display an alert and call the + // callbacks. + if (typeof res.MESSAGE_TITLE !== 'undefined') { + alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT); + } else { + $dark.fadeOut(phpbb.alertTime); + + if ($loadingIndicator) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + } + + if (typeof phpbb.ajaxCallbacks[callback] === 'function') { + phpbb.ajaxCallbacks[callback].call(that, res); + } + + // If the server says to refresh the page, check whether the page should + // be refreshed and refresh page after specified time if required. + if (res.REFRESH_DATA) { + if (typeof refresh === 'function') { + refresh = refresh(res.REFRESH_DATA.url); + } else if (typeof refresh !== 'boolean') { + refresh = false; + } + + phpbbAlertTimer = setTimeout(function() { + if (refresh) { + window.location = res.REFRESH_DATA.url; + } + + // Hide the alert even if we refresh the page, in case the user + // presses the back button. + $dark.fadeOut(phpbb.alertTime, function() { + if (typeof alert !== 'undefined') { + alert.hide(); + } + }); + }, res.REFRESH_DATA.time * 1000); // Server specifies time in seconds + } + } else { + // If confirmation is required, display a dialog to the user. + phpbb.confirm(res.MESSAGE_BODY, function(del) { + if (!del) { + return; + } + + phpbb.loadingIndicator(); + data = $('
' + res.S_HIDDEN_FIELDS + '
').serialize(); + $.ajax({ + url: res.S_CONFIRM_ACTION, + type: 'POST', + data: data + '&confirm=' + res.YES_VALUE + '&' + $('form', '#phpbb_confirm').serialize(), + success: returnHandler, + error: errorHandler + }); + }, false); + } + } + + // If the element is a form, POST must be used and some extra data must + // be taken from the form. + var runFilter = (typeof options.filter === 'function'); + data = {}; + + if (isForm) { + action = $this.attr('action').replace('&', '&'); + data = $this.serializeArray(); + method = $this.attr('method') || 'GET'; + + if ($this.find('input[type="submit"][data-clicked]')) { + submit = $this.find('input[type="submit"][data-clicked]'); + data.push({ + name: submit.attr('name'), + value: submit.val() + }); + } + } else if (isText) { + var name = $this.attr('data-name') || this.name; + action = $this.attr('data-url').replace('&', '&'); + data[name] = this.value; + method = 'POST'; + } else { + action = this.href; + data = null; + method = 'GET'; + } + + var sendRequest = function() { + var dataOverlay = $this.attr('data-overlay'); + if (overlay && (typeof dataOverlay === 'undefined' || dataOverlay === 'true')) { + phpbb.loadingIndicator(); + } + + var request = $.ajax({ + url: action, + type: method, + data: data, + success: returnHandler, + error: errorHandler, + cache: false + }); + + request.always(function() { + if ($loadingIndicator && $loadingIndicator.is(':visible')) { + $loadingIndicator.fadeOut(phpbb.alertTime); + } + }); + }; + + // If filter function returns false, cancel the AJAX functionality, + // and return true (meaning that the HTTP request will be sent normally). + if (runFilter && !options.filter.call(this, data, event, sendRequest)) { + return; + } + + sendRequest(); + event.preventDefault(); + }); + + if (isForm) { + $elements.find('input:submit').click(function () { + var $this = $(this); + + // Remove data-clicked attribute from any submit button of form + $this.parents('form:first').find('input:submit[data-clicked]').removeAttr('data-clicked'); + + $this.attr('data-clicked', 'true'); + }); + } + + return this; +}; + +phpbb.search = { + cache: { + data: [] + }, + tpl: [], + container: [] +}; + +/** + * Get cached search data. + * + * @param {string} id Search ID. + * @returns {bool|object} Cached data object. Returns false if no data exists. + */ +phpbb.search.cache.get = function(id) { + if (this.data[id]) { + return this.data[id]; + } + return false; +}; + +/** + * Set search cache data value. + * + * @param {string} id Search ID. + * @param {string} key Data key. + * @param {string} value Data value. + */ +phpbb.search.cache.set = function(id, key, value) { + if (!this.data[id]) { + this.data[id] = { results: [] }; + } + this.data[id][key] = value; +}; + +/** + * Cache search result. + * + * @param {string} id Search ID. + * @param {string} keyword Keyword. + * @param {Array} results Search results. + */ +phpbb.search.cache.setResults = function(id, keyword, results) { + this.data[id].results[keyword] = results; +}; + +/** + * Trim spaces from keyword and lower its case. + * + * @param {string} keyword Search keyword to clean. + * @returns {string} Cleaned string. + */ +phpbb.search.cleanKeyword = function(keyword) { + return $.trim(keyword).toLowerCase(); +}; + +/** + * Get clean version of search keyword. If textarea supports several keywords + * (one per line), it fetches the current keyword based on the caret position. + * + * @param {jQuery} $input Search input|textarea. + * @param {string} keyword Input|textarea value. + * @param {bool} multiline Whether textarea supports multiple search keywords. + * + * @returns string Clean string. + */ +phpbb.search.getKeyword = function($input, keyword, multiline) { + if (multiline) { + var line = phpbb.search.getKeywordLine($input); + keyword = keyword.split('\n').splice(line, 1); + } + return phpbb.search.cleanKeyword(keyword); +}; + +/** + * Get the textarea line number on which the keyword resides - for textareas + * that support multiple keywords (one per line). + * + * @param {jQuery} $textarea Search textarea. + * @returns {int} The line number. + */ +phpbb.search.getKeywordLine = function ($textarea) { + var selectionStart = $textarea.get(0).selectionStart; + return $textarea.val().substr(0, selectionStart).split('\n').length - 1; +}; + +/** + * Set the value on the input|textarea. If textarea supports multiple + * keywords, only the active keyword is replaced. + * + * @param {jQuery} $input Search input|textarea. + * @param {string} value Value to set. + * @param {bool} multiline Whether textarea supports multiple search keywords. + */ +phpbb.search.setValue = function($input, value, multiline) { + if (multiline) { + var line = phpbb.search.getKeywordLine($input), + lines = $input.val().split('\n'); + lines[line] = value; + value = lines.join('\n'); + } + $input.val(value); +}; + +/** + * Sets the onclick event to set the value on the input|textarea to the + * selected search result. + * + * @param {jQuery} $input Search input|textarea. + * @param {object} value Result object. + * @param {jQuery} $row Result element. + * @param {jQuery} $container jQuery object for the search container. + */ +phpbb.search.setValueOnClick = function($input, value, $row, $container) { + $row.click(function() { + phpbb.search.setValue($input, value.result, $input.attr('data-multiline')); + $container.hide(); + }); +}; + +/** + * Runs before the AJAX search request is sent and determines whether + * there is a need to contact the server. If there are cached results + * already, those are displayed instead. Executes the AJAX request function + * itself due to the need to use a timeout to limit the number of requests. + * + * @param {Array} data Data to be sent to the server. + * @param {object} event Onkeyup event object. + * @param {function} sendRequest Function to execute AJAX request. + * + * @returns {bool} Returns false. + */ +phpbb.search.filter = function(data, event, sendRequest) { + var $this = $(this), + dataName = ($this.attr('data-name') !== undefined) ? $this.attr('data-name') : $this.attr('name'), + minLength = parseInt($this.attr('data-min-length'), 10), + searchID = $this.attr('data-results'), + keyword = phpbb.search.getKeyword($this, data[dataName], $this.attr('data-multiline')), + cache = phpbb.search.cache.get(searchID), + proceed = true; + data[dataName] = keyword; + + if (cache.timeout) { + clearTimeout(cache.timeout); + } + + var timeout = setTimeout(function() { + // Check min length and existence of cache. + if (minLength > keyword.length) { + proceed = false; + } else if (cache.lastSearch) { + // Has the keyword actually changed? + if (cache.lastSearch === keyword) { + proceed = false; + } else { + // Do we already have results for this? + if (cache.results[keyword]) { + var response = { + keyword: keyword, + results: cache.results[keyword] + }; + phpbb.search.handleResponse(response, $this, true); + proceed = false; + } + + // If the previous search didn't yield results and the string only had characters added to it, + // then we won't bother sending a request. + if (keyword.indexOf(cache.lastSearch) === 0 && cache.results[cache.lastSearch].length === 0) { + phpbb.search.cache.set(searchID, 'lastSearch', keyword); + phpbb.search.cache.setResults(searchID, keyword, []); + proceed = false; + } + } + } + + if (proceed) { + sendRequest.call(this); + } + }, 350); + phpbb.search.cache.set(searchID, 'timeout', timeout); + + return false; +}; + +/** + * Handle search result response. + * + * @param {object} res Data received from server. + * @param {jQuery} $input Search input|textarea. + * @param {bool} fromCache Whether the results are from the cache. + * @param {function} callback Optional callback to run when assigning each search result. + */ +phpbb.search.handleResponse = function(res, $input, fromCache, callback) { + if (typeof res !== 'object') { + return; + } + + var searchID = $input.attr('data-results'), + $container = $(searchID); + + if (this.cache.get(searchID).callback) { + callback = this.cache.get(searchID).callback; + } else if (typeof callback === 'function') { + this.cache.set(searchID, 'callback', callback); + } + + if (!fromCache) { + this.cache.setResults(searchID, res.keyword, res.results); + } + + this.cache.set(searchID, 'lastSearch', res.keyword); + this.showResults(res.results, $input, $container, callback); +}; + +/** + * Show search results. + * + * @param {Array} results Search results. + * @param {jQuery} $input Search input|textarea. + * @param {jQuery} $container Search results container element. + * @param {function} callback Optional callback to run when assigning each search result. + */ +phpbb.search.showResults = function(results, $input, $container, callback) { + var $resultContainer = $('.search-results', $container); + this.clearResults($resultContainer); + + if (!results.length) { + $container.hide(); + return; + } + + var searchID = $container.attr('id'), + tpl, + row; + + if (!this.tpl[searchID]) { + tpl = $('.search-result-tpl', $container); + this.tpl[searchID] = tpl.clone().removeClass('search-result-tpl'); + tpl.remove(); + } + tpl = this.tpl[searchID]; + + $.each(results, function(i, item) { + row = tpl.clone(); + row.find('.search-result').html(item.display); + + if (typeof callback === 'function') { + callback.call(this, $input, item, row, $container); + } + row.appendTo($resultContainer).show(); + }); + $container.show(); +}; + +/** + * Clear search results. + * + * @param {jQuery} $container Search results container. + */ +phpbb.search.clearResults = function($container) { + $container.children(':not(.search-result-tpl)').remove(); +}; + +$('#phpbb').click(function() { + var $this = $(this); + + if (!$this.is('.live-search') && !$this.parents().is('.live-search')) { + $('.live-search').hide(); + } +}); + +phpbb.history = {}; + +/** +* Check whether a method in the native history object is supported. +* +* @param {string} fn Method name. +* @returns {bool} Returns true if the method is supported. +*/ +phpbb.history.isSupported = function(fn) { + return !(typeof history === 'undefined' || typeof history[fn] === 'undefined'); +}; + +/** +* Wrapper for the pushState and replaceState methods of the +* native history object. +* +* @param {string} mode Mode. Either push or replace. +* @param {string} url New URL. +* @param {string} [title] Optional page title. +* @param {object} [obj] Optional state object. +*/ +phpbb.history.alterUrl = function(mode, url, title, obj) { + var fn = mode + 'State'; + + if (!url || !phpbb.history.isSupported(fn)) { + return; + } + if (!title) { + title = document.title; + } + if (!obj) { + obj = null; + } + + history[fn](obj, title, url); +}; + +/** +* Wrapper for the native history.replaceState method. +* +* @param {string} url New URL. +* @param {string} [title] Optional page title. +* @param {object} [obj] Optional state object. +*/ +phpbb.history.replaceUrl = function(url, title, obj) { + phpbb.history.alterUrl('replace', url, title, obj); +}; + +/** +* Wrapper for the native history.pushState method. +* +* @param {string} url New URL. +* @param {string} [title] Optional page title. +* @param {object} [obj] Optional state object. +*/ +phpbb.history.pushUrl = function(url, title, obj) { + phpbb.history.alterUrl('push', url, title, obj); +}; + +/** +* Hide the optgroups that are not the selected timezone +* +* @param {bool} keepSelection Shall we keep the value selected, or shall the +* user be forced to repick one. +*/ +phpbb.timezoneSwitchDate = function(keepSelection) { + var $timezoneCopy = $('#timezone_copy'); + var $timezone = $('#timezone'); + var $tzDate = $('#tz_date'); + var $tzSelectDateSuggest = $('#tz_select_date_suggest'); + + if ($timezoneCopy.length === 0) { + // We make a backup of the original dropdown, so we can remove optgroups + // instead of setting display to none, because IE and chrome will not + // hide options inside of optgroups and selects via css + $timezone.clone() + .attr('id', 'timezone_copy') + .css('display', 'none') + .attr('name', 'tz_copy') + .insertAfter('#timezone'); + } else { + // Copy the content of our backup, so we can remove all unneeded options + $timezone.html($timezoneCopy.html()); + } + + if ($tzDate.val() !== '') { + $timezone.children('optgroup').remove(':not([data-tz-value="' + $tzDate.val() + '"])'); + } + + if ($tzDate.val() === $tzSelectDateSuggest.attr('data-suggested-tz')) { + $tzSelectDateSuggest.css('display', 'none'); + } else { + $tzSelectDateSuggest.css('display', 'inline'); + } + + var $tzOptions = $timezone.children('optgroup[data-tz-value="' + $tzDate.val() + '"]').children('option'); + + if ($tzOptions.length === 1) { + // If there is only one timezone for the selected date, we just select that automatically. + $tzOptions.prop('selected', true); + keepSelection = true; + } + + if (typeof keepSelection !== 'undefined' && !keepSelection) { + var $timezoneOptions = $timezone.find('optgroup option'); + if ($timezoneOptions.filter(':selected').length <= 0) { + $timezoneOptions.filter(':first').prop('selected', true); + } + } +}; + +/** +* Display the date/time select +*/ +phpbb.timezoneEnableDateSelection = function() { + $('#tz_select_date').css('display', 'block'); +}; + +/** +* Preselect a date/time or suggest one, if it is not picked. +* +* @param {bool} forceSelector Shall we select the suggestion? +*/ +phpbb.timezonePreselectSelect = function(forceSelector) { + + // The offset returned here is in minutes and negated. + var offset = (new Date()).getTimezoneOffset(); + var sign = '-'; + + if (offset < 0) { + sign = '+'; + offset = -offset; + } + + var minutes = offset % 60; + var hours = (offset - minutes) / 60; + + if (hours < 10) { + hours = '0' + hours.toString(); + } else { + hours = hours.toString(); + } + + if (minutes < 10) { + minutes = '0' + minutes.toString(); + } else { + minutes = minutes.toString(); + } + + var prefix = 'UTC' + sign + hours + ':' + minutes; + var prefixLength = prefix.length; + var selectorOptions = $('option', '#tz_date'); + var i; + + var $tzSelectDateSuggest = $('#tz_select_date_suggest'); + + for (i = 0; i < selectorOptions.length; ++i) { + var option = selectorOptions[i]; + + if (option.value.substring(0, prefixLength) === prefix) { + if ($('#tz_date').val() !== option.value && !forceSelector) { + // We do not select the option for the user, but notify him, + // that we would suggest a different setting. + phpbb.timezoneSwitchDate(true); + $tzSelectDateSuggest.css('display', 'inline'); + } else { + option.selected = true; + phpbb.timezoneSwitchDate(!forceSelector); + $tzSelectDateSuggest.css('display', 'none'); + } + + var suggestion = $tzSelectDateSuggest.attr('data-l-suggestion'); + + $tzSelectDateSuggest.attr('title', suggestion.replace('%s', option.innerHTML)); + $tzSelectDateSuggest.attr('value', suggestion.replace('%s', option.innerHTML.substring(0, 9))); + $tzSelectDateSuggest.attr('data-suggested-tz', option.innerHTML); + + // Found the suggestion, there cannot be more, so return from here. + return; + } + } +}; + +phpbb.ajaxCallbacks = {}; + +/** + * Adds an AJAX callback to be used by phpbb.ajaxify. + * + * See the phpbb.ajaxify comments for information on stuff like parameters. + * + * @param {string} id The name of the callback. + * @param {function} callback The callback to be called. + */ +phpbb.addAjaxCallback = function(id, callback) { + if (typeof callback === 'function') { + phpbb.ajaxCallbacks[id] = callback; + } + return this; +}; + +/** + * This callback handles live member searches. + */ +phpbb.addAjaxCallback('member_search', function(res) { + phpbb.search.handleResponse(res, $(this), false, phpbb.getFunctionByName('phpbb.search.setValueOnClick')); +}); + +/** + * This callback alternates text - it replaces the current text with the text in + * the alt-text data attribute, and replaces the text in the attribute with the + * current text so that the process can be repeated. + */ +phpbb.addAjaxCallback('alt_text', function() { + var $anchor, + updateAll = $(this).data('update-all'), + altText; + + if (updateAll !== undefined && updateAll.length) { + $anchor = $(updateAll); + } else { + $anchor = $(this); + } + + $anchor.each(function() { + var $this = $(this); + altText = $this.attr('data-alt-text'); + $this.attr('data-alt-text', $.trim($this.text())); + $this.attr('title', altText); + $this.children('span').text(altText); + }); +}); + +/** + * This callback is based on the alt_text callback. + * + * It replaces the current text with the text in the alt-text data attribute, + * and replaces the text in the attribute with the current text so that the + * process can be repeated. + * Additionally it replaces the class of the link's parent + * and changes the link itself. + */ +phpbb.addAjaxCallback('toggle_link', function() { + var $anchor, + updateAll = $(this).data('update-all') , + toggleText, + toggleUrl, + toggleClass; + + if (updateAll !== undefined && updateAll.length) { + $anchor = $(updateAll); + } else { + $anchor = $(this); + } + + $anchor.each(function() { + var $this = $(this); + + // Toggle link url + toggleUrl = $this.attr('data-toggle-url'); + $this.attr('data-toggle-url', $this.attr('href')); + $this.attr('href', toggleUrl); + + // Toggle class of link parent + toggleClass = $this.attr('data-toggle-class'); + $this.attr('data-toggle-class', $this.children().attr('class')); + $this.children('.icon').attr('class', toggleClass); + + // Toggle link text + toggleText = $this.attr('data-toggle-text'); + $this.attr('data-toggle-text', $this.children('span').text()); + $this.attr('title', $.trim(toggleText)); + $this.children('span').text(toggleText); + }); +}); + +/** +* Automatically resize textarea +* +* This function automatically resizes textarea elements when user +* types text. +* +* @param {jQuery} $items jQuery object(s) to resize +* @param {object} [options] Optional parameter that adjusts default +* configuration. See configuration variable +* +* Optional parameters: +* minWindowHeight {number} Minimum browser window height when textareas are resized. Default = 500 +* minHeight {number} Minimum height of textarea. Default = 200 +* maxHeight {number} Maximum height of textarea. Default = 500 +* heightDiff {number} Minimum difference between window and textarea height. Default = 200 +* resizeCallback {function} Function to call after resizing textarea +* resetCallback {function} Function to call when resize has been canceled + +* Callback function format: function(item) {} +* this points to DOM object +* item is a jQuery object, same as this +*/ +phpbb.resizeTextArea = function($items, options) { + // Configuration + var configuration = { + minWindowHeight: 500, + minHeight: 200, + maxHeight: 500, + heightDiff: 200, + resizeCallback: function() {}, + resetCallback: function() {} + }; + + if (phpbb.isTouch) { + return; + } + + if (arguments.length > 1) { + configuration = $.extend(configuration, options); + } + + function resetAutoResize(item) { + var $item = $(item); + if ($item.hasClass('auto-resized')) { + $(item) + .css({ height: '', resize: '' }) + .removeClass('auto-resized'); + configuration.resetCallback.call(item, $item); + } + } + + function autoResize(item) { + function setHeight(height) { + height += parseInt($item.css('height'), 10) - $item.innerHeight(); + $item + .css({ height: height + 'px', resize: 'none' }) + .addClass('auto-resized'); + configuration.resizeCallback.call(item, $item); + } + + var windowHeight = $(window).height(); + + if (windowHeight < configuration.minWindowHeight) { + resetAutoResize(item); + return; + } + + var maxHeight = Math.min( + Math.max(windowHeight - configuration.heightDiff, configuration.minHeight), + configuration.maxHeight + ), + $item = $(item), + height = parseInt($item.innerHeight(), 10), + scrollHeight = (item.scrollHeight) ? item.scrollHeight : 0; + + if (height < 0) { + return; + } + + if (height > maxHeight) { + setHeight(maxHeight); + } else if (scrollHeight > (height + 5)) { + setHeight(Math.min(maxHeight, scrollHeight)); + } + } + + $items.on('focus change keyup', function() { + $(this).each(function() { + autoResize(this); + }); + }).change(); + + $(window).resize(function() { + $items.each(function() { + if ($(this).hasClass('auto-resized')) { + autoResize(this); + } + }); + }); +}; + +/** +* Check if cursor in textarea is currently inside a bbcode tag +* +* @param {object} textarea Textarea DOM object +* @param {Array} startTags List of start tags to look for +* For example, Array('[code]', '[code=') +* @param {Array} endTags List of end tags to look for +* For example, Array('[/code]') +* +* @returns {boolean} True if cursor is in bbcode tag +*/ +phpbb.inBBCodeTag = function(textarea, startTags, endTags) { + var start = textarea.selectionStart, + lastEnd = -1, + lastStart = -1, + i, index, value; + + if (typeof start !== 'number') { + return false; + } + + value = textarea.value.toLowerCase(); + + for (i = 0; i < startTags.length; i++) { + var tagLength = startTags[i].length; + if (start >= tagLength) { + index = value.lastIndexOf(startTags[i], start - tagLength); + lastStart = Math.max(lastStart, index); + } + } + if (lastStart === -1) { + return false; + } + + if (start > 0) { + for (i = 0; i < endTags.length; i++) { + index = value.lastIndexOf(endTags[i], start - 1); + lastEnd = Math.max(lastEnd, index); + } + } + + return (lastEnd < lastStart); +}; + + +/** +* Adjust textarea to manage code bbcode +* +* This function allows to use tab characters when typing code +* and keeps indentation of previous line of code when adding new +* line while typing code. +* +* Editor's functionality is changed only when cursor is between +* [code] and [/code] bbcode tags. +* +* @param {object} textarea Textarea DOM object to apply editor to +*/ +phpbb.applyCodeEditor = function(textarea) { + // list of allowed start and end bbcode code tags, in lower case + var startTags = ['[code]', '[code='], + startTagsEnd = ']', + endTags = ['[/code]']; + + if (!textarea || typeof textarea.selectionStart !== 'number') { + return; + } + + if ($(textarea).data('code-editor') === true) { + return; + } + + function inTag() { + return phpbb.inBBCodeTag(textarea, startTags, endTags); + } + + /** + * Get line of text before cursor + * + * @param {boolean} stripCodeStart If true, only part of line + * after [code] tag will be returned. + * + * @returns {string} Line of text + */ + function getLastLine(stripCodeStart) { + var start = textarea.selectionStart, + value = textarea.value, + index = value.lastIndexOf('\n', start - 1); + + value = value.substring(index + 1, start); + + if (stripCodeStart) { + for (var i = 0; i < startTags.length; i++) { + index = value.lastIndexOf(startTags[i]); + if (index >= 0) { + var tagLength = startTags[i].length; + + value = value.substring(index + tagLength); + if (startTags[i].lastIndexOf(startTagsEnd) !== tagLength) { + index = value.indexOf(startTagsEnd); + + if (index >= 0) { + value = value.substr(index + 1); + } + } + } + } + } + + return value; + } + + /** + * Append text at cursor position + * + * @param {string} text Text to append + */ + function appendText(text) { + var start = textarea.selectionStart, + end = textarea.selectionEnd, + value = textarea.value; + + textarea.value = value.substr(0, start) + text + value.substr(end); + textarea.selectionStart = textarea.selectionEnd = start + text.length; + } + + $(textarea).data('code-editor', true).on('keydown', function(event) { + var key = event.keyCode || event.which; + + // intercept tabs + if (key === keymap.TAB && + !event.ctrlKey && + !event.shiftKey && + !event.altKey && + !event.metaKey) { + if (inTag()) { + appendText('\t'); + event.preventDefault(); + return; + } + } + + // intercept new line characters + if (key === keymap.ENTER) { + if (inTag()) { + var lastLine = getLastLine(true), + code = '' + /^\s*/g.exec(lastLine); + + if (code.length > 0) { + appendText('\n' + code); + event.preventDefault(); + } + } + } + }); +}; + +/** + * Show drag and drop animation when textarea is present + * + * This function will enable the drag and drop animation for a specified + * textarea. + * + * @param {HTMLElement} textarea Textarea DOM object to apply editor to + */ +phpbb.showDragNDrop = function(textarea) { + if (!textarea) { + return; + } + + $('body').on('dragenter dragover', function () { + $(textarea).addClass('drag-n-drop'); + }).on('dragleave dragout dragend drop', function() { + $(textarea).removeClass('drag-n-drop'); + }); + $(textarea).on('dragenter dragover', function () { + $(textarea).addClass('drag-n-drop-highlight'); + }).on('dragleave dragout dragend drop', function() { + $(textarea).removeClass('drag-n-drop-highlight'); + }); +}; + +/** +* List of classes that toggle dropdown menu, +* list of classes that contain visible dropdown menu +* +* Add your own classes to strings with comma (probably you +* will never need to do that) +*/ +phpbb.dropdownHandles = '.dropdown-container.dropdown-visible .dropdown-toggle'; +phpbb.dropdownVisibleContainers = '.dropdown-container.dropdown-visible'; + +/** +* Dropdown toggle event handler +* This handler is used by phpBB.registerDropdown() and other functions +*/ +phpbb.toggleDropdown = function() { + var $this = $(this), + options = $this.data('dropdown-options'), + parent = options.parent, + visible = parent.hasClass('dropdown-visible'), + direction; + + if (!visible) { + // Hide other dropdown menus + $(phpbb.dropdownHandles).each(phpbb.toggleDropdown); + + // Figure out direction of dropdown + direction = options.direction; + var verticalDirection = options.verticalDirection, + offset = $this.offset(); + + if (direction === 'auto') { + if (($(window).width() - $this.outerWidth(true)) / 2 > offset.left) { + direction = 'right'; + } else { + direction = 'left'; + } + } + parent.toggleClass(options.leftClass, direction === 'left') + .toggleClass(options.rightClass, direction === 'right'); + + if (verticalDirection === 'auto') { + var height = $(window).height(), + top = offset.top - $(window).scrollTop(); + + verticalDirection = (top < height * 0.7) ? 'down' : 'up'; + } + parent.toggleClass(options.upClass, verticalDirection === 'up') + .toggleClass(options.downClass, verticalDirection === 'down'); + } + + options.dropdown.toggle(); + parent.toggleClass(options.visibleClass, !visible) + .toggleClass('dropdown-visible', !visible); + + // Check dimensions when showing dropdown + // !visible because variable shows state of dropdown before it was toggled + if (!visible) { + var windowWidth = $(window).width(); + + options.dropdown.find('.dropdown-contents').each(function() { + var $this = $(this); + + $this.css({ + marginLeft: 0, + left: 0, + marginRight: 0, + maxWidth: (windowWidth - 4) + 'px' + }); + + var offset = $this.offset().left, + width = $this.outerWidth(true); + + if (offset < 2) { + $this.css('left', (2 - offset) + 'px'); + } else if ((offset + width + 2) > windowWidth) { + $this.css('margin-left', (windowWidth - offset - width - 2) + 'px'); + } + + // Check whether the vertical scrollbar is present. + $this.toggleClass('dropdown-nonscroll', this.scrollHeight === $this.innerHeight()); + + }); + var freeSpace = parent.offset().left - 4; + + if (direction === 'left') { + options.dropdown.css('margin-left', '-' + freeSpace + 'px'); + + // Try to position the notification dropdown correctly in RTL-responsive mode + if (options.dropdown.hasClass('dropdown-extended')) { + var contentWidth, + fullFreeSpace = freeSpace + parent.outerWidth(); + + options.dropdown.find('.dropdown-contents').each(function() { + contentWidth = parseInt($(this).outerWidth(), 10); + $(this).css({ marginLeft: 0, left: 0 }); + }); + + var maxOffset = Math.min(contentWidth, fullFreeSpace) + 'px'; + options.dropdown.css({ + width: maxOffset, + marginLeft: -maxOffset + }); + } + } else { + options.dropdown.css('margin-right', '-' + (windowWidth + freeSpace) + 'px'); + } + } + + // Prevent event propagation + if (arguments.length > 0) { + try { + var e = arguments[0]; + e.preventDefault(); + e.stopPropagation(); + } catch (error) { } + } + return false; +}; + +/** +* Toggle dropdown submenu +*/ +phpbb.toggleSubmenu = function(e) { + $(this).siblings('.dropdown-submenu').toggle(); + e.preventDefault(); +}; + +/** +* Register dropdown menu +* Shows/hides dropdown, decides which side to open to +* +* @param {jQuery} toggle Link that toggles dropdown. +* @param {jQuery} dropdown Dropdown menu. +* @param {Object} options List of options. Optional. +*/ +phpbb.registerDropdown = function(toggle, dropdown, options) { + var ops = { + parent: toggle.parent(), // Parent item to add classes to + direction: 'auto', // Direction of dropdown menu. Possible values: auto, left, right + verticalDirection: 'auto', // Vertical direction. Possible values: auto, up, down + visibleClass: 'visible', // Class to add to parent item when dropdown is visible + leftClass: 'dropdown-left', // Class to add to parent item when dropdown opens to left side + rightClass: 'dropdown-right', // Class to add to parent item when dropdown opens to right side + upClass: 'dropdown-up', // Class to add to parent item when dropdown opens above menu item + downClass: 'dropdown-down' // Class to add to parent item when dropdown opens below menu item + }; + if (options) { + ops = $.extend(ops, options); + } + ops.dropdown = dropdown; + + ops.parent.addClass('dropdown-container'); + toggle.addClass('dropdown-toggle'); + + toggle.data('dropdown-options', ops); + + toggle.click(phpbb.toggleDropdown); + $('.dropdown-toggle-submenu', ops.parent).click(phpbb.toggleSubmenu); +}; + +/** +* Get the HTML for a color palette table. +* +* @param {string} dir Palette direction - either v or h +* @param {int} width Palette cell width. +* @param {int} height Palette cell height. +*/ +phpbb.colorPalette = function(dir, width, height) { + var r, g, b, + numberList = new Array(6), + color = '', + html = ''; + + numberList[0] = '00'; + numberList[1] = '40'; + numberList[2] = '80'; + numberList[3] = 'BF'; + numberList[4] = 'FF'; + + var tableClass = (dir === 'h') ? 'horizontal-palette' : 'vertical-palette'; + html += ''; + + for (r = 0; r < 5; r++) { + if (dir === 'h') { + html += ''; + } + + for (g = 0; g < 5; g++) { + if (dir === 'v') { + html += ''; + } + + for (b = 0; b < 5; b++) { + color = '' + numberList[r] + numberList[g] + numberList[b]; + html += ''; + } + + if (dir === 'v') { + html += ''; + } + } + + if (dir === 'h') { + html += ''; + } + } + html += '
'; + html += '
'; + return html; +}; + +/** +* Register a color palette. +* +* @param {jQuery} el jQuery object for the palette container. +*/ +phpbb.registerPalette = function(el) { + var orientation = el.attr('data-orientation'), + height = el.attr('data-height'), + width = el.attr('data-width'), + target = el.attr('data-target'), + bbcode = el.attr('data-bbcode'); + + // Insert the palette HTML into the container. + el.html(phpbb.colorPalette(orientation, width, height)); + + // Add toggle control. + $('#color_palette_toggle').click(function(e) { + el.toggle(); + e.preventDefault(); + }); + + // Attach event handler when a palette cell is clicked. + $(el).on('click', 'a', function(e) { + var color = $(this).attr('data-color'); + + if (bbcode) { + bbfontstyle('[color=#' + color + ']', '[/color]'); + } else { + $(target).val(color); + } + e.preventDefault(); + }); +}; + +/** +* Set display of page element +* +* @param {string} id The ID of the element to change +* @param {int} action Set to 0 if element display should be toggled, -1 for +* hiding the element, and 1 for showing it. +* @param {string} type Display type that should be used, e.g. inline, block or +* other CSS "display" types +*/ +phpbb.toggleDisplay = function(id, action, type) { + if (!type) { + type = 'block'; + } + + var $element = $('#' + id); + + var display = $element.css('display'); + if (!action) { + action = (display === '' || display === type) ? -1 : 1; + } + $element.css('display', ((action === 1) ? type : 'none')); +}; + +/** +* Toggle additional settings based on the selected +* option of select element. +* +* @param {jQuery} el jQuery select element object. +*/ +phpbb.toggleSelectSettings = function(el) { + el.children().each(function() { + var $this = $(this), + $setting = $($this.data('toggle-setting')); + $setting.toggle($this.is(':selected')); + + // Disable any input elements that are not visible right now + if ($this.is(':selected')) { + $($this.data('toggle-setting') + ' input').prop('disabled', false); + } else { + $($this.data('toggle-setting') + ' input').prop('disabled', true); + } + }); +}; + +/** +* Get function from name. +* Based on http://stackoverflow.com/a/359910 +* +* @param {string} functionName Function to get. +* @returns function +*/ +phpbb.getFunctionByName = function (functionName) { + var namespaces = functionName.split('.'), + func = namespaces.pop(), + context = window; + + for (var i = 0; i < namespaces.length; i++) { + context = context[namespaces[i]]; + } + return context[func]; +}; + +/** +* Register page dropdowns. +*/ +phpbb.registerPageDropdowns = function() { + var $body = $('body'); + + $body.find('.dropdown-container').each(function() { + var $this = $(this), + $trigger = $this.find('.dropdown-trigger:first'), + $contents = $this.find('.dropdown'), + options = { + direction: 'auto', + verticalDirection: 'auto' + }, + data; + + if (!$trigger.length) { + data = $this.attr('data-dropdown-trigger'); + $trigger = data ? $this.children(data) : $this.children('a:first'); + } + + if (!$contents.length) { + data = $this.attr('data-dropdown-contents'); + $contents = data ? $this.children(data) : $this.children('div:first'); + } + + if (!$trigger.length || !$contents.length) { + return; + } + + if ($this.hasClass('dropdown-up')) { + options.verticalDirection = 'up'; + } + if ($this.hasClass('dropdown-down')) { + options.verticalDirection = 'down'; + } + if ($this.hasClass('dropdown-left')) { + options.direction = 'left'; + } + if ($this.hasClass('dropdown-right')) { + options.direction = 'right'; + } + + phpbb.registerDropdown($trigger, $contents, options); + }); + + // Hide active dropdowns when click event happens outside + $body.click(function(e) { + var $parents = $(e.target).parents(); + if (!$parents.is(phpbb.dropdownVisibleContainers)) { + $(phpbb.dropdownHandles).each(phpbb.toggleDropdown); + } + }); +}; + +/** + * Handle avatars to be lazy loaded. + */ +phpbb.lazyLoadAvatars = function loadAvatars() { + $('.avatar[data-src]').each(function () { + var $avatar = $(this); + + $avatar + .attr('src', $avatar.data('src')) + .removeAttr('data-src'); + }); +}; + +$(window).on('load', phpbb.lazyLoadAvatars); + +/** +* Apply code editor to all textarea elements with data-bbcode attribute +*/ +$(function() { + $('textarea[data-bbcode]').each(function() { + phpbb.applyCodeEditor(this); + }); + + phpbb.registerPageDropdowns(); + + $('[data-orientation]').each(function() { + phpbb.registerPalette($(this)); + }); + + // Update browser history URL to point to specific post in viewtopic.php + // when using view=unread#unread link. + phpbb.history.replaceUrl($('#unread[data-url]').data('url')); + + // Hide settings that are not selected via select element. + $('select[data-togglable-settings]').each(function() { + var $this = $(this); + + $this.change(function() { + phpbb.toggleSelectSettings($this); + }); + phpbb.toggleSelectSettings($this); + }); +}); + +})(jQuery); // Avoid conflicts with other libraries diff --git a/install/update/old/assets/javascript/editor.js b/install/update/old/assets/javascript/editor.js new file mode 100644 index 0000000..23244f5 --- /dev/null +++ b/install/update/old/assets/javascript/editor.js @@ -0,0 +1,425 @@ +/** +* bbCode control by subBlue design [ www.subBlue.com ] +* Includes unixsafe colour palette selector by SHS` +*/ + +// Startup variables +var imageTag = false; +var theSelection = false; +var bbcodeEnabled = true; + +// Check for Browser & Platform for PC & IE specific bits +// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html +var clientPC = navigator.userAgent.toLowerCase(); // Get client info +var clientVer = parseInt(navigator.appVersion, 10); // Get browser version + +var is_ie = ((clientPC.indexOf('msie') !== -1) && (clientPC.indexOf('opera') === -1)); +var is_win = ((clientPC.indexOf('win') !== -1) || (clientPC.indexOf('16bit') !== -1)); +var baseHeight; + +/** +* Shows the help messages in the helpline window +*/ +function helpline(help) { + document.forms[form_name].helpbox.value = help_line[help]; +} + +/** +* Fix a bug involving the TextRange object. From +* http://www.frostjedi.com/terra/scripts/demo/caretBug.html +*/ +function initInsertions() { + var doc; + + if (document.forms[form_name]) { + doc = document; + } else { + doc = opener.document; + } + + var textarea = doc.forms[form_name].elements[text_name]; + + if (is_ie && typeof(baseHeight) !== 'number') { + textarea.focus(); + baseHeight = doc.selection.createRange().duplicate().boundingHeight; + + if (!document.forms[form_name]) { + document.body.focus(); + } + } +} + +/** +* bbstyle +*/ +function bbstyle(bbnumber) { + if (bbnumber !== -1) { + bbfontstyle(bbtags[bbnumber], bbtags[bbnumber+1]); + } else { + insert_text('[*]'); + document.forms[form_name].elements[text_name].focus(); + } +} + +/** +* Apply bbcodes +*/ +function bbfontstyle(bbopen, bbclose) { + theSelection = false; + + var textarea = document.forms[form_name].elements[text_name]; + + textarea.focus(); + + if ((clientVer >= 4) && is_ie && is_win) { + // Get text selection + theSelection = document.selection.createRange().text; + + if (theSelection) { + // Add tags around selection + document.selection.createRange().text = bbopen + theSelection + bbclose; + textarea.focus(); + theSelection = ''; + return; + } + } else if (textarea.selectionEnd && (textarea.selectionEnd - textarea.selectionStart > 0)) { + mozWrap(textarea, bbopen, bbclose); + textarea.focus(); + theSelection = ''; + return; + } + + //The new position for the cursor after adding the bbcode + var caret_pos = getCaretPosition(textarea).start; + var new_pos = caret_pos + bbopen.length; + + // Open tag + insert_text(bbopen + bbclose); + + // Center the cursor when we don't have a selection + // Gecko and proper browsers + if (!isNaN(textarea.selectionStart)) { + textarea.selectionStart = new_pos; + textarea.selectionEnd = new_pos; + } + // IE + else if (document.selection) { + var range = textarea.createTextRange(); + range.move("character", new_pos); + range.select(); + storeCaret(textarea); + } + + textarea.focus(); +} + +/** +* Insert text at position +*/ +function insert_text(text, spaces, popup) { + var textarea; + + if (!popup) { + textarea = document.forms[form_name].elements[text_name]; + } else { + textarea = opener.document.forms[form_name].elements[text_name]; + } + + if (spaces) { + text = ' ' + text + ' '; + } + + // Since IE9, IE also has textarea.selectionStart, but it still needs to be treated the old way. + // Therefore we simply add a !is_ie here until IE fixes the text-selection completely. + if (!isNaN(textarea.selectionStart) && !is_ie) { + var sel_start = textarea.selectionStart; + var sel_end = textarea.selectionEnd; + + mozWrap(textarea, text, ''); + textarea.selectionStart = sel_start + text.length; + textarea.selectionEnd = sel_end + text.length; + } else if (textarea.createTextRange && textarea.caretPos) { + if (baseHeight !== textarea.caretPos.boundingHeight) { + textarea.focus(); + storeCaret(textarea); + } + + var caret_pos = textarea.caretPos; + caret_pos.text = caret_pos.text.charAt(caret_pos.text.length - 1) === ' ' ? caret_pos.text + text + ' ' : caret_pos.text + text; + } else { + textarea.value = textarea.value + text; + } + + if (!popup) { + textarea.focus(); + } +} + +/** +* Add inline attachment at position +*/ +function attachInline(index, filename) { + insert_text('[attachment=' + index + ']' + filename + '[/attachment]'); + document.forms[form_name].elements[text_name].focus(); +} + +/** +* Add quote text to message +*/ +function addquote(post_id, username, l_wrote, attributes) { + var message_name = 'message_' + post_id; + var theSelection = ''; + var divarea = false; + var i; + + if (l_wrote === undefined) { + // Backwards compatibility + l_wrote = 'wrote'; + } + if (typeof attributes !== 'object') { + attributes = {}; + } + + if (document.all) { + divarea = document.all[message_name]; + } else { + divarea = document.getElementById(message_name); + } + + // Get text selection - not only the post content :( + // IE9 must use the document.selection method but has the *.getSelection so we just force no IE + if (window.getSelection && !is_ie && !window.opera) { + theSelection = window.getSelection().toString(); + } else if (document.getSelection && !is_ie) { + theSelection = document.getSelection(); + } else if (document.selection) { + theSelection = document.selection.createRange().text; + } + + if (theSelection === '' || typeof theSelection === 'undefined' || theSelection === null) { + if (divarea.innerHTML) { + theSelection = divarea.innerHTML.replace(/
/ig, '\n'); + theSelection = theSelection.replace(//ig, '\n'); + theSelection = theSelection.replace(/<\;/ig, '<'); + theSelection = theSelection.replace(/>\;/ig, '>'); + theSelection = theSelection.replace(/&\;/ig, '&'); + theSelection = theSelection.replace(/ \;/ig, ' '); + } else if (document.all) { + theSelection = divarea.innerText; + } else if (divarea.textContent) { + theSelection = divarea.textContent; + } else if (divarea.firstChild.nodeValue) { + theSelection = divarea.firstChild.nodeValue; + } + } + + if (theSelection) { + if (bbcodeEnabled) { + attributes.author = username; + insert_text(generateQuote(theSelection, attributes)); + } else { + insert_text(username + ' ' + l_wrote + ':' + '\n'); + var lines = split_lines(theSelection); + for (i = 0; i < lines.length; i++) { + insert_text('> ' + lines[i] + '\n'); + } + } + } +} + +/** +* Create a quote block for given text +* +* Possible attributes: +* - author: author's name (usually a username) +* - post_id: post_id of the post being quoted +* - user_id: user_id of the user being quoted +* - time: timestamp of the original message +* +* @param {!string} text Quote's text +* @param {!Object} attributes Quote's attributes +* @return {!string} Quote block to be used in a new post/text +*/ +function generateQuote(text, attributes) { + text = text.replace(/^\s+/, '').replace(/\s+$/, ''); + var quote = '[quote'; + if (attributes.author) { + // Add the author as the BBCode's default attribute + quote += '=' + formatAttributeValue(attributes.author); + delete attributes.author; + } + for (var name in attributes) { + if (attributes.hasOwnProperty(name)) { + var value = attributes[name]; + quote += ' ' + name + '=' + formatAttributeValue(value.toString()); + } + } + quote += ']'; + var newline = ((quote + text + '[/quote]').length > 80 || text.indexOf('\n') > -1) ? '\n' : ''; + quote += newline + text + newline + '[/quote]'; + + return quote; +} + +/** +* Format given string to be used as an attribute value +* +* Will return the string as-is if it can be used in a BBCode without quotes. Otherwise, +* it will use either single- or double- quotes depending on whichever requires less escaping. +* Quotes and backslashes are escaped with backslashes where necessary +* +* @param {!string} str Original string +* @return {!string} Same string if possible, escaped string within quotes otherwise +*/ +function formatAttributeValue(str) { + if (!/[ "'\\\]]/.test(str)) { + // Return as-is if it contains none of: space, ' " \ or ] + return str; + } + var singleQuoted = "'" + str.replace(/[\\']/g, '\\$&') + "'", + doubleQuoted = '"' + str.replace(/[\\"]/g, '\\$&') + '"'; + + return (singleQuoted.length < doubleQuoted.length) ? singleQuoted : doubleQuoted; +} + +function split_lines(text) { + var lines = text.split('\n'); + var splitLines = new Array(); + var j = 0; + var i; + + for(i = 0; i < lines.length; i++) { + if (lines[i].length <= 80) { + splitLines[j] = lines[i]; + j++; + } else { + var line = lines[i]; + var splitAt; + do { + splitAt = line.indexOf(' ', 80); + + if (splitAt === -1) { + splitLines[j] = line; + j++; + } else { + splitLines[j] = line.substring(0, splitAt); + line = line.substring(splitAt); + j++; + } + } + while(splitAt !== -1); + } + } + return splitLines; +} + +/** +* From http://www.massless.org/mozedit/ +*/ +function mozWrap(txtarea, open, close) { + var selLength = (typeof(txtarea.textLength) === 'undefined') ? txtarea.value.length : txtarea.textLength; + var selStart = txtarea.selectionStart; + var selEnd = txtarea.selectionEnd; + var scrollTop = txtarea.scrollTop; + + var s1 = (txtarea.value).substring(0,selStart); + var s2 = (txtarea.value).substring(selStart, selEnd); + var s3 = (txtarea.value).substring(selEnd, selLength); + + txtarea.value = s1 + open + s2 + close + s3; + txtarea.selectionStart = selStart + open.length; + txtarea.selectionEnd = selEnd + open.length; + txtarea.focus(); + txtarea.scrollTop = scrollTop; + + return; +} + +/** +* Insert at Caret position. Code from +* http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130 +*/ +function storeCaret(textEl) { + if (textEl.createTextRange && document.selection) { + textEl.caretPos = document.selection.createRange().duplicate(); + } +} + +/** +* Caret Position object +*/ +function caretPosition() { + var start = null; + var end = null; +} + +/** +* Get the caret position in an textarea +*/ +function getCaretPosition(txtarea) { + var caretPos = new caretPosition(); + + // simple Gecko/Opera way + if (txtarea.selectionStart || txtarea.selectionStart === 0) { + caretPos.start = txtarea.selectionStart; + caretPos.end = txtarea.selectionEnd; + } + // dirty and slow IE way + else if (document.selection) { + // get current selection + var range = document.selection.createRange(); + + // a new selection of the whole textarea + var range_all = document.body.createTextRange(); + range_all.moveToElementText(txtarea); + + // calculate selection start point by moving beginning of range_all to beginning of range + var sel_start; + for (sel_start = 0; range_all.compareEndPoints('StartToStart', range) < 0; sel_start++) { + range_all.moveStart('character', 1); + } + + txtarea.sel_start = sel_start; + + // we ignore the end value for IE, this is already dirty enough and we don't need it + caretPos.start = txtarea.sel_start; + caretPos.end = txtarea.sel_start; + } + + return caretPos; +} + +/** +* Allow to use tab character when typing code +* Keep indentation of last line of code when typing code +*/ +(function($) { + $(document).ready(function() { + var doc, textarea; + + // find textarea, make sure browser supports necessary functions + if (document.forms[form_name]) { + doc = document; + } else { + doc = opener.document; + } + + if (!doc.forms[form_name]) { + return; + } + + textarea = doc.forms[form_name].elements[text_name]; + + phpbb.applyCodeEditor(textarea); + if ($('#attach-panel').length) { + phpbb.showDragNDrop(textarea); + } + + $('textarea').on('keydown', function (e) { + if (e.which === 13 && (e.metaKey || e.ctrlKey)) { + $(this).closest('form').find(':submit').click(); + } + }); + }); +})(jQuery); + diff --git a/install/update/old/assets/javascript/plupload.js b/install/update/old/assets/javascript/plupload.js new file mode 100644 index 0000000..495d756 --- /dev/null +++ b/install/update/old/assets/javascript/plupload.js @@ -0,0 +1,657 @@ +/* global phpbb, plupload, attachInline */ + +plupload.addI18n(phpbb.plupload.i18n); +phpbb.plupload.ids = []; + +(function($) { // Avoid conflicts with other libraries + +'use strict'; + +/** + * Set up the uploader. + */ +phpbb.plupload.initialize = function() { + // Initialize the Plupload uploader. + phpbb.plupload.uploader.init(); + + // Set attachment data. + phpbb.plupload.setData(phpbb.plupload.data); + phpbb.plupload.updateMultipartParams(phpbb.plupload.getSerializedData()); + + // Only execute if Plupload initialized successfully. + phpbb.plupload.uploader.bind('Init', function() { + phpbb.plupload.form = $(phpbb.plupload.config.form_hook)[0]; + phpbb.plupload.rowTpl = $('#attach-row-tpl')[0].outerHTML; + + // Hide the basic upload panel and remove the attach row template. + $('#attach-row-tpl, #attach-panel-basic').remove(); + // Show multi-file upload options. + $('#attach-panel-multi').show(); + }); + + phpbb.plupload.uploader.bind('PostInit', function() { + // Point out the drag-and-drop zone if it's supported. + if (phpbb.plupload.uploader.features.dragdrop) { + $('#drag-n-drop-message').show(); + } + + // Ensure "Add files" button position is correctly calculated. + if ($('#attach-panel-multi').is(':visible')) { + phpbb.plupload.uploader.refresh(); + } + $('[data-subpanel="attach-panel"]').one('click', function() { + phpbb.plupload.uploader.refresh(); + }); + }); +}; + +/** + * Unsets all elements in the object uploader.settings.multipart_params whose keys + * begin with 'attachment_data[' + */ +phpbb.plupload.clearParams = function() { + var obj = phpbb.plupload.uploader.settings.multipart_params; + for (var key in obj) { + if (!obj.hasOwnProperty(key) || key.indexOf('attachment_data[') !== 0) { + continue; + } + + delete phpbb.plupload.uploader.settings.multipart_params[key]; + } +}; + +/** + * Update uploader.settings.multipart_params object with new data. + * + * @param {object} obj + */ +phpbb.plupload.updateMultipartParams = function(obj) { + var settings = phpbb.plupload.uploader.settings; + settings.multipart_params = $.extend(settings.multipart_params, obj); +}; + +/** + * Convert the array of attachment objects into an object that PHP would expect as POST data. + * + * @returns {object} An object in the form 'attachment_data[i][key]': value as + * expected by the server + */ +phpbb.plupload.getSerializedData = function() { + var obj = {}; + for (var i = 0; i < phpbb.plupload.data.length; i++) { + var datum = phpbb.plupload.data[i]; + for (var key in datum) { + if (!datum.hasOwnProperty(key)) { + continue; + } + + obj['attachment_data[' + i + '][' + key + ']'] = datum[key]; + } + } + return obj; +}; + +/** + * Get the index from the phpbb.plupload.data array where the given + * attachment id appears. + * + * @param {int} attachId The attachment id of the file. + * @returns {bool|int} Index of the file if exists, otherwise false. + */ +phpbb.plupload.getIndex = function(attachId) { + var index = $.inArray(Number(attachId), phpbb.plupload.ids); + return (index !== -1) ? index : false; +}; + +/** + * Set the data in phpbb.plupload.data and phpbb.plupload.ids arrays. + * + * @param {Array} data Array containing the new data to use. In the form of + * array(index => object(property: value). Requires attach_id to be one of the object properties. + */ +phpbb.plupload.setData = function(data) { + // Make sure that the array keys are reset. + phpbb.plupload.ids = phpbb.plupload.data = []; + phpbb.plupload.data = data; + + for (var i = 0; i < data.length; i++) { + phpbb.plupload.ids.push(Number(data[i].attach_id)); + } +}; + +/** + * Update the attachment data in the HTML and the phpbb & phpbb.plupload objects. + * + * @param {Array} data Array containing the new data to use. + * @param {string} action The action that required the update. Used to update the inline attachment bbcodes. + * @param {int} index The index from phpbb.plupload_ids that was affected by the action. + * @param {Array} downloadUrl Optional array of download urls to update. + */ +phpbb.plupload.update = function(data, action, index, downloadUrl) { + + phpbb.plupload.updateBbcode(action, index); + phpbb.plupload.setData(data); + phpbb.plupload.updateRows(downloadUrl); + phpbb.plupload.clearParams(); + phpbb.plupload.updateMultipartParams(phpbb.plupload.getSerializedData()); +}; + +/** + * Update the relevant elements and hidden data for all attachments. + * + * @param {Array} downloadUrl Optional array of download urls to update. + */ +phpbb.plupload.updateRows = function(downloadUrl) { + for (var i = 0; i < phpbb.plupload.ids.length; i++) { + phpbb.plupload.updateRow(i, downloadUrl); + } +}; + +/** + * Insert a row for a new attachment. This expects an HTML snippet in the HTML + * using the id "attach-row-tpl" to be present. This snippet is cloned and the + * data for the file inserted into it. The row is then appended or prepended to + * #file-list based on the attach_order setting. + * + * @param {object} file Plupload file object for the new attachment. + */ +phpbb.plupload.insertRow = function(file) { + var row = $(phpbb.plupload.rowTpl); + + row.attr('id', file.id); + row.find('.file-name').html(plupload.xmlEncode(file.name)); + row.find('.file-size').html(plupload.formatSize(file.size)); + + if (phpbb.plupload.order === 'desc') { + $('#file-list').prepend(row); + } else { + $('#file-list').append(row); + } +}; + +/** + * Update the relevant elements and hidden data for an attachment. + * + * @param {int} index The index from phpbb.plupload.ids of the attachment to edit. + * @param {Array} downloadUrl Optional array of download urls to update. + */ +phpbb.plupload.updateRow = function(index, downloadUrl) { + var attach = phpbb.plupload.data[index], + row = $('[data-attach-id="' + attach.attach_id + '"]'); + + // Add the link to the file + if (typeof downloadUrl !== 'undefined' && typeof downloadUrl[index] !== 'undefined') { + var url = downloadUrl[index].replace('&', '&'), + link = $(''); + + link.attr('href', url).html(attach.real_filename); + row.find('.file-name').html(link); + } + + row.find('textarea').attr('name', 'comment_list[' + index + ']'); + phpbb.plupload.updateHiddenData(row, attach, index); +}; + +/** + * Update hidden input data for an attachment. + * + * @param {object} row jQuery object for the attachment row. + * @param {object} attach Attachment data object from phpbb.plupload.data + * @param {int} index Attachment index from phpbb.plupload.ids + */ +phpbb.plupload.updateHiddenData = function(row, attach, index) { + row.find('input[type="hidden"]').remove(); + + for (var key in attach) { + if (!attach.hasOwnProperty(key)) { + return; + } + + var input = $('') + .attr('type', 'hidden') + .attr('name', 'attachment_data[' + index + '][' + key + ']') + .attr('value', attach[key]); + $(row).append(input); + } +}; + +/** + * Deleting a file removes it from the queue and fires an AJAX event to the + * server to tell it to remove the temporary attachment. The server + * responds with the updated attachment data list so that any future + * uploads can maintain state with the server + * + * @param {object} row jQuery object for the attachment row. + * @param {int} attachId Attachment id of the file to be removed. + */ +phpbb.plupload.deleteFile = function(row, attachId) { + // If there's no attach id, then the file hasn't been uploaded. Simply delete the row. + if (typeof attachId === 'undefined') { + var file = phpbb.plupload.uploader.getFile(row.attr('id')); + phpbb.plupload.uploader.removeFile(file); + + row.slideUp(100, function() { + row.remove(); + phpbb.plupload.hideEmptyList(); + }); + } + + var index = phpbb.plupload.getIndex(attachId); + row.find('.file-status').toggleClass('file-uploaded file-working'); + + if (index === false) { + return; + } + var fields = {}; + fields['delete_file[' + index + ']'] = 1; + + var always = function() { + row.find('.file-status').removeClass('file-working'); + }; + + var done = function(response) { + if (typeof response !== 'object') { + return; + } + + // trigger_error() was called which likely means a permission error was encountered. + if (typeof response.title !== 'undefined') { + phpbb.plupload.uploader.trigger('Error', { message: response.message }); + // We will have to assume that the deletion failed. So leave the file status as uploaded. + row.find('.file-status').toggleClass('file-uploaded'); + + return; + } + phpbb.plupload.update(response, 'removal', index); + // Check if the user can upload files now if he had reached the max files limit. + phpbb.plupload.handleMaxFilesReached(); + + if (row.attr('id')) { + var file = phpbb.plupload.uploader.getFile(row.attr('id')); + phpbb.plupload.uploader.removeFile(file); + } + row.slideUp(100, function() { + row.remove(); + // Hide the file list if it's empty now. + phpbb.plupload.hideEmptyList(); + }); + phpbb.plupload.uploader.trigger('FilesRemoved'); + }; + + $.ajax(phpbb.plupload.config.url, { + type: 'POST', + data: $.extend(fields, phpbb.plupload.getSerializedData()), + headers: phpbb.plupload.config.headers + }) + .always(always) + .done(done); +}; + +/** + * Check the attachment list and hide its container if it's empty. + */ +phpbb.plupload.hideEmptyList = function() { + if (!$('#file-list').children().length) { + $('#file-list-container').slideUp(100); + } +}; + +/** + * Update the indices used in inline attachment bbcodes. This ensures that the + * bbcodes correspond to the correct file after a file is added or removed. + * This should be called before the phpbb.plupload,data and phpbb.plupload.ids + * arrays are updated, otherwise it will not work correctly. + * + * @param {string} action The action that occurred -- either "addition" or "removal" + * @param {int} index The index of the attachment from phpbb.plupload.ids that was affected. + */ +phpbb.plupload.updateBbcode = function(action, index) { + var textarea = $('#message', phpbb.plupload.form), + text = textarea.val(), + removal = (action === 'removal'); + + // Return if the bbcode isn't used at all. + if (text.indexOf('[attachment=') === -1) { + return; + } + + function runUpdate(i) { + var regex = new RegExp('\\[attachment=' + i + '\\](.*?)\\[\\/attachment\\]', 'g'); + text = text.replace(regex, function updateBbcode(_, fileName) { + // Remove the bbcode if the file was removed. + if (removal && index === i) { + return ''; + } + var newIndex = i + ((removal) ? -1 : 1); + return '[attachment=' + newIndex + ']' + fileName + '[/attachment]'; + }); + } + + // Loop forwards when removing and backwards when adding ensures we don't + // corrupt the bbcode index. + var i; + if (removal) { + for (i = index; i < phpbb.plupload.ids.length; i++) { + runUpdate(i); + } + } else { + for (i = phpbb.plupload.ids.length - 1; i >= index; i--) { + runUpdate(i); + } + } + + textarea.val(text); +}; + +/** + * Get Plupload file objects based on their upload status. + * + * @param {int} status Plupload status - plupload.DONE, plupload.FAILED, + * plupload.QUEUED, plupload.STARTED, plupload.STOPPED + * + * @returns {Array} The Plupload file objects matching the status. + */ +phpbb.plupload.getFilesByStatus = function(status) { + var files = []; + + $.each(phpbb.plupload.uploader.files, function(i, file) { + if (file.status === status) { + files.push(file); + } + }); + return files; +}; + +/** + * Check whether the user has reached the maximun number of files that he's allowed + * to upload. If so, disables the uploader and marks the queued files as failed. Otherwise + * makes sure that the uploader is enabled. + * + * @returns {bool} True if the limit has been reached. False if otherwise. + */ +phpbb.plupload.handleMaxFilesReached = function() { + // If there is no limit, the user is an admin or moderator. + if (!phpbb.plupload.maxFiles) { + return false; + } + + if (phpbb.plupload.maxFiles <= phpbb.plupload.ids.length) { + // Fail the rest of the queue. + phpbb.plupload.markQueuedFailed(phpbb.plupload.lang.TOO_MANY_ATTACHMENTS); + // Disable the uploader. + phpbb.plupload.disableUploader(); + phpbb.plupload.uploader.trigger('Error', { message: phpbb.plupload.lang.TOO_MANY_ATTACHMENTS }); + + return true; + } else if (phpbb.plupload.maxFiles > phpbb.plupload.ids.length) { + // Enable the uploader if the user is under the limit + phpbb.plupload.enableUploader(); + } + return false; +}; + +/** + * Disable the uploader + */ +phpbb.plupload.disableUploader = function() { + $('#add_files').addClass('disabled'); + phpbb.plupload.uploader.disableBrowse(); +}; + +/** + * Enable the uploader + */ +phpbb.plupload.enableUploader = function() { + $('#add_files').removeClass('disabled'); + phpbb.plupload.uploader.disableBrowse(false); +}; + +/** + * Mark all queued files as failed. + * + * @param {string} error Error message to present to the user. + */ +phpbb.plupload.markQueuedFailed = function(error) { + var files = phpbb.plupload.getFilesByStatus(plupload.QUEUED); + + $.each(files, function(i, file) { + $('#' + file.id).find('.file-progress').hide(); + phpbb.plupload.fileError(file, error); + }); +}; + +/** + * Marks a file as failed and sets the error message for it. + * + * @param {object} file Plupload file object that failed. + * @param {string} error Error message to present to the user. + */ +phpbb.plupload.fileError = function(file, error) { + file.status = plupload.FAILED; + file.error = error; + $('#' + file.id).find('.file-status') + .addClass('file-error') + .attr({ + 'data-error-title': phpbb.plupload.lang.ERROR, + 'data-error-message': error + }); +}; + + +/** + * Set up the Plupload object and get some basic data. + */ +phpbb.plupload.uploader = new plupload.Uploader(phpbb.plupload.config); +phpbb.plupload.initialize(); + +var $fileList = $('#file-list'); + +/** + * Insert inline attachment bbcode. + */ +$fileList.on('click', '.file-inline-bbcode', function(e) { + var attachId = $(this).parents('.attach-row').attr('data-attach-id'), + index = phpbb.plupload.getIndex(attachId); + + attachInline(index, phpbb.plupload.data[index].real_filename); + e.preventDefault(); +}); + +/** + * Delete a file. + */ +$fileList.on('click', '.file-delete', function(e) { + var row = $(this).parents('.attach-row'), + attachId = row.attr('data-attach-id'); + + phpbb.plupload.deleteFile(row, attachId); + e.preventDefault(); +}); + +/** + * Display the error message for a particular file when the error icon is clicked. + */ +$fileList.on('click', '.file-error', function(e) { + phpbb.alert($(this).attr('data-error-title'), $(this).attr('data-error-message')); + e.preventDefault(); +}); + +/** + * Fires when an error occurs. + */ +phpbb.plupload.uploader.bind('Error', function(up, error) { + error.file.name = plupload.xmlEncode(error.file.name); + + // The error message that Plupload provides for these is vague, so we'll be more specific. + if (error.code === plupload.FILE_EXTENSION_ERROR) { + error.message = plupload.translate('Invalid file extension:') + ' ' + error.file.name; + } else if (error.code === plupload.FILE_SIZE_ERROR) { + error.message = plupload.translate('File too large:') + ' ' + error.file.name; + } + phpbb.alert(phpbb.plupload.lang.ERROR, error.message); +}); + +/** + * Fires before a given file is about to be uploaded. This allows us to + * send the real filename along with the chunk. This is necessary because + * for some reason the filename is set to 'blob' whenever a file is chunked + * + * @param {object} up The plupload.Uploader object + * @param {object} file The plupload.File object that is about to be uploaded + */ +phpbb.plupload.uploader.bind('BeforeUpload', function(up, file) { + if (phpbb.plupload.handleMaxFilesReached()) { + return; + } + + phpbb.plupload.updateMultipartParams({ real_filename: file.name }); +}); + +/** + * Fired when a single chunk of any given file is uploaded. This parses the + * response from the server and checks for an error. If an error occurs it + * is reported to the user and the upload of this particular file is halted + * + * @param {object} up The plupload.Uploader object + * @param {object} file The plupload.File object whose chunk has just + * been uploaded + * @param {object} response The response object from the server + */ +phpbb.plupload.uploader.bind('ChunkUploaded', function(up, file, response) { + if (response.chunk >= response.chunks - 1) { + return; + } + + var json = {}; + try { + json = $.parseJSON(response.response); + } catch (e) { + file.status = plupload.FAILED; + up.trigger('FileUploaded', file, { + response: JSON.stringify({ + error: { + message: 'Error parsing server response.' + } + }) + }); + } + + // If trigger_error() was called, then a permission error likely occurred. + if (typeof json.title !== 'undefined') { + json.error = { message: json.message }; + } + + if (json.error) { + file.status = plupload.FAILED; + up.trigger('FileUploaded', file, { + response: JSON.stringify({ + error: { + message: json.error.message + } + }) + }); + } +}); + +/** + * Fires when files are added to the queue. + */ +phpbb.plupload.uploader.bind('FilesAdded', function(up, files) { + // Prevent unnecessary requests to the server if the user already uploaded + // the maximum number of files allowed. + if (phpbb.plupload.handleMaxFilesReached()) { + return; + } + + // Switch the active tab if the style supports it + if (typeof activateSubPanel === 'function') { + activateSubPanel('attach-panel'); // jshint ignore: line + } + + // Show the file list if there aren't any files currently. + var $fileListContainer = $('#file-list-container'); + if (!$fileListContainer.is(':visible')) { + $fileListContainer.show(100); + } + + $.each(files, function(i, file) { + phpbb.plupload.insertRow(file); + }); + + up.bind('UploadProgress', function(up, file) { + $('.file-progress-bar', '#' + file.id).css('width', file.percent + '%'); + $('#file-total-progress-bar').css('width', up.total.percent + '%'); + }); + + // Do not allow more files to be added to the running queue. + phpbb.plupload.disableUploader(); + + // Start uploading the files once the user has selected them. + up.start(); +}); + + +/** + * Fires when an entire file has been uploaded. It checks for errors + * returned by the server otherwise parses the list of attachment data and + * appends it to the next file upload so that the server can maintain state + * with regards to the attachments in a given post + * + * @param {object} up The plupload.Uploader object + * @param {object} file The plupload.File object that has just been + * uploaded + * @param {string} response The response string from the server + */ +phpbb.plupload.uploader.bind('FileUploaded', function(up, file, response) { + var json = {}, + row = $('#' + file.id), + error; + + // Hide the progress indicator. + row.find('.file-progress').hide(); + + try { + json = JSON.parse(response.response); + } catch (e) { + error = 'Error parsing server response.'; + } + + // If trigger_error() was called, then a permission error likely occurred. + if (typeof json.title !== 'undefined') { + error = json.message; + up.trigger('Error', { message: error }); + + // The rest of the queue will fail. + phpbb.plupload.markQueuedFailed(error); + } else if (json.error) { + error = json.error.message; + } + + if (typeof error !== 'undefined') { + phpbb.plupload.fileError(file, error); + } else if (file.status === plupload.DONE) { + file.attachment_data = json.data[0]; + + row.attr('data-attach-id', file.attachment_data.attach_id); + row.find('.file-inline-bbcode').show(); + row.find('.file-status').addClass('file-uploaded'); + phpbb.plupload.update(json.data, 'addition', 0, [json.download_url]); + } +}); + +/** + * Fires when the entire queue of files have been uploaded. + */ +phpbb.plupload.uploader.bind('UploadComplete', function() { + // Hide the progress bar + setTimeout(function() { + $('#file-total-progress-bar').fadeOut(500, function() { + $(this).css('width', 0).show(); + }); + }, 2000); + + // Re-enable the uploader + phpbb.plupload.enableUploader(); +}); + +})(jQuery); // Avoid conflicts with other libraries diff --git a/install/update/old/common.php b/install/update/old/common.php new file mode 100644 index 0000000..172503f --- /dev/null +++ b/install/update/old/common.php @@ -0,0 +1,164 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* Minimum Requirement: PHP 5.4.0 +*/ + +if (!defined('IN_PHPBB')) +{ + exit; +} + +require($phpbb_root_path . 'includes/startup.' . $phpEx); +require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); + +$phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); +$phpbb_class_loader->register(); + +$phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); +extract($phpbb_config_php_file->get_all()); + +if (!defined('PHPBB_ENVIRONMENT')) +{ + @define('PHPBB_ENVIRONMENT', 'production'); +} + +if (!defined('PHPBB_INSTALLED')) +{ + // Redirect the user to the installer + require($phpbb_root_path . 'includes/functions.' . $phpEx); + + // We have to generate a full HTTP/1.1 header here since we can't guarantee to have any of the information + // available as used by the redirect function + $server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME')); + $server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT'); + $secure = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 1 : 0; + + if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') + { + $secure = 1; + $server_port = 443; + } + + $script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF'); + if (!$script_name) + { + $script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI'); + } + + // $phpbb_root_path accounts for redirects from e.g. /adm + $script_path = trim(dirname($script_name)) . '/' . $phpbb_root_path . 'install/app.' . $phpEx; + // Replace any number of consecutive backslashes and/or slashes with a single slash + // (could happen on some proxy setups and/or Windows servers) + $script_path = preg_replace('#[\\\\/]{2,}#', '/', $script_path); + + // Eliminate . and .. from the path + require($phpbb_root_path . 'phpbb/filesystem.' . $phpEx); + $phpbb_filesystem = new phpbb\filesystem\filesystem(); + $script_path = $phpbb_filesystem->clean_path($script_path); + + $url = (($secure) ? 'https://' : 'http://') . $server_name; + + if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80))) + { + // HTTP HOST can carry a port number... + if (strpos($server_name, ':') === false) + { + $url .= ':' . $server_port; + } + } + + $url .= $script_path; + header('Location: ' . $url); + exit; +} + +// In case $phpbb_adm_relative_path is not set (in case of an update), use the default. +$phpbb_adm_relative_path = (isset($phpbb_adm_relative_path)) ? $phpbb_adm_relative_path : 'adm/'; +$phpbb_admin_path = (defined('PHPBB_ADMIN_PATH')) ? PHPBB_ADMIN_PATH : $phpbb_root_path . $phpbb_adm_relative_path; + +// Include files +require($phpbb_root_path . 'includes/functions.' . $phpEx); +require($phpbb_root_path . 'includes/functions_content.' . $phpEx); +include($phpbb_root_path . 'includes/functions_compatibility.' . $phpEx); + +require($phpbb_root_path . 'includes/constants.' . $phpEx); +require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + +if (PHPBB_ENVIRONMENT === 'development') +{ + \phpbb\debug\debug::enable(); +} +else +{ + set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); +} + +$phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); +$phpbb_class_loader_ext->register(); + +// Set up container +try +{ + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); + $phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container(); +} +catch (InvalidArgumentException $e) +{ + if (PHPBB_ENVIRONMENT !== 'development') + { + trigger_error( + 'The requested environment ' . PHPBB_ENVIRONMENT . ' is not available.', + E_USER_ERROR + ); + } + else + { + throw $e; + } +} + +$phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); +$phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); + +require($phpbb_root_path . 'includes/compatibility_globals.' . $phpEx); + +register_compatibility_globals(); + +// Add own hook handler +require($phpbb_root_path . 'includes/hooks/index.' . $phpEx); +$phpbb_hook = new phpbb_hook(array('exit_handler', 'phpbb_user_session_handler', 'append_sid', array('template', 'display'))); + +/* @var $phpbb_hook_finder \phpbb\hook\finder */ +$phpbb_hook_finder = $phpbb_container->get('hook_finder'); + +foreach ($phpbb_hook_finder->find() as $hook) +{ + @include($phpbb_root_path . 'includes/hooks/' . $hook . '.' . $phpEx); +} + +/** +* Main event which is triggered on every page +* +* You can use this event to load function files and initiate objects +* +* NOTE: At this point the global session ($user) and permissions ($auth) +* do NOT exist yet. If you need to use the user object +* (f.e. to include language files) or need to check permissions, +* please use the core.user_setup event instead! +* +* @event core.common +* @since 3.1.0-a1 +*/ +$phpbb_dispatcher->dispatch('core.common'); diff --git a/install/update/old/composer.json b/install/update/old/composer.json new file mode 100644 index 0000000..d192fd5 --- /dev/null +++ b/install/update/old/composer.json @@ -0,0 +1,75 @@ +{ + "name": "phpbb/phpbb", + "description": "phpBB Forum Software application", + "type": "project", + "keywords": ["phpbb", "forum"], + "homepage": "https://www.phpbb.com", + "license": "GPL-2.0-only", + "authors": [ + { + "name": "phpBB Limited", + "email": "operations@phpbb.com", + "homepage": "https://www.phpbb.com/go/authors" + } + ], + "support": { + "issues": "https://tracker.phpbb.com", + "forum": "https://www.phpbb.com/community/", + "wiki": "https://wiki.phpbb.com", + "irc": "irc://irc.freenode.org/phpbb" + }, + "scripts": { + "post-update-cmd": "echo 'You MUST manually modify the clean-vendor-dir target in build/build.xml when adding or upgrading dependencies.'" + }, + "replace": { + "phpbb/phpbb-core": "self.version" + }, + "require": { + "php": ">=5.4", + "bantu/ini-get-wrapper": "1.0.*", + "google/recaptcha": "~1.1", + "guzzlehttp/guzzle": "~5.3", + "lusitanian/oauth": "^0.8.1", + "marc1706/fast-image-size": "^1.1", + "paragonie/random_compat": "^1.4", + "patchwork/utf8": "^1.1", + "s9e/text-formatter": "^1.3", + "symfony/config": "^2.8", + "symfony/console": "^2.8", + "symfony/debug": "^2.8", + "symfony/dependency-injection": "^2.8", + "symfony/event-dispatcher": "^2.8", + "symfony/filesystem": "^2.8", + "symfony/finder": "^2.8", + "symfony/http-foundation": "^2.8", + "symfony/http-kernel": "^2.8", + "symfony/proxy-manager-bridge": "^2.8", + "symfony/routing": "^2.8", + "symfony/twig-bridge": "^2.8", + "symfony/yaml": "^2.8", + "twig/twig": "^1.0" + }, + "require-dev": { + "fabpot/goutte": "~2.0", + "facebook/webdriver": "~1.1", + "laravel/homestead": "~2.2", + "phing/phing": "2.4.*", + "phpunit/dbunit": "1.3.*", + "phpunit/phpunit": "^4.1", + "sami/sami": "1.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/browser-kit": "^2.8", + "symfony/css-selector": "^2.8", + "symfony/dom-crawler": "^2.8" + }, + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "config": { + "platform": { + "php": "5.4.7" + } + } +} diff --git a/install/update/old/composer.lock b/install/update/old/composer.lock new file mode 100644 index 0000000..2c338bf --- /dev/null +++ b/install/update/old/composer.lock @@ -0,0 +1,3644 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "6daa2f5f7a161377dee1835bd4d5b463", + "packages": [ + { + "name": "bantu/ini-get-wrapper", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/bantuXorg/php-ini-get-wrapper.git", + "reference": "4770c7feab370c62e23db4f31c112b7c6d90aee2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/bantuXorg/php-ini-get-wrapper/zipball/4770c7feab370c62e23db4f31c112b7c6d90aee2", + "reference": "4770c7feab370c62e23db4f31c112b7c6d90aee2", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "bantu\\IniGetWrapper\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Convenience wrapper around ini_get()", + "time": "2014-09-15T13:12:35+00:00" + }, + { + "name": "google/recaptcha", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/google/recaptcha.git", + "reference": "2b7e00566afca82a38a1d3adb8e42c118006296e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/recaptcha/zipball/2b7e00566afca82a38a1d3adb8e42c118006296e", + "reference": "2b7e00566afca82a38a1d3adb8e42c118006296e", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "4.5.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "ReCaptcha\\": "src/ReCaptcha" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "Client library for reCAPTCHA, a free service that protect websites from spam and abuse.", + "homepage": "http://www.google.com/recaptcha/", + "keywords": [ + "Abuse", + "captcha", + "recaptcha", + "spam" + ], + "time": "2015-09-02T17:23:59+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "5.3.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "93bbdb30d59be6cd9839495306c65f2907370eb9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/93bbdb30d59be6cd9839495306c65f2907370eb9", + "reference": "93bbdb30d59be6cd9839495306c65f2907370eb9", + "shasum": "" + }, + "require": { + "guzzlehttp/ringphp": "^1.1", + "php": ">=5.4.0", + "react/promise": "^2.2" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2018-07-31T13:33:10+00:00" + }, + { + "name": "guzzlehttp/ringphp", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/RingPHP.git", + "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/5e2a174052995663dd68e6b5ad838afd47dd615b", + "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b", + "shasum": "" + }, + "require": { + "guzzlehttp/streams": "~3.0", + "php": ">=5.4.0", + "react/promise": "~2.0" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "ext-curl": "Guzzle will use specific adapters if cURL is present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Ring\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function.", + "time": "2018-07-31T13:22:33+00:00" + }, + { + "name": "guzzlehttp/streams", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/streams.git", + "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", + "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Provides a simple abstraction over streams of data", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "Guzzle", + "stream" + ], + "time": "2014-10-12T19:18:40+00:00" + }, + { + "name": "ircmaxell/password-compat", + "version": "v1.0.4", + "source": { + "type": "git", + "url": "https://github.com/ircmaxell/password_compat.git", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", + "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "autoload": { + "files": [ + "lib/password.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Anthony Ferrara", + "email": "ircmaxell@php.net", + "homepage": "http://blog.ircmaxell.com" + } + ], + "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", + "homepage": "https://github.com/ircmaxell/password_compat", + "keywords": [ + "hashing", + "password" + ], + "time": "2014-11-20T16:49:30+00:00" + }, + { + "name": "lusitanian/oauth", + "version": "v0.8.11", + "source": { + "type": "git", + "url": "https://github.com/Lusitanian/PHPoAuthLib.git", + "reference": "fc11a53db4b66da555a6a11fce294f574a8374f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Lusitanian/PHPoAuthLib/zipball/fc11a53db4b66da555a6a11fce294f574a8374f9", + "reference": "fc11a53db4b66da555a6a11fce294f574a8374f9", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*", + "predis/predis": "0.8.*@dev", + "squizlabs/php_codesniffer": "2.*", + "symfony/http-foundation": "~2.1" + }, + "suggest": { + "ext-openssl": "Allows for usage of secure connections with the stream-based HTTP client.", + "predis/predis": "Allows using the Redis storage backend.", + "symfony/http-foundation": "Allows using the Symfony Session storage backend." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.1-dev" + } + }, + "autoload": { + "psr-0": { + "OAuth": "src", + "OAuth\\Unit": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David Desberg", + "email": "david@daviddesberg.com" + }, + { + "name": "Elliot Chance", + "email": "elliotchance@gmail.com" + }, + { + "name": "Pieter Hordijk", + "email": "info@pieterhordijk.com" + } + ], + "description": "PHP 5.3+ oAuth 1/2 Library", + "keywords": [ + "Authentication", + "authorization", + "oauth", + "security" + ], + "time": "2016-07-12T22:15:00+00:00" + }, + { + "name": "marc1706/fast-image-size", + "version": "v1.1.4", + "source": { + "type": "git", + "url": "https://github.com/marc1706/fast-image-size.git", + "reference": "c4ded0223a4e49ae45a2183a69f6afac5baf7250" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/marc1706/fast-image-size/zipball/c4ded0223a4e49ae45a2183a69f6afac5baf7250", + "reference": "c4ded0223a4e49ae45a2183a69f6afac5baf7250", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "FastImageSize\\": "lib", + "FastImageSize\\tests\\": "tests" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marc Alexander", + "email": "admin@m-a-styles.de", + "homepage": "https://www.m-a-styles.de", + "role": "Developer" + } + ], + "description": "fast-image-size is a PHP library that does almost everything PHP's getimagesize() does but without the large overhead of downloading the complete file.", + "homepage": "https://www.m-a-styles.de", + "keywords": [ + "fast", + "getimagesize", + "image", + "imagesize", + "php", + "size" + ], + "time": "2017-10-23T18:52:01+00:00" + }, + { + "name": "ocramius/proxy-manager", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/ProxyManager.git", + "reference": "57e9272ec0e8deccf09421596e0e2252df440e11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/57e9272ec0e8deccf09421596e0e2252df440e11", + "reference": "57e9272ec0e8deccf09421596e0e2252df440e11", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "zendframework/zend-code": ">2.2.5,<3.0" + }, + "require-dev": { + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "1.5.*" + }, + "suggest": { + "ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects", + "zendframework/zend-json": "To have the JsonRpc adapter (Remote Object feature)", + "zendframework/zend-soap": "To have the Soap adapter (Remote Object feature)", + "zendframework/zend-stdlib": "To use the hydrator proxy", + "zendframework/zend-xmlrpc": "To have the XmlRpc adapter (Remote Object feature)" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "ProxyManager\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A library providing utilities to generate, instantiate and generally operate with Object Proxies", + "homepage": "https://github.com/Ocramius/ProxyManager", + "keywords": [ + "aop", + "lazy loading", + "proxy", + "proxy pattern", + "service proxies" + ], + "time": "2015-08-09T04:28:19+00:00" + }, + { + "name": "paragonie/random_compat", + "version": "v1.4.3", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "9b3899e3c3ddde89016f576edb8c489708ad64cd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/9b3899e3c3ddde89016f576edb8c489708ad64cd", + "reference": "9b3899e3c3ddde89016f576edb8c489708ad64cd", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2017-03-13T16:22:52+00:00" + }, + { + "name": "patchwork/utf8", + "version": "v1.3.1", + "source": { + "type": "git", + "url": "https://github.com/tchwork/utf8.git", + "reference": "30ec6451aec7d2536f0af8fe535f70c764f2c47a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/tchwork/utf8/zipball/30ec6451aec7d2536f0af8fe535f70c764f2c47a", + "reference": "30ec6451aec7d2536f0af8fe535f70c764f2c47a", + "shasum": "" + }, + "require": { + "lib-pcre": ">=7.3", + "php": ">=5.3.0" + }, + "suggest": { + "ext-iconv": "Use iconv for best performance", + "ext-intl": "Use Intl for best performance", + "ext-mbstring": "Use Mbstring for best performance", + "ext-wfio": "Use WFIO for UTF-8 filesystem access on Windows" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Patchwork\\": "src/Patchwork/" + }, + "classmap": [ + "src/Normalizer.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "(Apache-2.0 or GPL-2.0)" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + } + ], + "description": "Portable and performant UTF-8, Unicode and Grapheme Clusters for PHP", + "homepage": "https://github.com/tchwork/utf8", + "keywords": [ + "grapheme", + "i18n", + "unicode", + "utf-8", + "utf8" + ], + "time": "2016-05-18T13:57:10+00:00" + }, + { + "name": "psr/log", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2018-11-20T15:27:04+00:00" + }, + { + "name": "react/promise", + "version": "v2.7.1", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/31ffa96f8d2ed0341a57848cbb84d88b89dd664d", + "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d", + "shasum": "" + }, + "require": { + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "time": "2019-01-07T21:25:54+00:00" + }, + { + "name": "s9e/text-formatter", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/s9e/TextFormatter.git", + "reference": "dc7efff70b67b9cee00881ad3bef0a1da076b31e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/dc7efff70b67b9cee00881ad3bef0a1da076b31e", + "reference": "dc7efff70b67b9cee00881ad3bef0a1da076b31e", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-filter": "*", + "lib-pcre": ">=7.2", + "php": ">=5.4.7" + }, + "require-dev": { + "matthiasmullie/minify": "*", + "php-coveralls/php-coveralls": "*", + "s9e/regexp-builder": "1.*" + }, + "suggest": { + "ext-curl": "Improves the performance of the MediaEmbed plugin and some JavaScript minifiers", + "ext-intl": "Allows international URLs to be accepted by the URL filter", + "ext-json": "Enables the generation of a JavaScript parser", + "ext-mbstring": "Improves the performance of the PHP renderer", + "ext-tokenizer": "Improves the performance of the PHP renderer", + "ext-xsl": "Enables the XSLT renderer", + "ext-zlib": "Enables gzip compression when scraping content via the MediaEmbed plugin" + }, + "type": "library", + "autoload": { + "psr-4": { + "s9e\\TextFormatter\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Multi-purpose text formatting and markup library. Plugins offer support for BBCodes, Markdown, emoticons, HTML, embedding media (YouTube, etc...), enhanced typography and more.", + "homepage": "https://github.com/s9e/TextFormatter/", + "keywords": [ + "bbcode", + "bbcodes", + "blog", + "censor", + "embed", + "emoji", + "emoticons", + "engine", + "forum", + "html", + "markdown", + "markup", + "media", + "parser", + "shortcodes" + ], + "time": "2019-03-27T14:19:41+00:00" + }, + { + "name": "symfony/config", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/config.git", + "reference": "7dd5f5040dc04c118d057fb5886563963eb70011" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/config/zipball/7dd5f5040dc04c118d057fb5886563963eb70011", + "reference": "7dd5f5040dc04c118d057fb5886563963eb70011", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/filesystem": "~2.3|~3.0.0", + "symfony/polyfill-ctype": "~1.8" + }, + "require-dev": { + "symfony/yaml": "~2.7|~3.0.0" + }, + "suggest": { + "symfony/yaml": "To use the yaml reference dumper" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Config\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Config Component", + "homepage": "https://symfony.com", + "time": "2018-11-26T09:38:12+00:00" + }, + { + "name": "symfony/console", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12", + "reference": "cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/debug": "^2.7.2|~3.0.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/event-dispatcher": "~2.1|~3.0.0", + "symfony/process": "~2.1|~3.0.0" + }, + "suggest": { + "psr/log-implementation": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2018-11-20T15:55:20+00:00" + }, + { + "name": "symfony/debug", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/debug.git", + "reference": "74251c8d50dd3be7c4ce0c7b862497cdc641a5d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/debug/zipball/74251c8d50dd3be7c4ce0c7b862497cdc641a5d0", + "reference": "74251c8d50dd3be7c4ce0c7b862497cdc641a5d0", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.2|~3.0.0", + "symfony/http-kernel": "~2.3.24|~2.5.9|^2.6.2|~3.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T11:18:13+00:00" + }, + { + "name": "symfony/dependency-injection", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/dependency-injection.git", + "reference": "a2f40df187f0053bc361bcea3b27ff2b85744d9f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a2f40df187f0053bc361bcea3b27ff2b85744d9f", + "reference": "a2f40df187f0053bc361bcea3b27ff2b85744d9f", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "conflict": { + "symfony/expression-language": "<2.6" + }, + "require-dev": { + "symfony/config": "~2.2|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/yaml": "~2.3.42|~2.7.14|~2.8.7|~3.0.7" + }, + "suggest": { + "symfony/config": "", + "symfony/expression-language": "For using expressions in service container configuration", + "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", + "symfony/yaml": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DependencyInjection\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DependencyInjection Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T11:18:13+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a77e974a5fecb4398833b0709210e3d5e334ffb0", + "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "^2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.6|~3.0.0", + "symfony/expression-language": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0" + }, + "suggest": { + "symfony/dependency-injection": "", + "symfony/http-kernel": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony EventDispatcher Component", + "homepage": "https://symfony.com", + "time": "2018-11-21T14:20:20+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "7ae46872dad09dffb7fe1e93a0937097339d0080" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/7ae46872dad09dffb7fe1e93a0937097339d0080", + "reference": "7ae46872dad09dffb7fe1e93a0937097339d0080", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T11:18:13+00:00" + }, + { + "name": "symfony/finder", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "1444eac52273e345d9b95129bf914639305a9ba4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/1444eac52273e345d9b95129bf914639305a9ba4", + "reference": "1444eac52273e345d9b95129bf914639305a9ba4", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T11:18:13+00:00" + }, + { + "name": "symfony/http-foundation", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-foundation.git", + "reference": "d0ab719bedc9fc6748a95b2dcb04137292a27b92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d0ab719bedc9fc6748a95b2dcb04137292a27b92", + "reference": "d0ab719bedc9fc6748a95b2dcb04137292a27b92", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php54": "~1.0", + "symfony/polyfill-php55": "~1.0" + }, + "require-dev": { + "symfony/expression-language": "~2.4|~3.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpFoundation\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpFoundation Component", + "homepage": "https://symfony.com", + "time": "2018-11-25T11:27:05+00:00" + }, + { + "name": "symfony/http-kernel", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-kernel.git", + "reference": "3df0207d4c973eb9c91b38a608aef4654dc256fa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3df0207d4c973eb9c91b38a608aef4654dc256fa", + "reference": "3df0207d4c973eb9c91b38a608aef4654dc256fa", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "psr/log": "~1.0", + "symfony/debug": "^2.6.2", + "symfony/event-dispatcher": "^2.6.7|~3.0.0", + "symfony/http-foundation": "~2.7.36|~2.8.29|~3.1.6", + "symfony/polyfill-ctype": "~1.8" + }, + "conflict": { + "symfony/config": "<2.7", + "twig/twig": "<1.34|<2.4,>=2" + }, + "require-dev": { + "symfony/browser-kit": "~2.3|~3.0.0", + "symfony/class-loader": "~2.1|~3.0.0", + "symfony/config": "~2.8", + "symfony/console": "~2.3|~3.0.0", + "symfony/css-selector": "^2.0.5|~3.0.0", + "symfony/dependency-injection": "~2.8|~3.0.0", + "symfony/dom-crawler": "^2.0.5|~3.0.0", + "symfony/expression-language": "~2.4|~3.0.0", + "symfony/finder": "^2.0.5|~3.0.0", + "symfony/process": "^2.0.5|~3.0.0", + "symfony/routing": "~2.8|~3.0.0", + "symfony/stopwatch": "~2.3|~3.0.0", + "symfony/templating": "~2.2|~3.0.0", + "symfony/translation": "^2.0.5|~3.0.0", + "symfony/var-dumper": "~2.6|~3.0.0" + }, + "suggest": { + "symfony/browser-kit": "", + "symfony/class-loader": "", + "symfony/config": "", + "symfony/console": "", + "symfony/dependency-injection": "", + "symfony/finder": "", + "symfony/var-dumper": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpKernel\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony HttpKernel Component", + "homepage": "https://symfony.com", + "time": "2018-12-06T14:45:07+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "82ebae02209c21113908c229e9883c419720738a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", + "reference": "82ebae02209c21113908c229e9883c419720738a", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "backendtea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", + "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/polyfill-php54", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php54.git", + "reference": "2964b17ddc32dba7bcba009d5501c84d3fba1452" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/2964b17ddc32dba7bcba009d5501c84d3fba1452", + "reference": "2964b17ddc32dba7bcba009d5501c84d3fba1452", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php54\\": "" + }, + "files": [ + "bootstrap.php" + ], + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/polyfill-php55", + "version": "v1.11.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php55.git", + "reference": "96fa25cef405ea452919559a0025d5dc16e30e4c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/96fa25cef405ea452919559a0025d5dc16e30e4c", + "reference": "96fa25cef405ea452919559a0025d5dc16e30e4c", + "shasum": "" + }, + "require": { + "ircmaxell/password-compat": "~1.0", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.11-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php55\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "time": "2019-02-06T07:57:58+00:00" + }, + { + "name": "symfony/proxy-manager-bridge", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/proxy-manager-bridge.git", + "reference": "9c5f8d58e9c8017affdbeaec86c89d558aee4ec8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/9c5f8d58e9c8017affdbeaec86c89d558aee4ec8", + "reference": "9c5f8d58e9c8017affdbeaec86c89d558aee4ec8", + "shasum": "" + }, + "require": { + "ocramius/proxy-manager": "~0.4|~1.0|~2.0", + "php": ">=5.3.9", + "symfony/dependency-injection": "~2.8|~3.0.0" + }, + "require-dev": { + "symfony/config": "~2.3|~3.0.0" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\ProxyManager\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony ProxyManager Bridge", + "homepage": "https://symfony.com", + "time": "2018-11-11T11:18:13+00:00" + }, + { + "name": "symfony/routing", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/routing.git", + "reference": "8b0df6869d1997baafff6a1541826eac5a03d067" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/routing/zipball/8b0df6869d1997baafff6a1541826eac5a03d067", + "reference": "8b0df6869d1997baafff6a1541826eac5a03d067", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "conflict": { + "symfony/config": "<2.7" + }, + "require-dev": { + "doctrine/annotations": "~1.0", + "psr/log": "~1.0", + "symfony/config": "~2.7|~3.0.0", + "symfony/expression-language": "~2.4|~3.0.0", + "symfony/http-foundation": "~2.3|~3.0.0", + "symfony/yaml": "^2.0.5|~3.0.0" + }, + "suggest": { + "doctrine/annotations": "For using the annotation loader", + "symfony/config": "For using the all-in-one router or any loader", + "symfony/dependency-injection": "For loading routes from a service", + "symfony/expression-language": "For using expression matching", + "symfony/http-foundation": "For using a Symfony Request object", + "symfony/yaml": "For using the YAML loader" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Routing\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Routing Component", + "homepage": "https://symfony.com", + "keywords": [ + "router", + "routing", + "uri", + "url" + ], + "time": "2018-11-20T15:55:20+00:00" + }, + { + "name": "symfony/twig-bridge", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/twig-bridge.git", + "reference": "ecc1e30d05fa99f25b504e2d6a8684555ae39f7c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/ecc1e30d05fa99f25b504e2d6a8684555ae39f7c", + "reference": "ecc1e30d05fa99f25b504e2d6a8684555ae39f7c", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "twig/twig": "~1.34|~2.4" + }, + "conflict": { + "symfony/form": "<2.8.23" + }, + "require-dev": { + "symfony/asset": "~2.7|~3.0.0", + "symfony/console": "~2.8|~3.0.0", + "symfony/expression-language": "~2.4|~3.0.0", + "symfony/finder": "~2.3|~3.0.0", + "symfony/form": "^2.8.23", + "symfony/http-foundation": "^2.8.29|~3.0.0", + "symfony/http-kernel": "~2.8|~3.0.0", + "symfony/polyfill-intl-icu": "~1.0", + "symfony/routing": "~2.2|~3.0.0", + "symfony/security": "^2.8.31|^3.3.13", + "symfony/security-acl": "~2.6|~3.0.0", + "symfony/stopwatch": "~2.2|~3.0.0", + "symfony/templating": "~2.1|~3.0.0", + "symfony/translation": "~2.7|~3.0.0", + "symfony/var-dumper": "~2.7.16|~2.8.9|~3.0.9", + "symfony/yaml": "^2.0.5|~3.0.0" + }, + "suggest": { + "symfony/asset": "For using the AssetExtension", + "symfony/expression-language": "For using the ExpressionExtension", + "symfony/finder": "", + "symfony/form": "For using the FormExtension", + "symfony/http-kernel": "For using the HttpKernelExtension", + "symfony/routing": "For using the RoutingExtension", + "symfony/security": "For using the SecurityExtension", + "symfony/stopwatch": "For using the StopwatchExtension", + "symfony/templating": "For using the TwigEngine", + "symfony/translation": "For using the TranslationExtension", + "symfony/var-dumper": "For using the DumpExtension", + "symfony/yaml": "For using the YamlExtension" + }, + "type": "symfony-bridge", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Bridge\\Twig\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Twig Bridge", + "homepage": "https://symfony.com", + "time": "2018-11-11T11:18:13+00:00" + }, + { + "name": "symfony/yaml", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "02c1859112aa779d9ab394ae4f3381911d84052b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/02c1859112aa779d9ab394ae4f3381911d84052b", + "reference": "02c1859112aa779d9ab394ae4f3381911d84052b", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T11:18:13+00:00" + }, + { + "name": "twig/twig", + "version": "v1.39.1", + "source": { + "type": "git", + "url": "https://github.com/twigphp/Twig.git", + "reference": "23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec", + "reference": "23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "symfony/polyfill-ctype": "^1.8" + }, + "require-dev": { + "psr/container": "^1.0", + "symfony/debug": "^2.7", + "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.39-dev" + } + }, + "autoload": { + "psr-0": { + "Twig_": "lib/" + }, + "psr-4": { + "Twig\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com", + "homepage": "http://fabien.potencier.org", + "role": "Lead Developer" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" + }, + { + "name": "Twig Team", + "homepage": "https://twig.symfony.com/contributors", + "role": "Contributors" + } + ], + "description": "Twig, the flexible, fast, and secure template language for PHP", + "homepage": "https://twig.symfony.com", + "keywords": [ + "templating" + ], + "time": "2019-04-16T17:12:57+00:00" + }, + { + "name": "zendframework/zend-code", + "version": "2.5.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-code.git", + "reference": "5d998f261ec2a55171c71da57a11622745680153" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-code/zipball/5d998f261ec2a55171c71da57a11622745680153", + "reference": "5d998f261ec2a55171c71da57a11622745680153", + "shasum": "" + }, + "require": { + "php": ">=5.3.23", + "zendframework/zend-eventmanager": "~2.5" + }, + "require-dev": { + "doctrine/common": ">=2.1", + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "zendframework/zend-stdlib": "~2.5", + "zendframework/zend-version": "~2.5" + }, + "suggest": { + "doctrine/common": "Doctrine\\Common >=2.1 for annotation features", + "zendframework/zend-stdlib": "Zend\\Stdlib component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Code\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "provides facilities to generate arbitrary code using an object oriented interface", + "homepage": "https://github.com/zendframework/zend-code", + "keywords": [ + "code", + "zf2" + ], + "time": "2015-06-03T15:31:59+00:00" + }, + { + "name": "zendframework/zend-eventmanager", + "version": "2.5.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-eventmanager.git", + "reference": "d94a16039144936f107f906896349900fd634443" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/d94a16039144936f107f906896349900fd634443", + "reference": "d94a16039144936f107f906896349900fd634443", + "shasum": "" + }, + "require": { + "php": ">=5.3.23", + "zendframework/zend-stdlib": "~2.5" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\EventManager\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-eventmanager", + "keywords": [ + "eventmanager", + "zf2" + ], + "time": "2015-06-03T15:32:01+00:00" + }, + { + "name": "zendframework/zend-stdlib", + "version": "2.5.1", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-stdlib.git", + "reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cc8e90a60dd5d44b9730b77d07b97550091da1ae", + "reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae", + "shasum": "" + }, + "require": { + "php": ">=5.3.23" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "zendframework/zend-config": "~2.5", + "zendframework/zend-eventmanager": "~2.5", + "zendframework/zend-filter": "~2.5", + "zendframework/zend-inputfilter": "~2.5", + "zendframework/zend-serializer": "~2.5", + "zendframework/zend-servicemanager": "~2.5" + }, + "suggest": { + "zendframework/zend-eventmanager": "To support aggregate hydrator usage", + "zendframework/zend-filter": "To support naming strategy hydrator usage", + "zendframework/zend-serializer": "Zend\\Serializer component", + "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev", + "dev-develop": "2.6-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\Stdlib\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-stdlib", + "keywords": [ + "stdlib", + "zf2" + ], + "time": "2015-06-03T15:32:03+00:00" + } + ], + "packages-dev": [ + { + "name": "doctrine/instantiator", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", + "shasum": "" + }, + "require": { + "php": ">=5.3,<8.0-DEV" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "~4.0", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2015-06-14T21:17:01+00:00" + }, + { + "name": "fabpot/goutte", + "version": "v2.0.4", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/Goutte.git", + "reference": "0ad3ee6dc2d0aaa832a80041a1e09bf394e99802" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/Goutte/zipball/0ad3ee6dc2d0aaa832a80041a1e09bf394e99802", + "reference": "0ad3ee6dc2d0aaa832a80041a1e09bf394e99802", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": ">=4,<6", + "php": ">=5.4.0", + "symfony/browser-kit": "~2.1", + "symfony/css-selector": "~2.1", + "symfony/dom-crawler": "~2.1" + }, + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Goutte\\": "Goutte" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A simple PHP Web Scraper", + "homepage": "https://github.com/FriendsOfPHP/Goutte", + "keywords": [ + "scraper" + ], + "time": "2015-05-05T21:14:57+00:00" + }, + { + "name": "facebook/webdriver", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/facebook/php-webdriver.git", + "reference": "b7186fb1bcfda956d237f59face250d06ef47253" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/facebook/php-webdriver/zipball/b7186fb1bcfda956d237f59face250d06ef47253", + "reference": "b7186fb1bcfda956d237f59face250d06ef47253", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.19" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "4.6.* || ~5.0", + "squizlabs/php_codesniffer": "^2.6" + }, + "suggest": { + "phpdocumentor/phpdocumentor": "2.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Facebook\\WebDriver\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "A PHP client for WebDriver", + "homepage": "https://github.com/facebook/php-webdriver", + "keywords": [ + "facebook", + "php", + "selenium", + "webdriver" + ], + "time": "2016-08-10T00:44:08+00:00" + }, + { + "name": "laravel/homestead", + "version": "v2.2.2", + "source": { + "type": "git", + "url": "https://github.com/laravel/homestead.git", + "reference": "f4e45f895d8707042c2d0698627d33c484e7c6ba" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/laravel/homestead/zipball/f4e45f895d8707042c2d0698627d33c484e7c6ba", + "reference": "f4e45f895d8707042c2d0698627d33c484e7c6ba", + "shasum": "" + }, + "require": { + "php": ">=5.4", + "symfony/console": "~2.0 || ~3.0", + "symfony/process": "~2.0 || ~3.0" + }, + "bin": [ + "homestead" + ], + "type": "library", + "autoload": { + "psr-4": { + "Laravel\\Homestead\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Taylor Otwell", + "email": "taylorotwell@gmail.com" + } + ], + "description": "A virtual machine for web artisans.", + "time": "2016-09-17T04:42:33+00:00" + }, + { + "name": "michelf/php-markdown", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/michelf/php-markdown.git", + "reference": "01ab082b355bf188d907b9929cd99b2923053495" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/michelf/php-markdown/zipball/01ab082b355bf188d907b9929cd99b2923053495", + "reference": "01ab082b355bf188d907b9929cd99b2923053495", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Michelf\\": "Michelf/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Michel Fortin", + "email": "michel.fortin@michelf.ca", + "homepage": "https://michelf.ca/", + "role": "Developer" + }, + { + "name": "John Gruber", + "homepage": "https://daringfireball.net/" + } + ], + "description": "PHP Markdown", + "homepage": "https://michelf.ca/projects/php-markdown/", + "keywords": [ + "markdown" + ], + "time": "2018-01-15T00:49:33+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v0.9.5", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/ef70767475434bdb3615b43c327e2cae17ef12eb", + "reference": "ef70767475434bdb3615b43c327e2cae17ef12eb", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.9-dev" + } + }, + "autoload": { + "psr-0": { + "PHPParser": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2014-07-23T18:24:17+00:00" + }, + { + "name": "phing/phing", + "version": "2.4.14", + "source": { + "type": "git", + "url": "https://github.com/phingofficial/phing.git", + "reference": "41075d93ca254f1c90c79ec7ce81be2b2629e138" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phingofficial/phing/zipball/41075d93ca254f1c90c79ec7ce81be2b2629e138", + "reference": "41075d93ca254f1c90c79ec7ce81be2b2629e138", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "bin": [ + "bin/phing" + ], + "type": "library", + "autoload": { + "classmap": [ + "classes/phing/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "classes" + ], + "license": [ + "LGPL3" + ], + "authors": [ + { + "name": "Michiel Rook", + "email": "mrook@php.net" + }, + { + "name": "Phing Community", + "homepage": "http://www.phing.info/trac/wiki/Development/Contributors" + } + ], + "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.", + "homepage": "http://www.phing.info/", + "keywords": [ + "build", + "task", + "tool" + ], + "time": "2012-11-29T21:23:47+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "2.0.5", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "reference": "e6a969a640b00d8daa3c66518b0405fb41ae0c4b", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "suggest": { + "dflydev/markdown": "~1.0", + "erusev/parsedown": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "phpDocumentor": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "mike.vanriel@naenius.com" + } + ], + "time": "2016-01-25T08:17:30+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.8.0", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2018-08-05T17:53:17+00:00" + }, + { + "name": "phpunit/dbunit", + "version": "1.3.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/dbunit.git", + "reference": "1507040c2541bdffd7fbd71fc792cecdea6a7c61" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/dbunit/zipball/1507040c2541bdffd7fbd71fc792cecdea6a7c61", + "reference": "1507040c2541bdffd7fbd71fc792cecdea6a7c61", + "shasum": "" + }, + "require": { + "ext-pdo": "*", + "ext-simplexml": "*", + "php": ">=5.3.3", + "phpunit/phpunit": "~3.7|~4.0", + "symfony/yaml": "~2.1" + }, + "bin": [ + "composer/bin/dbunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "", + "../../symfony/yaml/" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "DbUnit port for PHP/PHPUnit to support database interaction testing.", + "homepage": "https://github.com/sebastianbergmann/dbunit/", + "keywords": [ + "database", + "testing", + "xunit" + ], + "abandoned": true, + "time": "2015-03-29T14:23:04+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "2.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": "~1.3", + "phpunit/php-text-template": "~1.2", + "phpunit/php-token-stream": "~1.3", + "sebastian/environment": "^1.3.2", + "sebastian/version": "~1.0" + }, + "require-dev": { + "ext-xdebug": ">=2.1.4", + "phpunit/phpunit": "~4" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.2.1", + "ext-xmlwriter": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2015-10-06T15:47:00+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2017-11-27T13:52:08+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.9", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "reference": "3dcf38ca72b158baf0bc245e9184d3fdffa9c46f", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2017-02-26T11:10:40+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.4.12", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2017-12-04T08:55:13+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "4.8.36", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpspec/prophecy": "^1.3.1", + "phpunit/php-code-coverage": "~2.1", + "phpunit/php-file-iterator": "~1.4", + "phpunit/php-text-template": "~1.2", + "phpunit/php-timer": "^1.0.6", + "phpunit/phpunit-mock-objects": "~2.3", + "sebastian/comparator": "~1.2.2", + "sebastian/diff": "~1.2", + "sebastian/environment": "~1.3", + "sebastian/exporter": "~1.2", + "sebastian/global-state": "~1.0", + "sebastian/version": "~1.0", + "symfony/yaml": "~2.1|~3.0" + }, + "suggest": { + "phpunit/php-invoker": "~1.1" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.8.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2017-06-21T08:07:12+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "2.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": ">=5.3.3", + "phpunit/php-text-template": "~1.2", + "sebastian/exporter": "~1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "abandoned": true, + "time": "2015-10-02T06:51:40+00:00" + }, + { + "name": "pimple/pimple", + "version": "v1.0.2", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94", + "reference": "ae11e57e8c2bb414b2ff93396dbbfc0eb92feb94", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple is a simple Dependency Injection Container for PHP 5.3", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2013-03-08T08:21:40+00:00" + }, + { + "name": "sami/sami", + "version": "v1.4.1", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/Sami.git", + "reference": "160018bfefffa730dc35a2c606691a45acbf41a1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/Sami/zipball/160018bfefffa730dc35a2c606691a45acbf41a1", + "reference": "160018bfefffa730dc35a2c606691a45acbf41a1", + "shasum": "" + }, + "require": { + "michelf/php-markdown": "~1.3", + "nikic/php-parser": "0.9.*", + "php": ">=5.3.0", + "pimple/pimple": "1.0.*", + "symfony/console": "~2.1", + "symfony/filesystem": "~2.1", + "symfony/finder": "~2.1", + "symfony/process": "~2.1", + "symfony/yaml": "~2.1", + "twig/twig": "1.*" + }, + "bin": [ + "sami.php" + ], + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-0": { + "Sami": "." + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Sami, an API documentation generator", + "homepage": "http://sami.sensiolabs.org", + "keywords": [ + "phpdoc" + ], + "abandoned": true, + "time": "2015-06-05T03:36:34+00:00" + }, + { + "name": "sebastian/comparator", + "version": "1.2.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/diff": "~1.2", + "sebastian/exporter": "~1.2 || ~2.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "http://www.github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2017-01-29T09:50:25+00:00" + }, + { + "name": "sebastian/diff", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff" + ], + "time": "2017-05-22T07:24:03+00:00" + }, + { + "name": "sebastian/environment", + "version": "1.3.8", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2016-08-18T05:49:44+00:00" + }, + { + "name": "sebastian/exporter", + "version": "1.2.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "sebastian/recursion-context": "~1.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2016-06-17T09:04:28+00:00" + }, + { + "name": "sebastian/global-state", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.2" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2015-10-12T03:26:01+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2016-10-03T07:41:43+00:00" + }, + { + "name": "sebastian/version", + "version": "1.0.6", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "reference": "58b3a85e7999757d6ad81c787a1fbf5ff6c628c6", + "shasum": "" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2015-06-21T13:59:46+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "2.9.2", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "2acf168de78487db620ab4bc524135a13cfe6745" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/2acf168de78487db620ab4bc524135a13cfe6745", + "reference": "2acf168de78487db620ab4bc524135a13cfe6745", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2018-11-07T22:31:41+00:00" + }, + { + "name": "symfony/browser-kit", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/browser-kit.git", + "reference": "b507697225f32a76a9d333d0766fb46353e9d00d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/browser-kit/zipball/b507697225f32a76a9d333d0766fb46353e9d00d", + "reference": "b507697225f32a76a9d333d0766fb46353e9d00d", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/dom-crawler": "~2.1|~3.0.0" + }, + "require-dev": { + "symfony/css-selector": "^2.0.5|~3.0.0", + "symfony/process": "~2.3.34|^2.7.6|~3.0.0" + }, + "suggest": { + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\BrowserKit\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony BrowserKit Component", + "homepage": "https://symfony.com", + "time": "2018-11-26T06:55:10+00:00" + }, + { + "name": "symfony/css-selector", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/css-selector.git", + "reference": "7b1692e418d7ccac24c373528453bc90e42797de" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/7b1692e418d7ccac24c373528453bc90e42797de", + "reference": "7b1692e418d7ccac24c373528453bc90e42797de", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\CssSelector\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jean-François Simon", + "email": "jeanfrancois.simon@sensiolabs.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony CssSelector Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T11:18:13+00:00" + }, + { + "name": "symfony/dom-crawler", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/dom-crawler.git", + "reference": "2cdc7d3909eea6f982a6298d2e9ab7db01b6403c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/2cdc7d3909eea6f982a6298d2e9ab7db01b6403c", + "reference": "2cdc7d3909eea6f982a6298d2e9ab7db01b6403c", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.0" + }, + "require-dev": { + "symfony/css-selector": "~2.8|~3.0.0" + }, + "suggest": { + "symfony/css-selector": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\DomCrawler\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DomCrawler Component", + "homepage": "https://symfony.com", + "time": "2018-11-24T22:30:19+00:00" + }, + { + "name": "symfony/process", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "c3591a09c78639822b0b290d44edb69bf9f05dc8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/c3591a09c78639822b0b290d44edb69bf9f05dc8", + "reference": "c3591a09c78639822b0b290d44edb69bf9f05dc8", + "shasum": "" + }, + "require": { + "php": ">=5.3.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2018-11-11T11:18:13+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [], + "platform-overrides": { + "php": "5.4.7" + } +} diff --git a/install/update/old/config/default/container/parameters.yml b/install/update/old/config/default/container/parameters.yml new file mode 100644 index 0000000..8ecc142 --- /dev/null +++ b/install/update/old/config/default/container/parameters.yml @@ -0,0 +1,20 @@ +parameters: + # Disable the usage of the super globals (_GET, _POST, _SERVER...) + core.disable_super_globals: true + + # Datetime class to use + datetime.class: \phpbb\datetime + + # Mimetype guesser priorities + mimetype.guesser.priority.lowest: -2 + mimetype.guesser.priority.low: -1 + mimetype.guesser.priority.default: 0 + mimetype.guesser.priority.high: 1 + mimetype.guesser.priority.highest: 2 + + # List of default password driver types + passwords.algorithms: + - passwords.driver.bcrypt_2y + - passwords.driver.bcrypt + - passwords.driver.salted_md5 + - passwords.driver.phpass diff --git a/install/update/old/config/default/container/services.yml b/install/update/old/config/default/container/services.yml new file mode 100644 index 0000000..9bb1d67 --- /dev/null +++ b/install/update/old/config/default/container/services.yml @@ -0,0 +1,169 @@ +imports: + - { resource: services_attachment.yml } + - { resource: services_auth.yml } + - { resource: services_avatar.yml } + - { resource: services_captcha.yml } + - { resource: services_console.yml } + - { resource: services_content.yml } + - { resource: services_cron.yml } + - { resource: services_db.yml } + - { resource: services_event.yml } + - { resource: services_feed.yml } + - { resource: services_files.yml } + - { resource: services_filesystem.yml } + - { resource: services_help.yml } + - { resource: services_hook.yml } + - { resource: services_http.yml } + - { resource: services_language.yml } + - { resource: services_migrator.yml } + - { resource: services_mimetype_guesser.yml } + - { resource: services_module.yml } + - { resource: services_notification.yml } + - { resource: services_password.yml } + - { resource: services_php.yml } + - { resource: services_profilefield.yml } + - { resource: services_report.yml } + - { resource: services_routing.yml } + - { resource: services_text_formatter.yml } + - { resource: services_text_reparser.yml } + - { resource: services_twig.yml } + - { resource: services_user.yml } + + - { resource: tables.yml } + - { resource: parameters.yml } + +services: + cache: + class: phpbb\cache\service + arguments: + - '@cache.driver' + - '@config' + - '@dbal.conn' + - '%core.root_path%' + - '%core.php_ext%' + + cache.driver: + class: '%cache.driver.class%' + + class_loader: + class: phpbb\class_loader + arguments: + - phpbb\ + - '%core.root_path%includes/' + - '%core.php_ext%' + calls: + - [register, []] + - [set_cache, ['@cache.driver']] + + class_loader.ext: + class: phpbb\class_loader + arguments: + - \ + - '%core.root_path%ext/' + - '%core.php_ext%' + calls: + - [register, []] + - [set_cache, ['@cache.driver']] + + config: + class: phpbb\config\db + arguments: + - '@dbal.conn' + - '@cache.driver' + - '%tables.config%' + + config.php: + synthetic: true + + config_text: + class: phpbb\config\db_text + arguments: + - '@dbal.conn' + - '%tables.config_text%' + + controller.helper: + class: phpbb\controller\helper + arguments: + - '@template' + - '@user' + - '@config' + - '@symfony_request' + - '@request' + - '@routing.helper' + + controller.resolver: + class: phpbb\controller\resolver + arguments: + - '@service_container' + - '%core.root_path%' + - '@template' + + ext.manager: + class: phpbb\extension\manager + arguments: + - '@service_container' + - '@dbal.conn' + - '@config' + - '@filesystem' + - '%tables.ext%' + - '%core.root_path%' + - '%core.php_ext%' + - '@cache' + + file_downloader: + class: phpbb\file_downloader + + file_locator: + class: phpbb\routing\file_locator + arguments: + - '@filesystem' + - '%core.root_path%' + + group_helper: + class: phpbb\group\helper + arguments: + - '@language' + + log: + class: phpbb\log\log + arguments: + - '@dbal.conn' + - '@user' + - '@auth' + - '@dispatcher' + - '%core.root_path%' + - '%core.adm_relative_path%' + - '%core.php_ext%' + - '%tables.log%' + + path_helper: + class: phpbb\path_helper + arguments: + - '@symfony_request' + - '@filesystem' + - '@request' + - '%core.root_path%' + - '%core.php_ext%' + - '%core.adm_relative_path%' + + plupload: + class: phpbb\plupload\plupload + arguments: + - '%core.root_path%' + - '@config' + - '@request' + - '@user' + - '@php_ini' + - '@mimetype.guesser' + + upload_imagesize: + class: FastImageSize\FastImageSize + + version_helper: + class: phpbb\version_helper + shared: false + arguments: + - '@cache' + - '@config' + - '@file_downloader' + - '@user' diff --git a/install/update/old/config/default/container/services_auth.yml b/install/update/old/config/default/container/services_auth.yml new file mode 100644 index 0000000..ed8dc90 --- /dev/null +++ b/install/update/old/config/default/container/services_auth.yml @@ -0,0 +1,110 @@ +services: +# ----- Auth management ----- + auth: + class: phpbb\auth\auth + +# ----- Auth providers ----- + auth.provider_collection: + class: phpbb\auth\provider_collection + arguments: + - '@service_container' + - '@config' + tags: + - { name: service_collection, tag: auth.provider } + + auth.provider.db: + class: phpbb\auth\provider\db + arguments: + - '@dbal.conn' + - '@config' + - '@passwords.manager' + - '@request' + - '@user' + - '@service_container' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: auth.provider } + + auth.provider.apache: + class: phpbb\auth\provider\apache + arguments: + - '@dbal.conn' + - '@config' + - '@passwords.manager' + - '@request' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: auth.provider } + + auth.provider.ldap: + class: phpbb\auth\provider\ldap + arguments: + - '@dbal.conn' + - '@config' + - '@passwords.manager' + - '@user' + tags: + - { name: auth.provider } + + auth.provider.oauth: + class: phpbb\auth\provider\oauth\oauth + arguments: + - '@dbal.conn' + - '@config' + - '@passwords.manager' + - '@request' + - '@user' + - '%tables.auth_provider_oauth_token_storage%' + - '%tables.auth_provider_oauth_states%' + - '%tables.auth_provider_oauth_account_assoc%' + - '@auth.provider.oauth.service_collection' + - '%tables.users%' + - '@service_container' + - '@dispatcher' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: auth.provider } + +# ----- OAuth services providers ----- + auth.provider.oauth.service_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: auth.provider.oauth.service } + + auth.provider.oauth.service.bitly: + class: phpbb\auth\provider\oauth\service\bitly + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } + + auth.provider.oauth.service.facebook: + class: phpbb\auth\provider\oauth\service\facebook + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } + + auth.provider.oauth.service.google: + class: phpbb\auth\provider\oauth\service\google + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } + + auth.provider.oauth.service.twitter: + class: phpbb\auth\provider\oauth\service\twitter + arguments: + - '@config' + - '@request' + tags: + - { name: auth.provider.oauth.service } diff --git a/install/update/old/config/default/container/services_console.yml b/install/update/old/config/default/container/services_console.yml new file mode 100644 index 0000000..05e467f --- /dev/null +++ b/install/update/old/config/default/container/services_console.yml @@ -0,0 +1,295 @@ +services: + console.exception_subscriber: + class: phpbb\console\exception_subscriber + arguments: + - '@language' + tags: + - { name: kernel.event_subscriber } + + console.command_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: console.command } + + console.command.cache.purge: + class: phpbb\console\command\cache\purge + arguments: + - '@user' + - '@cache.driver' + - '@dbal.conn' + - '@auth' + - '@log' + - '@config' + tags: + - { name: console.command } + + console.command.config.delete: + class: phpbb\console\command\config\delete + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.increment: + class: phpbb\console\command\config\increment + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.get: + class: phpbb\console\command\config\get + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.set: + class: phpbb\console\command\config\set + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.config.set_atomic: + class: phpbb\console\command\config\set_atomic + arguments: + - '@user' + - '@config' + tags: + - { name: console.command } + + console.command.cron.list: + class: phpbb\console\command\cron\cron_list + arguments: + - '@user' + - '@cron.manager' + tags: + - { name: console.command } + + console.command.cron.run: + class: phpbb\console\command\cron\run + arguments: + - '@user' + - '@cron.manager' + - '@cron.lock_db' + tags: + - { name: console.command } + + console.command.db.list: + class: phpbb\console\command\db\list_command + arguments: + - '@user' + - '@migrator' + - '@ext.manager' + - '@config' + - '@cache' + tags: + - { name: console.command } + + console.command.db.migrate: + class: phpbb\console\command\db\migrate + arguments: + - '@user' + - '@language' + - '@migrator' + - '@ext.manager' + - '@config' + - '@cache' + - '@log' + - '@filesystem' + - '%core.root_path%' + tags: + - { name: console.command } + + console.command.db.revert: + class: phpbb\console\command\db\revert + parent: console.command.db.migrate + tags: + - { name: console.command } + + console.command.dev.migration_tips: + class: phpbb\console\command\dev\migration_tips + arguments: + - '@user' + - '@ext.manager' + tags: + - { name: console.command } + + console.command.extension.disable: + class: phpbb\console\command\extension\disable + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.extension.enable: + class: phpbb\console\command\extension\enable + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.extension.purge: + class: phpbb\console\command\extension\purge + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.extension.show: + class: phpbb\console\command\extension\show + arguments: + - '@user' + - '@ext.manager' + - '@log' + tags: + - { name: console.command } + + console.command.fixup.recalculate_email_hash: + class: phpbb\console\command\fixup\recalculate_email_hash + arguments: + - '@user' + - '@dbal.conn' + tags: + - { name: console.command } + + console.command.fixup.update_hashes: + class: phpbb\console\command\fixup\update_hashes + arguments: + - '@config' + - '@user' + - '@dbal.conn' + - '@passwords.manager' + - '@passwords.driver_collection' + - '%passwords.algorithms%' + tags: + - { name: console.command } + + console.command.fixup.fix_left_right_ids: + class: phpbb\console\command\fixup\fix_left_right_ids + arguments: + - '@user' + - '@dbal.conn' + - '@cache.driver' + tags: + - { name: console.command } + + console.command.reparser.list: + class: phpbb\console\command\reparser\list_all + arguments: + - '@user' + - '@text_reparser_collection' + tags: + - { name: console.command } + + console.command.reparser.reparse: + class: phpbb\console\command\reparser\reparse + arguments: + - '@user' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + tags: + - { name: console.command } + + console.command.thumbnail.delete: + class: phpbb\console\command\thumbnail\delete + arguments: + - '@config' + - '@user' + - '@dbal.conn' + - '%core.root_path%' + tags: + - { name: console.command } + + console.command.thumbnail.generate: + class: phpbb\console\command\thumbnail\generate + arguments: + - '@config' + - '@user' + - '@dbal.conn' + - '@cache' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: console.command } + + console.command.thumbnail.recreate: + class: phpbb\console\command\thumbnail\recreate + arguments: + - '@user' + tags: + - { name: console.command } + + console.command.update.check: + class: phpbb\console\command\update\check + arguments: + - '@user' + - '@config' + - '@service_container' + - '@language' + tags: + - { name: console.command } + + console.command.user.activate: + class: phpbb\console\command\user\activate + arguments: + - '@user' + - '@dbal.conn' + - '@config' + - '@language' + - '@log' + - '@notification_manager' + - '@user_loader' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: console.command } + + console.command.user.add: + class: phpbb\console\command\user\add + arguments: + - '@user' + - '@dbal.conn' + - '@config' + - '@language' + - '@passwords.manager' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: console.command } + + console.command.user.delete: + class: phpbb\console\command\user\delete + arguments: + - '@user' + - '@dbal.conn' + - '@language' + - '@log' + - '@user_loader' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: console.command } + + console.command.user.reclean: + class: phpbb\console\command\user\reclean + arguments: + - '@user' + - '@dbal.conn' + - '@language' + tags: + - { name: console.command } diff --git a/install/update/old/config/default/container/services_cron.yml b/install/update/old/config/default/container/services_cron.yml new file mode 100644 index 0000000..d7f6388 --- /dev/null +++ b/install/update/old/config/default/container/services_cron.yml @@ -0,0 +1,235 @@ +services: + cron.manager: + class: phpbb\cron\manager + arguments: + - '@cron.task_collection' + - '%core.root_path%' + - '%core.php_ext%' + + cron.lock_db: + class: phpbb\lock\db + arguments: + - cron_lock + - '@config' + - '@dbal.conn' + +# ----- Cron tasks ----- + cron.task_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: cron.task } + + cron.task.core.prune_all_forums: + class: phpbb\cron\task\core\prune_all_forums + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '@dbal.conn' + calls: + - [set_name, [cron.task.core.prune_all_forums]] + tags: + - { name: cron.task } + + cron.task.core.prune_forum: + class: phpbb\cron\task\core\prune_forum + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '@dbal.conn' + calls: + - [set_name, [cron.task.core.prune_forum]] + tags: + - { name: cron.task } + + cron.task.core.prune_shadow_topics: + class: phpbb\cron\task\core\prune_shadow_topics + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '@dbal.conn' + - '@log' + - '@user' + calls: + - [set_name, [cron.task.core.prune_shadow_topics]] + tags: + - { name: cron.task } + + cron.task.core.prune_notifications: + class: phpbb\cron\task\core\prune_notifications + arguments: + - '@config' + - '@notification_manager' + calls: + - [set_name, [cron.task.core.prune_notifications]] + tags: + - { name: cron.task } + + cron.task.core.queue: + class: phpbb\cron\task\core\queue + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + - '%core.cache_dir%' + calls: + - [set_name, [cron.task.core.queue]] + tags: + - { name: cron.task } + + cron.task.core.tidy_cache: + class: phpbb\cron\task\core\tidy_cache + arguments: + - '@config' + - '@cache.driver' + calls: + - [set_name, [cron.task.core.tidy_cache]] + tags: + - { name: cron.task } + + cron.task.core.tidy_database: + class: phpbb\cron\task\core\tidy_database + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + calls: + - [set_name, [cron.task.core.tidy_database]] + tags: + - { name: cron.task } + + cron.task.core.tidy_plupload: + class: phpbb\cron\task\core\tidy_plupload + arguments: + - '%core.root_path%' + - '@config' + - '@log' + - '@user' + calls: + - [set_name, [cron.task.core.tidy_plupload]] + tags: + - { name: cron.task } + + cron.task.core.tidy_search: + class: phpbb\cron\task\core\tidy_search + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@auth' + - '@config' + - '@dbal.conn' + - '@user' + - '@dispatcher' + calls: + - [set_name, [cron.task.core.tidy_search]] + tags: + - { name: cron.task } + + cron.task.core.tidy_sessions: + class: phpbb\cron\task\core\tidy_sessions + arguments: + - '@config' + - '@user' + calls: + - [set_name, [cron.task.core.tidy_sessions]] + tags: + - { name: cron.task } + + cron.task.core.tidy_warnings: + class: phpbb\cron\task\core\tidy_warnings + arguments: + - '%core.root_path%' + - '%core.php_ext%' + - '@config' + calls: + - [set_name, [cron.task.core.tidy_warnings]] + tags: + - { name: cron.task } + + cron.task.text_reparser.pm_text: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.pm_text]] + - [set_reparser, [text_reparser.pm_text]] + tags: + - { name: cron.task } + + cron.task.text_reparser.poll_option: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.poll_option]] + - [set_reparser, [text_reparser.poll_option]] + tags: + - { name: cron.task } + + cron.task.text_reparser.poll_title: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.poll_title]] + - [set_reparser, [text_reparser.poll_title]] + tags: + - { name: cron.task } + + cron.task.text_reparser.post_text: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.post_text]] + - [set_reparser, [text_reparser.post_text]] + tags: + - { name: cron.task } + + cron.task.text_reparser.user_signature: + class: phpbb\cron\task\text_reparser\reparser + arguments: + - '@config' + - '@config_text' + - '@text_reparser.lock' + - '@text_reparser.manager' + - '@text_reparser_collection' + calls: + - [set_name, [cron.task.text_reparser.user_signature]] + - [set_reparser, [text_reparser.user_signature]] + tags: + - { name: cron.task } + + cron.task.core.update_hashes: + class: phpbb\cron\task\core\update_hashes + arguments: + - '@config' + - '@dbal.conn' + - '@passwords.update.lock' + - '@passwords.manager' + - '@passwords.driver_collection' + - '%passwords.algorithms%' + calls: + - [set_name, [cron.task.core.update_hashes]] + tags: + - { name: cron.task } diff --git a/install/update/old/config/default/container/services_password.yml b/install/update/old/config/default/container/services_password.yml new file mode 100644 index 0000000..d5f5fe2 --- /dev/null +++ b/install/update/old/config/default/container/services_password.yml @@ -0,0 +1,136 @@ +parameters: + passwords.driver.bcrypt_cost: 10 + +services: +# ----- Password management ----- + passwords.manager: + class: phpbb\passwords\manager + arguments: + - '@config' + - '@passwords.driver_collection' + - '@passwords.helper' + - '%passwords.algorithms%' + + passwords.helper: + class: phpbb\passwords\helper + + passwords.driver_helper: + class: phpbb\passwords\driver\helper + arguments: + - '@config' + +# ----- Password's drivers ----- + passwords.driver_collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: passwords.driver } + + passwords.driver.bcrypt: + class: phpbb\passwords\driver\bcrypt + arguments: + - '@config' + - '@passwords.driver_helper' + - '%passwords.driver.bcrypt_cost%' + tags: + - { name: passwords.driver } + + passwords.driver.bcrypt_2y: + class: phpbb\passwords\driver\bcrypt_2y + arguments: + - '@config' + - '@passwords.driver_helper' + - '%passwords.driver.bcrypt_cost%' + tags: + - { name: passwords.driver } + + passwords.driver.bcrypt_wcf2: + class: phpbb\passwords\driver\bcrypt_wcf2 + arguments: + - '@passwords.driver.bcrypt' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.salted_md5: + class: phpbb\passwords\driver\salted_md5 + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.phpass: + class: phpbb\passwords\driver\phpass + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.convert_password: + class: phpbb\passwords\driver\convert_password + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.sha1_smf: + class: phpbb\passwords\driver\sha1_smf + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.sha1_wcf1: + class: phpbb\passwords\driver\sha1_wcf1 + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.sha1: + class: phpbb\passwords\driver\sha1 + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.md5_phpbb2: + class: phpbb\passwords\driver\md5_phpbb2 + arguments: + - '@request' + - '@passwords.driver.salted_md5' + - '@passwords.driver_helper' + - '%core.root_path%' + - '%core.php_ext%' + tags: + - { name: passwords.driver } + + passwords.driver.md5_mybb: + class: phpbb\passwords\driver\md5_mybb + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.driver.md5_vb: + class: phpbb\passwords\driver\md5_vb + arguments: + - '@config' + - '@passwords.driver_helper' + tags: + - { name: passwords.driver } + + passwords.update.lock: + class: phpbb\lock\db + arguments: + - update_hashes_lock + - '@config' + - '@dbal.conn' diff --git a/install/update/old/config/default/container/services_routing.yml b/install/update/old/config/default/container/services_routing.yml new file mode 100644 index 0000000..3048145 --- /dev/null +++ b/install/update/old/config/default/container/services_routing.yml @@ -0,0 +1,79 @@ +services: + router: + class: phpbb\routing\router + arguments: + - '@service_container' + - '@routing.chained_resources_locator' + - '@routing.delegated_loader' + - '%core.php_ext%' + - '%core.cache_dir%' + + router.listener: + class: Symfony\Component\HttpKernel\EventListener\RouterListener + arguments: + - '@router' + - null + - null + - '@request_stack' + tags: + - { name: kernel.event_subscriber } + + routing.helper: + class: phpbb\routing\helper + arguments: + - '@config' + - '@router' + - '@symfony_request' + - '@request' + - '@filesystem' + - '%core.root_path%' + - '%core.php_ext%' + +# ---- Route loaders ---- + + routing.delegated_loader: + class: Symfony\Component\Config\Loader\DelegatingLoader + arguments: + - '@routing.resolver' + + routing.resolver: + class: phpbb\routing\loader_resolver + arguments: + - '@routing.loader.collection' + + routing.loader.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: routing.loader } + + routing.loader.yaml: + class: Symfony\Component\Routing\Loader\YamlFileLoader + arguments: + - '@file_locator' + tags: + - { name: routing.loader } + +# ---- Resources Locators ---- + + routing.chained_resources_locator: + class: phpbb\routing\resources_locator\chained_resources_locator + arguments: + - '@routing.resources_locator.collection' + + routing.resources_locator.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: routing.resources_locator } + + routing.resources_locator.default: + class: phpbb\routing\resources_locator\default_resources_locator + arguments: + - '%core.root_path%' + - '%core.environment%' + - '@ext.manager' + tags: + - { name: routing.resources_locator } diff --git a/install/update/old/config/default/container/services_text_formatter.yml b/install/update/old/config/default/container/services_text_formatter.yml new file mode 100644 index 0000000..07087cd --- /dev/null +++ b/install/update/old/config/default/container/services_text_formatter.yml @@ -0,0 +1,79 @@ +parameters: + text_formatter.cache.dir: '%core.cache_dir%' + text_formatter.cache.parser.key: _text_formatter_parser + text_formatter.cache.renderer.key: _text_formatter_renderer + +services: + text_formatter.cache: + alias: text_formatter.s9e.factory + + text_formatter.data_access: + class: phpbb\textformatter\data_access + arguments: + - '@dbal.conn' + - '%tables.bbcodes%' + - '%tables.smilies%' + - '%tables.styles%' + - '%tables.words%' + - '%core.root_path%styles/' + + text_formatter.parser: + alias: text_formatter.s9e.parser + + text_formatter.renderer: + alias: text_formatter.s9e.renderer + + text_formatter.utils: + alias: text_formatter.s9e.utils + + text_formatter.s9e.bbcode_merger: + class: phpbb\textformatter\s9e\bbcode_merger + arguments: + - '@text_formatter.s9e.factory' + + text_formatter.s9e.factory: + class: phpbb\textformatter\s9e\factory + arguments: + - '@text_formatter.data_access' + - '@cache.driver' + - '@dispatcher' + - '@config' + - '@text_formatter.s9e.link_helper' + - '@log' + - '%text_formatter.cache.dir%' + - '%text_formatter.cache.parser.key%' + - '%text_formatter.cache.renderer.key%' + + text_formatter.s9e.link_helper: + class: phpbb\textformatter\s9e\link_helper + + text_formatter.s9e.parser: + class: phpbb\textformatter\s9e\parser + arguments: + - '@cache.driver' + - '%text_formatter.cache.parser.key%' + - '@text_formatter.s9e.factory' + - '@dispatcher' + + text_formatter.s9e.quote_helper: + class: phpbb\textformatter\s9e\quote_helper + arguments: + - '@user' + - '%core.root_path%' + - '%core.php_ext%' + + text_formatter.s9e.renderer: + class: phpbb\textformatter\s9e\renderer + arguments: + - '@cache.driver' + - '%text_formatter.cache.dir%' + - '%text_formatter.cache.renderer.key%' + - '@text_formatter.s9e.factory' + - '@dispatcher' + calls: + - [configure_quote_helper, ['@text_formatter.s9e.quote_helper']] + - [configure_smilies_path, ['@config', '@path_helper']] + - [configure_user, ['@user', '@config', '@auth']] + + text_formatter.s9e.utils: + class: phpbb\textformatter\s9e\utils diff --git a/install/update/old/config/default/container/services_twig.yml b/install/update/old/config/default/container/services_twig.yml new file mode 100644 index 0000000..a9b5b6d --- /dev/null +++ b/install/update/old/config/default/container/services_twig.yml @@ -0,0 +1,68 @@ +parameters: + core.template.cache_path: '%core.cache_dir%twig/' + +services: + template.twig.environment: + class: phpbb\template\twig\environment + arguments: + - '@config' + - '@filesystem' + - '@path_helper' + - '%core.template.cache_path%' + - '@ext.manager' + - '@template.twig.loader' + - '@dispatcher' + - [] + calls: + - [setLexer, ['@template.twig.lexer']] + + template.twig.lexer: + class: phpbb\template\twig\lexer + lazy: true + arguments: + - '@template.twig.environment' + + template.twig.loader: + class: phpbb\template\twig\loader + arguments: + - '@filesystem' + + template.twig.extensions.collection: + class: phpbb\di\service_collection + arguments: + - '@service_container' + tags: + - { name: service_collection, tag: twig.extension } + + template.twig.extensions.phpbb: + class: phpbb\template\twig\extension + arguments: + - '@template_context' + - '@language' + tags: + - { name: twig.extension } + + template.twig.extensions.routing: + class: phpbb\template\twig\extension\routing + arguments: + - '@routing.helper' + tags: + - { name: twig.extension } + + template.twig.extensions.debug: + class: Twig_Extension_Debug + + template: + class: phpbb\template\twig\twig + arguments: + - '@path_helper' + - '@config' + - '@template_context' + - '@template.twig.environment' + - '%core.template.cache_path%' + - '@user' + - '@template.twig.extensions.collection' + - '@ext.manager' + + template_context: + class: phpbb\template\context diff --git a/install/update/old/config/default/routing/routing.yml b/install/update/old/config/default/routing/routing.yml new file mode 100644 index 0000000..f381f02 --- /dev/null +++ b/install/update/old/config/default/routing/routing.yml @@ -0,0 +1,24 @@ +# Structure: +# +# foo_controller: +# path: /foo +# defaults: { _controller: foo_sevice:method } +# +# The above will be accessed via app.php?controller=foo and it will +# instantiate the 'foo_service' service and call the 'method' method. +# + +phpbb_feed_routing: + resource: feed.yml + prefix: /feed + +phpbb_feed_index: + path: /feed + defaults: { _controller: phpbb.feed.controller:overall } + +phpbb_help_routing: + resource: help.yml + prefix: /help + +phpbb_report_routing: + resource: report.yml diff --git a/install/update/old/cron.php b/install/update/old/cron.php new file mode 100644 index 0000000..2f51994 --- /dev/null +++ b/install/update/old/cron.php @@ -0,0 +1,84 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +define('IN_PHPBB', true); +define('IN_CRON', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); + +// Do not update users last page entry +$user->session_begin(false); +$auth->acl($user->data); + +function output_image() +{ + // Output transparent gif + header('Cache-Control: no-cache'); + header('Content-type: image/gif'); + header('Content-length: 43'); + + echo base64_decode('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='); + + // Flush here to prevent browser from showing the page as loading while + // running cron. + flush(); +} + +// Thanks to various fatal errors and lack of try/finally, it is quite easy to leave +// the cron lock locked, especially when working on cron-related code. +// +// Attempt to alleviate the problem by doing setup outside of the lock as much as possible. + +$cron_type = $request->variable('cron_type', ''); + +// Comment this line out for debugging so the page does not return an image. +output_image(); + +/* @var $cron_lock \phpbb\lock\db */ +$cron_lock = $phpbb_container->get('cron.lock_db'); +if ($cron_lock->acquire()) +{ + /* @var $cron \phpbb\cron\manager */ + $cron = $phpbb_container->get('cron.manager'); + + $task = $cron->find_task($cron_type); + if ($task) + { + /** + * This event enables you to catch the task before it runs + * + * @event core.cron_run_before + * @var \phpbb\cron\task\wrapper task Current Cron task + * @since 3.1.8-RC1 + */ + $vars = array( + 'task', + ); + extract($phpbb_dispatcher->trigger_event('core.cron_run_before', compact($vars))); + + if ($task->is_parametrized()) + { + $task->parse_parameters($request); + } + if ($task->is_ready()) + { + $task->run(); + } + } + $cron_lock->release(); +} + +garbage_collection(); diff --git a/install/update/old/download/file.php b/install/update/old/download/file.php new file mode 100644 index 0000000..9ee489c --- /dev/null +++ b/install/update/old/download/file.php @@ -0,0 +1,326 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); + +// Thank you sun. +if (isset($_SERVER['CONTENT_TYPE'])) +{ + if ($_SERVER['CONTENT_TYPE'] === 'application/x-java-archive') + { + exit; + } +} +else if (isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'Java') !== false) +{ + exit; +} + +if (isset($_GET['avatar'])) +{ + require($phpbb_root_path . 'includes/startup.' . $phpEx); + + require($phpbb_root_path . 'phpbb/class_loader.' . $phpEx); + $phpbb_class_loader = new \phpbb\class_loader('phpbb\\', "{$phpbb_root_path}phpbb/", $phpEx); + $phpbb_class_loader->register(); + + $phpbb_config_php_file = new \phpbb\config_php_file($phpbb_root_path, $phpEx); + extract($phpbb_config_php_file->get_all()); + + if (!defined('PHPBB_ENVIRONMENT')) + { + @define('PHPBB_ENVIRONMENT', 'production'); + } + + if (!defined('PHPBB_INSTALLED') || empty($dbms) || empty($acm_type)) + { + exit; + } + + require($phpbb_root_path . 'includes/constants.' . $phpEx); + require($phpbb_root_path . 'includes/functions.' . $phpEx); + require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); + require($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + + // Setup class loader first + $phpbb_class_loader_ext = new \phpbb\class_loader('\\', "{$phpbb_root_path}ext/", $phpEx); + $phpbb_class_loader_ext->register(); + + // Set up container + $phpbb_container_builder = new \phpbb\di\container_builder($phpbb_root_path, $phpEx); + $phpbb_container = $phpbb_container_builder->with_config($phpbb_config_php_file)->get_container(); + + $phpbb_class_loader->set_cache($phpbb_container->get('cache.driver')); + $phpbb_class_loader_ext->set_cache($phpbb_container->get('cache.driver')); + + // set up caching + /* @var $cache \phpbb\cache\service */ + $cache = $phpbb_container->get('cache'); + + /* @var $phpbb_dispatcher \phpbb\event\dispatcher */ + $phpbb_dispatcher = $phpbb_container->get('dispatcher'); + + /* @var $request \phpbb\request\request_interface */ + $request = $phpbb_container->get('request'); + + /* @var $db \phpbb\db\driver\driver_interface */ + $db = $phpbb_container->get('dbal.conn'); + + /* @var $phpbb_log \phpbb\log\log_interface */ + $phpbb_log = $phpbb_container->get('log'); + + unset($dbpasswd); + + /* @var $config \phpbb\config\config */ + $config = $phpbb_container->get('config'); + + // load extensions + /* @var $phpbb_extension_manager \phpbb\extension\manager */ + $phpbb_extension_manager = $phpbb_container->get('ext.manager'); + + // worst-case default + $browser = strtolower($request->header('User-Agent', 'msie 6.0')); + + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + + $filename = $request->variable('avatar', ''); + $avatar_group = false; + $exit = false; + + if (isset($filename[0]) && $filename[0] === 'g') + { + $avatar_group = true; + $filename = substr($filename, 1); + } + + // '==' is not a bug - . as the first char is as bad as no dot at all + if (strpos($filename, '.') == false) + { + send_status_line(403, 'Forbidden'); + $exit = true; + } + + if (!$exit) + { + $ext = substr(strrchr($filename, '.'), 1); + $stamp = (int) substr(stristr($filename, '_'), 1); + $filename = (int) $filename; + $exit = set_modified_headers($stamp, $browser); + } + if (!$exit && !in_array($ext, array('png', 'gif', 'jpg', 'jpeg'))) + { + // no way such an avatar could exist. They are not following the rules, stop the show. + send_status_line(403, 'Forbidden'); + $exit = true; + } + + + if (!$exit) + { + if (!$filename) + { + // no way such an avatar could exist. They are not following the rules, stop the show. + send_status_line(403, 'Forbidden'); + } + else + { + send_avatar_to_browser(($avatar_group ? 'g' : '') . $filename . '.' . $ext, $browser); + } + } + file_gc(); +} + +// implicit else: we are not in avatar mode +include($phpbb_root_path . 'common.' . $phpEx); +require($phpbb_root_path . 'includes/functions_download' . '.' . $phpEx); + +$attach_id = $request->variable('id', 0); +$mode = $request->variable('mode', ''); +$thumbnail = $request->variable('t', false); + +// Start session management, do not update session page. +$user->session_begin(false); +$auth->acl($user->data); +$user->setup('viewtopic'); + +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +if (!$config['allow_attachments'] && !$config['allow_pm_attach']) +{ + send_status_line(404, 'Not Found'); + trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED'); +} + +if (!$attach_id) +{ + send_status_line(404, 'Not Found'); + trigger_error('NO_ATTACHMENT_SELECTED'); +} + +$sql = 'SELECT attach_id, post_msg_id, topic_id, in_message, poster_id, is_orphan, physical_filename, real_filename, extension, mimetype, filesize, filetime + FROM ' . ATTACHMENTS_TABLE . " + WHERE attach_id = $attach_id"; +$result = $db->sql_query($sql); +$attachment = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +if (!$attachment) +{ + send_status_line(404, 'Not Found'); + trigger_error('ERROR_NO_ATTACHMENT'); +} +else if (!download_allowed()) +{ + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['LINKAGE_FORBIDDEN']); +} +else +{ + $attachment['physical_filename'] = utf8_basename($attachment['physical_filename']); + + if (!$attachment['in_message'] && !$config['allow_attachments'] || $attachment['in_message'] && !$config['allow_pm_attach']) + { + send_status_line(404, 'Not Found'); + trigger_error('ATTACHMENT_FUNCTIONALITY_DISABLED'); + } + + if ($attachment['is_orphan']) + { + // We allow admins having attachment permissions to see orphan attachments... + $own_attachment = ($auth->acl_get('a_attach') || $attachment['poster_id'] == $user->data['user_id']) ? true : false; + + if (!$own_attachment || ($attachment['in_message'] && !$auth->acl_get('u_pm_download')) || (!$attachment['in_message'] && !$auth->acl_get('u_download'))) + { + send_status_line(404, 'Not Found'); + trigger_error('ERROR_NO_ATTACHMENT'); + } + + // Obtain all extensions... + $extensions = $cache->obtain_attach_extensions(true); + } + else + { + if (!$attachment['in_message']) + { + phpbb_download_handle_forum_auth($db, $auth, $attachment['topic_id']); + + $sql = 'SELECT forum_id, post_visibility + FROM ' . POSTS_TABLE . ' + WHERE post_id = ' . (int) $attachment['post_msg_id']; + $result = $db->sql_query($sql); + $post_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$post_row || !$phpbb_content_visibility->is_visible('post', $post_row['forum_id'], $post_row)) + { + // Attachment of a soft deleted post and the user is not allowed to see the post + send_status_line(404, 'Not Found'); + trigger_error('ERROR_NO_ATTACHMENT'); + } + } + else + { + // Attachment is in a private message. + $post_row = array('forum_id' => false); + phpbb_download_handle_pm_auth($db, $auth, $user->data['user_id'], $attachment['post_msg_id']); + } + + $extensions = array(); + if (!extension_allowed($post_row['forum_id'], $attachment['extension'], $extensions)) + { + send_status_line(403, 'Forbidden'); + trigger_error(sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension'])); + } + } + + $download_mode = (int) $extensions[$attachment['extension']]['download_mode']; + $display_cat = $extensions[$attachment['extension']]['display_cat']; + + if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !$user->optionget('viewimg')) + { + $display_cat = ATTACHMENT_CATEGORY_NONE; + } + + if ($display_cat == ATTACHMENT_CATEGORY_FLASH && !$user->optionget('viewflash')) + { + $display_cat = ATTACHMENT_CATEGORY_NONE; + } + + /** + * Event to modify data before sending file to browser + * + * @event core.download_file_send_to_browser_before + * @var int attach_id The attachment ID + * @var array attachment Array with attachment data + * @var int display_cat Attachment category + * @var int download_mode File extension specific download mode + * @var array extensions Array with file extensions data + * @var string mode Download mode + * @var bool thumbnail Flag indicating if the file is a thumbnail + * @since 3.1.6-RC1 + * @changed 3.1.7-RC1 Fixing wrong name of a variable (replacing "extension" by "extensions") + */ + $vars = array( + 'attach_id', + 'attachment', + 'display_cat', + 'download_mode', + 'extensions', + 'mode', + 'thumbnail', + ); + extract($phpbb_dispatcher->trigger_event('core.download_file_send_to_browser_before', compact($vars))); + + if ($thumbnail) + { + $attachment['physical_filename'] = 'thumb_' . $attachment['physical_filename']; + } + else if ($display_cat == ATTACHMENT_CATEGORY_NONE && !$attachment['is_orphan'] && !phpbb_http_byte_range($attachment['filesize'])) + { + // Update download count + phpbb_increment_downloads($db, $attachment['attach_id']); + } + + if ($display_cat == ATTACHMENT_CATEGORY_IMAGE && $mode === 'view' && (strpos($attachment['mimetype'], 'image') === 0) && (strpos(strtolower($user->browser), 'msie') !== false) && !phpbb_is_greater_ie_version($user->browser, 7)) + { + wrap_img_in_html(append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'id=' . $attachment['attach_id']), $attachment['real_filename']); + file_gc(); + } + else + { + // Determine the 'presenting'-method + if ($download_mode == PHYSICAL_LINK) + { + // This presenting method should no longer be used + if (!@is_dir($phpbb_root_path . $config['upload_path'])) + { + send_status_line(500, 'Internal Server Error'); + trigger_error($user->lang['PHYSICAL_DOWNLOAD_NOT_POSSIBLE']); + } + + redirect($phpbb_root_path . $config['upload_path'] . '/' . $attachment['physical_filename']); + file_gc(); + } + else + { + send_file_to_browser($attachment, $config['upload_path'], $display_cat); + file_gc(); + } + } +} diff --git a/install/update/old/ext/phpbb/viglink/acp/viglink_helper.php b/install/update/old/ext/phpbb/viglink/acp/viglink_helper.php new file mode 100644 index 0000000..86568de --- /dev/null +++ b/install/update/old/ext/phpbb/viglink/acp/viglink_helper.php @@ -0,0 +1,146 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + */ + +namespace phpbb\viglink\acp; + +/** + * Class to handle allowing or disallowing VigLink services + */ +class viglink_helper +{ + /** @var \phpbb\cache\driver\driver_interface $cache */ + protected $cache; + + /** @var \phpbb\config\config $config */ + protected $config; + + /** @var \phpbb\file_downloader $file_downloader */ + protected $file_downloader; + + /** @var \phpbb\language\language $language */ + protected $language; + + /** @var \phpbb\log\log $log */ + protected $log; + + /** @var \phpbb\user $user */ + protected $user; + + /** @var bool Use SSL or not */ + protected $use_ssl = false; + + /** + * Constructor + * + * @param \phpbb\cache\driver\driver_interface $cache + * @param \phpbb\config\config $config + * @param \phpbb\file_downloader $file_downloader + * @param \phpbb\language\language $language + * @param \phpbb\log\log $log + * @param \phpbb\user $user + */ + public function __construct(\phpbb\cache\driver\driver_interface $cache, \phpbb\config\config $config, \phpbb\file_downloader $file_downloader, \phpbb\language\language $language, \phpbb\log\log $log, \phpbb\user $user) + { + $this->cache = $cache; + $this->config = $config; + $this->file_downloader = $file_downloader; + $this->language = $language; + $this->log = $log; + $this->user = $user; + } + + /** + * Obtains the latest VigLink services information from phpBB + * + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * + * @throws \RuntimeException + * + * @return void + */ + public function set_viglink_services($force_update = false, $force_cache = false) + { + $cache_key = '_versioncheck_viglink_' . $this->use_ssl; + + $info = $this->cache->get($cache_key); + + if ($info === false && $force_cache) + { + throw new \RuntimeException($this->language->lang('VERSIONCHECK_FAIL')); + } + else if ($info === false || $force_update) + { + try + { + $info = $this->file_downloader->get('www.phpbb.com', '/viglink', 'enabled', 443); + } + catch (\phpbb\exception\runtime_exception $exception) + { + $prepare_parameters = array_merge(array($exception->getMessage()), $exception->get_parameters()); + throw new \RuntimeException(call_user_func_array(array($this->language, 'lang'), $prepare_parameters)); + } + + if ($info === '0') + { + $this->set_viglink_configs(array( + 'allow_viglink_phpbb' => false, + )); + } + else + { + $info = '1'; + $this->set_viglink_configs(array( + 'allow_viglink_phpbb' => true, + )); + } + + $this->cache->put($cache_key, $info, 86400); // 24 hours + } + } + + /** + * Sets VigLink service configs as determined by phpBB + * + * @param array $data Array of VigLink file data. + * + * @return void + */ + protected function set_viglink_configs($data) + { + $viglink_configs = array( + 'allow_viglink_phpbb', + 'phpbb_viglink_api_key', + ); + + foreach ($viglink_configs as $cfg_name) + { + if (array_key_exists($cfg_name, $data) && ($data[$cfg_name] != $this->config[$cfg_name] || !isset($this->config[$cfg_name]))) + { + $this->config->set($cfg_name, $data[$cfg_name]); + } + } + + $this->config->set('viglink_last_gc', time(), false); + } + + /** + * Log a VigLink error message to the error log + * + * @param string $message The error message + */ + public function log_viglink_error($message) + { + $user_id = empty($this->user->data) ? ANONYMOUS : $this->user->data['user_id']; + $user_ip = empty($this->user->ip) ? '' : $this->user->ip; + + $this->log->add('critical', $user_id, $user_ip, 'LOG_VIGLINK_CHECK_FAIL', false, array($message)); + } +} diff --git a/install/update/old/ext/phpbb/viglink/composer.json b/install/update/old/ext/phpbb/viglink/composer.json new file mode 100644 index 0000000..30312e3 --- /dev/null +++ b/install/update/old/ext/phpbb/viglink/composer.json @@ -0,0 +1,27 @@ +{ + "name": "phpbb/viglink", + "type": "phpbb-extension", + "description": "The VigLink extension for phpBB makes it possible to earn revenue, without any change to the user experience, when users post and follow links to commercial sites.", + "homepage": "https://www.phpbb.com", + "version": "1.0.4", + "keywords": ["phpbb", "extension", "viglink"], + "license": "GPL-2.0-only", + "authors": [ + { + "name": "phpBB Limited", + "email": "operations@phpbb.com", + "homepage": "https://www.phpbb.com/go/authors" + } + ], + "require": { + "php": ">=5.4", + "phpbb/phpbb": ">=3.2.0-b1", + "composer/installers": "~1.0" + }, + "extra": { + "display-name": "VigLink", + "soft-require": { + "phpbb/phpbb": ">=3.2.0-b1,<3.3" + } + } +} diff --git a/install/update/old/ext/phpbb/viglink/composer.lock b/install/update/old/ext/phpbb/viglink/composer.lock new file mode 100644 index 0000000..f03a73d --- /dev/null +++ b/install/update/old/ext/phpbb/viglink/composer.lock @@ -0,0 +1,115 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "155838fcd9206482cc645c3de6a7e8db", + "content-hash": "610135270d537f2e8580b747c6b57ce9", + "packages": [ + { + "name": "composer/installers", + "version": "v1.0.20", + "source": { + "type": "git", + "url": "https://github.com/composer/installers.git", + "reference": "1bff8aa77a18f3616f468ed8000cf86a5725bac3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/installers/zipball/1bff8aa77a18f3616f468ed8000cf86a5725bac3", + "reference": "1bff8aa77a18f3616f468ed8000cf86a5725bac3", + "shasum": "" + }, + "replace": { + "roundcube/plugin-installer": "*", + "shama/baton": "*" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpunit/phpunit": "4.1.*" + }, + "type": "composer-installer", + "extra": { + "class": "Composer\\Installers\\Installer", + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-0": { + "Composer\\Installers\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "description": "A multi-framework Composer library installer", + "homepage": "http://composer.github.com/installers/", + "keywords": [ + "Craft", + "Dolibarr", + "Hurad", + "MODX Evo", + "OXID", + "SMF", + "Thelia", + "WolfCMS", + "agl", + "annotatecms", + "bitrix", + "cakephp", + "chef", + "codeigniter", + "concrete5", + "croogo", + "dokuwiki", + "drupal", + "elgg", + "fuelphp", + "grav", + "installer", + "joomla", + "kohana", + "laravel", + "lithium", + "magento", + "mako", + "mediawiki", + "modulework", + "moodle", + "phpbb", + "piwik", + "ppi", + "puppet", + "roundcube", + "shopware", + "silverstripe", + "symfony", + "typo3", + "wordpress", + "zend", + "zikula" + ], + "time": "2015-01-11 03:51:11" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.3.3" + }, + "platform-dev": [] +} diff --git a/install/update/old/ext/phpbb/viglink/styles/all/theme/viglink.css b/install/update/old/ext/phpbb/viglink/styles/all/theme/viglink.css new file mode 100644 index 0000000..c507a54 --- /dev/null +++ b/install/update/old/ext/phpbb/viglink/styles/all/theme/viglink.css @@ -0,0 +1,18 @@ +/* phpBB VigLink Extension Style Sheet + ------------------------------------------------------------------------ + Copyright (c) phpBB Limited + + For full copyright and license information, please see + the docs/CREDITS.txt file. + ------------------------------------------------------------------------ +*/ + +.viglink-header { + background: url('images/VigLink_logo.png') no-repeat 0 0; + padding-bottom: 18px; + padding-left: 142px; +} + +.send-stats-tile > .viglink-header-h2 { + margin-bottom: 10px; +} diff --git a/install/update/old/feed.php b/install/update/old/feed.php new file mode 100644 index 0000000..1480867 --- /dev/null +++ b/install/update/old/feed.php @@ -0,0 +1,58 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +* Idea and original RSS Feed 2.0 MOD (Version 1.0.8/9) by leviatan21 +* Original MOD: http://www.phpbb.com/community/viewtopic.php?f=69&t=1214645 +* MOD Author Profile: http://www.phpbb.com/community/memberlist.php?mode=viewprofile&u=345763 +* MOD Author Homepage: http://www.mssti.com/phpbb3/ +* +**/ + +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\Routing\Exception\InvalidParameterException; + +/** +* @ignore +**/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); + +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); + +$forum_id = $request->variable('f', 0); +$topic_id = $request->variable('t', 0); +$mode = $request->variable('mode', ''); + +if ($forum_id !== 0) +{ + $url = $controller_helper->route('phpbb_feed_forum', array('forum_id' => $forum_id)); +} +else if ($topic_id !== 0) +{ + $url = $controller_helper->route('phpbb_feed_topic', array('topic_id' => $topic_id)); +} +else +{ + try + { + $url = $controller_helper->route('phpbb_feed_overall', array('mode' => $mode)); + } + catch (InvalidParameterException $e) + { + $url = $controller_helper->route('phpbb_feed_index'); + } +} + +$response = new RedirectResponse($url, 301); +$response->send(); diff --git a/install/update/old/includes/acp/acp_attachments.php b/install/update/old/includes/acp/acp_attachments.php new file mode 100644 index 0000000..5b1db5c --- /dev/null +++ b/install/update/old/includes/acp/acp_attachments.php @@ -0,0 +1,1732 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_attachments +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var ContainerBuilder */ + protected $phpbb_container; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + /** @var \phpbb\attachment\manager */ + protected $attachment_manager; + + public $id; + public $u_action; + protected $new_config; + + function main($id, $mode) + { + global $db, $user, $auth, $template, $cache, $phpbb_container, $phpbb_filesystem, $phpbb_dispatcher; + global $config, $phpbb_admin_path, $phpbb_root_path, $phpEx, $phpbb_log, $request; + + $this->id = $id; + $this->db = $db; + $this->config = $config; + $this->template = $template; + $this->user = $user; + $this->phpbb_container = $phpbb_container; + $this->filesystem = $phpbb_filesystem; + $this->attachment_manager = $phpbb_container->get('attachment.manager'); + + $user->add_lang(array('posting', 'viewtopic', 'acp/attachments')); + + $error = $notify = array(); + $submit = (isset($_POST['submit'])) ? true : false; + $action = $request->variable('action', ''); + + $form_key = 'acp_attach'; + add_form_key($form_key); + + if ($submit && !check_form_key($form_key)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + switch ($mode) + { + case 'attach': + $l_title = 'ACP_ATTACHMENT_SETTINGS'; + break; + + case 'extensions': + $l_title = 'ACP_MANAGE_EXTENSIONS'; + break; + + case 'ext_groups': + $l_title = 'ACP_EXTENSION_GROUPS'; + break; + + case 'orphan': + $l_title = 'ACP_ORPHAN_ATTACHMENTS'; + break; + + case 'manage': + $l_title = 'ACP_MANAGE_ATTACHMENTS'; + break; + + default: + trigger_error('NO_MODE', E_USER_ERROR); + break; + } + + $this->tpl_name = 'acp_attachments'; + $this->page_title = $l_title; + + $template->assign_vars(array( + 'L_TITLE' => $user->lang[$l_title], + 'L_TITLE_EXPLAIN' => $user->lang[$l_title . '_EXPLAIN'], + 'U_ACTION' => $this->u_action) + ); + + switch ($mode) + { + case 'attach': + + if (!function_exists('get_supported_image_types')) + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } + + $sql = 'SELECT group_name, cat_id + FROM ' . EXTENSION_GROUPS_TABLE . ' + WHERE cat_id > 0 + ORDER BY cat_id'; + $result = $db->sql_query($sql); + + $s_assigned_groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['group_name'] = (isset($user->lang['EXT_GROUP_' . $row['group_name']])) ? $user->lang['EXT_GROUP_' . $row['group_name']] : $row['group_name']; + $s_assigned_groups[$row['cat_id']][] = $row['group_name']; + } + $db->sql_freeresult($result); + + $l_legend_cat_images = $user->lang['SETTINGS_CAT_IMAGES'] . ' [' . $user->lang['ASSIGNED_GROUP'] . ': ' . ((!empty($s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE])) ? implode($user->lang['COMMA_SEPARATOR'], $s_assigned_groups[ATTACHMENT_CATEGORY_IMAGE]) : $user->lang['NO_EXT_GROUP']) . ']'; + + $display_vars = array( + 'title' => 'ACP_ATTACHMENT_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_ATTACHMENT_SETTINGS', + + 'img_max_width' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), + 'img_max_height' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), + 'img_link_width' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), + 'img_link_height' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false,), + + 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'upload_path' => array('lang' => 'UPLOAD_DIR', 'validate' => 'wpath', 'type' => 'text:25:100', 'explain' => true), + 'display_order' => array('lang' => 'DISPLAY_ORDER', 'validate' => 'bool', 'type' => 'custom', 'method' => 'display_order', 'explain' => true), + 'attachment_quota' => array('lang' => 'ATTACH_QUOTA', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), + 'max_filesize' => array('lang' => 'ATTACH_MAX_FILESIZE', 'validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), + 'max_filesize_pm' => array('lang' => 'ATTACH_MAX_PM_FILESIZE','validate' => 'string', 'type' => 'custom', 'method' => 'max_filesize', 'explain' => true), + 'max_attachments' => array('lang' => 'MAX_ATTACHMENTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => false), + 'max_attachments_pm' => array('lang' => 'MAX_ATTACHMENTS_PM', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => false), + 'secure_downloads' => array('lang' => 'SECURE_DOWNLOADS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'secure_allow_deny' => array('lang' => 'SECURE_ALLOW_DENY', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_allow_deny', 'explain' => true), + 'secure_allow_empty_referer' => array('lang' => 'SECURE_EMPTY_REFERRER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'check_attachment_content' => array('lang' => 'CHECK_CONTENT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend2' => $l_legend_cat_images, + 'img_display_inlined' => array('lang' => 'DISPLAY_INLINED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'img_create_thumbnail' => array('lang' => 'CREATE_THUMBNAIL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'img_max_thumb_width' => array('lang' => 'MAX_THUMB_WIDTH', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'img_min_thumb_filesize' => array('lang' => 'MIN_THUMB_FILESIZE', 'validate' => 'int:0:999999999999999', 'type' => 'number:0:999999999999999', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), + 'img_max' => array('lang' => 'MAX_IMAGE_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'img_link' => array('lang' => 'IMAGE_LINK_SIZE', 'validate' => 'int:0:9999', 'type' => 'dimension:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + ) + ); + + /** + * Event to add and/or modify acp_attachement configurations + * + * @event core.acp_attachments_config_edit_add + * @var array display_vars Array of config values to display and process + * @var string mode Mode of the config page we are displaying + * @var boolean submit Do we display the form or process the submission + * @since 3.1.11-RC1 + */ + $vars = array('display_vars', 'mode', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.acp_attachments_config_edit_add', compact($vars))); + + $this->new_config = $config; + $cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => '')) : $this->new_config; + $error = array(); + + // We validate the complete config if whished + validate_config_vars($display_vars['vars'], $cfg_array, $error); + + // Do not write values if there is an error + if (count($error)) + { + $submit = false; + } + + // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... + foreach ($display_vars['vars'] as $config_name => $null) + { + if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) + { + continue; + } + + $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; + + if (in_array($config_name, array('attachment_quota', 'max_filesize', 'max_filesize_pm'))) + { + $size_var = $request->variable($config_name, ''); + $this->new_config[$config_name] = $config_value = ($size_var == 'kb') ? round($config_value * 1024) : (($size_var == 'mb') ? round($config_value * 1048576) : $config_value); + } + + if ($submit) + { + $config->set($config_name, $config_value); + } + } + + $this->perform_site_list(); + + if ($submit) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_ATTACH'); + + // Check Settings + $this->test_upload($error, $this->new_config['upload_path'], false); + + if (!count($error)) + { + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + } + } + + $template->assign_var('S_ATTACHMENT_SETTINGS', true); + + // Secure Download Options - Same procedure as with banning + $allow_deny = ($this->new_config['secure_allow_deny']) ? 'ALLOWED' : 'DISALLOWED'; + + $sql = 'SELECT * + FROM ' . SITELIST_TABLE; + $result = $db->sql_query($sql); + + $defined_ips = ''; + $ips = array(); + + while ($row = $db->sql_fetchrow($result)) + { + $value = ($row['site_ip']) ? $row['site_ip'] : $row['site_hostname']; + if ($value) + { + $defined_ips .= '' . $value . ''; + $ips[$row['site_id']] = $value; + } + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_SECURE_DOWNLOADS' => $this->new_config['secure_downloads'], + 'S_DEFINED_IPS' => ($defined_ips != '') ? true : false, + 'S_WARNING' => (count($error)) ? true : false, + + 'WARNING_MSG' => implode('
', $error), + 'DEFINED_IPS' => $defined_ips, + + 'L_SECURE_TITLE' => $user->lang['DEFINE_' . $allow_deny . '_IPS'], + 'L_IP_EXCLUDE' => $user->lang['EXCLUDE_FROM_' . $allow_deny . '_IP'], + 'L_REMOVE_IPS' => $user->lang['REMOVE_' . $allow_deny . '_IPS']) + ); + + // Output relevant options + foreach ($display_vars['vars'] as $config_key => $vars) + { + if (!is_array($vars) && strpos($config_key, 'legend') === false) + { + continue; + } + + if (strpos($config_key, 'legend') !== false) + { + $template->assign_block_vars('options', array( + 'S_LEGEND' => true, + 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars) + ); + + continue; + } + + $type = explode(':', $vars['type']); + + $l_explain = ''; + if ($vars['explain'] && isset($vars['lang_explain'])) + { + $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain']; + } + else if ($vars['explain']) + { + $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : ''; + } + + $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); + if (empty($content)) + { + continue; + } + + $template->assign_block_vars('options', array( + 'KEY' => $config_key, + 'TITLE' => $user->lang[$vars['lang']], + 'S_EXPLAIN' => $vars['explain'], + 'TITLE_EXPLAIN' => $l_explain, + 'CONTENT' => $content, + ) + ); + + unset($display_vars['vars'][$config_key]); + } + + break; + + case 'extensions': + + if ($submit || isset($_POST['add_extension_check'])) + { + if ($submit) + { + // Change Extensions ? + $extension_change_list = $request->variable('extension_change_list', array(0)); + $group_select_list = $request->variable('group_select', array(0)); + + // Generate correct Change List + $extensions = array(); + + for ($i = 0, $size = count($extension_change_list); $i < $size; $i++) + { + $extensions[$extension_change_list[$i]]['group_id'] = $group_select_list[$i]; + } + + $sql = 'SELECT * + FROM ' . EXTENSIONS_TABLE . ' + ORDER BY extension_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['group_id'] != $extensions[$row['extension_id']]['group_id']) + { + $sql = 'UPDATE ' . EXTENSIONS_TABLE . ' + SET group_id = ' . (int) $extensions[$row['extension_id']]['group_id'] . ' + WHERE extension_id = ' . $row['extension_id']; + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_UPDATE', false, array($row['extension'])); + } + } + $db->sql_freeresult($result); + + // Delete Extension? + $extension_id_list = $request->variable('extension_id_list', array(0)); + + if (count($extension_id_list)) + { + $sql = 'SELECT extension + FROM ' . EXTENSIONS_TABLE . ' + WHERE ' . $db->sql_in_set('extension_id', $extension_id_list); + $result = $db->sql_query($sql); + + $extension_list = ''; + while ($row = $db->sql_fetchrow($result)) + { + $extension_list .= ($extension_list == '') ? $row['extension'] : ', ' . $row['extension']; + } + $db->sql_freeresult($result); + + $sql = 'DELETE + FROM ' . EXTENSIONS_TABLE . ' + WHERE ' . $db->sql_in_set('extension_id', $extension_id_list); + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_DEL', false, array($extension_list)); + } + } + + // Add Extension? + $add_extension = strtolower($request->variable('add_extension', '')); + $add_extension_group = $request->variable('add_group_select', 0); + $add = (isset($_POST['add_extension_check'])) ? true : false; + + if ($add_extension && $add) + { + if (!count($error)) + { + $sql = 'SELECT extension_id + FROM ' . EXTENSIONS_TABLE . " + WHERE extension = '" . $db->sql_escape($add_extension) . "'"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $error[] = sprintf($user->lang['EXTENSION_EXIST'], $add_extension); + } + $db->sql_freeresult($result); + + if (!count($error)) + { + $sql_ary = array( + 'group_id' => $add_extension_group, + 'extension' => $add_extension + ); + + $db->sql_query('INSERT INTO ' . EXTENSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXT_ADD', false, array($add_extension)); + } + } + } + + if (!count($error)) + { + $notify[] = $user->lang['EXTENSIONS_UPDATED']; + } + + $cache->destroy('_extensions'); + } + + $template->assign_vars(array( + 'S_EXTENSIONS' => true, + 'ADD_EXTENSION' => (isset($add_extension)) ? $add_extension : '', + 'GROUP_SELECT_OPTIONS' => (isset($_POST['add_extension_check'])) ? $this->group_select('add_group_select', $add_extension_group, 'extension_group') : $this->group_select('add_group_select', false, 'extension_group')) + ); + + $sql = 'SELECT * + FROM ' . EXTENSIONS_TABLE . ' + ORDER BY group_id, extension'; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $old_group_id = $row['group_id']; + do + { + $s_spacer = false; + + $current_group_id = $row['group_id']; + if ($old_group_id != $current_group_id) + { + $s_spacer = true; + $old_group_id = $current_group_id; + } + + $template->assign_block_vars('extensions', array( + 'S_SPACER' => $s_spacer, + 'EXTENSION_ID' => $row['extension_id'], + 'EXTENSION' => $row['extension'], + 'GROUP_OPTIONS' => $this->group_select('group_select[]', $row['group_id'])) + ); + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + break; + + case 'ext_groups': + + $template->assign_var('S_EXTENSION_GROUPS', true); + + if ($submit) + { + $action = $request->variable('action', ''); + $group_id = $request->variable('g', 0); + + if ($action != 'add' && $action != 'edit') + { + trigger_error('NO_MODE', E_USER_ERROR); + } + + if (!$group_id && $action == 'edit') + { + trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if ($group_id) + { + $sql = 'SELECT * + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE group_id = $group_id"; + $result = $db->sql_query($sql); + $ext_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$ext_row) + { + trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + else + { + $ext_row = array(); + } + + $group_name = $request->variable('group_name', '', true); + $new_group_name = ($action == 'add') ? $group_name : (($ext_row['group_name'] != $group_name) ? $group_name : ''); + + if (!$group_name) + { + $error[] = $user->lang['NO_EXT_GROUP_NAME']; + } + + // Check New Group Name + if ($new_group_name) + { + $sql = 'SELECT group_id + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($new_group_name)) . "'"; + if ($group_id) + { + $sql .= ' AND group_id <> ' . $group_id; + } + $result = $db->sql_query($sql); + + if ($db->sql_fetchrow($result)) + { + $error[] = sprintf($user->lang['EXTENSION_GROUP_EXIST'], $new_group_name); + } + $db->sql_freeresult($result); + } + + if (!count($error)) + { + // Ok, build the update/insert array + $upload_icon = $request->variable('upload_icon', 'no_image'); + $size_select = $request->variable('size_select', 'b'); + $forum_select = $request->variable('forum_select', false); + $allowed_forums = $request->variable('allowed_forums', array(0)); + $allow_in_pm = (isset($_POST['allow_in_pm'])) ? true : false; + $max_filesize = $request->variable('max_filesize', 0); + $max_filesize = ($size_select == 'kb') ? round($max_filesize * 1024) : (($size_select == 'mb') ? round($max_filesize * 1048576) : $max_filesize); + $allow_group = (isset($_POST['allow_group'])) ? true : false; + + if ($max_filesize == $config['max_filesize']) + { + $max_filesize = 0; + } + + if (!count($allowed_forums)) + { + $forum_select = false; + } + + $group_ary = array( + 'group_name' => $group_name, + 'cat_id' => $request->variable('special_category', ATTACHMENT_CATEGORY_NONE), + 'allow_group' => ($allow_group) ? 1 : 0, + 'upload_icon' => ($upload_icon == 'no_image') ? '' : $upload_icon, + 'max_filesize' => $max_filesize, + 'allowed_forums'=> ($forum_select) ? serialize($allowed_forums) : '', + 'allow_in_pm' => ($allow_in_pm) ? 1 : 0, + ); + + if ($action == 'add') + { + $group_ary['download_mode'] = INLINE_LINK; + } + + $sql = ($action == 'add') ? 'INSERT INTO ' . EXTENSION_GROUPS_TABLE . ' ' : 'UPDATE ' . EXTENSION_GROUPS_TABLE . ' SET '; + $sql .= $db->sql_build_array((($action == 'add') ? 'INSERT' : 'UPDATE'), $group_ary); + $sql .= ($action == 'edit') ? " WHERE group_id = $group_id" : ''; + + $db->sql_query($sql); + + if ($action == 'add') + { + $group_id = $db->sql_nextid(); + } + + $group_name = (isset($user->lang['EXT_GROUP_' . $group_name])) ? $user->lang['EXT_GROUP_' . $group_name] : $group_name; + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXTGROUP_' . strtoupper($action), false, array($group_name)); + } + + $extension_list = $request->variable('extensions', array(0)); + + if ($action == 'edit' && count($extension_list)) + { + $sql = 'UPDATE ' . EXTENSIONS_TABLE . " + SET group_id = 0 + WHERE group_id = $group_id"; + $db->sql_query($sql); + } + + if (count($extension_list)) + { + $sql = 'UPDATE ' . EXTENSIONS_TABLE . " + SET group_id = $group_id + WHERE " . $db->sql_in_set('extension_id', $extension_list); + $db->sql_query($sql); + } + + $cache->destroy('_extensions'); + + if (!count($error)) + { + $notify[] = $user->lang['SUCCESS_EXTENSION_GROUP_' . strtoupper($action)]; + } + } + + $cat_lang = array( + ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], + ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], + ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], + ); + + $group_id = $request->variable('g', 0); + $action = (isset($_POST['add'])) ? 'add' : $action; + + switch ($action) + { + case 'delete': + + if (confirm_box(true)) + { + $sql = 'SELECT group_name + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE group_id = $group_id"; + $result = $db->sql_query($sql); + $group_name = (string) $db->sql_fetchfield('group_name'); + $db->sql_freeresult($result); + + $sql = 'DELETE + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE group_id = $group_id"; + $db->sql_query($sql); + + // Set corresponding Extensions to a pending Group + $sql = 'UPDATE ' . EXTENSIONS_TABLE . " + SET group_id = 0 + WHERE group_id = $group_id"; + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_EXTGROUP_DEL', false, array($group_name)); + + $cache->destroy('_extensions'); + + trigger_error($user->lang['EXTENSION_GROUP_DELETED'] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'group_id' => $group_id, + 'action' => 'delete', + ))); + } + + break; + + case 'edit': + + if (!$group_id) + { + trigger_error($user->lang['NO_EXT_GROUP_SPECIFIED'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql = 'SELECT * + FROM ' . EXTENSION_GROUPS_TABLE . " + WHERE group_id = $group_id"; + $result = $db->sql_query($sql); + $ext_group_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $forum_ids = (!$ext_group_row['allowed_forums']) ? array() : unserialize(trim($ext_group_row['allowed_forums'])); + + // no break; + + case 'add': + + if ($action == 'add') + { + $ext_group_row = array( + 'group_name' => $request->variable('group_name', '', true), + 'cat_id' => 0, + 'allow_group' => 1, + 'allow_in_pm' => 1, + 'upload_icon' => '', + 'max_filesize' => 0, + ); + + $forum_ids = array(); + } + + $sql = 'SELECT * + FROM ' . EXTENSIONS_TABLE . " + WHERE group_id = $group_id + OR group_id = 0 + ORDER BY extension"; + $result = $db->sql_query($sql); + $extensions = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + if ($ext_group_row['max_filesize'] == 0) + { + $ext_group_row['max_filesize'] = (int) $config['max_filesize']; + } + + $max_filesize = get_formatted_filesize($ext_group_row['max_filesize'], false, array('mb', 'kb', 'b')); + $size_format = $max_filesize['si_identifier']; + $ext_group_row['max_filesize'] = $max_filesize['value']; + + $img_path = $config['upload_icons_path']; + + $filename_list = ''; + $no_image_select = false; + + $imglist = filelist($phpbb_root_path . $img_path); + + if (!empty($imglist[''])) + { + $imglist = array_values($imglist); + $imglist = $imglist[0]; + + foreach ($imglist as $key => $img) + { + if (!$ext_group_row['upload_icon']) + { + $no_image_select = true; + $selected = ''; + } + else + { + $selected = ($ext_group_row['upload_icon'] == $img) ? ' selected="selected"' : ''; + } + + if (strlen($img) > 255) + { + continue; + } + + $filename_list .= ''; + } + } + + $i = 0; + $assigned_extensions = ''; + foreach ($extensions as $num => $row) + { + if ($row['group_id'] == $group_id && $group_id) + { + $assigned_extensions .= ($i) ? ', ' . $row['extension'] : $row['extension']; + $i++; + } + } + + $s_extension_options = ''; + foreach ($extensions as $row) + { + $s_extension_options .= '' . $row['extension'] . ''; + } + + $template->assign_vars(array( + 'IMG_PATH' => $img_path, + 'ACTION' => $action, + 'GROUP_ID' => $group_id, + 'GROUP_NAME' => $ext_group_row['group_name'], + 'ALLOW_GROUP' => $ext_group_row['allow_group'], + 'ALLOW_IN_PM' => $ext_group_row['allow_in_pm'], + 'UPLOAD_ICON_SRC' => $phpbb_root_path . $img_path . '/' . $ext_group_row['upload_icon'], + 'EXTGROUP_FILESIZE' => $ext_group_row['max_filesize'], + 'ASSIGNED_EXTENSIONS' => $assigned_extensions, + + 'S_CATEGORY_SELECT' => $this->category_select('special_category', $group_id, 'category'), + 'S_EXT_GROUP_SIZE_OPTIONS' => size_select_options($size_format), + 'S_EXTENSION_OPTIONS' => $s_extension_options, + 'S_FILENAME_LIST' => $filename_list, + 'S_EDIT_GROUP' => true, + 'S_NO_IMAGE' => $no_image_select, + 'S_FORUM_IDS' => (count($forum_ids)) ? true : false, + + 'U_EXTENSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&mode=extensions"), + 'U_BACK' => $this->u_action, + + 'L_LEGEND' => $user->lang[strtoupper($action) . '_EXTENSION_GROUP']) + ); + + $s_forum_id_options = ''; + + /** @todo use in-built function **/ + + $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql, 600); + + $right = $cat_right = $padding_inc = 0; + $padding = $forum_list = $holding = ''; + $padding_store = array('0' => ''); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) + { + // Non-postable forum with no subforums, don't display + continue; + } + + if (!$auth->acl_get('f_list', $row['forum_id'])) + { + // if the user does not have permissions to list this forum skip + continue; + } + + if ($row['left_id'] < $right) + { + $padding .= '   '; + $padding_store[$row['parent_id']] = $padding; + } + else if ($row['left_id'] > $right + 1) + { + $padding = empty($padding_store[$row['parent_id']]) ? '' : $padding_store[$row['parent_id']]; + } + + $right = $row['right_id']; + + $selected = (in_array($row['forum_id'], $forum_ids)) ? ' selected="selected"' : ''; + + if ($row['left_id'] > $cat_right) + { + // make sure we don't forget anything + $s_forum_id_options .= $holding; + $holding = ''; + } + + if ($row['right_id'] - $row['left_id'] > 1) + { + $cat_right = max($cat_right, $row['right_id']); + + $holding .= ''; + } + else + { + $s_forum_id_options .= $holding . ''; + $holding = ''; + } + } + + if ($holding) + { + $s_forum_id_options .= $holding; + } + + $db->sql_freeresult($result); + unset($padding_store); + + $template->assign_vars(array( + 'S_FORUM_ID_OPTIONS' => $s_forum_id_options) + ); + + break; + } + + $sql = 'SELECT * + FROM ' . EXTENSION_GROUPS_TABLE . ' + ORDER BY allow_group DESC, allow_in_pm DESC, group_name'; + $result = $db->sql_query($sql); + + $old_allow_group = $old_allow_pm = 1; + while ($row = $db->sql_fetchrow($result)) + { + $s_add_spacer = ($old_allow_group != $row['allow_group'] || $old_allow_pm != $row['allow_in_pm']) ? true : false; + + $template->assign_block_vars('groups', array( + 'S_ADD_SPACER' => $s_add_spacer, + 'S_ALLOWED_IN_PM' => ($row['allow_in_pm']) ? true : false, + 'S_GROUP_ALLOWED' => ($row['allow_group']) ? true : false, + + 'U_EDIT' => $this->u_action . "&action=edit&g={$row['group_id']}", + 'U_DELETE' => $this->u_action . "&action=delete&g={$row['group_id']}", + + 'GROUP_NAME' => (isset($user->lang['EXT_GROUP_' . $row['group_name']])) ? $user->lang['EXT_GROUP_' . $row['group_name']] : $row['group_name'], + 'CATEGORY' => $cat_lang[$row['cat_id']], + ) + ); + + $old_allow_group = $row['allow_group']; + $old_allow_pm = $row['allow_in_pm']; + } + $db->sql_freeresult($result); + + break; + + case 'orphan': + + /* @var $pagination \phpbb\pagination */ + $pagination = $this->phpbb_container->get('pagination'); + + if ($submit) + { + $delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); + $add_files = (isset($_POST['add'])) ? array_keys($request->variable('add', array('' => 0))) : array(); + $post_ids = $request->variable('post_id', array('' => 0)); + + if (count($delete_files)) + { + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', $delete_files) . ' + AND is_orphan = 1'; + $result = $db->sql_query($sql); + + $delete_files = array(); + while ($row = $db->sql_fetchrow($result)) + { + $this->attachment_manager->unlink($row['physical_filename'], 'file'); + + if ($row['thumbnail']) + { + $this->attachment_manager->unlink($row['physical_filename'], 'thumbnail'); + } + + $delete_files[$row['attach_id']] = $row['real_filename']; + } + $db->sql_freeresult($result); + } + + if (count($delete_files)) + { + $sql = 'DELETE FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($delete_files)); + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_ORPHAN_DEL', false, array(implode(', ', $delete_files))); + $notify[] = sprintf($user->lang['LOG_ATTACH_ORPHAN_DEL'], implode($user->lang['COMMA_SEPARATOR'], $delete_files)); + } + + $upload_list = array(); + foreach ($add_files as $attach_id) + { + if (!isset($delete_files[$attach_id]) && !empty($post_ids[$attach_id])) + { + $upload_list[$attach_id] = $post_ids[$attach_id]; + } + } + unset($add_files); + + if (count($upload_list)) + { + $template->assign_var('S_UPLOADING_FILES', true); + + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + + $forum_names = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_names[$row['forum_id']] = $row['forum_name']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT forum_id, topic_id, post_id, poster_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_id', $upload_list); + $result = $db->sql_query($sql); + + $post_info = array(); + while ($row = $db->sql_fetchrow($result)) + { + $post_info[$row['post_id']] = $row; + } + $db->sql_freeresult($result); + + // Select those attachments we want to change... + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($upload_list)) . ' + AND is_orphan = 1'; + $result = $db->sql_query($sql); + + $files_added = $space_taken = 0; + while ($row = $db->sql_fetchrow($result)) + { + $post_row = $post_info[$upload_list[$row['attach_id']]]; + + $template->assign_block_vars('upload', array( + 'FILE_INFO' => sprintf($user->lang['UPLOADING_FILE_TO'], $row['real_filename'], $post_row['post_id']), + 'S_DENIED' => (!$auth->acl_get('f_attach', $post_row['forum_id'])) ? true : false, + 'L_DENIED' => (!$auth->acl_get('f_attach', $post_row['forum_id'])) ? sprintf($user->lang['UPLOAD_DENIED_FORUM'], $forum_names[$row['forum_id']]) : '') + ); + + if (!$auth->acl_get('f_attach', $post_row['forum_id'])) + { + continue; + } + + // Adjust attachment entry + $sql_ary = array( + 'in_message' => 0, + 'is_orphan' => 0, + 'poster_id' => $post_row['poster_id'], + 'post_msg_id' => $post_row['post_id'], + 'topic_id' => $post_row['topic_id'], + ); + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE attach_id = ' . $row['attach_id']; + $db->sql_query($sql); + + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_attachment = 1 + WHERE post_id = ' . $post_row['post_id']; + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_attachment = 1 + WHERE topic_id = ' . $post_row['topic_id']; + $db->sql_query($sql); + + $space_taken += $row['filesize']; + $files_added++; + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACH_FILEUPLOAD', false, array($post_row['post_id'], $row['real_filename'])); + } + $db->sql_freeresult($result); + + if ($files_added) + { + $config->increment('upload_dir_size', $space_taken, false); + $config->increment('num_files', $files_added, false); + } + } + } + + $template->assign_vars(array( + 'S_ORPHAN' => true) + ); + + $attachments_per_page = (int) $config['topics_per_page']; + + // Get total number or orphans older than 3 hours + $sql = 'SELECT COUNT(attach_id) as num_files, SUM(filesize) as total_size + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 1 + AND filetime < ' . (time() - 3*60*60); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $num_files = (int) $row['num_files']; + $total_size = (int) $row['total_size']; + $this->db->sql_freeresult($result); + + $start = $request->variable('start', 0); + $start = $pagination->validate_start($start, $attachments_per_page, $num_files); + + // Just get the files with is_orphan set and older than 3 hours + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 1 + AND filetime < ' . (time() - 3*60*60) . ' + ORDER BY filetime DESC'; + $result = $db->sql_query_limit($sql, $attachments_per_page, $start); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('orphan', array( + 'FILESIZE' => get_formatted_filesize($row['filesize']), + 'FILETIME' => $user->format_date($row['filetime']), + 'REAL_FILENAME' => utf8_basename($row['real_filename']), + 'PHYSICAL_FILENAME' => utf8_basename($row['physical_filename']), + 'ATTACH_ID' => $row['attach_id'], + 'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? $post_ids[$row['attach_id']] : '', + 'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&id=' . $row['attach_id'])) + ); + } + $db->sql_freeresult($result); + + $pagination->generate_template_pagination( + $this->u_action, + 'pagination', + 'start', + $num_files, + $attachments_per_page, + $start + ); + + $template->assign_vars(array( + 'TOTAL_FILES' => $num_files, + 'TOTAL_SIZE' => get_formatted_filesize($total_size), + )); + + break; + + case 'manage': + + if ($submit) + { + $delete_files = (isset($_POST['delete'])) ? array_keys($request->variable('delete', array('' => 0))) : array(); + + if (count($delete_files)) + { + // Select those attachments we want to delete... + $sql = 'SELECT real_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', $delete_files) . ' + AND is_orphan = 0'; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $deleted_filenames[] = $row['real_filename']; + } + $db->sql_freeresult($result); + + if ($num_deleted = $this->attachment_manager->delete('attach', $delete_files)) + { + if (count($delete_files) != $num_deleted) + { + $error[] = $user->lang['FILES_GONE']; + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACHMENTS_DELETED', false, array(implode(', ', $deleted_filenames))); + $notify[] = sprintf($user->lang['LOG_ATTACHMENTS_DELETED'], implode($user->lang['COMMA_SEPARATOR'], $deleted_filenames)); + } + else + { + $error[] = $user->lang['NO_FILES_TO_DELETE']; + } + } + } + + if ($action == 'stats') + { + $this->handle_stats_resync(); + } + + $stats_error = $this->check_stats_accuracy(); + + if ($stats_error) + { + $error[] = $stats_error; + } + + $template->assign_vars(array( + 'S_MANAGE' => true, + )); + + $start = $request->variable('start', 0); + + // Sort keys + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); + + // Sorting + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('f' => $user->lang['FILENAME'], 't' => $user->lang['FILEDATE'], 's' => $user->lang['FILESIZE'], 'x' => $user->lang['EXTENSION'], 'd' => $user->lang['DOWNLOADS'],'p' => $user->lang['ATTACH_POST_TYPE'], 'u' => $user->lang['AUTHOR']); + $sort_by_sql = array('f' => 'a.real_filename', 't' => 'a.filetime', 's' => 'a.filesize', 'x' => 'a.extension', 'd' => 'a.download_count', 'p' => 'a.in_message', 'u' => 'u.username'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + $min_filetime = ($sort_days) ? (time() - ($sort_days * 86400)) : ''; + $limit_filetime = ($min_filetime) ? " AND a.filetime >= $min_filetime " : ''; + $start = ($sort_days && isset($_POST['sort'])) ? 0 : $start; + + $attachments_per_page = (int) $config['topics_per_page']; + + $stats = $this->get_attachment_stats($limit_filetime); + $num_files = $stats['num_files']; + $total_size = $stats['upload_dir_size']; + + // Make sure $start is set to the last page if it exceeds the amount + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $start = $pagination->validate_start($start, $attachments_per_page, $num_files); + + // If the user is trying to reach the second half of the attachments list, fetch it starting from the end + $store_reverse = false; + $sql_limit = $attachments_per_page; + + if ($start > $num_files / 2) + { + $store_reverse = true; + + // Select the sort order. Add time sort anchor for non-time sorting cases + $sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') : ''; + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'ASC' : 'DESC') . $sql_sort_anchor; + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $num_files); + $sql_start = $pagination->reverse_start($start, $sql_limit, $num_files); + } + else + { + // Select the sort order. Add time sort anchor for non-time sorting cases + $sql_sort_anchor = ($sort_key != 't') ? ', a.filetime ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') : ''; + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC') . $sql_sort_anchor; + $sql_start = $start; + } + + $attachments_list = array(); + + // Just get the files + $sql = 'SELECT a.*, u.username, u.user_colour, t.topic_title + FROM ' . ATTACHMENTS_TABLE . ' a + LEFT JOIN ' . USERS_TABLE . ' u ON (u.user_id = a.poster_id) + LEFT JOIN ' . TOPICS_TABLE . " t ON (a.topic_id = t.topic_id) + WHERE a.is_orphan = 0 + $limit_filetime + ORDER BY $sql_sort_order"; + $result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + + $i = ($store_reverse) ? $sql_limit - 1 : 0; + + // Store increment value in a variable to save some conditional calls + $i_increment = ($store_reverse) ? -1 : 1; + while ($attachment_row = $db->sql_fetchrow($result)) + { + $attachments_list[$i] = $attachment_row; + $i = $i + $i_increment; + } + $db->sql_freeresult($result); + + $base_url = $this->u_action . "&$u_sort_param"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_files, $attachments_per_page, $start); + + $template->assign_vars(array( + 'TOTAL_FILES' => $num_files, + 'TOTAL_SIZE' => get_formatted_filesize($total_size), + + 'S_LIMIT_DAYS' => $s_limit_days, + 'S_SORT_KEY' => $s_sort_key, + 'S_SORT_DIR' => $s_sort_dir) + ); + + // Grab extensions + $extensions = $cache->obtain_attach_extensions(true); + + for ($i = 0, $end = count($attachments_list); $i < $end; ++$i) + { + $row = $attachments_list[$i]; + + $row['extension'] = strtolower(trim((string) $row['extension'])); + $comment = ($row['attach_comment'] && !$row['in_message']) ? str_replace(array("\n", "\r"), array('
', "\n"), $row['attach_comment']) : ''; + $display_cat = isset($extensions[$row['extension']]['display_cat']) ? $extensions[$row['extension']]['display_cat'] : ATTACHMENT_CATEGORY_NONE; + $l_downloaded_viewed = ($display_cat == ATTACHMENT_CATEGORY_NONE) ? 'DOWNLOAD_COUNTS' : 'VIEWED_COUNTS'; + + $template->assign_block_vars('attachments', array( + 'ATTACHMENT_POSTER' => get_username_string('full', (int) $row['poster_id'], (string) $row['username'], (string) $row['user_colour'], (string) $row['username']), + 'FILESIZE' => get_formatted_filesize((int) $row['filesize']), + 'FILETIME' => $user->format_date((int) $row['filetime']), + 'REAL_FILENAME' => (!$row['in_message']) ? utf8_basename((string) $row['real_filename']) : '', + 'PHYSICAL_FILENAME' => utf8_basename((string) $row['physical_filename']), + 'EXT_GROUP_NAME' => (!empty($extensions[$row['extension']]['group_name'])) ? $user->lang['EXT_GROUP_' . $extensions[$row['extension']]['group_name']] : '', + 'COMMENT' => $comment, + 'TOPIC_TITLE' => (!$row['in_message']) ? (string) $row['topic_title'] : '', + 'ATTACH_ID' => (int) $row['attach_id'], + 'POST_ID' => (int) $row['post_msg_id'], + 'TOPIC_ID' => (int) $row['topic_id'], + 'POST_IDS' => (!empty($post_ids[$row['attach_id']])) ? (int) $post_ids[$row['attach_id']] : '', + + 'L_DOWNLOAD_COUNT' => $user->lang($l_downloaded_viewed, (int) $row['download_count']), + + 'S_IN_MESSAGE' => (bool) $row['in_message'], + + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . "#p{$row['post_msg_id']}", + 'U_FILE' => append_sid($phpbb_root_path . 'download/file.' . $phpEx, 'mode=view&id=' . $row['attach_id'])) + ); + } + + break; + } + + if (count($error)) + { + $template->assign_vars(array( + 'S_WARNING' => true, + 'WARNING_MSG' => implode('
', $error)) + ); + } + + if (count($notify)) + { + $template->assign_vars(array( + 'S_NOTIFY' => true, + 'NOTIFY_MSG' => implode('
', $notify)) + ); + } + } + + /** + * Get attachment file count and size of upload directory + * + * @param $limit string Additional limit for WHERE clause to filter stats by. + * @return array Returns array with stats: num_files and upload_dir_size + */ + public function get_attachment_stats($limit = '') + { + $sql = 'SELECT COUNT(a.attach_id) AS num_files, SUM(a.filesize) AS upload_dir_size + FROM ' . ATTACHMENTS_TABLE . " a + WHERE a.is_orphan = 0 + $limit"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + return array( + 'num_files' => (int) $row['num_files'], + 'upload_dir_size' => (float) $row['upload_dir_size'], + ); + } + + /** + * Set config attachment stat values + * + * @param $stats array Array of config key => value pairs to set. + * @return null + */ + public function set_attachment_stats($stats) + { + foreach ($stats as $key => $value) + { + $this->config->set($key, $value, true); + } + } + + /** + * Check accuracy of attachment statistics. + * + * @return bool|string Returns false if stats are correct or error message + * otherwise. + */ + public function check_stats_accuracy() + { + // Get fresh stats. + $stats = $this->get_attachment_stats(); + + // Get current files stats + $num_files = (int) $this->config['num_files']; + $total_size = (float) $this->config['upload_dir_size']; + + if (($num_files != $stats['num_files']) || ($total_size != $stats['upload_dir_size'])) + { + $u_resync = $this->u_action . '&action=stats'; + + return $this->user->lang( + 'FILES_STATS_WRONG', + (int) $stats['num_files'], + get_formatted_filesize($stats['upload_dir_size']), + '', + '' + ); + } + return false; + } + + /** + * Handle stats resync. + * + * @return null + */ + public function handle_stats_resync() + { + if (!confirm_box(true)) + { + confirm_box(false, $this->user->lang['RESYNC_FILES_STATS_CONFIRM'], build_hidden_fields(array( + 'i' => $this->id, + 'mode' => 'manage', + 'action' => 'stats', + ))); + } + else + { + $this->set_attachment_stats($this->get_attachment_stats()); + + /* @var $log \phpbb\log\log_interface */ + $log = $this->phpbb_container->get('log'); + $log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_RESYNC_FILES_STATS'); + } + + } + + /** + * Build Select for category items + */ + function category_select($select_name, $group_id = false, $key = '') + { + global $db, $user; + + $types = array( + ATTACHMENT_CATEGORY_NONE => $user->lang['NO_FILE_CAT'], + ATTACHMENT_CATEGORY_IMAGE => $user->lang['CAT_IMAGES'], + ATTACHMENT_CATEGORY_FLASH => $user->lang['CAT_FLASH_FILES'], + ); + + if ($group_id) + { + $sql = 'SELECT cat_id + FROM ' . EXTENSION_GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + + $cat_type = (!($row = $db->sql_fetchrow($result))) ? ATTACHMENT_CATEGORY_NONE : $row['cat_id']; + + $db->sql_freeresult($result); + } + else + { + $cat_type = ATTACHMENT_CATEGORY_NONE; + } + + $group_select = ''; + + return $group_select; + } + + /** + * Extension group select + */ + function group_select($select_name, $default_group = false, $key = '') + { + global $db, $user; + + $group_select = ''; + + return $group_select; + } + + /** + * Test Settings + */ + function test_upload(&$error, $upload_dir, $create_directory = false) + { + global $user, $phpbb_root_path; + + // Does the target directory exist, is it a directory and writable. + if ($create_directory) + { + if (!file_exists($phpbb_root_path . $upload_dir)) + { + @mkdir($phpbb_root_path . $upload_dir, 0777); + + try + { + $this->filesystem->phpbb_chmod($phpbb_root_path . $upload_dir, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + + if (!file_exists($phpbb_root_path . $upload_dir)) + { + $error[] = sprintf($user->lang['NO_UPLOAD_DIR'], $upload_dir); + return; + } + + if (!is_dir($phpbb_root_path . $upload_dir)) + { + $error[] = sprintf($user->lang['UPLOAD_NOT_DIR'], $upload_dir); + return; + } + + if (!$this->filesystem->is_writable($phpbb_root_path . $upload_dir)) + { + $error[] = sprintf($user->lang['NO_WRITE_UPLOAD'], $upload_dir); + return; + } + } + + /** + * Perform operations on sites for external linking + */ + function perform_site_list() + { + global $db, $user, $request, $phpbb_log; + + if (isset($_REQUEST['securesubmit'])) + { + // Grab the list of entries + $ips = $request->variable('ips', ''); + $ip_list = array_unique(explode("\n", $ips)); + $ip_list_log = implode(', ', $ip_list); + + $ip_exclude = (int) $request->variable('ipexclude', false, false, \phpbb\request\request_interface::POST); + + $iplist = array(); + $hostlist = array(); + + foreach ($ip_list as $item) + { + if (preg_match('#^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$#', trim($item), $ip_range_explode)) + { + // Don't ask about all this, just don't ask ... ! + $ip_1_counter = $ip_range_explode[1]; + $ip_1_end = $ip_range_explode[5]; + + while ($ip_1_counter <= $ip_1_end) + { + $ip_2_counter = ($ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[2] : 0; + $ip_2_end = ($ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[6]; + + if ($ip_2_counter == 0 && $ip_2_end == 254) + { + $ip_2_counter = 256; + + $iplist[] = "'$ip_1_counter.*'"; + } + + while ($ip_2_counter <= $ip_2_end) + { + $ip_3_counter = ($ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[3] : 0; + $ip_3_end = ($ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[7]; + + if ($ip_3_counter == 0 && $ip_3_end == 254) + { + $ip_3_counter = 256; + + $iplist[] = "'$ip_1_counter.$ip_2_counter.*'"; + } + + while ($ip_3_counter <= $ip_3_end) + { + $ip_4_counter = ($ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[4] : 0; + $ip_4_end = ($ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end) ? 254 : $ip_range_explode[8]; + + if ($ip_4_counter == 0 && $ip_4_end == 254) + { + $ip_4_counter = 256; + + $iplist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.*'"; + } + + while ($ip_4_counter <= $ip_4_end) + { + $iplist[] = "'$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter'"; + $ip_4_counter++; + } + $ip_3_counter++; + } + $ip_2_counter++; + } + $ip_1_counter++; + } + } + else if (preg_match('#^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$#', trim($item)) || preg_match('#^[a-f0-9:]+\*?$#i', trim($item))) + { + $iplist[] = "'" . trim($item) . "'"; + } + else if (preg_match('#^([\w\-_]\.?){2,}$#is', trim($item))) + { + $hostlist[] = "'" . trim($item) . "'"; + } + else if (preg_match("#^([a-z0-9\-\*\._/]+?)$#is", trim($item))) + { + $hostlist[] = "'" . trim($item) . "'"; + } + } + + $sql = 'SELECT site_ip, site_hostname + FROM ' . SITELIST_TABLE . " + WHERE ip_exclude = $ip_exclude"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $iplist_tmp = array(); + $hostlist_tmp = array(); + do + { + if ($row['site_ip']) + { + if (strlen($row['site_ip']) > 40) + { + continue; + } + + $iplist_tmp[] = "'" . $row['site_ip'] . "'"; + } + else if ($row['site_hostname']) + { + if (strlen($row['site_hostname']) > 255) + { + continue; + } + + $hostlist_tmp[] = "'" . $row['site_hostname'] . "'"; + } + // break; + } + while ($row = $db->sql_fetchrow($result)); + + $iplist = array_unique(array_diff($iplist, $iplist_tmp)); + $hostlist = array_unique(array_diff($hostlist, $hostlist_tmp)); + unset($iplist_tmp); + unset($hostlist_tmp); + } + $db->sql_freeresult($result); + + if (count($iplist)) + { + foreach ($iplist as $ip_entry) + { + $sql = 'INSERT INTO ' . SITELIST_TABLE . " (site_ip, ip_exclude) + VALUES ($ip_entry, $ip_exclude)"; + $db->sql_query($sql); + } + } + + if (count($hostlist)) + { + foreach ($hostlist as $host_entry) + { + $sql = 'INSERT INTO ' . SITELIST_TABLE . " (site_hostname, ip_exclude) + VALUES ($host_entry, $ip_exclude)"; + $db->sql_query($sql); + } + } + + if (!empty($ip_list_log)) + { + // Update log + $log_entry = ($ip_exclude) ? 'LOG_DOWNLOAD_EXCLUDE_IP' : 'LOG_DOWNLOAD_IP'; + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_entry, false, array($ip_list_log)); + } + + trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); + } + else if (isset($_POST['unsecuresubmit'])) + { + $unip_sql = $request->variable('unip', array(0)); + + if (count($unip_sql)) + { + $l_unip_list = ''; + + // Grab details of ips for logging information later + $sql = 'SELECT site_ip, site_hostname + FROM ' . SITELIST_TABLE . ' + WHERE ' . $db->sql_in_set('site_id', $unip_sql); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $l_unip_list .= (($l_unip_list != '') ? ', ' : '') . (($row['site_ip']) ? $row['site_ip'] : $row['site_hostname']); + } + $db->sql_freeresult($result); + + $sql = 'DELETE FROM ' . SITELIST_TABLE . ' + WHERE ' . $db->sql_in_set('site_id', $unip_sql); + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DOWNLOAD_REMOVE_IP', false, array($l_unip_list)); + } + + trigger_error($user->lang['SECURE_DOWNLOAD_UPDATE_SUCCESS'] . adm_back_link($this->u_action)); + } + } + + /** + * Write display_order config field + */ + function display_order($value, $key = '') + { + $radio_ary = array(0 => 'DESCENDING', 1 => 'ASCENDING'); + + return h_radio('config[display_order]', $radio_ary, $value, $key); + } + + /** + * Adjust all three max_filesize config vars for display + */ + function max_filesize($value, $key = '') + { + // Determine size var and adjust the value accordingly + $filesize = get_formatted_filesize($value, false, array('mb', 'kb', 'b')); + $size_var = $filesize['si_identifier']; + $value = $filesize['value']; + + // size and maxlength must not be specified for input of type number + return ' '; + } + + /** + * Write secure_allow_deny config field + */ + function select_allow_deny($value, $key = '') + { + $radio_ary = array(1 => 'ORDER_ALLOW_DENY', 0 => 'ORDER_DENY_ALLOW'); + + return h_radio('config[' . $key . ']', $radio_ary, $value, $key); + } + +} diff --git a/install/update/old/includes/acp/acp_bbcodes.php b/install/update/old/includes/acp/acp_bbcodes.php new file mode 100644 index 0000000..1f7374a --- /dev/null +++ b/install/update/old/includes/acp/acp_bbcodes.php @@ -0,0 +1,620 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_bbcodes +{ + var $u_action; + + function main($id, $mode) + { + global $db, $user, $template, $cache, $request, $phpbb_dispatcher, $phpbb_container; + global $phpbb_log; + + $user->add_lang('acp/posting'); + + // Set up general vars + $action = $request->variable('action', ''); + $bbcode_id = $request->variable('bbcode', 0); + $submit = $request->is_set_post('submit'); + + $this->tpl_name = 'acp_bbcodes'; + $this->page_title = 'ACP_BBCODES'; + $form_key = 'acp_bbcodes'; + + add_form_key($form_key); + + if ($submit && !check_form_key($form_key)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Set up mode-specific vars + switch ($action) + { + case 'add': + $bbcode_match = $bbcode_tpl = $bbcode_helpline = ''; + $display_on_posting = 0; + break; + + case 'edit': + $sql = 'SELECT bbcode_match, bbcode_tpl, display_on_posting, bbcode_helpline + FROM ' . BBCODES_TABLE . ' + WHERE bbcode_id = ' . $bbcode_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['BBCODE_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $bbcode_match = $row['bbcode_match']; + $bbcode_tpl = htmlspecialchars($row['bbcode_tpl']); + $display_on_posting = $row['display_on_posting']; + $bbcode_helpline = $row['bbcode_helpline']; + break; + + case 'modify': + $sql = 'SELECT bbcode_id, bbcode_tag + FROM ' . BBCODES_TABLE . ' + WHERE bbcode_id = ' . $bbcode_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['BBCODE_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // No break here + + case 'create': + $display_on_posting = $request->variable('display_on_posting', 0); + + $bbcode_match = $request->variable('bbcode_match', ''); + $bbcode_tpl = htmlspecialchars_decode($request->variable('bbcode_tpl', '', true)); + $bbcode_helpline = $request->variable('bbcode_helpline', '', true); + break; + } + + // Do major work + switch ($action) + { + case 'edit': + case 'add': + + $tpl_ary = array( + 'S_EDIT_BBCODE' => true, + 'U_BACK' => $this->u_action, + 'U_ACTION' => $this->u_action . '&action=' . (($action == 'add') ? 'create' : 'modify') . (($bbcode_id) ? "&bbcode=$bbcode_id" : ''), + + 'L_BBCODE_USAGE_EXPLAIN'=> sprintf($user->lang['BBCODE_USAGE_EXPLAIN'], '', ''), + 'BBCODE_MATCH' => $bbcode_match, + 'BBCODE_TPL' => $bbcode_tpl, + 'BBCODE_HELPLINE' => $bbcode_helpline, + 'DISPLAY_ON_POSTING' => $display_on_posting, + ); + + $bbcode_tokens = array('TEXT', 'SIMPLETEXT', 'INTTEXT', 'IDENTIFIER', 'NUMBER', 'EMAIL', 'URL', 'LOCAL_URL', 'RELATIVE_URL', 'COLOR'); + + /** + * Modify custom bbcode template data before we display the add/edit form + * + * @event core.acp_bbcodes_edit_add + * @var string action Type of the action: add|edit + * @var array tpl_ary Array with custom bbcode add/edit data + * @var int bbcode_id When editing: the bbcode id, + * when creating: 0 + * @var array bbcode_tokens Array of bbcode tokens + * @since 3.1.0-a3 + */ + $vars = array('action', 'tpl_ary', 'bbcode_id', 'bbcode_tokens'); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_edit_add', compact($vars))); + + $template->assign_vars($tpl_ary); + + foreach ($bbcode_tokens as $token) + { + $template->assign_block_vars('token', array( + 'TOKEN' => '{' . $token . '}', + 'EXPLAIN' => ($token === 'LOCAL_URL') ? $user->lang(array('tokens', $token), generate_board_url() . '/') : $user->lang(array('tokens', $token)), + )); + } + + return; + + break; + + case 'modify': + case 'create': + + $sql_ary = $hidden_fields = array(); + + /** + * Modify custom bbcode data before the modify/create action + * + * @event core.acp_bbcodes_modify_create + * @var string action Type of the action: modify|create + * @var array sql_ary Array with new bbcode data + * @var int bbcode_id When editing: the bbcode id, + * when creating: 0 + * @var bool display_on_posting Display bbcode on posting form + * @var string bbcode_match The bbcode usage string to match + * @var string bbcode_tpl The bbcode HTML replacement string + * @var string bbcode_helpline The bbcode help line string + * @var array hidden_fields Array of hidden fields for use when + * submitting form when $warn_text is true + * @since 3.1.0-a3 + */ + $vars = array( + 'action', + 'sql_ary', + 'bbcode_id', + 'display_on_posting', + 'bbcode_match', + 'bbcode_tpl', + 'bbcode_helpline', + 'hidden_fields', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create', compact($vars))); + + $warn_text = preg_match('%<[^>]*\{text[\d]*\}[^>]*>%i', $bbcode_tpl); + if (!$warn_text || confirm_box(true)) + { + $data = $this->build_regexp($bbcode_match, $bbcode_tpl); + + // Make sure the user didn't pick a "bad" name for the BBCode tag. + $hard_coded = array('code', 'quote', 'quote=', 'attachment', 'attachment=', 'b', 'i', 'url', 'url=', 'img', 'size', 'size=', 'color', 'color=', 'u', 'list', 'list=', 'email', 'email=', 'flash', 'flash='); + + if (($action == 'modify' && strtolower($data['bbcode_tag']) !== strtolower($row['bbcode_tag'])) || ($action == 'create')) + { + $sql = 'SELECT 1 as test + FROM ' . BBCODES_TABLE . " + WHERE LOWER(bbcode_tag) = '" . $db->sql_escape(strtolower($data['bbcode_tag'])) . "'"; + $result = $db->sql_query($sql); + $info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Grab the end, interrogate the last closing tag + if ($info['test'] === '1' || in_array(strtolower($data['bbcode_tag']), $hard_coded) || (preg_match('#\[/([^[]*)]$#', $bbcode_match, $regs) && in_array(strtolower($regs[1]), $hard_coded))) + { + trigger_error($user->lang['BBCODE_INVALID_TAG_NAME'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + if (substr($data['bbcode_tag'], -1) === '=') + { + $test = substr($data['bbcode_tag'], 0, -1); + } + else + { + $test = $data['bbcode_tag']; + } + + if (!preg_match('%\\[' . $test . '[^]]*].*?\\[/' . $test . ']%s', $bbcode_match)) + { + trigger_error($user->lang['BBCODE_OPEN_ENDED_TAG'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (strlen($data['bbcode_tag']) > 16) + { + trigger_error($user->lang['BBCODE_TAG_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (strlen($bbcode_match) > 4000) + { + trigger_error($user->lang['BBCODE_TAG_DEF_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (strlen($bbcode_helpline) > 255) + { + trigger_error($user->lang['BBCODE_HELPLINE_TOO_LONG'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql_ary = array_merge($sql_ary, array( + 'bbcode_tag' => $data['bbcode_tag'], + 'bbcode_match' => $bbcode_match, + 'bbcode_tpl' => $bbcode_tpl, + 'display_on_posting' => $display_on_posting, + 'bbcode_helpline' => $bbcode_helpline, + 'first_pass_match' => $data['first_pass_match'], + 'first_pass_replace' => $data['first_pass_replace'], + 'second_pass_match' => $data['second_pass_match'], + 'second_pass_replace' => $data['second_pass_replace'] + )); + + if ($action == 'create') + { + $sql = 'SELECT MAX(bbcode_id) as max_bbcode_id + FROM ' . BBCODES_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $bbcode_id = (int) $row['max_bbcode_id'] + 1; + + // Make sure it is greater than the core bbcode ids... + if ($bbcode_id <= NUM_CORE_BBCODES) + { + $bbcode_id = NUM_CORE_BBCODES + 1; + } + } + else + { + $bbcode_id = NUM_CORE_BBCODES + 1; + } + + if ($bbcode_id > BBCODE_LIMIT) + { + trigger_error($user->lang['TOO_MANY_BBCODES'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql_ary['bbcode_id'] = (int) $bbcode_id; + + $db->sql_query('INSERT INTO ' . BBCODES_TABLE . $db->sql_build_array('INSERT', $sql_ary)); + $cache->destroy('sql', BBCODES_TABLE); + $phpbb_container->get('text_formatter.cache')->invalidate(); + + $lang = 'BBCODE_ADDED'; + $log_action = 'LOG_BBCODE_ADD'; + } + else + { + $sql = 'UPDATE ' . BBCODES_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE bbcode_id = ' . $bbcode_id; + $db->sql_query($sql); + $cache->destroy('sql', BBCODES_TABLE); + $phpbb_container->get('text_formatter.cache')->invalidate(); + + $lang = 'BBCODE_EDITED'; + $log_action = 'LOG_BBCODE_EDIT'; + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_action, false, array($data['bbcode_tag'])); + + /** + * Event after a BBCode has been added or updated + * + * @event core.acp_bbcodes_modify_create_after + * @var string action Type of the action: modify|create + * @var int bbcode_id The id of the added or updated bbcode + * @var array sql_ary Array with bbcode data (read only) + * @since 3.2.4-RC1 + */ + $vars = array( + 'action', + 'bbcode_id', + 'sql_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_modify_create_after', compact($vars))); + + trigger_error($user->lang[$lang] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['BBCODE_DANGER'], build_hidden_fields(array_merge($hidden_fields, array( + 'action' => $action, + 'bbcode' => $bbcode_id, + 'bbcode_match' => $bbcode_match, + 'bbcode_tpl' => htmlspecialchars($bbcode_tpl), + 'bbcode_helpline' => $bbcode_helpline, + 'display_on_posting' => $display_on_posting, + ))) + , 'confirm_bbcode.html'); + } + + break; + + case 'delete': + + $sql = 'SELECT bbcode_tag + FROM ' . BBCODES_TABLE . " + WHERE bbcode_id = $bbcode_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + if (confirm_box(true)) + { + $bbcode_tag = $row['bbcode_tag']; + + $db->sql_query('DELETE FROM ' . BBCODES_TABLE . " WHERE bbcode_id = $bbcode_id"); + $cache->destroy('sql', BBCODES_TABLE); + $phpbb_container->get('text_formatter.cache')->invalidate(); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_BBCODE_DELETE', false, array($bbcode_tag)); + + /** + * Event after a BBCode has been deleted + * + * @event core.acp_bbcodes_delete_after + * @var string action Type of the action: delete + * @var int bbcode_id The id of the deleted bbcode + * @var string bbcode_tag The tag of the deleted bbcode + * @since 3.2.4-RC1 + */ + $vars = array( + 'action', + 'bbcode_id', + 'bbcode_tag', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_delete_after', compact($vars))); + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['BBCODE_DELETED'], + 'REFRESH_DATA' => array( + 'time' => 3 + ) + )); + } + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'bbcode' => $bbcode_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action)) + ); + } + } + + break; + } + + $u_action = $this->u_action; + + $template_data = array( + 'U_ACTION' => $this->u_action . '&action=add', + ); + + $sql_ary = array( + 'SELECT' => 'b.*', + 'FROM' => array(BBCODES_TABLE => 'b'), + 'ORDER_BY' => 'b.bbcode_tag', + ); + + /** + * Modify custom bbcode template data before we display the form + * + * @event core.acp_bbcodes_display_form + * @var string action Type of the action: modify|create + * @var array sql_ary The SQL array to get custom bbcode data + * @var array template_data Array with form template data + * @var string u_action The u_action link + * @since 3.1.0-a3 + */ + $vars = array('action', 'sql_ary', 'template_data', 'u_action'); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_display_form', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + $template->assign_vars($template_data); + + while ($row = $db->sql_fetchrow($result)) + { + $bbcodes_array = array( + 'BBCODE_TAG' => $row['bbcode_tag'], + 'U_EDIT' => $u_action . '&action=edit&bbcode=' . $row['bbcode_id'], + 'U_DELETE' => $u_action . '&action=delete&bbcode=' . $row['bbcode_id'], + ); + + /** + * Modify display of custom bbcodes in the form + * + * @event core.acp_bbcodes_display_bbcodes + * @var array row Array with current bbcode data + * @var array bbcodes_array Array of bbcodes template data + * @var string u_action The u_action link + * @since 3.1.0-a3 + */ + $vars = array('bbcodes_array', 'row', 'u_action'); + extract($phpbb_dispatcher->trigger_event('core.acp_bbcodes_display_bbcodes', compact($vars))); + + $template->assign_block_vars('bbcodes', $bbcodes_array); + + } + $db->sql_freeresult($result); + } + + /* + * Build regular expression for custom bbcode + */ + function build_regexp(&$bbcode_match, &$bbcode_tpl) + { + $bbcode_match = trim($bbcode_match); + $bbcode_tpl = trim($bbcode_tpl); + + // Allow unicode characters for URL|LOCAL_URL|RELATIVE_URL|INTTEXT tokens + $utf8 = preg_match('/(URL|LOCAL_URL|RELATIVE_URL|INTTEXT)/', $bbcode_match); + + $fp_match = preg_quote($bbcode_match, '!'); + $fp_replace = preg_replace('#^\[(.*?)\]#', '[$1:$uid]', $bbcode_match); + $fp_replace = preg_replace('#\[/(.*?)\]$#', '[/$1:$uid]', $fp_replace); + + $sp_match = preg_quote($bbcode_match, '!'); + $sp_match = preg_replace('#^\\\\\[(.*?)\\\\\]#', '\[$1:$uid\]', $sp_match); + $sp_match = preg_replace('#\\\\\[/(.*?)\\\\\]$#', '\[/$1:$uid\]', $sp_match); + $sp_replace = $bbcode_tpl; + + // @todo Make sure to change this too if something changed in message parsing + $tokens = array( + 'URL' => array( + '!(?:(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))!ie' => "\$this->bbcode_specialchars(('\$1') ? '\$1' : 'http://\$2')" + ), + 'LOCAL_URL' => array( + '!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')" + ), + 'RELATIVE_URL' => array( + '!(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')!e' => "\$this->bbcode_specialchars('$1')" + ), + 'EMAIL' => array( + '!(' . get_preg_expression('email') . ')!ie' => "\$this->bbcode_specialchars('$1')" + ), + 'TEXT' => array( + '!(.*?)!es' => "str_replace(array(\"\\r\\n\", '\\\"', '\\'', '(', ')'), array(\"\\n\", '\"', ''', '(', ')'), trim('\$1'))" + ), + 'SIMPLETEXT' => array( + '!([a-zA-Z0-9-+.,_ ]+)!' => "$1" + ), + 'INTTEXT' => array( + '!([\p{L}\p{N}\-+,_. ]+)!u' => "$1" + ), + 'IDENTIFIER' => array( + '!([a-zA-Z0-9-_]+)!' => "$1" + ), + 'COLOR' => array( + '!([a-z]+|#[0-9abcdef]+)!i' => '$1' + ), + 'NUMBER' => array( + '!([0-9]+)!' => '$1' + ) + ); + + $sp_tokens = array( + 'URL' => '(?i)((?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('url')) . ')|(?:' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('www_url')) . '))(?-i)', + 'LOCAL_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)', + 'RELATIVE_URL' => '(?i)(' . str_replace(array('!', '\#'), array('\!', '#'), get_preg_expression('relative_url')) . ')(?-i)', + 'EMAIL' => '(' . get_preg_expression('email') . ')', + 'TEXT' => '(.*?)', + 'SIMPLETEXT' => '([a-zA-Z0-9-+.,_ ]+)', + 'INTTEXT' => '([\p{L}\p{N}\-+,_. ]+)', + 'IDENTIFIER' => '([a-zA-Z0-9-_]+)', + 'COLOR' => '([a-zA-Z]+|#[0-9abcdefABCDEF]+)', + 'NUMBER' => '([0-9]+)', + ); + + $pad = 0; + $modifiers = 'i'; + $modifiers .= ($utf8) ? 'u' : ''; + + if (preg_match_all('/\{(' . implode('|', array_keys($tokens)) . ')[0-9]*\}/i', $bbcode_match, $m)) + { + foreach ($m[0] as $n => $token) + { + $token_type = $m[1][$n]; + + reset($tokens[strtoupper($token_type)]); + list($match, $replace) = each($tokens[strtoupper($token_type)]); + + // Pad backreference numbers from tokens + if (preg_match_all('/(?lang['BBCODE_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $fp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { + return strtolower($match[0]); + }, $fp_match); + $fp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { + return strtolower($match[0]); + }, $fp_replace); + $sp_match = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { + return strtolower($match[0]); + }, $sp_match); + $sp_replace = preg_replace_callback('#\[/?' . $bbcode_search . '#i', function ($match) { + return strtolower($match[0]); + }, $sp_replace); + + return array( + 'bbcode_tag' => $bbcode_tag, + 'first_pass_match' => $fp_match, + 'first_pass_replace' => $fp_replace, + 'second_pass_match' => $sp_match, + 'second_pass_replace' => $sp_replace + ); + } +} diff --git a/install/update/old/includes/acp/acp_board.php b/install/update/old/includes/acp/acp_board.php new file mode 100644 index 0000000..e348c76 --- /dev/null +++ b/install/update/old/includes/acp/acp_board.php @@ -0,0 +1,1178 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @todo add cron intervals to server settings? (database_gc, queue_interval, session_gc, search_gc, cache_gc, warnings_gc) +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_board +{ + var $u_action; + var $new_config; + + function main($id, $mode) + { + global $user, $template, $request, $language; + global $config, $phpbb_root_path, $phpEx; + global $cache, $phpbb_container, $phpbb_dispatcher, $phpbb_log; + + /** @var \phpbb\language\language $language Language object */ + $language = $phpbb_container->get('language'); + + $user->add_lang('acp/board'); + + $submit = (isset($_POST['submit']) || isset($_POST['allow_quick_reply_enable'])) ? true : false; + + $form_key = 'acp_board'; + add_form_key($form_key); + + /** + * Validation types are: + * string, int, bool, + * script_path (absolute path in url - beginning with / and no trailing slash), + * rpath (relative), rwpath (realtive, writable), path (relative path, but able to escape the root), wpath (writable) + */ + switch ($mode) + { + case 'settings': + $display_vars = array( + 'title' => 'ACP_BOARD_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_BOARD_SETTINGS', + 'sitename' => array('lang' => 'SITE_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), + 'site_desc' => array('lang' => 'SITE_DESC', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => false), + 'site_home_url' => array('lang' => 'SITE_HOME_URL', 'validate' => 'url', 'type' => 'url:40:255', 'explain' => true), + 'site_home_text' => array('lang' => 'SITE_HOME_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + 'board_index_text' => array('lang' => 'BOARD_INDEX_TEXT', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + 'board_disable' => array('lang' => 'DISABLE_BOARD', 'validate' => 'bool', 'type' => 'custom', 'method' => 'board_disable', 'explain' => true), + 'board_disable_msg' => false, + 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), + 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), + 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'custom', 'method' => 'timezone_select', 'explain' => true), + + 'legend2' => 'BOARD_STYLE', + 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => true), + 'guest_style' => array('lang' => 'GUEST_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array($this->guest_style_get(), false), 'explain' => true), + 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend3' => 'WARNINGS', + 'warnings_expire_days' => array('lang' => 'WARNINGS_EXPIRE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + + 'legend4' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'features': + $display_vars = array( + 'title' => 'ACP_BOARD_FEATURES', + 'vars' => array( + 'legend1' => 'ACP_BOARD_FEATURES', + 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_attachments' => array('lang' => 'ALLOW_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_report' => array('lang' => 'ALLOW_PM_REPORT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_board_notifications' => array('lang' => 'ALLOW_BOARD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'display_last_subject' => array('lang' => 'DISPLAY_LAST_SUBJECT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), + + 'legend2' => 'ACP_LOAD_SETTINGS', + 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + + 'legend3' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'avatar': + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + $avatar_drivers = $phpbb_avatar_manager->get_all_drivers(); + + $avatar_vars = array(); + foreach ($avatar_drivers as $current_driver) + { + /** @var \phpbb\avatar\driver\driver_interface $driver */ + $driver = $phpbb_avatar_manager->get_driver($current_driver, false); + + /* + * First grab the settings for enabling/disabling the avatar + * driver and afterwards grab additional settings the driver + * might have. + */ + $avatar_vars += $phpbb_avatar_manager->get_avatar_settings($driver); + $avatar_vars += $driver->prepare_form_acp($user); + } + + $display_vars = array( + 'title' => 'ACP_AVATAR_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_AVATAR_SETTINGS', + + 'avatar_min_width' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), + 'avatar_min_height' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), + 'avatar_max_width' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), + 'avatar_max_height' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => false, 'method' => false, 'explain' => false), + + 'allow_avatar' => array('lang' => 'ALLOW_AVATARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'avatar_min' => array('lang' => 'MIN_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'avatar_max' => array('lang' => 'MAX_AVATAR_SIZE', 'validate' => 'int:0', 'type' => 'dimension:0', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + ) + ); + + if (!empty($avatar_vars)) + { + $display_vars['vars'] += $avatar_vars; + } + break; + + case 'message': + $display_vars = array( + 'title' => 'ACP_MESSAGE_SETTINGS', + 'lang' => 'ucp', + 'vars' => array( + 'legend1' => 'GENERAL_SETTINGS', + 'allow_privmsg' => array('lang' => 'BOARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'pm_max_boxes' => array('lang' => 'BOXES_MAX', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'pm_max_msgs' => array('lang' => 'BOXES_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'full_folder_action' => array('lang' => 'FULL_FOLDER_ACTION', 'validate' => 'int', 'type' => 'select', 'method' => 'full_folder_select', 'explain' => true), + 'pm_edit_time' => array('lang' => 'PM_EDIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'pm_max_recipients' => array('lang' => 'PM_MAX_RECIPIENTS', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), + + 'legend2' => 'GENERAL_OPTIONS', + 'allow_mass_pm' => array('lang' => 'ALLOW_MASS_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_bbcode_pm' => array('lang' => 'ALLOW_BBCODE_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_smilies_pm' => array('lang' => 'ALLOW_SMILIES_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_pm_attach' => array('lang' => 'ALLOW_PM_ATTACHMENTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_pm' => array('lang' => 'ALLOW_SIG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'print_pm' => array('lang' => 'ALLOW_PRINT_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'forward_pm' => array('lang' => 'ALLOW_FORWARD_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_img_pm' => array('lang' => 'ALLOW_IMG_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'auth_flash_pm' => array('lang' => 'ALLOW_FLASH_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'enable_pm_icons' => array('lang' => 'ENABLE_PM_ICONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + + 'legend3' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'post': + $display_vars = array( + 'title' => 'ACP_POST_SETTINGS', + 'vars' => array( + 'legend1' => 'GENERAL_OPTIONS', + 'allow_topic_notify' => array('lang' => 'ALLOW_TOPIC_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_forum_notify' => array('lang' => 'ALLOW_FORUM_NOTIFY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_bbcode' => array('lang' => 'ALLOW_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_post_flash' => array('lang' => 'ALLOW_POST_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_smilies' => array('lang' => 'ALLOW_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_post_links' => array('lang' => 'ALLOW_POST_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allowed_schemes_links' => array('lang' => 'ALLOWED_SCHEMES_LINKS', 'validate' => 'string', 'type' => 'text:0:255', 'explain' => true), + 'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'custom', 'method' => 'quick_reply', 'explain' => true), + + 'legend2' => 'POSTING', + 'bump_type' => false, + 'edit_time' => array('lang' => 'EDIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'delete_time' => array('lang' => 'DELETE_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'display_last_edited' => array('lang' => 'DISPLAY_LAST_EDITED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'flood_interval' => array('lang' => 'FLOOD_INTERVAL', 'validate' => 'int:0:9999999999', 'type' => 'number:0:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'bump_interval' => array('lang' => 'BUMP_INTERVAL', 'validate' => 'int:0', 'type' => 'custom', 'method' => 'bump_interval', 'explain' => true), + 'topics_per_page' => array('lang' => 'TOPICS_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), + 'posts_per_page' => array('lang' => 'POSTS_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), + 'smilies_per_page' => array('lang' => 'SMILIES_PER_PAGE', 'validate' => 'int:1:9999', 'type' => 'number:1:9999', 'explain' => false), + 'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'number:2:127', 'explain' => false), + 'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0:999999', 'type' => 'number:0:999999', 'explain' => true), + 'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:1:999999', 'type' => 'number:1:999999', 'explain' => true), + 'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'), + 'max_quote_depth' => array('lang' => 'QUOTE_DEPTH_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_post_img_width' => array('lang' => 'MAX_POST_IMG_WIDTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'max_post_img_height' => array('lang' => 'MAX_POST_IMG_HEIGHT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + + 'legend3' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'signature': + $display_vars = array( + 'title' => 'ACP_SIGNATURE_SETTINGS', + 'vars' => array( + 'legend1' => 'GENERAL_OPTIONS', + 'allow_sig' => array('lang' => 'ALLOW_SIG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_bbcode' => array('lang' => 'ALLOW_SIG_BBCODE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_img' => array('lang' => 'ALLOW_SIG_IMG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_flash' => array('lang' => 'ALLOW_SIG_FLASH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_smilies' => array('lang' => 'ALLOW_SIG_SMILIES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_sig_links' => array('lang' => 'ALLOW_SIG_LINKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend2' => 'GENERAL_SETTINGS', + 'max_sig_chars' => array('lang' => 'MAX_SIG_LENGTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_sig_urls' => array('lang' => 'MAX_SIG_URLS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_sig_font_size' => array('lang' => 'MAX_SIG_FONT_SIZE', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' %'), + 'max_sig_smilies' => array('lang' => 'MAX_SIG_SMILIES', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'max_sig_img_width' => array('lang' => 'MAX_SIG_IMG_WIDTH', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + 'max_sig_img_height' => array('lang' => 'MAX_SIG_IMG_HEIGHT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true, 'append' => ' ' . $user->lang['PIXEL']), + + 'legend3' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'registration': + $display_vars = array( + 'title' => 'ACP_REGISTER_SETTINGS', + 'vars' => array( + 'legend1' => 'GENERAL_SETTINGS', + 'max_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:8:180', 'type' => false, 'method' => false, 'explain' => false,), + 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,), + + 'require_activation' => array('lang' => 'ACC_ACTIVATION', 'validate' => 'int', 'type' => 'select', 'method' => 'select_acc_activation', 'explain' => true), + 'new_member_post_limit' => array('lang' => 'NEW_MEMBER_POST_LIMIT', 'validate' => 'int:0:255', 'type' => 'number:0:255', 'explain' => true, 'append' => ' ' . $user->lang['POSTS']), + 'new_member_group_default'=> array('lang' => 'NEW_MEMBER_GROUP_DEFAULT', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'min_name_chars' => array('lang' => 'USERNAME_LENGTH', 'validate' => 'int:1', 'type' => 'custom:5:180', 'method' => 'username_length', 'explain' => true), + 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), + 'allow_name_chars' => array('lang' => 'USERNAME_CHARS', 'validate' => 'string', 'type' => 'select', 'method' => 'select_username_chars', 'explain' => true), + 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), + 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + + 'legend2' => 'GENERAL_OPTIONS', + 'allow_namechange' => array('lang' => 'ALLOW_NAME_CHANGE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'allow_emailreuse' => array('lang' => 'ALLOW_EMAIL_REUSE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'enable_confirm' => array('lang' => 'VISUAL_CONFIRM_REG', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), + 'max_reg_attempts' => array('lang' => 'REG_LIMIT', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + + 'legend3' => 'COPPA', + 'coppa_enable' => array('lang' => 'ENABLE_COPPA', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'coppa_mail' => array('lang' => 'COPPA_MAIL', 'validate' => 'string', 'type' => 'textarea:5:40', 'explain' => true), + 'coppa_fax' => array('lang' => 'COPPA_FAX', 'validate' => 'string', 'type' => 'text:25:100', 'explain' => false), + + 'legend4' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'feed': + $display_vars = array( + 'title' => 'ACP_FEED_MANAGEMENT', + 'vars' => array( + 'legend1' => 'ACP_FEED_GENERAL', + 'feed_enable' => array('lang' => 'ACP_FEED_ENABLE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_item_statistics' => array('lang' => 'ACP_FEED_ITEM_STATISTICS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'feed_http_auth' => array('lang' => 'ACP_FEED_HTTP_AUTH', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + + 'legend2' => 'ACP_FEED_POST_BASED', + 'feed_limit_post' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5:9999', 'type' => 'number:5:9999', 'explain' => true), + 'feed_overall' => array('lang' => 'ACP_FEED_OVERALL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_forum' => array('lang' => 'ACP_FEED_FORUM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_topic' => array('lang' => 'ACP_FEED_TOPIC', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + + 'legend3' => 'ACP_FEED_TOPIC_BASED', + 'feed_limit_topic' => array('lang' => 'ACP_FEED_LIMIT', 'validate' => 'int:5:9999', 'type' => 'number:5:9999', 'explain' => true), + 'feed_topics_new' => array('lang' => 'ACP_FEED_TOPICS_NEW', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_topics_active' => array('lang' => 'ACP_FEED_TOPICS_ACTIVE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_news_id' => array('lang' => 'ACP_FEED_NEWS', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_news_forums', 'explain' => true), + + 'legend4' => 'ACP_FEED_SETTINGS_OTHER', + 'feed_overall_forums' => array('lang' => 'ACP_FEED_OVERALL_FORUMS', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true ), + 'feed_exclude_id' => array('lang' => 'ACP_FEED_EXCLUDE_ID', 'validate' => 'string', 'type' => 'custom', 'method' => 'select_exclude_forums', 'explain' => true), + ) + ); + break; + + case 'cookie': + $display_vars = array( + 'title' => 'ACP_COOKIE_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_COOKIE_SETTINGS', + 'cookie_domain' => array('lang' => 'COOKIE_DOMAIN', 'validate' => 'string', 'type' => 'text::255', 'explain' => true), + 'cookie_name' => array('lang' => 'COOKIE_NAME', 'validate' => 'string', 'type' => 'text::16', 'explain' => true), + 'cookie_path' => array('lang' => 'COOKIE_PATH', 'validate' => 'string', 'type' => 'text::255', 'explain' => true), + 'cookie_secure' => array('lang' => 'COOKIE_SECURE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'cookie_notice' => array('lang' => 'COOKIE_NOTICE', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + ) + ); + break; + + case 'load': + $display_vars = array( + 'title' => 'ACP_LOAD_SETTINGS', + 'vars' => array( + 'legend1' => 'GENERAL_SETTINGS', + 'limit_load' => array('lang' => 'LIMIT_LOAD', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'session_length' => array('lang' => 'SESSION_LENGTH', 'validate' => 'int:60:9999999999', 'type' => 'number:60:9999999999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'active_sessions' => array('lang' => 'LIMIT_SESSIONS', 'validate' => 'int:0:9999', 'type' => 'number:0:9999', 'explain' => true), + 'load_online_time' => array('lang' => 'ONLINE_LENGTH', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['MINUTES']), + 'read_notification_expire_days' => array('lang' => 'READ_NOTIFICATION_EXPIRE_DAYS', 'validate' => 'int:0', 'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + + 'legend2' => 'GENERAL_OPTIONS', + 'load_notifications' => array('lang' => 'LOAD_NOTIFICATIONS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_db_track' => array('lang' => 'YES_POST_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_db_lastread' => array('lang' => 'YES_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_anon_lastread' => array('lang' => 'YES_ANON_READ_MARKING', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_online' => array('lang' => 'YES_ONLINE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_online_guests' => array('lang' => 'YES_ONLINE_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_onlinetrack' => array('lang' => 'YES_ONLINE_TRACK', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_unreads_search' => array('lang' => 'YES_UNREAD_SEARCH', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_moderators' => array('lang' => 'YES_MODERATORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_jumpbox' => array('lang' => 'YES_JUMPBOX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_user_activity' => array('lang' => 'LOAD_USER_ACTIVITY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'load_user_activity_limit' => array('lang' => 'LOAD_USER_ACTIVITY_LIMIT', 'validate' => 'int:0:99999999', 'type' => 'number:0:99999999', 'explain' => true), + 'load_tplcompile' => array('lang' => 'RECOMPILE_STYLES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_cdn' => array('lang' => 'ALLOW_CDN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'enable_accurate_pm_button' => array('lang' => 'YES_ACCURATE_PM_BUTTON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_live_searches' => array('lang' => 'ALLOW_LIVE_SEARCHES', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend3' => 'CUSTOM_PROFILE_FIELDS', + 'load_cpf_memberlist' => array('lang' => 'LOAD_CPF_MEMBERLIST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_cpf_pm' => array('lang' => 'LOAD_CPF_PM', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_cpf_viewprofile' => array('lang' => 'LOAD_CPF_VIEWPROFILE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + 'load_cpf_viewtopic' => array('lang' => 'LOAD_CPF_VIEWTOPIC', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => false), + + 'legend4' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'auth': + $display_vars = array( + 'title' => 'ACP_AUTH_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_AUTH_SETTINGS', + 'auth_method' => array('lang' => 'AUTH_METHOD', 'validate' => 'string', 'type' => 'select:1:toggable', 'method' => 'select_auth_method', 'explain' => false), + ) + ); + break; + + case 'server': + $display_vars = array( + 'title' => 'ACP_SERVER_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_SERVER_SETTINGS', + 'gzip_compress' => array('lang' => 'ENABLE_GZIP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'use_system_cron' => array('lang' => 'USE_SYSTEM_CRON', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend2' => 'PATH_SETTINGS', + 'enable_mod_rewrite' => array('lang' => 'MOD_REWRITE_ENABLE', 'validate' => 'bool', 'type' => 'custom', 'method' => 'enable_mod_rewrite', 'explain' => true), + 'smilies_path' => array('lang' => 'SMILIES_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), + 'icons_path' => array('lang' => 'ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), + 'upload_icons_path' => array('lang' => 'UPLOAD_ICONS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), + 'ranks_path' => array('lang' => 'RANKS_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), + + 'legend3' => 'SERVER_URL_SETTINGS', + 'force_server_vars' => array('lang' => 'FORCE_SERVER_VARS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'server_protocol' => array('lang' => 'SERVER_PROTOCOL', 'validate' => 'string', 'type' => 'text:10:10', 'explain' => true), + 'server_name' => array('lang' => 'SERVER_NAME', 'validate' => 'string', 'type' => 'text:40:255', 'explain' => true), + 'server_port' => array('lang' => 'SERVER_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), + 'script_path' => array('lang' => 'SCRIPT_PATH', 'validate' => 'script_path', 'type' => 'text::255', 'explain' => true), + + 'legend4' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + case 'security': + $display_vars = array( + 'title' => 'ACP_SECURITY_SETTINGS', + 'vars' => array( + 'legend1' => 'ACP_SECURITY_SETTINGS', + 'allow_autologin' => array('lang' => 'ALLOW_AUTOLOGIN', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'allow_password_reset' => array('lang' => 'ALLOW_PASSWORD_RESET', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'max_autologin_time' => array('lang' => 'AUTOLOGIN_LENGTH', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + 'ip_check' => array('lang' => 'IP_VALID', 'validate' => 'int', 'type' => 'custom', 'method' => 'select_ip_check', 'explain' => true), + 'browser_check' => array('lang' => 'BROWSER_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'forwarded_for_check' => array('lang' => 'FORWARDED_FOR_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'referer_validation' => array('lang' => 'REFERRER_VALID', 'validate' => 'int:0:3','type' => 'custom', 'method' => 'select_ref_check', 'explain' => true), + 'remote_upload_verify' => array('lang' => 'UPLOAD_CERT_VALID', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'check_dnsbl' => array('lang' => 'CHECK_DNSBL', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'email_check_mx' => array('lang' => 'EMAIL_CHECK_MX', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'max_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:8:255', 'type' => false, 'method' => false, 'explain' => false,), + 'min_pass_chars' => array('lang' => 'PASSWORD_LENGTH', 'validate' => 'int:1', 'type' => 'custom', 'method' => 'password_length', 'explain' => true), + 'pass_complex' => array('lang' => 'PASSWORD_TYPE', 'validate' => 'string', 'type' => 'select', 'method' => 'select_password_chars', 'explain' => true), + 'chg_passforce' => array('lang' => 'FORCE_PASS_CHANGE', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true, 'append' => ' ' . $user->lang['DAYS']), + 'max_login_attempts' => array('lang' => 'MAX_LOGIN_ATTEMPTS', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), + 'ip_login_limit_max' => array('lang' => 'IP_LOGIN_LIMIT_MAX', 'validate' => 'int:0:999', 'type' => 'number:0:999', 'explain' => true), + 'ip_login_limit_time' => array('lang' => 'IP_LOGIN_LIMIT_TIME', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'ip_login_limit_use_forwarded' => array('lang' => 'IP_LOGIN_LIMIT_USE_FORWARDED', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'tpl_allow_php' => array('lang' => 'TPL_ALLOW_PHP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'form_token_lifetime' => array('lang' => 'FORM_TIME_MAX', 'validate' => 'int:-1:99999', 'type' => 'number:-1:99999', 'explain' => true, 'append' => ' ' . $user->lang['SECONDS']), + 'form_token_sid_guests' => array('lang' => 'FORM_SID_GUESTS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + ) + ); + break; + + case 'email': + $display_vars = array( + 'title' => 'ACP_EMAIL_SETTINGS', + 'vars' => array( + 'legend1' => 'GENERAL_SETTINGS', + 'email_enable' => array('lang' => 'ENABLE_EMAIL', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'board_email_form' => array('lang' => 'BOARD_EMAIL_FORM', 'validate' => 'bool', 'type' => 'radio:enabled_disabled', 'explain' => true), + 'email_package_size' => array('lang' => 'EMAIL_PACKAGE_SIZE', 'validate' => 'int:0', 'type' => 'number:0:99999', 'explain' => true), + 'board_contact' => array('lang' => 'CONTACT_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), + 'board_contact_name' => array('lang' => 'CONTACT_EMAIL_NAME', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), + 'board_email' => array('lang' => 'ADMIN_EMAIL', 'validate' => 'email', 'type' => 'email:25:100', 'explain' => true), + 'email_force_sender' => array('lang' => 'EMAIL_FORCE_SENDER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'board_email_sig' => array('lang' => 'EMAIL_SIG', 'validate' => 'string', 'type' => 'textarea:5:30', 'explain' => true), + 'board_hide_emails' => array('lang' => 'BOARD_HIDE_EMAILS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'send_test_email' => array('lang' => 'SEND_TEST_EMAIL', 'validate' => 'bool', 'type' => 'custom', 'method' => 'send_test_email', 'explain' => true), + + 'legend2' => 'SMTP_SETTINGS', + 'smtp_delivery' => array('lang' => 'USE_SMTP', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'smtp_host' => array('lang' => 'SMTP_SERVER', 'validate' => 'string', 'type' => 'text:25:50', 'explain' => true), + 'smtp_port' => array('lang' => 'SMTP_PORT', 'validate' => 'int:0:99999', 'type' => 'number:0:99999', 'explain' => true), + 'smtp_auth_method' => array('lang' => 'SMTP_AUTH_METHOD', 'validate' => 'string', 'type' => 'select', 'method' => 'mail_auth_select', 'explain' => true), + 'smtp_username' => array('lang' => 'SMTP_USERNAME', 'validate' => 'string', 'type' => 'text:25:255', 'explain' => true), + 'smtp_password' => array('lang' => 'SMTP_PASSWORD', 'validate' => 'string', 'type' => 'password:25:255', 'explain' => true), + 'smtp_verify_peer' => array('lang' => 'SMTP_VERIFY_PEER', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'smtp_verify_peer_name' => array('lang' => 'SMTP_VERIFY_PEER_NAME', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'smtp_allow_self_signed'=> array('lang' => 'SMTP_ALLOW_SELF_SIGNED','validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + + 'legend3' => 'ACP_SUBMIT_CHANGES', + ) + ); + break; + + default: + trigger_error('NO_MODE', E_USER_ERROR); + break; + } + + /** + * Event to add and/or modify acp_board configurations + * + * @event core.acp_board_config_edit_add + * @var array display_vars Array of config values to display and process + * @var string mode Mode of the config page we are displaying + * @var boolean submit Do we display the form or process the submission + * @since 3.1.0-a4 + */ + $vars = array('display_vars', 'mode', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.acp_board_config_edit_add', compact($vars))); + + if (isset($display_vars['lang'])) + { + $user->add_lang($display_vars['lang']); + } + + $this->new_config = clone $config; + $cfg_array = (isset($_REQUEST['config'])) ? $request->variable('config', array('' => ''), true) : $this->new_config; + $error = array(); + + // We validate the complete config if wished + validate_config_vars($display_vars['vars'], $cfg_array, $error); + + if ($submit && !check_form_key($form_key)) + { + $error[] = $user->lang['FORM_INVALID']; + } + // Do not write values if there is an error + if (count($error)) + { + $submit = false; + } + + // We go through the display_vars to make sure no one is trying to set variables he/she is not allowed to... + foreach ($display_vars['vars'] as $config_name => $data) + { + if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) + { + continue; + } + + if ($config_name == 'auth_method' || $config_name == 'feed_news_id' || $config_name == 'feed_exclude_id') + { + continue; + } + + if ($config_name == 'guest_style') + { + if (isset($cfg_array[$config_name])) + { + $this->guest_style_set($cfg_array[$config_name]); + } + continue; + } + + $this->new_config[$config_name] = $config_value = $cfg_array[$config_name]; + + if ($submit) + { + if (strpos($data['type'], 'password') === 0 && $config_value === '********') + { + // Do not update password fields if the content is ********, + // because that is the password replacement we use to not + // send the password to the output + continue; + } + $config->set($config_name, $config_value); + + if ($config_name == 'allow_quick_reply' && isset($_POST['allow_quick_reply_enable'])) + { + enable_bitfield_column_flag(FORUMS_TABLE, 'forum_flags', round(log(FORUM_FLAG_QUICK_REPLY, 2))); + } + } + } + + // Invalidate the text_formatter cache when posting options are changed + if ($mode == 'post' && $submit) + { + $phpbb_container->get('text_formatter.cache')->invalidate(); + } + + // Store news and exclude ids + if ($mode == 'feed' && $submit) + { + $cache->destroy('_feed_news_forum_ids'); + $cache->destroy('_feed_excluded_forum_ids'); + + $this->store_feed_forums(FORUM_OPTION_FEED_NEWS, 'feed_news_id'); + $this->store_feed_forums(FORUM_OPTION_FEED_EXCLUDE, 'feed_exclude_id'); + } + + if ($mode == 'auth') + { + // Retrieve a list of auth plugins and check their config values + /* @var $auth_providers \phpbb\auth\provider_collection */ + $auth_providers = $phpbb_container->get('auth.provider_collection'); + + $updated_auth_settings = false; + $old_auth_config = array(); + foreach ($auth_providers as $provider) + { + /** @var \phpbb\auth\provider\provider_interface $provider */ + if ($fields = $provider->acp()) + { + // Check if we need to create config fields for this plugin and save config when submit was pressed + foreach ($fields as $field) + { + if (!isset($config[$field])) + { + $config->set($field, ''); + } + + if (!isset($cfg_array[$field]) || strpos($field, 'legend') !== false) + { + continue; + } + + if (substr($field, -9) === '_password' && $cfg_array[$field] === '********') + { + // Do not update password fields if the content is ********, + // because that is the password replacement we use to not + // send the password to the output + continue; + } + + $old_auth_config[$field] = $this->new_config[$field]; + $config_value = $cfg_array[$field]; + $this->new_config[$field] = $config_value; + + if ($submit) + { + $updated_auth_settings = true; + $config->set($field, $config_value); + } + } + } + unset($fields); + } + + if ($submit && (($cfg_array['auth_method'] != $this->new_config['auth_method']) || $updated_auth_settings)) + { + $method = basename($cfg_array['auth_method']); + if (array_key_exists('auth.provider.' . $method, $auth_providers)) + { + $provider = $auth_providers['auth.provider.' . $method]; + if ($error = $provider->init()) + { + foreach ($old_auth_config as $config_name => $config_value) + { + $config->set($config_name, $config_value); + } + trigger_error($error . adm_back_link($this->u_action), E_USER_WARNING); + } + $config->set('auth_method', basename($cfg_array['auth_method'])); + } + else + { + trigger_error('NO_AUTH_PLUGIN', E_USER_ERROR); + } + } + } + + if ($mode == 'email' && $request->is_set_post('send_test_email')) + { + if ($config['email_enable']) + { + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $messenger = new messenger(false); + $messenger->template('test'); + $messenger->set_addresses($user->data); + $messenger->anti_abuse_headers($config, $user); + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($user->data['username']), + )); + $messenger->send(NOTIFY_EMAIL); + + trigger_error($user->lang('TEST_EMAIL_SENT') . adm_back_link($this->u_action)); + } + else + { + $user->add_lang('memberlist'); + trigger_error($user->lang('EMAIL_DISABLED') . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + if ($submit) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_' . strtoupper($mode)); + + $message = $user->lang('CONFIG_UPDATED'); + $message_type = E_USER_NOTICE; + if (!$config['email_enable'] && in_array($mode, array('email', 'registration')) && + in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN))) + { + $message .= '

' . $user->lang('ACC_ACTIVATION_WARNING'); + $message_type = E_USER_WARNING; + } + trigger_error($message . adm_back_link($this->u_action), $message_type); + } + + $this->tpl_name = 'acp_board'; + $this->page_title = $display_vars['title']; + + $template->assign_vars(array( + 'L_TITLE' => $user->lang[$display_vars['title']], + 'L_TITLE_EXPLAIN' => $user->lang[$display_vars['title'] . '_EXPLAIN'], + + 'S_ERROR' => (count($error)) ? true : false, + 'ERROR_MSG' => implode('
', $error), + + 'U_ACTION' => $this->u_action) + ); + + // Output relevant page + foreach ($display_vars['vars'] as $config_key => $vars) + { + if (!is_array($vars) && strpos($config_key, 'legend') === false) + { + continue; + } + + if (strpos($config_key, 'legend') !== false) + { + $template->assign_block_vars('options', array( + 'S_LEGEND' => true, + 'LEGEND' => (isset($user->lang[$vars])) ? $user->lang[$vars] : $vars) + ); + + continue; + } + + $type = explode(':', $vars['type']); + + $l_explain = ''; + if ($vars['explain'] && isset($vars['lang_explain'])) + { + $l_explain = (isset($user->lang[$vars['lang_explain']])) ? $user->lang[$vars['lang_explain']] : $vars['lang_explain']; + } + else if ($vars['explain']) + { + $l_explain = (isset($user->lang[$vars['lang'] . '_EXPLAIN'])) ? $user->lang[$vars['lang'] . '_EXPLAIN'] : ''; + } + + $content = build_cfg_template($type, $config_key, $this->new_config, $config_key, $vars); + + if (empty($content)) + { + continue; + } + + $template->assign_block_vars('options', array( + 'KEY' => $config_key, + 'TITLE' => (isset($user->lang[$vars['lang']])) ? $user->lang[$vars['lang']] : $vars['lang'], + 'S_EXPLAIN' => $vars['explain'] && !empty($l_explain), + 'TITLE_EXPLAIN' => $l_explain, + 'CONTENT' => $content, + ) + ); + + unset($display_vars['vars'][$config_key]); + } + + if ($mode == 'auth') + { + $template->assign_var('S_AUTH', true); + + foreach ($auth_providers as $provider) + { + $auth_tpl = $provider->get_acp_template($this->new_config); + if ($auth_tpl) + { + if (array_key_exists('BLOCK_VAR_NAME', $auth_tpl)) + { + foreach ($auth_tpl['BLOCK_VARS'] as $block_vars) + { + $template->assign_block_vars($auth_tpl['BLOCK_VAR_NAME'], $block_vars); + } + } + $template->assign_vars($auth_tpl['TEMPLATE_VARS']); + $template->assign_block_vars('auth_tpl', array( + 'TEMPLATE_FILE' => $auth_tpl['TEMPLATE_FILE'], + )); + } + } + } + } + + /** + * Select auth method + */ + function select_auth_method($selected_method, $key = '') + { + global $phpbb_container; + + /* @var $auth_providers \phpbb\auth\provider_collection */ + $auth_providers = $phpbb_container->get('auth.provider_collection'); + $auth_plugins = array(); + + foreach ($auth_providers as $key => $value) + { + if (!($value instanceof \phpbb\auth\provider\provider_interface)) + { + continue; + } + $auth_plugins[] = str_replace('auth.provider.', '', $key); + } + + sort($auth_plugins); + + $auth_select = ''; + foreach ($auth_plugins as $method) + { + $selected = ($selected_method == $method) ? ' selected="selected"' : ''; + $auth_select .= "'; + } + + return $auth_select; + } + + /** + * Select mail authentication method + */ + function mail_auth_select($selected_method, $key = '') + { + global $user; + + $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5', 'POP-BEFORE-SMTP'); + $s_smtp_auth_options = ''; + + foreach ($auth_methods as $method) + { + $s_smtp_auth_options .= ''; + } + + return $s_smtp_auth_options; + } + + /** + * Select full folder action + */ + function full_folder_select($value, $key = '') + { + global $user; + + return ''; + } + + /** + * Select ip validation + */ + function select_ip_check($value, $key = '') + { + $radio_ary = array(4 => 'ALL', 3 => 'CLASS_C', 2 => 'CLASS_B', 0 => 'NO_IP_VALIDATION'); + + return h_radio('config[ip_check]', $radio_ary, $value, $key); + } + + /** + * Select referer validation + */ + function select_ref_check($value, $key = '') + { + $radio_ary = array(REFERER_VALIDATE_PATH => 'REF_PATH', REFERER_VALIDATE_HOST => 'REF_HOST', REFERER_VALIDATE_NONE => 'NO_REF_VALIDATION'); + + return h_radio('config[referer_validation]', $radio_ary, $value, $key); + } + + /** + * Select account activation method + */ + function select_acc_activation($selected_value, $value) + { + global $user, $config; + + $act_ary = array( + 'ACC_DISABLE' => array(true, USER_ACTIVATION_DISABLE), + 'ACC_NONE' => array(true, USER_ACTIVATION_NONE), + 'ACC_USER' => array($config['email_enable'], USER_ACTIVATION_SELF), + 'ACC_ADMIN' => array($config['email_enable'], USER_ACTIVATION_ADMIN), + ); + + $act_options = ''; + foreach ($act_ary as $key => $data) + { + list($available, $value) = $data; + $selected = ($selected_value == $value) ? ' selected="selected"' : ''; + $class = (!$available) ? ' class="disabled-option"' : ''; + $act_options .= ''; + } + + return $act_options; + } + + /** + * Maximum/Minimum username length + */ + function username_length($value, $key = '') + { + global $user; + + return ' ' . $user->lang['MIN_CHARS'] . '   ' . $user->lang['MAX_CHARS']; + } + + /** + * Allowed chars in usernames + */ + function select_username_chars($selected_value, $key) + { + global $user; + + $user_char_ary = array('USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII'); + $user_char_options = ''; + foreach ($user_char_ary as $user_type) + { + $selected = ($selected_value == $user_type) ? ' selected="selected"' : ''; + $user_char_options .= ''; + } + + return $user_char_options; + } + + /** + * Maximum/Minimum password length + */ + function password_length($value, $key) + { + global $user; + + return ' ' . $user->lang['MIN_CHARS'] . '   ' . $user->lang['MAX_CHARS']; + } + + /** + * Required chars in passwords + */ + function select_password_chars($selected_value, $key) + { + global $user; + + $pass_type_ary = array('PASS_TYPE_ANY', 'PASS_TYPE_CASE', 'PASS_TYPE_ALPHA', 'PASS_TYPE_SYMBOL'); + $pass_char_options = ''; + foreach ($pass_type_ary as $pass_type) + { + $selected = ($selected_value == $pass_type) ? ' selected="selected"' : ''; + $pass_char_options .= ''; + } + + return $pass_char_options; + } + + /** + * Select bump interval + */ + function bump_interval($value, $key) + { + global $user; + + $s_bump_type = ''; + $types = array('m' => 'MINUTES', 'h' => 'HOURS', 'd' => 'DAYS'); + foreach ($types as $type => $lang) + { + $selected = ($this->new_config['bump_type'] == $type) ? ' selected="selected"' : ''; + $s_bump_type .= ''; + } + + return ' '; + } + + /** + * Board disable option and message + */ + function board_disable($value, $key) + { + $radio_ary = array(1 => 'YES', 0 => 'NO'); + + return h_radio('config[board_disable]', $radio_ary, $value) . '
'; + } + + /** + * Global quick reply enable/disable setting and button to enable in all forums + */ + function quick_reply($value, $key) + { + global $user; + + $radio_ary = array(1 => 'YES', 0 => 'NO'); + + return h_radio('config[allow_quick_reply]', $radio_ary, $value) . + '

'; + } + + /** + * Select guest timezone + */ + function timezone_select($value, $key) + { + global $template, $user; + + $timezone_select = phpbb_timezone_select($template, $user, $value, true); + + return ''; + } + + /** + * Get guest style + */ + public function guest_style_get() + { + global $db; + + $sql = 'SELECT user_style + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . ANONYMOUS; + $result = $db->sql_query($sql); + + $style = (int) $db->sql_fetchfield('user_style'); + $db->sql_freeresult($result); + + return $style; + } + + /** + * Set guest style + * + * @param int $style_id The style ID + */ + public function guest_style_set($style_id) + { + global $db; + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $style_id . ' + WHERE user_id = ' . ANONYMOUS; + $db->sql_query($sql); + } + + /** + * Select default dateformat + */ + function dateformat_select($value, $key) + { + global $user, $config; + + // Let the format_date function operate with the acp values + $old_tz = $user->timezone; + try + { + $user->timezone = new DateTimeZone($config['board_timezone']); + } + catch (\Exception $e) + { + // If the board timezone is invalid, we just use the users timezone. + } + + $dateformat_options = ''; + + foreach ($user->lang['dateformats'] as $format => $null) + { + $dateformat_options .= ''; + } + + $dateformat_options .= ''; + + // Reset users date options + $user->timezone = $old_tz; + + return " + "; + } + + /** + * Select multiple forums + */ + function select_news_forums($value, $key) + { + $forum_list = make_forum_select(false, false, true, true, true, false, true); + + // Build forum options + $s_forum_options = ''; + + return $s_forum_options; + } + + function select_exclude_forums($value, $key) + { + $forum_list = make_forum_select(false, false, true, true, true, false, true); + + // Build forum options + $s_forum_options = ''; + + return $s_forum_options; + } + + function store_feed_forums($option, $key) + { + global $db, $cache, $request; + + // Get key + $values = $request->variable($key, array(0 => 0)); + + // Empty option bit for all forums + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_options = forum_options - ' . (1 << $option) . ' + WHERE ' . $db->sql_bit_and('forum_options', $option, '<> 0'); + $db->sql_query($sql); + + // Already emptied for all... + if (count($values)) + { + // Set for selected forums + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_options = forum_options + ' . (1 << $option) . ' + WHERE ' . $db->sql_in_set('forum_id', $values); + $db->sql_query($sql); + } + + // Empty sql cache for forums table because options changed + $cache->destroy('sql', FORUMS_TABLE); + } + + /** + * Option to enable/disable removal of 'app.php' from URLs + * + * Note that if mod_rewrite is on, URLs without app.php will still work, + * but any paths generated by the controller helper url() method will not + * contain app.php. + * + * @param int $value The current config value + * @param string $key The config key + * @return string The HTML for the form field + */ + function enable_mod_rewrite($value, $key) + { + global $user; + + // Determine whether mod_rewrite is enabled on the server + // NOTE: This only works on Apache servers on which PHP is NOT + // installed as CGI. In that case, there is no way for PHP to + // determine whether or not the Apache module is enabled. + // + // To be clear on the value of $mod_rewite: + // null = Cannot determine whether or not the server has mod_rewrite + // enabled + // false = Can determine that the server does NOT have mod_rewrite + // enabled + // true = Can determine that the server DOES have mod_rewrite_enabled + $mod_rewrite = null; + if (function_exists('apache_get_modules')) + { + $mod_rewrite = (bool) in_array('mod_rewrite', apache_get_modules()); + } + + // If $message is false, mod_rewrite is enabled. + // Otherwise, it is not and we need to: + // 1) disable the form field + // 2) make sure the config value is set to 0 + // 3) append the message to the return + $value = ($mod_rewrite === false) ? 0 : $value; + $message = $mod_rewrite === null ? 'MOD_REWRITE_INFORMATION_UNAVAILABLE' : ($mod_rewrite === false ? 'MOD_REWRITE_DISABLED' : false); + + // Let's do some friendly HTML injection if we want to disable the + // form field because h_radio() has no pretty way of doing so + $field_name = 'config[enable_mod_rewrite]' . ($message === 'MOD_REWRITE_DISABLED' ? '" disabled="disabled' : ''); + + return h_radio($field_name, array(1 => 'YES', 0 => 'NO'), $value) . + ($message !== false ? '
' . $user->lang($message) . '' : ''); + } + + function send_test_email($value, $key) + { + global $user; + + return ''; + } +} diff --git a/install/update/old/includes/acp/acp_database.php b/install/update/old/includes/acp/acp_database.php new file mode 100644 index 0000000..05f2b98 --- /dev/null +++ b/install/update/old/includes/acp/acp_database.php @@ -0,0 +1,622 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_database +{ + var $db_tools; + var $u_action; + public $page_title; + + function main($id, $mode) + { + global $cache, $db, $user, $template, $table_prefix, $request; + global $phpbb_root_path, $phpbb_container, $phpbb_log; + + $this->db_tools = $phpbb_container->get('dbal.tools'); + + $user->add_lang('acp/database'); + + $this->tpl_name = 'acp_database'; + $this->page_title = 'ACP_DATABASE'; + + $action = $request->variable('action', ''); + + $form_key = 'acp_database'; + add_form_key($form_key); + + $template->assign_vars(array( + 'MODE' => $mode + )); + + switch ($mode) + { + case 'backup': + + $this->page_title = 'ACP_BACKUP'; + + switch ($action) + { + case 'download': + $type = $request->variable('type', ''); + $table = array_intersect($this->db_tools->sql_list_tables(), $request->variable('table', array(''))); + $format = $request->variable('method', ''); + $where = $request->variable('where', ''); + + if (!count($table)) + { + trigger_error($user->lang['TABLE_SELECT_ERROR'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (!check_form_key($form_key)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $store = $structure = $schema_data = false; + + if ($where == 'store') + { + $store = true; + } + + if ($type == 'full' || $type == 'structure') + { + $structure = true; + } + + if ($type == 'full' || $type == 'data') + { + $schema_data = true; + } + + @set_time_limit(1200); + @set_time_limit(0); + + $time = time(); + + $filename = 'backup_' . $time . '_' . unique_id(); + + /** @var phpbb\db\extractor\extractor_interface $extractor Database extractor */ + $extractor = $phpbb_container->get('dbal.extractor'); + $extractor->init_extractor($format, $filename, $time, false, $store); + + $extractor->write_start($table_prefix); + + foreach ($table as $table_name) + { + // Get the table structure + if ($structure) + { + $extractor->write_table($table_name); + } + else + { + // We might wanna empty out all that junk :D + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $extractor->flush('DELETE FROM ' . $table_name . ";\n"); + break; + + case 'mssql_odbc': + case 'mssqlnative': + $extractor->flush('TRUNCATE TABLE ' . $table_name . "GO\n"); + break; + + case 'oracle': + $extractor->flush('TRUNCATE TABLE ' . $table_name . "/\n"); + break; + + default: + $extractor->flush('TRUNCATE TABLE ' . $table_name . ";\n"); + break; + } + } + + // Data + if ($schema_data) + { + $extractor->write_data($table_name); + } + } + + $extractor->write_end(); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_BACKUP'); + + trigger_error($user->lang['BACKUP_SUCCESS'] . adm_back_link($this->u_action)); + break; + + default: + $tables = $this->db_tools->sql_list_tables(); + asort($tables); + foreach ($tables as $table_name) + { + if (strlen($table_prefix) === 0 || stripos($table_name, $table_prefix) === 0) + { + $template->assign_block_vars('tables', array( + 'TABLE' => $table_name + )); + } + } + unset($tables); + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action . '&action=download' + )); + + $available_methods = array('gzip' => 'zlib', 'bzip2' => 'bz2'); + + foreach ($available_methods as $type => $module) + { + if (!@extension_loaded($module)) + { + continue; + } + + $template->assign_block_vars('methods', array( + 'TYPE' => $type + )); + } + + $template->assign_block_vars('methods', array( + 'TYPE' => 'text' + )); + break; + } + break; + + case 'restore': + + $this->page_title = 'ACP_RESTORE'; + + switch ($action) + { + case 'submit': + $delete = $request->variable('delete', ''); + $file = $request->variable('file', ''); + + $backup_info = $this->get_backup_file($phpbb_root_path . 'store/', $file); + + if (empty($backup_info) || !is_readable($backup_info['file_name'])) + { + trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if ($delete) + { + if (confirm_box(true)) + { + unlink($backup_info['file_name']); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_DELETE'); + trigger_error($user->lang['BACKUP_DELETE'] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['DELETE_SELECTED_BACKUP'], build_hidden_fields(array('delete' => $delete, 'file' => $file))); + } + } + else if (confirm_box(true)) + { + switch ($backup_info['extensions']) + { + case 'sql': + $fp = fopen($backup_info['file_name'], 'rb'); + $read = 'fread'; + $seek = 'fseek'; + $eof = 'feof'; + $close = 'fclose'; + $fgetd = 'fgetd'; + break; + + case 'sql.bz2': + $fp = bzopen($backup_info['file_name'], 'r'); + $read = 'bzread'; + $seek = ''; + $eof = 'feof'; + $close = 'bzclose'; + $fgetd = 'fgetd_seekless'; + break; + + case 'sql.gz': + $fp = gzopen($backup_info['file_name'], 'rb'); + $read = 'gzread'; + $seek = 'gzseek'; + $eof = 'gzeof'; + $close = 'gzclose'; + $fgetd = 'fgetd'; + break; + + default: + trigger_error($user->lang['BACKUP_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + return; + } + + switch ($db->get_sql_layer()) + { + case 'mysql': + case 'mysql4': + case 'mysqli': + case 'sqlite3': + while (($sql = $fgetd($fp, ";\n", $read, $seek, $eof)) !== false) + { + $db->sql_query($sql); + } + break; + + case 'postgres': + $delim = ";\n"; + while (($sql = $fgetd($fp, $delim, $read, $seek, $eof)) !== false) + { + $query = trim($sql); + + if (substr($query, 0, 13) == 'CREATE DOMAIN') + { + list(, , $domain) = explode(' ', $query); + $sql = "SELECT domain_name + FROM information_schema.domains + WHERE domain_name = '$domain';"; + $result = $db->sql_query($sql); + if (!$db->sql_fetchrow($result)) + { + $db->sql_query($query); + } + $db->sql_freeresult($result); + } + else + { + $db->sql_query($query); + } + + if (substr($query, 0, 4) == 'COPY') + { + while (($sub = $fgetd($fp, "\n", $read, $seek, $eof)) !== '\.') + { + if ($sub === false) + { + trigger_error($user->lang['RESTORE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + pg_put_line($db->get_db_connect_id(), $sub . "\n"); + } + pg_put_line($db->get_db_connect_id(), "\\.\n"); + pg_end_copy($db->get_db_connect_id()); + } + } + break; + + case 'oracle': + while (($sql = $fgetd($fp, "/\n", $read, $seek, $eof)) !== false) + { + $db->sql_query($sql); + } + break; + + case 'mssql_odbc': + case 'mssqlnative': + while (($sql = $fgetd($fp, "GO\n", $read, $seek, $eof)) !== false) + { + $db->sql_query($sql); + } + break; + } + + $close($fp); + + // Purge the cache due to updated data + $cache->purge(); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_DB_RESTORE'); + trigger_error($user->lang['RESTORE_SUCCESS'] . adm_back_link($this->u_action)); + break; + } + else + { + confirm_box(false, $user->lang['RESTORE_SELECTED_BACKUP'], build_hidden_fields(array('file' => $file))); + } + + default: + $backup_files = $this->get_file_list($phpbb_root_path . 'store/'); + + if (!empty($backup_files)) + { + krsort($backup_files); + + foreach ($backup_files as $name => $file) + { + $template->assign_block_vars('files', array( + 'FILE' => sha1($file), + 'NAME' => $user->format_date($name, 'd-m-Y H:i', true), + 'SUPPORTED' => true, + )); + } + } + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action . '&action=submit' + )); + break; + } + break; + } + } + + /** + * Get backup file from file hash + * + * @param string $directory Relative path to directory + * @param string $file_hash Hash of selected file + * + * @return array Backup file data or empty array if unable to find file + */ + protected function get_backup_file($directory, $file_hash) + { + $backup_data = []; + + $file_list = $this->get_file_list($directory); + $supported_extensions = $this->get_supported_extensions(); + + foreach ($file_list as $file) + { + preg_match('#^backup_(\d{10,})_(?:[a-z\d]{16}|[a-z\d]{32})\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches); + if (sha1($file) === $file_hash && in_array($matches[2], $supported_extensions)) + { + $backup_data = [ + 'file_name' => $directory . $file, + 'extension' => $matches[2], + ]; + break; + } + } + + return $backup_data; + } + + /** + * Get backup file list for directory + * + * @param string $directory Relative path to backup directory + * + * @return array List of backup files in specified directory + */ + protected function get_file_list($directory) + { + $supported_extensions = $this->get_supported_extensions(); + + $dh = @opendir($directory); + + $backup_files = []; + + if ($dh) + { + while (($file = readdir($dh)) !== false) + { + if (preg_match('#^backup_(\d{10,})_(?:[a-z\d]{16}|[a-z\d]{32})\.(sql(?:\.(?:gz|bz2))?)$#i', $file, $matches)) + { + if (in_array($matches[2], $supported_extensions)) + { + $backup_files[(int) $matches[1]] = $file; + } + } + } + closedir($dh); + } + + return $backup_files; + } + + /** + * Get supported extensions for backup + * + * @return array List of supported extensions + */ + protected function get_supported_extensions() + { + $extensions = ['sql']; + $available_methods = ['sql.gz' => 'zlib', 'sql.bz2' => 'bz2']; + + foreach ($available_methods as $type => $module) + { + if (!@extension_loaded($module)) + { + continue; + } + $extensions[] = $type; + } + + return $extensions; + } +} + +// get how much space we allow for a chunk of data, very similar to phpMyAdmin's way of doing things ;-) (hey, we only do this for MySQL anyway :P) +function get_usable_memory() +{ + $val = trim(@ini_get('memory_limit')); + + if (preg_match('/(\\d+)([mkg]?)/i', $val, $regs)) + { + $memory_limit = (int) $regs[1]; + switch ($regs[2]) + { + + case 'k': + case 'K': + $memory_limit *= 1024; + break; + + case 'm': + case 'M': + $memory_limit *= 1048576; + break; + + case 'g': + case 'G': + $memory_limit *= 1073741824; + break; + } + + // how much memory PHP requires at the start of export (it is really a little less) + if ($memory_limit > 6100000) + { + $memory_limit -= 6100000; + } + + // allow us to consume half of the total memory available + $memory_limit /= 2; + } + else + { + // set the buffer to 1M if we have no clue how much memory PHP will give us :P + $memory_limit = 1048576; + } + + return $memory_limit; +} + +function sanitize_data_mssql($text) +{ + $data = preg_split('/[\n\t\r\b\f]/', $text); + preg_match_all('/[\n\t\r\b\f]/', $text, $matches); + + $val = array(); + + foreach ($data as $value) + { + if (strlen($value)) + { + $val[] = "'" . $value . "'"; + } + if (count($matches[0])) + { + $val[] = 'char(' . ord(array_shift($matches[0])) . ')'; + } + } + + return implode('+', $val); +} + +function sanitize_data_oracle($text) +{ +// $data = preg_split('/[\0\n\t\r\b\f\'"\/\\\]/', $text); +// preg_match_all('/[\0\n\t\r\b\f\'"\/\\\]/', $text, $matches); + $data = preg_split('/[\0\b\f\'\/]/', $text); + preg_match_all('/[\0\r\b\f\'\/]/', $text, $matches); + + $val = array(); + + foreach ($data as $value) + { + if (strlen($value)) + { + $val[] = "'" . $value . "'"; + } + if (count($matches[0])) + { + $val[] = 'chr(' . ord(array_shift($matches[0])) . ')'; + } + } + + return implode('||', $val); +} + +function sanitize_data_generic($text) +{ + $data = preg_split('/[\n\t\r\b\f]/', $text); + preg_match_all('/[\n\t\r\b\f]/', $text, $matches); + + $val = array(); + + foreach ($data as $value) + { + if (strlen($value)) + { + $val[] = "'" . $value . "'"; + } + if (count($matches[0])) + { + $val[] = "'" . array_shift($matches[0]) . "'"; + } + } + + return implode('||', $val); +} + +// modified from PHP.net +function fgetd(&$fp, $delim, $read, $seek, $eof, $buffer = 8192) +{ + $record = ''; + $delim_len = strlen($delim); + + while (!$eof($fp)) + { + $pos = strpos($record, $delim); + if ($pos === false) + { + $record .= $read($fp, $buffer); + if ($eof($fp) && ($pos = strpos($record, $delim)) !== false) + { + $seek($fp, $pos + $delim_len - strlen($record), SEEK_CUR); + return substr($record, 0, $pos); + } + } + else + { + $seek($fp, $pos + $delim_len - strlen($record), SEEK_CUR); + return substr($record, 0, $pos); + } + } + + return false; +} + +function fgetd_seekless(&$fp, $delim, $read, $seek, $eof, $buffer = 8192) +{ + static $array = array(); + static $record = ''; + + if (!count($array)) + { + while (!$eof($fp)) + { + if (strpos($record, $delim) !== false) + { + $array = explode($delim, $record); + $record = array_pop($array); + break; + } + else + { + $record .= $read($fp, $buffer); + } + } + if ($eof($fp) && strpos($record, $delim) !== false) + { + $array = explode($delim, $record); + $record = array_pop($array); + } + } + + if (count($array)) + { + return array_shift($array); + } + + return false; +} diff --git a/install/update/old/includes/acp/acp_extensions.php b/install/update/old/includes/acp/acp_extensions.php new file mode 100644 index 0000000..a1cb210 --- /dev/null +++ b/install/update/old/includes/acp/acp_extensions.php @@ -0,0 +1,665 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use phpbb\exception\exception_interface; +use phpbb\exception\version_check_exception; + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_extensions +{ + var $u_action; + var $tpl_name; + var $page_title; + + private $config; + private $template; + private $user; + private $log; + private $request; + private $phpbb_dispatcher; + private $ext_manager; + private $phpbb_container; + private $php_ini; + + function main() + { + // Start the page + global $config, $user, $template, $request, $phpbb_extension_manager, $phpbb_root_path, $phpbb_log, $phpbb_dispatcher, $phpbb_container; + + $this->config = $config; + $this->template = $template; + $this->user = $user; + $this->request = $request; + $this->log = $phpbb_log; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->ext_manager = $phpbb_extension_manager; + $this->phpbb_container = $phpbb_container; + $this->php_ini = $this->phpbb_container->get('php_ini'); + + $this->user->add_lang(array('install', 'acp/extensions', 'migrator')); + + $this->page_title = 'ACP_EXTENSIONS'; + + $action = $this->request->variable('action', 'list'); + $ext_name = $this->request->variable('ext_name', ''); + + // What is a safe limit of execution time? Half the max execution time should be safe. + $safe_time_limit = ($this->php_ini->getNumeric('max_execution_time') / 2); + $start_time = time(); + + // Cancel action + if ($this->request->is_set_post('cancel')) + { + $action = 'list'; + $ext_name = ''; + } + + if (in_array($action, array('enable', 'disable', 'delete_data')) && !check_link_hash($this->request->variable('hash', ''), $action . '.' . $ext_name)) + { + trigger_error('FORM_INVALID', E_USER_WARNING); + } + + /** + * Event to run a specific action on extension + * + * @event core.acp_extensions_run_action_before + * @var string action Action to run; if the event completes execution of the action, should be set to 'none' + * @var string u_action Url we are at + * @var string ext_name Extension name from request + * @var int safe_time_limit Safe limit of execution time + * @var int start_time Start time + * @var string tpl_name Template file to load + * @since 3.1.11-RC1 + * @changed 3.2.1-RC1 Renamed to core.acp_extensions_run_action_before, added tpl_name, added action 'none' + */ + $u_action = $this->u_action; + $tpl_name = ''; + $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time', 'tpl_name'); + extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action_before', compact($vars))); + + // In case they have been updated by the event + $this->u_action = $u_action; + $this->tpl_name = $tpl_name; + + // If they've specified an extension, let's load the metadata manager and validate it. + if ($ext_name) + { + $md_manager = $this->ext_manager->create_extension_metadata_manager($ext_name); + + try + { + $md_manager->get_metadata('all'); + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + // What are we doing? + switch ($action) + { + case 'none': + // Intentionally empty, used by extensions that execute additional actions in the prior event + break; + + case 'set_config_version_check_force_unstable': + $force_unstable = $this->request->variable('force_unstable', false); + + if ($force_unstable) + { + $s_hidden_fields = build_hidden_fields(array( + 'force_unstable' => $force_unstable, + )); + + confirm_box(false, $this->user->lang('EXTENSION_FORCE_UNSTABLE_CONFIRM'), $s_hidden_fields); + } + else + { + $this->config->set('extension_force_unstable', false); + trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + } + break; + + case 'list': + default: + if (confirm_box(true)) + { + $this->config->set('extension_force_unstable', true); + trigger_error($this->user->lang['CONFIG_UPDATED'] . adm_back_link($this->u_action)); + } + + $this->list_enabled_exts(); + $this->list_disabled_exts(); + $this->list_available_exts(); + + $this->template->assign_vars(array( + 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=list&versioncheck_force=1', + 'FORCE_UNSTABLE' => $this->config['extension_force_unstable'], + 'U_ACTION' => $this->u_action, + )); + + $this->tpl_name = 'acp_ext_list'; + break; + + case 'enable_pre': + try + { + $md_manager->validate_enable(); + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); + } + + $extension = $this->ext_manager->get_extension($ext_name); + if (!$extension->is_enableable()) + { + trigger_error($this->user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if ($this->ext_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + + $this->tpl_name = 'acp_ext_enable'; + + $this->template->assign_vars(array( + 'PRE' => true, + 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_ENABLE_CONFIRM', $md_manager->get_metadata('display-name')), + 'U_ENABLE' => $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name), + )); + break; + + case 'enable': + try + { + $md_manager->validate_enable(); + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING); + } + + $extension = $this->ext_manager->get_extension($ext_name); + if (!$extension->is_enableable()) + { + trigger_error($this->user->lang['EXTENSION_NOT_ENABLEABLE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + try + { + while ($this->ext_manager->enable_step($ext_name)) + { + // Are we approaching the time limit? If so we want to pause the update and continue after refreshing + if ((time() - $start_time) >= $safe_time_limit) + { + $this->template->assign_var('S_NEXT_STEP', true); + + meta_refresh(0, $this->u_action . '&action=enable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('enable.' . $ext_name)); + } + } + + // Update custom style for admin area + $this->template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), + ), array($phpbb_root_path . 'adm/style')); + + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_ENABLE', time(), array($ext_name)); + } + catch (\phpbb\db\migration\exception $e) + { + $this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user)); + } + + $this->tpl_name = 'acp_ext_enable'; + + $this->template->assign_vars(array( + 'U_RETURN' => $this->u_action . '&action=list', + )); + break; + + case 'disable_pre': + if (!$this->ext_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + + $this->tpl_name = 'acp_ext_disable'; + + $this->template->assign_vars(array( + 'PRE' => true, + 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DISABLE_CONFIRM', $md_manager->get_metadata('display-name')), + 'U_DISABLE' => $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name), + )); + break; + + case 'disable': + if (!$this->ext_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + + while ($this->ext_manager->disable_step($ext_name)) + { + // Are we approaching the time limit? If so we want to pause the update and continue after refreshing + if ((time() - $start_time) >= $safe_time_limit) + { + $this->template->assign_var('S_NEXT_STEP', true); + + meta_refresh(0, $this->u_action . '&action=disable&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('disable.' . $ext_name)); + } + } + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_DISABLE', time(), array($ext_name)); + + $this->tpl_name = 'acp_ext_disable'; + + $this->template->assign_vars(array( + 'U_RETURN' => $this->u_action . '&action=list', + )); + break; + + case 'delete_data_pre': + if ($this->ext_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + $this->tpl_name = 'acp_ext_delete_data'; + + $this->template->assign_vars(array( + 'PRE' => true, + 'L_CONFIRM_MESSAGE' => $this->user->lang('EXTENSION_DELETE_DATA_CONFIRM', $md_manager->get_metadata('display-name')), + 'U_PURGE' => $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name), + )); + break; + + case 'delete_data': + if ($this->ext_manager->is_enabled($ext_name)) + { + redirect($this->u_action); + } + + try + { + while ($this->ext_manager->purge_step($ext_name)) + { + // Are we approaching the time limit? If so we want to pause the update and continue after refreshing + if ((time() - $start_time) >= $safe_time_limit) + { + $this->template->assign_var('S_NEXT_STEP', true); + + meta_refresh(0, $this->u_action . '&action=delete_data&ext_name=' . urlencode($ext_name) . '&hash=' . generate_link_hash('delete_data.' . $ext_name)); + } + } + $this->log->add('admin', $this->user->data['user_id'], $this->user->ip, 'LOG_EXT_PURGE', time(), array($ext_name)); + } + catch (\phpbb\db\migration\exception $e) + { + $this->template->assign_var('MIGRATOR_ERROR', $e->getLocalisedMessage($this->user)); + } + + $this->tpl_name = 'acp_ext_delete_data'; + + $this->template->assign_vars(array( + 'U_RETURN' => $this->u_action . '&action=list', + )); + break; + + case 'details': + // Output it to the template + $meta = $md_manager->get_metadata('all'); + $this->output_metadata_to_template($meta); + + if (isset($meta['extra']['version-check'])) + { + try + { + $updates_available = $this->ext_manager->version_check($md_manager, $this->request->variable('versioncheck_force', false), false, $this->config['extension_force_unstable'] ? 'unstable' : null); + + $this->template->assign_vars(array( + 'S_UP_TO_DATE' => empty($updates_available), + 'UP_TO_DATE_MSG' => $this->user->lang(empty($updates_available) ? 'UP_TO_DATE' : 'NOT_UP_TO_DATE', $md_manager->get_metadata('display-name')), + )); + + $this->template->assign_block_vars('updates_available', $updates_available); + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + + $this->template->assign_vars(array( + 'S_VERSIONCHECK_FAIL' => true, + 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '', + )); + } + $this->template->assign_var('S_VERSIONCHECK', true); + } + else + { + $this->template->assign_var('S_VERSIONCHECK', false); + } + + $this->template->assign_vars(array( + 'U_BACK' => $this->u_action . '&action=list', + 'U_VERSIONCHECK_FORCE' => $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')), + )); + + $this->tpl_name = 'acp_ext_details'; + break; + } + + /** + * Event to run after a specific action on extension has completed + * + * @event core.acp_extensions_run_action_after + * @var string action Action that has run + * @var string u_action Url we are at + * @var string ext_name Extension name from request + * @var int safe_time_limit Safe limit of execution time + * @var int start_time Start time + * @var string tpl_name Template file to load + * @since 3.1.11-RC1 + */ + $u_action = $this->u_action; + $tpl_name = $this->tpl_name; + $vars = array('action', 'u_action', 'ext_name', 'safe_time_limit', 'start_time', 'tpl_name'); + extract($this->phpbb_dispatcher->trigger_event('core.acp_extensions_run_action_after', compact($vars))); + + // In case they have been updated by the event + $this->u_action = $u_action; + $this->tpl_name = $tpl_name; + } + + /** + * Lists all the enabled extensions and dumps to the template + * + * @return null + */ + public function list_enabled_exts() + { + $enabled_extension_meta_data = array(); + + foreach ($this->ext_manager->all_enabled() as $name => $location) + { + $md_manager = $this->ext_manager->create_extension_metadata_manager($name); + + try + { + $meta = $md_manager->get_metadata('all'); + $enabled_extension_meta_data[$name] = array( + 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), + 'META_VERSION' => $meta['version'], + ); + + if (isset($meta['extra']['version-check'])) + { + try + { + $force_update = $this->request->variable('versioncheck_force', false); + $updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update); + + $enabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); + $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; + $enabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); + } + catch (exception_interface $e) + { + // Ignore exceptions due to the version check + } + } + else + { + $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->template->assign_block_vars('disabled', array( + 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $message), + 'S_VERSIONCHECK' => false, + )); + } + catch (\RuntimeException $e) + { + $enabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + + uasort($enabled_extension_meta_data, array($this, 'sort_extension_meta_data_table')); + + foreach ($enabled_extension_meta_data as $name => $block_vars) + { + $block_vars['NAME'] = $name; + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('enabled', $block_vars); + + $this->output_actions('enabled', array( + 'DISABLE' => $this->u_action . '&action=disable_pre&ext_name=' . urlencode($name), + )); + } + } + + /** + * Lists all the disabled extensions and dumps to the template + * + * @return null + */ + public function list_disabled_exts() + { + $disabled_extension_meta_data = array(); + + foreach ($this->ext_manager->all_disabled() as $name => $location) + { + $md_manager = $this->ext_manager->create_extension_metadata_manager($name); + + try + { + $meta = $md_manager->get_metadata('all'); + $disabled_extension_meta_data[$name] = array( + 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), + 'META_VERSION' => $meta['version'], + ); + + if (isset($meta['extra']['version-check'])) + { + $force_update = $this->request->variable('versioncheck_force', false); + $updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update); + + $disabled_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); + $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = true; + $disabled_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); + } + else + { + $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + catch (version_check_exception $e) + { + $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->template->assign_block_vars('disabled', array( + 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $message), + 'S_VERSIONCHECK' => false, + )); + } + catch (\RuntimeException $e) + { + $disabled_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + + uasort($disabled_extension_meta_data, array($this, 'sort_extension_meta_data_table')); + + foreach ($disabled_extension_meta_data as $name => $block_vars) + { + $block_vars['NAME'] = $name; + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('disabled', $block_vars); + + $this->output_actions('disabled', array( + 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), + 'DELETE_DATA' => $this->u_action . '&action=delete_data_pre&ext_name=' . urlencode($name), + )); + } + } + + /** + * Lists all the available extensions and dumps to the template + * + * @return null + */ + public function list_available_exts() + { + $uninstalled = array_diff_key($this->ext_manager->all_available(), $this->ext_manager->all_configured()); + + $available_extension_meta_data = array(); + + foreach ($uninstalled as $name => $location) + { + $md_manager = $this->ext_manager->create_extension_metadata_manager($name); + + try + { + $meta = $md_manager->get_metadata('all'); + $available_extension_meta_data[$name] = array( + 'META_DISPLAY_NAME' => $md_manager->get_metadata('display-name'), + 'META_VERSION' => $meta['version'], + ); + + if (isset($meta['extra']['version-check'])) + { + $force_update = $this->request->variable('versioncheck_force', false); + $updates = $this->ext_manager->version_check($md_manager, $force_update, !$force_update); + + $available_extension_meta_data[$name]['S_UP_TO_DATE'] = empty($updates); + $available_extension_meta_data[$name]['S_VERSIONCHECK'] = true; + $available_extension_meta_data[$name]['U_VERSIONCHECK_FORCE'] = $this->u_action . '&action=details&versioncheck_force=1&ext_name=' . urlencode($md_manager->get_metadata('name')); + } + else + { + $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + } + catch (version_check_exception $e) + { + $available_extension_meta_data[$name]['S_VERSIONCHECK'] = false; + } + catch (exception_interface $e) + { + $message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $this->template->assign_block_vars('disabled', array( + 'META_DISPLAY_NAME' => $this->user->lang('EXTENSION_INVALID_LIST', $name, $message), + 'S_VERSIONCHECK' => false, + )); + } + } + + uasort($available_extension_meta_data, array($this, 'sort_extension_meta_data_table')); + + foreach ($available_extension_meta_data as $name => $block_vars) + { + $block_vars['NAME'] = $name; + $block_vars['U_DETAILS'] = $this->u_action . '&action=details&ext_name=' . urlencode($name); + + $this->template->assign_block_vars('disabled', $block_vars); + + $this->output_actions('disabled', array( + 'ENABLE' => $this->u_action . '&action=enable_pre&ext_name=' . urlencode($name), + )); + } + } + + /** + * Output actions to a block + * + * @param string $block + * @param array $actions + */ + private function output_actions($block, $actions) + { + foreach ($actions as $lang => $url) + { + $this->template->assign_block_vars($block . '.actions', array( + 'L_ACTION' => $this->user->lang('EXTENSION_' . $lang), + 'L_ACTION_EXPLAIN' => (isset($this->user->lang['EXTENSION_' . $lang . '_EXPLAIN'])) ? $this->user->lang('EXTENSION_' . $lang . '_EXPLAIN') : '', + 'U_ACTION' => $url, + )); + } + } + + /** + * Sort helper for the table containing the metadata about the extensions. + */ + protected function sort_extension_meta_data_table($val1, $val2) + { + return strnatcasecmp($val1['META_DISPLAY_NAME'], $val2['META_DISPLAY_NAME']); + } + + /** + * Outputs extension metadata into the template + * + * @param array $metadata Array with all metadata for the extension + * @return null + */ + public function output_metadata_to_template($metadata) + { + $this->template->assign_vars(array( + 'META_NAME' => $metadata['name'], + 'META_TYPE' => $metadata['type'], + 'META_DESCRIPTION' => (isset($metadata['description'])) ? $metadata['description'] : '', + 'META_HOMEPAGE' => (isset($metadata['homepage'])) ? $metadata['homepage'] : '', + 'META_VERSION' => $metadata['version'], + 'META_TIME' => (isset($metadata['time'])) ? $metadata['time'] : '', + 'META_LICENSE' => $metadata['license'], + + 'META_REQUIRE_PHP' => (isset($metadata['require']['php'])) ? $metadata['require']['php'] : '', + 'META_REQUIRE_PHP_FAIL' => (isset($metadata['require']['php'])) ? false : true, + + 'META_REQUIRE_PHPBB' => (isset($metadata['extra']['soft-require']['phpbb/phpbb'])) ? $metadata['extra']['soft-require']['phpbb/phpbb'] : '', + 'META_REQUIRE_PHPBB_FAIL' => (isset($metadata['extra']['soft-require']['phpbb/phpbb'])) ? false : true, + + 'META_DISPLAY_NAME' => (isset($metadata['extra']['display-name'])) ? $metadata['extra']['display-name'] : '', + )); + + foreach ($metadata['authors'] as $author) + { + $this->template->assign_block_vars('meta_authors', array( + 'AUTHOR_NAME' => $author['name'], + 'AUTHOR_EMAIL' => (isset($author['email'])) ? $author['email'] : '', + 'AUTHOR_HOMEPAGE' => (isset($author['homepage'])) ? $author['homepage'] : '', + 'AUTHOR_ROLE' => (isset($author['role'])) ? $author['role'] : '', + )); + } + } +} diff --git a/install/update/old/includes/acp/acp_forums.php b/install/update/old/includes/acp/acp_forums.php new file mode 100644 index 0000000..be5a7a2 --- /dev/null +++ b/install/update/old/includes/acp/acp_forums.php @@ -0,0 +1,2179 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_forums +{ + var $u_action; + var $parent_id = 0; + + function main($id, $mode) + { + global $db, $user, $auth, $template, $cache, $request, $phpbb_dispatcher; + global $phpbb_admin_path, $phpbb_root_path, $phpEx, $phpbb_log; + + $user->add_lang('acp/forums'); + $this->tpl_name = 'acp_forums'; + $this->page_title = 'ACP_MANAGE_FORUMS'; + + $form_key = 'acp_forums'; + add_form_key($form_key); + + $action = $request->variable('action', ''); + $update = (isset($_POST['update'])) ? true : false; + $forum_id = $request->variable('f', 0); + + $this->parent_id = $request->variable('parent_id', 0); + $forum_data = $errors = array(); + if ($update && !check_form_key($form_key)) + { + $update = false; + $errors[] = $user->lang['FORM_INVALID']; + } + + // Check additional permissions + switch ($action) + { + case 'progress_bar': + $start = $request->variable('start', 0); + $total = $request->variable('total', 0); + + $this->display_progress_bar($start, $total); + break; + + case 'delete': + + if (!$auth->acl_get('a_forumdel')) + { + trigger_error($user->lang['NO_PERMISSION_FORUM_DELETE'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + break; + + case 'add': + + if (!$auth->acl_get('a_forumadd')) + { + trigger_error($user->lang['NO_PERMISSION_FORUM_ADD'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + break; + } + + // Major routines + if ($update) + { + switch ($action) + { + case 'delete': + $action_subforums = $request->variable('action_subforums', ''); + $subforums_to_id = $request->variable('subforums_to_id', 0); + $action_posts = $request->variable('action_posts', ''); + $posts_to_id = $request->variable('posts_to_id', 0); + + $errors = $this->delete_forum($forum_id, $action_posts, $action_subforums, $posts_to_id, $subforums_to_id); + + if (count($errors)) + { + break; + } + + $auth->acl_clear_prefetch(); + $cache->destroy('sql', FORUMS_TABLE); + + trigger_error($user->lang['FORUM_DELETED'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + + break; + + case 'edit': + $forum_data = array( + 'forum_id' => $forum_id + ); + + // No break here + + case 'add': + + $forum_data += array( + 'parent_id' => $request->variable('forum_parent_id', $this->parent_id), + 'forum_type' => $request->variable('forum_type', FORUM_POST), + 'type_action' => $request->variable('type_action', ''), + 'forum_status' => $request->variable('forum_status', ITEM_UNLOCKED), + 'forum_parents' => '', + 'forum_name' => $request->variable('forum_name', '', true), + 'forum_link' => $request->variable('forum_link', ''), + 'forum_link_track' => $request->variable('forum_link_track', false), + 'forum_desc' => $request->variable('forum_desc', '', true), + 'forum_desc_uid' => '', + 'forum_desc_options' => 7, + 'forum_desc_bitfield' => '', + 'forum_rules' => $request->variable('forum_rules', '', true), + 'forum_rules_uid' => '', + 'forum_rules_options' => 7, + 'forum_rules_bitfield' => '', + 'forum_rules_link' => $request->variable('forum_rules_link', ''), + 'forum_image' => $request->variable('forum_image', ''), + 'forum_style' => $request->variable('forum_style', 0), + 'display_subforum_list' => $request->variable('display_subforum_list', false), + 'display_on_index' => $request->variable('display_on_index', false), + 'forum_topics_per_page' => $request->variable('topics_per_page', 0), + 'enable_indexing' => $request->variable('enable_indexing', true), + 'enable_icons' => $request->variable('enable_icons', false), + 'enable_prune' => $request->variable('enable_prune', false), + 'enable_post_review' => $request->variable('enable_post_review', true), + 'enable_quick_reply' => $request->variable('enable_quick_reply', false), + 'enable_shadow_prune' => $request->variable('enable_shadow_prune', false), + 'prune_days' => $request->variable('prune_days', 7), + 'prune_viewed' => $request->variable('prune_viewed', 7), + 'prune_freq' => $request->variable('prune_freq', 1), + 'prune_old_polls' => $request->variable('prune_old_polls', false), + 'prune_announce' => $request->variable('prune_announce', false), + 'prune_sticky' => $request->variable('prune_sticky', false), + 'prune_shadow_days' => $request->variable('prune_shadow_days', 7), + 'prune_shadow_freq' => $request->variable('prune_shadow_freq', 1), + 'forum_password' => $request->variable('forum_password', '', true), + 'forum_password_confirm'=> $request->variable('forum_password_confirm', '', true), + 'forum_password_unset' => $request->variable('forum_password_unset', false), + ); + + /** + * Request forum data and operate on it (parse texts, etc.) + * + * @event core.acp_manage_forums_request_data + * @var string action Type of the action: add|edit + * @var array forum_data Array with new forum data + * @since 3.1.0-a1 + */ + $vars = array('action', 'forum_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_request_data', compact($vars))); + + // On add, add empty forum_options... else do not consider it (not updating it) + if ($action == 'add') + { + $forum_data['forum_options'] = 0; + } + + // Use link_display_on_index setting if forum type is link + if ($forum_data['forum_type'] == FORUM_LINK) + { + $forum_data['display_on_index'] = $request->variable('link_display_on_index', false); + } + + // Linked forums and categories are not able to be locked... + if ($forum_data['forum_type'] == FORUM_LINK || $forum_data['forum_type'] == FORUM_CAT) + { + $forum_data['forum_status'] = ITEM_UNLOCKED; + } + + $forum_data['show_active'] = ($forum_data['forum_type'] == FORUM_POST) ? $request->variable('display_recent', true) : $request->variable('display_active', false); + + // Get data for forum rules if specified... + if ($forum_data['forum_rules']) + { + generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], $request->variable('rules_parse_bbcode', false), $request->variable('rules_parse_urls', false), $request->variable('rules_parse_smilies', false)); + } + + // Get data for forum description if specified + if ($forum_data['forum_desc']) + { + generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], $request->variable('desc_parse_bbcode', false), $request->variable('desc_parse_urls', false), $request->variable('desc_parse_smilies', false)); + } + + $errors = $this->update_forum_data($forum_data); + + if (!count($errors)) + { + $forum_perm_from = $request->variable('forum_perm_from', 0); + $cache->destroy('sql', FORUMS_TABLE); + + $copied_permissions = false; + // Copy permissions? + if ($forum_perm_from && $forum_perm_from != $forum_data['forum_id'] && + ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')))) + { + copy_forum_permissions($forum_perm_from, $forum_data['forum_id'], ($action == 'edit') ? true : false); + phpbb_cache_moderators($db, $cache, $auth); + $copied_permissions = true; + } +/* Commented out because of questionable UI workflow - re-visit for 3.0.7 + else if (!$this->parent_id && $action != 'edit' && $auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) + { + $this->copy_permission_page($forum_data); + return; + } +*/ + $auth->acl_clear_prefetch(); + + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; + + $message = ($action == 'add') ? $user->lang['FORUM_CREATED'] : $user->lang['FORUM_UPDATED']; + + // redirect directly to permission settings screen if authed + if ($action == 'add' && !$copied_permissions && $auth->acl_get('a_fauth')) + { + $message .= '

' . sprintf($user->lang['REDIRECT_ACL'], '', ''); + + meta_refresh(4, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url)); + } + + trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + } + + break; + } + } + + switch ($action) + { + case 'move_up': + case 'move_down': + + if (!$forum_id) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + $move_forum_name = $this->move_forum_by($row, $action, 1); + + if ($move_forum_name !== false) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_' . strtoupper($action), false, array($row['forum_name'], $move_forum_name)); + $cache->destroy('sql', FORUMS_TABLE); + } + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response; + $json_response->send(array('success' => ($move_forum_name !== false))); + } + + break; + + case 'sync': + if (!$forum_id) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + @set_time_limit(0); + + $sql = 'SELECT forum_name, (forum_topics_approved + forum_topics_unapproved + forum_topics_softdeleted) AS total_topics + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + if ($row['total_topics']) + { + $sql = 'SELECT MIN(topic_id) as min_topic_id, MAX(topic_id) as max_topic_id + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = ' . $forum_id; + $result = $db->sql_query($sql); + $row2 = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Typecast to int if there is no data available + $row2['min_topic_id'] = (int) $row2['min_topic_id']; + $row2['max_topic_id'] = (int) $row2['max_topic_id']; + + $start = $request->variable('start', $row2['min_topic_id']); + + $batch_size = 2000; + $end = $start + $batch_size; + + // Sync all topics in batch mode... + sync('topic', 'range', 'topic_id BETWEEN ' . $start . ' AND ' . $end, true, true); + + if ($end < $row2['max_topic_id']) + { + // We really need to find a way of showing statistics... no progress here + $sql = 'SELECT COUNT(topic_id) as num_topics + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = ' . $forum_id . ' + AND topic_id BETWEEN ' . $start . ' AND ' . $end; + $result = $db->sql_query($sql); + $topics_done = $request->variable('topics_done', 0) + (int) $db->sql_fetchfield('num_topics'); + $db->sql_freeresult($result); + + $start += $batch_size; + + $url = $this->u_action . "&parent_id={$this->parent_id}&f=$forum_id&action=sync&start=$start&topics_done=$topics_done&total={$row['total_topics']}"; + + meta_refresh(0, $url); + + $template->assign_vars(array( + 'U_PROGRESS_BAR' => $this->u_action . "&action=progress_bar&start=$topics_done&total={$row['total_topics']}", + 'UA_PROGRESS_BAR' => addslashes($this->u_action . "&action=progress_bar&start=$topics_done&total={$row['total_topics']}"), + 'S_CONTINUE_SYNC' => true, + 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $topics_done, $row['total_topics'])) + ); + + return; + } + } + + $url = $this->u_action . "&parent_id={$this->parent_id}&f=$forum_id&action=sync_forum"; + meta_refresh(0, $url); + + $template->assign_vars(array( + 'U_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', + 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&action=progress_bar'), + 'S_CONTINUE_SYNC' => true, + 'L_PROGRESS_EXPLAIN' => sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], 0, $row['total_topics'])) + ); + + return; + + break; + + case 'sync_forum': + + $sql = 'SELECT forum_name, forum_type + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + sync('forum', 'forum_id', $forum_id, false, true); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_SYNC', false, array($row['forum_name'])); + + $cache->destroy('sql', FORUMS_TABLE); + + $template->assign_var('L_FORUM_RESYNCED', sprintf($user->lang['FORUM_RESYNCED'], $row['forum_name'])); + + break; + + case 'add': + case 'edit': + + if ($update) + { + $forum_data['forum_flags'] = 0; + $forum_data['forum_flags'] += ($request->variable('forum_link_track', false)) ? FORUM_FLAG_LINK_TRACK : 0; + $forum_data['forum_flags'] += ($request->variable('prune_old_polls', false)) ? FORUM_FLAG_PRUNE_POLL : 0; + $forum_data['forum_flags'] += ($request->variable('prune_announce', false)) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; + $forum_data['forum_flags'] += ($request->variable('prune_sticky', false)) ? FORUM_FLAG_PRUNE_STICKY : 0; + $forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; + $forum_data['forum_flags'] += ($request->variable('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0; + $forum_data['forum_flags'] += ($request->variable('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0; + } + + // Initialise $row, so we always have it in the event + $row = array(); + + // Show form to create/modify a forum + if ($action == 'edit') + { + $this->page_title = 'EDIT_FORUM'; + $row = $this->get_forum_info($forum_id); + $old_forum_type = $row['forum_type']; + + if (!$update) + { + $forum_data = $row; + } + else + { + $forum_data['left_id'] = $row['left_id']; + $forum_data['right_id'] = $row['right_id']; + } + + // Make sure no direct child forums are able to be selected as parents. + $exclude_forums = array(); + foreach (get_forum_branch($forum_id, 'children') as $row) + { + $exclude_forums[] = $row['forum_id']; + } + + $parents_list = make_forum_select($forum_data['parent_id'], $exclude_forums, false, false, false); + + $forum_data['forum_password_confirm'] = $forum_data['forum_password']; + } + else + { + $this->page_title = 'CREATE_FORUM'; + + $forum_id = $this->parent_id; + $parents_list = make_forum_select($this->parent_id, false, false, false, false); + + // Fill forum data with default values + if (!$update) + { + $forum_data = array( + 'parent_id' => $this->parent_id, + 'forum_type' => FORUM_POST, + 'forum_status' => ITEM_UNLOCKED, + 'forum_name' => $request->variable('forum_name', '', true), + 'forum_link' => '', + 'forum_link_track' => false, + 'forum_desc' => '', + 'forum_rules' => '', + 'forum_rules_link' => '', + 'forum_image' => '', + 'forum_style' => 0, + 'display_subforum_list' => true, + 'display_on_index' => false, + 'forum_topics_per_page' => 0, + 'enable_indexing' => true, + 'enable_icons' => false, + 'enable_prune' => false, + 'prune_days' => 7, + 'prune_viewed' => 7, + 'prune_freq' => 1, + 'enable_shadow_prune' => false, + 'prune_shadow_days' => 7, + 'prune_shadow_freq' => 1, + 'forum_flags' => FORUM_FLAG_POST_REVIEW + FORUM_FLAG_ACTIVE_TOPICS, + 'forum_options' => 0, + 'forum_password' => '', + 'forum_password_confirm'=> '', + ); + } + } + + /** + * Initialise data before we display the add/edit form + * + * @event core.acp_manage_forums_initialise_data + * @var string action Type of the action: add|edit + * @var bool update Do we display the form only + * or did the user press submit + * @var int forum_id When editing: the forum id, + * when creating: the parent forum id + * @var array row Array with current forum data + * empty when creating new forum + * @var array forum_data Array with new forum data + * @var string parents_list List of parent options + * @since 3.1.0-a1 + */ + $vars = array('action', 'update', 'forum_id', 'row', 'forum_data', 'parents_list'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_initialise_data', compact($vars))); + + $forum_rules_data = array( + 'text' => $forum_data['forum_rules'], + 'allow_bbcode' => true, + 'allow_smilies' => true, + 'allow_urls' => true + ); + + $forum_desc_data = array( + 'text' => $forum_data['forum_desc'], + 'allow_bbcode' => true, + 'allow_smilies' => true, + 'allow_urls' => true + ); + + $forum_rules_preview = ''; + + // Parse rules if specified + if ($forum_data['forum_rules']) + { + if (!isset($forum_data['forum_rules_uid'])) + { + // Before we are able to display the preview and plane text, we need to parse our $request->variable()'d value... + $forum_data['forum_rules_uid'] = ''; + $forum_data['forum_rules_bitfield'] = ''; + $forum_data['forum_rules_options'] = 0; + + generate_text_for_storage($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options'], $request->variable('rules_allow_bbcode', false), $request->variable('rules_allow_urls', false), $request->variable('rules_allow_smilies', false)); + } + + // Generate preview content + $forum_rules_preview = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']); + + // decode... + $forum_rules_data = generate_text_for_edit($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_options']); + } + + // Parse desciption if specified + if ($forum_data['forum_desc']) + { + if (!isset($forum_data['forum_desc_uid'])) + { + // Before we are able to display the preview and plane text, we need to parse our $request->variable()'d value... + $forum_data['forum_desc_uid'] = ''; + $forum_data['forum_desc_bitfield'] = ''; + $forum_data['forum_desc_options'] = 0; + + generate_text_for_storage($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_bitfield'], $forum_data['forum_desc_options'], $request->variable('desc_allow_bbcode', false), $request->variable('desc_allow_urls', false), $request->variable('desc_allow_smilies', false)); + } + + // decode... + $forum_desc_data = generate_text_for_edit($forum_data['forum_desc'], $forum_data['forum_desc_uid'], $forum_data['forum_desc_options']); + } + + $forum_type_options = ''; + $forum_type_ary = array(FORUM_CAT => 'CAT', FORUM_POST => 'FORUM', FORUM_LINK => 'LINK'); + + foreach ($forum_type_ary as $value => $lang) + { + $forum_type_options .= ''; + } + + $styles_list = style_select($forum_data['forum_style'], true); + + $statuslist = ''; + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST . " + AND forum_id <> $forum_id"; + $result = $db->sql_query_limit($sql, 1); + + $postable_forum_exists = false; + if ($db->sql_fetchrow($result)) + { + $postable_forum_exists = true; + } + $db->sql_freeresult($result); + + // Subforum move options + if ($action == 'edit' && $forum_data['forum_type'] == FORUM_CAT) + { + $subforums_id = array(); + $subforums = get_forum_branch($forum_id, 'children'); + + foreach ($subforums as $row) + { + $subforums_id[] = $row['forum_id']; + } + + $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id); + + if ($postable_forum_exists) + { + $template->assign_vars(array( + 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id)) // , false, true, false??? + ); + } + + $template->assign_vars(array( + 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, + 'S_FORUMS_LIST' => $forums_list) + ); + } + else if ($postable_forum_exists) + { + $template->assign_vars(array( + 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_id, false, true, false)) + ); + } + + $s_show_display_on_index = false; + + if ($forum_data['parent_id'] > 0) + { + // if this forum is a subforum put the "display on index" checkbox + if ($parent_info = $this->get_forum_info($forum_data['parent_id'])) + { + if ($parent_info['parent_id'] > 0 || $parent_info['forum_type'] == FORUM_CAT) + { + $s_show_display_on_index = true; + } + } + } + + if (strlen($forum_data['forum_password']) == 32) + { + $errors[] = $user->lang['FORUM_PASSWORD_OLD']; + } + + $template_data = array( + 'S_EDIT_FORUM' => true, + 'S_ERROR' => (count($errors)) ? true : false, + 'S_PARENT_ID' => $this->parent_id, + 'S_FORUM_PARENT_ID' => $forum_data['parent_id'], + 'S_ADD_ACTION' => ($action == 'add') ? true : false, + + 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, + 'U_EDIT_ACTION' => $this->u_action . "&parent_id={$this->parent_id}&action=$action&f=$forum_id", + + 'L_COPY_PERMISSIONS_EXPLAIN' => $user->lang['COPY_PERMISSIONS_' . strtoupper($action) . '_EXPLAIN'], + 'L_TITLE' => $user->lang[$this->page_title], + 'ERROR_MSG' => (count($errors)) ? implode('
', $errors) : '', + + 'FORUM_NAME' => $forum_data['forum_name'], + 'FORUM_DATA_LINK' => $forum_data['forum_link'], + 'FORUM_IMAGE' => $forum_data['forum_image'], + 'FORUM_IMAGE_SRC' => ($forum_data['forum_image']) ? $phpbb_root_path . $forum_data['forum_image'] : '', + 'FORUM_POST' => FORUM_POST, + 'FORUM_LINK' => FORUM_LINK, + 'FORUM_CAT' => FORUM_CAT, + 'PRUNE_FREQ' => $forum_data['prune_freq'], + 'PRUNE_DAYS' => $forum_data['prune_days'], + 'PRUNE_VIEWED' => $forum_data['prune_viewed'], + 'PRUNE_SHADOW_FREQ' => $forum_data['prune_shadow_freq'], + 'PRUNE_SHADOW_DAYS' => $forum_data['prune_shadow_days'], + 'TOPICS_PER_PAGE' => $forum_data['forum_topics_per_page'], + 'FORUM_RULES_LINK' => $forum_data['forum_rules_link'], + 'FORUM_RULES' => $forum_data['forum_rules'], + 'FORUM_RULES_PREVIEW' => $forum_rules_preview, + 'FORUM_RULES_PLAIN' => $forum_rules_data['text'], + 'S_BBCODE_CHECKED' => ($forum_rules_data['allow_bbcode']) ? true : false, + 'S_SMILIES_CHECKED' => ($forum_rules_data['allow_smilies']) ? true : false, + 'S_URLS_CHECKED' => ($forum_rules_data['allow_urls']) ? true : false, + 'S_FORUM_PASSWORD_SET' => (empty($forum_data['forum_password'])) ? false : true, + + 'FORUM_DESC' => $forum_desc_data['text'], + 'S_DESC_BBCODE_CHECKED' => ($forum_desc_data['allow_bbcode']) ? true : false, + 'S_DESC_SMILIES_CHECKED' => ($forum_desc_data['allow_smilies']) ? true : false, + 'S_DESC_URLS_CHECKED' => ($forum_desc_data['allow_urls']) ? true : false, + + 'S_FORUM_TYPE_OPTIONS' => $forum_type_options, + 'S_STATUS_OPTIONS' => $statuslist, + 'S_PARENT_OPTIONS' => $parents_list, + 'S_STYLES_OPTIONS' => $styles_list, + 'S_FORUM_OPTIONS' => make_forum_select(($action == 'add') ? $forum_data['parent_id'] : false, ($action == 'edit') ? $forum_data['forum_id'] : false, false, false, false), + 'S_SHOW_DISPLAY_ON_INDEX' => $s_show_display_on_index, + 'S_FORUM_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, + 'S_FORUM_ORIG_POST' => (isset($old_forum_type) && $old_forum_type == FORUM_POST) ? true : false, + 'S_FORUM_ORIG_CAT' => (isset($old_forum_type) && $old_forum_type == FORUM_CAT) ? true : false, + 'S_FORUM_ORIG_LINK' => (isset($old_forum_type) && $old_forum_type == FORUM_LINK) ? true : false, + 'S_FORUM_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, + 'S_FORUM_CAT' => ($forum_data['forum_type'] == FORUM_CAT) ? true : false, + 'S_ENABLE_INDEXING' => ($forum_data['enable_indexing']) ? true : false, + 'S_TOPIC_ICONS' => ($forum_data['enable_icons']) ? true : false, + 'S_DISPLAY_SUBFORUM_LIST' => ($forum_data['display_subforum_list']) ? true : false, + 'S_DISPLAY_ON_INDEX' => ($forum_data['display_on_index']) ? true : false, + 'S_PRUNE_ENABLE' => ($forum_data['enable_prune']) ? true : false, + 'S_PRUNE_SHADOW_ENABLE' => ($forum_data['enable_shadow_prune']) ? true : false, + 'S_FORUM_LINK_TRACK' => ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? true : false, + 'S_PRUNE_OLD_POLLS' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_POLL) ? true : false, + 'S_PRUNE_ANNOUNCE' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_ANNOUNCE) ? true : false, + 'S_PRUNE_STICKY' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_STICKY) ? true : false, + 'S_DISPLAY_ACTIVE_TOPICS' => ($forum_data['forum_type'] == FORUM_POST) ? ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) : true, + 'S_ENABLE_ACTIVE_TOPICS' => ($forum_data['forum_type'] == FORUM_CAT) ? ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) : false, + 'S_ENABLE_POST_REVIEW' => ($forum_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) ? true : false, + 'S_ENABLE_QUICK_REPLY' => ($forum_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) ? true : false, + 'S_CAN_COPY_PERMISSIONS' => ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) ? true : false, + ); + + /** + * Modify forum template data before we display the form + * + * @event core.acp_manage_forums_display_form + * @var string action Type of the action: add|edit + * @var bool update Do we display the form only + * or did the user press submit + * @var int forum_id When editing: the forum id, + * when creating: the parent forum id + * @var array row Array with current forum data + * empty when creating new forum + * @var array forum_data Array with new forum data + * @var string parents_list List of parent options + * @var array errors Array of errors, if you add errors + * ensure to update the template variables + * S_ERROR and ERROR_MSG to display it + * @var array template_data Array with new forum data + * @since 3.1.0-a1 + */ + $vars = array( + 'action', + 'update', + 'forum_id', + 'row', + 'forum_data', + 'parents_list', + 'errors', + 'template_data', + ); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_display_form', compact($vars))); + + $template->assign_vars($template_data); + + return; + + break; + + case 'delete': + + if (!$forum_id) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + $forum_data = $this->get_forum_info($forum_id); + + $subforums_id = array(); + $subforums = get_forum_branch($forum_id, 'children'); + + foreach ($subforums as $row) + { + $subforums_id[] = $row['forum_id']; + } + + $forums_list = make_forum_select($forum_data['parent_id'], $subforums_id); + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST . " + AND forum_id <> $forum_id"; + $result = $db->sql_query_limit($sql, 1); + + if ($db->sql_fetchrow($result)) + { + $template->assign_vars(array( + 'S_MOVE_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $subforums_id, false, true)) // , false, true, false??? + ); + } + $db->sql_freeresult($result); + + $parent_id = ($this->parent_id == $forum_id) ? 0 : $this->parent_id; + + $template->assign_vars(array( + 'S_DELETE_FORUM' => true, + 'U_ACTION' => $this->u_action . "&parent_id={$parent_id}&action=delete&f=$forum_id", + 'U_BACK' => $this->u_action . '&parent_id=' . $this->parent_id, + + 'FORUM_NAME' => $forum_data['forum_name'], + 'S_FORUM_POST' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, + 'S_FORUM_LINK' => ($forum_data['forum_type'] == FORUM_LINK) ? true : false, + 'S_HAS_SUBFORUMS' => ($forum_data['right_id'] - $forum_data['left_id'] > 1) ? true : false, + 'S_FORUMS_LIST' => $forums_list, + 'S_ERROR' => (count($errors)) ? true : false, + 'ERROR_MSG' => (count($errors)) ? implode('
', $errors) : '') + ); + + return; + break; + + case 'copy_perm': + $forum_perm_from = $request->variable('forum_perm_from', 0); + + // Copy permissions? + if (!empty($forum_perm_from) && $forum_perm_from != $forum_id) + { + copy_forum_permissions($forum_perm_from, $forum_id, true); + phpbb_cache_moderators($db, $cache, $auth); + $auth->acl_clear_prefetch(); + $cache->destroy('sql', FORUMS_TABLE); + + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_id; + + $message = $user->lang['FORUM_UPDATED']; + + // Redirect to permissions + if ($auth->acl_get('a_fauth')) + { + $message .= '

' . sprintf($user->lang['REDIRECT_ACL'], '', ''); + } + + trigger_error($message . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id)); + } + + break; + } + + // Default management page + if (!$this->parent_id) + { + $navigation = $user->lang['FORUM_INDEX']; + } + else + { + $navigation = '' . $user->lang['FORUM_INDEX'] . ''; + + $forums_nav = get_forum_branch($this->parent_id, 'parents', 'descending'); + foreach ($forums_nav as $row) + { + if ($row['forum_id'] == $this->parent_id) + { + $navigation .= ' -> ' . $row['forum_name']; + } + else + { + $navigation .= ' -> ' . $row['forum_name'] . ''; + } + } + } + + // Jumpbox + $forum_box = make_forum_select($this->parent_id, false, false, false, false); //make_forum_select($this->parent_id); + + if ($action == 'sync' || $action == 'sync_forum') + { + $template->assign_var('S_RESYNCED', true); + } + + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . " + WHERE parent_id = $this->parent_id + ORDER BY left_id"; + $result = $db->sql_query($sql); + + $rowset = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rowset[(int) $row['forum_id']] = $row; + } + $db->sql_freeresult($result); + + /** + * Modify the forum list data + * + * @event core.acp_manage_forums_modify_forum_list + * @var array rowset Array with the forums list data + * @since 3.1.10-RC1 + */ + $vars = array('rowset'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_modify_forum_list', compact($vars))); + + if (!empty($rowset)) + { + foreach ($rowset as $row) + { + $forum_type = $row['forum_type']; + + if ($row['forum_status'] == ITEM_LOCKED) + { + $folder_image = '' . $user->lang['LOCKED'] . ''; + } + else + { + switch ($forum_type) + { + case FORUM_LINK: + $folder_image = '' . $user->lang['LINK'] . ''; + break; + + default: + $folder_image = ($row['left_id'] + 1 != $row['right_id']) ? '' . $user->lang['SUBFORUM'] . '' : '' . $user->lang['FOLDER'] . ''; + break; + } + } + + $url = $this->u_action . "&parent_id=$this->parent_id&f={$row['forum_id']}"; + + $template->assign_block_vars('forums', array( + 'FOLDER_IMAGE' => $folder_image, + 'FORUM_IMAGE' => ($row['forum_image']) ? '' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', + 'FORUM_NAME' => $row['forum_name'], + 'FORUM_DESCRIPTION' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), + 'FORUM_TOPICS' => $row['forum_topics_approved'], + 'FORUM_POSTS' => $row['forum_posts_approved'], + + 'S_FORUM_LINK' => ($forum_type == FORUM_LINK) ? true : false, + 'S_FORUM_POST' => ($forum_type == FORUM_POST) ? true : false, + + 'U_FORUM' => $this->u_action . '&parent_id=' . $row['forum_id'], + 'U_MOVE_UP' => $url . '&action=move_up', + 'U_MOVE_DOWN' => $url . '&action=move_down', + 'U_EDIT' => $url . '&action=edit', + 'U_DELETE' => $url . '&action=delete', + 'U_SYNC' => $url . '&action=sync') + ); + } + } + else if ($this->parent_id) + { + $row = $this->get_forum_info($this->parent_id); + + $url = $this->u_action . '&parent_id=' . $this->parent_id . '&f=' . $row['forum_id']; + + $template->assign_vars(array( + 'S_NO_FORUMS' => true, + + 'U_EDIT' => $url . '&action=edit', + 'U_DELETE' => $url . '&action=delete', + 'U_SYNC' => $url . '&action=sync') + ); + } + unset($rowset); + + $template->assign_vars(array( + 'ERROR_MSG' => (count($errors)) ? implode('
', $errors) : '', + 'NAVIGATION' => $navigation, + 'FORUM_BOX' => $forum_box, + 'U_SEL_ACTION' => $this->u_action, + 'U_ACTION' => $this->u_action . '&parent_id=' . $this->parent_id, + + 'U_PROGRESS_BAR' => $this->u_action . '&action=progress_bar', + 'UA_PROGRESS_BAR' => addslashes($this->u_action . '&action=progress_bar'), + )); + } + + /** + * Get forum details + */ + function get_forum_info($forum_id) + { + global $db; + + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error("Forum #$forum_id does not exist", E_USER_ERROR); + } + + return $row; + } + + /** + * Update forum data + */ + function update_forum_data(&$forum_data_ary) + { + global $db, $user, $cache, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request; + + $errors = array(); + + $forum_data = $forum_data_ary; + /** + * Validate the forum data before we create/update the forum + * + * @event core.acp_manage_forums_validate_data + * @var array forum_data Array with new forum data + * @var array errors Array of errors, should be strings and not + * language key. + * @since 3.1.0-a1 + */ + $vars = array('forum_data', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_validate_data', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); + + if ($forum_data_ary['forum_name'] == '') + { + $errors[] = $user->lang['FORUM_NAME_EMPTY']; + } + + if (utf8_strlen($forum_data_ary['forum_desc']) > 4000) + { + $errors[] = $user->lang['FORUM_DESC_TOO_LONG']; + } + + if (utf8_strlen($forum_data_ary['forum_rules']) > 4000) + { + $errors[] = $user->lang['FORUM_RULES_TOO_LONG']; + } + + if ($forum_data_ary['forum_password'] || $forum_data_ary['forum_password_confirm']) + { + if ($forum_data_ary['forum_password'] != $forum_data_ary['forum_password_confirm']) + { + $forum_data_ary['forum_password'] = $forum_data_ary['forum_password_confirm'] = ''; + $errors[] = $user->lang['FORUM_PASSWORD_MISMATCH']; + } + } + + if ($forum_data_ary['prune_days'] < 0 || $forum_data_ary['prune_viewed'] < 0 || $forum_data_ary['prune_freq'] < 0) + { + $forum_data_ary['prune_days'] = $forum_data_ary['prune_viewed'] = $forum_data_ary['prune_freq'] = 0; + $errors[] = $user->lang['FORUM_DATA_NEGATIVE']; + } + + $range_test_ary = array( + array('lang' => 'FORUM_TOPICS_PAGE', 'value' => $forum_data_ary['forum_topics_per_page'], 'column_type' => 'USINT:0'), + ); + + if (!empty($forum_data_ary['forum_image']) && !file_exists($phpbb_root_path . $forum_data_ary['forum_image'])) + { + $errors[] = $user->lang['FORUM_IMAGE_NO_EXIST']; + } + + validate_range($range_test_ary, $errors); + + // Set forum flags + // 1 = link tracking + // 2 = prune old polls + // 4 = prune announcements + // 8 = prune stickies + // 16 = show active topics + // 32 = enable post review + $forum_data_ary['forum_flags'] = 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['forum_link_track']) ? FORUM_FLAG_LINK_TRACK : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_old_polls']) ? FORUM_FLAG_PRUNE_POLL : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_announce']) ? FORUM_FLAG_PRUNE_ANNOUNCE : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0; + $forum_data_ary['forum_flags'] += ($forum_data_ary['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0; + + // Unset data that are not database fields + $forum_data_sql = $forum_data_ary; + + unset($forum_data_sql['forum_link_track']); + unset($forum_data_sql['prune_old_polls']); + unset($forum_data_sql['prune_announce']); + unset($forum_data_sql['prune_sticky']); + unset($forum_data_sql['show_active']); + unset($forum_data_sql['enable_post_review']); + unset($forum_data_sql['enable_quick_reply']); + unset($forum_data_sql['forum_password_confirm']); + + // What are we going to do tonight Brain? The same thing we do everynight, + // try to take over the world ... or decide whether to continue update + // and if so, whether it's a new forum/cat/link or an existing one + if (count($errors)) + { + return $errors; + } + + // As we don't know the old password, it's kinda tricky to detect changes + if ($forum_data_sql['forum_password_unset']) + { + $forum_data_sql['forum_password'] = ''; + } + else if (empty($forum_data_sql['forum_password'])) + { + unset($forum_data_sql['forum_password']); + } + else + { + // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + + $forum_data_sql['forum_password'] = $passwords_manager->hash($forum_data_sql['forum_password']); + } + unset($forum_data_sql['forum_password_unset']); + + $forum_data = $forum_data_ary; + /** + * Remove invalid values from forum_data_sql that should not be updated + * + * @event core.acp_manage_forums_update_data_before + * @var array forum_data Array with forum data + * @var array forum_data_sql Array with data we are going to update + * If forum_data_sql[forum_id] is set, we update + * that forum, otherwise a new one is created. + * @since 3.1.0-a1 + */ + $vars = array('forum_data', 'forum_data_sql'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_before', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); + + $is_new_forum = !isset($forum_data_sql['forum_id']); + + if ($is_new_forum) + { + // no forum_id means we're creating a new forum + unset($forum_data_sql['type_action']); + + if ($forum_data_sql['parent_id']) + { + $sql = 'SELECT left_id, right_id, forum_type + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_data_sql['parent_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error($user->lang['PARENT_NOT_EXIST'] . adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), E_USER_WARNING); + } + + if ($row['forum_type'] == FORUM_LINK) + { + $errors[] = $user->lang['PARENT_IS_LINK_FORUM']; + return $errors; + } + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET left_id = left_id + 2, right_id = right_id + 2 + WHERE left_id > ' . $row['right_id']; + $db->sql_query($sql); + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET right_id = right_id + 2 + WHERE ' . $row['left_id'] . ' BETWEEN left_id AND right_id'; + $db->sql_query($sql); + + $forum_data_sql['left_id'] = $row['right_id']; + $forum_data_sql['right_id'] = $row['right_id'] + 1; + } + else + { + $sql = 'SELECT MAX(right_id) AS right_id + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $forum_data_sql['left_id'] = $row['right_id'] + 1; + $forum_data_sql['right_id'] = $row['right_id'] + 2; + } + + $sql = 'INSERT INTO ' . FORUMS_TABLE . ' ' . $db->sql_build_array('INSERT', $forum_data_sql); + $db->sql_query($sql); + + $forum_data_ary['forum_id'] = $db->sql_nextid(); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_ADD', false, array($forum_data_ary['forum_name'])); + } + else + { + $row = $this->get_forum_info($forum_data_sql['forum_id']); + + if ($row['forum_type'] == FORUM_POST && $row['forum_type'] != $forum_data_sql['forum_type']) + { + // Has subforums and want to change into a link? + if ($row['right_id'] - $row['left_id'] > 1 && $forum_data_sql['forum_type'] == FORUM_LINK) + { + $errors[] = $user->lang['FORUM_WITH_SUBFORUMS_NOT_TO_LINK']; + return $errors; + } + + // we're turning a postable forum into a non-postable forum + if ($forum_data_sql['type_action'] == 'move') + { + $to_forum_id = $request->variable('to_forum_id', 0); + + if ($to_forum_id) + { + $errors = $this->move_forum_content($forum_data_sql['forum_id'], $to_forum_id); + } + else + { + return array($user->lang['NO_DESTINATION_FORUM']); + } + } + else if ($forum_data_sql['type_action'] == 'delete') + { + $errors = $this->delete_forum_content($forum_data_sql['forum_id']); + } + else + { + return array($user->lang['NO_FORUM_ACTION']); + } + + $forum_data_sql['forum_posts_approved'] = $forum_data_sql['forum_posts_unapproved'] = $forum_data_sql['forum_posts_softdeleted'] = $forum_data_sql['forum_topics_approved'] = $forum_data_sql['forum_topics_unapproved'] = $forum_data_sql['forum_topics_softdeleted'] = 0; + $forum_data_sql['forum_last_post_id'] = $forum_data_sql['forum_last_poster_id'] = $forum_data_sql['forum_last_post_time'] = 0; + $forum_data_sql['forum_last_poster_name'] = $forum_data_sql['forum_last_poster_colour'] = ''; + } + else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_LINK) + { + // Has subforums? + if ($row['right_id'] - $row['left_id'] > 1) + { + // We are turning a category into a link - but need to decide what to do with the subforums. + $action_subforums = $request->variable('action_subforums', ''); + $subforums_to_id = $request->variable('subforums_to_id', 0); + + if ($action_subforums == 'delete') + { + $rows = get_forum_branch($row['forum_id'], 'children', 'descending', false); + + foreach ($rows as $_row) + { + // Do not remove the forum id we are about to change. ;) + if ($_row['forum_id'] == $row['forum_id']) + { + continue; + } + + $forum_ids[] = $_row['forum_id']; + $errors = array_merge($errors, $this->delete_forum_content($_row['forum_id'])); + } + + if (count($errors)) + { + return $errors; + } + + if (count($forum_ids)) + { + $sql = 'DELETE FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + // Delete forum ids from extension groups table + $sql = 'SELECT group_id, allowed_forums + FROM ' . EXTENSION_GROUPS_TABLE; + $result = $db->sql_query($sql); + + while ($_row = $db->sql_fetchrow($result)) + { + if (!$_row['allowed_forums']) + { + continue; + } + + $allowed_forums = unserialize(trim($_row['allowed_forums'])); + $allowed_forums = array_diff($allowed_forums, $forum_ids); + + $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " + SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "' + WHERE group_id = {$_row['group_id']}"; + $db->sql_query($sql); + } + $db->sql_freeresult($result); + + $cache->destroy('_extensions'); + } + } + else if ($action_subforums == 'move') + { + if (!$subforums_to_id) + { + return array($user->lang['NO_DESTINATION_FORUM']); + } + + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $subforums_to_id; + $result = $db->sql_query($sql); + $_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$_row) + { + return array($user->lang['NO_FORUM']); + } + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . " + WHERE parent_id = {$row['forum_id']}"; + $result = $db->sql_query($sql); + + while ($_row = $db->sql_fetchrow($result)) + { + $this->move_forum($_row['forum_id'], $subforums_to_id); + } + $db->sql_freeresult($result); + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET parent_id = $subforums_to_id + WHERE parent_id = {$row['forum_id']}"; + $db->sql_query($sql); + } + + // Adjust the left/right id + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET right_id = left_id + 1 + WHERE forum_id = ' . $row['forum_id']; + $db->sql_query($sql); + } + } + else if ($row['forum_type'] == FORUM_CAT && $forum_data_sql['forum_type'] == FORUM_POST) + { + // Changing a category to a forum? Reset the data (you can't post directly in a cat, you must use a forum) + $forum_data_sql['forum_posts_approved'] = 0; + $forum_data_sql['forum_posts_unapproved'] = 0; + $forum_data_sql['forum_posts_softdeleted'] = 0; + $forum_data_sql['forum_topics_approved'] = 0; + $forum_data_sql['forum_topics_unapproved'] = 0; + $forum_data_sql['forum_topics_softdeleted'] = 0; + $forum_data_sql['forum_last_post_id'] = 0; + $forum_data_sql['forum_last_post_subject'] = ''; + $forum_data_sql['forum_last_post_time'] = 0; + $forum_data_sql['forum_last_poster_id'] = 0; + $forum_data_sql['forum_last_poster_name'] = ''; + $forum_data_sql['forum_last_poster_colour'] = ''; + } + + if (count($errors)) + { + return $errors; + } + + if ($row['parent_id'] != $forum_data_sql['parent_id']) + { + if ($row['forum_id'] != $forum_data_sql['parent_id']) + { + $errors = $this->move_forum($forum_data_sql['forum_id'], $forum_data_sql['parent_id']); + } + else + { + $forum_data_sql['parent_id'] = $row['parent_id']; + } + } + + if (count($errors)) + { + return $errors; + } + + unset($forum_data_sql['type_action']); + + if ($row['forum_name'] != $forum_data_sql['forum_name']) + { + // the forum name has changed, clear the parents list of all forums (for safety) + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET forum_parents = ''"; + $db->sql_query($sql); + } + + // Setting the forum id to the forum id is not really received well by some dbs. ;) + $forum_id = $forum_data_sql['forum_id']; + unset($forum_data_sql['forum_id']); + + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $forum_data_sql) . ' + WHERE forum_id = ' . $forum_id; + $db->sql_query($sql); + + // Add it back + $forum_data_ary['forum_id'] = $forum_id; + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_EDIT', false, array($forum_data_ary['forum_name'])); + } + + $forum_data = $forum_data_ary; + /** + * Event after a forum was updated or created + * + * @event core.acp_manage_forums_update_data_after + * @var array forum_data Array with forum data + * @var array forum_data_sql Array with data we updated + * @var bool is_new_forum Did we create a forum or update one + * If you want to overwrite this value, + * ensure to set forum_data_sql[forum_id] + * @var array errors Array of errors, should be strings and not + * language key. + * @since 3.1.0-a1 + */ + $vars = array('forum_data', 'forum_data_sql', 'is_new_forum', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_update_data_after', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); + + return $errors; + } + + /** + * Move forum + */ + function move_forum($from_id, $to_id) + { + global $db, $user, $phpbb_dispatcher; + + $errors = array(); + + // Check if we want to move to a parent with link type + if ($to_id > 0) + { + $to_data = $this->get_forum_info($to_id); + + if ($to_data['forum_type'] == FORUM_LINK) + { + $errors[] = $user->lang['PARENT_IS_LINK_FORUM']; + } + } + + /** + * Event when we move all children of one forum to another + * + * This event may be triggered, when a forum is deleted + * + * @event core.acp_manage_forums_move_children + * @var int from_id If of the current parent forum + * @var int to_id If of the new parent forum + * @var array errors Array of errors, should be strings and not + * language key. + * @since 3.1.0-a1 + */ + $vars = array('from_id', 'to_id', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_children', compact($vars))); + + // Return if there were errors + if (!empty($errors)) + { + return $errors; + } + + $db->sql_transaction('begin'); + + $moved_forums = get_forum_branch($from_id, 'children', 'descending'); + $from_data = $moved_forums[0]; + $diff = count($moved_forums) * 2; + + $moved_ids = array(); + for ($i = 0, $size = count($moved_forums); $i < $size; ++$i) + { + $moved_ids[] = $moved_forums[$i]['forum_id']; + } + + // Resync parents + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET right_id = right_id - $diff, forum_parents = '' + WHERE left_id < " . $from_data['right_id'] . " + AND right_id > " . $from_data['right_id']; + $db->sql_query($sql); + + // Resync righthand side of tree + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id - $diff, right_id = right_id - $diff, forum_parents = '' + WHERE left_id > " . $from_data['right_id']; + $db->sql_query($sql); + + if ($to_id > 0) + { + // Retrieve $to_data again, it may have been changed... + $to_data = $this->get_forum_info($to_id); + + // Resync new parents + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET right_id = right_id + $diff, forum_parents = '' + WHERE " . $to_data['right_id'] . ' BETWEEN left_id AND right_id + AND ' . $db->sql_in_set('forum_id', $moved_ids, true); + $db->sql_query($sql); + + // Resync the righthand side of the tree + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id + $diff, right_id = right_id + $diff, forum_parents = '' + WHERE left_id > " . $to_data['right_id'] . ' + AND ' . $db->sql_in_set('forum_id', $moved_ids, true); + $db->sql_query($sql); + + // Resync moved branch + $to_data['right_id'] += $diff; + + if ($to_data['right_id'] > $from_data['right_id']) + { + $diff = '+ ' . ($to_data['right_id'] - $from_data['right_id'] - 1); + } + else + { + $diff = '- ' . abs($to_data['right_id'] - $from_data['right_id'] - 1); + } + } + else + { + $sql = 'SELECT MAX(right_id) AS right_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $moved_ids, true); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $diff = '+ ' . ($row['right_id'] - $from_data['left_id'] + 1); + } + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id $diff, right_id = right_id $diff, forum_parents = '' + WHERE " . $db->sql_in_set('forum_id', $moved_ids); + $db->sql_query($sql); + + $db->sql_transaction('commit'); + + return $errors; + } + + /** + * Move forum content from one to another forum + */ + function move_forum_content($from_id, $to_id, $sync = true) + { + global $db, $phpbb_dispatcher; + + $errors = array(); + + /** + * Event when we move content from one forum to another + * + * @event core.acp_manage_forums_move_content + * @var int from_id If of the current parent forum + * @var int to_id If of the new parent forum + * @var bool sync Shall we sync the "to"-forum's data + * @var array errors Array of errors, should be strings and not + * language key. If this array is not empty, + * The content will not be moved. + * @since 3.1.0-a1 + */ + $vars = array('from_id', 'to_id', 'sync', 'errors'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content', compact($vars))); + + // Return if there were errors + if (!empty($errors)) + { + return $errors; + } + + $table_ary = array(LOG_TABLE, POSTS_TABLE, TOPICS_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); + + /** + * Perform additional actions before move forum content + * + * @event core.acp_manage_forums_move_content_sql_before + * @var array table_ary Array of tables from which forum_id will be updated + * @since 3.2.4-RC1 + */ + $vars = array('table_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_manage_forums_move_content_sql_before', compact($vars))); + + foreach ($table_ary as $table) + { + $sql = "UPDATE $table + SET forum_id = $to_id + WHERE forum_id = $from_id"; + $db->sql_query($sql); + } + unset($table_ary); + + $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, MODERATOR_CACHE_TABLE); + + foreach ($table_ary as $table) + { + $sql = "DELETE FROM $table + WHERE forum_id = $from_id"; + $db->sql_query($sql); + } + + if ($sync) + { + // Delete ghost topics that link back to the same forum then resync counters + sync('topic_moved'); + sync('forum', 'forum_id', $to_id, false, true); + } + + return array(); + } + + /** + * Remove complete forum + */ + function delete_forum($forum_id, $action_posts = 'delete', $action_subforums = 'delete', $posts_to_id = 0, $subforums_to_id = 0) + { + global $db, $user, $cache, $phpbb_log; + + $forum_data = $this->get_forum_info($forum_id); + + $errors = array(); + $log_action_posts = $log_action_forums = $posts_to_name = $subforums_to_name = ''; + $forum_ids = array($forum_id); + + if ($action_posts == 'delete') + { + $log_action_posts = 'POSTS'; + $errors = array_merge($errors, $this->delete_forum_content($forum_id)); + } + else if ($action_posts == 'move') + { + if (!$posts_to_id) + { + $errors[] = $user->lang['NO_DESTINATION_FORUM']; + } + else + { + $log_action_posts = 'MOVE_POSTS'; + + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $posts_to_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $errors[] = $user->lang['NO_FORUM']; + } + else + { + $posts_to_name = $row['forum_name']; + $errors = array_merge($errors, $this->move_forum_content($forum_id, $posts_to_id)); + } + } + } + + if (count($errors)) + { + return $errors; + } + + if ($action_subforums == 'delete') + { + $log_action_forums = 'FORUMS'; + $rows = get_forum_branch($forum_id, 'children', 'descending', false); + + foreach ($rows as $row) + { + $forum_ids[] = $row['forum_id']; + $errors = array_merge($errors, $this->delete_forum_content($row['forum_id'])); + } + + if (count($errors)) + { + return $errors; + } + + $diff = count($forum_ids) * 2; + + $sql = 'DELETE FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids); + $db->sql_query($sql); + } + else if ($action_subforums == 'move') + { + if (!$subforums_to_id) + { + $errors[] = $user->lang['NO_DESTINATION_FORUM']; + } + else + { + $log_action_forums = 'MOVE_FORUMS'; + + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $subforums_to_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $errors[] = $user->lang['NO_FORUM']; + } + else + { + $subforums_to_name = $row['forum_name']; + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . " + WHERE parent_id = $forum_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $this->move_forum($row['forum_id'], $subforums_to_id); + } + $db->sql_freeresult($result); + + // Grab new forum data for correct tree updating later + $forum_data = $this->get_forum_info($forum_id); + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET parent_id = $subforums_to_id + WHERE parent_id = $forum_id"; + $db->sql_query($sql); + + $diff = 2; + $sql = 'DELETE FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + } + } + + if (count($errors)) + { + return $errors; + } + } + else + { + $diff = 2; + $sql = 'DELETE FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . " + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + } + + // Resync tree + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET right_id = right_id - $diff + WHERE left_id < {$forum_data['right_id']} AND right_id > {$forum_data['right_id']}"; + $db->sql_query($sql); + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id - $diff, right_id = right_id - $diff + WHERE left_id > {$forum_data['right_id']}"; + $db->sql_query($sql); + + // Delete forum ids from extension groups table + $sql = 'SELECT group_id, allowed_forums + FROM ' . EXTENSION_GROUPS_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$row['allowed_forums']) + { + continue; + } + + $allowed_forums = unserialize(trim($row['allowed_forums'])); + $allowed_forums = array_diff($allowed_forums, $forum_ids); + + $sql = 'UPDATE ' . EXTENSION_GROUPS_TABLE . " + SET allowed_forums = '" . ((count($allowed_forums)) ? serialize($allowed_forums) : '') . "' + WHERE group_id = {$row['group_id']}"; + $db->sql_query($sql); + } + $db->sql_freeresult($result); + + $cache->destroy('_extensions'); + + $log_action = implode('_', array($log_action_posts, $log_action_forums)); + + switch ($log_action) + { + case 'MOVE_POSTS_MOVE_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS', false, array($posts_to_name, $subforums_to_name, $forum_data['forum_name'])); + break; + + case 'MOVE_POSTS_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS', false, array($posts_to_name, $forum_data['forum_name'])); + break; + + case 'POSTS_MOVE_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS', false, array($subforums_to_name, $forum_data['forum_name'])); + break; + + case '_MOVE_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_FORUMS', false, array($subforums_to_name, $forum_data['forum_name'])); + break; + + case 'MOVE_POSTS_': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_MOVE_POSTS', false, array($posts_to_name, $forum_data['forum_name'])); + break; + + case 'POSTS_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS_FORUMS', false, array($forum_data['forum_name'])); + break; + + case '_FORUMS': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_FORUMS', false, array($forum_data['forum_name'])); + break; + + case 'POSTS_': + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_POSTS', false, array($forum_data['forum_name'])); + break; + + default: + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_DEL_FORUM', false, array($forum_data['forum_name'])); + break; + } + + return $errors; + } + + /** + * Delete forum content + */ + function delete_forum_content($forum_id) + { + global $db, $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher; + + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + + $db->sql_transaction('begin'); + + // Select then delete all attachments + $sql = 'SELECT a.topic_id + FROM ' . POSTS_TABLE . ' p, ' . ATTACHMENTS_TABLE . " a + WHERE p.forum_id = $forum_id + AND a.in_message = 0 + AND a.topic_id = p.topic_id"; + $result = $db->sql_query($sql); + + $topic_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('topic', $topic_ids, false); + unset($attachment_manager); + + // Delete shadow topics pointing to topics in this forum + delete_topic_shadows($forum_id); + + // Before we remove anything we make sure we are able to adjust the post counts later. ;) + $sql = 'SELECT poster_id + FROM ' . POSTS_TABLE . ' + WHERE forum_id = ' . $forum_id . ' + AND post_postcount = 1 + AND post_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + + $post_counts = array(); + while ($row = $db->sql_fetchrow($result)) + { + $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1; + } + $db->sql_freeresult($result); + + switch ($db->get_sql_layer()) + { + case 'mysql4': + case 'mysqli': + + // Delete everything else and thank MySQL for offering multi-table deletion + $tables_ary = array( + SEARCH_WORDMATCH_TABLE => 'post_id', + REPORTS_TABLE => 'post_id', + WARNINGS_TABLE => 'post_id', + BOOKMARKS_TABLE => 'topic_id', + TOPICS_WATCH_TABLE => 'topic_id', + TOPICS_POSTED_TABLE => 'topic_id', + POLL_OPTIONS_TABLE => 'topic_id', + POLL_VOTES_TABLE => 'topic_id', + ); + + $sql = 'DELETE ' . POSTS_TABLE; + $sql_using = "\nFROM " . POSTS_TABLE; + $sql_where = "\nWHERE " . POSTS_TABLE . ".forum_id = $forum_id\n"; + + foreach ($tables_ary as $table => $field) + { + $sql .= ", $table "; + $sql_using .= ", $table "; + $sql_where .= "\nAND $table.$field = " . POSTS_TABLE . ".$field"; + } + + $db->sql_query($sql . $sql_using . $sql_where); + + break; + + default: + + // Delete everything else and curse your DB for not offering multi-table deletion + $tables_ary = array( + 'post_id' => array( + SEARCH_WORDMATCH_TABLE, + REPORTS_TABLE, + WARNINGS_TABLE, + ), + + 'topic_id' => array( + BOOKMARKS_TABLE, + TOPICS_WATCH_TABLE, + TOPICS_POSTED_TABLE, + POLL_OPTIONS_TABLE, + POLL_VOTES_TABLE, + ) + ); + + // Amount of rows we select and delete in one iteration. + $batch_size = 500; + + foreach ($tables_ary as $field => $tables) + { + $start = 0; + + do + { + $sql = "SELECT $field + FROM " . POSTS_TABLE . ' + WHERE forum_id = ' . $forum_id; + $result = $db->sql_query_limit($sql, $batch_size, $start); + + $ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $ids[] = $row[$field]; + } + $db->sql_freeresult($result); + + if (count($ids)) + { + $start += count($ids); + + foreach ($tables as $table) + { + $db->sql_query("DELETE FROM $table WHERE " . $db->sql_in_set($field, $ids)); + } + } + } + while (count($ids) == $batch_size); + } + unset($ids); + + break; + } + + $table_ary = array(FORUMS_ACCESS_TABLE, FORUMS_TRACK_TABLE, FORUMS_WATCH_TABLE, LOG_TABLE, MODERATOR_CACHE_TABLE, POSTS_TABLE, TOPICS_TABLE, TOPICS_TRACK_TABLE); + + /** + * Perform additional actions before forum content deletion + * + * @event core.delete_forum_content_before_query + * @var array table_ary Array of tables from which all rows will be deleted that hold the forum_id + * @var int forum_id the forum id + * @var array topic_ids Array of the topic ids from the forum to be deleted + * @var array post_counts Array of counts of posts in the forum, by poster_id + * @since 3.1.6-RC1 + */ + $vars = array( + 'table_ary', + 'forum_id', + 'topic_ids', + 'post_counts', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_forum_content_before_query', compact($vars))); + + foreach ($table_ary as $table) + { + $db->sql_query("DELETE FROM $table WHERE forum_id = $forum_id"); + } + + // Set forum ids to 0 + $table_ary = array(DRAFTS_TABLE); + + foreach ($table_ary as $table) + { + $db->sql_query("UPDATE $table SET forum_id = 0 WHERE forum_id = $forum_id"); + } + + // Adjust users post counts + if (count($post_counts)) + { + foreach ($post_counts as $poster_id => $substract) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = 0 + WHERE user_id = ' . $poster_id . ' + AND user_posts < ' . $substract; + $db->sql_query($sql); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts - ' . $substract . ' + WHERE user_id = ' . $poster_id . ' + AND user_posts >= ' . $substract; + $db->sql_query($sql); + } + } + + $db->sql_transaction('commit'); + + // Make sure the overall post/topic count is correct... + $sql = 'SELECT COUNT(post_id) AS stat + FROM ' . POSTS_TABLE . ' + WHERE post_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_posts', (int) $row['stat'], false); + + $sql = 'SELECT COUNT(topic_id) AS stat + FROM ' . TOPICS_TABLE . ' + WHERE topic_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_topics', (int) $row['stat'], false); + + $sql = 'SELECT COUNT(attach_id) as stat + FROM ' . ATTACHMENTS_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_files', (int) $row['stat'], false); + + $sql = 'SELECT SUM(filesize) as stat + FROM ' . ATTACHMENTS_TABLE; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('upload_dir_size', (float) $row['stat'], false); + + return array(); + } + + /** + * Move forum position by $steps up/down + */ + function move_forum_by($forum_row, $action = 'move_up', $steps = 1) + { + global $db; + + /** + * Fetch all the siblings between the module's current spot + * and where we want to move it to. If there are less than $steps + * siblings between the current spot and the target then the + * module will move as far as possible + */ + $sql = 'SELECT forum_id, forum_name, left_id, right_id + FROM ' . FORUMS_TABLE . " + WHERE parent_id = {$forum_row['parent_id']} + AND " . (($action == 'move_up') ? "right_id < {$forum_row['right_id']} ORDER BY right_id DESC" : "left_id > {$forum_row['left_id']} ORDER BY left_id ASC"); + $result = $db->sql_query_limit($sql, $steps); + + $target = array(); + while ($row = $db->sql_fetchrow($result)) + { + $target = $row; + } + $db->sql_freeresult($result); + + if (!count($target)) + { + // The forum is already on top or bottom + return false; + } + + /** + * $left_id and $right_id define the scope of the nodes that are affected by the move. + * $diff_up and $diff_down are the values to substract or add to each node's left_id + * and right_id in order to move them up or down. + * $move_up_left and $move_up_right define the scope of the nodes that are moving + * up. Other nodes in the scope of ($left_id, $right_id) are considered to move down. + */ + if ($action == 'move_up') + { + $left_id = $target['left_id']; + $right_id = $forum_row['right_id']; + + $diff_up = $forum_row['left_id'] - $target['left_id']; + $diff_down = $forum_row['right_id'] + 1 - $forum_row['left_id']; + + $move_up_left = $forum_row['left_id']; + $move_up_right = $forum_row['right_id']; + } + else + { + $left_id = $forum_row['left_id']; + $right_id = $target['right_id']; + + $diff_up = $forum_row['right_id'] + 1 - $forum_row['left_id']; + $diff_down = $target['right_id'] - $forum_row['right_id']; + + $move_up_left = $forum_row['right_id'] + 1; + $move_up_right = $target['right_id']; + } + + // Now do the dirty job + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET left_id = left_id + CASE + WHEN left_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} + ELSE {$diff_down} + END, + right_id = right_id + CASE + WHEN right_id BETWEEN {$move_up_left} AND {$move_up_right} THEN -{$diff_up} + ELSE {$diff_down} + END, + forum_parents = '' + WHERE + left_id BETWEEN {$left_id} AND {$right_id} + AND right_id BETWEEN {$left_id} AND {$right_id}"; + $db->sql_query($sql); + + return $target['forum_name']; + } + + /** + * Display progress bar for syncinc forums + */ + function display_progress_bar($start, $total) + { + global $template, $user; + + adm_page_header($user->lang['SYNC_IN_PROGRESS']); + + $template->set_filenames(array( + 'body' => 'progress_bar.html') + ); + + $template->assign_vars(array( + 'L_PROGRESS' => $user->lang['SYNC_IN_PROGRESS'], + 'L_PROGRESS_EXPLAIN' => ($start && $total) ? sprintf($user->lang['SYNC_IN_PROGRESS_EXPLAIN'], $start, $total) : $user->lang['SYNC_IN_PROGRESS']) + ); + + adm_page_footer(); + } + + /** + * Display copy permission page + * Not used at the moment - we will have a look at it for 3.0.7 + */ + function copy_permission_page($forum_data) + { + global $phpEx, $phpbb_admin_path, $template, $user; + + $acl_url = '&mode=setting_forum_local&forum_id[]=' . $forum_data['forum_id']; + $action = append_sid($this->u_action . "&parent_id={$this->parent_id}&f={$forum_data['forum_id']}&action=copy_perm"); + + $l_acl = sprintf($user->lang['COPY_TO_ACL'], '', ''); + + $this->tpl_name = 'acp_forums_copy_perm'; + + $template->assign_vars(array( + 'U_ACL' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions' . $acl_url), + 'L_ACL_LINK' => $l_acl, + 'L_BACK_LINK' => adm_back_link($this->u_action . '&parent_id=' . $this->parent_id), + 'S_COPY_ACTION' => $action, + 'S_FORUM_OPTIONS' => make_forum_select($forum_data['parent_id'], $forum_data['forum_id'], false, false, false), + )); + } + +} diff --git a/install/update/old/includes/acp/acp_help_phpbb.php b/install/update/old/includes/acp/acp_help_phpbb.php new file mode 100644 index 0000000..a36b36e --- /dev/null +++ b/install/update/old/includes/acp/acp_help_phpbb.php @@ -0,0 +1,143 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_help_phpbb +{ + var $u_action; + + function main($id, $mode) + { + global $config, $request, $template, $user, $phpbb_dispatcher, $phpbb_admin_path, $phpbb_root_path, $phpEx; + + if (!class_exists('phpbb_questionnaire_data_collector')) + { + include($phpbb_root_path . 'includes/questionnaire/questionnaire.' . $phpEx); + } + + $collect_url = "https://www.phpbb.com/stats/receive_stats.php"; + + $this->tpl_name = 'acp_help_phpbb'; + $this->page_title = 'ACP_HELP_PHPBB'; + + $submit = ($request->is_set_post('submit')) ? true : false; + + $form_key = 'acp_help_phpbb'; + add_form_key($form_key); + $error = array(); + + if ($submit && !check_form_key($form_key)) + { + $error[] = $user->lang['FORM_INVALID']; + } + // Do not write values if there is an error + if (count($error)) + { + $submit = false; + } + + // generate a unique id if necessary + if (!isset($config['questionnaire_unique_id'])) + { + $install_id = unique_id(); + $config->set('questionnaire_unique_id', $install_id); + } + else + { + $install_id = $config['questionnaire_unique_id']; + } + + $collector = new phpbb_questionnaire_data_collector($install_id); + + // Add data provider + $collector->add_data_provider(new phpbb_questionnaire_php_data_provider()); + $collector->add_data_provider(new phpbb_questionnaire_system_data_provider()); + $collector->add_data_provider(new phpbb_questionnaire_phpbb_data_provider($config)); + + /** + * Event to modify ACP help phpBB page and/or listen to submit + * + * @event core.acp_help_phpbb_submit_before + * @var boolean submit Do we display the form or process the submission + * @since 3.2.0-RC2 + */ + $vars = array('submit'); + extract($phpbb_dispatcher->trigger_event('core.acp_help_phpbb_submit_before', compact($vars))); + + if ($submit) + { + $config->set('help_send_statistics', $request->variable('help_send_statistics', false)); + $response = $request->variable('send_statistics_response', ''); + + $config->set('help_send_statistics_time', time()); + + if (!empty($response)) + { + if ((strpos($response, 'Thank you') !== false || strpos($response, 'Flood protection') !== false)) + { + trigger_error($user->lang('THANKS_SEND_STATISTICS') . adm_back_link($this->u_action)); + } + else + { + trigger_error($user->lang('FAIL_SEND_STATISTICS') . adm_back_link($this->u_action)); + } + } + + trigger_error($user->lang('CONFIG_UPDATED') . adm_back_link($this->u_action)); + } + + $template->assign_vars(array( + 'U_COLLECT_STATS' => $collect_url, + 'S_COLLECT_STATS' => (!empty($config['help_send_statistics'])) ? true : false, + 'RAW_DATA' => $collector->get_data_for_form(), + 'U_ACP_MAIN' => append_sid("{$phpbb_admin_path}index.$phpEx"), + 'U_ACTION' => $this->u_action, + // Pass earliest time we should try to send stats again + 'COLLECT_STATS_TIME' => intval($config['help_send_statistics_time']) + 86400, + )); + + $raw = $collector->get_data_raw(); + + foreach ($raw as $provider => $data) + { + if ($provider == 'install_id') + { + $data = array($provider => $data); + } + + $template->assign_block_vars('providers', array( + 'NAME' => htmlspecialchars($provider), + )); + + foreach ($data as $key => $value) + { + if (is_array($value)) + { + $value = utf8_wordwrap(serialize($value), 75, "\n", true); + } + + $template->assign_block_vars('providers.values', array( + 'KEY' => utf8_htmlspecialchars($key), + 'VALUE' => utf8_htmlspecialchars($value), + )); + } + } + } +} diff --git a/install/update/old/includes/acp/acp_main.php b/install/update/old/includes/acp/acp_main.php new file mode 100644 index 0000000..8f169d1 --- /dev/null +++ b/install/update/old/includes/acp/acp_main.php @@ -0,0 +1,707 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_main +{ + var $u_action; + + function main($id, $mode) + { + global $config, $db, $cache, $user, $auth, $template, $request, $phpbb_log; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container, $phpbb_dispatcher, $phpbb_filesystem; + + // Show restore permissions notice + if ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) + { + $this->tpl_name = 'acp_main'; + $this->page_title = 'ACP_MAIN'; + + $sql = 'SELECT user_id, username, user_colour + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user->data['user_perm_from']; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $perm_from = get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']); + + $template->assign_vars(array( + 'S_RESTORE_PERMISSIONS' => true, + 'U_RESTORE_PERMISSIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm'), + 'PERM_FROM' => $perm_from, + 'L_PERMISSIONS_TRANSFERRED_EXPLAIN' => sprintf($user->lang['PERMISSIONS_TRANSFERRED_EXPLAIN'], $perm_from, append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm')), + )); + + return; + } + + $action = $request->variable('action', ''); + + if ($action) + { + if ($action === 'admlogout') + { + $user->unset_admin(); + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + if (!confirm_box(true)) + { + switch ($action) + { + case 'online': + $confirm = true; + $confirm_lang = 'RESET_ONLINE_CONFIRM'; + break; + case 'stats': + $confirm = true; + $confirm_lang = 'RESYNC_STATS_CONFIRM'; + break; + case 'user': + $confirm = true; + $confirm_lang = 'RESYNC_POSTCOUNTS_CONFIRM'; + break; + case 'date': + $confirm = true; + $confirm_lang = 'RESET_DATE_CONFIRM'; + break; + case 'db_track': + $confirm = true; + $confirm_lang = 'RESYNC_POST_MARKING_CONFIRM'; + break; + case 'purge_cache': + $confirm = true; + $confirm_lang = 'PURGE_CACHE_CONFIRM'; + break; + case 'purge_sessions': + $confirm = true; + $confirm_lang = 'PURGE_SESSIONS_CONFIRM'; + break; + + default: + $confirm = true; + $confirm_lang = 'CONFIRM_OPERATION'; + } + + if ($confirm) + { + confirm_box(false, $user->lang[$confirm_lang], build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + ))); + } + } + else + { + switch ($action) + { + + case 'online': + if (!$auth->acl_get('a_board')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $config->set('record_online_users', 1, false); + $config->set('record_online_date', time(), false); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_ONLINE'); + + if ($request->is_ajax()) + { + trigger_error('RESET_ONLINE_SUCCESS'); + } + break; + + case 'stats': + if (!$auth->acl_get('a_board')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql = 'SELECT COUNT(post_id) AS stat + FROM ' . POSTS_TABLE . ' + WHERE post_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $config->set('num_posts', (int) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + $sql = 'SELECT COUNT(topic_id) AS stat + FROM ' . TOPICS_TABLE . ' + WHERE topic_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $config->set('num_topics', (int) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + $sql = 'SELECT COUNT(user_id) AS stat + FROM ' . USERS_TABLE . ' + WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')'; + $result = $db->sql_query($sql); + $config->set('num_users', (int) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + $sql = 'SELECT COUNT(attach_id) as stat + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 0'; + $result = $db->sql_query($sql); + $config->set('num_files', (int) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + $sql = 'SELECT SUM(filesize) as stat + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 0'; + $result = $db->sql_query($sql); + $config->set('upload_dir_size', (float) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + if (!function_exists('update_last_username')) + { + include($phpbb_root_path . "includes/functions_user.$phpEx"); + } + update_last_username(); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_STATS'); + + if ($request->is_ajax()) + { + trigger_error('RESYNC_STATS_SUCCESS'); + } + break; + + case 'user': + if (!$auth->acl_get('a_board')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Resync post counts + $start = $max_post_id = 0; + + // Find the maximum post ID, we can only stop the cycle when we've reached it + $sql = 'SELECT MAX(forum_last_post_id) as max_post_id + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + $max_post_id = (int) $db->sql_fetchfield('max_post_id'); + $db->sql_freeresult($result); + + // No maximum post id? :o + if (!$max_post_id) + { + $sql = 'SELECT MAX(post_id) as max_post_id + FROM ' . POSTS_TABLE; + $result = $db->sql_query($sql); + $max_post_id = (int) $db->sql_fetchfield('max_post_id'); + $db->sql_freeresult($result); + } + + // Still no maximum post id? Then we are finished + if (!$max_post_id) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POSTCOUNTS'); + break; + } + + $step = ($config['num_posts']) ? (max((int) ($config['num_posts'] / 5), 20000)) : 20000; + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_posts = 0'); + + while ($start < $max_post_id) + { + $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id + FROM ' . POSTS_TABLE . ' + WHERE post_id BETWEEN ' . ($start + 1) . ' AND ' . ($start + $step) . ' + AND post_postcount = 1 AND post_visibility = ' . ITEM_APPROVED . ' + GROUP BY poster_id'; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $sql = 'UPDATE ' . USERS_TABLE . " SET user_posts = user_posts + {$row['num_posts']} WHERE user_id = {$row['poster_id']}"; + $db->sql_query($sql); + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + $start += $step; + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POSTCOUNTS'); + + if ($request->is_ajax()) + { + trigger_error('RESYNC_POSTCOUNTS_SUCCESS'); + } + break; + + case 'date': + if (!$auth->acl_get('a_board')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $config->set('board_startdate', time() - 1); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESET_DATE'); + + if ($request->is_ajax()) + { + trigger_error('RESET_DATE_SUCCESS'); + } + break; + + case 'db_track': + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); + break; + + default: + $db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE); + break; + } + + // This can get really nasty... therefore we only do the last six months + $get_from_time = time() - (6 * 4 * 7 * 24 * 60 * 60); + + // Select forum ids, do not include categories + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type <> ' . FORUM_CAT; + $result = $db->sql_query($sql); + + $forum_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + // Any global announcements? ;) + $forum_ids[] = 0; + + // Now go through the forums and get us some topics... + foreach ($forum_ids as $forum_id) + { + $sql = 'SELECT p.poster_id, p.topic_id + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t + WHERE t.forum_id = ' . $forum_id . ' + AND t.topic_moved_id = 0 + AND t.topic_last_post_time > ' . $get_from_time . ' + AND t.topic_id = p.topic_id + AND p.poster_id <> ' . ANONYMOUS . ' + GROUP BY p.poster_id, p.topic_id'; + $result = $db->sql_query($sql); + + $posted = array(); + while ($row = $db->sql_fetchrow($result)) + { + $posted[$row['poster_id']][] = $row['topic_id']; + } + $db->sql_freeresult($result); + + $sql_ary = array(); + foreach ($posted as $user_id => $topic_row) + { + foreach ($topic_row as $topic_id) + { + $sql_ary[] = array( + 'user_id' => (int) $user_id, + 'topic_id' => (int) $topic_id, + 'topic_posted' => 1, + ); + } + } + unset($posted); + + if (count($sql_ary)) + { + $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); + } + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_RESYNC_POST_MARKING'); + + if ($request->is_ajax()) + { + trigger_error('RESYNC_POST_MARKING_SUCCESS'); + } + break; + + case 'purge_cache': + $config->increment('assets_version', 1); + $cache->purge(); + + // Remove old renderers from the text_formatter service. Since this + // operation is performed after the cache is purged, there is not "current" + // renderer and in effect all renderers will be purged + $phpbb_container->get('text_formatter.cache')->tidy(); + + // Clear permissions + $auth->acl_clear_prefetch(); + phpbb_cache_moderators($db, $cache, $auth); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PURGE_CACHE'); + + if ($request->is_ajax()) + { + trigger_error('PURGE_CACHE_SUCCESS'); + } + break; + + case 'purge_sessions': + if ((int) $user->data['user_type'] !== USER_FOUNDER) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $tables = array(CONFIRM_TABLE, SESSIONS_TABLE); + + foreach ($tables as $table) + { + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $db->sql_query("DELETE FROM $table"); + break; + + default: + $db->sql_query("TRUNCATE TABLE $table"); + break; + } + } + + // let's restore the admin session + $reinsert_ary = array( + 'session_id' => (string) $user->session_id, + 'session_page' => (string) substr($user->page['page'], 0, 199), + 'session_forum_id' => $user->page['forum'], + 'session_user_id' => (int) $user->data['user_id'], + 'session_start' => (int) $user->data['session_start'], + 'session_last_visit' => (int) $user->data['session_last_visit'], + 'session_time' => (int) $user->time_now, + 'session_browser' => (string) trim(substr($user->browser, 0, 149)), + 'session_forwarded_for' => (string) $user->forwarded_for, + 'session_ip' => (string) $user->ip, + 'session_autologin' => (int) $user->data['session_autologin'], + 'session_admin' => 1, + 'session_viewonline' => (int) $user->data['session_viewonline'], + ); + + $sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $reinsert_ary); + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PURGE_SESSIONS'); + + if ($request->is_ajax()) + { + trigger_error('PURGE_SESSIONS_SUCCESS'); + } + break; + } + } + } + + // Version check + $user->add_lang('install'); + + if ($auth->acl_get('a_server') && version_compare(PHP_VERSION, '5.4.0', '<')) + { + $template->assign_vars(array( + 'S_PHP_VERSION_OLD' => true, + 'L_PHP_VERSION_OLD' => sprintf($user->lang['PHP_VERSION_OLD'], PHP_VERSION, '5.4.0', '', ''), + )); + } + + if ($auth->acl_get('a_board')) + { + $version_helper = $phpbb_container->get('version_helper'); + try + { + $recheck = $request->variable('versioncheck_force', false); + $updates_available = $version_helper->get_update_on_branch($recheck); + $upgrades_available = $version_helper->get_suggested_updates(); + if (!empty($upgrades_available)) + { + $upgrades_available = array_pop($upgrades_available); + } + + $template->assign_vars(array( + 'S_VERSION_UP_TO_DATE' => empty($updates_available), + 'S_VERSION_UPGRADEABLE' => !empty($upgrades_available), + 'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false, + )); + } + catch (\RuntimeException $e) + { + $message = call_user_func_array(array($user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $template->assign_vars(array( + 'S_VERSIONCHECK_FAIL' => true, + 'VERSIONCHECK_FAIL_REASON' => ($e->getMessage() !== 'VERSIONCHECK_FAIL') ? $message : '', + )); + } + } + else + { + // We set this template var to true, to not display an outdated version notice. + $template->assign_var('S_VERSION_UP_TO_DATE', true); + } + + // Incomplete update? + if (phpbb_version_compare($config['version'], PHPBB_VERSION, '<')) + { + $template->assign_var('S_UPDATE_INCOMPLETE', true); + } + + /** + * Notice admin + * + * @event core.acp_main_notice + * @since 3.1.0-RC3 + */ + $phpbb_dispatcher->dispatch('core.acp_main_notice'); + + // Get forum statistics + $total_posts = $config['num_posts']; + $total_topics = $config['num_topics']; + $total_users = $config['num_users']; + $total_files = $config['num_files']; + + $start_date = $user->format_date($config['board_startdate']); + + $boarddays = (time() - $config['board_startdate']) / 86400; + + $posts_per_day = sprintf('%.2f', $total_posts / $boarddays); + $topics_per_day = sprintf('%.2f', $total_topics / $boarddays); + $users_per_day = sprintf('%.2f', $total_users / $boarddays); + $files_per_day = sprintf('%.2f', $total_files / $boarddays); + + $upload_dir_size = get_formatted_filesize($config['upload_dir_size']); + + $avatar_dir_size = 0; + + if ($avatar_dir = @opendir($phpbb_root_path . $config['avatar_path'])) + { + while (($file = readdir($avatar_dir)) !== false) + { + if ($file[0] != '.' && $file != 'CVS' && strpos($file, 'index.') === false) + { + $avatar_dir_size += filesize($phpbb_root_path . $config['avatar_path'] . '/' . $file); + } + } + closedir($avatar_dir); + + $avatar_dir_size = get_formatted_filesize($avatar_dir_size); + } + else + { + // Couldn't open Avatar dir. + $avatar_dir_size = $user->lang['NOT_AVAILABLE']; + } + + if ($posts_per_day > $total_posts) + { + $posts_per_day = $total_posts; + } + + if ($topics_per_day > $total_topics) + { + $topics_per_day = $total_topics; + } + + if ($users_per_day > $total_users) + { + $users_per_day = $total_users; + } + + if ($files_per_day > $total_files) + { + $files_per_day = $total_files; + } + + if ($config['allow_attachments'] || $config['allow_pm_attach']) + { + $sql = 'SELECT COUNT(attach_id) AS total_orphan + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 1 + AND filetime < ' . (time() - 3*60*60); + $result = $db->sql_query($sql); + $total_orphan = (int) $db->sql_fetchfield('total_orphan'); + $db->sql_freeresult($result); + } + else + { + $total_orphan = false; + } + + $dbsize = get_database_size(); + + $template->assign_vars(array( + 'TOTAL_POSTS' => $total_posts, + 'POSTS_PER_DAY' => $posts_per_day, + 'TOTAL_TOPICS' => $total_topics, + 'TOPICS_PER_DAY' => $topics_per_day, + 'TOTAL_USERS' => $total_users, + 'USERS_PER_DAY' => $users_per_day, + 'TOTAL_FILES' => $total_files, + 'FILES_PER_DAY' => $files_per_day, + 'START_DATE' => $start_date, + 'AVATAR_DIR_SIZE' => $avatar_dir_size, + 'DBSIZE' => $dbsize, + 'UPLOAD_DIR_SIZE' => $upload_dir_size, + 'TOTAL_ORPHAN' => $total_orphan, + 'S_TOTAL_ORPHAN' => ($total_orphan === false) ? false : true, + 'GZIP_COMPRESSION' => ($config['gzip_compress'] && @extension_loaded('zlib')) ? $user->lang['ON'] : $user->lang['OFF'], + 'DATABASE_INFO' => $db->sql_server_info(), + 'PHP_VERSION_INFO' => PHP_VERSION, + 'BOARD_VERSION' => $config['version'], + + 'U_ACTION' => $this->u_action, + 'U_ADMIN_LOG' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=logs&mode=admin'), + 'U_INACTIVE_USERS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=inactive&mode=list'), + 'U_VERSIONCHECK' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=update&mode=version_check'), + 'U_VERSIONCHECK_FORCE' => append_sid("{$phpbb_admin_path}index.$phpEx", 'versioncheck_force=1'), + 'U_ATTACH_ORPHAN' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=acp_attachments&mode=orphan'), + + 'S_VERSIONCHECK' => ($auth->acl_get('a_board')) ? true : false, + 'S_ACTION_OPTIONS' => ($auth->acl_get('a_board')) ? true : false, + 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, + ) + ); + + $log_data = array(); + $log_count = false; + + if ($auth->acl_get('a_viewlogs')) + { + view_log('admin', $log_data, $log_count, 5); + + foreach ($log_data as $row) + { + $template->assign_block_vars('log', array( + 'USERNAME' => $row['username_full'], + 'IP' => $row['ip'], + 'DATE' => $user->format_date($row['time']), + 'ACTION' => $row['action']) + ); + } + } + + if ($auth->acl_get('a_user')) + { + $user->add_lang('memberlist'); + + $inactive = array(); + $inactive_count = 0; + + view_inactive_users($inactive, $inactive_count, 10); + + foreach ($inactive as $row) + { + $template->assign_block_vars('inactive', array( + 'INACTIVE_DATE' => $user->format_date($row['user_inactive_time']), + 'REMINDED_DATE' => $user->format_date($row['user_reminded_time']), + 'JOINED' => $user->format_date($row['user_regdate']), + 'LAST_VISIT' => (!$row['user_lastvisit']) ? ' - ' : $user->format_date($row['user_lastvisit']), + + 'REASON' => $row['inactive_reason'], + 'USER_ID' => $row['user_id'], + 'POSTS' => ($row['user_posts']) ? $row['user_posts'] : 0, + 'REMINDED' => $row['user_reminded'], + + 'REMINDED_EXPLAIN' => $user->lang('USER_LAST_REMINDED', (int) $row['user_reminded'], $user->format_date($row['user_reminded_time'])), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'], false, append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview')), + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), + 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + + 'U_USER_ADMIN' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=users&mode=overview&u={$row['user_id']}"), + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$row['user_id']}&sr=posts") : '', + )); + } + + $option_ary = array('activate' => 'ACTIVATE', 'delete' => 'DELETE'); + if ($config['email_enable']) + { + $option_ary += array('remind' => 'REMIND'); + } + + $template->assign_vars(array( + 'S_INACTIVE_USERS' => true, + 'S_INACTIVE_OPTIONS' => build_select($option_ary)) + ); + } + + // Warn if install is still present + if (file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install')) + { + $template->assign_var('S_REMOVE_INSTALL', true); + } + + // Warn if no search index is created + if ($config['num_posts'] && class_exists($config['search_type'])) + { + $error = false; + $search_type = $config['search_type']; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if (!$search->index_created()) + { + $template->assign_vars(array( + 'S_SEARCH_INDEX_MISSING' => true, + 'L_NO_SEARCH_INDEX' => $user->lang('NO_SEARCH_INDEX', $search->get_name(), '', ''), + )); + } + } + + if (!defined('PHPBB_DISABLE_CONFIG_CHECK') && file_exists($phpbb_root_path . 'config.' . $phpEx) && $phpbb_filesystem->is_writable($phpbb_root_path . 'config.' . $phpEx)) + { + // World-Writable? (000x) + $template->assign_var('S_WRITABLE_CONFIG', (bool) (@fileperms($phpbb_root_path . 'config.' . $phpEx) & 0x0002)); + } + + if (extension_loaded('mbstring')) + { + $template->assign_vars(array( + 'S_MBSTRING_LOADED' => true, + 'S_MBSTRING_FUNC_OVERLOAD_FAIL' => (intval(@ini_get('mbstring.func_overload')) & (MB_OVERLOAD_MAIL | MB_OVERLOAD_STRING)), + 'S_MBSTRING_ENCODING_TRANSLATION_FAIL' => (@ini_get('mbstring.encoding_translation') != 0), + 'S_MBSTRING_HTTP_INPUT_FAIL' => !in_array(@ini_get('mbstring.http_input'), array('pass', '')), + 'S_MBSTRING_HTTP_OUTPUT_FAIL' => !in_array(@ini_get('mbstring.http_output'), array('pass', '')), + )); + } + + // Fill dbms version if not yet filled + if (empty($config['dbms_version'])) + { + $config->set('dbms_version', $db->sql_server_info(true)); + } + + $this->tpl_name = 'acp_main'; + $this->page_title = 'ACP_MAIN'; + } +} diff --git a/install/update/old/includes/acp/acp_permissions.php b/install/update/old/includes/acp/acp_permissions.php new file mode 100644 index 0000000..e683b19 --- /dev/null +++ b/install/update/old/includes/acp/acp_permissions.php @@ -0,0 +1,1346 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_permissions +{ + var $u_action; + var $permission_dropdown; + + /** + * @var $phpbb_permissions \phpbb\permissions + */ + protected $permissions; + + function main($id, $mode) + { + global $db, $user, $auth, $template, $phpbb_container, $request; + global $config, $phpbb_root_path, $phpEx; + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + if (!class_exists('auth_admin')) + { + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + } + + $this->permissions = $phpbb_container->get('acl.permissions'); + + $auth_admin = new auth_admin(); + + $user->add_lang('acp/permissions'); + add_permission_language(); + + $this->tpl_name = 'acp_permissions'; + + // Trace has other vars + if ($mode == 'trace') + { + $user_id = $request->variable('u', 0); + $forum_id = $request->variable('f', 0); + $permission = $request->variable('auth', ''); + + $this->tpl_name = 'permission_trace'; + + if ($user_id && isset($auth_admin->acl_options['id'][$permission]) && $auth->acl_get('a_viewauth')) + { + $this->page_title = sprintf($user->lang['TRACE_PERMISSION'], $this->permissions->get_permission_lang($permission)); + $this->permission_trace($user_id, $forum_id, $permission); + return; + } + trigger_error('NO_MODE', E_USER_ERROR); + } + + // Copy forum permissions + if ($mode == 'setting_forum_copy') + { + $this->tpl_name = 'permission_forum_copy'; + + if ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth')) + { + $this->page_title = 'ACP_FORUM_PERMISSIONS_COPY'; + $this->copy_forum_permissions(); + return; + } + + trigger_error('NO_MODE', E_USER_ERROR); + } + + // Set some vars + $action = $request->variable('action', array('' => 0)); + $action = key($action); + $action = (isset($_POST['psubmit'])) ? 'apply_permissions' : $action; + + $all_forums = $request->variable('all_forums', 0); + $subforum_id = $request->variable('subforum_id', 0); + $forum_id = $request->variable('forum_id', array(0)); + + $username = $request->variable('username', array(''), true); + $usernames = $request->variable('usernames', '', true); + $user_id = $request->variable('user_id', array(0)); + + $group_id = $request->variable('group_id', array(0)); + $select_all_groups = $request->variable('select_all_groups', 0); + + $form_name = 'acp_permissions'; + add_form_key($form_name); + + // If select all groups is set, we pre-build the group id array (this option is used for other screens to link to the permission settings screen) + if ($select_all_groups) + { + // Add default groups to selection + $sql_and = (!$config['coppa_enable']) ? " AND group_name <> 'REGISTERED_COPPA'" : ''; + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . ' + WHERE group_type = ' . GROUP_SPECIAL . " + $sql_and"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $group_id[] = $row['group_id']; + } + $db->sql_freeresult($result); + } + + // Map usernames to ids and vice versa + if ($usernames) + { + $username = explode("\n", $usernames); + } + unset($usernames); + + if (count($username) && !count($user_id)) + { + user_get_id_name($user_id, $username); + + if (!count($user_id)) + { + trigger_error($user->lang['SELECTED_USER_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + unset($username); + + // Build forum ids (of all forums are checked or subforum listing used) + if ($all_forums) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id'; + $result = $db->sql_query($sql); + + $forum_id = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_id[] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + } + else if ($subforum_id) + { + $forum_id = array(); + foreach (get_forum_branch($subforum_id, 'children') as $row) + { + $forum_id[] = (int) $row['forum_id']; + } + } + + // Define some common variables for every mode + $permission_scope = (strpos($mode, '_global') !== false) ? 'global' : 'local'; + + // Showing introductionary page? + if ($mode == 'intro') + { + $this->page_title = 'ACP_PERMISSIONS'; + + $template->assign_vars(array( + 'S_INTRO' => true) + ); + + return; + } + + switch ($mode) + { + case 'setting_user_global': + case 'setting_group_global': + $this->permission_dropdown = array('u_', 'm_', 'a_'); + $permission_victim = ($mode == 'setting_user_global') ? array('user') : array('group'); + $this->page_title = ($mode == 'setting_user_global') ? 'ACP_USERS_PERMISSIONS' : 'ACP_GROUPS_PERMISSIONS'; + break; + + case 'setting_user_local': + case 'setting_group_local': + $this->permission_dropdown = array('f_', 'm_'); + $permission_victim = ($mode == 'setting_user_local') ? array('user', 'forums') : array('group', 'forums'); + $this->page_title = ($mode == 'setting_user_local') ? 'ACP_USERS_FORUM_PERMISSIONS' : 'ACP_GROUPS_FORUM_PERMISSIONS'; + break; + + case 'setting_admin_global': + case 'setting_mod_global': + $this->permission_dropdown = (strpos($mode, '_admin_') !== false) ? array('a_') : array('m_'); + $permission_victim = array('usergroup'); + $this->page_title = ($mode == 'setting_admin_global') ? 'ACP_ADMINISTRATORS' : 'ACP_GLOBAL_MODERATORS'; + break; + + case 'setting_mod_local': + case 'setting_forum_local': + $this->permission_dropdown = ($mode == 'setting_mod_local') ? array('m_') : array('f_'); + $permission_victim = array('forums', 'usergroup'); + $this->page_title = ($mode == 'setting_mod_local') ? 'ACP_FORUM_MODERATORS' : 'ACP_FORUM_PERMISSIONS'; + break; + + case 'view_admin_global': + case 'view_user_global': + case 'view_mod_global': + $this->permission_dropdown = ($mode == 'view_admin_global') ? array('a_') : (($mode == 'view_user_global') ? array('u_') : array('m_')); + $permission_victim = array('usergroup_view'); + $this->page_title = ($mode == 'view_admin_global') ? 'ACP_VIEW_ADMIN_PERMISSIONS' : (($mode == 'view_user_global') ? 'ACP_VIEW_USER_PERMISSIONS' : 'ACP_VIEW_GLOBAL_MOD_PERMISSIONS'); + break; + + case 'view_mod_local': + case 'view_forum_local': + $this->permission_dropdown = ($mode == 'view_mod_local') ? array('m_') : array('f_'); + $permission_victim = array('forums', 'usergroup_view'); + $this->page_title = ($mode == 'view_mod_local') ? 'ACP_VIEW_FORUM_MOD_PERMISSIONS' : 'ACP_VIEW_FORUM_PERMISSIONS'; + break; + + default: + trigger_error('NO_MODE', E_USER_ERROR); + break; + } + + $template->assign_vars(array( + 'L_TITLE' => $user->lang[$this->page_title], + 'L_EXPLAIN' => $user->lang[$this->page_title . '_EXPLAIN']) + ); + + // Get permission type + $permission_type = $request->variable('type', $this->permission_dropdown[0]); + + if (!in_array($permission_type, $this->permission_dropdown)) + { + trigger_error($user->lang['WRONG_PERMISSION_TYPE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Handle actions + if (strpos($mode, 'setting_') === 0 && $action) + { + switch ($action) + { + case 'delete': + if (confirm_box(true)) + { + // All users/groups selected? + $all_users = (isset($_POST['all_users'])) ? true : false; + $all_groups = (isset($_POST['all_groups'])) ? true : false; + + if ($all_users || $all_groups) + { + $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); + + if ($all_users && count($items['user_ids'])) + { + $user_id = $items['user_ids']; + } + else if ($all_groups && count($items['group_ids'])) + { + $group_id = $items['group_ids']; + } + } + + if (count($user_id) || count($group_id)) + { + $this->remove_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id, $forum_id); + } + else + { + trigger_error($user->lang['NO_USER_GROUP_SELECTED'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + else + { + if (isset($_POST['cancel'])) + { + $u_redirect = $this->u_action . '&type=' . $permission_type; + foreach ($forum_id as $fid) + { + $u_redirect .= '&forum_id[]=' . $fid; + } + redirect($u_redirect); + } + + $s_hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'action' => array($action => 1), + 'user_id' => $user_id, + 'group_id' => $group_id, + 'forum_id' => $forum_id, + 'type' => $permission_type, + ); + if (isset($_POST['all_users'])) + { + $s_hidden_fields['all_users'] = 1; + } + if (isset($_POST['all_groups'])) + { + $s_hidden_fields['all_groups'] = 1; + } + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); + } + break; + + case 'apply_permissions': + if (!isset($_POST['setting'])) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + } + + $this->set_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id); + break; + + case 'apply_all_permissions': + if (!isset($_POST['setting'])) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_SETTING_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID']. adm_back_link($this->u_action), E_USER_WARNING); + } + + $this->set_all_permissions($mode, $permission_type, $auth_admin, $user_id, $group_id); + break; + } + } + + // Go through the screens/options needed and present them in correct order + foreach ($permission_victim as $victim) + { + switch ($victim) + { + case 'forum_dropdown': + + if (count($forum_id)) + { + $this->check_existence('forum', $forum_id); + continue 2; + } + + $template->assign_vars(array( + 'S_SELECT_FORUM' => true, + 'S_FORUM_OPTIONS' => make_forum_select(false, false, true, false, false)) + ); + + break; + + case 'forums': + + if (count($forum_id)) + { + $this->check_existence('forum', $forum_id); + continue 2; + } + + $forum_list = make_forum_select(false, false, true, false, false, false, true); + + // Build forum options + $s_forum_options = ''; + foreach ($forum_list as $f_id => $f_row) + { + $s_forum_options .= ''; + } + + // Build subforum options + $s_subforum_options = $this->build_subforum_options($forum_list); + + $template->assign_vars(array( + 'S_SELECT_FORUM' => true, + 'S_FORUM_OPTIONS' => $s_forum_options, + 'S_SUBFORUM_OPTIONS' => $s_subforum_options, + 'S_FORUM_ALL' => true, + 'S_FORUM_MULTIPLE' => true) + ); + + break; + + case 'user': + + if (count($user_id)) + { + $this->check_existence('user', $user_id); + continue 2; + } + + $template->assign_vars(array( + 'S_SELECT_USER' => true, + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_victim&field=username&select_single=true'), + )); + + break; + + case 'group': + + if (count($group_id)) + { + $this->check_existence('group', $group_id); + continue 2; + } + + $template->assign_vars(array( + 'S_SELECT_GROUP' => true, + 'S_GROUP_OPTIONS' => group_select_options(false, false, false), // Show all groups + )); + + break; + + case 'usergroup': + case 'usergroup_view': + + $all_users = (isset($_POST['all_users'])) ? true : false; + $all_groups = (isset($_POST['all_groups'])) ? true : false; + + if ((count($user_id) && !$all_users) || (count($group_id) && !$all_groups)) + { + if (count($user_id)) + { + $this->check_existence('user', $user_id); + } + + if (count($group_id)) + { + $this->check_existence('group', $group_id); + } + + continue 2; + } + + // Now we check the users... because the "all"-selection is different here (all defined users/groups) + $items = $this->retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type); + + if ($all_users && count($items['user_ids'])) + { + $user_id = $items['user_ids']; + continue 2; + } + + if ($all_groups && count($items['group_ids'])) + { + $group_id = $items['group_ids']; + continue 2; + } + + $template->assign_vars(array( + 'S_SELECT_USERGROUP' => ($victim == 'usergroup') ? true : false, + 'S_SELECT_USERGROUP_VIEW' => ($victim == 'usergroup_view') ? true : false, + 'S_DEFINED_USER_OPTIONS' => $items['user_ids_options'], + 'S_DEFINED_GROUP_OPTIONS' => $items['group_ids_options'], + 'S_ADD_GROUP_OPTIONS' => group_select_options(false, $items['group_ids'], false), // Show all groups + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=add_user&field=username&select_single=true'), + )); + + break; + } + + // The S_ALLOW_SELECT parameter below is a measure to lower memory usage. + // If there are more than 5 forums selected the admin is not able to select all users/groups too. + // We need to see if the number of forums can be increased or need to be decreased. + + // Setting permissions screen + $s_hidden_fields = build_hidden_fields(array( + 'user_id' => $user_id, + 'group_id' => $group_id, + 'forum_id' => $forum_id, + 'type' => $permission_type, + )); + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + 'ANONYMOUS_USER_ID' => ANONYMOUS, + + 'S_SELECT_VICTIM' => true, + 'S_ALLOW_ALL_SELECT' => (count($forum_id) > 5) ? false : true, + 'S_CAN_SELECT_USER' => ($auth->acl_get('a_authusers')) ? true : false, + 'S_CAN_SELECT_GROUP' => ($auth->acl_get('a_authgroups')) ? true : false, + 'S_HIDDEN_FIELDS' => $s_hidden_fields) + ); + + // Let the forum names being displayed + if (count($forum_id)) + { + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id) . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql); + + $forum_names = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_names[] = $row['forum_name']; + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_FORUM_NAMES' => (count($forum_names)) ? true : false, + 'FORUM_NAMES' => implode($user->lang['COMMA_SEPARATOR'], $forum_names)) + ); + } + + return; + } + + // Setting permissions screen + $s_hidden_fields = build_hidden_fields(array( + 'user_id' => $user_id, + 'group_id' => $group_id, + 'forum_id' => $forum_id, + 'type' => $permission_type, + )); + + // Do not allow forum_ids being set and no other setting defined (will bog down the server too much) + if (count($forum_id) && !count($user_id) && !count($group_id)) + { + trigger_error($user->lang['ONLY_FORUM_DEFINED'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $template->assign_vars(array( + 'S_PERMISSION_DROPDOWN' => (count($this->permission_dropdown) > 1) ? $this->build_permission_dropdown($this->permission_dropdown, $permission_type, $permission_scope) : false, + 'L_PERMISSION_TYPE' => $this->permissions->get_type_lang($permission_type), + + 'U_ACTION' => $this->u_action, + 'S_HIDDEN_FIELDS' => $s_hidden_fields) + ); + + if (strpos($mode, 'setting_') === 0) + { + $template->assign_vars(array( + 'S_SETTING_PERMISSIONS' => true) + ); + + $hold_ary = $auth_admin->get_mask('set', (count($user_id)) ? $user_id : false, (count($group_id)) ? $group_id : false, (count($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NO); + $auth_admin->display_mask('set', $permission_type, $hold_ary, ((count($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); + } + else + { + $template->assign_vars(array( + 'S_VIEWING_PERMISSIONS' => true) + ); + + $hold_ary = $auth_admin->get_mask('view', (count($user_id)) ? $user_id : false, (count($group_id)) ? $group_id : false, (count($forum_id)) ? $forum_id : false, $permission_type, $permission_scope, ACL_NEVER); + $auth_admin->display_mask('view', $permission_type, $hold_ary, ((count($user_id)) ? 'user' : 'group'), (($permission_scope == 'local') ? true : false)); + } + } + + /** + * Build +subforum options + */ + function build_subforum_options($forum_list) + { + global $user; + + $s_options = ''; + + $forum_list = array_merge($forum_list); + + foreach ($forum_list as $key => $row) + { + if ($row['disabled']) + { + continue; + } + + $s_options .= ''; + } + + return $s_options; + } + + /** + * Build dropdown field for changing permission types + */ + function build_permission_dropdown($options, $default_option, $permission_scope) + { + global $auth; + + $s_dropdown_options = ''; + foreach ($options as $setting) + { + if (!$auth->acl_get('a_' . str_replace('_', '', $setting) . 'auth')) + { + continue; + } + + $selected = ($setting == $default_option) ? ' selected="selected"' : ''; + $l_setting = $this->permissions->get_type_lang($setting, $permission_scope); + $s_dropdown_options .= ''; + } + + return $s_dropdown_options; + } + + /** + * Check if selected items exist. Remove not found ids and if empty return error. + */ + function check_existence($mode, &$ids) + { + global $db, $user; + + switch ($mode) + { + case 'user': + $table = USERS_TABLE; + $sql_id = 'user_id'; + break; + + case 'group': + $table = GROUPS_TABLE; + $sql_id = 'group_id'; + break; + + case 'forum': + $table = FORUMS_TABLE; + $sql_id = 'forum_id'; + break; + } + + if (count($ids)) + { + $sql = "SELECT $sql_id + FROM $table + WHERE " . $db->sql_in_set($sql_id, $ids); + $result = $db->sql_query($sql); + + $ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $ids[] = (int) $row[$sql_id]; + } + $db->sql_freeresult($result); + } + + if (!count($ids)) + { + trigger_error($user->lang['SELECTED_' . strtoupper($mode) . '_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + /** + * Apply permissions + */ + function set_permissions($mode, $permission_type, $auth_admin, &$user_id, &$group_id) + { + global $db, $cache, $user, $auth; + global $request; + + $psubmit = $request->variable('psubmit', array(0 => array(0 => 0))); + + // User or group to be set? + $ug_type = (count($user_id)) ? 'user' : 'group'; + + // Check the permission setting again + if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // We loop through the auth settings defined in our submit + list($ug_id, ) = each($psubmit); + list($forum_id, ) = each($psubmit[$ug_id]); + + $settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST); + if (empty($settings) || empty($settings[$ug_id]) || empty($settings[$ug_id][$forum_id])) + { + trigger_error('WRONG_PERMISSION_SETTING_FORMAT', E_USER_WARNING); + } + + $auth_settings = $settings[$ug_id][$forum_id]; + + // Do we have a role we want to set? + $roles = $request->variable('role', array(0 => array(0 => 0)), false, \phpbb\request\request_interface::POST); + $assigned_role = (isset($roles[$ug_id][$forum_id])) ? (int) $roles[$ug_id][$forum_id] : 0; + + // Do the admin want to set these permissions to other items too? + $inherit = $request->variable('inherit', array(0 => array(0))); + + $ug_id = array($ug_id); + $forum_id = array($forum_id); + + if (count($inherit)) + { + foreach ($inherit as $_ug_id => $forum_id_ary) + { + // Inherit users/groups? + if (!in_array($_ug_id, $ug_id)) + { + $ug_id[] = $_ug_id; + } + + // Inherit forums? + $forum_id = array_merge($forum_id, array_keys($forum_id_ary)); + } + } + + $forum_id = array_unique($forum_id); + + // If the auth settings differ from the assigned role, then do not set a role... + if ($assigned_role) + { + if (!$this->check_assigned_role($assigned_role, $auth_settings)) + { + $assigned_role = 0; + } + } + + // Update the permission set... + $auth_admin->acl_set($ug_type, $forum_id, $ug_id, $auth_settings, $assigned_role); + + // Do we need to recache the moderator lists? + if ($permission_type == 'm_') + { + phpbb_cache_moderators($db, $cache, $auth); + } + + // Remove users who are now moderators or admins from everyones foes list + if ($permission_type == 'm_' || $permission_type == 'a_') + { + phpbb_update_foes($db, $auth, $group_id, $user_id); + } + + $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_id, $forum_id); + + meta_refresh(5, $this->u_action); + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + } + + /** + * Apply all permissions + */ + function set_all_permissions($mode, $permission_type, $auth_admin, &$user_id, &$group_id) + { + global $db, $cache, $user, $auth; + global $request; + + // User or group to be set? + $ug_type = (count($user_id)) ? 'user' : 'group'; + + // Check the permission setting again + if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $auth_settings = $request->variable('setting', array(0 => array(0 => array('' => 0))), false, \phpbb\request\request_interface::POST); + $auth_roles = $request->variable('role', array(0 => array(0 => 0)), false, \phpbb\request\request_interface::POST); + $ug_ids = $forum_ids = array(); + + // We need to go through the auth settings + foreach ($auth_settings as $ug_id => $forum_auth_row) + { + $ug_id = (int) $ug_id; + $ug_ids[] = $ug_id; + + foreach ($forum_auth_row as $forum_id => $auth_options) + { + $forum_id = (int) $forum_id; + $forum_ids[] = $forum_id; + + // Check role... + $assigned_role = (isset($auth_roles[$ug_id][$forum_id])) ? (int) $auth_roles[$ug_id][$forum_id] : 0; + + // If the auth settings differ from the assigned role, then do not set a role... + if ($assigned_role) + { + if (!$this->check_assigned_role($assigned_role, $auth_options)) + { + $assigned_role = 0; + } + } + + // Update the permission set... + $auth_admin->acl_set($ug_type, $forum_id, $ug_id, $auth_options, $assigned_role, false); + } + } + + $auth_admin->acl_clear_prefetch(); + + // Do we need to recache the moderator lists? + if ($permission_type == 'm_') + { + phpbb_cache_moderators($db, $cache, $auth); + } + + // Remove users who are now moderators or admins from everyones foes list + if ($permission_type == 'm_' || $permission_type == 'a_') + { + phpbb_update_foes($db, $auth, $group_id, $user_id); + } + + $this->log_action($mode, 'add', $permission_type, $ug_type, $ug_ids, $forum_ids); + + if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') + { + meta_refresh(5, $this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids)); + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_ids))); + } + else + { + meta_refresh(5, $this->u_action); + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + } + } + + /** + * Compare auth settings with auth settings from role + * returns false if they differ, true if they are equal + */ + function check_assigned_role($role_id, &$auth_settings) + { + global $db; + + $sql = 'SELECT o.auth_option, r.auth_setting + FROM ' . ACL_OPTIONS_TABLE . ' o, ' . ACL_ROLES_DATA_TABLE . ' r + WHERE o.auth_option_id = r.auth_option_id + AND r.role_id = ' . $role_id; + $result = $db->sql_query($sql); + + $test_auth_settings = array(); + while ($row = $db->sql_fetchrow($result)) + { + $test_auth_settings[$row['auth_option']] = $row['auth_setting']; + } + $db->sql_freeresult($result); + + // We need to add any ACL_NO setting from auth_settings to compare correctly + foreach ($auth_settings as $option => $setting) + { + if ($setting == ACL_NO) + { + $test_auth_settings[$option] = $setting; + } + } + + if (count(array_diff_assoc($auth_settings, $test_auth_settings))) + { + return false; + } + + return true; + } + + /** + * Remove permissions + */ + function remove_permissions($mode, $permission_type, $auth_admin, &$user_id, &$group_id, &$forum_id) + { + global $user, $db, $cache, $auth; + + // User or group to be set? + $ug_type = (count($user_id)) ? 'user' : 'group'; + + // Check the permission setting again + if (!$auth->acl_get('a_' . str_replace('_', '', $permission_type) . 'auth') || !$auth->acl_get('a_auth' . $ug_type . 's')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $auth_admin->acl_delete($ug_type, (($ug_type == 'user') ? $user_id : $group_id), (count($forum_id) ? $forum_id : false), $permission_type); + + // Do we need to recache the moderator lists? + if ($permission_type == 'm_') + { + phpbb_cache_moderators($db, $cache, $auth); + } + + $this->log_action($mode, 'del', $permission_type, $ug_type, (($ug_type == 'user') ? $user_id : $group_id), (count($forum_id) ? $forum_id : array(0 => 0))); + + if ($mode == 'setting_forum_local' || $mode == 'setting_mod_local') + { + meta_refresh(5, $this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id)); + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action . '&forum_id[]=' . implode('&forum_id[]=', $forum_id))); + } + else + { + meta_refresh(5, $this->u_action); + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + } + } + + /** + * Log permission changes + */ + function log_action($mode, $action, $permission_type, $ug_type, $ug_id, $forum_id) + { + global $db, $user, $phpbb_log, $phpbb_container; + + if (!is_array($ug_id)) + { + $ug_id = array($ug_id); + } + + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + // Logging ... first grab user or groupnames ... + $sql = ($ug_type == 'group') ? 'SELECT group_name as name, group_type FROM ' . GROUPS_TABLE . ' WHERE ' : 'SELECT username as name FROM ' . USERS_TABLE . ' WHERE '; + $sql .= $db->sql_in_set(($ug_type == 'group') ? 'group_id' : 'user_id', array_map('intval', $ug_id)); + $result = $db->sql_query($sql); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $l_ug_list = ''; + while ($row = $db->sql_fetchrow($result)) + { + $group_name = $group_helper->get_name($row['name']); + $l_ug_list .= (($l_ug_list != '') ? ', ' : '') . ((isset($row['group_type']) && $row['group_type'] == GROUP_SPECIAL) ? '' . $group_name . '' : $group_name); + } + $db->sql_freeresult($result); + + $mode = str_replace('setting_', '', $mode); + + if ($forum_id[0] == 0) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), false, array($l_ug_list)); + } + else + { + // Grab the forum details if non-zero forum_id + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id); + $result = $db->sql_query($sql); + + $l_forum_list = ''; + while ($row = $db->sql_fetchrow($result)) + { + $l_forum_list .= (($l_forum_list != '') ? ', ' : '') . $row['forum_name']; + } + $db->sql_freeresult($result); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_' . strtoupper($action) . '_' . strtoupper($mode) . '_' . strtoupper($permission_type), false, array($l_forum_list, $l_ug_list)); + } + } + + /** + * Display a complete trace tree for the selected permission to determine where settings are set/unset + */ + function permission_trace($user_id, $forum_id, $permission) + { + global $db, $template, $user, $auth, $request, $phpbb_container; + + if ($user_id != $user->data['user_id']) + { + $userdata = $auth->obtain_user_data($user_id); + } + else + { + $userdata = $user->data; + } + + if (!$userdata) + { + trigger_error('NO_USERS', E_USER_ERROR); + } + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $forum_name = false; + + if ($forum_id) + { + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql, 3600); + $forum_name = $db->sql_fetchfield('forum_name'); + $db->sql_freeresult($result); + } + + $back = $request->variable('back', 0); + + $template->assign_vars(array( + 'PERMISSION' => $this->permissions->get_permission_lang($permission), + 'PERMISSION_USERNAME' => $userdata['username'], + 'FORUM_NAME' => $forum_name, + + 'S_GLOBAL_TRACE' => ($forum_id) ? false : true, + + 'U_BACK' => ($back) ? build_url(array('f', 'back')) . "&f=$back" : '') + ); + + $template->assign_block_vars('trace', array( + 'WHO' => $user->lang['DEFAULT'], + 'INFORMATION' => $user->lang['TRACE_DEFAULT'], + + 'S_SETTING_NO' => true, + 'S_TOTAL_NO' => true) + ); + + $sql = 'SELECT DISTINCT g.group_name, g.group_id, g.group_type + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.group_id = g.group_id) + WHERE ug.user_id = ' . $user_id . ' + AND ug.user_pending = 0 + AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) + ORDER BY g.group_type DESC, g.group_id DESC'; + $result = $db->sql_query($sql); + + $groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $groups[$row['group_id']] = array( + 'auth_setting' => ACL_NO, + 'group_name' => $group_helper->get_name($row['group_name']), + ); + } + $db->sql_freeresult($result); + + $total = ACL_NO; + $add_key = (($forum_id) ? '_LOCAL' : ''); + + if (count($groups)) + { + // Get group auth settings + $hold_ary = $auth->acl_group_raw_data(array_keys($groups), $permission, $forum_id); + + foreach ($hold_ary as $group_id => $forum_ary) + { + $groups[$group_id]['auth_setting'] = $hold_ary[$group_id][$forum_id][$permission]; + } + unset($hold_ary); + + foreach ($groups as $id => $row) + { + switch ($row['auth_setting']) + { + case ACL_NO: + $information = $user->lang['TRACE_GROUP_NO' . $add_key]; + break; + + case ACL_YES: + $information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_YES_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_GROUP_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_YES_TOTAL_NO' . $add_key]); + $total = ($total == ACL_NO) ? ACL_YES : $total; + break; + + case ACL_NEVER: + $information = ($total == ACL_YES) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_GROUP_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_GROUP_NEVER_TOTAL_NO' . $add_key]); + $total = ACL_NEVER; + break; + } + + $template->assign_block_vars('trace', array( + 'WHO' => $row['group_name'], + 'INFORMATION' => $information, + + 'S_SETTING_NO' => ($row['auth_setting'] == ACL_NO) ? true : false, + 'S_SETTING_YES' => ($row['auth_setting'] == ACL_YES) ? true : false, + 'S_SETTING_NEVER' => ($row['auth_setting'] == ACL_NEVER) ? true : false, + 'S_TOTAL_NO' => ($total == ACL_NO) ? true : false, + 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, + 'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false) + ); + } + } + + // Get user specific permission... globally or for this forum + $hold_ary = $auth->acl_user_raw_data($user_id, $permission, $forum_id); + $auth_setting = (!count($hold_ary)) ? ACL_NO : $hold_ary[$user_id][$forum_id][$permission]; + + switch ($auth_setting) + { + case ACL_NO: + $information = ($total == ACL_NO) ? $user->lang['TRACE_USER_NO_TOTAL_NO' . $add_key] : $user->lang['TRACE_USER_KEPT' . $add_key]; + $total = ($total == ACL_NO) ? ACL_NEVER : $total; + break; + + case ACL_YES: + $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_YES_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_USER_YES_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_YES_TOTAL_NO' . $add_key]); + $total = ($total == ACL_NO) ? ACL_YES : $total; + break; + + case ACL_NEVER: + $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_NEVER_TOTAL_YES' . $add_key] : (($total == ACL_NEVER) ? $user->lang['TRACE_USER_NEVER_TOTAL_NEVER' . $add_key] : $user->lang['TRACE_USER_NEVER_TOTAL_NO' . $add_key]); + $total = ACL_NEVER; + break; + } + + $template->assign_block_vars('trace', array( + 'WHO' => $userdata['username'], + 'INFORMATION' => $information, + + 'S_SETTING_NO' => ($auth_setting == ACL_NO) ? true : false, + 'S_SETTING_YES' => ($auth_setting == ACL_YES) ? true : false, + 'S_SETTING_NEVER' => ($auth_setting == ACL_NEVER) ? true : false, + 'S_TOTAL_NO' => false, + 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, + 'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false) + ); + + if ($forum_id != 0 && isset($auth->acl_options['global'][$permission])) + { + if ($user_id != $user->data['user_id']) + { + $auth2 = new \phpbb\auth\auth(); + $auth2->acl($userdata); + $auth_setting = $auth2->acl_get($permission); + } + else + { + $auth_setting = $auth->acl_get($permission); + } + + if ($auth_setting) + { + $information = ($total == ACL_YES) ? $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_YES'] : $user->lang['TRACE_USER_GLOBAL_YES_TOTAL_NEVER']; + $total = ACL_YES; + } + else + { + $information = $user->lang['TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT']; + } + + // If there is no auth information we do not need to worry the user by showing non-relevant data. + if ($auth_setting) + { + $template->assign_block_vars('trace', array( + 'WHO' => sprintf($user->lang['TRACE_GLOBAL_SETTING'], $userdata['username']), + 'INFORMATION' => sprintf($information, '", ''), + + 'S_SETTING_NO' => false, + 'S_SETTING_YES' => $auth_setting, + 'S_SETTING_NEVER' => !$auth_setting, + 'S_TOTAL_NO' => false, + 'S_TOTAL_YES' => ($total == ACL_YES) ? true : false, + 'S_TOTAL_NEVER' => ($total == ACL_NEVER) ? true : false) + ); + } + } + + // Take founder status into account, overwriting the default values + if ($userdata['user_type'] == USER_FOUNDER && strpos($permission, 'a_') === 0) + { + $template->assign_block_vars('trace', array( + 'WHO' => $userdata['username'], + 'INFORMATION' => $user->lang['TRACE_USER_FOUNDER'], + + 'S_SETTING_NO' => ($auth_setting == ACL_NO) ? true : false, + 'S_SETTING_YES' => ($auth_setting == ACL_YES) ? true : false, + 'S_SETTING_NEVER' => ($auth_setting == ACL_NEVER) ? true : false, + 'S_TOTAL_NO' => false, + 'S_TOTAL_YES' => true, + 'S_TOTAL_NEVER' => false) + ); + + $total = ACL_YES; + } + + // Total value... + $template->assign_vars(array( + 'S_RESULT_NO' => ($total == ACL_NO) ? true : false, + 'S_RESULT_YES' => ($total == ACL_YES) ? true : false, + 'S_RESULT_NEVER' => ($total == ACL_NEVER) ? true : false, + )); + } + + /** + * Handles copying permissions from one forum to others + */ + function copy_forum_permissions() + { + global $db, $auth, $cache, $template, $user, $request; + + $user->add_lang('acp/forums'); + + $submit = isset($_POST['submit']) ? true : false; + + if ($submit) + { + $src = $request->variable('src_forum_id', 0); + $dest = $request->variable('dest_forum_ids', array(0)); + + if (confirm_box(true)) + { + if (copy_forum_permissions($src, $dest)) + { + phpbb_cache_moderators($db, $cache, $auth); + + $auth->acl_clear_prefetch(); + $cache->destroy('sql', FORUMS_TABLE); + + trigger_error($user->lang['AUTH_UPDATED'] . adm_back_link($this->u_action)); + } + else + { + trigger_error($user->lang['SELECTED_FORUM_NOT_EXIST'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + else + { + $s_hidden_fields = array( + 'submit' => $submit, + 'src_forum_id' => $src, + 'dest_forum_ids' => $dest, + ); + + $s_hidden_fields = build_hidden_fields($s_hidden_fields); + + confirm_box(false, $user->lang['COPY_PERMISSIONS_CONFIRM'], $s_hidden_fields); + } + } + + $template->assign_vars(array( + 'S_FORUM_OPTIONS' => make_forum_select(false, false, false, false, false), + )); + } + + /** + * Get already assigned users/groups + */ + function retrieve_defined_user_groups($permission_scope, $forum_id, $permission_type) + { + global $db, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $sql_forum_id = ($permission_scope == 'global') ? 'AND a.forum_id = 0' : ((count($forum_id)) ? 'AND ' . $db->sql_in_set('a.forum_id', $forum_id) : 'AND a.forum_id <> 0'); + + // Permission options are only able to be a permission set... therefore we will pre-fetch the possible options and also the possible roles + $option_ids = $role_ids = array(); + + $sql = 'SELECT auth_option_id + FROM ' . ACL_OPTIONS_TABLE . ' + WHERE auth_option ' . $db->sql_like_expression($permission_type . $db->get_any_char()); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $option_ids[] = (int) $row['auth_option_id']; + } + $db->sql_freeresult($result); + + if (count($option_ids)) + { + $sql = 'SELECT DISTINCT role_id + FROM ' . ACL_ROLES_DATA_TABLE . ' + WHERE ' . $db->sql_in_set('auth_option_id', $option_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $role_ids[] = (int) $row['role_id']; + } + $db->sql_freeresult($result); + } + + if (count($option_ids) && count($role_ids)) + { + $sql_where = 'AND (' . $db->sql_in_set('a.auth_option_id', $option_ids) . ' OR ' . $db->sql_in_set('a.auth_role_id', $role_ids) . ')'; + } + else if (count($role_ids)) + { + $sql_where = 'AND ' . $db->sql_in_set('a.auth_role_id', $role_ids); + } + else if (count($option_ids)) + { + $sql_where = 'AND ' . $db->sql_in_set('a.auth_option_id', $option_ids); + } + + // Not ideal, due to the filesort, non-use of indexes, etc. + $sql = 'SELECT DISTINCT u.user_id, u.username, u.username_clean, u.user_regdate + FROM ' . USERS_TABLE . ' u, ' . ACL_USERS_TABLE . " a + WHERE u.user_id = a.user_id + $sql_forum_id + $sql_where + ORDER BY u.username_clean, u.user_regdate ASC"; + $result = $db->sql_query($sql); + + $s_defined_user_options = ''; + $defined_user_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $s_defined_user_options .= ''; + $defined_user_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT DISTINCT g.group_type, g.group_name, g.group_id + FROM ' . GROUPS_TABLE . ' g, ' . ACL_GROUPS_TABLE . " a + WHERE g.group_id = a.group_id + $sql_forum_id + $sql_where + ORDER BY g.group_type DESC, g.group_name ASC"; + $result = $db->sql_query($sql); + + $s_defined_group_options = ''; + $defined_group_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $s_defined_group_options .= '' . $group_helper->get_name($row['group_name']) . ''; + $defined_group_ids[] = $row['group_id']; + } + $db->sql_freeresult($result); + + return array( + 'group_ids' => $defined_group_ids, + 'group_ids_options' => $s_defined_group_options, + 'user_ids' => $defined_user_ids, + 'user_ids_options' => $s_defined_user_options + ); + } +} diff --git a/install/update/old/includes/acp/acp_prune.php b/install/update/old/includes/acp/acp_prune.php new file mode 100644 index 0000000..3eee4f7 --- /dev/null +++ b/install/update/old/includes/acp/acp_prune.php @@ -0,0 +1,587 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_prune +{ + var $u_action; + + function main($id, $mode) + { + global $user, $phpEx, $phpbb_root_path; + + $user->add_lang('acp/prune'); + + if (!function_exists('user_active_flip')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + switch ($mode) + { + case 'forums': + $this->tpl_name = 'acp_prune_forums'; + $this->page_title = 'ACP_PRUNE_FORUMS'; + $this->prune_forums($id, $mode); + break; + + case 'users': + $this->tpl_name = 'acp_prune_users'; + $this->page_title = 'ACP_PRUNE_USERS'; + $this->prune_users($id, $mode); + break; + } + } + + /** + * Prune forums + */ + function prune_forums($id, $mode) + { + global $db, $user, $auth, $template, $phpbb_log, $request, $phpbb_dispatcher; + + $all_forums = $request->variable('all_forums', 0); + $forum_id = $request->variable('f', array(0)); + $submit = (isset($_POST['submit'])) ? true : false; + + if ($all_forums) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id'; + $result = $db->sql_query($sql); + + $forum_id = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_id[] = $row['forum_id']; + } + $db->sql_freeresult($result); + } + + if ($submit) + { + if (confirm_box(true)) + { + $prune_posted = $request->variable('prune_days', 0); + $prune_viewed = $request->variable('prune_vieweddays', 0); + $prune_all = (!$prune_posted && !$prune_viewed) ? true : false; + + $prune_flags = 0; + $prune_flags += ($request->variable('prune_old_polls', 0)) ? 2 : 0; + $prune_flags += ($request->variable('prune_announce', 0)) ? 4 : 0; + $prune_flags += ($request->variable('prune_sticky', 0)) ? 8 : 0; + + // Convert days to seconds for timestamp functions... + $prunedate_posted = time() - ($prune_posted * 86400); + $prunedate_viewed = time() - ($prune_viewed * 86400); + + $template->assign_vars(array( + 'S_PRUNED' => true) + ); + + $sql_forum = (count($forum_id)) ? ' AND ' . $db->sql_in_set('forum_id', $forum_id) : ''; + + // Get a list of forum's or the data for the forum that we are pruning. + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST . " + $sql_forum + ORDER BY left_id ASC"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $prune_ids = array(); + $p_result['topics'] = 0; + $p_result['posts'] = 0; + $log_data = ''; + + do + { + if (!$auth->acl_get('f_list', $row['forum_id'])) + { + continue; + } + + if ($prune_all) + { + $p_result = prune($row['forum_id'], 'posted', time(), $prune_flags, false); + } + else + { + if ($prune_posted) + { + $return = prune($row['forum_id'], 'posted', $prunedate_posted, $prune_flags, false); + $p_result['topics'] += $return['topics']; + $p_result['posts'] += $return['posts']; + } + + if ($prune_viewed) + { + $return = prune($row['forum_id'], 'viewed', $prunedate_viewed, $prune_flags, false); + $p_result['topics'] += $return['topics']; + $p_result['posts'] += $return['posts']; + } + } + + $prune_ids[] = $row['forum_id']; + + $template->assign_block_vars('pruned', array( + 'FORUM_NAME' => $row['forum_name'], + 'NUM_TOPICS' => $p_result['topics'], + 'NUM_POSTS' => $p_result['posts']) + ); + + $log_data .= (($log_data != '') ? ', ' : '') . $row['forum_name']; + } + while ($row = $db->sql_fetchrow($result)); + + // Sync all pruned forums at once + sync('forum', 'forum_id', $prune_ids, true, true); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_PRUNE', false, array($log_data)); + } + $db->sql_freeresult($result); + + return; + } + else + { + $hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'submit' => 1, + 'all_forums' => $all_forums, + 'f' => $forum_id, + + 'prune_days' => $request->variable('prune_days', 0), + 'prune_vieweddays' => $request->variable('prune_vieweddays', 0), + 'prune_old_polls' => $request->variable('prune_old_polls', 0), + 'prune_announce' => $request->variable('prune_announce', 0), + 'prune_sticky' => $request->variable('prune_sticky', 0), + ); + + /** + * Use this event to pass data from the prune form to the confirmation screen + * + * @event core.prune_forums_settings_confirm + * @var array hidden_fields Hidden fields that are passed through the confirm screen + * @since 3.2.2-RC1 + */ + $vars = array('hidden_fields'); + extract($phpbb_dispatcher->trigger_event('core.prune_forums_settings_confirm', compact($vars))); + + confirm_box(false, $user->lang['PRUNE_FORUM_CONFIRM'], build_hidden_fields($hidden_fields)); + } + } + + // If they haven't selected a forum for pruning yet then + // display a select box to use for pruning. + if (!count($forum_id)) + { + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + 'S_SELECT_FORUM' => true, + 'S_FORUM_OPTIONS' => make_forum_select(false, false, false)) + ); + } + else + { + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + + if (!$row) + { + $db->sql_freeresult($result); + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $forum_list = $s_hidden_fields = ''; + do + { + $forum_list .= (($forum_list != '') ? ', ' : '') . '' . $row['forum_name'] . ''; + $s_hidden_fields .= ''; + } + while ($row = $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + + $l_selected_forums = (count($forum_id) == 1) ? 'SELECTED_FORUM' : 'SELECTED_FORUMS'; + + $template_data = array( + 'L_SELECTED_FORUMS' => $user->lang[$l_selected_forums], + 'U_ACTION' => $this->u_action, + 'U_BACK' => $this->u_action, + 'FORUM_LIST' => $forum_list, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + ); + + /** + * Event to add/modify prune forums settings template data + * + * @event core.prune_forums_settings_template_data + * @var array template_data Array with form template data + * @since 3.2.2-RC1 + */ + $vars = array('template_data'); + extract($phpbb_dispatcher->trigger_event('core.prune_forums_settings_template_data', compact($vars))); + + $template->assign_vars($template_data); + } + } + + /** + * Prune users + */ + function prune_users($id, $mode) + { + global $db, $user, $auth, $template, $phpbb_log, $request; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $user->add_lang('memberlist'); + + $prune = (isset($_POST['prune'])) ? true : false; + + if ($prune) + { + $action = $request->variable('action', 'deactivate'); + $deleteposts = $request->variable('deleteposts', 0); + + if (confirm_box(true)) + { + $user_ids = $usernames = array(); + + $this->get_prune_users($user_ids, $usernames); + if (count($user_ids)) + { + if ($action == 'deactivate') + { + user_active_flip('deactivate', $user_ids); + $l_log = 'LOG_PRUNE_USER_DEAC'; + } + else if ($action == 'delete') + { + if ($deleteposts) + { + user_delete('remove', $user_ids); + + $l_log = 'LOG_PRUNE_USER_DEL_DEL'; + } + else + { + user_delete('retain', $user_ids, true); + + $l_log = 'LOG_PRUNE_USER_DEL_ANON'; + } + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $l_log, false, array(implode(', ', $usernames))); + $msg = $user->lang['USER_' . strtoupper($action) . '_SUCCESS']; + } + else + { + $msg = $user->lang['USER_PRUNE_FAILURE']; + } + + trigger_error($msg . adm_back_link($this->u_action)); + } + else + { + // We list the users which will be pruned... + $user_ids = $usernames = array(); + $this->get_prune_users($user_ids, $usernames); + + if (!count($user_ids)) + { + trigger_error($user->lang['USER_PRUNE_FAILURE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Assign to template + foreach ($user_ids as $user_id) + { + $template->assign_block_vars('users', array( + 'USERNAME' => $usernames[$user_id], + 'USER_ID' => $user_id, + 'U_PROFILE' => get_username_string('profile', $user_id, $usernames[$user_id]), + 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', + )); + } + + $template->assign_vars(array( + 'S_DEACTIVATE' => ($action == 'deactivate') ? true : false, + 'S_DELETE' => ($action == 'delete') ? true : false, + )); + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'prune' => 1, + + 'deleteposts' => $request->variable('deleteposts', 0), + 'action' => $request->variable('action', ''), + )), 'confirm_body_prune.html'); + } + } + + $find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']); + $s_find_count = ''; + + foreach ($find_count as $key => $value) + { + $selected = ($key == 'eq') ? ' selected="selected"' : ''; + $s_find_count .= ''; + } + + $find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']); + $s_find_active_time = ''; + foreach ($find_time as $key => $value) + { + $s_find_active_time .= ''; + } + + $sql = 'SELECT group_id, group_name + FROM ' . GROUPS_TABLE . ' + WHERE group_type <> ' . GROUP_SPECIAL . ' + ORDER BY group_name ASC'; + $result = $db->sql_query($sql); + + $s_group_list = ''; + while ($row = $db->sql_fetchrow($result)) + { + $s_group_list .= ''; + } + $db->sql_freeresult($result); + + if ($s_group_list) + { + // Only prepend the "All groups" option if there are groups, + // otherwise we don't want to display this option at all. + $s_group_list = '' . $s_group_list; + } + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + 'S_ACTIVE_OPTIONS' => $s_find_active_time, + 'S_GROUP_LIST' => $s_group_list, + 'S_COUNT_OPTIONS' => $s_find_count, + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=acp_prune&field=users'), + )); + } + + /** + * Get user_ids/usernames from those being pruned + */ + function get_prune_users(&$user_ids, &$usernames) + { + global $user, $db, $request; + + $users_by_name = $request->variable('users', '', true); + $users_by_id = $request->variable('user_ids', array(0)); + $group_id = $request->variable('group_id', 0); + $posts_on_queue = (trim($request->variable('posts_on_queue', '')) === '') ? false : $request->variable('posts_on_queue', 0); + + if ($users_by_name) + { + $users = explode("\n", $users_by_name); + $where_sql = ' AND ' . $db->sql_in_set('username_clean', array_map('utf8_clean_string', $users)); + } + else if (!empty($users_by_id)) + { + $user_ids = $users_by_id; + user_get_id_name($user_ids, $usernames); + + $where_sql = ' AND ' . $db->sql_in_set('user_id', $user_ids); + } + else + { + $username = $request->variable('username', '', true); + $email = $request->variable('email', ''); + + $active_select = $request->variable('active_select', 'lt'); + $count_select = $request->variable('count_select', 'eq'); + $queue_select = $request->variable('queue_select', 'gt'); + $joined_before = $request->variable('joined_before', ''); + $joined_after = $request->variable('joined_after', ''); + $active = $request->variable('active', ''); + + $count = ($request->variable('count', '') === '') ? false : $request->variable('count', 0); + + $active = ($active) ? explode('-', $active) : array(); + $joined_before = ($joined_before) ? explode('-', $joined_before) : array(); + $joined_after = ($joined_after) ? explode('-', $joined_after) : array(); + + // calculate the conditions required by the join time criteria + $joined_sql = ''; + if (!empty($joined_before) && !empty($joined_after)) + { + // if the two entered dates are equal, we need to adjust + // so that our time range is a full day instead of 1 second + if ($joined_after == $joined_before) + { + $joined_after[2] += 1; + } + + $joined_sql = ' AND user_regdate BETWEEN ' . gmmktime(0, 0, 0, (int) $joined_after[1], (int) $joined_after[2], (int) $joined_after[0]) . + ' AND ' . gmmktime(0, 0, 0, (int) $joined_before[1], (int) $joined_before[2], (int) $joined_before[0]); + } + else if (empty($joined_before) && !empty($joined_after)) + { + $joined_sql = ' AND user_regdate > ' . gmmktime(0, 0, 0, (int) $joined_after[1], (int) $joined_after[2], (int) $joined_after[0]); + } + else if (empty($joined_after) && !empty($joined_before)) + { + $joined_sql = ' AND user_regdate < ' . gmmktime(0, 0, 0, (int) $joined_before[1], (int) $joined_before[2], (int) $joined_before[0]); + } + // implicit else when both arrays are empty do nothing + + if ((count($active) && count($active) != 3) || (count($joined_before) && count($joined_before) != 3) || (count($joined_after) && count($joined_after) != 3)) + { + trigger_error($user->lang['WRONG_ACTIVE_JOINED_DATE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); + + $where_sql = ''; + $where_sql .= ($username) ? ' AND username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($username))) : ''; + $where_sql .= ($email) ? ' AND user_email ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $email)) . ' ' : ''; + $where_sql .= $joined_sql; + $where_sql .= ($count !== false) ? " AND user_posts " . $key_match[$count_select] . ' ' . (int) $count . ' ' : ''; + + // First handle pruning of users who never logged in, last active date is 0000-00-00 + if (count($active) && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) + { + $where_sql .= ' AND user_lastvisit = 0'; + } + else if (count($active) && $active_select != 'lt') + { + $where_sql .= ' AND user_lastvisit ' . $key_match[$active_select] . ' ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]); + } + else if (count($active)) + { + $where_sql .= ' AND (user_lastvisit > 0 AND user_lastvisit < ' . gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]) . ')'; + } + } + + // If no search criteria were provided, go no further. + if (!$where_sql && !$group_id && $posts_on_queue === false) + { + return; + } + + // Get bot ids + $sql = 'SELECT user_id + FROM ' . BOTS_TABLE; + $result = $db->sql_query($sql); + + $bot_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $bot_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + // Protect the admin, do not prune if no options are given... + if ($where_sql) + { + // Do not prune founder members + $sql = 'SELECT user_id, username + FROM ' . USERS_TABLE . ' + WHERE user_id <> ' . ANONYMOUS . ' + AND user_type <> ' . USER_FOUNDER . " + $where_sql"; + $result = $db->sql_query($sql); + + $user_ids = $usernames = array(); + + while ($row = $db->sql_fetchrow($result)) + { + // Do not prune bots and the user currently pruning. + if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + { + $user_ids[] = $row['user_id']; + $usernames[$row['user_id']] = $row['username']; + } + } + $db->sql_freeresult($result); + } + + if ($group_id) + { + $sql = 'SELECT u.user_id, u.username + FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u + WHERE ug.group_id = ' . (int) $group_id . ' + AND ug.user_id <> ' . ANONYMOUS . ' + AND u.user_type <> ' . USER_FOUNDER . ' + AND ug.user_pending = 0 + AND u.user_id = ug.user_id + ' . (!empty($user_ids) ? ' AND ' . $db->sql_in_set('ug.user_id', $user_ids) : ''); + $result = $db->sql_query($sql); + + // we're performing an intersection operation, so all the relevant users + // come from this most recent query (which was limited to the results of the + // previous query) + $user_ids = $usernames = array(); + while ($row = $db->sql_fetchrow($result)) + { + // Do not prune bots and the user currently pruning. + if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + { + $user_ids[] = $row['user_id']; + $usernames[$row['user_id']] = $row['username']; + } + } + $db->sql_freeresult($result); + } + + if ($posts_on_queue !== false) + { + $sql = 'SELECT u.user_id, u.username, COUNT(p.post_id) AS queue_posts + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE u.user_id <> ' . ANONYMOUS . ' + AND u.user_type <> ' . USER_FOUNDER . ' + AND ' . $db->sql_in_set('p.post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)) . ' + AND u.user_id = p.poster_id + ' . (!empty($user_ids) ? ' AND ' . $db->sql_in_set('p.poster_id', $user_ids) : '') . ' + GROUP BY p.poster_id + HAVING queue_posts ' . $key_match[$queue_select] . ' ' . $posts_on_queue; + $result = $db->sql_query($sql); + + // same intersection logic as the above group ID portion + $user_ids = $usernames = array(); + while ($row = $db->sql_fetchrow($result)) + { + // Do not prune bots and the user currently pruning. + if ($row['user_id'] != $user->data['user_id'] && !in_array($row['user_id'], $bot_ids)) + { + $user_ids[] = $row['user_id']; + $usernames[$row['user_id']] = $row['username']; + } + } + $db->sql_freeresult($result); + } + } +} diff --git a/install/update/old/includes/acp/acp_reasons.php b/install/update/old/includes/acp/acp_reasons.php new file mode 100644 index 0000000..dfb2ccb --- /dev/null +++ b/install/update/old/includes/acp/acp_reasons.php @@ -0,0 +1,394 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_reasons +{ + var $u_action; + + function main($id, $mode) + { + global $db, $user, $template; + global $request, $phpbb_log; + + $user->add_lang(array('mcp', 'acp/posting')); + + // Set up general vars + $action = $request->variable('action', ''); + $submit = (isset($_POST['submit'])) ? true : false; + $reason_id = $request->variable('id', 0); + + $this->tpl_name = 'acp_reasons'; + $this->page_title = 'ACP_REASONS'; + + $form_name = 'acp_reason'; + add_form_key('acp_reason'); + + $error = array(); + + switch ($action) + { + case 'add': + case 'edit': + + $reason_row = array( + 'reason_title' => $request->variable('reason_title', '', true), + 'reason_description' => $request->variable('reason_description', '', true), + ); + + if ($submit) + { + if (!check_form_key($form_name)) + { + $error[] = $user->lang['FORM_INVALID']; + } + // Reason specified? + if (!$reason_row['reason_title'] || !$reason_row['reason_description']) + { + $error[] = $user->lang['NO_REASON_INFO']; + } + + $check_double = ($action == 'add') ? true : false; + + if ($action == 'edit') + { + $sql = 'SELECT reason_title + FROM ' . REPORTS_REASONS_TABLE . " + WHERE reason_id = $reason_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (strtolower($row['reason_title']) == 'other' || strtolower($reason_row['reason_title']) == 'other') + { + $reason_row['reason_title'] = 'other'; + } + + if ($row['reason_title'] != $reason_row['reason_title']) + { + $check_double = true; + } + } + + // Check for same reason if adding it... + if ($check_double) + { + $sql = 'SELECT reason_id + FROM ' . REPORTS_REASONS_TABLE . " + WHERE reason_title = '" . $db->sql_escape($reason_row['reason_title']) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row || ($action == 'add' && strtolower($reason_row['reason_title']) == 'other')) + { + $error[] = $user->lang['REASON_ALREADY_EXIST']; + } + } + + if (!count($error)) + { + // New reason? + if ($action == 'add') + { + // Get new order... + $sql = 'SELECT MAX(reason_order) as max_reason_order + FROM ' . REPORTS_REASONS_TABLE; + $result = $db->sql_query($sql); + $max_order = (int) $db->sql_fetchfield('max_reason_order'); + $db->sql_freeresult($result); + + $sql_ary = array( + 'reason_title' => (string) $reason_row['reason_title'], + 'reason_description' => (string) $reason_row['reason_description'], + 'reason_order' => $max_order + 1 + ); + + $db->sql_query('INSERT INTO ' . REPORTS_REASONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $log = 'ADDED'; + } + else if ($reason_id) + { + $sql_ary = array( + 'reason_title' => (string) $reason_row['reason_title'], + 'reason_description' => (string) $reason_row['reason_description'], + ); + + $db->sql_query('UPDATE ' . REPORTS_REASONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE reason_id = ' . $reason_id); + + $log = 'UPDATED'; + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_REASON_' . $log, false, array($reason_row['reason_title'])); + trigger_error($user->lang['REASON_' . $log] . adm_back_link($this->u_action)); + } + } + else if ($reason_id) + { + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . ' + WHERE reason_id = ' . $reason_id; + $result = $db->sql_query($sql); + $reason_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$reason_row) + { + trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + $l_title = ($action == 'edit') ? 'EDIT' : 'ADD'; + + $translated = false; + + // If the reason is defined within the language file, we will use the localized version, else just use the database entry... + if (isset($user->lang['report_reasons']['TITLE'][strtoupper($reason_row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason_row['reason_title'])])) + { + $translated = true; + } + + $template->assign_vars(array( + 'L_TITLE' => $user->lang['REASON_' . $l_title], + 'U_ACTION' => $this->u_action . "&id=$reason_id&action=$action", + 'U_BACK' => $this->u_action, + 'ERROR_MSG' => (count($error)) ? implode('
', $error) : '', + + 'REASON_TITLE' => $reason_row['reason_title'], + 'REASON_DESCRIPTION' => $reason_row['reason_description'], + + 'TRANSLATED_TITLE' => ($translated) ? $user->lang['report_reasons']['TITLE'][strtoupper($reason_row['reason_title'])] : '', + 'TRANSLATED_DESCRIPTION'=> ($translated) ? $user->lang['report_reasons']['DESCRIPTION'][strtoupper($reason_row['reason_title'])] : '', + + 'S_AVAILABLE_TITLES' => implode($user->lang['COMMA_SEPARATOR'], array_map('htmlspecialchars', array_keys($user->lang['report_reasons']['TITLE']))), + 'S_EDIT_REASON' => true, + 'S_TRANSLATED' => $translated, + 'S_ERROR' => (count($error)) ? true : false, + ) + ); + + return; + break; + + case 'delete': + + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . ' + WHERE reason_id = ' . $reason_id; + $result = $db->sql_query($sql); + $reason_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$reason_row) + { + trigger_error($user->lang['NO_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + if (strtolower($reason_row['reason_title']) == 'other') + { + trigger_error($user->lang['NO_REMOVE_DEFAULT_REASON'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Let the deletion be confirmed... + if (confirm_box(true)) + { + $sql = 'SELECT reason_id + FROM ' . REPORTS_REASONS_TABLE . " + WHERE LOWER(reason_title) = 'other'"; + $result = $db->sql_query($sql); + $other_reason_id = (int) $db->sql_fetchfield('reason_id'); + $db->sql_freeresult($result); + + switch ($db->get_sql_layer()) + { + // The ugly one! + case 'mysqli': + case 'mysql4': + case 'mysql': + // Change the reports using this reason to 'other' + $sql = 'UPDATE ' . REPORTS_TABLE . ' + SET reason_id = ' . $other_reason_id . ", report_text = CONCAT('" . $db->sql_escape($reason_row['reason_description']) . "\n\n', report_text) + WHERE reason_id = $reason_id"; + break; + + // Standard? What's that? + case 'mssql_odbc': + case 'mssqlnative': + // Change the reports using this reason to 'other' + $sql = "DECLARE @ptrval binary(16) + + SELECT @ptrval = TEXTPTR(report_text) + FROM " . REPORTS_TABLE . " + WHERE reason_id = " . $reason_id . " + + UPDATETEXT " . REPORTS_TABLE . ".report_text @ptrval 0 0 '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' + + UPDATE " . REPORTS_TABLE . ' + SET reason_id = ' . $other_reason_id . " + WHERE reason_id = $reason_id"; + break; + + // Teh standard + case 'postgres': + case 'oracle': + case 'sqlite3': + // Change the reports using this reason to 'other' + $sql = 'UPDATE ' . REPORTS_TABLE . ' + SET reason_id = ' . $other_reason_id . ", report_text = '" . $db->sql_escape($reason_row['reason_description']) . "\n\n' || report_text + WHERE reason_id = $reason_id"; + break; + } + $db->sql_query($sql); + + $db->sql_query('DELETE FROM ' . REPORTS_REASONS_TABLE . ' WHERE reason_id = ' . $reason_id); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_REASON_REMOVED', false, array($reason_row['reason_title'])); + trigger_error($user->lang['REASON_REMOVED'] . adm_back_link($this->u_action)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'id' => $reason_id)) + ); + } + + break; + + case 'move_up': + case 'move_down': + + if (!check_link_hash($request->variable('hash', ''), 'acp_reasons')) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $sql = 'SELECT reason_order + FROM ' . REPORTS_REASONS_TABLE . " + WHERE reason_id = $reason_id"; + $result = $db->sql_query($sql); + $order = $db->sql_fetchfield('reason_order'); + $db->sql_freeresult($result); + + if ($order === false || ($order == 0 && $action == 'move_up')) + { + break; + } + $order = (int) $order; + $order_total = $order * 2 + (($action == 'move_up') ? -1 : 1); + + $sql = 'UPDATE ' . REPORTS_REASONS_TABLE . ' + SET reason_order = ' . $order_total . ' - reason_order + WHERE reason_order IN (' . $order . ', ' . (($action == 'move_up') ? $order - 1 : $order + 1) . ')'; + $db->sql_query($sql); + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'success' => (bool) $db->sql_affectedrows(), + )); + } + break; + } + + // By default, check that order is valid and fix it if necessary + $sql = 'SELECT reason_id, reason_order + FROM ' . REPORTS_REASONS_TABLE . ' + ORDER BY reason_order'; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $order = 0; + do + { + ++$order; + + if ($row['reason_order'] != $order) + { + $sql = 'UPDATE ' . REPORTS_REASONS_TABLE . " + SET reason_order = $order + WHERE reason_id = {$row['reason_id']}"; + $db->sql_query($sql); + } + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + ) + ); + + // Reason count + $sql = 'SELECT reason_id, COUNT(reason_id) AS reason_count + FROM ' . REPORTS_TABLE . ' + GROUP BY reason_id'; + $result = $db->sql_query($sql); + + $reason_count = array(); + while ($row = $db->sql_fetchrow($result)) + { + $reason_count[$row['reason_id']] = $row['reason_count']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT * + FROM ' . REPORTS_REASONS_TABLE . ' + ORDER BY reason_order ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $translated = false; + $other_reason = ($row['reason_title'] == 'other') ? true : false; + + // If the reason is defined within the language file, we will use the localized version, else just use the database entry... + if (isset($user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]) && isset($user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])])) + { + $row['reason_description'] = $user->lang['report_reasons']['DESCRIPTION'][strtoupper($row['reason_title'])]; + $row['reason_title'] = $user->lang['report_reasons']['TITLE'][strtoupper($row['reason_title'])]; + + $translated = true; + } + + $template->assign_block_vars('reasons', array( + 'REASON_TITLE' => $row['reason_title'], + 'REASON_DESCRIPTION' => $row['reason_description'], + 'REASON_COUNT' => (isset($reason_count[$row['reason_id']])) ? $reason_count[$row['reason_id']] : 0, + + 'S_TRANSLATED' => $translated, + 'S_OTHER_REASON' => $other_reason, + + 'U_EDIT' => $this->u_action . '&action=edit&id=' . $row['reason_id'], + 'U_DELETE' => (!$other_reason) ? $this->u_action . '&action=delete&id=' . $row['reason_id'] : '', + 'U_MOVE_UP' => $this->u_action . '&action=move_up&id=' . $row['reason_id'] . '&hash=' . generate_link_hash('acp_reasons'), + 'U_MOVE_DOWN' => $this->u_action . '&action=move_down&id=' . $row['reason_id'] . '&hash=' . generate_link_hash('acp_reasons')) + ); + } + $db->sql_freeresult($result); + } +} diff --git a/install/update/old/includes/acp/acp_styles.php b/install/update/old/includes/acp/acp_styles.php new file mode 100644 index 0000000..1bf5a3c --- /dev/null +++ b/install/update/old/includes/acp/acp_styles.php @@ -0,0 +1,1373 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_styles +{ + public $u_action; + + protected $u_base_action; + protected $s_hidden_fields; + protected $mode; + protected $styles_path; + protected $styles_path_absolute = 'styles'; + protected $default_style = 0; + protected $styles_list_cols = 0; + protected $reserved_style_names = array('adm', 'admin', 'all'); + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\template\template */ + protected $template; + + /** @var \phpbb\request\request_interface */ + protected $request; + + /** @var \phpbb\cache\driver\driver_interface */ + protected $cache; + + /** @var \phpbb\auth\auth */ + protected $auth; + + /** @var \phpbb\textformatter\cache_interface */ + protected $text_formatter_cache; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** @var \phpbb\event\dispatcher_interface */ + protected $dispatcher; + + public function main($id, $mode) + { + global $db, $user, $phpbb_admin_path, $phpbb_root_path, $phpEx, $template, $request, $cache, $auth, $config, $phpbb_dispatcher, $phpbb_container; + + $this->db = $db; + $this->user = $user; + $this->template = $template; + $this->request = $request; + $this->cache = $cache; + $this->auth = $auth; + $this->text_formatter_cache = $phpbb_container->get('text_formatter.cache'); + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $phpEx; + $this->dispatcher = $phpbb_dispatcher; + + $this->default_style = $config['default_style']; + $this->styles_path = $this->phpbb_root_path . $this->styles_path_absolute . '/'; + + $this->u_base_action = append_sid("{$phpbb_admin_path}index.{$this->php_ext}", "i={$id}"); + $this->s_hidden_fields = array( + 'mode' => $mode, + ); + + $this->user->add_lang('acp/styles'); + + $this->tpl_name = 'acp_styles'; + $this->page_title = 'ACP_CAT_STYLES'; + $this->mode = $mode; + + $action = $this->request->variable('action', ''); + $post_actions = array('install', 'activate', 'deactivate', 'uninstall'); + + foreach ($post_actions as $key) + { + if ($this->request->is_set_post($key)) + { + $action = $key; + } + } + + // The uninstall action uses confirm_box() to verify the validity of the request, + // so there is no need to check for a valid token here. + if (in_array($action, $post_actions) && $action != 'uninstall') + { + $is_valid_request = check_link_hash($request->variable('hash', ''), $action) || check_form_key('styles_management'); + + if (!$is_valid_request) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + if ($action != '') + { + $this->s_hidden_fields['action'] = $action; + } + + $this->template->assign_vars(array( + 'U_ACTION' => $this->u_base_action, + 'S_HIDDEN_FIELDS' => build_hidden_fields($this->s_hidden_fields) + ) + ); + + /** + * Run code before ACP styles action execution + * + * @event core.acp_styles_action_before + * @var int id Module ID + * @var string mode Active module + * @var string action Module that should be run + * @since 3.1.7-RC1 + */ + $vars = array('id', 'mode', 'action'); + extract($this->dispatcher->trigger_event('core.acp_styles_action_before', compact($vars))); + + // Execute actions + switch ($action) + { + case 'install': + $this->action_install(); + return; + case 'uninstall': + $this->action_uninstall(); + return; + case 'activate': + $this->action_activate(); + return; + case 'deactivate': + $this->action_deactivate(); + return; + case 'details': + $this->action_details(); + return; + default: + $this->frontend(); + } + } + + /** + * Main page + */ + protected function frontend() + { + add_form_key('styles_management'); + + // Check mode + switch ($this->mode) + { + case 'style': + $this->welcome_message('ACP_STYLES', 'ACP_STYLES_EXPLAIN'); + $this->show_installed(); + return; + case 'install': + $this->welcome_message('INSTALL_STYLES', 'INSTALL_STYLES_EXPLAIN'); + $this->show_available(); + return; + } + trigger_error($this->user->lang['NO_MODE'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + /** + * Install style(s) + */ + protected function action_install() + { + // Get list of styles to install + $dirs = $this->request_vars('dir', '', true); + + // Get list of styles that can be installed + $styles = $this->find_available(false); + + // Install each style + $messages = array(); + $installed_names = array(); + $installed_dirs = array(); + foreach ($dirs as $dir) + { + if (in_array($dir, $this->reserved_style_names)) + { + $messages[] = $this->user->lang('STYLE_NAME_RESERVED', htmlspecialchars($dir)); + continue; + } + + $found = false; + foreach ($styles as &$style) + { + // Check if: + // 1. Directory matches directory we are looking for + // 2. Style is not installed yet + // 3. Style with same name or directory hasn't been installed already within this function + if ($style['style_path'] == $dir && empty($style['_installed']) && !in_array($style['style_path'], $installed_dirs) && !in_array($style['style_name'], $installed_names)) + { + // Install style + $style['style_active'] = 1; + $style['style_id'] = $this->install_style($style); + $style['_installed'] = true; + $found = true; + $installed_names[] = $style['style_name']; + $installed_dirs[] = $style['style_path']; + $messages[] = sprintf($this->user->lang['STYLE_INSTALLED'], htmlspecialchars($style['style_name'])); + } + } + if (!$found) + { + $messages[] = sprintf($this->user->lang['STYLE_NOT_INSTALLED'], htmlspecialchars($dir)); + } + } + + // Invalidate the text formatter's cache for the new styles to take effect + if (!empty($installed_names)) + { + $this->text_formatter_cache->invalidate(); + } + + // Show message + if (!count($messages)) + { + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + $message = implode('
', $messages); + $message .= '

« ' . $this->user->lang('STYLE_INSTALLED_RETURN_INSTALLED_STYLES') . ''; + $message .= '

» ' . $this->user->lang('STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES') . ''; + trigger_error($message, E_USER_NOTICE); + } + + /** + * Confirm styles removal + */ + protected function action_uninstall() + { + // Get list of styles to uninstall + $ids = $this->request_vars('id', 0, true); + + // Check if confirmation box was submitted + if (confirm_box(true)) + { + // Uninstall + $this->action_uninstall_confirmed($ids, $this->request->variable('confirm_delete_files', false)); + return; + } + + // Confirm box + $s_hidden = build_hidden_fields(array( + 'action' => 'uninstall', + 'ids' => $ids + )); + $this->template->assign_var('S_CONFIRM_DELETE', true); + confirm_box(false, $this->user->lang['CONFIRM_UNINSTALL_STYLES'], $s_hidden, 'acp_styles.html'); + + // Canceled - show styles list + $this->frontend(); + } + + /** + * Uninstall styles(s) + * + * @param array $ids List of style IDs + * @param bool $delete_files If true, script will attempt to remove files for selected styles + */ + protected function action_uninstall_confirmed($ids, $delete_files) + { + global $user, $phpbb_log; + + $default = $this->default_style; + $uninstalled = array(); + $messages = array(); + + // Check styles list + foreach ($ids as $id) + { + if (!$id) + { + trigger_error($this->user->lang['INVALID_STYLE_ID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + if ($id == $default) + { + trigger_error($this->user->lang['UNINSTALL_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); + } + $uninstalled[$id] = false; + } + + // Order by reversed style_id, so parent styles would be removed after child styles + // This way parent and child styles can be removed in same function call + $sql = 'SELECT * + FROM ' . STYLES_TABLE . ' + WHERE style_id IN (' . implode(', ', $ids) . ') + ORDER BY style_id DESC'; + $result = $this->db->sql_query($sql); + + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + // Uinstall each style + $uninstalled = array(); + foreach ($rows as $style) + { + $result = $this->uninstall_style($style, $delete_files); + + if (is_string($result)) + { + $messages[] = $result; + continue; + } + $messages[] = sprintf($this->user->lang['STYLE_UNINSTALLED'], $style['style_name']); + $uninstalled[] = $style['style_name']; + + // Attempt to delete files + if ($delete_files) + { + $messages[] = sprintf($this->user->lang[$this->delete_style_files($style['style_path']) ? 'DELETE_STYLE_FILES_SUCCESS' : 'DELETE_STYLE_FILES_FAILED'], $style['style_name']); + } + } + + if (empty($messages)) + { + // Nothing to uninstall? + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Log action + if (count($uninstalled)) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_DELETE', false, array(implode(', ', $uninstalled))); + } + + // Clear cache + $this->cache->purge(); + + // Show message + trigger_error(implode('
', $messages) . adm_back_link($this->u_action), E_USER_NOTICE); + } + + /** + * Activate styles + */ + protected function action_activate() + { + // Get list of styles to activate + $ids = $this->request_vars('id', 0, true); + + // Activate styles + $sql = 'UPDATE ' . STYLES_TABLE . ' + SET style_active = 1 + WHERE style_id IN (' . implode(', ', $ids) . ')'; + $this->db->sql_query($sql); + + // Purge cache + $this->cache->destroy('sql', STYLES_TABLE); + + // Show styles list + $this->frontend(); + } + + /** + * Deactivate styles + */ + protected function action_deactivate() + { + // Get list of styles to deactivate + $ids = $this->request_vars('id', 0, true); + + // Check for default style + foreach ($ids as $id) + { + if ($id == $this->default_style) + { + trigger_error($this->user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + // Reset default style for users who use selected styles + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $this->default_style . ' + WHERE user_style IN (' . implode(', ', $ids) . ')'; + $this->db->sql_query($sql); + + // Deactivate styles + $sql = 'UPDATE ' . STYLES_TABLE . ' + SET style_active = 0 + WHERE style_id IN (' . implode(', ', $ids) . ')'; + $this->db->sql_query($sql); + + // Purge cache + $this->cache->destroy('sql', STYLES_TABLE); + + // Show styles list + $this->frontend(); + } + + /** + * Show style details + */ + protected function action_details() + { + global $user, $phpbb_log; + + $id = $this->request->variable('id', 0); + if (!$id) + { + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Get all styles + $styles = $this->get_styles(); + usort($styles, array($this, 'sort_styles')); + + // Find current style + $style = false; + foreach ($styles as $row) + { + if ($row['style_id'] == $id) + { + $style = $row; + break; + } + } + + if ($style === false) + { + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Read style configuration file + $style_cfg = $this->read_style_cfg($style['style_path']); + + // Find all available parent styles + $list = $this->find_possible_parents($styles, $id); + + // Add form key + $form_key = 'acp_styles'; + add_form_key($form_key); + + // Change data + if ($this->request->variable('update', false)) + { + if (!check_form_key($form_key)) + { + trigger_error($this->user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $update = array( + 'style_name' => trim($this->request->variable('style_name', $style['style_name'])), + 'style_parent_id' => $this->request->variable('style_parent', (int) $style['style_parent_id']), + 'style_active' => $this->request->variable('style_active', (int) $style['style_active']), + ); + $update_action = $this->u_action . '&action=details&id=' . $id; + + // Check style name + if ($update['style_name'] != $style['style_name']) + { + if (!strlen($update['style_name'])) + { + trigger_error($this->user->lang['STYLE_ERR_STYLE_NAME'] . adm_back_link($update_action), E_USER_WARNING); + } + foreach ($styles as $row) + { + if ($row['style_name'] == $update['style_name']) + { + trigger_error($this->user->lang['STYLE_ERR_NAME_EXIST'] . adm_back_link($update_action), E_USER_WARNING); + } + } + } + else + { + unset($update['style_name']); + } + + // Check parent style id + if ($update['style_parent_id'] != $style['style_parent_id']) + { + if ($update['style_parent_id'] != 0) + { + $found = false; + foreach ($list as $row) + { + if ($row['style_id'] == $update['style_parent_id']) + { + $found = true; + $update['style_parent_tree'] = ($row['style_parent_tree'] != '' ? $row['style_parent_tree'] . '/' : '') . $row['style_path']; + break; + } + } + if (!$found) + { + trigger_error($this->user->lang['STYLE_ERR_INVALID_PARENT'] . adm_back_link($update_action), E_USER_WARNING); + } + } + else + { + $update['style_parent_tree'] = ''; + } + } + else + { + unset($update['style_parent_id']); + } + + // Check style_active + if ($update['style_active'] != $style['style_active']) + { + if (!$update['style_active'] && $this->default_style == $style['style_id']) + { + trigger_error($this->user->lang['DEACTIVATE_DEFAULT'] . adm_back_link($update_action), E_USER_WARNING); + } + } + else + { + unset($update['style_active']); + } + + // Update data + if (count($update)) + { + $sql = 'UPDATE ' . STYLES_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $update) . " + WHERE style_id = $id"; + $this->db->sql_query($sql); + + $style = array_merge($style, $update); + + if (isset($update['style_parent_id'])) + { + // Update styles tree + $styles = $this->get_styles(); + if ($this->update_styles_tree($styles, $style)) + { + // Something was changed in styles tree, purge all cache + $this->cache->purge(); + } + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_EDIT_DETAILS', false, array($style['style_name'])); + } + + // Update default style + $default = $this->request->variable('style_default', 0); + if ($default) + { + if (!$style['style_active']) + { + trigger_error($this->user->lang['STYLE_DEFAULT_CHANGE_INACTIVE'] . adm_back_link($update_action), E_USER_WARNING); + } + $this->config->set('default_style', $id); + $this->cache->purge(); + } + + // Show styles list + $this->frontend(); + return; + } + + // Show page title + $this->welcome_message('ACP_STYLES', null); + + // Show parent styles + foreach ($list as $row) + { + $this->template->assign_block_vars('parent_styles', array( + 'STYLE_ID' => $row['style_id'], + 'STYLE_NAME' => htmlspecialchars($row['style_name']), + 'LEVEL' => $row['level'], + 'SPACER' => str_repeat('  ', $row['level']), + ) + ); + } + + // Show style details + $this->template->assign_vars(array( + 'S_STYLE_DETAILS' => true, + 'STYLE_ID' => $style['style_id'], + 'STYLE_NAME' => htmlspecialchars($style['style_name']), + 'STYLE_PATH' => htmlspecialchars($style['style_path']), + 'STYLE_VERSION' => htmlspecialchars($style_cfg['style_version']), + 'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']), + 'STYLE_PARENT' => $style['style_parent_id'], + 'S_STYLE_ACTIVE' => $style['style_active'], + 'S_STYLE_DEFAULT' => ($style['style_id'] == $this->default_style) + ) + ); + } + + /** + * List installed styles + */ + protected function show_installed() + { + // Get all installed styles + $styles = $this->get_styles(); + + if (!count($styles)) + { + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + usort($styles, array($this, 'sort_styles')); + + // Get users + $users = $this->get_users(); + + // Add users counter to rows + foreach ($styles as &$style) + { + $style['_users'] = isset($users[$style['style_id']]) ? $users[$style['style_id']] : 0; + } + + // Set up styles list variables + // Addons should increase this number and update template variable + $this->styles_list_cols = 4; + $this->template->assign_var('STYLES_LIST_COLS', $this->styles_list_cols); + + // Show styles list + $this->show_styles_list($styles, 0, 0); + + // Show styles with invalid inherits_id + foreach ($styles as $style) + { + if (empty($style['_shown'])) + { + $style['_note'] = sprintf($this->user->lang['REQUIRES_STYLE'], htmlspecialchars($style['style_parent_tree'])); + $this->list_style($style, 0); + } + } + + // Add buttons + $this->template->assign_block_vars('extra_actions', array( + 'ACTION_NAME' => 'activate', + 'L_ACTION' => $this->user->lang['STYLE_ACTIVATE'], + ) + ); + + $this->template->assign_block_vars('extra_actions', array( + 'ACTION_NAME' => 'deactivate', + 'L_ACTION' => $this->user->lang['STYLE_DEACTIVATE'], + ) + ); + + if (isset($this->style_counters) && $this->style_counters['total'] > 1) + { + $this->template->assign_block_vars('extra_actions', array( + 'ACTION_NAME' => 'uninstall', + 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL'], + ) + ); + } + } + + /** + * Show list of styles that can be installed + */ + protected function show_available() + { + // Get list of styles + $styles = $this->find_available(true); + + // Show styles + if (empty($styles)) + { + trigger_error($this->user->lang['NO_UNINSTALLED_STYLE'] . adm_back_link($this->u_base_action), E_USER_NOTICE); + } + + usort($styles, array($this, 'sort_styles')); + + $this->styles_list_cols = 3; + $this->template->assign_vars(array( + 'STYLES_LIST_COLS' => $this->styles_list_cols, + 'STYLES_LIST_HIDE_COUNT' => true + ) + ); + + // Show styles + foreach ($styles as &$style) + { + // Check if style has a parent style in styles list + $has_parent = false; + if ($style['_inherit_name'] != '') + { + foreach ($styles as $parent_style) + { + if ($parent_style['style_name'] == $style['_inherit_name'] && empty($parent_style['_shown'])) + { + // Show parent style first + $has_parent = true; + } + } + } + if (!$has_parent) + { + $this->list_style($style, 0); + $this->show_available_child_styles($styles, $style['style_name'], 1); + } + } + + // Show styles that do not have parent style in styles list + foreach ($styles as $style) + { + if (empty($style['_shown'])) + { + $this->list_style($style, 0); + } + } + + // Add button + if (isset($this->style_counters) && $this->style_counters['caninstall'] > 0) + { + $this->template->assign_block_vars('extra_actions', array( + 'ACTION_NAME' => 'install', + 'L_ACTION' => $this->user->lang['INSTALL_STYLES'], + ) + ); + } + } + + /** + * Find styles available for installation + * + * @param bool $all if true, function will return all installable styles. if false, function will return only styles that can be installed + * @return array List of styles + */ + protected function find_available($all) + { + // Get list of installed styles + $installed = $this->get_styles(); + + $installed_dirs = array(); + $installed_names = array(); + foreach ($installed as $style) + { + $installed_dirs[] = $style['style_path']; + $installed_names[$style['style_name']] = array( + 'path' => $style['style_path'], + 'id' => $style['style_id'], + 'parent' => $style['style_parent_id'], + 'tree' => (strlen($style['style_parent_tree']) ? $style['style_parent_tree'] . '/' : '') . $style['style_path'], + ); + } + + // Get list of directories + $dirs = $this->find_style_dirs(); + + // Find styles that can be installed + $styles = array(); + foreach ($dirs as $dir) + { + if (in_array($dir, $installed_dirs)) + { + // Style is already installed + continue; + } + $cfg = $this->read_style_cfg($dir); + if ($cfg === false) + { + // Invalid style.cfg + continue; + } + + // Style should be available for installation + $parent = $cfg['parent']; + $style = array( + 'style_id' => 0, + 'style_name' => $cfg['name'], + 'style_copyright' => $cfg['copyright'], + 'style_active' => 0, + 'style_path' => $dir, + 'bbcode_bitfield' => $cfg['template_bitfield'], + 'style_parent_id' => 0, + 'style_parent_tree' => '', + // Extra values for styles list + // All extra variable start with _ so they won't be confused with data that can be added to styles table + '_inherit_name' => $parent, + '_available' => true, + '_note' => '', + ); + + // Check style inheritance + if ($parent != '') + { + if (isset($installed_names[$parent])) + { + // Parent style is installed + $row = $installed_names[$parent]; + $style['style_parent_id'] = $row['id']; + $style['style_parent_tree'] = $row['tree']; + } + else + { + // Parent style is not installed yet + $style['_available'] = false; + $style['_note'] = sprintf($this->user->lang['REQUIRES_STYLE'], htmlspecialchars($parent)); + } + } + + if ($all || $style['_available']) + { + $styles[] = $style; + } + } + + return $styles; + } + + /** + * Show styles list + * + * @param array $styles styles list + * @param int $parent parent style id + * @param int $level style inheritance level + */ + protected function show_styles_list(&$styles, $parent, $level) + { + foreach ($styles as &$style) + { + if (empty($style['_shown']) && $style['style_parent_id'] == $parent) + { + $this->list_style($style, $level); + $this->show_styles_list($styles, $style['style_id'], $level + 1); + } + } + } + + /** + * Show available styles tree + * + * @param array $styles Styles list, passed as reference + * @param string $name Name of parent style + * @param int $level Styles tree level + */ + protected function show_available_child_styles(&$styles, $name, $level) + { + foreach ($styles as &$style) + { + if (empty($style['_shown']) && $style['_inherit_name'] == $name) + { + $this->list_style($style, $level); + $this->show_available_child_styles($styles, $style['style_name'], $level + 1); + } + } + } + + /** + * Update styles tree + * + * @param array $styles Styles list, passed as reference + * @param array|false $style Current style, false if root + * @return bool True if something was updated, false if not + */ + protected function update_styles_tree(&$styles, $style = false) + { + $parent_id = ($style === false) ? 0 : $style['style_id']; + $parent_tree = ($style === false) ? '' : ($style['style_parent_tree'] == '' ? '' : $style['style_parent_tree']) . $style['style_path']; + $update = false; + $updated = false; + foreach ($styles as &$row) + { + if ($row['style_parent_id'] == $parent_id) + { + if ($row['style_parent_tree'] != $parent_tree) + { + $row['style_parent_tree'] = $parent_tree; + $update = true; + } + $updated |= $this->update_styles_tree($styles, $row); + } + } + if ($update) + { + $sql = 'UPDATE ' . STYLES_TABLE . " + SET style_parent_tree = '" . $this->db->sql_escape($parent_tree) . "' + WHERE style_parent_id = {$parent_id}"; + $this->db->sql_query($sql); + $updated = true; + } + return $updated; + } + + /** + * Find all possible parent styles for style + * + * @param array $styles list of styles + * @param int $id id of style + * @param int $parent current parent style id + * @param int $level current tree level + * @return array Style ids, names and levels + */ + protected function find_possible_parents($styles, $id = -1, $parent = 0, $level = 0) + { + $results = array(); + foreach ($styles as $style) + { + if ($style['style_id'] != $id && $style['style_parent_id'] == $parent) + { + $results[] = array( + 'style_id' => $style['style_id'], + 'style_name' => $style['style_name'], + 'style_path' => $style['style_path'], + 'style_parent_id' => $style['style_parent_id'], + 'style_parent_tree' => $style['style_parent_tree'], + 'level' => $level + ); + $results = array_merge($results, $this->find_possible_parents($styles, $id, $style['style_id'], $level + 1)); + } + } + return $results; + } + + /** + * Show item in styles list + * + * @param array $style style row + * @param int $level style inheritance level + */ + protected function list_style(&$style, $level) + { + // Mark row as shown + if (!empty($style['_shown'])) + { + return; + } + + $style['_shown'] = true; + + // Generate template variables + $actions = array(); + $row = array( + // Style data + 'STYLE_ID' => $style['style_id'], + 'STYLE_NAME' => htmlspecialchars($style['style_name']), + 'STYLE_PHPBB_VERSION' => $this->read_style_cfg($style['style_path'])['phpbb_version'], + 'STYLE_PATH' => htmlspecialchars($style['style_path']), + 'STYLE_COPYRIGHT' => strip_tags($style['style_copyright']), + 'STYLE_ACTIVE' => $style['style_active'], + + // Additional data + 'DEFAULT' => ($style['style_id'] && $style['style_id'] == $this->default_style), + 'USERS' => (isset($style['_users'])) ? $style['_users'] : '', + 'LEVEL' => $level, + 'PADDING' => (4 + 16 * $level), + 'SHOW_COPYRIGHT' => ($style['style_id']) ? false : true, + 'STYLE_PATH_FULL' => htmlspecialchars($this->styles_path_absolute . '/' . $style['style_path']) . '/', + + // Comment to show below style + 'COMMENT' => (isset($style['_note'])) ? $style['_note'] : '', + + // The following variables should be used by hooks to add custom HTML code + 'EXTRA' => '', + 'EXTRA_OPTIONS' => '' + ); + + // Status specific data + if ($style['style_id']) + { + // Style is installed + + // Details + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=details&id=' . $style['style_id'], + 'L_ACTION' => $this->user->lang['DETAILS'] + ); + + // Activate/Deactive + $action_name = ($style['style_active'] ? 'de' : '') . 'activate'; + + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=' . $action_name . '&hash=' . generate_link_hash($action_name) . '&id=' . $style['style_id'], + 'L_ACTION' => $this->user->lang['STYLE_' . ($style['style_active'] ? 'DE' : '') . 'ACTIVATE'] + ); + +/* // Export + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=export&hash=' . generate_link_hash('export') . '&id=' . $style['style_id'], + 'L_ACTION' => $this->user->lang['EXPORT'] + ); */ + + // Uninstall + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=uninstall&hash=' . generate_link_hash('uninstall') . '&id=' . $style['style_id'], + 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL'] + ); + + // Preview + $actions[] = array( + 'U_ACTION' => append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'style=' . $style['style_id']), + 'L_ACTION' => $this->user->lang['PREVIEW'] + ); + } + else + { + // Style is not installed + if (empty($style['_available'])) + { + $actions[] = array( + 'HTML' => $this->user->lang['CANNOT_BE_INSTALLED'] + ); + } + else + { + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=install&hash=' . generate_link_hash('install') . '&dir=' . urlencode($style['style_path']), + 'L_ACTION' => $this->user->lang['INSTALL_STYLE'] + ); + } + } + + // todo: add hook + + // Assign template variables + $this->template->assign_block_vars('styles_list', $row); + foreach ($actions as $action) + { + $this->template->assign_block_vars('styles_list.actions', $action); + } + + // Increase counters + $counter = ($style['style_id']) ? ($style['style_active'] ? 'active' : 'inactive') : (empty($style['_available']) ? 'cannotinstall' : 'caninstall'); + if (!isset($this->style_counters)) + { + $this->style_counters = array( + 'total' => 0, + 'active' => 0, + 'inactive' => 0, + 'caninstall' => 0, + 'cannotinstall' => 0 + ); + } + $this->style_counters[$counter]++; + $this->style_counters['total']++; + } + + /** + * Show welcome message + * + * @param string $title main title + * @param string $description page description + */ + protected function welcome_message($title, $description) + { + $this->template->assign_vars(array( + 'L_TITLE' => $this->user->lang[$title], + 'L_EXPLAIN' => (isset($this->user->lang[$description])) ? $this->user->lang[$description] : '' + ) + ); + } + + /** + * Find all directories that have styles + * + * @return array Directory names + */ + protected function find_style_dirs() + { + $styles = array(); + + $dp = @opendir($this->styles_path); + if ($dp) + { + while (($file = readdir($dp)) !== false) + { + $dir = $this->styles_path . $file; + if ($file[0] == '.' || !is_dir($dir)) + { + continue; + } + + if (file_exists("{$dir}/style.cfg")) + { + $styles[] = $file; + } + } + closedir($dp); + } + + return $styles; + } + + /** + * Sort styles + */ + public function sort_styles($style1, $style2) + { + if ($style1['style_active'] != $style2['style_active']) + { + return ($style1['style_active']) ? -1 : 1; + } + if (isset($style1['_available']) && $style1['_available'] != $style2['_available']) + { + return ($style1['_available']) ? -1 : 1; + } + return strcasecmp(isset($style1['style_name']) ? $style1['style_name'] : $style1['name'], isset($style2['style_name']) ? $style2['style_name'] : $style2['name']); + } + + /** + * Read style configuration file + * + * @param string $dir style directory + * @return array|bool Style data, false on error + */ + protected function read_style_cfg($dir) + { + static $required = array('name', 'phpbb_version', 'copyright'); + $cfg = parse_cfg_file($this->styles_path . $dir . '/style.cfg'); + + // Check if it is a valid file + foreach ($required as $key) + { + if (!isset($cfg[$key])) + { + return false; + } + } + + // Check data + if (!isset($cfg['parent']) || !is_string($cfg['parent']) || $cfg['parent'] == $cfg['name']) + { + $cfg['parent'] = ''; + } + if (!isset($cfg['template_bitfield'])) + { + $cfg['template_bitfield'] = $this->default_bitfield(); + } + + return $cfg; + } + + /** + * Install style + * + * @param array $style style data + * @return int Style id + */ + protected function install_style($style) + { + global $user, $phpbb_log; + + // Generate row + $sql_ary = array(); + foreach ($style as $key => $value) + { + if ($key != 'style_id' && substr($key, 0, 1) != '_') + { + $sql_ary[$key] = $value; + } + } + + // Add to database + $this->db->sql_transaction('begin'); + + $sql = 'INSERT INTO ' . STYLES_TABLE . ' + ' . $this->db->sql_build_array('INSERT', $sql_ary); + $this->db->sql_query($sql); + + $id = $this->db->sql_nextid(); + + $this->db->sql_transaction('commit'); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_STYLE_ADD', false, array($sql_ary['style_name'])); + + return $id; + } + + /** + * Lists all styles + * + * @return array Rows with styles data + */ + protected function get_styles() + { + $sql = 'SELECT * + FROM ' . STYLES_TABLE; + $result = $this->db->sql_query($sql); + + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + return $rows; + } + + /** + * Count users for each style + * + * @return array Styles in following format: [style_id] = number of users + */ + protected function get_users() + { + $sql = 'SELECT user_style, COUNT(user_style) AS style_count + FROM ' . USERS_TABLE . ' + GROUP BY user_style'; + $result = $this->db->sql_query($sql); + + $style_count = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $style_count[$row['user_style']] = $row['style_count']; + } + $this->db->sql_freeresult($result); + + return $style_count; + } + + /** + * Uninstall style + * + * @param array $style Style data + * @return bool|string True on success, error message on error + */ + protected function uninstall_style($style) + { + $id = $style['style_id']; + $path = $style['style_path']; + + // Check if style has child styles + $sql = 'SELECT style_id + FROM ' . STYLES_TABLE . ' + WHERE style_parent_id = ' . (int) $id . " OR style_parent_tree = '" . $this->db->sql_escape($path) . "'"; + $result = $this->db->sql_query($sql); + + $conflict = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($conflict !== false) + { + return sprintf($this->user->lang['STYLE_UNINSTALL_DEPENDENT'], $style['style_name']); + } + + // Change default style for users + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_style = ' . (int) $this->default_style . ' + WHERE user_style = ' . $id; + $this->db->sql_query($sql); + + // Uninstall style + $sql = 'DELETE FROM ' . STYLES_TABLE . ' + WHERE style_id = ' . $id; + $this->db->sql_query($sql); + return true; + } + + /** + * Delete all files in style directory + * + * @param string $path Style directory + * @param string $dir Directory to remove inside style's directory + * @return bool True on success, false on error + */ + protected function delete_style_files($path, $dir = '') + { + $dirname = $this->styles_path . $path . $dir; + $result = true; + + $dp = @opendir($dirname); + + if ($dp) + { + while (($file = readdir($dp)) !== false) + { + if ($file == '.' || $file == '..') + { + continue; + } + $filename = $dirname . '/' . $file; + if (is_dir($filename)) + { + if (!$this->delete_style_files($path, $dir . '/' . $file)) + { + $result = false; + } + } + else + { + if (!@unlink($filename)) + { + $result = false; + } + } + } + closedir($dp); + } + if (!@rmdir($dirname)) + { + return false; + } + + return $result; + } + + /** + * Get list of items from posted data + * + * @param string $name Variable name + * @param string|int $default Default value for array + * @param bool $error If true, error will be triggered if list is empty + * @return array Items + */ + protected function request_vars($name, $default, $error = false) + { + $item = $this->request->variable($name, $default); + $items = $this->request->variable($name . 's', array($default)); + + if (count($items) == 1 && $items[0] == $default) + { + $items = array(); + } + + if ($item != $default && !count($items)) + { + $items[] = $item; + } + + if ($error && !count($items)) + { + trigger_error($this->user->lang['NO_MATCHING_STYLES_FOUND'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + return $items; + } + + /** + * Generates default bitfield + * + * This bitfield decides which bbcodes are defined in a template. + * + * @return string Bitfield + */ + protected function default_bitfield() + { + static $value; + if (isset($value)) + { + return $value; + } + + // Hardcoded template bitfield to add for new templates + $default_bitfield = '1111111111111'; + + $bitfield = new bitfield(); + for ($i = 0; $i < strlen($default_bitfield); $i++) + { + if ($default_bitfield[$i] == '1') + { + $bitfield->set($i); + } + } + + return $bitfield->get_base64(); + } + +} diff --git a/install/update/old/includes/acp/acp_update.php b/install/update/old/includes/acp/acp_update.php new file mode 100644 index 0000000..9124a59 --- /dev/null +++ b/install/update/old/includes/acp/acp_update.php @@ -0,0 +1,86 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_update +{ + var $u_action; + + function main($id, $mode) + { + global $config, $user, $template, $request; + global $phpbb_root_path, $phpEx, $phpbb_container; + + $user->add_lang('install'); + + $this->tpl_name = 'acp_update'; + $this->page_title = 'ACP_VERSION_CHECK'; + + /* @var $version_helper \phpbb\version_helper */ + $version_helper = $phpbb_container->get('version_helper'); + try + { + $recheck = $request->variable('versioncheck_force', false); + $updates_available = $version_helper->get_update_on_branch($recheck); + $upgrades_available = $version_helper->get_suggested_updates(); + if (!empty($upgrades_available)) + { + $upgrades_available = array_pop($upgrades_available); + } + } + catch (\RuntimeException $e) + { + $template->assign_var('S_VERSIONCHECK_FAIL', true); + + $updates_available = array(); + } + + if (!empty($updates_available)) + { + $template->assign_block_vars('updates_available', $updates_available); + } + + $update_link = $phpbb_root_path . 'install/app.' . $phpEx; + + $template->assign_vars(array( + 'S_UP_TO_DATE' => empty($updates_available), + 'U_ACTION' => $this->u_action, + 'U_VERSIONCHECK_FORCE' => append_sid($this->u_action . '&versioncheck_force=1'), + + 'CURRENT_VERSION' => $config['version'], + + 'UPDATE_INSTRUCTIONS' => sprintf($user->lang['UPDATE_INSTRUCTIONS'], $update_link), + 'S_VERSION_UPGRADEABLE' => !empty($upgrades_available), + 'UPGRADE_INSTRUCTIONS' => !empty($upgrades_available) ? $user->lang('UPGRADE_INSTRUCTIONS', $upgrades_available['current'], $upgrades_available['announcement']) : false, + )); + + // Incomplete update? + if (phpbb_version_compare($config['version'], PHPBB_VERSION, '<')) + { + $database_update_link = $phpbb_root_path . 'install/app.php/update'; + + $template->assign_vars(array( + 'S_UPDATE_INCOMPLETE' => true, + 'FILES_VERSION' => PHPBB_VERSION, + 'INCOMPLETE_INSTRUCTIONS' => $user->lang('UPDATE_INCOMPLETE_EXPLAIN', $database_update_link), + )); + } + } +} diff --git a/install/update/old/includes/acp/acp_users.php b/install/update/old/includes/acp/acp_users.php new file mode 100644 index 0000000..2d1eaad --- /dev/null +++ b/install/update/old/includes/acp/acp_users.php @@ -0,0 +1,2692 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class acp_users +{ + var $u_action; + var $p_master; + + function __construct($p_master) + { + $this->p_master = $p_master; + } + + function main($id, $mode) + { + global $config, $db, $user, $auth, $template; + global $phpbb_root_path, $phpbb_admin_path, $phpEx; + global $phpbb_dispatcher, $request; + global $phpbb_container, $phpbb_log; + + $user->add_lang(array('posting', 'ucp', 'acp/users')); + $this->tpl_name = 'acp_users'; + + $error = array(); + $username = $request->variable('username', '', true); + $user_id = $request->variable('u', 0); + $action = $request->variable('action', ''); + + // Get referer to redirect user to the appropriate page after delete action + $redirect = $request->variable('redirect', ''); + $redirect_tag = "redirect=$redirect"; + $redirect_url = append_sid("{$phpbb_admin_path}index.$phpEx", "i=$redirect"); + + $submit = (isset($_POST['update']) && !isset($_POST['cancel'])) ? true : false; + + $form_name = 'acp_users'; + add_form_key($form_name); + + // Whois (special case) + if ($action == 'whois') + { + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $this->page_title = 'WHOIS'; + $this->tpl_name = 'simple_body'; + + $user_ip = phpbb_ip_normalise($request->variable('user_ip', '')); + $domain = gethostbyaddr($user_ip); + $ipwhois = user_ipwhois($user_ip); + + $template->assign_vars(array( + 'MESSAGE_TITLE' => sprintf($user->lang['IP_WHOIS_FOR'], $domain), + 'MESSAGE_TEXT' => nl2br($ipwhois)) + ); + + return; + } + + // Show user selection mask + if (!$username && !$user_id) + { + $this->page_title = 'SELECT_USER'; + + $template->assign_vars(array( + 'U_ACTION' => $this->u_action, + 'ANONYMOUS_USER_ID' => ANONYMOUS, + + 'S_SELECT_USER' => true, + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=select_user&field=username&select_single=true'), + )); + + return; + } + + if (!$user_id) + { + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $result = $db->sql_query($sql); + $user_id = (int) $db->sql_fetchfield('user_id'); + $db->sql_freeresult($result); + + if (!$user_id) + { + trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); + } + } + + // Generate content for all modes + $sql = 'SELECT u.*, s.* + FROM ' . USERS_TABLE . ' u + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) + WHERE u.user_id = ' . $user_id . ' + ORDER BY s.session_time DESC'; + $result = $db->sql_query_limit($sql, 1); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + trigger_error($user->lang['NO_USER'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + // Generate overall "header" for user admin + $s_form_options = ''; + + // Build modes dropdown list + $sql = 'SELECT module_mode, module_auth + FROM ' . MODULES_TABLE . " + WHERE module_basename = 'acp_users' + AND module_enabled = 1 + AND module_class = 'acp' + ORDER BY left_id, module_mode"; + $result = $db->sql_query($sql); + + $dropdown_modes = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!$this->p_master->module_auth_self($row['module_auth'])) + { + continue; + } + + $dropdown_modes[$row['module_mode']] = true; + } + $db->sql_freeresult($result); + + foreach ($dropdown_modes as $module_mode => $null) + { + $selected = ($mode == $module_mode) ? ' selected="selected"' : ''; + $s_form_options .= ''; + } + + $template->assign_vars(array( + 'U_BACK' => (empty($redirect)) ? $this->u_action : $redirect_url, + 'U_MODE_SELECT' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=$id&u=$user_id"), + 'U_ACTION' => $this->u_action . '&u=' . $user_id . ((empty($redirect)) ? '' : '&' . $redirect_tag), + 'S_FORM_OPTIONS' => $s_form_options, + 'MANAGED_USERNAME' => $user_row['username']) + ); + + // Prevent normal users/admins change/view founders if they are not a founder by themselves + if ($user->data['user_type'] != USER_FOUNDER && $user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['NOT_MANAGE_FOUNDER'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + $this->page_title = $user_row['username'] . ' :: ' . $user->lang('ACP_USER_' . strtoupper($mode)); + + switch ($mode) + { + case 'overview': + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $user->add_lang('acp/ban'); + + $delete = $request->variable('delete', 0); + $delete_type = $request->variable('delete_type', ''); + $ip = $request->variable('ip', 'ip'); + + /** + * Run code at beginning of ACP users overview + * + * @event core.acp_users_overview_before + * @var array user_row Current user data + * @var string mode Active module + * @var string action Module that should be run + * @var bool submit Do we display the form only + * or did the user press submit + * @var array error Array holding error messages + * @since 3.1.3-RC1 + */ + $vars = array('user_row', 'mode', 'action', 'submit', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_before', compact($vars))); + + if ($submit) + { + if ($delete) + { + if (!$auth->acl_get('a_userdel')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NO_AUTH_OPERATION'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Check if the user wants to remove himself or the guest user account + if ($user_id == ANONYMOUS) + { + trigger_error($user->lang['CANNOT_REMOVE_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Founders can not be deleted. + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_REMOVE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_id == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_REMOVE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($delete_type) + { + if (confirm_box(true)) + { + user_delete($delete_type, $user_id, $user_row['username']); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DELETED', false, array($user_row['username'])); + trigger_error($user->lang['USER_DELETED'] . adm_back_link( + (empty($redirect)) ? $this->u_action : $redirect_url + ) + ); + } + else + { + $delete_confirm_hidden_fields = array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true, + 'delete' => 1, + 'delete_type' => $delete_type, + ); + + // Checks if the redirection page is specified + if (!empty($redirect)) + { + $delete_confirm_hidden_fields['redirect'] = $redirect; + } + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($delete_confirm_hidden_fields)); + } + } + else + { + trigger_error($user->lang['NO_MODE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + + // Handle quicktool actions + switch ($action) + { + case 'banuser': + case 'banemail': + case 'banip': + + if ($user_id == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_BAN_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_id == ANONYMOUS) + { + trigger_error($user->lang['CANNOT_BAN_ANONYMOUS'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_BAN_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $ban = array(); + + switch ($action) + { + case 'banuser': + $ban[] = $user_row['username']; + $reason = 'USER_ADMIN_BAN_NAME_REASON'; + break; + + case 'banemail': + $ban[] = $user_row['user_email']; + $reason = 'USER_ADMIN_BAN_EMAIL_REASON'; + break; + + case 'banip': + $ban[] = $user_row['user_ip']; + + $sql = 'SELECT DISTINCT poster_ip + FROM ' . POSTS_TABLE . " + WHERE poster_id = $user_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $ban[] = $row['poster_ip']; + } + $db->sql_freeresult($result); + + $reason = 'USER_ADMIN_BAN_IP_REASON'; + break; + } + + $ban_reason = $request->variable('ban_reason', $user->lang[$reason], true); + $ban_give_reason = $request->variable('ban_give_reason', '', true); + + // Log not used at the moment, we simply utilize the ban function. + $result = user_ban(substr($action, 3), $ban, 0, 0, 0, $ban_reason, $ban_give_reason); + + trigger_error((($result === false) ? $user->lang['BAN_ALREADY_ENTERED'] : $user->lang['BAN_SUCCESSFUL']) . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'reactivate': + + if ($user_id == $user->data['user_id']) + { + trigger_error($user->lang['CANNOT_FORCE_REACT_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_FORCE_REACT_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error($user->lang['CANNOT_FORCE_REACT_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($config['email_enable']) + { + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } + + $server_url = generate_board_url(); + + $user_actkey = gen_rand_string(mt_rand(6, 10)); + $email_template = ($user_row['user_type'] == USER_NORMAL) ? 'user_reactivate_account' : 'user_resend_inactive'; + + if ($user_row['user_type'] == USER_NORMAL) + { + user_active_flip('deactivate', $user_id, INACTIVE_REMIND); + } + else + { + // Grabbing the last confirm key - we only send a reminder + $sql = 'SELECT user_actkey + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $user_activation_key = (string) $db->sql_fetchfield('user_actkey'); + $db->sql_freeresult($result); + + $user_actkey = empty($user_activation_key) ? $user_actkey : $user_activation_key; + } + + if ($user_row['user_type'] == USER_NORMAL || empty($user_activation_key)) + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_actkey = '" . $db->sql_escape($user_actkey) . "' + WHERE user_id = $user_id"; + $db->sql_query($sql); + } + + $messenger = new messenger(false); + + $messenger->template($email_template, $user_row['user_lang']); + + $messenger->set_addresses($user_row); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'USERNAME' => htmlspecialchars_decode($user_row['username']), + 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey") + ); + + $messenger->send(NOTIFY_EMAIL); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_REACTIVATE', false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_REACTIVATE_USER', false, array( + 'reportee_id' => $user_id + )); + + trigger_error($user->lang['FORCE_REACTIVATION_SUCCESS'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + break; + + case 'active': + + if ($user_id == $user->data['user_id']) + { + // It is only deactivation since the user is already activated (else he would not have reached this page) + trigger_error($user->lang['CANNOT_DEACTIVATE_YOURSELF'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_FOUNDER) + { + trigger_error($user->lang['CANNOT_DEACTIVATE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error($user->lang['CANNOT_DEACTIVATE_BOT'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + user_active_flip('flip', $user_id); + + if ($user_row['user_type'] == USER_INACTIVE) + { + if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_row['user_id']); + + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } + + $messenger = new messenger(false); + + $messenger->template('admin_welcome_activated', $user_row['user_lang']); + + $messenger->set_addresses($user_row); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($user_row['username'])) + ); + + $messenger->send(NOTIFY_EMAIL); + } + } + + $message = ($user_row['user_type'] == USER_INACTIVE) ? 'USER_ADMIN_ACTIVATED' : 'USER_ADMIN_DEACTIVED'; + $log = ($user_row['user_type'] == USER_INACTIVE) ? 'LOG_USER_ACTIVE' : 'LOG_USER_INACTIVE'; + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, $log . '_USER', false, array( + 'reportee_id' => $user_id + )); + + trigger_error($user->lang[$message] . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'delsig': + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $sql_ary = array( + 'user_sig' => '', + 'user_sig_bbcode_uid' => '', + 'user_sig_bbcode_bitfield' => '' + ); + + $sql = 'UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_SIG', false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_SIG_USER', false, array( + 'reportee_id' => $user_id + )); + + trigger_error($user->lang['USER_ADMIN_SIG_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'delavatar': + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Delete old avatar if present + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $phpbb_avatar_manager->clean_row($user_row, 'user'), USERS_TABLE, 'user_'); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_AVATAR', false, array($user_row['username'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_AVATAR_USER', false, array( + 'reportee_id' => $user_id + )); + + trigger_error($user->lang['USER_ADMIN_AVATAR_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + break; + + case 'delposts': + + if (confirm_box(true)) + { + // Delete posts, attachments, etc. + delete_posts('poster_id', $user_id); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_POSTS', false, array($user_row['username'])); + trigger_error($user->lang['USER_POSTS_DELETED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + + break; + + case 'delattach': + + if (confirm_box(true)) + { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('user', $user_id); + unset($attachment_manager); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_ATTACH', false, array($user_row['username'])); + trigger_error($user->lang['USER_ATTACHMENTS_REMOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + + break; + + case 'deloutbox': + + if (confirm_box(true)) + { + $msg_ids = array(); + $lang = 'EMPTY'; + + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE author_id = $user_id + AND folder_id = " . PRIVMSGS_OUTBOX; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + if (!function_exists('delete_pm')) + { + include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + } + + do + { + $msg_ids[] = (int) $row['msg_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + + delete_pm($user_id, $msg_ids, PRIVMSGS_OUTBOX); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_DEL_OUTBOX', false, array($user_row['username'])); + + $lang = 'EMPTIED'; + } + $db->sql_freeresult($result); + + trigger_error($user->lang['USER_OUTBOX_' . $lang] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + break; + + case 'moveposts': + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $user->add_lang('acp/forums'); + + $new_forum_id = $request->variable('new_f', 0); + + if (!$new_forum_id) + { + $this->page_title = 'USER_ADMIN_MOVE_POSTS'; + + $template->assign_vars(array( + 'S_SELECT_FORUM' => true, + 'U_ACTION' => $this->u_action . "&action=$action&u=$user_id", + 'U_BACK' => $this->u_action . "&u=$user_id", + 'S_FORUM_OPTIONS' => make_forum_select(false, false, false, true)) + ); + + return; + } + + // Is the new forum postable to? + $sql = 'SELECT forum_name, forum_type + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $new_forum_id"; + $result = $db->sql_query($sql); + $forum_info = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$forum_info) + { + trigger_error($user->lang['NO_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($forum_info['forum_type'] != FORUM_POST) + { + trigger_error($user->lang['MOVE_POSTS_NO_POSTABLE_FORUM'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Two stage? + // Move topics comprising only posts from this user + $topic_id_ary = $move_topic_ary = $move_post_ary = $new_topic_id_ary = array(); + $forum_id_ary = array($new_forum_id); + + $sql = 'SELECT topic_id, post_visibility, COUNT(post_id) AS total_posts + FROM ' . POSTS_TABLE . " + WHERE poster_id = $user_id + AND forum_id <> $new_forum_id + GROUP BY topic_id, post_visibility"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id_ary[$row['topic_id']][$row['post_visibility']] = $row['total_posts']; + } + $db->sql_freeresult($result); + + if (count($topic_id_ary)) + { + $sql = 'SELECT topic_id, forum_id, topic_title, topic_posts_approved, topic_posts_unapproved, topic_posts_softdeleted, topic_attachment + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', array_keys($topic_id_ary)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($topic_id_ary[$row['topic_id']][ITEM_APPROVED] == $row['topic_posts_approved'] + && $topic_id_ary[$row['topic_id']][ITEM_UNAPPROVED] == $row['topic_posts_unapproved'] + && $topic_id_ary[$row['topic_id']][ITEM_REAPPROVE] == $row['topic_posts_unapproved'] + && $topic_id_ary[$row['topic_id']][ITEM_DELETED] == $row['topic_posts_softdeleted']) + { + $move_topic_ary[] = $row['topic_id']; + } + else + { + $move_post_ary[$row['topic_id']]['title'] = $row['topic_title']; + $move_post_ary[$row['topic_id']]['attach'] = ($row['topic_attachment']) ? 1 : 0; + } + + $forum_id_ary[] = $row['forum_id']; + } + $db->sql_freeresult($result); + } + + // Entire topic comprises posts by this user, move these topics + if (count($move_topic_ary)) + { + move_topics($move_topic_ary, $new_forum_id, false); + } + + if (count($move_post_ary)) + { + // Create new topic + // Update post_ids, report_ids, attachment_ids + foreach ($move_post_ary as $topic_id => $post_ary) + { + // Create new topic + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'topic_poster' => $user_id, + 'topic_time' => time(), + 'forum_id' => $new_forum_id, + 'icon_id' => 0, + 'topic_visibility' => ITEM_APPROVED, + 'topic_title' => $post_ary['title'], + 'topic_first_poster_name' => $user_row['username'], + 'topic_type' => POST_NORMAL, + 'topic_time_limit' => 0, + 'topic_attachment' => $post_ary['attach']) + ); + $db->sql_query($sql); + + $new_topic_id = $db->sql_nextid(); + + // Move posts + $sql = 'UPDATE ' . POSTS_TABLE . " + SET forum_id = $new_forum_id, topic_id = $new_topic_id + WHERE topic_id = $topic_id + AND poster_id = $user_id"; + $db->sql_query($sql); + + if ($post_ary['attach']) + { + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " + SET topic_id = $new_topic_id + WHERE topic_id = $topic_id + AND poster_id = $user_id"; + $db->sql_query($sql); + } + + $new_topic_id_ary[] = $new_topic_id; + } + } + + $forum_id_ary = array_unique($forum_id_ary); + $topic_id_ary = array_unique(array_merge(array_keys($topic_id_ary), $new_topic_id_ary)); + + if (count($topic_id_ary)) + { + sync('topic_reported', 'topic_id', $topic_id_ary); + sync('topic', 'topic_id', $topic_id_ary); + } + + if (count($forum_id_ary)) + { + sync('forum', 'forum_id', $forum_id_ary, false, true); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_MOVE_POSTS', false, array($user_row['username'], $forum_info['forum_name'])); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_MOVE_POSTS_USER', false, array( + 'reportee_id' => $user_id, + $forum_info['forum_name'] + )); + + trigger_error($user->lang['USER_POSTS_MOVED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + + break; + + case 'leave_nr': + + if (confirm_box(true)) + { + remove_newly_registered($user_id, $user_row); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_REMOVED_NR', false, array($user_row['username'])); + trigger_error($user->lang['USER_LIFTED_NR'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'update' => true)) + ); + } + + break; + + default: + $u_action = $this->u_action; + + /** + * Run custom quicktool code + * + * @event core.acp_users_overview_run_quicktool + * @var string action Quick tool that should be run + * @var array user_row Current user data + * @var string u_action The u_action link + * @since 3.1.0-a1 + * @changed 3.2.2-RC1 Added u_action + */ + $vars = array('action', 'user_row', 'u_action'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_run_quicktool', compact($vars))); + + unset($u_action); + break; + } + + // Handle registration info updates + $data = array( + 'username' => $request->variable('user', $user_row['username'], true), + 'user_founder' => $request->variable('user_founder', ($user_row['user_type'] == USER_FOUNDER) ? 1 : 0), + 'email' => strtolower($request->variable('user_email', $user_row['user_email'])), + 'new_password' => $request->variable('new_password', '', true), + 'password_confirm' => $request->variable('password_confirm', '', true), + ); + + // Validation data - we do not check the password complexity setting here + $check_ary = array( + 'new_password' => array( + array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + array('password')), + 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + ); + + // Check username if altered + if ($data['username'] != $user_row['username']) + { + $check_ary += array( + 'username' => array( + array('string', false, $config['min_name_chars'], $config['max_name_chars']), + array('username', $user_row['username']) + ), + ); + } + + // Check email if altered + if ($data['email'] != $user_row['user_email']) + { + $check_ary += array( + 'email' => array( + array('string', false, 6, 60), + array('user_email', $user_row['user_email']), + ), + ); + } + + $error = validate_data($data, $check_ary); + + if ($data['new_password'] && $data['password_confirm'] != $data['new_password']) + { + $error[] = 'NEW_PASSWORD_ERROR'; + } + + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + + // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + + // Which updates do we need to do? + $update_username = ($user_row['username'] != $data['username']) ? $data['username'] : false; + $update_password = $data['new_password'] && !$passwords_manager->check($data['new_password'], $user_row['user_password']); + $update_email = ($data['email'] != $user_row['user_email']) ? $data['email'] : false; + + if (!count($error)) + { + $sql_ary = array(); + + if ($user_row['user_type'] != USER_FOUNDER || $user->data['user_type'] == USER_FOUNDER) + { + // Only allow founders updating the founder status... + if ($user->data['user_type'] == USER_FOUNDER) + { + // Setting a normal member to be a founder + if ($data['user_founder'] && $user_row['user_type'] != USER_FOUNDER) + { + // Make sure the user is not setting an Inactive or ignored user to be a founder + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error($user->lang['CANNOT_SET_FOUNDER_IGNORED'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($user_row['user_type'] == USER_INACTIVE) + { + trigger_error($user->lang['CANNOT_SET_FOUNDER_INACTIVE'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $sql_ary['user_type'] = USER_FOUNDER; + } + else if (!$data['user_founder'] && $user_row['user_type'] == USER_FOUNDER) + { + // Check if at least one founder is present + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_FOUNDER . ' + AND user_id <> ' . $user_id; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $sql_ary['user_type'] = USER_NORMAL; + } + else + { + trigger_error($user->lang['AT_LEAST_ONE_FOUNDER'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + } + } + + /** + * Modify user data before we update it + * + * @event core.acp_users_overview_modify_data + * @var array user_row Current user data + * @var array data Submitted user data + * @var array sql_ary User data we udpate + * @since 3.1.0-a1 + */ + $vars = array('user_row', 'data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_overview_modify_data', compact($vars))); + + if ($update_username !== false) + { + $sql_ary['username'] = $update_username; + $sql_ary['username_clean'] = utf8_clean_string($update_username); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_NAME', false, array( + 'reportee_id' => $user_id, + $user_row['username'], + $update_username + )); + } + + if ($update_email !== false) + { + $sql_ary += array( + 'user_email' => $update_email, + 'user_email_hash' => phpbb_email_hash($update_email), + ); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_EMAIL', false, array( + 'reportee_id' => $user_id, + $user_row['username'], + $user_row['user_email'], + $update_email + )); + } + + if ($update_password) + { + $sql_ary += array( + 'user_password' => $passwords_manager->hash($data['new_password']), + 'user_passchg' => time(), + ); + + $user->reset_login_keys($user_id); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array( + 'reportee_id' => $user_id, + $user_row['username'] + )); + } + + if (count($sql_ary)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + } + + if ($update_username) + { + user_update_name($user_row['username'], $update_username); + } + + // Let the users permissions being updated + $auth->acl_clear_prefetch($user_id); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_USER_UPDATE', false, array($data['username'])); + + trigger_error($user->lang['USER_OVERVIEW_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + if ($user_id == $user->data['user_id']) + { + $quick_tool_ary = array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH', 'deloutbox' => 'DEL_OUTBOX'); + if ($user_row['user_new']) + { + $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; + } + } + else + { + $quick_tool_ary = array(); + + if ($user_row['user_type'] != USER_FOUNDER) + { + $quick_tool_ary += array('banuser' => 'BAN_USER', 'banemail' => 'BAN_EMAIL', 'banip' => 'BAN_IP'); + } + + if ($user_row['user_type'] != USER_FOUNDER && $user_row['user_type'] != USER_IGNORE) + { + $quick_tool_ary += array('active' => (($user_row['user_type'] == USER_INACTIVE) ? 'ACTIVATE' : 'DEACTIVATE')); + } + + $quick_tool_ary += array('delsig' => 'DEL_SIG', 'delavatar' => 'DEL_AVATAR', 'moveposts' => 'MOVE_POSTS', 'delposts' => 'DEL_POSTS', 'delattach' => 'DEL_ATTACH', 'deloutbox' => 'DEL_OUTBOX'); + + if ($config['email_enable'] && ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_INACTIVE)) + { + $quick_tool_ary['reactivate'] = 'FORCE'; + } + + if ($user_row['user_new']) + { + $quick_tool_ary['leave_nr'] = 'LEAVE_NR'; + } + } + + if ($config['load_onlinetrack']) + { + $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline + FROM ' . SESSIONS_TABLE . " + WHERE session_user_id = $user_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $user_row['session_time'] = (isset($row['session_time'])) ? $row['session_time'] : 0; + $user_row['session_viewonline'] = (isset($row['session_viewonline'])) ? $row['session_viewonline'] : 0; + unset($row); + } + + /** + * Add additional quick tool options and overwrite user data + * + * @event core.acp_users_display_overview + * @var array user_row Array with user data + * @var array quick_tool_ary Ouick tool options + * @since 3.1.0-a1 + */ + $vars = array('user_row', 'quick_tool_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_display_overview', compact($vars))); + + $s_action_options = ''; + foreach ($quick_tool_ary as $value => $lang) + { + $s_action_options .= ''; + } + + $last_active = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_lastvisit']; + + $inactive_reason = ''; + if ($user_row['user_type'] == USER_INACTIVE) + { + $inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN']; + + switch ($user_row['user_inactive_reason']) + { + case INACTIVE_REGISTER: + $inactive_reason = $user->lang['INACTIVE_REASON_REGISTER']; + break; + + case INACTIVE_PROFILE: + $inactive_reason = $user->lang['INACTIVE_REASON_PROFILE']; + break; + + case INACTIVE_MANUAL: + $inactive_reason = $user->lang['INACTIVE_REASON_MANUAL']; + break; + + case INACTIVE_REMIND: + $inactive_reason = $user->lang['INACTIVE_REASON_REMIND']; + break; + } + } + + // Posts in Queue + $sql = 'SELECT COUNT(post_id) as posts_in_queue + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . $user_id . ' + AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)); + $result = $db->sql_query($sql); + $user_row['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); + $db->sql_freeresult($result); + + $sql = 'SELECT post_id + FROM ' . POSTS_TABLE . ' + WHERE poster_id = '. $user_id; + $result = $db->sql_query_limit($sql, 1); + $user_row['user_has_posts'] = (bool) $db->sql_fetchfield('post_id'); + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'L_NAME_CHARS_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), + 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), + 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $user_row['posts_in_queue']), + 'S_FOUNDER' => ($user->data['user_type'] == USER_FOUNDER) ? true : false, + + 'S_OVERVIEW' => true, + 'S_USER_IP' => ($user_row['user_ip']) ? true : false, + 'S_USER_FOUNDER' => ($user_row['user_type'] == USER_FOUNDER) ? true : false, + 'S_ACTION_OPTIONS' => $s_action_options, + 'S_OWN_ACCOUNT' => ($user_id == $user->data['user_id']) ? true : false, + 'S_USER_INACTIVE' => ($user_row['user_type'] == USER_INACTIVE) ? true : false, + + 'U_SHOW_IP' => $this->u_action . "&u=$user_id&ip=" . (($ip == 'ip') ? 'hostname' : 'ip'), + 'U_WHOIS' => $this->u_action . "&action=whois&user_ip={$user_row['user_ip']}", + 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', + 'U_SEARCH_USER' => ($config['load_search'] && $auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id={$user_row['user_id']}&sr=posts") : '', + + 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_row['user_id']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_row['user_id']}&hash=" . generate_link_hash('switchperm')) : '', + + 'POSTS_IN_QUEUE' => $user_row['posts_in_queue'], + 'USER' => $user_row['username'], + 'USER_REGISTERED' => $user->format_date($user_row['user_regdate']), + 'REGISTERED_IP' => ($ip == 'hostname') ? gethostbyaddr($user_row['user_ip']) : $user_row['user_ip'], + 'USER_LASTACTIVE' => ($last_active) ? $user->format_date($last_active) : ' - ', + 'USER_EMAIL' => $user_row['user_email'], + 'USER_WARNINGS' => $user_row['user_warnings'], + 'USER_POSTS' => $user_row['user_posts'], + 'USER_HAS_POSTS' => $user_row['user_has_posts'], + 'USER_INACTIVE_REASON' => $inactive_reason, + )); + + break; + + case 'feedback': + + $user->add_lang('mcp'); + + // Set up general vars + $start = $request->variable('start', 0); + $deletemark = (isset($_POST['delmarked'])) ? true : false; + $deleteall = (isset($_POST['delall'])) ? true : false; + $marked = $request->variable('mark', array(0)); + $message = $request->variable('message', '', true); + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + // Sort keys + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); + + // Delete entries if requested and able + if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) + { + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $where_sql = ''; + if ($deletemark && $marked) + { + $sql_in = array(); + foreach ($marked as $mark) + { + $sql_in[] = $mark; + } + $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); + unset($sql_in); + } + + if ($where_sql || $deleteall) + { + $sql = 'DELETE FROM ' . LOG_TABLE . ' + WHERE log_type = ' . LOG_USERS . " + AND reportee_id = $user_id + $where_sql"; + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CLEAR_USER', false, array($user_row['username'])); + } + } + + if ($submit && $message) + { + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array($user_row['username'])); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $user_row['username'] + )); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GENERAL', false, array( + 'reportee_id' => $user_id, + $message + )); + + trigger_error($user->lang['USER_FEEDBACK_ADDED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Sorting + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); + $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + // Define where and sort sql for use in displaying logs + $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; + $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + + // Grab log data + $log_data = array(); + $log_count = 0; + $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort); + + $base_url = $this->u_action . "&u=$user_id&$u_sort_param"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'S_FEEDBACK' => true, + + 'S_LIMIT_DAYS' => $s_limit_days, + 'S_SORT_KEY' => $s_sort_key, + 'S_SORT_DIR' => $s_sort_dir, + 'S_CLEARLOGS' => $auth->acl_get('a_clearlogs')) + ); + + foreach ($log_data as $row) + { + $template->assign_block_vars('log', array( + 'USERNAME' => $row['username_full'], + 'IP' => $row['ip'], + 'DATE' => $user->format_date($row['time']), + 'ACTION' => nl2br($row['action']), + 'ID' => $row['id']) + ); + } + + break; + + case 'warnings': + $user->add_lang('mcp'); + + // Set up general vars + $deletemark = (isset($_POST['delmarked'])) ? true : false; + $deleteall = (isset($_POST['delall'])) ? true : false; + $confirm = (isset($_POST['confirm'])) ? true : false; + $marked = $request->variable('mark', array(0)); + + // Delete entries if requested and able + if ($deletemark || $deleteall || $confirm) + { + if (confirm_box(true)) + { + $where_sql = ''; + $deletemark = $request->variable('delmarked', 0); + $deleteall = $request->variable('delall', 0); + if ($deletemark && $marked) + { + $where_sql = ' AND ' . $db->sql_in_set('warning_id', array_values($marked)); + } + + if ($where_sql || $deleteall) + { + $sql = 'DELETE FROM ' . WARNINGS_TABLE . " + WHERE user_id = $user_id + $where_sql"; + $db->sql_query($sql); + + if ($deleteall) + { + $log_warnings = $deleted_warnings = 0; + } + else + { + $num_warnings = (int) $db->sql_affectedrows(); + $deleted_warnings = ' user_warnings - ' . $num_warnings; + $log_warnings = ($num_warnings > 2) ? 2 : $num_warnings; + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_warnings = $deleted_warnings + WHERE user_id = $user_id"; + $db->sql_query($sql); + + if ($log_warnings) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WARNINGS_DELETED', false, array($user_row['username'], $num_warnings)); + } + else + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_WARNINGS_DELETED_ALL', false, array($user_row['username'])); + } + } + } + else + { + $s_hidden_fields = array( + 'i' => $id, + 'mode' => $mode, + 'u' => $user_id, + 'mark' => $marked, + ); + if (isset($_POST['delmarked'])) + { + $s_hidden_fields['delmarked'] = 1; + } + if (isset($_POST['delall'])) + { + $s_hidden_fields['delall'] = 1; + } + if (isset($_POST['delall']) || (isset($_POST['delmarked']) && count($marked))) + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($s_hidden_fields)); + } + } + } + + $sql = 'SELECT w.warning_id, w.warning_time, w.post_id, l.log_operation, l.log_data, l.user_id AS mod_user_id, m.username AS mod_username, m.user_colour AS mod_user_colour + FROM ' . WARNINGS_TABLE . ' w + LEFT JOIN ' . LOG_TABLE . ' l + ON (w.log_id = l.log_id) + LEFT JOIN ' . USERS_TABLE . ' m + ON (l.user_id = m.user_id) + WHERE w.user_id = ' . $user_id . ' + ORDER BY w.warning_time DESC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$row['log_operation']) + { + // We do not have a log-entry anymore, so there is no data available + $row['action'] = $user->lang['USER_WARNING_LOG_DELETED']; + } + else + { + $row['action'] = (isset($user->lang[$row['log_operation']])) ? $user->lang[$row['log_operation']] : '{' . ucfirst(str_replace('_', ' ', $row['log_operation'])) . '}'; + if (!empty($row['log_data'])) + { + $log_data_ary = @unserialize($row['log_data']); + $log_data_ary = ($log_data_ary === false) ? array() : $log_data_ary; + + if (isset($user->lang[$row['log_operation']])) + { + // Check if there are more occurrences of % than arguments, if there are we fill out the arguments array + // It doesn't matter if we add more arguments than placeholders + if ((substr_count($row['action'], '%') - count($log_data_ary)) > 0) + { + $log_data_ary = array_merge($log_data_ary, array_fill(0, substr_count($row['action'], '%') - count($log_data_ary), '')); + } + $row['action'] = vsprintf($row['action'], $log_data_ary); + $row['action'] = bbcode_nl2br(censor_text($row['action'])); + } + else if (!empty($log_data_ary)) + { + $row['action'] .= '
' . implode('', $log_data_ary); + } + } + } + + $template->assign_block_vars('warn', array( + 'ID' => $row['warning_id'], + 'USERNAME' => ($row['log_operation']) ? get_username_string('full', $row['mod_user_id'], $row['mod_username'], $row['mod_user_colour']) : '-', + 'ACTION' => make_clickable($row['action']), + 'DATE' => $user->format_date($row['warning_time']), + )); + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_WARNINGS' => true, + )); + + break; + + case 'profile': + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + + $cp_data = $cp_error = array(); + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($user->data['user_lang']) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $user_row['iso_lang_id'] = $row['lang_id']; + + $data = array( + 'jabber' => $request->variable('jabber', $user_row['user_jabber'], true), + 'bday_day' => 0, + 'bday_month' => 0, + 'bday_year' => 0, + ); + + if ($user_row['user_birthday']) + { + list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user_row['user_birthday']); + } + + $data['bday_day'] = $request->variable('bday_day', $data['bday_day']); + $data['bday_month'] = $request->variable('bday_month', $data['bday_month']); + $data['bday_year'] = $request->variable('bday_year', $data['bday_year']); + $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']); + + /** + * Modify user data on editing profile in ACP + * + * @event core.acp_users_modify_profile + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @var int user_id The user id + * @var array user_row Array with the full user data + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit', 'user_id', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_modify_profile', compact($vars))); + + if ($submit) + { + $error = validate_data($data, array( + 'jabber' => array( + array('string', true, 5, 255), + array('jabber')), + 'bday_day' => array('num', true, 1, 31), + 'bday_month' => array('num', true, 1, 12), + 'bday_year' => array('num', true, 1901, gmdate('Y', time())), + 'user_birthday' => array('date', true), + )); + + // validate custom profile fields + $cp->submit_cp_field('profile', $user_row['iso_lang_id'], $cp_data, $cp_error); + + if (count($cp_error)) + { + $error = array_merge($error, $cp_error); + } + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + + /** + * Validate profile data in ACP before submitting to the database + * + * @event core.acp_users_profile_validate + * @var array data Array with user profile data + * @var int user_id The user id + * @var array user_row Array with the full user data + * @var array error Array with the form errors + * @since 3.1.4-RC1 + * @changed 3.1.12-RC1 Removed submit, added user_id, user_row + */ + $vars = array('data', 'user_id', 'user_row', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_validate', compact($vars))); + + if (!count($error)) + { + $sql_ary = array( + 'user_jabber' => $data['jabber'], + 'user_birthday' => $data['user_birthday'], + ); + + /** + * Modify profile data in ACP before submitting to the database + * + * @event core.acp_users_profile_modify_sql_ary + * @var array cp_data Array with the user custom profile fields data + * @var array data Array with user profile data + * @var int user_id The user id + * @var array user_row Array with the full user data + * @var array sql_ary Array with sql data + * @since 3.1.4-RC1 + */ + $vars = array('cp_data', 'data', 'user_id', 'user_row', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_profile_modify_sql_ary', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + // Update Custom Fields + $cp->update_profile_field_data($user_id, $cp_data); + + trigger_error($user->lang['USER_PROFILE_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + $s_birthday_day_options = ''; + for ($i = 1; $i < 32; $i++) + { + $selected = ($i == $data['bday_day']) ? ' selected="selected"' : ''; + $s_birthday_day_options .= ""; + } + + $s_birthday_month_options = ''; + for ($i = 1; $i < 13; $i++) + { + $selected = ($i == $data['bday_month']) ? ' selected="selected"' : ''; + $s_birthday_month_options .= ""; + } + + $now = getdate(); + $s_birthday_year_options = ''; + for ($i = $now['year'] - 100; $i <= $now['year']; $i++) + { + $selected = ($i == $data['bday_year']) ? ' selected="selected"' : ''; + $s_birthday_year_options .= ""; + } + unset($now); + + $template->assign_vars(array( + 'JABBER' => $data['jabber'], + 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, + 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, + 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, + + 'S_PROFILE' => true) + ); + + // Get additional profile fields and assign them to the template block var 'profile_fields' + $user->get_profile_fields($user_id); + + $cp->generate_profile_fields('profile', $user_row['iso_lang_id']); + + break; + + case 'prefs': + + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $data = array( + 'dateformat' => $request->variable('dateformat', $user_row['user_dateformat'], true), + 'lang' => basename($request->variable('lang', $user_row['user_lang'])), + 'tz' => $request->variable('tz', $user_row['user_timezone']), + 'style' => $request->variable('style', $user_row['user_style']), + 'viewemail' => $request->variable('viewemail', $user_row['user_allow_viewemail']), + 'massemail' => $request->variable('massemail', $user_row['user_allow_massemail']), + 'hideonline' => $request->variable('hideonline', !$user_row['user_allow_viewonline']), + 'notifymethod' => $request->variable('notifymethod', $user_row['user_notify_type']), + 'notifypm' => $request->variable('notifypm', $user_row['user_notify_pm']), + 'allowpm' => $request->variable('allowpm', $user_row['user_allow_pm']), + + 'topic_sk' => $request->variable('topic_sk', ($user_row['user_topic_sortby_type']) ? $user_row['user_topic_sortby_type'] : 't'), + 'topic_sd' => $request->variable('topic_sd', ($user_row['user_topic_sortby_dir']) ? $user_row['user_topic_sortby_dir'] : 'd'), + 'topic_st' => $request->variable('topic_st', ($user_row['user_topic_show_days']) ? $user_row['user_topic_show_days'] : 0), + + 'post_sk' => $request->variable('post_sk', ($user_row['user_post_sortby_type']) ? $user_row['user_post_sortby_type'] : 't'), + 'post_sd' => $request->variable('post_sd', ($user_row['user_post_sortby_dir']) ? $user_row['user_post_sortby_dir'] : 'a'), + 'post_st' => $request->variable('post_st', ($user_row['user_post_show_days']) ? $user_row['user_post_show_days'] : 0), + + 'view_images' => $request->variable('view_images', $this->optionget($user_row, 'viewimg')), + 'view_flash' => $request->variable('view_flash', $this->optionget($user_row, 'viewflash')), + 'view_smilies' => $request->variable('view_smilies', $this->optionget($user_row, 'viewsmilies')), + 'view_sigs' => $request->variable('view_sigs', $this->optionget($user_row, 'viewsigs')), + 'view_avatars' => $request->variable('view_avatars', $this->optionget($user_row, 'viewavatars')), + 'view_wordcensor' => $request->variable('view_wordcensor', $this->optionget($user_row, 'viewcensors')), + + 'bbcode' => $request->variable('bbcode', $this->optionget($user_row, 'bbcode')), + 'smilies' => $request->variable('smilies', $this->optionget($user_row, 'smilies')), + 'sig' => $request->variable('sig', $this->optionget($user_row, 'attachsig')), + 'notify' => $request->variable('notify', $user_row['user_notify']), + ); + + /** + * Modify users preferences data + * + * @event core.acp_users_prefs_modify_data + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_data', compact($vars))); + + if ($submit) + { + $error = validate_data($data, array( + 'dateformat' => array('string', false, 1, 64), + 'lang' => array('match', false, '#^[a-z_\-]{2,}$#i'), + 'tz' => array('timezone'), + + 'topic_sk' => array('string', false, 1, 1), + 'topic_sd' => array('string', false, 1, 1), + 'post_sk' => array('string', false, 1, 1), + 'post_sd' => array('string', false, 1, 1), + )); + + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + + if (!count($error)) + { + $this->optionset($user_row, 'viewimg', $data['view_images']); + $this->optionset($user_row, 'viewflash', $data['view_flash']); + $this->optionset($user_row, 'viewsmilies', $data['view_smilies']); + $this->optionset($user_row, 'viewsigs', $data['view_sigs']); + $this->optionset($user_row, 'viewavatars', $data['view_avatars']); + $this->optionset($user_row, 'viewcensors', $data['view_wordcensor']); + $this->optionset($user_row, 'bbcode', $data['bbcode']); + $this->optionset($user_row, 'smilies', $data['smilies']); + $this->optionset($user_row, 'attachsig', $data['sig']); + + $sql_ary = array( + 'user_options' => $user_row['user_options'], + + 'user_allow_pm' => $data['allowpm'], + 'user_allow_viewemail' => $data['viewemail'], + 'user_allow_massemail' => $data['massemail'], + 'user_allow_viewonline' => !$data['hideonline'], + 'user_notify_type' => $data['notifymethod'], + 'user_notify_pm' => $data['notifypm'], + + 'user_dateformat' => $data['dateformat'], + 'user_lang' => $data['lang'], + 'user_timezone' => $data['tz'], + 'user_style' => $data['style'], + + 'user_topic_sortby_type' => $data['topic_sk'], + 'user_post_sortby_type' => $data['post_sk'], + 'user_topic_sortby_dir' => $data['topic_sd'], + 'user_post_sortby_dir' => $data['post_sd'], + + 'user_topic_show_days' => $data['topic_st'], + 'user_post_show_days' => $data['post_st'], + + 'user_notify' => $data['notify'], + ); + + /** + * Modify SQL query before users preferences are updated + * + * @event core.acp_users_prefs_modify_sql + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @var array sql_ary SQL array with users preferences data to update + * @var array error Array with errors data + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row', 'sql_ary', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_sql', compact($vars))); + + if (!count($error)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE user_id = $user_id"; + $db->sql_query($sql); + + // Check if user has an active session + if ($user_row['session_id']) + { + // We'll update the session if user_allow_viewonline has changed and the user is a bot + // Or if it's a regular user and the admin set it to hide the session + if ($user_row['user_allow_viewonline'] != $sql_ary['user_allow_viewonline'] && $user_row['user_type'] == USER_IGNORE + || $user_row['user_allow_viewonline'] && !$sql_ary['user_allow_viewonline']) + { + // We also need to check if the user has the permission to cloak. + $user_auth = new \phpbb\auth\auth(); + $user_auth->acl($user_row); + + $session_sql_ary = array( + 'session_viewonline' => ($user_auth->acl_get('u_hideonline')) ? $sql_ary['user_allow_viewonline'] : true, + ); + + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $session_sql_ary) . " + WHERE session_user_id = $user_id"; + $db->sql_query($sql); + + unset($user_auth); + } + } + + trigger_error($user->lang['USER_PREFS_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + $dateformat_options = ''; + foreach ($user->lang['dateformats'] as $format => $null) + { + $dateformat_options .= ''; + } + + $s_custom = false; + + $dateformat_options .= ''; + + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + // Topic ordering options + $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']); + + // 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']); + $sort_by_post_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + + $_options = array('topic', 'post'); + foreach ($_options as $sort_option) + { + ${'s_limit_' . $sort_option . '_days'} = ''; + + ${'s_sort_' . $sort_option . '_key'} = ''; + + ${'s_sort_' . $sort_option . '_dir'} = ''; + } + + phpbb_timezone_select($template, $user, $data['tz'], true); + $user_prefs_data = array( + 'S_PREFS' => true, + 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, + + 'VIEW_EMAIL' => $data['viewemail'], + 'MASS_EMAIL' => $data['massemail'], + 'ALLOW_PM' => $data['allowpm'], + 'HIDE_ONLINE' => $data['hideonline'], + 'NOTIFY_EMAIL' => ($data['notifymethod'] == NOTIFY_EMAIL) ? true : false, + 'NOTIFY_IM' => ($data['notifymethod'] == NOTIFY_IM) ? true : false, + 'NOTIFY_BOTH' => ($data['notifymethod'] == NOTIFY_BOTH) ? true : false, + 'NOTIFY_PM' => $data['notifypm'], + 'BBCODE' => $data['bbcode'], + 'SMILIES' => $data['smilies'], + 'ATTACH_SIG' => $data['sig'], + 'NOTIFY' => $data['notify'], + 'VIEW_IMAGES' => $data['view_images'], + 'VIEW_FLASH' => $data['view_flash'], + 'VIEW_SMILIES' => $data['view_smilies'], + 'VIEW_SIGS' => $data['view_sigs'], + 'VIEW_AVATARS' => $data['view_avatars'], + 'VIEW_WORDCENSOR' => $data['view_wordcensor'], + + 'S_TOPIC_SORT_DAYS' => $s_limit_topic_days, + 'S_TOPIC_SORT_KEY' => $s_sort_topic_key, + 'S_TOPIC_SORT_DIR' => $s_sort_topic_dir, + 'S_POST_SORT_DAYS' => $s_limit_post_days, + 'S_POST_SORT_KEY' => $s_sort_post_key, + 'S_POST_SORT_DIR' => $s_sort_post_dir, + + 'DATE_FORMAT' => $data['dateformat'], + 'S_DATEFORMAT_OPTIONS' => $dateformat_options, + 'S_CUSTOM_DATEFORMAT' => $s_custom, + 'DEFAULT_DATEFORMAT' => $config['default_dateformat'], + 'A_DEFAULT_DATEFORMAT' => addslashes($config['default_dateformat']), + + 'S_LANG_OPTIONS' => language_select($data['lang']), + 'S_STYLE_OPTIONS' => style_select($data['style']), + ); + + /** + * Modify users preferences data before assigning it to the template + * + * @event core.acp_users_prefs_modify_template_data + * @var array data Array with users preferences data + * @var array user_row Array with user data + * @var array user_prefs_data Array with users preferences data to be assigned to the template + * @since 3.1.0-b3 + */ + $vars = array('data', 'user_row', 'user_prefs_data'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_prefs_modify_template_data', compact($vars))); + + $template->assign_vars($user_prefs_data); + + break; + + case 'avatar': + + $avatars_enabled = false; + /** @var \phpbb\avatar\manager $phpbb_avatar_manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + + if ($config['allow_avatar']) + { + $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); + + // This is normalised data, without the user_ prefix + $avatar_data = \phpbb\avatar\manager::clean_row($user_row, 'user'); + + if ($submit) + { + if (check_form_key($form_name)) + { + $driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); + + if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) + { + $driver = $phpbb_avatar_manager->get_driver($driver_name); + $result = $driver->process_form($request, $template, $user, $avatar_data, $error); + + if ($result && empty($error)) + { + // Success! Lets save the result in the database + $result = array( + 'user_avatar_type' => $driver_name, + 'user_avatar' => $result['avatar'], + 'user_avatar_width' => $result['avatar_width'], + 'user_avatar_height' => $result['avatar_height'], + ); + + /** + * Modify users preferences data before assigning it to the template + * + * @event core.acp_users_avatar_sql + * @var array user_row Array with user data + * @var array result Array with user avatar data to be updated in the DB + * @since 3.2.4-RC1 + */ + $vars = array('user_row', 'result'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_avatar_sql', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $result) . ' + WHERE user_id = ' . (int) $user_id; + + $db->sql_query($sql); + trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + } + else + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (!confirm_box(true)) + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true)) + ); + } + else + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, USERS_TABLE, 'user_'); + + trigger_error($user->lang['USER_AVATAR_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + + $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user_row['user_avatar_type'])); + + // Assign min and max values before generating avatar driver html + $template->assign_vars(array( + 'AVATAR_MIN_WIDTH' => $config['avatar_min_width'], + 'AVATAR_MAX_WIDTH' => $config['avatar_max_width'], + 'AVATAR_MIN_HEIGHT' => $config['avatar_min_height'], + 'AVATAR_MAX_HEIGHT' => $config['avatar_max_height'], + )); + + foreach ($avatar_drivers as $current_driver) + { + $driver = $phpbb_avatar_manager->get_driver($current_driver); + + $avatars_enabled = true; + $template->set_filenames(array( + 'avatar' => $driver->get_acp_template_name(), + )); + + if ($driver->prepare_form($request, $template, $user, $avatar_data, $error)) + { + $driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver); + $driver_upper = strtoupper($driver_name); + + $template->assign_block_vars('avatar_drivers', array( + 'L_TITLE' => $user->lang($driver_upper . '_TITLE'), + 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), + + 'DRIVER' => $driver_name, + 'SELECTED' => $current_driver == $selected_driver, + 'OUTPUT' => $template->assign_display('avatar'), + )); + } + } + } + + // Avatar manager is not initialized if avatars are disabled + if (isset($phpbb_avatar_manager)) + { + // Replace "error" strings with their real, localised form + $error = $phpbb_avatar_manager->localize_errors($user, $error); + } + + $avatar = phpbb_get_user_avatar($user_row, 'USER_AVATAR', true); + + $template->assign_vars(array( + 'S_AVATAR' => true, + 'ERROR' => (!empty($error)) ? implode('
', $error) : '', + 'AVATAR' => (empty($avatar) ? '' : $avatar), + + 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', + + 'L_AVATAR_EXPLAIN' => $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', $config['avatar_max_width'], $config['avatar_max_height'], $config['avatar_filesize'] / 1024), + + 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), + )); + + break; + + case 'rank': + + if ($submit) + { + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $rank_id = $request->variable('user_rank', 0); + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_rank = $rank_id + WHERE user_id = $user_id"; + $db->sql_query($sql); + + trigger_error($user->lang['USER_RANK_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + + $sql = 'SELECT * + FROM ' . RANKS_TABLE . ' + WHERE rank_special = 1 + ORDER BY rank_title'; + $result = $db->sql_query($sql); + + $s_rank_options = ''; + + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($user_row['user_rank'] && $row['rank_id'] == $user_row['user_rank']) ? ' selected="selected"' : ''; + $s_rank_options .= ''; + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_RANK' => true, + 'S_RANK_OPTIONS' => $s_rank_options) + ); + + break; + + case 'sig': + + if (!function_exists('display_custom_bbcodes')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $enable_bbcode = ($config['allow_sig_bbcode']) ? $this->optionget($user_row, 'sig_bbcode') : false; + $enable_smilies = ($config['allow_sig_smilies']) ? $this->optionget($user_row, 'sig_smilies') : false; + $enable_urls = ($config['allow_sig_links']) ? $this->optionget($user_row, 'sig_links') : false; + + $bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0); + + $decoded_message = generate_text_for_edit($user_row['user_sig'], $user_row['user_sig_bbcode_uid'], $bbcode_flags); + $signature = $request->variable('signature', $decoded_message['text'], true); + $signature_preview = ''; + + if ($submit || $request->is_set_post('preview')) + { + $enable_bbcode = ($config['allow_sig_bbcode']) ? !$request->variable('disable_bbcode', false) : false; + $enable_smilies = ($config['allow_sig_smilies']) ? !$request->variable('disable_smilies', false) : false; + $enable_urls = ($config['allow_sig_links']) ? !$request->variable('disable_magic_url', false) : false; + + if (!check_form_key($form_name)) + { + $error[] = 'FORM_INVALID'; + } + } + + $bbcode_uid = $bbcode_bitfield = $bbcode_flags = ''; + $warn_msg = generate_text_for_storage( + $signature, + $bbcode_uid, + $bbcode_bitfield, + $bbcode_flags, + $enable_bbcode, + $enable_urls, + $enable_smilies, + $config['allow_sig_img'], + $config['allow_sig_flash'], + true, + $config['allow_sig_links'], + 'sig' + ); + + if (count($warn_msg)) + { + $error += $warn_msg; + } + + if (!$submit) + { + // Parse it for displaying + $signature_preview = generate_text_for_display($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags); + } + else + { + if (!count($error)) + { + $this->optionset($user_row, 'sig_bbcode', $enable_bbcode); + $this->optionset($user_row, 'sig_smilies', $enable_smilies); + $this->optionset($user_row, 'sig_links', $enable_urls); + + $sql_ary = array( + 'user_sig' => $signature, + 'user_options' => $user_row['user_options'], + 'user_sig_bbcode_uid' => $bbcode_uid, + 'user_sig_bbcode_bitfield' => $bbcode_bitfield, + ); + + /** + * Modify user signature before it is stored in the DB + * + * @event core.acp_users_modify_signature_sql_ary + * @var array user_row Array with user data + * @var array sql_ary Array with user signature data to be updated in the DB + * @since 3.2.4-RC1 + */ + $vars = array('user_row', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_modify_signature_sql_ary', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + + trigger_error($user->lang['USER_SIG_UPDATED'] . adm_back_link($this->u_action . '&u=' . $user_id)); + } + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + + if ($request->is_set_post('preview')) + { + $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_flags); + } + + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + + $template->assign_vars(array( + 'S_SIGNATURE' => true, + + 'SIGNATURE' => $decoded_message['text'], + 'SIGNATURE_PREVIEW' => $signature_preview, + + 'S_BBCODE_CHECKED' => (!$enable_bbcode) ? ' checked="checked"' : '', + 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', + 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', + + 'BBCODE_STATUS' => $user->lang(($config['allow_sig_bbcode'] ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), + 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + + 'L_SIGNATURE_EXPLAIN' => $user->lang('SIGNATURE_EXPLAIN', (int) $config['max_sig_chars']), + + 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], + 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], + 'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false, + 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false, + 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false) + ); + + // Assigning custom bbcodes + display_custom_bbcodes(); + + break; + + case 'attach': + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + $start = $request->variable('start', 0); + $deletemark = (isset($_POST['delmarked'])) ? true : false; + $marked = $request->variable('mark', array(0)); + + // Sort keys + $sort_key = $request->variable('sk', 'a'); + $sort_dir = $request->variable('sd', 'd'); + + if ($deletemark && count($marked)) + { + $sql = 'SELECT attach_id + FROM ' . ATTACHMENTS_TABLE . ' + WHERE poster_id = ' . $user_id . ' + AND is_orphan = 0 + AND ' . $db->sql_in_set('attach_id', $marked); + $result = $db->sql_query($sql); + + $marked = array(); + while ($row = $db->sql_fetchrow($result)) + { + $marked[] = $row['attach_id']; + } + $db->sql_freeresult($result); + } + + if ($deletemark && count($marked)) + { + if (confirm_box(true)) + { + $sql = 'SELECT real_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', $marked); + $result = $db->sql_query($sql); + + $log_attachments = array(); + while ($row = $db->sql_fetchrow($result)) + { + $log_attachments[] = $row['real_filename']; + } + $db->sql_freeresult($result); + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('attach', $marked); + unset($attachment_manager); + + $message = (count($log_attachments) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']; + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ATTACHMENTS_DELETED', false, array(implode($user->lang['COMMA_SEPARATOR'], $log_attachments))); + trigger_error($message . adm_back_link($this->u_action . '&u=' . $user_id)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'delmarked' => true, + 'mark' => $marked)) + ); + } + } + + $sk_text = array('a' => $user->lang['SORT_FILENAME'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']); + $sk_sql = array('a' => 'a.real_filename', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title'); + + $sd_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + $s_sort_key = ''; + foreach ($sk_text as $key => $value) + { + $selected = ($sort_key == $key) ? ' selected="selected"' : ''; + $s_sort_key .= ''; + } + + $s_sort_dir = ''; + foreach ($sd_text as $key => $value) + { + $selected = ($sort_dir == $key) ? ' selected="selected"' : ''; + $s_sort_dir .= ''; + } + + if (!isset($sk_sql[$sort_key])) + { + $sort_key = 'a'; + } + + $order_by = $sk_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); + + $sql = 'SELECT COUNT(attach_id) as num_attachments + FROM ' . ATTACHMENTS_TABLE . " + WHERE poster_id = $user_id + AND is_orphan = 0"; + $result = $db->sql_query_limit($sql, 1); + $num_attachments = (int) $db->sql_fetchfield('num_attachments'); + $db->sql_freeresult($result); + + $sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title + FROM ' . ATTACHMENTS_TABLE . ' a + LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id + AND a.in_message = 0) + LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id + AND a.in_message = 1) + WHERE a.poster_id = ' . $user_id . " + AND a.is_orphan = 0 + ORDER BY $order_by"; + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['in_message']) + { + $view_topic = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&p={$row['post_msg_id']}"); + } + else + { + $view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . '#p' . $row['post_msg_id']; + } + + $template->assign_block_vars('attach', array( + 'REAL_FILENAME' => $row['real_filename'], + 'COMMENT' => nl2br($row['attach_comment']), + 'EXTENSION' => $row['extension'], + 'SIZE' => get_formatted_filesize($row['filesize']), + 'DOWNLOAD_COUNT' => $row['download_count'], + 'POST_TIME' => $user->format_date($row['filetime']), + 'TOPIC_TITLE' => ($row['in_message']) ? $row['message_title'] : $row['topic_title'], + + 'ATTACH_ID' => $row['attach_id'], + 'POST_ID' => $row['post_msg_id'], + 'TOPIC_ID' => $row['topic_id'], + + 'S_IN_MESSAGE' => $row['in_message'], + + 'U_DOWNLOAD' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . $row['attach_id']), + 'U_VIEW_TOPIC' => $view_topic) + ); + } + $db->sql_freeresult($result); + + $base_url = $this->u_action . "&u=$user_id&sk=$sort_key&sd=$sort_dir"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'S_ATTACHMENTS' => true, + 'S_SORT_KEY' => $s_sort_key, + 'S_SORT_DIR' => $s_sort_dir, + )); + + break; + + case 'groups': + + if (!function_exists('group_user_attributes')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $user->add_lang(array('groups', 'acp/groups')); + $group_id = $request->variable('g', 0); + + if ($group_id) + { + // Check the founder only entry for this group to make sure everything is well + $sql = 'SELECT group_founder_manage + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $db->sql_query($sql); + $founder_manage = (int) $db->sql_fetchfield('group_founder_manage'); + $db->sql_freeresult($result); + + if ($user->data['user_type'] != USER_FOUNDER && $founder_manage) + { + trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + } + + switch ($action) + { + case 'demote': + case 'promote': + case 'default': + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!check_link_hash($request->variable('hash', ''), 'acp_users')) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action), E_USER_WARNING); + } + + group_user_attributes($action, $group_id, $user_id); + + if ($action == 'default') + { + $user_row['group_id'] = $group_id; + } + break; + + case 'delete': + + if (confirm_box(true)) + { + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if ($error = group_user_del($group_id, $user_id)) + { + trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $error = array(); + + // The delete action was successful - therefore update the user row... + $sql = 'SELECT u.*, s.* + FROM ' . USERS_TABLE . ' u + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) + WHERE u.user_id = ' . $user_id . ' + ORDER BY s.session_time DESC'; + $result = $db->sql_query_limit($sql, 1); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'g' => $group_id)) + ); + } + + break; + + case 'approve': + + if (confirm_box(true)) + { + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + group_user_attributes($action, $group_id, $user_id); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'u' => $user_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action, + 'g' => $group_id)) + ); + } + + break; + } + + // Add user to group? + if ($submit) + { + + if (!check_form_key($form_name)) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + // Add user/s to group + if ($error = group_user_add($group_id, $user_id)) + { + trigger_error($user->lang[$error] . adm_back_link($this->u_action . '&u=' . $user_id), E_USER_WARNING); + } + + $error = array(); + } + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $sql = 'SELECT ug.*, g.* + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug + WHERE ug.user_id = $user_id + AND g.group_id = ug.group_id + ORDER BY g.group_type DESC, ug.user_pending ASC, g.group_name"; + $result = $db->sql_query($sql); + + $i = 0; + $group_data = $id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $type = ($row['group_type'] == GROUP_SPECIAL) ? 'special' : (($row['user_pending']) ? 'pending' : 'normal'); + + $group_data[$type][$i]['group_id'] = $row['group_id']; + $group_data[$type][$i]['group_name'] = $row['group_name']; + $group_data[$type][$i]['group_leader'] = ($row['group_leader']) ? 1 : 0; + + $id_ary[] = $row['group_id']; + + $i++; + } + $db->sql_freeresult($result); + + // Select box for other groups + $sql = 'SELECT group_id, group_name, group_type, group_founder_manage + FROM ' . GROUPS_TABLE . ' + ' . ((count($id_ary)) ? 'WHERE ' . $db->sql_in_set('group_id', $id_ary, true) : '') . ' + ORDER BY group_type DESC, group_name ASC'; + $result = $db->sql_query($sql); + + $s_group_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + if (!$config['coppa_enable'] && $row['group_name'] == 'REGISTERED_COPPA') + { + continue; + } + + // Do not display those groups not allowed to be managed + if ($user->data['user_type'] != USER_FOUNDER && $row['group_founder_manage']) + { + continue; + } + + $s_group_options .= '' . $group_helper->get_name($row['group_name']) . ''; + } + $db->sql_freeresult($result); + + $current_type = ''; + foreach ($group_data as $group_type => $data_ary) + { + if ($current_type != $group_type) + { + $template->assign_block_vars('group', array( + 'S_NEW_GROUP_TYPE' => true, + 'GROUP_TYPE' => $user->lang['USER_GROUP_' . strtoupper($group_type)]) + ); + } + + foreach ($data_ary as $data) + { + $template->assign_block_vars('group', array( + 'U_EDIT_GROUP' => append_sid("{$phpbb_admin_path}index.$phpEx", "i=groups&mode=manage&action=edit&u=$user_id&g={$data['group_id']}&back_link=acp_users_groups"), + 'U_DEFAULT' => $this->u_action . "&action=default&u=$user_id&g=" . $data['group_id'] . '&hash=' . generate_link_hash('acp_users'), + 'U_DEMOTE_PROMOTE' => $this->u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'] . '&hash=' . generate_link_hash('acp_users'), + 'U_DELETE' => $this->u_action . "&action=delete&u=$user_id&g=" . $data['group_id'], + 'U_APPROVE' => ($group_type == 'pending') ? $this->u_action . "&action=approve&u=$user_id&g=" . $data['group_id'] : '', + + 'GROUP_NAME' => $group_helper->get_name($data['group_name']), + 'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'], + + 'S_IS_MEMBER' => ($group_type != 'pending') ? true : false, + 'S_NO_DEFAULT' => ($user_row['group_id'] != $data['group_id']) ? true : false, + 'S_SPECIAL_GROUP' => ($group_type == 'special') ? true : false, + ) + ); + } + } + + $template->assign_vars(array( + 'S_GROUPS' => true, + 'S_GROUP_OPTIONS' => $s_group_options) + ); + + break; + + case 'perm': + + if (!class_exists('auth_admin')) + { + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + } + + $auth_admin = new auth_admin(); + + $user->add_lang('acp/permissions'); + add_permission_language(); + + $forum_id = $request->variable('f', 0); + + // Global Permissions + if (!$forum_id) + { + // Select auth options + $sql = 'SELECT auth_option, is_local, is_global + FROM ' . ACL_OPTIONS_TABLE . ' + WHERE auth_option ' . $db->sql_like_expression($db->get_any_char() . '_') . ' + AND is_global = 1 + ORDER BY auth_option'; + $result = $db->sql_query($sql); + + $hold_ary = array(); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary = $auth_admin->get_mask('view', $user_id, false, false, $row['auth_option'], 'global', ACL_NEVER); + $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', false, false); + } + $db->sql_freeresult($result); + + unset($hold_ary); + } + else + { + $sql = 'SELECT auth_option, is_local, is_global + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option " . $db->sql_like_expression($db->get_any_char() . '_') . " + AND is_local = 1 + ORDER BY is_global DESC, auth_option"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary = $auth_admin->get_mask('view', $user_id, false, $forum_id, $row['auth_option'], 'local', ACL_NEVER); + $auth_admin->display_mask('view', $row['auth_option'], $hold_ary, 'user', true, false); + } + $db->sql_freeresult($result); + } + + $s_forum_options = ''; + $s_forum_options .= make_forum_select($forum_id, false, true, false, false, false); + + $template->assign_vars(array( + 'S_PERMISSIONS' => true, + + 'S_GLOBAL' => (!$forum_id) ? true : false, + 'S_FORUM_OPTIONS' => $s_forum_options, + + 'U_ACTION' => $this->u_action . '&u=' . $user_id, + 'U_USER_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx" ,'i=permissions&mode=setting_user_global&user_id[]=' . $user_id), + 'U_USER_FORUM_PERMISSIONS' => append_sid("{$phpbb_admin_path}index.$phpEx", 'i=permissions&mode=setting_user_local&user_id[]=' . $user_id)) + ); + + break; + + default: + + /** + * Additional modes provided by extensions + * + * @event core.acp_users_mode_add + * @var string mode New mode + * @var int user_id User id of the user to manage + * @var array user_row Array with user data + * @var array error Array with errors data + * @since 3.2.2-RC1 + */ + $vars = array('mode', 'user_id', 'user_row', 'error'); + extract($phpbb_dispatcher->trigger_event('core.acp_users_mode_add', compact($vars))); + + break; + } + + // Assign general variables + $template->assign_vars(array( + 'S_ERROR' => (count($error)) ? true : false, + 'ERROR_MSG' => (count($error)) ? implode('
', $error) : '') + ); + } + + /** + * Set option bit field for user options in a user row array. + * + * Optionset replacement for this module based on $user->optionset. + * + * @param array $user_row Row from the users table. + * @param int $key Option key, as defined in $user->keyoptions property. + * @param bool $value True to set the option, false to clear the option. + * @param int $data Current bit field value, or false to use $user_row['user_options'] + * @return int|bool If $data is false, the bit field is modified and + * written back to $user_row['user_options'], and + * return value is true if the bit field changed and + * false otherwise. If $data is not false, the new + * bitfield value is returned. + */ + function optionset(&$user_row, $key, $value, $data = false) + { + global $user; + + $var = ($data !== false) ? $data : $user_row['user_options']; + + $new_var = phpbb_optionset($user->keyoptions[$key], $value, $var); + + if ($data === false) + { + if ($new_var != $var) + { + $user_row['user_options'] = $new_var; + return true; + } + else + { + return false; + } + } + else + { + return $new_var; + } + } + + /** + * Get option bit field from user options in a user row array. + * + * Optionget replacement for this module based on $user->optionget. + * + * @param array $user_row Row from the users table. + * @param int $key option key, as defined in $user->keyoptions property. + * @param int $data bit field value to use, or false to use $user_row['user_options'] + * @return bool true if the option is set in the bit field, false otherwise + */ + function optionget(&$user_row, $key, $data = false) + { + global $user; + + $var = ($data !== false) ? $data : $user_row['user_options']; + return phpbb_optionget($user->keyoptions[$key], $var); + } +} diff --git a/install/update/old/includes/acp/auth.php b/install/update/old/includes/acp/auth.php new file mode 100644 index 0000000..b414a31 --- /dev/null +++ b/install/update/old/includes/acp/auth.php @@ -0,0 +1,1323 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ACP Permission/Auth class +*/ +class auth_admin extends \phpbb\auth\auth +{ + /** + * Init auth settings + */ + function __construct() + { + global $db, $cache; + + if (($this->acl_options = $cache->get('_acl_options')) === false) + { + $sql = 'SELECT auth_option_id, auth_option, is_global, is_local + FROM ' . ACL_OPTIONS_TABLE . ' + ORDER BY auth_option_id'; + $result = $db->sql_query($sql); + + $global = $local = 0; + $this->acl_options = array(); + while ($row = $db->sql_fetchrow($result)) + { + if ($row['is_global']) + { + $this->acl_options['global'][$row['auth_option']] = $global++; + } + + if ($row['is_local']) + { + $this->acl_options['local'][$row['auth_option']] = $local++; + } + + $this->acl_options['id'][$row['auth_option']] = (int) $row['auth_option_id']; + $this->acl_options['option'][(int) $row['auth_option_id']] = $row['auth_option']; + } + $db->sql_freeresult($result); + + $cache->put('_acl_options', $this->acl_options); + } + } + + /** + * Get permission mask + * This function only supports getting permissions of one type (for example a_) + * + * @param set|view $mode defines the permissions we get, view gets effective permissions (checking user AND group permissions), set only gets the user or group permission set alone + * @param mixed $user_id user ids to search for (a user_id or a group_id has to be specified at least) + * @param mixed $group_id group ids to search for, return group related settings (a user_id or a group_id has to be specified at least) + * @param mixed $forum_id forum_ids to search for. Defining a forum id also means getting local settings + * @param string $auth_option the auth_option defines the permission setting to look for (a_ for example) + * @param local|global $scope the scope defines the permission scope. If local, a forum_id is additionally required + * @param ACL_NEVER|ACL_NO|ACL_YES $acl_fill defines the mode those permissions not set are getting filled with + */ + function get_mask($mode, $user_id = false, $group_id = false, $forum_id = false, $auth_option = false, $scope = false, $acl_fill = ACL_NEVER) + { + global $db, $user; + + $hold_ary = array(); + $view_user_mask = ($mode == 'view' && $group_id === false) ? true : false; + + if ($auth_option === false || $scope === false) + { + return array(); + } + + $acl_user_function = ($mode == 'set') ? 'acl_user_raw_data' : 'acl_raw_data'; + + if (!$view_user_mask) + { + if ($forum_id !== false) + { + $hold_ary = ($group_id !== false) ? $this->acl_group_raw_data($group_id, $auth_option . '%', $forum_id) : $this->$acl_user_function($user_id, $auth_option . '%', $forum_id); + } + else + { + $hold_ary = ($group_id !== false) ? $this->acl_group_raw_data($group_id, $auth_option . '%', ($scope == 'global') ? 0 : false) : $this->$acl_user_function($user_id, $auth_option . '%', ($scope == 'global') ? 0 : false); + } + } + + // Make sure hold_ary is filled with every setting (prevents missing forums/users/groups) + $ug_id = ($group_id !== false) ? ((!is_array($group_id)) ? array($group_id) : $group_id) : ((!is_array($user_id)) ? array($user_id) : $user_id); + $forum_ids = ($forum_id !== false) ? ((!is_array($forum_id)) ? array($forum_id) : $forum_id) : (($scope == 'global') ? array(0) : array()); + + // Only those options we need + $compare_options = array_diff(preg_replace('/^((?!' . $auth_option . ').+)|(' . $auth_option . ')$/', '', array_keys($this->acl_options[$scope])), array('')); + + // If forum_ids is false and the scope is local we actually want to have all forums within the array + if ($scope == 'local' && !count($forum_ids)) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql, 120); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + } + + if ($view_user_mask) + { + $auth2 = null; + + $sql = 'SELECT user_id, user_permissions, user_type + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $ug_id); + $result = $db->sql_query($sql); + + while ($userdata = $db->sql_fetchrow($result)) + { + if ($user->data['user_id'] != $userdata['user_id']) + { + $auth2 = new \phpbb\auth\auth(); + $auth2->acl($userdata); + } + else + { + global $auth; + $auth2 = &$auth; + } + + $hold_ary[$userdata['user_id']] = array(); + foreach ($forum_ids as $f_id) + { + $hold_ary[$userdata['user_id']][$f_id] = array(); + foreach ($compare_options as $option) + { + $hold_ary[$userdata['user_id']][$f_id][$option] = $auth2->acl_get($option, $f_id); + } + } + } + $db->sql_freeresult($result); + + unset($userdata); + unset($auth2); + } + + foreach ($ug_id as $_id) + { + if (!isset($hold_ary[$_id])) + { + $hold_ary[$_id] = array(); + } + + foreach ($forum_ids as $f_id) + { + if (!isset($hold_ary[$_id][$f_id])) + { + $hold_ary[$_id][$f_id] = array(); + } + } + } + + // Now, we need to fill the gaps with $acl_fill. ;) + + // Now switch back to keys + if (count($compare_options)) + { + $compare_options = array_combine($compare_options, array_fill(1, count($compare_options), $acl_fill)); + } + + // Defining the user-function here to save some memory + $return_acl_fill = function () use ($acl_fill) + { + return $acl_fill; + }; + + // Actually fill the gaps + if (count($hold_ary)) + { + foreach ($hold_ary as $ug_id => $row) + { + foreach ($row as $id => $options) + { + // Do not include the global auth_option + unset($options[$auth_option]); + + // Not a "fine" solution, but at all it's a 1-dimensional + // array_diff_key function filling the resulting array values with zeros + // The differences get merged into $hold_ary (all permissions having $acl_fill set) + $hold_ary[$ug_id][$id] = array_merge($options, + + array_map($return_acl_fill, + array_flip( + array_diff( + array_keys($compare_options), array_keys($options) + ) + ) + ) + ); + } + } + } + else + { + $hold_ary[($group_id !== false) ? $group_id : $user_id][(int) $forum_id] = $compare_options; + } + + return $hold_ary; + } + + /** + * Get permission mask for roles + * This function only supports getting masks for one role + */ + function get_role_mask($role_id) + { + global $db; + + $hold_ary = array(); + + // Get users having this role set... + $sql = 'SELECT user_id, forum_id + FROM ' . ACL_USERS_TABLE . ' + WHERE auth_role_id = ' . $role_id . ' + ORDER BY forum_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary[$row['forum_id']]['users'][] = $row['user_id']; + } + $db->sql_freeresult($result); + + // Now grab groups... + $sql = 'SELECT group_id, forum_id + FROM ' . ACL_GROUPS_TABLE . ' + WHERE auth_role_id = ' . $role_id . ' + ORDER BY forum_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $hold_ary[$row['forum_id']]['groups'][] = $row['group_id']; + } + $db->sql_freeresult($result); + + return $hold_ary; + } + + /** + * Display permission mask (assign to template) + */ + function display_mask($mode, $permission_type, &$hold_ary, $user_mode = 'user', $local = false, $group_display = true) + { + global $template, $user, $db, $phpbb_container; + + /* @var $phpbb_permissions \phpbb\permissions */ + $phpbb_permissions = $phpbb_container->get('acl.permissions'); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + // Define names for template loops, might be able to be set + $tpl_pmask = 'p_mask'; + $tpl_fmask = 'f_mask'; + $tpl_category = 'category'; + $tpl_mask = 'mask'; + + $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; + + // Get names + if ($user_mode == 'user') + { + $sql = 'SELECT user_id as ug_id, username as ug_name + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', array_keys($hold_ary)) . ' + ORDER BY username_clean ASC'; + } + else + { + $sql = 'SELECT group_id as ug_id, group_name as ug_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_id', array_keys($hold_ary)) . ' + ORDER BY group_type DESC, group_name ASC'; + } + $result = $db->sql_query($sql); + + $ug_names_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $ug_names_ary[$row['ug_id']] = ($user_mode == 'user') ? $row['ug_name'] : $group_helper->get_name($row['ug_name']); + } + $db->sql_freeresult($result); + + // Get used forums + $forum_ids = array(); + foreach ($hold_ary as $ug_id => $row) + { + $forum_ids = array_merge($forum_ids, array_keys($row)); + } + $forum_ids = array_unique($forum_ids); + + $forum_names_ary = array(); + if ($local) + { + $forum_names_ary = make_forum_select(false, false, true, false, false, false, true); + + // Remove the disabled ones, since we do not create an option field here... + foreach ($forum_names_ary as $key => $value) + { + if (!$value['disabled']) + { + continue; + } + unset($forum_names_ary[$key]); + } + } + else + { + $forum_names_ary[0] = $l_acl_type; + } + + // Get available roles + $sql = 'SELECT * + FROM ' . ACL_ROLES_TABLE . " + WHERE role_type = '" . $db->sql_escape($permission_type) . "' + ORDER BY role_order ASC"; + $result = $db->sql_query($sql); + + $roles = array(); + while ($row = $db->sql_fetchrow($result)) + { + $roles[$row['role_id']] = $row; + } + $db->sql_freeresult($result); + + $cur_roles = $this->acl_role_data($user_mode, $permission_type, array_keys($hold_ary)); + + // Build js roles array (role data assignments) + $s_role_js_array = ''; + + if (count($roles)) + { + $s_role_js_array = array(); + + // Make sure every role (even if empty) has its array defined + foreach ($roles as $_role_id => $null) + { + $s_role_js_array[$_role_id] = "\n" . 'role_options[' . $_role_id . '] = new Array();' . "\n"; + } + + $sql = 'SELECT r.role_id, o.auth_option, r.auth_setting + FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o + WHERE o.auth_option_id = r.auth_option_id + AND ' . $db->sql_in_set('r.role_id', array_keys($roles)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $flag = substr($row['auth_option'], 0, strpos($row['auth_option'], '_') + 1); + if ($flag == $row['auth_option']) + { + continue; + } + + $s_role_js_array[$row['role_id']] .= 'role_options[' . $row['role_id'] . '][\'' . addslashes($row['auth_option']) . '\'] = ' . $row['auth_setting'] . '; '; + } + $db->sql_freeresult($result); + + $s_role_js_array = implode('', $s_role_js_array); + } + + $template->assign_var('S_ROLE_JS_ARRAY', $s_role_js_array); + unset($s_role_js_array); + + // Now obtain memberships + $user_groups_default = $user_groups_custom = array(); + if ($user_mode == 'user' && $group_display) + { + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE . ' + ORDER BY group_type DESC, group_name ASC'; + $result = $db->sql_query($sql); + + $groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $groups[$row['group_id']] = $row; + } + $db->sql_freeresult($result); + + $memberships = group_memberships(false, array_keys($hold_ary), false); + + // User is not a member of any group? Bad admin, bad bad admin... + if ($memberships) + { + foreach ($memberships as $row) + { + $user_groups_default[$row['user_id']][] = $group_helper->get_name($groups[$row['group_id']]['group_name']); + } + } + unset($memberships, $groups); + } + + // If we only have one forum id to display or being in local mode and more than one user/group to display, + // we switch the complete interface to group by user/usergroup instead of grouping by forum + // To achieve this, we need to switch the array a bit + if (count($forum_ids) == 1 || ($local && count($ug_names_ary) > 1)) + { + $hold_ary_temp = $hold_ary; + $hold_ary = array(); + foreach ($hold_ary_temp as $ug_id => $row) + { + foreach ($forum_names_ary as $forum_id => $forum_row) + { + if (isset($row[$forum_id])) + { + $hold_ary[$forum_id][$ug_id] = $row[$forum_id]; + } + } + } + unset($hold_ary_temp); + + foreach ($hold_ary as $forum_id => $forum_array) + { + $content_array = $categories = array(); + $this->build_permission_array($hold_ary[$forum_id], $content_array, $categories, array_keys($ug_names_ary)); + + $template->assign_block_vars($tpl_pmask, array( + 'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'], + 'PADDING' => ($forum_id == 0) ? '' : $forum_names_ary[$forum_id]['padding'], + + 'CATEGORIES' => implode('', $categories), + + 'L_ACL_TYPE' => $l_acl_type, + + 'S_LOCAL' => ($local) ? true : false, + 'S_GLOBAL' => (!$local) ? true : false, + 'S_NUM_CATS' => count($categories), + 'S_VIEW' => ($mode == 'view') ? true : false, + 'S_NUM_OBJECTS' => count($content_array), + 'S_USER_MODE' => ($user_mode == 'user') ? true : false, + 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false) + ); + + @reset($content_array); + while (list($ug_id, $ug_array) = each($content_array)) + { + // Build role dropdown options + $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; + + $role_options = array(); + + $s_role_options = ''; + $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; + + @reset($roles); + while (list($role_id, $role_row) = each($roles)) + { + $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); + $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; + + $title = ($role_description) ? ' title="' . $role_description . '"' : ''; + $s_role_options .= ''; + + $role_options[] = array( + 'ID' => $role_id, + 'ROLE_NAME' => $role_name, + 'TITLE' => $role_description, + 'SELECTED' => $role_id == $current_role_id, + ); + } + + if ($s_role_options) + { + $s_role_options = '' . $s_role_options; + } + + if (!$current_role_id && $mode != 'view') + { + $s_custom_permissions = false; + + foreach ($ug_array as $key => $value) + { + if ($value['S_NEVER'] || $value['S_YES']) + { + $s_custom_permissions = true; + break; + } + } + } + else + { + $s_custom_permissions = false; + } + + $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array( + 'NAME' => $ug_names_ary[$ug_id], + 'UG_ID' => $ug_id, + 'S_ROLE_OPTIONS' => $s_role_options, + 'S_CUSTOM' => $s_custom_permissions, + 'FORUM_ID' => $forum_id, + 'S_ROLE_ID' => $current_role_id, + )); + + $template->assign_block_vars_array($tpl_pmask . '.' . $tpl_fmask . '.role_options', $role_options); + + $this->assign_cat_array($ug_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, ($mode == 'view'), $show_trace); + + unset($content_array[$ug_id]); + } + + unset($hold_ary[$forum_id]); + } + } + else + { + foreach ($ug_names_ary as $ug_id => $ug_name) + { + if (!isset($hold_ary[$ug_id])) + { + continue; + } + + $content_array = $categories = array(); + $this->build_permission_array($hold_ary[$ug_id], $content_array, $categories, array_keys($forum_names_ary)); + + $template->assign_block_vars($tpl_pmask, array( + 'NAME' => $ug_name, + 'CATEGORIES' => implode('', $categories), + + 'USER_GROUPS_DEFAULT' => ($user_mode == 'user' && isset($user_groups_default[$ug_id]) && count($user_groups_default[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_default[$ug_id]) : '', + 'USER_GROUPS_CUSTOM' => ($user_mode == 'user' && isset($user_groups_custom[$ug_id]) && count($user_groups_custom[$ug_id])) ? implode($user->lang['COMMA_SEPARATOR'], $user_groups_custom[$ug_id]) : '', + 'L_ACL_TYPE' => $l_acl_type, + + 'S_LOCAL' => ($local) ? true : false, + 'S_GLOBAL' => (!$local) ? true : false, + 'S_NUM_CATS' => count($categories), + 'S_VIEW' => ($mode == 'view') ? true : false, + 'S_NUM_OBJECTS' => count($content_array), + 'S_USER_MODE' => ($user_mode == 'user') ? true : false, + 'S_GROUP_MODE' => ($user_mode == 'group') ? true : false) + ); + + @reset($content_array); + while (list($forum_id, $forum_array) = each($content_array)) + { + // Build role dropdown options + $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; + + $role_options = array(); + + $current_role_id = (isset($cur_roles[$ug_id][$forum_id])) ? $cur_roles[$ug_id][$forum_id] : 0; + $s_role_options = ''; + + @reset($roles); + while (list($role_id, $role_row) = each($roles)) + { + $role_description = (!empty($user->lang[$role_row['role_description']])) ? $user->lang[$role_row['role_description']] : nl2br($role_row['role_description']); + $role_name = (!empty($user->lang[$role_row['role_name']])) ? $user->lang[$role_row['role_name']] : $role_row['role_name']; + + $title = ($role_description) ? ' title="' . $role_description . '"' : ''; + $s_role_options .= ''; + + $role_options[] = array( + 'ID' => $role_id, + 'ROLE_NAME' => $role_name, + 'TITLE' => $role_description, + 'SELECTED' => $role_id == $current_role_id, + ); + } + + if ($s_role_options) + { + $s_role_options = '' . $s_role_options; + } + + if (!$current_role_id && $mode != 'view') + { + $s_custom_permissions = false; + + foreach ($forum_array as $key => $value) + { + if ($value['S_NEVER'] || $value['S_YES']) + { + $s_custom_permissions = true; + break; + } + } + } + else + { + $s_custom_permissions = false; + } + + $template->assign_block_vars($tpl_pmask . '.' . $tpl_fmask, array( + 'NAME' => ($forum_id == 0) ? $forum_names_ary[0] : $forum_names_ary[$forum_id]['forum_name'], + 'PADDING' => ($forum_id == 0) ? '' : $forum_names_ary[$forum_id]['padding'], + 'S_CUSTOM' => $s_custom_permissions, + 'UG_ID' => $ug_id, + 'S_ROLE_OPTIONS' => $s_role_options, + 'FORUM_ID' => $forum_id) + ); + + $template->assign_block_vars_array($tpl_pmask . '.' . $tpl_fmask . '.role_options', $role_options); + + $this->assign_cat_array($forum_array, $tpl_pmask . '.' . $tpl_fmask . '.' . $tpl_category, $tpl_mask, $ug_id, $forum_id, ($mode == 'view'), $show_trace); + } + + unset($hold_ary[$ug_id], $ug_names_ary[$ug_id]); + } + } + } + + /** + * Display permission mask for roles + */ + function display_role_mask(&$hold_ary) + { + global $db, $template, $user, $phpbb_root_path, $phpEx; + global $phpbb_container; + + if (!count($hold_ary)) + { + return; + } + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + // Get forum names + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', array_keys($hold_ary)) . ' + ORDER BY left_id'; + $result = $db->sql_query($sql); + + // If the role is used globally, then reflect that + $forum_names = (isset($hold_ary[0])) ? array(0 => '') : array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_names[$row['forum_id']] = $row['forum_name']; + } + $db->sql_freeresult($result); + + foreach ($forum_names as $forum_id => $forum_name) + { + $auth_ary = $hold_ary[$forum_id]; + + $template->assign_block_vars('role_mask', array( + 'NAME' => ($forum_id == 0) ? $user->lang['GLOBAL_MASK'] : $forum_name, + 'FORUM_ID' => $forum_id) + ); + + if (isset($auth_ary['users']) && count($auth_ary['users'])) + { + $sql = 'SELECT user_id, username + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $auth_ary['users']) . ' + ORDER BY username_clean ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('role_mask.users', array( + 'USER_ID' => $row['user_id'], + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username']), + 'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username']), + )); + } + $db->sql_freeresult($result); + } + + if (isset($auth_ary['groups']) && count($auth_ary['groups'])) + { + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_id', $auth_ary['groups']) . ' + ORDER BY group_type ASC, group_name'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('role_mask.groups', array( + 'GROUP_ID' => $row['group_id'], + 'GROUP_NAME' => $group_helper->get_name($row['group_name']), + 'U_PROFILE' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=group&g={$row['group_id']}")) + ); + } + $db->sql_freeresult($result); + } + } + } + + /** + * NOTE: this function is not in use atm + * Add a new option to the list ... $options is a hash of form -> + * $options = array( + * 'local' => array('option1', 'option2', ...), + * 'global' => array('optionA', 'optionB', ...) + * ); + */ + function acl_add_option($options) + { + global $db, $cache; + + if (!is_array($options)) + { + return false; + } + + $cur_options = array(); + + // Determine current options + $sql = 'SELECT auth_option, is_global, is_local + FROM ' . ACL_OPTIONS_TABLE . ' + ORDER BY auth_option_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $cur_options[$row['auth_option']] = ($row['is_global'] && $row['is_local']) ? 'both' : (($row['is_global']) ? 'global' : 'local'); + } + $db->sql_freeresult($result); + + // Here we need to insert new options ... this requires discovering whether + // an options is global, local or both and whether we need to add an permission + // set flag (x_) + $new_options = array('local' => array(), 'global' => array()); + + foreach ($options as $type => $option_ary) + { + $option_ary = array_unique($option_ary); + + foreach ($option_ary as $option_value) + { + $new_options[$type][] = $option_value; + + $flag = substr($option_value, 0, strpos($option_value, '_') + 1); + + if (!in_array($flag, $new_options[$type])) + { + $new_options[$type][] = $flag; + } + } + } + unset($options); + + $options = array(); + $options['local'] = array_diff($new_options['local'], $new_options['global']); + $options['global'] = array_diff($new_options['global'], $new_options['local']); + $options['both'] = array_intersect($new_options['local'], $new_options['global']); + + // Now check which options to add/update + $add_options = $update_options = array(); + + // First local ones... + foreach ($options as $type => $option_ary) + { + foreach ($option_ary as $option) + { + if (!isset($cur_options[$option])) + { + $add_options[] = array( + 'auth_option' => (string) $option, + 'is_global' => ($type == 'global' || $type == 'both') ? 1 : 0, + 'is_local' => ($type == 'local' || $type == 'both') ? 1 : 0 + ); + + continue; + } + + // Else, update existing entry if it is changed... + if ($type === $cur_options[$option]) + { + continue; + } + + // New type is always both: + // If is now both, we set both. + // If it was global the new one is local and we need to set it to both + // If it was local the new one is global and we need to set it to both + $update_options[] = $option; + } + } + + if (!empty($add_options)) + { + $db->sql_multi_insert(ACL_OPTIONS_TABLE, $add_options); + } + + if (!empty($update_options)) + { + $sql = 'UPDATE ' . ACL_OPTIONS_TABLE . ' + SET is_global = 1, is_local = 1 + WHERE ' . $db->sql_in_set('auth_option', $update_options); + $db->sql_query($sql); + } + + $cache->destroy('_acl_options'); + $this->acl_clear_prefetch(); + + // Because we just changed the options and also purged the options cache, we instantly update/regenerate it for later calls to succeed. + $this->acl_options = array(); + $this->__construct(); + + return true; + } + + /** + * Set a user or group ACL record + */ + function acl_set($ug_type, $forum_id, $ug_id, $auth, $role_id = 0, $clear_prefetch = true) + { + global $db; + + // One or more forums + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + // One or more users + if (!is_array($ug_id)) + { + $ug_id = array($ug_id); + } + + $ug_id_sql = $db->sql_in_set($ug_type . '_id', array_map('intval', $ug_id)); + $forum_sql = $db->sql_in_set('forum_id', array_map('intval', $forum_id)); + + // Instead of updating, inserting, removing we just remove all current settings and re-set everything... + $table = ($ug_type == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; + $id_field = $ug_type . '_id'; + + // Get any flags as required + reset($auth); + $flag = key($auth); + $flag = substr($flag, 0, strpos($flag, '_') + 1); + + // This ID (the any-flag) is set if one or more permissions are true... + $any_option_id = (int) $this->acl_options['id'][$flag]; + + // Remove any-flag from auth ary + if (isset($auth[$flag])) + { + unset($auth[$flag]); + } + + // Remove current auth options... + $auth_option_ids = array((int) $any_option_id); + foreach ($auth as $auth_option => $auth_setting) + { + $auth_option_ids[] = (int) $this->acl_options['id'][$auth_option]; + } + + $sql = "DELETE FROM $table + WHERE $forum_sql + AND $ug_id_sql + AND " . $db->sql_in_set('auth_option_id', $auth_option_ids); + $db->sql_query($sql); + + // Remove those having a role assigned... the correct type of course... + $sql = 'SELECT role_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_type = '" . $db->sql_escape($flag) . "'"; + $result = $db->sql_query($sql); + + $role_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $role_ids[] = $row['role_id']; + } + $db->sql_freeresult($result); + + if (count($role_ids)) + { + $sql = "DELETE FROM $table + WHERE $forum_sql + AND $ug_id_sql + AND auth_option_id = 0 + AND " . $db->sql_in_set('auth_role_id', $role_ids); + $db->sql_query($sql); + } + + // Ok, include the any-flag if one or more auth options are set to yes... + foreach ($auth as $auth_option => $setting) + { + if ($setting == ACL_YES && (!isset($auth[$flag]) || $auth[$flag] == ACL_NEVER)) + { + $auth[$flag] = ACL_YES; + } + } + + $sql_ary = array(); + foreach ($forum_id as $forum) + { + $forum = (int) $forum; + + if ($role_id) + { + foreach ($ug_id as $id) + { + $sql_ary[] = array( + $id_field => (int) $id, + 'forum_id' => (int) $forum, + 'auth_option_id' => 0, + 'auth_setting' => 0, + 'auth_role_id' => (int) $role_id, + ); + } + } + else + { + foreach ($auth as $auth_option => $setting) + { + $auth_option_id = (int) $this->acl_options['id'][$auth_option]; + + if ($setting != ACL_NO) + { + foreach ($ug_id as $id) + { + $sql_ary[] = array( + $id_field => (int) $id, + 'forum_id' => (int) $forum, + 'auth_option_id' => (int) $auth_option_id, + 'auth_setting' => (int) $setting + ); + } + } + } + } + } + + $db->sql_multi_insert($table, $sql_ary); + + if ($clear_prefetch) + { + $this->acl_clear_prefetch(); + } + } + + /** + * Set a role-specific ACL record + */ + function acl_set_role($role_id, $auth) + { + global $db; + + // Get any-flag as required + reset($auth); + $flag = key($auth); + $flag = substr($flag, 0, strpos($flag, '_') + 1); + + // Remove any-flag from auth ary + if (isset($auth[$flag])) + { + unset($auth[$flag]); + } + + // Re-set any flag... + foreach ($auth as $auth_option => $setting) + { + if ($setting == ACL_YES && (!isset($auth[$flag]) || $auth[$flag] == ACL_NEVER)) + { + $auth[$flag] = ACL_YES; + } + } + + $sql_ary = array(); + foreach ($auth as $auth_option => $setting) + { + $auth_option_id = (int) $this->acl_options['id'][$auth_option]; + + if ($setting != ACL_NO) + { + $sql_ary[] = array( + 'role_id' => (int) $role_id, + 'auth_option_id' => (int) $auth_option_id, + 'auth_setting' => (int) $setting + ); + } + } + + // If no data is there, we set the any-flag to ACL_NEVER... + if (!count($sql_ary)) + { + $sql_ary[] = array( + 'role_id' => (int) $role_id, + 'auth_option_id' => (int) $this->acl_options['id'][$flag], + 'auth_setting' => ACL_NEVER + ); + } + + // Remove current auth options... + $sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . ' + WHERE role_id = ' . $role_id; + $db->sql_query($sql); + + // Now insert the new values + $db->sql_multi_insert(ACL_ROLES_DATA_TABLE, $sql_ary); + + $this->acl_clear_prefetch(); + } + + /** + * Remove local permission + */ + function acl_delete($mode, $ug_id = false, $forum_id = false, $permission_type = false) + { + global $db; + + if ($ug_id === false && $forum_id === false) + { + return; + } + + $option_id_ary = array(); + $table = ($mode == 'user') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; + $id_field = $mode . '_id'; + + $where_sql = array(); + + if ($forum_id !== false) + { + $where_sql[] = (!is_array($forum_id)) ? 'forum_id = ' . (int) $forum_id : $db->sql_in_set('forum_id', array_map('intval', $forum_id)); + } + + if ($ug_id !== false) + { + $where_sql[] = (!is_array($ug_id)) ? $id_field . ' = ' . (int) $ug_id : $db->sql_in_set($id_field, array_map('intval', $ug_id)); + } + + // There seem to be auth options involved, therefore we need to go through the list and make sure we capture roles correctly + if ($permission_type !== false) + { + // Get permission type + $sql = 'SELECT auth_option, auth_option_id + FROM ' . ACL_OPTIONS_TABLE . " + WHERE auth_option " . $db->sql_like_expression($permission_type . $db->get_any_char()); + $result = $db->sql_query($sql); + + $auth_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $option_id_ary[] = $row['auth_option_id']; + $auth_id_ary[$row['auth_option']] = ACL_NO; + } + $db->sql_freeresult($result); + + // First of all, lets grab the items having roles with the specified auth options assigned + $sql = "SELECT auth_role_id, $id_field, forum_id + FROM $table, " . ACL_ROLES_TABLE . " r + WHERE auth_role_id <> 0 + AND auth_role_id = r.role_id + AND r.role_type = '{$permission_type}' + AND " . implode(' AND ', $where_sql) . ' + ORDER BY auth_role_id'; + $result = $db->sql_query($sql); + + $cur_role_auth = array(); + while ($row = $db->sql_fetchrow($result)) + { + $cur_role_auth[$row['auth_role_id']][$row['forum_id']][] = $row[$id_field]; + } + $db->sql_freeresult($result); + + // Get role data for resetting data + if (count($cur_role_auth)) + { + $sql = 'SELECT ao.auth_option, rd.role_id, rd.auth_setting + FROM ' . ACL_OPTIONS_TABLE . ' ao, ' . ACL_ROLES_DATA_TABLE . ' rd + WHERE ao.auth_option_id = rd.auth_option_id + AND ' . $db->sql_in_set('rd.role_id', array_keys($cur_role_auth)); + $result = $db->sql_query($sql); + + $auth_settings = array(); + while ($row = $db->sql_fetchrow($result)) + { + // We need to fill all auth_options, else setting it will fail... + if (!isset($auth_settings[$row['role_id']])) + { + $auth_settings[$row['role_id']] = $auth_id_ary; + } + $auth_settings[$row['role_id']][$row['auth_option']] = $row['auth_setting']; + } + $db->sql_freeresult($result); + + // Set the options + foreach ($cur_role_auth as $role_id => $auth_row) + { + foreach ($auth_row as $f_id => $ug_row) + { + $this->acl_set($mode, $f_id, $ug_row, $auth_settings[$role_id], 0, false); + } + } + } + } + + // Now, normally remove permissions... + if ($permission_type !== false) + { + $where_sql[] = $db->sql_in_set('auth_option_id', array_map('intval', $option_id_ary)); + } + + $sql = "DELETE FROM $table + WHERE " . implode(' AND ', $where_sql); + $db->sql_query($sql); + + $this->acl_clear_prefetch(); + } + + /** + * Assign category to template + * used by display_mask() + */ + function assign_cat_array(&$category_array, $tpl_cat, $tpl_mask, $ug_id, $forum_id, $s_view, $show_trace = false) + { + global $template, $phpbb_admin_path, $phpEx, $phpbb_container; + + /* @var $phpbb_permissions \phpbb\permissions */ + $phpbb_permissions = $phpbb_container->get('acl.permissions'); + + @reset($category_array); + while (list($cat, $cat_array) = each($category_array)) + { + if (!$phpbb_permissions->category_defined($cat)) + { + continue; + } + + $template->assign_block_vars($tpl_cat, array( + '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, + 'S_NO' => ($cat_array['S_NO'] && !$cat_array['S_NEVER'] && !$cat_array['S_YES']) ? true : false, + + '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 + * + $key_array = array_intersect(array_keys($user->lang), array_map(create_function('$a', 'return "acl_" . $a;'), array_keys($cat_array['permissions']))); + $values_array = $cat_array['permissions']; + + $cat_array['permissions'] = array(); + + foreach ($key_array as $key) + { + $key = str_replace('acl_', '', $key); + $cat_array['permissions'][$key] = $values_array[$key]; + } + unset($key_array, $values_array); +*/ + @reset($cat_array['permissions']); + while (list($permission, $allowed) = each($cat_array['permissions'])) + { + if (!$phpbb_permissions->permission_defined($permission)) + { + continue; + } + + if ($s_view) + { + $template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array( + 'S_YES' => ($allowed == ACL_YES) ? true : false, + 'S_NEVER' => ($allowed == ACL_NEVER) ? true : false, + + 'UG_ID' => $ug_id, + 'FORUM_ID' => $forum_id, + 'FIELD_NAME' => $permission, + 'S_FIELD_NAME' => 'setting[' . $ug_id . '][' . $forum_id . '][' . $permission . ']', + + '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' => $phpbb_permissions->get_permission_lang($permission), + )); + } + else + { + $template->assign_block_vars($tpl_cat . '.' . $tpl_mask, array( + 'S_YES' => ($allowed == ACL_YES) ? true : false, + 'S_NEVER' => ($allowed == ACL_NEVER) ? true : false, + 'S_NO' => ($allowed == ACL_NO) ? true : false, + + 'UG_ID' => $ug_id, + 'FORUM_ID' => $forum_id, + 'FIELD_NAME' => $permission, + 'S_FIELD_NAME' => 'setting[' . $ug_id . '][' . $forum_id . '][' . $permission . ']', + + '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' => $phpbb_permissions->get_permission_lang($permission), + )); + } + } + } + } + + /** + * Building content array from permission rows with explicit key ordering + * used by display_mask() + */ + function build_permission_array(&$permission_row, &$content_array, &$categories, $key_sort_array) + { + global $phpbb_container; + + /* @var $phpbb_permissions \phpbb\permissions */ + $phpbb_permissions = $phpbb_container->get('acl.permissions'); + + foreach ($key_sort_array as $forum_id) + { + if (!isset($permission_row[$forum_id])) + { + continue; + } + + $permissions = $permission_row[$forum_id]; + ksort($permissions); + + @reset($permissions); + while (list($permission, $auth_setting) = each($permissions)) + { + $cat = $phpbb_permissions->get_permission_category($permission); + + // Build our categories array + if (!isset($categories[$cat])) + { + $categories[$cat] = $phpbb_permissions->get_category_lang($cat); + } + + // Build our content array + if (!isset($content_array[$forum_id])) + { + $content_array[$forum_id] = array(); + } + + if (!isset($content_array[$forum_id][$cat])) + { + $content_array[$forum_id][$cat] = array( + 'S_YES' => false, + 'S_NEVER' => false, + 'S_NO' => false, + 'permissions' => array(), + ); + } + + $content_array[$forum_id][$cat]['S_YES'] |= ($auth_setting == ACL_YES) ? true : false; + $content_array[$forum_id][$cat]['S_NEVER'] |= ($auth_setting == ACL_NEVER) ? true : false; + $content_array[$forum_id][$cat]['S_NO'] |= ($auth_setting == ACL_NO) ? true : false; + + $content_array[$forum_id][$cat]['permissions'][$permission] = $auth_setting; + } + } + } + + /** + * Use permissions from another user. This transferes a permission set from one user to another. + * The other user is always able to revert back to his permission set. + * This function does not check for lower/higher permissions, it is possible for the user to gain + * "more" permissions by this. + * Admin permissions will not be copied. + */ + function ghost_permissions($from_user_id, $to_user_id) + { + global $db; + + if ($to_user_id == ANONYMOUS) + { + return false; + } + + $hold_ary = $this->acl_raw_data_single_user($from_user_id); + + // Key 0 in $hold_ary are global options, all others are forum_ids + + // We disallow copying admin permissions + foreach ($this->acl_options['global'] as $opt => $id) + { + if (strpos($opt, 'a_') === 0) + { + $hold_ary[0][$this->acl_options['id'][$opt]] = ACL_NEVER; + } + } + + // Force a_switchperm to be allowed + $hold_ary[0][$this->acl_options['id']['a_switchperm']] = ACL_YES; + + $user_permissions = $this->build_bitstring($hold_ary); + + if (!$user_permissions) + { + return false; + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_permissions = '" . $db->sql_escape($user_permissions) . "', + user_perm_from = $from_user_id + WHERE user_id = " . $to_user_id; + $db->sql_query($sql); + + return true; + } +} diff --git a/install/update/old/includes/bbcode.php b/install/update/old/includes/bbcode.php new file mode 100644 index 0000000..c31b63a --- /dev/null +++ b/install/update/old/includes/bbcode.php @@ -0,0 +1,707 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* BBCode class +*/ +class bbcode +{ + var $bbcode_uid = ''; + var $bbcode_bitfield = ''; + var $bbcode_cache = array(); + var $bbcode_template = array(); + + var $bbcodes = array(); + + var $template_bitfield; + + /** + * Constructor + */ + function __construct($bitfield = '') + { + $this->bbcode_set_bitfield($bitfield); + } + + /** + * Init bbcode cache entries if bitfield is specified + * + * @param string $bbcode_bitfield The bbcode bitfield + */ + function bbcode_set_bitfield($bitfield = '') + { + if ($bitfield) + { + $this->bbcode_bitfield = $bitfield; + $this->bbcode_cache_init(); + } + } + + /** + * Second pass bbcodes + */ + function bbcode_second_pass(&$message, $bbcode_uid = '', $bbcode_bitfield = false) + { + if ($bbcode_uid) + { + $this->bbcode_uid = $bbcode_uid; + } + + if ($bbcode_bitfield !== false) + { + $this->bbcode_bitfield = $bbcode_bitfield; + + // Init those added with a new bbcode_bitfield (already stored codes will not get parsed again) + $this->bbcode_cache_init(); + } + + if (!$this->bbcode_bitfield) + { + // Remove the uid from tags that have not been transformed into HTML + if ($this->bbcode_uid) + { + $message = str_replace(':' . $this->bbcode_uid, '', $message); + } + + return; + } + + $str = array('search' => array(), 'replace' => array()); + $preg = array('search' => array(), 'replace' => array()); + + $bitfield = new bitfield($this->bbcode_bitfield); + $bbcodes_set = $bitfield->get_all_set(); + + $undid_bbcode_specialchars = false; + foreach ($bbcodes_set as $bbcode_id) + { + if (!empty($this->bbcode_cache[$bbcode_id])) + { + foreach ($this->bbcode_cache[$bbcode_id] as $type => $array) + { + foreach ($array as $search => $replace) + { + ${$type}['search'][] = str_replace('$uid', $this->bbcode_uid, $search); + ${$type}['replace'][] = $replace; + } + + if (count($str['search'])) + { + $message = str_replace($str['search'], $str['replace'], $message); + $str = array('search' => array(), 'replace' => array()); + } + + if (count($preg['search'])) + { + // we need to turn the entities back into their original form to allow the + // search patterns to work properly + if (!$undid_bbcode_specialchars) + { + $message = str_replace(array(':', '.'), array(':', '.'), $message); + $undid_bbcode_specialchars = true; + } + + foreach ($preg['search'] as $key => $search) + { + if (is_callable($preg['replace'][$key])) + { + $message = preg_replace_callback($search, $preg['replace'][$key], $message); + } + else + { + $message = preg_replace($search, $preg['replace'][$key], $message); + } + } + + $preg = array('search' => array(), 'replace' => array()); + } + } + } + } + + // Remove the uid from tags that have not been transformed into HTML + $message = str_replace(':' . $this->bbcode_uid, '', $message); + } + + /** + * Init bbcode cache + * + * requires: $this->bbcode_bitfield + * sets: $this->bbcode_cache with bbcode templates needed for bbcode_bitfield + */ + function bbcode_cache_init() + { + global $user, $phpbb_dispatcher, $phpbb_extension_manager, $phpbb_container, $phpbb_filesystem; + + if (empty($this->template_filename)) + { + $this->template_bitfield = new bitfield($user->style['bbcode_bitfield']); + + $template = new \phpbb\template\twig\twig( + $phpbb_container->get('path_helper'), + $phpbb_container->get('config'), + new \phpbb\template\context(), + new \phpbb\template\twig\environment( + $phpbb_container->get('config'), + $phpbb_container->get('filesystem'), + $phpbb_container->get('path_helper'), + $phpbb_container->getParameter('core.cache_dir'), + $phpbb_container->get('ext.manager'), + new \phpbb\template\twig\loader( + $phpbb_filesystem + ) + ), + $phpbb_container->getParameter('core.cache_dir'), + $phpbb_container->get('user'), + $phpbb_container->get('template.twig.extensions.collection'), + $phpbb_extension_manager + ); + + $template->set_style(); + $template->set_filenames(array('bbcode.html' => 'bbcode.html')); + $this->template_filename = $template->get_source_file_for_handle('bbcode.html'); + } + + $bbcode_ids = $rowset = $sql = array(); + + $bitfield = new bitfield($this->bbcode_bitfield); + $bbcodes_set = $bitfield->get_all_set(); + + foreach ($bbcodes_set as $bbcode_id) + { + if (isset($this->bbcode_cache[$bbcode_id])) + { + // do not try to re-cache it if it's already in + continue; + } + $bbcode_ids[] = $bbcode_id; + + if ($bbcode_id > NUM_CORE_BBCODES) + { + $sql[] = $bbcode_id; + } + } + + if (count($sql)) + { + global $db; + + $sql = 'SELECT * + FROM ' . BBCODES_TABLE . ' + WHERE ' . $db->sql_in_set('bbcode_id', $sql); + $result = $db->sql_query($sql, 3600); + + while ($row = $db->sql_fetchrow($result)) + { + // To circumvent replacing newlines with
for the generated html, + // we use carriage returns here. They are later changed back to newlines + $row['bbcode_tpl'] = str_replace("\n", "\r", $row['bbcode_tpl']); + $row['second_pass_replace'] = str_replace("\n", "\r", $row['second_pass_replace']); + + $rowset[$row['bbcode_id']] = $row; + } + $db->sql_freeresult($result); + } + + // To perform custom second pass in extension, use $this->bbcode_second_pass_by_extension() + // method which accepts variable number of parameters + foreach ($bbcode_ids as $bbcode_id) + { + switch ($bbcode_id) + { + case BBCODE_ID_QUOTE: + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[/quote:$uid]' => $this->bbcode_tpl('quote_close', $bbcode_id) + ), + 'preg' => array( + '#\[quote(?:="(.*?)")?:$uid\]((?!\[quote(?:=".*?")?:$uid\]).)?#is' => function ($match) { + if (!isset($match[2])) + { + $match[2] = ''; + } + + return $this->bbcode_second_pass_quote($match[1], $match[2]); + }, + ) + ); + break; + + case BBCODE_ID_B: + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[b:$uid]' => $this->bbcode_tpl('b_open', $bbcode_id), + '[/b:$uid]' => $this->bbcode_tpl('b_close', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_I: + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[i:$uid]' => $this->bbcode_tpl('i_open', $bbcode_id), + '[/i:$uid]' => $this->bbcode_tpl('i_close', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_URL: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[url:$uid\]((.*?))\[/url:$uid\]#s' => $this->bbcode_tpl('url', $bbcode_id), + '#\[url=([^\[]+?):$uid\](.*?)\[/url:$uid\]#s' => $this->bbcode_tpl('url', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_IMG: + if ($user->optionget('viewimg')) + { + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[img:$uid\](.*?)\[/img:$uid\]#s' => $this->bbcode_tpl('img', $bbcode_id), + ) + ); + } + else + { + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[img:$uid\](.*?)\[/img:$uid\]#s' => str_replace('$2', '[ img ]', $this->bbcode_tpl('url', $bbcode_id, true)), + ) + ); + } + break; + + case BBCODE_ID_SIZE: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[size=([\-\+]?\d+):$uid\](.*?)\[/size:$uid\]#s' => $this->bbcode_tpl('size', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_COLOR: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+):$uid\](.*?)\[/color:$uid\]!is' => $this->bbcode_tpl('color', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_U: + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[u:$uid]' => $this->bbcode_tpl('u_open', $bbcode_id), + '[/u:$uid]' => $this->bbcode_tpl('u_close', $bbcode_id), + ) + ); + break; + + case BBCODE_ID_CODE: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[code(?:=([a-z]+))?:$uid\](.*?)\[/code:$uid\]#is' => function ($match) { + return $this->bbcode_second_pass_code($match[1], $match[2]); + }, + ) + ); + break; + + case BBCODE_ID_LIST: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#(\[\/?(list|\*):[mou]?:?$uid\])[\n]{1}#' => "\$1", + '#(\[list=([^\[]+):$uid\])[\n]{1}#' => "\$1", + '#\[list=([^\[]+):$uid\]#' => function ($match) { + return $this->bbcode_list($match[1]); + }, + ), + 'str' => array( + '[list:$uid]' => $this->bbcode_tpl('ulist_open_default', $bbcode_id), + '[/list:u:$uid]' => $this->bbcode_tpl('ulist_close', $bbcode_id), + '[/list:o:$uid]' => $this->bbcode_tpl('olist_close', $bbcode_id), + '[*:$uid]' => $this->bbcode_tpl('listitem', $bbcode_id), + '[/*:$uid]' => $this->bbcode_tpl('listitem_close', $bbcode_id), + '[/*:m:$uid]' => $this->bbcode_tpl('listitem_close', $bbcode_id) + ), + ); + break; + + case BBCODE_ID_EMAIL: + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[email:$uid\]((.*?))\[/email:$uid\]#is' => $this->bbcode_tpl('email', $bbcode_id), + '#\[email=([^\[]+):$uid\](.*?)\[/email:$uid\]#is' => $this->bbcode_tpl('email', $bbcode_id) + ) + ); + break; + + case BBCODE_ID_FLASH: + if ($user->optionget('viewflash')) + { + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[flash=([0-9]+),([0-9]+):$uid\](.*?)\[/flash:$uid\]#' => $this->bbcode_tpl('flash', $bbcode_id), + ) + ); + } + else + { + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array( + '#\[flash=([0-9]+),([0-9]+):$uid\](.*?)\[/flash:$uid\]#' => str_replace('$1', '$3', str_replace('$2', '[ flash ]', $this->bbcode_tpl('url', $bbcode_id, true))) + ) + ); + } + break; + + case BBCODE_ID_ATTACH: + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array( + '[/attachment:$uid]' => $this->bbcode_tpl('inline_attachment_close', $bbcode_id) + ), + 'preg' => array( + '#\[attachment=([0-9]+):$uid\]#' => $this->bbcode_tpl('inline_attachment_open', $bbcode_id) + ) + ); + break; + + default: + if (isset($rowset[$bbcode_id])) + { + if ($this->template_bitfield->get($bbcode_id)) + { + // The bbcode requires a custom template to be loaded + if (!$bbcode_tpl = $this->bbcode_tpl($rowset[$bbcode_id]['bbcode_tag'], $bbcode_id)) + { + // For some reason, the required template seems not to be available, use the default template + $bbcode_tpl = (!empty($rowset[$bbcode_id]['second_pass_replace'])) ? $rowset[$bbcode_id]['second_pass_replace'] : $rowset[$bbcode_id]['bbcode_tpl']; + } + else + { + // In order to use templates with custom bbcodes we need + // to replace all {VARS} to corresponding backreferences + // Note that backreferences are numbered from bbcode_match + if (preg_match_all('/\{(URL|LOCAL_URL|EMAIL|TEXT|SIMPLETEXT|INTTEXT|IDENTIFIER|COLOR|NUMBER)[0-9]*\}/', $rowset[$bbcode_id]['bbcode_match'], $m)) + { + foreach ($m[0] as $i => $tok) + { + $bbcode_tpl = str_replace($tok, '$' . ($i + 1), $bbcode_tpl); + } + } + } + } + else + { + // Default template + $bbcode_tpl = (!empty($rowset[$bbcode_id]['second_pass_replace'])) ? $rowset[$bbcode_id]['second_pass_replace'] : $rowset[$bbcode_id]['bbcode_tpl']; + } + + // Replace {L_*} lang strings + $bbcode_tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) { + return (!empty($user->lang[$match[1]])) ? $user->lang($match[1]) : ucwords(strtolower(str_replace('_', ' ', $match[1]))); + }, $bbcode_tpl); + + if (!empty($rowset[$bbcode_id]['second_pass_replace'])) + { + // The custom BBCode requires second-pass pattern replacements + $this->bbcode_cache[$bbcode_id] = array( + 'preg' => array($rowset[$bbcode_id]['second_pass_match'] => $bbcode_tpl) + ); + } + else + { + $this->bbcode_cache[$bbcode_id] = array( + 'str' => array($rowset[$bbcode_id]['second_pass_match'] => $bbcode_tpl) + ); + } + } + else + { + $this->bbcode_cache[$bbcode_id] = false; + } + break; + } + } + + $bbcode_cache = $this->bbcode_cache; + $bbcode_bitfield = $this->bbcode_bitfield; + $bbcode_uid = $this->bbcode_uid; + + /** + * Use this event to modify the bbcode_cache + * + * @event core.bbcode_cache_init_end + * @var array bbcode_cache The array of cached search and replace patterns of bbcodes + * @var string bbcode_bitfield The bbcode bitfield + * @var string bbcode_uid The bbcode uid + * @since 3.1.3-RC1 + */ + $vars = array('bbcode_cache', 'bbcode_bitfield', 'bbcode_uid'); + extract($phpbb_dispatcher->trigger_event('core.bbcode_cache_init_end', compact($vars))); + + $this->bbcode_cache = $bbcode_cache; + $this->bbcode_bitfield = $bbcode_bitfield; + $this->bbcode_uid = $bbcode_uid; + } + + /** + * Return bbcode template + */ + function bbcode_tpl($tpl_name, $bbcode_id = -1, $skip_bitfield_check = false) + { + static $bbcode_hardtpl = array(); + if (empty($bbcode_hardtpl)) + { + global $user; + + $bbcode_hardtpl = array( + 'b_open' => '', + 'b_close' => '', + 'i_open' => '', + 'i_close' => '', + 'u_open' => '', + 'u_close' => '', + 'img' => '' . $user->lang['IMAGE'] . '', + 'size' => '$2', + 'color' => '$2', + 'email' => '$2' + ); + } + + if ($bbcode_id != -1 && !$skip_bitfield_check && !$this->template_bitfield->get($bbcode_id)) + { + return (isset($bbcode_hardtpl[$tpl_name])) ? $bbcode_hardtpl[$tpl_name] : false; + } + + if (empty($this->bbcode_template)) + { + if (($tpl = file_get_contents($this->template_filename)) === false) + { + trigger_error('Could not load bbcode template', E_USER_ERROR); + } + + // replace \ with \\ and then ' with \'. + $tpl = str_replace('\\', '\\\\', $tpl); + $tpl = str_replace("'", "\'", $tpl); + + // strip newlines and indent + $tpl = preg_replace("/\n[\n\r\s\t]*/", '', $tpl); + + // Turn template blocks into PHP assignment statements for the values of $bbcode_tpl.. + $this->bbcode_template = array(); + + // Capture the BBCode template matches + // Allow phpBB template or the Twig syntax + $matches = (preg_match_all('#(.*?)#', $tpl, $match)) ?: + preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $tpl, $match); + + for ($i = 0; $i < $matches; $i++) + { + if (empty($match[1][$i])) + { + continue; + } + + $this->bbcode_template[$match[1][$i]] = $this->bbcode_tpl_replace($match[1][$i], $match[2][$i]); + } + } + + return (isset($this->bbcode_template[$tpl_name])) ? $this->bbcode_template[$tpl_name] : ((isset($bbcode_hardtpl[$tpl_name])) ? $bbcode_hardtpl[$tpl_name] : false); + } + + /** + * Return bbcode template replacement + */ + function bbcode_tpl_replace($tpl_name, $tpl) + { + global $user; + + static $replacements = array( + 'quote_username_open' => array('{USERNAME}' => '$1'), + 'color' => array('{COLOR}' => '$1', '{TEXT}' => '$2'), + 'size' => array('{SIZE}' => '$1', '{TEXT}' => '$2'), + 'img' => array('{URL}' => '$1'), + 'flash' => array('{WIDTH}' => '$1', '{HEIGHT}' => '$2', '{URL}' => '$3'), + 'url' => array('{URL}' => '$1', '{DESCRIPTION}' => '$2'), + 'email' => array('{EMAIL}' => '$1', '{DESCRIPTION}' => '$2') + ); + + $tpl = preg_replace_callback('/{L_([A-Z0-9_]+)}/', function ($match) use ($user) { + return (!empty($user->lang[$match[1]])) ? $user->lang($match[1]) : ucwords(strtolower(str_replace('_', ' ', $match[1]))); + }, $tpl); + + if (!empty($replacements[$tpl_name])) + { + $tpl = strtr($tpl, $replacements[$tpl_name]); + } + + return trim($tpl); + } + + /** + * Second parse list bbcode + */ + function bbcode_list($type) + { + if ($type == '') + { + $tpl = 'ulist_open_default'; + $type = 'default'; + } + else if ($type == 'i') + { + $tpl = 'olist_open'; + $type = 'lower-roman'; + } + else if ($type == 'I') + { + $tpl = 'olist_open'; + $type = 'upper-roman'; + } + else if (preg_match('#^(disc|circle|square)$#i', $type)) + { + $tpl = 'ulist_open'; + $type = strtolower($type); + } + else if (preg_match('#^[a-z]$#', $type)) + { + $tpl = 'olist_open'; + $type = 'lower-alpha'; + } + else if (preg_match('#[A-Z]#', $type)) + { + $tpl = 'olist_open'; + $type = 'upper-alpha'; + } + else if (is_numeric($type)) + { + $tpl = 'olist_open'; + $type = 'decimal'; + } + else + { + $tpl = 'olist_open'; + $type = 'decimal'; + } + + return str_replace('{LIST_TYPE}', $type, $this->bbcode_tpl($tpl)); + } + + /** + * Second parse quote tag + */ + function bbcode_second_pass_quote($username, $quote) + { + // when using the /e modifier, preg_replace slashes double-quotes but does not + // seem to slash anything else + $quote = str_replace('\"', '"', $quote); + $username = str_replace('\"', '"', $username); + + // remove newline at the beginning + if ($quote == "\n") + { + $quote = ''; + } + + $quote = (($username) ? str_replace('$1', $username, $this->bbcode_tpl('quote_username_open')) : $this->bbcode_tpl('quote_open')) . $quote; + + return $quote; + } + + /** + * Second parse code tag + */ + function bbcode_second_pass_code($type, $code) + { + // when using the /e modifier, preg_replace slashes double-quotes but does not + // seem to slash anything else + $code = str_replace('\"', '"', $code); + + switch ($type) + { + case 'php': + // Not the english way, but valid because of hardcoded syntax highlighting + if (strpos($code, '
') === 0) + { + $code = substr($code, 41); + } + + // no break; + + default: + $code = str_replace("\t", '   ', $code); + $code = str_replace(' ', '  ', $code); + $code = str_replace(' ', '  ', $code); + $code = str_replace("\n ", "\n ", $code); + + // keep space at the beginning + if (!empty($code) && $code[0] == ' ') + { + $code = ' ' . substr($code, 1); + } + + // remove newline at the beginning + if (!empty($code) && $code[0] == "\n") + { + $code = substr($code, 1); + } + break; + } + + $code = $this->bbcode_tpl('code_open') . $code . $this->bbcode_tpl('code_close'); + + return $code; + } + + /** + * Function to perform custom bbcode second pass by extensions + * can be used to assign bbcode pattern replacement + * Example: '#\[list=([^\[]+):$uid\]#e' => "\$this->bbcode_second_pass_by_extension('\$1')" + * + * Accepts variable number of parameters + * + * @return mixed Second pass result + */ + function bbcode_second_pass_by_extension() + { + global $phpbb_dispatcher; + + $return = false; + $params_array = func_get_args(); + + /** + * Event to perform bbcode second pass with + * the custom validating methods provided by extensions + * + * @event core.bbcode_second_pass_by_extension + * @var array params_array Array with the function parameters + * @var mixed return Second pass result to return + * + * @since 3.1.5-RC1 + */ + $vars = array('params_array', 'return'); + extract($phpbb_dispatcher->trigger_event('core.bbcode_second_pass_by_extension', compact($vars))); + + return $return; + } +} diff --git a/install/update/old/includes/compatibility_globals.php b/install/update/old/includes/compatibility_globals.php new file mode 100644 index 0000000..ad394e3 --- /dev/null +++ b/install/update/old/includes/compatibility_globals.php @@ -0,0 +1,84 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** + * Sets compatibility globals in the global scope + * + * This function registers compatibility variables to the global + * variable scope. This is required to make it possible to include this file + * in a service. + */ +function register_compatibility_globals() +{ + global $phpbb_container; + + global $cache, $phpbb_dispatcher, $request, $user, $auth, $db, $config, $language, $phpbb_log; + global $symfony_request, $phpbb_filesystem, $phpbb_path_helper, $phpbb_extension_manager, $template; + + // set up caching + /* @var $cache \phpbb\cache\service */ + $cache = $phpbb_container->get('cache'); + + // Instantiate some basic classes + /* @var $phpbb_dispatcher \phpbb\event\dispatcher */ + $phpbb_dispatcher = $phpbb_container->get('dispatcher'); + + /* @var $request \phpbb\request\request_interface */ + $request = $phpbb_container->get('request'); + // Inject request instance, so only this instance is used with request_var + request_var('', 0, false, false, $request); + + /* @var $user \phpbb\user */ + $user = $phpbb_container->get('user'); + + /* @var \phpbb\language\language $language */ + $language = $phpbb_container->get('language'); + + /* @var $auth \phpbb\auth\auth */ + $auth = $phpbb_container->get('auth'); + + /* @var $db \phpbb\db\driver\driver_interface */ + $db = $phpbb_container->get('dbal.conn'); + + // Grab global variables, re-cache if necessary + /* @var $config phpbb\config\db */ + $config = $phpbb_container->get('config'); + set_config('', '', false, $config); + set_config_count('', 0, false, $config); + + /* @var $phpbb_log \phpbb\log\log_interface */ + $phpbb_log = $phpbb_container->get('log'); + + /* @var $symfony_request \phpbb\symfony_request */ + $symfony_request = $phpbb_container->get('symfony_request'); + + /* @var $phpbb_filesystem \phpbb\filesystem\filesystem_interface */ + $phpbb_filesystem = $phpbb_container->get('filesystem'); + + /* @var $phpbb_path_helper \phpbb\path_helper */ + $phpbb_path_helper = $phpbb_container->get('path_helper'); + + // load extensions + /* @var $phpbb_extension_manager \phpbb\extension\manager */ + $phpbb_extension_manager = $phpbb_container->get('ext.manager'); + + /* @var $template \phpbb\template\template */ + $template = $phpbb_container->get('template'); +} diff --git a/install/update/old/includes/constants.php b/install/update/old/includes/constants.php new file mode 100644 index 0000000..3effe6c --- /dev/null +++ b/install/update/old/includes/constants.php @@ -0,0 +1,316 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* valid external constants: +* PHPBB_MSG_HANDLER +* PHPBB_DB_NEW_LINK +* PHPBB_ROOT_PATH +* PHPBB_ADMIN_PATH +*/ + +// phpBB Version +@define('PHPBB_VERSION', '3.2.7'); + +// QA-related +// define('PHPBB_QA', 1); + +// User related +define('ANONYMOUS', 1); + +define('USER_ACTIVATION_NONE', 0); +define('USER_ACTIVATION_SELF', 1); +define('USER_ACTIVATION_ADMIN', 2); +define('USER_ACTIVATION_DISABLE', 3); + +define('AVATAR_UPLOAD', 1); +define('AVATAR_REMOTE', 2); +define('AVATAR_GALLERY', 3); + +define('USER_NORMAL', 0); +define('USER_INACTIVE', 1); +define('USER_IGNORE', 2); +define('USER_FOUNDER', 3); + +define('INACTIVE_REGISTER', 1); // Newly registered account +define('INACTIVE_PROFILE', 2); // Profile details changed +define('INACTIVE_MANUAL', 3); // Account deactivated by administrator +define('INACTIVE_REMIND', 4); // Forced user account reactivation + +// ACL +define('ACL_NEVER', 0); +define('ACL_YES', 1); +define('ACL_NO', -1); + +// Login error codes +define('LOGIN_CONTINUE', 1); +define('LOGIN_BREAK', 2); +define('LOGIN_SUCCESS', 3); +define('LOGIN_SUCCESS_CREATE_PROFILE', 20); +define('LOGIN_SUCCESS_LINK_PROFILE', 21); +define('LOGIN_ERROR_USERNAME', 10); +define('LOGIN_ERROR_PASSWORD', 11); +define('LOGIN_ERROR_ACTIVE', 12); +define('LOGIN_ERROR_ATTEMPTS', 13); +define('LOGIN_ERROR_EXTERNAL_AUTH', 14); +define('LOGIN_ERROR_PASSWORD_CONVERT', 15); + +// Maximum login attempts +// The value is arbitrary, but it has to fit into the user_login_attempts field. +define('LOGIN_ATTEMPTS_MAX', 100); + +// Group settings +define('GROUP_OPEN', 0); +define('GROUP_CLOSED', 1); +define('GROUP_HIDDEN', 2); +define('GROUP_SPECIAL', 3); +define('GROUP_FREE', 4); + +// Forum/Topic states +define('FORUM_CAT', 0); +define('FORUM_POST', 1); +define('FORUM_LINK', 2); +define('ITEM_UNLOCKED', 0); +define('ITEM_LOCKED', 1); +define('ITEM_MOVED', 2); + +define('ITEM_UNAPPROVED', 0); // => has not yet been approved +define('ITEM_APPROVED', 1); // => has been approved, and has not been soft deleted +define('ITEM_DELETED', 2); // => has been soft deleted +define('ITEM_REAPPROVE', 3); // => has been edited and needs to be re-approved + +// Forum Flags +define('FORUM_FLAG_LINK_TRACK', 1); +define('FORUM_FLAG_PRUNE_POLL', 2); +define('FORUM_FLAG_PRUNE_ANNOUNCE', 4); +define('FORUM_FLAG_PRUNE_STICKY', 8); +define('FORUM_FLAG_ACTIVE_TOPICS', 16); +define('FORUM_FLAG_POST_REVIEW', 32); +define('FORUM_FLAG_QUICK_REPLY', 64); + +// Forum Options... sequential order. Modifications should begin at number 10 (number 29 is maximum) +define('FORUM_OPTION_FEED_NEWS', 1); +define('FORUM_OPTION_FEED_EXCLUDE', 2); + +// Optional text flags +define('OPTION_FLAG_BBCODE', 1); +define('OPTION_FLAG_SMILIES', 2); +define('OPTION_FLAG_LINKS', 4); + +// Topic types +define('POST_NORMAL', 0); +define('POST_STICKY', 1); +define('POST_ANNOUNCE', 2); +define('POST_GLOBAL', 3); + +// Lastread types +define('TRACK_NORMAL', 0); +define('TRACK_POSTED', 1); + +// Notify methods +define('NOTIFY_EMAIL', 0); +define('NOTIFY_IM', 1); +define('NOTIFY_BOTH', 2); + +// Notify status +define('NOTIFY_YES', 0); +define('NOTIFY_NO', 1); + +// Email Priority Settings +define('MAIL_LOW_PRIORITY', 4); +define('MAIL_NORMAL_PRIORITY', 3); +define('MAIL_HIGH_PRIORITY', 2); + +// Log types +define('LOG_ADMIN', 0); +define('LOG_MOD', 1); +define('LOG_CRITICAL', 2); +define('LOG_USERS', 3); + +// Private messaging - Do NOT change these values +define('PRIVMSGS_HOLD_BOX', -4); +define('PRIVMSGS_NO_BOX', -3); +define('PRIVMSGS_OUTBOX', -2); +define('PRIVMSGS_SENTBOX', -1); +define('PRIVMSGS_INBOX', 0); + +// Full Folder Actions +define('FULL_FOLDER_NONE', -3); +define('FULL_FOLDER_DELETE', -2); +define('FULL_FOLDER_HOLD', -1); + +// Download Modes - Attachments +define('INLINE_LINK', 1); +// This mode is only used internally to allow modders extending the attachment functionality +define('PHYSICAL_LINK', 2); + +// Confirm types +define('CONFIRM_REG', 1); +define('CONFIRM_LOGIN', 2); +define('CONFIRM_POST', 3); +define('CONFIRM_REPORT', 4); + +// Categories - Attachments +define('ATTACHMENT_CATEGORY_NONE', 0); +define('ATTACHMENT_CATEGORY_IMAGE', 1); // Inline Images +define('ATTACHMENT_CATEGORY_WM', 2); // Windows Media Files - Streaming - @deprecated 3.2 +define('ATTACHMENT_CATEGORY_RM', 3); // Real Media Files - Streaming - @deprecated 3.2 +define('ATTACHMENT_CATEGORY_THUMB', 4); // Not used within the database, only while displaying posts +define('ATTACHMENT_CATEGORY_FLASH', 5); // Flash/SWF files +define('ATTACHMENT_CATEGORY_QUICKTIME', 6); // Quicktime/Mov files - @deprecated 3.2 + +// BBCode UID length +define('BBCODE_UID_LEN', 8); + +// Number of core BBCodes +define('NUM_CORE_BBCODES', 12); +define('NUM_PREDEFINED_BBCODES', 22); + +// BBCode IDs +define('BBCODE_ID_QUOTE', 0); +define('BBCODE_ID_B', 1); +define('BBCODE_ID_I', 2); +define('BBCODE_ID_URL', 3); +define('BBCODE_ID_IMG', 4); +define('BBCODE_ID_SIZE', 5); +define('BBCODE_ID_COLOR', 6); +define('BBCODE_ID_U', 7); +define('BBCODE_ID_CODE', 8); +define('BBCODE_ID_LIST', 9); +define('BBCODE_ID_EMAIL', 10); +define('BBCODE_ID_FLASH', 11); +define('BBCODE_ID_ATTACH', 12); + +// BBCode hard limit +define('BBCODE_LIMIT', 1511); + +// Smiley hard limit +define('SMILEY_LIMIT', 1000); + +// Magic url types +define('MAGIC_URL_EMAIL', 1); +define('MAGIC_URL_FULL', 2); +define('MAGIC_URL_LOCAL', 3); +define('MAGIC_URL_WWW', 4); + +// Profile Field Types +define('FIELD_INT', 1); +define('FIELD_STRING', 2); +define('FIELD_TEXT', 3); +define('FIELD_BOOL', 4); +define('FIELD_DROPDOWN', 5); +define('FIELD_DATE', 6); + +// referer validation +define('REFERER_VALIDATE_NONE', 0); +define('REFERER_VALIDATE_HOST', 1); +define('REFERER_VALIDATE_PATH', 2); + +// phpbb_chmod() permissions +@define('CHMOD_ALL', 7); +@define('CHMOD_READ', 4); +@define('CHMOD_WRITE', 2); +@define('CHMOD_EXECUTE', 1); + +// Captcha code length +define('CAPTCHA_MIN_CHARS', 4); +define('CAPTCHA_MAX_CHARS', 7); + +// Additional constants +define('VOTE_CONVERTED', 127); + +// BC global FTW +global $table_prefix; + +// Table names +define('ACL_GROUPS_TABLE', $table_prefix . 'acl_groups'); +define('ACL_OPTIONS_TABLE', $table_prefix . 'acl_options'); +define('ACL_ROLES_DATA_TABLE', $table_prefix . 'acl_roles_data'); +define('ACL_ROLES_TABLE', $table_prefix . 'acl_roles'); +define('ACL_USERS_TABLE', $table_prefix . 'acl_users'); +define('ATTACHMENTS_TABLE', $table_prefix . 'attachments'); +define('BANLIST_TABLE', $table_prefix . 'banlist'); +define('BBCODES_TABLE', $table_prefix . 'bbcodes'); +define('BOOKMARKS_TABLE', $table_prefix . 'bookmarks'); +define('BOTS_TABLE', $table_prefix . 'bots'); +@define('CONFIG_TABLE', $table_prefix . 'config'); +define('CONFIG_TEXT_TABLE', $table_prefix . 'config_text'); +define('CONFIRM_TABLE', $table_prefix . 'confirm'); +define('DISALLOW_TABLE', $table_prefix . 'disallow'); +define('DRAFTS_TABLE', $table_prefix . 'drafts'); +define('EXT_TABLE', $table_prefix . 'ext'); +define('EXTENSIONS_TABLE', $table_prefix . 'extensions'); +define('EXTENSION_GROUPS_TABLE', $table_prefix . 'extension_groups'); +define('FORUMS_TABLE', $table_prefix . 'forums'); +define('FORUMS_ACCESS_TABLE', $table_prefix . 'forums_access'); +define('FORUMS_TRACK_TABLE', $table_prefix . 'forums_track'); +define('FORUMS_WATCH_TABLE', $table_prefix . 'forums_watch'); +define('GROUPS_TABLE', $table_prefix . 'groups'); +define('ICONS_TABLE', $table_prefix . 'icons'); +define('LANG_TABLE', $table_prefix . 'lang'); +define('LOG_TABLE', $table_prefix . 'log'); +define('LOGIN_ATTEMPT_TABLE', $table_prefix . 'login_attempts'); +define('MIGRATIONS_TABLE', $table_prefix . 'migrations'); +define('MODERATOR_CACHE_TABLE', $table_prefix . 'moderator_cache'); +define('MODULES_TABLE', $table_prefix . 'modules'); +define('NOTIFICATION_TYPES_TABLE', $table_prefix . 'notification_types'); +define('NOTIFICATIONS_TABLE', $table_prefix . 'notifications'); +define('POLL_OPTIONS_TABLE', $table_prefix . 'poll_options'); +define('POLL_VOTES_TABLE', $table_prefix . 'poll_votes'); +define('POSTS_TABLE', $table_prefix . 'posts'); +define('PRIVMSGS_TABLE', $table_prefix . 'privmsgs'); +define('PRIVMSGS_FOLDER_TABLE', $table_prefix . 'privmsgs_folder'); +define('PRIVMSGS_RULES_TABLE', $table_prefix . 'privmsgs_rules'); +define('PRIVMSGS_TO_TABLE', $table_prefix . 'privmsgs_to'); +define('PROFILE_FIELDS_TABLE', $table_prefix . 'profile_fields'); +define('PROFILE_FIELDS_DATA_TABLE', $table_prefix . 'profile_fields_data'); +define('PROFILE_FIELDS_LANG_TABLE', $table_prefix . 'profile_fields_lang'); +define('PROFILE_LANG_TABLE', $table_prefix . 'profile_lang'); +define('RANKS_TABLE', $table_prefix . 'ranks'); +define('REPORTS_TABLE', $table_prefix . 'reports'); +define('REPORTS_REASONS_TABLE', $table_prefix . 'reports_reasons'); +define('SEARCH_RESULTS_TABLE', $table_prefix . 'search_results'); +define('SEARCH_WORDLIST_TABLE', $table_prefix . 'search_wordlist'); +define('SEARCH_WORDMATCH_TABLE', $table_prefix . 'search_wordmatch'); +define('SESSIONS_TABLE', $table_prefix . 'sessions'); +define('SESSIONS_KEYS_TABLE', $table_prefix . 'sessions_keys'); +define('SITELIST_TABLE', $table_prefix . 'sitelist'); +define('SMILIES_TABLE', $table_prefix . 'smilies'); +define('SPHINX_TABLE', $table_prefix . 'sphinx'); +define('STYLES_TABLE', $table_prefix . 'styles'); +define('STYLES_TEMPLATE_TABLE', $table_prefix . 'styles_template'); +define('STYLES_TEMPLATE_DATA_TABLE',$table_prefix . 'styles_template_data'); +define('STYLES_THEME_TABLE', $table_prefix . 'styles_theme'); +define('STYLES_IMAGESET_TABLE', $table_prefix . 'styles_imageset'); +define('STYLES_IMAGESET_DATA_TABLE',$table_prefix . 'styles_imageset_data'); +define('TEAMPAGE_TABLE', $table_prefix . 'teampage'); +define('TOPICS_TABLE', $table_prefix . 'topics'); +define('TOPICS_POSTED_TABLE', $table_prefix . 'topics_posted'); +define('TOPICS_TRACK_TABLE', $table_prefix . 'topics_track'); +define('TOPICS_WATCH_TABLE', $table_prefix . 'topics_watch'); +define('USER_GROUP_TABLE', $table_prefix . 'user_group'); +define('USER_NOTIFICATIONS_TABLE', $table_prefix . 'user_notifications'); +define('USERS_TABLE', $table_prefix . 'users'); +define('WARNINGS_TABLE', $table_prefix . 'warnings'); +define('WORDS_TABLE', $table_prefix . 'words'); +define('ZEBRA_TABLE', $table_prefix . 'zebra'); + +// Additional tables diff --git a/install/update/old/includes/diff/engine.php b/install/update/old/includes/diff/engine.php new file mode 100644 index 0000000..757fdad --- /dev/null +++ b/install/update/old/includes/diff/engine.php @@ -0,0 +1,555 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Code from pear.php.net, Text_Diff-1.1.0 package +* http://pear.php.net/package/Text_Diff/ (native engine) +* +* Modified by phpBB Limited to meet our coding standards +* and being able to integrate into phpBB +* +* Class used internally by Text_Diff to actually compute the diffs. This +* class is implemented using native PHP code. +* +* The algorithm used here is mostly lifted from the perl module +* Algorithm::Diff (version 1.06) by Ned Konz, which is available at: +* http://www.perl.com/CPAN/authors/id/N/NE/NEDKONZ/Algorithm-Diff-1.06.zip +* +* More ideas are taken from: http://www.ics.uci.edu/~eppstein/161/960229.html +* +* Some ideas (and a bit of code) are taken from analyze.c, of GNU +* diffutils-2.7, which can be found at: +* ftp://gnudist.gnu.org/pub/gnu/diffutils/diffutils-2.7.tar.gz +* +* Some ideas (subdivision by NCHUNKS > 2, and some optimizations) are from +* Geoffrey T. Dairiki . The original PHP version of this +* code was written by him, and is used/adapted with his permission. +* +* Copyright 2004-2008 The Horde Project (http://www.horde.org/) +* +* @author Geoffrey T. Dairiki +* @package diff +* +* @access private +*/ +class diff_engine +{ + /** + * If set to true we trim all lines before we compare them. This ensures that sole space/tab changes do not trigger diffs. + */ + var $skip_whitespace_changes = true; + + function diff(&$from_lines, &$to_lines, $preserve_cr = true) + { + // Remove empty lines... + // If preserve_cr is true, we basically only change \r\n and bare \r to \n to get the same carriage returns for both files + // If it is false, we try to only use \n once per line and ommit all empty lines to be able to get a proper data diff + + if (is_array($from_lines)) + { + $from_lines = implode("\n", $from_lines); + } + + if (is_array($to_lines)) + { + $to_lines = implode("\n", $to_lines); + } + + if ($preserve_cr) + { + $from_lines = explode("\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $from_lines))); + $to_lines = explode("\n", str_replace("\r", "\n", str_replace("\r\n", "\n", $to_lines))); + } + else + { + $from_lines = explode("\n", preg_replace('#[\n\r]+#', "\n", $from_lines)); + $to_lines = explode("\n", preg_replace('#[\n\r]+#', "\n", $to_lines)); + } + + $n_from = count($from_lines); + $n_to = count($to_lines); + + $this->xchanged = $this->ychanged = $this->xv = $this->yv = $this->xind = $this->yind = array(); + unset($this->seq, $this->in_seq, $this->lcs); + + // Skip leading common lines. + for ($skip = 0; $skip < $n_from && $skip < $n_to; $skip++) + { + if (trim($from_lines[$skip]) !== trim($to_lines[$skip])) + { + break; + } + $this->xchanged[$skip] = $this->ychanged[$skip] = false; + } + + // Skip trailing common lines. + $xi = $n_from; + $yi = $n_to; + + for ($endskip = 0; --$xi > $skip && --$yi > $skip; $endskip++) + { + if (trim($from_lines[$xi]) !== trim($to_lines[$yi])) + { + break; + } + $this->xchanged[$xi] = $this->ychanged[$yi] = false; + } + + // Ignore lines which do not exist in both files. + for ($xi = $skip; $xi < $n_from - $endskip; $xi++) + { + if ($this->skip_whitespace_changes) $xhash[trim($from_lines[$xi])] = 1; else $xhash[$from_lines[$xi]] = 1; + } + + for ($yi = $skip; $yi < $n_to - $endskip; $yi++) + { + $line = ($this->skip_whitespace_changes) ? trim($to_lines[$yi]) : $to_lines[$yi]; + + if (($this->ychanged[$yi] = empty($xhash[$line]))) + { + continue; + } + $yhash[$line] = 1; + $this->yv[] = $line; + $this->yind[] = $yi; + } + + for ($xi = $skip; $xi < $n_from - $endskip; $xi++) + { + $line = ($this->skip_whitespace_changes) ? trim($from_lines[$xi]) : $from_lines[$xi]; + + if (($this->xchanged[$xi] = empty($yhash[$line]))) + { + continue; + } + $this->xv[] = $line; + $this->xind[] = $xi; + } + + // Find the LCS. + $this->_compareseq(0, count($this->xv), 0, count($this->yv)); + + // Merge edits when possible. + if ($this->skip_whitespace_changes) + { + $from_lines_clean = array_map('trim', $from_lines); + $to_lines_clean = array_map('trim', $to_lines); + + $this->_shift_boundaries($from_lines_clean, $this->xchanged, $this->ychanged); + $this->_shift_boundaries($to_lines_clean, $this->ychanged, $this->xchanged); + + unset($from_lines_clean, $to_lines_clean); + } + else + { + $this->_shift_boundaries($from_lines, $this->xchanged, $this->ychanged); + $this->_shift_boundaries($to_lines, $this->ychanged, $this->xchanged); + } + + // Compute the edit operations. + $edits = array(); + $xi = $yi = 0; + + while ($xi < $n_from || $yi < $n_to) + { + // Skip matching "snake". + $copy = array(); + + while ($xi < $n_from && $yi < $n_to && !$this->xchanged[$xi] && !$this->ychanged[$yi]) + { + $copy[] = $from_lines[$xi++]; + $yi++; + } + + if ($copy) + { + $edits[] = new diff_op_copy($copy); + } + + // Find deletes & adds. + $delete = array(); + while ($xi < $n_from && $this->xchanged[$xi]) + { + $delete[] = $from_lines[$xi++]; + } + + $add = array(); + while ($yi < $n_to && $this->ychanged[$yi]) + { + $add[] = $to_lines[$yi++]; + } + + if ($delete && $add) + { + $edits[] = new diff_op_change($delete, $add); + } + else if ($delete) + { + $edits[] = new diff_op_delete($delete); + } + else if ($add) + { + $edits[] = new diff_op_add($add); + } + } + + return $edits; + } + + /** + * Divides the Largest Common Subsequence (LCS) of the sequences (XOFF, + * XLIM) and (YOFF, YLIM) into NCHUNKS approximately equally sized segments. + * + * Returns (LCS, PTS). LCS is the length of the LCS. PTS is an array of + * NCHUNKS+1 (X, Y) indexes giving the diving points between sub + * sequences. The first sub-sequence is contained in (X0, X1), (Y0, Y1), + * the second in (X1, X2), (Y1, Y2) and so on. Note that (X0, Y0) == + * (XOFF, YOFF) and (X[NCHUNKS], Y[NCHUNKS]) == (XLIM, YLIM). + * + * This function assumes that the first lines of the specified portions of + * the two files do not match, and likewise that the last lines do not + * match. The caller must trim matching lines from the beginning and end + * of the portions it is going to specify. + */ + function _diag($xoff, $xlim, $yoff, $ylim, $nchunks) + { + $flip = false; + + if ($xlim - $xoff > $ylim - $yoff) + { + // Things seems faster (I'm not sure I understand why) when the shortest sequence is in X. + $flip = true; + list($xoff, $xlim, $yoff, $ylim) = array($yoff, $ylim, $xoff, $xlim); + } + + if ($flip) + { + for ($i = $ylim - 1; $i >= $yoff; $i--) + { + $ymatches[$this->xv[$i]][] = $i; + } + } + else + { + for ($i = $ylim - 1; $i >= $yoff; $i--) + { + $ymatches[$this->yv[$i]][] = $i; + } + } + + $this->lcs = 0; + $this->seq[0]= $yoff - 1; + $this->in_seq = array(); + $ymids[0] = array(); + + $numer = $xlim - $xoff + $nchunks - 1; + $x = $xoff; + + for ($chunk = 0; $chunk < $nchunks; $chunk++) + { + if ($chunk > 0) + { + for ($i = 0; $i <= $this->lcs; $i++) + { + $ymids[$i][$chunk - 1] = $this->seq[$i]; + } + } + + $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $chunk) / $nchunks); + + for (; $x < $x1; $x++) + { + $line = $flip ? $this->yv[$x] : $this->xv[$x]; + if (empty($ymatches[$line])) + { + continue; + } + $matches = $ymatches[$line]; + + reset($matches); + while (list(, $y) = each($matches)) + { + if (empty($this->in_seq[$y])) + { + $k = $this->_lcs_pos($y); + $ymids[$k] = $ymids[$k - 1]; + break; + } + } + + // no reset() here + while (list(, $y) = each($matches)) + { + if ($y > $this->seq[$k - 1]) + { + // Optimization: this is a common case: next match is just replacing previous match. + $this->in_seq[$this->seq[$k]] = false; + $this->seq[$k] = $y; + $this->in_seq[$y] = 1; + } + else if (empty($this->in_seq[$y])) + { + $k = $this->_lcs_pos($y); + $ymids[$k] = $ymids[$k - 1]; + } + } + } + } + + $seps[] = $flip ? array($yoff, $xoff) : array($xoff, $yoff); + $ymid = $ymids[$this->lcs]; + + for ($n = 0; $n < $nchunks - 1; $n++) + { + $x1 = $xoff + (int)(($numer + ($xlim - $xoff) * $n) / $nchunks); + $y1 = $ymid[$n] + 1; + $seps[] = $flip ? array($y1, $x1) : array($x1, $y1); + } + $seps[] = $flip ? array($ylim, $xlim) : array($xlim, $ylim); + + return array($this->lcs, $seps); + } + + function _lcs_pos($ypos) + { + $end = $this->lcs; + + if ($end == 0 || $ypos > $this->seq[$end]) + { + $this->seq[++$this->lcs] = $ypos; + $this->in_seq[$ypos] = 1; + return $this->lcs; + } + + $beg = 1; + while ($beg < $end) + { + $mid = (int)(($beg + $end) / 2); + if ($ypos > $this->seq[$mid]) + { + $beg = $mid + 1; + } + else + { + $end = $mid; + } + } + + $this->in_seq[$this->seq[$end]] = false; + $this->seq[$end] = $ypos; + $this->in_seq[$ypos] = 1; + + return $end; + } + + /** + * Finds LCS of two sequences. + * + * The results are recorded in the vectors $this->{x,y}changed[], by + * storing a 1 in the element for each line that is an insertion or + * deletion (ie. is not in the LCS). + * + * The subsequence of file 0 is (XOFF, XLIM) and likewise for file 1. + * + * Note that XLIM, YLIM are exclusive bounds. All line numbers are + * origin-0 and discarded lines are not counted. + */ + function _compareseq($xoff, $xlim, $yoff, $ylim) + { + // Slide down the bottom initial diagonal. + while ($xoff < $xlim && $yoff < $ylim && $this->xv[$xoff] == $this->yv[$yoff]) + { + ++$xoff; + ++$yoff; + } + + // Slide up the top initial diagonal. + while ($xlim > $xoff && $ylim > $yoff && $this->xv[$xlim - 1] == $this->yv[$ylim - 1]) + { + --$xlim; + --$ylim; + } + + if ($xoff == $xlim || $yoff == $ylim) + { + $lcs = 0; + } + else + { + // This is ad hoc but seems to work well. + // $nchunks = sqrt(min($xlim - $xoff, $ylim - $yoff) / 2.5); + // $nchunks = max(2,min(8,(int)$nchunks)); + $nchunks = min(7, $xlim - $xoff, $ylim - $yoff) + 1; + list($lcs, $seps) = $this->_diag($xoff, $xlim, $yoff, $ylim, $nchunks); + } + + if ($lcs == 0) + { + // X and Y sequences have no common subsequence: mark all changed. + while ($yoff < $ylim) + { + $this->ychanged[$this->yind[$yoff++]] = 1; + } + + while ($xoff < $xlim) + { + $this->xchanged[$this->xind[$xoff++]] = 1; + } + } + else + { + // Use the partitions to split this problem into subproblems. + reset($seps); + $pt1 = $seps[0]; + + while ($pt2 = next($seps)) + { + $this->_compareseq($pt1[0], $pt2[0], $pt1[1], $pt2[1]); + $pt1 = $pt2; + } + } + } + + /** + * Adjusts inserts/deletes of identical lines to join changes as much as possible. + * + * We do something when a run of changed lines include a line at one end + * and has an excluded, identical line at the other. We are free to + * choose which identical line is included. 'compareseq' usually chooses + * the one at the beginning, but usually it is cleaner to consider the + * following identical line to be the "change". + * + * This is extracted verbatim from analyze.c (GNU diffutils-2.7). + */ + function _shift_boundaries($lines, &$changed, $other_changed) + { + $i = 0; + $j = 0; + + $len = count($lines); + $other_len = count($other_changed); + + while (1) + { + // Scan forward to find the beginning of another run of + // changes. Also keep track of the corresponding point in the other file. + // + // Throughout this code, $i and $j are adjusted together so that + // the first $i elements of $changed and the first $j elements of + // $other_changed both contain the same number of zeros (unchanged lines). + // + // Furthermore, $j is always kept so that $j == $other_len or $other_changed[$j] == false. + while ($j < $other_len && $other_changed[$j]) + { + $j++; + } + + while ($i < $len && ! $changed[$i]) + { + $i++; + $j++; + + while ($j < $other_len && $other_changed[$j]) + { + $j++; + } + } + + if ($i == $len) + { + break; + } + + $start = $i; + + // Find the end of this run of changes. + while (++$i < $len && $changed[$i]) + { + continue; + } + + do + { + // Record the length of this run of changes, so that we can later determine whether the run has grown. + $runlength = $i - $start; + + // Move the changed region back, so long as the previous unchanged line matches the last changed one. + // This merges with previous changed regions. + while ($start > 0 && $lines[$start - 1] == $lines[$i - 1]) + { + $changed[--$start] = 1; + $changed[--$i] = false; + + while ($start > 0 && $changed[$start - 1]) + { + $start--; + } + + while ($other_changed[--$j]) + { + continue; + } + } + + // Set CORRESPONDING to the end of the changed run, at the last point where it corresponds to a changed run in the + // other file. CORRESPONDING == LEN means no such point has been found. + $corresponding = $j < $other_len ? $i : $len; + + // Move the changed region forward, so long as the first changed line matches the following unchanged one. + // This merges with following changed regions. + // Do this second, so that if there are no merges, the changed region is moved forward as far as possible. + while ($i < $len && $lines[$start] == $lines[$i]) + { + $changed[$start++] = false; + $changed[$i++] = 1; + + while ($i < $len && $changed[$i]) + { + $i++; + } + + $j++; + if ($j < $other_len && $other_changed[$j]) + { + $corresponding = $i; + while ($j < $other_len && $other_changed[$j]) + { + $j++; + } + } + } + } + while ($runlength != $i - $start); + + // If possible, move the fully-merged run of changes back to a corresponding run in the other file. + while ($corresponding < $i) + { + $changed[--$start] = 1; + $changed[--$i] = 0; + + while ($other_changed[--$j]) + { + continue; + } + } + } + } +} diff --git a/install/update/old/includes/functions.php b/install/update/old/includes/functions.php new file mode 100644 index 0000000..5234c34 --- /dev/null +++ b/install/update/old/includes/functions.php @@ -0,0 +1,4945 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +// Common global functions +/** +* Load the autoloaders added by the extensions. +* +* @param string $phpbb_root_path Path to the phpbb root directory. +*/ +function phpbb_load_extensions_autoloaders($phpbb_root_path) +{ + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $phpbb_root_path . 'ext/', + \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + $iterator->setMaxDepth(2); + + foreach ($iterator as $file_info) + { + if ($file_info->getFilename() === 'vendor' && $iterator->getDepth() === 2) + { + $filename = $file_info->getRealPath() . '/autoload.php'; + if (file_exists($filename)) + { + require $filename; + } + } + } +} + +/** +* Casts a variable to the given type. +* +* @deprecated +*/ +function set_var(&$result, $var, $type, $multibyte = false) +{ + // no need for dependency injection here, if you have the object, call the method yourself! + $type_cast_helper = new \phpbb\request\type_cast_helper(); + $type_cast_helper->set_var($result, $var, $type, $multibyte); +} + +/** +* Generates an alphanumeric random string of given length +* +* @param int $num_chars Length of random string, defaults to 8. +* This number should be less or equal than 64. +* +* @return string +*/ +function gen_rand_string($num_chars = 8) +{ + $range = array_merge(range('A', 'Z'), range(0, 9)); + $size = count($range); + + $output = ''; + for ($i = 0; $i < $num_chars; $i++) + { + $rand = random_int(0, $size-1); + $output .= $range[$rand]; + } + + return $output; +} + +/** +* Generates a user-friendly alphanumeric random string of given length +* We remove 0 and O so users cannot confuse those in passwords etc. +* +* @param int $num_chars Length of random string, defaults to 8. +* This number should be less or equal than 64. +* +* @return string +*/ +function gen_rand_string_friendly($num_chars = 8) +{ + $range = array_merge(range('A', 'N'), range('P', 'Z'), range(1, 9)); + $size = count($range); + + $output = ''; + for ($i = 0; $i < $num_chars; $i++) + { + $rand = random_int(0, $size-1); + $output .= $range[$rand]; + } + + return $output; +} + +/** +* Return unique id +*/ +function unique_id() +{ + return strtolower(gen_rand_string(16)); +} + +/** +* Wrapper for mt_rand() which allows swapping $min and $max parameters. +* +* PHP does not allow us to swap the order of the arguments for mt_rand() anymore. +* (since PHP 5.3.4, see http://bugs.php.net/46587) +* +* @param int $min Lowest value to be returned +* @param int $max Highest value to be returned +* +* @return int Random integer between $min and $max (or $max and $min) +*/ +function phpbb_mt_rand($min, $max) +{ + return ($min > $max) ? mt_rand($max, $min) : mt_rand($min, $max); +} + +/** +* Wrapper for getdate() which returns the equivalent array for UTC timestamps. +* +* @param int $time Unix timestamp (optional) +* +* @return array Returns an associative array of information related to the timestamp. +* See http://www.php.net/manual/en/function.getdate.php +*/ +function phpbb_gmgetdate($time = false) +{ + if ($time === false) + { + $time = time(); + } + + // getdate() interprets timestamps in local time. + // What follows uses the fact that getdate() and + // date('Z') balance each other out. + return getdate($time - date('Z')); +} + +/** +* Return formatted string for filesizes +* +* @param mixed $value filesize in bytes +* (non-negative number; int, float or string) +* @param bool $string_only true if language string should be returned +* @param array $allowed_units only allow these units (data array indexes) +* +* @return mixed data array if $string_only is false +*/ +function get_formatted_filesize($value, $string_only = true, $allowed_units = false) +{ + global $user; + + $available_units = array( + 'tb' => array( + 'min' => 1099511627776, // pow(2, 40) + 'index' => 4, + 'si_unit' => 'TB', + 'iec_unit' => 'TIB', + ), + 'gb' => array( + 'min' => 1073741824, // pow(2, 30) + 'index' => 3, + 'si_unit' => 'GB', + 'iec_unit' => 'GIB', + ), + 'mb' => array( + 'min' => 1048576, // pow(2, 20) + 'index' => 2, + 'si_unit' => 'MB', + 'iec_unit' => 'MIB', + ), + 'kb' => array( + 'min' => 1024, // pow(2, 10) + 'index' => 1, + 'si_unit' => 'KB', + 'iec_unit' => 'KIB', + ), + 'b' => array( + 'min' => 0, + 'index' => 0, + 'si_unit' => 'BYTES', // Language index + 'iec_unit' => 'BYTES', // Language index + ), + ); + + foreach ($available_units as $si_identifier => $unit_info) + { + if (!empty($allowed_units) && $si_identifier != 'b' && !in_array($si_identifier, $allowed_units)) + { + continue; + } + + if ($value >= $unit_info['min']) + { + $unit_info['si_identifier'] = $si_identifier; + + break; + } + } + unset($available_units); + + for ($i = 0; $i < $unit_info['index']; $i++) + { + $value /= 1024; + } + $value = round($value, 2); + + // Lookup units in language dictionary + $unit_info['si_unit'] = (isset($user->lang[$unit_info['si_unit']])) ? $user->lang[$unit_info['si_unit']] : $unit_info['si_unit']; + $unit_info['iec_unit'] = (isset($user->lang[$unit_info['iec_unit']])) ? $user->lang[$unit_info['iec_unit']] : $unit_info['iec_unit']; + + // Default to IEC + $unit_info['unit'] = $unit_info['iec_unit']; + + if (!$string_only) + { + $unit_info['value'] = $value; + + return $unit_info; + } + + return $value . ' ' . $unit_info['unit']; +} + +/** +* Determine whether we are approaching the maximum execution time. Should be called once +* at the beginning of the script in which it's used. +* @return bool Either true if the maximum execution time is nearly reached, or false +* if some time is still left. +*/ +function still_on_time($extra_time = 15) +{ + static $max_execution_time, $start_time; + + $current_time = microtime(true); + + if (empty($max_execution_time)) + { + $max_execution_time = (function_exists('ini_get')) ? (int) @ini_get('max_execution_time') : (int) @get_cfg_var('max_execution_time'); + + // If zero, then set to something higher to not let the user catch the ten seconds barrier. + if ($max_execution_time === 0) + { + $max_execution_time = 50 + $extra_time; + } + + $max_execution_time = min(max(10, ($max_execution_time - $extra_time)), 50); + + // For debugging purposes + // $max_execution_time = 10; + + global $starttime; + $start_time = (empty($starttime)) ? $current_time : $starttime; + } + + return (ceil($current_time - $start_time) < $max_execution_time) ? true : false; +} + +/** +* Hashes an email address to a big integer +* +* @param string $email Email address +* +* @return string Unsigned Big Integer +*/ +function phpbb_email_hash($email) +{ + return sprintf('%u', crc32(strtolower($email))) . strlen($email); +} + +/** +* Wrapper for version_compare() that allows using uppercase A and B +* for alpha and beta releases. +* +* See http://www.php.net/manual/en/function.version-compare.php +* +* @param string $version1 First version number +* @param string $version2 Second version number +* @param string $operator Comparison operator (optional) +* +* @return mixed Boolean (true, false) if comparison operator is specified. +* Integer (-1, 0, 1) otherwise. +*/ +function phpbb_version_compare($version1, $version2, $operator = null) +{ + $version1 = strtolower($version1); + $version2 = strtolower($version2); + + if (is_null($operator)) + { + return version_compare($version1, $version2); + } + else + { + return version_compare($version1, $version2, $operator); + } +} + +// functions used for building option fields + +/** +* Pick a language, any language ... +*/ +function language_select($default = '') +{ + global $db; + + $sql = 'SELECT lang_iso, lang_local_name + FROM ' . LANG_TABLE . ' + ORDER BY lang_english_name'; + $result = $db->sql_query($sql); + + $lang_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($row['lang_iso'] == $default) ? ' selected="selected"' : ''; + $lang_options .= ''; + } + $db->sql_freeresult($result); + + return $lang_options; +} + +/** +* Pick a template/theme combo, +*/ +function style_select($default = '', $all = false) +{ + global $db; + + $sql_where = (!$all) ? 'WHERE style_active = 1 ' : ''; + $sql = 'SELECT style_id, style_name + FROM ' . STYLES_TABLE . " + $sql_where + ORDER BY style_name"; + $result = $db->sql_query($sql); + + $style_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($row['style_id'] == $default) ? ' selected="selected"' : ''; + $style_options .= ''; + } + $db->sql_freeresult($result); + + return $style_options; +} + +/** +* Format the timezone offset with hours and minutes +* +* @param int $tz_offset Timezone offset in seconds +* @param bool $show_null Whether null offsets should be shown +* @return string Normalized offset string: -7200 => -02:00 +* 16200 => +04:30 +*/ +function phpbb_format_timezone_offset($tz_offset, $show_null = false) +{ + $sign = ($tz_offset < 0) ? '-' : '+'; + $time_offset = abs($tz_offset); + + if ($time_offset == 0 && $show_null == false) + { + return ''; + } + + $offset_seconds = $time_offset % 3600; + $offset_minutes = $offset_seconds / 60; + $offset_hours = ($time_offset - $offset_seconds) / 3600; + + $offset_string = sprintf("%s%02d:%02d", $sign, $offset_hours, $offset_minutes); + return $offset_string; +} + +/** +* Compares two time zone labels. +* Arranges them in increasing order by timezone offset. +* Places UTC before other timezones in the same offset. +*/ +function phpbb_tz_select_compare($a, $b) +{ + $a_sign = $a[3]; + $b_sign = $b[3]; + if ($a_sign != $b_sign) + { + return $a_sign == '-' ? -1 : 1; + } + + $a_offset = substr($a, 4, 5); + $b_offset = substr($b, 4, 5); + if ($a_offset == $b_offset) + { + $a_name = substr($a, 12); + $b_name = substr($b, 12); + if ($a_name == $b_name) + { + return 0; + } + else if ($a_name == 'UTC') + { + return -1; + } + else if ($b_name == 'UTC') + { + return 1; + } + else + { + return $a_name < $b_name ? -1 : 1; + } + } + else + { + if ($a_sign == '-') + { + return $a_offset > $b_offset ? -1 : 1; + } + else + { + return $a_offset < $b_offset ? -1 : 1; + } + } +} + +/** +* Return list of timezone identifiers +* We also add the selected timezone if we can create an object with it. +* DateTimeZone::listIdentifiers seems to not add all identifiers to the list, +* because some are only kept for backward compatible reasons. If the user has +* a deprecated value, we add it here, so it can still be kept. Once the user +* changed his value, there is no way back to deprecated values. +* +* @param string $selected_timezone Additional timezone that shall +* be added to the list of identiers +* @return array DateTimeZone::listIdentifiers and additional +* selected_timezone if it is a valid timezone. +*/ +function phpbb_get_timezone_identifiers($selected_timezone) +{ + $timezones = DateTimeZone::listIdentifiers(); + + if (!in_array($selected_timezone, $timezones)) + { + try + { + // Add valid timezones that are currently selected but not returned + // by DateTimeZone::listIdentifiers + $validate_timezone = new DateTimeZone($selected_timezone); + $timezones[] = $selected_timezone; + } + catch (\Exception $e) + { + } + } + + return $timezones; +} + +/** +* Options to pick a timezone and date/time +* +* @param \phpbb\template\template $template phpBB template object +* @param \phpbb\user $user Object of the current user +* @param string $default A timezone to select +* @param boolean $truncate Shall we truncate the options text +* +* @return array Returns an array containing the options for the time selector. +*/ +function phpbb_timezone_select($template, $user, $default = '', $truncate = false) +{ + static $timezones; + + $default_offset = ''; + if (!isset($timezones)) + { + $unsorted_timezones = phpbb_get_timezone_identifiers($default); + + $timezones = array(); + foreach ($unsorted_timezones as $timezone) + { + $tz = new DateTimeZone($timezone); + $dt = $user->create_datetime('now', $tz); + $offset = $dt->getOffset(); + $current_time = $dt->format($user->lang['DATETIME_FORMAT'], true); + $offset_string = phpbb_format_timezone_offset($offset, true); + $timezones['UTC' . $offset_string . ' - ' . $timezone] = array( + 'tz' => $timezone, + 'offset' => $offset_string, + 'current' => $current_time, + ); + if ($timezone === $default) + { + $default_offset = 'UTC' . $offset_string; + } + } + unset($unsorted_timezones); + + uksort($timezones, 'phpbb_tz_select_compare'); + } + + $tz_select = $opt_group = ''; + + foreach ($timezones as $key => $timezone) + { + if ($opt_group != $timezone['offset']) + { + // Generate tz_select for backwards compatibility + $tz_select .= ($opt_group) ? '' : ''; + $tz_select .= ''; + $opt_group = $timezone['offset']; + $template->assign_block_vars('timezone_select', array( + 'LABEL' => $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']), + 'VALUE' => $key . ' - ' . $timezone['current'], + )); + + $selected = (!empty($default_offset) && strpos($key, $default_offset) !== false) ? ' selected="selected"' : ''; + $template->assign_block_vars('timezone_date', array( + 'VALUE' => $key . ' - ' . $timezone['current'], + 'SELECTED' => !empty($selected), + 'TITLE' => $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $timezone['current']), + )); + } + + $label = $timezone['tz']; + if (isset($user->lang['timezones'][$label])) + { + $label = $user->lang['timezones'][$label]; + } + $title = $user->lang(array('timezones', 'UTC_OFFSET_CURRENT'), $timezone['offset'], $label); + + if ($truncate) + { + $label = truncate_string($label, 50, 255, false, '...'); + } + + // Also generate timezone_select for backwards compatibility + $selected = ($timezone['tz'] === $default) ? ' selected="selected"' : ''; + $tz_select .= ''; + $template->assign_block_vars('timezone_select.timezone_options', array( + 'TITLE' => $title, + 'VALUE' => $timezone['tz'], + 'SELECTED' => !empty($selected), + 'LABEL' => $label, + )); + } + $tz_select .= ''; + + return $tz_select; +} + +// Functions handling topic/post tracking/marking + +/** +* Marks a topic/forum as read +* Marks a topic as posted to +* +* @param string $mode (all, topics, topic, post) +* @param int|bool $forum_id Used in all, topics, and topic mode +* @param int|bool $topic_id Used in topic and post mode +* @param int $post_time 0 means current time(), otherwise to set a specific mark time +* @param int $user_id can only be used with $mode == 'post' +*/ +function markread($mode, $forum_id = false, $topic_id = false, $post_time = 0, $user_id = 0) +{ + global $db, $user, $config; + global $request, $phpbb_container, $phpbb_dispatcher; + + $post_time = ($post_time === 0 || $post_time > time()) ? time() : (int) $post_time; + + $should_markread = true; + + /** + * This event is used for performing actions directly before marking forums, + * topics or posts as read. + * + * It is also possible to prevent the marking. For that, the $should_markread parameter + * should be set to FALSE. + * + * @event core.markread_before + * @var string mode Variable containing marking mode value + * @var mixed forum_id Variable containing forum id, or false + * @var mixed topic_id Variable containing topic id, or false + * @var int post_time Variable containing post time + * @var int user_id Variable containing the user id + * @var bool should_markread Flag indicating if the markread should be done or not. + * @since 3.1.4-RC1 + */ + $vars = array( + 'mode', + 'forum_id', + 'topic_id', + 'post_time', + 'user_id', + 'should_markread', + ); + extract($phpbb_dispatcher->trigger_event('core.markread_before', compact($vars))); + + if (!$should_markread) + { + return; + } + + if ($mode == 'all') + { + if (empty($forum_id)) + { + // Mark all forums read (index page) + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + // Mark all topic notifications read for this user + $phpbb_notifications->mark_notifications(array( + 'notification.type.topic', + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + 'notification.type.approve_topic', + 'notification.type.approve_post', + ), false, $user->data['user_id'], $post_time); + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + // Mark all forums read (index page) + $tables = array(TOPICS_TRACK_TABLE, FORUMS_TRACK_TABLE); + foreach ($tables as $table) + { + $sql = 'DELETE FROM ' . $table . " + WHERE user_id = {$user->data['user_id']} + AND mark_time < $post_time"; + $db->sql_query($sql); + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastmark = $post_time + WHERE user_id = {$user->data['user_id']} + AND user_lastmark < $post_time"; + $db->sql_query($sql); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + + unset($tracking_topics['tf']); + unset($tracking_topics['t']); + unset($tracking_topics['f']); + $tracking_topics['l'] = base_convert($post_time - $config['board_startdate'], 10, 36); + + $user->set_cookie('track', tracking_serialize($tracking_topics), $post_time + 31536000); + $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking_topics), \phpbb\request\request_interface::COOKIE); + + unset($tracking_topics); + + if ($user->data['is_registered']) + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastmark = $post_time + WHERE user_id = {$user->data['user_id']} + AND user_lastmark < $post_time"; + $db->sql_query($sql); + } + } + } + } + else if ($mode == 'topics') + { + // Mark all topics in forums read + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + else + { + $forum_id = array_unique($forum_id); + } + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->mark_notifications_by_parent(array( + 'notification.type.topic', + 'notification.type.approve_topic', + ), $forum_id, $user->data['user_id'], $post_time); + + // Mark all post/quote notifications read for this user in this forum + $topic_ids = array(); + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id); + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + $phpbb_notifications->mark_notifications_by_parent(array( + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + 'notification.type.approve_post', + ), $topic_ids, $user->data['user_id'], $post_time); + + // Add 0 to forums array to mark global announcements correctly + // $forum_id[] = 0; + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $sql = 'DELETE FROM ' . TOPICS_TRACK_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND mark_time < $post_time + AND " . $db->sql_in_set('forum_id', $forum_id); + $db->sql_query($sql); + + $sql = 'SELECT forum_id + FROM ' . FORUMS_TRACK_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND " . $db->sql_in_set('forum_id', $forum_id); + $result = $db->sql_query($sql); + + $sql_update = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_update[] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + + if (count($sql_update)) + { + $sql = 'UPDATE ' . FORUMS_TRACK_TABLE . " + SET mark_time = $post_time + WHERE user_id = {$user->data['user_id']} + AND mark_time < $post_time + AND " . $db->sql_in_set('forum_id', $sql_update); + $db->sql_query($sql); + } + + if ($sql_insert = array_diff($forum_id, $sql_update)) + { + $sql_ary = array(); + foreach ($sql_insert as $f_id) + { + $sql_ary[] = array( + 'user_id' => (int) $user->data['user_id'], + 'forum_id' => (int) $f_id, + 'mark_time' => $post_time, + ); + } + + $db->sql_multi_insert(FORUMS_TRACK_TABLE, $sql_ary); + } + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $tracking = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking = ($tracking) ? tracking_unserialize($tracking) : array(); + + foreach ($forum_id as $f_id) + { + $topic_ids36 = (isset($tracking['tf'][$f_id])) ? $tracking['tf'][$f_id] : array(); + + if (isset($tracking['tf'][$f_id])) + { + unset($tracking['tf'][$f_id]); + } + + foreach ($topic_ids36 as $topic_id36) + { + unset($tracking['t'][$topic_id36]); + } + + if (isset($tracking['f'][$f_id])) + { + unset($tracking['f'][$f_id]); + } + + $tracking['f'][$f_id] = base_convert($post_time - $config['board_startdate'], 10, 36); + } + + if (isset($tracking['tf']) && empty($tracking['tf'])) + { + unset($tracking['tf']); + } + + $user->set_cookie('track', tracking_serialize($tracking), $post_time + 31536000); + $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), \phpbb\request\request_interface::COOKIE); + + unset($tracking); + } + } + else if ($mode == 'topic') + { + if ($topic_id === false || $forum_id === false) + { + return; + } + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + // Mark post notifications read for this user in this topic + $phpbb_notifications->mark_notifications(array( + 'notification.type.topic', + 'notification.type.approve_topic', + ), $topic_id, $user->data['user_id'], $post_time); + + $phpbb_notifications->mark_notifications_by_parent(array( + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + 'notification.type.approve_post', + ), $topic_id, $user->data['user_id'], $post_time); + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $sql = 'UPDATE ' . TOPICS_TRACK_TABLE . " + SET mark_time = $post_time + WHERE user_id = {$user->data['user_id']} + AND mark_time < $post_time + AND topic_id = $topic_id"; + $db->sql_query($sql); + + // insert row + if (!$db->sql_affectedrows()) + { + $db->sql_return_on_error(true); + + $sql_ary = array( + 'user_id' => (int) $user->data['user_id'], + 'topic_id' => (int) $topic_id, + 'forum_id' => (int) $forum_id, + 'mark_time' => $post_time, + ); + + $db->sql_query('INSERT INTO ' . TOPICS_TRACK_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $db->sql_return_on_error(false); + } + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $tracking = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking = ($tracking) ? tracking_unserialize($tracking) : array(); + + $topic_id36 = base_convert($topic_id, 10, 36); + + if (!isset($tracking['t'][$topic_id36])) + { + $tracking['tf'][$forum_id][$topic_id36] = true; + } + + $tracking['t'][$topic_id36] = base_convert($post_time - (int) $config['board_startdate'], 10, 36); + + // If the cookie grows larger than 10000 characters we will remove the smallest value + // This can result in old topics being unread - but most of the time it should be accurate... + if (strlen($request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE)) > 10000) + { + //echo 'Cookie grown too large' . print_r($tracking, true); + + // We get the ten most minimum stored time offsets and its associated topic ids + $time_keys = array(); + for ($i = 0; $i < 10 && count($tracking['t']); $i++) + { + $min_value = min($tracking['t']); + $m_tkey = array_search($min_value, $tracking['t']); + unset($tracking['t'][$m_tkey]); + + $time_keys[$m_tkey] = $min_value; + } + + // Now remove the topic ids from the array... + foreach ($tracking['tf'] as $f_id => $topic_id_ary) + { + foreach ($time_keys as $m_tkey => $min_value) + { + if (isset($topic_id_ary[$m_tkey])) + { + $tracking['f'][$f_id] = $min_value; + unset($tracking['tf'][$f_id][$m_tkey]); + } + } + } + + if ($user->data['is_registered']) + { + $user->data['user_lastmark'] = intval(base_convert(max($time_keys) + $config['board_startdate'], 36, 10)); + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastmark = $post_time + WHERE user_id = {$user->data['user_id']} + AND mark_time < $post_time"; + $db->sql_query($sql); + } + else + { + $tracking['l'] = max($time_keys); + } + } + + $user->set_cookie('track', tracking_serialize($tracking), $post_time + 31536000); + $request->overwrite($config['cookie_name'] . '_track', tracking_serialize($tracking), \phpbb\request\request_interface::COOKIE); + } + } + else if ($mode == 'post') + { + if ($topic_id === false) + { + return; + } + + $use_user_id = (!$user_id) ? $user->data['user_id'] : $user_id; + + if ($config['load_db_track'] && $use_user_id != ANONYMOUS) + { + $db->sql_return_on_error(true); + + $sql_ary = array( + 'user_id' => (int) $use_user_id, + 'topic_id' => (int) $topic_id, + 'topic_posted' => 1, + ); + + $db->sql_query('INSERT INTO ' . TOPICS_POSTED_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $db->sql_return_on_error(false); + } + } + + /** + * This event is used for performing actions directly after forums, + * topics or posts have been marked as read. + * + * @event core.markread_after + * @var string mode Variable containing marking mode value + * @var mixed forum_id Variable containing forum id, or false + * @var mixed topic_id Variable containing topic id, or false + * @var int post_time Variable containing post time + * @var int user_id Variable containing the user id + * @since 3.2.6-RC1 + */ + $vars = array( + 'mode', + 'forum_id', + 'topic_id', + 'post_time', + 'user_id', + ); + extract($phpbb_dispatcher->trigger_event('core.markread_after', compact($vars))); +} + +/** +* Get topic tracking info by using already fetched info +*/ +function get_topic_tracking($forum_id, $topic_ids, &$rowset, $forum_mark_time, $global_announce_list = false) +{ + global $user; + + $last_read = array(); + + if (!is_array($topic_ids)) + { + $topic_ids = array($topic_ids); + } + + foreach ($topic_ids as $topic_id) + { + if (!empty($rowset[$topic_id]['mark_time'])) + { + $last_read[$topic_id] = $rowset[$topic_id]['mark_time']; + } + } + + $topic_ids = array_diff($topic_ids, array_keys($last_read)); + + if (count($topic_ids)) + { + $mark_time = array(); + + if (!empty($forum_mark_time[$forum_id]) && $forum_mark_time[$forum_id] !== false) + { + $mark_time[$forum_id] = $forum_mark_time[$forum_id]; + } + + $user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user->data['user_lastmark']; + + foreach ($topic_ids as $topic_id) + { + $last_read[$topic_id] = $user_lastmark; + } + } + + return $last_read; +} + +/** +* Get topic tracking info from db (for cookie based tracking only this function is used) +*/ +function get_complete_topic_tracking($forum_id, $topic_ids, $global_announce_list = false) +{ + global $config, $user, $request; + + $last_read = array(); + + if (!is_array($topic_ids)) + { + $topic_ids = array($topic_ids); + } + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + global $db; + + $sql = 'SELECT topic_id, mark_time + FROM ' . TOPICS_TRACK_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND " . $db->sql_in_set('topic_id', $topic_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $last_read[$row['topic_id']] = $row['mark_time']; + } + $db->sql_freeresult($result); + + $topic_ids = array_diff($topic_ids, array_keys($last_read)); + + if (count($topic_ids)) + { + $sql = 'SELECT forum_id, mark_time + FROM ' . FORUMS_TRACK_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND forum_id = $forum_id"; + $result = $db->sql_query($sql); + + $mark_time = array(); + while ($row = $db->sql_fetchrow($result)) + { + $mark_time[$row['forum_id']] = $row['mark_time']; + } + $db->sql_freeresult($result); + + $user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user->data['user_lastmark']; + + foreach ($topic_ids as $topic_id) + { + $last_read[$topic_id] = $user_lastmark; + } + } + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + global $tracking_topics; + + if (!isset($tracking_topics) || !count($tracking_topics)) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + } + + if (!$user->data['is_registered']) + { + $user_lastmark = (isset($tracking_topics['l'])) ? base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate'] : 0; + } + else + { + $user_lastmark = $user->data['user_lastmark']; + } + + foreach ($topic_ids as $topic_id) + { + $topic_id36 = base_convert($topic_id, 10, 36); + + if (isset($tracking_topics['t'][$topic_id36])) + { + $last_read[$topic_id] = base_convert($tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate']; + } + } + + $topic_ids = array_diff($topic_ids, array_keys($last_read)); + + if (count($topic_ids)) + { + $mark_time = array(); + + if (isset($tracking_topics['f'][$forum_id])) + { + $mark_time[$forum_id] = base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']; + } + + $user_lastmark = (isset($mark_time[$forum_id])) ? $mark_time[$forum_id] : $user_lastmark; + + foreach ($topic_ids as $topic_id) + { + $last_read[$topic_id] = $user_lastmark; + } + } + } + + return $last_read; +} + +/** +* Get list of unread topics +* +* @param int $user_id User ID (or false for current user) +* @param string $sql_extra Extra WHERE SQL statement +* @param string $sql_sort ORDER BY SQL sorting statement +* @param string $sql_limit Limits the size of unread topics list, 0 for unlimited query +* @param string $sql_limit_offset Sets the offset of the first row to search, 0 to search from the start +* +* @return array[int][int] Topic ids as keys, mark_time of topic as value +*/ +function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $sql_limit = 1001, $sql_limit_offset = 0) +{ + global $config, $db, $user, $request; + global $phpbb_dispatcher; + + $user_id = ($user_id === false) ? (int) $user->data['user_id'] : (int) $user_id; + + // Data array we're going to return + $unread_topics = array(); + + if (empty($sql_sort)) + { + $sql_sort = 'ORDER BY t.topic_last_post_time DESC, t.topic_last_post_id DESC'; + } + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + // Get list of the unread topics + $last_mark = (int) $user->data['user_lastmark']; + + $sql_array = array( + 'SELECT' => 't.topic_id, t.topic_last_post_time, tt.mark_time as topic_mark_time, ft.mark_time as forum_mark_time', + + 'FROM' => array(TOPICS_TABLE => 't'), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), + 'ON' => "tt.user_id = $user_id AND t.topic_id = tt.topic_id", + ), + array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => "ft.user_id = $user_id AND t.forum_id = ft.forum_id", + ), + ), + + 'WHERE' => " + t.topic_last_post_time > $last_mark AND + ( + (tt.mark_time IS NOT NULL AND t.topic_last_post_time > tt.mark_time) OR + (tt.mark_time IS NULL AND ft.mark_time IS NOT NULL AND t.topic_last_post_time > ft.mark_time) OR + (tt.mark_time IS NULL AND ft.mark_time IS NULL) + ) + $sql_extra + $sql_sort", + ); + + /** + * Change SQL query for fetching unread topics data + * + * @event core.get_unread_topics_modify_sql + * @var array sql_array Fully assembled SQL query with keys SELECT, FROM, LEFT_JOIN, WHERE + * @var int last_mark User's last_mark time + * @var string sql_extra Extra WHERE SQL statement + * @var string sql_sort ORDER BY SQL sorting statement + * @since 3.1.4-RC1 + */ + $vars = array( + 'sql_array', + 'last_mark', + 'sql_extra', + 'sql_sort', + ); + extract($phpbb_dispatcher->trigger_event('core.get_unread_topics_modify_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query_limit($sql, $sql_limit, $sql_limit_offset); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id = (int) $row['topic_id']; + $unread_topics[$topic_id] = ($row['topic_mark_time']) ? (int) $row['topic_mark_time'] : (($row['forum_mark_time']) ? (int) $row['forum_mark_time'] : $last_mark); + } + $db->sql_freeresult($result); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + global $tracking_topics; + + if (empty($tracking_topics)) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', false, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + } + + if (!$user->data['is_registered']) + { + $user_lastmark = (isset($tracking_topics['l'])) ? base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate'] : 0; + } + else + { + $user_lastmark = (int) $user->data['user_lastmark']; + } + + $sql = 'SELECT t.topic_id, t.forum_id, t.topic_last_post_time + FROM ' . TOPICS_TABLE . ' t + WHERE t.topic_last_post_time > ' . $user_lastmark . " + $sql_extra + $sql_sort"; + $result = $db->sql_query_limit($sql, $sql_limit, $sql_limit_offset); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_id = (int) $row['forum_id']; + $topic_id = (int) $row['topic_id']; + $topic_id36 = base_convert($topic_id, 10, 36); + + if (isset($tracking_topics['t'][$topic_id36])) + { + $last_read = base_convert($tracking_topics['t'][$topic_id36], 36, 10) + $config['board_startdate']; + + if ($row['topic_last_post_time'] > $last_read) + { + $unread_topics[$topic_id] = $last_read; + } + } + else if (isset($tracking_topics['f'][$forum_id])) + { + $mark_time = base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']; + + if ($row['topic_last_post_time'] > $mark_time) + { + $unread_topics[$topic_id] = $mark_time; + } + } + else + { + $unread_topics[$topic_id] = $user_lastmark; + } + } + $db->sql_freeresult($result); + } + + return $unread_topics; +} + +/** +* Check for read forums and update topic tracking info accordingly +* +* @param int $forum_id the forum id to check +* @param int $forum_last_post_time the forums last post time +* @param int $f_mark_time the forums last mark time if user is registered and load_db_lastread enabled +* @param int $mark_time_forum false if the mark time needs to be obtained, else the last users forum mark time +* +* @return true if complete forum got marked read, else false. +*/ +function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false) +{ + global $db, $tracking_topics, $user, $config, $request, $phpbb_container; + + // Determine the users last forum mark time if not given. + if ($mark_time_forum === false) + { + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $mark_time_forum = (!empty($f_mark_time)) ? $f_mark_time : $user->data['user_lastmark']; + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + + if (!$user->data['is_registered']) + { + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + + $mark_time_forum = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + } + } + + // Handle update of unapproved topics info. + // Only update for moderators having m_approve permission for the forum. + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + // Check the forum for any left unread topics. + // If there are none, we mark the forum as read. + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + if ($mark_time_forum >= $forum_last_post_time) + { + // We do not need to mark read, this happened before. Therefore setting this to true + $row = true; + } + else + { + $sql = 'SELECT t.forum_id + FROM ' . TOPICS_TABLE . ' t + LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt + ON (tt.topic_id = t.topic_id + AND tt.user_id = ' . $user->data['user_id'] . ') + WHERE t.forum_id = ' . $forum_id . ' + AND t.topic_last_post_time > ' . $mark_time_forum . ' + AND t.topic_moved_id = 0 + AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.') . ' + AND (tt.topic_id IS NULL + OR tt.mark_time < t.topic_last_post_time)'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + // Get information from cookie + if (!isset($tracking_topics['tf'][$forum_id])) + { + // We do not need to mark read, this happened before. Therefore setting this to true + $row = true; + } + else + { + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE t.forum_id = ' . $forum_id . ' + AND t.topic_last_post_time > ' . $mark_time_forum . ' + AND t.topic_moved_id = 0 + AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'); + $result = $db->sql_query($sql); + + $check_forum = $tracking_topics['tf'][$forum_id]; + $unread = false; + + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($check_forum[base_convert($row['topic_id'], 10, 36)])) + { + $unread = true; + break; + } + } + $db->sql_freeresult($result); + + $row = $unread; + } + } + else + { + $row = true; + } + + if (!$row) + { + markread('topics', $forum_id); + return true; + } + + return false; +} + +/** +* Transform an array into a serialized format +*/ +function tracking_serialize($input) +{ + $out = ''; + foreach ($input as $key => $value) + { + if (is_array($value)) + { + $out .= $key . ':(' . tracking_serialize($value) . ');'; + } + else + { + $out .= $key . ':' . $value . ';'; + } + } + return $out; +} + +/** +* Transform a serialized array into an actual array +*/ +function tracking_unserialize($string, $max_depth = 3) +{ + $n = strlen($string); + if ($n > 10010) + { + die('Invalid data supplied'); + } + $data = $stack = array(); + $key = ''; + $mode = 0; + $level = &$data; + for ($i = 0; $i < $n; ++$i) + { + switch ($mode) + { + case 0: + switch ($string[$i]) + { + case ':': + $level[$key] = 0; + $mode = 1; + break; + case ')': + unset($level); + $level = array_pop($stack); + $mode = 3; + break; + default: + $key .= $string[$i]; + } + break; + + case 1: + switch ($string[$i]) + { + case '(': + if (count($stack) >= $max_depth) + { + die('Invalid data supplied'); + } + $stack[] = &$level; + $level[$key] = array(); + $level = &$level[$key]; + $key = ''; + $mode = 0; + break; + default: + $level[$key] = $string[$i]; + $mode = 2; + break; + } + break; + + case 2: + switch ($string[$i]) + { + case ')': + unset($level); + $level = array_pop($stack); + $mode = 3; + break; + case ';': + $key = ''; + $mode = 0; + break; + default: + $level[$key] .= $string[$i]; + break; + } + break; + + case 3: + switch ($string[$i]) + { + case ')': + unset($level); + $level = array_pop($stack); + break; + case ';': + $key = ''; + $mode = 0; + break; + default: + die('Invalid data supplied'); + break; + } + break; + } + } + + if (count($stack) != 0 || ($mode != 0 && $mode != 3)) + { + die('Invalid data supplied'); + } + + return $level; +} + +// Server functions (building urls, redirecting...) + +/** +* Append session id to url. +* This function supports hooks. +* +* @param string $url The url the session id needs to be appended to (can have params) +* @param mixed $params String or array of additional url parameters +* @param bool $is_amp Is url using & (true) or & (false) +* @param string $session_id Possibility to use a custom session id instead of the global one +* @param bool $is_route Is url generated by a route. +* +* @return string The corrected url. +* +* Examples: +* +* append_sid("{$phpbb_root_path}viewtopic.$phpEx?t=1&f=2"); +* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2'); +* append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=1&f=2', false); +* append_sid("{$phpbb_root_path}viewtopic.$phpEx", array('t' => 1, 'f' => 2)); +* +* +*/ +function append_sid($url, $params = false, $is_amp = true, $session_id = false, $is_route = false) +{ + global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_path_helper; + global $phpbb_dispatcher; + + if ($params === '' || (is_array($params) && empty($params))) + { + // Do not append the ? if the param-list is empty anyway. + $params = false; + } + + // Update the root path with the correct relative web path + if (!$is_route && $phpbb_path_helper instanceof \phpbb\path_helper) + { + $url = $phpbb_path_helper->update_web_root_path($url); + } + + $append_sid_overwrite = false; + + /** + * This event can either supplement or override the append_sid() function + * + * To override this function, the event must set $append_sid_overwrite to + * the new URL value, which will be returned following the event + * + * @event core.append_sid + * @var string url The url the session id needs + * to be appended to (can have + * params) + * @var mixed params String or array of additional + * url parameters + * @var bool is_amp Is url using & (true) or + * & (false) + * @var bool|string session_id Possibility to use a custom + * session id (string) instead of + * the global one (false) + * @var bool|string append_sid_overwrite Overwrite function (string + * URL) or not (false) + * @var bool is_route Is url generated by a route. + * @since 3.1.0-a1 + */ + $vars = array('url', 'params', 'is_amp', 'session_id', 'append_sid_overwrite', 'is_route'); + extract($phpbb_dispatcher->trigger_event('core.append_sid', compact($vars))); + + if ($append_sid_overwrite) + { + return $append_sid_overwrite; + } + + // The following hook remains for backwards compatibility, though use of + // the event above is preferred. + // Developers using the hook function need to globalise the $_SID and $_EXTRA_URL on their own and also handle it appropriately. + // They could mimic most of what is within this function + if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__, $url, $params, $is_amp, $session_id)) + { + if ($phpbb_hook->hook_return(__FUNCTION__)) + { + return $phpbb_hook->hook_return_result(__FUNCTION__); + } + } + + $params_is_array = is_array($params); + + // Get anchor + $anchor = ''; + if (strpos($url, '#') !== false) + { + list($url, $anchor) = explode('#', $url, 2); + $anchor = '#' . $anchor; + } + else if (!$params_is_array && strpos($params, '#') !== false) + { + list($params, $anchor) = explode('#', $params, 2); + $anchor = '#' . $anchor; + } + + // Handle really simple cases quickly + if ($_SID == '' && $session_id === false && empty($_EXTRA_URL) && !$params_is_array && !$anchor) + { + if ($params === false) + { + return $url; + } + + $url_delim = (strpos($url, '?') === false) ? '?' : (($is_amp) ? '&' : '&'); + return $url . ($params !== false ? $url_delim. $params : ''); + } + + // Assign sid if session id is not specified + if ($session_id === false) + { + $session_id = $_SID; + } + + $amp_delim = ($is_amp) ? '&' : '&'; + $url_delim = (strpos($url, '?') === false) ? '?' : $amp_delim; + + // Appending custom url parameter? + $append_url = (!empty($_EXTRA_URL)) ? implode($amp_delim, $_EXTRA_URL) : ''; + + // Use the short variant if possible ;) + if ($params === false) + { + // Append session id + if (!$session_id) + { + return $url . (($append_url) ? $url_delim . $append_url : '') . $anchor; + } + else + { + return $url . (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . 'sid=' . $session_id . $anchor; + } + } + + // Build string if parameters are specified as array + if (is_array($params)) + { + $output = array(); + + foreach ($params as $key => $item) + { + if ($item === NULL) + { + continue; + } + + if ($key == '#') + { + $anchor = '#' . $item; + continue; + } + + $output[] = $key . '=' . $item; + } + + $params = implode($amp_delim, $output); + } + + // Append session id and parameters (even if they are empty) + // If parameters are empty, the developer can still append his/her parameters without caring about the delimiter + return $url . (($append_url) ? $url_delim . $append_url . $amp_delim : $url_delim) . $params . ((!$session_id) ? '' : $amp_delim . 'sid=' . $session_id) . $anchor; +} + +/** +* Generate board url (example: http://www.example.com/phpBB) +* +* @param bool $without_script_path if set to true the script path gets not appended (example: http://www.example.com) +* +* @return string the generated board url +*/ +function generate_board_url($without_script_path = false) +{ + global $config, $user, $request, $symfony_request; + + $server_name = $user->host; + + // Forcing server vars is the only way to specify/override the protocol + if ($config['force_server_vars'] || !$server_name) + { + $server_protocol = ($config['server_protocol']) ? $config['server_protocol'] : (($config['cookie_secure']) ? 'https://' : 'http://'); + $server_name = $config['server_name']; + $server_port = (int) $config['server_port']; + $script_path = $config['script_path']; + + $url = $server_protocol . $server_name; + $cookie_secure = $config['cookie_secure']; + } + else + { + $server_port = (int) $symfony_request->getPort(); + + $forwarded_proto = $request->server('HTTP_X_FORWARDED_PROTO'); + + if (!empty($forwarded_proto) && $forwarded_proto === 'https') + { + $server_port = 443; + } + // Do not rely on cookie_secure, users seem to think that it means a secured cookie instead of an encrypted connection + $cookie_secure = $request->is_secure() ? 1 : 0; + $url = (($cookie_secure) ? 'https://' : 'http://') . $server_name; + + $script_path = $user->page['root_script_path']; + } + + if ($server_port && (($cookie_secure && $server_port <> 443) || (!$cookie_secure && $server_port <> 80))) + { + // HTTP HOST can carry a port number (we fetch $user->host, but for old versions this may be true) + if (strpos($server_name, ':') === false) + { + $url .= ':' . $server_port; + } + } + + if (!$without_script_path) + { + $url .= $script_path; + } + + // Strip / from the end + if (substr($url, -1, 1) == '/') + { + $url = substr($url, 0, -1); + } + + return $url; +} + +/** +* Redirects the user to another page then exits the script nicely +* This function is intended for urls within the board. It's not meant to redirect to cross-domains. +* +* @param string $url The url to redirect to +* @param bool $return If true, do not redirect but return the sanitized URL. Default is no return. +* @param bool $disable_cd_check If true, redirect() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. Default is false. +*/ +function redirect($url, $return = false, $disable_cd_check = false) +{ + global $user, $phpbb_path_helper, $phpbb_dispatcher; + + if (!$user->is_setup()) + { + $user->add_lang('common'); + } + + // Make sure no &'s are in, this will break the redirect + $url = str_replace('&', '&', $url); + + // Determine which type of redirect we need to handle... + $url_parts = @parse_url($url); + + if ($url_parts === false) + { + // Malformed url + trigger_error('INSECURE_REDIRECT', E_USER_WARNING); + } + else if (!empty($url_parts['scheme']) && !empty($url_parts['host'])) + { + // Attention: only able to redirect within the same domain if $disable_cd_check is false (yourdomain.com -> www.yourdomain.com will not work) + if (!$disable_cd_check && $url_parts['host'] !== $user->host) + { + trigger_error('INSECURE_REDIRECT', E_USER_WARNING); + } + } + else if ($url[0] == '/') + { + // Absolute uri, prepend direct url... + $url = generate_board_url(true) . $url; + } + else + { + // Relative uri + $pathinfo = pathinfo($url); + + // Is the uri pointing to the current directory? + if ($pathinfo['dirname'] == '.') + { + $url = str_replace('./', '', $url); + + // Strip / from the beginning + if ($url && substr($url, 0, 1) == '/') + { + $url = substr($url, 1); + } + } + + $url = $phpbb_path_helper->remove_web_root_path($url); + + if ($user->page['page_dir']) + { + $url = $user->page['page_dir'] . '/' . $url; + } + + $url = generate_board_url() . '/' . $url; + } + + // Clean URL and check if we go outside the forum directory + $url = $phpbb_path_helper->clean_url($url); + + if (!$disable_cd_check && strpos($url, generate_board_url(true) . '/') !== 0) + { + trigger_error('INSECURE_REDIRECT', E_USER_WARNING); + } + + // Make sure no linebreaks are there... to prevent http response splitting for PHP < 4.4.2 + if (strpos(urldecode($url), "\n") !== false || strpos(urldecode($url), "\r") !== false || strpos($url, ';') !== false) + { + trigger_error('INSECURE_REDIRECT', E_USER_WARNING); + } + + // Now, also check the protocol and for a valid url the last time... + $allowed_protocols = array('http', 'https', 'ftp', 'ftps'); + $url_parts = parse_url($url); + + if ($url_parts === false || empty($url_parts['scheme']) || !in_array($url_parts['scheme'], $allowed_protocols)) + { + trigger_error('INSECURE_REDIRECT', E_USER_WARNING); + } + + /** + * Execute code and/or overwrite redirect() + * + * @event core.functions.redirect + * @var string url The url + * @var bool return If true, do not redirect but return the sanitized URL. + * @var bool disable_cd_check If true, redirect() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. + * @since 3.1.0-RC3 + */ + $vars = array('url', 'return', 'disable_cd_check'); + extract($phpbb_dispatcher->trigger_event('core.functions.redirect', compact($vars))); + + if ($return) + { + return $url; + } + else + { + garbage_collection(); + } + + // Redirect via an HTML form for PITA webservers + if (@preg_match('#WebSTAR|Xitami#', getenv('SERVER_SOFTWARE'))) + { + header('Refresh: 0; URL=' . $url); + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '' . $user->lang['REDIRECT'] . ''; + echo ''; + echo ''; + echo '
' . sprintf($user->lang['URL_REDIRECT'], '', '') . '
'; + echo ''; + echo ''; + + exit; + } + + // Behave as per HTTP/1.1 spec for others + header('Location: ' . $url); + exit; +} + +/** +* Re-Apply session id after page reloads +*/ +function reapply_sid($url, $is_route = false) +{ + global $phpEx, $phpbb_root_path; + + if ($url === "index.$phpEx") + { + return append_sid("index.$phpEx"); + } + else if ($url === "{$phpbb_root_path}index.$phpEx") + { + return append_sid("{$phpbb_root_path}index.$phpEx"); + } + + // Remove previously added sid + if (strpos($url, 'sid=') !== false) + { + // All kind of links + $url = preg_replace('/(\?)?(&|&)?sid=[a-z0-9]+/', '', $url); + // if the sid was the first param, make the old second as first ones + $url = preg_replace("/$phpEx(&|&)+?/", "$phpEx?", $url); + } + + return append_sid($url, false, true, false, $is_route); +} + +/** +* Returns url from the session/current page with an re-appended SID with optionally stripping vars from the url +*/ +function build_url($strip_vars = false) +{ + global $config, $user, $phpbb_path_helper; + + $page = $phpbb_path_helper->get_valid_page($user->page['page'], $config['enable_mod_rewrite']); + + // Append SID + $redirect = append_sid($page, false, false); + + if ($strip_vars !== false) + { + $redirect = $phpbb_path_helper->strip_url_params($redirect, $strip_vars, false); + } + else + { + $redirect = str_replace('&', '&', $redirect); + } + + return $redirect . ((strpos($redirect, '?') === false) ? '?' : ''); +} + +/** +* Meta refresh assignment +* Adds META template variable with meta http tag. +* +* @param int $time Time in seconds for meta refresh tag +* @param string $url URL to redirect to. The url will go through redirect() first before the template variable is assigned +* @param bool $disable_cd_check If true, meta_refresh() will redirect to an external domain. If false, the redirect point to the boards url if it does not match the current domain. Default is false. +*/ +function meta_refresh($time, $url, $disable_cd_check = false) +{ + global $template, $refresh_data, $request; + + $url = redirect($url, true, $disable_cd_check); + if ($request->is_ajax()) + { + $refresh_data = array( + 'time' => $time, + 'url' => $url, + ); + } + else + { + // For XHTML compatibility we change back & to & + $url = str_replace('&', '&', $url); + + $template->assign_vars(array( + 'META' => '') + ); + } + + return $url; +} + +/** +* Outputs correct status line header. +* +* Depending on php sapi one of the two following forms is used: +* +* Status: 404 Not Found +* +* HTTP/1.x 404 Not Found +* +* HTTP version is taken from HTTP_VERSION environment variable, +* and defaults to 1.0. +* +* Sample usage: +* +* send_status_line(404, 'Not Found'); +* +* @param int $code HTTP status code +* @param string $message Message for the status code +* @return null +*/ +function send_status_line($code, $message) +{ + if (substr(strtolower(@php_sapi_name()), 0, 3) === 'cgi') + { + // in theory, we shouldn't need that due to php doing it. Reality offers a differing opinion, though + header("Status: $code $message", true, $code); + } + else + { + $version = phpbb_request_http_version(); + header("$version $code $message", true, $code); + } +} + +/** +* Returns the HTTP version used in the current request. +* +* Handles the case of being called before $request is present, +* in which case it falls back to the $_SERVER superglobal. +* +* @return string HTTP version +*/ +function phpbb_request_http_version() +{ + global $request; + + $version = ''; + if ($request && $request->server('SERVER_PROTOCOL')) + { + $version = $request->server('SERVER_PROTOCOL'); + } + else if (isset($_SERVER['SERVER_PROTOCOL'])) + { + $version = $_SERVER['SERVER_PROTOCOL']; + } + + if (!empty($version) && is_string($version) && preg_match('#^HTTP/[0-9]\.[0-9]$#', $version)) + { + return $version; + } + + return 'HTTP/1.0'; +} + +//Form validation + + +/** +* Add a secret hash for use in links/GET requests +* @param string $link_name The name of the link; has to match the name used in check_link_hash, otherwise no restrictions apply +* @return string the hash + +*/ +function generate_link_hash($link_name) +{ + global $user; + + if (!isset($user->data["hash_$link_name"])) + { + $user->data["hash_$link_name"] = substr(sha1($user->data['user_form_salt'] . $link_name), 0, 8); + } + + return $user->data["hash_$link_name"]; +} + + +/** +* checks a link hash - for GET requests +* @param string $token the submitted token +* @param string $link_name The name of the link +* @return boolean true if all is fine +*/ +function check_link_hash($token, $link_name) +{ + return $token === generate_link_hash($link_name); +} + +/** +* Add a secret token to the form (requires the S_FORM_TOKEN template variable) +* @param string $form_name The name of the form; has to match the name used in check_form_key, otherwise no restrictions apply +* @param string $template_variable_suffix A string that is appended to the name of the template variable to which the form elements are assigned +*/ +function add_form_key($form_name, $template_variable_suffix = '') +{ + global $config, $template, $user, $phpbb_dispatcher; + + $now = time(); + $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : ''; + $token = sha1($now . $user->data['user_form_salt'] . $form_name . $token_sid); + + $s_fields = build_hidden_fields(array( + 'creation_time' => $now, + 'form_token' => $token, + )); + + /** + * Perform additional actions on creation of the form token + * + * @event core.add_form_key + * @var string form_name The form name + * @var int now Current time timestamp + * @var string s_fields Generated hidden fields + * @var string token Form token + * @var string token_sid User session ID + * @var string template_variable_suffix The string that is appended to template variable name + * + * @since 3.1.0-RC3 + * @changed 3.1.11-RC1 Added template_variable_suffix + */ + $vars = array( + 'form_name', + 'now', + 's_fields', + 'token', + 'token_sid', + 'template_variable_suffix', + ); + extract($phpbb_dispatcher->trigger_event('core.add_form_key', compact($vars))); + + $template->assign_var('S_FORM_TOKEN' . $template_variable_suffix, $s_fields); +} + +/** + * Check the form key. Required for all altering actions not secured by confirm_box + * + * @param string $form_name The name of the form; has to match the name used + * in add_form_key, otherwise no restrictions apply + * @param int $timespan The maximum acceptable age for a submitted form + * in seconds. Defaults to the config setting. + * @return bool True, if the form key was valid, false otherwise + */ +function check_form_key($form_name, $timespan = false) +{ + global $config, $request, $user; + + if ($timespan === false) + { + // we enforce a minimum value of half a minute here. + $timespan = ($config['form_token_lifetime'] == -1) ? -1 : max(30, $config['form_token_lifetime']); + } + + if ($request->is_set_post('creation_time') && $request->is_set_post('form_token')) + { + $creation_time = abs($request->variable('creation_time', 0)); + $token = $request->variable('form_token', ''); + + $diff = time() - $creation_time; + + // If creation_time and the time() now is zero we can assume it was not a human doing this (the check for if ($diff)... + if (defined('DEBUG_TEST') || $diff && ($diff <= $timespan || $timespan === -1)) + { + $token_sid = ($user->data['user_id'] == ANONYMOUS && !empty($config['form_token_sid_guests'])) ? $user->session_id : ''; + $key = sha1($creation_time . $user->data['user_form_salt'] . $form_name . $token_sid); + + if ($key === $token) + { + return true; + } + } + } + + return false; +} + +// Message/Login boxes + +/** +* Build Confirm box +* @param boolean $check True for checking if confirmed (without any additional parameters) and false for displaying the confirm box +* @param string|array $title Title/Message used for confirm box. +* message text is _CONFIRM appended to title. +* If title cannot be found in user->lang a default one is displayed +* If title_CONFIRM cannot be found in user->lang the text given is used. +* If title is an array, the first array value is used as explained per above, +* all other array values are sent as parameters to the language function. +* @param string $hidden Hidden variables +* @param string $html_body Template used for confirm box +* @param string $u_action Custom form action +* +* @return bool True if confirmation was successful, false if not +*/ +function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_body.html', $u_action = '') +{ + global $user, $template, $db, $request; + global $config, $language, $phpbb_path_helper; + + if (isset($_POST['cancel'])) + { + return false; + } + + $confirm = ($language->lang('YES') === $request->variable('confirm', '', true, \phpbb\request\request_interface::POST)); + + if ($check && $confirm) + { + $user_id = $request->variable('confirm_uid', 0); + $session_id = $request->variable('sess', ''); + $confirm_key = $request->variable('confirm_key', ''); + + if ($user_id != $user->data['user_id'] || $session_id != $user->session_id || !$confirm_key || !$user->data['user_last_confirm_key'] || $confirm_key != $user->data['user_last_confirm_key']) + { + return false; + } + + // Reset user_last_confirm_key + $sql = 'UPDATE ' . USERS_TABLE . " SET user_last_confirm_key = '' + WHERE user_id = " . $user->data['user_id']; + $db->sql_query($sql); + + return true; + } + else if ($check) + { + return false; + } + + $s_hidden_fields = build_hidden_fields(array( + 'confirm_uid' => $user->data['user_id'], + 'sess' => $user->session_id, + 'sid' => $user->session_id, + )); + + // generate activation key + $confirm_key = gen_rand_string(10); + + // generate language strings + if (is_array($title)) + { + $key = array_shift($title); + $count = array_shift($title); + $confirm_title = $language->is_set($key) ? $language->lang($key, $count, $title) : $language->lang('CONFIRM'); + $confirm_text = $language->is_set($key . '_CONFIRM') ? $language->lang($key . '_CONFIRM', $count, $title) : $key; + } + else + { + $confirm_title = $language->is_set($title) ? $language->lang($title) : $language->lang('CONFIRM'); + $confirm_text = $language->is_set($title . '_CONFIRM') ? $language->lang($title . '_CONFIRM') : $title; + } + + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_header($confirm_title); + } + else + { + page_header($confirm_title); + } + + $template->set_filenames(array( + 'body' => $html_body) + ); + + // If activation key already exist, we better do not re-use the key (something very strange is going on...) + if ($request->variable('confirm_key', '')) + { + // This should not occur, therefore we cancel the operation to safe the user + return false; + } + + // re-add sid / transform & to & for user->page (user->page is always using &) + $use_page = ($u_action) ? $u_action : str_replace('&', '&', $user->page['page']); + $u_action = reapply_sid($phpbb_path_helper->get_valid_page($use_page, $config['enable_mod_rewrite'])); + $u_action .= ((strpos($u_action, '?') === false) ? '?' : '&') . 'confirm_key=' . $confirm_key; + + $template->assign_vars(array( + 'MESSAGE_TITLE' => $confirm_title, + 'MESSAGE_TEXT' => $confirm_text, + + 'YES_VALUE' => $language->lang('YES'), + 'S_CONFIRM_ACTION' => $u_action, + 'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields, + 'S_AJAX_REQUEST' => $request->is_ajax(), + )); + + $sql = 'UPDATE ' . USERS_TABLE . " SET user_last_confirm_key = '" . $db->sql_escape($confirm_key) . "' + WHERE user_id = " . $user->data['user_id']; + $db->sql_query($sql); + + if ($request->is_ajax()) + { + $u_action .= '&confirm_uid=' . $user->data['user_id'] . '&sess=' . $user->session_id . '&sid=' . $user->session_id; + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'MESSAGE_BODY' => $template->assign_display('body'), + 'MESSAGE_TITLE' => $confirm_title, + 'MESSAGE_TEXT' => $confirm_text, + + 'YES_VALUE' => $language->lang('YES'), + 'S_CONFIRM_ACTION' => str_replace('&', '&', $u_action), //inefficient, rewrite whole function + 'S_HIDDEN_FIELDS' => $hidden . $s_hidden_fields + )); + } + + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_footer(); + } + else + { + page_footer(); + } + + exit; // unreachable, page_footer() above will call exit() +} + +/** +* Generate login box or verify password +*/ +function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true) +{ + global $user, $template, $auth, $phpEx, $phpbb_root_path, $config; + global $request, $phpbb_container, $phpbb_dispatcher, $phpbb_log; + + $err = ''; + $form_name = 'login'; + + // Make sure user->setup() has been called + if (!$user->is_setup()) + { + $user->setup(); + } + + /** + * This event allows an extension to modify the login process + * + * @event core.login_box_before + * @var string redirect Redirect string + * @var string l_explain Explain language string + * @var string l_success Success language string + * @var bool admin Is admin? + * @var bool s_display Display full login form? + * @var string err Error string + * @since 3.1.9-RC1 + */ + $vars = array('redirect', 'l_explain', 'l_success', 'admin', 's_display', 'err'); + extract($phpbb_dispatcher->trigger_event('core.login_box_before', compact($vars))); + + // Print out error if user tries to authenticate as an administrator without having the privileges... + if ($admin && !$auth->acl_get('a_')) + { + // Not authd + // anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions + if ($user->data['is_registered']) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); + } + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_ADMIN'); + } + + if (empty($err) && ($request->is_set_post('login') || ($request->is_set('login') && $request->variable('login', '') == 'external'))) + { + // Get credential + if ($admin) + { + $credential = $request->variable('credential', ''); + + if (strspn($credential, 'abcdef0123456789') !== strlen($credential) || strlen($credential) != 32) + { + if ($user->data['is_registered']) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); + } + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_ADMIN'); + } + + $password = $request->untrimmed_variable('password_' . $credential, '', true); + } + else + { + $password = $request->untrimmed_variable('password', '', true); + } + + $username = $request->variable('username', '', true); + $autologin = $request->is_set_post('autologin'); + $viewonline = (int) !$request->is_set_post('viewonline'); + $admin = ($admin) ? 1 : 0; + $viewonline = ($admin) ? $user->data['session_viewonline'] : $viewonline; + + // Check if the supplied username is equal to the one stored within the database if re-authenticating + if ($admin && utf8_clean_string($username) != utf8_clean_string($user->data['username'])) + { + // We log the attempt to use a different username... + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); + + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_ADMIN_USER_DIFFER'); + } + + // Check form key + if ($password && !check_form_key($form_name)) + { + $result = array( + 'status' => false, + 'error_msg' => 'FORM_INVALID', + ); + } + else + { + // If authentication is successful we redirect user to previous page + $result = $auth->login($username, $password, $autologin, $viewonline, $admin); + } + + // If admin authentication and login, we will log if it was a success or not... + // We also break the operation on the first non-success login - it could be argued that the user already knows + if ($admin) + { + if ($result['status'] == LOGIN_SUCCESS) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_SUCCESS'); + } + else + { + // Only log the failed attempt if a real user tried to. + // anonymous/inactive users are never able to go to the ACP even if they have the relevant permissions + if ($user->data['is_registered']) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ADMIN_AUTH_FAIL'); + } + } + } + + // The result parameter is always an array, holding the relevant information... + if ($result['status'] == LOGIN_SUCCESS) + { + $redirect = $request->variable('redirect', "{$phpbb_root_path}index.$phpEx"); + + /** + * This event allows an extension to modify the redirection when a user successfully logs in + * + * @event core.login_box_redirect + * @var string redirect Redirect string + * @var bool admin Is admin? + * @var array result Result from auth provider + * @since 3.1.0-RC5 + * @changed 3.1.9-RC1 Removed undefined return variable + * @changed 3.2.4-RC1 Added result + */ + $vars = array('redirect', 'admin', 'result'); + extract($phpbb_dispatcher->trigger_event('core.login_box_redirect', compact($vars))); + + // append/replace SID (may change during the session for AOL users) + $redirect = reapply_sid($redirect); + + // Special case... the user is effectively banned, but we allow founders to login + if (defined('IN_CHECK_BAN') && $result['user_row']['user_type'] != USER_FOUNDER) + { + return; + } + + redirect($redirect); + } + + // Something failed, determine what... + if ($result['status'] == LOGIN_BREAK) + { + trigger_error($result['error_msg']); + } + + // Special cases... determine + switch ($result['status']) + { + case LOGIN_ERROR_PASSWORD_CONVERT: + $err = sprintf( + $user->lang[$result['error_msg']], + ($config['email_enable']) ? '' : '', + ($config['email_enable']) ? '' : '', + '', + '' + ); + break; + + case LOGIN_ERROR_ATTEMPTS: + + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_LOGIN); + // $captcha->reset(); + + $template->assign_vars(array( + 'CAPTCHA_TEMPLATE' => $captcha->get_template(), + )); + // no break; + + // Username, password, etc... + default: + $err = $user->lang[$result['error_msg']]; + + // Assign admin contact to some error messages + if ($result['error_msg'] == 'LOGIN_ERROR_USERNAME' || $result['error_msg'] == 'LOGIN_ERROR_PASSWORD') + { + $err = sprintf($user->lang[$result['error_msg']], '', ''); + } + + break; + } + + /** + * This event allows an extension to process when a user fails a login attempt + * + * @event core.login_box_failed + * @var array result Login result data + * @var string username User name used to login + * @var string password Password used to login + * @var string err Error message + * @since 3.1.3-RC1 + */ + $vars = array('result', 'username', 'password', 'err'); + extract($phpbb_dispatcher->trigger_event('core.login_box_failed', compact($vars))); + } + + // Assign credential for username/password pair + $credential = ($admin) ? md5(unique_id()) : false; + + $s_hidden_fields = array( + 'sid' => $user->session_id, + ); + + if ($redirect) + { + $s_hidden_fields['redirect'] = $redirect; + } + + if ($admin) + { + $s_hidden_fields['credential'] = $credential; + } + + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_provider = $provider_collection->get_provider(); + + $auth_provider_data = $auth_provider->get_login_data(); + if ($auth_provider_data) + { + if (isset($auth_provider_data['VARS'])) + { + $template->assign_vars($auth_provider_data['VARS']); + } + + if (isset($auth_provider_data['BLOCK_VAR_NAME'])) + { + foreach ($auth_provider_data['BLOCK_VARS'] as $block_vars) + { + $template->assign_block_vars($auth_provider_data['BLOCK_VAR_NAME'], $block_vars); + } + } + + $template->assign_vars(array( + 'PROVIDER_TEMPLATE_FILE' => $auth_provider_data['TEMPLATE_FILE'], + )); + } + + // Add form token for login box + add_form_key($form_name, '_LOGIN'); + + $s_hidden_fields = build_hidden_fields($s_hidden_fields); + + $login_box_template_data = array( + 'LOGIN_ERROR' => $err, + 'LOGIN_EXPLAIN' => $l_explain, + + 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '', + 'U_RESEND_ACTIVATION' => ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '', + 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), + 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), + 'UA_PRIVACY' => addslashes(append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy')), + + 'S_DISPLAY_FULL_LOGIN' => ($s_display) ? true : false, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + + 'S_ADMIN_AUTH' => $admin, + 'USERNAME' => ($admin) ? $user->data['username'] : '', + + 'USERNAME_CREDENTIAL' => 'username', + 'PASSWORD_CREDENTIAL' => ($admin) ? 'password_' . $credential : 'password', + ); + + /** + * Event to add/modify login box template data + * + * @event core.login_box_modify_template_data + * @var int admin Flag whether user is admin + * @var string username User name + * @var int autologin Flag whether autologin is enabled + * @var string redirect Redirect URL + * @var array login_box_template_data Array with the login box template data + * @since 3.2.3-RC2 + */ + $vars = array( + 'admin', + 'username', + 'autologin', + 'redirect', + 'login_box_template_data', + ); + extract($phpbb_dispatcher->trigger_event('core.login_box_modify_template_data', compact($vars))); + + $template->assign_vars($login_box_template_data); + + page_header($user->lang['LOGIN']); + + $template->set_filenames(array( + 'body' => 'login_body.html') + ); + make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + + page_footer(); +} + +/** +* Generate forum login box +*/ +function login_forum_box($forum_data) +{ + global $db, $phpbb_container, $request, $template, $user, $phpbb_dispatcher, $phpbb_root_path, $phpEx; + + $password = $request->variable('password', '', true); + + $sql = 'SELECT forum_id + FROM ' . FORUMS_ACCESS_TABLE . ' + WHERE forum_id = ' . $forum_data['forum_id'] . ' + AND user_id = ' . $user->data['user_id'] . " + AND session_id = '" . $db->sql_escape($user->session_id) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return true; + } + + if ($password) + { + // Remove expired authorised sessions + $sql = 'SELECT f.session_id + FROM ' . FORUMS_ACCESS_TABLE . ' f + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (f.session_id = s.session_id) + WHERE s.session_id IS NULL'; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $sql_in = array(); + do + { + $sql_in[] = (string) $row['session_id']; + } + while ($row = $db->sql_fetchrow($result)); + + // Remove expired sessions + $sql = 'DELETE FROM ' . FORUMS_ACCESS_TABLE . ' + WHERE ' . $db->sql_in_set('session_id', $sql_in); + $db->sql_query($sql); + } + $db->sql_freeresult($result); + + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + + if ($passwords_manager->check($password, $forum_data['forum_password'])) + { + $sql_ary = array( + 'forum_id' => (int) $forum_data['forum_id'], + 'user_id' => (int) $user->data['user_id'], + 'session_id' => (string) $user->session_id, + ); + + $db->sql_query('INSERT INTO ' . FORUMS_ACCESS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + return true; + } + + $template->assign_var('LOGIN_ERROR', $user->lang['WRONG_PASSWORD']); + } + + /** + * Performing additional actions, load additional data on forum login + * + * @event core.login_forum_box + * @var array forum_data Array with forum data + * @var string password Password entered + * @since 3.1.0-RC3 + */ + $vars = array('forum_data', 'password'); + extract($phpbb_dispatcher->trigger_event('core.login_forum_box', compact($vars))); + + page_header($user->lang['LOGIN']); + + // Add form token for login box + add_form_key('login', '_LOGIN'); + + $template->assign_vars(array( + 'FORUM_NAME' => isset($forum_data['forum_name']) ? $forum_data['forum_name'] : '', + 'S_LOGIN_ACTION' => build_url(array('f')), + 'S_HIDDEN_FIELDS' => build_hidden_fields(array('f' => $forum_data['forum_id']))) + ); + + $template->set_filenames(array( + 'body' => 'login_forum.html') + ); + + make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_data['forum_id']); + + page_footer(); +} + +// Little helpers + +/** +* Little helper for the build_hidden_fields function +*/ +function _build_hidden_fields($key, $value, $specialchar, $stripslashes) +{ + $hidden_fields = ''; + + if (!is_array($value)) + { + $value = ($stripslashes) ? stripslashes($value) : $value; + $value = ($specialchar) ? htmlspecialchars($value, ENT_COMPAT, 'UTF-8') : $value; + + $hidden_fields .= '' . "\n"; + } + else + { + foreach ($value as $_key => $_value) + { + $_key = ($stripslashes) ? stripslashes($_key) : $_key; + $_key = ($specialchar) ? htmlspecialchars($_key, ENT_COMPAT, 'UTF-8') : $_key; + + $hidden_fields .= _build_hidden_fields($key . '[' . $_key . ']', $_value, $specialchar, $stripslashes); + } + } + + return $hidden_fields; +} + +/** +* Build simple hidden fields from array +* +* @param array $field_ary an array of values to build the hidden field from +* @param bool $specialchar if true, keys and values get specialchared +* @param bool $stripslashes if true, keys and values get stripslashed +* +* @return string the hidden fields +*/ +function build_hidden_fields($field_ary, $specialchar = false, $stripslashes = false) +{ + $s_hidden_fields = ''; + + foreach ($field_ary as $name => $vars) + { + $name = ($stripslashes) ? stripslashes($name) : $name; + $name = ($specialchar) ? htmlspecialchars($name, ENT_COMPAT, 'UTF-8') : $name; + + $s_hidden_fields .= _build_hidden_fields($name, $vars, $specialchar, $stripslashes); + } + + return $s_hidden_fields; +} + +/** +* Parse cfg file +*/ +function parse_cfg_file($filename, $lines = false) +{ + $parsed_items = array(); + + if ($lines === false) + { + $lines = file($filename); + } + + foreach ($lines as $line) + { + $line = trim($line); + + if (!$line || $line[0] == '#' || ($delim_pos = strpos($line, '=')) === false) + { + continue; + } + + // Determine first occurrence, since in values the equal sign is allowed + $key = htmlspecialchars(strtolower(trim(substr($line, 0, $delim_pos)))); + $value = trim(substr($line, $delim_pos + 1)); + + if (in_array($value, array('off', 'false', '0'))) + { + $value = false; + } + else if (in_array($value, array('on', 'true', '1'))) + { + $value = true; + } + else if (!trim($value)) + { + $value = ''; + } + else if (($value[0] == "'" && $value[strlen($value) - 1] == "'") || ($value[0] == '"' && $value[strlen($value) - 1] == '"')) + { + $value = htmlspecialchars(substr($value, 1, strlen($value)-2)); + } + else + { + $value = htmlspecialchars($value); + } + + $parsed_items[$key] = $value; + } + + if (isset($parsed_items['parent']) && isset($parsed_items['name']) && $parsed_items['parent'] == $parsed_items['name']) + { + unset($parsed_items['parent']); + } + + return $parsed_items; +} + +/** +* Return a nicely formatted backtrace. +* +* Turns the array returned by debug_backtrace() into HTML markup. +* Also filters out absolute paths to phpBB root. +* +* @return string HTML markup +*/ +function get_backtrace() +{ + $output = '
'; + $backtrace = debug_backtrace(); + + // We skip the first one, because it only shows this file/function + unset($backtrace[0]); + + foreach ($backtrace as $trace) + { + // Strip the current directory from path + $trace['file'] = (empty($trace['file'])) ? '(not given by php)' : htmlspecialchars(phpbb_filter_root_path($trace['file'])); + $trace['line'] = (empty($trace['line'])) ? '(not given by php)' : $trace['line']; + + // Only show function arguments for include etc. + // Other parameters may contain sensible information + $argument = ''; + if (!empty($trace['args'][0]) && in_array($trace['function'], array('include', 'require', 'include_once', 'require_once'))) + { + $argument = htmlspecialchars(phpbb_filter_root_path($trace['args'][0])); + } + + $trace['class'] = (!isset($trace['class'])) ? '' : $trace['class']; + $trace['type'] = (!isset($trace['type'])) ? '' : $trace['type']; + + $output .= '
'; + $output .= 'FILE: ' . $trace['file'] . '
'; + $output .= 'LINE: ' . ((!empty($trace['line'])) ? $trace['line'] : '') . '
'; + + $output .= 'CALL: ' . htmlspecialchars($trace['class'] . $trace['type'] . $trace['function']); + $output .= '(' . (($argument !== '') ? "'$argument'" : '') . ')
'; + } + $output .= '
'; + return $output; +} + +/** +* This function returns a regular expression pattern for commonly used expressions +* Use with / as delimiter for email mode and # for url modes +* mode can be: email|bbcode_htm|url|url_inline|www_url|www_url_inline|relative_url|relative_url_inline|ipv4|ipv6 +*/ +function get_preg_expression($mode) +{ + switch ($mode) + { + case 'email': + // Regex written by James Watts and Francisco Jose Martin Moreno + // http://fightingforalostcause.net/misc/2006/compare-email-regex.php + return '((?:[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*(?:[\w\!\#$\%\'\*\+\-\/\=\?\^\`{\|\}\~]|&)+)@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,63})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)'; + break; + + case 'bbcode_htm': + return array( + '#.*?#', + '#.*?#', + '#\2#', + '#.*?#', + '#(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))[.](?(?:0|[1-9](?:(?:0|[1-9])+)*))(?:-(?(?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:0|[1-9](?:(?:0|[1-9])+)*))(?:[.](?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:0|[1-9](?:(?:0|[1-9])+)*)))*))?(?:[+](?(?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:(?:0|[1-9])+))(?:[.](?:(?:(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?|(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)(?:[A-Za-z]|-)(?:(?:(?:0|[1-9])|(?:[A-Za-z]|-))+)?)|(?:(?:0|[1-9])+)))*))?)$/'; + break; + } + + return ''; +} + +/** +* Generate regexp for naughty words censoring +* Depends on whether installed PHP version supports unicode properties +* +* @param string $word word template to be replaced +* +* @return string $preg_expr regex to use with word censor +*/ +function get_censor_preg_expression($word) +{ + // Unescape the asterisk to simplify further conversions + $word = str_replace('\*', '*', preg_quote($word, '#')); + + // Replace asterisk(s) inside the pattern, at the start and at the end of it with regexes + $word = preg_replace(array('#(?<=[\p{Nd}\p{L}_])\*+(?=[\p{Nd}\p{L}_])#iu', '#^\*+#', '#\*+$#'), array('([\x20]*?|[\p{Nd}\p{L}_-]*?)', '[\p{Nd}\p{L}_-]*?', '[\p{Nd}\p{L}_-]*?'), $word); + + // Generate the final substitution + $preg_expr = '#(? strlen($longest_match)) + { + $longest_match = $match[0]; + $longest_match_offset = $match[1]; + } + } + + $ret = substr_replace($ret, '', $longest_match_offset, strlen($longest_match)); + + if ($longest_match_offset == strlen($ret)) + { + $ret .= ':'; + } + + if ($longest_match_offset == 0) + { + $ret = ':' . $ret; + } + + return $ret; + + default: + return false; + } +} + +/** +* Wrapper for inet_pton() +* +* Converts a human readable IP address to its packed in_addr representation +* inet_pton() is supported by PHP since 5.1.0, since 5.3.0 also on Windows. +* +* @param string $address A human readable IPv4 or IPv6 address. +* +* @return mixed false if address is invalid, +* in_addr representation of the given address otherwise (string) +*/ +function phpbb_inet_pton($address) +{ + $ret = ''; + if (preg_match(get_preg_expression('ipv4'), $address)) + { + foreach (explode('.', $address) as $part) + { + $ret .= ($part <= 0xF ? '0' : '') . dechex($part); + } + + return pack('H*', $ret); + } + + if (preg_match(get_preg_expression('ipv6'), $address)) + { + $parts = explode(':', $address); + $missing_parts = 8 - count($parts) + 1; + + if (substr($address, 0, 2) === '::') + { + ++$missing_parts; + } + + if (substr($address, -2) === '::') + { + ++$missing_parts; + } + + $embedded_ipv4 = false; + $last_part = end($parts); + + if (preg_match(get_preg_expression('ipv4'), $last_part)) + { + $parts[count($parts) - 1] = ''; + $last_part = phpbb_inet_pton($last_part); + $embedded_ipv4 = true; + --$missing_parts; + } + + foreach ($parts as $i => $part) + { + if (strlen($part)) + { + $ret .= str_pad($part, 4, '0', STR_PAD_LEFT); + } + else if ($i && $i < count($parts) - 1) + { + $ret .= str_repeat('0000', $missing_parts); + } + } + + $ret = pack('H*', $ret); + + if ($embedded_ipv4) + { + $ret .= $last_part; + } + + return $ret; + } + + return false; +} + +/** +* Wrapper for php's checkdnsrr function. +* +* @param string $host Fully-Qualified Domain Name +* @param string $type Resource record type to lookup +* Supported types are: MX (default), A, AAAA, NS, TXT, CNAME +* Other types may work or may not work +* +* @return mixed true if entry found, +* false if entry not found, +* null if this function is not supported by this environment +* +* Since null can also be returned, you probably want to compare the result +* with === true or === false, +*/ +function phpbb_checkdnsrr($host, $type = 'MX') +{ + // The dot indicates to search the DNS root (helps those having DNS prefixes on the same domain) + if (substr($host, -1) == '.') + { + $host_fqdn = $host; + $host = substr($host, 0, -1); + } + else + { + $host_fqdn = $host . '.'; + } + // $host has format some.host.example.com + // $host_fqdn has format some.host.example.com. + + // If we're looking for an A record we can use gethostbyname() + if ($type == 'A' && function_exists('gethostbyname')) + { + return (@gethostbyname($host_fqdn) == $host_fqdn) ? false : true; + } + + if (function_exists('checkdnsrr')) + { + return checkdnsrr($host_fqdn, $type); + } + + if (function_exists('dns_get_record')) + { + // dns_get_record() expects an integer as second parameter + // We have to convert the string $type to the corresponding integer constant. + $type_constant = 'DNS_' . $type; + $type_param = (defined($type_constant)) ? constant($type_constant) : DNS_ANY; + + // dns_get_record() might throw E_WARNING and return false for records that do not exist + $resultset = @dns_get_record($host_fqdn, $type_param); + + if (empty($resultset) || !is_array($resultset)) + { + return false; + } + else if ($type_param == DNS_ANY) + { + // $resultset is a non-empty array + return true; + } + + foreach ($resultset as $result) + { + if ( + isset($result['host']) && $result['host'] == $host && + isset($result['type']) && $result['type'] == $type + ) + { + return true; + } + } + + return false; + } + + // If we're on Windows we can still try to call nslookup via exec() as a last resort + if (DIRECTORY_SEPARATOR == '\\' && function_exists('exec')) + { + @exec('nslookup -type=' . escapeshellarg($type) . ' ' . escapeshellarg($host_fqdn), $output); + + // If output is empty, the nslookup failed + if (empty($output)) + { + return NULL; + } + + foreach ($output as $line) + { + $line = trim($line); + + if (empty($line)) + { + continue; + } + + // Squash tabs and multiple whitespaces to a single whitespace. + $line = preg_replace('/\s+/', ' ', $line); + + switch ($type) + { + case 'MX': + if (stripos($line, "$host MX") === 0) + { + return true; + } + break; + + case 'NS': + if (stripos($line, "$host nameserver") === 0) + { + return true; + } + break; + + case 'TXT': + if (stripos($line, "$host text") === 0) + { + return true; + } + break; + + case 'CNAME': + if (stripos($line, "$host canonical name") === 0) + { + return true; + } + break; + + default: + case 'AAAA': + // AAAA records returned by nslookup on Windows XP/2003 have this format. + // Later Windows versions use the A record format below for AAAA records. + if (stripos($line, "$host AAAA IPv6 address") === 0) + { + return true; + } + // No break + + case 'A': + if (!empty($host_matches)) + { + // Second line + if (stripos($line, "Address: ") === 0) + { + return true; + } + else + { + $host_matches = false; + } + } + else if (stripos($line, "Name: $host") === 0) + { + // First line + $host_matches = true; + } + break; + } + } + + return false; + } + + return NULL; +} + +// Handler, header and footer + +/** +* Error and message handler, call with trigger_error if read +*/ +function msg_handler($errno, $msg_text, $errfile, $errline) +{ + global $cache, $db, $auth, $template, $config, $user, $request; + global $phpbb_root_path, $msg_title, $msg_long_text, $phpbb_log; + + // Do not display notices if we suppress them via @ + if (error_reporting() == 0 && $errno != E_USER_ERROR && $errno != E_USER_WARNING && $errno != E_USER_NOTICE) + { + return; + } + + // Message handler is stripping text. In case we need it, we are possible to define long text... + if (isset($msg_long_text) && $msg_long_text && !$msg_text) + { + $msg_text = $msg_long_text; + } + + switch ($errno) + { + case E_NOTICE: + case E_WARNING: + + // Check the error reporting level and return if the error level does not match + // If DEBUG is defined the default level is E_ALL + if (($errno & ((defined('DEBUG')) ? E_ALL : error_reporting())) == 0) + { + return; + } + + if (strpos($errfile, 'cache') === false && strpos($errfile, 'template.') === false) + { + $errfile = phpbb_filter_root_path($errfile); + $msg_text = phpbb_filter_root_path($msg_text); + $error_name = ($errno === E_WARNING) ? 'PHP Warning' : 'PHP Notice'; + echo '[phpBB Debug] ' . $error_name . ': in file ' . $errfile . ' on line ' . $errline . ': ' . $msg_text . '
' . "\n"; + + // we are writing an image - the user won't see the debug, so let's place it in the log + if (defined('IMAGE_OUTPUT') || defined('IN_CRON')) + { + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_IMAGE_GENERATION_ERROR', false, array($errfile, $errline, $msg_text)); + } + // echo '

BACKTRACE
' . get_backtrace() . '
' . "\n"; + } + + return; + + break; + + case E_USER_ERROR: + + if (!empty($user) && $user->is_setup()) + { + $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; + $msg_title = (!isset($msg_title)) ? $user->lang['GENERAL_ERROR'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title); + + $l_return_index = sprintf($user->lang['RETURN_INDEX'], '', ''); + $l_notify = ''; + + if (!empty($config['board_contact'])) + { + $l_notify = '

' . sprintf($user->lang['NOTIFY_ADMIN_EMAIL'], $config['board_contact']) . '

'; + } + } + else + { + $msg_title = 'General Error'; + $l_return_index = 'Return to index page'; + $l_notify = ''; + + if (!empty($config['board_contact'])) + { + $l_notify = '

Please notify the board administrator or webmaster: ' . $config['board_contact'] . '

'; + } + } + + $log_text = $msg_text; + $backtrace = get_backtrace(); + if ($backtrace) + { + $log_text .= '

BACKTRACE
' . $backtrace; + } + + if (defined('IN_INSTALL') || defined('DEBUG') || isset($auth) && $auth->acl_get('a_')) + { + $msg_text = $log_text; + + // If this is defined there already was some output + // So let's not break it + if (defined('IN_DB_UPDATE')) + { + echo '
' . $msg_text . '
'; + + $db->sql_return_on_error(true); + phpbb_end_update($cache, $config); + } + } + + if ((defined('IN_CRON') || defined('IMAGE_OUTPUT')) && isset($db)) + { + // let's avoid loops + $db->sql_return_on_error(true); + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_GENERAL_ERROR', false, array($msg_title, $log_text)); + $db->sql_return_on_error(false); + } + + // Do not send 200 OK, but service unavailable on errors + send_status_line(503, 'Service Unavailable'); + + garbage_collection(); + + // Try to not call the adm page data... + + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '' . $msg_title . ''; + echo ''; + echo ''; + echo ''; + echo '
'; + echo ' '; + echo '
'; + echo '
'; + echo '
'; + echo '

' . $msg_title . '

'; + + echo '
' . $msg_text . '
'; + + echo $l_notify; + + echo '
'; + echo '
'; + echo '
'; + echo ' '; + echo '
'; + echo ''; + echo ''; + + exit_handler(); + + // On a fatal error (and E_USER_ERROR *is* fatal) we never want other scripts to continue and force an exit here. + exit; + break; + + case E_USER_WARNING: + case E_USER_NOTICE: + + define('IN_ERROR_HANDLER', true); + + if (empty($user->data)) + { + $user->session_begin(); + } + + // We re-init the auth array to get correct results on login/logout + $auth->acl($user->data); + + if (!$user->is_setup()) + { + $user->setup(); + } + + if ($msg_text == 'ERROR_NO_ATTACHMENT' || $msg_text == 'NO_FORUM' || $msg_text == 'NO_TOPIC' || $msg_text == 'NO_USER') + { + send_status_line(404, 'Not Found'); + } + + $msg_text = (!empty($user->lang[$msg_text])) ? $user->lang[$msg_text] : $msg_text; + $msg_title = (!isset($msg_title)) ? $user->lang['INFORMATION'] : ((!empty($user->lang[$msg_title])) ? $user->lang[$msg_title] : $msg_title); + + if (!defined('HEADER_INC')) + { + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_header($msg_title); + } + else + { + page_header($msg_title); + } + } + + $template->set_filenames(array( + 'body' => 'message_body.html') + ); + + $template->assign_vars(array( + 'MESSAGE_TITLE' => $msg_title, + 'MESSAGE_TEXT' => $msg_text, + 'S_USER_WARNING' => ($errno == E_USER_WARNING) ? true : false, + 'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false) + ); + + if ($request->is_ajax()) + { + global $refresh_data; + + $json_response = new \phpbb\json_response; + $json_response->send(array( + 'MESSAGE_TITLE' => $msg_title, + 'MESSAGE_TEXT' => $msg_text, + 'S_USER_WARNING' => ($errno == E_USER_WARNING) ? true : false, + 'S_USER_NOTICE' => ($errno == E_USER_NOTICE) ? true : false, + 'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null + )); + } + + // We do not want the cron script to be called on error messages + define('IN_CRON', true); + + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_footer(); + } + else + { + page_footer(); + } + + exit_handler(); + break; + + // PHP4 compatibility + case E_DEPRECATED: + return true; + break; + } + + // If we notice an error not handled here we pass this back to PHP by returning false + // This may not work for all php versions + return false; +} + +/** +* Removes absolute path to phpBB root directory from error messages +* and converts backslashes to forward slashes. +* +* @param string $errfile Absolute file path +* (e.g. /var/www/phpbb3/phpBB/includes/functions.php) +* Please note that if $errfile is outside of the phpBB root, +* the root path will not be found and can not be filtered. +* @return string Relative file path +* (e.g. /includes/functions.php) +*/ +function phpbb_filter_root_path($errfile) +{ + global $phpbb_filesystem; + + static $root_path; + + if (empty($root_path)) + { + if ($phpbb_filesystem) + { + $root_path = $phpbb_filesystem->realpath(dirname(__FILE__) . '/../'); + } + else + { + $filesystem = new \phpbb\filesystem\filesystem(); + $root_path = $filesystem->realpath(dirname(__FILE__) . '/../'); + } + } + + return str_replace(array($root_path, '\\'), array('[ROOT]', '/'), $errfile); +} + +/** +* Queries the session table to get information about online guests +* @param int $item_id Limits the search to the item with this id +* @param string $item The name of the item which is stored in the session table as session_{$item}_id +* @return int The number of active distinct guest sessions +*/ +function obtain_guest_count($item_id = 0, $item = 'forum') +{ + global $db, $config; + + if ($item_id) + { + $reading_sql = ' AND s.session_' . $item . '_id = ' . (int) $item_id; + } + else + { + $reading_sql = ''; + } + $time = (time() - (intval($config['load_online_time']) * 60)); + + // Get number of online guests + + if ($db->get_sql_layer() === 'sqlite3') + { + $sql = 'SELECT COUNT(session_ip) as num_guests + FROM ( + SELECT DISTINCT s.session_ip + FROM ' . SESSIONS_TABLE . ' s + WHERE s.session_user_id = ' . ANONYMOUS . ' + AND s.session_time >= ' . ($time - ((int) ($time % 60))) . + $reading_sql . + ')'; + } + else + { + $sql = 'SELECT COUNT(DISTINCT s.session_ip) as num_guests + FROM ' . SESSIONS_TABLE . ' s + WHERE s.session_user_id = ' . ANONYMOUS . ' + AND s.session_time >= ' . ($time - ((int) ($time % 60))) . + $reading_sql; + } + $result = $db->sql_query($sql); + $guests_online = (int) $db->sql_fetchfield('num_guests'); + $db->sql_freeresult($result); + + return $guests_online; +} + +/** +* Queries the session table to get information about online users +* @param int $item_id Limits the search to the item with this id +* @param string $item The name of the item which is stored in the session table as session_{$item}_id +* @return array An array containing the ids of online, hidden and visible users, as well as statistical info +*/ +function obtain_users_online($item_id = 0, $item = 'forum') +{ + global $db, $config; + + $reading_sql = ''; + if ($item_id !== 0) + { + $reading_sql = ' AND s.session_' . $item . '_id = ' . (int) $item_id; + } + + $online_users = array( + 'online_users' => array(), + 'hidden_users' => array(), + 'total_online' => 0, + 'visible_online' => 0, + 'hidden_online' => 0, + 'guests_online' => 0, + ); + + if ($config['load_online_guests']) + { + $online_users['guests_online'] = obtain_guest_count($item_id, $item); + } + + // a little discrete magic to cache this for 30 seconds + $time = (time() - (intval($config['load_online_time']) * 60)); + + $sql = 'SELECT s.session_user_id, s.session_ip, s.session_viewonline + FROM ' . SESSIONS_TABLE . ' s + WHERE s.session_time >= ' . ($time - ((int) ($time % 30))) . + $reading_sql . + ' AND s.session_user_id <> ' . ANONYMOUS; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + // Skip multiple sessions for one user + if (!isset($online_users['online_users'][$row['session_user_id']])) + { + $online_users['online_users'][$row['session_user_id']] = (int) $row['session_user_id']; + if ($row['session_viewonline']) + { + $online_users['visible_online']++; + } + else + { + $online_users['hidden_users'][$row['session_user_id']] = (int) $row['session_user_id']; + $online_users['hidden_online']++; + } + } + } + $online_users['total_online'] = $online_users['guests_online'] + $online_users['visible_online'] + $online_users['hidden_online']; + $db->sql_freeresult($result); + + return $online_users; +} + +/** +* Uses the result of obtain_users_online to generate a localized, readable representation. +* @param mixed $online_users result of obtain_users_online - array with user_id lists for total, hidden and visible users, and statistics +* @param int $item_id Indicate that the data is limited to one item and not global +* @param string $item The name of the item which is stored in the session table as session_{$item}_id +* @return array An array containing the string for output to the template +*/ +function obtain_users_online_string($online_users, $item_id = 0, $item = 'forum') +{ + global $config, $db, $user, $auth, $phpbb_dispatcher; + + $user_online_link = $rowset = array(); + // Need caps version of $item for language-strings + $item_caps = strtoupper($item); + + if (count($online_users['online_users'])) + { + $sql_ary = array( + 'SELECT' => 'u.username, u.username_clean, u.user_id, u.user_type, u.user_allow_viewonline, u.user_colour', + 'FROM' => array( + USERS_TABLE => 'u', + ), + 'WHERE' => $db->sql_in_set('u.user_id', $online_users['online_users']), + 'ORDER_BY' => 'u.username_clean ASC', + ); + + /** + * Modify SQL query to obtain online users data + * + * @event core.obtain_users_online_string_sql + * @var array online_users Array with online users data + * from obtain_users_online() + * @var int item_id Restrict online users to item id + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var array sql_ary SQL query array to obtain users online data + * @since 3.1.4-RC1 + * @changed 3.1.7-RC1 Change sql query into array and adjust var accordingly. Allows extension authors the ability to adjust the sql_ary. + */ + $vars = array('online_users', 'item_id', 'item', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + $rowset = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + foreach ($rowset as $row) + { + // User is logged in and therefore not a guest + if ($row['user_id'] != ANONYMOUS) + { + if (isset($online_users['hidden_users'][$row['user_id']])) + { + $row['username'] = '' . $row['username'] . ''; + } + + if (!isset($online_users['hidden_users'][$row['user_id']]) || $auth->acl_get('u_viewonline') || $row['user_id'] === $user->data['user_id']) + { + $user_online_link[$row['user_id']] = get_username_string(($row['user_type'] <> USER_IGNORE) ? 'full' : 'no_profile', $row['user_id'], $row['username'], $row['user_colour']); + } + } + } + } + + /** + * Modify online userlist data + * + * @event core.obtain_users_online_string_before_modify + * @var array online_users Array with online users data + * from obtain_users_online() + * @var int item_id Restrict online users to item id + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var array rowset Array with online users data + * @var array user_online_link Array with online users items (usernames) + * @since 3.1.10-RC1 + */ + $vars = array( + 'online_users', + 'item_id', + 'item', + 'rowset', + 'user_online_link', + ); + extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_before_modify', compact($vars))); + + $online_userlist = implode(', ', $user_online_link); + + if (!$online_userlist) + { + $online_userlist = $user->lang['NO_ONLINE_USERS']; + } + + if ($item_id === 0) + { + $online_userlist = $user->lang['REGISTERED_USERS'] . ' ' . $online_userlist; + } + else if ($config['load_online_guests']) + { + $online_userlist = $user->lang('BROWSING_' . $item_caps . '_GUESTS', $online_users['guests_online'], $online_userlist); + } + else + { + $online_userlist = sprintf($user->lang['BROWSING_' . $item_caps], $online_userlist); + } + // Build online listing + $visible_online = $user->lang('REG_USERS_TOTAL', (int) $online_users['visible_online']); + $hidden_online = $user->lang('HIDDEN_USERS_TOTAL', (int) $online_users['hidden_online']); + + if ($config['load_online_guests']) + { + $guests_online = $user->lang('GUEST_USERS_TOTAL', (int) $online_users['guests_online']); + $l_online_users = $user->lang('ONLINE_USERS_TOTAL_GUESTS', (int) $online_users['total_online'], $visible_online, $hidden_online, $guests_online); + } + else + { + $l_online_users = $user->lang('ONLINE_USERS_TOTAL', (int) $online_users['total_online'], $visible_online, $hidden_online); + } + + /** + * Modify online userlist data + * + * @event core.obtain_users_online_string_modify + * @var array online_users Array with online users data + * from obtain_users_online() + * @var int item_id Restrict online users to item id + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var array rowset Array with online users data + * @var array user_online_link Array with online users items (usernames) + * @var string online_userlist String containing users online list + * @var string l_online_users String with total online users count info + * @since 3.1.4-RC1 + */ + $vars = array( + 'online_users', + 'item_id', + 'item', + 'rowset', + 'user_online_link', + 'online_userlist', + 'l_online_users', + ); + extract($phpbb_dispatcher->trigger_event('core.obtain_users_online_string_modify', compact($vars))); + + return array( + 'online_userlist' => $online_userlist, + 'l_online_users' => $l_online_users, + ); +} + +/** +* Get option bitfield from custom data +* +* @param int $bit The bit/value to get +* @param int $data Current bitfield to check +* @return bool Returns true if value of constant is set in bitfield, else false +*/ +function phpbb_optionget($bit, $data) +{ + return ($data & 1 << (int) $bit) ? true : false; +} + +/** +* Set option bitfield +* +* @param int $bit The bit/value to set/unset +* @param bool $set True if option should be set, false if option should be unset. +* @param int $data Current bitfield to change +* +* @return int The new bitfield +*/ +function phpbb_optionset($bit, $set, $data) +{ + if ($set && !($data & 1 << $bit)) + { + $data += 1 << $bit; + } + else if (!$set && ($data & 1 << $bit)) + { + $data -= 1 << $bit; + } + + return $data; +} + +/** +* Login using http authenticate. +* +* @param array $param Parameter array, see $param_defaults array. +* +* @return null +*/ +function phpbb_http_login($param) +{ + global $auth, $user, $request; + global $config; + + $param_defaults = array( + 'auth_message' => '', + + 'autologin' => false, + 'viewonline' => true, + 'admin' => false, + ); + + // Overwrite default values with passed values + $param = array_merge($param_defaults, $param); + + // User is already logged in + // We will not overwrite his session + if (!empty($user->data['is_registered'])) + { + return; + } + + // $_SERVER keys to check + $username_keys = array( + 'PHP_AUTH_USER', + 'Authorization', + 'REMOTE_USER', 'REDIRECT_REMOTE_USER', + 'HTTP_AUTHORIZATION', 'REDIRECT_HTTP_AUTHORIZATION', + 'REMOTE_AUTHORIZATION', 'REDIRECT_REMOTE_AUTHORIZATION', + 'AUTH_USER', + ); + + $password_keys = array( + 'PHP_AUTH_PW', + 'REMOTE_PASSWORD', + 'AUTH_PASSWORD', + ); + + $username = null; + foreach ($username_keys as $k) + { + if ($request->is_set($k, \phpbb\request\request_interface::SERVER)) + { + $username = htmlspecialchars_decode($request->server($k)); + break; + } + } + + $password = null; + foreach ($password_keys as $k) + { + if ($request->is_set($k, \phpbb\request\request_interface::SERVER)) + { + $password = htmlspecialchars_decode($request->server($k)); + break; + } + } + + // Decode encoded information (IIS, CGI, FastCGI etc.) + if (!is_null($username) && is_null($password) && strpos($username, 'Basic ') === 0) + { + list($username, $password) = explode(':', base64_decode(substr($username, 6)), 2); + } + + if (!is_null($username) && !is_null($password)) + { + set_var($username, $username, 'string', true); + set_var($password, $password, 'string', true); + + $auth_result = $auth->login($username, $password, $param['autologin'], $param['viewonline'], $param['admin']); + + if ($auth_result['status'] == LOGIN_SUCCESS) + { + return; + } + else if ($auth_result['status'] == LOGIN_ERROR_ATTEMPTS) + { + send_status_line(401, 'Unauthorized'); + + trigger_error('NOT_AUTHORISED'); + } + } + + // Prepend sitename to auth_message + $param['auth_message'] = ($param['auth_message'] === '') ? $config['sitename'] : $config['sitename'] . ' - ' . $param['auth_message']; + + // We should probably filter out non-ASCII characters - RFC2616 + $param['auth_message'] = preg_replace('/[\x80-\xFF]/', '?', $param['auth_message']); + + header('WWW-Authenticate: Basic realm="' . $param['auth_message'] . '"'); + send_status_line(401, 'Unauthorized'); + + trigger_error('NOT_AUTHORISED'); +} + +/** +* Escapes and quotes a string for use as an HTML/XML attribute value. +* +* This is a port of Python xml.sax.saxutils quoteattr. +* +* The function will attempt to choose a quote character in such a way as to +* avoid escaping quotes in the string. If this is not possible the string will +* be wrapped in double quotes and double quotes will be escaped. +* +* @param string $data The string to be escaped +* @param array $entities Associative array of additional entities to be escaped +* @return string Escaped and quoted string +*/ +function phpbb_quoteattr($data, $entities = null) +{ + $data = str_replace('&', '&', $data); + $data = str_replace('>', '>', $data); + $data = str_replace('<', '<', $data); + + $data = str_replace("\n", ' ', $data); + $data = str_replace("\r", ' ', $data); + $data = str_replace("\t", ' ', $data); + + if (!empty($entities)) + { + $data = str_replace(array_keys($entities), array_values($entities), $data); + } + + if (strpos($data, '"') !== false) + { + if (strpos($data, "'") !== false) + { + $data = '"' . str_replace('"', '"', $data) . '"'; + } + else + { + $data = "'" . $data . "'"; + } + } + else + { + $data = '"' . $data . '"'; + } + + return $data; +} + +/** +* Converts query string (GET) parameters in request into hidden fields. +* +* Useful for forwarding GET parameters when submitting forms with GET method. +* +* It is possible to omit some of the GET parameters, which is useful if +* they are specified in the form being submitted. +* +* sid is always omitted. +* +* @param \phpbb\request\request $request Request object +* @param array $exclude A list of variable names that should not be forwarded +* @return string HTML with hidden fields +*/ +function phpbb_build_hidden_fields_for_query_params($request, $exclude = null) +{ + $names = $request->variable_names(\phpbb\request\request_interface::GET); + $hidden = ''; + foreach ($names as $name) + { + // Sessions are dealt with elsewhere, omit sid always + if ($name == 'sid') + { + continue; + } + + // Omit any additional parameters requested + if (!empty($exclude) && in_array($name, $exclude)) + { + continue; + } + + $escaped_name = phpbb_quoteattr($name); + + // Note: we might retrieve the variable from POST or cookies + // here. To avoid exposing cookies, skip variables that are + // overwritten somewhere other than GET entirely. + $value = $request->variable($name, '', true); + $get_value = $request->variable($name, '', true, \phpbb\request\request_interface::GET); + if ($value === $get_value) + { + $escaped_value = phpbb_quoteattr($value); + $hidden .= ""; + } + } + return $hidden; +} + +/** +* Get user avatar +* +* @param array $user_row Row from the users table +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar html +*/ +function phpbb_get_user_avatar($user_row, $alt = 'USER_AVATAR', $ignore_config = false, $lazy = false) +{ + $row = \phpbb\avatar\manager::clean_row($user_row, 'user'); + return phpbb_get_avatar($row, $alt, $ignore_config, $lazy); +} + +/** +* Get group avatar +* +* @param array $group_row Row from the groups table +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar html +*/ +function phpbb_get_group_avatar($user_row, $alt = 'GROUP_AVATAR', $ignore_config = false, $lazy = false) +{ + $row = \phpbb\avatar\manager::clean_row($user_row, 'group'); + return phpbb_get_avatar($row, $alt, $ignore_config, $lazy); +} + +/** +* Get avatar +* +* @param array $row Row cleaned by \phpbb\avatar\manager::clean_row +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar html +*/ +function phpbb_get_avatar($row, $alt, $ignore_config = false, $lazy = false) +{ + global $user, $config; + global $phpbb_container, $phpbb_dispatcher; + + if (!$config['allow_avatar'] && !$ignore_config) + { + return ''; + } + + $avatar_data = array( + 'src' => $row['avatar'], + 'width' => $row['avatar_width'], + 'height' => $row['avatar_height'], + ); + + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + $driver = $phpbb_avatar_manager->get_driver($row['avatar_type'], !$ignore_config); + $html = ''; + + if ($driver) + { + $html = $driver->get_custom_html($user, $row, $alt); + $avatar_data = $driver->get_data($row); + } + else + { + $avatar_data['src'] = ''; + } + + if (empty($html) && !empty($avatar_data['src'])) + { + if ($lazy) + { + // Determine board url - we may need it later + $board_url = generate_board_url() . '/'; + // This path is sent with the base template paths in the assign_vars() + // call below. We need to correct it in case we are accessing from a + // controller because the web paths will be incorrect otherwise. + $phpbb_path_helper = $phpbb_container->get('path_helper'); + $corrected_path = $phpbb_path_helper->get_web_root_path(); + + $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path; + + $theme = "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme'; + + $src = 'src="' . $theme . '/images/no_avatar.gif" data-src="' . $avatar_data['src'] . '"'; + } + else + { + $src = 'src="' . $avatar_data['src'] . '"'; + } + + $html = ''; + } + + /** + * Event to modify HTML tag of avatar + * + * @event core.get_avatar_after + * @var array row Row cleaned by \phpbb\avatar\manager::clean_row + * @var string alt Optional language string for alt tag within image, can be a language key or text + * @var bool ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP + * @var array avatar_data The HTML attributes for avatar tag + * @var string html The HTML tag of generated avatar + * @since 3.1.6-RC1 + */ + $vars = array('row', 'alt', 'ignore_config', 'avatar_data', 'html'); + extract($phpbb_dispatcher->trigger_event('core.get_avatar_after', compact($vars))); + + return $html; +} + +/** +* Generate page header +*/ +function page_header($page_title = '', $display_online_list = false, $item_id = 0, $item = 'forum', $send_headers = true) +{ + global $db, $config, $template, $SID, $_SID, $_EXTRA_URL, $user, $auth, $phpEx, $phpbb_root_path; + global $phpbb_dispatcher, $request, $phpbb_container, $phpbb_admin_path; + + if (defined('HEADER_INC')) + { + return; + } + + define('HEADER_INC', true); + + // A listener can set this variable to `true` when it overrides this function + $page_header_override = false; + + /** + * Execute code and/or overwrite page_header() + * + * @event core.page_header + * @var string page_title Page title + * @var bool display_online_list Do we display online users list + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var int item_id Restrict online users to item id + * @var bool page_header_override Shall we return instead of running + * the rest of page_header() + * @since 3.1.0-a1 + */ + $vars = array('page_title', 'display_online_list', 'item_id', 'item', 'page_header_override'); + extract($phpbb_dispatcher->trigger_event('core.page_header', compact($vars))); + + if ($page_header_override) + { + return; + } + + // gzip_compression + if ($config['gzip_compress']) + { + // to avoid partially compressed output resulting in blank pages in + // the browser or error messages, compression is disabled in a few cases: + // + // 1) if headers have already been sent, this indicates plaintext output + // has been started so further content must not be compressed + // 2) the length of the current output buffer is non-zero. This means + // there is already some uncompressed content in this output buffer + // so further output must not be compressed + // 3) if more than one level of output buffering is used because we + // cannot test all output buffer level content lengths. One level + // could be caused by php.ini output_buffering. Anything + // beyond that is manual, so the code wrapping phpBB in output buffering + // can easily compress the output itself. + // + if (@extension_loaded('zlib') && !headers_sent() && ob_get_level() <= 1 && ob_get_length() == 0) + { + ob_start('ob_gzhandler'); + } + } + + $user->update_session_infos(); + + // Generate logged in/logged out status + if ($user->data['user_id'] != ANONYMOUS) + { + $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout', true, $user->session_id); + $l_login_logout = $user->lang['LOGOUT']; + } + else + { + $u_login_logout = append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'); + $l_login_logout = $user->lang['LOGIN']; + } + + // Last visit date/time + $s_last_visit = ($user->data['user_id'] != ANONYMOUS) ? $user->format_date($user->data['session_last_visit']) : ''; + + // Get users online list ... if required + $l_online_users = $online_userlist = $l_online_record = $l_online_time = ''; + + if ($config['load_online'] && $config['load_online_time'] && $display_online_list) + { + /** + * Load online data: + * For obtaining another session column use $item and $item_id in the function-parameter, whereby the column is session_{$item}_id. + */ + $item_id = max($item_id, 0); + + $online_users = obtain_users_online($item_id, $item); + $user_online_strings = obtain_users_online_string($online_users, $item_id, $item); + + $l_online_users = $user_online_strings['l_online_users']; + $online_userlist = $user_online_strings['online_userlist']; + $total_online_users = $online_users['total_online']; + + if ($total_online_users > $config['record_online_users']) + { + $config->set('record_online_users', $total_online_users, false); + $config->set('record_online_date', time(), false); + } + + $l_online_record = $user->lang('RECORD_ONLINE_USERS', (int) $config['record_online_users'], $user->format_date($config['record_online_date'], false, true)); + + $l_online_time = $user->lang('VIEW_ONLINE_TIMES', (int) $config['load_online_time']); + } + + $s_privmsg_new = false; + + // Check for new private messages if user is logged in + if (!empty($user->data['is_registered'])) + { + if ($user->data['user_new_privmsg']) + { + if (!$user->data['user_last_privmsg'] || $user->data['user_last_privmsg'] > $user->data['session_last_visit']) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_last_privmsg = ' . $user->data['session_last_visit'] . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + + $s_privmsg_new = true; + } + else + { + $s_privmsg_new = false; + } + } + else + { + $s_privmsg_new = false; + } + } + + $forum_id = $request->variable('f', 0); + $topic_id = $request->variable('t', 0); + + $s_feed_news = false; + + // Get option for news + if ($config['feed_enable']) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0'); + $result = $db->sql_query_limit($sql, 1, 0, 600); + $s_feed_news = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + } + + // Determine board url - we may need it later + $board_url = generate_board_url() . '/'; + // This path is sent with the base template paths in the assign_vars() + // call below. We need to correct it in case we are accessing from a + // controller because the web paths will be incorrect otherwise. + /* @var $phpbb_path_helper \phpbb\path_helper */ + $phpbb_path_helper = $phpbb_container->get('path_helper'); + $corrected_path = $phpbb_path_helper->get_web_root_path(); + $web_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? $board_url : $corrected_path; + + // Send a proper content-language to the output + $user_lang = $user->lang['USER_LANG']; + if (strpos($user_lang, '-x-') !== false) + { + $user_lang = substr($user_lang, 0, strpos($user_lang, '-x-')); + } + + $s_search_hidden_fields = array(); + if ($_SID) + { + $s_search_hidden_fields['sid'] = $_SID; + } + + if (!empty($_EXTRA_URL)) + { + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; + } + } + + $dt = $user->create_datetime(); + $timezone_offset = $user->lang(array('timezones', 'UTC_OFFSET'), phpbb_format_timezone_offset($dt->getOffset())); + $timezone_name = $user->timezone->getName(); + if (isset($user->lang['timezones'][$timezone_name])) + { + $timezone_name = $user->lang['timezones'][$timezone_name]; + } + + // Output the notifications + $notifications = false; + if ($config['load_notifications'] && $config['allow_board_notifications'] && $user->data['user_id'] != ANONYMOUS && $user->data['user_type'] != USER_IGNORE) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $notifications = $phpbb_notifications->load_notifications('notification.method.board', array( + 'all_unread' => true, + 'limit' => 5, + )); + + foreach ($notifications['notifications'] as $notification) + { + $template->assign_block_vars('notifications', $notification->prepare_for_display()); + } + } + + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + $notification_mark_hash = generate_link_hash('mark_all_notifications_read'); + + $s_login_redirect = build_hidden_fields(array('redirect' => $phpbb_path_helper->remove_web_root_path(build_url()))); + /** + * Workaround for missing template variable in pre phpBB 3.2.6 styles. + * @deprecated 3.2.7 (To be removed: 3.3.0-a1) + */ + $form_token_login = $template->retrieve_var('S_FORM_TOKEN_LOGIN'); + if (!empty($form_token_login)) + { + $s_login_redirect .= $form_token_login; + // Remove S_FORM_TOKEN_LOGIN as it's already appended to S_LOGIN_REDIRECT + $template->assign_var('S_FORM_TOKEN_LOGIN', ''); + } + + // The following assigns all _common_ variables that may be used at any point in a template. + $template->assign_vars(array( + 'SITENAME' => $config['sitename'], + 'SITE_DESCRIPTION' => $config['site_desc'], + 'PAGE_TITLE' => $page_title, + 'SCRIPT_NAME' => str_replace('.' . $phpEx, '', $user->page['page_name']), + 'LAST_VISIT_DATE' => sprintf($user->lang['YOU_LAST_VISIT'], $s_last_visit), + 'LAST_VISIT_YOU' => $s_last_visit, + 'CURRENT_TIME' => sprintf($user->lang['CURRENT_TIME'], $user->format_date(time(), false, true)), + 'TOTAL_USERS_ONLINE' => $l_online_users, + 'LOGGED_IN_USER_LIST' => $online_userlist, + 'RECORD_USERS' => $l_online_record, + + 'PRIVATE_MESSAGE_COUNT' => (!empty($user->data['user_unread_privmsg'])) ? $user->data['user_unread_privmsg'] : 0, + 'CURRENT_USER_AVATAR' => phpbb_get_user_avatar($user->data), + 'CURRENT_USERNAME_SIMPLE' => get_username_string('no_profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), + 'CURRENT_USERNAME_FULL' => get_username_string('full', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), + 'UNREAD_NOTIFICATIONS_COUNT' => ($notifications !== false) ? $notifications['unread_count'] : '', + 'NOTIFICATIONS_COUNT' => ($notifications !== false) ? $notifications['unread_count'] : '', + 'U_VIEW_ALL_NOTIFICATIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_notifications'), + 'U_MARK_ALL_NOTIFICATIONS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_notifications&mode=notification_list&mark=all&token=' . $notification_mark_hash), + 'U_NOTIFICATION_SETTINGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_notifications&mode=notification_options'), + 'S_NOTIFICATIONS_DISPLAY' => $config['load_notifications'] && $config['allow_board_notifications'], + + 'S_USER_NEW_PRIVMSG' => $user->data['user_new_privmsg'], + 'S_USER_UNREAD_PRIVMSG' => $user->data['user_unread_privmsg'], + 'S_USER_NEW' => $user->data['user_new'], + + 'SID' => $SID, + '_SID' => $_SID, + 'SESSION_ID' => $user->session_id, + 'ROOT_PATH' => $web_path, + 'BOARD_URL' => $board_url, + + 'L_LOGIN_LOGOUT' => $l_login_logout, + 'L_INDEX' => ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['FORUM_INDEX'], + 'L_SITE_HOME' => ($config['site_home_text'] !== '') ? $config['site_home_text'] : $user->lang['HOME'], + 'L_ONLINE_EXPLAIN' => $l_online_time, + + 'U_PRIVATEMSGS' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'), + 'U_RETURN_INBOX' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'), + 'U_MEMBERLIST' => append_sid("{$phpbb_root_path}memberlist.$phpEx"), + 'U_VIEWONLINE' => ($auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) ? append_sid("{$phpbb_root_path}viewonline.$phpEx") : '', + 'U_LOGIN_LOGOUT' => $u_login_logout, + 'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"), + 'U_SEARCH' => append_sid("{$phpbb_root_path}search.$phpEx"), + 'U_SITE_HOME' => $config['site_home_url'], + 'U_REGISTER' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), + 'U_PROFILE' => append_sid("{$phpbb_root_path}ucp.$phpEx"), + 'U_USER_PROFILE' => get_username_string('profile', $user->data['user_id'], $user->data['username'], $user->data['user_colour']), + 'U_MODCP' => append_sid("{$phpbb_root_path}mcp.$phpEx", false, true, $user->session_id), + 'U_FAQ' => $controller_helper->route('phpbb_help_faq_controller'), + 'U_SEARCH_SELF' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=egosearch'), + 'U_SEARCH_NEW' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=newposts'), + 'U_SEARCH_UNANSWERED' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unanswered'), + 'U_SEARCH_UNREAD' => append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=unreadposts'), + 'U_SEARCH_ACTIVE_TOPICS'=> append_sid("{$phpbb_root_path}search.$phpEx", 'search_id=active_topics'), + 'U_DELETE_COOKIES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=delete_cookies'), + 'U_CONTACT_US' => ($config['contact_admin_form_enable'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin') : '', + 'U_TEAM' => (!$auth->acl_get('u_viewprofile')) ? '' : append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=team'), + 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), + 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), + 'UA_PRIVACY' => addslashes(append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy')), + 'U_RESTORE_PERMISSIONS' => ($user->data['user_perm_from'] && $auth->acl_get('a_switchperm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=restore_perm') : '', + 'U_FEED' => $controller_helper->route('phpbb_feed_index'), + + 'S_USER_LOGGED_IN' => ($user->data['user_id'] != ANONYMOUS) ? true : false, + 'S_AUTOLOGIN_ENABLED' => ($config['allow_autologin']) ? true : false, + 'S_BOARD_DISABLED' => ($config['board_disable']) ? true : false, + 'S_REGISTERED_USER' => (!empty($user->data['is_registered'])) ? true : false, + 'S_IS_BOT' => (!empty($user->data['is_bot'])) ? true : false, + 'S_USER_LANG' => $user_lang, + 'S_USER_BROWSER' => (isset($user->data['session_browser'])) ? $user->data['session_browser'] : $user->lang['UNKNOWN_BROWSER'], + 'S_USERNAME' => $user->data['username'], + 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], + 'S_CONTENT_FLOW_BEGIN' => ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_TIMEZONE' => sprintf($user->lang['ALL_TIMES'], $timezone_offset, $timezone_name), + 'S_DISPLAY_ONLINE_LIST' => ($l_online_time) ? 1 : 0, + 'S_DISPLAY_SEARCH' => (!$config['load_search']) ? 0 : (isset($auth) ? ($auth->acl_get('u_search') && $auth->acl_getf_global('f_search')) : 1), + 'S_DISPLAY_PM' => ($config['allow_privmsg'] && !empty($user->data['is_registered']) && ($auth->acl_get('u_readpm') || $auth->acl_get('u_sendpm'))) ? true : false, + 'S_DISPLAY_MEMBERLIST' => (isset($auth)) ? $auth->acl_get('u_viewprofile') : 0, + 'S_NEW_PM' => ($s_privmsg_new) ? 1 : 0, + 'S_REGISTER_ENABLED' => ($config['require_activation'] != USER_ACTIVATION_DISABLE) ? true : false, + 'S_FORUM_ID' => $forum_id, + 'S_TOPIC_ID' => $topic_id, + + 'S_LOGIN_ACTION' => ((!defined('ADMIN_START')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login') : append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id)), + 'S_LOGIN_REDIRECT' => $s_login_redirect, + + 'S_ENABLE_FEEDS' => ($config['feed_enable']) ? true : false, + 'S_ENABLE_FEEDS_OVERALL' => ($config['feed_overall']) ? true : false, + 'S_ENABLE_FEEDS_FORUMS' => ($config['feed_overall_forums']) ? true : false, + 'S_ENABLE_FEEDS_TOPICS' => ($config['feed_topics_new']) ? true : false, + 'S_ENABLE_FEEDS_TOPICS_ACTIVE' => ($config['feed_topics_active']) ? true : false, + 'S_ENABLE_FEEDS_NEWS' => ($s_feed_news) ? true : false, + + 'S_LOAD_UNREADS' => ($config['load_unreads_search'] && ($config['load_anon_lastread'] || $user->data['is_registered'])) ? true : false, + + 'S_SEARCH_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), + + 'T_ASSETS_VERSION' => $config['assets_version'], + 'T_ASSETS_PATH' => "{$web_path}assets", + 'T_THEME_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme', + 'T_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template', + 'T_SUPER_TEMPLATE_PATH' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/template', + 'T_IMAGES_PATH' => "{$web_path}images/", + 'T_SMILIES_PATH' => "{$web_path}{$config['smilies_path']}/", + 'T_AVATAR_PATH' => "{$web_path}{$config['avatar_path']}/", + 'T_AVATAR_GALLERY_PATH' => "{$web_path}{$config['avatar_gallery_path']}/", + 'T_ICONS_PATH' => "{$web_path}{$config['icons_path']}/", + 'T_RANKS_PATH' => "{$web_path}{$config['ranks_path']}/", + 'T_UPLOAD_PATH' => "{$web_path}{$config['upload_path']}/", + 'T_STYLESHEET_LINK' => "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/stylesheet.css?assets_version=' . $config['assets_version'], + 'T_STYLESHEET_LANG_LINK'=> "{$web_path}styles/" . rawurlencode($user->style['style_path']) . '/theme/' . $user->lang_name . '/stylesheet.css?assets_version=' . $config['assets_version'], + 'T_FONT_AWESOME_LINK' => !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$web_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'], + 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$web_path}assets/javascript/jquery.min.js?assets_version=" . $config['assets_version'], + 'S_ALLOW_CDN' => !empty($config['allow_cdn']), + 'S_COOKIE_NOTICE' => !empty($config['cookie_notice']), + + 'T_THEME_NAME' => rawurlencode($user->style['style_path']), + 'T_THEME_LANG_NAME' => $user->lang_name, + 'T_TEMPLATE_NAME' => $user->style['style_path'], + 'T_SUPER_TEMPLATE_NAME' => rawurlencode((isset($user->style['style_parent_tree']) && $user->style['style_parent_tree']) ? $user->style['style_parent_tree'] : $user->style['style_path']), + 'T_IMAGES' => 'images', + 'T_SMILIES' => $config['smilies_path'], + 'T_AVATAR' => $config['avatar_path'], + 'T_AVATAR_GALLERY' => $config['avatar_gallery_path'], + 'T_ICONS' => $config['icons_path'], + 'T_RANKS' => $config['ranks_path'], + 'T_UPLOAD' => $config['upload_path'], + + 'SITE_LOGO_IMG' => $user->img('site_logo'), + )); + + $http_headers = array(); + + if ($send_headers) + { + // An array of http headers that phpbb will set. The following event may override these. + $http_headers += array( + // application/xhtml+xml not used because of IE + 'Content-type' => 'text/html; charset=UTF-8', + 'Cache-Control' => 'private, no-cache="set-cookie"', + 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', + ); + if (!empty($user->data['is_bot'])) + { + // Let reverse proxies know we detected a bot. + $http_headers['X-PHPBB-IS-BOT'] = 'yes'; + } + } + + /** + * Execute code and/or overwrite _common_ template variables after they have been assigned. + * + * @event core.page_header_after + * @var string page_title Page title + * @var bool display_online_list Do we display online users list + * @var string item Restrict online users to a certain + * session item, e.g. forum for + * session_forum_id + * @var int item_id Restrict online users to item id + * @var array http_headers HTTP headers that should be set by phpbb + * + * @since 3.1.0-b3 + */ + $vars = array('page_title', 'display_online_list', 'item_id', 'item', 'http_headers'); + extract($phpbb_dispatcher->trigger_event('core.page_header_after', compact($vars))); + + foreach ($http_headers as $hname => $hval) + { + header((string) $hname . ': ' . (string) $hval); + } + + return; +} + +/** +* Check and display the SQL report if requested. +* +* @param \phpbb\request\request_interface $request Request object +* @param \phpbb\auth\auth $auth Auth object +* @param \phpbb\db\driver\driver_interface $db Database connection +*/ +function phpbb_check_and_display_sql_report(\phpbb\request\request_interface $request, \phpbb\auth\auth $auth, \phpbb\db\driver\driver_interface $db) +{ + if ($request->variable('explain', false) && $auth->acl_get('a_') && defined('DEBUG')) + { + $db->sql_report('display'); + } +} + +/** +* Generate the debug output string +* +* @param \phpbb\db\driver\driver_interface $db Database connection +* @param \phpbb\config\config $config Config object +* @param \phpbb\auth\auth $auth Auth object +* @param \phpbb\user $user User object +* @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher +* @return string +*/ +function phpbb_generate_debug_output(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\user $user, \phpbb\event\dispatcher_interface $phpbb_dispatcher) +{ + $debug_info = array(); + + // Output page creation time + if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + if (isset($GLOBALS['starttime'])) + { + $totaltime = microtime(true) - $GLOBALS['starttime']; + $debug_info[] = sprintf('Time: %.3fs', $db->get_sql_time(), ($totaltime - $db->get_sql_time()), $totaltime); + } + + $debug_info[] = sprintf('Queries: %d', $db->sql_num_queries(true), $db->sql_num_queries()); + + $memory_usage = memory_get_peak_usage(); + if ($memory_usage) + { + $memory_usage = get_formatted_filesize($memory_usage); + + $debug_info[] = 'Peak Memory Usage: ' . $memory_usage; + } + } + + if (defined('DEBUG')) + { + $debug_info[] = 'GZIP: ' . (($config['gzip_compress'] && @extension_loaded('zlib')) ? 'On' : 'Off'); + + if ($user->load) + { + $debug_info[] = 'Load: ' . $user->load; + } + + if ($auth->acl_get('a_')) + { + $debug_info[] = 'SQL Explain'; + } + } + + /** + * Modify debug output information + * + * @event core.phpbb_generate_debug_output + * @var array debug_info Array of strings with debug information + * + * @since 3.1.0-RC3 + */ + $vars = array('debug_info'); + extract($phpbb_dispatcher->trigger_event('core.phpbb_generate_debug_output', compact($vars))); + + return implode(' | ', $debug_info); +} + +/** +* Generate page footer +* +* @param bool $run_cron Whether or not to run the cron +* @param bool $display_template Whether or not to display the template +* @param bool $exit_handler Whether or not to run the exit_handler() +*/ +function page_footer($run_cron = true, $display_template = true, $exit_handler = true) +{ + global $db, $config, $template, $user, $auth, $cache, $phpEx; + global $request, $phpbb_dispatcher, $phpbb_admin_path; + + // A listener can set this variable to `true` when it overrides this function + $page_footer_override = false; + + /** + * Execute code and/or overwrite page_footer() + * + * @event core.page_footer + * @var bool run_cron Shall we run cron tasks + * @var bool page_footer_override Shall we return instead of running + * the rest of page_footer() + * @since 3.1.0-a1 + */ + $vars = array('run_cron', 'page_footer_override'); + extract($phpbb_dispatcher->trigger_event('core.page_footer', compact($vars))); + + if ($page_footer_override) + { + return; + } + + phpbb_check_and_display_sql_report($request, $auth, $db); + + $template->assign_vars(array( + 'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher), + 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', + 'CREDIT_LINE' => $user->lang('POWERED_BY', 'phpBB® Forum Software © phpBB Limited'), + + 'U_ACP' => ($auth->acl_get('a_') && !empty($user->data['is_registered'])) ? append_sid("{$phpbb_admin_path}index.$phpEx", false, true, $user->session_id) : '') + ); + + // Call cron-type script + $call_cron = false; + if (!defined('IN_CRON') && !$config['use_system_cron'] && $run_cron && !$config['board_disable'] && !$user->data['is_bot'] && !$cache->get('_cron.lock_check')) + { + $call_cron = true; + $time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time(); + + // Any old lock present? + if (!empty($config['cron_lock'])) + { + $cron_time = explode(' ', $config['cron_lock']); + + // If 1 hour lock is present we do not call cron.php + if ($cron_time[0] + 3600 >= $time_now) + { + $call_cron = false; + } + } + } + + // Call cron job? + if ($call_cron) + { + global $phpbb_container; + + /* @var $cron \phpbb\cron\manager */ + $cron = $phpbb_container->get('cron.manager'); + $task = $cron->find_one_ready_task(); + + if ($task) + { + $url = $task->get_url(); + $template->assign_var('RUN_CRON_TASK', 'cron'); + } + else + { + $cache->put('_cron.lock_check', true, 60); + } + } + + /** + * Execute code and/or modify output before displaying the template. + * + * @event core.page_footer_after + * @var bool display_template Whether or not to display the template + * @var bool exit_handler Whether or not to run the exit_handler() + * + * @since 3.1.0-RC5 + */ + $vars = array('display_template', 'exit_handler'); + extract($phpbb_dispatcher->trigger_event('core.page_footer_after', compact($vars))); + + if ($display_template) + { + $template->display('body'); + } + + garbage_collection(); + + if ($exit_handler) + { + exit_handler(); + } +} + +/** +* Closing the cache object and the database +* Cool function name, eh? We might want to add operations to it later +*/ +function garbage_collection() +{ + global $cache, $db; + global $phpbb_dispatcher; + + if (!empty($phpbb_dispatcher)) + { + /** + * Unload some objects, to free some memory, before we finish our task + * + * @event core.garbage_collection + * @since 3.1.0-a1 + */ + $phpbb_dispatcher->dispatch('core.garbage_collection'); + } + + // Unload cache, must be done before the DB connection if closed + if (!empty($cache)) + { + $cache->unload(); + } + + // Close our DB connection. + if (!empty($db)) + { + $db->sql_close(); + } +} + +/** +* Handler for exit calls in phpBB. +* This function supports hooks. +* +* Note: This function is called after the template has been outputted. +*/ +function exit_handler() +{ + global $phpbb_hook; + + if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__)) + { + if ($phpbb_hook->hook_return(__FUNCTION__)) + { + return $phpbb_hook->hook_return_result(__FUNCTION__); + } + } + + // As a pre-caution... some setups display a blank page if the flush() is not there. + (ob_get_level() > 0) ? @ob_flush() : @flush(); + + exit; +} + +/** +* Handler for init calls in phpBB. This function is called in \phpbb\user::setup(); +* This function supports hooks. +*/ +function phpbb_user_session_handler() +{ + global $phpbb_hook; + + if (!empty($phpbb_hook) && $phpbb_hook->call_hook(__FUNCTION__)) + { + if ($phpbb_hook->hook_return(__FUNCTION__)) + { + return $phpbb_hook->hook_return_result(__FUNCTION__); + } + } + + return; +} + +/** +* Casts a numeric string $input to an appropriate numeric type (i.e. integer or float) +* +* @param string $input A numeric string. +* +* @return int|float Integer $input if $input fits integer, +* float $input otherwise. +*/ +function phpbb_to_numeric($input) +{ + return ($input > PHP_INT_MAX) ? (float) $input : (int) $input; +} + +/** +* Get the board contact details (e.g. for emails) +* +* @param \phpbb\config\config $config +* @param string $phpEx +* @return string +*/ +function phpbb_get_board_contact(\phpbb\config\config $config, $phpEx) +{ + if ($config['contact_admin_form_enable']) + { + return generate_board_url() . '/memberlist.' . $phpEx . '?mode=contactadmin'; + } + else + { + return $config['board_contact']; + } +} + +/** +* Get a clickable board contact details link +* +* @param \phpbb\config\config $config +* @param string $phpbb_root_path +* @param string $phpEx +* @return string +*/ +function phpbb_get_board_contact_link(\phpbb\config\config $config, $phpbb_root_path, $phpEx) +{ + if ($config['contact_admin_form_enable'] && $config['email_enable']) + { + return append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); + } + else + { + return 'mailto:' . htmlspecialchars($config['board_contact']); + } +} diff --git a/install/update/old/includes/functions_acp.php b/install/update/old/includes/functions_acp.php new file mode 100644 index 0000000..dd326c3 --- /dev/null +++ b/install/update/old/includes/functions_acp.php @@ -0,0 +1,726 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Header for acp pages +*/ +function adm_page_header($page_title) +{ + global $config, $user, $template; + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $SID, $_SID; + global $phpbb_dispatcher, $phpbb_container; + + if (defined('HEADER_INC')) + { + return; + } + + define('HEADER_INC', true); + + // A listener can set this variable to `true` when it overrides this function + $adm_page_header_override = false; + + /** + * Execute code and/or overwrite adm_page_header() + * + * @event core.adm_page_header + * @var string page_title Page title + * @var bool adm_page_header_override Shall we return instead of + * running the rest of adm_page_header() + * @since 3.1.0-a1 + */ + $vars = array('page_title', 'adm_page_header_override'); + extract($phpbb_dispatcher->trigger_event('core.adm_page_header', compact($vars))); + + if ($adm_page_header_override) + { + return; + } + + $user->update_session_infos(); + + // gzip_compression + if ($config['gzip_compress']) + { + if (@extension_loaded('zlib') && !headers_sent()) + { + ob_start('ob_gzhandler'); + } + } + + $template->assign_vars(array( + 'PAGE_TITLE' => $page_title, + 'USERNAME' => $user->data['username'], + + 'SID' => $SID, + '_SID' => $_SID, + 'SESSION_ID' => $user->session_id, + 'ROOT_PATH' => $phpbb_root_path, + 'ADMIN_ROOT_PATH' => $phpbb_admin_path, + + 'U_LOGOUT' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=logout'), + 'U_ADM_LOGOUT' => append_sid("{$phpbb_admin_path}index.$phpEx", 'action=admlogout'), + 'U_ADM_INDEX' => append_sid("{$phpbb_admin_path}index.$phpEx"), + 'U_INDEX' => append_sid("{$phpbb_root_path}index.$phpEx"), + + 'T_IMAGES_PATH' => "{$phpbb_root_path}images/", + 'T_SMILIES_PATH' => "{$phpbb_root_path}{$config['smilies_path']}/", + 'T_AVATAR_PATH' => "{$phpbb_root_path}{$config['avatar_path']}/", + 'T_AVATAR_GALLERY_PATH' => "{$phpbb_root_path}{$config['avatar_gallery_path']}/", + 'T_ICONS_PATH' => "{$phpbb_root_path}{$config['icons_path']}/", + 'T_RANKS_PATH' => "{$phpbb_root_path}{$config['ranks_path']}/", + 'T_UPLOAD_PATH' => "{$phpbb_root_path}{$config['upload_path']}/", + 'T_FONT_AWESOME_LINK' => !empty($config['allow_cdn']) && !empty($config['load_font_awesome_url']) ? $config['load_font_awesome_url'] : "{$phpbb_root_path}assets/css/font-awesome.min.css?assets_version=" . $config['assets_version'], + + 'T_ASSETS_VERSION' => $config['assets_version'], + + 'ICON_MOVE_UP' => '' . $user->lang['MOVE_UP'] . '', + 'ICON_MOVE_UP_DISABLED' => '' . $user->lang['MOVE_UP'] . '', + 'ICON_MOVE_DOWN' => '' . $user->lang['MOVE_DOWN'] . '', + 'ICON_MOVE_DOWN_DISABLED' => '' . $user->lang['MOVE_DOWN'] . '', + 'ICON_EDIT' => '' . $user->lang['EDIT'] . '', + 'ICON_EDIT_DISABLED' => '' . $user->lang['EDIT'] . '', + 'ICON_DELETE' => '' . $user->lang['DELETE'] . '', + 'ICON_DELETE_DISABLED' => '' . $user->lang['DELETE'] . '', + 'ICON_SYNC' => '' . $user->lang['RESYNC'] . '', + 'ICON_SYNC_DISABLED' => '' . $user->lang['RESYNC'] . '', + + 'S_USER_LANG' => $user->lang['USER_LANG'], + 'S_CONTENT_DIRECTION' => $user->lang['DIRECTION'], + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_CONTENT_FLOW_BEGIN' => ($user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left', + + 'CONTAINER_EXCEPTION' => $phpbb_container->hasParameter('container_exception') ? $phpbb_container->getParameter('container_exception') : false, + )); + + // An array of http headers that phpbb will set. The following event may override these. + $http_headers = array( + // application/xhtml+xml not used because of IE + 'Content-type' => 'text/html; charset=UTF-8', + 'Cache-Control' => 'private, no-cache="set-cookie"', + 'Expires' => gmdate('D, d M Y H:i:s', time()) . ' GMT', + ); + + /** + * Execute code and/or overwrite _common_ template variables after they have been assigned. + * + * @event core.adm_page_header_after + * @var string page_title Page title + * @var array http_headers HTTP headers that should be set by phpbb + * + * @since 3.1.0-RC3 + */ + $vars = array('page_title', 'http_headers'); + extract($phpbb_dispatcher->trigger_event('core.adm_page_header_after', compact($vars))); + + foreach ($http_headers as $hname => $hval) + { + header((string) $hname . ': ' . (string) $hval); + } + + return; +} + +/** +* Page footer for acp pages +*/ +function adm_page_footer($copyright_html = true) +{ + global $db, $config, $template, $user, $auth; + global $phpbb_root_path; + global $request, $phpbb_dispatcher; + + // A listener can set this variable to `true` when it overrides this function + $adm_page_footer_override = false; + + /** + * Execute code and/or overwrite adm_page_footer() + * + * @event core.adm_page_footer + * @var bool copyright_html Shall we display the copyright? + * @var bool adm_page_footer_override Shall we return instead of + * running the rest of adm_page_footer() + * @since 3.1.0-a1 + */ + $vars = array('copyright_html', 'adm_page_footer_override'); + extract($phpbb_dispatcher->trigger_event('core.adm_page_footer', compact($vars))); + + if ($adm_page_footer_override) + { + return; + } + + phpbb_check_and_display_sql_report($request, $auth, $db); + + $template->assign_vars(array( + 'DEBUG_OUTPUT' => phpbb_generate_debug_output($db, $config, $auth, $user, $phpbb_dispatcher), + 'TRANSLATION_INFO' => (!empty($user->lang['TRANSLATION_INFO'])) ? $user->lang['TRANSLATION_INFO'] : '', + 'S_COPYRIGHT_HTML' => $copyright_html, + 'CREDIT_LINE' => $user->lang('POWERED_BY', 'phpBB® Forum Software © phpBB Limited'), + 'T_JQUERY_LINK' => !empty($config['allow_cdn']) && !empty($config['load_jquery_url']) ? $config['load_jquery_url'] : "{$phpbb_root_path}assets/javascript/jquery.min.js", + 'S_ALLOW_CDN' => !empty($config['allow_cdn']), + 'VERSION' => $config['version']) + ); + + $template->display('body'); + + garbage_collection(); + exit_handler(); +} + +/** +* Generate back link for acp pages +*/ +function adm_back_link($u_action) +{ + global $user; + return '

« ' . $user->lang['BACK_TO_PREV'] . ''; +} + +/** +* Build select field options in acp pages +*/ +function build_select($option_ary, $option_default = false) +{ + global $user; + + $html = ''; + foreach ($option_ary as $value => $title) + { + $selected = ($option_default !== false && $value == $option_default) ? ' selected="selected"' : ''; + $html .= ''; + } + + return $html; +} + +/** +* Build radio fields in acp pages +*/ +function h_radio($name, $input_ary, $input_default = false, $id = false, $key = false, $separator = '') +{ + global $user; + + $html = ''; + $id_assigned = false; + foreach ($input_ary as $value => $title) + { + $selected = ($input_default !== false && $value == $input_default) ? ' checked="checked"' : ''; + $html .= '' . $separator; + $id_assigned = true; + } + + return $html; +} + +/** +* Build configuration template for acp configuration pages +*/ +function build_cfg_template($tpl_type, $key, &$new_ary, $config_key, $vars) +{ + global $user, $module, $phpbb_dispatcher; + + $tpl = ''; + $name = 'config[' . $config_key . ']'; + + // Make sure there is no notice printed out for non-existent config options (we simply set them) + if (!isset($new_ary[$config_key])) + { + $new_ary[$config_key] = ''; + } + + switch ($tpl_type[0]) + { + case 'password': + if ($new_ary[$config_key] !== '') + { + // replace passwords with asterixes + $new_ary[$config_key] = '********'; + } + case 'text': + case 'url': + case 'email': + case 'tel': + case 'search': + // maxlength and size are only valid for these types and will be + // ignored for other input types. + $size = (int) $tpl_type[1]; + $maxlength = (int) $tpl_type[2]; + + $tpl = ''; + break; + + case 'color': + case 'datetime': + case 'datetime-local': + case 'month': + case 'week': + $tpl = ''; + break; + + case 'date': + case 'time': + case 'number': + case 'range': + $max = ''; + $min = ( isset($tpl_type[1]) ) ? (int) $tpl_type[1] : false; + if ( isset($tpl_type[2]) ) + { + $max = (int) $tpl_type[2]; + } + + $tpl = ''; + break; + + case 'dimension': + $max = ''; + + $min = (int) $tpl_type[1]; + + if ( isset($tpl_type[2]) ) + { + $max = (int) $tpl_type[2]; + } + + $tpl = ' x '; + break; + + case 'textarea': + $rows = (int) $tpl_type[1]; + $cols = (int) $tpl_type[2]; + + $tpl = ''; + break; + + case 'radio': + $key_yes = ($new_ary[$config_key]) ? ' checked="checked"' : ''; + $key_no = (!$new_ary[$config_key]) ? ' checked="checked"' : ''; + + $tpl_type_cond = explode('_', $tpl_type[1]); + $type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true; + + $tpl_no = ''; + $tpl_yes = ''; + + $tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . $tpl_no : $tpl_no . $tpl_yes; + break; + + case 'select': + case 'custom': + + if (isset($vars['method'])) + { + $call = array($module->module, $vars['method']); + } + else if (isset($vars['function'])) + { + $call = $vars['function']; + } + else + { + break; + } + + if (isset($vars['params'])) + { + $args = array(); + foreach ($vars['params'] as $value) + { + switch ($value) + { + case '{CONFIG_VALUE}': + $value = $new_ary[$config_key]; + break; + + case '{KEY}': + $value = $key; + break; + } + + $args[] = $value; + } + } + else + { + $args = array($new_ary[$config_key], $key); + } + + $return = call_user_func_array($call, $args); + + if ($tpl_type[0] == 'select') + { + $size = (isset($tpl_type[1])) ? (int) $tpl_type[1] : 1; + $data_toggle = (!empty($tpl_type[2])) ? ' data-togglable-settings="true"' : ''; + + $tpl = ''; + } + else + { + $tpl = $return; + } + + break; + + default: + break; + } + + if (isset($vars['append'])) + { + $tpl .= $vars['append']; + } + + $new = $new_ary; + /** + * Overwrite the html code we display for the config value + * + * @event core.build_config_template + * @var array tpl_type Config type array: + * 0 => data type + * 1 [optional] => string: size, int: minimum + * 2 [optional] => string: max. length, int: maximum + * @var string key Should be used for the id attribute in html + * @var array new Array with the config values we display + * @var string name Should be used for the name attribute + * @var array vars Array with the options for the config + * @var string tpl The resulting html code we display + * @since 3.1.0-a1 + */ + $vars = array('tpl_type', 'key', 'new', 'name', 'vars', 'tpl'); + extract($phpbb_dispatcher->trigger_event('core.build_config_template', compact($vars))); + $new_ary = $new; + unset($new); + + return $tpl; +} + +/** +* Going through a config array and validate values, writing errors to $error. The validation method accepts parameters separated by ':' for string and int. +* The first parameter defines the type to be used, the second the lower bound and the third the upper bound. Only the type is required. +*/ +function validate_config_vars($config_vars, &$cfg_array, &$error) +{ + global $phpbb_root_path, $user, $phpbb_dispatcher, $phpbb_filesystem, $language; + + $type = 0; + $min = 1; + $max = 2; + + foreach ($config_vars as $config_name => $config_definition) + { + if (!isset($cfg_array[$config_name]) || strpos($config_name, 'legend') !== false) + { + continue; + } + + if (!isset($config_definition['validate'])) + { + continue; + } + + $validator = explode(':', $config_definition['validate']); + + // Validate a bit. ;) (0 = type, 1 = min, 2= max) + switch ($validator[$type]) + { + case 'url': + $cfg_array[$config_name] = trim($cfg_array[$config_name]); + + if (!empty($cfg_array[$config_name]) && !preg_match('#^' . get_preg_expression('url') . '$#iu', $cfg_array[$config_name])) + { + $error[] = $language->lang('URL_INVALID', $language->lang($config_definition['lang'])); + } + + // no break here + + case 'string': + $length = utf8_strlen($cfg_array[$config_name]); + + // the column is a VARCHAR + $validator[$max] = (isset($validator[$max])) ? min(255, $validator[$max]) : 255; + + if (isset($validator[$min]) && $length < $validator[$min]) + { + $error[] = sprintf($user->lang['SETTING_TOO_SHORT'], $user->lang[$config_definition['lang']], $validator[$min]); + } + else if (isset($validator[$max]) && $length > $validator[2]) + { + $error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$config_definition['lang']], $validator[$max]); + } + break; + + case 'bool': + $cfg_array[$config_name] = ($cfg_array[$config_name]) ? 1 : 0; + break; + + case 'int': + $cfg_array[$config_name] = (int) $cfg_array[$config_name]; + + if (isset($validator[$min]) && $cfg_array[$config_name] < $validator[$min]) + { + $error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$config_definition['lang']], $validator[$min]); + } + else if (isset($validator[$max]) && $cfg_array[$config_name] > $validator[$max]) + { + $error[] = sprintf($user->lang['SETTING_TOO_BIG'], $user->lang[$config_definition['lang']], $validator[$max]); + } + + if (strpos($config_name, '_max') !== false) + { + // Min/max pairs of settings should ensure that min <= max + // Replace _max with _min to find the name of the minimum + // corresponding configuration variable + $min_name = str_replace('_max', '_min', $config_name); + + if (isset($cfg_array[$min_name]) && is_numeric($cfg_array[$min_name]) && $cfg_array[$config_name] < $cfg_array[$min_name]) + { + // A minimum value exists and the maximum value is less than it + $error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$config_definition['lang']], (int) $cfg_array[$min_name]); + } + } + break; + + case 'email': + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $cfg_array[$config_name])) + { + $error[] = $user->lang['EMAIL_INVALID_EMAIL']; + } + break; + + // Absolute path + case 'script_path': + if (!$cfg_array[$config_name]) + { + break; + } + + $destination = str_replace('\\', '/', $cfg_array[$config_name]); + + if ($destination !== '/') + { + // Adjust destination path (no trailing slash) + if (substr($destination, -1, 1) == '/') + { + $destination = substr($destination, 0, -1); + } + + $destination = str_replace(array('../', './'), '', $destination); + + if ($destination[0] != '/') + { + $destination = '/' . $destination; + } + } + + $cfg_array[$config_name] = trim($destination); + + break; + + // Absolute path + case 'lang': + if (!$cfg_array[$config_name]) + { + break; + } + + $cfg_array[$config_name] = basename($cfg_array[$config_name]); + + if (!file_exists($phpbb_root_path . 'language/' . $cfg_array[$config_name] . '/')) + { + $error[] = $user->lang['WRONG_DATA_LANG']; + } + break; + + // Relative path (appended $phpbb_root_path) + case 'rpath': + case 'rwpath': + if (!$cfg_array[$config_name]) + { + break; + } + + $destination = $cfg_array[$config_name]; + + // Adjust destination path (no trailing slash) + if (substr($destination, -1, 1) == '/' || substr($destination, -1, 1) == '\\') + { + $destination = substr($destination, 0, -1); + } + + $destination = str_replace(array('../', '..\\', './', '.\\'), '', $destination); + if ($destination && ($destination[0] == '/' || $destination[0] == "\\")) + { + $destination = ''; + } + + $cfg_array[$config_name] = trim($destination); + + // Path being relative (still prefixed by phpbb_root_path), but with the ability to escape the root dir... + case 'path': + case 'wpath': + + if (!$cfg_array[$config_name]) + { + break; + } + + $cfg_array[$config_name] = trim($cfg_array[$config_name]); + + // Make sure no NUL byte is present... + if (strpos($cfg_array[$config_name], "\0") !== false || strpos($cfg_array[$config_name], '%00') !== false) + { + $cfg_array[$config_name] = ''; + break; + } + + $path = $phpbb_root_path . $cfg_array[$config_name]; + + if (!file_exists($path)) + { + $error[] = sprintf($user->lang['DIRECTORY_DOES_NOT_EXIST'], $cfg_array[$config_name]); + } + + if (file_exists($path) && !is_dir($path)) + { + $error[] = sprintf($user->lang['DIRECTORY_NOT_DIR'], $cfg_array[$config_name]); + } + + // Check if the path is writable + if ($config_definition['validate'] == 'wpath' || $config_definition['validate'] == 'rwpath') + { + if (file_exists($path) && !$phpbb_filesystem->is_writable($path)) + { + $error[] = sprintf($user->lang['DIRECTORY_NOT_WRITABLE'], $cfg_array[$config_name]); + } + } + + break; + + default: + /** + * Validate a config value + * + * @event core.validate_config_variable + * @var array cfg_array Array with config values + * @var string config_name Name of the config we validate + * @var array config_definition Array with the options for + * this config + * @var array error Array of errors, the errors should + * be strings only, language keys are + * not replaced afterwards + * @since 3.1.0-a1 + */ + $vars = array('cfg_array', 'config_name', 'config_definition', 'error'); + extract($phpbb_dispatcher->trigger_event('core.validate_config_variable', compact($vars))); + break; + } + } + + return; +} + +/** +* Checks whatever or not a variable is OK for use in the Database +* param mixed $value_ary An array of the form array(array('lang' => ..., 'value' => ..., 'column_type' =>))' +* param mixed $error The error array +*/ +function validate_range($value_ary, &$error) +{ + global $user; + + $column_types = array( + 'BOOL' => array('php_type' => 'int', 'min' => 0, 'max' => 1), + 'USINT' => array('php_type' => 'int', 'min' => 0, 'max' => 65535), + 'UINT' => array('php_type' => 'int', 'min' => 0, 'max' => (int) 0x7fffffff), + // Do not use (int) 0x80000000 - it evaluates to different + // values on 32-bit and 64-bit systems. + // Apparently -2147483648 is a float on 32-bit systems, + // despite fitting in an int, thus explicit cast is needed. + 'INT' => array('php_type' => 'int', 'min' => (int) -2147483648, 'max' => (int) 0x7fffffff), + 'TINT' => array('php_type' => 'int', 'min' => -128, 'max' => 127), + + 'VCHAR' => array('php_type' => 'string', 'min' => 0, 'max' => 255), + ); + foreach ($value_ary as $value) + { + $column = explode(':', $value['column_type']); + if (!isset($column_types[$column[0]])) + { + continue; + } + else + { + $type = $column_types[$column[0]]; + } + + switch ($type['php_type']) + { + case 'string' : + $max = (isset($column[1])) ? min($column[1],$type['max']) : $type['max']; + if (utf8_strlen($value['value']) > $max) + { + $error[] = sprintf($user->lang['SETTING_TOO_LONG'], $user->lang[$value['lang']], $max); + } + break; + + case 'int': + $min = (isset($column[1])) ? max($column[1],$type['min']) : $type['min']; + $max = (isset($column[2])) ? min($column[2],$type['max']) : $type['max']; + if ($value['value'] < $min) + { + $error[] = sprintf($user->lang['SETTING_TOO_LOW'], $user->lang[$value['lang']], $min); + } + else if ($value['value'] > $max) + { + $error[] = sprintf($user->lang['SETTING_TOO_BIG'], $user->lang[$value['lang']], $max); + } + break; + } + } +} + +/** +* Inserts new config display_vars into an exisiting display_vars array +* at the given position. +* +* @param array $display_vars An array of existing config display vars +* @param array $add_config_vars An array of new config display vars +* @param array $where Where to place the new config vars, +* before or after an exisiting config, as an array +* of the form: array('after' => 'config_name') or +* array('before' => 'config_name'). +* @return array The array of config display vars +*/ +function phpbb_insert_config_array($display_vars, $add_config_vars, $where) +{ + if (is_array($where) && array_key_exists(current($where), $display_vars)) + { + $position = array_search(current($where), array_keys($display_vars)) + ((key($where) == 'before') ? 0 : 1); + $display_vars = array_merge( + array_slice($display_vars, 0, $position), + $add_config_vars, + array_slice($display_vars, $position) + ); + } + + return $display_vars; +} diff --git a/install/update/old/includes/functions_admin.php b/install/update/old/includes/functions_admin.php new file mode 100644 index 0000000..c19d48b --- /dev/null +++ b/install/update/old/includes/functions_admin.php @@ -0,0 +1,3109 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Recalculate Nested Sets +* +* @param int $new_id first left_id (should start with 1) +* @param string $pkey primary key-column (containing the id for the parent_id of the children) +* @param string $table constant or fullname of the table +* @param int $parent_id parent_id of the current set (default = 0) +* @param array $where contains strings to compare closer on the where statement (additional) +*/ +function recalc_nested_sets(&$new_id, $pkey, $table, $parent_id = 0, $where = array()) +{ + global $db; + + $sql = 'SELECT * + FROM ' . $table . ' + WHERE parent_id = ' . (int) $parent_id . + ((!empty($where)) ? ' AND ' . implode(' AND ', $where) : '') . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + // First we update the left_id for this module + if ($row['left_id'] != $new_id) + { + $db->sql_query('UPDATE ' . $table . ' SET ' . $db->sql_build_array('UPDATE', array('left_id' => $new_id)) . " WHERE $pkey = {$row[$pkey]}"); + } + $new_id++; + + // Then we go through any children and update their left/right id's + recalc_nested_sets($new_id, $pkey, $table, $row[$pkey], $where); + + // Then we come back and update the right_id for this module + if ($row['right_id'] != $new_id) + { + $db->sql_query('UPDATE ' . $table . ' SET ' . $db->sql_build_array('UPDATE', array('right_id' => $new_id)) . " WHERE $pkey = {$row[$pkey]}"); + } + $new_id++; + } + $db->sql_freeresult($result); +} + +/** +* Simple version of jumpbox, just lists authed forums +*/ +function make_forum_select($select_id = false, $ignore_id = false, $ignore_acl = false, $ignore_nonpost = false, $ignore_emptycat = true, $only_acl_post = false, $return_array = false) +{ + global $db, $auth, $phpbb_dispatcher; + + // This query is identical to the jumpbox one + $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, forum_flags, forum_options, left_id, right_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql, 600); + + $rowset = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rowset[(int) $row['forum_id']] = $row; + } + $db->sql_freeresult($result); + + $right = 0; + $padding_store = array('0' => ''); + $padding = ''; + $forum_list = ($return_array) ? array() : ''; + + /** + * Modify the forum list data + * + * @event core.make_forum_select_modify_forum_list + * @var array rowset Array with the forums list data + * @since 3.1.10-RC1 + */ + $vars = array('rowset'); + extract($phpbb_dispatcher->trigger_event('core.make_forum_select_modify_forum_list', compact($vars))); + + // Sometimes it could happen that forums will be displayed here not be displayed within the index page + // This is the result of forums not displayed at index, having list permissions and a parent of a forum with no permissions. + // If this happens, the padding could be "broken" + + foreach ($rowset as $row) + { + if ($row['left_id'] < $right) + { + $padding .= '   '; + $padding_store[$row['parent_id']] = $padding; + } + else if ($row['left_id'] > $right + 1) + { + $padding = (isset($padding_store[$row['parent_id']])) ? $padding_store[$row['parent_id']] : ''; + } + + $right = $row['right_id']; + $disabled = false; + + if (!$ignore_acl && $auth->acl_gets(array('f_list', 'a_forum', 'a_forumadd', 'a_forumdel'), $row['forum_id'])) + { + if ($only_acl_post && !$auth->acl_get('f_post', $row['forum_id']) || (!$auth->acl_get('m_approve', $row['forum_id']) && !$auth->acl_get('f_noapprove', $row['forum_id']))) + { + $disabled = true; + } + } + else if (!$ignore_acl) + { + continue; + } + + if ( + ((is_array($ignore_id) && in_array($row['forum_id'], $ignore_id)) || $row['forum_id'] == $ignore_id) + || + // Non-postable forum with no subforums, don't display + ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id']) && $ignore_emptycat) + || + ($row['forum_type'] != FORUM_POST && $ignore_nonpost) + ) + { + $disabled = true; + } + + if ($return_array) + { + // Include some more information... + $selected = (is_array($select_id)) ? ((in_array($row['forum_id'], $select_id)) ? true : false) : (($row['forum_id'] == $select_id) ? true : false); + $forum_list[$row['forum_id']] = array_merge(array('padding' => $padding, 'selected' => ($selected && !$disabled), 'disabled' => $disabled), $row); + } + else + { + $selected = (is_array($select_id)) ? ((in_array($row['forum_id'], $select_id)) ? ' selected="selected"' : '') : (($row['forum_id'] == $select_id) ? ' selected="selected"' : ''); + $forum_list .= ''; + } + } + unset($padding_store, $rowset); + + return $forum_list; +} + +/** +* Generate size select options +*/ +function size_select_options($size_compare) +{ + global $user; + + $size_types_text = array($user->lang['BYTES'], $user->lang['KIB'], $user->lang['MIB']); + $size_types = array('b', 'kb', 'mb'); + + $s_size_options = ''; + + for ($i = 0, $size = count($size_types_text); $i < $size; $i++) + { + $selected = ($size_compare == $size_types[$i]) ? ' selected="selected"' : ''; + $s_size_options .= ''; + } + + return $s_size_options; +} + +/** +* Generate list of groups (option fields without select) +* +* @param int $group_id The default group id to mark as selected +* @param array $exclude_ids The group ids to exclude from the list, false (default) if you whish to exclude no id +* @param int $manage_founder If set to false (default) all groups are returned, if 0 only those groups returned not being managed by founders only, if 1 only those groups returned managed by founders only. +* +* @return string The list of options. +*/ +function group_select_options($group_id, $exclude_ids = false, $manage_founder = false) +{ + global $db, $config, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $exclude_sql = ($exclude_ids !== false && count($exclude_ids)) ? 'WHERE ' . $db->sql_in_set('group_id', array_map('intval', $exclude_ids), true) : ''; + $sql_and = (!$config['coppa_enable']) ? (($exclude_sql) ? ' AND ' : ' WHERE ') . "group_name <> 'REGISTERED_COPPA'" : ''; + $sql_founder = ($manage_founder !== false) ? (($exclude_sql || $sql_and) ? ' AND ' : ' WHERE ') . 'group_founder_manage = ' . (int) $manage_founder : ''; + + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE . " + $exclude_sql + $sql_and + $sql_founder + ORDER BY group_type DESC, group_name ASC"; + $result = $db->sql_query($sql); + + $s_group_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($row['group_id'] == $group_id) ? ' selected="selected"' : ''; + $s_group_options .= '' . $group_helper->get_name($row['group_name']) . ''; + } + $db->sql_freeresult($result); + + return $s_group_options; +} + +/** +* Obtain authed forums list +*/ +function get_forum_list($acl_list = 'f_list', $id_only = true, $postable_only = false, $no_cache = false) +{ + global $db, $auth, $phpbb_dispatcher; + static $forum_rows; + + if (!isset($forum_rows)) + { + // This query is identical to the jumpbox one + $expire_time = ($no_cache) ? 0 : 600; + + $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql, $expire_time); + + $forum_rows = array(); + + $right = $padding = 0; + $padding_store = array('0' => 0); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['left_id'] < $right) + { + $padding++; + $padding_store[$row['parent_id']] = $padding; + } + else if ($row['left_id'] > $right + 1) + { + // Ok, if the $padding_store for this parent is empty there is something wrong. For now we will skip over it. + // @todo digging deep to find out "how" this can happen. + $padding = (isset($padding_store[$row['parent_id']])) ? $padding_store[$row['parent_id']] : $padding; + } + + $right = $row['right_id']; + $row['padding'] = $padding; + + $forum_rows[] = $row; + } + $db->sql_freeresult($result); + unset($padding_store); + } + + $rowset = array(); + foreach ($forum_rows as $row) + { + if ($postable_only && $row['forum_type'] != FORUM_POST) + { + continue; + } + + if ($acl_list == '' || ($acl_list != '' && $auth->acl_gets($acl_list, $row['forum_id']))) + { + $rowset[] = ($id_only) ? (int) $row['forum_id'] : $row; + } + } + + /** + * Modify the forum list data + * + * @event core.get_forum_list_modify_data + * @var array rowset Array with the forum list data + * @since 3.1.10-RC1 + */ + $vars = array('rowset'); + extract($phpbb_dispatcher->trigger_event('core.get_forum_list_modify_data', compact($vars))); + + return $rowset; +} + +/** +* Get forum branch +*/ +function get_forum_branch($forum_id, $type = 'all', $order = 'descending', $include_forum = true) +{ + global $db; + + switch ($type) + { + case 'parents': + $condition = 'f1.left_id BETWEEN f2.left_id AND f2.right_id'; + break; + + case 'children': + $condition = 'f2.left_id BETWEEN f1.left_id AND f1.right_id'; + break; + + default: + $condition = 'f2.left_id BETWEEN f1.left_id AND f1.right_id OR f1.left_id BETWEEN f2.left_id AND f2.right_id'; + break; + } + + $rows = array(); + + $sql = 'SELECT f2.* + FROM ' . FORUMS_TABLE . ' f1 + LEFT JOIN ' . FORUMS_TABLE . " f2 ON ($condition) + WHERE f1.forum_id = $forum_id + ORDER BY f2.left_id " . (($order == 'descending') ? 'ASC' : 'DESC'); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$include_forum && $row['forum_id'] == $forum_id) + { + continue; + } + + $rows[] = $row; + } + $db->sql_freeresult($result); + + return $rows; +} + +/** +* Copies permissions from one forum to others +* +* @param int $src_forum_id The source forum we want to copy permissions from +* @param array $dest_forum_ids The destination forum(s) we want to copy to +* @param bool $clear_dest_perms True if destination permissions should be deleted +* @param bool $add_log True if log entry should be added +* +* @return bool False on error +*/ +function copy_forum_permissions($src_forum_id, $dest_forum_ids, $clear_dest_perms = true, $add_log = true) +{ + global $db, $user, $phpbb_log; + + // Only one forum id specified + if (!is_array($dest_forum_ids)) + { + $dest_forum_ids = array($dest_forum_ids); + } + + // Make sure forum ids are integers + $src_forum_id = (int) $src_forum_id; + $dest_forum_ids = array_map('intval', $dest_forum_ids); + + // No source forum or no destination forums specified + if (empty($src_forum_id) || empty($dest_forum_ids)) + { + return false; + } + + // Check if source forum exists + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $src_forum_id; + $result = $db->sql_query($sql); + $src_forum_name = $db->sql_fetchfield('forum_name'); + $db->sql_freeresult($result); + + // Source forum doesn't exist + if (empty($src_forum_name)) + { + return false; + } + + // Check if destination forums exists + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); + $result = $db->sql_query($sql); + + $dest_forum_ids = $dest_forum_names = array(); + while ($row = $db->sql_fetchrow($result)) + { + $dest_forum_ids[] = (int) $row['forum_id']; + $dest_forum_names[] = $row['forum_name']; + } + $db->sql_freeresult($result); + + // No destination forum exists + if (empty($dest_forum_ids)) + { + return false; + } + + // From the mysql documentation: + // Prior to MySQL 4.0.14, the target table of the INSERT statement cannot appear + // in the FROM clause of the SELECT part of the query. This limitation is lifted in 4.0.14. + // Due to this we stay on the safe side if we do the insertion "the manual way" + + // Rowsets we're going to insert + $users_sql_ary = $groups_sql_ary = array(); + + // Query acl users table for source forum data + $sql = 'SELECT user_id, auth_option_id, auth_role_id, auth_setting + FROM ' . ACL_USERS_TABLE . ' + WHERE forum_id = ' . $src_forum_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $row = array( + 'user_id' => (int) $row['user_id'], + 'auth_option_id' => (int) $row['auth_option_id'], + 'auth_role_id' => (int) $row['auth_role_id'], + 'auth_setting' => (int) $row['auth_setting'], + ); + + foreach ($dest_forum_ids as $dest_forum_id) + { + $users_sql_ary[] = $row + array('forum_id' => $dest_forum_id); + } + } + $db->sql_freeresult($result); + + // Query acl groups table for source forum data + $sql = 'SELECT group_id, auth_option_id, auth_role_id, auth_setting + FROM ' . ACL_GROUPS_TABLE . ' + WHERE forum_id = ' . $src_forum_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $row = array( + 'group_id' => (int) $row['group_id'], + 'auth_option_id' => (int) $row['auth_option_id'], + 'auth_role_id' => (int) $row['auth_role_id'], + 'auth_setting' => (int) $row['auth_setting'], + ); + + foreach ($dest_forum_ids as $dest_forum_id) + { + $groups_sql_ary[] = $row + array('forum_id' => $dest_forum_id); + } + } + $db->sql_freeresult($result); + + $db->sql_transaction('begin'); + + // Clear current permissions of destination forums + if ($clear_dest_perms) + { + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $dest_forum_ids); + $db->sql_query($sql); + } + + $db->sql_multi_insert(ACL_USERS_TABLE, $users_sql_ary); + $db->sql_multi_insert(ACL_GROUPS_TABLE, $groups_sql_ary); + + if ($add_log) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_FORUM_COPIED_PERMISSIONS', false, array($src_forum_name, implode(', ', $dest_forum_names))); + } + + $db->sql_transaction('commit'); + + return true; +} + +/** +* Get physical file listing +*/ +function filelist($rootdir, $dir = '', $type = 'gif|jpg|jpeg|png') +{ + $matches = array($dir => array()); + + // Remove initial / if present + $rootdir = (substr($rootdir, 0, 1) == '/') ? substr($rootdir, 1) : $rootdir; + // Add closing / if not present + $rootdir = ($rootdir && substr($rootdir, -1) != '/') ? $rootdir . '/' : $rootdir; + + // Remove initial / if present + $dir = (substr($dir, 0, 1) == '/') ? substr($dir, 1) : $dir; + // Add closing / if not present + $dir = ($dir && substr($dir, -1) != '/') ? $dir . '/' : $dir; + + if (!is_dir($rootdir . $dir)) + { + return $matches; + } + + $dh = @opendir($rootdir . $dir); + + if (!$dh) + { + return $matches; + } + + while (($fname = readdir($dh)) !== false) + { + if (is_file("$rootdir$dir$fname")) + { + if (filesize("$rootdir$dir$fname") && preg_match('#\.' . $type . '$#i', $fname)) + { + $matches[$dir][] = $fname; + } + } + else if ($fname[0] != '.' && is_dir("$rootdir$dir$fname")) + { + $matches += filelist($rootdir, "$dir$fname", $type); + } + } + closedir($dh); + + return $matches; +} + +/** +* Move topic(s) +*/ +function move_topics($topic_ids, $forum_id, $auto_sync = true) +{ + global $db, $phpbb_dispatcher; + + if (empty($topic_ids)) + { + return; + } + + $forum_ids = array($forum_id); + + if (!is_array($topic_ids)) + { + $topic_ids = array($topic_ids); + } + + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids) . ' + AND forum_id = ' . $forum_id; + $db->sql_query($sql); + + if ($auto_sync) + { + $sql = 'SELECT DISTINCT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + } + + $table_ary = array(TOPICS_TABLE, POSTS_TABLE, LOG_TABLE, DRAFTS_TABLE, TOPICS_TRACK_TABLE); + + /** + * Perform additional actions before topics move + * + * @event core.move_topics_before_query + * @var array table_ary Array of tables from which forum_id will be updated for all rows that hold the moved topics + * @var array topic_ids Array of the moved topic ids + * @var string forum_id The forum id from where the topics are moved + * @var array forum_ids Array of the forums where the topics are moving (includes also forum_id) + * @var bool auto_sync Whether or not to perform auto sync + * @since 3.1.5-RC1 + */ + $vars = array( + 'table_ary', + 'topic_ids', + 'forum_id', + 'forum_ids', + 'auto_sync', + ); + extract($phpbb_dispatcher->trigger_event('core.move_topics_before_query', compact($vars))); + + foreach ($table_ary as $table) + { + $sql = "UPDATE $table + SET forum_id = $forum_id + WHERE " . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + unset($table_ary); + + if ($auto_sync) + { + sync('forum', 'forum_id', $forum_ids, true, true); + unset($forum_ids); + } +} + +/** +* Move post(s) +*/ +function move_posts($post_ids, $topic_id, $auto_sync = true) +{ + global $db, $phpbb_dispatcher; + + if (!is_array($post_ids)) + { + $post_ids = array($post_ids); + } + + $forum_ids = array(); + $topic_ids = array($topic_id); + + $sql = 'SELECT DISTINCT topic_id, forum_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_id', $post_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = (int) $row['forum_id']; + $topic_ids[] = (int) $row['topic_id']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $forum_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$forum_row) + { + trigger_error('NO_TOPIC'); + } + + /** + * Perform additional actions before moving posts + * + * @event core.move_posts_before + * @var array post_ids Array of post ids to move + * @var int topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync + * @var array forum_ids Array of the forum ids the posts are moved from + * @var array topic_ids Array of the topic ids the posts are moved from + * @var array forum_row Array with the forum id of the topic the posts are moved to + * @since 3.1.7-RC1 + */ + $vars = array( + 'post_ids', + 'topic_id', + 'auto_sync', + 'forum_ids', + 'topic_ids', + 'forum_row', + ); + extract($phpbb_dispatcher->trigger_event('core.move_posts_before', compact($vars))); + + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET forum_id = ' . (int) $forum_row['forum_id'] . ", topic_id = $topic_id + WHERE " . $db->sql_in_set('post_id', $post_ids); + $db->sql_query($sql); + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " + SET topic_id = $topic_id, in_message = 0 + WHERE " . $db->sql_in_set('post_msg_id', $post_ids); + $db->sql_query($sql); + + /** + * Perform additional actions after moving posts + * + * @event core.move_posts_after + * @var array post_ids Array of the moved post ids + * @var int topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync + * @var array forum_ids Array of the forum ids the posts are moved from + * @var array topic_ids Array of the topic ids the posts are moved from + * @var array forum_row Array with the forum id of the topic the posts are moved to + * @since 3.1.7-RC1 + */ + $vars = array( + 'post_ids', + 'topic_id', + 'auto_sync', + 'forum_ids', + 'topic_ids', + 'forum_row', + ); + extract($phpbb_dispatcher->trigger_event('core.move_posts_after', compact($vars))); + + if ($auto_sync) + { + $forum_ids[] = (int) $forum_row['forum_id']; + + sync('topic_reported', 'topic_id', $topic_ids); + sync('topic_attachment', 'topic_id', $topic_ids); + sync('topic', 'topic_id', $topic_ids, true); + sync('forum', 'forum_id', $forum_ids, true, true); + + /** + * Perform additional actions after move post sync + * + * @event core.move_posts_sync_after + * @var array post_ids Array of the moved post ids + * @var int topic_id The topic id the posts are moved to + * @var bool auto_sync Whether or not to perform auto sync + * @var array forum_ids Array of the forum ids the posts are moved from + * @var array topic_ids Array of the topic ids the posts are moved from + * @var array forum_row Array with the forum id of the topic the posts are moved to + * @since 3.1.11-RC1 + */ + $vars = array( + 'post_ids', + 'topic_id', + 'auto_sync', + 'forum_ids', + 'topic_ids', + 'forum_row', + ); + extract($phpbb_dispatcher->trigger_event('core.move_posts_sync_after', compact($vars))); + } + + // Update posted information + update_posted_info($topic_ids); +} + +/** +* Remove topic(s) +*/ +function delete_topics($where_type, $where_ids, $auto_sync = true, $post_count_sync = true, $call_delete_posts = true) +{ + global $db, $config, $phpbb_container, $phpbb_dispatcher; + + $approved_topics = 0; + $forum_ids = $topic_ids = array(); + + if ($where_type === 'range') + { + $where_clause = $where_ids; + } + else + { + $where_ids = (is_array($where_ids)) ? array_unique($where_ids) : array($where_ids); + + if (!count($where_ids)) + { + return array('topics' => 0, 'posts' => 0); + } + + $where_clause = $db->sql_in_set($where_type, $where_ids); + } + + // Making sure that delete_posts does not call delete_topics again... + $return = array( + 'posts' => ($call_delete_posts) ? delete_posts($where_type, $where_ids, false, true, $post_count_sync, false) : 0, + ); + + $sql = 'SELECT topic_id, forum_id, topic_visibility, topic_moved_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $where_clause; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + $topic_ids[] = $row['topic_id']; + + if ($row['topic_visibility'] == ITEM_APPROVED && !$row['topic_moved_id']) + { + $approved_topics++; + } + } + $db->sql_freeresult($result); + + $return['topics'] = count($topic_ids); + + if (!count($topic_ids)) + { + return $return; + } + + $db->sql_transaction('begin'); + + $table_ary = array(BOOKMARKS_TABLE, TOPICS_TRACK_TABLE, TOPICS_POSTED_TABLE, POLL_VOTES_TABLE, POLL_OPTIONS_TABLE, TOPICS_WATCH_TABLE, TOPICS_TABLE); + + /** + * Perform additional actions before topic(s) deletion + * + * @event core.delete_topics_before_query + * @var array table_ary Array of tables from which all rows will be deleted that hold a topic_id occuring in topic_ids + * @var array topic_ids Array of topic ids to delete + * @since 3.1.4-RC1 + */ + $vars = array( + 'table_ary', + 'topic_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_topics_before_query', compact($vars))); + + foreach ($table_ary as $table) + { + $sql = "DELETE FROM $table + WHERE " . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + unset($table_ary); + + /** + * Perform additional actions after topic(s) deletion + * + * @event core.delete_topics_after_query + * @var array topic_ids Array of topic ids that were deleted + * @since 3.1.4-RC1 + */ + $vars = array( + 'topic_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_topics_after_query', compact($vars))); + + $moved_topic_ids = array(); + + // update the other forums + $sql = 'SELECT topic_id, forum_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + $moved_topic_ids[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (count($moved_topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $moved_topic_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + if ($auto_sync) + { + sync('forum', 'forum_id', array_unique($forum_ids), true, true); + sync('topic_reported', $where_type, $where_ids); + } + + if ($approved_topics) + { + $config->increment('num_topics', $approved_topics * (-1), false); + } + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->delete_notifications(array( + 'notification.type.topic', + 'notification.type.approve_topic', + 'notification.type.topic_in_queue', + ), $topic_ids); + + return $return; +} + +/** +* Remove post(s) +*/ +function delete_posts($where_type, $where_ids, $auto_sync = true, $posted_sync = true, $post_count_sync = true, $call_delete_topics = true) +{ + global $db, $config, $phpbb_root_path, $phpEx, $auth, $user, $phpbb_container, $phpbb_dispatcher; + + // Notifications types to delete + $delete_notifications_types = array( + 'notification.type.quote', + 'notification.type.approve_post', + 'notification.type.post_in_queue', + 'notification.type.report_post', + ); + + /** + * Perform additional actions before post(s) deletion + * + * @event core.delete_posts_before + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of posts ids to delete + * @var bool auto_sync Flag indicating if topics/forums should be synchronized + * @var bool posted_sync Flag indicating if topics_posted table should be resynchronized + * @var bool post_count_sync Flag indicating if posts count should be resynchronized + * @var bool call_delete_topics Flag indicating if topics having no posts should be deleted + * @var array delete_notifications_types Array with notifications types to delete + * @since 3.1.0-a4 + */ + $vars = array( + 'where_type', + 'where_ids', + 'auto_sync', + 'posted_sync', + 'post_count_sync', + 'call_delete_topics', + 'delete_notifications_types', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_before', compact($vars))); + + if ($where_type === 'range') + { + $where_clause = $where_ids; + } + else + { + if (is_array($where_ids)) + { + $where_ids = array_unique($where_ids); + } + else + { + $where_ids = array($where_ids); + } + + if (!count($where_ids)) + { + return false; + } + + $where_ids = array_map('intval', $where_ids); + +/* Possible code for splitting post deletion + if (count($where_ids) >= 1001) + { + // Split into chunks of 1000 + $chunks = array_chunk($where_ids, 1000); + + foreach ($chunks as $_where_ids) + { + delete_posts($where_type, $_where_ids, $auto_sync, $posted_sync, $post_count_sync, $call_delete_topics); + } + + return; + }*/ + + $where_clause = $db->sql_in_set($where_type, $where_ids); + } + + $approved_posts = 0; + $post_ids = $topic_ids = $forum_ids = $post_counts = $remove_topics = array(); + + $sql = 'SELECT post_id, poster_id, post_visibility, post_postcount, topic_id, forum_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $where_clause; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $post_ids[] = (int) $row['post_id']; + $poster_ids[] = (int) $row['poster_id']; + $topic_ids[] = (int) $row['topic_id']; + $forum_ids[] = (int) $row['forum_id']; + + if ($row['post_postcount'] && $post_count_sync && $row['post_visibility'] == ITEM_APPROVED) + { + $post_counts[$row['poster_id']] = (!empty($post_counts[$row['poster_id']])) ? $post_counts[$row['poster_id']] + 1 : 1; + } + + if ($row['post_visibility'] == ITEM_APPROVED) + { + $approved_posts++; + } + } + $db->sql_freeresult($result); + + if (!count($post_ids)) + { + return false; + } + + $db->sql_transaction('begin'); + + $table_ary = array(POSTS_TABLE, REPORTS_TABLE); + + /** + * Perform additional actions during post(s) deletion before running the queries + * + * @event core.delete_posts_in_transaction_before + * @var array post_ids Array with deleted posts' ids + * @var array poster_ids Array with deleted posts' author ids + * @var array topic_ids Array with deleted posts' topic ids + * @var array forum_ids Array with deleted posts' forum ids + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of post ids to delete + * @var array delete_notifications_types Array with notifications types to delete + * @var array table_ary Array with table names to delete data from + * @since 3.1.7-RC1 + */ + $vars = array( + 'post_ids', + 'poster_ids', + 'topic_ids', + 'forum_ids', + 'where_type', + 'where_ids', + 'delete_notifications_types', + 'table_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_in_transaction_before', compact($vars))); + + foreach ($table_ary as $table) + { + $sql = "DELETE FROM $table + WHERE " . $db->sql_in_set('post_id', $post_ids); + $db->sql_query($sql); + } + unset($table_ary); + + // Adjust users post counts + if (count($post_counts) && $post_count_sync) + { + foreach ($post_counts as $poster_id => $substract) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = 0 + WHERE user_id = ' . $poster_id . ' + AND user_posts < ' . $substract; + $db->sql_query($sql); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts - ' . $substract . ' + WHERE user_id = ' . $poster_id . ' + AND user_posts >= ' . $substract; + $db->sql_query($sql); + } + } + + // Remove topics now having no posts? + if (count($topic_ids)) + { + $sql = 'SELECT topic_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + GROUP BY topic_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $remove_topics[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + // Actually, those not within remove_topics should be removed. ;) + $remove_topics = array_diff($topic_ids, $remove_topics); + } + + // Remove the message from the search index + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if ($error) + { + trigger_error($error); + } + + $search->index_remove($post_ids, $poster_ids, $forum_ids); + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('post', $post_ids, false); + unset($attachment_manager); + + /** + * Perform additional actions during post(s) deletion + * + * @event core.delete_posts_in_transaction + * @var array post_ids Array with deleted posts' ids + * @var array poster_ids Array with deleted posts' author ids + * @var array topic_ids Array with deleted posts' topic ids + * @var array forum_ids Array with deleted posts' forum ids + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of posts ids to delete + * @var array delete_notifications_types Array with notifications types to delete + * @since 3.1.0-a4 + */ + $vars = array( + 'post_ids', + 'poster_ids', + 'topic_ids', + 'forum_ids', + 'where_type', + 'where_ids', + 'delete_notifications_types', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_in_transaction', compact($vars))); + + $db->sql_transaction('commit'); + + /** + * Perform additional actions after post(s) deletion + * + * @event core.delete_posts_after + * @var array post_ids Array with deleted posts' ids + * @var array poster_ids Array with deleted posts' author ids + * @var array topic_ids Array with deleted posts' topic ids + * @var array forum_ids Array with deleted posts' forum ids + * @var string where_type Variable containing posts deletion mode + * @var mixed where_ids Array or comma separated list of posts ids to delete + * @var array delete_notifications_types Array with notifications types to delete + * @since 3.1.0-a4 + */ + $vars = array( + 'post_ids', + 'poster_ids', + 'topic_ids', + 'forum_ids', + 'where_type', + 'where_ids', + 'delete_notifications_types', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_posts_after', compact($vars))); + + // Resync topics_posted table + if ($posted_sync) + { + update_posted_info($topic_ids); + } + + if ($auto_sync) + { + sync('topic_reported', 'topic_id', $topic_ids); + sync('topic', 'topic_id', $topic_ids, true); + sync('forum', 'forum_id', $forum_ids, true, true); + } + + if ($approved_posts && $post_count_sync) + { + $config->increment('num_posts', $approved_posts * (-1), false); + } + + // We actually remove topics now to not be inconsistent (the delete_topics function calls this function too) + if (count($remove_topics) && $call_delete_topics) + { + delete_topics('topic_id', $remove_topics, $auto_sync, $post_count_sync, false); + } + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->delete_notifications($delete_notifications_types, $post_ids); + + return count($post_ids); +} + +/** +* Delete Attachments +* +* @deprecated 3.2.0-a1 (To be removed: 3.4.0) +* +* @param string $mode can be: post|message|topic|attach|user +* @param mixed $ids can be: post_ids, message_ids, topic_ids, attach_ids, user_ids +* @param bool $resync set this to false if you are deleting posts or topics +*/ +function delete_attachments($mode, $ids, $resync = true) +{ + global $phpbb_container; + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $num_deleted = $attachment_manager->delete($mode, $ids, $resync); + + unset($attachment_manager); + + return $num_deleted; +} + +/** +* Deletes shadow topics pointing to a specified forum. +* +* @param int $forum_id The forum id +* @param string $sql_more Additional WHERE statement, e.g. t.topic_time < (time() - 1234) +* @param bool $auto_sync Will call sync() if this is true +* +* @return array Array with affected forums +*/ +function delete_topic_shadows($forum_id, $sql_more = '', $auto_sync = true) +{ + global $db; + + if (!$forum_id) + { + // Nothing to do. + return; + } + + // Set of affected forums we have to resync + $sync_forum_ids = array(); + + // Amount of topics we select and delete at once. + $batch_size = 500; + + do + { + $sql = 'SELECT t2.forum_id, t2.topic_id + FROM ' . TOPICS_TABLE . ' t2, ' . TOPICS_TABLE . ' t + WHERE t2.topic_moved_id = t.topic_id + AND t.forum_id = ' . (int) $forum_id . ' + ' . (($sql_more) ? 'AND ' . $sql_more : ''); + $result = $db->sql_query_limit($sql, $batch_size); + + $topic_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_ids[] = (int) $row['topic_id']; + + $sync_forum_ids[(int) $row['forum_id']] = (int) $row['forum_id']; + } + $db->sql_freeresult($result); + + if (!empty($topic_ids)) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + } + while (count($topic_ids) == $batch_size); + + if ($auto_sync) + { + sync('forum', 'forum_id', $sync_forum_ids, true, true); + } + + return $sync_forum_ids; +} + +/** +* Update/Sync posted information for topics +*/ +function update_posted_info(&$topic_ids) +{ + global $db, $config; + + if (empty($topic_ids) || !$config['load_db_track']) + { + return; + } + + // First of all, let us remove any posted information for these topics + $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + + // Now, let us collect the user/topic combos for rebuilding the information + $sql = 'SELECT poster_id, topic_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + AND poster_id <> ' . ANONYMOUS . ' + GROUP BY poster_id, topic_id'; + $result = $db->sql_query($sql); + + $posted = array(); + while ($row = $db->sql_fetchrow($result)) + { + // Add as key to make them unique (grouping by) and circumvent empty keys on array_unique + $posted[$row['poster_id']][] = $row['topic_id']; + } + $db->sql_freeresult($result); + + // Now add the information... + $sql_ary = array(); + foreach ($posted as $user_id => $topic_row) + { + foreach ($topic_row as $topic_id) + { + $sql_ary[] = array( + 'user_id' => (int) $user_id, + 'topic_id' => (int) $topic_id, + 'topic_posted' => 1, + ); + } + } + unset($posted); + + $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); +} + +/** +* Delete attached file +* +* @deprecated 3.2.0-a1 (To be removed: 3.4.0) +*/ +function phpbb_unlink($filename, $mode = 'file', $entry_removed = false) +{ + global $phpbb_container; + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $unlink = $attachment_manager->unlink($filename, $mode, $entry_removed); + unset($attachment_manager); + + return $unlink; +} + +/** +* All-encompasing sync function +* +* Exaples: +* +* sync('topic', 'topic_id', 123); // resync topic #123 +* sync('topic', 'forum_id', array(2, 3)); // resync topics from forum #2 and #3 +* sync('topic'); // resync all topics +* sync('topic', 'range', 'topic_id BETWEEN 1 AND 60'); // resync a range of topics/forums (only available for 'topic' and 'forum' modes) +* +* +* Modes: +* - forum Resync complete forum +* - topic Resync topics +* - topic_moved Removes topic shadows that would be in the same forum as the topic they link to +* - topic_visibility Resyncs the topic_visibility flag according to the status of the first post +* - post_reported Resyncs the post_reported flag, relying on actual reports +* - topic_reported Resyncs the topic_reported flag, relying on post_reported flags +* - post_attachement Same as post_reported, but with attachment flags +* - topic_attachement Same as topic_reported, but with attachment flags +*/ +function sync($mode, $where_type = '', $where_ids = '', $resync_parents = false, $sync_extra = false) +{ + global $db; + + if (is_array($where_ids)) + { + $where_ids = array_unique($where_ids); + $where_ids = array_map('intval', $where_ids); + } + else if ($where_type != 'range') + { + $where_ids = ($where_ids) ? array((int) $where_ids) : array(); + } + + if ($mode == 'forum' || $mode == 'topic' || $mode == 'topic_visibility' || $mode == 'topic_reported' || $mode == 'post_reported') + { + if (!$where_type) + { + $where_sql = ''; + $where_sql_and = 'WHERE'; + } + else if ($where_type == 'range') + { + // Only check a range of topics/forums. For instance: 'topic_id BETWEEN 1 AND 60' + $where_sql = 'WHERE (' . $mode[0] . ".$where_ids)"; + $where_sql_and = $where_sql . "\n\tAND"; + } + else + { + // Do not sync the "global forum" + $where_ids = array_diff($where_ids, array(0)); + + if (!count($where_ids)) + { + // Empty array with IDs. This means that we don't have any work to do. Just return. + return; + } + + // Limit the topics/forums we are syncing, use specific topic/forum IDs. + // $where_type contains the field for the where clause (forum_id, topic_id) + $where_sql = 'WHERE ' . $db->sql_in_set($mode[0] . '.' . $where_type, $where_ids); + $where_sql_and = $where_sql . "\n\tAND"; + } + } + else + { + if (!count($where_ids)) + { + return; + } + + // $where_type contains the field for the where clause (forum_id, topic_id) + $where_sql = 'WHERE ' . $db->sql_in_set($mode[0] . '.' . $where_type, $where_ids); + $where_sql_and = $where_sql . "\n\tAND"; + } + + switch ($mode) + { + case 'topic_moved': + $db->sql_transaction('begin'); + switch ($db->get_sql_layer()) + { + case 'mysql4': + case 'mysqli': + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + USING ' . TOPICS_TABLE . ' t1, ' . TOPICS_TABLE . " t2 + WHERE t1.topic_moved_id = t2.topic_id + AND t1.forum_id = t2.forum_id"; + $db->sql_query($sql); + break; + + default: + $sql = 'SELECT t1.topic_id + FROM ' .TOPICS_TABLE . ' t1, ' . TOPICS_TABLE . " t2 + WHERE t1.topic_moved_id = t2.topic_id + AND t1.forum_id = t2.forum_id"; + $result = $db->sql_query($sql); + + $topic_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_id_ary[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (!count($topic_id_ary)) + { + return; + } + + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_id_ary); + $db->sql_query($sql); + + break; + } + + $db->sql_transaction('commit'); + break; + + case 'topic_visibility': + + $db->sql_transaction('begin'); + + $sql = 'SELECT t.topic_id, p.post_visibility + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + $where_sql_and p.topic_id = t.topic_id + AND p.post_visibility = " . ITEM_APPROVED; + $result = $db->sql_query($sql); + + $topics_approved = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topics_approved[] = (int) $row['topic_id']; + } + $db->sql_freeresult($result); + + $sql = 'SELECT t.topic_id, p.post_visibility + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + $where_sql_and " . $db->sql_in_set('t.topic_id', $topics_approved, true, true) . ' + AND p.topic_id = t.topic_id + AND p.post_visibility = ' . ITEM_DELETED; + $result = $db->sql_query($sql); + + $topics_softdeleted = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topics_softdeleted[] = (int) $row['topic_id']; + } + $db->sql_freeresult($result); + + $topics_softdeleted = array_diff($topics_softdeleted, $topics_approved); + $topics_not_unapproved = array_merge($topics_softdeleted, $topics_approved); + + $update_ary = array( + ITEM_UNAPPROVED => (!empty($topics_not_unapproved)) ? $where_sql_and . ' ' . $db->sql_in_set('topic_id', $topics_not_unapproved, true) : '', + ITEM_APPROVED => (!empty($topics_approved)) ? ' WHERE ' . $db->sql_in_set('topic_id', $topics_approved) : '', + ITEM_DELETED => (!empty($topics_softdeleted)) ? ' WHERE ' . $db->sql_in_set('topic_id', $topics_softdeleted) : '', + ); + + foreach ($update_ary as $visibility => $sql_where) + { + if ($sql_where) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_visibility = ' . $visibility . ' + ' . $sql_where; + $db->sql_query($sql); + } + } + + $db->sql_transaction('commit'); + break; + + case 'post_reported': + $post_ids = $post_reported = array(); + + $db->sql_transaction('begin'); + + $sql = 'SELECT p.post_id, p.post_reported + FROM ' . POSTS_TABLE . " p + $where_sql + GROUP BY p.post_id, p.post_reported"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $post_ids[$row['post_id']] = $row['post_id']; + if ($row['post_reported']) + { + $post_reported[$row['post_id']] = 1; + } + } + $db->sql_freeresult($result); + + $sql = 'SELECT DISTINCT(post_id) + FROM ' . REPORTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_id', $post_ids) . ' + AND report_closed = 0'; + $result = $db->sql_query($sql); + + $post_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($post_reported[$row['post_id']])) + { + $post_ids[] = $row['post_id']; + } + else + { + unset($post_reported[$row['post_id']]); + } + } + $db->sql_freeresult($result); + + // $post_reported should be empty by now, if it's not it contains + // posts that are falsely flagged as reported + foreach ($post_reported as $post_id => $void) + { + $post_ids[] = $post_id; + } + + if (count($post_ids)) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_reported = 1 - post_reported + WHERE ' . $db->sql_in_set('post_id', $post_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + break; + + case 'topic_reported': + if ($sync_extra) + { + sync('post_reported', $where_type, $where_ids); + } + + $topic_ids = $topic_reported = array(); + + $db->sql_transaction('begin'); + + $sql = 'SELECT DISTINCT(t.topic_id) + FROM ' . POSTS_TABLE . " t + $where_sql_and t.post_reported = 1"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_reported[$row['topic_id']] = 1; + } + $db->sql_freeresult($result); + + $sql = 'SELECT t.topic_id, t.topic_reported + FROM ' . TOPICS_TABLE . " t + $where_sql"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_reported'] ^ isset($topic_reported[$row['topic_id']])) + { + $topic_ids[] = $row['topic_id']; + } + } + $db->sql_freeresult($result); + + if (count($topic_ids)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_reported = 1 - topic_reported + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + break; + + case 'post_attachment': + $post_ids = $post_attachment = array(); + + $db->sql_transaction('begin'); + + $sql = 'SELECT p.post_id, p.post_attachment + FROM ' . POSTS_TABLE . " p + $where_sql + GROUP BY p.post_id, p.post_attachment"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $post_ids[$row['post_id']] = $row['post_id']; + if ($row['post_attachment']) + { + $post_attachment[$row['post_id']] = 1; + } + } + $db->sql_freeresult($result); + + $sql = 'SELECT DISTINCT(post_msg_id) + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $post_ids) . ' + AND in_message = 0'; + $result = $db->sql_query($sql); + + $post_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($post_attachment[$row['post_msg_id']])) + { + $post_ids[] = $row['post_msg_id']; + } + else + { + unset($post_attachment[$row['post_msg_id']]); + } + } + $db->sql_freeresult($result); + + // $post_attachment should be empty by now, if it's not it contains + // posts that are falsely flagged as having attachments + foreach ($post_attachment as $post_id => $void) + { + $post_ids[] = $post_id; + } + + if (count($post_ids)) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_attachment = 1 - post_attachment + WHERE ' . $db->sql_in_set('post_id', $post_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + break; + + case 'topic_attachment': + if ($sync_extra) + { + sync('post_attachment', $where_type, $where_ids); + } + + $topic_ids = $topic_attachment = array(); + + $db->sql_transaction('begin'); + + $sql = 'SELECT DISTINCT(t.topic_id) + FROM ' . POSTS_TABLE . " t + $where_sql_and t.post_attachment = 1"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_attachment[$row['topic_id']] = 1; + } + $db->sql_freeresult($result); + + $sql = 'SELECT t.topic_id, t.topic_attachment + FROM ' . TOPICS_TABLE . " t + $where_sql"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_attachment'] ^ isset($topic_attachment[$row['topic_id']])) + { + $topic_ids[] = $row['topic_id']; + } + } + $db->sql_freeresult($result); + + if (count($topic_ids)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_attachment = 1 - topic_attachment + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + break; + + case 'forum': + + $db->sql_transaction('begin'); + + // 1: Get the list of all forums + $sql = 'SELECT f.* + FROM ' . FORUMS_TABLE . " f + $where_sql"; + $result = $db->sql_query($sql); + + $forum_data = $forum_ids = $post_ids = $last_post_id = $post_info = array(); + while ($row = $db->sql_fetchrow($result)) + { + if ($row['forum_type'] == FORUM_LINK) + { + continue; + } + + $forum_id = (int) $row['forum_id']; + $forum_ids[$forum_id] = $forum_id; + + $forum_data[$forum_id] = $row; + if ($sync_extra) + { + $forum_data[$forum_id]['posts_approved'] = 0; + $forum_data[$forum_id]['posts_unapproved'] = 0; + $forum_data[$forum_id]['posts_softdeleted'] = 0; + $forum_data[$forum_id]['topics_approved'] = 0; + $forum_data[$forum_id]['topics_unapproved'] = 0; + $forum_data[$forum_id]['topics_softdeleted'] = 0; + } + $forum_data[$forum_id]['last_post_id'] = 0; + $forum_data[$forum_id]['last_post_subject'] = ''; + $forum_data[$forum_id]['last_post_time'] = 0; + $forum_data[$forum_id]['last_poster_id'] = 0; + $forum_data[$forum_id]['last_poster_name'] = ''; + $forum_data[$forum_id]['last_poster_colour'] = ''; + } + $db->sql_freeresult($result); + + if (!count($forum_ids)) + { + break; + } + + $forum_ids = array_values($forum_ids); + + // 2: Get topic counts for each forum (optional) + if ($sync_extra) + { + $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS total_topics + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids) . ' + GROUP BY forum_id, topic_visibility'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_id = (int) $row['forum_id']; + + if ($row['topic_visibility'] == ITEM_APPROVED) + { + $forum_data[$forum_id]['topics_approved'] = $row['total_topics']; + } + else if ($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) + { + $forum_data[$forum_id]['topics_unapproved'] = $row['total_topics']; + } + else if ($row['topic_visibility'] == ITEM_DELETED) + { + $forum_data[$forum_id]['topics_softdeleted'] = $row['total_topics']; + } + } + $db->sql_freeresult($result); + } + + // 3: Get post count for each forum (optional) + if ($sync_extra) + { + if (count($forum_ids) == 1) + { + $sql = 'SELECT SUM(t.topic_posts_approved) AS forum_posts_approved, SUM(t.topic_posts_unapproved) AS forum_posts_unapproved, SUM(t.topic_posts_softdeleted) AS forum_posts_softdeleted + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' + AND t.topic_status <> ' . ITEM_MOVED; + } + else + { + $sql = 'SELECT t.forum_id, SUM(t.topic_posts_approved) AS forum_posts_approved, SUM(t.topic_posts_unapproved) AS forum_posts_unapproved, SUM(t.topic_posts_softdeleted) AS forum_posts_softdeleted + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' + AND t.topic_status <> ' . ITEM_MOVED . ' + GROUP BY t.forum_id'; + } + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_id = (count($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; + + $forum_data[$forum_id]['posts_approved'] = (int) $row['forum_posts_approved']; + $forum_data[$forum_id]['posts_unapproved'] = (int) $row['forum_posts_unapproved']; + $forum_data[$forum_id]['posts_softdeleted'] = (int) $row['forum_posts_softdeleted']; + } + $db->sql_freeresult($result); + } + + // 4: Get last_post_id for each forum + if (count($forum_ids) == 1) + { + $sql = 'SELECT MAX(t.topic_last_post_id) as last_post_id + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' + AND t.topic_visibility = ' . ITEM_APPROVED; + } + else + { + $sql = 'SELECT t.forum_id, MAX(t.topic_last_post_id) as last_post_id + FROM ' . TOPICS_TABLE . ' t + WHERE ' . $db->sql_in_set('t.forum_id', $forum_ids) . ' + AND t.topic_visibility = ' . ITEM_APPROVED . ' + GROUP BY t.forum_id'; + } + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_id = (count($forum_ids) == 1) ? (int) $forum_ids[0] : (int) $row['forum_id']; + + $forum_data[$forum_id]['last_post_id'] = (int) $row['last_post_id']; + + $post_ids[] = $row['last_post_id']; + } + $db->sql_freeresult($result); + + // 5: Retrieve last_post infos + if (count($post_ids)) + { + $sql = 'SELECT p.post_id, p.poster_id, p.post_subject, p.post_time, p.post_username, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' + AND p.poster_id = u.user_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $post_info[$row['post_id']] = $row; + } + $db->sql_freeresult($result); + + foreach ($forum_data as $forum_id => $data) + { + if ($data['last_post_id']) + { + if (isset($post_info[$data['last_post_id']])) + { + $forum_data[$forum_id]['last_post_subject'] = $post_info[$data['last_post_id']]['post_subject']; + $forum_data[$forum_id]['last_post_time'] = $post_info[$data['last_post_id']]['post_time']; + $forum_data[$forum_id]['last_poster_id'] = $post_info[$data['last_post_id']]['poster_id']; + $forum_data[$forum_id]['last_poster_name'] = ($post_info[$data['last_post_id']]['poster_id'] != ANONYMOUS) ? $post_info[$data['last_post_id']]['username'] : $post_info[$data['last_post_id']]['post_username']; + $forum_data[$forum_id]['last_poster_colour'] = $post_info[$data['last_post_id']]['user_colour']; + } + else + { + // For some reason we did not find the post in the db + $forum_data[$forum_id]['last_post_id'] = 0; + $forum_data[$forum_id]['last_post_subject'] = ''; + $forum_data[$forum_id]['last_post_time'] = 0; + $forum_data[$forum_id]['last_poster_id'] = 0; + $forum_data[$forum_id]['last_poster_name'] = ''; + $forum_data[$forum_id]['last_poster_colour'] = ''; + } + } + } + unset($post_info); + } + + // 6: Now do that thing + $fieldnames = array('last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); + + if ($sync_extra) + { + array_push($fieldnames, 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'topics_approved', 'topics_unapproved', 'topics_softdeleted'); + } + + foreach ($forum_data as $forum_id => $row) + { + $sql_ary = array(); + + foreach ($fieldnames as $fieldname) + { + if ($row['forum_' . $fieldname] != $row[$fieldname]) + { + if (preg_match('#(name|colour|subject)$#', $fieldname)) + { + $sql_ary['forum_' . $fieldname] = (string) $row[$fieldname]; + } + else + { + $sql_ary['forum_' . $fieldname] = (int) $row[$fieldname]; + } + } + } + + if (count($sql_ary)) + { + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE forum_id = ' . $forum_id; + $db->sql_query($sql); + } + } + + $db->sql_transaction('commit'); + break; + + case 'topic': + $topic_data = $post_ids = $resync_forums = $delete_topics = $delete_posts = $moved_topics = array(); + + $db->sql_transaction('begin'); + + $sql = 'SELECT t.topic_id, t.forum_id, t.topic_moved_id, t.topic_visibility, ' . (($sync_extra) ? 't.topic_attachment, t.topic_reported, ' : '') . 't.topic_poster, t.topic_time, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_first_post_id, t.topic_first_poster_name, t.topic_first_poster_colour, t.topic_last_post_id, t.topic_last_post_subject, t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_poster_colour, t.topic_last_post_time + FROM ' . TOPICS_TABLE . " t + $where_sql"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_moved_id']) + { + $moved_topics[] = $row['topic_id']; + continue; + } + + $topic_id = (int) $row['topic_id']; + $topic_data[$topic_id] = $row; + $topic_data[$topic_id]['visibility'] = ITEM_UNAPPROVED; + $topic_data[$topic_id]['posts_approved'] = 0; + $topic_data[$topic_id]['posts_unapproved'] = 0; + $topic_data[$topic_id]['posts_softdeleted'] = 0; + $topic_data[$topic_id]['first_post_id'] = 0; + $topic_data[$topic_id]['last_post_id'] = 0; + unset($topic_data[$topic_id]['topic_id']); + + // This array holds all topic_ids + $delete_topics[$topic_id] = ''; + + if ($sync_extra) + { + $topic_data[$topic_id]['reported'] = 0; + $topic_data[$topic_id]['attachment'] = 0; + } + } + $db->sql_freeresult($result); + + // Use "t" as table alias because of the $where_sql clause + // NOTE: 't.post_visibility' in the GROUP BY is causing a major slowdown. + $sql = 'SELECT t.topic_id, t.post_visibility, COUNT(t.post_id) AS total_posts, MIN(t.post_id) AS first_post_id, MAX(t.post_id) AS last_post_id + FROM ' . POSTS_TABLE . " t + $where_sql + GROUP BY t.topic_id, t.post_visibility"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id = (int) $row['topic_id']; + + $row['first_post_id'] = (int) $row['first_post_id']; + $row['last_post_id'] = (int) $row['last_post_id']; + + if (!isset($topic_data[$topic_id])) + { + // Hey, these posts come from a topic that does not exist + $delete_posts[$topic_id] = ''; + } + else + { + // Unset the corresponding entry in $delete_topics + // When we'll be done, only topics with no posts will remain + unset($delete_topics[$topic_id]); + + if ($row['post_visibility'] == ITEM_APPROVED) + { + $topic_data[$topic_id]['posts_approved'] = $row['total_posts']; + } + else if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) + { + $topic_data[$topic_id]['posts_unapproved'] = $row['total_posts']; + } + else if ($row['post_visibility'] == ITEM_DELETED) + { + $topic_data[$topic_id]['posts_softdeleted'] = $row['total_posts']; + } + + if ($row['post_visibility'] == ITEM_APPROVED) + { + $topic_data[$topic_id]['visibility'] = ITEM_APPROVED; + $topic_data[$topic_id]['first_post_id'] = $row['first_post_id']; + $topic_data[$topic_id]['last_post_id'] = $row['last_post_id']; + } + else if ($topic_data[$topic_id]['visibility'] != ITEM_APPROVED) + { + // If there is no approved post, we take the min/max of the other visibilities + // for the last and first post info, because it is only visible to moderators anyway + $topic_data[$topic_id]['first_post_id'] = (!empty($topic_data[$topic_id]['first_post_id'])) ? min($topic_data[$topic_id]['first_post_id'], $row['first_post_id']) : $row['first_post_id']; + $topic_data[$topic_id]['last_post_id'] = max($topic_data[$topic_id]['last_post_id'], $row['last_post_id']); + + if ($topic_data[$topic_id]['visibility'] == ITEM_UNAPPROVED || $topic_data[$topic_id]['visibility'] == ITEM_REAPPROVE) + { + // Soft delete status is stronger than unapproved. + $topic_data[$topic_id]['visibility'] = $row['post_visibility']; + } + } + } + } + $db->sql_freeresult($result); + + foreach ($topic_data as $topic_id => $row) + { + $post_ids[] = $row['first_post_id']; + if ($row['first_post_id'] != $row['last_post_id']) + { + $post_ids[] = $row['last_post_id']; + } + } + + // Now we delete empty topics and orphan posts + if (count($delete_posts)) + { + delete_posts('topic_id', array_keys($delete_posts), false); + unset($delete_posts); + } + + if (!count($topic_data)) + { + // If we get there, topic ids were invalid or topics did not contain any posts + delete_topics($where_type, $where_ids, true); + return; + } + + if (count($delete_topics)) + { + $delete_topic_ids = array(); + foreach ($delete_topics as $topic_id => $void) + { + unset($topic_data[$topic_id]); + $delete_topic_ids[] = $topic_id; + } + + delete_topics('topic_id', $delete_topic_ids, false); + unset($delete_topics, $delete_topic_ids); + } + + $sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' + AND u.user_id = p.poster_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id = intval($row['topic_id']); + + if ($row['post_id'] == $topic_data[$topic_id]['first_post_id']) + { + $topic_data[$topic_id]['time'] = $row['post_time']; + $topic_data[$topic_id]['poster'] = $row['poster_id']; + $topic_data[$topic_id]['first_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; + $topic_data[$topic_id]['first_poster_colour'] = $row['user_colour']; + } + + if ($row['post_id'] == $topic_data[$topic_id]['last_post_id']) + { + $topic_data[$topic_id]['last_poster_id'] = $row['poster_id']; + $topic_data[$topic_id]['last_post_subject'] = $row['post_subject']; + $topic_data[$topic_id]['last_post_time'] = $row['post_time']; + $topic_data[$topic_id]['last_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; + $topic_data[$topic_id]['last_poster_colour'] = $row['user_colour']; + } + } + $db->sql_freeresult($result); + + // Make sure shadow topics do link to existing topics + if (count($moved_topics)) + { + $delete_topics = array(); + + $sql = 'SELECT t1.topic_id, t1.topic_moved_id + FROM ' . TOPICS_TABLE . ' t1 + LEFT JOIN ' . TOPICS_TABLE . ' t2 ON (t2.topic_id = t1.topic_moved_id) + WHERE ' . $db->sql_in_set('t1.topic_id', $moved_topics) . ' + AND t2.topic_id IS NULL'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $delete_topics[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (count($delete_topics)) + { + delete_topics('topic_id', $delete_topics, false); + } + unset($delete_topics); + + // Make sure shadow topics having no last post data being updated (this only rarely happens...) + $sql = 'SELECT topic_id, topic_moved_id, topic_last_post_id, topic_first_post_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $moved_topics) . ' + AND topic_last_post_time = 0'; + $result = $db->sql_query($sql); + + $shadow_topic_data = $post_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $shadow_topic_data[$row['topic_moved_id']] = $row; + $post_ids[] = $row['topic_last_post_id']; + $post_ids[] = $row['topic_first_post_id']; + } + $db->sql_freeresult($result); + + $sync_shadow_topics = array(); + if (count($post_ids)) + { + $sql = 'SELECT p.post_id, p.topic_id, p.post_visibility, p.poster_id, p.post_subject, p.post_username, p.post_time, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . $db->sql_in_set('p.post_id', $post_ids) . ' + AND u.user_id = p.poster_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_id = (int) $row['topic_id']; + + // Ok, there should be a shadow topic. If there isn't, then there's something wrong with the db. + // However, there's not much we can do about it. + if (!empty($shadow_topic_data[$topic_id])) + { + if ($row['post_id'] == $shadow_topic_data[$topic_id]['topic_first_post_id']) + { + $orig_topic_id = $shadow_topic_data[$topic_id]['topic_id']; + + if (!isset($sync_shadow_topics[$orig_topic_id])) + { + $sync_shadow_topics[$orig_topic_id] = array(); + } + + $sync_shadow_topics[$orig_topic_id]['topic_time'] = $row['post_time']; + $sync_shadow_topics[$orig_topic_id]['topic_poster'] = $row['poster_id']; + $sync_shadow_topics[$orig_topic_id]['topic_first_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; + $sync_shadow_topics[$orig_topic_id]['topic_first_poster_colour'] = $row['user_colour']; + } + + if ($row['post_id'] == $shadow_topic_data[$topic_id]['topic_last_post_id']) + { + $orig_topic_id = $shadow_topic_data[$topic_id]['topic_id']; + + if (!isset($sync_shadow_topics[$orig_topic_id])) + { + $sync_shadow_topics[$orig_topic_id] = array(); + } + + $sync_shadow_topics[$orig_topic_id]['topic_last_poster_id'] = $row['poster_id']; + $sync_shadow_topics[$orig_topic_id]['topic_last_post_subject'] = $row['post_subject']; + $sync_shadow_topics[$orig_topic_id]['topic_last_post_time'] = $row['post_time']; + $sync_shadow_topics[$orig_topic_id]['topic_last_poster_name'] = ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username']; + $sync_shadow_topics[$orig_topic_id]['topic_last_poster_colour'] = $row['user_colour']; + } + } + } + $db->sql_freeresult($result); + + $shadow_topic_data = array(); + + // Update the information we collected + if (count($sync_shadow_topics)) + { + foreach ($sync_shadow_topics as $sync_topic_id => $sql_ary) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE topic_id = ' . $sync_topic_id; + $db->sql_query($sql); + } + } + } + + unset($sync_shadow_topics, $shadow_topic_data); + } + + // These are fields that will be synchronised + $fieldnames = array('time', 'visibility', 'posts_approved', 'posts_unapproved', 'posts_softdeleted', 'poster', 'first_post_id', 'first_poster_name', 'first_poster_colour', 'last_post_id', 'last_post_subject', 'last_post_time', 'last_poster_id', 'last_poster_name', 'last_poster_colour'); + + if ($sync_extra) + { + // This routine assumes that post_reported values are correct + // if they are not, use sync('post_reported') first + $sql = 'SELECT t.topic_id, p.post_id + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + $where_sql_and p.topic_id = t.topic_id + AND p.post_reported = 1 + GROUP BY t.topic_id, p.post_id"; + $result = $db->sql_query($sql); + + $fieldnames[] = 'reported'; + while ($row = $db->sql_fetchrow($result)) + { + $topic_data[intval($row['topic_id'])]['reported'] = 1; + } + $db->sql_freeresult($result); + + // This routine assumes that post_attachment values are correct + // if they are not, use sync('post_attachment') first + $sql = 'SELECT t.topic_id, p.post_id + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + $where_sql_and p.topic_id = t.topic_id + AND p.post_attachment = 1 + GROUP BY t.topic_id, p.post_id"; + $result = $db->sql_query($sql); + + $fieldnames[] = 'attachment'; + while ($row = $db->sql_fetchrow($result)) + { + $topic_data[intval($row['topic_id'])]['attachment'] = 1; + } + $db->sql_freeresult($result); + } + + foreach ($topic_data as $topic_id => $row) + { + $sql_ary = array(); + + foreach ($fieldnames as $fieldname) + { + if (isset($row[$fieldname]) && isset($row['topic_' . $fieldname]) && $row['topic_' . $fieldname] != $row[$fieldname]) + { + $sql_ary['topic_' . $fieldname] = $row[$fieldname]; + } + } + + if (count($sql_ary)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE topic_id = ' . $topic_id; + $db->sql_query($sql); + + $resync_forums[$row['forum_id']] = $row['forum_id']; + } + } + unset($topic_data); + + $db->sql_transaction('commit'); + + // if some topics have been resync'ed then resync parent forums + // except when we're only syncing a range, we don't want to sync forums during + // batch processing. + if ($resync_parents && count($resync_forums) && $where_type != 'range') + { + sync('forum', 'forum_id', array_values($resync_forums), true, true); + } + break; + } + + return; +} + +/** +* Prune function +*/ +function prune($forum_id, $prune_mode, $prune_date, $prune_flags = 0, $auto_sync = true, $prune_limit = 0) +{ + global $db, $phpbb_dispatcher; + + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + if (!count($forum_id)) + { + return; + } + + $sql_and = ''; + + if (!($prune_flags & FORUM_FLAG_PRUNE_ANNOUNCE)) + { + $sql_and .= ' AND topic_type <> ' . POST_ANNOUNCE; + $sql_and .= ' AND topic_type <> ' . POST_GLOBAL; + } + + if (!($prune_flags & FORUM_FLAG_PRUNE_STICKY)) + { + $sql_and .= ' AND topic_type <> ' . POST_STICKY; + } + + if ($prune_mode == 'posted') + { + $sql_and .= " AND topic_last_post_time < $prune_date"; + } + + if ($prune_mode == 'viewed') + { + $sql_and .= " AND topic_last_view_time < $prune_date"; + } + + if ($prune_mode == 'shadow') + { + $sql_and .= ' AND topic_status = ' . ITEM_MOVED . " AND topic_last_post_time < $prune_date"; + } + + /** + * Use this event to modify the SQL that selects topics to be pruned + * + * @event core.prune_sql + * @var string forum_id The forum id + * @var string prune_mode The prune mode + * @var string prune_date The prune date + * @var int prune_flags The prune flags + * @var bool auto_sync Whether or not to perform auto sync + * @var string sql_and SQL text appended to where clause + * @var int prune_limit The prune limit + * @since 3.1.3-RC1 + * @changed 3.1.10-RC1 Added prune_limit + */ + $vars = array( + 'forum_id', + 'prune_mode', + 'prune_date', + 'prune_flags', + 'auto_sync', + 'sql_and', + 'prune_limit', + ); + extract($phpbb_dispatcher->trigger_event('core.prune_sql', compact($vars))); + + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id) . " + AND poll_start = 0 + $sql_and"; + $result = $db->sql_query_limit($sql, $prune_limit); + + $topic_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_list[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if ($prune_flags & FORUM_FLAG_PRUNE_POLL) + { + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_id) . " + AND poll_start > 0 + AND poll_last_vote < $prune_date + $sql_and"; + $result = $db->sql_query_limit($sql, $prune_limit); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_list[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + $topic_list = array_unique($topic_list); + } + + /** + * Perform additional actions before topic deletion via pruning + * + * @event core.prune_delete_before + * @var int[] topic_list The IDs of the topics to be deleted + * @since 3.2.2-RC1 + */ + $vars = array('topic_list'); + extract($phpbb_dispatcher->trigger_event('core.prune_delete_before', compact($vars))); + + return delete_topics('topic_id', $topic_list, $auto_sync, false); +} + +/** +* Function auto_prune(), this function now relies on passed vars +*/ +function auto_prune($forum_id, $prune_mode, $prune_flags, $prune_days, $prune_freq) +{ + global $db, $user, $phpbb_log; + + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql, 3600); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $prune_date = time() - ($prune_days * 86400); + $next_prune = time() + ($prune_freq * 86400); + + $result = prune($forum_id, $prune_mode, $prune_date, $prune_flags, true, 300); + + if ($result['topics'] == 0 && $result['posts'] == 0) + { + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET prune_next = $next_prune + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_AUTO_PRUNE', false, array($row['forum_name'])); + } + + return; +} + +/** +* Cache moderators. Called whenever permissions are changed +* via admin_permissions. Changes of usernames and group names +* must be carried through for the moderators table. +* +* @param \phpbb\db\driver\driver_interface $db Database connection +* @param \phpbb\cache\driver\driver_interface Cache driver +* @param \phpbb\auth\auth $auth Authentication object +* @return null +*/ +function phpbb_cache_moderators($db, $cache, $auth) +{ + // Remove cached sql results + $cache->destroy('sql', MODERATOR_CACHE_TABLE); + + // Clear table + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $db->sql_query('DELETE FROM ' . MODERATOR_CACHE_TABLE); + break; + + default: + $db->sql_query('TRUNCATE TABLE ' . MODERATOR_CACHE_TABLE); + break; + } + + // We add moderators who have forum moderator permissions without an explicit ACL_NEVER setting + $sql_ary = array(); + + // Grab all users having moderative options... + $hold_ary = $auth->acl_user_raw_data(false, 'm_%', false); + + // Add users? + if (!empty($hold_ary)) + { + // At least one moderative option warrants a display + $ug_id_ary = array_keys($hold_ary); + + // Remove users who have group memberships with DENY moderator permissions + $sql_ary_deny = array( + 'SELECT' => 'a.forum_id, ug.user_id, g.group_id', + + 'FROM' => array( + ACL_OPTIONS_TABLE => 'o', + USER_GROUP_TABLE => 'ug', + GROUPS_TABLE => 'g', + ACL_GROUPS_TABLE => 'a', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(ACL_ROLES_DATA_TABLE => 'r'), + 'ON' => 'a.auth_role_id = r.role_id', + ), + ), + + 'WHERE' => '(o.auth_option_id = a.auth_option_id OR o.auth_option_id = r.auth_option_id) + AND ((a.auth_setting = ' . ACL_NEVER . ' AND r.auth_setting IS NULL) + OR r.auth_setting = ' . ACL_NEVER . ') + AND a.group_id = ug.group_id + AND g.group_id = ug.group_id + AND NOT (ug.group_leader = 1 AND g.group_skip_auth = 1) + AND ' . $db->sql_in_set('ug.user_id', $ug_id_ary) . " + AND ug.user_pending = 0 + AND o.auth_option " . $db->sql_like_expression('m_' . $db->get_any_char()), + ); + $sql = $db->sql_build_query('SELECT', $sql_ary_deny); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (isset($hold_ary[$row['user_id']][$row['forum_id']])) + { + unset($hold_ary[$row['user_id']][$row['forum_id']]); + } + } + $db->sql_freeresult($result); + + if (count($hold_ary)) + { + // Get usernames... + $sql = 'SELECT user_id, username + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', array_keys($hold_ary)); + $result = $db->sql_query($sql); + + $usernames_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $usernames_ary[$row['user_id']] = $row['username']; + } + $db->sql_freeresult($result); + + foreach ($hold_ary as $user_id => $forum_id_ary) + { + // Do not continue if user does not exist + if (!isset($usernames_ary[$user_id])) + { + continue; + } + + foreach ($forum_id_ary as $forum_id => $auth_ary) + { + $sql_ary[] = array( + 'forum_id' => (int) $forum_id, + 'user_id' => (int) $user_id, + 'username' => (string) $usernames_ary[$user_id], + 'group_id' => 0, + 'group_name' => '' + ); + } + } + } + } + + // Now to the groups... + $hold_ary = $auth->acl_group_raw_data(false, 'm_%', false); + + if (!empty($hold_ary)) + { + $ug_id_ary = array_keys($hold_ary); + + // Make sure not hidden or special groups are involved... + $sql = 'SELECT group_name, group_id, group_type + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_id', $ug_id_ary); + $result = $db->sql_query($sql); + + $groupnames_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + if ($row['group_type'] == GROUP_HIDDEN || $row['group_type'] == GROUP_SPECIAL) + { + unset($hold_ary[$row['group_id']]); + } + + $groupnames_ary[$row['group_id']] = $row['group_name']; + } + $db->sql_freeresult($result); + + foreach ($hold_ary as $group_id => $forum_id_ary) + { + // If there is no group, we do not assign it... + if (!isset($groupnames_ary[$group_id])) + { + continue; + } + + foreach ($forum_id_ary as $forum_id => $auth_ary) + { + $flag = false; + foreach ($auth_ary as $auth_option => $setting) + { + // Make sure at least one ACL_YES option is set... + if ($setting == ACL_YES) + { + $flag = true; + break; + } + } + + if (!$flag) + { + continue; + } + + $sql_ary[] = array( + 'forum_id' => (int) $forum_id, + 'user_id' => 0, + 'username' => '', + 'group_id' => (int) $group_id, + 'group_name' => (string) $groupnames_ary[$group_id] + ); + } + } + } + + $db->sql_multi_insert(MODERATOR_CACHE_TABLE, $sql_ary); +} + +/** +* View log +* +* @param string $mode The mode defines which log_type is used and from which log the entry is retrieved +* @param array &$log The result array with the logs +* @param mixed &$log_count If $log_count is set to false, we will skip counting all entries in the database. +* Otherwise an integer with the number of total matching entries is returned. +* @param int $limit Limit the number of entries that are returned +* @param int $offset Offset when fetching the log entries, f.e. when paginating +* @param mixed $forum_id Restrict the log entries to the given forum_id (can also be an array of forum_ids) +* @param int $topic_id Restrict the log entries to the given topic_id +* @param int $user_id Restrict the log entries to the given user_id +* @param int $log_time Only get log entries newer than the given timestamp +* @param string $sort_by SQL order option, e.g. 'l.log_time DESC' +* @param string $keywords Will only return log entries that have the keywords in log_operation or log_data +* +* @return int Returns the offset of the last valid page, if the specified offset was invalid (too high) +*/ +function view_log($mode, &$log, &$log_count, $limit = 0, $offset = 0, $forum_id = 0, $topic_id = 0, $user_id = 0, $limit_days = 0, $sort_by = 'l.log_time DESC', $keywords = '') +{ + global $phpbb_log; + + $count_logs = ($log_count !== false); + + $log = $phpbb_log->get_logs($mode, $count_logs, $limit, $offset, $forum_id, $topic_id, $user_id, $limit_days, $sort_by, $keywords); + $log_count = $phpbb_log->get_log_count(); + + return $phpbb_log->get_valid_offset(); +} + +/** +* Removes moderators and administrators from foe lists. +* +* @param \phpbb\db\driver\driver_interface $db Database connection +* @param \phpbb\auth\auth $auth Authentication object +* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore +* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore +* @return null +*/ +function phpbb_update_foes($db, $auth, $group_id = false, $user_id = false) +{ + // update foes for some user + if (is_array($user_id) && count($user_id)) + { + $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' + WHERE ' . $db->sql_in_set('zebra_id', $user_id) . ' + AND foe = 1'; + $db->sql_query($sql); + return; + } + + // update foes for some group + if (is_array($group_id) && count($group_id)) + { + // Grab group settings... + $sql_ary = array( + 'SELECT' => 'a.group_id', + + 'FROM' => array( + ACL_OPTIONS_TABLE => 'ao', + ACL_GROUPS_TABLE => 'a', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(ACL_ROLES_DATA_TABLE => 'r'), + 'ON' => 'a.auth_role_id = r.role_id', + ), + ), + + 'WHERE' => '(ao.auth_option_id = a.auth_option_id OR ao.auth_option_id = r.auth_option_id) + AND ' . $db->sql_in_set('a.group_id', $group_id) . " + AND ao.auth_option IN ('a_', 'm_')", + + 'GROUP_BY' => 'a.group_id', + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $groups[] = (int) $row['group_id']; + } + $db->sql_freeresult($result); + + if (!count($groups)) + { + return; + } + + switch ($db->get_sql_layer()) + { + case 'mysqli': + case 'mysql4': + $sql = 'DELETE ' . (($db->get_sql_layer() === 'mysqli' || version_compare($db->sql_server_info(true), '4.1', '>=')) ? 'z.*' : ZEBRA_TABLE) . ' + FROM ' . ZEBRA_TABLE . ' z, ' . USER_GROUP_TABLE . ' ug + WHERE z.zebra_id = ug.user_id + AND z.foe = 1 + AND ' . $db->sql_in_set('ug.group_id', $groups); + $db->sql_query($sql); + break; + + default: + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . ' + WHERE ' . $db->sql_in_set('group_id', $groups); + $result = $db->sql_query($sql); + + $users = array(); + while ($row = $db->sql_fetchrow($result)) + { + $users[] = (int) $row['user_id']; + } + $db->sql_freeresult($result); + + if (count($users)) + { + $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' + WHERE ' . $db->sql_in_set('zebra_id', $users) . ' + AND foe = 1'; + $db->sql_query($sql); + } + break; + } + + return; + } + + // update foes for everyone + $perms = array(); + foreach ($auth->acl_get_list(false, array('a_', 'm_'), false) as $forum_id => $forum_ary) + { + foreach ($forum_ary as $auth_option => $user_ary) + { + $perms = array_merge($perms, $user_ary); + } + } + + if (count($perms)) + { + $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' + WHERE ' . $db->sql_in_set('zebra_id', array_unique($perms)) . ' + AND foe = 1'; + $db->sql_query($sql); + } + unset($perms); +} + +/** +* Lists inactive users +*/ +function view_inactive_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_inactive_time DESC') +{ + global $db, $user; + + $sql = 'SELECT COUNT(user_id) AS user_count + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_INACTIVE . + (($limit_days) ? " AND user_inactive_time >= $limit_days" : ''); + $result = $db->sql_query($sql); + $user_count = (int) $db->sql_fetchfield('user_count'); + $db->sql_freeresult($result); + + if ($user_count == 0) + { + // Save the queries, because there are no users to display + return 0; + } + + if ($offset >= $user_count) + { + $offset = ($offset - $limit < 0) ? 0 : $offset - $limit; + } + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_INACTIVE . + (($limit_days) ? " AND user_inactive_time >= $limit_days" : '') . " + ORDER BY $sort_by"; + $result = $db->sql_query_limit($sql, $limit, $offset); + + while ($row = $db->sql_fetchrow($result)) + { + $row['inactive_reason'] = $user->lang['INACTIVE_REASON_UNKNOWN']; + switch ($row['user_inactive_reason']) + { + case INACTIVE_REGISTER: + $row['inactive_reason'] = $user->lang['INACTIVE_REASON_REGISTER']; + break; + + case INACTIVE_PROFILE: + $row['inactive_reason'] = $user->lang['INACTIVE_REASON_PROFILE']; + break; + + case INACTIVE_MANUAL: + $row['inactive_reason'] = $user->lang['INACTIVE_REASON_MANUAL']; + break; + + case INACTIVE_REMIND: + $row['inactive_reason'] = $user->lang['INACTIVE_REASON_REMIND']; + break; + } + + $users[] = $row; + } + $db->sql_freeresult($result); + + return $offset; +} + +/** +* Lists warned users +*/ +function view_warned_users(&$users, &$user_count, $limit = 0, $offset = 0, $limit_days = 0, $sort_by = 'user_warnings DESC') +{ + global $db; + + $sql = 'SELECT user_id, username, user_colour, user_warnings, user_last_warning + FROM ' . USERS_TABLE . ' + WHERE user_warnings > 0 + ' . (($limit_days) ? "AND user_last_warning >= $limit_days" : '') . " + ORDER BY $sort_by"; + $result = $db->sql_query_limit($sql, $limit, $offset); + $users = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + $sql = 'SELECT count(user_id) AS user_count + FROM ' . USERS_TABLE . ' + WHERE user_warnings > 0 + ' . (($limit_days) ? "AND user_last_warning >= $limit_days" : ''); + $result = $db->sql_query($sql); + $user_count = (int) $db->sql_fetchfield('user_count'); + $db->sql_freeresult($result); + + return; +} + +/** +* Get database size +* Currently only mysql and mssql are supported +*/ +function get_database_size() +{ + global $db, $user, $table_prefix; + + $database_size = false; + + // This code is heavily influenced by a similar routine in phpMyAdmin 2.2.0 + switch ($db->get_sql_layer()) + { + case 'mysql': + case 'mysql4': + case 'mysqli': + $sql = 'SELECT VERSION() AS mysql_version'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $version = $row['mysql_version']; + + if (preg_match('#(3\.23|[45]\.|10\.[0-9]\.[0-9]{1,2}-+Maria)#', $version)) + { + $db_name = (preg_match('#^(?:3\.23\.(?:[6-9]|[1-9]{2}))|[45]\.|10\.[0-9]\.[0-9]{1,2}-+Maria#', $version)) ? "`{$db->get_db_name()}`" : $db->get_db_name(); + + $sql = 'SHOW TABLE STATUS + FROM ' . $db_name; + $result = $db->sql_query($sql, 7200); + + $database_size = 0; + while ($row = $db->sql_fetchrow($result)) + { + if ((isset($row['Type']) && $row['Type'] != 'MRG_MyISAM') || (isset($row['Engine']) && ($row['Engine'] == 'MyISAM' || $row['Engine'] == 'InnoDB' || $row['Engine'] == 'Aria'))) + { + if ($table_prefix != '') + { + if (strpos($row['Name'], $table_prefix) !== false) + { + $database_size += $row['Data_length'] + $row['Index_length']; + } + } + else + { + $database_size += $row['Data_length'] + $row['Index_length']; + } + } + } + $db->sql_freeresult($result); + } + } + break; + + case 'sqlite3': + global $dbhost; + + if (file_exists($dbhost)) + { + $database_size = filesize($dbhost); + } + + break; + + case 'mssql_odbc': + case 'mssqlnative': + $sql = 'SELECT @@VERSION AS mssql_version'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $sql = 'SELECT ((SUM(size) * 8.0) * 1024.0) as dbsize + FROM sysfiles'; + + if ($row) + { + // Azure stats are stored elsewhere + if (strpos($row['mssql_version'], 'SQL Azure') !== false) + { + $sql = 'SELECT ((SUM(reserved_page_count) * 8.0) * 1024.0) as dbsize + FROM sys.dm_db_partition_stats'; + } + } + + $result = $db->sql_query($sql, 7200); + $database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false; + $db->sql_freeresult($result); + break; + + case 'postgres': + $sql = "SELECT proname + FROM pg_proc + WHERE proname = 'pg_database_size'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row['proname'] == 'pg_database_size') + { + $database = $db->get_db_name(); + if (strpos($database, '.') !== false) + { + list($database, ) = explode('.', $database); + } + + $sql = "SELECT oid + FROM pg_database + WHERE datname = '$database'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $oid = $row['oid']; + + $sql = 'SELECT pg_database_size(' . $oid . ') as size'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $database_size = $row['size']; + } + break; + + case 'oracle': + $sql = 'SELECT SUM(bytes) as dbsize + FROM user_segments'; + $result = $db->sql_query($sql, 7200); + $database_size = ($row = $db->sql_fetchrow($result)) ? $row['dbsize'] : false; + $db->sql_freeresult($result); + break; + } + + $database_size = ($database_size !== false) ? get_formatted_filesize($database_size) : $user->lang['NOT_AVAILABLE']; + + return $database_size; +} + +/* +* Tidy Warnings +* Remove all warnings which have now expired from the database +* The duration of a warning can be defined by the administrator +* This only removes the warning and reduces the associated count, +* it does not remove the user note recording the contents of the warning +*/ +function tidy_warnings() +{ + global $db, $config; + + $expire_date = time() - ($config['warnings_expire_days'] * 86400); + $warning_list = $user_list = array(); + + $sql = 'SELECT * FROM ' . WARNINGS_TABLE . " + WHERE warning_time < $expire_date"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $warning_list[] = $row['warning_id']; + $user_list[$row['user_id']] = isset($user_list[$row['user_id']]) ? ++$user_list[$row['user_id']] : 1; + } + $db->sql_freeresult($result); + + if (count($warning_list)) + { + $db->sql_transaction('begin'); + + $sql = 'DELETE FROM ' . WARNINGS_TABLE . ' + WHERE ' . $db->sql_in_set('warning_id', $warning_list); + $db->sql_query($sql); + + foreach ($user_list as $user_id => $value) + { + $sql = 'UPDATE ' . USERS_TABLE . " SET user_warnings = user_warnings - $value + WHERE user_id = $user_id"; + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + } + + $config->set('warnings_last_gc', time(), false); +} + +/** +* Tidy database, doing some maintanance tasks +*/ +function tidy_database() +{ + global $config, $db; + + // Here we check permission consistency + + // Sometimes, it can happen permission tables having forums listed which do not exist + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + + $forum_ids = array(0); + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + $db->sql_transaction('begin'); + + // Delete those rows from the acl tables not having listed the forums above + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids, true); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . ACL_USERS_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $forum_ids, true); + $db->sql_query($sql); + + $db->sql_transaction('commit'); + + $config->set('database_last_gc', time(), false); +} + +/** +* Add permission language - this will make sure custom files will be included +*/ +function add_permission_language() +{ + global $user, $phpEx, $phpbb_extension_manager; + + // add permission language files from extensions + $finder = $phpbb_extension_manager->get_finder(); + + $lang_files = $finder + ->prefix('permissions_') + ->suffix(".$phpEx") + ->core_path('language/') + ->extension_directory('/language') + ->find(); + + foreach ($lang_files as $lang_file => $ext_name) + { + if ($ext_name === '/') + { + $user->add_lang($lang_file); + } + else + { + $user->add_lang_ext($ext_name, $lang_file); + } + } +} + +/** + * Enables a particular flag in a bitfield column of a given table. + * + * @param string $table_name The table to update + * @param string $column_name The column containing a bitfield to update + * @param int $flag The binary flag which is OR-ed with the current column value + * @param string $sql_more This string is attached to the sql query generated to update the table. + * + * @return null + */ +function enable_bitfield_column_flag($table_name, $column_name, $flag, $sql_more = '') +{ + global $db; + + $sql = 'UPDATE ' . $table_name . ' + SET ' . $column_name . ' = ' . $db->sql_bit_or($column_name, $flag) . ' + ' . $sql_more; + $db->sql_query($sql); +} diff --git a/install/update/old/includes/functions_compatibility.php b/install/update/old/includes/functions_compatibility.php new file mode 100644 index 0000000..e95fa40 --- /dev/null +++ b/install/update/old/includes/functions_compatibility.php @@ -0,0 +1,513 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Get user avatar +* +* @deprecated 3.1.0-a1 (To be removed: 3.3.0) +* +* @param string $avatar Users assigned avatar name +* @param int $avatar_type Type of avatar +* @param string $avatar_width Width of users avatar +* @param string $avatar_height Height of users avatar +* @param string $alt Optional language string for alt tag within image, can be a language key or text +* @param bool $ignore_config Ignores the config-setting, to be still able to view the avatar in the UCP +* @param bool $lazy If true, will be lazy loaded (requires JS) +* +* @return string Avatar image +*/ +function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false, $lazy = false) +{ + // map arguments to new function phpbb_get_avatar() + $row = array( + 'avatar' => $avatar, + 'avatar_type' => $avatar_type, + 'avatar_width' => $avatar_width, + 'avatar_height' => $avatar_height, + ); + + return phpbb_get_avatar($row, $alt, $ignore_config, $lazy); +} + +/** +* Hash the password +* +* @deprecated 3.1.0-a2 (To be removed: 3.3.0) +* +* @param string $password Password to be hashed +* +* @return string|bool Password hash or false if something went wrong during hashing +*/ +function phpbb_hash($password) +{ + global $phpbb_container; + + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + return $passwords_manager->hash($password); +} + +/** +* Check for correct password +* +* @deprecated 3.1.0-a2 (To be removed: 3.3.0) +* +* @param string $password The password in plain text +* @param string $hash The stored password hash +* +* @return bool Returns true if the password is correct, false if not. +*/ +function phpbb_check_hash($password, $hash) +{ + global $phpbb_container; + + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + return $passwords_manager->check($password, $hash); +} + +/** +* Eliminates useless . and .. components from specified path. +* +* Deprecated, use filesystem class instead +* +* @param string $path Path to clean +* @return string Cleaned path +* +* @deprecated 3.1.0 (To be removed: 3.3.0) +*/ +function phpbb_clean_path($path) +{ + global $phpbb_path_helper, $phpbb_container; + + if (!$phpbb_path_helper && $phpbb_container) + { + /* @var $phpbb_path_helper \phpbb\path_helper */ + $phpbb_path_helper = $phpbb_container->get('path_helper'); + } + else if (!$phpbb_path_helper) + { + global $phpbb_root_path, $phpEx; + + // The container is not yet loaded, use a new instance + if (!class_exists('\phpbb\path_helper')) + { + require($phpbb_root_path . 'phpbb/path_helper.' . $phpEx); + } + + $request = new phpbb\request\request(); + $phpbb_path_helper = new phpbb\path_helper( + new phpbb\symfony_request( + $request + ), + new phpbb\filesystem\filesystem(), + $request, + $phpbb_root_path, + $phpEx + ); + } + + return $phpbb_path_helper->clean_path($path); +} + +/** +* Pick a timezone +* +* @param string $default A timezone to select +* @param boolean $truncate Shall we truncate the options text +* +* @return string Returns the options for timezone selector only +* +* @deprecated 3.1.0 (To be removed: 3.3.0) +*/ +function tz_select($default = '', $truncate = false) +{ + global $template, $user; + + return phpbb_timezone_select($template, $user, $default, $truncate); +} + +/** +* Cache moderators. Called whenever permissions are changed +* via admin_permissions. Changes of usernames and group names +* must be carried through for the moderators table. +* +* @deprecated 3.1.0 (To be removed: 3.3.0) +* @return null +*/ +function cache_moderators() +{ + global $db, $cache, $auth; + return phpbb_cache_moderators($db, $cache, $auth); +} + +/** +* Removes moderators and administrators from foe lists. +* +* @deprecated 3.1.0 (To be removed: 3.3.0) +* @param array|bool $group_id If an array, remove all members of this group from foe lists, or false to ignore +* @param array|bool $user_id If an array, remove this user from foe lists, or false to ignore +* @return null +*/ +function update_foes($group_id = false, $user_id = false) +{ + global $db, $auth; + return phpbb_update_foes($db, $auth, $group_id, $user_id); +} + +/** +* Get user rank title and image +* +* @param int $user_rank the current stored users rank id +* @param int $user_posts the users number of posts +* @param string &$rank_title the rank title will be stored here after execution +* @param string &$rank_img the rank image as full img tag is stored here after execution +* @param string &$rank_img_src the rank image source is stored here after execution +* +* @deprecated 3.1.0-RC5 (To be removed: 3.3.0) +* +* Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false +*/ +function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank_img_src) +{ + global $phpbb_root_path, $phpEx; + if (!function_exists('phpbb_get_user_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $rank_data = phpbb_get_user_rank(array('user_rank' => $user_rank), $user_posts); + $rank_title = $rank_data['title']; + $rank_img = $rank_data['img']; + $rank_img_src = $rank_data['img_src']; +} + +/** + * Retrieve contents from remotely stored file + * + * @deprecated 3.1.2 Use file_downloader instead + */ +function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6) +{ + global $phpbb_container; + + // Get file downloader and assign $errstr and $errno + /* @var $file_downloader \phpbb\file_downloader */ + $file_downloader = $phpbb_container->get('file_downloader'); + + $file_data = $file_downloader->get($host, $directory, $filename, $port, $timeout); + $errstr = $file_downloader->get_error_string(); + $errno = $file_downloader->get_error_number(); + + return $file_data; +} + +/** + * Add log entry + * + * @param string $mode The mode defines which log_type is used and from which log the entry is retrieved + * @param int $forum_id Mode 'mod' ONLY: forum id of the related item, NOT INCLUDED otherwise + * @param int $topic_id Mode 'mod' ONLY: topic id of the related item, NOT INCLUDED otherwise + * @param int $reportee_id Mode 'user' ONLY: user id of the reportee, NOT INCLUDED otherwise + * @param string $log_operation Name of the operation + * @param array $additional_data More arguments can be added, depending on the log_type + * + * @return int|bool Returns the log_id, if the entry was added to the database, false otherwise. + * + * @deprecated 3.1.0 (To be removed: 3.3.0) + */ +function add_log() +{ + global $phpbb_log, $user; + + $args = func_get_args(); + $mode = array_shift($args); + + // This looks kind of dirty, but add_log has some additional data before the log_operation + $additional_data = array(); + switch ($mode) + { + case 'admin': + case 'critical': + break; + case 'mod': + $additional_data['forum_id'] = array_shift($args); + $additional_data['topic_id'] = array_shift($args); + break; + case 'user': + $additional_data['reportee_id'] = array_shift($args); + break; + } + + $log_operation = array_shift($args); + $additional_data = array_merge($additional_data, $args); + + $user_id = (empty($user->data)) ? ANONYMOUS : $user->data['user_id']; + $user_ip = (empty($user->ip)) ? '' : $user->ip; + + return $phpbb_log->add($mode, $user_id, $user_ip, $log_operation, time(), $additional_data); +} + +/** + * Sets a configuration option's value. + * + * Please note that this function does not update the is_dynamic value for + * an already existing config option. + * + * @param string $config_name The configuration option's name + * @param string $config_value New configuration value + * @param bool $is_dynamic Whether this variable should be cached (false) or + * if it changes too frequently (true) to be + * efficiently cached. + * + * @return null + * + * @deprecated 3.1.0 (To be removed: 3.3.0) + */ +function set_config($config_name, $config_value, $is_dynamic = false, \phpbb\config\config $set_config = null) +{ + static $config = null; + + if ($set_config !== null) + { + $config = $set_config; + + if (empty($config_name)) + { + return; + } + } + + $config->set($config_name, $config_value, !$is_dynamic); +} + +/** + * Increments an integer config value directly in the database. + * + * @param string $config_name The configuration option's name + * @param int $increment Amount to increment by + * @param bool $is_dynamic Whether this variable should be cached (false) or + * if it changes too frequently (true) to be + * efficiently cached. + * + * @return null + * + * @deprecated 3.1.0 (To be removed: 3.3.0) + */ +function set_config_count($config_name, $increment, $is_dynamic = false, \phpbb\config\config $set_config = null) +{ + static $config = null; + if ($set_config !== null) + { + $config = $set_config; + if (empty($config_name)) + { + return; + } + } + $config->increment($config_name, $increment, !$is_dynamic); +} + +/** + * Wrapper function of \phpbb\request\request::variable which exists for backwards compatability. + * See {@link \phpbb\request\request_interface::variable \phpbb\request\request_interface::variable} for + * documentation of this function's use. + * + * @deprecated 3.1.0 (To be removed: 3.3.0) + * @param mixed $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * If you pass an instance of {@link \phpbb\request\request_interface phpbb_request_interface} + * as this parameter it will overwrite the current request class instance. If you do + * not do so, it will create its own instance (but leave superglobals enabled). + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param bool $cookie This param is mapped to \phpbb\request\request_interface::COOKIE as the last param for + * \phpbb\request\request_interface::variable for backwards compatability reasons. + * @param \phpbb\request\request_interface|null|false If an instance of \phpbb\request\request_interface is given the instance is stored in + * a static variable and used for all further calls where this parameters is null. Until + * the function is called with an instance it automatically creates a new \phpbb\request\request + * instance on every call. By passing false this per-call instantiation can be restored + * after having passed in a \phpbb\request\request_interface instance. + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ +function request_var($var_name, $default, $multibyte = false, $cookie = false, $request = null) +{ + // This is all just an ugly hack to add "Dependency Injection" to a function + // the only real code is the function call which maps this function to a method. + static $static_request = null; + if ($request instanceof \phpbb\request\request_interface) + { + $static_request = $request; + if (empty($var_name)) + { + return; + } + } + else if ($request === false) + { + $static_request = null; + if (empty($var_name)) + { + return; + } + } + $tmp_request = $static_request; + // no request class set, create a temporary one ourselves to keep backwards compatibility + if ($tmp_request === null) + { + // false param: enable super globals, so the created request class does not + // make super globals inaccessible everywhere outside this function. + $tmp_request = new \phpbb\request\request(new \phpbb\request\type_cast_helper(), false); + } + return $tmp_request->variable($var_name, $default, $multibyte, ($cookie) ? \phpbb\request\request_interface::COOKIE : \phpbb\request\request_interface::REQUEST); +} + +/** + * Get tables of a database + * + * @deprecated 3.1.0 (To be removed: 3.3.0) + */ +function get_tables($db) +{ + $db_tools_factory = new \phpbb\db\tools\factory(); + $db_tools = $db_tools_factory->get($db); + + return $db_tools->sql_list_tables(); +} + +/** + * Global function for chmodding directories and files for internal use + * + * This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions. + * The function determines owner and group from common.php file and sets the same to the provided file. + * The function uses bit fields to build the permissions. + * The function sets the appropiate execute bit on directories. + * + * Supported constants representing bit fields are: + * + * CHMOD_ALL - all permissions (7) + * CHMOD_READ - read permission (4) + * CHMOD_WRITE - write permission (2) + * CHMOD_EXECUTE - execute permission (1) + * + * NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions. + * + * @param string $filename The file/directory to be chmodded + * @param int $perms Permissions to set + * + * @return bool true on success, otherwise false + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::phpbb_chmod() instead + */ +function phpbb_chmod($filename, $perms = CHMOD_READ) +{ + global $phpbb_filesystem; + + try + { + $phpbb_filesystem->phpbb_chmod($filename, $perms); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + return false; + } + + return true; +} + +/** + * Test if a file/directory is writable + * + * This function calls the native is_writable() when not running under + * Windows and it is not disabled. + * + * @param string $file Path to perform write test on + * @return bool True when the path is writable, otherwise false. + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::is_writable() instead + */ +function phpbb_is_writable($file) +{ + global $phpbb_filesystem; + + return $phpbb_filesystem->is_writable($file); +} + +/** + * Checks if a path ($path) is absolute or relative + * + * @param string $path Path to check absoluteness of + * @return boolean + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::is_absolute_path() instead + */ +function phpbb_is_absolute($path) +{ + global $phpbb_filesystem; + + return $phpbb_filesystem->is_absolute_path($path); +} + +/** + * A wrapper for realpath + * + * @deprecated 3.2.0-dev use \phpbb\filesystem\filesystem::realpath() instead + */ +function phpbb_realpath($path) +{ + global $phpbb_filesystem; + + return $phpbb_filesystem->realpath($path); +} + +/** + * Determine which plural form we should use. + * For some languages this is not as simple as for English. + * + * @param $rule int ID of the plural rule we want to use, see https://area51.phpbb.com/docs/dev/32x/language/plurals.html + * @param $number int|float The number we want to get the plural case for. Float numbers are floored. + * @return int The plural-case we need to use for the number plural-rule combination + * + * @deprecated 3.2.0-dev (To be removed: 3.3.0) + */ +function phpbb_get_plural_form($rule, $number) +{ + global $phpbb_container; + + /** @var \phpbb\language\language $language */ + $language = $phpbb_container->get('language'); + return $language->get_plural_form($number, $rule); +} + +/** +* @return bool Always true +* @deprecated 3.2.0-dev +*/ +function phpbb_pcre_utf8_support() +{ + return true; +} diff --git a/install/update/old/includes/functions_compress.php b/install/update/old/includes/functions_compress.php new file mode 100644 index 0000000..e86da77 --- /dev/null +++ b/install/update/old/includes/functions_compress.php @@ -0,0 +1,830 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Class for handling archives (compression/decompression) +*/ +class compress +{ + var $fp = 0; + + /** + * @var array + */ + protected $filelist = array(); + + /** + * Add file to archive + */ + function add_file($src, $src_rm_prefix = '', $src_add_prefix = '', $skip_files = '') + { + global $phpbb_root_path; + + $skip_files = explode(',', $skip_files); + + // Remove rm prefix from src path + $src_path = ($src_rm_prefix) ? preg_replace('#^(' . preg_quote($src_rm_prefix, '#') . ')#', '', $src) : $src; + // Add src prefix + $src_path = ($src_add_prefix) ? ($src_add_prefix . ((substr($src_add_prefix, -1) != '/') ? '/' : '') . $src_path) : $src_path; + // Remove initial "/" if present + $src_path = (substr($src_path, 0, 1) == '/') ? substr($src_path, 1) : $src_path; + + if (is_file($phpbb_root_path . $src)) + { + $this->data($src_path, file_get_contents("$phpbb_root_path$src"), stat("$phpbb_root_path$src"), false); + } + else if (is_dir($phpbb_root_path . $src)) + { + // Clean up path, add closing / if not present + $src_path = ($src_path && substr($src_path, -1) != '/') ? $src_path . '/' : $src_path; + + $filelist = filelist("$phpbb_root_path$src", '', '*'); + krsort($filelist); + + /** + * Commented out, as adding the folders produces corrupted archives + if ($src_path) + { + $this->data($src_path, '', true, stat("$phpbb_root_path$src")); + } + */ + + foreach ($filelist as $path => $file_ary) + { + /** + * Commented out, as adding the folders produces corrupted archives + if ($path) + { + // Same as for src_path + $path = (substr($path, 0, 1) == '/') ? substr($path, 1) : $path; + $path = ($path && substr($path, -1) != '/') ? $path . '/' : $path; + + $this->data("$src_path$path", '', true, stat("$phpbb_root_path$src$path")); + } + */ + + foreach ($file_ary as $file) + { + if (in_array($path . $file, $skip_files)) + { + continue; + } + + $this->data("$src_path$path$file", file_get_contents("$phpbb_root_path$src$path$file"), stat("$phpbb_root_path$src$path$file"), false); + } + } + } + else + { + // $src does not exist + return false; + } + + return true; + } + + /** + * Add custom file (the filepath will not be adjusted) + */ + function add_custom_file($src, $filename) + { + if (!file_exists($src)) + { + return false; + } + + $this->data($filename, file_get_contents($src), stat($src), false); + return true; + } + + /** + * Add file data + */ + function add_data($src, $name) + { + $stat = array(); + $stat[2] = 436; //384 + $stat[4] = $stat[5] = 0; + $stat[7] = strlen($src); + $stat[9] = time(); + $this->data($name, $src, $stat, false); + return true; + } + + /** + * Checks if a file by that name as already been added and, if it has, + * returns a new, unique name. + * + * @param string $name The filename + * @return string A unique filename + */ + protected function unique_filename($name) + { + if (isset($this->filelist[$name])) + { + $start = $name; + $ext = ''; + $this->filelist[$name]++; + + // Separate the extension off the end of the filename to preserve it + $pos = strrpos($name, '.'); + if ($pos !== false) + { + $start = substr($name, 0, $pos); + $ext = substr($name, $pos); + } + + return $start . '_' . $this->filelist[$name] . $ext; + } + + $this->filelist[$name] = 0; + return $name; + } + + /** + * Return available methods + * + * @return array Array of strings of available compression methods (.tar, .tar.gz, .zip, etc.) + */ + static public function methods() + { + $methods = array('.tar'); + $available_methods = array('.tar.gz' => 'zlib', '.tar.bz2' => 'bz2', '.zip' => 'zlib'); + + foreach ($available_methods as $type => $module) + { + if (!@extension_loaded($module)) + { + continue; + } + $methods[] = $type; + } + + return $methods; + } +} + +/** +* Zip creation class from phpMyAdmin 2.3.0 (c) Tobias Ratschiller, Olivier Müller, Loïc Chapeaux, +* Marc Delisle, http://www.phpmyadmin.net/ +* +* Zip extraction function by Alexandre Tedeschi, alexandrebr at gmail dot com +* +* Modified extensively by psoTFX and DavidMJ, (c) phpBB Limited, 2003 +* +* Based on work by Eric Mueller and Denis125 +* Official ZIP file format: http://www.pkware.com/appnote.txt +*/ +class compress_zip extends compress +{ + var $datasec = array(); + var $ctrl_dir = array(); + var $eof_cdh = "\x50\x4b\x05\x06\x00\x00\x00\x00"; + + var $old_offset = 0; + var $datasec_len = 0; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Constructor + */ + function __construct($mode, $file) + { + global $phpbb_filesystem; + + $this->fp = @fopen($file, $mode . 'b'); + $this->filesystem = ($phpbb_filesystem instanceof \phpbb\filesystem\filesystem_interface) ? $phpbb_filesystem : new \phpbb\filesystem\filesystem(); + + if (!$this->fp) + { + trigger_error('Unable to open file ' . $file . ' [' . $mode . 'b]'); + } + } + + /** + * Convert unix to dos time + */ + function unix_to_dos_time($time) + { + $timearray = (!$time) ? getdate() : getdate($time); + + if ($timearray['year'] < 1980) + { + $timearray['year'] = 1980; + $timearray['mon'] = $timearray['mday'] = 1; + $timearray['hours'] = $timearray['minutes'] = $timearray['seconds'] = 0; + } + + return (($timearray['year'] - 1980) << 25) | ($timearray['mon'] << 21) | ($timearray['mday'] << 16) | ($timearray['hours'] << 11) | ($timearray['minutes'] << 5) | ($timearray['seconds'] >> 1); + } + + /** + * Extract archive + */ + function extract($dst) + { + // Loop the file, looking for files and folders + $dd_try = false; + rewind($this->fp); + + while (!feof($this->fp)) + { + // Check if the signature is valid... + $signature = fread($this->fp, 4); + + switch ($signature) + { + // 'Local File Header' + case "\x50\x4b\x03\x04": + // Lets get everything we need. + // We don't store the version needed to extract, the general purpose bit flag or the date and time fields + $data = unpack("@4/vc_method/@10/Vcrc/Vc_size/Vuc_size/vname_len/vextra_field", fread($this->fp, 26)); + $file_name = fread($this->fp, $data['name_len']); // filename + + if ($data['extra_field']) + { + fread($this->fp, $data['extra_field']); // extra field + } + + $target_filename = "$dst$file_name"; + + if (!$data['uc_size'] && !$data['crc'] && substr($file_name, -1, 1) == '/') + { + if (!is_dir($target_filename)) + { + $str = ''; + $folders = explode('/', $target_filename); + + // Create and folders and subfolders if they do not exist + foreach ($folders as $folder) + { + $folder = trim($folder); + if (!$folder) + { + continue; + } + + $str = (!empty($str)) ? $str . '/' . $folder : $folder; + if (!is_dir($str)) + { + if (!@mkdir($str, 0777)) + { + trigger_error("Could not create directory $folder"); + } + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + } + // This is a directory, we are not writting files + continue; + } + else + { + // Some archivers are punks, they don't include folders in their archives! + $str = ''; + $folders = explode('/', pathinfo($target_filename, PATHINFO_DIRNAME)); + + // Create and folders and subfolders if they do not exist + foreach ($folders as $folder) + { + $folder = trim($folder); + if (!$folder) + { + continue; + } + + $str = (!empty($str)) ? $str . '/' . $folder : $folder; + if (!is_dir($str)) + { + if (!@mkdir($str, 0777)) + { + trigger_error("Could not create directory $folder"); + } + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + } + + if (!$data['uc_size']) + { + $content = ''; + } + else + { + $content = fread($this->fp, $data['c_size']); + } + + $fp = fopen($target_filename, "w"); + + switch ($data['c_method']) + { + case 0: + // Not compressed + fwrite($fp, $content); + break; + + case 8: + // Deflate + fwrite($fp, gzinflate($content, $data['uc_size'])); + break; + + case 12: + // Bzip2 + fwrite($fp, bzdecompress($content)); + break; + } + + fclose($fp); + break; + + // We hit the 'Central Directory Header', we can stop because nothing else in here requires our attention + // or we hit the end of the central directory record, we can safely end the loop as we are totally finished with looking for files and folders + case "\x50\x4b\x01\x02": + // This case should simply never happen.. but it does exist.. + case "\x50\x4b\x05\x06": + break 2; + + // 'Packed to Removable Disk', ignore it and look for the next signature... + case 'PK00': + continue 2; + + // We have encountered a header that is weird. Lets look for better data... + default: + if (!$dd_try) + { + // Unexpected header. Trying to detect wrong placed 'Data Descriptor'; + $dd_try = true; + fseek($this->fp, 8, SEEK_CUR); // Jump over 'crc-32'(4) 'compressed-size'(4), 'uncompressed-size'(4) + continue 2; + } + trigger_error("Unexpected header, ending loop"); + break 2; + } + + $dd_try = false; + } + } + + /** + * Close archive + */ + function close() + { + // Write out central file directory and footer ... if it exists + if (count($this->ctrl_dir)) + { + fwrite($this->fp, $this->file()); + } + fclose($this->fp); + } + + /** + * Create the structures ... note we assume version made by is MSDOS + */ + function data($name, $data, $stat, $is_dir = false) + { + $name = str_replace('\\', '/', $name); + $name = $this->unique_filename($name); + + $hexdtime = pack('V', $this->unix_to_dos_time($stat[9])); + + if ($is_dir) + { + $unc_len = $c_len = $crc = 0; + $zdata = ''; + $var_ext = 10; + } + else + { + $unc_len = strlen($data); + $crc = crc32($data); + $zdata = gzdeflate($data); + $c_len = strlen($zdata); + $var_ext = 20; + + // Did we compress? No, then use data as is + if ($c_len >= $unc_len) + { + $zdata = $data; + $c_len = $unc_len; + $var_ext = 10; + } + } + unset($data); + + // If we didn't compress set method to store, else deflate + $c_method = ($c_len == $unc_len) ? "\x00\x00" : "\x08\x00"; + + // Are we a file or a directory? Set archive for file + $attrib = ($is_dir) ? 16 : 32; + + // File Record Header + $fr = "\x50\x4b\x03\x04"; // Local file header 4bytes + $fr .= pack('v', $var_ext); // ver needed to extract 2bytes + $fr .= "\x00\x00"; // gen purpose bit flag 2bytes + $fr .= $c_method; // compression method 2bytes + $fr .= $hexdtime; // last mod time and date 2+2bytes + $fr .= pack('V', $crc); // crc32 4bytes + $fr .= pack('V', $c_len); // compressed filesize 4bytes + $fr .= pack('V', $unc_len); // uncompressed filesize 4bytes + $fr .= pack('v', strlen($name));// length of filename 2bytes + + $fr .= pack('v', 0); // extra field length 2bytes + $fr .= $name; + $fr .= $zdata; + unset($zdata); + + $this->datasec_len += strlen($fr); + + // Add data to file ... by writing data out incrementally we save some memory + fwrite($this->fp, $fr); + unset($fr); + + // Central Directory Header + $cdrec = "\x50\x4b\x01\x02"; // header 4bytes + $cdrec .= "\x00\x00"; // version made by + $cdrec .= pack('v', $var_ext); // version needed to extract + $cdrec .= "\x00\x00"; // gen purpose bit flag + $cdrec .= $c_method; // compression method + $cdrec .= $hexdtime; // last mod time & date + $cdrec .= pack('V', $crc); // crc32 + $cdrec .= pack('V', $c_len); // compressed filesize + $cdrec .= pack('V', $unc_len); // uncompressed filesize + $cdrec .= pack('v', strlen($name)); // length of filename + $cdrec .= pack('v', 0); // extra field length + $cdrec .= pack('v', 0); // file comment length + $cdrec .= pack('v', 0); // disk number start + $cdrec .= pack('v', 0); // internal file attributes + $cdrec .= pack('V', $attrib); // external file attributes + $cdrec .= pack('V', $this->old_offset); // relative offset of local header + $cdrec .= $name; + + // Save to central directory + $this->ctrl_dir[] = $cdrec; + + $this->old_offset = $this->datasec_len; + } + + /** + * file + */ + function file() + { + $ctrldir = implode('', $this->ctrl_dir); + + return $ctrldir . $this->eof_cdh . + pack('v', count($this->ctrl_dir)) . // total # of entries "on this disk" + pack('v', count($this->ctrl_dir)) . // total # of entries overall + pack('V', strlen($ctrldir)) . // size of central dir + pack('V', $this->datasec_len) . // offset to start of central dir + "\x00\x00"; // .zip file comment length + } + + /** + * Download archive + */ + function download($filename, $download_name = false) + { + global $phpbb_root_path; + + if ($download_name === false) + { + $download_name = $filename; + } + + $mimetype = 'application/zip'; + + header('Cache-Control: private, no-cache'); + header("Content-Type: $mimetype; name=\"$download_name.zip\""); + header("Content-disposition: attachment; filename=$download_name.zip"); + + $fp = @fopen("{$phpbb_root_path}store/$filename.zip", 'rb'); + if ($fp) + { + while ($buffer = fread($fp, 1024)) + { + echo $buffer; + } + fclose($fp); + } + } +} + +/** +* Tar/tar.gz compression routine +* Header/checksum creation derived from tarfile.pl, (c) Tom Horsley, 1994 +*/ +class compress_tar extends compress +{ + var $isgz = false; + var $isbz = false; + var $filename = ''; + var $mode = ''; + var $type = ''; + var $wrote = false; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Constructor + */ + function __construct($mode, $file, $type = '') + { + global $phpbb_filesystem; + + $type = (!$type) ? $file : $type; + $this->isgz = preg_match('#(\.tar\.gz|\.tgz)$#', $type); + $this->isbz = preg_match('#\.tar\.bz2$#', $type); + + $this->mode = &$mode; + $this->file = &$file; + $this->type = &$type; + $this->open(); + + $this->filesystem = ($phpbb_filesystem instanceof \phpbb\filesystem\filesystem_interface) ? $phpbb_filesystem : new \phpbb\filesystem\filesystem(); + } + + /** + * Extract archive + */ + function extract($dst) + { + $fzread = ($this->isbz && function_exists('bzread')) ? 'bzread' : (($this->isgz && @extension_loaded('zlib')) ? 'gzread' : 'fread'); + + // Run through the file and grab directory entries + while ($buffer = $fzread($this->fp, 512)) + { + $tmp = unpack('A6magic', substr($buffer, 257, 6)); + + if (trim($tmp['magic']) == 'ustar') + { + $tmp = unpack('A100name', $buffer); + $filename = trim($tmp['name']); + + $tmp = unpack('Atype', substr($buffer, 156, 1)); + $filetype = (int) trim($tmp['type']); + + $tmp = unpack('A12size', substr($buffer, 124, 12)); + $filesize = octdec((int) trim($tmp['size'])); + + $target_filename = "$dst$filename"; + + if ($filetype == 5) + { + if (!is_dir($target_filename)) + { + $str = ''; + $folders = explode('/', $target_filename); + + // Create and folders and subfolders if they do not exist + foreach ($folders as $folder) + { + $folder = trim($folder); + if (!$folder) + { + continue; + } + + $str = (!empty($str)) ? $str . '/' . $folder : $folder; + if (!is_dir($str)) + { + if (!@mkdir($str, 0777)) + { + trigger_error("Could not create directory $folder"); + } + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + } + } + else if ($filesize >= 0 && ($filetype == 0 || $filetype == "\0")) + { + // Some archivers are punks, they don't properly order the folders in their archives! + $str = ''; + $folders = explode('/', pathinfo($target_filename, PATHINFO_DIRNAME)); + + // Create and folders and subfolders if they do not exist + foreach ($folders as $folder) + { + $folder = trim($folder); + if (!$folder) + { + continue; + } + + $str = (!empty($str)) ? $str . '/' . $folder : $folder; + if (!is_dir($str)) + { + if (!@mkdir($str, 0777)) + { + trigger_error("Could not create directory $folder"); + } + + try + { + $this->filesystem->phpbb_chmod($str, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + + // Write out the files + if (!($fp = fopen($target_filename, 'wb'))) + { + trigger_error("Couldn't create file $filename"); + } + + try + { + $this->filesystem->phpbb_chmod($target_filename, CHMOD_READ); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + + // Grab the file contents + fwrite($fp, ($filesize) ? $fzread($this->fp, ($filesize + 511) &~ 511) : '', $filesize); + fclose($fp); + } + } + } + } + + /** + * Close archive + */ + function close() + { + $fzclose = ($this->isbz && function_exists('bzclose')) ? 'bzclose' : (($this->isgz && @extension_loaded('zlib')) ? 'gzclose' : 'fclose'); + + if ($this->wrote) + { + $fzwrite = ($this->isbz && function_exists('bzwrite')) ? 'bzwrite' : (($this->isgz && @extension_loaded('zlib')) ? 'gzwrite' : 'fwrite'); + + // The end of a tar archive ends in two records of all NULLs (1024 bytes of \0) + $fzwrite($this->fp, str_repeat("\0", 1024)); + } + + $fzclose($this->fp); + } + + /** + * Create the structures + */ + function data($name, $data, $stat, $is_dir = false) + { + $name = $this->unique_filename($name); + $this->wrote = true; + $fzwrite = ($this->isbz && function_exists('bzwrite')) ? 'bzwrite' : (($this->isgz && @extension_loaded('zlib')) ? 'gzwrite' : 'fwrite'); + + $typeflag = ($is_dir) ? '5' : ''; + + // This is the header data, it contains all the info we know about the file or folder that we are about to archive + $header = ''; + $header .= pack('a100', $name); // file name + $header .= pack('a8', sprintf("%07o", $stat[2])); // file mode + $header .= pack('a8', sprintf("%07o", $stat[4])); // owner id + $header .= pack('a8', sprintf("%07o", $stat[5])); // group id + $header .= pack('a12', sprintf("%011o", $stat[7])); // file size + $header .= pack('a12', sprintf("%011o", $stat[9])); // last mod time + + // Checksum + $checksum = 0; + for ($i = 0; $i < 148; $i++) + { + $checksum += ord($header[$i]); + } + + // We precompute the rest of the hash, this saves us time in the loop and allows us to insert our hash without resorting to string functions + $checksum += 2415 + (($is_dir) ? 53 : 0); + + $header .= pack('a8', sprintf("%07o", $checksum)); // checksum + $header .= pack('a1', $typeflag); // link indicator + $header .= pack('a100', ''); // name of linked file + $header .= pack('a6', 'ustar'); // ustar indicator + $header .= pack('a2', '00'); // ustar version + $header .= pack('a32', 'Unknown'); // owner name + $header .= pack('a32', 'Unknown'); // group name + $header .= pack('a8', ''); // device major number + $header .= pack('a8', ''); // device minor number + $header .= pack('a155', ''); // filename prefix + $header .= pack('a12', ''); // end + + // This writes the entire file in one shot. Header, followed by data and then null padded to a multiple of 512 + $fzwrite($this->fp, $header . (($stat[7] !== 0 && !$is_dir) ? $data . str_repeat("\0", (($stat[7] + 511) &~ 511) - $stat[7]) : '')); + unset($data); + } + + /** + * Open archive + */ + function open() + { + $fzopen = ($this->isbz && function_exists('bzopen')) ? 'bzopen' : (($this->isgz && @extension_loaded('zlib')) ? 'gzopen' : 'fopen'); + $this->fp = @$fzopen($this->file, $this->mode . (($fzopen == 'bzopen') ? '' : 'b') . (($fzopen == 'gzopen') ? '9' : '')); + + if (!$this->fp) + { + trigger_error('Unable to open file ' . $this->file . ' [' . $fzopen . ' - ' . $this->mode . 'b]'); + } + } + + /** + * Download archive + */ + function download($filename, $download_name = false) + { + global $phpbb_root_path; + + if ($download_name === false) + { + $download_name = $filename; + } + + switch ($this->type) + { + case '.tar': + $mimetype = 'application/x-tar'; + break; + + case '.tar.gz': + $mimetype = 'application/x-gzip'; + break; + + case '.tar.bz2': + $mimetype = 'application/x-bzip2'; + break; + + default: + $mimetype = 'application/octet-stream'; + break; + } + + header('Cache-Control: private, no-cache'); + header("Content-Type: $mimetype; name=\"$download_name$this->type\""); + header("Content-disposition: attachment; filename=$download_name$this->type"); + + $fp = @fopen("{$phpbb_root_path}store/$filename$this->type", 'rb'); + if ($fp) + { + while ($buffer = fread($fp, 1024)) + { + echo $buffer; + } + fclose($fp); + } + } +} diff --git a/install/update/old/includes/functions_content.php b/install/update/old/includes/functions_content.php new file mode 100644 index 0000000..a15a03f --- /dev/null +++ b/install/update/old/includes/functions_content.php @@ -0,0 +1,1805 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* gen_sort_selects() +* make_jumpbox() +* bump_topic_allowed() +* get_context() +* phpbb_clean_search_string() +* decode_message() +* strip_bbcode() +* generate_text_for_display() +* generate_text_for_storage() +* generate_text_for_edit() +* make_clickable_callback() +* make_clickable() +* censor_text() +* bbcode_nl2br() +* smiley_text() +* parse_attachments() +* extension_allowed() +* truncate_string() +* get_username_string() +* class bitfield +*/ + +/** +* Generate sort selection fields +*/ +function gen_sort_selects(&$limit_days, &$sort_by_text, &$sort_days, &$sort_key, &$sort_dir, &$s_limit_days, &$s_sort_key, &$s_sort_dir, &$u_sort_param, $def_st = false, $def_sk = false, $def_sd = false) +{ + global $user, $phpbb_dispatcher; + + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + $sorts = array( + 'st' => array( + 'key' => 'sort_days', + 'default' => $def_st, + 'options' => $limit_days, + 'output' => &$s_limit_days, + ), + + 'sk' => array( + 'key' => 'sort_key', + 'default' => $def_sk, + 'options' => $sort_by_text, + 'output' => &$s_sort_key, + ), + + 'sd' => array( + 'key' => 'sort_dir', + 'default' => $def_sd, + 'options' => $sort_dir_text, + 'output' => &$s_sort_dir, + ), + ); + $u_sort_param = ''; + + foreach ($sorts as $name => $sort_ary) + { + $key = $sort_ary['key']; + $selected = ${$sort_ary['key']}; + + // Check if the key is selectable. If not, we reset to the default or first key found. + // This ensures the values are always valid. We also set $sort_dir/sort_key/etc. to the + // correct value, else the protection is void. ;) + if (!isset($sort_ary['options'][$selected])) + { + if ($sort_ary['default'] !== false) + { + $selected = ${$key} = $sort_ary['default']; + } + else + { + @reset($sort_ary['options']); + $selected = ${$key} = key($sort_ary['options']); + } + } + + $sort_ary['output'] = ''; + + $u_sort_param .= ($selected !== $sort_ary['default']) ? ((strlen($u_sort_param)) ? '&' : '') . "{$name}={$selected}" : ''; + } + + /** + * Run code before generated sort selects are returned + * + * @event core.gen_sort_selects_after + * @var int limit_days Days limit + * @var array sort_by_text Sort by text options + * @var int sort_days Sort by days flag + * @var string sort_key Sort key + * @var string sort_dir Sort dir + * @var string s_limit_days String of days limit + * @var string s_sort_key String of sort key + * @var string s_sort_dir String of sort dir + * @var string u_sort_param Sort URL params + * @var bool def_st Default sort days + * @var bool def_sk Default sort key + * @var bool def_sd Default sort dir + * @var array sorts Sorts + * @since 3.1.9-RC1 + */ + $vars = array( + 'limit_days', + 'sort_by_text', + 'sort_days', + 'sort_key', + 'sort_dir', + 's_limit_days', + 's_sort_key', + 's_sort_dir', + 'u_sort_param', + 'def_st', + 'def_sk', + 'def_sd', + 'sorts', + ); + extract($phpbb_dispatcher->trigger_event('core.gen_sort_selects_after', compact($vars))); + + return; +} + +/** +* Generate Jumpbox +*/ +function make_jumpbox($action, $forum_id = false, $select_all = false, $acl_list = false, $force_display = false) +{ + global $config, $auth, $template, $user, $db, $phpbb_path_helper, $phpbb_dispatcher; + + // We only return if the jumpbox is not forced to be displayed (in case it is needed for functionality) + if (!$config['load_jumpbox'] && $force_display === false) + { + return; + } + + $sql = 'SELECT forum_id, forum_name, parent_id, forum_type, left_id, right_id + FROM ' . FORUMS_TABLE . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql, 600); + + $rowset = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rowset[(int) $row['forum_id']] = $row; + } + $db->sql_freeresult($result); + + $right = $padding = 0; + $padding_store = array('0' => 0); + $display_jumpbox = false; + $iteration = 0; + + /** + * Modify the jumpbox forum list data + * + * @event core.make_jumpbox_modify_forum_list + * @var array rowset Array with the forums list data + * @since 3.1.10-RC1 + */ + $vars = array('rowset'); + extract($phpbb_dispatcher->trigger_event('core.make_jumpbox_modify_forum_list', compact($vars))); + + // Sometimes it could happen that forums will be displayed here not be displayed within the index page + // This is the result of forums not displayed at index, having list permissions and a parent of a forum with no permissions. + // If this happens, the padding could be "broken" + + foreach ($rowset as $row) + { + if ($row['left_id'] < $right) + { + $padding++; + $padding_store[$row['parent_id']] = $padding; + } + else if ($row['left_id'] > $right + 1) + { + // Ok, if the $padding_store for this parent is empty there is something wrong. For now we will skip over it. + // @todo digging deep to find out "how" this can happen. + $padding = (isset($padding_store[$row['parent_id']])) ? $padding_store[$row['parent_id']] : $padding; + } + + $right = $row['right_id']; + + if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) + { + // Non-postable forum with no subforums, don't display + continue; + } + + if (!$auth->acl_get('f_list', $row['forum_id'])) + { + // if the user does not have permissions to list this forum skip + continue; + } + + if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id'])) + { + continue; + } + + $tpl_ary = array(); + if (!$display_jumpbox) + { + $tpl_ary[] = array( + 'FORUM_ID' => ($select_all) ? 0 : -1, + 'FORUM_NAME' => ($select_all) ? $user->lang['ALL_FORUMS'] : $user->lang['SELECT_FORUM'], + 'S_FORUM_COUNT' => $iteration, + 'LINK' => $phpbb_path_helper->append_url_params($action, array('f' => $forum_id)), + ); + + $iteration++; + $display_jumpbox = true; + } + + $tpl_ary[] = array( + 'FORUM_ID' => $row['forum_id'], + 'FORUM_NAME' => $row['forum_name'], + 'SELECTED' => ($row['forum_id'] == $forum_id) ? ' selected="selected"' : '', + 'S_FORUM_COUNT' => $iteration, + 'S_IS_CAT' => ($row['forum_type'] == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($row['forum_type'] == FORUM_POST) ? true : false, + 'LINK' => $phpbb_path_helper->append_url_params($action, array('f' => $row['forum_id'])), + ); + + /** + * Modify the jumpbox before it is assigned to the template + * + * @event core.make_jumpbox_modify_tpl_ary + * @var array row The data of the forum + * @var array tpl_ary Template data of the forum + * @since 3.1.10-RC1 + */ + $vars = array( + 'row', + 'tpl_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.make_jumpbox_modify_tpl_ary', compact($vars))); + + $template->assign_block_vars_array('jumpbox_forums', $tpl_ary); + + unset($tpl_ary); + + for ($i = 0; $i < $padding; $i++) + { + $template->assign_block_vars('jumpbox_forums.level', array()); + } + $iteration++; + } + unset($padding_store, $rowset); + + $url_parts = $phpbb_path_helper->get_url_parts($action); + + $template->assign_vars(array( + 'S_DISPLAY_JUMPBOX' => $display_jumpbox, + 'S_JUMPBOX_ACTION' => $action, + 'HIDDEN_FIELDS_FOR_JUMPBOX' => build_hidden_fields($url_parts['params']), + )); + + return; +} + +/** +* Bump Topic Check - used by posting and viewtopic +*/ +function bump_topic_allowed($forum_id, $topic_bumped, $last_post_time, $topic_poster, $last_topic_poster) +{ + global $config, $auth, $user; + + // Check permission and make sure the last post was not already bumped + if (!$auth->acl_get('f_bump', $forum_id) || $topic_bumped) + { + return false; + } + + // Check bump time range, is the user really allowed to bump the topic at this time? + $bump_time = ($config['bump_type'] == 'm') ? $config['bump_interval'] * 60 : (($config['bump_type'] == 'h') ? $config['bump_interval'] * 3600 : $config['bump_interval'] * 86400); + + // Check bump time + if ($last_post_time + $bump_time > time()) + { + return false; + } + + // Check bumper, only topic poster and last poster are allowed to bump + if ($topic_poster != $user->data['user_id'] && $last_topic_poster != $user->data['user_id']) + { + return false; + } + + // A bump time of 0 will completely disable the bump feature... not intended but might be useful. + return $bump_time; +} + +/** +* Generates a text with approx. the specified length which contains the specified words and their context +* +* @param string $text The full text from which context shall be extracted +* @param string $words An array of words which should be contained in the result, has to be a valid part of a PCRE pattern (escape with preg_quote!) +* @param int $length The desired length of the resulting text, however the result might be shorter or longer than this value +* +* @return string Context of the specified words separated by "..." +*/ +function get_context($text, $words, $length = 400) +{ + // first replace all whitespaces with single spaces + $text = preg_replace('/ +/', ' ', strtr($text, "\t\n\r\x0C ", ' ')); + + // we need to turn the entities back into their original form, to not cut the message in between them + $entities = array('<', '>', '[', ']', '.', ':', ':'); + $characters = array('<', '>', '[', ']', '.', ':', ':'); + $text = str_replace($entities, $characters, $text); + + $word_indizes = array(); + if (count($words)) + { + $match = ''; + // find the starting indizes of all words + foreach ($words as $word) + { + if ($word) + { + if (preg_match('#(?:[^\w]|^)(' . $word . ')(?:[^\w]|$)#i', $text, $match)) + { + if (empty($match[1])) + { + continue; + } + + $pos = utf8_strpos($text, $match[1]); + if ($pos !== false) + { + $word_indizes[] = $pos; + } + } + } + } + unset($match); + + if (count($word_indizes)) + { + $word_indizes = array_unique($word_indizes); + sort($word_indizes); + + $wordnum = count($word_indizes); + // number of characters on the right and left side of each word + $sequence_length = (int) ($length / (2 * $wordnum)) - 2; + $final_text = ''; + $word = $j = 0; + $final_text_index = -1; + + // cycle through every character in the original text + for ($i = $word_indizes[$word], $n = utf8_strlen($text); $i < $n; $i++) + { + // if the current position is the start of one of the words then append $sequence_length characters to the final text + if (isset($word_indizes[$word]) && ($i == $word_indizes[$word])) + { + if ($final_text_index < $i - $sequence_length - 1) + { + $final_text .= '... ' . preg_replace('#^([^ ]*)#', '', utf8_substr($text, $i - $sequence_length, $sequence_length)); + } + else + { + // if the final text is already nearer to the current word than $sequence_length we only append the text + // from its current index on and distribute the unused length to all other sequenes + $sequence_length += (int) (($final_text_index - $i + $sequence_length + 1) / (2 * $wordnum)); + $final_text .= utf8_substr($text, $final_text_index + 1, $i - $final_text_index - 1); + } + $final_text_index = $i - 1; + + // add the following characters to the final text (see below) + $word++; + $j = 1; + } + + if ($j > 0) + { + // add the character to the final text and increment the sequence counter + $final_text .= utf8_substr($text, $i, 1); + $final_text_index++; + $j++; + + // if this is a whitespace then check whether we are done with this sequence + if (utf8_substr($text, $i, 1) == ' ') + { + // only check whether we have to exit the context generation completely if we haven't already reached the end anyway + if ($i + 4 < $n) + { + if (($j > $sequence_length && $word >= $wordnum) || utf8_strlen($final_text) > $length) + { + $final_text .= ' ...'; + break; + } + } + else + { + // make sure the text really reaches the end + $j -= 4; + } + + // stop context generation and wait for the next word + if ($j > $sequence_length) + { + $j = 0; + } + } + } + } + return str_replace($characters, $entities, $final_text); + } + } + + if (!count($words) || !count($word_indizes)) + { + return str_replace($characters, $entities, ((utf8_strlen($text) >= $length + 3) ? utf8_substr($text, 0, $length) . '...' : $text)); + } +} + +/** +* Cleans a search string by removing single wildcards from it and replacing multiple spaces with a single one. +* +* @param string $search_string The full search string which should be cleaned. +* +* @return string The cleaned search string without any wildcards and multiple spaces. +*/ +function phpbb_clean_search_string($search_string) +{ + // This regular expressions matches every single wildcard. + // That means one after a whitespace or the beginning of the string or one before a whitespace or the end of the string. + $search_string = preg_replace('#(?<=^|\s)\*+(?=\s|$)#', '', $search_string); + $search_string = trim($search_string); + $search_string = preg_replace(array('#\s+#u', '#\*+#u'), array(' ', '*'), $search_string); + return $search_string; +} + +/** +* Decode text whereby text is coming from the db and expected to be pre-parsed content +* We are placing this outside of the message parser because we are often in need of it... +* +* NOTE: special chars are kept encoded +* +* @param string &$message Original message, passed by reference +* @param string $bbcode_uid BBCode UID +* @return null +*/ +function decode_message(&$message, $bbcode_uid = '') +{ + global $phpbb_container, $phpbb_dispatcher; + + /** + * Use this event to modify the message before it is decoded + * + * @event core.decode_message_before + * @var string message_text The message content + * @var string bbcode_uid The message BBCode UID + * @since 3.1.9-RC1 + */ + $message_text = $message; + $vars = array('message_text', 'bbcode_uid'); + extract($phpbb_dispatcher->trigger_event('core.decode_message_before', compact($vars))); + $message = $message_text; + + if (preg_match('#^<[rt][ >]#', $message)) + { + $message = htmlspecialchars($phpbb_container->get('text_formatter.utils')->unparse($message), ENT_COMPAT); + } + else + { + if ($bbcode_uid) + { + $match = array('
', "[/*:m:$bbcode_uid]", ":u:$bbcode_uid", ":o:$bbcode_uid", ":$bbcode_uid"); + $replace = array("\n", '', '', '', ''); + } + else + { + $match = array('
'); + $replace = array("\n"); + } + + $message = str_replace($match, $replace, $message); + + $match = get_preg_expression('bbcode_htm'); + $replace = array('\1', '\1', '\2', '\2', '\1', '', ''); + + $message = preg_replace($match, $replace, $message); + } + + /** + * Use this event to modify the message after it is decoded + * + * @event core.decode_message_after + * @var string message_text The message content + * @var string bbcode_uid The message BBCode UID + * @since 3.1.9-RC1 + */ + $message_text = $message; + $vars = array('message_text', 'bbcode_uid'); + extract($phpbb_dispatcher->trigger_event('core.decode_message_after', compact($vars))); + $message = $message_text; +} + +/** +* Strips all bbcode from a text in place +*/ +function strip_bbcode(&$text, $uid = '') +{ + global $phpbb_container; + + if (preg_match('#^<[rt][ >]#', $text)) + { + $text = $phpbb_container->get('text_formatter.utils')->clean_formatting($text); + } + else + { + if (!$uid) + { + $uid = '[0-9a-z]{5,}'; + } + + $text = preg_replace("#\[\/?[a-z0-9\*\+\-]+(?:=(?:".*"|[^\]]*))?(?::[a-z])?(\:$uid)\]#", ' ', $text); + + $match = get_preg_expression('bbcode_htm'); + $replace = array('\1', '\1', '\2', '\1', '', ''); + + $text = preg_replace($match, $replace, $text); + } +} + +/** +* For display of custom parsed text on user-facing pages +* Expects $text to be the value directly from the database (stored value) +*/ +function generate_text_for_display($text, $uid, $bitfield, $flags, $censor_text = true) +{ + static $bbcode; + global $auth, $config, $user; + global $phpbb_dispatcher, $phpbb_container; + + if ($text === '') + { + return ''; + } + + /** + * Use this event to modify the text before it is parsed + * + * @event core.modify_text_for_display_before + * @var string text The text to parse + * @var string uid The BBCode UID + * @var string bitfield The BBCode Bitfield + * @var int flags The BBCode Flags + * @var bool censor_text Whether or not to apply word censors + * @since 3.1.0-a1 + */ + $vars = array('text', 'uid', 'bitfield', 'flags', 'censor_text'); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_before', compact($vars))); + + if (preg_match('#^<[rt][ >]#', $text)) + { + $renderer = $phpbb_container->get('text_formatter.renderer'); + + // Temporarily switch off viewcensors if applicable + $old_censor = $renderer->get_viewcensors(); + + // Check here if the user is having viewing censors disabled (and also allowed to do so). + if (!$user->optionget('viewcensors') && $config['allow_nocensors'] && $auth->acl_get('u_chgcensors')) + { + $censor_text = false; + } + + if ($old_censor !== $censor_text) + { + $renderer->set_viewcensors($censor_text); + } + + $text = $renderer->render($text); + + // Restore the previous value + if ($old_censor !== $censor_text) + { + $renderer->set_viewcensors($old_censor); + } + } + else + { + if ($censor_text) + { + $text = censor_text($text); + } + + // Parse bbcode if bbcode uid stored and bbcode enabled + if ($uid && ($flags & OPTION_FLAG_BBCODE)) + { + if (!class_exists('bbcode')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/bbcode.' . $phpEx); + } + + if (empty($bbcode)) + { + $bbcode = new bbcode($bitfield); + } + else + { + $bbcode->bbcode_set_bitfield($bitfield); + } + + $bbcode->bbcode_second_pass($text, $uid); + } + + $text = bbcode_nl2br($text); + $text = smiley_text($text, !($flags & OPTION_FLAG_SMILIES)); + } + + /** + * Use this event to modify the text after it is parsed + * + * @event core.modify_text_for_display_after + * @var string text The text to parse + * @var string uid The BBCode UID + * @var string bitfield The BBCode Bitfield + * @var int flags The BBCode Flags + * @since 3.1.0-a1 + */ + $vars = array('text', 'uid', 'bitfield', 'flags'); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_display_after', compact($vars))); + + return $text; +} + +/** +* For parsing custom parsed text to be stored within the database. +* This function additionally returns the uid and bitfield that needs to be stored. +* Expects $text to be the value directly from $request->variable() and in it's non-parsed form +* +* @param string $text The text to be replaced with the parsed one +* @param string $uid The BBCode uid for this parse +* @param string $bitfield The BBCode bitfield for this parse +* @param int $flags The allow_bbcode, allow_urls and allow_smilies compiled into a single integer. +* @param bool $allow_bbcode If BBCode is allowed (i.e. if BBCode is parsed) +* @param bool $allow_urls If urls is allowed +* @param bool $allow_smilies If smilies are allowed +* @param bool $allow_img_bbcode +* @param bool $allow_flash_bbcode +* @param bool $allow_quote_bbcode +* @param bool $allow_url_bbcode +* @param string $mode Mode to parse text as, e.g. post or sig +* +* @return array An array of string with the errors that occurred while parsing +*/ +function generate_text_for_storage(&$text, &$uid, &$bitfield, &$flags, $allow_bbcode = false, $allow_urls = false, $allow_smilies = false, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $mode = 'post') +{ + global $phpbb_root_path, $phpEx, $phpbb_dispatcher; + + /** + * Use this event to modify the text before it is prepared for storage + * + * @event core.modify_text_for_storage_before + * @var string text The text to parse + * @var string uid The BBCode UID + * @var string bitfield The BBCode Bitfield + * @var int flags The BBCode Flags + * @var bool allow_bbcode Whether or not to parse BBCode + * @var bool allow_urls Whether or not to parse URLs + * @var bool allow_smilies Whether or not to parse Smilies + * @var bool allow_img_bbcode Whether or not to parse the [img] BBCode + * @var bool allow_flash_bbcode Whether or not to parse the [flash] BBCode + * @var bool allow_quote_bbcode Whether or not to parse the [quote] BBCode + * @var bool allow_url_bbcode Whether or not to parse the [url] BBCode + * @var string mode Mode to parse text as, e.g. post or sig + * @since 3.1.0-a1 + * @changed 3.2.0-a1 Added mode + */ + $vars = array( + 'text', + 'uid', + 'bitfield', + 'flags', + 'allow_bbcode', + 'allow_urls', + 'allow_smilies', + 'allow_img_bbcode', + 'allow_flash_bbcode', + 'allow_quote_bbcode', + 'allow_url_bbcode', + 'mode', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_before', compact($vars))); + + $uid = $bitfield = ''; + $flags = (($allow_bbcode) ? OPTION_FLAG_BBCODE : 0) + (($allow_smilies) ? OPTION_FLAG_SMILIES : 0) + (($allow_urls) ? OPTION_FLAG_LINKS : 0); + + if (!class_exists('parse_message')) + { + include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + } + + $message_parser = new parse_message($text); + $message_parser->parse($allow_bbcode, $allow_urls, $allow_smilies, $allow_img_bbcode, $allow_flash_bbcode, $allow_quote_bbcode, $allow_url_bbcode, true, $mode); + + $text = $message_parser->message; + $uid = $message_parser->bbcode_uid; + + // If the bbcode_bitfield is empty, there is no need for the uid to be stored. + if (!$message_parser->bbcode_bitfield) + { + $uid = ''; + } + + $bitfield = $message_parser->bbcode_bitfield; + + /** + * Use this event to modify the text after it is prepared for storage + * + * @event core.modify_text_for_storage_after + * @var string text The text to parse + * @var string uid The BBCode UID + * @var string bitfield The BBCode Bitfield + * @var int flags The BBCode Flags + * @var string message_parser The message_parser object + * @since 3.1.0-a1 + * @changed 3.1.11-RC1 Added message_parser to vars + */ + $vars = array('text', 'uid', 'bitfield', 'flags', 'message_parser'); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_storage_after', compact($vars))); + + return $message_parser->warn_msg; +} + +/** +* For decoding custom parsed text for edits as well as extracting the flags +* Expects $text to be the value directly from the database (pre-parsed content) +*/ +function generate_text_for_edit($text, $uid, $flags) +{ + global $phpbb_dispatcher; + + /** + * Use this event to modify the text before it is decoded for editing + * + * @event core.modify_text_for_edit_before + * @var string text The text to parse + * @var string uid The BBCode UID + * @var int flags The BBCode Flags + * @since 3.1.0-a1 + */ + $vars = array('text', 'uid', 'flags'); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_edit_before', compact($vars))); + + decode_message($text, $uid); + + /** + * Use this event to modify the text after it is decoded for editing + * + * @event core.modify_text_for_edit_after + * @var string text The text to parse + * @var int flags The BBCode Flags + * @since 3.1.0-a1 + */ + $vars = array('text', 'flags'); + extract($phpbb_dispatcher->trigger_event('core.modify_text_for_edit_after', compact($vars))); + + return array( + 'allow_bbcode' => ($flags & OPTION_FLAG_BBCODE) ? 1 : 0, + 'allow_smilies' => ($flags & OPTION_FLAG_SMILIES) ? 1 : 0, + 'allow_urls' => ($flags & OPTION_FLAG_LINKS) ? 1 : 0, + 'text' => $text + ); +} + +/** +* A subroutine of make_clickable used with preg_replace +* It places correct HTML around an url, shortens the displayed text +* and makes sure no entities are inside URLs +*/ +function make_clickable_callback($type, $whitespace, $url, $relative_url, $class) +{ + $orig_url = $url; + $orig_relative = $relative_url; + $append = ''; + $url = htmlspecialchars_decode($url); + $relative_url = htmlspecialchars_decode($relative_url); + + // make sure no HTML entities were matched + $chars = array('<', '>', '"'); + $split = false; + + foreach ($chars as $char) + { + $next_split = strpos($url, $char); + if ($next_split !== false) + { + $split = ($split !== false) ? min($split, $next_split) : $next_split; + } + } + + if ($split !== false) + { + // an HTML entity was found, so the URL has to end before it + $append = substr($url, $split) . $relative_url; + $url = substr($url, 0, $split); + $relative_url = ''; + } + else if ($relative_url) + { + // same for $relative_url + $split = false; + foreach ($chars as $char) + { + $next_split = strpos($relative_url, $char); + if ($next_split !== false) + { + $split = ($split !== false) ? min($split, $next_split) : $next_split; + } + } + + if ($split !== false) + { + $append = substr($relative_url, $split); + $relative_url = substr($relative_url, 0, $split); + } + } + + // if the last character of the url is a punctuation mark, exclude it from the url + $last_char = ($relative_url) ? $relative_url[strlen($relative_url) - 1] : $url[strlen($url) - 1]; + + switch ($last_char) + { + case '.': + case '?': + case '!': + case ':': + case ',': + $append = $last_char; + if ($relative_url) + { + $relative_url = substr($relative_url, 0, -1); + } + else + { + $url = substr($url, 0, -1); + } + break; + + // set last_char to empty here, so the variable can be used later to + // check whether a character was removed + default: + $last_char = ''; + break; + } + + $short_url = (utf8_strlen($url) > 55) ? utf8_substr($url, 0, 39) . ' ... ' . utf8_substr($url, -10) : $url; + + switch ($type) + { + case MAGIC_URL_LOCAL: + $tag = 'l'; + $relative_url = preg_replace('/[&?]sid=[0-9a-f]{32}$/', '', preg_replace('/([&?])sid=[0-9a-f]{32}&/', '$1', $relative_url)); + $url = $url . '/' . $relative_url; + $text = $relative_url; + + // this url goes to http://domain.tld/path/to/board/ which + // would result in an empty link if treated as local so + // don't touch it and let MAGIC_URL_FULL take care of it. + if (!$relative_url) + { + return $whitespace . $orig_url . '/' . $orig_relative; // slash is taken away by relative url pattern + } + break; + + case MAGIC_URL_FULL: + $tag = 'm'; + $text = $short_url; + break; + + case MAGIC_URL_WWW: + $tag = 'w'; + $url = 'http://' . $url; + $text = $short_url; + break; + + case MAGIC_URL_EMAIL: + $tag = 'e'; + $text = $short_url; + $url = 'mailto:' . $url; + break; + } + + $url = htmlspecialchars($url); + $text = htmlspecialchars($text); + $append = htmlspecialchars($append); + + $html = "$whitespace$text$append"; + + return $html; +} + +/** +* make_clickable function +* +* Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx. +* Cuts down displayed size of link if over 50 chars, turns absolute links +* into relative versions when the server/script path matches the link +*/ +function make_clickable($text, $server_url = false, $class = 'postlink') +{ + if ($server_url === false) + { + $server_url = generate_board_url(); + } + + static $static_class; + static $magic_url_match_args; + + if (!isset($magic_url_match_args[$server_url]) || $static_class != $class) + { + $static_class = $class; + $class = ($static_class) ? ' class="' . $static_class . '"' : ''; + $local_class = ($static_class) ? ' class="' . $static_class . '-local"' : ''; + + if (!is_array($magic_url_match_args)) + { + $magic_url_match_args = array(); + } + + // relative urls for this board + $magic_url_match_args[$server_url][] = array( + '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#iu', + MAGIC_URL_LOCAL, + $local_class, + ); + + // matches a xxxx://aaaaa.bbb.cccc. ... + $magic_url_match_args[$server_url][] = array( + '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#iu', + MAGIC_URL_FULL, + $class, + ); + + // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing + $magic_url_match_args[$server_url][] = array( + '#(^|[\n\t (>])(' . get_preg_expression('www_url_inline') . ')#iu', + MAGIC_URL_WWW, + $class, + ); + + // matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode. + $magic_url_match_args[$server_url][] = array( + '/(^|[\n\t (>])(' . get_preg_expression('email') . ')/iu', + MAGIC_URL_EMAIL, + '', + ); + } + + foreach ($magic_url_match_args[$server_url] as $magic_args) + { + if (preg_match($magic_args[0], $text, $matches)) + { + $text = preg_replace_callback($magic_args[0], function($matches) use ($magic_args) + { + $relative_url = isset($matches[3]) ? $matches[3] : ''; + return make_clickable_callback($magic_args[1], $matches[1], $matches[2], $relative_url, $magic_args[2]); + }, $text); + } + } + + return $text; +} + +/** +* Censoring +*/ +function censor_text($text) +{ + static $censors; + + // Nothing to do? + if ($text === '') + { + return ''; + } + + // We moved the word censor checks in here because we call this function quite often - and then only need to do the check once + if (!isset($censors) || !is_array($censors)) + { + global $config, $user, $auth, $cache; + + // We check here if the user is having viewing censors disabled (and also allowed to do so). + if (!$user->optionget('viewcensors') && $config['allow_nocensors'] && $auth->acl_get('u_chgcensors')) + { + $censors = array(); + } + else + { + $censors = $cache->obtain_word_list(); + } + } + + if (count($censors)) + { + return preg_replace($censors['match'], $censors['replace'], $text); + } + + return $text; +} + +/** +* custom version of nl2br which takes custom BBCodes into account +*/ +function bbcode_nl2br($text) +{ + // custom BBCodes might contain carriage returns so they + // are not converted into
so now revert that + $text = str_replace(array("\n", "\r"), array('
', "\n"), $text); + return $text; +} + +/** +* Smiley processing +*/ +function smiley_text($text, $force_option = false) +{ + global $config, $user, $phpbb_path_helper, $phpbb_dispatcher; + + if ($force_option || !$config['allow_smilies'] || !$user->optionget('viewsmilies')) + { + return preg_replace('##', ''; + } + } + + $filesize = get_formatted_filesize($attachment['filesize'], false); + + $comment = bbcode_nl2br(censor_text($attachment['attach_comment'])); + + $block_array += array( + 'UPLOAD_ICON' => $upload_icon, + 'FILESIZE' => $filesize['value'], + 'SIZE_LANG' => $filesize['unit'], + 'DOWNLOAD_NAME' => utf8_basename($attachment['real_filename']), + 'COMMENT' => $comment, + ); + + $denied = false; + + if (!extension_allowed($forum_id, $attachment['extension'], $extensions)) + { + $denied = true; + + $block_array += array( + 'S_DENIED' => true, + 'DENIED_MESSAGE' => sprintf($user->lang['EXTENSION_DISABLED_AFTER_POSTING'], $attachment['extension']) + ); + } + + if (!$denied) + { + $display_cat = $extensions[$attachment['extension']]['display_cat']; + + if ($display_cat == ATTACHMENT_CATEGORY_IMAGE) + { + if ($attachment['thumbnail']) + { + $display_cat = ATTACHMENT_CATEGORY_THUMB; + } + else + { + if ($config['img_display_inlined']) + { + if ($config['img_link_width'] || $config['img_link_height']) + { + $dimension = @getimagesize($filename); + + // If the dimensions could not be determined or the image being 0x0 we display it as a link for safety purposes + if ($dimension === false || empty($dimension[0]) || empty($dimension[1])) + { + $display_cat = ATTACHMENT_CATEGORY_NONE; + } + else + { + $display_cat = ($dimension[0] <= $config['img_link_width'] && $dimension[1] <= $config['img_link_height']) ? ATTACHMENT_CATEGORY_IMAGE : ATTACHMENT_CATEGORY_NONE; + } + } + } + else + { + $display_cat = ATTACHMENT_CATEGORY_NONE; + } + } + } + + // Make some descisions based on user options being set. + if (($display_cat == ATTACHMENT_CATEGORY_IMAGE || $display_cat == ATTACHMENT_CATEGORY_THUMB) && !$user->optionget('viewimg')) + { + $display_cat = ATTACHMENT_CATEGORY_NONE; + } + + if ($display_cat == ATTACHMENT_CATEGORY_FLASH && !$user->optionget('viewflash')) + { + $display_cat = ATTACHMENT_CATEGORY_NONE; + } + + $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']); + $l_downloaded_viewed = 'VIEWED_COUNTS'; + + switch ($display_cat) + { + // Images + case ATTACHMENT_CATEGORY_IMAGE: + $inline_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id']); + $download_link .= '&mode=view'; + + $block_array += array( + 'S_IMAGE' => true, + 'U_INLINE_LINK' => $inline_link, + ); + + $update_count_ary[] = $attachment['attach_id']; + break; + + // Images, but display Thumbnail + case ATTACHMENT_CATEGORY_THUMB: + $thumbnail_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $attachment['attach_id'] . '&t=1'); + $download_link .= '&mode=view'; + + $block_array += array( + 'S_THUMBNAIL' => true, + 'THUMB_IMAGE' => $thumbnail_link, + ); + + $update_count_ary[] = $attachment['attach_id']; + break; + + // Macromedia Flash Files + case ATTACHMENT_CATEGORY_FLASH: + list($width, $height) = @getimagesize($filename); + + $block_array += array( + 'S_FLASH_FILE' => true, + 'WIDTH' => $width, + 'HEIGHT' => $height, + 'U_VIEW_LINK' => $download_link . '&view=1', + ); + + // Viewed/Heared File ... update the download count + $update_count_ary[] = $attachment['attach_id']; + break; + + default: + $l_downloaded_viewed = 'DOWNLOAD_COUNTS'; + + $block_array += array( + 'S_FILE' => true, + ); + break; + } + + if (!isset($attachment['download_count'])) + { + $attachment['download_count'] = 0; + } + + $block_array += array( + 'U_DOWNLOAD_LINK' => $download_link, + 'L_DOWNLOAD_COUNT' => $user->lang($l_downloaded_viewed, (int) $attachment['download_count']), + ); + } + + $update_count = $update_count_ary; + /** + * Use this event to modify the attachment template data. + * + * This event is triggered once per attachment. + * + * @event core.parse_attachments_modify_template_data + * @var array attachment Array with attachment data + * @var array block_array Template data of the attachment + * @var int display_cat Attachment category data + * @var string download_link Attachment download link + * @var array extensions Array with attachment extensions data + * @var mixed forum_id The forum id the attachments are displayed in (false if in private message) + * @var bool preview Flag indicating if we are in post preview mode + * @var array update_count Array with attachment ids to update download count + * @since 3.1.0-RC5 + */ + $vars = array( + 'attachment', + 'block_array', + 'display_cat', + 'download_link', + 'extensions', + 'forum_id', + 'preview', + 'update_count', + ); + extract($phpbb_dispatcher->trigger_event('core.parse_attachments_modify_template_data', compact($vars))); + $update_count_ary = $update_count; + unset($update_count); + + $template->assign_block_vars('_file', $block_array); + + $compiled_attachments[] = $template->assign_display('attachment_tpl'); + } + + $attachments = $compiled_attachments; + unset($compiled_attachments); + + $unset_tpl = array(); + + preg_match_all('#(.*?)#', $message, $matches, PREG_PATTERN_ORDER); + + $replace = array(); + foreach ($matches[0] as $num => $capture) + { + $index = $matches[1][$num]; + + $replace['from'][] = $matches[0][$num]; + $replace['to'][] = (isset($attachments[$index])) ? $attachments[$index] : sprintf($user->lang['MISSING_INLINE_ATTACHMENT'], $matches[2][array_search($index, $matches[1])]); + + $unset_tpl[] = $index; + } + + if (isset($replace['from'])) + { + $message = str_replace($replace['from'], $replace['to'], $message); + } + + $unset_tpl = array_unique($unset_tpl); + + // Sort correctly + if ($config['display_order']) + { + // Ascending sort + krsort($attachments); + } + else + { + // Descending sort + ksort($attachments); + } + + // Needed to let not display the inlined attachments at the end of the post again + foreach ($unset_tpl as $index) + { + unset($attachments[$index]); + } +} + +/** +* Check if extension is allowed to be posted. +* +* @param mixed $forum_id The forum id to check or false if private message +* @param string $extension The extension to check, for example zip. +* @param array &$extensions The extension array holding the information from the cache (will be obtained if empty) +* +* @return bool False if the extension is not allowed to be posted, else true. +*/ +function extension_allowed($forum_id, $extension, &$extensions) +{ + if (empty($extensions)) + { + global $cache; + $extensions = $cache->obtain_attach_extensions($forum_id); + } + + return (!isset($extensions['_allowed_'][$extension])) ? false : true; +} + +/** +* Truncates string while retaining special characters if going over the max length +* The default max length is 60 at the moment +* The maximum storage length is there to fit the string within the given length. The string may be further truncated due to html entities. +* For example: string given is 'a "quote"' (length: 9), would be a stored as 'a "quote"' (length: 19) +* +* @param string $string The text to truncate to the given length. String is specialchared. +* @param int $max_length Maximum length of string (multibyte character count as 1 char / Html entity count as 1 char) +* @param int $max_store_length Maximum character length of string (multibyte character count as 1 char / Html entity count as entity chars). +* @param bool $allow_reply Allow Re: in front of string +* NOTE: This parameter can cause undesired behavior (returning strings longer than $max_store_length) and is deprecated. +* @param string $append String to be appended +*/ +function truncate_string($string, $max_length = 60, $max_store_length = 255, $allow_reply = false, $append = '') +{ + $strip_reply = false; + $stripped = false; + if ($allow_reply && strpos($string, 'Re: ') === 0) + { + $strip_reply = true; + $string = substr($string, 4); + } + + $_chars = utf8_str_split(htmlspecialchars_decode($string)); + $chars = array_map('utf8_htmlspecialchars', $_chars); + + // Now check the length ;) + if (count($chars) > $max_length) + { + // Cut off the last elements from the array + $string = implode('', array_slice($chars, 0, $max_length - utf8_strlen($append))); + $stripped = true; + } + + // Due to specialchars, we may not be able to store the string... + if (utf8_strlen($string) > $max_store_length) + { + // let's split again, we do not want half-baked strings where entities are split + $_chars = utf8_str_split(htmlspecialchars_decode($string)); + $chars = array_map('utf8_htmlspecialchars', $_chars); + + do + { + array_pop($chars); + $string = implode('', $chars); + } + while (!empty($chars) && utf8_strlen($string) > $max_store_length); + } + + if ($strip_reply) + { + $string = 'Re: ' . $string; + } + + if ($append != '' && $stripped) + { + $string = $string . $append; + } + + return $string; +} + +/** +* Get username details for placing into templates. +* This function caches all modes on first call, except for no_profile and anonymous user - determined by $user_id. +* +* @param string $mode Can be profile (for getting an url to the profile), username (for obtaining the username), colour (for obtaining the user colour), full (for obtaining a html string representing a coloured link to the users profile) or no_profile (the same as full but forcing no profile link) +* @param int $user_id The users id +* @param string $username The users name +* @param string $username_colour The users colour +* @param string $guest_username optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then. +* @param string $custom_profile_url optional parameter to specify a profile url. The user id get appended to this url as &u={user_id} +* +* @return string A string consisting of what is wanted based on $mode. +*/ +function get_username_string($mode, $user_id, $username, $username_colour = '', $guest_username = false, $custom_profile_url = false) +{ + static $_profile_cache; + global $phpbb_dispatcher; + + // We cache some common variables we need within this function + if (empty($_profile_cache)) + { + global $phpbb_root_path, $phpEx; + + $_profile_cache['base_url'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=viewprofile&u={USER_ID}'); + $_profile_cache['tpl_noprofile'] = '{USERNAME}'; + $_profile_cache['tpl_noprofile_colour'] = '{USERNAME}'; + $_profile_cache['tpl_profile'] = '{USERNAME}'; + $_profile_cache['tpl_profile_colour'] = '{USERNAME}'; + } + + global $user, $auth; + + // This switch makes sure we only run code required for the mode + switch ($mode) + { + case 'full': + case 'no_profile': + case 'colour': + + // Build correct username colour + $username_colour = ($username_colour) ? '#' . $username_colour : ''; + + // Return colour + if ($mode == 'colour') + { + $username_string = $username_colour; + break; + } + + // no break; + + case 'username': + + // Build correct username + if ($guest_username === false) + { + $username = ($username) ? $username : $user->lang['GUEST']; + } + else + { + $username = ($user_id && $user_id != ANONYMOUS) ? $username : ((!empty($guest_username)) ? $guest_username : $user->lang['GUEST']); + } + + // Return username + if ($mode == 'username') + { + $username_string = $username; + break; + } + + // no break; + + case 'profile': + + // Build correct profile url - only show if not anonymous and permission to view profile if registered user + // For anonymous the link leads to a login page. + if ($user_id && $user_id != ANONYMOUS && ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('u_viewprofile'))) + { + $profile_url = ($custom_profile_url !== false) ? $custom_profile_url . '&u=' . (int) $user_id : str_replace(array('={USER_ID}', '=%7BUSER_ID%7D'), '=' . (int) $user_id, $_profile_cache['base_url']); + } + else + { + $profile_url = ''; + } + + // Return profile + if ($mode == 'profile') + { + $username_string = $profile_url; + break; + } + + // no break; + } + + if (!isset($username_string)) + { + if (($mode == 'full' && !$profile_url) || $mode == 'no_profile') + { + $username_string = str_replace(array('{USERNAME_COLOUR}', '{USERNAME}'), array($username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_noprofile'] : $_profile_cache['tpl_noprofile_colour']); + } + else + { + $username_string = str_replace(array('{PROFILE_URL}', '{USERNAME_COLOUR}', '{USERNAME}'), array($profile_url, $username_colour, $username), (!$username_colour) ? $_profile_cache['tpl_profile'] : $_profile_cache['tpl_profile_colour']); + } + } + + /** + * Use this event to change the output of get_username_string() + * + * @event core.modify_username_string + * @var string mode profile|username|colour|full|no_profile + * @var int user_id String or array of additional url + * parameters + * @var string username The user's username + * @var string username_colour The user's colour + * @var string guest_username Optional parameter to specify the + * guest username. + * @var string custom_profile_url Optional parameter to specify a + * profile url. + * @var string username_string The string that has been generated + * @var array _profile_cache Array of original return templates + * @since 3.1.0-a1 + */ + $vars = array( + 'mode', + 'user_id', + 'username', + 'username_colour', + 'guest_username', + 'custom_profile_url', + 'username_string', + '_profile_cache', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_username_string', compact($vars))); + + return $username_string; +} + +/** + * Add an option to the quick-mod tools. + * + * @param string $url The recepting URL for the quickmod actions. + * @param string $option The language key for the value of the option. + * @param string $lang_string The language string to use. + */ +function phpbb_add_quickmod_option($url, $option, $lang_string) +{ + global $template, $user, $phpbb_path_helper; + + $lang_string = $user->lang($lang_string); + $template->assign_block_vars('quickmod', array( + 'VALUE' => $option, + 'TITLE' => $lang_string, + 'LINK' => $phpbb_path_helper->append_url_params($url, array('action' => $option)), + )); +} + +/** +* Concatenate an array into a string list. +* +* @param array $items Array of items to concatenate +* @param object $user The phpBB $user object. +* +* @return string String list. Examples: "A"; "A and B"; "A, B, and C" +*/ +function phpbb_generate_string_list($items, $user) +{ + if (empty($items)) + { + return ''; + } + + $count = count($items); + $last_item = array_pop($items); + $lang_key = 'STRING_LIST_MULTI'; + + if ($count == 1) + { + return $last_item; + } + else if ($count == 2) + { + $lang_key = 'STRING_LIST_SIMPLE'; + } + $list = implode($user->lang['COMMA_SEPARATOR'], $items); + + return $user->lang($lang_key, $list, $last_item); +} + +class bitfield +{ + var $data; + + function __construct($bitfield = '') + { + $this->data = base64_decode($bitfield); + } + + /** + */ + function get($n) + { + // Get the ($n / 8)th char + $byte = $n >> 3; + + if (strlen($this->data) >= $byte + 1) + { + $c = $this->data[$byte]; + + // Lookup the ($n % 8)th bit of the byte + $bit = 7 - ($n & 7); + return (bool) (ord($c) & (1 << $bit)); + } + else + { + return false; + } + } + + function set($n) + { + $byte = $n >> 3; + $bit = 7 - ($n & 7); + + if (strlen($this->data) >= $byte + 1) + { + $this->data[$byte] = $this->data[$byte] | chr(1 << $bit); + } + else + { + $this->data .= str_repeat("\0", $byte - strlen($this->data)); + $this->data .= chr(1 << $bit); + } + } + + function clear($n) + { + $byte = $n >> 3; + + if (strlen($this->data) >= $byte + 1) + { + $bit = 7 - ($n & 7); + $this->data[$byte] = $this->data[$byte] &~ chr(1 << $bit); + } + } + + function get_blob() + { + return $this->data; + } + + function get_base64() + { + return base64_encode($this->data); + } + + function get_bin() + { + $bin = ''; + $len = strlen($this->data); + + for ($i = 0; $i < $len; ++$i) + { + $bin .= str_pad(decbin(ord($this->data[$i])), 8, '0', STR_PAD_LEFT); + } + + return $bin; + } + + function get_all_set() + { + return array_keys(array_filter(str_split($this->get_bin()))); + } + + function merge($bitfield) + { + $this->data = $this->data | $bitfield->get_blob(); + } +} + +/** + * Formats the quote according to the given BBCode status setting + * + * @param phpbb\language\language $language Language class + * @param parse_message $message_parser Message parser class + * @param phpbb\textformatter\utils_interface $text_formatter_utils Text formatter utilities + * @param bool $bbcode_status The status of the BBCode setting + * @param array $quote_attributes The attributes of the quoted post + * @param string $message_link Link of the original quoted post + */ +function phpbb_format_quote($language, $message_parser, $text_formatter_utils, $bbcode_status, $quote_attributes, $message_link = '') +{ + if ($bbcode_status) + { + $quote_text = $text_formatter_utils->generate_quote( + censor_text($message_parser->message), + $quote_attributes + ); + + $message_parser->message = $quote_text . "\n\n"; + } + else + { + $offset = 0; + $quote_string = "> "; + $message = censor_text(trim($message_parser->message)); + // see if we are nesting. It's easily tricked but should work for one level of nesting + if (strpos($message, ">") !== false) + { + $offset = 10; + } + $message = utf8_wordwrap($message, 75 + $offset, "\n"); + + $message = $quote_string . $message; + $message = str_replace("\n", "\n" . $quote_string, $message); + + $message_parser->message = $quote_attributes['author'] . " " . $language->lang('WROTE') . ":\n" . $message . "\n"; + } + + if ($message_link) + { + $message_parser->message = $message_link . $message_parser->message; + } +} diff --git a/install/update/old/includes/functions_convert.php b/install/update/old/includes/functions_convert.php new file mode 100644 index 0000000..2cfbe95 --- /dev/null +++ b/install/update/old/includes/functions_convert.php @@ -0,0 +1,2514 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Default avatar width/height +* @ignore +*/ +define('DEFAULT_AVATAR_X', 80); +define('DEFAULT_AVATAR_Y', 80); + +// Global functions - all functions can be used by convertors + +// SIMPLE FUNCTIONS + +/** +* Return the preceding value +*/ +function dec($var) +{ + return --$var; +} + +/** +* Return the next value +*/ +function inc($var) +{ + return ++$var; +} + +/** +* Return whether the value is positive +*/ +function is_positive($n) +{ + return ($n > 0) ? 1 : 0; +} + +/** +* Boolean inverse of the value +*/ +function not($var) +{ + return ($var) ? 0 : 1; +} + +/** +* Convert a textual value to it's equivalent boolean value +* +* @param string $str String to convert (converts yes, on, y, 1 and true to boolean true) +* @return boolean The equivalent value +*/ +function str_to_bool($str) +{ + $str = strtolower($str); + return ($str == 'yes' || $str == 'on' || $str == 'y' || $str == 'true' || $str == '1') ? true : false; +} + +/** +* Function to mimic php's empty() function (it is the same) +*/ +function is_empty($mixed) +{ + return empty($mixed); +} + +/** +* Convert the name of a user's primary group to the appropriate equivalent phpBB group id +* +* @param string $status The name of the group +* @return int The group_id corresponding to the equivalent group +*/ +function str_to_primary_group($status) +{ + switch (ucfirst(strtolower($status))) + { + case 'Administrator': + return get_group_id('administrators'); + break; + + case 'Super moderator': + case 'Global moderator': + case 'Moderator': + return get_group_id('global_moderators'); + break; + + case 'Guest': + case 'Anonymous': + return get_group_id('guests'); + break; + + default: + return get_group_id('registered'); + break; + } +} + +/** +* Convert a boolean into the appropriate phpBB constant indicating whether the item is locked +*/ +function is_item_locked($bool) +{ + return ($bool) ? ITEM_LOCKED : ITEM_UNLOCKED; +} + +/** +* Convert a value from days to seconds +*/ +function days_to_seconds($days) +{ + return ($days * 86400); +} + +/** +* Determine whether a user is anonymous and return the appropriate new user_id +*/ +function is_user_anonymous($user_id) +{ + return ($user_id > ANONYMOUS) ? $user_id : ANONYMOUS; +} + +/** +* Generate a key value based on existing values +* +* @param int $pad Amount to add to the maximum value +* @return int Key value +*/ +function auto_id($pad = 0) +{ + global $auto_id, $convert_row; + + if (!empty($convert_row['max_id'])) + { + return $convert_row['max_id'] + $pad; + } + + return $auto_id + $pad; +} + +/** +* Convert a boolean into the appropriate phpBB constant indicating whether the user is active +*/ +function set_user_type($user_active) +{ + return ($user_active) ? USER_NORMAL : USER_INACTIVE; +} + +/** +* Convert a value from minutes to hours +*/ +function minutes_to_hours($minutes) +{ + return ($minutes / 3600); +} + +/** +* Return the group_id for a given group name +*/ +function get_group_id($group_name) +{ + global $db, $group_mapping; + + if (empty($group_mapping)) + { + $sql = 'SELECT group_name, group_id + FROM ' . GROUPS_TABLE; + $result = $db->sql_query($sql); + + $group_mapping = array(); + while ($row = $db->sql_fetchrow($result)) + { + $group_mapping[strtoupper($row['group_name'])] = (int) $row['group_id']; + } + $db->sql_freeresult($result); + } + + if (!count($group_mapping)) + { + add_default_groups(); + return get_group_id($group_name); + } + + if (isset($group_mapping[strtoupper($group_name)])) + { + return $group_mapping[strtoupper($group_name)]; + } + + return $group_mapping['REGISTERED']; +} + +/** +* Generate the email hash stored in the users table +* +* Note: Deprecated, calls should directly go to phpbb_email_hash() +*/ +function gen_email_hash($email) +{ + return phpbb_email_hash($email); +} + +/** +* Convert a boolean into the appropriate phpBB constant indicating whether the topic is locked +*/ +function is_topic_locked($bool) +{ + return (!empty($bool)) ? ITEM_LOCKED : ITEM_UNLOCKED; +} + +/** +* Generate a bbcode_uid value +*/ +function make_uid($timestamp) +{ + static $last_timestamp, $last_uid; + + if (empty($last_timestamp) || $timestamp != $last_timestamp) + { + $last_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN); + } + $last_timestamp = $timestamp; + return $last_uid; +} + + +/** +* Validate a website address +*/ +function validate_website($url) +{ + if ($url === 'http://') + { + return ''; + } + else if (!preg_match('#^http[s]?://#i', $url) && strlen($url) > 0) + { + return 'http://' . $url; + } + return $url; +} + +/** +* Convert nulls to zeros for fields which allowed a NULL value in the source but not the destination +*/ +function null_to_zero($value) +{ + return ($value === NULL) ? 0 : $value; +} + +/** +* Convert nulls to empty strings for fields which allowed a NULL value in the source but not the destination +*/ +function null_to_str($value) +{ + return ($value === NULL) ? '' : $value; +} + +// EXTENDED FUNCTIONS + +/** +* Get old config value +*/ +function get_config_value($config_name) +{ + static $convert_config; + + if (!isset($convert_config)) + { + $convert_config = get_config(); + } + + if (!isset($convert_config[$config_name])) + { + return false; + } + + return (empty($convert_config[$config_name])) ? '' : $convert_config[$config_name]; +} + +/** +* Convert an IP address from the hexadecimal notation to normal dotted-quad notation +*/ +function decode_ip($int_ip) +{ + if (!$int_ip) + { + return $int_ip; + } + + $hexipbang = explode('.', chunk_split($int_ip, 2, '.')); + + // Any mod changing the way ips are stored? Then we are not able to convert and enter the ip "as is" to not "destroy" anything... + if (count($hexipbang) < 4) + { + return $int_ip; + } + + return hexdec($hexipbang[0]) . '.' . hexdec($hexipbang[1]) . '.' . hexdec($hexipbang[2]) . '.' . hexdec($hexipbang[3]); +} + +/** +* Reverse the encoding of wild-carded bans +*/ +function decode_ban_ip($int_ip) +{ + return str_replace('255', '*', decode_ip($int_ip)); +} + +/** +* Determine the MIME-type of a specified filename +* This does not actually inspect the file, but simply uses the file extension +*/ +function mimetype($filename) +{ + if (!preg_match('/\.([a-z0-9]+)$/i', $filename, $m)) + { + return 'application/octet-stream'; + } + + switch (strtolower($m[1])) + { + case 'zip': return 'application/zip'; + case 'jpeg': return 'image/jpeg'; + case 'jpg': return 'image/jpeg'; + case 'jpe': return 'image/jpeg'; + case 'png': return 'image/png'; + case 'gif': return 'image/gif'; + case 'htm': + case 'html': return 'text/html'; + case 'tif': return 'image/tiff'; + case 'tiff': return 'image/tiff'; + case 'ras': return 'image/x-cmu-raster'; + case 'pnm': return 'image/x-portable-anymap'; + case 'pbm': return 'image/x-portable-bitmap'; + case 'pgm': return 'image/x-portable-graymap'; + case 'ppm': return 'image/x-portable-pixmap'; + case 'rgb': return 'image/x-rgb'; + case 'xbm': return 'image/x-xbitmap'; + case 'xpm': return 'image/x-xpixmap'; + case 'xwd': return 'image/x-xwindowdump'; + case 'z': return 'application/x-compress'; + case 'gtar': return 'application/x-gtar'; + case 'tgz': return 'application/x-gtar'; + case 'gz': return 'application/x-gzip'; + case 'tar': return 'application/x-tar'; + case 'xls': return 'application/excel'; + case 'pdf': return 'application/pdf'; + case 'ppt': return 'application/powerpoint'; + case 'rm': return 'application/vnd.rn-realmedia'; + case 'wma': return 'audio/x-ms-wma'; + case 'swf': return 'application/x-shockwave-flash'; + case 'ief': return 'image/ief'; + case 'doc': + case 'dot': + case 'wrd': return 'application/msword'; + case 'ai': + case 'eps': + case 'ps': return 'application/postscript'; + case 'asc': + case 'txt': + case 'c': + case 'cc': + case 'h': + case 'hh': + case 'cpp': + case 'hpp': + case 'php': + case 'php3': return 'text/plain'; + default: return 'application/octet-stream'; + } +} + +/** +* Obtain the dimensions of all remotely hosted avatars +* This should only be called from execute_last +* There can be significant network overhead if there are a large number of remote avatars +* @todo Look at the option of allowing the user to decide whether this is called or to force the dimensions +*/ +function remote_avatar_dims() +{ + global $db; + + $sql = 'SELECT user_id, user_avatar + FROM ' . USERS_TABLE . ' + WHERE user_avatar_type = ' . AVATAR_REMOTE; + $result = $db->sql_query($sql); + + $remote_avatars = array(); + while ($row = $db->sql_fetchrow($result)) + { + $remote_avatars[(int) $row['user_id']] = $row['user_avatar']; + } + $db->sql_freeresult($result); + + foreach ($remote_avatars as $user_id => $avatar) + { + $width = (int) get_remote_avatar_dim($avatar, 0); + $height = (int) get_remote_avatar_dim($avatar, 1); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_avatar_width = ' . (int) $width . ', user_avatar_height = ' . (int) $height . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + } +} + +function import_avatar_gallery($gallery_name = '', $subdirs_as_galleries = false) +{ + global $config, $convert, $user; + + $relative_path = empty($convert->convertor['source_path_absolute']); + + // check for trailing slash + if (rtrim($convert->convertor['avatar_gallery_path'], '/') === '') + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_GALLERY_PATH'], 'import_avatar_gallery()'), __LINE__, __FILE__); + } + + $src_path = relative_base(path($convert->convertor['avatar_gallery_path'], $relative_path), $relative_path); + + if (is_dir($src_path)) + { + // Do not die on failure... safe mode restrictions may be in effect. + copy_dir($convert->convertor['avatar_gallery_path'], path($config['avatar_gallery_path']) . $gallery_name, !$subdirs_as_galleries, false, false, $relative_path); + + // only doing 1 level deep. (ibf 1.x) + // notes: ibf has 2 tiers: directly in the avatar directory for base gallery (handled in the above statement), plus subdirs(handled below). + // recursive subdirs ignored. -- i don't know if other forums support recursive galleries. if they do, this following code could be upgraded to be recursive. + if ($subdirs_as_galleries) + { + $dirlist = array(); + if ($handle = @opendir($src_path)) + { + while ($entry = readdir($handle)) + { + if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm') + { + continue; + } + + if (is_dir($src_path . $entry)) + { + $dirlist[] = $entry; + } + } + closedir($handle); + } + else if ($dir = @dir($src_path)) + { + while ($entry = $dir->read()) + { + if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm') + { + continue; + } + + if (is_dir($src_path . $entry)) + { + $dirlist[] = $entry; + } + } + $dir->close(); + } + + for ($i = 0, $end = count($dirlist); $i < $end; ++$i) + { + $dir = $dirlist[$i]; + + // Do not die on failure... safe mode restrictions may be in effect. + copy_dir(path($convert->convertor['avatar_gallery_path'], $relative_path) . $dir, path($config['avatar_gallery_path']) . $dir, true, false, false, $relative_path); + } + } + } +} + +function import_attachment_files($category_name = '') +{ + global $config, $convert, $db, $user; + + $sql = 'SELECT config_value AS upload_path + FROM ' . CONFIG_TABLE . " + WHERE config_name = 'upload_path'"; + $result = $db->sql_query($sql); + $config['upload_path'] = $db->sql_fetchfield('upload_path'); + $db->sql_freeresult($result); + + $relative_path = empty($convert->convertor['source_path_absolute']); + + if (empty($convert->convertor['upload_path'])) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_UPLOAD_DIR'], 'import_attachment_files()'), __LINE__, __FILE__); + } + + if (is_dir(relative_base(path($convert->convertor['upload_path'], $relative_path), $relative_path))) + { + copy_dir($convert->convertor['upload_path'], path($config['upload_path']) . $category_name, true, false, true, $relative_path); + } +} + +function attachment_forum_perms($forum_id) +{ + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + return serialize($forum_id); +} + +// base64todec function +// -> from php manual? +function base64_unpack($string) +{ + $chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+-'; + $base = strlen($chars); + + $length = strlen($string); + $number = 0; + + for ($i = 1; $i <= $length; $i++) + { + $pos = $length - $i; + $operand = strpos($chars, substr($string, $pos, 1)); + $exponent = pow($base, $i-1); + $dec_value = $operand * $exponent; + $number += $dec_value; + } + + return $number; +} + +function _import_check($config_var, $source, $use_target) +{ + global $convert, $config; + + $result = array( + 'orig_source' => $source, + 'copied' => false, + 'relative_path' => (empty($convert->convertor['source_path_absolute'])) ? true : false, + ); + + // copy file will prepend $phpBB_root_path + $target = $config[$config_var] . '/' . utf8_basename(($use_target === false) ? $source : $use_target); + + if (!empty($convert->convertor[$config_var]) && strpos($source, $convert->convertor[$config_var]) !== 0) + { + $source = $convert->convertor[$config_var] . $source; + } + + $result['source'] = $source; + + if (file_exists(relative_base($source, $result['relative_path'], __LINE__, __FILE__))) + { + $result['copied'] = copy_file($source, $target, false, false, $result['relative_path']); + } + + if ($result['copied']) + { + $result['target'] = utf8_basename($target); + } + else + { + $result['target'] = ($use_target !== false) ? $result['orig_source'] : utf8_basename($target); + } + + return $result; +} + +function import_attachment($source, $use_target = false) +{ + if (empty($source)) + { + return ''; + } + + global $convert, $config, $user; + + // check for trailing slash + if (rtrim($convert->convertor['upload_path'], '/') === '') + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_UPLOAD_DIR'], 'import_attachment()'), __LINE__, __FILE__); + } + + $result = _import_check('upload_path', $source, $use_target); + + if ($result['copied']) + { + // Thumbnails? + if (is_array($convert->convertor['thumbnails'])) + { + $thumb_dir = $convert->convertor['thumbnails'][0]; + $thumb_prefix = $convert->convertor['thumbnails'][1]; + $thumb_source = $thumb_dir . $thumb_prefix . utf8_basename($result['source']); + + if (strpos($thumb_source, $convert->convertor['upload_path']) !== 0) + { + $thumb_source = $convert->convertor['upload_path'] . $thumb_source; + } + $thumb_target = $config['upload_path'] . '/thumb_' . $result['target']; + + if (file_exists(relative_base($thumb_source, $result['relative_path'], __LINE__, __FILE__))) + { + copy_file($thumb_source, $thumb_target, false, false, $result['relative_path']); + } + } + } + + return $result['target']; +} + +function import_rank($source, $use_target = false) +{ + if (empty($source)) + { + return ''; + } + + global $convert, $user; + + if (!isset($convert->convertor['ranks_path'])) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_RANKS_PATH'], 'import_rank()'), __LINE__, __FILE__); + } + + $result = _import_check('ranks_path', $source, $use_target); + return $result['target']; +} + +function import_smiley($source, $use_target = false) +{ + if (empty($source)) + { + return ''; + } + + global $convert, $user; + + // check for trailing slash + if (rtrim($convert->convertor['smilies_path'], '/') === '') + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_SMILIES_PATH'], 'import_smiley()'), __LINE__, __FILE__); + } + + $result = _import_check('smilies_path', $source, $use_target); + return $result['target']; +} + +/* +*/ +function import_avatar($source, $use_target = false, $user_id = false) +{ + if (empty($source) || preg_match('#^https?:#i', $source) || preg_match('#blank\.(gif|png)$#i', $source)) + { + return; + } + + global $convert, $config, $user; + + // check for trailing slash + if (rtrim($convert->convertor['avatar_path'], '/') === '') + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_AVATAR_PATH'], 'import_avatar()'), __LINE__, __FILE__); + } + + if ($use_target === false && $user_id !== false) + { + $use_target = $config['avatar_salt'] . '_' . $user_id . '.' . substr(strrchr($source, '.'), 1); + } + + _import_check('avatar_path', $source, $use_target); + + return ((!empty($user_id)) ? $user_id : $use_target) . '.' . substr(strrchr($source, '.'), 1); +} + +/** +* @todo all image dimension functions below (there are a *lot*) should get revisited and converted to one or two functions (no more needed, really). +*/ + +/** +* Calculate the size of the specified image +* Called from the following functions for calculating the size of specific image types +*/ +function get_image_dim($source) +{ + if (empty($source)) + { + return array(0, 0); + } + + global $convert; + + $relative_path = empty($convert->convertor['source_path_absolute']); + + if (file_exists(relative_base($source, $relative_path))) + { + $image = relative_base($source, $relative_path); + return @getimagesize($image); + } + + return false; +} + +/** +* Obtain the width of the specified smilie +*/ +function get_smiley_width($src) +{ + return get_smiley_dim($src, 0); +} + +/** +* Obtain the height of the specified smilie +*/ +function get_smiley_height($src) +{ + return get_smiley_dim($src, 1); +} + +/** +* Obtain the size of the specified smilie (using the cache if possible) and cache the value +*/ +function get_smiley_dim($source, $axis) +{ + if (empty($source)) + { + return 15; + } + + static $smiley_cache = array(); + + if (isset($smiley_cache[$source])) + { + return $smiley_cache[$source][$axis]; + } + + global $convert, $user; + + $orig_source = $source; + + if (!isset($convert->convertor['smilies_path'])) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_SMILIES_PATH'], 'get_smiley_dim()'), __LINE__, __FILE__); + } + + if (!empty($convert->convertor['smilies_path']) && strpos($source, $convert->convertor['smilies_path']) !== 0) + { + $source = $convert->convertor['smilies_path'] . $source; + } + + $smiley_cache[$orig_source] = get_image_dim($source); + + if (empty($smiley_cache[$orig_source]) || empty($smiley_cache[$orig_source][0]) || empty($smiley_cache[$orig_source][1])) + { + $smiley_cache[$orig_source] = array(15, 15); + return 15; + } + + return $smiley_cache[$orig_source][$axis]; +} + +/** +* Obtain the width of the specified avatar +*/ +function get_avatar_width($src, $func = false, $arg1 = false, $arg2 = false) +{ + return get_avatar_dim($src, 0, $func, $arg1, $arg2); +} + +/** +* Obtain the height of the specified avatar +*/ +function get_avatar_height($src, $func = false, $arg1 = false, $arg2 = false) +{ + return get_avatar_dim($src, 1, $func, $arg1, $arg2); +} + +/** +*/ +function get_avatar_dim($src, $axis, $func = false, $arg1 = false, $arg2 = false) +{ + $avatar_type = AVATAR_UPLOAD; + + if ($func) + { + if ($arg1 || $arg2) + { + $ary = array($arg1); + + if ($arg2) + { + $ary[] = $arg2; + } + + $avatar_type = call_user_func_array($func, $ary); + } + else + { + $avatar_type = call_user_func($func); + } + } + + switch ($avatar_type) + { + case AVATAR_UPLOAD: + return get_upload_avatar_dim($src, $axis); + break; + + case AVATAR_GALLERY: + return get_gallery_avatar_dim($src, $axis); + break; + + case AVATAR_REMOTE: + // see notes on this functions usage and (hopefully) model $func to avoid this accordingly + return get_remote_avatar_dim($src, $axis); + break; + + default: + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + + return $axis ? $default_y : $default_x; + break; + } +} + +/** +* Obtain the size of the specified uploaded avatar (using the cache if possible) and cache the value +*/ +function get_upload_avatar_dim($source, $axis) +{ + static $cachedims = false; + static $cachekey = false; + + if (empty($source)) + { + return 0; + } + + if ($cachekey == $source) + { + return $cachedims[$axis]; + } + + if (substr($source, 0, 7) == 'upload:') + { + $source = substr($source, 7); + } + + global $convert, $user; + + if (!isset($convert->convertor['avatar_path'])) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_AVATAR_PATH'], 'get_upload_avatar_dim()'), __LINE__, __FILE__); + } + + if (!empty($convert->convertor['avatar_path']) && strpos($source, $convert->convertor['avatar_path']) !== 0) + { + $source = path($convert->convertor['avatar_path'], empty($convert->convertor['source_path_absolute'])) . $source; + } + + $cachedims = get_image_dim($source); + + if (empty($cachedims) || empty($cachedims[0]) || empty($cachedims[1])) + { + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + + $cachedims = array($default_x, $default_y); + } + + return $cachedims[$axis]; +} + +/** +* Obtain the size of the specified gallery avatar (using the cache if possible) and cache the value +*/ +function get_gallery_avatar_dim($source, $axis) +{ + if (empty($source)) + { + return 0; + } + + static $avatar_cache = array(); + + if (isset($avatar_cache[$source])) + { + return $avatar_cache[$source][$axis]; + } + + global $convert, $user; + + $orig_source = $source; + + if (!isset($convert->convertor['avatar_gallery_path'])) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_GALLERY_PATH'], 'get_gallery_avatar_dim()'), __LINE__, __FILE__); + } + + if (!empty($convert->convertor['avatar_gallery_path']) && strpos($source, $convert->convertor['avatar_gallery_path']) !== 0) + { + $source = path($convert->convertor['avatar_gallery_path'], empty($convert->convertor['source_path_absolute'])) . $source; + } + + $avatar_cache[$orig_source] = get_image_dim($source); + + if (empty($avatar_cache[$orig_source]) || empty($avatar_cache[$orig_source][0]) || empty($avatar_cache[$orig_source][1])) + { + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + + $avatar_cache[$orig_source] = array($default_x, $default_y); + } + + return $avatar_cache[$orig_source][$axis]; +} + +/** +* Obtain the size of the specified remote avatar (using the cache if possible) and cache the value +* Whilst it's unlikely that remote avatars will be duplicated, it is possible so caching seems the best option +* This should only be called from a post processing step due to the possibility of network timeouts +*/ +function get_remote_avatar_dim($src, $axis) +{ + if (empty($src)) + { + return 0; + } + + static $remote_avatar_cache = array(); + + // an ugly hack: we assume that the dimensions of each remote avatar are accessed exactly twice (x and y) + if (isset($remote_avatar_cache[$src])) + { + $retval = $remote_avatar_cache[$src][$axis]; + unset($remote_avatar_cache); + return $retval; + } + + $url_info = @parse_url($src); + if (empty($url_info['host'])) + { + return 0; + } + $host = $url_info['host']; + $port = (isset($url_info['port'])) ? $url_info['port'] : 0; + $protocol = (isset($url_info['scheme'])) ? $url_info['scheme'] : 'http'; + if (empty($port)) + { + switch (strtolower($protocol)) + { + case 'ftp': + $port = 21; + break; + + case 'https': + $port = 443; + break; + + default: + $port = 80; + } + } + + $timeout = @ini_get('default_socket_timeout'); + @ini_set('default_socket_timeout', 2); + + // We're just trying to reach the server to avoid timeouts + $fp = @fsockopen($host, $port, $errno, $errstr, 1); + if ($fp) + { + $remote_avatar_cache[$src] = @getimagesize($src); + fclose($fp); + } + + $default_x = (defined('DEFAULT_AVATAR_X_CUSTOM')) ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X; + $default_y = (defined('DEFAULT_AVATAR_Y_CUSTOM')) ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y; + $default = array($default_x, $default_y); + + if (empty($remote_avatar_cache[$src]) || empty($remote_avatar_cache[$src][0]) || empty($remote_avatar_cache[$src][1])) + { + $remote_avatar_cache[$src] = $default; + } + else + { + // We trust gallery and uploaded avatars to conform to the size settings; we might have to adjust here + if ($remote_avatar_cache[$src][0] > $default_x || $remote_avatar_cache[$src][1] > $default_y) + { + $bigger = ($remote_avatar_cache[$src][0] > $remote_avatar_cache[$src][1]) ? 0 : 1; + $ratio = $default[$bigger] / $remote_avatar_cache[$src][$bigger]; + $remote_avatar_cache[$src][0] = (int) ($remote_avatar_cache[$src][0] * $ratio); + $remote_avatar_cache[$src][1] = (int) ($remote_avatar_cache[$src][1] * $ratio); + } + } + + @ini_set('default_socket_timeout', $timeout); + return $remote_avatar_cache[$src][$axis]; +} + +function set_user_options() +{ + global $convert_row; + + // Key need to be set in row, else default value is chosen + $keyoptions = array( + 'viewimg' => array('bit' => 0, 'default' => 1), + 'viewflash' => array('bit' => 1, 'default' => 1), + 'viewsmilies' => array('bit' => 2, 'default' => 1), + 'viewsigs' => array('bit' => 3, 'default' => 1), + 'viewavatars' => array('bit' => 4, 'default' => 1), + 'viewcensors' => array('bit' => 5, 'default' => 1), + 'attachsig' => array('bit' => 6, 'default' => 0), + 'bbcode' => array('bit' => 8, 'default' => 1), + 'smilies' => array('bit' => 9, 'default' => 1), + 'sig_bbcode' => array('bit' => 15, 'default' => 1), + 'sig_smilies' => array('bit' => 16, 'default' => 1), + 'sig_links' => array('bit' => 17, 'default' => 1), + ); + + $option_field = 0; + + foreach ($keyoptions as $key => $key_ary) + { + $value = (isset($convert_row[$key])) ? (int) $convert_row[$key] : $key_ary['default']; + + if ($value && !($option_field & 1 << $key_ary['bit'])) + { + $option_field += 1 << $key_ary['bit']; + } + } + + return $option_field; +} + +/** +* Index messages on the fly as we convert them +* @todo naderman, can you check that this works with the new search plugins as it's use is currently disabled (and thus untested) +function search_indexing($message = '') +{ + global $fulltext_search, $convert_row; + + if (!isset($convert_row['post_id'])) + { + return; + } + + if (!$message) + { + if (!isset($convert_row['message'])) + { + return; + } + + $message = $convert_row['message']; + } + + $title = (isset($convert_row['title'])) ? $convert_row['title'] : ''; + + $fulltext_search->index('post', $convert_row['post_id'], $message, $title, $convert_row['poster_id'], $convert_row['forum_id']); +} +*/ + +function make_unique_filename($filename) +{ + if (!strlen($filename)) + { + $filename = md5(unique_id()) . '.dat'; + } + else if ($filename[0] == '.') + { + $filename = md5(unique_id()) . $filename; + } + else if (preg_match('/\.([a-z]+)$/i', $filename, $m)) + { + $filename = preg_replace('/\.([a-z]+)$/i', '_' . md5(unique_id()) . '.\1', $filename); + } + else + { + $filename .= '_' . md5(unique_id()) . '.dat'; + } + + return $filename; +} + +function words_unique(&$words) +{ + reset($words); + $return_array = array(); + + $word = current($words); + do + { + $return_array[$word] = $word; + } + while ($word = next($words)); + + return $return_array; +} + +/** +* Adds a user to the specified group and optionally makes them a group leader +* This function does not create the group if it does not exist and so should only be called after the groups have been created +*/ +function add_user_group($group_id, $user_id, $group_leader = false) +{ + global $db; + + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'group_id' => $group_id, + 'user_id' => $user_id, + 'group_leader' => ($group_leader) ? 1 : 0, + 'user_pending' => 0)); + $db->sql_query($sql); +} + +// STANDALONE FUNCTIONS + +/** +* Add users to the pre-defined "special" groups +* +* @param string $group The name of the special group to add to +* @param string $select_query An SQL query to retrieve the user(s) to add to the group +*/ +function user_group_auth($group, $select_query, $use_src_db) +{ + global $convert, $user, $db, $src_db, $same_db; + + if (!in_array($group, array('guests', 'registered', 'registered_coppa', 'global_moderators', 'administrators', 'bots'))) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_WRONG_GROUP'], $group, 'user_group_auth()'), __LINE__, __FILE__, true); + return; + } + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $db->sql_escape(strtoupper($group)) . "'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if (!$group_id) + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_GROUP'], $group, 'user_group_auth()'), __LINE__, __FILE__, true); + return; + } + + if ($same_db || !$use_src_db) + { + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' (user_id, group_id, user_pending) + ' . str_replace('{' . strtoupper($group) . '}', $group_id . ', 0', $select_query); + $db->sql_query($sql); + } + else + { + $result = $src_db->sql_query(str_replace('{' . strtoupper($group) . '}', $group_id . ' ', $select_query)); + while ($row = $src_db->sql_fetchrow($result)) + { + // this might become quite a lot of INSERTS unfortunately + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . " (user_id, group_id, user_pending) + VALUES ({$row['user_id']}, $group_id, 0)"; + $db->sql_query($sql); + } + $src_db->sql_freeresult($result); + } +} + +/** +* Retrieves configuration information from the source forum and caches it as an array +* Both database and file driven configuration formats can be handled +* (the type used is specified in $config_schema, see convert_phpbb20.php for more details) +*/ +function get_config() +{ + static $convert_config; + global $user; + + if (isset($convert_config)) + { + return $convert_config; + } + + global $src_db, $same_db; + global $convert; + + if ($convert->config_schema['table_format'] != 'file') + { + if ($convert->mysql_convert && $same_db) + { + $src_db->sql_query("SET NAMES 'binary'"); + } + + $sql = 'SELECT * FROM ' . $convert->src_table_prefix . $convert->config_schema['table_name']; + $result = $src_db->sql_query($sql); + $row = $src_db->sql_fetchrow($result); + + if (!$row) + { + $convert->p_master->error($user->lang['CONV_ERROR_GET_CONFIG'], __LINE__, __FILE__); + } + } + + if (is_array($convert->config_schema['table_format'])) + { + $convert_config = array(); + list($key, $val) = each($convert->config_schema['table_format']); + + do + { + $convert_config[$row[$key]] = $row[$val]; + } + while ($row = $src_db->sql_fetchrow($result)); + $src_db->sql_freeresult($result); + + if ($convert->mysql_convert && $same_db) + { + $src_db->sql_query("SET NAMES 'utf8'"); + } + } + else if ($convert->config_schema['table_format'] == 'file') + { + $filename = $convert->options['forum_path'] . '/' . $convert->config_schema['filename']; + if (!file_exists($filename)) + { + $convert->p_master->error($user->lang('FILE_NOT_FOUND', $filename), __LINE__, __FILE__); + } + + if (isset($convert->config_schema['array_name'])) + { + unset($convert->config_schema['array_name']); + } + + $convert_config = extract_variables_from_file($filename); + if (!empty($convert->config_schema['array_name'])) + { + $convert_config = $convert_config[$convert->config_schema['array_name']]; + } + } + else + { + $convert_config = $row; + if ($convert->mysql_convert && $same_db) + { + $src_db->sql_query("SET NAMES 'utf8'"); + } + } + + if (!count($convert_config)) + { + $convert->p_master->error($user->lang['CONV_ERROR_CONFIG_EMPTY'], __LINE__, __FILE__); + } + + return $convert_config; +} + +/** +* Transfers the relevant configuration information from the source forum +* The mapping of fields is specified in $config_schema, see convert_phpbb20.php for more details +*/ +function restore_config($schema) +{ + global $config; + + $convert_config = get_config(); + + foreach ($schema['settings'] as $config_name => $src) + { + if (preg_match('/(.*)\((.*)\)/', $src, $m)) + { + $var = (empty($m[2]) || empty($convert_config[$m[2]])) ? "''" : "'" . addslashes($convert_config[$m[2]]) . "'"; + $exec = '$config_value = ' . $m[1] . '(' . $var . ');'; + // @codingStandardsIgnoreStart + eval($exec); + // @codingStandardsIgnoreEnd + } + else + { + if ($schema['table_format'] != 'file' || empty($schema['array_name'])) + { + $config_value = (isset($convert_config[$src])) ? $convert_config[$src] : ''; + } + else if (!empty($schema['array_name'])) + { + $src_ary = $schema['array_name']; + $config_value = (isset($convert_config[$src_ary][$src])) ? $convert_config[$src_ary][$src] : ''; + } + } + + if ($config_value !== '') + { + // Most are... + if (is_string($config_value)) + { + $config_value = truncate_string(utf8_htmlspecialchars($config_value), 255, 255, false); + } + + $config->set($config_name, $config_value); + } + } +} + +/** +* Update the count of PM's in custom folders for all users +*/ +function update_folder_pm_count() +{ + global $db; + + $sql = 'SELECT user_id, folder_id, COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ', ' . PRIVMSGS_INBOX . ', ' . PRIVMSGS_OUTBOX . ', ' . PRIVMSGS_SENTBOX . ') + GROUP BY folder_id, user_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . PRIVMSGS_FOLDER_TABLE . ' SET pm_count = ' . $row['num_messages'] . ' + WHERE user_id = ' . $row['user_id'] . ' AND folder_id = ' . $row['folder_id']); + } + $db->sql_freeresult($result); +} + +// Functions mainly used by the main convertor script + +function path($path, $path_relative = true) +{ + if ($path === false) + { + return ''; + } + + if (substr($path, -1) != '/') + { + $path .= '/'; + } + + if (!$path_relative) + { + return $path; + } + + if (substr($path, 0, 1) == '/') + { + $path = substr($path, 1); + } + + return $path; +} + +/** +* Extract the variables defined in a configuration file +* @todo As noted by Xore we need to look at this from a security perspective +*/ +function extract_variables_from_file($_filename) +{ + include($_filename); + + $vars = get_defined_vars(); + unset($vars['_filename']); + + return $vars; +} + +function get_path($src_path, $src_url, $test_file) +{ + global $phpbb_root_path, $phpEx; + + $board_config = get_config(); + + $test_file = preg_replace('/\.php$/i', ".$phpEx", $test_file); + $src_path = path($src_path); + + if (@file_exists($phpbb_root_path . $src_path . $test_file)) + { + return $src_path; + } + + if (!empty($src_url) && !empty($board_config['server_name'])) + { + if (!preg_match('#https?://([^/]+)(.*)#i', $src_url, $m)) + { + return false; + } + + if ($m[1] != $board_config['server_name']) + { + return false; + } + + $url_parts = explode('/', $m[2]); + if (substr($src_url, -1) != '/') + { + if (preg_match('/.*\.([a-z0-9]{3,4})$/i', $url_parts[count($url_parts) - 1])) + { + $url_parts[count($url_parts) - 1] = ''; + } + else + { + $url_parts[] = ''; + } + } + + $script_path = $board_config['script_path']; + if (substr($script_path, -1) == '/') + { + $script_path = substr($script_path, 0, -1); + } + + $path_array = array(); + + $phpbb_parts = explode('/', $script_path); + for ($i = 0, $end = count($url_parts); $i < $end; ++$i) + { + if ($i < count($phpbb_parts[$i]) && $url_parts[$i] == $phpbb_parts[$i]) + { + $path_array[] = $url_parts[$i]; + unset($url_parts[$i]); + } + else + { + $path = ''; + for ($j = $i, $end2 = count($phpbb_parts); $j < $end2; ++$j) + { + $path .= '../'; + } + $path .= implode('/', $url_parts); + break; + } + } + + if (!empty($path)) + { + if (@file_exists($phpbb_root_path . $path . $test_file)) + { + return $path; + } + } + } + + return false; +} + +function compare_table($tables, $tablename, &$prefixes) +{ + for ($i = 0, $table_size = count($tables); $i < $table_size; ++$i) + { + if (preg_match('/(.*)' . $tables[$i] . '$/', $tablename, $m)) + { + if (empty($m[1])) + { + $m[1] = '*'; + } + + if (isset($prefixes[$m[1]])) + { + $prefixes[$m[1]]++; + } + else + { + $prefixes[$m[1]] = 1; + } + } + } +} + +/** +* Grant permissions to a specified user or group +* +* @param string $ug_type user|group|user_role|group_role +* @param mixed $forum_id forum ids (array|int|0) -> 0 == all forums +* @param mixed $ug_id [int] user_id|group_id : [string] usergroup name +* @param mixed $acl_list [string] acl entry : [array] acl entries : [string] role entry +* @param int $setting ACL_YES|ACL_NO|ACL_NEVER +*/ +function mass_auth($ug_type, $forum_id, $ug_id, $acl_list, $setting = ACL_NO) +{ + global $db; + static $acl_option_ids, $group_ids; + + if (($ug_type == 'group' || $ug_type == 'group_role') && is_string($ug_id)) + { + if (!isset($group_ids[$ug_id])) + { + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $db->sql_escape(strtoupper($ug_id)) . "'"; + $result = $db->sql_query_limit($sql, 1); + $id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if (!$id) + { + return; + } + + $group_ids[$ug_id] = $id; + } + + $ug_id = (int) $group_ids[$ug_id]; + } + + $table = ($ug_type == 'user' || $ug_type == 'user_role') ? ACL_USERS_TABLE : ACL_GROUPS_TABLE; + $id_field = ($ug_type == 'user' || $ug_type == 'user_role') ? 'user_id' : 'group_id'; + + // Role based permissions are the simplest to handle so check for them first + if ($ug_type == 'user_role' || $ug_type == 'group_role') + { + if (is_numeric($forum_id)) + { + $sql = 'SELECT role_id + FROM ' . ACL_ROLES_TABLE . " + WHERE role_name = 'ROLE_" . $db->sql_escape($acl_list) . "'"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // If we have no role id there is something wrong here + if ($row) + { + $sql = "INSERT INTO $table ($id_field, forum_id, auth_role_id) VALUES ($ug_id, $forum_id, " . $row['role_id'] . ')'; + $db->sql_query($sql); + } + } + + return; + } + + // Build correct parameters + $auth = array(); + + if (!is_array($acl_list)) + { + $auth = array($acl_list => $setting); + } + else + { + foreach ($acl_list as $auth_option) + { + $auth[$auth_option] = $setting; + } + } + unset($acl_list); + + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + // Set any flags as required + foreach ($auth as $auth_option => $acl_setting) + { + $flag = substr($auth_option, 0, strpos($auth_option, '_') + 1); + if (empty($auth[$flag])) + { + $auth[$flag] = $acl_setting; + } + } + + if (!is_array($acl_option_ids) || empty($acl_option_ids)) + { + $sql = 'SELECT auth_option_id, auth_option + FROM ' . ACL_OPTIONS_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $acl_option_ids[$row['auth_option']] = $row['auth_option_id']; + } + $db->sql_freeresult($result); + } + + $sql_forum = 'AND ' . $db->sql_in_set('a.forum_id', array_map('intval', $forum_id), false, true); + + $sql = ($ug_type == 'user') ? 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting FROM ' . ACL_USERS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $sql_forum AND a.user_id = $ug_id" : 'SELECT o.auth_option_id, o.auth_option, a.forum_id, a.auth_setting FROM ' . ACL_GROUPS_TABLE . ' a, ' . ACL_OPTIONS_TABLE . " o WHERE a.auth_option_id = o.auth_option_id $sql_forum AND a.group_id = $ug_id"; + $result = $db->sql_query($sql); + + $cur_auth = array(); + while ($row = $db->sql_fetchrow($result)) + { + $cur_auth[$row['forum_id']][$row['auth_option_id']] = $row['auth_setting']; + } + $db->sql_freeresult($result); + + $sql_ary = array(); + foreach ($forum_id as $forum) + { + foreach ($auth as $auth_option => $setting) + { + $auth_option_id = $acl_option_ids[$auth_option]; + + if (!$auth_option_id) + { + continue; + } + + switch ($setting) + { + case ACL_NO: + if (isset($cur_auth[$forum][$auth_option_id])) + { + $sql_ary['delete'][] = "DELETE FROM $table + WHERE forum_id = $forum + AND auth_option_id = $auth_option_id + AND $id_field = $ug_id"; + } + break; + + default: + if (!isset($cur_auth[$forum][$auth_option_id])) + { + $sql_ary['insert'][] = "$ug_id, $forum, $auth_option_id, $setting"; + } + else if ($cur_auth[$forum][$auth_option_id] != $setting) + { + $sql_ary['update'][] = "UPDATE " . $table . " + SET auth_setting = $setting + WHERE $id_field = $ug_id + AND forum_id = $forum + AND auth_option_id = $auth_option_id"; + } + } + } + } + unset($cur_auth); + + $sql = ''; + foreach ($sql_ary as $sql_type => $sql_subary) + { + switch ($sql_type) + { + case 'insert': + switch ($db->get_sql_layer()) + { + case 'mysql': + case 'mysql4': + $sql = 'VALUES ' . implode(', ', preg_replace('#^(.*?)$#', '(\1)', $sql_subary)); + break; + + case 'sqlite3': + case 'mssqlnative': + $sql = implode(' UNION ALL ', preg_replace('#^(.*?)$#', 'SELECT \1', $sql_subary)); + break; + + default: + foreach ($sql_subary as $sql) + { + $sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) VALUES ($sql)"; + $db->sql_query($sql); + $sql = ''; + } + } + + if ($sql != '') + { + $sql = "INSERT INTO $table ($id_field, forum_id, auth_option_id, auth_setting) $sql"; + $db->sql_query($sql); + } + break; + + case 'update': + case 'delete': + foreach ($sql_subary as $sql) + { + $db->sql_query($sql); + $sql = ''; + } + break; + } + unset($sql_ary[$sql_type]); + } + unset($sql_ary); + +} + +/** +* Update the count of unread private messages for all users +*/ +function update_unread_count() +{ + global $db; + + $sql = 'SELECT user_id, COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE pm_unread = 1 + AND folder_id <> ' . PRIVMSGS_OUTBOX . ' + GROUP BY user_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET user_unread_privmsg = ' . $row['num_messages'] . ' + WHERE user_id = ' . $row['user_id']); + } + $db->sql_freeresult($result); +} + +/** +* Add any of the pre-defined "special" groups which are missing from the database +*/ +function add_default_groups() +{ + global $db; + + $default_groups = array( + 'GUESTS' => array('', 0, 0), + 'REGISTERED' => array('', 0, 0), + 'REGISTERED_COPPA' => array('', 0, 0), + 'GLOBAL_MODERATORS' => array('00AA00', 2, 0), + 'ADMINISTRATORS' => array('AA0000', 1, 1), + 'BOTS' => array('9E8DA7', 0, 0), + 'NEWLY_REGISTERED' => array('', 0, 0), + ); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_name', array_keys($default_groups)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + unset($default_groups[strtoupper($row['group_name'])]); + } + $db->sql_freeresult($result); + + $sql_ary = array(); + + foreach ($default_groups as $name => $data) + { + $sql_ary[] = array( + 'group_name' => (string) $name, + 'group_desc' => '', + 'group_desc_uid' => '', + 'group_desc_bitfield' => '', + 'group_type' => GROUP_SPECIAL, + 'group_colour' => (string) $data[0], + 'group_legend' => (int) $data[1], + 'group_founder_manage' => (int) $data[2], + ); + } + + if (count($sql_ary)) + { + $db->sql_multi_insert(GROUPS_TABLE, $sql_ary); + } +} + +function add_groups_to_teampage() +{ + global $db; + + $teampage_groups = array( + 'ADMINISTRATORS' => 1, + 'GLOBAL_MODERATORS' => 2, + ); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_name', array_keys($teampage_groups)); + $result = $db->sql_query($sql); + + $teampage_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $teampage_ary[] = array( + 'group_id' => (int) $row['group_id'], + 'teampage_name' => '', + 'teampage_position' => (int) $teampage_groups[$row['group_name']], + 'teampage_parent' => 0, + ); + } + $db->sql_freeresult($result); + + if (count($teampage_ary)) + { + $db->sql_multi_insert(TEAMPAGE_TABLE, $teampage_ary); + } +} + + +/** +* Sync post count. We might need to do this in batches. +*/ +function sync_post_count($offset, $limit) +{ + global $db; + $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id + FROM ' . POSTS_TABLE . ' + WHERE post_postcount = 1 + AND post_visibility = ' . ITEM_APPROVED . ' + GROUP BY poster_id + ORDER BY poster_id'; + $result = $db->sql_query_limit($sql, $limit, $offset); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}"); + } + $db->sql_freeresult($result); +} + +/** +* Add the search bots into the database +* This code should be used in execute_last if the source database did not have bots +* If you are converting bots this function should not be called +* @todo We might want to look at sharing the bot list between the install code and this code for consistancy +*/ +function add_bots() +{ + global $db, $convert, $user, $config, $phpbb_root_path, $phpEx; + + $db->sql_query($convert->truncate_statement . BOTS_TABLE); + + $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id', false, $result); + $db->sql_freeresult($result); + + if (!$group_id) + { + add_default_groups(); + + $sql = 'SELECT group_id FROM ' . GROUPS_TABLE . " WHERE group_name = 'BOTS'"; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id', false, $result); + $db->sql_freeresult($result); + + if (!$group_id) + { + global $install; + $install->error($user->lang['CONV_ERROR_INCONSISTENT_GROUPS'], __LINE__, __FILE__); + } + } + + $bots = array( + 'AdsBot [Google]' => array('AdsBot-Google', ''), + 'Alexa [Bot]' => array('ia_archiver', ''), + 'Alta Vista [Bot]' => array('Scooter/', ''), + 'Ask Jeeves [Bot]' => array('Ask Jeeves', ''), + 'Baidu [Spider]' => array('Baiduspider+(', ''), + 'Bing [Bot]' => array('bingbot/', ''), + 'Exabot [Bot]' => array('Exabot/', ''), + 'FAST Enterprise [Crawler]' => array('FAST Enterprise Crawler', ''), + 'FAST WebCrawler [Crawler]' => array('FAST-WebCrawler/', ''), + 'Francis [Bot]' => array('http://www.neomo.de/', ''), + 'Gigabot [Bot]' => array('Gigabot/', ''), + 'Google Adsense [Bot]' => array('Mediapartners-Google', ''), + 'Google Desktop' => array('Google Desktop', ''), + 'Google Feedfetcher' => array('Feedfetcher-Google', ''), + 'Google [Bot]' => array('Googlebot', ''), + 'Heise IT-Markt [Crawler]' => array('heise-IT-Markt-Crawler', ''), + 'Heritrix [Crawler]' => array('heritrix/1.', ''), + 'IBM Research [Bot]' => array('ibm.com/cs/crawler', ''), + 'ICCrawler - ICjobs' => array('ICCrawler - ICjobs', ''), + 'ichiro [Crawler]' => array('ichiro/2', ''), + 'Majestic-12 [Bot]' => array('MJ12bot/', ''), + 'Metager [Bot]' => array('MetagerBot/', ''), + 'MSN NewsBlogs' => array('msnbot-NewsBlogs/', ''), + 'MSN [Bot]' => array('msnbot/', ''), + 'MSNbot Media' => array('msnbot-media/', ''), + 'NG-Search [Bot]' => array('NG-Search/', ''), + 'Nutch [Bot]' => array('http://lucene.apache.org/nutch/', ''), + 'Nutch/CVS [Bot]' => array('NutchCVS/', ''), + 'OmniExplorer [Bot]' => array('OmniExplorer_Bot/', ''), + 'Online link [Validator]' => array('online link validator', ''), + 'psbot [Picsearch]' => array('psbot/0', ''), + 'Seekport [Bot]' => array('Seekbot/', ''), + 'Sensis [Crawler]' => array('Sensis Web Crawler', ''), + 'SEO Crawler' => array('SEO search Crawler/', ''), + 'Seoma [Crawler]' => array('Seoma [SEO Crawler]', ''), + 'SEOSearch [Crawler]' => array('SEOsearch/', ''), + 'Snappy [Bot]' => array('Snappy/1.1 ( http://www.urltrends.com/ )', ''), + 'Steeler [Crawler]' => array('http://www.tkl.iis.u-tokyo.ac.jp/~crawler/', ''), + 'Synoo [Bot]' => array('SynooBot/', ''), + 'Telekom [Bot]' => array('crawleradmin.t-info@telekom.de', ''), + 'TurnitinBot [Bot]' => array('TurnitinBot/', ''), + 'Voyager [Bot]' => array('voyager/1.0', ''), + 'W3 [Sitesearch]' => array('W3 SiteSearch Crawler', ''), + 'W3C [Linkcheck]' => array('W3C-checklink/', ''), + 'W3C [Validator]' => array('W3C_*Validator', ''), + 'WiseNut [Bot]' => array('http://www.WISEnutbot.com', ''), + 'YaCy [Bot]' => array('yacybot', ''), + 'Yahoo MMCrawler [Bot]' => array('Yahoo-MMCrawler/', ''), + 'Yahoo Slurp [Bot]' => array('Yahoo! DE Slurp', ''), + 'Yahoo [Bot]' => array('Yahoo! Slurp', ''), + 'YahooSeeker [Bot]' => array('YahooSeeker/', ''), + ); + + if (!function_exists('user_add')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + foreach ($bots as $bot_name => $bot_ary) + { + $user_row = array( + 'user_type' => USER_IGNORE, + 'group_id' => $group_id, + 'username' => $bot_name, + 'user_regdate' => time(), + 'user_password' => '', + 'user_colour' => '9E8DA7', + 'user_email' => '', + 'user_lang' => $config['default_lang'], + 'user_style' => 1, + 'user_timezone' => 'UTC', + 'user_allow_massemail' => 0, + ); + + $user_id = user_add($user_row); + + if ($user_id) + { + $sql = 'INSERT INTO ' . BOTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'bot_active' => 1, + 'bot_name' => $bot_name, + 'user_id' => $user_id, + 'bot_agent' => $bot_ary[0], + 'bot_ip' => $bot_ary[1]) + ); + $db->sql_query($sql); + } + } +} + +/** +* Update any dynamic configuration variables after the conversion is finished +* @todo Confirm that this updates all relevant values since it has not necessarily been kept in sync with all changes +*/ +function update_dynamic_config() +{ + global $db, $config; + + // Get latest username + $sql = 'SELECT user_id, username, user_colour + FROM ' . USERS_TABLE . ' + WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + + if (!empty($config['increment_user_id'])) + { + $sql .= ' AND user_id <> ' . $config['increment_user_id']; + } + + $sql .= ' ORDER BY user_id DESC'; + + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $config->set('newest_user_id', $row['user_id'], false); + $config->set('newest_username', $row['username'], false); + $config->set('newest_user_colour', $row['user_colour'], false); + } + +// Also do not reset record online user/date. There will be old data or the fresh data from the schema. +// set_config('record_online_users', 1, true); +// set_config('record_online_date', time(), true); + + $sql = 'SELECT COUNT(post_id) AS stat + FROM ' . POSTS_TABLE . ' + WHERE post_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_posts', (int) $row['stat'], false); + + $sql = 'SELECT COUNT(topic_id) AS stat + FROM ' . TOPICS_TABLE . ' + WHERE topic_visibility = ' . ITEM_APPROVED; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_topics', (int) $row['stat'], false); + + $sql = 'SELECT COUNT(user_id) AS stat + FROM ' . USERS_TABLE . ' + WHERE user_type IN (' . USER_NORMAL . ',' . USER_FOUNDER . ')'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('num_users', (int) $row['stat'], false); + + $sql = 'SELECT COUNT(attach_id) as stat + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 0'; + $result = $db->sql_query($sql); + $config->set('num_files', (int) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + $sql = 'SELECT SUM(filesize) as stat + FROM ' . ATTACHMENTS_TABLE . ' + WHERE is_orphan = 0'; + $result = $db->sql_query($sql); + $config->set('upload_dir_size', (float) $db->sql_fetchfield('stat'), false); + $db->sql_freeresult($result); + + /** + * We do not resync users post counts - this can be done by the admin after conversion if wanted. + $sql = 'SELECT COUNT(post_id) AS num_posts, poster_id + FROM ' . POSTS_TABLE . ' + WHERE post_postcount = 1 + GROUP BY poster_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_posts = {$row['num_posts']} WHERE user_id = {$row['poster_id']}"); + } + $db->sql_freeresult($result); + */ +} + +/** +* Updates topics_posted entries +*/ +function update_topics_posted() +{ + global $db; + + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $db->sql_query('DELETE FROM ' . TOPICS_POSTED_TABLE); + break; + + default: + $db->sql_query('TRUNCATE TABLE ' . TOPICS_POSTED_TABLE); + break; + } + + // This can get really nasty... therefore we only do the last six months + $get_from_time = time() - (6 * 4 * 7 * 24 * 60 * 60); + + // Select forum ids, do not include categories + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type <> ' . FORUM_CAT; + $result = $db->sql_query($sql); + + $forum_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_ids[] = $row['forum_id']; + } + $db->sql_freeresult($result); + + // Any global announcements? ;) + $forum_ids[] = 0; + + // Now go through the forums and get us some topics... + foreach ($forum_ids as $forum_id) + { + $sql = 'SELECT p.poster_id, p.topic_id + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t + WHERE t.forum_id = ' . $forum_id . ' + AND t.topic_moved_id = 0 + AND t.topic_last_post_time > ' . $get_from_time . ' + AND t.topic_id = p.topic_id + AND p.poster_id <> ' . ANONYMOUS . ' + GROUP BY p.poster_id, p.topic_id'; + $result = $db->sql_query($sql); + + $posted = array(); + while ($row = $db->sql_fetchrow($result)) + { + $posted[$row['poster_id']][] = $row['topic_id']; + } + $db->sql_freeresult($result); + + $sql_ary = array(); + foreach ($posted as $user_id => $topic_row) + { + foreach ($topic_row as $topic_id) + { + $sql_ary[] = array( + 'user_id' => (int) $user_id, + 'topic_id' => (int) $topic_id, + 'topic_posted' => 1, + ); + } + } + unset($posted); + + if (count($sql_ary)) + { + $db->sql_multi_insert(TOPICS_POSTED_TABLE, $sql_ary); + } + } +} + +/** +* Ensure that all users have a default group specified and update related information such as their colour +*/ +function fix_empty_primary_groups() +{ + global $db; + + // Set group ids for users not already having it + $sql = 'UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('registered') . ' + WHERE group_id = 0 AND user_type = ' . USER_INACTIVE; + $db->sql_query($sql); + + $sql = 'UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('registered') . ' + WHERE group_id = 0 AND user_type = ' . USER_NORMAL; + $db->sql_query($sql); + + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('guests') . ' WHERE user_id = ' . ANONYMOUS); + + $sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . ' WHERE group_id = ' . get_group_id('administrators'); + $result = $db->sql_query($sql); + + $user_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (count($user_ids)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('administrators') . ' + WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids)); + } + + $sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . ' WHERE group_id = ' . get_group_id('global_moderators'); + $result = $db->sql_query($sql); + + $user_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (count($user_ids)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET group_id = ' . get_group_id('global_moderators') . ' + WHERE group_id = 0 AND ' . $db->sql_in_set('user_id', $user_ids)); + } + + // Set user colour + $sql = 'SELECT group_id, group_colour FROM ' . GROUPS_TABLE . " + WHERE group_colour <> ''"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $db->sql_query('UPDATE ' . USERS_TABLE . " SET user_colour = '{$row['group_colour']}' WHERE group_id = {$row['group_id']}"); + } + $db->sql_freeresult($result); +} + +/** +* Cleanly remove invalid user entries after converting the users table... +*/ +function remove_invalid_users() +{ + global $db, $phpEx, $phpbb_root_path; + + // username_clean is UNIQUE + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE username_clean = ''"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + if (!function_exists('user_delete')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + user_delete('remove', $row['user_id']); + } +} + +function convert_bbcode($message, $convert_size = true, $extended_bbcodes = false) +{ + static $orig, $repl, $origx, $replx, $str_from, $str_to; + + if (empty($orig)) + { + $orig = $repl = array(); + + $orig[] = '#\[(php|sql)\](.*?)\[/(php|sql)\]#is'; + $repl[] = '[code]\2[/code]'; + + $orig[] = '#\[font=[^\]]+\](.*?)\[/font\]#is'; + $repl[] = '\1'; + + $orig[] = '#\[align=[a-z]+\](.*?)\[/align\]#is'; + $repl[] = '\1'; + + $orig[] = '#\[/list=.*?\]#is'; + $repl[] = '[/list]'; + + $origx = array( + '#\[glow[^\]]+\](.*?)\[/glow\]#is', + '#\[shadow[^\]]+\](.*?)\[/shadow\]#is', + '#\[flash[^\]]+\](.*?)\[/flash\]#is' + ); + + $replx = array( + '\1', + '\1', + '[url=\1]Flash[/url]' + ); + + $str_from = array( + '[ftp]', '[/ftp]', + '[ftp=', '[/ftp]', + '[pre]', '[/pre]', + '[table]', '[/table]', + '[td]', '[/td]', + '[tr]', '[/tr]', + '[s]', '[/s]', + '[left]', '[/left]', + '[right]', '[/right]', + '[center]', '[/center]', + '[sub]', '[/sub]', + '[sup]', '[/sup]', + '[tt]', '[/tt]', + '[move]', '[/move]', + '[hr]' + ); + + $str_to = array( + '[url]', '[/url]', + '[url=', '[/url]', + '[code]', '[/code]', + "\n", '', + '', '', + "\n", '', + '', '', + '', '', + '', '', + '', '', + '', '', + '', '', + '', '', + '', '', + "\n\n" + ); + + for ($i = 0, $end = count($str_from); $i < $end; ++$i) + { + $origx[] = '#\\' . str_replace(']', '\\]', $str_from[$i]) . '#is'; + $replx[] = $str_to[$i]; + } + } + + if (preg_match_all('#\[email=([^\]]+)\](.*?)\[/email\]#i', $message, $m)) + { + for ($i = 0, $end = count($m[1]); $i < $end; ++$i) + { + if ($m[1][$i] == $m[2][$i]) + { + $message = str_replace($m[0][$i], '[email]' . $m[1][$i] . '[/email]', $message); + } + else + { + $message = str_replace($m[0][$i], $m[2][$i] . ' ([email]' . $m[1][$i] . '[/email])', $message); + } + } + } + + if ($convert_size && preg_match('#\[size=[0-9]+\].*?\[/size\]#i', $message)) + { + $size = array(9, 9, 12, 15, 18, 24, 29, 29, 29, 29); + $message = preg_replace('#\[size=([0-9]+)\](.*?)\[/size\]#i', '[size=\1]\2[/size]', $message); + $message = preg_replace('#\[size=[0-9]{2,}\](.*?)\[/size\]#i', '[size=29]\1[/size]', $message); + + for ($i = count($size); $i;) + { + $i--; + $message = str_replace('[size=' . $i . ']', '[size=' . $size[$i] . ']', $message); + } + } + + if ($extended_bbcodes) + { + $message = preg_replace($origx, $replx, $message); + } + + $message = preg_replace($orig, $repl, $message); + return $message; +} + + +function copy_file($src, $trg, $overwrite = false, $die_on_failure = true, $source_relative_path = true) +{ + global $convert, $phpbb_root_path, $user, $phpbb_filesystem; + + /** @var \phpbb\filesystem\filesystem_interface $filesystem */ + $filesystem = $phpbb_filesystem; + + if (substr($trg, -1) == '/') + { + $trg .= utf8_basename($src); + } + $src_path = relative_base($src, $source_relative_path, __LINE__, __FILE__); + $trg_path = $trg; + + if (!$overwrite && @file_exists($trg_path)) + { + return true; + } + + if (!@file_exists($src_path)) + { + return; + } + + $path = $phpbb_root_path; + $parts = explode('/', $trg); + unset($parts[count($parts) - 1]); + + for ($i = 0, $end = count($parts); $i < $end; ++$i) + { + $path .= $parts[$i] . '/'; + + if (!is_dir($path)) + { + @mkdir($path, 0777); + } + } + + if (!$filesystem->is_writable($path)) + { + @chmod($path, 0777); + } + + if (!@copy($src_path, $phpbb_root_path . $trg_path)) + { + $convert->p_master->error(sprintf($user->lang['COULD_NOT_COPY'], $src_path, $phpbb_root_path . $trg_path), __LINE__, __FILE__, !$die_on_failure); + return; + } + + if ($perm = @fileperms($src_path)) + { + @chmod($phpbb_root_path . $trg_path, $perm); + } + + return true; +} + +function copy_dir($src, $trg, $copy_subdirs = true, $overwrite = false, $die_on_failure = true, $source_relative_path = true) +{ + global $convert, $phpbb_root_path, $config, $user, $phpbb_filesystem; + + /** @var \phpbb\filesystem\filesystem_interface $filesystem */ + $filesystem = $phpbb_filesystem; + + $dirlist = $filelist = $bad_dirs = array(); + $src = path($src, $source_relative_path); + $trg = path($trg); + $src_path = relative_base($src, $source_relative_path, __LINE__, __FILE__); + $trg_path = $phpbb_root_path . $trg; + + if (!is_dir($trg_path)) + { + @mkdir($trg_path, 0777); + @chmod($trg_path, 0777); + } + + if (!$filesystem->is_writable($trg_path)) + { + $bad_dirs[] = path($config['script_path']) . $trg; + } + + if ($handle = @opendir($src_path)) + { + while ($entry = readdir($handle)) + { + if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm') + { + continue; + } + + if (is_dir($src_path . $entry)) + { + $dirlist[] = $entry; + } + else + { + $filelist[] = $entry; + } + } + closedir($handle); + } + else if ($dir = @dir($src_path)) + { + while ($entry = $dir->read()) + { + if ($entry[0] == '.' || $entry == 'CVS' || $entry == 'index.htm') + { + continue; + } + + if (is_dir($src_path . $entry)) + { + $dirlist[] = $entry; + } + else + { + $filelist[] = $entry; + } + } + $dir->close(); + } + else + { + $convert->p_master->error(sprintf($user->lang['CONV_ERROR_COULD_NOT_READ'], relative_base($src, $source_relative_path)), __LINE__, __FILE__); + } + + if ($copy_subdirs) + { + for ($i = 0, $end = count($dirlist); $i < $end; ++$i) + { + $dir = $dirlist[$i]; + + if ($dir == 'CVS') + { + continue; + } + + if (!is_dir($trg_path . $dir)) + { + @mkdir($trg_path . $dir, 0777); + @chmod($trg_path . $dir, 0777); + } + + if (!$filesystem->is_writable($trg_path . $dir)) + { + $bad_dirs[] = $trg . $dir; + $bad_dirs[] = $trg_path . $dir; + } + + if (!count($bad_dirs)) + { + copy_dir($src . $dir, $trg . $dir, true, $overwrite, $die_on_failure, $source_relative_path); + } + } + } + + if (count($bad_dirs)) + { + $str = (count($bad_dirs) == 1) ? $user->lang['MAKE_FOLDER_WRITABLE'] : $user->lang['MAKE_FOLDERS_WRITABLE']; + sort($bad_dirs); + $convert->p_master->error(sprintf($str, implode('
', $bad_dirs)), __LINE__, __FILE__); + } + + for ($i = 0, $end = count($filelist); $i < $end; ++$i) + { + copy_file($src . $filelist[$i], $trg . $filelist[$i], $overwrite, $die_on_failure, $source_relative_path); + } +} + +function relative_base($path, $is_relative = true, $line = false, $file = false) +{ + global $convert, $user; + + if (!$is_relative) + { + return $path; + } + + if (empty($convert->options['forum_path']) && $is_relative) + { + $line = $line ? $line : __LINE__; + $file = $file ? $file : __FILE__; + + $convert->p_master->error($user->lang['CONV_ERROR_NO_FORUM_PATH'], $line, $file); + } + + return $convert->options['forum_path'] . '/' . $path; +} + +function get_smiley_display() +{ + static $smiley_count = 0; + $smiley_count++; + return ($smiley_count < 50) ? 1 : 0; +} + + +function fill_dateformat($user_dateformat) +{ + global $config; + + return ((empty($user_dateformat)) ? $config['default_dateformat'] : $user_dateformat); +} diff --git a/install/update/old/includes/functions_display.php b/install/update/old/includes/functions_display.php new file mode 100644 index 0000000..7924670 --- /dev/null +++ b/install/update/old/includes/functions_display.php @@ -0,0 +1,1733 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Display Forums +*/ +function display_forums($root_data = '', $display_moderators = true, $return_moderators = false) +{ + global $db, $auth, $user, $template; + global $phpbb_root_path, $phpEx, $config; + global $request, $phpbb_dispatcher, $phpbb_container; + + $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array(); + $parent_id = $visible_forums = 0; + + // Mark forums read? + $mark_read = $request->variable('mark', ''); + + if ($mark_read == 'all') + { + $mark_read = ''; + } + + if (!$root_data) + { + if ($mark_read == 'forums') + { + $mark_read = 'all'; + } + + $root_data = array('forum_id' => 0); + $sql_where = ''; + } + else + { + $sql_where = 'left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id']; + } + + // Handle marking everything read + if ($mark_read == 'all') + { + $redirect = build_url(array('mark', 'hash', 'mark_time')); + meta_refresh(3, $redirect); + + if (check_link_hash($request->variable('hash', ''), 'global')) + { + markread('all', false, false, $request->variable('mark_time', 0)); + + if ($request->is_ajax()) + { + // Tell the ajax script what language vars and URL need to be replaced + $data = array( + 'NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'], + 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'], + 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums&mark_time=' . time()) : '', + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED'] + ); + $json_response = new \phpbb\json_response(); + $json_response->send($data); + } + + trigger_error( + $user->lang['FORUMS_MARKED'] . '

' . + sprintf($user->lang['RETURN_INDEX'], '', '') + ); + } + else + { + trigger_error(sprintf($user->lang['RETURN_PAGE'], '', '')); + } + } + + // Display list of active topics for this category? + $show_active = (isset($root_data['forum_flags']) && ($root_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false; + + $sql_array = array( + 'SELECT' => 'f.*', + 'FROM' => array( + FORUMS_TABLE => 'f' + ), + 'LEFT_JOIN' => array(), + ); + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND ft.forum_id = f.forum_id'); + $sql_array['SELECT'] .= ', ft.mark_time'; + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + + if (!$user->data['is_registered']) + { + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + } + + if ($show_active) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(FORUMS_ACCESS_TABLE => 'fa'), + 'ON' => "fa.forum_id = f.forum_id AND fa.session_id = '" . $db->sql_escape($user->session_id) . "'" + ); + + $sql_array['SELECT'] .= ', fa.user_id'; + } + + $sql_ary = array( + 'SELECT' => $sql_array['SELECT'], + 'FROM' => $sql_array['FROM'], + 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], + + 'WHERE' => $sql_where, + + 'ORDER_BY' => 'f.left_id', + ); + + /** + * Event to modify the SQL query before the forum data is queried + * + * @event core.display_forums_modify_sql + * @var array sql_ary The SQL array to get the data of the forums + * @since 3.1.0-a1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $forum_tracking_info = $valid_categories = array(); + $branch_root_id = $root_data['forum_id']; + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + while ($row = $db->sql_fetchrow($result)) + { + /** + * Event to modify the data set of a forum + * + * This event is triggered once per forum + * + * @event core.display_forums_modify_row + * @var int branch_root_id Last top-level forum + * @var array row The data of the forum + * @since 3.1.0-a1 + */ + $vars = array('branch_root_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_row', compact($vars))); + + $forum_id = $row['forum_id']; + + // Mark forums read? + if ($mark_read == 'forums') + { + if ($auth->acl_get('f_list', $forum_id)) + { + $forum_ids[] = $forum_id; + } + + continue; + } + + // Category with no members + if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) + { + continue; + } + + // Skip branch + if (isset($right_id)) + { + if ($row['left_id'] < $right_id) + { + continue; + } + unset($right_id); + } + + if (!$auth->acl_get('f_list', $forum_id)) + { + // if the user does not have permissions to list this forum, skip everything until next branch + $right_id = $row['right_id']; + continue; + } + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $forum_tracking_info[$forum_id] = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark']; + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + if (!$user->data['is_registered']) + { + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + $forum_tracking_info[$forum_id] = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + } + + // Lets check whether there are unapproved topics/posts, so we can display an information to moderators + $row['forum_id_unapproved_topics'] = ($auth->acl_get('m_approve', $forum_id) && $row['forum_topics_unapproved']) ? $forum_id : 0; + $row['forum_id_unapproved_posts'] = ($auth->acl_get('m_approve', $forum_id) && $row['forum_posts_unapproved']) ? $forum_id : 0; + $row['forum_posts'] = $phpbb_content_visibility->get_count('forum_posts', $row, $forum_id); + $row['forum_topics'] = $phpbb_content_visibility->get_count('forum_topics', $row, $forum_id); + + // Display active topics from this forum? + if ($show_active && $row['forum_type'] == FORUM_POST && $auth->acl_get('f_read', $forum_id) && ($row['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) + { + if (!isset($active_forum_ary['forum_topics'])) + { + $active_forum_ary['forum_topics'] = 0; + } + + if (!isset($active_forum_ary['forum_posts'])) + { + $active_forum_ary['forum_posts'] = 0; + } + + $active_forum_ary['forum_id'][] = $forum_id; + $active_forum_ary['enable_icons'][] = $row['enable_icons']; + $active_forum_ary['forum_topics'] += $row['forum_topics']; + $active_forum_ary['forum_posts'] += $row['forum_posts']; + + // If this is a passworded forum we do not show active topics from it if the user is not authorised to view it... + if ($row['forum_password'] && $row['user_id'] != $user->data['user_id']) + { + $active_forum_ary['exclude_forum_id'][] = $forum_id; + } + } + + // Fill list of categories with forums + if (isset($forum_rows[$row['parent_id']])) + { + $valid_categories[$row['parent_id']] = true; + } + + // + if ($row['parent_id'] == $root_data['forum_id'] || $row['parent_id'] == $branch_root_id) + { + if ($row['forum_type'] != FORUM_CAT) + { + $forum_ids_moderator[] = (int) $forum_id; + } + + // Direct child of current branch + $parent_id = $forum_id; + $forum_rows[$forum_id] = $row; + + if ($row['forum_type'] == FORUM_CAT && $row['parent_id'] == $root_data['forum_id']) + { + $branch_root_id = $forum_id; + } + $forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id']; + $forum_rows[$parent_id]['forum_password_last_post'] = $row['forum_password']; + $forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; + } + else if ($row['forum_type'] != FORUM_CAT) + { + $subforums[$parent_id][$forum_id]['display'] = ($row['display_on_index']) ? true : false; + $subforums[$parent_id][$forum_id]['name'] = $row['forum_name']; + $subforums[$parent_id][$forum_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; + $subforums[$parent_id][$forum_id]['children'] = array(); + $subforums[$parent_id][$forum_id]['type'] = $row['forum_type']; + + if (isset($subforums[$parent_id][$row['parent_id']]) && !$row['display_on_index']) + { + $subforums[$parent_id][$row['parent_id']]['children'][] = $forum_id; + } + + if (!$forum_rows[$parent_id]['forum_id_unapproved_topics'] && $row['forum_id_unapproved_topics']) + { + $forum_rows[$parent_id]['forum_id_unapproved_topics'] = $forum_id; + } + + if (!$forum_rows[$parent_id]['forum_id_unapproved_posts'] && $row['forum_id_unapproved_posts']) + { + $forum_rows[$parent_id]['forum_id_unapproved_posts'] = $forum_id; + } + + $forum_rows[$parent_id]['forum_topics'] += $row['forum_topics']; + + // Do not list redirects in LINK Forums as Posts. + if ($row['forum_type'] != FORUM_LINK) + { + $forum_rows[$parent_id]['forum_posts'] += $row['forum_posts']; + } + + if ($row['forum_last_post_time'] > $forum_rows[$parent_id]['forum_last_post_time']) + { + $forum_rows[$parent_id]['forum_last_post_id'] = $row['forum_last_post_id']; + $forum_rows[$parent_id]['forum_last_post_subject'] = $row['forum_last_post_subject']; + $forum_rows[$parent_id]['forum_last_post_time'] = $row['forum_last_post_time']; + $forum_rows[$parent_id]['forum_last_poster_id'] = $row['forum_last_poster_id']; + $forum_rows[$parent_id]['forum_last_poster_name'] = $row['forum_last_poster_name']; + $forum_rows[$parent_id]['forum_last_poster_colour'] = $row['forum_last_poster_colour']; + $forum_rows[$parent_id]['forum_id_last_post'] = $forum_id; + $forum_rows[$parent_id]['forum_password_last_post'] = $row['forum_password']; + } + } + + /** + * Event to modify the forum rows data set + * + * This event is triggered once per forum + * + * @event core.display_forums_modify_forum_rows + * @var array forum_rows Data array of all forums we display + * @var array subforums Data array of all subforums we display + * @var int branch_root_id Current top-level forum + * @var int parent_id Current parent forum + * @var array row The data of the forum + * @since 3.1.0-a1 + */ + $vars = array('forum_rows', 'subforums', 'branch_root_id', 'parent_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_forum_rows', compact($vars))); + } + $db->sql_freeresult($result); + + // Handle marking posts + if ($mark_read == 'forums') + { + $redirect = build_url(array('mark', 'hash', 'mark_time')); + $token = $request->variable('hash', ''); + if (check_link_hash($token, 'global')) + { + markread('topics', $forum_ids, false, $request->variable('mark_time', 0)); + $message = sprintf($user->lang['RETURN_FORUM'], '', ''); + meta_refresh(3, $redirect); + + if ($request->is_ajax()) + { + // Tell the ajax script what language vars and URL need to be replaced + $data = array( + 'NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'], + 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'], + 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . '&f=' . $root_data['forum_id'] . '&mark=forums&mark_time=' . time()) : '', + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['FORUMS_MARKED'] + ); + $json_response = new \phpbb\json_response(); + $json_response->send($data); + } + + trigger_error($user->lang['FORUMS_MARKED'] . '

' . $message); + } + else + { + $message = sprintf($user->lang['RETURN_PAGE'], '', ''); + meta_refresh(3, $redirect); + trigger_error($message); + } + + } + + // Grab moderators ... if necessary + if ($display_moderators) + { + if ($return_moderators) + { + $forum_ids_moderator[] = $root_data['forum_id']; + } + get_moderators($forum_moderators, $forum_ids_moderator); + } + + /** + * Event to perform additional actions before the forum list is being generated + * + * @event core.display_forums_before + * @var array active_forum_ary Array with forum data to display active topics + * @var bool display_moderators Flag indicating if we display forum moderators + * @var array forum_moderators Array with forum moderators list + * @var array forum_rows Data array of all forums we display + * @var bool return_moderators Flag indicating if moderators list should be returned + * @var array root_data Array with the root forum data + * @since 3.1.4-RC1 + */ + $vars = array( + 'active_forum_ary', + 'display_moderators', + 'forum_moderators', + 'forum_rows', + 'return_moderators', + 'root_data', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_before', compact($vars))); + + // Used to tell whatever we have to create a dummy category or not. + $last_catless = true; + foreach ($forum_rows as $row) + { + // Category + if ($row['parent_id'] == $root_data['forum_id'] && $row['forum_type'] == FORUM_CAT) + { + // Do not display categories without any forums to display + if (!isset($valid_categories[$row['forum_id']])) + { + continue; + } + + $cat_row = array( + 'S_IS_CAT' => true, + 'FORUM_ID' => $row['forum_id'], + 'FORUM_NAME' => $row['forum_name'], + 'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), + 'FORUM_FOLDER_IMG' => '', + 'FORUM_FOLDER_IMG_SRC' => '', + 'FORUM_IMAGE' => ($row['forum_image']) ? '' . $user->lang['FORUM_CAT'] . '' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', + 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']), + ); + + /** + * Modify the template data block of the 'category' + * + * This event is triggered once per 'category' + * + * @event core.display_forums_modify_category_template_vars + * @var array cat_row Template data of the 'category' + * @var bool last_catless The flag indicating whether the last forum had a parent category + * @var array root_data Array with the root forum data + * @var array row The data of the 'category' + * @since 3.1.0-RC4 + * @changed 3.1.7-RC1 Removed undefined catless variable + */ + $vars = array( + 'cat_row', + 'last_catless', + 'root_data', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_category_template_vars', compact($vars))); + + $template->assign_block_vars('forumrow', $cat_row); + + continue; + } + + $visible_forums++; + $forum_id = $row['forum_id']; + + $forum_unread = (isset($forum_tracking_info[$forum_id]) && $row['orig_forum_last_post_time'] > $forum_tracking_info[$forum_id]) ? true : false; + + $folder_image = $folder_alt = $l_subforums = ''; + $subforums_list = array(); + + // Generate list of subforums if we need to + if (isset($subforums[$forum_id])) + { + foreach ($subforums[$forum_id] as $subforum_id => $subforum_row) + { + $subforum_unread = (isset($forum_tracking_info[$subforum_id]) && $subforum_row['orig_forum_last_post_time'] > $forum_tracking_info[$subforum_id]) ? true : false; + + if (!$subforum_unread && !empty($subforum_row['children'])) + { + foreach ($subforum_row['children'] as $child_id) + { + if (isset($forum_tracking_info[$child_id]) && $subforums[$forum_id][$child_id]['orig_forum_last_post_time'] > $forum_tracking_info[$child_id]) + { + // Once we found an unread child forum, we can drop out of this loop + $subforum_unread = true; + break; + } + } + } + + if ($subforum_row['display'] && $subforum_row['name']) + { + $subforums_list[] = array( + 'link' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $subforum_id), + 'name' => $subforum_row['name'], + 'unread' => $subforum_unread, + 'type' => $subforum_row['type'], + ); + } + else + { + unset($subforums[$forum_id][$subforum_id]); + } + + // If one subforum is unread the forum gets unread too... + if ($subforum_unread) + { + $forum_unread = true; + } + } + + $l_subforums = (count($subforums[$forum_id]) == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS']; + $folder_image = ($forum_unread) ? 'forum_unread_subforum' : 'forum_read_subforum'; + } + else + { + switch ($row['forum_type']) + { + case FORUM_POST: + $folder_image = ($forum_unread) ? 'forum_unread' : 'forum_read'; + break; + + case FORUM_LINK: + $folder_image = 'forum_link'; + break; + } + } + + // Which folder should we display? + if ($row['forum_status'] == ITEM_LOCKED) + { + $folder_image = ($forum_unread) ? 'forum_unread_locked' : 'forum_read_locked'; + $folder_alt = 'FORUM_LOCKED'; + } + else + { + $folder_alt = ($forum_unread) ? 'UNREAD_POSTS' : 'NO_UNREAD_POSTS'; + } + + // Create last post link information, if appropriate + if ($row['forum_last_post_id']) + { + if ($row['forum_password_last_post'] === '' && $auth->acl_gets('f_read', 'f_list_topics', $row['forum_id_last_post'])) + { + $last_post_subject = censor_text($row['forum_last_post_subject']); + $last_post_subject_truncated = truncate_string($last_post_subject, 30, 255, false, $user->lang['ELLIPSIS']); + } + else + { + $last_post_subject = $last_post_subject_truncated = ''; + } + $last_post_time = $user->format_date($row['forum_last_post_time']); + $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; + } + else + { + $last_post_subject = $last_post_time = $last_post_url = $last_post_subject_truncated = ''; + } + + // Output moderator listing ... if applicable + $l_moderator = $moderators_list = ''; + if ($display_moderators && !empty($forum_moderators[$forum_id])) + { + $l_moderator = (count($forum_moderators[$forum_id]) == 1) ? $user->lang['MODERATOR'] : $user->lang['MODERATORS']; + $moderators_list = implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]); + } + + $l_post_click_count = ($row['forum_type'] == FORUM_LINK) ? 'CLICKS' : 'POSTS'; + $post_click_count = ($row['forum_type'] != FORUM_LINK || $row['forum_flags'] & FORUM_FLAG_LINK_TRACK) ? $row['forum_posts'] : ''; + + $s_subforums_list = $subforums_row = array(); + foreach ($subforums_list as $subforum) + { + $s_subforums_list[] = '' . $subforum['name'] . ''; + $subforums_row[] = array( + 'U_SUBFORUM' => $subforum['link'], + 'SUBFORUM_NAME' => $subforum['name'], + 'S_UNREAD' => $subforum['unread'], + 'IS_LINK' => $subforum['type'] == FORUM_LINK, + ); + } + $s_subforums_list = (string) implode($user->lang['COMMA_SEPARATOR'], $s_subforums_list); + $catless = ($row['parent_id'] == $root_data['forum_id']) ? true : false; + + if ($row['forum_type'] != FORUM_LINK) + { + $u_viewforum = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']); + } + else + { + // If the forum is a link and we count redirects we need to visit it + // If the forum is having a password or no read access we do not expose the link, but instead handle it in viewforum + if (($row['forum_flags'] & FORUM_FLAG_LINK_TRACK) || $row['forum_password'] || !$auth->acl_get('f_read', $forum_id)) + { + $u_viewforum = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']); + } + else + { + $u_viewforum = $row['forum_link']; + } + } + + $forum_row = array( + 'S_IS_CAT' => false, + 'S_NO_CAT' => $catless && !$last_catless, + 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false, + 'S_UNREAD_FORUM' => $forum_unread, + 'S_AUTH_READ' => $auth->acl_get('f_read', $row['forum_id']), + 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, + 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, + 'S_SUBFORUMS' => (count($subforums_list)) ? true : false, + 'S_DISPLAY_SUBJECT' => ($last_post_subject !== '' && $config['display_last_subject']) ? true : false, + 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, + + 'FORUM_ID' => $row['forum_id'], + 'FORUM_NAME' => $row['forum_name'], + 'FORUM_DESC' => generate_text_for_display($row['forum_desc'], $row['forum_desc_uid'], $row['forum_desc_bitfield'], $row['forum_desc_options']), + 'TOPICS' => $row['forum_topics'], + $l_post_click_count => $post_click_count, + 'FORUM_IMG_STYLE' => $folder_image, + 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), + 'FORUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '', + 'FORUM_IMAGE' => ($row['forum_image']) ? '' . $user->lang[$folder_alt] . '' : '', + 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', + 'LAST_POST_SUBJECT' => $last_post_subject, + 'LAST_POST_SUBJECT_TRUNCATED' => $last_post_subject_truncated, + 'LAST_POST_TIME' => $last_post_time, + 'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'LAST_POSTER_FULL' => get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'MODERATORS' => $moderators_list, + 'SUBFORUMS' => $s_subforums_list, + + 'L_SUBFORUM_STR' => $l_subforums, + 'L_MODERATOR_STR' => $l_moderator, + + 'U_UNAPPROVED_TOPICS' => ($row['forum_id_unapproved_topics']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_topics&f=' . $row['forum_id_unapproved_topics']) : '', + 'U_UNAPPROVED_POSTS' => ($row['forum_id_unapproved_posts']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_posts&f=' . $row['forum_id_unapproved_posts']) : '', + 'U_VIEWFORUM' => $u_viewforum, + 'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'U_LAST_POST' => $last_post_url, + ); + + /** + * Modify the template data block of the forum + * + * This event is triggered once per forum + * + * @event core.display_forums_modify_template_vars + * @var array forum_row Template data of the forum + * @var array row The data of the forum + * @var array subforums_row Template data of subforums + * @since 3.1.0-a1 + * @changed 3.1.0-b5 Added var subforums_row + */ + $vars = array('forum_row', 'row', 'subforums_row'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars))); + + $template->assign_block_vars('forumrow', $forum_row); + + // Assign subforums loop for style authors + $template->assign_block_vars_array('forumrow.subforum', $subforums_row); + + /** + * Modify and/or assign additional template data for the forum + * after forumrow loop has been assigned. This can be used + * to create additional forumrow subloops in extensions. + * + * This event is triggered once per forum + * + * @event core.display_forums_add_template_data + * @var array forum_row Template data of the forum + * @var array row The data of the forum + * @var array subforums_list The data of subforums + * @var array subforums_row Template data of subforums + * @var bool catless The flag indicating whether a forum has a parent category + * @since 3.1.0-b5 + */ + $vars = array( + 'forum_row', + 'row', + 'subforums_list', + 'subforums_row', + 'catless', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_add_template_data', compact($vars))); + + $last_catless = $catless; + } + + $template->assign_vars(array( + 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . '&f=' . $root_data['forum_id'] . '&mark=forums&mark_time=' . time()) : '', + 'S_HAS_SUBFORUM' => ($visible_forums) ? true : false, + 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'], + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPICS_UNAPPROVED'), + 'UNAPPROVED_POST_IMG' => $user->img('icon_topic_unapproved', 'POSTS_UNAPPROVED_FORUM'), + )); + + /** + * Event to perform additional actions after the forum list has been generated + * + * @event core.display_forums_after + * @var array active_forum_ary Array with forum data to display active topics + * @var bool display_moderators Flag indicating if we display forum moderators + * @var array forum_moderators Array with forum moderators list + * @var array forum_rows Data array of all forums we display + * @var bool return_moderators Flag indicating if moderators list should be returned + * @var array root_data Array with the root forum data + * @since 3.1.0-RC5 + */ + $vars = array( + 'active_forum_ary', + 'display_moderators', + 'forum_moderators', + 'forum_rows', + 'return_moderators', + 'root_data', + ); + extract($phpbb_dispatcher->trigger_event('core.display_forums_after', compact($vars))); + + if ($return_moderators) + { + return array($active_forum_ary, $forum_moderators); + } + + return array($active_forum_ary, array()); +} + +/** +* Create forum rules for given forum +*/ +function generate_forum_rules(&$forum_data) +{ + if ($forum_data['forum_rules']) + { + $forum_data['forum_rules'] = generate_text_for_display($forum_data['forum_rules'], $forum_data['forum_rules_uid'], $forum_data['forum_rules_bitfield'], $forum_data['forum_rules_options']); + } + + if (!$forum_data['forum_rules'] && !$forum_data['forum_rules_link']) + { + return; + } + + global $template; + + $template->assign_vars(array( + 'S_FORUM_RULES' => true, + 'U_FORUM_RULES' => $forum_data['forum_rules_link'], + 'FORUM_RULES' => $forum_data['forum_rules']) + ); +} + +/** +* Create forum navigation links for given forum, create parent +* list if currently null, assign basic forum info to template +*/ +function generate_forum_nav(&$forum_data_ary) +{ + global $template, $auth, $config; + global $phpEx, $phpbb_root_path, $phpbb_dispatcher; + + if (!$auth->acl_get('f_list', $forum_data_ary['forum_id'])) + { + return; + } + + $navlinks_parents = $forum_template_data = array(); + + // Get forum parents + $forum_parents = get_forum_parents($forum_data_ary); + + $microdata_attr = 'data-forum-id'; + + // Build navigation links + if (!empty($forum_parents)) + { + foreach ($forum_parents as $parent_forum_id => $parent_data) + { + list($parent_name, $parent_type) = array_values($parent_data); + + // Skip this parent if the user does not have the permission to view it + if (!$auth->acl_get('f_list', $parent_forum_id)) + { + continue; + } + + $navlinks_parents[] = array( + 'S_IS_CAT' => ($parent_type == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($parent_type == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($parent_type == FORUM_POST) ? true : false, + 'FORUM_NAME' => $parent_name, + 'FORUM_ID' => $parent_forum_id, + 'MICRODATA' => $microdata_attr . '="' . $parent_forum_id . '"', + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $parent_forum_id), + ); + } + } + + $navlinks = array( + 'S_IS_CAT' => ($forum_data_ary['forum_type'] == FORUM_CAT) ? true : false, + 'S_IS_LINK' => ($forum_data_ary['forum_type'] == FORUM_LINK) ? true : false, + 'S_IS_POST' => ($forum_data_ary['forum_type'] == FORUM_POST) ? true : false, + 'FORUM_NAME' => $forum_data_ary['forum_name'], + 'FORUM_ID' => $forum_data_ary['forum_id'], + 'MICRODATA' => $microdata_attr . '="' . $forum_data_ary['forum_id'] . '"', + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_data_ary['forum_id']), + ); + + $forum_template_data = array( + 'FORUM_ID' => $forum_data_ary['forum_id'], + 'FORUM_NAME' => $forum_data_ary['forum_name'], + 'FORUM_DESC' => generate_text_for_display($forum_data_ary['forum_desc'], $forum_data_ary['forum_desc_uid'], $forum_data_ary['forum_desc_bitfield'], $forum_data_ary['forum_desc_options']), + + 'S_ENABLE_FEEDS_FORUM' => ($config['feed_forum'] && $forum_data_ary['forum_type'] == FORUM_POST && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $forum_data_ary['forum_options'])) ? true : false, + ); + + $forum_data = $forum_data_ary; + /** + * Event to modify the navlinks text + * + * @event core.generate_forum_nav + * @var array forum_data Array with the forum data + * @var array forum_template_data Array with generic forum template data + * @var string microdata_attr The microdata attribute + * @var array navlinks_parents Array with the forum parents navlinks data + * @var array navlinks Array with the forum navlinks data + * @since 3.1.5-RC1 + */ + $vars = array( + 'forum_data', + 'forum_template_data', + 'microdata_attr', + 'navlinks_parents', + 'navlinks', + ); + extract($phpbb_dispatcher->trigger_event('core.generate_forum_nav', compact($vars))); + $forum_data_ary = $forum_data; + unset($forum_data); + + $template->assign_block_vars_array('navlinks', $navlinks_parents); + $template->assign_block_vars('navlinks', $navlinks); + $template->assign_vars($forum_template_data); + + return; +} + +/** +* Returns forum parents as an array. Get them from forum_data if available, or update the database otherwise +*/ +function get_forum_parents(&$forum_data) +{ + global $db; + + $forum_parents = array(); + + if ($forum_data['parent_id'] > 0) + { + if ($forum_data['forum_parents'] == '') + { + $sql = 'SELECT forum_id, forum_name, forum_type + FROM ' . FORUMS_TABLE . ' + WHERE left_id < ' . $forum_data['left_id'] . ' + AND right_id > ' . $forum_data['right_id'] . ' + ORDER BY left_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_parents[$row['forum_id']] = array($row['forum_name'], (int) $row['forum_type']); + } + $db->sql_freeresult($result); + + $forum_data['forum_parents'] = serialize($forum_parents); + + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET forum_parents = '" . $db->sql_escape($forum_data['forum_parents']) . "' + WHERE parent_id = " . $forum_data['parent_id']; + $db->sql_query($sql); + } + else + { + $forum_parents = unserialize($forum_data['forum_parents']); + } + } + + return $forum_parents; +} + +/** +* Obtain list of moderators of each forum +*/ +function get_moderators(&$forum_moderators, $forum_id = false) +{ + global $db, $phpbb_root_path, $phpEx, $user, $auth; + global $phpbb_container; + + $forum_id_ary = array(); + + if ($forum_id !== false) + { + if (!is_array($forum_id)) + { + $forum_id = array($forum_id); + } + + // Exchange key/value pair to be able to faster check for the forum id existence + $forum_id_ary = array_flip($forum_id); + } + + $sql_array = array( + 'SELECT' => 'm.*, u.user_colour, g.group_colour, g.group_type', + + 'FROM' => array( + MODERATOR_CACHE_TABLE => 'm', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(USERS_TABLE => 'u'), + 'ON' => 'm.user_id = u.user_id', + ), + array( + 'FROM' => array(GROUPS_TABLE => 'g'), + 'ON' => 'm.group_id = g.group_id', + ), + ), + + 'WHERE' => 'm.display_on_index = 1', + ); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + // We query every forum here because for caching we should not have any parameter. + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql, 3600); + + while ($row = $db->sql_fetchrow($result)) + { + $f_id = (int) $row['forum_id']; + + if (!isset($forum_id_ary[$f_id])) + { + continue; + } + + if (!empty($row['user_id'])) + { + $forum_moderators[$f_id][] = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); + } + else + { + $group_name = $group_helper->get_name($row['group_name']); + + if ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile')) + { + $forum_moderators[$f_id][] = '' . $group_name . ''; + } + else + { + $forum_moderators[$f_id][] = '' . $group_name . ''; + } + } + } + $db->sql_freeresult($result); + + return; +} + +/** +* User authorisation levels output +* +* @param string $mode Can be forum or topic. Not in use at the moment. +* @param int $forum_id The current forum the user is in. +* @param int $forum_status The forums status bit. +*/ +function gen_forum_auth_level($mode, $forum_id, $forum_status) +{ + global $template, $auth, $user, $config; + + $locked = ($forum_status == ITEM_LOCKED && !$auth->acl_get('m_edit', $forum_id)) ? true : false; + + $rules = array( + ($auth->acl_get('f_post', $forum_id) && !$locked) ? $user->lang['RULES_POST_CAN'] : $user->lang['RULES_POST_CANNOT'], + ($auth->acl_get('f_reply', $forum_id) && !$locked) ? $user->lang['RULES_REPLY_CAN'] : $user->lang['RULES_REPLY_CANNOT'], + ($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $forum_id) && !$locked) ? $user->lang['RULES_EDIT_CAN'] : $user->lang['RULES_EDIT_CANNOT'], + ($user->data['is_registered'] && ($auth->acl_gets('f_delete', 'm_delete', $forum_id) || $auth->acl_gets('f_softdelete', 'm_softdelete', $forum_id)) && !$locked) ? $user->lang['RULES_DELETE_CAN'] : $user->lang['RULES_DELETE_CANNOT'], + ); + + if ($config['allow_attachments']) + { + $rules[] = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && !$locked) ? $user->lang['RULES_ATTACH_CAN'] : $user->lang['RULES_ATTACH_CANNOT']; + } + + foreach ($rules as $rule) + { + $template->assign_block_vars('rules', array('RULE' => $rule)); + } + + return; +} + +/** +* Generate topic status +*/ +function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$folder_alt, &$topic_type) +{ + global $user, $config; + + if ($topic_row['topic_status'] == ITEM_MOVED) + { + $topic_type = $user->lang['VIEW_TOPIC_MOVED']; + $folder_img = 'topic_moved'; + $folder_alt = 'TOPIC_MOVED'; + } + else + { + switch ($topic_row['topic_type']) + { + case POST_GLOBAL: + $topic_type = $user->lang['VIEW_TOPIC_GLOBAL']; + $folder = 'global_read'; + $folder_new = 'global_unread'; + break; + + case POST_ANNOUNCE: + $topic_type = $user->lang['VIEW_TOPIC_ANNOUNCEMENT']; + $folder = 'announce_read'; + $folder_new = 'announce_unread'; + break; + + case POST_STICKY: + $topic_type = $user->lang['VIEW_TOPIC_STICKY']; + $folder = 'sticky_read'; + $folder_new = 'sticky_unread'; + break; + + default: + $topic_type = ''; + $folder = 'topic_read'; + $folder_new = 'topic_unread'; + + // Hot topic threshold is for posts in a topic, which is replies + the first post. ;) + if ($config['hot_threshold'] && ($replies + 1) >= $config['hot_threshold'] && $topic_row['topic_status'] != ITEM_LOCKED) + { + $folder .= '_hot'; + $folder_new .= '_hot'; + } + break; + } + + if ($topic_row['topic_status'] == ITEM_LOCKED) + { + $topic_type = $user->lang['VIEW_TOPIC_LOCKED']; + $folder .= '_locked'; + $folder_new .= '_locked'; + } + + $folder_img = ($unread_topic) ? $folder_new : $folder; + $folder_alt = ($unread_topic) ? 'UNREAD_POSTS' : (($topic_row['topic_status'] == ITEM_LOCKED) ? 'TOPIC_LOCKED' : 'NO_UNREAD_POSTS'); + + // Posted image? + if (!empty($topic_row['topic_posted']) && $topic_row['topic_posted']) + { + $folder_img .= '_mine'; + } + } + + if ($topic_row['poll_start'] && $topic_row['topic_status'] != ITEM_MOVED) + { + $topic_type = $user->lang['VIEW_TOPIC_POLL']; + } +} + +/** +* Assign/Build custom bbcodes for display in screens supporting using of bbcodes +* The custom bbcodes buttons will be placed within the template block 'custom_tags' +*/ +function display_custom_bbcodes() +{ + global $db, $template, $user, $phpbb_dispatcher; + + // Start counting from 22 for the bbcode ids (every bbcode takes two ids - opening/closing) + $num_predefined_bbcodes = NUM_PREDEFINED_BBCODES; + + $sql_ary = array( + 'SELECT' => 'b.bbcode_id, b.bbcode_tag, b.bbcode_helpline', + 'FROM' => array(BBCODES_TABLE => 'b'), + 'WHERE' => 'b.display_on_posting = 1', + 'ORDER_BY' => 'b.bbcode_tag', + ); + + /** + * Event to modify the SQL query before custom bbcode data is queried + * + * @event core.display_custom_bbcodes_modify_sql + * @var array sql_ary The SQL array to get the bbcode data + * @var int num_predefined_bbcodes The number of predefined core bbcodes + * (multiplied by factor of 2) + * @since 3.1.0-a3 + */ + $vars = array('sql_ary', 'num_predefined_bbcodes'); + extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + $i = 0; + while ($row = $db->sql_fetchrow($result)) + { + // If the helpline is defined within the language file, we will use the localised version, else just use the database entry... + if (isset($user->lang[strtoupper($row['bbcode_helpline'])])) + { + $row['bbcode_helpline'] = $user->lang[strtoupper($row['bbcode_helpline'])]; + } + + $custom_tags = array( + 'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", + 'BBCODE_ID' => $num_predefined_bbcodes + ($i * 2), + 'BBCODE_TAG' => $row['bbcode_tag'], + 'BBCODE_TAG_CLEAN' => str_replace('=', '-', $row['bbcode_tag']), + 'BBCODE_HELPLINE' => $row['bbcode_helpline'], + 'A_BBCODE_HELPLINE' => str_replace(array('&', '"', "'", '<', '>'), array('&', '"', "\'", '<', '>'), $row['bbcode_helpline']), + ); + + /** + * Event to modify the template data block of a custom bbcode + * + * This event is triggered once per bbcode + * + * @event core.display_custom_bbcodes_modify_row + * @var array custom_tags Template data of the bbcode + * @var array row The data of the bbcode + * @since 3.1.0-a1 + */ + $vars = array('custom_tags', 'row'); + extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_row', compact($vars))); + + $template->assign_block_vars('custom_tags', $custom_tags); + + $i++; + } + $db->sql_freeresult($result); + + /** + * Display custom bbcodes + * + * @event core.display_custom_bbcodes + * @since 3.1.0-a1 + */ + $phpbb_dispatcher->dispatch('core.display_custom_bbcodes'); +} + +/** +* Display reasons +* +* @deprecated 3.2.0-dev +*/ +function display_reasons($reason_id = 0) +{ + global $phpbb_container; + + $phpbb_container->get('phpbb.report.report_reason_list_provider')->display_reasons($reason_id); +} + +/** +* Display user activity (action forum/topic) +*/ +function display_user_activity(&$userdata_ary) +{ + global $auth, $template, $db, $user, $config; + global $phpbb_root_path, $phpEx; + global $phpbb_container, $phpbb_dispatcher; + + // Do not display user activity for users having too many posts... + $limit = $config['load_user_activity_limit']; + if ($userdata_ary['user_posts'] > $limit && $limit != 0) + { + return; + } + + $forum_ary = array(); + + $forum_read_ary = $auth->acl_getf('f_read'); + foreach ($forum_read_ary as $forum_id => $allowed) + { + if ($allowed['f_read']) + { + $forum_ary[] = (int) $forum_id; + } + } + + $forum_ary = array_diff($forum_ary, $user->get_passworded_forums()); + + $active_f_row = $active_t_row = array(); + if (!empty($forum_ary)) + { + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + // Obtain active forum + $sql = 'SELECT forum_id, COUNT(post_id) AS num_posts + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . $userdata_ary['user_id'] . ' + AND post_postcount = 1 + AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . ' + GROUP BY forum_id + ORDER BY num_posts DESC'; + $result = $db->sql_query_limit($sql, 1); + $active_f_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!empty($active_f_row)) + { + $sql = 'SELECT forum_name + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $active_f_row['forum_id']; + $result = $db->sql_query($sql, 3600); + $active_f_row['forum_name'] = (string) $db->sql_fetchfield('forum_name'); + $db->sql_freeresult($result); + } + + // Obtain active topic + $sql = 'SELECT topic_id, COUNT(post_id) AS num_posts + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . $userdata_ary['user_id'] . ' + AND post_postcount = 1 + AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . ' + GROUP BY topic_id + ORDER BY num_posts DESC'; + $result = $db->sql_query_limit($sql, 1); + $active_t_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!empty($active_t_row)) + { + $sql = 'SELECT topic_title + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $active_t_row['topic_id']; + $result = $db->sql_query($sql); + $active_t_row['topic_title'] = (string) $db->sql_fetchfield('topic_title'); + $db->sql_freeresult($result); + } + } + + $userdata = $userdata_ary; + $show_user_activity = true; + /** + * Alter list of forums and topics to display as active + * + * @event core.display_user_activity_modify_actives + * @var array userdata User's data + * @var array active_f_row List of active forums + * @var array active_t_row List of active posts + * @var bool show_user_activity Show user forum and topic activity + * @since 3.1.0-RC3 + * @changed 3.2.5-RC1 Added show_user_activity into event + */ + $vars = array('userdata', 'active_f_row', 'active_t_row', 'show_user_activity'); + extract($phpbb_dispatcher->trigger_event('core.display_user_activity_modify_actives', compact($vars))); + $userdata_ary = $userdata; + unset($userdata); + + $userdata_ary['active_t_row'] = $active_t_row; + $userdata_ary['active_f_row'] = $active_f_row; + + $active_f_name = $active_f_id = $active_f_count = $active_f_pct = ''; + if (!empty($active_f_row['num_posts'])) + { + $active_f_name = $active_f_row['forum_name']; + $active_f_id = $active_f_row['forum_id']; + $active_f_count = $active_f_row['num_posts']; + $active_f_pct = ($userdata_ary['user_posts']) ? ($active_f_count / $userdata_ary['user_posts']) * 100 : 0; + } + + $active_t_name = $active_t_id = $active_t_count = $active_t_pct = ''; + if (!empty($active_t_row['num_posts'])) + { + $active_t_name = $active_t_row['topic_title']; + $active_t_id = $active_t_row['topic_id']; + $active_t_count = $active_t_row['num_posts']; + $active_t_pct = ($userdata_ary['user_posts']) ? ($active_t_count / $userdata_ary['user_posts']) * 100 : 0; + } + + $l_active_pct = ($userdata_ary['user_id'] != ANONYMOUS && $userdata_ary['user_id'] == $user->data['user_id']) ? $user->lang['POST_PCT_ACTIVE_OWN'] : $user->lang['POST_PCT_ACTIVE']; + + $template->assign_vars(array( + 'ACTIVE_FORUM' => $active_f_name, + 'ACTIVE_FORUM_POSTS' => $user->lang('USER_POSTS', (int) $active_f_count), + 'ACTIVE_FORUM_PCT' => sprintf($l_active_pct, $active_f_pct), + 'ACTIVE_TOPIC' => censor_text($active_t_name), + 'ACTIVE_TOPIC_POSTS' => $user->lang('USER_POSTS', (int) $active_t_count), + 'ACTIVE_TOPIC_PCT' => sprintf($l_active_pct, $active_t_pct), + 'U_ACTIVE_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $active_f_id), + 'U_ACTIVE_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $active_t_id), + 'S_SHOW_ACTIVITY' => $show_user_activity) + ); +} + +/** +* Topic and forum watching common code +*/ +function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0, $item_title = '') +{ + global $db, $user, $phpEx, $start, $phpbb_root_path; + global $request; + + $table_sql = ($mode == 'forum') ? FORUMS_WATCH_TABLE : TOPICS_WATCH_TABLE; + $where_sql = ($mode == 'forum') ? 'forum_id' : 'topic_id'; + $match_id = ($mode == 'forum') ? $forum_id : $topic_id; + $u_url = "uid={$user->data['user_id']}"; + $u_url .= ($mode == 'forum') ? '&f' : '&f=' . $forum_id . '&t'; + $is_watching = 0; + + // Is user watching this topic? + if ($user_id != ANONYMOUS) + { + $can_watch = true; + + if ($notify_status == 'unset') + { + $sql = "SELECT notify_status + FROM $table_sql + WHERE $where_sql = $match_id + AND user_id = $user_id"; + $result = $db->sql_query($sql); + + $notify_status = ($row = $db->sql_fetchrow($result)) ? $row['notify_status'] : NULL; + $db->sql_freeresult($result); + } + + if (!is_null($notify_status) && $notify_status !== '') + { + if (isset($_GET['unwatch'])) + { + $uid = $request->variable('uid', 0); + $token = $request->variable('hash', ''); + + if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) + { + if ($uid != $user_id || $request->variable('unwatch', '', false, \phpbb\request\request_interface::GET) != $mode) + { + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['ERR_UNWATCHING']; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); + } + trigger_error($message); + } + + $sql = 'DELETE FROM ' . $table_sql . " + WHERE $where_sql = $match_id + AND user_id = $user_id"; + $db->sql_query($sql); + + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)]; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); + } + meta_refresh(3, $redirect_url); + trigger_error($message); + } + else + { + $s_hidden_fields = array( + 'uid' => $user->data['user_id'], + 'unwatch' => $mode, + 'start' => $start, + 'f' => $forum_id, + ); + if ($mode != 'forum') + { + $s_hidden_fields['t'] = $topic_id; + } + + if ($item_title == '') + { + $confirm_box_message = 'UNWATCH_' . strtoupper($mode); + } + else + { + $confirm_box_message = $user->lang('UNWATCH_' . strtoupper($mode) . '_DETAILED', $item_title); + } + confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields)); + } + } + else + { + $is_watching = true; + + if ($notify_status != NOTIFY_YES) + { + $sql = 'UPDATE ' . $table_sql . " + SET notify_status = " . NOTIFY_YES . " + WHERE $where_sql = $match_id + AND user_id = $user_id"; + $db->sql_query($sql); + } + } + } + else + { + if (isset($_GET['watch'])) + { + $uid = $request->variable('uid', 0); + $token = $request->variable('hash', ''); + + if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) + { + if ($uid != $user_id || $request->variable('watch', '', false, \phpbb\request\request_interface::GET) != $mode) + { + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['ERR_WATCHING']; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); + } + trigger_error($message); + } + + $is_watching = true; + + $sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status) + VALUES ($user_id, $match_id, " . NOTIFY_YES . ')'; + $db->sql_query($sql); + + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)]; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_' . strtoupper($mode), '', ''); + } + meta_refresh(3, $redirect_url); + trigger_error($message); + } + else + { + $s_hidden_fields = array( + 'uid' => $user->data['user_id'], + 'watch' => $mode, + 'start' => $start, + 'f' => $forum_id, + ); + if ($mode != 'forum') + { + $s_hidden_fields['t'] = $topic_id; + } + + $confirm_box_message = (($item_title == '') ? 'WATCH_' . strtoupper($mode) : $user->lang('WATCH_' . strtoupper($mode) . '_DETAILED', $item_title)); + confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields)); + } + } + else + { + $is_watching = 0; + } + } + } + else + { + if ((isset($_GET['unwatch']) && $request->variable('unwatch', '', false, \phpbb\request\request_interface::GET) == $mode) || + (isset($_GET['watch']) && $request->variable('watch', '', false, \phpbb\request\request_interface::GET) == $mode)) + { + login_box(); + } + else + { + $can_watch = 0; + $is_watching = 0; + } + } + + if ($can_watch) + { + $s_watching['link'] = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&" . (($is_watching) ? 'unwatch' : 'watch') . "=$mode&start=$start&hash=" . generate_link_hash("{$mode}_$match_id")); + $s_watching['link_toggle'] = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&" . ((!$is_watching) ? 'unwatch' : 'watch') . "=$mode&start=$start&hash=" . generate_link_hash("{$mode}_$match_id")); + $s_watching['title'] = $user->lang[(($is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; + $s_watching['title_toggle'] = $user->lang[((!$is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; + $s_watching['is_watching'] = $is_watching; + } + + return; +} + +/** +* Get user rank title and image +* +* @param array $user_data the current stored users data +* @param int $user_posts the users number of posts +* +* @return array An associative array containing the rank title (title), the rank image as full img tag (img) and the rank image source (img_src) +* +* Note: since we do not want to break backwards-compatibility, this function will only properly assign ranks to guests if you call it for them with user_posts == false +*/ +function phpbb_get_user_rank($user_data, $user_posts) +{ + global $ranks, $config, $phpbb_root_path, $phpbb_path_helper, $phpbb_dispatcher; + + $user_rank_data = array( + 'title' => null, + 'img' => null, + 'img_src' => null, + ); + + /** + * Preparing a user's rank before displaying + * + * @event core.modify_user_rank + * @var array user_data Array with user's data + * @var int user_posts User_posts to change + * @since 3.1.0-RC4 + */ + + $vars = array('user_data', 'user_posts'); + extract($phpbb_dispatcher->trigger_event('core.modify_user_rank', compact($vars))); + + if (empty($ranks)) + { + global $cache; + $ranks = $cache->obtain_ranks(); + } + + if (!empty($user_data['user_rank'])) + { + + $user_rank_data['title'] = (isset($ranks['special'][$user_data['user_rank']]['rank_title'])) ? $ranks['special'][$user_data['user_rank']]['rank_title'] : ''; + + $user_rank_data['img_src'] = (!empty($ranks['special'][$user_data['user_rank']]['rank_image'])) ? $phpbb_path_helper->update_web_root_path($phpbb_root_path . $config['ranks_path'] . '/' . $ranks['special'][$user_data['user_rank']]['rank_image']) : ''; + + $user_rank_data['img'] = (!empty($ranks['special'][$user_data['user_rank']]['rank_image'])) ? '' . $ranks['special'][$user_data['user_rank']]['rank_title'] . '' : ''; + } + else if ($user_posts !== false) + { + if (!empty($ranks['normal'])) + { + foreach ($ranks['normal'] as $rank) + { + if ($user_posts >= $rank['rank_min']) + { + $user_rank_data['title'] = $rank['rank_title']; + $user_rank_data['img_src'] = (!empty($rank['rank_image'])) ? $phpbb_path_helper->update_web_root_path($phpbb_root_path . $config['ranks_path'] . '/' . $rank['rank_image']) : ''; + $user_rank_data['img'] = (!empty($rank['rank_image'])) ? '' . $rank['rank_title'] . '' : ''; + break; + } + } + } + } + + /** + * Modify a user's rank before displaying + * + * @event core.get_user_rank_after + * @var array user_data Array with user's data + * @var int user_posts User_posts to change + * @var array user_rank_data User rank data + * @since 3.1.11-RC1 + */ + + $vars = array( + 'user_data', + 'user_posts', + 'user_rank_data', + ); + extract($phpbb_dispatcher->trigger_event('core.get_user_rank_after', compact($vars))); + + return $user_rank_data; +} + +/** +* Prepare profile data +*/ +function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabled = false, $check_can_receive_pm = true) +{ + global $config, $auth, $user, $phpEx, $phpbb_root_path, $phpbb_dispatcher; + + $username = $data['username']; + $user_id = $data['user_id']; + + $user_rank_data = phpbb_get_user_rank($data, (($user_id == ANONYMOUS) ? false : $data['user_posts'])); + + if ((!empty($data['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_user')) + { + $email = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=email&u=' . $user_id) : (($config['board_hide_emails'] && !$auth->acl_get('a_user')) ? '' : 'mailto:' . $data['user_email']); + } + else + { + $email = ''; + } + + if ($config['load_onlinetrack']) + { + $update_time = $config['load_online_time'] * 60; + $online = (time() - $update_time < $data['session_time'] && ((isset($data['session_viewonline']) && $data['session_viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; + } + else + { + $online = false; + } + + if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) + { + $last_active = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_lastvisit']; + } + else + { + $last_active = ''; + } + + $age = ''; + + if ($config['allow_birthdays'] && $data['user_birthday']) + { + list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $data['user_birthday'])); + + if ($bday_year) + { + $now = $user->create_datetime(); + $now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset()); + + $diff = $now['mon'] - $bday_month; + if ($diff == 0) + { + $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; + } + else + { + $diff = ($diff < 0) ? 1 : 0; + } + + $age = max(0, (int) ($now['year'] - $bday_year - $diff)); + } + } + + if (!function_exists('phpbb_get_banned_user_ids')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + // Can this user receive a Private Message? + $can_receive_pm = $check_can_receive_pm && ( + // They must be a "normal" user + $data['user_type'] != USER_IGNORE && + + // They must not be deactivated by the administrator + ($data['user_type'] != USER_INACTIVE || $data['user_inactive_reason'] != INACTIVE_MANUAL) && + + // They must be able to read PMs + count($auth->acl_get_list($user_id, 'u_readpm')) && + + // They must not be permanently banned + !count(phpbb_get_banned_user_ids($user_id, false)) && + + // They must allow users to contact via PM + (($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || $data['user_allow_pm']) + ); + + // Dump it out to the template + $template_data = array( + 'AGE' => $age, + 'RANK_TITLE' => $user_rank_data['title'], + 'JOINED' => $user->format_date($data['user_regdate']), + 'LAST_ACTIVE' => (empty($last_active)) ? ' - ' : $user->format_date($last_active), + 'POSTS' => ($data['user_posts']) ? $data['user_posts'] : 0, + 'WARNINGS' => isset($data['user_warnings']) ? $data['user_warnings'] : 0, + + 'USERNAME_FULL' => get_username_string('full', $user_id, $username, $data['user_colour']), + 'USERNAME' => get_username_string('username', $user_id, $username, $data['user_colour']), + 'USER_COLOR' => get_username_string('colour', $user_id, $username, $data['user_colour']), + 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $username, $data['user_colour']), + + 'A_USERNAME' => addslashes(get_username_string('username', $user_id, $username, $data['user_colour'])), + + 'AVATAR_IMG' => phpbb_get_user_avatar($data), + 'ONLINE_IMG' => (!$config['load_onlinetrack']) ? '' : (($online) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), + 'S_ONLINE' => ($config['load_onlinetrack'] && $online) ? true : false, + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], + 'S_JABBER_ENABLED' => ($config['jab_enable']) ? true : false, + + 'S_WARNINGS' => ($auth->acl_getf_global('m_') || $auth->acl_get('m_warn')) ? true : false, + + 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '', + 'U_NOTES' => ($user_notes_enabled && $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', + 'U_WARN' => ($warn_user_enabled && $auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', + 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && $can_receive_pm) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $user_id) : '', + 'U_EMAIL' => $email, + 'U_JABBER' => ($data['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contact&action=jabber&u=' . $user_id) : '', + + 'USER_JABBER' => ($config['jab_enable']) ? $data['user_jabber'] : '', + 'USER_JABBER_IMG' => ($config['jab_enable'] && $data['user_jabber']) ? $user->img('icon_contact_jabber', $data['user_jabber']) : '', + + 'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $username), + 'L_CONTACT_USER' => $user->lang('CONTACT_USER', $username), + 'L_VIEWING_PROFILE' => $user->lang('VIEWING_PROFILE', $username), + ); + + /** + * Preparing a user's data before displaying it in profile and memberlist + * + * @event core.memberlist_prepare_profile_data + * @var array data Array with user's data + * @var array template_data Template array with user's data + * @since 3.1.0-a1 + */ + $vars = array('data', 'template_data'); + extract($phpbb_dispatcher->trigger_event('core.memberlist_prepare_profile_data', compact($vars))); + + return $template_data; +} + +function phpbb_sort_last_active($first, $second) +{ + global $id_cache, $sort_dir; + + $lesser_than = ($sort_dir === 'd') ? -1 : 1; + + if (isset($id_cache[$first]['group_leader']) && $id_cache[$first]['group_leader'] && (!isset($id_cache[$second]['group_leader']) || !$id_cache[$second]['group_leader'])) + { + return -1; + } + else if (isset($id_cache[$second]['group_leader']) && (!isset($id_cache[$first]['group_leader']) || !$id_cache[$first]['group_leader']) && $id_cache[$second]['group_leader']) + { + return 1; + } + else + { + return $lesser_than * (int) ($id_cache[$first]['last_visit'] - $id_cache[$second]['last_visit']); + } +} diff --git a/install/update/old/includes/functions_download.php b/install/update/old/includes/functions_download.php new file mode 100644 index 0000000..7be12ba --- /dev/null +++ b/install/update/old/includes/functions_download.php @@ -0,0 +1,790 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* A simplified function to deliver avatars +* The argument needs to be checked before calling this function. +*/ +function send_avatar_to_browser($file, $browser) +{ + global $config, $phpbb_root_path; + + $prefix = $config['avatar_salt'] . '_'; + $image_dir = $config['avatar_path']; + + // Adjust image_dir path (no trailing slash) + if (substr($image_dir, -1, 1) == '/' || substr($image_dir, -1, 1) == '\\') + { + $image_dir = substr($image_dir, 0, -1) . '/'; + } + $image_dir = str_replace(array('../', '..\\', './', '.\\'), '', $image_dir); + + if ($image_dir && ($image_dir[0] == '/' || $image_dir[0] == '\\')) + { + $image_dir = ''; + } + $file_path = $phpbb_root_path . $image_dir . '/' . $prefix . $file; + + if ((@file_exists($file_path) && @is_readable($file_path)) && !headers_sent()) + { + header('Cache-Control: public'); + + $image_data = @getimagesize($file_path); + header('Content-Type: ' . image_type_to_mime_type($image_data[2])); + + if ((strpos(strtolower($browser), 'msie') !== false) && !phpbb_is_greater_ie_version($browser, 7)) + { + header('Content-Disposition: attachment; ' . header_filename($file)); + + if (strpos(strtolower($browser), 'msie 6.0') !== false) + { + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); + } + else + { + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); + } + } + else + { + header('Content-Disposition: inline; ' . header_filename($file)); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); + } + + $size = @filesize($file_path); + if ($size) + { + header("Content-Length: $size"); + } + + if (@readfile($file_path) == false) + { + $fp = @fopen($file_path, 'rb'); + + if ($fp !== false) + { + while (!feof($fp)) + { + echo fread($fp, 8192); + } + fclose($fp); + } + } + + flush(); + } + else + { + header('HTTP/1.0 404 Not Found'); + } +} + +/** +* Wraps an url into a simple html page. Used to display attachments in IE. +* this is a workaround for now; might be moved to template system later +* direct any complaints to 1 Microsoft Way, Redmond +*/ +function wrap_img_in_html($src, $title) +{ + echo ''; + echo ''; + echo ''; + echo ''; + echo ''; + echo '' . $title . ''; + echo ''; + echo ''; + echo '
'; + echo '' . $title . ''; + echo '
'; + echo ''; + echo ''; +} + +/** +* Send file to browser +*/ +function send_file_to_browser($attachment, $upload_dir, $category) +{ + global $user, $db, $phpbb_dispatcher, $phpbb_root_path, $request; + + $filename = $phpbb_root_path . $upload_dir . '/' . $attachment['physical_filename']; + + if (!@file_exists($filename)) + { + send_status_line(404, 'Not Found'); + trigger_error('ERROR_NO_ATTACHMENT'); + } + + // Correct the mime type - we force application/octetstream for all files, except images + // Please do not change this, it is a security precaution + if ($category != ATTACHMENT_CATEGORY_IMAGE || strpos($attachment['mimetype'], 'image') !== 0) + { + $attachment['mimetype'] = (strpos(strtolower($user->browser), 'msie') !== false || strpos(strtolower($user->browser), 'opera') !== false) ? 'application/octetstream' : 'application/octet-stream'; + } + + if (@ob_get_length()) + { + @ob_end_clean(); + } + + // Now send the File Contents to the Browser + $size = @filesize($filename); + + /** + * Event to alter attachment before it is sent to browser. + * + * @event core.send_file_to_browser_before + * @var array attachment Attachment data + * @var string upload_dir Relative path of upload directory + * @var int category Attachment category + * @var string filename Path to file, including filename + * @var int size File size + * @since 3.1.11-RC1 + */ + $vars = array( + 'attachment', + 'upload_dir', + 'category', + 'filename', + 'size', + ); + extract($phpbb_dispatcher->trigger_event('core.send_file_to_browser_before', compact($vars))); + + // To correctly display further errors we need to make sure we are using the correct headers for both (unsetting content-length may not work) + + // Check if headers already sent or not able to get the file contents. + if (headers_sent() || !@file_exists($filename) || !@is_readable($filename)) + { + // PHP track_errors setting On? + if (!empty($php_errormsg)) + { + send_status_line(500, 'Internal Server Error'); + trigger_error($user->lang['UNABLE_TO_DELIVER_FILE'] . '
' . sprintf($user->lang['TRACKED_PHP_ERROR'], $php_errormsg)); + } + + send_status_line(500, 'Internal Server Error'); + trigger_error('UNABLE_TO_DELIVER_FILE'); + } + + // Make sure the database record for the filesize is correct + if ($size > 0 && $size != $attachment['filesize'] && strpos($attachment['physical_filename'], 'thumb_') === false) + { + // Update database record + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET filesize = ' . (int) $size . ' + WHERE attach_id = ' . (int) $attachment['attach_id']; + $db->sql_query($sql); + } + + // Now the tricky part... let's dance + header('Cache-Control: public'); + + // Send out the Headers. Do not set Content-Disposition to inline please, it is a security measure for users using the Internet Explorer. + header('Content-Type: ' . $attachment['mimetype']); + + if (phpbb_is_greater_ie_version($user->browser, 7)) + { + header('X-Content-Type-Options: nosniff'); + } + + if ($category == ATTACHMENT_CATEGORY_FLASH && $request->variable('view', 0) === 1) + { + // We use content-disposition: inline for flash files and view=1 to let it correctly play with flash player 10 - any other disposition will fail to play inline + header('Content-Disposition: inline'); + } + else + { + if (empty($user->browser) || ((strpos(strtolower($user->browser), 'msie') !== false) && !phpbb_is_greater_ie_version($user->browser, 7))) + { + header('Content-Disposition: attachment; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); + if (empty($user->browser) || (strpos(strtolower($user->browser), 'msie 6.0') !== false)) + { + header('Expires: ' . gmdate('D, d M Y H:i:s', time()) . ' GMT'); + } + } + else + { + header('Content-Disposition: ' . ((strpos($attachment['mimetype'], 'image') === 0) ? 'inline' : 'attachment') . '; ' . header_filename(htmlspecialchars_decode($attachment['real_filename']))); + if (phpbb_is_greater_ie_version($user->browser, 7) && (strpos($attachment['mimetype'], 'image') !== 0)) + { + header('X-Download-Options: noopen'); + } + } + } + + // Close the db connection before sending the file etc. + file_gc(false); + + if (!set_modified_headers($attachment['filetime'], $user->browser)) + { + // We make sure those have to be enabled manually by defining a constant + // because of the potential disclosure of full attachment path + // in case support for features is absent in the webserver software. + if (defined('PHPBB_ENABLE_X_ACCEL_REDIRECT') && PHPBB_ENABLE_X_ACCEL_REDIRECT) + { + // X-Accel-Redirect - http://wiki.nginx.org/XSendfile + header('X-Accel-Redirect: ' . $user->page['root_script_path'] . $upload_dir . '/' . $attachment['physical_filename']); + exit; + } + else if (defined('PHPBB_ENABLE_X_SENDFILE') && PHPBB_ENABLE_X_SENDFILE && !phpbb_http_byte_range($size)) + { + // X-Sendfile - http://blog.lighttpd.net/articles/2006/07/02/x-sendfile + // Lighttpd's X-Sendfile does not support range requests as of 1.4.26 + // and always requires an absolute path. + header('X-Sendfile: ' . dirname(__FILE__) . "/../$upload_dir/{$attachment['physical_filename']}"); + exit; + } + + if ($size) + { + header("Content-Length: $size"); + } + + // Try to deliver in chunks + @set_time_limit(0); + + $fp = @fopen($filename, 'rb'); + + if ($fp !== false) + { + // Deliver file partially if requested + if ($range = phpbb_http_byte_range($size)) + { + fseek($fp, $range['byte_pos_start']); + + send_status_line(206, 'Partial Content'); + header('Content-Range: bytes ' . $range['byte_pos_start'] . '-' . $range['byte_pos_end'] . '/' . $range['bytes_total']); + header('Content-Length: ' . $range['bytes_requested']); + + // First read chunks + while (!feof($fp) && ftell($fp) < $range['byte_pos_end'] - 8192) + { + echo fread($fp, 8192); + } + // Then, read the remainder + echo fread($fp, $range['bytes_requested'] % 8192); + } + else + { + while (!feof($fp)) + { + echo fread($fp, 8192); + } + } + fclose($fp); + } + else + { + @readfile($filename); + } + + flush(); + } + + exit; +} + +/** +* Get a browser friendly UTF-8 encoded filename +*/ +function header_filename($file) +{ + global $request; + + $user_agent = $request->header('User-Agent'); + + // There be dragons here. + // Not many follows the RFC... + if (strpos($user_agent, 'MSIE') !== false || strpos($user_agent, 'Konqueror') !== false) + { + return "filename=" . rawurlencode($file); + } + + // follow the RFC for extended filename for the rest + return "filename*=UTF-8''" . rawurlencode($file); +} + +/** +* Check if downloading item is allowed +*/ +function download_allowed() +{ + global $config, $user, $db, $request; + + if (!$config['secure_downloads']) + { + return true; + } + + $url = htmlspecialchars_decode($request->header('Referer')); + + if (!$url) + { + return ($config['secure_allow_empty_referer']) ? true : false; + } + + // Split URL into domain and script part + $url = @parse_url($url); + + if ($url === false) + { + return ($config['secure_allow_empty_referer']) ? true : false; + } + + $hostname = $url['host']; + unset($url); + + $allowed = ($config['secure_allow_deny']) ? false : true; + $iplist = array(); + + if (($ip_ary = @gethostbynamel($hostname)) !== false) + { + foreach ($ip_ary as $ip) + { + if ($ip) + { + $iplist[] = $ip; + } + } + } + + // Check for own server... + $server_name = $user->host; + + // Forcing server vars is the only way to specify/override the protocol + if ($config['force_server_vars'] || !$server_name) + { + $server_name = $config['server_name']; + } + + if (preg_match('#^.*?' . preg_quote($server_name, '#') . '.*?$#i', $hostname)) + { + $allowed = true; + } + + // Get IP's and Hostnames + if (!$allowed) + { + $sql = 'SELECT site_ip, site_hostname, ip_exclude + FROM ' . SITELIST_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $site_ip = trim($row['site_ip']); + $site_hostname = trim($row['site_hostname']); + + if ($site_ip) + { + foreach ($iplist as $ip) + { + if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($site_ip, '#')) . '$#i', $ip)) + { + if ($row['ip_exclude']) + { + $allowed = ($config['secure_allow_deny']) ? false : true; + break 2; + } + else + { + $allowed = ($config['secure_allow_deny']) ? true : false; + } + } + } + } + + if ($site_hostname) + { + if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($site_hostname, '#')) . '$#i', $hostname)) + { + if ($row['ip_exclude']) + { + $allowed = ($config['secure_allow_deny']) ? false : true; + break; + } + else + { + $allowed = ($config['secure_allow_deny']) ? true : false; + } + } + } + } + $db->sql_freeresult($result); + } + + return $allowed; +} + +/** +* Check if the browser has the file already and set the appropriate headers- +* @returns false if a resend is in order. +*/ +function set_modified_headers($stamp, $browser) +{ + global $request; + + // let's see if we have to send the file at all + $last_load = $request->header('If-Modified-Since') ? strtotime(trim($request->header('If-Modified-Since'))) : false; + + if (strpos(strtolower($browser), 'msie 6.0') === false && !phpbb_is_greater_ie_version($browser, 7)) + { + if ($last_load !== false && $last_load >= $stamp) + { + send_status_line(304, 'Not Modified'); + // seems that we need those too ... browsers + header('Cache-Control: public'); + header('Expires: ' . gmdate('D, d M Y H:i:s', time() + 31536000) . ' GMT'); + return true; + } + else + { + header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $stamp) . ' GMT'); + } + } + return false; +} + +/** +* Garbage Collection +* +* @param bool $exit Whether to die or not. +* +* @return null +*/ +function file_gc($exit = true) +{ + global $cache, $db; + + if (!empty($cache)) + { + $cache->unload(); + } + + $db->sql_close(); + + if ($exit) + { + exit; + } +} + +/** +* HTTP range support (RFC 2616 Section 14.35) +* +* Allows browsers to request partial file content +* in case a download has been interrupted. +* +* @param int $filesize the size of the file in bytes we are about to deliver +* +* @return mixed false if the whole file has to be delivered +* associative array on success +*/ +function phpbb_http_byte_range($filesize) +{ + // Only call find_range_request() once. + static $request_array; + + if (!$filesize) + { + return false; + } + + if (!isset($request_array)) + { + $request_array = phpbb_find_range_request(); + } + + return (empty($request_array)) ? false : phpbb_parse_range_request($request_array, $filesize); +} + +/** +* Searches for HTTP range request in request headers. +* +* @return mixed false if no request found +* array of strings containing the requested ranges otherwise +* e.g. array(0 => '0-0', 1 => '123-125') +*/ +function phpbb_find_range_request() +{ + global $request; + + $value = $request->header('Range'); + + // Make sure range request starts with "bytes=" + if (strpos($value, 'bytes=') === 0) + { + // Strip leading 'bytes=' + // Multiple ranges can be separated by a comma + return explode(',', substr($value, 6)); + } + + return false; +} + +/** +* Analyses a range request array. +* +* A range request can contain multiple ranges, +* we however only handle the first request and +* only support requests from a given byte to the end of the file. +* +* @param array $request_array array of strings containing the requested ranges +* @param int $filesize the full size of the file in bytes that has been requested +* +* @return mixed false if the whole file has to be delivered +* associative array on success +* byte_pos_start the first byte position, can be passed to fseek() +* byte_pos_end the last byte position +* bytes_requested the number of bytes requested +* bytes_total the full size of the file +*/ +function phpbb_parse_range_request($request_array, $filesize) +{ + $first_byte_pos = -1; + $last_byte_pos = -1; + + // Go through all ranges + foreach ($request_array as $range_string) + { + $range = explode('-', trim($range_string)); + + // "-" is invalid, "0-0" however is valid and means the very first byte. + if (count($range) != 2 || $range[0] === '' && $range[1] === '') + { + continue; + } + + // Substitute defaults + if ($range[0] === '') + { + $range[0] = 0; + } + + if ($range[1] === '') + { + $range[1] = $filesize - 1; + } + + if ($last_byte_pos >= 0 && $last_byte_pos + 1 != $range[0]) + { + // We only support contiguous ranges, no multipart stuff :( + return false; + } + + if ($range[1] && $range[1] < $range[0]) + { + // The requested range contains 0 bytes. + continue; + } + + // Return bytes from $range[0] to $range[1] + if ($first_byte_pos < 0) + { + $first_byte_pos = (int) $range[0]; + } + + $last_byte_pos = (int) $range[1]; + + if ($first_byte_pos >= $filesize) + { + // Requested range not satisfiable + return false; + } + + // Adjust last-byte-pos if it is absent or greater than the content. + if ($range[1] === '' || $last_byte_pos >= $filesize) + { + $last_byte_pos = $filesize - 1; + } + } + + if ($first_byte_pos < 0 || $last_byte_pos < 0) + { + return false; + } + + return array( + 'byte_pos_start' => $first_byte_pos, + 'byte_pos_end' => $last_byte_pos, + 'bytes_requested' => $last_byte_pos - $first_byte_pos + 1, + 'bytes_total' => $filesize, + ); +} + +/** +* Increments the download count of all provided attachments +* +* @param \phpbb\db\driver\driver_interface $db The database object +* @param array|int $ids The attach_id of each attachment +* +* @return null +*/ +function phpbb_increment_downloads($db, $ids) +{ + if (!is_array($ids)) + { + $ids = array($ids); + } + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET download_count = download_count + 1 + WHERE ' . $db->sql_in_set('attach_id', $ids); + $db->sql_query($sql); +} + +/** +* Handles authentication when downloading attachments from a post or topic +* +* @param \phpbb\db\driver\driver_interface $db The database object +* @param \phpbb\auth\auth $auth The authentication object +* @param int $topic_id The id of the topic that we are downloading from +* +* @return null +*/ +function phpbb_download_handle_forum_auth($db, $auth, $topic_id) +{ + global $phpbb_container; + + $sql_array = array( + 'SELECT' => 't.topic_visibility, t.forum_id, f.forum_name, f.forum_password, f.parent_id', + 'FROM' => array( + TOPICS_TABLE => 't', + FORUMS_TABLE => 'f', + ), + 'WHERE' => 't.topic_id = ' . (int) $topic_id . ' + AND t.forum_id = f.forum_id', + ); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + if ($row && !$phpbb_content_visibility->is_visible('topic', $row['forum_id'], $row)) + { + send_status_line(404, 'Not Found'); + trigger_error('ERROR_NO_ATTACHMENT'); + } + else if ($row && $auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id'])) + { + if ($row['forum_password']) + { + // Do something else ... ? + login_forum_box($row); + } + } + else + { + send_status_line(403, 'Forbidden'); + trigger_error('SORRY_AUTH_VIEW_ATTACH'); + } +} + +/** +* Handles authentication when downloading attachments from PMs +* +* @param \phpbb\db\driver\driver_interface $db The database object +* @param \phpbb\auth\auth $auth The authentication object +* @param int $user_id The user id +* @param int $msg_id The id of the PM that we are downloading from +* +* @return null +*/ +function phpbb_download_handle_pm_auth($db, $auth, $user_id, $msg_id) +{ + global $phpbb_dispatcher; + + if (!$auth->acl_get('u_pm_download')) + { + send_status_line(403, 'Forbidden'); + trigger_error('SORRY_AUTH_VIEW_ATTACH'); + } + + $allowed = phpbb_download_check_pm_auth($db, $user_id, $msg_id); + + /** + * Event to modify PM attachments download auth + * + * @event core.modify_pm_attach_download_auth + * @var bool allowed Whether the user is allowed to download from that PM or not + * @var int msg_id The id of the PM to download from + * @var int user_id The user id for auth check + * @since 3.1.11-RC1 + */ + $vars = array('allowed', 'msg_id', 'user_id'); + extract($phpbb_dispatcher->trigger_event('core.modify_pm_attach_download_auth', compact($vars))); + + if (!$allowed) + { + send_status_line(403, 'Forbidden'); + trigger_error('ERROR_NO_ATTACHMENT'); + } +} + +/** +* Checks whether a user can download from a particular PM +* +* @param \phpbb\db\driver\driver_interface $db The database object +* @param int $user_id The user id +* @param int $msg_id The id of the PM that we are downloading from +* +* @return bool Whether the user is allowed to download from that PM or not +*/ +function phpbb_download_check_pm_auth($db, $user_id, $msg_id) +{ + // Check if the attachment is within the users scope... + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE msg_id = ' . (int) $msg_id . ' + AND ( + user_id = ' . (int) $user_id . ' + OR author_id = ' . (int) $user_id . ' + )'; + $result = $db->sql_query_limit($sql, 1); + $allowed = (bool) $db->sql_fetchfield('msg_id'); + $db->sql_freeresult($result); + + return $allowed; +} + +/** +* Check if the browser is internet explorer version 7+ +* +* @param string $user_agent User agent HTTP header +* @param int $version IE version to check against +* +* @return bool true if internet explorer version is greater than $version +*/ +function phpbb_is_greater_ie_version($user_agent, $version) +{ + if (preg_match('/msie (\d+)/', strtolower($user_agent), $matches)) + { + $ie_version = (int) $matches[1]; + return ($ie_version > $version); + } + else + { + return false; + } +} diff --git a/install/update/old/includes/functions_messenger.php b/install/update/old/includes/functions_messenger.php new file mode 100644 index 0000000..4f0d400 --- /dev/null +++ b/install/update/old/includes/functions_messenger.php @@ -0,0 +1,1915 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Messenger +*/ +class messenger +{ + var $msg, $replyto, $from, $subject; + var $addresses = array(); + var $extra_headers = array(); + + var $mail_priority = MAIL_NORMAL_PRIORITY; + var $use_queue = true; + + /** @var \phpbb\template\template */ + protected $template; + + /** + * Constructor + */ + function __construct($use_queue = true) + { + global $config; + + $this->use_queue = (!$config['email_package_size']) ? false : $use_queue; + $this->subject = ''; + } + + /** + * Resets all the data (address, template file, etc etc) to default + */ + function reset() + { + $this->addresses = $this->extra_headers = array(); + $this->msg = $this->replyto = $this->from = ''; + $this->mail_priority = MAIL_NORMAL_PRIORITY; + } + + /** + * Set addresses for to/im as available + * + * @param array $user User row + */ + function set_addresses($user) + { + if (isset($user['user_email']) && $user['user_email']) + { + $this->to($user['user_email'], (isset($user['username']) ? $user['username'] : '')); + } + + if (isset($user['user_jabber']) && $user['user_jabber']) + { + $this->im($user['user_jabber'], (isset($user['username']) ? $user['username'] : '')); + } + } + + /** + * Sets an email address to send to + */ + function to($address, $realname = '') + { + global $config; + + if (!trim($address)) + { + return; + } + + $pos = isset($this->addresses['to']) ? count($this->addresses['to']) : 0; + + $this->addresses['to'][$pos]['email'] = trim($address); + + // If empty sendmail_path on windows, PHP changes the to line + if (!$config['smtp_delivery'] && DIRECTORY_SEPARATOR == '\\') + { + $this->addresses['to'][$pos]['name'] = ''; + } + else + { + $this->addresses['to'][$pos]['name'] = trim($realname); + } + } + + /** + * Sets an cc address to send to + */ + function cc($address, $realname = '') + { + if (!trim($address)) + { + return; + } + + $pos = isset($this->addresses['cc']) ? count($this->addresses['cc']) : 0; + $this->addresses['cc'][$pos]['email'] = trim($address); + $this->addresses['cc'][$pos]['name'] = trim($realname); + } + + /** + * Sets an bcc address to send to + */ + function bcc($address, $realname = '') + { + if (!trim($address)) + { + return; + } + + $pos = isset($this->addresses['bcc']) ? count($this->addresses['bcc']) : 0; + $this->addresses['bcc'][$pos]['email'] = trim($address); + $this->addresses['bcc'][$pos]['name'] = trim($realname); + } + + /** + * Sets a im contact to send to + */ + function im($address, $realname = '') + { + // IM-Addresses could be empty + if (!trim($address)) + { + return; + } + + $pos = isset($this->addresses['im']) ? count($this->addresses['im']) : 0; + $this->addresses['im'][$pos]['uid'] = trim($address); + $this->addresses['im'][$pos]['name'] = trim($realname); + } + + /** + * Set the reply to address + */ + function replyto($address) + { + $this->replyto = trim($address); + } + + /** + * Set the from address + */ + function from($address) + { + $this->from = trim($address); + } + + /** + * set up subject for mail + */ + function subject($subject = '') + { + $this->subject = trim($subject); + } + + /** + * set up extra mail headers + */ + function headers($headers) + { + $this->extra_headers[] = trim($headers); + } + + /** + * Adds X-AntiAbuse headers + * + * @param array $config Configuration array + * @param user $user A user object + * + * @return null + */ + function anti_abuse_headers($config, $user) + { + $this->headers('X-AntiAbuse: Board servername - ' . mail_encode($config['server_name'])); + $this->headers('X-AntiAbuse: User_id - ' . $user->data['user_id']); + $this->headers('X-AntiAbuse: Username - ' . mail_encode($user->data['username'])); + $this->headers('X-AntiAbuse: User IP - ' . $user->ip); + } + + /** + * Set the email priority + */ + function set_mail_priority($priority = MAIL_NORMAL_PRIORITY) + { + $this->mail_priority = $priority; + } + + /** + * Set email template to use + */ + function template($template_file, $template_lang = '', $template_path = '', $template_dir_prefix = '') + { + global $config, $phpbb_root_path, $user; + + $template_dir_prefix = (!$template_dir_prefix || $template_dir_prefix[0] === '/') ? $template_dir_prefix : '/' . $template_dir_prefix; + + $this->setup_template(); + + if (!trim($template_file)) + { + trigger_error('No template file for emailing set.', E_USER_ERROR); + } + + if (!trim($template_lang)) + { + // fall back to board default language if the user's language is + // missing $template_file. If this does not exist either, + // $this->template->set_filenames will do a trigger_error + $template_lang = basename($config['default_lang']); + } + + $ext_template_paths = array( + array( + 'name' => $template_lang . '_email', + 'ext_path' => 'language/' . $template_lang . '/email' . $template_dir_prefix, + ), + ); + + if ($template_path) + { + $template_paths = array( + $template_path . $template_dir_prefix, + ); + } + else + { + $template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; + $template_path .= $template_lang . '/email'; + + $template_paths = array( + $template_path . $template_dir_prefix, + ); + + $board_language = basename($config['default_lang']); + + // we can only specify default language fallback when the path is not a custom one for which we + // do not know the default language alternative + if ($template_lang !== $board_language) + { + $fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; + $fallback_template_path .= $board_language . '/email'; + + $template_paths[] = $fallback_template_path . $template_dir_prefix; + + $ext_template_paths[] = array( + 'name' => $board_language . '_email', + 'ext_path' => 'language/' . $board_language . '/email' . $template_dir_prefix, + ); + } + // If everything fails just fall back to en template + if ($template_lang !== 'en' && $board_language !== 'en') + { + $fallback_template_path = (!empty($user->lang_path)) ? $user->lang_path : $phpbb_root_path . 'language/'; + $fallback_template_path .= 'en/email'; + + $template_paths[] = $fallback_template_path . $template_dir_prefix; + + $ext_template_paths[] = array( + 'name' => 'en_email', + 'ext_path' => 'language/en/email' . $template_dir_prefix, + ); + } + } + + $this->set_template_paths($ext_template_paths, $template_paths); + + $this->template->set_filenames(array( + 'body' => $template_file . '.txt', + )); + + return true; + } + + /** + * assign variables to email template + */ + function assign_vars($vars) + { + $this->setup_template(); + + $this->template->assign_vars($vars); + } + + function assign_block_vars($blockname, $vars) + { + $this->setup_template(); + + $this->template->assign_block_vars($blockname, $vars); + } + + /** + * Send the mail out to the recipients set previously in var $this->addresses + * + * @param int $method User notification method NOTIFY_EMAIL|NOTIFY_IM|NOTIFY_BOTH + * @param bool $break Flag indicating if the function only formats the subject + * and the message without sending it + * + * @return bool + */ + function send($method = NOTIFY_EMAIL, $break = false) + { + global $config, $user, $phpbb_dispatcher; + + // We add some standard variables we always use, no need to specify them always + $this->assign_vars(array( + 'U_BOARD' => generate_board_url(), + 'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . htmlspecialchars_decode($config['board_email_sig'])), + 'SITENAME' => htmlspecialchars_decode($config['sitename']), + )); + + $subject = $this->subject; + $template = $this->template; + /** + * Event to modify the template before parsing + * + * @event core.modify_notification_template + * @var int method User notification method NOTIFY_EMAIL|NOTIFY_IM|NOTIFY_BOTH + * @var bool break Flag indicating if the function only formats the subject + * and the message without sending it + * @var string subject The message subject + * @var \phpbb\template\template template The (readonly) template object + * @since 3.2.4-RC1 + */ + $vars = array('method', 'break', 'subject', 'template'); + extract($phpbb_dispatcher->trigger_event('core.modify_notification_template', compact($vars))); + + // Parse message through template + $message = trim($this->template->assign_display('body')); + + /** + * Event to modify notification message text after parsing + * + * @event core.modify_notification_message + * @var int method User notification method NOTIFY_EMAIL|NOTIFY_IM|NOTIFY_BOTH + * @var bool break Flag indicating if the function only formats the subject + * and the message without sending it + * @var string subject The message subject + * @var string message The message text + * @since 3.1.11-RC1 + */ + $vars = array('method', 'break', 'subject', 'message'); + extract($phpbb_dispatcher->trigger_event('core.modify_notification_message', compact($vars))); + + $this->subject = $subject; + $this->msg = $message; + unset($subject, $message, $template); + + // Because we use \n for newlines in the body message we need to fix line encoding errors for those admins who uploaded email template files in the wrong encoding + $this->msg = str_replace("\r\n", "\n", $this->msg); + + // We now try and pull a subject from the email body ... if it exists, + // do this here because the subject may contain a variable + $drop_header = ''; + $match = array(); + if (preg_match('#^(Subject:(.*?))$#m', $this->msg, $match)) + { + $this->subject = (trim($match[2]) != '') ? trim($match[2]) : (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']); + $drop_header .= '[\r\n]*?' . preg_quote($match[1], '#'); + } + else + { + $this->subject = (($this->subject != '') ? $this->subject : $user->lang['NO_EMAIL_SUBJECT']); + } + + if (preg_match('#^(List-Unsubscribe:(.*?))$#m', $this->msg, $match)) + { + $this->extra_headers[] = $match[1]; + $drop_header .= '[\r\n]*?' . preg_quote($match[1], '#'); + } + + if ($drop_header) + { + $this->msg = trim(preg_replace('#' . $drop_header . '#s', '', $this->msg)); + } + + if ($break) + { + return true; + } + + switch ($method) + { + case NOTIFY_EMAIL: + $result = $this->msg_email(); + break; + + case NOTIFY_IM: + $result = $this->msg_jabber(); + break; + + case NOTIFY_BOTH: + $result = $this->msg_email(); + $this->msg_jabber(); + break; + } + + $this->reset(); + return $result; + } + + /** + * Add error message to log + */ + function error($type, $msg) + { + global $user, $config, $request, $phpbb_log; + + // Session doesn't exist, create it + if (!isset($user->session_id) || $user->session_id === '') + { + $user->session_begin(); + } + + $calling_page = htmlspecialchars_decode($request->server('PHP_SELF')); + + switch ($type) + { + case 'EMAIL': + $message = 'EMAIL/' . (($config['smtp_delivery']) ? 'SMTP' : 'PHP/mail()') . ''; + break; + + default: + $message = "$type"; + break; + } + + $message .= '
' . htmlspecialchars($calling_page) . '

' . $msg . '
'; + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_' . $type, false, array($message)); + } + + /** + * Save to queue + */ + function save_queue() + { + global $config; + + if ($config['email_package_size'] && $this->use_queue && !empty($this->queue)) + { + $this->queue->save(); + return; + } + } + + /** + * Generates a valid message id to be used in emails + * + * @return string message id + */ + function generate_message_id() + { + global $config, $request; + + $domain = ($config['server_name']) ?: $request->server('SERVER_NAME', 'phpbb.generated'); + + return md5(unique_id(time())) . '@' . $domain; + } + + /** + * Return email header + */ + function build_header($to, $cc, $bcc) + { + global $config, $phpbb_dispatcher; + + // We could use keys here, but we won't do this for 3.0.x to retain backwards compatibility + $headers = array(); + + $headers[] = 'From: ' . $this->from; + + if ($cc) + { + $headers[] = 'Cc: ' . $cc; + } + + if ($bcc) + { + $headers[] = 'Bcc: ' . $bcc; + } + + $headers[] = 'Reply-To: ' . $this->replyto; + $headers[] = 'Return-Path: <' . $config['board_email'] . '>'; + $headers[] = 'Sender: <' . $config['board_email'] . '>'; + $headers[] = 'MIME-Version: 1.0'; + $headers[] = 'Message-ID: <' . $this->generate_message_id() . '>'; + $headers[] = 'Date: ' . date('r', time()); + $headers[] = 'Content-Type: text/plain; charset=UTF-8'; // format=flowed + $headers[] = 'Content-Transfer-Encoding: 8bit'; // 7bit + + $headers[] = 'X-Priority: ' . $this->mail_priority; + $headers[] = 'X-MSMail-Priority: ' . (($this->mail_priority == MAIL_LOW_PRIORITY) ? 'Low' : (($this->mail_priority == MAIL_NORMAL_PRIORITY) ? 'Normal' : 'High')); + $headers[] = 'X-Mailer: phpBB3'; + $headers[] = 'X-MimeOLE: phpBB3'; + $headers[] = 'X-phpBB-Origin: phpbb://' . str_replace(array('http://', 'https://'), array('', ''), generate_board_url()); + + /** + * Event to modify email header entries + * + * @event core.modify_email_headers + * @var array headers Array containing email header entries + * @since 3.1.11-RC1 + */ + $vars = array('headers'); + extract($phpbb_dispatcher->trigger_event('core.modify_email_headers', compact($vars))); + + if (count($this->extra_headers)) + { + $headers = array_merge($headers, $this->extra_headers); + } + + return $headers; + } + + /** + * Send out emails + */ + function msg_email() + { + global $config, $phpbb_dispatcher; + + if (empty($config['email_enable'])) + { + return false; + } + + // Addresses to send to? + if (empty($this->addresses) || (empty($this->addresses['to']) && empty($this->addresses['cc']) && empty($this->addresses['bcc']))) + { + // Send was successful. ;) + return true; + } + + $use_queue = false; + if ($config['email_package_size'] && $this->use_queue) + { + if (empty($this->queue)) + { + $this->queue = new queue(); + $this->queue->init('email', $config['email_package_size']); + } + $use_queue = true; + } + + $contact_name = htmlspecialchars_decode($config['board_contact_name']); + $board_contact = (($contact_name !== '') ? '"' . mail_encode($contact_name) . '" ' : '') . '<' . $config['board_contact'] . '>'; + + $break = false; + $addresses = $this->addresses; + $subject = $this->subject; + $msg = $this->msg; + /** + * Event to send message via external transport + * + * @event core.notification_message_email + * @var bool break Flag indicating if the function return after hook + * @var array addresses The message recipients + * @var string subject The message subject + * @var string msg The message text + * @since 3.2.4-RC1 + */ + $vars = array( + 'break', + 'addresses', + 'subject', + 'msg', + ); + extract($phpbb_dispatcher->trigger_event('core.notification_message_email', compact($vars))); + + if ($break) + { + return true; + } + + if (empty($this->replyto)) + { + $this->replyto = $board_contact; + } + + if (empty($this->from)) + { + $this->from = $board_contact; + } + + $encode_eol = ($config['smtp_delivery']) ? "\r\n" : PHP_EOL; + + // Build to, cc and bcc strings + $to = $cc = $bcc = ''; + foreach ($this->addresses as $type => $address_ary) + { + if ($type == 'im') + { + continue; + } + + foreach ($address_ary as $which_ary) + { + ${$type} .= ((${$type} != '') ? ', ' : '') . (($which_ary['name'] != '') ? mail_encode($which_ary['name'], $encode_eol) . ' <' . $which_ary['email'] . '>' : $which_ary['email']); + } + } + + // Build header + $headers = $this->build_header($to, $cc, $bcc); + + // Send message ... + if (!$use_queue) + { + $mail_to = ($to == '') ? 'undisclosed-recipients:;' : $to; + $err_msg = ''; + + if ($config['smtp_delivery']) + { + $result = smtpmail($this->addresses, mail_encode($this->subject), wordwrap(utf8_wordwrap($this->msg), 997, "\n", true), $err_msg, $headers); + } + else + { + $result = phpbb_mail($mail_to, $this->subject, $this->msg, $headers, PHP_EOL, $err_msg); + } + + if (!$result) + { + $this->error('EMAIL', $err_msg); + return false; + } + } + else + { + $this->queue->put('email', array( + 'to' => $to, + 'addresses' => $this->addresses, + 'subject' => $this->subject, + 'msg' => $this->msg, + 'headers' => $headers) + ); + } + + return true; + } + + /** + * Send jabber message out + */ + function msg_jabber() + { + global $config, $user, $phpbb_root_path, $phpEx; + + if (empty($config['jab_enable']) || empty($config['jab_host']) || empty($config['jab_username']) || empty($config['jab_password'])) + { + return false; + } + + if (empty($this->addresses['im'])) + { + // Send was successful. ;) + return true; + } + + $use_queue = false; + if ($config['jab_package_size'] && $this->use_queue) + { + if (empty($this->queue)) + { + $this->queue = new queue(); + $this->queue->init('jabber', $config['jab_package_size']); + } + $use_queue = true; + } + + $addresses = array(); + foreach ($this->addresses['im'] as $type => $uid_ary) + { + $addresses[] = $uid_ary['uid']; + } + $addresses = array_unique($addresses); + + if (!$use_queue) + { + include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); + $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl'], $config['jab_verify_peer'], $config['jab_verify_peer_name'], $config['jab_allow_self_signed']); + + if (!$this->jabber->connect()) + { + $this->error('JABBER', $user->lang['ERR_JAB_CONNECT'] . '
' . $this->jabber->get_log()); + return false; + } + + if (!$this->jabber->login()) + { + $this->error('JABBER', $user->lang['ERR_JAB_AUTH'] . '
' . $this->jabber->get_log()); + return false; + } + + foreach ($addresses as $address) + { + $this->jabber->send_message($address, $this->msg, $this->subject); + } + + $this->jabber->disconnect(); + } + else + { + $this->queue->put('jabber', array( + 'addresses' => $addresses, + 'subject' => $this->subject, + 'msg' => $this->msg) + ); + } + unset($addresses); + return true; + } + + /** + * Setup template engine + */ + protected function setup_template() + { + global $phpbb_container, $phpbb_dispatcher; + + if ($this->template instanceof \phpbb\template\template) + { + return; + } + + $template_environment = new \phpbb\template\twig\environment( + $phpbb_container->get('config'), + $phpbb_container->get('filesystem'), + $phpbb_container->get('path_helper'), + $phpbb_container->getParameter('core.template.cache_path'), + $phpbb_container->get('ext.manager'), + new \phpbb\template\twig\loader( + $phpbb_container->get('filesystem') + ), + $phpbb_dispatcher, + array() + ); + $template_environment->setLexer($phpbb_container->get('template.twig.lexer')); + + $this->template = new \phpbb\template\twig\twig( + $phpbb_container->get('path_helper'), + $phpbb_container->get('config'), + new \phpbb\template\context(), + $template_environment, + $phpbb_container->getParameter('core.template.cache_path'), + $phpbb_container->get('user'), + $phpbb_container->get('template.twig.extensions.collection'), + $phpbb_container->get('ext.manager') + ); + } + + /** + * Set template paths to load + */ + protected function set_template_paths($path_name, $paths) + { + $this->setup_template(); + + $this->template->set_custom_style($path_name, $paths); + } +} + +/** +* handling email and jabber queue +*/ +class queue +{ + var $data = array(); + var $queue_data = array(); + var $package_size = 0; + var $cache_file = ''; + var $eol = "\n"; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * constructor + */ + function __construct() + { + global $phpEx, $phpbb_root_path, $phpbb_filesystem, $phpbb_container; + + $this->data = array(); + $this->cache_file = $phpbb_container->getParameter('core.cache_dir') . "queue.$phpEx"; + $this->filesystem = $phpbb_filesystem; + } + + /** + * Init a queue object + */ + function init($object, $package_size) + { + $this->data[$object] = array(); + $this->data[$object]['package_size'] = $package_size; + $this->data[$object]['data'] = array(); + } + + /** + * Put object in queue + */ + function put($object, $scope) + { + $this->data[$object]['data'][] = $scope; + } + + /** + * Process queue + * Using lock file + */ + function process() + { + global $config, $phpEx, $phpbb_root_path, $user, $phpbb_dispatcher; + + $lock = new \phpbb\lock\flock($this->cache_file); + $lock->acquire(); + + // avoid races, check file existence once + $have_cache_file = file_exists($this->cache_file); + if (!$have_cache_file || $config['last_queue_run'] > time() - $config['queue_interval']) + { + if (!$have_cache_file) + { + $config->set('last_queue_run', time(), false); + } + + $lock->release(); + return; + } + + $config->set('last_queue_run', time(), false); + + include($this->cache_file); + + foreach ($this->queue_data as $object => $data_ary) + { + @set_time_limit(0); + + if (!isset($data_ary['package_size'])) + { + $data_ary['package_size'] = 0; + } + + $package_size = $data_ary['package_size']; + $num_items = (!$package_size || count($data_ary['data']) < $package_size) ? count($data_ary['data']) : $package_size; + + /* + * This code is commented out because it causes problems on some web hosts. + * The core problem is rather restrictive email sending limits. + * This code is nly useful if you have no such restrictions from the + * web host and the package size setting is wrong. + + // If the amount of emails to be sent is way more than package_size than we need to increase it to prevent backlogs... + if (count($data_ary['data']) > $package_size * 2.5) + { + $num_items = count($data_ary['data']); + } + */ + + switch ($object) + { + case 'email': + // Delete the email queued objects if mailing is disabled + if (!$config['email_enable']) + { + unset($this->queue_data['email']); + continue 2; + } + break; + + case 'jabber': + if (!$config['jab_enable']) + { + unset($this->queue_data['jabber']); + continue 2; + } + + include_once($phpbb_root_path . 'includes/functions_jabber.' . $phpEx); + $this->jabber = new jabber($config['jab_host'], $config['jab_port'], $config['jab_username'], htmlspecialchars_decode($config['jab_password']), $config['jab_use_ssl'], $config['jab_verify_peer'], $config['jab_verify_peer_name'], $config['jab_allow_self_signed']); + + if (!$this->jabber->connect()) + { + $messenger = new messenger(); + $messenger->error('JABBER', $user->lang['ERR_JAB_CONNECT']); + continue 2; + } + + if (!$this->jabber->login()) + { + $messenger = new messenger(); + $messenger->error('JABBER', $user->lang['ERR_JAB_AUTH']); + continue 2; + } + + break; + + default: + $lock->release(); + return; + } + + for ($i = 0; $i < $num_items; $i++) + { + // Make variables available... + extract(array_shift($this->queue_data[$object]['data'])); + + switch ($object) + { + case 'email': + $break = false; + /** + * Event to send message via external transport + * + * @event core.notification_message_process + * @var bool break Flag indicating if the function return after hook + * @var array addresses The message recipients + * @var string subject The message subject + * @var string msg The message text + * @since 3.2.4-RC1 + */ + $vars = array( + 'break', + 'addresses', + 'subject', + 'msg', + ); + extract($phpbb_dispatcher->trigger_event('core.notification_message_process', compact($vars))); + + if (!$break) + { + $err_msg = ''; + $to = (!$to) ? 'undisclosed-recipients:;' : $to; + + if ($config['smtp_delivery']) + { + $result = smtpmail($addresses, mail_encode($subject), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $err_msg, $headers); + } + else + { + $result = phpbb_mail($to, $subject, $msg, $headers, PHP_EOL, $err_msg); + } + + if (!$result) + { + $messenger = new messenger(); + $messenger->error('EMAIL', $err_msg); + continue 2; + } + } + break; + + case 'jabber': + foreach ($addresses as $address) + { + if ($this->jabber->send_message($address, $msg, $subject) === false) + { + $messenger = new messenger(); + $messenger->error('JABBER', $this->jabber->get_log()); + continue 3; + } + } + break; + } + } + + // No more data for this object? Unset it + if (!count($this->queue_data[$object]['data'])) + { + unset($this->queue_data[$object]); + } + + // Post-object processing + switch ($object) + { + case 'jabber': + // Hang about a couple of secs to ensure the messages are + // handled, then disconnect + $this->jabber->disconnect(); + break; + } + } + + if (!count($this->queue_data)) + { + @unlink($this->cache_file); + } + else + { + if ($fp = @fopen($this->cache_file, 'wb')) + { + fwrite($fp, "queue_data = unserialize(" . var_export(serialize($this->queue_data), true) . ");\n\n?>"); + fclose($fp); + + if (function_exists('opcache_invalidate')) + { + @opcache_invalidate($this->cache_file); + } + + try + { + $this->filesystem->phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + } + + $lock->release(); + } + + /** + * Save queue + */ + function save() + { + if (!count($this->data)) + { + return; + } + + $lock = new \phpbb\lock\flock($this->cache_file); + $lock->acquire(); + + if (file_exists($this->cache_file)) + { + include($this->cache_file); + + foreach ($this->queue_data as $object => $data_ary) + { + if (isset($this->data[$object]) && count($this->data[$object])) + { + $this->data[$object]['data'] = array_merge($data_ary['data'], $this->data[$object]['data']); + } + else + { + $this->data[$object]['data'] = $data_ary['data']; + } + } + } + + if ($fp = @fopen($this->cache_file, 'w')) + { + fwrite($fp, "queue_data = unserialize(" . var_export(serialize($this->data), true) . ");\n\n?>"); + fclose($fp); + + if (function_exists('opcache_invalidate')) + { + @opcache_invalidate($this->cache_file); + } + + try + { + $this->filesystem->phpbb_chmod($this->cache_file, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + + $this->data = array(); + } + + $lock->release(); + } +} + +/** +* Replacement or substitute for PHP's mail command +*/ +function smtpmail($addresses, $subject, $message, &$err_msg, $headers = false) +{ + global $config, $user; + + // Fix any bare linefeeds in the message to make it RFC821 Compliant. + $message = preg_replace("#(?lang['NO_EMAIL_SUBJECT'])) ? $user->lang['NO_EMAIL_SUBJECT'] : 'No email subject specified'; + return false; + } + + if (trim($message) == '') + { + $err_msg = (isset($user->lang['NO_EMAIL_MESSAGE'])) ? $user->lang['NO_EMAIL_MESSAGE'] : 'Email message was blank'; + return false; + } + + $mail_rcpt = $mail_to = $mail_cc = array(); + + // Build correct addresses for RCPT TO command and the client side display (TO, CC) + if (isset($addresses['to']) && count($addresses['to'])) + { + foreach ($addresses['to'] as $which_ary) + { + $mail_to[] = ($which_ary['name'] != '') ? mail_encode(trim($which_ary['name'])) . ' <' . trim($which_ary['email']) . '>' : '<' . trim($which_ary['email']) . '>'; + $mail_rcpt['to'][] = '<' . trim($which_ary['email']) . '>'; + } + } + + if (isset($addresses['bcc']) && count($addresses['bcc'])) + { + foreach ($addresses['bcc'] as $which_ary) + { + $mail_rcpt['bcc'][] = '<' . trim($which_ary['email']) . '>'; + } + } + + if (isset($addresses['cc']) && count($addresses['cc'])) + { + foreach ($addresses['cc'] as $which_ary) + { + $mail_cc[] = ($which_ary['name'] != '') ? mail_encode(trim($which_ary['name'])) . ' <' . trim($which_ary['email']) . '>' : '<' . trim($which_ary['email']) . '>'; + $mail_rcpt['cc'][] = '<' . trim($which_ary['email']) . '>'; + } + } + + $smtp = new smtp_class(); + + $errno = 0; + $errstr = ''; + + $smtp->add_backtrace('Connecting to ' . $config['smtp_host'] . ':' . $config['smtp_port']); + + // Ok we have error checked as much as we can to this point let's get on it already. + if (!class_exists('\phpbb\error_collector')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/error_collector.' . $phpEx); + } + $collector = new \phpbb\error_collector; + $collector->install(); + + $options = array(); + $verify_peer = (bool) $config['smtp_verify_peer']; + $verify_peer_name = (bool) $config['smtp_verify_peer_name']; + $allow_self_signed = (bool) $config['smtp_allow_self_signed']; + $remote_socket = $config['smtp_host'] . ':' . $config['smtp_port']; + + // Set ssl context options, see http://php.net/manual/en/context.ssl.php + $options['ssl'] = array('verify_peer' => $verify_peer, 'verify_peer_name' => $verify_peer_name, 'allow_self_signed' => $allow_self_signed); + $socket_context = stream_context_create($options); + + $smtp->socket = @stream_socket_client($remote_socket, $errno, $errstr, 20, STREAM_CLIENT_CONNECT, $socket_context); + $collector->uninstall(); + $error_contents = $collector->format_errors(); + + if (!$smtp->socket) + { + if ($errstr) + { + $errstr = utf8_convert_message($errstr); + } + + $err_msg = (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; + $err_msg .= ($error_contents) ? '

' . htmlspecialchars($error_contents) : ''; + return false; + } + + // Wait for reply + if ($err_msg = $smtp->server_parse('220', __LINE__)) + { + $smtp->close_session($err_msg); + return false; + } + + // Let me in. This function handles the complete authentication process + if ($err_msg = $smtp->log_into_server($config['smtp_host'], $config['smtp_username'], htmlspecialchars_decode($config['smtp_password']), $config['smtp_auth_method'])) + { + $smtp->close_session($err_msg); + return false; + } + + // From this point onward most server response codes should be 250 + // Specify who the mail is from.... + $smtp->server_send('MAIL FROM:<' . $config['board_email'] . '>'); + if ($err_msg = $smtp->server_parse('250', __LINE__)) + { + $smtp->close_session($err_msg); + return false; + } + + // Specify each user to send to and build to header. + $to_header = implode(', ', $mail_to); + $cc_header = implode(', ', $mail_cc); + + // Now tell the MTA to send the Message to the following people... [TO, BCC, CC] + $rcpt = false; + foreach ($mail_rcpt as $type => $mail_to_addresses) + { + foreach ($mail_to_addresses as $mail_to_address) + { + // Add an additional bit of error checking to the To field. + if (preg_match('#[^ ]+\@[^ ]+#', $mail_to_address)) + { + $smtp->server_send("RCPT TO:$mail_to_address"); + if ($err_msg = $smtp->server_parse('250', __LINE__)) + { + // We continue... if users are not resolved we do not care + if ($smtp->numeric_response_code != 550) + { + $smtp->close_session($err_msg); + return false; + } + } + else + { + $rcpt = true; + } + } + } + } + + // We try to send messages even if a few people do not seem to have valid email addresses, but if no one has, we have to exit here. + if (!$rcpt) + { + $user->session_begin(); + $err_msg .= '

'; + $err_msg .= (isset($user->lang['INVALID_EMAIL_LOG'])) ? sprintf($user->lang['INVALID_EMAIL_LOG'], htmlspecialchars($mail_to_address)) : '' . htmlspecialchars($mail_to_address) . ' possibly an invalid email address?'; + $smtp->close_session($err_msg); + return false; + } + + // Ok now we tell the server we are ready to start sending data + $smtp->server_send('DATA'); + + // This is the last response code we look for until the end of the message. + if ($err_msg = $smtp->server_parse('354', __LINE__)) + { + $smtp->close_session($err_msg); + return false; + } + + // Send the Subject Line... + $smtp->server_send("Subject: $subject"); + + // Now the To Header. + $to_header = ($to_header == '') ? 'undisclosed-recipients:;' : $to_header; + $smtp->server_send("To: $to_header"); + + // Now the CC Header. + if ($cc_header != '') + { + $smtp->server_send("CC: $cc_header"); + } + + // Now any custom headers.... + if ($headers !== false) + { + $smtp->server_send("$headers\r\n"); + } + + // Ok now we are ready for the message... + $smtp->server_send($message); + + // Ok the all the ingredients are mixed in let's cook this puppy... + $smtp->server_send('.'); + if ($err_msg = $smtp->server_parse('250', __LINE__)) + { + $smtp->close_session($err_msg); + return false; + } + + // Now tell the server we are done and close the socket... + $smtp->server_send('QUIT'); + $smtp->close_session($err_msg); + + return true; +} + +/** +* SMTP Class +* Auth Mechanisms originally taken from the AUTH Modules found within the PHP Extension and Application Repository (PEAR) +* See docs/AUTHORS for more details +*/ +class smtp_class +{ + var $server_response = ''; + var $socket = 0; + protected $socket_tls = false; + var $responses = array(); + var $commands = array(); + var $numeric_response_code = 0; + + var $backtrace = false; + var $backtrace_log = array(); + + function __construct() + { + // Always create a backtrace for admins to identify SMTP problems + $this->backtrace = true; + $this->backtrace_log = array(); + } + + /** + * Add backtrace message for debugging + */ + function add_backtrace($message) + { + if ($this->backtrace) + { + $this->backtrace_log[] = utf8_htmlspecialchars($message); + } + } + + /** + * Send command to smtp server + */ + function server_send($command, $private_info = false) + { + fputs($this->socket, $command . "\r\n"); + + (!$private_info) ? $this->add_backtrace("# $command") : $this->add_backtrace('# Omitting sensitive information'); + + // We could put additional code here + } + + /** + * We use the line to give the support people an indication at which command the error occurred + */ + function server_parse($response, $line) + { + global $user; + + $this->server_response = ''; + $this->responses = array(); + $this->numeric_response_code = 0; + + while (substr($this->server_response, 3, 1) != ' ') + { + if (!($this->server_response = fgets($this->socket, 256))) + { + return (isset($user->lang['NO_EMAIL_RESPONSE_CODE'])) ? $user->lang['NO_EMAIL_RESPONSE_CODE'] : 'Could not get mail server response codes'; + } + $this->responses[] = substr(rtrim($this->server_response), 4); + $this->numeric_response_code = (int) substr($this->server_response, 0, 3); + + $this->add_backtrace("LINE: $line <- {$this->server_response}"); + } + + if (!(substr($this->server_response, 0, 3) == $response)) + { + $this->numeric_response_code = (int) substr($this->server_response, 0, 3); + return (isset($user->lang['EMAIL_SMTP_ERROR_RESPONSE'])) ? sprintf($user->lang['EMAIL_SMTP_ERROR_RESPONSE'], $line, $this->server_response) : "Ran into problems sending Mail at Line $line. Response: $this->server_response"; + } + + return 0; + } + + /** + * Close session + */ + function close_session(&$err_msg) + { + fclose($this->socket); + + if ($this->backtrace) + { + $message = '

Backtrace

' . implode('
', $this->backtrace_log) . '

'; + $err_msg .= $message; + } + } + + /** + * Log into server and get possible auth codes if neccessary + */ + function log_into_server($hostname, $username, $password, $default_auth_method) + { + global $user; + + // Here we try to determine the *real* hostname (reverse DNS entry preferrably) + $local_host = $user->host; + + if (function_exists('php_uname')) + { + $local_host = php_uname('n'); + + // Able to resolve name to IP + if (($addr = @gethostbyname($local_host)) !== $local_host) + { + // Able to resolve IP back to name + if (($name = @gethostbyaddr($addr)) !== $addr) + { + $local_host = $name; + } + } + } + + // If we are authenticating through pop-before-smtp, we + // have to login ones before we get authenticated + // NOTE: on some configurations the time between an update of the auth database takes so + // long that the first email send does not work. This is not a biggie on a live board (only + // the install mail will most likely fail) - but on a dynamic ip connection this might produce + // severe problems and is not fixable! + if ($default_auth_method == 'POP-BEFORE-SMTP' && $username && $password) + { + global $config; + + $errno = 0; + $errstr = ''; + + $this->server_send("QUIT"); + fclose($this->socket); + + $this->pop_before_smtp($hostname, $username, $password); + $username = $password = $default_auth_method = ''; + + // We need to close the previous session, else the server is not + // able to get our ip for matching... + if (!$this->socket = @fsockopen($config['smtp_host'], $config['smtp_port'], $errno, $errstr, 10)) + { + if ($errstr) + { + $errstr = utf8_convert_message($errstr); + } + + $err_msg = (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; + return $err_msg; + } + + // Wait for reply + if ($err_msg = $this->server_parse('220', __LINE__)) + { + $this->close_session($err_msg); + return $err_msg; + } + } + + $hello_result = $this->hello($local_host); + if (!is_null($hello_result)) + { + return $hello_result; + } + + // SMTP STARTTLS (RFC 3207) + if (!$this->socket_tls) + { + $this->socket_tls = $this->starttls(); + + if ($this->socket_tls) + { + // Switched to TLS + // RFC 3207: "The client MUST discard any knowledge obtained from the server, [...]" + // So say hello again + $hello_result = $this->hello($local_host); + + if (!is_null($hello_result)) + { + return $hello_result; + } + } + } + + // If we are not authenticated yet, something might be wrong if no username and passwd passed + if (!$username || !$password) + { + return false; + } + + if (!isset($this->commands['AUTH'])) + { + return (isset($user->lang['SMTP_NO_AUTH_SUPPORT'])) ? $user->lang['SMTP_NO_AUTH_SUPPORT'] : 'SMTP server does not support authentication'; + } + + // Get best authentication method + $available_methods = explode(' ', $this->commands['AUTH']); + + // Define the auth ordering if the default auth method was not found + $auth_methods = array('PLAIN', 'LOGIN', 'CRAM-MD5', 'DIGEST-MD5'); + $method = ''; + + if (in_array($default_auth_method, $available_methods)) + { + $method = $default_auth_method; + } + else + { + foreach ($auth_methods as $_method) + { + if (in_array($_method, $available_methods)) + { + $method = $_method; + break; + } + } + } + + if (!$method) + { + return (isset($user->lang['NO_SUPPORTED_AUTH_METHODS'])) ? $user->lang['NO_SUPPORTED_AUTH_METHODS'] : 'No supported authentication methods'; + } + + $method = strtolower(str_replace('-', '_', $method)); + return $this->$method($username, $password); + } + + /** + * SMTP EHLO/HELO + * + * @return mixed Null if the authentication process is supposed to continue + * False if already authenticated + * Error message (string) otherwise + */ + protected function hello($hostname) + { + // Try EHLO first + $this->server_send("EHLO $hostname"); + if ($err_msg = $this->server_parse('250', __LINE__)) + { + // a 503 response code means that we're already authenticated + if ($this->numeric_response_code == 503) + { + return false; + } + + // If EHLO fails, we try HELO + $this->server_send("HELO $hostname"); + if ($err_msg = $this->server_parse('250', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + } + + foreach ($this->responses as $response) + { + $response = explode(' ', $response); + $response_code = $response[0]; + unset($response[0]); + $this->commands[$response_code] = implode(' ', $response); + } + } + + /** + * SMTP STARTTLS (RFC 3207) + * + * @return bool Returns true if TLS was started + * Otherwise false + */ + protected function starttls() + { + if (!function_exists('stream_socket_enable_crypto')) + { + return false; + } + + if (!isset($this->commands['STARTTLS'])) + { + return false; + } + + $this->server_send('STARTTLS'); + + if ($err_msg = $this->server_parse('220', __LINE__)) + { + return false; + } + + $result = false; + $stream_meta = stream_get_meta_data($this->socket); + + if (socket_set_blocking($this->socket, 1)) + { + $result = stream_socket_enable_crypto($this->socket, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + socket_set_blocking($this->socket, (int) $stream_meta['blocked']); + } + + return $result; + } + + /** + * Pop before smtp authentication + */ + function pop_before_smtp($hostname, $username, $password) + { + global $user; + + if (!$this->socket = @fsockopen($hostname, 110, $errno, $errstr, 10)) + { + if ($errstr) + { + $errstr = utf8_convert_message($errstr); + } + + return (isset($user->lang['NO_CONNECT_TO_SMTP_HOST'])) ? sprintf($user->lang['NO_CONNECT_TO_SMTP_HOST'], $errno, $errstr) : "Could not connect to smtp host : $errno : $errstr"; + } + + $this->server_send("USER $username", true); + if ($err_msg = $this->server_parse('+OK', __LINE__)) + { + return $err_msg; + } + + $this->server_send("PASS $password", true); + if ($err_msg = $this->server_parse('+OK', __LINE__)) + { + return $err_msg; + } + + $this->server_send('QUIT'); + fclose($this->socket); + + return false; + } + + /** + * Plain authentication method + */ + function plain($username, $password) + { + $this->server_send('AUTH PLAIN'); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + + $base64_method_plain = base64_encode("\0" . $username . "\0" . $password); + $this->server_send($base64_method_plain, true); + if ($err_msg = $this->server_parse('235', __LINE__)) + { + return $err_msg; + } + + return false; + } + + /** + * Login authentication method + */ + function login($username, $password) + { + $this->server_send('AUTH LOGIN'); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + + $this->server_send(base64_encode($username), true); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return $err_msg; + } + + $this->server_send(base64_encode($password), true); + if ($err_msg = $this->server_parse('235', __LINE__)) + { + return $err_msg; + } + + return false; + } + + /** + * cram_md5 authentication method + */ + function cram_md5($username, $password) + { + $this->server_send('AUTH CRAM-MD5'); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + + $md5_challenge = base64_decode($this->responses[0]); + $password = (strlen($password) > 64) ? pack('H32', md5($password)) : ((strlen($password) < 64) ? str_pad($password, 64, chr(0)) : $password); + $md5_digest = md5((substr($password, 0, 64) ^ str_repeat(chr(0x5C), 64)) . (pack('H32', md5((substr($password, 0, 64) ^ str_repeat(chr(0x36), 64)) . $md5_challenge)))); + + $base64_method_cram_md5 = base64_encode($username . ' ' . $md5_digest); + + $this->server_send($base64_method_cram_md5, true); + if ($err_msg = $this->server_parse('235', __LINE__)) + { + return $err_msg; + } + + return false; + } + + /** + * digest_md5 authentication method + * A real pain in the *** + */ + function digest_md5($username, $password) + { + global $config, $user; + + $this->server_send('AUTH DIGEST-MD5'); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return ($this->numeric_response_code == 503) ? false : $err_msg; + } + + $md5_challenge = base64_decode($this->responses[0]); + + // Parse the md5 challenge - from AUTH_SASL (PEAR) + $tokens = array(); + while (preg_match('/^([a-z-]+)=("[^"]+(?host; + } + + // Maxbuf + if (empty($tokens['maxbuf'])) + { + $tokens['maxbuf'] = 65536; + } + + // Required: nonce, algorithm + if (empty($tokens['nonce']) || empty($tokens['algorithm'])) + { + $tokens = array(); + } + $md5_challenge = $tokens; + + if (!empty($md5_challenge)) + { + $str = ''; + for ($i = 0; $i < 32; $i++) + { + $str .= chr(mt_rand(0, 255)); + } + $cnonce = base64_encode($str); + + $digest_uri = 'smtp/' . $config['smtp_host']; + + $auth_1 = sprintf('%s:%s:%s', pack('H32', md5(sprintf('%s:%s:%s', $username, $md5_challenge['realm'], $password))), $md5_challenge['nonce'], $cnonce); + $auth_2 = 'AUTHENTICATE:' . $digest_uri; + $response_value = md5(sprintf('%s:%s:00000001:%s:auth:%s', md5($auth_1), $md5_challenge['nonce'], $cnonce, md5($auth_2))); + + $input_string = sprintf('username="%s",realm="%s",nonce="%s",cnonce="%s",nc="00000001",qop=auth,digest-uri="%s",response=%s,%d', $username, $md5_challenge['realm'], $md5_challenge['nonce'], $cnonce, $digest_uri, $response_value, $md5_challenge['maxbuf']); + } + else + { + return (isset($user->lang['INVALID_DIGEST_CHALLENGE'])) ? $user->lang['INVALID_DIGEST_CHALLENGE'] : 'Invalid digest challenge'; + } + + $base64_method_digest_md5 = base64_encode($input_string); + $this->server_send($base64_method_digest_md5, true); + if ($err_msg = $this->server_parse('334', __LINE__)) + { + return $err_msg; + } + + $this->server_send(' '); + if ($err_msg = $this->server_parse('235', __LINE__)) + { + return $err_msg; + } + + return false; + } +} + +/** +* Encodes the given string for proper display in UTF-8. +* +* This version is using base64 encoded data. The downside of this +* is if the mail client does not understand this encoding the user +* is basically doomed with an unreadable subject. +* +* Please note that this version fully supports RFC 2045 section 6.8. +* +* @param string $eol End of line we are using (optional to be backwards compatible) +*/ +function mail_encode($str, $eol = "\r\n") +{ + // define start delimimter, end delimiter and spacer + $start = "=?UTF-8?B?"; + $end = "?="; + $delimiter = "$eol "; + + // Maximum length is 75. $split_length *must* be a multiple of 4, but <= 75 - strlen($start . $delimiter . $end)!!! + $split_length = 60; + $encoded_str = base64_encode($str); + + // If encoded string meets the limits, we just return with the correct data. + if (strlen($encoded_str) <= $split_length) + { + return $start . $encoded_str . $end; + } + + // If there is only ASCII data, we just return what we want, correctly splitting the lines. + if (strlen($str) === utf8_strlen($str)) + { + return $start . implode($end . $delimiter . $start, str_split($encoded_str, $split_length)) . $end; + } + + // UTF-8 data, compose encoded lines + $array = utf8_str_split($str); + $str = ''; + + while (count($array)) + { + $text = ''; + + while (count($array) && intval((strlen($text . $array[0]) + 2) / 3) << 2 <= $split_length) + { + $text .= array_shift($array); + } + + $str .= $start . base64_encode($text) . $end . $delimiter; + } + + return substr($str, 0, -strlen($delimiter)); +} + +/** +* Wrapper for sending out emails with the PHP's mail function +*/ +function phpbb_mail($to, $subject, $msg, $headers, $eol, &$err_msg) +{ + global $config, $phpbb_root_path, $phpEx; + + // We use the EOL character for the OS here because the PHP mail function does not correctly transform line endings. On Windows SMTP is used (SMTP is \r\n), on UNIX a command is used... + // Reference: http://bugs.php.net/bug.php?id=15841 + $headers = implode($eol, $headers); + + if (!class_exists('\phpbb\error_collector')) + { + include($phpbb_root_path . 'includes/error_collector.' . $phpEx); + } + + $collector = new \phpbb\error_collector; + $collector->install(); + + // On some PHP Versions mail() *may* fail if there are newlines within the subject. + // Newlines are used as a delimiter for lines in mail_encode() according to RFC 2045 section 6.8. + // Because PHP can't decide what is wanted we revert back to the non-RFC-compliant way of separating by one space (Use '' as parameter to mail_encode() results in SPACE used) + $additional_parameters = $config['email_force_sender'] ? '-f' . $config['board_email'] : ''; + $result = mail($to, mail_encode($subject, ''), wordwrap(utf8_wordwrap($msg), 997, "\n", true), $headers, $additional_parameters); + + $collector->uninstall(); + $err_msg = $collector->format_errors(); + + return $result; +} diff --git a/install/update/old/includes/functions_module.php b/install/update/old/includes/functions_module.php new file mode 100644 index 0000000..88dafc4 --- /dev/null +++ b/install/update/old/includes/functions_module.php @@ -0,0 +1,1145 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Class handling all types of 'plugins' (a future term) +*/ +class p_master +{ + var $p_id; + var $p_class; + var $p_name; + var $p_mode; + var $p_parent; + + var $include_path = false; + var $active_module = false; + var $active_module_row_id = false; + var $acl_forum_id = false; + var $module_ary = array(); + + /** + * Constuctor + * Set module include path + */ + function __construct($include_path = false) + { + global $phpbb_root_path; + + $this->include_path = ($include_path !== false) ? $include_path : $phpbb_root_path . 'includes/'; + + // Make sure the path ends with / + if (substr($this->include_path, -1) !== '/') + { + $this->include_path .= '/'; + } + } + + /** + * Set custom include path for modules + * Schema for inclusion is include_path . modulebase + * + * @param string $include_path include path to be used. + * @access public + */ + function set_custom_include_path($include_path) + { + $this->include_path = $include_path; + + // Make sure the path ends with / + if (substr($this->include_path, -1) !== '/') + { + $this->include_path .= '/'; + } + } + + /** + * List modules + * + * This creates a list, stored in $this->module_ary of all available + * modules for the given class (ucp, mcp and acp). Additionally + * $this->module_y_ary is created with indentation information for + * displaying the module list appropriately. Only modules for which + * the user has access rights are included in these lists. + */ + function list_modules($p_class) + { + global $db, $user, $cache; + global $phpbb_dispatcher; + + // Sanitise for future path use, it's escaped as appropriate for queries + $this->p_class = str_replace(array('.', '/', '\\'), '', basename($p_class)); + + // Get cached modules + if (($this->module_cache = $cache->get('_modules_' . $this->p_class)) === false) + { + // Get modules + $sql = 'SELECT * + FROM ' . MODULES_TABLE . " + WHERE module_class = '" . $db->sql_escape($this->p_class) . "' + ORDER BY left_id ASC"; + $result = $db->sql_query($sql); + + $rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rows[$row['module_id']] = $row; + } + $db->sql_freeresult($result); + + $this->module_cache = array(); + foreach ($rows as $module_id => $row) + { + $this->module_cache['modules'][] = $row; + $this->module_cache['parents'][$row['module_id']] = $this->get_parents($row['parent_id'], $row['left_id'], $row['right_id'], $rows); + } + unset($rows); + + $cache->put('_modules_' . $this->p_class, $this->module_cache); + } + + if (empty($this->module_cache)) + { + $this->module_cache = array('modules' => array(), 'parents' => array()); + } + + // We "could" build a true tree with this function - maybe mod authors want to use this... + // Functions for traversing and manipulating the tree are not available though + // We might re-structure the module system to use true trees in 3.2.x... + // $tree = $this->build_tree($this->module_cache['modules'], $this->module_cache['parents']); + + // Clean up module cache array to only let survive modules the user can access + $right_id = false; + + $hide_categories = array(); + foreach ($this->module_cache['modules'] as $key => $row) + { + // When the module has no mode (category) we check whether it has visible children + // before listing it as well. + if (!$row['module_mode']) + { + $hide_categories[(int) $row['module_id']] = $key; + } + + // Not allowed to view module? + if (!$this->module_auth_self($row['module_auth'])) + { + unset($this->module_cache['modules'][$key]); + continue; + } + + // Category with no members, ignore + if (!$row['module_basename'] && ($row['left_id'] + 1 == $row['right_id'])) + { + unset($this->module_cache['modules'][$key]); + continue; + } + + // Skip branch + if ($right_id !== false) + { + if ($row['left_id'] < $right_id) + { + unset($this->module_cache['modules'][$key]); + continue; + } + + $right_id = false; + } + + // Not enabled? + if (!$row['module_enabled']) + { + // If category is disabled then disable every child too + unset($this->module_cache['modules'][$key]); + $right_id = $row['right_id']; + continue; + } + + if ($row['module_mode']) + { + // The parent category has a visible child + // So remove it and all its parents from the hide array + unset($hide_categories[(int) $row['parent_id']]); + foreach ($this->module_cache['parents'][$row['module_id']] as $module_id => $row_id) + { + unset($hide_categories[$module_id]); + } + } + } + + foreach ($hide_categories as $module_id => $row_id) + { + unset($this->module_cache['modules'][$row_id]); + } + + // Re-index (this is needed, else we are not able to array_slice later) + $this->module_cache['modules'] = array_merge($this->module_cache['modules']); + + // Include MOD _info files for populating language entries within the menus + $this->add_mod_info($this->p_class); + + // Now build the module array, but exclude completely empty categories... + $right_id = false; + $names = array(); + + foreach ($this->module_cache['modules'] as $key => $row) + { + // Skip branch + if ($right_id !== false) + { + if ($row['left_id'] < $right_id) + { + continue; + } + + $right_id = false; + } + + // Category with no members on their way down (we have to check every level) + if (!$row['module_basename']) + { + $empty_category = true; + + // We go through the branch and look for an activated module + foreach (array_slice($this->module_cache['modules'], $key + 1) as $temp_row) + { + if ($temp_row['left_id'] > $row['left_id'] && $temp_row['left_id'] < $row['right_id']) + { + // Module there + if ($temp_row['module_basename'] && $temp_row['module_enabled']) + { + $empty_category = false; + break; + } + continue; + } + break; + } + + // Skip the branch + if ($empty_category) + { + $right_id = $row['right_id']; + continue; + } + } + + $depth = count($this->module_cache['parents'][$row['module_id']]); + + // We need to prefix the functions to not create a naming conflict + + // Function for building 'url_extra' + $short_name = $this->get_short_name($row['module_basename']); + + $url_func = 'phpbb_module_' . $short_name . '_url'; + if (!function_exists($url_func)) + { + $url_func = '_module_' . $short_name . '_url'; + } + + // Function for building the language name + $lang_func = 'phpbb_module_' . $short_name . '_lang'; + if (!function_exists($lang_func)) + { + $lang_func = '_module_' . $short_name . '_lang'; + } + + // Custom function for calling parameters on module init (for example assigning template variables) + $custom_func = 'phpbb_module_' . $short_name; + if (!function_exists($custom_func)) + { + $custom_func = '_module_' . $short_name; + } + + $names[$row['module_basename'] . '_' . $row['module_mode']][] = true; + + $module_row = array( + 'depth' => $depth, + + 'id' => (int) $row['module_id'], + 'parent' => (int) $row['parent_id'], + 'cat' => ($row['right_id'] > $row['left_id'] + 1) ? true : false, + + 'is_duplicate' => ($row['module_basename'] && count($names[$row['module_basename'] . '_' . $row['module_mode']]) > 1) ? true : false, + + 'name' => (string) $row['module_basename'], + 'mode' => (string) $row['module_mode'], + 'display' => (int) $row['module_display'], + + 'url_extra' => (function_exists($url_func)) ? $url_func($row['module_mode'], $row) : '', + + 'lang' => ($row['module_basename'] && function_exists($lang_func)) ? $lang_func($row['module_mode'], $row['module_langname']) : ((!empty($user->lang[$row['module_langname']])) ? $user->lang[$row['module_langname']] : $row['module_langname']), + 'langname' => $row['module_langname'], + + 'left' => $row['left_id'], + 'right' => $row['right_id'], + ); + + if (function_exists($custom_func)) + { + $custom_func($row['module_mode'], $module_row); + } + + /** + * This event allows to modify parameters for building modules list + * + * @event core.modify_module_row + * @var string url_func Function for building 'url_extra' + * @var string lang_func Function for building the language name + * @var string custom_func Custom function for calling parameters on module init + * @var array row Array holding the basic module data + * @var array module_row Array holding the module display parameters + * @since 3.1.0-b3 + */ + $vars = array('url_func', 'lang_func', 'custom_func', 'row', 'module_row'); + extract($phpbb_dispatcher->trigger_event('core.modify_module_row', compact($vars))); + + $this->module_ary[] = $module_row; + } + + unset($this->module_cache['modules'], $names); + } + + /** + * Check if a certain main module is accessible/loaded + * By giving the module mode you are able to additionally check for only one mode within the main module + * + * @param string $module_basename The module base name, for example logs, reports, main (for the mcp). + * @param mixed $module_mode The module mode to check. If provided the mode will be checked in addition for presence. + * + * @return bool Returns true if module is loaded and accessible, else returns false + */ + function loaded($module_basename, $module_mode = false) + { + if (!$this->is_full_class($module_basename)) + { + $module_basename = $this->p_class . '_' . $module_basename; + } + + if (empty($this->loaded_cache)) + { + $this->loaded_cache = array(); + + foreach ($this->module_ary as $row) + { + if (!$row['name']) + { + continue; + } + + if (!isset($this->loaded_cache[$row['name']])) + { + $this->loaded_cache[$row['name']] = array(); + } + + if (!$row['mode']) + { + continue; + } + + $this->loaded_cache[$row['name']][$row['mode']] = true; + } + } + + if ($module_mode === false) + { + return (isset($this->loaded_cache[$module_basename])) ? true : false; + } + + return (!empty($this->loaded_cache[$module_basename][$module_mode])) ? true : false; + } + + /** + * Check module authorisation. + * + * This is a non-static version that uses $this->acl_forum_id + * for the forum id. + */ + function module_auth_self($module_auth) + { + return self::module_auth($module_auth, $this->acl_forum_id); + } + + /** + * Check module authorisation. + * + * This is a static version, it must be given $forum_id. + * See also module_auth_self. + */ + static function module_auth($module_auth, $forum_id) + { + global $auth, $config; + global $request, $phpbb_extension_manager, $phpbb_dispatcher; + + $module_auth = trim($module_auth); + + // Generally allowed to access module if module_auth is empty + if (!$module_auth) + { + return true; + } + + // With the code below we make sure only those elements get eval'd we really want to be checked + preg_match_all('/(?: + "[^"\\\\]*(?:\\\\.[^"\\\\]*)*" | + \'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\' | + [(),] | + [^\s(),]+)/x', $module_auth, $match); + + // Valid tokens for auth and their replacements + $valid_tokens = array( + 'acl_([a-z0-9_]+)(,\$id)?' => '(int) $auth->acl_get(\'\\1\'\\2)', + '\$id' => '(int) $forum_id', + 'aclf_([a-z0-9_]+)' => '(int) $auth->acl_getf_global(\'\\1\')', + 'cfg_([a-z0-9_]+)' => '(int) $config[\'\\1\']', + 'request_([a-zA-Z0-9_]+)' => '$request->variable(\'\\1\', false)', + 'ext_([a-zA-Z0-9_/]+)' => 'array_key_exists(\'\\1\', $phpbb_extension_manager->all_enabled())', + 'authmethod_([a-z0-9_\\\\]+)' => '($config[\'auth_method\'] === \'\\1\')', + ); + + /** + * Alter tokens for module authorisation check + * + * @event core.module_auth + * @var array valid_tokens Valid tokens and their auth check + * replacements + * @var string module_auth The module_auth of the current + * module + * @var int forum_id The current forum_id + * @since 3.1.0-a3 + */ + $vars = array('valid_tokens', 'module_auth', 'forum_id'); + extract($phpbb_dispatcher->trigger_event('core.module_auth', compact($vars))); + + $tokens = $match[0]; + for ($i = 0, $size = count($tokens); $i < $size; $i++) + { + $token = &$tokens[$i]; + + switch ($token) + { + case ')': + case '(': + case '&&': + case '||': + case ',': + break; + + default: + if (!preg_match('#(?:' . implode(array_keys($valid_tokens), ')|(?:') . ')#', $token)) + { + $token = ''; + } + break; + } + } + + $module_auth = implode(' ', $tokens); + + // Make sure $id separation is working fine + $module_auth = str_replace(' , ', ',', $module_auth); + + $module_auth = preg_replace( + // Array keys with # prepended/appended + array_map(function($value) { + return '#' . $value . '#'; + }, array_keys($valid_tokens)), + array_values($valid_tokens), + $module_auth + ); + + $is_auth = false; + // @codingStandardsIgnoreStart + eval('$is_auth = (int) (' . $module_auth . ');'); + // @codingStandardsIgnoreEnd + + return $is_auth; + } + + /** + * Set active module + */ + function set_active($id = false, $mode = false) + { + global $request; + + $icat = false; + $this->active_module = false; + + if ($request->variable('icat', '')) + { + $icat = $id; + $id = $request->variable('icat', ''); + } + + // Restore the backslashes in class names + if (strpos($id, '-') !== false) + { + $id = str_replace('-', '\\', $id); + } + + if ($id && !is_numeric($id) && !$this->is_full_class($id)) + { + $id = $this->p_class . '_' . $id; + } + + $category = false; + foreach ($this->module_ary as $row_id => $item_ary) + { + // If this is a module and it's selected, active + // If this is a category and the module is the first within it, active + // If this is a module and no mode selected, select first mode + // If no category or module selected, go active for first module in first category + if ( + (($item_ary['name'] === $id || $item_ary['name'] === $this->p_class . '_' . $id || $item_ary['id'] === (int) $id) && (($item_ary['mode'] == $mode && !$item_ary['cat']) || ($icat && $item_ary['cat']))) || + ($item_ary['parent'] === $category && !$item_ary['cat'] && !$icat && $item_ary['display']) || + (($item_ary['name'] === $id || $item_ary['name'] === $this->p_class . '_' . $id || $item_ary['id'] === (int) $id) && !$mode && !$item_ary['cat']) || + (!$id && !$mode && !$item_ary['cat'] && $item_ary['display']) + ) + { + if ($item_ary['cat']) + { + $id = $icat; + $icat = false; + + continue; + } + + $this->p_id = $item_ary['id']; + $this->p_parent = $item_ary['parent']; + $this->p_name = $item_ary['name']; + $this->p_mode = $item_ary['mode']; + $this->p_left = $item_ary['left']; + $this->p_right = $item_ary['right']; + + $this->module_cache['parents'] = $this->module_cache['parents'][$this->p_id]; + $this->active_module = $item_ary['id']; + $this->active_module_row_id = $row_id; + + break; + } + else if (($item_ary['cat'] && $item_ary['id'] === (int) $id) || ($item_ary['parent'] === $category && $item_ary['cat'])) + { + $category = $item_ary['id']; + } + } + } + + /** + * Loads currently active module + * + * This method loads a given module, passing it the relevant id and mode. + * + * @param string|false $mode mode, as passed through to the module + * @param string|false $module_url If supplied, we use this module url + * @param bool $execute_module If true, at the end we execute the main method for the new instance + */ + function load_active($mode = false, $module_url = false, $execute_module = true) + { + global $phpbb_root_path, $phpbb_admin_path, $phpEx, $user, $template, $request; + + $module_path = $this->include_path . $this->p_class; + $icat = $request->variable('icat', ''); + + if ($this->active_module === false) + { + trigger_error('MODULE_NOT_ACCESS', E_USER_ERROR); + } + + // new modules use the full class names, old ones are always called _, e.g. acp_board + if (!class_exists($this->p_name)) + { + if (!file_exists("$module_path/{$this->p_name}.$phpEx")) + { + trigger_error($user->lang('MODULE_NOT_FIND', "$module_path/{$this->p_name}.$phpEx"), E_USER_ERROR); + } + + include("$module_path/{$this->p_name}.$phpEx"); + + if (!class_exists($this->p_name)) + { + trigger_error($user->lang('MODULE_FILE_INCORRECT_CLASS', "$module_path/{$this->p_name}.$phpEx", $this->p_name), E_USER_ERROR); + } + } + + if (!empty($mode)) + { + $this->p_mode = $mode; + } + + // Create a new instance of the desired module ... + $class_name = $this->p_name; + + $this->module = new $class_name($this); + + // We pre-define the action parameter we are using all over the place + if (defined('IN_ADMIN')) + { + /* + * If this is an extension module, we'll try to automatically set + * the style paths for the extension (the ext author can change them + * if necessary). + */ + $module_dir = explode('\\', get_class($this->module)); + + // 0 vendor, 1 extension name, ... + if (isset($module_dir[1])) + { + $module_style_dir = $phpbb_root_path . 'ext/' . $module_dir[0] . '/' . $module_dir[1] . '/adm/style'; + + if (is_dir($module_style_dir)) + { + $template->set_custom_style(array( + array( + 'name' => 'adm', + 'ext_path' => 'adm/style/', + ), + ), array($module_style_dir, $phpbb_admin_path . 'style')); + } + } + + // Is first module automatically enabled a duplicate and the category not passed yet? + if (!$icat && $this->module_ary[$this->active_module_row_id]['is_duplicate']) + { + $icat = $this->module_ary[$this->active_module_row_id]['parent']; + } + + // Not being able to overwrite ;) + $this->module->u_action = append_sid("{$phpbb_admin_path}index.$phpEx", 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + } + else + { + /* + * If this is an extension module, we'll try to automatically set + * the style paths for the extension (the ext author can change them + * if necessary). + */ + $module_dir = explode('\\', get_class($this->module)); + + // 0 vendor, 1 extension name, ... + if (isset($module_dir[1])) + { + $module_style_dir = 'ext/' . $module_dir[0] . '/' . $module_dir[1] . '/styles'; + + if (is_dir($phpbb_root_path . $module_style_dir)) + { + $template->set_style(array($module_style_dir, 'styles')); + } + } + + // If user specified the module url we will use it... + if ($module_url !== false) + { + $this->module->u_action = $module_url; + } + else + { + $this->module->u_action = $phpbb_root_path . (($user->page['page_dir']) ? $user->page['page_dir'] . '/' : '') . $user->page['page_name']; + } + + $this->module->u_action = append_sid($this->module->u_action, 'i=' . $this->get_module_identifier($this->p_name)) . (($icat) ? '&icat=' . $icat : '') . "&mode={$this->p_mode}"; + } + + // Add url_extra parameter to u_action url + if (!empty($this->module_ary) && $this->active_module !== false && $this->module_ary[$this->active_module_row_id]['url_extra']) + { + $this->module->u_action .= $this->module_ary[$this->active_module_row_id]['url_extra']; + } + + // Assign the module path for re-usage + $this->module->module_path = $module_path . '/'; + + // Execute the main method for the new instance, we send the module id and mode as parameters + // Users are able to call the main method after this function to be able to assign additional parameters manually + if ($execute_module) + { + $short_name = preg_replace("#^{$this->p_class}_#", '', $this->p_name); + $this->module->main($short_name, $this->p_mode); + } + } + + /** + * Appending url parameter to the currently active module. + * + * This function is called for adding specific url parameters while executing the current module. + * It is doing the same as the _module_{name}_url() function, apart from being able to be called after + * having dynamically parsed specific parameters. This allows more freedom in choosing additional parameters. + * One example can be seen in /includes/mcp/mcp_notes.php - $this->p_master->adjust_url() call. + * + * @param string $url_extra Extra url parameters, e.g.: &u=$user_id + * + */ + function adjust_url($url_extra) + { + if (empty($this->module_ary[$this->active_module_row_id])) + { + return; + } + + $row = &$this->module_ary[$this->active_module_row_id]; + + // We check for the same url_extra in $row['url_extra'] to overcome doubled additions... + if (strpos($row['url_extra'], $url_extra) === false) + { + $row['url_extra'] .= $url_extra; + } + } + + /** + * Check if a module is active + */ + function is_active($id, $mode = false) + { + // If we find a name by this id and being enabled we have our active one... + foreach ($this->module_ary as $row_id => $item_ary) + { + if (($item_ary['name'] === $id || $item_ary['id'] === (int) $id) && $item_ary['display'] || $item_ary['name'] === $this->p_class . '_' . $id) + { + if ($mode === false || $mode === $item_ary['mode']) + { + return true; + } + } + } + + return false; + } + + /** + * Get parents + */ + function get_parents($parent_id, $left_id, $right_id, &$all_parents) + { + $parents = array(); + + if ($parent_id > 0) + { + foreach ($all_parents as $module_id => $row) + { + if ($row['left_id'] < $left_id && $row['right_id'] > $right_id) + { + $parents[$module_id] = $row['parent_id']; + } + + if ($row['left_id'] > $left_id) + { + break; + } + } + } + + return $parents; + } + + /** + * Get tree branch + */ + function get_branch($left_id, $right_id, $remaining) + { + $branch = array(); + + foreach ($remaining as $key => $row) + { + if ($row['left_id'] > $left_id && $row['left_id'] < $right_id) + { + $branch[] = $row; + continue; + } + break; + } + + return $branch; + } + + /** + * Build true binary tree from given array + * Not in use + */ + function build_tree(&$modules, &$parents) + { + $tree = array(); + + foreach ($modules as $row) + { + $branch = &$tree; + + if ($row['parent_id']) + { + // Go through the tree to find our branch + $parent_tree = $parents[$row['module_id']]; + + foreach ($parent_tree as $id => $value) + { + if (!isset($branch[$id]) && isset($branch['child'])) + { + $branch = &$branch['child']; + } + $branch = &$branch[$id]; + } + $branch = &$branch['child']; + } + + $branch[$row['module_id']] = $row; + if (!isset($branch[$row['module_id']]['child'])) + { + $branch[$row['module_id']]['child'] = array(); + } + } + + return $tree; + } + + /** + * Build navigation structure + */ + function assign_tpl_vars($module_url) + { + global $template; + + $current_id = $right_id = false; + + // Make sure the module_url has a question mark set, effectively determining the delimiter to use + $delim = (strpos($module_url, '?') === false) ? '?' : '&'; + + $current_depth = 0; + $linear_offset = 'l_block1'; + $tabular_offset = 't_block2'; + + // Generate the list of modules, we'll do this in two ways ... + // 1) In a linear fashion + // 2) In a combined tabbed + linear fashion ... tabs for the categories + // and a linear list for subcategories/items + foreach ($this->module_ary as $row_id => $item_ary) + { + // Skip hidden modules + if (!$item_ary['display']) + { + continue; + } + + // Skip branch + if ($right_id !== false) + { + if ($item_ary['left'] < $right_id) + { + continue; + } + + $right_id = false; + } + + // Category with no members on their way down (we have to check every level) + if (!$item_ary['name']) + { + $empty_category = true; + + // We go through the branch and look for an activated module + foreach (array_slice($this->module_ary, $row_id + 1) as $temp_row) + { + if ($temp_row['left'] > $item_ary['left'] && $temp_row['left'] < $item_ary['right']) + { + // Module there and displayed? + if ($temp_row['name'] && $temp_row['display']) + { + $empty_category = false; + break; + } + continue; + } + break; + } + + // Skip the branch + if ($empty_category) + { + $right_id = $item_ary['right']; + continue; + } + } + + // Select first id we can get + if (!$current_id && (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id)) + { + $current_id = $item_ary['id']; + } + + $depth = $item_ary['depth']; + + if ($depth > $current_depth) + { + $linear_offset = $linear_offset . '.l_block' . ($depth + 1); + $tabular_offset = ($depth + 1 > 2) ? $tabular_offset . '.t_block' . ($depth + 1) : $tabular_offset; + } + else if ($depth < $current_depth) + { + for ($i = $current_depth - $depth; $i > 0; $i--) + { + $linear_offset = substr($linear_offset, 0, strrpos($linear_offset, '.')); + $tabular_offset = ($i + $depth > 1) ? substr($tabular_offset, 0, strrpos($tabular_offset, '.')) : $tabular_offset; + } + } + + $u_title = $module_url . $delim . 'i='; + // if the item has a name use it, else use its id + if (empty($item_ary['name'])) + { + $u_title .= $item_ary['id']; + } + else + { + // if the category has a name, then use it. + $u_title .= $this->get_module_identifier($item_ary['name']); + } + // If the item is not a category append the mode + if (!$item_ary['cat']) + { + if ($item_ary['is_duplicate']) + { + $u_title .= '&icat=' . $current_id; + } + $u_title .= '&mode=' . $item_ary['mode']; + } + + // Was not allowed in categories before - /*!$item_ary['cat'] && */ + $u_title .= (isset($item_ary['url_extra'])) ? $item_ary['url_extra'] : ''; + + // Only output a categories items if it's currently selected + if (!$depth || ($depth && (in_array($item_ary['parent'], array_values($this->module_cache['parents'])) || $item_ary['parent'] == $this->p_parent))) + { + $use_tabular_offset = (!$depth) ? 't_block1' : $tabular_offset; + + $tpl_ary = array( + 'L_TITLE' => $item_ary['lang'], + 'S_SELECTED' => (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) ? true : false, + 'U_TITLE' => $u_title + ); + + $template->assign_block_vars($use_tabular_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER))); + } + + $tpl_ary = array( + 'L_TITLE' => $item_ary['lang'], + 'S_SELECTED' => (isset($this->module_cache['parents'][$item_ary['id']]) || $item_ary['id'] == $this->p_id) ? true : false, + 'U_TITLE' => $u_title + ); + + $template->assign_block_vars($linear_offset, array_merge($tpl_ary, array_change_key_case($item_ary, CASE_UPPER))); + + $current_depth = $depth; + } + } + + /** + * Returns desired template name + */ + function get_tpl_name() + { + return $this->module->tpl_name . '.html'; + } + + /** + * Returns the desired page title + */ + function get_page_title() + { + global $user; + + if (!isset($this->module->page_title)) + { + return ''; + } + + return (isset($user->lang[$this->module->page_title])) ? $user->lang[$this->module->page_title] : $this->module->page_title; + } + + /** + * Load module as the current active one without the need for registering it + * + * @param string $class module class (acp/mcp/ucp) + * @param string $name module name (class name of the module, or its basename + * phpbb_ext_foo_acp_bar_module, ucp_zebra or zebra) + * @param string $mode mode, as passed through to the module + * + */ + function load($class, $name, $mode = false) + { + // new modules use the full class names, old ones are always called _, e.g. acp_board + // in the latter case this function may be called as load('acp', 'board') + if (!class_exists($name) && substr($name, 0, strlen($class) + 1) !== $class . '_') + { + $name = $class . '_' . $name; + } + + $this->p_class = $class; + $this->p_name = $name; + + // Set active module to true instead of using the id + $this->active_module = true; + + $this->load_active($mode); + } + + /** + * Display module + */ + function display($page_title, $display_online_list = false) + { + global $template, $user; + + // Generate the page + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_header($page_title); + } + else + { + page_header($page_title, $display_online_list); + } + + $template->set_filenames(array( + 'body' => $this->get_tpl_name()) + ); + + if (defined('IN_ADMIN') && isset($user->data['session_admin']) && $user->data['session_admin']) + { + adm_page_footer(); + } + else + { + page_footer(); + } + } + + /** + * Toggle whether this module will be displayed or not + */ + function set_display($id, $mode = false, $display = true) + { + foreach ($this->module_ary as $row_id => $item_ary) + { + if (($item_ary['name'] === $id || $item_ary['name'] === $this->p_class . '_' . $id || $item_ary['id'] === (int) $id) && (!$mode || $item_ary['mode'] === $mode)) + { + $this->module_ary[$row_id]['display'] = (int) $display; + } + } + } + + /** + * Add custom MOD info language file + */ + function add_mod_info($module_class) + { + global $config, $user, $phpEx, $phpbb_extension_manager; + + $finder = $phpbb_extension_manager->get_finder(); + + // We grab the language files from the default, English and user's language. + // So we can fall back to the other files like we do when using add_lang() + $default_lang_files = $english_lang_files = $user_lang_files = array(); + + // Search for board default language if it's not the user language + if ($config['default_lang'] != $user->lang_name) + { + $default_lang_files = $finder + ->prefix('info_' . strtolower($module_class) . '_') + ->suffix(".$phpEx") + ->extension_directory('/language/' . basename($config['default_lang'])) + ->core_path('language/' . basename($config['default_lang']) . '/mods/') + ->find(); + } + + // Search for english, if its not the default or user language + if ($config['default_lang'] != 'en' && $user->lang_name != 'en') + { + $english_lang_files = $finder + ->prefix('info_' . strtolower($module_class) . '_') + ->suffix(".$phpEx") + ->extension_directory('/language/en') + ->core_path('language/en/mods/') + ->find(); + } + + // Find files in the user's language + $user_lang_files = $finder + ->prefix('info_' . strtolower($module_class) . '_') + ->suffix(".$phpEx") + ->extension_directory('/language/' . $user->lang_name) + ->core_path('language/' . $user->lang_name . '/mods/') + ->find(); + + $lang_files = array_merge($english_lang_files, $default_lang_files, $user_lang_files); + foreach ($lang_files as $lang_file => $ext_name) + { + $user->add_lang_ext($ext_name, $lang_file); + } + } + + /** + * Retrieve shortened module basename for legacy basenames (with xcp_ prefix) + * + * @param string $basename A module basename + * @return string The basename if it starts with phpbb_ or the basename with + * the current p_class (e.g. acp_) stripped. + */ + protected function get_short_name($basename) + { + if (substr($basename, 0, 6) === 'phpbb\\' || strpos($basename, '\\') !== false) + { + return $basename; + } + + // strip xcp_ prefix from old classes + return substr($basename, strlen($this->p_class) + 1); + } + + /** + * If the basename contains a \ we don't use that for the URL. + * + * Firefox is currently unable to correctly copy a urlencoded \ + * so users will be unable to post links to modules. + * However we can replace them with dashes and re-replace them later + * + * @param string $basename Basename of the module + * @return string Identifier that should be used for + * module link creation + */ + protected function get_module_identifier($basename) + { + if (strpos($basename, '\\') === false) + { + return $basename; + } + + return str_replace('\\', '-', $basename); + } + + /** + * Checks whether the given module basename is a correct class name + * + * @param string $basename A module basename + * @return bool True if the basename starts with phpbb_ or (x)cp_, false otherwise + */ + protected function is_full_class($basename) + { + return (strpos($basename, '\\') !== false || preg_match('/^(ucp|mcp|acp)_/', $basename)); + } +} diff --git a/install/update/old/includes/functions_posting.php b/install/update/old/includes/functions_posting.php new file mode 100644 index 0000000..3640f54 --- /dev/null +++ b/install/update/old/includes/functions_posting.php @@ -0,0 +1,2772 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Fill smiley templates (or just the variables) with smilies, either in a window or inline +*/ +function generate_smilies($mode, $forum_id) +{ + global $db, $user, $config, $template, $phpbb_dispatcher, $request; + global $phpEx, $phpbb_root_path, $phpbb_container, $phpbb_path_helper; + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $base_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=smilies&f=' . $forum_id); + $start = $request->variable('start', 0); + + if ($mode == 'window') + { + if ($forum_id) + { + $sql = 'SELECT forum_style + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $user->setup('posting', (int) $row['forum_style']); + } + else + { + $user->setup('posting'); + } + + page_header($user->lang['SMILIES']); + + $sql = 'SELECT COUNT(smiley_id) AS item_count + FROM ' . SMILIES_TABLE . ' + GROUP BY smiley_url'; + $result = $db->sql_query($sql, 3600); + + $smiley_count = 0; + while ($row = $db->sql_fetchrow($result)) + { + ++$smiley_count; + } + $db->sql_freeresult($result); + + $template->set_filenames(array( + 'body' => 'posting_smilies.html') + ); + + $start = $pagination->validate_start($start, $config['smilies_per_page'], $smiley_count); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $smiley_count, $config['smilies_per_page'], $start); + } + + $display_link = false; + if ($mode == 'inline') + { + $sql = 'SELECT smiley_id + FROM ' . SMILIES_TABLE . ' + WHERE display_on_posting = 0'; + $result = $db->sql_query_limit($sql, 1, 0, 3600); + + if ($row = $db->sql_fetchrow($result)) + { + $display_link = true; + } + $db->sql_freeresult($result); + } + + if ($mode == 'window') + { + $sql = 'SELECT smiley_url, MIN(emotion) as emotion, MIN(code) AS code, smiley_width, smiley_height, MIN(smiley_order) AS min_smiley_order + FROM ' . SMILIES_TABLE . ' + GROUP BY smiley_url, smiley_width, smiley_height + ORDER BY min_smiley_order'; + $result = $db->sql_query_limit($sql, $config['smilies_per_page'], $start, 3600); + } + else + { + $sql = 'SELECT * + FROM ' . SMILIES_TABLE . ' + WHERE display_on_posting = 1 + ORDER BY smiley_order'; + $result = $db->sql_query($sql, 3600); + } + + $smilies = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (empty($smilies[$row['smiley_url']])) + { + $smilies[$row['smiley_url']] = $row; + } + } + $db->sql_freeresult($result); + + if (count($smilies)) + { + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_path_helper->get_web_root_path(); + + foreach ($smilies as $row) + { + /** + * Modify smiley root path before populating smiley list + * + * @event core.generate_smilies_before + * @var string root_path root_path for smilies + * @since 3.1.11-RC1 + */ + $vars = array('root_path'); + extract($phpbb_dispatcher->trigger_event('core.generate_smilies_before', compact($vars))); + $template->assign_block_vars('smiley', array( + 'SMILEY_CODE' => $row['code'], + 'A_SMILEY_CODE' => addslashes($row['code']), + 'SMILEY_IMG' => $root_path . $config['smilies_path'] . '/' . $row['smiley_url'], + 'SMILEY_WIDTH' => $row['smiley_width'], + 'SMILEY_HEIGHT' => $row['smiley_height'], + 'SMILEY_DESC' => $row['emotion']) + ); + } + } + + /** + * This event is called after the smilies are populated + * + * @event core.generate_smilies_after + * @var string mode Mode of the smilies: window|inline + * @var int forum_id The forum ID we are currently in + * @var bool display_link Shall we display the "more smilies" link? + * @since 3.1.0-a1 + */ + $vars = array('mode', 'forum_id', 'display_link'); + extract($phpbb_dispatcher->trigger_event('core.generate_smilies_after', compact($vars))); + + if ($mode == 'inline' && $display_link) + { + $template->assign_vars(array( + 'S_SHOW_SMILEY_LINK' => true, + 'U_MORE_SMILIES' => $base_url, + )); + } + + if ($mode == 'window') + { + page_footer(); + } +} + +/** +* Update last post information +* Should be used instead of sync() if only the last post information are out of sync... faster +* +* @param string $type Can be forum|topic +* @param mixed $ids topic/forum ids +* @param bool $return_update_sql true: SQL query shall be returned, false: execute SQL +*/ +function update_post_information($type, $ids, $return_update_sql = false) +{ + global $db; + + if (empty($ids)) + { + return; + } + if (!is_array($ids)) + { + $ids = array($ids); + } + + $update_sql = $empty_forums = $not_empty_forums = array(); + + if ($type != 'topic') + { + $topic_join = ', ' . TOPICS_TABLE . ' t'; + $topic_condition = 'AND t.topic_id = p.topic_id AND t.topic_visibility = ' . ITEM_APPROVED; + } + else + { + $topic_join = ''; + $topic_condition = ''; + } + + if (count($ids) == 1) + { + $sql = 'SELECT p.post_id as last_post_id + FROM ' . POSTS_TABLE . " p $topic_join + WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . " + $topic_condition + AND p.post_visibility = " . ITEM_APPROVED . " + ORDER BY p.post_id DESC"; + $result = $db->sql_query_limit($sql, 1); + } + else + { + $sql = 'SELECT p.' . $type . '_id, MAX(p.post_id) as last_post_id + FROM ' . POSTS_TABLE . " p $topic_join + WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . " + $topic_condition + AND p.post_visibility = " . ITEM_APPROVED . " + GROUP BY p.{$type}_id"; + $result = $db->sql_query($sql); + } + + $last_post_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (count($ids) == 1) + { + $row[$type . '_id'] = $ids[0]; + } + + if ($type == 'forum') + { + $not_empty_forums[] = $row['forum_id']; + + if (empty($row['last_post_id'])) + { + $empty_forums[] = $row['forum_id']; + } + } + + $last_post_ids[] = $row['last_post_id']; + } + $db->sql_freeresult($result); + + if ($type == 'forum') + { + $empty_forums = array_merge($empty_forums, array_diff($ids, $not_empty_forums)); + + foreach ($empty_forums as $void => $forum_id) + { + $update_sql[$forum_id][] = 'forum_last_post_id = 0'; + $update_sql[$forum_id][] = "forum_last_post_subject = ''"; + $update_sql[$forum_id][] = 'forum_last_post_time = 0'; + $update_sql[$forum_id][] = 'forum_last_poster_id = 0'; + $update_sql[$forum_id][] = "forum_last_poster_name = ''"; + $update_sql[$forum_id][] = "forum_last_poster_colour = ''"; + } + } + + if (count($last_post_ids)) + { + $sql = 'SELECT p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE p.poster_id = u.user_id + AND ' . $db->sql_in_set('p.post_id', $last_post_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $update_sql[$row["{$type}_id"]][] = $type . '_last_post_id = ' . (int) $row['post_id']; + $update_sql[$row["{$type}_id"]][] = "{$type}_last_post_subject = '" . $db->sql_escape($row['post_subject']) . "'"; + $update_sql[$row["{$type}_id"]][] = $type . '_last_post_time = ' . (int) $row['post_time']; + $update_sql[$row["{$type}_id"]][] = $type . '_last_poster_id = ' . (int) $row['poster_id']; + $update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_colour = '" . $db->sql_escape($row['user_colour']) . "'"; + $update_sql[$row["{$type}_id"]][] = "{$type}_last_poster_name = '" . (($row['poster_id'] == ANONYMOUS) ? $db->sql_escape($row['post_username']) : $db->sql_escape($row['username'])) . "'"; + } + $db->sql_freeresult($result); + } + unset($empty_forums, $ids, $last_post_ids); + + if ($return_update_sql || !count($update_sql)) + { + return $update_sql; + } + + $table = ($type == 'forum') ? FORUMS_TABLE : TOPICS_TABLE; + + foreach ($update_sql as $update_id => $update_sql_ary) + { + $sql = "UPDATE $table + SET " . implode(', ', $update_sql_ary) . " + WHERE {$type}_id = $update_id"; + $db->sql_query($sql); + } + + return; +} + +/** +* Generate Topic Icons for display +*/ +function posting_gen_topic_icons($mode, $icon_id) +{ + global $phpbb_root_path, $config, $template, $cache; + + // Grab icons + $icons = $cache->obtain_icons(); + + if (!$icon_id) + { + $template->assign_var('S_NO_ICON_CHECKED', ' checked="checked"'); + } + + if (count($icons)) + { + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $phpbb_root_path; + + foreach ($icons as $id => $data) + { + if ($data['display']) + { + $template->assign_block_vars('topic_icon', array( + 'ICON_ID' => $id, + 'ICON_IMG' => $root_path . $config['icons_path'] . '/' . $data['img'], + 'ICON_WIDTH' => $data['width'], + 'ICON_HEIGHT' => $data['height'], + 'ICON_ALT' => $data['alt'], + + 'S_CHECKED' => ($id == $icon_id) ? true : false, + 'S_ICON_CHECKED' => ($id == $icon_id) ? ' checked="checked"' : '') + ); + } + } + + return true; + } + + return false; +} + +/** +* Build topic types able to be selected +*/ +function posting_gen_topic_types($forum_id, $cur_topic_type = POST_NORMAL) +{ + global $auth, $user, $template; + + $toggle = false; + + $topic_types = array( + 'sticky' => array('const' => POST_STICKY, 'lang' => 'POST_STICKY'), + 'announce' => array('const' => POST_ANNOUNCE, 'lang' => 'POST_ANNOUNCEMENT'), + 'announce_global' => array('const' => POST_GLOBAL, 'lang' => 'POST_GLOBAL') + ); + + $topic_type_array = array(); + + foreach ($topic_types as $auth_key => $topic_value) + { + if ($auth->acl_get('f_' . $auth_key, $forum_id)) + { + $toggle = true; + + $topic_type_array[] = array( + 'VALUE' => $topic_value['const'], + 'S_CHECKED' => ($cur_topic_type == $topic_value['const']) ? ' checked="checked"' : '', + 'L_TOPIC_TYPE' => $user->lang[$topic_value['lang']] + ); + } + } + + if ($toggle) + { + $topic_type_array = array_merge(array(0 => array( + 'VALUE' => POST_NORMAL, + 'S_CHECKED' => ($cur_topic_type == POST_NORMAL) ? ' checked="checked"' : '', + 'L_TOPIC_TYPE' => $user->lang['POST_NORMAL'])), + + $topic_type_array + ); + + foreach ($topic_type_array as $array) + { + $template->assign_block_vars('topic_type', $array); + } + + $template->assign_vars(array( + 'S_TOPIC_TYPE_STICKY' => ($auth->acl_get('f_sticky', $forum_id)), + 'S_TOPIC_TYPE_ANNOUNCE' => ($auth->acl_gets('f_announce', 'f_announce_global', $forum_id)), + )); + } + + return $toggle; +} + +// +// Attachment related functions +// + +/** +* Upload Attachment - filedata is generated here +* Uses upload class +* +* @deprecated 3.2.0-a1 (To be removed: 3.4.0) +* +* @param string $form_name The form name of the file upload input +* @param int $forum_id The id of the forum +* @param bool $local Whether the file is local or not +* @param string $local_storage The path to the local file +* @param bool $is_message Whether it is a PM or not +* @param array $local_filedata A filespec object created for the local file +* +* @return array File data array +*/ +function upload_attachment($form_name, $forum_id, $local = false, $local_storage = '', $is_message = false, $local_filedata = false) +{ + global $phpbb_container; + + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $file = $attachment_manager->upload($form_name, $forum_id, $local, $local_storage, $is_message, $local_filedata); + unset($attachment_manager); + + return $file; +} + +/** +* Calculate the needed size for Thumbnail +*/ +function get_img_size_format($width, $height) +{ + global $config; + + // Maximum Width the Image can take + $max_width = ($config['img_max_thumb_width']) ? $config['img_max_thumb_width'] : 400; + + if ($width > $height) + { + return array( + round($width * ($max_width / $width)), + round($height * ($max_width / $width)) + ); + } + else + { + return array( + round($width * ($max_width / $height)), + round($height * ($max_width / $height)) + ); + } +} + +/** +* Return supported image types +*/ +function get_supported_image_types($type = false) +{ + if (@extension_loaded('gd')) + { + $format = imagetypes(); + $new_type = 0; + + if ($type !== false) + { + // Type is one of the IMAGETYPE constants - it is fetched from getimagesize() + switch ($type) + { + // GIF + case IMAGETYPE_GIF: + $new_type = ($format & IMG_GIF) ? IMG_GIF : false; + break; + + // JPG, JPC, JP2 + case IMAGETYPE_JPEG: + case IMAGETYPE_JPC: + case IMAGETYPE_JPEG2000: + case IMAGETYPE_JP2: + case IMAGETYPE_JPX: + case IMAGETYPE_JB2: + $new_type = ($format & IMG_JPG) ? IMG_JPG : false; + break; + + // PNG + case IMAGETYPE_PNG: + $new_type = ($format & IMG_PNG) ? IMG_PNG : false; + break; + + // WBMP + case IMAGETYPE_WBMP: + $new_type = ($format & IMG_WBMP) ? IMG_WBMP : false; + break; + } + } + else + { + $new_type = array(); + $go_through_types = array(IMG_GIF, IMG_JPG, IMG_PNG, IMG_WBMP); + + foreach ($go_through_types as $check_type) + { + if ($format & $check_type) + { + $new_type[] = $check_type; + } + } + } + + return array( + 'gd' => ($new_type) ? true : false, + 'format' => $new_type, + 'version' => (function_exists('imagecreatetruecolor')) ? 2 : 1 + ); + } + + return array('gd' => false); +} + +/** +* Create Thumbnail +*/ +function create_thumbnail($source, $destination, $mimetype) +{ + global $config, $phpbb_filesystem, $phpbb_dispatcher; + + $min_filesize = (int) $config['img_min_thumb_filesize']; + $img_filesize = (file_exists($source)) ? @filesize($source) : false; + + if (!$img_filesize || $img_filesize <= $min_filesize) + { + return false; + } + + $dimension = @getimagesize($source); + + if ($dimension === false) + { + return false; + } + + list($width, $height, $type, ) = $dimension; + + if (empty($width) || empty($height)) + { + return false; + } + + list($new_width, $new_height) = get_img_size_format($width, $height); + + // Do not create a thumbnail if the resulting width/height is bigger than the original one + if ($new_width >= $width && $new_height >= $height) + { + return false; + } + + $thumbnail_created = false; + + /** + * Create thumbnail event to replace GD thumbnail creation with for example ImageMagick + * + * @event core.thumbnail_create_before + * @var string source Image source path + * @var string destination Thumbnail destination path + * @var string mimetype Image mime type + * @var float new_width Calculated thumbnail width + * @var float new_height Calculated thumbnail height + * @var bool thumbnail_created Set to true to skip default GD thumbnail creation + * @since 3.2.4 + */ + $vars = array( + 'source', + 'destination', + 'mimetype', + 'new_width', + 'new_height', + 'thumbnail_created', + ); + extract($phpbb_dispatcher->trigger_event('core.thumbnail_create_before', compact($vars))); + + if (!$thumbnail_created) + { + $type = get_supported_image_types($type); + + if ($type['gd']) + { + // If the type is not supported, we are not able to create a thumbnail + if ($type['format'] === false) + { + return false; + } + + switch ($type['format']) + { + case IMG_GIF: + $image = @imagecreatefromgif($source); + break; + + case IMG_JPG: + @ini_set('gd.jpeg_ignore_warning', 1); + $image = @imagecreatefromjpeg($source); + break; + + case IMG_PNG: + $image = @imagecreatefrompng($source); + break; + + case IMG_WBMP: + $image = @imagecreatefromwbmp($source); + break; + } + + if (empty($image)) + { + return false; + } + + if ($type['version'] == 1) + { + $new_image = imagecreate($new_width, $new_height); + + if ($new_image === false) + { + return false; + } + + imagecopyresized($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + } + else + { + $new_image = imagecreatetruecolor($new_width, $new_height); + + if ($new_image === false) + { + return false; + } + + // Preserve alpha transparency (png for example) + @imagealphablending($new_image, false); + @imagesavealpha($new_image, true); + + imagecopyresampled($new_image, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); + } + + // If we are in safe mode create the destination file prior to using the gd functions to circumvent a PHP bug + if (@ini_get('safe_mode') || @strtolower(ini_get('safe_mode')) == 'on') + { + @touch($destination); + } + + switch ($type['format']) + { + case IMG_GIF: + imagegif($new_image, $destination); + break; + + case IMG_JPG: + imagejpeg($new_image, $destination, 90); + break; + + case IMG_PNG: + imagepng($new_image, $destination); + break; + + case IMG_WBMP: + imagewbmp($new_image, $destination); + break; + } + + imagedestroy($new_image); + } + else + { + return false; + } + } + + if (!file_exists($destination)) + { + return false; + } + + try + { + $phpbb_filesystem->phpbb_chmod($destination, CHMOD_READ | CHMOD_WRITE); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + + return true; +} + +/** +* Assign Inline attachments (build option fields) +*/ +function posting_gen_inline_attachments(&$attachment_data) +{ + global $template; + + if (count($attachment_data)) + { + $s_inline_attachment_options = ''; + + foreach ($attachment_data as $i => $attachment) + { + $s_inline_attachment_options .= ''; + } + + $template->assign_var('S_INLINE_ATTACHMENT_OPTIONS', $s_inline_attachment_options); + + return true; + } + + return false; +} + +/** +* Generate inline attachment entry +*/ +function posting_gen_attachment_entry($attachment_data, &$filename_data, $show_attach_box = true) +{ + global $template, $config, $phpbb_root_path, $phpEx, $user, $phpbb_dispatcher; + + // Some default template variables + $template->assign_vars(array( + 'S_SHOW_ATTACH_BOX' => $show_attach_box, + 'S_HAS_ATTACHMENTS' => count($attachment_data), + 'FILESIZE' => $config['max_filesize'], + 'FILE_COMMENT' => (isset($filename_data['filecomment'])) ? $filename_data['filecomment'] : '', + )); + + if (count($attachment_data)) + { + // We display the posted attachments within the desired order. + ($config['display_order']) ? krsort($attachment_data) : ksort($attachment_data); + + $attachrow_template_vars = []; + + foreach ($attachment_data as $count => $attach_row) + { + $hidden = ''; + $attach_row['real_filename'] = utf8_basename($attach_row['real_filename']); + + foreach ($attach_row as $key => $value) + { + $hidden .= ''; + } + + $download_link = append_sid("{$phpbb_root_path}download/file.$phpEx", 'mode=view&id=' . (int) $attach_row['attach_id'], true, ($attach_row['is_orphan']) ? $user->session_id : false); + + $attachrow_template_vars[(int) $attach_row['attach_id']] = array( + 'FILENAME' => utf8_basename($attach_row['real_filename']), + 'A_FILENAME' => addslashes(utf8_basename($attach_row['real_filename'])), + 'FILE_COMMENT' => $attach_row['attach_comment'], + 'ATTACH_ID' => $attach_row['attach_id'], + 'S_IS_ORPHAN' => $attach_row['is_orphan'], + 'ASSOC_INDEX' => $count, + 'FILESIZE' => get_formatted_filesize($attach_row['filesize']), + + 'U_VIEW_ATTACHMENT' => $download_link, + 'S_HIDDEN' => $hidden, + ); + } + + /** + * Modify inline attachments template vars + * + * @event core.modify_inline_attachments_template_vars + * @var array attachment_data Array containing attachments data + * @var array attachrow_template_vars Array containing attachments template vars + * @since 3.2.2-RC1 + */ + $vars = array('attachment_data', 'attachrow_template_vars'); + extract($phpbb_dispatcher->trigger_event('core.modify_inline_attachments_template_vars', compact($vars))); + + $template->assign_block_vars_array('attach_row', $attachrow_template_vars); + } + + return count($attachment_data); +} + +// +// General Post functions +// + +/** +* Load Drafts +*/ +function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $msg_id = 0) +{ + global $user, $db, $template, $auth; + global $phpbb_root_path, $phpbb_dispatcher, $phpEx; + + $topic_ids = $forum_ids = $draft_rows = array(); + + // Load those drafts not connected to forums/topics + // If forum_id == 0 AND topic_id == 0 then this is a PM draft + if (!$topic_id && !$forum_id) + { + $sql_and = ' AND d.forum_id = 0 AND d.topic_id = 0'; + } + else + { + $sql_and = ''; + $sql_and .= ($forum_id) ? ' AND d.forum_id = ' . (int) $forum_id : ''; + $sql_and .= ($topic_id) ? ' AND d.topic_id = ' . (int) $topic_id : ''; + } + + $sql = 'SELECT d.*, f.forum_id, f.forum_name + FROM ' . DRAFTS_TABLE . ' d + LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = d.forum_id) + WHERE d.user_id = ' . $user->data['user_id'] . " + $sql_and + ORDER BY d.save_time DESC"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_id']) + { + $topic_ids[] = (int) $row['topic_id']; + } + $draft_rows[] = $row; + } + $db->sql_freeresult($result); + + if (!count($draft_rows)) + { + return; + } + + $topic_rows = array(); + if (count($topic_ids)) + { + $sql = 'SELECT topic_id, forum_id, topic_title, topic_poster + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', array_unique($topic_ids)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $topic_rows[$row['topic_id']] = $row; + } + $db->sql_freeresult($result); + } + + /** + * Drafts found and their topics + * Edit $draft_rows in order to add or remove drafts loaded + * + * @event core.load_drafts_draft_list_result + * @var array draft_rows The drafts query result. Includes its forum id and everything about the draft + * @var array topic_ids The list of topics got from the topics table + * @var array topic_rows The topics that draft_rows references + * @since 3.1.0-RC3 + */ + $vars = array('draft_rows', 'topic_ids', 'topic_rows'); + extract($phpbb_dispatcher->trigger_event('core.load_drafts_draft_list_result', compact($vars))); + + unset($topic_ids); + + $template->assign_var('S_SHOW_DRAFTS', true); + + foreach ($draft_rows as $draft) + { + $link_topic = $link_forum = $link_pm = false; + $view_url = $title = ''; + + if (isset($topic_rows[$draft['topic_id']]) + && ( + ($topic_rows[$draft['topic_id']]['forum_id'] && $auth->acl_get('f_read', $topic_rows[$draft['topic_id']]['forum_id'])) + || + (!$topic_rows[$draft['topic_id']]['forum_id'] && $auth->acl_getf_global('f_read')) + )) + { + $topic_forum_id = ($topic_rows[$draft['topic_id']]['forum_id']) ? $topic_rows[$draft['topic_id']]['forum_id'] : $forum_id; + + $link_topic = true; + $view_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_forum_id . '&t=' . $draft['topic_id']); + $title = $topic_rows[$draft['topic_id']]['topic_title']; + + $insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $topic_forum_id . '&t=' . $draft['topic_id'] . '&mode=reply&d=' . $draft['draft_id']); + } + else if ($draft['forum_id'] && $auth->acl_get('f_read', $draft['forum_id'])) + { + $link_forum = true; + $view_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $draft['forum_id']); + $title = $draft['forum_name']; + + $insert_url = append_sid("{$phpbb_root_path}posting.$phpEx", 'f=' . $draft['forum_id'] . '&mode=post&d=' . $draft['draft_id']); + } + else + { + // Either display as PM draft if forum_id and topic_id are empty or if access to the forums has been denied afterwards... + $link_pm = true; + $insert_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&d={$draft['draft_id']}" . (($pm_action) ? "&action=$pm_action" : '') . (($msg_id) ? "&p=$msg_id" : '')); + } + + $template->assign_block_vars('draftrow', array( + 'DRAFT_ID' => $draft['draft_id'], + 'DATE' => $user->format_date($draft['save_time']), + 'DRAFT_SUBJECT' => $draft['draft_subject'], + + 'TITLE' => $title, + 'U_VIEW' => $view_url, + 'U_INSERT' => $insert_url, + + 'S_LINK_PM' => $link_pm, + 'S_LINK_TOPIC' => $link_topic, + 'S_LINK_FORUM' => $link_forum) + ); + } +} + +/** +* Topic Review +*/ +function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true) +{ + global $user, $auth, $db, $template; + global $config, $phpbb_root_path, $phpEx, $phpbb_container, $phpbb_dispatcher; + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + $sql_sort = ($mode == 'post_review') ? 'ASC' : 'DESC'; + + // Go ahead and pull all data for this topic + $sql = 'SELECT p.post_id + FROM ' . POSTS_TABLE . ' p' . " + WHERE p.topic_id = $topic_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . ' + ' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . ' + ' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . ' + ORDER BY p.post_time ' . $sql_sort . ', p.post_id ' . $sql_sort; + $result = $db->sql_query_limit($sql, $config['posts_per_page']); + + $post_list = array(); + + while ($row = $db->sql_fetchrow($result)) + { + $post_list[] = $row['post_id']; + } + + $db->sql_freeresult($result); + + if (!count($post_list)) + { + return false; + } + + // Handle 'post_review_edit' like 'post_review' from now on + if ($mode == 'post_review_edit') + { + $mode = 'post_review'; + } + + $sql_ary = array( + 'SELECT' => 'u.username, u.user_id, u.user_colour, p.*, z.friend, z.foe, uu.username as post_delete_username, uu.user_colour as post_delete_user_colour', + + 'FROM' => array( + USERS_TABLE => 'u', + POSTS_TABLE => 'p', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(ZEBRA_TABLE => 'z'), + 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id', + ), + array( + 'FROM' => array(USERS_TABLE => 'uu'), + 'ON' => 'uu.user_id = p.post_delete_user', + ), + ), + + 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . ' + AND u.user_id = p.poster_id', + ); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + $rowset = array(); + $has_attachments = false; + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['post_id']] = $row; + + if ($row['post_attachment']) + { + $has_attachments = true; + } + } + $db->sql_freeresult($result); + + // Grab extensions + $attachments = array(); + if ($has_attachments && $auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) + { + // Get attachments... + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $post_list) . ' + AND in_message = 0 + ORDER BY filetime DESC, post_msg_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + } + + /** + * Event to modify the posts list for topic reviews + * + * @event core.topic_review_modify_post_list + * @var array attachments Array with the post attachments data + * @var int cur_post_id Post offset ID + * @var int forum_id The topic's forum ID + * @var string mode The topic review mode + * @var array post_list Array with the post IDs + * @var array rowset Array with the posts data + * @var bool show_quote_button Flag indicating if the quote button should be displayed + * @var int topic_id The topic ID that is being reviewed + * @since 3.1.9-RC1 + */ + $vars = array( + 'attachments', + 'cur_post_id', + 'forum_id', + 'mode', + 'post_list', + 'rowset', + 'show_quote_button', + 'topic_id', + ); + extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_post_list', compact($vars))); + + for ($i = 0, $end = count($post_list); $i < $end; ++$i) + { + // A non-existing rowset only happens if there was no user present for the entered poster_id + // This could be a broken posts table. + if (!isset($rowset[$post_list[$i]])) + { + continue; + } + + $row = $rowset[$post_list[$i]]; + + $poster_id = $row['user_id']; + $post_subject = $row['post_subject']; + + $decoded_message = false; + + if ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) + { + $decoded_message = censor_text($row['post_text']); + decode_message($decoded_message, $row['bbcode_uid']); + + $decoded_message = bbcode_nl2br($decoded_message); + } + + $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']])) + { + $update_count = array(); + parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count); + } + + $post_subject = censor_text($post_subject); + + $post_anchor = ($mode == 'post_review') ? 'ppr' . $row['post_id'] : 'pr' . $row['post_id']; + $u_show_post = append_sid($phpbb_root_path . 'viewtopic.' . $phpEx, "f=$forum_id&t=$topic_id&p={$row['post_id']}&view=show#p{$row['post_id']}"); + + $l_deleted_message = ''; + if ($row['post_visibility'] == ITEM_DELETED) + { + $display_postername = get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + + // User having deleted the post also being the post author? + if (!$row['post_delete_user'] || $row['post_delete_user'] == $poster_id) + { + $display_username = $display_postername; + } + else + { + $display_username = get_username_string('full', $row['post_delete_user'], $row['post_delete_username'], $row['post_delete_user_colour']); + } + + if ($row['post_delete_reason']) + { + $l_deleted_message = $user->lang('POST_DELETED_BY_REASON', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true), $row['post_delete_reason']); + } + else + { + $l_deleted_message = $user->lang('POST_DELETED_BY', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true)); + } + } + + $post_row = array( + 'POST_AUTHOR_FULL' => get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + + 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, + 'S_FRIEND' => ($row['friend']) ? true : false, + 'S_IGNORE_POST' => ($row['foe']) ? true : false, + 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), "", '') : '', + 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false, + 'L_DELETE_POST' => $l_deleted_message, + + 'POST_SUBJECT' => $post_subject, + 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), + 'POST_DATE' => $user->format_date($row['post_time']), + 'MESSAGE' => $message, + 'DECODED_MESSAGE' => $decoded_message, + 'POST_ID' => $row['post_id'], + 'POST_TIME' => $row['post_time'], + 'USER_ID' => $row['user_id'], + 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'], + 'U_MCP_DETAILS' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=post_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'POSTER_QUOTE' => ($show_quote_button && $auth->acl_get('f_reply', $forum_id)) ? addslashes(get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '', + ); + + $current_row_number = $i; + + /** + * Event to modify the template data block for topic reviews + * + * @event core.topic_review_modify_row + * @var string mode The review mode + * @var int topic_id The topic that is being reviewed + * @var int forum_id The topic's forum + * @var int cur_post_id Post offset id + * @var int current_row_number Number of the current row being iterated + * @var array post_row Template block array of the current post + * @var array row Array with original post and user data + * @since 3.1.4-RC1 + */ + $vars = array( + 'mode', + 'topic_id', + 'forum_id', + 'cur_post_id', + 'current_row_number', + 'post_row', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.topic_review_modify_row', compact($vars))); + + $template->assign_block_vars($mode . '_row', $post_row); + + // Display not already displayed Attachments for this post, we already parsed them. ;) + if (!empty($attachments[$row['post_id']])) + { + foreach ($attachments[$row['post_id']] as $attachment) + { + $template->assign_block_vars($mode . '_row.attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + } + + unset($rowset[$post_list[$i]]); + } + + if ($mode == 'topic_review') + { + $template->assign_var('QUOTE_IMG', $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE'])); + } + + return true; +} + +// +// Post handling functions +// + +/** +* Delete Post +*/ +function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $softdelete_reason = '') +{ + global $db, $user, $phpbb_container, $phpbb_dispatcher; + global $config, $phpEx, $phpbb_root_path; + + // Specify our post mode + $post_mode = 'delete'; + if (($data['topic_first_post_id'] === $data['topic_last_post_id']) && ($data['topic_posts_approved'] + $data['topic_posts_unapproved'] + $data['topic_posts_softdeleted'] == 1)) + { + $post_mode = 'delete_topic'; + } + else if ($data['topic_first_post_id'] == $post_id) + { + $post_mode = 'delete_first_post'; + } + else if ($data['topic_last_post_id'] == $post_id) + { + $post_mode = 'delete_last_post'; + } + $sql_data = array(); + $next_post_id = false; + + include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + + $db->sql_transaction('begin'); + + // we must make sure to update forums that contain the shadow'd topic + if ($post_mode == 'delete_topic') + { + $shadow_forum_ids = array(); + + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_moved_id', $topic_id); + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($shadow_forum_ids[(int) $row['forum_id']])) + { + $shadow_forum_ids[(int) $row['forum_id']] = 1; + } + else + { + $shadow_forum_ids[(int) $row['forum_id']]++; + } + } + $db->sql_freeresult($result); + } + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + + // (Soft) delete the post + if ($is_soft && ($post_mode != 'delete_topic')) + { + $phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $post_id, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason, ($data['topic_first_post_id'] == $post_id), ($data['topic_last_post_id'] == $post_id)); + } + else if (!$is_soft) + { + if (!delete_posts('post_id', array($post_id), false, false, false)) + { + // Try to delete topic, we may had an previous error causing inconsistency + if ($post_mode == 'delete_topic') + { + delete_topics('topic_id', array($topic_id), false); + } + trigger_error('ALREADY_DELETED'); + } + } + + $db->sql_transaction('commit'); + + // Collect the necessary information for updating the tables + $sql_data[FORUMS_TABLE] = $sql_data[TOPICS_TABLE] = ''; + switch ($post_mode) + { + case 'delete_topic': + + foreach ($shadow_forum_ids as $updated_forum => $topic_count) + { + // counting is fun! we only have to do count($forum_ids) number of queries, + // even if the topic is moved back to where its shadow lives (we count how many times it is in a forum) + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_topics_approved = forum_topics_approved - ' . $topic_count . ' + WHERE forum_id = ' . $updated_forum; + $db->sql_query($sql); + update_post_information('forum', $updated_forum); + } + + if ($is_soft) + { + $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason); + } + else + { + delete_topics('topic_id', array($topic_id), false); + + $phpbb_content_visibility->remove_topic_from_statistic($data, $sql_data); + + $update_sql = update_post_information('forum', $forum_id, true); + if (count($update_sql)) + { + $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : ''; + $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]); + } + } + + break; + + case 'delete_first_post': + $sql = 'SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE p.topic_id = $topic_id + AND p.poster_id = u.user_id + AND p.post_visibility = " . ITEM_APPROVED . ' + ORDER BY p.post_time ASC, p.post_id ASC'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + // No approved post, so the first is a not-approved post (unapproved or soft deleted) + $sql = 'SELECT p.post_id, p.poster_id, p.post_time, p.post_username, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE p.topic_id = $topic_id + AND p.poster_id = u.user_id + ORDER BY p.post_time ASC, p.post_id ASC"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + $next_post_id = (int) $row['post_id']; + + $sql_data[TOPICS_TABLE] = $db->sql_build_array('UPDATE', array( + 'topic_poster' => (int) $row['poster_id'], + 'topic_first_post_id' => (int) $row['post_id'], + 'topic_first_poster_colour' => $row['user_colour'], + 'topic_first_poster_name' => ($row['poster_id'] == ANONYMOUS) ? $row['post_username'] : $row['username'], + 'topic_time' => (int) $row['post_time'], + )); + break; + + case 'delete_last_post': + if (!$is_soft) + { + // Update last post information when hard deleting. Soft delete already did that by itself. + $update_sql = update_post_information('forum', $forum_id, true); + if (count($update_sql)) + { + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . implode(', ', $update_sql[$forum_id]); + } + + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_bumped = 0, topic_bumper = 0'; + + $update_sql = update_post_information('topic', $topic_id, true); + if (!empty($update_sql)) + { + $sql_data[TOPICS_TABLE] .= ', ' . implode(', ', $update_sql[$topic_id]); + $next_post_id = (int) str_replace('topic_last_post_id = ', '', $update_sql[$topic_id][0]); + } + } + + if (!$next_post_id) + { + $sql = 'SELECT MAX(post_id) as last_post_id + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id); + $result = $db->sql_query($sql); + $next_post_id = (int) $db->sql_fetchfield('last_post_id'); + $db->sql_freeresult($result); + } + break; + + case 'delete': + $sql = 'SELECT post_id + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . ' + AND post_time > ' . $data['post_time'] . ' + ORDER BY post_time ASC, post_id ASC'; + $result = $db->sql_query_limit($sql, 1); + $next_post_id = (int) $db->sql_fetchfield('post_id'); + $db->sql_freeresult($result); + break; + } + + if (($post_mode == 'delete') || ($post_mode == 'delete_last_post') || ($post_mode == 'delete_first_post')) + { + if (!$is_soft) + { + $phpbb_content_visibility->remove_post_from_statistic($data, $sql_data); + } + + $sql = 'SELECT 1 AS has_attachments + FROM ' . ATTACHMENTS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query_limit($sql, 1); + $has_attachments = (int) $db->sql_fetchfield('has_attachments'); + $db->sql_freeresult($result); + + if (!$has_attachments) + { + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_attachment = 0'; + } + } + + $db->sql_transaction('begin'); + + $where_sql = array( + FORUMS_TABLE => "forum_id = $forum_id", + TOPICS_TABLE => "topic_id = $topic_id", + USERS_TABLE => 'user_id = ' . $data['poster_id'], + ); + + foreach ($sql_data as $table => $update_sql) + { + if ($update_sql) + { + $db->sql_query("UPDATE $table SET $update_sql WHERE " . $where_sql[$table]); + } + } + + // Adjust posted info for this user by looking for a post by him/her within this topic... + if ($post_mode != 'delete_topic' && $config['load_db_track'] && $data['poster_id'] != ANONYMOUS) + { + $sql = 'SELECT poster_id + FROM ' . POSTS_TABLE . ' + WHERE topic_id = ' . $topic_id . ' + AND poster_id = ' . $data['poster_id']; + $result = $db->sql_query_limit($sql, 1); + $poster_id = (int) $db->sql_fetchfield('poster_id'); + $db->sql_freeresult($result); + + // The user is not having any more posts within this topic + if (!$poster_id) + { + $sql = 'DELETE FROM ' . TOPICS_POSTED_TABLE . ' + WHERE topic_id = ' . $topic_id . ' + AND user_id = ' . $data['poster_id']; + $db->sql_query($sql); + } + } + + $db->sql_transaction('commit'); + + if ($data['post_reported'] && ($post_mode != 'delete_topic')) + { + sync('topic_reported', 'topic_id', array($topic_id)); + } + + /** + * This event is used for performing actions directly after a post or topic + * has been deleted. + * + * @event core.delete_post_after + * @var int forum_id Post forum ID + * @var int topic_id Post topic ID + * @var int post_id Post ID + * @var array data Post data + * @var bool is_soft Soft delete flag + * @var string softdelete_reason Soft delete reason + * @var string post_mode delete_topic, delete_first_post, delete_last_post or delete + * @var mixed next_post_id Next post ID in the topic (post ID or false) + * + * @since 3.1.11-RC1 + */ + $vars = array( + 'forum_id', + 'topic_id', + 'post_id', + 'data', + 'is_soft', + 'softdelete_reason', + 'post_mode', + 'next_post_id', + ); + extract($phpbb_dispatcher->trigger_event('core.delete_post_after', compact($vars))); + + return $next_post_id; +} + +/** +* Submit Post +* @todo Split up and create lightweight, simple API for this. +*/ +function submit_post($mode, $subject, $username, $topic_type, &$poll_ary, &$data_ary, $update_message = true, $update_search_index = true) +{ + global $db, $auth, $user, $config, $phpEx, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $phpbb_log, $request; + + $poll = $poll_ary; + $data = $data_ary; + /** + * Modify the data for post submitting + * + * @event core.modify_submit_post_data + * @var string mode Variable containing posting mode value + * @var string subject Variable containing post subject value + * @var string username Variable containing post author name + * @var int topic_type Variable containing topic type value + * @var array poll Array with the poll data for the post + * @var array data Array with the data for the post + * @var bool update_message Flag indicating if the post will be updated + * @var bool update_search_index Flag indicating if the search index will be updated + * @since 3.1.0-a4 + */ + $vars = array( + 'mode', + 'subject', + 'username', + 'topic_type', + 'poll', + 'data', + 'update_message', + 'update_search_index', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_submit_post_data', compact($vars))); + $poll_ary = $poll; + $data_ary = $data; + unset($poll); + unset($data); + + // We do not handle erasing posts here + if ($mode == 'delete') + { + return false; + } + + if (!empty($data_ary['post_time'])) + { + $current_time = $data_ary['post_time']; + } + else + { + $current_time = time(); + } + + if ($mode == 'post') + { + $post_mode = 'post'; + $update_message = true; + } + else if ($mode != 'edit') + { + $post_mode = 'reply'; + $update_message = true; + } + else if ($mode == 'edit') + { + $post_mode = ($data_ary['topic_posts_approved'] + $data_ary['topic_posts_unapproved'] + $data_ary['topic_posts_softdeleted'] == 1) ? 'edit_topic' : (($data_ary['topic_first_post_id'] == $data_ary['post_id']) ? 'edit_first_post' : (($data_ary['topic_last_post_id'] == $data_ary['post_id']) ? 'edit_last_post' : 'edit')); + } + + // First of all make sure the subject and topic title are having the correct length. + // To achieve this without cutting off between special chars we convert to an array and then count the elements. + $subject = truncate_string($subject, 120); + $data_ary['topic_title'] = truncate_string($data_ary['topic_title'], 120); + + // Collect some basic information about which tables and which rows to update/insert + $sql_data = $topic_row = array(); + $poster_id = ($mode == 'edit') ? $data_ary['poster_id'] : (int) $user->data['user_id']; + + // Retrieve some additional information if not present + if ($mode == 'edit' && (!isset($data_ary['post_visibility']) || !isset($data_ary['topic_visibility']) || $data_ary['post_visibility'] === false || $data_ary['topic_visibility'] === false)) + { + $sql = 'SELECT p.post_visibility, t.topic_type, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_visibility + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p + WHERE t.topic_id = p.topic_id + AND p.post_id = ' . $data_ary['post_id']; + $result = $db->sql_query($sql); + $topic_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $data_ary['topic_visibility'] = $topic_row['topic_visibility']; + $data_ary['post_visibility'] = $topic_row['post_visibility']; + } + + // This variable indicates if the user is able to post or put into the queue + $post_visibility = ITEM_APPROVED; + + // Check the permissions for post approval. + // Moderators must go through post approval like ordinary users. + if (!$auth->acl_get('f_noapprove', $data_ary['forum_id'])) + { + // Post not approved, but in queue + $post_visibility = ITEM_UNAPPROVED; + switch ($post_mode) + { + case 'edit_first_post': + case 'edit': + case 'edit_last_post': + case 'edit_topic': + $post_visibility = ITEM_REAPPROVE; + break; + } + } + else if (isset($data_ary['post_visibility']) && $data_ary['post_visibility'] !== false) + { + $post_visibility = $data_ary['post_visibility']; + } + + // MODs/Extensions are able to force any visibility on posts + if (isset($data_ary['force_approved_state'])) + { + $post_visibility = (in_array((int) $data_ary['force_approved_state'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED, ITEM_REAPPROVE))) ? (int) $data_ary['force_approved_state'] : $post_visibility; + } + if (isset($data_ary['force_visibility'])) + { + $post_visibility = (in_array((int) $data_ary['force_visibility'], array(ITEM_APPROVED, ITEM_UNAPPROVED, ITEM_DELETED, ITEM_REAPPROVE))) ? (int) $data_ary['force_visibility'] : $post_visibility; + } + + // Start the transaction here + $db->sql_transaction('begin'); + + // Collect Information + switch ($post_mode) + { + case 'post': + case 'reply': + $sql_data[POSTS_TABLE]['sql'] = array( + 'forum_id' => $data_ary['forum_id'], + 'poster_id' => (int) $user->data['user_id'], + 'icon_id' => $data_ary['icon_id'], + 'poster_ip' => $user->ip, + 'post_time' => $current_time, + 'post_visibility' => $post_visibility, + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], + 'post_username' => (!$user->data['is_registered']) ? $username : '', + 'post_subject' => $subject, + 'post_text' => $data_ary['message'], + 'post_checksum' => $data_ary['message_md5'], + 'post_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'], + 'post_postcount' => ($auth->acl_get('f_postcount', $data_ary['forum_id'])) ? 1 : 0, + 'post_edit_locked' => $data_ary['post_edit_locked'] + ); + break; + + case 'edit_first_post': + case 'edit': + + case 'edit_last_post': + case 'edit_topic': + + // If edit reason is given always display edit info + + // If editing last post then display no edit info + // If m_edit permission then display no edit info + // If normal edit display edit info + + // Display edit info if edit reason given or user is editing his post, which is not the last within the topic. + if ($data_ary['post_edit_reason'] || (!$auth->acl_get('m_edit', $data_ary['forum_id']) && ($post_mode == 'edit' || $post_mode == 'edit_first_post'))) + { + $data_ary['post_edit_reason'] = truncate_string($data_ary['post_edit_reason'], 255, 255, false); + + $sql_data[POSTS_TABLE]['sql'] = array( + 'post_edit_time' => $current_time, + 'post_edit_reason' => $data_ary['post_edit_reason'], + 'post_edit_user' => (int) $data_ary['post_edit_user'], + ); + + $sql_data[POSTS_TABLE]['stat'][] = 'post_edit_count = post_edit_count + 1'; + } + else if (!$data_ary['post_edit_reason'] && $mode == 'edit' && $auth->acl_get('m_edit', $data_ary['forum_id'])) + { + $sql_data[POSTS_TABLE]['sql'] = array( + 'post_edit_reason' => '', + ); + } + + // If the person editing this post is different to the one having posted then we will add a log entry stating the edit + // Could be simplified by only adding to the log if the edit is not tracked - but this may confuse admins/mods + if ($user->data['user_id'] != $poster_id) + { + $log_subject = ($subject) ? $subject : $data_ary['topic_title']; + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_POST_EDITED', false, array( + 'forum_id' => $data_ary['forum_id'], + 'topic_id' => $data_ary['topic_id'], + 'post_id' => $data_ary['post_id'], + $log_subject, + (!empty($username)) ? $username : $user->lang['GUEST'], + $data_ary['post_edit_reason'] + )); + } + + if (!isset($sql_data[POSTS_TABLE]['sql'])) + { + $sql_data[POSTS_TABLE]['sql'] = array(); + } + + $sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array( + 'forum_id' => $data_ary['forum_id'], + 'poster_id' => $data_ary['poster_id'], + 'icon_id' => $data_ary['icon_id'], + // We will change the visibility later + //'post_visibility' => $post_visibility, + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], + 'post_username' => ($username && $data_ary['poster_id'] == ANONYMOUS) ? $username : '', + 'post_subject' => $subject, + 'post_checksum' => $data_ary['message_md5'], + 'post_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'], + 'post_edit_locked' => $data_ary['post_edit_locked']) + ); + + if ($update_message) + { + $sql_data[POSTS_TABLE]['sql']['post_text'] = $data_ary['message']; + } + + break; + } + + // And the topic ladies and gentlemen + switch ($post_mode) + { + case 'post': + $sql_data[TOPICS_TABLE]['sql'] = array( + 'topic_poster' => (int) $user->data['user_id'], + 'topic_time' => $current_time, + 'topic_last_view_time' => $current_time, + 'forum_id' => $data_ary['forum_id'], + 'icon_id' => $data_ary['icon_id'], + 'topic_posts_approved' => ($post_visibility == ITEM_APPROVED) ? 1 : 0, + 'topic_posts_softdeleted' => ($post_visibility == ITEM_DELETED) ? 1 : 0, + 'topic_posts_unapproved' => ($post_visibility == ITEM_UNAPPROVED) ? 1 : 0, + 'topic_visibility' => $post_visibility, + 'topic_delete_user' => ($post_visibility != ITEM_APPROVED) ? (int) $user->data['user_id'] : 0, + 'topic_title' => $subject, + 'topic_first_poster_name' => (!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : ''), + 'topic_first_poster_colour' => $user->data['user_colour'], + 'topic_type' => $topic_type, + 'topic_time_limit' => $topic_type != POST_NORMAL ? ($data_ary['topic_time_limit'] * 86400) : 0, + 'topic_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'topic_status' => (isset($data_ary['topic_status'])) ? $data_ary['topic_status'] : ITEM_UNLOCKED, + ); + + if (isset($poll_ary['poll_options']) && !empty($poll_ary['poll_options'])) + { + $poll_start = ($poll_ary['poll_start']) ? $poll_ary['poll_start'] : $current_time; + $poll_length = $poll_ary['poll_length'] * 86400; + if ($poll_length < 0) + { + $poll_start = $poll_start + $poll_length; + if ($poll_start < 0) + { + $poll_start = 0; + } + $poll_length = 1; + } + + $sql_data[TOPICS_TABLE]['sql'] = array_merge($sql_data[TOPICS_TABLE]['sql'], array( + 'poll_title' => $poll_ary['poll_title'], + 'poll_start' => $poll_start, + 'poll_max_options' => $poll_ary['poll_max_options'], + 'poll_length' => $poll_length, + 'poll_vote_change' => $poll_ary['poll_vote_change']) + ); + } + + $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data_ary['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : ''); + + if ($post_visibility == ITEM_APPROVED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_approved = forum_topics_approved + 1'; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_approved = forum_posts_approved + 1'; + } + else if ($post_visibility == ITEM_UNAPPROVED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_unapproved = forum_topics_unapproved + 1'; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_unapproved = forum_posts_unapproved + 1'; + } + else if ($post_visibility == ITEM_DELETED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics_softdeleted = forum_topics_softdeleted + 1'; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_softdeleted = forum_posts_softdeleted + 1'; + } + break; + + case 'reply': + $sql_data[TOPICS_TABLE]['stat'][] = 'topic_last_view_time = ' . $current_time . ', + topic_bumped = 0, + topic_bumper = 0' . + (($post_visibility == ITEM_APPROVED) ? ', topic_posts_approved = topic_posts_approved + 1' : '') . + (($post_visibility == ITEM_UNAPPROVED) ? ', topic_posts_unapproved = topic_posts_unapproved + 1' : '') . + (($post_visibility == ITEM_DELETED) ? ', topic_posts_softdeleted = topic_posts_softdeleted + 1' : '') . + ((!empty($data_ary['attachment_data']) || (isset($data_ary['topic_attachment']) && $data_ary['topic_attachment'])) ? ', topic_attachment = 1' : ''); + + $sql_data[USERS_TABLE]['stat'][] = "user_lastpost_time = $current_time" . (($auth->acl_get('f_postcount', $data_ary['forum_id']) && $post_visibility == ITEM_APPROVED) ? ', user_posts = user_posts + 1' : ''); + + if ($post_visibility == ITEM_APPROVED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_approved = forum_posts_approved + 1'; + } + else if ($post_visibility == ITEM_UNAPPROVED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_unapproved = forum_posts_unapproved + 1'; + } + else if ($post_visibility == ITEM_DELETED) + { + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts_softdeleted = forum_posts_softdeleted + 1'; + } + break; + + case 'edit_topic': + case 'edit_first_post': + if (isset($poll_ary['poll_options'])) + { + $poll_start = ($poll_ary['poll_start'] || empty($poll_ary['poll_options'])) ? $poll_ary['poll_start'] : $current_time; + $poll_length = $poll_ary['poll_length'] * 86400; + if ($poll_length < 0) + { + $poll_start = $poll_start + $poll_length; + if ($poll_start < 0) + { + $poll_start = 0; + } + $poll_length = 1; + } + } + + $sql_data[TOPICS_TABLE]['sql'] = array( + 'forum_id' => $data_ary['forum_id'], + 'icon_id' => $data_ary['icon_id'], + 'topic_title' => $subject, + 'topic_first_poster_name' => $username, + 'topic_type' => $topic_type, + 'topic_time_limit' => $topic_type != POST_NORMAL ? ($data_ary['topic_time_limit'] * 86400) : 0, + 'poll_title' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_title'] : '', + 'poll_start' => (isset($poll_ary['poll_options'])) ? $poll_start : 0, + 'poll_max_options' => (isset($poll_ary['poll_options'])) ? $poll_ary['poll_max_options'] : 1, + 'poll_length' => (isset($poll_ary['poll_options'])) ? $poll_length : 0, + 'poll_vote_change' => (isset($poll_ary['poll_vote_change'])) ? $poll_ary['poll_vote_change'] : 0, + 'topic_last_view_time' => $current_time, + + 'topic_attachment' => (!empty($data_ary['attachment_data'])) ? 1 : (isset($data_ary['topic_attachment']) ? $data_ary['topic_attachment'] : 0), + ); + + break; + } + + $poll = $poll_ary; + $data = $data_ary; + /** + * Modify sql query data for post submitting + * + * @event core.submit_post_modify_sql_data + * @var array data Array with the data for the post + * @var array poll Array with the poll data for the post + * @var string post_mode Variable containing posting mode value + * @var bool sql_data Array with the data for the posting SQL query + * @var string subject Variable containing post subject value + * @var int topic_type Variable containing topic type value + * @var string username Variable containing post author name + * @since 3.1.3-RC1 + */ + $vars = array( + 'data', + 'poll', + 'post_mode', + 'sql_data', + 'subject', + 'topic_type', + 'username', + ); + extract($phpbb_dispatcher->trigger_event('core.submit_post_modify_sql_data', compact($vars))); + $poll_ary = $poll; + $data_ary = $data; + unset($poll); + unset($data); + + // Submit new topic + if ($post_mode == 'post') + { + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . + $db->sql_build_array('INSERT', $sql_data[TOPICS_TABLE]['sql']); + $db->sql_query($sql); + + $data_ary['topic_id'] = $db->sql_nextid(); + + $sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array( + 'topic_id' => $data_ary['topic_id']) + ); + unset($sql_data[TOPICS_TABLE]['sql']); + } + + // Submit new post + if ($post_mode == 'post' || $post_mode == 'reply') + { + if ($post_mode == 'reply') + { + $sql_data[POSTS_TABLE]['sql'] = array_merge($sql_data[POSTS_TABLE]['sql'], array( + 'topic_id' => $data_ary['topic_id'], + )); + } + + $sql = 'INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data[POSTS_TABLE]['sql']); + $db->sql_query($sql); + $data_ary['post_id'] = $db->sql_nextid(); + + if ($post_mode == 'post' || $post_visibility == ITEM_APPROVED) + { + $sql_data[TOPICS_TABLE]['sql'] = array( + 'topic_last_post_id' => $data_ary['post_id'], + 'topic_last_post_time' => $current_time, + 'topic_last_poster_id' => $sql_data[POSTS_TABLE]['sql']['poster_id'], + 'topic_last_poster_name' => ($user->data['user_id'] == ANONYMOUS) ? $sql_data[POSTS_TABLE]['sql']['post_username'] : $user->data['username'], + 'topic_last_poster_colour' => $user->data['user_colour'], + 'topic_last_post_subject' => (string) $subject, + ); + } + + if ($post_mode == 'post') + { + $sql_data[TOPICS_TABLE]['sql']['topic_first_post_id'] = $data_ary['post_id']; + } + + // Update total post count and forum information + if ($post_visibility == ITEM_APPROVED) + { + if ($post_mode == 'post') + { + $config->increment('num_topics', 1, false); + } + $config->increment('num_posts', 1, false); + + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_id = ' . $data_ary['post_id']; + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'"; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_post_time = ' . $current_time; + $sql_data[FORUMS_TABLE]['stat'][] = 'forum_last_poster_id = ' . (int) $user->data['user_id']; + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape((!$user->data['is_registered'] && $username) ? $username : (($user->data['user_id'] != ANONYMOUS) ? $user->data['username'] : '')) . "'"; + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_colour = '" . $db->sql_escape($user->data['user_colour']) . "'"; + } + + unset($sql_data[POSTS_TABLE]['sql']); + } + + // Update the topics table + if (isset($sql_data[TOPICS_TABLE]['sql'])) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_data[TOPICS_TABLE]['sql']) . ' + WHERE topic_id = ' . $data_ary['topic_id']; + $db->sql_query($sql); + + unset($sql_data[TOPICS_TABLE]['sql']); + } + + // Update the posts table + if (isset($sql_data[POSTS_TABLE]['sql'])) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_data[POSTS_TABLE]['sql']) . ' + WHERE post_id = ' . $data_ary['post_id']; + $db->sql_query($sql); + + unset($sql_data[POSTS_TABLE]['sql']); + } + + // Update Poll Tables + if (isset($poll_ary['poll_options'])) + { + $cur_poll_options = array(); + + if ($mode == 'edit') + { + $sql = 'SELECT * + FROM ' . POLL_OPTIONS_TABLE . ' + WHERE topic_id = ' . $data_ary['topic_id'] . ' + ORDER BY poll_option_id'; + $result = $db->sql_query($sql); + + $cur_poll_options = array(); + while ($row = $db->sql_fetchrow($result)) + { + $cur_poll_options[] = $row; + } + $db->sql_freeresult($result); + } + + $sql_insert_ary = array(); + + for ($i = 0, $size = count($poll_ary['poll_options']); $i < $size; $i++) + { + if (strlen(trim($poll_ary['poll_options'][$i]))) + { + if (empty($cur_poll_options[$i])) + { + // If we add options we need to put them to the end to be able to preserve votes... + $sql_insert_ary[] = array( + 'poll_option_id' => (int) count($cur_poll_options) + 1 + count($sql_insert_ary), + 'topic_id' => (int) $data_ary['topic_id'], + 'poll_option_text' => (string) $poll_ary['poll_options'][$i] + ); + } + else if ($poll_ary['poll_options'][$i] != $cur_poll_options[$i]) + { + $sql = 'UPDATE ' . POLL_OPTIONS_TABLE . " + SET poll_option_text = '" . $db->sql_escape($poll_ary['poll_options'][$i]) . "' + WHERE poll_option_id = " . $cur_poll_options[$i]['poll_option_id'] . ' + AND topic_id = ' . $data_ary['topic_id']; + $db->sql_query($sql); + } + } + } + + $db->sql_multi_insert(POLL_OPTIONS_TABLE, $sql_insert_ary); + + if (count($poll_ary['poll_options']) < count($cur_poll_options)) + { + $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . ' + WHERE poll_option_id > ' . count($poll_ary['poll_options']) . ' + AND topic_id = ' . $data_ary['topic_id']; + $db->sql_query($sql); + } + + // If edited, we would need to reset votes (since options can be re-ordered above, you can't be sure if the change is for changing the text or adding an option + if ($mode == 'edit' && count($poll_ary['poll_options']) != count($cur_poll_options)) + { + $db->sql_query('DELETE FROM ' . POLL_VOTES_TABLE . ' WHERE topic_id = ' . $data_ary['topic_id']); + $db->sql_query('UPDATE ' . POLL_OPTIONS_TABLE . ' SET poll_option_total = 0 WHERE topic_id = ' . $data_ary['topic_id']); + } + } + + // Submit Attachments + if (!empty($data_ary['attachment_data']) && $data_ary['post_id'] && in_array($mode, array('post', 'reply', 'quote', 'edit'))) + { + $space_taken = $files_added = 0; + $orphan_rows = array(); + + foreach ($data_ary['attachment_data'] as $pos => $attach_row) + { + $orphan_rows[(int) $attach_row['attach_id']] = array(); + } + + if (count($orphan_rows)) + { + $sql = 'SELECT attach_id, filesize, physical_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan_rows)) . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + $orphan_rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $orphan_rows[$row['attach_id']] = $row; + } + $db->sql_freeresult($result); + } + + foreach ($data_ary['attachment_data'] as $pos => $attach_row) + { + if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']])) + { + continue; + } + + if (!$attach_row['is_orphan']) + { + // update entry in db if attachment already stored in db and filespace + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " + SET attach_comment = '" . $db->sql_escape($attach_row['attach_comment']) . "' + WHERE attach_id = " . (int) $attach_row['attach_id'] . ' + AND is_orphan = 0'; + $db->sql_query($sql); + } + else + { + // insert attachment into db + if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + { + continue; + } + + $space_taken += $orphan_rows[$attach_row['attach_id']]['filesize']; + $files_added++; + + $attach_sql = array( + 'post_msg_id' => $data_ary['post_id'], + 'topic_id' => $data_ary['topic_id'], + 'is_orphan' => 0, + 'poster_id' => $poster_id, + 'attach_comment' => $attach_row['attach_comment'], + ); + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . ' + WHERE attach_id = ' . $attach_row['attach_id'] . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $db->sql_query($sql); + } + } + + if ($space_taken && $files_added) + { + $config->increment('upload_dir_size', $space_taken, false); + $config->increment('num_files', $files_added, false); + } + } + + $first_post_has_topic_info = ($post_mode == 'edit_first_post' && + (($post_visibility == ITEM_DELETED && $data_ary['topic_posts_softdeleted'] == 1) || + ($post_visibility == ITEM_UNAPPROVED && $data_ary['topic_posts_unapproved'] == 1) || + ($post_visibility == ITEM_REAPPROVE && $data_ary['topic_posts_unapproved'] == 1) || + ($post_visibility == ITEM_APPROVED && $data_ary['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_ary['post_visibility'] != $post_visibility) + { + // If the post was not approved, it could also be the starter, + // so we sync the starter after approving/restoring, to ensure that the stats are correct + // Same applies for the last post + $is_starter = ($post_mode == 'edit_first_post' || $post_mode == 'edit_topic' || $data_ary['post_visibility'] != ITEM_APPROVED); + $is_latest = ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $data_ary['post_visibility'] != ITEM_APPROVED); + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + $phpbb_content_visibility->set_post_visibility($post_visibility, $data_ary['post_id'], $data_ary['topic_id'], $data_ary['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest); + } + else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $first_post_has_topic_info) + { + if ($post_visibility == ITEM_APPROVED || $data_ary['topic_visibility'] == $post_visibility) + { + // only the subject can be changed from edit + $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_post_subject = '" . $db->sql_escape($subject) . "'"; + + // Maybe not only the subject, but also changing anonymous usernames. ;) + if ($data_ary['poster_id'] == ANONYMOUS) + { + $sql_data[TOPICS_TABLE]['stat'][] = "topic_last_poster_name = '" . $db->sql_escape($username) . "'"; + } + + if ($post_visibility == ITEM_APPROVED) + { + // this does not _necessarily_ mean that we must update the info again, + // it just means that we might have to + $sql = 'SELECT forum_last_post_id, forum_last_post_subject + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . (int) $data_ary['forum_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // this post is the latest post in the forum, better update + if ($row['forum_last_post_id'] == $data_ary['post_id'] && ($row['forum_last_post_subject'] !== $subject || $data_ary['poster_id'] == ANONYMOUS)) + { + // the post's subject changed + if ($row['forum_last_post_subject'] !== $subject) + { + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_post_subject = '" . $db->sql_escape($subject) . "'"; + } + + // Update the user name if poster is anonymous... just in case a moderator changed it + if ($data_ary['poster_id'] == ANONYMOUS) + { + $sql_data[FORUMS_TABLE]['stat'][] = "forum_last_poster_name = '" . $db->sql_escape($username) . "'"; + } + } + } + } + } + + // Update forum stats + $where_sql = array( + POSTS_TABLE => 'post_id = ' . $data_ary['post_id'], + TOPICS_TABLE => 'topic_id = ' . $data_ary['topic_id'], + FORUMS_TABLE => 'forum_id = ' . $data_ary['forum_id'], + USERS_TABLE => 'user_id = ' . $poster_id + ); + + foreach ($sql_data as $table => $update_ary) + { + if (isset($update_ary['stat']) && implode('', $update_ary['stat'])) + { + $sql = "UPDATE $table SET " . implode(', ', $update_ary['stat']) . ' WHERE ' . $where_sql[$table]; + $db->sql_query($sql); + } + } + + // Delete topic shadows (if any exist). We do not need a shadow topic for an global announcement + if ($topic_type == POST_GLOBAL) + { + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE topic_moved_id = ' . $data_ary['topic_id']; + $db->sql_query($sql); + } + + // Committing the transaction before updating search index + $db->sql_transaction('commit'); + + // Delete draft if post was loaded... + $draft_id = $request->variable('draft_loaded', 0); + if ($draft_id) + { + $sql = 'DELETE FROM ' . DRAFTS_TABLE . " + WHERE draft_id = $draft_id + AND user_id = {$user->data['user_id']}"; + $db->sql_query($sql); + } + + // Index message contents + if ($update_search_index && $data_ary['enable_indexing']) + { + // Select the search method and do some additional checks to ensure it can actually be utilised + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if ($error) + { + trigger_error($error); + } + + $search->index($mode, $data_ary['post_id'], $data_ary['message'], $subject, $poster_id, $data_ary['forum_id']); + } + + // Topic Notification, do not change if moderator is changing other users posts... + if ($user->data['user_id'] == $poster_id) + { + if (!$data_ary['notify_set'] && $data_ary['notify']) + { + $sql = 'INSERT INTO ' . TOPICS_WATCH_TABLE . ' (user_id, topic_id) + VALUES (' . $user->data['user_id'] . ', ' . $data_ary['topic_id'] . ')'; + $db->sql_query($sql); + } + else if (($config['email_enable'] || $config['jab_enable']) && $data_ary['notify_set'] && !$data_ary['notify']) + { + $sql = 'DELETE FROM ' . TOPICS_WATCH_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . ' + AND topic_id = ' . $data_ary['topic_id']; + $db->sql_query($sql); + } + } + + if ($mode == 'post' || $mode == 'reply' || $mode == 'quote') + { + // Mark this topic as posted to + markread('post', $data_ary['forum_id'], $data_ary['topic_id']); + } + + // Mark this topic as read + // We do not use post_time here, this is intended (post_time can have a date in the past if editing a message) + markread('topic', $data_ary['forum_id'], $data_ary['topic_id'], time()); + + // + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $sql = 'SELECT mark_time + FROM ' . FORUMS_TRACK_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . ' + AND forum_id = ' . $data_ary['forum_id']; + $result = $db->sql_query($sql); + $f_mark_time = (int) $db->sql_fetchfield('mark_time'); + $db->sql_freeresult($result); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $f_mark_time = false; + } + + if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered']) + { + // Update forum info + $sql = 'SELECT forum_last_post_time + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $data_ary['forum_id']; + $result = $db->sql_query($sql); + $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time'); + $db->sql_freeresult($result); + + update_forum_tracking_info($data_ary['forum_id'], $forum_last_post_time, $f_mark_time, false); + } + + // If a username was supplied or the poster is a guest, we will use the supplied username. + // Doing it this way we can use "...post by guest-username..." in notifications when + // "guest-username" is supplied or ommit the username if it is not. + $username = ($username !== '' || !$user->data['is_registered']) ? $username : $user->data['username']; + + // Send Notifications + $notification_data = array_merge($data_ary, array( + 'topic_title' => (isset($data_ary['topic_title'])) ? $data_ary['topic_title'] : $subject, + 'post_username' => $username, + 'poster_id' => $poster_id, + 'post_text' => $data_ary['message'], + 'post_time' => $current_time, + 'post_subject' => $subject, + )); + + /** + * This event allows you to modify the notification data upon submission + * + * @event core.modify_submit_notification_data + * @var array notification_data The notification data to be inserted in to the database + * @var array data_ary The data array with a lot of the post submission data + * @var string mode The posting mode + * @var int poster_id The poster id + * @since 3.2.4-RC1 + */ + $vars = array('notification_data', 'data_ary', 'mode', 'poster_id'); + extract($phpbb_dispatcher->trigger_event('core.modify_submit_notification_data', compact($vars))); + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + if ($post_visibility == ITEM_APPROVED) + { + switch ($mode) + { + case 'post': + $phpbb_notifications->add_notifications(array( + 'notification.type.quote', + 'notification.type.topic', + ), $notification_data); + break; + + case 'reply': + case 'quote': + $phpbb_notifications->add_notifications(array( + 'notification.type.quote', + 'notification.type.bookmark', + 'notification.type.post', + ), $notification_data); + break; + + case 'edit_topic': + case 'edit_first_post': + case 'edit': + case 'edit_last_post': + if ($user->data['user_id'] == $poster_id) + { + $phpbb_notifications->update_notifications(array( + 'notification.type.quote', + ), $notification_data); + } + + $phpbb_notifications->update_notifications(array( + 'notification.type.bookmark', + 'notification.type.topic', + 'notification.type.post', + ), $notification_data); + break; + } + } + else if ($post_visibility == ITEM_UNAPPROVED) + { + switch ($mode) + { + case 'post': + $phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data); + break; + + case 'reply': + case 'quote': + $phpbb_notifications->add_notifications('notification.type.post_in_queue', $notification_data); + break; + + case 'edit_topic': + case 'edit_first_post': + case 'edit': + case 'edit_last_post': + // Nothing to do here + break; + } + } + else if ($post_visibility == ITEM_REAPPROVE) + { + switch ($mode) + { + case 'edit_topic': + case 'edit_first_post': + $phpbb_notifications->add_notifications('notification.type.topic_in_queue', $notification_data); + + // Delete the approve_post notification so we can notify the user again, + // when his post got reapproved + $phpbb_notifications->delete_notifications('notification.type.approve_post', $notification_data['post_id']); + break; + + case 'edit': + case 'edit_last_post': + $phpbb_notifications->add_notifications('notification.type.post_in_queue', $notification_data); + + // Delete the approve_post notification so we can notify the user again, + // when his post got reapproved + $phpbb_notifications->delete_notifications('notification.type.approve_post', $notification_data['post_id']); + break; + + case 'post': + case 'reply': + case 'quote': + // Nothing to do here + break; + } + } + else if ($post_visibility == ITEM_DELETED) + { + switch ($mode) + { + case 'post': + case 'reply': + case 'quote': + case 'edit_topic': + case 'edit_first_post': + case 'edit': + case 'edit_last_post': + // Nothing to do here + break; + } + } + + $params = $add_anchor = ''; + + if ($post_visibility == ITEM_APPROVED || + ($auth->acl_get('m_softdelete', $data_ary['forum_id']) && $post_visibility == ITEM_DELETED) || + ($auth->acl_get('m_approve', $data_ary['forum_id']) && in_array($post_visibility, array(ITEM_UNAPPROVED, ITEM_REAPPROVE)))) + { + $params .= '&t=' . $data_ary['topic_id']; + + if ($mode != 'post') + { + $params .= '&p=' . $data_ary['post_id']; + $add_anchor = '#p' . $data_ary['post_id']; + } + } + else if ($mode != 'post' && $post_mode != 'edit_first_post' && $post_mode != 'edit_topic') + { + $params .= '&t=' . $data_ary['topic_id']; + } + + $url = (!$params) ? "{$phpbb_root_path}viewforum.$phpEx" : "{$phpbb_root_path}viewtopic.$phpEx"; + $url = append_sid($url, 'f=' . $data_ary['forum_id'] . $params) . $add_anchor; + + $poll = $poll_ary; + $data = $data_ary; + /** + * This event is used for performing actions directly after a post or topic + * has been submitted. When a new topic is posted, the topic ID is + * available in the $data array. + * + * The only action that can be done by altering data made available to this + * event is to modify the return URL ($url). + * + * @event core.submit_post_end + * @var string mode Variable containing posting mode value + * @var string subject Variable containing post subject value + * @var string username Variable containing post author name + * @var int topic_type Variable containing topic type value + * @var array poll Array with the poll data for the post + * @var array data Array with the data for the post + * @var int post_visibility Variable containing up to date post visibility + * @var bool update_message Flag indicating if the post will be updated + * @var bool update_search_index Flag indicating if the search index will be updated + * @var string url The "Return to topic" URL + * + * @since 3.1.0-a3 + * @changed 3.1.0-RC3 Added vars mode, subject, username, topic_type, + * poll, update_message, update_search_index + */ + $vars = array( + 'mode', + 'subject', + 'username', + 'topic_type', + 'poll', + 'data', + 'post_visibility', + 'update_message', + 'update_search_index', + 'url', + ); + extract($phpbb_dispatcher->trigger_event('core.submit_post_end', compact($vars))); + $data_ary = $data; + $poll_ary = $poll; + unset($data); + unset($poll); + + return $url; +} + +/** +* Handle topic bumping +* @param int $forum_id The ID of the forum the topic is being bumped belongs to +* @param int $topic_id The ID of the topic is being bumping +* @param array $post_data Passes some topic parameters: +* - 'topic_title' +* - 'topic_last_post_id' +* - 'topic_last_poster_id' +* - 'topic_last_post_subject' +* - 'topic_last_poster_name' +* - 'topic_last_poster_colour' +* @param int $bump_time The time at which topic was bumped, usually it is a current time as obtained via time(). +* @return string An URL to the bumped topic, example: ./viewtopic.php?forum_id=1&topic_id=2&p=3#p3 +*/ +function phpbb_bump_topic($forum_id, $topic_id, $post_data, $bump_time = false) +{ + global $config, $db, $user, $phpEx, $phpbb_root_path, $phpbb_log; + + if ($bump_time === false) + { + $bump_time = time(); + } + + // Begin bumping + $db->sql_transaction('begin'); + + // Update the topic's last post post_time + $sql = 'UPDATE ' . POSTS_TABLE . " + SET post_time = $bump_time + WHERE post_id = {$post_data['topic_last_post_id']} + AND topic_id = $topic_id"; + $db->sql_query($sql); + + // Sync the topic's last post time, the rest of the topic's last post data isn't changed + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_last_post_time = $bump_time, + topic_bumped = 1, + topic_bumper = " . $user->data['user_id'] . " + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + + // Update the forum's last post info + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET forum_last_post_id = " . $post_data['topic_last_post_id'] . ", + forum_last_poster_id = " . $post_data['topic_last_poster_id'] . ", + forum_last_post_subject = '" . $db->sql_escape($post_data['topic_last_post_subject']) . "', + forum_last_post_time = $bump_time, + forum_last_poster_name = '" . $db->sql_escape($post_data['topic_last_poster_name']) . "', + forum_last_poster_colour = '" . $db->sql_escape($post_data['topic_last_poster_colour']) . "' + WHERE forum_id = $forum_id"; + $db->sql_query($sql); + + // Update bumper's time of the last posting to prevent flood + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastpost_time = $bump_time + WHERE user_id = " . $user->data['user_id']; + $db->sql_query($sql); + + $db->sql_transaction('commit'); + + // Mark this topic as posted to + markread('post', $forum_id, $topic_id, $bump_time); + + // Mark this topic as read + markread('topic', $forum_id, $topic_id, $bump_time); + + // Update forum tracking info + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $sql = 'SELECT mark_time + FROM ' . FORUMS_TRACK_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . ' + AND forum_id = ' . $forum_id; + $result = $db->sql_query($sql); + $f_mark_time = (int) $db->sql_fetchfield('mark_time'); + $db->sql_freeresult($result); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $f_mark_time = false; + } + + if (($config['load_db_lastread'] && $user->data['is_registered']) || $config['load_anon_lastread'] || $user->data['is_registered']) + { + // Update forum info + $sql = 'SELECT forum_last_post_time + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_id; + $result = $db->sql_query($sql); + $forum_last_post_time = (int) $db->sql_fetchfield('forum_last_post_time'); + $db->sql_freeresult($result); + + update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time, false); + } + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_BUMP_TOPIC', false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $post_data['topic_title'] + )); + + $url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p={$post_data['topic_last_post_id']}") . "#p{$post_data['topic_last_post_id']}"; + + return $url; +} + +/** +* Show upload popup (progress bar) +*/ +function phpbb_upload_popup($forum_style = 0) +{ + global $template, $user; + + ($forum_style) ? $user->setup('posting', $forum_style) : $user->setup('posting'); + + page_header($user->lang['PROGRESS_BAR']); + + $template->set_filenames(array( + 'popup' => 'posting_progress_bar.html') + ); + + $template->assign_vars(array( + 'PROGRESS_BAR' => $user->img('upload_bar', $user->lang['UPLOAD_IN_PROGRESS'])) + ); + + $template->display('popup'); + + garbage_collection(); + exit_handler(); +} + +/** +* Do the various checks required for removing posts as well as removing it +* +* @param int $forum_id The id of the forum +* @param int $topic_id The id of the topic +* @param int $post_id The id of the post +* @param array $post_data Array with the post data +* @param bool $is_soft The flag indicating whether it is the soft delete mode +* @param string $delete_reason Description for the post deletion reason +* +* @return null +*/ +function phpbb_handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft = false, $delete_reason = '') +{ + global $user, $auth, $config, $request; + global $phpbb_root_path, $phpEx, $phpbb_log, $phpbb_dispatcher; + + $force_delete_allowed = $force_softdelete_allowed = false; + $perm_check = ($is_soft) ? 'softdelete' : 'delete'; + + /** + * This event allows to modify the conditions for the post deletion + * + * @event core.handle_post_delete_conditions + * @var int forum_id The id of the forum + * @var int topic_id The id of the topic + * @var int post_id The id of the post + * @var array post_data Array with the post data + * @var bool is_soft The flag indicating whether it is the soft delete mode + * @var string delete_reason Description for the post deletion reason + * @var bool force_delete_allowed Allow the user to delete the post (all permissions and conditions are ignored) + * @var bool force_softdelete_allowed Allow the user to softdelete the post (all permissions and conditions are ignored) + * @var string perm_check The deletion mode softdelete|delete + * @since 3.1.11-RC1 + */ + $vars = array( + 'forum_id', + 'topic_id', + 'post_id', + 'post_data', + 'is_soft', + 'delete_reason', + 'force_delete_allowed', + 'force_softdelete_allowed', + 'perm_check', + ); + extract($phpbb_dispatcher->trigger_event('core.handle_post_delete_conditions', compact($vars))); + + // If moderator removing post or user itself removing post, present a confirmation screen + if ($force_delete_allowed || ($is_soft && $force_softdelete_allowed) || $auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']))) + { + $s_hidden_fields = array( + 'p' => $post_id, + 'f' => $forum_id, + 'mode' => ($is_soft) ? 'soft_delete' : 'delete', + ); + + if (confirm_box(true)) + { + $data = array( + 'topic_first_post_id' => $post_data['topic_first_post_id'], + 'topic_last_post_id' => $post_data['topic_last_post_id'], + 'topic_posts_approved' => $post_data['topic_posts_approved'], + 'topic_posts_unapproved' => $post_data['topic_posts_unapproved'], + 'topic_posts_softdeleted' => $post_data['topic_posts_softdeleted'], + 'topic_visibility' => $post_data['topic_visibility'], + 'topic_type' => $post_data['topic_type'], + 'post_visibility' => $post_data['post_visibility'], + 'post_reported' => $post_data['post_reported'], + 'post_time' => $post_data['post_time'], + 'poster_id' => $post_data['poster_id'], + 'post_postcount' => $post_data['post_postcount'], + ); + + $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft, $delete_reason); + $post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username']; + + if ($next_post_id === false) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, (($is_soft) ? 'LOG_SOFTDELETE_TOPIC' : 'LOG_DELETE_TOPIC'), false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $post_data['topic_title'], + $post_username, + $delete_reason + )); + + $meta_info = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"); + $message = $user->lang['POST_DELETED']; + } + else + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, (($is_soft) ? 'LOG_SOFTDELETE_POST' : 'LOG_DELETE_POST'), false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + 'post_id' => $post_id, + $post_data['post_subject'], + $post_username, + $delete_reason + )); + + $meta_info = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&p=$next_post_id") . "#p$next_post_id"; + $message = $user->lang['POST_DELETED']; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); + } + } + + meta_refresh(3, $meta_info); + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_FORUM', '', ''); + } + trigger_error($message); + } + else + { + global $template; + + $can_delete = $force_delete_allowed || ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id))); + $can_softdelete = $force_softdelete_allowed || ($auth->acl_get('m_softdelete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_softdelete', $forum_id))); + + $template->assign_vars(array( + 'S_SOFTDELETED' => $post_data['post_visibility'] == ITEM_DELETED, + 'S_CHECKED_PERMANENT' => $request->is_set_post('delete_permanent') ? ' checked="checked"' : '', + 'S_ALLOWED_DELETE' => $can_delete, + 'S_ALLOWED_SOFTDELETE' => $can_softdelete, + )); + + $l_confirm = 'DELETE_POST'; + if ($post_data['post_visibility'] == ITEM_DELETED) + { + $l_confirm .= '_PERMANENTLY'; + $s_hidden_fields['delete_permanent'] = '1'; + } + else if (!$can_softdelete) + { + $s_hidden_fields['delete_permanent'] = '1'; + } + + confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html'); + } + } + + // If we are here the user is not able to delete - present the correct error message + if ($post_data['poster_id'] != $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) + { + trigger_error('DELETE_OWN_POSTS'); + } + + if ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && $post_id != $post_data['topic_last_post_id']) + { + trigger_error('CANNOT_DELETE_REPLIED'); + } + + trigger_error('USER_CANNOT_DELETE'); +} diff --git a/install/update/old/includes/functions_privmsgs.php b/install/update/old/includes/functions_privmsgs.php new file mode 100644 index 0000000..444bf2c --- /dev/null +++ b/install/update/old/includes/functions_privmsgs.php @@ -0,0 +1,2264 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/* + Ability to simply add own rules by doing three things: + 1) Add an appropriate constant + 2) Add a new check array to the global_privmsgs_rules variable and the condition array (if one is required) + 3) Implement the rule logic in the check_rule() function + 4) Add a new language variable to ucp.php + + The user is then able to select the new rule. It will be checked against and handled as specified. + To add new actions (yes, checks can be added here too) to the rule management, the core code has to be modified. +*/ + +define('RULE_IS_LIKE', 1); // Is Like +define('RULE_IS_NOT_LIKE', 2); // Is Not Like +define('RULE_IS', 3); // Is +define('RULE_IS_NOT', 4); // Is Not +define('RULE_BEGINS_WITH', 5); // Begins with +define('RULE_ENDS_WITH', 6); // Ends with +define('RULE_IS_FRIEND', 7); // Is Friend +define('RULE_IS_FOE', 8); // Is Foe +define('RULE_IS_USER', 9); // Is User +define('RULE_IS_GROUP', 10); // Is In Usergroup +define('RULE_ANSWERED', 11); // Answered +define('RULE_FORWARDED', 12); // Forwarded +define('RULE_TO_GROUP', 14); // Usergroup +define('RULE_TO_ME', 15); // Me + +define('ACTION_PLACE_INTO_FOLDER', 1); +define('ACTION_MARK_AS_READ', 2); +define('ACTION_MARK_AS_IMPORTANT', 3); +define('ACTION_DELETE_MESSAGE', 4); + +define('CHECK_SUBJECT', 1); +define('CHECK_SENDER', 2); +define('CHECK_MESSAGE', 3); +define('CHECK_STATUS', 4); +define('CHECK_TO', 5); + +/** +* Global private message rules +* These rules define what to do if a rule is hit +*/ +$global_privmsgs_rules = array( + CHECK_SUBJECT => array( + RULE_IS_LIKE => array('check0' => 'message_subject'), + RULE_IS_NOT_LIKE => array('check0' => 'message_subject'), + RULE_IS => array('check0' => 'message_subject'), + RULE_IS_NOT => array('check0' => 'message_subject'), + RULE_BEGINS_WITH => array('check0' => 'message_subject'), + RULE_ENDS_WITH => array('check0' => 'message_subject'), + ), + + CHECK_SENDER => array( + RULE_IS_LIKE => array('check0' => 'username'), + RULE_IS_NOT_LIKE => array('check0' => 'username'), + RULE_IS => array('check0' => 'username'), + RULE_IS_NOT => array('check0' => 'username'), + RULE_BEGINS_WITH => array('check0' => 'username'), + RULE_ENDS_WITH => array('check0' => 'username'), + RULE_IS_FRIEND => array('check0' => 'friend'), + RULE_IS_FOE => array('check0' => 'foe'), + RULE_IS_USER => array('check0' => 'author_id'), + RULE_IS_GROUP => array('check0' => 'author_in_group'), + ), + + CHECK_MESSAGE => array( + RULE_IS_LIKE => array('check0' => 'message_text'), + RULE_IS_NOT_LIKE => array('check0' => 'message_text'), + RULE_IS => array('check0' => 'message_text'), + RULE_IS_NOT => array('check0' => 'message_text'), + ), + + CHECK_STATUS => array( + RULE_ANSWERED => array('check0' => 'pm_replied'), + RULE_FORWARDED => array('check0' => 'pm_forwarded'), + ), + + CHECK_TO => array( + RULE_TO_GROUP => array('check0' => 'to', 'check1' => 'bcc', 'check2' => 'user_in_group'), + RULE_TO_ME => array('check0' => 'to', 'check1' => 'bcc'), + ) +); + +/** +* This is for defining which condition fields to show for which Rule +*/ +$global_rule_conditions = array( + RULE_IS_LIKE => 'text', + RULE_IS_NOT_LIKE => 'text', + RULE_IS => 'text', + RULE_IS_NOT => 'text', + RULE_BEGINS_WITH => 'text', + RULE_ENDS_WITH => 'text', + RULE_IS_USER => 'user', + RULE_IS_GROUP => 'group' +); + +/** +* Get all folder +*/ +function get_folder($user_id, $folder_id = false) +{ + global $db, $user, $template; + global $phpbb_root_path, $phpEx; + + $folder = array(); + + // Get folder information + $sql = 'SELECT folder_id, COUNT(msg_id) as num_messages, SUM(pm_unread) as num_unread + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id <> " . PRIVMSGS_NO_BOX . ' + GROUP BY folder_id'; + $result = $db->sql_query($sql); + + $num_messages = $num_unread = array(); + while ($row = $db->sql_fetchrow($result)) + { + $num_messages[(int) $row['folder_id']] = $row['num_messages']; + $num_unread[(int) $row['folder_id']] = $row['num_unread']; + } + $db->sql_freeresult($result); + + // Make sure the default boxes are defined + $available_folder = array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX); + + foreach ($available_folder as $default_folder) + { + if (!isset($num_messages[$default_folder])) + { + $num_messages[$default_folder] = 0; + } + + if (!isset($num_unread[$default_folder])) + { + $num_unread[$default_folder] = 0; + } + } + + // Adjust unread status for outbox + $num_unread[PRIVMSGS_OUTBOX] = $num_messages[PRIVMSGS_OUTBOX]; + + $folder[PRIVMSGS_INBOX] = array( + 'folder_name' => $user->lang['PM_INBOX'], + 'num_messages' => $num_messages[PRIVMSGS_INBOX], + 'unread_messages' => $num_unread[PRIVMSGS_INBOX] + ); + + // Custom Folder + $sql = 'SELECT folder_id, folder_name, pm_count + FROM ' . PRIVMSGS_FOLDER_TABLE . " + WHERE user_id = $user_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $folder[$row['folder_id']] = array( + 'folder_name' => $row['folder_name'], + 'num_messages' => $row['pm_count'], + 'unread_messages' => ((isset($num_unread[$row['folder_id']])) ? $num_unread[$row['folder_id']] : 0) + ); + } + $db->sql_freeresult($result); + + $folder[PRIVMSGS_OUTBOX] = array( + 'folder_name' => $user->lang['PM_OUTBOX'], + 'num_messages' => $num_messages[PRIVMSGS_OUTBOX], + 'unread_messages' => $num_unread[PRIVMSGS_OUTBOX] + ); + + $folder[PRIVMSGS_SENTBOX] = array( + 'folder_name' => $user->lang['PM_SENTBOX'], + 'num_messages' => $num_messages[PRIVMSGS_SENTBOX], + 'unread_messages' => $num_unread[PRIVMSGS_SENTBOX] + ); + + // Define Folder Array for template designers (and for making custom folders usable by the template too) + foreach ($folder as $f_id => $folder_ary) + { + $folder_id_name = ($f_id == PRIVMSGS_INBOX) ? 'inbox' : (($f_id == PRIVMSGS_OUTBOX) ? 'outbox' : 'sentbox'); + + $template->assign_block_vars('folder', array( + 'FOLDER_ID' => $f_id, + 'FOLDER_NAME' => $folder_ary['folder_name'], + 'NUM_MESSAGES' => $folder_ary['num_messages'], + 'UNREAD_MESSAGES' => $folder_ary['unread_messages'], + + 'U_FOLDER' => ($f_id > 0) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $f_id) : append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $folder_id_name), + + 'S_CUR_FOLDER' => ($f_id === $folder_id) ? true : false, + 'S_UNREAD_MESSAGES' => ($folder_ary['unread_messages']) ? true : false, + 'S_CUSTOM_FOLDER' => ($f_id > 0) ? true : false) + ); + } + + if ($folder_id !== false && $folder_id !== PRIVMSGS_HOLD_BOX && !isset($folder[$folder_id])) + { + trigger_error('UNKNOWN_FOLDER'); + } + + return $folder; +} + +/** +* Delete Messages From Sentbox +* we are doing this here because this saves us a bunch of checks and queries +*/ +function clean_sentbox($num_sentbox_messages) +{ + global $db, $user; + + // Check Message Limit + if ($user->data['message_limit'] && $num_sentbox_messages > $user->data['message_limit']) + { + // Delete old messages + $sql = 'SELECT t.msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p + WHERE t.msg_id = p.msg_id + AND t.user_id = ' . $user->data['user_id'] . ' + AND t.folder_id = ' . PRIVMSGS_SENTBOX . ' + ORDER BY p.message_time ASC'; + $result = $db->sql_query_limit($sql, ($num_sentbox_messages - $user->data['message_limit'])); + + $delete_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $delete_ids[] = $row['msg_id']; + } + $db->sql_freeresult($result); + delete_pm($user->data['user_id'], $delete_ids, PRIVMSGS_SENTBOX); + } +} + +/** +* Check Rule against Message Information +*/ +function check_rule(&$rules, &$rule_row, &$message_row, $user_id) +{ + if (!isset($rules[$rule_row['rule_check']][$rule_row['rule_connection']])) + { + return false; + } + + $check_ary = $rules[$rule_row['rule_check']][$rule_row['rule_connection']]; + + $result = false; + + $check0 = $message_row[$check_ary['check0']]; + + switch ($rule_row['rule_connection']) + { + case RULE_IS_LIKE: + $result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); + break; + + case RULE_IS_NOT_LIKE: + $result = !preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); + break; + + case RULE_IS: + $result = ($check0 == $rule_row['rule_string']); + break; + + case RULE_IS_NOT: + $result = ($check0 != $rule_row['rule_string']); + break; + + case RULE_BEGINS_WITH: + $result = preg_match("/^" . preg_quote($rule_row['rule_string'], '/') . '/i', $check0); + break; + + case RULE_ENDS_WITH: + $result = preg_match("/" . preg_quote($rule_row['rule_string'], '/') . '$/i', $check0); + break; + + case RULE_IS_FRIEND: + case RULE_IS_FOE: + case RULE_ANSWERED: + case RULE_FORWARDED: + $result = ($check0 == 1); + break; + + case RULE_IS_USER: + $result = ($check0 == $rule_row['rule_user_id']); + break; + + case RULE_IS_GROUP: + $result = in_array($rule_row['rule_group_id'], $check0); + break; + + case RULE_TO_GROUP: + $result = (in_array('g_' . $message_row[$check_ary['check2']], $check0) || in_array('g_' . $message_row[$check_ary['check2']], $message_row[$check_ary['check1']])); + break; + + case RULE_TO_ME: + $result = (in_array('u_' . $user_id, $check0) || in_array('u_' . $user_id, $message_row[$check_ary['check1']])); + break; + } + + if (!$result) + { + return false; + } + + switch ($rule_row['rule_action']) + { + case ACTION_PLACE_INTO_FOLDER: + return array('action' => $rule_row['rule_action'], 'folder_id' => $rule_row['rule_folder_id']); + break; + + case ACTION_MARK_AS_READ: + case ACTION_MARK_AS_IMPORTANT: + return array('action' => $rule_row['rule_action'], 'pm_unread' => $message_row['pm_unread'], 'pm_marked' => $message_row['pm_marked']); + break; + + case ACTION_DELETE_MESSAGE: + global $db; + + // Check for admins/mods - users are not allowed to remove those messages... + // We do the check here to make sure the data we use is consistent + $sql = 'SELECT user_id, user_type, user_permissions + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $message_row['author_id']; + $result = $db->sql_query($sql); + $userdata = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $auth2 = new \phpbb\auth\auth(); + $auth2->acl($userdata); + + if (!$auth2->acl_get('a_') && !$auth2->acl_get('m_') && !$auth2->acl_getf_global('m_')) + { + return array('action' => $rule_row['rule_action'], 'pm_unread' => $message_row['pm_unread'], 'pm_marked' => $message_row['pm_marked']); + } + + return false; + break; + + default: + return false; + } + + return false; +} + +/** +* Update user PM count +*/ +function update_pm_counts() +{ + global $user, $db; + + // Update unread count + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE pm_unread = 1 + AND folder_id <> ' . PRIVMSGS_OUTBOX . ' + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $user->data['user_unread_privmsg'] = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + + // Update new pm count + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE pm_new = 1 + AND folder_id IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $user->data['user_new_privmsg'] = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + + $db->sql_query('UPDATE ' . USERS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', array( + 'user_unread_privmsg' => (int) $user->data['user_unread_privmsg'], + 'user_new_privmsg' => (int) $user->data['user_new_privmsg'], + )) . ' WHERE user_id = ' . $user->data['user_id']); + + // Ok, here we need to repair something, other boxes than privmsgs_no_box and privmsgs_hold_box should not carry the pm_new flag. + if (!$user->data['user_new_privmsg']) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_new = 0 + WHERE pm_new = 1 + AND folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + } +} + +/** +* Place new messages into appropriate folder +*/ +function place_pm_into_folder(&$global_privmsgs_rules, $release = false) +{ + global $db, $user, $config; + + if (!$user->data['user_new_privmsg']) + { + return array('not_moved' => 0, 'removed' => 0); + } + + $user_message_rules = (int) $user->data['user_message_rules']; + $user_id = (int) $user->data['user_id']; + + $action_ary = $move_into_folder = array(); + $num_removed = 0; + + // Newly processing on-hold messages + if ($release) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET folder_id = ' . PRIVMSGS_NO_BOX . ' + WHERE folder_id = ' . PRIVMSGS_HOLD_BOX . " + AND user_id = $user_id"; + $db->sql_query($sql); + } + + // Get those messages not yet placed into any box + $retrieve_sql = 'SELECT t.*, p.*, u.username, u.user_id, u.group_id + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE t.user_id = $user_id + AND p.author_id = u.user_id + AND t.folder_id = " . PRIVMSGS_NO_BOX . ' + AND t.msg_id = p.msg_id'; + + // Just place into the appropriate arrays if no rules need to be checked + if (!$user_message_rules) + { + $result = $db->sql_query($retrieve_sql); + + while ($row = $db->sql_fetchrow($result)) + { + $action_ary[$row['msg_id']][] = array('action' => false); + } + $db->sql_freeresult($result); + } + else + { + $user_rules = $zebra = $check_rows = array(); + $user_ids = $memberships = array(); + + // First of all, grab all rules and retrieve friends/foes + $sql = 'SELECT * + FROM ' . PRIVMSGS_RULES_TABLE . " + WHERE user_id = $user_id"; + $result = $db->sql_query($sql); + $user_rules = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + if (count($user_rules)) + { + $sql = 'SELECT zebra_id, friend, foe + FROM ' . ZEBRA_TABLE . " + WHERE user_id = $user_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $zebra[$row['zebra_id']] = $row; + } + $db->sql_freeresult($result); + } + + // Now build a bare-bone check_row array + $result = $db->sql_query($retrieve_sql); + + while ($row = $db->sql_fetchrow($result)) + { + $check_rows[] = array_merge($row, array( + 'to' => explode(':', $row['to_address']), + 'bcc' => explode(':', $row['bcc_address']), + 'friend' => (isset($zebra[$row['author_id']])) ? $zebra[$row['author_id']]['friend'] : 0, + 'foe' => (isset($zebra[$row['author_id']])) ? $zebra[$row['author_id']]['foe'] : 0, + 'user_in_group' => array($user->data['group_id']), + 'author_in_group' => array()) + ); + + $user_ids[] = $row['user_id']; + } + $db->sql_freeresult($result); + + // Retrieve user memberships + if (count($user_ids)) + { + $sql = 'SELECT * + FROM ' . USER_GROUP_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_ids) . ' + AND user_pending = 0'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $memberships[$row['user_id']][] = $row['group_id']; + } + $db->sql_freeresult($result); + } + + // Now place into the appropriate folder + foreach ($check_rows as $row) + { + // Add membership if set + if (isset($memberships[$row['author_id']])) + { + $row['author_in_group'] = $memberships[$row['user_id']]; + } + + // Check Rule - this should be very quick since we have all information we need + $is_match = false; + foreach ($user_rules as $rule_row) + { + if (($action = check_rule($global_privmsgs_rules, $rule_row, $row, $user_id)) !== false) + { + $is_match = true; + $action_ary[$row['msg_id']][] = $action; + } + } + + if (!$is_match) + { + $action_ary[$row['msg_id']][] = array('action' => false); + } + } + + unset($user_rules, $zebra, $check_rows, $user_ids, $memberships); + } + + // We place actions into arrays, to save queries. + $unread_ids = $delete_ids = $important_ids = array(); + + foreach ($action_ary as $msg_id => $msg_ary) + { + // It is allowed to execute actions more than once, except placing messages into folder + $folder_action = $message_removed = false; + + foreach ($msg_ary as $pos => $rule_ary) + { + if ($folder_action && $rule_ary['action'] == ACTION_PLACE_INTO_FOLDER) + { + continue; + } + + switch ($rule_ary['action']) + { + case ACTION_PLACE_INTO_FOLDER: + // Folder actions have precedence, so we will remove any other ones + $folder_action = true; + $move_into_folder[(int) $rule_ary['folder_id']][] = $msg_id; + break; + + case ACTION_MARK_AS_READ: + if ($rule_ary['pm_unread']) + { + $unread_ids[] = $msg_id; + } + break; + + case ACTION_DELETE_MESSAGE: + $delete_ids[] = $msg_id; + $message_removed = true; + break; + + case ACTION_MARK_AS_IMPORTANT: + if (!$rule_ary['pm_marked']) + { + $important_ids[] = $msg_id; + } + break; + } + } + + // We place this here because it could happen that the messages are doubled if a rule marks a message and then moves it into a specific + // folder. Here we simply move the message into the INBOX if it gets not removed and also not put into a custom folder. + if (!$folder_action && !$message_removed) + { + $move_into_folder[PRIVMSGS_INBOX][] = $msg_id; + } + } + + // Do not change the order of processing + // The number of queries needed to be executed here highly depends on the defined rules and are + // only gone through if new messages arrive. + + // Delete messages + if (count($delete_ids)) + { + $num_removed += count($delete_ids); + delete_pm($user_id, $delete_ids, PRIVMSGS_NO_BOX); + } + + // Set messages to Unread + if (count($unread_ids)) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_unread = 0 + WHERE ' . $db->sql_in_set('msg_id', $unread_ids) . " + AND user_id = $user_id + AND folder_id = " . PRIVMSGS_NO_BOX; + $db->sql_query($sql); + } + + // mark messages as important + if (count($important_ids)) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_marked = 1 - pm_marked + WHERE folder_id = ' . PRIVMSGS_NO_BOX . " + AND user_id = $user_id + AND " . $db->sql_in_set('msg_id', $important_ids); + $db->sql_query($sql); + } + + // Move into folder + $folder = array(); + + if (count($move_into_folder)) + { + // Determine Full Folder Action - we need the move to folder id later eventually + $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; + + $sql_folder = array_keys($move_into_folder); + if ($full_folder_action >= 0) + { + $sql_folder[] = $full_folder_action; + } + + $sql = 'SELECT folder_id, pm_count + FROM ' . PRIVMSGS_FOLDER_TABLE . ' + WHERE ' . $db->sql_in_set('folder_id', $sql_folder) . " + AND user_id = $user_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $folder[(int) $row['folder_id']] = (int) $row['pm_count']; + } + $db->sql_freeresult($result); + + unset($sql_folder); + + if (isset($move_into_folder[PRIVMSGS_INBOX])) + { + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id = " . PRIVMSGS_INBOX; + $result = $db->sql_query($sql); + $folder[PRIVMSGS_INBOX] = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + } + } + + // Here we have ideally only one folder to move into + foreach ($move_into_folder as $folder_id => $msg_ary) + { + $dest_folder = $folder_id; + $full_folder_action = FULL_FOLDER_NONE; + + // Check Message Limit - we calculate with the complete array, most of the time it is one message + // But we are making sure that the other way around works too (more messages in queue than allowed to be stored) + if ($user->data['message_limit'] && $folder[$folder_id] && ($folder[$folder_id] + count($msg_ary)) > $user->data['message_limit']) + { + $full_folder_action = ($user->data['user_full_folder'] == FULL_FOLDER_NONE) ? ($config['full_folder_action'] - (FULL_FOLDER_NONE*(-1))) : $user->data['user_full_folder']; + + // If destination folder itself is full... + if ($full_folder_action >= 0 && ($folder[$full_folder_action] + count($msg_ary)) > $user->data['message_limit']) + { + $full_folder_action = $config['full_folder_action'] - (FULL_FOLDER_NONE*(-1)); + } + + // If Full Folder Action is to move to another folder, we simply adjust the destination folder + if ($full_folder_action >= 0) + { + $dest_folder = $full_folder_action; + } + else if ($full_folder_action == FULL_FOLDER_DELETE) + { + // Delete some messages. NOTE: Ordered by msg_id here instead of message_time! + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id = $dest_folder + ORDER BY msg_id ASC"; + $result = $db->sql_query_limit($sql, (($folder[$dest_folder] + count($msg_ary)) - $user->data['message_limit'])); + + $delete_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $delete_ids[] = $row['msg_id']; + } + $db->sql_freeresult($result); + + $num_removed += count($delete_ids); + delete_pm($user_id, $delete_ids, $dest_folder); + } + } + + // + if ($full_folder_action == FULL_FOLDER_HOLD) + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET folder_id = ' . PRIVMSGS_HOLD_BOX . ' + WHERE folder_id = ' . PRIVMSGS_NO_BOX . " + AND user_id = $user_id + AND " . $db->sql_in_set('msg_id', $msg_ary); + $db->sql_query($sql); + } + else + { + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " + SET folder_id = $dest_folder, pm_new = 0 + WHERE folder_id = " . PRIVMSGS_NO_BOX . " + AND user_id = $user_id + AND pm_new = 1 + AND " . $db->sql_in_set('msg_id', $msg_ary); + $db->sql_query($sql); + + if ($dest_folder != PRIVMSGS_INBOX) + { + $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . ' + SET pm_count = pm_count + ' . (int) $db->sql_affectedrows() . " + WHERE folder_id = $dest_folder + AND user_id = $user_id"; + $db->sql_query($sql); + } + } + } + + if (count($action_ary)) + { + // Move from OUTBOX to SENTBOX + // We are not checking any full folder status here... SENTBOX is a special treatment (old messages get deleted) + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET folder_id = ' . PRIVMSGS_SENTBOX . ' + WHERE folder_id = ' . PRIVMSGS_OUTBOX . ' + AND ' . $db->sql_in_set('msg_id', array_keys($action_ary)); + $db->sql_query($sql); + } + + // Update new/unread count + update_pm_counts(); + + // Now check how many messages got not moved... + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id = " . PRIVMSGS_HOLD_BOX; + $result = $db->sql_query($sql); + $num_not_moved = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + + return array('not_moved' => $num_not_moved, 'removed' => $num_removed); +} + +/** +* Move PM from one to another folder +*/ +function move_pm($user_id, $message_limit, $move_msg_ids, $dest_folder, $cur_folder_id) +{ + global $db, $user; + global $phpbb_root_path, $phpEx; + + $num_moved = 0; + + if (!is_array($move_msg_ids)) + { + $move_msg_ids = array($move_msg_ids); + } + + if (count($move_msg_ids) && !in_array($dest_folder, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX)) && + !in_array($cur_folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX)) && $cur_folder_id != $dest_folder) + { + // We have to check the destination folder ;) + if ($dest_folder != PRIVMSGS_INBOX) + { + $sql = 'SELECT folder_id, folder_name, pm_count + FROM ' . PRIVMSGS_FOLDER_TABLE . " + WHERE folder_id = $dest_folder + AND user_id = $user_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } + + if ($message_limit && $row['pm_count'] + count($move_msg_ids) > $message_limit) + { + $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $row['folder_name']) . '

'; + $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $row['folder_name']); + trigger_error($message); + } + } + else + { + $sql = 'SELECT COUNT(msg_id) as num_messages + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE folder_id = ' . PRIVMSGS_INBOX . " + AND user_id = $user_id"; + $result = $db->sql_query($sql); + $num_messages = (int) $db->sql_fetchfield('num_messages'); + $db->sql_freeresult($result); + + if ($message_limit && $num_messages + count($move_msg_ids) > $message_limit) + { + $message = sprintf($user->lang['NOT_ENOUGH_SPACE_FOLDER'], $user->lang['PM_INBOX']) . '

'; + $message .= sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user->lang['PM_INBOX']); + trigger_error($message); + } + } + + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " + SET folder_id = $dest_folder + WHERE folder_id = $cur_folder_id + AND user_id = $user_id + AND " . $db->sql_in_set('msg_id', $move_msg_ids); + $db->sql_query($sql); + $num_moved = $db->sql_affectedrows(); + + // Update pm counts + if ($num_moved) + { + if (!in_array($cur_folder_id, array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX))) + { + $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . " + SET pm_count = pm_count - $num_moved + WHERE folder_id = $cur_folder_id + AND user_id = $user_id"; + $db->sql_query($sql); + } + + if ($dest_folder != PRIVMSGS_INBOX) + { + $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . " + SET pm_count = pm_count + $num_moved + WHERE folder_id = $dest_folder + AND user_id = $user_id"; + $db->sql_query($sql); + } + } + } + else if (in_array($cur_folder_id, array(PRIVMSGS_NO_BOX, PRIVMSGS_OUTBOX))) + { + trigger_error('CANNOT_MOVE_SPECIAL'); + } + + return $num_moved; +} + +/** +* Update unread message status +*/ +function update_unread_status($unread, $msg_id, $user_id, $folder_id) +{ + if (!$unread) + { + return; + } + + global $db, $user, $phpbb_container; + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->mark_notifications('notification.type.pm', $msg_id, $user_id); + + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " + SET pm_unread = 0 + WHERE msg_id = $msg_id + AND user_id = $user_id + AND folder_id = $folder_id + AND pm_unread = 1"; + $db->sql_query($sql); + + // If the message is already marked as read, we just skip the rest to avoid negative PM count + if (!$db->sql_affectedrows()) + { + return; + } + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_unread_privmsg = user_unread_privmsg - 1 + WHERE user_id = $user_id"; + $db->sql_query($sql); + + if ($user->data['user_id'] == $user_id) + { + $user->data['user_unread_privmsg']--; + + // Try to cope with previous wrong conversions... + if ($user->data['user_unread_privmsg'] < 0) + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_unread_privmsg = 0 + WHERE user_id = $user_id"; + $db->sql_query($sql); + + $user->data['user_unread_privmsg'] = 0; + } + } +} + +function mark_folder_read($user_id, $folder_id) +{ + global $db; + + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE folder_id = ' . ((int) $folder_id) . ' + AND user_id = ' . ((int) $user_id) . ' + AND pm_unread = 1'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + update_unread_status(true, $row['msg_id'], $user_id, $folder_id); + } + $db->sql_freeresult($result); +} + +/** +* Handle all actions possible with marked messages +*/ +function handle_mark_actions($user_id, $mark_action) +{ + global $db, $user, $phpbb_root_path, $phpEx, $request; + + $msg_ids = $request->variable('marked_msg_id', array(0)); + $cur_folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); + + if (!count($msg_ids)) + { + return false; + } + + switch ($mark_action) + { + case 'mark_important': + + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . " + SET pm_marked = 1 - pm_marked + WHERE folder_id = $cur_folder_id + AND user_id = $user_id + AND " . $db->sql_in_set('msg_id', $msg_ids); + $db->sql_query($sql); + + break; + + case 'delete_marked': + + global $auth; + + if (!$auth->acl_get('u_pm_delete')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_DELETE_MESSAGE'); + } + + if (confirm_box(true)) + { + delete_pm($user_id, $msg_ids, $cur_folder_id); + + $success_msg = (count($msg_ids) == 1) ? 'MESSAGE_DELETED' : 'MESSAGES_DELETED'; + $redirect = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $cur_folder_id); + + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_FOLDER'], '', '')); + } + else + { + $s_hidden_fields = array( + 'cur_folder_id' => $cur_folder_id, + 'mark_option' => 'delete_marked', + 'submit_mark' => true, + 'marked_msg_id' => $msg_ids + ); + + confirm_box(false, 'DELETE_MARKED_PM', build_hidden_fields($s_hidden_fields)); + } + + break; + + default: + return false; + } + + return true; +} + +/** +* Delete PM(s) +*/ +function delete_pm($user_id, $msg_ids, $folder_id) +{ + global $db, $user, $phpbb_container, $phpbb_dispatcher; + + $user_id = (int) $user_id; + $folder_id = (int) $folder_id; + + if (!$user_id) + { + return false; + } + + if (!is_array($msg_ids)) + { + if (!$msg_ids) + { + return false; + } + $msg_ids = array($msg_ids); + } + + if (!count($msg_ids)) + { + return false; + } + + /** + * Get all info for PM(s) before they are deleted + * + * @event core.delete_pm_before + * @var int user_id ID of the user requested the message delete + * @var array msg_ids array of all messages to be deleted + * @var int folder_id ID of the user folder where the messages are stored + * @since 3.1.0-b5 + */ + $vars = array('user_id', 'msg_ids', 'folder_id'); + extract($phpbb_dispatcher->trigger_event('core.delete_pm_before', compact($vars))); + + // Get PM Information for later deleting + $sql = 'SELECT msg_id, pm_unread, pm_new + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', array_map('intval', $msg_ids)) . " + AND folder_id = $folder_id + AND user_id = $user_id"; + $result = $db->sql_query($sql); + + $delete_rows = array(); + $num_unread = $num_new = $num_deleted = 0; + while ($row = $db->sql_fetchrow($result)) + { + $num_unread += (int) $row['pm_unread']; + $num_new += (int) $row['pm_new']; + + $delete_rows[$row['msg_id']] = 1; + } + $db->sql_freeresult($result); + unset($msg_ids); + + if (!count($delete_rows)) + { + return false; + } + + $db->sql_transaction('begin'); + + // if no one has read the message yet (meaning it is in users outbox) + // then mark the message as deleted... + if ($folder_id == PRIVMSGS_OUTBOX) + { + // Remove PM from Outbox + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id AND folder_id = " . PRIVMSGS_OUTBOX . ' + AND ' . $db->sql_in_set('msg_id', array_keys($delete_rows)); + $db->sql_query($sql); + + // Update PM Information for safety + $sql = 'UPDATE ' . PRIVMSGS_TABLE . " SET message_text = '' + WHERE " . $db->sql_in_set('msg_id', array_keys($delete_rows)); + $db->sql_query($sql); + + // Set delete flag for those intended to receive the PM + // We do not remove the message actually, to retain some basic information (sent time for example) + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_deleted = 1 + WHERE ' . $db->sql_in_set('msg_id', array_keys($delete_rows)); + $db->sql_query($sql); + + $num_deleted = $db->sql_affectedrows(); + } + else + { + // Delete private message data + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . " + WHERE user_id = $user_id + AND folder_id = $folder_id + AND " . $db->sql_in_set('msg_id', array_keys($delete_rows)); + $db->sql_query($sql); + $num_deleted = $db->sql_affectedrows(); + } + + // if folder id is user defined folder then decrease pm_count + if (!in_array($folder_id, array(PRIVMSGS_INBOX, PRIVMSGS_OUTBOX, PRIVMSGS_SENTBOX, PRIVMSGS_NO_BOX))) + { + $sql = 'UPDATE ' . PRIVMSGS_FOLDER_TABLE . " + SET pm_count = pm_count - $num_deleted + WHERE folder_id = $folder_id"; + $db->sql_query($sql); + } + + // Update unread and new status field + if ($num_unread || $num_new) + { + $set_sql = ($num_unread) ? 'user_unread_privmsg = user_unread_privmsg - ' . $num_unread : ''; + + if ($num_new) + { + $set_sql .= ($set_sql != '') ? ', ' : ''; + $set_sql .= 'user_new_privmsg = user_new_privmsg - ' . $num_new; + } + + $db->sql_query('UPDATE ' . USERS_TABLE . " SET $set_sql WHERE user_id = $user_id"); + + $user->data['user_new_privmsg'] -= $num_new; + $user->data['user_unread_privmsg'] -= $num_unread; + } + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->delete_notifications('notification.type.pm', array_keys($delete_rows)); + + // Now we have to check which messages we can delete completely + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', array_keys($delete_rows)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + unset($delete_rows[$row['msg_id']]); + } + $db->sql_freeresult($result); + + $delete_ids = array_keys($delete_rows); + + if (count($delete_ids)) + { + // Check if there are any attachments we need to remove + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('message', $delete_ids, false); + unset($attachment_manager); + + $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $delete_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + return true; +} + +/** +* Delete all PM(s) for a given user and delete the ones without references +* +* @param int $user_id ID of the user whose private messages we want to delete +* +* @return boolean False if there were no pms found, true otherwise. +*/ +function phpbb_delete_user_pms($user_id) +{ + $user_id = (int) $user_id; + + if (!$user_id) + { + return false; + } + + return phpbb_delete_users_pms(array($user_id)); +} + +/** +* Delete all PM(s) for given users and delete the ones without references +* +* @param array $user_ids IDs of the users whose private messages we want to delete +* +* @return boolean False if there were no pms found, true otherwise. +*/ +function phpbb_delete_users_pms($user_ids) +{ + global $db, $phpbb_container; + + $user_id_sql = $db->sql_in_set('user_id', $user_ids); + $author_id_sql = $db->sql_in_set('author_id', $user_ids); + + // Get PM Information for later deleting + // The two queries where split, so we can use our indexes + $undelivered_msg = $delete_ids = array(); + + // Part 1: get PMs the user received + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $user_id_sql; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $msg_id = (int) $row['msg_id']; + $delete_ids[$msg_id] = $msg_id; + } + $db->sql_freeresult($result); + + // Part 2: get PMs the users sent, but are yet to be received. + // We cannot simply delete them. First we have to check + // whether another user already received and read the message. + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $author_id_sql . ' + AND folder_id = ' . PRIVMSGS_NO_BOX; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $msg_id = (int) $row['msg_id']; + $undelivered_msg[$msg_id] = $msg_id; + } + $db->sql_freeresult($result); + + if (empty($delete_ids) && empty($undelivered_msg)) + { + return false; + } + + $db->sql_transaction('begin'); + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + if (!empty($undelivered_msg)) + { + // A pm is delivered, if for any recipient the message was moved + // from their NO_BOX to another folder. We do not delete such + // messages, but only delete them for users, who have not yet + // received them. + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $author_id_sql . ' + AND folder_id <> ' . PRIVMSGS_NO_BOX . ' + AND folder_id <> ' . PRIVMSGS_OUTBOX . ' + AND folder_id <> ' . PRIVMSGS_SENTBOX; + $result = $db->sql_query($sql); + + $delivered_msg = array(); + while ($row = $db->sql_fetchrow($result)) + { + $msg_id = (int) $row['msg_id']; + $delivered_msg[$msg_id] = $msg_id; + unset($undelivered_msg[$msg_id]); + } + $db->sql_freeresult($result); + + $undelivered_user = array(); + + // Count the messages we delete, so we can correct the user pm data + $sql = 'SELECT user_id, COUNT(msg_id) as num_undelivered_privmsgs + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $author_id_sql . ' + AND folder_id = ' . PRIVMSGS_NO_BOX . ' + AND ' . $db->sql_in_set('msg_id', array_merge($undelivered_msg, $delivered_msg)) . ' + GROUP BY user_id'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $num_pms = (int) $row['num_undelivered_privmsgs']; + $undelivered_user[$num_pms][] = (int) $row['user_id']; + + if (count($undelivered_user[$num_pms]) > 50) + { + // If there are too many users affected the query might get + // too long, so we update the value for the first bunch here. + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new_privmsg = user_new_privmsg - ' . $num_pms . ', + user_unread_privmsg = user_unread_privmsg - ' . $num_pms . ' + WHERE ' . $db->sql_in_set('user_id', $undelivered_user[$num_pms]); + $db->sql_query($sql); + unset($undelivered_user[$num_pms]); + } + } + $db->sql_freeresult($result); + + foreach ($undelivered_user as $num_pms => $undelivered_user_set) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new_privmsg = user_new_privmsg - ' . $num_pms . ', + user_unread_privmsg = user_unread_privmsg - ' . $num_pms . ' + WHERE ' . $db->sql_in_set('user_id', $undelivered_user_set); + $db->sql_query($sql); + } + + if (!empty($delivered_msg)) + { + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE folder_id = ' . PRIVMSGS_NO_BOX . ' + AND ' . $db->sql_in_set('msg_id', $delivered_msg); + $db->sql_query($sql); + + $phpbb_notifications->delete_notifications('notification.type.pm', $delivered_msg); + } + + if (!empty($undelivered_msg)) + { + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $undelivered_msg); + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $undelivered_msg); + $db->sql_query($sql); + + $phpbb_notifications->delete_notifications('notification.type.pm', $undelivered_msg); + } + } + + // Reset the user's pm count to 0 + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new_privmsg = 0, + user_unread_privmsg = 0 + WHERE ' . $user_id_sql; + $db->sql_query($sql); + + // Delete private message data of the user + $sql = 'DELETE FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $user_id_sql; + $db->sql_query($sql); + + if (!empty($delete_ids)) + { + // Now we have to check which messages we can delete completely + $sql = 'SELECT msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $delete_ids); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + unset($delete_ids[$row['msg_id']]); + } + $db->sql_freeresult($result); + + if (!empty($delete_ids)) + { + // Check if there are any attachments we need to remove + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('message', $delete_ids, false); + unset($attachment_manager); + + $sql = 'DELETE FROM ' . PRIVMSGS_TABLE . ' + WHERE ' . $db->sql_in_set('msg_id', $delete_ids); + $db->sql_query($sql); + + $phpbb_notifications->delete_notifications('notification.type.pm', $delete_ids); + } + } + + // Set the remaining author id to anonymous + // This way users are still able to read messages from users being removed + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET author_id = ' . ANONYMOUS . ' + WHERE ' . $author_id_sql; + $db->sql_query($sql); + + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET author_id = ' . ANONYMOUS . ' + WHERE ' . $author_id_sql; + $db->sql_query($sql); + + $db->sql_transaction('commit'); + + return true; +} + +/** +* Rebuild message header +*/ +function rebuild_header($check_ary) +{ + $address = array(); + + foreach ($check_ary as $check_type => $address_field) + { + // Split Addresses into users and groups + preg_match_all('/:?(u|g)_([0-9]+):?/', $address_field, $match); + + $u = $g = array(); + foreach ($match[1] as $id => $type) + { + ${$type}[] = (int) $match[2][$id]; + } + + $_types = array('u', 'g'); + foreach ($_types as $type) + { + if (count(${$type})) + { + foreach (${$type} as $id) + { + $address[$type][$id] = $check_type; + } + } + } + } + + return $address; +} + +/** +* Print out/assign recipient information +*/ +function write_pm_addresses($check_ary, $author_id, $plaintext = false) +{ + global $db, $user, $template, $phpbb_root_path, $phpEx, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $addresses = array(); + + foreach ($check_ary as $check_type => $address_field) + { + if (!is_array($address_field)) + { + // Split Addresses into users and groups + preg_match_all('/:?(u|g)_([0-9]+):?/', $address_field, $match); + + $u = $g = array(); + foreach ($match[1] as $id => $type) + { + ${$type}[] = (int) $match[2][$id]; + } + } + else + { + $u = $address_field['u']; + $g = $address_field['g']; + } + + $address = array(); + if (count($u)) + { + $sql = 'SELECT user_id, username, user_colour + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $u); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) + { + if ($plaintext) + { + $address[] = $row['username']; + } + else + { + $address['user'][$row['user_id']] = array('name' => $row['username'], 'colour' => $row['user_colour']); + } + } + } + $db->sql_freeresult($result); + } + + if (count($g)) + { + if ($plaintext) + { + $sql = 'SELECT group_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_id', $g); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) + { + $address[] = $group_helper->get_name($row['group_name']); + } + } + $db->sql_freeresult($result); + } + else + { + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE ' . $db->sql_in_set('g.group_id', $g) . ' + AND g.group_id = ug.group_id + AND ug.user_pending = 0'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($address['group'][$row['group_id']])) + { + if ($check_type == 'to' || $author_id == $user->data['user_id'] || $row['user_id'] == $user->data['user_id']) + { + $row['group_name'] = $group_helper->get_name($row['group_name']); + $address['group'][$row['group_id']] = array('name' => $row['group_name'], 'colour' => $row['group_colour']); + } + } + + if (isset($address['user'][$row['user_id']])) + { + $address['user'][$row['user_id']]['in_group'] = $row['group_id']; + } + } + $db->sql_freeresult($result); + } + } + + if (count($address) && !$plaintext) + { + $template->assign_var('S_' . strtoupper($check_type) . '_RECIPIENT', true); + + foreach ($address as $type => $adr_ary) + { + foreach ($adr_ary as $id => $row) + { + $tpl_ary = array( + 'IS_GROUP' => ($type == 'group') ? true : false, + 'IS_USER' => ($type == 'user') ? true : false, + 'UG_ID' => $id, + 'NAME' => $row['name'], + 'COLOUR' => ($row['colour']) ? '#' . $row['colour'] : '', + 'TYPE' => $type, + ); + + if ($type == 'user') + { + $tpl_ary = array_merge($tpl_ary, array( + 'U_VIEW' => get_username_string('profile', $id, $row['name'], $row['colour']), + 'NAME_FULL' => get_username_string('full', $id, $row['name'], $row['colour']), + )); + } + else + { + $tpl_ary = array_merge($tpl_ary, array( + 'U_VIEW' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $id), + )); + } + + $template->assign_block_vars($check_type . '_recipient', $tpl_ary); + } + } + } + + $addresses[$check_type] = $address; + } + + return $addresses; +} + +/** +* Get folder status +*/ +function get_folder_status($folder_id, $folder) +{ + global $user; + + if (isset($folder[$folder_id])) + { + $folder = $folder[$folder_id]; + } + else + { + return false; + } + + $return = array( + 'folder_name' => $folder['folder_name'], + 'cur' => $folder['num_messages'], + 'remaining' => ($user->data['message_limit']) ? $user->data['message_limit'] - $folder['num_messages'] : 0, + 'max' => $user->data['message_limit'], + 'percent' => ($user->data['message_limit']) ? (($user->data['message_limit'] > 0) ? floor(($folder['num_messages'] / $user->data['message_limit']) * 100) : 100) : 0, + ); + + $return['message'] = $user->lang('FOLDER_STATUS_MSG', $user->lang('MESSAGES_COUNT', (int) $return['max']), (int) $return['cur'], $return['percent']); + + return $return; +} + +// +// COMPOSE MESSAGES +// + +/** +* Submit PM +*/ +function submit_pm($mode, $subject, &$data_ary, $put_in_outbox = true) +{ + global $db, $auth, $config, $user, $phpbb_root_path, $phpbb_container, $phpbb_dispatcher, $request; + + // We do not handle erasing pms here + if ($mode == 'delete') + { + return false; + } + + $current_time = time(); + + $data = $data_ary; + /** + * Get all parts of the PM that are to be submited to the DB. + * + * @event core.submit_pm_before + * @var string mode PM Post mode - post|reply|quote|quotepost|forward|edit + * @var string subject Subject of the private message + * @var array data The whole row data of the PM. + * @since 3.1.0-b3 + */ + $vars = array('mode', 'subject', 'data'); + extract($phpbb_dispatcher->trigger_event('core.submit_pm_before', compact($vars))); + $data_ary = $data; + unset($data); + + // Collect some basic information about which tables and which rows to update/insert + $sql_data = array(); + $root_level = 0; + + // Recipient Information + $recipients = $to = $bcc = array(); + + if ($mode != 'edit') + { + // Build Recipient List + // u|g => array($user_id => 'to'|'bcc') + $_types = array('u', 'g'); + foreach ($_types as $ug_type) + { + if (isset($data_ary['address_list'][$ug_type]) && count($data_ary['address_list'][$ug_type])) + { + foreach ($data_ary['address_list'][$ug_type] as $id => $field) + { + $id = (int) $id; + + // Do not rely on the address list being "valid" + if (!$id || ($ug_type == 'u' && $id == ANONYMOUS)) + { + continue; + } + + $field = ($field == 'to') ? 'to' : 'bcc'; + if ($ug_type == 'u') + { + $recipients[$id] = $field; + } + ${$field}[] = $ug_type . '_' . $id; + } + } + } + + if (isset($data_ary['address_list']['g']) && count($data_ary['address_list']['g'])) + { + // We need to check the PM status of group members (do they want to receive PM's?) + // Only check if not a moderator or admin, since they are allowed to override this user setting + $sql_allow_pm = (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) ? ' AND u.user_allow_pm = 1' : ''; + + $sql = 'SELECT u.user_type, ug.group_id, ug.user_id + FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug + WHERE ' . $db->sql_in_set('ug.group_id', array_keys($data_ary['address_list']['g'])) . ' + AND ug.user_pending = 0 + AND u.user_id = ug.user_id + AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')' . + $sql_allow_pm; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $field = ($data_ary['address_list']['g'][$row['group_id']] == 'to') ? 'to' : 'bcc'; + $recipients[$row['user_id']] = $field; + } + $db->sql_freeresult($result); + } + + if (!count($recipients)) + { + trigger_error('NO_RECIPIENT'); + } + } + + // First of all make sure the subject are having the correct length. + $subject = truncate_string($subject); + + $db->sql_transaction('begin'); + + $sql = ''; + + switch ($mode) + { + case 'reply': + case 'quote': + $root_level = ($data_ary['reply_from_root_level']) ? $data_ary['reply_from_root_level'] : $data_ary['reply_from_msg_id']; + + // Set message_replied switch for this user + $sql = 'UPDATE ' . PRIVMSGS_TO_TABLE . ' + SET pm_replied = 1 + WHERE user_id = ' . $data_ary['from_user_id'] . ' + AND msg_id = ' . $data_ary['reply_from_msg_id']; + + // no break + + case 'forward': + case 'post': + case 'quotepost': + $sql_data = array( + 'root_level' => $root_level, + 'author_id' => $data_ary['from_user_id'], + 'icon_id' => $data_ary['icon_id'], + 'author_ip' => $data_ary['from_user_ip'], + 'message_time' => $current_time, + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], + 'message_subject' => $subject, + 'message_text' => $data_ary['message'], + 'message_attachment'=> (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'], + 'to_address' => implode(':', $to), + 'bcc_address' => implode(':', $bcc), + 'message_reported' => 0, + ); + break; + + case 'edit': + $sql_data = array( + 'icon_id' => $data_ary['icon_id'], + 'message_edit_time' => $current_time, + 'enable_bbcode' => $data_ary['enable_bbcode'], + 'enable_smilies' => $data_ary['enable_smilies'], + 'enable_magic_url' => $data_ary['enable_urls'], + 'enable_sig' => $data_ary['enable_sig'], + 'message_subject' => $subject, + 'message_text' => $data_ary['message'], + 'message_attachment'=> (!empty($data_ary['attachment_data'])) ? 1 : 0, + 'bbcode_bitfield' => $data_ary['bbcode_bitfield'], + 'bbcode_uid' => $data_ary['bbcode_uid'] + ); + break; + } + + if (count($sql_data)) + { + if ($mode == 'post' || $mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward') + { + $db->sql_query('INSERT INTO ' . PRIVMSGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_data)); + $data_ary['msg_id'] = $db->sql_nextid(); + } + else if ($mode == 'edit') + { + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_edit_count = message_edit_count + 1, ' . $db->sql_build_array('UPDATE', $sql_data) . ' + WHERE msg_id = ' . $data_ary['msg_id']; + $db->sql_query($sql); + } + } + + if ($mode != 'edit') + { + if ($sql) + { + $db->sql_query($sql); + } + unset($sql); + + $sql_ary = array(); + foreach ($recipients as $user_id => $type) + { + $sql_ary[] = array( + 'msg_id' => (int) $data_ary['msg_id'], + 'user_id' => (int) $user_id, + 'author_id' => (int) $data_ary['from_user_id'], + 'folder_id' => PRIVMSGS_NO_BOX, + 'pm_new' => 1, + 'pm_unread' => 1, + 'pm_forwarded' => ($mode == 'forward') ? 1 : 0 + ); + } + + $db->sql_multi_insert(PRIVMSGS_TO_TABLE, $sql_ary); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new_privmsg = user_new_privmsg + 1, user_unread_privmsg = user_unread_privmsg + 1, user_last_privmsg = ' . time() . ' + WHERE ' . $db->sql_in_set('user_id', array_keys($recipients)); + $db->sql_query($sql); + + // Put PM into outbox + if ($put_in_outbox) + { + $db->sql_query('INSERT INTO ' . PRIVMSGS_TO_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'msg_id' => (int) $data_ary['msg_id'], + 'user_id' => (int) $data_ary['from_user_id'], + 'author_id' => (int) $data_ary['from_user_id'], + 'folder_id' => PRIVMSGS_OUTBOX, + 'pm_new' => 0, + 'pm_unread' => 0, + 'pm_forwarded' => ($mode == 'forward') ? 1 : 0)) + ); + } + } + + // Set user last post time + if ($mode == 'reply' || $mode == 'quote' || $mode == 'quotepost' || $mode == 'forward' || $mode == 'post') + { + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_lastpost_time = $current_time + WHERE user_id = " . $data_ary['from_user_id']; + $db->sql_query($sql); + } + + // Submit Attachments + if (!empty($data_ary['attachment_data']) && $data_ary['msg_id'] && in_array($mode, array('post', 'reply', 'quote', 'quotepost', 'edit', 'forward'))) + { + $space_taken = $files_added = 0; + $orphan_rows = array(); + + foreach ($data_ary['attachment_data'] as $pos => $attach_row) + { + $orphan_rows[(int) $attach_row['attach_id']] = array(); + } + + if (count($orphan_rows)) + { + $sql = 'SELECT attach_id, filesize, physical_filename + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan_rows)) . ' + AND in_message = 1 + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + $orphan_rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $orphan_rows[$row['attach_id']] = $row; + } + $db->sql_freeresult($result); + } + + foreach ($data_ary['attachment_data'] as $pos => $attach_row) + { + if ($attach_row['is_orphan'] && !isset($orphan_rows[$attach_row['attach_id']])) + { + continue; + } + + if (!$attach_row['is_orphan']) + { + // update entry in db if attachment already stored in db and filespace + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . " + SET attach_comment = '" . $db->sql_escape($attach_row['attach_comment']) . "' + WHERE attach_id = " . (int) $attach_row['attach_id'] . ' + AND is_orphan = 0'; + $db->sql_query($sql); + } + else + { + // insert attachment into db + if (!@file_exists($phpbb_root_path . $config['upload_path'] . '/' . utf8_basename($orphan_rows[$attach_row['attach_id']]['physical_filename']))) + { + continue; + } + + $space_taken += $orphan_rows[$attach_row['attach_id']]['filesize']; + $files_added++; + + $attach_sql = array( + 'post_msg_id' => $data_ary['msg_id'], + 'topic_id' => 0, + 'is_orphan' => 0, + 'poster_id' => $data_ary['from_user_id'], + 'attach_comment' => $attach_row['attach_comment'], + ); + + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $attach_sql) . ' + WHERE attach_id = ' . $attach_row['attach_id'] . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $db->sql_query($sql); + } + } + + if ($space_taken && $files_added) + { + $config->increment('upload_dir_size', $space_taken, false); + $config->increment('num_files', $files_added, false); + } + } + + // Delete draft if post was loaded... + $draft_id = $request->variable('draft_loaded', 0); + if ($draft_id) + { + $sql = 'DELETE FROM ' . DRAFTS_TABLE . " + WHERE draft_id = $draft_id + AND user_id = " . $data_ary['from_user_id']; + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + // Send Notifications + $pm_data = array_merge($data_ary, array( + 'message_subject' => $subject, + 'recipients' => $recipients, + )); + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + if ($mode == 'edit') + { + $phpbb_notifications->update_notifications('notification.type.pm', $pm_data); + } + else + { + $phpbb_notifications->add_notifications('notification.type.pm', $pm_data); + } + + $data = $data_ary; + /** + * Get PM message ID after submission to DB + * + * @event core.submit_pm_after + * @var string mode PM Post mode - post|reply|quote|quotepost|forward|edit + * @var string subject Subject of the private message + * @var array data The whole row data of the PM. + * @var array pm_data The data sent to notification class + * @since 3.1.0-b5 + */ + $vars = array('mode', 'subject', 'data', 'pm_data'); + extract($phpbb_dispatcher->trigger_event('core.submit_pm_after', compact($vars))); + $data_ary = $data; + unset($data); + + return $data_ary['msg_id']; +} + +/** +* Display Message History +*/ +function message_history($msg_id, $user_id, $message_row, $folder, $in_post_mode = false) +{ + global $db, $user, $template, $phpbb_root_path, $phpEx, $auth; + + // Select all receipts and the author from the pm we currently view, to only display their pm-history + $sql = 'SELECT author_id, user_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE msg_id = $msg_id + AND folder_id <> " . PRIVMSGS_HOLD_BOX; + $result = $db->sql_query($sql); + + $recipients = array(); + while ($row = $db->sql_fetchrow($result)) + { + $recipients[] = (int) $row['user_id']; + $recipients[] = (int) $row['author_id']; + } + $db->sql_freeresult($result); + $recipients = array_unique($recipients); + + // Get History Messages (could be newer) + $sql = 'SELECT t.*, p.*, u.* + FROM ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TO_TABLE . ' t, ' . USERS_TABLE . ' u + WHERE t.msg_id = p.msg_id + AND p.author_id = u.user_id + AND t.folder_id NOT IN (' . PRIVMSGS_NO_BOX . ', ' . PRIVMSGS_HOLD_BOX . ') + AND ' . $db->sql_in_set('t.author_id', $recipients, false, true) . " + AND t.user_id = $user_id"; + + // We no longer need those. + unset($recipients); + + if (!$message_row['root_level']) + { + $sql .= " AND (p.root_level = $msg_id OR (p.root_level = 0 AND p.msg_id = $msg_id))"; + } + else + { + $sql .= " AND (p.root_level = " . $message_row['root_level'] . ' OR p.msg_id = ' . $message_row['root_level'] . ')'; + } + $sql .= ' ORDER BY p.message_time DESC'; + + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + + if (!$row) + { + $db->sql_freeresult($result); + return false; + } + + $title = $row['message_subject']; + + $rowset = array(); + $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm') . '&folder='; + + do + { + $folder_id = (int) $row['folder_id']; + + $row['folder'][] = (isset($folder[$folder_id])) ? '' . $folder[$folder_id]['folder_name'] . '' : $user->lang['UNKNOWN_FOLDER']; + + if (isset($rowset[$row['msg_id']])) + { + $rowset[$row['msg_id']]['folder'][] = (isset($folder[$folder_id])) ? '' . $folder[$folder_id]['folder_name'] . '' : $user->lang['UNKNOWN_FOLDER']; + } + else + { + $rowset[$row['msg_id']] = $row; + } + } + while ($row = $db->sql_fetchrow($result)); + $db->sql_freeresult($result); + + if (count($rowset) == 1 && !$in_post_mode) + { + return false; + } + + $title = censor_text($title); + + $url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm'); + $next_history_pm = $previous_history_pm = $prev_id = 0; + + // Re-order rowset to be able to get the next/prev message rows... + $rowset = array_values($rowset); + + for ($i = 0, $size = count($rowset); $i < $size; $i++) + { + $row = &$rowset[$i]; + $id = (int) $row['msg_id']; + + $author_id = $row['author_id']; + $folder_id = (int) $row['folder_id']; + + $subject = $row['message_subject']; + $message = $row['message_text']; + + $message = censor_text($message); + + $decoded_message = false; + + if ($in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) + { + $decoded_message = $message; + decode_message($decoded_message, $row['bbcode_uid']); + + $decoded_message = bbcode_nl2br($decoded_message); + } + + $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); + + if ($id == $msg_id) + { + $next_history_pm = (isset($rowset[$i + 1])) ? (int) $rowset[$i + 1]['msg_id'] : 0; + $previous_history_pm = $prev_id; + } + + $template->assign_block_vars('history_row', array( + 'MESSAGE_AUTHOR_QUOTE' => (($decoded_message) ? addslashes(get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username'])) : ''), + 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $author_id, $row['username'], $row['user_colour'], $row['username']), + 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $author_id, $row['username'], $row['user_colour'], $row['username']), + 'MESSAGE_AUTHOR' => get_username_string('username', $author_id, $row['username'], $row['user_colour'], $row['username']), + 'U_MESSAGE_AUTHOR' => get_username_string('profile', $author_id, $row['username'], $row['user_colour'], $row['username']), + + 'SUBJECT' => $subject, + 'SENT_DATE' => $user->format_date($row['message_time']), + 'MESSAGE' => $message, + 'FOLDER' => implode($user->lang['COMMA_SEPARATOR'], $row['folder']), + 'DECODED_MESSAGE' => $decoded_message, + + 'S_CURRENT_MSG' => ($row['msg_id'] == $msg_id), + 'S_AUTHOR_DELETED' => ($author_id == ANONYMOUS) ? true : false, + 'S_IN_POST_MODE' => $in_post_mode, + + 'MSG_ID' => $row['msg_id'], + 'MESSAGE_TIME' => $row['message_time'], + 'USER_ID' => $row['user_id'], + 'U_VIEW_MESSAGE' => "$url&f=$folder_id&p=" . $row['msg_id'], + 'U_QUOTE' => (!$in_post_mode && $auth->acl_get('u_sendpm') && $author_id != ANONYMOUS) ? "$url&mode=compose&action=quote&f=" . $folder_id . "&p=" . $row['msg_id'] : '', + 'U_POST_REPLY_PM' => ($author_id != $user->data['user_id'] && $author_id != ANONYMOUS && $auth->acl_get('u_sendpm')) ? "$url&mode=compose&action=reply&f=$folder_id&p=" . $row['msg_id'] : '') + ); + unset($rowset[$i]); + $prev_id = $id; + } + + $template->assign_vars(array( + 'QUOTE_IMG' => $user->img('icon_post_quote', $user->lang['REPLY_WITH_QUOTE']), + 'HISTORY_TITLE' => $title, + + 'U_VIEW_NEXT_HISTORY' => ($next_history_pm) ? "$url&p=" . $next_history_pm : '', + 'U_VIEW_PREVIOUS_HISTORY' => ($previous_history_pm) ? "$url&p=" . $previous_history_pm : '', + )); + + return true; +} + +/** +* Set correct users max messages in PM folder. +* If several group memberships define different amount of messages, the highest will be chosen. +*/ +function set_user_message_limit() +{ + global $user, $db, $config; + + // Get maximum about from user memberships + $message_limit = phpbb_get_max_setting_from_group($db, $user->data['user_id'], 'message_limit'); + + // If it is 0, there is no limit set and we use the maximum value within the config. + $user->data['message_limit'] = (!$message_limit) ? $config['pm_max_msgs'] : $message_limit; +} + +/** + * Get the maximum PM setting for the groups of the user + * + * @param \phpbb\db\driver\driver_interface $db + * @param int $user_id + * @param string $setting Only 'max_recipients' and 'message_limit' are supported + * @return int The maximum setting for all groups of the user, unless one group has '0' + * @throws \InvalidArgumentException If selected group setting is not supported + */ +function phpbb_get_max_setting_from_group(\phpbb\db\driver\driver_interface $db, $user_id, $setting) +{ + if ($setting !== 'max_recipients' && $setting !== 'message_limit') + { + throw new InvalidArgumentException('Setting "' . $setting . '" is not supported'); + } + + // Get maximum number of allowed recipients + $sql = 'SELECT MAX(g.group_' . $setting . ') as max_setting + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE ug.user_id = ' . (int) $user_id . ' + AND ug.user_pending = 0 + AND ug.group_id = g.group_id'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $max_setting = (int) $row['max_setting']; + + return $max_setting; +} + +/** +* Generates an array of coloured recipient names from a list of PMs - (groups & users) +* +* @param array $pm_by_id An array of rows from PRIVMSGS_TABLE, keys are the msg_ids. +* +* @return array 2D Array: array(msg_id => array('username or group string', ...), ...) +* Usernames are generated with {@link get_username_string get_username_string} +* Groups are coloured and have a link to the membership page +*/ +function get_recipient_strings($pm_by_id) +{ + global $db, $phpbb_root_path, $phpEx, $user, $phpbb_container; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $address_list = $recipient_list = $address = array(); + + $_types = array('u', 'g'); + + foreach ($pm_by_id as $message_id => $row) + { + $address[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); + + foreach ($_types as $ug_type) + { + if (isset($address[$message_id][$ug_type]) && count($address[$message_id][$ug_type])) + { + foreach ($address[$message_id][$ug_type] as $ug_id => $in_to) + { + $recipient_list[$ug_type][$ug_id] = array('name' => $user->lang['NA'], 'colour' => ''); + } + } + } + } + + foreach ($_types as $ug_type) + { + if (!empty($recipient_list[$ug_type])) + { + if ($ug_type == 'u') + { + $sql = 'SELECT user_id as id, username as name, user_colour as colour + FROM ' . USERS_TABLE . ' + WHERE '; + } + else + { + $sql = 'SELECT group_id as id, group_name as name, group_colour as colour, group_type + FROM ' . GROUPS_TABLE . ' + WHERE '; + } + $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($recipient_list[$ug_type]))); + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($ug_type == 'g') + { + $row['name'] = $group_helper->get_name($row['name']); + } + + $recipient_list[$ug_type][$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); + } + $db->sql_freeresult($result); + } + } + + foreach ($address as $message_id => $adr_ary) + { + foreach ($adr_ary as $type => $id_ary) + { + foreach ($id_ary as $ug_id => $_id) + { + if ($type == 'u') + { + $address_list[$message_id][] = get_username_string('full', $ug_id, $recipient_list[$type][$ug_id]['name'], $recipient_list[$type][$ug_id]['colour']); + } + else + { + $user_colour = ($recipient_list[$type][$ug_id]['colour']) ? ' style="font-weight: bold; color:#' . $recipient_list[$type][$ug_id]['colour'] . '"' : ''; + $link = ''; + $address_list[$message_id][] = $link . $recipient_list[$type][$ug_id]['name'] . (($link) ? '' : ''); + } + } + } + } + + return $address_list; +} diff --git a/install/update/old/includes/functions_transfer.php b/install/update/old/includes/functions_transfer.php new file mode 100644 index 0000000..7427b89 --- /dev/null +++ b/install/update/old/includes/functions_transfer.php @@ -0,0 +1,899 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Transfer class, wrapper for ftp/sftp/ssh +*/ +class transfer +{ + var $connection; + var $host; + var $port; + var $username; + var $password; + var $timeout; + var $root_path; + var $tmp_path; + var $file_perms; + var $dir_perms; + + /** + * Constructor - init some basic values + */ + function __construct() + { + global $phpbb_root_path; + + $this->file_perms = 0644; + $this->dir_perms = 0777; + + // We use the store directory as temporary path to circumvent open basedir restrictions + $this->tmp_path = $phpbb_root_path . 'store/'; + } + + /** + * Write file to location + */ + function write_file($destination_file = '', $contents = '') + { + global $phpbb_root_path; + + $destination_file = $this->root_path . str_replace($phpbb_root_path, '', $destination_file); + + // need to create a temp file and then move that temp file. + // ftp functions can only move files around and can't create. + // This means that the users will need to have access to write + // temporary files or have write access on a folder within phpBB + // like the cache folder. If the user can't do either, then + // he/she needs to use the fsock ftp method + $temp_name = tempnam($this->tmp_path, 'transfer_'); + @unlink($temp_name); + + $fp = @fopen($temp_name, 'w'); + + if (!$fp) + { + trigger_error('Unable to create temporary file ' . $temp_name, E_USER_ERROR); + } + + @fwrite($fp, $contents); + @fclose($fp); + + $result = $this->overwrite_file($temp_name, $destination_file); + + // remove temporary file now + @unlink($temp_name); + + return $result; + } + + /** + * Moving file into location. If the destination file already exists it gets overwritten + */ + function overwrite_file($source_file, $destination_file) + { + /** + * @todo generally think about overwriting files in another way, by creating a temporary file and then renaming it + * @todo check for the destination file existance too + */ + $this->_delete($destination_file); + $result = $this->_put($source_file, $destination_file); + $this->_chmod($destination_file, $this->file_perms); + + return $result; + } + + /** + * Create directory structure + */ + function make_dir($dir) + { + global $phpbb_root_path; + + $dir = str_replace($phpbb_root_path, '', $dir); + $dir = explode('/', $dir); + $dirs = ''; + + for ($i = 0, $total = count($dir); $i < $total; $i++) + { + $result = true; + + if (strpos($dir[$i], '.') === 0) + { + continue; + } + $cur_dir = $dir[$i] . '/'; + + if (!file_exists($phpbb_root_path . $dirs . $cur_dir)) + { + // create the directory + $result = $this->_mkdir($dir[$i]); + $this->_chmod($dir[$i], $this->dir_perms); + } + + $this->_chdir($this->root_path . $dirs . $dir[$i]); + $dirs .= $cur_dir; + } + + $this->_chdir($this->root_path); + + /** + * @todo stack result into array to make sure every path creation has been taken care of + */ + return $result; + } + + /** + * Copy file from source location to destination location + */ + function copy_file($from_loc, $to_loc) + { + global $phpbb_root_path; + + $from_loc = ((strpos($from_loc, $phpbb_root_path) !== 0) ? $phpbb_root_path : '') . $from_loc; + $to_loc = $this->root_path . str_replace($phpbb_root_path, '', $to_loc); + + if (!file_exists($from_loc)) + { + return false; + } + + $result = $this->overwrite_file($from_loc, $to_loc); + + return $result; + } + + /** + * Remove file + */ + function delete_file($file) + { + global $phpbb_root_path; + + $file = $this->root_path . str_replace($phpbb_root_path, '', $file); + + return $this->_delete($file); + } + + /** + * Remove directory + * @todo remove child directories? + */ + function remove_dir($dir) + { + global $phpbb_root_path; + + $dir = $this->root_path . str_replace($phpbb_root_path, '', $dir); + + return $this->_rmdir($dir); + } + + /** + * Rename a file or folder + */ + function rename($old_handle, $new_handle) + { + global $phpbb_root_path; + + $old_handle = $this->root_path . str_replace($phpbb_root_path, '', $old_handle); + + return $this->_rename($old_handle, $new_handle); + } + + /** + * Check if a specified file exist... + */ + function file_exists($directory, $filename) + { + global $phpbb_root_path; + + $directory = $this->root_path . str_replace($phpbb_root_path, '', $directory); + + $this->_chdir($directory); + $result = $this->_ls(); + + if ($result !== false && is_array($result)) + { + return (in_array($filename, $result)) ? true : false; + } + + return false; + } + + /** + * Open session + */ + function open_session() + { + return $this->_init(); + } + + /** + * Close current session + */ + function close_session() + { + return $this->_close(); + } + + /** + * Determine methods able to be used + */ + static public function methods() + { + $methods = array(); + $disabled_functions = explode(',', @ini_get('disable_functions')); + + if (@extension_loaded('ftp')) + { + $methods[] = 'ftp'; + } + + if (!in_array('fsockopen', $disabled_functions)) + { + $methods[] = 'ftp_fsock'; + } + + return $methods; + } +} + +/** +* FTP transfer class +*/ +class ftp extends transfer +{ + /** + * Standard parameters for FTP session + */ + function __construct($host, $username, $password, $root_path, $port = 21, $timeout = 10) + { + $this->host = $host; + $this->port = $port; + $this->username = $username; + $this->password = $password; + $this->timeout = $timeout; + + // Make sure $this->root_path is layed out the same way as the $user->page['root_script_path'] value (/ at the end) + $this->root_path = str_replace('\\', '/', $this->root_path); + + if (!empty($root_path)) + { + $this->root_path = (($root_path[0] != '/' ) ? '/' : '') . $root_path . ((substr($root_path, -1, 1) == '/') ? '' : '/'); + } + + // Init some needed values + $this->transfer(); + + return; + } + + /** + * Requests data + */ + static public function data() + { + global $user; + + return array( + 'host' => 'localhost', + 'username' => 'anonymous', + 'password' => '', + 'root_path' => $user->page['root_script_path'], + 'port' => 21, + 'timeout' => 10 + ); + } + + /** + * Init FTP Session + * @access private + */ + function _init() + { + // connect to the server + $this->connection = @ftp_connect($this->host, $this->port, $this->timeout); + + if (!$this->connection) + { + return 'ERR_CONNECTING_SERVER'; + } + + // login to the server + if (!@ftp_login($this->connection, $this->username, $this->password)) + { + return 'ERR_UNABLE_TO_LOGIN'; + } + + // attempt to turn pasv mode on + @ftp_pasv($this->connection, true); + + // change to the root directory + if (!$this->_chdir($this->root_path)) + { + return 'ERR_CHANGING_DIRECTORY'; + } + + return true; + } + + /** + * Create Directory (MKDIR) + * @access private + */ + function _mkdir($dir) + { + return @ftp_mkdir($this->connection, $dir); + } + + /** + * Remove directory (RMDIR) + * @access private + */ + function _rmdir($dir) + { + return @ftp_rmdir($this->connection, $dir); + } + + /** + * Rename file + * @access private + */ + function _rename($old_handle, $new_handle) + { + return @ftp_rename($this->connection, $old_handle, $new_handle); + } + + /** + * Change current working directory (CHDIR) + * @access private + */ + function _chdir($dir = '') + { + if ($dir && $dir !== '/') + { + if (substr($dir, -1, 1) == '/') + { + $dir = substr($dir, 0, -1); + } + } + + return @ftp_chdir($this->connection, $dir); + } + + /** + * change file permissions (CHMOD) + * @access private + */ + function _chmod($file, $perms) + { + if (function_exists('ftp_chmod')) + { + $err = @ftp_chmod($this->connection, $perms, $file); + } + else + { + // Unfortunatly CHMOD is not expecting an octal value... + // We need to transform the integer (which was an octal) to an octal representation (to get the int) and then pass as is. ;) + $chmod_cmd = 'CHMOD ' . base_convert($perms, 10, 8) . ' ' . $file; + $err = $this->_site($chmod_cmd); + } + + return $err; + } + + /** + * Upload file to location (PUT) + * @access private + */ + function _put($from_file, $to_file) + { + // We only use the BINARY file mode to cicumvent rewrite actions from ftp server (mostly linefeeds being replaced) + $mode = FTP_BINARY; + + $to_dir = dirname($to_file); + $to_file = basename($to_file); + $this->_chdir($to_dir); + + $result = @ftp_put($this->connection, $to_file, $from_file, $mode); + $this->_chdir($this->root_path); + + return $result; + } + + /** + * Delete file (DELETE) + * @access private + */ + function _delete($file) + { + return @ftp_delete($this->connection, $file); + } + + /** + * Close ftp session (CLOSE) + * @access private + */ + function _close() + { + if (!$this->connection) + { + return false; + } + + return @ftp_quit($this->connection); + } + + /** + * Return current working directory (CWD) + * At the moment not used by parent class + * @access private + */ + function _cwd() + { + return @ftp_pwd($this->connection); + } + + /** + * Return list of files in a given directory (LS) + * @access private + */ + function _ls($dir = './') + { + $list = @ftp_nlist($this->connection, $dir); + + // See bug #46295 - Some FTP daemons don't like './' + if ($dir === './') + { + // Let's try some alternatives + $list = (empty($list)) ? @ftp_nlist($this->connection, '.') : $list; + $list = (empty($list)) ? @ftp_nlist($this->connection, '') : $list; + } + + // Return on error + if ($list === false) + { + return false; + } + + // Remove path if prepended + foreach ($list as $key => $item) + { + // Use same separator for item and dir + $item = str_replace('\\', '/', $item); + $dir = str_replace('\\', '/', $dir); + + if (!empty($dir) && strpos($item, $dir) === 0) + { + $item = substr($item, strlen($dir)); + } + + $list[$key] = $item; + } + + return $list; + } + + /** + * FTP SITE command (ftp-only function) + * @access private + */ + function _site($command) + { + return @ftp_site($this->connection, $command); + } +} + +/** +* FTP fsock transfer class +*/ +class ftp_fsock extends transfer +{ + var $data_connection; + + /** + * Standard parameters for FTP session + */ + function __construct($host, $username, $password, $root_path, $port = 21, $timeout = 10) + { + $this->host = $host; + $this->port = $port; + $this->username = $username; + $this->password = $password; + $this->timeout = $timeout; + + // Make sure $this->root_path is layed out the same way as the $user->page['root_script_path'] value (/ at the end) + $this->root_path = str_replace('\\', '/', $this->root_path); + + if (!empty($root_path)) + { + $this->root_path = (($root_path[0] != '/' ) ? '/' : '') . $root_path . ((substr($root_path, -1, 1) == '/') ? '' : '/'); + } + + // Init some needed values + parent::__construct(); + + return; + } + + /** + * Requests data + */ + static public function data() + { + global $user; + + return array( + 'host' => 'localhost', + 'username' => 'anonymous', + 'password' => '', + 'root_path' => $user->page['root_script_path'], + 'port' => 21, + 'timeout' => 10 + ); + } + + /** + * Init FTP Session + * @access private + */ + function _init() + { + $errno = 0; + $errstr = ''; + + // connect to the server + $this->connection = @fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout); + + if (!$this->connection || !$this->_check_command()) + { + return 'ERR_CONNECTING_SERVER'; + } + + @stream_set_timeout($this->connection, $this->timeout); + + // login + if (!$this->_send_command('USER', $this->username)) + { + return 'ERR_UNABLE_TO_LOGIN'; + } + + if (!$this->_send_command('PASS', $this->password)) + { + return 'ERR_UNABLE_TO_LOGIN'; + } + + // change to the root directory + if (!$this->_chdir($this->root_path)) + { + return 'ERR_CHANGING_DIRECTORY'; + } + + return true; + } + + /** + * Create Directory (MKDIR) + * @access private + */ + function _mkdir($dir) + { + return $this->_send_command('MKD', $dir); + } + + /** + * Remove directory (RMDIR) + * @access private + */ + function _rmdir($dir) + { + return $this->_send_command('RMD', $dir); + } + + /** + * Rename File + * @access private + */ + function _rename($old_handle, $new_handle) + { + $this->_send_command('RNFR', $old_handle); + return $this->_send_command('RNTO', $new_handle); + } + + /** + * Change current working directory (CHDIR) + * @access private + */ + function _chdir($dir = '') + { + if ($dir && $dir !== '/') + { + if (substr($dir, -1, 1) == '/') + { + $dir = substr($dir, 0, -1); + } + } + + return $this->_send_command('CWD', $dir); + } + + /** + * change file permissions (CHMOD) + * @access private + */ + function _chmod($file, $perms) + { + // Unfortunatly CHMOD is not expecting an octal value... + // We need to transform the integer (which was an octal) to an octal representation (to get the int) and then pass as is. ;) + return $this->_send_command('SITE CHMOD', base_convert($perms, 10, 8) . ' ' . $file); + } + + /** + * Upload file to location (PUT) + * @access private + */ + function _put($from_file, $to_file) + { + // We only use the BINARY file mode to cicumvent rewrite actions from ftp server (mostly linefeeds being replaced) + // 'I' == BINARY + // 'A' == ASCII + if (!$this->_send_command('TYPE', 'I')) + { + return false; + } + + // open the connection to send file over + if (!$this->_open_data_connection()) + { + return false; + } + + $this->_send_command('STOR', $to_file, false); + + // send the file + $fp = @fopen($from_file, 'rb'); + while (!@feof($fp)) + { + @fwrite($this->data_connection, @fread($fp, 4096)); + } + @fclose($fp); + + // close connection + $this->_close_data_connection(); + + return $this->_check_command(); + } + + /** + * Delete file (DELETE) + * @access private + */ + function _delete($file) + { + return $this->_send_command('DELE', $file); + } + + /** + * Close ftp session (CLOSE) + * @access private + */ + function _close() + { + if (!$this->connection) + { + return false; + } + + return $this->_send_command('QUIT'); + } + + /** + * Return current working directory (CWD) + * At the moment not used by parent class + * @access private + */ + function _cwd() + { + $this->_send_command('PWD', '', false); + return preg_replace('#^[0-9]{3} "(.+)" .+\r\n#', '\\1', $this->_check_command(true)); + } + + /** + * Return list of files in a given directory (LS) + * @access private + */ + function _ls($dir = './') + { + if (!$this->_open_data_connection()) + { + return false; + } + + $this->_send_command('NLST', $dir); + + $list = array(); + while (!@feof($this->data_connection)) + { + $filename = preg_replace('#[\r\n]#', '', @fgets($this->data_connection, 512)); + + if ($filename !== '') + { + $list[] = $filename; + } + } + $this->_close_data_connection(); + + // Clear buffer + $this->_check_command(); + + // See bug #46295 - Some FTP daemons don't like './' + if ($dir === './' && empty($list)) + { + // Let's try some alternatives + $list = $this->_ls('.'); + + if (empty($list)) + { + $list = $this->_ls(''); + } + + return $list; + } + + // Remove path if prepended + foreach ($list as $key => $item) + { + // Use same separator for item and dir + $item = str_replace('\\', '/', $item); + $dir = str_replace('\\', '/', $dir); + + if (!empty($dir) && strpos($item, $dir) === 0) + { + $item = substr($item, strlen($dir)); + } + + $list[$key] = $item; + } + + return $list; + } + + /** + * Send a command to server (FTP fsock only function) + * @access private + */ + function _send_command($command, $args = '', $check = true) + { + if (!empty($args)) + { + $command = "$command $args"; + } + + fwrite($this->connection, $command . "\r\n"); + + if ($check === true && !$this->_check_command()) + { + return false; + } + + return true; + } + + /** + * Opens a connection to send data (FTP fosck only function) + * @access private + */ + function _open_data_connection() + { + // Try to find out whether we have a IPv4 or IPv6 (control) connection + if (function_exists('stream_socket_get_name')) + { + $socket_name = stream_socket_get_name($this->connection, true); + $server_ip = substr($socket_name, 0, strrpos($socket_name, ':')); + } + + if (!isset($server_ip) || preg_match(get_preg_expression('ipv4'), $server_ip)) + { + // Passive mode + $this->_send_command('PASV', '', false); + + if (!$ip_port = $this->_check_command(true)) + { + return false; + } + + // open the connection to start sending the file + if (!preg_match('#[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+#', $ip_port, $temp)) + { + // bad ip and port + return false; + } + + $temp = explode(',', $temp[0]); + $server_ip = $temp[0] . '.' . $temp[1] . '.' . $temp[2] . '.' . $temp[3]; + $server_port = $temp[4] * 256 + $temp[5]; + } + else + { + // Extended Passive Mode - RFC2428 + $this->_send_command('EPSV', '', false); + + if (!$epsv_response = $this->_check_command(true)) + { + return false; + } + + // Response looks like "229 Entering Extended Passive Mode (|||12345|)" + // where 12345 is the tcp port for the data connection + if (!preg_match('#\(\|\|\|([0-9]+)\|\)#', $epsv_response, $match)) + { + return false; + } + $server_port = (int) $match[1]; + + // fsockopen expects IPv6 address in square brackets + $server_ip = "[$server_ip]"; + } + + $errno = 0; + $errstr = ''; + + if (!$this->data_connection = @fsockopen($server_ip, $server_port, $errno, $errstr, $this->timeout)) + { + return false; + } + @stream_set_timeout($this->data_connection, $this->timeout); + + return true; + } + + /** + * Closes a connection used to send data + * @access private + */ + function _close_data_connection() + { + return @fclose($this->data_connection); + } + + /** + * Check to make sure command was successful (FTP fsock only function) + * @access private + */ + function _check_command($return = false) + { + $response = ''; + + do + { + $result = @fgets($this->connection, 512); + $response .= $result; + } + while (substr($result, 3, 1) !== ' '); + + if (!preg_match('#^[123]#', $response)) + { + return false; + } + + return ($return) ? $response : true; + } +} diff --git a/install/update/old/includes/functions_user.php b/install/update/old/includes/functions_user.php new file mode 100644 index 0000000..fb9241d --- /dev/null +++ b/install/update/old/includes/functions_user.php @@ -0,0 +1,3759 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Obtain user_ids from usernames or vice versa. Returns false on +* success else the error string +* +* @param array &$user_id_ary The user ids to check or empty if usernames used +* @param array &$username_ary The usernames to check or empty if user ids used +* @param mixed $user_type Array of user types to check, false if not restricting by user type +* @param boolean $update_references If false, the supplied array is unset and appears unchanged from where it was called +* @return boolean|string Returns false on success, error string on failure +*/ +function user_get_id_name(&$user_id_ary, &$username_ary, $user_type = false, $update_references = false) +{ + global $db; + + // Are both arrays already filled? Yep, return else + // are neither array filled? + if ($user_id_ary && $username_ary) + { + return false; + } + else if (!$user_id_ary && !$username_ary) + { + return 'NO_USERS'; + } + + $which_ary = ($user_id_ary) ? 'user_id_ary' : 'username_ary'; + + if (${$which_ary} && !is_array(${$which_ary})) + { + ${$which_ary} = array(${$which_ary}); + } + + $sql_in = ($which_ary == 'user_id_ary') ? array_map('intval', ${$which_ary}) : array_map('utf8_clean_string', ${$which_ary}); + + // By unsetting the array here, the values passed in at the point user_get_id_name() was called will be retained. + // Otherwise, if we don't unset (as the array was passed by reference) the original array will be updated below. + if ($update_references === false) + { + unset(${$which_ary}); + } + + $user_id_ary = $username_ary = array(); + + // Grab the user id/username records + $sql_where = ($which_ary == 'user_id_ary') ? 'user_id' : 'username_clean'; + $sql = 'SELECT user_id, username + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set($sql_where, $sql_in); + + if ($user_type !== false && !empty($user_type)) + { + $sql .= ' AND ' . $db->sql_in_set('user_type', $user_type); + } + + $result = $db->sql_query($sql); + + if (!($row = $db->sql_fetchrow($result))) + { + $db->sql_freeresult($result); + return 'NO_USERS'; + } + + do + { + $username_ary[$row['user_id']] = $row['username']; + $user_id_ary[] = $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + $db->sql_freeresult($result); + + return false; +} + +/** +* Get latest registered username and update database to reflect it +*/ +function update_last_username() +{ + global $config, $db; + + // Get latest username + $sql = 'SELECT user_id, username, user_colour + FROM ' . USERS_TABLE . ' + WHERE user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ') + ORDER BY user_id DESC'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $config->set('newest_user_id', $row['user_id'], false); + $config->set('newest_username', $row['username'], false); + $config->set('newest_user_colour', $row['user_colour'], false); + } +} + +/** +* Updates a username across all relevant tables/fields +* +* @param string $old_name the old/current username +* @param string $new_name the new username +*/ +function user_update_name($old_name, $new_name) +{ + global $config, $db, $cache, $phpbb_dispatcher; + + $update_ary = array( + FORUMS_TABLE => array( + 'forum_last_poster_id' => 'forum_last_poster_name', + ), + MODERATOR_CACHE_TABLE => array( + 'user_id' => 'username', + ), + POSTS_TABLE => array( + 'poster_id' => 'post_username', + ), + TOPICS_TABLE => array( + 'topic_poster' => 'topic_first_poster_name', + 'topic_last_poster_id' => 'topic_last_poster_name', + ), + ); + + foreach ($update_ary as $table => $field_ary) + { + foreach ($field_ary as $id_field => $name_field) + { + $sql = "UPDATE $table + SET $name_field = '" . $db->sql_escape($new_name) . "' + WHERE $name_field = '" . $db->sql_escape($old_name) . "' + AND $id_field <> " . ANONYMOUS; + $db->sql_query($sql); + } + } + + if ($config['newest_username'] == $old_name) + { + $config->set('newest_username', $new_name, false); + } + + /** + * Update a username when it is changed + * + * @event core.update_username + * @var string old_name The old username that is replaced + * @var string new_name The new username + * @since 3.1.0-a1 + */ + $vars = array('old_name', 'new_name'); + extract($phpbb_dispatcher->trigger_event('core.update_username', compact($vars))); + + // Because some tables/caches use username-specific data we need to purge this here. + $cache->destroy('sql', MODERATOR_CACHE_TABLE); +} + +/** +* Adds an user +* +* @param mixed $user_row An array containing the following keys (and the appropriate values): username, group_id (the group to place the user in), user_email and the user_type(usually 0). Additional entries not overridden by defaults will be forwarded. +* @param array $cp_data custom profile fields, see custom_profile::build_insert_sql_array +* @param array $notifications_data The notifications settings for the new user +* @return the new user's ID. +*/ +function user_add($user_row, $cp_data = false, $notifications_data = null) +{ + global $db, $config; + global $phpbb_dispatcher, $phpbb_container; + + if (empty($user_row['username']) || !isset($user_row['group_id']) || !isset($user_row['user_email']) || !isset($user_row['user_type'])) + { + return false; + } + + $username_clean = utf8_clean_string($user_row['username']); + + if (empty($username_clean)) + { + return false; + } + + $sql_ary = array( + 'username' => $user_row['username'], + 'username_clean' => $username_clean, + 'user_password' => (isset($user_row['user_password'])) ? $user_row['user_password'] : '', + 'user_email' => strtolower($user_row['user_email']), + 'user_email_hash' => phpbb_email_hash($user_row['user_email']), + 'group_id' => $user_row['group_id'], + 'user_type' => $user_row['user_type'], + ); + + // These are the additional vars able to be specified + $additional_vars = array( + 'user_permissions' => '', + 'user_timezone' => $config['board_timezone'], + 'user_dateformat' => $config['default_dateformat'], + 'user_lang' => $config['default_lang'], + 'user_style' => (int) $config['default_style'], + 'user_actkey' => '', + 'user_ip' => '', + 'user_regdate' => time(), + 'user_passchg' => time(), + 'user_options' => 230271, + // We do not set the new flag here - registration scripts need to specify it + 'user_new' => 0, + + 'user_inactive_reason' => 0, + 'user_inactive_time' => 0, + 'user_lastmark' => time(), + 'user_lastvisit' => 0, + 'user_lastpost_time' => 0, + 'user_lastpage' => '', + 'user_posts' => 0, + 'user_colour' => '', + 'user_avatar' => '', + 'user_avatar_type' => '', + 'user_avatar_width' => 0, + 'user_avatar_height' => 0, + 'user_new_privmsg' => 0, + 'user_unread_privmsg' => 0, + 'user_last_privmsg' => 0, + 'user_message_rules' => 0, + 'user_full_folder' => PRIVMSGS_NO_BOX, + 'user_emailtime' => 0, + + 'user_notify' => 0, + 'user_notify_pm' => 1, + 'user_notify_type' => NOTIFY_EMAIL, + 'user_allow_pm' => 1, + 'user_allow_viewonline' => 1, + 'user_allow_viewemail' => 1, + 'user_allow_massemail' => 1, + + 'user_sig' => '', + 'user_sig_bbcode_uid' => '', + 'user_sig_bbcode_bitfield' => '', + + 'user_form_salt' => unique_id(), + ); + + // Now fill the sql array with not required variables + foreach ($additional_vars as $key => $default_value) + { + $sql_ary[$key] = (isset($user_row[$key])) ? $user_row[$key] : $default_value; + } + + // Any additional variables in $user_row not covered above? + $remaining_vars = array_diff(array_keys($user_row), array_keys($sql_ary)); + + // Now fill our sql array with the remaining vars + if (count($remaining_vars)) + { + foreach ($remaining_vars as $key) + { + $sql_ary[$key] = $user_row[$key]; + } + } + + /** + * Use this event to modify the values to be inserted when a user is added + * + * @event core.user_add_modify_data + * @var array user_row Array of user details submitted to user_add + * @var array cp_data Array of Custom profile fields submitted to user_add + * @var array sql_ary Array of data to be inserted when a user is added + * @var array notifications_data Array of notification data to be inserted when a user is added + * @since 3.1.0-a1 + * @changed 3.1.0-b5 Added user_row and cp_data + * @changed 3.1.11-RC1 Added notifications_data + */ + $vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data'); + extract($phpbb_dispatcher->trigger_event('core.user_add_modify_data', compact($vars))); + + $sql = 'INSERT INTO ' . USERS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + + $user_id = $db->sql_nextid(); + + // Insert Custom Profile Fields + if ($cp_data !== false && count($cp_data)) + { + $cp_data['user_id'] = (int) $user_id; + + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + $sql = 'INSERT INTO ' . PROFILE_FIELDS_DATA_TABLE . ' ' . + $db->sql_build_array('INSERT', $cp->build_insert_sql_array($cp_data)); + $db->sql_query($sql); + } + + // Place into appropriate group... + $sql = 'INSERT INTO ' . USER_GROUP_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'user_id' => (int) $user_id, + 'group_id' => (int) $user_row['group_id'], + 'user_pending' => 0) + ); + $db->sql_query($sql); + + // Now make it the users default group... + group_set_user_default($user_row['group_id'], array($user_id), false); + + // Add to newly registered users group if user_new is 1 + if ($config['new_member_post_limit'] && $sql_ary['user_new']) + { + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'NEWLY_REGISTERED' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $add_group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if ($add_group_id) + { + global $phpbb_log; + + // Because these actions only fill the log unnecessarily, we disable it + $phpbb_log->disable('admin'); + + // Add user to "newly registered users" group and set to default group if admin specified so. + if ($config['new_member_group_default']) + { + group_user_add($add_group_id, $user_id, false, false, true); + $user_row['group_id'] = $add_group_id; + } + else + { + group_user_add($add_group_id, $user_id); + } + + $phpbb_log->enable('admin'); + } + } + + // set the newest user and adjust the user count if the user is a normal user and no activation mail is sent + if ($user_row['user_type'] == USER_NORMAL || $user_row['user_type'] == USER_FOUNDER) + { + $config->set('newest_user_id', $user_id, false); + $config->set('newest_username', $user_row['username'], false); + $config->increment('num_users', 1, false); + + $sql = 'SELECT group_colour + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $user_row['group_id']; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $config->set('newest_user_colour', $row['group_colour'], false); + } + + // Use default notifications settings if notifications_data is not set + if ($notifications_data === null) + { + $notifications_data = array( + array( + 'item_type' => 'notification.type.post', + 'method' => 'notification.method.email', + ), + array( + 'item_type' => 'notification.type.topic', + 'method' => 'notification.method.email', + ), + ); + } + + /** + * Modify the notifications data to be inserted in the database when a user is added + * + * @event core.user_add_modify_notifications_data + * @var array user_row Array of user details submitted to user_add + * @var array cp_data Array of Custom profile fields submitted to user_add + * @var array sql_ary Array of data to be inserted when a user is added + * @var array notifications_data Array of notification data to be inserted when a user is added + * @since 3.2.2-RC1 + */ + $vars = array('user_row', 'cp_data', 'sql_ary', 'notifications_data'); + extract($phpbb_dispatcher->trigger_event('core.user_add_modify_notifications_data', compact($vars))); + + // Subscribe user to notifications if necessary + if (!empty($notifications_data)) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + foreach ($notifications_data as $subscription) + { + $phpbb_notifications->add_subscription($subscription['item_type'], 0, $subscription['method'], $user_id); + } + } + + /** + * Event that returns user id, user details and user CPF of newly registered user + * + * @event core.user_add_after + * @var int user_id User id of newly registered user + * @var array user_row Array of user details submitted to user_add + * @var array cp_data Array of Custom profile fields submitted to user_add + * @since 3.1.0-b5 + */ + $vars = array('user_id', 'user_row', 'cp_data'); + extract($phpbb_dispatcher->trigger_event('core.user_add_after', compact($vars))); + + return $user_id; +} + +/** + * Remove User + * + * @param string $mode Either 'retain' or 'remove' + * @param mixed $user_ids Either an array of integers or an integer + * @param bool $retain_username + * @return bool + */ +function user_delete($mode, $user_ids, $retain_username = true) +{ + global $cache, $config, $db, $user, $phpbb_dispatcher, $phpbb_container; + global $phpbb_root_path, $phpEx; + + $db->sql_transaction('begin'); + + $user_rows = array(); + if (!is_array($user_ids)) + { + $user_ids = array($user_ids); + } + + $user_id_sql = $db->sql_in_set('user_id', $user_ids); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE ' . $user_id_sql; + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $user_rows[(int) $row['user_id']] = $row; + } + $db->sql_freeresult($result); + + if (empty($user_rows)) + { + return false; + } + + /** + * Event before a user is deleted + * + * @event core.delete_user_before + * @var string mode Mode of deletion (retain/delete posts) + * @var array user_ids IDs of the deleted user + * @var mixed retain_username True if username should be retained + * or false if not + * @var array user_rows Array containing data of the deleted users + * @since 3.1.0-a1 + * @changed 3.2.4-RC1 Added user_rows + */ + $vars = array('mode', 'user_ids', 'retain_username', 'user_rows'); + extract($phpbb_dispatcher->trigger_event('core.delete_user_before', compact($vars))); + + // Before we begin, we will remove the reports the user issued. + $sql = 'SELECT r.post_id, p.topic_id + FROM ' . REPORTS_TABLE . ' r, ' . POSTS_TABLE . ' p + WHERE ' . $db->sql_in_set('r.user_id', $user_ids) . ' + AND p.post_id = r.post_id'; + $result = $db->sql_query($sql); + + $report_posts = $report_topics = array(); + while ($row = $db->sql_fetchrow($result)) + { + $report_posts[] = $row['post_id']; + $report_topics[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (count($report_posts)) + { + $report_posts = array_unique($report_posts); + $report_topics = array_unique($report_topics); + + // Get a list of topics that still contain reported posts + $sql = 'SELECT DISTINCT topic_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $report_topics) . ' + AND post_reported = 1 + AND ' . $db->sql_in_set('post_id', $report_posts, true); + $result = $db->sql_query($sql); + + $keep_report_topics = array(); + while ($row = $db->sql_fetchrow($result)) + { + $keep_report_topics[] = $row['topic_id']; + } + $db->sql_freeresult($result); + + if (count($keep_report_topics)) + { + $report_topics = array_diff($report_topics, $keep_report_topics); + } + unset($keep_report_topics); + + // Now set the flags back + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_reported = 0 + WHERE ' . $db->sql_in_set('post_id', $report_posts); + $db->sql_query($sql); + + if (count($report_topics)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_reported = 0 + WHERE ' . $db->sql_in_set('topic_id', $report_topics); + $db->sql_query($sql); + } + } + + // Remove reports + $db->sql_query('DELETE FROM ' . REPORTS_TABLE . ' WHERE ' . $user_id_sql); + + $num_users_delta = 0; + + // Get auth provider collection in case accounts might need to be unlinked + $provider_collection = $phpbb_container->get('auth.provider_collection'); + + // Some things need to be done in the loop (if the query changes based + // on which user is currently being deleted) + $added_guest_posts = 0; + foreach ($user_rows as $user_id => $user_row) + { + if ($user_row['user_avatar'] && $user_row['user_avatar_type'] == 'avatar.driver.upload') + { + avatar_delete('user', $user_row); + } + + // Unlink accounts + foreach ($provider_collection as $provider_name => $auth_provider) + { + $provider_data = $auth_provider->get_auth_link_data($user_id); + + if ($provider_data !== null) + { + $link_data = array( + 'user_id' => $user_id, + 'link_method' => 'user_delete', + ); + + // BLOCK_VARS might contain hidden fields necessary for unlinking accounts + if (isset($provider_data['BLOCK_VARS']) && is_array($provider_data['BLOCK_VARS'])) + { + foreach ($provider_data['BLOCK_VARS'] as $provider_service) + { + if (!array_key_exists('HIDDEN_FIELDS', $provider_service)) + { + $provider_service['HIDDEN_FIELDS'] = array(); + } + + $auth_provider->unlink_account(array_merge($link_data, $provider_service['HIDDEN_FIELDS'])); + } + } + else + { + $auth_provider->unlink_account($link_data); + } + } + } + + // Decrement number of users if this user is active + if ($user_row['user_type'] != USER_INACTIVE && $user_row['user_type'] != USER_IGNORE) + { + --$num_users_delta; + } + + switch ($mode) + { + case 'retain': + if ($retain_username === false) + { + $post_username = $user->lang['GUEST']; + } + else + { + $post_username = $user_row['username']; + } + + // If the user is inactive and newly registered + // we assume no posts from the user, and save + // the queries + if ($user_row['user_type'] != USER_INACTIVE || $user_row['user_inactive_reason'] != INACTIVE_REGISTER || $user_row['user_posts']) + { + // When we delete these users and retain the posts, we must assign all the data to the guest user + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_last_poster_id = ' . ANONYMOUS . ", forum_last_poster_name = '" . $db->sql_escape($post_username) . "', forum_last_poster_colour = '' + WHERE forum_last_poster_id = $user_id"; + $db->sql_query($sql); + + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET poster_id = ' . ANONYMOUS . ", post_username = '" . $db->sql_escape($post_username) . "' + WHERE poster_id = $user_id"; + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_poster = ' . ANONYMOUS . ", topic_first_poster_name = '" . $db->sql_escape($post_username) . "', topic_first_poster_colour = '' + WHERE topic_poster = $user_id"; + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_last_poster_id = ' . ANONYMOUS . ", topic_last_poster_name = '" . $db->sql_escape($post_username) . "', topic_last_poster_colour = '' + WHERE topic_last_poster_id = $user_id"; + $db->sql_query($sql); + + // Since we change every post by this author, we need to count this amount towards the anonymous user + + if ($user_row['user_posts']) + { + $added_guest_posts += $user_row['user_posts']; + } + } + break; + + case 'remove': + // there is nothing variant specific to deleting posts + break; + } + } + + if ($num_users_delta != 0) + { + $config->increment('num_users', $num_users_delta, false); + } + + // Now do the invariant tasks + // all queries performed in one call of this function are in a single transaction + // so this is kosher + if ($mode == 'retain') + { + // Assign more data to the Anonymous user + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET poster_id = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('poster_id', $user_ids); + $db->sql_query($sql); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts + ' . $added_guest_posts . ' + WHERE user_id = ' . ANONYMOUS; + $db->sql_query($sql); + } + else if ($mode == 'remove') + { + if (!function_exists('delete_posts')) + { + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + + // Delete posts, attachments, etc. + // delete_posts can handle any number of IDs in its second argument + delete_posts('poster_id', $user_ids); + } + + $table_ary = [ + USERS_TABLE, + USER_GROUP_TABLE, + TOPICS_WATCH_TABLE, + FORUMS_WATCH_TABLE, + ACL_USERS_TABLE, + TOPICS_TRACK_TABLE, + TOPICS_POSTED_TABLE, + FORUMS_TRACK_TABLE, + PROFILE_FIELDS_DATA_TABLE, + MODERATOR_CACHE_TABLE, + DRAFTS_TABLE, + BOOKMARKS_TABLE, + SESSIONS_KEYS_TABLE, + PRIVMSGS_FOLDER_TABLE, + PRIVMSGS_RULES_TABLE, + $phpbb_container->getParameter('tables.auth_provider_oauth_token_storage'), + $phpbb_container->getParameter('tables.auth_provider_oauth_states'), + $phpbb_container->getParameter('tables.auth_provider_oauth_account_assoc'), + $phpbb_container->getParameter('tables.user_notifications') + ]; + + // Ignore errors on deleting from non-existent tables, e.g. when migrating + $db->sql_return_on_error(true); + // Delete the miscellaneous (non-post) data for the user + foreach ($table_ary as $table) + { + $sql = "DELETE FROM $table + WHERE " . $user_id_sql; + $db->sql_query($sql); + } + $db->sql_return_on_error(); + + $cache->destroy('sql', MODERATOR_CACHE_TABLE); + + // Change user_id to anonymous for posts edited by this user + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_edit_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('post_edit_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for pms edited by this user + $sql = 'UPDATE ' . PRIVMSGS_TABLE . ' + SET message_edit_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('message_edit_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for posts deleted by this user + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_delete_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('post_delete_user', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for topics deleted by this user + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_delete_user = ' . ANONYMOUS . ' + WHERE ' . $db->sql_in_set('topic_delete_user', $user_ids); + $db->sql_query($sql); + + // Delete user log entries about this user + $sql = 'DELETE FROM ' . LOG_TABLE . ' + WHERE ' . $db->sql_in_set('reportee_id', $user_ids); + $db->sql_query($sql); + + // Change user_id to anonymous for this users triggered events + $sql = 'UPDATE ' . LOG_TABLE . ' + SET user_id = ' . ANONYMOUS . ' + WHERE ' . $user_id_sql; + $db->sql_query($sql); + + // Delete the user_id from the zebra table + $sql = 'DELETE FROM ' . ZEBRA_TABLE . ' + WHERE ' . $user_id_sql . ' + OR ' . $db->sql_in_set('zebra_id', $user_ids); + $db->sql_query($sql); + + // Delete the user_id from the banlist + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set('ban_userid', $user_ids); + $db->sql_query($sql); + + // Delete the user_id from the session table + $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' + WHERE ' . $db->sql_in_set('session_user_id', $user_ids); + $db->sql_query($sql); + + // Clean the private messages tables from the user + if (!function_exists('phpbb_delete_user_pms')) + { + include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + } + phpbb_delete_users_pms($user_ids); + + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->delete_notifications('notification.type.admin_activate_user', $user_ids); + + $db->sql_transaction('commit'); + + /** + * Event after a user is deleted + * + * @event core.delete_user_after + * @var string mode Mode of deletion (retain/delete posts) + * @var array user_ids IDs of the deleted user + * @var mixed retain_username True if username should be retained + * or false if not + * @var array user_rows Array containing data of the deleted users + * @since 3.1.0-a1 + * @changed 3.2.2-RC1 Added user_rows + */ + $vars = array('mode', 'user_ids', 'retain_username', 'user_rows'); + extract($phpbb_dispatcher->trigger_event('core.delete_user_after', compact($vars))); + + // Reset newest user info if appropriate + if (in_array($config['newest_user_id'], $user_ids)) + { + update_last_username(); + } + + return false; +} + +/** +* Flips user_type from active to inactive and vice versa, handles group membership updates +* +* @param string $mode can be flip for flipping from active/inactive, activate or deactivate +*/ +function user_active_flip($mode, $user_id_ary, $reason = INACTIVE_MANUAL) +{ + global $config, $db, $user, $auth, $phpbb_dispatcher; + + $deactivated = $activated = 0; + $sql_statements = array(); + + if (!is_array($user_id_ary)) + { + $user_id_ary = array($user_id_ary); + } + + if (!count($user_id_ary)) + { + return; + } + + $sql = 'SELECT user_id, group_id, user_type, user_inactive_reason + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary = array(); + + if ($row['user_type'] == USER_IGNORE || $row['user_type'] == USER_FOUNDER || + ($mode == 'activate' && $row['user_type'] != USER_INACTIVE) || + ($mode == 'deactivate' && $row['user_type'] == USER_INACTIVE)) + { + continue; + } + + if ($row['user_type'] == USER_INACTIVE) + { + $activated++; + } + else + { + $deactivated++; + + // Remove the users session key... + $user->reset_login_keys($row['user_id']); + } + + $sql_ary += array( + 'user_type' => ($row['user_type'] == USER_NORMAL) ? USER_INACTIVE : USER_NORMAL, + 'user_inactive_time' => ($row['user_type'] == USER_NORMAL) ? time() : 0, + 'user_inactive_reason' => ($row['user_type'] == USER_NORMAL) ? $reason : 0, + ); + + $sql_statements[$row['user_id']] = $sql_ary; + } + $db->sql_freeresult($result); + + /** + * Check or modify activated/deactivated users data before submitting it to the database + * + * @event core.user_active_flip_before + * @var string mode User type changing mode, can be: flip|activate|deactivate + * @var int reason Reason for changing user type, can be: INACTIVE_REGISTER|INACTIVE_PROFILE|INACTIVE_MANUAL|INACTIVE_REMIND + * @var int activated The number of users to be activated + * @var int deactivated The number of users to be deactivated + * @var array user_id_ary Array with user ids to change user type + * @var array sql_statements Array with users data to submit to the database, keys: user ids, values: arrays with user data + * @since 3.1.4-RC1 + */ + $vars = array('mode', 'reason', 'activated', 'deactivated', 'user_id_ary', 'sql_statements'); + extract($phpbb_dispatcher->trigger_event('core.user_active_flip_before', compact($vars))); + + if (count($sql_statements)) + { + foreach ($sql_statements as $user_id => $sql_ary) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + } + + $auth->acl_clear_prefetch(array_keys($sql_statements)); + } + + /** + * Perform additional actions after the users have been activated/deactivated + * + * @event core.user_active_flip_after + * @var string mode User type changing mode, can be: flip|activate|deactivate + * @var int reason Reason for changing user type, can be: INACTIVE_REGISTER|INACTIVE_PROFILE|INACTIVE_MANUAL|INACTIVE_REMIND + * @var int activated The number of users to be activated + * @var int deactivated The number of users to be deactivated + * @var array user_id_ary Array with user ids to change user type + * @var array sql_statements Array with users data to submit to the database, keys: user ids, values: arrays with user data + * @since 3.1.4-RC1 + */ + $vars = array('mode', 'reason', 'activated', 'deactivated', 'user_id_ary', 'sql_statements'); + extract($phpbb_dispatcher->trigger_event('core.user_active_flip_after', compact($vars))); + + if ($deactivated) + { + $config->increment('num_users', $deactivated * (-1), false); + } + + if ($activated) + { + $config->increment('num_users', $activated, false); + } + + // Update latest username + update_last_username(); +} + +/** +* Add a ban or ban exclusion to the banlist. Bans either a user, an IP or an email address +* +* @param string $mode Type of ban. One of the following: user, ip, email +* @param mixed $ban Banned entity. Either string or array with usernames, ips or email addresses +* @param int $ban_len Ban length in minutes +* @param string $ban_len_other Ban length as a date (YYYY-MM-DD) +* @param boolean $ban_exclude Exclude these entities from banning? +* @param string $ban_reason String describing the reason for this ban +* @return boolean +*/ +function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason, $ban_give_reason = '') +{ + global $db, $user, $cache, $phpbb_log; + + // Delete stale bans + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ban_end < ' . time() . ' + AND ban_end <> 0'; + $db->sql_query($sql); + + $ban_list = (!is_array($ban)) ? array_unique(explode("\n", $ban)) : $ban; + $ban_list_log = implode(', ', $ban_list); + + $current_time = time(); + + // Set $ban_end to the unix time when the ban should end. 0 is a permanent ban. + if ($ban_len) + { + if ($ban_len != -1 || !$ban_len_other) + { + $ban_end = max($current_time, $current_time + ($ban_len) * 60); + } + else + { + $ban_other = explode('-', $ban_len_other); + if (count($ban_other) == 3 && ((int) $ban_other[0] < 9999) && + (strlen($ban_other[0]) == 4) && (strlen($ban_other[1]) == 2) && (strlen($ban_other[2]) == 2)) + { + $ban_end = max($current_time, $user->create_datetime() + ->setDate((int) $ban_other[0], (int) $ban_other[1], (int) $ban_other[2]) + ->setTime(0, 0, 0) + ->getTimestamp() + $user->timezone->getOffset(new DateTime('UTC'))); + } + else + { + trigger_error('LENGTH_BAN_INVALID', E_USER_WARNING); + } + } + } + else + { + $ban_end = 0; + } + + $founder = $founder_names = array(); + + if (!$ban_exclude) + { + // Create a list of founder... + $sql = 'SELECT user_id, user_email, username_clean + FROM ' . USERS_TABLE . ' + WHERE user_type = ' . USER_FOUNDER; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $founder[$row['user_id']] = $row['user_email']; + $founder_names[$row['user_id']] = $row['username_clean']; + } + $db->sql_freeresult($result); + } + + $banlist_ary = array(); + + switch ($mode) + { + case 'user': + $type = 'ban_userid'; + + // At the moment we do not support wildcard username banning + + // Select the relevant user_ids. + $sql_usernames = array(); + + foreach ($ban_list as $username) + { + $username = trim($username); + if ($username != '') + { + $clean_name = utf8_clean_string($username); + if ($clean_name == $user->data['username_clean']) + { + trigger_error('CANNOT_BAN_YOURSELF', E_USER_WARNING); + } + if (in_array($clean_name, $founder_names)) + { + trigger_error('CANNOT_BAN_FOUNDER', E_USER_WARNING); + } + $sql_usernames[] = $clean_name; + } + } + + // Make sure we have been given someone to ban + if (!count($sql_usernames)) + { + trigger_error('NO_USER_SPECIFIED', E_USER_WARNING); + } + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('username_clean', $sql_usernames); + + // Do not allow banning yourself, the guest account, or founders. + $non_bannable = array($user->data['user_id'], ANONYMOUS); + if (count($founder)) + { + $sql .= ' AND ' . $db->sql_in_set('user_id', array_merge(array_keys($founder), $non_bannable), true); + } + else + { + $sql .= ' AND ' . $db->sql_in_set('user_id', $non_bannable, true); + } + + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $banlist_ary[] = (int) $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + } + else + { + $db->sql_freeresult($result); + trigger_error('NO_USERS', E_USER_WARNING); + } + $db->sql_freeresult($result); + break; + + case 'ip': + $type = 'ban_ip'; + + foreach ($ban_list as $ban_item) + { + if (preg_match('#^([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})[ ]*\-[ ]*([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$#', trim($ban_item), $ip_range_explode)) + { + // This is an IP range + // Don't ask about all this, just don't ask ... ! + $ip_1_counter = $ip_range_explode[1]; + $ip_1_end = $ip_range_explode[5]; + + while ($ip_1_counter <= $ip_1_end) + { + $ip_2_counter = ($ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[2] : 0; + $ip_2_end = ($ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[6]; + + if ($ip_2_counter == 0 && $ip_2_end == 254) + { + $ip_2_counter = 256; + + $banlist_ary[] = "$ip_1_counter.*"; + } + + while ($ip_2_counter <= $ip_2_end) + { + $ip_3_counter = ($ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[3] : 0; + $ip_3_end = ($ip_2_counter < $ip_2_end || $ip_1_counter < $ip_1_end) ? 254 : $ip_range_explode[7]; + + if ($ip_3_counter == 0 && $ip_3_end == 254) + { + $ip_3_counter = 256; + + $banlist_ary[] = "$ip_1_counter.$ip_2_counter.*"; + } + + while ($ip_3_counter <= $ip_3_end) + { + $ip_4_counter = ($ip_3_counter == $ip_range_explode[3] && $ip_2_counter == $ip_range_explode[2] && $ip_1_counter == $ip_range_explode[1]) ? $ip_range_explode[4] : 0; + $ip_4_end = ($ip_3_counter < $ip_3_end || $ip_2_counter < $ip_2_end) ? 254 : $ip_range_explode[8]; + + if ($ip_4_counter == 0 && $ip_4_end == 254) + { + $ip_4_counter = 256; + + $banlist_ary[] = "$ip_1_counter.$ip_2_counter.$ip_3_counter.*"; + } + + while ($ip_4_counter <= $ip_4_end) + { + $banlist_ary[] = "$ip_1_counter.$ip_2_counter.$ip_3_counter.$ip_4_counter"; + $ip_4_counter++; + } + $ip_3_counter++; + } + $ip_2_counter++; + } + $ip_1_counter++; + } + } + else if (preg_match('#^([0-9]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})\.([0-9\*]{1,3})$#', trim($ban_item)) || preg_match('#^[a-f0-9:]+\*?$#i', trim($ban_item))) + { + // Normal IP address + $banlist_ary[] = trim($ban_item); + } + else if (preg_match('#^\*$#', trim($ban_item))) + { + // Ban all IPs + $banlist_ary[] = '*'; + } + else if (preg_match('#^([\w\-_]\.?){2,}$#is', trim($ban_item))) + { + // hostname + $ip_ary = gethostbynamel(trim($ban_item)); + + if (!empty($ip_ary)) + { + foreach ($ip_ary as $ip) + { + if ($ip) + { + if (strlen($ip) > 40) + { + continue; + } + + $banlist_ary[] = $ip; + } + } + } + } + + if (empty($banlist_ary)) + { + trigger_error('NO_IPS_DEFINED', E_USER_WARNING); + } + } + break; + + case 'email': + $type = 'ban_email'; + + foreach ($ban_list as $ban_item) + { + $ban_item = trim($ban_item); + + if (preg_match('#^.*?@*|(([a-z0-9\-]+\.)+([a-z]{2,3}))$#i', $ban_item)) + { + if (strlen($ban_item) > 100) + { + continue; + } + + if (!count($founder) || !in_array($ban_item, $founder)) + { + $banlist_ary[] = $ban_item; + } + } + } + + if (count($ban_list) == 0) + { + trigger_error('NO_EMAILS_DEFINED', E_USER_WARNING); + } + break; + + default: + trigger_error('NO_MODE', E_USER_WARNING); + break; + } + + // Fetch currently set bans of the specified type and exclude state. Prevent duplicate bans. + $sql_where = ($type == 'ban_userid') ? 'ban_userid <> 0' : "$type <> ''"; + + $sql = "SELECT $type + FROM " . BANLIST_TABLE . " + WHERE $sql_where + AND ban_exclude = " . (int) $ban_exclude; + $result = $db->sql_query($sql); + + // Reset $sql_where, because we use it later... + $sql_where = ''; + + if ($row = $db->sql_fetchrow($result)) + { + $banlist_ary_tmp = array(); + do + { + switch ($mode) + { + case 'user': + $banlist_ary_tmp[] = $row['ban_userid']; + break; + + case 'ip': + $banlist_ary_tmp[] = $row['ban_ip']; + break; + + case 'email': + $banlist_ary_tmp[] = $row['ban_email']; + break; + } + } + while ($row = $db->sql_fetchrow($result)); + + $banlist_ary_tmp = array_intersect($banlist_ary, $banlist_ary_tmp); + + if (count($banlist_ary_tmp)) + { + // One or more entities are already banned/excluded, delete the existing bans, so they can be re-inserted with the given new length + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set($type, $banlist_ary_tmp) . ' + AND ban_exclude = ' . (int) $ban_exclude; + $db->sql_query($sql); + } + + unset($banlist_ary_tmp); + } + $db->sql_freeresult($result); + + // We have some entities to ban + if (count($banlist_ary)) + { + $sql_ary = array(); + + foreach ($banlist_ary as $ban_entry) + { + $sql_ary[] = array( + $type => $ban_entry, + 'ban_start' => (int) $current_time, + 'ban_end' => (int) $ban_end, + 'ban_exclude' => (int) $ban_exclude, + 'ban_reason' => (string) $ban_reason, + 'ban_give_reason' => (string) $ban_give_reason, + ); + } + + $db->sql_multi_insert(BANLIST_TABLE, $sql_ary); + + // If we are banning we want to logout anyone matching the ban + if (!$ban_exclude) + { + switch ($mode) + { + case 'user': + $sql_where = 'WHERE ' . $db->sql_in_set('session_user_id', $banlist_ary); + break; + + case 'ip': + $sql_where = 'WHERE ' . $db->sql_in_set('session_ip', $banlist_ary); + break; + + case 'email': + $banlist_ary_sql = array(); + + foreach ($banlist_ary as $ban_entry) + { + $banlist_ary_sql[] = (string) str_replace('*', '%', $ban_entry); + } + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_email', $banlist_ary_sql); + $result = $db->sql_query($sql); + + $sql_in = array(); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $sql_in[] = $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $sql_where = 'WHERE ' . $db->sql_in_set('session_user_id', $sql_in); + } + $db->sql_freeresult($result); + break; + } + + if (isset($sql_where) && $sql_where) + { + $sql = 'DELETE FROM ' . SESSIONS_TABLE . " + $sql_where"; + $db->sql_query($sql); + + if ($mode == 'user') + { + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' ' . ((in_array('*', $banlist_ary)) ? '' : 'WHERE ' . $db->sql_in_set('user_id', $banlist_ary)); + $db->sql_query($sql); + } + } + } + + // Update log + $log_entry = ($ban_exclude) ? 'LOG_BAN_EXCLUDE_' : 'LOG_BAN_'; + + // Add to admin log, moderator log and user notes + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log_entry . strtoupper($mode), false, array($ban_reason, $ban_list_log)); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, $log_entry . strtoupper($mode), false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $ban_reason, + $ban_list_log + )); + if ($mode == 'user') + { + foreach ($banlist_ary as $user_id) + { + $phpbb_log->add('user', $user->data['user_id'], $user->ip, $log_entry . strtoupper($mode), false, array( + 'reportee_id' => $user_id, + $ban_reason, + $ban_list_log + )); + } + } + + $cache->destroy('sql', BANLIST_TABLE); + + return true; + } + + // There was nothing to ban/exclude. But destroying the cache because of the removal of stale bans. + $cache->destroy('sql', BANLIST_TABLE); + + return false; +} + +/** +* Unban User +*/ +function user_unban($mode, $ban) +{ + global $db, $user, $cache, $phpbb_log, $phpbb_dispatcher; + + // Delete stale bans + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ban_end < ' . time() . ' + AND ban_end <> 0'; + $db->sql_query($sql); + + if (!is_array($ban)) + { + $ban = array($ban); + } + + $unban_sql = array_map('intval', $ban); + + if (count($unban_sql)) + { + // Grab details of bans for logging information later + switch ($mode) + { + case 'user': + $sql = 'SELECT u.username AS unban_info, u.user_id + FROM ' . USERS_TABLE . ' u, ' . BANLIST_TABLE . ' b + WHERE ' . $db->sql_in_set('b.ban_id', $unban_sql) . ' + AND u.user_id = b.ban_userid'; + break; + + case 'email': + $sql = 'SELECT ban_email AS unban_info + FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set('ban_id', $unban_sql); + break; + + case 'ip': + $sql = 'SELECT ban_ip AS unban_info + FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set('ban_id', $unban_sql); + break; + } + $result = $db->sql_query($sql); + + $l_unban_list = ''; + $user_ids_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $l_unban_list .= (($l_unban_list != '') ? ', ' : '') . $row['unban_info']; + if ($mode == 'user') + { + $user_ids_ary[] = $row['user_id']; + } + } + $db->sql_freeresult($result); + + $sql = 'DELETE FROM ' . BANLIST_TABLE . ' + WHERE ' . $db->sql_in_set('ban_id', $unban_sql); + $db->sql_query($sql); + + // Add to moderator log, admin log and user notes + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_UNBAN_' . strtoupper($mode), false, array($l_unban_list)); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_UNBAN_' . strtoupper($mode), false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $l_unban_list + )); + if ($mode == 'user') + { + foreach ($user_ids_ary as $user_id) + { + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_UNBAN_' . strtoupper($mode), false, array( + 'reportee_id' => $user_id, + $l_unban_list + )); + } + } + + /** + * Use this event to perform actions after the unban has been performed + * + * @event core.user_unban + * @var string mode One of the following: user, ip, email + * @var array user_ids_ary Array with user_ids + * @since 3.1.11-RC1 + */ + $vars = array( + 'mode', + 'user_ids_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.user_unban', compact($vars))); + } + + $cache->destroy('sql', BANLIST_TABLE); + + return false; +} + +/** +* Internet Protocol Address Whois +* RFC3912: WHOIS Protocol Specification +* +* @param string $ip Ip address, either IPv4 or IPv6. +* +* @return string Empty string if not a valid ip address. +* Otherwise make_clickable()'ed whois result. +*/ +function user_ipwhois($ip) +{ + if (empty($ip)) + { + return ''; + } + + if (!preg_match(get_preg_expression('ipv4'), $ip) && !preg_match(get_preg_expression('ipv6'), $ip)) + { + return ''; + } + + // IPv4 & IPv6 addresses + $whois_host = 'whois.arin.net.'; + + $ipwhois = ''; + + if (($fsk = @fsockopen($whois_host, 43))) + { + // CRLF as per RFC3912 + fputs($fsk, "$ip\r\n"); + while (!feof($fsk)) + { + $ipwhois .= fgets($fsk, 1024); + } + @fclose($fsk); + } + + $match = array(); + + // Test for referrals from $whois_host to other whois databases, roll on rwhois + if (preg_match('#ReferralServer:[\x20]*whois://(.+)#im', $ipwhois, $match)) + { + if (strpos($match[1], ':') !== false) + { + $pos = strrpos($match[1], ':'); + $server = substr($match[1], 0, $pos); + $port = (int) substr($match[1], $pos + 1); + unset($pos); + } + else + { + $server = $match[1]; + $port = 43; + } + + $buffer = ''; + + if (($fsk = @fsockopen($server, $port))) + { + fputs($fsk, "$ip\r\n"); + while (!feof($fsk)) + { + $buffer .= fgets($fsk, 1024); + } + @fclose($fsk); + } + + // Use the result from $whois_host if we don't get any result here + $ipwhois = (empty($buffer)) ? $ipwhois : $buffer; + } + + $ipwhois = htmlspecialchars($ipwhois); + + // Magic URL ;) + return trim(make_clickable($ipwhois, false, '')); +} + +/** +* Data validation ... used primarily but not exclusively by ucp modules +* +* "Master" function for validating a range of data types +*/ +function validate_data($data, $val_ary) +{ + global $user; + + $error = array(); + + foreach ($val_ary as $var => $val_seq) + { + if (!is_array($val_seq[0])) + { + $val_seq = array($val_seq); + } + + foreach ($val_seq as $validate) + { + $function = array_shift($validate); + array_unshift($validate, $data[$var]); + + if (is_array($function)) + { + $result = call_user_func_array(array($function[0], 'validate_' . $function[1]), $validate); + } + else + { + $function_prefix = (function_exists('phpbb_validate_' . $function)) ? 'phpbb_validate_' : 'validate_'; + $result = call_user_func_array($function_prefix . $function, $validate); + } + + if ($result) + { + // Since errors are checked later for their language file existence, we need to make sure custom errors are not adjusted. + $error[] = (empty($user->lang[$result . '_' . strtoupper($var)])) ? $result : $result . '_' . strtoupper($var); + } + } + } + + return $error; +} + +/** +* Validate String +* +* @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_string($string, $optional = false, $min = 0, $max = 0) +{ + if (empty($string) && $optional) + { + return false; + } + + if ($min && utf8_strlen(htmlspecialchars_decode($string)) < $min) + { + return 'TOO_SHORT'; + } + else if ($max && utf8_strlen(htmlspecialchars_decode($string)) > $max) + { + return 'TOO_LONG'; + } + + return false; +} + +/** +* Validate Number +* +* @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_num($num, $optional = false, $min = 0, $max = 1E99) +{ + if (empty($num) && $optional) + { + return false; + } + + if ($num < $min) + { + return 'TOO_SMALL'; + } + else if ($num > $max) + { + return 'TOO_LARGE'; + } + + return false; +} + +/** +* Validate Date +* @param String $string a date in the dd-mm-yyyy format +* @return boolean +*/ +function validate_date($date_string, $optional = false) +{ + $date = explode('-', $date_string); + if ((empty($date) || count($date) != 3) && $optional) + { + return false; + } + else if ($optional) + { + for ($field = 0; $field <= 1; $field++) + { + $date[$field] = (int) $date[$field]; + if (empty($date[$field])) + { + $date[$field] = 1; + } + } + $date[2] = (int) $date[2]; + // assume an arbitrary leap year + if (empty($date[2])) + { + $date[2] = 1980; + } + } + + if (count($date) != 3 || !checkdate($date[1], $date[0], $date[2])) + { + return 'INVALID'; + } + + return false; +} + + +/** +* Validate Match +* +* @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_match($string, $optional = false, $match = '') +{ + if (empty($string) && $optional) + { + return false; + } + + if (empty($match)) + { + return false; + } + + if (!preg_match($match, $string)) + { + return 'WRONG_DATA'; + } + + return false; +} + +/** +* Validate Language Pack ISO Name +* +* Tests whether a language name is valid and installed +* +* @param string $lang_iso The language string to test +* +* @return bool|string Either false if validation succeeded or +* a string which will be used as the error message +* (with the variable name appended) +*/ +function validate_language_iso_name($lang_iso) +{ + global $db; + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($lang_iso) . "'"; + $result = $db->sql_query($sql); + $lang_id = (int) $db->sql_fetchfield('lang_id'); + $db->sql_freeresult($result); + + return ($lang_id) ? false : 'WRONG_DATA'; +} + +/** +* Validate Timezone Name +* +* Tests whether a timezone name is valid +* +* @param string $timezone The timezone string to test +* +* @return bool|string Either false if validation succeeded or +* a string which will be used as the error message +* (with the variable name appended) +*/ +function phpbb_validate_timezone($timezone) +{ + return (in_array($timezone, phpbb_get_timezone_identifiers($timezone))) ? false : 'TIMEZONE_INVALID'; +} + +/*** + * Validate Username + * + * Check to see if the username has been taken, or if it is disallowed. + * Also checks if it includes the " character or the 4-bytes Unicode ones + * (aka emojis) which we don't allow in usernames. + * Used for registering, changing names, and posting anonymously with a username + * + * @param string $username The username to check + * @param string $allowed_username An allowed username, default being $user->data['username'] + * + * @return mixed Either false if validation succeeded or a string which will be + * used as the error message (with the variable name appended) + */ +function validate_username($username, $allowed_username = false) +{ + global $config, $db, $user, $cache; + + $clean_username = utf8_clean_string($username); + $allowed_username = ($allowed_username === false) ? $user->data['username_clean'] : utf8_clean_string($allowed_username); + + if ($allowed_username == $clean_username) + { + return false; + } + + // The very first check is for + // out-of-bounds characters that are currently + // not supported by utf8_bin in MySQL + if (preg_match('/[\x{10000}-\x{10FFFF}]/u', $username)) + { + return 'INVALID_EMOJIS'; + } + + // ... fast checks first. + if (strpos($username, '"') !== false || strpos($username, '"') !== false || empty($clean_username)) + { + return 'INVALID_CHARS'; + } + + switch ($config['allow_name_chars']) + { + case 'USERNAME_CHARS_ANY': + $regex = '.+'; + break; + + case 'USERNAME_ALPHA_ONLY': + $regex = '[A-Za-z0-9]+'; + break; + + case 'USERNAME_ALPHA_SPACERS': + $regex = '[A-Za-z0-9-[\]_+ ]+'; + break; + + case 'USERNAME_LETTER_NUM': + $regex = '[\p{Lu}\p{Ll}\p{N}]+'; + break; + + case 'USERNAME_LETTER_NUM_SPACERS': + $regex = '[-\]_+ [\p{Lu}\p{Ll}\p{N}]+'; + break; + + case 'USERNAME_ASCII': + default: + $regex = '[\x01-\x7F]+'; + break; + } + + if (!preg_match('#^' . $regex . '$#u', $username)) + { + return 'INVALID_CHARS'; + } + + $sql = 'SELECT username + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $db->sql_escape($clean_username) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return 'USERNAME_TAKEN'; + } + + $sql = 'SELECT group_name + FROM ' . GROUPS_TABLE . " + WHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($username)) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return 'USERNAME_TAKEN'; + } + + $bad_usernames = $cache->obtain_disallowed_usernames(); + + foreach ($bad_usernames as $bad_username) + { + if (preg_match('#^' . $bad_username . '$#', $clean_username)) + { + return 'USERNAME_DISALLOWED'; + } + } + + return false; +} + +/** +* Check to see if the password meets the complexity settings +* +* @return boolean|string Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_password($password) +{ + global $config; + + if ($password === '' || $config['pass_complex'] === 'PASS_TYPE_ANY') + { + // Password empty or no password complexity required. + return false; + } + + $upp = '\p{Lu}'; + $low = '\p{Ll}'; + $num = '\p{N}'; + $sym = '[^\p{Lu}\p{Ll}\p{N}]'; + $chars = array(); + + switch ($config['pass_complex']) + { + // No break statements below ... + // We require strong passwords in case pass_complex is not set or is invalid + default: + + // Require mixed case letters, numbers and symbols + case 'PASS_TYPE_SYMBOL': + $chars[] = $sym; + + // Require mixed case letters and numbers + case 'PASS_TYPE_ALPHA': + $chars[] = $num; + + // Require mixed case letters + case 'PASS_TYPE_CASE': + $chars[] = $low; + $chars[] = $upp; + } + + foreach ($chars as $char) + { + if (!preg_match('#' . $char . '#u', $password)) + { + return 'INVALID_CHARS'; + } + } + + return false; +} + +/** +* Check to see if email address is a valid address and contains a MX record +* +* @param string $email The email to check +* +* @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function phpbb_validate_email($email, $config = null) +{ + if ($config === null) + { + global $config; + } + + $email = strtolower($email); + + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email)) + { + return 'EMAIL_INVALID'; + } + + // Check MX record. + // The idea for this is from reading the UseBB blog/announcement. :) + if ($config['email_check_mx']) + { + list(, $domain) = explode('@', $email); + + if (phpbb_checkdnsrr($domain, 'A') === false && phpbb_checkdnsrr($domain, 'MX') === false) + { + return 'DOMAIN_NO_MX_RECORD'; + } + } + + return false; +} + +/** +* Check to see if email address is banned or already present in the DB +* +* @param string $email The email to check +* @param string $allowed_email An allowed email, default being $user->data['user_email'] +* +* @return mixed Either false if validation succeeded or a string which will be used as the error message (with the variable name appended) +*/ +function validate_user_email($email, $allowed_email = false) +{ + global $config, $db, $user; + + $email = strtolower($email); + $allowed_email = ($allowed_email === false) ? strtolower($user->data['user_email']) : strtolower($allowed_email); + + if ($allowed_email == $email) + { + return false; + } + + $validate_email = phpbb_validate_email($email, $config); + if ($validate_email) + { + return $validate_email; + } + + if (($ban = $user->check_ban(false, false, $email, true)) !== false) + { + return ($ban === true) ? 'EMAIL_BANNED' : (!empty($ban['ban_give_reason']) ? $ban['ban_give_reason'] : $ban); + } + + if (!$config['allow_emailreuse']) + { + $sql = 'SELECT user_email_hash + FROM ' . USERS_TABLE . " + WHERE user_email_hash = " . $db->sql_escape(phpbb_email_hash($email)); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return 'EMAIL_TAKEN'; + } + } + + return false; +} + +/** +* Validate jabber address +* Taken from the jabber class within flyspray (see author notes) +* +* @author flyspray.org +*/ +function validate_jabber($jid) +{ + if (!$jid) + { + return false; + } + + $separator_pos = strpos($jid, '@'); + + if ($separator_pos === false) + { + return 'WRONG_DATA'; + } + + $username = substr($jid, 0, $separator_pos); + $realm = substr($jid, $separator_pos + 1); + + if (strlen($username) == 0 || strlen($realm) < 3) + { + return 'WRONG_DATA'; + } + + $arr = explode('.', $realm); + + if (count($arr) == 0) + { + return 'WRONG_DATA'; + } + + foreach ($arr as $part) + { + if (substr($part, 0, 1) == '-' || substr($part, -1, 1) == '-') + { + return 'WRONG_DATA'; + } + + if (!preg_match("@^[a-zA-Z0-9-.]+$@", $part)) + { + return 'WRONG_DATA'; + } + } + + $boundary = array(array(0, 127), array(192, 223), array(224, 239), array(240, 247), array(248, 251), array(252, 253)); + + // Prohibited Characters RFC3454 + RFC3920 + $prohibited = array( + // Table C.1.1 + array(0x0020, 0x0020), // SPACE + // Table C.1.2 + array(0x00A0, 0x00A0), // NO-BREAK SPACE + array(0x1680, 0x1680), // OGHAM SPACE MARK + array(0x2000, 0x2001), // EN QUAD + array(0x2001, 0x2001), // EM QUAD + array(0x2002, 0x2002), // EN SPACE + array(0x2003, 0x2003), // EM SPACE + array(0x2004, 0x2004), // THREE-PER-EM SPACE + array(0x2005, 0x2005), // FOUR-PER-EM SPACE + array(0x2006, 0x2006), // SIX-PER-EM SPACE + array(0x2007, 0x2007), // FIGURE SPACE + array(0x2008, 0x2008), // PUNCTUATION SPACE + array(0x2009, 0x2009), // THIN SPACE + array(0x200A, 0x200A), // HAIR SPACE + array(0x200B, 0x200B), // ZERO WIDTH SPACE + array(0x202F, 0x202F), // NARROW NO-BREAK SPACE + array(0x205F, 0x205F), // MEDIUM MATHEMATICAL SPACE + array(0x3000, 0x3000), // IDEOGRAPHIC SPACE + // Table C.2.1 + array(0x0000, 0x001F), // [CONTROL CHARACTERS] + array(0x007F, 0x007F), // DELETE + // Table C.2.2 + array(0x0080, 0x009F), // [CONTROL CHARACTERS] + array(0x06DD, 0x06DD), // ARABIC END OF AYAH + array(0x070F, 0x070F), // SYRIAC ABBREVIATION MARK + array(0x180E, 0x180E), // MONGOLIAN VOWEL SEPARATOR + array(0x200C, 0x200C), // ZERO WIDTH NON-JOINER + array(0x200D, 0x200D), // ZERO WIDTH JOINER + array(0x2028, 0x2028), // LINE SEPARATOR + array(0x2029, 0x2029), // PARAGRAPH SEPARATOR + array(0x2060, 0x2060), // WORD JOINER + array(0x2061, 0x2061), // FUNCTION APPLICATION + array(0x2062, 0x2062), // INVISIBLE TIMES + array(0x2063, 0x2063), // INVISIBLE SEPARATOR + array(0x206A, 0x206F), // [CONTROL CHARACTERS] + array(0xFEFF, 0xFEFF), // ZERO WIDTH NO-BREAK SPACE + array(0xFFF9, 0xFFFC), // [CONTROL CHARACTERS] + array(0x1D173, 0x1D17A), // [MUSICAL CONTROL CHARACTERS] + // Table C.3 + array(0xE000, 0xF8FF), // [PRIVATE USE, PLANE 0] + array(0xF0000, 0xFFFFD), // [PRIVATE USE, PLANE 15] + array(0x100000, 0x10FFFD), // [PRIVATE USE, PLANE 16] + // Table C.4 + array(0xFDD0, 0xFDEF), // [NONCHARACTER CODE POINTS] + array(0xFFFE, 0xFFFF), // [NONCHARACTER CODE POINTS] + array(0x1FFFE, 0x1FFFF), // [NONCHARACTER CODE POINTS] + array(0x2FFFE, 0x2FFFF), // [NONCHARACTER CODE POINTS] + array(0x3FFFE, 0x3FFFF), // [NONCHARACTER CODE POINTS] + array(0x4FFFE, 0x4FFFF), // [NONCHARACTER CODE POINTS] + array(0x5FFFE, 0x5FFFF), // [NONCHARACTER CODE POINTS] + array(0x6FFFE, 0x6FFFF), // [NONCHARACTER CODE POINTS] + array(0x7FFFE, 0x7FFFF), // [NONCHARACTER CODE POINTS] + array(0x8FFFE, 0x8FFFF), // [NONCHARACTER CODE POINTS] + array(0x9FFFE, 0x9FFFF), // [NONCHARACTER CODE POINTS] + array(0xAFFFE, 0xAFFFF), // [NONCHARACTER CODE POINTS] + array(0xBFFFE, 0xBFFFF), // [NONCHARACTER CODE POINTS] + array(0xCFFFE, 0xCFFFF), // [NONCHARACTER CODE POINTS] + array(0xDFFFE, 0xDFFFF), // [NONCHARACTER CODE POINTS] + array(0xEFFFE, 0xEFFFF), // [NONCHARACTER CODE POINTS] + array(0xFFFFE, 0xFFFFF), // [NONCHARACTER CODE POINTS] + array(0x10FFFE, 0x10FFFF), // [NONCHARACTER CODE POINTS] + // Table C.5 + array(0xD800, 0xDFFF), // [SURROGATE CODES] + // Table C.6 + array(0xFFF9, 0xFFF9), // INTERLINEAR ANNOTATION ANCHOR + array(0xFFFA, 0xFFFA), // INTERLINEAR ANNOTATION SEPARATOR + array(0xFFFB, 0xFFFB), // INTERLINEAR ANNOTATION TERMINATOR + array(0xFFFC, 0xFFFC), // OBJECT REPLACEMENT CHARACTER + array(0xFFFD, 0xFFFD), // REPLACEMENT CHARACTER + // Table C.7 + array(0x2FF0, 0x2FFB), // [IDEOGRAPHIC DESCRIPTION CHARACTERS] + // Table C.8 + array(0x0340, 0x0340), // COMBINING GRAVE TONE MARK + array(0x0341, 0x0341), // COMBINING ACUTE TONE MARK + array(0x200E, 0x200E), // LEFT-TO-RIGHT MARK + array(0x200F, 0x200F), // RIGHT-TO-LEFT MARK + array(0x202A, 0x202A), // LEFT-TO-RIGHT EMBEDDING + array(0x202B, 0x202B), // RIGHT-TO-LEFT EMBEDDING + array(0x202C, 0x202C), // POP DIRECTIONAL FORMATTING + array(0x202D, 0x202D), // LEFT-TO-RIGHT OVERRIDE + array(0x202E, 0x202E), // RIGHT-TO-LEFT OVERRIDE + array(0x206A, 0x206A), // INHIBIT SYMMETRIC SWAPPING + array(0x206B, 0x206B), // ACTIVATE SYMMETRIC SWAPPING + array(0x206C, 0x206C), // INHIBIT ARABIC FORM SHAPING + array(0x206D, 0x206D), // ACTIVATE ARABIC FORM SHAPING + array(0x206E, 0x206E), // NATIONAL DIGIT SHAPES + array(0x206F, 0x206F), // NOMINAL DIGIT SHAPES + // Table C.9 + array(0xE0001, 0xE0001), // LANGUAGE TAG + array(0xE0020, 0xE007F), // [TAGGING CHARACTERS] + // RFC3920 + array(0x22, 0x22), // " + array(0x26, 0x26), // & + array(0x27, 0x27), // ' + array(0x2F, 0x2F), // / + array(0x3A, 0x3A), // : + array(0x3C, 0x3C), // < + array(0x3E, 0x3E), // > + array(0x40, 0x40) // @ + ); + + $pos = 0; + $result = true; + + while ($pos < strlen($username)) + { + $len = $uni = 0; + for ($i = 0; $i <= 5; $i++) + { + if (ord($username[$pos]) >= $boundary[$i][0] && ord($username[$pos]) <= $boundary[$i][1]) + { + $len = $i + 1; + $uni = (ord($username[$pos]) - $boundary[$i][0]) * pow(2, $i * 6); + + for ($k = 1; $k < $len; $k++) + { + $uni += (ord($username[$pos + $k]) - 128) * pow(2, ($i - $k) * 6); + } + + break; + } + } + + if ($len == 0) + { + return 'WRONG_DATA'; + } + + foreach ($prohibited as $pval) + { + if ($uni >= $pval[0] && $uni <= $pval[1]) + { + $result = false; + break 2; + } + } + + $pos = $pos + $len; + } + + if (!$result) + { + return 'WRONG_DATA'; + } + + return false; +} + +/** +* Validate hex colour value +* +* @param string $colour The hex colour value +* @param bool $optional Whether the colour value is optional. True if an empty +* string will be accepted as correct input, false if not. +* @return bool|string Error message if colour value is incorrect, false if it +* fits the hex colour code +*/ +function phpbb_validate_hex_colour($colour, $optional = false) +{ + if ($colour === '') + { + return (($optional) ? false : 'WRONG_DATA'); + } + + if (!preg_match('/^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/', $colour)) + { + return 'WRONG_DATA'; + } + + return false; +} + +/** +* Verifies whether a style ID corresponds to an active style. +* +* @param int $style_id The style_id of a style which should be checked if activated or not. +* @return boolean +*/ +function phpbb_style_is_active($style_id) +{ + global $db; + + $sql = 'SELECT style_active + FROM ' . STYLES_TABLE . ' + WHERE style_id = '. (int) $style_id; + $result = $db->sql_query($sql); + + $style_is_active = (bool) $db->sql_fetchfield('style_active'); + $db->sql_freeresult($result); + + return $style_is_active; +} + +/** +* Remove avatar +*/ +function avatar_delete($mode, $row, $clean_db = false) +{ + global $phpbb_root_path, $config; + + // Check if the users avatar is actually *not* a group avatar + if ($mode == 'user') + { + if (strpos($row['user_avatar'], 'g') === 0 || (((int) $row['user_avatar'] !== 0) && ((int) $row['user_avatar'] !== (int) $row['user_id']))) + { + return false; + } + } + + if ($clean_db) + { + avatar_remove_db($row[$mode . '_avatar']); + } + $filename = get_avatar_filename($row[$mode . '_avatar']); + + if (file_exists($phpbb_root_path . $config['avatar_path'] . '/' . $filename)) + { + @unlink($phpbb_root_path . $config['avatar_path'] . '/' . $filename); + return true; + } + + return false; +} + +/** +* Generates avatar filename from the database entry +*/ +function get_avatar_filename($avatar_entry) +{ + global $config; + + if ($avatar_entry[0] === 'g') + { + $avatar_group = true; + $avatar_entry = substr($avatar_entry, 1); + } + else + { + $avatar_group = false; + } + $ext = substr(strrchr($avatar_entry, '.'), 1); + $avatar_entry = intval($avatar_entry); + return $config['avatar_salt'] . '_' . (($avatar_group) ? 'g' : '') . $avatar_entry . '.' . $ext; +} + +/** +* Returns an explanation string with maximum avatar settings +* +* @return string +*/ +function phpbb_avatar_explanation_string() +{ + global $config, $user; + + return $user->lang(($config['avatar_filesize'] == 0) ? 'AVATAR_EXPLAIN_NO_FILESIZE' : 'AVATAR_EXPLAIN', + $user->lang('PIXELS', (int) $config['avatar_max_width']), + $user->lang('PIXELS', (int) $config['avatar_max_height']), + round($config['avatar_filesize'] / 1024)); +} + +// +// Usergroup functions +// + +/** +* Add or edit a group. If we're editing a group we only update user +* parameters such as rank, etc. if they are changed +*/ +function group_create(&$group_id, $type, $name, $desc, $group_attributes, $allow_desc_bbcode = false, $allow_desc_urls = false, $allow_desc_smilies = false) +{ + global $db, $user, $phpbb_container, $phpbb_log; + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + $error = array(); + + // Attributes which also affect the users table + $user_attribute_ary = array('group_colour', 'group_rank', 'group_avatar', 'group_avatar_type', 'group_avatar_width', 'group_avatar_height'); + + // Check data. Limit group name length. + if (!utf8_strlen($name) || utf8_strlen($name) > 60) + { + $error[] = (!utf8_strlen($name)) ? $user->lang['GROUP_ERR_USERNAME'] : $user->lang['GROUP_ERR_USER_LONG']; + } + + $err = group_validate_groupname($group_id, $name); + if (!empty($err)) + { + $error[] = $user->lang[$err]; + } + + if (!in_array($type, array(GROUP_OPEN, GROUP_CLOSED, GROUP_HIDDEN, GROUP_SPECIAL, GROUP_FREE))) + { + $error[] = $user->lang['GROUP_ERR_TYPE']; + } + + $group_teampage = !empty($group_attributes['group_teampage']); + unset($group_attributes['group_teampage']); + + if (!count($error)) + { + $current_legend = \phpbb\groupposition\legend::GROUP_DISABLED; + $current_teampage = \phpbb\groupposition\teampage::GROUP_DISABLED; + + /* @var $legend \phpbb\groupposition\legend */ + $legend = $phpbb_container->get('groupposition.legend'); + + /* @var $teampage \phpbb\groupposition\teampage */ + $teampage = $phpbb_container->get('groupposition.teampage'); + + if ($group_id) + { + try + { + $current_legend = $legend->get_group_value($group_id); + $current_teampage = $teampage->get_group_value($group_id); + } + catch (\phpbb\groupposition\exception $exception) + { + trigger_error($user->lang($exception->getMessage())); + } + } + + if (!empty($group_attributes['group_legend'])) + { + if (($group_id && ($current_legend == \phpbb\groupposition\legend::GROUP_DISABLED)) || !$group_id) + { + // Old group currently not in the legend or new group, add at the end. + $group_attributes['group_legend'] = 1 + $legend->get_group_count(); + } + else + { + // Group stayes in the legend + $group_attributes['group_legend'] = $current_legend; + } + } + else if ($group_id && ($current_legend != \phpbb\groupposition\legend::GROUP_DISABLED)) + { + // Group is removed from the legend + try + { + $legend->delete_group($group_id, true); + } + catch (\phpbb\groupposition\exception $exception) + { + trigger_error($user->lang($exception->getMessage())); + } + $group_attributes['group_legend'] = \phpbb\groupposition\legend::GROUP_DISABLED; + } + else + { + $group_attributes['group_legend'] = \phpbb\groupposition\legend::GROUP_DISABLED; + } + + // Unset the objects, we don't need them anymore. + unset($legend); + + $user_ary = array(); + $sql_ary = array( + 'group_name' => (string) $name, + 'group_desc' => (string) $desc, + 'group_desc_uid' => '', + 'group_desc_bitfield' => '', + 'group_type' => (int) $type, + ); + + // Parse description + if ($desc) + { + generate_text_for_storage($sql_ary['group_desc'], $sql_ary['group_desc_uid'], $sql_ary['group_desc_bitfield'], $sql_ary['group_desc_options'], $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies); + } + + if (count($group_attributes)) + { + // Merge them with $sql_ary to properly update the group + $sql_ary = array_merge($sql_ary, $group_attributes); + } + + // Setting the log message before we set the group id (if group gets added) + $log = ($group_id) ? 'LOG_GROUP_UPDATED' : 'LOG_GROUP_CREATED'; + + if ($group_id) + { + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $user_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (isset($sql_ary['group_avatar'])) + { + remove_default_avatar($group_id, $user_ary); + } + + if (isset($sql_ary['group_rank'])) + { + remove_default_rank($group_id, $user_ary); + } + + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " + WHERE group_id = $group_id"; + $db->sql_query($sql); + + // Since we may update the name too, we need to do this on other tables too... + $sql = 'UPDATE ' . MODERATOR_CACHE_TABLE . " + SET group_name = '" . $db->sql_escape($sql_ary['group_name']) . "' + WHERE group_id = $group_id"; + $db->sql_query($sql); + + // One special case is the group skip auth setting. If this was changed we need to purge permissions for this group + if (isset($group_attributes['group_skip_auth'])) + { + // Get users within this group... + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . ' + WHERE group_id = ' . $group_id . ' + AND user_pending = 0'; + $result = $db->sql_query($sql); + + $user_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_id_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (!empty($user_id_ary)) + { + global $auth; + + // Clear permissions cache of relevant users + $auth->acl_clear_prefetch($user_id_ary); + } + } + } + else + { + $sql = 'INSERT INTO ' . GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + } + + // Remove the group from the teampage, only if unselected and we are editing a group, + // which is currently displayed. + if (!$group_teampage && $group_id && $current_teampage != \phpbb\groupposition\teampage::GROUP_DISABLED) + { + try + { + $teampage->delete_group($group_id); + } + catch (\phpbb\groupposition\exception $exception) + { + trigger_error($user->lang($exception->getMessage())); + } + } + + if (!$group_id) + { + $group_id = $db->sql_nextid(); + + if (isset($sql_ary['group_avatar_type']) && $sql_ary['group_avatar_type'] == 'avatar.driver.upload') + { + group_correct_avatar($group_id, $sql_ary['group_avatar']); + } + } + + try + { + if ($group_teampage && $current_teampage == \phpbb\groupposition\teampage::GROUP_DISABLED) + { + $teampage->add_group($group_id); + } + + if ($group_teampage) + { + if ($current_teampage == \phpbb\groupposition\teampage::GROUP_DISABLED) + { + $teampage->add_group($group_id); + } + } + else if ($group_id && ($current_teampage != \phpbb\groupposition\teampage::GROUP_DISABLED)) + { + $teampage->delete_group($group_id); + } + } + catch (\phpbb\groupposition\exception $exception) + { + trigger_error($user->lang($exception->getMessage())); + } + unset($teampage); + + // Set user attributes + $sql_ary = array(); + if (count($group_attributes)) + { + // Go through the user attributes array, check if a group attribute matches it and then set it. ;) + foreach ($user_attribute_ary as $attribute) + { + if (!isset($group_attributes[$attribute])) + { + continue; + } + + // If we are about to set an avatar, we will not overwrite user avatars if no group avatar is set... + if (strpos($attribute, 'group_avatar') === 0 && !$group_attributes[$attribute]) + { + continue; + } + + $sql_ary[$attribute] = $group_attributes[$attribute]; + } + } + + if (count($sql_ary) && count($user_ary)) + { + group_set_user_default($group_id, $user_ary, $sql_ary); + } + + $name = $group_helper->get_name($name); + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($name)); + + group_update_listings($group_id); + } + + return (count($error)) ? $error : false; +} + + +/** +* Changes a group avatar's filename to conform to the naming scheme +*/ +function group_correct_avatar($group_id, $old_entry) +{ + global $config, $db, $phpbb_root_path; + + $group_id = (int) $group_id; + $ext = substr(strrchr($old_entry, '.'), 1); + $old_filename = get_avatar_filename($old_entry); + $new_filename = $config['avatar_salt'] . "_g$group_id.$ext"; + $new_entry = 'g' . $group_id . '_' . substr(time(), -5) . ".$ext"; + + $avatar_path = $phpbb_root_path . $config['avatar_path']; + if (@rename($avatar_path . '/'. $old_filename, $avatar_path . '/' . $new_filename)) + { + $sql = 'UPDATE ' . GROUPS_TABLE . ' + SET group_avatar = \'' . $db->sql_escape($new_entry) . "' + WHERE group_id = $group_id"; + $db->sql_query($sql); + } +} + + +/** +* Remove avatar also for users not having the group as default +*/ +function avatar_remove_db($avatar_name) +{ + global $db; + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_avatar = '', + user_avatar_type = '' + WHERE user_avatar = '" . $db->sql_escape($avatar_name) . '\''; + $db->sql_query($sql); +} + + +/** +* Group Delete +*/ +function group_delete($group_id, $group_name = false) +{ + global $db, $cache, $auth, $user, $phpbb_root_path, $phpEx, $phpbb_dispatcher, $phpbb_container, $phpbb_log; + + if (!$group_name) + { + $group_name = get_group_name($group_id); + } + + $start = 0; + + do + { + $user_id_ary = $username_ary = array(); + + // Batch query for group members, call group_user_del + $sql = 'SELECT u.user_id, u.username + FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . " u + WHERE ug.group_id = $group_id + AND u.user_id = ug.user_id"; + $result = $db->sql_query_limit($sql, 200, $start); + + if ($row = $db->sql_fetchrow($result)) + { + do + { + $user_id_ary[] = $row['user_id']; + $username_ary[] = $row['username']; + + $start++; + } + while ($row = $db->sql_fetchrow($result)); + + group_user_del($group_id, $user_id_ary, $username_ary, $group_name); + } + else + { + $start = 0; + } + $db->sql_freeresult($result); + } + while ($start); + + // Delete group from legend and teampage + try + { + /* @var $legend \phpbb\groupposition\legend */ + $legend = $phpbb_container->get('groupposition.legend'); + $legend->delete_group($group_id); + unset($legend); + } + catch (\phpbb\groupposition\exception $exception) + { + // The group we want to delete does not exist. + // No reason to worry, we just continue the deleting process. + //trigger_error($user->lang($exception->getMessage())); + } + + try + { + /* @var $teampage \phpbb\groupposition\teampage */ + $teampage = $phpbb_container->get('groupposition.teampage'); + $teampage->delete_group($group_id); + unset($teampage); + } + catch (\phpbb\groupposition\exception $exception) + { + // The group we want to delete does not exist. + // No reason to worry, we just continue the deleting process. + //trigger_error($user->lang($exception->getMessage())); + } + + // Delete group + $sql = 'DELETE FROM ' . GROUPS_TABLE . " + WHERE group_id = $group_id"; + $db->sql_query($sql); + + // Delete auth entries from the groups table + $sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . " + WHERE group_id = $group_id"; + $db->sql_query($sql); + + /** + * Event after a group is deleted + * + * @event core.delete_group_after + * @var int group_id ID of the deleted group + * @var string group_name Name of the deleted group + * @since 3.1.0-a1 + */ + $vars = array('group_id', 'group_name'); + extract($phpbb_dispatcher->trigger_event('core.delete_group_after', compact($vars))); + + // Re-cache moderators + if (!function_exists('phpbb_cache_moderators')) + { + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + + phpbb_cache_moderators($db, $cache, $auth); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_GROUP_DELETE', false, array($group_name)); + + // Return false - no error + return false; +} + +/** +* Add user(s) to group +* +* @return mixed false if no errors occurred, else the user lang string for the relevant error, for example 'NO_USER' +*/ +function group_user_add($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $default = false, $leader = 0, $pending = 0, $group_attributes = false) +{ + global $db, $auth, $user, $phpbb_container, $phpbb_log, $phpbb_dispatcher; + + // We need both username and user_id info + $result = user_get_id_name($user_id_ary, $username_ary); + + if (empty($user_id_ary) || $result !== false) + { + return 'NO_USER'; + } + + // Because the item that gets passed into the previous function is unset, the reference is lost and our original + // array is retained - so we know there's a problem if there's a different number of ids to usernames now. + if (count($user_id_ary) != count($username_ary)) + { + return 'GROUP_USERS_INVALID'; + } + + // Remove users who are already members of this group + $sql = 'SELECT user_id, group_leader + FROM ' . USER_GROUP_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary) . " + AND group_id = $group_id"; + $result = $db->sql_query($sql); + + $add_id_ary = $update_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $add_id_ary[] = (int) $row['user_id']; + + if ($leader && !$row['group_leader']) + { + $update_id_ary[] = (int) $row['user_id']; + } + } + $db->sql_freeresult($result); + + // Do all the users exist in this group? + $add_id_ary = array_diff($user_id_ary, $add_id_ary); + + // If we have no users + if (!count($add_id_ary) && !count($update_id_ary)) + { + return 'GROUP_USERS_EXIST'; + } + + $db->sql_transaction('begin'); + + // Insert the new users + if (count($add_id_ary)) + { + $sql_ary = array(); + + foreach ($add_id_ary as $user_id) + { + $sql_ary[] = array( + 'user_id' => (int) $user_id, + 'group_id' => (int) $group_id, + 'group_leader' => (int) $leader, + 'user_pending' => (int) $pending, + ); + } + + $db->sql_multi_insert(USER_GROUP_TABLE, $sql_ary); + } + + if (count($update_id_ary)) + { + $sql = 'UPDATE ' . USER_GROUP_TABLE . ' + SET group_leader = 1 + WHERE ' . $db->sql_in_set('user_id', $update_id_ary) . " + AND group_id = $group_id"; + $db->sql_query($sql); + } + + if ($default) + { + group_user_attributes('default', $group_id, $user_id_ary, false, $group_name, $group_attributes); + } + + $db->sql_transaction('commit'); + + // Clear permissions cache of relevant users + $auth->acl_clear_prefetch($user_id_ary); + + /** + * Event after users are added to a group + * + * @event core.group_add_user_after + * @var int group_id ID of the group to which users are added + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users which are added + * @var array username_ary names of the users which are added + * @var int pending Pending setting, 1 if user(s) added are pending + * @since 3.1.7-RC1 + */ + $vars = array( + 'group_id', + 'group_name', + 'user_id_ary', + 'username_ary', + 'pending', + ); + extract($phpbb_dispatcher->trigger_event('core.group_add_user_after', compact($vars))); + + if (!$group_name) + { + $group_name = get_group_name($group_id); + } + + $log = ($leader) ? 'LOG_MODS_ADDED' : (($pending) ? 'LOG_USERS_PENDING' : 'LOG_USERS_ADDED'); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($group_name, implode(', ', $username_ary))); + + group_update_listings($group_id); + + if ($pending) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + foreach ($add_id_ary as $user_id) + { + $phpbb_notifications->add_notifications('notification.type.group_request', array( + 'group_id' => $group_id, + 'user_id' => $user_id, + 'group_name' => $group_name, + )); + } + } + + // Return false - no error + return false; +} + +/** +* Remove a user/s from a given group. When we remove users we update their +* default group_id. We do this by examining which "special" groups they belong +* to. The selection is made based on a reasonable priority system +* +* @return false if no errors occurred, else the user lang string for the relevant error, for example 'NO_USER' +*/ +function group_user_del($group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $log_action = true) +{ + global $db, $auth, $config, $user, $phpbb_dispatcher, $phpbb_container, $phpbb_log; + + if ($config['coppa_enable']) + { + $group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'NEWLY_REGISTERED', 'REGISTERED_COPPA', 'REGISTERED', 'BOTS', 'GUESTS'); + } + else + { + $group_order = array('ADMINISTRATORS', 'GLOBAL_MODERATORS', 'NEWLY_REGISTERED', 'REGISTERED', 'BOTS', 'GUESTS'); + } + + // We need both username and user_id info + $result = user_get_id_name($user_id_ary, $username_ary); + + if (empty($user_id_ary) || $result !== false) + { + return 'NO_USER'; + } + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE ' . $db->sql_in_set('group_name', $group_order); + $result = $db->sql_query($sql); + + $group_order_id = $special_group_data = array(); + while ($row = $db->sql_fetchrow($result)) + { + $group_order_id[$row['group_name']] = $row['group_id']; + + $special_group_data[$row['group_id']] = array( + 'group_colour' => $row['group_colour'], + 'group_rank' => $row['group_rank'], + ); + + // Only set the group avatar if one is defined... + if ($row['group_avatar']) + { + $special_group_data[$row['group_id']] = array_merge($special_group_data[$row['group_id']], array( + 'group_avatar' => $row['group_avatar'], + 'group_avatar_type' => $row['group_avatar_type'], + 'group_avatar_width' => $row['group_avatar_width'], + 'group_avatar_height' => $row['group_avatar_height']) + ); + } + } + $db->sql_freeresult($result); + + // Get users default groups - we only need to reset default group membership if the group from which the user gets removed is set as default + $sql = 'SELECT user_id, group_id + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary); + $result = $db->sql_query($sql); + + $default_groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $default_groups[$row['user_id']] = $row['group_id']; + } + $db->sql_freeresult($result); + + // What special group memberships exist for these users? + $sql = 'SELECT g.group_id, g.group_name, ug.user_id + FROM ' . USER_GROUP_TABLE . ' ug, ' . GROUPS_TABLE . ' g + WHERE ' . $db->sql_in_set('ug.user_id', $user_id_ary) . " + AND g.group_id = ug.group_id + AND g.group_id <> $group_id + AND g.group_type = " . GROUP_SPECIAL . ' + ORDER BY ug.user_id, g.group_id'; + $result = $db->sql_query($sql); + + $temp_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + if ($default_groups[$row['user_id']] == $group_id && (!isset($temp_ary[$row['user_id']]) || $group_order_id[$row['group_name']] < $temp_ary[$row['user_id']])) + { + $temp_ary[$row['user_id']] = $row['group_id']; + } + } + $db->sql_freeresult($result); + + // sql_where_ary holds the new default groups and their users + $sql_where_ary = array(); + foreach ($temp_ary as $uid => $gid) + { + $sql_where_ary[$gid][] = $uid; + } + unset($temp_ary); + + foreach ($special_group_data as $gid => $default_data_ary) + { + if (isset($sql_where_ary[$gid]) && count($sql_where_ary[$gid])) + { + remove_default_rank($group_id, $sql_where_ary[$gid]); + remove_default_avatar($group_id, $sql_where_ary[$gid]); + group_set_user_default($gid, $sql_where_ary[$gid], $default_data_ary); + } + } + unset($special_group_data); + + /** + * Event before users are removed from a group + * + * @event core.group_delete_user_before + * @var int group_id ID of the group from which users are deleted + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users which are removed + * @var array username_ary names of the users which are removed + * @since 3.1.0-a1 + */ + $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); + extract($phpbb_dispatcher->trigger_event('core.group_delete_user_before', compact($vars))); + + $sql = 'DELETE FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + AND " . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + + // Clear permissions cache of relevant users + $auth->acl_clear_prefetch($user_id_ary); + + /** + * Event after users are removed from a group + * + * @event core.group_delete_user_after + * @var int group_id ID of the group from which users are deleted + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users which are removed + * @var array username_ary names of the users which are removed + * @since 3.1.7-RC1 + */ + $vars = array('group_id', 'group_name', 'user_id_ary', 'username_ary'); + extract($phpbb_dispatcher->trigger_event('core.group_delete_user_after', compact($vars))); + + if ($log_action) + { + if (!$group_name) + { + $group_name = get_group_name($group_id); + } + + $log = 'LOG_GROUP_REMOVE'; + + if ($group_name) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($group_name, implode(', ', $username_ary))); + } + } + + group_update_listings($group_id); + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->delete_notifications('notification.type.group_request', $user_id_ary, $group_id); + + // Return false - no error + return false; +} + + +/** +* Removes the group avatar of the default group from the users in user_ids who have that group as default. +*/ +function remove_default_avatar($group_id, $user_ids) +{ + global $db; + + if (!is_array($user_ids)) + { + $user_ids = array($user_ids); + } + if (empty($user_ids)) + { + return false; + } + + $user_ids = array_map('intval', $user_ids); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + if (!$row = $db->sql_fetchrow($result)) + { + $db->sql_freeresult($result); + return false; + } + $db->sql_freeresult($result); + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_avatar = '', + user_avatar_type = '', + user_avatar_width = 0, + user_avatar_height = 0 + WHERE group_id = " . (int) $group_id . " + AND user_avatar = '" . $db->sql_escape($row['group_avatar']) . "' + AND " . $db->sql_in_set('user_id', $user_ids); + + $db->sql_query($sql); +} + +/** +* Removes the group rank of the default group from the users in user_ids who have that group as default. +*/ +function remove_default_rank($group_id, $user_ids) +{ + global $db; + + if (!is_array($user_ids)) + { + $user_ids = array($user_ids); + } + if (empty($user_ids)) + { + return false; + } + + $user_ids = array_map('intval', $user_ids); + + $sql = 'SELECT * + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + if (!$row = $db->sql_fetchrow($result)) + { + $db->sql_freeresult($result); + return false; + } + $db->sql_freeresult($result); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_rank = 0 + WHERE group_id = ' . (int) $group_id . ' + AND user_rank <> 0 + AND user_rank = ' . (int) $row['group_rank'] . ' + AND ' . $db->sql_in_set('user_id', $user_ids); + $db->sql_query($sql); +} + +/** +* This is used to promote (to leader), demote or set as default a member/s +*/ +function group_user_attributes($action, $group_id, $user_id_ary = false, $username_ary = false, $group_name = false, $group_attributes = false) +{ + global $db, $auth, $user, $phpbb_container, $phpbb_log, $phpbb_dispatcher; + + // We need both username and user_id info + $result = user_get_id_name($user_id_ary, $username_ary); + + if (empty($user_id_ary) || $result !== false) + { + return 'NO_USERS'; + } + + if (!$group_name) + { + $group_name = get_group_name($group_id); + } + + switch ($action) + { + case 'demote': + case 'promote': + + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + AND user_pending = 1 + AND " . $db->sql_in_set('user_id', $user_id_ary); + $result = $db->sql_query_limit($sql, 1); + $not_empty = ($db->sql_fetchrow($result)); + $db->sql_freeresult($result); + if ($not_empty) + { + return 'NO_VALID_USERS'; + } + + $sql = 'UPDATE ' . USER_GROUP_TABLE . ' + SET group_leader = ' . (($action == 'promote') ? 1 : 0) . " + WHERE group_id = $group_id + AND user_pending = 0 + AND " . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + + $log = ($action == 'promote') ? 'LOG_GROUP_PROMOTED' : 'LOG_GROUP_DEMOTED'; + break; + + case 'approve': + // Make sure we only approve those which are pending ;) + $sql = 'SELECT u.user_id, u.user_email, u.username, u.username_clean, u.user_notify_type, u.user_jabber, u.user_lang + FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . ' ug + WHERE ug.group_id = ' . $group_id . ' + AND ug.user_pending = 1 + AND ug.user_id = u.user_id + AND ' . $db->sql_in_set('ug.user_id', $user_id_ary); + $result = $db->sql_query($sql); + + $user_id_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_id_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + if (!count($user_id_ary)) + { + return false; + } + + $sql = 'UPDATE ' . USER_GROUP_TABLE . " + SET user_pending = 0 + WHERE group_id = $group_id + AND " . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $phpbb_notifications->add_notifications('notification.type.group_request_approved', array( + 'user_ids' => $user_id_ary, + 'group_id' => $group_id, + 'group_name' => $group_name, + )); + $phpbb_notifications->delete_notifications('notification.type.group_request', $user_id_ary, $group_id); + + $log = 'LOG_USERS_APPROVED'; + break; + + case 'default': + // We only set default group for approved members of the group + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + AND user_pending = 0 + AND " . $db->sql_in_set('user_id', $user_id_ary); + $result = $db->sql_query($sql); + + $user_id_ary = $username_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_id_ary[] = $row['user_id']; + } + $db->sql_freeresult($result); + + $result = user_get_id_name($user_id_ary, $username_ary); + if (!count($user_id_ary) || $result !== false) + { + return 'NO_USERS'; + } + + $sql = 'SELECT user_id, group_id + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary, false, true); + $result = $db->sql_query($sql); + + $groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + if (!isset($groups[$row['group_id']])) + { + $groups[$row['group_id']] = array(); + } + $groups[$row['group_id']][] = $row['user_id']; + } + $db->sql_freeresult($result); + + foreach ($groups as $gid => $uids) + { + remove_default_rank($gid, $uids); + remove_default_avatar($gid, $uids); + } + group_set_user_default($group_id, $user_id_ary, $group_attributes); + $log = 'LOG_GROUP_DEFAULTS'; + break; + } + + /** + * Event to perform additional actions on setting user group attributes + * + * @event core.user_set_group_attributes + * @var int group_id ID of the group + * @var string group_name Name of the group + * @var array user_id_ary IDs of the users to set group attributes + * @var array username_ary Names of the users to set group attributes + * @var array group_attributes Group attributes which were changed + * @var string action Action to perform over the group members + * @since 3.1.10-RC1 + */ + $vars = array( + 'group_id', + 'group_name', + 'user_id_ary', + 'username_ary', + 'group_attributes', + 'action', + ); + extract($phpbb_dispatcher->trigger_event('core.user_set_group_attributes', compact($vars))); + + // Clear permissions cache of relevant users + $auth->acl_clear_prefetch($user_id_ary); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, $log, false, array($group_name, implode(', ', $username_ary))); + + group_update_listings($group_id); + + return false; +} + +/** +* A small version of validate_username to check for a group name's existence. To be called directly. +*/ +function group_validate_groupname($group_id, $group_name) +{ + global $db; + + $group_name = utf8_clean_string($group_name); + + if (!empty($group_id)) + { + $sql = 'SELECT group_name + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + return false; + } + + $allowed_groupname = utf8_clean_string($row['group_name']); + + if ($allowed_groupname == $group_name) + { + return false; + } + } + + $sql = 'SELECT group_name + FROM ' . GROUPS_TABLE . " + WHERE LOWER(group_name) = '" . $db->sql_escape(utf8_strtolower($group_name)) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + return 'GROUP_NAME_TAKEN'; + } + + return false; +} + +/** +* Set users default group +* +* @access private +*/ +function group_set_user_default($group_id, $user_id_ary, $group_attributes = false, $update_listing = false) +{ + global $config, $phpbb_container, $db, $phpbb_dispatcher; + + if (empty($user_id_ary)) + { + return; + } + + $attribute_ary = array( + 'group_colour' => 'string', + 'group_rank' => 'int', + 'group_avatar' => 'string', + 'group_avatar_type' => 'string', + 'group_avatar_width' => 'int', + 'group_avatar_height' => 'int', + ); + + $sql_ary = array( + 'group_id' => $group_id + ); + + // Were group attributes passed to the function? If not we need to obtain them + if ($group_attributes === false) + { + $sql = 'SELECT ' . implode(', ', array_keys($attribute_ary)) . ' + FROM ' . GROUPS_TABLE . " + WHERE group_id = $group_id"; + $result = $db->sql_query($sql); + $group_attributes = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + foreach ($attribute_ary as $attribute => $type) + { + if (isset($group_attributes[$attribute])) + { + // If we are about to set an avatar or rank, we will not overwrite with empty, unless we are not actually changing the default group + if ((strpos($attribute, 'group_avatar') === 0 || strpos($attribute, 'group_rank') === 0) && !$group_attributes[$attribute]) + { + continue; + } + + settype($group_attributes[$attribute], $type); + $sql_ary[str_replace('group_', 'user_', $attribute)] = $group_attributes[$attribute]; + } + } + + $updated_sql_ary = $sql_ary; + + // Before we update the user attributes, we will update the rank for users that don't have a custom rank + if (isset($sql_ary['user_rank'])) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', array('user_rank' => $sql_ary['user_rank'])) . ' + WHERE user_rank = 0 + AND ' . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + unset($sql_ary['user_rank']); + } + + // Before we update the user attributes, we will update the avatar for users that don't have a custom avatar + $avatar_options = array('user_avatar', 'user_avatar_type', 'user_avatar_height', 'user_avatar_width'); + + if (isset($sql_ary['user_avatar'])) + { + $avatar_sql_ary = array(); + foreach ($avatar_options as $avatar_option) + { + if (isset($sql_ary[$avatar_option])) + { + $avatar_sql_ary[$avatar_option] = $sql_ary[$avatar_option]; + } + } + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $avatar_sql_ary) . " + WHERE user_avatar = '' + AND " . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + } + + // Remove the avatar options, as we already updated them + foreach ($avatar_options as $avatar_option) + { + unset($sql_ary[$avatar_option]); + } + + if (!empty($sql_ary)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE ' . $db->sql_in_set('user_id', $user_id_ary); + $db->sql_query($sql); + } + + if (isset($sql_ary['user_colour'])) + { + // Update any cached colour information for these users + $sql = 'UPDATE ' . FORUMS_TABLE . " + SET forum_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('forum_last_poster_id', $user_id_ary); + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_first_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('topic_poster', $user_id_ary); + $db->sql_query($sql); + + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_last_poster_colour = '" . $db->sql_escape($sql_ary['user_colour']) . "' + WHERE " . $db->sql_in_set('topic_last_poster_id', $user_id_ary); + $db->sql_query($sql); + + if (in_array($config['newest_user_id'], $user_id_ary)) + { + $config->set('newest_user_colour', $sql_ary['user_colour'], false); + } + } + + // Make all values available for the event + $sql_ary = $updated_sql_ary; + + /** + * Event when the default group is set for an array of users + * + * @event core.user_set_default_group + * @var int group_id ID of the group + * @var array user_id_ary IDs of the users + * @var array group_attributes Group attributes which were changed + * @var array update_listing Update the list of moderators and foes + * @var array sql_ary User attributes which were changed + * @since 3.1.0-a1 + */ + $vars = array('group_id', 'user_id_ary', 'group_attributes', 'update_listing', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.user_set_default_group', compact($vars))); + + if ($update_listing) + { + group_update_listings($group_id); + } + + // Because some tables/caches use usercolour-specific data we need to purge this here. + $phpbb_container->get('cache.driver')->destroy('sql', MODERATOR_CACHE_TABLE); +} + +/** +* Get group name +*/ +function get_group_name($group_id) +{ + global $db, $phpbb_container; + + $sql = 'SELECT group_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . (int) $group_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + return ''; + } + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + return $group_helper->get_name($row['group_name']); +} + +/** +* Obtain either the members of a specified group, the groups the specified user is subscribed to +* or checking if a specified user is in a specified group. This function does not return pending memberships. +* +* Note: Never use this more than once... first group your users/groups +*/ +function group_memberships($group_id_ary = false, $user_id_ary = false, $return_bool = false) +{ + global $db; + + if (!$group_id_ary && !$user_id_ary) + { + return true; + } + + if ($user_id_ary) + { + $user_id_ary = (!is_array($user_id_ary)) ? array($user_id_ary) : $user_id_ary; + } + + if ($group_id_ary) + { + $group_id_ary = (!is_array($group_id_ary)) ? array($group_id_ary) : $group_id_ary; + } + + $sql = 'SELECT ug.*, u.username, u.username_clean, u.user_email + FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u + WHERE ug.user_id = u.user_id + AND ug.user_pending = 0 AND '; + + if ($group_id_ary) + { + $sql .= ' ' . $db->sql_in_set('ug.group_id', $group_id_ary); + } + + if ($user_id_ary) + { + $sql .= ($group_id_ary) ? ' AND ' : ' '; + $sql .= $db->sql_in_set('ug.user_id', $user_id_ary); + } + + $result = ($return_bool) ? $db->sql_query_limit($sql, 1) : $db->sql_query($sql); + + $row = $db->sql_fetchrow($result); + + if ($return_bool) + { + $db->sql_freeresult($result); + return ($row) ? true : false; + } + + if (!$row) + { + return false; + } + + $return = array(); + + do + { + $return[] = $row; + } + while ($row = $db->sql_fetchrow($result)); + + $db->sql_freeresult($result); + + return $return; +} + +/** +* Re-cache moderators and foes if group has a_ or m_ permissions +*/ +function group_update_listings($group_id) +{ + global $db, $cache, $auth; + + $hold_ary = $auth->acl_group_raw_data($group_id, array('a_', 'm_')); + + if (empty($hold_ary)) + { + return; + } + + $mod_permissions = $admin_permissions = false; + + foreach ($hold_ary as $g_id => $forum_ary) + { + foreach ($forum_ary as $forum_id => $auth_ary) + { + foreach ($auth_ary as $auth_option => $setting) + { + if ($mod_permissions && $admin_permissions) + { + break 3; + } + + if ($setting != ACL_YES) + { + continue; + } + + if ($auth_option == 'm_') + { + $mod_permissions = true; + } + + if ($auth_option == 'a_') + { + $admin_permissions = true; + } + } + } + } + + if ($mod_permissions) + { + if (!function_exists('phpbb_cache_moderators')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + phpbb_cache_moderators($db, $cache, $auth); + } + + if ($mod_permissions || $admin_permissions) + { + if (!function_exists('phpbb_update_foes')) + { + global $phpbb_root_path, $phpEx; + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + phpbb_update_foes($db, $auth, array($group_id)); + } +} + + + +/** +* Funtion to make a user leave the NEWLY_REGISTERED system group. +* @access public +* @param $user_id The id of the user to remove from the group +*/ +function remove_newly_registered($user_id, $user_data = false) +{ + global $db; + + if ($user_data === false) + { + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + return false; + } + else + { + $user_data = $user_row; + } + } + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = 'NEWLY_REGISTERED' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $group_id = (int) $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + + if (!$group_id) + { + return false; + } + + // We need to call group_user_del here, because this function makes sure everything is correctly changed. + // Force function to not log the removal of users from newly registered users group + group_user_del($group_id, $user_id, false, false, false); + + // Set user_new to 0 to let this not be triggered again + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_new = 0 + WHERE user_id = ' . $user_id; + $db->sql_query($sql); + + // The new users group was the users default group? + if ($user_data['group_id'] == $group_id) + { + // Which group is now the users default one? + $sql = 'SELECT group_id + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $user_data['group_id'] = $db->sql_fetchfield('group_id'); + $db->sql_freeresult($result); + } + + return $user_data['group_id']; +} + +/** +* Gets user ids of currently banned registered users. +* +* @param array $user_ids Array of users' ids to check for banning, +* leave empty to get complete list of banned ids +* @param bool|int $ban_end Bool True to get users currently banned +* Bool False to only get permanently banned users +* Int Unix timestamp to get users banned until that time +* @return array Array of banned users' ids if any, empty array otherwise +*/ +function phpbb_get_banned_user_ids($user_ids = array(), $ban_end = true) +{ + global $db; + + $sql_user_ids = (!empty($user_ids)) ? $db->sql_in_set('ban_userid', $user_ids) : 'ban_userid <> 0'; + + // Get banned User ID's + // Ignore stale bans which were not wiped yet + $banned_ids_list = array(); + $sql = 'SELECT ban_userid + FROM ' . BANLIST_TABLE . " + WHERE $sql_user_ids + AND ban_exclude <> 1"; + + if ($ban_end === true) + { + // Banned currently + $sql .= " AND (ban_end > " . time() . ' + OR ban_end = 0)'; + } + else if ($ban_end === false) + { + // Permanently banned + $sql .= " AND ban_end = 0"; + } + else + { + // Banned until a specified time + $sql .= " AND (ban_end > " . (int) $ban_end . ' + OR ban_end = 0)'; + } + + $result = $db->sql_query($sql); + while ($row = $db->sql_fetchrow($result)) + { + $user_id = (int) $row['ban_userid']; + $banned_ids_list[$user_id] = $user_id; + } + $db->sql_freeresult($result); + + return $banned_ids_list; +} + +/** +* Function for assigning a template var if the zebra module got included +*/ +function phpbb_module_zebra($mode, &$module_row) +{ + global $template; + + $template->assign_var('S_ZEBRA_ENABLED', true); + + if ($mode == 'friends') + { + $template->assign_var('S_ZEBRA_FRIENDS_ENABLED', true); + } + + if ($mode == 'foes') + { + $template->assign_var('S_ZEBRA_FOES_ENABLED', true); + } +} diff --git a/install/update/old/includes/mcp/mcp_ban.php b/install/update/old/includes/mcp/mcp_ban.php new file mode 100644 index 0000000..8797f06 --- /dev/null +++ b/install/update/old/includes/mcp/mcp_ban.php @@ -0,0 +1,301 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class mcp_ban +{ + var $u_action; + + function main($id, $mode) + { + global $db, $user, $auth, $template, $request, $phpbb_dispatcher; + global $phpbb_root_path, $phpEx; + + if (!function_exists('user_ban')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + // Include the admin banning interface... + if (!class_exists('acp_ban')) + { + include($phpbb_root_path . 'includes/acp/acp_ban.' . $phpEx); + } + + $bansubmit = $request->is_set_post('bansubmit'); + $unbansubmit = $request->is_set_post('unbansubmit'); + + $user->add_lang(array('acp/ban', 'acp/users')); + $this->tpl_name = 'mcp_ban'; + + /** + * Use this event to pass perform actions when a ban is issued or revoked + * + * @event core.mcp_ban_main + * @var bool bansubmit True if a ban is issued + * @var bool unbansubmit True if a ban is removed + * @var string mode Mode of the ban that is being worked on + * @since 3.1.0-RC5 + */ + $vars = array( + 'bansubmit', + 'unbansubmit', + 'mode', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_main', compact($vars))); + + // Ban submitted? + if ($bansubmit) + { + // Grab the list of entries + $ban = $request->variable('ban', '', $mode === 'user'); + $ban_length = $request->variable('banlength', 0); + $ban_length_other = $request->variable('banlengthother', ''); + $ban_exclude = $request->variable('banexclude', 0); + $ban_reason = $request->variable('banreason', '', true); + $ban_give_reason = $request->variable('bangivereason', '', true); + + if ($ban) + { + if (confirm_box(true)) + { + $abort_ban = false; + /** + * Use this event to modify the ban details before the ban is performed + * + * @event core.mcp_ban_before + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @var mixed abort_ban Either false, or an error message that is displayed to the user. + * If a string is given the bans are not issued. + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + 'abort_ban', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_before', compact($vars))); + + if ($abort_ban) + { + trigger_error($abort_ban); + } + user_ban($mode, $ban, $ban_length, $ban_length_other, $ban_exclude, $ban_reason, $ban_give_reason); + + /** + * Use this event to perform actions after the ban has been performed + * + * @event core.mcp_ban_after + * @var string mode One of the following: user, ip, email + * @var string ban Either string or array with usernames, ips or email addresses + * @var int ban_length Ban length in minutes + * @var string ban_length_other Ban length as a date (YYYY-MM-DD) + * @var bool ban_exclude Are we banning or excluding from another ban + * @var string ban_reason Ban reason displayed to moderators + * @var string ban_give_reason Ban reason displayed to the banned user + * @since 3.1.0-RC5 + */ + $vars = array( + 'mode', + 'ban', + 'ban_length', + 'ban_length_other', + 'ban_exclude', + 'ban_reason', + 'ban_give_reason', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_after', compact($vars))); + + trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '

« ' . $user->lang['BACK_TO_PREV'] . ''); + } + else + { + $hidden_fields = array( + 'mode' => $mode, + 'ban' => $ban, + 'bansubmit' => true, + 'banlength' => $ban_length, + 'banlengthother' => $ban_length_other, + 'banexclude' => $ban_exclude, + 'banreason' => $ban_reason, + 'bangivereason' => $ban_give_reason, + ); + + /** + * Use this event to pass data from the ban form to the confirmation screen + * + * @event core.mcp_ban_confirm + * @var array hidden_fields Hidden fields that are passed through the confirm screen + * @since 3.1.0-RC5 + */ + $vars = array('hidden_fields'); + extract($phpbb_dispatcher->trigger_event('core.mcp_ban_confirm', compact($vars))); + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields($hidden_fields)); + } + } + } + else if ($unbansubmit) + { + $ban = $request->variable('unban', array('')); + + if ($ban) + { + if (confirm_box(true)) + { + user_unban($mode, $ban); + + trigger_error($user->lang['BAN_UPDATE_SUCCESSFUL'] . '

« ' . $user->lang['BACK_TO_PREV'] . ''); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'mode' => $mode, + 'unbansubmit' => true, + 'unban' => $ban))); + } + } + } + + // Ban length options + $ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['UNTIL'] . ' -> '); + + $ban_end_options = ''; + foreach ($ban_end_text as $length => $text) + { + $ban_end_options .= ''; + } + + // Define language vars + $this->page_title = $user->lang[strtoupper($mode) . '_BAN']; + + $l_ban_explain = $user->lang[strtoupper($mode) . '_BAN_EXPLAIN']; + $l_ban_exclude_explain = $user->lang[strtoupper($mode) . '_BAN_EXCLUDE_EXPLAIN']; + $l_unban_title = $user->lang[strtoupper($mode) . '_UNBAN']; + $l_unban_explain = $user->lang[strtoupper($mode) . '_UNBAN_EXPLAIN']; + $l_no_ban_cell = $user->lang[strtoupper($mode) . '_NO_BANNED']; + + switch ($mode) + { + case 'user': + $l_ban_cell = $user->lang['USERNAME']; + break; + + case 'ip': + $l_ban_cell = $user->lang['IP_HOSTNAME']; + break; + + case 'email': + $l_ban_cell = $user->lang['EMAIL_ADDRESS']; + break; + } + + acp_ban::display_ban_options($mode); + + $template->assign_vars(array( + 'L_TITLE' => $this->page_title, + 'L_EXPLAIN' => $l_ban_explain, + 'L_UNBAN_TITLE' => $l_unban_title, + 'L_UNBAN_EXPLAIN' => $l_unban_explain, + 'L_BAN_CELL' => $l_ban_cell, + 'L_BAN_EXCLUDE_EXPLAIN' => $l_ban_exclude_explain, + 'L_NO_BAN_CELL' => $l_no_ban_cell, + + 'S_USERNAME_BAN' => ($mode == 'user') ? true : false, + + 'U_ACTION' => $this->u_action, + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp_ban&field=ban'), + )); + + if ($mode === 'email' && !$auth->acl_get('a_user')) + { + return; + } + + // As a "service" we will check if any post id is specified and populate the username of the poster id if given + $post_id = $request->variable('p', 0); + $user_id = $request->variable('u', 0); + $pre_fill = false; + + if ($user_id && $user_id <> ANONYMOUS) + { + $sql = 'SELECT username, user_email, user_ip + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + switch ($mode) + { + case 'user': + $pre_fill = (string) $db->sql_fetchfield('username'); + break; + + case 'ip': + $pre_fill = (string) $db->sql_fetchfield('user_ip'); + break; + + case 'email': + $pre_fill = (string) $db->sql_fetchfield('user_email'); + break; + } + $db->sql_freeresult($result); + } + else if ($post_id) + { + $post_info = phpbb_get_post_data($post_id, 'm_ban'); + + if (count($post_info) && !empty($post_info[$post_id])) + { + switch ($mode) + { + case 'user': + $pre_fill = $post_info[$post_id]['username']; + break; + + case 'ip': + $pre_fill = $post_info[$post_id]['poster_ip']; + break; + + case 'email': + $pre_fill = $post_info[$post_id]['user_email']; + break; + } + + } + } + + if ($pre_fill) + { + // left for legacy template compatibility + $template->assign_var('USERNAMES', $pre_fill); + $template->assign_var('BAN_QUANTIFIER', $pre_fill); + } + } +} diff --git a/install/update/old/includes/mcp/mcp_logs.php b/install/update/old/includes/mcp/mcp_logs.php new file mode 100644 index 0000000..79f9d35 --- /dev/null +++ b/install/update/old/includes/mcp/mcp_logs.php @@ -0,0 +1,230 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* mcp_logs +* Handling warning the users +*/ +class mcp_logs +{ + var $u_action; + var $p_master; + + function __construct($p_master) + { + $this->p_master = $p_master; + } + + function main($id, $mode) + { + global $auth, $db, $user, $template, $request; + global $config, $phpbb_container, $phpbb_log; + + $user->add_lang('acp/common'); + + $action = $request->variable('action', array('' => '')); + + if (is_array($action)) + { + list($action, ) = each($action); + } + else + { + $action = $request->variable('action', ''); + } + + // Set up general vars + $start = $request->variable('start', 0); + $deletemark = ($action == 'del_marked') ? true : false; + $deleteall = ($action == 'del_all') ? true : false; + $marked = $request->variable('mark', array(0)); + + // Sort keys + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); + + $this->tpl_name = 'mcp_logs'; + $this->page_title = 'MCP_LOGS'; + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + $forum_list = array_values(array_intersect(get_forum_list('f_read'), get_forum_list('m_'))); + $forum_list[] = 0; + + $forum_id = $topic_id = 0; + + switch ($mode) + { + case 'front': + break; + + case 'forum_logs': + $forum_id = $request->variable('f', 0); + + if (!in_array($forum_id, $forum_list)) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } + + $forum_list = array($forum_id); + break; + + case 'topic_logs': + $topic_id = $request->variable('t', 0); + + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $forum_id = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + if (!in_array($forum_id, $forum_list)) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } + + $forum_list = array($forum_id); + break; + } + + // Delete entries if requested and able + if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) + { + if (confirm_box(true)) + { + if ($deletemark && count($marked)) + { + $conditions = array( + 'forum_id' => array('IN' => $forum_list), + 'log_id' => array('IN' => $marked), + ); + + $phpbb_log->delete('mod', $conditions); + } + else if ($deleteall) + { + $keywords = $request->variable('keywords', '', true); + + $conditions = array( + 'forum_id' => array('IN' => $forum_list), + 'keywords' => $keywords, + ); + + if ($sort_days) + { + $conditions['log_time'] = array('>=', time() - ($sort_days * 86400)); + } + + if ($mode == 'topic_logs') + { + $conditions['topic_id'] = $topic_id; + } + + $phpbb_log->delete('mod', $conditions); + } + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'f' => $forum_id, + 't' => $topic_id, + 'start' => $start, + 'delmarked' => $deletemark, + 'delall' => $deleteall, + 'mark' => $marked, + 'st' => $sort_days, + 'sk' => $sort_key, + 'sd' => $sort_dir, + 'i' => $id, + 'mode' => $mode, + 'action' => $request->variable('action', array('' => '')))) + ); + } + } + + // Sorting + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('u' => $user->lang['SORT_USERNAME'], 't' => $user->lang['SORT_DATE'], 'i' => $user->lang['SORT_IP'], 'o' => $user->lang['SORT_ACTION']); + $sort_by_sql = array('u' => 'u.username_clean', 't' => 'l.log_time', 'i' => 'l.log_ip', 'o' => 'l.log_operation'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + // Define where and sort sql for use in displaying logs + $sql_where = ($sort_days) ? (time() - ($sort_days * 86400)) : 0; + $sql_sort = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + + $keywords = $request->variable('keywords', '', true); + $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; + + // Grab log data + $log_data = array(); + $log_count = 0; + $start = view_log('mod', $log_data, $log_count, $config['topics_per_page'], $start, $forum_list, $topic_id, 0, $sql_where, $sql_sort, $keywords); + + $base_url = $this->u_action . "&$u_sort_param$keywords_param"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'TOTAL' => $user->lang('TOTAL_LOGS', (int) $log_count), + + 'L_TITLE' => $user->lang['MCP_LOGS'], + + 'U_POST_ACTION' => $this->u_action . "&$u_sort_param$keywords_param&start=$start", + 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_LOGS' => ($log_count > 0), + 'S_KEYWORDS' => $keywords, + ) + ); + + foreach ($log_data as $row) + { + $data = array(); + + $checks = array('viewpost', 'viewtopic', 'viewforum'); + foreach ($checks as $check) + { + if (isset($row[$check]) && $row[$check]) + { + $data[] = '' . $user->lang['LOGVIEW_' . strtoupper($check)] . ''; + } + } + + $template->assign_block_vars('log', array( + 'USERNAME' => $row['username_full'], + 'IP' => $row['ip'], + 'DATE' => $user->format_date($row['time']), + 'ACTION' => $row['action'], + 'DATA' => (count($data)) ? implode(' | ', $data) : '', + 'ID' => $row['id'], + ) + ); + } + } +} diff --git a/install/update/old/includes/mcp/mcp_main.php b/install/update/old/includes/mcp/mcp_main.php new file mode 100644 index 0000000..4bd783b --- /dev/null +++ b/install/update/old/includes/mcp/mcp_main.php @@ -0,0 +1,1701 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* mcp_main +* Handling mcp actions +*/ +class mcp_main +{ + var $p_master; + var $u_action; + + function __construct($p_master) + { + $this->p_master = $p_master; + } + + function main($id, $mode) + { + global $auth, $user, $action; + global $phpbb_root_path, $phpEx, $request; + global $phpbb_dispatcher; + + $quickmod = ($mode == 'quickmod') ? true : false; + + switch ($action) + { + case 'lock': + case 'unlock': + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + lock_unlock($action, $topic_ids); + break; + + case 'lock_post': + case 'unlock_post': + + $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0)); + + if (!count($post_ids)) + { + trigger_error('NO_POST_SELECTED'); + } + + lock_unlock($action, $post_ids); + break; + + case 'make_announce': + case 'make_sticky': + case 'make_global': + case 'make_normal': + + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + change_topic_type($action, $topic_ids); + break; + + case 'move': + $user->add_lang('viewtopic'); + + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + mcp_move_topic($topic_ids); + break; + + case 'fork': + $user->add_lang('viewtopic'); + + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + mcp_fork_topic($topic_ids); + break; + + case 'delete_topic': + $user->add_lang('viewtopic'); + + // f parameter is not reliable for permission usage, however we just use it to decide + // which permission we will check later on. So if it is manipulated, we will still catch it later on. + $forum_id = $request->variable('f', 0); + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + $soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false; + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + mcp_delete_topic($topic_ids, $soft_delete, $request->variable('delete_reason', '', true)); + break; + + case 'delete_post': + $user->add_lang('posting'); + + // f parameter is not reliable for permission usage, however we just use it to decide + // which permission we will check later on. So if it is manipulated, we will still catch it later on. + $forum_id = $request->variable('f', 0); + $post_ids = (!$quickmod) ? $request->variable('post_id_list', array(0)) : array($request->variable('p', 0)); + $soft_delete = (($request->is_set_post('confirm') && !$request->is_set_post('delete_permanent')) || !$auth->acl_get('m_delete', $forum_id)) ? true : false; + + if (!count($post_ids)) + { + trigger_error('NO_POST_SELECTED'); + } + + mcp_delete_post($post_ids, $soft_delete, $request->variable('delete_reason', '', true)); + break; + + case 'restore_topic': + $user->add_lang('posting'); + + $topic_ids = (!$quickmod) ? $request->variable('topic_id_list', array(0)) : array($request->variable('t', 0)); + + if (!count($topic_ids)) + { + trigger_error('NO_TOPIC_SELECTED'); + } + + mcp_restore_topic($topic_ids); + break; + + default: + /** + * This event allows you to handle custom quickmod options + * + * @event core.modify_quickmod_actions + * @var string action Topic quick moderation action name + * @var bool quickmod Flag indicating whether MCP is in quick moderation mode + * @since 3.1.0-a4 + * @changed 3.1.0-RC4 Added variables: action, quickmod + */ + $vars = array('action', 'quickmod'); + extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_actions', compact($vars))); + break; + } + + switch ($mode) + { + case 'front': + if (!function_exists('mcp_front_view')) + { + include($phpbb_root_path . 'includes/mcp/mcp_front.' . $phpEx); + } + + $user->add_lang('acp/common'); + + mcp_front_view($id, $mode, $action); + + $this->tpl_name = 'mcp_front'; + $this->page_title = 'MCP_MAIN'; + break; + + case 'forum_view': + if (!function_exists('mcp_forum_view')) + { + include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx); + } + + $user->add_lang('viewforum'); + + $forum_id = $request->variable('f', 0); + + $forum_info = phpbb_get_forum_data($forum_id, 'm_', true); + + if (!count($forum_info)) + { + $this->main('main', 'front'); + return; + } + + $forum_info = $forum_info[$forum_id]; + + mcp_forum_view($id, $mode, $action, $forum_info); + + $this->tpl_name = 'mcp_forum'; + $this->page_title = 'MCP_MAIN_FORUM_VIEW'; + break; + + case 'topic_view': + if (!function_exists('mcp_topic_view')) + { + include($phpbb_root_path . 'includes/mcp/mcp_topic.' . $phpEx); + } + + mcp_topic_view($id, $mode, $action); + + $this->tpl_name = 'mcp_topic'; + $this->page_title = 'MCP_MAIN_TOPIC_VIEW'; + break; + + case 'post_details': + if (!function_exists('mcp_post_details')) + { + include($phpbb_root_path . 'includes/mcp/mcp_post.' . $phpEx); + } + + mcp_post_details($id, $mode, $action); + + $this->tpl_name = ($action == 'whois') ? 'mcp_whois' : 'mcp_post'; + $this->page_title = 'MCP_MAIN_POST_DETAILS'; + break; + + default: + if ($quickmod) + { + switch ($action) + { + case 'lock': + case 'unlock': + case 'make_announce': + case 'make_sticky': + case 'make_global': + case 'make_normal': + case 'make_onindex': + case 'move': + case 'fork': + case 'delete_topic': + trigger_error('TOPIC_NOT_EXIST'); + break; + + case 'lock_post': + case 'unlock_post': + case 'delete_post': + trigger_error('POST_NOT_EXIST'); + break; + } + } + + trigger_error('NO_MODE', E_USER_ERROR); + break; + } + } +} + +/** +* Lock/Unlock Topic/Post +*/ +function lock_unlock($action, $ids) +{ + global $user, $db, $request, $phpbb_log, $phpbb_dispatcher; + + if ($action == 'lock' || $action == 'unlock') + { + $table = TOPICS_TABLE; + $sql_id = 'topic_id'; + $set_id = 'topic_status'; + $l_prefix = 'TOPIC'; + } + else + { + $table = POSTS_TABLE; + $sql_id = 'post_id'; + $set_id = 'post_edit_locked'; + $l_prefix = 'POST'; + } + + $orig_ids = $ids; + + if (!phpbb_check_ids($ids, $table, $sql_id, array('m_lock'))) + { + // Make sure that for f_user_lock only the lock action is triggered. + if ($action != 'lock') + { + return; + } + + $ids = $orig_ids; + + if (!phpbb_check_ids($ids, $table, $sql_id, array('f_user_lock'))) + { + return; + } + } + unset($orig_ids); + + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $redirect = reapply_sid($redirect); + + $s_hidden_fields = build_hidden_fields(array( + $sql_id . '_list' => $ids, + 'action' => $action, + 'redirect' => $redirect) + ); + + if (confirm_box(true)) + { + $sql = "UPDATE $table + SET $set_id = " . (($action == 'lock' || $action == 'lock_post') ? ITEM_LOCKED : ITEM_UNLOCKED) . ' + WHERE ' . $db->sql_in_set($sql_id, $ids); + $db->sql_query($sql); + + $data = ($action == 'lock' || $action == 'unlock') ? phpbb_get_topic_data($ids) : phpbb_get_post_data($ids); + + foreach ($data as $id => $row) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_' . strtoupper($action), false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => isset($row['post_id']) ? $row['post_id'] : 0, + $row['topic_title'] + )); + } + + /** + * Perform additional actions after locking/unlocking posts/topics + * + * @event core.mcp_lock_unlock_after + * @var string action Variable containing the action we perform on the posts/topics ('lock', 'unlock', 'lock_post' or 'unlock_post') + * @var array ids Array containing the post/topic IDs that have been locked/unlocked + * @var array data Array containing posts/topics data + * @since 3.1.7-RC1 + */ + $vars = array( + 'action', + 'ids', + 'data', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_lock_unlock_after', compact($vars))); + + $success_msg = $l_prefix . ((count($ids) == 1) ? '' : 'S') . '_' . (($action == 'lock' || $action == 'lock_post') ? 'LOCKED' : 'UNLOCKED') . '_SUCCESS'; + + meta_refresh(2, $redirect); + $message = $user->lang[$success_msg]; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + } + trigger_error($message); + } + else + { + confirm_box(false, strtoupper($action) . '_' . $l_prefix . ((count($ids) == 1) ? '' : 'S'), $s_hidden_fields); + } + + redirect($redirect); +} + +/** +* Change Topic Type +*/ +function change_topic_type($action, $topic_ids) +{ + global $user, $db, $request, $phpbb_log, $phpbb_dispatcher; + + switch ($action) + { + case 'make_announce': + $new_topic_type = POST_ANNOUNCE; + $check_acl = 'f_announce'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_ANNOUNCEMENT' : 'MCP_MAKE_ANNOUNCEMENTS'; + break; + + case 'make_global': + $new_topic_type = POST_GLOBAL; + $check_acl = 'f_announce_global'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_GLOBAL' : 'MCP_MAKE_GLOBALS'; + break; + + case 'make_sticky': + $new_topic_type = POST_STICKY; + $check_acl = 'f_sticky'; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_STICKY' : 'MCP_MAKE_STICKIES'; + break; + + default: + $new_topic_type = POST_NORMAL; + $check_acl = false; + $l_new_type = (count($topic_ids) == 1) ? 'MCP_MAKE_NORMAL' : 'MCP_MAKE_NORMALS'; + break; + } + + $forum_id = phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', $check_acl, true); + + if ($forum_id === false) + { + return; + } + + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $redirect = reapply_sid($redirect); + + $s_hidden_fields = array( + 'topic_id_list' => $topic_ids, + 'f' => $forum_id, + 'action' => $action, + 'redirect' => $redirect, + ); + + if (confirm_box(true)) + { + + /** + * Perform additional actions before changing topic(s) type + * + * @event core.mcp_change_topic_type_before + * @var int new_topic_type The candidated topic type. + * @var int forum_id The forum ID for the topic ID(s). + * @var array topic_ids Array containing the topic ID(s) that will be changed + * @since 3.2.6-RC1 + */ + $vars = array( + 'new_topic_type', + 'forum_id', + 'topic_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_change_topic_type_before', compact($vars))); + + $db->sql_transaction('begin'); + + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_type = $new_topic_type + WHERE " . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + + if (($new_topic_type == POST_GLOBAL) && count($topic_ids)) + { + // Delete topic shadows for global announcements + $sql = 'DELETE FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_moved_id', $topic_ids); + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_TYPE_CHANGED' : 'TOPICS_TYPE_CHANGED'; + + if (count($topic_ids)) + { + $data = phpbb_get_topic_data($topic_ids); + + foreach ($data as $topic_id => $row) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_TOPIC_TYPE_CHANGED', false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $row['topic_title'] + )); + } + } + + /** + * Perform additional actions after changing topic types + * + * @event core.mcp_change_topic_type_after + * @var int new_topic_type The newly changed topic type. + * @var int forum_id The forum ID where the newly changed topic type belongs to. + * @var array topic_ids Array containing the topic IDs that have been changed + * @since 3.2.6-RC1 + */ + $vars = array( + 'new_topic_type', + 'forum_id', + 'topic_ids', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_change_topic_type_after', compact($vars))); + + meta_refresh(2, $redirect); + $message = $user->lang[$success_msg]; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_PAGE', '', ''); + } + trigger_error($message); + } + else + { + confirm_box(false, $l_new_type, build_hidden_fields($s_hidden_fields)); + } + + redirect($redirect); +} + +/** +* Move Topic +*/ +function mcp_move_topic($topic_ids) +{ + global $auth, $user, $db, $template, $phpbb_log, $request, $phpbb_dispatcher; + global $phpEx, $phpbb_root_path; + + // Here we limit the operation to one forum only + $forum_id = phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_move'), true); + + if ($forum_id === false) + { + return; + } + + $to_forum_id = $request->variable('to_forum_id', 0); + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $additional_msg = $success_msg = ''; + + $s_hidden_fields = build_hidden_fields(array( + 'topic_id_list' => $topic_ids, + 'f' => $forum_id, + 'action' => 'move', + 'redirect' => $redirect) + ); + + if ($to_forum_id) + { + $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post'); + + if (!count($forum_data)) + { + $additional_msg = $user->lang['FORUM_NOT_EXIST']; + } + else + { + $forum_data = $forum_data[$to_forum_id]; + + if ($forum_data['forum_type'] != FORUM_POST) + { + $additional_msg = $user->lang['FORUM_NOT_POSTABLE']; + } + else if (!$auth->acl_get('f_post', $to_forum_id) || (!$auth->acl_get('m_approve', $to_forum_id) && !$auth->acl_get('f_noapprove', $to_forum_id))) + { + $additional_msg = $user->lang['USER_CANNOT_POST']; + } + else if ($forum_id == $to_forum_id) + { + $additional_msg = $user->lang['CANNOT_MOVE_SAME_FORUM']; + } + } + } + else if (isset($_POST['confirm'])) + { + $additional_msg = $user->lang['FORUM_NOT_EXIST']; + } + + if (!$to_forum_id || $additional_msg) + { + $request->overwrite('confirm', null, \phpbb\request\request_interface::POST); + $request->overwrite('confirm_key', null); + } + + if (confirm_box(true)) + { + $topic_data = phpbb_get_topic_data($topic_ids); + $leave_shadow = (isset($_POST['move_leave_shadow'])) ? true : false; + + $forum_sync_data = array(); + + $forum_sync_data[$forum_id] = current($topic_data); + $forum_sync_data[$to_forum_id] = $forum_data; + + $topics_moved = $topics_moved_unapproved = $topics_moved_softdeleted = 0; + $posts_moved = $posts_moved_unapproved = $posts_moved_softdeleted = 0; + + foreach ($topic_data as $topic_id => $topic_info) + { + if ($topic_info['topic_visibility'] == ITEM_APPROVED) + { + $topics_moved++; + } + else if ($topic_info['topic_visibility'] == ITEM_UNAPPROVED || $topic_info['topic_visibility'] == ITEM_REAPPROVE) + { + $topics_moved_unapproved++; + } + else if ($topic_info['topic_visibility'] == ITEM_DELETED) + { + $topics_moved_softdeleted++; + } + + $posts_moved += $topic_info['topic_posts_approved']; + $posts_moved_unapproved += $topic_info['topic_posts_unapproved']; + $posts_moved_softdeleted += $topic_info['topic_posts_softdeleted']; + } + + $db->sql_transaction('begin'); + + // Move topics, but do not resync yet + move_topics($topic_ids, $to_forum_id, false); + + if ($request->is_set_post('move_lock_topics') && $auth->acl_get('m_lock', $to_forum_id)) + { + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_status = ' . ITEM_LOCKED . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids); + $db->sql_query($sql); + } + + $shadow_topics = 0; + $forum_ids = array($to_forum_id); + foreach ($topic_data as $topic_id => $row) + { + // Get the list of forums to resync + $forum_ids[] = $row['forum_id']; + + // We add the $to_forum_id twice, because 'forum_id' is updated + // when the topic is moved again later. + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MOVE', false, array( + 'forum_id' => (int) $to_forum_id, + 'topic_id' => (int) $topic_id, + $row['forum_name'], + $forum_data['forum_name'], + (int) $row['forum_id'], + (int) $forum_data['forum_id'], + )); + + // Leave a redirection if required and only if the topic is visible to users + if ($leave_shadow && $row['topic_visibility'] == ITEM_APPROVED && $row['topic_type'] != POST_GLOBAL) + { + $shadow = array( + 'forum_id' => (int) $row['forum_id'], + 'icon_id' => (int) $row['icon_id'], + 'topic_attachment' => (int) $row['topic_attachment'], + 'topic_visibility' => ITEM_APPROVED, // a shadow topic is always approved + 'topic_reported' => 0, // a shadow topic is never reported + 'topic_title' => (string) $row['topic_title'], + 'topic_poster' => (int) $row['topic_poster'], + 'topic_time' => (int) $row['topic_time'], + 'topic_time_limit' => (int) $row['topic_time_limit'], + 'topic_views' => (int) $row['topic_views'], + 'topic_posts_approved' => (int) $row['topic_posts_approved'], + 'topic_posts_unapproved'=> (int) $row['topic_posts_unapproved'], + 'topic_posts_softdeleted'=> (int) $row['topic_posts_softdeleted'], + 'topic_status' => ITEM_MOVED, + 'topic_type' => POST_NORMAL, + 'topic_first_post_id' => (int) $row['topic_first_post_id'], + 'topic_first_poster_colour'=>(string) $row['topic_first_poster_colour'], + 'topic_first_poster_name'=> (string) $row['topic_first_poster_name'], + 'topic_last_post_id' => (int) $row['topic_last_post_id'], + 'topic_last_poster_id' => (int) $row['topic_last_poster_id'], + 'topic_last_poster_colour'=>(string) $row['topic_last_poster_colour'], + 'topic_last_poster_name'=> (string) $row['topic_last_poster_name'], + 'topic_last_post_subject'=> (string) $row['topic_last_post_subject'], + 'topic_last_post_time' => (int) $row['topic_last_post_time'], + 'topic_last_view_time' => (int) $row['topic_last_view_time'], + 'topic_moved_id' => (int) $row['topic_id'], + 'topic_bumped' => (int) $row['topic_bumped'], + 'topic_bumper' => (int) $row['topic_bumper'], + 'poll_title' => (string) $row['poll_title'], + 'poll_start' => (int) $row['poll_start'], + 'poll_length' => (int) $row['poll_length'], + 'poll_max_options' => (int) $row['poll_max_options'], + 'poll_last_vote' => (int) $row['poll_last_vote'] + ); + + /** + * Perform actions before shadow topic is created. + * + * @event core.mcp_main_modify_shadow_sql + * @var array shadow SQL array to be used by $db->sql_build_array + * @var array row Topic data + * @since 3.1.11-RC1 + * @changed 3.1.11-RC1 Added variable: row + */ + $vars = array( + 'shadow', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_shadow_sql', compact($vars))); + + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . $db->sql_build_array('INSERT', $shadow)); + + // Shadow topics only count on new "topics" and not posts... a shadow topic alone has 0 posts + $shadow_topics++; + } + } + unset($topic_data); + + $sync_sql = array(); + if ($posts_moved) + { + $sync_sql[$to_forum_id][] = 'forum_posts_approved = forum_posts_approved + ' . (int) $posts_moved; + $sync_sql[$forum_id][] = 'forum_posts_approved = forum_posts_approved - ' . (int) $posts_moved; + } + if ($posts_moved_unapproved) + { + $sync_sql[$to_forum_id][] = 'forum_posts_unapproved = forum_posts_unapproved + ' . (int) $posts_moved_unapproved; + $sync_sql[$forum_id][] = 'forum_posts_unapproved = forum_posts_unapproved - ' . (int) $posts_moved_unapproved; + } + if ($posts_moved_softdeleted) + { + $sync_sql[$to_forum_id][] = 'forum_posts_softdeleted = forum_posts_softdeleted + ' . (int) $posts_moved_softdeleted; + $sync_sql[$forum_id][] = 'forum_posts_softdeleted = forum_posts_softdeleted - ' . (int) $posts_moved_softdeleted; + } + + if ($topics_moved) + { + $sync_sql[$to_forum_id][] = 'forum_topics_approved = forum_topics_approved + ' . (int) $topics_moved; + if ($topics_moved - $shadow_topics > 0) + { + $sync_sql[$forum_id][] = 'forum_topics_approved = forum_topics_approved - ' . (int) ($topics_moved - $shadow_topics); + } + } + if ($topics_moved_unapproved) + { + $sync_sql[$to_forum_id][] = 'forum_topics_unapproved = forum_topics_unapproved + ' . (int) $topics_moved_unapproved; + $sync_sql[$forum_id][] = 'forum_topics_unapproved = forum_topics_unapproved - ' . (int) $topics_moved_unapproved; + } + if ($topics_moved_softdeleted) + { + $sync_sql[$to_forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted + ' . (int) $topics_moved_softdeleted; + $sync_sql[$forum_id][] = 'forum_topics_softdeleted = forum_topics_softdeleted - ' . (int) $topics_moved_softdeleted; + } + + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_MOVED_SUCCESS' : 'TOPICS_MOVED_SUCCESS'; + + foreach ($sync_sql as $forum_id_key => $array) + { + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET ' . implode(', ', $array) . ' + WHERE forum_id = ' . $forum_id_key; + $db->sql_query($sql); + } + + $db->sql_transaction('commit'); + + sync('forum', 'forum_id', array($forum_id, $to_forum_id)); + } + else + { + $template->assign_vars(array( + 'S_FORUM_SELECT' => make_forum_select($to_forum_id, $forum_id, false, true, true, true), + 'S_CAN_LEAVE_SHADOW' => true, + 'S_CAN_LOCK_TOPIC' => ($auth->acl_get('m_lock', $to_forum_id)) ? true : false, + 'ADDITIONAL_MSG' => $additional_msg) + ); + + confirm_box(false, 'MOVE_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); + } + + $redirect = $request->variable('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + + if (!$success_msg) + { + redirect($redirect); + } + else + { + meta_refresh(3, $redirect); + + $message = $user->lang[$success_msg]; + $message .= '

' . sprintf($user->lang['RETURN_PAGE'], '', ''); + $message .= '

' . sprintf($user->lang['RETURN_FORUM'], '', ''); + $message .= '

' . sprintf($user->lang['RETURN_NEW_FORUM'], '', ''); + + trigger_error($message); + } +} + +/** +* Restore Topics +*/ +function mcp_restore_topic($topic_ids) +{ + global $user, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log; + + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve'))) + { + return; + } + + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $forum_id = $request->variable('f', 0); + + $s_hidden_fields = build_hidden_fields(array( + 'topic_id_list' => $topic_ids, + 'f' => $forum_id, + 'action' => 'restore_topic', + 'redirect' => $redirect, + )); + $success_msg = ''; + + if (confirm_box(true)) + { + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_RESTORED_SUCCESS' : 'TOPICS_RESTORED_SUCCESS'; + + $data = phpbb_get_topic_data($topic_ids); + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + foreach ($data as $topic_id => $row) + { + $return = $phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), ''); + if (!empty($return)) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_RESTORE_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'], + $row['topic_first_poster_name'] + )); + } + } + } + else + { + confirm_box(false, (count($topic_ids) == 1) ? 'RESTORE_TOPIC' : 'RESTORE_TOPICS', $s_hidden_fields); + } + + $topic_id = $request->variable('t', 0); + if (!$request->is_set('quickmod', \phpbb\request\request_interface::REQUEST)) + { + $redirect = $request->variable('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + $redirect_message = 'PAGE'; + } + else if ($topic_id) + { + $redirect = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id); + $redirect_message = 'TOPIC'; + } + else + { + $redirect = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + $redirect_message = 'FORUM'; + } + + if (!$success_msg) + { + redirect($redirect); + } + else + { + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_' . $redirect_message], '', '')); + } +} + +/** +* Delete Topics +*/ +function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_topic') +{ + global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log; + + $check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete'; + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array($check_permission))) + { + return; + } + + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $forum_id = $request->variable('f', 0); + + $s_hidden_fields = array( + 'topic_id_list' => $topic_ids, + 'f' => $forum_id, + 'action' => $action, + 'redirect' => $redirect, + ); + $success_msg = ''; + + if (confirm_box(true)) + { + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_DELETED_SUCCESS' : 'TOPICS_DELETED_SUCCESS'; + + $data = phpbb_get_topic_data($topic_ids); + + foreach ($data as $topic_id => $row) + { + if ($row['topic_moved_id']) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_SHADOW_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'] + )); + } + else + { + // Only soft delete non-shadow topics + if ($is_soft) + { + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + $return = $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason); + if (!empty($return)) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SOFTDELETE_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'], + $row['topic_first_poster_name'], + $soft_delete_reason + )); + } + } + else + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_TOPIC', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $topic_id, + $row['topic_title'], + $row['topic_first_poster_name'], + $soft_delete_reason + )); + } + } + } + + if (!$is_soft) + { + delete_topics('topic_id', $topic_ids); + } + } + else + { + global $template; + + $user->add_lang('posting'); + + // If there are only shadow topics, we neither need a reason nor softdelete + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + AND topic_moved_id = 0'; + $result = $db->sql_query_limit($sql, 1); + $only_shadow = !$db->sql_fetchfield('topic_id'); + $db->sql_freeresult($result); + + $only_softdeleted = false; + if (!$only_shadow && $auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id)) + { + // If there are only soft deleted topics, we display a message why the option is not available + $sql = 'SELECT topic_id + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_ids) . ' + AND topic_visibility <> ' . ITEM_DELETED; + $result = $db->sql_query_limit($sql, 1); + $only_softdeleted = !$db->sql_fetchfield('topic_id'); + $db->sql_freeresult($result); + } + + $template->assign_vars(array( + 'S_SHADOW_TOPICS' => $only_shadow, + 'S_SOFTDELETED' => $only_softdeleted, + 'S_TOPIC_MODE' => true, + 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), + 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), + 'DELETE_TOPIC_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_TOPIC_PERMANENTLY', count($topic_ids)), + )); + + $count = count($topic_ids); + $l_confirm = $count === 1 ? 'DELETE_TOPIC' : 'DELETE_TOPICS'; + if ($only_softdeleted) + { + $l_confirm = array($l_confirm . '_PERMANENTLY', $count); + $s_hidden_fields['delete_permanent'] = '1'; + } + else if ($only_shadow || !$auth->acl_get('m_softdelete', $forum_id)) + { + $s_hidden_fields['delete_permanent'] = '1'; + } + + confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html'); + } + + $topic_id = $request->variable('t', 0); + if (!$request->is_set('quickmod', \phpbb\request\request_interface::REQUEST)) + { + $redirect = $request->variable('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + $redirect_message = 'PAGE'; + } + else if ($is_soft && $topic_id) + { + $redirect = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $topic_id); + $redirect_message = 'TOPIC'; + } + else + { + $redirect = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + $redirect_message = 'FORUM'; + } + + if (!$success_msg) + { + redirect($redirect); + } + else + { + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '

' . sprintf($user->lang['RETURN_' . $redirect_message], '', '')); + } +} + +/** +* Delete Posts +*/ +function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_post') +{ + global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container, $phpbb_log; + + $check_permission = ($is_soft) ? 'm_softdelete' : 'm_delete'; + if (!phpbb_check_ids($post_ids, POSTS_TABLE, 'post_id', array($check_permission))) + { + return; + } + + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $forum_id = $request->variable('f', 0); + + $s_hidden_fields = array( + 'post_id_list' => $post_ids, + 'f' => $forum_id, + 'action' => $action, + 'redirect' => $redirect, + ); + $success_msg = ''; + + if (confirm_box(true) && $is_soft) + { + $post_info = phpbb_get_post_data($post_ids); + + $topic_info = $approve_log = array(); + + // Group the posts by topic_id + foreach ($post_info as $post_id => $post_data) + { + if ($post_data['post_visibility'] != ITEM_APPROVED) + { + continue; + } + $topic_id = (int) $post_data['topic_id']; + + $topic_info[$topic_id]['posts'][] = (int) $post_id; + $topic_info[$topic_id]['forum_id'] = (int) $post_data['forum_id']; + + if ($post_id == $post_data['topic_first_post_id']) + { + $topic_info[$topic_id]['first_post'] = true; + } + + if ($post_id == $post_data['topic_last_post_id']) + { + $topic_info[$topic_id]['last_post'] = true; + } + + $approve_log[] = array( + 'forum_id' => $post_data['forum_id'], + 'topic_id' => $post_data['topic_id'], + 'post_id' => $post_id, + 'post_subject' => $post_data['post_subject'], + 'poster_id' => $post_data['poster_id'], + 'post_username' => $post_data['post_username'], + 'username' => $post_data['username'], + ); + } + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + foreach ($topic_info as $topic_id => $topic_data) + { + $phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post'])); + } + $affected_topics = count($topic_info); + // None of the topics is really deleted, so a redirect won't hurt much. + $deleted_topics = 0; + + $success_msg = (count($post_info) == 1) ? $user->lang['POST_DELETED_SUCCESS'] : $user->lang['POSTS_DELETED_SUCCESS']; + + foreach ($approve_log as $row) + { + $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SOFTDELETE_POST', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => $row['post_id'], + $row['post_subject'], + $post_username, + $soft_delete_reason + )); + } + + $topic_id = $request->variable('t', 0); + + // Return links + $return_link = array(); + if ($affected_topics == 1 && $topic_id) + { + $return_link[] = sprintf($user->lang['RETURN_TOPIC'], '', ''); + } + $return_link[] = sprintf($user->lang['RETURN_FORUM'], '', ''); + + } + else if (confirm_box(true)) + { + if (!function_exists('delete_posts')) + { + include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + } + + // Count the number of topics that are affected + // I did not use COUNT(DISTINCT ...) because I remember having problems + // with it on older versions of MySQL -- Ashe + + $sql = 'SELECT DISTINCT topic_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_id', $post_ids); + $result = $db->sql_query($sql); + + $topic_id_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $topic_id_list[] = $row['topic_id']; + } + $affected_topics = count($topic_id_list); + $db->sql_freeresult($result); + + $post_data = phpbb_get_post_data($post_ids); + + foreach ($post_data as $id => $row) + { + $post_username = ($row['poster_id'] == ANONYMOUS && !empty($row['post_username'])) ? $row['post_username'] : $row['username']; + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_DELETE_POST', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => $row['post_id'], + $row['post_subject'], + $post_username, + $soft_delete_reason + )); + } + + // Now delete the posts, topics and forums are automatically resync'ed + delete_posts('post_id', $post_ids); + + $sql = 'SELECT COUNT(topic_id) AS topics_left + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', $topic_id_list); + $result = $db->sql_query_limit($sql, 1); + + $deleted_topics = ($row = $db->sql_fetchrow($result)) ? ($affected_topics - $row['topics_left']) : $affected_topics; + $db->sql_freeresult($result); + + $topic_id = $request->variable('t', 0); + + // Return links + $return_link = array(); + if ($affected_topics == 1 && !$deleted_topics && $topic_id) + { + $return_link[] = sprintf($user->lang['RETURN_TOPIC'], '', ''); + } + $return_link[] = sprintf($user->lang['RETURN_FORUM'], '', ''); + + if (count($post_ids) == 1) + { + if ($deleted_topics) + { + // We deleted the only post of a topic, which in turn has + // been removed from the database + $success_msg = $user->lang['TOPIC_DELETED_SUCCESS']; + } + else + { + $success_msg = $user->lang['POST_DELETED_SUCCESS']; + } + } + else + { + if ($deleted_topics) + { + // Some of topics disappeared + $success_msg = $user->lang['POSTS_DELETED_SUCCESS'] . '

' . $user->lang['EMPTY_TOPICS_REMOVED_WARNING']; + } + else + { + $success_msg = $user->lang['POSTS_DELETED_SUCCESS']; + } + } + } + else + { + global $template; + + $user->add_lang('posting'); + + $only_softdeleted = false; + if ($auth->acl_get('m_delete', $forum_id) && $auth->acl_get('m_softdelete', $forum_id)) + { + // If there are only soft deleted posts, we display a message why the option is not available + $sql = 'SELECT post_id + FROM ' . POSTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_id', $post_ids) . ' + AND post_visibility <> ' . ITEM_DELETED; + $result = $db->sql_query_limit($sql, 1); + $only_softdeleted = !$db->sql_fetchfield('post_id'); + $db->sql_freeresult($result); + } + + $template->assign_vars(array( + 'S_SOFTDELETED' => $only_softdeleted, + 'S_ALLOWED_DELETE' => $auth->acl_get('m_delete', $forum_id), + 'S_ALLOWED_SOFTDELETE' => $auth->acl_get('m_softdelete', $forum_id), + 'DELETE_POST_PERMANENTLY_EXPLAIN' => $user->lang('DELETE_POST_PERMANENTLY', count($post_ids)), + )); + + $count = count($post_ids); + $l_confirm = $count === 1 ? 'DELETE_POST' : 'DELETE_POSTS'; + if ($only_softdeleted) + { + $l_confirm = array($l_confirm . '_PERMANENTLY', $count); + $s_hidden_fields['delete_permanent'] = '1'; + } + else if (!$auth->acl_get('m_softdelete', $forum_id)) + { + $s_hidden_fields['delete_permanent'] = '1'; + } + + confirm_box(false, $l_confirm, build_hidden_fields($s_hidden_fields), 'confirm_delete_body.html'); + } + + $redirect = $request->variable('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + + if (!$success_msg) + { + redirect($redirect); + } + else + { + if ($affected_topics != 1 || $deleted_topics || !$topic_id) + { + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", false); + } + + meta_refresh(3, $redirect); + trigger_error($success_msg . '

' . sprintf($user->lang['RETURN_PAGE'], '', '') . '

' . implode('

', $return_link)); + } +} + +/** +* Fork Topic +*/ +function mcp_fork_topic($topic_ids) +{ + global $auth, $user, $db, $template, $config; + global $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher; + + if (!phpbb_check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) + { + return; + } + + $to_forum_id = $request->variable('to_forum_id', 0); + $forum_id = $request->variable('f', 0); + $redirect = $request->variable('redirect', build_url(array('action', 'quickmod'))); + $additional_msg = $success_msg = ''; + $counter = array(); + + $s_hidden_fields = build_hidden_fields(array( + 'topic_id_list' => $topic_ids, + 'f' => $forum_id, + 'action' => 'fork', + 'redirect' => $redirect) + ); + + if ($to_forum_id) + { + $forum_data = phpbb_get_forum_data($to_forum_id, 'f_post'); + + if (!count($topic_ids)) + { + $additional_msg = $user->lang['NO_TOPIC_SELECTED']; + } + else if (!count($forum_data)) + { + $additional_msg = $user->lang['FORUM_NOT_EXIST']; + } + else + { + $forum_data = $forum_data[$to_forum_id]; + + if ($forum_data['forum_type'] != FORUM_POST) + { + $additional_msg = $user->lang['FORUM_NOT_POSTABLE']; + } + else if (!$auth->acl_get('f_post', $to_forum_id)) + { + $additional_msg = $user->lang['USER_CANNOT_POST']; + } + } + } + else if (isset($_POST['confirm'])) + { + $additional_msg = $user->lang['FORUM_NOT_EXIST']; + } + + if ($additional_msg) + { + $request->overwrite('confirm', null, \phpbb\request\request_interface::POST); + $request->overwrite('confirm_key', null); + } + + if (confirm_box(true)) + { + $topic_data = phpbb_get_topic_data($topic_ids, 'f_post'); + + $total_topics = $total_topics_unapproved = $total_topics_softdeleted = 0; + $total_posts = $total_posts_unapproved = $total_posts_softdeleted = 0; + $new_topic_id_list = array(); + + foreach ($topic_data as $topic_id => $topic_row) + { + if (!isset($search_type) && $topic_row['enable_indexing']) + { + // Select the search method and do some additional checks to ensure it can actually be utilised + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + $search_mode = 'post'; + + if ($error) + { + trigger_error($error); + } + } + else if (!isset($search_type) && !$topic_row['enable_indexing']) + { + $search_type = false; + } + + $sql_ary = array( + 'forum_id' => (int) $to_forum_id, + 'icon_id' => (int) $topic_row['icon_id'], + 'topic_attachment' => (int) $topic_row['topic_attachment'], + 'topic_visibility' => (int) $topic_row['topic_visibility'], + 'topic_reported' => 0, + 'topic_title' => (string) $topic_row['topic_title'], + 'topic_poster' => (int) $topic_row['topic_poster'], + 'topic_time' => (int) $topic_row['topic_time'], + 'topic_posts_approved' => (int) $topic_row['topic_posts_approved'], + 'topic_posts_unapproved' => (int) $topic_row['topic_posts_unapproved'], + 'topic_posts_softdeleted' => (int) $topic_row['topic_posts_softdeleted'], + 'topic_status' => (int) $topic_row['topic_status'], + 'topic_type' => (int) $topic_row['topic_type'], + 'topic_first_poster_name' => (string) $topic_row['topic_first_poster_name'], + 'topic_last_poster_id' => (int) $topic_row['topic_last_poster_id'], + 'topic_last_poster_name' => (string) $topic_row['topic_last_poster_name'], + 'topic_last_post_time' => (int) $topic_row['topic_last_post_time'], + 'topic_last_view_time' => (int) $topic_row['topic_last_view_time'], + 'topic_bumped' => (int) $topic_row['topic_bumped'], + 'topic_bumper' => (int) $topic_row['topic_bumper'], + 'poll_title' => (string) $topic_row['poll_title'], + 'poll_start' => (int) $topic_row['poll_start'], + 'poll_length' => (int) $topic_row['poll_length'], + 'poll_max_options' => (int) $topic_row['poll_max_options'], + 'poll_vote_change' => (int) $topic_row['poll_vote_change'], + ); + + /** + * Perform actions before forked topic is created. + * + * @event core.mcp_main_modify_fork_sql + * @var array sql_ary SQL array to be used by $db->sql_build_array + * @var array topic_row Topic data + * @since 3.1.11-RC1 + * @changed 3.1.11-RC1 Added variable: topic_row + */ + $vars = array( + 'sql_ary', + 'topic_row', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_modify_fork_sql', compact($vars))); + + $db->sql_query('INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + $new_topic_id = $db->sql_nextid(); + $new_topic_id_list[$topic_id] = $new_topic_id; + + switch ($topic_row['topic_visibility']) + { + case ITEM_APPROVED: + $total_topics++; + break; + case ITEM_UNAPPROVED: + case ITEM_REAPPROVE: + $total_topics_unapproved++; + break; + case ITEM_DELETED: + $total_topics_softdeleted++; + break; + } + + if ($topic_row['poll_start']) + { + $sql = 'SELECT * + FROM ' . POLL_OPTIONS_TABLE . " + WHERE topic_id = $topic_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary = array( + 'poll_option_id' => (int) $row['poll_option_id'], + 'topic_id' => (int) $new_topic_id, + 'poll_option_text' => (string) $row['poll_option_text'], + 'poll_option_total' => 0 + ); + + $db->sql_query('INSERT INTO ' . POLL_OPTIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + } + $db->sql_freeresult($result); + } + + $sql = 'SELECT * + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + ORDER BY post_time ASC, post_id ASC"; + $result = $db->sql_query($sql); + + $post_rows = array(); + while ($row = $db->sql_fetchrow($result)) + { + $post_rows[] = $row; + } + $db->sql_freeresult($result); + + if (!count($post_rows)) + { + continue; + } + + foreach ($post_rows as $row) + { + $sql_ary = array( + 'topic_id' => (int) $new_topic_id, + 'forum_id' => (int) $to_forum_id, + 'poster_id' => (int) $row['poster_id'], + 'icon_id' => (int) $row['icon_id'], + 'poster_ip' => (string) $row['poster_ip'], + 'post_time' => (int) $row['post_time'], + 'post_visibility' => (int) $row['post_visibility'], + 'post_reported' => 0, + 'enable_bbcode' => (int) $row['enable_bbcode'], + 'enable_smilies' => (int) $row['enable_smilies'], + 'enable_magic_url' => (int) $row['enable_magic_url'], + 'enable_sig' => (int) $row['enable_sig'], + 'post_username' => (string) $row['post_username'], + 'post_subject' => (string) $row['post_subject'], + 'post_text' => (string) $row['post_text'], + 'post_edit_reason' => (string) $row['post_edit_reason'], + 'post_edit_user' => (int) $row['post_edit_user'], + 'post_checksum' => (string) $row['post_checksum'], + 'post_attachment' => (int) $row['post_attachment'], + 'bbcode_bitfield' => $row['bbcode_bitfield'], + 'bbcode_uid' => (string) $row['bbcode_uid'], + 'post_edit_time' => (int) $row['post_edit_time'], + 'post_edit_count' => (int) $row['post_edit_count'], + 'post_edit_locked' => (int) $row['post_edit_locked'], + 'post_postcount' => $row['post_postcount'], + ); + // Adjust post count only if the post can be incremented to the user counter + if ($row['post_postcount']) + { + if (isset($counter[$row['poster_id']])) + { + ++$counter[$row['poster_id']]; + } + else + { + $counter[$row['poster_id']] = 1; + } + } + $db->sql_query('INSERT INTO ' . POSTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + $new_post_id = $db->sql_nextid(); + + /** + * Perform actions after forked topic is created. + * + * @event core.mcp_main_fork_sql_after + * @var int new_topic_id The newly created topic ID + * @var int to_forum_id The forum ID where the forked topic has been moved to + * @var int new_post_id The newly created post ID + * @var array row Post data + * @since 3.2.4-RC1 + */ + $vars = array( + 'new_topic_id', + 'to_forum_id', + 'new_post_id', + 'row', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_main_fork_sql_after', compact($vars))); + + switch ($row['post_visibility']) + { + case ITEM_APPROVED: + $total_posts++; + break; + case ITEM_UNAPPROVED: + case ITEM_REAPPROVE: + $total_posts_unapproved++; + break; + case ITEM_DELETED: + $total_posts_softdeleted++; + break; + } + + // Copy whether the topic is dotted + markread('post', $to_forum_id, $new_topic_id, 0, $row['poster_id']); + + if (!empty($search_type)) + { + $search->index($search_mode, $new_post_id, $sql_ary['post_text'], $sql_ary['post_subject'], $sql_ary['poster_id'], ($topic_row['topic_type'] == POST_GLOBAL) ? 0 : $to_forum_id); + $search_mode = 'reply'; // After one we index replies + } + + // Copy Attachments + if ($row['post_attachment']) + { + $sql = 'SELECT * FROM ' . ATTACHMENTS_TABLE . " + WHERE post_msg_id = {$row['post_id']} + AND topic_id = $topic_id + AND in_message = 0"; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($attach_row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'post_msg_id' => (int) $new_post_id, + 'topic_id' => (int) $new_topic_id, + 'in_message' => 0, + 'is_orphan' => (int) $attach_row['is_orphan'], + 'poster_id' => (int) $attach_row['poster_id'], + 'physical_filename' => (string) utf8_basename($attach_row['physical_filename']), + 'real_filename' => (string) utf8_basename($attach_row['real_filename']), + 'download_count' => (int) $attach_row['download_count'], + 'attach_comment' => (string) $attach_row['attach_comment'], + 'extension' => (string) $attach_row['extension'], + 'mimetype' => (string) $attach_row['mimetype'], + 'filesize' => (int) $attach_row['filesize'], + 'filetime' => (int) $attach_row['filetime'], + 'thumbnail' => (int) $attach_row['thumbnail'] + ); + } + $db->sql_freeresult($result); + + if (count($sql_ary)) + { + $db->sql_multi_insert(ATTACHMENTS_TABLE, $sql_ary); + } + } + } + + // Copy topic subscriptions to new topic + $sql = 'SELECT user_id, notify_status + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $new_topic_id, + 'user_id' => (int) $row['user_id'], + 'notify_status' => (int) $row['notify_status'], + ); + } + $db->sql_freeresult($result); + + if (count($sql_ary)) + { + $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); + } + + // Copy bookmarks to new topic + $sql = 'SELECT user_id + FROM ' . BOOKMARKS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $new_topic_id, + 'user_id' => (int) $row['user_id'], + ); + } + $db->sql_freeresult($result); + + if (count($sql_ary)) + { + $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary); + } + } + + // Sync new topics, parent forums and board stats + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_posts_approved = forum_posts_approved + ' . $total_posts . ', + forum_posts_unapproved = forum_posts_unapproved + ' . $total_posts_unapproved . ', + forum_posts_softdeleted = forum_posts_softdeleted + ' . $total_posts_softdeleted . ', + forum_topics_approved = forum_topics_approved + ' . $total_topics . ', + forum_topics_unapproved = forum_topics_unapproved + ' . $total_topics_unapproved . ', + forum_topics_softdeleted = forum_topics_softdeleted + ' . $total_topics_softdeleted . ' + WHERE forum_id = ' . $to_forum_id; + $db->sql_query($sql); + + if (!empty($counter)) + { + // Do only one query per user and not a query per post. + foreach ($counter as $user_id => $count) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_posts = user_posts + ' . (int) $count . ' + WHERE user_id = ' . (int) $user_id; + $db->sql_query($sql); + } + } + + sync('topic', 'topic_id', $new_topic_id_list); + sync('forum', 'forum_id', $to_forum_id); + + $config->increment('num_topics', count($new_topic_id_list), false); + $config->increment('num_posts', $total_posts, false); + + foreach ($new_topic_id_list as $topic_id => $new_topic_id) + { + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_FORK', false, array( + 'forum_id' => $to_forum_id, + 'topic_id' => $new_topic_id, + $topic_row['forum_name'] + )); + } + + $success_msg = (count($topic_ids) == 1) ? 'TOPIC_FORKED_SUCCESS' : 'TOPICS_FORKED_SUCCESS'; + } + else + { + $template->assign_vars(array( + 'S_FORUM_SELECT' => make_forum_select($to_forum_id, false, false, true, true, true), + 'S_CAN_LEAVE_SHADOW' => false, + 'ADDITIONAL_MSG' => $additional_msg) + ); + + confirm_box(false, 'FORK_TOPIC' . ((count($topic_ids) == 1) ? '' : 'S'), $s_hidden_fields, 'mcp_move.html'); + } + + $redirect = $request->variable('redirect', "index.$phpEx"); + $redirect = reapply_sid($redirect); + + if (!$success_msg) + { + redirect($redirect); + } + else + { + $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + meta_refresh(3, $redirect_url); + $return_link = sprintf($user->lang['RETURN_FORUM'], '', ''); + + if ($forum_id != $to_forum_id) + { + $return_link .= '

' . sprintf($user->lang['RETURN_NEW_FORUM'], '', ''); + } + + trigger_error($user->lang[$success_msg] . '

' . $return_link); + } +} diff --git a/install/update/old/includes/mcp/mcp_notes.php b/install/update/old/includes/mcp/mcp_notes.php new file mode 100644 index 0000000..a4c2356 --- /dev/null +++ b/install/update/old/includes/mcp/mcp_notes.php @@ -0,0 +1,258 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* mcp_notes +* Displays notes about a user +*/ +class mcp_notes +{ + var $p_master; + var $u_action; + + function __construct($p_master) + { + $this->p_master = $p_master; + } + + function main($id, $mode) + { + global $user, $template, $request; + global $phpbb_root_path, $phpEx; + + $action = $request->variable('action', array('' => '')); + + if (is_array($action)) + { + list($action, ) = each($action); + } + + $this->page_title = 'MCP_NOTES'; + + switch ($mode) + { + case 'front': + $template->assign_vars(array( + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'), + 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes'), + + 'L_TITLE' => $user->lang['MCP_NOTES'], + )); + + $this->tpl_name = 'mcp_notes_front'; + break; + + case 'user_notes': + $user->add_lang('acp/common'); + + $this->mcp_notes_user_view($action); + $this->tpl_name = 'mcp_notes_user'; + break; + } + } + + /** + * Display user notes + */ + function mcp_notes_user_view($action) + { + global $config, $phpbb_log, $request; + global $template, $db, $user, $auth, $phpbb_container; + + $user_id = $request->variable('u', 0); + $username = $request->variable('username', '', true); + $start = $request->variable('start', 0); + $st = $request->variable('st', 0); + $sk = $request->variable('sk', 'b'); + $sd = $request->variable('sd', 'd'); + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + add_form_key('mcp_notes'); + + $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE $sql_where"; + $result = $db->sql_query($sql); + $userrow = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$userrow) + { + trigger_error('NO_USER'); + } + + $user_id = $userrow['user_id']; + + // Populate user id to the currently active module (this module) + // The following method is another way of adjusting module urls. It is the easy variant if we want + // to directly adjust the current module url based on data retrieved within the same module. + if (strpos($this->u_action, "&u=$user_id") === false) + { + $this->p_master->adjust_url('&u=' . $user_id); + $this->u_action .= "&u=$user_id"; + } + + $deletemark = ($action == 'del_marked') ? true : false; + $deleteall = ($action == 'del_all') ? true : false; + $marked = $request->variable('marknote', array(0)); + $usernote = $request->variable('usernote', '', true); + + // Handle any actions + if (($deletemark || $deleteall) && $auth->acl_get('a_clearlogs')) + { + $where_sql = ''; + if ($deletemark && $marked) + { + $sql_in = array(); + foreach ($marked as $mark) + { + $sql_in[] = $mark; + } + $where_sql = ' AND ' . $db->sql_in_set('log_id', $sql_in); + unset($sql_in); + } + + if ($where_sql || $deleteall) + { + if (check_form_key('mcp_notes')) + { + $sql = 'DELETE FROM ' . LOG_TABLE . ' + WHERE log_type = ' . LOG_USERS . " + AND reportee_id = $user_id + $where_sql"; + $db->sql_query($sql); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CLEAR_USER', false, array($userrow['username'])); + + $msg = ($deletemark) ? 'MARKED_NOTES_DELETED' : 'ALL_NOTES_DELETED'; + } + else + { + $msg = 'FORM_INVALID'; + } + $redirect = $this->u_action . '&u=' . $user_id; + meta_refresh(3, $redirect); + trigger_error($user->lang[$msg] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + } + + if ($usernote && $action == 'add_feedback') + { + if (check_form_key('mcp_notes')) + { + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array($userrow['username'])); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_FEEDBACK', false, array( + 'forum_id' => 0, + 'topic_id' => 0, + $userrow['username'] + )); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GENERAL', false, array( + 'reportee_id' => $user_id, + $usernote + )); + + $msg = $user->lang['USER_FEEDBACK_ADDED']; + } + else + { + $msg = $user->lang['FORM_INVALID']; + } + $redirect = $this->u_action; + meta_refresh(3, $redirect); + + trigger_error($msg . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + + // Generate the appropriate user information for the user we are looking at + + $rank_title = $rank_img = ''; + $avatar_img = phpbb_get_user_avatar($userrow); + + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_IP'], 'd' => $user->lang['SORT_ACTION']); + $sort_by_sql = array('a' => 'u.username_clean', 'b' => 'l.log_time', 'c' => 'l.log_ip', 'd' => 'l.log_operation'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + // Define where and sort sql for use in displaying logs + $sql_where = ($st) ? (time() - ($st * 86400)) : 0; + $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); + + $keywords = $request->variable('keywords', '', true); + $keywords_param = !empty($keywords) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; + + $log_data = array(); + $log_count = 0; + $start = view_log('user', $log_data, $log_count, $config['topics_per_page'], $start, 0, 0, $user_id, $sql_where, $sql_sort, $keywords); + + if ($log_count) + { + $template->assign_var('S_USER_NOTES', true); + + foreach ($log_data as $row) + { + $template->assign_block_vars('usernotes', array( + 'REPORT_BY' => $row['username_full'], + 'REPORT_AT' => $user->format_date($row['time']), + 'ACTION' => $row['action'], + 'IP' => $row['ip'], + 'ID' => $row['id']) + ); + } + } + + $base_url = $this->u_action . "&$u_sort_param$keywords_param"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $log_count, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action, + 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_KEYWORDS' => $keywords, + + 'L_TITLE' => $user->lang['MCP_NOTES_USER'], + + 'TOTAL_REPORTS' => $user->lang('LIST_REPORTS', (int) $log_count), + + 'RANK_TITLE' => $rank_title, + 'JOINED' => $user->format_date($userrow['user_regdate']), + 'POSTS' => ($userrow['user_posts']) ? $userrow['user_posts'] : 0, + 'WARNINGS' => ($userrow['user_warnings']) ? $userrow['user_warnings'] : 0, + + 'USERNAME_FULL' => get_username_string('full', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'USERNAME_COLOUR' => get_username_string('colour', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'USERNAME' => get_username_string('username', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + 'U_PROFILE' => get_username_string('profile', $userrow['user_id'], $userrow['username'], $userrow['user_colour']), + + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $rank_img, + ) + ); + } + +} diff --git a/install/update/old/includes/mcp/mcp_topic.php b/install/update/old/includes/mcp/mcp_topic.php new file mode 100644 index 0000000..68a65aa --- /dev/null +++ b/install/update/old/includes/mcp/mcp_topic.php @@ -0,0 +1,812 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* View topic in MCP +*/ +function mcp_topic_view($id, $mode, $action) +{ + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $auth, $phpbb_container, $phpbb_dispatcher; + + $url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . phpbb_extra_url()); + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $user->add_lang('viewtopic'); + + $topic_id = $request->variable('t', 0); + $topic_info = phpbb_get_topic_data(array($topic_id), false, true); + + if (!count($topic_info)) + { + trigger_error('TOPIC_NOT_EXIST'); + } + + $topic_info = $topic_info[$topic_id]; + + // Set up some vars + $icon_id = $request->variable('icon', 0); + $subject = $request->variable('subject', '', true); + $start = $request->variable('start', 0); + $sort_days_old = $request->variable('st_old', 0); + $forum_id = $request->variable('f', 0); + $to_topic_id = $request->variable('to_topic_id', 0); + $to_forum_id = $request->variable('to_forum_id', 0); + $sort = isset($_POST['sort']) ? true : false; + $submitted_id_list = $request->variable('post_ids', array(0)); + $checked_ids = $post_id_list = $request->variable('post_id_list', array(0)); + + // Resync Topic? + if ($action == 'resync') + { + if (!function_exists('mcp_resync_topics')) + { + include($phpbb_root_path . 'includes/mcp/mcp_forum.' . $phpEx); + } + mcp_resync_topics(array($topic_id)); + } + + // Split Topic? + if ($action == 'split_all' || $action == 'split_beyond') + { + if (!$sort) + { + split_topic($action, $topic_id, $to_forum_id, $subject); + } + $action = 'split'; + } + + // Merge Posts? + if ($action == 'merge_posts') + { + if (!$sort) + { + merge_posts($topic_id, $to_topic_id); + } + $action = 'merge'; + } + + if ($action == 'split' && !$subject) + { + $subject = $topic_info['topic_title']; + } + + // Restore or pprove posts? + if (($action == 'restore' || $action == 'approve') && $auth->acl_get('m_approve', $topic_info['forum_id'])) + { + if (!class_exists('mcp_queue')) + { + include($phpbb_root_path . 'includes/mcp/mcp_queue.' . $phpEx); + } + + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + if (!count($post_id_list)) + { + trigger_error('NO_POST_SELECTED'); + } + + if (!$sort) + { + mcp_queue::approve_posts($action, $post_id_list, $id, $mode); + } + } + + // Jumpbox, sort selects and that kind of things + make_jumpbox($url . "&i=$id&mode=forum_view", $topic_info['forum_id'], false, 'm_', true); + $where_sql = ($action == 'reports') ? 'WHERE post_reported = 1 AND ' : 'WHERE'; + + $sort_days = $total = 0; + $sort_key = $sort_dir = ''; + $sort_by_sql = $sort_order_sql = array(); + phpbb_mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql); + + /* @var $phpbb_content_visibility \phpbb\content_visibility */ + $phpbb_content_visibility = $phpbb_container->get('content.visibility'); + $limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + + if ($total == -1) + { + $total = $phpbb_content_visibility->get_count('topic_posts', $topic_info, $topic_info['forum_id']); + } + + $posts_per_page = max(0, $request->variable('posts_per_page', intval($config['posts_per_page']))); + if ($posts_per_page == 0) + { + $posts_per_page = $total; + } + + if ((!empty($sort_days_old) && $sort_days_old != $sort_days) || $total <= $posts_per_page) + { + $start = 0; + } + $start = $pagination->validate_start($start, $posts_per_page, $total); + + $sql = 'SELECT u.username, u.username_clean, u.user_colour, p.* + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . ' + p.topic_id = ' . $topic_id . ' + AND ' . $phpbb_content_visibility->get_visibility_sql('post', $topic_info['forum_id'], 'p.') . ' + AND p.poster_id = u.user_id ' . + $limit_time_sql . ' + ORDER BY ' . $sort_order_sql; + $result = $db->sql_query_limit($sql, $posts_per_page, $start); + + $rowset = $post_id_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rowset[] = $row; + $post_id_list[] = $row['post_id']; + } + $db->sql_freeresult($result); + + // Get topic tracking info + if ($config['load_db_lastread']) + { + $tmp_topic_data = array($topic_id => $topic_info); + $topic_tracking_info = get_topic_tracking($topic_info['forum_id'], $topic_id, $tmp_topic_data, array($topic_info['forum_id'] => $topic_info['forum_mark_time'])); + unset($tmp_topic_data); + } + else + { + $topic_tracking_info = get_complete_topic_tracking($topic_info['forum_id'], $topic_id); + } + + $has_unapproved_posts = $has_deleted_posts = false; + + // Grab extensions + $attachments = array(); + if ($topic_info['topic_attachment'] && count($post_id_list)) + { + // Get attachments... + if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $topic_info['forum_id'])) + { + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $post_id_list) . ' + AND in_message = 0 + ORDER BY filetime DESC, post_msg_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + } + } + + /** + * Event to modify the post data for the MCP topic review before assigning the posts + * + * @event core.mcp_topic_modify_post_data + * @var array attachments List of attachments post_id => array of attachments + * @var int forum_id The forum ID we are currently in + * @var int id ID of the tab we are displaying + * @var string mode Mode of the MCP page we are displaying + * @var array post_id_list Array with post ids we are going to display + * @var array rowset Array with the posts data + * @var int topic_id The topic ID we are currently reviewing + * @since 3.1.7-RC1 + */ + $vars = array( + 'attachments', + 'forum_id', + 'id', + 'mode', + 'post_id_list', + 'rowset', + 'topic_id', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_topic_modify_post_data', compact($vars))); + + foreach ($rowset as $i => $row) + { + $message = $row['post_text']; + $post_subject = ($row['post_subject'] != '') ? $row['post_subject'] : $topic_info['topic_title']; + + $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']])) + { + $update_count = array(); + parse_attachments($topic_info['forum_id'], $message, $attachments[$row['post_id']], $update_count); + } + + if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) + { + $has_unapproved_posts = true; + } + + if ($row['post_visibility'] == ITEM_DELETED) + { + $has_deleted_posts = true; + } + + $post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false; + + $post_row = array( + 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + + 'POST_DATE' => $user->format_date($row['post_time']), + 'POST_SUBJECT' => $post_subject, + 'MESSAGE' => $message, + 'POST_ID' => $row['post_id'], + 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '', ''), + + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), + + 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $topic_info['forum_id'])), + 'S_POST_UNAPPROVED' => (($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $topic_info['forum_id'])), + 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED && $auth->acl_get('m_approve', $topic_info['forum_id'])), + 'S_CHECKED' => (($submitted_id_list && !in_array(intval($row['post_id']), $submitted_id_list)) || in_array(intval($row['post_id']), $checked_ids)) ? true : false, + 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, + + 'U_POST_DETAILS' => "$url&i=$id&p={$row['post_id']}&mode=post_details" . (($forum_id) ? "&f=$forum_id" : ''), + 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '', + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $topic_info['forum_id'] . '&p=' . $row['post_id']) : '', + ); + + /** + * Event to modify the template data block for topic reviews in the MCP + * + * @event core.mcp_topic_review_modify_row + * @var int id ID of the tab we are displaying + * @var string mode Mode of the MCP page we are displaying + * @var int topic_id The topic ID we are currently reviewing + * @var int forum_id The forum ID we are currently in + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var array post_row Template block array of the current post + * @var array row Array with original post and user data + * @var array topic_info Array with topic data + * @var int total Total posts count + * @since 3.1.4-RC1 + */ + $vars = array( + 'id', + 'mode', + 'topic_id', + 'forum_id', + 'start', + 'current_row_number', + 'post_row', + 'row', + 'topic_info', + 'total', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_topic_review_modify_row', compact($vars))); + + $template->assign_block_vars('postrow', $post_row); + + // Display not already displayed Attachments for this post, we already parsed them. ;) + if (!empty($attachments[$row['post_id']])) + { + foreach ($attachments[$row['post_id']] as $attachment) + { + $template->assign_block_vars('postrow.attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + } + + unset($rowset[$i]); + } + + // Display topic icons for split topic + $s_topic_icons = false; + + if ($auth->acl_gets('m_split', 'm_merge', (int) $topic_info['forum_id'])) + { + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + $s_topic_icons = posting_gen_topic_icons('', $icon_id); + + // Has the user selected a topic for merge? + if ($to_topic_id) + { + $to_topic_info = phpbb_get_topic_data(array($to_topic_id), 'm_merge'); + + if (!count($to_topic_info)) + { + $to_topic_id = 0; + } + else + { + $to_topic_info = $to_topic_info[$to_topic_id]; + + if (!$to_topic_info['enable_icons'] || $auth->acl_get('!f_icons', $topic_info['forum_id'])) + { + $s_topic_icons = false; + } + } + } + } + + $s_hidden_fields = build_hidden_fields(array( + 'st_old' => $sort_days, + 'post_ids' => $post_id_list, + )); + + $base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=$id&t={$topic_info['topic_id']}&mode=$mode&action=$action&to_topic_id=$to_topic_id&posts_per_page=$posts_per_page&st=$sort_days&sk=$sort_key&sd=$sort_dir"); + if ($posts_per_page) + { + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total, $posts_per_page, $start); + } + + $template->assign_vars(array( + 'TOPIC_TITLE' => $topic_info['topic_title'], + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $topic_info['forum_id'] . '&t=' . $topic_info['topic_id']), + + 'TO_TOPIC_ID' => $to_topic_id, + 'TO_TOPIC_INFO' => ($to_topic_id) ? sprintf($user->lang['YOU_SELECTED_TOPIC'], $to_topic_id, '' . $to_topic_info['topic_title'] . '') : '', + + 'SPLIT_SUBJECT' => $subject, + 'POSTS_PER_PAGE' => $posts_per_page, + 'ACTION' => $action, + + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), + 'DELETED_IMG' => $user->img('icon_topic_deleted', 'POST_DELETED_RESTORE'), + 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'), + + 'S_MCP_ACTION' => "$url&i=$id&mode=$mode&action=$action&start=$start", + 'S_FORUM_SELECT' => ($to_forum_id) ? make_forum_select($to_forum_id, false, false, true, true, true) : make_forum_select($topic_info['forum_id'], false, false, true, true, true), + 'S_CAN_SPLIT' => ($auth->acl_get('m_split', $topic_info['forum_id'])) ? true : false, + 'S_CAN_MERGE' => ($auth->acl_get('m_merge', $topic_info['forum_id'])) ? true : false, + 'S_CAN_DELETE' => ($auth->acl_get('m_delete', $topic_info['forum_id'])) ? true : false, + 'S_CAN_APPROVE' => ($has_unapproved_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false, + 'S_CAN_RESTORE' => ($has_deleted_posts && $auth->acl_get('m_approve', $topic_info['forum_id'])) ? true : false, + 'S_CAN_LOCK' => ($auth->acl_get('m_lock', $topic_info['forum_id'])) ? true : false, + 'S_CAN_REPORT' => ($auth->acl_get('m_report', $topic_info['forum_id'])) ? true : false, + 'S_CAN_SYNC' => $auth->acl_get('m_', $topic_info['forum_id']), + 'S_REPORT_VIEW' => ($action == 'reports') ? true : false, + 'S_MERGE_VIEW' => ($action == 'merge') ? true : false, + 'S_SPLIT_VIEW' => ($action == 'split') ? true : false, + + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + + 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, + 'S_TOPIC_ICON' => $icon_id, + + 'U_SELECT_TOPIC' => "$url&i=$id&mode=forum_view&action=merge_select" . (($forum_id) ? "&f=$forum_id" : ''), + + 'RETURN_TOPIC' => sprintf($user->lang['RETURN_TOPIC'], '', ''), + 'RETURN_FORUM' => sprintf($user->lang['RETURN_FORUM'], '', ''), + + 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total), + )); +} + +/** +* Split topic +*/ +function split_topic($action, $topic_id, $to_forum_id, $subject) +{ + global $db, $template, $user, $phpEx, $phpbb_root_path, $auth, $config, $phpbb_log, $request, $phpbb_dispatcher; + + $post_id_list = $request->variable('post_id_list', array(0)); + $forum_id = $request->variable('forum_id', 0); + $start = $request->variable('start', 0); + + if (!count($post_id_list)) + { + $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); + return; + } + + if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_split'))) + { + return; + } + + $post_id = $post_id_list[0]; + $post_info = phpbb_get_post_data(array($post_id)); + + if (!count($post_info)) + { + $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); + return; + } + + $post_info = $post_info[$post_id]; + $subject = trim($subject); + + // Make some tests + if (!$subject) + { + $template->assign_var('MESSAGE', $user->lang['EMPTY_SUBJECT']); + return; + } + + if ($to_forum_id <= 0) + { + $template->assign_var('MESSAGE', $user->lang['NO_DESTINATION_FORUM']); + return; + } + + $forum_info = phpbb_get_forum_data(array($to_forum_id), 'f_post'); + + if (!count($forum_info)) + { + $template->assign_var('MESSAGE', $user->lang['USER_CANNOT_POST']); + return; + } + + $forum_info = $forum_info[$to_forum_id]; + + if ($forum_info['forum_type'] != FORUM_POST) + { + $template->assign_var('MESSAGE', $user->lang['FORUM_NOT_POSTABLE']); + return; + } + + $redirect = $request->variable('redirect', build_url(array('quickmod'))); + + $s_hidden_fields = build_hidden_fields(array( + 'i' => 'main', + 'post_id_list' => $post_id_list, + 'f' => $forum_id, + 'mode' => 'topic_view', + 'start' => $start, + 'action' => $action, + 't' => $topic_id, + 'redirect' => $redirect, + 'subject' => $subject, + 'to_forum_id' => $to_forum_id, + 'icon' => $request->variable('icon', 0)) + ); + + if (confirm_box(true)) + { + if ($action == 'split_beyond') + { + $sort_days = $total = 0; + $sort_key = $sort_dir = ''; + $sort_by_sql = $sort_order_sql = array(); + phpbb_mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $forum_id, $topic_id); + + $limit_time_sql = ($sort_days) ? 'AND t.topic_last_post_time >= ' . (time() - ($sort_days * 86400)) : ''; + + if ($sort_order_sql[0] == 'u') + { + $sql = 'SELECT p.post_id, p.forum_id, p.post_visibility + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE p.topic_id = $topic_id + AND p.poster_id = u.user_id + $limit_time_sql + ORDER BY $sort_order_sql"; + } + else + { + $sql = 'SELECT p.post_id, p.forum_id, p.post_visibility + FROM ' . POSTS_TABLE . " p + WHERE p.topic_id = $topic_id + $limit_time_sql + ORDER BY $sort_order_sql"; + } + $result = $db->sql_query_limit($sql, 0, $start); + + $store = false; + $post_id_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + // If split from selected post (split_beyond), we split the unapproved items too. + if (($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) && !$auth->acl_get('m_approve', $row['forum_id'])) + { +// continue; + } + + // Start to store post_ids as soon as we see the first post that was selected + if ($row['post_id'] == $post_id) + { + $store = true; + } + + if ($store) + { + $post_id_list[] = $row['post_id']; + } + } + $db->sql_freeresult($result); + } + + if (!count($post_id_list)) + { + trigger_error('NO_POST_SELECTED'); + } + + $icon_id = $request->variable('icon', 0); + + $sql_ary = array( + 'forum_id' => $to_forum_id, + 'topic_title' => $subject, + 'icon_id' => $icon_id, + 'topic_visibility' => 1 + ); + + $sql = 'INSERT INTO ' . TOPICS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + + $to_topic_id = $db->sql_nextid(); + move_posts($post_id_list, $to_topic_id); + + $topic_info = phpbb_get_topic_data(array($topic_id)); + $topic_info = $topic_info[$topic_id]; + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SPLIT_DESTINATION', false, array( + 'forum_id' => $to_forum_id, + 'topic_id' => $to_topic_id, + $subject + )); + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_SPLIT_SOURCE', false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $topic_info['topic_title'] + )); + + // Change topic title of first post + $sql = 'UPDATE ' . POSTS_TABLE . " + SET post_subject = '" . $db->sql_escape($subject) . "' + WHERE post_id = {$post_id_list[0]}"; + $db->sql_query($sql); + + // Grab data for first post in split topic + $sql_array = array( + 'SELECT' => 'p.post_id, p.forum_id, p.poster_id, p.post_text, f.enable_indexing', + 'FROM' => array( + POSTS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'p.forum_id = f.forum_id', + ) + ), + 'WHERE' => "post_id = {$post_id_list[0]}", + ); + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + $first_post_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Index first post as if it were edited + if ($first_post_data['enable_indexing']) + { + // Select the search method and do some additional checks to ensure it can actually be utilised + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if ($error) + { + trigger_error($error); + } + + $search->index('edit', $first_post_data['post_id'], $first_post_data['post_text'], $subject, $first_post_data['poster_id'], $first_post_data['forum_id']); + } + + // Copy topic subscriptions to new topic + $sql = 'SELECT user_id, notify_status + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $to_topic_id, + 'user_id' => (int) $row['user_id'], + 'notify_status' => (int) $row['notify_status'], + ); + } + $db->sql_freeresult($result); + + if (count($sql_ary)) + { + $db->sql_multi_insert(TOPICS_WATCH_TABLE, $sql_ary); + } + + // Copy bookmarks to new topic + $sql = 'SELECT user_id + FROM ' . BOOKMARKS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + + $sql_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + $sql_ary[] = array( + 'topic_id' => (int) $to_topic_id, + 'user_id' => (int) $row['user_id'], + ); + } + $db->sql_freeresult($result); + + if (count($sql_ary)) + { + $db->sql_multi_insert(BOOKMARKS_TABLE, $sql_ary); + } + + $success_msg = 'TOPIC_SPLIT_SUCCESS'; + + // Update forum statistics + $config->increment('num_topics', 1, false); + + // Link back to both topics + $return_link = sprintf($user->lang['RETURN_TOPIC'], '', '') . '

' . sprintf($user->lang['RETURN_NEW_TOPIC'], '', ''); + $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); + $redirect = reapply_sid($redirect); + + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '

' . $return_link); + } + else + { + confirm_box(false, ($action == 'split_all') ? 'SPLIT_TOPIC_ALL' : 'SPLIT_TOPIC_BEYOND', $s_hidden_fields); + } +} + +/** +* Merge selected posts into selected topic +*/ +function merge_posts($topic_id, $to_topic_id) +{ + global $db, $template, $user, $phpEx, $phpbb_root_path, $phpbb_log, $request, $phpbb_dispatcher; + + if (!$to_topic_id) + { + $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); + return; + } + + $sync_topics = array($topic_id, $to_topic_id); + + $topic_data = phpbb_get_topic_data($sync_topics, 'm_merge'); + + if (!count($topic_data) || empty($topic_data[$to_topic_id])) + { + $template->assign_var('MESSAGE', $user->lang['NO_FINAL_TOPIC_SELECTED']); + return; + } + + $sync_forums = array(); + foreach ($topic_data as $data) + { + $sync_forums[$data['forum_id']] = $data['forum_id']; + } + + $topic_data = $topic_data[$to_topic_id]; + + $post_id_list = $request->variable('post_id_list', array(0)); + $start = $request->variable('start', 0); + + if (!count($post_id_list)) + { + $template->assign_var('MESSAGE', $user->lang['NO_POST_SELECTED']); + return; + } + + if (!phpbb_check_ids($post_id_list, POSTS_TABLE, 'post_id', array('m_merge'))) + { + return; + } + + $redirect = $request->variable('redirect', build_url(array('quickmod'))); + + $s_hidden_fields = build_hidden_fields(array( + 'i' => 'main', + 'post_id_list' => $post_id_list, + 'to_topic_id' => $to_topic_id, + 'mode' => 'topic_view', + 'action' => 'merge_posts', + 'start' => $start, + 'redirect' => $redirect, + 't' => $topic_id) + ); + $return_link = ''; + + if (confirm_box(true)) + { + $to_forum_id = $topic_data['forum_id']; + + move_posts($post_id_list, $to_topic_id, false); + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_MERGE', false, array( + 'forum_id' => $to_forum_id, + 'topic_id' => $to_topic_id, + $topic_data['topic_title'] + )); + + // Message and return links + $success_msg = 'POSTS_MERGED_SUCCESS'; + + // Does the original topic still exist? If yes, link back to it + $sql = 'SELECT forum_id + FROM ' . POSTS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $return_link .= sprintf($user->lang['RETURN_TOPIC'], '', ''); + } + else + { + if (!function_exists('phpbb_update_rows_avoiding_duplicates_notify_status')) + { + include($phpbb_root_path . 'includes/functions_database_helper.' . $phpEx); + } + + // 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', 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', array($topic_id), $to_topic_id); + } + + // Re-sync the topics and forums because the auto-sync was deactivated in the call of move_posts() + sync('topic_reported', 'topic_id', $sync_topics); + sync('topic_attachment', 'topic_id', $sync_topics); + sync('topic', 'topic_id', $sync_topics, true); + sync('forum', 'forum_id', $sync_forums, true, true); + + // Link to the new topic + $return_link .= (($return_link) ? '

' : '') . sprintf($user->lang['RETURN_NEW_TOPIC'], '', ''); + $redirect = $request->variable('redirect', "{$phpbb_root_path}viewtopic.$phpEx?f=$to_forum_id&t=$to_topic_id"); + $redirect = reapply_sid($redirect); + + /** + * Perform additional actions after merging posts. + * + * @event core.mcp_topics_merge_posts_after + * @var int topic_id The topic ID from which posts are being moved + * @var int to_topic_id The topic ID to which posts are being moved + * @since 3.1.11-RC1 + */ + $vars = array( + 'topic_id', + 'to_topic_id', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_topics_merge_posts_after', compact($vars))); + + meta_refresh(3, $redirect); + trigger_error($user->lang[$success_msg] . '

' . $return_link); + } + else + { + confirm_box(false, 'MERGE_POSTS', $s_hidden_fields); + } +} diff --git a/install/update/old/includes/mcp/mcp_warn.php b/install/update/old/includes/mcp/mcp_warn.php new file mode 100644 index 0000000..df17513 --- /dev/null +++ b/install/update/old/includes/mcp/mcp_warn.php @@ -0,0 +1,610 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* mcp_warn +* Handling warning the users +*/ +class mcp_warn +{ + var $p_master; + var $u_action; + + function __construct($p_master) + { + $this->p_master = $p_master; + } + + function main($id, $mode) + { + global $request; + + $action = $request->variable('action', array('' => '')); + + if (is_array($action)) + { + list($action, ) = each($action); + } + + $this->page_title = 'MCP_WARN'; + + add_form_key('mcp_warn'); + + switch ($mode) + { + case 'front': + $this->mcp_warn_front_view(); + $this->tpl_name = 'mcp_warn_front'; + break; + + case 'list': + $this->mcp_warn_list_view($action); + $this->tpl_name = 'mcp_warn_list'; + break; + + case 'warn_post': + $this->mcp_warn_post_view($action); + $this->tpl_name = 'mcp_warn_post'; + break; + + case 'warn_user': + $this->mcp_warn_user_view($action); + $this->tpl_name = 'mcp_warn_user'; + break; + } + } + + /** + * Generates the summary on the main page of the warning module + */ + function mcp_warn_front_view() + { + global $phpEx, $phpbb_root_path; + global $template, $db, $user; + + $template->assign_vars(array( + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp&field=username&select_single=true'), + 'U_POST_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user'), + )); + + // Obtain a list of the 5 naughtiest users.... + // These are the 5 users with the highest warning count + $highest = array(); + $count = 0; + + view_warned_users($highest, $count, 5); + + foreach ($highest as $row) + { + $template->assign_block_vars('highest', array( + 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + + 'WARNING_TIME' => $user->format_date($row['user_last_warning']), + 'WARNINGS' => $row['user_warnings'], + )); + } + + // And now the 5 most recent users to get in trouble + $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_warnings, w.warning_time + FROM ' . USERS_TABLE . ' u, ' . WARNINGS_TABLE . ' w + WHERE u.user_id = w.user_id + ORDER BY w.warning_time DESC'; + $result = $db->sql_query_limit($sql, 5); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('latest', array( + 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + + 'WARNING_TIME' => $user->format_date($row['warning_time']), + 'WARNINGS' => $row['user_warnings'], + )); + } + $db->sql_freeresult($result); + } + + /** + * Lists all users with warnings + */ + function mcp_warn_list_view($action) + { + global $phpEx, $phpbb_root_path, $config, $phpbb_container; + global $template, $user, $auth, $request; + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $user->add_lang('memberlist'); + + $start = $request->variable('start', 0); + $st = $request->variable('st', 0); + $sk = $request->variable('sk', 'b'); + $sd = $request->variable('sd', 'd'); + + $limit_days = array(0 => $user->lang['ALL_ENTRIES'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + $sort_by_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_DATE'], 'c' => $user->lang['SORT_WARNINGS']); + $sort_by_sql = array('a' => 'username_clean', 'b' => 'user_last_warning', 'c' => 'user_warnings'); + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $st, $sk, $sd, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + // Define where and sort sql for use in displaying logs + $sql_where = ($st) ? (time() - ($st * 86400)) : 0; + $sql_sort = $sort_by_sql[$sk] . ' ' . (($sd == 'd') ? 'DESC' : 'ASC'); + + $users = array(); + $user_count = 0; + + view_warned_users($users, $user_count, $config['topics_per_page'], $start, $sql_where, $sql_sort); + + foreach ($users as $row) + { + $template->assign_block_vars('user', array( + 'U_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $row['user_id']), + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + + 'WARNING_TIME' => $user->format_date($row['user_last_warning']), + 'WARNINGS' => $row['user_warnings'], + )); + } + + $base_url = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&mode=list&st=$st&sk=$sk&sd=$sd"); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $user_count, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action, + 'S_CLEAR_ALLOWED' => ($auth->acl_get('a_clearlogs')) ? true : false, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + + 'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $user_count), + )); + } + + /** + * Handles warning the user when the warning is for a specific post + */ + function mcp_warn_post_view($action) + { + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $phpbb_dispatcher; + + $post_id = $request->variable('p', 0); + $forum_id = $request->variable('f', 0); + $notify = (isset($_REQUEST['notify_user'])) ? true : false; + $warning = $request->variable('warning', '', true); + + $sql = 'SELECT u.*, p.* + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . " u + WHERE p.post_id = $post_id + AND u.user_id = p.poster_id"; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + trigger_error('NO_POST'); + } + + // There is no point issuing a warning to ignored users (ie anonymous and bots) + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error('CANNOT_WARN_ANONYMOUS'); + } + + // Prevent someone from warning themselves + if ($user_row['user_id'] == $user->data['user_id']) + { + trigger_error('CANNOT_WARN_SELF'); + } + + // Check if there is already a warning for this post to prevent multiple + // warnings for the same offence + $sql = 'SELECT post_id + FROM ' . WARNINGS_TABLE . " + WHERE post_id = $post_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + trigger_error('ALREADY_WARNED'); + } + + $user_id = $user_row['user_id']; + + if (strpos($this->u_action, "&f=$forum_id&p=$post_id") === false) + { + $this->p_master->adjust_url("&f=$forum_id&p=$post_id"); + $this->u_action .= "&f=$forum_id&p=$post_id"; + } + + // Check if can send a notification + if ($config['allow_privmsg']) + { + $auth2 = new \phpbb\auth\auth(); + $auth2->acl($user_row); + $s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false; + unset($auth2); + } + else + { + $s_can_notify = false; + } + + // Prevent against clever people + if ($notify && !$s_can_notify) + { + $notify = false; + } + + if ($warning && $action == 'add_warning') + { + if (check_form_key('mcp_warn')) + { + $s_mcp_warn_post = true; + + /** + * Event for before warning a user for a post. + * + * @event core.mcp_warn_post_before + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, we notify the user for the warning + * @var int post_id The post id for which the warning is added + * @var bool s_mcp_warn_post If true, we add the warning else we omit it + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 'post_id', + 's_mcp_warn_post', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_post_before', compact($vars))); + + if ($s_mcp_warn_post) + { + add_warning($user_row, $warning, $notify, $post_id); + $message = $user->lang['USER_WARNING_ADDED']; + + /** + * Event for after warning a user for a post. + * + * @event core.mcp_warn_post_after + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, the user was notified for the warning + * @var int post_id The post id for which the warning is added + * @var string message Message displayed to the moderator + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 'post_id', + 'message', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_post_after', compact($vars))); + } + } + else + { + $message = $user->lang['FORM_INVALID']; + } + + if (!empty($message)) + { + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); + meta_refresh(2, $redirect); + trigger_error($message . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + } + + // OK, they didn't submit a warning so lets build the page for them to do so + + // We want to make the message available here as a reminder + // Parse the message and subject + $parse_flags = OPTION_FLAG_SMILIES | ($user_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_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']); + $avatar_img = phpbb_get_user_avatar($user_row); + + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action, + + 'POST' => $message, + 'USERNAME' => $user_row['username'], + 'USER_COLOR' => (!empty($user_row['user_colour'])) ? $user_row['user_colour'] : '', + 'RANK_TITLE' => $user_rank_data['title'], + 'JOINED' => $user->format_date($user_row['user_regdate']), + 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, + 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, + + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $user_rank_data['img'], + + 'L_WARNING_POST_DEFAULT' => sprintf($user->lang['WARNING_POST_DEFAULT'], generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&p=$post_id#p$post_id"), + + 'S_CAN_NOTIFY' => $s_can_notify, + )); + } + + /** + * Handles warning the user + */ + function mcp_warn_user_view($action) + { + global $phpEx, $phpbb_root_path, $config, $request; + global $template, $db, $user, $phpbb_dispatcher; + + $user_id = $request->variable('u', 0); + $username = $request->variable('username', '', true); + $notify = (isset($_REQUEST['notify_user'])) ? true : false; + $warning = $request->variable('warning', '', true); + + $sql_where = ($user_id) ? "user_id = $user_id" : "username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE ' . $sql_where; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + trigger_error('NO_USER'); + } + + // Prevent someone from warning themselves + if ($user_row['user_id'] == $user->data['user_id']) + { + trigger_error('CANNOT_WARN_SELF'); + } + + $user_id = $user_row['user_id']; + + if (strpos($this->u_action, "&u=$user_id") === false) + { + $this->p_master->adjust_url('&u=' . $user_id); + $this->u_action .= "&u=$user_id"; + } + + // Check if can send a notification + if ($config['allow_privmsg']) + { + $auth2 = new \phpbb\auth\auth(); + $auth2->acl($user_row); + $s_can_notify = ($auth2->acl_get('u_readpm')) ? true : false; + unset($auth2); + } + else + { + $s_can_notify = false; + } + + // Prevent against clever people + if ($notify && !$s_can_notify) + { + $notify = false; + } + + if ($warning && $action == 'add_warning') + { + if (check_form_key('mcp_warn')) + { + $s_mcp_warn_user = true; + + /** + * Event for before warning a user from MCP. + * + * @event core.mcp_warn_user_before + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, we notify the user for the warning + * @var bool s_mcp_warn_user If true, we add the warning else we omit it + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 's_mcp_warn_user', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_before', compact($vars))); + + if ($s_mcp_warn_user) + { + add_warning($user_row, $warning, $notify); + $message = $user->lang['USER_WARNING_ADDED']; + + /** + * Event for after warning a user from MCP. + * + * @event core.mcp_warn_user_after + * @var array user_row The entire user row + * @var string warning The warning message + * @var bool notify If true, the user was notified for the warning + * @var string message Message displayed to the moderator + * @since 3.1.0-b4 + */ + $vars = array( + 'user_row', + 'warning', + 'notify', + 'message', + ); + extract($phpbb_dispatcher->trigger_event('core.mcp_warn_user_after', compact($vars))); + } + } + else + { + $message = $user->lang['FORM_INVALID']; + } + + if (!empty($message)) + { + $redirect = append_sid("{$phpbb_root_path}mcp.$phpEx", "i=notes&mode=user_notes&u=$user_id"); + meta_refresh(2, $redirect); + trigger_error($message . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + } + + // Generate the appropriate user information for the user we are looking at + if (!function_exists('phpbb_get_user_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + $user_rank_data = phpbb_get_user_rank($user_row, $user_row['user_posts']); + $avatar_img = phpbb_get_user_avatar($user_row); + + // OK, they didn't submit a warning so lets build the page for them to do so + $template->assign_vars(array( + 'U_POST_ACTION' => $this->u_action, + + 'RANK_TITLE' => $user_rank_data['title'], + 'JOINED' => $user->format_date($user_row['user_regdate']), + 'POSTS' => ($user_row['user_posts']) ? $user_row['user_posts'] : 0, + 'WARNINGS' => ($user_row['user_warnings']) ? $user_row['user_warnings'] : 0, + + 'USERNAME_FULL' => get_username_string('full', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'USERNAME_COLOUR' => get_username_string('colour', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'USERNAME' => get_username_string('username', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + 'U_PROFILE' => get_username_string('profile', $user_row['user_id'], $user_row['username'], $user_row['user_colour']), + + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $user_rank_data['img'], + + 'S_CAN_NOTIFY' => $s_can_notify, + )); + + return $user_id; + } +} + +/** +* Insert the warning into the database +*/ +function add_warning($user_row, $warning, $send_pm = true, $post_id = 0) +{ + global $phpEx, $phpbb_root_path, $config, $phpbb_log; + global $db, $user; + + if ($send_pm) + { + include_once($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + include_once($phpbb_root_path . 'includes/message_parser.' . $phpEx); + + // Attempt to translate warning to language of user being warned if user's language differs from issuer's language + if ($user_row['user_lang'] != $user->lang_name) + { + $lang = array(); + + $user_row['user_lang'] = (file_exists($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx)) ? $user_row['user_lang'] : $config['default_lang']; + include($phpbb_root_path . 'language/' . basename($user_row['user_lang']) . "/mcp." . $phpEx); + + $warn_pm_subject = $lang['WARNING_PM_SUBJECT']; + $warn_pm_body = sprintf($lang['WARNING_PM_BODY'], $warning); + + unset($lang); + } + else + { + $warn_pm_subject = $user->lang('WARNING_PM_SUBJECT'); + $warn_pm_body = $user->lang('WARNING_PM_BODY', $warning); + } + + $message_parser = new parse_message(); + + $message_parser->message = $warn_pm_body; + $message_parser->parse(true, true, true, false, false, true, true); + + $pm_data = array( + 'from_user_id' => $user->data['user_id'], + 'from_user_ip' => $user->ip, + 'from_username' => $user->data['username'], + 'enable_sig' => false, + 'enable_bbcode' => true, + 'enable_smilies' => true, + 'enable_urls' => false, + 'icon_id' => 0, + 'bbcode_bitfield' => $message_parser->bbcode_bitfield, + 'bbcode_uid' => $message_parser->bbcode_uid, + 'message' => $message_parser->message, + 'address_list' => array('u' => array($user_row['user_id'] => 'to')), + ); + + submit_pm('post', $warn_pm_subject, $pm_data, false); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array($user_row['username'])); + $log_id = $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING_BODY', false, array( + 'reportee_id' => $user_row['user_id'], + $warning + )); + + $sql_ary = array( + 'user_id' => $user_row['user_id'], + 'post_id' => $post_id, + 'log_id' => $log_id, + 'warning_time' => time(), + ); + + $db->sql_query('INSERT INTO ' . WARNINGS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_warnings = user_warnings + 1, + user_last_warning = ' . time() . ' + WHERE user_id = ' . $user_row['user_id']; + $db->sql_query($sql); + + // We add this to the mod log too for moderators to see that a specific user got warned. + $sql = 'SELECT forum_id, topic_id + FROM ' . POSTS_TABLE . ' + WHERE post_id = ' . $post_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_USER_WARNING', false, array( + 'forum_id' => $row['forum_id'], + 'topic_id' => $row['topic_id'], + 'post_id' => $post_id, + $user_row['username'] + )); +} diff --git a/install/update/old/includes/message_parser.php b/install/update/old/includes/message_parser.php new file mode 100644 index 0000000..0b79cca --- /dev/null +++ b/install/update/old/includes/message_parser.php @@ -0,0 +1,2059 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (!class_exists('bbcode')) +{ + // The following lines are for extensions which include message_parser.php + // while $phpbb_root_path and $phpEx are out of the script scope + // which may lead to the 'Undefined variable' and 'failed to open stream' errors + if (!isset($phpbb_root_path)) + { + global $phpbb_root_path; + } + + if (!isset($phpEx)) + { + global $phpEx; + } + + include($phpbb_root_path . 'includes/bbcode.' . $phpEx); +} + +/** +* BBCODE FIRSTPASS +* BBCODE first pass class (functions for parsing messages for db storage) +*/ +class bbcode_firstpass extends bbcode +{ + var $message = ''; + var $warn_msg = array(); + var $parsed_items = array(); + + /** + * Parse BBCode + */ + function parse_bbcode() + { + if (!$this->bbcodes) + { + $this->bbcode_init(); + } + + global $user; + + $this->bbcode_bitfield = ''; + $bitfield = new bitfield(); + + foreach ($this->bbcodes as $bbcode_name => $bbcode_data) + { + if (isset($bbcode_data['disabled']) && $bbcode_data['disabled']) + { + foreach ($bbcode_data['regexp'] as $regexp => $replacement) + { + if (preg_match($regexp, $this->message)) + { + $this->warn_msg[] = sprintf($user->lang['UNAUTHORISED_BBCODE'] , '[' . $bbcode_name . ']'); + continue; + } + } + } + else + { + foreach ($bbcode_data['regexp'] as $regexp => $replacement) + { + // The pattern gets compiled and cached by the PCRE extension, + // it should not demand recompilation + if (preg_match($regexp, $this->message)) + { + if (is_callable($replacement)) + { + $this->message = preg_replace_callback($regexp, $replacement, $this->message); + } + else + { + $this->message = preg_replace($regexp, $replacement, $this->message); + } + $bitfield->set($bbcode_data['bbcode_id']); + } + } + } + } + + $this->bbcode_bitfield = $bitfield->get_base64(); + } + + /** + * Prepare some bbcodes for better parsing + */ + function prepare_bbcodes() + { + // Ok, seems like users instead want the no-parsing of urls, smilies, etc. after and before and within quote tags being tagged as "not a bug". + // Fine by me ;) Will ease our live... but do not come back and cry at us, we won't hear you. + + /* Add newline at the end and in front of each quote block to prevent parsing errors (urls, smilies, etc.) + if (strpos($this->message, '[quote') !== false && strpos($this->message, '[/quote]') !== false) + { + $this->message = str_replace("\r\n", "\n", $this->message); + + // We strip newlines and spaces after and before quotes in quotes (trimming) and then add exactly one newline + $this->message = preg_replace('#\[quote(=".*?")?\]\s*(.*?)\s*\[/quote\]#siu', '[quote\1]' . "\n" . '\2' ."\n[/quote]", $this->message); + } + */ + + // Add other checks which needs to be placed before actually parsing anything (be it bbcodes, smilies, urls...) + } + + /** + * Init bbcode data for later parsing + */ + function bbcode_init($allow_custom_bbcode = true) + { + global $phpbb_dispatcher; + + static $rowset; + + $bbcode_class = $this; + + // This array holds all bbcode data. BBCodes will be processed in this + // order, so it is important to keep [code] in first position and + // [quote] in second position. + // To parse multiline URL we enable dotall option setting only for URL text + // but not for link itself, thus [url][/url] is not affected. + // + // To perform custom validation in extension, use $this->validate_bbcode_by_extension() + // method which accepts variable number of parameters + $this->bbcodes = array( + 'code' => array('bbcode_id' => BBCODE_ID_CODE, 'regexp' => array('#\[code(?:=([a-z]+))?\](.+\[/code\])#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_code($match[1], $match[2]); + } + )), + 'quote' => array('bbcode_id' => BBCODE_ID_QUOTE, 'regexp' => array('#\[quote(?:="(.*?)")?\](.+)\[/quote\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_quote($match[0]); + } + )), + 'attachment' => array('bbcode_id' => BBCODE_ID_ATTACH, 'regexp' => array('#\[attachment=([0-9]+)\](.*?)\[/attachment\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_attachment($match[1], $match[2]); + } + )), + 'b' => array('bbcode_id' => BBCODE_ID_B, 'regexp' => array('#\[b\](.*?)\[/b\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_strong($match[1]); + } + )), + 'i' => array('bbcode_id' => BBCODE_ID_I, 'regexp' => array('#\[i\](.*?)\[/i\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_italic($match[1]); + } + )), + 'url' => array('bbcode_id' => BBCODE_ID_URL, 'regexp' => array('#\[url(=(.*))?\](?(1)((?s).*(?-s))|(.*))\[/url\]#uiU' => function ($match) use($bbcode_class) + { + return $bbcode_class->validate_url($match[2], ($match[3]) ? $match[3] : $match[4]); + } + )), + 'img' => array('bbcode_id' => BBCODE_ID_IMG, 'regexp' => array('#\[img\](.*)\[/img\]#uiU' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_img($match[1]); + } + )), + 'size' => array('bbcode_id' => BBCODE_ID_SIZE, 'regexp' => array('#\[size=([\-\+]?\d+)\](.*?)\[/size\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_size($match[1], $match[2]); + } + )), + 'color' => array('bbcode_id' => BBCODE_ID_COLOR, 'regexp' => array('!\[color=(#[0-9a-f]{3}|#[0-9a-f]{6}|[a-z\-]+)\](.*?)\[/color\]!uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_color($match[1], $match[2]); + } + )), + 'u' => array('bbcode_id' => BBCODE_ID_U, 'regexp' => array('#\[u\](.*?)\[/u\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_underline($match[1]); + } + )), + 'list' => array('bbcode_id' => BBCODE_ID_LIST, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_parse_list($match[0]); + } + )), + 'email' => array('bbcode_id' => BBCODE_ID_EMAIL, 'regexp' => array('#\[email=?(.*?)?\](.*?)\[/email\]#uis' => function ($match) use($bbcode_class) + { + return $bbcode_class->validate_email($match[1], $match[2]); + } + )), + 'flash' => array('bbcode_id' => BBCODE_ID_FLASH, 'regexp' => array('#\[flash=([0-9]+),([0-9]+)\](.*?)\[/flash\]#ui' => function ($match) use($bbcode_class) + { + return $bbcode_class->bbcode_flash($match[1], $match[2], $match[3]); + } + )) + ); + + // Zero the parsed items array + $this->parsed_items = array(); + + foreach ($this->bbcodes as $tag => $bbcode_data) + { + $this->parsed_items[$tag] = 0; + } + + if (!$allow_custom_bbcode) + { + return; + } + + if (!is_array($rowset)) + { + global $db; + $rowset = array(); + + $sql = 'SELECT * + FROM ' . BBCODES_TABLE; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $rowset[] = $row; + } + $db->sql_freeresult($result); + } + + foreach ($rowset as $row) + { + $this->bbcodes[$row['bbcode_tag']] = array( + 'bbcode_id' => (int) $row['bbcode_id'], + 'regexp' => array($row['first_pass_match'] => str_replace('$uid', $this->bbcode_uid, $row['first_pass_replace'])) + ); + } + + $bbcodes = $this->bbcodes; + + /** + * Event to modify the bbcode data for later parsing + * + * @event core.modify_bbcode_init + * @var array bbcodes Array of bbcode data for use in parsing + * @var array rowset Array of bbcode data from the database + * @since 3.1.0-a3 + */ + $vars = array('bbcodes', 'rowset'); + extract($phpbb_dispatcher->trigger_event('core.modify_bbcode_init', compact($vars))); + + $this->bbcodes = $bbcodes; + } + + /** + * Making some pre-checks for bbcodes as well as increasing the number of parsed items + */ + function check_bbcode($bbcode, &$in) + { + // when using the /e modifier, preg_replace slashes double-quotes but does not + // seem to slash anything else + $in = str_replace("\r\n", "\n", str_replace('\"', '"', $in)); + + // Trimming here to make sure no empty bbcodes are parsed accidently + if (trim($in) == '') + { + return false; + } + + $this->parsed_items[$bbcode]++; + + return true; + } + + /** + * Transform some characters in valid bbcodes + */ + function bbcode_specialchars($text) + { + $str_from = array('<', '>', '[', ']', '.', ':'); + $str_to = array('<', '>', '[', ']', '.', ':'); + + return str_replace($str_from, $str_to, $text); + } + + /** + * Parse size tag + */ + function bbcode_size($stx, $in) + { + global $user, $config; + + if (!$this->check_bbcode('size', $in)) + { + return $in; + } + + if ($config['max_' . $this->mode . '_font_size'] && $config['max_' . $this->mode . '_font_size'] < $stx) + { + $this->warn_msg[] = $user->lang('MAX_FONT_SIZE_EXCEEDED', (int) $config['max_' . $this->mode . '_font_size']); + + return '[size=' . $stx . ']' . $in . '[/size]'; + } + + // Do not allow size=0 + if ($stx <= 0) + { + return '[size=' . $stx . ']' . $in . '[/size]'; + } + + return '[size=' . $stx . ':' . $this->bbcode_uid . ']' . $in . '[/size:' . $this->bbcode_uid . ']'; + } + + /** + * Parse color tag + */ + function bbcode_color($stx, $in) + { + if (!$this->check_bbcode('color', $in)) + { + return $in; + } + + return '[color=' . $stx . ':' . $this->bbcode_uid . ']' . $in . '[/color:' . $this->bbcode_uid . ']'; + } + + /** + * Parse u tag + */ + function bbcode_underline($in) + { + if (!$this->check_bbcode('u', $in)) + { + return $in; + } + + return '[u:' . $this->bbcode_uid . ']' . $in . '[/u:' . $this->bbcode_uid . ']'; + } + + /** + * Parse b tag + */ + function bbcode_strong($in) + { + if (!$this->check_bbcode('b', $in)) + { + return $in; + } + + return '[b:' . $this->bbcode_uid . ']' . $in . '[/b:' . $this->bbcode_uid . ']'; + } + + /** + * Parse i tag + */ + function bbcode_italic($in) + { + if (!$this->check_bbcode('i', $in)) + { + return $in; + } + + return '[i:' . $this->bbcode_uid . ']' . $in . '[/i:' . $this->bbcode_uid . ']'; + } + + /** + * Parse img tag + */ + function bbcode_img($in) + { + global $user, $config; + + if (!$this->check_bbcode('img', $in)) + { + return $in; + } + + $in = trim($in); + $error = false; + + $in = str_replace(' ', '%20', $in); + + // Checking urls + if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $in) && !preg_match('#^' . get_preg_expression('www_url') . '$#iu', $in)) + { + return '[img]' . $in . '[/img]'; + } + + // Try to cope with a common user error... not specifying a protocol but only a subdomain + if (!preg_match('#^[a-z0-9]+://#i', $in)) + { + $in = 'http://' . $in; + } + + if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width']) + { + $imagesize = new \FastImageSize\FastImageSize(); + $size_info = $imagesize->getImageSize(htmlspecialchars_decode($in)); + + if ($size_info === false) + { + $error = true; + $this->warn_msg[] = $user->lang['UNABLE_GET_IMAGE_SIZE']; + } + else + { + if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $size_info['height']) + { + $error = true; + $this->warn_msg[] = $user->lang('MAX_IMG_HEIGHT_EXCEEDED', (int) $config['max_' . $this->mode . '_img_height']); + } + + if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $size_info['width']) + { + $error = true; + $this->warn_msg[] = $user->lang('MAX_IMG_WIDTH_EXCEEDED', (int) $config['max_' . $this->mode . '_img_width']); + } + } + } + + if ($error || $this->path_in_domain($in)) + { + return '[img]' . $in . '[/img]'; + } + + return '[img:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($in) . '[/img:' . $this->bbcode_uid . ']'; + } + + /** + * Parse flash tag + */ + function bbcode_flash($width, $height, $in) + { + global $user, $config; + + if (!$this->check_bbcode('flash', $in)) + { + return $in; + } + + $in = trim($in); + $error = false; + + // Do not allow 0-sizes generally being entered + if ($width <= 0 || $height <= 0) + { + return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]'; + } + + $in = str_replace(' ', '%20', $in); + + // Make sure $in is a URL. + if (!preg_match('#^' . get_preg_expression('url') . '$#iu', $in) && + !preg_match('#^' . get_preg_expression('www_url') . '$#iu', $in)) + { + return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]'; + } + + // Apply the same size checks on flash files as on images + if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width']) + { + if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $height) + { + $error = true; + $this->warn_msg[] = $user->lang('MAX_FLASH_HEIGHT_EXCEEDED', (int) $config['max_' . $this->mode . '_img_height']); + } + + if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $width) + { + $error = true; + $this->warn_msg[] = $user->lang('MAX_FLASH_WIDTH_EXCEEDED', (int) $config['max_' . $this->mode . '_img_width']); + } + } + + if ($error || $this->path_in_domain($in)) + { + return '[flash=' . $width . ',' . $height . ']' . $in . '[/flash]'; + } + + return '[flash=' . $width . ',' . $height . ':' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($in) . '[/flash:' . $this->bbcode_uid . ']'; + } + + /** + * Parse inline attachments [ia] + */ + function bbcode_attachment($stx, $in) + { + if (!$this->check_bbcode('attachment', $in)) + { + return $in; + } + + return '[attachment=' . $stx . ':' . $this->bbcode_uid . ']' . trim($in) . '[/attachment:' . $this->bbcode_uid . ']'; + } + + /** + * Parse code text from code tag + * @access private + */ + function bbcode_parse_code($stx, &$code) + { + switch (strtolower($stx)) + { + case 'php': + + $remove_tags = false; + + $str_from = array('<', '>', '[', ']', '.', ':', ':'); + $str_to = array('<', '>', '[', ']', '.', ':', ':'); + $code = str_replace($str_from, $str_to, $code); + + if (!preg_match('/\<\?.*?\?\>/is', $code)) + { + $remove_tags = true; + $code = ""; + } + + $conf = array('highlight.bg', 'highlight.comment', 'highlight.default', 'highlight.html', 'highlight.keyword', 'highlight.string'); + foreach ($conf as $ini_var) + { + @ini_set($ini_var, str_replace('highlight.', 'syntax', $ini_var)); + } + + // Because highlight_string is specialcharing the text (but we already did this before), we have to reverse this in order to get correct results + $code = htmlspecialchars_decode($code); + $code = highlight_string($code, true); + + $str_from = array('', '', '','[', ']', '.', ':'); + $str_to = array('', '', '', '[', ']', '.', ':'); + + if ($remove_tags) + { + $str_from[] = '<?php '; + $str_to[] = ''; + $str_from[] = '<?php '; + $str_to[] = ''; + } + + $code = str_replace($str_from, $str_to, $code); + $code = preg_replace('#^()\n?(.*?)\n?()$#is', '$1$2$3', $code); + + if ($remove_tags) + { + $code = preg_replace('#()?\?>()#', '$1 $2', $code); + } + + $code = preg_replace('#^(.*)#s', '$2', $code); + $code = preg_replace('#(?:\s++| )*+$#u', '', $code); + + // remove newline at the end + if (!empty($code) && substr($code, -1) == "\n") + { + $code = substr($code, 0, -1); + } + + return "[code=$stx:" . $this->bbcode_uid . ']' . $code . '[/code:' . $this->bbcode_uid . ']'; + break; + + default: + return '[code:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($code) . '[/code:' . $this->bbcode_uid . ']'; + break; + } + } + + /** + * Parse code tag + * Expects the argument to start right after the opening [code] tag and to end with [/code] + */ + function bbcode_code($stx, $in) + { + if (!$this->check_bbcode('code', $in)) + { + return $in; + } + + // We remove the hardcoded elements from the code block here because it is not used in code blocks + // Having it here saves us one preg_replace per message containing [code] blocks + // Additionally, magic url parsing should go after parsing bbcodes, but for safety those are stripped out too... + $htm_match = get_preg_expression('bbcode_htm'); + unset($htm_match[4], $htm_match[5]); + $htm_replace = array('\1', '\1', '\2', '\1'); + + $out = $code_block = ''; + $open = 1; + + while ($in) + { + // Determine position and tag length of next code block + preg_match('#(.*?)(\[code(?:=([a-z]+))?\])(.+)#is', $in, $buffer); + $pos = (isset($buffer[1])) ? strlen($buffer[1]) : false; + $tag_length = (isset($buffer[2])) ? strlen($buffer[2]) : false; + + // Determine position of ending code tag + $pos2 = stripos($in, '[/code]'); + + // Which is the next block, ending code or code block + if ($pos !== false && $pos < $pos2) + { + // Open new block + if (!$open) + { + $out .= substr($in, 0, $pos); + $in = substr($in, $pos); + $stx = (isset($buffer[3])) ? $buffer[3] : ''; + $code_block = ''; + } + else + { + // Already opened block, just append to the current block + $code_block .= substr($in, 0, $pos) . ((isset($buffer[2])) ? $buffer[2] : ''); + $in = substr($in, $pos); + } + + $in = substr($in, $tag_length); + $open++; + } + else + { + // Close the block + if ($open == 1) + { + $code_block .= substr($in, 0, $pos2); + $code_block = preg_replace($htm_match, $htm_replace, $code_block); + + // Parse this code block + $out .= $this->bbcode_parse_code($stx, $code_block); + $code_block = ''; + $open--; + } + else if ($open) + { + // Close one open tag... add to the current code block + $code_block .= substr($in, 0, $pos2 + 7); + $open--; + } + else + { + // end code without opening code... will be always outside code block + $out .= substr($in, 0, $pos2 + 7); + } + + $in = substr($in, $pos2 + 7); + } + } + + // if now $code_block has contents we need to parse the remaining code while removing the last closing tag to match up. + if ($code_block) + { + $code_block = substr($code_block, 0, -7); + $code_block = preg_replace($htm_match, $htm_replace, $code_block); + + $out .= $this->bbcode_parse_code($stx, $code_block); + } + + return $out; + } + + /** + * Parse list bbcode + * Expects the argument to start with a tag + */ + function bbcode_parse_list($in) + { + if (!$this->check_bbcode('list', $in)) + { + return $in; + } + + // $tok holds characters to stop at. Since the string starts with a '[' we'll get everything up to the first ']' which should be the opening [list] tag + $tok = ']'; + $out = '['; + + // First character is [ + $in = substr($in, 1); + $list_end_tags = $item_end_tags = array(); + + do + { + $pos = strlen($in); + + for ($i = 0, $tok_len = strlen($tok); $i < $tok_len; ++$i) + { + $tmp_pos = strpos($in, $tok[$i]); + + if ($tmp_pos !== false && $tmp_pos < $pos) + { + $pos = $tmp_pos; + } + } + + $buffer = substr($in, 0, $pos); + $tok = $in[$pos]; + + $in = substr($in, $pos + 1); + + if ($tok == ']') + { + // if $tok is ']' the buffer holds a tag + if (strtolower($buffer) == '/list' && count($list_end_tags)) + { + // valid [/list] tag, check nesting so that we don't hit false positives + if (count($item_end_tags) && count($item_end_tags) >= count($list_end_tags)) + { + // current li tag has not been closed + $out = preg_replace('/\n?\[$/', '[', $out) . array_pop($item_end_tags) . ']['; + } + + $out .= array_pop($list_end_tags) . ']'; + $tok = '['; + } + else if (preg_match('#^list(=[0-9a-z]+)?$#i', $buffer, $m)) + { + // sub-list, add a closing tag + if (empty($m[1]) || preg_match('/^=(?:disc|square|circle)$/i', $m[1])) + { + array_push($list_end_tags, '/list:u:' . $this->bbcode_uid); + } + else + { + array_push($list_end_tags, '/list:o:' . $this->bbcode_uid); + } + $out .= 'list' . substr($buffer, 4) . ':' . $this->bbcode_uid . ']'; + $tok = '['; + } + else + { + if (($buffer == '*' || substr($buffer, -2) == '[*') && count($list_end_tags)) + { + // the buffer holds a bullet tag and we have a [list] tag open + if (count($item_end_tags) >= count($list_end_tags)) + { + if (substr($buffer, -2) == '[*') + { + $out .= substr($buffer, 0, -2) . '['; + } + // current li tag has not been closed + if (preg_match('/\n\[$/', $out, $m)) + { + $out = preg_replace('/\n\[$/', '[', $out); + $buffer = array_pop($item_end_tags) . "]\n[*:" . $this->bbcode_uid; + } + else + { + $buffer = array_pop($item_end_tags) . '][*:' . $this->bbcode_uid; + } + } + else + { + $buffer = '*:' . $this->bbcode_uid; + } + + $item_end_tags[] = '/*:m:' . $this->bbcode_uid; + } + else if ($buffer == '/*') + { + array_pop($item_end_tags); + $buffer = '/*:' . $this->bbcode_uid; + } + + $out .= $buffer . $tok; + $tok = '[]'; + } + } + else + { + // Not within a tag, just add buffer to the return string + $out .= $buffer . $tok; + $tok = ($tok == '[') ? ']' : '[]'; + } + } + while ($in); + + // do we have some tags open? close them now + if (count($item_end_tags)) + { + $out .= '[' . implode('][', $item_end_tags) . ']'; + } + if (count($list_end_tags)) + { + $out .= '[' . implode('][', $list_end_tags) . ']'; + } + + return $out; + } + + /** + * Parse quote bbcode + * Expects the argument to start with a tag + */ + function bbcode_quote($in) + { + $in = str_replace("\r\n", "\n", str_replace('\"', '"', trim($in))); + + if (!$in) + { + return ''; + } + + // To let the parser not catch tokens within quote_username quotes we encode them before we start this... + $in = preg_replace_callback('#quote="(.*?)"\]#i', function ($match) { + return 'quote="' . str_replace(array('[', ']', '\\\"'), array('[', ']', '\"'), $match[1]) . '"]'; + }, $in); + + $tok = ']'; + $out = '['; + + $in = substr($in, 1); + $close_tags = $error_ary = array(); + $buffer = ''; + + do + { + $pos = strlen($in); + for ($i = 0, $tok_len = strlen($tok); $i < $tok_len; ++$i) + { + $tmp_pos = strpos($in, $tok[$i]); + if ($tmp_pos !== false && $tmp_pos < $pos) + { + $pos = $tmp_pos; + } + } + + $buffer .= substr($in, 0, $pos); + $tok = $in[$pos]; + $in = substr($in, $pos + 1); + + if ($tok == ']') + { + if (strtolower($buffer) == '/quote' && count($close_tags) && substr($out, -1, 1) == '[') + { + // we have found a closing tag + $out .= array_pop($close_tags) . ']'; + $tok = '['; + $buffer = ''; + + /* Add space at the end of the closing tag if not happened before to allow following urls/smilies to be parsed correctly + * Do not try to think for the user. :/ Do not parse urls/smilies if there is no space - is the same as with other bbcodes too. + * Also, we won't have any spaces within $in anyway, only adding up spaces -> #10982 + if (!$in || $in[0] !== ' ') + { + $out .= ' '; + }*/ + } + else if (preg_match('#^quote(?:="(.*?)")?$#is', $buffer, $m) && substr($out, -1, 1) == '[') + { + $this->parsed_items['quote']++; + array_push($close_tags, '/quote:' . $this->bbcode_uid); + + if (isset($m[1]) && $m[1]) + { + $username = str_replace(array('[', ']'), array('[', ']'), $m[1]); + $username = preg_replace('#\[(?!b|i|u|color|url|email|/b|/i|/u|/color|/url|/email)#iU', '[$1', $username); + + $end_tags = array(); + $error = false; + + preg_match_all('#\[((?:/)?(?:[a-z]+))#i', $username, $tags); + foreach ($tags[1] as $tag) + { + if ($tag[0] != '/') + { + $end_tags[] = '/' . $tag; + } + else + { + $end_tag = array_pop($end_tags); + $error = ($end_tag != $tag) ? true : false; + } + } + + if ($error) + { + $username = $m[1]; + } + + $out .= 'quote="' . $username . '":' . $this->bbcode_uid . ']'; + } + else + { + $out .= 'quote:' . $this->bbcode_uid . ']'; + } + + $tok = '['; + $buffer = ''; + } + else if (preg_match('#^quote="(.*?)#is', $buffer, $m)) + { + // the buffer holds an invalid opening tag + $buffer .= ']'; + } + else + { + $out .= $buffer . $tok; + $tok = '[]'; + $buffer = ''; + } + } + else + { +/** +* Old quote code working fine, but having errors listed in bug #3572 +* +* $out .= $buffer . $tok; +* $tok = ($tok == '[') ? ']' : '[]'; +* $buffer = ''; +*/ + + $out .= $buffer . $tok; + + if ($tok == '[') + { + // Search the text for the next tok... if an ending quote comes first, then change tok to [] + $pos1 = stripos($in, '[/quote'); + // If the token ] comes first, we change it to ] + $pos2 = strpos($in, ']'); + // If the token [ comes first, we change it to [ + $pos3 = strpos($in, '['); + + if ($pos1 !== false && ($pos2 === false || $pos1 < $pos2) && ($pos3 === false || $pos1 < $pos3)) + { + $tok = '[]'; + } + else if ($pos3 !== false && ($pos2 === false || $pos3 < $pos2)) + { + $tok = '['; + } + else + { + $tok = ']'; + } + } + else + { + $tok = '[]'; + } + $buffer = ''; + } + } + while ($in); + + $out .= $buffer; + + if (count($close_tags)) + { + $out .= '[' . implode('][', $close_tags) . ']'; + } + + foreach ($error_ary as $error_msg) + { + $this->warn_msg[] = $error_msg; + } + + return $out; + } + + /** + * Validate email + */ + function validate_email($var1, $var2) + { + $var1 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var1))); + $var2 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var2))); + + $txt = $var2; + $email = ($var1) ? $var1 : $var2; + + $validated = true; + + if (!preg_match('/^' . get_preg_expression('email') . '$/i', $email)) + { + $validated = false; + } + + if (!$validated) + { + return '[email' . (($var1) ? "=$var1" : '') . ']' . $var2 . '[/email]'; + } + + $this->parsed_items['email']++; + + if ($var1) + { + $retval = '[email=' . $this->bbcode_specialchars($email) . ':' . $this->bbcode_uid . ']' . $txt . '[/email:' . $this->bbcode_uid . ']'; + } + else + { + $retval = '[email:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($email) . '[/email:' . $this->bbcode_uid . ']'; + } + + return $retval; + } + + /** + * Validate url + * + * @param string $var1 optional url parameter for url bbcode: [url(=$var1)]$var2[/url] + * @param string $var2 url bbcode content: [url(=$var1)]$var2[/url] + */ + function validate_url($var1, $var2) + { + $var1 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var1))); + $var2 = str_replace("\r\n", "\n", str_replace('\"', '"', trim($var2))); + + $url = ($var1) ? $var1 : $var2; + + if ($var1 && !$var2) + { + $var2 = $var1; + } + + if (!$url) + { + return '[url' . (($var1) ? '=' . $var1 : '') . ']' . $var2 . '[/url]'; + } + + $valid = false; + + $url = str_replace(' ', '%20', $url); + + // Checking urls + if (preg_match('#^' . get_preg_expression('url') . '$#iu', $url) || + preg_match('#^' . get_preg_expression('www_url') . '$#iu', $url) || + preg_match('#^' . preg_quote(generate_board_url(), '#') . get_preg_expression('relative_url') . '$#iu', $url)) + { + $valid = true; + } + + if ($valid) + { + $this->parsed_items['url']++; + + // if there is no scheme, then add http schema + if (!preg_match('#^[a-z][a-z\d+\-.]*:/{2}#i', $url)) + { + $url = 'http://' . $url; + } + + // Is this a link to somewhere inside this board? If so then remove the session id from the url + if (strpos($url, generate_board_url()) !== false && strpos($url, 'sid=') !== false) + { + $url = preg_replace('/(&|\?)sid=[0-9a-f]{32}&/', '\1', $url); + $url = preg_replace('/(&|\?)sid=[0-9a-f]{32}$/', '', $url); + $url = append_sid($url); + } + + return ($var1) ? '[url=' . $this->bbcode_specialchars($url) . ':' . $this->bbcode_uid . ']' . $var2 . '[/url:' . $this->bbcode_uid . ']' : '[url:' . $this->bbcode_uid . ']' . $this->bbcode_specialchars($url) . '[/url:' . $this->bbcode_uid . ']'; + } + + return '[url' . (($var1) ? '=' . $var1 : '') . ']' . $var2 . '[/url]'; + } + + /** + * Check if url is pointing to this domain/script_path/php-file + * + * @param string $url the url to check + * @return true if the url is pointing to this domain/script_path/php-file, false if not + * + * @access private + */ + function path_in_domain($url) + { + global $config, $phpEx, $user; + + if ($config['force_server_vars']) + { + $check_path = !empty($config['script_path']) ? $config['script_path'] : '/'; + } + else + { + $check_path = ($user->page['root_script_path'] != '/') ? substr($user->page['root_script_path'], 0, -1) : '/'; + } + + // Is the user trying to link to a php file in this domain and script path? + if (strpos($url, ".{$phpEx}") !== false && strpos($url, $check_path) !== false) + { + $server_name = $user->host; + + // Forcing server vars is the only way to specify/override the protocol + if ($config['force_server_vars'] || !$server_name) + { + $server_name = $config['server_name']; + } + + // Check again in correct order... + $pos_ext = strpos($url, ".{$phpEx}"); + $pos_path = strpos($url, $check_path); + $pos_domain = strpos($url, $server_name); + + if ($pos_domain !== false && $pos_path >= $pos_domain && $pos_ext >= $pos_path) + { + // Ok, actually we allow linking to some files (this may be able to be extended in some way later...) + if (strpos($url, '/' . $check_path . '/download/file.' . $phpEx) !== 0) + { + return false; + } + + return true; + } + } + + return false; + } +} + +/** +* Main message parser for posting, pm, etc. takes raw message +* and parses it for attachments, bbcode and smilies +*/ +class parse_message extends bbcode_firstpass +{ + var $attachment_data = array(); + var $filename_data = array(); + + // Helps ironing out user error + var $message_status = ''; + + var $allow_img_bbcode = true; + var $allow_flash_bbcode = true; + var $allow_quote_bbcode = true; + var $allow_url_bbcode = true; + + var $mode; + + /** + * The plupload object used for dealing with attachments + * @var \phpbb\plupload\plupload + */ + protected $plupload; + + /** + * Init - give message here or manually + */ + function __construct($message = '') + { + // Init BBCode UID + $this->bbcode_uid = substr(base_convert(unique_id(), 16, 36), 0, BBCODE_UID_LEN); + $this->message = $message; + } + + /** + * Parse Message + */ + function parse($allow_bbcode, $allow_magic_url, $allow_smilies, $allow_img_bbcode = true, $allow_flash_bbcode = true, $allow_quote_bbcode = true, $allow_url_bbcode = true, $update_this_message = true, $mode = 'post') + { + global $config, $user, $phpbb_dispatcher, $phpbb_container; + + $this->mode = $mode; + + foreach (array('chars', 'smilies', 'urls', 'font_size', 'img_height', 'img_width') as $key) + { + if (!isset($config['max_' . $mode . '_' . $key])) + { + $config['max_' . $mode . '_' . $key] = 0; + } + } + + $this->allow_img_bbcode = $allow_img_bbcode; + $this->allow_flash_bbcode = $allow_flash_bbcode; + $this->allow_quote_bbcode = $allow_quote_bbcode; + $this->allow_url_bbcode = $allow_url_bbcode; + + // If false, then $this->message won't be altered, the text will be returned instead. + if (!$update_this_message) + { + $tmp_message = $this->message; + $return_message = &$this->message; + } + + if ($this->message_status == 'display') + { + $this->decode_message(); + } + + // Store message length... + $message_length = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message)); + + // Maximum message length check. 0 disables this check completely. + if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars']) + { + $this->warn_msg[] = $user->lang('CHARS_' . strtoupper($mode) . '_CONTAINS', $message_length) . '
' . $user->lang('TOO_MANY_CHARS_LIMIT', (int) $config['max_' . $mode . '_chars']); + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + + // Minimum message length check for post only + if ($mode === 'post') + { + if (!$message_length || $message_length < (int) $config['min_post_chars']) + { + $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : ($user->lang('CHARS_POST_CONTAINS', $message_length) . '
' . $user->lang('TOO_FEW_CHARS_LIMIT', (int) $config['min_post_chars'])); + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + } + + /** + * This event can be used for additional message checks/cleanup before parsing + * + * @event core.message_parser_check_message + * @var bool allow_bbcode Do we allow BBCodes + * @var bool allow_magic_url Do we allow magic urls + * @var bool allow_smilies Do we allow smilies + * @var bool allow_img_bbcode Do we allow image BBCode + * @var bool allow_flash_bbcode Do we allow flash BBCode + * @var bool allow_quote_bbcode Do we allow quote BBCode + * @var bool allow_url_bbcode Do we allow url BBCode + * @var bool update_this_message Do we alter the parsed message + * @var string mode Posting mode + * @var string message The message text to parse + * @var string bbcode_bitfield The bbcode_bitfield before parsing + * @var string bbcode_uid The bbcode_uid before parsing + * @var bool return Do we return after the event is triggered if $warn_msg is not empty + * @var array warn_msg Array of the warning messages + * @since 3.1.2-RC1 + * @changed 3.1.3-RC1 Added vars $bbcode_bitfield and $bbcode_uid + */ + $message = $this->message; + $warn_msg = $this->warn_msg; + $return = false; + $bbcode_bitfield = $this->bbcode_bitfield; + $bbcode_uid = $this->bbcode_uid; + $vars = array( + 'allow_bbcode', + 'allow_magic_url', + 'allow_smilies', + 'allow_img_bbcode', + 'allow_flash_bbcode', + 'allow_quote_bbcode', + 'allow_url_bbcode', + 'update_this_message', + 'mode', + 'message', + 'bbcode_bitfield', + 'bbcode_uid', + 'return', + 'warn_msg', + ); + extract($phpbb_dispatcher->trigger_event('core.message_parser_check_message', compact($vars))); + $this->message = $message; + $this->warn_msg = $warn_msg; + $this->bbcode_bitfield = $bbcode_bitfield; + $this->bbcode_uid = $bbcode_uid; + if ($return && !empty($this->warn_msg)) + { + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + + // Get the parser + $parser = $phpbb_container->get('text_formatter.parser'); + + // Set the parser's options + ($allow_bbcode) ? $parser->enable_bbcodes() : $parser->disable_bbcodes(); + ($allow_magic_url) ? $parser->enable_magic_url() : $parser->disable_magic_url(); + ($allow_smilies) ? $parser->enable_smilies() : $parser->disable_smilies(); + ($allow_img_bbcode) ? $parser->enable_bbcode('img') : $parser->disable_bbcode('img'); + ($allow_flash_bbcode) ? $parser->enable_bbcode('flash') : $parser->disable_bbcode('flash'); + ($allow_quote_bbcode) ? $parser->enable_bbcode('quote') : $parser->disable_bbcode('quote'); + ($allow_url_bbcode) ? $parser->enable_bbcode('url') : $parser->disable_bbcode('url'); + + // Set some config values + $parser->set_vars(array( + 'max_font_size' => $config['max_' . $this->mode . '_font_size'], + 'max_img_height' => $config['max_' . $this->mode . '_img_height'], + 'max_img_width' => $config['max_' . $this->mode . '_img_width'], + 'max_smilies' => $config['max_' . $this->mode . '_smilies'], + 'max_urls' => $config['max_' . $this->mode . '_urls'] + )); + + // Parse this message + $this->message = $parser->parse(htmlspecialchars_decode($this->message, ENT_QUOTES)); + + // Remove quotes that are nested too deep + if ($config['max_quote_depth'] > 0) + { + $this->remove_nested_quotes($config['max_quote_depth']); + } + + // Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length. + // The maximum length check happened before any parsings. + if ($mode === 'post' && utf8_clean_string($this->message) === '') + { + $this->warn_msg[] = $user->lang['TOO_FEW_CHARS']; + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + + // Remove quotes that are nested too deep + if ($config['max_quote_depth'] > 0) + { + $this->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode( + $this->message, + 'quote', + $config['max_quote_depth'] + ); + } + + // Check for errors + $errors = $parser->get_errors(); + if ($errors) + { + foreach ($errors as $i => $args) + { + // Translate each error with $user->lang() + $errors[$i] = call_user_func_array(array($user, 'lang'), $args); + } + $this->warn_msg = array_merge($this->warn_msg, $errors); + + return (!$update_this_message) ? $return_message : $this->warn_msg; + } + + if (!$update_this_message) + { + unset($this->message); + $this->message = $tmp_message; + return $return_message; + } + + $this->message_status = 'parsed'; + return false; + } + + /** + * Formatting text for display + */ + function format_display($allow_bbcode, $allow_magic_url, $allow_smilies, $update_this_message = true) + { + global $phpbb_container, $phpbb_dispatcher; + + // If false, then the parsed message get returned but internal message not processed. + if (!$update_this_message) + { + $tmp_message = $this->message; + $return_message = &$this->message; + } + + $text = $this->message; + $uid = $this->bbcode_uid; + + /** + * Event to modify the text before it is parsed + * + * @event core.modify_format_display_text_before + * @var string text The message text to parse + * @var string uid The bbcode uid + * @var bool allow_bbcode Do we allow bbcodes + * @var bool allow_magic_url Do we allow magic urls + * @var bool allow_smilies Do we allow smilies + * @var bool update_this_message Do we update the internal message + * with the parsed result + * @since 3.1.6-RC1 + */ + $vars = array('text', 'uid', 'allow_bbcode', 'allow_magic_url', 'allow_smilies', 'update_this_message'); + extract($phpbb_dispatcher->trigger_event('core.modify_format_display_text_before', compact($vars))); + + $this->message = $text; + $this->bbcode_uid = $uid; + unset($text, $uid); + + // NOTE: message_status is unreliable for detecting unparsed text because some callers + // change $this->message without resetting $this->message_status to 'plain' so we + // inspect the message instead + //if ($this->message_status == 'plain') + if (!preg_match('/^<[rt][ >]/', $this->message)) + { + // Force updating message - of course. + $this->parse($allow_bbcode, $allow_magic_url, $allow_smilies, $this->allow_img_bbcode, $this->allow_flash_bbcode, $this->allow_quote_bbcode, $this->allow_url_bbcode, true); + } + + // There's a bug when previewing a topic with no poll, because the empty title of the poll + // gets parsed but $this->message still ends up empty. This fixes it, until a proper fix is + // devised + if ($this->message === '') + { + $this->message = $phpbb_container->get('text_formatter.parser')->parse($this->message); + } + + $this->message = $phpbb_container->get('text_formatter.renderer')->render($this->message); + + $text = $this->message; + $uid = $this->bbcode_uid; + + /** + * Event to modify the text after it is parsed + * + * @event core.modify_format_display_text_after + * @var string text The message text to parse + * @var string uid The bbcode uid + * @var bool allow_bbcode Do we allow bbcodes + * @var bool allow_magic_url Do we allow magic urls + * @var bool allow_smilies Do we allow smilies + * @var bool update_this_message Do we update the internal message + * with the parsed result + * @since 3.1.0-a3 + */ + $vars = array('text', 'uid', 'allow_bbcode', 'allow_magic_url', 'allow_smilies', 'update_this_message'); + extract($phpbb_dispatcher->trigger_event('core.modify_format_display_text_after', compact($vars))); + + $this->message = $text; + $this->bbcode_uid = $uid; + + if (!$update_this_message) + { + unset($this->message); + $this->message = $tmp_message; + return $return_message; + } + + $this->message_status = 'display'; + return false; + } + + /** + * Decode message to be placed back into form box + */ + function decode_message($custom_bbcode_uid = '', $update_this_message = true) + { + // If false, then the parsed message get returned but internal message not processed. + if (!$update_this_message) + { + $tmp_message = $this->message; + $return_message = &$this->message; + } + + ($custom_bbcode_uid) ? decode_message($this->message, $custom_bbcode_uid) : decode_message($this->message, $this->bbcode_uid); + + if (!$update_this_message) + { + unset($this->message); + $this->message = $tmp_message; + return $return_message; + } + + $this->message_status = 'plain'; + return false; + } + + /** + * Replace magic urls of form http://xxx.xxx., www.xxx. and xxx@xxx.xxx. + * Cuts down displayed size of link if over 50 chars, turns absolute links + * into relative versions when the server/script path matches the link + */ + function magic_url($server_url) + { + // We use the global make_clickable function + $this->message = make_clickable($this->message, $server_url); + } + + /** + * Parse Smilies + */ + function smilies($max_smilies = 0) + { + global $db, $user; + static $match; + static $replace; + + // See if the static arrays have already been filled on an earlier invocation + if (!is_array($match)) + { + $match = $replace = array(); + + // NOTE: obtain_* function? chaching the table contents? + + // For now setting the ttl to 10 minutes + switch ($db->get_sql_layer()) + { + case 'mssql_odbc': + case 'mssqlnative': + $sql = 'SELECT * + FROM ' . SMILIES_TABLE . ' + ORDER BY LEN(code) DESC'; + break; + + // LENGTH supported by MySQL, IBM DB2, Oracle and Access for sure... + default: + $sql = 'SELECT * + FROM ' . SMILIES_TABLE . ' + ORDER BY LENGTH(code) DESC'; + break; + } + $result = $db->sql_query($sql, 600); + + while ($row = $db->sql_fetchrow($result)) + { + if (empty($row['code'])) + { + continue; + } + + // (assertion) + $match[] = preg_quote($row['code'], '#'); + $replace[] = '' . $row['code'] . ''; + } + $db->sql_freeresult($result); + } + + if (count($match)) + { + if ($max_smilies) + { + // 'u' modifier has been added to correctly parse smilies within unicode strings + // For details: http://tracker.phpbb.com/browse/PHPBB3-10117 + $num_matches = preg_match_all('#(?<=^|[\n .])(?:' . implode('|', $match) . ')(?![^<>]*>)#u', $this->message, $matches); + unset($matches); + + if ($num_matches !== false && $num_matches > $max_smilies) + { + $this->warn_msg[] = sprintf($user->lang['TOO_MANY_SMILIES'], $max_smilies); + return; + } + } + + // Make sure the delimiter # is added in front and at the end of every element within $match + // 'u' modifier has been added to correctly parse smilies within unicode strings + // For details: http://tracker.phpbb.com/browse/PHPBB3-10117 + + $this->message = trim(preg_replace(explode(chr(0), '#(?<=^|[\n .])' . implode('(?![^<>]*>)#u' . chr(0) . '#(?<=^|[\n .])', $match) . '(?![^<>]*>)#u'), $replace, $this->message)); + } + } + + /** + * Parse Attachments + */ + function parse_attachments($form_name, $mode, $forum_id, $submit, $preview, $refresh, $is_message = false) + { + global $config, $auth, $user, $phpbb_root_path, $phpEx, $db, $request; + global $phpbb_container, $phpbb_dispatcher; + + $error = array(); + + $num_attachments = count($this->attachment_data); + $this->filename_data['filecomment'] = $request->variable('filecomment', '', true); + $upload = $request->file($form_name); + $upload_file = (!empty($upload) && $upload['name'] !== 'none' && trim($upload['name'])); + + $add_file = (isset($_POST['add_file'])) ? true : false; + $delete_file = (isset($_POST['delete_file'])) ? true : false; + + // First of all adjust comments if changed + $actual_comment_list = $request->variable('comment_list', array(''), true); + + foreach ($actual_comment_list as $comment_key => $comment) + { + if (!isset($this->attachment_data[$comment_key])) + { + continue; + } + + if ($this->attachment_data[$comment_key]['attach_comment'] != $actual_comment_list[$comment_key]) + { + $this->attachment_data[$comment_key]['attach_comment'] = $actual_comment_list[$comment_key]; + } + } + + $cfg = array(); + $cfg['max_attachments'] = ($is_message) ? $config['max_attachments_pm'] : $config['max_attachments']; + $forum_id = ($is_message) ? 0 : $forum_id; + + if ($submit && in_array($mode, array('post', 'reply', 'quote', 'edit')) && $upload_file) + { + if ($num_attachments < $cfg['max_attachments'] || $auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) + { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message); + $error = $filedata['error']; + + if ($filedata['post_attach'] && !count($error)) + { + $sql_ary = array( + 'physical_filename' => $filedata['physical_filename'], + 'attach_comment' => $this->filename_data['filecomment'], + 'real_filename' => $filedata['real_filename'], + 'extension' => $filedata['extension'], + 'mimetype' => $filedata['mimetype'], + 'filesize' => $filedata['filesize'], + 'filetime' => $filedata['filetime'], + 'thumbnail' => $filedata['thumbnail'], + 'is_orphan' => 1, + 'in_message' => ($is_message) ? 1 : 0, + 'poster_id' => $user->data['user_id'], + ); + + /** + * Modify attachment sql array on submit + * + * @event core.modify_attachment_sql_ary_on_submit + * @var array sql_ary Array containing SQL data + * @since 3.2.6-RC1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.modify_attachment_sql_ary_on_submit', compact($vars))); + + $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $new_entry = array( + 'attach_id' => $db->sql_nextid(), + 'is_orphan' => 1, + 'real_filename' => $filedata['real_filename'], + 'attach_comment'=> $this->filename_data['filecomment'], + 'filesize' => $filedata['filesize'], + ); + + $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); + + /** + * Modify attachment data on submit + * + * @event core.modify_attachment_data_on_submit + * @var array attachment_data Array containing attachment data + * @since 3.2.2-RC1 + */ + $attachment_data = $this->attachment_data; + $vars = array('attachment_data'); + extract($phpbb_dispatcher->trigger_event('core.modify_attachment_data_on_submit', compact($vars))); + $this->attachment_data = $attachment_data; + unset($attachment_data); + + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) { + return '[attachment='.($match[1] + 1).']' . $match[2] . '[/attachment]'; + }, $this->message); + + $this->filename_data['filecomment'] = ''; + + // This Variable is set to false here, because Attachments are entered into the + // Database in two modes, one if the id_list is 0 and the second one if post_attach is true + // Since post_attach is automatically switched to true if an Attachment got added to the filesystem, + // but we are assigning an id of 0 here, we have to reset the post_attach variable to false. + // + // This is very relevant, because it could happen that the post got not submitted, but we do not + // know this circumstance here. We could be at the posting page or we could be redirected to the entered + // post. :) + $filedata['post_attach'] = false; + } + } + else + { + $error[] = $user->lang('TOO_MANY_ATTACHMENTS', (int) $cfg['max_attachments']); + } + } + + if ($preview || $refresh || count($error)) + { + if (isset($this->plupload) && $this->plupload->is_active()) + { + $json_response = new \phpbb\json_response(); + } + + // Perform actions on temporary attachments + if ($delete_file) + { + include_once($phpbb_root_path . 'includes/functions_admin.' . $phpEx); + + $index = array_keys($request->variable('delete_file', array(0 => 0))); + $index = (!empty($index)) ? $index[0] : false; + + if ($index !== false && !empty($this->attachment_data[$index])) + { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + + // delete selected attachment + if ($this->attachment_data[$index]['is_orphan']) + { + $sql = 'SELECT attach_id, physical_filename, thumbnail + FROM ' . ATTACHMENTS_TABLE . ' + WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id'] . ' + AND is_orphan = 1 + AND poster_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $attachment_manager->unlink($row['physical_filename'], 'file'); + + if ($row['thumbnail']) + { + $attachment_manager->unlink($row['physical_filename'], 'thumbnail'); + } + + $db->sql_query('DELETE FROM ' . ATTACHMENTS_TABLE . ' WHERE attach_id = ' . (int) $this->attachment_data[$index]['attach_id']); + } + } + else + { + $attachment_manager->delete('attach', $this->attachment_data[$index]['attach_id']); + } + + unset($this->attachment_data[$index]); + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) use($index) { + return ($match[1] == $index) ? '' : (($match[1] > $index) ? '[attachment=' . ($match[1] - 1) . ']' . $match[2] . '[/attachment]' : $match[0]); + }, $this->message); + + // Reindex Array + $this->attachment_data = array_values($this->attachment_data); + if (isset($this->plupload) && $this->plupload->is_active()) + { + $json_response->send($this->attachment_data); + } + } + } + else if (($add_file || $preview) && $upload_file) + { + if ($num_attachments < $cfg['max_attachments'] || $auth->acl_gets('m_', 'a_', $forum_id)) + { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $filedata = $attachment_manager->upload($form_name, $forum_id, false, '', $is_message); + $error = array_merge($error, $filedata['error']); + + if (!count($error)) + { + $sql_ary = array( + 'physical_filename' => $filedata['physical_filename'], + 'attach_comment' => $this->filename_data['filecomment'], + 'real_filename' => $filedata['real_filename'], + 'extension' => $filedata['extension'], + 'mimetype' => $filedata['mimetype'], + 'filesize' => $filedata['filesize'], + 'filetime' => $filedata['filetime'], + 'thumbnail' => $filedata['thumbnail'], + 'is_orphan' => 1, + 'in_message' => ($is_message) ? 1 : 0, + 'poster_id' => $user->data['user_id'], + ); + + /** + * Modify attachment sql array on upload + * + * @event core.modify_attachment_sql_ary_on_upload + * @var array sql_ary Array containing SQL data + * @since 3.2.6-RC1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.modify_attachment_sql_ary_on_upload', compact($vars))); + + $db->sql_query('INSERT INTO ' . ATTACHMENTS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary)); + + $new_entry = array( + 'attach_id' => $db->sql_nextid(), + 'is_orphan' => 1, + 'real_filename' => $filedata['real_filename'], + 'attach_comment'=> $this->filename_data['filecomment'], + 'filesize' => $filedata['filesize'], + ); + + $this->attachment_data = array_merge(array(0 => $new_entry), $this->attachment_data); + + /** + * Modify attachment data on upload + * + * @event core.modify_attachment_data_on_upload + * @var array attachment_data Array containing attachment data + * @since 3.2.2-RC1 + */ + $attachment_data = $this->attachment_data; + $vars = array('attachment_data'); + extract($phpbb_dispatcher->trigger_event('core.modify_attachment_data_on_upload', compact($vars))); + $this->attachment_data = $attachment_data; + unset($attachment_data); + + $this->message = preg_replace_callback('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#', function ($match) { + return '[attachment=' . ($match[1] + 1) . ']' . $match[2] . '[/attachment]'; + }, $this->message); + $this->filename_data['filecomment'] = ''; + + if (isset($this->plupload) && $this->plupload->is_active()) + { + $download_url = append_sid("{$phpbb_root_path}download/file.{$phpEx}", 'mode=view&id=' . $new_entry['attach_id']); + + // Send the client the attachment data to maintain state + $json_response->send(array('data' => $this->attachment_data, 'download_url' => $download_url)); + } + } + } + else + { + $error[] = $user->lang('TOO_MANY_ATTACHMENTS', (int) $cfg['max_attachments']); + } + + if (!empty($error) && isset($this->plupload) && $this->plupload->is_active()) + { + // If this is a plupload (and thus ajax) request, give the + // client the first error we have + $json_response->send(array( + 'jsonrpc' => '2.0', + 'id' => 'id', + 'error' => array( + 'code' => 105, + 'message' => current($error), + ), + )); + } + } + } + + foreach ($error as $error_msg) + { + $this->warn_msg[] = $error_msg; + } + } + + /** + * Get Attachment Data + */ + function get_submitted_attachment_data($check_user_id = false) + { + global $user, $db; + global $request; + + $this->filename_data['filecomment'] = $request->variable('filecomment', '', true); + $attachment_data = $request->variable('attachment_data', array(0 => array('' => '')), true, \phpbb\request\request_interface::POST); + $this->attachment_data = array(); + + $check_user_id = ($check_user_id === false) ? $user->data['user_id'] : $check_user_id; + + if (!count($attachment_data)) + { + return; + } + + $not_orphan = $orphan = array(); + + foreach ($attachment_data as $pos => $var_ary) + { + if ($var_ary['is_orphan']) + { + $orphan[(int) $var_ary['attach_id']] = $pos; + } + else + { + $not_orphan[(int) $var_ary['attach_id']] = $pos; + } + } + + // Regenerate already posted attachments + if (count($not_orphan)) + { + // Get the attachment data, based on the poster id... + $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($not_orphan)) . ' + AND poster_id = ' . $check_user_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $pos = $not_orphan[$row['attach_id']]; + $this->attachment_data[$pos] = $row; + $this->attachment_data[$pos]['attach_comment'] = $attachment_data[$pos]['attach_comment']; + + unset($not_orphan[$row['attach_id']]); + } + $db->sql_freeresult($result); + } + + if (count($not_orphan)) + { + trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR); + } + + // Regenerate newly uploaded attachments + if (count($orphan)) + { + $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment, filesize + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('attach_id', array_keys($orphan)) . ' + AND poster_id = ' . $user->data['user_id'] . ' + AND is_orphan = 1'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $pos = $orphan[$row['attach_id']]; + $this->attachment_data[$pos] = $row; + $this->attachment_data[$pos]['attach_comment'] = $attachment_data[$pos]['attach_comment']; + + unset($orphan[$row['attach_id']]); + } + $db->sql_freeresult($result); + } + + if (count($orphan)) + { + trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR); + } + + ksort($this->attachment_data); + } + + /** + * Parse Poll + */ + function parse_poll(&$poll) + { + global $user, $config; + + $poll_max_options = $poll['poll_max_options']; + + // Parse Poll Option text + $tmp_message = $this->message; + + $poll['poll_options'] = preg_split('/\s*?\n\s*/', trim($poll['poll_option_text'])); + $poll['poll_options_size'] = count($poll['poll_options']); + + foreach ($poll['poll_options'] as &$poll_option) + { + $this->message = $poll_option; + $poll_option = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll'); + } + unset($poll_option); + $poll['poll_option_text'] = implode("\n", $poll['poll_options']); + + // Parse Poll Title + $this->message = $poll['poll_title']; + if (!$poll['poll_title'] && $poll['poll_options_size']) + { + $this->warn_msg[] = $user->lang['NO_POLL_TITLE']; + } + else + { + if (utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message)) > 100) + { + $this->warn_msg[] = $user->lang['POLL_TITLE_TOO_LONG']; + } + $poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll'); + if (strlen($poll['poll_title']) > 255) + { + $this->warn_msg[] = $user->lang['POLL_TITLE_COMP_TOO_LONG']; + } + } + + if (count($poll['poll_options']) == 1) + { + $this->warn_msg[] = $user->lang['TOO_FEW_POLL_OPTIONS']; + } + else if ($poll['poll_options_size'] > (int) $config['max_poll_options']) + { + $this->warn_msg[] = $user->lang['TOO_MANY_POLL_OPTIONS']; + } + else if ($poll_max_options > $poll['poll_options_size']) + { + $this->warn_msg[] = $user->lang['TOO_MANY_USER_OPTIONS']; + } + + $poll['poll_max_options'] = ($poll['poll_max_options'] < 1) ? 1 : (($poll['poll_max_options'] > $config['max_poll_options']) ? $config['max_poll_options'] : $poll['poll_max_options']); + + $this->message = $tmp_message; + } + + /** + * Remove nested quotes at given depth in current parsed message + * + * @param integer $max_depth Depth limit + * @return null + */ + public function remove_nested_quotes($max_depth) + { + global $phpbb_container; + + if (preg_match('#^<[rt][ >]#', $this->message)) + { + $this->message = $phpbb_container->get('text_formatter.utils')->remove_bbcode( + $this->message, + 'quote', + $max_depth + ); + + return; + } + + // Capture all [quote] and [/quote] tags + preg_match_all('(\\[/?quote(?:="(.*?)")?:' . $this->bbcode_uid . '\\])', $this->message, $matches, PREG_OFFSET_CAPTURE); + + // Iterate over the quote tags to mark the ranges that must be removed + $depth = 0; + $ranges = array(); + $start_pos = 0; + foreach ($matches[0] as $match) + { + if ($match[0][1] === '/') + { + --$depth; + if ($depth == $max_depth) + { + $end_pos = $match[1] + strlen($match[0]); + $length = $end_pos - $start_pos; + $ranges[] = array($start_pos, $length); + } + } + else + { + ++$depth; + if ($depth == $max_depth + 1) + { + $start_pos = $match[1]; + } + } + } + + foreach (array_reverse($ranges) as $range) + { + list($start_pos, $length) = $range; + $this->message = substr_replace($this->message, '', $start_pos, $length); + } + } + + /** + * Setter function for passing the plupload object + * + * @param \phpbb\plupload\plupload $plupload The plupload object + * + * @return null + */ + public function set_plupload(\phpbb\plupload\plupload $plupload) + { + $this->plupload = $plupload; + } + + /** + * Function to perform custom bbcode validation by extensions + * can be used in bbcode_init() to assign regexp replacement + * Example: 'regexp' => array('#\[b\](.*?)\[/b\]#uise' => "\$this->validate_bbcode_by_extension('\$1')") + * + * Accepts variable number of parameters + * + * @return mixed Validation result + */ + public function validate_bbcode_by_extension() + { + global $phpbb_dispatcher; + + $return = false; + $params_array = func_get_args(); + + /** + * Event to validate bbcode with the custom validating methods + * provided by extensions + * + * @event core.validate_bbcode_by_extension + * @var array params_array Array with the function parameters + * @var mixed return Validation result to return + * + * @since 3.1.5-RC1 + */ + $vars = array('params_array', 'return'); + extract($phpbb_dispatcher->trigger_event('core.validate_bbcode_by_extension', compact($vars))); + + return $return; + } +} diff --git a/install/update/old/includes/questionnaire/questionnaire.php b/install/update/old/includes/questionnaire/questionnaire.php new file mode 100644 index 0000000..2f80582 --- /dev/null +++ b/install/update/old/includes/questionnaire/questionnaire.php @@ -0,0 +1,501 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* This class collects data which is used to create some usage statistics. +* +* The collected data is - after authorization of the administrator - submitted +* to a central server. For privacy reasons we try to collect only data which aren't private +* or don't give any information which might help to identify the user. +* +* @author Johannes Schlueter +* @copyright (c) 2007-2008 Johannes Schlueter +*/ +class phpbb_questionnaire_data_collector +{ + var $providers; + var $data = null; + var $install_id = ''; + + /** + * Constructor. + * + * @param string + */ + function __construct($install_id) + { + $this->install_id = $install_id; + $this->providers = array(); + } + + function add_data_provider($provider) + { + $this->providers[] = $provider; + } + + /** + * Get data as an array. + * + * @return array All Data + */ + function get_data_raw() + { + if (!$this->data) + { + $this->collect(); + } + + return $this->data; + } + + function get_data_for_form() + { + return base64_encode(serialize($this->get_data_raw())); + } + + /** + * Collect info into the data property. + * + * @return null + */ + function collect() + { + foreach (array_keys($this->providers) as $key) + { + $provider = $this->providers[$key]; + $this->data[$provider->get_identifier()] = $provider->get_data(); + } + $this->data['install_id'] = $this->install_id; + } +} + +/** interface: get_indentifier(), get_data() */ + +/** +* Questionnaire PHP data provider +*/ +class phpbb_questionnaire_php_data_provider +{ + function get_identifier() + { + return 'PHP'; + } + + /** + * Get data about the PHP runtime setup. + * + * @return array + */ + function get_data() + { + return array( + 'version' => PHP_VERSION, + 'sapi' => PHP_SAPI, + 'int_size' => defined('PHP_INT_SIZE') ? PHP_INT_SIZE : '', + 'safe_mode' => (int) @ini_get('safe_mode'), + 'open_basedir' => (int) @ini_get('open_basedir'), + 'memory_limit' => @ini_get('memory_limit'), + 'allow_url_fopen' => (int) @ini_get('allow_url_fopen'), + 'allow_url_include' => (int) @ini_get('allow_url_include'), + 'file_uploads' => (int) @ini_get('file_uploads'), + 'upload_max_filesize' => @ini_get('upload_max_filesize'), + 'post_max_size' => @ini_get('post_max_size'), + 'disable_functions' => @ini_get('disable_functions'), + 'disable_classes' => @ini_get('disable_classes'), + 'enable_dl' => (int) @ini_get('enable_dl'), + 'magic_quotes_gpc' => (int) @ini_get('magic_quotes_gpc'), + 'register_globals' => (int) @ini_get('register_globals'), + 'filter.default' => @ini_get('filter.default'), + 'zend.ze1_compatibility_mode' => (int) @ini_get('zend.ze1_compatibility_mode'), + 'unicode.semantics' => (int) @ini_get('unicode.semantics'), + 'zend_thread_safty' => (int) function_exists('zend_thread_id'), + 'extensions' => get_loaded_extensions(), + ); + } +} + +/** +* Questionnaire System data provider +*/ +class phpbb_questionnaire_system_data_provider +{ + function get_identifier() + { + return 'System'; + } + + /** + * Get data about the general system information, like OS or IP (shortened). + * + * @return array + */ + function get_data() + { + global $request; + + // Start discovering the IPV4 server address, if available + // Try apache, IIS, fall back to 0.0.0.0 + $server_address = htmlspecialchars_decode($request->server('SERVER_ADDR', $request->server('LOCAL_ADDR', '0.0.0.0'))); + + return array( + 'os' => PHP_OS, + 'httpd' => htmlspecialchars_decode($request->server('SERVER_SOFTWARE')), + // we don't want the real IP address (for privacy policy reasons) but only + // a network address to see whether your installation is running on a private or public network. + 'private_ip' => $this->is_private_ip($server_address), + 'ipv6' => strpos($server_address, ':') !== false, + ); + } + + /** + * Checks whether the given IP is in a private network. + * + * @param string $ip IP in v4 dot-decimal or v6 hex format + * @return bool true if the IP is from a private network, else false + */ + function is_private_ip($ip) + { + // IPv4 + if (strpos($ip, ':') === false) + { + $ip_address_ary = explode('.', $ip); + + // build ip + if (!isset($ip_address_ary[0]) || !isset($ip_address_ary[1])) + { + $ip_address_ary = explode('.', '0.0.0.0'); + } + + // IANA reserved addresses for private networks (RFC 1918) are: + // - 10.0.0.0/8 + // - 172.16.0.0/12 + // - 192.168.0.0/16 + if ($ip_address_ary[0] == '10' || + ($ip_address_ary[0] == '172' && intval($ip_address_ary[1]) > 15 && intval($ip_address_ary[1]) < 32) || + ($ip_address_ary[0] == '192' && $ip_address_ary[1] == '168')) + { + return true; + } + } + // IPv6 + else + { + // unique local unicast + $prefix = substr($ip, 0, 2); + if ($prefix == 'fc' || $prefix == 'fd') + { + return true; + } + } + + return false; + } +} + +/** +* Questionnaire phpBB data provider +*/ +class phpbb_questionnaire_phpbb_data_provider +{ + var $config; + var $unique_id; + + /** + * Constructor. + * + * @param array $config + */ + function __construct($config) + { + // generate a unique id if necessary + if (empty($config['questionnaire_unique_id'])) + { + $this->unique_id = unique_id(); + $config->set('questionnaire_unique_id', $this->unique_id); + } + else + { + $this->unique_id = $config['questionnaire_unique_id']; + } + + $this->config = $config; + } + + /** + * Returns a string identifier for this data provider + * + * @return string "phpBB" + */ + function get_identifier() + { + return 'phpBB'; + } + + /** + * Get data about this phpBB installation. + * + * @return array Relevant anonymous config options + */ + function get_data() + { + global $phpbb_config_php_file; + + extract($phpbb_config_php_file->get_all()); + unset($dbhost, $dbport, $dbname, $dbuser, $dbpasswd); // Just a precaution + + $dbms = $phpbb_config_php_file->convert_30_dbms_to_31($dbms); + + // Only send certain config vars + $config_vars = array( + 'active_sessions' => true, + 'allow_attachments' => true, + 'allow_autologin' => true, + 'allow_avatar' => true, + 'allow_avatar_local' => true, + 'allow_avatar_remote' => true, + 'allow_avatar_upload' => true, + 'allow_bbcode' => true, + 'allow_birthdays' => true, + 'allow_bookmarks' => true, + 'allow_emailreuse' => true, + 'allow_forum_notify' => true, + 'allow_mass_pm' => true, + 'allow_name_chars' => true, + 'allow_namechange' => true, + 'allow_nocensors' => true, + 'allow_pm_attach' => true, + 'allow_pm_report' => true, + 'allow_post_flash' => true, + 'allow_post_links' => true, + 'allow_privmsg' => true, + 'allow_quick_reply' => true, + 'allow_sig' => true, + 'allow_sig_bbcode' => true, + 'allow_sig_flash' => true, + 'allow_sig_img' => true, + 'allow_sig_links' => true, + 'allow_sig_pm' => true, + 'allow_sig_smilies' => true, + 'allow_smilies' => true, + 'allow_topic_notify' => true, + 'attachment_quota' => true, + 'auth_bbcode_pm' => true, + 'auth_flash_pm' => true, + 'auth_img_pm' => true, + 'auth_method' => true, + 'auth_smilies_pm' => true, + 'avatar_filesize' => true, + 'avatar_max_height' => true, + 'avatar_max_width' => true, + 'avatar_min_height' => true, + 'avatar_min_width' => true, + 'board_email_form' => true, + 'board_hide_emails' => true, + 'board_timezone' => true, + 'browser_check' => true, + 'bump_interval' => true, + 'bump_type' => true, + 'cache_gc' => true, + 'captcha_plugin' => true, + 'captcha_gd' => true, + 'captcha_gd_foreground_noise' => true, + 'captcha_gd_x_grid' => true, + 'captcha_gd_y_grid' => true, + 'captcha_gd_wave' => true, + 'captcha_gd_3d_noise' => true, + 'captcha_gd_fonts' => true, + 'confirm_refresh' => true, + 'check_attachment_content' => true, + 'check_dnsbl' => true, + 'chg_passforce' => true, + 'cookie_secure' => true, + 'coppa_enable' => true, + 'database_gc' => true, + 'dbms_version' => true, + 'default_dateformat' => true, + 'default_lang' => true, + 'display_last_edited' => true, + 'display_order' => true, + 'edit_time' => true, + 'email_check_mx' => true, + 'email_enable' => true, + 'email_force_sender' => true, + 'email_package_size' => true, + 'enable_confirm' => true, + 'enable_pm_icons' => true, + 'enable_post_confirm' => true, + 'feed_enable' => true, + 'feed_http_auth' => true, + 'feed_limit_post' => true, + 'feed_limit_topic' => true, + 'feed_overall' => true, + 'feed_overall_forums' => true, + 'feed_forum' => true, + 'feed_topic' => true, + 'feed_topics_new' => true, + 'feed_topics_active' => true, + 'feed_item_statistics' => true, + 'flood_interval' => true, + 'force_server_vars' => true, + 'form_token_lifetime' => true, + 'form_token_mintime' => true, + 'form_token_sid_guests' => true, + 'forward_pm' => true, + 'forwarded_for_check' => true, + 'full_folder_action' => true, + 'fulltext_native_common_thres' => true, + 'fulltext_native_load_upd' => true, + 'fulltext_native_max_chars' => true, + 'fulltext_native_min_chars' => true, + 'gzip_compress' => true, + 'hot_threshold' => true, + 'img_create_thumbnail' => true, + 'img_display_inlined' => true, + 'img_link_height' => true, + 'img_link_width' => true, + 'img_max_height' => true, + 'img_max_thumb_width' => true, + 'img_max_width' => true, + 'img_min_thumb_filesize' => true, + 'ip_check' => true, + 'jab_enable' => true, + 'jab_package_size' => true, + 'jab_use_ssl' => true, + 'limit_load' => true, + 'limit_search_load' => true, + 'load_anon_lastread' => true, + 'load_birthdays' => true, + 'load_cpf_memberlist' => true, + 'load_cpf_viewprofile' => true, + 'load_cpf_viewtopic' => true, + 'load_db_lastread' => true, + 'load_db_track' => true, + 'load_jumpbox' => true, + 'load_moderators' => true, + 'load_online' => true, + 'load_online_guests' => true, + 'load_online_time' => true, + 'load_onlinetrack' => true, + 'load_search' => true, + 'load_tplcompile' => true, + 'load_user_activity' => true, + 'max_attachments' => true, + 'max_attachments_pm' => true, + 'max_autologin_time' => true, + 'max_filesize' => true, + 'max_filesize_pm' => true, + 'max_login_attempts' => true, + 'max_name_chars' => true, + 'max_num_search_keywords' => true, + 'max_pass_chars' => true, + 'max_poll_options' => true, + 'max_post_chars' => true, + 'max_post_font_size' => true, + 'max_post_img_height' => true, + 'max_post_img_width' => true, + 'max_post_smilies' => true, + 'max_post_urls' => true, + 'max_quote_depth' => true, + 'max_reg_attempts' => true, + 'max_sig_chars' => true, + 'max_sig_font_size' => true, + 'max_sig_img_height' => true, + 'max_sig_img_width' => true, + 'max_sig_smilies' => true, + 'max_sig_urls' => true, + 'min_name_chars' => true, + 'min_pass_chars' => true, + 'min_post_chars' => true, + 'min_search_author_chars' => true, + 'mime_triggers' => true, + 'new_member_post_limit' => true, + 'new_member_group_default' => true, + 'override_user_style' => true, + 'pass_complex' => true, + 'pm_edit_time' => true, + 'pm_max_boxes' => true, + 'pm_max_msgs' => true, + 'pm_max_recipients' => true, + 'posts_per_page' => true, + 'print_pm' => true, + 'queue_interval' => true, + 'require_activation' => true, + 'referer_validation' => true, + 'search_block_size' => true, + 'search_gc' => true, + 'search_interval' => true, + 'search_anonymous_interval' => true, + 'search_type' => true, + 'search_store_results' => true, + 'secure_allow_deny' => true, + 'secure_allow_empty_referer' => true, + 'secure_downloads' => true, + 'session_gc' => true, + 'session_length' => true, + 'smtp_auth_method' => true, + 'smtp_delivery' => true, + 'topics_per_page' => true, + 'tpl_allow_php' => true, + 'version' => true, + 'warnings_expire_days' => true, + 'warnings_gc' => true, + + 'num_files' => true, + 'num_posts' => true, + 'num_topics' => true, + 'num_users' => true, + 'record_online_users' => true, + ); + + $result = array(); + foreach ($config_vars as $name => $void) + { + if (isset($this->config[$name])) + { + $result['config_' . $name] = $this->config[$name]; + } + } + + global $db, $request; + + $result['dbms'] = $dbms; + $result['acm_type'] = $acm_type; + $result['user_agent'] = 'Unknown'; + $result['dbms_version'] = $db->sql_server_info(true); + + // Try to get user agent vendor and version + $match = array(); + $user_agent = $request->header('User-Agent'); + $agents = array('firefox', 'msie', 'opera', 'chrome', 'safari', 'mozilla', 'seamonkey', 'konqueror', 'netscape', 'gecko', 'navigator', 'mosaic', 'lynx', 'amaya', 'omniweb', 'avant', 'camino', 'flock', 'aol'); + + // We check here 1 by 1 because some strings occur after others (for example Mozilla [...] Firefox/) + foreach ($agents as $agent) + { + if (preg_match('#(' . $agent . ')[/ ]?([0-9.]*)#i', $user_agent, $match)) + { + $result['user_agent'] = $match[1] . ' ' . $match[2]; + break; + } + } + + return $result; + } +} diff --git a/install/update/old/includes/startup.php b/install/update/old/includes/startup.php new file mode 100644 index 0000000..66f8565 --- /dev/null +++ b/install/update/old/includes/startup.php @@ -0,0 +1,86 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +// Report all errors, except notices and deprecation messages +$level = E_ALL & ~E_NOTICE & ~E_DEPRECATED; +error_reporting($level); + +/** +* Minimum Requirement: PHP 5.4.0 +*/ +if (version_compare(PHP_VERSION, '5.4') < 0) +{ + die('You are running an unsupported PHP version. Please upgrade to PHP 5.4.0 or higher before trying to install or update to phpBB 3.2'); +} +// Register globals and magic quotes have been dropped in PHP 5.4 so no need for extra checks + + +// In PHP 5.3.0 the error level has been raised to E_WARNING which causes problems +// because we show E_WARNING errors and do not set a default timezone. +// This is because we have our own timezone handling and work in UTC only anyway. + +// So what we basically want to do is set our timezone to UTC, +// but we don't know what other scripts (such as bridges) are involved, +// so we check whether a timezone is already set by calling date_default_timezone_get(). + +// Unfortunately, date_default_timezone_get() itself might throw E_WARNING +// if no timezone has been set, so we have to keep it quiet with @. + +// date_default_timezone_get() tries to guess the correct timezone first +// and then falls back to UTC when everything fails. +// We just set the timezone to whatever date_default_timezone_get() returns. +date_default_timezone_set(@date_default_timezone_get()); + +// Autoloading of dependencies. +// Three options are supported: +// 1. If dependencies are installed with Composer, Composer will create a +// vendor/autoload.php. If this file exists it will be +// automatically used by phpBB. This is the default mode that phpBB +// will use when shipped. +// 2. To disable composer autoloading, PHPBB_NO_COMPOSER_AUTOLOAD can be specified. +// Additionally specify PHPBB_AUTOLOAD=/path/to/autoload.php in the +// environment. This is useful for running CLI scripts and tests. +// /path/to/autoload.php should define and register class loaders +// for all of phpBB's dependencies. +// 3. You can also set PHPBB_NO_COMPOSER_AUTOLOAD without setting PHPBB_AUTOLOAD. +// In this case autoloading needs to be defined before running any phpBB +// script. This might be useful in cases when phpBB is integrated into a +// larger program. +if (getenv('PHPBB_NO_COMPOSER_AUTOLOAD')) +{ + if (getenv('PHPBB_AUTOLOAD')) + { + require(getenv('PHPBB_AUTOLOAD')); + } +} +else +{ + if (!file_exists($phpbb_root_path . 'vendor/autoload.php')) + { + trigger_error( + 'Composer dependencies have not been set up yet, run ' . + "'php ../composer.phar install' from the phpBB directory to do so.", + E_USER_ERROR + ); + } + require($phpbb_root_path . 'vendor/autoload.php'); +} + +$starttime = microtime(true); diff --git a/install/update/old/includes/ucp/ucp_attachments.php b/install/update/old/includes/ucp/ucp_attachments.php new file mode 100644 index 0000000..c1b623c --- /dev/null +++ b/install/update/old/includes/ucp/ucp_attachments.php @@ -0,0 +1,205 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ucp_attachments +* User attachments +*/ +class ucp_attachments +{ + var $u_action; + + function main($id, $mode) + { + global $template, $user, $db, $config, $phpEx, $phpbb_root_path, $phpbb_container, $request; + + $start = $request->variable('start', 0); + $sort_key = $request->variable('sk', 'a'); + $sort_dir = $request->variable('sd', 'a'); + + $delete = (isset($_POST['delete'])) ? true : false; + $delete_ids = array_keys($request->variable('attachment', array(0))); + + if ($delete && count($delete_ids)) + { + // Validate $delete_ids... + $sql = 'SELECT attach_id + FROM ' . ATTACHMENTS_TABLE . ' + WHERE poster_id = ' . $user->data['user_id'] . ' + AND is_orphan = 0 + AND ' . $db->sql_in_set('attach_id', $delete_ids); + $result = $db->sql_query($sql); + + $delete_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $delete_ids[] = $row['attach_id']; + } + $db->sql_freeresult($result); + } + + if ($delete && count($delete_ids)) + { + $s_hidden_fields = array( + 'delete' => 1 + ); + + foreach ($delete_ids as $attachment_id) + { + $s_hidden_fields['attachment'][$attachment_id] = 1; + } + + if (confirm_box(true)) + { + /** @var \phpbb\attachment\manager $attachment_manager */ + $attachment_manager = $phpbb_container->get('attachment.manager'); + $attachment_manager->delete('attach', $delete_ids); + unset($attachment_manager); + + meta_refresh(3, $this->u_action); + $message = ((count($delete_ids) == 1) ? $user->lang['ATTACHMENT_DELETED'] : $user->lang['ATTACHMENTS_DELETED']) . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + else + { + confirm_box(false, (count($delete_ids) == 1) ? 'DELETE_ATTACHMENT' : 'DELETE_ATTACHMENTS', build_hidden_fields($s_hidden_fields)); + } + } + + // Select box eventually + $sort_key_text = array('a' => $user->lang['SORT_FILENAME'], 'b' => $user->lang['SORT_COMMENT'], 'c' => $user->lang['SORT_EXTENSION'], 'd' => $user->lang['SORT_SIZE'], 'e' => $user->lang['SORT_DOWNLOADS'], 'f' => $user->lang['SORT_POST_TIME'], 'g' => $user->lang['SORT_TOPIC_TITLE']); + $sort_key_sql = array('a' => 'a.real_filename', 'b' => 'a.attach_comment', 'c' => 'a.extension', 'd' => 'a.filesize', 'e' => 'a.download_count', 'f' => 'a.filetime', 'g' => 't.topic_title'); + + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + $s_sort_key = ''; + foreach ($sort_key_text as $key => $value) + { + $selected = ($sort_key == $key) ? ' selected="selected"' : ''; + $s_sort_key .= ''; + } + + $s_sort_dir = ''; + foreach ($sort_dir_text as $key => $value) + { + $selected = ($sort_dir == $key) ? ' selected="selected"' : ''; + $s_sort_dir .= ''; + } + + if (!isset($sort_key_sql[$sort_key])) + { + $sort_key = 'a'; + } + + $order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); + + $sql = 'SELECT COUNT(attach_id) as num_attachments + FROM ' . ATTACHMENTS_TABLE . ' + WHERE poster_id = ' . $user->data['user_id'] . ' + AND is_orphan = 0'; + $result = $db->sql_query($sql); + $num_attachments = $db->sql_fetchfield('num_attachments'); + $db->sql_freeresult($result); + + // Ensure start is a valid value + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $start = $pagination->validate_start($start, $config['topics_per_page'], $num_attachments); + + $sql = 'SELECT a.*, t.topic_title, p.message_subject as message_title + FROM ' . ATTACHMENTS_TABLE . ' a + LEFT JOIN ' . TOPICS_TABLE . ' t ON (a.topic_id = t.topic_id AND a.in_message = 0) + LEFT JOIN ' . PRIVMSGS_TABLE . ' p ON (a.post_msg_id = p.msg_id AND a.in_message = 1) + WHERE a.poster_id = ' . $user->data['user_id'] . " + AND a.is_orphan = 0 + ORDER BY $order_by"; + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + + $row_count = 0; + if ($row = $db->sql_fetchrow($result)) + { + $template->assign_var('S_ATTACHMENT_ROWS', true); + + do + { + if ($row['in_message']) + { + $view_topic = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&p={$row['post_msg_id']}"); + } + else + { + $view_topic = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t={$row['topic_id']}&p={$row['post_msg_id']}") . "#p{$row['post_msg_id']}"; + } + + $template->assign_block_vars('attachrow', array( + 'ROW_NUMBER' => $row_count + ($start + 1), + 'FILENAME' => $row['real_filename'], + 'COMMENT' => bbcode_nl2br($row['attach_comment']), + 'EXTENSION' => $row['extension'], + 'SIZE' => get_formatted_filesize($row['filesize']), + 'DOWNLOAD_COUNT' => $row['download_count'], + 'POST_TIME' => $user->format_date($row['filetime']), + 'TOPIC_TITLE' => ($row['in_message']) ? $row['message_title'] : $row['topic_title'], + + 'ATTACH_ID' => $row['attach_id'], + 'POST_ID' => $row['post_msg_id'], + 'TOPIC_ID' => $row['topic_id'], + + 'S_IN_MESSAGE' => $row['in_message'], + + 'U_VIEW_ATTACHMENT' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'id=' . $row['attach_id']), + 'U_VIEW_TOPIC' => $view_topic) + ); + + $row_count++; + } + while ($row = $db->sql_fetchrow($result)); + } + $db->sql_freeresult($result); + + $base_url = $this->u_action . "&sk=$sort_key&sd=$sort_dir"; + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $num_attachments, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'TOTAL_ATTACHMENTS' => $num_attachments, + 'NUM_ATTACHMENTS' => $user->lang('NUM_ATTACHMENTS', $num_attachments), + + 'L_TITLE' => $user->lang['UCP_ATTACHMENTS'], + + 'U_SORT_FILENAME' => $this->u_action . "&sk=a&sd=" . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_FILE_COMMENT' => $this->u_action . "&sk=b&sd=" . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_EXTENSION' => $this->u_action . "&sk=c&sd=" . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_FILESIZE' => $this->u_action . "&sk=d&sd=" . (($sort_key == 'd' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_DOWNLOADS' => $this->u_action . "&sk=e&sd=" . (($sort_key == 'e' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_POST_TIME' => $this->u_action . "&sk=f&sd=" . (($sort_key == 'f' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_TOPIC_TITLE' => $this->u_action . "&sk=g&sd=" . (($sort_key == 'g' && $sort_dir == 'a') ? 'd' : 'a'), + + 'S_DISPLAY_MARK_ALL' => ($num_attachments) ? true : false, + 'S_DISPLAY_PAGINATION' => ($num_attachments) ? true : false, + 'S_UCP_ACTION' => $this->u_action, + 'S_SORT_OPTIONS' => $s_sort_key, + 'S_ORDER_SELECT' => $s_sort_dir) + ); + + $this->tpl_name = 'ucp_attachments'; + $this->page_title = 'UCP_ATTACHMENTS'; + } +} diff --git a/install/update/old/includes/ucp/ucp_groups.php b/install/update/old/includes/ucp/ucp_groups.php new file mode 100644 index 0000000..2423af8 --- /dev/null +++ b/install/update/old/includes/ucp/ucp_groups.php @@ -0,0 +1,1137 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ucp_groups +*/ +class ucp_groups +{ + var $u_action; + + function main($id, $mode) + { + global $config, $phpbb_root_path, $phpEx, $phpbb_admin_path; + global $db, $user, $auth, $cache, $template; + global $request, $phpbb_container, $phpbb_log; + + /** @var \phpbb\language\language $language Language object */ + $language = $phpbb_container->get('language'); + + $user->add_lang('groups'); + + $return_page = '

' . sprintf($user->lang['RETURN_PAGE'], '', ''); + + $mark_ary = $request->variable('mark', array(0)); + $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + switch ($mode) + { + case 'membership': + + $this->page_title = 'UCP_USERGROUPS_MEMBER'; + + if ($submit || isset($_POST['change_default'])) + { + $action = (isset($_POST['change_default'])) ? 'change_default' : $request->variable('action', ''); + $group_id = ($action == 'change_default') ? $request->variable('default', 0) : $request->variable('selected', 0); + + if (!$group_id) + { + trigger_error('NO_GROUP_SELECTED'); + } + + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE . " + WHERE group_id IN ($group_id, {$user->data['group_id']})"; + $result = $db->sql_query($sql); + + $group_row = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['group_name'] = $group_helper->get_name($row['group_name']); + $group_row[$row['group_id']] = $row; + } + $db->sql_freeresult($result); + + if (!count($group_row)) + { + trigger_error('GROUP_NOT_EXIST'); + } + + switch ($action) + { + case 'change_default': + // User already having this group set as default? + if ($group_id == $user->data['group_id']) + { + trigger_error($user->lang['ALREADY_DEFAULT_GROUP'] . $return_page); + } + + if (!$auth->acl_get('u_chggrp')) + { + send_status_line(403, 'Forbidden'); + trigger_error($user->lang['NOT_AUTHORISED'] . $return_page); + } + + // User needs to be member of the group in order to make it default + if (!group_memberships($group_id, $user->data['user_id'], true)) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + + if (confirm_box(true)) + { + group_user_attributes('default', $group_id, $user->data['user_id']); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_CHANGE', false, array( + 'reportee_id' => $user->data['user_id'], + sprintf($user->lang['USER_GROUP_CHANGE'], $group_row[$user->data['group_id']]['group_name'], $group_row[$group_id]['group_name']) + )); + + meta_refresh(3, $this->u_action); + trigger_error($user->lang['CHANGED_DEFAULT_GROUP'] . $return_page); + } + else + { + $s_hidden_fields = array( + 'default' => $group_id, + 'change_default'=> true + ); + + confirm_box(false, sprintf($user->lang['GROUP_CHANGE_DEFAULT'], $group_row[$group_id]['group_name']), build_hidden_fields($s_hidden_fields)); + } + + break; + + case 'resign': + + // User tries to resign from default group but is not allowed to change it? + if ($group_id == $user->data['group_id'] && !$auth->acl_get('u_chggrp')) + { + trigger_error($user->lang['NOT_RESIGN_FROM_DEFAULT_GROUP'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + list(, $row) = each($row); + + $sql = 'SELECT group_type + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . $group_id; + $result = $db->sql_query($sql); + $group_type = (int) $db->sql_fetchfield('group_type'); + $db->sql_freeresult($result); + + if ($group_type != GROUP_OPEN && $group_type != GROUP_FREE) + { + trigger_error($user->lang['CANNOT_RESIGN_GROUP'] . $return_page); + } + + if (confirm_box(true)) + { + group_user_del($group_id, $user->data['user_id']); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_RESIGN', false, array( + 'reportee_id' => $user->data['user_id'], + $group_row[$group_id]['group_name'] + )); + + meta_refresh(3, $this->u_action); + trigger_error($user->lang[($row['user_pending']) ? 'GROUP_RESIGNED_PENDING' : 'GROUP_RESIGNED_MEMBERSHIP'] . $return_page); + } + else + { + $s_hidden_fields = array( + 'selected' => $group_id, + 'action' => 'resign', + 'submit' => true + ); + + confirm_box(false, ($row['user_pending']) ? 'GROUP_RESIGN_PENDING' : 'GROUP_RESIGN_MEMBERSHIP', build_hidden_fields($s_hidden_fields)); + } + + break; + + case 'join': + + $sql = 'SELECT ug.*, u.username, u.username_clean, u.user_email + FROM ' . USER_GROUP_TABLE . ' ug, ' . USERS_TABLE . ' u + WHERE ug.user_id = u.user_id + AND ug.group_id = ' . $group_id . ' + AND ug.user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + if ($row['user_pending']) + { + trigger_error($user->lang['ALREADY_IN_GROUP_PENDING'] . $return_page); + } + + trigger_error($user->lang['ALREADY_IN_GROUP'] . $return_page); + } + + // Check permission to join (open group or request) + if ($group_row[$group_id]['group_type'] != GROUP_OPEN && $group_row[$group_id]['group_type'] != GROUP_FREE) + { + trigger_error($user->lang['CANNOT_JOIN_GROUP'] . $return_page); + } + + if (confirm_box(true)) + { + if ($group_row[$group_id]['group_type'] == GROUP_FREE) + { + group_user_add($group_id, $user->data['user_id']); + } + else + { + group_user_add($group_id, $user->data['user_id'], false, false, false, 0, 1); + } + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_JOIN' . (($group_row[$group_id]['group_type'] == GROUP_FREE) ? '' : '_PENDING'), false, array( + 'reportee_id' => $user->data['user_id'], + $group_row[$group_id]['group_name'] + )); + + meta_refresh(3, $this->u_action); + trigger_error($user->lang[($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOINED' : 'GROUP_JOINED_PENDING'] . $return_page); + } + else + { + $s_hidden_fields = array( + 'selected' => $group_id, + 'action' => 'join', + 'submit' => true + ); + + confirm_box(false, ($group_row[$group_id]['group_type'] == GROUP_FREE) ? 'GROUP_JOIN' : 'GROUP_JOIN_PENDING', build_hidden_fields($s_hidden_fields)); + } + + break; + + case 'demote': + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + list(, $row) = each($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + if (confirm_box(true)) + { + group_user_attributes('demote', $group_id, $user->data['user_id']); + + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_GROUP_DEMOTE', false, array( + 'reportee_id' => $user->data['user_id'], + $group_row[$group_id]['group_name'] + )); + + meta_refresh(3, $this->u_action); + trigger_error($user->lang['USER_GROUP_DEMOTED'] . $return_page); + } + else + { + $s_hidden_fields = array( + 'selected' => $group_id, + 'action' => 'demote', + 'submit' => true + ); + + confirm_box(false, 'USER_GROUP_DEMOTE', build_hidden_fields($s_hidden_fields)); + } + + break; + } + } + + $sql = 'SELECT g.*, ug.group_leader, ug.user_pending + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE ug.user_id = ' . $user->data['user_id'] . ' + AND g.group_id = ug.group_id + ORDER BY g.group_type DESC, g.group_name'; + $result = $db->sql_query($sql); + + $group_id_ary = array(); + $leader_count = $member_count = $pending_count = 0; + while ($row = $db->sql_fetchrow($result)) + { + $block = ($row['group_leader']) ? 'leader' : (($row['user_pending']) ? 'pending' : 'member'); + + switch ($row['group_type']) + { + case GROUP_OPEN: + $group_status = 'OPEN'; + break; + + case GROUP_CLOSED: + $group_status = 'CLOSED'; + break; + + case GROUP_HIDDEN: + $group_status = 'HIDDEN'; + break; + + case GROUP_SPECIAL: + $group_status = 'SPECIAL'; + break; + + case GROUP_FREE: + $group_status = 'FREE'; + break; + } + + $template->assign_block_vars($block, array( + 'GROUP_ID' => $row['group_id'], + 'GROUP_NAME' => $group_helper->get_name($row['group_name']), + 'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'], + 'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true, + 'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status], + 'GROUP_COLOUR' => $row['group_colour'], + + 'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']), + + 'S_GROUP_DEFAULT' => ($row['group_id'] == $user->data['group_id']) ? true : false, + 'S_ROW_COUNT' => ${$block . '_count'}++) + ); + + $group_id_ary[] = (int) $row['group_id']; + } + $db->sql_freeresult($result); + + // Hide hidden groups unless user is an admin with group privileges + $sql_and = ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? '<> ' . GROUP_SPECIAL : 'NOT IN (' . GROUP_SPECIAL . ', ' . GROUP_HIDDEN . ')'; + + $sql = 'SELECT group_id, group_name, group_colour, group_desc, group_desc_uid, group_desc_bitfield, group_desc_options, group_type, group_founder_manage + FROM ' . GROUPS_TABLE . ' + WHERE ' . ((count($group_id_ary)) ? $db->sql_in_set('group_id', $group_id_ary, true) . ' AND ' : '') . " + group_type $sql_and + ORDER BY group_type DESC, group_name"; + $result = $db->sql_query($sql); + + $nonmember_count = 0; + while ($row = $db->sql_fetchrow($result)) + { + switch ($row['group_type']) + { + case GROUP_OPEN: + $group_status = 'OPEN'; + break; + + case GROUP_CLOSED: + $group_status = 'CLOSED'; + break; + + case GROUP_HIDDEN: + $group_status = 'HIDDEN'; + break; + + case GROUP_SPECIAL: + $group_status = 'SPECIAL'; + break; + + case GROUP_FREE: + $group_status = 'FREE'; + break; + } + + $template->assign_block_vars('nonmember', array( + 'GROUP_ID' => $row['group_id'], + 'GROUP_NAME' => $group_helper->get_name($row['group_name']), + 'GROUP_DESC' => ($row['group_type'] <> GROUP_SPECIAL) ? generate_text_for_display($row['group_desc'], $row['group_desc_uid'], $row['group_desc_bitfield'], $row['group_desc_options']) : $user->lang['GROUP_IS_SPECIAL'], + 'GROUP_SPECIAL' => ($row['group_type'] <> GROUP_SPECIAL) ? false : true, + 'GROUP_CLOSED' => ($row['group_type'] <> GROUP_CLOSED || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? false : true, + 'GROUP_STATUS' => $user->lang['GROUP_IS_' . $group_status], + 'S_CAN_JOIN' => ($row['group_type'] == GROUP_OPEN || $row['group_type'] == GROUP_FREE) ? true : false, + 'GROUP_COLOUR' => $row['group_colour'], + + 'U_VIEW_GROUP' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']), + + 'S_ROW_COUNT' => $nonmember_count++) + ); + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_CHANGE_DEFAULT' => ($auth->acl_get('u_chggrp')) ? true : false, + 'S_LEADER_COUNT' => $leader_count, + 'S_MEMBER_COUNT' => $member_count, + 'S_PENDING_COUNT' => $pending_count, + 'S_NONMEMBER_COUNT' => $nonmember_count, + + 'S_UCP_ACTION' => $this->u_action) + ); + + break; + + case 'manage': + + $this->page_title = 'UCP_USERGROUPS_MANAGE'; + $action = (isset($_POST['addusers'])) ? 'addusers' : $request->variable('action', ''); + $group_id = $request->variable('g', 0); + + if (!function_exists('phpbb_get_user_rank')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + add_form_key('ucp_groups'); + + if ($group_id) + { + $sql = 'SELECT g.*, t.teampage_position AS group_teampage + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . TEAMPAGE_TABLE . ' t + ON (t.group_id = g.group_id) + WHERE g.group_id = ' . $group_id; + $result = $db->sql_query($sql); + $group_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$group_row) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + // Check if the user is allowed to manage this group if set to founder only. + if ($user->data['user_type'] != USER_FOUNDER && $group_row['group_founder_manage']) + { + trigger_error($user->lang['NOT_ALLOWED_MANAGE_GROUP'] . $return_page, E_USER_WARNING); + } + + $group_name = $group_row['group_name']; + $group_type = $group_row['group_type']; + + $avatar = phpbb_get_group_avatar($group_row, 'GROUP_AVATAR', true); + + $template->assign_vars(array( + 'GROUP_NAME' => $group_helper->get_name($group_name), + 'GROUP_INTERNAL_NAME' => $group_name, + 'GROUP_COLOUR' => (isset($group_row['group_colour'])) ? $group_row['group_colour'] : '', + 'GROUP_DESC_DISP' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']), + 'GROUP_TYPE' => $group_row['group_type'], + + 'AVATAR' => (empty($avatar) ? '' : $avatar), + 'AVATAR_IMAGE' => (empty($avatar) ? '' : $avatar), + 'AVATAR_WIDTH' => (isset($group_row['group_avatar_width'])) ? $group_row['group_avatar_width'] : '', + 'AVATAR_HEIGHT' => (isset($group_row['group_avatar_height'])) ? $group_row['group_avatar_height'] : '', + )); + } + + switch ($action) + { + case 'edit': + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + list(, $row) = each($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $user->add_lang(array('acp/groups', 'acp/common')); + + $update = (isset($_POST['update'])) ? true : false; + + $error = array(); + + // Setup avatar data for later + $avatars_enabled = false; + $avatar_drivers = null; + $avatar_data = null; + $avatar_error = array(); + + /** @var \phpbb\avatar\manager $phpbb_avatar_manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + + if ($config['allow_avatar']) + { + $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); + + // This is normalised data, without the group_ prefix + $avatar_data = \phpbb\avatar\manager::clean_row($group_row, 'group'); + } + + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (confirm_box(true)) + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, GROUPS_TABLE, 'group_'); + $cache->destroy('sql', GROUPS_TABLE); + + $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED'; + trigger_error($user->lang[$message] . $return_page); + } + else + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true, + 'i' => $id, + 'mode' => $mode, + 'g' => $group_id, + 'action' => $action)) + ); + } + } + + // Did we submit? + if ($update) + { + $group_name = $request->variable('group_name', '', true); + $group_desc = $request->variable('group_desc', '', true); + $group_type = $request->variable('group_type', GROUP_FREE); + + $allow_desc_bbcode = $request->variable('desc_parse_bbcode', false); + $allow_desc_urls = $request->variable('desc_parse_urls', false); + $allow_desc_smilies = $request->variable('desc_parse_smilies', false); + + $submit_ary = array( + 'colour' => $request->variable('group_colour', ''), + 'rank' => $request->variable('group_rank', 0), + 'receive_pm' => isset($_REQUEST['group_receive_pm']) ? 1 : 0, + 'message_limit' => $request->variable('group_message_limit', 0), + 'max_recipients'=> $request->variable('group_max_recipients', 0), + 'legend' => $group_row['group_legend'], + 'teampage' => $group_row['group_teampage'], + ); + + if ($config['allow_avatar']) + { + // Handle avatar + $driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); + + if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) + { + $driver = $phpbb_avatar_manager->get_driver($driver_name); + $result = $driver->process_form($request, $template, $user, $avatar_data, $avatar_error); + + if ($result && empty($avatar_error)) + { + $result['avatar_type'] = $driver_name; + + $submit_ary = array_merge($submit_ary, $result); + } + } + + // Merge any avatars errors into the primary error array + $error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error)); + } + + if (!check_form_key('ucp_groups')) + { + $error[] = $user->lang['FORM_INVALID']; + } + + // Validate submitted colour value + if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour', true)))) + { + // Replace "error" string with its real, localised form + $error = array_merge($error, $colour_error); + } + + if (!count($error)) + { + // Only set the rank, colour, etc. if it's changed or if we're adding a new + // group. This prevents existing group members being updated if no changes + // were made. + // However there are some attributes that need to be set everytime, + // otherwise the group gets removed from the feature. + $set_attributes = array('legend', 'teampage'); + + $group_attributes = array(); + $test_variables = array( + 'rank' => 'int', + 'colour' => 'string', + 'avatar' => 'string', + 'avatar_type' => 'string', + 'avatar_width' => 'int', + 'avatar_height' => 'int', + 'receive_pm' => 'int', + 'legend' => 'int', + 'teampage' => 'int', + 'message_limit' => 'int', + 'max_recipients'=> 'int', + ); + + foreach ($test_variables as $test => $type) + { + if (isset($submit_ary[$test]) && ($action == 'add' || $group_row['group_' . $test] != $submit_ary[$test] || isset($group_attributes['group_avatar']) && strpos($test, 'avatar') === 0 || in_array($test, $set_attributes))) + { + settype($submit_ary[$test], $type); + $group_attributes['group_' . $test] = $group_row['group_' . $test] = $submit_ary[$test]; + } + } + + if (!($error = group_create($group_id, $group_type, $group_name, $group_desc, $group_attributes, $allow_desc_bbcode, $allow_desc_urls, $allow_desc_smilies))) + { + $cache->destroy('sql', GROUPS_TABLE); + $cache->destroy('sql', TEAMPAGE_TABLE); + + $message = ($action == 'edit') ? 'GROUP_UPDATED' : 'GROUP_CREATED'; + trigger_error($user->lang[$message] . $return_page); + } + } + + if (count($error)) + { + $error = array_map(array(&$user, 'lang'), $error); + $group_rank = $submit_ary['rank']; + + $group_desc_data = array( + 'text' => $group_desc, + 'allow_bbcode' => $allow_desc_bbcode, + 'allow_smilies' => $allow_desc_smilies, + 'allow_urls' => $allow_desc_urls + ); + } + } + else if (!$group_id) + { + $group_desc_data = array( + 'text' => '', + 'allow_bbcode' => true, + 'allow_smilies' => true, + 'allow_urls' => true + ); + $group_rank = 0; + $group_type = GROUP_OPEN; + } + else + { + $group_desc_data = generate_text_for_edit($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_options']); + $group_rank = $group_row['group_rank']; + } + + $sql = 'SELECT * + FROM ' . RANKS_TABLE . ' + WHERE rank_special = 1 + ORDER BY rank_title'; + $result = $db->sql_query($sql); + + $rank_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $selected = ($group_rank && $row['rank_id'] == $group_rank) ? ' selected="selected"' : ''; + $rank_options .= ''; + } + $db->sql_freeresult($result); + + $type_free = ($group_type == GROUP_FREE) ? ' checked="checked"' : ''; + $type_open = ($group_type == GROUP_OPEN) ? ' checked="checked"' : ''; + $type_closed = ($group_type == GROUP_CLOSED) ? ' checked="checked"' : ''; + $type_hidden = ($group_type == GROUP_HIDDEN) ? ' checked="checked"' : ''; + + // Load up stuff for avatars + if ($config['allow_avatar']) + { + $avatars_enabled = false; + $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $avatar_data['avatar_type'])); + + // Assign min and max values before generating avatar driver html + $template->assign_vars(array( + 'AVATAR_MIN_WIDTH' => $config['avatar_min_width'], + 'AVATAR_MAX_WIDTH' => $config['avatar_max_width'], + 'AVATAR_MIN_HEIGHT' => $config['avatar_min_height'], + 'AVATAR_MAX_HEIGHT' => $config['avatar_max_height'], + )); + + foreach ($avatar_drivers as $current_driver) + { + $driver = $phpbb_avatar_manager->get_driver($current_driver); + + $avatars_enabled = true; + $template->set_filenames(array( + 'avatar' => $driver->get_template_name(), + )); + + if ($driver->prepare_form($request, $template, $user, $avatar_data, $avatar_error)) + { + $driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver); + $driver_upper = strtoupper($driver_name); + $template->assign_block_vars('avatar_drivers', array( + 'L_TITLE' => $user->lang($driver_upper . '_TITLE'), + 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), + + 'DRIVER' => $driver_name, + 'SELECTED' => $current_driver == $selected_driver, + 'OUTPUT' => $template->assign_display('avatar'), + )); + } + } + } + + if (isset($phpbb_avatar_manager) && !$update) + { + // Merge any avatars errors into the primary error array + $error = array_merge($error, $phpbb_avatar_manager->localize_errors($user, $avatar_error)); + } + + $template->assign_vars(array( + 'S_EDIT' => true, + 'S_INCLUDE_SWATCH' => true, + 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', + 'S_ERROR' => (count($error)) ? true : false, + 'S_SPECIAL_GROUP' => ($group_type == GROUP_SPECIAL) ? true : false, + 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), + 'S_GROUP_MANAGE' => true, + + 'ERROR_MSG' => (count($error)) ? implode('
', $error) : '', + 'GROUP_RECEIVE_PM' => (isset($group_row['group_receive_pm']) && $group_row['group_receive_pm']) ? ' checked="checked"' : '', + 'GROUP_MESSAGE_LIMIT' => (isset($group_row['group_message_limit'])) ? $group_row['group_message_limit'] : 0, + 'GROUP_MAX_RECIPIENTS' => (isset($group_row['group_max_recipients'])) ? $group_row['group_max_recipients'] : 0, + + 'GROUP_DESC' => $group_desc_data['text'], + 'S_DESC_BBCODE_CHECKED' => $group_desc_data['allow_bbcode'], + 'S_DESC_URLS_CHECKED' => $group_desc_data['allow_urls'], + 'S_DESC_SMILIES_CHECKED'=> $group_desc_data['allow_smilies'], + + 'S_RANK_OPTIONS' => $rank_options, + + 'GROUP_TYPE_FREE' => GROUP_FREE, + 'GROUP_TYPE_OPEN' => GROUP_OPEN, + 'GROUP_TYPE_CLOSED' => GROUP_CLOSED, + 'GROUP_TYPE_HIDDEN' => GROUP_HIDDEN, + 'GROUP_TYPE_SPECIAL' => GROUP_SPECIAL, + + 'GROUP_FREE' => $type_free, + 'GROUP_OPEN' => $type_open, + 'GROUP_CLOSED' => $type_closed, + 'GROUP_HIDDEN' => $type_hidden, + + 'S_UCP_ACTION' => $this->u_action . "&action=$action&g=$group_id", + 'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(), + )); + + break; + + case 'list': + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + list(, $row) = each($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $user->add_lang(array('acp/groups', 'acp/common')); + $start = $request->variable('start', 0); + + // Grab the leaders - always, on every page... + $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending + FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug + WHERE ug.group_id = $group_id + AND u.user_id = ug.user_id + AND ug.group_leader = 1 + ORDER BY ug.user_pending DESC, u.username_clean"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('leader', array( + 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => $row['user_colour'], + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'U_USER_VIEW' => get_username_string('profile', $row['user_id'], $row['username']), + 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, + 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', + 'USER_POSTS' => $row['user_posts'], + 'USER_ID' => $row['user_id']) + ); + } + $db->sql_freeresult($result); + + // Total number of group members (non-leaders) + $sql = 'SELECT COUNT(user_id) AS total_members + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + AND group_leader = 0"; + $result = $db->sql_query($sql); + $total_members = (int) $db->sql_fetchfield('total_members'); + $db->sql_freeresult($result); + + // Grab the members + $sql = 'SELECT u.user_id, u.username, u.username_clean, u.user_colour, u.user_regdate, u.user_posts, u.group_id, ug.group_leader, ug.user_pending + FROM ' . USERS_TABLE . ' u, ' . USER_GROUP_TABLE . " ug + WHERE ug.group_id = $group_id + AND u.user_id = ug.user_id + AND ug.group_leader = 0 + ORDER BY ug.user_pending DESC, u.username_clean"; + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + + $pending = false; + $approved = false; + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['user_pending'] && !$pending) + { + $template->assign_block_vars('member', array( + 'S_PENDING' => true) + ); + $template->assign_var('S_PENDING_SET', true); + + $pending = true; + } + else if (!$row['user_pending'] && !$approved) + { + $template->assign_block_vars('member', array( + 'S_APPROVED' => true) + ); + $template->assign_var('S_APPROVED_SET', true); + + $approved = true; + } + + $template->assign_block_vars('member', array( + 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => $row['user_colour'], + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'U_USER_VIEW' => get_username_string('profile', $row['user_id'], $row['username']), + 'S_GROUP_DEFAULT' => ($row['group_id'] == $group_id) ? true : false, + 'JOINED' => ($row['user_regdate']) ? $user->format_date($row['user_regdate']) : ' - ', + 'USER_POSTS' => $row['user_posts'], + 'USER_ID' => $row['user_id']) + ); + } + $db->sql_freeresult($result); + + $s_action_options = ''; + $options = array('default' => 'DEFAULT', 'approve' => 'APPROVE', 'deleteusers' => 'DELETE'); + + foreach ($options as $option => $lang) + { + $s_action_options .= ''; + } + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + $base_url = $this->u_action . "&action=$action&g=$group_id"; + $start = $pagination->validate_start($start, $config['topics_per_page'], $total_members); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_members, $config['topics_per_page'], $start); + + $template->assign_vars(array( + 'S_LIST' => true, + 'S_ACTION_OPTIONS' => $s_action_options, + + 'U_ACTION' => $this->u_action . "&g=$group_id", + 'S_UCP_ACTION' => $this->u_action . "&g=$group_id", + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=ucp&field=usernames'), + )); + + break; + + case 'approve': + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + list(, $row) = each($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $user->add_lang('acp/groups'); + + // Approve, demote or promote + group_user_attributes('approve', $group_id, $mark_ary, false, false); + + trigger_error($user->lang['USERS_APPROVED'] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + + break; + + case 'default': + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + list(, $row) = each($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $group_row['group_name'] = $group_helper->get_name($group_row['group_name']); + + if (confirm_box(true)) + { + if (!count($mark_ary)) + { + $start = 0; + + do + { + $sql = 'SELECT user_id + FROM ' . USER_GROUP_TABLE . " + WHERE group_id = $group_id + ORDER BY user_id"; + $result = $db->sql_query_limit($sql, 200, $start); + + $mark_ary = array(); + if ($row = $db->sql_fetchrow($result)) + { + do + { + $mark_ary[] = $row['user_id']; + } + while ($row = $db->sql_fetchrow($result)); + + group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row); + + $start = (count($mark_ary) < 200) ? 0 : $start + 200; + } + else + { + $start = 0; + } + $db->sql_freeresult($result); + } + while ($start); + } + else + { + group_user_attributes('default', $group_id, $mark_ary, false, $group_row['group_name'], $group_row); + } + + $user->add_lang('acp/groups'); + + trigger_error($user->lang['GROUP_DEFS_UPDATED'] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + else + { + $user->add_lang('acp/common'); + + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'mark' => $mark_ary, + 'g' => $group_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action)) + ); + } + + // redirect to last screen + redirect($this->u_action . '&action=list&g=' . $group_id); + + break; + + case 'deleteusers': + + $user->add_lang(array('acp/groups', 'acp/common')); + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + list(, $row) = each($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $group_row['group_name'] = $group_helper->get_name($group_row['group_name']); + + if (confirm_box(true)) + { + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + $error = group_user_del($group_id, $mark_ary, false, $group_row['group_name']); + + if ($error) + { + trigger_error($user->lang[$error] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + + trigger_error($user->lang['GROUP_USERS_REMOVE'] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'mark' => $mark_ary, + 'g' => $group_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action)) + ); + } + + // redirect to last screen + redirect($this->u_action . '&action=list&g=' . $group_id); + + break; + + case 'addusers': + + $user->add_lang(array('acp/groups', 'acp/common')); + + $names = $request->variable('usernames', '', true); + + if (!$group_id) + { + trigger_error($user->lang['NO_GROUP'] . $return_page); + } + + if (!$names) + { + trigger_error($user->lang['NO_USERS'] . $return_page); + } + + if (!($row = group_memberships($group_id, $user->data['user_id']))) + { + trigger_error($user->lang['NOT_MEMBER_OF_GROUP'] . $return_page); + } + list(, $row) = each($row); + + if (!$row['group_leader']) + { + trigger_error($user->lang['NOT_LEADER_OF_GROUP'] . $return_page); + } + + $name_ary = array_unique(explode("\n", $names)); + $group_name = $group_helper->get_name($group_row['group_name']); + + $default = $request->variable('default', 0); + + if (confirm_box(true)) + { + $return_manage_page = '

' . $language->lang('RETURN_PAGE', '', ''); + + // Add user/s to group + if ($error = group_user_add($group_id, false, $name_ary, $group_name, $default, 0, 0, $group_row)) + { + $display_message = $language->lang($error); + + if ($error == 'GROUP_USERS_INVALID') + { + // Find which users don't exist + $actual_name_ary = $name_ary; + $actual_user_id_ary = []; + user_get_id_name($actual_user_id_ary, $actual_name_ary, false, true); + + $display_message = $language->lang('GROUP_USERS_INVALID', implode($language->lang('COMMA_SEPARATOR'), array_udiff($name_ary, $actual_name_ary, 'strcasecmp'))); + } + + trigger_error($display_message . $return_manage_page); + } + + trigger_error($language->lang('GROUP_USERS_ADDED') . $return_manage_page); + } + else + { + $s_hidden_fields = array( + 'default' => $default, + 'usernames' => $names, + 'g' => $group_id, + 'i' => $id, + 'mode' => $mode, + 'action' => $action + ); + + confirm_box(false, $user->lang('GROUP_CONFIRM_ADD_USERS', count($name_ary), implode($user->lang['COMMA_SEPARATOR'], $name_ary)), build_hidden_fields($s_hidden_fields)); + } + + trigger_error($user->lang['NO_USERS_ADDED'] . '

' . sprintf($user->lang['RETURN_PAGE'], '', '')); + + break; + + default: + $user->add_lang('acp/common'); + + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_desc, g.group_desc_uid, g.group_desc_bitfield, g.group_desc_options, g.group_type, ug.group_leader + FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . ' ug + WHERE ug.user_id = ' . $user->data['user_id'] . ' + AND g.group_id = ug.group_id + AND ug.group_leader = 1 + ORDER BY g.group_type DESC, g.group_name'; + $result = $db->sql_query($sql); + + while ($value = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('leader', array( + 'GROUP_NAME' => $group_helper->get_name($value['group_name']), + 'GROUP_DESC' => generate_text_for_display($value['group_desc'], $value['group_desc_uid'], $value['group_desc_bitfield'], $value['group_desc_options']), + 'GROUP_TYPE' => $value['group_type'], + 'GROUP_ID' => $value['group_id'], + 'GROUP_COLOUR' => $value['group_colour'], + + 'U_LIST' => $this->u_action . "&action=list&g={$value['group_id']}", + 'U_EDIT' => $this->u_action . "&action=edit&g={$value['group_id']}") + ); + } + $db->sql_freeresult($result); + + break; + } + + break; + } + + $this->tpl_name = 'ucp_groups_' . $mode; + } +} diff --git a/install/update/old/includes/ucp/ucp_pm.php b/install/update/old/includes/ucp/ucp_pm.php new file mode 100644 index 0000000..4d02620 --- /dev/null +++ b/install/update/old/includes/ucp/ucp_pm.php @@ -0,0 +1,435 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Private Message Class +* +* $_REQUEST['folder'] display folder with the id used +* $_REQUEST['folder'] inbox|outbox|sentbox display folder with the associated name +* +* Display Messages (default to inbox) - mode=view +* Display single message - mode=view&p=[msg_id] or &p=[msg_id] (short linkage) +* +* if the folder id with (&f=[folder_id]) is used when displaying messages, one query will be saved. If it is not used, phpBB needs to grab +* the folder id first in order to display the input boxes and folder names and such things. ;) phpBB always checks this against the database to make +* sure the user is able to view the message. +* +* Composing Messages (mode=compose): +* To specific user (u=[user_id]) +* To specific group (g=[group_id]) +* Quoting a post (action=quotepost&p=[post_id]) +* Quoting a PM (action=quote&p=[msg_id]) +* Forwarding a PM (action=forward&p=[msg_id]) +*/ +class ucp_pm +{ + var $u_action; + + function main($id, $mode) + { + global $user, $template, $phpbb_root_path, $auth, $phpEx, $db, $config, $request; + + if (!$user->data['is_registered']) + { + trigger_error('NO_MESSAGE'); + } + + // Is PM disabled? + if (!$config['allow_privmsg']) + { + trigger_error('PM_DISABLED'); + } + + $user->add_lang('posting'); + $template->assign_var('S_PRIVMSGS', true); + + // Folder directly specified? + $folder_specified = $request->variable('folder', ''); + + if (!in_array($folder_specified, array('inbox', 'outbox', 'sentbox'))) + { + $folder_specified = (int) $folder_specified; + } + else + { + $folder_specified = ($folder_specified == 'inbox') ? PRIVMSGS_INBOX : (($folder_specified == 'outbox') ? PRIVMSGS_OUTBOX : PRIVMSGS_SENTBOX); + } + + if (!$folder_specified) + { + $mode = (!$mode) ? $request->variable('mode', 'view') : $mode; + } + else + { + $mode = 'view'; + } + + if (!function_exists('get_folder')) + { + include($phpbb_root_path . 'includes/functions_privmsgs.' . $phpEx); + } + + switch ($mode) + { + // Compose message + case 'compose': + $action = $request->variable('action', 'post'); + + $user_folders = get_folder($user->data['user_id']); + + if ($action != 'delete' && !$auth->acl_get('u_sendpm')) + { + // trigger_error('NO_AUTH_SEND_MESSAGE'); + $template->assign_vars(array( + 'S_NO_AUTH_SEND_MESSAGE' => true, + 'S_COMPOSE_PM_VIEW' => true, + )); + + $tpl_file = 'ucp_pm_viewfolder'; + break; + } + + if (!function_exists('compose_pm')) + { + include($phpbb_root_path . 'includes/ucp/ucp_pm_compose.' . $phpEx); + } + compose_pm($id, $mode, $action, $user_folders); + + $tpl_file = 'posting_body'; + break; + + case 'options': + set_user_message_limit(); + get_folder($user->data['user_id']); + + if (!function_exists('message_options')) + { + include($phpbb_root_path . 'includes/ucp/ucp_pm_options.' . $phpEx); + } + message_options($id, $mode, $global_privmsgs_rules, $global_rule_conditions); + + $tpl_file = 'ucp_pm_options'; + break; + + case 'drafts': + + get_folder($user->data['user_id']); + $this->p_name = 'pm'; + + if (!class_exists('ucp_main')) + { + include($phpbb_root_path . 'includes/ucp/ucp_main.' . $phpEx); + } + + $module = new ucp_main($this); + $module->u_action = $this->u_action; + $module->main($id, $mode); + + $this->tpl_name = $module->tpl_name; + $this->page_title = 'UCP_PM_DRAFTS'; + + unset($module); + return; + + break; + + case 'view': + + set_user_message_limit(); + + if ($folder_specified) + { + $folder_id = $folder_specified; + $action = 'view_folder'; + } + else + { + $folder_id = $request->variable('f', PRIVMSGS_NO_BOX); + $action = $request->variable('action', 'view_folder'); + } + + $msg_id = $request->variable('p', 0); + $view = $request->variable('view', ''); + + // View message if specified + if ($msg_id) + { + $action = 'view_message'; + } + + if (!$auth->acl_get('u_readpm')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_READ_MESSAGE'); + } + + if ($view == 'print' && (!$config['print_pm'] || !$auth->acl_get('u_pm_printpm'))) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_PRINT_MESSAGE'); + } + + // Do not allow hold messages to be seen + if ($folder_id == PRIVMSGS_HOLD_BOX) + { + trigger_error('NO_AUTH_READ_HOLD_MESSAGE'); + } + + // First Handle Mark actions and moving messages + $submit_mark = (isset($_POST['submit_mark'])) ? true : false; + $move_pm = (isset($_POST['move_pm'])) ? true : false; + $mark_option = $request->variable('mark_option', ''); + $dest_folder = $request->variable('dest_folder', PRIVMSGS_NO_BOX); + + // Is moving PM triggered through mark options? + if (!in_array($mark_option, array('mark_important', 'delete_marked')) && $submit_mark) + { + $move_pm = true; + $dest_folder = (int) $mark_option; + $submit_mark = false; + } + + // Move PM + if ($move_pm) + { + $move_msg_ids = (isset($_POST['marked_msg_id'])) ? $request->variable('marked_msg_id', array(0)) : array(); + $cur_folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); + + if (move_pm($user->data['user_id'], $user->data['message_limit'], $move_msg_ids, $dest_folder, $cur_folder_id)) + { + // Return to folder view if single message moved + if ($action == 'view_message') + { + $msg_id = 0; + $folder_id = $request->variable('cur_folder_id', PRIVMSGS_NO_BOX); + $action = 'view_folder'; + } + } + } + + // Message Mark Options + if ($submit_mark) + { + handle_mark_actions($user->data['user_id'], $mark_option); + } + + // If new messages arrived, place them into the appropriate folder + $num_not_moved = $num_removed = 0; + $release = $request->variable('release', 0); + + if ($user->data['user_new_privmsg'] && ($action == 'view_folder' || $action == 'view_message')) + { + $return = place_pm_into_folder($global_privmsgs_rules, $release); + $num_not_moved = $return['not_moved']; + $num_removed = $return['removed']; + } + + if (!$msg_id && $folder_id == PRIVMSGS_NO_BOX) + { + $folder_id = PRIVMSGS_INBOX; + } + else if ($msg_id && $folder_id == PRIVMSGS_NO_BOX) + { + $sql = 'SELECT folder_id + FROM ' . PRIVMSGS_TO_TABLE . " + WHERE msg_id = $msg_id + AND folder_id <> " . PRIVMSGS_NO_BOX . ' + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_MESSAGE'); + } + $folder_id = (int) $row['folder_id']; + } + + if ($request->variable('mark', '') == 'all' && check_link_hash($request->variable('token', ''), 'mark_all_pms_read')) + { + mark_folder_read($user->data['user_id'], $folder_id); + + meta_refresh(3, $this->u_action); + $message = $user->lang['PM_MARK_ALL_READ_SUCCESS']; + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $message, + 'success' => true, + )); + } + $message .= '

' . $user->lang('RETURN_UCP', '', ''); + + trigger_error($message); + } + + $message_row = array(); + if ($action == 'view_message' && $msg_id) + { + // Get Message user want to see + if ($view == 'next' || $view == 'previous') + { + $sql_condition = ($view == 'next') ? '>' : '<'; + $sql_ordering = ($view == 'next') ? 'ASC' : 'DESC'; + + $sql = 'SELECT t.msg_id + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . PRIVMSGS_TABLE . " p2 + WHERE p2.msg_id = $msg_id + AND t.folder_id = $folder_id + AND t.user_id = " . $user->data['user_id'] . " + AND t.msg_id = p.msg_id + AND p.message_time $sql_condition p2.message_time + ORDER BY p.message_time $sql_ordering"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $message = ($view == 'next') ? 'NO_NEWER_PM' : 'NO_OLDER_PM'; + trigger_error($message); + } + else + { + $msg_id = $row['msg_id']; + } + } + + $sql = 'SELECT t.*, p.*, u.* + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE t.user_id = ' . $user->data['user_id'] . " + AND p.author_id = u.user_id + AND t.folder_id = $folder_id + AND t.msg_id = p.msg_id + AND p.msg_id = $msg_id"; + $result = $db->sql_query($sql); + $message_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$message_row) + { + trigger_error('NO_MESSAGE'); + } + + // Update unread status + update_unread_status($message_row['pm_unread'], $message_row['msg_id'], $user->data['user_id'], $folder_id); + } + + $folder = get_folder($user->data['user_id'], $folder_id); + + $s_folder_options = $s_to_folder_options = ''; + foreach ($folder as $f_id => $folder_ary) + { + $option = '' . $folder_ary['folder_name'] . (($folder_ary['unread_messages']) ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . ''; + + $s_to_folder_options .= ($f_id != PRIVMSGS_OUTBOX && $f_id != PRIVMSGS_SENTBOX) ? $option : ''; + $s_folder_options .= $option; + } + clean_sentbox($folder[PRIVMSGS_SENTBOX]['num_messages']); + + // Header for message view - folder and so on + $folder_status = get_folder_status($folder_id, $folder); + + $template->assign_vars(array( + 'CUR_FOLDER_ID' => $folder_id, + 'CUR_FOLDER_NAME' => $folder_status['folder_name'], + 'NUM_NOT_MOVED' => $num_not_moved, + 'NUM_REMOVED' => $num_removed, + 'RELEASE_MESSAGE_INFO' => sprintf($user->lang['RELEASE_MESSAGES'], '', ''), + 'NOT_MOVED_MESSAGES' => $user->lang('NOT_MOVED_MESSAGES', (int) $num_not_moved), + 'RULE_REMOVED_MESSAGES' => $user->lang('RULE_REMOVED_MESSAGES', (int) $num_removed), + + 'S_FOLDER_OPTIONS' => $s_folder_options, + 'S_TO_FOLDER_OPTIONS' => $s_to_folder_options, + 'S_FOLDER_ACTION' => $this->u_action . '&action=view_folder', + 'S_PM_ACTION' => $this->u_action . '&action=' . $action, + + 'U_INBOX' => $this->u_action . '&folder=inbox', + 'U_OUTBOX' => $this->u_action . '&folder=outbox', + 'U_SENTBOX' => $this->u_action . '&folder=sentbox', + 'U_CREATE_FOLDER' => $this->u_action . '&mode=options', + 'U_CURRENT_FOLDER' => $this->u_action . '&folder=' . $folder_id, + 'U_MARK_ALL' => $this->u_action . '&folder=' . $folder_id . '&mark=all&token=' . generate_link_hash('mark_all_pms_read'), + + 'S_IN_INBOX' => ($folder_id == PRIVMSGS_INBOX) ? true : false, + 'S_IN_OUTBOX' => ($folder_id == PRIVMSGS_OUTBOX) ? true : false, + 'S_IN_SENTBOX' => ($folder_id == PRIVMSGS_SENTBOX) ? true : false, + + 'FOLDER_STATUS' => $folder_status['message'], + 'FOLDER_MAX_MESSAGES' => $folder_status['max'], + 'FOLDER_CUR_MESSAGES' => $folder_status['cur'], + 'FOLDER_REMAINING_MESSAGES' => $folder_status['remaining'], + 'FOLDER_PERCENT' => $folder_status['percent']) + ); + + if ($action == 'view_folder') + { + if (!function_exists('view_folder')) + { + include($phpbb_root_path . 'includes/ucp/ucp_pm_viewfolder.' . $phpEx); + } + view_folder($id, $mode, $folder_id, $folder); + + $tpl_file = 'ucp_pm_viewfolder'; + } + else if ($action == 'view_message') + { + $template->assign_vars(array( + 'S_VIEW_MESSAGE' => true, + 'L_RETURN_TO_FOLDER' => $user->lang('RETURN_TO', $folder_status['folder_name']), + 'MSG_ID' => $msg_id, + )); + + if (!$msg_id) + { + trigger_error('NO_MESSAGE'); + } + + if (!function_exists('view_message')) + { + include($phpbb_root_path . 'includes/ucp/ucp_pm_viewmessage.' . $phpEx); + } + view_message($id, $mode, $folder_id, $msg_id, $folder, $message_row); + + $tpl_file = ($view == 'print') ? 'ucp_pm_viewmessage_print' : 'ucp_pm_viewmessage'; + } + + break; + + default: + trigger_error('NO_ACTION_MODE', E_USER_ERROR); + break; + } + + $template->assign_vars(array( + 'L_TITLE' => $user->lang['UCP_PM_' . strtoupper($mode)], + 'S_UCP_ACTION' => $this->u_action . ((isset($action)) ? "&action=$action" : '')) + ); + + // Set desired template + $this->tpl_name = $tpl_file; + $this->page_title = 'UCP_PM_' . strtoupper($mode); + } +} diff --git a/install/update/old/includes/ucp/ucp_pm_compose.php b/install/update/old/includes/ucp/ucp_pm_compose.php new file mode 100644 index 0000000..543db4f --- /dev/null +++ b/install/update/old/includes/ucp/ucp_pm_compose.php @@ -0,0 +1,1546 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* Compose private message +* Called from ucp_pm with mode == 'compose' +*/ +function compose_pm($id, $mode, $action, $user_folders = array()) +{ + global $template, $db, $auth, $user, $cache; + global $phpbb_root_path, $phpEx, $config; + global $request, $phpbb_dispatcher, $phpbb_container; + + // Damn php and globals - i know, this is horrible + // Needed for handle_message_list_actions() + global $refresh, $submit, $preview; + + if (!function_exists('generate_smilies')) + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } + + if (!function_exists('display_custom_bbcodes')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + if (!class_exists('parse_message')) + { + include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + } + + if (!$action) + { + $action = 'post'; + } + add_form_key('ucp_pm_compose'); + + // Grab only parameters needed here + $to_user_id = $request->variable('u', 0); + $to_group_id = $request->variable('g', 0); + $msg_id = $request->variable('p', 0); + $draft_id = $request->variable('d', 0); + + // Reply to all triggered (quote/reply) + $reply_to_all = $request->variable('reply_to_all', 0); + + $address_list = $request->variable('address_list', array('' => array(0 => ''))); + + $preview = (isset($_POST['preview'])) ? true : false; + $save = (isset($_POST['save'])) ? true : false; + $load = (isset($_POST['load'])) ? true : false; + $cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false; + $delete = (isset($_POST['delete'])) ? true : false; + + $remove_u = (isset($_REQUEST['remove_u'])) ? true : false; + $remove_g = (isset($_REQUEST['remove_g'])) ? true : false; + $add_to = (isset($_REQUEST['add_to'])) ? true : false; + $add_bcc = (isset($_REQUEST['add_bcc'])) ? true : false; + + $refresh = isset($_POST['add_file']) || isset($_POST['delete_file']) || $save || $load + || $remove_u || $remove_g || $add_to || $add_bcc; + $submit = $request->is_set_post('post') && !$refresh && !$preview; + + $action = ($delete && !$preview && !$refresh && $submit) ? 'delete' : $action; + $select_single = ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? false : true; + + $error = array(); + $current_time = time(); + + /** @var \phpbb\group\helper $group_helper */ + $group_helper = $phpbb_container->get('group_helper'); + + // Was cancel pressed? If so then redirect to the appropriate page + if ($cancel) + { + if ($msg_id) + { + redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id)); + } + redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm')); + } + + // Since viewtopic.php language entries are used in several modes, + // we include the language file here + $user->add_lang('viewtopic'); + + /** + * Modify the default vars before composing a PM + * + * @event core.ucp_pm_compose_modify_data + * @var int msg_id post_id in the page request + * @var int to_user_id The id of whom the message is to + * @var int to_group_id The id of the group the message is to + * @var bool submit Whether the form has been submitted + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete Whether the user is deleting the PM + * @var int reply_to_all Value of reply_to_all request variable. + * @since 3.1.4-RC1 + */ + $vars = array( + 'msg_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_modify_data', compact($vars))); + + // Output PM_TO box if message composing + if ($action != 'edit') + { + // Add groups to PM box + if ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) + { + $sql = 'SELECT g.group_id, g.group_name, g.group_type, g.group_colour + FROM ' . GROUPS_TABLE . ' g'; + + if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) + { + $sql .= ' LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + } + + $sql .= ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' WHERE ' : ' AND '; + + $sql .= 'g.group_receive_pm = 1 + ORDER BY g.group_type DESC, g.group_name ASC'; + $result = $db->sql_query($sql); + + $group_options = ''; + while ($row = $db->sql_fetchrow($result)) + { + $group_options .= '' . $group_helper->get_name($row['group_name']) . ''; + } + $db->sql_freeresult($result); + } + + $template->assign_vars(array( + 'S_SHOW_PM_BOX' => true, + 'S_ALLOW_MASS_PM' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm')) ? true : false, + 'S_GROUP_OPTIONS' => ($config['allow_mass_pm'] && $auth->acl_get('u_masspm_group')) ? $group_options : '', + 'U_FIND_USERNAME' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=postform&field=username_list&select_single=" . (int) $select_single), + )); + } + + $sql = ''; + $folder_id = 0; + + // What is all this following SQL for? Well, we need to know + // some basic information in all cases before we do anything. + switch ($action) + { + case 'post': + if (!$auth->acl_get('u_sendpm')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_SEND_MESSAGE'); + } + break; + + case 'reply': + case 'quote': + case 'forward': + case 'quotepost': + if (!$msg_id) + { + trigger_error('NO_MESSAGE'); + } + + if (!$auth->acl_get('u_sendpm')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_SEND_MESSAGE'); + } + + if ($action == 'quotepost') + { + $sql = 'SELECT p.post_id as msg_id, p.forum_id, p.post_text as message_text, p.poster_id as author_id, p.post_time as message_time, p.bbcode_bitfield, p.bbcode_uid, p.enable_sig, p.enable_smilies, p.enable_magic_url, t.topic_title as message_subject, u.username as quote_username + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . USERS_TABLE . " u + WHERE p.post_id = $msg_id + AND t.topic_id = p.topic_id + AND u.user_id = p.poster_id"; + } + else + { + $sql = 'SELECT t.folder_id, p.*, u.username as quote_username + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE t.user_id = ' . $user->data['user_id'] . " + AND p.author_id = u.user_id + AND t.msg_id = p.msg_id + AND p.msg_id = $msg_id"; + } + break; + + case 'edit': + if (!$msg_id) + { + trigger_error('NO_MESSAGE'); + } + + // check for outbox (not read) status, we do not allow editing if one user already having the message + $sql = 'SELECT p.*, t.folder_id + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p + WHERE t.user_id = ' . $user->data['user_id'] . ' + AND t.folder_id = ' . PRIVMSGS_OUTBOX . " + AND t.msg_id = $msg_id + AND t.msg_id = p.msg_id"; + break; + + case 'delete': + if (!$auth->acl_get('u_pm_delete')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_DELETE_MESSAGE'); + } + + if (!$msg_id) + { + trigger_error('NO_MESSAGE'); + } + + $sql = 'SELECT msg_id, pm_unread, pm_new, author_id, folder_id + FROM ' . PRIVMSGS_TO_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . " + AND msg_id = $msg_id"; + break; + + case 'smilies': + generate_smilies('window', 0); + break; + + default: + trigger_error('NO_ACTION_MODE', E_USER_ERROR); + break; + } + + if ($action == 'forward' && (!$config['forward_pm'] || !$auth->acl_get('u_pm_forward'))) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_FORWARD_MESSAGE'); + } + + if ($action == 'edit' && !$auth->acl_get('u_pm_edit')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_EDIT_MESSAGE'); + } + + if ($sql) + { + /** + * Alter sql query to get message for user to write the PM + * + * @event core.ucp_pm_compose_compose_pm_basic_info_query_before + * @var string sql String with the query to be executed + * @var int msg_id topic_id in the page request + * @var int to_user_id The id of whom the message is to + * @var int to_group_id The id of the group whom the message is to + * @var bool submit Whether the user is sending the PM or not + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete Whether the user is deleting the PM + * @var int reply_to_all Value of reply_to_all request variable. + * @since 3.1.0-RC5 + * @changed 3.2.0-a1 Removed undefined variables + */ + $vars = array( + 'sql', + 'msg_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_compose_pm_basic_info_query_before', compact($vars))); + + $result = $db->sql_query($sql); + $post = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$post) + { + // If editing it could be the recipient already read the message... + if ($action == 'edit') + { + $sql = 'SELECT p.*, t.folder_id + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p + WHERE t.user_id = ' . $user->data['user_id'] . " + AND t.msg_id = $msg_id + AND t.msg_id = p.msg_id"; + $result = $db->sql_query($sql); + $post = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($post) + { + trigger_error('NO_EDIT_READ_MESSAGE'); + } + } + + trigger_error('NO_MESSAGE'); + } + + if ($action == 'quotepost') + { + if (($post['forum_id'] && !$auth->acl_get('f_read', $post['forum_id'])) || (!$post['forum_id'] && !$auth->acl_getf_global('f_read'))) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } + + /** + * Get the result of querying for the post to be quoted in the pm message + * + * @event core.ucp_pm_compose_quotepost_query_after + * @var string sql The original SQL used in the query + * @var array post Associative array with the data of the quoted post + * @var array msg_id The post_id that was searched to get the message for quoting + * @var int to_user_id Users the message is sent to + * @var int to_group_id Groups the message is sent to + * @var bool submit Whether the user is sending the PM or not + * @var bool preview Whether the user is previewing the PM or not + * @var string action One of: post, reply, quote, forward, quotepost, edit, delete, smilies + * @var bool delete If deleting message + * @var int reply_to_all Value of reply_to_all request variable. + * @since 3.1.0-RC5 + * @changed 3.2.0-a1 Removed undefined variables + */ + $vars = array( + 'sql', + 'post', + 'msg_id', + 'to_user_id', + 'to_group_id', + 'submit', + 'preview', + 'action', + 'delete', + 'reply_to_all', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_quotepost_query_after', compact($vars))); + + // Passworded forum? + if ($post['forum_id']) + { + $sql = 'SELECT forum_id, forum_name, forum_password + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . (int) $post['forum_id']; + $result = $db->sql_query($sql); + $forum_data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!empty($forum_data['forum_password'])) + { + login_forum_box($forum_data); + } + } + } + + $msg_id = (int) $post['msg_id']; + $folder_id = (isset($post['folder_id'])) ? $post['folder_id'] : 0; + $message_text = (isset($post['message_text'])) ? $post['message_text'] : ''; + + if ((!$post['author_id'] || ($post['author_id'] == ANONYMOUS && $action != 'delete')) && $msg_id) + { + trigger_error('NO_AUTHOR'); + } + + if ($action == 'quotepost') + { + // Decode text for message display + decode_message($message_text, $post['bbcode_uid']); + } + + if ($action != 'delete') + { + $enable_urls = $post['enable_magic_url']; + $enable_sig = (isset($post['enable_sig'])) ? $post['enable_sig'] : 0; + + $message_attachment = (isset($post['message_attachment'])) ? $post['message_attachment'] : 0; + $message_subject = $post['message_subject']; + $message_time = $post['message_time']; + $bbcode_uid = $post['bbcode_uid']; + + $quote_username = (isset($post['quote_username'])) ? $post['quote_username'] : ''; + $icon_id = (isset($post['icon_id'])) ? $post['icon_id'] : 0; + + if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !count($address_list) && !$refresh && !$submit && !$preview) + { + // Add the original author as the recipient if quoting a post or only replying and not having checked "reply to all" + if ($action == 'quotepost' || !$reply_to_all) + { + $address_list = array('u' => array($post['author_id'] => 'to')); + } + else + { + // We try to include every previously listed member from the TO Header - Reply to all + $address_list = rebuild_header(array('to' => $post['to_address'])); + + // Add the author (if he is already listed then this is no shame (it will be overwritten)) + $address_list['u'][$post['author_id']] = 'to'; + + // Now, make sure the user itself is not listed. ;) + if (isset($address_list['u'][$user->data['user_id']])) + { + unset($address_list['u'][$user->data['user_id']]); + } + } + } + else if ($action == 'edit' && !count($address_list) && !$refresh && !$submit && !$preview) + { + // Rebuild TO and BCC Header + $address_list = rebuild_header(array('to' => $post['to_address'], 'bcc' => $post['bcc_address'])); + } + + if ($action == 'quotepost') + { + $check_value = 0; + } + else + { + $check_value = (($post['enable_bbcode']+1) << 8) + (($post['enable_smilies']+1) << 4) + (($enable_urls+1) << 2) + (($post['enable_sig']+1) << 1); + } + } + } + else + { + $message_attachment = 0; + $message_text = $message_subject = ''; + + /** + * Predefine message text and subject + * + * @event core.ucp_pm_compose_predefined_message + * @var string message_text Message text + * @var string message_subject Messate subject + * @since 3.1.11-RC1 + */ + $vars = array('message_text', 'message_subject'); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_predefined_message', compact($vars))); + + if ($to_user_id && $to_user_id != ANONYMOUS && $action == 'post') + { + $address_list['u'][$to_user_id] = 'to'; + } + else if ($to_group_id && $action == 'post') + { + $address_list['g'][$to_group_id] = 'to'; + } + $check_value = 0; + } + + if (($to_group_id || isset($address_list['g'])) && (!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group'))) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_GROUP_MESSAGE'); + } + + if ($action == 'edit' && !$refresh && !$preview && !$submit) + { + if (!($message_time > time() - ($config['pm_edit_time'] * 60) || !$config['pm_edit_time'])) + { + trigger_error('CANNOT_EDIT_MESSAGE_TIME'); + } + } + + if ($action == 'post') + { + $template->assign_var('S_NEW_MESSAGE', true); + } + + if (!isset($icon_id)) + { + $icon_id = 0; + } + + /* @var $plupload \phpbb\plupload\plupload */ + $plupload = $phpbb_container->get('plupload'); + $message_parser = new parse_message(); + $message_parser->set_plupload($plupload); + + $message_parser->message = ($action == 'reply') ? '' : $message_text; + unset($message_text); + + $s_action = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=$mode&action=$action", true, $user->session_id); + $s_action .= (($folder_id) ? "&f=$folder_id" : '') . (($msg_id) ? "&p=$msg_id" : ''); + + // Delete triggered ? + if ($action == 'delete') + { + // Folder id has been determined by the SQL Statement + // $folder_id = $request->variable('f', PRIVMSGS_NO_BOX); + + // Do we need to confirm ? + if (confirm_box(true)) + { + delete_pm($user->data['user_id'], $msg_id, $folder_id); + + // jump to next message in "history"? nope, not for the moment. But able to be included later. + $meta_info = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&folder=$folder_id"); + $message = $user->lang['MESSAGE_DELETED']; + + meta_refresh(3, $meta_info); + $message .= '

' . sprintf($user->lang['RETURN_FOLDER'], '', ''); + trigger_error($message); + } + else + { + $s_hidden_fields = array( + 'p' => $msg_id, + 'f' => $folder_id, + 'action' => 'delete' + ); + + // "{$phpbb_root_path}ucp.$phpEx?i=pm&mode=compose" + confirm_box(false, 'DELETE_MESSAGE', build_hidden_fields($s_hidden_fields)); + } + + redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&action=view_message&p=' . $msg_id)); + } + + // Get maximum number of allowed recipients + $max_recipients = phpbb_get_max_setting_from_group($db, $user->data['user_id'], 'max_recipients'); + + // If it is 0, there is no limit set and we use the maximum value within the config. + $max_recipients = (!$max_recipients) ? $config['pm_max_recipients'] : $max_recipients; + + // If this is a quote/reply "to all"... we may increase the max_recpients to the number of original recipients + if (($action == 'reply' || $action == 'quote') && $max_recipients && $reply_to_all) + { + // We try to include every previously listed member from the TO Header + $list = rebuild_header(array('to' => $post['to_address'])); + + // Can be an empty array too ;) + $list = (!empty($list['u'])) ? $list['u'] : array(); + $list[$post['author_id']] = 'to'; + + if (isset($list[$user->data['user_id']])) + { + unset($list[$user->data['user_id']]); + } + + $max_recipients = ($max_recipients < count($list)) ? count($list) : $max_recipients; + + unset($list); + } + + // Handle User/Group adding/removing + handle_message_list_actions($address_list, $error, $remove_u, $remove_g, $add_to, $add_bcc); + + // Check mass pm to group permission + if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm_group')) && !empty($address_list['g'])) + { + $address_list = array(); + $error[] = $user->lang['NO_AUTH_GROUP_MESSAGE']; + } + + // Check mass pm to users permission + if ((!$config['allow_mass_pm'] || !$auth->acl_get('u_masspm')) && num_recipients($address_list) > 1) + { + $address_list = get_recipients($address_list, 1); + $error[] = $user->lang('TOO_MANY_RECIPIENTS', 1); + } + + // Check for too many recipients + if (!empty($address_list['u']) && $max_recipients && count($address_list['u']) > $max_recipients) + { + $address_list = get_recipients($address_list, $max_recipients); + $error[] = $user->lang('TOO_MANY_RECIPIENTS', $max_recipients); + } + + // Always check if the submitted attachment data is valid and belongs to the user. + // Further down (especially in submit_post()) we do not check this again. + $message_parser->get_submitted_attachment_data(); + + if ($message_attachment && !$submit && !$refresh && !$preview && $action == 'edit') + { + // Do not change to SELECT * + $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename, filesize + FROM ' . ATTACHMENTS_TABLE . " + WHERE post_msg_id = $msg_id + AND in_message = 1 + AND is_orphan = 0 + ORDER BY filetime DESC"; + $result = $db->sql_query($sql); + $message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result)); + $db->sql_freeresult($result); + } + + if (!in_array($action, array('quote', 'edit', 'delete', 'forward'))) + { + $enable_sig = ($config['allow_sig'] && $config['allow_sig_pm'] && $auth->acl_get('u_sig') && $user->optionget('attachsig')); + $enable_smilies = ($config['allow_smilies'] && $auth->acl_get('u_pm_smilies') && $user->optionget('smilies')); + $enable_bbcode = ($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode') && $user->optionget('bbcode')); + $enable_urls = true; + } + + $drafts = false; + + // User own some drafts? + if ($auth->acl_get('u_savedrafts') && $action != 'delete') + { + $sql = 'SELECT draft_id + FROM ' . DRAFTS_TABLE . ' + WHERE forum_id = 0 + AND topic_id = 0 + AND user_id = ' . $user->data['user_id'] . + (($draft_id) ? " AND draft_id <> $draft_id" : ''); + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $drafts = true; + } + } + + if ($action == 'edit') + { + $message_parser->bbcode_uid = $bbcode_uid; + } + + $bbcode_status = ($config['allow_bbcode'] && $config['auth_bbcode_pm'] && $auth->acl_get('u_pm_bbcode')) ? true : false; + $smilies_status = ($config['allow_smilies'] && $config['auth_smilies_pm'] && $auth->acl_get('u_pm_smilies')) ? true : false; + $img_status = ($config['auth_img_pm'] && $auth->acl_get('u_pm_img')) ? true : false; + $flash_status = ($config['auth_flash_pm'] && $auth->acl_get('u_pm_flash')) ? true : false; + $url_status = ($config['allow_post_links']) ? true : false; + + // Save Draft + if ($save && $auth->acl_get('u_savedrafts')) + { + $subject = $request->variable('subject', '', true); + $subject = (!$subject && $action != 'post') ? $user->lang['NEW_MESSAGE'] : $subject; + $message = $request->variable('message', '', true); + + if ($subject && $message) + { + if (confirm_box(true)) + { + $message_parser->message = $message; + $message_parser->parse($bbcode_status, $url_status, $smilies_status, $img_status, $flash_status, true, $url_status); + + $sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'user_id' => $user->data['user_id'], + 'topic_id' => 0, + 'forum_id' => 0, + 'save_time' => $current_time, + 'draft_subject' => $subject, + 'draft_message' => $message_parser->message, + ) + ); + $db->sql_query($sql); + + $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=$mode"); + + meta_refresh(3, $redirect_url); + $message = $user->lang['DRAFT_SAVED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + + trigger_error($message); + } + else + { + $s_hidden_fields = build_hidden_fields(array( + 'mode' => $mode, + 'action' => $action, + 'save' => true, + 'subject' => $subject, + 'message' => $message, + 'u' => $to_user_id, + 'g' => $to_group_id, + 'p' => $msg_id) + ); + $s_hidden_fields .= build_address_field($address_list); + + confirm_box(false, 'SAVE_DRAFT', $s_hidden_fields); + } + } + else + { + if (utf8_clean_string($subject) === '') + { + $error[] = $user->lang['EMPTY_MESSAGE_SUBJECT']; + } + + if (utf8_clean_string($message) === '') + { + $error[] = $user->lang['TOO_FEW_CHARS']; + } + } + + unset($subject, $message); + } + + // Load Draft + if ($draft_id && $auth->acl_get('u_savedrafts')) + { + $sql = 'SELECT draft_subject, draft_message + FROM ' . DRAFTS_TABLE . " + WHERE draft_id = $draft_id + AND topic_id = 0 + AND forum_id = 0 + AND user_id = " . $user->data['user_id']; + $result = $db->sql_query_limit($sql, 1); + + if ($row = $db->sql_fetchrow($result)) + { + $message_parser->message = $row['draft_message']; + $message_subject = $row['draft_subject']; + + $template->assign_var('S_DRAFT_LOADED', true); + } + else + { + $draft_id = 0; + } + $db->sql_freeresult($result); + } + + // Load Drafts + if ($load && $drafts) + { + load_drafts(0, 0, $id, $action, $msg_id); + } + + if ($submit || $preview || $refresh) + { + if (($submit || $preview) && !check_form_key('ucp_pm_compose')) + { + $error[] = $user->lang['FORM_INVALID']; + } + $subject = $request->variable('subject', '', true); + $message_parser->message = $request->variable('message', '', true); + + $icon_id = $request->variable('icon', 0); + + $enable_bbcode = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true; + $enable_smilies = (!$smilies_status || isset($_POST['disable_smilies'])) ? false : true; + $enable_urls = (isset($_POST['disable_magic_url'])) ? 0 : 1; + $enable_sig = (!$config['allow_sig'] ||!$config['allow_sig_pm']) ? false : ((isset($_POST['attach_sig'])) ? true : false); + + /** + * Modify private message + * + * @event core.ucp_pm_compose_modify_parse_before + * @var bool enable_bbcode Whether or not bbcode is enabled + * @var bool enable_smilies Whether or not smilies are enabled + * @var bool enable_urls Whether or not urls are enabled + * @var bool enable_sig Whether or not signature is enabled + * @var string subject PM subject text + * @var object message_parser The message parser object + * @var bool submit Whether or not the form has been sumitted + * @var bool preview Whether or not the signature is being previewed + * @var array error Any error strings + * @since 3.1.10-RC1 + */ + $vars = array( + 'enable_bbcode', + 'enable_smilies', + 'enable_urls', + 'enable_sig', + 'subject', + 'message_parser', + 'submit', + 'preview', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_modify_parse_before', compact($vars))); + + // Parse Attachments - before checksum is calculated + $message_parser->parse_attachments('fileupload', $action, 0, $submit, $preview, $refresh, true); + + if (count($message_parser->warn_msg) && !($remove_u || $remove_g || $add_to || $add_bcc)) + { + $error[] = implode('
', $message_parser->warn_msg); + $message_parser->warn_msg = array(); + } + + // Parse message + $message_parser->parse($enable_bbcode, ($config['allow_post_links']) ? $enable_urls : false, $enable_smilies, $img_status, $flash_status, true, $config['allow_post_links']); + + // On a refresh we do not care about message parsing errors + if (count($message_parser->warn_msg) && !$refresh) + { + $error[] = implode('
', $message_parser->warn_msg); + } + + if ($action != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$auth->acl_get('u_ignoreflood')) + { + // Flood check + $last_post_time = $user->data['user_lastpost_time']; + + if ($last_post_time) + { + if ($last_post_time && ($current_time - $last_post_time) < intval($config['flood_interval'])) + { + $error[] = $user->lang['FLOOD_ERROR']; + } + } + } + + // Subject defined + if ($submit) + { + if (utf8_clean_string($subject) === '') + { + $error[] = $user->lang['EMPTY_MESSAGE_SUBJECT']; + } + + if (!count($address_list)) + { + $error[] = $user->lang['NO_RECIPIENT']; + } + } + + // Store message, sync counters + if (!count($error) && $submit) + { + $pm_data = array( + 'msg_id' => (int) $msg_id, + 'from_user_id' => $user->data['user_id'], + 'from_user_ip' => $user->ip, + 'from_username' => $user->data['username'], + 'reply_from_root_level' => (isset($post['root_level'])) ? (int) $post['root_level'] : 0, + 'reply_from_msg_id' => (int) $msg_id, + 'icon_id' => (int) $icon_id, + 'enable_sig' => (bool) $enable_sig, + 'enable_bbcode' => (bool) $enable_bbcode, + 'enable_smilies' => (bool) $enable_smilies, + 'enable_urls' => (bool) $enable_urls, + 'bbcode_bitfield' => $message_parser->bbcode_bitfield, + 'bbcode_uid' => $message_parser->bbcode_uid, + 'message' => $message_parser->message, + 'attachment_data' => $message_parser->attachment_data, + 'filename_data' => $message_parser->filename_data, + 'address_list' => $address_list + ); + + // ((!$message_subject) ? $subject : $message_subject) + $msg_id = submit_pm($action, $subject, $pm_data); + + $return_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=view&p=' . $msg_id); + $inbox_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=inbox'); + $outbox_folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=outbox'); + + $folder_url = ''; + if (($folder_id > 0) && isset($user_folders[$folder_id])) + { + $folder_url = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&folder=' . $folder_id); + } + + $return_box_url = ($action === 'post' || $action === 'edit') ? $outbox_folder_url : $inbox_folder_url; + $return_box_lang = ($action === 'post' || $action === 'edit') ? 'PM_OUTBOX' : 'PM_INBOX'; + + $save_message = ($action === 'edit') ? $user->lang['MESSAGE_EDITED'] : $user->lang['MESSAGE_STORED']; + $message = $save_message . '

' . $user->lang('VIEW_PRIVATE_MESSAGE', '', ''); + + $last_click_type = 'CLICK_RETURN_FOLDER'; + if ($folder_url) + { + $message .= '

' . sprintf($user->lang['CLICK_RETURN_FOLDER'], '', '', $user_folders[$folder_id]['folder_name']); + $last_click_type = 'CLICK_GOTO_FOLDER'; + } + $message .= '

' . sprintf($user->lang[$last_click_type], '', '', $user->lang[$return_box_lang]); + + meta_refresh(3, $return_message_url); + trigger_error($message); + } + + $message_subject = $subject; + } + + // Preview + if (!count($error) && $preview) + { + $preview_message = $message_parser->format_display($enable_bbcode, $enable_urls, $enable_smilies, false); + + $preview_signature = $user->data['user_sig']; + $preview_signature_uid = $user->data['user_sig_bbcode_uid']; + $preview_signature_bitfield = $user->data['user_sig_bbcode_bitfield']; + + // Signature + if ($enable_sig && $config['allow_sig'] && $preview_signature) + { + $bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0); + $preview_signature = generate_text_for_display($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $bbcode_flags); + } + else + { + $preview_signature = ''; + } + + // Attachment Preview + if (count($message_parser->attachment_data)) + { + $template->assign_var('S_HAS_ATTACHMENTS', true); + + $update_count = array(); + $attachment_data = $message_parser->attachment_data; + + parse_attachments(false, $preview_message, $attachment_data, $update_count, true); + + foreach ($attachment_data as $i => $attachment) + { + $template->assign_block_vars('attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + unset($attachment_data); + } + + $preview_subject = censor_text($subject); + + if (!count($error)) + { + $template->assign_vars(array( + 'PREVIEW_SUBJECT' => $preview_subject, + 'PREVIEW_MESSAGE' => $preview_message, + 'PREVIEW_SIGNATURE' => $preview_signature, + + 'S_DISPLAY_PREVIEW' => true) + ); + } + unset($message_text); + } + + // Decode text for message display + $bbcode_uid = (($action == 'quote' || $action == 'forward') && !$preview && !$refresh && (!count($error) || (count($error) && !$submit))) ? $bbcode_uid : $message_parser->bbcode_uid; + + $message_parser->decode_message($bbcode_uid); + + if (($action == 'quote' || $action == 'quotepost') && !$preview && !$refresh && !$submit) + { + if ($action == 'quotepost') + { + $post_id = $request->variable('p', 0); + if ($config['allow_post_links']) + { + $message_link = generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id}"; + $message_link_subject = "{$user->lang['SUBJECT']}{$user->lang['COLON']} {$message_subject}"; + if ($bbcode_status) + { + $message_link = "[url=" . $message_link . "]" . $message_link_subject . "[/url]\n\n"; + } + else + { + $message_link = $message_link . " - " . $message_link_subject . "\n\n"; + } + } + else + { + $message_link = $user->lang['SUBJECT'] . $user->lang['COLON'] . ' ' . $message_subject . " (" . generate_board_url() . "/viewtopic.$phpEx?p={$post_id}#p{$post_id})\n\n"; + } + } + else + { + $message_link = ''; + } + $quote_attributes = array( + 'author' => $quote_username, + 'time' => $post['message_time'], + 'user_id' => $post['author_id'], + ); + if ($action === 'quotepost') + { + $quote_attributes['post_id'] = $post['msg_id']; + } + + /** @var \phpbb\language\language $language */ + $language = $phpbb_container->get('language'); + /** @var \phpbb\textformatter\utils_interface $text_formatter_utils */ + $text_formatter_utils = $phpbb_container->get('text_formatter.utils'); + phpbb_format_quote($language, $message_parser, $text_formatter_utils, $bbcode_status, $quote_attributes, $message_link); + } + + if (($action == 'reply' || $action == 'quote' || $action == 'quotepost') && !$preview && !$refresh) + { + $message_subject = ((!preg_match('/^Re:/', $message_subject)) ? 'Re: ' : '') . censor_text($message_subject); + } + + if ($action == 'forward' && !$preview && !$refresh && !$submit) + { + $fwd_to_field = write_pm_addresses(array('to' => $post['to_address']), 0, true); + + if ($config['allow_post_links']) + { + $quote_username_text = '[url=' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']}]{$quote_username}[/url]"; + } + else + { + $quote_username_text = $quote_username . ' (' . generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$post['author_id']})"; + } + + $forward_text = array(); + $forward_text[] = $user->lang['FWD_ORIGINAL_MESSAGE']; + $forward_text[] = sprintf($user->lang['FWD_SUBJECT'], censor_text($message_subject)); + $forward_text[] = sprintf($user->lang['FWD_DATE'], $user->format_date($message_time, false, true)); + $forward_text[] = sprintf($user->lang['FWD_FROM'], $quote_username_text); + $forward_text[] = sprintf($user->lang['FWD_TO'], implode($user->lang['COMMA_SEPARATOR'], $fwd_to_field['to'])); + + $quote_text = $phpbb_container->get('text_formatter.utils')->generate_quote( + censor_text($message_parser->message), + array('author' => $quote_username) + ); + $message_parser->message = implode("\n", $forward_text) . "\n\n" . $quote_text; + $message_subject = ((!preg_match('/^Fwd:/', $message_subject)) ? 'Fwd: ' : '') . censor_text($message_subject); + } + + $attachment_data = $message_parser->attachment_data; + $filename_data = $message_parser->filename_data; + $message_text = $message_parser->message; + + // MAIN PM PAGE BEGINS HERE + + // Generate smiley listing + generate_smilies('inline', 0); + + // Generate PM Icons + $s_pm_icons = false; + if ($config['enable_pm_icons']) + { + $s_pm_icons = posting_gen_topic_icons($action, $icon_id); + } + + // Generate inline attachment select box + posting_gen_inline_attachments($attachment_data); + + // Build address list for display + // array('u' => array($author_id => 'to')); + if (count($address_list)) + { + // Get Usernames and Group Names + $result = array(); + if (!empty($address_list['u'])) + { + $sql = 'SELECT user_id as id, username as name, user_colour as colour + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', array_map('intval', array_keys($address_list['u']))) . ' + ORDER BY username_clean ASC'; + $result['u'] = $db->sql_query($sql); + } + + if (!empty($address_list['g'])) + { + $sql = 'SELECT g.group_id AS id, g.group_name AS name, g.group_colour AS colour, g.group_type + FROM ' . GROUPS_TABLE . ' g'; + + if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) + { + $sql .= ' LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + } + + $sql .= ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? ' WHERE ' : ' AND '; + + $sql .= 'g.group_receive_pm = 1 + AND ' . $db->sql_in_set('g.group_id', array_map('intval', array_keys($address_list['g']))) . ' + ORDER BY g.group_name ASC'; + + $result['g'] = $db->sql_query($sql); + } + + $u = $g = array(); + $_types = array('u', 'g'); + foreach ($_types as $type) + { + if (isset($result[$type]) && $result[$type]) + { + while ($row = $db->sql_fetchrow($result[$type])) + { + if ($type == 'g') + { + $row['name'] = $group_helper->get_name($row['name']); + } + + ${$type}[$row['id']] = array('name' => $row['name'], 'colour' => $row['colour']); + } + $db->sql_freeresult($result[$type]); + } + } + + // Now Build the address list + foreach ($address_list as $type => $adr_ary) + { + foreach ($adr_ary as $id => $field) + { + if (!isset(${$type}[$id])) + { + unset($address_list[$type][$id]); + continue; + } + + $field = ($field == 'to') ? 'to' : 'bcc'; + $type = ($type == 'u') ? 'u' : 'g'; + $id = (int) $id; + + $tpl_ary = array( + 'IS_GROUP' => ($type == 'g') ? true : false, + 'IS_USER' => ($type == 'u') ? true : false, + 'UG_ID' => $id, + 'NAME' => ${$type}[$id]['name'], + 'COLOUR' => (${$type}[$id]['colour']) ? '#' . ${$type}[$id]['colour'] : '', + 'TYPE' => $type, + ); + + if ($type == 'u') + { + $tpl_ary = array_merge($tpl_ary, array( + 'U_VIEW' => get_username_string('profile', $id, ${$type}[$id]['name'], ${$type}[$id]['colour']), + 'NAME_FULL' => get_username_string('full', $id, ${$type}[$id]['name'], ${$type}[$id]['colour']), + )); + } + else + { + $tpl_ary = array_merge($tpl_ary, array( + 'U_VIEW' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $id), + )); + } + + $template->assign_block_vars($field . '_recipient', $tpl_ary); + } + } + } + + // Build hidden address list + $s_hidden_address_field = build_address_field($address_list); + + $bbcode_checked = (isset($enable_bbcode)) ? !$enable_bbcode : (($config['allow_bbcode'] && $auth->acl_get('u_pm_bbcode')) ? !$user->optionget('bbcode') : 1); + $smilies_checked = (isset($enable_smilies)) ? !$enable_smilies : (($config['allow_smilies'] && $auth->acl_get('u_pm_smilies')) ? !$user->optionget('smilies') : 1); + $urls_checked = (isset($enable_urls)) ? !$enable_urls : 0; + $sig_checked = $enable_sig; + + switch ($action) + { + case 'post': + $page_title = $user->lang['POST_NEW_PM']; + break; + + case 'quote': + $page_title = $user->lang['POST_QUOTE_PM']; + break; + + case 'quotepost': + $page_title = $user->lang['POST_PM_POST']; + break; + + case 'reply': + $page_title = $user->lang['POST_REPLY_PM']; + break; + + case 'edit': + $page_title = $user->lang['POST_EDIT_PM']; + break; + + case 'forward': + $page_title = $user->lang['POST_FORWARD_PM']; + break; + + default: + trigger_error('NO_ACTION_MODE', E_USER_ERROR); + break; + } + + $s_hidden_fields = (isset($check_value)) ? '' : ''; + $s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '' : ''; + + $form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_pm_attach'] || !$auth->acl_get('u_pm_attach')) ? '' : ' enctype="multipart/form-data"'; + + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + + // Start assigning vars for main posting page ... + $template_ary = array( + 'L_POST_A' => $page_title, + 'L_ICON' => $user->lang['PM_ICON'], + 'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']), + + 'SUBJECT' => (isset($message_subject)) ? $message_subject : '', + 'MESSAGE' => $message_text, + 'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), + 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'URL_STATUS' => ($url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], + 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['PM']), + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'MAX_RECIPIENTS' => ($config['allow_mass_pm'] && ($auth->acl_get('u_masspm') || $auth->acl_get('u_masspm_group'))) ? $max_recipients : 0, + + 'S_COMPOSE_PM' => true, + 'S_EDIT_POST' => ($action == 'edit'), + 'S_SHOW_PM_ICONS' => $s_pm_icons, + 'S_BBCODE_ALLOWED' => ($bbcode_status) ? 1 : 0, + 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', + 'S_SMILIES_ALLOWED' => $smilies_status, + 'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '', + 'S_SIG_ALLOWED' => ($config['allow_sig'] && $config['allow_sig_pm'] && $auth->acl_get('u_sig')), + 'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '', + 'S_LINKS_ALLOWED' => $url_status, + 'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '', + 'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $action != 'edit') ? true : false, + 'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $drafts), + 'S_FORM_ENCTYPE' => $form_enctype, + 'S_ATTACH_DATA' => json_encode($message_parser->attachment_data), + + 'S_BBCODE_IMG' => $img_status, + 'S_BBCODE_FLASH' => $flash_status, + 'S_BBCODE_QUOTE' => true, + 'S_BBCODE_URL' => $url_status, + + 'S_POST_ACTION' => $s_action, + 'S_HIDDEN_ADDRESS_FIELD' => $s_hidden_address_field, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + + 'S_CLOSE_PROGRESS_WINDOW' => isset($_POST['add_file']), + 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup'), + 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", 'f=0&mode=popup')), + ); + + /** + * Modify the default template vars + * + * @event core.ucp_pm_compose_template + * @var array template_ary Template variables + * @since 3.2.6-RC1 + */ + $vars = array('template_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_template', compact($vars))); + + $template->assign_vars($template_ary); + + // Build custom bbcodes array + display_custom_bbcodes(); + + // Show attachment box for adding attachments if true + $allowed = ($auth->acl_get('u_pm_attach') && $config['allow_pm_attach'] && $form_enctype); + + if ($allowed) + { + $max_files = ($auth->acl_gets('a_', 'm_')) ? 0 : (int) $config['max_attachments_pm']; + $plupload->configure($cache, $template, $s_action, false, $max_files); + } + + // Attachment entry + posting_gen_attachment_entry($attachment_data, $filename_data, $allowed); + + // Message History + if ($action == 'reply' || $action == 'quote' || $action == 'forward') + { + if (message_history($msg_id, $user->data['user_id'], $post, array(), true)) + { + $template->assign_var('S_DISPLAY_HISTORY', true); + } + } +} + +/** +* For composing messages, handle list actions +*/ +function handle_message_list_actions(&$address_list, &$error, $remove_u, $remove_g, $add_to, $add_bcc) +{ + global $auth, $db, $user; + global $request, $phpbb_dispatcher; + + // Delete User [TO/BCC] + if ($remove_u && $request->variable('remove_u', array(0 => ''))) + { + $remove_user_id = array_keys($request->variable('remove_u', array(0 => ''))); + + if (isset($remove_user_id[0])) + { + unset($address_list['u'][(int) $remove_user_id[0]]); + } + } + + // Delete Group [TO/BCC] + if ($remove_g && $request->variable('remove_g', array(0 => ''))) + { + $remove_group_id = array_keys($request->variable('remove_g', array(0 => ''))); + + if (isset($remove_group_id[0])) + { + unset($address_list['g'][(int) $remove_group_id[0]]); + } + } + + // Add Selected Groups + $group_list = $request->variable('group_list', array(0)); + + // Build usernames to add + $usernames = $request->variable('username', '', true); + $usernames = (empty($usernames)) ? array() : array($usernames); + + $username_list = $request->variable('username_list', '', true); + if ($username_list) + { + $usernames = array_merge($usernames, explode("\n", $username_list)); + } + + // If add to or add bcc not pressed, users could still have usernames listed they want to add... + if (!$add_to && !$add_bcc && (count($group_list) || count($usernames))) + { + $add_to = true; + + global $refresh, $submit, $preview; + + $refresh = true; + $submit = false; + + // Preview is only true if there was also a message entered + if ($request->variable('message', '')) + { + $preview = true; + } + } + + // Add User/Group [TO] + if ($add_to || $add_bcc) + { + $type = ($add_to) ? 'to' : 'bcc'; + + if (count($group_list)) + { + foreach ($group_list as $group_id) + { + $address_list['g'][$group_id] = $type; + } + } + + // User ID's to add... + $user_id_ary = array(); + + // Reveal the correct user_ids + if (count($usernames)) + { + $user_id_ary = array(); + user_get_id_name($user_id_ary, $usernames, array(USER_NORMAL, USER_FOUNDER, USER_INACTIVE)); + + // If there are users not existing, we will at least print a notice... + if (!count($user_id_ary)) + { + $error[] = $user->lang['PM_NO_USERS']; + } + } + + // Add Friends if specified + $friend_list = array_keys($request->variable('add_' . $type, array(0))); + $user_id_ary = array_merge($user_id_ary, $friend_list); + + foreach ($user_id_ary as $user_id) + { + if ($user_id == ANONYMOUS) + { + continue; + } + + $address_list['u'][$user_id] = $type; + } + } + + // Check for disallowed recipients + if (!empty($address_list['u'])) + { + $can_ignore_allow_pm = $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'); + + // Administrator deactivated users check and we need to check their + // PM status (do they want to receive PM's?) + // Only check PM status if not a moderator or admin, since they + // are allowed to override this user setting + $sql = 'SELECT user_id, user_allow_pm + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', array_keys($address_list['u'])) . ' + AND ( + (user_type = ' . USER_INACTIVE . ' + AND user_inactive_reason = ' . INACTIVE_MANUAL . ') + ' . ($can_ignore_allow_pm ? '' : ' OR user_allow_pm = 0') . ' + )'; + + $result = $db->sql_query($sql); + + $removed_no_pm = $removed_no_permission = false; + while ($row = $db->sql_fetchrow($result)) + { + if (!$can_ignore_allow_pm && !$row['user_allow_pm']) + { + $removed_no_pm = true; + } + else + { + $removed_no_permission = true; + } + + unset($address_list['u'][$row['user_id']]); + } + $db->sql_freeresult($result); + + // print a notice about users not being added who do not want to receive pms + if ($removed_no_pm) + { + $error[] = $user->lang['PM_USERS_REMOVED_NO_PM']; + } + + // print a notice about users not being added who do not have permission to receive PMs + if ($removed_no_permission) + { + $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; + } + + if (!count(array_keys($address_list['u']))) + { + return; + } + + // Check if users have permission to read PMs + $can_read = $auth->acl_get_list(array_keys($address_list['u']), 'u_readpm'); + $can_read = (empty($can_read) || !isset($can_read[0]['u_readpm'])) ? array() : $can_read[0]['u_readpm']; + $cannot_read_list = array_diff(array_keys($address_list['u']), $can_read); + if (!empty($cannot_read_list)) + { + foreach ($cannot_read_list as $cannot_read) + { + unset($address_list['u'][$cannot_read]); + } + + $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; + } + + // Check if users are banned + $banned_user_list = phpbb_get_banned_user_ids(array_keys($address_list['u']), false); + if (!empty($banned_user_list)) + { + foreach ($banned_user_list as $banned_user) + { + unset($address_list['u'][$banned_user]); + } + + $error[] = $user->lang['PM_USERS_REMOVED_NO_PERMISSION']; + } + } + + /** + * Event for additional message list actions + * + * @event core.message_list_actions + * @var array address_list The assoc array with the recipient user/group ids + * @var array error The array containing error data + * @var bool remove_u The variable for removing a user + * @var bool remove_g The variable for removing a group + * @var bool add_to The variable for adding a user to the [TO] field + * @var bool add_bcc The variable for adding a user to the [BCC] field + * @since 3.2.4-RC1 + */ + $vars = array('address_list', 'error', 'remove_u', 'remove_g', 'add_to', 'add_bcc'); + extract($phpbb_dispatcher->trigger_event('core.message_list_actions', compact($vars))); +} + +/** +* Build the hidden field for the recipients. Needed, as the variable is not read via $request->variable(). +*/ +function build_address_field($address_list) +{ + $s_hidden_address_field = ''; + foreach ($address_list as $type => $adr_ary) + { + foreach ($adr_ary as $id => $field) + { + $s_hidden_address_field .= ''; + } + } + return $s_hidden_address_field; +} + +/** +* Return number of private message recipients +*/ +function num_recipients($address_list) +{ + $num_recipients = 0; + + foreach ($address_list as $field => $adr_ary) + { + $num_recipients += count($adr_ary); + } + + return $num_recipients; +} + +/** +* Get number of 'num_recipients' recipients from first position +*/ +function get_recipients($address_list, $num_recipients = 1) +{ + $recipient = array(); + + $count = 0; + foreach ($address_list as $field => $adr_ary) + { + foreach ($adr_ary as $id => $type) + { + if ($count >= $num_recipients) + { + break 2; + } + $recipient[$field][$id] = $type; + $count++; + } + } + + return $recipient; +} diff --git a/install/update/old/includes/ucp/ucp_pm_viewfolder.php b/install/update/old/includes/ucp/ucp_pm_viewfolder.php new file mode 100644 index 0000000..09e7bf4 --- /dev/null +++ b/install/update/old/includes/ucp/ucp_pm_viewfolder.php @@ -0,0 +1,604 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* View message folder +* Called from ucp_pm with mode == 'view' && action == 'view_folder' +*/ +function view_folder($id, $mode, $folder_id, $folder) +{ + global $user, $template, $auth, $db, $cache, $request; + global $phpbb_root_path, $config, $phpEx; + + $submit_export = (isset($_POST['submit_export'])) ? true : false; + + $folder_info = get_pm_from($folder_id, $folder, $user->data['user_id']); + + if (!$submit_export) + { + $user->add_lang('viewforum'); + + // Grab icons + $icons = $cache->obtain_icons(); + + $color_rows = array('message_reported', 'marked', 'replied'); + + $_module = new p_master(); + $_module->list_modules('ucp'); + $_module->set_active('zebra'); + + $zebra_enabled = ($_module->active_module === false) ? false : true; + + unset($_module); + + if ($zebra_enabled) + { + $color_rows = array_merge($color_rows, array('friend', 'foe')); + } + + foreach ($color_rows as $var) + { + $template->assign_block_vars('pm_colour_info', array( + 'IMG' => $user->img("pm_{$var}", ''), + 'CLASS' => "pm_{$var}_colour", + 'LANG' => $user->lang[strtoupper($var) . '_MESSAGE']) + ); + } + + $mark_options = array('mark_important', 'delete_marked'); + + // Minimise edits + if (!$auth->acl_get('u_pm_delete') && $key = array_search('delete_marked', $mark_options)) + { + unset($mark_options[$key]); + } + + $s_mark_options = ''; + foreach ($mark_options as $mark_option) + { + $s_mark_options .= ''; + } + + // We do the folder moving options here too, for template authors to use... + $s_folder_move_options = ''; + if ($folder_id != PRIVMSGS_NO_BOX && $folder_id != PRIVMSGS_OUTBOX) + { + foreach ($folder as $f_id => $folder_ary) + { + if ($f_id == PRIVMSGS_OUTBOX || $f_id == PRIVMSGS_SENTBOX || $f_id == $folder_id) + { + continue; + } + + $s_folder_move_options .= ''; + $s_folder_move_options .= sprintf($user->lang['MOVE_MARKED_TO_FOLDER'], $folder_ary['folder_name']); + $s_folder_move_options .= (($folder_ary['unread_messages']) ? ' [' . $folder_ary['unread_messages'] . '] ' : '') . ''; + } + } + $friend = $foe = array(); + + // Get friends and foes + $sql = 'SELECT * + FROM ' . ZEBRA_TABLE . ' + WHERE user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $friend[$row['zebra_id']] = $row['friend']; + $foe[$row['zebra_id']] = $row['foe']; + } + $db->sql_freeresult($result); + + $template->assign_vars(array( + 'S_MARK_OPTIONS' => $s_mark_options, + 'S_MOVE_MARKED_OPTIONS' => $s_folder_move_options) + ); + + // Okay, lets dump out the page ... + if (count($folder_info['pm_list'])) + { + $address_list = array(); + + // Build Recipient List if in outbox/sentbox - max two additional queries + if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) + { + $address_list = get_recipient_strings($folder_info['rowset']); + } + + foreach ($folder_info['pm_list'] as $message_id) + { + $row = &$folder_info['rowset'][$message_id]; + + $folder_img = ($row['pm_unread']) ? 'pm_unread' : 'pm_read'; + $folder_alt = ($row['pm_unread']) ? 'NEW_MESSAGES' : 'NO_NEW_MESSAGES'; + + // Generate all URIs ... + $view_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=view&f=$folder_id&p=$message_id"); + $remove_message_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=$id&mode=compose&action=delete&p=$message_id"); + + $row_indicator = ''; + foreach ($color_rows as $var) + { + if (($var !== 'friend' && $var !== 'foe' && $row[($var === 'message_reported') ? $var : "pm_{$var}"]) + || + (($var === 'friend' || $var === 'foe') && isset(${$var}[$row['author_id']]) && ${$var}[$row['author_id']])) + { + $row_indicator = $var; + break; + } + } + + // Send vars to template + $template->assign_block_vars('messagerow', array( + 'PM_CLASS' => ($row_indicator) ? 'pm_' . $row_indicator . '_colour' : '', + + 'MESSAGE_AUTHOR_FULL' => get_username_string('full', $row['author_id'], $row['username'], $row['user_colour'], $row['username']), + 'MESSAGE_AUTHOR_COLOUR' => get_username_string('colour', $row['author_id'], $row['username'], $row['user_colour'], $row['username']), + 'MESSAGE_AUTHOR' => get_username_string('username', $row['author_id'], $row['username'], $row['user_colour'], $row['username']), + 'U_MESSAGE_AUTHOR' => get_username_string('profile', $row['author_id'], $row['username'], $row['user_colour'], $row['username']), + + 'FOLDER_ID' => $folder_id, + 'MESSAGE_ID' => $message_id, + 'SENT_TIME' => $user->format_date($row['message_time']), + 'SUBJECT' => censor_text($row['message_subject']), + 'FOLDER' => (isset($folder[$row['folder_id']])) ? $folder[$row['folder_id']]['folder_name'] : '', + 'U_FOLDER' => (isset($folder[$row['folder_id']])) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'folder=' . $row['folder_id']) : '', + 'PM_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? '' : '', + 'PM_ICON_URL' => (!empty($icons[$row['icon_id']])) ? $config['icons_path'] . '/' . $icons[$row['icon_id']]['img'] : '', + 'FOLDER_IMG' => $user->img($folder_img, $folder_alt), + 'FOLDER_IMG_STYLE' => $folder_img, + 'PM_IMG' => ($row_indicator) ? $user->img('pm_' . $row_indicator, '') : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_pm_download') && $row['message_attachment'] && $config['allow_pm_attach']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + + 'S_PM_UNREAD' => ($row['pm_unread']) ? true : false, + 'S_PM_DELETED' => ($row['pm_deleted']) ? true : false, + 'S_PM_REPORTED' => (isset($row['report_id'])) ? true : false, + 'S_AUTHOR_DELETED' => ($row['author_id'] == ANONYMOUS) ? true : false, + + 'U_VIEW_PM' => ($row['pm_deleted']) ? '' : $view_message_url, + 'U_REMOVE_PM' => ($row['pm_deleted']) ? $remove_message_url : '', + 'U_MCP_REPORT' => (isset($row['report_id'])) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=pm_reports&mode=pm_report_details&r=' . $row['report_id']) : '', + 'RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? implode($user->lang['COMMA_SEPARATOR'], $address_list[$message_id]) : '') + ); + } + unset($folder_info['rowset']); + + $template->assign_vars(array( + 'S_SHOW_RECIPIENTS' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? true : false, + 'S_SHOW_COLOUR_LEGEND' => true, + + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'PM_REPORTED'), + 'S_PM_ICONS' => ($config['enable_pm_icons']) ? true : false) + ); + } + } + else + { + $export_type = $request->variable('export_option', ''); + $enclosure = $request->variable('enclosure', ''); + $delimiter = $request->variable('delimiter', ''); + + if ($export_type == 'CSV' && ($delimiter === '' || $enclosure === '')) + { + $template->assign_var('PROMPT', true); + } + else + { + // Build Recipient List if in outbox/sentbox + + $address_temp = $address = $data = array(); + + if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) + { + foreach ($folder_info['rowset'] as $message_id => $row) + { + $address_temp[$message_id] = rebuild_header(array('to' => $row['to_address'], 'bcc' => $row['bcc_address'])); + $address[$message_id] = array(); + } + } + + foreach ($folder_info['pm_list'] as $message_id) + { + $row = &$folder_info['rowset'][$message_id]; + + include_once($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + + $sql = 'SELECT p.message_text, p.bbcode_uid + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE t.user_id = ' . $user->data['user_id'] . " + AND p.author_id = u.user_id + AND t.folder_id = $folder_id + AND t.msg_id = p.msg_id + AND p.msg_id = $message_id"; + $result = $db->sql_query_limit($sql, 1); + $message_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $_types = array('u', 'g'); + foreach ($_types as $ug_type) + { + if (isset($address_temp[$message_id][$ug_type]) && count($address_temp[$message_id][$ug_type])) + { + if (!isset($address[$message_id][$ug_type])) + { + $address[$message_id][$ug_type] = array(); + } + if ($ug_type == 'u') + { + $sql = 'SELECT user_id as id, username as name + FROM ' . USERS_TABLE . ' + WHERE '; + } + else + { + $sql = 'SELECT group_id as id, group_name as name + FROM ' . GROUPS_TABLE . ' + WHERE '; + } + $sql .= $db->sql_in_set(($ug_type == 'u') ? 'user_id' : 'group_id', array_map('intval', array_keys($address_temp[$message_id][$ug_type]))); + + $result = $db->sql_query($sql); + + while ($info_row = $db->sql_fetchrow($result)) + { + $address[$message_id][$ug_type][$address_temp[$message_id][$ug_type][$info_row['id']]][] = $info_row['name']; + unset($address_temp[$message_id][$ug_type][$info_row['id']]); + } + $db->sql_freeresult($result); + } + } + + // There is the chance that all recipients of the message got deleted. To avoid creating + // exports without recipients, we add a bogus "undisclosed recipient". + if (!(isset($address[$message_id]['g']) && count($address[$message_id]['g'])) && + !(isset($address[$message_id]['u']) && count($address[$message_id]['u']))) + { + $address[$message_id]['u'] = array(); + $address[$message_id]['u']['to'] = array(); + $address[$message_id]['u']['to'][] = $user->lang['UNDISCLOSED_RECIPIENT']; + } + + decode_message($message_row['message_text'], $message_row['bbcode_uid']); + + $data[] = array( + 'subject' => censor_text($row['message_subject']), + 'sender' => $row['username'], + // ISO 8601 date. For PHP4 we are able to hardcode the timezone because $user->format_date() does not set it. + 'date' => $user->format_date($row['message_time'], 'c', true), + 'to' => ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) ? $address[$message_id] : '', + 'message' => $message_row['message_text'] + ); + } + + switch ($export_type) + { + case 'CSV': + case 'CSV_EXCEL': + $mimetype = 'text/csv'; + $filetype = 'csv'; + + if ($export_type == 'CSV_EXCEL') + { + $enclosure = '"'; + $delimiter = ','; + $newline = "\r\n"; + } + else + { + $newline = "\n"; + } + + $string = ''; + foreach ($data as $value) + { + $recipients = $value['to']; + $value['to'] = $value['bcc'] = ''; + + if (is_array($recipients)) + { + foreach ($recipients as $values) + { + $value['bcc'] .= (isset($values['bcc']) && is_array($values['bcc'])) ? ',' . implode(',', $values['bcc']) : ''; + $value['to'] .= (isset($values['to']) && is_array($values['to'])) ? ',' . implode(',', $values['to']) : ''; + } + + // Remove the commas which will appear before the first entry. + $value['to'] = substr($value['to'], 1); + $value['bcc'] = substr($value['bcc'], 1); + } + + foreach ($value as $tag => $text) + { + $cell = str_replace($enclosure, $enclosure . $enclosure, $text); + + if (strpos($cell, $enclosure) !== false || strpos($cell, $delimiter) !== false || strpos($cell, $newline) !== false) + { + $string .= $enclosure . $text . $enclosure . $delimiter; + } + else + { + $string .= $cell . $delimiter; + } + } + $string = substr($string, 0, -1) . $newline; + } + break; + + case 'XML': + $mimetype = 'application/xml'; + $filetype = 'xml'; + $string = '' . "\n"; + $string .= "\n"; + + foreach ($data as $value) + { + $string .= "\t\n"; + + if (is_array($value['to'])) + { + foreach ($value['to'] as $key => $values) + { + foreach ($values as $type => $types) + { + foreach ($types as $name) + { + $string .= "\t\t$name\n"; + } + } + } + } + + unset($value['to']); + + foreach ($value as $tag => $text) + { + $string .= "\t\t<$tag>$text\n"; + } + + $string .= "\t\n"; + } + $string .= ''; + break; + } + + header('Cache-Control: private, no-cache'); + header("Content-Type: $mimetype; name=\"data.$filetype\""); + header("Content-disposition: attachment; filename=data.$filetype"); + echo $string; + exit; + } + } +} + +/** +* Get Messages from folder/user +*/ +function get_pm_from($folder_id, $folder, $user_id) +{ + global $user, $db, $template, $config, $auth, $phpbb_container, $phpbb_root_path, $phpEx, $request, $phpbb_dispatcher; + + $start = $request->variable('start', 0); + + // Additional vars later, pm ordering is mostly different from post ordering. :/ + $sort_days = $request->variable('st', 0); + $sort_key = $request->variable('sk', 't'); + $sort_dir = $request->variable('sd', 'd'); + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + // PM ordering options + $limit_days = array(0 => $user->lang['ALL_MESSAGES'], 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']); + + // No sort by Author for sentbox/outbox (already only author available) + // Also, sort by msg_id for the time - private messages are not as prone to errors as posts are. + if ($folder_id == PRIVMSGS_OUTBOX || $folder_id == PRIVMSGS_SENTBOX) + { + $sort_by_text = array('t' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_sql = array('t' => 'p.message_time', 's' => array('p.message_subject', 'p.message_time')); + } + else + { + $sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); + $sort_by_sql = array('a' => array('u.username_clean', 'p.message_time'), 't' => 'p.message_time', 's' => array('p.message_subject', 'p.message_time')); + } + + $s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + + $folder_sql = 't.folder_id = ' . (int) $folder_id; + + // Limit pms to certain time frame, obtain correct pm count + if ($sort_days) + { + $min_post_time = time() - ($sort_days * 86400); + + if (isset($_POST['sort'])) + { + $start = 0; + } + + $sql = 'SELECT COUNT(t.msg_id) AS pm_count + FROM ' . PRIVMSGS_TO_TABLE . ' t, ' . PRIVMSGS_TABLE . " p + WHERE $folder_sql + AND t.user_id = $user_id + AND t.msg_id = p.msg_id + AND p.message_time >= $min_post_time"; + $result = $db->sql_query_limit($sql, 1); + $pm_count = (int) $db->sql_fetchfield('pm_count'); + $db->sql_freeresult($result); + + $sql_limit_time = "AND p.message_time >= $min_post_time"; + } + else + { + $pm_count = (!empty($folder[$folder_id]['num_messages'])) ? $folder[$folder_id]['num_messages'] : 0; + $sql_limit_time = ''; + } + + $base_url = append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id&$u_sort_param"); + $start = $pagination->validate_start($start, $config['topics_per_page'], $pm_count); + $pagination->generate_template_pagination($base_url, 'pagination', 'start', $pm_count, $config['topics_per_page'], $start); + + $template_vars = array( + 'TOTAL_MESSAGES' => $user->lang('VIEW_PM_MESSAGES', (int) $pm_count), + + 'POST_IMG' => (!$auth->acl_get('u_sendpm')) ? $user->img('button_topic_locked', 'POST_PM_LOCKED') : $user->img('button_pm_new', 'POST_NEW_PM'), + + 'S_NO_AUTH_SEND_MESSAGE' => !$auth->acl_get('u_sendpm'), + + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_TOPIC_ICONS' => ($config['enable_pm_icons']) ? true : false, + + 'U_POST_NEW_TOPIC' => ($auth->acl_get('u_sendpm')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose') : '', + 'S_PM_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", "i=pm&mode=view&action=view_folder&f=$folder_id" . (($start !== 0) ? "&start=$start" : '')), + ); + + /** + * Modify template variables before they are assigned + * + * @event core.ucp_pm_view_folder_get_pm_from_template + * @var int folder_id Folder ID + * @var array folder Folder data + * @var int user_id User ID + * @var string base_url Pagination base URL + * @var int start Pagination start + * @var int pm_count Count of PMs + * @var array template_vars Template variables to be assigned + * @since 3.1.11-RC1 + */ + $vars = array( + 'folder_id', + 'folder', + 'user_id', + 'base_url', + 'start', + 'pm_count', + 'template_vars', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_template', compact($vars))); + + $template->assign_vars($template_vars); + + // Grab all pm data + $rowset = $pm_list = array(); + + // If the user is trying to reach late pages, start searching from the end + $store_reverse = false; + $sql_limit = $config['topics_per_page']; + if ($start > $pm_count / 2) + { + $store_reverse = true; + + // Select the sort order + $direction = ($sort_dir == 'd') ? 'ASC' : 'DESC'; + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $pm_count); + $sql_start = $pagination->reverse_start($start, $sql_limit, $pm_count); + } + else + { + // Select the sort order + $direction = ($sort_dir == 'd') ? 'DESC' : 'ASC'; + $sql_start = $start; + } + + // Sql sort order + if (is_array($sort_by_sql[$sort_key])) + { + $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; + } + else + { + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; + } + + $sql_ary = array( + 'SELECT' => 't.*, p.root_level, p.message_time, p.message_subject, p.icon_id, p.to_address, p.message_attachment, p.bcc_address, u.username, u.username_clean, u.user_colour, p.message_reported', + 'FROM' => array( + PRIVMSGS_TO_TABLE => 't', + PRIVMSGS_TABLE => 'p', + USERS_TABLE => 'u', + ), + 'WHERE' => "t.user_id = $user_id + AND p.author_id = u.user_id + AND $folder_sql + AND t.msg_id = p.msg_id + $sql_limit_time", + 'ORDER_BY' => $sql_sort_order, + ); + + /** + * Modify SQL before it is executed + * + * @event core.ucp_pm_view_folder_get_pm_from_sql + * @var array sql_ary SQL array + * @var int sql_limit SQL limit + * @var int sql_start SQL start + * @since 3.1.11-RC1 + */ + $vars = array( + 'sql_ary', + 'sql_limit', + 'sql_start', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_pm_view_folder_get_pm_from_sql', compact($vars))); + + $result = $db->sql_query_limit($db->sql_build_query('SELECT', $sql_ary), $sql_limit, $sql_start); + + $pm_reported = array(); + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['msg_id']] = $row; + $pm_list[] = $row['msg_id']; + if ($row['message_reported']) + { + $pm_reported[] = $row['msg_id']; + } + } + $db->sql_freeresult($result); + + // Fetch the report_ids, if there are any reported pms. + if (!empty($pm_reported) && $auth->acl_getf_global('m_report')) + { + $sql = 'SELECT pm_id, report_id + FROM ' . REPORTS_TABLE . ' + WHERE report_closed = 0 + AND ' . $db->sql_in_set('pm_id', $pm_reported); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $rowset[$row['pm_id']]['report_id'] = $row['report_id']; + } + $db->sql_freeresult($result); + } + + $pm_list = ($store_reverse) ? array_reverse($pm_list) : $pm_list; + + return array( + 'pm_count' => $pm_count, + 'pm_list' => $pm_list, + 'rowset' => $rowset + ); +} diff --git a/install/update/old/includes/ucp/ucp_profile.php b/install/update/old/includes/ucp/ucp_profile.php new file mode 100644 index 0000000..9a12840 --- /dev/null +++ b/install/update/old/includes/ucp/ucp_profile.php @@ -0,0 +1,847 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ucp_profile +* Changing profile settings +* +* @todo what about pertaining user_sig_options? +*/ +class ucp_profile +{ + var $u_action; + + function main($id, $mode) + { + global $config, $db, $user, $auth, $template, $phpbb_root_path, $phpEx; + global $request, $phpbb_container, $phpbb_log, $phpbb_dispatcher; + + $user->add_lang('posting'); + + $submit = $request->variable('submit', false, false, \phpbb\request\request_interface::POST); + $error = $data = array(); + $s_hidden_fields = ''; + + switch ($mode) + { + case 'reg_details': + + $data = array( + 'username' => $request->variable('username', $user->data['username'], true), + 'email' => strtolower($request->variable('email', $user->data['user_email'])), + 'new_password' => $request->variable('new_password', '', true), + 'cur_password' => $request->variable('cur_password', '', true), + 'password_confirm' => $request->variable('password_confirm', '', true), + ); + + /** + * Modify user registration data on editing account settings in UCP + * + * @event core.ucp_profile_reg_details_data + * @var array data Array with current or updated user registration data + * @var bool submit Flag indicating if submit button has been pressed + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_data', compact($vars))); + + add_form_key('ucp_reg_details'); + + if ($submit) + { + // Do not check cur_password, it is the old one. + $check_ary = array( + 'new_password' => array( + array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + array('password')), + 'password_confirm' => array('string', true, $config['min_pass_chars'], $config['max_pass_chars']), + 'email' => array( + array('string', false, 6, 60), + array('user_email')), + ); + + if ($auth->acl_get('u_chgname') && $config['allow_namechange']) + { + $check_ary['username'] = array( + array('string', false, $config['min_name_chars'], $config['max_name_chars']), + array('username'), + ); + } + + $error = validate_data($data, $check_ary); + + if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && $data['password_confirm'] != $data['new_password']) + { + $error[] = ($data['password_confirm']) ? 'NEW_PASSWORD_ERROR' : 'NEW_PASSWORD_CONFIRM_EMPTY'; + } + + // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + + // Only check the new password against the previous password if there have been no errors + if (!count($error) && $auth->acl_get('u_chgpasswd') && $data['new_password'] && $passwords_manager->check($data['new_password'], $user->data['user_password'])) + { + $error[] = 'SAME_PASSWORD_ERROR'; + } + + if (!$passwords_manager->check($data['cur_password'], $user->data['user_password'])) + { + $error[] = ($data['cur_password']) ? 'CUR_PASSWORD_ERROR' : 'CUR_PASSWORD_EMPTY'; + } + + if (!check_form_key('ucp_reg_details')) + { + $error[] = 'FORM_INVALID'; + } + + /** + * Validate user data on editing registration data in UCP + * + * @event core.ucp_profile_reg_details_validate + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @var array error Array of any generated errors + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit', 'error'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_validate', compact($vars))); + + if (!count($error)) + { + $sql_ary = array( + 'username' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? $data['username'] : $user->data['username'], + 'username_clean' => ($auth->acl_get('u_chgname') && $config['allow_namechange']) ? utf8_clean_string($data['username']) : $user->data['username_clean'], + 'user_email' => ($auth->acl_get('u_chgemail')) ? $data['email'] : $user->data['user_email'], + 'user_email_hash' => ($auth->acl_get('u_chgemail')) ? phpbb_email_hash($data['email']) : $user->data['user_email_hash'], + 'user_password' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? $passwords_manager->hash($data['new_password']) : $user->data['user_password'], + 'user_passchg' => ($auth->acl_get('u_chgpasswd') && $data['new_password']) ? time() : 0, + ); + + if ($auth->acl_get('u_chgname') && $config['allow_namechange'] && $data['username'] != $user->data['username']) + { + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_NAME', false, array( + 'reportee_id' => $user->data['user_id'], + $user->data['username'], + $data['username'] + )); + } + + if ($auth->acl_get('u_chgpasswd') && $data['new_password'] && !$passwords_manager->check($data['new_password'], $user->data['user_password'])) + { + $user->reset_login_keys(); + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_NEW_PASSWORD', false, array( + 'reportee_id' => $user->data['user_id'], + $user->data['username'] + )); + } + + if ($auth->acl_get('u_chgemail') && $data['email'] != $user->data['user_email']) + { + $phpbb_log->add('user', $user->data['user_id'], $user->ip, 'LOG_USER_UPDATE_EMAIL', false, array( + 'reportee_id' => $user->data['user_id'], + $user->data['username'], + $user->data['user_email'], + $data['email'] + )); + } + + $message = 'PROFILE_UPDATED'; + + if ($auth->acl_get('u_chgemail') && $config['email_enable'] && $data['email'] != $user->data['user_email'] && $user->data['user_type'] != USER_FOUNDER && ($config['require_activation'] == USER_ACTIVATION_SELF || $config['require_activation'] == USER_ACTIVATION_ADMIN)) + { + $message = ($config['require_activation'] == USER_ACTIVATION_SELF) ? 'ACCOUNT_EMAIL_CHANGED' : 'ACCOUNT_EMAIL_CHANGED_ADMIN'; + + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $server_url = generate_board_url(); + + $user_actkey = gen_rand_string(mt_rand(6, 10)); + + $messenger = new messenger(false); + + $template_file = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? 'user_activate_inactive' : 'user_activate'; + $messenger->template($template_file, $user->data['user_lang']); + + $messenger->to($data['email'], $data['username']); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($data['username']), + 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey") + ); + + $messenger->send(NOTIFY_EMAIL); + + if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + { + $notifications_manager = $phpbb_container->get('notification_manager'); + $notifications_manager->add_notifications('notification.type.admin_activate_user', array( + 'user_id' => $user->data['user_id'], + 'user_actkey' => $user_actkey, + 'user_regdate' => time(), // Notification time + )); + } + + user_active_flip('deactivate', $user->data['user_id'], INACTIVE_PROFILE); + + // Because we want the profile to be reactivated we set user_newpasswd to empty (else the reactivation will fail) + $sql_ary['user_actkey'] = $user_actkey; + $sql_ary['user_newpasswd'] = ''; + } + + /** + * Modify user registration data before submitting it to the database + * + * @event core.ucp_profile_reg_details_sql_ary + * @var array data Array with current or updated user registration data + * @var array sql_ary Array with user registration data to submit to the database + * @since 3.1.4-RC1 + */ + $vars = array('data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_reg_details_sql_ary', compact($vars))); + + if (count($sql_ary)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + } + + // Need to update config, forum, topic, posting, messages, etc. + if ($data['username'] != $user->data['username'] && $auth->acl_get('u_chgname') && $config['allow_namechange']) + { + user_update_name($user->data['username'], $data['username']); + } + + // Now, we can remove the user completely (kill the session) - NOT BEFORE!!! + if (!empty($sql_ary['user_actkey'])) + { + meta_refresh(5, append_sid($phpbb_root_path . 'index.' . $phpEx)); + $message = $user->lang[$message] . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + + // Because the user gets deactivated we log him out too, killing his session + $user->session_kill(); + } + else + { + meta_refresh(3, $this->u_action); + $message = $user->lang[$message] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + } + + trigger_error($message); + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + $template->assign_vars(array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + + 'USERNAME' => $data['username'], + 'EMAIL' => $data['email'], + 'PASSWORD_CONFIRM' => $data['password_confirm'], + 'NEW_PASSWORD' => $data['new_password'], + 'CUR_PASSWORD' => '', + + 'L_USERNAME_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), + 'L_CHANGE_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), + + 'S_FORCE_PASSWORD' => ($auth->acl_get('u_chgpasswd') && $config['chg_passforce'] && $user->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) ? true : false, + 'S_CHANGE_USERNAME' => ($config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false, + 'S_CHANGE_EMAIL' => ($auth->acl_get('u_chgemail')) ? true : false, + 'S_CHANGE_PASSWORD' => ($auth->acl_get('u_chgpasswd')) ? true : false) + ); + break; + + case 'profile_info': + // Do not display profile information panel if not authed to do so + if (!$auth->acl_get('u_chgprofileinfo')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_PROFILEINFO'); + } + + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + + $cp_data = $cp_error = array(); + + $data = array( + 'jabber' => $request->variable('jabber', $user->data['user_jabber'], true), + ); + + if ($config['allow_birthdays']) + { + $data['bday_day'] = $data['bday_month'] = $data['bday_year'] = 0; + + if ($user->data['user_birthday']) + { + list($data['bday_day'], $data['bday_month'], $data['bday_year']) = explode('-', $user->data['user_birthday']); + } + + $data['bday_day'] = $request->variable('bday_day', $data['bday_day']); + $data['bday_month'] = $request->variable('bday_month', $data['bday_month']); + $data['bday_year'] = $request->variable('bday_year', $data['bday_year']); + $data['user_birthday'] = sprintf('%2d-%2d-%4d', $data['bday_day'], $data['bday_month'], $data['bday_year']); + } + + /** + * Modify user data on editing profile in UCP + * + * @event core.ucp_profile_modify_profile_info + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_modify_profile_info', compact($vars))); + + add_form_key('ucp_profile_info'); + + if ($submit) + { + $validate_array = array( + 'jabber' => array( + array('string', true, 5, 255), + array('jabber')), + ); + + if ($config['allow_birthdays']) + { + $validate_array = array_merge($validate_array, array( + 'bday_day' => array('num', true, 1, 31), + 'bday_month' => array('num', true, 1, 12), + 'bday_year' => array('num', true, 1901, gmdate('Y', time()) + 50), + 'user_birthday' => array('date', true), + )); + } + + $error = validate_data($data, $validate_array); + + // validate custom profile fields + $cp->submit_cp_field('profile', $user->get_iso_lang_id(), $cp_data, $cp_error); + + if (count($cp_error)) + { + $error = array_merge($error, $cp_error); + } + + if (!check_form_key('ucp_profile_info')) + { + $error[] = 'FORM_INVALID'; + } + + /** + * Validate user data on editing profile in UCP + * + * @event core.ucp_profile_validate_profile_info + * @var array data Array with user profile data + * @var bool submit Flag indicating if submit button has been pressed + * @var array error Array of any generated errors + * @since 3.1.4-RC1 + */ + $vars = array('data', 'submit', 'error'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_validate_profile_info', compact($vars))); + + if (!count($error)) + { + $data['notify'] = $user->data['user_notify_type']; + + if ($data['notify'] == NOTIFY_IM && (!$config['jab_enable'] || !$data['jabber'] || !@extension_loaded('xml'))) + { + // User has not filled in a jabber address (Or one of the modules is disabled or jabber is disabled) + // Disable notify by Jabber now for this user. + $data['notify'] = NOTIFY_EMAIL; + } + + $sql_ary = array( + 'user_jabber' => $data['jabber'], + 'user_notify_type' => $data['notify'], + ); + + if ($config['allow_birthdays']) + { + $sql_ary['user_birthday'] = $data['user_birthday']; + } + + /** + * Modify profile data in UCP before submitting to the database + * + * @event core.ucp_profile_info_modify_sql_ary + * @var array cp_data Array with the user custom profile fields data + * @var array data Array with user profile data + * @var array sql_ary user options data we update + * @since 3.1.4-RC1 + */ + $vars = array('cp_data', 'data', 'sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_info_modify_sql_ary', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + + // Update Custom Fields + $cp->update_profile_field_data($user->data['user_id'], $cp_data); + + meta_refresh(3, $this->u_action); + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + if ($config['allow_birthdays']) + { + $s_birthday_day_options = ''; + for ($i = 1; $i < 32; $i++) + { + $selected = ($i == $data['bday_day']) ? ' selected="selected"' : ''; + $s_birthday_day_options .= ""; + } + + $s_birthday_month_options = ''; + for ($i = 1; $i < 13; $i++) + { + $selected = ($i == $data['bday_month']) ? ' selected="selected"' : ''; + $s_birthday_month_options .= ""; + } + + $now = getdate(); + $s_birthday_year_options = ''; + for ($i = $now['year'] - 100; $i <= $now['year']; $i++) + { + $selected = ($i == $data['bday_year']) ? ' selected="selected"' : ''; + $s_birthday_year_options .= ""; + } + unset($now); + + $template->assign_vars(array( + 'S_BIRTHDAY_DAY_OPTIONS' => $s_birthday_day_options, + 'S_BIRTHDAY_MONTH_OPTIONS' => $s_birthday_month_options, + 'S_BIRTHDAY_YEAR_OPTIONS' => $s_birthday_year_options, + 'S_BIRTHDAYS_ENABLED' => true, + )); + } + + $template->assign_vars(array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'S_JABBER_ENABLED' => $config['jab_enable'], + 'JABBER' => $data['jabber'], + )); + + // Get additional profile fields and assign them to the template block var 'profile_fields' + $user->get_profile_fields($user->data['user_id']); + + $cp->generate_profile_fields('profile', $user->get_iso_lang_id()); + + break; + + case 'signature': + + if (!$auth->acl_get('u_sig')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_SIGNATURE'); + } + + if (!function_exists('generate_smilies')) + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } + + if (!function_exists('display_custom_bbcodes')) + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $preview = $request->is_set_post('preview'); + + $enable_bbcode = ($config['allow_sig_bbcode']) ? $user->optionget('sig_bbcode') : false; + $enable_smilies = ($config['allow_sig_smilies']) ? $user->optionget('sig_smilies') : false; + $enable_urls = ($config['allow_sig_links']) ? $user->optionget('sig_links') : false; + + $bbcode_flags = ($enable_bbcode ? OPTION_FLAG_BBCODE : 0) + ($enable_smilies ? OPTION_FLAG_SMILIES : 0) + ($enable_urls ? OPTION_FLAG_LINKS : 0); + + $decoded_message = generate_text_for_edit($user->data['user_sig'], $user->data['user_sig_bbcode_uid'], $bbcode_flags); + $signature = $request->variable('signature', $decoded_message['text'], true); + $signature_preview = ''; + + if ($submit || $preview) + { + $enable_bbcode = ($config['allow_sig_bbcode']) ? !$request->variable('disable_bbcode', false) : false; + $enable_smilies = ($config['allow_sig_smilies']) ? !$request->variable('disable_smilies', false) : false; + $enable_urls = ($config['allow_sig_links']) ? !$request->variable('disable_magic_url', false) : false; + + if (!check_form_key('ucp_sig')) + { + $error[] = 'FORM_INVALID'; + } + } + + /** + * Modify user signature on editing profile in UCP + * + * @event core.ucp_profile_modify_signature + * @var bool enable_bbcode Whether or not bbcode is enabled + * @var bool enable_smilies Whether or not smilies are enabled + * @var bool enable_urls Whether or not urls are enabled + * @var string signature Users signature text + * @var array error Any error strings + * @var bool submit Whether or not the form has been sumitted + * @var bool preview Whether or not the signature is being previewed + * @since 3.1.10-RC1 + * @changed 3.2.0-RC2 Removed message parser + */ + $vars = array( + 'enable_bbcode', + 'enable_smilies', + 'enable_urls', + 'signature', + 'error', + 'submit', + 'preview', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_modify_signature', compact($vars))); + + $bbcode_uid = $bbcode_bitfield = $bbcode_flags = ''; + $warn_msg = generate_text_for_storage( + $signature, + $bbcode_uid, + $bbcode_bitfield, + $bbcode_flags, + $enable_bbcode, + $enable_urls, + $enable_smilies, + $config['allow_sig_img'], + $config['allow_sig_flash'], + true, + $config['allow_sig_links'], + 'sig' + ); + + if (count($warn_msg)) + { + $error += $warn_msg; + } + + if (!$submit) + { + // Parse it for displaying + $signature_preview = generate_text_for_display($signature, $bbcode_uid, $bbcode_bitfield, $bbcode_flags); + } + else + { + if (!count($error)) + { + $user->optionset('sig_bbcode', $enable_bbcode); + $user->optionset('sig_smilies', $enable_smilies); + $user->optionset('sig_links', $enable_urls); + + $sql_ary = array( + 'user_sig' => $signature, + 'user_options' => $user->data['user_options'], + 'user_sig_bbcode_uid' => $bbcode_uid, + 'user_sig_bbcode_bitfield' => $bbcode_bitfield + ); + + /** + * Modify user registration data before submitting it to the database + * + * @event core.ucp_profile_modify_signature_sql_ary + * @var array sql_ary Array with user signature data to submit to the database + * @since 3.1.10-RC1 + */ + $vars = array('sql_ary'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_modify_signature_sql_ary', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . $user->data['user_id']; + $db->sql_query($sql); + + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + + if ($request->is_set_post('preview')) + { + $decoded_message = generate_text_for_edit($signature, $bbcode_uid, $bbcode_flags); + } + + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + + $template->assign_vars(array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'SIGNATURE' => $decoded_message['text'], + 'SIGNATURE_PREVIEW' => $signature_preview, + + 'S_BBCODE_CHECKED' => (!$enable_bbcode) ? ' checked="checked"' : '', + 'S_SMILIES_CHECKED' => (!$enable_smilies) ? ' checked="checked"' : '', + 'S_MAGIC_URL_CHECKED' => (!$enable_urls) ? ' checked="checked"' : '', + + 'BBCODE_STATUS' => $user->lang(($config['allow_sig_bbcode'] ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), + 'SMILIES_STATUS' => ($config['allow_sig_smilies']) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'IMG_STATUS' => ($config['allow_sig_img']) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($config['allow_sig_flash']) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'URL_STATUS' => ($config['allow_sig_links']) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + 'MAX_FONT_SIZE' => (int) $config['max_sig_font_size'], + + 'L_SIGNATURE_EXPLAIN' => $user->lang('SIGNATURE_EXPLAIN', (int) $config['max_sig_chars']), + + 'S_BBCODE_ALLOWED' => $config['allow_sig_bbcode'], + 'S_SMILIES_ALLOWED' => $config['allow_sig_smilies'], + 'S_BBCODE_IMG' => ($config['allow_sig_img']) ? true : false, + 'S_BBCODE_FLASH' => ($config['allow_sig_flash']) ? true : false, + 'S_LINKS_ALLOWED' => ($config['allow_sig_links']) ? true : false) + ); + + add_form_key('ucp_sig'); + + // Build custom bbcodes array + display_custom_bbcodes(); + + // Generate smiley listing + generate_smilies('inline', 0); + + break; + + case 'avatar': + + add_form_key('ucp_avatar'); + + $avatars_enabled = false; + + if ($config['allow_avatar'] && $auth->acl_get('u_chgavatar')) + { + /* @var $phpbb_avatar_manager \phpbb\avatar\manager */ + $phpbb_avatar_manager = $phpbb_container->get('avatar.manager'); + $avatar_drivers = $phpbb_avatar_manager->get_enabled_drivers(); + + // This is normalised data, without the user_ prefix + $avatar_data = \phpbb\avatar\manager::clean_row($user->data, 'user'); + + if ($submit) + { + if (check_form_key('ucp_avatar')) + { + $driver_name = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', '')); + + if (in_array($driver_name, $avatar_drivers) && !$request->is_set_post('avatar_delete')) + { + $driver = $phpbb_avatar_manager->get_driver($driver_name); + $result = $driver->process_form($request, $template, $user, $avatar_data, $error); + + if ($result && empty($error)) + { + // Success! Lets save the result in the database + $result = array( + 'user_avatar_type' => $driver_name, + 'user_avatar' => $result['avatar'], + 'user_avatar_width' => $result['avatar_width'], + 'user_avatar_height' => $result['avatar_height'], + ); + + /** + * Trigger events on successfull avatar change + * + * @event core.ucp_profile_avatar_sql + * @var array result Array with data to be stored in DB + * @since 3.1.11-RC1 + */ + $vars = array('result'); + extract($phpbb_dispatcher->trigger_event('core.ucp_profile_avatar_sql', compact($vars))); + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $result) . ' + WHERE user_id = ' . (int) $user->data['user_id']; + $db->sql_query($sql); + + meta_refresh(3, $this->u_action); + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + } + } + else + { + $error[] = 'FORM_INVALID'; + } + } + + // Handle deletion of avatars + if ($request->is_set_post('avatar_delete')) + { + if (!confirm_box(true)) + { + confirm_box(false, $user->lang('CONFIRM_AVATAR_DELETE'), build_hidden_fields(array( + 'avatar_delete' => true, + 'i' => $id, + 'mode' => $mode)) + ); + } + else + { + $phpbb_avatar_manager->handle_avatar_delete($db, $user, $avatar_data, USERS_TABLE, 'user_'); + + meta_refresh(3, $this->u_action); + $message = $user->lang['PROFILE_UPDATED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + } + + $selected_driver = $phpbb_avatar_manager->clean_driver_name($request->variable('avatar_driver', $user->data['user_avatar_type'])); + + $template->assign_vars(array( + 'AVATAR_MIN_WIDTH' => $config['avatar_min_width'], + 'AVATAR_MAX_WIDTH' => $config['avatar_max_width'], + 'AVATAR_MIN_HEIGHT' => $config['avatar_min_height'], + 'AVATAR_MAX_HEIGHT' => $config['avatar_max_height'], + )); + + foreach ($avatar_drivers as $current_driver) + { + $driver = $phpbb_avatar_manager->get_driver($current_driver); + + $avatars_enabled = true; + $template->set_filenames(array( + 'avatar' => $driver->get_template_name(), + )); + + if ($driver->prepare_form($request, $template, $user, $avatar_data, $error)) + { + $driver_name = $phpbb_avatar_manager->prepare_driver_name($current_driver); + $driver_upper = strtoupper($driver_name); + + $template->assign_block_vars('avatar_drivers', array( + 'L_TITLE' => $user->lang($driver_upper . '_TITLE'), + 'L_EXPLAIN' => $user->lang($driver_upper . '_EXPLAIN'), + + 'DRIVER' => $driver_name, + 'SELECTED' => $current_driver == $selected_driver, + 'OUTPUT' => $template->assign_display('avatar'), + )); + } + } + + // Replace "error" strings with their real, localised form + $error = $phpbb_avatar_manager->localize_errors($user, $error); + } + + $avatar = phpbb_get_user_avatar($user->data, 'USER_AVATAR', true); + + $template->assign_vars(array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'AVATAR' => $avatar, + + 'S_FORM_ENCTYPE' => ' enctype="multipart/form-data"', + + 'L_AVATAR_EXPLAIN' => phpbb_avatar_explanation_string(), + + 'S_AVATARS_ENABLED' => ($config['allow_avatar'] && $avatars_enabled), + )); + + break; + + case 'autologin_keys': + + add_form_key('ucp_autologin_keys'); + + if ($submit) + { + $keys = $request->variable('keys', array('')); + + if (!check_form_key('ucp_autologin_keys')) + { + $error[] = 'FORM_INVALID'; + } + + if (!count($error)) + { + if (!empty($keys)) + { + foreach ($keys as $key => $id) + { + $keys[$key] = $db->sql_like_expression($id . $db->get_any_char()); + } + $sql_where = '(key_id ' . implode(' OR key_id ', $keys) . ')'; + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE user_id = ' . (int) $user->data['user_id'] . ' + AND ' . $sql_where ; + + $db->sql_query($sql); + + meta_refresh(3, $this->u_action); + $message = $user->lang['AUTOLOGIN_SESSION_KEYS_DELETED'] . '

' . sprintf($user->lang['RETURN_UCP'], '', ''); + trigger_error($message); + } + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + } + + $sql = 'SELECT key_id, last_ip, last_login + FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE user_id = ' . (int) $user->data['user_id'] . ' + ORDER BY last_login ASC'; + + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $template->assign_block_vars('sessions', array( + 'KEY' => substr($row['key_id'], 0, 8), + 'IP' => $row['last_ip'], + 'LOGIN_TIME' => $user->format_date($row['last_login']), + )); + } + + $db->sql_freeresult($result); + + break; + } + + $template->assign_vars(array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + + 'L_TITLE' => $user->lang['UCP_PROFILE_' . strtoupper($mode)], + + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_UCP_ACTION' => $this->u_action) + ); + + // Set desired template + $this->tpl_name = 'ucp_profile_' . $mode; + $this->page_title = 'UCP_PROFILE_' . strtoupper($mode); + } +} diff --git a/install/update/old/includes/ucp/ucp_register.php b/install/update/old/includes/ucp/ucp_register.php new file mode 100644 index 0000000..0e673cb --- /dev/null +++ b/install/update/old/includes/ucp/ucp_register.php @@ -0,0 +1,709 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ucp_register +* Board registration +*/ +class ucp_register +{ + var $u_action; + + function main($id, $mode) + { + global $config, $db, $user, $template, $phpbb_root_path, $phpEx; + global $request, $phpbb_container, $phpbb_dispatcher; + + // + if ($config['require_activation'] == USER_ACTIVATION_DISABLE || + (in_array($config['require_activation'], array(USER_ACTIVATION_SELF, USER_ACTIVATION_ADMIN)) && !$config['email_enable'])) + { + trigger_error('UCP_REGISTER_DISABLE'); + } + + $coppa = $request->is_set('coppa') ? (int) $request->variable('coppa', false) : false; + $agreed = $request->variable('agreed', false); + $submit = $request->is_set_post('submit'); + $change_lang = $request->variable('change_lang', ''); + $user_lang = $request->variable('lang', $user->lang_name); + + /** + * Add UCP register data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_requests_after + * @var bool coppa Is set coppa + * @var bool agreed Did user agree to coppa? + * @var bool submit Is set post submit? + * @var string change_lang Change language request + * @var string user_lang User language request + * @since 3.1.11-RC1 + */ + $vars = array( + 'coppa', + 'agreed', + 'submit', + 'change_lang', + 'user_lang', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_requests_after', compact($vars))); + + if ($agreed) + { + add_form_key('ucp_register'); + } + else + { + add_form_key('ucp_register_terms'); + } + + if ($change_lang || $user_lang != $config['default_lang']) + { + $use_lang = ($change_lang) ? basename($change_lang) : basename($user_lang); + + if (!validate_language_iso_name($use_lang)) + { + if ($change_lang) + { + $submit = false; + + // Setting back agreed to let the user view the agreement in his/her language + $agreed = false; + } + + $user_lang = $use_lang; + } + else + { + $change_lang = ''; + $user_lang = $user->lang_name; + } + } + + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + + $error = $cp_data = $cp_error = array(); + $s_hidden_fields = array(); + + // Handle login_link data added to $_hidden_fields + $login_link_data = $this->get_login_link_data_array(); + + if (!empty($login_link_data)) + { + // Confirm that we have all necessary data + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $auth_provider = $provider_collection->get_provider($request->variable('auth_provider', '')); + + $result = $auth_provider->login_link_has_necessary_data($login_link_data); + if ($result !== null) + { + $error[] = $user->lang[$result]; + } + + $s_hidden_fields = array_merge($s_hidden_fields, $this->get_login_link_data_for_hidden_fields($login_link_data)); + } + + if (!$agreed || ($coppa === false && $config['coppa_enable']) || ($coppa && !$config['coppa_enable'])) + { + $add_coppa = ($coppa !== false) ? '&coppa=' . $coppa : ''; + + $s_hidden_fields = array_merge($s_hidden_fields, array( + 'change_lang' => '', + )); + + // If we change the language, we want to pass on some more possible parameter. + if ($change_lang) + { + // We do not include the password + $s_hidden_fields = array_merge($s_hidden_fields, array( + 'username' => $request->variable('username', '', true), + 'email' => strtolower($request->variable('email', '')), + 'lang' => $user->lang_name, + 'tz' => $request->variable('tz', $config['board_timezone']), + )); + + } + + // Checking amount of available languages + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE; + $result = $db->sql_query($sql); + + $lang_row = array(); + while ($row = $db->sql_fetchrow($result)) + { + $lang_row[] = $row; + } + $db->sql_freeresult($result); + + if ($coppa === false && $config['coppa_enable']) + { + $now = getdate(); + $coppa_birthday = $user->create_datetime() + ->setDate($now['year'] - 13, $now['mon'], $now['mday'] - 1) + ->setTime(0, 0, 0) + ->format($user->lang['DATE_FORMAT'], true); + unset($now); + + $template_vars = array( + 'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '', + 'L_COPPA_NO' => sprintf($user->lang['UCP_COPPA_BEFORE'], $coppa_birthday), + 'L_COPPA_YES' => sprintf($user->lang['UCP_COPPA_ON_AFTER'], $coppa_birthday), + + 'U_COPPA_NO' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=0'), + 'U_COPPA_YES' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register&coppa=1'), + + 'S_SHOW_COPPA' => true, + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), + + 'COOKIE_NAME' => $config['cookie_name'], + 'COOKIE_PATH' => $config['cookie_path'], + ); + } + else + { + $template_vars = array( + 'S_LANG_OPTIONS' => (count($lang_row) > 1) ? language_select($user_lang) : '', + 'L_TERMS_OF_USE' => sprintf($user->lang['TERMS_OF_USE_CONTENT'], $config['sitename'], generate_board_url()), + + 'S_SHOW_COPPA' => false, + 'S_REGISTRATION' => true, + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register' . $add_coppa), + + 'COOKIE_NAME' => $config['cookie_name'], + 'COOKIE_PATH' => $config['cookie_path'], + ); + } + + $tpl_name = 'ucp_agreement'; + + /** + * Allows to modify the agreements. + * + * @event core.ucp_register_agreement_modify_template_data + * @var string tpl_name Template file + * @var array template_vars Array with data about to be assigned to the template + * @var array s_hidden_fields Array with hidden form elements + * @var array lang_row Array with available languages, read only + * @since 3.2.2-RC1 + */ + $vars = array('tpl_name', 'template_vars', 's_hidden_fields', 'lang_row'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_agreement_modify_template_data', compact($vars))); + + unset($lang_row); + + $template_vars = array_merge($template_vars, array( + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + )); + + $template->assign_vars($template_vars); + + /** + * Allows to modify the agreements. + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_agreement + * @since 3.1.6-RC1 + * @deprecated 3.2.2-RC1 Replaced by core.ucp_register_agreement_modify_template_data and to be removed in 3.3.0-RC1 + */ + $phpbb_dispatcher->dispatch('core.ucp_register_agreement'); + + $this->tpl_name = $tpl_name; + return; + } + + // The CAPTCHA kicks in here. We can't help that the information gets lost on language change. + if ($config['enable_confirm']) + { + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_REG); + } + + $timezone = $config['board_timezone']; + + $data = array( + 'username' => $request->variable('username', '', true), + 'new_password' => $request->variable('new_password', '', true), + 'password_confirm' => $request->variable('password_confirm', '', true), + 'email' => strtolower($request->variable('email', '')), + 'lang' => basename($request->variable('lang', $user->lang_name)), + 'tz' => $request->variable('tz', $timezone), + ); + /** + * Add UCP register data before they are assigned to the template or submitted + * + * To assign data to the template, use $template->assign_vars() + * + * @event core.ucp_register_data_before + * @var bool submit Do we display the form only + * or did the user press submit + * @var array data Array with current ucp registration data + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'data'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_data_before', compact($vars))); + + // Check and initialize some variables if needed + if ($submit) + { + $error = validate_data($data, array( + 'username' => array( + array('string', false, $config['min_name_chars'], $config['max_name_chars']), + array('username', '')), + 'new_password' => array( + array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), + array('password')), + 'password_confirm' => array('string', false, $config['min_pass_chars'], $config['max_pass_chars']), + 'email' => array( + array('string', false, 6, 60), + array('user_email')), + 'tz' => array('timezone'), + 'lang' => array('language_iso_name'), + )); + + if (!check_form_key('ucp_register')) + { + $error[] = $user->lang['FORM_INVALID']; + } + + // Replace "error" strings with their real, localised form + $error = array_map(array($user, 'lang'), $error); + + if ($config['enable_confirm']) + { + $vc_response = $captcha->validate($data); + if ($vc_response !== false) + { + $error[] = $vc_response; + } + + if ($config['max_reg_attempts'] && $captcha->get_attempt_count() > $config['max_reg_attempts']) + { + $error[] = $user->lang['TOO_MANY_REGISTERS']; + } + } + + // DNSBL check + if ($config['check_dnsbl']) + { + if (($dnsbl = $user->check_dnsbl('register')) !== false) + { + $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]); + } + } + + // validate custom profile fields + $cp->submit_cp_field('register', $user->get_iso_lang_id(), $cp_data, $error); + + if (!count($error)) + { + if ($data['new_password'] != $data['password_confirm']) + { + $error[] = $user->lang['NEW_PASSWORD_ERROR']; + } + } + /** + * Check UCP registration data after they are submitted + * + * @event core.ucp_register_data_after + * @var bool submit Do we display the form only + * or did the user press submit + * @var array data Array with current ucp registration data + * @var array cp_data Array with custom profile fields data + * @var array error Array with list of errors + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'data', 'cp_data', 'error'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_data_after', compact($vars))); + + if (!count($error)) + { + $server_url = generate_board_url(); + + // Which group by default? + $group_name = ($coppa) ? 'REGISTERED_COPPA' : 'REGISTERED'; + + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $db->sql_escape($group_name) . "' + AND group_type = " . GROUP_SPECIAL; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + $group_id = $row['group_id']; + + if (($coppa || + $config['require_activation'] == USER_ACTIVATION_SELF || + $config['require_activation'] == USER_ACTIVATION_ADMIN) && $config['email_enable']) + { + $user_actkey = gen_rand_string(mt_rand(6, 10)); + $user_type = USER_INACTIVE; + $user_inactive_reason = INACTIVE_REGISTER; + $user_inactive_time = time(); + } + else + { + $user_type = USER_NORMAL; + $user_actkey = ''; + $user_inactive_reason = 0; + $user_inactive_time = 0; + } + + // Instantiate passwords manager + /* @var $passwords_manager \phpbb\passwords\manager */ + $passwords_manager = $phpbb_container->get('passwords.manager'); + + $user_row = array( + 'username' => $data['username'], + 'user_password' => $passwords_manager->hash($data['new_password']), + 'user_email' => $data['email'], + 'group_id' => (int) $group_id, + 'user_timezone' => $data['tz'], + 'user_lang' => $data['lang'], + 'user_type' => $user_type, + 'user_actkey' => $user_actkey, + 'user_ip' => $user->ip, + 'user_regdate' => time(), + 'user_inactive_reason' => $user_inactive_reason, + 'user_inactive_time' => $user_inactive_time, + ); + + if ($config['new_member_post_limit']) + { + $user_row['user_new'] = 1; + } + /** + * Add into $user_row before user_add + * + * user_add allows adding more data into the users table + * + * @event core.ucp_register_user_row_after + * @var bool submit Do we display the form only + * or did the user press submit + * @var array cp_data Array with custom profile fields data + * @var array user_row Array with current ucp registration data + * @since 3.1.4-RC1 + */ + $vars = array('submit', 'cp_data', 'user_row'); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_user_row_after', compact($vars))); + + // Register user... + $user_id = user_add($user_row, $cp_data); + + // This should not happen, because the required variables are listed above... + if ($user_id === false) + { + trigger_error('NO_USER', E_USER_ERROR); + } + + // Okay, captcha, your job is done. + if ($config['enable_confirm'] && isset($captcha)) + { + $captcha->reset(); + } + + if ($coppa && $config['email_enable']) + { + $message = $user->lang['ACCOUNT_COPPA']; + $email_template = 'coppa_welcome_inactive'; + } + else if ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) + { + $message = $user->lang['ACCOUNT_INACTIVE']; + $email_template = 'user_welcome_inactive'; + } + else if ($config['require_activation'] == USER_ACTIVATION_ADMIN && $config['email_enable']) + { + $message = $user->lang['ACCOUNT_INACTIVE_ADMIN']; + $email_template = 'admin_welcome_inactive'; + } + else + { + $message = $user->lang['ACCOUNT_ADDED']; + $email_template = 'user_welcome'; + } + + if ($config['email_enable']) + { + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $messenger = new messenger(false); + + $messenger->template($email_template, $data['lang']); + + $messenger->to($data['email'], $data['username']); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'USERNAME' => htmlspecialchars_decode($data['username']), + 'PASSWORD' => htmlspecialchars_decode($data['new_password']), + 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey") + ); + + if ($coppa) + { + $messenger->assign_vars(array( + 'FAX_INFO' => $config['coppa_fax'], + 'MAIL_INFO' => $config['coppa_mail'], + 'EMAIL_ADDRESS' => $data['email']) + ); + } + + /** + * Modify messenger data before welcome mail is sent + * + * @event core.ucp_register_welcome_email_before + * @var array user_row Array with user registration data + * @var array cp_data Array with custom profile fields data + * @var array data Array with current ucp registration data + * @var string message Message to be displayed to the user after registration + * @var string server_url Server URL + * @var int user_id New user ID + * @var string user_actkey User activation key + * @var messenger messenger phpBB Messenger + * @since 3.2.4-RC1 + */ + $vars = array( + 'user_row', + 'cp_data', + 'data', + 'message', + 'server_url', + 'user_id', + 'user_actkey', + 'messenger', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_welcome_email_before', compact($vars))); + + $messenger->send(NOTIFY_EMAIL); + } + + if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + $phpbb_notifications->add_notifications('notification.type.admin_activate_user', array( + 'user_id' => $user_id, + 'user_actkey' => $user_row['user_actkey'], + 'user_regdate' => $user_row['user_regdate'], + )); + } + + // Perform account linking if necessary + if (!empty($login_link_data)) + { + $login_link_data['user_id'] = $user_id; + + $result = $auth_provider->link_account($login_link_data); + + if ($result) + { + $message = $message . '

' . $user->lang[$result]; + } + } + + /** + * Perform additional actions after user registration + * + * @event core.ucp_register_register_after + * @var array user_row Array with user registration data + * @var array cp_data Array with custom profile fields data + * @var array data Array with current ucp registration data + * @var string message Message to be displayed to the user after registration + * @var string server_url Server URL + * @var int user_id New user ID + * @var string user_actkey User activation key + * @since 3.2.4-RC1 + */ + $vars = array( + 'user_row', + 'cp_data', + 'data', + 'message', + 'server_url', + 'user_id', + 'user_actkey', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_register_after', compact($vars))); + + $message = $message . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + trigger_error($message); + } + } + + $s_hidden_fields = array_merge($s_hidden_fields, array( + 'agreed' => 'true', + 'change_lang' => 0, + )); + + if ($config['coppa_enable']) + { + $s_hidden_fields['coppa'] = $coppa; + } + + if ($config['enable_confirm']) + { + $s_hidden_fields = array_merge($s_hidden_fields, $captcha->get_hidden_fields()); + } + + // Visual Confirmation - Show images + if ($config['enable_confirm']) + { + $template->assign_vars(array( + 'CAPTCHA_TEMPLATE' => $captcha->get_template(), + )); + } + + // + $l_reg_cond = ''; + switch ($config['require_activation']) + { + case USER_ACTIVATION_SELF: + $l_reg_cond = $user->lang['UCP_EMAIL_ACTIVATE']; + break; + + case USER_ACTIVATION_ADMIN: + $l_reg_cond = $user->lang['UCP_ADMIN_ACTIVATE']; + break; + } + + // Assign template vars for timezone select + phpbb_timezone_select($template, $user, $data['tz'], true); + + $template_vars = array( + 'USERNAME' => $data['username'], + 'PASSWORD' => $data['new_password'], + 'PASSWORD_CONFIRM' => $data['password_confirm'], + 'EMAIL' => $data['email'], + + 'L_REG_COND' => $l_reg_cond, + 'L_USERNAME_EXPLAIN' => $user->lang($config['allow_name_chars'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_name_chars']), $user->lang('CHARACTERS', (int) $config['max_name_chars'])), + 'L_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), + + 'S_LANG_OPTIONS' => language_select($data['lang']), + 'S_TZ_PRESELECT' => !$submit, + 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false, + 'S_REGISTRATION' => true, + 'S_COPPA' => $coppa, + 'S_UCP_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=register'), + + 'COOKIE_NAME' => $config['cookie_name'], + 'COOKIE_PATH' => $config['cookie_path'], + ); + + $tpl_name = 'ucp_register'; + + /** + * Modify template data on the registration page + * + * @event core.ucp_register_modify_template_data + * @var array template_vars Array with template data + * @var array data Array with user data, read only + * @var array error Array with errors + * @var array s_hidden_fields Array with hidden field elements + * @var string tpl_name Template name + * @since 3.2.2-RC1 + */ + $vars = array( + 'template_vars', + 'data', + 'error', + 's_hidden_fields', + 'tpl_name', + ); + extract($phpbb_dispatcher->trigger_event('core.ucp_register_modify_template_data', compact($vars))); + + $template_vars = array_merge($template_vars, array( + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + )); + + $template->assign_vars($template_vars); + + // + $user->profile_fields = array(); + + // Generate profile fields -> Template Block Variable profile_fields + $cp->generate_profile_fields('register', $user->get_iso_lang_id()); + + // + $this->tpl_name = $tpl_name; + } + + /** + * Creates the login_link data array + * + * @return array Returns an array of all POST paramaters whose names + * begin with 'login_link_' + */ + protected function get_login_link_data_array() + { + global $request; + + $var_names = $request->variable_names(\phpbb\request\request_interface::POST); + $login_link_data = array(); + $string_start_length = strlen('login_link_'); + + foreach ($var_names as $var_name) + { + if (strpos($var_name, 'login_link_') === 0) + { + $key_name = substr($var_name, $string_start_length); + $login_link_data[$key_name] = $request->variable($var_name, '', false, \phpbb\request\request_interface::POST); + } + } + + return $login_link_data; + } + + /** + * Prepends they key names of an associative array with 'login_link_' for + * inclusion on the page as hidden fields. + * + * @param array $data The array to be modified + * @return array The modified array + */ + protected function get_login_link_data_for_hidden_fields($data) + { + $new_data = array(); + + foreach ($data as $key => $value) + { + $new_data['login_link_' . $key] = $value; + } + + return $new_data; + } +} diff --git a/install/update/old/includes/ucp/ucp_resend.php b/install/update/old/includes/ucp/ucp_resend.php new file mode 100644 index 0000000..44c5410 --- /dev/null +++ b/install/update/old/includes/ucp/ucp_resend.php @@ -0,0 +1,163 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* ucp_resend +* Resending activation emails +*/ +class ucp_resend +{ + var $u_action; + + function main($id, $mode) + { + global $config, $phpbb_root_path, $phpEx; + global $db, $user, $auth, $template, $request; + + $username = $request->variable('username', '', true); + $email = strtolower($request->variable('email', '')); + $submit = (isset($_POST['submit'])) ? true : false; + + add_form_key('ucp_resend'); + + if ($submit) + { + if (!check_form_key('ucp_resend')) + { + trigger_error('FORM_INVALID'); + } + + $sql = 'SELECT user_id, group_id, username, user_email, user_type, user_lang, user_actkey, user_inactive_reason + FROM ' . USERS_TABLE . " + WHERE user_email_hash = '" . $db->sql_escape(phpbb_email_hash($email)) . "' + AND username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'"; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$user_row) + { + trigger_error('NO_EMAIL_USER'); + } + + if ($user_row['user_type'] == USER_IGNORE) + { + trigger_error('NO_USER'); + } + + if (!$user_row['user_actkey'] && $user_row['user_type'] != USER_INACTIVE) + { + trigger_error('ACCOUNT_ALREADY_ACTIVATED'); + } + + if (!$user_row['user_actkey'] || ($user_row['user_type'] == USER_INACTIVE && $user_row['user_inactive_reason'] == INACTIVE_MANUAL)) + { + trigger_error('ACCOUNT_DEACTIVATED'); + } + + // Determine coppa status on group (REGISTERED(_COPPA)) + $sql = 'SELECT group_name, group_type + FROM ' . GROUPS_TABLE . ' + WHERE group_id = ' . $user_row['group_id']; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + $coppa = ($row['group_name'] == 'REGISTERED_COPPA' && $row['group_type'] == GROUP_SPECIAL) ? true : false; + + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + $messenger = new messenger(false); + + if ($config['require_activation'] == USER_ACTIVATION_SELF || $coppa) + { + $messenger->template(($coppa) ? 'coppa_resend_inactive' : 'user_resend_inactive', $user_row['user_lang']); + $messenger->set_addresses($user_row); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'WELCOME_MSG' => htmlspecialchars_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'USERNAME' => htmlspecialchars_decode($user_row['username']), + 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}") + ); + + if ($coppa) + { + $messenger->assign_vars(array( + 'FAX_INFO' => $config['coppa_fax'], + 'MAIL_INFO' => $config['coppa_mail'], + 'EMAIL_ADDRESS' => $user_row['user_email']) + ); + } + + $messenger->send(NOTIFY_EMAIL); + } + + if ($config['require_activation'] == USER_ACTIVATION_ADMIN) + { + // Grab an array of user_id's with a_user permissions ... these users can activate a user + $admin_ary = $auth->acl_get_list(false, 'a_user', false); + + $sql = 'SELECT user_id, username, user_email, user_lang, user_jabber, user_notify_type + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_id', $admin_ary[0]['a_user']); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $messenger->template('admin_activate', $row['user_lang']); + $messenger->set_addresses($row); + + $messenger->anti_abuse_headers($config, $user); + + $messenger->assign_vars(array( + 'USERNAME' => htmlspecialchars_decode($user_row['username']), + 'U_USER_DETAILS' => generate_board_url() . "/memberlist.$phpEx?mode=viewprofile&u={$user_row['user_id']}", + 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}") + ); + + $messenger->send($row['user_notify_type']); + } + $db->sql_freeresult($result); + } + + meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); + + $message = ($config['require_activation'] == USER_ACTIVATION_ADMIN) ? $user->lang['ACTIVATION_EMAIL_SENT_ADMIN'] : $user->lang['ACTIVATION_EMAIL_SENT']; + $message .= '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + trigger_error($message); + } + + $template->assign_vars(array( + 'USERNAME' => $username, + 'EMAIL' => $email, + 'S_PROFILE_ACTION' => append_sid($phpbb_root_path . 'ucp.' . $phpEx, 'mode=resend_act')) + ); + + $this->tpl_name = 'ucp_resend'; + $this->page_title = 'UCP_RESEND'; + } +} diff --git a/install/update/old/includes/utf/utf_tools.php b/install/update/old/includes/utf/utf_tools.php new file mode 100644 index 0000000..89de454 --- /dev/null +++ b/install/update/old/includes/utf/utf_tools.php @@ -0,0 +1,1450 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +// Enforce ASCII only string handling +setlocale(LC_CTYPE, 'C'); + +/** +* Setup the UTF-8 portability layer +*/ +Patchwork\Utf8\Bootup::initUtf8Encode(); +Patchwork\Utf8\Bootup::initMbstring(); +Patchwork\Utf8\Bootup::initIntl(); + +/** +* UTF-8 tools +* +* Whenever possible, these functions will try to use PHP's built-in functions or +* extensions, otherwise they will default to custom routines. +* +*/ + +/** +* UTF-8 aware alternative to strrpos +* @ignore +*/ +function utf8_strrpos($str, $needle, $offset = null) +{ + // Emulate behaviour of strrpos rather than raising warning + if (empty($str)) + { + return false; + } + + if (is_null($offset)) + { + return mb_strrpos($str, $needle); + } + else + { + return mb_strrpos($str, $needle, $offset); + } +} + +/** +* UTF-8 aware alternative to strpos +* @ignore +*/ +function utf8_strpos($str, $needle, $offset = null) +{ + if (is_null($offset)) + { + return mb_strpos($str, $needle); + } + else + { + return mb_strpos($str, $needle, $offset); + } +} + +/** +* UTF-8 aware alternative to strtolower +* @ignore +*/ +function utf8_strtolower($str) +{ + return mb_strtolower($str); +} + +/** +* UTF-8 aware alternative to strtoupper +* @ignore +*/ +function utf8_strtoupper($str) +{ + return mb_strtoupper($str); +} + +/** +* UTF-8 aware alternative to substr +* @ignore +*/ +function utf8_substr($str, $offset, $length = null) +{ + if (is_null($length)) + { + return mb_substr($str, $offset); + } + else + { + return mb_substr($str, $offset, $length); + } +} + +/** +* Return the length (in characters) of a UTF-8 string +* @ignore +*/ +function utf8_strlen($text) +{ + return mb_strlen($text, 'utf-8'); +} + +/** +* UTF-8 aware alternative to str_split +* Convert a string to an array +* +* @author Harry Fuecks +* @param string $str UTF-8 encoded +* @param int $split_len number to characters to split string by +* @return array characters in string reverses +*/ +function utf8_str_split($str, $split_len = 1) +{ + if (!is_int($split_len) || $split_len < 1) + { + return false; + } + + $len = utf8_strlen($str); + if ($len <= $split_len) + { + return array($str); + } + + preg_match_all('/.{' . $split_len . '}|[^\x00]{1,' . $split_len . '}$/us', $str, $ar); + return $ar[0]; +} + +/** +* UTF-8 aware alternative to strspn +* Find length of initial segment matching the mask +* +* @author Harry Fuecks +*/ +function utf8_strspn($str, $mask, $start = null, $length = null) +{ + if ($start !== null || $length !== null) + { + $str = utf8_substr($str, $start, $length); + } + + preg_match('/^[' . $mask . ']+/u', $str, $matches); + + if (isset($matches[0])) + { + return utf8_strlen($matches[0]); + } + + return 0; +} + +/** +* UTF-8 aware alternative to ucfirst +* Make a string's first character uppercase +* +* @author Harry Fuecks +* @param string +* @return string with first character as upper case (if applicable) +*/ +function utf8_ucfirst($str) +{ + switch (utf8_strlen($str)) + { + case 0: + return ''; + break; + + case 1: + return utf8_strtoupper($str); + break; + + default: + preg_match('/^(.{1})(.*)$/us', $str, $matches); + return utf8_strtoupper($matches[1]) . $matches[2]; + break; + } +} + +/** +* Recode a string to UTF-8 +* +* If the encoding is not supported, the string is returned as-is +* +* @param string $string Original string +* @param string $encoding Original encoding (lowered) +* @return string The string, encoded in UTF-8 +*/ +function utf8_recode($string, $encoding) +{ + $encoding = strtolower($encoding); + + if ($encoding == 'utf-8' || !is_string($string) || empty($string)) + { + return $string; + } + + // we force iso-8859-1 to be cp1252 + if ($encoding == 'iso-8859-1') + { + $encoding = 'cp1252'; + } + // convert iso-8859-8-i to iso-8859-8 + else if ($encoding == 'iso-8859-8-i') + { + $encoding = 'iso-8859-8'; + $string = hebrev($string); + } + + // First, try iconv() + if (function_exists('iconv')) + { + $ret = @iconv($encoding, 'utf-8', $string); + + if (!empty($ret)) + { + return $ret; + } + } + + // Try the mb_string extension + if (function_exists('mb_convert_encoding')) + { + // mbstring is nasty on PHP4, we must make *sure* that we send a good encoding + switch ($encoding) + { + case 'iso-8859-1': + case 'iso-8859-2': + case 'iso-8859-4': + case 'iso-8859-7': + case 'iso-8859-9': + case 'iso-8859-15': + case 'windows-1251': + case 'windows-1252': + case 'cp1252': + case 'shift_jis': + case 'euc-kr': + case 'big5': + case 'gb2312': + $ret = @mb_convert_encoding($string, 'utf-8', $encoding); + + if (!empty($ret)) + { + return $ret; + } + } + } + + // Try the recode extension + if (function_exists('recode_string')) + { + $ret = @recode_string($encoding . '..utf-8', $string); + + if (!empty($ret)) + { + return $ret; + } + } + + // If nothing works, check if we have a custom transcoder available + if (!preg_match('#^[a-z0-9_ \\-]+$#', $encoding)) + { + // Make sure the encoding name is alphanumeric, we don't want it to be abused into loading arbitrary files + trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); + } + + global $phpbb_root_path, $phpEx; + + // iso-8859-* character encoding + if (preg_match('/iso[_ -]?8859[_ -]?(\\d+)/', $encoding, $array)) + { + switch ($array[1]) + { + case '1': + case '2': + case '4': + case '7': + case '8': + case '9': + case '15': + if (!function_exists('iso_8859_' . $array[1])) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx)) + { + trigger_error('Basic reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx); + } + return call_user_func('iso_8859_' . $array[1], $string); + break; + + default: + trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); + break; + } + } + + // CP/WIN character encoding + if (preg_match('/(?:cp|windows)[_\- ]?(\\d+)/', $encoding, $array)) + { + switch ($array[1]) + { + case '932': + break; + case '1250': + case '1251': + case '1252': + case '1254': + case '1255': + case '1256': + case '1257': + case '874': + if (!function_exists('cp' . $array[1])) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx)) + { + trigger_error('Basic reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx); + } + return call_user_func('cp' . $array[1], $string); + break; + + default: + trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); + break; + } + } + + // TIS-620 + if (preg_match('/tis[_ -]?620/', $encoding)) + { + if (!function_exists('tis_620')) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx)) + { + trigger_error('Basic reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_basic.' . $phpEx); + } + return tis_620($string); + } + + // SJIS + if (preg_match('/sjis(?:[_ -]?win)?|(?:cp|ibm)[_ -]?932|shift[_ -]?jis/', $encoding)) + { + if (!function_exists('sjis')) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx)) + { + trigger_error('CJK reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx); + } + return sjis($string); + } + + // EUC_KR + if (preg_match('/euc[_ -]?kr/', $encoding)) + { + if (!function_exists('euc_kr')) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx)) + { + trigger_error('CJK reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx); + } + return euc_kr($string); + } + + // BIG-5 + if (preg_match('/big[_ -]?5/', $encoding)) + { + if (!function_exists('big5')) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx)) + { + trigger_error('CJK reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx); + } + return big5($string); + } + + // GB2312 + if (preg_match('/gb[_ -]?2312/', $encoding)) + { + if (!function_exists('gb2312')) + { + if (!file_exists($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx)) + { + trigger_error('CJK reencoder file is missing', E_USER_ERROR); + } + include($phpbb_root_path . 'includes/utf/data/recode_cjk.' . $phpEx); + } + return gb2312($string); + } + + // Trigger an error?! Fow now just give bad data :-( + trigger_error('Unknown encoding: ' . $encoding, E_USER_ERROR); +} + +/** +* Replace all UTF-8 chars that are not in ASCII with their NCR +* +* @param string $text UTF-8 string in NFC +* @return string ASCII string using NCRs for non-ASCII chars +*/ +function utf8_encode_ncr($text) +{ + return preg_replace_callback('#[\\xC2-\\xF4][\\x80-\\xBF]{1,3}#', 'utf8_encode_ncr_callback', $text); +} + +/** +* Callback used in encode_ncr() +* +* Takes a UTF-8 char and replaces it with its NCR. Attention, $m is an array +* +* @param array $m 0-based numerically indexed array passed by preg_replace_callback() +* @return string A HTML NCR if the character is valid, or the original string otherwise +*/ +function utf8_encode_ncr_callback($m) +{ + return '&#' . utf8_ord($m[0]) . ';'; +} + +/** +* Converts a UTF-8 char to an NCR +* +* @param string $chr UTF-8 char +* @return integer UNICODE code point +*/ +function utf8_ord($chr) +{ + switch (strlen($chr)) + { + case 1: + return ord($chr); + break; + + case 2: + return ((ord($chr[0]) & 0x1F) << 6) | (ord($chr[1]) & 0x3F); + break; + + case 3: + return ((ord($chr[0]) & 0x0F) << 12) | ((ord($chr[1]) & 0x3F) << 6) | (ord($chr[2]) & 0x3F); + break; + + case 4: + return ((ord($chr[0]) & 0x07) << 18) | ((ord($chr[1]) & 0x3F) << 12) | ((ord($chr[2]) & 0x3F) << 6) | (ord($chr[3]) & 0x3F); + break; + + default: + return $chr; + } +} + +/** +* Converts an NCR to a UTF-8 char +* +* @param int $cp UNICODE code point +* @return string UTF-8 char +*/ +function utf8_chr($cp) +{ + if ($cp > 0xFFFF) + { + return chr(0xF0 | ($cp >> 18)) . chr(0x80 | (($cp >> 12) & 0x3F)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); + } + else if ($cp > 0x7FF) + { + return chr(0xE0 | ($cp >> 12)) . chr(0x80 | (($cp >> 6) & 0x3F)) . chr(0x80 | ($cp & 0x3F)); + } + else if ($cp > 0x7F) + { + return chr(0xC0 | ($cp >> 6)) . chr(0x80 | ($cp & 0x3F)); + } + else + { + return chr($cp); + } +} + +/** +* Convert Numeric Character References to UTF-8 chars +* +* Notes: +* - we do not convert NCRs recursively, if you pass &#38; it will return & +* - we DO NOT check for the existence of the Unicode characters, therefore an entity may be converted to an inexistent codepoint +* +* @param string $text String to convert, encoded in UTF-8 (no normal form required) +* @return string UTF-8 string where NCRs have been replaced with the actual chars +*/ +function utf8_decode_ncr($text) +{ + return preg_replace_callback('/&#([0-9]{1,6}|x[0-9A-F]{1,5});/i', 'utf8_decode_ncr_callback', $text); +} + +/** +* Callback used in decode_ncr() +* +* Takes a NCR (in decimal or hexadecimal) and returns a UTF-8 char. Attention, $m is an array. +* It will ignore most of invalid NCRs, but not all! +* +* @param array $m 0-based numerically indexed array passed by preg_replace_callback() +* @return string UTF-8 char +*/ +function utf8_decode_ncr_callback($m) +{ + $cp = (strncasecmp($m[1], 'x', 1)) ? $m[1] : hexdec(substr($m[1], 1)); + + return utf8_chr($cp); +} + +/** +* Case folds a unicode string as per Unicode 5.0, section 3.13 +* +* @param string $text text to be case folded +* @param string $option determines how we will fold the cases +* @return string case folded text +*/ +function utf8_case_fold($text, $option = 'full') +{ + static $uniarray = array(); + global $phpbb_root_path, $phpEx; + + // common is always set + if (!isset($uniarray['c'])) + { + $uniarray['c'] = include($phpbb_root_path . 'includes/utf/data/case_fold_c.' . $phpEx); + } + + // only set full if we need to + if ($option === 'full' && !isset($uniarray['f'])) + { + $uniarray['f'] = include($phpbb_root_path . 'includes/utf/data/case_fold_f.' . $phpEx); + } + + // only set simple if we need to + if ($option !== 'full' && !isset($uniarray['s'])) + { + $uniarray['s'] = include($phpbb_root_path . 'includes/utf/data/case_fold_s.' . $phpEx); + } + + // common is always replaced + $text = strtr($text, $uniarray['c']); + + if ($option === 'full') + { + // full replaces a character with multiple characters + $text = strtr($text, $uniarray['f']); + } + else + { + // simple replaces a character with another character + $text = strtr($text, $uniarray['s']); + } + + return $text; +} + +/** +* Takes the input and does a "special" case fold. It does minor normalization +* and returns NFKC compatable text +* +* @param string $text text to be case folded +* @param string $option determines how we will fold the cases +* @return string case folded text +*/ +function utf8_case_fold_nfkc($text, $option = 'full') +{ + static $fc_nfkc_closure = array( + "\xCD\xBA" => "\x20\xCE\xB9", + "\xCF\x92" => "\xCF\x85", + "\xCF\x93" => "\xCF\x8D", + "\xCF\x94" => "\xCF\x8B", + "\xCF\xB2" => "\xCF\x83", + "\xCF\xB9" => "\xCF\x83", + "\xE1\xB4\xAC" => "\x61", + "\xE1\xB4\xAD" => "\xC3\xA6", + "\xE1\xB4\xAE" => "\x62", + "\xE1\xB4\xB0" => "\x64", + "\xE1\xB4\xB1" => "\x65", + "\xE1\xB4\xB2" => "\xC7\x9D", + "\xE1\xB4\xB3" => "\x67", + "\xE1\xB4\xB4" => "\x68", + "\xE1\xB4\xB5" => "\x69", + "\xE1\xB4\xB6" => "\x6A", + "\xE1\xB4\xB7" => "\x6B", + "\xE1\xB4\xB8" => "\x6C", + "\xE1\xB4\xB9" => "\x6D", + "\xE1\xB4\xBA" => "\x6E", + "\xE1\xB4\xBC" => "\x6F", + "\xE1\xB4\xBD" => "\xC8\xA3", + "\xE1\xB4\xBE" => "\x70", + "\xE1\xB4\xBF" => "\x72", + "\xE1\xB5\x80" => "\x74", + "\xE1\xB5\x81" => "\x75", + "\xE1\xB5\x82" => "\x77", + "\xE2\x82\xA8" => "\x72\x73", + "\xE2\x84\x82" => "\x63", + "\xE2\x84\x83" => "\xC2\xB0\x63", + "\xE2\x84\x87" => "\xC9\x9B", + "\xE2\x84\x89" => "\xC2\xB0\x66", + "\xE2\x84\x8B" => "\x68", + "\xE2\x84\x8C" => "\x68", + "\xE2\x84\x8D" => "\x68", + "\xE2\x84\x90" => "\x69", + "\xE2\x84\x91" => "\x69", + "\xE2\x84\x92" => "\x6C", + "\xE2\x84\x95" => "\x6E", + "\xE2\x84\x96" => "\x6E\x6F", + "\xE2\x84\x99" => "\x70", + "\xE2\x84\x9A" => "\x71", + "\xE2\x84\x9B" => "\x72", + "\xE2\x84\x9C" => "\x72", + "\xE2\x84\x9D" => "\x72", + "\xE2\x84\xA0" => "\x73\x6D", + "\xE2\x84\xA1" => "\x74\x65\x6C", + "\xE2\x84\xA2" => "\x74\x6D", + "\xE2\x84\xA4" => "\x7A", + "\xE2\x84\xA8" => "\x7A", + "\xE2\x84\xAC" => "\x62", + "\xE2\x84\xAD" => "\x63", + "\xE2\x84\xB0" => "\x65", + "\xE2\x84\xB1" => "\x66", + "\xE2\x84\xB3" => "\x6D", + "\xE2\x84\xBB" => "\x66\x61\x78", + "\xE2\x84\xBE" => "\xCE\xB3", + "\xE2\x84\xBF" => "\xCF\x80", + "\xE2\x85\x85" => "\x64", + "\xE3\x89\x90" => "\x70\x74\x65", + "\xE3\x8B\x8C" => "\x68\x67", + "\xE3\x8B\x8E" => "\x65\x76", + "\xE3\x8B\x8F" => "\x6C\x74\x64", + "\xE3\x8D\xB1" => "\x68\x70\x61", + "\xE3\x8D\xB3" => "\x61\x75", + "\xE3\x8D\xB5" => "\x6F\x76", + "\xE3\x8D\xBA" => "\x69\x75", + "\xE3\x8E\x80" => "\x70\x61", + "\xE3\x8E\x81" => "\x6E\x61", + "\xE3\x8E\x82" => "\xCE\xBC\x61", + "\xE3\x8E\x83" => "\x6D\x61", + "\xE3\x8E\x84" => "\x6B\x61", + "\xE3\x8E\x85" => "\x6B\x62", + "\xE3\x8E\x86" => "\x6D\x62", + "\xE3\x8E\x87" => "\x67\x62", + "\xE3\x8E\x8A" => "\x70\x66", + "\xE3\x8E\x8B" => "\x6E\x66", + "\xE3\x8E\x8C" => "\xCE\xBC\x66", + "\xE3\x8E\x90" => "\x68\x7A", + "\xE3\x8E\x91" => "\x6B\x68\x7A", + "\xE3\x8E\x92" => "\x6D\x68\x7A", + "\xE3\x8E\x93" => "\x67\x68\x7A", + "\xE3\x8E\x94" => "\x74\x68\x7A", + "\xE3\x8E\xA9" => "\x70\x61", + "\xE3\x8E\xAA" => "\x6B\x70\x61", + "\xE3\x8E\xAB" => "\x6D\x70\x61", + "\xE3\x8E\xAC" => "\x67\x70\x61", + "\xE3\x8E\xB4" => "\x70\x76", + "\xE3\x8E\xB5" => "\x6E\x76", + "\xE3\x8E\xB6" => "\xCE\xBC\x76", + "\xE3\x8E\xB7" => "\x6D\x76", + "\xE3\x8E\xB8" => "\x6B\x76", + "\xE3\x8E\xB9" => "\x6D\x76", + "\xE3\x8E\xBA" => "\x70\x77", + "\xE3\x8E\xBB" => "\x6E\x77", + "\xE3\x8E\xBC" => "\xCE\xBC\x77", + "\xE3\x8E\xBD" => "\x6D\x77", + "\xE3\x8E\xBE" => "\x6B\x77", + "\xE3\x8E\xBF" => "\x6D\x77", + "\xE3\x8F\x80" => "\x6B\xCF\x89", + "\xE3\x8F\x81" => "\x6D\xCF\x89", + "\xE3\x8F\x83" => "\x62\x71", + "\xE3\x8F\x86" => "\x63\xE2\x88\x95\x6B\x67", + "\xE3\x8F\x87" => "\x63\x6F\x2E", + "\xE3\x8F\x88" => "\x64\x62", + "\xE3\x8F\x89" => "\x67\x79", + "\xE3\x8F\x8B" => "\x68\x70", + "\xE3\x8F\x8D" => "\x6B\x6B", + "\xE3\x8F\x8E" => "\x6B\x6D", + "\xE3\x8F\x97" => "\x70\x68", + "\xE3\x8F\x99" => "\x70\x70\x6D", + "\xE3\x8F\x9A" => "\x70\x72", + "\xE3\x8F\x9C" => "\x73\x76", + "\xE3\x8F\x9D" => "\x77\x62", + "\xE3\x8F\x9E" => "\x76\xE2\x88\x95\x6D", + "\xE3\x8F\x9F" => "\x61\xE2\x88\x95\x6D", + "\xF0\x9D\x90\x80" => "\x61", + "\xF0\x9D\x90\x81" => "\x62", + "\xF0\x9D\x90\x82" => "\x63", + "\xF0\x9D\x90\x83" => "\x64", + "\xF0\x9D\x90\x84" => "\x65", + "\xF0\x9D\x90\x85" => "\x66", + "\xF0\x9D\x90\x86" => "\x67", + "\xF0\x9D\x90\x87" => "\x68", + "\xF0\x9D\x90\x88" => "\x69", + "\xF0\x9D\x90\x89" => "\x6A", + "\xF0\x9D\x90\x8A" => "\x6B", + "\xF0\x9D\x90\x8B" => "\x6C", + "\xF0\x9D\x90\x8C" => "\x6D", + "\xF0\x9D\x90\x8D" => "\x6E", + "\xF0\x9D\x90\x8E" => "\x6F", + "\xF0\x9D\x90\x8F" => "\x70", + "\xF0\x9D\x90\x90" => "\x71", + "\xF0\x9D\x90\x91" => "\x72", + "\xF0\x9D\x90\x92" => "\x73", + "\xF0\x9D\x90\x93" => "\x74", + "\xF0\x9D\x90\x94" => "\x75", + "\xF0\x9D\x90\x95" => "\x76", + "\xF0\x9D\x90\x96" => "\x77", + "\xF0\x9D\x90\x97" => "\x78", + "\xF0\x9D\x90\x98" => "\x79", + "\xF0\x9D\x90\x99" => "\x7A", + "\xF0\x9D\x90\xB4" => "\x61", + "\xF0\x9D\x90\xB5" => "\x62", + "\xF0\x9D\x90\xB6" => "\x63", + "\xF0\x9D\x90\xB7" => "\x64", + "\xF0\x9D\x90\xB8" => "\x65", + "\xF0\x9D\x90\xB9" => "\x66", + "\xF0\x9D\x90\xBA" => "\x67", + "\xF0\x9D\x90\xBB" => "\x68", + "\xF0\x9D\x90\xBC" => "\x69", + "\xF0\x9D\x90\xBD" => "\x6A", + "\xF0\x9D\x90\xBE" => "\x6B", + "\xF0\x9D\x90\xBF" => "\x6C", + "\xF0\x9D\x91\x80" => "\x6D", + "\xF0\x9D\x91\x81" => "\x6E", + "\xF0\x9D\x91\x82" => "\x6F", + "\xF0\x9D\x91\x83" => "\x70", + "\xF0\x9D\x91\x84" => "\x71", + "\xF0\x9D\x91\x85" => "\x72", + "\xF0\x9D\x91\x86" => "\x73", + "\xF0\x9D\x91\x87" => "\x74", + "\xF0\x9D\x91\x88" => "\x75", + "\xF0\x9D\x91\x89" => "\x76", + "\xF0\x9D\x91\x8A" => "\x77", + "\xF0\x9D\x91\x8B" => "\x78", + "\xF0\x9D\x91\x8C" => "\x79", + "\xF0\x9D\x91\x8D" => "\x7A", + "\xF0\x9D\x91\xA8" => "\x61", + "\xF0\x9D\x91\xA9" => "\x62", + "\xF0\x9D\x91\xAA" => "\x63", + "\xF0\x9D\x91\xAB" => "\x64", + "\xF0\x9D\x91\xAC" => "\x65", + "\xF0\x9D\x91\xAD" => "\x66", + "\xF0\x9D\x91\xAE" => "\x67", + "\xF0\x9D\x91\xAF" => "\x68", + "\xF0\x9D\x91\xB0" => "\x69", + "\xF0\x9D\x91\xB1" => "\x6A", + "\xF0\x9D\x91\xB2" => "\x6B", + "\xF0\x9D\x91\xB3" => "\x6C", + "\xF0\x9D\x91\xB4" => "\x6D", + "\xF0\x9D\x91\xB5" => "\x6E", + "\xF0\x9D\x91\xB6" => "\x6F", + "\xF0\x9D\x91\xB7" => "\x70", + "\xF0\x9D\x91\xB8" => "\x71", + "\xF0\x9D\x91\xB9" => "\x72", + "\xF0\x9D\x91\xBA" => "\x73", + "\xF0\x9D\x91\xBB" => "\x74", + "\xF0\x9D\x91\xBC" => "\x75", + "\xF0\x9D\x91\xBD" => "\x76", + "\xF0\x9D\x91\xBE" => "\x77", + "\xF0\x9D\x91\xBF" => "\x78", + "\xF0\x9D\x92\x80" => "\x79", + "\xF0\x9D\x92\x81" => "\x7A", + "\xF0\x9D\x92\x9C" => "\x61", + "\xF0\x9D\x92\x9E" => "\x63", + "\xF0\x9D\x92\x9F" => "\x64", + "\xF0\x9D\x92\xA2" => "\x67", + "\xF0\x9D\x92\xA5" => "\x6A", + "\xF0\x9D\x92\xA6" => "\x6B", + "\xF0\x9D\x92\xA9" => "\x6E", + "\xF0\x9D\x92\xAA" => "\x6F", + "\xF0\x9D\x92\xAB" => "\x70", + "\xF0\x9D\x92\xAC" => "\x71", + "\xF0\x9D\x92\xAE" => "\x73", + "\xF0\x9D\x92\xAF" => "\x74", + "\xF0\x9D\x92\xB0" => "\x75", + "\xF0\x9D\x92\xB1" => "\x76", + "\xF0\x9D\x92\xB2" => "\x77", + "\xF0\x9D\x92\xB3" => "\x78", + "\xF0\x9D\x92\xB4" => "\x79", + "\xF0\x9D\x92\xB5" => "\x7A", + "\xF0\x9D\x93\x90" => "\x61", + "\xF0\x9D\x93\x91" => "\x62", + "\xF0\x9D\x93\x92" => "\x63", + "\xF0\x9D\x93\x93" => "\x64", + "\xF0\x9D\x93\x94" => "\x65", + "\xF0\x9D\x93\x95" => "\x66", + "\xF0\x9D\x93\x96" => "\x67", + "\xF0\x9D\x93\x97" => "\x68", + "\xF0\x9D\x93\x98" => "\x69", + "\xF0\x9D\x93\x99" => "\x6A", + "\xF0\x9D\x93\x9A" => "\x6B", + "\xF0\x9D\x93\x9B" => "\x6C", + "\xF0\x9D\x93\x9C" => "\x6D", + "\xF0\x9D\x93\x9D" => "\x6E", + "\xF0\x9D\x93\x9E" => "\x6F", + "\xF0\x9D\x93\x9F" => "\x70", + "\xF0\x9D\x93\xA0" => "\x71", + "\xF0\x9D\x93\xA1" => "\x72", + "\xF0\x9D\x93\xA2" => "\x73", + "\xF0\x9D\x93\xA3" => "\x74", + "\xF0\x9D\x93\xA4" => "\x75", + "\xF0\x9D\x93\xA5" => "\x76", + "\xF0\x9D\x93\xA6" => "\x77", + "\xF0\x9D\x93\xA7" => "\x78", + "\xF0\x9D\x93\xA8" => "\x79", + "\xF0\x9D\x93\xA9" => "\x7A", + "\xF0\x9D\x94\x84" => "\x61", + "\xF0\x9D\x94\x85" => "\x62", + "\xF0\x9D\x94\x87" => "\x64", + "\xF0\x9D\x94\x88" => "\x65", + "\xF0\x9D\x94\x89" => "\x66", + "\xF0\x9D\x94\x8A" => "\x67", + "\xF0\x9D\x94\x8D" => "\x6A", + "\xF0\x9D\x94\x8E" => "\x6B", + "\xF0\x9D\x94\x8F" => "\x6C", + "\xF0\x9D\x94\x90" => "\x6D", + "\xF0\x9D\x94\x91" => "\x6E", + "\xF0\x9D\x94\x92" => "\x6F", + "\xF0\x9D\x94\x93" => "\x70", + "\xF0\x9D\x94\x94" => "\x71", + "\xF0\x9D\x94\x96" => "\x73", + "\xF0\x9D\x94\x97" => "\x74", + "\xF0\x9D\x94\x98" => "\x75", + "\xF0\x9D\x94\x99" => "\x76", + "\xF0\x9D\x94\x9A" => "\x77", + "\xF0\x9D\x94\x9B" => "\x78", + "\xF0\x9D\x94\x9C" => "\x79", + "\xF0\x9D\x94\xB8" => "\x61", + "\xF0\x9D\x94\xB9" => "\x62", + "\xF0\x9D\x94\xBB" => "\x64", + "\xF0\x9D\x94\xBC" => "\x65", + "\xF0\x9D\x94\xBD" => "\x66", + "\xF0\x9D\x94\xBE" => "\x67", + "\xF0\x9D\x95\x80" => "\x69", + "\xF0\x9D\x95\x81" => "\x6A", + "\xF0\x9D\x95\x82" => "\x6B", + "\xF0\x9D\x95\x83" => "\x6C", + "\xF0\x9D\x95\x84" => "\x6D", + "\xF0\x9D\x95\x86" => "\x6F", + "\xF0\x9D\x95\x8A" => "\x73", + "\xF0\x9D\x95\x8B" => "\x74", + "\xF0\x9D\x95\x8C" => "\x75", + "\xF0\x9D\x95\x8D" => "\x76", + "\xF0\x9D\x95\x8E" => "\x77", + "\xF0\x9D\x95\x8F" => "\x78", + "\xF0\x9D\x95\x90" => "\x79", + "\xF0\x9D\x95\xAC" => "\x61", + "\xF0\x9D\x95\xAD" => "\x62", + "\xF0\x9D\x95\xAE" => "\x63", + "\xF0\x9D\x95\xAF" => "\x64", + "\xF0\x9D\x95\xB0" => "\x65", + "\xF0\x9D\x95\xB1" => "\x66", + "\xF0\x9D\x95\xB2" => "\x67", + "\xF0\x9D\x95\xB3" => "\x68", + "\xF0\x9D\x95\xB4" => "\x69", + "\xF0\x9D\x95\xB5" => "\x6A", + "\xF0\x9D\x95\xB6" => "\x6B", + "\xF0\x9D\x95\xB7" => "\x6C", + "\xF0\x9D\x95\xB8" => "\x6D", + "\xF0\x9D\x95\xB9" => "\x6E", + "\xF0\x9D\x95\xBA" => "\x6F", + "\xF0\x9D\x95\xBB" => "\x70", + "\xF0\x9D\x95\xBC" => "\x71", + "\xF0\x9D\x95\xBD" => "\x72", + "\xF0\x9D\x95\xBE" => "\x73", + "\xF0\x9D\x95\xBF" => "\x74", + "\xF0\x9D\x96\x80" => "\x75", + "\xF0\x9D\x96\x81" => "\x76", + "\xF0\x9D\x96\x82" => "\x77", + "\xF0\x9D\x96\x83" => "\x78", + "\xF0\x9D\x96\x84" => "\x79", + "\xF0\x9D\x96\x85" => "\x7A", + "\xF0\x9D\x96\xA0" => "\x61", + "\xF0\x9D\x96\xA1" => "\x62", + "\xF0\x9D\x96\xA2" => "\x63", + "\xF0\x9D\x96\xA3" => "\x64", + "\xF0\x9D\x96\xA4" => "\x65", + "\xF0\x9D\x96\xA5" => "\x66", + "\xF0\x9D\x96\xA6" => "\x67", + "\xF0\x9D\x96\xA7" => "\x68", + "\xF0\x9D\x96\xA8" => "\x69", + "\xF0\x9D\x96\xA9" => "\x6A", + "\xF0\x9D\x96\xAA" => "\x6B", + "\xF0\x9D\x96\xAB" => "\x6C", + "\xF0\x9D\x96\xAC" => "\x6D", + "\xF0\x9D\x96\xAD" => "\x6E", + "\xF0\x9D\x96\xAE" => "\x6F", + "\xF0\x9D\x96\xAF" => "\x70", + "\xF0\x9D\x96\xB0" => "\x71", + "\xF0\x9D\x96\xB1" => "\x72", + "\xF0\x9D\x96\xB2" => "\x73", + "\xF0\x9D\x96\xB3" => "\x74", + "\xF0\x9D\x96\xB4" => "\x75", + "\xF0\x9D\x96\xB5" => "\x76", + "\xF0\x9D\x96\xB6" => "\x77", + "\xF0\x9D\x96\xB7" => "\x78", + "\xF0\x9D\x96\xB8" => "\x79", + "\xF0\x9D\x96\xB9" => "\x7A", + "\xF0\x9D\x97\x94" => "\x61", + "\xF0\x9D\x97\x95" => "\x62", + "\xF0\x9D\x97\x96" => "\x63", + "\xF0\x9D\x97\x97" => "\x64", + "\xF0\x9D\x97\x98" => "\x65", + "\xF0\x9D\x97\x99" => "\x66", + "\xF0\x9D\x97\x9A" => "\x67", + "\xF0\x9D\x97\x9B" => "\x68", + "\xF0\x9D\x97\x9C" => "\x69", + "\xF0\x9D\x97\x9D" => "\x6A", + "\xF0\x9D\x97\x9E" => "\x6B", + "\xF0\x9D\x97\x9F" => "\x6C", + "\xF0\x9D\x97\xA0" => "\x6D", + "\xF0\x9D\x97\xA1" => "\x6E", + "\xF0\x9D\x97\xA2" => "\x6F", + "\xF0\x9D\x97\xA3" => "\x70", + "\xF0\x9D\x97\xA4" => "\x71", + "\xF0\x9D\x97\xA5" => "\x72", + "\xF0\x9D\x97\xA6" => "\x73", + "\xF0\x9D\x97\xA7" => "\x74", + "\xF0\x9D\x97\xA8" => "\x75", + "\xF0\x9D\x97\xA9" => "\x76", + "\xF0\x9D\x97\xAA" => "\x77", + "\xF0\x9D\x97\xAB" => "\x78", + "\xF0\x9D\x97\xAC" => "\x79", + "\xF0\x9D\x97\xAD" => "\x7A", + "\xF0\x9D\x98\x88" => "\x61", + "\xF0\x9D\x98\x89" => "\x62", + "\xF0\x9D\x98\x8A" => "\x63", + "\xF0\x9D\x98\x8B" => "\x64", + "\xF0\x9D\x98\x8C" => "\x65", + "\xF0\x9D\x98\x8D" => "\x66", + "\xF0\x9D\x98\x8E" => "\x67", + "\xF0\x9D\x98\x8F" => "\x68", + "\xF0\x9D\x98\x90" => "\x69", + "\xF0\x9D\x98\x91" => "\x6A", + "\xF0\x9D\x98\x92" => "\x6B", + "\xF0\x9D\x98\x93" => "\x6C", + "\xF0\x9D\x98\x94" => "\x6D", + "\xF0\x9D\x98\x95" => "\x6E", + "\xF0\x9D\x98\x96" => "\x6F", + "\xF0\x9D\x98\x97" => "\x70", + "\xF0\x9D\x98\x98" => "\x71", + "\xF0\x9D\x98\x99" => "\x72", + "\xF0\x9D\x98\x9A" => "\x73", + "\xF0\x9D\x98\x9B" => "\x74", + "\xF0\x9D\x98\x9C" => "\x75", + "\xF0\x9D\x98\x9D" => "\x76", + "\xF0\x9D\x98\x9E" => "\x77", + "\xF0\x9D\x98\x9F" => "\x78", + "\xF0\x9D\x98\xA0" => "\x79", + "\xF0\x9D\x98\xA1" => "\x7A", + "\xF0\x9D\x98\xBC" => "\x61", + "\xF0\x9D\x98\xBD" => "\x62", + "\xF0\x9D\x98\xBE" => "\x63", + "\xF0\x9D\x98\xBF" => "\x64", + "\xF0\x9D\x99\x80" => "\x65", + "\xF0\x9D\x99\x81" => "\x66", + "\xF0\x9D\x99\x82" => "\x67", + "\xF0\x9D\x99\x83" => "\x68", + "\xF0\x9D\x99\x84" => "\x69", + "\xF0\x9D\x99\x85" => "\x6A", + "\xF0\x9D\x99\x86" => "\x6B", + "\xF0\x9D\x99\x87" => "\x6C", + "\xF0\x9D\x99\x88" => "\x6D", + "\xF0\x9D\x99\x89" => "\x6E", + "\xF0\x9D\x99\x8A" => "\x6F", + "\xF0\x9D\x99\x8B" => "\x70", + "\xF0\x9D\x99\x8C" => "\x71", + "\xF0\x9D\x99\x8D" => "\x72", + "\xF0\x9D\x99\x8E" => "\x73", + "\xF0\x9D\x99\x8F" => "\x74", + "\xF0\x9D\x99\x90" => "\x75", + "\xF0\x9D\x99\x91" => "\x76", + "\xF0\x9D\x99\x92" => "\x77", + "\xF0\x9D\x99\x93" => "\x78", + "\xF0\x9D\x99\x94" => "\x79", + "\xF0\x9D\x99\x95" => "\x7A", + "\xF0\x9D\x99\xB0" => "\x61", + "\xF0\x9D\x99\xB1" => "\x62", + "\xF0\x9D\x99\xB2" => "\x63", + "\xF0\x9D\x99\xB3" => "\x64", + "\xF0\x9D\x99\xB4" => "\x65", + "\xF0\x9D\x99\xB5" => "\x66", + "\xF0\x9D\x99\xB6" => "\x67", + "\xF0\x9D\x99\xB7" => "\x68", + "\xF0\x9D\x99\xB8" => "\x69", + "\xF0\x9D\x99\xB9" => "\x6A", + "\xF0\x9D\x99\xBA" => "\x6B", + "\xF0\x9D\x99\xBB" => "\x6C", + "\xF0\x9D\x99\xBC" => "\x6D", + "\xF0\x9D\x99\xBD" => "\x6E", + "\xF0\x9D\x99\xBE" => "\x6F", + "\xF0\x9D\x99\xBF" => "\x70", + "\xF0\x9D\x9A\x80" => "\x71", + "\xF0\x9D\x9A\x81" => "\x72", + "\xF0\x9D\x9A\x82" => "\x73", + "\xF0\x9D\x9A\x83" => "\x74", + "\xF0\x9D\x9A\x84" => "\x75", + "\xF0\x9D\x9A\x85" => "\x76", + "\xF0\x9D\x9A\x86" => "\x77", + "\xF0\x9D\x9A\x87" => "\x78", + "\xF0\x9D\x9A\x88" => "\x79", + "\xF0\x9D\x9A\x89" => "\x7A", + "\xF0\x9D\x9A\xA8" => "\xCE\xB1", + "\xF0\x9D\x9A\xA9" => "\xCE\xB2", + "\xF0\x9D\x9A\xAA" => "\xCE\xB3", + "\xF0\x9D\x9A\xAB" => "\xCE\xB4", + "\xF0\x9D\x9A\xAC" => "\xCE\xB5", + "\xF0\x9D\x9A\xAD" => "\xCE\xB6", + "\xF0\x9D\x9A\xAE" => "\xCE\xB7", + "\xF0\x9D\x9A\xAF" => "\xCE\xB8", + "\xF0\x9D\x9A\xB0" => "\xCE\xB9", + "\xF0\x9D\x9A\xB1" => "\xCE\xBA", + "\xF0\x9D\x9A\xB2" => "\xCE\xBB", + "\xF0\x9D\x9A\xB3" => "\xCE\xBC", + "\xF0\x9D\x9A\xB4" => "\xCE\xBD", + "\xF0\x9D\x9A\xB5" => "\xCE\xBE", + "\xF0\x9D\x9A\xB6" => "\xCE\xBF", + "\xF0\x9D\x9A\xB7" => "\xCF\x80", + "\xF0\x9D\x9A\xB8" => "\xCF\x81", + "\xF0\x9D\x9A\xB9" => "\xCE\xB8", + "\xF0\x9D\x9A\xBA" => "\xCF\x83", + "\xF0\x9D\x9A\xBB" => "\xCF\x84", + "\xF0\x9D\x9A\xBC" => "\xCF\x85", + "\xF0\x9D\x9A\xBD" => "\xCF\x86", + "\xF0\x9D\x9A\xBE" => "\xCF\x87", + "\xF0\x9D\x9A\xBF" => "\xCF\x88", + "\xF0\x9D\x9B\x80" => "\xCF\x89", + "\xF0\x9D\x9B\x93" => "\xCF\x83", + "\xF0\x9D\x9B\xA2" => "\xCE\xB1", + "\xF0\x9D\x9B\xA3" => "\xCE\xB2", + "\xF0\x9D\x9B\xA4" => "\xCE\xB3", + "\xF0\x9D\x9B\xA5" => "\xCE\xB4", + "\xF0\x9D\x9B\xA6" => "\xCE\xB5", + "\xF0\x9D\x9B\xA7" => "\xCE\xB6", + "\xF0\x9D\x9B\xA8" => "\xCE\xB7", + "\xF0\x9D\x9B\xA9" => "\xCE\xB8", + "\xF0\x9D\x9B\xAA" => "\xCE\xB9", + "\xF0\x9D\x9B\xAB" => "\xCE\xBA", + "\xF0\x9D\x9B\xAC" => "\xCE\xBB", + "\xF0\x9D\x9B\xAD" => "\xCE\xBC", + "\xF0\x9D\x9B\xAE" => "\xCE\xBD", + "\xF0\x9D\x9B\xAF" => "\xCE\xBE", + "\xF0\x9D\x9B\xB0" => "\xCE\xBF", + "\xF0\x9D\x9B\xB1" => "\xCF\x80", + "\xF0\x9D\x9B\xB2" => "\xCF\x81", + "\xF0\x9D\x9B\xB3" => "\xCE\xB8", + "\xF0\x9D\x9B\xB4" => "\xCF\x83", + "\xF0\x9D\x9B\xB5" => "\xCF\x84", + "\xF0\x9D\x9B\xB6" => "\xCF\x85", + "\xF0\x9D\x9B\xB7" => "\xCF\x86", + "\xF0\x9D\x9B\xB8" => "\xCF\x87", + "\xF0\x9D\x9B\xB9" => "\xCF\x88", + "\xF0\x9D\x9B\xBA" => "\xCF\x89", + "\xF0\x9D\x9C\x8D" => "\xCF\x83", + "\xF0\x9D\x9C\x9C" => "\xCE\xB1", + "\xF0\x9D\x9C\x9D" => "\xCE\xB2", + "\xF0\x9D\x9C\x9E" => "\xCE\xB3", + "\xF0\x9D\x9C\x9F" => "\xCE\xB4", + "\xF0\x9D\x9C\xA0" => "\xCE\xB5", + "\xF0\x9D\x9C\xA1" => "\xCE\xB6", + "\xF0\x9D\x9C\xA2" => "\xCE\xB7", + "\xF0\x9D\x9C\xA3" => "\xCE\xB8", + "\xF0\x9D\x9C\xA4" => "\xCE\xB9", + "\xF0\x9D\x9C\xA5" => "\xCE\xBA", + "\xF0\x9D\x9C\xA6" => "\xCE\xBB", + "\xF0\x9D\x9C\xA7" => "\xCE\xBC", + "\xF0\x9D\x9C\xA8" => "\xCE\xBD", + "\xF0\x9D\x9C\xA9" => "\xCE\xBE", + "\xF0\x9D\x9C\xAA" => "\xCE\xBF", + "\xF0\x9D\x9C\xAB" => "\xCF\x80", + "\xF0\x9D\x9C\xAC" => "\xCF\x81", + "\xF0\x9D\x9C\xAD" => "\xCE\xB8", + "\xF0\x9D\x9C\xAE" => "\xCF\x83", + "\xF0\x9D\x9C\xAF" => "\xCF\x84", + "\xF0\x9D\x9C\xB0" => "\xCF\x85", + "\xF0\x9D\x9C\xB1" => "\xCF\x86", + "\xF0\x9D\x9C\xB2" => "\xCF\x87", + "\xF0\x9D\x9C\xB3" => "\xCF\x88", + "\xF0\x9D\x9C\xB4" => "\xCF\x89", + "\xF0\x9D\x9D\x87" => "\xCF\x83", + "\xF0\x9D\x9D\x96" => "\xCE\xB1", + "\xF0\x9D\x9D\x97" => "\xCE\xB2", + "\xF0\x9D\x9D\x98" => "\xCE\xB3", + "\xF0\x9D\x9D\x99" => "\xCE\xB4", + "\xF0\x9D\x9D\x9A" => "\xCE\xB5", + "\xF0\x9D\x9D\x9B" => "\xCE\xB6", + "\xF0\x9D\x9D\x9C" => "\xCE\xB7", + "\xF0\x9D\x9D\x9D" => "\xCE\xB8", + "\xF0\x9D\x9D\x9E" => "\xCE\xB9", + "\xF0\x9D\x9D\x9F" => "\xCE\xBA", + "\xF0\x9D\x9D\xA0" => "\xCE\xBB", + "\xF0\x9D\x9D\xA1" => "\xCE\xBC", + "\xF0\x9D\x9D\xA2" => "\xCE\xBD", + "\xF0\x9D\x9D\xA3" => "\xCE\xBE", + "\xF0\x9D\x9D\xA4" => "\xCE\xBF", + "\xF0\x9D\x9D\xA5" => "\xCF\x80", + "\xF0\x9D\x9D\xA6" => "\xCF\x81", + "\xF0\x9D\x9D\xA7" => "\xCE\xB8", + "\xF0\x9D\x9D\xA8" => "\xCF\x83", + "\xF0\x9D\x9D\xA9" => "\xCF\x84", + "\xF0\x9D\x9D\xAA" => "\xCF\x85", + "\xF0\x9D\x9D\xAB" => "\xCF\x86", + "\xF0\x9D\x9D\xAC" => "\xCF\x87", + "\xF0\x9D\x9D\xAD" => "\xCF\x88", + "\xF0\x9D\x9D\xAE" => "\xCF\x89", + "\xF0\x9D\x9E\x81" => "\xCF\x83", + "\xF0\x9D\x9E\x90" => "\xCE\xB1", + "\xF0\x9D\x9E\x91" => "\xCE\xB2", + "\xF0\x9D\x9E\x92" => "\xCE\xB3", + "\xF0\x9D\x9E\x93" => "\xCE\xB4", + "\xF0\x9D\x9E\x94" => "\xCE\xB5", + "\xF0\x9D\x9E\x95" => "\xCE\xB6", + "\xF0\x9D\x9E\x96" => "\xCE\xB7", + "\xF0\x9D\x9E\x97" => "\xCE\xB8", + "\xF0\x9D\x9E\x98" => "\xCE\xB9", + "\xF0\x9D\x9E\x99" => "\xCE\xBA", + "\xF0\x9D\x9E\x9A" => "\xCE\xBB", + "\xF0\x9D\x9E\x9B" => "\xCE\xBC", + "\xF0\x9D\x9E\x9C" => "\xCE\xBD", + "\xF0\x9D\x9E\x9D" => "\xCE\xBE", + "\xF0\x9D\x9E\x9E" => "\xCE\xBF", + "\xF0\x9D\x9E\x9F" => "\xCF\x80", + "\xF0\x9D\x9E\xA0" => "\xCF\x81", + "\xF0\x9D\x9E\xA1" => "\xCE\xB8", + "\xF0\x9D\x9E\xA2" => "\xCF\x83", + "\xF0\x9D\x9E\xA3" => "\xCF\x84", + "\xF0\x9D\x9E\xA4" => "\xCF\x85", + "\xF0\x9D\x9E\xA5" => "\xCF\x86", + "\xF0\x9D\x9E\xA6" => "\xCF\x87", + "\xF0\x9D\x9E\xA7" => "\xCF\x88", + "\xF0\x9D\x9E\xA8" => "\xCF\x89", + "\xF0\x9D\x9E\xBB" => "\xCF\x83", + "\xF0\x9D\x9F\x8A" => "\xCF\x9D", + ); + + // do the case fold + $text = utf8_case_fold($text, $option); + + // convert to NFKC + Normalizer::normalize($text, Normalizer::NFKC); + + // FC_NFKC_Closure, http://www.unicode.org/Public/5.0.0/ucd/DerivedNormalizationProps.txt + $text = strtr($text, $fc_nfkc_closure); + + return $text; +} + +/** +* Assume the input is NFC: +* Takes the input and does a "special" case fold. It does minor normalization as well. +* +* @param string $text text to be case folded +* @param string $option determines how we will fold the cases +* @return string case folded text +*/ +function utf8_case_fold_nfc($text, $option = 'full') +{ + static $uniarray = array(); + static $ypogegrammeni = array( + "\xCD\xBA" => "\x20\xCD\x85", + "\xE1\xBE\x80" => "\xE1\xBC\x80\xCD\x85", + "\xE1\xBE\x81" => "\xE1\xBC\x81\xCD\x85", + "\xE1\xBE\x82" => "\xE1\xBC\x82\xCD\x85", + "\xE1\xBE\x83" => "\xE1\xBC\x83\xCD\x85", + "\xE1\xBE\x84" => "\xE1\xBC\x84\xCD\x85", + "\xE1\xBE\x85" => "\xE1\xBC\x85\xCD\x85", + "\xE1\xBE\x86" => "\xE1\xBC\x86\xCD\x85", + "\xE1\xBE\x87" => "\xE1\xBC\x87\xCD\x85", + "\xE1\xBE\x88" => "\xE1\xBC\x88\xCD\x85", + "\xE1\xBE\x89" => "\xE1\xBC\x89\xCD\x85", + "\xE1\xBE\x8A" => "\xE1\xBC\x8A\xCD\x85", + "\xE1\xBE\x8B" => "\xE1\xBC\x8B\xCD\x85", + "\xE1\xBE\x8C" => "\xE1\xBC\x8C\xCD\x85", + "\xE1\xBE\x8D" => "\xE1\xBC\x8D\xCD\x85", + "\xE1\xBE\x8E" => "\xE1\xBC\x8E\xCD\x85", + "\xE1\xBE\x8F" => "\xE1\xBC\x8F\xCD\x85", + "\xE1\xBE\x90" => "\xE1\xBC\xA0\xCD\x85", + "\xE1\xBE\x91" => "\xE1\xBC\xA1\xCD\x85", + "\xE1\xBE\x92" => "\xE1\xBC\xA2\xCD\x85", + "\xE1\xBE\x93" => "\xE1\xBC\xA3\xCD\x85", + "\xE1\xBE\x94" => "\xE1\xBC\xA4\xCD\x85", + "\xE1\xBE\x95" => "\xE1\xBC\xA5\xCD\x85", + "\xE1\xBE\x96" => "\xE1\xBC\xA6\xCD\x85", + "\xE1\xBE\x97" => "\xE1\xBC\xA7\xCD\x85", + "\xE1\xBE\x98" => "\xE1\xBC\xA8\xCD\x85", + "\xE1\xBE\x99" => "\xE1\xBC\xA9\xCD\x85", + "\xE1\xBE\x9A" => "\xE1\xBC\xAA\xCD\x85", + "\xE1\xBE\x9B" => "\xE1\xBC\xAB\xCD\x85", + "\xE1\xBE\x9C" => "\xE1\xBC\xAC\xCD\x85", + "\xE1\xBE\x9D" => "\xE1\xBC\xAD\xCD\x85", + "\xE1\xBE\x9E" => "\xE1\xBC\xAE\xCD\x85", + "\xE1\xBE\x9F" => "\xE1\xBC\xAF\xCD\x85", + "\xE1\xBE\xA0" => "\xE1\xBD\xA0\xCD\x85", + "\xE1\xBE\xA1" => "\xE1\xBD\xA1\xCD\x85", + "\xE1\xBE\xA2" => "\xE1\xBD\xA2\xCD\x85", + "\xE1\xBE\xA3" => "\xE1\xBD\xA3\xCD\x85", + "\xE1\xBE\xA4" => "\xE1\xBD\xA4\xCD\x85", + "\xE1\xBE\xA5" => "\xE1\xBD\xA5\xCD\x85", + "\xE1\xBE\xA6" => "\xE1\xBD\xA6\xCD\x85", + "\xE1\xBE\xA7" => "\xE1\xBD\xA7\xCD\x85", + "\xE1\xBE\xA8" => "\xE1\xBD\xA8\xCD\x85", + "\xE1\xBE\xA9" => "\xE1\xBD\xA9\xCD\x85", + "\xE1\xBE\xAA" => "\xE1\xBD\xAA\xCD\x85", + "\xE1\xBE\xAB" => "\xE1\xBD\xAB\xCD\x85", + "\xE1\xBE\xAC" => "\xE1\xBD\xAC\xCD\x85", + "\xE1\xBE\xAD" => "\xE1\xBD\xAD\xCD\x85", + "\xE1\xBE\xAE" => "\xE1\xBD\xAE\xCD\x85", + "\xE1\xBE\xAF" => "\xE1\xBD\xAF\xCD\x85", + "\xE1\xBE\xB2" => "\xE1\xBD\xB0\xCD\x85", + "\xE1\xBE\xB3" => "\xCE\xB1\xCD\x85", + "\xE1\xBE\xB4" => "\xCE\xAC\xCD\x85", + "\xE1\xBE\xB7" => "\xE1\xBE\xB6\xCD\x85", + "\xE1\xBE\xBC" => "\xCE\x91\xCD\x85", + "\xE1\xBF\x82" => "\xE1\xBD\xB4\xCD\x85", + "\xE1\xBF\x83" => "\xCE\xB7\xCD\x85", + "\xE1\xBF\x84" => "\xCE\xAE\xCD\x85", + "\xE1\xBF\x87" => "\xE1\xBF\x86\xCD\x85", + "\xE1\xBF\x8C" => "\xCE\x97\xCD\x85", + "\xE1\xBF\xB2" => "\xE1\xBD\xBC\xCD\x85", + "\xE1\xBF\xB3" => "\xCF\x89\xCD\x85", + "\xE1\xBF\xB4" => "\xCF\x8E\xCD\x85", + "\xE1\xBF\xB7" => "\xE1\xBF\xB6\xCD\x85", + "\xE1\xBF\xBC" => "\xCE\xA9\xCD\x85", + ); + + // perform a small trick, avoid further normalization on composed points that contain U+0345 in their decomposition + $text = strtr($text, $ypogegrammeni); + + // do the case fold + $text = utf8_case_fold($text, $option); + + return $text; +} + +/** +* wrapper around PHP's native normalizer from intl +* previously a PECL extension, included in the core since PHP 5.3.0 +* http://php.net/manual/en/normalizer.normalize.php +* +* @param mixed $strings a string or an array of strings to normalize +* @return mixed the normalized content, preserving array keys if array given. +*/ +function utf8_normalize_nfc($strings) +{ + if (empty($strings)) + { + return $strings; + } + + if (!is_array($strings)) + { + if (Normalizer::isNormalized($strings)) + { + return $strings; + } + return (string) Normalizer::normalize($strings); + } + else + { + foreach ($strings as $key => $string) + { + if (is_array($string)) + { + foreach ($string as $_key => $_string) + { + if (Normalizer::isNormalized($strings[$key][$_key])) + { + continue; + } + $strings[$key][$_key] = (string) Normalizer::normalize($strings[$key][$_key]); + } + } + else + { + if (Normalizer::isNormalized($strings[$key])) + { + continue; + } + $strings[$key] = (string) Normalizer::normalize($strings[$key]); + } + } + } + + return $strings; +} + +/** +* This function is used to generate a "clean" version of a string. +* Clean means that it is a case insensitive form (case folding) and that it is normalized (NFC). +* Additionally a homographs of one character are transformed into one specific character (preferably ASCII +* if it is an ASCII character). +* +* Please be aware that if you change something within this function or within +* functions used here you need to rebuild/update the username_clean column in the users table. And all other +* columns that store a clean string otherwise you will break this functionality. +* +* @param string $text An unclean string, mabye user input (has to be valid UTF-8!) +* @return string Cleaned up version of the input string +*/ +function utf8_clean_string($text) +{ + global $phpbb_root_path, $phpEx; + + static $homographs = array(); + if (empty($homographs)) + { + $homographs = include($phpbb_root_path . 'includes/utf/data/confusables.' . $phpEx); + } + + $text = utf8_case_fold_nfkc($text); + $text = strtr($text, $homographs); + // Other control characters + $text = preg_replace('#(?:[\x00-\x1F\x7F]+|(?:\xC2[\x80-\x9F])+)#', '', $text); + + // we need to reduce multiple spaces to a single one + $text = preg_replace('# {2,}#', ' ', $text); + + // we can use trim here as all the other space characters should have been turned + // into normal ASCII spaces by now + return trim($text); +} + +/** +* A wrapper for htmlspecialchars($value, ENT_COMPAT, 'UTF-8') +*/ +function utf8_htmlspecialchars($value) +{ + return htmlspecialchars($value, ENT_COMPAT, 'UTF-8'); +} + +/** +* Trying to convert returned system message to utf8 +* +* PHP assumes such messages are ISO-8859-1 so we'll do that too +* and if it breaks messages we'll blame it on them ;-) +*/ +function utf8_convert_message($message) +{ + // First of all check if conversion is neded at all, as there is no point + // in converting ASCII messages from ISO-8859-1 to UTF-8 + if (!preg_match('/[\x80-\xFF]/', $message)) + { + return utf8_htmlspecialchars($message); + } + + // else we need to convert some part of the message + return utf8_htmlspecialchars(utf8_recode($message, 'ISO-8859-1')); +} + +/** +* UTF8-compatible wordwrap replacement +* +* @param string $string The input string +* @param int $width The column width. Defaults to 75. +* @param string $break The line is broken using the optional break parameter. Defaults to '\n'. +* @param bool $cut If the cut is set to TRUE, the string is always wrapped at the specified width. So if you have a word that is larger than the given width, it is broken apart. +* +* @return string the given string wrapped at the specified column. +* +*/ +function utf8_wordwrap($string, $width = 75, $break = "\n", $cut = false) +{ + // We first need to explode on $break, not destroying existing (intended) breaks + $lines = explode($break, $string); + $new_lines = array(0 => ''); + $index = 0; + + foreach ($lines as $line) + { + $words = explode(' ', $line); + + for ($i = 0, $size = count($words); $i < $size; $i++) + { + $word = $words[$i]; + + // If cut is true we need to cut the word if it is > width chars + if ($cut && utf8_strlen($word) > $width) + { + $words[$i] = utf8_substr($word, $width); + $word = utf8_substr($word, 0, $width); + $i--; + } + + if (utf8_strlen($new_lines[$index] . $word) > $width) + { + $new_lines[$index] = substr($new_lines[$index], 0, -1); + $index++; + $new_lines[$index] = ''; + } + + $new_lines[$index] .= $word . ' '; + } + + $new_lines[$index] = substr($new_lines[$index], 0, -1); + $index++; + $new_lines[$index] = ''; + } + + unset($new_lines[$index]); + return implode($break, $new_lines); +} + +/** +* UTF8-safe basename() function +* +* basename() has some limitations and is dependent on the locale setting +* according to the PHP manual. Therefore we provide our own locale independent +* basename function. +* +* @param string $filename The filename basename() should be applied to +* @return string The basenamed filename +*/ +function utf8_basename($filename) +{ + // We always check for forward slash AND backward slash + // because they could be mixed or "sneaked" in. ;) + // You know, never trust user input... + if (strpos($filename, '/') !== false) + { + $filename = utf8_substr($filename, utf8_strrpos($filename, '/') + 1); + } + + if (strpos($filename, '\\') !== false) + { + $filename = utf8_substr($filename, utf8_strrpos($filename, '\\') + 1); + } + + return $filename; +} diff --git a/install/update/old/index.php b/install/update/old/index.php new file mode 100644 index 0000000..5eee772 --- /dev/null +++ b/install/update/old/index.php @@ -0,0 +1,260 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('viewforum'); + +// Mark notifications read +if (($mark_notification = $request->variable('mark_notification', 0))) +{ + if ($user->data['user_id'] == ANONYMOUS) + { + if ($request->is_ajax()) + { + trigger_error('LOGIN_REQUIRED'); + } + login_box('', $user->lang['LOGIN_REQUIRED']); + } + + if (check_link_hash($request->variable('hash', ''), 'mark_notification_read')) + { + /* @var $phpbb_notifications \phpbb\notification\manager */ + $phpbb_notifications = $phpbb_container->get('notification_manager'); + + $notification = $phpbb_notifications->load_notifications('notification.method.board', array( + 'notification_id' => $mark_notification, + )); + + if (isset($notification['notifications'][$mark_notification])) + { + $notification = $notification['notifications'][$mark_notification]; + + $notification->mark_read(); + + /** + * You can use this event to perform additional tasks or redirect user elsewhere. + * + * @event core.index_mark_notification_after + * @var int mark_notification Notification ID + * @var \phpbb\notification\type\type_interface notification Notification instance + * @since 3.2.6-RC1 + */ + $vars = array('mark_notification', 'notification'); + extract($phpbb_dispatcher->trigger_event('core.index_mark_notification_after', compact($vars))); + + if ($request->is_ajax()) + { + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'success' => true, + )); + } + + if (($redirect = $request->variable('redirect', ''))) + { + redirect(append_sid($phpbb_root_path . $redirect)); + } + + redirect($notification->get_redirect_url()); + } + } +} + +display_forums('', $config['load_moderators']); + +$order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; +// Grab group details for legend display +if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) +{ + $sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend + FROM ' . GROUPS_TABLE . ' + WHERE group_legend > 0 + ORDER BY ' . $order_legend . ' ASC'; +} +else +{ + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE g.group_legend > 0 + AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ') + ORDER BY g.' . $order_legend . ' ASC'; +} +$result = $db->sql_query($sql); + +/** @var \phpbb\group\helper $group_helper */ +$group_helper = $phpbb_container->get('group_helper'); + +$legend = array(); +while ($row = $db->sql_fetchrow($result)) +{ + $colour_text = ($row['group_colour']) ? ' style="color:#' . $row['group_colour'] . '"' : ''; + $group_name = $group_helper->get_name($row['group_name']); + + if ($row['group_name'] == 'BOTS' || ($user->data['user_id'] != ANONYMOUS && !$auth->acl_get('u_viewprofile'))) + { + $legend[] = '' . $group_name . '
'; + } + else + { + $legend[] = '' . $group_name . ''; + } +} +$db->sql_freeresult($result); + +$legend = implode($user->lang['COMMA_SEPARATOR'], $legend); + +// Generate birthday list if required ... +$show_birthdays = ($config['load_birthdays'] && $config['allow_birthdays'] && $auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')); + +$birthdays = $birthday_list = array(); +if ($show_birthdays) +{ + $time = $user->create_datetime(); + $now = phpbb_gmgetdate($time->getTimestamp() + $time->getOffset()); + + // Display birthdays of 29th february on 28th february in non-leap-years + $leap_year_birthdays = ''; + if ($now['mday'] == 28 && $now['mon'] == 2 && !$time->format('L')) + { + $leap_year_birthdays = " OR u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', 29, 2)) . "%'"; + } + + $sql_ary = array( + 'SELECT' => 'u.user_id, u.username, u.user_colour, u.user_birthday', + 'FROM' => array( + USERS_TABLE => 'u', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(BANLIST_TABLE => 'b'), + 'ON' => 'u.user_id = b.ban_userid', + ), + ), + 'WHERE' => "(b.ban_id IS NULL OR b.ban_exclude = 1) + AND (u.user_birthday LIKE '" . $db->sql_escape(sprintf('%2d-%2d-', $now['mday'], $now['mon'])) . "%' $leap_year_birthdays) + AND u.user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')', + ); + + /** + * Event to modify the SQL query to get birthdays data + * + * @event core.index_modify_birthdays_sql + * @var array now The assoc array with the 'now' local timestamp data + * @var array sql_ary The SQL array to get the birthdays data + * @var object time The user related Datetime object + * @since 3.1.7-RC1 + */ + $vars = array('now', 'sql_ary', 'time'); + extract($phpbb_dispatcher->trigger_event('core.index_modify_birthdays_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + $rows = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + foreach ($rows as $row) + { + $birthday_username = get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']); + $birthday_year = (int) substr($row['user_birthday'], -4); + $birthday_age = ($birthday_year) ? max(0, $now['year'] - $birthday_year) : ''; + + $birthdays[] = array( + 'USERNAME' => $birthday_username, + 'AGE' => $birthday_age, + ); + + // For 3.0 compatibility + $birthday_list[] = $birthday_username . (($birthday_age) ? " ({$birthday_age})" : ''); + } + + /** + * Event to modify the birthdays list + * + * @event core.index_modify_birthdays_list + * @var array birthdays Array with the users birthdays data + * @var array rows Array with the birthdays SQL query result + * @since 3.1.7-RC1 + */ + $vars = array('birthdays', 'rows'); + extract($phpbb_dispatcher->trigger_event('core.index_modify_birthdays_list', compact($vars))); + + $template->assign_block_vars_array('birthdays', $birthdays); +} + +// Add form token for login box +add_form_key('login', '_LOGIN'); + +// Assign index specific vars +$template->assign_vars(array( + 'TOTAL_POSTS' => $user->lang('TOTAL_POSTS_COUNT', (int) $config['num_posts']), + 'TOTAL_TOPICS' => $user->lang('TOTAL_TOPICS', (int) $config['num_topics']), + 'TOTAL_USERS' => $user->lang('TOTAL_USERS', (int) $config['num_users']), + 'NEWEST_USER' => $user->lang('NEWEST_USER', get_username_string('full', $config['newest_user_id'], $config['newest_username'], $config['newest_user_colour'])), + + 'LEGEND' => $legend, + 'BIRTHDAY_LIST' => (empty($birthday_list)) ? '' : implode($user->lang['COMMA_SEPARATOR'], $birthday_list), + + 'FORUM_IMG' => $user->img('forum_read', 'NO_UNREAD_POSTS'), + 'FORUM_UNREAD_IMG' => $user->img('forum_unread', 'UNREAD_POSTS'), + 'FORUM_LOCKED_IMG' => $user->img('forum_read_locked', 'NO_UNREAD_POSTS_LOCKED'), + 'FORUM_UNREAD_LOCKED_IMG' => $user->img('forum_unread_locked', 'UNREAD_POSTS_LOCKED'), + + 'S_LOGIN_ACTION' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), + 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '', + 'S_DISPLAY_BIRTHDAY_LIST' => $show_birthdays, + 'S_INDEX' => true, + + 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums&mark_time=' . time()) : '', + 'U_MCP' => ($auth->acl_get('m_') || $auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main&mode=front', true, $user->session_id) : '') +); + +$page_title = ($config['board_index_text'] !== '') ? $config['board_index_text'] : $user->lang['INDEX']; + +/** +* You can use this event to modify the page title and load data for the index +* +* @event core.index_modify_page_title +* @var string page_title Title of the index page +* @since 3.1.0-a1 +*/ +$vars = array('page_title'); +extract($phpbb_dispatcher->trigger_event('core.index_modify_page_title', compact($vars))); + +// Output page +page_header($page_title, true); + +$template->set_filenames(array( + 'body' => 'index_body.html') +); + +page_footer(); diff --git a/install/update/old/language/en/acp/attachments.php b/install/update/old/language/en/acp/attachments.php new file mode 100644 index 0000000..86430f4 --- /dev/null +++ b/install/update/old/language/en/acp/attachments.php @@ -0,0 +1,169 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'ACP_ATTACHMENT_SETTINGS_EXPLAIN' => 'Here you can configure the main settings for attachments and the associated special categories.', + 'ACP_EXTENSION_GROUPS_EXPLAIN' => 'Here you can add, delete, modify or disable your extension groups. Further options include the assignment of a special category to them, changing the download mechanism and defining an upload icon which will be displayed in front of the attachment which belongs to the group.', + 'ACP_MANAGE_EXTENSIONS_EXPLAIN' => 'Here you can manage your allowed extensions. To activate your extensions, please refer to the extension groups management panel. We strongly recommend not to allow scripting extensions (such as php, php3, php4, phtml, pl, cgi, py, rb, asp, aspx, and so forth…).', + 'ACP_ORPHAN_ATTACHMENTS_EXPLAIN' => 'Here you are able to see orphaned files. This happens mostly if users are attaching files but not submitting the post. You are able to delete the files or attach them to existing posts. Attaching to posts requires a valid post ID, you have to determine this ID by yourself. This will assign the already uploaded attachment to the post you entered.', + 'ADD_EXTENSION' => 'Add extension', + 'ADD_EXTENSION_GROUP' => 'Add extension group', + 'ADMIN_UPLOAD_ERROR' => 'Errors while trying to attach file: “%s”.', + 'ALLOWED_FORUMS' => 'Allowed forums', + 'ALLOWED_FORUMS_EXPLAIN' => 'Able to post the assigned extensions at the selected (or all if selected) forums.', + 'ALLOWED_IN_PM_POST' => 'Allowed', + 'ALLOW_ATTACHMENTS' => 'Allow attachments', + 'ALLOW_ALL_FORUMS' => 'Allow all forums', + 'ALLOW_IN_PM' => 'Allowed in private messaging', + 'ALLOW_PM_ATTACHMENTS' => 'Allow attachments in private messages', + 'ALLOW_SELECTED_FORUMS' => 'Only forums selected below', + 'ASSIGNED_EXTENSIONS' => 'Assigned extensions', + 'ASSIGNED_GROUP' => 'Assigned extension group', + 'ATTACH_EXTENSIONS_URL' => 'Extensions', + 'ATTACH_EXT_GROUPS_URL' => 'Extension groups', + 'ATTACH_ID' => 'ID', + 'ATTACH_MAX_FILESIZE' => 'Maximum file size', + 'ATTACH_MAX_FILESIZE_EXPLAIN' => 'Maximum size of each file. If this value is 0, the uploadable filesize is only limited by your PHP configuration.', + 'ATTACH_MAX_PM_FILESIZE' => 'Maximum file size messaging', + 'ATTACH_MAX_PM_FILESIZE_EXPLAIN' => 'Maximum size of each file, with 0 being unlimited, attached to a private message.', + 'ATTACH_ORPHAN_URL' => 'Orphan attachments', + 'ATTACH_POST_ID' => 'Post ID', + 'ATTACH_POST_TYPE' => 'Post type', + 'ATTACH_QUOTA' => 'Total attachment quota', + 'ATTACH_QUOTA_EXPLAIN' => 'Maximum drive space available for attachments for the whole board, with 0 being unlimited.', + 'ATTACH_TO_POST' => 'Attach file to post', + + 'CAT_FLASH_FILES' => 'Flash files', + 'CAT_IMAGES' => 'Images', + 'CHECK_CONTENT' => 'Check attachment files', + 'CHECK_CONTENT_EXPLAIN' => 'Some browsers can be tricked to assume an incorrect mimetype for uploaded files. This option ensures that such files likely to cause this are rejected.', + 'CREATE_GROUP' => 'Create new group', + 'CREATE_THUMBNAIL' => 'Create thumbnail', + 'CREATE_THUMBNAIL_EXPLAIN' => 'Create a thumbnail in all possible situations.', + + 'DEFINE_ALLOWED_IPS' => 'Define allowed IPs/hostnames', + 'DEFINE_DISALLOWED_IPS' => 'Define disallowed IPs/hostnames', + 'DOWNLOAD_ADD_IPS_EXPLAIN' => 'To specify several different IPs or hostnames enter each on a new line. To specify a range of IP addresses separate the start and end with a hyphen (-), to specify a wildcard use “*”.', + 'DOWNLOAD_REMOVE_IPS_EXPLAIN' => 'You can remove (or un-exclude) multiple IP addresses in one go using the appropriate combination of mouse and keyboard for your computer and browser. Excluded IPs have a blue background.', + 'DISPLAY_INLINED' => 'Display images inline', + 'DISPLAY_INLINED_EXPLAIN' => 'If set to No image attachments will show as a link.', + 'DISPLAY_ORDER' => 'Attachment display order', + 'DISPLAY_ORDER_EXPLAIN' => 'Display attachments ordered by time.', + + 'EDIT_EXTENSION_GROUP' => 'Edit extension group', + 'EXCLUDE_ENTERED_IP' => 'Enable this to exclude the entered IP/hostname.', + 'EXCLUDE_FROM_ALLOWED_IP' => 'Exclude IP from allowed IPs/hostnames', + 'EXCLUDE_FROM_DISALLOWED_IP' => 'Exclude IP from disallowed IPs/hostnames', + 'EXTENSIONS_UPDATED' => 'Extensions successfully updated.', + 'EXTENSION_EXIST' => 'The extension %s already exists.', + 'EXTENSION_GROUP' => 'Extension group', + 'EXTENSION_GROUPS' => 'Extension groups', + 'EXTENSION_GROUP_DELETED' => 'Extension group successfully deleted.', + 'EXTENSION_GROUP_EXIST' => 'The extension group %s already exists.', + + 'EXT_GROUP_ARCHIVES' => 'Archives', + 'EXT_GROUP_DOCUMENTS' => 'Documents', + 'EXT_GROUP_DOWNLOADABLE_FILES' => 'Downloadable Files', + 'EXT_GROUP_FLASH_FILES' => 'Flash Files', + 'EXT_GROUP_IMAGES' => 'Images', + 'EXT_GROUP_PLAIN_TEXT' => 'Plain Text', + + 'FILES_GONE' => 'Some of the attachments you selected for deletion do not exist. They may have been already deleted. Attachments that did exist were deleted.', + 'FILES_STATS_WRONG' => 'Your file statistics are likely inaccurate and need to be resynchronised. Actual values: number of attachments = %1$d, total size of attachments = %2$s.
Click %3$shere%4$s to resynchronise them.', + + 'GO_TO_EXTENSIONS' => 'Go to extension management screen', + 'GROUP_NAME' => 'Group name', + + 'IMAGE_LINK_SIZE' => 'Image link dimensions', + 'IMAGE_LINK_SIZE_EXPLAIN' => 'Display image attachment as an inline text link if image is larger than this. To disable this behaviour, set the values to 0px by 0px.', + + 'MAX_ATTACHMENTS' => 'Maximum number of attachments per post', + 'MAX_ATTACHMENTS_PM' => 'Maximum number of attachments per private message', + 'MAX_EXTGROUP_FILESIZE' => 'Maximum file size', + 'MAX_IMAGE_SIZE' => 'Maximum image dimensions', + 'MAX_IMAGE_SIZE_EXPLAIN' => 'Maximum size of image attachments. Set both values to 0px by 0px to disable dimension checking.', + 'MAX_THUMB_WIDTH' => 'Maximum thumbnail width/height in pixel', + 'MAX_THUMB_WIDTH_EXPLAIN' => 'A generated thumbnail will not exceed the width set here.', + 'MIN_THUMB_FILESIZE' => 'Minimum thumbnail file size', + 'MIN_THUMB_FILESIZE_EXPLAIN' => 'Do not create a thumbnail for images smaller than this.', + 'MODE_INLINE' => 'Inline', + 'MODE_PHYSICAL' => 'Physical', + + 'NOT_ALLOWED_IN_PM' => 'Only allowed in posts', + 'NOT_ALLOWED_IN_PM_POST' => 'Not allowed', + 'NOT_ASSIGNED' => 'Not assigned', + 'NO_ATTACHMENTS' => 'No attachments found for this period.', + 'NO_EXT_GROUP' => 'None', + 'NO_EXT_GROUP_NAME' => 'No group name entered', + 'NO_EXT_GROUP_SPECIFIED' => 'No extension group specified.', + 'NO_FILE_CAT' => 'None', + 'NO_IMAGE' => 'No image', + 'NO_UPLOAD_DIR' => 'The upload directory you specified does not exist.', + 'NO_WRITE_UPLOAD' => 'The upload directory you specified cannot be written to. Please alter the permissions to allow the webserver to write to it.', + + 'ONLY_ALLOWED_IN_PM' => 'Only allowed in private messages', + 'ORDER_ALLOW_DENY' => 'Allow', + 'ORDER_DENY_ALLOW' => 'Deny', + + 'REMOVE_ALLOWED_IPS' => 'Remove or un-exclude allowed IPs/hostnames', + 'REMOVE_DISALLOWED_IPS' => 'Remove or un-exclude disallowed IPs/hostnames', + 'RESYNC_FILES_STATS_CONFIRM' => 'Are you sure you wish to resynchronise file statistics?', + + 'SECURE_ALLOW_DENY' => 'Allow/Deny list', + 'SECURE_ALLOW_DENY_EXPLAIN' => 'Change the default behaviour when secure downloads are enabled of the Allow/Deny list to that of a whitelist (Allow) or a blacklist (Deny).', + 'SECURE_DOWNLOADS' => 'Enable secure downloads', + 'SECURE_DOWNLOADS_EXPLAIN' => 'With this option enabled, downloads are limited to IP’s/hostnames you define.', + 'SECURE_DOWNLOAD_NOTICE' => 'Secure Downloads are not enabled. The settings below will be applied after enabling secure downloads.', + 'SECURE_DOWNLOAD_UPDATE_SUCCESS'=> 'The IP list has been updated successfully.', + 'SECURE_EMPTY_REFERRER' => 'Allow empty referrer', + 'SECURE_EMPTY_REFERRER_EXPLAIN' => 'Secure downloads are based on referrers. Do you want to allow downloads for those omitting the referrer?', + 'SETTINGS_CAT_IMAGES' => 'Image category settings', + 'SPECIAL_CATEGORY' => 'Special category', + 'SPECIAL_CATEGORY_EXPLAIN' => 'Special categories differ between the way presented within posts.', + 'SUCCESSFULLY_UPLOADED' => 'Successfully uploaded.', + 'SUCCESS_EXTENSION_GROUP_ADD' => 'Extension group successfully added.', + 'SUCCESS_EXTENSION_GROUP_EDIT' => 'Extension group successfully updated.', + + 'UPLOADING_FILES' => 'Uploading files', + 'UPLOADING_FILE_TO' => 'Uploading file “%1$s” to post number %2$d…', + 'UPLOAD_DENIED_FORUM' => 'You do not have the permission to upload files to forum “%s”.', + 'UPLOAD_DIR' => 'Upload directory', + 'UPLOAD_DIR_EXPLAIN' => 'Storage path for attachments. Please note that if you change this directory while already having uploaded attachments you need to manually copy the files to their new location.', + 'UPLOAD_ICON' => 'Upload icon', + 'UPLOAD_NOT_DIR' => 'The upload location you specified does not appear to be a directory.', +)); diff --git a/install/update/old/language/en/acp/board.php b/install/update/old/language/en/acp/board.php new file mode 100644 index 0000000..9b45ffa --- /dev/null +++ b/install/update/old/language/en/acp/board.php @@ -0,0 +1,631 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Board Settings +$lang = array_merge($lang, array( + 'ACP_BOARD_SETTINGS_EXPLAIN' => 'Here you can determine the basic operation of your board, give it a fitting name and description, and among other settings adjust the default values for timezone and language.', + 'BOARD_INDEX_TEXT' => 'Board index text', + 'BOARD_INDEX_TEXT_EXPLAIN' => 'This text is displayed as the board index in the board’s breadcrumbs. If not specified, it will default to “Board index”.', + 'BOARD_STYLE' => 'Board style', + 'CUSTOM_DATEFORMAT' => 'Custom…', + 'DEFAULT_DATE_FORMAT' => 'Date format', + 'DEFAULT_DATE_FORMAT_EXPLAIN' => 'The date format is the same as the PHP date function.', + 'DEFAULT_LANGUAGE' => 'Default language', + 'DEFAULT_STYLE' => 'Default style', + 'DEFAULT_STYLE_EXPLAIN' => 'The default style for new users.', + 'DISABLE_BOARD' => 'Disable board', + 'DISABLE_BOARD_EXPLAIN' => 'This will make the board unavailable to users who are neither administrators nor moderators. You can also enter a short (255 character) message to display if you wish.', + 'DISPLAY_LAST_SUBJECT' => 'Display subject of last added post on forum list', + 'DISPLAY_LAST_SUBJECT_EXPLAIN' => 'The subject of the last added post will be displayed in the forum list with a hyperlink to the post. Subjects from password protected forums and forums in which user doesn’t have read access are not shown.', + 'GUEST_STYLE' => 'Guest style', + 'GUEST_STYLE_EXPLAIN' => 'The board style for guests.', + 'OVERRIDE_STYLE' => 'Override user style', + 'OVERRIDE_STYLE_EXPLAIN' => 'Replaces user’s (and guest’s) style with the style as defined under "Default style".', + 'SITE_DESC' => 'Site description', + 'SITE_HOME_TEXT' => 'Main website text', + 'SITE_HOME_TEXT_EXPLAIN' => 'This text will be displayed as a link to your website homepage in the board’s breadcrumbs. If not specified, it will default to “Home”.', + 'SITE_HOME_URL' => 'Main website URL', + 'SITE_HOME_URL_EXPLAIN' => 'If specified, a link to this URL will be prepended to your board’s breadcrumbs and the board logo will link to this URL instead of the forum index. An absolute URL is required, e.g. http://www.phpbb.com.', + 'SITE_NAME' => 'Site name', + 'SYSTEM_TIMEZONE' => 'Guest timezone', + 'SYSTEM_TIMEZONE_EXPLAIN' => 'Timezone to use for displaying times to users who are not logged in (guests, bots). Logged in users set their timezone during registration and can change it in their user control panel.', + 'WARNINGS_EXPIRE' => 'Warning duration', + 'WARNINGS_EXPIRE_EXPLAIN' => 'Number of days that will elapse before a warning will automatically expire from a user’s record. Set this value to 0 to make warnings permanent.', +)); + +// Board Features +$lang = array_merge($lang, array( + 'ACP_BOARD_FEATURES_EXPLAIN' => 'Here you can enable/disable several board features.', + + 'ALLOW_ATTACHMENTS' => 'Allow attachments', + 'ALLOW_BIRTHDAYS' => 'Allow birthdays', + 'ALLOW_BIRTHDAYS_EXPLAIN' => 'Allow birthdays to be entered and age being displayed in profiles. Please note the birthday list within the board index is controlled by a separate load setting.', + 'ALLOW_BOOKMARKS' => 'Allow bookmarking topics', + 'ALLOW_BOOKMARKS_EXPLAIN' => 'User is able to store personal bookmarks.', + 'ALLOW_BBCODE' => 'Allow BBCode', + 'ALLOW_FORUM_NOTIFY' => 'Allow subscribing to forums', + 'ALLOW_NAME_CHANGE' => 'Allow username changes', + 'ALLOW_NO_CENSORS' => 'Allow disabling of word censoring', + 'ALLOW_NO_CENSORS_EXPLAIN' => 'Users can choose to disable the automatic word censoring of posts and private messages.', + 'ALLOW_PM_ATTACHMENTS' => 'Allow attachments in private messages', + 'ALLOW_PM_REPORT' => 'Allow users to report private messages', + 'ALLOW_PM_REPORT_EXPLAIN' => 'If this setting is enabled, users have the option of reporting a private message they have received or sent to the board’s moderators. These private messages will then be visible in the Moderator Control Panel.', + 'ALLOW_QUICK_REPLY' => 'Allow quick reply', + 'ALLOW_QUICK_REPLY_EXPLAIN' => 'This switch allows for the quick reply to be disabled board-wide. When enabled, forum specific settings will be used to determine whether the quick reply is displayed in individual forums.', + 'ALLOW_QUICK_REPLY_BUTTON' => 'Submit and enable quick reply in all forums', + 'ALLOW_SIG' => 'Allow signatures', + 'ALLOW_SIG_BBCODE' => 'Allow BBCode in user signatures', + 'ALLOW_SIG_FLASH' => 'Allow use of [FLASH] BBCode tag in user signatures', + 'ALLOW_SIG_IMG' => 'Allow use of [IMG] BBCode tag in user signatures', + 'ALLOW_SIG_LINKS' => 'Allow use of links in user signatures', + 'ALLOW_SIG_LINKS_EXPLAIN' => 'If disallowed the [URL] BBCode tag and automatic/magic URLs are disabled.', + 'ALLOW_SIG_SMILIES' => 'Allow use of smilies in user signatures', + 'ALLOW_SMILIES' => 'Allow smilies', + 'ALLOW_TOPIC_NOTIFY' => 'Allow subscribing to topics', + 'BOARD_PM' => 'Private messaging', + 'BOARD_PM_EXPLAIN' => 'Enable private messaging for all users.', + 'ALLOW_BOARD_NOTIFICATIONS' => 'Allow board notifications', +)); + +// Avatar Settings +$lang = array_merge($lang, array( + 'ACP_AVATAR_SETTINGS_EXPLAIN' => 'Avatars are generally small, unique images a user can associate with themselves. Depending on the style they are usually displayed below the username when viewing topics. Here you can determine how users can define their avatars. Please note that in order to upload avatars you need to have created the directory you name below and ensure it can be written to by the web server. Please also note that file size limits are only imposed on uploaded avatars, they do not apply to remotely linked images.', + + 'ALLOW_AVATARS' => 'Enable avatars', + 'ALLOW_AVATARS_EXPLAIN' => 'Allow general usage of avatars;
If you disable avatars in general or avatars of a certain mode, the disabled avatars will no longer be shown on the board, but users will still be able to download their own avatars in the User Control Panel.', + 'ALLOW_GRAVATAR' => 'Enable gravatar avatars', + 'ALLOW_LOCAL' => 'Enable gallery avatars', + 'ALLOW_REMOTE' => 'Enable remote avatars', + 'ALLOW_REMOTE_EXPLAIN' => 'Avatars linked to from another website.
Warning: Enabling this feature might allow users to check for the existence of files and services that are only accessible on the local network.', + 'ALLOW_REMOTE_UPLOAD' => 'Enable remote avatar uploading', + 'ALLOW_REMOTE_UPLOAD_EXPLAIN' => 'Allow uploading of avatars from another website.
Warning: Enabling this feature might allow users to check for the existence of files and services that are only accessible on the local network.', + 'ALLOW_UPLOAD' => 'Enable avatar uploading', + 'AVATAR_GALLERY_PATH' => 'Avatar gallery path', + 'AVATAR_GALLERY_PATH_EXPLAIN' => 'Path under your phpBB root directory for pre-loaded images, e.g. images/avatars/gallery.
Double dots like ../ will be stripped from the path for security reasons.', + 'AVATAR_STORAGE_PATH' => 'Avatar storage path', + 'AVATAR_STORAGE_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/avatars/upload.
Avatar uploading will not be available if this path is not writable.
Double dots like ../ will be stripped from the path for security reasons.', + 'MAX_AVATAR_SIZE' => 'Maximum avatar dimensions', + 'MAX_AVATAR_SIZE_EXPLAIN' => 'Width x Height in pixels.', + 'MAX_FILESIZE' => 'Maximum avatar file size', + 'MAX_FILESIZE_EXPLAIN' => 'For uploaded avatar files. If this value is 0, the uploaded filesize is only limited by your PHP configuration.', + 'MIN_AVATAR_SIZE' => 'Minimum avatar dimensions', + 'MIN_AVATAR_SIZE_EXPLAIN' => 'Width x Height in pixels.', +)); + +// Message Settings +$lang = array_merge($lang, array( + 'ACP_MESSAGE_SETTINGS_EXPLAIN' => 'Here you can set all default settings for private messaging.', + + 'ALLOW_BBCODE_PM' => 'Allow BBCode in private messages', + 'ALLOW_FLASH_PM' => 'Allow use of [FLASH] BBCode tag', + 'ALLOW_FLASH_PM_EXPLAIN' => 'Note that the ability to use flash in private messages, if enabled here, also depends on the permissions.', + 'ALLOW_FORWARD_PM' => 'Allow forwarding of private messages', + 'ALLOW_IMG_PM' => 'Allow use of [IMG] BBCode tag', + 'ALLOW_MASS_PM' => 'Allow sending of private messages to multiple users and groups', + 'ALLOW_MASS_PM_EXPLAIN' => 'Sending to groups can be adjusted per group within the group settings page.', + 'ALLOW_PRINT_PM' => 'Allow print view in private messaging', + 'ALLOW_QUOTE_PM' => 'Allow quotes in private messages', + 'ALLOW_SIG_PM' => 'Allow signature in private messages', + 'ALLOW_SMILIES_PM' => 'Allow smilies in private messages', + 'BOXES_LIMIT' => 'Maximum private messages per box', + 'BOXES_LIMIT_EXPLAIN' => 'Users may receive no more than this many messages in each of their private message boxes. Set this value to 0 to allow unlimited messages.', + 'BOXES_MAX' => 'Maximum private message folders', + 'BOXES_MAX_EXPLAIN' => 'By default users may create this many personal folders for private messages.', + 'ENABLE_PM_ICONS' => 'Enable use of topic icons in private messages', + 'FULL_FOLDER_ACTION' => 'Full folder default action', + 'FULL_FOLDER_ACTION_EXPLAIN'=> 'Default action to take if a user’s folder is full assuming the user’s folder action, if set at all, is not applicable. The only exception is for the “Sent messages” folder where the default action is always to delete old messages.', + 'HOLD_NEW_MESSAGES' => 'Hold new messages', + 'PM_EDIT_TIME' => 'Limit editing time', + 'PM_EDIT_TIME_EXPLAIN' => 'Limits the time available to edit a private message not already delivered. Setting the value to 0 disables this behaviour.', + 'PM_MAX_RECIPIENTS' => 'Maximum number of allowed recipients', + 'PM_MAX_RECIPIENTS_EXPLAIN' => 'The maximum number of allowed recipients in a private message. If 0 is entered, an unlimited number is allowed. This setting can be adjusted for every group within the group settings page.', +)); + +// Post Settings +$lang = array_merge($lang, array( + 'ACP_POST_SETTINGS_EXPLAIN' => 'Here you can set all default settings for posting.', + 'ALLOW_POST_LINKS' => 'Allow links in posts/private messages', + 'ALLOW_POST_LINKS_EXPLAIN' => 'If disallowed the [URL] BBCode tag and automatic/magic URLs are disabled.', + 'ALLOWED_SCHEMES_LINKS' => 'Allowed schemes in links', + 'ALLOWED_SCHEMES_LINKS_EXPLAIN' => 'Users can only post schemeless URLs or one of the comma-separated list of allowed schemes.', + 'ALLOW_POST_FLASH' => 'Allow use of [FLASH] BBCode tag in posts', + 'ALLOW_POST_FLASH_EXPLAIN' => 'If disallowed the [FLASH] BBCode tag is disabled in posts. Otherwise the permission system controls which users can use the [FLASH] BBCode tag.', + + 'BUMP_INTERVAL' => 'Bump interval', + 'BUMP_INTERVAL_EXPLAIN' => 'Number of minutes, hours or days between the last post to a topic and the ability to bump that topic. Setting the value to 0 disables bumping entirely.', + 'CHAR_LIMIT' => 'Maximum characters per post/message', + 'CHAR_LIMIT_EXPLAIN' => 'The number of characters allowed within a post/private message. Set to 0 for unlimited characters.', + 'DELETE_TIME' => 'Limit deleting time', + 'DELETE_TIME_EXPLAIN' => 'Limits the time available to delete a new post. Setting the value to 0 disables this behaviour.', + 'DISPLAY_LAST_EDITED' => 'Display last edited time information', + 'DISPLAY_LAST_EDITED_EXPLAIN' => 'Choose if the last edited by information to be displayed on posts.', + 'EDIT_TIME' => 'Limit editing time', + 'EDIT_TIME_EXPLAIN' => 'Limits the time available to edit a new post. Setting the value to 0 disables this behaviour.', + 'FLOOD_INTERVAL' => 'Flood interval', + 'FLOOD_INTERVAL_EXPLAIN' => 'Number of seconds a user must wait between posting new messages. To enable users to ignore this alter their permissions.', + 'HOT_THRESHOLD' => 'Popular topic threshold', + 'HOT_THRESHOLD_EXPLAIN' => 'Posts per topic threshold required for the popular topic annotation. Set to 0 to disable popular topics.', + 'MAX_POLL_OPTIONS' => 'Maximum number of poll options', + 'MAX_POST_FONT_SIZE' => 'Maximum font size per post', + 'MAX_POST_FONT_SIZE_EXPLAIN' => 'Maximum font size allowed in a post. Set to 0 for unlimited font size.', + 'MAX_POST_IMG_HEIGHT' => 'Maximum image height per post', + 'MAX_POST_IMG_HEIGHT_EXPLAIN' => 'Maximum height of an image/flash file in postings. Set to 0 for unlimited size.', + 'MAX_POST_IMG_WIDTH' => 'Maximum image width per post', + 'MAX_POST_IMG_WIDTH_EXPLAIN' => 'Maximum width of an image/flash file in postings. Set to 0 for unlimited size.', + 'MAX_POST_URLS' => 'Maximum links per post', + 'MAX_POST_URLS_EXPLAIN' => 'Maximum number of URLs in a post. Set to 0 for unlimited links.', + 'MIN_CHAR_LIMIT' => 'Minimum characters per post/message', + 'MIN_CHAR_LIMIT_EXPLAIN' => 'The minimum number of characters the user need to enter within a post/private message. The minimum for this setting is 1.', + 'POSTING' => 'Posting', + 'POSTS_PER_PAGE' => 'Posts per page', + 'QUOTE_DEPTH_LIMIT' => 'Maximum nesting depth for quotes', + 'QUOTE_DEPTH_LIMIT_EXPLAIN' => 'Maximum quote nesting depth in a post. Set to 0 for unlimited depth.', + 'SMILIES_LIMIT' => 'Maximum smilies per post', + 'SMILIES_LIMIT_EXPLAIN' => 'Maximum number of smilies in a post. Set to 0 for unlimited smilies.', + 'SMILIES_PER_PAGE' => 'Smilies per page', + 'TOPICS_PER_PAGE' => 'Topics per page', +)); + +// Signature Settings +$lang = array_merge($lang, array( + 'ACP_SIGNATURE_SETTINGS_EXPLAIN' => 'Here you can set all default settings for signatures.', + + 'MAX_SIG_FONT_SIZE' => 'Maximum signature font size', + 'MAX_SIG_FONT_SIZE_EXPLAIN' => 'Maximum font size allowed in user signatures. Set to 0 for unlimited size.', + 'MAX_SIG_IMG_HEIGHT' => 'Maximum signature image height', + 'MAX_SIG_IMG_HEIGHT_EXPLAIN' => 'Maximum height of an image/flash file in user signatures. Set to 0 for unlimited height.', + 'MAX_SIG_IMG_WIDTH' => 'Maximum signature image width', + 'MAX_SIG_IMG_WIDTH_EXPLAIN' => 'Maximum width of an image/flash file in user signatures. Set to 0 for unlimited width.', + 'MAX_SIG_LENGTH' => 'Maximum signature length', + 'MAX_SIG_LENGTH_EXPLAIN' => 'Maximum number of characters in user signatures.', + 'MAX_SIG_SMILIES' => 'Maximum smilies per signature', + 'MAX_SIG_SMILIES_EXPLAIN' => 'Maximum smilies allowed in user signatures. Set to 0 for unlimited smilies.', + 'MAX_SIG_URLS' => 'Maximum signature links', + 'MAX_SIG_URLS_EXPLAIN' => 'Maximum number of links in user signatures. Set to 0 for unlimited links.', +)); + +// Registration Settings +$lang = array_merge($lang, array( + 'ACP_REGISTER_SETTINGS_EXPLAIN' => 'Here you are able to define registration and profile related settings.', + + 'ACC_ACTIVATION' => 'Account activation', + 'ACC_ACTIVATION_EXPLAIN' => 'This determines whether users have immediate access to the board or if confirmation is required. You can also completely disable new registrations. “Board-wide email” must be enabled in order to use user or admin activation.', + 'ACC_ACTIVATION_WARNING' => 'Please note that the currently selected activation method requires emails to be enabled, otherwise registration will be disabled. We recommend to either select a different activation method or reenable emails.', + 'NEW_MEMBER_POST_LIMIT' => 'New member post limit', + 'NEW_MEMBER_POST_LIMIT_EXPLAIN' => 'New members are within the Newly Registered Users group until they reach this number of posts. You can use this group to keep them from using the PM system or to review their posts. A value of 0 disables this feature.', + 'NEW_MEMBER_GROUP_DEFAULT' => 'Set Newly Registered Users group to default', + 'NEW_MEMBER_GROUP_DEFAULT_EXPLAIN' => 'If set to yes, and a new member post limit is specified, newly registered users will not only be put into the Newly Registered Users group, but this group will also be their default one. This may come in handy if you want to assign a group default rank and/or avatar the user then inherits.', + + 'ACC_ADMIN' => 'By admin', + 'ACC_DISABLE' => 'Disable registration', + 'ACC_NONE' => 'No activation (immediate access)', + 'ACC_USER' => 'By user (email verification)', +// 'ACC_USER_ADMIN' => 'User + Admin', + 'ALLOW_EMAIL_REUSE' => 'Allow email address re-use', + 'ALLOW_EMAIL_REUSE_EXPLAIN' => 'Different users can register with the same email address.', + 'COPPA' => 'COPPA', + 'COPPA_FAX' => 'COPPA fax number', + 'COPPA_MAIL' => 'COPPA mailing address', + 'COPPA_MAIL_EXPLAIN' => 'This is the mailing address where parents will send COPPA registration forms.', + 'ENABLE_COPPA' => 'Enable COPPA', + 'ENABLE_COPPA_EXPLAIN' => 'This requires users to declare whether they are 13 or over for compliance with the U.S. COPPA. If this is disabled the COPPA specific groups will no longer be displayed.', + 'MAX_CHARS' => 'Max', + 'MIN_CHARS' => 'Min', + 'NO_AUTH_PLUGIN' => 'No suitable auth plugin found.', + 'PASSWORD_LENGTH' => 'Password length', + 'PASSWORD_LENGTH_EXPLAIN' => 'Minimum and maximum number of characters in passwords.', + 'REG_LIMIT' => 'Registration attempts', + 'REG_LIMIT_EXPLAIN' => 'Number of attempts users can make at solving the anti-spambot task before being locked out of that session.', + 'USERNAME_ALPHA_ONLY' => 'Alphanumeric only', + 'USERNAME_ALPHA_SPACERS' => 'Alphanumeric and spacers', + 'USERNAME_ASCII' => 'ASCII (no international unicode)', + 'USERNAME_LETTER_NUM' => 'Any letter and number', + 'USERNAME_LETTER_NUM_SPACERS' => 'Any letter, number, and spacer', + 'USERNAME_CHARS' => 'Limit username chars', + 'USERNAME_CHARS_ANY' => 'Any character', + 'USERNAME_CHARS_EXPLAIN' => 'Restrict type of characters that may be used in usernames, spacers are: space, -, +, _, [ and ].', + 'USERNAME_LENGTH' => 'Username length', + 'USERNAME_LENGTH_EXPLAIN' => 'Minimum and maximum number of characters in usernames.', +)); + +// Feeds +$lang = array_merge($lang, array( + 'ACP_FEED_MANAGEMENT' => 'General syndication feeds settings', + 'ACP_FEED_MANAGEMENT_EXPLAIN' => 'This module makes available various ATOM feeds, parsing any BBCode in posts to make them readable in external feeds.', + + 'ACP_FEED_GENERAL' => 'General feed settings', + 'ACP_FEED_POST_BASED' => 'Post-based feed settings', + 'ACP_FEED_TOPIC_BASED' => 'Topic-based feed settings', + 'ACP_FEED_SETTINGS_OTHER' => 'Other feeds and settings', + + 'ACP_FEED_ENABLE' => 'Enable feeds', + 'ACP_FEED_ENABLE_EXPLAIN' => 'Turns on or off ATOM feeds for the entire board.
Disabling this switches off all feeds, no matter how the options below are set.', + 'ACP_FEED_LIMIT' => 'Number of items', + 'ACP_FEED_LIMIT_EXPLAIN' => 'The maximum number of feed items to display.', + + 'ACP_FEED_OVERALL' => 'Enable board-wide feed', + 'ACP_FEED_OVERALL_EXPLAIN' => 'Board-wide new posts.', + 'ACP_FEED_FORUM' => 'Enable per-forum feeds', + 'ACP_FEED_FORUM_EXPLAIN' => 'Single forum and subforums new posts.', + 'ACP_FEED_TOPIC' => 'Enable per-topic feeds', + 'ACP_FEED_TOPIC_EXPLAIN' => 'Single topics new posts.', + + 'ACP_FEED_TOPICS_NEW' => 'Enable new topics feed', + 'ACP_FEED_TOPICS_NEW_EXPLAIN' => 'Enables the “New Topics” feed, which displays the last created topics including the first post.', + 'ACP_FEED_TOPICS_ACTIVE' => 'Enable active topics feed', + 'ACP_FEED_TOPICS_ACTIVE_EXPLAIN' => 'Enables the “Active Topics” feed, which displays the last active topics including the last post.', + 'ACP_FEED_NEWS' => 'News feed', + 'ACP_FEED_NEWS_EXPLAIN' => 'Pull the first post from these forums. Select no forums to disable news feed.
Select multiple forums by holding CTRL and clicking.', + + 'ACP_FEED_OVERALL_FORUMS' => 'Enable forums feed', + 'ACP_FEED_OVERALL_FORUMS_EXPLAIN' => 'Enables the “All forums” feed, which displays a list of forums.', + + 'ACP_FEED_HTTP_AUTH' => 'Allow HTTP Authentication', + 'ACP_FEED_HTTP_AUTH_EXPLAIN' => 'Enables HTTP authentication, which allows users to receive content that is hidden to guest users by adding the auth=http parameter to the feed URL. Please note that some PHP setups require additional changes to the .htaccess file. Instructions can be found in that file.', + 'ACP_FEED_ITEM_STATISTICS' => 'Item statistics', + 'ACP_FEED_ITEM_STATISTICS_EXPLAIN' => 'Display individual statistics underneath feed items
(e.g. posted by, date and time, replies, views)', + 'ACP_FEED_EXCLUDE_ID' => 'Exclude these forums', + 'ACP_FEED_EXCLUDE_ID_EXPLAIN' => 'Content from these will be not included in feeds. Select no forum to pull data from all forums.
Select/Deselect multiple forums by holding CTRL and clicking.', +)); + +// Visual Confirmation Settings +$lang = array_merge($lang, array( + 'ACP_VC_SETTINGS_EXPLAIN' => 'Here you can select and configure plugins, which are designed to block automated form submissions by spambots. These plugins typically work by challenging the user with a CAPTCHA, a test which is designed to be difficult for computers to solve.', + 'ACP_VC_EXT_GET_MORE' => 'For additional (and possibly better) anti-spam plugins, visit the phpBB.com Extensions Database. For more information on preventing spam on your board, visit the phpBB.com Knowledge Base.', + 'AVAILABLE_CAPTCHAS' => 'Available plugins', + 'CAPTCHA_UNAVAILABLE' => 'The plugin cannot be selected as its requirements are not met.', + 'CAPTCHA_GD' => 'GD image', + 'CAPTCHA_GD_3D' => 'GD 3D image', + 'CAPTCHA_GD_FOREGROUND_NOISE' => 'Foreground noise', + 'CAPTCHA_GD_EXPLAIN' => 'Uses GD to make a more advanced anti-spambot image.', + 'CAPTCHA_GD_FOREGROUND_NOISE_EXPLAIN' => 'Use foreground noise to make the image harder to read.', + 'CAPTCHA_GD_X_GRID' => 'Background noise x-axis', + 'CAPTCHA_GD_X_GRID_EXPLAIN' => 'Use lower settings of this to make the image harder to read. 0 will disable x-axis background noise.', + 'CAPTCHA_GD_Y_GRID' => 'Background noise y-axis', + 'CAPTCHA_GD_Y_GRID_EXPLAIN' => 'Use lower settings of this to make the image harder to read. 0 will disable y-axis background noise.', + 'CAPTCHA_GD_WAVE' => 'Wave distortion', + 'CAPTCHA_GD_WAVE_EXPLAIN' => 'This applies a wave distortion to the image.', + 'CAPTCHA_GD_3D_NOISE' => 'Add 3D-noise objects', + 'CAPTCHA_GD_3D_NOISE_EXPLAIN' => 'This adds additional objects to the image, over the letters.', + 'CAPTCHA_GD_FONTS' => 'Use different fonts', + 'CAPTCHA_GD_FONTS_EXPLAIN' => 'This setting controls how many different letter shapes are used. You can just use the default shapes or introduce altered letters. Adding lowercase letters is also possible.', + 'CAPTCHA_FONT_DEFAULT' => 'Default', + 'CAPTCHA_FONT_NEW' => 'New Shapes', + 'CAPTCHA_FONT_LOWER' => 'Also use lowercase', + 'CAPTCHA_NO_GD' => 'Simple image', + 'CAPTCHA_PREVIEW_MSG' => 'Your changes have not been saved, this is just a preview.', + 'CAPTCHA_PREVIEW_EXPLAIN' => 'The plugin as it would look like using the current selection.', + + 'CAPTCHA_SELECT' => 'Installed plugins', + 'CAPTCHA_SELECT_EXPLAIN' => 'The dropdown holds the plugins recognised by the board. Grey entries are not available right now and might need configuration prior to use.', + 'CAPTCHA_CONFIGURE' => 'Configure plugins', + 'CAPTCHA_CONFIGURE_EXPLAIN' => 'Change the settings for the selected plugin.', + 'CONFIGURE' => 'Configure', + 'CAPTCHA_NO_OPTIONS' => 'This plugin has no configuration options.', + + 'VISUAL_CONFIRM_POST' => 'Enable spambot countermeasures for guest postings', + 'VISUAL_CONFIRM_POST_EXPLAIN' => 'Requires guest users to pass the anti-spambot task to help prevent automated postings.', + 'VISUAL_CONFIRM_REG' => 'Enable spambot countermeasures for registrations', + 'VISUAL_CONFIRM_REG_EXPLAIN' => 'Requires new users to pass the anti-spambot task to help prevent automated registrations.', + 'VISUAL_CONFIRM_REFRESH' => 'Allow users to refresh the anti-spambot task', + 'VISUAL_CONFIRM_REFRESH_EXPLAIN' => 'Allows users to request a new anti-spambot task if they are unable to solve the current task during registration. Some plugins might not support this option.', +)); + +// Cookie Settings +$lang = array_merge($lang, array( + 'ACP_COOKIE_SETTINGS_EXPLAIN' => 'These details define the data used to send cookies to your users browsers. In most cases the default values for the cookie settings should be sufficient. If you do need to change any do so with care, incorrect settings can prevent users logging in. If you have problems with users staying logging in to your board, visit the phpBB.com Knowledge Base - Fixing incorrect cookie settings.', + + 'COOKIE_DOMAIN' => 'Cookie domain', + 'COOKIE_DOMAIN_EXPLAIN' => 'In most cases the cookie domain is optional. Leave it blank if you are unsure.

In the case where you have a board integrated with other software or have multiple domains, then to determine the cookie domain you need to do the following. If you have something like example.com and forums.example.com, or perhaps forums.example.com and blog.example.com. Remove the subdomains until you find the common domain, example.com. Now add a dot in front of the common domain and you would enter .example.com (note the dot at the beginning).', + 'COOKIE_NAME' => 'Cookie name', + 'COOKIE_NAME_EXPLAIN' => 'This can be anything what you want, make it original. Whenever the cookie settings are changed the name of the cookie should be changed.', + 'COOKIE_NOTICE' => 'Cookie notice', + 'COOKIE_NOTICE_EXPLAIN' => 'If enabled a cookie notice will be displayed to users when visiting your board. This might be required by law depending on the content of your board and enabled extensions.', + 'COOKIE_PATH' => 'Cookie path', + 'COOKIE_PATH_EXPLAIN' => 'This will usually be the same as your script path or simply a slash to make the cookie accessible across the site domain.', + 'COOKIE_SECURE' => 'Cookie secure', + 'COOKIE_SECURE_EXPLAIN' => 'If your server is running via SSL set this to enabled else leave as disabled. Having this enabled and not running via SSL will result in server errors during redirects.', + 'ONLINE_LENGTH' => 'View online time span', + 'ONLINE_LENGTH_EXPLAIN' => 'Number of minutes after which inactive users will not appear in “Who is online” listings. The higher this value the greater is the processing required to generate the listing.', + 'SESSION_LENGTH' => 'Session length', + 'SESSION_LENGTH_EXPLAIN' => 'Sessions will expire after this time, in seconds.', +)); + +// Contact Settings +$lang = array_merge($lang, array( + 'ACP_CONTACT_SETTINGS_EXPLAIN' => 'Here you can enable and disable the contact page and also add a text that is displayed on the page.', + + 'CONTACT_US_ENABLE' => 'Enable contact page', + 'CONTACT_US_ENABLE_EXPLAIN' => 'This page allows users to send emails to board administrators. Please note that board-wide emails option must be enabled as well. You can find this option in General > Client Communication > Email settings.', + + 'CONTACT_US_INFO' => 'Contact information', + 'CONTACT_US_INFO_EXPLAIN' => 'The message is displayed on the contact page', + 'CONTACT_US_INFO_PREVIEW' => 'Contact page information - Preview', + 'CONTACT_US_INFO_UPDATED' => 'Contact page information has been updated.', +)); + +// Load Settings +$lang = array_merge($lang, array( + 'ACP_LOAD_SETTINGS_EXPLAIN' => 'Here you can enable and disable certain board functions to reduce the amount of processing required. On most servers there is no need to disable any functions. However on certain systems or in shared hosting environments it may be beneficial to disable capabilities you do not really need. You can also specify limits for system load and active sessions beyond which the board will go offline.', + + 'ALLOW_CDN' => 'Allow usage of third party content delivery networks', + 'ALLOW_CDN_EXPLAIN' => 'If this setting is enabled, some files will be served from external third party servers instead of your server. This reduces the network bandwidth required by your server, but may present a privacy issue for some board administrators. In a default phpBB installation, this includes loading “jQuery” and the font “Open Sans” from Google’s content delivery network.', + 'ALLOW_LIVE_SEARCHES' => 'Allow live searches', + 'ALLOW_LIVE_SEARCHES_EXPLAIN' => 'If this setting is enabled, users are provided with keyword suggestions as they type in certain fields throughout the board.', + 'CUSTOM_PROFILE_FIELDS' => 'Custom profile fields', + 'LIMIT_LOAD' => 'Limit system load', + 'LIMIT_LOAD_EXPLAIN' => 'If the system’s 1-minute load average exceeds this value the board will automatically go offline. A value of 1.0 equals ~100% utilisation of one processor. This only functions on UNIX based servers and where this information is accessible. The value here resets itself to 0 if phpBB was unable to get the load limit.', + 'LIMIT_SESSIONS' => 'Limit sessions', + 'LIMIT_SESSIONS_EXPLAIN' => 'If the number of sessions exceeds this value within a one minute period the board will go offline. Set to 0 for unlimited sessions.', + 'LOAD_CPF_MEMBERLIST' => 'Allow styles to display custom profile fields in memberlist', + 'LOAD_CPF_PM' => 'Display custom profile fields in private messages', + 'LOAD_CPF_VIEWPROFILE' => 'Display custom profile fields in user profiles', + 'LOAD_CPF_VIEWTOPIC' => 'Display custom profile fields on topic pages', + 'LOAD_USER_ACTIVITY' => 'Show user’s activity', + 'LOAD_USER_ACTIVITY_EXPLAIN' => 'Displays active topic/forum in user profiles and user control panel. It is recommended to disable this on boards with more than one million posts.', + 'LOAD_USER_ACTIVITY_LIMIT' => 'User’s activity post limit', + 'LOAD_USER_ACTIVITY_LIMIT_EXPLAIN' => 'The active topic/forum won’t be shown for users having more than this number of posts. Set to 0 to disable the limit.', + 'READ_NOTIFICATION_EXPIRE_DAYS' => 'Read Notification Expiration', + 'READ_NOTIFICATION_EXPIRE_DAYS_EXPLAIN' => 'Number of days that will elapse before a read notification will automatically be deleted. Set this value to 0 to make notifications permanent.', + 'RECOMPILE_STYLES' => 'Recompile stale style components', + 'RECOMPILE_STYLES_EXPLAIN' => 'Check for updated style components on filesystem and recompile.', + 'YES_ACCURATE_PM_BUTTON' => 'Enable permission specific PM button in topic pages', + 'YES_ACCURATE_PM_BUTTON_EXPLAIN' => 'If this setting is enabled, only post profiles of users who are permitted to read private messages will have a private message button.', + 'YES_ANON_READ_MARKING' => 'Enable topic marking for guests', + 'YES_ANON_READ_MARKING_EXPLAIN' => 'Stores read/unread status information for guests. If disabled, posts are always marked read for guests.', + 'YES_BIRTHDAYS' => 'Enable birthday listing', + 'YES_BIRTHDAYS_EXPLAIN' => 'If disabled the birthday listing is no longer displayed. To let this setting take effect the birthday feature needs to be enabled too.', + 'YES_JUMPBOX' => 'Enable display of jumpbox', + 'YES_MODERATORS' => 'Enable display of moderators', + 'YES_ONLINE' => 'Enable online user listings', + 'YES_ONLINE_EXPLAIN' => 'Display online user information on index, forum and topic pages.', + 'YES_ONLINE_GUESTS' => 'Enable online guest listings in viewonline', + 'YES_ONLINE_GUESTS_EXPLAIN' => 'Allow display of guest user information in viewonline.', + 'YES_ONLINE_TRACK' => 'Enable display of user online/offline information', + 'YES_ONLINE_TRACK_EXPLAIN' => 'Display online information for user in profiles and topic pages.', + 'YES_POST_MARKING' => 'Enable dotted topics', + 'YES_POST_MARKING_EXPLAIN' => 'Indicates whether user has posted to a topic.', + 'YES_READ_MARKING' => 'Enable server-side topic marking', + 'YES_READ_MARKING_EXPLAIN' => 'Stores read/unread status information in the database rather than a cookie.', + 'YES_UNREAD_SEARCH' => 'Enable search for unread posts', +)); + +// Auth settings +$lang = array_merge($lang, array( + 'ACP_AUTH_SETTINGS_EXPLAIN' => 'phpBB supports authentication plug-ins, or modules. These allow you determine how users are authenticated when they log into the board. By default four plug-ins are provided: DB, LDAP, Apache, and OAuth. Not all methods require additional information so only fill out fields if they are relevant to the selected method.', + + 'AUTH_METHOD' => 'Select an authentication method', + + 'AUTH_PROVIDER_OAUTH_ERROR_ELEMENT_MISSING' => 'Both the key and secret of each enabled OAuth service provider must be provided. Only one was provided for an OAuth service provider.', + 'AUTH_PROVIDER_OAUTH_EXPLAIN' => 'Each OAuth provider requires a unique secret and key in order to authenticate with the external server. These should be supplied by the OAuth service when you register your website with them and should be entered exactly as provided to you.
Any service that does not have both a key and a secret entered here will not be available for use by the forum users. Also note, that user can still register and login using the DB authentication plug-in.', + 'AUTH_PROVIDER_OAUTH_KEY' => 'Key', + 'AUTH_PROVIDER_OAUTH_TITLE' => 'OAuth', + 'AUTH_PROVIDER_OAUTH_SECRET' => 'Secret', + + 'APACHE_SETUP_BEFORE_USE' => 'You have to setup apache authentication before you switch phpBB to this authentication method. Keep in mind that the username you use for apache authentication has to be the same as your phpBB username. Apache authentication can only be used with mod_php (not with a CGI version) and safe_mode disabled.', + + 'LDAP' => 'LDAP', + 'LDAP_DN' => 'LDAP base dn', + 'LDAP_DN_EXPLAIN' => 'This is the Distinguished Name, locating the user information, e.g. o=My Company,c=US.', + 'LDAP_EMAIL' => 'LDAP email attribute', + 'LDAP_EMAIL_EXPLAIN' => 'Set this to the name of your user entry email attribute (if one exists) in order to automatically set the email address for new users. Leaving this empty results in empty email address for users who log in for the first time.', + 'LDAP_INCORRECT_USER_PASSWORD' => 'Binding to LDAP server failed with specified user/password.', + 'LDAP_NO_EMAIL' => 'The specified email attribute does not exist.', + 'LDAP_NO_IDENTITY' => 'Could not find a login identity for %s.', + 'LDAP_PASSWORD' => 'LDAP password', + 'LDAP_PASSWORD_EXPLAIN' => 'Leave blank to use anonymous binding, otherwise fill in the password for the above user. Required for Active Directory Servers.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', + 'LDAP_PORT' => 'LDAP server port', + 'LDAP_PORT_EXPLAIN' => 'Optionally you can specify a port which should be used to connect to the LDAP server instead of the default port 389.', + 'LDAP_SERVER' => 'LDAP server name', + 'LDAP_SERVER_EXPLAIN' => 'If using LDAP this is the hostname or IP address of the LDAP server. Alternatively you can specify an URL like ldap://hostname:port/', + 'LDAP_UID' => 'LDAP uid', + 'LDAP_UID_EXPLAIN' => 'This is the key under which to search for a given login identity, e.g. uid, sn, etc.', + 'LDAP_USER' => 'LDAP user dn', + 'LDAP_USER_EXPLAIN' => 'Leave blank to use anonymous binding. If filled in phpBB uses the specified distinguished name on login attempts to find the correct user, e.g. uid=Username,ou=MyUnit,o=MyCompany,c=US. Required for Active Directory Servers.', + 'LDAP_USER_FILTER' => 'LDAP user filter', + 'LDAP_USER_FILTER_EXPLAIN' => 'Optionally you can further limit the searched objects with additional filters. For example objectClass=posixGroup would result in the use of (&(uid=$username)(objectClass=posixGroup))', +)); + +// Server Settings +$lang = array_merge($lang, array( + 'ACP_SERVER_SETTINGS_EXPLAIN' => 'Here you define server and domain dependent settings. Please ensure the data you enter is accurate, errors will result in emails containing incorrect information. When entering the domain name remember it does include http:// or other protocol term. Only alter the port number if you know your server uses a different value, port 80 is correct in most cases.', + + 'ENABLE_GZIP' => 'Enable GZip compression', + 'ENABLE_GZIP_EXPLAIN' => 'Generated content will be compressed prior to sending it to the user. This can reduce network traffic but will also increase CPU usage on both server and client side. Requires zlib PHP extension to be loaded.', + 'FORCE_SERVER_VARS' => 'Force server URL settings', + 'FORCE_SERVER_VARS_EXPLAIN' => 'If set to yes the server settings defined here will be used in favour of the automatically determined values.', + 'ICONS_PATH' => 'Post icons storage path', + 'ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/icons.', + 'MOD_REWRITE_ENABLE' => 'Enable URL Rewriting', + 'MOD_REWRITE_ENABLE_EXPLAIN' => 'When enabled, URLs containing ’app.php’ will be rewritten to remove the filename (i.e. app.php/foo will become /foo). Apache server’s mod_rewrite module is required for this functionality to work; if this option is enabled without mod_rewrite support, URLs on your board may be broken.', + 'MOD_REWRITE_DISABLED' => 'The mod_rewrite module on your Apache web server is disabled. Enable the module or contact your web hosting provider if you wish to enable this feature.', + 'MOD_REWRITE_INFORMATION_UNAVAILABLE' => 'We are unable to determine whether or not this server supports URL rewriting. This setting may be enabled but if URL rewriting is not available, paths generated by this board (such as for use in links) may be broken. Contact your web hosting provider if you are unsure whether or not you can safely enable this feature.', + 'PATH_SETTINGS' => 'Path settings', + 'RANKS_PATH' => 'Rank image storage path', + 'RANKS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/ranks.', + 'SCRIPT_PATH' => 'Script path', + 'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB is located relative to the domain name, e.g. /phpBB3.', + 'SERVER_NAME' => 'Domain name', + 'SERVER_NAME_EXPLAIN' => 'The domain name this board runs from (for example: www.example.com).', + 'SERVER_PORT' => 'Server port', + 'SERVER_PORT_EXPLAIN' => 'The port your server is running on, usually 80, only change if different.', + 'SERVER_PROTOCOL' => 'Server protocol', + 'SERVER_PROTOCOL_EXPLAIN' => 'This is used as the server protocol if these settings are forced. If empty or not forced the protocol is determined by the cookie secure settings (http:// or https://).', + 'SERVER_URL_SETTINGS' => 'Server URL settings', + 'SMILIES_PATH' => 'Smilies storage path', + 'SMILIES_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/smilies.', + 'UPLOAD_ICONS_PATH' => 'Extension group icons storage path', + 'UPLOAD_ICONS_PATH_EXPLAIN' => 'Path under your phpBB root directory, e.g. images/upload_icons.', + 'USE_SYSTEM_CRON' => 'Run periodic tasks from system cron', + 'USE_SYSTEM_CRON_EXPLAIN' => 'When off, phpBB will arrange for periodic tasks to be run automatically. When on, phpBB will not schedule any periodic tasks by itself; a system administrator must arrange for bin/phpbbcli.php cron:run to be run by the system cron facility at regular intervals (e.g. every 5 minutes).', +)); + +// Security Settings +$lang = array_merge($lang, array( + 'ACP_SECURITY_SETTINGS_EXPLAIN' => 'Here you are able to define session and login related settings.', + + 'ALL' => 'All', + 'ALLOW_AUTOLOGIN' => 'Allow "Remember Me" logins', + 'ALLOW_AUTOLOGIN_EXPLAIN' => 'Determines whether users are given "Remember Me" option when they visit the board.', + 'ALLOW_PASSWORD_RESET' => 'Allow password reset ("Forgot Password")', + 'ALLOW_PASSWORD_RESET_EXPLAIN' => 'Determines whether or not users are able to use the "I forgot my password" link on the login page to recover their account. If you use an external authentication mechanism you may wish to disable this feature.', + 'AUTOLOGIN_LENGTH' => '"Remember Me" login key expiration length (in days)', + 'AUTOLOGIN_LENGTH_EXPLAIN' => 'Number of days after which "Remember Me" login keys are removed or zero to disable.', + 'BROWSER_VALID' => 'Validate browser', + 'BROWSER_VALID_EXPLAIN' => 'Enables browser validation for each session improving security.', + 'CHECK_DNSBL' => 'Check IP against DNS Blackhole List', + 'CHECK_DNSBL_EXPLAIN' => 'If enabled the user’s IP address is checked against the following DNSBL services on registration and posting: spamcop.net and www.spamhaus.org. This lookup may take a while, depending on the server’s configuration. If slowdowns are experienced or too many false positives reported it is recommended to disable this check.', + 'CLASS_B' => 'A.B', + 'CLASS_C' => 'A.B.C', + 'EMAIL_CHECK_MX' => 'Check email domain for valid MX record', + 'EMAIL_CHECK_MX_EXPLAIN' => 'If enabled, the email domain provided on registration and profile changes is checked for a valid MX record.', + 'FORCE_PASS_CHANGE' => 'Force password change', + 'FORCE_PASS_CHANGE_EXPLAIN' => 'Require user to change their password after a set number of days. Setting this value to 0 disables this behaviour.', + 'FORM_TIME_MAX' => 'Maximum time to submit forms', + 'FORM_TIME_MAX_EXPLAIN' => 'The time a user has to submit a form. Use -1 to disable. Note that a form might become invalid if the session expires, regardless of this setting.', + 'FORM_SID_GUESTS' => 'Tie forms to guest sessions', + 'FORM_SID_GUESTS_EXPLAIN' => 'If enabled, the form token issued to guests will be session-exclusive. This can cause problems with some ISPs.', + 'FORWARDED_FOR_VALID' => 'Validate X_FORWARDED_FOR header', + 'FORWARDED_FOR_VALID_EXPLAIN' => 'Sessions will only be continued if the sent X_FORWARDED_FOR header equals the one sent with the previous request. Bans will be checked against IPs in X_FORWARDED_FOR too.', + 'IP_VALID' => 'Session IP validation', + 'IP_VALID_EXPLAIN' => 'Determines how much of the users IP is used to validate a session; All compares the complete address, A.B.C the first x.x.x, A.B the first x.x, None disables checking. On IPv6 addresses A.B.C compares the first 4 blocks and A.B the first 3 blocks.', + 'IP_LOGIN_LIMIT_MAX' => 'Maximum number of login attempts per IP address', + 'IP_LOGIN_LIMIT_MAX_EXPLAIN' => 'The threshold of login attempts allowed from a single IP address before an anti-spambot task is triggered. Enter 0 to prevent the anti-spambot task from being triggered by IP addresses.', + 'IP_LOGIN_LIMIT_TIME' => 'IP address login attempt expiration time', + 'IP_LOGIN_LIMIT_TIME_EXPLAIN' => 'Login attempts expire after this period.', + 'IP_LOGIN_LIMIT_USE_FORWARDED' => 'Limit login attempts by X_FORWARDED_FOR header', + 'IP_LOGIN_LIMIT_USE_FORWARDED_EXPLAIN' => 'Instead of limiting login attempts by IP address they are limited by X_FORWARDED_FOR values.
Warning: Only enable this if you are operating a proxy server that sets X_FORWARDED_FOR to trustworthy values.', + 'MAX_LOGIN_ATTEMPTS' => 'Maximum number of login attempts per username', + 'MAX_LOGIN_ATTEMPTS_EXPLAIN' => 'The number of login attempts allowed for a single account before the anti-spambot task is triggered. Enter 0 to prevent the anti-spambot task from being triggered for distinct user accounts.', + 'NO_IP_VALIDATION' => 'None', + 'NO_REF_VALIDATION' => 'None', + 'PASSWORD_TYPE' => 'Password complexity', + 'PASSWORD_TYPE_EXPLAIN' => 'Determines how complex a password needs to be when set or altered, subsequent options include the previous ones.', + 'PASS_TYPE_ALPHA' => 'Must contain letters and numbers', + 'PASS_TYPE_ANY' => 'No requirements', + 'PASS_TYPE_CASE' => 'Must be mixed case', + 'PASS_TYPE_SYMBOL' => 'Must contain symbols', + 'REF_HOST' => 'Only validate host', + 'REF_PATH' => 'Also validate path', + 'REFERRER_VALID' => 'Validate Referrer', + 'REFERRER_VALID_EXPLAIN' => 'If enabled, the referrer of POST requests will be checked against the host/script path settings. This may cause issues with boards using several domains and or external logins.', + 'TPL_ALLOW_PHP' => 'Allow php in templates', + 'TPL_ALLOW_PHP_EXPLAIN' => 'If this option is enabled, PHP and INCLUDEPHP statements will be recognised and parsed in templates.', + 'UPLOAD_CERT_VALID' => 'Validate upload certificate', + 'UPLOAD_CERT_VALID_EXPLAIN' => 'If enabled, certificates of remote uploads will be validated. This requires the CA bundle to be defined by the openssl.cafile or curl.cainfo setting in your php.ini.', +)); + +// Email Settings +$lang = array_merge($lang, array( + 'ACP_EMAIL_SETTINGS_EXPLAIN' => 'This information is used when the board sends emails to your users. Please ensure the email address you specify is valid, any bounced or undeliverable messages will likely be sent to that address. If your host does not provide a native (PHP based) email service you can instead send messages directly using SMTP. This requires the address of an appropriate server (ask your provider if necessary). If the server requires authentication (and only if it does) enter the necessary username, password and authentication method.', + + 'ADMIN_EMAIL' => 'From email address', + 'ADMIN_EMAIL_EXPLAIN' => 'This will be used as the from address on all emails, the technical contact email address. It will always be used as the Sender address in emails.', + 'BOARD_EMAIL_FORM' => 'Users send email via board', + 'BOARD_EMAIL_FORM_EXPLAIN' => 'Instead of showing the users email address users are able to send emails via the board.', + 'BOARD_HIDE_EMAILS' => 'Hide email addresses', + 'BOARD_HIDE_EMAILS_EXPLAIN' => 'This function keeps email addresses completely private.', + 'CONTACT_EMAIL' => 'Contact email address', + 'CONTACT_EMAIL_EXPLAIN' => 'This address will be used whenever a specific contact point is needed, e.g. spam, error output, etc. It will always be used as the From and Reply-To address in emails.', + 'CONTACT_EMAIL_NAME' => 'Contact name', + 'CONTACT_EMAIL_NAME_EXPLAIN' => 'This is the contact name that e-mail recipients will see. If you don’t want to have a contact name, leave this field empty.', + 'EMAIL_FORCE_SENDER' => 'Force from email address', + 'EMAIL_FORCE_SENDER_EXPLAIN' => 'This will set the Return-Path to the from email address instead of using the local user and hostname of the server. This setting does not apply when using SMTP.
Warning: Requires the user that the webserver runs as to be added as trusted user to the sendmail configuration.', + 'EMAIL_PACKAGE_SIZE' => 'Email package size', + 'EMAIL_PACKAGE_SIZE_EXPLAIN' => 'This is the number of maximum emails sent out in one package. This setting is applied to the internal message queue; set this value to 0 if you have problems with non-delivered notification emails.', + 'EMAIL_SIG' => 'Email signature', + 'EMAIL_SIG_EXPLAIN' => 'This text will be attached to all emails the board sends.', + 'ENABLE_EMAIL' => 'Enable board-wide emails', + 'ENABLE_EMAIL_EXPLAIN' => 'If this is set to disabled no emails will be sent by the board at all. Note the user and admin account activation settings require this setting to be enabled. If currently using “user” or “admin” activation in the activation settings, disabling this setting will disable registration.', + 'SEND_TEST_EMAIL' => 'Send a test email', + 'SEND_TEST_EMAIL_EXPLAIN' => 'This will send a test email to the address defined in your account.', + 'SMTP_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', + 'SMTP_ALLOW_SELF_SIGNED_EXPLAIN'=> 'Allow connections to SMTP server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', + 'SMTP_AUTH_METHOD' => 'Authentication method for SMTP', + 'SMTP_AUTH_METHOD_EXPLAIN' => 'Only used if a username/password is set, ask your provider if you are unsure which method to use.', + 'SMTP_CRAM_MD5' => 'CRAM-MD5', + 'SMTP_DIGEST_MD5' => 'DIGEST-MD5', + 'SMTP_LOGIN' => 'LOGIN', + 'SMTP_PASSWORD' => 'SMTP password', + 'SMTP_PASSWORD_EXPLAIN' => 'Only enter a password if your SMTP server requires it.
Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', + 'SMTP_PLAIN' => 'PLAIN', + 'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP', + 'SMTP_PORT' => 'SMTP server port', + 'SMTP_PORT_EXPLAIN' => 'Only change this if you know your SMTP server is on a different port.', + 'SMTP_SERVER' => 'SMTP server address and protocol', + 'SMTP_SERVER_EXPLAIN' => 'Note that you have to provide the protocol that your server uses. If you are using SSL, this has to be "ssl://your.mailserver.com"', + 'SMTP_SETTINGS' => 'SMTP settings', + 'SMTP_USERNAME' => 'SMTP username', + 'SMTP_USERNAME_EXPLAIN' => 'Only enter a username if your SMTP server requires it.', + 'SMTP_VERIFY_PEER' => 'Verify SSL certificate', + 'SMTP_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by SMTP server.
Warning: Connecting peers with unverified SSL certificates may cause security implications.', + 'SMTP_VERIFY_PEER_NAME' => 'Verify SMTP peer name', + 'SMTP_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for SMTP servers using SSL / TLS connections.
Warning: Connecting to unverified peers may cause security implications.', + 'TEST_EMAIL_SENT' => 'The test email has been sent.
If you don’t receive it, please check your emails configuration.

If you require assistance, please visit the phpBB support forums.', + + 'USE_SMTP' => 'Use SMTP server for email', + 'USE_SMTP_EXPLAIN' => 'Select “Yes” if you want or have to send email via a named server instead of the local mail function.', +)); + +// Jabber settings +$lang = array_merge($lang, array( + 'ACP_JABBER_SETTINGS_EXPLAIN' => 'Here you can enable and control the use of Jabber for instant messaging and board notifications. Jabber is an open source protocol and therefore available for use by anyone. Some Jabber servers include gateways or transports which allow you to contact users on other networks. Not all servers offer all transports and changes in protocols can prevent transports from operating. Please be sure to enter already registered account details - phpBB will use the details you enter here as is.', + + 'JAB_ALLOW_SELF_SIGNED' => 'Allow self-signed SSL certificates', + 'JAB_ALLOW_SELF_SIGNED_EXPLAIN' => 'Allow connections to Jabber server with self-signed SSL certificate.
Warning: Allowing self-signed SSL certificates may cause security implications.', + 'JAB_ENABLE' => 'Enable Jabber', + 'JAB_ENABLE_EXPLAIN' => 'Enables use of Jabber messaging and notifications.', + 'JAB_GTALK_NOTE' => 'Please note that GTalk will not work because the dns_get_record function could not be found. This function is not available in PHP4, and is not implemented on Windows platforms. It currently does not work on BSD-based systems, including Mac OS.', + 'JAB_PACKAGE_SIZE' => 'Jabber package size', + 'JAB_PACKAGE_SIZE_EXPLAIN' => 'This is the number of messages sent in one package. If set to 0 the message is sent immediately and will not be queued for later sending.', + 'JAB_PASSWORD' => 'Jabber password', + 'JAB_PASSWORD_EXPLAIN' => 'Warning: This password will be stored as plain text in the database, visible to everybody who can access your database or who can view this configuration page.', + 'JAB_PORT' => 'Jabber port', + 'JAB_PORT_EXPLAIN' => 'Leave blank unless you know it is not port 5222.', + 'JAB_SERVER' => 'Jabber server', + 'JAB_SERVER_EXPLAIN' => 'See %sjabber.org%s for a list of servers.', + 'JAB_SETTINGS_CHANGED' => 'Jabber settings changed successfully.', + 'JAB_USE_SSL' => 'Use SSL to connect', + 'JAB_USE_SSL_EXPLAIN' => 'If enabled a secure connection is tried to be established. The Jabber port will be modified to 5223 if port 5222 is specified.', + 'JAB_USERNAME' => 'Jabber username or JID', + 'JAB_USERNAME_EXPLAIN' => 'Specify a registered username or a valid JID. The username will not be checked for validity. If you only specify a username, then your JID will be the username and the server you specified above. Else, specify a valid JID, for example user@jabber.org.', + 'JAB_VERIFY_PEER' => 'Verify SSL certificate', + 'JAB_VERIFY_PEER_EXPLAIN' => 'Require verification of SSL certificate used by Jabber server.
Warning: Connecting peers with unverified SSL certificates may cause security implications.', + 'JAB_VERIFY_PEER_NAME' => 'Verify Jabber peer name', + 'JAB_VERIFY_PEER_NAME_EXPLAIN' => 'Require verification of peer name for Jabber servers using SSL / TLS connections.
Warning: Connecting to unverified peers may cause security implications.', +)); diff --git a/install/update/old/language/en/acp/common.php b/install/update/old/language/en/acp/common.php new file mode 100644 index 0000000..1c22535 --- /dev/null +++ b/install/update/old/language/en/acp/common.php @@ -0,0 +1,833 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Common +$lang = array_merge($lang, array( + 'ACP_ADMINISTRATORS' => 'Administrators', + 'ACP_ADMIN_LOGS' => 'Admin log', + 'ACP_ADMIN_ROLES' => 'Admin roles', + 'ACP_ATTACHMENTS' => 'Attachments', + 'ACP_ATTACHMENT_SETTINGS' => 'Attachment settings', + 'ACP_AUTH_SETTINGS' => 'Authentication', + 'ACP_AUTOMATION' => 'Automation', + 'ACP_AVATAR_SETTINGS' => 'Avatar settings', + + 'ACP_BACKUP' => 'Backup', + 'ACP_BAN' => 'Banning', + 'ACP_BAN_EMAILS' => 'Ban emails', + 'ACP_BAN_IPS' => 'Ban IPs', + 'ACP_BAN_USERNAMES' => 'Ban users', + 'ACP_BBCODES' => 'BBCodes', + 'ACP_BOARD_CONFIGURATION' => 'Board configuration', + 'ACP_BOARD_FEATURES' => 'Board features', + 'ACP_BOARD_MANAGEMENT' => 'Board management', + 'ACP_BOARD_SETTINGS' => 'Board settings', + 'ACP_BOTS' => 'Spiders/Robots', + + 'ACP_CAPTCHA' => 'CAPTCHA', + + 'ACP_CAT_CUSTOMISE' => 'Customise', + 'ACP_CAT_DATABASE' => 'Database', + 'ACP_CAT_DOT_MODS' => 'Extensions', + 'ACP_CAT_FORUMS' => 'Forums', + 'ACP_CAT_GENERAL' => 'General', + 'ACP_CAT_MAINTENANCE' => 'Maintenance', + 'ACP_CAT_PERMISSIONS' => 'Permissions', + 'ACP_CAT_POSTING' => 'Posting', + 'ACP_CAT_STYLES' => 'Styles', + 'ACP_CAT_SYSTEM' => 'System', + 'ACP_CAT_USERGROUP' => 'Users and Groups', + 'ACP_CAT_USERS' => 'Users', + 'ACP_CLIENT_COMMUNICATION' => 'Client communication', + 'ACP_COOKIE_SETTINGS' => 'Cookie settings', + 'ACP_CONTACT' => 'Contact page', + 'ACP_CONTACT_SETTINGS' => 'Contact page settings', + 'ACP_CRITICAL_LOGS' => 'Error log', + 'ACP_CUSTOM_PROFILE_FIELDS' => 'Custom profile fields', + + 'ACP_DATABASE' => 'Database management', + 'ACP_DISALLOW' => 'Disallow', + 'ACP_DISALLOW_USERNAMES' => 'Disallow usernames', + + 'ACP_EMAIL_SETTINGS' => 'Email settings', + 'ACP_EXTENSION_GROUPS' => 'Manage attachment extension groups', + 'ACP_EXTENSION_MANAGEMENT' => 'Extension management', + 'ACP_EXTENSIONS' => 'Manage extensions', + + 'ACP_FORUM_BASED_PERMISSIONS' => 'Forum based permissions', + 'ACP_FORUM_LOGS' => 'Forum logs', + 'ACP_FORUM_MANAGEMENT' => 'Forum management', + 'ACP_FORUM_MODERATORS' => 'Forum moderators', + 'ACP_FORUM_PERMISSIONS' => 'Forum permissions', + 'ACP_FORUM_PERMISSIONS_COPY' => 'Copy forum permissions', + 'ACP_FORUM_ROLES' => 'Forum roles', + + 'ACP_GENERAL_CONFIGURATION' => 'General configuration', + 'ACP_GENERAL_TASKS' => 'General tasks', + 'ACP_GLOBAL_MODERATORS' => 'Global moderators', + 'ACP_GLOBAL_PERMISSIONS' => 'Global permissions', + 'ACP_GROUPS' => 'Groups', + 'ACP_GROUPS_FORUM_PERMISSIONS' => 'Group forum permissions', + 'ACP_GROUPS_MANAGE' => 'Manage groups', + 'ACP_GROUPS_MANAGEMENT' => 'Group management', + 'ACP_GROUPS_PERMISSIONS' => 'Group permissions', + 'ACP_GROUPS_POSITION' => 'Manage group positions', + + 'ACP_HELP_PHPBB' => 'Help support phpBB', + + 'ACP_ICONS' => 'Topic icons', + 'ACP_ICONS_SMILIES' => 'Topic icons/smilies', + 'ACP_INACTIVE_USERS' => 'Inactive users', + 'ACP_INDEX' => 'ACP index', + + 'ACP_JABBER_SETTINGS' => 'Jabber settings', + + 'ACP_LANGUAGE' => 'Language management', + 'ACP_LANGUAGE_PACKS' => 'Language packs', + 'ACP_LOAD_SETTINGS' => 'Load settings', + 'ACP_LOGGING' => 'Logging', + + 'ACP_MAIN' => 'ACP index', + + 'ACP_MANAGE_ATTACHMENTS' => 'Manage attachments', + 'ACP_MANAGE_ATTACHMENTS_EXPLAIN' => 'Here you can list and delete files attached to posts and private messages.', + + 'ACP_MANAGE_EXTENSIONS' => 'Manage attachment extensions', + 'ACP_MANAGE_FORUMS' => 'Manage forums', + 'ACP_MANAGE_RANKS' => 'Manage ranks', + 'ACP_MANAGE_REASONS' => 'Manage report/denial reasons', + 'ACP_MANAGE_USERS' => 'Manage users', + 'ACP_MASS_EMAIL' => 'Mass email', + 'ACP_MESSAGES' => 'Messages', + 'ACP_MESSAGE_SETTINGS' => 'Private message settings', + 'ACP_MODULE_MANAGEMENT' => 'Module management', + 'ACP_MOD_LOGS' => 'Moderator log', + 'ACP_MOD_ROLES' => 'Moderator roles', + + 'ACP_NO_ITEMS' => 'There are no items yet.', + + 'ACP_ORPHAN_ATTACHMENTS' => 'Orphaned attachments', + + 'ACP_PERMISSIONS' => 'Permissions', + 'ACP_PERMISSION_MASKS' => 'Permission masks', + 'ACP_PERMISSION_ROLES' => 'Permission roles', + 'ACP_PERMISSION_TRACE' => 'Permission trace', + 'ACP_PHP_INFO' => 'PHP information', + 'ACP_POST_SETTINGS' => 'Post settings', + 'ACP_PRUNE_FORUMS' => 'Prune forums', + 'ACP_PRUNE_USERS' => 'Prune users', + 'ACP_PRUNING' => 'Pruning', + + 'ACP_QUICK_ACCESS' => 'Quick access', + + 'ACP_RANKS' => 'Ranks', + 'ACP_REASONS' => 'Report/denial reasons', + 'ACP_REGISTER_SETTINGS' => 'User registration settings', + + 'ACP_RESTORE' => 'Restore', + + 'ACP_FEED' => 'Feed management', + 'ACP_FEED_SETTINGS' => 'Feed settings', + + 'ACP_SEARCH' => 'Search configuration', + 'ACP_SEARCH_INDEX' => 'Search index', + 'ACP_SEARCH_SETTINGS' => 'Search settings', + + 'ACP_SECURITY_SETTINGS' => 'Security settings', + 'ACP_SERVER_CONFIGURATION' => 'Server configuration', + 'ACP_SERVER_SETTINGS' => 'Server settings', + 'ACP_SIGNATURE_SETTINGS' => 'Signature settings', + 'ACP_SMILIES' => 'Smilies', + 'ACP_STYLE_MANAGEMENT' => 'Style management', + 'ACP_STYLES' => 'Styles', + 'ACP_STYLES_CACHE' => 'Purge Cache', + 'ACP_STYLES_INSTALL' => 'Install Styles', + + 'ACP_SUBMIT_CHANGES' => 'Submit changes', + + 'ACP_TEMPLATES' => 'Templates', + 'ACP_THEMES' => 'Themes', + + 'ACP_UPDATE' => 'Updating', + 'ACP_USERS_FORUM_PERMISSIONS' => 'User forum permissions', + 'ACP_USERS_LOGS' => 'User logs', + 'ACP_USERS_PERMISSIONS' => 'User permissions', + 'ACP_USER_ATTACH' => 'Attachments', + 'ACP_USER_AVATAR' => 'Avatar', + 'ACP_USER_FEEDBACK' => 'Feedback', + 'ACP_USER_GROUPS' => 'Groups', + 'ACP_USER_MANAGEMENT' => 'User management', + 'ACP_USER_OVERVIEW' => 'Overview', + 'ACP_USER_PERM' => 'Permissions', + 'ACP_USER_PREFS' => 'Preferences', + 'ACP_USER_PROFILE' => 'Profile', + 'ACP_USER_RANK' => 'Rank', + 'ACP_USER_ROLES' => 'User roles', + 'ACP_USER_SECURITY' => 'User security', + 'ACP_USER_SIG' => 'Signature', + 'ACP_USER_WARNINGS' => 'Warnings', + + 'ACP_VC_SETTINGS' => 'Spambot countermeasures', + 'ACP_VC_CAPTCHA_DISPLAY' => 'CAPTCHA image preview', + 'ACP_VERSION_CHECK' => 'Check for updates', + 'ACP_VIEW_ADMIN_PERMISSIONS' => 'View administrative permissions', + 'ACP_VIEW_FORUM_MOD_PERMISSIONS' => 'View forum moderation permissions', + 'ACP_VIEW_FORUM_PERMISSIONS' => 'View forum-based permissions', + 'ACP_VIEW_GLOBAL_MOD_PERMISSIONS' => 'View global moderation permissions', + 'ACP_VIEW_USER_PERMISSIONS' => 'View user-based permissions', + + 'ACP_WORDS' => 'Word censoring', + + 'ACTION' => 'Action', + 'ACTIONS' => 'Actions', + 'ACTIVATE' => 'Activate', + 'ADD' => 'Add', + 'ADMIN' => 'Administration', + 'ADMIN_INDEX' => 'Admin index', + 'ADMIN_PANEL' => 'Administration Control Panel', + + 'ADM_LOGOUT' => 'ACP Logout', + 'ADM_LOGGED_OUT' => 'Successfully logged out from Administration Control Panel', + + 'BACK' => 'Back', + + 'CANNOT_CHANGE_FILE_GROUP' => 'Unable to change file group', + 'CANNOT_CHANGE_FILE_PERMISSIONS' => 'Unable to change file permissions', + 'CANNOT_COPY_FILES' => 'Unable to copy files', + 'CANNOT_CREATE_SYMLINK' => 'Unable to create a symlink', + 'CANNOT_DELETE_FILES' => 'Unable to delete files from the system', + 'CANNOT_DUMP_FILE' => 'Unable to dump file', + 'CANNOT_MIRROR_DIRECTORY' => 'Unable to mirror directory', + 'CANNOT_RENAME_FILE' => 'Unable to rename a file from the system', + 'CANNOT_TOUCH_FILES' => 'Unable to determine if the file exists', + + 'CONTAINER_EXCEPTION' => 'phpBB encountered an error building the container due to an installed extension. For this reason, all extensions have been temporarily disabled. Please try purging your forum cache. All extensions will automatically be re-enabled once the container error is resolved. If this error continues, please visit phpBB.com for support.', + 'EXCEPTION' => 'Exception', + + 'COLOUR_SWATCH' => 'Web-safe colour swatch', + 'CONFIG_UPDATED' => 'Configuration updated successfully.', + 'CRON_LOCK_ERROR' => 'Could not obtain cron lock.', + 'CRON_NO_SUCH_TASK' => 'Could not find cron task “%s”.', + 'CRON_NO_TASK' => 'No cron tasks need to be run right now.', + 'CRON_NO_TASKS' => 'No cron tasks could be found.', + 'CURRENT_VERSION' => 'Current version', + + 'DEACTIVATE' => 'Deactivate', + 'DIRECTORY_DOES_NOT_EXIST' => 'The entered path “%s” does not exist.', + 'DIRECTORY_NOT_DIR' => 'The entered path “%s” is not a directory.', + 'DIRECTORY_NOT_WRITABLE' => 'The entered path “%s” is not writable.', + 'DISABLE' => 'Disable', + 'DOWNLOAD' => 'Download', + 'DOWNLOAD_AS' => 'Download as', + 'DOWNLOAD_STORE' => 'Download or store file', + 'DOWNLOAD_STORE_EXPLAIN' => 'You may directly download the file or save it in your store/ folder.', + 'DOWNLOADS' => 'Downloads', + + 'EDIT' => 'Edit', + 'ENABLE' => 'Enable', + 'EXPORT_DOWNLOAD' => 'Download', + 'EXPORT_STORE' => 'Store', + + 'GENERAL_OPTIONS' => 'General options', + 'GENERAL_SETTINGS' => 'General settings', + 'GLOBAL_MASK' => 'Global permission mask', + + 'INSTALL' => 'Install', + 'IP' => 'User IP', + 'IP_HOSTNAME' => 'IP addresses or hostnames', + + 'LATEST_VERSION' => 'Latest version', + 'LOAD_NOTIFICATIONS' => 'Display Notifications', + 'LOAD_NOTIFICATIONS_EXPLAIN' => 'Display the notifications list on every page (typically in the header).', + 'LOGGED_IN_AS' => 'You are logged in as:', + 'LOGIN_ADMIN' => 'To administer the board you must be an authenticated user.', + 'LOGIN_ADMIN_CONFIRM' => 'To administer the board you must re-authenticate yourself.', + 'LOGIN_ADMIN_SUCCESS' => 'You have successfully authenticated and will now be redirected to the Administration Control Panel.', + 'LOOK_UP_FORUM' => 'Select a forum', + 'LOOK_UP_FORUMS_EXPLAIN'=> 'You are able to select more than one forum.', + + 'MANAGE' => 'Manage', + 'MENU_TOGGLE' => 'Hide or display the side menu', + 'MORE' => 'More', // Not used at the moment + 'MORE_INFORMATION' => 'More information »', + 'MOVE_DOWN' => 'Move down', + 'MOVE_UP' => 'Move up', + + 'NOTIFY' => 'Notification', + 'NO_ADMIN' => 'You are not authorised to administer this board.', + 'NO_EMAILS_DEFINED' => 'No valid email addresses found.', + 'NO_FILES_TO_DELETE' => 'Attachments you selected for deletion do not exist.', + 'NO_PASSWORD_SUPPLIED' => 'You need to enter your password to access the Administration Control Panel.', + + 'OFF' => 'Off', + 'ON' => 'On', + + 'PARSE_BBCODE' => 'Parse BBCode', + 'PARSE_SMILIES' => 'Parse smilies', + 'PARSE_URLS' => 'Parse links', + 'PERMISSIONS_TRANSFERRED' => 'Permissions transferred', + 'PERMISSIONS_TRANSFERRED_EXPLAIN' => 'You currently have the permissions from %1$s. You are able to browse the board with this user’s permissions, but not access the administration control panel since admin permissions were not transferred. You can revert to your permission set at any time.', + 'PROCEED_TO_ACP' => '%sProceed to the ACP%s', + + 'RELEASE_ANNOUNCEMENT' => 'Announcement', + 'REMIND' => 'Remind', + 'REPARSE_LOCK_ERROR' => 'Reparsing is already in progress by another process.', + 'RESYNC' => 'Resynchronise', + + 'RUNNING_TASK' => 'Running task: %s.', + 'SELECT_ANONYMOUS' => 'Select anonymous user', + 'SELECT_OPTION' => 'Select option', + + 'SETTING_TOO_LOW' => 'The provided value for the setting “%1$s” is too low. The minimum acceptable value is %2$d.', + 'SETTING_TOO_BIG' => 'The provided value for the setting “%1$s” is too high. The maximum acceptable value is %2$d.', + 'SETTING_TOO_LONG' => 'The provided value for the setting “%1$s” is too long. The maximum acceptable length is %2$d.', + 'SETTING_TOO_SHORT' => 'The provided value for the setting “%1$s” is too short. The minimum acceptable length is %2$d.', + + 'SHOW_ALL_OPERATIONS' => 'Show all operations', + + 'TASKS_NOT_READY' => 'Not ready tasks:', + 'TASKS_READY' => 'Ready tasks:', + 'TOTAL_SIZE' => 'Total size', + + 'UCP' => 'User Control Panel', + 'URL_INVALID' => 'The provided URL for the setting “%1$s” is invalid.', + 'USERNAMES_EXPLAIN' => 'Place each username on a separate line.', + 'USER_CONTROL_PANEL' => 'User Control Panel', + + 'UPDATE_NEEDED' => 'The board is not up to date.', + 'UPDATE_NOT_NEEDED' => 'The board is up to date.', + 'UPDATES_AVAILABLE' => 'Updates available:', + + 'WARNING' => 'Warning', +)); + +// PHP info +$lang = array_merge($lang, array( + 'ACP_PHP_INFO_EXPLAIN' => 'This page lists information on the version of PHP installed on this server. It includes details of loaded modules, available variables and default settings. This information may be useful when diagnosing problems. Please be aware that some hosting companies will limit what information is displayed here for security reasons. You are advised to not give out any details on this page except when asked by official team members on the support forums.', + + 'NO_PHPINFO_AVAILABLE' => 'Information about your PHP configuration is unable to be determined. Phpinfo() has been disabled for security reasons.', +)); + +// Logs +$lang = array_merge($lang, array( + 'ACP_ADMIN_LOGS_EXPLAIN' => 'This lists all the actions carried out by board administrators. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.', + 'ACP_CRITICAL_LOGS_EXPLAIN' => 'This lists the actions carried out by the board itself. This log provides you with information you are able to use for solving specific problems, for example non-delivery of emails. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.', + 'ACP_MOD_LOGS_EXPLAIN' => 'This lists all actions done on forums, topics and posts as well as actions carried out on users by moderators, including banning. You can sort by username, date, IP or action. If you have appropriate permissions you can also clear individual operations or the log as a whole.', + 'ACP_USERS_LOGS_EXPLAIN' => 'This lists all actions carried out by users or on users (reports, warnings and user notes).', + 'ALL_ENTRIES' => 'All entries', + + 'DISPLAY_LOG' => 'Display entries from previous', + + 'NO_ENTRIES' => 'No log entries for this period.', + + 'SORT_IP' => 'IP address', + 'SORT_DATE' => 'Date', + 'SORT_ACTION' => 'Log action', +)); + +// Index page +$lang = array_merge($lang, array( + 'ADMIN_INTRO' => 'Thank you for choosing phpBB as your board solution. This screen will give you a quick overview of all the various statistics of your board. The links on the left hand side of this screen allow you to control every aspect of your board experience. Each page will have instructions on how to use the tools.', + 'ADMIN_LOG' => 'Logged administrator actions', + 'ADMIN_LOG_INDEX_EXPLAIN' => 'This gives an overview of the last five actions carried out by board administrators. A full copy of the log can be viewed from the appropriate menu item or following the link below.', + 'AVATAR_DIR_SIZE' => 'Avatar directory size', + + 'BOARD_STARTED' => 'Board started', + 'BOARD_VERSION' => 'Board version', + + 'DATABASE_SERVER_INFO' => 'Database server', + 'DATABASE_SIZE' => 'Database size', + + // Enviroment configuration checks, mbstring related + 'ERROR_MBSTRING_FUNC_OVERLOAD' => 'Function overloading is improperly configured', + 'ERROR_MBSTRING_FUNC_OVERLOAD_EXPLAIN' => 'mbstring.func_overload must be set to either 0 or 4. You can check the current value on the PHP information page.', + 'ERROR_MBSTRING_ENCODING_TRANSLATION' => 'Transparent character encoding is improperly configured', + 'ERROR_MBSTRING_ENCODING_TRANSLATION_EXPLAIN' => 'mbstring.encoding_translation must be set to 0. You can check the current value on the PHP information page.', + 'ERROR_MBSTRING_HTTP_INPUT' => 'HTTP input character conversion is improperly configured', + 'ERROR_MBSTRING_HTTP_INPUT_EXPLAIN' => 'mbstring.http_input must be set to pass. You can check the current value on the PHP information page.', + 'ERROR_MBSTRING_HTTP_OUTPUT' => 'HTTP output character conversion is improperly configured', + 'ERROR_MBSTRING_HTTP_OUTPUT_EXPLAIN' => 'mbstring.http_output must be set to pass. You can check the current value on the PHP information page.', + + 'FILES_PER_DAY' => 'Attachments per day', + 'FORUM_STATS' => 'Board statistics', + + 'GZIP_COMPRESSION' => 'GZip compression', + + 'NO_SEARCH_INDEX' => 'The selected search backend does not have a search index.
Please create the index for “%1$s” in the %2$ssearch index%3$s section.', + 'NOT_AVAILABLE' => 'Not available', + 'NUMBER_FILES' => 'Number of attachments', + 'NUMBER_POSTS' => 'Number of posts', + 'NUMBER_TOPICS' => 'Number of topics', + 'NUMBER_USERS' => 'Number of users', + 'NUMBER_ORPHAN' => 'Orphan attachments', + + 'PHP_VERSION' => 'PHP version', + 'PHP_VERSION_OLD' => 'The version of PHP on this server (%1$s) will no longer be supported by future versions of phpBB. The minimum required version will be PHP %2$s. %3$sDetails%4$s', + + 'POSTS_PER_DAY' => 'Posts per day', + + 'PURGE_CACHE' => 'Purge the cache', + 'PURGE_CACHE_CONFIRM' => 'Are you sure you wish to purge the cache?', + 'PURGE_CACHE_EXPLAIN' => 'Purge all cache related items, this includes any cached template files or queries.', + 'PURGE_CACHE_SUCCESS' => 'Cache successfully purged.', + + 'PURGE_SESSIONS' => 'Purge all sessions', + 'PURGE_SESSIONS_CONFIRM' => 'Are you sure you wish to purge all sessions? This will log out all users.', + 'PURGE_SESSIONS_EXPLAIN' => 'Purge all sessions. This will log out all users by truncating the session table.', + 'PURGE_SESSIONS_SUCCESS' => 'Sessions successfully purged.', + + 'RESET_DATE' => 'Reset board’s start date', + 'RESET_DATE_CONFIRM' => 'Are you sure you wish to reset the board’s start date?', + 'RESET_DATE_SUCCESS' => 'Board’s start date reset', + 'RESET_ONLINE' => 'Reset most users ever online', + 'RESET_ONLINE_CONFIRM' => 'Are you sure you wish to reset the most users ever online counter?', + 'RESET_ONLINE_SUCCESS' => 'Most users ever online reset', + 'RESYNC_POSTCOUNTS' => 'Resynchronise post counts', + 'RESYNC_POSTCOUNTS_EXPLAIN' => 'Only existing posts will be taken into consideration. Pruned posts will not be counted.', + 'RESYNC_POSTCOUNTS_CONFIRM' => 'Are you sure you wish to resynchronise post counts?', + 'RESYNC_POSTCOUNTS_SUCCESS' => 'Resynchronised post counts', + 'RESYNC_POST_MARKING' => 'Resynchronise dotted topics', + 'RESYNC_POST_MARKING_CONFIRM' => 'Are you sure you wish to resynchronise dotted topics?', + 'RESYNC_POST_MARKING_EXPLAIN' => 'First unmarks all topics and then correctly marks topics that have seen any activity during the past six months.', + 'RESYNC_POST_MARKING_SUCCESS' => 'Resynchronised dotted topics', + 'RESYNC_STATS' => 'Resynchronise statistics', + 'RESYNC_STATS_CONFIRM' => 'Are you sure you wish to resynchronise statistics?', + 'RESYNC_STATS_EXPLAIN' => 'Recalculates the total number of posts, topics, users and files.', + 'RESYNC_STATS_SUCCESS' => 'Resynchronised statistics', + 'RUN' => 'Run now', + + 'STATISTIC' => 'Statistic', + 'STATISTIC_RESYNC_OPTIONS' => 'Resynchronise or reset statistics', + + 'TIMEZONE_INVALID' => 'The timezone you selected is invalid.', + 'TIMEZONE_SELECTED' => '(currently selected)', + 'TOPICS_PER_DAY' => 'Topics per day', + + 'UPLOAD_DIR_SIZE' => 'Size of posted attachments', + 'USERS_PER_DAY' => 'Users per day', + + 'VALUE' => 'Value', + 'VERSIONCHECK_FAIL' => 'Failed to obtain latest version information.', + 'VERSIONCHECK_FORCE_UPDATE' => 'Re-Check version', + 'VERSION_CHECK' => 'Version check', + 'VERSION_CHECK_EXPLAIN' => 'Checks to see if your phpBB installation is up to date.', + 'VERSIONCHECK_INVALID_ENTRY' => 'Latest version information contains an unsupported entry.', + 'VERSIONCHECK_INVALID_URL' => 'Latest version information contains invalid URL.', + 'VERSIONCHECK_INVALID_VERSION' => 'Latest version information contains an invalid version.', + 'VERSION_NOT_UP_TO_DATE_ACP' => 'Your phpBB installation is not up to date.
Below is a link to the release announcement, which contains more information as well as instructions on updating.', + 'VERSION_NOT_UP_TO_DATE_TITLE' => 'Your phpBB installation is not up to date.', + 'VERSION_UP_TO_DATE_ACP' => 'Your phpBB installation is up to date. There are no updates available at this time.', + 'VIEW_ADMIN_LOG' => 'View administrator log', + 'VIEW_INACTIVE_USERS' => 'View inactive users', + + 'WELCOME_PHPBB' => 'Welcome to phpBB', + 'WRITABLE_CONFIG' => 'Your config file (config.php) is currently world-writable. We strongly encourage you to change the permissions to 640 or at least to 644 (for example: chmod 640 config.php).', +)); + +// Inactive Users +$lang = array_merge($lang, array( + 'INACTIVE_DATE' => 'Inactive date', + 'INACTIVE_REASON' => 'Reason', + 'INACTIVE_REASON_MANUAL' => 'Account deactivated by administrator', + 'INACTIVE_REASON_PROFILE' => 'Profile details changed', + 'INACTIVE_REASON_REGISTER' => 'Newly registered account', + 'INACTIVE_REASON_REMIND' => 'Forced user account reactivation', + 'INACTIVE_REASON_UNKNOWN' => 'Unknown', + 'INACTIVE_USERS' => 'Inactive users', + 'INACTIVE_USERS_EXPLAIN' => 'This is a list of users who have registered but whose accounts are inactive. You can activate, delete or remind (by sending an email) these users if you wish.', + 'INACTIVE_USERS_EXPLAIN_INDEX' => 'This is a list of the last 10 registered users who have inactive accounts. Accounts are inactive either because account activation was enabled in user registration settings and these users’ accounts have not yet been activated, or because these accounts have been deactivated. A full list is available by following the link below from where you can activate, delete or remind (by sending an email) these users if you wish.', + + 'NO_INACTIVE_USERS' => 'No inactive users', + + 'SORT_INACTIVE' => 'Inactive date', + 'SORT_LAST_VISIT' => 'Last visit', + 'SORT_REASON' => 'Reason', + 'SORT_REG_DATE' => 'Registration date', + 'SORT_LAST_REMINDER'=> 'Last reminded', + 'SORT_REMINDER' => 'Reminder sent', + + 'USER_IS_INACTIVE' => 'User is inactive', +)); + +// Help support phpBB page +$lang = array_merge($lang, array( + 'EXPLAIN_SEND_STATISTICS' => 'Please send information about your server and board configurations to phpBB for statistical analysis. All information that could identify you or your website has been removed - the data is entirely anonymous. We base decisions about future phpBB versions on this information. The statistics are made available publically. We also share this data with the PHP project, the programming language phpBB is made with.', + 'EXPLAIN_SHOW_STATISTICS' => 'Using the button below you can preview all variables that will be transmitted.', + 'DONT_SEND_STATISTICS' => 'Return to the ACP if you do not wish to send statistical information to phpBB.', + 'GO_ACP_MAIN' => 'Go to the ACP start page', + 'HIDE_STATISTICS' => 'Hide details', + 'SEND_STATISTICS' => 'Send statistics', + 'SEND_STATISTICS_LONG' => 'Send statistical information', + 'SHOW_STATISTICS' => 'Show details', + 'THANKS_SEND_STATISTICS' => 'Thank you for submitting your information.', + 'FAIL_SEND_STATISTICS' => 'phpBB was unable to send statistics', +)); + +// Log Entries +$lang = array_merge($lang, array( + 'LOG_ACL_ADD_USER_GLOBAL_U_' => 'Added or edited users’ user permissions
» %s', + 'LOG_ACL_ADD_GROUP_GLOBAL_U_' => 'Added or edited groups’ user permissions
» %s', + 'LOG_ACL_ADD_USER_GLOBAL_M_' => 'Added or edited users’ global moderator permissions
» %s', + 'LOG_ACL_ADD_GROUP_GLOBAL_M_' => 'Added or edited groups’ global moderator permissions
» %s', + 'LOG_ACL_ADD_USER_GLOBAL_A_' => 'Added or edited users’ administrator permissions
» %s', + 'LOG_ACL_ADD_GROUP_GLOBAL_A_' => 'Added or edited groups’ administrator permissions
» %s', + + 'LOG_ACL_ADD_ADMIN_GLOBAL_A_' => 'Added or edited Administrators
» %s', + 'LOG_ACL_ADD_MOD_GLOBAL_M_' => 'Added or edited Global Moderators
» %s', + + 'LOG_ACL_ADD_USER_LOCAL_F_' => 'Added or edited users’ forum access from %1$s
» %2$s', + 'LOG_ACL_ADD_USER_LOCAL_M_' => 'Added or edited users’ forum moderator access from %1$s
» %2$s', + 'LOG_ACL_ADD_GROUP_LOCAL_F_' => 'Added or edited groups’ forum access from %1$s
» %2$s', + 'LOG_ACL_ADD_GROUP_LOCAL_M_' => 'Added or edited groups’ forum moderator access from %1$s
» %2$s', + + 'LOG_ACL_ADD_MOD_LOCAL_M_' => 'Added or edited Moderators from %1$s
» %2$s', + 'LOG_ACL_ADD_FORUM_LOCAL_F_' => 'Added or edited forum permissions from %1$s
» %2$s', + + 'LOG_ACL_DEL_ADMIN_GLOBAL_A_' => 'Removed Administrators
» %s', + 'LOG_ACL_DEL_MOD_GLOBAL_M_' => 'Removed Global Moderators
» %s', + 'LOG_ACL_DEL_MOD_LOCAL_M_' => 'Removed Moderators from %1$s
» %2$s', + 'LOG_ACL_DEL_FORUM_LOCAL_F_' => 'Removed User/Group forum permissions from %1$s
» %2$s', + + 'LOG_ACL_TRANSFER_PERMISSIONS' => 'Permissions transferred from
» %s', + 'LOG_ACL_RESTORE_PERMISSIONS' => 'Own permissions restored after using permissions from
» %s', + + 'LOG_ADMIN_AUTH_FAIL' => 'Failed administration login attempt', + 'LOG_ADMIN_AUTH_SUCCESS' => 'Successful administration login', + + 'LOG_ATTACHMENTS_DELETED' => 'Removed user attachments
» %s', + + 'LOG_ATTACH_EXT_ADD' => 'Added or edited attachment extension
» %s', + 'LOG_ATTACH_EXT_DEL' => 'Removed attachment extension
» %s', + 'LOG_ATTACH_EXT_UPDATE' => 'Updated attachment extension
» %s', + 'LOG_ATTACH_EXTGROUP_ADD' => 'Added extension group
» %s', + 'LOG_ATTACH_EXTGROUP_EDIT' => 'Edited extension group
» %s', + 'LOG_ATTACH_EXTGROUP_DEL' => 'Removed extension group
» %s', + 'LOG_ATTACH_FILEUPLOAD' => 'Orphan File uploaded to Post
» ID %1$d - %2$s', + 'LOG_ATTACH_ORPHAN_DEL' => 'Orphan Files deleted
» %s', + + 'LOG_BAN_EXCLUDE_USER' => 'Excluded user from ban for reason “%1$s
» %2$s', + 'LOG_BAN_EXCLUDE_IP' => 'Excluded IP from ban for reason “%1$s
» %2$s', + 'LOG_BAN_EXCLUDE_EMAIL' => 'Excluded email from ban for reason “%1$s
» %2$s', + 'LOG_BAN_USER' => 'Banned user for reason “%1$s
» %2$s', + 'LOG_BAN_IP' => 'Banned IP for reason “%1$s
» %2$s', + 'LOG_BAN_EMAIL' => 'Banned email for reason “%1$s
» %2$s', + 'LOG_UNBAN_USER' => 'Unbanned user
» %s', + 'LOG_UNBAN_IP' => 'Unbanned IP
» %s', + 'LOG_UNBAN_EMAIL' => 'Unbanned email
» %s', + + 'LOG_BBCODE_ADD' => 'Added new BBCode
» %s', + 'LOG_BBCODE_EDIT' => 'Edited BBCode
» %s', + 'LOG_BBCODE_DELETE' => 'Deleted BBCode
» %s', + 'LOG_BBCODE_CONFIGURATION_ERROR' => 'Error while configuring BBCode: %1$s
» %2$s', + + 'LOG_BOT_ADDED' => 'New bot added
» %s', + 'LOG_BOT_DELETE' => 'Deleted bot
» %s', + 'LOG_BOT_UPDATED' => 'Existing bot updated
» %s', + + 'LOG_CLEAR_ADMIN' => 'Cleared admin log', + 'LOG_CLEAR_CRITICAL' => 'Cleared error log', + 'LOG_CLEAR_MOD' => 'Cleared moderator log', + 'LOG_CLEAR_USER' => 'Cleared user log
» %s', + 'LOG_CLEAR_USERS' => 'Cleared user logs', + + 'LOG_CONFIG_ATTACH' => 'Altered attachment settings', + 'LOG_CONFIG_AUTH' => 'Altered authentication settings', + 'LOG_CONFIG_AVATAR' => 'Altered avatar settings', + 'LOG_CONFIG_COOKIE' => 'Altered cookie settings', + 'LOG_CONFIG_EMAIL' => 'Altered email settings', + 'LOG_CONFIG_FEATURES' => 'Altered board features', + 'LOG_CONFIG_LOAD' => 'Altered load settings', + 'LOG_CONFIG_MESSAGE' => 'Altered private message settings', + 'LOG_CONFIG_POST' => 'Altered post settings', + 'LOG_CONFIG_REGISTRATION' => 'Altered user registration settings', + 'LOG_CONFIG_FEED' => 'Altered syndication feeds settings', + 'LOG_CONFIG_SEARCH' => 'Altered search settings', + 'LOG_CONFIG_SECURITY' => 'Altered security settings', + 'LOG_CONFIG_SERVER' => 'Altered server settings', + 'LOG_CONFIG_SETTINGS' => 'Altered board settings', + 'LOG_CONFIG_SIGNATURE' => 'Altered signature settings', + 'LOG_CONFIG_VISUAL' => 'Altered anti-spambot settings', + + 'LOG_APPROVE_TOPIC' => 'Approved topic
» %s', + 'LOG_BUMP_TOPIC' => 'User bumped topic
» %s', + 'LOG_DELETE_POST' => 'Deleted post “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_DELETE_SHADOW_TOPIC' => 'Deleted shadow topic
» %s', + 'LOG_DELETE_TOPIC' => 'Deleted topic “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_FORK' => 'Copied topic
» from %s', + 'LOG_LOCK' => 'Locked topic
» %s', + 'LOG_LOCK_POST' => 'Locked post
» %s', + 'LOG_MERGE' => 'Merged posts into topic
» %s', + 'LOG_MOVE' => 'Moved topic
» from %1$s to %2$s', + 'LOG_MOVED_TOPIC' => 'Moved topic
» %s', + 'LOG_PM_REPORT_CLOSED' => 'Closed PM report
» %s', + 'LOG_PM_REPORT_DELETED' => 'Deleted PM report
» %s', + 'LOG_POST_APPROVED' => 'Approved post
» %s', + 'LOG_POST_DISAPPROVED' => 'Disapproved post “%1$s” written by “%3$s” for the following reason
» %2$s', + 'LOG_POST_EDITED' => 'Edited post “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_POST_RESTORED' => 'Restored post
» %s', + 'LOG_REPORT_CLOSED' => 'Closed report
» %s', + 'LOG_REPORT_DELETED' => 'Deleted report
» %s', + 'LOG_RESTORE_TOPIC' => 'Restored topic “%1$s” written by
» %2$s', + 'LOG_SOFTDELETE_POST' => 'Soft deleted post “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_SOFTDELETE_TOPIC' => 'Soft deleted topic “%1$s” written by “%2$s” for the following reason
» %3$s', + 'LOG_SPLIT_DESTINATION' => 'Moved split posts
» to %s', + 'LOG_SPLIT_SOURCE' => 'Split posts
» from %s', + + 'LOG_TOPIC_APPROVED' => 'Approved topic
» %s', + 'LOG_TOPIC_RESTORED' => 'Restored topic
» %s', + 'LOG_TOPIC_DISAPPROVED' => 'Disapproved topic “%1$s” written by “%3$s” for the following reason
» %2$s', + 'LOG_TOPIC_RESYNC' => 'Resynchronised topic counters
» %s', + 'LOG_TOPIC_TYPE_CHANGED' => 'Changed topic type
» %s', + 'LOG_UNLOCK' => 'Unlocked topic
» %s', + 'LOG_UNLOCK_POST' => 'Unlocked post
» %s', + + 'LOG_DISALLOW_ADD' => 'Added disallowed username
» %s', + 'LOG_DISALLOW_DELETE' => 'Deleted disallowed username', + + 'LOG_DB_BACKUP' => 'Database backup', + 'LOG_DB_DELETE' => 'Deleted database backup', + 'LOG_DB_RESTORE' => 'Restored database backup', + + 'LOG_DOWNLOAD_EXCLUDE_IP' => 'Excluded IP/hostname from download list
» %s', + 'LOG_DOWNLOAD_IP' => 'Added IP/hostname to download list
» %s', + 'LOG_DOWNLOAD_REMOVE_IP' => 'Removed IP/hostname from download list
» %s', + + 'LOG_ERROR_JABBER' => 'Jabber error
» %s', + 'LOG_ERROR_EMAIL' => 'Email error
» %s', + 'LOG_ERROR_CAPTCHA' => 'CAPTCHA error
» %s', + + 'LOG_FORUM_ADD' => 'Created new forum
» %s', + 'LOG_FORUM_COPIED_PERMISSIONS' => 'Copied forum permissions from %1$s
» %2$s', + 'LOG_FORUM_DEL_FORUM' => 'Deleted forum
» %s', + 'LOG_FORUM_DEL_FORUMS' => 'Deleted forum and its subforums
» %s', + 'LOG_FORUM_DEL_MOVE_FORUMS' => 'Deleted forum and moved subforums to %1$s
» %2$s', + 'LOG_FORUM_DEL_MOVE_POSTS' => 'Deleted forum and moved posts to %1$s
» %2$s', + 'LOG_FORUM_DEL_MOVE_POSTS_FORUMS' => 'Deleted forum and its subforums, moved posts to %1$s
» %2$s', + 'LOG_FORUM_DEL_MOVE_POSTS_MOVE_FORUMS' => 'Deleted forum, moved posts to %1$s and subforums to %2$s
» %3$s', + 'LOG_FORUM_DEL_POSTS' => 'Deleted forum and its posts
» %s', + 'LOG_FORUM_DEL_POSTS_FORUMS' => 'Deleted forum, its posts and subforums
» %s', + 'LOG_FORUM_DEL_POSTS_MOVE_FORUMS' => 'Deleted forum and its posts, moved subforums to %1$s
» %2$s', + 'LOG_FORUM_EDIT' => 'Edited forum details
» %s', + 'LOG_FORUM_MOVE_DOWN' => 'Moved forum %1$s below %2$s', + 'LOG_FORUM_MOVE_UP' => 'Moved forum %1$s above %2$s', + 'LOG_FORUM_SYNC' => 'Re-synchronised forum
» %s', + + 'LOG_GENERAL_ERROR' => 'A general error occurred: %1$s
» %2$s', + + 'LOG_GROUP_CREATED' => 'New usergroup created
» %s', + 'LOG_GROUP_DEFAULTS' => 'Group “%1$s” made default for members
» %2$s', + 'LOG_GROUP_DELETE' => 'Usergroup deleted
» %s', + 'LOG_GROUP_DEMOTED' => 'Leaders demoted in usergroup %1$s
» %2$s', + 'LOG_GROUP_PROMOTED' => 'Members promoted to leader in usergroup %1$s
» %2$s', + 'LOG_GROUP_REMOVE' => 'Members removed from usergroup %1$s
» %2$s', + 'LOG_GROUP_UPDATED' => 'Usergroup details updated
» %s', + 'LOG_MODS_ADDED' => 'Added new leaders to usergroup %1$s
» %2$s', + 'LOG_USERS_ADDED' => 'Added new members to usergroup %1$s
» %2$s', + 'LOG_USERS_APPROVED' => 'Users approved in usergroup %1$s
» %2$s', + 'LOG_USERS_PENDING' => 'Users requested to join group “%1$s” and need to be approved
» %2$s', + + 'LOG_IMAGE_GENERATION_ERROR' => 'Error while creating image
» Error in %1$s on line %2$s: %3$s', + + 'LOG_INACTIVE_ACTIVATE' => 'Activated inactive users
» %s', + 'LOG_INACTIVE_DELETE' => 'Deleted inactive users
» %s', + 'LOG_INACTIVE_REMIND' => 'Sent reminder emails to inactive users
» %s', + 'LOG_INSTALL_CONVERTED' => 'Converted from %1$s to phpBB %2$s', + 'LOG_INSTALL_INSTALLED' => 'Installed phpBB %s', + + 'LOG_IP_BROWSER_FORWARDED_CHECK' => 'Session IP/browser/X_FORWARDED_FOR check failed
»User IP “%1$s” checked against session IP “%2$s”, user browser string “%3$s” checked against session browser string “%4$s” and user X_FORWARDED_FOR string “%5$s” checked against session X_FORWARDED_FOR string “%6$s”.', + + 'LOG_JAB_CHANGED' => 'Jabber account changed', + 'LOG_JAB_PASSCHG' => 'Jabber password changed', + 'LOG_JAB_REGISTER' => 'Jabber account registered', + 'LOG_JAB_SETTINGS_CHANGED' => 'Jabber settings changed', + + 'LOG_LANGUAGE_PACK_DELETED' => 'Deleted language pack
» %s', + 'LOG_LANGUAGE_PACK_INSTALLED' => 'Installed language pack
» %s', + 'LOG_LANGUAGE_PACK_UPDATED' => 'Updated language pack details
» %s', + 'LOG_LANGUAGE_FILE_REPLACED' => 'Replaced language file
» %s', + 'LOG_LANGUAGE_FILE_SUBMITTED' => 'Submitted language file and placed in store folder
» %s', + + 'LOG_MASS_EMAIL' => 'Sent mass email
» %s', + + 'LOG_MCP_CHANGE_POSTER' => 'Changed poster in topic “%1$s”
» from %2$s to %3$s', + + 'LOG_MODULE_DISABLE' => 'Module disabled
» %s', + 'LOG_MODULE_ENABLE' => 'Module enabled
» %s', + 'LOG_MODULE_MOVE_DOWN' => 'Module moved down
» %1$s below %2$s', + 'LOG_MODULE_MOVE_UP' => 'Module moved up
» %1$s above %2$s', + 'LOG_MODULE_REMOVED' => 'Module removed
» %s', + 'LOG_MODULE_ADD' => 'Module added
» %s', + 'LOG_MODULE_EDIT' => 'Module edited
» %s', + + 'LOG_A_ROLE_ADD' => 'Admin role added
» %s', + 'LOG_A_ROLE_EDIT' => 'Admin role edited
» %s', + 'LOG_A_ROLE_REMOVED' => 'Admin role removed
» %s', + 'LOG_F_ROLE_ADD' => 'Forum role added
» %s', + 'LOG_F_ROLE_EDIT' => 'Forum role edited
» %s', + 'LOG_F_ROLE_REMOVED' => 'Forum role removed
» %s', + 'LOG_M_ROLE_ADD' => 'Moderator role added
» %s', + 'LOG_M_ROLE_EDIT' => 'Moderator role edited
» %s', + 'LOG_M_ROLE_REMOVED' => 'Moderator role removed
» %s', + 'LOG_U_ROLE_ADD' => 'User role added
» %s', + 'LOG_U_ROLE_EDIT' => 'User role edited
» %s', + 'LOG_U_ROLE_REMOVED' => 'User role removed
» %s', + + 'LOG_PLUPLOAD_TIDY_FAILED' => 'Unable to open %1$s for tidying, check permissions.
Exception: %2$s
Trace: %3$s', + + 'LOG_PROFILE_FIELD_ACTIVATE' => 'Profile field activated
» %s', + 'LOG_PROFILE_FIELD_CREATE' => 'Profile field added
» %s', + 'LOG_PROFILE_FIELD_DEACTIVATE' => 'Profile field deactivated
» %s', + 'LOG_PROFILE_FIELD_EDIT' => 'Profile field changed
» %s', + 'LOG_PROFILE_FIELD_REMOVED' => 'Profile field removed
» %s', + + 'LOG_PRUNE' => 'Pruned forums
» %s', + 'LOG_AUTO_PRUNE' => 'Auto-pruned forums
» %s', + 'LOG_PRUNE_SHADOW' => 'Auto-pruned shadow topics
» %s', + 'LOG_PRUNE_USER_DEAC' => 'Users deactivated
» %s', + 'LOG_PRUNE_USER_DEL_DEL' => 'Users pruned and posts deleted
» %s', + 'LOG_PRUNE_USER_DEL_ANON' => 'Users pruned and posts retained
» %s', + + 'LOG_PURGE_CACHE' => 'Purged cache', + 'LOG_PURGE_SESSIONS' => 'Purged sessions', + + 'LOG_RANK_ADDED' => 'Added new rank
» %s', + 'LOG_RANK_REMOVED' => 'Removed rank
» %s', + 'LOG_RANK_UPDATED' => 'Updated rank
» %s', + + 'LOG_REASON_ADDED' => 'Added report/denial reason
» %s', + 'LOG_REASON_REMOVED' => 'Removed report/denial reason
» %s', + 'LOG_REASON_UPDATED' => 'Updated report/denial reason
» %s', + + 'LOG_REFERER_INVALID' => 'Referrer validation failed
»Referrer was “%1$s”. The request was rejected and the session killed.', + 'LOG_RESET_DATE' => 'Board start date reset', + 'LOG_RESET_ONLINE' => 'Most users online reset', + 'LOG_RESYNC_FILES_STATS' => 'File statistics resynchronised', + 'LOG_RESYNC_POSTCOUNTS' => 'User post counts resynchronised', + 'LOG_RESYNC_POST_MARKING' => 'Dotted topics resynchronised', + 'LOG_RESYNC_STATS' => 'Post, topic and user statistics resynchronised', + + 'LOG_SEARCH_INDEX_CREATED' => 'Created search index for
» %s', + 'LOG_SEARCH_INDEX_REMOVED' => 'Removed search index for
» %s', + 'LOG_SPHINX_ERROR' => 'Sphinx Error
» %s', + 'LOG_STYLE_ADD' => 'Added new style
» %s', + 'LOG_STYLE_DELETE' => 'Deleted style
» %s', + 'LOG_STYLE_EDIT_DETAILS' => 'Edited style
» %s', + 'LOG_STYLE_EXPORT' => 'Exported style
» %s', + + // @deprecated 3.1 + 'LOG_TEMPLATE_ADD_DB' => 'Added new template set to database
» %s', + // @deprecated 3.1 + 'LOG_TEMPLATE_ADD_FS' => 'Add new template set on filesystem
» %s', + 'LOG_TEMPLATE_CACHE_CLEARED' => 'Deleted cached versions of template files in template set %1$s
» %2$s', + 'LOG_TEMPLATE_DELETE' => 'Deleted template set
» %s', + 'LOG_TEMPLATE_EDIT' => 'Edited template set %1$s
» %2$s', + 'LOG_TEMPLATE_EDIT_DETAILS' => 'Edited template details
» %s', + 'LOG_TEMPLATE_EXPORT' => 'Exported template set
» %s', + // @deprecated 3.1 + 'LOG_TEMPLATE_REFRESHED' => 'Refreshed template set
» %s', + + // @deprecated 3.1 + 'LOG_THEME_ADD_DB' => 'Added new theme to database
» %s', + // @deprecated 3.1 + 'LOG_THEME_ADD_FS' => 'Add new theme on filesystem
» %s', + 'LOG_THEME_DELETE' => 'Theme deleted
» %s', + 'LOG_THEME_EDIT_DETAILS' => 'Edited theme details
» %s', + 'LOG_THEME_EDIT' => 'Edited theme %1$s', + 'LOG_THEME_EDIT_FILE' => 'Edited theme %1$s
» Modified file %2$s', + 'LOG_THEME_EXPORT' => 'Exported theme
» %s', + // @deprecated 3.1 + 'LOG_THEME_REFRESHED' => 'Refreshed theme
» %s', + + 'LOG_UPDATE_DATABASE' => 'Updated Database from version %1$s to version %2$s', + 'LOG_UPDATE_PHPBB' => 'Updated phpBB from version %1$s to version %2$s', + + 'LOG_USER_ACTIVE' => 'User activated
» %s', + 'LOG_USER_BAN_USER' => 'Banned User via user management for reason “%1$s
» %2$s', + 'LOG_USER_BAN_IP' => 'Banned IP via user management for reason “%1$s
» %2$s', + 'LOG_USER_BAN_EMAIL' => 'Banned email via user management for reason “%1$s
» %2$s', + 'LOG_USER_DELETED' => 'Deleted user
» %s', + 'LOG_USER_DEL_ATTACH' => 'Removed all attachments made by the user
» %s', + 'LOG_USER_DEL_AVATAR' => 'Removed user avatar
» %s', + 'LOG_USER_DEL_OUTBOX' => 'Emptied user outbox
» %s', + 'LOG_USER_DEL_POSTS' => 'Removed all posts made by the user
» %s', + 'LOG_USER_DEL_SIG' => 'Removed user signature
» %s', + 'LOG_USER_INACTIVE' => 'User deactivated
» %s', + 'LOG_USER_MOVE_POSTS' => 'Moved user posts
» posts by “%1$s” to forum “%2$s”', + 'LOG_USER_NEW_PASSWORD' => 'Changed user password
» %s', + 'LOG_USER_REACTIVATE' => 'Forced user account reactivation
» %s', + 'LOG_USER_REMOVED_NR' => 'Removed newly registered flag from user
» %s', + + 'LOG_USER_UPDATE_EMAIL' => 'User “%1$s” changed email
» from “%2$s” to “%3$s”', + 'LOG_USER_UPDATE_NAME' => 'Changed username
» from “%1$s” to “%2$s”', + 'LOG_USER_USER_UPDATE' => 'Updated user details
» %s', + + 'LOG_USER_ACTIVE_USER' => 'User account activated', + 'LOG_USER_DEL_AVATAR_USER' => 'User avatar removed', + 'LOG_USER_DEL_SIG_USER' => 'User signature removed', + 'LOG_USER_FEEDBACK' => 'Added user feedback
» %s', + 'LOG_USER_GENERAL' => 'Entry added:
» %s', + 'LOG_USER_INACTIVE_USER' => 'User account de-activated', + 'LOG_USER_LOCK' => 'User locked own topic
» %s', + 'LOG_USER_MOVE_POSTS_USER' => 'Moved all posts to forum» %s', + 'LOG_USER_REACTIVATE_USER' => 'Forced user account reactivation', + 'LOG_USER_UNLOCK' => 'User unlocked own topic
» %s', + 'LOG_USER_WARNING' => 'Added user warning
» %s', + 'LOG_USER_WARNING_BODY' => 'The following warning was issued to this user
» %s', + + 'LOG_USER_GROUP_CHANGE' => 'User changed default group
» %s', + 'LOG_USER_GROUP_DEMOTE' => 'User demoted as leaders from usergroup
» %s', + 'LOG_USER_GROUP_JOIN' => 'User joined group
» %s', + 'LOG_USER_GROUP_JOIN_PENDING' => 'User joined group and needs to be approved
» %s', + 'LOG_USER_GROUP_RESIGN' => 'User resigned membership from group
» %s', + + 'LOG_WARNING_DELETED' => 'Deleted user warning
» %s', + 'LOG_WARNINGS_DELETED' => array( + 1 => 'Deleted user warning
» %1$s', + 2 => 'Deleted %2$d user warnings
» %1$s', // Example: 'Deleted 2 user warnings
» username' + ), + 'LOG_WARNINGS_DELETED_ALL' => 'Deleted all user warnings
» %s', + + 'LOG_WORD_ADD' => 'Added word censor
» %s', + 'LOG_WORD_DELETE' => 'Deleted word censor
» %s', + 'LOG_WORD_EDIT' => 'Edited word censor
» %s', + + 'LOG_EXT_ENABLE' => 'Extension enabled
» %s', + 'LOG_EXT_DISABLE' => 'Extension disabled
» %s', + 'LOG_EXT_PURGE' => 'Extension’s data deleted
» %s', + 'LOG_EXT_UPDATE' => 'Extension updated
» %s', +)); diff --git a/install/update/old/language/en/acp/forums.php b/install/update/old/language/en/acp/forums.php new file mode 100644 index 0000000..7a71763 --- /dev/null +++ b/install/update/old/language/en/acp/forums.php @@ -0,0 +1,165 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Forum Admin +$lang = array_merge($lang, array( + 'AUTO_PRUNE_DAYS' => 'Auto-prune post age', + 'AUTO_PRUNE_DAYS_EXPLAIN' => 'Number of days since last post after which topic is removed.', + 'AUTO_PRUNE_FREQ' => 'Auto-prune frequency', + 'AUTO_PRUNE_FREQ_EXPLAIN' => 'Time in days between pruning events.', + 'AUTO_PRUNE_VIEWED' => 'Auto-prune post viewed age', + 'AUTO_PRUNE_VIEWED_EXPLAIN' => 'Number of days since topic was viewed after which topic is removed.', + 'AUTO_PRUNE_SHADOW_FREQ' => 'Auto-prune shadow topics frequency', + 'AUTO_PRUNE_SHADOW_DAYS' => 'Auto-prune shadow topics age', + 'AUTO_PRUNE_SHADOW_DAYS_EXPLAIN' => 'Number of days after which shadow topic is removed.', + 'AUTO_PRUNE_SHADOW_FREQ_EXPLAIN' => 'Time in days between pruning events.', + + 'CONTINUE' => 'Continue', + 'COPY_PERMISSIONS' => 'Copy permissions from', + 'COPY_PERMISSIONS_EXPLAIN' => 'To ease up the permission setup for your new forum, you can copy the permissions of an existing forum.', + 'COPY_PERMISSIONS_ADD_EXPLAIN' => 'Once created, the forum will have the same permissions as the one you select here. If no forum is selected the newly created forum will not be visible until permissions had been set.', + 'COPY_PERMISSIONS_EDIT_EXPLAIN' => 'If you select to copy permissions, the forum will have the same permissions as the one you select here. This will overwrite any permissions you have previously set for this forum with the permissions of the forum you select here. If no forum is selected the current permissions will be kept.', + 'COPY_TO_ACL' => 'Alternatively, you are also able to %sset up new permissions%s for this forum.', + 'CREATE_FORUM' => 'Create new forum', + + 'DECIDE_MOVE_DELETE_CONTENT' => 'Delete content or move to forum', + 'DECIDE_MOVE_DELETE_SUBFORUMS' => 'Delete subforums or move to forum', + 'DEFAULT_STYLE' => 'Default style', + 'DELETE_ALL_POSTS' => 'Delete posts', + 'DELETE_SUBFORUMS' => 'Delete subforums and posts', + 'DISPLAY_ACTIVE_TOPICS' => 'Enable active topics', + 'DISPLAY_ACTIVE_TOPICS_EXPLAIN' => 'If set to yes active topics in selected subforums will be displayed under this category.', + + 'EDIT_FORUM' => 'Edit forum', + 'ENABLE_INDEXING' => 'Enable search indexing', + 'ENABLE_INDEXING_EXPLAIN' => 'If set to yes posts made to this forum will be indexed for searching.', + 'ENABLE_POST_REVIEW' => 'Enable post review', + 'ENABLE_POST_REVIEW_EXPLAIN' => 'If set to yes users are able to review their post if new posts were made to the topic while users wrote theirs. This should be disabled for chat forums.', + 'ENABLE_QUICK_REPLY' => 'Enable quick reply', + 'ENABLE_QUICK_REPLY_EXPLAIN' => 'Enables the quick reply in this forum. This setting is not considered if the quick reply is disabled board wide. The quick reply will only be displayed for users who have permission to post in this forum.', + 'ENABLE_RECENT' => 'Display active topics', + 'ENABLE_RECENT_EXPLAIN' => 'If set to yes topics made to this forum will be shown in the active topics list.', + 'ENABLE_TOPIC_ICONS' => 'Enable topic icons', + + 'FORUM_ADMIN' => 'Forum administration', + 'FORUM_ADMIN_EXPLAIN' => 'In phpBB3 everything is forum based. A category is just a special type of forum. Each forum can have an unlimited number of sub-forums and you can determine whether each may be posted to or not (i.e. whether it acts like an old category). Here you can add, edit, delete, lock, unlock individual forums as well as set certain additional controls. If your posts and topics have got out of sync you can also resynchronise a forum. You need to copy or set appropriate permissions for newly created forums to have them displayed.', + 'FORUM_AUTO_PRUNE' => 'Enable auto-pruning', + 'FORUM_AUTO_PRUNE_EXPLAIN' => 'Prunes the forum of topics, set the frequency/age parameters below.', + 'FORUM_CREATED' => 'Forum created successfully.', + 'FORUM_DATA_NEGATIVE' => 'Pruning parameters cannot be negative.', + 'FORUM_DESC_TOO_LONG' => 'The forum description is too long, it must be less than 4000 characters.', + 'FORUM_DELETE' => 'Delete forum', + 'FORUM_DELETE_EXPLAIN' => 'The form below will allow you to delete a forum. If the forum is postable you are able to decide where you want to put all topics (or forums) it contained.', + 'FORUM_DELETED' => 'Forum successfully deleted.', + 'FORUM_DESC' => 'Description', + 'FORUM_DESC_EXPLAIN' => 'Any HTML markup entered here will be displayed as is. If the selected forum type is a category the description is not used.', + 'FORUM_EDIT_EXPLAIN' => 'The form below will allow you to customise this forum. Please note that moderation and post count controls are set via forum permissions for each user or usergroup.', + 'FORUM_IMAGE' => 'Forum image', + 'FORUM_IMAGE_EXPLAIN' => 'Location, relative to the phpBB root directory, of an additional image to associate with this forum.', + 'FORUM_IMAGE_NO_EXIST' => 'The specified forum image does not exist', + 'FORUM_LINK_EXPLAIN' => 'Full URL (including the protocol, i.e.: http://) to the destination location that clicking this forum will take the user, e.g.: http://www.phpbb.com/.', + 'FORUM_LINK_TRACK' => 'Track link redirects', + 'FORUM_LINK_TRACK_EXPLAIN' => 'Records the number of times a forum link was clicked.', + 'FORUM_NAME' => 'Forum name', + 'FORUM_NAME_EMPTY' => 'You must enter a name for this forum.', + 'FORUM_PARENT' => 'Parent forum', + 'FORUM_PASSWORD' => 'Forum password', + 'FORUM_PASSWORD_CONFIRM' => 'Confirm forum password', + 'FORUM_PASSWORD_CONFIRM_EXPLAIN' => 'Only needs to be set if a forum password is entered.', + 'FORUM_PASSWORD_EXPLAIN' => 'Defines a password for this forum, use the permission system in preference.', + 'FORUM_PASSWORD_UNSET' => 'Remove forum password', + 'FORUM_PASSWORD_UNSET_EXPLAIN' => 'Check here if you want to remove the forum password.', + 'FORUM_PASSWORD_OLD' => 'The forum password is using an old hashing method and should be changed.', + 'FORUM_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', + 'FORUM_PRUNE_SETTINGS' => 'Forum prune settings', + 'FORUM_PRUNE_SHADOW' => 'Enable auto-pruning of shadow topics', + 'FORUM_PRUNE_SHADOW_EXPLAIN' => 'Prunes the forum of shadow topics, set the frequency/age parameters below.', + 'FORUM_RESYNCED' => 'Forum “%s” successfully resynced', + 'FORUM_RULES_EXPLAIN' => 'Forum rules are displayed at any page within the given forum.', + 'FORUM_RULES_LINK' => 'Link to forum rules', + 'FORUM_RULES_LINK_EXPLAIN' => 'You are able to enter the URL of the page/post containing your forum rules here. This setting will override the forum rules text you specified.', + 'FORUM_RULES_PREVIEW' => 'Forum rules preview', + 'FORUM_RULES_TOO_LONG' => 'The forum rules must be less than 4000 characters.', + 'FORUM_SETTINGS' => 'Forum settings', + 'FORUM_STATUS' => 'Forum status', + 'FORUM_STYLE' => 'Forum style', + 'FORUM_TOPICS_PAGE' => 'Topics per page', + 'FORUM_TOPICS_PAGE_EXPLAIN' => 'If non-zero this value will override the default topics per page setting.', + 'FORUM_TYPE' => 'Forum type', + 'FORUM_UPDATED' => 'Forum information updated successfully.', + + 'FORUM_WITH_SUBFORUMS_NOT_TO_LINK' => 'You want to change a postable forum having subforums to a link. Please move all subforums out of this forum before you proceed, because after changing to a link you are no longer able to see the subforums currently connected to this forum.', + + 'GENERAL_FORUM_SETTINGS' => 'General forum settings', + + 'LINK' => 'Link', + 'LIST_INDEX' => 'List subforum in parent-forum’s legend', + 'LIST_INDEX_EXPLAIN' => 'Displays this forum on the index and elsewhere as a link within the legend of its parent-forum if the parent-forum’s “List subforums in legend” option is enabled.', + 'LIST_SUBFORUMS' => 'List subforums in legend', + 'LIST_SUBFORUMS_EXPLAIN' => 'Displays this forum’s subforums on the index and elsewhere as a link within the legend if their “List subforum in parent-forum’s legend” option is enabled.', + 'LOCKED' => 'Locked', + + 'MOVE_POSTS_NO_POSTABLE_FORUM' => 'The forum you selected for moving the posts to is not postable. Please select a postable forum.', + 'MOVE_POSTS_TO' => 'Move posts to', + 'MOVE_SUBFORUMS_TO' => 'Move subforums to', + + 'NO_DESTINATION_FORUM' => 'You have not specified a forum to move content to.', + 'NO_FORUM_ACTION' => 'No action defined for what happens with the forum content.', + 'NO_PARENT' => 'No parent', + 'NO_PERMISSIONS' => 'Do not copy permissions', + 'NO_PERMISSION_FORUM_ADD' => 'You do not have the necessary permissions to add forums.', + 'NO_PERMISSION_FORUM_DELETE' => 'You do not have the necessary permissions to delete forums.', + + 'PARENT_IS_LINK_FORUM' => 'The parent you specified is a forum link. Link forums are not able to hold other forums, please specify a category or forum as the parent forum.', + 'PARENT_NOT_EXIST' => 'Parent does not exist.', + 'PRUNE_ANNOUNCEMENTS' => 'Prune announcements', + 'PRUNE_STICKY' => 'Prune stickies', + 'PRUNE_OLD_POLLS' => 'Prune old polls', + 'PRUNE_OLD_POLLS_EXPLAIN' => 'Removes topics with polls not voted in for post age days.', + + 'REDIRECT_ACL' => 'Now you are able to %sset permissions%s for this forum.', + + 'SYNC_IN_PROGRESS' => 'Synchronizing forum', + 'SYNC_IN_PROGRESS_EXPLAIN' => 'Currently resyncing topic range %1$d/%2$d.', + + 'TYPE_CAT' => 'Category', + 'TYPE_FORUM' => 'Forum', + 'TYPE_LINK' => 'Link', + + 'UNLOCKED' => 'Unlocked', +)); diff --git a/install/update/old/language/en/acp/permissions.php b/install/update/old/language/en/acp/permissions.php new file mode 100644 index 0000000..54d968c --- /dev/null +++ b/install/update/old/language/en/acp/permissions.php @@ -0,0 +1,287 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'ACP_PERMISSIONS_EXPLAIN' => ' +

Permissions are highly granular and grouped into four major sections, which are:

+ +

Global Permissions

+

These are used to control access on a global level and apply to the entire bulletin board. They are further divided into User Permissions, Group Permissions, Administrators and Global Moderators.

+ +

Forum Based Permissions

+

These are used to control access on a per forum basis. They are further divided into Forum Permissions, Forum Moderators, User Forum Permissions and Group Forum Permissions.

+ +

Permission Roles

+

These are used to create different sets of permissions for the different permission types later being able to be assigned on a role-based basis. The default roles should cover the administration of bulletin boards large and small, though within each of the four divisions, you can add/edit/delete roles as you see fit.

+ +

Permission Masks

+

These are used to view the effective permissions assigned to Users, Moderators (Local and Global), Administrators or Forums.

+ +
+ +

For further information on setting up and managing permissions on your phpBB3 board, please see the section on Setting permissions of our Quick Start Guide.

+ ', + + 'ACL_NEVER' => 'Never', + 'ACL_SET' => 'Setting permissions', + 'ACL_SET_EXPLAIN' => 'Permissions are based on a simple YES/NO system. Setting an option to NEVER for a user or usergroup overrides any other value assigned to it. If you do not wish to assign a value for an option for this user or group select NO. If values are assigned for this option elsewhere they will be used in preference, else NEVER is assumed. All objects marked (with the checkbox in front of them) will copy the permission set you defined.', + 'ACL_SETTING' => 'Setting', + + 'ACL_TYPE_A_' => 'Administrative permissions', + 'ACL_TYPE_F_' => 'Forum permissions', + 'ACL_TYPE_M_' => 'Moderative permissions', + 'ACL_TYPE_U_' => 'User permissions', + + 'ACL_TYPE_GLOBAL_A_' => 'Administrative permissions', + 'ACL_TYPE_GLOBAL_U_' => 'User permissions', + 'ACL_TYPE_GLOBAL_M_' => 'Global Moderator permissions', + 'ACL_TYPE_LOCAL_M_' => 'Forum Moderator permissions', + 'ACL_TYPE_LOCAL_F_' => 'Forum permissions', + + 'ACL_NO' => 'No', + 'ACL_VIEW' => 'Viewing permissions', + 'ACL_VIEW_EXPLAIN' => 'Here you can see the effective permissions the user/group is having. A red square indicates that the user/group does not have the permission, a green square indicates that the user/group does have the permission.', + 'ACL_YES' => 'Yes', + + 'ACP_ADMINISTRATORS_EXPLAIN' => 'Here you can assign administrator permissions to users or groups. All users with administrator permissions can view the administration control panel.', + 'ACP_FORUM_MODERATORS_EXPLAIN' => 'Here you can assign users and groups as forum moderators. To assign users access to forums, to define global moderative permissions or administrators please use the appropriate page.', + 'ACP_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can alter which users and groups can access which forums. To assign moderators or define administrators please use the appropriate page.', + 'ACP_FORUM_PERMISSIONS_COPY_EXPLAIN' => 'Here you can copy forum permissions from one forum to one or more other forums.', + 'ACP_GLOBAL_MODERATORS_EXPLAIN' => 'Here you can assign global moderator permissions to users or groups. These moderators are like ordinary moderators except they have access to every forum on your board.', + 'ACP_GROUPS_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can assign forum permissions to groups.', + 'ACP_GROUPS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to groups - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. Individual user permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group permissions.', + 'ACP_ADMIN_ROLES_EXPLAIN' => 'Here you are able to manage the roles for administrative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', + 'ACP_FORUM_ROLES_EXPLAIN' => 'Here you are able to manage the roles for forum permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', + 'ACP_MOD_ROLES_EXPLAIN' => 'Here you are able to manage the roles for moderative permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', + 'ACP_USER_ROLES_EXPLAIN' => 'Here you are able to manage the roles for user permissions. Roles are effective permissions, if you change a role the items having this role assigned will change its permissions too.', + 'ACP_USERS_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can assign forum permissions to users.', + 'ACP_USERS_PERMISSIONS_EXPLAIN' => 'Here you can assign global permissions to users - user permissions, global moderator permissions and administrator permissions. User permissions include capabilities such as the use of avatars, sending private messages, et cetera; global moderator permissions such as approving posts, manage topics, manage bans, et cetera and lastly administrator permissions such as altering permissions, define custom BBCodes, manage forums, et cetera. To alter these settings for large numbers of users the Group permissions system is the preferred method. User permissions should only be changed in rare occasions, the preferred method is putting users in groups and assigning the group permissions.', + 'ACP_VIEW_ADMIN_PERMISSIONS_EXPLAIN' => 'Here you can view the effective administrative permissions assigned to the selected users/groups.', + 'ACP_VIEW_GLOBAL_MOD_PERMISSIONS_EXPLAIN' => 'Here you can view the global moderative permissions assigned to the selected users/groups.', + 'ACP_VIEW_FORUM_PERMISSIONS_EXPLAIN' => 'Here you can view the forum permissions assigned to the selected users/groups and forums.', + 'ACP_VIEW_FORUM_MOD_PERMISSIONS_EXPLAIN' => 'Here you can view the forum moderator permissions assigned to the selected users/groups and forums.', + 'ACP_VIEW_USER_PERMISSIONS_EXPLAIN' => 'Here you can view the effective user permissions assigned to the selected users/groups.', + + 'ADD_GROUPS' => 'Add groups', + 'ADD_PERMISSIONS' => 'Add permissions', + 'ADD_USERS' => 'Add users', + 'ADVANCED_PERMISSIONS' => 'Advanced Permissions', + 'ALL_GROUPS' => 'Select all groups', + 'ALL_NEVER' => 'All NEVER', + 'ALL_NO' => 'All NO', + 'ALL_USERS' => 'Select all users', + 'ALL_YES' => 'All YES', + 'APPLY_ALL_PERMISSIONS' => 'Apply all permissions', + 'APPLY_PERMISSIONS' => 'Apply permissions', + 'APPLY_PERMISSIONS_EXPLAIN' => 'The permissions and role defined for this item will only be applied to this item and all checked items.', + 'AUTH_UPDATED' => 'Permissions have been updated.', + + 'COPY_PERMISSIONS_CONFIRM' => 'Are you sure you wish to carry out this operation? Please be aware that this will overwrite any existing permissions on the selected targets.', + 'COPY_PERMISSIONS_FORUM_FROM_EXPLAIN' => 'The source forum you want to copy permissions from.', + 'COPY_PERMISSIONS_FORUM_TO_EXPLAIN' => 'The destination forums you want the copied permissions applied to.', + 'COPY_PERMISSIONS_FROM' => 'Copy permissions from', + 'COPY_PERMISSIONS_TO' => 'Apply permissions to', + + 'CREATE_ROLE' => 'Create role', + 'CREATE_ROLE_FROM' => 'Use settings from…', + 'CUSTOM' => 'Custom…', + + 'DEFAULT' => 'Default', + 'DELETE_ROLE' => 'Delete role', + 'DELETE_ROLE_CONFIRM' => 'Are you sure you want to remove this role? Items having this role assigned will not lose their permission settings.', + 'DISPLAY_ROLE_ITEMS' => 'View items using this role', + + 'EDIT_PERMISSIONS' => 'Edit permissions', + 'EDIT_ROLE' => 'Edit role', + + 'GROUPS_NOT_ASSIGNED' => 'No group assigned to this role', + + 'LOOK_UP_GROUP' => 'Look up usergroup', + 'LOOK_UP_USER' => 'Look up user', + + 'MANAGE_GROUPS' => 'Manage groups', + 'MANAGE_USERS' => 'Manage users', + + 'NO_AUTH_SETTING_FOUND' => 'Permission settings not defined.', + 'NO_ROLE_ASSIGNED' => 'No role assigned…', + 'NO_ROLE_ASSIGNED_EXPLAIN' => 'Setting to this role does not change permissions on the right. If you want to unset/remove all permissions you should use the “All NO” link.', + 'NO_ROLE_AVAILABLE' => 'No role available', + 'NO_ROLE_NAME_SPECIFIED' => 'Please give the role a name.', + 'NO_ROLE_SELECTED' => 'Role could not be found.', + 'NO_USER_GROUP_SELECTED' => 'You haven’t selected any user or group.', + + 'ONLY_FORUM_DEFINED' => 'You only defined forums in your selection. Please also select at least one user or one group.', + + 'PERMISSION_APPLIED_TO_ALL' => 'Permissions and role will also be applied to all checked objects', + 'PLUS_SUBFORUMS' => '+Subforums', + + 'REMOVE_PERMISSIONS' => 'Remove permissions', + 'REMOVE_ROLE' => 'Remove role', + 'RESULTING_PERMISSION' => 'Resulting permission', + 'ROLE' => 'Role', + 'ROLE_ADD_SUCCESS' => 'Role successfully added.', + 'ROLE_ASSIGNED_TO' => 'Users/Groups assigned to %s', + 'ROLE_DELETED' => 'Role successfully removed.', + 'ROLE_DESCRIPTION' => 'Role description', + + 'ROLE_ADMIN_FORUM' => 'Forum Admin', + 'ROLE_ADMIN_FULL' => 'Full Admin', + 'ROLE_ADMIN_STANDARD' => 'Standard Admin', + 'ROLE_ADMIN_USERGROUP' => 'User and Groups Admin', + 'ROLE_FORUM_BOT' => 'Bot Access', + 'ROLE_FORUM_FULL' => 'Full Access', + 'ROLE_FORUM_LIMITED' => 'Limited Access', + 'ROLE_FORUM_LIMITED_POLLS' => 'Limited Access + Polls', + 'ROLE_FORUM_NOACCESS' => 'No Access', + 'ROLE_FORUM_ONQUEUE' => 'On Moderation Queue', + 'ROLE_FORUM_POLLS' => 'Standard Access + Polls', + 'ROLE_FORUM_READONLY' => 'Read Only Access', + 'ROLE_FORUM_STANDARD' => 'Standard Access', + 'ROLE_FORUM_NEW_MEMBER' => 'Newly Registered User Access', + 'ROLE_MOD_FULL' => 'Full Moderator', + 'ROLE_MOD_QUEUE' => 'Queue Moderator', + 'ROLE_MOD_SIMPLE' => 'Simple Moderator', + 'ROLE_MOD_STANDARD' => 'Standard Moderator', + 'ROLE_USER_FULL' => 'All Features', + 'ROLE_USER_LIMITED' => 'Limited Features', + 'ROLE_USER_NOAVATAR' => 'No Avatar', + 'ROLE_USER_NOPM' => 'No Private Messages', + 'ROLE_USER_STANDARD' => 'Standard Features', + 'ROLE_USER_NEW_MEMBER' => 'Newly Registered User Features', + + 'ROLE_DESCRIPTION_ADMIN_FORUM' => 'Can access the forum management and forum permission settings.', + 'ROLE_DESCRIPTION_ADMIN_FULL' => 'Has access to all administrative functions of this board.
Not recommended.', + 'ROLE_DESCRIPTION_ADMIN_STANDARD' => 'Has access to most administrative features but is not allowed to use server or system related tools.', + 'ROLE_DESCRIPTION_ADMIN_USERGROUP' => 'Can manage groups and users: Able to change permissions, settings, manage bans, and manage ranks.', + 'ROLE_DESCRIPTION_FORUM_BOT' => 'This role is recommended for bots and search spiders.', + 'ROLE_DESCRIPTION_FORUM_FULL' => 'Can use all forum features, including posting of announcements and stickies. Can also ignore the flood limit.
Not recommended for normal users.', + 'ROLE_DESCRIPTION_FORUM_LIMITED' => 'Can use some forum features, but cannot attach files or use post icons.', + 'ROLE_DESCRIPTION_FORUM_LIMITED_POLLS' => 'As per Limited Access but can also create polls.', + 'ROLE_DESCRIPTION_FORUM_NOACCESS' => 'Can neither see nor access the forum.', + 'ROLE_DESCRIPTION_FORUM_ONQUEUE' => 'Can use most forum features including attachments, but posts and topics need to be approved by a moderator.', + 'ROLE_DESCRIPTION_FORUM_POLLS' => 'Like Standard Access but can also create polls.', + 'ROLE_DESCRIPTION_FORUM_READONLY' => 'Can read the forum, but cannot create new topics or reply to posts.', + 'ROLE_DESCRIPTION_FORUM_STANDARD' => 'Can use most forum features including attachments and deleting own topics, but cannot lock own topics, and cannot create polls.', + 'ROLE_DESCRIPTION_FORUM_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains NEVER permissions to lock features for new users.', + 'ROLE_DESCRIPTION_MOD_FULL' => 'Can use all moderating features, including banning.', + 'ROLE_DESCRIPTION_MOD_QUEUE' => 'Can use the Moderation Queue to validate and edit posts, but nothing else.', + 'ROLE_DESCRIPTION_MOD_SIMPLE' => 'Can only use basic topic actions. Cannot send warnings or use moderation queue.', + 'ROLE_DESCRIPTION_MOD_STANDARD' => 'Can use most moderating tools, but cannot ban users or change the post author.', + 'ROLE_DESCRIPTION_USER_FULL' => 'Can use all available forum features for users, including changing the user name or ignoring the flood limit.
Not recommended.', + 'ROLE_DESCRIPTION_USER_LIMITED' => 'Can access some of the user features. Attachments, emails, or instant messages are not allowed.', + 'ROLE_DESCRIPTION_USER_NOAVATAR' => 'Has a limited feature set and is not allowed to use the Avatar feature.', + 'ROLE_DESCRIPTION_USER_NOPM' => 'Has a limited feature set, and is not allowed to use Private Messages.', + 'ROLE_DESCRIPTION_USER_STANDARD' => 'Can access most but not all user features. Cannot change user name or ignore the flood limit, for instance.', + 'ROLE_DESCRIPTION_USER_NEW_MEMBER' => 'A role for members of the special newly registered users group; contains NEVER permissions to lock features for new users.', + + 'ROLE_DESCRIPTION_EXPLAIN' => 'You are able to enter a short explanation of what the role is doing or for what it is meant for. The text you enter here will be displayed within the permissions screens too.', + 'ROLE_DESCRIPTION_LONG' => 'The role description is too long, please limit it to 4000 characters.', + 'ROLE_DETAILS' => 'Role details', + 'ROLE_EDIT_SUCCESS' => 'Role successfully edited.', + 'ROLE_NAME' => 'Role name', + 'ROLE_NAME_ALREADY_EXIST' => 'A role named %s already exist for the specified permission type.', + 'ROLE_NOT_ASSIGNED' => 'Role has not been assigned yet.', + + 'SELECTED_FORUM_NOT_EXIST' => 'The selected forum(s) do not exist.', + 'SELECTED_GROUP_NOT_EXIST' => 'The selected group(s) do not exist.', + 'SELECTED_USER_NOT_EXIST' => 'The selected user(s) do not exist.', + 'SELECT_FORUM_SUBFORUM_EXPLAIN' => 'The forum you select here will include all subforums into the selection.', + 'SELECT_ROLE' => 'Select role…', + 'SELECT_TYPE' => 'Select type', + 'SET_PERMISSIONS' => 'Set permissions', + 'SET_ROLE_PERMISSIONS' => 'Set role permissions', + 'SET_USERS_PERMISSIONS' => 'Set user permissions', + 'SET_USERS_FORUM_PERMISSIONS' => 'Set user forum permissions', + + 'TRACE_DEFAULT' => 'By default every permission is NO (unset). So the permission can be overwritten by other settings.', + 'TRACE_FOR' => 'Trace for', + 'TRACE_GLOBAL_SETTING' => '%s (global)', + 'TRACE_GROUP_NEVER_TOTAL_NEVER' => 'This group’s permission is set to NEVER like the total result so the old result is kept.', + 'TRACE_GROUP_NEVER_TOTAL_NEVER_LOCAL' => 'This group’s permission for this forum is set to NEVER like the total result so the old result is kept.', + 'TRACE_GROUP_NEVER_TOTAL_NO' => 'This group’s permission is set to NEVER which becomes the new total value because it wasn’t set yet (set to NO).', + 'TRACE_GROUP_NEVER_TOTAL_NO_LOCAL' => 'This group’s permission for this forum is set to NEVER which becomes the new total value because it wasn’t set yet (set to NO).', + 'TRACE_GROUP_NEVER_TOTAL_YES' => 'This group’s permission is set to NEVER which overwrites the total YES to a NEVER for this user.', + 'TRACE_GROUP_NEVER_TOTAL_YES_LOCAL' => 'This group’s permission for this forum is set to NEVER which overwrites the total YES to a NEVER for this user.', + 'TRACE_GROUP_NO' => 'The permission is NO for this group so the old total value is kept.', + 'TRACE_GROUP_NO_LOCAL' => 'The permission is NO for this group within this forum so the old total value is kept.', + 'TRACE_GROUP_YES_TOTAL_NEVER' => 'This group’s permission is set to YES but the total NEVER cannot be overwritten.', + 'TRACE_GROUP_YES_TOTAL_NEVER_LOCAL' => 'This group’s permission for this forum is set to YES but the total NEVER cannot be overwritten.', + 'TRACE_GROUP_YES_TOTAL_NO' => 'This group’s permission is set to YES which becomes the new total value because it wasn’t set yet (set to NO).', + 'TRACE_GROUP_YES_TOTAL_NO_LOCAL' => 'This group’s permission for this forum is set to YES which becomes the new total value because it wasn’t set yet (set to NO).', + 'TRACE_GROUP_YES_TOTAL_YES' => 'This group’s permission is set to YES and the total permission is already set to YES, so the total result is kept.', + 'TRACE_GROUP_YES_TOTAL_YES_LOCAL' => 'This group’s permission for this forum is set to YES and the total permission is already set to YES, so the total result is kept.', + 'TRACE_PERMISSION' => 'Trace permission - %s', + 'TRACE_RESULT' => 'Trace result', + 'TRACE_SETTING' => 'Trace setting', + + 'TRACE_USER_GLOBAL_YES_TOTAL_YES' => 'The forum independent user permission evaluates to YES but the total permission is already set to YES, so the total result is kept. %sTrace global permission%s', + 'TRACE_USER_GLOBAL_YES_TOTAL_NEVER' => 'The forum independent user permission evaluates to YES which overwrites the current local result NEVER. %sTrace global permission%s', + 'TRACE_USER_GLOBAL_NEVER_TOTAL_KEPT' => 'The forum independent user permission evaluates to NEVER which doesn’t influence the local permission. %sTrace global permission%s', + + 'TRACE_USER_FOUNDER' => 'The user is a founder, therefore admin permissions are always set to YES.', + 'TRACE_USER_KEPT' => 'The user’s permission is NO so the old total value is kept.', + 'TRACE_USER_KEPT_LOCAL' => 'The user’s permission for this forum is NO so the old total value is kept.', + 'TRACE_USER_NEVER_TOTAL_NEVER' => 'The user’s permission is set to NEVER and the total value is set to NEVER, so nothing is changed.', + 'TRACE_USER_NEVER_TOTAL_NEVER_LOCAL' => 'The user’s permission for this forum is set to NEVER and the total value is set to NEVER, so nothing is changed.', + 'TRACE_USER_NEVER_TOTAL_NO' => 'The user’s permission is set to NEVER which becomes the total value because it was set to NO.', + 'TRACE_USER_NEVER_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is set to NEVER which becomes the total value because it was set to NO.', + 'TRACE_USER_NEVER_TOTAL_YES' => 'The user’s permission is set to NEVER and overwrites the previous YES.', + 'TRACE_USER_NEVER_TOTAL_YES_LOCAL' => 'The user’s permission for this forum is set to NEVER and overwrites the previous YES.', + 'TRACE_USER_NO_TOTAL_NO' => 'The user’s permission is NO and the total value was set to NO so it defaults to NEVER.', + 'TRACE_USER_NO_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is NO and the total value was set to NO so it defaults to NEVER.', + 'TRACE_USER_YES_TOTAL_NEVER' => 'The user’s permission is set to YES but the total NEVER cannot be overwritten.', + 'TRACE_USER_YES_TOTAL_NEVER_LOCAL' => 'The user’s permission for this forum is set to YES but the total NEVER cannot be overwritten.', + 'TRACE_USER_YES_TOTAL_NO' => 'The user’s permission is set to YES which becomes the total value because it was set to NO.', + 'TRACE_USER_YES_TOTAL_NO_LOCAL' => 'The user’s permission for this forum is set to YES which becomes the total value because it was set to NO.', + 'TRACE_USER_YES_TOTAL_YES' => 'The user’s permission is set to YES and the total value is set to YES, so nothing is changed.', + 'TRACE_USER_YES_TOTAL_YES_LOCAL' => 'The user’s permission for this forum is set to YES and the total value is set to YES, so nothing is changed.', + 'TRACE_WHO' => 'Who', + 'TRACE_TOTAL' => 'Total', + + 'USERS_NOT_ASSIGNED' => 'No users are assigned to this role', + 'USER_IS_MEMBER_OF_DEFAULT' => 'is a member of the following pre-defined groups', + 'USER_IS_MEMBER_OF_CUSTOM' => 'is a member of the following user defined groups', + + 'VIEW_ASSIGNED_ITEMS' => 'View assigned items', + 'VIEW_LOCAL_PERMS' => 'Local permissions', + 'VIEW_GLOBAL_PERMS' => 'Global permissions', + 'VIEW_PERMISSIONS' => 'View permissions', + + 'WRONG_PERMISSION_TYPE' => 'Wrong permission type selected.', + 'WRONG_PERMISSION_SETTING_FORMAT' => 'The permission settings are in a wrong format, phpBB is not able to process them correctly.', +)); diff --git a/install/update/old/language/en/acp/permissions_phpbb.php b/install/update/old/language/en/acp/permissions_phpbb.php new file mode 100644 index 0000000..64740b3 --- /dev/null +++ b/install/update/old/language/en/acp/permissions_phpbb.php @@ -0,0 +1,214 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +/** +* EXTENSION-DEVELOPERS PLEASE NOTE +* +* 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. +*/ + +$lang = array_merge($lang, array( + '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' => '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' => 'Can see forum', + 'ACL_F_LIST_TOPICS' => 'Can see topics', + '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_ANNOUNCE_GLOBAL' => 'Can post global 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
Moderators, who have the approve posts permission, can restore soft deleted posts.', + 'ACL_F_IGNOREFLOOD' => 'Can ignore flood limit', + 'ACL_F_POSTCOUNT' => 'Increment post counter
Please note that this setting only affects new posts.', + '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' => 'Can edit posts', + 'ACL_M_DELETE' => 'Can permanently delete posts', + 'ACL_M_SOFTDELETE' => 'Can soft delete posts
Moderators, who have the approve posts permission, can restore soft deleted posts.', + 'ACL_M_APPROVE' => 'Can approve and restore 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
This setting is only assigned globally. It is not forum based.', // This moderator setting is only global (and not local) + 'ACL_M_PM_REPORT' => 'Can close and delete reports of private messages
This setting is only assigned globally. It is not forum based.', // This moderator setting is only global (and not local) + 'ACL_M_BAN' => 'Can manage bans
This setting is only assigned globally. It is not forum based.', // This moderator setting is only global (and not local) +)); + +// Admin Permissions +$lang = array_merge($lang, array( + '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
This also includes seeing the users browser agent within the viewonline list.', + '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/install/update/old/language/en/acp/posting.php b/install/update/old/language/en/acp/posting.php new file mode 100644 index 0000000..119ad2d --- /dev/null +++ b/install/update/old/language/en/acp/posting.php @@ -0,0 +1,291 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// BBCodes +// Note to translators: you can translate everything but what's between { and } +$lang = array_merge($lang, array( + 'ACP_BBCODES_EXPLAIN' => 'BBCode is a special implementation of HTML offering greater control over what and how something is displayed. From this page you can add, remove and edit custom BBCodes.', + 'ADD_BBCODE' => 'Add a new BBCode', + + 'BBCODE_DANGER' => 'The BBCode you are trying to add seems to use a {TEXT} token inside a HTML attribute. This is a possible XSS security issue. Try using the more restrictive {SIMPLETEXT} or {INTTEXT} types instead. Only proceed if you understand the risks involved and you consider the use of {TEXT} absolutely unavoidable.', + 'BBCODE_DANGER_PROCEED' => 'Proceed', //'I understand the risk', + + 'BBCODE_ADDED' => 'BBCode added successfully.', + 'BBCODE_EDITED' => 'BBCode edited successfully.', + 'BBCODE_DELETED' => 'The BBCode has been removed successfully.', + 'BBCODE_NOT_EXIST' => 'The BBCode you selected does not exist.', + 'BBCODE_HELPLINE' => 'Help line', + 'BBCODE_HELPLINE_EXPLAIN' => 'This field contains the mouse over text of the BBCode.', + 'BBCODE_HELPLINE_TEXT' => 'Help line text', + 'BBCODE_HELPLINE_TOO_LONG' => 'The help line you entered is too long.', + + 'BBCODE_INVALID_TAG_NAME' => 'The BBCode tag name that you selected already exists.', + 'BBCODE_INVALID' => 'Your BBCode is constructed in an invalid form.', + 'BBCODE_OPEN_ENDED_TAG' => 'Your custom BBCode must contain both an opening and a closing tag.', + 'BBCODE_TAG' => 'Tag', + 'BBCODE_TAG_TOO_LONG' => 'The tag name you selected is too long.', + 'BBCODE_TAG_DEF_TOO_LONG' => 'The tag definition that you have entered is too long, please shorten your tag definition.', + 'BBCODE_USAGE' => 'BBCode usage', + 'BBCODE_USAGE_EXAMPLE' => '[highlight={COLOR}]{TEXT}[/highlight]

[font={SIMPLETEXT1}]{SIMPLETEXT2}[/font]', + 'BBCODE_USAGE_EXPLAIN' => 'Here you define how to use the BBCode. Replace any variable input by the corresponding token (%ssee below%s).', + + 'EXAMPLE' => 'Example:', + 'EXAMPLES' => 'Examples:', + + 'HTML_REPLACEMENT' => 'HTML replacement', + 'HTML_REPLACEMENT_EXAMPLE' => '<span style="background-color: {COLOR};">{TEXT}</span>

<span style="font-family: {SIMPLETEXT1};">{SIMPLETEXT2}</span>', + 'HTML_REPLACEMENT_EXPLAIN' => 'Here you define the default HTML replacement. Do not forget to put back tokens you used above!', + + 'TOKEN' => 'Token', + 'TOKENS' => 'Tokens', + 'TOKENS_EXPLAIN' => 'Tokens are placeholders for user input. The input will be validated only if it matches the corresponding definition. If needed, you can number them by adding a number as the last character between the braces, e.g. {TEXT1}, {TEXT2}.

Within the HTML replacement you can also use any language string present in your language/ directory like this: {L_<STRINGNAME>} where <STRINGNAME> is the name of the translated string you want to add. For example, {L_WROTE} will be displayed as “wrote” or its translation according to user’s locale.

Please note that only tokens listed below are able to be used within custom BBCodes.', + 'TOKEN_DEFINITION' => 'What can it be?', + 'TOO_MANY_BBCODES' => 'You cannot create any more BBCodes. Please remove one or more BBCodes then try again.', + + 'tokens' => array( + 'TEXT' => 'Any text, including foreign characters, numbers, etc… You should not use this token in HTML tags. Instead try to use IDENTIFIER, INTTEXT or SIMPLETEXT.', + 'SIMPLETEXT' => 'Characters from the latin alphabet (A-Z), numbers, spaces, commas, dots, minus, plus, hyphen and underscore', + 'INTTEXT' => 'Unicode letter characters, numbers, spaces, commas, dots, minus, plus, hyphen, underscore and whitespaces.', + 'IDENTIFIER' => 'Characters from the latin alphabet (A-Z), numbers, hyphen and underscore', + 'NUMBER' => 'Any series of digits', + 'EMAIL' => 'A valid email address', + 'URL' => 'A valid URL using any protocol (http, ftp, etc… cannot be used for javascript exploits). If none is given, “http://” is prefixed to the string.', + 'LOCAL_URL' => 'A local URL. The URL must be relative to the topic page and cannot contain a server name or protocol, as links are prefixed with “%s”', + 'RELATIVE_URL' => 'A relative URL. You can use this to match parts of a URL, but be careful: a full URL is a valid relative URL. When you want to use relative URLs of your board, use the LOCAL_URL token.', + 'COLOR' => 'A HTML colour, can be either in the numeric form #FF1234 or a CSS colour keyword such as fuchsia or InactiveBorder', + ), +)); + +// Smilies and topic icons +$lang = array_merge($lang, array( + 'ACP_ICONS_EXPLAIN' => 'From this page you can add, remove and edit the icons users may add to their topics or posts. These icons are generally displayed next to topic titles on the forum listing, or the post subjects in topic listings. You can also install and create new packages of icons.', + 'ACP_SMILIES_EXPLAIN' => 'Smilies or emoticons are typically small, sometimes animated images used to convey an emotion or feeling. From this page you can add, remove and edit the emoticons users can use in their posts and private messages. You can also install and create new packages of smilies.', + 'ADD_SMILIES' => 'Add multiple smilies', + 'ADD_SMILEY_CODE' => 'Add additional smiley code', + 'ADD_ICONS' => 'Add multiple icons', + 'AFTER_ICONS' => 'After %s', + 'AFTER_SMILIES' => 'After %s', + + 'CODE' => 'Code', + 'CURRENT_ICONS' => 'Current icons', + 'CURRENT_ICONS_EXPLAIN' => 'Choose what to do with the currently installed icons.', + 'CURRENT_SMILIES' => 'Current smilies', + 'CURRENT_SMILIES_EXPLAIN' => 'Choose what to do with the currently installed smilies.', + + 'DISPLAY_ON_POSTING' => 'Display on posting page', + 'DISPLAY_POSTING' => 'On posting page', + 'DISPLAY_POSTING_NO' => 'Not on posting page', + + 'EDIT_ICONS' => 'Edit icons', + 'EDIT_SMILIES' => 'Edit smilies', + 'EMOTION' => 'Emotion', + 'EXPORT_ICONS' => 'Export and download icons.pak', + 'EXPORT_ICONS_EXPLAIN' => '%sOn clicking this link, the configuration for your installed icons will be packaged into icons.pak which once downloaded can be used to create a .zip or .tgz file containing all of your icons plus this icons.pak configuration file%s.', + 'EXPORT_SMILIES' => 'Export and download smilies.pak', + 'EXPORT_SMILIES_EXPLAIN' => '%sOn clicking this link, the configuration for your installed smilies will be packaged into smilies.pak which once downloaded can be used to create a .zip or .tgz file containing all of your smilies plus this smilies.pak configuration file%s.', + + 'FIRST' => 'First', + + 'ICONS_ADD' => 'Add a new icon', + 'ICONS_ADDED' => array( + 0 => 'No icons were added.', + 1 => 'The icon has been added successfully.', + 2 => 'The icons have been added successfully.', + ), + 'ICONS_CONFIG' => 'Icon configuration', + 'ICONS_DELETED' => 'The icon has been removed successfully.', + 'ICONS_EDIT' => 'Edit icon', + 'ICONS_EDITED' => array( + 0 => 'No icons were updated.', + 1 => 'The icon has been updated successfully.', + 2 => 'The icons have been updated successfully.', + ), + 'ICONS_HEIGHT' => 'Icon height', + 'ICONS_IMAGE' => 'Icon image', + 'ICONS_IMPORTED' => 'The icons pack has been installed successfully.', + 'ICONS_IMPORT_SUCCESS' => 'The icons pack was imported successfully.', + 'ICONS_LOCATION' => 'Icon location', + 'ICONS_NOT_DISPLAYED' => 'The following icons are not displayed on the posting page', + 'ICONS_ORDER' => 'Icon order', + 'ICONS_URL' => 'Icon image file', + 'ICONS_WIDTH' => 'Icon width', + 'IMPORT_ICONS' => 'Install icons package', + 'IMPORT_SMILIES' => 'Install smilies package', + + 'KEEP_ALL' => 'Keep all', + + 'MASS_ADD_SMILIES' => 'Add multiple smilies', + + 'NO_ICONS_ADD' => 'There are no icons available for adding.', + 'NO_ICONS_EDIT' => 'There are no icons available for modifying.', + 'NO_ICONS_EXPORT' => 'You have no icons with which to create a package.', + 'NO_ICONS_PAK' => 'No icon packages found.', + 'NO_SMILIES_ADD' => 'There are no smilies available for adding.', + 'NO_SMILIES_EDIT' => 'There are no smilies available for modifying.', + 'NO_SMILIES_EXPORT' => 'You have no smilies with which to create a package.', + 'NO_SMILIES_PAK' => 'No smiley packages found.', + + 'PAK_FILE_NOT_READABLE' => 'Could not read .pak file.', + + 'REPLACE_MATCHES' => 'Replace matches', + + 'SELECT_PACKAGE' => 'Select a package file', + 'SMILIES_ADD' => 'Add a new smiley', + 'SMILIES_ADDED' => array( + 0 => 'No smilies were added.', + 1 => 'The smiley has been added successfully.', + 2 => 'The smilies have been added successfully.', + ), + 'SMILIES_CODE' => 'Smiley code', + 'SMILIES_CONFIG' => 'Smiley configuration', + 'SMILIES_DELETED' => 'The smiley has been removed successfully.', + 'SMILIES_EDIT' => 'Edit smiley', + 'SMILIE_NO_CODE' => 'The smiley “%s” was ignored, as there was no code entered.', + 'SMILIE_NO_EMOTION' => 'The smiley “%s” was ignored, as there was no emotion entered.', + 'SMILIE_NO_FILE' => 'The smiley “%s” was ignored, as the file is missing.', + 'SMILIES_EDITED' => array( + 0 => 'No smilies were updated.', + 1 => 'The smiley has been updated successfully.', + 2 => 'The smilies have been updated successfully.', + ), + 'SMILIES_EMOTION' => 'Emotion', + 'SMILIES_HEIGHT' => 'Smiley height', + 'SMILIES_IMAGE' => 'Smiley image', + 'SMILIES_IMPORTED' => 'The smilies pack has been installed successfully.', + 'SMILIES_IMPORT_SUCCESS' => 'The smilies pack was imported successfully.', + 'SMILIES_LOCATION' => 'Smiley location', + 'SMILIES_NOT_DISPLAYED' => 'The following smilies are not displayed on the posting page', + 'SMILIES_ORDER' => 'Smiley order', + 'SMILIES_URL' => 'Smiley image file', + 'SMILIES_WIDTH' => 'Smiley width', + + 'TOO_MANY_SMILIES' => array( + 1 => 'Limit of %d smiley reached.', + 2 => 'Limit of %d smilies reached.', + ), + + 'WRONG_PAK_TYPE' => 'The specified package does not contain the appropriate data.', +)); + +// Word censors +$lang = array_merge($lang, array( + 'ACP_WORDS_EXPLAIN' => 'From this control panel you can add, edit, and remove words that will be automatically censored on your forums. People are still allowed to register with usernames containing these words. Wildcards (*) are accepted in the word field, e.g. *test* will match detestable, test* would match testing, *test would match detest.', + 'ADD_WORD' => 'Add new word', + + 'EDIT_WORD' => 'Edit word censor', + 'ENTER_WORD' => 'You must enter a word and its replacement.', + + 'NO_WORD' => 'No word selected for editing.', + + 'REPLACEMENT' => 'Replacement', + + 'UPDATE_WORD' => 'Update word censor', + + 'WORD' => 'Word', + 'WORD_ADDED' => 'The word censor has been successfully added.', + 'WORD_REMOVED' => 'The selected word censor has been successfully removed.', + 'WORD_UPDATED' => 'The selected word censor has been successfully updated.', +)); + +// Ranks +$lang = array_merge($lang, array( + 'ACP_RANKS_EXPLAIN' => 'Using this form you can add, edit, view and delete ranks. You can also create special ranks which can be applied to a user via the user management facility.', + 'ADD_RANK' => 'Add new rank', + + 'MUST_SELECT_RANK' => 'You must select a rank.', + + 'NO_ASSIGNED_RANK' => 'No special rank assigned.', + 'NO_RANK_TITLE' => 'You haven’t specified a title for the rank.', + 'NO_UPDATE_RANKS' => 'The rank was successfully deleted. However user accounts using this rank were not updated. You will need to manually reset the rank on these accounts.', + + 'RANK_ADDED' => 'The rank was successfully added.', + 'RANK_IMAGE' => 'Rank image', + 'RANK_IMAGE_EXPLAIN' => 'Use this to define a small image associated with the rank. The path is relative to the root phpBB directory.', + 'RANK_IMAGE_IN_USE' => '(In use)', + 'RANK_MINIMUM' => 'Minimum posts', + 'RANK_REMOVED' => 'The rank was successfully deleted.', + 'RANK_SPECIAL' => 'Set as special rank', + 'RANK_TITLE' => 'Rank title', + 'RANK_UPDATED' => 'The rank was successfully updated.', +)); + +// Disallow Usernames +$lang = array_merge($lang, array( + 'ACP_DISALLOW_EXPLAIN' => 'Here you can control usernames which will not be allowed to be used. Disallowed usernames are allowed to contain a wildcard character of *.', + 'ADD_DISALLOW_EXPLAIN' => 'You can disallow a username using the wildcard character * to match any character.', + 'ADD_DISALLOW_TITLE' => 'Add a disallowed username', + + 'DELETE_DISALLOW_EXPLAIN' => 'You can remove a disallowed username by selecting the username from this list and clicking submit.', + 'DELETE_DISALLOW_TITLE' => 'Remove a disallowed username', + 'DISALLOWED_ALREADY' => 'The name you entered is already disallowed.', + 'DISALLOWED_DELETED' => 'The disallowed username has been successfully removed.', + 'DISALLOW_SUCCESSFUL' => 'The disallowed username has been successfully added.', + + 'NO_DISALLOWED' => 'No disallowed usernames', + 'NO_USERNAME_SPECIFIED' => 'You haven’t selected or entered a username to operate with.', +)); + +// Reasons +$lang = array_merge($lang, array( + 'ACP_REASONS_EXPLAIN' => 'Here you can manage the reasons used in reports and denial messages when disapproving posts. There is one default reason (marked with a *) you are not able to remove, this reason is normally used for custom messages if no reason fits.', + 'ADD_NEW_REASON' => 'Add new reason', + 'AVAILABLE_TITLES' => 'Available localised reason titles', + + 'IS_NOT_TRANSLATED' => 'Reason has not been localised.', + 'IS_NOT_TRANSLATED_EXPLAIN' => 'Reason has not been localised. If you want to provide the localised form, specify the correct key from the language files report reasons section.', + 'IS_TRANSLATED' => 'Reason has been localised.', + 'IS_TRANSLATED_EXPLAIN' => 'Reason has been localised. If the title you enter here is specified within the language files report reasons section, the localised form of the title and description will be used.', + + 'NO_REASON' => 'Reason could not be found.', + 'NO_REASON_INFO' => 'You have to specify a title and a description for this reason.', + 'NO_REMOVE_DEFAULT_REASON' => 'You are not able to remove the default reason “Other”.', + + 'REASON_ADD' => 'Add report/denial reason', + 'REASON_ADDED' => 'Report/denial reason successfully added.', + 'REASON_ALREADY_EXIST' => 'A reason with this title already exist, please enter another title for this reason.', + 'REASON_DESCRIPTION' => 'Reason description', + 'REASON_DESC_TRANSLATED' => 'Displayed reason description', + 'REASON_EDIT' => 'Edit report/denial reason', + 'REASON_EDIT_EXPLAIN' => 'Here you are able to add or edit a reason. If the reason is translated the localised version is used instead of the description entered here.', + 'REASON_REMOVED' => 'Report/denial reason successfully removed.', + 'REASON_TITLE' => 'Reason title', + 'REASON_TITLE_TRANSLATED' => 'Displayed reason title', + 'REASON_UPDATED' => 'Report/denial reason successfully updated.', + + 'USED_IN_REPORTS' => 'Used in reports', +)); diff --git a/install/update/old/language/en/acp/profile.php b/install/update/old/language/en/acp/profile.php new file mode 100644 index 0000000..41cbd9c --- /dev/null +++ b/install/update/old/language/en/acp/profile.php @@ -0,0 +1,176 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Custom profile fields +$lang = array_merge($lang, array( + 'ADDED_PROFILE_FIELD' => 'Successfully added custom profile field.', + 'ALPHA_DOTS' => 'Alphanumeric and dots (periods)', + 'ALPHA_ONLY' => 'Alphanumeric only', + 'ALPHA_SPACERS' => 'Alphanumeric and spacers', + 'ALPHA_UNDERSCORE' => 'Alphanumeric and underscores', + 'ALPHA_PUNCTUATION' => 'Alphanumeric with comma, dots, underscore and dashes beginning with a letter', + 'ALWAYS_TODAY' => 'Always the current date', + + 'BOOL_ENTRIES_EXPLAIN' => 'Enter your options now', + 'BOOL_TYPE_EXPLAIN' => 'Define the type, either a checkbox or radio buttons. A checkbox will only be displayed if it is checked for a given user. In that case the second language option will be used. Radio buttons will display regardless of their value.', + + 'CHANGED_PROFILE_FIELD' => 'Successfully changed profile field.', + 'CHARS_ANY' => 'Any character', + 'CHECKBOX' => 'Checkbox', + 'COLUMNS' => 'Columns', + 'CP_LANG_DEFAULT_VALUE' => 'Default value', + 'CP_LANG_EXPLAIN' => 'Field description', + 'CP_LANG_EXPLAIN_EXPLAIN' => 'The explanation for this field presented to the user.', + 'CP_LANG_NAME' => 'Field name/title presented to the user', + 'CP_LANG_OPTIONS' => 'Options', + 'CREATE_NEW_FIELD' => 'Create new field', + 'CUSTOM_FIELDS_NOT_TRANSLATED' => 'At least one custom profile field has not yet been translated. Please enter the required information by clicking on the “Translate” link.', + + 'DEFAULT_ISO_LANGUAGE' => 'Default language [%s]', + 'DEFAULT_LANGUAGE_NOT_FILLED' => 'The language entries for the default language are not filled for this profile field.', + 'DEFAULT_VALUE' => 'Default value', + 'DELETE_PROFILE_FIELD' => 'Remove profile field', + 'DELETE_PROFILE_FIELD_CONFIRM' => 'Are you sure you want to delete this profile field?', + 'DISPLAY_AT_PROFILE' => 'Display in user control panel', + 'DISPLAY_AT_PROFILE_EXPLAIN' => 'The user is able to change this profile field within the user control panel.', + 'DISPLAY_AT_REGISTER' => 'Display on registration screen', + 'DISPLAY_AT_REGISTER_EXPLAIN' => 'If this option is enabled, the field will be displayed on registration.', + 'DISPLAY_ON_MEMBERLIST' => 'Display on memberlist screen', + 'DISPLAY_ON_MEMBERLIST_EXPLAIN' => 'If this option is enabled, the field will be displayed in the user rows on the memberlist screen.', + 'DISPLAY_ON_PM' => 'Display on view private message screen', + 'DISPLAY_ON_PM_EXPLAIN' => 'If this option is enabled, the field will be displayed in the mini-profile on the private message screen.', + 'DISPLAY_ON_VT' => 'Display on viewtopic screen', + 'DISPLAY_ON_VT_EXPLAIN' => 'If this option is enabled, the field will be displayed in the mini-profile on the topic screen.', + 'DISPLAY_PROFILE_FIELD' => 'Publicly display profile field', + 'DISPLAY_PROFILE_FIELD_EXPLAIN' => 'The profile field will be shown in all locations allowed within the load settings. Setting this to “no” will hide the field from topic pages, profiles and the memberlist.', + 'DROPDOWN_ENTRIES_EXPLAIN' => 'Enter your options now, every option in one line.', + + 'EDIT_DROPDOWN_LANG_EXPLAIN' => 'Please note that you are able to change your options text and also able to add new options to the end. It is not advised to add new options between existing options - this could result in wrong options assigned to your users. This can also happen if you remove options in-between. Removing options from the end result in users having assigned this item now reverting back to the default one.', + 'EMPTY_FIELD_IDENT' => 'Empty field identification', + 'EMPTY_USER_FIELD_NAME' => 'Please enter a field name/title', + 'ENTRIES' => 'Entries', + 'EVERYTHING_OK' => 'Everything OK', + + 'FIELD_BOOL' => 'Boolean (Yes/No)', + 'FIELD_CONTACT_DESC' => 'Contact description', + 'FIELD_CONTACT_URL' => 'Contact link', + 'FIELD_DATE' => 'Date', + 'FIELD_DESCRIPTION' => 'Field description', + 'FIELD_DESCRIPTION_EXPLAIN' => 'The explanation for this field presented to the user.', + 'FIELD_DROPDOWN' => 'Dropdown box', + 'FIELD_GOOGLEPLUS' => 'Google+', + 'FIELD_IDENT' => 'Field identification', + 'FIELD_IDENT_ALREADY_EXIST' => 'The chosen field identification already exist. Please choose another name.', + 'FIELD_IDENT_EXPLAIN' => 'The field identification is a name to identify the profile field within the database and the templates.', + 'FIELD_INT' => 'Numbers', + 'FIELD_IS_CONTACT' => 'Display field as a contact field', + 'FIELD_IS_CONTACT_EXPLAIN' => 'Contact fields are displayed within the contact section of the user profile and are displayed differently in the mini profile next to posts and private messages. You can use %s as a placeholder variable which will be replaced by a value provided by the user.', + 'FIELD_LENGTH' => 'Length of input box', + 'FIELD_NOT_FOUND' => 'Profile field not found.', + 'FIELD_STRING' => 'Single text field', + 'FIELD_TEXT' => 'Textarea', + 'FIELD_TYPE' => 'Field type', + 'FIELD_TYPE_EXPLAIN' => 'You are not able to change the field type later.', + 'FIELD_URL' => 'URL (Link)', + 'FIELD_VALIDATION' => 'Field validation', + 'FIRST_OPTION' => 'First option', + + 'HIDE_PROFILE_FIELD' => 'Hide profile field', + 'HIDE_PROFILE_FIELD_EXPLAIN' => 'Hide the profile field from all other users except the user, administrators and moderators who are still able to see this field. If the Display in user control panel option is disabled, the user will not be able to see or change this field and the field can only be changed by administrators.', + + 'INVALID_CHARS_FIELD_IDENT' => 'Field identification can only contain lowercase a-z and _', + 'INVALID_FIELD_IDENT_LEN' => 'Field identification can only be 17 characters long', + 'ISO_LANGUAGE' => 'Language [%s]', + + 'LANG_SPECIFIC_OPTIONS' => 'Language specific options [%s]', + + 'LETTER_NUM_DOTS' => 'Any letters, numbers and dots (periods)', + 'LETTER_NUM_ONLY' => 'Any letters and numbers', + 'LETTER_NUM_PUNCTUATION' => 'Any letters, numbers, comma, dots, underscores and dashes beginning with any letter', + 'LETTER_NUM_SPACERS' => 'Any letters, numbers and spacers', + 'LETTER_NUM_UNDERSCORE' => 'Any letters, numbers and underscores', + + 'MAX_FIELD_CHARS' => 'Maximum number of characters', + 'MAX_FIELD_NUMBER' => 'Highest allowed number', + 'MIN_FIELD_CHARS' => 'Minimum number of characters', + 'MIN_FIELD_NUMBER' => 'Lowest allowed number', + + 'NO_FIELD_ENTRIES' => 'No entries defined', + 'NO_FIELD_ID' => 'No field id specified.', + 'NO_FIELD_TYPE' => 'No Field type specified.', + 'NO_VALUE_OPTION' => 'Option equal to non entered value', + 'NO_VALUE_OPTION_EXPLAIN' => 'Value for a non-entry. If the field is required, the user gets an error if he choose the option selected here.', + 'NUMBERS_ONLY' => 'Only numbers (0-9)', + + 'PROFILE_BASIC_OPTIONS' => 'Basic options', + 'PROFILE_FIELD_ACTIVATED' => 'Profile field successfully activated.', + 'PROFILE_FIELD_DEACTIVATED' => 'Profile field successfully deactivated.', + 'PROFILE_LANG_OPTIONS' => 'Language specific options', + 'PROFILE_TYPE_OPTIONS' => 'Profile type specific options', + + 'RADIO_BUTTONS' => 'Radio buttons', + 'REMOVED_PROFILE_FIELD' => 'Successfully removed profile field.', + 'REQUIRED_FIELD' => 'Required field', + 'REQUIRED_FIELD_EXPLAIN' => 'Force profile field to be filled out or specified by user or administrator. If display at registration screen option is disabled, the field will only be required when the user edits their profile.', + 'ROWS' => 'Rows', + + 'SAVE' => 'Save', + 'SECOND_OPTION' => 'Second option', + 'SHOW_NOVALUE_FIELD' => 'Show field if no value was selected', + 'SHOW_NOVALUE_FIELD_EXPLAIN' => 'Determines if the profile field should be displayed if no value was selected for optional fields or if no value has been selected yet for required fields.', + 'STEP_1_EXPLAIN_CREATE' => 'Here you can enter the first basic parameters of your new profile field. This information is needed for the second step where you’ll be able to set remaining options and tweak your profile field further.', + 'STEP_1_EXPLAIN_EDIT' => 'Here you can change the basic parameters of your profile field. The relevant options are re-calculated within the second step.', + 'STEP_1_TITLE_CREATE' => 'Add profile field', + 'STEP_1_TITLE_EDIT' => 'Edit profile field', + 'STEP_2_EXPLAIN_CREATE' => 'Here you are able to define some common options you may want to adjust.', + 'STEP_2_EXPLAIN_EDIT' => 'Here you are able to change some common options.
Please note that changes to profile fields will not affect existing profile fields entered by your users.', + 'STEP_2_TITLE_CREATE' => 'Profile type specific options', + 'STEP_2_TITLE_EDIT' => 'Profile type specific options', + 'STEP_3_EXPLAIN_CREATE' => 'Since you have more than one board language installed, you have to fill out the remaining language items too. If you don’t, then default language setting for this custom profile field will be used, you are able to fill out the remaining language items later too.', + 'STEP_3_EXPLAIN_EDIT' => 'Since you have more than one board language installed, you now can change or add the remaining language items too. If you don’t, then default language setting for this custom profile field will be used.', + 'STEP_3_TITLE_CREATE' => 'Remaining language definitions', + 'STEP_3_TITLE_EDIT' => 'Language definitions', + 'STRING_DEFAULT_VALUE_EXPLAIN' => 'Enter a default phrase to be displayed, a default value. Leave empty if you want to show it empty at the first place.', + + 'TEXT_DEFAULT_VALUE_EXPLAIN' => 'Enter a default text to be displayed, a default value. Leave empty if you want to show it empty at the first place.', + 'TRANSLATE' => 'Translate', + + 'USER_FIELD_NAME' => 'Field name/title presented to the user', + + 'VISIBILITY_OPTION' => 'Visibility options', +)); diff --git a/install/update/old/language/en/acp/styles.php b/install/update/old/language/en/acp/styles.php new file mode 100644 index 0000000..ab85d9d --- /dev/null +++ b/install/update/old/language/en/acp/styles.php @@ -0,0 +1,90 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'ACP_STYLES_EXPLAIN' => 'Here you can manage the available styles on your board. You may alter existing styles, delete, deactivate, reactivate, install new ones. You can also see what a style will look like using the preview function. Also listed is the total user count for each style, note that overriding user styles will not be reflected here.', + + 'CANNOT_BE_INSTALLED' => 'Cannot be installed', + 'CONFIRM_UNINSTALL_STYLES' => 'Are you sure you wish to uninstall selected styles?', + 'COPYRIGHT' => 'Copyright', + + 'DEACTIVATE_DEFAULT' => 'You cannot deactivate the default style.', + 'DELETE_FROM_FS' => 'Delete from filesystem', + 'DELETE_STYLE_FILES_FAILED' => 'Error deleting files for style "%s".', + 'DELETE_STYLE_FILES_SUCCESS' => 'Files for style "%s" have been deleted.', + 'DETAILS' => 'Details', + + 'INHERITING_FROM' => 'Inherits from', + 'INSTALL_STYLE' => 'Install style', + 'INSTALL_STYLES' => 'Install styles', + 'INSTALL_STYLES_EXPLAIN' => 'Here you can install new styles.
If you cannot find a specific style in list below, check to make sure style is already installed. If it is not installed, check if it was uploaded correctly.', + 'INVALID_STYLE_ID' => 'Invalid style ID.', + + 'NO_MATCHING_STYLES_FOUND' => 'No styles match your query.', + 'NO_UNINSTALLED_STYLE' => 'No uninstalled styles detected.', + + 'PURGED_CACHE' => 'Cache was purged.', + + 'REQUIRES_STYLE' => 'This style requires the style "%s" to be installed.', + + 'STYLE_ACTIVATE' => 'Activate', + 'STYLE_ACTIVE' => 'Active', + 'STYLE_DEACTIVATE' => 'Deactivate', + 'STYLE_DEFAULT' => 'Make default style', + 'STYLE_DEFAULT_CHANGE_INACTIVE' => 'You must activate style before making it default style.', + 'STYLE_ERR_INVALID_PARENT' => 'Invalid parent style.', + 'STYLE_ERR_NAME_EXIST' => 'A style with that name already exists.', + 'STYLE_ERR_STYLE_NAME' => 'You must supply a name for this style.', + 'STYLE_INSTALLED' => 'Style "%s" has been installed.', + 'STYLE_INSTALLED_RETURN_INSTALLED_STYLES' => 'Return to installed styles list', + 'STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES' => 'Install more styles', + 'STYLE_NAME' => 'Style name', + 'STYLE_NAME_RESERVED' => 'Style "%s" can not be installed, because the name is reserved.', + 'STYLE_NOT_INSTALLED' => 'Style "%s" was not installed.', + 'STYLE_PATH' => 'Style path', + 'STYLE_UNINSTALL' => 'Uninstall', + 'STYLE_UNINSTALL_DEPENDENT' => 'Style "%s" cannot be uninstalled because it has one or more child styles.', + 'STYLE_UNINSTALLED' => 'Style "%s" uninstalled successfully.', + 'STYLE_PHPBB_VERSION' => 'phpBB Version', + 'STYLE_USED_BY' => 'Used by (including robots)', + 'STYLE_VERSION' => 'Style version', + + 'UNINSTALL_DEFAULT' => 'You cannot uninstall the default style.', + + 'BROWSE_STYLES_DATABASE' => 'Browse styles database', +)); diff --git a/install/update/old/language/en/captcha_recaptcha.php b/install/update/old/language/en/captcha_recaptcha.php new file mode 100644 index 0000000..dde2a4b --- /dev/null +++ b/install/update/old/language/en/captcha_recaptcha.php @@ -0,0 +1,52 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'RECAPTCHA_LANG' => 'en-GB', // Find the language/country code on https://developers.google.com/recaptcha/docs/language - If no code exists for your language you can use "en" or leave the string empty + 'RECAPTCHA_NOT_AVAILABLE' => 'In order to use reCaptcha, you must create an account on www.google.com/recaptcha.', + 'CAPTCHA_RECAPTCHA' => 'reCaptcha', + 'RECAPTCHA_INCORRECT' => 'The solution you provided was incorrect', + 'RECAPTCHA_NOSCRIPT' => 'Please enable JavaScript in your browser to load the challenge.', + + 'RECAPTCHA_PUBLIC' => 'Public reCaptcha key', + 'RECAPTCHA_PUBLIC_EXPLAIN' => 'Your public reCaptcha key. Keys can be obtained on www.google.com/recaptcha.', + 'RECAPTCHA_PRIVATE' => 'Private reCaptcha key', + 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Your private reCaptcha key. Keys can be obtained on www.google.com/recaptcha.', + + 'RECAPTCHA_EXPLAIN' => 'In an effort to prevent automatic submissions, we require that you complete the following challenge.', +)); diff --git a/install/update/old/language/en/cli.php b/install/update/old/language/en/cli.php new file mode 100644 index 0000000..505d12e --- /dev/null +++ b/install/update/old/language/en/cli.php @@ -0,0 +1,178 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +if (!defined('IN_PHPBB')) +{ + exit; +} + +/** +* DO NOT CHANGE +*/ +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'CLI_CONFIG_CANNOT_CACHED' => 'Set this option if the configuration option changes too frequently to be efficiently cached.', + 'CLI_CONFIG_CURRENT' => 'Current configuration value, use 0 and 1 to specify boolean values', + 'CLI_CONFIG_DELETE_SUCCESS' => 'Successfully deleted config %s.', + 'CLI_CONFIG_NEW' => 'New configuration value, use 0 and 1 to specify boolean values', + 'CLI_CONFIG_NOT_EXISTS' => 'Config %s does not exist', + 'CLI_CONFIG_OPTION_NAME' => 'The configuration option’s name', + 'CLI_CONFIG_PRINT_WITHOUT_NEWLINE' => 'Set this option if the value should be printed without a new line at the end.', + 'CLI_CONFIG_INCREMENT_BY' => 'Amount to increment by', + 'CLI_CONFIG_INCREMENT_SUCCESS' => 'Successfully incremented config %s', + 'CLI_CONFIG_SET_FAILURE' => 'Could not set config %s', + 'CLI_CONFIG_SET_SUCCESS' => 'Successfully set config %s', + + 'CLI_DESCRIPTION_CRON_LIST' => 'Prints a list of ready and unready cron jobs.', + 'CLI_DESCRIPTION_CRON_RUN' => 'Runs all ready cron tasks.', + 'CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1' => 'Name of the task to be run', + 'CLI_DESCRIPTION_DB_LIST' => 'List all installed and available migrations.', + 'CLI_DESCRIPTION_DB_MIGRATE' => 'Updates the database by applying migrations.', + 'CLI_DESCRIPTION_DB_REVERT' => 'Revert a migration.', + 'CLI_DESCRIPTION_DELETE_CONFIG' => 'Deletes a configuration option', + 'CLI_DESCRIPTION_DISABLE_EXTENSION' => 'Disables the specified extension.', + 'CLI_DESCRIPTION_ENABLE_EXTENSION' => 'Enables the specified extension.', + 'CLI_DESCRIPTION_FIND_MIGRATIONS' => 'Finds migrations that are not depended upon.', + 'CLI_DESCRIPTION_FIX_LEFT_RIGHT_IDS' => 'Repairs the tree structure of the forums and modules.', + 'CLI_DESCRIPTION_GET_CONFIG' => 'Gets a configuration option’s value', + 'CLI_DESCRIPTION_INCREMENT_CONFIG' => 'Increments a configuration option’s integer value', + 'CLI_DESCRIPTION_LIST_EXTENSIONS' => 'Lists all extensions in the database and on the filesystem.', + + 'CLI_DESCRIPTION_OPTION_ENV' => 'The Environment name.', + 'CLI_DESCRIPTION_OPTION_SAFE_MODE' => 'Run in Safe Mode (without extensions).', + 'CLI_DESCRIPTION_OPTION_SHELL' => 'Launch the shell.', + + 'CLI_DESCRIPTION_PURGE_EXTENSION' => 'Purges the specified extension.', + + 'CLI_DESCRIPTION_REPARSER_LIST' => 'Lists the types of text that can be reparsed.', + 'CLI_DESCRIPTION_REPARSER_AVAILABLE' => 'Available reparsers:', + 'CLI_DESCRIPTION_REPARSER_REPARSE' => 'Reparses stored text with the current text_formatter services.', + 'CLI_DESCRIPTION_REPARSER_REPARSE_ARG_1' => 'Type of text to reparse. Leave blank to reparse everything.', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_DRY_RUN' => 'Do not save any changes; just print what would happen', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_MIN' => 'Lowest record ID to process', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_MAX' => 'Highest record ID to process', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_SIZE' => 'Approximate number of records to process at a time', + 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RESUME' => 'Start reparsing where the last execution stopped', + + 'CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH' => 'Recalculates the user_email_hash column of the users table.', + + 'CLI_DESCRIPTION_SET_ATOMIC_CONFIG' => 'Sets a configuration option’s value only if the old matches the current value', + 'CLI_DESCRIPTION_SET_CONFIG' => 'Sets a configuration option’s value', + + 'CLI_DESCRIPTION_THUMBNAIL_DELETE' => 'Delete all existing thumbnails.', + 'CLI_DESCRIPTION_THUMBNAIL_GENERATE' => 'Generate all missing thumbnails.', + 'CLI_DESCRIPTION_THUMBNAIL_RECREATE' => 'Recreate all thumbnails.', + + 'CLI_DESCRIPTION_UPDATE_CHECK' => 'Check if the board is up to date.', + 'CLI_DESCRIPTION_UPDATE_CHECK_ARGUMENT_1' => 'Name of the extension to check (if all, checks all the extensions)', + 'CLI_DESCRIPTION_UPDATE_CHECK_OPTION_CACHE' => 'Run check command with cache.', + 'CLI_DESCRIPTION_UPDATE_CHECK_OPTION_STABILITY' => 'Run command choosing to check only stable or unstable versions.', + + 'CLI_DESCRIPTION_UPDATE_HASH_BCRYPT' => 'Updates outdated password hashes to be hashed with bcrypt.', + + 'CLI_ERROR_INVALID_STABILITY' => '"%s" needs to be set to "stable" or "unstable".', + + 'CLI_DESCRIPTION_USER_ACTIVATE' => 'Activate (or deactivate) a user account.', + 'CLI_DESCRIPTION_USER_ACTIVATE_USERNAME' => 'Username of the account to activate.', + 'CLI_DESCRIPTION_USER_ACTIVATE_DEACTIVATE' => 'Deactivate the user’s account', + 'CLI_DESCRIPTION_USER_ACTIVATE_ACTIVE' => 'The user is already active.', + 'CLI_DESCRIPTION_USER_ACTIVATE_INACTIVE' => 'The user is already inactive.', + 'CLI_DESCRIPTION_USER_ADD' => 'Add a new user.', + 'CLI_DESCRIPTION_USER_ADD_OPTION_USERNAME' => 'Username of the new user', + 'CLI_DESCRIPTION_USER_ADD_OPTION_PASSWORD' => 'Password of the new user', + 'CLI_DESCRIPTION_USER_ADD_OPTION_EMAIL' => 'E-mail address of the new user', + 'CLI_DESCRIPTION_USER_ADD_OPTION_NOTIFY' => 'Send account activation email to the new user (not sent by default)', + 'CLI_DESCRIPTION_USER_DELETE' => 'Delete a user account.', + 'CLI_DESCRIPTION_USER_DELETE_USERNAME' => 'Username of the user to delete', + 'CLI_DESCRIPTION_USER_DELETE_OPTION_POSTS' => 'Delete all posts by the user. Without this option, the user’s posts will be retained.', + 'CLI_DESCRIPTION_USER_RECLEAN' => 'Re-clean usernames.', + + 'CLI_EXTENSION_DISABLE_FAILURE' => 'Could not disable extension %s', + 'CLI_EXTENSION_DISABLE_SUCCESS' => 'Successfully disabled extension %s', + 'CLI_EXTENSION_DISABLED' => 'Extension %s is not enabled', + 'CLI_EXTENSION_ENABLE_FAILURE' => 'Could not enable extension %s', + 'CLI_EXTENSION_ENABLE_SUCCESS' => 'Successfully enabled extension %s', + 'CLI_EXTENSION_ENABLED' => 'Extension %s is already enabled', + 'CLI_EXTENSION_NOT_EXIST' => 'Extension %s does not exist', + 'CLI_EXTENSION_NAME' => 'Name of the extension', + 'CLI_EXTENSION_PURGE_FAILURE' => 'Could not purge extension %s', + 'CLI_EXTENSION_PURGE_SUCCESS' => 'Successfully purged extension %s', + 'CLI_EXTENSION_UPDATE_FAILURE' => 'Could not update extension %s', + 'CLI_EXTENSION_UPDATE_SUCCESS' => 'Successfully updated extension %s', + 'CLI_EXTENSION_NOT_FOUND' => 'No extensions were found.', + 'CLI_EXTENSION_NOT_ENABLEABLE' => 'Extension %s is not enableable.', + 'CLI_EXTENSIONS_AVAILABLE' => 'Available', + 'CLI_EXTENSIONS_DISABLED' => 'Disabled', + 'CLI_EXTENSIONS_ENABLED' => 'Enabled', + + 'CLI_FIXUP_FIX_LEFT_RIGHT_IDS_SUCCESS' => 'Successfully repaired the tree structure of the forums and modules.', + 'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS' => 'Successfully recalculated all email hashes.', + 'CLI_FIXUP_UPDATE_HASH_BCRYPT_SUCCESS' => 'Successfully updated outdated password hashes to bcrypt.', + + 'CLI_MIGRATION_NAME' => 'Migration name, including the namespace (use forward slashes instead of backslashes to avoid problems).', + 'CLI_MIGRATIONS_AVAILABLE' => 'Available migrations', + 'CLI_MIGRATIONS_INSTALLED' => 'Installed migrations', + 'CLI_MIGRATIONS_ONLY_AVAILABLE' => 'Show only available migrations', + 'CLI_MIGRATIONS_EMPTY' => 'No migrations.', + + 'CLI_REPARSER_REPARSE_REPARSING' => 'Reparsing %1$s (range %2$d..%3$d)', + 'CLI_REPARSER_REPARSE_REPARSING_START' => 'Reparsing %s...', + 'CLI_REPARSER_REPARSE_SUCCESS' => 'Reparsing ended with success', + + // In all the case %1$s is the logical name of the file and %2$s the real name on the filesystem + // eg: big_image.png (2_a51529ae7932008cf8454a95af84cacd) generated. + 'CLI_THUMBNAIL_DELETED' => '%1$s (%2$s) deleted.', + 'CLI_THUMBNAIL_DELETING' => 'Deleting thumbnails', + 'CLI_THUMBNAIL_SKIPPED' => '%1$s (%2$s) skipped.', + 'CLI_THUMBNAIL_GENERATED' => '%1$s (%2$s) generated.', + 'CLI_THUMBNAIL_GENERATING' => 'Generating thumbnails', + 'CLI_THUMBNAIL_GENERATING_DONE' => 'All thumbnails have been regenerated.', + 'CLI_THUMBNAIL_DELETING_DONE' => 'All thumbnails have been deleted.', + + 'CLI_THUMBNAIL_NOTHING_TO_GENERATE' => 'No thumbnails to generate.', + 'CLI_THUMBNAIL_NOTHING_TO_DELETE' => 'No thumbnails to delete.', + + 'CLI_USER_ADD_SUCCESS' => 'Successfully added user %s.', + 'CLI_USER_DELETE_CONFIRM' => 'Are you sure you want to delete ‘%s’? [y/N]', + 'CLI_USER_RECLEAN_START' => 'Re-cleaning usernames', + 'CLI_USER_RECLEAN_DONE' => [ + 0 => 'Re-cleaning complete. No usernames needed to be cleaned.', + 1 => 'Re-cleaning complete. %d username was cleaned.', + 2 => 'Re-cleaning complete. %d usernames were cleaned.', + ], +)); + +// Additional help for commands. +$lang = array_merge($lang, array( + 'CLI_HELP_CRON_RUN' => $lang['CLI_DESCRIPTION_CRON_RUN'] . ' Optionally you can specify a cron task name to run only the specified cron task.', + 'CLI_HELP_USER_ACTIVATE' => 'Activate a user account, or deactivate an account using the --deactivate option. +To optionally send an activation email to the user, use the --send-email option.', + 'CLI_HELP_USER_ADD' => 'The %command.name% command adds a new user: +If this command is run without options, you will be prompted to enter them. +To optionally send an email to the new user, use the --send-email option.', + 'CLI_HELP_USER_RECLEAN' => 'Re-clean usernames will check all stored usernames and ensure clean versions are also stored. Cleaned usernames are a case insensitive form, NFC normalized and transformed to ASCII.', +)); diff --git a/install/update/old/language/en/common.php b/install/update/old/language/en/common.php new file mode 100644 index 0000000..8350307 --- /dev/null +++ b/install/update/old/language/en/common.php @@ -0,0 +1,1438 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine +// +// Some characters you may want to copy&paste: +// ’ » “ ” … +// + +$lang = array_merge($lang, array( + 'TRANSLATION_INFO' => '', + 'DIRECTION' => 'ltr', + 'DATE_FORMAT' => '|d M Y|', // 01 Jan 2007 (with Relative days enabled) + 'DATETIME_FORMAT' => '|d M Y, H:i|', // 01 Jan 2007, 13:37 (with Relative days enabled) + 'USER_LANG' => 'en-gb', + + // You can define different rules for the determination of plural forms here. + // See https://area51.phpbb.com/docs/dev/32x/language/plurals.html for more information + // or ask the translation manager for help. + 'PLURAL_RULE' => 1, + + '1_DAY' => '1 day', + '1_MONTH' => '1 month', + '1_YEAR' => '1 year', + '2_WEEKS' => '2 weeks', + '3_MONTHS' => '3 months', + '6_MONTHS' => '6 months', + '7_DAYS' => '7 days', + + 'ACCOUNT_ALREADY_ACTIVATED' => 'Your account has already been activated.', + 'ACCOUNT_DEACTIVATED' => 'Your account has been manually deactivated and is only able to be reactivated by an administrator.', + 'ACP' => 'Administration Control Panel', + 'ACP_SHORT' => 'ACP', + 'ACTIVE' => 'active', + 'ACTIVE_ERROR' => 'The specified username is currently inactive. If you have problems activating your account, please contact a board administrator.', + 'ADMINISTRATOR' => 'Administrator', + 'ADMINISTRATORS' => 'Administrators', + 'AGE' => 'Age', + 'AIM' => 'AIM', + 'AJAX_ERROR_TITLE' => 'AJAX error', + 'AJAX_ERROR_TEXT' => 'Something went wrong when processing your request.', + 'AJAX_ERROR_TEXT_ABORT' => 'User aborted request.', + 'AJAX_ERROR_TEXT_TIMEOUT' => 'Your request timed out; please try again.', + 'AJAX_ERROR_TEXT_PARSERERROR' => 'Something went wrong with the request and the server returned an invalid reply.', + 'ALLOWED' => 'Allowed', + 'ALL_FILES' => 'All files', + 'ALL_FORUMS' => 'All forums', + 'ALL_MESSAGES' => 'All messages', + 'ALL_POSTS' => 'All posts', + 'ALL_TIMES' => 'All times are %1$s', + 'ALL_TOPICS' => 'All Topics', + 'ALT_TEXT' => 'Alternative text', + 'AND' => 'And', + 'ARE_WATCHING_FORUM' => 'You have subscribed to be notified of new posts in this forum.', + 'ARE_WATCHING_TOPIC' => 'You have subscribed to be notified of new posts in this topic.', + 'ASCENDING' => 'Ascending', + 'ATTACHMENTS' => 'Attachments', + 'ATTACHED_IMAGE_NOT_IMAGE' => 'The image file you tried to attach is invalid.', + 'AUTHOR' => 'Author', + 'AUTH_NO_PROFILE_CREATED' => 'The creation of a user profile was unsuccessful.', + 'AUTH_PROVIDER_OAUTH_ERROR_INVALID_ENTRY' => 'Invalid database entry.', + 'AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE' => 'Invalid service type provided to OAuth service handler.', + 'AUTH_PROVIDER_OAUTH_ERROR_SERVICE_NOT_CREATED' => 'OAuth service not created', + 'AUTH_PROVIDER_OAUTH_SERVICE_BITLY' => 'Bitly', + 'AUTH_PROVIDER_OAUTH_SERVICE_FACEBOOK' => 'Facebook', + 'AUTH_PROVIDER_OAUTH_SERVICE_GOOGLE' => 'Google', + 'AUTH_PROVIDER_OAUTH_SERVICE_TWITTER' => 'Twitter', + 'AUTH_PROVIDER_OAUTH_TOKEN_ERROR_NOT_STORED' => 'OAuth token not stored.', + 'AUTH_PROVIDER_OAUTH_TOKEN_ERROR_INCORRECTLY_STORED' => 'OAuth token incorrectly stored.', + 'AVATAR_DISALLOWED_CONTENT' => 'The upload was rejected because the uploaded file was identified as a possible attack vector.', + 'AVATAR_DISALLOWED_EXTENSION' => 'This file cannot be displayed because the extension %s is not allowed.', + 'AVATAR_EMPTY_REMOTE_DATA' => 'The specified avatar could not be uploaded because the remote data appears to be invalid or corrupted.', + 'AVATAR_EMPTY_FILEUPLOAD' => 'The uploaded avatar file is empty.', + 'AVATAR_INVALID_FILENAME' => '%s is an invalid filename.', + 'AVATAR_NOT_UPLOADED' => 'Avatar could not be uploaded.', + 'AVATAR_NO_TEMP_DIR' => 'Temporary folder could not be found or is not writable.', + 'AVATAR_NO_SIZE' => 'The width or height of the linked avatar could not be determined. Please enter them manually.', + 'AVATAR_PARTIAL_UPLOAD' => 'The specified file was only partially uploaded.', + 'AVATAR_PHP_SIZE_NA' => 'The avatar’s filesize is too large.
The maximum allowed filesize set in php.ini could not be determined.', + 'AVATAR_PHP_SIZE_OVERRUN' => 'The avatar’s filesize is too large. The maximum allowed upload size is %1$d %2$s.
Please note this is set in php.ini and cannot be overridden.', + 'AVATAR_REMOTE_UPLOAD_TIMEOUT' => 'The specified avatar could not be uploaded because the request timed out.', + 'AVATAR_PHP_UPLOAD_STOPPED' => 'A PHP extension has stopped the file upload.', + 'AVATAR_URL_INVALID' => 'The URL you specified is invalid.', + 'AVATAR_URL_NOT_FOUND' => 'The file specified could not be found.', + 'AVATAR_WRONG_FILESIZE' => 'The avatar’s filesize must be between 0 and %1$d %2$s.', + 'AVATAR_WRONG_SIZE' => 'The submitted avatar is %5$s wide and %6$s high. Avatars must be at least %1$s wide and %2$s high, but no larger than %3$s wide and %4$s high.', + + 'BACK_TO_TOP' => 'Top', + 'BACK_TO_PREV' => 'Back to previous page', + 'BAN_TRIGGERED_BY_EMAIL'=> 'A ban has been issued on your email address.', + 'BAN_TRIGGERED_BY_IP' => 'A ban has been issued on your IP address.', + 'BAN_TRIGGERED_BY_USER' => 'A ban has been issued on your username.', + 'BBCODE_GUIDE' => 'BBCode guide', + 'BCC' => 'BCC', + 'BIRTHDAYS' => 'Birthdays', + 'BOARD_BAN_PERM' => 'You have been permanently banned from this board.

Please contact the %2$sBoard Administrator%3$s for more information.', + 'BOARD_BAN_REASON' => 'Reason given for ban: %s', + 'BOARD_BAN_TIME' => 'You have been banned from this board until %1$s.

Please contact the %2$sBoard Administrator%3$s for more information.', + 'BOARD_DISABLE' => 'Sorry but this board is currently unavailable.', + 'BOARD_DISABLED' => 'This board is currently disabled.', + 'BOARD_UNAVAILABLE' => 'Sorry but the board is temporarily unavailable, please try again in a few minutes.', + 'BROWSING_FORUM' => 'Users browsing this forum: %1$s', + 'BROWSING_FORUM_GUESTS' => array( + 1 => 'Users browsing this forum: %2$s and %1$d guest', + 2 => 'Users browsing this forum: %2$s and %1$d guests', + ), + 'BUTTON_DELETE' => 'Delete', + 'BUTTON_EDIT' => 'Edit', + 'BUTTON_FORUM_LOCKED' => 'Locked', + 'BUTTON_INFORMATION' => 'Information', + 'BUTTON_NEW_TOPIC' => 'New Topic', + 'BUTTON_PM' => 'PM', + 'BUTTON_PM_FORWARD' => 'Forward', + 'BUTTON_PM_NEW' => 'New PM', + 'BUTTON_PM_REPLY' => 'Send Reply', + 'BUTTON_PM_REPLY_ALL' => 'Reply All', + 'BUTTON_POST_REPLY' => 'Post Reply', + 'BUTTON_QUOTE' => 'Quote', + 'BUTTON_REPORT' => 'Report', + 'BUTTON_TOPIC_LOCKED' => 'Locked', + 'BUTTON_WARN' => 'Warn', + 'BYTES' => 'Bytes', + 'BYTES_SHORT' => 'B', + + 'CANCEL' => 'Cancel', + 'CHANGE' => 'Change', + 'CHANGE_FONT_SIZE' => 'Change font size', + 'CHANGING_PREFERENCES' => 'Changing board preferences', + 'CHANGING_PROFILE' => 'Changing profile settings', + 'CHARACTERS' => array( + 1 => '%d character', + 2 => '%d characters', + ), + 'COLLAPSE_VIEW' => 'Collapse view', + 'CLOSE_WINDOW' => 'Close window', + 'COLOUR_SWATCH' => 'Colour swatch', + 'COLON' => ':', + 'COMMA_SEPARATOR' => ', ', // Comma used to join lists into a single string, use localised comma if appropriate, eg: Ideographic or Arabic + 'CONFIRM' => 'Confirm', + 'CONFIRM_CODE' => 'Confirmation code', + 'CONFIRM_CODE_EXPLAIN' => 'Enter the code exactly as it appears. All letters are case insensitive.', + 'CONFIRM_CODE_WRONG' => 'The confirmation code you entered was incorrect.', + 'CONFIRM_OPERATION' => 'Are you sure you wish to carry out this operation?', + 'CONFIRM_AVATAR_DELETE' => 'Are you sure you wish to delete this avatar?', + 'CONGRATULATIONS' => 'Congratulations to', + 'CONNECTION_FAILED' => 'Connection failed.', + 'CONNECTION_SUCCESS' => 'Connection was successful!', + 'CONTACT' => 'Contact', + 'CONTACT_USER' => 'Contact %s', + 'CONTACT_US' => 'Contact us', + 'COOKIE_CONSENT_INFO' => 'Learn more', + 'COOKIE_CONSENT_MSG' => 'This website uses cookies to ensure you get the best experience on our website.', + 'COOKIE_CONSENT_OK' => 'Got it!', + 'COOKIE_CONSENT_HREF' => 'http://cookiesandyou.com', + 'COOKIES_DELETED' => 'All board cookies successfully deleted.', + 'CURRENT_TIME' => 'It is currently %s', + + 'DAY' => 'Day', + 'DAYS' => 'Days', + 'DELETE' => 'Delete', + 'DELETE_ALL' => 'Delete all', + 'DELETE_COOKIES' => 'Delete cookies', + 'DELETE_MARKED' => 'Delete marked', + 'DELETE_POST' => 'Delete post', + 'DELIMITER' => 'Delimiter', + 'DESCENDING' => 'Descending', + 'DISABLED' => 'Disabled', + 'DISPLAY' => 'Display', + 'DISPLAY_GUESTS' => 'Display guests', + 'DISPLAY_MESSAGES' => 'Display messages from previous', + 'DISPLAY_POSTS' => 'Display posts from previous', + 'DISPLAY_TOPICS' => 'Display topics from previous', + 'DOWNLOADED' => 'Downloaded', + 'DOWNLOADING_FILE' => 'Downloading file', + 'DOWNLOAD_COUNTS' => array( + 0 => 'Not downloaded yet', + 1 => 'Downloaded %d time', + 2 => 'Downloaded %d times', + ), + + 'EDIT_POST' => 'Edit post', + 'ELLIPSIS' => '…', + 'EMAIL' => 'Email', // Short form for EMAIL_ADDRESS + 'EMAIL_ADDRESS' => 'Email address', + 'EMAIL_INVALID_EMAIL' => 'The email address you entered is invalid.', + 'EMAIL_SMTP_ERROR_RESPONSE' => 'Ran into problems sending email at Line %1$s. Response: %2$s.', + 'EMPTY_SUBJECT' => 'You must specify a subject when posting a new topic.', + 'EMPTY_MESSAGE_SUBJECT' => 'You must specify a subject when composing a new message.', + 'ENABLED' => 'Enabled', + 'ENCLOSURE' => 'Enclosure', + 'ENTER_USERNAME' => 'Enter username', + 'ERR_CHANGING_DIRECTORY' => 'Unable to change directory.', + 'ERR_CONNECTING_SERVER' => 'Error connecting to the server.', + 'ERR_JAB_AUTH' => 'Could not authorise on Jabber server.', + 'ERR_JAB_CONNECT' => 'Could not connect to Jabber server.', + 'ERR_UNABLE_TO_LOGIN' => 'The specified username or password is incorrect.', + 'ERR_UNWATCHING' => 'An error occurred while trying to unsubscribe.', + 'ERR_WATCHING' => 'An error occurred while trying to subscribe.', + 'ERR_WRONG_PATH_TO_PHPBB' => 'The phpBB path specified appears to be invalid.', + 'ERROR' => 'Error', + 'EXPAND_VIEW' => 'Expand view', + 'EXTENSION' => 'Extension', + 'EXTENSION_DISABLED' => 'The extension %s is not enabled.', + 'EXTENSION_DISABLED_AFTER_POSTING' => 'The extension %s has been deactivated and can no longer be displayed.', + 'EXTENSION_DOES_NOT_EXIST' => 'The extension %s does not exist.', + + 'FACEBOOK' => 'Facebook', + 'FAQ' => 'FAQ', + 'FAQ_EXPLAIN' => 'Frequently Asked Questions', + 'FEATURE_NOT_AVAILABLE' => 'The requested feature is not available on this board.', + 'FILENAME' => 'Filename', + 'FILESIZE' => 'File size', + 'FILEDATE' => 'File date', + 'FILE_COMMENT' => 'File comment', + 'FILE_CONTENT_ERR' => 'Could not read the contents of file: %s', + 'FILE_JSON_DECODE_ERR' => 'Failed to decode json file: %s', + 'FILE_NOT_FOUND' => 'The requested file could not be found: %s', + 'FIND_USERNAME' => 'Find a member', + 'FOLDER' => 'Folder', + 'FORGOT_PASS' => 'I forgot my password', + 'FORM_INVALID' => 'The submitted form was invalid. Try submitting again.', + 'FORUM' => 'Forum', + 'FORUMS' => 'Forums', + 'FORUMS_MARKED' => 'Forums have been marked read.', + 'FORUM_CAT' => 'Forum category', + 'FORUM_INDEX' => 'Board index', + 'FORUM_LINK' => 'Forum link', + 'FORUM_LOCATION' => 'Forum location', + 'FORUM_LOCKED' => 'Forum locked', + 'FORUM_RULES' => 'Forum rules', + 'FORUM_RULES_LINK' => 'Please click here to view the forum rules', + 'FROM' => 'from', + 'FSOCK_DISABLED' => 'The operation could not be completed because the fsockopen function has been disabled or the server being queried could not be found.', + 'FSOCK_TIMEOUT' => 'A timeout occurred while reading from the network stream.', + + 'FTP_FSOCK_HOST' => 'FTP host', + 'FTP_FSOCK_HOST_EXPLAIN' => 'FTP server used to connect your site.', + 'FTP_FSOCK_PASSWORD' => 'FTP password', + 'FTP_FSOCK_PASSWORD_EXPLAIN' => 'Password for your FTP username.', + 'FTP_FSOCK_PORT' => 'FTP port', + 'FTP_FSOCK_PORT_EXPLAIN' => 'Port used to connect to your server.', + 'FTP_FSOCK_ROOT_PATH' => 'Path to phpBB', + 'FTP_FSOCK_ROOT_PATH_EXPLAIN' => 'Path from the root to your phpBB board.', + 'FTP_FSOCK_TIMEOUT' => 'FTP timeout', + 'FTP_FSOCK_TIMEOUT_EXPLAIN' => 'The amount of time, in seconds, that the system will wait for a reply from your server.', + 'FTP_FSOCK_USERNAME' => 'FTP username', + 'FTP_FSOCK_USERNAME_EXPLAIN' => 'Username used to connect to your server.', + + 'FTP_HOST' => 'FTP host', + 'FTP_HOST_EXPLAIN' => 'FTP server used to connect your site.', + 'FTP_PASSWORD' => 'FTP password', + 'FTP_PASSWORD_EXPLAIN' => 'Password for your FTP username.', + 'FTP_PORT' => 'FTP port', + 'FTP_PORT_EXPLAIN' => 'Port used to connect to your server.', + 'FTP_ROOT_PATH' => 'Path to phpBB', + 'FTP_ROOT_PATH_EXPLAIN' => 'Path from the root to your phpBB board.', + 'FTP_TIMEOUT' => 'FTP timeout', + 'FTP_TIMEOUT_EXPLAIN' => 'The amount of time, in seconds, that the system will wait for a reply from your server.', + 'FTP_USERNAME' => 'FTP username', + 'FTP_USERNAME_EXPLAIN' => 'Username used to connect to your server.', + + 'GENERAL_ERROR' => 'General Error', + 'GB' => 'GB', + 'GIB' => 'GiB', + 'GO' => 'Go', + 'GOOGLEPLUS' => 'Google+', + 'GOTO_FIRST_POST' => 'Go to first post', + 'GOTO_LAST_POST' => 'Go to last post', + 'GOTO_PAGE' => 'Go to page', + 'GROUP' => 'Group', + 'GROUPS' => 'Groups', + 'GROUP_ERR_TYPE' => 'Inappropriate group type specified.', + 'GROUP_ERR_USERNAME' => 'No group name specified.', + 'GROUP_ERR_USER_LONG' => 'Group names cannot exceed 60 characters. The specified group name is too long.', + 'GUEST' => 'Guest', + 'GUEST_USERS_ONLINE' => array( + 1 => 'There is %d guest user online', + 2 => 'There are %d guest users online', + ), + 'GUEST_USERS_TOTAL' => array( + 1 => '%d guest', + 2 => '%d guests', + ), + 'G_ADMINISTRATORS' => 'Administrators', + 'G_BOTS' => 'Bots', + 'G_GUESTS' => 'Guests', + 'G_REGISTERED' => 'Registered users', + 'G_REGISTERED_COPPA' => 'Registered COPPA users', + 'G_GLOBAL_MODERATORS' => 'Global moderators', + 'G_NEWLY_REGISTERED' => 'Newly registered users', + + 'HIDDEN_USERS_ONLINE' => array( + 1 => '%d hidden user', + 2 => '%d hidden users', + ), + 'HIDDEN_USERS_TOTAL' => array( + 1 => '%d hidden', + 2 => '%d hidden', + ), + 'HIDE_GUESTS' => 'Hide guests', + 'HIDE_ME' => 'Hide my online status this session', + 'HOURS' => 'Hours', + 'HOME' => 'Home', + + 'ICQ' => 'ICQ', + 'IF' => 'If', + 'IMAGE' => 'Image', + 'IMAGE_FILETYPE_INVALID' => 'Image file type %d for mimetype %s not supported.', + 'IMAGE_FILETYPE_MISMATCH' => 'Image file type mismatch: expected extension %1$s but extension %2$s given.', + 'IN' => 'in', + 'INACTIVE' => 'Inactive', + 'INDEX' => 'Index page', + 'INFORMATION' => 'Information', + 'INSECURE_REDIRECT' => 'Tried to redirect to potentially insecure url.', + 'INTERESTS' => 'Interests', + 'INVALID_DIGEST_CHALLENGE' => 'Invalid digest challenge.', + 'INVALID_EMAIL_LOG' => '%s possibly an invalid email address?', + 'INVALID_FEED_ATTACHMENTS' => 'The selected feed tried fetching attachments with invalid constraints.', + 'INVALID_PLURAL_RULE' => 'The chosen plural rule is invalid. Valid values are integers between 0 and 15.', + 'IP' => 'IP', + 'IP_BLACKLISTED' => 'Your IP %1$s has been blocked because it is blacklisted. For details please see %2$s.', + + 'JABBER' => 'Jabber', + 'JOINED' => 'Joined', + 'JUMP_PAGE' => 'Enter the page number you wish to go to', + 'JUMP_TO' => 'Jump to', + 'JUMP_TO_PAGE' => 'Jump to page', + 'JUMP_TO_PAGE_CLICK' => 'Click to jump to page…', + + 'KB' => 'KB', + 'KIB' => 'KiB', + + 'LAST_POST' => 'Last post', + 'LAST_UPDATED' => 'Last updated', + 'LAST_VISIT' => 'Last visit', + 'LDAP_NO_LDAP_EXTENSION' => 'LDAP extension not available.', + 'LDAP_NO_SERVER_CONNECTION' => 'Could not connect to LDAP server.', + 'LDAP_SEARCH_FAILED' => 'An error occurred while searching the LDAP directory.', + 'LEGEND' => 'Legend', + 'LIVE_SEARCHES_NOT_ALLOWED' => 'Live searches are not allowed.', + 'LOADING' => 'Loading', + 'LOCATION' => 'Location', + 'LOCK_POST' => 'Lock post', + 'LOCK_POST_EXPLAIN' => 'Prevent editing', + 'LOCK_TOPIC' => 'Lock topic', + 'LOGIN' => 'Login', + 'LOGIN_CHECK_PM' => 'Log in to check your private messages.', + 'LOGIN_CONFIRMATION' => 'Confirmation of login', + 'LOGIN_CONFIRM_EXPLAIN' => 'To prevent brute forcing accounts the board requires you to enter a confirmation code after a maximum amount of failed logins. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', // unused + 'LOGIN_ERROR_ATTEMPTS' => 'You exceeded the maximum allowed number of login attempts. In addition to your username and password you now also have to solve the CAPTCHA below.', + 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE' => 'You have not been authenticated by Apache.', + 'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST' => 'A non-existant OAuth service has been requested.', + 'LOGIN_ERROR_PASSWORD' => 'You have specified an incorrect password. Please check your password and try again. If you continue to have problems please contact the %sBoard Administrator%s.', + 'LOGIN_ERROR_PASSWORD_CONVERT' => 'It was not possible to convert your password when updating this bulletin board’s software. Please %srequest a new password%s. If you continue to have problems please contact the %sBoard Administrator%s.', + 'LOGIN_ERROR_USERNAME' => 'You have specified an incorrect username. Please check your username and try again. If you continue to have problems please contact the %sBoard Administrator%s.', + 'LOGIN_FORUM' => 'To view or post in this forum you must enter its password.', + 'LOGIN_INFO' => 'In order to login you must be registered. Registering takes only a few moments but gives you increased capabilities. The board administrator may also grant additional permissions to registered users. Before you register please ensure you are familiar with our terms of use and related policies. Please ensure you read any forum rules as you navigate around the board.', + 'LOGIN_VIEWFORUM' => 'The board requires you to be registered and logged in to view this forum.', + 'LOGIN_EXPLAIN_EDIT' => 'In order to edit posts in this forum you have to be registered and logged in.', + 'LOGIN_EXPLAIN_VIEWONLINE' => 'In order to view the online list you have to be registered and logged in.', + 'LOGIN_REQUIRED' => 'You need to login to perform this action.', + 'LOGOUT' => 'Logout', + 'LOGOUT_USER' => 'Logout [ %s ]', + 'LOG_ME_IN' => 'Remember me', + + 'MAIN' => 'Main', + 'MARK' => 'Mark', + 'MARK_ALL' => 'Mark all', + 'MARK_ALL_READ' => 'Mark all read', + 'MARK_FORUMS_READ' => 'Mark forums read', + 'MARK_READ' => 'Mark read', + 'MARK_SUBFORUMS_READ' => 'Mark subforums read', + 'MB' => 'MB', + 'MIB' => 'MiB', + 'MCP' => 'Moderator Control Panel', + 'MCP_SHORT' => 'MCP', + 'MEMBERLIST' => 'Members', + 'MEMBERLIST_EXPLAIN' => 'View complete list of members', + 'MERGE' => 'Merge', + 'MERGE_POSTS' => 'Move posts', + 'MERGE_TOPIC' => 'Merge topic', + 'MESSAGE' => 'Message', + 'MESSAGES' => 'Messages', + 'MESSAGES_COUNT' => array( + 1 => '%d message', + 2 => '%d messages', + ), + 'MESSAGE_BODY' => 'Message body', + 'MINUTES' => 'Minutes', + 'MODERATE' => 'Moderate', + 'MODERATOR' => 'Moderator', + 'MODERATORS' => 'Moderators', + 'MODULE_NOT_ACCESS' => 'Module not accessible', + 'MODULE_NOT_FIND' => 'Cannot find module %s', + 'MODULE_FILE_INCORRECT_CLASS' => 'Module file %s does not contain correct class [%s]', + 'MONTH' => 'Month', + 'MOVE' => 'Move', + + 'NA' => 'N/A', + 'NEWEST_USER' => 'Our newest member %s', + 'NEW_MESSAGE' => 'New message', + 'NEW_MESSAGES' => 'New messages', + 'NEW_POST' => 'New post', // Not used anymore + 'NEW_POSTS' => 'New posts', // Not used anymore + 'NEXT' => 'Next', // Used in pagination + 'NEXT_STEP' => 'Next', + 'NEVER' => 'Never', + 'NO' => 'No', + 'NO_NOTIFICATIONS' => 'You have no notifications', + 'NOT_ALLOWED_MANAGE_GROUP' => 'You are not allowed to manage this group.', + 'NOT_AUTHORISED' => 'You are not authorised to access this area.', + 'NOT_WATCHING_FORUM' => 'You are no longer subscribed to updates on this forum.', + 'NOT_WATCHING_TOPIC' => 'You are no longer subscribed to this topic.', + 'NOTIFICATIONS' => 'Notifications', + // This applies for NOTIFICATION_BOOKMARK and NOTIFICATION_POST. + // %1$s will return a list of users that's concatenated using "," and "and" - see STRING_LIST + // Once the user count reaches 5 users or more, the list is trimmed using NOTIFICATION_X_OTHERS + // Once the user count reaches 20 users or more, the list is trimmed using NOTIFICATION_MANY_OTHERS + // Examples: + // A replied... + // A and B replied... + // A, B and C replied... + // A, B, C and 2 others replied... + // A, B, C and others replied... + 'NOTIFICATION_BOOKMARK' => array( + 1 => 'Reply from %1$s in bookmarked topic:', + ), + 'NOTIFICATION_FORUM' => 'Forum: %1$s', + 'NOTIFICATION_GROUP_REQUEST' => 'Group request from %1$s to join the group %2$s.', + 'NOTIFICATION_GROUP_REQUEST_APPROVED' => 'Group request approved to join the group %1$s.', + 'NOTIFICATION_METHOD_INVALID' => 'The method "%s" does not refer to a valid notification method.', + 'NOTIFICATION_PM' => 'Private Message from %1$s:', + 'NOTIFICATION_POST' => array( + 1 => 'Reply from %1$s in topic:', + ), + 'NOTIFICATION_POST_APPROVED' => 'Post approved:', + 'NOTIFICATION_POST_DISAPPROVED' => 'Post disapproved:', + 'NOTIFICATION_POST_IN_QUEUE' => 'Post approval request by %1$s:', + 'NOTIFICATION_QUOTE' => array( + 1 => 'Quoted by %1$s in:', + ), + 'NOTIFICATION_REFERENCE' => '"%1$s"', + 'NOTIFICATION_REASON' => 'Reason: %1$s.', + 'NOTIFICATION_REPORT_PM' => 'Private Message reported by %1$s:', + 'NOTIFICATION_REPORT_POST' => 'Post reported by %1$s:', + 'NOTIFICATION_REPORT_CLOSED' => 'Report closed by %1$s for:', + 'NOTIFICATION_TOPIC' => 'New topic by %1$s:', + 'NOTIFICATION_TOPIC_APPROVED' => 'Topic approved:', + 'NOTIFICATION_TOPIC_DISAPPROVED' => 'Topic disapproved:', + 'NOTIFICATION_TOPIC_IN_QUEUE' => 'Topic approval request by %1$s:', + 'NOTIFICATION_TYPE_NOT_EXIST' => 'The notification type "%s" is missing from the file system.', + 'NOTIFICATION_ADMIN_ACTIVATE_USER' => 'Activation required for deactivated or newly registered user: “%1$s”', + // Used in conjuction with NOTIFICATION_BOOKMARK and NOTIFICATION_POST. + 'NOTIFICATION_MANY_OTHERS' => 'others', + 'NOTIFICATION_X_OTHERS' => array( + 2 => '%d others', + ), + 'NOTIFY_ADMIN' => 'Please notify the board administrator or webmaster.', + 'NOTIFY_ADMIN_EMAIL' => 'Please notify the board administrator or webmaster: %1$s', + 'NO_ACCESS_ATTACHMENT' => 'You are not allowed to access this file.', + 'NO_ACTION' => 'No action specified.', + 'NO_ADMINISTRATORS' => 'There are no administrators.', + 'NO_AUTH_ADMIN' => 'Access to the Administration Control Panel is not allowed as you do not have administrative permissions.', + 'NO_AUTH_ADMIN_USER_DIFFER' => 'You are not able to re-authenticate as a different user.', + 'NO_AUTH_OPERATION' => 'You do not have the necessary permissions to complete this operation.', + 'NO_AVATARS' => 'No avatars currently available', + 'NO_CONNECT_TO_SMTP_HOST' => 'Could not connect to smtp host : %1$s : %2$s', + 'NO_BIRTHDAYS' => 'No birthdays today', + 'NO_EMAIL_MESSAGE' => 'Email message was blank.', + 'NO_EMAIL_RESPONSE_CODE' => 'Could not get mail server response codes.', + 'NO_EMAIL_SUBJECT' => 'No email subject specified.', + 'NO_FORUM' => 'The forum you selected does not exist.', + 'NO_FORUMS' => 'This board has no forums.', + 'NO_GROUP' => 'The requested usergroup does not exist.', + 'NO_GROUP_MEMBERS' => 'This group currently has no members.', + 'NO_IPS_DEFINED' => 'No IP addresses or hostnames defined', + 'NO_MEMBERS' => 'No members found for this search criterion.', + 'NO_MESSAGES' => 'No messages', + 'NO_MODE' => 'No mode specified.', + 'NO_MODERATORS' => 'There are no moderators.', + 'NO_NEW_MESSAGES' => 'No new messages', + 'NO_NEW_POSTS' => 'No new posts', // Not used anymore + 'NO_ONLINE_USERS' => 'No registered users', + 'NO_POSTS' => 'No posts', + 'NO_POSTS_TIME_FRAME' => 'No posts exist inside this topic for the selected time frame.', + 'NO_FEED_ENABLED' => 'Feeds are not available on this board.', + 'NO_FEED' => 'The requested feed is not available.', + 'NO_STYLE_DATA' => 'Could not get style data', + 'NO_SUBJECT' => 'No subject specified', // Used for posts having no subject defined but displayed within management pages. + 'NO_SUCH_SEARCH_MODULE' => 'The specified search backend doesn’t exist.', + 'NO_SUPPORTED_AUTH_METHODS' => 'No supported authentication methods.', + 'NO_TOPIC' => 'The requested topic does not exist.', + 'NO_TOPIC_FORUM' => 'The topic or forum no longer exists.', + 'NO_TOPICS' => 'There are no topics or posts in this forum.', + 'NO_TOPICS_TIME_FRAME' => 'No topics exist inside this forum for the selected time frame.', + 'NO_UNREAD_POSTS' => 'No unread posts', + 'NO_UPLOAD_FORM_FOUND' => 'Upload initiated but no valid file upload form found.', + 'NO_USER' => 'The requested user does not exist.', + 'NO_USERS' => 'The requested users do not exist.', + 'NO_USER_SPECIFIED' => 'No username was specified.', + + // Nullar/Singular/Plural language entry. The key numbers define the number range in which a certain grammatical expression is valid. + 'NUM_ATTACHMENTS' => array( + 1 => '%d attachment', + 2 => '%d attachments', + ), + 'NUM_POSTS_IN_QUEUE' => array( + 0 => 'No posts in queue', // 0 + 1 => '1 post in queue', // 1 + 2 => '%d posts in queue', // 2+ + ), + + 'OCCUPATION' => 'Occupation', + 'OFFLINE' => 'Offline', + 'ONLINE' => 'Online', + 'ONLINE_BUDDIES' => 'Online friends', + // "... :: x registered and y hidden" + 'ONLINE_USERS_TOTAL' => array( + 1 => 'In total there is %1$d user online :: %2$s and %3$s', + 2 => 'In total there are %1$d users online :: %2$s and %3$s', + ), + // "... :: x registered, y hidden and z guests" + 'ONLINE_USERS_TOTAL_GUESTS' => array( + 1 => 'In total there is %1$d user online :: %2$s, %3$s and %4$s', + 2 => 'In total there are %1$d users online :: %2$s, %3$s and %4$s', + ), + 'OPTIONS' => 'Options', + + 'PAGE_NOT_FOUND' => 'The requested page could not be found.', + 'PAGE_OF' => 'Page %1$d of %2$d', + 'PAGE_TITLE_NUMBER' => 'Page %s', + 'PASSWORD' => 'Password', + 'PIXEL' => 'px', + 'PIXELS' => array( + 1 => '%d pixel', + 2 => '%d pixels', + ), + 'PLEASE_WAIT' => 'Please wait.', + 'PM' => 'PM', + 'PM_REPORTED' => 'Click to view report', + 'POSTING_MESSAGE' => 'Posting message in %s', + 'POSTING_PRIVATE_MESSAGE' => 'Composing private message', + 'POST' => 'Post', + 'POST_ANNOUNCEMENT' => 'Announce', + 'POST_STICKY' => 'Sticky', + 'POSTED' => 'Posted', + 'POSTED_IN_FORUM' => 'in', + 'POSTED_ON_DATE' => 'on', + 'POSTS' => 'Posts', + 'POSTS_UNAPPROVED' => 'At least one post in this topic has not been approved.', + 'POSTS_UNAPPROVED_FORUM'=> 'At least one post in this forum has not been approved.', + 'POST_BY_AUTHOR' => 'by', + 'POST_BY_FOE' => '%1$s, who is currently on your ignore list, made this post.', + 'POST_DISPLAY' => '%1$sDisplay this post%2$s.', + 'POST_DAY' => '%.2f posts per day', + 'POST_DELETED_ACTION' => 'Deleted post:', + 'POST_DELETED' => 'This post has been deleted.', + 'POST_DELETED_BY' => '%2$s deleted the post by %1$s on %3$s.', + 'POST_DELETED_BY_REASON'=> '%2$s deleted the post by %1$s on %3$s for the following reason: %4$s', + 'POST_DETAILS' => 'Post details', + 'POST_NEW_TOPIC' => 'Post new topic', + 'POST_PCT' => '%.2f%% of all posts', + 'POST_PCT_ACTIVE' => '%.2f%% of user’s posts', + 'POST_PCT_ACTIVE_OWN' => '%.2f%% of your posts', + 'POST_REPLY' => 'Post a reply', + 'POST_REPORTED' => 'Click to view report', + 'POST_SUBJECT' => 'Post subject', + 'POST_TIME' => 'Post time', + 'POST_TOPIC' => 'Post a new topic', + 'POST_UNAPPROVED_ACTION' => 'Post awaiting approval:', + 'POST_UNAPPROVED' => 'This post has not been approved.', + 'POWERED_BY' => 'Powered by %s', + 'PREVIEW' => 'Preview', + 'PREVIOUS' => 'Previous', // Used in pagination + 'PREVIOUS_STEP' => 'Previous', + 'PRIVACY' => 'Privacy policy', + 'PRIVACY_LINK' => 'Privacy', + 'PRIVATE_MESSAGE' => 'Private message', + 'PRIVATE_MESSAGES' => 'Private messages', + 'PRIVATE_MESSAGING' => 'Private messaging', + 'PROFILE' => 'User Control Panel', + + 'QUICK_LINKS' => 'Quick links', + + 'RANK' => 'Rank', + 'READING_FORUM' => 'Viewing topics in %s', + 'READING_GLOBAL_ANNOUNCE' => 'Reading global announcement', + 'READING_LINK' => 'Following forum link %s', + 'READING_TOPIC' => 'Reading topic in %s', + 'READ_PROFILE' => 'Profile', + 'REASON' => 'Reason', + 'RECORD_ONLINE_USERS' => 'Most users ever online was %1$s on %2$s', + 'REDIRECT' => 'Redirect', + 'REDIRECTS' => 'Total redirects', + 'REGISTER' => 'Register', + 'REGISTERED_USERS' => 'Registered users:', + // "... and 2 hidden users online" + 'REG_USERS_ONLINE' => array( + 1 => 'There is %1$d registered user and %2$s online', + 2 => 'There are %1$d registered users and %2$s online', + ), + 'REG_USERS_TOTAL' => array( + 1 => '%d registered', + 2 => '%d registered', + ), + 'REMOVE' => 'Remove', + 'REMOVE_INSTALL' => 'Please delete, move or rename the install directory before you use your board. If this directory is still present, only the Administration Control Panel (ACP) will be accessible.', + 'REPLIES' => 'Replies', + 'REPLY_WITH_QUOTE' => 'Reply with quote', + 'REPLYING_GLOBAL_ANNOUNCE' => 'Replying to global announcement', + 'REPLYING_MESSAGE' => 'Replying to message in %s', + 'REPORT_BY' => 'Report by', + 'REPORT_POST' => 'Report this post', + 'REPORTING_POST' => 'Reporting post', + 'RESEND_ACTIVATION' => 'Resend activation email', + 'RESET' => 'Reset', + 'RESTORE_PERMISSIONS' => 'Restore permissions', + 'RETURN_INDEX' => '%sReturn to the index page%s', + 'RETURN_FORUM' => '%sReturn to the forum last visited%s', + 'RETURN_PAGE' => '%sReturn to the previous page%s', + 'RETURN_TOPIC' => '%sReturn to the topic last visited%s', + 'RETURN_TO' => 'Return to “%s”', + 'RETURN_TO_INDEX' => 'Return to Board Index', + 'FEED' => 'Feed', + 'FEED_NEWS' => 'News', + 'FEED_TOPICS_ACTIVE' => 'Active Topics', + 'FEED_TOPICS_NEW' => 'New Topics', + 'RULES_ATTACH_CAN' => 'You can post attachments in this forum', + 'RULES_ATTACH_CANNOT' => 'You cannot post attachments in this forum', + 'RULES_DELETE_CAN' => 'You can delete your posts in this forum', + 'RULES_DELETE_CANNOT' => 'You cannot delete your posts in this forum', + 'RULES_DOWNLOAD_CAN' => 'You can download attachments in this forum', + 'RULES_DOWNLOAD_CANNOT' => 'You cannot download attachments in this forum', + 'RULES_EDIT_CAN' => 'You can edit your posts in this forum', + 'RULES_EDIT_CANNOT' => 'You cannot edit your posts in this forum', + 'RULES_LOCK_CAN' => 'You can lock your topics in this forum', + 'RULES_LOCK_CANNOT' => 'You cannot lock your topics in this forum', + 'RULES_POST_CAN' => 'You can post new topics in this forum', + 'RULES_POST_CANNOT' => 'You cannot post new topics in this forum', + 'RULES_REPLY_CAN' => 'You can reply to topics in this forum', + 'RULES_REPLY_CANNOT' => 'You cannot reply to topics in this forum', + 'RULES_VOTE_CAN' => 'You can vote in polls in this forum', + 'RULES_VOTE_CANNOT' => 'You cannot vote in polls in this forum', + + 'SEARCH' => 'Search', + 'SEARCH_MINI' => 'Search…', + 'SEARCH_ADV' => 'Advanced search', + 'SEARCH_ADV_EXPLAIN' => 'View the advanced search options', + 'SEARCH_KEYWORDS' => 'Search for keywords', + 'SEARCHING_FORUMS' => 'Searching forums', + 'SEARCH_ACTIVE_TOPICS' => 'Active topics', + 'SEARCH_FOR' => 'Search for', + 'SEARCH_FORUM' => 'Search this forum…', + 'SEARCH_NEW' => 'New posts', + 'SEARCH_POSTS_BY' => 'Search posts by', + 'SEARCH_SELF' => 'Your posts', + 'SEARCH_TOPIC' => 'Search this topic…', + 'SEARCH_UNANSWERED' => 'Unanswered topics', + 'SEARCH_UNREAD' => 'Unread posts', + 'SEARCH_USER_POSTS' => 'Search user’s posts', + 'SECONDS' => 'Seconds', + 'SEE_ALL' => 'See All', + 'SELECT' => 'Select', + 'SELECT_ALL_CODE' => 'Select all', + 'SELECT_DESTINATION_FORUM' => 'Please select a destination forum', + 'SELECT_FORUM' => 'Select a forum', + 'SEND_EMAIL' => 'Send email', // Used for submit buttons + 'SEND_EMAIL_USER' => 'Send email to %s', + 'SEND_PRIVATE_MESSAGE' => 'Send private message', + 'SETTINGS' => 'Settings', + 'SIGNATURE' => 'Signature', + 'SKIP' => 'Skip to content', + 'SKYPE' => 'Skype', + 'SMTP_NO_AUTH_SUPPORT' => 'SMTP server does not support authentication.', + 'SORRY_AUTH_READ' => 'You are not authorised to read this forum.', + 'SORRY_AUTH_READ_TOPIC' => 'You are not authorised to read this topic.', + 'SORRY_AUTH_VIEW_ATTACH' => 'You are not authorised to download this attachment.', + 'SORT_BY' => 'Sort by', + 'SORT_DIRECTION' => 'Direction', + 'SORT_JOINED' => 'Joined date', + 'SORT_LOCATION' => 'Location', + 'SORT_OPTIONS' => 'Display and sorting options', + 'SORT_RANK' => 'Rank', + 'SORT_POSTS' => 'Posts', + 'SORT_TOPIC_TITLE' => 'Topic title', + 'SORT_USERNAME' => 'Username', + 'SPLIT_TOPIC' => 'Split topic', + 'SQL_ERROR_OCCURRED' => 'An SQL error occurred while fetching this page. Please contact the %sBoard Administrator%s if this problem persists.', + 'STATISTICS' => 'Statistics', + 'START_WATCHING_FORUM' => 'Subscribe forum', + 'START_WATCHING_TOPIC' => 'Subscribe topic', + 'STOP_WATCHING_FORUM' => 'Unsubscribe forum', + 'STOP_WATCHING_TOPIC' => 'Unsubscribe topic', + 'STRING_LIST_MULTI' => '%1$s, and %2$s', + 'STRING_LIST_SIMPLE' => '%1$s and %2$s', + 'SUBFORUM' => 'Subforum', + 'SUBFORUMS' => 'Subforums', + 'SUBJECT' => 'Subject', + 'SUBMIT' => 'Submit', + + 'TB' => 'TB', + 'TERMS_LINK' => 'Terms', + 'TERMS_USE' => 'Terms of use', + 'TEST_CONNECTION' => 'Test connection', + 'THE_TEAM' => 'The team', + 'TIB' => 'TiB', + 'TIME' => 'Time', + 'TIMEOUT_PROCESSING_REQ' => 'Request timed out.', + + 'TOO_LARGE' => 'The value you entered is too large.', + 'TOO_LARGE_MAX_RECIPIENTS' => 'The value of Maximum number of allowed recipients per private message setting you entered is too large.', + + 'TOO_LONG' => 'The value you entered is too long.', + + 'TOO_LONG_CONFIRM_CODE' => 'The confirm code you entered is too long.', + 'TOO_LONG_DATEFORMAT' => 'The date format you entered is too long.', + 'TOO_LONG_JABBER' => 'The Jabber account name you entered is too long.', + 'TOO_LONG_NEW_PASSWORD' => 'The password you entered is too long.', + 'TOO_LONG_PASSWORD_CONFIRM' => 'The password confirmation you entered is too long.', + 'TOO_LONG_USER_PASSWORD' => 'The password you entered is too long.', + 'TOO_LONG_USERNAME' => 'The username you entered is too long.', + 'TOO_LONG_EMAIL' => 'The email address you entered is too long.', + + 'TOO_MANY_VOTE_OPTIONS' => 'You have tried to vote for too many options.', + + 'TOO_SHORT' => 'The value you entered is too short.', + + 'TOO_SHORT_CONFIRM_CODE' => 'The confirm code you entered is too short.', + 'TOO_SHORT_DATEFORMAT' => 'The date format you entered is too short.', + 'TOO_SHORT_JABBER' => 'The Jabber account name you entered is too short.', + 'TOO_SHORT_NEW_PASSWORD' => 'The password you entered is too short.', + 'TOO_SHORT_PASSWORD_CONFIRM' => 'The password confirmation you entered is too short.', + 'TOO_SHORT_USER_PASSWORD' => 'The password you entered is too short.', + 'TOO_SHORT_USERNAME' => 'The username you entered is too short.', + 'TOO_SHORT_EMAIL' => 'The email address you entered is too short.', + 'TOO_SHORT_EMAIL_CONFIRM' => 'The email address confirmation you entered is too short.', + 'TOO_SMALL' => 'The value you entered is too small.', + 'TOO_SMALL_MAX_RECIPIENTS' => 'The value of Maximum number of allowed recipients per private message setting you entered is too small.', + + 'TOPIC' => 'Topic', + 'TOPICS' => 'Topics', + 'TOPICS_UNAPPROVED' => 'At least one topic in this forum has not been approved.', + 'TOPIC_ICON' => 'Topic icon', + 'TOPIC_LOCKED' => 'This topic is locked, you cannot edit posts or make further replies.', + 'TOPIC_LOCKED_SHORT'=> 'Topic locked', + 'TOPIC_MOVED' => 'Moved topic', + 'TOPIC_REVIEW' => 'Topic review', + 'TOPIC_TITLE' => 'Topic title', + 'TOPIC_UNAPPROVED' => 'This topic has not been approved.', + 'TOPIC_UNAPPROVED_FORUM' => array( + 1 => 'Topic awaiting approval', + 2 => 'Topics awaiting approval', + ), + 'TOPIC_DELETED' => 'This topic has been deleted.', + 'TOTAL_ATTACHMENTS' => 'Attachment(s)', + 'TOTAL_LOGS' => array( + 1 => '%d log', + 2 => '%d logs', + ), + 'TOTAL_PMS' => array( + 1 => '%d private message in total', + 2 => '%d private messages in total', + ), + 'TOPIC_POLL' => 'This topic has a poll.', + 'TOTAL_POSTS' => 'Total posts', + 'TOTAL_POSTS_COUNT' => array( + 2 => 'Total posts %d', + ), + 'TOPIC_REPORTED' => 'This topic has been reported', + 'TOTAL_TOPICS' => array( + 2 => 'Total topics %d', + ), + 'TOTAL_USERS' => array( + 2 => 'Total members %d', + ), + 'TRACKED_PHP_ERROR' => 'Tracked PHP errors: %s', + 'TWITTER' => 'Twitter', + + 'UNABLE_GET_IMAGE_SIZE' => 'It was not possible to determine the dimensions of the image. Please verify that the URL you entered is correct.', + 'UNABLE_TO_DELIVER_FILE'=> 'Unable to deliver file.', + 'UNKNOWN_BROWSER' => 'Unknown browser', + 'UNMARK_ALL' => 'Unmark all', + 'UNREAD_MESSAGES' => 'Unread messages', + 'UNREAD_POST' => 'Unread post', + 'UNREAD_POSTS' => 'Unread posts', + 'UNWATCH_FORUM_CONFIRM' => 'Are you sure you wish to unsubscribe from this forum?', + 'UNWATCH_FORUM_DETAILED' => 'Are you sure you wish to unsubscribe from the forum “%s”?', + 'UNWATCH_TOPIC_CONFIRM' => 'Are you sure you wish to unsubscribe from this topic?', + 'UNWATCH_TOPIC_DETAILED' => 'Are you sure you wish to unsubscribe from the topic “%s”?', + 'UNWATCHED_FORUMS' => 'You are no longer subscribed to the selected forums.', + 'UNWATCHED_TOPICS' => 'You are no longer subscribed to the selected topics.', + 'UNWATCHED_FORUMS_TOPICS' => 'You are no longer subscribed to the selected entries.', + 'UPDATE' => 'Update', + 'UPLOAD_IN_PROGRESS' => 'The upload is currently in progress.', + 'URL_REDIRECT' => 'If your browser does not support meta redirection %splease click HERE to be redirected%s.', + 'USERGROUPS' => 'Groups', + 'USERNAME' => 'Username', + 'USERNAMES' => 'Usernames', + 'USER_AVATAR' => 'User avatar', + 'USER_CANNOT_READ' => 'You cannot read posts in this forum.', + 'USER_POSTS' => array( + 1 => '%d Post', + 2 => '%d Posts', + ), + 'USERS' => 'Users', + 'USE_PERMISSIONS' => 'Test out user’s permissions', + + 'USER_NEW_PERMISSION_DISALLOWED' => 'We are sorry, but you are not authorised to use this feature. You may have just registered here and may need to participate more in discussions to be able to use this feature.', + + 'VARIANT_DATE_SEPARATOR' => ' / ', // Used in date format dropdown, eg: "Today, 13:37 / 01 Jan 2007, 13:37" ... to join a relative date with calendar date + 'VIEWED' => 'Viewed', + 'VIEWED_COUNTS' => array( + 0 => 'Not viewed yet', + 1 => 'Viewed %d time', + 2 => 'Viewed %d times', + ), + 'VIEWING_CONTACT_ADMIN' => 'Viewing contact page', + 'VIEWING_FAQ' => 'Viewing FAQ', + 'VIEWING_MEMBERS' => 'Viewing member details', + 'VIEWING_ONLINE' => 'Viewing who is online', + 'VIEWING_MCP' => 'Viewing moderator control panel', + 'VIEWING_MEMBER_PROFILE' => 'Viewing member profile', + 'VIEWING_PRIVATE_MESSAGES' => 'Viewing private messages', + 'VIEWING_REGISTER' => 'Registering account', + 'VIEWING_UCP' => 'Viewing user control panel', + 'VIEWS' => 'Views', + 'VIEW_BOOKMARKS' => 'View bookmarks', + 'VIEW_FORUM_LOGS' => 'View Logs', + 'VIEW_LATEST_POST' => 'View the latest post', + 'VIEW_NEWEST_POST' => 'View first unread post', + 'VIEW_NOTES' => 'View user notes', + 'VIEW_ONLINE_TIMES' => array( + 1 => 'based on users active over the past %d minute', + 2 => 'based on users active over the past %d minutes', + ), + 'VIEW_TOPIC' => 'View topic', + 'VIEW_TOPIC_ANNOUNCEMENT' => 'Announcement: ', + 'VIEW_TOPIC_GLOBAL' => 'Global Announcement: ', + 'VIEW_TOPIC_LOCKED' => 'Locked: ', + 'VIEW_TOPIC_LOGS' => 'View logs', + 'VIEW_TOPIC_MOVED' => 'Moved: ', + 'VIEW_TOPIC_POLL' => 'Poll: ', + 'VIEW_TOPIC_STICKY' => 'Sticky: ', + 'VISIT_WEBSITE' => 'Visit website', + + 'WARNINGS' => 'Warnings', + 'WARN_USER' => 'Warn user', + 'WATCH_FORUM_CONFIRM' => 'Are you sure you wish to subscribe to this forum?', + 'WATCH_FORUM_DETAILED' => 'Are you sure you wish to subscribe to the forum “%s”?', + 'WATCH_TOPIC_CONFIRM' => 'Are you sure you wish to subscribe to this topic?', + 'WATCH_TOPIC_DETAILED' => 'Are you sure you wish to subscribe to the topic “%s”?', + 'WELCOME_SUBJECT' => 'Welcome to %s forums', + 'WEBSITE' => 'Website', + 'WHOIS' => 'Whois', + 'WHO_IS_ONLINE' => 'Who is online', + 'WRONG_PASSWORD' => 'You entered an incorrect password.', + + 'WRONG_DATA_COLOUR' => 'The colour value you entered is invalid.', + 'WRONG_DATA_JABBER' => 'The name you entered is not a valid Jabber account name.', + 'WRONG_DATA_LANG' => 'The language you specified is not valid.', + 'WRONG_DATA_POST_SD' => 'The post sort direction you specified is not valid.', + 'WRONG_DATA_POST_SK' => 'The post sort option you specified is not valid.', + 'WRONG_DATA_TOPIC_SD' => 'The topic sort direction you specified is not valid.', + 'WRONG_DATA_TOPIC_SK' => 'The topic sort option you specified is not valid.', + 'WROTE' => 'wrote', + + 'YAHOO' => 'Yahoo Messenger', + 'YOUTUBE' => 'YouTube', + 'YEAR' => 'Year', + 'YEAR_MONTH_DAY' => '(YYYY-MM-DD)', + 'YES' => 'Yes', + 'YOU_LAST_VISIT' => 'Last visit was: %s', + + 'datetime' => array( + 'TODAY' => 'Today', + 'TOMORROW' => 'Tomorrow', + 'YESTERDAY' => 'Yesterday', + 'AGO' => array( + 0 => 'less than a minute ago', + 1 => '%d minute ago', + 2 => '%d minutes ago', + ), + + 'Sunday' => 'Sunday', + 'Monday' => 'Monday', + 'Tuesday' => 'Tuesday', + 'Wednesday' => 'Wednesday', + 'Thursday' => 'Thursday', + 'Friday' => 'Friday', + 'Saturday' => 'Saturday', + + 'Sun' => 'Sun', + 'Mon' => 'Mon', + 'Tue' => 'Tue', + 'Wed' => 'Wed', + 'Thu' => 'Thu', + 'Fri' => 'Fri', + 'Sat' => 'Sat', + + 'January' => 'January', + 'February' => 'February', + 'March' => 'March', + 'April' => 'April', + 'May' => 'May', + 'June' => 'June', + 'July' => 'July', + 'August' => 'August', + 'September' => 'September', + 'October' => 'October', + 'November' => 'November', + 'December' => 'December', + + 'Jan' => 'Jan', + 'Feb' => 'Feb', + 'Mar' => 'Mar', + 'Apr' => 'Apr', + 'May_short' => 'May', // Short representation of "May". May_short used because in English the short and long date are the same for May. + 'Jun' => 'Jun', + 'Jul' => 'Jul', + 'Aug' => 'Aug', + 'Sep' => 'Sep', + 'Oct' => 'Oct', + 'Nov' => 'Nov', + 'Dec' => 'Dec', + ), + + // Timezones can be translated. We use this for the Etc/GMT timezones here, + // because they are named invers to their offset. + 'timezones' => array( + 'UTC' => 'UTC', + 'UTC_OFFSET' => 'UTC%1$s', + 'UTC_OFFSET_CURRENT' => 'UTC%1$s - %2$s', + + 'Etc/GMT-12' => 'UTC+12', + 'Etc/GMT-11' => 'UTC+11', + 'Etc/GMT-10' => 'UTC+10', + 'Etc/GMT-9' => 'UTC+9', + 'Etc/GMT-8' => 'UTC+8', + 'Etc/GMT-7' => 'UTC+7', + 'Etc/GMT-6' => 'UTC+6', + 'Etc/GMT-5' => 'UTC+5', + 'Etc/GMT-4' => 'UTC+4', + 'Etc/GMT-3' => 'UTC+3', + 'Etc/GMT-2' => 'UTC+2', + 'Etc/GMT-1' => 'UTC+1', + 'Etc/GMT+1' => 'UTC-1', + 'Etc/GMT+2' => 'UTC-2', + 'Etc/GMT+3' => 'UTC-3', + 'Etc/GMT+4' => 'UTC-4', + 'Etc/GMT+5' => 'UTC-5', + 'Etc/GMT+6' => 'UTC-6', + 'Etc/GMT+7' => 'UTC-7', + 'Etc/GMT+8' => 'UTC-8', + 'Etc/GMT+9' => 'UTC-9', + 'Etc/GMT+10' => 'UTC-10', + 'Etc/GMT+11' => 'UTC-11', + 'Etc/GMT+12' => 'UTC-12', + + 'Africa/Abidjan' => 'Africa/Abidjan', + 'Africa/Accra' => 'Africa/Accra', + 'Africa/Addis_Ababa' => 'Africa/Addis Ababa', + 'Africa/Algiers' => 'Africa/Algiers', + 'Africa/Asmara' => 'Africa/Asmara', + 'Africa/Bamako' => 'Africa/Bamako', + 'Africa/Bangui' => 'Africa/Bangui', + 'Africa/Banjul' => 'Africa/Banjul', + 'Africa/Bissau' => 'Africa/Bissau', + 'Africa/Blantyre' => 'Africa/Blantyre', + 'Africa/Brazzaville' => 'Africa/Brazzaville', + 'Africa/Bujumbura' => 'Africa/Bujumbura', + 'Africa/Cairo' => 'Africa/Cairo', + 'Africa/Casablanca' => 'Africa/Casablanca', + 'Africa/Ceuta' => 'Africa/Ceuta', + 'Africa/Conakry' => 'Africa/Conakry', + 'Africa/Dakar' => 'Africa/Dakar', + 'Africa/Dar_es_Salaam' => 'Africa/Dar es Salaam', + 'Africa/Djibouti' => 'Africa/Djibouti', + 'Africa/Douala' => 'Africa/Douala', + 'Africa/El_Aaiun' => 'Africa/El Aaiun', + 'Africa/Freetown' => 'Africa/Freetown', + 'Africa/Gaborone' => 'Africa/Gaborone', + 'Africa/Harare' => 'Africa/Harare', + 'Africa/Johannesburg' => 'Africa/Johannesburg', + 'Africa/Juba' => 'Africa/Juba', + 'Africa/Kampala' => 'Africa/Kampala', + 'Africa/Khartoum' => 'Africa/Khartoum', + 'Africa/Kigali' => 'Africa/Kigali', + 'Africa/Kinshasa' => 'Africa/Kinshasa', + 'Africa/Lagos' => 'Africa/Lagos', + 'Africa/Libreville' => 'Africa/Libreville', + 'Africa/Lome' => 'Africa/Lome', + 'Africa/Luanda' => 'Africa/Luanda', + 'Africa/Lubumbashi' => 'Africa/Lubumbashi', + 'Africa/Lusaka' => 'Africa/Lusaka', + 'Africa/Malabo' => 'Africa/Malabo', + 'Africa/Maputo' => 'Africa/Maputo', + 'Africa/Maseru' => 'Africa/Maseru', + 'Africa/Mbabane' => 'Africa/Mbabane', + 'Africa/Mogadishu' => 'Africa/Mogadishu', + 'Africa/Monrovia' => 'Africa/Monrovia', + 'Africa/Nairobi' => 'Africa/Nairobi', + 'Africa/Ndjamena' => 'Africa/Ndjamena', + 'Africa/Niamey' => 'Africa/Niamey', + 'Africa/Nouakchott' => 'Africa/Nouakchott', + 'Africa/Ouagadougou' => 'Africa/Ouagadougou', + 'Africa/Porto-Novo' => 'Africa/Porto-Novo', + 'Africa/Sao_Tome' => 'Africa/Sao Tome', + 'Africa/Tripoli' => 'Africa/Tripoli', + 'Africa/Tunis' => 'Africa/Tunis', + 'Africa/Windhoek' => 'Africa/Windhoek', + + 'America/Adak' => 'America/Adak', + 'America/Anchorage' => 'America/Anchorage', + 'America/Anguilla' => 'America/Anguilla', + 'America/Antigua' => 'America/Antigua', + 'America/Araguaina' => 'America/Araguaina', + + 'America/Argentina/Buenos_Aires' => 'America/Argentina/Buenos Aires', + 'America/Argentina/Catamarca' => 'America/Argentina/Catamarca', + 'America/Argentina/Cordoba' => 'America/Argentina/Cordoba', + 'America/Argentina/Jujuy' => 'America/Argentina/Jujuy', + 'America/Argentina/La_Rioja' => 'America/Argentina/La Rioja', + 'America/Argentina/Mendoza' => 'America/Argentina/Mendoza', + 'America/Argentina/Rio_Gallegos' => 'America/Argentina/Rio Gallegos', + 'America/Argentina/Salta' => 'America/Argentina/Salta', + 'America/Argentina/San_Juan' => 'America/Argentina/San Juan', + 'America/Argentina/San_Luis' => 'America/Argentina/San Luis', + 'America/Argentina/Tucuman' => 'America/Argentina/Tucuman', + 'America/Argentina/Ushuaia' => 'America/Argentina/Ushuaia', + + 'America/Aruba' => 'America/Aruba', + 'America/Asuncion' => 'America/Asuncion', + 'America/Atikokan' => 'America/Atikokan', + 'America/Bahia' => 'America/Bahia', + 'America/Bahia_Banderas' => 'America/Bahia Banderas', + 'America/Barbados' => 'America/Barbados', + 'America/Belem' => 'America/Belem', + 'America/Belize' => 'America/Belize', + 'America/Blanc-Sablon' => 'America/Blanc-Sablon', + 'America/Boa_Vista' => 'America/Boa Vista', + 'America/Bogota' => 'America/Bogota', + 'America/Boise' => 'America/Boise', + 'America/Cambridge_Bay' => 'America/Cambridge Bay', + 'America/Campo_Grande' => 'America/Campo Grande', + 'America/Cancun' => 'America/Cancun', + 'America/Caracas' => 'America/Caracas', + 'America/Cayenne' => 'America/Cayenne', + 'America/Cayman' => 'America/Cayman', + 'America/Chicago' => 'America/Chicago', + 'America/Chihuahua' => 'America/Chihuahua', + 'America/Costa_Rica' => 'America/Costa Rica', + 'America/Creston' => 'America/Creston', + 'America/Cuiaba' => 'America/Cuiaba', + 'America/Curacao' => 'America/Curacao', + 'America/Danmarkshavn' => 'America/Danmarkshavn', + 'America/Dawson' => 'America/Dawson', + 'America/Dawson_Creek' => 'America/Dawson Creek', + 'America/Denver' => 'America/Denver', + 'America/Detroit' => 'America/Detroit', + 'America/Dominica' => 'America/Dominica', + 'America/Edmonton' => 'America/Edmonton', + 'America/Eirunepe' => 'America/Eirunepe', + 'America/El_Salvador' => 'America/El Salvador', + 'America/Fortaleza' => 'America/Fortaleza', + 'America/Glace_Bay' => 'America/Glace Bay', + 'America/Godthab' => 'America/Godthab', + 'America/Goose_Bay' => 'America/Goose Bay', + 'America/Grand_Turk' => 'America/Grand Turk', + 'America/Grenada' => 'America/Grenada', + 'America/Guadeloupe' => 'America/Guadeloupe', + 'America/Guatemala' => 'America/Guatemala', + 'America/Guayaquil' => 'America/Guayaquil', + 'America/Guyana' => 'America/Guyana', + 'America/Halifax' => 'America/Halifax', + 'America/Havana' => 'America/Havana', + 'America/Hermosillo' => 'America/Hermosillo', + 'America/Indiana/Indianapolis' => 'America/Indiana/Indianapolis', + 'America/Indiana/Knox' => 'America/Indiana/Knox', + 'America/Indiana/Marengo' => 'America/Indiana/Marengo', + 'America/Indiana/Petersburg' => 'America/Indiana/Petersburg', + 'America/Indiana/Tell_City' => 'America/Indiana/Tell City', + 'America/Indiana/Vevay' => 'America/Indiana/Vevay', + 'America/Indiana/Vincennes' => 'America/Indiana/Vincennes', + 'America/Indiana/Winamac' => 'America/Indiana/Winamac', + 'America/Inuvik' => 'America/Inuvik', + 'America/Iqaluit' => 'America/Iqaluit', + 'America/Jamaica' => 'America/Jamaica', + 'America/Juneau' => 'America/Juneau', + 'America/Kentucky/Louisville' => 'America/Kentucky/Louisville', + 'America/Kentucky/Monticello' => 'America/Kentucky/Monticello', + 'America/Kralendijk' => 'America/Kralendijk', + 'America/La_Paz' => 'America/La Paz', + 'America/Lima' => 'America/Lima', + 'America/Los_Angeles' => 'America/Los Angeles', + 'America/Lower_Princes' => 'America/Lower Princes', + 'America/Maceio' => 'America/Maceio', + 'America/Managua' => 'America/Managua', + 'America/Manaus' => 'America/Manaus', + 'America/Marigot' => 'America/Marigot', + 'America/Martinique' => 'America/Martinique', + 'America/Matamoros' => 'America/Matamoros', + 'America/Mazatlan' => 'America/Mazatlan', + 'America/Menominee' => 'America/Menominee', + 'America/Merida' => 'America/Merida', + 'America/Metlakatla' => 'America/Metlakatla', + 'America/Mexico_City' => 'America/Mexico City', + 'America/Miquelon' => 'America/Miquelon', + 'America/Moncton' => 'America/Moncton', + 'America/Monterrey' => 'America/Monterrey', + 'America/Montevideo' => 'America/Montevideo', + 'America/Montreal' => 'America/Montreal', + 'America/Montserrat' => 'America/Montserrat', + 'America/Nassau' => 'America/Nassau', + 'America/New_York' => 'America/New York', + 'America/Nipigon' => 'America/Nipigon', + 'America/Nome' => 'America/Nome', + 'America/Noronha' => 'America/Noronha', + 'America/North_Dakota/Beulah' => 'America/North Dakota/Beulah', + 'America/North_Dakota/Center' => 'America/North Dakota/Center', + 'America/North_Dakota/New_Salem' => 'America/North Dakota/New Salem', + 'America/Ojinaga' => 'America/Ojinaga', + 'America/Panama' => 'America/Panama', + 'America/Pangnirtung' => 'America/Pangnirtung', + 'America/Paramaribo' => 'America/Paramaribo', + 'America/Phoenix' => 'America/Phoenix', + 'America/Port-au-Prince' => 'America/Port-au-Prince', + 'America/Port_of_Spain' => 'America/Port of Spain', + 'America/Porto_Velho' => 'America/Porto Velho', + 'America/Puerto_Rico' => 'America/Puerto Rico', + 'America/Rainy_River' => 'America/Rainy River', + 'America/Rankin_Inlet' => 'America/Rankin Inlet', + 'America/Recife' => 'America/Recife', + 'America/Regina' => 'America/Regina', + 'America/Resolute' => 'America/Resolute', + 'America/Rio_Branco' => 'America/Rio Branco', + 'America/Santa_Isabel' => 'America/Santa Isabel', + 'America/Santarem' => 'America/Santarem', + 'America/Santiago' => 'America/Santiago', + 'America/Santo_Domingo' => 'America/Santo Domingo', + 'America/Sao_Paulo' => 'America/Sao Paulo', + 'America/Scoresbysund' => 'America/Scoresbysund', + 'America/Shiprock' => 'America/Shiprock', + 'America/Sitka' => 'America/Sitka', + 'America/St_Barthelemy' => 'America/St. Barthelemy', + 'America/St_Johns' => 'America/St. Johns', + 'America/St_Kitts' => 'America/St. Kitts', + 'America/St_Lucia' => 'America/St. Lucia', + 'America/St_Thomas' => 'America/St. Thomas', + 'America/St_Vincent' => 'America/St. Vincent', + 'America/Swift_Current' => 'America/Swift Current', + 'America/Tegucigalpa' => 'America/Tegucigalpa', + 'America/Thule' => 'America/Thule', + 'America/Thunder_Bay' => 'America/Thunder Bay', + 'America/Tijuana' => 'America/Tijuana', + 'America/Toronto' => 'America/Toronto', + 'America/Tortola' => 'America/Tortola', + 'America/Vancouver' => 'America/Vancouver', + 'America/Whitehorse' => 'America/Whitehorse', + 'America/Winnipeg' => 'America/Winnipeg', + 'America/Yakutat' => 'America/Yakutat', + 'America/Yellowknife' => 'America/Yellowknife', + + 'Antarctica/Casey' => 'Antarctica/Casey', + 'Antarctica/Davis' => 'Antarctica/Davis', + 'Antarctica/DumontDUrville' => 'Antarctica/DumontDUrville', + 'Antarctica/Macquarie' => 'Antarctica/Macquarie', + 'Antarctica/Mawson' => 'Antarctica/Mawson', + 'Antarctica/McMurdo' => 'Antarctica/McMurdo', + 'Antarctica/Palmer' => 'Antarctica/Palmer', + 'Antarctica/Rothera' => 'Antarctica/Rothera', + 'Antarctica/South_Pole' => 'Antarctica/South Pole', + 'Antarctica/Syowa' => 'Antarctica/Syowa', + 'Antarctica/Vostok' => 'Antarctica/Vostok', + + 'Arctic/Longyearbyen' => 'Arctic/Longyearbyen', + + 'Asia/Aden' => 'Asia/Aden', + 'Asia/Almaty' => 'Asia/Almaty', + 'Asia/Amman' => 'Asia/Amman', + 'Asia/Anadyr' => 'Asia/Anadyr', + 'Asia/Aqtau' => 'Asia/Aqtau', + 'Asia/Aqtobe' => 'Asia/Aqtobe', + 'Asia/Ashgabat' => 'Asia/Ashgabat', + 'Asia/Baghdad' => 'Asia/Baghdad', + 'Asia/Bahrain' => 'Asia/Bahrain', + 'Asia/Baku' => 'Asia/Baku', + 'Asia/Bangkok' => 'Asia/Bangkok', + 'Asia/Beirut' => 'Asia/Beirut', + 'Asia/Bishkek' => 'Asia/Bishkek', + 'Asia/Brunei' => 'Asia/Brunei', + 'Asia/Choibalsan' => 'Asia/Choibalsan', + 'Asia/Chongqing' => 'Asia/Chongqing', + 'Asia/Colombo' => 'Asia/Colombo', + 'Asia/Damascus' => 'Asia/Damascus', + 'Asia/Dhaka' => 'Asia/Dhaka', + 'Asia/Dili' => 'Asia/Dili', + 'Asia/Dubai' => 'Asia/Dubai', + 'Asia/Dushanbe' => 'Asia/Dushanbe', + 'Asia/Gaza' => 'Asia/Gaza', + 'Asia/Harbin' => 'Asia/Harbin', + 'Asia/Hebron' => 'Asia/Hebron', + 'Asia/Ho_Chi_Minh' => 'Asia/Ho Chi Minh', + 'Asia/Hong_Kong' => 'Asia/Hong Kong', + 'Asia/Hovd' => 'Asia/Hovd', + 'Asia/Irkutsk' => 'Asia/Irkutsk', + 'Asia/Jakarta' => 'Asia/Jakarta', + 'Asia/Jayapura' => 'Asia/Jayapura', + 'Asia/Jerusalem' => 'Asia/Jerusalem', + 'Asia/Kabul' => 'Asia/Kabul', + 'Asia/Kamchatka' => 'Asia/Kamchatka', + 'Asia/Karachi' => 'Asia/Karachi', + 'Asia/Kashgar' => 'Asia/Kashgar', + 'Asia/Kathmandu' => 'Asia/Kathmandu', + 'Asia/Khandyga' => 'Asia/Khandyga', + 'Asia/Kolkata' => 'Asia/Kolkata', + 'Asia/Krasnoyarsk' => 'Asia/Krasnoyarsk', + 'Asia/Kuala_Lumpur' => 'Asia/Kuala Lumpur', + 'Asia/Kuching' => 'Asia/Kuching', + 'Asia/Kuwait' => 'Asia/Kuwait', + 'Asia/Macau' => 'Asia/Macau', + 'Asia/Magadan' => 'Asia/Magadan', + 'Asia/Makassar' => 'Asia/Makassar', + 'Asia/Manila' => 'Asia/Manila', + 'Asia/Muscat' => 'Asia/Muscat', + 'Asia/Nicosia' => 'Asia/Nicosia', + 'Asia/Novokuznetsk' => 'Asia/Novokuznetsk', + 'Asia/Novosibirsk' => 'Asia/Novosibirsk', + 'Asia/Omsk' => 'Asia/Omsk', + 'Asia/Oral' => 'Asia/Oral', + 'Asia/Phnom_Penh' => 'Asia/Phnom Penh', + 'Asia/Pontianak' => 'Asia/Pontianak', + 'Asia/Pyongyang' => 'Asia/Pyongyang', + 'Asia/Qatar' => 'Asia/Qatar', + 'Asia/Qyzylorda' => 'Asia/Qyzylorda', + 'Asia/Rangoon' => 'Asia/Rangoon', + 'Asia/Riyadh' => 'Asia/Riyadh', + 'Asia/Sakhalin' => 'Asia/Sakhalin', + 'Asia/Samarkand' => 'Asia/Samarkand', + 'Asia/Seoul' => 'Asia/Seoul', + 'Asia/Shanghai' => 'Asia/Shanghai', + 'Asia/Singapore' => 'Asia/Singapore', + 'Asia/Taipei' => 'Asia/Taipei', + 'Asia/Tashkent' => 'Asia/Tashkent', + 'Asia/Tbilisi' => 'Asia/Tbilisi', + 'Asia/Tehran' => 'Asia/Tehran', + 'Asia/Thimphu' => 'Asia/Thimphu', + 'Asia/Tokyo' => 'Asia/Tokyo', + 'Asia/Ulaanbaatar' => 'Asia/Ulaanbaatar', + 'Asia/Urumqi' => 'Asia/Urumqi', + 'Asia/Ust-Nera' => 'Asia/Ust-Nera', + 'Asia/Vientiane' => 'Asia/Vientiane', + 'Asia/Vladivostok' => 'Asia/Vladivostok', + 'Asia/Yakutsk' => 'Asia/Yakutsk', + 'Asia/Yekaterinburg' => 'Asia/Yekaterinburg', + 'Asia/Yerevan' => 'Asia/Yerevan', + + 'Atlantic/Azores' => 'Atlantic/Azores', + 'Atlantic/Bermuda' => 'Atlantic/Bermuda', + 'Atlantic/Canary' => 'Atlantic/Canary', + 'Atlantic/Cape_Verde' => 'Atlantic/Cape Verde', + 'Atlantic/Faroe' => 'Atlantic/Faroe', + 'Atlantic/Madeira' => 'Atlantic/Madeira', + 'Atlantic/Reykjavik' => 'Atlantic/Reykjavik', + 'Atlantic/South_Georgia' => 'Atlantic/South Georgia', + 'Atlantic/St_Helena' => 'Atlantic/St. Helena', + 'Atlantic/Stanley' => 'Atlantic/Stanley', + + 'Australia/Adelaide' => 'Australia/Adelaide', + 'Australia/Brisbane' => 'Australia/Brisbane', + 'Australia/Broken_Hill' => 'Australia/Broken Hill', + 'Australia/Currie' => 'Australia/Currie', + 'Australia/Darwin' => 'Australia/Darwin', + 'Australia/Eucla' => 'Australia/Eucla', + 'Australia/Hobart' => 'Australia/Hobart', + 'Australia/Lindeman' => 'Australia/Lindeman', + 'Australia/Lord_Howe' => 'Australia/Lord Howe', + 'Australia/Melbourne' => 'Australia/Melbourne', + 'Australia/Perth' => 'Australia/Perth', + 'Australia/Sydney' => 'Australia/Sydney', + + 'Europe/Amsterdam' => 'Europe/Amsterdam', + 'Europe/Andorra' => 'Europe/Andorra', + 'Europe/Athens' => 'Europe/Athens', + 'Europe/Belgrade' => 'Europe/Belgrade', + 'Europe/Berlin' => 'Europe/Berlin', + 'Europe/Bratislava' => 'Europe/Bratislava', + 'Europe/Brussels' => 'Europe/Brussels', + 'Europe/Bucharest' => 'Europe/Bucharest', + 'Europe/Budapest' => 'Europe/Budapest', + 'Europe/Busingen' => 'Europe/Busingen', + 'Europe/Chisinau' => 'Europe/Chisinau', + 'Europe/Copenhagen' => 'Europe/Copenhagen', + 'Europe/Dublin' => 'Europe/Dublin', + 'Europe/Gibraltar' => 'Europe/Gibraltar', + 'Europe/Guernsey' => 'Europe/Guernsey', + 'Europe/Helsinki' => 'Europe/Helsinki', + 'Europe/Isle_of_Man' => 'Europe/Isle of Man', + 'Europe/Istanbul' => 'Europe/Istanbul', + 'Europe/Jersey' => 'Europe/Jersey', + 'Europe/Kaliningrad' => 'Europe/Kaliningrad', + 'Europe/Kiev' => 'Europe/Kiev', + 'Europe/Lisbon' => 'Europe/Lisbon', + 'Europe/Ljubljana' => 'Europe/Ljubljana', + 'Europe/London' => 'Europe/London', + 'Europe/Luxembourg' => 'Europe/Luxembourg', + 'Europe/Madrid' => 'Europe/Madrid', + 'Europe/Malta' => 'Europe/Malta', + 'Europe/Mariehamn' => 'Europe/Mariehamn', + 'Europe/Minsk' => 'Europe/Minsk', + 'Europe/Monaco' => 'Europe/Monaco', + 'Europe/Moscow' => 'Europe/Moscow', + 'Europe/Oslo' => 'Europe/Oslo', + 'Europe/Paris' => 'Europe/Paris', + 'Europe/Podgorica' => 'Europe/Podgorica', + 'Europe/Prague' => 'Europe/Prague', + 'Europe/Riga' => 'Europe/Riga', + 'Europe/Rome' => 'Europe/Rome', + 'Europe/Samara' => 'Europe/Samara', + 'Europe/San_Marino' => 'Europe/San Marino', + 'Europe/Sarajevo' => 'Europe/Sarajevo', + 'Europe/Simferopol' => 'Europe/Simferopol', + 'Europe/Skopje' => 'Europe/Skopje', + 'Europe/Sofia' => 'Europe/Sofia', + 'Europe/Stockholm' => 'Europe/Stockholm', + 'Europe/Tallinn' => 'Europe/Tallinn', + 'Europe/Tirane' => 'Europe/Tirane', + 'Europe/Uzhgorod' => 'Europe/Uzhgorod', + 'Europe/Vaduz' => 'Europe/Vaduz', + 'Europe/Vatican' => 'Europe/Vatican', + 'Europe/Vienna' => 'Europe/Vienna', + 'Europe/Vilnius' => 'Europe/Vilnius', + 'Europe/Volgograd' => 'Europe/Volgograd', + 'Europe/Warsaw' => 'Europe/Warsaw', + 'Europe/Zagreb' => 'Europe/Zagreb', + 'Europe/Zaporozhye' => 'Europe/Zaporozhye', + 'Europe/Zurich' => 'Europe/Zurich', + + 'Indian/Antananarivo' => 'Indian/Antananarivo', + 'Indian/Chagos' => 'Indian/Chagos', + 'Indian/Christmas' => 'Indian/Christmas', + 'Indian/Cocos' => 'Indian/Cocos', + 'Indian/Comoro' => 'Indian/Comoro', + 'Indian/Kerguelen' => 'Indian/Kerguelen', + 'Indian/Mahe' => 'Indian/Mahe', + 'Indian/Maldives' => 'Indian/Maldives', + 'Indian/Mauritius' => 'Indian/Mauritius', + 'Indian/Mayotte' => 'Indian/Mayotte', + 'Indian/Reunion' => 'Indian/Reunion', + + 'Pacific/Apia' => 'Pacific/Apia', + 'Pacific/Auckland' => 'Pacific/Auckland', + 'Pacific/Chatham' => 'Pacific/Chatham', + 'Pacific/Chuuk' => 'Pacific/Chuuk', + 'Pacific/Easter' => 'Pacific/Easter', + 'Pacific/Efate' => 'Pacific/Efate', + 'Pacific/Enderbury' => 'Pacific/Enderbury', + 'Pacific/Fakaofo' => 'Pacific/Fakaofo', + 'Pacific/Fiji' => 'Pacific/Fiji', + 'Pacific/Funafuti' => 'Pacific/Funafuti', + 'Pacific/Galapagos' => 'Pacific/Galapagos', + 'Pacific/Gambier' => 'Pacific/Gambier', + 'Pacific/Guadalcanal' => 'Pacific/Guadalcanal', + 'Pacific/Guam' => 'Pacific/Guam', + 'Pacific/Honolulu' => 'Pacific/Honolulu', + 'Pacific/Johnston' => 'Pacific/Johnston', + 'Pacific/Kiritimati' => 'Pacific/Kiritimati', + 'Pacific/Kosrae' => 'Pacific/Kosrae', + 'Pacific/Kwajalein' => 'Pacific/Kwajalein', + 'Pacific/Majuro' => 'Pacific/Majuro', + 'Pacific/Marquesas' => 'Pacific/Marquesas', + 'Pacific/Midway' => 'Pacific/Midway', + 'Pacific/Nauru' => 'Pacific/Nauru', + 'Pacific/Niue' => 'Pacific/Niue', + 'Pacific/Norfolk' => 'Pacific/Norfolk', + 'Pacific/Noumea' => 'Pacific/Noumea', + 'Pacific/Pago_Pago' => 'Pacific/Pago Pago', + 'Pacific/Palau' => 'Pacific/Palau', + 'Pacific/Pitcairn' => 'Pacific/Pitcairn', + 'Pacific/Pohnpei' => 'Pacific/Pohnpei', + 'Pacific/Port_Moresby' => 'Pacific/Port Moresby', + 'Pacific/Rarotonga' => 'Pacific/Rarotonga', + 'Pacific/Saipan' => 'Pacific/Saipan', + 'Pacific/Tahiti' => 'Pacific/Tahiti', + 'Pacific/Tarawa' => 'Pacific/Tarawa', + 'Pacific/Tongatapu' => 'Pacific/Tongatapu', + 'Pacific/Wake' => 'Pacific/Wake', + 'Pacific/Wallis' => 'Pacific/Wallis', + ), + + // The value is only an example and will get replaced by the current time on view + 'dateformats' => array( + 'd M Y, H:i' => '01 Jan 2007, 13:37', + 'd M Y H:i' => '01 Jan 2007 13:37', + 'M jS, \'y, H:i' => 'Jan 1st, \'07, 13:37', + 'D M d, Y g:i a' => 'Mon Jan 01, 2007 1:37 pm', + 'F jS, Y, g:i a' => 'January 1st, 2007, 1:37 pm', + '|d M Y|, H:i' => 'Today, 13:37 / 01 Jan 2007, 13:37', + '|F jS, Y|, g:i a' => 'Today, 1:37 pm / January 1st, 2007, 1:37 pm', + ), + + // The default dateformat which will be used on new installs in this language + // Translators should change this if a the usual date format is different + 'default_dateformat' => 'D M d, Y g:i a', // Mon Jan 01, 2007 1:37 pm + +)); diff --git a/install/update/old/language/en/email/admin_activate.txt b/install/update/old/language/en/email/admin_activate.txt new file mode 100644 index 0000000..a53ab12 --- /dev/null +++ b/install/update/old/language/en/email/admin_activate.txt @@ -0,0 +1,13 @@ +Subject: Activate user account + +Hello, + +The account owned by "{USERNAME}" has been deactivated or newly created, you should check the details of this user (if required) and handle it appropriately. + +Use this link to view the user's profile: +{U_USER_DETAILS} + +Use this link to activate the account: +{U_ACTIVATE} + +{EMAIL_SIG} diff --git a/install/update/old/language/en/install.php b/install/update/old/language/en/install.php new file mode 100644 index 0000000..9bceecc --- /dev/null +++ b/install/update/old/language/en/install.php @@ -0,0 +1,599 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +/** + * DO NOT CHANGE + */ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Common installer pages +$lang = array_merge($lang, array( + 'INSTALL_PANEL' => 'Installation Panel', + 'SELECT_LANG' => 'Select language', + + 'STAGE_INSTALL' => 'Installing phpBB', + + // Introduction page + 'INTRODUCTION_TITLE' => 'Introduction', + 'INTRODUCTION_BODY' => 'Welcome to phpBB3!

phpBB® is the most widely used open source bulletin board solution in the world. phpBB3 is the latest installment in a package line started in 2000. Like its predecessors, phpBB3 is feature-rich, user-friendly, and fully supported by the phpBB Team. phpBB3 greatly improves on what made phpBB2 popular, and adds commonly requested features that were not present in previous versions. We hope it exceeds your expectations.

This installation system will guide you through installing phpBB3, updating to the latest version of phpBB3 from past releases, as well as converting to phpBB3 from a different discussion board system (including phpBB2). For more information, we encourage you to read the installation guide.

To read the phpBB3 license or learn about obtaining support and our stance on it, please select the respective options from the side menu. To continue, please select the appropriate tab above.', + + // Support page + 'SUPPORT_TITLE' => 'Support', + 'SUPPORT_BODY' => 'Full support will be provided for the current stable release of phpBB3, free of charge. This includes:

  • installation
  • configuration
  • technical questions
  • problems relating to potential bugs in the software
  • updating from Release Candidate (RC) versions to the latest stable version
  • converting from phpBB 2.0.x to phpBB3
  • converting from other discussion board software to phpBB3 (please see the Convertors Forum)

We encourage users still running beta versions of phpBB3 to replace their installation with a fresh copy of the latest version.

Extensions / Styles

For issues relating to Extensions, please post in the appropriate Extensions Forum.
For issues relating to styles, templates and themes, please post in the appropriate Styles Forum.

If your question relates to a specific package, please post directly in the topic dedicated to the package.

Obtaining Support

Support Section
Quick Start Guide

To ensure you stay up to date with the latest news and releases, follow us on Twitter and Facebook

', + + // License + 'LICENSE_TITLE' => 'General Public License', + + // Install page + 'INSTALL_INTRO' => 'Welcome to Installation', + 'INSTALL_INTRO_BODY' => 'With this option, it is possible to install phpBB3 onto your server.

In order to proceed, you will need your database settings. If you do not know your database settings, please contact your host and ask for them. You will not be able to continue without them. You need:

+ +
    +
  • The Database Type - the database you will be using.
  • +
  • The Database server hostname or DSN - the address of the database server.
  • +
  • The Database server port - the port of the database server (most of the time this is not needed).
  • +
  • The Database name - the name of the database on the server.
  • +
  • The Database username and Database password - the login data to access the database.
  • +
+ +

Note: if you are installing using SQLite, you should enter the full path to your database file in the DSN field and leave the username and password fields blank. For security reasons, you should make sure that the database file is not stored in a location accessible from the web.

+ +

phpBB3 supports the following databases:

+
    +
  • MySQL 3.23 or above (MySQLi supported)
  • +
  • PostgreSQL 8.3+
  • +
  • SQLite 3.6.15+
  • +
  • MS SQL Server 2000 or above (directly or via ODBC)
  • +
  • MS SQL Server 2005 or above (native)
  • +
  • Oracle
  • +
+ +

Only those databases supported on your server will be displayed.', + + 'ACP_LINK' => 'Take me to the ACP', + + 'INSTALL_PHPBB_INSTALLED' => 'phpBB is already installed.', + 'INSTALL_PHPBB_NOT_INSTALLED' => 'phpBB is not installed yet.', +)); + +// Requirements translation +$lang = array_merge($lang, array( + // Filesystem requirements + 'FILE_NOT_EXISTS' => 'File does not exist', + 'FILE_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB the %1$s file needs to exist.', + 'FILE_NOT_EXISTS_EXPLAIN_OPTIONAL' => 'It is recommended that the %1$s file exist for a better forum user experience.', + 'FILE_NOT_WRITABLE' => 'File is not writable', + 'FILE_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB the %1$s file needs to be writable.', + 'FILE_NOT_WRITABLE_EXPLAIN_OPTIONAL' => 'It is recommended that the %1$s file be writable for a better forum user experience.', + + 'DIRECTORY_NOT_EXISTS' => 'Directory does not exist', + 'DIRECTORY_NOT_EXISTS_EXPLAIN' => 'To be able to install phpBB the %1$s directory needs to exist.', + 'DIRECTORY_NOT_EXISTS_EXPLAIN_OPTIONAL' => 'It is recommended that the %1$s directory exist for a better forum user experience.', + 'DIRECTORY_NOT_WRITABLE' => 'Directory is not writable', + 'DIRECTORY_NOT_WRITABLE_EXPLAIN' => 'To be able to install phpBB the %1$s directory needs to be writable.', + 'DIRECTORY_NOT_WRITABLE_EXPLAIN_OPTIONAL' => 'It is recommended that the %1$s directory be writable for a better forum user experience.', + + // Server requirements + 'PHP_VERSION_REQD' => 'PHP version', + 'PHP_VERSION_REQD_EXPLAIN' => 'phpBB requires PHP version 5.4.0 or higher.', + 'PHP_GETIMAGESIZE_SUPPORT' => 'PHP getimagesize() function is required', + 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the getimagesize function needs to be available.', + 'PCRE_UTF_SUPPORT' => 'PCRE UTF-8 support', + 'PCRE_UTF_SUPPORT_EXPLAIN' => 'phpBB will not run if your PHP installation is not compiled with UTF-8 support in the PCRE extension.', + 'PHP_JSON_SUPPORT' => 'PHP JSON support', + 'PHP_JSON_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the PHP JSON extension needs to be available.', + 'PHP_XML_SUPPORT' => 'PHP XML/DOM support', + 'PHP_XML_SUPPORT_EXPLAIN' => 'In order for phpBB to function correctly, the PHP XML/DOM extension needs to be available.', + 'PHP_SUPPORTED_DB' => 'Supported databases', + 'PHP_SUPPORTED_DB_EXPLAIN' => 'You must have support for at least one compatible database within PHP. If no database modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.', + + 'RETEST_REQUIREMENTS' => 'Retest requirements', + + 'STAGE_REQUIREMENTS' => 'Check requirements', +)); + +// General error messages +$lang = array_merge($lang, array( + 'INST_ERR_MISSING_DATA' => 'You must fill out all fields in this block.', + + 'TIMEOUT_DETECTED_TITLE' => 'The installer detected a timeout', + 'TIMEOUT_DETECTED_MESSAGE' => 'The installer has detected a timeout, you may try to refresh the page, which may lead to data corruption. We suggest that you either increase your timeout settings or try to use the CLI.', +)); + +// Data obtaining translations +$lang = array_merge($lang, array( + 'STAGE_OBTAIN_DATA' => 'Set installation data', + + // + // Admin data + // + 'STAGE_ADMINISTRATOR' => 'Administrator details', + + // Form labels + 'ADMIN_CONFIG' => 'Administrator configuration', + 'ADMIN_PASSWORD' => 'Administrator password', + 'ADMIN_PASSWORD_CONFIRM' => 'Confirm administrator password', + 'ADMIN_PASSWORD_EXPLAIN' => 'Please enter a password between 6 and 30 characters in length.', + 'ADMIN_USERNAME' => 'Administrator username', + 'ADMIN_USERNAME_EXPLAIN' => 'Please enter a username between 3 and 20 characters in length.', + + // Errors + 'INST_ERR_EMAIL_INVALID' => 'The email address you entered is invalid.', + 'INST_ERR_PASSWORD_MISMATCH' => 'The passwords you entered did not match.', + 'INST_ERR_PASSWORD_TOO_LONG' => 'The password you entered is too long. The maximum length is 30 characters.', + 'INST_ERR_PASSWORD_TOO_SHORT' => 'The password you entered is too short. The minimum length is 6 characters.', + 'INST_ERR_USER_TOO_LONG' => 'The username you entered is too long. The maximum length is 20 characters.', + 'INST_ERR_USER_TOO_SHORT' => 'The username you entered is too short. The minimum length is 3 characters.', + + // + // Board data + // + // Form labels + 'BOARD_CONFIG' => 'Bulletin board configuration', + 'DEFAULT_LANGUAGE' => 'Default language', + 'BOARD_NAME' => 'Title of the board', + 'BOARD_DESCRIPTION' => 'Short description of the board', + + // + // Database data + // + 'STAGE_DATABASE' => 'Database settings', + + // Form labels + 'DB_CONFIG' => 'Database configuration', + 'DBMS' => 'Database type', + 'DB_HOST' => 'Database server hostname or DSN', + 'DB_HOST_EXPLAIN' => 'DSN stands for Data Source Name and is relevant only for ODBC installs. On PostgreSQL, use localhost to connect to the local server via UNIX domain socket and 127.0.0.1 to connect via TCP. For SQLite, enter the full path to your database file.', + 'DB_PORT' => 'Database server port', + 'DB_PORT_EXPLAIN' => 'Leave this blank unless you know the server operates on a non-standard port.', + 'DB_PASSWORD' => 'Database password', + 'DB_NAME' => 'Database name', + 'DB_USERNAME' => 'Database username', + 'DATABASE_VERSION' => 'Database version', + 'TABLE_PREFIX' => 'Prefix for tables in database', + 'TABLE_PREFIX_EXPLAIN' => 'The prefix must start with a letter and must only contain letters, numbers and underscores.', + + // Database options + 'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', + 'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Native ]', + 'DB_OPTION_MYSQL' => 'MySQL', + 'DB_OPTION_MYSQLI' => 'MySQL with MySQLi Extension', + 'DB_OPTION_ORACLE' => 'Oracle', + 'DB_OPTION_POSTGRES' => 'PostgreSQL', + 'DB_OPTION_SQLITE3' => 'SQLite 3', + + // Errors + 'INST_ERR_DB' => 'Database installation error', + 'INST_ERR_NO_DB' => 'Cannot load the PHP module for the selected database type.', + 'INST_ERR_DB_INVALID_PREFIX' => 'The prefix you entered is invalid. It must start with a letter and must only contain letters, numbers and underscores.', + 'INST_ERR_PREFIX_TOO_LONG' => 'The table prefix you have specified is too long. The maximum length is %d characters.', + 'INST_ERR_DB_NO_NAME' => 'No database name specified.', + 'INST_ERR_DB_FORUM_PATH' => 'The database file specified is within your board directory tree. You should put this file in a non web-accessible location.', + 'INST_ERR_DB_CONNECT' => 'Could not connect to the database, see error message below.', + 'INST_ERR_DB_NO_WRITABLE' => 'Both the database and the directory containing it must be writable.', + 'INST_ERR_DB_NO_ERROR' => 'No error message given.', + 'INST_ERR_PREFIX' => 'Tables with the specified prefix already exist, please choose an alternative.', + 'INST_ERR_DB_NO_MYSQLI' => 'The version of MySQL installed on this machine is incompatible with the “MySQL with MySQLi Extension” option you have selected. Please try the “MySQL” option instead.', + 'INST_ERR_DB_NO_SQLITE3' => 'The version of the SQLite extension you have installed is too old, it must be upgraded to at least 3.6.15.', + 'INST_ERR_DB_NO_ORACLE' => 'The version of Oracle installed on this machine requires you to set the NLS_CHARACTERSET parameter to UTF8. Either upgrade your installation to 9.2+ or change the parameter.', + 'INST_ERR_DB_NO_POSTGRES' => 'The database you have selected was not created in UNICODE or UTF8 encoding. Try installing with a database in UNICODE or UTF8 encoding.', + 'INST_SCHEMA_FILE_NOT_WRITABLE' => 'The schema file is not writable', + + // + // Email data + // + 'EMAIL_CONFIG' => 'E-mail configuration', + + // Package info + 'PACKAGE_VERSION' => 'Package version installed', + 'UPDATE_INCOMPLETE' => 'Your phpBB installation has not been correctly updated.', + 'UPDATE_INCOMPLETE_MORE' => 'Please read the information below in order to fix this error.', + 'UPDATE_INCOMPLETE_EXPLAIN' => '

Incomplete update

+ +

We noticed that the last update of your phpBB installation hasn’t been completed. Visit the database updater, ensure Update database only is selected and click on Submit. Don\'t forget to delete the "install"-directory after you have updated the database sucessfully.

', + + // + // Server data + // + // Form labels + 'UPGRADE_INSTRUCTIONS' => 'A new feature release %1$s is available. Please read the release announcement to learn about what it has to offer, and how to upgrade.', + 'SERVER_CONFIG' => 'Server configuration', + 'SCRIPT_PATH' => 'Script path', + 'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB is located relative to the domain name, e.g. /phpBB3.', +)); + +// Default database schema entries... +$lang = array_merge($lang, array( + 'CONFIG_BOARD_EMAIL_SIG' => 'Thanks, The Management', + 'CONFIG_SITE_DESC' => 'A short text to describe your forum', + 'CONFIG_SITENAME' => 'yourdomain.com', + + 'DEFAULT_INSTALL_POST' => 'This is an example post in your phpBB3 installation. Everything seems to be working. You may delete this post if you like and continue to set up your board. During the installation process your first category and your first forum are assigned an appropriate set of permissions for the predefined usergroups administrators, bots, global moderators, guests, registered users and registered COPPA users. If you also choose to delete your first category and your first forum, do not forget to assign permissions for all these usergroups for all new categories and forums you create. It is recommended to rename your first category and your first forum and copy permissions from these while creating new categories and forums. Have fun!', + + 'FORUMS_FIRST_CATEGORY' => 'Your first category', + 'FORUMS_TEST_FORUM_DESC' => 'Description of your first forum.', + 'FORUMS_TEST_FORUM_TITLE' => 'Your first forum', + + 'RANKS_SITE_ADMIN_TITLE' => 'Site Admin', + 'REPORT_WAREZ' => 'The post contains links to illegal or pirated software.', + 'REPORT_SPAM' => 'The reported post has the only purpose to advertise for a website or another product.', + 'REPORT_OFF_TOPIC' => 'The reported post is off topic.', + 'REPORT_OTHER' => 'The reported post does not fit into any other category, please use the further information field.', + + 'SMILIES_ARROW' => 'Arrow', + 'SMILIES_CONFUSED' => 'Confused', + 'SMILIES_COOL' => 'Cool', + 'SMILIES_CRYING' => 'Crying or Very Sad', + 'SMILIES_EMARRASSED' => 'Embarrassed', + 'SMILIES_EVIL' => 'Evil or Very Mad', + 'SMILIES_EXCLAMATION' => 'Exclamation', + 'SMILIES_GEEK' => 'Geek', + 'SMILIES_IDEA' => 'Idea', + 'SMILIES_LAUGHING' => 'Laughing', + 'SMILIES_MAD' => 'Mad', + 'SMILIES_MR_GREEN' => 'Mr. Green', + 'SMILIES_NEUTRAL' => 'Neutral', + 'SMILIES_QUESTION' => 'Question', + 'SMILIES_RAZZ' => 'Razz', + 'SMILIES_ROLLING_EYES' => 'Rolling Eyes', + 'SMILIES_SAD' => 'Sad', + 'SMILIES_SHOCKED' => 'Shocked', + 'SMILIES_SMILE' => 'Smile', + 'SMILIES_SURPRISED' => 'Surprised', + 'SMILIES_TWISTED_EVIL' => 'Twisted Evil', + 'SMILIES_UBER_GEEK' => 'Uber Geek', + 'SMILIES_VERY_HAPPY' => 'Very Happy', + 'SMILIES_WINK' => 'Wink', + + 'TOPICS_TOPIC_TITLE' => 'Welcome to phpBB3', +)); + +// Common navigation items' translation +$lang = array_merge($lang, array( + 'MENU_OVERVIEW' => 'Overview', + 'MENU_INTRO' => 'Introduction', + 'MENU_LICENSE' => 'License', + 'MENU_SUPPORT' => 'Support', +)); + +// Task names +$lang = array_merge($lang, array( + // Install filesystem + 'TASK_CREATE_CONFIG_FILE' => 'Creating configuration file', + + // Install database + 'TASK_ADD_CONFIG_SETTINGS' => 'Adding configuration settings', + 'TASK_ADD_DEFAULT_DATA' => 'Adding default settings to the database', + 'TASK_CREATE_DATABASE_SCHEMA_FILE' => 'Creating database schema file', + 'TASK_SETUP_DATABASE' => 'Setting up database', + 'TASK_CREATE_TABLES' => 'Creating tables', + + // Install data + 'TASK_ADD_BOTS' => 'Registering bots', + 'TASK_ADD_LANGUAGES' => 'Installing available languages', + 'TASK_ADD_MODULES' => 'Installing modules', + 'TASK_CREATE_SEARCH_INDEX' => 'Creating search index', + + // Install finish tasks + 'TASK_INSTALL_EXTENSIONS' => 'Installing packaged extensions', + 'TASK_NOTIFY_USER' => 'Sending notification e-mail', + 'TASK_POPULATE_MIGRATIONS' => 'Populating migrations', + + // Installer general progress messages + 'INSTALLER_FINISHED' => 'The installer has finished successfully', +)); + +// Installer's general messages +$lang = array_merge($lang, array( + 'MODULE_NOT_FOUND' => 'Module not found', + 'MODULE_NOT_FOUND_DESCRIPTION' => 'A module could not be found because the service, %s, is undefined.', + + 'TASK_NOT_FOUND' => 'Task not found', + 'TASK_NOT_FOUND_DESCRIPTION' => 'A task could not be found because the service, %s, is undefined.', + + 'SKIP_MODULE' => 'Skip “%s” module', + 'SKIP_TASK' => 'Skip “%s” task', + + 'TASK_SERVICE_INSTALLER_MISSING' => 'All installer task services should start with “installer”', + 'TASK_CLASS_NOT_FOUND' => 'Installer task service definition is invalid. Service name “%1$s” given, the expected class namespace is “%2$s” for that. For more information please see the documentation of task_interface.', + + 'INSTALLER_CONFIG_NOT_WRITABLE' => 'The installer config file is not writable.', +)); + +// CLI messages +$lang = array_merge($lang, array( + 'CLI_INSTALL_BOARD' => 'Install phpBB', + 'CLI_UPDATE_BOARD' => 'Update phpBB', + 'CLI_INSTALL_SHOW_CONFIG' => 'Show the configuration which will be used', + 'CLI_INSTALL_VALIDATE_CONFIG' => 'Validate a configuration file', + 'CLI_CONFIG_FILE' => 'Config file to use', + 'MISSING_FILE' => 'Unable to access file %1$s', + 'MISSING_DATA' => 'Config file is missing data or might contain invalid settings.', + 'INVALID_YAML_FILE' => 'Could not parse YAML file %1$s', + 'CONFIGURATION_VALID' => 'The configuration file is valid', +)); + +// Common updater messages +$lang = array_merge($lang, array( + 'UPDATE_INSTALLATION' => 'Update phpBB installation', + 'UPDATE_INSTALLATION_EXPLAIN' => 'With this option, it is possible to update your phpBB installation to the latest version.
During the process all of your files will be checked for their integrity. You are able to review all differences and files before the update.

The file update itself can be done in two different ways.

Manual Update

With this update you only download your personal set of changed files to make sure you do not lose your file modifications you may have done. After you downloaded this package you need to manually upload the files to their correct position under your phpBB root directory. Once done, you are able to do the file check stage again to see if you moved the files to their correct location.

Automatic Update with FTP

This method is similar to the first one but without the need to download the changed files and uploading them on your own. This will be done for you. In order to use this method you need to know your FTP login details since you will be asked for them. Once finished you will be redirected to the file check again to make sure everything got updated correctly.

', + 'UPDATE_INSTRUCTIONS' => ' + +

Release announcement

+ +

Please read the release announcement for the latest version before you continue your update process, it may contain useful information. It also contains full download links as well as the change log.

+ +
+ +

How to update your installation with the Full Package

+ +

The recommended way of updating your installation is using the full package. If core phpBB files have been modified in your installation you may wish to use the automatic update package in order to not lose these changes. You are also able to update your installation using the other methods listed within the INSTALL.html document. The steps for updating phpBB3 using the full package are:

+ +
    +
  1. Backup all board files and the database.
  2. +
  3. Go to the phpBB.com downloads page and download the latest "Full Package" archive.
  4. +
  5. Unpack the archive.
  6. +
  7. Remove (delete) the config.php file, and the /images, /store and /files folders from the package (not your site).
  8. +
  9. Go to the ACP, Board settings, and make sure prosilver is set as the default style. If not, set it to prosilver.
  10. +
  11. Delete the /vendor and /cache folders from the board’s root folder on the host.
  12. +
  13. Via FTP or SSH upload the remaining files and folders (that is, the remaining CONTENTS of the phpBB3 folder) to the root folder of your board installation on the server, overwriting the existing files. (Note: take care not to delete any extensions in your /ext folder when uploading the new phpBB3 contents.)
  14. +
  15. Now start the update process by pointing your browser to the install folder.
  16. +
  17. Follow the steps to update the database and let that run to completion.
  18. +
  19. Via FTP or SSH delete the /install folder from the root of your board installation.

  20. +
+ +

You now have a new up to date board containing all your users and posts. Follow up tasks:

+
    +
  • Update your language pack
  • +
  • Update your style

  • +
+ +

How to update your installation with the Automatic Update Package

+ +

The automatic update package is only recommended in case core phpBB files have been modified in your installation. You are also able to update your installation using the methods listed within the INSTALL.html document. The steps for updating phpBB3 using the automatic update package are:

+ +
    +
  1. Go to the phpBB.com downloads page and download the "Automatic Update Package" archive.
  2. +
  3. Unpack the archive.
  4. +
  5. Upload the complete uncompressed "install" and "vendor" folders to your phpBB root directory (where your config.php file is).

  6. +
+ +

Once uploaded your board will be offline for normal users due to the install directory you uploaded now being present.

+ Now start the update process by pointing your browser to the install folder.
+
+ You will then be guided through the update process. You will be notified once the update is complete. +

+ ', +)); + +// Updater forms +$lang = array_merge($lang, array( + // Updater types + 'UPDATE_TYPE' => 'Type of update to run', + + 'UPDATE_TYPE_ALL' => 'Update filesystem and database', + 'UPDATE_TYPE_DB_ONLY' => 'Update database only', + + // File updater methods + 'UPDATE_FILE_METHOD_TITLE' => 'File updater methods', + + 'UPDATE_FILE_METHOD' => 'File updater method', + 'UPDATE_FILE_METHOD_DOWNLOAD' => 'Download modified files in an archive', + 'UPDATE_FILE_METHOD_FTP' => 'Update files via FTP (Automatic)', + 'UPDATE_FILE_METHOD_FILESYSTEM' => 'Update files via direct file access (Automatic)', + + // File updater archives + 'SELECT_DOWNLOAD_FORMAT' => 'Select download archive format', + + // FTP settings + 'FTP_SETTINGS' => 'FTP settings', +)); + +// Requirements messages +$lang = array_merge($lang, array( + 'UPDATE_FILES_NOT_FOUND' => 'No valid update directory was found, please make sure you uploaded the relevant files.', + + 'NO_UPDATE_FILES_UP_TO_DATE' => 'Your version is up to date. There is no need to run the update tool. If you want to make an integrity check on your files make sure you uploaded the correct update files.', + 'OLD_UPDATE_FILES' => 'Update files are out of date. The update files found are for updating from phpBB %1$s to phpBB %2$s but the latest version of phpBB is %3$s.', + 'INCOMPATIBLE_UPDATE_FILES' => 'The update files found are incompatible with your installed version. Your installed version is %1$s and the update file is for updating phpBB %2$s to %3$s.', +)); + +// Update files +$lang = array_merge($lang, array( + 'STAGE_UPDATE_FILES' => 'Update files', + + // Check files + 'UPDATE_CHECK_FILES' => 'Check files to update', + + // Update file differ + 'FILE_DIFFER_ERROR_FILE_CANNOT_BE_READ' => 'The file differ failed to open %s.', + + 'UPDATE_FILE_DIFF' => 'Diffing changed files', + 'ALL_FILES_DIFFED' => 'All modified files has been diffed.', + + // File status + 'UPDATE_CONTINUE_FILE_UPDATE' => 'Update files', + + 'DOWNLOAD' => 'Download', + 'DOWNLOAD_CONFLICTS' => 'Download merge conflicts archive', + 'DOWNLOAD_CONFLICTS_EXPLAIN' => 'Search for <<< to spot conflicts', + '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, you may continue with the update process.', + + 'FILE_ALREADY_UP_TO_DATE' => 'File is already up to date.', + 'FILE_DIFF_NOT_ALLOWED' => 'File not allowed to be diffed.', + 'FILE_USED' => 'Information used from', // Single file + 'FILES_CONFLICT' => 'Conflict files', + 'FILES_CONFLICT_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. phpBB determined that these files create conflicts if they are tried to be merged. Please investigate the conflicts and try to manually resolve them or continue the update choosing the preferred merging method. If you resolve the conflicts manually check the files again after you modified them. You are also able to choose between the preferred merge method for every file. The first one will result in a file where the conflicting lines from your old file will be lost, the other one will result in losing the changes from the newer file.', + 'FILES_DELETED' => 'Deleted files', + 'FILES_DELETED_EXPLAIN' => 'The following files do not exist in the new version. These files have to be deleted from your installation.', + 'FILES_MODIFIED' => 'Modified files', + 'FILES_MODIFIED_EXPLAIN' => 'The following files are modified and do not represent the original files from the old version. The updated file will be a merge between your modifications and the new file.', + 'FILES_NEW' => 'New files', + 'FILES_NEW_EXPLAIN' => 'The following files currently do not exist within your installation. These files will be added to your installation.', + 'FILES_NEW_CONFLICT' => 'New conflicting files', + 'FILES_NEW_CONFLICT_EXPLAIN' => 'The following files are new within the latest version but it has been determined that there is already a file with the same name within the same position. This file will be overwritten by the new file.', + 'FILES_NOT_MODIFIED' => 'Not modified files', + 'FILES_NOT_MODIFIED_EXPLAIN' => 'The following files are not modified and represent the original phpBB files from the version you want to update from.', + 'FILES_UP_TO_DATE' => 'Already updated files', + 'FILES_UP_TO_DATE_EXPLAIN' => 'The following files are already up to date and do not need to be updated.', + 'FILES_VERSION' => 'Files Version', + 'TOGGLE_DISPLAY' => 'View/Hide file list', + + // File updater + 'UPDATE_UPDATING_FILES' => 'Updating files', + + 'UPDATE_FILE_UPDATER_HAS_FAILED' => 'File updater “%1$s“ has failed. The installer will try to fallback to “%2$s“.', + 'UPDATE_FILE_UPDATERS_HAVE_FAILED' => 'The file updater failed. No further fallback methods are available.', + + 'UPDATE_CONTINUE_UPDATE_PROCESS' => 'Continue update process', + 'UPDATE_RECHECK_UPDATE_FILES' => 'Check files again', +)); + +// Update database +$lang = array_merge($lang, array( + 'STAGE_UPDATE_DATABASE' => 'Update database', + + 'INLINE_UPDATE_SUCCESSFUL' => 'The database update was successful.', + + 'TASK_UPDATE_EXTENSIONS' => 'Updating extensions', +)); + +// Converter +$lang = array_merge($lang, array( + // Common converter messages + 'CONVERT_NOT_EXIST' => 'The specified convertor does not exist.', + 'DEV_NO_TEST_FILE' => 'No value has been specified for the test_file variable in the convertor. If you are a user of this convertor, you should not be seeing this error, please report this message to the convertor author. If you are a convertor author, you must specify the name of a file which exists in the source board to allow the path to it to be verified.', + 'COULD_NOT_FIND_PATH' => 'Could not find path to your former board. Please check your settings and try again.
» %s was specified as the source path.', + 'CONFIG_PHPBB_EMPTY' => 'The phpBB3 config variable for “%s” is empty.', + + 'MAKE_FOLDER_WRITABLE' => 'Please make sure that this folder exists and is writable by the webserver then try again:
»%s.', + 'MAKE_FOLDERS_WRITABLE' => 'Please make sure that these folders exist and are writable by the webserver then try again:
»%s.', + + 'INSTALL_TEST' => 'Test again', + + 'NO_TABLES_FOUND' => 'No tables found.', + 'TABLES_MISSING' => 'Could not find these tables
» %s.', + 'CHECK_TABLE_PREFIX' => 'Please check your table prefix and try again.', + + // Conversion in progress + 'CONTINUE_CONVERT' => 'Continue conversion', + 'CONTINUE_CONVERT_BODY' => 'A previous conversion attempt has been determined. You are now able to choose between starting a new conversion or continuing the conversion.', + 'CONVERT_NEW_CONVERSION' => 'New conversion', + 'CONTINUE_OLD_CONVERSION' => 'Continue previously started conversion', + + // Start conversion + 'SUB_INTRO' => 'Introduction', + 'CONVERT_INTRO' => 'Welcome to the phpBB Unified Convertor Framework', + 'CONVERT_INTRO_BODY' => 'From here, you are able to import data from other (installed) board systems. The list below shows all the conversion modules currently available. If there is no convertor shown in this list for the board software you wish to convert from, please check our website where further conversion modules may be available for download.', + 'AVAILABLE_CONVERTORS' => 'Available convertors', + 'NO_CONVERTORS' => 'No convertors are available for use.', + 'CONVERT_OPTIONS' => 'Options', + 'SOFTWARE' => 'Board software', + 'VERSION' => 'Version', + 'CONVERT' => 'Convert', + + // Settings + 'STAGE_SETTINGS' => 'Settings', + 'TABLE_PREFIX_SAME' => 'The table prefix needs to be the one used by the software you are converting from.
» Specified table prefix was %s.', + 'DEFAULT_PREFIX_IS' => 'The convertor was not able to find tables with the specified prefix. Please make sure you have entered the correct details for the board you are converting from. The default table prefix for %1$s is %2$s.', + 'SPECIFY_OPTIONS' => 'Specify conversion options', + 'FORUM_PATH' => 'Board path', + 'FORUM_PATH_EXPLAIN' => 'This is the relative path on disk to your former board from the root of this phpBB3 installation.', + 'REFRESH_PAGE' => 'Refresh page to continue conversion', + 'REFRESH_PAGE_EXPLAIN' => 'If set to yes, the convertor will refresh the page to continue the conversion after having finished a step. If this is your first conversion for testing purposes and to determine any errors in advance, we suggest to set this to No.', + + // Conversion + 'STAGE_IN_PROGRESS' => 'Conversion in progress', + + 'AUTHOR_NOTES' => 'Author notes
» %s', + 'STARTING_CONVERT' => 'Starting conversion process', + 'CONFIG_CONVERT' => 'Converting the configuration', + 'DONE' => 'Done', + 'PREPROCESS_STEP' => 'Executing pre-processing functions/queries', + 'FILLING_TABLE' => 'Filling table %s', + 'FILLING_TABLES' => 'Filling tables', + 'DB_ERR_INSERT' => 'Error while processing INSERT query.', + 'DB_ERR_LAST' => 'Error while processing query_last.', + 'DB_ERR_QUERY_FIRST' => 'Error while executing query_first.', + 'DB_ERR_QUERY_FIRST_TABLE' => 'Error while executing query_first, %s (“%s”).', + 'DB_ERR_SELECT' => 'Error while running SELECT query.', + 'STEP_PERCENT_COMPLETED' => 'Step %d of %d', + 'FINAL_STEP' => 'Process final step', + 'SYNC_FORUMS' => 'Starting to synchronise forums', + 'SYNC_POST_COUNT' => 'Synchronising post_counts', + 'SYNC_POST_COUNT_ID' => 'Synchronising post_counts from entry %1$s to %2$s.', + 'SYNC_TOPICS' => 'Starting to synchronise topics', + 'SYNC_TOPIC_ID' => 'Synchronising topics from topic_id %1$s to %2$s.', + 'PROCESS_LAST' => 'Processing last statements', + 'UPDATE_TOPICS_POSTED' => 'Generating topics posted information', + 'UPDATE_TOPICS_POSTED_ERR' => 'An error occurred while generating topics posted information. You can retry this step in the ACP after the conversion process is completed.', + 'CONTINUE_LAST' => 'Continue last statements', + 'CLEAN_VERIFY' => 'Cleaning up and verifying the final structure', + 'NOT_UNDERSTAND' => 'Could not understand %s #%d, table %s (“%s”)', + 'NAMING_CONFLICT' => 'Naming conflict: %s and %s are both aliases

%s', + + // Finish conversion + 'CONVERT_COMPLETE' => 'Conversion completed', + 'CONVERT_COMPLETE_EXPLAIN' => 'You have now successfully converted your board to phpBB 3.2. You can now login and access your board. Please ensure that the settings were transferred correctly before enabling your board by deleting the install directory. Remember that help on using phpBB is available online via the Documentation and the support forums.', + + 'CONV_ERROR_ATTACH_FTP_DIR' => 'FTP upload for attachments is enabled at the old board. Please disable the FTP upload option and make sure a valid upload directory is specified, then copy all attachment files to this new web accessible directory. Once you have done this, restart the convertor.', + 'CONV_ERROR_CONFIG_EMPTY' => 'There is no configuration information available for the conversion.', + 'CONV_ERROR_FORUM_ACCESS' => 'Unable to get forum access information.', + 'CONV_ERROR_GET_CATEGORIES' => 'Unable to get categories.', + 'CONV_ERROR_GET_CONFIG' => 'Could not retrieve your board configuration.', + 'CONV_ERROR_COULD_NOT_READ' => 'Unable to access/read “%s”.', + 'CONV_ERROR_GROUP_ACCESS' => 'Unable to get group authentication information.', + 'CONV_ERROR_INCONSISTENT_GROUPS' => 'Inconsistency in groups table detected in add_bots() - you need to add all special groups if you do it manually.', + 'CONV_ERROR_INSERT_BOT' => 'Unable to insert bot into users table.', + 'CONV_ERROR_INSERT_BOTGROUP' => 'Unable to insert bot into bots table.', + 'CONV_ERROR_INSERT_USER_GROUP' => 'Unable to insert user into user_group table.', + 'CONV_ERROR_MESSAGE_PARSER' => 'Message parser error', + 'CONV_ERROR_NO_AVATAR_PATH' => 'Note to developer: you must specify $convertor[\'avatar_path\'] to use %s.', + 'CONV_ERROR_NO_FORUM_PATH' => 'The relative path to the source board has not been specified.', + 'CONV_ERROR_NO_GALLERY_PATH' => 'Note to developer: you must specify $convertor[\'avatar_gallery_path\'] to use %s.', + 'CONV_ERROR_NO_GROUP' => 'Group “%1$s” could not be found in %2$s.', + 'CONV_ERROR_NO_RANKS_PATH' => 'Note to developer: you must specify $convertor[\'ranks_path\'] to use %s.', + 'CONV_ERROR_NO_SMILIES_PATH' => 'Note to developer: you must specify $convertor[\'smilies_path\'] to use %s.', + 'CONV_ERROR_NO_UPLOAD_DIR' => 'Note to developer: you must specify $convertor[\'upload_path\'] to use %s.', + 'CONV_ERROR_PERM_SETTING' => 'Unable to insert/update permission setting.', + 'CONV_ERROR_PM_COUNT' => 'Unable to select folder pm count.', + 'CONV_ERROR_REPLACE_CATEGORY' => 'Unable to insert new forum replacing old category.', + 'CONV_ERROR_REPLACE_FORUM' => 'Unable to insert new forum replacing old forum.', + 'CONV_ERROR_USER_ACCESS' => 'Unable to get user authentication information.', + 'CONV_ERROR_WRONG_GROUP' => 'Wrong group “%1$s” defined in %2$s.', + 'CONV_OPTIONS_BODY' => 'This page collects the data required to access the source board. Enter the database details of your former board; the converter will not change anything in the database given below. The source board should be disabled to allow a consistent conversion.', + 'CONV_SAVED_MESSAGES' => 'Saved messages', + + 'PRE_CONVERT_COMPLETE' => 'All pre-conversion steps have successfully been completed. You may now begin the actual conversion process. Please note that you may have to manually do and adjust several things. After conversion, especially check the permissions assigned, rebuild your search index which is not converted and also make sure files got copied correctly, for example avatars and smilies.', +)); diff --git a/install/update/old/language/en/migrator.php b/install/update/old/language/en/migrator.php new file mode 100644 index 0000000..8a82d40 --- /dev/null +++ b/install/update/old/language/en/migrator.php @@ -0,0 +1,81 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'CONFIG_NOT_EXIST' => 'The config setting "%s" unexpectedly does not exist.', + + 'GROUP_NOT_EXIST' => 'The group "%s" unexpectedly does not exist.', + + 'MIGRATION_APPLY_DEPENDENCIES' => 'Apply dependencies of %s.', + 'MIGRATION_DATA_DONE' => 'Installed Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_DATA_IN_PROGRESS' => 'Installing Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_DATA_RUNNING' => 'Installing Data: %s.', + 'MIGRATION_EFFECTIVELY_INSTALLED' => 'Migration already effectively installed (skipped): %s', + 'MIGRATION_EXCEPTION_ERROR' => 'Something went wrong during the request and an exception was thrown. The changes made before the error occurred were reversed to the best of our abilities, but you should check the board for errors.', + 'MIGRATION_NOT_FULFILLABLE' => 'The migration "%1$s" is not fulfillable, missing migration "%2$s".', + 'MIGRATION_NOT_INSTALLED' => 'The migration "%s" is not installed.', + 'MIGRATION_NOT_VALID' => '%s is not a valid migration.', + 'MIGRATION_SCHEMA_DONE' => 'Installed Schema: %1$s; Time: %2$.2f seconds', + 'MIGRATION_SCHEMA_IN_PROGRESS' => 'Installing Schema: %1$s; Time: %2$.2f seconds', + 'MIGRATION_SCHEMA_RUNNING' => 'Installing Schema: %s.', + + 'MIGRATION_REVERT_DATA_DONE' => 'Reverted Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_DATA_IN_PROGRESS' => 'Reverting Data: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_DATA_RUNNING' => 'Reverting Data: %s.', + 'MIGRATION_REVERT_SCHEMA_DONE' => 'Reverted Schema: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_SCHEMA_IN_PROGRESS' => 'Reverting Schema: %1$s; Time: %2$.2f seconds', + 'MIGRATION_REVERT_SCHEMA_RUNNING' => 'Reverting Schema: %s.', + + 'MIGRATION_INVALID_DATA_MISSING_CONDITION' => 'A migration is invalid. An if statement helper is missing a condition.', + 'MIGRATION_INVALID_DATA_MISSING_STEP' => 'A migration is invalid. An if statement helper is missing a valid call to a migration step.', + 'MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE' => 'A migration is invalid. A custom callable function could not be called.', + 'MIGRATION_INVALID_DATA_UNKNOWN_TYPE' => 'A migration is invalid. An unknown migration tool type was encountered.', + 'MIGRATION_INVALID_DATA_UNDEFINED_TOOL' => 'A migration is invalid. An undefined migration tool was encountered.', + 'MIGRATION_INVALID_DATA_UNDEFINED_METHOD' => 'A migration is invalid. An undefined migration tool method was encountered.', + + 'MODULE_ERROR' => 'An error occurred while creating a module: %s', + 'MODULE_EXISTS' => 'A module already exists: %s', + 'MODULE_EXIST_MULTIPLE' => 'Several modules with the given parent module langname already exist: %s. Try using before/after keys to clarify the module placement.', + 'MODULE_INFO_FILE_NOT_EXIST' => 'A required module info file is missing: %2$s', + 'MODULE_NOT_EXIST' => 'A required module does not exist: %s', + + 'PARENT_MODULE_FIND_ERROR' => 'Unable to determine the parent module identifier: %s', + 'PERMISSION_NOT_EXIST' => 'The permission setting "%s" unexpectedly does not exist.', + + 'ROLE_NOT_EXIST' => 'The permission role "%s" unexpectedly does not exist.', +)); diff --git a/install/update/old/language/en/posting.php b/install/update/old/language/en/posting.php new file mode 100644 index 0000000..11ea648 --- /dev/null +++ b/install/update/old/language/en/posting.php @@ -0,0 +1,287 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +$lang = array_merge($lang, array( + 'ADD_ATTACHMENT' => 'Upload attachment', + 'ADD_ATTACHMENT_EXPLAIN' => 'If you wish to attach one or more files enter the details below.', + 'ADD_FILE' => 'Add the file', + 'ADD_POLL' => 'Poll creation', + 'ADD_POLL_EXPLAIN' => 'If you do not want to add a poll to your topic leave the fields blank.', + 'ALREADY_DELETED' => 'Sorry but this message is already deleted.', + 'ATTACH_DISK_FULL' => 'There is not enough free disk space to post this attachment.', + 'ATTACH_QUOTA_REACHED' => 'Sorry, the board attachment quota has been reached.', + 'ATTACH_SIG' => 'Attach a signature (signatures can be altered via the UCP)', + + 'BBCODE_A_HELP' => 'Inline uploaded attachment: [attachment=]filename.ext[/attachment]', + 'BBCODE_B_HELP' => 'Bold text: [b]text[/b]', + 'BBCODE_C_HELP' => 'Code display: [code]code[/code]', + 'BBCODE_D_HELP' => 'Flash: [flash=width,height]http://url[/flash]', + 'BBCODE_F_HELP' => 'Font size: [size=85]small text[/size]', + 'BBCODE_IS_OFF' => '%sBBCode%s is OFF', + 'BBCODE_IS_ON' => '%sBBCode%s is ON', + 'BBCODE_I_HELP' => 'Italic text: [i]text[/i]', + 'BBCODE_L_HELP' => 'List: [list][*]text[/list]', + 'BBCODE_LISTITEM_HELP' => 'List item: [*]text', + 'BBCODE_O_HELP' => 'Ordered list: e.g. [list=1][*]First point[/list] or [list=a][*]Point a[/list]', + 'BBCODE_P_HELP' => 'Insert image: [img]http://image_url[/img]', + 'BBCODE_Q_HELP' => 'Quote text: [quote]text[/quote]', + 'BBCODE_S_HELP' => 'Font colour: [color=red]text[/color] or [color=#FF0000]text[/color]', + 'BBCODE_U_HELP' => 'Underline text: [u]text[/u]', + 'BBCODE_W_HELP' => 'Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]', + 'BBCODE_Y_HELP' => 'List: Add list element', + 'BUMP_ERROR' => 'You cannot bump this topic so soon after the last post.', + + 'CANNOT_DELETE_REPLIED' => 'Sorry but you may only delete posts which have not been replied to.', + 'CANNOT_EDIT_POST_LOCKED' => 'This post has been locked. You can no longer edit that post.', + 'CANNOT_EDIT_TIME' => 'You can no longer edit or delete that post.', + 'CANNOT_POST_ANNOUNCE' => 'Sorry but you cannot post announcements.', + 'CANNOT_POST_STICKY' => 'Sorry but you cannot post sticky topics.', + 'CHANGE_TOPIC_TO' => 'Change topic type to', + 'CHARS_POST_CONTAINS' => array( + 1 => 'Your message contains %1$d character.', + 2 => 'Your message contains %1$d characters.', + ), + 'CHARS_SIG_CONTAINS' => array( + 1 => 'Your signature contains %1$d character.', + 2 => 'Your signature contains %1$d characters.', + ), + 'CLOSE_TAGS' => 'Close tags', + 'CURRENT_TOPIC' => 'Current topic', + + 'DELETE_FILE' => 'Delete file', + 'DELETE_MESSAGE' => 'Delete message', + 'DELETE_MESSAGE_CONFIRM' => 'Are you sure you want to delete this message?', + 'DELETE_OWN_POSTS' => 'Sorry but you can only delete your own posts.', + 'DELETE_PERMANENTLY' => 'Delete permanently', + 'DELETE_POST_CONFIRM' => 'Are you sure you want to delete this post?', + 'DELETE_POST_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete this post?', + 'DELETE_POST_PERMANENTLY' => array( + 1 => 'Permanently delete this post so it can not be recovered', + 2 => 'Permanently delete %1$d posts so they can not be recovered', + ), + 'DELETE_POSTS_CONFIRM' => 'Are you sure you want to delete these posts?', + 'DELETE_POSTS_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete these posts?', + 'DELETE_REASON' => 'Reason for deletion', + 'DELETE_REASON_EXPLAIN' => 'The specified reason for deletion will be visible to moderators.', + 'DELETE_POST_WARN' => 'Delete this post', + 'DELETE_TOPIC_CONFIRM' => 'Are you sure you want to delete this topic?', + 'DELETE_TOPIC_PERMANENTLY' => array( + 1 => 'Permanently delete this topic so it can not be recovered', + 2 => 'Permanently delete %1$d topics so they can not be recovered', + ), + 'DELETE_TOPIC_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete this topic?', + 'DELETE_TOPICS_CONFIRM' => 'Are you sure you want to delete these topics?', + 'DELETE_TOPICS_PERMANENTLY_CONFIRM' => 'Are you sure you want to permanently delete these topics?', + 'DISABLE_BBCODE' => 'Disable BBCode', + 'DISABLE_MAGIC_URL' => 'Do not automatically parse URLs', + 'DISABLE_SMILIES' => 'Disable smilies', + 'DISALLOWED_CONTENT' => 'The upload was rejected because the uploaded file was identified as a possible attack vector.', + 'DISALLOWED_EXTENSION' => 'The extension %s is not allowed.', + 'DRAFT_LOADED' => 'Draft loaded into posting area, you may want to finish your post now.
Your draft will be deleted after submitting this post.', + 'DRAFT_LOADED_PM' => 'Draft loaded into message area, you may want to finish your private message now.
Your draft will be deleted after submitting this private message.', + 'DRAFT_SAVED' => 'Draft successfully saved.', + 'DRAFT_TITLE' => 'Draft title', + + 'EDIT_REASON' => 'Reason for editing this post', + 'EMPTY_FILEUPLOAD' => 'The uploaded file is empty.', + 'EMPTY_MESSAGE' => 'You must enter a message when posting.', + 'EMPTY_REMOTE_DATA' => 'File could not be uploaded, please try uploading the file manually.', + + 'FLASH_IS_OFF' => '[flash] is OFF', + 'FLASH_IS_ON' => '[flash] is ON', + 'FLOOD_ERROR' => 'You cannot make another post so soon after your last.', + 'FONT_COLOR' => 'Font colour', + 'FONT_COLOR_HIDE' => 'Hide font colour', + 'FONT_HUGE' => 'Huge', + 'FONT_LARGE' => 'Large', + 'FONT_NORMAL' => 'Normal', + 'FONT_SIZE' => 'Font size', + 'FONT_SMALL' => 'Small', + 'FONT_TINY' => 'Tiny', + + 'GENERAL_UPLOAD_ERROR' => 'Could not upload attachment to %s.', + + 'IMAGES_ARE_OFF' => '[img] is OFF', + 'IMAGES_ARE_ON' => '[img] is ON', + 'INVALID_FILENAME' => '%s is an invalid filename.', + + 'LOAD' => 'Load', + 'LOAD_DRAFT' => 'Load draft', + 'LOAD_DRAFT_EXPLAIN' => 'Here you are able to select the draft you want to continue writing. Your current post will be cancelled, all current post contents will be deleted. View, edit and delete drafts within your User Control Panel.', + 'LOGIN_EXPLAIN_BUMP' => 'You need to login in order to bump topics within this forum.', + 'LOGIN_EXPLAIN_DELETE' => 'You need to login in order to delete posts within this forum.', + 'LOGIN_EXPLAIN_SOFT_DELETE' => 'You need to login in order to soft-delete posts within this forum.', + 'LOGIN_EXPLAIN_POST' => 'You need to login in order to post within this forum.', + 'LOGIN_EXPLAIN_QUOTE' => 'You need to login in order to quote posts within this forum.', + 'LOGIN_EXPLAIN_REPLY' => 'You need to login in order to reply to topics within this forum.', + + 'MAX_FONT_SIZE_EXCEEDED' => 'You may only use fonts up to size %d.', + 'MAX_FLASH_HEIGHT_EXCEEDED' => array( + 1 => 'Your flash files may only be up to %d pixel high.', + 2 => 'Your flash files may only be up to %d pixels high.', + ), + 'MAX_FLASH_WIDTH_EXCEEDED' => array( + 1 => 'Your flash files may only be up to %d pixel wide.', + 2 => 'Your flash files may only be up to %d pixels wide.', + ), + 'MAX_IMG_HEIGHT_EXCEEDED' => array( + 1 => 'Your images may only be up to %1$d pixel high.', + 2 => 'Your images may only be up to %1$d pixels high.', + ), + 'MAX_IMG_WIDTH_EXCEEDED' => array( + 1 => 'Your images may only be up to %d pixel wide.', + 2 => 'Your images may only be up to %d pixels wide.', + ), + + 'MESSAGE_BODY_EXPLAIN' => array( + 0 => '', // zero means no limit, so we don't view a message here. + 1 => 'Enter your message here, it may contain no more than %d character.', + 2 => 'Enter your message here, it may contain no more than %d characters.', + ), + 'MESSAGE_DELETED' => 'This message has been deleted successfully.', + 'MORE_SMILIES' => 'View more smilies', + + 'NOTIFY_REPLY' => 'Notify me when a reply is posted', + 'NOT_UPLOADED' => 'File could not be uploaded.', + 'NO_DELETE_POLL_OPTIONS' => 'You cannot delete existing poll options.', + 'NO_PM_ICON' => 'No PM icon', + 'NO_POLL_TITLE' => 'You have to enter a poll title.', + 'NO_POST' => 'The requested post does not exist.', + 'NO_POST_MODE' => 'No post mode specified.', + 'NO_TEMP_DIR' => 'Temporary folder could not be found or is not writable.', + + 'PARTIAL_UPLOAD' => 'The uploaded file was only partially uploaded.', + 'PHP_UPLOAD_STOPPED' => 'A PHP extension has stopped the file upload.', + 'PHP_SIZE_NA' => 'The attachment’s file size is too large.
Could not determine the maximum size defined by PHP in php.ini.', + 'PHP_SIZE_OVERRUN' => 'The attachment’s file size is too large, the maximum upload size is %1$d %2$s.
Please note this is set in php.ini and cannot be overridden.', + 'PLACE_INLINE' => 'Place inline', + 'POLL_DELETE' => 'Delete poll', + 'POLL_FOR' => 'Run poll for', + 'POLL_FOR_EXPLAIN' => 'Enter 0 for a never ending poll.', + 'POLL_MAX_OPTIONS' => 'Options per user', + 'POLL_MAX_OPTIONS_EXPLAIN' => 'This is the number of options each user may select when voting.', + 'POLL_OPTIONS' => 'Poll options', + 'POLL_OPTIONS_EXPLAIN' => array( + 1 => 'Place each option on a new line. You may enter %d option.', + 2 => 'Place each option on a new line. You may enter up to %d options.', + ), + 'POLL_OPTIONS_EDIT_EXPLAIN' => array( + 1 => 'Place each option on a new line. You may enter %d option. If you remove or add options all previous votes will be reset.', + 2 => 'Place each option on a new line. You may enter up to %d options. If you remove or add options all previous votes will be reset.', + ), + 'POLL_QUESTION' => 'Poll question', + 'POLL_TITLE_TOO_LONG' => 'The poll title must contain fewer than 100 characters.', + 'POLL_TITLE_COMP_TOO_LONG' => 'The parsed size of your poll title is too large, consider removing BBCodes or smilies.', + 'POLL_VOTE_CHANGE' => 'Allow re-voting', + 'POLL_VOTE_CHANGE_EXPLAIN' => 'If enabled users are able to change their vote.', + 'POSTED_ATTACHMENTS' => 'Posted attachments', + 'POST_APPROVAL_NOTIFY' => 'You will be notified when your post has been approved.', + 'POST_CONFIRMATION' => 'Confirmation of post', + 'POST_CONFIRM_EXPLAIN' => 'To prevent automated posts the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', + 'POST_DELETED' => 'This post has been deleted successfully.', + 'POST_EDITED' => 'This post has been edited successfully.', + 'POST_EDITED_MOD' => 'This post has been edited successfully, but it will need to be approved by a moderator before it is publicly viewable.', + 'POST_GLOBAL' => 'Global', + 'POST_ICON' => 'Post icon', + 'POST_NORMAL' => 'Normal', + 'POST_REVIEW' => 'Post review', + 'POST_REVIEW_EDIT' => 'Post review', + 'POST_REVIEW_EDIT_EXPLAIN' => 'This post has been altered by another user while you were editing it. You may wish to review the current version of this post and adjust your edits.', + 'POST_REVIEW_EXPLAIN' => 'At least one new post has been made to this topic. You may wish to review your post in light of this.', + 'POST_STORED' => 'This message has been posted successfully.', + 'POST_STORED_MOD' => 'This message has been submitted successfully, but it will need to be approved by a moderator before it is publicly viewable.', + 'POST_TOPIC_AS' => 'Post topic as', + 'PROGRESS_BAR' => 'Progress bar', + + 'QUOTE_DEPTH_EXCEEDED' => array( + 1 => 'You may embed only %d quote within each other.', + 2 => 'You may embed only %d quotes within each other.', + ), + 'QUOTE_NO_NESTING' => 'You may not embed quotes within each other.', + + 'REMOTE_UPLOAD_TIMEOUT' => 'The specified file could not be uploaded because the request timed out.', + 'SAVE' => 'Save', + 'SAVE_DATE' => 'Saved at', + 'SAVE_DRAFT' => 'Save draft', + 'SAVE_DRAFT_CONFIRM' => 'Please note that saved drafts only include the subject and the message, any other element will be removed. Do you want to save your draft now?', + 'SMILIES' => 'Smilies', + 'SMILIES_ARE_OFF' => 'Smilies are OFF', + 'SMILIES_ARE_ON' => 'Smilies are ON', + 'STICKY_ANNOUNCE_TIME_LIMIT'=> 'Sticky/Announcement/Global time limit', + 'STICK_TOPIC_FOR' => 'Stick topic for', + 'STICK_TOPIC_FOR_EXPLAIN' => 'Enter 0 for a never ending Sticky/Announcement/Global. Please note that this number is relative to the date of the post.', + 'STYLES_TIP' => 'Tip: Styles can be applied quickly to selected text.', + + 'TOO_FEW_CHARS' => 'Your message contains too few characters.', + 'TOO_FEW_CHARS_LIMIT' => array( + 1 => 'You need to enter at least %1$d character.', + 2 => 'You need to enter at least %1$d characters.', + ), + 'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.', + 'TOO_MANY_ATTACHMENTS' => 'Cannot add another attachment, %d is the maximum.', + 'TOO_MANY_CHARS' => 'Your message contains too many characters.', + 'TOO_MANY_CHARS_LIMIT' => array( + 2 => 'The maximum number of allowed characters is %1$d.', + ), + 'TOO_MANY_POLL_OPTIONS' => 'You have tried to enter too many poll options.', + 'TOO_MANY_SMILIES' => 'Your message contains too many smilies. The maximum number of smilies allowed is %d.', + 'TOO_MANY_URLS' => 'Your message contains too many URLs. The maximum number of URLs allowed is %d.', + 'TOO_MANY_USER_OPTIONS' => 'You cannot specify more options per user than existing poll options.', + 'TOPIC_BUMPED' => 'Topic has been bumped successfully.', + + 'UNAUTHORISED_BBCODE' => 'You cannot use certain BBCodes: %s.', + 'UNGLOBALISE_EXPLAIN' => 'To switch this topic back from being global to a normal topic, you need to select the forum you wish this topic to be displayed.', + 'UNSUPPORTED_CHARACTERS_MESSAGE' => 'Your message contains the following unsupported characters:
%s', + 'UNSUPPORTED_CHARACTERS_SUBJECT' => 'Your subject contains the following unsupported characters:
%s', + 'UPDATE_COMMENT' => 'Update comment', + 'URL_INVALID' => 'The URL you specified is invalid.', + 'URL_NOT_FOUND' => 'The file specified could not be found.', + 'URL_IS_OFF' => '[url] is OFF', + 'URL_IS_ON' => '[url] is ON', + 'USER_CANNOT_BUMP' => 'You cannot bump topics in this forum.', + 'USER_CANNOT_DELETE' => 'You cannot delete posts in this forum.', + 'USER_CANNOT_EDIT' => 'You cannot edit posts in this forum.', + 'USER_CANNOT_REPLY' => 'You cannot reply in this forum.', + 'USER_CANNOT_FORUM_POST' => 'You are not able to do posting operations on this forum due to the forum type not supporting it.', + + 'VIEW_MESSAGE' => '%sView your submitted message%s', + 'VIEW_PRIVATE_MESSAGE' => '%sView your submitted private message%s', + + 'WRONG_FILESIZE' => 'The file is too big, maximum allowed size is %1$d %2$s.', + 'WRONG_SIZE' => 'The image must be at least %1$s wide, %2$s high and at most %3$s wide and %4$s high. The submitted image is %5$s wide and %6$s high.', +)); diff --git a/install/update/old/language/en/ucp.php b/install/update/old/language/en/ucp.php new file mode 100644 index 0000000..2622fb5 --- /dev/null +++ b/install/update/old/language/en/ucp.php @@ -0,0 +1,662 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* DO NOT CHANGE +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +if (empty($lang) || !is_array($lang)) +{ + $lang = array(); +} + +// DEVELOPERS PLEASE NOTE +// +// All language files should use UTF-8 as their encoding and the files must not contain a BOM. +// +// Placeholders can now contain order information, e.g. instead of +// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows +// translators to re-order the output of data while ensuring it remains correct +// +// You do not need this where single placeholders are used, e.g. 'Message %d' is fine +// equally where a string contains only two placeholders which are used to wrap text +// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine + +// Privacy policy and T&C +$lang = array_merge($lang, array( + 'TERMS_OF_USE_CONTENT' => 'By accessing “%1$s” (hereinafter “we”, “us”, “our”, “%1$s”, “%2$s”), you agree to be legally bound by the following terms. If you do not agree to be legally bound by all of the following terms then please do not access and/or use “%1$s”. We may change these at any time and we’ll do our utmost in informing you, though it would be prudent to review this regularly yourself as your continued usage of “%1$s” after changes mean you agree to be legally bound by these terms as they are updated and/or amended.
+
+ Our forums are powered by phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Limited”, “phpBB Teams”) which is a bulletin board solution released under the “GNU General Public License v2” (hereinafter “GPL”) and can be downloaded from www.phpbb.com. The phpBB software only facilitates internet based discussions; phpBB Limited is not responsible for what we allow and/or disallow as permissible content and/or conduct. For further information about phpBB, please see: https://www.phpbb.com/.
+
+ You agree not to post any abusive, obscene, vulgar, slanderous, hateful, threatening, sexually-orientated or any other material that may violate any laws be it of your country, the country where “%1$s” is hosted or International Law. Doing so may lead to you being immediately and permanently banned, with notification of your Internet Service Provider if deemed required by us. The IP address of all posts are recorded to aid in enforcing these conditions. You agree that “%1$s” have the right to remove, edit, move or close any topic at any time should we see fit. As a user you agree to any information you have entered to being stored in a database. While this information will not be disclosed to any third party without your consent, neither “%1$s” nor phpBB shall be held responsible for any hacking attempt that may lead to the data being compromised. + ', + + 'PRIVACY_POLICY' => 'This policy explains in detail how “%1$s” along with its affiliated companies (hereinafter “we”, “us”, “our”, “%1$s”, “%2$s”) and phpBB (hereinafter “they”, “them”, “their”, “phpBB software”, “www.phpbb.com”, “phpBB Limited”, “phpBB Teams”) use any information collected during any session of usage by you (hereinafter “your information”).
+
+ Your information is collected via two ways. Firstly, by browsing “%1$s” will cause the phpBB software to create a number of cookies, which are small text files that are downloaded on to your computer’s web browser temporary files. The first two cookies just contain a user identifier (hereinafter “user-id”) and an anonymous session identifier (hereinafter “session-id”), automatically assigned to you by the phpBB software. A third cookie will be created once you have browsed topics within “%1$s” and is used to store which topics have been read, thereby improving your user experience.
+
+ We may also create cookies external to the phpBB software whilst browsing “%1$s”, though these are outside the scope of this document which is intended to only cover the pages created by the phpBB software. The second way in which we collect your information is by what you submit to us. This can be, and is not limited to: posting as an anonymous user (hereinafter “anonymous posts”), registering on “%1$s” (hereinafter “your account”) and posts submitted by you after registration and whilst logged in (hereinafter “your posts”).
+
+ Your account will at a bare minimum contain a uniquely identifiable name (hereinafter “your user name”), a personal password used for logging into your account (hereinafter “your password”) and a personal, valid email address (hereinafter “your email”). Your information for your account at “%1$s” is protected by data-protection laws applicable in the country that hosts us. Any information beyond your user name, your password, and your email address required by “%1$s” during the registration process is either mandatory or optional, at the discretion of “%1$s”. In all cases, you have the option of what information in your account is publicly displayed. Furthermore, within your account, you have the option to opt-in or opt-out of automatically generated emails from the phpBB software.
+
+ Your password is ciphered (a one-way hash) so that it is secure. However, it is recommended that you do not reuse the same password across a number of different websites. Your password is the means of accessing your account at “%1$s”, so please guard it carefully and under no circumstance will anyone affiliated with “%1$s”, phpBB or another 3rd party, legitimately ask you for your password. Should you forget your password for your account, you can use the “I forgot my password” feature provided by the phpBB software. This process will ask you to submit your user name and your email, then the phpBB software will generate a new password to reclaim your account.
+ ', +)); + +// Common language entries +$lang = array_merge($lang, array( + 'ACCOUNT_ACTIVE' => 'Your account has now been activated. Thank you for registering.', + 'ACCOUNT_ACTIVE_ADMIN' => 'The account has now been activated.', + 'ACCOUNT_ACTIVE_PROFILE' => 'Your account has now been successfully reactivated.', + 'ACCOUNT_ADDED' => 'Thank you for registering, your account has been created. You may now login with your username and password.', + 'ACCOUNT_COPPA' => 'Your account has been created but has to be approved, please check your email for details.', + 'ACCOUNT_EMAIL_CHANGED' => 'Your account has been updated. However, this board requires account reactivation on email changes. An activation key has been sent to the new email address you provided. Please check your email for further information.', + 'ACCOUNT_EMAIL_CHANGED_ADMIN' => 'Your account has been updated. However, this board requires account reactivation by the administrators on email changes. An email has been sent to them and you will be informed when your account has been reactivated.', + 'ACCOUNT_INACTIVE' => 'Your account has been created. However, this board requires account activation. An activation key has been sent to the email address you provided. Please check your email for further information and also be sure to check your junk mail box. It may take a while to get the email depending on your email provider.', + 'ACCOUNT_INACTIVE_ADMIN' => 'Your account has been created. However, this board requires account activation by the administrator group. An email has been sent to them and you will be informed when your account has been activated.', + 'ACTIVATION_EMAIL_SENT' => 'The activation email has been sent to your email address.', + 'ACTIVATION_EMAIL_SENT_ADMIN' => 'The activation email has been sent to the administrators email addresses.', + 'ADD' => 'Add', + 'ADD_BCC' => 'Add [BCC]', + 'ADD_FOES' => 'Add new foes', + 'ADD_FOES_EXPLAIN' => 'You may enter several usernames each on a different line.', + 'ADD_FOLDER' => 'Add folder', + 'ADD_FRIENDS' => 'Add new friends', + 'ADD_FRIENDS_EXPLAIN' => 'You may enter several usernames each on a different line.', + 'ADD_NEW_RULE' => 'Add new rule', + 'ADD_RULE' => 'Add rule', + 'ADD_TO' => 'Add [To]', + 'ADD_USERS_UCP_EXPLAIN' => 'Here you can add new users to the group. You may select whether this group becomes the new default for the selected users. Please enter each username on a separate line.', + 'ADMIN_EMAIL' => 'Administrators can email me information', + 'AGREE' => 'I agree to these terms', + 'ALLOW_PM' => 'Allow users to send you private messages', + 'ALLOW_PM_EXPLAIN' => 'Note that administrators and moderators will always be able to send you messages.', + 'ALREADY_ACTIVATED' => 'You have already activated your account.', + 'ATTACHMENTS_EXPLAIN' => 'This is a list of attachments you have made in posts to this board.', + 'ATTACHMENTS_DELETED' => 'Attachments successfully deleted.', + 'ATTACHMENT_DELETED' => 'Attachment successfully deleted.', + 'AUTOLOGIN_SESSION_KEYS_DELETED'=> 'The selected "Remember Me" login keys were successfully deleted.', + 'AVATAR_CATEGORY' => 'Category', + 'AVATAR_DRIVER_GRAVATAR_TITLE' => 'Gravatar', + 'AVATAR_DRIVER_GRAVATAR_EXPLAIN'=> 'Gravatar is a service that allows you to maintain the same avatar across multiple websites. Visit Gravatar for more information.', + 'AVATAR_DRIVER_LOCAL_TITLE' => 'Gallery avatar', + 'AVATAR_DRIVER_LOCAL_EXPLAIN' => 'You can choose your avatar from a locally available set of avatars.', + 'AVATAR_DRIVER_REMOTE_TITLE' => 'Remote avatar', + 'AVATAR_DRIVER_REMOTE_EXPLAIN' => 'Link to avatar images from another website.', + 'AVATAR_DRIVER_UPLOAD_TITLE' => 'Upload avatar', + 'AVATAR_DRIVER_UPLOAD_EXPLAIN' => 'Upload your own custom avatar.', + 'AVATAR_EXPLAIN' => 'Maximum dimensions; width: %1$s, height: %2$s, file size: %3$.2f KiB.', + 'AVATAR_EXPLAIN_NO_FILESIZE' => 'Maximum dimensions; width: %1$s, height: %2$s.', + 'AVATAR_FEATURES_DISABLED' => 'The avatar functionality is currently disabled.', + 'AVATAR_GALLERY' => 'Local gallery', + 'AVATAR_GENERAL_UPLOAD_ERROR' => 'Could not upload avatar to %s.', + 'AVATAR_NOT_ALLOWED' => 'Your avatar cannot be displayed because avatars have been disallowed.', + 'AVATAR_PAGE' => 'Page', + 'AVATAR_SELECT' => 'Select your avatar', + 'AVATAR_TYPE' => 'Avatar type', + 'AVATAR_TYPE_NOT_ALLOWED' => 'Your current avatar cannot be displayed because its type has been disallowed.', + + 'BACK_TO_DRAFTS' => 'Back to saved drafts', + 'BACK_TO_LOGIN' => 'Back to login screen', + 'BIRTHDAY' => 'Birthday', + 'BIRTHDAY_EXPLAIN' => 'Setting a year will list your age when it is your birthday.', + 'BOARD_DATE_FORMAT' => 'My date format', + 'BOARD_DATE_FORMAT_EXPLAIN' => 'The syntax used is identical to the PHP date() function.', + 'BOARD_LANGUAGE' => 'My language', + 'BOARD_STYLE' => 'My board style', + 'BOARD_TIMEZONE' => 'My timezone', + 'BOOKMARKS' => 'Bookmarks', + 'BOOKMARKS_EXPLAIN' => 'You can bookmark topics for future reference. Select the checkbox for any bookmark you wish to delete, then press the Remove marked bookmarks button.', + 'BOOKMARKS_DISABLED' => 'Bookmarks are disabled on this board.', + 'BOOKMARKS_REMOVED' => 'Bookmarks removed successfully.', + + 'CANNOT_EDIT_MESSAGE_TIME' => 'You can no longer edit or delete that message.', + 'CANNOT_MOVE_TO_SAME_FOLDER'=> 'Messages cannot be moved to the folder you want to remove.', + 'CANNOT_MOVE_FROM_SPECIAL' => 'Messages cannot be moved from the outbox.', + 'CANNOT_RENAME_FOLDER' => 'This folder cannot be renamed.', + 'CANNOT_REMOVE_FOLDER' => 'This folder cannot be removed.', + 'CHANGE_DEFAULT_GROUP' => 'Change default group', + 'CHANGE_PASSWORD' => 'Change password', + 'CLICK_GOTO_FOLDER' => '%1$sGo to your “%3$s” folder%2$s', + 'CLICK_RETURN_FOLDER' => '%1$sReturn to your “%3$s” folder%2$s', + 'CONFIRMATION' => 'Confirmation of registration', + 'CONFIRM_CHANGES' => 'Confirm changes', + 'CONFIRM_EXPLAIN' => 'To prevent automated registrations the board requires you to enter a confirmation code. The code is displayed in the image you should see below. If you are visually impaired or cannot otherwise read this code please contact the %sBoard Administrator%s.', + 'VC_REFRESH' => 'Refresh confirmation code', + 'VC_REFRESH_EXPLAIN' => 'If you cannot read the code you can request a new one by clicking the button.', + + 'CONFIRM_PASSWORD' => 'Confirm password', + 'CONFIRM_PASSWORD_EXPLAIN' => 'You only need to confirm your password if you changed it above.', + 'COPPA_BIRTHDAY' => 'To continue with the registration procedure please tell us when you were born.', + 'COPPA_COMPLIANCE' => 'COPPA compliance', + 'COPPA_EXPLAIN' => 'Please note that clicking submit will create your account. However it cannot be activated until a parent or guardian approves your registration. You will be emailed a copy of the necessary form with details of where to send it.', + 'CREATE_FOLDER' => 'Add folder…', + 'CURRENT_IMAGE' => 'Current image', + 'CURRENT_PASSWORD' => 'Current password', + 'CURRENT_PASSWORD_EXPLAIN' => 'You must enter your current password if you wish to alter your email address or username.', + 'CURRENT_CHANGE_PASSWORD_EXPLAIN' => 'To change your password, your email address, or your username, you must enter your current password.', + 'CUR_PASSWORD_EMPTY' => 'You did not enter your current password.', + 'CUR_PASSWORD_ERROR' => 'The current password you entered is incorrect.', + 'CUSTOM_DATEFORMAT' => 'Custom…', + + 'DEFAULT_ACTION' => 'Default action', + 'DEFAULT_ACTION_EXPLAIN' => 'This action will be triggered if none of the above is applicable.', + 'DEFAULT_ADD_SIG' => 'Attach my signature by default', + 'DEFAULT_BBCODE' => 'Enable BBCode by default', + 'DEFAULT_NOTIFY' => 'Notify me upon replies by default', + 'DEFAULT_SMILIES' => 'Enable smilies by default', + 'DEFINED_RULES' => 'Defined rules', + 'DELETED_TOPIC' => 'Topic has been removed.', + 'DELETE_ATTACHMENT' => 'Delete attachment', + 'DELETE_ATTACHMENTS' => 'Delete attachments', + 'DELETE_ATTACHMENT_CONFIRM' => 'Are you sure you want to delete this attachment?', + 'DELETE_ATTACHMENTS_CONFIRM'=> 'Are you sure you want to delete these attachments?', + 'DELETE_AVATAR' => 'Delete image', + 'DELETE_COOKIES_CONFIRM' => 'Are you sure you want to delete all cookies set by this board?', + 'DELETE_MARKED_PM' => 'Delete marked messages', + 'DELETE_MARKED_PM_CONFIRM' => 'Are you sure you want to delete all marked messages?', + 'DELETE_OLDEST_MESSAGES' => 'Delete oldest messages', + 'DELETE_MESSAGE' => 'Delete message', + 'DELETE_MESSAGE_CONFIRM' => 'Are you sure you want to delete this private message?', + 'DELETE_MESSAGES_IN_FOLDER' => 'Delete all messages within removed folder', + 'DELETE_RULE' => 'Delete rule', + 'DELETE_RULE_CONFIRM' => 'Are you sure you want to delete this rule?', + 'DEMOTE_SELECTED' => 'Demote selected', + 'DISABLE_CENSORS' => 'Enable word censoring', + 'DISPLAY_GALLERY' => 'Display gallery', + 'DOMAIN_NO_MX_RECORD_EMAIL' => 'The entered email domain has no valid MX record.', + 'DOWNLOADS' => 'Downloads', + 'DRAFTS_DELETED' => 'All selected drafts were successfully deleted.', + 'DRAFTS_EXPLAIN' => 'Here you can view, edit and delete your saved drafts.', + 'DRAFT_UPDATED' => 'Draft successfully updated.', + + 'EDIT_DRAFT_EXPLAIN' => 'Here you are able to edit your draft. Drafts do not contain attachment and poll information.', + 'EMAIL_BANNED_EMAIL' => 'The email address you entered is not allowed to be used.', + 'EMAIL_REMIND' => 'This must be the email address associated with your account. If you have not changed this via your user control panel then it is the email address you registered your account with.', + 'EMAIL_TAKEN_EMAIL' => 'The entered email address is already in use.', + 'EMPTY_DRAFT' => 'You must enter a message to submit your changes.', + 'EMPTY_DRAFT_TITLE' => 'You must enter a draft title.', + 'EXPORT_AS_XML' => 'Export as XML', + 'EXPORT_AS_CSV' => 'Export as CSV', + 'EXPORT_AS_CSV_EXCEL' => 'Export as CSV (Excel)', + 'EXPORT_AS_TXT' => 'Export as TXT', + 'EXPORT_AS_MSG' => 'Export as MSG', + 'EXPORT_FOLDER' => 'Export this view', + + 'FIELD_REQUIRED' => 'The field “%s” must be completed.', + 'FIELD_TOO_SHORT' => array( + 1 => 'The field “%2$s” is too short, a minimum of %1$d character is required.', + 2 => 'The field “%2$s” is too short, a minimum of %1$d characters is required.', + ), + 'FIELD_TOO_LONG' => array( + 1 => 'The field “%2$s” is too long, a maximum of %1$d character is allowed.', + 2 => 'The field “%2$s” is too long, a maximum of %1$d characters is allowed.', + ), + 'FIELD_TOO_SMALL' => 'The value of “%2$s” is too small, a minimum value of %1$d is required.', + 'FIELD_TOO_LARGE' => 'The value of “%2$s” is too large, a maximum value of %1$d is allowed.', + 'FIELD_INVALID_CHARS_INVALID' => 'The field “%s” has invalid characters.', + 'FIELD_INVALID_CHARS_NUMBERS_ONLY' => 'The field “%s” has invalid characters, only numbers are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_DOTS' => 'The field “%s” has invalid characters, only alphanumeric or . characters are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_ONLY' => 'The field “%s” has invalid characters, only alphanumeric characters are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_PUNCTUATION' => 'The field “%s” has invalid characters, only alphanumeric or _,-. characters are allowed and the first character must be alphabetic.', + 'FIELD_INVALID_CHARS_ALPHA_SPACERS' => 'The field “%s” has invalid characters, only alphanumeric, space or -+_[] characters are allowed.', + 'FIELD_INVALID_CHARS_ALPHA_UNDERSCORE' => 'The field “%s” has invalid characters, only alphanumeric or _ characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_DOTS' => 'The field “%s” has invalid characters, only letter, number or . characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_ONLY' => 'The field “%s” has invalid characters, only letter and number characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_PUNCTUATION' => 'The field “%s” has invalid characters, only letter, number or _,-. characters are allowed and the first character must be alphabetic.', + 'FIELD_INVALID_CHARS_LETTER_NUM_SPACERS' => 'The field “%s” has invalid characters, only letter, number, space or -+_[] characters are allowed.', + 'FIELD_INVALID_CHARS_LETTER_NUM_UNDERSCORE' => 'The field “%s” has invalid characters, only letter, number or _ characters are allowed.', + 'FIELD_INVALID_DATE' => 'The field “%s” has an invalid date.', + 'FIELD_INVALID_URL' => 'The field “%s” has an invalid url.', + 'FIELD_INVALID_VALUE' => 'The field “%s” has an invalid value.', + + 'FOE_MESSAGE' => 'Message from foe', + 'FOES_EXPLAIN' => 'Foes are users which will be ignored by default. Posts by these users will not be fully visible. Personal messages from foes are still permitted. Please note that you cannot ignore moderators or administrators.', + 'FOES_UPDATED' => 'Your foes list has been updated successfully.', + 'FOLDER_ADDED' => 'Folder successfully added.', + 'FOLDER_MESSAGE_STATUS' => array( + 1 => '%2$d out of %1$s stored', + 2 => '%2$d out of %1$s stored', + ), + 'FOLDER_NAME_EMPTY' => 'You must enter a name for this folder.', + 'FOLDER_NAME_EXIST' => 'Folder %s already exists.', + 'FOLDER_OPTIONS' => 'Folder options', + 'FOLDER_RENAMED' => 'Folder successfully renamed.', + 'FOLDER_REMOVED' => 'Folder successfully removed.', + 'FOLDER_STATUS_MSG' => array( + 1 => 'Folder is %3$d%% full (%2$d out of %1$s stored)', + 2 => 'Folder is %3$d%% full (%2$d out of %1$s stored)', + ), + 'FORWARD_PM' => 'Forward PM', + 'FORCE_PASSWORD_EXPLAIN' => 'Before you may continue browsing the board you are required to change your password.', + 'FRIEND_MESSAGE' => 'Message from friend', + 'FRIENDS' => 'Friends', + 'FRIENDS_EXPLAIN' => 'Friends enable you quick access to members you communicate with frequently. If the template has relevant support any posts made by a friend may be highlighted.', + 'FRIENDS_OFFLINE' => 'Offline', + 'FRIENDS_ONLINE' => 'Online', + 'FRIENDS_UPDATED' => 'Your friends list has been updated successfully.', + 'FULL_FOLDER_OPTION_CHANGED'=> 'The action to take when a folder is full has been changed successfully.', + 'FWD_ORIGINAL_MESSAGE' => '-------- Original Message --------', + 'FWD_SUBJECT' => 'Subject: %s', + 'FWD_DATE' => 'Date: %s', + 'FWD_FROM' => 'From: %s', + 'FWD_TO' => 'To: %s', + + 'GLOBAL_ANNOUNCEMENT' => 'Global announcement', + + 'GRAVATAR_AVATAR_EMAIL' => 'Gravatar email', + 'GRAVATAR_AVATAR_EMAIL_EXPLAIN' => 'Enter the email address you used for registering your account on Gravatar.', + 'GRAVATAR_AVATAR_SIZE' => 'Avatar dimensions', + 'GRAVATAR_AVATAR_SIZE_EXPLAIN' => 'Specify the width and height of the avatar, leave blank to attempt automatic verification.', + + 'HIDE_ONLINE' => 'Hide my online status', + 'HIDE_ONLINE_EXPLAIN' => 'Changing this setting won’t become effective until your next visit to the board.', + 'HOLD_NEW_MESSAGES' => 'Do not accept new messages (New messages will be held back until enough space is available)', + 'HOLD_NEW_MESSAGES_SHORT' => 'New messages will be held back', + + 'IF_FOLDER_FULL' => 'If folder is full', + 'IMPORTANT_NEWS' => 'Important announcements', + 'INVALID_USER_BIRTHDAY' => 'The entered birthday is not a valid date.', + 'INVALID_CHARS_USERNAME' => 'The username contains forbidden characters.', + 'INVALID_EMOJIS_USERNAME' => 'The username contains forbidden characters (Emoji).', + 'INVALID_CHARS_NEW_PASSWORD'=> 'The password does not contain the required characters.', + 'ITEMS_REQUIRED' => 'The items marked with * are required profile fields and need to be filled out.', + + 'JOIN_SELECTED' => 'Join selected', + + 'LANGUAGE' => 'Language', + 'LINK_REMOTE_AVATAR' => 'Link off-site', + 'LINK_REMOTE_AVATAR_EXPLAIN'=> 'Enter the URL of the location containing the avatar image you wish to link to.', + 'LINK_REMOTE_SIZE' => 'Avatar dimensions', + 'LINK_REMOTE_SIZE_EXPLAIN' => 'Specify the width and height of the avatar, leave blank to attempt automatic verification.', + 'LOGIN_EXPLAIN_UCP' => 'Please login in order to access the User Control Panel.', + 'LOGIN_LINK' => 'Link or register your account on an external service with your board account', + 'LOGIN_LINK_EXPLAIN' => 'You have attempted to login with an external service that is not yet connected to an account on this board. You must now either link this account to an existing account or create a new account.', + 'LOGIN_LINK_MISSING_DATA' => 'Data that is necessary to link your account with an external service is not available. Please restart the login process.', + 'LOGIN_LINK_NO_DATA_PROVIDED' => 'No data has been provided to this page to link an external account to a forum account. Please contact the board administrator if you continue to experience problems.', + 'LOGIN_KEY' => 'Login Key', + 'LOGIN_TIME' => 'Login Time', + 'LOGIN_REDIRECT' => 'You have been successfully logged in.', + 'LOGOUT_FAILED' => 'You were not logged out, as the request did not match your session. Please contact the board administrator if you continue to experience problems.', + 'LOGOUT_REDIRECT' => 'You have been successfully logged out.', + + 'MARK_IMPORTANT' => 'Mark/Unmark as important', + 'MARKED_MESSAGE' => 'Marked message', + 'MAX_FOLDER_REACHED' => 'Maximum number of allowed user defined folders reached.', + 'MESSAGE_BY_AUTHOR' => 'by', + 'MESSAGE_COLOURS' => 'Message colours', + 'MESSAGE_DELETED' => 'Message successfully deleted.', + 'MESSAGE_EDITED' => 'Message successfully edited.', + 'MESSAGE_HISTORY' => 'Message history', + 'MESSAGE_REMOVED_FROM_OUTBOX' => 'This message was deleted by its author.', + 'MESSAGE_REPORTED_MESSAGE' => 'Reported message', + 'MESSAGE_SENT_ON' => 'on', + 'MESSAGE_STORED' => 'This message has been sent successfully.', + 'MESSAGE_TO' => 'To', + 'MESSAGES_DELETED' => 'Messages successfully deleted', + 'MOVE_DELETED_MESSAGES_TO' => 'Move messages from removed folder to', + 'MOVE_DOWN' => 'Move down', + 'MOVE_MARKED_TO_FOLDER' => 'Move marked to %s', + 'MOVE_PM_ERROR' => array( + 1 => 'An error occurred while moving the messages to the new folder, only %2$d out of %1$s was moved.', + 2 => 'An error occurred while moving the messages to the new folder, only %2$d out of %1$s were moved.', + ), + 'MOVE_TO_FOLDER' => 'Move to folder', + 'MOVE_UP' => 'Move up', + + 'NEW_FOLDER_NAME' => 'New folder name', + 'NEW_PASSWORD' => 'New password', + 'NEW_PASSWORD_CONFIRM_EMPTY' => 'You did not enter a confirm password.', + 'NEW_PASSWORD_ERROR' => 'The passwords you entered do not match.', + + 'NOTIFICATIONS_MARK_ALL_READ' => 'Mark all notifications read', + 'NOTIFICATIONS_MARK_ALL_READ_CONFIRM' => 'Are you sure you want to mark all notifications read?', + 'NOTIFICATIONS_MARK_ALL_READ_SUCCESS' => 'All notifications have been marked read.', + 'NOTIFICATION_GROUP_MISCELLANEOUS' => 'Miscellaneous Notifications', + 'NOTIFICATION_GROUP_MODERATION' => 'Moderation Notifications', + 'NOTIFICATION_GROUP_ADMINISTRATION' => 'Administration Notifications', + 'NOTIFICATION_GROUP_POSTING' => 'Posting Notifications', + 'NOTIFICATION_METHOD_BOARD' => 'Notifications', + 'NOTIFICATION_METHOD_EMAIL' => 'Email', + 'NOTIFICATION_METHOD_JABBER' => 'Jabber', + 'NOTIFICATION_TYPE' => 'Notification type', + 'NOTIFICATION_TYPE_BOOKMARK' => 'Someone replies to a topic you have bookmarked', + 'NOTIFICATION_TYPE_GROUP_REQUEST' => 'Someone requests to join a group you lead', + 'NOTIFICATION_TYPE_IN_MODERATION_QUEUE' => 'A post or topic needs approval', + 'NOTIFICATION_TYPE_MODERATION_QUEUE' => 'Your topics/posts are approved or disapproved by a moderator', + 'NOTIFICATION_TYPE_PM' => 'Someone sends you a private message', + 'NOTIFICATION_TYPE_POST' => 'Someone replies to a topic to which you are subscribed', + 'NOTIFICATION_TYPE_QUOTE' => 'Someone quotes you in a post', + 'NOTIFICATION_TYPE_REPORT' => 'Someone reports a post', + 'NOTIFICATION_TYPE_TOPIC' => 'Someone creates a topic in a forum to which you are subscribed', + 'NOTIFICATION_TYPE_ADMIN_ACTIVATE_USER' => 'User requiring activation', + + 'NOTIFY_METHOD' => 'Notification method', + 'NOTIFY_METHOD_BOTH' => 'Both', + 'NOTIFY_METHOD_EMAIL' => 'Email only', + 'NOTIFY_METHOD_EXPLAIN' => 'Method for sending messages sent via this board.', + 'NOTIFY_METHOD_IM' => 'Jabber only', + 'NOTIFY_ON_PM' => 'Notify me on new private messages', + 'NOT_ADDED_FRIENDS_ANONYMOUS' => 'You cannot add the anonymous user to your friends list.', + 'NOT_ADDED_FRIENDS_BOTS' => 'You cannot add bots to your friends list.', + 'NOT_ADDED_FRIENDS_FOES' => 'You cannot add users to your friends list who are on your foes list.', + 'NOT_ADDED_FRIENDS_SELF' => 'You cannot add yourself to the friends list.', + 'NOT_ADDED_FOES_MOD_ADMIN' => 'You cannot add administrators and moderators to your foes list.', + 'NOT_ADDED_FOES_ANONYMOUS' => 'You cannot add the anonymous user to your foes list.', + 'NOT_ADDED_FOES_BOTS' => 'You cannot add bots to your foes list.', + 'NOT_ADDED_FOES_FRIENDS' => 'You cannot add users to your foes list who are on your friends list.', + 'NOT_ADDED_FOES_SELF' => 'You cannot add yourself to the foes list.', + 'NOT_AGREE' => 'I do not agree to these terms', + 'NOT_ENOUGH_SPACE_FOLDER' => 'The destination folder “%s” seems to be full. The requested action has not been taken.', + 'NOT_MOVED_MESSAGES' => array( + 1 => 'You have %d private message currently on hold because of full folder.', + 2 => 'You have %d private messages currently on hold because of full folder.', + ), + 'NO_ACTION_MODE' => 'No message action specified.', + 'NO_AUTHOR' => 'No author defined for this message', + 'NO_AVATAR' => 'No avatar selected', + 'NO_AVATAR_CATEGORY' => 'None', + + 'NO_AUTH_DELETE_MESSAGE' => 'You are not authorised to delete private messages.', + 'NO_AUTH_EDIT_MESSAGE' => 'You are not authorised to edit private messages.', + 'NO_AUTH_FORWARD_MESSAGE' => 'You are not authorised to forward private messages.', + 'NO_AUTH_GROUP_MESSAGE' => 'You are not authorised to send private messages to groups.', + 'NO_AUTH_PROFILEINFO' => 'You are not authorised to change your profile information.', + 'NO_AUTH_READ_HOLD_MESSAGE' => 'You are not authorised to read private messages that are on hold.', + 'NO_AUTH_READ_MESSAGE' => 'You are not authorised to read private messages.', + 'NO_AUTH_PRINT_MESSAGE' => 'You are not authorised to print private messages.', + 'NO_AUTH_READ_REMOVED_MESSAGE' => 'You are not able to read this message because it was removed by the author.', + 'NO_AUTH_SEND_MESSAGE' => 'You are not authorised to send private messages.', + 'NO_AUTH_SIGNATURE' => 'You are not authorised to define a signature.', + + 'NO_BCC_RECIPIENT' => 'None', + 'NO_BOOKMARKS' => 'You have no bookmarks.', + 'NO_BOOKMARKS_SELECTED' => 'You have selected no bookmarks.', + 'NO_EDIT_READ_MESSAGE' => 'Private message cannot be edited because it has already been read.', + 'NO_EMAIL_USER' => 'The email/username information submitted could not be found.', + 'EMAIL_NOT_UNIQUE' => 'Email you specified is used by multiple users. You must specify username as well.', + 'NO_FOES' => 'No foes currently defined', + 'NO_FRIENDS' => 'No friends currently defined', + 'NO_FRIENDS_OFFLINE' => 'No friends offline', + 'NO_FRIENDS_ONLINE' => 'No friends online', + 'NO_GROUP_SELECTED' => 'No group specified.', + 'NO_IMPORTANT_NEWS' => 'No important announcements present.', + 'NO_MESSAGE' => 'Private message could not be found.', + 'NO_NEW_FOLDER_NAME' => 'You have to specify a new folder name.', + 'NO_NEWER_PM' => 'No newer messages.', + 'NO_OLDER_PM' => 'No older messages.', + 'NO_PASSWORD_SUPPLIED' => 'You cannot login without a password.', + 'NO_RECIPIENT' => 'No recipient defined.', + 'NO_RULES_DEFINED' => 'No rules defined.', + 'NO_SAVED_DRAFTS' => 'No drafts saved.', + 'NO_TO_RECIPIENT' => 'None', + 'NO_WATCHED_FORUMS' => 'You are not subscribed to any forums.', + 'NO_WATCHED_SELECTED' => 'You have not selected any subscribed topics or forums.', + 'NO_WATCHED_TOPICS' => 'You are not subscribed to any topics.', + + 'PASS_TYPE_ALPHA_EXPLAIN' => 'Password must be between %1$s and %2$s long, must contain letters in mixed case and must contain numbers.', + 'PASS_TYPE_ANY_EXPLAIN' => 'Must be between %1$s and %2$s.', + 'PASS_TYPE_CASE_EXPLAIN' => 'Password must be between %1$s and %2$s long and must contain letters in mixed case.', + 'PASS_TYPE_SYMBOL_EXPLAIN' => 'Password must be between %1$s and %2$s long, must contain letters in mixed case, must contain numbers and must contain symbols.', + 'PASSWORD' => 'Password', + 'PASSWORD_ACTIVATED' => 'Your new password has been activated.', + 'PASSWORD_UPDATED_IF_EXISTED' => 'If your account exists, a new password was sent to your registered email address. If you do not receive an email, it may be because you are banned, your account is not activated, or you are not allowed to change your password. Contact admin if any of those reasons apply. Also, check your spam filter.', + 'PERMISSIONS_RESTORED' => 'Successfully restored original permissions.', + 'PERMISSIONS_TRANSFERRED' => 'Successfully transferred permissions from %s, you are now able to browse the board with this user’s permissions.
Please note that admin permissions were not transferred. You are able to revert to your permission set at any time.', + 'PM_DISABLED' => 'Private messaging has been disabled on this board.', + 'PM_FROM' => 'From', + 'PM_FROM_REMOVED_AUTHOR' => 'This message was sent by a user no longer registered.', + 'PM_ICON' => 'PM icon', + 'PM_INBOX' => 'Inbox', + 'PM_MARK_ALL_READ' => 'Mark all messages read', + 'PM_MARK_ALL_READ_SUCCESS' => 'All private messages in this folder have been marked read', + 'PM_NO_USERS' => 'The requested users to be added do not exist.', + 'PM_OUTBOX' => 'Outbox', + 'PM_SENTBOX' => 'Sent messages', + 'PM_SUBJECT' => 'Message subject', + 'PM_TO' => 'Send to', + 'PM_TOOLS' => 'Message tools', + 'PM_USERS_REMOVED_NO_PERMISSION' => 'Some users couldn’t be added as they do not have permission to read private messages.', + 'PM_USERS_REMOVED_NO_PM' => 'Some users couldn’t be added as they have disabled private message receipt.', + 'POST_EDIT_PM' => 'Edit message', + 'POST_FORWARD_PM' => 'Forward message', + 'POST_NEW_PM' => 'Compose message', + 'POST_PM_LOCKED' => 'Private messaging is locked.', + 'POST_PM_POST' => 'Quote post', + 'POST_QUOTE_PM' => 'Quote message', + 'POST_REPLY_PM' => 'Reply to message', + 'PRINT_PM' => 'Print view', + 'PREFERENCES_UPDATED' => 'Your preferences have been updated.', + 'PROFILE_INFO_NOTICE' => 'Please note that this information may be viewable to other members. Be careful when including any personal details. Any fields marked with a * must be completed.', + 'PROFILE_UPDATED' => 'Your profile has been updated.', + 'PROFILE_AUTOLOGIN_KEYS' => 'The "Remember Me" login keys automatically log you in when you visit the board. If you logout, the remember me login key is deleted only on the computer you are using to logout. Here you can see remember login keys created on other computers you used to access this site.', + 'PROFILE_NO_AUTOLOGIN_KEYS' => 'There are no saved "Remember Me" login keys.', + + 'RECIPIENT' => 'Recipient', + 'RECIPIENTS' => 'Recipients', + 'REGISTRATION' => 'Registration', + 'RELEASE_MESSAGES' => '%sRelease all on-hold messages%s… they will be re-sorted into the appropriate folder if enough space is made available.', + 'REMOVE_ADDRESS' => 'Remove address', + 'REMOVE_SELECTED_BOOKMARKS' => 'Remove selected bookmarks', + 'REMOVE_SELECTED_BOOKMARKS_CONFIRM' => 'Are you sure you want to delete all selected bookmarks?', + 'REMOVE_BOOKMARK_MARKED' => 'Remove marked bookmarks', + 'REMOVE_FOLDER' => 'Remove folder', + 'REMOVE_FOLDER_CONFIRM' => 'Are you sure you want to remove this folder?', + 'RENAME' => 'Rename', + 'RENAME_FOLDER' => 'Rename folder', + 'REPLIED_MESSAGE' => 'Replied to message', + 'REPLY_TO_ALL' => 'Reply to sender and all recipients.', + 'REPORT_PM' => 'Report private message', + 'RESIGN_SELECTED' => 'Resign selected', + 'RETURN_FOLDER' => '%1$sReturn to previous folder%2$s', + 'RETURN_UCP' => '%sReturn to the User Control Panel%s', + 'RULE_ADDED' => 'Rule successfully added.', + 'RULE_ALREADY_DEFINED' => 'This rule was defined previously.', + 'RULE_DELETED' => 'Rule successfully removed.', + 'RULE_LIMIT_REACHED' => 'You cannot add more PM rules. You have reached the maximum number of rules.', + 'RULE_NOT_DEFINED' => 'Rule not correctly specified.', + 'RULE_REMOVED_MESSAGES' => array( + 1 => '%d private message was removed due to private message filters.', + 2 => '%d private messages were removed due to private message filters.', + ), + + 'SAME_PASSWORD_ERROR' => 'The new password you entered is the same as your current password.', + 'SEARCH_YOUR_POSTS' => 'Show your posts', + 'SEND_PASSWORD' => 'Send password', + 'SENT_AT' => 'Sent', // Used before dates in private messages + 'SHOW_EMAIL' => 'Users can contact me by email', + 'SIGNATURE_EXPLAIN' => 'This is a block of text that can be added to posts you make. There is a %d character limit.', + 'SIGNATURE_PREVIEW' => 'Your signature will appear like this in posts', + 'SIGNATURE_TOO_LONG' => 'Your signature is too long.', + 'SELECT_CURRENT_TIME' => 'Select current time', + 'SELECT_TIMEZONE' => 'Select timezone', + 'SORT' => 'Sort', + 'SORT_COMMENT' => 'File comment', + 'SORT_DOWNLOADS' => 'Downloads', + 'SORT_EXTENSION' => 'Extension', + 'SORT_FILENAME' => 'Filename', + 'SORT_POST_TIME' => 'Post time', + 'SORT_SIZE' => 'File size', + + 'TIMEZONE' => 'Timezone', + 'TIMEZONE_DATE_SUGGESTION' => 'Suggestion: %s', + 'TIMEZONE_INVALID' => 'The timezone you selected is invalid.', + 'TO' => 'Recipient', + 'TO_MASS' => 'Recipients', + 'TO_ADD' => 'Add recipient', + 'TO_ADD_MASS' => 'Add recipients', + 'TO_ADD_GROUPS' => 'Add groups', + 'TOO_MANY_RECIPIENTS' => 'You tried to send a private message to too many recipients.', + 'TOO_MANY_REGISTERS' => 'You have exceeded the maximum number of registration attempts for this session. Please try again later.', + + 'UCP' => 'User Control Panel', + 'UCP_ACTIVATE' => 'Activate account', + 'UCP_ADMIN_ACTIVATE' => 'Please note that you will need to enter a valid email address before your account is activated. The administrator will review your account and if approved you will receive an email at the address you specified.', + 'UCP_ATTACHMENTS' => 'Attachments', + 'UCP_AUTH_LINK' => 'External accounts', + 'UCP_AUTH_LINK_ASK' => 'You currently have no account associated with this external service. Click the button below to link your board account to an account with this external service.', + 'UCP_AUTH_LINK_ID' => 'Unique identifier', + 'UCP_AUTH_LINK_LINK' => 'Link', + 'UCP_AUTH_LINK_MANAGE' => 'Manage external account associations', + 'UCP_AUTH_LINK_NOT_SUPPORTED' => 'Linking board accounts to external services is not supported by this board’s current authentication method.', + 'UCP_AUTH_LINK_TITLE' => 'Manage your external account associations', + 'UCP_AUTH_LINK_UNLINK' => 'Unlink', + 'UCP_COPPA_BEFORE' => 'Before %s', + 'UCP_COPPA_ON_AFTER' => 'On or after %s', + 'UCP_EMAIL_ACTIVATE' => 'Please note that you will need to enter a valid email address before your account is activated. You will receive an email at the address you provide that contains an account activation link.', + 'UCP_JABBER' => 'Jabber address', + 'UCP_LOGIN_LINK' => 'Set up an external account association', + + 'UCP_MAIN' => 'Overview', + 'UCP_MAIN_ATTACHMENTS' => 'Manage attachments', + 'UCP_MAIN_BOOKMARKS' => 'Manage bookmarks', + 'UCP_MAIN_DRAFTS' => 'Manage drafts', + 'UCP_MAIN_FRONT' => 'Front page', + 'UCP_MAIN_SUBSCRIBED' => 'Manage subscriptions', + + 'UCP_NO_ATTACHMENTS' => 'You have posted no files.', + + 'UCP_NOTIFICATION_LIST' => 'Manage notifications', + 'UCP_NOTIFICATION_LIST_EXPLAIN' => 'Here you may view all past notifications.', + 'UCP_NOTIFICATION_OPTIONS' => 'Edit notification options', + 'UCP_NOTIFICATION_OPTIONS_EXPLAIN' => 'Here you can set your preferred notification methods for the board.', + + 'UCP_PREFS' => 'Board preferences', + 'UCP_PREFS_PERSONAL' => 'Edit global settings', + 'UCP_PREFS_POST' => 'Edit posting defaults', + 'UCP_PREFS_VIEW' => 'Edit display options', + + 'UCP_PM' => 'Private messages', + 'UCP_PM_COMPOSE' => 'Compose message', + 'UCP_PM_DRAFTS' => 'Manage PM drafts', + 'UCP_PM_OPTIONS' => 'Rules, folders & settings', + 'UCP_PM_UNREAD' => 'Unread messages', + 'UCP_PM_VIEW' => 'View messages', + + 'UCP_PROFILE' => 'Profile', + 'UCP_PROFILE_AVATAR' => 'Edit avatar', + 'UCP_PROFILE_PROFILE_INFO' => 'Edit profile', + 'UCP_PROFILE_REG_DETAILS' => 'Edit account settings', + 'UCP_PROFILE_SIGNATURE' => 'Edit signature', + 'UCP_PROFILE_AUTOLOGIN_KEYS'=> 'Manage “Remember Me” login keys', + + 'UCP_USERGROUPS' => 'Usergroups', + 'UCP_USERGROUPS_MEMBER' => 'Edit memberships', + 'UCP_USERGROUPS_MANAGE' => 'Manage groups', + + 'UCP_PASSWORD_RESET_DISABLED' => 'The password reset functionality has been disabled. If you need help accessing your account, please contact the %sBoard Administrator%s', + 'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.', + 'UCP_REMIND' => 'Send password', + 'UCP_RESEND' => 'Send activation email', + 'UCP_WELCOME' => 'Welcome to the User Control Panel. From here you can monitor, view and update your profile, preferences, subscribed forums and topics. You can also send messages to other users (if permitted). Please ensure you read any announcements before continuing.', + 'UCP_ZEBRA' => 'Friends & Foes', + 'UCP_ZEBRA_FOES' => 'Manage foes', + 'UCP_ZEBRA_FRIENDS' => 'Manage friends', + 'UNDISCLOSED_RECIPIENT' => 'Undisclosed Recipient', + 'UNKNOWN_FOLDER' => 'Unknown folder', + 'UNWATCH_MARKED' => 'Unwatch marked', + 'UPLOAD_AVATAR_FILE' => 'Upload from your machine', + 'UPLOAD_AVATAR_URL' => 'Upload from a URL', + 'UPLOAD_AVATAR_URL_EXPLAIN' => 'Enter the URL of the location containing the image. The image will be copied to this site.', + 'USERNAME_ALPHA_ONLY_EXPLAIN' => 'Username must be between %1$s and %2$s long and use only alphanumeric characters.', + 'USERNAME_ALPHA_SPACERS_EXPLAIN'=> 'Username must be between %1$s and %2$s long and use alphanumeric, space or -+_[] characters.', + 'USERNAME_ASCII_EXPLAIN' => 'Username must be between %1$s and %2$s long and use only ASCII characters, so no special symbols.', + 'USERNAME_LETTER_NUM_EXPLAIN' => 'Username must be between %1$s and %2$s long and use only letter or number characters.', + 'USERNAME_LETTER_NUM_SPACERS_EXPLAIN'=> 'Username must be between %1$s and %2$s long and use letter, number, space or -+_[] characters.', + 'USERNAME_CHARS_ANY_EXPLAIN' => 'Length must be between %1$s and %2$s.', + 'USERNAME_TAKEN_USERNAME' => 'The username you entered is already in use, please select an alternative.', + 'USERNAME_DISALLOWED_USERNAME' => 'The username you entered has been disallowed or contains a disallowed word. Please choose a different name.', + 'USER_NOT_FOUND_OR_INACTIVE' => 'The usernames you specified could either not be found or are not activated users.', + + 'VIEW_AVATARS' => 'Display avatars', + 'VIEW_EDIT' => 'View/Edit', + 'VIEW_FLASH' => 'Display Flash animations', + 'VIEW_IMAGES' => 'Display images within posts', + 'VIEW_NEXT_HISTORY' => 'Next PM in history', + 'VIEW_NEXT_PM' => 'Next PM', + 'VIEW_PM' => 'View message', + 'VIEW_PM_INFO' => 'Message details', + 'VIEW_PM_MESSAGES' => array( + 1 => '%d message', + 2 => '%d messages', + ), + 'VIEW_PREVIOUS_HISTORY' => 'Previous PM in history', + 'VIEW_PREVIOUS_PM' => 'Previous PM', + 'VIEW_PROFILE' => 'View profile', + 'VIEW_SIGS' => 'Display signatures', + 'VIEW_SMILIES' => 'Display smilies as images', + 'VIEW_TOPICS_DAYS' => 'Display topics from previous days', + 'VIEW_TOPICS_DIR' => 'Display topic order direction', + 'VIEW_TOPICS_KEY' => 'Display topics ordering by', + 'VIEW_POSTS_DAYS' => 'Display posts from previous days', + 'VIEW_POSTS_DIR' => 'Display post order direction', + 'VIEW_POSTS_KEY' => 'Display posts ordering by', + + 'WATCHED_EXPLAIN' => 'Below is a list of forums and topics you are subscribed to. You will be notified of new posts in either. To unsubscribe mark the forum or topic and then press the Unwatch marked button.', + 'WATCHED_FORUMS' => 'Watched forums', + 'WATCHED_TOPICS' => 'Watched topics', + 'WRONG_ACTIVATION' => 'The activation key you supplied does not match any in the database.', + + 'YOUR_DETAILS' => 'Your activity', + 'YOUR_FOES' => 'Your foes', + 'YOUR_FOES_EXPLAIN' => 'To remove usernames select them and click submit.', + 'YOUR_FRIENDS' => 'Your friends', + 'YOUR_FRIENDS_EXPLAIN' => 'To remove usernames select them and click submit.', + 'YOUR_WARNINGS' => 'Your warning level', + + 'PM_ACTION' => array( + 'PLACE_INTO_FOLDER' => 'Place into folder', + 'MARK_AS_READ' => 'Mark as read', + 'MARK_AS_IMPORTANT' => 'Mark message', + 'DELETE_MESSAGE' => 'Delete message', + ), + 'PM_CHECK' => array( + 'SUBJECT' => 'Subject', + 'SENDER' => 'Sender', + 'MESSAGE' => 'Message', + 'STATUS' => 'Message status', + 'TO' => 'Sent To', + ), + 'PM_RULE' => array( + 'IS_LIKE' => 'is like', + 'IS_NOT_LIKE' => 'is not like', + 'IS' => 'is', + 'IS_NOT' => 'is not', + 'BEGINS_WITH' => 'begins with', + 'ENDS_WITH' => 'ends with', + 'IS_FRIEND' => 'is friend', + 'IS_FOE' => 'is foe', + 'IS_USER' => 'is user', + 'IS_GROUP' => 'is in usergroup', + 'ANSWERED' => 'answered', + 'FORWARDED' => 'forwarded', + 'TO_GROUP' => 'to my default usergroup', + 'TO_ME' => 'to me', + ), + + 'GROUPS_EXPLAIN' => 'Usergroups enable board admins to better administer users. By default you will be placed in a specific group, this is your default group. This group defines how you may appear to other users, for example your username colouration, avatar, rank, etc. Depending on whether the administrator allows it you may be allowed to change your default group. You may also be placed in or allowed to join other groups. Some groups may give you additional permissions to view content or increase your capabilities in other areas.', + 'GROUP_LEADER' => 'Leaderships', + 'GROUP_MEMBER' => 'Memberships', + 'GROUP_PENDING' => 'Pending memberships', + 'GROUP_NONMEMBER' => 'Non-memberships', + 'GROUP_DETAILS' => 'Group details', + + 'NO_LEADER' => 'No group leaderships', + 'NO_MEMBER' => 'No group memberships', + 'NO_PENDING' => 'No pending memberships', + 'NO_NONMEMBER' => 'No non-member groups', +)); diff --git a/install/update/old/mcp.php b/install/update/old/mcp.php new file mode 100644 index 0000000..c4a8a66 --- /dev/null +++ b/install/update/old/mcp.php @@ -0,0 +1,326 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_admin.' . $phpEx); +include($phpbb_root_path . 'includes/functions_mcp.' . $phpEx); +require($phpbb_root_path . 'includes/functions_module.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('mcp'); + +$module = new p_master(); + +// Setting a variable to let the style designer know where he is... +$template->assign_var('S_IN_MCP', true); + +// Basic parameter data +$id = $request->variable('i', ''); + +$mode = $request->variable('mode', array('')); +$mode = count($mode) ? array_shift($mode) : $request->variable('mode', ''); + +// Only Moderators can go beyond this point +if (!$user->data['is_registered']) +{ + if ($user->data['is_bot']) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + login_box('', $user->lang['LOGIN_EXPLAIN_MCP']); +} + +$quickmod = (isset($_REQUEST['quickmod'])) ? true : false; +$action = $request->variable('action', ''); +$action_ary = $request->variable('action', array('' => 0)); + +$forum_action = $request->variable('forum_action', ''); +if ($forum_action !== '' && $request->variable('sort', false, false, \phpbb\request\request_interface::POST)) +{ + $action = $forum_action; +} + +if (count($action_ary)) +{ + list($action, ) = each($action_ary); +} +unset($action_ary); + +if ($mode == 'topic_logs') +{ + $id = 'logs'; + $quickmod = false; +} + +$post_id = $request->variable('p', 0); +$topic_id = $request->variable('t', 0); +$forum_id = $request->variable('f', 0); +$report_id = $request->variable('r', 0); +$user_id = $request->variable('u', 0); +$username = $request->variable('username', '', true); + +if ($post_id) +{ + // We determine the topic and forum id here, to make sure the moderator really has moderative rights on this post + $sql = 'SELECT topic_id, forum_id + FROM ' . POSTS_TABLE . " + WHERE post_id = $post_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $topic_id = (int) $row['topic_id']; + $forum_id = (int) $row['forum_id']; +} +else if ($topic_id) +{ + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . " + WHERE topic_id = $topic_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $forum_id = (int) $row['forum_id']; +} + +// If the user doesn't have any moderator powers (globally or locally) he can't access the mcp +if (!$auth->acl_getf_global('m_')) +{ + // Except he is using one of the quickmod tools for users + $user_quickmod_actions = array( + 'lock' => 'f_user_lock', + 'make_sticky' => 'f_sticky', + 'make_announce' => 'f_announce', + 'make_global' => 'f_announce_global', + 'make_normal' => array('f_announce', 'f_announce_global', 'f_sticky') + ); + + $allow_user = false; + if ($quickmod && isset($user_quickmod_actions[$action]) && $user->data['is_registered'] && $auth->acl_gets($user_quickmod_actions[$action], $forum_id)) + { + $topic_info = phpbb_get_topic_data(array($topic_id)); + if ($topic_info[$topic_id]['topic_poster'] == $user->data['user_id']) + { + $allow_user = true; + } + } + + if (!$allow_user) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } +} + +// if the user cannot read the forum he tries to access then we won't allow mcp access either +if ($forum_id && !$auth->acl_get('f_read', $forum_id)) +{ + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); +} + +/** +* Allow applying additional permissions to MCP access besides f_read +* +* @event core.mcp_global_f_read_auth_after +* @var string action The action the user tried to execute +* @var int forum_id The forum the user tried to access +* @var string mode The MCP module the user is trying to access +* @var p_master module Module system class +* @var bool quickmod True if the user is accessing using quickmod tools +* @var int topic_id The topic the user tried to access +* @since 3.1.3-RC1 +*/ +$vars = array( + 'action', + 'forum_id', + 'mode', + 'module', + 'quickmod', + 'topic_id', +); +extract($phpbb_dispatcher->trigger_event('core.mcp_global_f_read_auth_after', compact($vars))); + +if ($forum_id) +{ + $module->acl_forum_id = $forum_id; +} + +// Instantiate module system and generate list of available modules +$module->list_modules('mcp'); + +if ($quickmod) +{ + $mode = 'quickmod'; + + switch ($action) + { + case 'lock': + case 'unlock': + case 'lock_post': + case 'unlock_post': + case 'make_sticky': + case 'make_announce': + case 'make_global': + case 'make_normal': + case 'fork': + case 'move': + case 'delete_post': + case 'delete_topic': + case 'restore_topic': + $module->load('mcp', 'main', 'quickmod'); + return; + break; + + case 'topic_logs': + // Reset start parameter if we jumped from the quickmod dropdown + if ($request->variable('start', 0)) + { + $request->overwrite('start', 0); + } + + $module->set_active('logs', 'topic_logs'); + break; + + case 'merge_topic': + $module->set_active('main', 'forum_view'); + break; + + case 'split': + case 'merge': + $module->set_active('main', 'topic_view'); + break; + + default: + // If needed, the flag can be set to true within event listener + // to indicate that the action was handled properly + // and to pass by the trigger_error() call below + $is_valid_action = false; + + /** + * This event allows you to add custom quickmod options + * + * @event core.modify_quickmod_options + * @var object module Instance of module system class + * @var string action Quickmod option + * @var bool is_valid_action Flag indicating if the action was handled properly + * @since 3.1.0-a4 + */ + $vars = array('module', 'action', 'is_valid_action'); + extract($phpbb_dispatcher->trigger_event('core.modify_quickmod_options', compact($vars))); + + if (!$is_valid_action) + { + trigger_error($user->lang('QUICKMOD_ACTION_NOT_ALLOWED', $action), E_USER_ERROR); + } + break; + } +} +else +{ + // Select the active module + $module->set_active($id, $mode); +} + +// Hide some of the options if we don't have the relevant information to use them +if (!$post_id) +{ + $module->set_display('main', 'post_details', false); + $module->set_display('warn', 'warn_post', false); +} + +if ($mode == '' || $mode == 'unapproved_topics' || $mode == 'unapproved_posts' || $mode == 'deleted_topics' || $mode == 'deleted_posts') +{ + $module->set_display('queue', 'approve_details', false); +} + +if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' || $mode == 'pm_reports' || $mode == 'pm_reports_closed' || $mode == 'pm_report_details') +{ + $module->set_display('reports', 'report_details', false); +} + +if ($mode == '' || $mode == 'reports' || $mode == 'reports_closed' || $mode == 'pm_reports' || $mode == 'pm_reports_closed' || $mode == 'report_details') +{ + $module->set_display('pm_reports', 'pm_report_details', false); +} + +if (!$topic_id) +{ + $module->set_display('main', 'topic_view', false); + $module->set_display('logs', 'topic_logs', false); +} + +if (!$forum_id) +{ + $module->set_display('main', 'forum_view', false); + $module->set_display('logs', 'forum_logs', false); +} + +if (!$user_id && $username == '') +{ + $module->set_display('notes', 'user_notes', false); + $module->set_display('warn', 'warn_user', false); +} + +/** +* This event allows you to set display option for custom MCP modules +* +* @event core.modify_mcp_modules_display_option +* @var p_master module Module system class +* @var string mode MCP mode +* @var int user_id User id +* @var int forum_id Forum id +* @var int topic_id Topic id +* @var int post_id Post id +* @var string username User name +* @var int id Parent module id +* @since 3.1.0-b2 +*/ +$vars = array( + 'module', + 'mode', + 'user_id', + 'forum_id', + 'topic_id', + 'post_id', + 'username', + 'id', +); +extract($phpbb_dispatcher->trigger_event('core.modify_mcp_modules_display_option', compact($vars))); + +// Load and execute the relevant module +$module->load_active(); + +// Assign data to the template engine for the list of modules +$module->assign_tpl_vars(append_sid("{$phpbb_root_path}mcp.$phpEx")); + +// Generate urls for letting the moderation control panel being accessed in different modes +$template->assign_vars(array( + 'U_MCP' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=main'), + 'U_MCP_FORUM' => ($forum_id) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=forum_view&f=$forum_id") : '', + 'U_MCP_TOPIC' => ($forum_id && $topic_id) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&t=$topic_id") : '', + 'U_MCP_POST' => ($forum_id && $topic_id && $post_id) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&t=$topic_id&p=$post_id") : '', +)); + +// Generate the page, do not display/query online list +$module->display($module->get_page_title()); diff --git a/install/update/old/memberlist.php b/install/update/old/memberlist.php new file mode 100644 index 0000000..b26d7c8 --- /dev/null +++ b/install/update/old/memberlist.php @@ -0,0 +1,1776 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + +$mode = $request->variable('mode', ''); + +if ($mode === 'contactadmin') +{ + define('SKIP_CHECK_BAN', true); + define('SKIP_CHECK_DISABLED', true); +} + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup(array('memberlist', 'groups')); + +// Setting a variable to let the style designer know where he is... +$template->assign_var('S_IN_MEMBERLIST', true); + +// Grab data +$action = $request->variable('action', ''); +$user_id = $request->variable('u', ANONYMOUS); +$username = $request->variable('un', '', true); +$group_id = $request->variable('g', 0); +$topic_id = $request->variable('t', 0); + +// Redirect when old mode is used +if ($mode == 'leaders') +{ + send_status_line(301, 'Moved Permanently'); + redirect(append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=team')); +} + +// Check our mode... +if (!in_array($mode, array('', 'group', 'viewprofile', 'email', 'contact', 'contactadmin', 'searchuser', 'team', 'livesearch'))) +{ + trigger_error('NO_MODE'); +} + +switch ($mode) +{ + case 'email': + case 'contactadmin': + break; + + case 'livesearch': + if (!$config['allow_live_searches']) + { + trigger_error('LIVE_SEARCHES_NOT_ALLOWED'); + } + // No break + + default: + // Can this user view profiles/memberlist? + if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) + { + if ($user->data['user_id'] != ANONYMOUS) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_VIEW_USERS'); + } + + login_box('', ((isset($user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $user->lang['LOGIN_EXPLAIN_MEMBERLIST'])); + } + break; +} + +/** @var \phpbb\group\helper $group_helper */ +$group_helper = $phpbb_container->get('group_helper'); + +$start = $request->variable('start', 0); +$submit = (isset($_POST['submit'])) ? true : false; + +$default_key = 'c'; +$sort_key = $request->variable('sk', $default_key); +$sort_dir = $request->variable('sd', 'a'); + +$user_types = array(USER_NORMAL, USER_FOUNDER); +if ($auth->acl_get('a_user')) +{ + $user_types[] = USER_INACTIVE; +} + +// What do you want to do today? ... oops, I think that line is taken ... +switch ($mode) +{ + case 'team': + // Display a listing of board admins, moderators + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $page_title = $user->lang['THE_TEAM']; + $template_html = 'memberlist_team.html'; + + $sql = 'SELECT * + FROM ' . TEAMPAGE_TABLE . ' + ORDER BY teampage_position ASC'; + $result = $db->sql_query($sql, 3600); + $teampage_data = $db->sql_fetchrowset($result); + $db->sql_freeresult($result); + + $sql_ary = array( + 'SELECT' => 'g.group_id, g.group_name, g.group_colour, g.group_type, ug.user_id as ug_user_id, t.teampage_id', + + 'FROM' => array(GROUPS_TABLE => 'g'), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TEAMPAGE_TABLE => 't'), + 'ON' => 't.group_id = g.group_id', + ), + array( + 'FROM' => array(USER_GROUP_TABLE => 'ug'), + 'ON' => 'ug.group_id = g.group_id AND ug.user_pending = 0 AND ug.user_id = ' . (int) $user->data['user_id'], + ), + ), + ); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + $group_ids = $groups_ary = array(); + while ($row = $db->sql_fetchrow($result)) + { + if ($row['group_type'] == GROUP_HIDDEN && !$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $row['ug_user_id'] != $user->data['user_id']) + { + $row['group_name'] = $user->lang['GROUP_UNDISCLOSED']; + $row['u_group'] = ''; + } + else + { + $row['group_name'] = $group_helper->get_name($row['group_name']); + $row['u_group'] = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group&g=' . $row['group_id']); + } + + if ($row['teampage_id']) + { + // Only put groups into the array we want to display. + // We are fetching all groups, to ensure we got all data for default groups. + $group_ids[] = (int) $row['group_id']; + } + $groups_ary[(int) $row['group_id']] = $row; + } + $db->sql_freeresult($result); + + $sql_ary = array( + 'SELECT' => 'u.user_id, u.group_id as default_group, u.username, u.username_clean, u.user_colour, u.user_type, u.user_rank, u.user_posts, u.user_allow_pm, g.group_id', + + 'FROM' => array( + USER_GROUP_TABLE => 'ug', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(USERS_TABLE => 'u'), + 'ON' => 'ug.user_id = u.user_id', + ), + array( + 'FROM' => array(GROUPS_TABLE => 'g'), + 'ON' => 'ug.group_id = g.group_id', + ), + ), + + 'WHERE' => $db->sql_in_set('g.group_id', $group_ids, false, true) . ' AND ug.user_pending = 0', + + 'ORDER_BY' => 'u.username_clean ASC', + ); + + /** + * Modify the query used to get the users for the team page + * + * @event core.memberlist_team_modify_query + * @var array sql_ary Array containing the query + * @var array group_ids Array of group ids + * @var array teampage_data The teampage data + * @since 3.1.3-RC1 + */ + $vars = array( + 'sql_ary', + 'group_ids', + 'teampage_data', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_team_modify_query', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + $user_ary = $user_ids = $group_users = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['forums'] = ''; + $row['forums_ary'] = array(); + $user_ary[(int) $row['user_id']] = $row; + $user_ids[] = (int) $row['user_id']; + $group_users[(int) $row['group_id']][] = (int) $row['user_id']; + } + $db->sql_freeresult($result); + + $user_ids = array_unique($user_ids); + + if (!empty($user_ids) && $config['teampage_forums']) + { + $template->assign_var('S_DISPLAY_MODERATOR_FORUMS', true); + // Get all moderators + $perm_ary = $auth->acl_get_list($user_ids, array('m_'), false); + + foreach ($perm_ary as $forum_id => $forum_ary) + { + foreach ($forum_ary as $auth_option => $id_ary) + { + foreach ($id_ary as $id) + { + if (!$forum_id) + { + $user_ary[$id]['forums'] = $user->lang['ALL_FORUMS']; + } + else + { + $user_ary[$id]['forums_ary'][] = $forum_id; + } + } + } + } + + $sql = 'SELECT forum_id, forum_name + FROM ' . FORUMS_TABLE; + $result = $db->sql_query($sql); + + $forums = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forums[$row['forum_id']] = $row['forum_name']; + } + $db->sql_freeresult($result); + + foreach ($user_ary as $user_id => $user_data) + { + if (!$user_data['forums']) + { + foreach ($user_data['forums_ary'] as $forum_id) + { + $user_ary[$user_id]['forums_options'] = true; + if (isset($forums[$forum_id])) + { + if ($auth->acl_get('f_list', $forum_id)) + { + $user_ary[$user_id]['forums'] .= ''; + } + } + } + } + } + } + + $parent_team = 0; + foreach ($teampage_data as $team_data) + { + // If this team entry has no group, it's a category + if (!$team_data['group_id']) + { + $template->assign_block_vars('group', array( + 'GROUP_NAME' => $team_data['teampage_name'], + )); + + $parent_team = (int) $team_data['teampage_id']; + continue; + } + + $group_data = $groups_ary[(int) $team_data['group_id']]; + $group_id = (int) $team_data['group_id']; + + if (!$team_data['teampage_parent']) + { + // If the group does not have a parent category, we display the groupname as category + $template->assign_block_vars('group', array( + 'GROUP_NAME' => $group_data['group_name'], + 'GROUP_COLOR' => $group_data['group_colour'], + 'U_GROUP' => $group_data['u_group'], + )); + } + + // Display group members. + if (!empty($group_users[$group_id])) + { + foreach ($group_users[$group_id] as $user_id) + { + if (isset($user_ary[$user_id])) + { + $row = $user_ary[$user_id]; + if ($config['teampage_memberships'] == 1 && ($group_id != $groups_ary[$row['default_group']]['group_id']) && $groups_ary[$row['default_group']]['teampage_id']) + { + // Display users in their primary group, instead of the first group, when it is displayed on the teampage. + continue; + } + + $user_rank_data = phpbb_get_user_rank($row, (($row['user_id'] == ANONYMOUS) ? false : $row['user_posts'])); + + $template_vars = array( + 'USER_ID' => $row['user_id'], + 'FORUMS' => $row['forums'], + 'FORUM_OPTIONS' => (isset($row['forums_options'])) ? true : false, + 'RANK_TITLE' => $user_rank_data['title'], + + 'GROUP_NAME' => $groups_ary[$row['default_group']]['group_name'], + 'GROUP_COLOR' => $groups_ary[$row['default_group']]['group_colour'], + 'U_GROUP' => $groups_ary[$row['default_group']]['u_group'], + + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], + + 'S_INACTIVE' => $row['user_type'] == USER_INACTIVE, + + 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($row['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $row['user_id']) : '', + + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), + 'USER_COLOR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + 'U_VIEW_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), + ); + + /** + * Modify the template vars for displaying the user in the groups on the teampage + * + * @event core.memberlist_team_modify_template_vars + * @var array template_vars Array containing the query + * @var array row Array containing the action user row + * @var array groups_ary Array of groups with all users that should be displayed + * @since 3.1.3-RC1 + */ + $vars = array( + 'template_vars', + 'row', + 'groups_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_team_modify_template_vars', compact($vars))); + + $template->assign_block_vars('group.user', $template_vars); + + if ($config['teampage_memberships'] != 2) + { + unset($user_ary[$user_id]); + } + } + } + } + } + + $template->assign_vars(array( + 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE'])) + ); + break; + + case 'contact': + + $page_title = $user->lang['IM_USER']; + $template_html = 'memberlist_im.html'; + + if (!$auth->acl_get('u_sendim')) + { + send_status_line(403, 'Forbidden'); + trigger_error('NOT_AUTHORISED'); + } + + $presence_img = ''; + switch ($action) + { + case 'jabber': + $lang = 'JABBER'; + $sql_field = 'user_jabber'; + $s_select = (@extension_loaded('xml') && $config['jab_enable']) ? 'S_SEND_JABBER' : 'S_NO_SEND_JABBER'; + $s_action = append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=$action&u=$user_id"); + break; + + default: + trigger_error('NO_MODE', E_USER_ERROR); + break; + } + + // Grab relevant data + $sql = "SELECT user_id, username, user_email, user_lang, $sql_field + FROM " . USERS_TABLE . " + WHERE user_id = $user_id + AND user_type IN (" . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_USER'); + } + else if (empty($row[$sql_field])) + { + trigger_error('IM_NO_DATA'); + } + + // Post data grab actions + switch ($action) + { + case 'jabber': + add_form_key('memberlist_messaging'); + + if ($submit && @extension_loaded('xml') && $config['jab_enable']) + { + if (check_form_key('memberlist_messaging')) + { + + include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + + $subject = sprintf($user->lang['IM_JABBER_SUBJECT'], $user->data['username'], $config['server_name']); + $message = $request->variable('message', '', true); + + if (empty($message)) + { + trigger_error('EMPTY_MESSAGE_IM'); + } + + $messenger = new messenger(false); + + $messenger->template('profile_send_im', $row['user_lang']); + $messenger->subject(htmlspecialchars_decode($subject)); + + $messenger->replyto($user->data['user_email']); + $messenger->set_addresses($row); + + $messenger->assign_vars(array( + 'BOARD_CONTACT' => phpbb_get_board_contact($config, $phpEx), + 'FROM_USERNAME' => htmlspecialchars_decode($user->data['username']), + 'TO_USERNAME' => htmlspecialchars_decode($row['username']), + 'MESSAGE' => htmlspecialchars_decode($message)) + ); + + $messenger->send(NOTIFY_IM); + + $s_select = 'S_SENT_JABBER'; + } + else + { + trigger_error('FORM_INVALID'); + } + } + break; + } + + // Send vars to the template + $template->assign_vars(array( + 'IM_CONTACT' => $row[$sql_field], + 'A_IM_CONTACT' => addslashes($row[$sql_field]), + + 'USERNAME' => $row['username'], + 'CONTACT_NAME' => $row[$sql_field], + 'SITENAME' => $config['sitename'], + + 'PRESENCE_IMG' => $presence_img, + + 'L_SEND_IM_EXPLAIN' => $user->lang['IM_' . $lang], + 'L_IM_SENT_JABBER' => sprintf($user->lang['IM_SENT_JABBER'], $row['username']), + + $s_select => true, + 'S_IM_ACTION' => $s_action) + ); + + break; + + case 'viewprofile': + // Display a profile + if ($user_id == ANONYMOUS && !$username) + { + trigger_error('NO_USER'); + } + + // Get user... + $sql_array = array( + 'SELECT' => 'u.*', + 'FROM' => array( + USERS_TABLE => 'u' + ), + 'WHERE' => (($username) ? "u.username_clean = '" . $db->sql_escape(utf8_clean_string($username)) . "'" : "u.user_id = $user_id"), + ); + + /** + * Modify user data SQL before member profile row is created + * + * @event core.memberlist_modify_viewprofile_sql + * @var int user_id The user ID + * @var string username The username + * @var array sql_array Array containing the main query + * @since 3.2.6-RC1 + */ + $vars = array( + 'user_id', + 'username', + 'sql_array', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_viewprofile_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + $member = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$member) + { + trigger_error('NO_USER'); + } + + // a_user admins and founder are able to view inactive users and bots to be able to manage them more easily + // Normal users are able to see at least users having only changed their profile settings but not yet reactivated. + if (!$auth->acl_get('a_user') && $user->data['user_type'] != USER_FOUNDER) + { + if ($member['user_type'] == USER_IGNORE) + { + trigger_error('NO_USER'); + } + else if ($member['user_type'] == USER_INACTIVE && $member['user_inactive_reason'] != INACTIVE_PROFILE) + { + trigger_error('NO_USER'); + } + } + + $user_id = (int) $member['user_id']; + + // Get group memberships + // Also get visiting user's groups to determine hidden group memberships if necessary. + $auth_hidden_groups = ($user_id === (int) $user->data['user_id'] || $auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) ? true : false; + $sql_uid_ary = ($auth_hidden_groups) ? array($user_id) : array($user_id, (int) $user->data['user_id']); + + // Do the SQL thang + $sql_ary = [ + 'SELECT' => 'g.group_id, g.group_name, g.group_type, ug.user_id', + + 'FROM' => [ + GROUPS_TABLE => 'g', + ], + + 'LEFT_JOIN' => [ + [ + 'FROM' => [USER_GROUP_TABLE => 'ug'], + 'ON' => 'g.group_id = ug.group_id', + ], + ], + + 'WHERE' => $db->sql_in_set('ug.user_id', $sql_uid_ary) . ' + AND ug.user_pending = 0', + ]; + + /** + * Modify the query used to get the group data + * + * @event core.modify_memberlist_viewprofile_group_sql + * @var array sql_ary Array containing the query + * @since 3.2.6-RC1 + */ + $vars = array( + 'sql_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_memberlist_viewprofile_group_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + + // Divide data into profile data and current user data + $profile_groups = $user_groups = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['user_id'] = (int) $row['user_id']; + $row['group_id'] = (int) $row['group_id']; + + if ($row['user_id'] == $user_id) + { + $profile_groups[] = $row; + } + else + { + $user_groups[$row['group_id']] = $row['group_id']; + } + } + $db->sql_freeresult($result); + + // Filter out hidden groups and sort groups by name + $group_data = $group_sort = array(); + foreach ($profile_groups as $row) + { + if (!$auth_hidden_groups && $row['group_type'] == GROUP_HIDDEN && !isset($user_groups[$row['group_id']])) + { + // Skip over hidden groups the user cannot see + continue; + } + + $row['group_name'] = $group_helper->get_name($row['group_name']); + + $group_sort[$row['group_id']] = utf8_clean_string($row['group_name']); + $group_data[$row['group_id']] = $row; + } + unset($profile_groups); + unset($user_groups); + asort($group_sort); + + /** + * Modify group data before options is created and data is unset + * + * @event core.modify_memberlist_viewprofile_group_data + * @var array group_data Array containing the group data + * @var array group_sort Array containing the sorted group data + * @since 3.2.6-RC1 + */ + $vars = array( + 'group_data', + 'group_sort', + ); + extract($phpbb_dispatcher->trigger_event('core.modify_memberlist_viewprofile_group_data', compact($vars))); + + $group_options = ''; + foreach ($group_sort as $group_id => $null) + { + $row = $group_data[$group_id]; + + $group_options .= ''; + } + unset($group_data); + unset($group_sort); + + // What colour is the zebra + $sql = 'SELECT friend, foe + FROM ' . ZEBRA_TABLE . " + WHERE zebra_id = $user_id + AND user_id = {$user->data['user_id']}"; + + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $foe = ($row['foe']) ? true : false; + $friend = ($row['friend']) ? true : false; + $db->sql_freeresult($result); + + if ($config['load_onlinetrack']) + { + $sql = 'SELECT MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline + FROM ' . SESSIONS_TABLE . " + WHERE session_user_id = $user_id"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $member['session_time'] = (isset($row['session_time'])) ? $row['session_time'] : 0; + $member['session_viewonline'] = (isset($row['session_viewonline'])) ? $row['session_viewonline'] : 0; + unset($row); + } + + if ($config['load_user_activity']) + { + display_user_activity($member); + } + + // Do the relevant calculations + $memberdays = max(1, round((time() - $member['user_regdate']) / 86400)); + $posts_per_day = $member['user_posts'] / $memberdays; + $percentage = ($config['num_posts']) ? min(100, ($member['user_posts'] / $config['num_posts']) * 100) : 0; + + + if ($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); + } + + // We need to check if the modules 'zebra' ('friends' & 'foes' mode), 'notes' ('user_notes' mode) and 'warn' ('warn_user' mode) are accessible to decide if we can display appropriate links + $zebra_enabled = $friends_enabled = $foes_enabled = $user_notes_enabled = $warn_user_enabled = false; + + // Only check if the user is logged in + if ($user->data['is_registered']) + { + if (!class_exists('p_master')) + { + include($phpbb_root_path . 'includes/functions_module.' . $phpEx); + } + $module = new p_master(); + + $module->list_modules('ucp'); + $module->list_modules('mcp'); + + $user_notes_enabled = ($module->loaded('mcp_notes', 'user_notes')) ? true : false; + $warn_user_enabled = ($module->loaded('mcp_warn', 'warn_user')) ? true : false; + $zebra_enabled = ($module->loaded('ucp_zebra')) ? true : false; + $friends_enabled = ($module->loaded('ucp_zebra', 'friends')) ? true : false; + $foes_enabled = ($module->loaded('ucp_zebra', 'foes')) ? true : false; + + unset($module); + } + + // Custom Profile Fields + $profile_fields = array(); + if ($config['load_cpf_viewprofile']) + { + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + $profile_fields = $cp->grab_profile_fields_data($user_id); + $profile_fields = (isset($profile_fields[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields[$user_id]) : array(); + } + + /** + * Modify user data before we display the profile + * + * @event core.memberlist_view_profile + * @var array member Array with user's data + * @var bool user_notes_enabled Is the mcp user notes module enabled? + * @var bool warn_user_enabled Is the mcp warnings module enabled? + * @var bool zebra_enabled Is the ucp zebra module enabled? + * @var bool friends_enabled Is the ucp friends module enabled? + * @var bool foes_enabled Is the ucp foes module enabled? + * @var bool friend Is the user friend? + * @var bool foe Is the user foe? + * @var array profile_fields Array with user's profile field data + * @since 3.1.0-a1 + * @changed 3.1.0-b2 Added friend and foe status + * @changed 3.1.0-b3 Added profile fields data + */ + $vars = array( + 'member', + 'user_notes_enabled', + 'warn_user_enabled', + 'zebra_enabled', + 'friends_enabled', + 'foes_enabled', + 'friend', + 'foe', + 'profile_fields', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_view_profile', compact($vars))); + + $template->assign_vars(phpbb_show_profile($member, $user_notes_enabled, $warn_user_enabled)); + + // If the user has m_approve permission or a_user permission, then list then display unapproved posts + if ($auth->acl_getf_global('m_approve') || $auth->acl_get('a_user')) + { + $sql = 'SELECT COUNT(post_id) as posts_in_queue + FROM ' . POSTS_TABLE . ' + WHERE poster_id = ' . $user_id . ' + AND ' . $db->sql_in_set('post_visibility', array(ITEM_UNAPPROVED, ITEM_REAPPROVE)); + $result = $db->sql_query($sql); + $member['posts_in_queue'] = (int) $db->sql_fetchfield('posts_in_queue'); + $db->sql_freeresult($result); + } + else + { + $member['posts_in_queue'] = 0; + } + + // Define the main array of vars to assign to memberlist_view.html + $template_ary = array( + 'L_POSTS_IN_QUEUE' => $user->lang('NUM_POSTS_IN_QUEUE', $member['posts_in_queue']), + + 'POSTS_DAY' => $user->lang('POST_DAY', $posts_per_day), + 'POSTS_PCT' => $user->lang('POST_PCT', $percentage), + + 'SIGNATURE' => $member['user_sig'], + 'POSTS_IN_QUEUE' => $member['posts_in_queue'], + + 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']), + 'L_SEND_EMAIL_USER' => $user->lang('SEND_EMAIL_USER', $member['username']), + 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']), + 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']), + 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), + + 'S_PROFILE_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=group'), + 'S_GROUP_OPTIONS' => $group_options, + 'S_CUSTOM_FIELDS' => (isset($profile_fields['row']) && count($profile_fields['row'])) ? true : false, + + 'U_USER_ADMIN' => ($auth->acl_get('a_user')) ? append_sid("{$phpbb_admin_path}index.$phpEx", 'i=users&mode=overview&u=' . $user_id, true, $user->session_id) : '', + 'U_USER_BAN' => ($auth->acl_get('m_ban') && $user_id != $user->data['user_id']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=ban&mode=user&u=' . $user_id, true, $user->session_id) : '', + 'U_MCP_QUEUE' => ($auth->acl_getf_global('m_approve')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue', true, $user->session_id) : '', + + 'U_SWITCH_PERMISSIONS' => ($auth->acl_get('a_switchperm') && $user->data['user_id'] != $user_id) ? append_sid("{$phpbb_root_path}ucp.$phpEx", "mode=switch_perm&u={$user_id}&hash=" . generate_link_hash('switchperm')) : '', + 'U_EDIT_SELF' => ($user_id == $user->data['user_id'] && $auth->acl_get('u_chgprofileinfo')) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_profile&mode=profile_info') : '', + + 'S_USER_NOTES' => ($user_notes_enabled) ? true : false, + 'S_WARN_USER' => ($warn_user_enabled) ? true : false, + 'S_ZEBRA' => ($user->data['user_id'] != $user_id && $user->data['is_registered'] && $zebra_enabled) ? true : false, + 'U_ADD_FRIEND' => (!$friend && !$foe && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', + 'U_ADD_FOE' => (!$friend && !$foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&mode=foes&add=' . urlencode(htmlspecialchars_decode($member['username']))) : '', + 'U_REMOVE_FRIEND' => ($friend && $friends_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&usernames[]=' . $user_id) : '', + 'U_REMOVE_FOE' => ($foe && $foes_enabled) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=zebra&remove=1&mode=foes&usernames[]=' . $user_id) : '', + + 'U_CANONICAL' => generate_board_url() . '/' . append_sid("memberlist.$phpEx", 'mode=viewprofile&u=' . $user_id, true, ''), + ); + + /** + * Modify user's template vars before we display the profile + * + * @event core.memberlist_modify_view_profile_template_vars + * @var array template_ary Array with user's template vars + * @since 3.2.6-RC1 + */ + $vars = array( + 'template_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_view_profile_template_vars', compact($vars))); + + // Assign vars to memberlist_view.html + $template->assign_vars($template_ary); + + if (!empty($profile_fields['row'])) + { + $template->assign_vars($profile_fields['row']); + } + + if (!empty($profile_fields['blockrow'])) + { + foreach ($profile_fields['blockrow'] as $field_data) + { + $template->assign_block_vars('custom_fields', $field_data); + } + } + + // Inactive reason/account? + if ($member['user_type'] == USER_INACTIVE) + { + $user->add_lang('acp/common'); + + $inactive_reason = $user->lang['INACTIVE_REASON_UNKNOWN']; + + switch ($member['user_inactive_reason']) + { + case INACTIVE_REGISTER: + $inactive_reason = $user->lang['INACTIVE_REASON_REGISTER']; + break; + + case INACTIVE_PROFILE: + $inactive_reason = $user->lang['INACTIVE_REASON_PROFILE']; + break; + + case INACTIVE_MANUAL: + $inactive_reason = $user->lang['INACTIVE_REASON_MANUAL']; + break; + + case INACTIVE_REMIND: + $inactive_reason = $user->lang['INACTIVE_REASON_REMIND']; + break; + } + + $template->assign_vars(array( + 'S_USER_INACTIVE' => true, + 'USER_INACTIVE_REASON' => $inactive_reason) + ); + } + + // Now generate page title + $page_title = sprintf($user->lang['VIEWING_PROFILE'], $member['username']); + $template_html = 'memberlist_view.html'; + + break; + + case 'contactadmin': + case 'email': + if (!class_exists('messenger')) + { + include($phpbb_root_path . 'includes/functions_messenger.' . $phpEx); + } + + $user_id = $request->variable('u', 0); + $topic_id = $request->variable('t', 0); + + if ($user_id) + { + $form_name = 'user'; + } + else if ($topic_id) + { + $form_name = 'topic'; + } + else if ($mode === 'contactadmin') + { + $form_name = 'admin'; + } + else + { + trigger_error('NO_EMAIL'); + } + + /** @var $form \phpbb\message\form */ + $form = $phpbb_container->get('message.form.' . $form_name); + + $form->bind($request); + $error = $form->check_allow(); + if ($error) + { + trigger_error($error); + } + + if ($request->is_set_post('submit')) + { + $messenger = new messenger(false); + $form->submit($messenger); + } + + $page_title = $form->get_page_title(); + $template_html = $form->get_template_file(); + $form->render($template); + + break; + + case 'livesearch': + + $username_chars = $request->variable('username', '', true); + + $sql = 'SELECT username, user_id, user_colour + FROM ' . USERS_TABLE . ' + WHERE ' . $db->sql_in_set('user_type', $user_types) . ' + AND username_clean ' . $db->sql_like_expression(utf8_clean_string($username_chars) . $db->get_any_char()); + $result = $db->sql_query_limit($sql, 10); + $user_list = array(); + + while ($row = $db->sql_fetchrow($result)) + { + $user_list[] = array( + 'user_id' => (int) $row['user_id'], + 'result' => $row['username'], + 'username_full' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']), + 'display' => get_username_string('no_profile', $row['user_id'], $row['username'], $row['user_colour']), + ); + } + $db->sql_freeresult($result); + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'keyword' => $username_chars, + 'results' => $user_list, + )); + + break; + + case 'group': + default: + // The basic memberlist + $page_title = $user->lang['MEMBERLIST']; + $template_html = 'memberlist_body.html'; + + /* @var $pagination \phpbb\pagination */ + $pagination = $phpbb_container->get('pagination'); + + // Sorting + $sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'c' => $user->lang['SORT_JOINED'], 'd' => $user->lang['SORT_POST_COUNT']); + $sort_key_sql = array('a' => 'u.username_clean', 'c' => 'u.user_regdate', 'd' => 'u.user_posts'); + + if ($config['jab_enable']) + { + $sort_key_text['k'] = $user->lang['JABBER']; + $sort_key_sql['k'] = 'u.user_jabber'; + } + + if ($auth->acl_get('a_user')) + { + $sort_key_text['e'] = $user->lang['SORT_EMAIL']; + $sort_key_sql['e'] = 'u.user_email'; + } + + if ($auth->acl_get('u_viewonline')) + { + $sort_key_text['l'] = $user->lang['SORT_LAST_ACTIVE']; + $sort_key_sql['l'] = 'u.user_lastvisit'; + } + + $sort_key_text['m'] = $user->lang['SORT_RANK']; + $sort_key_sql['m'] = 'u.user_rank'; + + $sort_dir_text = array('a' => $user->lang['ASCENDING'], 'd' => $user->lang['DESCENDING']); + + $s_sort_key = ''; + foreach ($sort_key_text as $key => $value) + { + $selected = ($sort_key == $key) ? ' selected="selected"' : ''; + $s_sort_key .= ''; + } + + $s_sort_dir = ''; + foreach ($sort_dir_text as $key => $value) + { + $selected = ($sort_dir == $key) ? ' selected="selected"' : ''; + $s_sort_dir .= ''; + } + + // Additional sorting options for user search ... if search is enabled, if not + // then only admins can make use of this (for ACP functionality) + $sql_select = $sql_where_data = $sql_from = $sql_where = $order_by = ''; + + + $form = $request->variable('form', ''); + $field = $request->variable('field', ''); + $select_single = $request->variable('select_single', false); + + // Search URL parameters, if any of these are in the URL we do a search + $search_params = array('username', 'email', 'jabber', 'search_group_id', 'joined_select', 'active_select', 'count_select', 'joined', 'active', 'count', 'ip'); + + // We validate form and field here, only id/class allowed + $form = (!preg_match('/^[a-z0-9_-]+$/i', $form)) ? '' : $form; + $field = (!preg_match('/^[a-z0-9_-]+$/i', $field)) ? '' : $field; + if ((($mode == '' || $mode == 'searchuser') || count(array_intersect($request->variable_names(\phpbb\request\request_interface::GET), $search_params)) > 0) && ($config['load_search'] || $auth->acl_get('a_'))) + { + $username = $request->variable('username', '', true); + $email = strtolower($request->variable('email', '')); + $jabber = $request->variable('jabber', ''); + $search_group_id = $request->variable('search_group_id', 0); + + // when using these, make sure that we actually have values defined in $find_key_match + $joined_select = $request->variable('joined_select', 'lt'); + $active_select = $request->variable('active_select', 'lt'); + $count_select = $request->variable('count_select', 'eq'); + + $joined = explode('-', $request->variable('joined', '')); + $active = explode('-', $request->variable('active', '')); + $count = ($request->variable('count', '') !== '') ? $request->variable('count', 0) : ''; + $ipdomain = $request->variable('ip', ''); + + $find_key_match = array('lt' => '<', 'gt' => '>', 'eq' => '='); + + $find_count = array('lt' => $user->lang['LESS_THAN'], 'eq' => $user->lang['EQUAL_TO'], 'gt' => $user->lang['MORE_THAN']); + $s_find_count = ''; + foreach ($find_count as $key => $value) + { + $selected = ($count_select == $key) ? ' selected="selected"' : ''; + $s_find_count .= ''; + } + + $find_time = array('lt' => $user->lang['BEFORE'], 'gt' => $user->lang['AFTER']); + $s_find_join_time = ''; + foreach ($find_time as $key => $value) + { + $selected = ($joined_select == $key) ? ' selected="selected"' : ''; + $s_find_join_time .= ''; + } + + $s_find_active_time = ''; + foreach ($find_time as $key => $value) + { + $selected = ($active_select == $key) ? ' selected="selected"' : ''; + $s_find_active_time .= ''; + } + + $sql_where .= ($username) ? ' AND u.username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($username))) : ''; + $sql_where .= ($auth->acl_get('a_user') && $email) ? ' AND u.user_email ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $email)) . ' ' : ''; + $sql_where .= ($jabber) ? ' AND u.user_jabber ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), $jabber)) . ' ' : ''; + $sql_where .= (is_numeric($count) && isset($find_key_match[$count_select])) ? ' AND u.user_posts ' . $find_key_match[$count_select] . ' ' . (int) $count . ' ' : ''; + + if (isset($find_key_match[$joined_select]) && count($joined) == 3) + { + $joined_time = gmmktime(0, 0, 0, (int) $joined[1], (int) $joined[2], (int) $joined[0]); + + if ($joined_time !== false) + { + $sql_where .= " AND u.user_regdate " . $find_key_match[$joined_select] . ' ' . $joined_time; + } + } + + if (isset($find_key_match[$active_select]) && count($active) == 3 && $auth->acl_get('u_viewonline')) + { + $active_time = gmmktime(0, 0, 0, (int) $active[1], (int) $active[2], (int) $active[0]); + + if ($active_time !== false) + { + $sql_where .= " AND u.user_lastvisit " . $find_key_match[$active_select] . ' ' . $active_time; + } + } + + $sql_where .= ($search_group_id) ? " AND u.user_id = ug.user_id AND ug.group_id = $search_group_id AND ug.user_pending = 0 " : ''; + + if ($search_group_id) + { + $sql_from = ', ' . USER_GROUP_TABLE . ' ug '; + } + + if ($ipdomain && $auth->acl_getf_global('m_info')) + { + if (strspn($ipdomain, 'abcdefghijklmnopqrstuvwxyz')) + { + $hostnames = gethostbynamel($ipdomain); + + if ($hostnames !== false) + { + $ips = "'" . implode('\', \'', array_map(array($db, 'sql_escape'), preg_replace('#([0-9]{1,3}\.[0-9]{1,3}[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})#', "\\1", gethostbynamel($ipdomain)))) . "'"; + } + else + { + $ips = false; + } + } + else + { + $ips = "'" . str_replace('*', '%', $db->sql_escape($ipdomain)) . "'"; + } + + if ($ips === false) + { + // A minor fudge but it does the job :D + $sql_where .= " AND u.user_id = 0"; + } + else + { + $ip_forums = array_keys($auth->acl_getf('m_info', true)); + + $sql = 'SELECT DISTINCT poster_id + FROM ' . POSTS_TABLE . ' + WHERE poster_ip ' . ((strpos($ips, '%') !== false) ? 'LIKE' : 'IN') . " ($ips) + AND " . $db->sql_in_set('forum_id', $ip_forums); + + /** + * Modify sql query for members search by ip address / hostname + * + * @event core.memberlist_modify_ip_search_sql_query + * @var string ipdomain The host name + * @var string ips IP address list for the given host name + * @var string sql The SQL query for searching members by IP address + * @since 3.1.7-RC1 + */ + $vars = array( + 'ipdomain', + 'ips', + 'sql', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_ip_search_sql_query', compact($vars))); + + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $ip_sql = array(); + do + { + $ip_sql[] = $row['poster_id']; + } + while ($row = $db->sql_fetchrow($result)); + + $sql_where .= ' AND ' . $db->sql_in_set('u.user_id', $ip_sql); + } + else + { + // A minor fudge but it does the job :D + $sql_where .= " AND u.user_id = 0"; + } + unset($ip_forums); + + $db->sql_freeresult($result); + } + } + } + + $first_char = $request->variable('first_char', ''); + + if ($first_char == 'other') + { + for ($i = 97; $i < 123; $i++) + { + $sql_where .= ' AND u.username_clean NOT ' . $db->sql_like_expression(chr($i) . $db->get_any_char()); + } + } + else if ($first_char) + { + $sql_where .= ' AND u.username_clean ' . $db->sql_like_expression(substr($first_char, 0, 1) . $db->get_any_char()); + } + + // Are we looking at a usergroup? If so, fetch additional info + // and further restrict the user info query + if ($mode == 'group') + { + // We JOIN here to save a query for determining membership for hidden groups. ;) + $sql = 'SELECT g.*, ug.user_id, ug.group_leader + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug ON (ug.user_pending = 0 AND ug.user_id = ' . $user->data['user_id'] . " AND ug.group_id = $group_id) + WHERE g.group_id = $group_id"; + $result = $db->sql_query($sql); + $group_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$group_row) + { + trigger_error('NO_GROUP'); + } + + switch ($group_row['group_type']) + { + case GROUP_OPEN: + $group_row['l_group_type'] = 'OPEN'; + break; + + case GROUP_CLOSED: + $group_row['l_group_type'] = 'CLOSED'; + break; + + case GROUP_HIDDEN: + $group_row['l_group_type'] = 'HIDDEN'; + + // Check for membership or special permissions + if (!$auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel') && $group_row['user_id'] != $user->data['user_id']) + { + trigger_error('NO_GROUP'); + } + break; + + case GROUP_SPECIAL: + $group_row['l_group_type'] = 'SPECIAL'; + break; + + case GROUP_FREE: + $group_row['l_group_type'] = 'FREE'; + break; + } + + $avatar_img = phpbb_get_group_avatar($group_row); + + // ... same for group rank + $user_rank_data = array( + 'title' => null, + 'img' => null, + 'img_src' => null, + ); + if ($group_row['group_rank']) + { + $user_rank_data = phpbb_get_user_rank($group_row, false); + + if ($user_rank_data['img']) + { + $user_rank_data['img'] .= '
'; + } + } + // include modules for manage groups link display or not + // need to ensure the module is active + $can_manage_group = false; + if ($user->data['is_registered'] && $group_row['group_leader']) + { + if (!class_exists('p_master')) + { + include($phpbb_root_path . 'includes/functions_module.' . $phpEx); + } + $module = new p_master; + $module->list_modules('ucp'); + + if ($module->is_active('ucp_groups', 'manage')) + { + $can_manage_group = true; + } + unset($module); + } + + $template->assign_vars(array( + 'GROUP_DESC' => generate_text_for_display($group_row['group_desc'], $group_row['group_desc_uid'], $group_row['group_desc_bitfield'], $group_row['group_desc_options']), + 'GROUP_NAME' => $group_helper->get_name($group_row['group_name']), + 'GROUP_COLOR' => $group_row['group_colour'], + 'GROUP_TYPE' => $user->lang['GROUP_IS_' . $group_row['l_group_type']], + 'GROUP_RANK' => $user_rank_data['title'], + + 'AVATAR_IMG' => $avatar_img, + 'RANK_IMG' => $user_rank_data['img'], + 'RANK_IMG_SRC' => $user_rank_data['img_src'], + + 'U_PM' => ($auth->acl_get('u_sendpm') && $auth->acl_get('u_masspm_group') && $group_row['group_receive_pm'] && $config['allow_privmsg'] && $config['allow_mass_pm']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&g=' . $group_id) : '', + 'U_MANAGE' => ($can_manage_group) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=ucp_groups&mode=manage') : false,) + ); + + $sql_select = ', ug.group_leader'; + $sql_from = ', ' . USER_GROUP_TABLE . ' ug '; + $order_by = 'ug.group_leader DESC, '; + + $sql_where .= " AND ug.user_pending = 0 AND u.user_id = ug.user_id AND ug.group_id = $group_id"; + $sql_where_data = " AND u.user_id = ug.user_id AND ug.group_id = $group_id"; + } + + // Sorting and order + if (!isset($sort_key_sql[$sort_key])) + { + $sort_key = $default_key; + } + + $order_by .= $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); + + // Unfortunately we must do this here for sorting by rank, else the sort order is applied wrongly + if ($sort_key == 'm') + { + $order_by .= ', u.user_posts DESC'; + } + + /** + * Modify sql query data for members search + * + * @event core.memberlist_modify_sql_query_data + * @var string order_by SQL ORDER BY clause condition + * @var string sort_dir The sorting direction + * @var string sort_key The sorting key + * @var array sort_key_sql Arraty with the sorting conditions data + * @var string sql_from SQL FROM clause condition + * @var string sql_select SQL SELECT fields list + * @var string sql_where SQL WHERE clause condition + * @var string sql_where_data SQL WHERE clause additional conditions data + * @since 3.1.7-RC1 + */ + $vars = array( + 'order_by', + 'sort_dir', + 'sort_key', + 'sort_key_sql', + 'sql_from', + 'sql_select', + 'sql_where', + 'sql_where_data', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_sql_query_data', compact($vars))); + + // Count the users ... + $sql = 'SELECT COUNT(u.user_id) AS total_users + FROM ' . USERS_TABLE . " u$sql_from + WHERE " . $db->sql_in_set('u.user_type', $user_types) . " + $sql_where"; + $result = $db->sql_query($sql); + $total_users = (int) $db->sql_fetchfield('total_users'); + $db->sql_freeresult($result); + + // Build a relevant pagination_url + $params = $sort_params = array(); + + // We do not use $request->variable() here directly to save some calls (not all variables are set) + $check_params = array( + 'g' => array('g', 0), + 'sk' => array('sk', $default_key), + 'sd' => array('sd', 'a'), + 'form' => array('form', ''), + 'field' => array('field', ''), + 'select_single' => array('select_single', $select_single), + 'username' => array('username', '', true), + 'email' => array('email', ''), + 'jabber' => array('jabber', ''), + 'search_group_id' => array('search_group_id', 0), + 'joined_select' => array('joined_select', 'lt'), + 'active_select' => array('active_select', 'lt'), + 'count_select' => array('count_select', 'eq'), + 'joined' => array('joined', ''), + 'active' => array('active', ''), + 'count' => ($request->variable('count', '') !== '') ? array('count', 0) : array('count', ''), + 'ip' => array('ip', ''), + 'first_char' => array('first_char', ''), + ); + + $u_first_char_params = array(); + foreach ($check_params as $key => $call) + { + if (!isset($_REQUEST[$key])) + { + continue; + } + + $param = call_user_func_array(array($request, 'variable'), $call); + // Encode strings, convert everything else to int in order to prevent empty parameters. + $param = urlencode($key) . '=' . ((is_string($param)) ? urlencode($param) : (int) $param); + $params[] = $param; + + if ($key != 'first_char') + { + $u_first_char_params[] = $param; + } + if ($key != 'sk' && $key != 'sd') + { + $sort_params[] = $param; + } + } + + $u_hide_find_member = append_sid("{$phpbb_root_path}memberlist.$phpEx", "start=$start" . (!empty($params) ? '&' . implode('&', $params) : '')); + + if ($mode) + { + $params[] = "mode=$mode"; + $u_first_char_params[] = "mode=$mode"; + } + $sort_params[] = "mode=$mode"; + + $u_first_char_params = implode('&', $u_first_char_params); + $u_first_char_params .= ($u_first_char_params) ? '&' : ''; + + $first_characters = array(); + $first_characters[''] = $user->lang['ALL']; + for ($i = 97; $i < 123; $i++) + { + $first_characters[chr($i)] = chr($i - 32); + } + $first_characters['other'] = $user->lang['OTHER']; + + $first_char_block_vars = []; + + foreach ($first_characters as $char => $desc) + { + $first_char_block_vars[] = [ + 'DESC' => $desc, + 'VALUE' => $char, + 'S_SELECTED' => ($first_char == $char) ? true : false, + 'U_SORT' => append_sid("{$phpbb_root_path}memberlist.$phpEx", $u_first_char_params . 'first_char=' . $char) . '#memberlist', + ]; + } + + /** + * Modify memberlist sort and pagination parameters + * + * @event core.memberlist_modify_sort_pagination_params + * @var array sort_params Array with URL parameters for sorting + * @var array params Array with URL parameters for pagination + * @var array first_characters Array that maps each letter in a-z, 'other' and the empty string to their display representation + * @var string u_first_char_params Concatenated URL parameters for first character search links + * @var array first_char_block_vars Template block variables for each first character + * @var int total_users Total number of users found in this search + * @since 3.2.6-RC1 + */ + $vars = [ + 'sort_params', + 'params', + 'first_characters', + 'u_first_char_params', + 'first_char_block_vars', + 'total_users', + ]; + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_sort_pagination_params', compact($vars))); + + $template->assign_block_vars_array('first_char', $first_char_block_vars); + + $pagination_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $params)); + $sort_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", implode('&', $sort_params)); + + unset($search_params, $sort_params); + + // Some search user specific data + if (($mode == '' || $mode == 'searchuser') && ($config['load_search'] || $auth->acl_get('a_'))) + { + $group_selected = $request->variable('search_group_id', 0); + $s_group_select = ''; + $group_ids = array(); + + /** + * @todo add this to a separate function (function is responsible for returning the groups the user is able to see based on the users group membership) + */ + + if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) + { + $sql = 'SELECT group_id, group_name, group_type + FROM ' . GROUPS_TABLE; + + if (!$config['coppa_enable']) + { + $sql .= " WHERE group_name <> 'REGISTERED_COPPA'"; + } + + $sql .= ' ORDER BY group_name ASC'; + } + else + { + $sql = 'SELECT g.group_id, g.group_name, g.group_type + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ')'; + + if (!$config['coppa_enable']) + { + $sql .= " AND g.group_name <> 'REGISTERED_COPPA'"; + } + + $sql .= ' ORDER BY g.group_name ASC'; + } + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $group_ids[] = $row['group_id']; + $s_group_select .= ''; + } + $db->sql_freeresult($result); + + if ($group_selected !== 0 && !in_array($group_selected, $group_ids)) + { + trigger_error('NO_GROUP'); + } + + $template->assign_vars(array( + 'USERNAME' => $username, + 'EMAIL' => $email, + 'JABBER' => $jabber, + 'JOINED' => implode('-', $joined), + 'ACTIVE' => implode('-', $active), + 'COUNT' => $count, + 'IP' => $ipdomain, + + 'S_IP_SEARCH_ALLOWED' => ($auth->acl_getf_global('m_info')) ? true : false, + 'S_EMAIL_SEARCH_ALLOWED'=> ($auth->acl_get('a_user')) ? true : false, + 'S_JABBER_ENABLED' => $config['jab_enable'], + 'S_IN_SEARCH_POPUP' => ($form && $field) ? true : false, + 'S_SEARCH_USER' => ($mode == 'searchuser' || ($mode == '' && $submit)), + 'S_FORM_NAME' => $form, + 'S_FIELD_NAME' => $field, + 'S_SELECT_SINGLE' => $select_single, + 'S_COUNT_OPTIONS' => $s_find_count, + 'S_SORT_OPTIONS' => $s_sort_key, + 'S_JOINED_TIME_OPTIONS' => $s_find_join_time, + 'S_ACTIVE_TIME_OPTIONS' => $s_find_active_time, + 'S_GROUP_SELECT' => $s_group_select, + 'S_USER_SEARCH_ACTION' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=searchuser&form=$form&field=$field")) + ); + } + + $start = $pagination->validate_start($start, $config['topics_per_page'], $total_users); + + // Get us some users :D + $sql = "SELECT u.user_id + FROM " . USERS_TABLE . " u + $sql_from + WHERE " . $db->sql_in_set('u.user_type', $user_types) . " + $sql_where + ORDER BY $order_by"; + $result = $db->sql_query_limit($sql, $config['topics_per_page'], $start); + + $user_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $user_list[] = (int) $row['user_id']; + } + $db->sql_freeresult($result); + + // Load custom profile fields + if ($config['load_cpf_memberlist']) + { + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + + $cp_row = $cp->generate_profile_fields_template_headlines('field_show_on_ml'); + foreach ($cp_row as $profile_field) + { + $template->assign_block_vars('custom_fields', $profile_field); + } + } + + $leaders_set = false; + // So, did we get any users? + if (count($user_list)) + { + // Session time?! Session time... + $sql = 'SELECT session_user_id, MAX(session_time) AS session_time + FROM ' . SESSIONS_TABLE . ' + WHERE session_time >= ' . (time() - $config['session_length']) . ' + AND ' . $db->sql_in_set('session_user_id', $user_list) . ' + GROUP BY session_user_id'; + $result = $db->sql_query($sql); + + $session_times = array(); + while ($row = $db->sql_fetchrow($result)) + { + $session_times[$row['session_user_id']] = $row['session_time']; + } + $db->sql_freeresult($result); + + // Do the SQL thang + if ($mode == 'group') + { + $sql_from_ary = explode(',', $sql_from); + $extra_tables = []; + foreach ($sql_from_ary as $entry) + { + $table_data = explode(' ', trim($entry)); + + if (empty($table_data[0]) || empty($table_data[1])) + { + continue; + } + + $extra_tables[$table_data[0]] = $table_data[1]; + } + + $sql_array = array( + 'SELECT' => 'u.*' . $sql_select, + 'FROM' => array_merge([USERS_TABLE => 'u'], $extra_tables), + 'WHERE' => $db->sql_in_set('u.user_id', $user_list) . $sql_where_data . '', + ); + } + else + { + $sql_array = array( + 'SELECT' => 'u.*', + 'FROM' => array( + USERS_TABLE => 'u' + ), + 'WHERE' => $db->sql_in_set('u.user_id', $user_list), + ); + } + + /** + * Modify user data SQL before member row is created + * + * @event core.memberlist_modify_memberrow_sql + * @var string mode Memberlist mode + * @var string sql_select Additional select statement + * @var string sql_from Additional from statement + * @var array sql_array Array containing the main query + * @var array user_list Array containing list of users + * @since 3.2.6-RC1 + */ + $vars = array( + 'mode', + 'sql_select', + 'sql_from', + 'sql_array', + 'user_list', + ); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_memberrow_sql', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + + $id_cache = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['session_time'] = (!empty($session_times[$row['user_id']])) ? $session_times[$row['user_id']] : 0; + $row['last_visit'] = (!empty($row['session_time'])) ? $row['session_time'] : $row['user_lastvisit']; + + $id_cache[$row['user_id']] = $row; + } + + $db->sql_freeresult($result); + + // Load custom profile fields if required + if ($config['load_cpf_memberlist']) + { + // Grab all profile fields from users in id cache for later use - similar to the poster cache + $profile_fields_cache = $cp->grab_profile_fields_data($user_list); + + // Filter the fields we don't want to show + foreach ($profile_fields_cache as $user_id => $user_profile_fields) + { + foreach ($user_profile_fields as $field_ident => $profile_field) + { + if (!$profile_field['data']['field_show_on_ml']) + { + unset($profile_fields_cache[$user_id][$field_ident]); + } + } + } + } + + // If we sort by last active date we need to adjust the id cache due to user_lastvisit not being the last active date... + if ($sort_key == 'l') + { +// uasort($id_cache, create_function('$first, $second', "return (\$first['last_visit'] == \$second['last_visit']) ? 0 : ((\$first['last_visit'] < \$second['last_visit']) ? $lesser_than : ($lesser_than * -1));")); + usort($user_list, 'phpbb_sort_last_active'); + } + + // do we need to display contact fields as such + $use_contact_fields = false; + + /** + * Modify list of users before member row is created + * + * @event core.memberlist_memberrow_before + * @var array user_list Array containing list of users + * @var bool use_contact_fields Should we display contact fields as such? + * @since 3.1.7-RC1 + */ + $vars = array('user_list', 'use_contact_fields'); + extract($phpbb_dispatcher->trigger_event('core.memberlist_memberrow_before', compact($vars))); + + for ($i = 0, $end = count($user_list); $i < $end; ++$i) + { + $user_id = $user_list[$i]; + $row = $id_cache[$user_id]; + $is_leader = (isset($row['group_leader']) && $row['group_leader']) ? true : false; + $leaders_set = ($leaders_set || $is_leader); + + $cp_row = array(); + if ($config['load_cpf_memberlist']) + { + $cp_row = (isset($profile_fields_cache[$user_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$user_id], $use_contact_fields) : array(); + } + + $memberrow = array_merge(phpbb_show_profile($row, false, false, false), array( + 'ROW_NUMBER' => $i + ($start + 1), + + 'S_CUSTOM_PROFILE' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, + 'S_GROUP_LEADER' => $is_leader, + 'S_INACTIVE' => $row['user_type'] == USER_INACTIVE, + + 'U_VIEW_PROFILE' => get_username_string('profile', $user_id, $row['username']), + )); + + if (isset($cp_row['row']) && count($cp_row['row'])) + { + $memberrow = array_merge($memberrow, $cp_row['row']); + } + + $template->assign_block_vars('memberrow', $memberrow); + + if (isset($cp_row['blockrow']) && count($cp_row['blockrow'])) + { + foreach ($cp_row['blockrow'] as $field_data) + { + $template->assign_block_vars('memberrow.custom_fields', $field_data); + } + } + + unset($id_cache[$user_id]); + } + } + + $pagination->generate_template_pagination($pagination_url, 'pagination', 'start', $total_users, $config['topics_per_page'], $start); + + // Generate page + $template_vars = array( + 'TOTAL_USERS' => $user->lang('LIST_USERS', (int) $total_users), + + 'PROFILE_IMG' => $user->img('icon_user_profile', $user->lang['PROFILE']), + 'PM_IMG' => $user->img('icon_contact_pm', $user->lang['SEND_PRIVATE_MESSAGE']), + 'EMAIL_IMG' => $user->img('icon_contact_email', $user->lang['EMAIL']), + 'JABBER_IMG' => $user->img('icon_contact_jabber', $user->lang['JABBER']), + 'SEARCH_IMG' => $user->img('icon_user_search', $user->lang['SEARCH']), + + 'U_FIND_MEMBER' => ($config['load_search'] || $auth->acl_get('a_')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser' . (($start) ? "&start=$start" : '') . (!empty($params) ? '&' . implode('&', $params) : '')) : '', + 'U_HIDE_FIND_MEMBER' => ($mode == 'searchuser' || ($mode == '' && $submit)) ? $u_hide_find_member : '', + 'U_LIVE_SEARCH' => ($config['allow_live_searches']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=livesearch') : false, + 'U_SORT_USERNAME' => $sort_url . '&sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a'), + 'U_SORT_JOINED' => $sort_url . '&sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_SORT_POSTS' => $sort_url . '&sk=d&sd=' . (($sort_key == 'd' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_SORT_EMAIL' => $sort_url . '&sk=e&sd=' . (($sort_key == 'e' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_SORT_ACTIVE' => ($auth->acl_get('u_viewonline')) ? $sort_url . '&sk=l&sd=' . (($sort_key == 'l' && $sort_dir == 'd') ? 'a' : 'd') : '', + 'U_SORT_RANK' => $sort_url . '&sk=m&sd=' . (($sort_key == 'm' && $sort_dir == 'd') ? 'a' : 'd'), + 'U_LIST_CHAR' => $sort_url . '&sk=a&sd=' . (($sort_key == 'l' && $sort_dir == 'd') ? 'a' : 'd'), + + 'S_SHOW_GROUP' => ($mode == 'group') ? true : false, + 'S_VIEWONLINE' => $auth->acl_get('u_viewonline'), + 'S_LEADERS_SET' => $leaders_set, + 'S_MODE_SELECT' => $s_sort_key, + 'S_ORDER_SELECT' => $s_sort_dir, + 'S_MODE_ACTION' => $pagination_url, + ); + + /** + * Modify memberlist page template vars + * + * @event core.memberlist_modify_template_vars + * @var array params Array containing URL parameters + * @var string sort_url Sorting URL base + * @var array template_vars Array containing template vars + * @since 3.2.2-RC1 + */ + $vars = array('params', 'sort_url', 'template_vars'); + extract($phpbb_dispatcher->trigger_event('core.memberlist_modify_template_vars', compact($vars))); + + $template->assign_vars($template_vars); +} + +// Output the page +page_header($page_title); + +$template->set_filenames(array( + 'body' => $template_html) +); +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + +page_footer(); diff --git a/install/update/old/phpbb/auth/provider/apache.php b/install/update/old/phpbb/auth/provider/apache.php new file mode 100644 index 0000000..aa5bf64 --- /dev/null +++ b/install/update/old/phpbb/auth/provider/apache.php @@ -0,0 +1,264 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider; + +/** +* Apache authentication provider for phpBB3 +*/ +class apache extends \phpbb\auth\provider\base +{ + /** + * phpBB passwords manager + * + * @var \phpbb\passwords\manager + */ + protected $passwords_manager; + + /** + * Apache Authentication Constructor + * + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\config\config $config Config object + * @param \phpbb\passwords\manager $passwords_manager Passwords Manager object + * @param \phpbb\request\request $request Request object + * @param \phpbb\user $user User object + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, $phpbb_root_path, $php_ext) + { + $this->db = $db; + $this->config = $config; + $this->passwords_manager = $passwords_manager; + $this->request = $request; + $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * {@inheritdoc} + */ + public function init() + { + if (!$this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER) || $this->user->data['username'] !== htmlspecialchars_decode($this->request->server('PHP_AUTH_USER'))) + { + return $this->user->lang['APACHE_SETUP_BEFORE_USE']; + } + return false; + } + + /** + * {@inheritdoc} + */ + public function login($username, $password) + { + // do not allow empty password + if (!$password) + { + return array( + 'status' => LOGIN_ERROR_PASSWORD, + 'error_msg' => 'NO_PASSWORD_SUPPLIED', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!$username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!$this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER)) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $php_auth_user = htmlspecialchars_decode($this->request->server('PHP_AUTH_USER')); + $php_auth_pw = htmlspecialchars_decode($this->request->server('PHP_AUTH_PW')); + + if (!empty($php_auth_user) && !empty($php_auth_pw)) + { + if ($php_auth_user !== $username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type + FROM ' . USERS_TABLE . " + WHERE username = '" . $this->db->sql_escape($php_auth_user) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + // User inactive... + if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) + { + return array( + 'status' => LOGIN_ERROR_ACTIVE, + 'error_msg' => 'ACTIVE_ERROR', + 'user_row' => $row, + ); + } + + // Successful login... + return array( + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ); + } + + // this is the user's first login so create an empty profile + return array( + 'status' => LOGIN_SUCCESS_CREATE_PROFILE, + 'error_msg' => false, + 'user_row' => $this->user_row($php_auth_user, $php_auth_pw), + ); + } + + // Not logged into apache + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + /** + * {@inheritdoc} + */ + public function autologin() + { + if (!$this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER)) + { + return array(); + } + + $php_auth_user = htmlspecialchars_decode($this->request->server('PHP_AUTH_USER')); + $php_auth_pw = htmlspecialchars_decode($this->request->server('PHP_AUTH_PW')); + + if (!empty($php_auth_user) && !empty($php_auth_pw)) + { + set_var($php_auth_user, $php_auth_user, 'string', true); + set_var($php_auth_pw, $php_auth_pw, 'string', true); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE username = '" . $this->db->sql_escape($php_auth_user) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + return ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) ? array() : $row; + } + + if (!function_exists('user_add')) + { + include($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + // create the user if he does not exist yet + user_add($this->user_row($php_auth_user, $php_auth_pw)); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($php_auth_user)) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + return $row; + } + } + + return array(); + } + + /** + * This function generates an array which can be passed to the user_add + * function in order to create a user + * + * @param string $username The username of the new user. + * @param string $password The password of the new user. + * @return array Contains data that can be passed directly to + * the user_add function. + */ + private function user_row($username, $password) + { + // first retrieve default group id + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "' + AND group_type = " . GROUP_SPECIAL; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + // generate user account data + return array( + 'username' => $username, + 'user_password' => $this->passwords_manager->hash($password), + 'user_email' => '', + 'group_id' => (int) $row['group_id'], + 'user_type' => USER_NORMAL, + 'user_ip' => $this->user->ip, + 'user_new' => ($this->config['new_member_post_limit']) ? 1 : 0, + ); + } + + /** + * {@inheritdoc} + */ + public function validate_session($user) + { + // Check if PHP_AUTH_USER is set and handle this case + if ($this->request->is_set('PHP_AUTH_USER', \phpbb\request\request_interface::SERVER)) + { + $php_auth_user = $this->request->server('PHP_AUTH_USER'); + + return ($php_auth_user === $user['username']) ? true : false; + } + + // PHP_AUTH_USER is not set. A valid session is now determined by the user type (anonymous/bot or not) + if ($user['user_type'] == USER_IGNORE) + { + return true; + } + + return false; + } +} diff --git a/install/update/old/phpbb/auth/provider/base.php b/install/update/old/phpbb/auth/provider/base.php new file mode 100644 index 0000000..dea27cc --- /dev/null +++ b/install/update/old/phpbb/auth/provider/base.php @@ -0,0 +1,108 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider; + +/** +* Base authentication provider class that all other providers should implement +*/ +abstract class base implements \phpbb\auth\provider\provider_interface +{ + /** + * {@inheritdoc} + */ + public function init() + { + return; + } + + /** + * {@inheritdoc} + */ + public function autologin() + { + return; + } + + /** + * {@inheritdoc} + */ + public function acp() + { + return; + } + + /** + * {@inheritdoc} + */ + public function get_acp_template($new_config) + { + return; + } + + /** + * {@inheritdoc} + */ + public function get_login_data() + { + return; + } + + /** + * {@inheritdoc} + */ + public function get_auth_link_data($user_id = 0) + { + return; + } + + /** + * {@inheritdoc} + */ + public function logout($data, $new_session) + { + return; + } + + /** + * {@inheritdoc} + */ + public function validate_session($user) + { + return; + } + + /** + * {@inheritdoc} + */ + public function login_link_has_necessary_data($login_link_data) + { + return; + } + + /** + * {@inheritdoc} + */ + public function link_account(array $link_data) + { + return; + } + + /** + * {@inheritdoc} + */ + public function unlink_account(array $link_data) + { + return; + } +} diff --git a/install/update/old/phpbb/auth/provider/db.php b/install/update/old/phpbb/auth/provider/db.php new file mode 100644 index 0000000..1adf85e --- /dev/null +++ b/install/update/old/phpbb/auth/provider/db.php @@ -0,0 +1,240 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider; + +/** + * Database authentication provider for phpBB3 + * This is for authentication via the integrated user table + */ +class db extends \phpbb\auth\provider\base +{ + /** + * phpBB passwords manager + * + * @var \phpbb\passwords\manager + */ + protected $passwords_manager; + + /** + * DI container + * + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $phpbb_container; + + /** + * Database Authentication Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\config\config $config + * @param \phpbb\passwords\manager $passwords_manager + * @param \phpbb\request\request $request + * @param \phpbb\user $user + * @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request $request, \phpbb\user $user, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, $phpbb_root_path, $php_ext) + { + $this->db = $db; + $this->config = $config; + $this->passwords_manager = $passwords_manager; + $this->request = $request; + $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->phpbb_container = $phpbb_container; + } + + /** + * {@inheritdoc} + */ + public function login($username, $password) + { + // Auth plugins get the password untrimmed. + // For compatibility we trim() here. + $password = trim($password); + + // do not allow empty password + if (!$password) + { + return array( + 'status' => LOGIN_ERROR_PASSWORD, + 'error_msg' => 'NO_PASSWORD_SUPPLIED', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!$username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $username_clean = utf8_clean_string($username); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $this->db->sql_escape($username_clean) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (($this->user->ip && !$this->config['ip_login_limit_use_forwarded']) || + ($this->user->forwarded_for && $this->config['ip_login_limit_use_forwarded'])) + { + $sql = 'SELECT COUNT(*) AS attempts + FROM ' . LOGIN_ATTEMPT_TABLE . ' + WHERE attempt_time > ' . (time() - (int) $this->config['ip_login_limit_time']); + if ($this->config['ip_login_limit_use_forwarded']) + { + $sql .= " AND attempt_forwarded_for = '" . $this->db->sql_escape($this->user->forwarded_for) . "'"; + } + else + { + $sql .= " AND attempt_ip = '" . $this->db->sql_escape($this->user->ip) . "' "; + } + + $result = $this->db->sql_query($sql); + $attempts = (int) $this->db->sql_fetchfield('attempts'); + $this->db->sql_freeresult($result); + + $attempt_data = array( + 'attempt_ip' => $this->user->ip, + 'attempt_browser' => trim(substr($this->user->browser, 0, 149)), + 'attempt_forwarded_for' => $this->user->forwarded_for, + 'attempt_time' => time(), + 'user_id' => ($row) ? (int) $row['user_id'] : 0, + 'username' => $username, + 'username_clean' => $username_clean, + ); + $sql = 'INSERT INTO ' . LOGIN_ATTEMPT_TABLE . $this->db->sql_build_array('INSERT', $attempt_data); + $this->db->sql_query($sql); + } + else + { + $attempts = 0; + } + + if (!$row) + { + if ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max']) + { + return array( + 'status' => LOGIN_ERROR_ATTEMPTS, + 'error_msg' => 'LOGIN_ERROR_ATTEMPTS', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $show_captcha = ($this->config['max_login_attempts'] && $row['user_login_attempts'] >= $this->config['max_login_attempts']) || + ($this->config['ip_login_limit_max'] && $attempts >= $this->config['ip_login_limit_max']); + + // If there are too many login attempts, we need to check for a confirm image + // Every auth module is able to define what to do by itself... + if ($show_captcha) + { + /* @var $captcha_factory \phpbb\captcha\factory */ + $captcha_factory = $this->phpbb_container->get('captcha.factory'); + $captcha = $captcha_factory->get_instance($this->config['captcha_plugin']); + $captcha->init(CONFIRM_LOGIN); + $vc_response = $captcha->validate($row); + if ($vc_response) + { + return array( + 'status' => LOGIN_ERROR_ATTEMPTS, + 'error_msg' => 'LOGIN_ERROR_ATTEMPTS', + 'user_row' => $row, + ); + } + else + { + $captcha->reset(); + } + + } + + // Check password ... + if ($this->passwords_manager->check($password, $row['user_password'], $row)) + { + // Check for old password hash... + if ($this->passwords_manager->convert_flag || strlen($row['user_password']) == 32) + { + $hash = $this->passwords_manager->hash($password); + + // Update the password in the users table to the new format + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_password = '" . $this->db->sql_escape($hash) . "' + WHERE user_id = {$row['user_id']}"; + $this->db->sql_query($sql); + + $row['user_password'] = $hash; + } + + $sql = 'DELETE FROM ' . LOGIN_ATTEMPT_TABLE . ' + WHERE user_id = ' . $row['user_id']; + $this->db->sql_query($sql); + + if ($row['user_login_attempts'] != 0) + { + // Successful, reset login attempts (the user passed all stages) + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_login_attempts = 0 + WHERE user_id = ' . $row['user_id']; + $this->db->sql_query($sql); + } + + // User inactive... + if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) + { + return array( + 'status' => LOGIN_ERROR_ACTIVE, + 'error_msg' => 'ACTIVE_ERROR', + 'user_row' => $row, + ); + } + + // Successful login... set user_login_attempts to zero... + return array( + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ); + } + + // Password incorrect - increase login attempts + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_login_attempts = user_login_attempts + 1 + WHERE user_id = ' . (int) $row['user_id'] . ' + AND user_login_attempts < ' . LOGIN_ATTEMPTS_MAX; + $this->db->sql_query($sql); + + // Give status about wrong password... + return array( + 'status' => ($show_captcha) ? LOGIN_ERROR_ATTEMPTS : LOGIN_ERROR_PASSWORD, + 'error_msg' => 'LOGIN_ERROR_PASSWORD', + 'user_row' => $row, + ); + } +} diff --git a/install/update/old/phpbb/auth/provider/ldap.php b/install/update/old/phpbb/auth/provider/ldap.php new file mode 100644 index 0000000..0789a62 --- /dev/null +++ b/install/update/old/phpbb/auth/provider/ldap.php @@ -0,0 +1,348 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider; + +/** + * Database authentication provider for phpBB3 + * This is for authentication via the integrated user table + */ +class ldap extends \phpbb\auth\provider\base +{ + /** + * phpBB passwords manager + * + * @var \phpbb\passwords\manager + */ + protected $passwords_manager; + + /** + * LDAP Authentication Constructor + * + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\config\config $config Config object + * @param \phpbb\passwords\manager $passwords_manager Passwords manager object + * @param \phpbb\user $user User object + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\user $user) + { + $this->db = $db; + $this->config = $config; + $this->passwords_manager = $passwords_manager; + $this->user = $user; + } + + /** + * {@inheritdoc} + */ + public function init() + { + if (!@extension_loaded('ldap')) + { + return $this->user->lang['LDAP_NO_LDAP_EXTENSION']; + } + + $this->config['ldap_port'] = (int) $this->config['ldap_port']; + if ($this->config['ldap_port']) + { + $ldap = @ldap_connect($this->config['ldap_server'], $this->config['ldap_port']); + } + else + { + $ldap = @ldap_connect($this->config['ldap_server']); + } + + if (!$ldap) + { + return $this->user->lang['LDAP_NO_SERVER_CONNECTION']; + } + + @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); + @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); + + if ($this->config['ldap_user'] || $this->config['ldap_password']) + { + if (!@ldap_bind($ldap, htmlspecialchars_decode($this->config['ldap_user']), htmlspecialchars_decode($this->config['ldap_password']))) + { + return $this->user->lang['LDAP_INCORRECT_USER_PASSWORD']; + } + } + + // ldap_connect only checks whether the specified server is valid, so the connection might still fail + $search = @ldap_search( + $ldap, + htmlspecialchars_decode($this->config['ldap_base_dn']), + $this->ldap_user_filter($this->user->data['username']), + (empty($this->config['ldap_email'])) ? + array(htmlspecialchars_decode($this->config['ldap_uid'])) : + array(htmlspecialchars_decode($this->config['ldap_uid']), htmlspecialchars_decode($this->config['ldap_email'])), + 0, + 1 + ); + + if ($search === false) + { + return $this->user->lang['LDAP_SEARCH_FAILED']; + } + + $result = @ldap_get_entries($ldap, $search); + + @ldap_close($ldap); + + if (!is_array($result) || count($result) < 2) + { + return sprintf($this->user->lang['LDAP_NO_IDENTITY'], $this->user->data['username']); + } + + if (!empty($this->config['ldap_email']) && !isset($result[0][htmlspecialchars_decode($this->config['ldap_email'])])) + { + return $this->user->lang['LDAP_NO_EMAIL']; + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function login($username, $password) + { + // do not allow empty password + if (!$password) + { + return array( + 'status' => LOGIN_ERROR_PASSWORD, + 'error_msg' => 'NO_PASSWORD_SUPPLIED', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!$username) + { + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + if (!@extension_loaded('ldap')) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LDAP_NO_LDAP_EXTENSION', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + $this->config['ldap_port'] = (int) $this->config['ldap_port']; + if ($this->config['ldap_port']) + { + $ldap = @ldap_connect($this->config['ldap_server'], $this->config['ldap_port']); + } + else + { + $ldap = @ldap_connect($this->config['ldap_server']); + } + + if (!$ldap) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LDAP_NO_SERVER_CONNECTION', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + @ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3); + @ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0); + + if ($this->config['ldap_user'] || $this->config['ldap_password']) + { + if (!@ldap_bind($ldap, htmlspecialchars_decode($this->config['ldap_user']), htmlspecialchars_decode($this->config['ldap_password']))) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LDAP_NO_SERVER_CONNECTION', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + } + + $search = @ldap_search( + $ldap, + htmlspecialchars_decode($this->config['ldap_base_dn']), + $this->ldap_user_filter($username), + (empty($this->config['ldap_email'])) ? + array(htmlspecialchars_decode($this->config['ldap_uid'])) : + array(htmlspecialchars_decode($this->config['ldap_uid']), htmlspecialchars_decode($this->config['ldap_email'])), + 0, + 1 + ); + + $ldap_result = @ldap_get_entries($ldap, $search); + + if (is_array($ldap_result) && count($ldap_result) > 1) + { + if (@ldap_bind($ldap, $ldap_result[0]['dn'], htmlspecialchars_decode($password))) + { + @ldap_close($ldap); + + $sql ='SELECT user_id, username, user_password, user_passchg, user_email, user_type + FROM ' . USERS_TABLE . " + WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + unset($ldap_result); + + // User inactive... + if ($row['user_type'] == USER_INACTIVE || $row['user_type'] == USER_IGNORE) + { + return array( + 'status' => LOGIN_ERROR_ACTIVE, + 'error_msg' => 'ACTIVE_ERROR', + 'user_row' => $row, + ); + } + + // Successful login... set user_login_attempts to zero... + return array( + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ); + } + else + { + // retrieve default group id + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "' + AND group_type = " . GROUP_SPECIAL; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + trigger_error('NO_GROUP'); + } + + // generate user account data + $ldap_user_row = array( + 'username' => $username, + 'user_password' => $this->passwords_manager->hash($password), + 'user_email' => (!empty($this->config['ldap_email'])) ? utf8_htmlspecialchars($ldap_result[0][htmlspecialchars_decode($this->config['ldap_email'])][0]) : '', + 'group_id' => (int) $row['group_id'], + 'user_type' => USER_NORMAL, + 'user_ip' => $this->user->ip, + 'user_new' => ($this->config['new_member_post_limit']) ? 1 : 0, + ); + + unset($ldap_result); + + // this is the user's first login so create an empty profile + return array( + 'status' => LOGIN_SUCCESS_CREATE_PROFILE, + 'error_msg' => false, + 'user_row' => $ldap_user_row, + ); + } + } + else + { + unset($ldap_result); + @ldap_close($ldap); + + // Give status about wrong password... + return array( + 'status' => LOGIN_ERROR_PASSWORD, + 'error_msg' => 'LOGIN_ERROR_PASSWORD', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + } + + @ldap_close($ldap); + + return array( + 'status' => LOGIN_ERROR_USERNAME, + 'error_msg' => 'LOGIN_ERROR_USERNAME', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + /** + * {@inheritdoc} + */ + public function acp() + { + // These are fields required in the config table + return array( + 'ldap_server', 'ldap_port', 'ldap_base_dn', 'ldap_uid', 'ldap_user_filter', 'ldap_email', 'ldap_user', 'ldap_password', + ); + } + + /** + * {@inheritdoc} + */ + public function get_acp_template($new_config) + { + return array( + 'TEMPLATE_FILE' => 'auth_provider_ldap.html', + 'TEMPLATE_VARS' => array( + 'AUTH_LDAP_BASE_DN' => $new_config['ldap_base_dn'], + 'AUTH_LDAP_EMAIL' => $new_config['ldap_email'], + 'AUTH_LDAP_PASSORD' => $new_config['ldap_password'] !== '' ? '********' : '', + 'AUTH_LDAP_PORT' => $new_config['ldap_port'], + 'AUTH_LDAP_SERVER' => $new_config['ldap_server'], + 'AUTH_LDAP_UID' => $new_config['ldap_uid'], + 'AUTH_LDAP_USER' => $new_config['ldap_user'], + 'AUTH_LDAP_USER_FILTER' => $new_config['ldap_user_filter'], + ), + ); + } + + /** + * Generates a filter string for ldap_search to find a user + * + * @param $username string Username identifying the searched user + * + * @return string A filter string for ldap_search + */ + private function ldap_user_filter($username) + { + $filter = '(' . $this->config['ldap_uid'] . '=' . $this->ldap_escape(htmlspecialchars_decode($username)) . ')'; + if ($this->config['ldap_user_filter']) + { + $_filter = ($this->config['ldap_user_filter'][0] == '(' && substr($this->config['ldap_user_filter'], -1) == ')') ? $this->config['ldap_user_filter'] : "({$this->config['ldap_user_filter']})"; + $filter = "(&{$filter}{$_filter})"; + } + return $filter; + } + + /** + * Escapes an LDAP AttributeValue + * + * @param string $string The string to be escaped + * @return string The escaped string + */ + private function ldap_escape($string) + { + return str_replace(array('*', '\\', '(', ')'), array('\\*', '\\\\', '\\(', '\\)'), $string); + } +} diff --git a/install/update/old/phpbb/auth/provider/oauth/oauth.php b/install/update/old/phpbb/auth/provider/oauth/oauth.php new file mode 100644 index 0000000..93419d2 --- /dev/null +++ b/install/update/old/phpbb/auth/provider/oauth/oauth.php @@ -0,0 +1,747 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider\oauth; + +use OAuth\Common\Consumer\Credentials; + +/** +* OAuth authentication provider for phpBB3 +*/ +class oauth extends \phpbb\auth\provider\base +{ + /** + * Database driver + * + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * phpBB config + * + * @var \phpbb\config\config + */ + protected $config; + + /** + * phpBB passwords manager + * + * @var \phpbb\passwords\manager + */ + protected $passwords_manager; + + /** + * phpBB request object + * + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * phpBB user + * + * @var \phpbb\user + */ + protected $user; + + /** + * OAuth token table + * + * @var string + */ + protected $auth_provider_oauth_token_storage_table; + + /** + * OAuth state table + * + * @var string + */ + protected $auth_provider_oauth_state_table; + + /** + * OAuth account association table + * + * @var string + */ + protected $auth_provider_oauth_token_account_assoc; + + /** + * All OAuth service providers + * + * @var \phpbb\di\service_collection Contains \phpbb\auth\provider\oauth\service_interface + */ + protected $service_providers; + + /** + * Users table + * + * @var string + */ + protected $users_table; + + /** + * Cached current uri object + * + * @var \OAuth\Common\Http\Uri\UriInterface|null + */ + protected $current_uri; + + /** + * DI container + * + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $phpbb_container; + + /** + * phpBB event dispatcher + * + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * phpBB root path + * + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP file extension + * + * @var string + */ + protected $php_ext; + + /** + * OAuth Authentication Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\config\config $config + * @param \phpbb\passwords\manager $passwords_manager + * @param \phpbb\request\request_interface $request + * @param \phpbb\user $user + * @param string $auth_provider_oauth_token_storage_table + * @param string $auth_provider_oauth_state_table + * @param string $auth_provider_oauth_token_account_assoc + * @param \phpbb\di\service_collection $service_providers Contains \phpbb\auth\provider\oauth\service_interface + * @param string $users_table + * @param \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container DI container + * @param \phpbb\event\dispatcher_interface $dispatcher phpBB event dispatcher + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\passwords\manager $passwords_manager, \phpbb\request\request_interface $request, \phpbb\user $user, $auth_provider_oauth_token_storage_table, $auth_provider_oauth_state_table, $auth_provider_oauth_token_account_assoc, \phpbb\di\service_collection $service_providers, $users_table, \Symfony\Component\DependencyInjection\ContainerInterface $phpbb_container, \phpbb\event\dispatcher_interface $dispatcher, $phpbb_root_path, $php_ext) + { + $this->db = $db; + $this->config = $config; + $this->passwords_manager = $passwords_manager; + $this->request = $request; + $this->user = $user; + $this->auth_provider_oauth_token_storage_table = $auth_provider_oauth_token_storage_table; + $this->auth_provider_oauth_state_table = $auth_provider_oauth_state_table; + $this->auth_provider_oauth_token_account_assoc = $auth_provider_oauth_token_account_assoc; + $this->service_providers = $service_providers; + $this->users_table = $users_table; + $this->phpbb_container = $phpbb_container; + $this->dispatcher = $dispatcher; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * {@inheritdoc} + */ + public function init() + { + // This does not test whether or not the key and secret provided are valid. + foreach ($this->service_providers as $service_provider) + { + $credentials = $service_provider->get_service_credentials(); + + if (($credentials['key'] && !$credentials['secret']) || (!$credentials['key'] && $credentials['secret'])) + { + return $this->user->lang['AUTH_PROVIDER_OAUTH_ERROR_ELEMENT_MISSING']; + } + } + return false; + } + + /** + * {@inheritdoc} + */ + public function login($username, $password) + { + // Temporary workaround for only having one authentication provider available + if (!$this->request->is_set('oauth_service')) + { + $provider = new \phpbb\auth\provider\db($this->db, $this->config, $this->passwords_manager, $this->request, $this->user, $this->phpbb_container, $this->phpbb_root_path, $this->php_ext); + return $provider->login($username, $password); + } + + // Request the name of the OAuth service + $service_name_original = $this->request->variable('oauth_service', '', false); + $service_name = 'auth.provider.oauth.service.' . strtolower($service_name_original); + if ($service_name_original === '' || !array_key_exists($service_name, $this->service_providers)) + { + return array( + 'status' => LOGIN_ERROR_EXTERNAL_AUTH, + 'error_msg' => 'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST', + 'user_row' => array('user_id' => ANONYMOUS), + ); + } + + // Get the service credentials for the given service + $service_credentials = $this->service_providers[$service_name]->get_service_credentials(); + + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table); + $query = 'mode=login&login=external&oauth_service=' . $service_name_original; + $service = $this->get_service($service_name_original, $storage, $service_credentials, $query, $this->service_providers[$service_name]->get_auth_scope()); + + if (($service::OAUTH_VERSION === 2 && $this->request->is_set('code', \phpbb\request\request_interface::GET)) + || ($service::OAUTH_VERSION === 1 && $this->request->is_set('oauth_token', \phpbb\request\request_interface::GET))) + { + $this->service_providers[$service_name]->set_external_service_provider($service); + $unique_id = $this->service_providers[$service_name]->perform_auth_login(); + + // Check to see if this provider is already assosciated with an account + $data = array( + 'provider' => $service_name_original, + 'oauth_provider_id' => $unique_id + ); + + $sql = 'SELECT user_id FROM ' . $this->auth_provider_oauth_token_account_assoc . ' + WHERE ' . $this->db->sql_build_array('SELECT', $data); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $redirect_data = array( + 'auth_provider' => 'oauth', + 'login_link_oauth_service' => $service_name_original, + ); + + /** + * Event is triggered before check if provider is already associated with an account + * + * @event core.oauth_login_after_check_if_provider_id_has_match + * @var array row User row + * @var array data Provider data + * @var array redirect_data Data to be appended to the redirect url + * @var \OAuth\Common\Service\ServiceInterface service OAuth service + * @since 3.2.3-RC1 + * @changed 3.2.6-RC1 Added redirect_data + */ + $vars = array( + 'row', + 'data', + 'redirect_data', + 'service', + ); + extract($this->dispatcher->trigger_event('core.oauth_login_after_check_if_provider_id_has_match', compact($vars))); + + if (!$row) + { + // The user does not yet exist, ask to link or create profile + return array( + 'status' => LOGIN_SUCCESS_LINK_PROFILE, + 'error_msg' => 'LOGIN_OAUTH_ACCOUNT_NOT_LINKED', + 'user_row' => array(), + 'redirect_data' => $redirect_data, + ); + } + + // Retrieve the user's account + $sql = 'SELECT user_id, username, user_password, user_passchg, user_email, user_type, user_login_attempts + FROM ' . $this->users_table . ' + WHERE user_id = ' . (int) $row['user_id']; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + throw new \Exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_ENTRY'); + } + + /** + * Check if the user is banned. + * The fourth parameter, return, has to be true, + * otherwise the OAuth login is still called and + * an uncaught exception is thrown as there is no + * token stored in the database. + */ + $ban = $this->user->check_ban($row['user_id'], $row['user_ip'], $row['user_email'], true); + if (!empty($ban)) + { + $till_date = !empty($ban['ban_end']) ? $this->user->format_date($ban['ban_end']) : ''; + $message = !empty($ban['ban_end']) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM'; + + $contact_link = phpbb_get_board_contact_link($this->config, $this->phpbb_root_path, $this->php_ext); + $message = $this->user->lang($message, $till_date, '', ''); + $message .= !empty($ban['ban_give_reason']) ? '

' . $this->user->lang('BOARD_BAN_REASON', $ban['ban_give_reason']) : ''; + $message .= !empty($ban['ban_triggered_by']) ? '

' . $this->user->lang('BAN_TRIGGERED_BY_' . strtoupper($ban['ban_triggered_by'])) . '' : ''; + + return array( + 'status' => LOGIN_BREAK, + 'error_msg' => $message, + 'user_row' => $row, + ); + } + + // Update token storage to store the user_id + $storage->set_user_id($row['user_id']); + + /** + * Event is triggered after user is successfully logged in via OAuth. + * + * @event core.auth_oauth_login_after + * @var array row User row + * @since 3.1.11-RC1 + */ + $vars = array( + 'row', + ); + extract($this->dispatcher->trigger_event('core.auth_oauth_login_after', compact($vars))); + + // The user is now authenticated and can be logged in + return array( + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ); + } + else + { + if ($service::OAUTH_VERSION === 1) + { + $token = $service->requestRequestToken(); + $url = $service->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); + } + else + { + $url = $service->getAuthorizationUri(); + } + header('Location: ' . $url); + } + } + + /** + * Returns the cached current_uri object or creates and caches it if it is + * not already created. In each case the query string is updated based on + * the $query parameter. + * + * @param string $service_name The name of the service + * @param string $query The query string of the current_uri + * used in redirects + * @return \OAuth\Common\Http\Uri\UriInterface + */ + protected function get_current_uri($service_name, $query) + { + if ($this->current_uri) + { + $this->current_uri->setQuery($query); + return $this->current_uri; + } + + $uri_factory = new \OAuth\Common\Http\Uri\UriFactory(); + $super_globals = $this->request->get_super_global(\phpbb\request\request_interface::SERVER); + if (!empty($super_globals['HTTP_X_FORWARDED_PROTO']) && $super_globals['HTTP_X_FORWARDED_PROTO'] === 'https') + { + $super_globals['HTTPS'] = 'on'; + $super_globals['SERVER_PORT'] = 443; + } + $current_uri = $uri_factory->createFromSuperGlobalArray($super_globals); + $current_uri->setQuery($query); + + $this->current_uri = $current_uri; + return $current_uri; + } + + /** + * Returns a new service object + * + * @param string $service_name The name of the service + * @param \phpbb\auth\provider\oauth\token_storage $storage + * @param array $service_credentials {@see \phpbb\auth\provider\oauth\oauth::get_service_credentials} + * @param string $query The query string of the + * current_uri used in redirection + * @param array $scopes The scope of the request against + * the api. + * @return \OAuth\Common\Service\ServiceInterface + * @throws \Exception + */ + protected function get_service($service_name, \phpbb\auth\provider\oauth\token_storage $storage, array $service_credentials, $query, array $scopes = array()) + { + $current_uri = $this->get_current_uri($service_name, $query); + + // Setup the credentials for the requests + $credentials = new Credentials( + $service_credentials['key'], + $service_credentials['secret'], + $current_uri->getAbsoluteUri() + ); + + $service_factory = new \OAuth\ServiceFactory(); + $service = $service_factory->createService($service_name, $credentials, $storage, $scopes); + + if (!$service) + { + throw new \Exception('AUTH_PROVIDER_OAUTH_ERROR_SERVICE_NOT_CREATED'); + } + + return $service; + } + + /** + * {@inheritdoc} + */ + public function get_login_data() + { + $login_data = array( + 'TEMPLATE_FILE' => 'login_body_oauth.html', + 'BLOCK_VAR_NAME' => 'oauth', + 'BLOCK_VARS' => array(), + ); + + foreach ($this->service_providers as $service_name => $service_provider) + { + // Only include data if the credentials are set + $credentials = $service_provider->get_service_credentials(); + if ($credentials['key'] && $credentials['secret']) + { + $actual_name = str_replace('auth.provider.oauth.service.', '', $service_name); + $redirect_url = build_url(false) . '&login=external&oauth_service=' . $actual_name; + $login_data['BLOCK_VARS'][$service_name] = array( + 'REDIRECT_URL' => redirect($redirect_url, true), + 'SERVICE_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)], + ); + } + } + + return $login_data; + } + + /** + * {@inheritdoc} + */ + public function acp() + { + $ret = array(); + + foreach ($this->service_providers as $service_name => $service_provider) + { + $actual_name = str_replace('auth.provider.oauth.service.', '', $service_name); + $ret[] = 'auth_oauth_' . $actual_name . '_key'; + $ret[] = 'auth_oauth_' . $actual_name . '_secret'; + } + + return $ret; + } + + /** + * {@inheritdoc} + */ + public function get_acp_template($new_config) + { + $ret = array( + 'BLOCK_VAR_NAME' => 'oauth_services', + 'BLOCK_VARS' => array(), + 'TEMPLATE_FILE' => 'auth_provider_oauth.html', + 'TEMPLATE_VARS' => array(), + ); + + foreach ($this->service_providers as $service_name => $service_provider) + { + $actual_name = str_replace('auth.provider.oauth.service.', '', $service_name); + $ret['BLOCK_VARS'][$actual_name] = array( + 'ACTUAL_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)], + 'KEY' => $new_config['auth_oauth_' . $actual_name . '_key'], + 'NAME' => $actual_name, + 'SECRET' => $new_config['auth_oauth_' . $actual_name . '_secret'], + ); + } + + return $ret; + } + + /** + * {@inheritdoc} + */ + public function login_link_has_necessary_data($login_link_data) + { + if (empty($login_link_data)) + { + return 'LOGIN_LINK_NO_DATA_PROVIDED'; + } + + if (!array_key_exists('oauth_service', $login_link_data) || !$login_link_data['oauth_service'] || + !array_key_exists('link_method', $login_link_data) || !$login_link_data['link_method']) + { + return 'LOGIN_LINK_MISSING_DATA'; + } + + return null; + } + + /** + * {@inheritdoc} + */ + public function link_account(array $link_data) + { + // Check for a valid link method (auth_link or login_link) + if (!array_key_exists('link_method', $link_data) || + !in_array($link_data['link_method'], array( + 'auth_link', + 'login_link', + ))) + { + return 'LOGIN_LINK_MISSING_DATA'; + } + + // We must have an oauth_service listed, check for it two ways + if (!array_key_exists('oauth_service', $link_data) || !$link_data['oauth_service']) + { + $link_data['oauth_service'] = $this->request->variable('oauth_service', ''); + + if (!$link_data['oauth_service']) + { + return 'LOGIN_LINK_MISSING_DATA'; + } + } + + $service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']); + if (!array_key_exists($service_name, $this->service_providers)) + { + return 'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST'; + } + + switch ($link_data['link_method']) + { + case 'auth_link': + return $this->link_account_auth_link($link_data, $service_name); + case 'login_link': + return $this->link_account_login_link($link_data, $service_name); + } + } + + /** + * Performs the account linking for login_link + * + * @param array $link_data The same variable given to {@see \phpbb\auth\provider\provider_interface::link_account} + * @param string $service_name The name of the service being used in + * linking. + * @return string|null Returns a language constant (string) if an error is + * encountered, or null on success. + */ + protected function link_account_login_link(array $link_data, $service_name) + { + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table); + + // Check for an access token, they should have one + if (!$storage->has_access_token_by_session($service_name)) + { + return 'LOGIN_LINK_ERROR_OAUTH_NO_ACCESS_TOKEN'; + } + + // Prepare the query string + $query = 'mode=login_link&login_link_oauth_service=' . strtolower($link_data['oauth_service']); + + // Prepare for an authentication request + $service_credentials = $this->service_providers[$service_name]->get_service_credentials(); + $scopes = $this->service_providers[$service_name]->get_auth_scope(); + $service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $query, $scopes); + $this->service_providers[$service_name]->set_external_service_provider($service); + + // The user has already authenticated successfully, request to authenticate again + $unique_id = $this->service_providers[$service_name]->perform_token_auth(); + + // Insert into table, they will be able to log in after this + $data = array( + 'user_id' => $link_data['user_id'], + 'provider' => strtolower($link_data['oauth_service']), + 'oauth_provider_id' => $unique_id, + ); + + $this->link_account_perform_link($data); + // Update token storage to store the user_id + $storage->set_user_id($link_data['user_id']); + } + + /** + * Performs the account linking for auth_link + * + * @param array $link_data The same variable given to {@see \phpbb\auth\provider\provider_interface::link_account} + * @param string $service_name The name of the service being used in + * linking. + * @return string|null Returns a language constant (string) if an error is + * encountered, or null on success. + */ + protected function link_account_auth_link(array $link_data, $service_name) + { + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table); + $query = 'i=ucp_auth_link&mode=auth_link&link=1&oauth_service=' . strtolower($link_data['oauth_service']); + $service_credentials = $this->service_providers[$service_name]->get_service_credentials(); + $scopes = $this->service_providers[$service_name]->get_auth_scope(); + $service = $this->get_service(strtolower($link_data['oauth_service']), $storage, $service_credentials, $query, $scopes); + + if (($service::OAUTH_VERSION === 2 && $this->request->is_set('code', \phpbb\request\request_interface::GET)) + || ($service::OAUTH_VERSION === 1 && $this->request->is_set('oauth_token', \phpbb\request\request_interface::GET))) + { + $this->service_providers[$service_name]->set_external_service_provider($service); + $unique_id = $this->service_providers[$service_name]->perform_auth_login(); + + // Insert into table, they will be able to log in after this + $data = array( + 'user_id' => $this->user->data['user_id'], + 'provider' => strtolower($link_data['oauth_service']), + 'oauth_provider_id' => $unique_id, + ); + + $this->link_account_perform_link($data); + } + else + { + if ($service::OAUTH_VERSION === 1) + { + $token = $service->requestRequestToken(); + $url = $service->getAuthorizationUri(array('oauth_token' => $token->getRequestToken())); + } + else + { + $url = $service->getAuthorizationUri(); + } + header('Location: ' . $url); + } + } + + /** + * Performs the query that inserts an account link + * + * @param array $data This array is passed to db->sql_build_array + */ + protected function link_account_perform_link(array $data) + { + $sql = 'INSERT INTO ' . $this->auth_provider_oauth_token_account_assoc . ' + ' . $this->db->sql_build_array('INSERT', $data); + $this->db->sql_query($sql); + + /** + * Event is triggered after user links account. + * + * @event core.auth_oauth_link_after + * @var array data User row + * @since 3.1.11-RC1 + */ + $vars = array( + 'data', + ); + extract($this->dispatcher->trigger_event('core.auth_oauth_link_after', compact($vars))); + } + + /** + * {@inheritdoc} + */ + public function logout($data, $new_session) + { + // Clear all tokens belonging to the user + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table); + $storage->clearAllTokens(); + + return; + } + + /** + * {@inheritdoc} + */ + public function get_auth_link_data($user_id = 0) + { + $block_vars = array(); + + // Get all external accounts tied to the current user + $data = array( + 'user_id' => ($user_id <= 0) ? (int) $this->user->data['user_id'] : (int) $user_id, + ); + $sql = 'SELECT oauth_provider_id, provider FROM ' . $this->auth_provider_oauth_token_account_assoc . ' + WHERE ' . $this->db->sql_build_array('SELECT', $data); + $result = $this->db->sql_query($sql); + $rows = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + $oauth_user_ids = array(); + + if ($rows !== false && count($rows)) + { + foreach ($rows as $row) + { + $oauth_user_ids[$row['provider']] = $row['oauth_provider_id']; + } + } + unset($rows); + + foreach ($this->service_providers as $service_name => $service_provider) + { + // Only include data if the credentials are set + $credentials = $service_provider->get_service_credentials(); + if ($credentials['key'] && $credentials['secret']) + { + $actual_name = str_replace('auth.provider.oauth.service.', '', $service_name); + + $block_vars[$service_name] = array( + 'HIDDEN_FIELDS' => array( + 'link' => (!isset($oauth_user_ids[$actual_name])), + 'oauth_service' => $actual_name, + ), + + 'SERVICE_ID' => $actual_name, + 'SERVICE_NAME' => $this->user->lang['AUTH_PROVIDER_OAUTH_SERVICE_' . strtoupper($actual_name)], + 'UNIQUE_ID' => (isset($oauth_user_ids[$actual_name])) ? $oauth_user_ids[$actual_name] : null, + ); + } + } + + return array( + 'BLOCK_VAR_NAME' => 'oauth', + 'BLOCK_VARS' => $block_vars, + + 'TEMPLATE_FILE' => 'ucp_auth_link_oauth.html', + ); + } + + /** + * {@inheritdoc} + */ + public function unlink_account(array $link_data) + { + if (!array_key_exists('oauth_service', $link_data) || !$link_data['oauth_service']) + { + return 'LOGIN_LINK_MISSING_DATA'; + } + + // Remove user specified in $link_data if possible + $user_id = isset($link_data['user_id']) ? $link_data['user_id'] : $this->user->data['user_id']; + + // Remove the link + $sql = 'DELETE FROM ' . $this->auth_provider_oauth_token_account_assoc . " + WHERE provider = '" . $this->db->sql_escape($link_data['oauth_service']) . "' + AND user_id = " . (int) $user_id; + $this->db->sql_query($sql); + + // Clear all tokens belonging to the user on this service + $service_name = 'auth.provider.oauth.service.' . strtolower($link_data['oauth_service']); + $storage = new \phpbb\auth\provider\oauth\token_storage($this->db, $this->user, $this->auth_provider_oauth_token_storage_table, $this->auth_provider_oauth_state_table); + $storage->clearToken($service_name); + } +} diff --git a/install/update/old/phpbb/auth/provider/oauth/service/base.php b/install/update/old/phpbb/auth/provider/oauth/service/base.php new file mode 100644 index 0000000..6adf64a --- /dev/null +++ b/install/update/old/phpbb/auth/provider/oauth/service/base.php @@ -0,0 +1,51 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider\oauth\service; + +/** +* Base OAuth abstract class that all OAuth services should implement +*/ +abstract class base implements \phpbb\auth\provider\oauth\service\service_interface +{ + /** + * External OAuth service provider + * + * @var \OAuth\Common\Service\ServiceInterface + */ + protected $service_provider; + + /** + * {@inheritdoc} + */ + public function get_external_service_provider() + { + return $this->service_provider; + } + + /** + * {@inheritdoc} + */ + public function get_auth_scope() + { + return array(); + } + + /** + * {@inheritdoc} + */ + public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider) + { + $this->service_provider = $service_provider; + } +} diff --git a/install/update/old/phpbb/auth/provider/oauth/service/bitly.php b/install/update/old/phpbb/auth/provider/oauth/service/bitly.php new file mode 100644 index 0000000..25e731a --- /dev/null +++ b/install/update/old/phpbb/auth/provider/oauth/service/bitly.php @@ -0,0 +1,94 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider\oauth\service; + +/** +* Bitly OAuth service +*/ +class bitly extends \phpbb\auth\provider\oauth\service\base +{ + /** + * phpBB config + * + * @var \phpbb\config\config + */ + protected $config; + + /** + * phpBB request + * + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * Constructor + * + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request + */ + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) + { + $this->config = $config; + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public function get_service_credentials() + { + return array( + 'key' => $this->config['auth_oauth_bitly_key'], + 'secret' => $this->config['auth_oauth_bitly_secret'], + ); + } + + /** + * {@inheritdoc} + */ + public function perform_auth_login() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly)) + { + throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + // This was a callback request from bitly, get the token + $this->service_provider->requestAccessToken($this->request->variable('code', '')); + + // Send a request with it + $result = json_decode($this->service_provider->request('user/info'), true); + + // Return the unique identifier returned from bitly + return $result['data']['login']; + } + + /** + * {@inheritdoc} + */ + public function perform_token_auth() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly)) + { + throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + // Send a request with it + $result = json_decode($this->service_provider->request('user/info'), true); + + // Return the unique identifier returned from bitly + return $result['data']['login']; + } +} diff --git a/install/update/old/phpbb/auth/provider/oauth/service/facebook.php b/install/update/old/phpbb/auth/provider/oauth/service/facebook.php new file mode 100644 index 0000000..bb98835 --- /dev/null +++ b/install/update/old/phpbb/auth/provider/oauth/service/facebook.php @@ -0,0 +1,94 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider\oauth\service; + +/** +* Facebook OAuth service +*/ +class facebook extends base +{ + /** + * phpBB config + * + * @var \phpbb\config\config + */ + protected $config; + + /** + * phpBB request + * + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * Constructor + * + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request + */ + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) + { + $this->config = $config; + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public function get_service_credentials() + { + return array( + 'key' => $this->config['auth_oauth_facebook_key'], + 'secret' => $this->config['auth_oauth_facebook_secret'], + ); + } + + /** + * {@inheritdoc} + */ + public function perform_auth_login() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + // This was a callback request, get the token + $this->service_provider->requestAccessToken($this->request->variable('code', '')); + + // Send a request with it + $result = json_decode($this->service_provider->request('/me'), true); + + // Return the unique identifier + return $result['id']; + } + + /** + * {@inheritdoc} + */ + public function perform_token_auth() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + // Send a request with it + $result = json_decode($this->service_provider->request('/me'), true); + + // Return the unique identifier + return $result['id']; + } +} diff --git a/install/update/old/phpbb/auth/provider/oauth/service/google.php b/install/update/old/phpbb/auth/provider/oauth/service/google.php new file mode 100644 index 0000000..cb9f83a --- /dev/null +++ b/install/update/old/phpbb/auth/provider/oauth/service/google.php @@ -0,0 +1,105 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider\oauth\service; + +/** +* Google OAuth service +*/ +class google extends base +{ + /** + * phpBB config + * + * @var \phpbb\config\config + */ + protected $config; + + /** + * phpBB request + * + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * Constructor + * + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request + */ + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) + { + $this->config = $config; + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public function get_auth_scope() + { + return array( + 'userinfo_email', + 'userinfo_profile', + ); + } + + /** + * {@inheritdoc} + */ + public function get_service_credentials() + { + return array( + 'key' => $this->config['auth_oauth_google_key'], + 'secret' => $this->config['auth_oauth_google_secret'], + ); + } + + /** + * {@inheritdoc} + */ + public function perform_auth_login() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + // This was a callback request, get the token + $this->service_provider->requestAccessToken($this->request->variable('code', '')); + + // Send a request with it + $result = json_decode($this->service_provider->request('https://www.googleapis.com/oauth2/v1/userinfo'), true); + + // Return the unique identifier + return $result['id']; + } + + /** + * {@inheritdoc} + */ + public function perform_token_auth() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google)) + { + throw new exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + // Send a request with it + $result = json_decode($this->service_provider->request('https://www.googleapis.com/oauth2/v1/userinfo'), true); + + // Return the unique identifier + return $result['id']; + } +} diff --git a/install/update/old/phpbb/auth/provider/oauth/service/service_interface.php b/install/update/old/phpbb/auth/provider/oauth/service/service_interface.php new file mode 100644 index 0000000..e84eb24 --- /dev/null +++ b/install/update/old/phpbb/auth/provider/oauth/service/service_interface.php @@ -0,0 +1,73 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider\oauth\service; + +/** +* OAuth service interface +*/ +interface service_interface +{ + /** + * Returns an array of the scopes necessary for auth + * + * @return array An array of the required scopes + */ + public function get_auth_scope(); + + /** + * Returns the external library service provider once it has been set + * + * @param \OAuth\Common\Service\ServiceInterface|null + */ + public function get_external_service_provider(); + + /** + * Returns an array containing the service credentials belonging to requested + * service. + * + * @return array An array containing the 'key' and the 'secret' of the + * service in the form: + * array( + * 'key' => string + * 'secret' => string + * ) + */ + public function get_service_credentials(); + + /** + * Returns the results of the authentication in json format + * + * @throws \phpbb\auth\provider\oauth\service\exception + * @return string The unique identifier returned by the service provider + * that is used to authenticate the user with phpBB. + */ + public function perform_auth_login(); + + /** + * Returns the results of the authentication in json format + * Use this function when the user already has an access token + * + * @throws \phpbb\auth\provider\oauth\service\exception + * @return string The unique identifier returned by the service provider + * that is used to authenticate the user with phpBB. + */ + public function perform_token_auth(); + + /** + * Sets the external library service provider + * + * @param \OAuth\Common\Service\ServiceInterface $service_provider + */ + public function set_external_service_provider(\OAuth\Common\Service\ServiceInterface $service_provider); +} diff --git a/install/update/old/phpbb/auth/provider/oauth/service/twitter.php b/install/update/old/phpbb/auth/provider/oauth/service/twitter.php new file mode 100644 index 0000000..06beac5 --- /dev/null +++ b/install/update/old/phpbb/auth/provider/oauth/service/twitter.php @@ -0,0 +1,102 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider\oauth\service; + +/** +* Twitter OAuth service +*/ +class twitter extends \phpbb\auth\provider\oauth\service\base +{ + /** + * phpBB config + * + * @var \phpbb\config\config + */ + protected $config; + + /** + * phpBB request + * + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * Constructor + * + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request + */ + public function __construct(\phpbb\config\config $config, \phpbb\request\request_interface $request) + { + $this->config = $config; + $this->request = $request; + } + + /** + * {@inheritdoc} + */ + public function get_service_credentials() + { + return array( + 'key' => $this->config['auth_oauth_twitter_key'], + 'secret' => $this->config['auth_oauth_twitter_secret'], + ); + } + + /** + * {@inheritdoc} + */ + public function perform_auth_login() + { + if (!($this->service_provider instanceof \OAuth\OAuth1\Service\Twitter)) + { + throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + $storage = $this->service_provider->getStorage(); + $token = $storage->retrieveAccessToken('Twitter'); + $tokensecret = $token->getRequestTokenSecret(); + + // This was a callback request from twitter, get the token + $this->service_provider->requestAccessToken( + $this->request->variable('oauth_token', ''), + $this->request->variable('oauth_verifier', ''), + $tokensecret + ); + + // Send a request with it + $result = json_decode($this->service_provider->request('account/verify_credentials.json'), true); + + // Return the unique identifier returned from twitter + return $result['id']; + } + + /** + * {@inheritdoc} + */ + public function perform_token_auth() + { + if (!($this->service_provider instanceof \OAuth\OAuth1\Service\Twitter)) + { + throw new \phpbb\auth\provider\oauth\service\exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE'); + } + + // Send a request with it + $result = json_decode($this->service_provider->request('account/verify_credentials.json'), true); + + // Return the unique identifier returned from twitter + return $result['id']; + } +} diff --git a/install/update/old/phpbb/auth/provider/oauth/token_storage.php b/install/update/old/phpbb/auth/provider/oauth/token_storage.php new file mode 100644 index 0000000..b0c2fd0 --- /dev/null +++ b/install/update/old/phpbb/auth/provider/oauth/token_storage.php @@ -0,0 +1,592 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider\oauth; + +use OAuth\OAuth1\Token\StdOAuth1Token; +use OAuth\Common\Token\TokenInterface; +use OAuth\Common\Storage\TokenStorageInterface; +use OAuth\Common\Storage\Exception\TokenNotFoundException; +use OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException; + +/** +* OAuth storage wrapper for phpbb's cache +*/ +class token_storage implements TokenStorageInterface +{ + /** + * Cache driver. + * + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * phpBB user + * + * @var \phpbb\user + */ + protected $user; + + /** + * OAuth token table + * + * @var string + */ + protected $oauth_token_table; + + /** + * OAuth state table + * + * @var string + */ + protected $oauth_state_table; + + /** + * @var object|TokenInterface + */ + protected $cachedToken; + + /** + * @var string + */ + protected $cachedState; + + /** + * Creates token storage for phpBB. + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\user $user + * @param string $oauth_token_table + * @param string $oauth_state_table + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\user $user, $oauth_token_table, $oauth_state_table) + { + $this->db = $db; + $this->user = $user; + $this->oauth_token_table = $oauth_token_table; + $this->oauth_state_table = $oauth_state_table; + } + + /** + * {@inheritdoc} + */ + public function retrieveAccessToken($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedToken instanceof TokenInterface) + { + return $this->cachedToken; + } + + $data = array( + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + ); + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $data['session_id'] = $this->user->data['session_id']; + } + + return $this->_retrieve_access_token($data); + } + + /** + * {@inheritdoc} + */ + public function storeAccessToken($service, TokenInterface $token) + { + $service = $this->get_service_name_for_db($service); + + $this->cachedToken = $token; + + $data = array( + 'oauth_token' => $this->json_encode_token($token), + ); + + $sql = 'UPDATE ' . $this->oauth_token_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $data) . ' + WHERE user_id = ' . (int) $this->user->data['user_id'] . ' + ' . ((int) $this->user->data['user_id'] === ANONYMOUS ? "AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'" : '') . " + AND provider = '" . $this->db->sql_escape($service) . "'"; + $this->db->sql_query($sql); + + if (!$this->db->sql_affectedrows()) + { + $data = array( + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + 'oauth_token' => $this->json_encode_token($token), + 'session_id' => $this->user->data['session_id'], + ); + + $sql = 'INSERT INTO ' . $this->oauth_token_table . $this->db->sql_build_array('INSERT', $data); + + $this->db->sql_query($sql); + } + + return $this; + } + + /** + * {@inheritdoc} + */ + public function hasAccessToken($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedToken) + { + return true; + } + + $data = array( + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + ); + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $data['session_id'] = $this->user->data['session_id']; + } + + return $this->_has_acess_token($data); + } + + /** + * {@inheritdoc} + */ + public function clearToken($service) + { + $service = $this->get_service_name_for_db($service); + + $this->cachedToken = null; + + $sql = 'DELETE FROM ' . $this->oauth_token_table . ' + WHERE user_id = ' . (int) $this->user->data['user_id'] . " + AND provider = '" . $this->db->sql_escape($service) . "'"; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function clearAllTokens() + { + $this->cachedToken = null; + + $sql = 'DELETE FROM ' . $this->oauth_token_table . ' + WHERE user_id = ' . (int) $this->user->data['user_id']; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function storeAuthorizationState($service, $state) + { + $service = $this->get_service_name_for_db($service); + + $this->cachedState = $state; + + $data = array( + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + 'oauth_state' => $state, + 'session_id' => $this->user->data['session_id'], + ); + + $sql = 'INSERT INTO ' . $this->oauth_state_table . ' + ' . $this->db->sql_build_array('INSERT', $data); + $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function hasAuthorizationState($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return true; + } + + $data = array( + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + ); + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $data['session_id'] = $this->user->data['session_id']; + } + + return (bool) $this->get_state_row($data); + } + + /** + * {@inheritdoc} + */ + public function retrieveAuthorizationState($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return $this->cachedState; + } + + $data = array( + 'user_id' => (int) $this->user->data['user_id'], + 'provider' => $service, + ); + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $data['session_id'] = $this->user->data['session_id']; + } + + return $this->get_state_row($data); + } + + /** + * {@inheritdoc} + */ + public function clearAuthorizationState($service) + { + $service = $this->get_service_name_for_db($service); + + $this->cachedState = null; + + $sql = 'DELETE FROM ' . $this->oauth_state_table . ' + WHERE user_id = ' . (int) $this->user->data['user_id'] . " + AND provider = '" . $this->db->sql_escape($service) . "'"; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + return $this; + } + + /** + * {@inheritdoc} + */ + public function clearAllAuthorizationStates() + { + $this->cachedState = null; + + $sql = 'DELETE FROM ' . $this->oauth_state_table . ' + WHERE user_id = ' . (int) $this->user->data['user_id']; + + if ((int) $this->user->data['user_id'] === ANONYMOUS) + { + $sql .= " AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + } + + $this->db->sql_query($sql); + + return $this; + } + + /** + * Updates the user_id field in the database assosciated with the token + * + * @param int $user_id + */ + public function set_user_id($user_id) + { + if (!$this->cachedToken) + { + return; + } + + $sql = 'UPDATE ' . $this->oauth_token_table . ' + SET ' . $this->db->sql_build_array('UPDATE', array( + 'user_id' => (int) $user_id + )) . ' + WHERE user_id = ' . (int) $this->user->data['user_id'] . " + AND session_id = '" . $this->db->sql_escape($this->user->data['session_id']) . "'"; + $this->db->sql_query($sql); + } + + /** + * Checks to see if an access token exists solely by the session_id of the user + * + * @param string $service The name of the OAuth service + * @return bool true if they have token, false if they don't + */ + public function has_access_token_by_session($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedToken) + { + return true; + } + + $data = array( + 'session_id' => $this->user->data['session_id'], + 'provider' => $service, + ); + + return $this->_has_acess_token($data); + } + + /** + * Checks to see if a state exists solely by the session_id of the user + * + * @param string $service The name of the OAuth service + * @return bool true if they have state, false if they don't + */ + public function has_state_by_session($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return true; + } + + $data = array( + 'session_id' => $this->user->data['session_id'], + 'provider' => $service, + ); + + return (bool) $this->get_state_row($data); + } + + /** + * A helper function that performs the query for has access token functions + * + * @param array $data + * @return bool + */ + protected function _has_acess_token($data) + { + return (bool) $this->get_access_token_row($data); + } + + public function retrieve_access_token_by_session($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedToken instanceof TokenInterface) + { + return $this->cachedToken; + } + + $data = array( + 'session_id' => $this->user->data['session_id'], + 'provider' => $service, + ); + + return $this->_retrieve_access_token($data); + } + + public function retrieve_state_by_session($service) + { + $service = $this->get_service_name_for_db($service); + + if ($this->cachedState) + { + return $this->cachedState; + } + + $data = array( + 'session_id' => $this->user->data['session_id'], + 'provider' => $service, + ); + + return $this->_retrieve_state($data); + } + + /** + * A helper function that performs the query for retrieve access token functions + * Also checks if the token is a valid token + * + * @param array $data + * @return mixed + * @throws \OAuth\Common\Storage\Exception\TokenNotFoundException + */ + protected function _retrieve_access_token($data) + { + $row = $this->get_access_token_row($data); + + if (!$row) + { + throw new TokenNotFoundException('AUTH_PROVIDER_OAUTH_TOKEN_ERROR_NOT_STORED'); + } + + $token = $this->json_decode_token($row['oauth_token']); + + // Ensure that the token was serialized/unserialized correctly + if (!($token instanceof TokenInterface)) + { + $this->clearToken($data['provider']); + throw new TokenNotFoundException('AUTH_PROVIDER_OAUTH_TOKEN_ERROR_INCORRECTLY_STORED'); + } + + $this->cachedToken = $token; + return $token; + } + + /** + * A helper function that performs the query for retrieve state functions + * + * @param array $data + * @return mixed + * @throws \OAuth\Common\Storage\Exception\AuthorizationStateNotFoundException + */ + protected function _retrieve_state($data) + { + $row = $this->get_state_row($data); + + if (!$row) + { + throw new AuthorizationStateNotFoundException(); + } + + $this->cachedState = $row['oauth_state']; + return $this->cachedState; + } + + /** + * A helper function that performs the query for retrieving an access token + * + * @param array $data + * @return mixed + */ + protected function get_access_token_row($data) + { + $sql = 'SELECT oauth_token FROM ' . $this->oauth_token_table . ' + WHERE ' . $this->db->sql_build_array('SELECT', $data); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + return $row; + } + + /** + * A helper function that performs the query for retrieving a state + * + * @param array $data + * @return mixed + */ + protected function get_state_row($data) + { + $sql = 'SELECT oauth_state FROM ' . $this->oauth_state_table . ' + WHERE ' . $this->db->sql_build_array('SELECT', $data); + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + return $row; + } + + public function json_encode_token(TokenInterface $token) + { + $members = array( + 'accessToken' => $token->getAccessToken(), + 'endOfLife' => $token->getEndOfLife(), + 'extraParams' => $token->getExtraParams(), + 'refreshToken' => $token->getRefreshToken(), + + 'token_class' => get_class($token), + ); + + // Handle additional data needed for OAuth1 tokens + if ($token instanceof StdOAuth1Token) + { + $members['requestToken'] = $token->getRequestToken(); + $members['requestTokenSecret'] = $token->getRequestTokenSecret(); + $members['accessTokenSecret'] = $token->getAccessTokenSecret(); + } + + return json_encode($members); + } + + public function json_decode_token($json) + { + $token_data = json_decode($json, true); + + if ($token_data === null) + { + throw new TokenNotFoundException('AUTH_PROVIDER_OAUTH_TOKEN_ERROR_INCORRECTLY_STORED'); + } + + $token_class = $token_data['token_class']; + $access_token = $token_data['accessToken']; + $refresh_token = $token_data['refreshToken']; + $endOfLife = $token_data['endOfLife']; + $extra_params = $token_data['extraParams']; + + // Create the token + $token = new $token_class($access_token, $refresh_token, TokenInterface::EOL_NEVER_EXPIRES, $extra_params); + $token->setEndOfLife($endOfLife); + + // Handle OAuth 1.0 specific elements + if ($token instanceof StdOAuth1Token) + { + $token->setRequestToken($token_data['requestToken']); + $token->setRequestTokenSecret($token_data['requestTokenSecret']); + $token->setAccessTokenSecret($token_data['accessTokenSecret']); + } + + return $token; + } + + /** + * Returns the name of the service as it must be stored in the database. + * + * @param string $service The name of the OAuth service + * @return string The name of the OAuth service as it needs to be stored + * in the database. + */ + protected function get_service_name_for_db($service) + { + // Enforce the naming convention for oauth services + if (strpos($service, 'auth.provider.oauth.service.') !== 0) + { + $service = 'auth.provider.oauth.service.' . strtolower($service); + } + + return $service; + } +} diff --git a/install/update/old/phpbb/auth/provider/provider_interface.php b/install/update/old/phpbb/auth/provider/provider_interface.php new file mode 100644 index 0000000..35e0f55 --- /dev/null +++ b/install/update/old/phpbb/auth/provider/provider_interface.php @@ -0,0 +1,197 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\auth\provider; + +/** +* The interface authentication provider classes have to implement. +*/ +interface provider_interface +{ + /** + * Checks whether the user is currently identified to the authentication + * provider. + * Called in acp_board while setting authentication plugins. + * Changing to an authentication provider will not be permitted in acp_board + * if there is an error. + * + * @return boolean|string False if the user is identified, otherwise an + * error message, or null if not implemented. + */ + public function init(); + + /** + * Performs login. + * + * @param string $username The name of the user being authenticated. + * @param string $password The password of the user. + * @return array An associative array of the format: + * array( + * 'status' => status constant + * 'error_msg' => string + * 'user_row' => array + * ) + * A fourth key of the array may be present: + * 'redirect_data' This key is only used when 'status' is + * equal to LOGIN_SUCCESS_LINK_PROFILE and its value is an + * associative array that is turned into GET variables on + * the redirect url. + */ + public function login($username, $password); + + /** + * Autologin function + * + * @return array|null containing the user row, empty if no auto login + * should take place, or null if not impletmented. + */ + public function autologin(); + + /** + * This function is used to output any required fields in the authentication + * admin panel. It also defines any required configuration table fields. + * + * @return array|null Returns null if not implemented or an array of the + * configuration fields of the provider. + */ + public function acp(); + + /** + * This function updates the template with variables related to the acp + * options with whatever configuraton values are passed to it as an array. + * It then returns the name of the acp file related to this authentication + * provider. + * @param array $new_config Contains the new configuration values that + * have been set in acp_board. + * @return array|null Returns null if not implemented or an array with + * the template file name and an array of the vars + * that the template needs that must conform to the + * following example: + * array( + * 'TEMPLATE_FILE' => string, + * 'TEMPLATE_VARS' => array(...), + * ) + * An optional third element may be added to this + * array: 'BLOCK_VAR_NAME'. If this is present, + * then its value should be a string that is used + * to designate the name of the loop used in the + * ACP template file. When this is present, an + * additional key named 'BLOCK_VARS' is required. + * This must be an array containing at least one + * array of variables that will be assigned during + * the loop in the template. An example of this is + * presented below: + * array( + * 'BLOCK_VAR_NAME' => string, + * 'BLOCK_VARS' => array( + * 'KEY IS UNIMPORTANT' => array(...), + * ), + * 'TEMPLATE_FILE' => string, + * 'TEMPLATE_VARS' => array(...), + * ) + */ + public function get_acp_template($new_config); + + /** + * Returns an array of data necessary to build custom elements on the login + * form. + * + * @return array|null If this function is not implemented on an auth + * provider then it returns null. If it is implemented + * it will return an array of up to four elements of + * which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is + * present then 'BLOCK_VARS' must also be present in + * the array. The fourth element 'VARS' is also + * optional. The array, with all four elements present + * looks like the following: + * array( + * 'TEMPLATE_FILE' => string, + * 'BLOCK_VAR_NAME' => string, + * 'BLOCK_VARS' => array(...), + * 'VARS' => array(...), + * ) + */ + public function get_login_data(); + + /** + * Performs additional actions during logout. + * + * @param array $data An array corresponding to + * \phpbb\session::data + * @param boolean $new_session True for a new session, false for no new + * session. + */ + public function logout($data, $new_session); + + /** + * The session validation function checks whether the user is still logged + * into phpBB. + * + * @param array $user + * @return boolean true if the given user is authenticated, false if the + * session should be closed, or null if not implemented. + */ + public function validate_session($user); + + /** + * Checks to see if $login_link_data contains all information except for the + * user_id of an account needed to successfully link an external account to + * a forum account. + * + * @param array $login_link_data Any data needed to link a phpBB account to + * an external account. + * @return string|null Returns a string with a language constant if there + * is data missing or null if there is no error. + */ + public function login_link_has_necessary_data($login_link_data); + + /** + * Links an external account to a phpBB account. + * + * @param array $link_data Any data needed to link a phpBB account to + * an external account. + */ + public function link_account(array $link_data); + + /** + * Returns an array of data necessary to build the ucp_auth_link page + * + * @param int $user_id User ID for whom the data should be retrieved. + * defaults to 0, which is not a valid ID. The method + * should fall back to the current user's ID in this + * case. + * @return array|null If this function is not implemented on an auth + * provider then it returns null. If it is implemented + * it will return an array of up to four elements of + * which only 'TEMPLATE_FILE'. If 'BLOCK_VAR_NAME' is + * present then 'BLOCK_VARS' must also be present in + * the array. The fourth element 'VARS' is also + * optional. The array, with all four elements present + * looks like the following: + * array( + * 'TEMPLATE_FILE' => string, + * 'BLOCK_VAR_NAME' => string, + * 'BLOCK_VARS' => array(...), + * 'VARS' => array(...), + * ) + */ + public function get_auth_link_data($user_id = 0); + + /** + * Unlinks an external account from a phpBB account. + * + * @param array $link_data Any data needed to unlink a phpBB account + * from a phpbb account. + */ + public function unlink_account(array $link_data); +} diff --git a/install/update/old/phpbb/avatar/driver/remote.php b/install/update/old/phpbb/avatar/driver/remote.php new file mode 100644 index 0000000..efc4f5e --- /dev/null +++ b/install/update/old/phpbb/avatar/driver/remote.php @@ -0,0 +1,216 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\avatar\driver; + +/** +* Handles avatars hosted remotely +*/ +class remote extends \phpbb\avatar\driver\driver +{ + /** + * {@inheritdoc} + */ + public function get_data($row) + { + return array( + 'src' => $row['avatar'], + 'width' => $row['avatar_width'], + 'height' => $row['avatar_height'], + ); + } + + /** + * {@inheritdoc} + */ + public function prepare_form($request, $template, $user, $row, &$error) + { + $template->assign_vars(array( + 'AVATAR_REMOTE_WIDTH' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar_width']) ? $row['avatar_width'] : $request->variable('avatar_remote_width', ''), + 'AVATAR_REMOTE_HEIGHT' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar_height']) ? $row['avatar_height'] : $request->variable('avatar_remote_width', ''), + 'AVATAR_REMOTE_URL' => ((in_array($row['avatar_type'], array(AVATAR_REMOTE, $this->get_name(), 'remote'))) && $row['avatar']) ? $row['avatar'] : '', + )); + + return true; + } + + /** + * {@inheritdoc} + */ + public function process_form($request, $template, $user, $row, &$error) + { + $url = $request->variable('avatar_remote_url', ''); + $width = $request->variable('avatar_remote_width', 0); + $height = $request->variable('avatar_remote_height', 0); + + if (empty($url)) + { + return false; + } + + if (!preg_match('#^(http|https|ftp)://#i', $url)) + { + $url = 'http://' . $url; + } + + if (!function_exists('validate_data')) + { + require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $validate_array = validate_data( + array( + 'url' => $url, + ), + array( + 'url' => array('string', true, 5, 255), + ) + ); + + $error = array_merge($error, $validate_array); + + if (!empty($error)) + { + return false; + } + + // Check if this url looks alright + // Do not allow specifying the port (see RFC 3986) or IP addresses + if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.('. implode('|', $this->allowed_extensions) . ')$#i', $url) || + preg_match('@^(http|https|ftp)://[^/:?#]+:[0-9]+[/:?#]@i', $url) || + preg_match('#^(http|https|ftp)://(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])#i', $url) || + preg_match('#^(http|https|ftp)://(?:(?:(?:[\dA-F]{1,4}:){6}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:::(?:[\dA-F]{1,4}:){0,5}(?:[\dA-F]{1,4}(?::[\dA-F]{1,4})?|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:):(?:[\dA-F]{1,4}:){4}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,2}:(?:[\dA-F]{1,4}:){3}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,3}:(?:[\dA-F]{1,4}:){2}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,4}:(?:[\dA-F]{1,4}:)(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,5}:(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,6}:[\dA-F]{1,4})|(?:(?:[\dA-F]{1,4}:){1,7}:)|(?:::))#i', $url)) + { + $error[] = 'AVATAR_URL_INVALID'; + return false; + } + + // Get image dimensions + if (($width <= 0 || $height <= 0) && (($image_data = $this->imagesize->getImageSize($url)) === false)) + { + $error[] = 'UNABLE_GET_IMAGE_SIZE'; + return false; + } + + if (!empty($image_data) && ($image_data['width'] <= 0 || $image_data['height'] <= 0)) + { + $error[] = 'AVATAR_NO_SIZE'; + return false; + } + + $width = ($width && $height) ? $width : $image_data['width']; + $height = ($width && $height) ? $height : $image_data['height']; + + if ($width <= 0 || $height <= 0) + { + $error[] = 'AVATAR_NO_SIZE'; + return false; + } + + $types = \phpbb\files\upload::image_types(); + $extension = strtolower(\phpbb\files\filespec::get_extension($url)); + + // Check if this is actually an image + if ($file_stream = @fopen($url, 'r')) + { + // Timeout after 1 second + stream_set_timeout($file_stream, 1); + // read some data to ensure headers are present + fread($file_stream, 1024); + $meta = stream_get_meta_data($file_stream); + + if (isset($meta['wrapper_data']['headers']) && is_array($meta['wrapper_data']['headers'])) + { + $headers = $meta['wrapper_data']['headers']; + } + else if (isset($meta['wrapper_data']) && is_array($meta['wrapper_data'])) + { + $headers = $meta['wrapper_data']; + } + else + { + $headers = array(); + } + + foreach ($headers as $header) + { + $header = preg_split('/ /', $header, 2); + if (strtr(strtolower(trim($header[0], ':')), '_', '-') === 'content-type') + { + if (strpos($header[1], 'image/') !== 0) + { + $error[] = 'AVATAR_URL_INVALID'; + fclose($file_stream); + return false; + } + else + { + fclose($file_stream); + break; + } + } + } + } + else + { + $error[] = 'AVATAR_URL_INVALID'; + return false; + } + + if (!empty($image_data) && (!isset($types[$image_data['type']]) || !in_array($extension, $types[$image_data['type']]))) + { + if (!isset($types[$image_data['type']])) + { + $error[] = 'UNABLE_GET_IMAGE_SIZE'; + } + else + { + $error[] = array('IMAGE_FILETYPE_MISMATCH', $types[$image_data['type']][0], $extension); + } + + return false; + } + + if ($this->config['avatar_max_width'] || $this->config['avatar_max_height']) + { + if ($width > $this->config['avatar_max_width'] || $height > $this->config['avatar_max_height']) + { + $error[] = array('AVATAR_WRONG_SIZE', $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], $width, $height); + return false; + } + } + + if ($this->config['avatar_min_width'] || $this->config['avatar_min_height']) + { + if ($width < $this->config['avatar_min_width'] || $height < $this->config['avatar_min_height']) + { + $error[] = array('AVATAR_WRONG_SIZE', $this->config['avatar_min_width'], $this->config['avatar_min_height'], $this->config['avatar_max_width'], $this->config['avatar_max_height'], $width, $height); + return false; + } + } + + return array( + 'avatar' => $url, + 'avatar_width' => $width, + 'avatar_height' => $height, + ); + } + + /** + * {@inheritdoc} + */ + public function get_template_name() + { + return 'ucp_avatar_options_remote.html'; + } +} diff --git a/install/update/old/phpbb/avatar/driver/upload.php b/install/update/old/phpbb/avatar/driver/upload.php new file mode 100644 index 0000000..a012bb1 --- /dev/null +++ b/install/update/old/phpbb/avatar/driver/upload.php @@ -0,0 +1,331 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\avatar\driver; + +/** +* Handles avatars uploaded to the board +*/ +class upload extends \phpbb\avatar\driver\driver +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \phpbb\files\factory + */ + protected $files_factory; + + /** + * Construct a driver object + * + * @param \phpbb\config\config $config phpBB configuration + * @param string $phpbb_root_path Path to the phpBB root + * @param string $php_ext PHP file extension + * @param \phpbb\filesystem\filesystem_interface $filesystem phpBB filesystem helper + * @param \phpbb\path_helper $path_helper phpBB path helper + * @param \phpbb\event\dispatcher_interface $dispatcher phpBB Event dispatcher object + * @param \phpbb\files\factory $files_factory File classes factory + * @param \phpbb\cache\driver\driver_interface $cache Cache driver + */ + public function __construct(\phpbb\config\config $config, $phpbb_root_path, $php_ext, \phpbb\filesystem\filesystem_interface $filesystem, \phpbb\path_helper $path_helper, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\files\factory $files_factory, \phpbb\cache\driver\driver_interface $cache = null) + { + $this->config = $config; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->filesystem = $filesystem; + $this->path_helper = $path_helper; + $this->dispatcher = $dispatcher; + $this->files_factory = $files_factory; + $this->cache = $cache; + } + + /** + * {@inheritdoc} + */ + public function get_data($row) + { + $root_path = (defined('PHPBB_USE_BOARD_URL_PATH') && PHPBB_USE_BOARD_URL_PATH) ? generate_board_url() . '/' : $this->path_helper->get_web_root_path(); + + return array( + 'src' => $root_path . 'download/file.' . $this->php_ext . '?avatar=' . $row['avatar'], + 'width' => $row['avatar_width'], + 'height' => $row['avatar_height'], + ); + } + + /** + * {@inheritdoc} + */ + public function prepare_form($request, $template, $user, $row, &$error) + { + if (!$this->can_upload()) + { + return false; + } + + $template->assign_vars(array( + 'S_UPLOAD_AVATAR_URL' => ($this->config['allow_avatar_remote_upload']) ? true : false, + 'AVATAR_UPLOAD_SIZE' => $this->config['avatar_filesize'], + )); + + return true; + } + + /** + * {@inheritdoc} + */ + public function process_form($request, $template, $user, $row, &$error) + { + if (!$this->can_upload()) + { + return false; + } + + /** @var \phpbb\files\upload $upload */ + $upload = $this->files_factory->get('upload') + ->set_error_prefix('AVATAR_') + ->set_allowed_extensions($this->allowed_extensions) + ->set_max_filesize($this->config['avatar_filesize']) + ->set_allowed_dimensions( + $this->config['avatar_min_width'], + $this->config['avatar_min_height'], + $this->config['avatar_max_width'], + $this->config['avatar_max_height']) + ->set_disallowed_content((isset($this->config['mime_triggers']) ? explode('|', $this->config['mime_triggers']) : false)); + + $url = $request->variable('avatar_upload_url', ''); + $upload_file = $request->file('avatar_upload_file'); + + if (!empty($upload_file['name'])) + { + $file = $upload->handle_upload('files.types.form', 'avatar_upload_file'); + } + else if (!empty($this->config['allow_avatar_remote_upload']) && !empty($url)) + { + if (!preg_match('#^(http|https|ftp)://#i', $url)) + { + $url = 'http://' . $url; + } + + if (!function_exists('validate_data')) + { + require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $validate_array = validate_data( + array( + 'url' => $url, + ), + array( + 'url' => array('string', true, 5, 255), + ) + ); + + $error = array_merge($error, $validate_array); + + if (!empty($error)) + { + return false; + } + + // Do not allow specifying the port (see RFC 3986) or IP addresses + // remote_upload() will do its own check for allowed filetypes + if (!preg_match('#^(http|https|ftp)://(?:(.*?\.)*?[a-z0-9\-]+?\.[a-z]{2,4}|(?:\d{1,3}\.){3,5}\d{1,3}):?([0-9]*?).*?\.('. implode('|', $this->allowed_extensions) . ')$#i', $url) || + preg_match('@^(http|https|ftp)://[^/:?#]+:[0-9]+[/:?#]@i', $url) || + preg_match('#^(http|https|ftp)://(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])#i', $url) || + preg_match('#^(http|https|ftp)://(?:(?:(?:[\dA-F]{1,4}:){6}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:::(?:[\dA-F]{1,4}:){0,5}(?:[\dA-F]{1,4}(?::[\dA-F]{1,4})?|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:):(?:[\dA-F]{1,4}:){4}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,2}:(?:[\dA-F]{1,4}:){3}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,3}:(?:[\dA-F]{1,4}:){2}(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,4}:(?:[\dA-F]{1,4}:)(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,5}:(?:[\dA-F]{1,4}:[\dA-F]{1,4}|(?:(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.){3}(?:\d{1,2}|1\d\d|2[0-4]\d|25[0-5])))|(?:(?:[\dA-F]{1,4}:){1,6}:[\dA-F]{1,4})|(?:(?:[\dA-F]{1,4}:){1,7}:)|(?:::))#i', $url)) + { + $error[] = 'AVATAR_URL_INVALID'; + return false; + } + + $file = $upload->handle_upload('files.types.remote', $url); + } + else + { + return false; + } + + $prefix = $this->config['avatar_salt'] . '_'; + $file->clean_filename('avatar', $prefix, $row['id']); + + // If there was an error during upload, then abort operation + if (count($file->error)) + { + $file->remove(); + $error = $file->error; + return false; + } + + // Calculate new destination + $destination = $this->config['avatar_path']; + + // Adjust destination path (no trailing slash) + if (substr($destination, -1, 1) == '/' || substr($destination, -1, 1) == '\\') + { + $destination = substr($destination, 0, -1); + } + + $destination = str_replace(array('../', '..\\', './', '.\\'), '', $destination); + if ($destination && ($destination[0] == '/' || $destination[0] == "\\")) + { + $destination = ''; + } + + $filedata = array( + 'filename' => $file->get('filename'), + 'filesize' => $file->get('filesize'), + 'mimetype' => $file->get('mimetype'), + 'extension' => $file->get('extension'), + 'physical_filename' => $file->get('realname'), + 'real_filename' => $file->get('uploadname'), + ); + + /** + * Before moving new file in place (and eventually overwriting the existing avatar with the newly uploaded avatar) + * + * @event core.avatar_driver_upload_move_file_before + * @var array filedata Array containing uploaded file data + * @var \phpbb\files\filespec file Instance of filespec class + * @var string destination Destination directory where the file is going to be moved + * @var string prefix Prefix for the avatar filename + * @var array row Array with avatar row data + * @var array error Array of errors, if filled in by this event file will not be moved + * @since 3.1.6-RC1 + * @changed 3.1.9-RC1 Added filedata + * @changed 3.2.3-RC1 Added file + */ + $vars = array( + 'filedata', + 'file', + 'destination', + 'prefix', + 'row', + 'error', + ); + extract($this->dispatcher->trigger_event('core.avatar_driver_upload_move_file_before', compact($vars))); + + unset($filedata); + + if (!count($error)) + { + // Move file and overwrite any existing image + $file->move_file($destination, true); + } + + // If there was an error during move, then clean up leftovers + $error = array_merge($error, $file->error); + if (count($error)) + { + $file->remove(); + return false; + } + + // Delete current avatar if not overwritten + $ext = substr(strrchr($row['avatar'], '.'), 1); + if ($ext && $ext !== $file->get('extension')) + { + $this->delete($row); + } + + return array( + 'avatar' => $row['id'] . '_' . time() . '.' . $file->get('extension'), + 'avatar_width' => $file->get('width'), + 'avatar_height' => $file->get('height'), + ); + } + + /** + * {@inheritdoc} + */ + public function prepare_form_acp($user) + { + return array( + 'allow_avatar_remote_upload'=> array('lang' => 'ALLOW_REMOTE_UPLOAD', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), + 'avatar_filesize' => array('lang' => 'MAX_FILESIZE', 'validate' => 'int:0', 'type' => 'number:0', 'explain' => true, 'append' => ' ' . $user->lang['BYTES']), + 'avatar_path' => array('lang' => 'AVATAR_STORAGE_PATH', 'validate' => 'rpath', 'type' => 'text:20:255', 'explain' => true), + ); + } + + /** + * {@inheritdoc} + */ + public function delete($row) + { + + $error = array(); + $destination = $this->config['avatar_path']; + $prefix = $this->config['avatar_salt'] . '_'; + $ext = substr(strrchr($row['avatar'], '.'), 1); + $filename = $this->phpbb_root_path . $destination . '/' . $prefix . $row['id'] . '.' . $ext; + + /** + * Before deleting an existing avatar + * + * @event core.avatar_driver_upload_delete_before + * @var string destination Destination directory where the file is going to be deleted + * @var string prefix Prefix for the avatar filename + * @var array row Array with avatar row data + * @var array error Array of errors, if filled in by this event file will not be deleted + * @since 3.1.6-RC1 + */ + $vars = array( + 'destination', + 'prefix', + 'row', + 'error', + ); + extract($this->dispatcher->trigger_event('core.avatar_driver_upload_delete_before', compact($vars))); + + if (!count($error) && $this->filesystem->exists($filename)) + { + try + { + $this->filesystem->remove($filename); + return true; + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Fail is covered by return statement below + } + } + + return false; + } + + /** + * {@inheritdoc} + */ + public function get_template_name() + { + return 'ucp_avatar_options_upload.html'; + } + + /** + * Check if user is able to upload an avatar + * + * @return bool True if user can upload, false if not + */ + protected function can_upload() + { + return ($this->filesystem->exists($this->phpbb_root_path . $this->config['avatar_path']) && $this->filesystem->is_writable($this->phpbb_root_path . $this->config['avatar_path']) && (@ini_get('file_uploads') || strtolower(@ini_get('file_uploads')) == 'on')); + } +} diff --git a/install/update/old/phpbb/cache/driver/memcached.php b/install/update/old/phpbb/cache/driver/memcached.php new file mode 100644 index 0000000..7d66759 --- /dev/null +++ b/install/update/old/phpbb/cache/driver/memcached.php @@ -0,0 +1,134 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\cache\driver; + +if (!defined('PHPBB_ACM_MEMCACHED_PORT')) +{ + define('PHPBB_ACM_MEMCACHED_PORT', 11211); +} + +if (!defined('PHPBB_ACM_MEMCACHED_COMPRESS')) +{ + define('PHPBB_ACM_MEMCACHED_COMPRESS', true); +} + +if (!defined('PHPBB_ACM_MEMCACHED_HOST')) +{ + define('PHPBB_ACM_MEMCACHED_HOST', 'localhost'); +} + +if (!defined('PHPBB_ACM_MEMCACHED')) +{ + //can define multiple servers with host1/port1,host2/port2 format + define('PHPBB_ACM_MEMCACHED', PHPBB_ACM_MEMCACHED_HOST . '/' . PHPBB_ACM_MEMCACHED_PORT); +} + +/** +* ACM for Memcached +*/ +class memcached extends \phpbb\cache\driver\memory +{ + /** @var string Extension to use */ + protected $extension = 'memcached'; + + /** @var \Memcached Memcached class */ + protected $memcached; + + /** @var int Flags */ + protected $flags = 0; + + /** + * Memcached constructor + */ + public function __construct() + { + // Call the parent constructor + parent::__construct(); + + $this->memcached = new \Memcached(); + $this->memcached->setOption(\Memcached::OPT_BINARY_PROTOCOL, true); + // Memcached defaults to using compression, disable if we don't want + // to use it + if (!PHPBB_ACM_MEMCACHED_COMPRESS) + { + $this->memcached->setOption(\Memcached::OPT_COMPRESSION, false); + } + + foreach (explode(',', PHPBB_ACM_MEMCACHED) as $u) + { + preg_match('#(.*)/(\d+)#', $u, $parts); + $this->memcached->addServer(trim($parts[1]), (int) trim($parts[2])); + } + } + + /** + * {@inheritDoc} + */ + public function unload() + { + parent::unload(); + + unset($this->memcached); + } + + /** + * {@inheritDoc} + */ + public function purge() + { + $this->memcached->flush(); + + parent::purge(); + } + + /** + * Fetch an item from the cache + * + * @param string $var Cache key + * + * @return mixed Cached data + */ + protected function _read($var) + { + return $this->memcached->get($this->key_prefix . $var); + } + + /** + * Store data in the cache + * + * @param string $var Cache key + * @param mixed $data Data to store + * @param int $ttl Time-to-live of cached data + * @return bool True if the operation succeeded + */ + protected function _write($var, $data, $ttl = 2592000) + { + if (!$this->memcached->replace($this->key_prefix . $var, $data, $ttl)) + { + return $this->memcached->set($this->key_prefix . $var, $data, $ttl); + } + return true; + } + + /** + * Remove an item from the cache + * + * @param string $var Cache key + * @return bool True if the operation succeeded + */ + protected function _delete($var) + { + return $this->memcached->delete($this->key_prefix . $var); + } +} diff --git a/install/update/old/phpbb/cache/driver/memory.php b/install/update/old/phpbb/cache/driver/memory.php new file mode 100644 index 0000000..eba9549 --- /dev/null +++ b/install/update/old/phpbb/cache/driver/memory.php @@ -0,0 +1,282 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\cache\driver; + +/** +* ACM Abstract Memory Class +*/ +abstract class memory extends \phpbb\cache\driver\base +{ + var $key_prefix; + + /** + * Set cache path + */ + function __construct() + { + global $phpbb_root_path, $dbname, $table_prefix, $phpbb_container; + + $this->cache_dir = $phpbb_container->getParameter('core.cache_dir'); + $this->key_prefix = substr(md5($dbname . $table_prefix), 0, 8) . '_'; + + if (!isset($this->extension) || !extension_loaded($this->extension)) + { + global $acm_type; + + trigger_error("Could not find required extension [{$this->extension}] for the ACM module $acm_type.", E_USER_ERROR); + } + + if (isset($this->function) && !function_exists($this->function)) + { + global $acm_type; + + trigger_error("The required function [{$this->function}] is not available for the ACM module $acm_type.", E_USER_ERROR); + } + } + + /** + * {@inheritDoc} + */ + function load() + { + // grab the global cache + $data = $this->_read('global'); + + if ($data !== false) + { + $this->vars = $data; + return true; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function save() + { + if (!$this->is_modified) + { + return; + } + + $this->_write('global', $this->vars, 2592000); + + $this->is_modified = false; + } + + /** + * {@inheritDoc} + */ + function tidy() + { + global $config; + + // cache has auto GC, no need to have any code here :) + $config->set('cache_last_gc', time(), false); + } + + /** + * {@inheritDoc} + */ + function get($var_name) + { + if ($var_name[0] == '_') + { + if (!$this->_exists($var_name)) + { + return false; + } + + return $this->_read($var_name); + } + else + { + return ($this->_exists($var_name)) ? $this->vars[$var_name] : false; + } + } + + /** + * {@inheritDoc} + */ + function put($var_name, $var, $ttl = 2592000) + { + if ($var_name[0] == '_') + { + $this->_write($var_name, $var, $ttl); + } + else + { + $this->vars[$var_name] = $var; + $this->is_modified = true; + } + } + + /** + * {@inheritDoc} + */ + function destroy($var_name, $table = '') + { + if ($var_name == 'sql' && !empty($table)) + { + if (!is_array($table)) + { + $table = array($table); + } + + foreach ($table as $table_name) + { + // gives us the md5s that we want + $temp = $this->_read('sql_' . $table_name); + + if ($temp === false) + { + continue; + } + + // delete each query ref + foreach ($temp as $md5_id => $void) + { + $this->_delete('sql_' . $md5_id); + } + + // delete the table ref + $this->_delete('sql_' . $table_name); + } + + return; + } + + if (!$this->_exists($var_name)) + { + return; + } + + if ($var_name[0] == '_') + { + $this->_delete($var_name); + } + else if (isset($this->vars[$var_name])) + { + $this->is_modified = true; + unset($this->vars[$var_name]); + + // We save here to let the following cache hits succeed + $this->save(); + } + } + + /** + * {@inheritDoc} + */ + function _exists($var_name) + { + if ($var_name[0] == '_') + { + return $this->_isset($var_name); + } + else + { + if (!count($this->vars)) + { + $this->load(); + } + + return isset($this->vars[$var_name]); + } + } + + /** + * {@inheritDoc} + */ + function sql_save(\phpbb\db\driver\driver_interface $db, $query, $query_result, $ttl) + { + // Remove extra spaces and tabs + $query = preg_replace('/[\n\r\s\t]+/', ' ', $query); + $query_id = md5($query); + + // determine which tables this query belongs to + // Some queries use backticks, namely the get_database_size() query + // don't check for conformity, the SQL would error and not reach here. + if (!preg_match_all('/(?:FROM \\(?(`?\\w+`?(?: \\w+)?(?:, ?`?\\w+`?(?: \\w+)?)*)\\)?)|(?:JOIN (`?\\w+`?(?: \\w+)?))/', $query, $regs, PREG_SET_ORDER)) + { + // Bail out if the match fails. + return $query_result; + } + + $tables = array(); + foreach ($regs as $match) + { + if ($match[0][0] == 'F') + { + $tables = array_merge($tables, array_map('trim', explode(',', $match[1]))); + } + else + { + $tables[] = $match[2]; + } + } + + foreach ($tables as $table_name) + { + // Remove backticks + $table_name = ($table_name[0] == '`') ? substr($table_name, 1, -1) : $table_name; + + if (($pos = strpos($table_name, ' ')) !== false) + { + $table_name = substr($table_name, 0, $pos); + } + + $temp = $this->_read('sql_' . $table_name); + + if ($temp === false) + { + $temp = array(); + } + + $temp[$query_id] = true; + + // This must never expire + $this->_write('sql_' . $table_name, $temp, 0); + } + + // store them in the right place + $this->sql_rowset[$query_id] = array(); + $this->sql_row_pointer[$query_id] = 0; + + while ($row = $db->sql_fetchrow($query_result)) + { + $this->sql_rowset[$query_id][] = $row; + } + $db->sql_freeresult($query_result); + + $this->_write('sql_' . $query_id, $this->sql_rowset[$query_id], $ttl); + + return $query_id; + } + + /** + * Check if a cache var exists + * + * @access protected + * @param string $var Cache key + * @return bool True if it exists, otherwise false + */ + function _isset($var) + { + // Most caches don't need to check + return true; + } +} diff --git a/install/update/old/phpbb/captcha/non_gd.php b/install/update/old/phpbb/captcha/non_gd.php new file mode 100644 index 0000000..3818672 --- /dev/null +++ b/install/update/old/phpbb/captcha/non_gd.php @@ -0,0 +1,386 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha; + +/** +* Main non-gd captcha class +* @ignore +*/ +class non_gd +{ + var $filtered_pngs; + var $width = 320; + var $height = 50; + + /** + * Define filtered pngs on init + */ + function __construct() + { + // If we can we will generate a single filtered png, we avoid nastiness via emulation of some Zlib stuff + $this->define_filtered_pngs(); + } + + /** + * Create the image containing $code with a seed of $seed + */ + function execute($code, $seed) + { + $img_height = $this->height - 10; + $img_width = 0; + + mt_srand($seed); + + $char_widths = $hold_chars = array(); + $code_len = strlen($code); + + for ($i = 0; $i < $code_len; $i++) + { + $char = $code[$i]; + + $width = mt_rand(0, 4); + $raw_width = $this->filtered_pngs[$char]['width']; + $char_widths[$i] = $width; + $img_width += $raw_width - $width; + + // Split the char into chunks of $raw_width + 1 length + if (empty($hold_chars[$char])) + { + $hold_chars[$char] = str_split(base64_decode($this->filtered_pngs[$char]['data']), $raw_width + 1); + } + } + + $offset_x = mt_rand(0, $this->width - $img_width); + $offset_y = mt_rand(0, $this->height - $img_height); + + $image = ''; + for ($i = 0; $i < $this->height; $i++) + { + $image .= chr(0); + + if ($i > $offset_y && $i < $offset_y + $img_height) + { + for ($j = 0; $j < $offset_x; $j++) + { + $image .= chr(mt_rand(140, 255)); + } + + for ($j = 0; $j < $code_len; $j++) + { + $image .= $this->randomise(substr($hold_chars[$code{$j}][$i - $offset_y - 1], 1), $char_widths[$j]); + } + + for ($j = $offset_x + $img_width; $j < $this->width; $j++) + { + $image .= chr(mt_rand(140, 255)); + } + } + else + { + for ($j = 0; $j < $this->width; $j++) + { + $image .= chr(mt_rand(140, 255)); + } + } + } + unset($hold_chars); + + $image = $this->create_png($image, $this->width, $this->height); + + // Output image + header('Content-Type: image/png'); + header('Cache-control: no-cache, no-store'); + echo $image; + exit; + } + + /** + * This is designed to randomise the pixels of the image data within + * certain limits so as to keep it readable. It also varies the image + * width a little + */ + function randomise($scanline, $width) + { + $new_line = ''; + + $end = strlen($scanline) - ceil($width/2); + for ($i = (int) floor($width / 2); $i < $end; $i++) + { + $pixel = ord($scanline{$i}); + + if ($pixel < 190) + { + $new_line .= chr(mt_rand(0, 205)); + } + else if ($pixel > 190) + { + $new_line .= chr(mt_rand(145, 255)); + } + else + { + $new_line .= $scanline{$i}; + } + } + + return $new_line; + } + + /** + * This creates a chunk of the given type, with the given data + * of the given length adding the relevant crc + */ + function png_chunk($length, $type, $data) + { + $raw = $type . $data; + + return pack('N', $length) . $raw . pack('N', crc32($raw)); + } + + /** + * Creates greyscale 8bit png - The PNG spec can be found at + * http://www.libpng.org/pub/png/spec/PNG-Contents.html we use + * png because it's a fully recognised open standard and supported + * by practically all modern browsers and OSs + */ + function create_png($raw_image, $width, $height) + { + // SIG + $image = pack('C8', 137, 80, 78, 71, 13, 10, 26, 10); + + // IHDR + $raw = pack('N2', $width, $height); + $raw .= pack('C5', 8, 0, 0, 0, 0); + $image .= $this->png_chunk(13, 'IHDR', $raw); + + // IDAT + if (@extension_loaded('zlib')) + { + $raw_image = gzcompress($raw_image); + $length = strlen($raw_image); + } + else + { + // The total length of this image, uncompressed, is just a calculation of pixels + $length = ($width + 1) * $height; + + // Adler-32 hash generation + // Note: The hash is _backwards_ so we must reverse it + + if (@extension_loaded('hash')) + { + $adler_hash = strrev(hash('adler32', $raw_image, true)); + } + else if (@extension_loaded('mhash')) + { + $adler_hash = strrev(mhash(MHASH_ADLER32, $raw_image)); + } + else + { + // Optimized Adler-32 loop ported from the GNU Classpath project + $temp_length = $length; + $s1 = 1; + $s2 = $index = 0; + + while ($temp_length > 0) + { + // We can defer the modulo operation: + // s1 maximally grows from 65521 to 65521 + 255 * 3800 + // s2 maximally grows by 3800 * median(s1) = 2090079800 < 2^31 + $substract_value = ($temp_length < 3800) ? $temp_length : 3800; + $temp_length -= $substract_value; + + while (--$substract_value >= 0) + { + $s1 += ord($raw_image[$index]); + $s2 += $s1; + + $index++; + } + + $s1 %= 65521; + $s2 %= 65521; + } + $adler_hash = pack('N', ($s2 << 16) | $s1); + } + + // This is the same thing as gzcompress($raw_image, 0) but does not need zlib + $raw_image = pack('C3v2', 0x78, 0x01, 0x01, $length, ~$length) . $raw_image . $adler_hash; + + // The Zlib header + Adler hash make us add on 11 + $length += 11; + } + + // IDAT + $image .= $this->png_chunk($length, 'IDAT', $raw_image); + + // IEND + $image .= $this->png_chunk(0, 'IEND', ''); + + return $image; + } + + /** + * png image data + * Each 'data' element is base64_encoded uncompressed IDAT + */ + function define_filtered_pngs() + { + $this->filtered_pngs = array( + '0' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A///////////////////olFAkBAAAGDyA4P///M31/////////////wD////////////////0dAgAAAAAAAAAAAAEcPipFGHn////////////AP//////////////6DAAAAAAAAAAAAAAAAAALSEAN+T///////////8A//////////////xAAAAAAAAAAAAAAAAAAAAAACPA/////////////wD/////////////oAAAAAAAAAAAAAAAAAAAAAAAev//////////////AP////////////8oAAAAAAAAPNj/zDAAAAAAAABD//////////////8A////////////1AAAAAAAABjw////5BAAAAAAAADo/////////////wD///////////+QAAAAAAAAbP//////QgAAAAAAAKj/////////////AP///////////1wAAAAAAACs/////8AXAAAAAAAAcP////////////8A////////////OAAAAAAAAND////dNwAAAAAAAABI/////////////wD///////////8gAAAAAAAA4P//7koACwAAAAAAACT/////////////AP///////////wgAAAAAAAD///VqAwaPAAAAAAAAEP////////////8A////////////AAAAAAAAAP/8kQYDavUAAAAAAAAA/////////////wD///////////8AAAAAAAAA/6kNAEru/wAAAAAAAAD/////////////AP///////////wAAAAAAAADAIwA33f//AAAAAAAAAP////////////8A////////////FAAAAAAAADYAI8D///8AAAAAAAAQ/////////////wD///////////8kAAAAAAAAAA2p////5AAAAAAAACD/////////////AP///////////0gAAAAAAAAFkfz////UAAAAAAAAQP////////////8A////////////cAAAAAAAAET1/////7AAAAAAAABo/////////////wD///////////+oAAAAAAAAXfX/////sAAAAAAAAGj/////////////AAAAALgAAAAAAAAwAAAAAAAAAAAAAAD////////////oAAAAAAAACOT////oEAAAAAAAAOD/////////////AP////////////8+AAAAAAAAKMz/zDQAAAAAAAA0//////////////8A////////////7jgAAAAAAAAAAAAAAAAAAAAAAKT//////////////wD///////////VqAwIAAAAAAAAAAAAAAAAAAAA8////////////////AP//////////rQcDaVEAAAAAAAAAAAAAAAAAKOj///////////////8A///////////nblnu/IAIAAAAAAAAAAAAAFzw/////////////////wD////////////79////+iITCAAAAAgSITg////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////w==', + 'width' => 40 + ), + '1' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////8BAAAAAAAP//////////////////AP////////////////////////9sAAAAAAAA//////////////////8A////////////////////////pAAAAAAAAAD//////////////////wD//////////////////////6wEAAAAAAAAAP//////////////////AP////////////////////h4AAAAAAAAAAAA//////////////////8A//////////////////ygJAAAAAAAAAAAAAD//////////////////wD//////////////9x8HAAAAAAAAAAAAAAAAP//////////////////AP//////////////AAAAAAAAAAAAAAAAAAAA//////////////////8A//////////////8AAAAAAAAAAAAAAAAAAAD//////////////////wD//////////////wAAAAAAAAR4AAAAAAAAAP//////////////////AP//////////////AAAAAAA4zP8AAAAAAAAA//////////////////8A//////////////8AAAA4sP///wAAAAAAAAD//////////////////wD//////////////yR80P//////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////AAAAAAAAAP//////////////////AP////////////////////////8AAAAAAAAA//////////////////8A/////////////////////////wAAAAAAAAD//////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '2' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP/////////////////okFAkCAAABCBIfNT///////////////////8A///////////////8hAgAAAAAAAAAAAAAAFTo/////////////////wD//////////////1QAAAAAAAAAAAAAAAAAACjo////////////////AP////////////+MAAAAAAAAAAAAAAAAAAAAADj///////////////8A////////////9BAAAAAAAAAAAAAAAAAAAAAAALD//////////////wD///////////+gAAAAAAAAAHjs+KwMAAAAAAAAVP//////////////AP///////////1gAAAAAAABM/////6QAAAAAAAAU//////////////8A////////////KAAAAAAAALj/////+AAAAAAAAAD//////////////wD///////////+MfGBMOCAI8P/////wAAAAAAAACP//////////////AP///////////////////////////5wAAAAAAAAw//////////////8A///////////////////////////oFAAAAAAAAHz//////////////wD/////////////////////////6CgAAAAAAAAE3P//////////////AP///////////////////////9ggAAAAAAAAAHT///////////////8A//////////////////////+0DAAAAAAAAAA8+P///////////////wD/////////////////////gAAAAAAAAAAAKOj/////////////////AP//////////////////9FAAAAAAAAAAADzw//////////////////8A/////////////////+g4AAAAAAAAAABk/P///////////////////wD////////////////oKAAAAAAAAAAMqP//////////////////////AP//////////////6CgAAAAAAAAAMNz///////////////////////8A//////////////g4AAAAAAAAAFT0/////////////////////////wD/////////////bAAAAAAAAABU/P//////////////////////////AP///////////8wAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A////////////SAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////9wAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////hAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////9AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////xAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '3' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD////////////////8sGg0FAAAACA4cLz8////////////////////AP//////////////rBgAAAAAAAAAAAAAACTA//////////////////8A/////////////3QAAAAAAAAAAAAAAAAAAASs/////////////////wD///////////+YAAAAAAAAAAAAAAAAAAAAAAjc////////////////AP//////////6AwAAAAAAAAAAAAAAAAAAAAAAGT///////////////8A//////////94AAAAAAAABJDw/8g4AAAAAAAAHP///////////////wD//////////yAAAAAAAACE/////9gAAAAAAAAA////////////////AP///////////NSwiGQ4FOT//////AAAAAAAABD///////////////8A//////////////////////////+YAAAAAAAAVP///////////////wD//////////////////////P/ggAQAAAAAAATM////////////////AP////////////////////9gAAAAAAAAAAAElP////////////////8A/////////////////////0AAAAAAAAAAHLj//////////////////wD/////////////////////OAAAAAAAAAAwkPj/////////////////AP////////////////////8gAAAAAAAAAAAAINj///////////////8A/////////////////////xAAAAAAAAAAAAAAIPD//////////////wD/////////////////////uOz/4HgEAAAAAAAAhP//////////////AP///////////////////////////3wAAAAAAAAw//////////////8A////////////////////////////6AAAAAAAAAj//////////////wD/////////////////////////////AAAAAAAAAP//////////////AP//////////tJh8YEQoDNz//////+AAAAAAAAAY//////////////8A//////////88AAAAAAAAaP//////dAAAAAAAAEz//////////////wD//////////6QAAAAAAAAAdOD/5HQAAAAAAAAApP//////////////AP///////////CgAAAAAAAAAAAAAAAAAAAAAACD4//////////////8A////////////yAQAAAAAAAAAAAAAAAAAAAAEuP///////////////wD/////////////rAQAAAAAAAAAAAAAAAAABJD/////////////////AP//////////////zDQAAAAAAAAAAAAAACTA//////////////////8A/////////////////8BwOCAAAAAUNGi0/P///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '4' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////////////////nAAAAAAAAAD///////////////8A/////////////////////////8AEAAAAAAAAAP///////////////wD////////////////////////gGAAAAAAAAAAA////////////////AP//////////////////////9DAAAAAAAAAAAAD///////////////8A//////////////////////9UAAAAAAAAAAAAAP///////////////wD/////////////////////hAAAAAAAAAAAAAAA////////////////AP///////////////////7QAAAAAAAAAAAAAAAD///////////////8A///////////////////UDAAAAAAUAAAAAAAAAP///////////////wD/////////////////7CQAAAAABMAAAAAAAAAA////////////////AP////////////////xEAAAAAACU/wAAAAAAAAD///////////////8A////////////////cAAAAAAAZP//AAAAAAAAAP///////////////wD//////////////6AAAAAAADz8//8AAAAAAAAA////////////////AP/////////////IBAAAAAAc6P///wAAAAAAAAD///////////////8A////////////5BgAAAAADMz/////AAAAAAAAAP///////////////wD///////////g0AAAAAACk//////8AAAAAAAAA////////////////AP//////////XAAAAAAAfP///////wAAAAAAAAD///////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A////////////////////////////AAAAAAAAAP///////////////wD///////////////////////////8AAAAAAAAA////////////////AP///////////////////////////wAAAAAAAAD///////////////8A////////////////////////////AAAAAAAAAP///////////////wD///////////////////////////8AAAAAAAAA////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '5' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////8AAAAAAAAAAAAAAAAAAAAAAA//////////////8A///////////////MAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////////6wAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////////iAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////////9kAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////////0QAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////////IAAAAAAAYP////////////////////////////8A//////////////wAAAAAAAB8/////////////////////////////wD/////////////3AAAAAAAAIj/////////////////////////////AP////////////+4AAAAAAAAoLRYHAAEKGTE//////////////////8A/////////////5QAAAAAAAAQAAAAAAAAAABY9P///////////////wD/////////////dAAAAAAAAAAAAAAAAAAAAAA89P//////////////AP////////////9QAAAAAAAAAAAAAAAAAAAAAABg//////////////8A/////////////zAAAAAAAAAAAAAAAAAAAAAAAADQ/////////////wD/////////////IAAAAAAAAGjY/+h4BAAAAAAAAGz/////////////AP//////////////9NS0lHSc//////90AAAAAAAALP////////////8A/////////////////////////////9QAAAAAAAAE/////////////wD//////////////////////////////wAAAAAAAAD/////////////AP/////////////////////////////8AAAAAAAAEP////////////8A////////////pIRwWEAgDOD//////8wAAAAAAAA8/////////////wD///////////9EAAAAAAAAaP//////ZAAAAAAAAHz/////////////AP///////////6QAAAAAAAAAaOD/4GQAAAAAAAAE4P////////////8A/////////////CQAAAAAAAAAAAAAAAAAAAAAAGD//////////////wD/////////////yAQAAAAAAAAAAAAAAAAAAAAc7P//////////////AP//////////////rAwAAAAAAAAAAAAAAAAAGNj///////////////8A////////////////0EAAAAAAAAAAAAAAAFTo/////////////////wD//////////////////8h4QCAAAAAcQHzU////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '6' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////////////+0ZCwMAAAUNGjI////////////////////AP/////////////////EMAAAAAAAAAAAAABM6P////////////////8A////////////////lAQAAAAAAAAAAAAAAAAo6P///////////////wD//////////////6wAAAAAAAAAAAAAAAAAAABI////////////////AP/////////////oEAAAAAAAAAAAAAAAAAAAAACw//////////////8A/////////////3AAAAAAAAAoxP/YPAAAAAAAAEj//////////////wD////////////4EAAAAAAACOD////YDCBAVGiAoP//////////////AP///////////7gAAAAAAABY//////////////////////////////8A////////////eAAAAAAAAJT//////////////////////////////wD///////////9MAAAAAAAAvP/IXBgABCx03P//////////////////AP///////////ygAAAAAAADcdAAAAAAAAAAEiP////////////////8A////////////FAAAAAAAAFAAAAAAAAAAAAAAcP///////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAlP//////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAQ8P////////////8A////////////AAAAAAAAAABAyP/kZAAAAAAAAACQ/////////////wD///////////8MAAAAAAAALPj/////WAAAAAAAAET/////////////AP///////////yQAAAAAAACY///////MAAAAAAAAFP////////////8A////////////SAAAAAAAAMD///////wAAAAAAAAA/////////////wD///////////9wAAAAAAAAvP///////wAAAAAAAAD/////////////AP///////////7QAAAAAAACI///////UAAAAAAAAJP////////////8A////////////+AwAAAAAACDw/////2wAAAAAAABY/////////////wD/////////////cAAAAAAAADC8/Ox4AAAAAAAAAKj/////////////AP/////////////oEAAAAAAAAAAAAAAAAAAAAAAk/P////////////8A//////////////+oAAAAAAAAAAAAAAAAAAAABLj//////////////wD///////////////+QAAAAAAAAAAAAAAAAAACQ////////////////AP////////////////+0JAAAAAAAAAAAAAAkuP////////////////8A///////////////////8sGg0FAAADCxgqPz//////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '7' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAABP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAy4/////////////wD//////////////////////////+QUAAAAAAAEuP//////////////AP/////////////////////////8QAAAAAAAAKT///////////////8A/////////////////////////4wAAAAAAAB0/////////////////wD////////////////////////cCAAAAAAANPz/////////////////AP///////////////////////0QAAAAAAATY//////////////////8A//////////////////////+0AAAAAAAAeP///////////////////wD//////////////////////CQAAAAAABTw////////////////////AP////////////////////+gAAAAAAAAkP////////////////////8A/////////////////////ywAAAAAABDw/////////////////////wD///////////////////+4AAAAAAAAbP//////////////////////AP///////////////////1wAAAAAAADQ//////////////////////8A///////////////////4DAAAAAAAMP///////////////////////wD//////////////////7QAAAAAAAB8////////////////////////AP//////////////////aAAAAAAAAMj///////////////////////8A//////////////////8oAAAAAAAM/P///////////////////////wD/////////////////8AAAAAAAAET/////////////////////////AP////////////////+0AAAAAAAAcP////////////////////////8A/////////////////4wAAAAAAACY/////////////////////////wD/////////////////WAAAAAAAAMD/////////////////////////AP////////////////80AAAAAAAA4P////////////////////////8A/////////////////xAAAAAAAAD4/////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '8' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD////////////////////IdDQUAAAEIEiA1P//////////////////AP/////////////////gRAAAAAAAAAAAAAAAROD///////////////8A////////////////0BgAAAAAAAAAAAAAAAAAEMj//////////////wD///////////////AcAAAAAAAAAAAAAAAAAAAAHPD/////////////AP//////////////hAAAAAAAAAAAAAAAAAAAAAAAhP////////////8A//////////////8sAAAAAAAAKMz/zCgAAAAAAAAs/////////////wD//////////////wAAAAAAAADM////zAAAAAAAAAD/////////////AP//////////////BAAAAAAAAP//////AAAAAAAABP////////////8A//////////////8sAAAAAAAAzP///9QAAAAAAAAw/////////////wD//////////////3wAAAAAAAAoyP/YNAAAAAAAAIT/////////////AP//////////////7BgAAAAAAAAAAAAAAAAAAAAc8P////////////8A////////////////xBgAAAAAAAAAAAAAAAAAGNj//////////////wD/////////////////tAQAAAAAAAAAAAAAAACo////////////////AP///////////////HAAAAAAAAAAAAAAAAAAAAB8//////////////8A//////////////9gAAAAAAAAAAAAAAAAAAAAAAB8/////////////wD/////////////wAAAAAAAAABk4P/UWAAAAAAAAATQ////////////AP////////////9UAAAAAAAAaP//////XAAAAAAAAGT///////////8A/////////////xgAAAAAAADg///////cAAAAAAAAJP///////////wD/////////////AAAAAAAAAP////////8AAAAAAAAA////////////AP////////////8AAAAAAAAA4P//////3AAAAAAAAAT///////////8A/////////////ygAAAAAAABg//////9cAAAAAAAALP///////////wD/////////////ZAAAAAAAAABY1P/cXAAAAAAAAABw////////////AP/////////////QAAAAAAAAAAAAAAAAAAAAAAAABNz///////////8A//////////////9gAAAAAAAAAAAAAAAAAAAAAAB0/////////////wD///////////////Q8AAAAAAAAAAAAAAAAAAAAUPz/////////////AP////////////////x4CAAAAAAAAAAAAAAAEIT8//////////////8A///////////////////smFQwGAAAABg0ZKT0/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + '9' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////////////ysYCwMAAAUNGiw/P//////////////////AP////////////////+4JAAAAAAAAAAAAAAkuP////////////////8A////////////////lAQAAAAAAAAAAAAAAAAAkP///////////////wD//////////////8AEAAAAAAAAAAAAAAAAAAAAqP//////////////AP/////////////8JAAAAAAAAAAAAAAAAAAAAAAQ7P////////////8A/////////////6wAAAAAAAAAfOz8vCwAAAAAAABw/////////////wD/////////////WAAAAAAAAHD/////7BgAAAAAAAz4////////////AP////////////8kAAAAAAAA1P//////hAAAAAAAALT///////////8A/////////////wAAAAAAAAD///////+4AAAAAAAAcP///////////wD/////////////AAAAAAAAAPz//////8AAAAAAAABI////////////AP////////////8UAAAAAAAAzP//////lAAAAAAAACT///////////8A/////////////0QAAAAAAABY//////gsAAAAAAAADP///////////wD/////////////kAAAAAAAAABw5P/IPAAAAAAAAAAA////////////AP/////////////wEAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A//////////////+UAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD///////////////9wAAAAAAAAAAAAAFAAAAAAAAAU////////////AP////////////////+IBAAAAAAAAABw3AAAAAAAACj///////////8A///////////////////cdCwEABhcxP+8AAAAAAAATP///////////wD//////////////////////////////5AAAAAAAAB4////////////AP//////////////////////////////UAAAAAAAALj///////////8A//////////////+kgGxUQCAM2P///+AIAAAAAAAQ+P///////////wD//////////////0gAAAAAAAA42P/EKAAAAAAAAHD/////////////AP//////////////sAAAAAAAAAAAAAAAAAAAAAAQ6P////////////8A////////////////TAAAAAAAAAAAAAAAAAAAAKz//////////////wD////////////////oKAAAAAAAAAAAAAAAAASU////////////////AP/////////////////sUAAAAAAAAAAAAAAwxP////////////////8A////////////////////yHA0FAAADCxktP///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'A' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////////////////+QAAAAAAAAAAAAAAOT/////////////////AP//////////////////kAAAAAAAAAAAAAAAkP////////////////8A//////////////////88AAAAAAAAAAAAAAA8/////////////////wD/////////////////5AAAAAAAAAAAAAAAAADk////////////////AP////////////////+QAAAAAAAAAAAAAAAAAJD///////////////8A/////////////////zwAAAAAAAAAAAAAAAAAPP///////////////wD////////////////kAAAAAAAAAAgAAAAAAAAA5P//////////////AP///////////////5AAAAAAAAAAgAAAAAAAAACQ//////////////8A////////////////PAAAAAAAAAz8HAAAAAAAADz//////////////wD//////////////+QAAAAAAAAAWP9kAAAAAAAAANz/////////////AP//////////////kAAAAAAAAACk/7wAAAAAAAAAhP////////////8A//////////////88AAAAAAAABOz//BQAAAAAAAAw/////////////wD/////////////4AAAAAAAAAA8////ZAAAAAAAAADc////////////AP////////////+EAAAAAAAAAIj///+8AAAAAAAAAIT///////////8A/////////////zAAAAAAAAAA2P////wQAAAAAAAAMP///////////wD////////////cAAAAAAAAACT//////1wAAAAAAAAA3P//////////AP///////////4QAAAAAAAAAAAAAAAAAAAAAAAAAAACE//////////8A////////////MAAAAAAAAAAAAAAAAAAAAAAAAAAAADD//////////wD//////////9wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANz/////////AP//////////hAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAhP////////8A//////////8wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAw/////////wD/////////3AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADc////////AP////////+EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIT///////8A/////////zAAAAAAAAAAhP///////////2QAAAAAAAAAMP///////wD////////cAAAAAAAAAADM////////////vAAAAAAAAAAA3P//////AP///////4QAAAAAAAAAHP/////////////4DAAAAAAAAACE//////8A////////MAAAAAAAAABk//////////////9cAAAAAAAAADD//////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'B' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAEDh83P///////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAEhP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAeP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAABY////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAABT///////////8A//////////8AAAAAAAAAAP/////4zEwAAAAAAAAAAP///////////wD//////////wAAAAAAAAAA////////7AAAAAAAAAAQ////////////AP//////////AAAAAAAAAAD////////sAAAAAAAAAEj///////////8A//////////8AAAAAAAAAAP/////4zEQAAAAAAAAAtP///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAFz/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAiA/P////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAIjPj//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAGKz/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAJT///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAABNz//////////wD//////////wAAAAAAAAAA///////sqCAAAAAAAAAAbP//////////AP//////////AAAAAAAAAAD/////////yAAAAAAAAAAs//////////8A//////////8AAAAAAAAAAP//////////AAAAAAAAAAT//////////wD//////////wAAAAAAAAAA/////////7wAAAAAAAAAAP//////////AP//////////AAAAAAAAAAD//////+ikGAAAAAAAAAAY//////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFT//////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsP//////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAADj///////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAc6P///////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAATOj/////////////AP//////////AAAAAAAAAAAAAAAAAAAEIEBkkNj///////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'C' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////////////5JRULBAAAAgkTIDQ//////////////////8A////////////////1FAAAAAAAAAAAAAAAABAyP///////////////wD//////////////4gEAAAAAAAAAAAAAAAAAAAElP//////////////AP////////////9wAAAAAAAAAAAAAAAAAAAAAAAAlP////////////8A////////////kAAAAAAAAAAAAAAAAAAAAAAAAAAEyP///////////wD//////////9wIAAAAAAAAAAAAAAAAAAAAAAAAAAAw////////////AP//////////WAAAAAAAAAAAWMz/8JwQAAAAAAAAAACw//////////8A/////////+wEAAAAAAAAAID//////9QMAAAAAAAAAET//////////wD/////////nAAAAAAAAAAo/P///////3wAAAAABDBspP//////////AP////////9gAAAAAAAAAIz/////////3BxQjMT0//////////////8A/////////zQAAAAAAAAAzP///////////////////////////////wD/////////GAAAAAAAAADo////////////////////////////////AP////////8AAAAAAAAAAP////////////////////////////////8A/////////wAAAAAAAAAA/////////////////////////////////wD/////////AAAAAAAAAAD/////////////////////////////////AP////////8cAAAAAAAAAOj///////////////////////////////8A/////////zgAAAAAAAAA0P/////////kIGio7P///////////////wD/////////bAAAAAAAAACg/////////5wAAAAAMHS49P//////////AP////////+oAAAAAAAAAEz/////////PAAAAAAAAAAc//////////8A//////////QIAAAAAAAAALz//////6QAAAAAAAAAAGT//////////wD//////////3AAAAAAAAAADIzo/+SEBAAAAAAAAAAAyP//////////AP//////////7BAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A////////////rAAAAAAAAAAAAAAAAAAAAAAAAAAE0P///////////wD/////////////fAAAAAAAAAAAAAAAAAAAAAAAAJz/////////////AP//////////////iAQAAAAAAAAAAAAAAAAAAASY//////////////8A////////////////yEAAAAAAAAAAAAAAAAA8yP///////////////wD//////////////////9yIUCwQAAAAIEB4yP//////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'D' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////////8AAAAAAAAAAAAAAAAADChQkOT/////////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAABGjw//////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAACDY/////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAABjk////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAKj//////////wD///////////8AAAAAAAAAAP///+isSAAAAAAAAAAANP//////////AP///////////wAAAAAAAAAA////////hAAAAAAAAAAA2P////////8A////////////AAAAAAAAAAD/////////MAAAAAAAAACQ/////////wD///////////8AAAAAAAAAAP////////+MAAAAAAAAAFj/////////AP///////////wAAAAAAAAAA/////////8gAAAAAAAAAMP////////8A////////////AAAAAAAAAAD/////////5AAAAAAAAAAY/////////wD///////////8AAAAAAAAAAP//////////AAAAAAAAAAD/////////AP///////////wAAAAAAAAAA//////////8AAAAAAAAAAP////////8A////////////AAAAAAAAAAD//////////wAAAAAAAAAA/////////wD///////////8AAAAAAAAAAP/////////wAAAAAAAAABD/////////AP///////////wAAAAAAAAAA/////////9QAAAAAAAAAJP////////8A////////////AAAAAAAAAAD/////////qAAAAAAAAABI/////////wD///////////8AAAAAAAAAAP////////9QAAAAAAAAAHj/////////AP///////////wAAAAAAAAAA////////uAAAAAAAAAAAvP////////8A////////////AAAAAAAAAAD////w0HwEAAAAAAAAACT8/////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAADz8//////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAY6P///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAKNz/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAACHT0//////////////8A////////////AAAAAAAAAAAAAAAAABg4bKj0/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'E' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAD///////////////////////////////8A//////////8AAAAAAAAAAP///////////////////////////////wD//////////wAAAAAAAAAA////////////////////////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'F' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'G' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////////////////MB8TCgQAAAACCA4YJzs////////////////AP///////////////JQcAAAAAAAAAAAAAAAAAAhw8P////////////8A/////////////9gwAAAAAAAAAAAAAAAAAAAAAAAk2P///////////wD////////////EDAAAAAAAAAAAAAAAAAAAAAAAAAAc7P//////////AP//////////2AwAAAAAAAAAAAAAAAAAAAAAAAAAAABY//////////8A//////////wwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQ/////////wD/////////kAAAAAAAAAAAEHzQ/P/gmCAAAAAAAAAAAFz/////////AP////////wcAAAAAAAAACjg////////8CwAAAAAAAAgWP////////8A////////vAAAAAAAAAAI2P//////////yBRAcJjI8P///////////wD///////94AAAAAAAAAGD/////////////////////////////////AP///////0AAAAAAAAAAsP////////////////////////////////8A////////IAAAAAAAAADc/////////////////////////////////wD///////8AAAAAAAAAAP///////wAAAAAAAAAAAAAAAAD/////////AP///////wAAAAAAAAAA////////AAAAAAAAAAAAAAAAAP////////8A////////AAAAAAAAAAD///////8AAAAAAAAAAAAAAAAA/////////wD///////8gAAAAAAAAAOD//////wAAAAAAAAAAAAAAAAD/////////AP///////0AAAAAAAAAAtP//////AAAAAAAAAAAAAAAAAP////////8A////////cAAAAAAAAABw//////8AAAAAAAAAAAAAAAAA/////////wD///////+8AAAAAAAAABDs////////////AAAAAAAAAAD/////////AP////////wYAAAAAAAAADz0//////////AAAAAAAAAAAP////////8A/////////5AAAAAAAAAAACCY4P//3KhcCAAAAAAAAAAA/////////wD/////////+CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////AP//////////xAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIP////////8A////////////rAQAAAAAAAAAAAAAAAAAAAAAAAAAAGTw/////////wD/////////////vBQAAAAAAAAAAAAAAAAAAAAAADjI////////////AP//////////////8HAQAAAAAAAAAAAAAAAAAEiw//////////////8A//////////////////iwcEAgBAAABCA4aKDk/////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'H' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'I' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAP///////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAA////////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAD///////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'J' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAD//////////////wD///////////////////////////8AAAAAAAAAAP//////////////AP///////////////////////////wAAAAAAAAAA//////////////8A////////////////////////////AAAAAAAAAAj//////////////wD//////////+zMrIxwUDAQ//////wAAAAAAAAAIP//////////////AP//////////DAAAAAAAAADo////2AAAAAAAAAA0//////////////8A//////////8wAAAAAAAAAKj///+YAAAAAAAAAFj//////////////wD//////////2gAAAAAAAAAIND/yBgAAAAAAAAAkP//////////////AP//////////vAAAAAAAAAAAAAAAAAAAAAAAAADc//////////////8A////////////MAAAAAAAAAAAAAAAAAAAAAAAUP///////////////wD////////////EBAAAAAAAAAAAAAAAAAAAABjk////////////////AP////////////+sBAAAAAAAAAAAAAAAAAAY2P////////////////8A///////////////EMAAAAAAAAAAAAAAAVOj//////////////////wD/////////////////vHBAIAAAABg8fNT/////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'K' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////8AAAAAAAAAAP//////////wAQAAAAAAAAAAABw////////AP///////wAAAAAAAAAA/////////9AMAAAAAAAAAAAAcP////////8A////////AAAAAAAAAAD////////cGAAAAAAAAAAAAHD//////////wD///////8AAAAAAAAAAP//////6CgAAAAAAAAAAABs////////////AP///////wAAAAAAAAAA//////Q0AAAAAAAAAAAAVPz///////////8A////////AAAAAAAAAAD////8RAAAAAAAAAAAAFT8/////////////wD///////8AAAAAAAAAAP///1gAAAAAAAAAAABU/P//////////////AP///////wAAAAAAAAAA//9wAAAAAAAAAAAASPz///////////////8A////////AAAAAAAAAAD/jAAAAAAAAAAAADz0/////////////////wD///////8AAAAAAAAAAKQAAAAAAAAAAAA89P//////////////////AP///////wAAAAAAAAAABAAAAAAAAAAAFPT///////////////////8A////////AAAAAAAAAAAAAAAAAAAAAAAApP///////////////////wD///////8AAAAAAAAAAAAAAAAAAAAAAAAU8P//////////////////AP///////wAAAAAAAAAAAAAAAAAAAAAAAABk//////////////////8A////////AAAAAAAAAAAAAAAAAAAAAAAAAADE/////////////////wD///////8AAAAAAAAAAAAAAAAoEAAAAAAAACz8////////////////AP///////wAAAAAAAAAAAAAAGNiAAAAAAAAAAIj///////////////8A////////AAAAAAAAAAAAABjY//gYAAAAAAAACOD//////////////wD///////8AAAAAAAAAAAAY2P///5wAAAAAAAAASP//////////////AP///////wAAAAAAAAAAGNj//////CgAAAAAAAAAqP////////////8A////////AAAAAAAAAADI////////sAAAAAAAAAAc8P///////////wD///////8AAAAAAAAAAP//////////QAAAAAAAAABs////////////AP///////wAAAAAAAAAA///////////IAAAAAAAAAATI//////////8A////////AAAAAAAAAAD///////////9YAAAAAAAAADD8/////////wD///////8AAAAAAAAAAP///////////9wEAAAAAAAAAJD/////////AP///////wAAAAAAAAAA/////////////3AAAAAAAAAADOT///////8A////////AAAAAAAAAAD/////////////7BAAAAAAAAAAUP///////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'L' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAD/////////////////////////////AP////////////8AAAAAAAAAAP////////////////////////////8A/////////////wAAAAAAAAAA/////////////////////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////8AAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////wAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////////AAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'M' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////8AAAAAAAAAAAAAAHz//////3wAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAAAAAATP//////UAAAAAAAAAAAAAAA////////AP//////AAAAAAAAAAAAAAAc//////8cAAAAAAAAAAAAAAD///////8A//////8AAAAAAAAAAAAAAADw////8AAAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAAAAAAALz////AAAAAAAAAAAAAAAAA////////AP//////AAAAAAAAAAAAAAAAkP///5AAAAAAAAAAAAAAAAD///////8A//////8AAAAAAAAAAAAAAABc////ZAAAAAAAAAAAAAAAAP///////wD//////wAAAAAAAAAoAAAAADD///8wAAAAACQAAAAAAAAA////////AP//////AAAAAAAAAFwAAAAABPz//AgAAAAAXAAAAAAAAAD///////8A//////8AAAAAAAAAkAAAAAAA0P/UAAAAAACQAAAAAAAAAP///////wD//////wAAAAAAAADMAAAAAACg/6gAAAAAAMQAAAAAAAAA////////AP//////AAAAAAAAAPgEAAAAAHD/dAAAAAAE+AAAAAAAAAD///////8A//////8AAAAAAAAA/zQAAAAAQP9IAAAAADD/AAAAAAAAAP///////wD//////wAAAAAAAAD/bAAAAAAQ/xQAAAAAaP8AAAAAAAAA////////AP//////AAAAAAAAAP+gAAAAAADQAAAAAACc/wAAAAAAAAD///////8A//////8AAAAAAAAA/9QAAAAAAGgAAAAAAND/AAAAAAAAAP///////wD//////wAAAAAAAAD//wwAAAAAFAAAAAAM/P8AAAAAAAAA////////AP//////AAAAAAAAAP//RAAAAAAAAAAAADz//wAAAAAAAAD///////8A//////8AAAAAAAAA//94AAAAAAAAAAAAcP//AAAAAAAAAP///////wD//////wAAAAAAAAD//7AAAAAAAAAAAACo//8AAAAAAAAA////////AP//////AAAAAAAAAP//5AAAAAAAAAAAANz//wAAAAAAAAD///////8A//////8AAAAAAAAA////HAAAAAAAAAAQ////AAAAAAAAAP///////wD//////wAAAAAAAAD///9QAAAAAAAAAEz///8AAAAAAAAA////////AP//////AAAAAAAAAP///4gAAAAAAAAAfP///wAAAAAAAAD///////8A//////8AAAAAAAAA////vAAAAAAAAACw////AAAAAAAAAP///////wD//////wAAAAAAAAD////wAAAAAAAAAOz///8AAAAAAAAA////////AP//////AAAAAAAAAP////8sAAAAAAAc/////wAAAAAAAAD///////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'N' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////AAAAAAAAALD/////////////AAAAAAAAAP//////////AP////////8AAAAAAAAAFOj///////////8AAAAAAAAA//////////8A/////////wAAAAAAAAAASP///////////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAkP//////////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAI1P////////8AAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAw+P///////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAABw////////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAC8//////8AAAAAAAAA//////////8A/////////wAAAAAAAAAAAAAAABzs/////wAAAAAAAAD//////////wD/////////AAAAAAAAAAAAAAAAAFD/////AAAAAAAAAP//////////AP////////8AAAAAAAAAAAAAAAAAAJz///8AAAAAAAAA//////////8A/////////wAAAAAAAAAUAAAAAAAADNz//wAAAAAAAAD//////////wD/////////AAAAAAAAALQAAAAAAAAANPz/AAAAAAAAAP//////////AP////////8AAAAAAAAA/2wAAAAAAAAAfP8AAAAAAAAA//////////8A/////////wAAAAAAAAD/+CwAAAAAAAAExAAAAAAAAAD//////////wD/////////AAAAAAAAAP//0AQAAAAAAAAgAAAAAAAAAP//////////AP////////8AAAAAAAAA////jAAAAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD/////RAAAAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP/////kFAAAAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAA//////+sAAAAAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD///////9kAAAAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP////////QkAAAAAAAAAAAAAP//////////AP////////8AAAAAAAAA/////////8wEAAAAAAAAAAAA//////////8A/////////wAAAAAAAAD//////////4QAAAAAAAAAAAD//////////wD/////////AAAAAAAAAP///////////DwAAAAAAAAAAP//////////AP////////8AAAAAAAAA////////////4BAAAAAAAAAA//////////8A/////////wAAAAAAAAD/////////////qAAAAAAAAAD//////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'O' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A///////////////////0qGw4HAAAABw4aKT0/////////////////wD////////////////wcAwAAAAAAAAAAAAAAAho6P//////////////AP//////////////uBQAAAAAAAAAAAAAAAAAAAAMoP////////////8A/////////////6AEAAAAAAAAAAAAAAAAAAAAAAAAkP///////////wD///////////+4BAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP//////////8BQAAAAAAAAAAAAAAAAAAAAAAAAAAAAM5P////////8A//////////9wAAAAAAAAAAAsrPD/7KQsAAAAAAAAAABg/////////wD/////////+BAAAAAAAAAAUPj///////hQAAAAAAAAAAjs////////AP////////+sAAAAAAAAABDw//////////AYAAAAAAAAAKD///////8A/////////2wAAAAAAAAAdP///////////3wAAAAAAAAAYP///////wD/////////OAAAAAAAAAC4////////////xAAAAAAAAAAw////////AP////////8cAAAAAAAAAOD////////////oAAAAAAAAABT///////8A/////////wAAAAAAAAAA//////////////8AAAAAAAAAAP///////wD/////////AAAAAAAAAAD//////////////wAAAAAAAAAA////////AP////////8AAAAAAAAAAP/////////////8AAAAAAAAAAD///////8A/////////xwAAAAAAAAA5P///////////+AAAAAAAAAAHP///////wD/////////NAAAAAAAAAC8////////////uAAAAAAAAAA4////////AP////////9oAAAAAAAAAHj///////////98AAAAAAAAAGT///////8A/////////6gAAAAAAAAAGPD/////////+BgAAAAAAAAApP///////wD/////////9AwAAAAAAAAAUPz///////xcAAAAAAAAAAjs////////AP//////////cAAAAAAAAAAALKjs//CwOAAAAAAAAAAAYP////////8A///////////wFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzk/////////wD///////////+4BAAAAAAAAAAAAAAAAAAAAAAAAAAAoP//////////AP////////////+QAAAAAAAAAAAAAAAAAAAAAAAAAJD///////////8A//////////////+sEAAAAAAAAAAAAAAAAAAAAAyg/////////////wD////////////////oZAgAAAAAAAAAAAAAAARg4P//////////////AP//////////////////9KhsOCAAAAAUMFyc7P////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'P' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////////wAAAAAAAAAAAAAAAAAACCxguP////////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAOOD//////////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAGOD/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAARP////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAxP///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAABo////////////AP///////////wAAAAAAAAAA////6JwMAAAAAAAAADD///////////8A////////////AAAAAAAAAAD//////6AAAAAAAAAADP///////////wD///////////8AAAAAAAAAAP//////9AAAAAAAAAAA////////////AP///////////wAAAAAAAAAA///////0AAAAAAAAAAD///////////8A////////////AAAAAAAAAAD//////5gAAAAAAAAAHP///////////wD///////////8AAAAAAAAAAP///9iICAAAAAAAAABI////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAJD///////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAAAAAI6P///////////wD///////////8AAAAAAAAAAAAAAAAAAAAAAAAAAIT/////////////AP///////////wAAAAAAAAAAAAAAAAAAAAAAAABU/P////////////8A////////////AAAAAAAAAAAAAAAAAAAAAAAIhPz//////////////wD///////////8AAAAAAAAAAAAAAAAABCRMkOz/////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP///////////wAAAAAAAAAA//////////////////////////////8A////////////AAAAAAAAAAD//////////////////////////////wD///////////8AAAAAAAAAAP//////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'Q' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////SoaDQcAAAAHDhoqPT///////////////////8A//////////////BwDAAAAAAAAAAAAAAACHDo/////////////////wD///////////+4FAAAAAAAAAAAAAAAAAAAABCo////////////////AP//////////nAQAAAAAAAAAAAAAAAAAAAAAAACQ//////////////8A/////////7gEAAAAAAAAAAAAAAAAAAAAAAAAAACg/////////////wD////////wFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAzo////////////AP///////3AAAAAAAAAAACyo8P/sqCwAAAAAAAAAAGT///////////8A///////4EAAAAAAAAABM+P///////FQAAAAAAAAACPT//////////wD//////7AAAAAAAAAAFPD/////////9BgAAAAAAAAApP//////////AP//////bAAAAAAAAAB4////////////fAAAAAAAAABk//////////8A//////84AAAAAAAAALz///////////+8AAAAAAAAADT//////////wD//////xwAAAAAAAAA6P///////////+QAAAAAAAAAHP//////////AP//////AAAAAAAAAAD//////////////wAAAAAAAAAA//////////8A//////8AAAAAAAAAAP//////////////AAAAAAAAAAD//////////wD//////wAAAAAAAAAA/P////////////8AAAAAAAAAAP//////////AP//////GAAAAAAAAADg////////////4AAAAAAAAAAc//////////8A//////84AAAAAAAAALT////MJHTo//+8AAAAAAAAADT//////////wD//////2wAAAAAAAAAdP///2AAABCg/3wAAAAAAAAAZP//////////AP//////rAAAAAAAAAAY9P/sCAAAAABMGAAAAAAAAACk//////////8A///////4EAAAAAAAAABU/P+0OAAAAAAAAAAAAAAACPT//////////wD///////94AAAAAAAAAAA4sPD/gAAAAAAAAAAAAABk////////////AP////////AcAAAAAAAAAAAAAAAAAAAAAAAAAAAADOT///////////8A/////////7wEAAAAAAAAAAAAAAAAAAAAAAAAAACQ/////////////wD//////////6wEAAAAAAAAAAAAAAAAAAAAAAAAABSs////////////AP///////////7gUAAAAAAAAAAAAAAAAAAAAAAAAAABAwP////////8A//////////////BwDAAAAAAAAAAAAAAABAgAAAAAAAA8/////////wD////////////////0qGg0GAAAABgwXJjkxBgAAAAAALD/////////AP//////////////////////////////////5DQAAAAk/P////////8A////////////////////////////////////+GwAAJD//////////wD//////////////////////////////////////8A49P//////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'R' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////wAAAAAAAAAAAAAAAAAAAAQgOGSk+P///////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAcuP//////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAEsP////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQ6P///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB8////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAADD///////////8A/////////wAAAAAAAAAA///////svDgAAAAAAAAACP///////////wD/////////AAAAAAAAAAD/////////7AAAAAAAAAAA////////////AP////////8AAAAAAAAAAP/////////cAAAAAAAAABD///////////8A/////////wAAAAAAAAAA//////DQoCQAAAAAAAAAQP///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAACU////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAIPj///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAzU/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAA02P//////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAxctPz///////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAEDY/////////////////wD/////////AAAAAAAAAAD/9LAsAAAAAAAAAAzc////////////////AP////////8AAAAAAAAAAP///+wkAAAAAAAAADD8//////////////8A/////////wAAAAAAAAAA/////8QAAAAAAAAAAJD//////////////wD/////////AAAAAAAAAAD//////1QAAAAAAAAAFPD/////////////AP////////8AAAAAAAAAAP//////3AQAAAAAAAAAgP////////////8A/////////wAAAAAAAAAA////////aAAAAAAAAAAM6P///////////wD/////////AAAAAAAAAAD////////oCAAAAAAAAABs////////////AP////////8AAAAAAAAAAP////////+AAAAAAAAAAATc//////////8A/////////wAAAAAAAAAA//////////AUAAAAAAAAAFj//////////wD/////////AAAAAAAAAAD//////////5AAAAAAAAAAAND/////////AP////////8AAAAAAAAAAP//////////+CQAAAAAAAAAQP////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'S' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP/////////////////8vHBEIAgAAAQgQHC8/P////////////////8A////////////////pCQAAAAAAAAAAAAAAAAcoP///////////////wD//////////////FwAAAAAAAAAAAAAAAAAAAAAXP//////////////AP////////////9oAAAAAAAAAAAAAAAAAAAAAAAAhP////////////8A////////////zAAAAAAAAAAAAAAAAAAAAAAAAAAI6P///////////wD///////////9cAAAAAAAAAAAAAAAAAAAAAAAAAACA////////////AP///////////xgAAAAAAAAAUOD/8KwkAAAAAAAAADj///////////8A////////////AAAAAAAAAAD0/////8wABCAgICxASP///////////wD///////////8MAAAAAAAAAMz/////////////////////////////AP///////////0AAAAAAAAAACFiQxPT///////////////////////8A////////////oAAAAAAAAAAAAAAAADBwtPT//////////////////wD////////////8QAAAAAAAAAAAAAAAAAAACFTA////////////////AP/////////////oOAAAAAAAAAAAAAAAAAAAAABM6P////////////8A///////////////4fAgAAAAAAAAAAAAAAAAAAAAY2P///////////wD/////////////////7IwwAAAAAAAAAAAAAAAAAAAo+P//////////AP/////////////////////koGw0BAAAAAAAAAAAAACU//////////8A///////////////////////////4uFgAAAAAAAAAADz//////////wD//////////2BgSEA0IBwA6P///////5QAAAAAAAAADP//////////AP//////////JAAAAAAAAACc/////////AAAAAAAAAAA//////////8A//////////9YAAAAAAAAACDo///////AAAAAAAAAABT//////////wD//////////6QAAAAAAAAAACCk7P/snBQAAAAAAAAAUP//////////AP//////////+BAAAAAAAAAAAAAAAAAAAAAAAAAAAACs//////////8A////////////kAAAAAAAAAAAAAAAAAAAAAAAAAAAOP///////////wD////////////8RAAAAAAAAAAAAAAAAAAAAAAAABjc////////////AP/////////////0PAAAAAAAAAAAAAAAAAAAAAAg2P////////////8A///////////////8hBQAAAAAAAAAAAAAAAAMdPT//////////////wD/////////////////+LRwSCAMAAAAHDhoqPT/////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'T' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP///////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD///////////////////8AAAAAAAAAAP//////////////////////AP///////////////////wAAAAAAAAAA//////////////////////8A////////////////////AAAAAAAAAAD//////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'U' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////AAAAAAAAAAD///////////8AAAAAAAAAAP//////////AP////////8AAAAAAAAAAP///////////wAAAAAAAAAA//////////8A/////////wAAAAAAAAAA////////////AAAAAAAAAAD//////////wD/////////JAAAAAAAAADk/////////+gAAAAAAAAAHP//////////AP////////9MAAAAAAAAAJz/////////nAAAAAAAAABE//////////8A/////////4gAAAAAAAAAHOj//////+ggAAAAAAAAAHz//////////wD/////////0AAAAAAAAAAAIJzs/+ykIAAAAAAAAAAA0P//////////AP//////////QAAAAAAAAAAAAAAAAAAAAAAAAAAAAED///////////8A///////////IBAAAAAAAAAAAAAAAAAAAAAAAAAAE0P///////////wD///////////+YAAAAAAAAAAAAAAAAAAAAAAAAAJj/////////////AP////////////+UBAAAAAAAAAAAAAAAAAAAAASU//////////////8A///////////////IPAAAAAAAAAAAAAAAAAAwyP///////////////wD/////////////////0IxYOCAIAAAEIEiAyP//////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'V' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD//////zAAAAAAAAAAYP//////////////ZAAAAAAAAAAw////////AP//////kAAAAAAAAAAU/P////////////8UAAAAAAAAAJD///////8A///////oBAAAAAAAAADE////////////xAAAAAAAAAAE7P///////wD///////9MAAAAAAAAAHD///////////94AAAAAAAAAEz/////////AP///////6gAAAAAAAAAJP///////////yQAAAAAAAAArP////////8A////////+BAAAAAAAAAA1P/////////YAAAAAAAAABT4/////////wD/////////aAAAAAAAAACE/////////4QAAAAAAAAAbP//////////AP/////////EAAAAAAAAADT/////////OAAAAAAAAADM//////////8A//////////8kAAAAAAAAAOT//////+QAAAAAAAAAKP///////////wD//////////4QAAAAAAAAAmP//////nAAAAAAAAACI////////////AP//////////5AAAAAAAAABE//////9EAAAAAAAABOT///////////8A////////////QAAAAAAAAAT0////9AgAAAAAAABI/////////////wD///////////+gAAAAAAAAAKT///+kAAAAAAAAAKj/////////////AP////////////QIAAAAAAAAXP///1wAAAAAAAAM+P////////////8A/////////////1wAAAAAAAAM+P/8DAAAAAAAAGT//////////////wD/////////////vAAAAAAAAAC8/7wAAAAAAAAAxP//////////////AP//////////////HAAAAAAAAGj/aAAAAAAAACT///////////////8A//////////////94AAAAAAAAHP8cAAAAAAAAhP///////////////wD//////////////9gAAAAAAAAAkAAAAAAAAADk////////////////AP///////////////zgAAAAAAAAQAAAAAAAAQP////////////////8A////////////////lAAAAAAAAAAAAAAAAACg/////////////////wD////////////////sCAAAAAAAAAAAAAAADPT/////////////////AP////////////////9QAAAAAAAAAAAAAABg//////////////////8A/////////////////7AAAAAAAAAAAAAAAMD//////////////////wD//////////////////BQAAAAAAAAAAAAc////////////////////AP//////////////////cAAAAAAAAAAAAHz///////////////////8A///////////////////MAAAAAAAAAAAA3P///////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'W' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//8cAAAAAAAAALz/////4AAAAAAAAAAA6P////+8AAAAAAAAABz//wD//1QAAAAAAAAAjP////+gAAAAAAAAAACo/////4wAAAAAAAAAUP//AP//jAAAAAAAAABU/////2AAAAAAAAAAAGj/////VAAAAAAAAACM//8A///EAAAAAAAAACT/////IAAAAAAAAAAAKP////8kAAAAAAAAAMT//wD///gEAAAAAAAAAPD//+AAAAAAAAAAAAAA6P//8AAAAAAAAAAE9P//AP///zAAAAAAAAAAvP//oAAAAAAAAAAAAACo//+8AAAAAAAAADD///8A////bAAAAAAAAACM//9gAAAAAAAAAAAAAGT//4wAAAAAAAAAaP///wD///+kAAAAAAAAAFT//yAAAAAAAAAAAAAAIP//VAAAAAAAAACc////AP///9gAAAAAAAAAJP/gAAAAAAAAAAAAAAAA4P8kAAAAAAAAANT///8A/////xAAAAAAAAAA8KAAAAAAAAAAAAAAAACg8AAAAAAAAAAQ/////wD/////TAAAAAAAAAC8YAAAAAAAAAAAAAAAAGC8AAAAAAAAAET/////AP////+AAAAAAAAAAIwgAAAAAAAAAAAAAAAAIIwAAAAAAAAAfP////8A/////7gAAAAAAAAANAAAAAAAACwwAAAAAAAANAAAAAAAAACw/////wD/////8AAAAAAAAAAAAAAAAAAAdHgAAAAAAAAAAAAAAAAAAOz/////AP//////KAAAAAAAAAAAAAAAAAC4vAAAAAAAAAAAAAAAAAAg//////8A//////9gAAAAAAAAAAAAAAAACPj4CAAAAAAAAAAAAAAAAFj//////wD//////5QAAAAAAAAAAAAAAABE//9IAAAAAAAAAAAAAAAAkP//////AP//////0AAAAAAAAAAAAAAAAIj//4wAAAAAAAAAAAAAAADI//////8A///////8DAAAAAAAAAAAAAAAzP//1AAAAAAAAAAAAAAABPj//////wD///////88AAAAAAAAAAAAABT/////GAAAAAAAAAAAAAA0////////AP///////3QAAAAAAAAAAAAAWP////9gAAAAAAAAAAAAAHD///////8A////////sAAAAAAAAAAAAACg/////6QAAAAAAAAAAAAApP///////wD////////kAAAAAAAAAAAAAOT/////6AAAAAAAAAAAAADc////////AP////////8cAAAAAAAAAAAo////////MAAAAAAAAAAAEP////////8A/////////1QAAAAAAAAAAHD///////94AAAAAAAAAABM/////////wD/////////jAAAAAAAAAAAtP///////7wAAAAAAAAAAID/////////AP/////////EAAAAAAAAAAT0////////+AgAAAAAAAAAuP////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'X' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD///////9UAAAAAAAAAKz///////////+sAAAAAAAAAFD/////////AP///////+QQAAAAAAAAFOT/////////8BwAAAAAAAAM5P////////8A/////////5gAAAAAAAAATP////////9kAAAAAAAAAJD//////////wD//////////0AAAAAAAAAAoP//////wAAAAAAAAAA0/P//////////AP//////////2AgAAAAAAAAQ4P////gkAAAAAAAABMz///////////8A////////////iAAAAAAAAABA////dAAAAAAAAABw/////////////wD////////////8MAAAAAAAAACU/9AEAAAAAAAAHPD/////////////AP/////////////IBAAAAAAAAAzYMAAAAAAAAACs//////////////8A//////////////90AAAAAAAAABAAAAAAAAAATP///////////////wD///////////////QgAAAAAAAAAAAAAAAAAAzg////////////////AP///////////////7wAAAAAAAAAAAAAAAAAjP////////////////8A/////////////////2AAAAAAAAAAAAAAADD8/////////////////wD/////////////////7BQAAAAAAAAAAAAEyP//////////////////AP/////////////////gDAAAAAAAAAAAAAjY//////////////////8A/////////////////0AAAAAAAAAAAAAAADj8/////////////////wD///////////////+UAAAAAAAAAAAAAAAAAJD/////////////////AP//////////////4AwAAAAAAAAAAAAAAAAADOD///////////////8A//////////////9AAAAAAAAAAAAAAAAAAAAAQP///////////////wD/////////////nAAAAAAAAAAAWAAAAAAAAAAAlP//////////////AP///////////+QQAAAAAAAAAGD/YAAAAAAAAAAM4P////////////8A////////////TAAAAAAAAAAs9P/0LAAAAAAAAABM/////////////wD//////////6AAAAAAAAAADNT////UDAAAAAAAAACg////////////AP/////////kEAAAAAAAAACg//////+gAAAAAAAAABDk//////////8A/////////0wAAAAAAAAAYP////////9gAAAAAAAAAEz//////////wD///////+oAAAAAAAAACz0//////////QsAAAAAAAAAKT/////////AP//////7BQAAAAAAAAM1P///////////9QMAAAAAAAAFOz///////8A//////9UAAAAAAAAAKD//////////////6AAAAAAAAAAVP///////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'Y' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP///////1QAAAAAAAAAAGj//////////2gAAAAAAAAAAFT///////8A////////5BAAAAAAAAAAAMT////////EAAAAAAAAAAAQ5P///////wD/////////mAAAAAAAAAAAKPj/////+CgAAAAAAAAAAJj/////////AP//////////PAAAAAAAAAAAgP////+AAAAAAAAAAAA8//////////8A///////////YCAAAAAAAAAAE2P//2AQAAAAAAAAACNj//////////wD///////////+AAAAAAAAAAAA4//84AAAAAAAAAACA////////////AP////////////woAAAAAAAAAACUlAAAAAAAAAAAKPz///////////8A/////////////8gAAAAAAAAAABAQAAAAAAAAAADI/////////////wD//////////////2wAAAAAAAAAAAAAAAAAAAAAbP//////////////AP//////////////8BwAAAAAAAAAAAAAAAAAABzw//////////////8A////////////////tAAAAAAAAAAAAAAAAAAAtP///////////////wD/////////////////VAAAAAAAAAAAAAAAAFT/////////////////AP/////////////////oEAAAAAAAAAAAAAAQ6P////////////////8A//////////////////+cAAAAAAAAAAAAAJz//////////////////wD///////////////////9AAAAAAAAAAABA////////////////////AP///////////////////9gAAAAAAAAAANj///////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////8AAAAAAAAAAP////////////////////8A/////////////////////wAAAAAAAAAA/////////////////////wD/////////////////////AAAAAAAAAAD/////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + 'Z' => array( + 'data' => 'AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAA//////////////8A//////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAD//////////////wD//////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////////AP//////////AAAAAAAAAAAAAAAAAAAAAAAAAAAQ//////////////8A/////////////////////////1AAAAAAAAAABLz//////////////wD///////////////////////98AAAAAAAAAACY////////////////AP//////////////////////pAAAAAAAAAAAaP////////////////8A/////////////////////8QIAAAAAAAAAET8/////////////////wD////////////////////gGAAAAAAAAAAo9P//////////////////AP//////////////////9CwAAAAAAAAAFNz///////////////////8A//////////////////xMAAAAAAAAAATA/////////////////////wD/////////////////eAAAAAAAAAAAnP//////////////////////AP///////////////5wAAAAAAAAAAHT///////////////////////8A///////////////ABAAAAAAAAABM/P///////////////////////wD/////////////3BQAAAAAAAAALPT/////////////////////////AP////////////QoAAAAAAAAABjg//////////////////////////8A///////////8SAAAAAAAAAAExP///////////////////////////wD//////////2wAAAAAAAAAAKD/////////////////////////////AP////////+YAAAAAAAAAAB8//////////////////////////////8A/////////wQAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////////////wD/////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD/////////////AP////////8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8A/////////////////////////////////////////////////////wD/////////////////////////////////////////////////////AP////////////////////////////////////////////////////8=', + 'width' => 40 + ), + ); + } +} diff --git a/install/update/old/phpbb/captcha/plugins/qa.php b/install/update/old/phpbb/captcha/plugins/qa.php new file mode 100644 index 0000000..70b3f72 --- /dev/null +++ b/install/update/old/phpbb/captcha/plugins/qa.php @@ -0,0 +1,1040 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\captcha\plugins; + +/** +* And now to something completely different. Let's make a captcha without extending the abstract class. +* QA CAPTCHA sample implementation +*/ +class qa +{ + var $confirm_id; + var $answer; + var $question_ids; + var $question_text; + var $question_lang; + var $question_strict; + var $attempts = 0; + var $type; + // dirty trick: 0 is false, but can still encode that the captcha is not yet validated + var $solved = 0; + + protected $table_captcha_questions; + protected $table_captcha_answers; + protected $table_qa_confirm; + + /** + * @var string name of the service. + */ + protected $service_name; + + /** + * Constructor + * + * @param string $table_captcha_questions + * @param string $table_captcha_answers + * @param string $table_qa_confirm + */ + function __construct($table_captcha_questions, $table_captcha_answers, $table_qa_confirm) + { + $this->table_captcha_questions = $table_captcha_questions; + $this->table_captcha_answers = $table_captcha_answers; + $this->table_qa_confirm = $table_qa_confirm; + } + + /** + * @param int $type as per the CAPTCHA API docs, the type + */ + function init($type) + { + global $config, $db, $user, $request; + + // load our language file + $user->add_lang('captcha_qa'); + + // read input + $this->confirm_id = $request->variable('qa_confirm_id', ''); + $this->answer = $request->variable('qa_answer', '', true); + + $this->type = (int) $type; + $this->question_lang = $user->lang_name; + + // we need all defined questions - shouldn't be too many, so we can just grab them + // try the user's lang first + $sql = 'SELECT question_id + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($user->lang_name) . "'"; + $result = $db->sql_query($sql, 3600); + + while ($row = $db->sql_fetchrow($result)) + { + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + + // fallback to the board default lang + if (!count($this->question_ids)) + { + $this->question_lang = $config['default_lang']; + + $sql = 'SELECT question_id + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + $result = $db->sql_query($sql, 7200); + + while ($row = $db->sql_fetchrow($result)) + { + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + } + + // final fallback to any language + if (!count($this->question_ids)) + { + $this->question_lang = ''; + + $sql = 'SELECT q.question_id, q.lang_iso + FROM ' . $this->table_captcha_questions . ' q, ' . $this->table_captcha_answers . ' a + WHERE q.question_id = a.question_id'; + $result = $db->sql_query($sql, 7200); + + while ($row = $db->sql_fetchrow($result)) + { + if (empty($this->question_lang)) + { + $this->question_lang = $row['lang_iso']; + } + $this->question_ids[$row['question_id']] = $row['question_id']; + } + $db->sql_freeresult($result); + } + + // okay, if there is a confirm_id, we try to load that confirm's state. If not, we try to find one + if (!$this->load_answer() && (!$this->load_confirm_id() || !$this->load_answer())) + { + // we have no valid confirm ID, better get ready to ask something + $this->select_question(); + } + } + + /** + * See if the captcha has created its tables. + */ + public function is_installed() + { + global $phpbb_container; + + $db_tool = $phpbb_container->get('dbal.tools'); + + return $db_tool->sql_table_exists($this->table_captcha_questions); + } + + /** + * API function - for the captcha to be available, it must have installed itself and there has to be at least one question in the board's default lang + */ + public function is_available() + { + global $config, $db, $user; + + // load language file for pretty display in the ACP dropdown + $user->add_lang('captcha_qa'); + + if (!$this->is_installed()) + { + return false; + } + + $sql = 'SELECT COUNT(question_id) AS question_count + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + return ((bool) $row['question_count']); + } + + /** + * API function + */ + function has_config() + { + return true; + } + + /** + * API function + */ + static public function get_name() + { + return 'CAPTCHA_QA'; + } + + /** + * @return string the name of the service corresponding to the plugin + */ + function get_service_name() + { + return $this->service_name; + } + + /** + * Set the name of the plugin + * + * @param string $name + */ + public function set_name($name) + { + $this->service_name = $name; + } + + /** + * API function - not needed as we don't display an image + */ + function execute_demo() + { + } + + /** + * API function - not needed as we don't display an image + */ + function execute() + { + } + + /** + * API function - send the question to the template + */ + function get_template() + { + global $phpbb_log, $template, $user; + + if ($this->is_solved()) + { + return false; + } + else if (empty($this->question_text) || !count($this->question_ids)) + { + /** @var \phpbb\log\log_interface $phpbb_log */ + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); + return false; + } + else + { + $template->assign_vars(array( + 'QA_CONFIRM_QUESTION' => $this->question_text, + 'QA_CONFIRM_ID' => $this->confirm_id, + 'S_CONFIRM_CODE' => true, + 'S_TYPE' => $this->type, + )); + + return 'captcha_qa.html'; + } + } + + /** + * API function - we just display a mockup so that the captcha doesn't need to be installed + */ + function get_demo_template() + { + global $config, $db, $template; + + if ($this->is_available()) + { + $sql = 'SELECT question_text + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "'"; + $result = $db->sql_query_limit($sql, 1); + if ($row = $db->sql_fetchrow($result)) + { + $template->assign_vars(array( + 'QA_CONFIRM_QUESTION' => $row['question_text'], + )); + } + $db->sql_freeresult($result); + } + return 'captcha_qa_acp_demo.html'; + } + + /** + * API function + */ + function get_hidden_fields() + { + $hidden_fields = array(); + + // this is required - otherwise we would forget about the captcha being already solved + if ($this->solved) + { + $hidden_fields['qa_answer'] = $this->answer; + } + $hidden_fields['qa_confirm_id'] = $this->confirm_id; + + return $hidden_fields; + } + + /** + * API function + */ + function garbage_collect($type = 0) + { + global $db; + + $sql = 'SELECT c.confirm_id + FROM ' . $this->table_qa_confirm . ' c + LEFT JOIN ' . SESSIONS_TABLE . ' s + ON (c.session_id = s.session_id) + WHERE s.session_id IS NULL' . + ((empty($type)) ? '' : ' AND c.confirm_type = ' . (int) $type); + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $sql_in = array(); + + do + { + $sql_in[] = (string) $row['confirm_id']; + } + while ($row = $db->sql_fetchrow($result)); + + if (count($sql_in)) + { + $sql = 'DELETE FROM ' . $this->table_qa_confirm . ' + WHERE ' . $db->sql_in_set('confirm_id', $sql_in); + $db->sql_query($sql); + } + } + $db->sql_freeresult($result); + } + + /** + * API function - we don't drop the tables here, as that would cause the loss of all entered questions. + */ + function uninstall() + { + $this->garbage_collect(0); + } + + /** + * API function - set up shop + */ + function install() + { + global $phpbb_container; + + $db_tool = $phpbb_container->get('dbal.tools'); + $schemas = array( + $this->table_captcha_questions => array ( + 'COLUMNS' => array( + 'question_id' => array('UINT', null, 'auto_increment'), + 'strict' => array('BOOL', 0), + 'lang_id' => array('UINT', 0), + 'lang_iso' => array('VCHAR:30', ''), + 'question_text' => array('TEXT_UNI', ''), + ), + 'PRIMARY_KEY' => 'question_id', + 'KEYS' => array( + 'lang' => array('INDEX', 'lang_iso'), + ), + ), + $this->table_captcha_answers => array ( + 'COLUMNS' => array( + 'question_id' => array('UINT', 0), + 'answer_text' => array('STEXT_UNI', ''), + ), + 'KEYS' => array( + 'qid' => array('INDEX', 'question_id'), + ), + ), + $this->table_qa_confirm => array ( + 'COLUMNS' => array( + 'session_id' => array('CHAR:32', ''), + 'confirm_id' => array('CHAR:32', ''), + 'lang_iso' => array('VCHAR:30', ''), + 'question_id' => array('UINT', 0), + 'attempts' => array('UINT', 0), + 'confirm_type' => array('USINT', 0), + ), + 'KEYS' => array( + 'session_id' => array('INDEX', 'session_id'), + 'lookup' => array('INDEX', array('confirm_id', 'session_id', 'lang_iso')), + ), + 'PRIMARY_KEY' => 'confirm_id', + ), + ); + + foreach ($schemas as $table => $schema) + { + if (!$db_tool->sql_table_exists($table)) + { + $db_tool->sql_create_table($table, $schema); + } + } + } + + /** + * API function - see what has to be done to validate + */ + function validate() + { + global $phpbb_log, $user; + + $error = ''; + + if (!count($this->question_ids)) + { + /** @var \phpbb\log\log_interface $phpbb_log */ + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_ERROR_CAPTCHA', time(), array($user->lang('CONFIRM_QUESTION_MISSING'))); + return $user->lang('CONFIRM_QUESTION_MISSING'); + } + + if (!$this->confirm_id) + { + $error = $user->lang['CONFIRM_QUESTION_WRONG']; + } + else + { + if ($this->check_answer()) + { + $this->solved = true; + } + else + { + $error = $user->lang['CONFIRM_QUESTION_WRONG']; + } + } + + if (strlen($error)) + { + // okay, incorrect answer. Let's ask a new question. + $this->new_attempt(); + $this->solved = false; + + return $error; + } + else + { + return false; + } + } + + /** + * Select a question + */ + function select_question() + { + global $db, $user; + + if (!count($this->question_ids)) + { + return; + } + $this->confirm_id = md5(unique_id($user->ip)); + $this->question = (int) array_rand($this->question_ids); + + $sql = 'INSERT INTO ' . $this->table_qa_confirm . ' ' . $db->sql_build_array('INSERT', array( + 'confirm_id' => (string) $this->confirm_id, + 'session_id' => (string) $user->session_id, + 'lang_iso' => (string) $this->question_lang, + 'confirm_type' => (int) $this->type, + 'question_id' => (int) $this->question, + )); + $db->sql_query($sql); + + $this->load_answer(); + } + + /** + * New Question, if desired. + */ + function reselect_question() + { + global $db, $user; + + if (!count($this->question_ids)) + { + return; + } + + $this->question = (int) array_rand($this->question_ids); + $this->solved = 0; + + $sql = 'UPDATE ' . $this->table_qa_confirm . ' + SET question_id = ' . (int) $this->question . " + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "'"; + $db->sql_query($sql); + + $this->load_answer(); + } + + /** + * Wrong answer, so we increase the attempts and use a different question. + */ + function new_attempt() + { + global $db, $user; + + // yah, I would prefer a stronger rand, but this should work + $this->question = (int) array_rand($this->question_ids); + $this->solved = 0; + + $sql = 'UPDATE ' . $this->table_qa_confirm . ' + SET question_id = ' . (int) $this->question . ", + attempts = attempts + 1 + WHERE confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "'"; + $db->sql_query($sql); + + $this->load_answer(); + } + + + /** + * See if there is already an entry for the current session. + */ + function load_confirm_id() + { + global $db, $user; + + $sql = 'SELECT confirm_id + FROM ' . $this->table_qa_confirm . " + WHERE + session_id = '" . $db->sql_escape($user->session_id) . "' + AND lang_iso = '" . $db->sql_escape($this->question_lang) . "' + AND confirm_type = " . $this->type; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $this->confirm_id = $row['confirm_id']; + return true; + } + return false; + } + + /** + * Look up everything we need and populate the instance variables. + */ + function load_answer() + { + global $db, $user; + + if (!strlen($this->confirm_id) || !count($this->question_ids)) + { + return false; + } + + $sql = 'SELECT con.question_id, attempts, question_text, strict + FROM ' . $this->table_qa_confirm . ' con, ' . $this->table_captcha_questions . " qes + WHERE con.question_id = qes.question_id + AND confirm_id = '" . $db->sql_escape($this->confirm_id) . "' + AND session_id = '" . $db->sql_escape($user->session_id) . "' + AND qes.lang_iso = '" . $db->sql_escape($this->question_lang) . "' + AND confirm_type = " . $this->type; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $this->question = $row['question_id']; + + $this->attempts = $row['attempts']; + $this->question_strict = $row['strict']; + $this->question_text = $row['question_text']; + + return true; + } + + return false; + } + + /** + * The actual validation + */ + function check_answer() + { + global $db, $request; + + $answer = ($this->question_strict) ? $request->variable('qa_answer', '', true) : utf8_clean_string($request->variable('qa_answer', '', true)); + + $sql = 'SELECT answer_text + FROM ' . $this->table_captcha_answers . ' + WHERE question_id = ' . (int) $this->question; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $solution = ($this->question_strict) ? $row['answer_text'] : utf8_clean_string($row['answer_text']); + + if ($solution === $answer) + { + $this->solved = true; + + break; + } + } + $db->sql_freeresult($result); + + return $this->solved; + } + + /** + * API function + */ + function get_attempt_count() + { + return $this->attempts; + } + + /** + * API function + */ + function reset() + { + global $db, $user; + + $sql = 'DELETE FROM ' . $this->table_qa_confirm . " + WHERE session_id = '" . $db->sql_escape($user->session_id) . "' + AND confirm_type = " . (int) $this->type; + $db->sql_query($sql); + + // we leave the class usable by generating a new question + $this->select_question(); + } + + /** + * API function + */ + function is_solved() + { + global $request; + + if ($request->variable('qa_answer', false) && $this->solved === 0) + { + $this->validate(); + } + + return (bool) $this->solved; + } + + /** + * API function - The ACP backend, this marks the end of the easy methods + */ + function acp_page($id, $module) + { + global $config, $request, $phpbb_log, $template, $user; + + $user->add_lang('acp/board'); + $user->add_lang('captcha_qa'); + + if (!self::is_installed()) + { + $this->install(); + } + + $module->tpl_name = 'captcha_qa_acp'; + $module->page_title = 'ACP_VC_SETTINGS'; + $form_key = 'acp_captcha'; + add_form_key($form_key); + + $submit = $request->variable('submit', false); + $question_id = $request->variable('question_id', 0); + $action = $request->variable('action', ''); + + // we have two pages, so users might want to navigate from one to the other + $list_url = $module->u_action . "&configure=1&select_captcha=" . $this->get_service_name(); + + $template->assign_vars(array( + 'U_ACTION' => $module->u_action, + 'QUESTION_ID' => $question_id , + 'CLASS' => $this->get_service_name(), + )); + + // show the list? + if (!$question_id && $action != 'add') + { + $this->acp_question_list($module); + } + else if ($question_id && $action == 'delete') + { + if ($this->get_service_name() !== $config['captcha_plugin'] || !$this->acp_is_last($question_id)) + { + if (confirm_box(true)) + { + $this->acp_delete_question($question_id); + + trigger_error($user->lang['QUESTION_DELETED'] . adm_back_link($list_url)); + } + else + { + confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array( + 'question_id' => $question_id, + 'action' => $action, + 'configure' => 1, + 'select_captcha' => $this->get_service_name(), + )) + ); + } + } + else + { + trigger_error($user->lang['QA_LAST_QUESTION'] . adm_back_link($list_url), E_USER_WARNING); + } + } + else + { + // okay, show the editor + $question_input = $this->acp_get_question_input(); + $langs = $this->get_languages(); + + foreach ($langs as $lang => $entry) + { + $template->assign_block_vars('langs', array( + 'ISO' => $lang, + 'NAME' => $entry['name'], + )); + } + + $template->assign_vars(array( + 'U_LIST' => $list_url, + )); + + if ($question_id) + { + if ($question = $this->acp_get_question_data($question_id)) + { + $template->assign_vars(array( + 'QUESTION_TEXT' => ($question_input['question_text']) ? $question_input['question_text'] : $question['question_text'], + 'LANG_ISO' => ($question_input['lang_iso']) ? $question_input['lang_iso'] : $question['lang_iso'], + 'STRICT' => (isset($_REQUEST['strict'])) ? $question_input['strict'] : $question['strict'], + 'ANSWERS' => implode("\n", $question['answers']), + )); + } + else + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($list_url)); + } + } + else + { + $template->assign_vars(array( + 'QUESTION_TEXT' => $question_input['question_text'], + 'LANG_ISO' => $question_input['lang_iso'], + 'STRICT' => $question_input['strict'], + 'ANSWERS' => (is_array($question_input['answers'])) ? implode("\n", $question_input['answers']) : '', + )); + } + + if ($submit && check_form_key($form_key)) + { + if (!$this->validate_input($question_input)) + { + $template->assign_vars(array( + 'S_ERROR' => true, + )); + } + else + { + if ($question_id) + { + $this->acp_update_question($question_input, $question_id); + } + else + { + $this->acp_add_question($question_input); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_CONFIG_VISUAL'); + trigger_error($user->lang['CONFIG_UPDATED'] . adm_back_link($list_url)); + } + } + else if ($submit) + { + trigger_error($user->lang['FORM_INVALID'] . adm_back_link($list_url), E_USER_WARNING); + } + } + } + + /** + * This handles the list overview + */ + function acp_question_list($module) + { + global $db, $template; + + $sql = 'SELECT * + FROM ' . $this->table_captcha_questions; + $result = $db->sql_query($sql); + + $template->assign_vars(array( + 'S_LIST' => true, + )); + + while ($row = $db->sql_fetchrow($result)) + { + $url = $module->u_action . "&question_id={$row['question_id']}&configure=1&select_captcha=" . $this->get_service_name() . '&'; + + $template->assign_block_vars('questions', array( + 'QUESTION_TEXT' => $row['question_text'], + 'QUESTION_ID' => $row['question_id'], + 'QUESTION_LANG' => $row['lang_iso'], + 'U_DELETE' => "{$url}action=delete", + 'U_EDIT' => "{$url}action=edit", + )); + } + $db->sql_freeresult($result); + } + + /** + * Grab a question and bring it into a format the editor understands + */ + function acp_get_question_data($question_id) + { + global $db; + + if ($question_id) + { + $sql = 'SELECT * + FROM ' . $this->table_captcha_questions . ' + WHERE question_id = ' . $question_id; + $result = $db->sql_query($sql); + $question = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$question) + { + return false; + } + + $question['answers'] = array(); + + $sql = 'SELECT * + FROM ' . $this->table_captcha_answers . ' + WHERE question_id = ' . $question_id; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $question['answers'][] = $row['answer_text']; + } + $db->sql_freeresult($result); + + return $question; + } + + return false; + } + + /** + * Grab a question from input and bring it into a format the editor understands + */ + function acp_get_question_input() + { + global $request; + + $answers = $request->variable('answers', '', true); + + // Convert answers into array and filter if answers are set + if (strlen($answers)) + { + $answers = array_filter(array_map('trim', explode("\n", $answers)), function ($value) { + return $value !== ''; + }); + } + + $question = array( + 'question_text' => $request->variable('question_text', '', true), + 'strict' => $request->variable('strict', false), + 'lang_iso' => $request->variable('lang_iso', ''), + 'answers' => $answers, + ); + return $question; + } + + /** + * Update a question. + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function acp_update_question($data, $question_id) + { + global $db, $cache; + + // easier to delete all answers than to figure out which to update + $sql = 'DELETE FROM ' . $this->table_captcha_answers . " WHERE question_id = $question_id"; + $db->sql_query($sql); + + $langs = $this->get_languages(); + $question_ary = $data; + $question_ary['lang_id'] = $langs[$question_ary['lang_iso']]['id']; + unset($question_ary['answers']); + + $sql = 'UPDATE ' . $this->table_captcha_questions . ' + SET ' . $db->sql_build_array('UPDATE', $question_ary) . " + WHERE question_id = $question_id"; + $db->sql_query($sql); + + $this->acp_insert_answers($data, $question_id); + + $cache->destroy('sql', $this->table_captcha_questions); + } + + /** + * Insert a question. + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function acp_add_question($data) + { + global $db, $cache; + + $langs = $this->get_languages(); + $question_ary = $data; + + $question_ary['lang_id'] = $langs[$data['lang_iso']]['id']; + unset($question_ary['answers']); + + $sql = 'INSERT INTO ' . $this->table_captcha_questions . ' ' . $db->sql_build_array('INSERT', $question_ary); + $db->sql_query($sql); + + $question_id = $db->sql_nextid(); + + $this->acp_insert_answers($data, $question_id); + + $cache->destroy('sql', $this->table_captcha_questions); + } + + /** + * Insert the answers. + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function acp_insert_answers($data, $question_id) + { + global $db, $cache; + + foreach ($data['answers'] as $answer) + { + $answer_ary = array( + 'question_id' => $question_id, + 'answer_text' => $answer, + ); + + $sql = 'INSERT INTO ' . $this->table_captcha_answers . ' ' . $db->sql_build_array('INSERT', $answer_ary); + $db->sql_query($sql); + } + + $cache->destroy('sql', $this->table_captcha_answers); + } + + /** + * Delete a question. + */ + function acp_delete_question($question_id) + { + global $db, $cache; + + $tables = array($this->table_captcha_questions, $this->table_captcha_answers); + + foreach ($tables as $table) + { + $sql = "DELETE FROM $table + WHERE question_id = $question_id"; + $db->sql_query($sql); + } + + $cache->destroy('sql', $tables); + } + + /** + * Check if the entered data can be inserted/used + * param mixed $data : an array as created from acp_get_question_input or acp_get_question_data + */ + function validate_input($question_data) + { + $langs = $this->get_languages(); + + if (!isset($question_data['lang_iso']) || + !isset($question_data['question_text']) || + !isset($question_data['strict']) || + !isset($question_data['answers'])) + { + return false; + } + + if (!isset($langs[$question_data['lang_iso']]) || + !strlen($question_data['question_text']) || + !count($question_data['answers']) || + !is_array($question_data['answers'])) + { + return false; + } + + return true; + } + + /** + * List the installed language packs + */ + function get_languages() + { + global $db; + + $sql = 'SELECT * + FROM ' . LANG_TABLE; + $result = $db->sql_query($sql); + + $langs = array(); + while ($row = $db->sql_fetchrow($result)) + { + $langs[$row['lang_iso']] = array( + 'name' => $row['lang_local_name'], + 'id' => (int) $row['lang_id'], + ); + } + $db->sql_freeresult($result); + + return $langs; + } + + + + /** + * See if there is a question other than the one we have + */ + function acp_is_last($question_id) + { + global $config, $db; + + if ($question_id) + { + $sql = 'SELECT question_id + FROM ' . $this->table_captcha_questions . " + WHERE lang_iso = '" . $db->sql_escape($config['default_lang']) . "' + AND question_id <> " . (int) $question_id; + $result = $db->sql_query_limit($sql, 1); + $question = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$question) + { + return true; + } + return false; + } + } +} diff --git a/install/update/old/phpbb/class_loader.php b/install/update/old/phpbb/class_loader.php new file mode 100644 index 0000000..cfdcc2a --- /dev/null +++ b/install/update/old/phpbb/class_loader.php @@ -0,0 +1,164 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* The class loader resolves class names to file system paths and loads them if +* necessary. +* +* Classes have to be of the form phpbb_(dir_)*(classpart_)*, so directory names +* must never contain underscores. Example: phpbb_dir_subdir_class_name is a +* valid class name, while phpbb_dir_sub_dir_class_name is not. +* +* If every part of the class name is a directory, the last directory name is +* also used as the filename, e.g. phpbb_dir would resolve to dir/dir.php. +*/ +class class_loader +{ + private $namespace; + private $path; + private $php_ext; + private $cache; + + /** + * A map of looked up class names to paths relative to $this->path. + * This map is stored in cache and looked up if the cache is available. + * + * @var array + */ + private $cached_paths = array(); + + /** + * Creates a new \phpbb\class_loader, which loads files with the given + * file extension from the given path. + * + * @param string $namespace Required namespace for files to be loaded + * @param string $path Directory to load files from + * @param string $php_ext The file extension for PHP files + * @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface. + */ + public function __construct($namespace, $path, $php_ext = 'php', \phpbb\cache\driver\driver_interface $cache = null) + { + if ($namespace[0] !== '\\') + { + $namespace = '\\' . $namespace; + } + + $this->namespace = $namespace; + $this->path = $path; + $this->php_ext = $php_ext; + + $this->set_cache($cache); + } + + /** + * Provide the class loader with a cache to store paths. If set to null, the + * the class loader will resolve paths by checking for the existance of every + * directory in the class name every time. + * + * @param \phpbb\cache\driver\driver_interface $cache An implementation of the phpBB cache interface. + */ + public function set_cache(\phpbb\cache\driver\driver_interface $cache = null) + { + if ($cache) + { + $this->cached_paths = $cache->get('class_loader_' . str_replace('\\', '__', $this->namespace)); + + if ($this->cached_paths === false) + { + $this->cached_paths = array(); + } + } + + $this->cache = $cache; + } + + /** + * Registers the class loader as an autoloader using SPL. + */ + public function register() + { + spl_autoload_register(array($this, 'load_class')); + } + + /** + * Removes the class loader from the SPL autoloader stack. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'load_class')); + } + + /** + * Resolves a phpBB class name to a relative path which can be included. + * + * @param string $class The class name to resolve, must be in the + * namespace the loader was constructed with. + * Has to begin with \ + * @return string|bool A relative path to the file containing the + * class or false if looking it up failed. + */ + public function resolve_path($class) + { + if (isset($this->cached_paths[$class])) + { + return $this->path . $this->cached_paths[$class] . '.' . $this->php_ext; + } + + if (!preg_match('/^' . preg_quote($this->namespace, '/') . '[a-zA-Z0-9_\\\\]+$/', $class)) + { + return false; + } + + $relative_path = str_replace('\\', '/', substr($class, strlen($this->namespace))); + + if (!file_exists($this->path . $relative_path . '.' . $this->php_ext)) + { + return false; + } + + if ($this->cache) + { + $this->cached_paths[$class] = $relative_path; + $this->cache->put('class_loader_' . str_replace('\\', '__', $this->namespace), $this->cached_paths); + } + + return $this->path . $relative_path . '.' . $this->php_ext; + } + + /** + * Resolves a class name to a path and then includes it. + * + * @param string $class The class name which is being loaded. + */ + public function load_class($class) + { + // In general $class is not supposed to contain a leading backslash, + // but sometimes it does. See tickets PHP-50731 and HHVM-1840. + if ($class[0] !== '\\') + { + $class = '\\' . $class; + } + + if (substr($class, 0, strlen($this->namespace)) === $this->namespace) + { + $path = $this->resolve_path($class); + + if ($path) + { + require $path; + } + } + } +} diff --git a/install/update/old/phpbb/config/config.php b/install/update/old/phpbb/config/config.php new file mode 100644 index 0000000..aaad333 --- /dev/null +++ b/install/update/old/phpbb/config/config.php @@ -0,0 +1,167 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\config; + +/** +* Configuration container class +*/ +class config implements \ArrayAccess, \IteratorAggregate, \Countable +{ + /** + * The configuration data + * @var array(string => string) + */ + protected $config; + + /** + * Creates a configuration container with a default set of values + * + * @param array(string => string) $config The configuration data. + */ + public function __construct(array $config) + { + $this->config = $config; + } + + /** + * Retrieves an ArrayIterator over the configuration values. + * + * @return \ArrayIterator An iterator over all config data + */ + public function getIterator() + { + return new \ArrayIterator($this->config); + } + + /** + * Checks if the specified config value exists. + * + * @param string $key The configuration option's name. + * @return bool Whether the configuration option exists. + */ + public function offsetExists($key) + { + return isset($this->config[$key]); + } + + /** + * Retrieves a configuration value. + * + * @param string $key The configuration option's name. + * @return string The configuration value + */ + public function offsetGet($key) + { + return (isset($this->config[$key])) ? $this->config[$key] : ''; + } + + /** + * Temporarily overwrites the value of a configuration variable. + * + * The configuration change will not persist. It will be lost + * after the request. + * + * @param string $key The configuration option's name. + * @param string $value The temporary value. + */ + public function offsetSet($key, $value) + { + $this->config[$key] = $value; + } + + /** + * Called when deleting a configuration value directly, triggers an error. + * + * @param string $key The configuration option's name. + */ + public function offsetUnset($key) + { + trigger_error('Config values have to be deleted explicitly with the \phpbb\config\config::delete($key) method.', E_USER_ERROR); + } + + /** + * Retrieves the number of configuration options currently set. + * + * @return int Number of config options + */ + public function count() + { + return count($this->config); + } + + /** + * Removes a configuration option + * + * @param String $key The configuration option's name + * @param bool $use_cache Whether this variable should be cached or if it + * changes too frequently to be efficiently cached + * @return null + */ + public function delete($key, $use_cache = true) + { + unset($this->config[$key]); + } + + /** + * Sets a configuration option's value + * + * @param string $key The configuration option's name + * @param string $value New configuration value + * @param bool $use_cache Whether this variable should be cached or if it + * changes too frequently to be efficiently cached. + */ + public function set($key, $value, $use_cache = true) + { + $this->config[$key] = $value; + } + + /** + * Sets a configuration option's value only if the old_value matches the + * current configuration value or the configuration value does not exist yet. + * + * @param string $key The configuration option's name + * @param string $old_value Current configuration value + * @param string $new_value New configuration value + * @param bool $use_cache Whether this variable should be cached or if it + * changes too frequently to be efficiently cached. + * @return bool True if the value was changed, false otherwise. + */ + public function set_atomic($key, $old_value, $new_value, $use_cache = true) + { + if (!isset($this->config[$key]) || $this->config[$key] == $old_value) + { + $this->config[$key] = $new_value; + return true; + } + return false; + } + + /** + * Increments an integer configuration value. + * + * @param string $key The configuration option's name + * @param int $increment Amount to increment by + * @param bool $use_cache Whether this variable should be cached or if it + * changes too frequently to be efficiently cached. + */ + function increment($key, $increment, $use_cache = true) + { + if (!isset($this->config[$key])) + { + $this->config[$key] = 0; + } + + $this->config[$key] += $increment; + } +} diff --git a/install/update/old/phpbb/config_php_file.php b/install/update/old/phpbb/config_php_file.php new file mode 100644 index 0000000..7445e7d --- /dev/null +++ b/install/update/old/phpbb/config_php_file.php @@ -0,0 +1,160 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +class config_php_file +{ + /** @var string phpBB Root Path */ + protected $phpbb_root_path; + + /** @var string php file extension */ + protected $php_ext; + + /** + * Indicates whether the php config file has been loaded. + * + * @var bool + */ + protected $config_loaded = false; + + /** + * The content of the php config file + * + * @var array + */ + protected $config_data = array(); + + /** + * The path to the config file. (Default: $phpbb_root_path . 'config.' . $php_ext) + * + * @var string + */ + protected $config_file; + + private $defined_vars; + + /** + * Constructor + * + * @param string $phpbb_root_path phpBB Root Path + * @param string $php_ext php file extension + */ + function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->config_file = $this->phpbb_root_path . 'config.' . $this->php_ext; + } + + /** + * Set the path to the config file. + * + * @param string $config_file + */ + public function set_config_file($config_file) + { + $this->config_file = $config_file; + $this->config_loaded = false; + } + + /** + * Returns an associative array containing the variables defined by the config file. + * + * @return array Return the content of the config file or an empty array if the file does not exists. + */ + public function get_all() + { + $this->load_config_file(); + + return $this->config_data; + } + + /** + * Return the value of a variable defined into the config.php file or null if the variable does not exist. + * + * @param string $variable The name of the variable + * @return mixed Value of the variable or null if the variable is not defined. + */ + public function get($variable) + { + $this->load_config_file(); + + return isset($this->config_data[$variable]) ? $this->config_data[$variable] : null; + } + + /** + * Load the config file and store the information. + * + * @return null + */ + protected function load_config_file() + { + if (!$this->config_loaded && file_exists($this->config_file)) + { + $this->defined_vars = get_defined_vars(); + + require($this->config_file); + $this->config_data = array_diff_key(get_defined_vars(), $this->defined_vars); + + $this->config_loaded = true; + } + } + + /** + * Convert either 3.0 dbms or 3.1 db driver class name to 3.1 db driver class name. + * + * If $dbms is a valid 3.1 db driver class name, returns it unchanged. + * Otherwise prepends phpbb\db\driver\ to the dbms to convert a 3.0 dbms + * to 3.1 db driver class name. + * + * @param string $dbms dbms parameter + * @return string driver class + * @throws \RuntimeException + */ + public function convert_30_dbms_to_31($dbms) + { + // Note: this check is done first because mysqli extension + // supplies a mysqli class, and class_exists($dbms) would return + // true for mysqli class. + // However, per the docblock any valid 3.1 driver name should be + // recognized by this function, and have priority over 3.0 dbms. + if (strpos($dbms, 'phpbb\db\driver') === false && class_exists('phpbb\db\driver\\' . $dbms)) + { + return 'phpbb\db\driver\\' . $dbms; + } + + if (class_exists($dbms)) + { + // Additionally we could check that $dbms extends phpbb\db\driver\driver. + // http://php.net/manual/en/class.reflectionclass.php + // Beware of possible performance issues: + // http://stackoverflow.com/questions/294582/php-5-reflection-api-performance + // We could check for interface implementation in all paths or + // only when we do not prepend phpbb\db\driver\. + + /* + $reflection = new \ReflectionClass($dbms); + + if ($reflection->isSubclassOf('phpbb\db\driver\driver')) + { + return $dbms; + } + */ + + return $dbms; + } + + throw new \RuntimeException("You have specified an invalid dbms driver: $dbms"); + } +} diff --git a/install/update/old/phpbb/console/command/cron/run.php b/install/update/old/phpbb/console/command/cron/run.php new file mode 100644 index 0000000..dea6493 --- /dev/null +++ b/install/update/old/phpbb/console/command/cron/run.php @@ -0,0 +1,171 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\cron; + +use phpbb\exception\runtime_exception; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Output\OutputInterface; + +class run extends \phpbb\console\command\command +{ + /** @var \phpbb\cron\manager */ + protected $cron_manager; + + /** @var \phpbb\lock\db */ + protected $lock_db; + + /** + * Construct method + * + * @param \phpbb\user $user The user object (used to get language information) + * @param \phpbb\cron\manager $cron_manager The cron manager containing + * the cron tasks to be executed. + * @param \phpbb\lock\db $lock_db The lock for accessing database. + */ + public function __construct(\phpbb\user $user, \phpbb\cron\manager $cron_manager, \phpbb\lock\db $lock_db) + { + $this->cron_manager = $cron_manager; + $this->lock_db = $lock_db; + parent::__construct($user); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('cron:run') + ->setDescription($this->user->lang('CLI_DESCRIPTION_CRON_RUN')) + ->setHelp($this->user->lang('CLI_HELP_CRON_RUN')) + ->addArgument('name', InputArgument::OPTIONAL, $this->user->lang('CLI_DESCRIPTION_CRON_RUN_ARGUMENT_1')) + ; + } + + /** + * Executes the command cron:run. + * + * Tries to acquire the cron lock, then if no argument has been given runs all ready cron tasks. + * If the cron lock can not be obtained, an error message is printed + * and the exit status is set to 1. + * If the verbose option is specified, each start of a task is printed. + * Otherwise there is no output. + * If an argument is given to the command, only the task whose name matches the + * argument will be started. If verbose option is specified, + * an info message containing the name of the task is printed. + * If no task matches the argument given, an error message is printed + * and the exit status is set to 2. + * + * @param InputInterface $input The input stream used to get the argument and verboe option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * + * @return int 0 if all is ok, 1 if a lock error occured and 2 if no task matching the argument was found. + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + if ($this->lock_db->acquire()) + { + $task_name = $input->getArgument('name'); + if ($task_name) + { + $exit_status = $this->run_one($input, $output, $task_name); + } + else + { + $exit_status = $this->run_all($input, $output); + } + + $this->lock_db->release(); + return $exit_status; + } + else + { + throw new runtime_exception('CRON_LOCK_ERROR', array(), null, 1); + } + } + + /** + * Executes all ready cron tasks. + * + * If verbose mode is set, an info message will be printed if there is no task to + * be run, or else for each starting task. + * + * @see execute + * @param InputInterface $input The input stream used to get the argument and verbose option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * @return int 0 + */ + protected function run_all(InputInterface $input, OutputInterface $output) + { + $run_tasks = $this->cron_manager->find_all_ready_tasks(); + + if ($run_tasks) + { + foreach ($run_tasks as $task) + { + if ($input->getOption('verbose')) + { + $output->writeln('' . $this->user->lang('RUNNING_TASK', $task->get_name()) . ''); + } + + $task->run(); + } + } + else + { + if ($input->getOption('verbose')) + { + $output->writeln('' . $this->user->lang('CRON_NO_TASK') . ''); + } + } + + return 0; + } + + /** + * Executes a given cron task, if it is ready. + * + * If there is a task whose name matches $task_name, it is run and 0 is returned. + * and if verbose mode is set, print an info message with the name of the task. + * If there is no task matching $task_name, the function prints an error message + * and returns with status 2. + * + * @see execute + * @param string $task_name The name of the task that should be run. + * @param InputInterface $input The input stream used to get the argument and verbose option. + * @param OutputInterface $output The output stream, used for printing verbose-mode and error information. + * @return int 0 if all is well, 2 if no task matches $task_name. + */ + protected function run_one(InputInterface $input, OutputInterface $output, $task_name) + { + $task = $this->cron_manager->find_task($task_name); + if ($task) + { + if ($input->getOption('verbose')) + { + $output->writeln('' . $this->user->lang('RUNNING_TASK', $task_name) . ''); + } + + $task->run(); + return 0; + } + else + { + throw new runtime_exception('CRON_NO_SUCH_TASK', array( $task_name), null, 2); + } + } +} diff --git a/install/update/old/phpbb/console/command/extension/enable.php b/install/update/old/phpbb/console/command/extension/enable.php new file mode 100644 index 0000000..a6f5b10 --- /dev/null +++ b/install/update/old/phpbb/console/command/extension/enable.php @@ -0,0 +1,76 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ +namespace phpbb\console\command\extension; + +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; + +class enable extends command +{ + protected function configure() + { + $this + ->setName('extension:enable') + ->setDescription($this->user->lang('CLI_DESCRIPTION_ENABLE_EXTENSION')) + ->addArgument( + 'extension-name', + InputArgument::REQUIRED, + $this->user->lang('CLI_EXTENSION_NAME') + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + $name = $input->getArgument('extension-name'); + + if (!$this->manager->is_available($name)) + { + $io->error($this->user->lang('CLI_EXTENSION_NOT_EXIST', $name)); + return 1; + } + + $extension = $this->manager->get_extension($name); + + if (!$extension->is_enableable()) + { + $io->error($this->user->lang('CLI_EXTENSION_NOT_ENABLEABLE', $name)); + return 1; + } + + if ($this->manager->is_enabled($name)) + { + $io->error($this->user->lang('CLI_EXTENSION_ENABLED', $name)); + return 1; + } + + $this->manager->enable($name); + $this->manager->load_extensions(); + + if ($this->manager->is_enabled($name)) + { + $this->log->add('admin', ANONYMOUS, '', 'LOG_EXT_ENABLE', time(), array($name)); + $io->success($this->user->lang('CLI_EXTENSION_ENABLE_SUCCESS', $name)); + return 0; + } + else + { + $io->error($this->user->lang('CLI_EXTENSION_ENABLE_FAILURE', $name)); + return 1; + } + } +} diff --git a/install/update/old/phpbb/console/command/update/check.php b/install/update/old/phpbb/console/command/update/check.php new file mode 100644 index 0000000..9ced651 --- /dev/null +++ b/install/update/old/phpbb/console/command/update/check.php @@ -0,0 +1,331 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\console\command\update; + +use phpbb\config\config; +use phpbb\exception\exception_interface; +use phpbb\language\language; +use phpbb\user; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\DependencyInjection\ContainerInterface; + +class check extends \phpbb\console\command\command +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \Symfony\Component\DependencyInjection\ContainerBuilder */ + protected $phpbb_container; + /** + * @var language + */ + private $language; + + /** + * Construct method + */ + public function __construct(user $user, config $config, ContainerInterface $phpbb_container, language $language) + { + $this->config = $config; + $this->phpbb_container = $phpbb_container; + $this->language = $language; + + $this->language->add_lang(array('acp/common', 'acp/extensions')); + + parent::__construct($user); + } + + /** + * Configures the service. + * + * Sets the name and description of the command. + * + * @return null + */ + protected function configure() + { + $this + ->setName('update:check') + ->setDescription($this->language->lang('CLI_DESCRIPTION_UPDATE_CHECK')) + ->addArgument('ext-name', InputArgument::OPTIONAL, $this->language->lang('CLI_DESCRIPTION_UPDATE_CHECK_ARGUMENT_1')) + ->addOption('stability', null, InputOption::VALUE_REQUIRED, $this->language->lang('CLI_DESCRIPTION_UPDATE_CHECK_OPTION_STABILITY')) + ->addOption('cache', 'c', InputOption::VALUE_NONE, $this->language->lang('CLI_DESCRIPTION_UPDATE_CHECK_OPTION_CACHE')) + ; + } + + /** + * Executes the command. + * + * Checks if an update is available. + * If at least one is available, a message is printed and if verbose mode is set the list of possible updates is printed. + * If their is none, nothing is printed unless verbose mode is set. + * + * @param InputInterface $input Input stream, used to get the options. + * @param OutputInterface $output Output stream, used to print messages. + * @return int 0 if the board is up to date, 1 if it is not and 2 if an error occured. + * @throws \RuntimeException + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + $recheck = true; + if ($input->getOption('cache')) + { + $recheck = false; + } + + $stability = null; + if ($input->getOption('stability')) + { + $stability = $input->getOption('stability'); + if (!($stability == 'stable') && !($stability == 'unstable')) + { + $io->error($this->language->lang('CLI_ERROR_INVALID_STABILITY', $stability)); + return 3; + } + } + + $ext_name = $input->getArgument('ext-name'); + if ($ext_name != null) + { + if ($ext_name == 'all') + { + return $this->check_all_ext($io, $stability, $recheck); + } + else + { + return $this->check_ext($input, $io, $stability, $recheck, $ext_name); + } + } + else + { + return $this->check_core($input, $io, $stability, $recheck); + } + } + + /** + * Check if a given extension is up to date + * + * @param InputInterface $input Input stream, used to get the options. + * @param SymfonyStyle $io IO handler, for formatted and unified IO + * @param string $stability Force a given stability + * @param bool $recheck Disallow the use of the cache + * @param string $ext_name The extension name + * @return int + */ + protected function check_ext(InputInterface $input, SymfonyStyle $io, $stability, $recheck, $ext_name) + { + try + { + $ext_manager = $this->phpbb_container->get('ext.manager'); + $md_manager = $ext_manager->create_extension_metadata_manager($ext_name); + $updates_available = $ext_manager->version_check($md_manager, $recheck, false, $stability); + + $metadata = $md_manager->get_metadata('all'); + if ($input->getOption('verbose')) + { + $io->title($md_manager->get_metadata('display-name')); + + $io->note($this->language->lang('CURRENT_VERSION') . $this->language->lang('COLON') . ' ' . $metadata['version']); + } + + if (!empty($updates_available)) + { + if ($input->getOption('verbose')) + { + $io->caution($this->language->lang('NOT_UP_TO_DATE', $metadata['name'])); + + $this->display_versions($io, $updates_available); + } + + return 1; + } + else + { + if ($input->getOption('verbose')) + { + $io->success($this->language->lang('UPDATE_NOT_NEEDED')); + } + + return 0; + } + } + catch (\RuntimeException $e) + { + $io->error($this->language->lang('EXTENSION_NOT_INSTALLED', $ext_name)); + + return 1; + } + } + + /** + * Check if the core is up to date + * + * @param InputInterface $input Input stream, used to get the options. + * @param SymfonyStyle $io IO handler, for formatted and unified IO + * @param string $stability Force a given stability + * @param bool $recheck Disallow the use of the cache + * @return int + */ + protected function check_core(InputInterface $input, SymfonyStyle $io, $stability, $recheck) + { + $version_helper = $this->phpbb_container->get('version_helper'); + $version_helper->force_stability($stability); + + $updates_available = $version_helper->get_suggested_updates($recheck); + + if ($input->getOption('verbose')) + { + $io->title('phpBB core'); + + $io->note( $this->language->lang('CURRENT_VERSION') . $this->language->lang('COLON') . ' ' . $this->config['version']); + } + + if (!empty($updates_available)) + { + $io->caution($this->language->lang('UPDATE_NEEDED')); + + if ($input->getOption('verbose')) + { + $this->display_versions($io, $updates_available); + } + + return 1; + } + else + { + if ($input->getOption('verbose')) + { + $io->success($this->language->lang('UPDATE_NOT_NEEDED')); + } + + return 0; + } + } + + /** + * Check if all the available extensions are up to date + * + * @param SymfonyStyle $io IO handler, for formatted and unified IO + * @param bool $recheck Disallow the use of the cache + * @return int + */ + protected function check_all_ext(SymfonyStyle $io, $stability, $recheck) + { + /** @var \phpbb\extension\manager $ext_manager */ + $ext_manager = $this->phpbb_container->get('ext.manager'); + + $rows = []; + + foreach ($ext_manager->all_available() as $ext_name => $ext_path) + { + $row = []; + $row[] = sprintf("%s", $ext_name); + $md_manager = $ext_manager->create_extension_metadata_manager($ext_name); + try + { + $metadata = $md_manager->get_metadata('all'); + if (isset($metadata['extra']['version-check'])) + { + try { + $updates_available = $ext_manager->version_check($md_manager, $recheck, false, $stability); + if (!empty($updates_available)) + { + $versions = array_map(function($entry) + { + return $entry['current']; + }, $updates_available); + + $row[] = sprintf("%s", $metadata['version']); + $row[] = implode(', ', $versions); + } + else + { + $row[] = sprintf("%s", $metadata['version']); + $row[] = ''; + } + } catch (\RuntimeException $e) { + $row[] = $metadata['version']; + $row[] = ''; + } + } + else + { + $row[] = $metadata['version']; + $row[] = ''; + } + } + catch (exception_interface $e) + { + $exception_message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters())); + $row[] = '' . $exception_message . ''; + } + catch (\RuntimeException $e) + { + $row[] = '' . $e->getMessage() . ''; + } + + $rows[] = $row; + } + + $io->table([ + $this->language->lang('EXTENSION_NAME'), + $this->language->lang('CURRENT_VERSION'), + $this->language->lang('LATEST_VERSION'), + ], $rows); + + return 0; + } + + /** + * Display the details of the available updates + * + * @param SymfonyStyle $io IO handler, for formatted and unified IO + * @param array $updates_available The list of the available updates + */ + protected function display_versions(SymfonyStyle $io, $updates_available) + { + $io->section($this->language->lang('UPDATES_AVAILABLE')); + + $rows = []; + foreach ($updates_available as $version_data) + { + $row = ['', '', '']; + $row[0] = $version_data['current']; + + if (isset($version_data['announcement'])) + { + $row[1] = $version_data['announcement']; + } + + if (isset($version_data['download'])) + { + $row[2] = $version_data['download']; + } + + $rows[] = $row; + } + + $io->table([ + $this->language->lang('VERSION'), + $this->language->lang('ANNOUNCEMENT_TOPIC'), + $this->language->lang('DOWNLOAD_LATEST'), + ], $rows); + } +} diff --git a/install/update/old/phpbb/console/command/user/add.php b/install/update/old/phpbb/console/command/user/add.php new file mode 100644 index 0000000..c60a059 --- /dev/null +++ b/install/update/old/phpbb/console/command/user/add.php @@ -0,0 +1,334 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\console\command\user; + +use phpbb\config\config; +use phpbb\console\command\command; +use phpbb\db\driver\driver_interface; +use phpbb\exception\runtime_exception; +use phpbb\language\language; +use phpbb\passwords\manager; +use phpbb\user; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Question\Question; +use Symfony\Component\Console\Style\SymfonyStyle; + +class add extends command +{ + /** @var array Array of interactively acquired options */ + protected $data; + + /** @var driver_interface */ + protected $db; + + /** @var config */ + protected $config; + + /** @var language */ + protected $language; + + /** @var manager */ + protected $password_manager; + + /** + * phpBB root path + * + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP extension. + * + * @var string + */ + protected $php_ext; + + /** + * Construct method + * + * @param user $user + * @param driver_interface $db + * @param config $config + * @param language $language + * @param manager $password_manager + * @param string $phpbb_root_path + * @param string $php_ext + */ + public function __construct(user $user, driver_interface $db, config $config, language $language, manager $password_manager, $phpbb_root_path, $php_ext) + { + $this->db = $db; + $this->config = $config; + $this->language = $language; + $this->password_manager = $password_manager; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->language->add_lang('ucp'); + parent::__construct($user); + } + + /** + * Sets the command name and description + * + * @return null + */ + protected function configure() + { + $this + ->setName('user:add') + ->setDescription($this->language->lang('CLI_DESCRIPTION_USER_ADD')) + ->setHelp($this->language->lang('CLI_HELP_USER_ADD')) + ->addOption( + 'username', + 'U', + InputOption::VALUE_REQUIRED, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_USERNAME') + ) + ->addOption( + 'password', + 'P', + InputOption::VALUE_REQUIRED, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_PASSWORD') + ) + ->addOption( + 'email', + 'E', + InputOption::VALUE_REQUIRED, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_EMAIL') + ) + ->addOption( + 'send-email', + null, + InputOption::VALUE_NONE, + $this->language->lang('CLI_DESCRIPTION_USER_ADD_OPTION_NOTIFY') + ) + ; + } + + /** + * Executes the command user:add + * + * Adds a new user to the database. If options are not provided, it will ask for the username, password and email. + * User is added to the registered user group. Language and timezone default to $config settings. + * + * @param InputInterface $input The input stream used to get the options + * @param OutputInterface $output The output stream, used to print messages + * + * @return int 0 if all is well, 1 if any errors occurred + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + $io = new SymfonyStyle($input, $output); + + try + { + $this->validate_user_data(); + $group_id = $this->get_group_id(); + } + catch (runtime_exception $e) + { + $io->error($e->getMessage()); + return 1; + } + + $user_row = array( + 'username' => $this->data['username'], + 'user_password' => $this->password_manager->hash($this->data['new_password']), + 'user_email' => $this->data['email'], + 'group_id' => $group_id, + 'user_timezone' => $this->config['board_timezone'], + 'user_lang' => $this->config['default_lang'], + 'user_type' => USER_NORMAL, + 'user_regdate' => time(), + ); + + $user_id = (int) user_add($user_row); + + if (!$user_id) + { + $io->error($this->language->lang('AUTH_NO_PROFILE_CREATED')); + return 1; + } + + if ($input->getOption('send-email') && $this->config['email_enable']) + { + $this->send_activation_email($user_id); + } + + $io->success($this->language->lang('CLI_USER_ADD_SUCCESS', $this->data['username'])); + + return 0; + } + + /** + * Interacts with the user. + * + * @param InputInterface $input An InputInterface instance + * @param OutputInterface $output An OutputInterface instance + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + $helper = $this->getHelper('question'); + + $this->data = array( + 'username' => $input->getOption('username'), + 'new_password' => $input->getOption('password'), + 'email' => $input->getOption('email'), + ); + + if (!$this->data['username']) + { + $question = new Question($this->ask_user('USERNAME')); + $this->data['username'] = $helper->ask($input, $output, $question); + } + + if (!$this->data['new_password']) + { + $question = new Question($this->ask_user('PASSWORD')); + $question->setValidator(function ($value) use ($helper, $input, $output) { + $question = new Question($this->ask_user('CONFIRM_PASSWORD')); + $question->setHidden(true); + if ($helper->ask($input, $output, $question) != $value) + { + throw new runtime_exception($this->language->lang('NEW_PASSWORD_ERROR')); + } + return $value; + }); + $question->setHidden(true); + $question->setMaxAttempts(5); + + $this->data['new_password'] = $helper->ask($input, $output, $question); + } + + if (!$this->data['email']) + { + $question = new Question($this->ask_user('EMAIL_ADDRESS')); + $this->data['email'] = $helper->ask($input, $output, $question); + } + } + + /** + * Validate the submitted user data + * + * @throws runtime_exception if any data fails validation + * @return null + */ + protected function validate_user_data() + { + if (!function_exists('validate_data')) + { + require($this->phpbb_root_path . 'includes/functions_user.' . $this->php_ext); + } + + $error = validate_data($this->data, array( + 'username' => array( + array('string', false, $this->config['min_name_chars'], $this->config['max_name_chars']), + array('username', '')), + 'new_password' => array( + array('string', false, $this->config['min_pass_chars'], $this->config['max_pass_chars']), + array('password')), + 'email' => array( + array('string', false, 6, 60), + array('user_email')), + )); + + if ($error) + { + throw new runtime_exception(implode("\n", array_map(array($this->language, 'lang'), $error))); + } + } + + /** + * Get the group id + * + * Go and find in the database the group_id corresponding to 'REGISTERED' + * + * @throws runtime_exception if the group id does not exist in database. + * @return null + */ + protected function get_group_id() + { + $sql = 'SELECT group_id + FROM ' . GROUPS_TABLE . " + WHERE group_name = '" . $this->db->sql_escape('REGISTERED') . "' + AND group_type = " . GROUP_SPECIAL; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row || !$row['group_id']) + { + throw new runtime_exception($this->language->lang('NO_GROUP')); + } + + return $row['group_id']; + } + + /** + * Send account activation email + * + * @param int $user_id The new user's id + * @return null + */ + protected function send_activation_email($user_id) + { + switch ($this->config['require_activation']) + { + case USER_ACTIVATION_SELF: + $email_template = 'user_welcome_inactive'; + $user_actkey = gen_rand_string(mt_rand(6, 10)); + break; + case USER_ACTIVATION_ADMIN: + $email_template = 'admin_welcome_inactive'; + $user_actkey = gen_rand_string(mt_rand(6, 10)); + break; + default: + $email_template = 'user_welcome'; + $user_actkey = ''; + break; + } + + if (!class_exists('messenger')) + { + require($this->phpbb_root_path . 'includes/functions_messenger.' . $this->php_ext); + } + + $messenger = new \messenger(false); + $messenger->template($email_template, $this->user->lang_name); + $messenger->to($this->data['email'], $this->data['username']); + $messenger->anti_abuse_headers($this->config, $this->user); + $messenger->assign_vars(array( + 'WELCOME_MSG' => htmlspecialchars_decode($this->language->lang('WELCOME_SUBJECT', $this->config['sitename'])), + 'USERNAME' => htmlspecialchars_decode($this->data['username']), + 'PASSWORD' => htmlspecialchars_decode($this->data['new_password']), + 'U_ACTIVATE' => generate_board_url() . "/ucp.{$this->php_ext}?mode=activate&u=$user_id&k=$user_actkey") + ); + + $messenger->send(NOTIFY_EMAIL); + } + + /** + * Helper to translate questions to the user + * + * @param string $key The language key + * @return string The language key translated with a colon and space appended + */ + protected function ask_user($key) + { + return $this->language->lang($key) . $this->language->lang('COLON') . ' '; + } +} diff --git a/install/update/old/phpbb/content_visibility.php b/install/update/old/phpbb/content_visibility.php new file mode 100644 index 0000000..f023e07 --- /dev/null +++ b/install/update/old/phpbb/content_visibility.php @@ -0,0 +1,885 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* phpbb_visibility +* Handle fetching and setting the visibility for topics and posts +*/ +class content_visibility +{ + /** + * Database object + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Auth object + * @var \phpbb\auth\auth + */ + protected $auth; + + /** + * config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * phpBB root path + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP Extension + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + * @param \phpbb\db\driver\driver_interface $db Database object + * @param \phpbb\user $user User object + * @param string $phpbb_root_path Root path + * @param string $php_ext PHP Extension + * @param string $forums_table Forums table name + * @param string $posts_table Posts table name + * @param string $topics_table Topics table name + * @param string $users_table Users table name + */ + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\event\dispatcher_interface $phpbb_dispatcher, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $php_ext, $forums_table, $posts_table, $topics_table, $users_table) + { + $this->auth = $auth; + $this->config = $config; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->db = $db; + $this->user = $user; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->forums_table = $forums_table; + $this->posts_table = $posts_table; + $this->topics_table = $topics_table; + $this->users_table = $users_table; + } + + /** + * Can the current logged-in user soft-delete posts? + * + * @param $forum_id int Forum ID whose permissions to check + * @param $poster_id int Poster ID of the post in question + * @param $post_locked bool Is the post locked? + * @return bool + */ + public function can_soft_delete($forum_id, $poster_id, $post_locked) + { + if ($this->auth->acl_get('m_softdelete', $forum_id)) + { + return true; + } + else if ($this->auth->acl_get('f_softdelete', $forum_id) && $poster_id == $this->user->data['user_id'] && !$post_locked) + { + return true; + } + + return false; + } + + /** + * Get the topics post count or the forums post/topic count based on permissions + * + * @param $mode string One of topic_posts, forum_posts or forum_topics + * @param $data array Array with the topic/forum data to calculate from + * @param $forum_id int The forum id is used for permission checks + * @return int Number of posts/topics the user can see in the topic/forum + */ + public function get_count($mode, $data, $forum_id) + { + if (!$this->auth->acl_get('m_approve', $forum_id)) + { + return (int) $data[$mode . '_approved']; + } + + return (int) $data[$mode . '_approved'] + (int) $data[$mode . '_unapproved'] + (int) $data[$mode . '_softdeleted']; + } + + + /** + * Check topic/post visibility for a given forum ID + * + * Note: Read permissions are not checked. + * + * @param $mode string Either "topic" or "post" + * @param $forum_id int The forum id is used for permission checks + * @param $data array Array with item information to check visibility + * @return bool True if the item is visible, false if not + */ + public function is_visible($mode, $forum_id, $data) + { + $is_visible = $this->auth->acl_get('m_approve', $forum_id) || $data[$mode . '_visibility'] == ITEM_APPROVED; + + /** + * Allow changing the result of calling is_visible + * + * @event core.phpbb_content_visibility_is_visible + * @var bool is_visible Default visibility condition, to be modified by extensions if needed. + * @var string mode Either "topic" or "post" + * @var int forum_id Forum id of the current item + * @var array data Array of item information + * @since 3.2.2-RC1 + */ + $vars = array( + 'is_visible', + 'mode', + 'forum_id', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_is_visible', compact($vars))); + + return $is_visible; + } + + /** + * Create topic/post visibility SQL for a given forum ID + * + * Note: Read permissions are not checked. + * + * @param $mode string Either "topic" or "post" + * @param $forum_id int The forum id is used for permission checks + * @param $table_alias string Table alias to prefix in SQL queries + * @return string The appropriate combination SQL logic for topic/post_visibility + */ + public function get_visibility_sql($mode, $forum_id, $table_alias = '') + { + $where_sql = ''; + + $get_visibility_sql_overwrite = false; + + /** + * Allow changing the result of calling get_visibility_sql + * + * @event core.phpbb_content_visibility_get_visibility_sql_before + * @var string where_sql Extra visibility conditions. It must end with either an SQL "AND" or an "OR" + * @var string mode Either "topic" or "post" depending on the query this is being used in + * @var array forum_id The forum id in which the search is made. + * @var string table_alias Table alias to prefix in SQL queries + * @var mixed get_visibility_sql_overwrite If a string, forces the function to return get_forums_visibility_sql_overwrite after executing the event + * If false, get_visibility_sql continues normally + * It must be either boolean or string + * @since 3.1.4-RC1 + */ + $vars = array( + 'where_sql', + 'mode', + 'forum_id', + 'table_alias', + 'get_visibility_sql_overwrite', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_visibility_sql_before', compact($vars))); + + if ($get_visibility_sql_overwrite !== false) + { + return $get_visibility_sql_overwrite; + } + + if ($this->auth->acl_get('m_approve', $forum_id)) + { + $where_sql .= '1 = 1'; + } + else + { + $where_sql .= $table_alias . $mode . '_visibility = ' . ITEM_APPROVED; + } + + return '(' . $where_sql . ')'; + } + + /** + * Create topic/post visibility SQL for a set of forums + * + * Note: Read permissions are not checked. Forums without read permissions + * should not be in $forum_ids + * + * @param $mode string Either "topic" or "post" + * @param $forum_ids array Array of forum ids which the posts/topics are limited to + * @param $table_alias string Table alias to prefix in SQL queries + * @return string The appropriate combination SQL logic for topic/post_visibility + */ + public function get_forums_visibility_sql($mode, $forum_ids = array(), $table_alias = '') + { + $where_sql = ''; + + $approve_forums = array_keys($this->auth->acl_getf('m_approve', true)); + if (!empty($forum_ids) && !empty($approve_forums)) + { + $approve_forums = array_intersect($forum_ids, $approve_forums); + $forum_ids = array_diff($forum_ids, $approve_forums); + } + + $get_forums_visibility_sql_overwrite = false; + /** + * Allow changing the result of calling get_forums_visibility_sql + * + * @event core.phpbb_content_visibility_get_forums_visibility_before + * @var string where_sql Extra visibility conditions. It must end with either an SQL "AND" or an "OR" + * @var string mode Either "topic" or "post" depending on the query this is being used in + * @var array forum_ids Array of forum ids which the posts/topics are limited to + * @var string table_alias Table alias to prefix in SQL queries + * @var array approve_forums Array of forums where the user has m_approve permissions + * @var mixed get_forums_visibility_sql_overwrite If a string, forces the function to return get_forums_visibility_sql_overwrite after executing the event + * If false, get_forums_visibility_sql continues normally + * It must be either boolean or string + * @since 3.1.3-RC1 + */ + $vars = array( + 'where_sql', + 'mode', + 'forum_ids', + 'table_alias', + 'approve_forums', + 'get_forums_visibility_sql_overwrite', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_forums_visibility_before', compact($vars))); + + if ($get_forums_visibility_sql_overwrite !== false) + { + return $get_forums_visibility_sql_overwrite; + } + + // Moderator can view all posts/topics in the moderated forums + $where_sql .= '(' . $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums, false, true) . ' OR '; + // Normal user can view approved items only + $where_sql .= '(' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ' + AND ' . $this->db->sql_in_set($table_alias . 'forum_id', $forum_ids, false, true) . '))'; + + return '(' . $where_sql . ')'; + } + + /** + * Create topic/post visibility SQL for all forums on the board + * + * Note: Read permissions are not checked. Forums without read permissions + * should be in $exclude_forum_ids + * + * @param $mode string Either "topic" or "post" + * @param $exclude_forum_ids array Array of forum ids which are excluded + * @param $table_alias string Table alias to prefix in SQL queries + * @return string The appropriate combination SQL logic for topic/post_visibility + */ + public function get_global_visibility_sql($mode, $exclude_forum_ids = array(), $table_alias = '') + { + $where_sqls = array(); + + $approve_forums = array_diff(array_keys($this->auth->acl_getf('m_approve', true)), $exclude_forum_ids); + + $visibility_sql_overwrite = null; + + /** + * Allow changing the result of calling get_global_visibility_sql + * + * @event core.phpbb_content_visibility_get_global_visibility_before + * @var array where_sqls Array of extra visibility conditions. Will be joined by imploding with "OR". + * @var string mode Either "topic" or "post" depending on the query this is being used in + * @var array exclude_forum_ids Array of forum ids the current user doesn't have access to + * @var string table_alias Table alias to prefix in SQL queries + * @var array approve_forums Array of forums where the user has m_approve permissions + * @var string visibility_sql_overwrite If not empty, forces the function to return visibility_sql_overwrite after executing the event + * @since 3.1.3-RC1 + */ + $vars = array( + 'where_sqls', + 'mode', + 'exclude_forum_ids', + 'table_alias', + 'approve_forums', + 'visibility_sql_overwrite', + ); + extract($this->phpbb_dispatcher->trigger_event('core.phpbb_content_visibility_get_global_visibility_before', compact($vars))); + + if ($visibility_sql_overwrite) + { + return $visibility_sql_overwrite; + } + + // Include approved items in all forums but the excluded + $where_sqls[] = '(' . $this->db->sql_in_set($table_alias . 'forum_id', $exclude_forum_ids, true, true) . ' + AND ' . $table_alias . $mode . '_visibility = ' . ITEM_APPROVED . ')'; + + // If user has moderator permissions, add everything in the moderated forums + if (count($approve_forums)) + { + $where_sqls[] = $this->db->sql_in_set($table_alias . 'forum_id', $approve_forums); + } + + return '(' . implode(' OR ', $where_sqls) . ')'; + } + + /** + * Change visibility status of one post or all posts of a topic + * + * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @param $post_id mixed Post ID or array of post IDs to act on, + * if it is empty, all posts of topic_id will be modified + * @param $topic_id int Topic where $post_id is found + * @param $forum_id int Forum where $topic_id is found + * @param $user_id int User performing the action + * @param $time int Timestamp when the action is performed + * @param $reason string Reason why the visibility was changed. + * @param $is_starter bool Is this the first post of the topic changed? + * @param $is_latest bool Is this the last post of the topic changed? + * @param $limit_visibility mixed Limit updating per topic_id to a certain visibility + * @param $limit_delete_time mixed Limit updating per topic_id to a certain deletion time + * @return array Changed post data, empty array if an error occurred. + */ + public function set_post_visibility($visibility, $post_id, $topic_id, $forum_id, $user_id, $time, $reason, $is_starter, $is_latest, $limit_visibility = false, $limit_delete_time = false) + { + if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE))) + { + return array(); + } + + if ($post_id) + { + if (is_array($post_id)) + { + $where_sql = $this->db->sql_in_set('post_id', array_map('intval', $post_id)); + } + else + { + $where_sql = 'post_id = ' . (int) $post_id; + } + $where_sql .= ' AND topic_id = ' . (int) $topic_id; + } + else + { + $where_sql = 'topic_id = ' . (int) $topic_id; + + // Limit the posts to a certain visibility and deletion time + // This allows us to only restore posts, that were approved + // when the topic got soft deleted. So previous soft deleted + // and unapproved posts are still soft deleted/unapproved + if ($limit_visibility !== false) + { + $where_sql .= ' AND post_visibility = ' . (int) $limit_visibility; + } + + if ($limit_delete_time !== false) + { + $where_sql .= ' AND post_delete_time = ' . (int) $limit_delete_time; + } + } + + $sql = 'SELECT poster_id, post_id, post_postcount, post_visibility + FROM ' . $this->posts_table . ' + WHERE ' . $where_sql; + $result = $this->db->sql_query($sql); + + $post_ids = $poster_postcounts = $postcounts = $postcount_visibility = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $post_ids[] = (int) $row['post_id']; + + if ($row['post_visibility'] != $visibility) + { + if ($row['post_postcount'] && !isset($poster_postcounts[(int) $row['poster_id']])) + { + $poster_postcounts[(int) $row['poster_id']] = 1; + } + else if ($row['post_postcount']) + { + $poster_postcounts[(int) $row['poster_id']]++; + } + + if (!isset($postcount_visibility[$row['post_visibility']])) + { + $postcount_visibility[$row['post_visibility']] = 1; + } + else + { + $postcount_visibility[$row['post_visibility']]++; + } + } + } + $this->db->sql_freeresult($result); + + if (empty($post_ids)) + { + return array(); + } + + if (!function_exists('truncate_string')) + { + include($this->phpbb_root_path . 'includes/functions_content.' . $this->php_ext); + } + + $data = array( + 'post_visibility' => (int) $visibility, + 'post_delete_user' => (int) $user_id, + 'post_delete_time' => ((int) $time) ?: time(), + 'post_delete_reason' => truncate_string($reason, 255, 255, false), + ); + /** + * Perform actions right before the query to change post visibility + * + * @event core.set_post_visibility_before_sql + * @var int visibility Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @var array post_id Array containing all post IDs to be modified. If blank, all posts within the topic are modified. + * @var int topic_id Topic of the post IDs to be modified. + * @var int forum_id Forum ID that the topic_id resides in. + * @var int user_id User ID doing this action. + * @var int time Timestamp of this action. + * @var string reason Reason specified by the user for this change. + * @var bool is_starter Are we changing the topic's starter? + * @var bool is_latest Are we changing the topic's latest post? + * @var array data The data array for this action. + * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp + */ + $vars = array( + 'visibility', + 'post_id', + 'topic_id', + 'forum_id', + 'user_id', + 'time', + 'reason', + 'is_starter', + 'is_latest', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.set_post_visibility_before_sql', compact($vars))); + $sql = 'UPDATE ' . $this->posts_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $data) . ' + WHERE ' . $this->db->sql_in_set('post_id', $post_ids); + $this->db->sql_query($sql); + + // Group the authors by post count, to reduce the number of queries + foreach ($poster_postcounts as $poster_id => $num_posts) + { + $postcounts[$num_posts][] = $poster_id; + } + + // Update users postcounts + foreach ($postcounts as $num_posts => $poster_ids) + { + if (in_array($visibility, array(ITEM_REAPPROVE, ITEM_DELETED))) + { + $sql = 'UPDATE ' . $this->users_table . ' + SET user_posts = 0 + WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . ' + AND user_posts < ' . $num_posts; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->users_table . ' + SET user_posts = user_posts - ' . $num_posts . ' + WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . ' + AND user_posts >= ' . $num_posts; + $this->db->sql_query($sql); + } + else + { + $sql = 'UPDATE ' . $this->users_table . ' + SET user_posts = user_posts + ' . $num_posts . ' + WHERE ' . $this->db->sql_in_set('user_id', $poster_ids); + $this->db->sql_query($sql); + } + } + + $update_topic_postcount = true; + + // Sync the first/last topic information if needed + if (!$is_starter && $is_latest) + { + 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) + { + update_post_information('topic', $topic_id, false); + } + if ($forum_id) + { + update_post_information('forum', $forum_id, false); + } + } + else if ($is_starter && $topic_id) + { + if (!function_exists('sync')) + { + include($this->phpbb_root_path . 'includes/functions_admin.' . $this->php_ext); + } + + // ... so we need to use sync, if the first post is changed. + // The forum is resynced recursive by sync() itself. + sync('topic', 'topic_id', $topic_id, true); + + // sync recalculates the topic replies and forum posts by itself, so we don't do that. + $update_topic_postcount = false; + } + + $topic_update_array = array(); + // Update the topic's reply count and the forum's post count + if ($update_topic_postcount) + { + $field_alias = array( + ITEM_APPROVED => 'posts_approved', + ITEM_UNAPPROVED => 'posts_unapproved', + ITEM_DELETED => 'posts_softdeleted', + ITEM_REAPPROVE => 'posts_unapproved', + ); + $cur_posts = array_fill_keys($field_alias, 0); + + foreach ($postcount_visibility as $post_visibility => $visibility_posts) + { + $cur_posts[$field_alias[(int) $post_visibility]] += $visibility_posts; + } + + $sql_ary = array(); + $recipient_field = $field_alias[$visibility]; + + foreach ($cur_posts as $field => $count) + { + // Decrease the count for the old statuses. + if ($count && $field != $recipient_field) + { + $sql_ary[$field] = " - $count"; + } + } + // Add up the count from all statuses excluding the recipient status. + $count_increase = array_sum(array_diff($cur_posts, array($recipient_field))); + + if ($count_increase) + { + $sql_ary[$recipient_field] = " + $count_increase"; + } + + if (count($sql_ary)) + { + $forum_sql = array(); + + foreach ($sql_ary as $field => $value_change) + { + $topic_update_array[] = 'topic_' . $field . ' = topic_' . $field . $value_change; + $forum_sql[] = 'forum_' . $field . ' = forum_' . $field . $value_change; + } + + $sql = 'UPDATE ' . $this->forums_table . ' + SET ' . implode(', ', $forum_sql) . ' + WHERE forum_id = ' . (int) $forum_id; + $this->db->sql_query($sql); + } + } + + if ($post_id) + { + $sql = 'SELECT 1 AS has_attachments + FROM ' . POSTS_TABLE . ' + WHERE topic_id = ' . (int) $topic_id . ' + AND post_attachment = 1 + AND post_visibility = ' . ITEM_APPROVED . ' + AND ' . $this->db->sql_in_set('post_id', $post_id, true); + $result = $this->db->sql_query_limit($sql, 1); + + $has_attachment = (bool) $this->db->sql_fetchfield('has_attachments'); + $this->db->sql_freeresult($result); + + if ($has_attachment && $visibility == ITEM_APPROVED) + { + $topic_update_array[] = 'topic_attachment = 1'; + } + else if (!$has_attachment && $visibility != ITEM_APPROVED) + { + $topic_update_array[] = 'topic_attachment = 0'; + } + } + + if (!empty($topic_update_array)) + { + // Update the number for replies and posts, and update the attachments flag + $sql = 'UPDATE ' . $this->topics_table . ' + SET ' . implode(', ', $topic_update_array) . ' + WHERE topic_id = ' . (int) $topic_id; + $this->db->sql_query($sql); + } + /** + * Perform actions after all steps to changing post visibility + * + * @event core.set_post_visibility_after + * @var int visibility Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @var array post_id Array containing all post IDs to be modified. If blank, all posts within the topic are modified. + * @var int topic_id Topic of the post IDs to be modified. + * @var int forum_id Forum ID that the topic_id resides in. + * @var int user_id User ID doing this action. + * @var int time Timestamp of this action. + * @var string reason Reason specified by the user for this change. + * @var bool is_starter Are we changing the topic's starter? + * @var bool is_latest Are we changing the topic's latest post? + * @var array data The data array for this action. + * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp + */ + $vars = array( + 'visibility', + 'post_id', + 'topic_id', + 'forum_id', + 'user_id', + 'time', + 'reason', + 'is_starter', + 'is_latest', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.set_post_visibility_after', compact($vars))); + return $data; + } + + /** + * Set topic visibility + * + * Allows approving (which is akin to undeleting/restore) or soft deleting an entire topic. + * Calls set_post_visibility as needed. + * + * Note: By default, when a soft deleted topic is restored. Only posts that + * were approved at the time of soft deleting, are being restored. + * Same applies to soft deleting. Only approved posts will be marked + * as soft deleted. + * If you want to update all posts, use the force option. + * + * @param $visibility int Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @param $topic_id mixed Topic ID to act on + * @param $forum_id int Forum where $topic_id is found + * @param $user_id int User performing the action + * @param $time int Timestamp when the action is performed + * @param $reason string Reason why the visibilty was changed. + * @param $force_update_all bool Force to update all posts within the topic + * @return array Changed topic data, empty array if an error occured. + */ + public function set_topic_visibility($visibility, $topic_id, $forum_id, $user_id, $time, $reason, $force_update_all = false) + { + if (!in_array($visibility, array(ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE))) + { + return array(); + } + + if (!$force_update_all) + { + $sql = 'SELECT topic_visibility, topic_delete_time + FROM ' . $this->topics_table . ' + WHERE topic_id = ' . (int) $topic_id; + $result = $this->db->sql_query($sql); + $original_topic_data = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$original_topic_data) + { + // The topic does not exist... + return array(); + } + } + + if (!function_exists('truncate_string')) + { + include($this->phpbb_root_path . 'includes/functions_content.' . $this->php_ext); + } + + // Note, we do not set a reason for the posts, just for the topic + $data = array( + 'topic_visibility' => (int) $visibility, + 'topic_delete_user' => (int) $user_id, + 'topic_delete_time' => ((int) $time) ?: time(), + 'topic_delete_reason' => truncate_string($reason, 255, 255, false), + ); + /** + * Perform actions right before the query to change topic visibility + * + * @event core.set_topic_visibility_before_sql + * @var int visibility Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @var int topic_id Topic of the post IDs to be modified. + * @var int forum_id Forum ID that the topic_id resides in. + * @var int user_id User ID doing this action. + * @var int time Timestamp of this action. + * @var string reason Reason specified by the user for this change. + * @var bool force_update_all Force an update on all posts within the topic, regardless of their current approval state. + * @var array data The data array for this action. + * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp + */ + $vars = array( + 'visibility', + 'topic_id', + 'forum_id', + 'user_id', + 'time', + 'reason', + 'force_update_all', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.set_topic_visibility_before_sql', compact($vars))); + $sql = 'UPDATE ' . $this->topics_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $data) . ' + WHERE topic_id = ' . (int) $topic_id; + $this->db->sql_query($sql); + + if (!$this->db->sql_affectedrows()) + { + return array(); + } + + if (!$force_update_all && $original_topic_data['topic_delete_time'] && $original_topic_data['topic_visibility'] == ITEM_DELETED && $visibility == ITEM_APPROVED) + { + // If we're restoring a topic we only restore posts, that were soft deleted through the topic soft deletion. + $this->set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility'], $original_topic_data['topic_delete_time']); + } + else if (!$force_update_all && $original_topic_data['topic_visibility'] == ITEM_APPROVED && $visibility == ITEM_DELETED) + { + // If we're soft deleting a topic we only mark approved posts as soft deleted. + $this->set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true, $original_topic_data['topic_visibility']); + } + else + { + $this->set_post_visibility($visibility, false, $topic_id, $forum_id, $user_id, $time, '', true, true); + } + /** + * Perform actions after all steps to changing topic visibility + * + * @event core.set_topic_visibility_after + * @var int visibility Element of {ITEM_APPROVED, ITEM_DELETED, ITEM_REAPPROVE} + * @var int topic_id Topic of the post IDs to be modified. + * @var int forum_id Forum ID that the topic_id resides in. + * @var int user_id User ID doing this action. + * @var int time Timestamp of this action. + * @var string reason Reason specified by the user for this change. + * @var bool force_update_all Force an update on all posts within the topic, regardless of their current approval state. + * @var array data The data array for this action. + * @since 3.1.10-RC1 + * @changed 3.2.2-RC1 Use time instead of non-existent timestamp + */ + $vars = array( + 'visibility', + 'topic_id', + 'forum_id', + 'user_id', + 'time', + 'reason', + 'force_update_all', + 'data', + ); + extract($this->phpbb_dispatcher->trigger_event('core.set_topic_visibility_after', compact($vars))); + return $data; + } + + /** + * Add post to topic and forum statistics + * + * @param $data array Contains information from the topics table about given topic + * @param &$sql_data array Populated with the SQL changes, may be empty at call time + * @return null + */ + public function add_post_to_statistic($data, &$sql_data) + { + $sql_data[$this->topics_table] = (($sql_data[$this->topics_table]) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved + 1'; + + $sql_data[$this->forums_table] = (($sql_data[$this->forums_table]) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved + 1'; + + if ($data['post_postcount']) + { + $sql_data[$this->users_table] = (($sql_data[$this->users_table]) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts + 1'; + } + + $this->config->increment('num_posts', 1, false); + } + + /** + * Remove post from topic and forum statistics + * + * @param $data array Contains information from the topics table about given topic + * @param &$sql_data array Populated with the SQL changes, may be empty at call time + * @return null + */ + public function remove_post_from_statistic($data, &$sql_data) + { + if ($data['post_visibility'] == ITEM_APPROVED) + { + $sql_data[$this->topics_table] = ((!empty($sql_data[$this->topics_table])) ? $sql_data[$this->topics_table] . ', ' : '') . 'topic_posts_approved = topic_posts_approved - 1'; + $sql_data[$this->forums_table] = ((!empty($sql_data[$this->forums_table])) ? $sql_data[$this->forums_table] . ', ' : '') . 'forum_posts_approved = forum_posts_approved - 1'; + + if ($data['post_postcount']) + { + $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1'; + } + + $this->config->increment('num_posts', -1, false); + } + else if ($data['post_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE) + { + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_unapproved = forum_posts_unapproved - 1'; + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_unapproved = topic_posts_unapproved - 1'; + } + else if ($data['post_visibility'] == ITEM_DELETED) + { + $sql_data[FORUMS_TABLE] = (($sql_data[FORUMS_TABLE]) ? $sql_data[FORUMS_TABLE] . ', ' : '') . 'forum_posts_softdeleted = forum_posts_softdeleted - 1'; + $sql_data[TOPICS_TABLE] = (($sql_data[TOPICS_TABLE]) ? $sql_data[TOPICS_TABLE] . ', ' : '') . 'topic_posts_softdeleted = topic_posts_softdeleted - 1'; + } + } + + /** + * Remove topic from forum statistics + * + * @param $data array Post and topic data + * @param &$sql_data array Populated with the SQL changes, may be empty at call time + * @return null + */ + public function remove_topic_from_statistic($data, &$sql_data) + { + if ($data['topic_visibility'] == ITEM_APPROVED) + { + $sql_data[FORUMS_TABLE] .= 'forum_posts_approved = forum_posts_approved - 1, forum_topics_approved = forum_topics_approved - 1'; + + if ($data['post_postcount']) + { + $sql_data[$this->users_table] = ((!empty($sql_data[$this->users_table])) ? $sql_data[$this->users_table] . ', ' : '') . 'user_posts = user_posts - 1'; + } + } + else if ($data['topic_visibility'] == ITEM_UNAPPROVED || $data['post_visibility'] == ITEM_REAPPROVE) + { + $sql_data[FORUMS_TABLE] .= 'forum_posts_unapproved = forum_posts_unapproved - 1, forum_topics_unapproved = forum_topics_unapproved - 1'; + } + else if ($data['topic_visibility'] == ITEM_DELETED) + { + $sql_data[FORUMS_TABLE] .= 'forum_posts_softdeleted = forum_posts_softdeleted - 1, forum_topics_softdeleted = forum_topics_softdeleted - 1'; + } + + } +} diff --git a/install/update/old/phpbb/controller/helper.php b/install/update/old/phpbb/controller/helper.php new file mode 100644 index 0000000..664b4f4 --- /dev/null +++ b/install/update/old/phpbb/controller/helper.php @@ -0,0 +1,195 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\controller; + +use Symfony\Component\HttpFoundation\JsonResponse; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + +/** +* Controller helper class, contains methods that do things for controllers +*/ +class helper +{ + /** + * Template object + * @var \phpbb\template\template + */ + protected $template; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * config object + * @var \phpbb\config\config + */ + protected $config; + + /* @var \phpbb\symfony_request */ + protected $symfony_request; + + /* @var \phpbb\request\request_interface */ + protected $request; + + /** + * @var \phpbb\routing\helper + */ + protected $routing_helper; + + /** + * Constructor + * + * @param \phpbb\template\template $template Template object + * @param \phpbb\user $user User object + * @param \phpbb\config\config $config Config object + * @param \phpbb\symfony_request $symfony_request Symfony Request object + * @param \phpbb\request\request_interface $request phpBB request object + * @param \phpbb\routing\helper $routing_helper Helper to generate the routes + */ + public function __construct(\phpbb\template\template $template, \phpbb\user $user, \phpbb\config\config $config, \phpbb\symfony_request $symfony_request, \phpbb\request\request_interface $request, \phpbb\routing\helper $routing_helper) + { + $this->template = $template; + $this->user = $user; + $this->config = $config; + $this->symfony_request = $symfony_request; + $this->request = $request; + $this->routing_helper = $routing_helper; + } + + /** + * Automate setting up the page and creating the response object. + * + * @param string $template_file The template handle to render + * @param string $page_title The title of the page to output + * @param int $status_code The status code to be sent to the page header + * @param bool $display_online_list Do we display online users list + * @param int $item_id Restrict online users to item id + * @param string $item Restrict online users to a certain session item, e.g. forum for session_forum_id + * @param bool $send_headers Whether headers should be sent by page_header(). Defaults to false for controllers. + * + * @return Response object containing rendered page + */ + public function render($template_file, $page_title = '', $status_code = 200, $display_online_list = false, $item_id = 0, $item = 'forum', $send_headers = false) + { + page_header($page_title, $display_online_list, $item_id, $item, $send_headers); + + $this->template->set_filenames(array( + 'body' => $template_file, + )); + + page_footer(true, false, false); + + $headers = !empty($this->user->data['is_bot']) ? array('X-PHPBB-IS-BOT' => 'yes') : array(); + + return new Response($this->template->assign_display('body'), $status_code, $headers); + } + + /** + * Generate a URL to a route + * + * @param string $route Name of the route to travel + * @param array $params String or array of additional url parameters + * @param bool $is_amp Is url using & (true) or & (false) + * @param string|bool $session_id Possibility to use a custom session id instead of the global one + * @param bool|string $reference_type The type of reference to be generated (one of the constants) + * @return string The URL already passed through append_sid() + */ + public function route($route, array $params = array(), $is_amp = true, $session_id = false, $reference_type = UrlGeneratorInterface::ABSOLUTE_PATH) + { + return $this->routing_helper->route($route, $params, $is_amp, $session_id, $reference_type); + } + + /** + * Output an error, effectively the same thing as trigger_error + * + * @param string $message The error message + * @param int $code The error code (e.g. 404, 500, 503, etc.) + * @return Response A Response instance + * + * @deprecated 3.1.3 (To be removed: 3.3.0) Use exceptions instead. + */ + public function error($message, $code = 500) + { + return $this->message($message, array(), 'INFORMATION', $code); + } + + /** + * Output a message + * + * In case of an error, please throw an exception instead + * + * @param string $message The message to display (must be a language variable) + * @param array $parameters The parameters to use with the language var + * @param string $title Title for the message (must be a language variable) + * @param int $code The HTTP status code (e.g. 404, 500, 503, etc.) + * @return Response A Response instance + */ + public function message($message, array $parameters = array(), $title = 'INFORMATION', $code = 200) + { + array_unshift($parameters, $message); + $message_text = call_user_func_array(array($this->user, 'lang'), $parameters); + $message_title = $this->user->lang($title); + + if ($this->request->is_ajax()) + { + global $refresh_data; + + return new JsonResponse( + array( + 'MESSAGE_TITLE' => $message_title, + 'MESSAGE_TEXT' => $message_text, + 'S_USER_WARNING' => false, + 'S_USER_NOTICE' => false, + 'REFRESH_DATA' => (!empty($refresh_data)) ? $refresh_data : null + ), + $code + ); + } + + $this->template->assign_vars(array( + 'MESSAGE_TEXT' => $message_text, + 'MESSAGE_TITLE' => $message_title, + )); + + return $this->render('message_body.html', $message_title, $code); + } + + /** + * Assigns automatic refresh time meta tag in template + * + * @param int $time time in seconds, when redirection should occur + * @param string $url the URL where the user should be redirected + * @return null + */ + public function assign_meta_refresh_var($time, $url) + { + $this->template->assign_vars(array( + 'META' => '', + )); + } + + /** + * Return the current url + * + * @return string + */ + public function get_current_url() + { + return generate_board_url(true) . $this->request->escape($this->symfony_request->getRequestUri(), true); + } +} diff --git a/install/update/old/phpbb/cron/manager.php b/install/update/old/phpbb/cron/manager.php new file mode 100644 index 0000000..9bd30a0 --- /dev/null +++ b/install/update/old/phpbb/cron/manager.php @@ -0,0 +1,147 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\cron; + +/** +* Cron manager class. +* +* Finds installed cron tasks, stores task objects, provides task selection. +*/ +class manager +{ + /** + * Set of \phpbb\cron\task\wrapper objects. + * Array holding all tasks that have been found. + * + * @var array + */ + protected $tasks = array(); + + protected $phpbb_root_path; + protected $php_ext; + + /** + * Constructor. Loads all available tasks. + * + * @param array|\Traversable $tasks Provides an iterable set of task names + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension + */ + public function __construct($tasks, $phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->load_tasks($tasks); + } + + /** + * Loads tasks given by name, wraps them + * and puts them into $this->tasks. + * + * @param array|\Traversable $tasks Array of instances of \phpbb\cron\task\task + * + * @return null + */ + public function load_tasks($tasks) + { + foreach ($tasks as $task) + { + $this->tasks[] = $this->wrap_task($task); + } + } + + /** + * Finds a task that is ready to run. + * + * If several tasks are ready, any one of them could be returned. + * + * If no tasks are ready, null is returned. + * + * @return \phpbb\cron\task\wrapper|null + */ + public function find_one_ready_task() + { + shuffle($this->tasks); + foreach ($this->tasks as $task) + { + if ($task->is_ready()) + { + return $task; + } + } + return null; + } + + /** + * Finds all tasks that are ready to run. + * + * @return array List of tasks which are ready to run (wrapped in \phpbb\cron\task\wrapper). + */ + public function find_all_ready_tasks() + { + $tasks = array(); + foreach ($this->tasks as $task) + { + if ($task->is_ready()) + { + $tasks[] = $task; + } + } + return $tasks; + } + + /** + * Finds a task by name. + * + * If there is no task with the specified name, null is returned. + * + * Web runner uses this method to resolve names to tasks. + * + * @param string $name Name of the task to look up. + * @return \phpbb\cron\task\wrapper A wrapped task corresponding to the given name, or null. + */ + public function find_task($name) + { + foreach ($this->tasks as $task) + { + if ($task->get_name() == $name) + { + return $task; + } + } + return null; + } + + /** + * Find all tasks and return them. + * + * @return array List of all tasks. + */ + public function get_tasks() + { + return $this->tasks; + } + + /** + * Wraps a task inside an instance of \phpbb\cron\task\wrapper. + * + * @param \phpbb\cron\task\task $task The task. + * @return \phpbb\cron\task\wrapper The wrapped task. + */ + public function wrap_task(\phpbb\cron\task\task $task) + { + return new \phpbb\cron\task\wrapper($task, $this->phpbb_root_path, $this->php_ext); + } +} diff --git a/install/update/old/phpbb/cron/task/core/update_hashes.php b/install/update/old/phpbb/cron/task/core/update_hashes.php new file mode 100644 index 0000000..ba095ab --- /dev/null +++ b/install/update/old/phpbb/cron/task/core/update_hashes.php @@ -0,0 +1,130 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\cron\task\core; + +/** + * Update old hashes to the current default hashing algorithm + * + * It is intended to gradually update all "old" style hashes to the + * current default hashing algorithm. + */ +class update_hashes extends \phpbb\cron\task\base +{ + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\lock\db */ + protected $update_lock; + + /** @var \phpbb\passwords\manager */ + protected $passwords_manager; + + /** @var string Default hashing type */ + protected $default_type; + + /** + * Constructor. + * + * @param \phpbb\config\config $config + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\lock\db $update_lock + * @param \phpbb\passwords\manager $passwords_manager + * @param array $hashing_algorithms Hashing driver + * service collection + * @param array $defaults Default password types + */ + public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\lock\db $update_lock, \phpbb\passwords\manager $passwords_manager, $hashing_algorithms, $defaults) + { + $this->config = $config; + $this->db = $db; + $this->passwords_manager = $passwords_manager; + $this->update_lock = $update_lock; + + foreach ($defaults as $type) + { + if ($hashing_algorithms[$type]->is_supported()) + { + $this->default_type = $type; + break; + } + } + } + + /** + * {@inheritdoc} + */ + public function is_runnable() + { + return !$this->config['use_system_cron']; + } + + /** + * {@inheritdoc} + */ + public function should_run() + { + if (!empty($this->config['update_hashes_lock'])) + { + $last_run = explode(' ', $this->config['update_hashes_lock']); + if ($last_run[0] + 60 >= time()) + { + return false; + } + } + + return $this->config['enable_update_hashes'] && $this->config['update_hashes_last_cron'] < (time() - 60); + } + + /** + * {@inheritdoc} + */ + public function run() + { + if ($this->update_lock->acquire()) + { + $sql = 'SELECT user_id, user_password + FROM ' . USERS_TABLE . ' + WHERE user_password ' . $this->db->sql_like_expression('$H$' . $this->db->get_any_char()) . ' + OR user_password ' . $this->db->sql_like_expression('$CP$' . $this->db->get_any_char()); + $result = $this->db->sql_query_limit($sql, 20); + + $affected_rows = 0; + + while ($row = $this->db->sql_fetchrow($result)) + { + $new_hash = $this->passwords_manager->hash($row['user_password'], array($this->default_type)); + + // Increase number so we know that users were selected from the database + $affected_rows++; + + $sql = 'UPDATE ' . USERS_TABLE . " + SET user_password = '" . $this->db->sql_escape($new_hash) . "' + WHERE user_id = " . (int) $row['user_id']; + $this->db->sql_query($sql); + } + + $this->config->set('update_hashes_last_cron', time()); + $this->update_lock->release(); + + // Stop cron for good once all hashes are converted + if ($affected_rows === 0) + { + $this->config->set('enable_update_hashes', '0'); + } + } + } +} diff --git a/install/update/old/phpbb/cron/task/wrapper.php b/install/update/old/phpbb/cron/task/wrapper.php new file mode 100644 index 0000000..8a4a8b1 --- /dev/null +++ b/install/update/old/phpbb/cron/task/wrapper.php @@ -0,0 +1,106 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\cron\task; + +/** +* Cron task wrapper class. +* Enhances cron tasks with convenience methods that work identically for all tasks. +*/ +class wrapper +{ + protected $task; + protected $phpbb_root_path; + protected $php_ext; + + /** + * Constructor. + * + * Wraps a task $task, which must implement cron_task interface. + * + * @param \phpbb\cron\task\task $task The cron task to wrap. + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $php_ext PHP file extension + */ + public function __construct(\phpbb\cron\task\task $task, $phpbb_root_path, $php_ext) + { + $this->task = $task; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Returns whether the wrapped task is parametrised. + * + * Parametrized tasks accept parameters during initialization and must + * normally be scheduled with parameters. + * + * @return bool Whether or not this task is parametrized. + */ + public function is_parametrized() + { + return $this->task instanceof \phpbb\cron\task\parametrized; + } + + /** + * Returns whether the wrapped task is ready to run. + * + * A task is ready to run when it is runnable according to current configuration + * and enough time has passed since it was last run. + * + * @return bool Whether the wrapped task is ready to run. + */ + public function is_ready() + { + return $this->task->is_runnable() && $this->task->should_run(); + } + + /** + * Returns a url through which this task may be invoked via web. + * + * When system cron is not in use, running a cron task is accomplished + * by outputting an image with the url returned by this function as + * source. + * + * @return string URL through which this task may be invoked. + */ + public function get_url() + { + $name = $this->get_name(); + if ($this->is_parametrized()) + { + $params = $this->task->get_parameters(); + $extra = ''; + foreach ($params as $key => $value) + { + $extra .= '&' . $key . '=' . urlencode($value); + } + } + else + { + $extra = ''; + } + $url = append_sid($this->phpbb_root_path . 'cron.' . $this->php_ext, 'cron_type=' . $name . $extra); + return $url; + } + + /** + * Forwards all other method calls to the wrapped task implementation. + * + * @return mixed + */ + public function __call($name, $args) + { + return call_user_func_array(array($this->task, $name), $args); + } +} diff --git a/install/update/old/phpbb/db/driver/driver.php b/install/update/old/phpbb/db/driver/driver.php new file mode 100644 index 0000000..a36ce8c --- /dev/null +++ b/install/update/old/phpbb/db/driver/driver.php @@ -0,0 +1,1220 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* Database Abstraction Layer +*/ +abstract class driver implements driver_interface +{ + var $db_connect_id; + var $query_result; + var $return_on_error = false; + var $transaction = false; + var $sql_time = 0; + var $num_queries = array(); + var $open_queries = array(); + + var $curtime = 0; + var $query_hold = ''; + var $html_hold = ''; + var $sql_report = ''; + + var $persistency = false; + var $user = ''; + var $server = ''; + var $dbname = ''; + + // Set to true if error triggered + var $sql_error_triggered = false; + + // Holding the last sql query on sql error + var $sql_error_sql = ''; + // Holding the error information - only populated if sql_error_triggered is set + var $sql_error_returned = array(); + + // Holding transaction count + var $transactions = 0; + + // Supports multi inserts? + var $multi_insert = false; + + /** + * Current sql layer + */ + var $sql_layer = ''; + + /** + * Wildcards for matching any (%) or exactly one (_) character within LIKE expressions + */ + var $any_char; + var $one_char; + + /** + * Exact version of the DBAL, directly queried + */ + var $sql_server_version = false; + + const LOGICAL_OP = 0; + const STATEMENTS = 1; + const LEFT_STMT = 0; + const COMPARE_OP = 1; + const RIGHT_STMT = 2; + const SUBQUERY_OP = 3; + const SUBQUERY_SELECT_TYPE = 4; + const SUBQUERY_BUILD = 5; + + /** + * Constructor + */ + function __construct() + { + $this->num_queries = array( + 'cached' => 0, + 'normal' => 0, + 'total' => 0, + ); + + // Fill default sql layer based on the class being called. + // This can be changed by the specified layer itself later if needed. + $this->sql_layer = substr(get_class($this), strlen('phpbb\db\driver\\')); + + // Do not change this please! This variable is used to easy the use of it - and is hardcoded. + $this->any_char = chr(0) . '%'; + $this->one_char = chr(0) . '_'; + } + + /** + * {@inheritdoc} + */ + public function get_sql_layer() + { + return $this->sql_layer; + } + + /** + * {@inheritdoc} + */ + public function get_db_name() + { + return $this->dbname; + } + + /** + * {@inheritdoc} + */ + public function get_any_char() + { + return $this->any_char; + } + + /** + * {@inheritdoc} + */ + public function get_one_char() + { + return $this->one_char; + } + + /** + * {@inheritdoc} + */ + public function get_db_connect_id() + { + return $this->db_connect_id; + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_triggered() + { + return $this->sql_error_triggered; + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_sql() + { + return $this->sql_error_sql; + } + + /** + * {@inheritdoc} + */ + public function get_transaction() + { + return $this->transaction; + } + + /** + * {@inheritdoc} + */ + public function get_sql_time() + { + return $this->sql_time; + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_returned() + { + return $this->sql_error_returned; + } + + /** + * {@inheritdoc} + */ + public function get_multi_insert() + { + return $this->multi_insert; + } + + /** + * {@inheritdoc} + */ + public function set_multi_insert($multi_insert) + { + $this->multi_insert = $multi_insert; + } + + /** + * {@inheritDoc} + */ + function sql_return_on_error($fail = false) + { + $this->sql_error_triggered = false; + $this->sql_error_sql = ''; + + $this->return_on_error = $fail; + } + + /** + * {@inheritDoc} + */ + function sql_num_queries($cached = false) + { + return ($cached) ? $this->num_queries['cached'] : $this->num_queries['normal']; + } + + /** + * {@inheritDoc} + */ + function sql_add_num_queries($cached = false) + { + $this->num_queries['cached'] += ($cached !== false) ? 1 : 0; + $this->num_queries['normal'] += ($cached !== false) ? 0 : 1; + $this->num_queries['total'] += 1; + } + + /** + * {@inheritDoc} + */ + function sql_close() + { + if (!$this->db_connect_id) + { + return false; + } + + if ($this->transaction) + { + do + { + $this->sql_transaction('commit'); + } + while ($this->transaction); + } + + foreach ($this->open_queries as $query_id) + { + $this->sql_freeresult($query_id); + } + + // Connection closed correctly. Set db_connect_id to false to prevent errors + if ($result = $this->_sql_close()) + { + $this->db_connect_id = false; + } + + return $result; + } + + /** + * {@inheritDoc} + */ + function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + if (empty($query)) + { + return false; + } + + // Never use a negative total or offset + $total = ($total < 0) ? 0 : $total; + $offset = ($offset < 0) ? 0 : $offset; + + return $this->_sql_query_limit($query, $total, $offset, $cache_ttl); + } + + /** + * {@inheritDoc} + */ + function sql_fetchrowset($query_id = false) + { + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($query_id) + { + $result = array(); + while ($row = $this->sql_fetchrow($query_id)) + { + $result[] = $row; + } + + return $result; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_rowseek($rownum, &$query_id) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + if (!$query_id) + { + return false; + } + + $this->sql_freeresult($query_id); + $query_id = $this->sql_query($this->last_query_text); + + if (!$query_id) + { + return false; + } + + // We do not fetch the row for rownum == 0 because then the next resultset would be the second row + for ($i = 0; $i < $rownum; $i++) + { + if (!$this->sql_fetchrow($query_id)) + { + return false; + } + } + + return true; + } + + /** + * {@inheritDoc} + */ + function sql_fetchfield($field, $rownum = false, $query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($query_id) + { + if ($rownum !== false) + { + $this->sql_rowseek($rownum, $query_id); + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchfield($query_id, $field); + } + + $row = $this->sql_fetchrow($query_id); + return (isset($row[$field])) ? $row[$field] : false; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_like_expression($expression) + { + $expression = str_replace(array('_', '%'), array("\_", "\%"), $expression); + $expression = str_replace(array(chr(0) . "\_", chr(0) . "\%"), array('_', '%'), $expression); + + return $this->_sql_like_expression('LIKE \'' . $this->sql_escape($expression) . '\''); + } + + /** + * {@inheritDoc} + */ + function sql_not_like_expression($expression) + { + $expression = str_replace(array('_', '%'), array("\_", "\%"), $expression); + $expression = str_replace(array(chr(0) . "\_", chr(0) . "\%"), array('_', '%'), $expression); + + return $this->_sql_not_like_expression('NOT LIKE \'' . $this->sql_escape($expression) . '\''); + } + + /** + * {@inheritDoc} + */ + public function sql_case($condition, $action_true, $action_false = false) + { + $sql_case = 'CASE WHEN ' . $condition; + $sql_case .= ' THEN ' . $action_true; + $sql_case .= ($action_false !== false) ? ' ELSE ' . $action_false : ''; + $sql_case .= ' END'; + return $sql_case; + } + + /** + * {@inheritDoc} + */ + public function sql_concatenate($expr1, $expr2) + { + return $expr1 . ' || ' . $expr2; + } + + /** + * {@inheritDoc} + */ + function sql_buffer_nested_transactions() + { + return false; + } + + /** + * {@inheritDoc} + */ + function sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + // If we are within a transaction we will not open another one, but enclose the current one to not loose data (preventing auto commit) + if ($this->transaction) + { + $this->transactions++; + return true; + } + + $result = $this->_sql_transaction('begin'); + + if (!$result) + { + $this->sql_error(); + } + + $this->transaction = true; + break; + + case 'commit': + // If there was a previously opened transaction we do not commit yet... + // but count back the number of inner transactions + if ($this->transaction && $this->transactions) + { + $this->transactions--; + return true; + } + + // Check if there is a transaction (no transaction can happen if + // there was an error, with a combined rollback and error returning enabled) + // This implies we have transaction always set for autocommit db's + if (!$this->transaction) + { + return false; + } + + $result = $this->_sql_transaction('commit'); + + if (!$result) + { + $this->sql_error(); + } + + $this->transaction = false; + $this->transactions = 0; + break; + + case 'rollback': + $result = $this->_sql_transaction('rollback'); + $this->transaction = false; + $this->transactions = 0; + break; + + default: + $result = $this->_sql_transaction($status); + break; + } + + return $result; + } + + /** + * {@inheritDoc} + */ + function sql_build_array($query, $assoc_ary = false) + { + if (!is_array($assoc_ary)) + { + return false; + } + + $fields = $values = array(); + + if ($query == 'INSERT' || $query == 'INSERT_SELECT') + { + foreach ($assoc_ary as $key => $var) + { + $fields[] = $key; + + if (is_array($var) && is_string($var[0])) + { + // This is used for INSERT_SELECT(s) + $values[] = $var[0]; + } + else + { + $values[] = $this->_sql_validate_value($var); + } + } + + $query = ($query == 'INSERT') ? ' (' . implode(', ', $fields) . ') VALUES (' . implode(', ', $values) . ')' : ' (' . implode(', ', $fields) . ') SELECT ' . implode(', ', $values) . ' '; + } + else if ($query == 'MULTI_INSERT') + { + trigger_error('The MULTI_INSERT query value is no longer supported. Please use sql_multi_insert() instead.', E_USER_ERROR); + } + else if ($query == 'UPDATE' || $query == 'SELECT' || $query == 'DELETE') + { + $values = array(); + foreach ($assoc_ary as $key => $var) + { + $values[] = "$key = " . $this->_sql_validate_value($var); + } + $query = implode(($query == 'UPDATE') ? ', ' : ' AND ', $values); + } + + return $query; + } + + /** + * {@inheritDoc} + */ + function sql_in_set($field, $array, $negate = false, $allow_empty_set = false) + { + $array = (array) $array; + + if (!count($array)) + { + if (!$allow_empty_set) + { + // Print the backtrace to help identifying the location of the problematic code + $this->sql_error('No values specified for SQL IN comparison'); + } + else + { + // NOT IN () actually means everything so use a tautology + if ($negate) + { + return '1=1'; + } + // IN () actually means nothing so use a contradiction + else + { + return '1=0'; + } + } + } + + if (count($array) == 1) + { + @reset($array); + $var = current($array); + + return $field . ($negate ? ' <> ' : ' = ') . $this->_sql_validate_value($var); + } + else + { + return $field . ($negate ? ' NOT IN ' : ' IN ') . '(' . implode(', ', array_map(array($this, '_sql_validate_value'), $array)) . ')'; + } + } + + /** + * {@inheritDoc} + */ + function sql_bit_and($column_name, $bit, $compare = '') + { + if (method_exists($this, '_sql_bit_and')) + { + return $this->_sql_bit_and($column_name, $bit, $compare); + } + + return $column_name . ' & ' . (1 << $bit) . (($compare) ? ' ' . $compare : ''); + } + + /** + * {@inheritDoc} + */ + function sql_bit_or($column_name, $bit, $compare = '') + { + if (method_exists($this, '_sql_bit_or')) + { + return $this->_sql_bit_or($column_name, $bit, $compare); + } + + return $column_name . ' | ' . (1 << $bit) . (($compare) ? ' ' . $compare : ''); + } + + /** + * {@inheritDoc} + */ + function cast_expr_to_bigint($expression) + { + return $expression; + } + + /** + * {@inheritDoc} + */ + function cast_expr_to_string($expression) + { + return $expression; + } + + /** + * {@inheritDoc} + */ + function sql_lower_text($column_name) + { + return "LOWER($column_name)"; + } + + /** + * {@inheritDoc} + */ + function sql_multi_insert($table, $sql_ary) + { + if (!count($sql_ary)) + { + return false; + } + + if ($this->multi_insert) + { + $ary = array(); + foreach ($sql_ary as $id => $_sql_ary) + { + // If by accident the sql array is only one-dimensional we build a normal insert statement + if (!is_array($_sql_ary)) + { + return $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $sql_ary)); + } + + $values = array(); + foreach ($_sql_ary as $key => $var) + { + $values[] = $this->_sql_validate_value($var); + } + $ary[] = '(' . implode(', ', $values) . ')'; + } + + return $this->sql_query('INSERT INTO ' . $table . ' ' . ' (' . implode(', ', array_keys($sql_ary[0])) . ') VALUES ' . implode(', ', $ary)); + } + else + { + foreach ($sql_ary as $ary) + { + if (!is_array($ary)) + { + return false; + } + + $result = $this->sql_query('INSERT INTO ' . $table . ' ' . $this->sql_build_array('INSERT', $ary)); + + if (!$result) + { + return false; + } + } + } + + return true; + } + + /** + * Function for validating values + * @access private + */ + function _sql_validate_value($var) + { + if (is_null($var)) + { + return 'NULL'; + } + else if (is_string($var)) + { + return "'" . $this->sql_escape($var) . "'"; + } + else + { + return (is_bool($var)) ? intval($var) : $var; + } + } + + /** + * {@inheritDoc} + */ + function sql_build_query($query, $array) + { + $sql = ''; + switch ($query) + { + case 'SELECT': + case 'SELECT_DISTINCT'; + + $sql = str_replace('_', ' ', $query) . ' ' . $array['SELECT'] . ' FROM '; + + // Build table array. We also build an alias array for later checks. + $table_array = $aliases = array(); + $used_multi_alias = false; + + foreach ($array['FROM'] as $table_name => $alias) + { + if (is_array($alias)) + { + $used_multi_alias = true; + + foreach ($alias as $multi_alias) + { + $table_array[] = $table_name . ' ' . $multi_alias; + $aliases[] = $multi_alias; + } + } + else + { + $table_array[] = $table_name . ' ' . $alias; + $aliases[] = $alias; + } + } + + // We run the following code to determine if we need to re-order the table array. ;) + // The reason for this is that for multi-aliased tables (two equal tables) in the FROM statement the last table need to match the first comparison. + // DBMS who rely on this: Oracle, PostgreSQL and MSSQL. For all other DBMS it makes absolutely no difference in which order the table is. + if (!empty($array['LEFT_JOIN']) && count($array['FROM']) > 1 && $used_multi_alias !== false) + { + // Take first LEFT JOIN + $join = current($array['LEFT_JOIN']); + + // Determine the table used there (even if there are more than one used, we only want to have one + preg_match('/(' . implode('|', $aliases) . ')\.[^\s]+/U', str_replace(array('(', ')', 'AND', 'OR', ' '), '', $join['ON']), $matches); + + // If there is a first join match, we need to make sure the table order is correct + if (!empty($matches[1])) + { + $first_join_match = trim($matches[1]); + $table_array = $last = array(); + + foreach ($array['FROM'] as $table_name => $alias) + { + if (is_array($alias)) + { + foreach ($alias as $multi_alias) + { + ($multi_alias === $first_join_match) ? $last[] = $table_name . ' ' . $multi_alias : $table_array[] = $table_name . ' ' . $multi_alias; + } + } + else + { + ($alias === $first_join_match) ? $last[] = $table_name . ' ' . $alias : $table_array[] = $table_name . ' ' . $alias; + } + } + + $table_array = array_merge($table_array, $last); + } + } + + $sql .= $this->_sql_custom_build('FROM', implode(' CROSS JOIN ', $table_array)); + + if (!empty($array['LEFT_JOIN'])) + { + foreach ($array['LEFT_JOIN'] as $join) + { + $sql .= ' LEFT JOIN ' . key($join['FROM']) . ' ' . current($join['FROM']) . ' ON (' . $join['ON'] . ')'; + } + } + + if (!empty($array['WHERE'])) + { + $sql .= ' WHERE '; + + if (is_array($array['WHERE'])) + { + $sql_where = $this->_process_boolean_tree_first($array['WHERE']); + } + else + { + $sql_where = $array['WHERE']; + } + + $sql .= $this->_sql_custom_build('WHERE', $sql_where); + } + + if (!empty($array['GROUP_BY'])) + { + $sql .= ' GROUP BY ' . $array['GROUP_BY']; + } + + if (!empty($array['ORDER_BY'])) + { + $sql .= ' ORDER BY ' . $array['ORDER_BY']; + } + + break; + } + + return $sql; + } + + + protected function _process_boolean_tree_first($operations_ary) + { + // In cases where an array exists but there is no head condition, + // it should be because there's only 1 WHERE clause. This seems the best way to deal with it. + if ($operations_ary[self::LOGICAL_OP] !== 'AND' && + $operations_ary[self::LOGICAL_OP] !== 'OR') + { + $operations_ary = array('AND', array($operations_ary)); + } + return $this->_process_boolean_tree($operations_ary) . "\n"; + } + + protected function _process_boolean_tree($operations_ary) + { + $operation = $operations_ary[self::LOGICAL_OP]; + + foreach ($operations_ary[self::STATEMENTS] as &$condition) + { + switch ($condition[self::LOGICAL_OP]) + { + case 'AND': + case 'OR': + + $condition = ' ( ' . $this->_process_boolean_tree($condition) . ') '; + + break; + case 'NOT': + + $condition = ' NOT (' . $this->_process_boolean_tree($condition) . ') '; + + break; + + default: + + switch (count($condition)) + { + case 3: + + // Typical 3 element clause with {left hand} {operator} {right hand} + switch ($condition[self::COMPARE_OP]) + { + case 'IN': + case 'NOT_IN': + + // As this is used with an IN, assume it is a set of elements for sql_in_set() + $condition = $this->sql_in_set($condition[self::LEFT_STMT], $condition[self::RIGHT_STMT], $condition[self::COMPARE_OP] === 'NOT_IN', true); + + break; + + case 'LIKE': + + $condition = $condition[self::LEFT_STMT] . ' ' . $this->sql_like_expression($condition[self::RIGHT_STMT]) . ' '; + + break; + + case 'NOT_LIKE': + + $condition = $condition[self::LEFT_STMT] . ' ' . $this->sql_not_like_expression($condition[self::RIGHT_STMT]) . ' '; + + break; + + case 'IS_NOT': + + $condition[self::COMPARE_OP] = 'IS NOT'; + + // no break + case 'IS': + + // If the value is NULL, the string of it is the empty string ('') which is not the intended result. + // this should solve that + if ($condition[self::RIGHT_STMT] === null) + { + $condition[self::RIGHT_STMT] = 'NULL'; + } + + $condition = implode(' ', $condition); + + break; + + default: + + $condition = implode(' ', $condition); + + break; + } + + break; + + case 5: + + // Subquery with {left hand} {operator} {compare kind} {SELECT Kind } {Sub Query} + + $result = $condition[self::LEFT_STMT] . ' ' . $condition[self::COMPARE_OP] . ' ' . $condition[self::SUBQUERY_OP] . ' ( '; + $result .= $this->sql_build_query($condition[self::SUBQUERY_SELECT_TYPE], $condition[self::SUBQUERY_BUILD]); + $result .= ' )'; + $condition = $result; + + break; + + default: + // This is an unpredicted clause setup. Just join all elements. + $condition = implode(' ', $condition); + + break; + } + + break; + } + + } + + if ($operation === 'NOT') + { + $operations_ary = implode("", $operations_ary[self::STATEMENTS]); + } + else + { + $operations_ary = implode(" \n $operation ", $operations_ary[self::STATEMENTS]); + } + + return $operations_ary; + } + + + /** + * {@inheritDoc} + */ + function sql_error($sql = '') + { + global $auth, $user, $config; + + // Set var to retrieve errored status + $this->sql_error_triggered = true; + $this->sql_error_sql = $sql; + + $this->sql_error_returned = $this->_sql_error(); + + if (!$this->return_on_error) + { + $message = 'SQL ERROR [ ' . $this->sql_layer . ' ]

' . $this->sql_error_returned['message'] . ' [' . $this->sql_error_returned['code'] . ']'; + + // Show complete SQL error and path to administrators only + // Additionally show complete error on installation or if extended debug mode is enabled + // The DEBUG constant is for development only! + if ((isset($auth) && $auth->acl_get('a_')) || defined('IN_INSTALL') || defined('DEBUG')) + { + $message .= ($sql) ? '

SQL

' . htmlspecialchars($sql) : ''; + } + else + { + // If error occurs in initiating the session we need to use a pre-defined language string + // This could happen if the connection could not be established for example (then we are not able to grab the default language) + if (!isset($user->lang['SQL_ERROR_OCCURRED'])) + { + $message .= '

An sql error occurred while fetching this page. Please contact an administrator if this problem persists.'; + } + else + { + if (!empty($config['board_contact'])) + { + $message .= '

' . sprintf($user->lang['SQL_ERROR_OCCURRED'], '', ''); + } + else + { + $message .= '

' . sprintf($user->lang['SQL_ERROR_OCCURRED'], '', ''); + } + } + } + + if ($this->transaction) + { + $this->sql_transaction('rollback'); + } + + if (strlen($message) > 1024) + { + // We need to define $msg_long_text here to circumvent text stripping. + global $msg_long_text; + $msg_long_text = $message; + + trigger_error(false, E_USER_ERROR); + } + + trigger_error($message, E_USER_ERROR); + } + + if ($this->transaction) + { + $this->sql_transaction('rollback'); + } + + return $this->sql_error_returned; + } + + /** + * {@inheritDoc} + */ + function sql_report($mode, $query = '') + { + global $cache, $starttime, $phpbb_root_path, $phpbb_path_helper; + global $request; + + if (is_object($request) && !$request->variable('explain', false)) + { + return false; + } + + if (!$query && $this->query_hold != '') + { + $query = $this->query_hold; + } + + switch ($mode) + { + case 'display': + if (!empty($cache)) + { + $cache->unload(); + } + $this->sql_close(); + + $mtime = explode(' ', microtime()); + $totaltime = $mtime[0] + $mtime[1] - $starttime; + + echo ' + + + + + SQL Report + + + +
+ +
+
+
+ +
+

SQL Report

+
+

Page generated in ' . round($totaltime, 4) . " seconds with {$this->num_queries['normal']} queries" . (($this->num_queries['cached']) ? " + {$this->num_queries['cached']} " . (($this->num_queries['cached'] == 1) ? 'query' : 'queries') . ' returning data from cache' : '') . '

+ +

Time spent on ' . $this->sql_layer . ' queries: ' . round($this->sql_time, 5) . 's | Time spent on PHP: ' . round($totaltime - $this->sql_time, 5) . 's

+ +

+ ' . $this->sql_report . ' +
+ +
+
+
+ +
+ + '; + + exit_handler(); + + break; + + case 'stop': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $this->sql_report .= ' + + + + + + + + + + + + +
Query #' . $this->num_queries['total'] . '
+ + ' . $this->html_hold . ' + +

+ '; + + if ($this->query_result) + { + if (preg_match('/^(UPDATE|DELETE|REPLACE)/', $query)) + { + $this->sql_report .= 'Affected rows: ' . $this->sql_affectedrows() . ' | '; + } + $this->sql_report .= 'Before: ' . sprintf('%.5f', $this->curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed: ' . sprintf('%.5f', $endtime - $this->curtime) . 's'; + } + else + { + $error = $this->sql_error(); + $this->sql_report .= 'FAILED - ' . $this->sql_layer . ' Error ' . $error['code'] . ': ' . htmlspecialchars($error['message']); + } + + $this->sql_report .= '



'; + + $this->sql_time += $endtime - $this->curtime; + break; + + case 'start': + $this->query_hold = $query; + $this->html_hold = ''; + + $this->_sql_report($mode, $query); + + $this->curtime = explode(' ', microtime()); + $this->curtime = $this->curtime[0] + $this->curtime[1]; + + break; + + case 'add_select_row': + + $html_table = func_get_arg(2); + $row = func_get_arg(3); + + if (!$html_table && count($row)) + { + $html_table = true; + $this->html_hold .= ''; + + foreach (array_keys($row) as $val) + { + $this->html_hold .= ''; + } + $this->html_hold .= ''; + } + $this->html_hold .= ''; + + $class = 'row1'; + foreach (array_values($row) as $val) + { + $class = ($class == 'row1') ? 'row2' : 'row1'; + $this->html_hold .= ''; + } + $this->html_hold .= ''; + + return $html_table; + + break; + + case 'fromcache': + + $this->_sql_report($mode, $query); + + break; + + case 'record_fromcache': + + $endtime = func_get_arg(2); + $splittime = func_get_arg(3); + + $time_cache = $endtime - $this->curtime; + $time_db = $splittime - $endtime; + $color = ($time_db > $time_cache) ? 'green' : 'red'; + + $this->sql_report .= '
' . (($val) ? ucwords(str_replace('_', ' ', $val)) : ' ') . '
' . (($val) ? $val : ' ') . '
'; + $this->sql_report .= '
Query results obtained from the cache
'; + $this->sql_report .= '

'; + $this->sql_report .= 'Before: ' . sprintf('%.5f', $this->curtime - $starttime) . 's | After: ' . sprintf('%.5f', $endtime - $starttime) . 's | Elapsed [cache]: ' . sprintf('%.5f', ($time_cache)) . 's | Elapsed [db]: ' . sprintf('%.5f', $time_db) . 's



'; + + // Pad the start time to not interfere with page timing + $starttime += $time_db; + + break; + + default: + + $this->_sql_report($mode, $query); + + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + function get_estimated_row_count($table_name) + { + return $this->get_row_count($table_name); + } + + /** + * {@inheritDoc} + */ + function get_row_count($table_name) + { + $sql = 'SELECT COUNT(*) AS rows_total + FROM ' . $this->sql_escape($table_name); + $result = $this->sql_query($sql); + $rows_total = $this->sql_fetchfield('rows_total'); + $this->sql_freeresult($result); + + return $rows_total; + } +} diff --git a/install/update/old/phpbb/db/driver/driver_interface.php b/install/update/old/phpbb/db/driver/driver_interface.php new file mode 100644 index 0000000..8b487c5 --- /dev/null +++ b/install/update/old/phpbb/db/driver/driver_interface.php @@ -0,0 +1,453 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +interface driver_interface +{ + /** + * Gets the name of the sql layer. + * + * @return string + */ + public function get_sql_layer(); + + /** + * Gets the name of the database. + * + * @return string + */ + public function get_db_name(); + + /** + * Wildcards for matching any (%) character within LIKE expressions + * + * @return string + */ + public function get_any_char(); + + /** + * Wildcards for matching exactly one (_) character within LIKE expressions + * + * @return string + */ + public function get_one_char(); + + /** + * Gets the time spent into the queries + * + * @return int + */ + public function get_sql_time(); + + /** + * Gets the connect ID. + * + * @return mixed + */ + public function get_db_connect_id(); + + /** + * Indicates if an error was triggered. + * + * @return bool + */ + public function get_sql_error_triggered(); + + /** + * Gets the last faulty query + * + * @return string + */ + public function get_sql_error_sql(); + + /** + * Indicates if we are in a transaction. + * + * @return bool + */ + public function get_transaction(); + + /** + * Gets the returned error. + * + * @return array + */ + public function get_sql_error_returned(); + + /** + * Indicates if multiple insertion can be used + * + * @return bool + */ + public function get_multi_insert(); + + /** + * Set if multiple insertion can be used + * + * @param bool $multi_insert + */ + public function set_multi_insert($multi_insert); + + /** + * Gets the exact number of rows in a specified table. + * + * @param string $table_name Table name + * @return string Exact number of rows in $table_name. + */ + public function get_row_count($table_name); + + /** + * Gets the estimated number of rows in a specified table. + * + * @param string $table_name Table name + * @return string Number of rows in $table_name. + * Prefixed with ~ if estimated (otherwise exact). + */ + public function get_estimated_row_count($table_name); + + /** + * Run LOWER() on DB column of type text (i.e. neither varchar nor char). + * + * @param string $column_name The column name to use + * @return string A SQL statement like "LOWER($column_name)" + */ + public function sql_lower_text($column_name); + + /** + * Display sql error page + * + * @param string $sql The SQL query causing the error + * @return mixed Returns the full error message, if $this->return_on_error + * is set, null otherwise + */ + public function sql_error($sql = ''); + + /** + * Returns whether results of a query need to be buffered to run a + * transaction while iterating over them. + * + * @return bool Whether buffering is required. + */ + public function sql_buffer_nested_transactions(); + + /** + * Run binary OR operator on DB column. + * + * @param string $column_name The column name to use + * @param int $bit The value to use for the OR operator, + * will be converted to (1 << $bit). Is used by options, + * using the number schema... 0, 1, 2...29 + * @param string $compare Any custom SQL code after the check (e.g. "= 0") + * @return string A SQL statement like "$column | (1 << $bit) {$compare}" + */ + public function sql_bit_or($column_name, $bit, $compare = ''); + + /** + * Version information about used database + * + * @param bool $raw Only return the fetched sql_server_version + * @param bool $use_cache Is it safe to retrieve the value from the cache + * @return string sql server version + */ + public function sql_server_info($raw = false, $use_cache = true); + + /** + * Return on error or display error message + * + * @param bool $fail Should we return on errors, or stop + * @return null + */ + public function sql_return_on_error($fail = false); + + /** + * Build sql statement from an array + * + * @param string $query Should be on of the following strings: + * INSERT, INSERT_SELECT, UPDATE, SELECT, DELETE + * @param array $assoc_ary Array with "column => value" pairs + * @return string A SQL statement like "c1 = 'a' AND c2 = 'b'" + */ + public function sql_build_array($query, $assoc_ary = array()); + + /** + * Fetch all rows + * + * @param mixed $query_id Already executed query to get the rows from, + * if false, the last query will be used. + * @return mixed Nested array if the query had rows, false otherwise + */ + public function sql_fetchrowset($query_id = false); + + /** + * SQL Transaction + * + * @param string $status Should be one of the following strings: + * begin, commit, rollback + * @return mixed Buffered, seekable result handle, false on error + */ + public function sql_transaction($status = 'begin'); + + /** + * Build a concatenated expression + * + * @param string $expr1 Base SQL expression where we append the second one + * @param string $expr2 SQL expression that is appended to the first expression + * @return string Concatenated string + */ + public function sql_concatenate($expr1, $expr2); + + /** + * Build a case expression + * + * Note: The two statements action_true and action_false must have the same + * data type (int, vchar, ...) in the database! + * + * @param string $condition The condition which must be true, + * to use action_true rather then action_else + * @param string $action_true SQL expression that is used, if the condition is true + * @param mixed $action_false SQL expression that is used, if the condition is false + * @return string CASE expression including the condition and statements + */ + public function sql_case($condition, $action_true, $action_false = false); + + /** + * Build sql statement from array for select and select distinct statements + * + * Possible query values: SELECT, SELECT_DISTINCT + * + * @param string $query Should be one of: SELECT, SELECT_DISTINCT + * @param array $array Array with the query data: + * SELECT A comma imploded list of columns to select + * FROM Array with "table => alias" pairs, + * (alias can also be an array) + * Optional: LEFT_JOIN Array of join entries: + * FROM Table that should be joined + * ON Condition for the join + * Optional: WHERE Where SQL statement + * Optional: GROUP_BY Group by SQL statement + * Optional: ORDER_BY Order by SQL statement + * @return string A SQL statement ready for execution + */ + public function sql_build_query($query, $array); + + /** + * Fetch field + * if rownum is false, the current row is used, else it is pointing to the row (zero-based) + * + * @param string $field Name of the column + * @param mixed $rownum Row number, if false the current row will be used + * and the row curser will point to the next row + * Note: $rownum is 0 based + * @param mixed $query_id Already executed query to get the rows from, + * if false, the last query will be used. + * @return mixed String value of the field in the selected row, + * false, if the row does not exist + */ + public function sql_fetchfield($field, $rownum = false, $query_id = false); + + /** + * Fetch current row + * + * @param mixed $query_id Already executed query to get the rows from, + * if false, the last query will be used. + * @return mixed Array with the current row, + * false, if the row does not exist + */ + public function sql_fetchrow($query_id = false); + + /** + * Returns SQL string to cast a string expression to an int. + * + * @param string $expression An expression evaluating to string + * @return string Expression returning an int + */ + public function cast_expr_to_bigint($expression); + + /** + * Get last inserted id after insert statement + * + * @return string Autoincrement value of the last inserted row + */ + public function sql_nextid(); + + /** + * Add to query count + * + * @param bool $cached Is this query cached? + * @return null + */ + public function sql_add_num_queries($cached = false); + + /** + * Build LIMIT query + * + * @param string $query The SQL query to execute + * @param int $total The number of rows to select + * @param int $offset + * @param int $cache_ttl Either 0 to avoid caching or + * the time in seconds which the result shall be kept in cache + * @return mixed Buffered, seekable result handle, false on error + */ + public function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0); + + /** + * Base query method + * + * @param string $query The SQL query to execute + * @param int $cache_ttl Either 0 to avoid caching or + * the time in seconds which the result shall be kept in cache + * @return mixed Buffered, seekable result handle, false on error + */ + public function sql_query($query = '', $cache_ttl = 0); + + /** + * Returns SQL string to cast an integer expression to a string. + * + * @param string $expression An expression evaluating to int + * @return string Expression returning a string + */ + public function cast_expr_to_string($expression); + + /** + * Connect to server + * + * @param string $sqlserver Address of the database server + * @param string $sqluser User name of the SQL user + * @param string $sqlpassword Password of the SQL user + * @param string $database Name of the database + * @param mixed $port Port of the database server + * @param bool $persistency + * @param bool $new_link Should a new connection be established + * @return mixed Connection ID on success, string error message otherwise + */ + public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false); + + /** + * Run binary AND operator on DB column. + * Results in sql statement: "{$column_name} & (1 << {$bit}) {$compare}" + * + * @param string $column_name The column name to use + * @param int $bit The value to use for the AND operator, + * will be converted to (1 << $bit). Is used by + * options, using the number schema: 0, 1, 2...29 + * @param string $compare Any custom SQL code after the check (for example "= 0") + * @return string A SQL statement like: "{$column} & (1 << {$bit}) {$compare}" + */ + public function sql_bit_and($column_name, $bit, $compare = ''); + + /** + * Free sql result + * + * @param mixed $query_id Already executed query result, + * if false, the last query will be used. + * @return null + */ + public function sql_freeresult($query_id = false); + + /** + * Return number of sql queries and cached sql queries used + * + * @param bool $cached Should we return the number of cached or normal queries? + * @return int Number of queries that have been executed + */ + public function sql_num_queries($cached = false); + + /** + * Run more than one insert statement. + * + * @param string $table Table name to run the statements on + * @param array $sql_ary Multi-dimensional array holding the statement data + * @return bool false if no statements were executed. + */ + public function sql_multi_insert($table, $sql_ary); + + /** + * Return number of affected rows + * + * @return mixed Number of the affected rows by the last query + * false if no query has been run before + */ + public function sql_affectedrows(); + + /** + * DBAL garbage collection, close SQL connection + * + * @return mixed False if no connection was opened before, + * Server response otherwise + */ + public function sql_close(); + + /** + * Seek to given row number + * + * @param mixed $rownum Row number the curser should point to + * Note: $rownum is 0 based + * @param mixed $query_id ID of the query to set the row cursor on + * if false, the last query will be used. + * $query_id will then be set correctly + * @return bool False if something went wrong + */ + public function sql_rowseek($rownum, &$query_id); + + /** + * Escape string used in sql query + * + * @param string $msg String to be escaped + * @return string Escaped version of $msg + */ + public function sql_escape($msg); + + /** + * Correctly adjust LIKE expression for special characters + * Some DBMS are handling them in a different way + * + * @param string $expression The expression to use. Every wildcard is + * escaped, except $this->any_char and $this->one_char + * @return string A SQL statement like: "LIKE 'bertie_%'" + */ + public function sql_like_expression($expression); + + /** + * Correctly adjust NOT LIKE expression for special characters + * Some DBMS are handling them in a different way + * + * @param string $expression The expression to use. Every wildcard is + * escaped, except $this->any_char and $this->one_char + * @return string A SQL statement like: "NOT LIKE 'bertie_%'" + */ + public function sql_not_like_expression($expression); + + /** + * Explain queries + * + * @param string $mode Available modes: display, start, stop, + * add_select_row, fromcache, record_fromcache + * @param string $query The Query that should be explained + * @return mixed Either a full HTML page, boolean or null + */ + public function sql_report($mode, $query = ''); + + /** + * Build IN or NOT IN sql comparison string, uses <> or = on single element + * arrays to improve comparison speed + * + * @param string $field Name of the sql column that shall be compared + * @param array $array Array of values that are (not) allowed + * @param bool $negate true for NOT IN (), false for IN () + * @param bool $allow_empty_set If true, allow $array to be empty, + * this function will return 1=1 or 1=0 then. + * @return string A SQL statement like: "IN (1, 2, 3, 4)" or "= 1" + */ + public function sql_in_set($field, $array, $negate = false, $allow_empty_set = false); +} diff --git a/install/update/old/phpbb/db/driver/factory.php b/install/update/old/phpbb/db/driver/factory.php new file mode 100644 index 0000000..fb3a826 --- /dev/null +++ b/install/update/old/phpbb/db/driver/factory.php @@ -0,0 +1,443 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +use \Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* Database Abstraction Layer +*/ +class factory implements driver_interface +{ + /** + * @var driver_interface + */ + protected $driver = null; + + /** + * @var ContainerInterface + */ + protected $container; + + /** + * Constructor. + * + * @param ContainerInterface $container A ContainerInterface instance + */ + public function __construct(ContainerInterface $container) + { + $this->container = $container; + } + + /** + * Return the current driver (and retrieved it from the container if necessary) + * + * @return driver_interface + */ + protected function get_driver() + { + if ($this->driver === null) + { + $this->driver = $this->container->get('dbal.conn.driver'); + } + + return $this->driver; + } + + /** + * Set the current driver + * + * @param driver_interface $driver + */ + public function set_driver(driver_interface $driver) + { + $this->driver = $driver; + } + + /** + * {@inheritdoc} + */ + public function get_sql_layer() + { + return $this->get_driver()->get_sql_layer(); + } + + /** + * {@inheritdoc} + */ + public function get_db_name() + { + return $this->get_driver()->get_db_name(); + } + + /** + * {@inheritdoc} + */ + public function get_any_char() + { + return $this->get_driver()->get_any_char(); + } + + /** + * {@inheritdoc} + */ + public function get_one_char() + { + return $this->get_driver()->get_one_char(); + } + + /** + * {@inheritdoc} + */ + public function get_db_connect_id() + { + return $this->get_driver()->get_db_connect_id(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_triggered() + { + return $this->get_driver()->get_sql_error_triggered(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_sql() + { + return $this->get_driver()->get_sql_error_sql(); + } + + /** + * {@inheritdoc} + */ + public function get_transaction() + { + return $this->get_driver()->get_transaction(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_time() + { + return $this->get_driver()->get_sql_time(); + } + + /** + * {@inheritdoc} + */ + public function get_sql_error_returned() + { + return $this->get_driver()->get_sql_error_returned(); + } + + /** + * {@inheritdoc} + */ + public function get_multi_insert() + { + return $this->get_driver()->get_multi_insert(); + } + + /** + * {@inheritdoc} + */ + public function set_multi_insert($multi_insert) + { + $this->get_driver()->set_multi_insert($multi_insert); + } + + /** + * {@inheritdoc} + */ + public function get_row_count($table_name) + { + return $this->get_driver()->get_row_count($table_name); + } + + /** + * {@inheritdoc} + */ + public function get_estimated_row_count($table_name) + { + return $this->get_driver()->get_estimated_row_count($table_name); + } + + /** + * {@inheritdoc} + */ + public function sql_lower_text($column_name) + { + return $this->get_driver()->sql_lower_text($column_name); + } + + /** + * {@inheritdoc} + */ + public function sql_error($sql = '') + { + return $this->get_driver()->sql_error($sql); + } + + /** + * {@inheritdoc} + */ + public function sql_buffer_nested_transactions() + { + return $this->get_driver()->sql_buffer_nested_transactions(); + } + + /** + * {@inheritdoc} + */ + public function sql_bit_or($column_name, $bit, $compare = '') + { + return $this->get_driver()->sql_bit_or($column_name, $bit, $compare); + } + + /** + * {@inheritdoc} + */ + public function sql_server_info($raw = false, $use_cache = true) + { + return $this->get_driver()->sql_server_info($raw, $use_cache); + } + + /** + * {@inheritdoc} + */ + public function sql_return_on_error($fail = false) + { + return $this->get_driver()->sql_return_on_error($fail); + } + + /** + * {@inheritdoc} + */ + public function sql_build_array($query, $assoc_ary = array()) + { + return $this->get_driver()->sql_build_array($query, $assoc_ary); + } + + /** + * {@inheritdoc} + */ + public function sql_fetchrowset($query_id = false) + { + return $this->get_driver()->sql_fetchrowset($query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_transaction($status = 'begin') + { + return $this->get_driver()->sql_transaction($status); + } + + /** + * {@inheritdoc} + */ + public function sql_concatenate($expr1, $expr2) + { + return $this->get_driver()->sql_concatenate($expr1, $expr2); + } + + /** + * {@inheritdoc} + */ + public function sql_case($condition, $action_true, $action_false = false) + { + return $this->get_driver()->sql_case($condition, $action_true, $action_false); + } + + /** + * {@inheritdoc} + */ + public function sql_build_query($query, $array) + { + return $this->get_driver()->sql_build_query($query, $array); + } + + /** + * {@inheritdoc} + */ + public function sql_fetchfield($field, $rownum = false, $query_id = false) + { + return $this->get_driver()->sql_fetchfield($field, $rownum, $query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_fetchrow($query_id = false) + { + return $this->get_driver()->sql_fetchrow($query_id); + } + + /** + * {@inheritdoc} + */ + public function cast_expr_to_bigint($expression) + { + return $this->get_driver()->cast_expr_to_bigint($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_nextid() + { + return $this->get_driver()->sql_nextid(); + } + + /** + * {@inheritdoc} + */ + public function sql_add_num_queries($cached = false) + { + return $this->get_driver()->sql_add_num_queries($cached); + } + + /** + * {@inheritdoc} + */ + public function sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + return $this->get_driver()->sql_query_limit($query, $total, $offset, $cache_ttl); + } + + /** + * {@inheritdoc} + */ + public function sql_query($query = '', $cache_ttl = 0) + { + return $this->get_driver()->sql_query($query, $cache_ttl); + } + + /** + * {@inheritdoc} + */ + public function cast_expr_to_string($expression) + { + return $this->get_driver()->cast_expr_to_string($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + throw new \Exception('Disabled method.'); + } + + /** + * {@inheritdoc} + */ + public function sql_bit_and($column_name, $bit, $compare = '') + { + return $this->get_driver()->sql_bit_and($column_name, $bit, $compare); + } + + /** + * {@inheritdoc} + */ + public function sql_freeresult($query_id = false) + { + return $this->get_driver()->sql_freeresult($query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_num_queries($cached = false) + { + return $this->get_driver()->sql_num_queries($cached); + } + + /** + * {@inheritdoc} + */ + public function sql_multi_insert($table, $sql_ary) + { + return $this->get_driver()->sql_multi_insert($table, $sql_ary); + } + + /** + * {@inheritdoc} + */ + public function sql_affectedrows() + { + return $this->get_driver()->sql_affectedrows(); + } + + /** + * {@inheritdoc} + */ + public function sql_close() + { + return $this->get_driver()->sql_close(); + } + + /** + * {@inheritdoc} + */ + public function sql_rowseek($rownum, &$query_id) + { + return $this->get_driver()->sql_rowseek($rownum, $query_id); + } + + /** + * {@inheritdoc} + */ + public function sql_escape($msg) + { + return $this->get_driver()->sql_escape($msg); + } + + /** + * {@inheritdoc} + */ + public function sql_like_expression($expression) + { + return $this->get_driver()->sql_like_expression($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_not_like_expression($expression) + { + return $this->get_driver()->sql_not_like_expression($expression); + } + + /** + * {@inheritdoc} + */ + public function sql_report($mode, $query = '') + { + return $this->get_driver()->sql_report($mode, $query); + } + + /** + * {@inheritdoc} + */ + public function sql_in_set($field, $array, $negate = false, $allow_empty_set = false) + { + return $this->get_driver()->sql_in_set($field, $array, $negate, $allow_empty_set); + } +} diff --git a/install/update/old/phpbb/db/driver/mssql_odbc.php b/install/update/old/phpbb/db/driver/mssql_odbc.php new file mode 100644 index 0000000..9d9ad60 --- /dev/null +++ b/install/update/old/phpbb/db/driver/mssql_odbc.php @@ -0,0 +1,385 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* Unified ODBC functions +* Unified ODBC functions support any database having ODBC driver, for example Adabas D, IBM DB2, iODBC, Solid, Sybase SQL Anywhere... +* Here we only support MSSQL Server 2000+ because of the provided schema +* +* @note number of bytes returned for returning data depends on odbc.defaultlrl php.ini setting. +* If it is limited to 4K for example only 4K of data is returned max, resulting in incomplete theme data for example. +* @note odbc.defaultbinmode may affect UTF8 characters +*/ +class mssql_odbc extends \phpbb\db\driver\mssql_base +{ + var $last_query_text = ''; + var $connect_error = ''; + + /** + * {@inheritDoc} + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + $this->persistency = $persistency; + $this->user = $sqluser; + $this->dbname = $database; + + $port_delimiter = (defined('PHP_OS') && substr(PHP_OS, 0, 3) === 'WIN') ? ',' : ':'; + $this->server = $sqlserver . (($port) ? $port_delimiter . $port : ''); + + $max_size = @ini_get('odbc.defaultlrl'); + if (!empty($max_size)) + { + $unit = strtolower(substr($max_size, -1, 1)); + $max_size = (int) $max_size; + + if ($unit == 'k') + { + $max_size = floor($max_size / 1024); + } + else if ($unit == 'g') + { + $max_size *= 1024; + } + else if (is_numeric($unit)) + { + $max_size = floor((int) ($max_size . $unit) / 1048576); + } + $max_size = max(8, $max_size) . 'M'; + + @ini_set('odbc.defaultlrl', $max_size); + } + + if ($this->persistency) + { + if (!function_exists('odbc_pconnect')) + { + $this->connect_error = 'odbc_pconnect function does not exist, is odbc extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @odbc_pconnect($this->server, $this->user, $sqlpassword); + } + else + { + if (!function_exists('odbc_connect')) + { + $this->connect_error = 'odbc_connect function does not exist, is odbc extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @odbc_connect($this->server, $this->user, $sqlpassword); + } + + return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); + } + + /** + * {@inheritDoc} + */ + function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mssqlodbc_version')) === false) + { + $result_id = @odbc_exec($this->db_connect_id, "SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('productlevel'), SERVERPROPERTY('edition')"); + + $row = false; + if ($result_id) + { + $row = odbc_fetch_array($result_id); + odbc_free_result($result_id); + } + + $this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0; + + if (!empty($cache) && $use_cache) + { + $cache->put('mssqlodbc_version', $this->sql_server_version); + } + } + + if ($raw) + { + return $this->sql_server_version; + } + + return ($this->sql_server_version) ? 'MSSQL (ODBC)
' . $this->sql_server_version : 'MSSQL (ODBC)'; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return @odbc_exec($this->db_connect_id, 'BEGIN TRANSACTION'); + break; + + case 'commit': + return @odbc_exec($this->db_connect_id, 'COMMIT TRANSACTION'); + break; + + case 'rollback': + return @odbc_exec($this->db_connect_id, 'ROLLBACK TRANSACTION'); + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + // EXPLAIN only in extra debug mode + if (defined('DEBUG')) + { + $this->sql_report('start', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if (($this->query_result = @odbc_exec($this->db_connect_id, $query)) === false) + { + $this->sql_error($query); + } + + if (defined('DEBUG')) + { + $this->sql_report('stop', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if (defined('DEBUG')) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * Build LIMIT query + */ + function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + // Since TOP is only returning a set number of rows we won't need it if total is set to 0 (return all rows) + if ($total) + { + // We need to grab the total number of rows + the offset number of rows to get the correct result + if (strpos($query, 'SELECT DISTINCT') === 0) + { + $query = 'SELECT DISTINCT TOP ' . ($total + $offset) . ' ' . substr($query, 15); + } + else + { + $query = 'SELECT TOP ' . ($total + $offset) . ' ' . substr($query, 6); + } + } + + $result = $this->sql_query($query, $cache_ttl); + + // Seek by $offset rows + if ($offset) + { + $this->sql_rowseek($offset, $result); + } + + return $result; + } + + /** + * {@inheritDoc} + */ + function sql_affectedrows() + { + return ($this->db_connect_id) ? @odbc_num_rows($this->query_result) : false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + return ($query_id) ? odbc_fetch_array($query_id) : false; + } + + /** + * {@inheritDoc} + */ + function sql_nextid() + { + $result_id = @odbc_exec($this->db_connect_id, 'SELECT @@IDENTITY'); + + if ($result_id) + { + if (odbc_fetch_array($result_id)) + { + $id = odbc_result($result_id, 1); + odbc_free_result($result_id); + return $id; + } + odbc_free_result($result_id); + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[(int) $query_id])) + { + unset($this->open_queries[(int) $query_id]); + return odbc_free_result($query_id); + } + + return false; + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + if (function_exists('odbc_errormsg')) + { + $error = array( + 'message' => @odbc_errormsg(), + 'code' => @odbc_error(), + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @odbc_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @odbc_exec($this->db_connect_id, $query); + if ($result) + { + while ($void = odbc_fetch_array($result)) + { + // Take the time spent on parsing rows into account + } + odbc_free_result($result); + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/install/update/old/phpbb/db/driver/mssqlnative.php b/install/update/old/phpbb/db/driver/mssqlnative.php new file mode 100644 index 0000000..a4dcac5 --- /dev/null +++ b/install/update/old/phpbb/db/driver/mssqlnative.php @@ -0,0 +1,451 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* This is the MS SQL Server Native database abstraction layer. +* PHP mssql native driver required. +* @author Chris Pucci +* +*/ + +namespace phpbb\db\driver; + +class mssqlnative extends \phpbb\db\driver\mssql_base +{ + var $m_insert_id = null; + var $last_query_text = ''; + var $query_options = array(); + var $connect_error = ''; + + /** + * {@inheritDoc} + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + // Test for driver support, to avoid suppressed fatal error + if (!function_exists('sqlsrv_connect')) + { + $this->connect_error = 'Native MS SQL Server driver for PHP is missing or needs to be updated. Version 1.1 or later is required to install phpBB3. You can download the driver from: http://www.microsoft.com/sqlserver/2005/en/us/PHP-Driver.aspx'; + return $this->sql_error(''); + } + + //set up connection variables + $this->persistency = $persistency; + $this->user = $sqluser; + $this->dbname = $database; + $port_delimiter = (defined('PHP_OS') && substr(PHP_OS, 0, 3) === 'WIN') ? ',' : ':'; + $this->server = $sqlserver . (($port) ? $port_delimiter . $port : ''); + + //connect to database + $this->db_connect_id = sqlsrv_connect($this->server, array( + 'Database' => $this->dbname, + 'UID' => $this->user, + 'PWD' => $sqlpassword, + 'CharacterSet' => 'UTF-8' + )); + + return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); + } + + /** + * {@inheritDoc} + */ + function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) + { + $arr_server_info = sqlsrv_server_info($this->db_connect_id); + $this->sql_server_version = $arr_server_info['SQLServerVersion']; + + if (!empty($cache) && $use_cache) + { + $cache->put('mssql_version', $this->sql_server_version); + } + } + + if ($raw) + { + return $this->sql_server_version; + } + + return ($this->sql_server_version) ? 'MSSQL
' . $this->sql_server_version : 'MSSQL'; + } + + /** + * {@inheritDoc} + */ + function sql_buffer_nested_transactions() + { + return true; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return sqlsrv_begin_transaction($this->db_connect_id); + break; + + case 'commit': + return sqlsrv_commit($this->db_connect_id); + break; + + case 'rollback': + return sqlsrv_rollback($this->db_connect_id); + break; + } + return true; + } + + /** + * {@inheritDoc} + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + // EXPLAIN only in extra debug mode + if (defined('DEBUG')) + { + $this->sql_report('start', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if (($this->query_result = @sqlsrv_query($this->db_connect_id, $query, array(), $this->query_options)) === false) + { + $this->sql_error($query); + } + // reset options for next query + $this->query_options = array(); + + if (defined('DEBUG')) + { + $this->sql_report('stop', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if (defined('DEBUG')) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + return $this->query_result; + } + + /** + * Build LIMIT query + */ + function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + // total == 0 means all results - not zero results + if ($offset == 0 && $total !== 0) + { + if (strpos($query, "SELECT") === false) + { + $query = "TOP {$total} " . $query; + } + else + { + $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP '.$total, $query); + } + } + else if ($offset > 0) + { + $query = preg_replace('/SELECT(\s*DISTINCT)?/Dsi', 'SELECT$1 TOP(10000000) ', $query); + $query = 'SELECT * + FROM (SELECT sub2.*, ROW_NUMBER() OVER(ORDER BY sub2.line2) AS line3 + FROM (SELECT 1 AS line2, sub1.* FROM (' . $query . ') AS sub1) as sub2) AS sub3'; + + if ($total > 0) + { + $query .= ' WHERE line3 BETWEEN ' . ($offset+1) . ' AND ' . ($offset + $total); + } + else + { + $query .= ' WHERE line3 > ' . $offset; + } + } + + $result = $this->sql_query($query, $cache_ttl); + + return $result; + } + + /** + * {@inheritDoc} + */ + function sql_affectedrows() + { + return ($this->db_connect_id) ? @sqlsrv_rows_affected($this->query_result) : false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + if (!$query_id) + { + return false; + } + + $row = sqlsrv_fetch_array($query_id, SQLSRV_FETCH_ASSOC); + + if ($row) + { + foreach ($row as $key => $value) + { + $row[$key] = ($value === ' ' || $value === null) ? '' : $value; + } + + // remove helper values from LIMIT queries + if (isset($row['line2'])) + { + unset($row['line2'], $row['line3']); + } + } + return ($row !== null) ? $row : false; + } + + /** + * {@inheritDoc} + */ + function sql_nextid() + { + $result_id = @sqlsrv_query($this->db_connect_id, 'SELECT @@IDENTITY'); + + if ($result_id) + { + $row = sqlsrv_fetch_array($result_id); + $id = $row[0]; + sqlsrv_free_stmt($result_id); + return $id; + } + else + { + return false; + } + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[(int) $query_id])) + { + unset($this->open_queries[(int) $query_id]); + return sqlsrv_free_stmt($query_id); + } + + return false; + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + if (function_exists('sqlsrv_errors')) + { + $errors = @sqlsrv_errors(SQLSRV_ERR_ERRORS); + $error_message = ''; + $code = 0; + + if ($errors != null) + { + foreach ($errors as $error) + { + $error_message .= "SQLSTATE: " . $error['SQLSTATE'] . "\n"; + $error_message .= "code: " . $error['code'] . "\n"; + $code = $error['code']; + $error_message .= "message: " . $error['message'] . "\n"; + } + $this->last_error_result = $error_message; + $error = $this->last_error_result; + } + else + { + $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); + } + + $error = array( + 'message' => $error, + 'code' => $code, + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @sqlsrv_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + $html_table = false; + @sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT ON;'); + if ($result = @sqlsrv_query($this->db_connect_id, $query)) + { + sqlsrv_next_result($result); + while ($row = sqlsrv_fetch_array($result)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + sqlsrv_free_stmt($result); + } + @sqlsrv_query($this->db_connect_id, 'SET SHOWPLAN_TEXT OFF;'); + + if ($html_table) + { + $this->html_hold .= ''; + } + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @sqlsrv_query($this->db_connect_id, $query); + if ($result) + { + while ($void = sqlsrv_fetch_array($result)) + { + // Take the time spent on parsing rows into account + } + sqlsrv_free_stmt($result); + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } + + /** + * Utility method used to retrieve number of rows + * Emulates mysql_num_rows + * Used in acp_database.php -> write_data_mssqlnative() + * Requires a static or keyset cursor to be definde via + * mssqlnative_set_query_options() + */ + function mssqlnative_num_rows($res) + { + if ($res !== false) + { + return sqlsrv_num_rows($res); + } + else + { + return false; + } + } + + /** + * Allows setting mssqlnative specific query options passed to sqlsrv_query as 4th parameter. + */ + function mssqlnative_set_query_options($options) + { + $this->query_options = $options; + } +} diff --git a/install/update/old/phpbb/db/driver/mysqli.php b/install/update/old/phpbb/db/driver/mysqli.php new file mode 100644 index 0000000..d43e201 --- /dev/null +++ b/install/update/old/phpbb/db/driver/mysqli.php @@ -0,0 +1,490 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* MySQLi Database Abstraction Layer +* mysqli-extension has to be compiled with: +* MySQL 4.1+ or MySQL 5.0+ +*/ +class mysqli extends \phpbb\db\driver\mysql_base +{ + var $multi_insert = true; + var $connect_error = ''; + + /** + * {@inheritDoc} + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + if (!function_exists('mysqli_connect')) + { + $this->connect_error = 'mysqli_connect function does not exist, is mysqli extension installed?'; + return $this->sql_error(''); + } + + $this->persistency = $persistency; + $this->user = $sqluser; + + // If persistent connection, set dbhost to localhost when empty and prepend it with 'p:' prefix + $this->server = ($this->persistency) ? 'p:' . (($sqlserver) ? $sqlserver : 'localhost') : $sqlserver; + + $this->dbname = $database; + $port = (!$port) ? null : $port; + + // If port is set and it is not numeric, most likely mysqli socket is set. + // Try to map it to the $socket parameter. + $socket = null; + if ($port) + { + if (is_numeric($port)) + { + $port = (int) $port; + } + else + { + $socket = $port; + $port = null; + } + } + + $this->db_connect_id = mysqli_init(); + + if (!@mysqli_real_connect($this->db_connect_id, $this->server, $this->user, $sqlpassword, $this->dbname, $port, $socket, MYSQLI_CLIENT_FOUND_ROWS)) + { + $this->db_connect_id = ''; + } + + if ($this->db_connect_id && $this->dbname != '') + { + @mysqli_query($this->db_connect_id, "SET NAMES 'utf8'"); + + // enforce strict mode on databases that support it + if (version_compare($this->sql_server_info(true), '5.0.2', '>=')) + { + $result = @mysqli_query($this->db_connect_id, 'SELECT @@session.sql_mode AS sql_mode'); + if ($result) + { + $row = mysqli_fetch_assoc($result); + mysqli_free_result($result); + + $modes = array_map('trim', explode(',', $row['sql_mode'])); + } + else + { + $modes = array(); + } + + // TRADITIONAL includes STRICT_ALL_TABLES and STRICT_TRANS_TABLES + if (!in_array('TRADITIONAL', $modes)) + { + if (!in_array('STRICT_ALL_TABLES', $modes)) + { + $modes[] = 'STRICT_ALL_TABLES'; + } + + if (!in_array('STRICT_TRANS_TABLES', $modes)) + { + $modes[] = 'STRICT_TRANS_TABLES'; + } + } + + $mode = implode(',', $modes); + @mysqli_query($this->db_connect_id, "SET SESSION sql_mode='{$mode}'"); + } + return $this->db_connect_id; + } + + return $this->sql_error(''); + } + + /** + * {@inheritDoc} + */ + function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mysqli_version')) === false) + { + $result = @mysqli_query($this->db_connect_id, 'SELECT VERSION() AS version'); + if ($result) + { + $row = mysqli_fetch_assoc($result); + mysqli_free_result($result); + + $this->sql_server_version = $row['version']; + + if (!empty($cache) && $use_cache) + { + $cache->put('mysqli_version', $this->sql_server_version); + } + } + } + + return ($raw) ? $this->sql_server_version : 'MySQL(i) ' . $this->sql_server_version; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return @mysqli_autocommit($this->db_connect_id, false); + break; + + case 'commit': + $result = @mysqli_commit($this->db_connect_id); + @mysqli_autocommit($this->db_connect_id, true); + return $result; + break; + + case 'rollback': + $result = @mysqli_rollback($this->db_connect_id); + @mysqli_autocommit($this->db_connect_id, true); + return $result; + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + // EXPLAIN only in extra debug mode + if (defined('DEBUG')) + { + $this->sql_report('start', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } + + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if (($this->query_result = @mysqli_query($this->db_connect_id, $query)) === false) + { + $this->sql_error($query); + } + + if (defined('DEBUG')) + { + $this->sql_report('stop', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + } + else if (defined('DEBUG')) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * {@inheritDoc} + */ + function sql_affectedrows() + { + return ($this->db_connect_id) ? @mysqli_affected_rows($this->db_connect_id) : false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + if ($query_id) + { + $result = mysqli_fetch_assoc($query_id); + return $result !== null ? $result : false; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_rowseek($rownum, &$query_id) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + return ($query_id) ? @mysqli_data_seek($query_id, $rownum) : false; + } + + /** + * {@inheritDoc} + */ + function sql_nextid() + { + return ($this->db_connect_id) ? @mysqli_insert_id($this->db_connect_id) : false; + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if (!$query_id) + { + return false; + } + + if ($query_id === true) + { + return true; + } + + return mysqli_free_result($query_id); + } + + /** + * {@inheritDoc} + */ + function sql_escape($msg) + { + return @mysqli_real_escape_string($this->db_connect_id, $msg); + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + if ($this->db_connect_id) + { + $error = array( + 'message' => @mysqli_error($this->db_connect_id), + 'code' => @mysqli_errno($this->db_connect_id) + ); + } + else if (function_exists('mysqli_connect_error')) + { + $error = array( + 'message' => @mysqli_connect_error(), + 'code' => @mysqli_connect_errno(), + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @mysqli_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + static $test_prof; + + // current detection method, might just switch to see the existance of INFORMATION_SCHEMA.PROFILING + if ($test_prof === null) + { + $test_prof = false; + if (strpos(mysqli_get_server_info($this->db_connect_id), 'community') !== false) + { + $ver = mysqli_get_server_version($this->db_connect_id); + if ($ver >= 50037 && $ver < 50100) + { + $test_prof = true; + } + } + } + + switch ($mode) + { + case 'start': + + $explain_query = $query; + if (preg_match('/UPDATE ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + else if (preg_match('/DELETE FROM ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + + if (preg_match('/^SELECT/', $explain_query)) + { + $html_table = false; + + // begin profiling + if ($test_prof) + { + @mysqli_query($this->db_connect_id, 'SET profiling = 1;'); + } + + if ($result = @mysqli_query($this->db_connect_id, "EXPLAIN $explain_query")) + { + while ($row = mysqli_fetch_assoc($result)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + mysqli_free_result($result); + } + + if ($html_table) + { + $this->html_hold .= ''; + } + + if ($test_prof) + { + $html_table = false; + + // get the last profile + if ($result = @mysqli_query($this->db_connect_id, 'SHOW PROFILE ALL;')) + { + $this->html_hold .= '
'; + while ($row = mysqli_fetch_assoc($result)) + { + // make HTML safe + if (!empty($row['Source_function'])) + { + $row['Source_function'] = str_replace(array('<', '>'), array('<', '>'), $row['Source_function']); + } + + // remove unsupported features + foreach ($row as $key => $val) + { + if ($val === null) + { + unset($row[$key]); + } + } + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + mysqli_free_result($result); + } + + if ($html_table) + { + $this->html_hold .= ''; + } + + @mysqli_query($this->db_connect_id, 'SET profiling = 0;'); + } + } + + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @mysqli_query($this->db_connect_id, $query); + if ($result) + { + while ($void = mysqli_fetch_assoc($result)) + { + // Take the time spent on parsing rows into account + } + mysqli_free_result($result); + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/install/update/old/phpbb/db/driver/oracle.php b/install/update/old/phpbb/db/driver/oracle.php new file mode 100644 index 0000000..5fd1470 --- /dev/null +++ b/install/update/old/phpbb/db/driver/oracle.php @@ -0,0 +1,822 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* Oracle Database Abstraction Layer +*/ +class oracle extends \phpbb\db\driver\driver +{ + var $last_query_text = ''; + var $connect_error = ''; + + /** + * {@inheritDoc} + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + $this->persistency = $persistency; + $this->user = $sqluser; + $this->server = $sqlserver . (($port) ? ':' . $port : ''); + $this->dbname = $database; + + $connect = $database; + + // support for "easy connect naming" + if ($sqlserver !== '' && $sqlserver !== '/') + { + if (substr($sqlserver, -1, 1) == '/') + { + $sqlserver == substr($sqlserver, 0, -1); + } + $connect = $sqlserver . (($port) ? ':' . $port : '') . '/' . $database; + } + + if ($new_link) + { + if (!function_exists('ocinlogon')) + { + $this->connect_error = 'ocinlogon function does not exist, is oci extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @ocinlogon($this->user, $sqlpassword, $connect, 'UTF8'); + } + else if ($this->persistency) + { + if (!function_exists('ociplogon')) + { + $this->connect_error = 'ociplogon function does not exist, is oci extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @ociplogon($this->user, $sqlpassword, $connect, 'UTF8'); + } + else + { + if (!function_exists('ocilogon')) + { + $this->connect_error = 'ocilogon function does not exist, is oci extension installed?'; + return $this->sql_error(''); + } + $this->db_connect_id = @ocilogon($this->user, $sqlpassword, $connect, 'UTF8'); + } + + return ($this->db_connect_id) ? $this->db_connect_id : $this->sql_error(''); + } + + /** + * {@inheritDoc} + */ + function sql_server_info($raw = false, $use_cache = true) + { + /** + * force $use_cache false. I didn't research why the caching code below is commented out + * but I assume its because the Oracle extension provides a direct method to access it + * without a query. + */ +/* + global $cache; + + if (empty($cache) || ($this->sql_server_version = $cache->get('oracle_version')) === false) + { + $result = @ociparse($this->db_connect_id, 'SELECT * FROM v$version WHERE banner LIKE \'Oracle%\''); + @ociexecute($result, OCI_DEFAULT); + @ocicommit($this->db_connect_id); + + $row = array(); + @ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS); + @ocifreestatement($result); + $this->sql_server_version = trim($row['BANNER']); + + $cache->put('oracle_version', $this->sql_server_version); + } +*/ + $this->sql_server_version = @ociserverversion($this->db_connect_id); + + return $this->sql_server_version; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return true; + break; + + case 'commit': + return @ocicommit($this->db_connect_id); + break; + + case 'rollback': + return @ocirollback($this->db_connect_id); + break; + } + + return true; + } + + /** + * Oracle specific code to handle the fact that it does not compare columns properly + * @access private + */ + function _rewrite_col_compare($args) + { + if (count($args) == 4) + { + if ($args[2] == '=') + { + return '(' . $args[0] . ' OR (' . $args[1] . ' is NULL AND ' . $args[3] . ' is NULL))'; + } + else if ($args[2] == '<>') + { + // really just a fancy way of saying foo <> bar or (foo is NULL XOR bar is NULL) but SQL has no XOR :P + return '(' . $args[0] . ' OR ((' . $args[1] . ' is NULL AND ' . $args[3] . ' is NOT NULL) OR (' . $args[1] . ' is NOT NULL AND ' . $args[3] . ' is NULL)))'; + } + } + else + { + return $this->_rewrite_where($args[0]); + } + } + + /** + * Oracle specific code to handle it's lack of sanity + * @access private + */ + function _rewrite_where($where_clause) + { + preg_match_all('/\s*(AND|OR)?\s*([\w_.()]++)\s*(?:(=|<[=>]?|>=?|LIKE)\s*((?>\'(?>[^\']++|\'\')*+\'|[\d-.()]+))|((NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]+,? ?)*+\)))/', $where_clause, $result, PREG_SET_ORDER); + $out = ''; + foreach ($result as $val) + { + if (!isset($val[5])) + { + if ($val[4] !== "''") + { + $out .= $val[0]; + } + else + { + $out .= ' ' . $val[1] . ' ' . $val[2]; + if ($val[3] == '=') + { + $out .= ' is NULL'; + } + else if ($val[3] == '<>') + { + $out .= ' is NOT NULL'; + } + } + } + else + { + $in_clause = array(); + $sub_exp = substr($val[5], strpos($val[5], '(') + 1, -1); + $extra = false; + preg_match_all('/\'(?>[^\']++|\'\')*+\'|[\d-.]++/', $sub_exp, $sub_vals, PREG_PATTERN_ORDER); + $i = 0; + foreach ($sub_vals[0] as $sub_val) + { + // two things: + // 1) This determines if an empty string was in the IN clausing, making us turn it into a NULL comparison + // 2) This fixes the 1000 list limit that Oracle has (ORA-01795) + if ($sub_val !== "''") + { + $in_clause[(int) $i++/1000][] = $sub_val; + } + else + { + $extra = true; + } + } + if (!$extra && $i < 1000) + { + $out .= $val[0]; + } + else + { + $out .= ' ' . $val[1] . '('; + $in_array = array(); + + // constuct each IN() clause + foreach ($in_clause as $in_values) + { + $in_array[] = $val[2] . ' ' . (isset($val[6]) ? $val[6] : '') . 'IN(' . implode(', ', $in_values) . ')'; + } + + // Join the IN() clauses against a few ORs (IN is just a nicer OR anyway) + $out .= implode(' OR ', $in_array); + + // handle the empty string case + if ($extra) + { + $out .= ' OR ' . $val[2] . ' is ' . (isset($val[6]) ? $val[6] : '') . 'NULL'; + } + $out .= ')'; + + unset($in_array, $in_clause); + } + } + } + + return $out; + } + + /** + * {@inheritDoc} + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + // EXPLAIN only in extra debug mode + if (defined('DEBUG')) + { + $this->sql_report('start', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + $in_transaction = false; + if (!$this->transaction) + { + $this->sql_transaction('begin'); + } + else + { + $in_transaction = true; + } + + $array = array(); + + // We overcome Oracle's 4000 char limit by binding vars + if (strlen($query) > 4000) + { + if (preg_match('/^(INSERT INTO[^(]++)\\(([^()]+)\\) VALUES[^(]++\\((.*?)\\)$/sU', $query, $regs)) + { + if (strlen($regs[3]) > 4000) + { + $cols = explode(', ', $regs[2]); + + preg_match_all('/\'(?:[^\']++|\'\')*+\'|[\d-.]+/', $regs[3], $vals, PREG_PATTERN_ORDER); + +/* The code inside this comment block breaks clob handling, but does allow the + database restore script to work. If you want to allow no posts longer than 4KB + and/or need the db restore script, uncomment this. + + + if (count($cols) !== count($vals)) + { + // Try to replace some common data we know is from our restore script or from other sources + $regs[3] = str_replace("'||chr(47)||'", '/', $regs[3]); + $_vals = explode(', ', $regs[3]); + + $vals = array(); + $is_in_val = false; + $i = 0; + $string = ''; + + foreach ($_vals as $value) + { + if (strpos($value, "'") === false && !$is_in_val) + { + $vals[$i++] = $value; + continue; + } + + if (substr($value, -1) === "'") + { + $vals[$i] = $string . (($is_in_val) ? ', ' : '') . $value; + $string = ''; + $is_in_val = false; + + if ($vals[$i][0] !== "'") + { + $vals[$i] = "''" . $vals[$i]; + } + $i++; + continue; + } + else + { + $string .= (($is_in_val) ? ', ' : '') . $value; + $is_in_val = true; + } + } + + if ($string) + { + // New value if cols != value + $vals[(count($cols) !== count($vals)) ? $i : $i - 1] .= $string; + } + + $vals = array(0 => $vals); + } +*/ + + $inserts = $vals[0]; + unset($vals); + + foreach ($inserts as $key => $value) + { + if (!empty($value) && $value[0] === "'" && strlen($value) > 4002) // check to see if this thing is greater than the max + 'x2 + { + $inserts[$key] = ':' . strtoupper($cols[$key]); + $array[$inserts[$key]] = str_replace("''", "'", substr($value, 1, -1)); + } + } + + $query = $regs[1] . '(' . $regs[2] . ') VALUES (' . implode(', ', $inserts) . ')'; + } + } + else if (preg_match_all('/^(UPDATE [\\w_]++\\s+SET )([\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+)(?:,\\s*[\\w_]++\\s*=\\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]+))*+)\\s+(WHERE.*)$/s', $query, $data, PREG_SET_ORDER)) + { + if (strlen($data[0][2]) > 4000) + { + $update = $data[0][1]; + $where = $data[0][3]; + preg_match_all('/([\\w_]++)\\s*=\\s*(\'(?:[^\']++|\'\')*+\'|[\d-.]++)/', $data[0][2], $temp, PREG_SET_ORDER); + unset($data); + + $cols = array(); + foreach ($temp as $value) + { + if (!empty($value[2]) && $value[2][0] === "'" && strlen($value[2]) > 4002) // check to see if this thing is greater than the max + 'x2 + { + $cols[] = $value[1] . '=:' . strtoupper($value[1]); + $array[$value[1]] = str_replace("''", "'", substr($value[2], 1, -1)); + } + else + { + $cols[] = $value[1] . '=' . $value[2]; + } + } + + $query = $update . implode(', ', $cols) . ' ' . $where; + unset($cols); + } + } + } + + switch (substr($query, 0, 6)) + { + case 'DELETE': + if (preg_match('/^(DELETE FROM [\w_]++ WHERE)((?:\s*(?:AND|OR)?\s*[\w_]+\s*(?:(?:=|<>)\s*(?>\'(?>[^\']++|\'\')*+\'|[\d-.]+)|(?:NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]+,? ?)*+\)))*+)$/', $query, $regs)) + { + $query = $regs[1] . $this->_rewrite_where($regs[2]); + unset($regs); + } + break; + + case 'UPDATE': + if (preg_match('/^(UPDATE [\\w_]++\\s+SET [\\w_]+\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]++|:\w++)(?:, [\\w_]+\s*=\s*(?:\'(?:[^\']++|\'\')*+\'|[\d-.]++|:\w++))*+\\s+WHERE)(.*)$/s', $query, $regs)) + { + $query = $regs[1] . $this->_rewrite_where($regs[2]); + unset($regs); + } + break; + + case 'SELECT': + $query = preg_replace_callback('/([\w_.]++)\s*(?:(=|<>)\s*(?>\'(?>[^\']++|\'\')*+\'|[\d-.]++|([\w_.]++))|(?:NOT )?IN\s*\((?>\'(?>[^\']++|\'\')*+\',? ?|[\d-.]++,? ?)*+\))/', array($this, '_rewrite_col_compare'), $query); + break; + } + + $this->query_result = @ociparse($this->db_connect_id, $query); + + foreach ($array as $key => $value) + { + @ocibindbyname($this->query_result, $key, $array[$key], -1); + } + + $success = @ociexecute($this->query_result, OCI_DEFAULT); + + if (!$success) + { + $this->sql_error($query); + $this->query_result = false; + } + else + { + if (!$in_transaction) + { + $this->sql_transaction('commit'); + } + } + + if (defined('DEBUG')) + { + $this->sql_report('stop', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if (defined('DEBUG')) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * Build LIMIT query + */ + function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + $query = 'SELECT * FROM (SELECT /*+ FIRST_ROWS */ rownum AS xrownum, a.* FROM (' . $query . ') a WHERE rownum <= ' . ($offset + $total) . ') WHERE xrownum >= ' . $offset; + + return $this->sql_query($query, $cache_ttl); + } + + /** + * {@inheritDoc} + */ + function sql_affectedrows() + { + return ($this->query_result) ? @ocirowcount($this->query_result) : false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + if ($query_id) + { + $row = array(); + $result = ocifetchinto($query_id, $row, OCI_ASSOC + OCI_RETURN_NULLS); + + if (!$result || !$row) + { + return false; + } + + $result_row = array(); + foreach ($row as $key => $value) + { + // Oracle treats empty strings as null + if (is_null($value)) + { + $value = ''; + } + + // OCI->CLOB? + if (is_object($value)) + { + $value = $value->load(); + } + + $result_row[strtolower($key)] = $value; + } + + return $result_row; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_rowseek($rownum, &$query_id) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + if (!$query_id) + { + return false; + } + + // Reset internal pointer + @ociexecute($query_id, OCI_DEFAULT); + + // We do not fetch the row for rownum == 0 because then the next resultset would be the second row + for ($i = 0; $i < $rownum; $i++) + { + if (!$this->sql_fetchrow($query_id)) + { + return false; + } + } + + return true; + } + + /** + * {@inheritDoc} + */ + function sql_nextid() + { + $query_id = $this->query_result; + + if ($query_id !== false && $this->last_query_text != '') + { + if (preg_match('#^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)#is', $this->last_query_text, $tablename)) + { + $query = 'SELECT ' . $tablename[1] . '_seq.currval FROM DUAL'; + $stmt = @ociparse($this->db_connect_id, $query); + if ($stmt) + { + $success = @ociexecute($stmt, OCI_DEFAULT); + + if ($success) + { + $temp_result = ocifetchinto($stmt, $temp_array, OCI_ASSOC + OCI_RETURN_NULLS); + ocifreestatement($stmt); + + if ($temp_result) + { + return $temp_array['CURRVAL']; + } + else + { + return false; + } + } + } + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[(int) $query_id])) + { + unset($this->open_queries[(int) $query_id]); + return ocifreestatement($query_id); + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_escape($msg) + { + return str_replace(array("'", "\0"), array("''", ''), $msg); + } + + /** + * Build LIKE expression + * @access private + */ + function _sql_like_expression($expression) + { + return $expression . " ESCAPE '\\'"; + } + + /** + * Build NOT LIKE expression + * @access private + */ + function _sql_not_like_expression($expression) + { + return $expression . " ESCAPE '\\'"; + } + + function _sql_custom_build($stage, $data) + { + return $data; + } + + function _sql_bit_and($column_name, $bit, $compare = '') + { + return 'BITAND(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); + } + + function _sql_bit_or($column_name, $bit, $compare = '') + { + return 'BITOR(' . $column_name . ', ' . (1 << $bit) . ')' . (($compare) ? ' ' . $compare : ''); + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + if (function_exists('ocierror')) + { + $error = @ocierror(); + $error = (!$error) ? @ocierror($this->query_result) : $error; + $error = (!$error) ? @ocierror($this->db_connect_id) : $error; + + if ($error) + { + $this->last_error_result = $error; + } + else + { + $error = (isset($this->last_error_result) && $this->last_error_result) ? $this->last_error_result : array(); + } + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @ocilogoff($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + + $html_table = false; + + // Grab a plan table, any will do + $sql = "SELECT table_name + FROM USER_TABLES + WHERE table_name LIKE '%PLAN_TABLE%'"; + $stmt = ociparse($this->db_connect_id, $sql); + ociexecute($stmt); + $result = array(); + + if (ocifetchinto($stmt, $result, OCI_ASSOC + OCI_RETURN_NULLS)) + { + $table = $result['TABLE_NAME']; + + // This is the statement_id that will allow us to track the plan + $statement_id = substr(md5($query), 0, 30); + + // Remove any stale plans + $stmt2 = ociparse($this->db_connect_id, "DELETE FROM $table WHERE statement_id='$statement_id'"); + ociexecute($stmt2); + ocifreestatement($stmt2); + + // Explain the plan + $sql = "EXPLAIN PLAN + SET STATEMENT_ID = '$statement_id' + FOR $query"; + $stmt2 = ociparse($this->db_connect_id, $sql); + ociexecute($stmt2); + ocifreestatement($stmt2); + + // Get the data from the plan + $sql = "SELECT operation, options, object_name, object_type, cardinality, cost + FROM plan_table + START WITH id = 0 AND statement_id = '$statement_id' + CONNECT BY PRIOR id = parent_id + AND statement_id = '$statement_id'"; + $stmt2 = ociparse($this->db_connect_id, $sql); + ociexecute($stmt2); + + $row = array(); + while (ocifetchinto($stmt2, $row, OCI_ASSOC + OCI_RETURN_NULLS)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + + ocifreestatement($stmt2); + + // Remove the plan we just made, we delete them on request anyway + $stmt2 = ociparse($this->db_connect_id, "DELETE FROM $table WHERE statement_id='$statement_id'"); + ociexecute($stmt2); + ocifreestatement($stmt2); + } + + ocifreestatement($stmt); + + if ($html_table) + { + $this->html_hold .= ''; + } + + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @ociparse($this->db_connect_id, $query); + if ($result) + { + $success = @ociexecute($result, OCI_DEFAULT); + if ($success) + { + $row = array(); + + while (ocifetchinto($result, $row, OCI_ASSOC + OCI_RETURN_NULLS)) + { + // Take the time spent on parsing rows into account + } + @ocifreestatement($result); + } + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/install/update/old/phpbb/db/driver/postgres.php b/install/update/old/phpbb/db/driver/postgres.php new file mode 100644 index 0000000..4447661 --- /dev/null +++ b/install/update/old/phpbb/db/driver/postgres.php @@ -0,0 +1,501 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* PostgreSQL Database Abstraction Layer +* Minimum Requirement is Version 8.3+ +*/ +class postgres extends \phpbb\db\driver\driver +{ + var $multi_insert = true; + var $last_query_text = ''; + var $connect_error = ''; + + /** + * {@inheritDoc} + */ + function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + $connect_string = ''; + + if ($sqluser) + { + $connect_string .= "user=$sqluser "; + } + + if ($sqlpassword) + { + $connect_string .= "password=$sqlpassword "; + } + + if ($sqlserver) + { + // $sqlserver can carry a port separated by : for compatibility reasons + // If $sqlserver has more than one : it's probably an IPv6 address. + // In this case we only allow passing a port via the $port variable. + if (substr_count($sqlserver, ':') === 1) + { + list($sqlserver, $port) = explode(':', $sqlserver); + } + + if ($sqlserver !== 'localhost') + { + $connect_string .= "host=$sqlserver "; + } + + if ($port) + { + $connect_string .= "port=$port "; + } + } + + $schema = ''; + + if ($database) + { + $this->dbname = $database; + if (strpos($database, '.') !== false) + { + list($database, $schema) = explode('.', $database); + } + $connect_string .= "dbname=$database"; + } + + $this->persistency = $persistency; + + if ($this->persistency) + { + if (!function_exists('pg_pconnect')) + { + $this->connect_error = 'pg_pconnect function does not exist, is pgsql extension installed?'; + return $this->sql_error(''); + } + $collector = new \phpbb\error_collector; + $collector->install(); + $this->db_connect_id = (!$new_link) ? @pg_pconnect($connect_string) : @pg_pconnect($connect_string, PGSQL_CONNECT_FORCE_NEW); + } + else + { + if (!function_exists('pg_connect')) + { + $this->connect_error = 'pg_connect function does not exist, is pgsql extension installed?'; + return $this->sql_error(''); + } + $collector = new \phpbb\error_collector; + $collector->install(); + $this->db_connect_id = (!$new_link) ? @pg_connect($connect_string) : @pg_connect($connect_string, PGSQL_CONNECT_FORCE_NEW); + } + + $collector->uninstall(); + + if ($this->db_connect_id) + { + if ($schema !== '') + { + @pg_query($this->db_connect_id, 'SET search_path TO ' . $schema); + } + return $this->db_connect_id; + } + + $this->connect_error = $collector->format_errors(); + return $this->sql_error(''); + } + + /** + * {@inheritDoc} + */ + function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('pgsql_version')) === false) + { + $query_id = @pg_query($this->db_connect_id, 'SELECT VERSION() AS version'); + if ($query_id) + { + $row = pg_fetch_assoc($query_id, null); + pg_free_result($query_id); + + $this->sql_server_version = (!empty($row['version'])) ? trim(substr($row['version'], 10)) : 0; + + if (!empty($cache) && $use_cache) + { + $cache->put('pgsql_version', $this->sql_server_version); + } + } + } + + return ($raw) ? $this->sql_server_version : 'PostgreSQL ' . $this->sql_server_version; + } + + /** + * SQL Transaction + * @access private + */ + function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return @pg_query($this->db_connect_id, 'BEGIN'); + break; + + case 'commit': + return @pg_query($this->db_connect_id, 'COMMIT'); + break; + + case 'rollback': + return @pg_query($this->db_connect_id, 'ROLLBACK'); + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + // EXPLAIN only in extra debug mode + if (defined('DEBUG')) + { + $this->sql_report('start', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if (($this->query_result = @pg_query($this->db_connect_id, $query)) === false) + { + $this->sql_error($query); + } + + if (defined('DEBUG')) + { + $this->sql_report('stop', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + else if (strpos($query, 'SELECT') === 0) + { + $this->open_queries[(int) $this->query_result] = $this->query_result; + } + } + else if (defined('DEBUG')) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * Build db-specific query data + * @access private + */ + function _sql_custom_build($stage, $data) + { + return $data; + } + + /** + * Build LIMIT query + */ + function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + // if $total is set to 0 we do not want to limit the number of rows + if ($total == 0) + { + $total = 'ALL'; + } + + $query .= "\n LIMIT $total OFFSET $offset"; + + return $this->sql_query($query, $cache_ttl); + } + + /** + * {@inheritDoc} + */ + function sql_affectedrows() + { + return ($this->query_result) ? @pg_affected_rows($this->query_result) : false; + } + + /** + * {@inheritDoc} + */ + function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + return ($query_id) ? pg_fetch_assoc($query_id, null) : false; + } + + /** + * {@inheritDoc} + */ + function sql_rowseek($rownum, &$query_id) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && $cache->sql_exists($query_id)) + { + return $cache->sql_rowseek($rownum, $query_id); + } + + return ($query_id) ? @pg_result_seek($query_id, $rownum) : false; + } + + /** + * {@inheritDoc} + */ + function sql_nextid() + { + $query_id = $this->query_result; + + if ($query_id !== false && $this->last_query_text != '') + { + if (preg_match("/^INSERT[\t\n ]+INTO[\t\n ]+([a-z0-9\_\-]+)/is", $this->last_query_text, $tablename)) + { + $query = "SELECT currval('" . $tablename[1] . "_seq') AS last_value"; + $temp_q_id = @pg_query($this->db_connect_id, $query); + + if (!$temp_q_id) + { + return false; + } + + $temp_result = pg_fetch_assoc($temp_q_id, null); + pg_free_result($query_id); + + return ($temp_result) ? $temp_result['last_value'] : false; + } + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if (isset($this->open_queries[(int) $query_id])) + { + unset($this->open_queries[(int) $query_id]); + return pg_free_result($query_id); + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_escape($msg) + { + return @pg_escape_string($msg); + } + + /** + * Build LIKE expression + * @access private + */ + function _sql_like_expression($expression) + { + return $expression; + } + + /** + * Build NOT LIKE expression + * @access private + */ + function _sql_not_like_expression($expression) + { + return $expression; + } + + /** + * {@inheritDoc} + */ + function cast_expr_to_bigint($expression) + { + return 'CAST(' . $expression . ' as DECIMAL(255, 0))'; + } + + /** + * {@inheritDoc} + */ + function cast_expr_to_string($expression) + { + return 'CAST(' . $expression . ' as VARCHAR(255))'; + } + + /** + * return sql error array + * @access private + */ + function _sql_error() + { + // pg_last_error only works when there is an established connection. + // Connection errors have to be tracked by us manually. + if ($this->db_connect_id) + { + $message = @pg_last_error($this->db_connect_id); + } + else + { + $message = $this->connect_error; + } + + return array( + 'message' => $message, + 'code' => '' + ); + } + + /** + * Close sql connection + * @access private + */ + function _sql_close() + { + return @pg_close($this->db_connect_id); + } + + /** + * Build db-specific report + * @access private + */ + function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + + $explain_query = $query; + if (preg_match('/UPDATE ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + else if (preg_match('/DELETE FROM ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + + if (preg_match('/^SELECT/', $explain_query)) + { + $html_table = false; + + if ($result = @pg_query($this->db_connect_id, "EXPLAIN $explain_query")) + { + while ($row = pg_fetch_assoc($result, null)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + pg_free_result($result); + } + + if ($html_table) + { + $this->html_hold .= ''; + } + } + + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = @pg_query($this->db_connect_id, $query); + if ($result) + { + while ($void = pg_fetch_assoc($result, null)) + { + // Take the time spent on parsing rows into account + } + pg_free_result($result); + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/install/update/old/phpbb/db/driver/sqlite3.php b/install/update/old/phpbb/db/driver/sqlite3.php new file mode 100644 index 0000000..0508500 --- /dev/null +++ b/install/update/old/phpbb/db/driver/sqlite3.php @@ -0,0 +1,431 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\driver; + +/** +* SQLite3 Database Abstraction Layer +* Minimum Requirement: 3.6.15+ +*/ +class sqlite3 extends \phpbb\db\driver\driver +{ + /** + * @var string Stores errors during connection setup in case the driver is not available + */ + protected $connect_error = ''; + + /** + * @var \SQLite3 The SQLite3 database object to operate against + */ + protected $dbo = null; + + /** + * {@inheritDoc} + */ + public function sql_connect($sqlserver, $sqluser, $sqlpassword, $database, $port = false, $persistency = false, $new_link = false) + { + $this->persistency = false; + $this->user = $sqluser; + $this->server = $sqlserver . (($port) ? ':' . $port : ''); + $this->dbname = $database; + + if (!class_exists('SQLite3', false)) + { + $this->connect_error = 'SQLite3 not found, is the extension installed?'; + return $this->sql_error(''); + } + + try + { + $this->dbo = new \SQLite3($this->server, SQLITE3_OPEN_READWRITE | SQLITE3_OPEN_CREATE); + $this->dbo->busyTimeout(60000); + $this->db_connect_id = true; + } + catch (\Exception $e) + { + $this->connect_error = $e->getMessage(); + return array('message' => $this->connect_error); + } + + return true; + } + + /** + * {@inheritDoc} + */ + public function sql_server_info($raw = false, $use_cache = true) + { + global $cache; + + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('sqlite_version')) === false) + { + $version = \SQLite3::version(); + + $this->sql_server_version = $version['versionString']; + + if (!empty($cache) && $use_cache) + { + $cache->put('sqlite_version', $this->sql_server_version); + } + } + + return ($raw) ? $this->sql_server_version : 'SQLite ' . $this->sql_server_version; + } + + /** + * SQL Transaction + * + * @param string $status Should be one of the following strings: + * begin, commit, rollback + * @return bool Success/failure of the transaction query + */ + protected function _sql_transaction($status = 'begin') + { + switch ($status) + { + case 'begin': + return $this->dbo->exec('BEGIN IMMEDIATE'); + break; + + case 'commit': + return $this->dbo->exec('COMMIT'); + break; + + case 'rollback': + return @$this->dbo->exec('ROLLBACK'); + break; + } + + return true; + } + + /** + * {@inheritDoc} + */ + public function sql_query($query = '', $cache_ttl = 0) + { + if ($query != '') + { + global $cache; + + // EXPLAIN only in extra debug mode + if (defined('DEBUG')) + { + $this->sql_report('start', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->curtime = microtime(true); + } + + $this->last_query_text = $query; + $this->query_result = ($cache && $cache_ttl) ? $cache->sql_load($query) : false; + $this->sql_add_num_queries($this->query_result); + + if ($this->query_result === false) + { + if ($this->transaction === true && strpos($query, 'INSERT') === 0) + { + $query = preg_replace('/^INSERT INTO/', 'INSERT OR ROLLBACK INTO', $query); + } + + if (($this->query_result = @$this->dbo->query($query)) === false) + { + // Try to recover a lost database connection + if ($this->dbo && !@$this->dbo->lastErrorMsg()) + { + if ($this->sql_connect($this->server, $this->user, '', $this->dbname)) + { + $this->query_result = @$this->dbo->query($query); + } + } + + if ($this->query_result === false) + { + $this->sql_error($query); + } + } + + if (defined('DEBUG')) + { + $this->sql_report('stop', $query); + } + else if (defined('PHPBB_DISPLAY_LOAD_TIME')) + { + $this->sql_time += microtime(true) - $this->curtime; + } + + if (!$this->query_result) + { + return false; + } + + if ($cache && $cache_ttl) + { + $this->query_result = $cache->sql_save($this, $query, $this->query_result, $cache_ttl); + } + } + else if (defined('DEBUG')) + { + $this->sql_report('fromcache', $query); + } + } + else + { + return false; + } + + return $this->query_result; + } + + /** + * Build LIMIT query + * + * @param string $query The SQL query to execute + * @param int $total The number of rows to select + * @param int $offset + * @param int $cache_ttl Either 0 to avoid caching or + * the time in seconds which the result shall be kept in cache + * @return mixed Buffered, seekable result handle, false on error + */ + protected function _sql_query_limit($query, $total, $offset = 0, $cache_ttl = 0) + { + $this->query_result = false; + + // if $total is set to 0 we do not want to limit the number of rows + if ($total == 0) + { + $total = -1; + } + + $query .= "\n LIMIT " . ((!empty($offset)) ? $offset . ', ' . $total : $total); + + return $this->sql_query($query, $cache_ttl); + } + + /** + * {@inheritDoc} + */ + public function sql_affectedrows() + { + return ($this->db_connect_id) ? $this->dbo->changes() : false; + } + + /** + * {@inheritDoc} + */ + public function sql_fetchrow($query_id = false) + { + global $cache; + + if ($query_id === false) + { + /** @var \SQLite3Result $query_id */ + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_fetchrow($query_id); + } + + return is_object($query_id) ? @$query_id->fetchArray(SQLITE3_ASSOC) : false; + } + + /** + * {@inheritDoc} + */ + public function sql_nextid() + { + return ($this->db_connect_id) ? $this->dbo->lastInsertRowID() : false; + } + + /** + * {@inheritDoc} + */ + public function sql_freeresult($query_id = false) + { + global $cache; + + if ($query_id === false) + { + $query_id = $this->query_result; + } + + if ($cache && !is_object($query_id) && $cache->sql_exists($query_id)) + { + return $cache->sql_freeresult($query_id); + } + + if ($query_id) + { + return @$query_id->finalize(); + } + } + + /** + * {@inheritDoc} + */ + public function sql_escape($msg) + { + return \SQLite3::escapeString($msg); + } + + /** + * {@inheritDoc} + * + * For SQLite an underscore is an unknown character. + */ + public function sql_like_expression($expression) + { + // Unlike LIKE, GLOB is unfortunately case sensitive. + // We only catch * and ? here, not the character map possible on file globbing. + $expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression); + + $expression = str_replace(array('?', '*'), array("\?", "\*"), $expression); + $expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression); + + return 'GLOB \'' . $this->sql_escape($expression) . '\''; + } + + /** + * {@inheritDoc} + * + * For SQLite an underscore is an unknown character. + */ + public function sql_not_like_expression($expression) + { + // Unlike NOT LIKE, NOT GLOB is unfortunately case sensitive + // We only catch * and ? here, not the character map possible on file globbing. + $expression = str_replace(array(chr(0) . '_', chr(0) . '%'), array(chr(0) . '?', chr(0) . '*'), $expression); + + $expression = str_replace(array('?', '*'), array("\?", "\*"), $expression); + $expression = str_replace(array(chr(0) . "\?", chr(0) . "\*"), array('?', '*'), $expression); + + return 'NOT GLOB \'' . $this->sql_escape($expression) . '\''; + } + + /** + * return sql error array + * + * @return array + */ + protected function _sql_error() + { + if (class_exists('SQLite3', false) && isset($this->dbo)) + { + $error = array( + 'message' => $this->dbo->lastErrorMsg(), + 'code' => $this->dbo->lastErrorCode(), + ); + } + else + { + $error = array( + 'message' => $this->connect_error, + 'code' => '', + ); + } + + return $error; + } + + /** + * Build db-specific query data + * + * @param string $stage Available stages: FROM, WHERE + * @param mixed $data A string containing the CROSS JOIN query or an array of WHERE clauses + * + * @return string The db-specific query fragment + */ + protected function _sql_custom_build($stage, $data) + { + return $data; + } + + /** + * Close sql connection + * + * @return bool False if failure + */ + protected function _sql_close() + { + return $this->dbo->close(); + } + + /** + * Build db-specific report + * + * @param string $mode Available modes: display, start, stop, + * add_select_row, fromcache, record_fromcache + * @param string $query The Query that should be explained + * @return mixed Either a full HTML page, boolean or null + */ + protected function _sql_report($mode, $query = '') + { + switch ($mode) + { + case 'start': + + $explain_query = $query; + if (preg_match('/UPDATE ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + else if (preg_match('/DELETE FROM ([a-z0-9_]+).*?WHERE(.*)/s', $query, $m)) + { + $explain_query = 'SELECT * FROM ' . $m[1] . ' WHERE ' . $m[2]; + } + + if (preg_match('/^SELECT/', $explain_query)) + { + $html_table = false; + + if ($result = $this->dbo->query("EXPLAIN QUERY PLAN $explain_query")) + { + while ($row = $result->fetchArray(SQLITE3_ASSOC)) + { + $html_table = $this->sql_report('add_select_row', $query, $html_table, $row); + } + } + + if ($html_table) + { + $this->html_hold .= ''; + } + } + + break; + + case 'fromcache': + $endtime = explode(' ', microtime()); + $endtime = $endtime[0] + $endtime[1]; + + $result = $this->dbo->query($query); + if ($result) + { + while ($void = $result->fetchArray(SQLITE3_ASSOC)) + { + // Take the time spent on parsing rows into account + } + } + + $splittime = explode(' ', microtime()); + $splittime = $splittime[0] + $splittime[1]; + + $this->sql_report('record_fromcache', $query, $endtime, $splittime); + + break; + } + } +} diff --git a/install/update/old/phpbb/db/extractor/mysql_extractor.php b/install/update/old/phpbb/db/extractor/mysql_extractor.php new file mode 100644 index 0000000..34e309c --- /dev/null +++ b/install/update/old/phpbb/db/extractor/mysql_extractor.php @@ -0,0 +1,403 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\extractor; + +use phpbb\db\extractor\exception\extractor_not_initialized_exception; + +class mysql_extractor extends base_extractor +{ + /** + * {@inheritdoc} + */ + public function write_start($table_prefix) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = "#\n"; + $sql_data .= "# phpBB Backup Script\n"; + $sql_data .= "# Dump of tables for $table_prefix\n"; + $sql_data .= "# DATE : " . gmdate("d-m-Y H:i:s", $this->time) . " GMT\n"; + $sql_data .= "#\n"; + $this->flush($sql_data); + } + + /** + * {@inheritdoc} + */ + public function write_table($table_name) + { + static $new_extract; + + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + if ($new_extract === null) + { + if ($this->db->get_sql_layer() === 'mysqli' || version_compare($this->db->sql_server_info(true), '3.23.20', '>=')) + { + $new_extract = true; + } + else + { + $new_extract = false; + } + } + + if ($new_extract) + { + $this->new_write_table($table_name); + } + else + { + $this->old_write_table($table_name); + } + } + + /** + * {@inheritdoc} + */ + public function write_data($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + if ($this->db->get_sql_layer() === 'mysqli') + { + $this->write_data_mysqli($table_name); + } + else + { + $this->write_data_mysql($table_name); + } + } + + /** + * Extracts data from database table (for MySQLi driver) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function write_data_mysqli($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql = "SELECT * + FROM $table_name"; + $result = mysqli_query($this->db->get_db_connect_id(), $sql, MYSQLI_USE_RESULT); + if ($result != false) + { + $fields_cnt = mysqli_num_fields($result); + + // Get field information + $field = mysqli_fetch_fields($result); + $field_set = array(); + + for ($j = 0; $j < $fields_cnt; $j++) + { + $field_set[] = $field[$j]->name; + } + + $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); + $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); + $fields = implode(', ', $field_set); + $sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES '; + $first_set = true; + $query_len = 0; + $max_len = get_usable_memory(); + + while ($row = mysqli_fetch_row($result)) + { + $values = array(); + if ($first_set) + { + $query = $sql_data . '('; + } + else + { + $query .= ',('; + } + + for ($j = 0; $j < $fields_cnt; $j++) + { + if (!isset($row[$j]) || is_null($row[$j])) + { + $values[$j] = 'NULL'; + } + else if (($field[$j]->flags & 32768) && !($field[$j]->flags & 1024)) + { + $values[$j] = $row[$j]; + } + else + { + $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'"; + } + } + $query .= implode(', ', $values) . ')'; + + $query_len += strlen($query); + if ($query_len > $max_len) + { + $this->flush($query . ";\n\n"); + $query = ''; + $query_len = 0; + $first_set = true; + } + else + { + $first_set = false; + } + } + mysqli_free_result($result); + + // check to make sure we have nothing left to flush + if (!$first_set && $query) + { + $this->flush($query . ";\n\n"); + } + } + } + + /** + * Extracts data from database table (for MySQL driver) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function write_data_mysql($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql = "SELECT * + FROM $table_name"; + $result = mysql_unbuffered_query($sql, $this->db->get_db_connect_id()); + + if ($result != false) + { + $fields_cnt = mysql_num_fields($result); + + // Get field information + $field = array(); + for ($i = 0; $i < $fields_cnt; $i++) + { + $field[] = mysql_fetch_field($result, $i); + } + $field_set = array(); + + for ($j = 0; $j < $fields_cnt; $j++) + { + $field_set[] = $field[$j]->name; + } + + $search = array("\\", "'", "\x00", "\x0a", "\x0d", "\x1a", '"'); + $replace = array("\\\\", "\\'", '\0', '\n', '\r', '\Z', '\\"'); + $fields = implode(', ', $field_set); + $sql_data = 'INSERT INTO ' . $table_name . ' (' . $fields . ') VALUES '; + $first_set = true; + $query_len = 0; + $max_len = get_usable_memory(); + + while ($row = mysql_fetch_row($result)) + { + $values = array(); + if ($first_set) + { + $query = $sql_data . '('; + } + else + { + $query .= ',('; + } + + for ($j = 0; $j < $fields_cnt; $j++) + { + if (!isset($row[$j]) || is_null($row[$j])) + { + $values[$j] = 'NULL'; + } + else if ($field[$j]->numeric && ($field[$j]->type !== 'timestamp')) + { + $values[$j] = $row[$j]; + } + else + { + $values[$j] = "'" . str_replace($search, $replace, $row[$j]) . "'"; + } + } + $query .= implode(', ', $values) . ')'; + + $query_len += strlen($query); + if ($query_len > $max_len) + { + $this->flush($query . ";\n\n"); + $query = ''; + $query_len = 0; + $first_set = true; + } + else + { + $first_set = false; + } + } + mysql_free_result($result); + + // check to make sure we have nothing left to flush + if (!$first_set && $query) + { + $this->flush($query . ";\n\n"); + } + } + } + + /** + * Extracts database table structure (for MySQLi or MySQL 3.23.20+) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function new_write_table($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql = 'SHOW CREATE TABLE ' . $table_name; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + + $sql_data = '# Table: ' . $table_name . "\n"; + $sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; + $this->flush($sql_data . $row['Create Table'] . ";\n\n"); + + $this->db->sql_freeresult($result); + } + + /** + * Extracts database table structure (for MySQL verisons older than 3.23.20) + * + * @param string $table_name name of the database table + * @return null + * @throws \phpbb\db\extractor\exception\extractor_not_initialized_exception when calling this function before init_extractor() + */ + protected function old_write_table($table_name) + { + if (!$this->is_initialized) + { + throw new extractor_not_initialized_exception(); + } + + $sql_data = '# Table: ' . $table_name . "\n"; + $sql_data .= "DROP TABLE IF EXISTS $table_name;\n"; + $sql_data .= "CREATE TABLE $table_name(\n"; + $rows = array(); + + $sql = "SHOW FIELDS + FROM $table_name"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $line = ' ' . $row['Field'] . ' ' . $row['Type']; + + if (!is_null($row['Default'])) + { + $line .= " DEFAULT '{$row['Default']}'"; + } + + if ($row['Null'] != 'YES') + { + $line .= ' NOT NULL'; + } + + if ($row['Extra'] != '') + { + $line .= ' ' . $row['Extra']; + } + + $rows[] = $line; + } + $this->db->sql_freeresult($result); + + $sql = "SHOW KEYS + FROM $table_name"; + + $result = $this->db->sql_query($sql); + + $index = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $kname = $row['Key_name']; + + if ($kname != 'PRIMARY') + { + if ($row['Non_unique'] == 0) + { + $kname = "UNIQUE|$kname"; + } + } + + if ($row['Sub_part']) + { + $row['Column_name'] .= '(' . $row['Sub_part'] . ')'; + } + $index[$kname][] = $row['Column_name']; + } + $this->db->sql_freeresult($result); + + foreach ($index as $key => $columns) + { + $line = ' '; + + if ($key == 'PRIMARY') + { + $line .= 'PRIMARY KEY (' . implode(', ', $columns) . ')'; + } + else if (strpos($key, 'UNIQUE') === 0) + { + $line .= 'UNIQUE ' . substr($key, 7) . ' (' . implode(', ', $columns) . ')'; + } + else if (strpos($key, 'FULLTEXT') === 0) + { + $line .= 'FULLTEXT ' . substr($key, 9) . ' (' . implode(', ', $columns) . ')'; + } + else + { + $line .= "KEY $key (" . implode(', ', $columns) . ')'; + } + + $rows[] = $line; + } + + $sql_data .= implode(",\n", $rows); + $sql_data .= "\n);\n\n"; + + $this->flush($sql_data); + } +} diff --git a/install/update/old/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php b/install/update/old/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php new file mode 100644 index 0000000..1034343 --- /dev/null +++ b/install/update/old/phpbb/db/migration/data/v30x/release_3_0_4_rc1.php @@ -0,0 +1,129 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v30x; + +class release_3_0_4_rc1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return phpbb_version_compare($this->config['version'], '3.0.4-RC1', '>='); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v30x\release_3_0_3'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_profile' => array('BOOL', 0), + ), + ), + 'change_columns' => array( + $this->table_prefix . 'styles' => array( + 'style_id' => array('UINT', NULL, 'auto_increment'), + 'template_id' => array('UINT', 0), + 'theme_id' => array('UINT', 0), + 'imageset_id' => array('UINT', 0), + ), + $this->table_prefix . 'styles_imageset' => array( + 'imageset_id' => array('UINT', NULL, 'auto_increment'), + ), + $this->table_prefix . 'styles_imageset_data' => array( + 'image_id' => array('UINT', NULL, 'auto_increment'), + 'imageset_id' => array('UINT', 0), + ), + $this->table_prefix . 'styles_theme' => array( + 'theme_id' => array('UINT', NULL, 'auto_increment'), + ), + $this->table_prefix . 'styles_template' => array( + 'template_id' => array('UINT', NULL, 'auto_increment'), + ), + $this->table_prefix . 'styles_template_data' => array( + 'template_id' => array('UINT', 0), + ), + $this->table_prefix . 'forums' => array( + 'forum_style' => array('UINT', 0), + ), + $this->table_prefix . 'users' => array( + 'user_style' => array('UINT', 0), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'profile_fields' => array( + 'field_show_profile', + ), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array(&$this, 'update_custom_profile_fields'))), + + array('config.update', array('version', '3.0.4-RC1')), + ); + } + + public function update_custom_profile_fields() + { + // Update the Custom Profile Fields based on previous settings to the new \format + $sql = 'SELECT field_id, field_required, field_show_on_reg, field_hide + FROM ' . PROFILE_FIELDS_TABLE; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $sql_ary = array( + 'field_required' => 0, + 'field_show_on_reg' => 0, + 'field_hide' => 0, + 'field_show_profile'=> 0, + ); + + if ($row['field_required']) + { + $sql_ary['field_required'] = $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1; + } + else if ($row['field_show_on_reg']) + { + $sql_ary['field_show_on_reg'] = $sql_ary['field_show_profile'] = 1; + } + else if ($row['field_hide']) + { + // Only administrators and moderators can see this CPF, if the view is enabled, they can see it, otherwise just admins in the acp_users module + $sql_ary['field_hide'] = 1; + } + else + { + // equivelant to "none", which is the "Display in user control panel" option + $sql_ary['field_show_profile'] = 1; + } + + $this->sql_query('UPDATE ' . $this->table_prefix . 'profile_fields SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE field_id = ' . $row['field_id'], $errored, $error_ary); + } + + $this->db->sql_freeresult($result); + } +} diff --git a/install/update/old/phpbb/db/migration/data/v310/softdelete_p1.php b/install/update/old/phpbb/db/migration/data/v310/softdelete_p1.php new file mode 100644 index 0000000..b1e7486 --- /dev/null +++ b/install/update/old/phpbb/db/migration/data/v310/softdelete_p1.php @@ -0,0 +1,211 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\data\v310; + +class softdelete_p1 extends \phpbb\db\migration\migration +{ + public function effectively_installed() + { + return $this->db_tools->sql_column_exists($this->table_prefix . 'posts', 'post_visibility'); + } + + static public function depends_on() + { + return array('\phpbb\db\migration\data\v310\dev'); + } + + public function update_schema() + { + return array( + 'add_columns' => array( + $this->table_prefix . 'forums' => array( + 'forum_posts_approved' => array('UINT', 0), + 'forum_posts_unapproved' => array('UINT', 0), + 'forum_posts_softdeleted' => array('UINT', 0), + 'forum_topics_approved' => array('UINT', 0), + 'forum_topics_unapproved' => array('UINT', 0), + 'forum_topics_softdeleted' => array('UINT', 0), + ), + $this->table_prefix . 'posts' => array( + 'post_visibility' => array('TINT:3', 0), + 'post_delete_time' => array('TIMESTAMP', 0), + 'post_delete_reason' => array('STEXT_UNI', ''), + 'post_delete_user' => array('UINT', 0), + ), + $this->table_prefix . 'topics' => array( + 'topic_visibility' => array('TINT:3', 0), + 'topic_delete_time' => array('TIMESTAMP', 0), + 'topic_delete_reason' => array('STEXT_UNI', ''), + 'topic_delete_user' => array('UINT', 0), + 'topic_posts_approved' => array('UINT', 0), + 'topic_posts_unapproved' => array('UINT', 0), + 'topic_posts_softdeleted' => array('UINT', 0), + ), + ), + 'add_index' => array( + $this->table_prefix . 'posts' => array( + 'post_visibility' => array('post_visibility'), + ), + $this->table_prefix . 'topics' => array( + 'topic_visibility' => array('topic_visibility'), + 'forum_vis_last' => array('forum_id', 'topic_visibility', 'topic_last_post_id'), + ), + ), + ); + } + + public function revert_schema() + { + return array( + 'drop_columns' => array( + $this->table_prefix . 'forums' => array( + 'forum_posts_approved', + 'forum_posts_unapproved', + 'forum_posts_softdeleted', + 'forum_topics_approved', + 'forum_topics_unapproved', + 'forum_topics_softdeleted', + ), + $this->table_prefix . 'posts' => array( + 'post_visibility', + 'post_delete_time', + 'post_delete_reason', + 'post_delete_user', + ), + $this->table_prefix . 'topics' => array( + 'topic_visibility', + 'topic_delete_time', + 'topic_delete_reason', + 'topic_delete_user', + 'topic_posts_approved', + 'topic_posts_unapproved', + 'topic_posts_softdeleted', + ), + ), + 'drop_keys' => array( + $this->table_prefix . 'posts' => array('post_visibility'), + $this->table_prefix . 'topics' => array('topic_visibility', 'forum_vis_last'), + ), + ); + } + + public function update_data() + { + return array( + array('custom', array(array($this, 'update_post_visibility'))), + array('custom', array(array($this, 'update_topic_visibility'))), + array('custom', array(array($this, 'update_topics_post_counts'))), + array('custom', array(array($this, 'update_forums_topic_and_post_counts'))), + + array('permission.add', array('f_softdelete', false)), + array('permission.add', array('m_softdelete', false)), + ); + } + + public function update_post_visibility() + { + $sql = 'UPDATE ' . $this->table_prefix . 'posts + SET post_visibility = post_approved'; + $this->sql_query($sql); + } + + public function update_topic_visibility() + { + $sql = 'UPDATE ' . $this->table_prefix . 'topics + SET topic_visibility = topic_approved'; + $this->sql_query($sql); + } + + public function update_topics_post_counts() + { + /* + * Using sql_case here to avoid "BIGINT UNSIGNED value is out of range" errors. + * As we update all topics in 2 queries, one broken topic would stop the conversion + * for all topics and the surpressed error will cause the admin to not even notice it. + */ + $sql = 'UPDATE ' . $this->table_prefix . 'topics + SET topic_posts_approved = topic_replies + 1, + topic_posts_unapproved = ' . $this->db->sql_case('topic_replies_real > topic_replies', 'topic_replies_real - topic_replies', '0') . ' + WHERE topic_visibility = ' . ITEM_APPROVED; + $this->sql_query($sql); + + $sql = 'UPDATE ' . $this->table_prefix . 'topics + SET topic_posts_approved = 0, + topic_posts_unapproved = (' . $this->db->sql_case('topic_replies_real > topic_replies', 'topic_replies_real - topic_replies', '0') . ') + 1 + WHERE topic_visibility = ' . ITEM_UNAPPROVED; + $this->sql_query($sql); + } + + public function update_forums_topic_and_post_counts($start) + { + $start = (int) $start; + $limit = 10; + $converted_forums = 0; + + if (!$start) + { + // Preserve the forum_posts value for link forums as it represents redirects. + $sql = 'UPDATE ' . $this->table_prefix . 'forums + SET forum_posts_approved = forum_posts + WHERE forum_type = ' . FORUM_LINK; + $this->db->sql_query($sql); + } + + $sql = 'SELECT forum_id, topic_visibility, COUNT(topic_id) AS sum_topics, SUM(topic_posts_approved) AS sum_posts_approved, SUM(topic_posts_unapproved) AS sum_posts_unapproved + FROM ' . $this->table_prefix . 'topics + GROUP BY forum_id, topic_visibility + ORDER BY forum_id, topic_visibility'; + $result = $this->db->sql_query_limit($sql, $limit, $start); + + $update_forums = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $converted_forums++; + + $forum_id = (int) $row['forum_id']; + if (!isset($update_forums[$forum_id])) + { + $update_forums[$forum_id] = array( + 'forum_posts_approved' => 0, + 'forum_posts_unapproved' => 0, + 'forum_topics_approved' => 0, + 'forum_topics_unapproved' => 0, + ); + } + + $update_forums[$forum_id]['forum_posts_approved'] += (int) $row['sum_posts_approved']; + $update_forums[$forum_id]['forum_posts_unapproved'] += (int) $row['sum_posts_unapproved']; + + $update_forums[$forum_id][(($row['topic_visibility'] == ITEM_APPROVED) ? 'forum_topics_approved' : 'forum_topics_unapproved')] += (int) $row['sum_topics']; + } + $this->db->sql_freeresult($result); + + foreach ($update_forums as $forum_id => $forum_data) + { + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET ' . $this->db->sql_build_array('UPDATE', $forum_data) . ' + WHERE forum_id = ' . $forum_id; + $this->sql_query($sql); + } + + if ($converted_forums < $limit) + { + // There are no more topics, we are done + return; + } + + // There are still more topics to query, return the next start value + return $start + $limit; + } +} diff --git a/install/update/old/phpbb/db/migration/tool/module.php b/install/update/old/phpbb/db/migration/tool/module.php new file mode 100644 index 0000000..e5133c8 --- /dev/null +++ b/install/update/old/phpbb/db/migration/tool/module.php @@ -0,0 +1,556 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\migration\tool; + +use phpbb\module\exception\module_exception; + +/** +* Migration module management tool +*/ +class module implements \phpbb\db\migration\tool\tool_interface +{ + /** @var \phpbb\cache\service */ + protected $cache; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\module\module_manager */ + protected $module_manager; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** @var string */ + protected $modules_table; + + /** @var array */ + protected $module_categories = array(); + + /** + * Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\cache\service $cache + * @param \phpbb\user $user + * @param \phpbb\module\module_manager $module_manager + * @param string $phpbb_root_path + * @param string $php_ext + * @param string $modules_table + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\cache\service $cache, \phpbb\user $user, \phpbb\module\module_manager $module_manager, $phpbb_root_path, $php_ext, $modules_table) + { + $this->db = $db; + $this->cache = $cache; + $this->user = $user; + $this->module_manager = $module_manager; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->modules_table = $modules_table; + } + + /** + * {@inheritdoc} + */ + public function get_name() + { + return 'module'; + } + + /** + * Module Exists + * + * Check if a module exists + * + * @param string $class The module class(acp|mcp|ucp) + * @param int|string|bool $parent The parent module_id|module_langname (0 for no parent). + * Use false to ignore the parent check and check class wide. + * @param int|string $module The module_id|module_langname you would like to + * check for to see if it exists + * @param bool $lazy Checks lazily if the module exists. Returns true if it exists in at + * least one given parent. + * @return bool true if module exists in *all* given parents, false if not in any given parent; + * true if ignoring parent check and module exists class wide, false if not found at all. + */ + public function exists($class, $parent, $module, $lazy = false) + { + // the main root directory should return true + if (!$module) + { + return true; + } + + $parent_sqls = []; + if ($parent !== false) + { + $parents = $this->get_parent_module_id($parent, $module, false); + if ($parents === false) + { + return false; + } + + foreach ((array) $parents as $parent_id) + { + $parent_sqls[] = 'AND parent_id = ' . (int) $parent_id; + } + } + else + { + $parent_sqls[] = ''; + } + + foreach ($parent_sqls as $parent_sql) + { + $sql = 'SELECT module_id + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + $parent_sql + AND " . ((is_numeric($module)) ? 'module_id = ' . (int) $module : "module_langname = '" . $this->db->sql_escape($module) . "'"); + $result = $this->db->sql_query($sql); + $module_id = $this->db->sql_fetchfield('module_id'); + $this->db->sql_freeresult($result); + + if (!$lazy && !$module_id) + { + return false; + } + if ($lazy && $module_id) + { + return true; + } + } + + // Returns true, if modules exist in all parents and false otherwise + return !$lazy; + } + + /** + * Module Add + * + * Add a new module + * + * @param string $class The module class(acp|mcp|ucp) + * @param int|string $parent The parent module_id|module_langname (0 for no parent) + * @param array $data an array of the data on the new \module. + * This can be setup in two different ways. + * 1. The "manual" way. For inserting a category or one at a time. + * It will be merged with the base array shown a bit below, + * but at the least requires 'module_langname' to be sent, and, + * if you want to create a module (instead of just a category) you must + * send module_basename and module_mode. + * array( + * 'module_enabled' => 1, + * 'module_display' => 1, + * 'module_basename' => '', + * 'module_class' => $class, + * 'parent_id' => (int) $parent, + * 'module_langname' => '', + * 'module_mode' => '', + * 'module_auth' => '', + * ) + * 2. The "automatic" way. For inserting multiple at a time based on the + * specs in the info file for the module(s). For this to work the + * modules must be correctly setup in the info file. + * An example follows (this would insert the settings, log, and flag + * modes from the includes/acp/info/acp_asacp.php file): + * array( + * 'module_basename' => 'asacp', + * 'modes' => array('settings', 'log', 'flag'), + * ) + * Optionally you may not send 'modes' and it will insert all of the + * modules in that info file. + * path, specify that here + * @return null + * @throws \phpbb\db\migration\exception + */ + public function add($class, $parent = 0, $data = array()) + { + global $user, $phpbb_log; + + // allow sending the name as a string in $data to create a category + if (!is_array($data)) + { + $data = array('module_langname' => $data); + } + + $parents = (array) $this->get_parent_module_id($parent, $data); + + if (!isset($data['module_langname'])) + { + // The "automatic" way + $basename = (isset($data['module_basename'])) ? $data['module_basename'] : ''; + $module = $this->get_module_info($class, $basename); + + foreach ($module['modes'] as $mode => $module_info) + { + if (!isset($data['modes']) || in_array($mode, $data['modes'])) + { + $new_module = array( + 'module_basename' => $basename, + 'module_langname' => $module_info['title'], + 'module_mode' => $mode, + 'module_auth' => $module_info['auth'], + 'module_display' => (isset($module_info['display'])) ? $module_info['display'] : true, + 'before' => (isset($module_info['before'])) ? $module_info['before'] : false, + 'after' => (isset($module_info['after'])) ? $module_info['after'] : false, + ); + + // Run the "manual" way with the data we've collected. + foreach ($parents as $parent) + { + $this->add($class, $parent, $new_module); + } + } + } + + return; + } + + foreach ($parents as $parent) + { + $data['parent_id'] = $parent; + + // The "manual" way + if (!$this->exists($class, false, $parent)) + { + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent); + } + + if ($this->exists($class, $parent, $data['module_langname'])) + { + throw new \phpbb\db\migration\exception('MODULE_EXISTS', $data['module_langname']); + } + + $module_data = array( + 'module_enabled' => (isset($data['module_enabled'])) ? $data['module_enabled'] : 1, + 'module_display' => (isset($data['module_display'])) ? $data['module_display'] : 1, + 'module_basename' => (isset($data['module_basename'])) ? $data['module_basename'] : '', + 'module_class' => $class, + 'parent_id' => (int) $parent, + 'module_langname' => (isset($data['module_langname'])) ? $data['module_langname'] : '', + 'module_mode' => (isset($data['module_mode'])) ? $data['module_mode'] : '', + 'module_auth' => (isset($data['module_auth'])) ? $data['module_auth'] : '', + ); + + try + { + $this->module_manager->update_module_data($module_data); + + // Success + $module_log_name = ((isset($this->user->lang[$data['module_langname']])) ? $this->user->lang[$data['module_langname']] : $data['module_langname']); + $phpbb_log->add('admin', (isset($user->data['user_id'])) ? $user->data['user_id'] : ANONYMOUS, $user->ip, 'LOG_MODULE_ADD', false, array($module_log_name)); + + // Move the module if requested above/below an existing one + if (isset($data['before']) && $data['before']) + { + $before_mode = $before_langname = ''; + if (is_array($data['before'])) + { + // Restore legacy-legacy behaviour from phpBB 3.0 + list($before_mode, $before_langname) = $data['before']; + } + else + { + // Legacy behaviour from phpBB 3.1+ + $before_langname = $data['before']; + } + + $sql = 'SELECT left_id + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND parent_id = " . (int) $parent . " + AND module_langname = '" . $this->db->sql_escape($before_langname) . "'" + . (($before_mode) ? " AND module_mode = '" . $this->db->sql_escape($before_mode) . "'" : ''); + $result = $this->db->sql_query($sql); + $to_left = (int) $this->db->sql_fetchfield('left_id'); + $this->db->sql_freeresult($result); + + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = left_id + 2, right_id = right_id + 2 + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND left_id >= $to_left + AND left_id < {$module_data['left_id']}"; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = $to_left, right_id = " . ($to_left + 1) . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND module_id = {$module_data['module_id']}"; + $this->db->sql_query($sql); + } + else if (isset($data['after']) && $data['after']) + { + $after_mode = $after_langname = ''; + if (is_array($data['after'])) + { + // Restore legacy-legacy behaviour from phpBB 3.0 + list($after_mode, $after_langname) = $data['after']; + } + else + { + // Legacy behaviour from phpBB 3.1+ + $after_langname = $data['after']; + } + + $sql = 'SELECT right_id + FROM ' . $this->modules_table . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND parent_id = " . (int) $parent . " + AND module_langname = '" . $this->db->sql_escape($after_langname) . "'" + . (($after_mode) ? " AND module_mode = '" . $this->db->sql_escape($after_mode) . "'" : ''); + $result = $this->db->sql_query($sql); + $to_right = (int) $this->db->sql_fetchfield('right_id'); + $this->db->sql_freeresult($result); + + $sql = 'UPDATE ' . $this->modules_table . " + SET left_id = left_id + 2, right_id = right_id + 2 + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND left_id >= $to_right + AND left_id < {$module_data['left_id']}"; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . $this->modules_table . ' + SET left_id = ' . ($to_right + 1) . ', right_id = ' . ($to_right + 2) . " + WHERE module_class = '" . $this->db->sql_escape($class) . "' + AND module_id = {$module_data['module_id']}"; + $this->db->sql_query($sql); + } + } + catch (module_exception $e) + { + // Error + throw new \phpbb\db\migration\exception('MODULE_ERROR', $e->getMessage()); + } + } + + // Clear the Modules Cache + $this->module_manager->remove_cache_file($class); + } + + /** + * Module Remove + * + * Remove a module + * + * @param string $class The module class(acp|mcp|ucp) + * @param int|string|bool $parent The parent module_id|module_langname(0 for no parent). + * Use false to ignore the parent check and check class wide. + * @param int|string $module The module id|module_langname + * specify that here + * @return null + * @throws \phpbb\db\migration\exception + */ + public function remove($class, $parent = 0, $module = '') + { + // Imitation of module_add's "automatic" and "manual" method so the uninstaller works from the same set of instructions for umil_auto + if (is_array($module)) + { + if (isset($module['module_langname'])) + { + // Manual Method + return $this->remove($class, $parent, $module['module_langname']); + } + + // Failed. + if (!isset($module['module_basename'])) + { + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST'); + } + + // Automatic method + $basename = $module['module_basename']; + $module_info = $this->get_module_info($class, $basename); + + foreach ($module_info['modes'] as $mode => $info) + { + if (!isset($module['modes']) || in_array($mode, $module['modes'])) + { + $this->remove($class, $parent, $info['title']); + } + } + } + else + { + if (!$this->exists($class, $parent, $module, true)) + { + return; + } + + $parent_sql = ''; + if ($parent !== false) + { + $parents = (array) $this->get_parent_module_id($parent, $module); + $parent_sql = 'AND ' . $this->db->sql_in_set('parent_id', $parents); + } + + $module_ids = array(); + if (!is_numeric($module)) + { + $sql = 'SELECT module_id + FROM ' . $this->modules_table . " + WHERE module_langname = '" . $this->db->sql_escape($module) . "' + AND module_class = '" . $this->db->sql_escape($class) . "' + $parent_sql"; + $result = $this->db->sql_query($sql); + while ($module_id = $this->db->sql_fetchfield('module_id')) + { + $module_ids[] = (int) $module_id; + } + $this->db->sql_freeresult($result); + } + else + { + $module_ids[] = (int) $module; + } + + foreach ($module_ids as $module_id) + { + $this->module_manager->delete_module($module_id, $class); + } + + $this->module_manager->remove_cache_file($class); + } + } + + /** + * {@inheritdoc} + */ + public function reverse() + { + $arguments = func_get_args(); + $original_call = array_shift($arguments); + + $call = false; + switch ($original_call) + { + case 'add': + $call = 'remove'; + break; + + case 'remove': + $call = 'add'; + break; + + case 'reverse': + // Reversing a reverse is just the call itself + $call = array_shift($arguments); + break; + } + + if ($call) + { + return call_user_func_array(array(&$this, $call), $arguments); + } + } + + /** + * Wrapper for \acp_modules::get_module_infos() + * + * @param string $class Module Class + * @param string $basename Module Basename + * @return array Module Information + * @throws \phpbb\db\migration\exception + */ + protected function get_module_info($class, $basename) + { + $module = $this->module_manager->get_module_infos($class, $basename, true); + + if (empty($module)) + { + throw new \phpbb\db\migration\exception('MODULE_INFO_FILE_NOT_EXIST', $class, $basename); + } + + return array_pop($module); + } + + /** + * Get the list of installed module categories + * key - module_id + * value - module_langname + * + * @return null + */ + protected function get_categories_list() + { + // Select the top level categories + // and 2nd level [sub]categories + $sql = 'SELECT m2.module_id, m2.module_langname + FROM ' . $this->modules_table . ' m1, ' . $this->modules_table . " m2 + WHERE m1.parent_id = 0 + AND (m1.module_id = m2.module_id OR m2.parent_id = m1.module_id) + ORDER BY m1.module_id, m2.module_id ASC"; + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $this->module_categories[(int) $row['module_id']] = $row['module_langname']; + } + $this->db->sql_freeresult($result); + } + + /** + * Get parent module id + * + * @param string|int $parent_id The parent module_id|module_langname + * @param int|string|array $data The module_id, module_langname for existance checking or module data array for adding + * @param bool $throw_exception The flag indicating if exception should be thrown on error + * @return mixed The int parent module_id, an array of int parent module_id values or false + * @throws \phpbb\db\migration\exception + */ + public function get_parent_module_id($parent_id, $data = '', $throw_exception = true) + { + // Allow '' to be sent as 0 + $parent_id = $parent_id ?: 0; + + if (!is_numeric($parent_id)) + { + // Refresh the $module_categories array + $this->get_categories_list(); + + // Search for the parent module_langname + $ids = array_keys($this->module_categories, $parent_id); + + switch (count($ids)) + { + // No parent with the given module_langname exist + case 0: + if ($throw_exception) + { + throw new \phpbb\db\migration\exception('MODULE_NOT_EXIST', $parent_id); + } + + return false; + break; + + // Return the module id + case 1: + return (int) $ids[0]; + break; + + default: + // This represents the old behaviour of phpBB 3.0 + return $ids; + break; + } + } + + return $parent_id; + } +} diff --git a/install/update/old/phpbb/db/migrator.php b/install/update/old/phpbb/db/migrator.php new file mode 100644 index 0000000..2b0c66f --- /dev/null +++ b/install/update/old/phpbb/db/migrator.php @@ -0,0 +1,1037 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db; + +use phpbb\db\output_handler\migrator_output_handler_interface; +use phpbb\db\output_handler\null_migrator_output_handler; +use Symfony\Component\DependencyInjection\ContainerAwareInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* The migrator is responsible for applying new migrations in the correct order. +*/ +class migrator +{ + /** + * @var ContainerInterface + */ + protected $container; + + /** @var \phpbb\config\config */ + protected $config; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\db\tools\tools_interface */ + protected $db_tools; + + /** @var \phpbb\db\migration\helper */ + protected $helper; + + /** @var string */ + protected $table_prefix; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** @var string */ + protected $migrations_table; + + /** + * State of all migrations + * + * (SELECT * FROM migrations table) + * + * @var array + */ + protected $migration_state = array(); + + /** + * Array of all migrations available to be run + * + * @var array + */ + protected $migrations = array(); + + /** + * Array of migrations that have been determined to be fulfillable + * + * @var array + */ + protected $fulfillable_migrations = array(); + + /** + * 'name,' 'class,' and 'state' of the last migration run + * + * 'effectively_installed' set and set to true if the migration was effectively_installed + * + * @var array + */ + protected $last_run_migration = false; + + /** + * The output handler. A null handler is configured by default. + * + * @var migrator_output_handler_interface + */ + protected $output_handler; + + /** + * Constructor of the database migrator + */ + public function __construct(ContainerInterface $container, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\db\tools\tools_interface $db_tools, $migrations_table, $phpbb_root_path, $php_ext, $table_prefix, $tools, \phpbb\db\migration\helper $helper) + { + $this->container = $container; + $this->config = $config; + $this->db = $db; + $this->db_tools = $db_tools; + $this->helper = $helper; + + $this->migrations_table = $migrations_table; + + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->table_prefix = $table_prefix; + + $this->output_handler = new null_migrator_output_handler(); + + foreach ($tools as $tool) + { + $this->tools[$tool->get_name()] = $tool; + } + + $this->tools['dbtools'] = $this->db_tools; + + $this->load_migration_state(); + } + + /** + * Set the output handler. + * + * @param migrator_output_handler_interface $handler The output handler + */ + public function set_output_handler(migrator_output_handler_interface $handler) + { + $this->output_handler = $handler; + } + + /** + * Loads all migrations and their application state from the database. + * + * @return null + */ + public function load_migration_state() + { + $this->migration_state = array(); + + // prevent errors in case the table does not exist yet + $this->db->sql_return_on_error(true); + + $sql = "SELECT * + FROM " . $this->migrations_table; + $result = $this->db->sql_query($sql); + + if (!$this->db->get_sql_error_triggered()) + { + while ($migration = $this->db->sql_fetchrow($result)) + { + $this->migration_state[$migration['migration_name']] = $migration; + + $this->migration_state[$migration['migration_name']]['migration_depends_on'] = unserialize($migration['migration_depends_on']); + $this->migration_state[$migration['migration_name']]['migration_data_state'] = !empty($migration['migration_data_state']) ? unserialize($migration['migration_data_state']) : ''; + } + } + + $this->db->sql_freeresult($result); + + $this->db->sql_return_on_error(false); + } + + /** + * Get an array with information about the last migration run. + * + * The array contains 'name', 'class' and 'state'. 'effectively_installed' is set + * and set to true if the last migration was effectively_installed. + * + * @return array + */ + public function get_last_run_migration() + { + return $this->last_run_migration; + } + + /** + * Sets the list of available migration class names to the given array. + * + * @param array $class_names An array of migration class names + * @return null + */ + public function set_migrations($class_names) + { + foreach ($class_names as $key => $class) + { + if (!self::is_migration($class)) + { + unset($class_names[$key]); + } + } + + $this->migrations = $class_names; + } + + /** + * Get the list of available migration class names + * + * @return array Array of all migrations available to be run + */ + public function get_migrations() + { + return $this->migrations; + } + + /** + * Get the list of available and not installed migration class names + * + * @return array + */ + public function get_installable_migrations() + { + $unfinished_migrations = array(); + + foreach ($this->migrations as $name) + { + if (!isset($this->migration_state[$name]) || + !$this->migration_state[$name]['migration_schema_done'] || + !$this->migration_state[$name]['migration_data_done']) + { + $unfinished_migrations[] = $name; + } + } + + return $unfinished_migrations; + } + + /** + * Runs a single update step from the next migration to be applied. + * + * The update step can either be a schema or a (partial) data update. To + * check if update() needs to be called again use the finished() method. + * + * @return null + */ + public function update() + { + $this->container->get('dispatcher')->disable(); + $this->update_do(); + $this->container->get('dispatcher')->enable(); + } + + /** + * Get a valid migration name from the migration state array in case the + * supplied name is not in the migration state list. + * + * @param string $name Migration name + * @return string Migration name + */ + protected function get_valid_name($name) + { + // Try falling back to a valid migration name with or without leading backslash + if (!isset($this->migration_state[$name])) + { + $prepended_name = ($name[0] == '\\' ? '' : '\\') . $name; + $prefixless_name = $name[0] == '\\' ? substr($name, 1) : $name; + + if (isset($this->migration_state[$prepended_name])) + { + $name = $prepended_name; + } + else if (isset($this->migration_state[$prefixless_name])) + { + $name = $prefixless_name; + } + } + + return $name; + } + + /** + * Effectively runs a single update step from the next migration to be applied. + * + * @return null + */ + protected function update_do() + { + foreach ($this->migrations as $name) + { + $name = $this->get_valid_name($name); + + if (!isset($this->migration_state[$name]) || + !$this->migration_state[$name]['migration_schema_done'] || + !$this->migration_state[$name]['migration_data_done']) + { + if (!$this->try_apply($name)) + { + continue; + } + else + { + return; + } + } + else + { + $this->output_handler->write(array('MIGRATION_EFFECTIVELY_INSTALLED', $name), migrator_output_handler_interface::VERBOSITY_DEBUG); + } + } + } + + /** + * Attempts to apply a step of the given migration or one of its dependencies + * + * @param string $name The class name of the migration + * @return bool Whether any update step was successfully run + * @throws \phpbb\db\migration\exception + */ + protected function try_apply($name) + { + if (!class_exists($name)) + { + $this->output_handler->write(array('MIGRATION_NOT_VALID', $name), migrator_output_handler_interface::VERBOSITY_DEBUG); + return false; + } + + $migration = $this->get_migration($name); + + $state = (isset($this->migration_state[$name])) ? + $this->migration_state[$name] : + array( + 'migration_depends_on' => $migration->depends_on(), + 'migration_schema_done' => false, + 'migration_data_done' => false, + 'migration_data_state' => '', + 'migration_start_time' => 0, + 'migration_end_time' => 0, + ); + + if (!empty($state['migration_depends_on'])) + { + $this->output_handler->write(array('MIGRATION_APPLY_DEPENDENCIES', $name), migrator_output_handler_interface::VERBOSITY_DEBUG); + } + + foreach ($state['migration_depends_on'] as $depend) + { + $depend = $this->get_valid_name($depend); + + // Test all possible namings before throwing exception + if ($this->unfulfillable($depend) !== false) + { + throw new \phpbb\db\migration\exception('MIGRATION_NOT_FULFILLABLE', $name, $depend); + } + + if (!isset($this->migration_state[$depend]) || + !$this->migration_state[$depend]['migration_schema_done'] || + !$this->migration_state[$depend]['migration_data_done']) + { + return $this->try_apply($depend); + } + } + + $this->last_run_migration = array( + 'name' => $name, + 'class' => $migration, + 'state' => $state, + 'task' => '', + ); + + if (!isset($this->migration_state[$name])) + { + if ($state['migration_start_time'] == 0 && $migration->effectively_installed()) + { + $state = array( + 'migration_depends_on' => $migration->depends_on(), + 'migration_schema_done' => true, + 'migration_data_done' => true, + 'migration_data_state' => '', + 'migration_start_time' => 0, + 'migration_end_time' => 0, + ); + + $this->last_run_migration['effectively_installed'] = true; + + $this->output_handler->write(array('MIGRATION_EFFECTIVELY_INSTALLED', $name), migrator_output_handler_interface::VERBOSITY_VERBOSE); + } + else + { + $state['migration_start_time'] = time(); + } + } + + $this->set_migration_state($name, $state); + + if (!$state['migration_schema_done']) + { + $verbosity = empty($state['migration_data_state']) ? + migrator_output_handler_interface::VERBOSITY_VERBOSE : migrator_output_handler_interface::VERBOSITY_DEBUG; + $this->output_handler->write(array('MIGRATION_SCHEMA_RUNNING', $name), $verbosity); + + $this->last_run_migration['task'] = 'process_schema_step'; + + $total_time = (is_array($state['migration_data_state']) && isset($state['migration_data_state']['_total_time'])) ? + $state['migration_data_state']['_total_time'] : 0.0; + $elapsed_time = microtime(true); + + $steps = $this->helper->get_schema_steps($migration->update_schema()); + $result = $this->process_data_step($steps, $state['migration_data_state']); + + $elapsed_time = microtime(true) - $elapsed_time; + $total_time += $elapsed_time; + + if (is_array($result)) + { + $result['_total_time'] = $total_time; + } + + $state['migration_data_state'] = ($result === true) ? '' : $result; + $state['migration_schema_done'] = ($result === true); + + if ($state['migration_schema_done']) + { + $this->output_handler->write(array('MIGRATION_SCHEMA_DONE', $name, $total_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->output_handler->write(array('MIGRATION_SCHEMA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } + } + else if (!$state['migration_data_done']) + { + try + { + $verbosity = empty($state['migration_data_state']) ? + migrator_output_handler_interface::VERBOSITY_VERBOSE : migrator_output_handler_interface::VERBOSITY_DEBUG; + $this->output_handler->write(array('MIGRATION_DATA_RUNNING', $name), $verbosity); + + $this->last_run_migration['task'] = 'process_data_step'; + + $total_time = (is_array($state['migration_data_state']) && isset($state['migration_data_state']['_total_time'])) ? + $state['migration_data_state']['_total_time'] : 0.0; + $elapsed_time = microtime(true); + + $result = $this->process_data_step($migration->update_data(), $state['migration_data_state']); + + $elapsed_time = microtime(true) - $elapsed_time; + $total_time += $elapsed_time; + + if (is_array($result)) + { + $result['_total_time'] = $total_time; + } + + $state['migration_data_state'] = ($result === true) ? '' : $result; + $state['migration_data_done'] = ($result === true); + $state['migration_end_time'] = ($result === true) ? time() : 0; + + if ($state['migration_data_done']) + { + $this->output_handler->write(array('MIGRATION_DATA_DONE', $name, $total_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->output_handler->write(array('MIGRATION_DATA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } + } + catch (\phpbb\db\migration\exception $e) + { + // Reset data state and revert the schema changes + $state['migration_data_state'] = ''; + $this->set_migration_state($name, $state); + + $this->revert_do($name); + + throw $e; + } + } + + $this->set_migration_state($name, $state); + + return true; + } + + /** + * Runs a single revert step from the last migration installed + * + * YOU MUST ADD/SET ALL MIGRATIONS THAT COULD BE DEPENDENT ON THE MIGRATION TO REVERT TO BEFORE CALLING THIS METHOD! + * The revert step can either be a schema or a (partial) data revert. To + * check if revert() needs to be called again use the migration_state() method. + * + * @param string $migration String migration name to revert (including any that depend on this migration) + */ + public function revert($migration) + { + $this->container->get('dispatcher')->disable(); + $this->revert_do($migration); + $this->container->get('dispatcher')->enable(); + } + + /** + * Effectively runs a single revert step from the last migration installed + * + * @param string $migration String migration name to revert (including any that depend on this migration) + * @return null + */ + protected function revert_do($migration) + { + if (!isset($this->migration_state[$migration])) + { + // Not installed + return; + } + + foreach ($this->migrations as $name) + { + $state = $this->migration_state($name); + + if ($state && in_array($migration, $state['migration_depends_on']) && ($state['migration_schema_done'] || $state['migration_data_done'])) + { + $this->revert_do($name); + return; + } + } + + $this->try_revert($migration); + } + + /** + * Attempts to revert a step of the given migration or one of its dependencies + * + * @param string $name The class name of the migration + * @return bool Whether any update step was successfully run + */ + protected function try_revert($name) + { + if (!class_exists($name)) + { + return false; + } + + $migration = $this->get_migration($name); + + $state = $this->migration_state[$name]; + + $this->last_run_migration = array( + 'name' => $name, + 'class' => $migration, + 'task' => '', + ); + + if ($state['migration_data_done']) + { + $verbosity = empty($state['migration_data_state']) ? + migrator_output_handler_interface::VERBOSITY_VERBOSE : migrator_output_handler_interface::VERBOSITY_DEBUG; + $this->output_handler->write(array('MIGRATION_REVERT_DATA_RUNNING', $name), $verbosity); + + $total_time = (is_array($state['migration_data_state']) && isset($state['migration_data_state']['_total_time'])) ? + $state['migration_data_state']['_total_time'] : 0.0; + $elapsed_time = microtime(true); + + $steps = array_merge($this->helper->reverse_update_data($migration->update_data()), $migration->revert_data()); + $result = $this->process_data_step($steps, $state['migration_data_state']); + + $elapsed_time = microtime(true) - $elapsed_time; + $total_time += $elapsed_time; + + if (is_array($result)) + { + $result['_total_time'] = $total_time; + } + + $state['migration_data_state'] = ($result === true) ? '' : $result; + $state['migration_data_done'] = ($result === true) ? false : true; + + $this->set_migration_state($name, $state); + + if (!$state['migration_data_done']) + { + $this->output_handler->write(array('MIGRATION_REVERT_DATA_DONE', $name, $total_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->output_handler->write(array('MIGRATION_REVERT_DATA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } + } + else if ($state['migration_schema_done']) + { + $verbosity = empty($state['migration_data_state']) ? + migrator_output_handler_interface::VERBOSITY_VERBOSE : migrator_output_handler_interface::VERBOSITY_DEBUG; + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_RUNNING', $name), $verbosity); + + $total_time = (is_array($state['migration_data_state']) && isset($state['migration_data_state']['_total_time'])) ? + $state['migration_data_state']['_total_time'] : 0.0; + $elapsed_time = microtime(true); + + $steps = $this->helper->get_schema_steps($migration->revert_schema()); + $result = $this->process_data_step($steps, $state['migration_data_state']); + + $elapsed_time = microtime(true) - $elapsed_time; + $total_time += $elapsed_time; + + if (is_array($result)) + { + $result['_total_time'] = $total_time; + } + + $state['migration_data_state'] = ($result === true) ? '' : $result; + $state['migration_schema_done'] = ($result === true) ? false : true; + + if (!$state['migration_schema_done']) + { + $sql = 'DELETE FROM ' . $this->migrations_table . " + WHERE migration_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + + $this->last_run_migration = false; + unset($this->migration_state[$name]); + + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_DONE', $name, $total_time), migrator_output_handler_interface::VERBOSITY_NORMAL); + } + else + { + $this->set_migration_state($name, $state); + + $this->output_handler->write(array('MIGRATION_REVERT_SCHEMA_IN_PROGRESS', $name, $elapsed_time), migrator_output_handler_interface::VERBOSITY_VERY_VERBOSE); + } + } + + return true; + } + + /** + * Process the data step of the migration + * + * @param array $steps The steps to run + * @param bool|string $state Current state of the migration + * @param bool $revert true to revert a data step + * @return bool|string migration state. True if completed, serialized array if not finished + * @throws \phpbb\db\migration\exception + */ + protected function process_data_step($steps, $state, $revert = false) + { + if (count($steps) === 0) + { + return true; + } + + $state = is_array($state) ? $state : false; + + // reverse order of steps if reverting + if ($revert === true) + { + $steps = array_reverse($steps); + } + + $step = $last_result = 0; + if ($state) + { + $step = $state['step']; + + // We send the result from last time to the callable function + $last_result = $state['result']; + } + + try + { + // Result will be null or true if everything completed correctly + // Stop after each update step, to let the updater control the script runtime + $result = $this->run_step($steps[$step], $last_result, $revert); + if (($result !== null && $result !== true) || $step + 1 < count($steps)) + { + return array( + 'result' => $result, + // Move on if the last call finished + 'step' => ($result !== null && $result !== true) ? $step : $step + 1, + ); + } + } + catch (\phpbb\db\migration\exception $e) + { + // We should try rolling back here + foreach ($steps as $reverse_step_identifier => $reverse_step) + { + // If we've reached the current step we can break because we reversed everything that was run + if ($reverse_step_identifier == $step) + { + break; + } + + // Reverse the step that was run + $result = $this->run_step($reverse_step, false, !$revert); + } + + throw $e; + } + + return true; + } + + /** + * Run a single step + * + * An exception should be thrown if an error occurs + * + * @param mixed $step Data step from migration + * @param mixed $last_result Result to pass to the callable (only for 'custom' method) + * @param bool $reverse False to install, True to attempt uninstallation by reversing the call + * @return null + */ + protected function run_step($step, $last_result = 0, $reverse = false) + { + $callable_and_parameters = $this->get_callable_from_step($step, $last_result, $reverse); + + if ($callable_and_parameters === false) + { + return; + } + + $callable = $callable_and_parameters[0]; + $parameters = $callable_and_parameters[1]; + + return call_user_func_array($callable, $parameters); + } + + /** + * Get a callable statement from a data step + * + * @param array $step Data step from migration + * @param mixed $last_result Result to pass to the callable (only for 'custom' method) + * @param bool $reverse False to install, True to attempt uninstallation by reversing the call + * @return array Array with parameters for call_user_func_array(), 0 is the callable, 1 is parameters + * @throws \phpbb\db\migration\exception + */ + protected function get_callable_from_step(array $step, $last_result = 0, $reverse = false) + { + $type = $step[0]; + $parameters = $step[1]; + + $parts = explode('.', $type); + + $class = $parts[0]; + $method = false; + + if (isset($parts[1])) + { + $method = $parts[1]; + } + + switch ($class) + { + case 'if': + if (!isset($parameters[0])) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_CONDITION', $step); + } + + if (!isset($parameters[1])) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_MISSING_STEP', $step); + } + + if ($reverse) + { + // We might get unexpected results when trying + // to revert this, so just avoid it + return false; + } + + $condition = $parameters[0]; + + if (!$condition || (is_array($condition) && !$this->run_step($condition, $last_result, $reverse))) + { + return false; + } + + $step = $parameters[1]; + + return $this->get_callable_from_step($step); + break; + + case 'custom': + if (!is_callable($parameters[0])) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_CUSTOM_NOT_CALLABLE', $step); + } + + if ($reverse) + { + return false; + } + else + { + return array( + $parameters[0], + array($last_result), + ); + } + break; + + default: + if (!$method) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNKNOWN_TYPE', $step); + } + + if (!isset($this->tools[$class])) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_TOOL', $step); + } + + if (!method_exists(get_class($this->tools[$class]), $method)) + { + throw new \phpbb\db\migration\exception('MIGRATION_INVALID_DATA_UNDEFINED_METHOD', $step); + } + + // Attempt to reverse operations + if ($reverse) + { + array_unshift($parameters, $method); + + return array( + array($this->tools[$class], 'reverse'), + $parameters, + ); + } + + return array( + array($this->tools[$class], $method), + $parameters, + ); + break; + } + } + + /** + * Insert/Update migration row into the database + * + * @param string $name Name of the migration + * @param array $state + * @return null + */ + protected function set_migration_state($name, $state) + { + $migration_row = $state; + $migration_row['migration_depends_on'] = serialize($state['migration_depends_on']); + $migration_row['migration_data_state'] = !empty($state['migration_data_state']) ? serialize($state['migration_data_state']) : ''; + + if (isset($this->migration_state[$name])) + { + $sql = 'UPDATE ' . $this->migrations_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $migration_row) . " + WHERE migration_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + } + else + { + $migration_row['migration_name'] = $name; + $sql = 'INSERT INTO ' . $this->migrations_table . ' + ' . $this->db->sql_build_array('INSERT', $migration_row); + $this->db->sql_query($sql); + } + + $this->migration_state[$name] = $state; + + $this->last_run_migration['state'] = $state; + } + + /** + * Checks if a migration's dependencies can even theoretically be satisfied. + * + * @param string $name The class name of the migration + * @return bool|string False if fulfillable, string of missing migration name if unfulfillable + */ + public function unfulfillable($name) + { + $name = $this->get_valid_name($name); + + if (isset($this->migration_state[$name]) || isset($this->fulfillable_migrations[$name])) + { + return false; + } + + if (!class_exists($name)) + { + return $name; + } + + $migration = $this->get_migration($name); + $depends = $migration->depends_on(); + + foreach ($depends as $depend) + { + $depend = $this->get_valid_name($depend); + $unfulfillable = $this->unfulfillable($depend); + if ($unfulfillable !== false) + { + return $unfulfillable; + } + } + $this->fulfillable_migrations[$name] = true; + + return false; + } + + /** + * Checks whether all available, fulfillable migrations have been applied. + * + * @return bool Whether the migrations have been applied + */ + public function finished() + { + foreach ($this->migrations as $name) + { + if (!isset($this->migration_state[$name])) + { + // skip unfulfillable migrations, but fulfillables mean we + // are not finished yet + if ($this->unfulfillable($name) !== false) + { + continue; + } + + return false; + } + + $migration = $this->migration_state[$name]; + + if (!$migration['migration_schema_done'] || !$migration['migration_data_done']) + { + return false; + } + } + + return true; + } + + /** + * Gets a migration state (whether it is installed and to what extent) + * + * @param string $migration String migration name to check if it is installed + * @return bool|array False if the migration has not at all been installed, array + */ + public function migration_state($migration) + { + if (!isset($this->migration_state[$migration])) + { + return false; + } + + return $this->migration_state[$migration]; + } + + /** + * Helper to get a migration + * + * @param string $name Name of the migration + * @return \phpbb\db\migration\migration + */ + protected function get_migration($name) + { + $migration = new $name($this->config, $this->db, $this->db_tools, $this->phpbb_root_path, $this->php_ext, $this->table_prefix); + + if ($migration instanceof ContainerAwareInterface) + { + $migration->setContainer($this->container); + } + + return $migration; + } + + /** + * This function adds all migrations sent to it to the migrations table + * + * THIS SHOULD NOT GENERALLY BE USED! THIS IS FOR THE PHPBB INSTALLER. + * THIS WILL THROW ERRORS IF MIGRATIONS ALREADY EXIST IN THE TABLE, DO NOT CALL MORE THAN ONCE! + * + * @param array $migrations Array of migrations (names) to add to the migrations table + * @return null + */ + public function populate_migrations($migrations) + { + foreach ($migrations as $name) + { + if ($this->migration_state($name) === false) + { + $state = array( + 'migration_depends_on' => $name::depends_on(), + 'migration_schema_done' => true, + 'migration_data_done' => true, + 'migration_data_state' => '', + 'migration_start_time' => time(), + 'migration_end_time' => time(), + ); + $this->set_migration_state($name, $state); + } + } + } + + /** + * Creates the migrations table if it does not exist. + * @return null + */ + public function create_migrations_table() + { + // Make sure migrations have been installed. + if (!$this->db_tools->sql_table_exists($this->table_prefix . 'migrations')) + { + $this->db_tools->sql_create_table($this->table_prefix . 'migrations', array( + 'COLUMNS' => array( + 'migration_name' => array('VCHAR', ''), + 'migration_depends_on' => array('TEXT', ''), + 'migration_schema_done' => array('BOOL', 0), + 'migration_data_done' => array('BOOL', 0), + 'migration_data_state' => array('TEXT', ''), + 'migration_start_time' => array('TIMESTAMP', 0), + 'migration_end_time' => array('TIMESTAMP', 0), + ), + 'PRIMARY_KEY' => 'migration_name', + )); + } + } + + /** + * Check if a class is a migration. + * + * @param string $migration A migration class name + * @return bool Return true if class is a migration, false otherwise + */ + static public function is_migration($migration) + { + if (class_exists($migration)) + { + // Migration classes should extend the abstract class + // phpbb\db\migration\migration (which implements the + // migration_interface) and be instantiable. + $reflector = new \ReflectionClass($migration); + if ($reflector->implementsInterface('\phpbb\db\migration\migration_interface') && $reflector->isInstantiable()) + { + return true; + } + } + + return false; + } +} diff --git a/install/update/old/phpbb/db/tools/mssql.php b/install/update/old/phpbb/db/tools/mssql.php new file mode 100644 index 0000000..cbedf9a --- /dev/null +++ b/install/update/old/phpbb/db/tools/mssql.php @@ -0,0 +1,880 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\tools; + +/** + * Database Tools for handling cross-db actions such as altering columns, etc. + * Currently not supported is returning SQL for creating tables. + */ +class mssql extends tools +{ + /** + * Is the used MS SQL Server a SQL Server 2000? + * @var bool + */ + protected $is_sql_server_2000; + + /** + * Get the column types for mssql based databases + * + * @return array + */ + public static function get_dbms_type_map() + { + return array( + 'mssql' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'ULINT' => '[int]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[nvarchar] (100)', + 'STEXT_UNI' => '[nvarchar] (255)', + 'TEXT_UNI' => '[nvarchar] (4000)', + 'MTEXT_UNI' => '[ntext]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[nvarchar] (255)', + 'VCHAR_UNI:'=> '[nvarchar] (%d)', + 'VCHAR_CI' => '[nvarchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + + 'mssqlnative' => array( + 'INT:' => '[int]', + 'BINT' => '[float]', + 'ULINT' => '[int]', + 'UINT' => '[int]', + 'UINT:' => '[int]', + 'TINT:' => '[int]', + 'USINT' => '[int]', + 'BOOL' => '[int]', + 'VCHAR' => '[varchar] (255)', + 'VCHAR:' => '[varchar] (%d)', + 'CHAR:' => '[char] (%d)', + 'XSTEXT' => '[varchar] (1000)', + 'STEXT' => '[varchar] (3000)', + 'TEXT' => '[varchar] (8000)', + 'MTEXT' => '[text]', + 'XSTEXT_UNI'=> '[nvarchar] (100)', + 'STEXT_UNI' => '[nvarchar] (255)', + 'TEXT_UNI' => '[nvarchar] (4000)', + 'MTEXT_UNI' => '[ntext]', + 'TIMESTAMP' => '[int]', + 'DECIMAL' => '[float]', + 'DECIMAL:' => '[float]', + 'PDECIMAL' => '[float]', + 'PDECIMAL:' => '[float]', + 'VCHAR_UNI' => '[nvarchar] (255)', + 'VCHAR_UNI:'=> '[nvarchar] (%d)', + 'VCHAR_CI' => '[nvarchar] (255)', + 'VARBINARY' => '[varchar] (255)', + ), + ); + } + + /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param bool $return_statements True if only statements should be returned and no SQL being executed + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false) + { + parent::__construct($db, $return_statements); + + // Determine mapping database type + switch ($this->db->get_sql_layer()) + { + case 'mssql_odbc': + $this->sql_layer = 'mssql'; + break; + + case 'mssqlnative': + $this->sql_layer = 'mssqlnative'; + break; + } + + $this->dbms_type_map = self::get_dbms_type_map(); + } + + /** + * {@inheritDoc} + */ + function sql_list_tables() + { + $sql = "SELECT name + FROM sysobjects + WHERE type='U'"; + $result = $this->db->sql_query($sql); + + $tables = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $name = current($row); + $tables[$name] = $name; + } + $this->db->sql_freeresult($result); + + return $tables; + } + + /** + * {@inheritDoc} + */ + function sql_create_table($table_name, $table_data) + { + // holds the DDL for a column + $columns = $statements = array(); + + if ($this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // Begin transaction + $statements[] = 'begin'; + + // Determine if we have created a PRIMARY KEY in the earliest + $primary_key_gen = false; + + // Determine if the table requires a sequence + $create_sequence = false; + + // Begin table sql statement + $table_sql = 'CREATE TABLE [' . $table_name . '] (' . "\n"; + + if (!isset($table_data['PRIMARY_KEY'])) + { + $table_data['COLUMNS']['mssqlindex'] = array('UINT', null, 'auto_increment'); + $table_data['PRIMARY_KEY'] = 'mssqlindex'; + } + + // Iterate through the columns to create a table + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // here lies an array, filled with information compiled on the column's data + $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + + if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); + } + + // here we add the definition of the new column to the list of columns + $columns[] = "\t [{$column_name}] " . $prepared_column['column_type_sql_default']; + + // see if we have found a primary key set due to a column definition if we have found it, we can stop looking + if (!$primary_key_gen) + { + $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; + } + + // create sequence DDL based off of the existance of auto incrementing columns + if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) + { + $create_sequence = $column_name; + } + } + + // this makes up all the columns in the create table statement + $table_sql .= implode(",\n", $columns); + + // Close the table for two DBMS and add to the statements + $table_sql .= "\n);"; + $statements[] = $table_sql; + + // we have yet to create a primary key for this table, + // this means that we can add the one we really wanted instead + if (!$primary_key_gen) + { + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $primary_key_stmts = $this->sql_create_primary_key($table_name, $table_data['PRIMARY_KEY']); + foreach ($primary_key_stmts as $pk_stmt) + { + $statements[] = $pk_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); + + foreach ($key_stmts as $key_stmt) + { + $statements[] = $key_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Commit Transaction + $statements[] = 'commit'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_list_columns($table_name) + { + $columns = array(); + + $sql = "SELECT c.name + FROM syscolumns c + LEFT JOIN sysobjects o ON c.id = o.id + WHERE o.name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $column = strtolower(current($row)); + $columns[$column] = $column; + } + $this->db->sql_freeresult($result); + + return $columns; + } + + /** + * {@inheritDoc} + */ + function sql_index_exists($table_name, $index_name) + { + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['TYPE'] == 3) + { + if (strtolower($row['INDEX_NAME']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_unique_index_exists($table_name, $index_name) + { + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // Usually NON_UNIQUE is the column we want to check, but we allow for both + if ($row['TYPE'] == 3) + { + if (strtolower($row['INDEX_NAME']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_prepare_column_data($table_name, $column_name, $column_data) + { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + // Get type + list($column_type, ) = $this->get_column_type($column_data[0]); + + // Adjust default value if db-dependent specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; + } + + $sql = ''; + + $return_array = array(); + + $sql .= " {$column_type} "; + $sql_default = " {$column_type} "; + + // For adding columns we need the default definition + if (!is_null($column_data[1])) + { + // For hexadecimal values do not use single quotes + if (strpos($column_data[1], '0x') === 0) + { + $return_array['default'] = 'DEFAULT (' . $column_data[1] . ') '; + $sql_default .= $return_array['default']; + } + else + { + $return_array['default'] = 'DEFAULT (' . ((is_numeric($column_data[1])) ? $column_data[1] : "'{$column_data[1]}'") . ') '; + $sql_default .= $return_array['default']; + } + } + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + // $sql .= 'IDENTITY (1, 1) '; + $sql_default .= 'IDENTITY (1, 1) '; + } + + $return_array['textimage'] = $column_type === '[text]'; + + if (!is_null($column_data[1]) || (isset($column_data[2]) && $column_data[2] == 'auto_increment')) + { + $sql .= 'NOT NULL'; + $sql_default .= 'NOT NULL'; + } + else + { + $sql .= 'NULL'; + $sql_default .= 'NULL'; + } + + $return_array['column_type_sql_default'] = $sql_default; + + $return_array['column_type_sql'] = $sql; + + return $return_array; + } + + /** + * {@inheritDoc} + */ + function sql_column_add($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + // Does not support AFTER, only through temporary table + $statements[] = 'ALTER TABLE [' . $table_name . '] ADD [' . $column_name . '] ' . $column_data['column_type_sql_default']; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_column_remove($table_name, $column_name, $inline = false) + { + $statements = array(); + + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $indexes = $this->get_existing_indexes($table_name, $column_name); + $indexes = array_merge($indexes, $this->get_existing_indexes($table_name, $column_name, true)); + + // Drop any indexes + $recreate_indexes = array(); + if (!empty($indexes)) + { + foreach ($indexes as $index_name => $index_data) + { + $result = $this->sql_index_drop($table_name, $index_name); + $statements = array_merge($statements, $result); + if (count($index_data) > 1) + { + // Remove this column from the index and recreate it + $recreate_indexes[$index_name] = array_diff($index_data, array($column_name)); + } + } + } + + // Drop primary keys depending on this column + $result = $this->mssql_get_drop_default_primary_key_queries($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Drop default value constraint + $result = $this->mssql_get_drop_default_constraints_queries($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Remove the column + $statements[] = 'ALTER TABLE [' . $table_name . '] DROP COLUMN [' . $column_name . ']'; + + if (!empty($recreate_indexes)) + { + // Recreate indexes after we removed the column + foreach ($recreate_indexes as $index_name => $index_data) + { + $result = $this->sql_create_index($table_name, $index_name, $index_data); + $statements = array_merge($statements, $result); + } + } + + $this->return_statements = $old_return_statements; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_index_drop($table_name, $index_name) + { + $statements = array(); + + $statements[] = 'DROP INDEX [' . $table_name . '].[' . $index_name . ']'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_table_drop($table_name) + { + $statements = array(); + + if (!$this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // the most basic operation, get rid of the table + $statements[] = 'DROP TABLE ' . $table_name; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_primary_key($table_name, $column, $inline = false) + { + $statements = array(); + + $sql = "ALTER TABLE [{$table_name}] WITH NOCHECK ADD "; + $sql .= "CONSTRAINT [PK_{$table_name}] PRIMARY KEY CLUSTERED ("; + $sql .= '[' . implode("],\n\t\t[", $column) . ']'; + $sql .= ')'; + + $statements[] = $sql; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_unique_index($table_name, $index_name, $column) + { + $statements = array(); + + if ($this->mssql_is_sql_server_2000()) + { + $this->check_index_name_length($table_name, $index_name); + } + + $statements[] = 'CREATE UNIQUE INDEX [' . $index_name . '] ON [' . $table_name . ']([' . implode('], [', $column) . '])'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + // remove index length + $column = preg_replace('#:.*$#', '', $column); + + $statements[] = 'CREATE INDEX [' . $index_name . '] ON [' . $table_name . ']([' . implode('], [', $column) . '])'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritdoc} + */ + protected function get_max_index_name_length() + { + if ($this->mssql_is_sql_server_2000()) + { + return parent::get_max_index_name_length(); + } + else + { + return 128; + } + } + + /** + * {@inheritDoc} + */ + function sql_list_index($table_name) + { + $index_array = array(); + $sql = "EXEC sp_statistics '$table_name'"; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['TYPE'] == 3) + { + $index_array[] = strtolower($row['INDEX_NAME']); + } + } + $this->db->sql_freeresult($result); + + return $index_array; + } + + /** + * {@inheritDoc} + */ + function sql_column_change($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $indexes = $this->get_existing_indexes($table_name, $column_name); + $unique_indexes = $this->get_existing_indexes($table_name, $column_name, true); + + // Drop any indexes + if (!empty($indexes) || !empty($unique_indexes)) + { + $drop_indexes = array_merge(array_keys($indexes), array_keys($unique_indexes)); + foreach ($drop_indexes as $index_name) + { + $result = $this->sql_index_drop($table_name, $index_name); + $statements = array_merge($statements, $result); + } + } + + // Drop default value constraint + $result = $this->mssql_get_drop_default_constraints_queries($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Change the column + $statements[] = 'ALTER TABLE [' . $table_name . '] ALTER COLUMN [' . $column_name . '] ' . $column_data['column_type_sql']; + + if (!empty($column_data['default']) && !$this->mssql_is_column_identity($table_name, $column_name)) + { + // Add new default value constraint + $statements[] = 'ALTER TABLE [' . $table_name . '] ADD CONSTRAINT [DF_' . $table_name . '_' . $column_name . '_1] ' . $column_data['default'] . ' FOR [' . $column_name . ']'; + } + + if (!empty($indexes)) + { + // Recreate indexes after we changed the column + foreach ($indexes as $index_name => $index_data) + { + $result = $this->sql_create_index($table_name, $index_name, $index_data); + $statements = array_merge($statements, $result); + } + } + + if (!empty($unique_indexes)) + { + // Recreate unique indexes after we changed the column + foreach ($unique_indexes as $index_name => $index_data) + { + $result = $this->sql_create_unique_index($table_name, $index_name, $index_data); + $statements = array_merge($statements, $result); + } + } + + $this->return_statements = $old_return_statements; + + return $this->_sql_run_sql($statements); + } + + /** + * Get queries to drop the default constraints of a column + * + * We need to drop the default constraints of a column, + * before being able to change their type or deleting them. + * + * @param string $table_name + * @param string $column_name + * @return array Array with SQL statements + */ + protected function mssql_get_drop_default_constraints_queries($table_name, $column_name) + { + $statements = array(); + if ($this->mssql_is_sql_server_2000()) + { + // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx + // Deprecated in SQL Server 2005 + $sql = "SELECT so.name AS def_name + FROM sysobjects so + JOIN sysconstraints sc ON so.id = sc.constid + WHERE object_name(so.parent_obj) = '{$table_name}' + AND so.xtype = 'D' + AND sc.colid = (SELECT colid FROM syscolumns + WHERE id = object_id('{$table_name}') + AND name = '{$column_name}')"; + } + else + { + $sql = "SELECT dobj.name AS def_name + FROM sys.columns col + LEFT OUTER JOIN sys.objects dobj ON (dobj.object_id = col.default_object_id AND dobj.type = 'D') + WHERE col.object_id = object_id('{$table_name}') + AND col.name = '{$column_name}' + AND dobj.name IS NOT NULL"; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $statements[] = 'ALTER TABLE [' . $table_name . '] DROP CONSTRAINT [' . $row['def_name'] . ']'; + } + $this->db->sql_freeresult($result); + + return $statements; + } + + /** + * Get queries to drop the primary keys depending on the specified column + * + * We need to drop primary keys depending on this column before being able + * to delete them. + * + * @param string $table_name + * @param string $column_name + * @return array Array with SQL statements + */ + protected function mssql_get_drop_default_primary_key_queries($table_name, $column_name) + { + $statements = array(); + + $sql = "SELECT ccu.CONSTRAINT_NAME, ccu.COLUMN_NAME + FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc + JOIN INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE ccu ON tc.CONSTRAINT_NAME = ccu.Constraint_name + WHERE tc.TABLE_NAME = '{$table_name}' + AND tc.CONSTRAINT_TYPE = 'Primary Key' + AND ccu.COLUMN_NAME = '{$column_name}'"; + + $result = $this->db->sql_query($sql); + + while ($primary_key = $this->db->sql_fetchrow($result)) + { + $statements[] = 'ALTER TABLE [' . $table_name . '] DROP CONSTRAINT [' . $primary_key['CONSTRAINT_NAME'] . ']'; + } + $this->db->sql_freeresult($result); + + return $statements; + } + + /** + * Checks to see if column is an identity column + * + * Identity columns cannot have defaults set for them. + * + * @param string $table_name + * @param string $column_name + * @return bool true if identity, false if not + */ + protected function mssql_is_column_identity($table_name, $column_name) + { + if ($this->mssql_is_sql_server_2000()) + { + // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx + // Deprecated in SQL Server 2005 + $sql = "SELECT COLUMNPROPERTY(object_id('{$table_name}'), '{$column_name}', 'IsIdentity') AS is_identity"; + } + else + { + $sql = "SELECT is_identity FROM sys.columns + WHERE object_id = object_id('{$table_name}') + AND name = '{$column_name}'"; + } + + $result = $this->db->sql_query($sql); + $is_identity = $this->db->sql_fetchfield('is_identity'); + $this->db->sql_freeresult($result); + + return (bool) $is_identity; + } + + /** + * Get a list with existing indexes for the column + * + * @param string $table_name + * @param string $column_name + * @param bool $unique Should we get unique indexes or normal ones + * @return array Array with Index name => columns + */ + public function get_existing_indexes($table_name, $column_name, $unique = false) + { + $existing_indexes = array(); + if ($this->mssql_is_sql_server_2000()) + { + // http://msdn.microsoft.com/en-us/library/aa175912%28v=sql.80%29.aspx + // Deprecated in SQL Server 2005 + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name + FROM sysindexes ix + INNER JOIN sysindexkeys ixc + ON ixc.id = ix.id + AND ixc.indid = ix.indid + INNER JOIN syscolumns cols + ON cols.colid = ixc.colid + AND cols.id = ix.id + WHERE ix.id = object_id('{$table_name}') + AND cols.name = '{$column_name}' + AND INDEXPROPERTY(ix.id, ix.name, 'IsUnique') = " . ($unique ? '1' : '0'); + } + else + { + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name + FROM sys.indexes ix + INNER JOIN sys.index_columns ixc + ON ixc.object_id = ix.object_id + AND ixc.index_id = ix.index_id + INNER JOIN sys.columns cols + ON cols.column_id = ixc.column_id + AND cols.object_id = ix.object_id + WHERE ix.object_id = object_id('{$table_name}') + AND cols.name = '{$column_name}' + AND ix.is_primary_key = 0 + AND ix.is_unique = " . ($unique ? '1' : '0'); + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (!isset($row['is_unique']) || ($unique && $row['is_unique'] == 'UNIQUE') || (!$unique && $row['is_unique'] == 'NONUNIQUE')) + { + $existing_indexes[$row['phpbb_index_name']] = array(); + } + } + $this->db->sql_freeresult($result); + + if (empty($existing_indexes)) + { + return array(); + } + + if ($this->mssql_is_sql_server_2000()) + { + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name + FROM sysindexes ix + INNER JOIN sysindexkeys ixc + ON ixc.id = ix.id + AND ixc.indid = ix.indid + INNER JOIN syscolumns cols + ON cols.colid = ixc.colid + AND cols.id = ix.id + WHERE ix.id = object_id('{$table_name}') + AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes)); + } + else + { + $sql = "SELECT DISTINCT ix.name AS phpbb_index_name, cols.name AS phpbb_column_name + FROM sys.indexes ix + INNER JOIN sys.index_columns ixc + ON ixc.object_id = ix.object_id + AND ixc.index_id = ix.index_id + INNER JOIN sys.columns cols + ON cols.column_id = ixc.column_id + AND cols.object_id = ix.object_id + WHERE ix.object_id = object_id('{$table_name}') + AND " . $this->db->sql_in_set('ix.name', array_keys($existing_indexes)); + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $existing_indexes[$row['phpbb_index_name']][] = $row['phpbb_column_name']; + } + $this->db->sql_freeresult($result); + + return $existing_indexes; + } + + /** + * Is the used MS SQL Server a SQL Server 2000? + * + * @return bool + */ + protected function mssql_is_sql_server_2000() + { + if ($this->is_sql_server_2000 === null) + { + $sql = "SELECT CAST(SERVERPROPERTY('productversion') AS VARCHAR(25)) AS mssql_version"; + $result = $this->db->sql_query($sql); + $properties = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + $this->is_sql_server_2000 = $properties['mssql_version'][0] == '8'; + } + + return $this->is_sql_server_2000; + } + +} diff --git a/install/update/old/phpbb/db/tools/postgres.php b/install/update/old/phpbb/db/tools/postgres.php new file mode 100644 index 0000000..077d6e0 --- /dev/null +++ b/install/update/old/phpbb/db/tools/postgres.php @@ -0,0 +1,614 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\db\tools; + +/** + * Database Tools for handling cross-db actions such as altering columns, etc. + * Currently not supported is returning SQL for creating tables. + */ +class postgres extends tools +{ + /** + * Get the column types for postgres only + * + * @return array + */ + public static function get_dbms_type_map() + { + return array( + 'postgres' => array( + 'INT:' => 'INT4', + 'BINT' => 'INT8', + 'ULINT' => 'INT4', // unsigned + 'UINT' => 'INT4', // unsigned + 'UINT:' => 'INT4', // unsigned + 'USINT' => 'INT2', // unsigned + 'BOOL' => 'INT2', // unsigned + 'TINT:' => 'INT2', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'varchar(1000)', + 'STEXT' => 'varchar(3000)', + 'TEXT' => 'varchar(8000)', + 'MTEXT' => 'TEXT', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT_UNI' => 'varchar(4000)', + 'MTEXT_UNI' => 'TEXT', + 'TIMESTAMP' => 'INT4', // unsigned + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar_ci', + 'VARBINARY' => 'bytea', + ), + ); + } + + /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param bool $return_statements True if only statements should be returned and no SQL being executed + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false) + { + parent::__construct($db, $return_statements); + + // Determine mapping database type + $this->sql_layer = 'postgres'; + + $this->dbms_type_map = self::get_dbms_type_map(); + } + + /** + * {@inheritDoc} + */ + function sql_list_tables() + { + $sql = 'SELECT relname + FROM pg_stat_user_tables'; + $result = $this->db->sql_query($sql); + + $tables = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $name = current($row); + $tables[$name] = $name; + } + $this->db->sql_freeresult($result); + + return $tables; + } + + /** + * {@inheritDoc} + */ + function sql_create_table($table_name, $table_data) + { + // holds the DDL for a column + $columns = $statements = array(); + + if ($this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // Begin transaction + $statements[] = 'begin'; + + // Determine if we have created a PRIMARY KEY in the earliest + $primary_key_gen = false; + + // Determine if the table requires a sequence + $create_sequence = false; + + // Begin table sql statement + $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + + // Iterate through the columns to create a table + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // here lies an array, filled with information compiled on the column's data + $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + + if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); + } + + // here we add the definition of the new column to the list of columns + $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; + + // see if we have found a primary key set due to a column definition if we have found it, we can stop looking + if (!$primary_key_gen) + { + $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; + } + + // create sequence DDL based off of the existance of auto incrementing columns + if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) + { + $create_sequence = $column_name; + } + } + + // this makes up all the columns in the create table statement + $table_sql .= implode(",\n", $columns); + + // we have yet to create a primary key for this table, + // this means that we can add the one we really wanted instead + if (!$primary_key_gen) + { + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + $table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + } + } + + // do we need to add a sequence for auto incrementing columns? + if ($create_sequence) + { + $statements[] = "CREATE SEQUENCE {$table_name}_seq;"; + } + + // close the table + $table_sql .= "\n);"; + $statements[] = $table_sql; + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); + + foreach ($key_stmts as $key_stmt) + { + $statements[] = $key_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Commit Transaction + $statements[] = 'commit'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_list_columns($table_name) + { + $columns = array(); + + $sql = "SELECT a.attname + FROM pg_class c, pg_attribute a + WHERE c.relname = '{$table_name}' + AND a.attnum > 0 + AND a.attrelid = c.oid"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $column = strtolower(current($row)); + $columns[$column] = $column; + } + $this->db->sql_freeresult($result); + + return $columns; + } + + /** + * {@inheritDoc} + */ + function sql_index_exists($table_name, $index_name) + { + $sql = "SELECT ic.relname as index_name + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisunique != 't') + AND (i.indisprimary != 't')"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // This DBMS prefixes index names with the table name + $row['index_name'] = $this->strip_table_name_from_index_name($table_name, $row['index_name']); + + if (strtolower($row['index_name']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_unique_index_exists($table_name, $index_name) + { + $sql = "SELECT ic.relname as index_name, i.indisunique + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisprimary != 't')"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['indisunique'] != 't') + { + continue; + } + + // This DBMS prefixes index names with the table name + $row['index_name'] = $this->strip_table_name_from_index_name($table_name, $row['index_name']); + + if (strtolower($row['index_name']) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * Function to prepare some column information for better usage + * @access private + */ + function sql_prepare_column_data($table_name, $column_name, $column_data) + { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + // Get type + list($column_type, $orig_column_type) = $this->get_column_type($column_data[0]); + + // Adjust default value if db-dependent specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; + } + + $sql = " {$column_type} "; + + $return_array = array( + 'column_type' => $column_type, + 'auto_increment' => false, + ); + + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $default_val = "nextval('{$table_name}_seq')"; + $return_array['auto_increment'] = true; + } + else if (!is_null($column_data[1])) + { + $default_val = "'" . $column_data[1] . "'"; + $return_array['null'] = 'NOT NULL'; + $sql .= 'NOT NULL '; + } + else + { + // Integers need to have 0 instead of empty string as default + if (strpos($column_type, 'INT') === 0) + { + $default_val = '0'; + } + else + { + $default_val = "'" . $column_data[1] . "'"; + } + $return_array['null'] = 'NULL'; + $sql .= 'NULL '; + } + + $return_array['default'] = $default_val; + + $sql .= "DEFAULT {$default_val}"; + + // Unsigned? Then add a CHECK contraint + if (in_array($orig_column_type, $this->unsigned_types)) + { + $return_array['constraint'] = "CHECK ({$column_name} >= 0)"; + $sql .= " CHECK ({$column_name} >= 0)"; + } + + $return_array['column_type_sql'] = $sql; + + return $return_array; + } + + /** + * {@inheritDoc} + */ + function sql_column_add($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + // Does not support AFTER, only through temporary table + if (version_compare($this->db->sql_server_info(true), '8.0', '>=')) + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type_sql']; + } + else + { + // old versions cannot add columns with default and null information + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD COLUMN "' . $column_name . '" ' . $column_data['column_type'] . ' ' . $column_data['constraint']; + + if (isset($column_data['null'])) + { + if ($column_data['null'] == 'NOT NULL') + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET NOT NULL'; + } + } + + if (isset($column_data['default'])) + { + $statements[] = 'ALTER TABLE ' . $table_name . ' ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; + } + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_column_remove($table_name, $column_name, $inline = false) + { + $statements = array(); + + $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN "' . $column_name . '"'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_index_drop($table_name, $index_name) + { + $statements = array(); + + $statements[] = 'DROP INDEX ' . $table_name . '_' . $index_name; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_table_drop($table_name) + { + $statements = array(); + + if (!$this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // the most basic operation, get rid of the table + $statements[] = 'DROP TABLE ' . $table_name; + + // PGSQL does not "tightly" bind sequences and tables, we must guess... + $sql = "SELECT relname + FROM pg_class + WHERE relkind = 'S' + AND relname = '{$table_name}_seq'"; + $result = $this->db->sql_query($sql); + + // We don't even care about storing the results. We already know the answer if we get rows back. + if ($this->db->sql_fetchrow($result)) + { + $statements[] = "DROP SEQUENCE IF EXISTS {$table_name}_seq;\n"; + } + $this->db->sql_freeresult($result); + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_primary_key($table_name, $column, $inline = false) + { + $statements = array(); + + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_unique_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + $statements[] = 'CREATE UNIQUE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_index($table_name, $index_name, $column) + { + $statements = array(); + + $this->check_index_name_length($table_name, $index_name); + + // remove index length + $column = preg_replace('#:.*$#', '', $column); + + $statements[] = 'CREATE INDEX ' . $table_name . '_' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + + return $this->_sql_run_sql($statements); + } + + + /** + * {@inheritDoc} + */ + function sql_list_index($table_name) + { + $index_array = array(); + + $sql = "SELECT ic.relname as index_name + FROM pg_class bc, pg_class ic, pg_index i + WHERE (bc.oid = i.indrelid) + AND (ic.oid = i.indexrelid) + AND (bc.relname = '" . $table_name . "') + AND (i.indisunique != 't') + AND (i.indisprimary != 't')"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $row['index_name'] = $this->strip_table_name_from_index_name($table_name, $row['index_name']); + + $index_array[] = $row['index_name']; + } + $this->db->sql_freeresult($result); + + return array_map('strtolower', $index_array); + } + + /** + * {@inheritDoc} + */ + function sql_column_change($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + $sql = 'ALTER TABLE ' . $table_name . ' '; + + $sql_array = array(); + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' TYPE ' . $column_data['column_type']; + + if (isset($column_data['null'])) + { + if ($column_data['null'] == 'NOT NULL') + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET NOT NULL'; + } + else if ($column_data['null'] == 'NULL') + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' DROP NOT NULL'; + } + } + + if (isset($column_data['default'])) + { + $sql_array[] = 'ALTER COLUMN ' . $column_name . ' SET DEFAULT ' . $column_data['default']; + } + + // we don't want to double up on constraints if we change different number data types + if (isset($column_data['constraint'])) + { + $constraint_sql = "SELECT consrc as constraint_data + FROM pg_constraint, pg_class bc + WHERE conrelid = bc.oid + AND bc.relname = '{$table_name}' + AND NOT EXISTS ( + SELECT * + FROM pg_constraint as c, pg_inherits as i + WHERE i.inhrelid = pg_constraint.conrelid + AND c.conname = pg_constraint.conname + AND c.consrc = pg_constraint.consrc + AND c.conrelid = i.inhparent + )"; + + $constraint_exists = false; + + $result = $this->db->sql_query($constraint_sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (trim($row['constraint_data']) == trim($column_data['constraint'])) + { + $constraint_exists = true; + break; + } + } + $this->db->sql_freeresult($result); + + if (!$constraint_exists) + { + $sql_array[] = 'ADD ' . $column_data['constraint']; + } + } + + $sql .= implode(', ', $sql_array); + + $statements[] = $sql; + + return $this->_sql_run_sql($statements); + } + + /** + * Get a list with existing indexes for the column + * + * @param string $table_name + * @param string $column_name + * @param bool $unique Should we get unique indexes or normal ones + * @return array Array with Index name => columns + */ + public function get_existing_indexes($table_name, $column_name, $unique = false) + { + // Not supported + throw new \Exception('DBMS is not supported'); + } +} diff --git a/install/update/old/phpbb/db/tools/tools.php b/install/update/old/phpbb/db/tools/tools.php new file mode 100644 index 0000000..d21d34b --- /dev/null +++ b/install/update/old/phpbb/db/tools/tools.php @@ -0,0 +1,1956 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\db\tools; + +/** +* Database Tools for handling cross-db actions such as altering columns, etc. +* Currently not supported is returning SQL for creating tables. +*/ +class tools implements tools_interface +{ + /** + * Current sql layer + */ + var $sql_layer = ''; + + /** + * @var object DB object + */ + var $db = null; + + /** + * The Column types for every database we support + * @var array + */ + var $dbms_type_map = array(); + + /** + * Get the column types for every database we support + * + * @return array + */ + static public function get_dbms_type_map() + { + return array( + 'mysql_41' => array( + 'INT:' => 'int(%d)', + 'BINT' => 'bigint(20)', + 'ULINT' => 'INT(10) UNSIGNED', + 'UINT' => 'mediumint(8) UNSIGNED', + 'UINT:' => 'int(%d) UNSIGNED', + 'TINT:' => 'tinyint(%d)', + 'USINT' => 'smallint(4) UNSIGNED', + 'BOOL' => 'tinyint(1) UNSIGNED', + 'VCHAR' => 'varchar(255)', + 'VCHAR:' => 'varchar(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'text', + 'XSTEXT_UNI'=> 'varchar(100)', + 'STEXT' => 'text', + 'STEXT_UNI' => 'varchar(255)', + 'TEXT' => 'text', + 'TEXT_UNI' => 'text', + 'MTEXT' => 'mediumtext', + 'MTEXT_UNI' => 'mediumtext', + 'TIMESTAMP' => 'int(11) UNSIGNED', + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'varchar(255)', + 'VCHAR_UNI:'=> 'varchar(%d)', + 'VCHAR_CI' => 'varchar(255)', + 'VARBINARY' => 'varbinary(255)', + ), + + 'mysql_40' => array( + 'INT:' => 'int(%d)', + 'BINT' => 'bigint(20)', + 'ULINT' => 'INT(10) UNSIGNED', + 'UINT' => 'mediumint(8) UNSIGNED', + 'UINT:' => 'int(%d) UNSIGNED', + 'TINT:' => 'tinyint(%d)', + 'USINT' => 'smallint(4) UNSIGNED', + 'BOOL' => 'tinyint(1) UNSIGNED', + 'VCHAR' => 'varbinary(255)', + 'VCHAR:' => 'varbinary(%d)', + 'CHAR:' => 'binary(%d)', + 'XSTEXT' => 'blob', + 'XSTEXT_UNI'=> 'blob', + 'STEXT' => 'blob', + 'STEXT_UNI' => 'blob', + 'TEXT' => 'blob', + 'TEXT_UNI' => 'blob', + 'MTEXT' => 'mediumblob', + 'MTEXT_UNI' => 'mediumblob', + 'TIMESTAMP' => 'int(11) UNSIGNED', + 'DECIMAL' => 'decimal(5,2)', + 'DECIMAL:' => 'decimal(%d,2)', + 'PDECIMAL' => 'decimal(6,3)', + 'PDECIMAL:' => 'decimal(%d,3)', + 'VCHAR_UNI' => 'blob', + 'VCHAR_UNI:'=> array('varbinary(%d)', 'limit' => array('mult', 3, 255, 'blob')), + 'VCHAR_CI' => 'blob', + 'VARBINARY' => 'varbinary(255)', + ), + + 'oracle' => array( + 'INT:' => 'number(%d)', + 'BINT' => 'number(20)', + 'ULINT' => 'number(10)', + 'UINT' => 'number(8)', + 'UINT:' => 'number(%d)', + 'TINT:' => 'number(%d)', + 'USINT' => 'number(4)', + 'BOOL' => 'number(1)', + 'VCHAR' => 'varchar2(255)', + 'VCHAR:' => 'varchar2(%d)', + 'CHAR:' => 'char(%d)', + 'XSTEXT' => 'varchar2(1000)', + 'STEXT' => 'varchar2(3000)', + 'TEXT' => 'clob', + 'MTEXT' => 'clob', + 'XSTEXT_UNI'=> 'varchar2(300)', + 'STEXT_UNI' => 'varchar2(765)', + 'TEXT_UNI' => 'clob', + 'MTEXT_UNI' => 'clob', + 'TIMESTAMP' => 'number(11)', + 'DECIMAL' => 'number(5, 2)', + 'DECIMAL:' => 'number(%d, 2)', + 'PDECIMAL' => 'number(6, 3)', + 'PDECIMAL:' => 'number(%d, 3)', + 'VCHAR_UNI' => 'varchar2(765)', + 'VCHAR_UNI:'=> array('varchar2(%d)', 'limit' => array('mult', 3, 765, 'clob')), + 'VCHAR_CI' => 'varchar2(255)', + 'VARBINARY' => 'raw(255)', + ), + + 'sqlite3' => array( + 'INT:' => 'INT(%d)', + 'BINT' => 'BIGINT(20)', + 'ULINT' => 'INTEGER UNSIGNED', + 'UINT' => 'INTEGER UNSIGNED', + 'UINT:' => 'INTEGER UNSIGNED', + 'TINT:' => 'TINYINT(%d)', + 'USINT' => 'INTEGER UNSIGNED', + 'BOOL' => 'INTEGER UNSIGNED', + 'VCHAR' => 'VARCHAR(255)', + 'VCHAR:' => 'VARCHAR(%d)', + 'CHAR:' => 'CHAR(%d)', + 'XSTEXT' => 'TEXT(65535)', + 'STEXT' => 'TEXT(65535)', + 'TEXT' => 'TEXT(65535)', + 'MTEXT' => 'MEDIUMTEXT(16777215)', + 'XSTEXT_UNI'=> 'TEXT(65535)', + 'STEXT_UNI' => 'TEXT(65535)', + 'TEXT_UNI' => 'TEXT(65535)', + 'MTEXT_UNI' => 'MEDIUMTEXT(16777215)', + 'TIMESTAMP' => 'INTEGER UNSIGNED', //'int(11) UNSIGNED', + 'DECIMAL' => 'DECIMAL(5,2)', + 'DECIMAL:' => 'DECIMAL(%d,2)', + 'PDECIMAL' => 'DECIMAL(6,3)', + 'PDECIMAL:' => 'DECIMAL(%d,3)', + 'VCHAR_UNI' => 'VARCHAR(255)', + 'VCHAR_UNI:'=> 'VARCHAR(%d)', + 'VCHAR_CI' => 'VARCHAR(255)', + 'VARBINARY' => 'BLOB', + ), + ); + } + + /** + * A list of types being unsigned for better reference in some db's + * @var array + */ + var $unsigned_types = array('ULINT', 'UINT', 'UINT:', 'USINT', 'BOOL', 'TIMESTAMP'); + + /** + * This is set to true if user only wants to return the 'to-be-executed' SQL statement(s) (as an array). + * This mode has no effect on some methods (inserting of data for example). This is expressed within the methods command. + */ + var $return_statements = false; + + /** + * Constructor. Set DB Object and set {@link $return_statements return_statements}. + * + * @param \phpbb\db\driver\driver_interface $db Database connection + * @param bool $return_statements True if only statements should be returned and no SQL being executed + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $return_statements = false) + { + $this->db = $db; + $this->return_statements = $return_statements; + + $this->dbms_type_map = self::get_dbms_type_map(); + + // Determine mapping database type + switch ($this->db->get_sql_layer()) + { + case 'mysql': + $this->sql_layer = 'mysql_40'; + break; + + case 'mysql4': + if (version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) + { + $this->sql_layer = 'mysql_41'; + } + else + { + $this->sql_layer = 'mysql_40'; + } + break; + + case 'mysqli': + $this->sql_layer = 'mysql_41'; + break; + + default: + $this->sql_layer = $this->db->get_sql_layer(); + break; + } + } + + /** + * Setter for {@link $return_statements return_statements}. + * + * @param bool $return_statements True if SQL should not be executed but returned as strings + * @return null + */ + public function set_return_statements($return_statements) + { + $this->return_statements = $return_statements; + } + + /** + * {@inheritDoc} + */ + function sql_list_tables() + { + switch ($this->db->get_sql_layer()) + { + case 'mysql': + case 'mysql4': + case 'mysqli': + $sql = 'SHOW TABLES'; + break; + + case 'sqlite3': + $sql = 'SELECT name + FROM sqlite_master + WHERE type = "table" + AND name <> "sqlite_sequence"'; + break; + + case 'oracle': + $sql = 'SELECT table_name + FROM USER_TABLES'; + break; + } + + $result = $this->db->sql_query($sql); + + $tables = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $name = current($row); + $tables[$name] = $name; + } + $this->db->sql_freeresult($result); + + return $tables; + } + + /** + * {@inheritDoc} + */ + function sql_table_exists($table_name) + { + $this->db->sql_return_on_error(true); + $result = $this->db->sql_query_limit('SELECT * FROM ' . $table_name, 1); + $this->db->sql_return_on_error(false); + + if ($result) + { + $this->db->sql_freeresult($result); + return true; + } + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_create_table($table_name, $table_data) + { + // holds the DDL for a column + $columns = $statements = array(); + + if ($this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // Begin transaction + $statements[] = 'begin'; + + // Determine if we have created a PRIMARY KEY in the earliest + $primary_key_gen = false; + + // Determine if the table requires a sequence + $create_sequence = false; + + // Begin table sql statement + $table_sql = 'CREATE TABLE ' . $table_name . ' (' . "\n"; + + // Iterate through the columns to create a table + foreach ($table_data['COLUMNS'] as $column_name => $column_data) + { + // here lies an array, filled with information compiled on the column's data + $prepared_column = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + + if (isset($prepared_column['auto_increment']) && $prepared_column['auto_increment'] && strlen($column_name) > 26) // "${column_name}_gen" + { + trigger_error("Index name '${column_name}_gen' on table '$table_name' is too long. The maximum auto increment column length is 26 characters.", E_USER_ERROR); + } + + // here we add the definition of the new column to the list of columns + $columns[] = "\t {$column_name} " . $prepared_column['column_type_sql']; + + // see if we have found a primary key set due to a column definition if we have found it, we can stop looking + if (!$primary_key_gen) + { + $primary_key_gen = isset($prepared_column['primary_key_set']) && $prepared_column['primary_key_set']; + } + + // create sequence DDL based off of the existance of auto incrementing columns + if (!$create_sequence && isset($prepared_column['auto_increment']) && $prepared_column['auto_increment']) + { + $create_sequence = $column_name; + } + } + + // this makes up all the columns in the create table statement + $table_sql .= implode(",\n", $columns); + + // we have yet to create a primary key for this table, + // this means that we can add the one we really wanted instead + if (!$primary_key_gen) + { + // Write primary key + if (isset($table_data['PRIMARY_KEY'])) + { + if (!is_array($table_data['PRIMARY_KEY'])) + { + $table_data['PRIMARY_KEY'] = array($table_data['PRIMARY_KEY']); + } + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + case 'sqlite3': + $table_sql .= ",\n\t PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + break; + + case 'oracle': + $table_sql .= ",\n\t CONSTRAINT pk_{$table_name} PRIMARY KEY (" . implode(', ', $table_data['PRIMARY_KEY']) . ')'; + break; + } + } + } + + // close the table + switch ($this->sql_layer) + { + case 'mysql_41': + // make sure the table is in UTF-8 mode + $table_sql .= "\n) CHARACTER SET `utf8` COLLATE `utf8_bin`;"; + $statements[] = $table_sql; + break; + + case 'mysql_40': + case 'sqlite3': + $table_sql .= "\n);"; + $statements[] = $table_sql; + break; + + case 'oracle': + $table_sql .= "\n)"; + $statements[] = $table_sql; + + // do we need to add a sequence and a tigger for auto incrementing columns? + if ($create_sequence) + { + // create the actual sequence + $statements[] = "CREATE SEQUENCE {$table_name}_seq"; + + // the trigger is the mechanism by which we increment the counter + $trigger = "CREATE OR REPLACE TRIGGER t_{$table_name}\n"; + $trigger .= "BEFORE INSERT ON {$table_name}\n"; + $trigger .= "FOR EACH ROW WHEN (\n"; + $trigger .= "\tnew.{$create_sequence} IS NULL OR new.{$create_sequence} = 0\n"; + $trigger .= ")\n"; + $trigger .= "BEGIN\n"; + $trigger .= "\tSELECT {$table_name}_seq.nextval\n"; + $trigger .= "\tINTO :new.{$create_sequence}\n"; + $trigger .= "\tFROM dual;\n"; + $trigger .= "END;"; + + $statements[] = $trigger; + } + break; + } + + // Write Keys + if (isset($table_data['KEYS'])) + { + foreach ($table_data['KEYS'] as $key_name => $key_data) + { + if (!is_array($key_data[1])) + { + $key_data[1] = array($key_data[1]); + } + + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + $key_stmts = ($key_data[0] == 'UNIQUE') ? $this->sql_create_unique_index($table_name, $key_name, $key_data[1]) : $this->sql_create_index($table_name, $key_name, $key_data[1]); + + foreach ($key_stmts as $key_stmt) + { + $statements[] = $key_stmt; + } + + $this->return_statements = $old_return_statements; + } + } + + // Commit Transaction + $statements[] = 'commit'; + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function perform_schema_changes($schema_changes) + { + if (empty($schema_changes)) + { + return; + } + + $statements = array(); + $sqlite = false; + + // For SQLite we need to perform the schema changes in a much more different way + if ($this->db->get_sql_layer() == 'sqlite3' && $this->return_statements) + { + $sqlite_data = array(); + $sqlite = true; + } + + // Drop tables? + if (!empty($schema_changes['drop_tables'])) + { + foreach ($schema_changes['drop_tables'] as $table) + { + // only drop table if it exists + if ($this->sql_table_exists($table)) + { + $result = $this->sql_table_drop($table); + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Add tables? + if (!empty($schema_changes['add_tables'])) + { + foreach ($schema_changes['add_tables'] as $table => $table_data) + { + $result = $this->sql_create_table($table, $table_data); + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + + // Change columns? + if (!empty($schema_changes['change_columns'])) + { + foreach ($schema_changes['change_columns'] as $table => $columns) + { + foreach ($columns as $column_name => $column_data) + { + // If the column exists we change it, else we add it ;) + if ($column_exists = $this->sql_column_exists($table, $column_name)) + { + $result = $this->sql_column_change($table, $column_name, $column_data, true); + } + else + { + $result = $this->sql_column_add($table, $column_name, $column_data, true); + } + + if ($sqlite) + { + if ($column_exists) + { + $sqlite_data[$table]['change_columns'][] = $result; + } + else + { + $sqlite_data[$table]['add_columns'][] = $result; + } + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Add columns? + if (!empty($schema_changes['add_columns'])) + { + foreach ($schema_changes['add_columns'] as $table => $columns) + { + foreach ($columns as $column_name => $column_data) + { + // Only add the column if it does not exist yet + if ($column_exists = $this->sql_column_exists($table, $column_name)) + { + continue; + // This is commented out here because it can take tremendous time on updates +// $result = $this->sql_column_change($table, $column_name, $column_data, true); + } + else + { + $result = $this->sql_column_add($table, $column_name, $column_data, true); + } + + if ($sqlite) + { + if ($column_exists) + { + continue; +// $sqlite_data[$table]['change_columns'][] = $result; + } + else + { + $sqlite_data[$table]['add_columns'][] = $result; + } + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Remove keys? + if (!empty($schema_changes['drop_keys'])) + { + foreach ($schema_changes['drop_keys'] as $table => $indexes) + { + foreach ($indexes as $index_name) + { + if (!$this->sql_index_exists($table, $index_name)) + { + continue; + } + + $result = $this->sql_index_drop($table, $index_name); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Drop columns? + if (!empty($schema_changes['drop_columns'])) + { + foreach ($schema_changes['drop_columns'] as $table => $columns) + { + foreach ($columns as $column) + { + // Only remove the column if it exists... + if ($this->sql_column_exists($table, $column)) + { + $result = $this->sql_column_remove($table, $column, true); + + if ($sqlite) + { + $sqlite_data[$table]['drop_columns'][] = $result; + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + } + + // Add primary keys? + if (!empty($schema_changes['add_primary_keys'])) + { + foreach ($schema_changes['add_primary_keys'] as $table => $columns) + { + $result = $this->sql_create_primary_key($table, $columns, true); + + if ($sqlite) + { + $sqlite_data[$table]['primary_key'] = $result; + } + else if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + + // Add unique indexes? + if (!empty($schema_changes['add_unique_index'])) + { + foreach ($schema_changes['add_unique_index'] as $table => $index_array) + { + foreach ($index_array as $index_name => $column) + { + if ($this->sql_unique_index_exists($table, $index_name)) + { + continue; + } + + $result = $this->sql_create_unique_index($table, $index_name, $column); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + // Add indexes? + if (!empty($schema_changes['add_index'])) + { + foreach ($schema_changes['add_index'] as $table => $index_array) + { + foreach ($index_array as $index_name => $column) + { + if ($this->sql_index_exists($table, $index_name)) + { + continue; + } + + $result = $this->sql_create_index($table, $index_name, $column); + + if ($this->return_statements) + { + $statements = array_merge($statements, $result); + } + } + } + } + + if ($sqlite) + { + foreach ($sqlite_data as $table_name => $sql_schema_changes) + { + // Create temporary table with original data + $statements[] = 'begin'; + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}' + ORDER BY type DESC, name;"; + $result = $this->db->sql_query($sql); + + if (!$result) + { + continue; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $row['sql']); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + // Get the columns... + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $plain_table_cols = trim($matches[1]); + $new_table_cols = preg_split('/,(?![\s\w]+\))/m', $plain_table_cols); + $column_list = array(); + + foreach ($new_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + // note down the primary key notation because sqlite only supports adding it to the end for the new table + $primary_key = false; + $_new_cols = array(); + + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + $primary_key = $declaration; + continue; + } + $_new_cols[] = $declaration; + } + + $new_table_cols = $_new_cols; + + // First of all... change columns + if (!empty($sql_schema_changes['change_columns'])) + { + foreach ($sql_schema_changes['change_columns'] as $column_sql) + { + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if (strpos($column_sql, $entities[0] . ' ') === 0) + { + $new_table_cols[$key] = $column_sql; + } + } + } + } + + if (!empty($sql_schema_changes['add_columns'])) + { + foreach ($sql_schema_changes['add_columns'] as $column_sql) + { + $new_table_cols[] = $column_sql; + } + } + + // Now drop them... + if (!empty($sql_schema_changes['drop_columns'])) + { + foreach ($sql_schema_changes['drop_columns'] as $column_name) + { + // Remove from column list... + $new_column_list = array(); + foreach ($column_list as $key => $value) + { + if ($value === $column_name) + { + continue; + } + + $new_column_list[] = $value; + } + + $column_list = $new_column_list; + + // Remove from table... + $_new_cols = array(); + foreach ($new_table_cols as $key => $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if (strpos($column_name . ' ', $entities[0] . ' ') === 0) + { + continue; + } + $_new_cols[] = $declaration; + } + $new_table_cols = $_new_cols; + } + } + + // Primary key... + if (!empty($sql_schema_changes['primary_key'])) + { + $new_table_cols[] = 'PRIMARY KEY (' . implode(', ', $sql_schema_changes['primary_key']) . ')'; + } + // Add a new one or the old primary key + else if ($primary_key !== false) + { + $new_table_cols[] = $primary_key; + } + + $columns = implode(',', $column_list); + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $new_table_cols) . ');'; + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + } + } + + if ($this->return_statements) + { + return $statements; + } + } + + /** + * {@inheritDoc} + */ + function sql_list_columns($table_name) + { + $columns = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $sql = "SHOW COLUMNS FROM $table_name"; + break; + + case 'oracle': + $sql = "SELECT column_name + FROM user_tab_columns + WHERE LOWER(table_name) = '" . strtolower($table_name) . "'"; + break; + + case 'sqlite3': + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}'"; + + $result = $this->db->sql_query($sql); + + if (!$result) + { + return false; + } + + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + preg_match('#\((.*)\)#s', $row['sql'], $matches); + + $cols = trim($matches[1]); + $col_array = preg_split('/,(?![\s\w]+\))/m', $cols); + + foreach ($col_array as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + + $column = strtolower($entities[0]); + $columns[$column] = $column; + } + + return $columns; + break; + } + + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $column = strtolower(current($row)); + $columns[$column] = $column; + } + $this->db->sql_freeresult($result); + + return $columns; + } + + /** + * {@inheritDoc} + */ + function sql_column_exists($table_name, $column_name) + { + $columns = $this->sql_list_columns($table_name); + + return isset($columns[$column_name]); + } + + /** + * {@inheritDoc} + */ + function sql_index_exists($table_name, $index_name) + { + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name + FROM user_indexes + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'NONUNIQUE'"; + $col = 'index_name'; + break; + + case 'sqlite3': + $sql = "PRAGMA index_list('" . $table_name . "');"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique']) + { + continue; + } + + switch ($this->sql_layer) + { + // These DBMS prefix index name with the table name + case 'oracle': + case 'sqlite3': + $new_index_name = $this->check_index_name_length($table_name, $table_name . '_' . $index_name, false); + break; + default: + $new_index_name = $this->check_index_name_length($table_name, $index_name, false); + break; + } + + if (strtolower($row[$col]) == strtolower($new_index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * {@inheritDoc} + */ + function sql_unique_index_exists($table_name, $index_name) + { + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name, table_owner + FROM user_indexes + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'UNIQUE'"; + $col = 'index_name'; + break; + + case 'sqlite3': + $sql = "PRAGMA index_list('" . $table_name . "');"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && ($row['Non_unique'] || $row[$col] == 'PRIMARY')) + { + continue; + } + + if ($this->sql_layer == 'sqlite3' && !$row['unique']) + { + continue; + } + + // These DBMS prefix index name with the table name + switch ($this->sql_layer) + { + case 'oracle': + // Two cases here... prefixed with U_[table_owner] and not prefixed with table_name + if (strpos($row[$col], 'U_') === 0) + { + $row[$col] = substr($row[$col], strlen('U_' . $row['table_owner']) + 1); + } + else if (strpos($row[$col], strtoupper($table_name)) === 0) + { + $row[$col] = substr($row[$col], strlen($table_name) + 1); + } + break; + + case 'sqlite3': + $row[$col] = substr($row[$col], strlen($table_name) + 1); + break; + } + + if (strtolower($row[$col]) == strtolower($index_name)) + { + $this->db->sql_freeresult($result); + return true; + } + } + $this->db->sql_freeresult($result); + + return false; + } + + /** + * Private method for performing sql statements (either execute them or return them) + * @access private + */ + function _sql_run_sql($statements) + { + if ($this->return_statements) + { + return $statements; + } + + // We could add error handling here... + foreach ($statements as $sql) + { + if ($sql === 'begin') + { + $this->db->sql_transaction('begin'); + } + else if ($sql === 'commit') + { + $this->db->sql_transaction('commit'); + } + else + { + $this->db->sql_query($sql); + } + } + + return true; + } + + /** + * Function to prepare some column information for better usage + * @access private + */ + function sql_prepare_column_data($table_name, $column_name, $column_data) + { + if (strlen($column_name) > 30) + { + trigger_error("Column name '$column_name' on table '$table_name' is too long. The maximum is 30 characters.", E_USER_ERROR); + } + + // Get type + list($column_type) = $this->get_column_type($column_data[0]); + + // Adjust default value if db-dependent specified + if (is_array($column_data[1])) + { + $column_data[1] = (isset($column_data[1][$this->sql_layer])) ? $column_data[1][$this->sql_layer] : $column_data[1]['default']; + } + + $sql = ''; + + $return_array = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $sql .= " {$column_type} "; + + // For hexadecimal values do not use single quotes + if (!is_null($column_data[1]) && substr($column_type, -4) !== 'text' && substr($column_type, -4) !== 'blob') + { + $sql .= (strpos($column_data[1], '0x') === 0) ? "DEFAULT {$column_data[1]} " : "DEFAULT '{$column_data[1]}' "; + } + + if (!is_null($column_data[1]) || (isset($column_data[2]) && $column_data[2] == 'auto_increment')) + { + $sql .= 'NOT NULL'; + } + else + { + $sql .= 'NULL'; + } + + if (isset($column_data[2])) + { + if ($column_data[2] == 'auto_increment') + { + $sql .= ' auto_increment'; + } + else if ($this->sql_layer === 'mysql_41' && $column_data[2] == 'true_sort') + { + $sql .= ' COLLATE utf8_unicode_ci'; + } + } + + if (isset($column_data['after'])) + { + $return_array['after'] = $column_data['after']; + } + + break; + + case 'oracle': + $sql .= " {$column_type} "; + $sql .= (!is_null($column_data[1])) ? "DEFAULT '{$column_data[1]}' " : ''; + + // In Oracle empty strings ('') are treated as NULL. + // Therefore in oracle we allow NULL's for all DEFAULT '' entries + // Oracle does not like setting NOT NULL on a column that is already NOT NULL (this happens only on number fields) + if (!preg_match('/number/i', $column_type)) + { + $sql .= ($column_data[1] === '' || $column_data[1] === null) ? '' : 'NOT NULL'; + } + + $return_array['auto_increment'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $return_array['auto_increment'] = true; + } + + break; + + case 'sqlite3': + $return_array['primary_key_set'] = false; + if (isset($column_data[2]) && $column_data[2] == 'auto_increment') + { + $sql .= ' INTEGER PRIMARY KEY AUTOINCREMENT'; + $return_array['primary_key_set'] = true; + } + else + { + $sql .= ' ' . $column_type; + } + + if (!is_null($column_data[1])) + { + $sql .= ' NOT NULL '; + $sql .= "DEFAULT '{$column_data[1]}'"; + } + + break; + } + + $return_array['column_type_sql'] = $sql; + + return $return_array; + } + + /** + * Get the column's database type from the type map + * + * @param string $column_map_type + * @return array column type for this database + * and map type without length + */ + function get_column_type($column_map_type) + { + $column_type = ''; + if (strpos($column_map_type, ':') !== false) + { + list($orig_column_type, $column_length) = explode(':', $column_map_type); + if (!is_array($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'])) + { + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'], $column_length); + } + else + { + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'])) + { + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][0]) + { + case 'div': + $column_length /= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['rule'][1]; + $column_length = ceil($column_length); + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); + break; + } + } + + if (isset($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'])) + { + switch ($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][0]) + { + case 'mult': + $column_length *= $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][1]; + if ($column_length > $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][2]) + { + $column_type = $this->dbms_type_map[$this->sql_layer][$orig_column_type . ':']['limit'][3]; + } + else + { + $column_type = sprintf($this->dbms_type_map[$this->sql_layer][$orig_column_type . ':'][0], $column_length); + } + break; + } + } + } + $orig_column_type .= ':'; + } + else + { + $orig_column_type = $column_map_type; + $column_type = $this->dbms_type_map[$this->sql_layer][$column_map_type]; + } + + return array($column_type, $orig_column_type); + } + + /** + * {@inheritDoc} + */ + function sql_column_add($table_name, $column_name, $column_data, $inline = false) + { + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $after = (!empty($column_data['after'])) ? ' AFTER ' . $column_data['after'] : ''; + $statements[] = 'ALTER TABLE `' . $table_name . '` ADD COLUMN `' . $column_name . '` ' . $column_data['column_type_sql'] . $after; + break; + + case 'oracle': + // Does not support AFTER, only through temporary table + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; + break; + + case 'sqlite3': + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD ' . $column_name . ' ' . $column_data['column_type_sql']; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_column_remove($table_name, $column_name, $inline = false) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE `' . $table_name . '` DROP COLUMN `' . $column_name . '`'; + break; + + case 'oracle': + $statements[] = 'ALTER TABLE ' . $table_name . ' DROP COLUMN ' . $column_name; + break; + + case 'sqlite3': + + if ($inline && $this->return_statements) + { + return $column_name; + } + + $recreate_queries = $this->sqlite_get_recreate_table_queries($table_name, $column_name); + if (empty($recreate_queries)) + { + break; + } + + $statements[] = 'begin'; + + $sql_create_table = array_shift($recreate_queries); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $sql_create_table); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $sql_create_table, $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY' || $entities[0] === $column_name) + { + continue; + } + $column_list[] = $entities[0]; + } + + $columns = implode(',', $column_list); + + $new_table_cols = trim(preg_replace('/' . $column_name . '\b[^,]+(?:,|$)/m', '', $new_table_cols)); + if (substr($new_table_cols, -1) === ',') + { + // Remove the comma from the last entry again + $new_table_cols = substr($new_table_cols, 0, -1); + } + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ');'; + $statements = array_merge($statements, $recreate_queries); + + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_index_drop($table_name, $index_name) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $index_name = $this->check_index_name_length($table_name, $index_name, false); + $statements[] = 'DROP INDEX ' . $index_name . ' ON ' . $table_name; + break; + + case 'oracle': + case 'sqlite3': + $index_name = $this->check_index_name_length($table_name, $table_name . '_' . $index_name, false); + $statements[] = 'DROP INDEX ' . $index_name; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_table_drop($table_name) + { + $statements = array(); + + if (!$this->sql_table_exists($table_name)) + { + return $this->_sql_run_sql($statements); + } + + // the most basic operation, get rid of the table + $statements[] = 'DROP TABLE ' . $table_name; + + switch ($this->sql_layer) + { + case 'oracle': + $sql = 'SELECT A.REFERENCED_NAME + FROM USER_DEPENDENCIES A, USER_TRIGGERS B + WHERE A.REFERENCED_TYPE = \'SEQUENCE\' + AND A.NAME = B.TRIGGER_NAME + AND B.TABLE_NAME = \'' . strtoupper($table_name) . "'"; + $result = $this->db->sql_query($sql); + + // any sequences ref'd to this table's triggers? + while ($row = $this->db->sql_fetchrow($result)) + { + $statements[] = "DROP SEQUENCE {$row['referenced_name']}"; + } + $this->db->sql_freeresult($result); + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_primary_key($table_name, $column, $inline = false) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD PRIMARY KEY (' . implode(', ', $column) . ')'; + break; + + case 'oracle': + $statements[] = 'ALTER TABLE ' . $table_name . ' add CONSTRAINT pk_' . $table_name . ' PRIMARY KEY (' . implode(', ', $column) . ')'; + break; + + case 'sqlite3': + + if ($inline && $this->return_statements) + { + return $column; + } + + $recreate_queries = $this->sqlite_get_recreate_table_queries($table_name); + if (empty($recreate_queries)) + { + break; + } + + $statements[] = 'begin'; + + $sql_create_table = array_shift($recreate_queries); + + // Create a backup table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $sql_create_table); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $sql_create_table, $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $declaration) + { + $entities = preg_split('#\s+#', trim($declaration)); + if ($entities[0] == 'PRIMARY') + { + continue; + } + $column_list[] = $entities[0]; + } + + $columns = implode(',', $column_list); + + // create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . $new_table_cols . ', PRIMARY KEY (' . implode(', ', $column) . '));'; + $statements = array_merge($statements, $recreate_queries); + + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_unique_index($table_name, $index_name, $column) + { + $statements = array(); + + switch ($this->sql_layer) + { + case 'oracle': + case 'sqlite3': + $index_name = $this->check_index_name_length($table_name, $table_name . '_' . $index_name); + $statements[] = 'CREATE UNIQUE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + break; + + case 'mysql_40': + case 'mysql_41': + $index_name = $this->check_index_name_length($table_name, $index_name); + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD UNIQUE INDEX ' . $index_name . '(' . implode(', ', $column) . ')'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * {@inheritDoc} + */ + function sql_create_index($table_name, $index_name, $column) + { + $statements = array(); + + // remove index length unless MySQL4 + if ('mysql_40' != $this->sql_layer) + { + $column = preg_replace('#:.*$#', '', $column); + } + + switch ($this->sql_layer) + { + case 'oracle': + case 'sqlite3': + $index_name = $this->check_index_name_length($table_name, $table_name . '_' . $index_name); + $statements[] = 'CREATE INDEX ' . $index_name . ' ON ' . $table_name . '(' . implode(', ', $column) . ')'; + break; + + case 'mysql_40': + // add index size to definition as required by MySQL4 + foreach ($column as $i => $col) + { + if (false !== strpos($col, ':')) + { + list($col, $index_size) = explode(':', $col); + $column[$i] = "$col($index_size)"; + } + } + // no break + case 'mysql_41': + $index_name = $this->check_index_name_length($table_name, $index_name); + $statements[] = 'ALTER TABLE ' . $table_name . ' ADD INDEX ' . $index_name . ' (' . implode(', ', $column) . ')'; + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Check whether the index name is too long + * + * @param string $table_name + * @param string $index_name + * @param bool $throw_error + * @return string The index name, shortened if too long + */ + protected function check_index_name_length($table_name, $index_name, $throw_error = true) + { + $max_index_name_length = $this->get_max_index_name_length(); + if (strlen($index_name) > $max_index_name_length) + { + // Try removing the table prefix if it's at the beginning + $table_prefix = substr(CONFIG_TABLE, 0, -6); // strlen(config) + if (strpos($index_name, $table_prefix) === 0) + { + $index_name = substr($index_name, strlen($table_prefix)); + return $this->check_index_name_length($table_name, $index_name, $throw_error); + } + + // Try removing the remaining suffix part of table name then + $table_suffix = substr($table_name, strlen($table_prefix)); + if (strpos($index_name, $table_suffix) === 0) + { + // Remove the suffix and underscore separator between table_name and index_name + $index_name = substr($index_name, strlen($table_suffix) + 1); + return $this->check_index_name_length($table_name, $index_name, $throw_error); + } + + if ($throw_error) + { + trigger_error("Index name '$index_name' on table '$table_name' is too long. The maximum is $max_index_name_length characters.", E_USER_ERROR); + } + } + + return $index_name; + } + + /** + * Get maximum index name length. Might vary depending on db type + * + * @return int Maximum index name length + */ + protected function get_max_index_name_length() + { + return 30; + } + + /** + * {@inheritDoc} + */ + function sql_list_index($table_name) + { + $index_array = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $sql = 'SHOW KEYS + FROM ' . $table_name; + $col = 'Key_name'; + break; + + case 'oracle': + $sql = "SELECT index_name + FROM user_indexes + WHERE table_name = '" . strtoupper($table_name) . "' + AND generated = 'N' + AND uniqueness = 'NONUNIQUE'"; + $col = 'index_name'; + break; + + case 'sqlite3': + $sql = "PRAGMA index_info('" . $table_name . "');"; + $col = 'name'; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (($this->sql_layer == 'mysql_40' || $this->sql_layer == 'mysql_41') && !$row['Non_unique']) + { + continue; + } + + switch ($this->sql_layer) + { + case 'oracle': + case 'sqlite3': + $row[$col] = substr($row[$col], strlen($table_name) + 1); + break; + } + + $index_array[] = $row[$col]; + } + $this->db->sql_freeresult($result); + + return array_map('strtolower', $index_array); + } + + /** + * Removes table_name from the index_name if it is at the beginning + * + * @param $table_name + * @param $index_name + * @return string + */ + protected function strip_table_name_from_index_name($table_name, $index_name) + { + return (strpos(strtoupper($index_name), strtoupper($table_name)) === 0) ? substr($index_name, strlen($table_name) + 1) : $index_name; + } + + /** + * {@inheritDoc} + */ + function sql_column_change($table_name, $column_name, $column_data, $inline = false) + { + $original_column_data = $column_data; + $column_data = $this->sql_prepare_column_data($table_name, $column_name, $column_data); + $statements = array(); + + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + $statements[] = 'ALTER TABLE `' . $table_name . '` CHANGE `' . $column_name . '` `' . $column_name . '` ' . $column_data['column_type_sql']; + break; + + case 'oracle': + // We need the data here + $old_return_statements = $this->return_statements; + $this->return_statements = true; + + // Get list of existing indexes + $indexes = $this->get_existing_indexes($table_name, $column_name); + $unique_indexes = $this->get_existing_indexes($table_name, $column_name, true); + + // Drop any indexes + if (!empty($indexes) || !empty($unique_indexes)) + { + $drop_indexes = array_merge(array_keys($indexes), array_keys($unique_indexes)); + foreach ($drop_indexes as $index_name) + { + $result = $this->sql_index_drop($table_name, $this->strip_table_name_from_index_name($table_name, $index_name)); + $statements = array_merge($statements, $result); + } + } + + $temp_column_name = 'temp_' . substr(md5($column_name), 0, 25); + // Add a temporary table with the new type + $result = $this->sql_column_add($table_name, $temp_column_name, $original_column_data); + $statements = array_merge($statements, $result); + + // Copy the data to the new column + $statements[] = 'UPDATE ' . $table_name . ' SET ' . $temp_column_name . ' = ' . $column_name; + + // Drop the original column + $result = $this->sql_column_remove($table_name, $column_name); + $statements = array_merge($statements, $result); + + // Recreate the original column with the new type + $result = $this->sql_column_add($table_name, $column_name, $original_column_data); + $statements = array_merge($statements, $result); + + if (!empty($indexes)) + { + // Recreate indexes after we changed the column + foreach ($indexes as $index_name => $index_data) + { + $result = $this->sql_create_index($table_name, $this->strip_table_name_from_index_name($table_name, $index_name), $index_data); + $statements = array_merge($statements, $result); + } + } + + if (!empty($unique_indexes)) + { + // Recreate unique indexes after we changed the column + foreach ($unique_indexes as $index_name => $index_data) + { + $result = $this->sql_create_unique_index($table_name, $this->strip_table_name_from_index_name($table_name, $index_name), $index_data); + $statements = array_merge($statements, $result); + } + } + + // Copy the data to the original column + $statements[] = 'UPDATE ' . $table_name . ' SET ' . $column_name . ' = ' . $temp_column_name; + + // Drop the temporary column again + $result = $this->sql_column_remove($table_name, $temp_column_name); + $statements = array_merge($statements, $result); + + $this->return_statements = $old_return_statements; + break; + + case 'sqlite3': + + if ($inline && $this->return_statements) + { + return $column_name . ' ' . $column_data['column_type_sql']; + } + + $recreate_queries = $this->sqlite_get_recreate_table_queries($table_name); + if (empty($recreate_queries)) + { + break; + } + + $statements[] = 'begin'; + + $sql_create_table = array_shift($recreate_queries); + + // Create a temp table and populate it, destroy the existing one + $statements[] = preg_replace('#CREATE\s+TABLE\s+"?' . $table_name . '"?#i', 'CREATE TEMPORARY TABLE ' . $table_name . '_temp', $sql_create_table); + $statements[] = 'INSERT INTO ' . $table_name . '_temp SELECT * FROM ' . $table_name; + $statements[] = 'DROP TABLE ' . $table_name; + + preg_match('#\((.*)\)#s', $sql_create_table, $matches); + + $new_table_cols = trim($matches[1]); + $old_table_cols = preg_split('/,(?![\s\w]+\))/m', $new_table_cols); + $column_list = array(); + + foreach ($old_table_cols as $key => $declaration) + { + $declaration = trim($declaration); + + // Check for the beginning of the constraint section and stop + if (preg_match('/[^\(]*\s*PRIMARY KEY\s+\(/', $declaration) || + preg_match('/[^\(]*\s*UNIQUE\s+\(/', $declaration) || + preg_match('/[^\(]*\s*FOREIGN KEY\s+\(/', $declaration) || + preg_match('/[^\(]*\s*CHECK\s+\(/', $declaration)) + { + break; + } + + $entities = preg_split('#\s+#', $declaration); + $column_list[] = $entities[0]; + if ($entities[0] == $column_name) + { + $old_table_cols[$key] = $column_name . ' ' . $column_data['column_type_sql']; + } + } + + $columns = implode(',', $column_list); + + // Create a new table and fill it up. destroy the temp one + $statements[] = 'CREATE TABLE ' . $table_name . ' (' . implode(',', $old_table_cols) . ');'; + $statements = array_merge($statements, $recreate_queries); + + $statements[] = 'INSERT INTO ' . $table_name . ' (' . $columns . ') SELECT ' . $columns . ' FROM ' . $table_name . '_temp;'; + $statements[] = 'DROP TABLE ' . $table_name . '_temp'; + + $statements[] = 'commit'; + + break; + } + + return $this->_sql_run_sql($statements); + } + + /** + * Get a list with existing indexes for the column + * + * @param string $table_name + * @param string $column_name + * @param bool $unique Should we get unique indexes or normal ones + * @return array Array with Index name => columns + */ + public function get_existing_indexes($table_name, $column_name, $unique = false) + { + switch ($this->sql_layer) + { + case 'mysql_40': + case 'mysql_41': + case 'sqlite3': + // Not supported + throw new \Exception('DBMS is not supported'); + break; + } + + $sql = ''; + $existing_indexes = array(); + + switch ($this->sql_layer) + { + case 'oracle': + $sql = "SELECT ix.index_name AS phpbb_index_name, ix.uniqueness AS is_unique + FROM all_ind_columns ixc, all_indexes ix + WHERE ix.index_name = ixc.index_name + AND ixc.table_name = '" . strtoupper($table_name) . "' + AND ixc.column_name = '" . strtoupper($column_name) . "'"; + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + if (!isset($row['is_unique']) || ($unique && $row['is_unique'] == 'UNIQUE') || (!$unique && $row['is_unique'] == 'NONUNIQUE')) + { + $existing_indexes[$row['phpbb_index_name']] = array(); + } + } + $this->db->sql_freeresult($result); + + if (empty($existing_indexes)) + { + return array(); + } + + switch ($this->sql_layer) + { + case 'oracle': + $sql = "SELECT index_name AS phpbb_index_name, column_name AS phpbb_column_name + FROM all_ind_columns + WHERE table_name = '" . strtoupper($table_name) . "' + AND " . $this->db->sql_in_set('index_name', array_keys($existing_indexes)); + break; + } + + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $existing_indexes[$row['phpbb_index_name']][] = $row['phpbb_column_name']; + } + $this->db->sql_freeresult($result); + + return $existing_indexes; + } + + /** + * Returns the Queries which are required to recreate a table including indexes + * + * @param string $table_name + * @param string $remove_column When we drop a column, we remove the column + * from all indexes. If the index has no other + * column, we drop it completly. + * @return array + */ + protected function sqlite_get_recreate_table_queries($table_name, $remove_column = '') + { + $queries = array(); + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'table' + AND name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + $sql_create_table = $this->db->sql_fetchfield('sql'); + $this->db->sql_freeresult($result); + + if (!$sql_create_table) + { + return array(); + } + $queries[] = $sql_create_table; + + $sql = "SELECT sql + FROM sqlite_master + WHERE type = 'index' + AND tbl_name = '{$table_name}'"; + $result = $this->db->sql_query($sql); + while ($sql_create_index = $this->db->sql_fetchfield('sql')) + { + if ($remove_column) + { + $match = array(); + preg_match('#(?:[\w ]+)\((.*)\)#', $sql_create_index, $match); + if (!isset($match[1])) + { + continue; + } + + // Find and remove $remove_column from the index + $columns = explode(', ', $match[1]); + $found_column = array_search($remove_column, $columns); + if ($found_column !== false) + { + unset($columns[$found_column]); + + // If the column list is not empty add the index to the list + if (!empty($columns)) + { + $queries[] = str_replace($match[1], implode(', ', $columns), $sql_create_index); + } + } + else + { + $queries[] = $sql_create_index; + } + } + else + { + $queries[] = $sql_create_index; + } + } + $this->db->sql_freeresult($result); + + return $queries; + } +} diff --git a/install/update/old/phpbb/di/container_builder.php b/install/update/old/phpbb/di/container_builder.php new file mode 100644 index 0000000..8c1ce8b --- /dev/null +++ b/install/update/old/phpbb/di/container_builder.php @@ -0,0 +1,673 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di; + +use phpbb\filesystem\filesystem; +use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper; +use Symfony\Component\Config\ConfigCache; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Dumper\PhpDumper; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\EventDispatcher\DependencyInjection\RegisterListenersPass; +use Symfony\Component\Filesystem\Exception\IOException; +use Symfony\Component\Finder\Finder; +use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; + +class container_builder +{ + /** + * @var string The environment to use. + */ + protected $environment; + + /** + * @var string phpBB Root Path + */ + protected $phpbb_root_path; + + /** + * @var string php file extension + */ + protected $php_ext; + + /** + * The container under construction + * + * @var ContainerBuilder + */ + protected $container; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $dbal_connection = null; + + /** + * Indicates whether extensions should be used (default to true). + * + * @var bool + */ + protected $use_extensions = true; + + /** + * Defines a custom path to find the configuration of the container (default to $this->phpbb_root_path . 'config') + * + * @var string + */ + protected $config_path = null; + + /** + * Indicates whether the container should be dumped to the filesystem (default to true). + * + * If DEBUG_CONTAINER is set this option is ignored and a new container is build. + * + * @var bool + */ + protected $use_cache = true; + + /** + * Indicates if the container should be compiled automatically (default to true). + * + * @var bool + */ + protected $compile_container = true; + + /** + * Custom parameters to inject into the container. + * + * Default to: + * array( + * 'core.root_path', $this->phpbb_root_path, + * 'core.php_ext', $this->php_ext, + * ); + * + * @var array + */ + protected $custom_parameters = []; + + /** + * @var \phpbb\config_php_file + */ + protected $config_php_file; + + /** + * @var string + */ + protected $cache_dir; + + /** + * @var array + */ + private $container_extensions; + + /** @var \Exception */ + private $build_exception; + + /** + * Constructor + * + * @param string $phpbb_root_path Path to the phpbb includes directory. + * @param string $php_ext php file extension + */ + public function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + } + + /** + * Build and return a new Container respecting the current configuration + * + * @return \phpbb_cache_container|ContainerBuilder + */ + public function get_container() + { + try + { + $container_filename = $this->get_container_filename(); + $config_cache = new ConfigCache($container_filename, defined('DEBUG')); + if ($this->use_cache && $config_cache->isFresh()) + { + if ($this->use_extensions) + { + $autoload_cache = new ConfigCache($this->get_autoload_filename(), defined('DEBUG')); + if (!$autoload_cache->isFresh()) + { + // autoload cache should be refreshed + $this->load_extensions(); + } + + require($this->get_autoload_filename()); + } + + require($config_cache->getPath()); + $this->container = new \phpbb_cache_container(); + } + else + { + $this->container_extensions = array(new extension\core($this->get_config_path())); + + if ($this->use_extensions) + { + $this->load_extensions(); + } + + // Inject the config + if ($this->config_php_file) + { + $this->container_extensions[] = new extension\config($this->config_php_file); + } + + $this->container = $this->create_container($this->container_extensions); + + // Easy collections through tags + $this->container->addCompilerPass(new pass\collection_pass()); + + // Event listeners "phpBB style" + $this->container->addCompilerPass(new RegisterListenersPass('dispatcher', 'event.listener_listener', 'event.listener')); + + // Event listeners "Symfony style" + $this->container->addCompilerPass(new RegisterListenersPass('dispatcher')); + + if ($this->use_extensions) + { + $this->register_ext_compiler_pass(); + } + + $filesystem = new filesystem(); + $loader = new YamlFileLoader($this->container, new FileLocator($filesystem->realpath($this->get_config_path()))); + $loader->load($this->container->getParameter('core.environment') . '/config.yml'); + + $this->inject_custom_parameters(); + + if ($this->compile_container) + { + $this->container->compile(); + + if ($this->use_cache) + { + $this->dump_container($config_cache); + } + } + } + + if ($this->compile_container && $this->config_php_file) + { + $this->container->set('config.php', $this->config_php_file); + } + + $this->inject_dbal_driver(); + + return $this->container; + } + catch (\Exception $e) + { + // Don't try to recover if we are in the development environment + if ($this->get_environment() === 'development') + { + throw $e; + } + + if ($this->build_exception === null) + { + $this->build_exception = $e; + + return $this + ->without_extensions() + ->without_cache() + ->with_custom_parameters(array_merge($this->custom_parameters, [ + 'container_exception' => $e, + ])) + ->get_container(); + } + else + { + // Rethrow the original exception if it's still failing + throw $this->build_exception; + } + } + } + + /** + * Enable the extensions. + * + * @param string $environment The environment to use + * @return $this + */ + public function with_environment($environment) + { + $this->environment = $environment; + + return $this; + } + + /** + * Enable the extensions. + * + * @return $this + */ + public function with_extensions() + { + $this->use_extensions = true; + + return $this; + } + + /** + * Disable the extensions. + * + * @return $this + */ + public function without_extensions() + { + $this->use_extensions = false; + + return $this; + } + + /** + * Enable the caching of the container. + * + * If DEBUG_CONTAINER is set this option is ignored and a new container is build. + * + * @return $this + */ + public function with_cache() + { + $this->use_cache = true; + + return $this; + } + + /** + * Disable the caching of the container. + * + * @return $this + */ + public function without_cache() + { + $this->use_cache = false; + + return $this; + } + + /** + * Set the cache directory. + * + * @param string $cache_dir The cache directory. + * @return $this + */ + public function with_cache_dir($cache_dir) + { + $this->cache_dir = $cache_dir; + + return $this; + } + + /** + * Enable the compilation of the container. + * + * @return $this + */ + public function with_compiled_container() + { + $this->compile_container = true; + + return $this; + } + + /** + * Disable the compilation of the container. + * + * @return $this + */ + public function without_compiled_container() + { + $this->compile_container = false; + + return $this; + } + + /** + * Set a custom path to find the configuration of the container. + * + * @param string $config_path + * @return $this + */ + public function with_config_path($config_path) + { + $this->config_path = $config_path; + + return $this; + } + + /** + * Set custom parameters to inject into the container. + * + * @param array $custom_parameters + * @return $this + */ + public function with_custom_parameters($custom_parameters) + { + $this->custom_parameters = $custom_parameters; + + return $this; + } + + /** + * Set custom parameters to inject into the container. + * + * @param \phpbb\config_php_file $config_php_file + * @return $this + */ + public function with_config(\phpbb\config_php_file $config_php_file) + { + $this->config_php_file = $config_php_file; + + return $this; + } + + /** + * Returns the path to the container configuration (default: root_path/config) + * + * @return string + */ + protected function get_config_path() + { + return $this->config_path ?: $this->phpbb_root_path . 'config'; + } + + /** + * Returns the path to the cache directory (default: root_path/cache/environment). + * + * @return string Path to the cache directory. + */ + protected function get_cache_dir() + { + return $this->cache_dir ?: $this->phpbb_root_path . 'cache/' . $this->get_environment() . '/'; + } + + /** + * Load the enabled extensions. + */ + protected function load_extensions() + { + if ($this->config_php_file !== null) + { + // Build an intermediate container to load the ext list from the database + $container_builder = new container_builder($this->phpbb_root_path, $this->php_ext); + $ext_container = $container_builder + ->without_cache() + ->without_extensions() + ->with_config($this->config_php_file) + ->with_config_path($this->get_config_path()) + ->with_environment('production') + ->without_compiled_container() + ->get_container() + ; + + $ext_container->register('cache.driver', '\\phpbb\\cache\\driver\\dummy'); + $ext_container->compile(); + + $extensions = $ext_container->get('ext.manager')->all_enabled(); + + // Load each extension found + $autoloaders = ' $path) + { + $extension_class = '\\' . str_replace('/', '\\', $ext_name) . '\\di\\extension'; + + if (!class_exists($extension_class)) + { + $extension_class = '\\phpbb\\extension\\di\\extension_base'; + } + + $this->container_extensions[] = new $extension_class($ext_name, $path); + + // Load extension autoloader + $filename = $path . 'vendor/autoload.php'; + if (file_exists($filename)) + { + $autoloaders .= "require('{$filename}');\n"; + } + } + + $configCache = new ConfigCache($this->get_autoload_filename(), false); + $configCache->write($autoloaders); + + require($this->get_autoload_filename()); + } + else + { + // To load the extensions we need the database credentials. + // Automatically disable the extensions if we don't have them. + $this->use_extensions = false; + } + } + + /** + * Dump the container to the disk. + * + * @param ConfigCache $cache The config cache + */ + protected function dump_container($cache) + { + try + { + $dumper = new PhpDumper($this->container); + $proxy_dumper = new ProxyDumper(); + $dumper->setProxyDumper($proxy_dumper); + + $cached_container_dump = $dumper->dump(array( + 'class' => 'phpbb_cache_container', + 'base_class' => 'Symfony\\Component\\DependencyInjection\\ContainerBuilder', + )); + + $cache->write($cached_container_dump, $this->container->getResources()); + } + catch (IOException $e) + { + // Don't fail if the cache isn't writeable + } + } + + /** + * Create the ContainerBuilder object + * + * @param array $extensions Array of Container extension objects + * @return ContainerBuilder object + */ + protected function create_container(array $extensions) + { + $container = new ContainerBuilder(new ParameterBag($this->get_core_parameters())); + $container->setProxyInstantiator(new proxy_instantiator($this->get_cache_dir())); + + $extensions_alias = array(); + + foreach ($extensions as $extension) + { + $container->registerExtension($extension); + $extensions_alias[] = $extension->getAlias(); + } + + $container->getCompilerPassConfig()->setMergePass(new MergeExtensionConfigurationPass($extensions_alias)); + + return $container; + } + + /** + * Inject the customs parameters into the container + */ + protected function inject_custom_parameters() + { + foreach ($this->custom_parameters as $key => $value) + { + $this->container->setParameter($key, $value); + } + } + + /** + * Inject the dbal connection driver into container + */ + protected function inject_dbal_driver() + { + if (empty($this->config_php_file)) + { + return; + } + + $config_data = $this->config_php_file->get_all(); + if (!empty($config_data)) + { + if ($this->dbal_connection === null) + { + $dbal_driver_class = $this->config_php_file->convert_30_dbms_to_31($this->config_php_file->get('dbms')); + /** @var \phpbb\db\driver\driver_interface $dbal_connection */ + $this->dbal_connection = new $dbal_driver_class(); + $this->dbal_connection->sql_connect( + $this->config_php_file->get('dbhost'), + $this->config_php_file->get('dbuser'), + $this->config_php_file->get('dbpasswd'), + $this->config_php_file->get('dbname'), + $this->config_php_file->get('dbport'), + false, + defined('PHPBB_DB_NEW_LINK') && PHPBB_DB_NEW_LINK + ); + } + $this->container->set('dbal.conn.driver', $this->dbal_connection); + } + } + + /** + * Returns the core parameters. + * + * @return array An array of core parameters + */ + protected function get_core_parameters() + { + return array_merge( + array( + 'core.root_path' => $this->phpbb_root_path, + 'core.php_ext' => $this->php_ext, + 'core.environment' => $this->get_environment(), + 'core.debug' => defined('DEBUG') ? DEBUG : false, + 'core.cache_dir' => $this->get_cache_dir(), + ), + $this->get_env_parameters() + ); + } + + /** + * Gets the environment parameters. + * + * Only the parameters starting with "PHPBB__" are considered. + * + * @return array An array of parameters + */ + protected function get_env_parameters() + { + $parameters = array(); + foreach ($_SERVER as $key => $value) + { + if (0 === strpos($key, 'PHPBB__')) + { + $parameters[strtolower(str_replace('__', '.', substr($key, 9)))] = $value; + } + } + + return $parameters; + } + + /** + * Get the filename under which the dumped container will be stored. + * + * @return string Path for dumped container + */ + protected function get_container_filename() + { + $container_params = [ + 'phpbb_root_path' => $this->phpbb_root_path, + 'use_extensions' => $this->use_extensions, + 'config_path' => $this->config_path, + ]; + + return $this->get_cache_dir() . 'container_' . md5(implode(',', $container_params)) . '.' . $this->php_ext; + } + + /** + * Get the filename under which the dumped extensions autoloader will be stored. + * + * @return string Path for dumped extensions autoloader + */ + protected function get_autoload_filename() + { + $container_params = [ + 'phpbb_root_path' => $this->phpbb_root_path, + 'use_extensions' => $this->use_extensions, + 'config_path' => $this->config_path, + ]; + + return $this->get_cache_dir() . 'autoload_' . md5(implode(',', $container_params)) . '.' . $this->php_ext; + } + + /** + * Return the name of the current environment. + * + * @return string + */ + protected function get_environment() + { + return $this->environment ?: PHPBB_ENVIRONMENT; + } + + private function register_ext_compiler_pass() + { + $finder = new Finder(); + $finder + ->name('*_pass.php') + ->path('di/pass') + ->files() + ->ignoreDotFiles(true) + ->ignoreUnreadableDirs(true) + ->ignoreVCS(true) + ->followLinks() + ->in($this->phpbb_root_path . 'ext') + ; + + /** @var \SplFileInfo $pass */ + foreach ($finder as $pass) + { + $filename = $pass->getPathname(); + $filename = substr($filename, 0, -strlen('.' . $pass->getExtension())); + $filename = str_replace(DIRECTORY_SEPARATOR, '/', $filename); + $className = preg_replace('#^.*ext/#', '', $filename); + $className = '\\' . str_replace('/', '\\', $className); + + if (class_exists($className) && in_array('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface', class_implements($className), true)) + { + $this->container->addCompilerPass(new $className()); + } + } + } +} diff --git a/install/update/old/phpbb/di/extension/container_configuration.php b/install/update/old/phpbb/di/extension/container_configuration.php new file mode 100644 index 0000000..4585d65 --- /dev/null +++ b/install/update/old/phpbb/di/extension/container_configuration.php @@ -0,0 +1,52 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di\extension; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +class container_configuration implements ConfigurationInterface +{ + + /** + * Generates the configuration tree builder. + * + * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('core'); + $rootNode + ->children() + ->booleanNode('require_dev_dependencies')->defaultValue(false)->end() + ->arrayNode('debug') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('exceptions')->defaultValue(false)->end() + ->end() + ->end() + ->arrayNode('twig') + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('debug')->defaultValue(null)->end() + ->booleanNode('auto_reload')->defaultValue(null)->end() + ->booleanNode('enable_debug_extension')->defaultValue(false)->end() + ->end() + ->end() + ->end() + ; + return $treeBuilder; + } +} diff --git a/install/update/old/phpbb/di/extension/core.php b/install/update/old/phpbb/di/extension/core.php new file mode 100644 index 0000000..67150f0 --- /dev/null +++ b/install/update/old/phpbb/di/extension/core.php @@ -0,0 +1,124 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di\extension; + +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\HttpKernel\DependencyInjection\Extension; + +/** +* Container core extension +*/ +class core extends Extension +{ + const TWIG_OPTIONS_POSITION = 7; + + /** + * Config path + * @var string + */ + protected $config_path; + + /** + * Constructor + * + * @param string $config_path Config path + */ + public function __construct($config_path) + { + $this->config_path = $config_path; + } + + /** + * Loads a specific configuration. + * + * @param array $configs An array of configuration values + * @param ContainerBuilder $container A ContainerBuilder instance + * + * @throws \InvalidArgumentException When provided tag is not defined in this extension + */ + public function load(array $configs, ContainerBuilder $container) + { + $filesystem = new \phpbb\filesystem\filesystem(); + $loader = new YamlFileLoader($container, new FileLocator($filesystem->realpath($this->config_path))); + $loader->load($container->getParameter('core.environment') . '/container/environment.yml'); + + $config = $this->getConfiguration($configs, $container); + $config = $this->processConfiguration($config, $configs); + + if ($config['require_dev_dependencies']) + { + if (!class_exists('Goutte\Client', true)) + { + trigger_error( + 'Composer development dependencies have not been set up for the ' . $container->getParameter('core.environment') . ' environment yet, run ' . + "'php ../composer.phar install --dev' from the phpBB directory to do so.", + E_USER_ERROR + ); + } + } + + // Set the Twig options if defined in the environment + $definition = $container->getDefinition('template.twig.environment'); + $twig_environment_options = $definition->getArgument(static::TWIG_OPTIONS_POSITION); + if ($config['twig']['debug']) + { + $twig_environment_options['debug'] = true; + } + if ($config['twig']['auto_reload']) + { + $twig_environment_options['auto_reload'] = true; + } + + // Replace the 7th argument, the options passed to the environment + $definition->replaceArgument(static::TWIG_OPTIONS_POSITION, $twig_environment_options); + + if ($config['twig']['enable_debug_extension']) + { + $definition = $container->getDefinition('template.twig.extensions.debug'); + $definition->addTag('twig.extension'); + } + + // Set the debug options + foreach ($config['debug'] as $name => $value) + { + $container->setParameter('debug.' . $name, $value); + } + } + + /** + * {@inheritdoc} + */ + public function getConfiguration(array $config, ContainerBuilder $container) + { + $r = new \ReflectionClass('\phpbb\di\extension\container_configuration'); + $container->addResource(new FileResource($r->getFileName())); + + return new container_configuration(); + } + + /** + * Returns the recommended alias to use in XML. + * + * This alias is also the mandatory prefix to use when using YAML. + * + * @return string The alias + */ + public function getAlias() + { + return 'core'; + } +} diff --git a/install/update/old/phpbb/di/service_collection.php b/install/update/old/phpbb/di/service_collection.php new file mode 100644 index 0000000..8e9175e --- /dev/null +++ b/install/update/old/phpbb/di/service_collection.php @@ -0,0 +1,106 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\di; + +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* Collection of services to be configured at container compile time. +*/ +class service_collection extends \ArrayObject +{ + /** + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * @var array + */ + protected $service_classes; + + /** + * Constructor + * + * @param ContainerInterface $container Container object + */ + public function __construct(ContainerInterface $container) + { + $this->container = $container; + $this->service_classes = array(); + } + + /** + * {@inheritdoc} + */ + public function getIterator() + { + return new service_collection_iterator($this); + } + + // Because of a PHP issue we have to redefine offsetExists + // (even with a call to the parent): + // https://bugs.php.net/bug.php?id=66834 + // https://bugs.php.net/bug.php?id=67067 + // But it triggers a sniffer issue that we have to skip + // @codingStandardsIgnoreStart + /** + * {@inheritdoc} + */ + public function offsetExists($index) + { + return parent::offsetExists($index); + } + // @codingStandardsIgnoreEnd + + /** + * {@inheritdoc} + */ + public function offsetGet($index) + { + return $this->container->get($index); + } + + /** + * Add a service to the collection + * + * @param string $name The service name + * @return null + */ + public function add($name) + { + $this->offsetSet($name, null); + } + + /** + * Add a service's class to the collection + * + * @param string $service_id + * @param string $class + */ + public function add_service_class($service_id, $class) + { + $this->service_classes[$service_id] = $class; + } + + /** + * Get services' classes + * + * @return array + */ + public function get_service_classes() + { + return $this->service_classes; + } +} diff --git a/install/update/old/phpbb/event/md_exporter.php b/install/update/old/phpbb/event/md_exporter.php new file mode 100644 index 0000000..c3942bd --- /dev/null +++ b/install/update/old/phpbb/event/md_exporter.php @@ -0,0 +1,561 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\event; + +/** +* Crawls through a markdown file and grabs all events +*/ +class md_exporter +{ + /** @var string Path where we look for files*/ + protected $path; + + /** @var string phpBB Root Path */ + protected $root_path; + + /** @var string The minimum version for the events to return */ + protected $min_version; + + /** @var string The maximum version for the events to return */ + protected $max_version; + + /** @var string */ + protected $filter; + + /** @var string */ + protected $current_event; + + /** @var array */ + protected $events; + + /** + * @param string $phpbb_root_path + * @param mixed $extension String 'vendor/ext' to filter, null for phpBB core + * @param string $min_version + * @param string $max_version + */ + public function __construct($phpbb_root_path, $extension = null, $min_version = null, $max_version = null) + { + $this->root_path = $phpbb_root_path; + $this->path = $this->root_path; + if ($extension) + { + $this->path .= 'ext/' . $extension . '/'; + } + + $this->events = array(); + $this->events_by_file = array(); + $this->filter = $this->current_event = ''; + $this->min_version = $min_version; + $this->max_version = $max_version; + } + + /** + * Get the list of all events + * + * @return array Array with events: name => details + */ + public function get_events() + { + return $this->events; + } + + /** + * @param string $md_file Relative from phpBB root + * @return int Number of events found + * @throws \LogicException + */ + public function crawl_phpbb_directory_adm($md_file) + { + $this->crawl_eventsmd($md_file, 'adm'); + + $file_list = $this->get_recursive_file_list($this->path . 'adm/style/'); + foreach ($file_list as $file) + { + $file_name = 'adm/style/' . $file; + $this->validate_events_from_file($file_name, $this->crawl_file_for_events($file_name)); + } + + return count($this->events); + } + + /** + * @param string $md_file Relative from phpBB root + * @return int Number of events found + * @throws \LogicException + */ + public function crawl_phpbb_directory_styles($md_file) + { + $this->crawl_eventsmd($md_file, 'styles'); + + $styles = array('prosilver'); + foreach ($styles as $style) + { + $file_list = $this->get_recursive_file_list( + $this->path . 'styles/' . $style . '/template/' + ); + + foreach ($file_list as $file) + { + $file_name = 'styles/' . $style . '/template/' . $file; + $this->validate_events_from_file($file_name, $this->crawl_file_for_events($file_name)); + } + } + + return count($this->events); + } + + /** + * @param string $md_file Relative from phpBB root + * @param string $filter Should be 'styles' or 'adm' + * @return int Number of events found + * @throws \LogicException + */ + public function crawl_eventsmd($md_file, $filter) + { + if (!file_exists($this->path . $md_file)) + { + throw new \LogicException("The event docs file '{$md_file}' could not be found"); + } + + $file_content = file_get_contents($this->path . $md_file); + $this->filter = $filter; + + $events = explode("\n\n", $file_content); + foreach ($events as $event) + { + // Last row of the file + if (strpos($event, "\n===\n") === false) + { + continue; + } + + list($event_name, $details) = explode("\n===\n", $event, 2); + $this->validate_event_name($event_name); + $sorted_events = [$this->current_event, $event_name]; + natsort($sorted_events); + $this->current_event = $event_name; + + if (isset($this->events[$this->current_event])) + { + throw new \LogicException("The event '{$this->current_event}' is defined multiple times"); + } + + // Use array_values() to get actual first element and check against natural order + if (array_values($sorted_events)[0] === $event_name) + { + throw new \LogicException("The event '{$sorted_events[1]}' should be defined before '{$sorted_events[0]}'"); + } + + if (($this->filter == 'adm' && strpos($this->current_event, 'acp_') !== 0) + || ($this->filter == 'styles' && strpos($this->current_event, 'acp_') === 0)) + { + continue; + } + + list($file_details, $details) = explode("\n* Since: ", $details, 2); + + $changed_versions = array(); + if (strpos($details, "\n* Changed: ") !== false) + { + list($since, $details) = explode("\n* Changed: ", $details, 2); + while (strpos($details, "\n* Changed: ") !== false) + { + list($changed, $details) = explode("\n* Changed: ", $details, 2); + $changed_versions[] = $changed; + } + list($changed, $description) = explode("\n* Purpose: ", $details, 2); + $changed_versions[] = $changed; + } + else + { + list($since, $description) = explode("\n* Purpose: ", $details, 2); + $changed_versions = array(); + } + + $files = $this->validate_file_list($file_details); + $since = $this->validate_since($since); + $changes = array(); + foreach ($changed_versions as $changed) + { + list($changed_version, $changed_description) = $this->validate_changed($changed); + + if (isset($changes[$changed_version])) + { + throw new \LogicException("Duplicate change information found for event '{$this->current_event}'"); + } + + $changes[$changed_version] = $changed_description; + } + $description = trim($description, "\n") . "\n"; + + if (!$this->version_is_filtered($since)) + { + $is_filtered = false; + foreach ($changes as $version => $null) + { + if ($this->version_is_filtered($version)) + { + $is_filtered = true; + break; + } + } + + if (!$is_filtered) + { + continue; + } + } + + $this->events[$event_name] = array( + 'event' => $this->current_event, + 'files' => $files, + 'since' => $since, + 'changed' => $changes, + 'description' => $description, + ); + } + + return count($this->events); + } + + /** + * The version to check + * + * @param string $version + * @return bool + */ + protected function version_is_filtered($version) + { + return (!$this->min_version || phpbb_version_compare($this->min_version, $version, '<=')) + && (!$this->max_version || phpbb_version_compare($this->max_version, $version, '>=')); + } + + /** + * Format the php events as a wiki table + * + * @param string $action + * @return string Number of events found + */ + public function export_events_for_wiki($action = '') + { + if ($this->filter === 'adm') + { + if ($action === 'diff') + { + $wiki_page = '=== ACP Template Events ===' . "\n"; + } + else + { + $wiki_page = '= ACP Template Events =' . "\n"; + } + $wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n"; + $wiki_page .= '! Identifier !! Placement !! Added in Release !! Explanation' . "\n"; + } + else + { + if ($action === 'diff') + { + $wiki_page = '=== Template Events ===' . "\n"; + } + else + { + $wiki_page = '= Template Events =' . "\n"; + } + $wiki_page .= '{| class="zebra sortable" cellspacing="0" cellpadding="5"' . "\n"; + $wiki_page .= '! Identifier !! Prosilver Placement (If applicable) !! Added in Release !! Explanation' . "\n"; + } + + foreach ($this->events as $event_name => $event) + { + $wiki_page .= "|- id=\"{$event_name}\"\n"; + $wiki_page .= "| [[#{$event_name}|{$event_name}]] || "; + + if ($this->filter === 'adm') + { + $wiki_page .= implode(', ', $event['files']['adm']); + } + else + { + $wiki_page .= implode(', ', $event['files']['prosilver']); + } + + $wiki_page .= " || {$event['since']} || " . str_replace("\n", ' ', $event['description']) . "\n"; + } + $wiki_page .= '|}' . "\n"; + + return $wiki_page; + } + + /** + * Validates a template event name + * + * @param $event_name + * @return null + * @throws \LogicException + */ + public function validate_event_name($event_name) + { + if (!preg_match('#^([a-z][a-z0-9]*(?:_[a-z][a-z0-9]*)+)$#', $event_name)) + { + throw new \LogicException("Invalid event name '{$event_name}'"); + } + } + + /** + * Validate "Since" Information + * + * @param string $since + * @return string + * @throws \LogicException + */ + public function validate_since($since) + { + if (!$this->validate_version($since)) + { + throw new \LogicException("Invalid since information found for event '{$this->current_event}'"); + } + + return $since; + } + + /** + * Validate "Changed" Information + * + * @param string $changed + * @return string + * @throws \LogicException + */ + public function validate_changed($changed) + { + if (strpos($changed, ' ') !== false) + { + list($version, $description) = explode(' ', $changed, 2); + } + else + { + $version = $changed; + $description = ''; + } + + if (!$this->validate_version($version)) + { + throw new \LogicException("Invalid changed information found for event '{$this->current_event}'"); + } + + return array($version, $description); + } + + /** + * Validate "version" Information + * + * @param string $version + * @return bool True if valid, false otherwise + */ + public function validate_version($version) + { + return preg_match('#^\d+\.\d+\.\d+(?:-(?:a|b|RC|pl)\d+)?$#', $version); + } + + /** + * Validate the files list + * + * @param string $file_details + * @return array + * @throws \LogicException + */ + public function validate_file_list($file_details) + { + $files_list = array( + 'prosilver' => array(), + 'adm' => array(), + ); + + // Multi file list + if (strpos($file_details, "* Locations:\n + ") === 0) + { + $file_details = substr($file_details, strlen("* Locations:\n + ")); + $files = explode("\n + ", $file_details); + foreach ($files as $file) + { + if (!file_exists($this->path . $file) || substr($file, -5) !== '.html') + { + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 1); + } + + if (($this->filter !== 'adm') && strpos($file, 'styles/prosilver/template/') === 0) + { + $files_list['prosilver'][] = substr($file, strlen('styles/prosilver/template/')); + } + else if (($this->filter === 'adm') && strpos($file, 'adm/style/') === 0) + { + $files_list['adm'][] = substr($file, strlen('adm/style/')); + } + else + { + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 2); + } + + $this->events_by_file[$file][] = $this->current_event; + } + } + else if ($this->filter == 'adm') + { + $file = substr($file_details, strlen('* Location: ')); + if (!file_exists($this->path . $file) || substr($file, -5) !== '.html') + { + throw new \LogicException("Invalid file '{$file}' not found for event '{$this->current_event}'", 1); + } + + $files_list['adm'][] = substr($file, strlen('adm/style/')); + + $this->events_by_file[$file][] = $this->current_event; + } + else + { + throw new \LogicException("Invalid file list found for event '{$this->current_event}'", 2); + } + + return $files_list; + } + + /** + * Get all template events in a template file + * + * @param string $file + * @return array + * @throws \LogicException + */ + public function crawl_file_for_events($file) + { + if (!file_exists($this->path . $file)) + { + throw new \LogicException("File '{$file}' does not exist", 1); + } + + $event_list = array(); + $file_content = file_get_contents($this->path . $file); + + preg_match_all('/(?:{%|)/U', $file_content, $event_list); + + return $event_list[1]; + } + + /** + * Validates whether all events from $file are in the md file and vice-versa + * + * @param string $file + * @param array $events + * @return true + * @throws \LogicException + */ + public function validate_events_from_file($file, array $events) + { + if (empty($this->events_by_file[$file]) && empty($events)) + { + return true; + } + else if (empty($this->events_by_file[$file])) + { + $event_list = implode("', '", $events); + throw new \LogicException("File '{$file}' should not contain events, but contains: " + . "'{$event_list}'", 1); + } + else if (empty($events)) + { + $event_list = implode("', '", $this->events_by_file[$file]); + throw new \LogicException("File '{$file}' contains no events, but should contain: " + . "'{$event_list}'", 1); + } + + $missing_events_from_file = array(); + foreach ($this->events_by_file[$file] as $event) + { + if (!in_array($event, $events)) + { + $missing_events_from_file[] = $event; + } + } + + if (!empty($missing_events_from_file)) + { + $event_list = implode("', '", $missing_events_from_file); + throw new \LogicException("File '{$file}' does not contain events: '{$event_list}'", 2); + } + + $missing_events_from_md = array(); + foreach ($events as $event) + { + if (!in_array($event, $this->events_by_file[$file])) + { + $missing_events_from_md[] = $event; + } + } + + if (!empty($missing_events_from_md)) + { + $event_list = implode("', '", $missing_events_from_md); + throw new \LogicException("File '{$file}' contains additional events: '{$event_list}'", 3); + } + + return true; + } + + /** + * Returns a list of files in $dir + * + * Works recursive with any depth + * + * @param string $dir Directory to go through + * @return array List of files (including directories) + */ + public function get_recursive_file_list($dir) + { + try + { + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $dir, + \FilesystemIterator::SKIP_DOTS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + } + catch (\Exception $e) + { + return array(); + } + + $files = array(); + foreach ($iterator as $file_info) + { + /** @var \RecursiveDirectoryIterator $file_info */ + if ($file_info->isDir()) + { + continue; + } + + $relative_path = $iterator->getInnerIterator()->getSubPathname(); + + if (substr($relative_path, -5) == '.html') + { + $files[] = str_replace(DIRECTORY_SEPARATOR, '/', $relative_path); + } + } + + return $files; + } +} diff --git a/install/update/old/phpbb/extension/extension_interface.php b/install/update/old/phpbb/extension/extension_interface.php new file mode 100644 index 0000000..6a6b6ad --- /dev/null +++ b/install/update/old/phpbb/extension/extension_interface.php @@ -0,0 +1,70 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\extension; + +/** +* The interface extension meta classes have to implement to run custom code +* on enable/disable/purge. +*/ +interface extension_interface +{ + /** + * Indicate whether or not the extension can be enabled. + * + * @return bool + */ + public function is_enableable(); + + /** + * enable_step is executed on enabling an extension until it returns false. + * + * Calls to this function can be made in subsequent requests, when the + * function is invoked through a webserver with a too low max_execution_time. + * + * @param mixed $old_state The return value of the previous call + * of this method, or false on the first call + * @return mixed Returns false after last step, otherwise + * temporary state which is passed as an + * argument to the next step + */ + public function enable_step($old_state); + + /** + * Disables the extension. + * + * Calls to this function can be made in subsequent requests, when the + * function is invoked through a webserver with a too low max_execution_time. + * + * @param mixed $old_state The return value of the previous call + * of this method, or false on the first call + * @return mixed Returns false after last step, otherwise + * temporary state which is passed as an + * argument to the next step + */ + public function disable_step($old_state); + + /** + * purge_step is executed on purging an extension until it returns false. + * + * Calls to this function can be made in subsequent requests, when the + * function is invoked through a webserver with a too low max_execution_time. + * + * @param mixed $old_state The return value of the previous call + * of this method, or false on the first call + * @return mixed Returns false after last step, otherwise + * temporary state which is passed as an + * argument to the next step + */ + public function purge_step($old_state); +} diff --git a/install/update/old/phpbb/extension/manager.php b/install/update/old/phpbb/extension/manager.php new file mode 100644 index 0000000..4b4109b --- /dev/null +++ b/install/update/old/phpbb/extension/manager.php @@ -0,0 +1,633 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\extension; + +use phpbb\exception\runtime_exception; +use phpbb\file_downloader; +use Symfony\Component\DependencyInjection\ContainerInterface; + +/** +* The extension manager provides means to activate/deactivate extensions. +*/ +class manager +{ + /** @var ContainerInterface */ + protected $container; + + protected $db; + protected $config; + protected $cache; + protected $php_ext; + protected $extensions; + protected $extension_table; + protected $phpbb_root_path; + protected $cache_name; + + /** + * Creates a manager and loads information from database + * + * @param ContainerInterface $container A container + * @param \phpbb\db\driver\driver_interface $db A database connection + * @param \phpbb\config\config $config Config object + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param string $extension_table The name of the table holding extensions + * @param string $phpbb_root_path Path to the phpbb includes directory. + * @param string $php_ext php file extension, defaults to php + * @param \phpbb\cache\service $cache A cache instance or null + * @param string $cache_name The name of the cache variable, defaults to _ext + */ + public function __construct(ContainerInterface $container, \phpbb\db\driver\driver_interface $db, \phpbb\config\config $config, \phpbb\filesystem\filesystem_interface $filesystem, $extension_table, $phpbb_root_path, $php_ext = 'php', \phpbb\cache\service $cache = null, $cache_name = '_ext') + { + $this->cache = $cache; + $this->cache_name = $cache_name; + $this->config = $config; + $this->container = $container; + $this->db = $db; + $this->extension_table = $extension_table; + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->extensions = ($this->cache) ? $this->cache->get($this->cache_name) : false; + + if ($this->extensions === false) + { + $this->load_extensions(); + } + } + + /** + * Loads all extension information from the database + * + * @return null + */ + public function load_extensions() + { + $this->extensions = array(); + + // Do not try to load any extensions if the extension table + // does not exist or when installing or updating. + // Note: database updater invokes this code, and in 3.0 + // there is no extension table therefore the rest of this function + // fails + if (defined('IN_INSTALL') || version_compare($this->config['version'], '3.1.0-dev', '<')) + { + return; + } + + $sql = 'SELECT * + FROM ' . $this->extension_table; + + $result = $this->db->sql_query($sql); + $extensions = $this->db->sql_fetchrowset($result); + $this->db->sql_freeresult($result); + + foreach ($extensions as $extension) + { + $extension['ext_path'] = $this->get_extension_path($extension['ext_name']); + $this->extensions[$extension['ext_name']] = $extension; + } + + ksort($this->extensions); + + if ($this->cache) + { + $this->cache->put($this->cache_name, $this->extensions); + } + } + + /** + * Generates the path to an extension + * + * @param string $name The name of the extension + * @param bool $phpbb_relative Whether the path should be relative to phpbb root + * @return string Path to an extension + */ + public function get_extension_path($name, $phpbb_relative = false) + { + $name = str_replace('.', '', $name); + + return (($phpbb_relative) ? $this->phpbb_root_path : '') . 'ext/' . $name . '/'; + } + + /** + * Instantiates the extension meta class for the extension with the given name + * + * @param string $name The extension name + * @return \phpbb\extension\extension_interface Instance of the extension meta class or + * \phpbb\extension\base if the class does not exist + */ + public function get_extension($name) + { + $extension_class_name = str_replace('/', '\\', $name) . '\\ext'; + + $migrator = $this->container->get('migrator'); + + if (class_exists($extension_class_name)) + { + return new $extension_class_name($this->container, $this->get_finder(), $migrator, $name, $this->get_extension_path($name, true)); + } + else + { + return new \phpbb\extension\base($this->container, $this->get_finder(), $migrator, $name, $this->get_extension_path($name, true)); + } + } + + /** + * Instantiates the metadata manager for the extension with the given name + * + * @param string $name The extension name + * @return \phpbb\extension\metadata_manager Instance of the metadata manager + */ + public function create_extension_metadata_manager($name) + { + if (!isset($this->extensions[$name]['metadata'])) + { + $metadata = new \phpbb\extension\metadata_manager($name, $this->get_extension_path($name, true)); + $this->extensions[$name]['metadata'] = $metadata; + } + return $this->extensions[$name]['metadata']; + } + + /** + * Runs a step of the extension enabling process. + * + * Allows the exentension to enable in a long running script that works + * in multiple steps across requests. State is kept for the extension + * in the extensions table. + * + * @param string $name The extension's name + * @return bool False if enabling is finished, true otherwise + */ + public function enable_step($name) + { + // ignore extensions that are already enabled + if ($this->is_enabled($name)) + { + return false; + } + + $old_state = (isset($this->extensions[$name]['ext_state'])) ? unserialize($this->extensions[$name]['ext_state']) : false; + + $extension = $this->get_extension($name); + + if (!$extension->is_enableable()) + { + return false; + } + + $state = $extension->enable_step($old_state); + + $active = ($state === false); + + $extension_data = array( + 'ext_name' => $name, + 'ext_active' => $active, + 'ext_state' => serialize($state), + ); + + $this->extensions[$name] = $extension_data; + $this->extensions[$name]['ext_path'] = $this->get_extension_path($extension_data['ext_name']); + ksort($this->extensions); + + $sql = 'SELECT COUNT(ext_name) as row_count + FROM ' . $this->extension_table . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $result = $this->db->sql_query($sql); + $count = $this->db->sql_fetchfield('row_count'); + $this->db->sql_freeresult($result); + + if ($count) + { + $sql = 'UPDATE ' . $this->extension_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + } + else + { + $sql = 'INSERT INTO ' . $this->extension_table . ' + ' . $this->db->sql_build_array('INSERT', $extension_data); + $this->db->sql_query($sql); + } + + if ($this->cache) + { + $this->cache->purge(); + } + + if ($active) + { + $this->config->increment('assets_version', 1); + } + + return !$active; + } + + /** + * Enables an extension + * + * This method completely enables an extension. But it could be long running + * so never call this in a script that has a max_execution time. + * + * @param string $name The extension's name + * @return null + */ + public function enable($name) + { + // @codingStandardsIgnoreStart + while ($this->enable_step($name)); + // @codingStandardsIgnoreEnd + } + + /** + * Disables an extension + * + * Calls the disable method on the extension's meta class to allow it to + * process the event. + * + * @param string $name The extension's name + * @return bool False if disabling is finished, true otherwise + */ + public function disable_step($name) + { + // ignore extensions that are not enabled + if (!$this->is_enabled($name)) + { + return false; + } + + $old_state = unserialize($this->extensions[$name]['ext_state']); + + $extension = $this->get_extension($name); + $state = $extension->disable_step($old_state); + + // continue until the state is false + if ($state !== false) + { + $extension_data = array( + 'ext_state' => serialize($state), + ); + $this->extensions[$name]['ext_state'] = serialize($state); + + $sql = 'UPDATE ' . $this->extension_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + + if ($this->cache) + { + $this->cache->purge(); + } + + return true; + } + + $extension_data = array( + 'ext_active' => false, + 'ext_state' => serialize(false), + ); + $this->extensions[$name]['ext_active'] = false; + $this->extensions[$name]['ext_state'] = serialize(false); + + $sql = 'UPDATE ' . $this->extension_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + + if ($this->cache) + { + $this->cache->purge(); + } + + return false; + } + + /** + * Disables an extension + * + * Disables an extension completely at once. This process could run for a + * while so never call this in a script that has a max_execution time. + * + * @param string $name The extension's name + * @return null + */ + public function disable($name) + { + // @codingStandardsIgnoreStart + while ($this->disable_step($name)); + // @codingStandardsIgnoreEnd + } + + /** + * Purge an extension + * + * Disables the extension first if active, and then calls purge on the + * extension's meta class to delete the extension's database content. + * + * @param string $name The extension's name + * @return bool False if purging is finished, true otherwise + */ + public function purge_step($name) + { + // ignore extensions that are not configured + if (!$this->is_configured($name)) + { + return false; + } + + // disable first if necessary + if ($this->extensions[$name]['ext_active']) + { + $this->disable($name); + } + + $old_state = unserialize($this->extensions[$name]['ext_state']); + + $extension = $this->get_extension($name); + $state = $extension->purge_step($old_state); + + // continue until the state is false + if ($state !== false) + { + $extension_data = array( + 'ext_state' => serialize($state), + ); + $this->extensions[$name]['ext_state'] = serialize($state); + + $sql = 'UPDATE ' . $this->extension_table . ' + SET ' . $this->db->sql_build_array('UPDATE', $extension_data) . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + + if ($this->cache) + { + $this->cache->purge(); + } + + return true; + } + + unset($this->extensions[$name]); + + $sql = 'DELETE FROM ' . $this->extension_table . " + WHERE ext_name = '" . $this->db->sql_escape($name) . "'"; + $this->db->sql_query($sql); + + if ($this->cache) + { + $this->cache->purge(); + } + + return false; + } + + /** + * Purge an extension + * + * Purges an extension completely at once. This process could run for a while + * so never call this in a script that has a max_execution time. + * + * @param string $name The extension's name + * @return null + */ + public function purge($name) + { + // @codingStandardsIgnoreStart + while ($this->purge_step($name)); + // @codingStandardsIgnoreEnd + } + + /** + * Retrieves a list of all available extensions on the filesystem + * + * @return array An array with extension names as keys and paths to the + * extension as values + */ + public function all_available() + { + $available = array(); + if (!is_dir($this->phpbb_root_path . 'ext/')) + { + return $available; + } + + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator($this->phpbb_root_path . 'ext/', \FilesystemIterator::NEW_CURRENT_AND_KEY | \FilesystemIterator::FOLLOW_SYMLINKS) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + $iterator->setMaxDepth(2); + + foreach ($iterator as $file_info) + { + if ($file_info->isFile() && $file_info->getFilename() == 'composer.json') + { + $ext_name = $iterator->getInnerIterator()->getSubPath(); + $ext_name = str_replace(DIRECTORY_SEPARATOR, '/', $ext_name); + if ($this->is_available($ext_name)) + { + $available[$ext_name] = $this->get_extension_path($ext_name, true); + } + } + } + ksort($available); + return $available; + } + + /** + * Retrieves all configured extensions. + * + * All enabled and disabled extensions are considered configured. A purged + * extension that is no longer in the database is not configured. + * + * @param bool $phpbb_relative Whether the path should be relative to phpbb root + * + * @return array An array with extension names as keys and and the + * database stored extension information as values + */ + public function all_configured($phpbb_relative = true) + { + $configured = array(); + foreach ($this->extensions as $name => $data) + { + if ($this->is_configured($name)) + { + unset($data['metadata']); + $data['ext_path'] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path']; + $configured[$name] = $data; + } + } + return $configured; + } + + /** + * Retrieves all enabled extensions. + * @param bool $phpbb_relative Whether the path should be relative to phpbb root + * + * @return array An array with extension names as keys and and the + * database stored extension information as values + */ + public function all_enabled($phpbb_relative = true) + { + $enabled = array(); + foreach ($this->extensions as $name => $data) + { + if ($this->is_enabled($name)) + { + $enabled[$name] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path']; + } + } + return $enabled; + } + + /** + * Retrieves all disabled extensions. + * + * @param bool $phpbb_relative Whether the path should be relative to phpbb root + * + * @return array An array with extension names as keys and and the + * database stored extension information as values + */ + public function all_disabled($phpbb_relative = true) + { + $disabled = array(); + foreach ($this->extensions as $name => $data) + { + if ($this->is_disabled($name)) + { + $disabled[$name] = ($phpbb_relative ? $this->phpbb_root_path : '') . $data['ext_path']; + } + } + return $disabled; + } + + /** + * Check to see if a given extension is available on the filesystem + * + * @param string $name Extension name to check NOTE: Can be user input + * @return bool Depending on whether or not the extension is available + */ + public function is_available($name) + { + $md_manager = $this->create_extension_metadata_manager($name); + try + { + return $md_manager->get_metadata('all') && $md_manager->validate_enable(); + } + catch (\phpbb\extension\exception $e) + { + return false; + } + } + + /** + * Check to see if a given extension is enabled + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is enabled + */ + public function is_enabled($name) + { + return isset($this->extensions[$name]['ext_active']) && $this->extensions[$name]['ext_active']; + } + + /** + * Check to see if a given extension is disabled + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is disabled + */ + public function is_disabled($name) + { + return isset($this->extensions[$name]['ext_active']) && !$this->extensions[$name]['ext_active']; + } + + /** + * Check to see if a given extension is configured + * + * All enabled and disabled extensions are considered configured. A purged + * extension that is no longer in the database is not configured. + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is configured + */ + public function is_configured($name) + { + return isset($this->extensions[$name]['ext_active']); + } + + /** + * Check the version and return the available updates (for an extension). + * + * @param \phpbb\extension\metadata_manager $md_manager The metadata manager for the version to check. + * @param bool $force_update Ignores cached data. Defaults to false. + * @param bool $force_cache Force the use of the cache. Override $force_update. + * @param string $stability Force the stability (null by default). + * @return array + * @throws runtime_exception + */ + public function version_check(\phpbb\extension\metadata_manager $md_manager, $force_update = false, $force_cache = false, $stability = null) + { + $meta = $md_manager->get_metadata('all'); + + if (!isset($meta['extra']['version-check'])) + { + throw new runtime_exception('NO_VERSIONCHECK'); + } + + $version_check = $meta['extra']['version-check']; + + $version_helper = new \phpbb\version_helper($this->cache, $this->config, new file_downloader()); + $version_helper->set_current_version($meta['version']); + $version_helper->set_file_location($version_check['host'], $version_check['directory'], $version_check['filename'], isset($version_check['ssl']) ? $version_check['ssl'] : false); + $version_helper->force_stability($stability); + + return $version_helper->get_ext_update_on_branch($force_update, $force_cache); + } + + /** + * Check to see if a given extension is purged + * + * An extension is purged if it is available, not enabled and not disabled. + * + * @param string $name Extension name to check + * @return bool Depending on whether or not the extension is purged + */ + public function is_purged($name) + { + return $this->is_available($name) && !$this->is_configured($name); + } + + /** + * Instantiates a \phpbb\finder. + * + * @param bool $use_all_available Should we load all extensions, or just enabled ones + * @return \phpbb\finder An extension finder instance + */ + public function get_finder($use_all_available = false) + { + $finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, $this->cache, $this->php_ext, $this->cache_name . '_finder'); + if ($use_all_available) + { + $finder->set_extensions(array_keys($this->all_available())); + } + else + { + $finder->set_extensions(array_keys($this->all_enabled())); + } + return $finder; + } +} diff --git a/install/update/old/phpbb/feed/controller/feed.php b/install/update/old/phpbb/feed/controller/feed.php new file mode 100644 index 0000000..c0d7bc7 --- /dev/null +++ b/install/update/old/phpbb/feed/controller/feed.php @@ -0,0 +1,411 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\feed\controller; + +use phpbb\auth\auth; +use phpbb\config\config; +use phpbb\db\driver\driver_interface; +use \phpbb\event\dispatcher_interface; +use phpbb\exception\http_exception; +use phpbb\feed\feed_interface; +use phpbb\feed\exception\feed_unavailable_exception; +use phpbb\feed\exception\unauthorized_exception; +use phpbb\feed\helper as feed_helper; +use phpbb\controller\helper as controller_helper; +use phpbb\symfony_request; +use phpbb\user; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; + +class feed +{ + /** + * @var \Twig_Environment + */ + protected $template; + + /** + * @var symfony_request + */ + protected $request; + + /** + * @var controller_helper + */ + protected $controller_helper; + + /** + * @var config + */ + protected $config; + + /** + * @var driver_interface + */ + protected $db; + + /** + * @var ContainerInterface + */ + protected $container; + + /** + * @var feed_helper + */ + protected $feed_helper; + + /** + * @var user + */ + protected $user; + + /** + * @var auth + */ + protected $auth; + + /** + * @var dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \Twig_Environment $twig + * @param symfony_request $request + * @param controller_helper $controller_helper + * @param config $config + * @param driver_interface $db + * @param ContainerInterface $container + * @param feed_helper $feed_helper + * @param user $user + * @param auth $auth + * @param dispatcher_interface $phpbb_dispatcher + * @param string $php_ext + */ + public function __construct(\Twig_Environment $twig, symfony_request $request, controller_helper $controller_helper, config $config, driver_interface $db, ContainerInterface $container, feed_helper $feed_helper, user $user, auth $auth, dispatcher_interface $phpbb_dispatcher, $php_ext) + { + $this->request = $request; + $this->controller_helper = $controller_helper; + $this->config = $config; + $this->db = $db; + $this->container = $container; + $this->feed_helper = $feed_helper; + $this->user = $user; + $this->auth = $auth; + $this->php_ext = $php_ext; + $this->template = $twig; + $this->phpbb_dispatcher = $phpbb_dispatcher; + } + + /** + * Controller for /feed/forums route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function forums() + { + if (!$this->config['feed_overall_forums']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.forums')); + } + + /** + * Controller for /feed/news route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function news() + { + // Get at least one news forum + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_NEWS, '<> 0'); + $result = $this->db->sql_query_limit($sql, 1, 0, 600); + $s_feed_news = (int) $this->db->sql_fetchfield('forum_id'); + $this->db->sql_freeresult($result); + + if (!$s_feed_news) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.news')); + } + + /** + * Controller for /feed/topics route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topics() + { + if (!$this->config['feed_topics_new']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.topics')); + } + + /** + * Controller for /feed/topics_new route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topics_new() + { + return $this->topics(); + } + + /** + * Controller for /feed/topics_active route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topics_active() + { + if (!$this->config['feed_topics_active']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.topics_active')); + } + + /** + * Controller for /feed/forum/{forum_id} route + * + * @param int $forum_id + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function forum($forum_id) + { + if (!$this->config['feed_forum']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.forum')->set_forum_id($forum_id)); + } + + /** + * Controller for /feed/topic/{topic_id} route + * + * @param int $topic_id + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function topic($topic_id) + { + if (!$this->config['feed_topic']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.topic')->set_topic_id($topic_id)); + } + + /** + * Controller for /feed/{mode] route + * + * @return Response + * + * @throws http_exception when the feed is disabled + */ + public function overall() + { + if (!$this->config['feed_overall']) + { + $this->send_unavailable(); + } + + return $this->send_feed($this->container->get('feed.overall')); + } + + /** + * Display a given feed + * + * @param feed_interface $feed + * + * @return Response + */ + protected function send_feed(feed_interface $feed) + { + try + { + return $this->send_feed_do($feed); + } + catch (feed_unavailable_exception $e) + { + throw new http_exception(Response::HTTP_NOT_FOUND, $e->getMessage(), $e->get_parameters(), $e); + } + catch (unauthorized_exception $e) + { + throw new http_exception(Response::HTTP_FORBIDDEN, $e->getMessage(), $e->get_parameters(), $e); + } + } + + /** + * Really send the feed + * + * @param feed_interface $feed + * + * @return Response + * + * @throw exception\feed_exception + */ + protected function send_feed_do(feed_interface $feed) + { + $feed_updated_time = 0; + $item_vars = array(); + + $board_url = $this->feed_helper->get_board_url(); + + // Open Feed + $feed->open(); + + // Iterate through items + while ($row = $feed->get_item()) + { + /** + * Event to modify the feed row + * + * @event core.feed_modify_feed_row + * @var int forum_id Forum ID + * @var string mode Feeds mode (forums|topics|topics_new|topics_active|news) + * @var array row Array with feed data + * @var int topic_id Topic ID + * + * @since 3.1.10-RC1 + */ + $vars = array('forum_id', 'mode', 'row', 'topic_id'); + extract($this->phpbb_dispatcher->trigger_event('core.feed_modify_feed_row', compact($vars))); + + // BBCode options to correctly disable urls, smilies, bbcode... + if ($feed->get('options') === null) + { + // Allow all combinations + $options = 7; + + if ($feed->get('enable_bbcode') !== null && $feed->get('enable_smilies') !== null && $feed->get('enable_magic_url') !== null) + { + $options = (($row[$feed->get('enable_bbcode')]) ? OPTION_FLAG_BBCODE : 0) + (($row[$feed->get('enable_smilies')]) ? OPTION_FLAG_SMILIES : 0) + (($row[$feed->get('enable_magic_url')]) ? OPTION_FLAG_LINKS : 0); + } + } + else + { + $options = $row[$feed->get('options')]; + } + + $title = (isset($row[$feed->get('title')]) && $row[$feed->get('title')] !== '') ? $row[$feed->get('title')] : ((isset($row[$feed->get('title2')])) ? $row[$feed->get('title2')] : ''); + + $published = ($feed->get('published') !== null) ? (int) $row[$feed->get('published')] : 0; + $updated = ($feed->get('updated') !== null) ? (int) $row[$feed->get('updated')] : 0; + + $display_attachments = ($this->auth->acl_get('u_download') && $this->auth->acl_get('f_download', $row['forum_id']) && isset($row['post_attachment']) && $row['post_attachment']) ? true : false; + + $item_row = array( + 'author' => ($feed->get('creator') !== null) ? $row[$feed->get('creator')] : '', + 'published' => ($published > 0) ? $this->feed_helper->format_date($published) : '', + 'updated' => ($updated > 0) ? $this->feed_helper->format_date($updated) : '', + 'link' => '', + 'title' => censor_text($title), + 'category' => ($this->config['feed_item_statistics'] && !empty($row['forum_id'])) ? $board_url . '/viewforum.' . $this->php_ext . '?f=' . $row['forum_id'] : '', + 'category_name' => ($this->config['feed_item_statistics'] && isset($row['forum_name'])) ? $row['forum_name'] : '', + 'description' => censor_text($this->feed_helper->generate_content($row[$feed->get('text')], $row[$feed->get('bbcode_uid')], $row[$feed->get('bitfield')], $options, $row['forum_id'], ($display_attachments ? $feed->get_attachments($row['post_id']) : array()))), + 'statistics' => '', + ); + + // Adjust items, fill link, etc. + $feed->adjust_item($item_row, $row); + + $item_vars[] = $item_row; + + $feed_updated_time = max($feed_updated_time, $published, $updated); + } + + // If we do not have any items at all, sending the current time is better than sending no time. + if (!$feed_updated_time) + { + $feed_updated_time = time(); + } + + $feed->close(); + + $content = $this->template->render('feed.xml.twig', array( + // Some default assignments + // FEED_IMAGE is not used (atom) + 'FEED_IMAGE' => '', + 'SELF_LINK' => $this->controller_helper->route($this->request->attributes->get('_route'), $this->request->attributes->get('_route_params'), true, '', UrlGeneratorInterface::ABSOLUTE_URL), + 'FEED_LINK' => $board_url . '/index.' . $this->php_ext, + 'FEED_TITLE' => $this->config['sitename'], + 'FEED_SUBTITLE' => $this->config['site_desc'], + 'FEED_UPDATED' => $this->feed_helper->format_date($feed_updated_time), + 'FEED_LANG' => $this->user->lang['USER_LANG'], + 'FEED_AUTHOR' => $this->config['sitename'], + + // Feed entries + 'FEED_ROWS' => $item_vars, + )); + + $response = new Response($content); + $response->headers->set('Content-Type', 'application/atom+xml'); + $response->setCharset('UTF-8'); + $response->setLastModified(new \DateTime('@' . $feed_updated_time)); + + if (!empty($this->user->data['is_bot'])) + { + // Let reverse proxies know we detected a bot. + $response->headers->set('X-PHPBB-IS-BOT', 'yes'); + } + + return $response; + } + + /** + * Throw and exception saying that the feed isn't available + * + * @throw http_exception + */ + protected function send_unavailable() + { + throw new http_exception(404, 'FEATURE_NOT_AVAILABLE'); + } +} diff --git a/install/update/old/phpbb/feed/topics_active.php b/install/update/old/phpbb/feed/topics_active.php new file mode 100644 index 0000000..ea9ee97 --- /dev/null +++ b/install/update/old/phpbb/feed/topics_active.php @@ -0,0 +1,147 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\feed; + +/** + * Active Topics feed + * + * This will give you the last {$this->num_items} topics + * with replies made withing the last {$this->sort_days} days + * including the last post. + */ +class topics_active extends topic_base +{ + protected $sort_days = 7; + + /** + * {@inheritdoc} + */ + public function set_keys() + { + parent::set_keys(); + + $this->set('author_id', 'topic_last_poster_id'); + $this->set('creator', 'topic_last_poster_name'); + } + + /** + * {@inheritdoc} + */ + protected function get_sql() + { + $forum_ids_read = $this->get_readable_forums(); + if (empty($forum_ids_read)) + { + return false; + } + + $in_fid_ary = array_intersect($forum_ids_read, $this->get_forum_ids()); + $in_fid_ary = array_diff($in_fid_ary, $this->get_passworded_forums()); + if (empty($in_fid_ary)) + { + return false; + } + + // Search for topics in last X days + $last_post_time_sql = ($this->sort_days) ? ' AND topic_last_post_time > ' . (time() - ($this->sort_days * 24 * 3600)) : ''; + + // We really have to get the post ids first! + $sql = 'SELECT topic_last_post_id, topic_last_post_time + FROM ' . TOPICS_TABLE . ' + WHERE topic_moved_id = 0 + AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $in_fid_ary) . ' + ' . $last_post_time_sql . ' + ORDER BY topic_last_post_time DESC, topic_last_post_id DESC'; + $result = $this->db->sql_query_limit($sql, $this->num_items); + + $post_ids = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $post_ids[] = (int) $row['topic_last_post_id']; + } + $this->db->sql_freeresult($result); + + if (empty($post_ids)) + { + return false; + } + + parent::fetch_attachments($post_ids); + + $this->sql = array( + 'SELECT' => 'f.forum_id, f.forum_name, + t.topic_id, t.topic_title, t.topic_posts_approved, t.topic_posts_unapproved, t.topic_posts_softdeleted, t.topic_views, + t.topic_last_poster_id, t.topic_last_poster_name, t.topic_last_post_time, + p.post_id, p.post_time, p.post_edit_time, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, p.post_attachment, t.topic_visibility', + 'FROM' => array( + TOPICS_TABLE => 't', + POSTS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'p.forum_id = f.forum_id', + ), + ), + 'WHERE' => 'p.topic_id = t.topic_id + AND ' . $this->db->sql_in_set('p.post_id', $post_ids), + 'ORDER_BY' => 'p.post_time DESC, p.post_id DESC', + ); + + return true; + } + + /** + * Returns the ids of the forums not excluded from the active list + * + * @return int[] + */ + private function get_forum_ids() + { + static $forum_ids; + + $cache_name = 'feed_topic_active_forum_ids'; + + if (!isset($forum_ids) && ($forum_ids = $this->cache->get('_' . $cache_name)) === false) + { + $sql = 'SELECT forum_id + FROM ' . FORUMS_TABLE . ' + WHERE forum_type = ' . FORUM_POST . ' + AND ' . $this->db->sql_bit_and('forum_options', FORUM_OPTION_FEED_EXCLUDE, '= 0') . ' + AND ' . $this->db->sql_bit_and('forum_flags', round(log(FORUM_FLAG_ACTIVE_TOPICS, 2)), '<> 0'); + $result = $this->db->sql_query($sql); + + $forum_ids = array(); + while ($forum_id = (int) $this->db->sql_fetchfield('forum_id')) + { + $forum_ids[$forum_id] = $forum_id; + } + $this->db->sql_freeresult($result); + + $this->cache->put('_' . $cache_name, $forum_ids, 180); + } + + return $forum_ids; + } + + /** + * {@inheritdoc} + */ + public function adjust_item(&$item_row, &$row) + { + parent::adjust_item($item_row, $row); + + $item_row['title'] = (isset($row['forum_name']) && $row['forum_name'] !== '') ? $row['forum_name'] . ' ' . $this->separator . ' ' . $item_row['title'] : $item_row['title']; + } +} diff --git a/install/update/old/phpbb/files/filespec.php b/install/update/old/phpbb/files/filespec.php new file mode 100644 index 0000000..6847bca --- /dev/null +++ b/install/update/old/phpbb/files/filespec.php @@ -0,0 +1,584 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\files; + +use phpbb\language\language; + +/** + * Responsible for holding all file relevant information, as well as doing file-specific operations. + * The {@link fileupload fileupload class} can be used to upload several files, each of them being this object to operate further on. + */ +class filespec +{ + /** @var string File name */ + protected $filename = ''; + + /** @var string Real name of file */ + protected $realname = ''; + + /** @var string Upload name of file */ + protected $uploadname = ''; + + /** @var string Mimetype of file */ + protected $mimetype = ''; + + /** @var string File extension */ + protected $extension = ''; + + /** @var int File size */ + protected $filesize = 0; + + /** @var int Width of file */ + protected $width = 0; + + /** @var int Height of file */ + protected $height = 0; + + /** @var array Image info including type and size */ + protected $image_info = array(); + + /** @var string Destination file name */ + protected $destination_file = ''; + + /** @var string Destination file path */ + protected $destination_path = ''; + + /** @var bool Whether file was moved */ + protected $file_moved = false; + + /** @var bool Whether file is local */ + protected $local = false; + + /** @var bool Class initialization flag */ + protected $class_initialized = false; + + /** @var array Error array */ + public $error = array(); + + /** @var upload Instance of upload class */ + public $upload; + + /** @var \phpbb\filesystem\filesystem_interface */ + protected $filesystem; + + /** @var \bantu\IniGetWrapper\IniGetWrapper ini_get() wrapper class */ + protected $php_ini; + + /** @var \FastImageSize\FastImageSize */ + protected $imagesize; + + /** @var language Language class */ + protected $language; + + /** @var string phpBB root path */ + protected $phpbb_root_path; + + /** @var \phpbb\plupload\plupload The plupload object */ + protected $plupload; + + /** @var \phpbb\mimetype\guesser phpBB Mimetype guesser */ + protected $mimetype_guesser; + + /** + * File upload class + * + * @param \phpbb\filesystem\filesystem_interface $phpbb_filesystem Filesystem + * @param language $language Language + * @param \bantu\IniGetWrapper\IniGetWrapper $php_ini ini_get() wrapper + * @param \FastImageSize\FastImageSize $imagesize Imagesize class + * @param string $phpbb_root_path phpBB root path + * @param \phpbb\mimetype\guesser $mimetype_guesser Mime type guesser + * @param \phpbb\plupload\plupload $plupload Plupload + */ + public function __construct(\phpbb\filesystem\filesystem_interface $phpbb_filesystem, language $language, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \FastImageSize\FastImageSize $imagesize, $phpbb_root_path, \phpbb\mimetype\guesser $mimetype_guesser = null, \phpbb\plupload\plupload $plupload = null) + { + $this->filesystem = $phpbb_filesystem; + $this->language = $language; + $this->php_ini = $php_ini; + $this->imagesize = $imagesize; + $this->phpbb_root_path = $phpbb_root_path; + $this->plupload = $plupload; + $this->mimetype_guesser = $mimetype_guesser; + } + + /** + * Set upload ary + * + * @param array $upload_ary Upload ary + * + * @return filespec This instance of the filespec class + */ + public function set_upload_ary($upload_ary) + { + if (!isset($upload_ary) || !count($upload_ary)) + { + return $this; + } + + $this->class_initialized = true; + $this->filename = $upload_ary['tmp_name']; + $this->filesize = $upload_ary['size']; + $name = $upload_ary['name']; + $name = trim(utf8_basename($name)); + $this->realname = $this->uploadname = $name; + $this->mimetype = $upload_ary['type']; + + // Opera adds the name to the mime type + $this->mimetype = (strpos($this->mimetype, '; name') !== false) ? str_replace(strstr($this->mimetype, '; name'), '', $this->mimetype) : $this->mimetype; + + if (!$this->mimetype) + { + $this->mimetype = 'application/octet-stream'; + } + + $this->extension = strtolower(self::get_extension($this->realname)); + + // Try to get real filesize from temporary folder (not always working) ;) + $this->filesize = ($this->get_filesize($this->filename)) ?: $this->filesize; + + $this->width = $this->height = 0; + $this->file_moved = false; + + $this->local = (isset($upload_ary['local_mode'])) ? true : false; + + return $this; + } + + /** + * Set the upload namespace + * + * @param upload $namespace Instance of upload class + * + * @return filespec This instance of the filespec class + */ + public function set_upload_namespace($namespace) + { + $this->upload = $namespace; + + return $this; + } + + /** + * Check if class members were not properly initialised yet + * + * @return bool True if there was an init error, false if not + */ + public function init_error() + { + return !$this->class_initialized; + } + + /** + * Set error in error array + * + * @param mixed $error Content for error array + * + * @return \phpbb\files\filespec This instance of the filespec class + */ + public function set_error($error) + { + $this->error[] = $error; + + return $this; + } + + /** + * Cleans destination filename + * + * @param string $mode Either real, unique, or unique_ext. Real creates a + * realname, filtering some characters, lowering every + * character. Unique creates a unique filename. + * @param string $prefix Prefix applied to filename + * @param string $user_id The user_id is only needed for when cleaning a user's avatar + */ + public function clean_filename($mode = 'unique', $prefix = '', $user_id = '') + { + if ($this->init_error()) + { + return; + } + + switch ($mode) + { + case 'real': + // Remove every extension from filename (to not let the mime bug being exposed) + if (strpos($this->realname, '.') !== false) + { + $this->realname = substr($this->realname, 0, strpos($this->realname, '.')); + } + + // Replace any chars which may cause us problems with _ + $bad_chars = array("'", "\\", ' ', '/', ':', '*', '?', '"', '<', '>', '|'); + + $this->realname = rawurlencode(str_replace($bad_chars, '_', strtolower($this->realname))); + $this->realname = preg_replace("/%(\w{2})/", '_', $this->realname); + + $this->realname = $prefix . $this->realname . '.' . $this->extension; + break; + + case 'unique': + $this->realname = $prefix . md5(unique_id()); + break; + + case 'avatar': + $this->extension = strtolower($this->extension); + $this->realname = $prefix . $user_id . '.' . $this->extension; + + break; + + case 'unique_ext': + default: + $this->realname = $prefix . md5(unique_id()) . '.' . $this->extension; + } + } + + /** + * Get property from file object + * + * @param string $property Name of property + * + * @return mixed Content of property + */ + public function get($property) + { + if ($this->init_error() || !isset($this->$property)) + { + return false; + } + + return $this->$property; + } + + /** + * Check if file is an image (mime type) + * + * @return bool true if it is an image, false if not + */ + public function is_image() + { + return (strpos($this->mimetype, 'image/') === 0); + } + + /** + * Check if the file got correctly uploaded + * + * @return bool true if it is a valid upload, false if not + */ + public function is_uploaded() + { + $is_plupload = $this->plupload && $this->plupload->is_active(); + + if (!$this->local && !$is_plupload && !is_uploaded_file($this->filename)) + { + return false; + } + + if (($this->local || $is_plupload) && !file_exists($this->filename)) + { + return false; + } + + return true; + } + + /** + * Remove file + */ + public function remove() + { + if ($this->file_moved) + { + @unlink($this->destination_file); + } + } + + /** + * Get file extension + * + * @param string $filename Filename that needs to be checked + * + * @return string Extension of the supplied filename + */ + static public function get_extension($filename) + { + $filename = utf8_basename($filename); + + if (strpos($filename, '.') === false) + { + return ''; + } + + $filename = explode('.', $filename); + return array_pop($filename); + } + + /** + * Get mime type + * + * @param string $filename Filename that needs to be checked + * @return string Mime type of supplied filename + */ + public function get_mimetype($filename) + { + if ($this->mimetype_guesser !== null) + { + $mimetype = $this->mimetype_guesser->guess($filename, $this->uploadname); + + if ($mimetype !== 'application/octet-stream') + { + $this->mimetype = $mimetype; + } + } + + return $this->mimetype; + } + + /** + * Get file size + * + * @param string $filename File name of file to check + * + * @return int File size + */ + public function get_filesize($filename) + { + return @filesize($filename); + } + + + /** + * Check the first 256 bytes for forbidden content + * + * @param array $disallowed_content Array containg disallowed content + * + * @return bool False if disallowed content found, true if not + */ + public function check_content($disallowed_content) + { + if (empty($disallowed_content)) + { + return true; + } + + $fp = @fopen($this->filename, 'rb'); + + if ($fp !== false) + { + $ie_mime_relevant = fread($fp, 256); + fclose($fp); + foreach ($disallowed_content as $forbidden) + { + if (stripos($ie_mime_relevant, '<' . $forbidden) !== false) + { + return false; + } + } + } + return true; + } + + /** + * Move file to destination folder + * The phpbb_root_path variable will be applied to the destination path + * + * @param string $destination Destination path, for example $config['avatar_path'] + * @param bool $overwrite If set to true, an already existing file will be overwritten + * @param bool $skip_image_check If set to true, the check for the file to be a valid image is skipped + * @param string|bool $chmod Permission mask for chmodding the file after a successful move. + * The mode entered here reflects the mode defined by {@link phpbb_chmod()} + * + * @return bool True if file was moved, false if not + * @access public + */ + public function move_file($destination, $overwrite = false, $skip_image_check = false, $chmod = false) + { + if (count($this->error)) + { + return false; + } + + $chmod = ($chmod === false) ? CHMOD_READ | CHMOD_WRITE : $chmod; + + // We need to trust the admin in specifying valid upload directories and an attacker not being able to overwrite it... + $this->destination_path = $this->phpbb_root_path . $destination; + + // Check if the destination path exist... + if (!file_exists($this->destination_path)) + { + @unlink($this->filename); + return false; + } + + $upload_mode = ($this->php_ini->getBool('open_basedir') || $this->php_ini->getBool('safe_mode')) ? 'move' : 'copy'; + $upload_mode = ($this->local) ? 'local' : $upload_mode; + $this->destination_file = $this->destination_path . '/' . utf8_basename($this->realname); + + // Check if the file already exist, else there is something wrong... + if (file_exists($this->destination_file) && !$overwrite) + { + @unlink($this->filename); + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + $this->file_moved = false; + return false; + } + else + { + if (file_exists($this->destination_file)) + { + @unlink($this->destination_file); + } + + switch ($upload_mode) + { + case 'copy': + + if (!@copy($this->filename, $this->destination_file)) + { + if (!@move_uploaded_file($this->filename, $this->destination_file)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + } + } + + break; + + case 'move': + + if (!@move_uploaded_file($this->filename, $this->destination_file)) + { + if (!@copy($this->filename, $this->destination_file)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + } + } + + break; + + case 'local': + + if (!@copy($this->filename, $this->destination_file)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'GENERAL_UPLOAD_ERROR', $this->destination_file); + } + + break; + } + + // Remove temporary filename + @unlink($this->filename); + + if (count($this->error)) + { + return false; + } + + try + { + $this->filesystem->phpbb_chmod($this->destination_file, $chmod); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing + } + } + + // Try to get real filesize from destination folder + $this->filesize = ($this->get_filesize($this->destination_file)) ?: $this->filesize; + + // Get mimetype of supplied file + $this->mimetype = $this->get_mimetype($this->destination_file); + + if ($this->is_image() && !$skip_image_check) + { + $this->width = $this->height = 0; + + $this->image_info = $this->imagesize->getImageSize($this->destination_file, $this->mimetype); + + if ($this->image_info !== false) + { + $this->width = $this->image_info['width']; + $this->height = $this->image_info['height']; + + // Check image type + $types = upload::image_types(); + + if (!isset($types[$this->image_info['type']]) || !in_array($this->extension, $types[$this->image_info['type']])) + { + if (!isset($types[$this->image_info['type']])) + { + $this->error[] = $this->language->lang('IMAGE_FILETYPE_INVALID', $this->image_info['type'], $this->mimetype); + } + else + { + $this->error[] = $this->language->lang('IMAGE_FILETYPE_MISMATCH', $types[$this->image_info['type']][0], $this->extension); + } + } + + // Make sure the dimensions match a valid image + if (empty($this->width) || empty($this->height)) + { + $this->error[] = $this->language->lang('ATTACHED_IMAGE_NOT_IMAGE'); + } + } + else + { + $this->error[] = $this->language->lang('UNABLE_GET_IMAGE_SIZE'); + } + } + + $this->file_moved = true; + $this->additional_checks(); + unset($this->upload); + + return true; + } + + /** + * Performing additional checks + * + * @return bool False if issue was found, true if not + */ + public function additional_checks() + { + if (!$this->file_moved) + { + return false; + } + + // Filesize is too big or it's 0 if it was larger than the maxsize in the upload form + if ($this->upload->max_filesize && ($this->get('filesize') > $this->upload->max_filesize || $this->filesize == 0)) + { + $max_filesize = get_formatted_filesize($this->upload->max_filesize, false); + + $this->error[] = $this->language->lang($this->upload->error_prefix . 'WRONG_FILESIZE', $max_filesize['value'], $max_filesize['unit']); + + return false; + } + + if (!$this->upload->valid_dimensions($this)) + { + $this->error[] = $this->language->lang($this->upload->error_prefix . 'WRONG_SIZE', + $this->language->lang('PIXELS', (int) $this->upload->min_width), + $this->language->lang('PIXELS', (int) $this->upload->min_height), + $this->language->lang('PIXELS', (int) $this->upload->max_width), + $this->language->lang('PIXELS', (int) $this->upload->max_height), + $this->language->lang('PIXELS', (int) $this->width), + $this->language->lang('PIXELS', (int) $this->height)); + + return false; + } + + return true; + } +} diff --git a/install/update/old/phpbb/filesystem.php b/install/update/old/phpbb/filesystem.php new file mode 100644 index 0000000..af56d78 --- /dev/null +++ b/install/update/old/phpbb/filesystem.php @@ -0,0 +1,21 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** + * @deprecated 3.2.0-dev (To be removed 3.3.0) use \phpbb\filesystem\filesystem instead + */ +class filesystem extends \phpbb\filesystem\filesystem +{ +} diff --git a/install/update/old/phpbb/filesystem/filesystem.php b/install/update/old/phpbb/filesystem/filesystem.php new file mode 100644 index 0000000..bfafdf5 --- /dev/null +++ b/install/update/old/phpbb/filesystem/filesystem.php @@ -0,0 +1,916 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\filesystem; + +use phpbb\filesystem\exception\filesystem_exception; + +/** + * A class with various functions that are related to paths, files and the filesystem + */ +class filesystem implements filesystem_interface +{ + /** + * Store some information about file ownership for phpBB's chmod function + * + * @var array + */ + protected $chmod_info; + + /** + * Stores current working directory + * + * @var string|bool current working directory or false if it cannot be recovered + */ + protected $working_directory; + + /** + * Symfony's Filesystem component + * + * @var \Symfony\Component\Filesystem\Filesystem + */ + protected $symfony_filesystem; + + /** + * Constructor + */ + public function __construct() + { + $this->chmod_info = array(); + $this->symfony_filesystem = new \Symfony\Component\Filesystem\Filesystem(); + $this->working_directory = null; + } + + /** + * {@inheritdoc} + */ + public function chgrp($files, $group, $recursive = false) + { + try + { + $this->symfony_filesystem->chgrp($files, $group, $recursive); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('CANNOT_CHANGE_FILE_GROUP', $file, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function chmod($files, $perms = null, $recursive = false, $force_chmod_link = false) + { + if (is_null($perms)) + { + // Default to read permission for compatibility reasons + $perms = self::CHMOD_READ; + } + + // Check if we got a permission flag + if ($perms > self::CHMOD_ALL) + { + $file_perm = $perms; + + // Extract permissions + //$owner = ($file_perm >> 6) & 7; // This will be ignored + $group = ($file_perm >> 3) & 7; + $other = ($file_perm >> 0) & 7; + + // Does any permissions provided? if so we add execute bit for directories + $group = ($group !== 0) ? ($group | self::CHMOD_EXECUTE) : $group; + $other = ($other !== 0) ? ($other | self::CHMOD_EXECUTE) : $other; + + // Compute directory permissions + $dir_perm = (self::CHMOD_ALL << 6) + ($group << 3) + ($other << 3); + } + else + { + // Add execute bit to owner if execute bit is among perms + $owner_perm = (self::CHMOD_READ | self::CHMOD_WRITE) | ($perms & self::CHMOD_EXECUTE); + $file_perm = ($owner_perm << 6) + ($perms << 3) + ($perms << 0); + + // Compute directory permissions + $perm = ($perms !== 0) ? ($perms | self::CHMOD_EXECUTE) : $perms; + $dir_perm = (($owner_perm | self::CHMOD_EXECUTE) << 6) + ($perm << 3) + ($perm << 0); + } + + // Symfony's filesystem component does not support extra execution flags on directories + // so we need to implement it again + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + $this->chmod(new \FilesystemIterator($file), $perms, true); + } + + // Don't chmod links as mostly those require 0777 and that cannot be changed + if (is_dir($file) || (is_link($file) && $force_chmod_link)) + { + if (true !== @chmod($file, $dir_perm)) + { + throw new filesystem_exception('CANNOT_CHANGE_FILE_PERMISSIONS', $file, array()); + } + } + else if (is_file($file)) + { + if (true !== @chmod($file, $file_perm)) + { + throw new filesystem_exception('CANNOT_CHANGE_FILE_PERMISSIONS', $file, array()); + } + } + } + } + + /** + * {@inheritdoc} + */ + public function chown($files, $user, $recursive = false) + { + try + { + $this->symfony_filesystem->chown($files, $user, $recursive); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('CANNOT_CHANGE_FILE_GROUP', $file, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function clean_path($path) + { + $exploded = explode('/', $path); + $filtered = array(); + foreach ($exploded as $part) + { + if ($part === '.' && !empty($filtered)) + { + continue; + } + + if ($part === '..' && !empty($filtered) && $filtered[count($filtered) - 1] !== '.' && $filtered[count($filtered) - 1] !== '..') + { + array_pop($filtered); + } + else + { + $filtered[] = $part; + } + } + $path = implode('/', $filtered); + return $path; + } + + /** + * {@inheritdoc} + */ + public function copy($origin_file, $target_file, $override = false) + { + try + { + $this->symfony_filesystem->copy($origin_file, $target_file, $override); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + throw new filesystem_exception('CANNOT_COPY_FILES', '', array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function dump_file($filename, $content) + { + try + { + $this->symfony_filesystem->dumpFile($filename, $content); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + throw new filesystem_exception('CANNOT_DUMP_FILE', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function exists($files) + { + return $this->symfony_filesystem->exists($files); + } + + /** + * {@inheritdoc} + */ + public function is_absolute_path($path) + { + return (isset($path[0]) && $path[0] === '/' || preg_match('#^[a-z]:[/\\\]#i', $path)) ? true : false; + } + + /** + * {@inheritdoc} + */ + public function is_readable($files, $recursive = false) + { + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + if (!$this->is_readable(new \FilesystemIterator($file), true)) + { + return false; + } + } + + if (!is_readable($file)) + { + return false; + } + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function is_writable($files, $recursive = false) + { + if (defined('PHP_WINDOWS_VERSION_MAJOR') || !function_exists('is_writable')) + { + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + if (!$this->is_writable(new \FilesystemIterator($file), true)) + { + return false; + } + } + + if (!$this->phpbb_is_writable($file)) + { + return false; + } + } + } + else + { + // use built in is_writable + foreach ($this->to_iterator($files) as $file) + { + if ($recursive && is_dir($file) && !is_link($file)) + { + if (!$this->is_writable(new \FilesystemIterator($file), true)) + { + return false; + } + } + + if (!is_writable($file)) + { + return false; + } + } + } + + return true; + } + + /** + * {@inheritdoc} + */ + public function make_path_relative($end_path, $start_path) + { + return $this->symfony_filesystem->makePathRelative($end_path, $start_path); + } + + /** + * {@inheritdoc} + */ + public function mirror($origin_dir, $target_dir, \Traversable $iterator = null, $options = array()) + { + try + { + $this->symfony_filesystem->mirror($origin_dir, $target_dir, $iterator, $options); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + $msg = $e->getMessage(); + $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); + + throw new filesystem_exception('CANNOT_MIRROR_DIRECTORY', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function mkdir($dirs, $mode = 0777) + { + try + { + $this->symfony_filesystem->mkdir($dirs, $mode); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + $msg = $e->getMessage(); + $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); + + throw new filesystem_exception('CANNOT_CREATE_DIRECTORY', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function phpbb_chmod($files, $perms = null, $recursive = false, $force_chmod_link = false) + { + if (is_null($perms)) + { + // Default to read permission for compatibility reasons + $perms = self::CHMOD_READ; + } + + if (empty($this->chmod_info)) + { + if (!function_exists('fileowner') || !function_exists('filegroup')) + { + $this->chmod_info['process'] = false; + } + else + { + $common_php_owner = @fileowner(__FILE__); + $common_php_group = @filegroup(__FILE__); + + // And the owner and the groups PHP is running under. + $php_uid = (function_exists('posix_getuid')) ? @posix_getuid() : false; + $php_gids = (function_exists('posix_getgroups')) ? @posix_getgroups() : false; + + // If we are unable to get owner/group, then do not try to set them by guessing + if (!$php_uid || empty($php_gids) || !$common_php_owner || !$common_php_group) + { + $this->chmod_info['process'] = false; + } + else + { + $this->chmod_info = array( + 'process' => true, + 'common_owner' => $common_php_owner, + 'common_group' => $common_php_group, + 'php_uid' => $php_uid, + 'php_gids' => $php_gids, + ); + } + } + } + + if ($this->chmod_info['process']) + { + try + { + foreach ($this->to_iterator($files) as $file) + { + $file_uid = @fileowner($file); + $file_gid = @filegroup($file); + + // Change owner + if ($file_uid !== $this->chmod_info['common_owner']) + { + $this->chown($file, $this->chmod_info['common_owner'], $recursive); + } + + // Change group + if ($file_gid !== $this->chmod_info['common_group']) + { + $this->chgrp($file, $this->chmod_info['common_group'], $recursive); + } + + clearstatcache(); + $file_uid = @fileowner($file); + $file_gid = @filegroup($file); + } + } + catch (filesystem_exception $e) + { + $this->chmod_info['process'] = false; + } + } + + // Still able to process? + if ($this->chmod_info['process']) + { + if ($file_uid === $this->chmod_info['php_uid']) + { + $php = 'owner'; + } + else if (in_array($file_gid, $this->chmod_info['php_gids'])) + { + $php = 'group'; + } + else + { + // Since we are setting the everyone bit anyway, no need to do expensive operations + $this->chmod_info['process'] = false; + } + } + + // We are not able to determine or change something + if (!$this->chmod_info['process']) + { + $php = 'other'; + } + + switch ($php) + { + case 'owner': + try + { + $this->chmod($files, $perms, $recursive, $force_chmod_link); + clearstatcache(); + if ($this->is_readable($files) && $this->is_writable($files)) + { + break; + } + } + catch (filesystem_exception $e) + { + // Do nothing + } + case 'group': + try + { + $this->chmod($files, $perms, $recursive, $force_chmod_link); + clearstatcache(); + if ((!($perms & self::CHMOD_READ) || $this->is_readable($files, $recursive)) && (!($perms & self::CHMOD_WRITE) || $this->is_writable($files, $recursive))) + { + break; + } + } + catch (filesystem_exception $e) + { + // Do nothing + } + case 'other': + default: + $this->chmod($files, $perms, $recursive, $force_chmod_link); + break; + } + } + + /** + * {@inheritdoc} + */ + public function realpath($path) + { + if (!function_exists('realpath')) + { + return $this->phpbb_own_realpath($path); + } + + $realpath = realpath($path); + + // Strangely there are provider not disabling realpath but returning strange values. :o + // We at least try to cope with them. + if ((!$this->is_absolute_path($path) && $realpath === $path) || $realpath === false) + { + return $this->phpbb_own_realpath($path); + } + + // Check for DIRECTORY_SEPARATOR at the end (and remove it!) + if (substr($realpath, -1) === DIRECTORY_SEPARATOR) + { + $realpath = substr($realpath, 0, -1); + } + + return $realpath; + } + + /** + * {@inheritdoc} + */ + public function remove($files) + { + try + { + $this->symfony_filesystem->remove($files); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('CANNOT_DELETE_FILES', $file, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function rename($origin, $target, $overwrite = false) + { + try + { + $this->symfony_filesystem->rename($origin, $target, $overwrite); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + $msg = $e->getMessage(); + $filename = substr($msg, strpos($msg, '"'), strrpos($msg, '"')); + + throw new filesystem_exception('CANNOT_RENAME_FILE', $filename, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function symlink($origin_dir, $target_dir, $copy_on_windows = false) + { + try + { + $this->symfony_filesystem->symlink($origin_dir, $target_dir, $copy_on_windows); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + throw new filesystem_exception('CANNOT_CREATE_SYMLINK', $origin_dir, array(), $e); + } + } + + /** + * {@inheritdoc} + */ + public function touch($files, $time = null, $access_time = null) + { + try + { + $this->symfony_filesystem->touch($files, $time, $access_time); + } + catch (\Symfony\Component\Filesystem\Exception\IOException $e) + { + // Try to recover filename + // By the time this is written that is at the end of the message + $error = trim($e->getMessage()); + $file = substr($error, strrpos($error, ' ')); + + throw new filesystem_exception('CANNOT_TOUCH_FILES', $file, array(), $e); + } + } + + /** + * phpBB's implementation of is_writable + * + * @todo Investigate if is_writable is still buggy + * + * @param string $file file/directory to check if writable + * + * @return bool true if the given path is writable + */ + protected function phpbb_is_writable($file) + { + if (file_exists($file)) + { + // Canonicalise path to absolute path + $file = $this->realpath($file); + + if (is_dir($file)) + { + // Test directory by creating a file inside the directory + $result = @tempnam($file, 'i_w'); + + if (is_string($result) && file_exists($result)) + { + unlink($result); + + // Ensure the file is actually in the directory (returned realpathed) + return (strpos($result, $file) === 0) ? true : false; + } + } + else + { + $handle = @fopen($file, 'c'); + + if (is_resource($handle)) + { + fclose($handle); + return true; + } + } + } + else + { + // file does not exist test if we can write to the directory + $dir = dirname($file); + + if (file_exists($dir) && is_dir($dir) && $this->phpbb_is_writable($dir)) + { + return true; + } + } + + return false; + } + + /** + * Try to resolve real path when PHP's realpath failes to do so + * + * @param string $path + * @return bool|string + */ + protected function phpbb_own_realpath($path) + { + // Replace all directory separators with '/' + $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); + + $is_absolute_path = false; + $path_prefix = ''; + + if ($this->is_absolute_path($path)) + { + $is_absolute_path = true; + } + else + { + // Resolve working directory and store it + if (is_null($this->working_directory)) + { + if (function_exists('getcwd')) + { + $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', getcwd()); + } + + // + // From this point on we really just guessing + // If chdir were called we screwed + // + else if (function_exists('debug_backtrace')) + { + $call_stack = debug_backtrace(0); + $this->working_directory = str_replace(DIRECTORY_SEPARATOR, '/', dirname($call_stack[count($call_stack) - 1]['file'])); + } + else + { + // + // Assuming that the working directory is phpBB root + // we could use this as a fallback, when phpBB will use controllers + // everywhere this will be a safe assumption + // + //$dir_parts = explode(DIRECTORY_SEPARATOR, __DIR__); + //$namespace_parts = explode('\\', trim(__NAMESPACE__, '\\')); + + //$namespace_part_count = count($namespace_parts); + + // Check if we still loading from root + //if (array_slice($dir_parts, -$namespace_part_count) === $namespace_parts) + //{ + // $this->working_directory = implode('/', array_slice($dir_parts, 0, -$namespace_part_count)); + //} + //else + //{ + // $this->working_directory = false; + //} + + $this->working_directory = false; + } + } + + if ($this->working_directory !== false) + { + $is_absolute_path = true; + $path = $this->working_directory . '/' . $path; + } + } + + if ($is_absolute_path) + { + if (defined('PHP_WINDOWS_VERSION_MAJOR')) + { + $path_prefix = $path[0] . ':'; + $path = substr($path, 2); + } + else + { + $path_prefix = ''; + } + } + + $resolved_path = $this->resolve_path($path, $path_prefix, $is_absolute_path); + if ($resolved_path === false) + { + return false; + } + + if (!@file_exists($resolved_path) || (!@is_dir($resolved_path . '/') && !is_file($resolved_path))) + { + return false; + } + + // Return OS specific directory separators + $resolved = str_replace('/', DIRECTORY_SEPARATOR, $resolved_path); + + // Check for DIRECTORY_SEPARATOR at the end (and remove it!) + if (substr($resolved, -1) === DIRECTORY_SEPARATOR) + { + return substr($resolved, 0, -1); + } + + return $resolved; + } + + /** + * Convert file(s) to \Traversable object + * + * This is the same function as Symfony's toIterator, but that is private + * so we cannot use it. + * + * @param string|array|\Traversable $files filename/list of filenames + * @return \Traversable + */ + protected function to_iterator($files) + { + if (!$files instanceof \Traversable) + { + $files = new \ArrayObject(is_array($files) ? $files : array($files)); + } + + return $files; + } + + /** + * Try to resolve symlinks in path + * + * @param string $path The path to resolve + * @param string $prefix The path prefix (on windows the drive letter) + * @param bool $absolute Whether or not the path is absolute + * @param bool $return_array Whether or not to return path parts + * + * @return string|array|bool returns the resolved path or an array of parts of the path if $return_array is true + * or false if path cannot be resolved + */ + protected function resolve_path($path, $prefix = '', $absolute = false, $return_array = false) + { + if ($return_array) + { + $path = str_replace(DIRECTORY_SEPARATOR, '/', $path); + } + + trim ($path, '/'); + $path_parts = explode('/', $path); + $resolved = array(); + $resolved_path = $prefix; + $file_found = false; + + foreach ($path_parts as $path_part) + { + if ($file_found) + { + return false; + } + + if (empty($path_part) || ($path_part === '.' && ($absolute || !empty($resolved)))) + { + continue; + } + else if ($absolute && $path_part === '..') + { + if (empty($resolved)) + { + // No directories above root + return false; + } + + array_pop($resolved); + $resolved_path = false; + } + else if ($path_part === '..' && !empty($resolved) && !in_array($resolved[count($resolved) - 1], array('.', '..'))) + { + array_pop($resolved); + $resolved_path = false; + } + else + { + if ($resolved_path === false) + { + if (empty($resolved)) + { + $resolved_path = ($absolute) ? $prefix . '/' . $path_part : $path_part; + } + else + { + $tmp_array = $resolved; + if ($absolute) + { + array_unshift($tmp_array, $prefix); + } + + $resolved_path = implode('/', $tmp_array); + } + } + + $current_path = $resolved_path . '/' . $path_part; + + // Resolve symlinks + if (is_link($current_path)) + { + if (!function_exists('readlink')) + { + return false; + } + + $link = readlink($current_path); + + // Is link has an absolute path in it? + if ($this->is_absolute_path($link)) + { + if (defined('PHP_WINDOWS_VERSION_MAJOR')) + { + $prefix = $link[0] . ':'; + $link = substr($link, 2); + } + else + { + $prefix = ''; + } + + $resolved = $this->resolve_path($link, $prefix, true, true); + $absolute = true; + } + else + { + $resolved = $this->resolve_path($resolved_path . '/' . $link, $prefix, $absolute, true); + } + + if (!$resolved) + { + return false; + } + + $resolved_path = false; + } + else if (is_dir($current_path . '/')) + { + $resolved[] = $path_part; + $resolved_path = $current_path; + } + else if (is_file($current_path)) + { + $resolved[] = $path_part; + $resolved_path = $current_path; + $file_found = true; + } + else + { + return false; + } + } + } + + // If at the end of the path there were a .. or . + // we need to build the path again. + // Only doing this when a string is expected in return + if ($resolved_path === false && $return_array === false) + { + if (empty($resolved)) + { + $resolved_path = ($absolute) ? $prefix . '/' : './'; + } + else + { + $tmp_array = $resolved; + if ($absolute) + { + array_unshift($tmp_array, $prefix); + } + + $resolved_path = implode('/', $tmp_array); + } + } + + return ($return_array) ? $resolved : $resolved_path; + } +} diff --git a/install/update/old/phpbb/filesystem/filesystem_interface.php b/install/update/old/phpbb/filesystem/filesystem_interface.php new file mode 100644 index 0000000..1093be2 --- /dev/null +++ b/install/update/old/phpbb/filesystem/filesystem_interface.php @@ -0,0 +1,284 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\filesystem; + +/** + * Interface for phpBB's filesystem service + */ +interface filesystem_interface +{ + /** + * chmod all permissions flag + * + * @var int + */ + const CHMOD_ALL = 7; + + /** + * chmod read permissions flag + * + * @var int + */ + const CHMOD_READ = 4; + + /** + * chmod write permissions flag + * + * @var int + */ + const CHMOD_WRITE = 2; + + /** + * chmod execute permissions flag + * + * @var int + */ + const CHMOD_EXECUTE = 1; + + /** + * Change owner group of files/directories + * + * @param string|array|\Traversable $files The file(s)/directorie(s) to change group + * @param string $group The group that should own the files/directories + * @param bool $recursive If the group should be changed recursively + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function chgrp($files, $group, $recursive = false); + + /** + * Global function for chmodding directories and files for internal use + * + * The function accepts filesystem_interface::CHMOD_ flags in the permission argument + * or the user can specify octal values (or any integer if it makes sense). All directories will have + * an execution bit appended, if the user group (owner, group or other) has any bit specified. + * + * @param string|array|\Traversable $files The file/directory to be chmodded + * @param int $perms Permissions to set + * @param bool $recursive If the permissions should be changed recursively + * @param bool $force_chmod_link Try to apply permissions to symlinks as well + * + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function chmod($files, $perms = null, $recursive = false, $force_chmod_link = false); + + /** + * Change owner group of files/directories + * + * @param string|array|\Traversable $files The file(s)/directorie(s) to change group + * @param string $user The owner user name + * @param bool $recursive Whether change the owner recursively or not + * + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function chown($files, $user, $recursive = false); + + /** + * Eliminates useless . and .. components from specified path. + * + * @param string $path Path to clean + * + * @return string Cleaned path + */ + public function clean_path($path); + + /** + * Copies a file. + * + * This method only copies the file if the origin file is newer than the target file. + * + * By default, if the target already exists, it is not overridden. + * + * @param string $origin_file The original filename + * @param string $target_file The target filename + * @param bool $override Whether to override an existing file or not + * + * @throws \phpbb\filesystem\exception\filesystem_exception When the file cannot be copied + */ + public function copy($origin_file, $target_file, $override = false); + + /** + * Atomically dumps content into a file. + * + * @param string $filename The file to be written to. + * @param string $content The data to write into the file. + * + * @throws \phpbb\filesystem\exception\filesystem_exception When the file cannot be written + */ + public function dump_file($filename, $content); + + /** + * Checks the existence of files or directories. + * + * @param string|array|\Traversable $files files/directories to check + * + * @return bool Returns true if all files/directories exist, false otherwise + */ + public function exists($files); + + /** + * Checks if a path is absolute or not + * + * @param string $path Path to check + * + * @return bool true if the path is absolute, false otherwise + */ + public function is_absolute_path($path); + + /** + * Checks if files/directories are readable + * + * @param string|array|\Traversable $files files/directories to check + * @param bool $recursive Whether or not directories should be checked recursively + * + * @return bool True when the files/directories are readable, otherwise false. + */ + public function is_readable($files, $recursive = false); + + /** + * Test if a file/directory is writable + * + * @param string|array|\Traversable $files files/directories to perform write test on + * @param bool $recursive Whether or not directories should be checked recursively + * + * @return bool True when the files/directories are writable, otherwise false. + */ + public function is_writable($files, $recursive = false); + + /** + * Given an existing path, convert it to a path relative to a given starting path + * + * @param string $end_path Absolute path of target + * @param string $start_path Absolute path where traversal begins + * + * @return string Path of target relative to starting path + */ + public function make_path_relative($end_path, $start_path); + + /** + * Mirrors a directory to another. + * + * @param string $origin_dir The origin directory + * @param string $target_dir The target directory + * @param \Traversable $iterator A Traversable instance + * @param array $options An array of boolean options + * Valid options are: + * - $options['override'] Whether to override an existing file on copy or not (see copy()) + * - $options['copy_on_windows'] Whether to copy files instead of links on Windows (see symlink()) + * - $options['delete'] Whether to delete files that are not in the source directory (defaults to false) + * + * @throws \phpbb\filesystem\exception\filesystem_exception When the file cannot be copied. + * The filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function mirror($origin_dir, $target_dir, \Traversable $iterator = null, $options = array()); + + /** + * Creates a directory recursively. + * + * @param string|array|\Traversable $dirs The directory path + * @param int $mode The directory mode + * + * @throws \phpbb\filesystem\exception\filesystem_exception On any directory creation failure + * The filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function mkdir($dirs, $mode = 0777); + + /** + * Global function for chmodding directories and files for internal use + * + * This function determines owner and group whom the file belongs to and user and group of PHP and then set safest possible file permissions. + * The function determines owner and group from common.php file and sets the same to the provided file. + * The function uses bit fields to build the permissions. + * The function sets the appropiate execute bit on directories. + * + * Supported constants representing bit fields are: + * + * filesystem_interface::CHMOD_ALL - all permissions (7) + * filesystem_interface::CHMOD_READ - read permission (4) + * filesystem_interface::CHMOD_WRITE - write permission (2) + * filesystem_interface::CHMOD_EXECUTE - execute permission (1) + * + * NOTE: The function uses POSIX extension and fileowner()/filegroup() functions. If any of them is disabled, this function tries to build proper permissions, by calling is_readable() and is_writable() functions. + * + * @param string|array|\Traversable $file The file/directory to be chmodded + * @param int $perms Permissions to set + * @param bool $recursive If the permissions should be changed recursively + * @param bool $force_chmod_link Try to apply permissions to symlinks as well + * + * @throws \phpbb\filesystem\exception\filesystem_exception the filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function phpbb_chmod($file, $perms = null, $recursive = false, $force_chmod_link = false); + + /** + * A wrapper for PHP's realpath + * + * Try to resolve realpath when PHP's realpath is not available, or + * known to be buggy. + * + * @param string $path Path to resolve + * + * @return string Resolved path + */ + public function realpath($path); + + /** + * Removes files or directories. + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to remove + * + * @throws \phpbb\filesystem\exception\filesystem_exception When removal fails. + * The filename which triggered the error can be + * retrieved by filesystem_exception::get_filename() + */ + public function remove($files); + + /** + * Renames a file or a directory. + * + * @param string $origin The origin filename or directory + * @param string $target The new filename or directory + * @param bool $overwrite Whether to overwrite the target if it already exists + * + * @throws \phpbb\filesystem\exception\filesystem_exception When target file or directory already exists, + * or origin cannot be renamed. + */ + public function rename($origin, $target, $overwrite = false); + + /** + * Creates a symbolic link or copy a directory. + * + * @param string $origin_dir The origin directory path + * @param string $target_dir The symbolic link name + * @param bool $copy_on_windows Whether to copy files if on Windows + * + * @throws \phpbb\filesystem\exception\filesystem_exception When symlink fails + */ + public function symlink($origin_dir, $target_dir, $copy_on_windows = false); + + /** + * Sets access and modification time of file. + * + * @param string|array|\Traversable $files A filename, an array of files, or a \Traversable instance to create + * @param int $time The touch time as a Unix timestamp + * @param int $access_time The access time as a Unix timestamp + * + * @throws \phpbb\filesystem\exception\filesystem_exception When touch fails + */ + public function touch($files, $time = null, $access_time = null); +} diff --git a/install/update/old/phpbb/finder.php b/install/update/old/phpbb/finder.php new file mode 100644 index 0000000..1f1d931 --- /dev/null +++ b/install/update/old/phpbb/finder.php @@ -0,0 +1,547 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* The finder provides a simple way to locate files in the core and a set of extensions +*/ +class finder +{ + protected $extensions; + protected $filesystem; + protected $phpbb_root_path; + protected $cache; + protected $php_ext; + + /** + * The cache variable name used to store $this->cached_queries in $this->cache. + * + * Allows the use of multiple differently configured finders with the same cache. + * @var string + */ + protected $cache_name; + + /** + * An associative array, containing all search parameters set in methods. + * @var array + */ + protected $query; + + /** + * A map from md5 hashes of serialized queries to their previously retrieved + * results. + * @var array + */ + protected $cached_queries; + + /** + * Creates a new finder instance with its dependencies + * + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem instance + * @param string $phpbb_root_path Path to the phpbb root directory + * @param \phpbb\cache\service $cache A cache instance or null + * @param string $php_ext php file extension + * @param string $cache_name The name of the cache variable, defaults to + * _ext_finder + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path = '', \phpbb\cache\service $cache = null, $php_ext = 'php', $cache_name = '_ext_finder') + { + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + $this->cache = $cache; + $this->php_ext = $php_ext; + $this->cache_name = $cache_name; + + $this->query = array( + 'core_path' => false, + 'core_suffix' => false, + 'core_prefix' => false, + 'core_directory' => false, + 'extension_suffix' => false, + 'extension_prefix' => false, + 'extension_directory' => false, + ); + $this->extensions = array(); + + $this->cached_queries = ($this->cache) ? $this->cache->get($this->cache_name) : false; + } + + /** + * Set the array of extensions + * + * @param array $extensions A list of extensions that should be searched aswell + * @param bool $replace_list Should the list be emptied before adding the extensions + * @return \phpbb\finder This object for chaining calls + */ + public function set_extensions(array $extensions, $replace_list = true) + { + if ($replace_list) + { + $this->extensions = array(); + } + + foreach ($extensions as $ext_name) + { + $this->extensions[$ext_name] = $this->phpbb_root_path . 'ext/' . $ext_name . '/'; + } + return $this; + } + + /** + * Sets a core path to be searched in addition to extensions + * + * @param string $core_path The path relative to phpbb_root_path + * @return \phpbb\finder This object for chaining calls + */ + public function core_path($core_path) + { + $this->query['core_path'] = $core_path; + return $this; + } + + /** + * Sets the suffix all files found in extensions and core must match. + * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * + * @param string $suffix A filename suffix + * @return \phpbb\finder This object for chaining calls + */ + public function suffix($suffix) + { + $this->core_suffix($suffix); + $this->extension_suffix($suffix); + return $this; + } + + /** + * Sets a suffix all files found in extensions must match + * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * + * @param string $extension_suffix A filename suffix + * @return \phpbb\finder This object for chaining calls + */ + public function extension_suffix($extension_suffix) + { + $this->query['extension_suffix'] = $extension_suffix; + return $this; + } + + /** + * Sets a suffix all files found in the core path must match + * + * There is no default file extension, so to find PHP files only, you will + * have to specify .php as a suffix. However when using get_classes, the .php + * file extension is automatically added to suffixes. + * + * @param string $core_suffix A filename suffix + * @return \phpbb\finder This object for chaining calls + */ + public function core_suffix($core_suffix) + { + $this->query['core_suffix'] = $core_suffix; + return $this; + } + + /** + * Sets the prefix all files found in extensions and core must match + * + * @param string $prefix A filename prefix + * @return \phpbb\finder This object for chaining calls + */ + public function prefix($prefix) + { + $this->core_prefix($prefix); + $this->extension_prefix($prefix); + return $this; + } + + /** + * Sets a prefix all files found in extensions must match + * + * @param string $extension_prefix A filename prefix + * @return \phpbb\finder This object for chaining calls + */ + public function extension_prefix($extension_prefix) + { + $this->query['extension_prefix'] = $extension_prefix; + return $this; + } + + /** + * Sets a prefix all files found in the core path must match + * + * @param string $core_prefix A filename prefix + * @return \phpbb\finder This object for chaining calls + */ + public function core_prefix($core_prefix) + { + $this->query['core_prefix'] = $core_prefix; + return $this; + } + + /** + * Sets a directory all files found in extensions and core must be contained in + * + * Automatically sets the core_directory if its value does not differ from + * the current directory. + * + * @param string $directory + * @return \phpbb\finder This object for chaining calls + */ + public function directory($directory) + { + $this->core_directory($directory); + $this->extension_directory($directory); + return $this; + } + + /** + * Sets a directory all files found in extensions must be contained in + * + * @param string $extension_directory + * @return \phpbb\finder This object for chaining calls + */ + public function extension_directory($extension_directory) + { + $this->query['extension_directory'] = $this->sanitise_directory($extension_directory); + return $this; + } + + /** + * Sets a directory all files found in the core path must be contained in + * + * @param string $core_directory + * @return \phpbb\finder This object for chaining calls + */ + public function core_directory($core_directory) + { + $this->query['core_directory'] = $this->sanitise_directory($core_directory); + return $this; + } + + /** + * Removes occurances of /./ and makes sure path ends without trailing slash + * + * @param string $directory A directory pattern + * @return string A cleaned up directory pattern + */ + protected function sanitise_directory($directory) + { + $directory = $this->filesystem->clean_path($directory); + $dir_len = strlen($directory); + + if ($dir_len > 1 && $directory[$dir_len - 1] === '/') + { + $directory = substr($directory, 0, -1); + } + + return $directory; + } + + /** + * Finds classes matching the configured options if they follow phpBB naming rules. + * + * The php file extension is automatically added to suffixes. + * + * Note: If a file is matched but contains a class name not following the + * phpBB naming rules an incorrect class name will be returned. + * + * @param bool $cache Whether the result should be cached + * @return array An array of found class names + */ + public function get_classes($cache = true) + { + $this->query['extension_suffix'] .= '.' . $this->php_ext; + $this->query['core_suffix'] .= '.' . $this->php_ext; + + $files = $this->find($cache, false); + + return $this->get_classes_from_files($files); + } + + /** + * Get class names from a list of files + * + * @param array $files Array of files (from find()) + * @return array Array of class names + */ + public function get_classes_from_files($files) + { + $classes = array(); + foreach ($files as $file => $ext_name) + { + $class = substr($file, 0, -strlen('.' . $this->php_ext)); + if ($ext_name === '/' && preg_match('#^includes/#', $file)) + { + $class = preg_replace('#^includes/#', '', $class); + $classes[] = 'phpbb_' . str_replace('/', '_', $class); + } + else + { + $class = preg_replace('#^ext/#', '', $class); + $classes[] = '\\' . str_replace('/', '\\', $class); + } + } + return $classes; + } + + /** + * Finds all directories matching the configured options + * + * @param bool $cache Whether the result should be cached + * @param bool $extension_keys Whether the result should have extension name as array key + * @return array An array of paths to found directories + */ + public function get_directories($cache = true, $extension_keys = false) + { + return $this->find_with_root_path($cache, true, $extension_keys); + } + + /** + * Finds all files matching the configured options. + * + * @param bool $cache Whether the result should be cached + * @return array An array of paths to found files + */ + public function get_files($cache = true) + { + return $this->find_with_root_path($cache, false); + } + + /** + * A wrapper around the general find which prepends a root path to results + * + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @param bool $extension_keys If true, result will be associative array + * with extension name as key + * @return array An array of paths to found items + */ + protected function find_with_root_path($cache = true, $is_dir = false, $extension_keys = false) + { + $items = $this->find($cache, $is_dir); + + $result = array(); + foreach ($items as $item => $ext_name) + { + if ($extension_keys) + { + $result[$ext_name] = $this->phpbb_root_path . $item; + } + else + { + $result[] = $this->phpbb_root_path . $item; + } + } + + return $result; + } + + /** + * Finds all file system entries matching the configured options + * + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @return array An array of paths to found items + */ + public function find($cache = true, $is_dir = false) + { + $extensions = $this->extensions; + if ($this->query['core_path']) + { + $extensions['/'] = $this->phpbb_root_path . $this->query['core_path']; + } + + $files = array(); + $file_list = $this->find_from_paths($extensions, $cache, $is_dir); + + foreach ($file_list as $file) + { + $files[$file['named_path']] = $file['ext_name']; + } + + return $files; + } + + /** + * Finds all file system entries matching the configured options for one + * specific extension + * + * @param string $extension_name Name of the extension + * @param string $extension_path Relative path to the extension root directory + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @return array An array of paths to found items + */ + public function find_from_extension($extension_name, $extension_path, $cache = true, $is_dir = false) + { + $extensions = array( + $extension_name => $extension_path, + ); + + $files = array(); + $file_list = $this->find_from_paths($extensions, $cache, $is_dir); + + foreach ($file_list as $file) + { + $files[$file['named_path']] = $file['ext_name']; + } + + return $files; + } + + /** + * Finds all file system entries matching the configured options from + * an array of paths + * + * @param array $extensions Array of extensions (name => full relative path) + * @param bool $cache Whether the result should be cached + * @param bool $is_dir Directories will be returned when true, only files + * otherwise + * @return array An array of paths to found items + */ + public function find_from_paths($extensions, $cache = true, $is_dir = false) + { + $this->query['is_dir'] = $is_dir; + $query = md5(serialize($this->query) . serialize($extensions)); + + if (!defined('DEBUG') && $cache && isset($this->cached_queries[$query])) + { + return $this->cached_queries[$query]; + } + + $files = array(); + + foreach ($extensions as $name => $path) + { + $ext_name = $name; + + if (!file_exists($path)) + { + continue; + } + + if ($name === '/') + { + $location = $this->query['core_path']; + $name = ''; + $suffix = $this->query['core_suffix']; + $prefix = $this->query['core_prefix']; + $directory = $this->query['core_directory']; + } + else + { + $location = 'ext/'; + $name .= '/'; + $suffix = $this->query['extension_suffix']; + $prefix = $this->query['extension_prefix']; + $directory = $this->query['extension_directory']; + } + + // match only first directory if leading slash is given + if ($directory === '/') + { + $directory_pattern = '^' . preg_quote(DIRECTORY_SEPARATOR, '#'); + } + else if ($directory && $directory[0] === '/') + { + if (!$is_dir) + { + $path .= substr($directory, 1); + } + $directory_pattern = '^' . preg_quote(str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); + } + else + { + $directory_pattern = preg_quote(DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR, '#'); + } + if ($is_dir) + { + $directory_pattern .= '$'; + } + $directory_pattern = '#' . $directory_pattern . '#'; + + if (is_dir($path)) + { + $iterator = new \RecursiveIteratorIterator( + new \phpbb\recursive_dot_prefix_filter_iterator( + new \RecursiveDirectoryIterator( + $path, + \FilesystemIterator::SKIP_DOTS + ) + ), + \RecursiveIteratorIterator::SELF_FIRST + ); + + foreach ($iterator as $file_info) + { + $filename = $file_info->getFilename(); + + if ($file_info->isDir() == $is_dir) + { + if ($is_dir) + { + $relative_path = $iterator->getInnerIterator()->getSubPath() . DIRECTORY_SEPARATOR . basename($filename) . DIRECTORY_SEPARATOR; + if ($relative_path[0] !== DIRECTORY_SEPARATOR) + { + $relative_path = DIRECTORY_SEPARATOR . $relative_path; + } + } + else + { + $relative_path = $iterator->getInnerIterator()->getSubPathname(); + if ($directory && $directory[0] === '/') + { + $relative_path = str_replace('/', DIRECTORY_SEPARATOR, $directory) . DIRECTORY_SEPARATOR . $relative_path; + } + else + { + $relative_path = DIRECTORY_SEPARATOR . $relative_path; + } + } + + if ((!$suffix || substr($relative_path, -strlen($suffix)) === $suffix) && + (!$prefix || substr($filename, 0, strlen($prefix)) === $prefix) && + (!$directory || preg_match($directory_pattern, $relative_path))) + { + $files[] = array( + 'named_path' => str_replace(DIRECTORY_SEPARATOR, '/', $location . $name . substr($relative_path, 1)), + 'ext_name' => $ext_name, + 'path' => str_replace(array(DIRECTORY_SEPARATOR, $this->phpbb_root_path), array('/', ''), $file_info->getPath()) . '/', + 'filename' => $filename, + ); + } + } + } + } + } + + if ($cache && $this->cache) + { + $this->cached_queries[$query] = $files; + $this->cache->put($this->cache_name, $this->cached_queries); + } + + return $files; + } +} diff --git a/install/update/old/phpbb/group/helper.php b/install/update/old/phpbb/group/helper.php new file mode 100644 index 0000000..5befddf --- /dev/null +++ b/install/update/old/phpbb/group/helper.php @@ -0,0 +1,40 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\group; + +class helper +{ + /** @var \phpbb\language\language */ + protected $language; + + /** + * Constructor + * + * @param \phpbb\language\language $language Language object + */ + public function __construct(\phpbb\language\language $language) + { + $this->language = $language; + } + + /** + * @param $group_name string The stored group name + * + * @return string Group name or translated group name if it exists + */ + public function get_name($group_name) + { + return $this->language->is_set('G_' . utf8_strtoupper($group_name)) ? $this->language->lang('G_' . utf8_strtoupper($group_name)) : $group_name; + } +} diff --git a/install/update/old/phpbb/help/controller/bbcode.php b/install/update/old/phpbb/help/controller/bbcode.php new file mode 100644 index 0000000..e16f990 --- /dev/null +++ b/install/update/old/phpbb/help/controller/bbcode.php @@ -0,0 +1,85 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\help\controller; + +/** + * BBCode help page + */ +class bbcode extends controller +{ + /** + * @return string The title of the page + */ + public function display() + { + $this->language->add_lang('help/bbcode'); + + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_INTRO', + false, + array( + 'HELP_BBCODE_INTRO_BBCODE_QUESTION' => 'HELP_BBCODE_INTRO_BBCODE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_TEXT', + false, + array( + 'HELP_BBCODE_TEXT_BASIC_QUESTION' => 'HELP_BBCODE_TEXT_BASIC_ANSWER', + 'HELP_BBCODE_TEXT_COLOR_QUESTION' => 'HELP_BBCODE_TEXT_COLOR_ANSWER', + 'HELP_BBCODE_TEXT_COMBINE_QUESTION' => 'HELP_BBCODE_TEXT_COMBINE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_QUOTES', + false, + array( + 'HELP_BBCODE_QUOTES_TEXT_QUESTION' => 'HELP_BBCODE_QUOTES_TEXT_ANSWER', + 'HELP_BBCODE_QUOTES_CODE_QUESTION' => 'HELP_BBCODE_QUOTES_CODE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_LISTS', + false, + array( + 'HELP_BBCODE_LISTS_UNORDERER_QUESTION' => 'HELP_BBCODE_LISTS_UNORDERER_ANSWER', + 'HELP_BBCODE_LISTS_ORDERER_QUESTION' => 'HELP_BBCODE_LISTS_ORDERER_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_LINKS', + true, + array( + 'HELP_BBCODE_LINKS_BASIC_QUESTION' => 'HELP_BBCODE_LINKS_BASIC_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_IMAGES', + false, + array( + 'HELP_BBCODE_IMAGES_BASIC_QUESTION' => 'HELP_BBCODE_IMAGES_BASIC_ANSWER', + 'HELP_BBCODE_IMAGES_ATTACHMENT_QUESTION' => 'HELP_BBCODE_IMAGES_ATTACHMENT_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_BBCODE_BLOCK_OTHERS', + false, + array( + 'HELP_BBCODE_OTHERS_CUSTOM_QUESTION' => 'HELP_BBCODE_OTHERS_CUSTOM_ANSWER', + ) + ); + + return $this->language->lang('BBCODE_GUIDE'); + } +} diff --git a/install/update/old/phpbb/help/controller/faq.php b/install/update/old/phpbb/help/controller/faq.php new file mode 100644 index 0000000..5e45cfe --- /dev/null +++ b/install/update/old/phpbb/help/controller/faq.php @@ -0,0 +1,165 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\help\controller; + +/** + * FAQ help page + */ +class faq extends controller +{ + /** + * @return string The title of the page + */ + public function display() + { + $this->language->add_lang('help/faq'); + + $this->manager->add_block( + 'HELP_FAQ_BLOCK_LOGIN', + false, + array( + 'HELP_FAQ_LOGIN_REGISTER_QUESTION' => 'HELP_FAQ_LOGIN_REGISTER_ANSWER', + 'HELP_FAQ_LOGIN_COPPA_QUESTION' => 'HELP_FAQ_LOGIN_COPPA_ANSWER', + 'HELP_FAQ_LOGIN_CANNOT_REGISTER_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_REGISTER_ANSWER', + 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_QUESTION' => 'HELP_FAQ_LOGIN_REGISTER_CONFIRM_ANSWER', + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANSWER', + 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_QUESTION' => 'HELP_FAQ_LOGIN_CANNOT_LOGIN_ANYMORE_ANSWER', + 'HELP_FAQ_LOGIN_LOST_PASSWORD_QUESTION' => 'HELP_FAQ_LOGIN_LOST_PASSWORD_ANSWER', + 'HELP_FAQ_LOGIN_AUTO_LOGOUT_QUESTION' => 'HELP_FAQ_LOGIN_AUTO_LOGOUT_ANSWER', + 'HELP_FAQ_LOGIN_DELETE_COOKIES_QUESTION' => 'HELP_FAQ_LOGIN_DELETE_COOKIES_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_USERSETTINGS', + false, + array( + 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_QUESTION' => 'HELP_FAQ_USERSETTINGS_CHANGE_SETTINGS_ANSWER', + 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_QUESTION' => 'HELP_FAQ_USERSETTINGS_HIDE_ONLINE_ANSWER', + 'HELP_FAQ_USERSETTINGS_TIMEZONE_QUESTION' => 'HELP_FAQ_USERSETTINGS_TIMEZONE_ANSWER', + 'HELP_FAQ_USERSETTINGS_SERVERTIME_QUESTION' => 'HELP_FAQ_USERSETTINGS_SERVERTIME_ANSWER', + 'HELP_FAQ_USERSETTINGS_LANGUAGE_QUESTION' => 'HELP_FAQ_USERSETTINGS_LANGUAGE_ANSWER', + 'HELP_FAQ_USERSETTINGS_AVATAR_QUESTION' => 'HELP_FAQ_USERSETTINGS_AVATAR_ANSWER', + 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_QUESTION' => 'HELP_FAQ_USERSETTINGS_AVATAR_DISPLAY_ANSWER', + 'HELP_FAQ_USERSETTINGS_RANK_QUESTION' => 'HELP_FAQ_USERSETTINGS_RANK_ANSWER', + 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_QUESTION' => 'HELP_FAQ_USERSETTINGS_EMAIL_LOGIN_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_POSTING', + false, + array( + 'HELP_FAQ_POSTING_CREATE_QUESTION' => 'HELP_FAQ_POSTING_CREATE_ANSWER', + 'HELP_FAQ_POSTING_EDIT_DELETE_QUESTION' => 'HELP_FAQ_POSTING_EDIT_DELETE_ANSWER', + 'HELP_FAQ_POSTING_SIGNATURE_QUESTION' => 'HELP_FAQ_POSTING_SIGNATURE_ANSWER', + 'HELP_FAQ_POSTING_POLL_CREATE_QUESTION' => 'HELP_FAQ_POSTING_POLL_CREATE_ANSWER', + 'HELP_FAQ_POSTING_POLL_ADD_QUESTION' => 'HELP_FAQ_POSTING_POLL_ADD_ANSWER', + 'HELP_FAQ_POSTING_POLL_EDIT_QUESTION' => 'HELP_FAQ_POSTING_POLL_EDIT_ANSWER', + 'HELP_FAQ_POSTING_FORUM_RESTRICTED_QUESTION' => 'HELP_FAQ_POSTING_FORUM_RESTRICTED_ANSWER', + 'HELP_FAQ_POSTING_NO_ATTACHMENTS_QUESTION' => 'HELP_FAQ_POSTING_NO_ATTACHMENTS_ANSWER', + 'HELP_FAQ_POSTING_WARNING_QUESTION' => 'HELP_FAQ_POSTING_WARNING_ANSWER', + 'HELP_FAQ_POSTING_REPORT_QUESTION' => 'HELP_FAQ_POSTING_REPORT_ANSWER', + 'HELP_FAQ_POSTING_DRAFT_QUESTION' => 'HELP_FAQ_POSTING_DRAFT_ANSWER', + 'HELP_FAQ_POSTING_QUEUE_QUESTION' => 'HELP_FAQ_POSTING_QUEUE_ANSWER', + 'HELP_FAQ_POSTING_BUMP_QUESTION' => 'HELP_FAQ_POSTING_BUMP_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_FORMATTING', + false, + array( + 'HELP_FAQ_FORMATTING_BBOCDE_QUESTION' => 'HELP_FAQ_FORMATTING_BBOCDE_ANSWER', + 'HELP_FAQ_FORMATTING_HTML_QUESTION' => 'HELP_FAQ_FORMATTING_HTML_ANSWER', + 'HELP_FAQ_FORMATTING_SMILIES_QUESTION' => 'HELP_FAQ_FORMATTING_SMILIES_ANSWER', + 'HELP_FAQ_FORMATTING_IMAGES_QUESTION' => 'HELP_FAQ_FORMATTING_IMAGES_ANSWER', + 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_QUESTION' => 'HELP_FAQ_FORMATTING_GLOBAL_ANNOUNCE_ANSWER', + 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_QUESTION' => 'HELP_FAQ_FORMATTING_ANNOUNCEMENT_ANSWER', + 'HELP_FAQ_FORMATTING_STICKIES_QUESTION' => 'HELP_FAQ_FORMATTING_STICKIES_ANSWER', + 'HELP_FAQ_FORMATTING_LOCKED_QUESTION' => 'HELP_FAQ_FORMATTING_LOCKED_ANSWER', + 'HELP_FAQ_FORMATTING_ICONS_QUESTION' => 'HELP_FAQ_FORMATTING_ICONS_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_GROUPS', + true, + array( + 'HELP_FAQ_GROUPS_ADMINISTRATORS_QUESTION' => 'HELP_FAQ_GROUPS_ADMINISTRATORS_ANSWER', + 'HELP_FAQ_GROUPS_MODERATORS_QUESTION' => 'HELP_FAQ_GROUPS_MODERATORS_ANSWER', + 'HELP_FAQ_GROUPS_USERGROUPS_QUESTION' => 'HELP_FAQ_GROUPS_USERGROUPS_ANSWER', + 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_QUESTION' => 'HELP_FAQ_GROUPS_USERGROUPS_JOIN_ANSWER', + 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_QUESTION' => 'HELP_FAQ_GROUPS_USERGROUPS_LEAD_ANSWER', + 'HELP_FAQ_GROUPS_COLORS_QUESTION' => 'HELP_FAQ_GROUPS_COLORS_ANSWER', + 'HELP_FAQ_GROUPS_DEFAULT_QUESTION' => 'HELP_FAQ_GROUPS_DEFAULT_ANSWER', + 'HELP_FAQ_GROUPS_TEAM_QUESTION' => 'HELP_FAQ_GROUPS_TEAM_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_PMS', + false, + array( + 'HELP_FAQ_PMS_CANNOT_SEND_QUESTION' => 'HELP_FAQ_PMS_CANNOT_SEND_ANSWER', + 'HELP_FAQ_PMS_UNWANTED_QUESTION' => 'HELP_FAQ_PMS_UNWANTED_ANSWER', + 'HELP_FAQ_PMS_SPAM_QUESTION' => 'HELP_FAQ_PMS_SPAM_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_FRIENDS', + false, + array( + 'HELP_FAQ_FRIENDS_BASIC_QUESTION' => 'HELP_FAQ_FRIENDS_BASIC_ANSWER', + 'HELP_FAQ_FRIENDS_MANAGE_QUESTION' => 'HELP_FAQ_FRIENDS_MANAGE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_SEARCH', + false, + array( + 'HELP_FAQ_SEARCH_FORUM_QUESTION' => 'HELP_FAQ_SEARCH_FORUM_ANSWER', + 'HELP_FAQ_SEARCH_NO_RESULT_QUESTION' => 'HELP_FAQ_SEARCH_NO_RESULT_ANSWER', + 'HELP_FAQ_SEARCH_BLANK_QUESTION' => 'HELP_FAQ_SEARCH_BLANK_ANSWER', + 'HELP_FAQ_SEARCH_MEMBERS_QUESTION' => 'HELP_FAQ_SEARCH_MEMBERS_ANSWER', + 'HELP_FAQ_SEARCH_OWN_QUESTION' => 'HELP_FAQ_SEARCH_OWN_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_BOOKMARKS', + false, + array( + 'HELP_FAQ_BOOKMARKS_DIFFERENCE_QUESTION' => 'HELP_FAQ_BOOKMARKS_DIFFERENCE_ANSWER', + 'HELP_FAQ_BOOKMARKS_TOPIC_QUESTION' => 'HELP_FAQ_BOOKMARKS_TOPIC_ANSWER', + 'HELP_FAQ_BOOKMARKS_FORUM_QUESTION' => 'HELP_FAQ_BOOKMARKS_FORUM_ANSWER', + 'HELP_FAQ_BOOKMARKS_REMOVE_QUESTION' => 'HELP_FAQ_BOOKMARKS_REMOVE_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_ATTACHMENTS', + false, + array( + 'HELP_FAQ_ATTACHMENTS_ALLOWED_QUESTION' => 'HELP_FAQ_ATTACHMENTS_ALLOWED_ANSWER', + 'HELP_FAQ_ATTACHMENTS_OWN_QUESTION' => 'HELP_FAQ_ATTACHMENTS_OWN_ANSWER', + ) + ); + $this->manager->add_block( + 'HELP_FAQ_BLOCK_ISSUES', + false, + array( + 'HELP_FAQ_ISSUES_WHOIS_PHPBB_QUESTION' => 'HELP_FAQ_ISSUES_WHOIS_PHPBB_ANSWER', + 'HELP_FAQ_ISSUES_FEATURE_QUESTION' => 'HELP_FAQ_ISSUES_FEATURE_ANSWER', + 'HELP_FAQ_ISSUES_LEGAL_QUESTION' => 'HELP_FAQ_ISSUES_LEGAL_ANSWER', + 'HELP_FAQ_ISSUES_ADMIN_QUESTION' => 'HELP_FAQ_ISSUES_ADMIN_ANSWER', + ) + ); + + return $this->language->lang('FAQ_EXPLAIN'); + } +} diff --git a/install/update/old/phpbb/install/controller/helper.php b/install/update/old/phpbb/install/controller/helper.php new file mode 100644 index 0000000..ff7e691 --- /dev/null +++ b/install/update/old/phpbb/install/controller/helper.php @@ -0,0 +1,413 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\controller; + +use phpbb\install\helper\config; +use phpbb\install\helper\navigation\navigation_provider; +use phpbb\language\language; +use phpbb\language\language_file_helper; +use phpbb\path_helper; +use phpbb\request\request; +use phpbb\request\request_interface; +use phpbb\routing\router; +use phpbb\symfony_request; +use phpbb\template\template; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Cookie; + +/** + * A duplicate of \phpbb\controller\helper + * + * This class is necessary because of controller\helper's legacy function calls + * to page_header() page_footer() functions which has unavailable dependencies. + */ +class helper +{ + /** + * @var config + */ + protected $installer_config; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var bool|string + */ + protected $language_cookie; + + /** + * @var \phpbb\language\language_file_helper + */ + protected $lang_helper; + + /** + * @var \phpbb\install\helper\navigation\navigation_provider + */ + protected $navigation_provider; + + /** + * @var \phpbb\template\template + */ + protected $template; + + /** + * @var \phpbb\path_helper + */ + protected $path_helper; + + /** + * @var \phpbb\request\request + */ + protected $phpbb_request; + + /** + * @var \phpbb\symfony_request + */ + protected $request; + + /** + * @var \phpbb\routing\router + */ + protected $router; + + /** + * @var string + */ + protected $phpbb_admin_path; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param config $config + * @param language $language + * @param language_file_helper $lang_helper + * @param navigation_provider $nav + * @param template $template + * @param path_helper $path_helper + * @param request $phpbb_request + * @param symfony_request $request + * @param router $router + * @param string $phpbb_root_path + */ + public function __construct(config $config, language $language, language_file_helper $lang_helper, navigation_provider $nav, template $template, path_helper $path_helper, request $phpbb_request, symfony_request $request, router $router, $phpbb_root_path) + { + $this->installer_config = $config; + $this->language = $language; + $this->language_cookie = false; + $this->lang_helper = $lang_helper; + $this->navigation_provider = $nav; + $this->template = $template; + $this->path_helper = $path_helper; + $this->phpbb_request = $phpbb_request; + $this->request = $request; + $this->router = $router; + $this->phpbb_root_path = $phpbb_root_path; + $this->phpbb_admin_path = $phpbb_root_path . 'adm/'; + } + + /** + * Automate setting up the page and creating the response object. + * + * @param string $template_file The template handle to render + * @param string $page_title The title of the page to output + * @param bool $selected_language True to enable language selector it, false otherwise + * @param int $status_code The status code to be sent to the page header + * + * @return Response object containing rendered page + */ + public function render($template_file, $page_title = '', $selected_language = false, $status_code = 200) + { + $this->page_header($page_title, $selected_language); + + $this->template->set_filenames(array( + 'body' => $template_file, + )); + + $response = new Response($this->template->assign_display('body'), $status_code); + + // Set language cookie + if ($this->language_cookie !== false) + { + $cookie = new Cookie('lang', $this->language_cookie, time() + 3600); + $response->headers->setCookie($cookie); + + $this->language_cookie = false; + } + + return $response; + } + + /** + * Returns path from route name + * + * @param string $route_name + * @param array $parameters + * + * @return string + */ + public function route($route_name, $parameters = array()) + { + $url = $this->router->generate($route_name, $parameters); + + return $url; + } + + /** + * Handles language selector form + */ + public function handle_language_select() + { + $lang = null; + + // Check if language form has been submited + $submit = $this->phpbb_request->variable('change_lang', ''); + if (!empty($submit)) + { + $lang = $this->phpbb_request->variable('language', ''); + } + + // Retrieve language from cookie + $lang_cookie = $this->phpbb_request->variable('lang', '', false, request_interface::COOKIE); + if (empty($lang) && !empty($lang_cookie)) + { + $lang = $lang_cookie; + } + + $lang = (!empty($lang) && strpos($lang, '/') === false) ? $lang : null; + $this->language_cookie = $lang; + + $this->render_language_select($lang); + + if ($lang !== null) + { + $this->language->set_user_language($lang, true); + $this->installer_config->set('user_language', $lang); + } + } + + /** + * Process navigation data to reflect active/completed stages + * + * @param \phpbb\install\helper\iohandler\iohandler_interface|null $iohandler + */ + public function handle_navigation($iohandler = null) + { + $nav_data = $this->installer_config->get_navigation_data(); + + // Set active navigation stage + if (isset($nav_data['active']) && is_array($nav_data['active'])) + { + if ($iohandler !== null) + { + $iohandler->set_active_stage_menu($nav_data['active']); + } + + $this->navigation_provider->set_nav_property($nav_data['active'], array( + 'selected' => true, + 'completed' => false, + )); + } + + // Set finished navigation stages + if (isset($nav_data['finished']) && is_array($nav_data['finished'])) + { + foreach ($nav_data['finished'] as $finished_stage) + { + if ($iohandler !== null) + { + $iohandler->set_finished_stage_menu($finished_stage); + } + + $this->navigation_provider->set_nav_property($finished_stage, array( + 'selected' => false, + 'completed' => true, + )); + } + } + } + + /** + * Set default template variables + * + * @param string $page_title Title of the page + * @param bool $selected_language True to enable language selector it, false otherwise + */ + protected function page_header($page_title, $selected_language = false) + { + // Path to templates + $paths = array($this->phpbb_root_path . 'install/update/new/adm/', $this->phpbb_admin_path); + $paths = array_filter($paths, 'is_dir'); + $path = array_shift($paths); + $path = substr($path, strlen($this->phpbb_root_path)); + + $this->template->assign_vars(array( + 'L_CHANGE' => $this->language->lang('CHANGE'), + 'L_COLON' => $this->language->lang('COLON'), + 'L_INSTALL_PANEL' => $this->language->lang('INSTALL_PANEL'), + 'L_SELECT_LANG' => $this->language->lang('SELECT_LANG'), + 'L_SKIP' => $this->language->lang('SKIP'), + 'PAGE_TITLE' => $this->language->lang($page_title), + 'T_IMAGE_PATH' => $this->path_helper->get_web_root_path() . $path . 'images', + 'T_JQUERY_LINK' => $this->path_helper->get_web_root_path() . $path . '../assets/javascript/jquery.min.js', + 'T_TEMPLATE_PATH' => $this->path_helper->get_web_root_path() . $path . 'style', + 'T_ASSETS_PATH' => $this->path_helper->get_web_root_path() . $path . '../assets', + + 'S_CONTENT_DIRECTION' => $this->language->lang('DIRECTION'), + 'S_CONTENT_FLOW_BEGIN' => ($this->language->lang('DIRECTION') === 'ltr') ? 'left' : 'right', + 'S_CONTENT_FLOW_END' => ($this->language->lang('DIRECTION') === 'ltr') ? 'right' : 'left', + 'S_CONTENT_ENCODING' => 'UTF-8', + 'S_LANG_SELECT' => $selected_language, + + 'S_USER_LANG' => $this->language->lang('USER_LANG'), + )); + + $this->render_navigation(); + } + + /** + * Render navigation + */ + protected function render_navigation() + { + // Get navigation items + $nav_array = $this->navigation_provider->get(); + $nav_array = $this->sort_navigation_level($nav_array); + + $active_main_menu = $this->get_active_main_menu($nav_array); + + // Pass navigation to template + foreach ($nav_array as $key => $entry) + { + $this->template->assign_block_vars('t_block1', array( + 'L_TITLE' => $this->language->lang($entry['label']), + 'S_SELECTED' => ($active_main_menu === $key), + 'U_TITLE' => $this->route($entry['route']), + )); + + if (is_array($entry[0]) && $active_main_menu === $key) + { + $entry[0] = $this->sort_navigation_level($entry[0]); + + foreach ($entry[0] as $name => $sub_entry) + { + if (isset($sub_entry['stage']) && $sub_entry['stage'] === true) + { + $this->template->assign_block_vars('l_block2', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['selected']) && $sub_entry['selected'] === true), + 'S_COMPLETE' => (isset($sub_entry['completed']) && $sub_entry['completed'] === true), + 'STAGE_NAME' => $name, + )); + } + else + { + $this->template->assign_block_vars('l_block1', array( + 'L_TITLE' => $this->language->lang($sub_entry['label']), + 'S_SELECTED' => (isset($sub_entry['route']) && $sub_entry['route'] === $this->request->get('_route')), + 'U_TITLE' => $this->route($sub_entry['route']), + )); + } + } + } + } + } + + /** + * Render language select form + * + * @param string $selected_language + */ + protected function render_language_select($selected_language = null) + { + $langs = $this->lang_helper->get_available_languages(); + foreach ($langs as $lang) + { + $this->template->assign_block_vars('language_select_item', array( + 'VALUE' => $lang['iso'], + 'NAME' => $lang['local_name'], + 'SELECTED' => ($lang['iso'] === $selected_language), + )); + } + } + + /** + * Returns the name of the active main menu item + * + * @param array $nav_array + * + * @return string|bool Returns the name of the active main menu element, if the element not found, returns false + */ + protected function get_active_main_menu($nav_array) + { + $active_route = $this->request->get('_route'); + + foreach ($nav_array as $nav_name => $nav_options) + { + $current_menu = $nav_name; + + if (isset($nav_options['route']) && $nav_options['route'] === $active_route) + { + return $nav_name; + } + + if (is_array($nav_options[0])) + { + foreach ($nav_options[0] as $sub_menus) + { + if (isset($sub_menus['route']) && $sub_menus['route'] === $active_route) + { + return $current_menu; + } + } + } + } + + return false; + } + + /** + * Sorts the top level of navigation array + * + * @param array $nav_array Navigation array + * + * @return array + */ + protected function sort_navigation_level($nav_array) + { + $sorted = array(); + foreach ($nav_array as $key => $nav) + { + $order = (isset($nav['order'])) ? $nav['order'] : 0; + $sorted[$order][$key] = $nav; + } + + // Linearization of navigation array + $nav_array = array(); + ksort($sorted); + foreach ($sorted as $nav) + { + $nav_array = array_merge($nav_array, $nav); + } + + return $nav_array; + } +} diff --git a/install/update/old/phpbb/install/helper/container_factory.php b/install/update/old/phpbb/install/helper/container_factory.php new file mode 100644 index 0000000..9e372fe --- /dev/null +++ b/install/update/old/phpbb/install/helper/container_factory.php @@ -0,0 +1,191 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper; + +use phpbb\install\exception\cannot_build_container_exception; +use phpbb\language\language; +use phpbb\request\request; + +class container_factory +{ + /** + * @var language + */ + protected $language; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * @var \phpbb\request\request + */ + protected $request; + + /** + * @var update_helper + */ + protected $update_helper; + + /** + * The full phpBB container + * + * @var \Symfony\Component\DependencyInjection\ContainerInterface + */ + protected $container; + + /** + * Constructor + * + * @param language $language Language service + * @param request $request Request interface + * @param update_helper $update_helper Update helper + * @param string $phpbb_root_path Path to phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct(language $language, request $request, update_helper $update_helper, $phpbb_root_path, $php_ext) + { + $this->language = $language; + $this->request = $request; + $this->update_helper = $update_helper; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->container = null; + } + + /** + * Container getter + * + * @param null|string $service_name Name of the service to return + * + * @return \Symfony\Component\DependencyInjection\ContainerInterface|Object phpBB's dependency injection container + * or the service specified in $service_name + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + * @throws \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException If the service is not defined + * @throws \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException When a circular reference is detected + * @throws \Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException When the service is not defined + */ + public function get($service_name = null) + { + // Check if container was built, if not try to build it + if ($this->container === null) + { + $this->build_container(); + } + + return ($service_name === null) ? $this->container : $this->container->get($service_name); + } + + /** + * Returns the specified parameter from the container + * + * @param string $param_name + * + * @return mixed + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + */ + public function get_parameter($param_name) + { + // Check if container was built, if not try to build it + if ($this->container === null) + { + $this->build_container(); + } + + return $this->container->getParameter($param_name); + } + + /** + * Build dependency injection container + * + * @throws \phpbb\install\exception\cannot_build_container_exception When container cannot be built + */ + protected function build_container() + { + // If the container has been already built just return. + // Although this should never happen + if ($this->container instanceof \Symfony\Component\DependencyInjection\ContainerInterface) + { + return; + } + + // Check whether container can be built + // We need config.php for that so let's check if it has been set up yet + if (!filesize($this->phpbb_root_path . 'config.' . $this->php_ext)) + { + throw new cannot_build_container_exception(); + } + + $phpbb_config_php_file = new \phpbb\config_php_file($this->phpbb_root_path, $this->php_ext); + $phpbb_container_builder = new \phpbb\di\container_builder($this->phpbb_root_path, $this->php_ext); + + // For BC with functions that we need during install + global $phpbb_container, $table_prefix; + + $disable_super_globals = $this->request->super_globals_disabled(); + + // This is needed because container_builder::get_env_parameters() uses $_SERVER + if ($disable_super_globals) + { + $this->request->enable_super_globals(); + } + + $other_config_path = $this->phpbb_root_path . 'install/update/new/config'; + $config_path = (is_dir($other_config_path)) ? $other_config_path : $this->phpbb_root_path . 'config'; + + $this->container = $phpbb_container_builder + ->with_environment('production') + ->with_config($phpbb_config_php_file) + ->with_config_path($config_path) + ->without_compiled_container() + ->get_container(); + + // Setting request is required for the compatibility globals as those are generated from + // this container + if (!$this->container->isFrozen()) + { + $this->container->register('request')->setSynthetic(true); + $this->container->register('language')->setSynthetic(true); + } + + $this->container->set('request', $this->request); + $this->container->set('language', $this->language); + + $this->container->compile(); + + $phpbb_container = $this->container; + $table_prefix = $phpbb_config_php_file->get('table_prefix'); + + // Restore super globals to previous state + if ($disable_super_globals) + { + $this->request->disable_super_globals(); + } + + // Get compatibilty globals and constants + $this->update_helper->include_file('includes/compatibility_globals.' . $this->php_ext); + + register_compatibility_globals(); + + $this->update_helper->include_file('includes/constants.' . $this->php_ext); + } +} diff --git a/install/update/old/phpbb/install/helper/database.php b/install/update/old/phpbb/install/helper/database.php new file mode 100644 index 0000000..fa5a10c --- /dev/null +++ b/install/update/old/phpbb/install/helper/database.php @@ -0,0 +1,439 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper; + +use phpbb\install\exception\invalid_dbms_exception; + +/** + * Database related general functionality for installer + */ +class database +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var array + */ + protected $supported_dbms = array( + // Note: php 5.5 alpha 2 deprecated mysql. + // Keep mysqli before mysql in this list. + 'mysqli' => array( + 'LABEL' => 'MySQL with MySQLi Extension', + 'SCHEMA' => 'mysql_41', + 'MODULE' => 'mysqli', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mysqli', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mysql' => array( + 'LABEL' => 'MySQL', + 'SCHEMA' => 'mysql', + 'MODULE' => 'mysql', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mysql', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssql_odbc'=> array( + 'LABEL' => 'MS SQL Server [ ODBC ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'odbc', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mssql_odbc', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'mssqlnative' => array( + 'LABEL' => 'MS SQL Server 2005+ [ Native ]', + 'SCHEMA' => 'mssql', + 'MODULE' => 'sqlsrv', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\mssqlnative', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'oracle' => array( + 'LABEL' => 'Oracle', + 'SCHEMA' => 'oracle', + 'MODULE' => 'oci8', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\oracle', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + 'postgres' => array( + 'LABEL' => 'PostgreSQL 8.3+', + 'SCHEMA' => 'postgres', + 'MODULE' => 'pgsql', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\postgres', + 'AVAILABLE' => true, + '2.0.x' => true, + ), + 'sqlite3' => array( + 'LABEL' => 'SQLite3', + 'SCHEMA' => 'sqlite', + 'MODULE' => 'sqlite3', + 'DELIM' => ';', + 'DRIVER' => 'phpbb\db\driver\sqlite3', + 'AVAILABLE' => true, + '2.0.x' => false, + ), + ); + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem interface + * @param string $phpbb_root_path Path to phpBB's root + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $phpbb_root_path) + { + $this->filesystem = $filesystem; + $this->phpbb_root_path = $phpbb_root_path; + } + + /** + * Returns an array of available DBMS supported by phpBB + * + * If a DBMS is specified it will only return data for that DBMS + * and will load its extension if necessary. + * + * @param mixed $dbms name of the DBMS that's info is required or false for all DBMS info + * @param bool $return_unavailable set it to true if you expect unavailable but supported DBMS + * returned as well + * @param bool $only_20x_options set it to true if you only want to recover 2.0.x options + * + * @return array Array of available and supported DBMS + */ + public function get_available_dbms($dbms = false, $return_unavailable = false, $only_20x_options = false) + { + $available_dbms = $this->supported_dbms; + + if ($dbms) + { + if (isset($this->supported_dbms[$dbms])) + { + $available_dbms = array($dbms => $this->supported_dbms[$dbms]); + } + else + { + return array(); + } + } + + $any_dbms_available = false; + foreach ($available_dbms as $db_name => $db_array) + { + if ($only_20x_options && !$db_array['2.0.x']) + { + if ($return_unavailable) + { + $available_dbms[$db_name]['AVAILABLE'] = false; + } + else + { + unset($available_dbms[$db_name]); + } + + continue; + } + + $dll = $db_array['MODULE']; + if (!@extension_loaded($dll)) + { + if ($return_unavailable) + { + $available_dbms[$db_name]['AVAILABLE'] = false; + } + else + { + unset($available_dbms[$db_name]); + } + + continue; + } + + $any_dbms_available = true; + } + + if ($return_unavailable) + { + $available_dbms['ANY_DB_SUPPORT'] = $any_dbms_available; + } + + return $available_dbms; + } + + /** + * Removes "/* style" as well as "# style" comments from $input. + * + * @param string $sql_query Input string + * + * @return string Input string with comments removed + */ + public function remove_comments($sql_query) + { + // Remove /* */ comments (http://ostermiller.org/findcomment.html) + $sql_query = preg_replace('#/\*(.|[\r\n])*?\*/#', "\n", $sql_query); + + // Remove # style comments + $sql_query = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql_query)); + + return $sql_query; + } + + /** + * split_sql_file() will split an uploaded sql file into single sql statements. + * + * Note: expects trim() to have already been run on $sql. + * + * @param string $sql SQL statements + * @param string $delimiter Delimiter between sql statements + * + * @return array Array of sql statements + */ + public function split_sql_file($sql, $delimiter) + { + $sql = str_replace("\r" , '', $sql); + $data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql); + + $data = array_map('trim', $data); + + // The empty case + $end_data = end($data); + + if (empty($end_data)) + { + unset($data[key($data)]); + } + + return $data; + } + + /** + * Validates table prefix + * + * @param string $dbms The selected dbms + * @param string $table_prefix The table prefix to validate + * + * @return bool|array true if table prefix is valid, array of errors otherwise + * + * @throws \phpbb\install\exception\invalid_dbms_exception When $dbms is not a valid + */ + public function validate_table_prefix($dbms, $table_prefix) + { + $errors = array(); + + if (!preg_match('#^[a-zA-Z][a-zA-Z0-9_]*$#', $table_prefix)) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_INVALID_PREFIX', + ); + } + + // Do dbms specific checks + $dbms_info = $this->get_available_dbms($dbms); + switch ($dbms_info[$dbms]['SCHEMA']) + { + case 'mysql': + case 'mysql_41': + $prefix_length = 36; + break; + case 'mssql': + $prefix_length = 90; + break; + case 'oracle': + $prefix_length = 6; + break; + case 'postgres': + $prefix_length = 36; + break; + case 'sqlite': + $prefix_length = 200; + break; + default: + throw new invalid_dbms_exception(); + break; + } + + // Check the prefix length to ensure that index names are not too long + if (strlen($table_prefix) > $prefix_length) + { + $errors[] = array( + 'title' => array('INST_ERR_PREFIX_TOO_LONG', $prefix_length), + ); + } + + return (empty($errors)) ? true : $errors; + } + + /** + * Check if the user provided database parameters are correct + * + * This function checks the database connection data and also checks for + * any other problems that could cause an error during the installation + * such as if there is any database table names conflicting. + * + * Note: The function assumes that $table_prefix has been already validated + * with validate_table_prefix(). + * + * @param string $dbms Selected database type + * @param string $dbhost Database host address + * @param int $dbport Database port number + * @param string $dbuser Database username + * @param string $dbpass Database password + * @param string $dbname Database name + * @param string $table_prefix Database table prefix + * + * @return array|bool Returns true if test is successful, array of errors otherwise + */ + public function check_database_connection($dbms, $dbhost, $dbport, $dbuser, $dbpass, $dbname, $table_prefix) + { + $dbms_info = $this->get_available_dbms($dbms); + $dbms_info = $dbms_info[$dbms]; + $errors = array(); + + // Instantiate it and set return on error true + /** @var \phpbb\db\driver\driver_interface $db */ + $db = new $dbms_info['DRIVER']; + $db->sql_return_on_error(true); + + // Check that we actually have a database name before going any further + if (!in_array($dbms_info['SCHEMA'], array('sqlite', 'oracle'), true) && $dbname === '') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_NAME', + ); + } + + // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea + if ($dbms_info['SCHEMA'] === 'sqlite' + && stripos($this->filesystem->realpath($dbhost), $this->filesystem->realpath($this->phpbb_root_path) === 0)) + { + $errors[] = array( + 'title' =>'INST_ERR_DB_FORUM_PATH', + ); + } + + // Check if SQLite database is writable + if ($dbms_info['SCHEMA'] === 'sqlite' + && (($this->filesystem->exists($dbhost) && !$this->filesystem->is_writable($dbhost)) || !$this->filesystem->is_writable(pathinfo($dbhost, PATHINFO_DIRNAME)))) + { + $errors[] = array( + 'title' =>'INST_ERR_DB_NO_WRITABLE', + ); + } + + // Try to connect to db + if (is_array($db->sql_connect($dbhost, $dbuser, $dbpass, $dbname, $dbport, false, true))) + { + $db_error = $db->sql_error(); + $errors[] = array( + 'title' => 'INST_ERR_DB_CONNECT', + 'description' => ($db_error['message']) ? utf8_convert_message($db_error['message']) : 'INST_ERR_DB_NO_ERROR', + ); + } + else + { + // Check if there is any table name collisions + $temp_prefix = strtolower($table_prefix); + $table_ary = array( + $temp_prefix . 'attachments', + $temp_prefix . 'config', + $temp_prefix . 'sessions', + $temp_prefix . 'topics', + $temp_prefix . 'users', + ); + + $db_tools_factory = new \phpbb\db\tools\factory(); + $db_tools = $db_tools_factory->get($db); + $tables = $db_tools->sql_list_tables(); + $tables = array_map('strtolower', $tables); + $table_intersect = array_intersect($tables, $table_ary); + + if (count($table_intersect)) + { + $errors[] = array( + 'title' => 'INST_ERR_PREFIX', + ); + } + + // Check if database version is supported + switch ($dbms) + { + case 'mysqli': + if (version_compare($db->sql_server_info(true), '4.1.3', '<')) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_MYSQLI', + ); + } + break; + case 'sqlite3': + if (version_compare($db->sql_server_info(true), '3.6.15', '<')) + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_SQLITE3', + ); + } + break; + case 'oracle': + $sql = "SELECT * + FROM NLS_DATABASE_PARAMETERS + WHERE PARAMETER = 'NLS_RDBMS_VERSION' + OR PARAMETER = 'NLS_CHARACTERSET'"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $stats[$row['parameter']] = $row['value']; + } + $db->sql_freeresult($result); + + if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<') && $stats['NLS_CHARACTERSET'] !== 'UTF8') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_ORACLE', + ); + } + break; + case 'postgres': + $sql = "SHOW server_encoding;"; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') + { + $errors[] = array( + 'title' => 'INST_ERR_DB_NO_POSTGRES', + ); + } + break; + } + } + + return (empty($errors)) ? true : $errors; + } +} diff --git a/install/update/old/phpbb/install/helper/iohandler/iohandler_interface.php b/install/update/old/phpbb/install/helper/iohandler/iohandler_interface.php new file mode 100644 index 0000000..4407489 --- /dev/null +++ b/install/update/old/phpbb/install/helper/iohandler/iohandler_interface.php @@ -0,0 +1,222 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\helper\iohandler; + +/** + * Input-Output handler interface for the installer + */ +interface iohandler_interface +{ + /** + * Renders or returns response message + * + * @param bool $no_more_output Whether or not there will be more output in this output unit + */ + public function send_response($no_more_output = false); + + /** + * Returns input variable + * + * @param string $name Name of the input variable to obtain + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * + * @return mixed Value of the input variable + */ + public function get_input($name, $default, $multibyte = false); + + /** + * Returns raw input variable + * + * @param string $name Name of the input variable to obtain + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * + * @return mixed Value of the raw input variable + */ + public function get_raw_input($name, $default); + + /** + * Returns server variable + * + * This function should work the same as request_interface::server(). + * + * @param string $name Name of the server variable + * @param mixed $default Default value to return when the requested variable does not exist + * + * @return mixed Value of the server variable + */ + public function get_server_variable($name, $default = ''); + + /** + * Wrapper function for request_interface::header() + * + * @param string $name Name of the request header variable + * @param mixed $default Default value to return when the requested variable does not exist + * + * @return mixed + */ + public function get_header_variable($name, $default = ''); + + /** + * Returns true if the connection is encrypted + * + * @return bool + */ + public function is_secure(); + + /** + * Adds an error message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $error_title Title of the error message. + * @param string|bool|array $error_description Description of the error (and possibly guidelines to resolve it), + * or false if the error description is not available. + */ + public function add_error_message($error_title, $error_description = false); + + /** + * Adds a warning message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $warning_title Title of the warning message + * @param string|bool|array $warning_description Description of the warning (and possibly guidelines to resolve it), + * or false if the warning description is not available + */ + public function add_warning_message($warning_title, $warning_description = false); + + /** + * Adds a log message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $log_title Title of the log message + * @param string|bool|array $log_description Description of the log, + * or false if the log description is not available + */ + public function add_log_message($log_title, $log_description = false); + + /** + * Adds a success message to the rendering queue + * + * Note: When an array is passed into the parameters below, it will be + * resolved as printf($param[0], $param[1], ...). + * + * @param string|array $success_title Title of the success message + * @param string|bool|array $success_description Description of the success, + * or false if the success description is not available + * + * @return null + */ + public function add_success_message($success_title, $success_description = false); + + /** + * Adds a requested data group to the rendering queue + * + * @param string $title Language variable with the title of the form + * @param array $form An array describing the required data (options etc) + */ + public function add_user_form_group($title, $form); + + /** + * Returns the rendering information for the form + * + * @param string $title Language variable with the title of the form + * @param array $form An array describing the required data (options etc) + * + * @return string Information to render the form + */ + public function generate_form_render_data($title, $form); + + /** + * Sets the number of tasks belonging to the installer in the current mode. + * + * @param int $task_count Number of tasks + * @param bool $restart Whether or not to restart the progress bar, false by default + */ + public function set_task_count($task_count, $restart = false); + + /** + * Sets the progress information + * + * @param string $task_lang_key Language key for the name of the task + * @param int $task_number Position of the current task in the task queue + */ + public function set_progress($task_lang_key, $task_number); + + /** + * Sends refresh request to the client + */ + public function request_refresh(); + + /** + * Marks stage as active in the navigation bar + * + * @param array $menu_path Array to the navigation elem + */ + public function set_active_stage_menu($menu_path); + + /** + * Marks stage as completed in the navigation bar + * + * @param array $menu_path Array to the navigation elem + */ + public function set_finished_stage_menu($menu_path); + + /** + * Finish the progress bar + * + * @param string $message_lang_key Language key for the message + */ + public function finish_progress($message_lang_key); + + /** + * Adds a download link + * + * @param string $route Route for the link + * @param string $title Language key for the title + * @param string|null|array $msg Language key for the message + */ + public function add_download_link($route, $title, $msg = null); + + /** + * Redirects the user to a new page + * + * @param string $url URL to redirect to + * @param bool $use_ajax Whether or not to use AJAX redirect + */ + public function redirect($url, $use_ajax = false); + + /** + * Renders the status of update files + * + * @param array $status_array Array containing files in groups to render + */ + public function render_update_file_status($status_array); + + /** + * Sends and sets cookies + * + * @param string $cookie_name Name of the cookie to set + * @param string $cookie_value Value of the cookie to set + */ + public function set_cookie($cookie_name, $cookie_value); +} diff --git a/install/update/old/phpbb/install/installer_configuration.php b/install/update/old/phpbb/install/installer_configuration.php new file mode 100644 index 0000000..8051403 --- /dev/null +++ b/install/update/old/phpbb/install/installer_configuration.php @@ -0,0 +1,147 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\install; + +use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\ConfigurationInterface; + +class installer_configuration implements ConfigurationInterface +{ + + /** + * Generates the configuration tree builder. + * + * @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder + */ + public function getConfigTreeBuilder() + { + $treeBuilder = new TreeBuilder(); + $rootNode = $treeBuilder->root('installer'); + $rootNode + ->children() + ->arrayNode('admin') + ->children() + ->scalarNode('name')->defaultValue('admin')->cannotBeEmpty()->end() + ->scalarNode('password')->defaultValue('adminadmin')->cannotBeEmpty()->end() + ->scalarNode('email')->defaultValue('admin@example.org')->cannotBeEmpty()->end() + ->end() + ->end() + ->arrayNode('board') + ->children() + ->scalarNode('lang') + ->defaultValue('en') + ->cannotBeEmpty() + ->end() + ->scalarNode('name') + ->defaultValue('My Board') + ->cannotBeEmpty() + ->end() + ->scalarNode('description') + ->defaultValue('My amazing new phpBB board') + ->cannotBeEmpty() + ->end() + ->end() + ->end() + ->arrayNode('database') + ->children() + ->scalarNode('dbms') + ->defaultValue('sqlite3') + ->cannotBeEmpty() + ->isRequired() + ->end() + ->scalarNode('dbhost') + ->defaultValue(null) + ->end() + ->scalarNode('dbport') + ->defaultValue(null) + ->end() + ->scalarNode('dbuser') + ->defaultValue(null) + ->end() + ->scalarNode('dbpasswd') + ->defaultValue(null) + ->end() + ->scalarNode('dbname') + ->defaultValue(null) + ->end() + ->scalarNode('table_prefix') + ->defaultValue('phpbb_') + ->cannotBeEmpty() + ->isRequired() + ->end() + ->end() + ->end() + ->arrayNode('email') + ->canBeEnabled() + ->addDefaultsIfNotSet() + ->children() + ->booleanNode('smtp_delivery') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('smtp_host') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_port') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_auth') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_user') + ->defaultValue(null) + ->end() + ->scalarNode('smtp_pass') + ->defaultValue(null) + ->end() + ->end() + ->end() + ->arrayNode('server') + ->children() + ->booleanNode('cookie_secure') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('server_protocol') + ->defaultValue('http://') + ->cannotBeEmpty() + ->end() + ->booleanNode('force_server_vars') + ->defaultValue(false) + ->treatNullLike(false) + ->end() + ->scalarNode('server_name') + ->defaultValue('localhost') + ->cannotBeEmpty() + ->end() + ->integerNode('server_port') + ->defaultValue(80) + ->min(1) + ->cannotBeEmpty() + ->end() + ->scalarNode('script_path') + ->defaultValue('/') + ->cannotBeEmpty() + ->end() + ->end() + ->end() + ->arrayNode('extensions') + ->prototype('scalar')->end() + ->defaultValue([]) + ->end() + ->end() + ; + return $treeBuilder; + } +} diff --git a/install/update/old/phpbb/install/module/install_database/task/add_config_settings.php b/install/update/old/phpbb/install/module/install_database/task/add_config_settings.php new file mode 100644 index 0000000..ba43960 --- /dev/null +++ b/install/update/old/phpbb/install/module/install_database/task/add_config_settings.php @@ -0,0 +1,368 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_database\task; + +use phpbb\install\exception\resource_limit_reached_exception; + +/** + * Create database schema + */ +class add_config_settings extends \phpbb\install\task_base +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var \phpbb\language\language + */ + protected $language; + + /** + * @var \phpbb\passwords\manager + */ + protected $password_manager; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $config_table; + + /** + * @var string + */ + protected $user_table; + + /** + * @var string + */ + protected $topics_table; + + /** + * @var string + */ + protected $forums_table; + + /** + * @var string + */ + protected $posts_table; + + /** + * @var string + */ + protected $moderator_cache_table; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem service + * @param \phpbb\install\helper\config $install_config Installer's config helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param \phpbb\install\helper\container_factory $container Installer's DI container + * @param \phpbb\language\language $language Language service + * @param string $phpbb_root_path Path to phpBB's root + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\config $install_config, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + \phpbb\install\helper\container_factory $container, + \phpbb\language\language $language, + $phpbb_root_path) + { + $this->db = $container->get('dbal.conn'); + $this->filesystem = $filesystem; + $this->install_config = $install_config; + $this->iohandler = $iohandler; + $this->language = $language; + $this->password_manager = $container->get('passwords.manager'); + $this->phpbb_root_path = $phpbb_root_path; + + // Table names + $this->config_table = $container->get_parameter('tables.config'); + $this->forums_table = $container->get_parameter('tables.forums'); + $this->topics_table = $container->get_parameter('tables.topics'); + $this->user_table = $container->get_parameter('tables.users'); + $this->moderator_cache_table = $container->get_parameter('tables.moderator_cache'); + $this->posts_table = $container->get_parameter('tables.posts'); + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $server_name = $this->install_config->get('server_name'); + $current_time = time(); + $user_ip = phpbb_ip_normalise($this->iohandler->get_server_variable('REMOTE_ADDR')); + $user_ip = ($user_ip === false) ? '' : $user_ip; + $referer = $this->iohandler->get_server_variable('REFERER'); + + // Calculate cookie domain + $cookie_domain = $server_name; + + if (strpos($cookie_domain, 'www.') === 0) + { + $cookie_domain = substr($cookie_domain, 3); + } + + // Set default config and post data, this applies to all DB's + $sql_ary = array( + 'INSERT INTO ' . $this->config_table . " (config_name, config_value) + VALUES ('board_startdate', '$current_time')", + + 'INSERT INTO ' . $this->config_table . " (config_name, config_value) + VALUES ('default_lang', '" . $this->db->sql_escape($this->install_config->get('default_lang')) . "')", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_name')) . "' + WHERE config_name = 'server_name'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_port')) . "' + WHERE config_name = 'server_port'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "' + WHERE config_name = 'board_email'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_email')) . "' + WHERE config_name = 'board_contact'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($cookie_domain) . "' + WHERE config_name = 'cookie_domain'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "' + WHERE config_name = 'default_dateformat'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('email_enable')) . "' + WHERE config_name = 'email_enable'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_delivery')) . "' + WHERE config_name = 'smtp_delivery'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_host')) . "' + WHERE config_name = 'smtp_host'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_port')) . "' + WHERE config_name = 'smtp_port'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_auth')) . "' + WHERE config_name = 'smtp_auth_method'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_user')) . "' + WHERE config_name = 'smtp_username'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('smtp_pass')) . "' + WHERE config_name = 'smtp_password'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('cookie_secure')) . "' + WHERE config_name = 'cookie_secure'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('force_server_vars')) . "' + WHERE config_name = 'force_server_vars'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('script_path')) . "' + WHERE config_name = 'script_path'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('server_protocol')) . "' + WHERE config_name = 'server_protocol'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE config_name = 'newest_username'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . md5(mt_rand()) . "' + WHERE config_name = 'avatar_salt'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . md5(mt_rand()) . "' + WHERE config_name = 'plupload_salt'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_name')) . "' + WHERE config_name = 'sitename'", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->install_config->get('board_description')) . "' + WHERE config_name = 'site_desc'", + + 'UPDATE ' . $this->user_table . " + SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "', + user_password='" . $this->password_manager->hash($this->install_config->get('admin_passwd')) . "', + user_ip = '" . $this->db->sql_escape($user_ip) . "', + user_lang = '" . $this->db->sql_escape($this->install_config->get('user_language', 'en')) . "', + user_email='" . $this->db->sql_escape($this->install_config->get('board_email')) . "', + user_dateformat='" . $this->db->sql_escape($this->language->lang('default_dateformat')) . "', + user_email_hash = " . $this->db->sql_escape(phpbb_email_hash($this->install_config->get('board_email'))) . ", + username_clean = '" . $this->db->sql_escape(utf8_clean_string($this->install_config->get('admin_name'))) . "' + WHERE username = 'Admin'", + + 'UPDATE ' . $this->moderator_cache_table . " + SET username = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE username = 'Admin'", + + 'UPDATE ' . $this->forums_table . " + SET forum_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE forum_last_poster_name = 'Admin'", + + 'UPDATE ' . $this->topics_table . " + SET topic_first_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "', + topic_last_poster_name = '" . $this->db->sql_escape($this->install_config->get('admin_name')) . "' + WHERE topic_first_poster_name = 'Admin' + OR topic_last_poster_name = 'Admin'", + + 'UPDATE ' . $this->user_table . " + SET user_regdate = $current_time", + + 'UPDATE ' . $this->posts_table . " + SET post_time = $current_time, poster_ip = '" . $this->db->sql_escape($user_ip) . "'", + + 'UPDATE ' . $this->topics_table . " + SET topic_time = $current_time, topic_last_post_time = $current_time", + + 'UPDATE ' . $this->forums_table . " + SET forum_last_post_time = $current_time", + + 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($this->db->sql_server_info(true)) . "' + WHERE config_name = 'dbms_version'", + ); + + if (@extension_loaded('gd')) + { + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = 'core.captcha.plugins.gd' + WHERE config_name = 'captcha_plugin'"; + + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '1' + WHERE config_name = 'captcha_gd'"; + } + + $ref = substr($referer, strpos($referer, '://') + 3); + if (!(stripos($ref, $server_name) === 0)) + { + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '0' + WHERE config_name = 'referer_validation'"; + } + + // We set a (semi-)unique cookie name to bypass login issues related to the cookie name. + $cookie_name = 'phpbb3_'; + $rand_str = md5(mt_rand()); + $rand_str = str_replace('0', 'z', base_convert($rand_str, 16, 35)); + $rand_str = substr($rand_str, 0, 5); + $cookie_name .= strtolower($rand_str); + + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '" . $this->db->sql_escape($cookie_name) . "' + WHERE config_name = 'cookie_name'"; + + // Disable avatars if upload directory is not writable + if (!$this->filesystem->is_writable($this->phpbb_root_path . 'images/avatars/upload/')) + { + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '0' + WHERE config_name = 'allow_avatar'"; + + $sql_ary[] = 'UPDATE ' . $this->config_table . " + SET config_value = '0' + WHERE config_name = 'allow_avatar_upload'"; + } + + $i = $this->install_config->get('add_config_settings_index', 0); + $total = count($sql_ary); + $sql_ary = array_slice($sql_ary, $i); + + foreach ($sql_ary as $sql) + { + if (!$this->db->sql_query($sql)) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + + $i++; + + // Stop execution if resource limit is reached + if ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0) + { + break; + } + } + + if ($i < $total) + { + $this->install_config->set('add_config_settings_index', $i); + throw new resource_limit_reached_exception(); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_ADD_CONFIG_SETTINGS'; + } +} diff --git a/install/update/old/phpbb/install/module/install_database/task/create_schema.php b/install/update/old/phpbb/install/module/install_database/task/create_schema.php new file mode 100644 index 0000000..a5635d5 --- /dev/null +++ b/install/update/old/phpbb/install/module/install_database/task/create_schema.php @@ -0,0 +1,234 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_database\task; + +use phpbb\install\exception\resource_limit_reached_exception; + +/** + * Create database schema + */ +class create_schema extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\config + */ + protected $config; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\db\tools\tools_interface + */ + protected $db_tools; + + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config Installer's config provider + * @param \phpbb\install\helper\database $db_helper Installer's database helper + * @param \phpbb\filesystem\filesystem_interface $filesystem Filesystem service + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler Installer's input-output handler + * @param string $phpbb_root_path Path phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\database $db_helper, + \phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + $phpbb_root_path, + $php_ext) + { + $dbms = $db_helper->get_available_dbms($config->get('dbms')); + $dbms = $dbms[$config->get('dbms')]['DRIVER']; + $factory = new \phpbb\db\tools\factory(); + + $this->db = new $dbms(); + $this->db->sql_connect( + $config->get('dbhost'), + $config->get('dbuser'), + $config->get('dbpasswd'), + $config->get('dbname'), + $config->get('dbport'), + false, + false + ); + + $this->config = $config; + $this->db_tools = $factory->get($this->db); + $this->database_helper = $db_helper; + $this->filesystem = $filesystem; + $this->iohandler = $iohandler; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // As this task may take a large amount of time to complete refreshing the page might be necessary for some + // server configurations with limited resources + if (!$this->config->get('pre_schema_forced_refresh')) + { + if ($this->config->get_time_remaining() < 5) + { + $this->config->set('pre_schema_forced_refresh', true); + throw new resource_limit_reached_exception(); + } + } + + $this->db->sql_return_on_error(true); + + $dbms = $this->config->get('dbms'); + $dbms_info = $this->database_helper->get_available_dbms($dbms); + $schema_name = $dbms_info[$dbms]['SCHEMA']; + $delimiter = $dbms_info[$dbms]['DELIM']; + $table_prefix = $this->config->get('table_prefix'); + + if ($dbms === 'mysql') + { + if (version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) + { + $schema_name .= '_41'; + } + else + { + $schema_name .= '_40'; + } + } + + $db_schema_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql'; + + // Load database vendor specific code if there is any + if ($this->filesystem->exists($db_schema_path)) + { + $sql_query = @file_get_contents($db_schema_path); + $sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query); + $sql_query = $this->database_helper->remove_comments($sql_query); + $sql_query = $this->database_helper->split_sql_file($sql_query, $delimiter); + + foreach ($sql_query as $sql) + { + if (!$this->db->sql_query($sql)) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + + unset($sql_query); + } + + $change_prefix = false; + + // Generate database schema + if ($this->filesystem->exists($this->phpbb_root_path . 'install/schemas/schema.json')) + { + $db_table_schema = @file_get_contents($this->phpbb_root_path . 'install/schemas/schema.json'); + $db_table_schema = json_decode($db_table_schema, true); + $change_prefix = true; + } + else + { + global $table_prefix; + + $table_prefix = $this->config->get('table_prefix'); + + if (!defined('CONFIG_TABLE')) + { + // We need to include the constants file for the table constants + // when we generate the schema from the migration files. + include ($this->phpbb_root_path . 'includes/constants.' . $this->php_ext); + } + + $finder = new \phpbb\finder($this->filesystem, $this->phpbb_root_path, null, $this->php_ext); + $migrator_classes = $finder->core_path('phpbb/db/migration/data/')->get_classes(); + $factory = new \phpbb\db\tools\factory(); + $db_tools = $factory->get($this->db, true); + $schema_generator = new \phpbb\db\migration\schema_generator( + $migrator_classes, + new \phpbb\config\config(array()), + $this->db, + $db_tools, + $this->phpbb_root_path, + $this->php_ext, + $table_prefix + ); + $db_table_schema = $schema_generator->get_schema(); + } + + if (!defined('CONFIG_TABLE')) + { + // CONFIG_TABLE is required by sql_create_index() to check the + // length of index names. However table_prefix is not defined + // here yet, so we need to create the constant ourselves. + define('CONFIG_TABLE', $table_prefix . 'config'); + } + + foreach ($db_table_schema as $table_name => $table_data) + { + $this->db_tools->sql_create_table( + ( ($change_prefix) ? ($table_prefix . substr($table_name, 6)) : $table_name ), + $table_data + ); + } + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_CREATE_DATABASE_SCHEMA'; + } +} diff --git a/install/update/old/phpbb/install/module/install_database/task/set_up_database.php b/install/update/old/phpbb/install/module/install_database/task/set_up_database.php new file mode 100644 index 0000000..49c8ea2 --- /dev/null +++ b/install/update/old/phpbb/install/module/install_database/task/set_up_database.php @@ -0,0 +1,164 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_database\task; + +/** + * Set up database for table generation + */ +class set_up_database extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\config + */ + protected $config; + + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $schema_file_path; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * Constructor + * + * @param \phpbb\install\helper\config $config + * @param \phpbb\install\helper\database $db_helper + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * @param string $phpbb_root_path + */ + public function __construct(\phpbb\install\helper\config $config, + \phpbb\install\helper\database $db_helper, + \phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + $phpbb_root_path) + { + $dbms = $db_helper->get_available_dbms($config->get('dbms')); + $dbms = $dbms[$config->get('dbms')]['DRIVER']; + + $this->db = new $dbms(); + $this->db->sql_connect( + $config->get('dbhost'), + $config->get('dbuser'), + $config->get('dbpasswd'), + $config->get('dbname'), + $config->get('dbport'), + false, + false + ); + + $this->config = $config; + $this->database_helper = $db_helper; + $this->filesystem = $filesystem; + $this->iohandler = $iohandler; + $this->phpbb_root_path = $phpbb_root_path; + + parent::__construct(false); + } + + /** + * {@inheritdoc} + */ + public function check_requirements() + { + $dbms = $this->config->get('dbms'); + $dbms_info = $this->database_helper->get_available_dbms($dbms); + $schema_name = $dbms_info[$dbms]['SCHEMA']; + + if ($dbms === 'mysql') + { + if (version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) + { + $schema_name .= '_41'; + } + else + { + $schema_name .= '_40'; + } + } + + $this->schema_file_path = $this->phpbb_root_path . 'install/schemas/' . $schema_name . '_schema.sql'; + + return $this->filesystem->exists($this->schema_file_path); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $this->db->sql_return_on_error(true); + + $dbms = $this->config->get('dbms'); + $dbms_info = $this->database_helper->get_available_dbms($dbms); + $delimiter = $dbms_info[$dbms]['DELIM']; + $table_prefix = $this->config->get('table_prefix'); + + $sql_query = @file_get_contents($this->schema_file_path); + $sql_query = preg_replace('#phpbb_#i', $table_prefix, $sql_query); + $sql_query = $this->database_helper->remove_comments($sql_query); + $sql_query = $this->database_helper->split_sql_file($sql_query, $delimiter); + + foreach ($sql_query as $sql) + { + if (!$this->db->sql_query($sql)) + { + $error = $this->db->sql_error($this->db->get_sql_error_sql()); + $this->iohandler->add_error_message('INST_ERR_DB', $error['message']); + } + } + + unset($sql_query); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_SETUP_DATABASE'; + } +} diff --git a/install/update/old/phpbb/install/module/install_filesystem/task/create_config_file.php b/install/update/old/phpbb/install/module/install_filesystem/task/create_config_file.php new file mode 100644 index 0000000..5bc425b --- /dev/null +++ b/install/update/old/phpbb/install/module/install_filesystem/task/create_config_file.php @@ -0,0 +1,244 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\install_filesystem\task; + +use phpbb\install\exception\user_interaction_required_exception; + +/** + * Dumps config file + */ +class create_config_file extends \phpbb\install\task_base +{ + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * @var \phpbb\install\helper\database + */ + protected $db_helper; + + /** + * @var \phpbb\install\helper\config + */ + protected $install_config; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $iohandler; + + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var string + */ + protected $php_ext; + + /** + * @var array + */ + protected $options; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param \phpbb\install\helper\config $install_config + * @param \phpbb\install\helper\database $db_helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $iohandler + * @param string $phpbb_root_path + * @param string $php_ext + * @param array $options + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, + \phpbb\install\helper\config $install_config, + \phpbb\install\helper\database $db_helper, + \phpbb\install\helper\iohandler\iohandler_interface $iohandler, + $phpbb_root_path, + $php_ext, + $options = array()) + { + $this->install_config = $install_config; + $this->db_helper = $db_helper; + $this->filesystem = $filesystem; + $this->iohandler = $iohandler; + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + $this->options = array_merge(array( + 'debug' => false, + 'debug_container' => false, + 'environment' => null, + ), $options); + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + $config_written = true; + + // Create config.php + $path_to_config = $this->phpbb_root_path . 'config.' . $this->php_ext; + + $fp = @fopen($path_to_config, 'w'); + if (!$fp) + { + $config_written = false; + } + + $config_content = $this->get_config_data($this->options['debug'], $this->options['debug_container'], $this->options['environment']); + + if (!@fwrite($fp, $config_content)) + { + $config_written = false; + } + + @fclose($fp); + + // chmod config.php to be only readable + if ($config_written) + { + try + { + $this->filesystem->phpbb_chmod($path_to_config, \phpbb\filesystem\filesystem_interface::CHMOD_READ); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing, the user will get a notice later + } + } + else + { + $this->iohandler->add_error_message('UNABLE_TO_WRITE_CONFIG_FILE'); + throw new user_interaction_required_exception(); + } + + // Create a lock file to indicate that there is an install in progress + $fp = @fopen($this->phpbb_root_path . 'cache/install_lock', 'wb'); + if ($fp === false) + { + // We were unable to create the lock file - abort + $this->iohandler->add_error_message('UNABLE_TO_WRITE_LOCK'); + throw new user_interaction_required_exception(); + } + @fclose($fp); + + try + { + $this->filesystem->phpbb_chmod($this->phpbb_root_path . 'cache/install_lock', 0777); + } + catch (\phpbb\filesystem\exception\filesystem_exception $e) + { + // Do nothing, the user will get a notice later + } + } + + /** + * Returns the content which should be dumped to config.php + * + * @param bool $debug If the debug constants should be enabled by default or not + * @param bool $debug_container If the container should be compiled on + * every page load or not + * @param string $environment The environment to use + * + * @return string content to be written to the config file + */ + protected function get_config_data($debug = false, $debug_container = false, $environment = null) + { + $config_content = "install_config->get('dbms'); + $db_driver = $this->db_helper->get_available_dbms($dbms); + $db_driver = $db_driver[$dbms]['DRIVER']; + + $config_data_array = array( + 'dbms' => $db_driver, + 'dbhost' => $this->install_config->get('dbhost'), + 'dbport' => $this->install_config->get('dbport'), + 'dbname' => $this->install_config->get('dbname'), + 'dbuser' => $this->install_config->get('dbuser'), + 'dbpasswd' => $this->install_config->get('dbpasswd'), + 'table_prefix' => $this->install_config->get('table_prefix'), + + 'phpbb_adm_relative_path' => 'adm/', + + 'acm_type' => 'phpbb\cache\driver\file', + ); + + foreach ($config_data_array as $key => $value) + { + $config_content .= "\${$key} = '" . str_replace("'", "\\'", str_replace('\\', '\\\\', $value)) . "';\n"; + } + + $config_content .= "\n@define('PHPBB_INSTALLED', true);\n"; + $config_content .= "// @define('PHPBB_DISPLAY_LOAD_TIME', true);\n"; + + if ($environment) + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'test');\n"; + } + else if ($debug) + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'development');\n"; + } + else + { + $config_content .= "@define('PHPBB_ENVIRONMENT', 'production');\n"; + } + + if ($debug_container) + { + $config_content .= "@define('DEBUG_CONTAINER', true);\n"; + } + else + { + $config_content .= "// @define('DEBUG_CONTAINER', true);\n"; + } + + if ($environment === 'test') + { + $config_content .= "@define('DEBUG_TEST', true);\n"; + + // Mandatory for the functional tests, will be removed by PHPBB3-12623 + $config_content .= "@define('DEBUG', true);\n"; + } + + return $config_content; + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 1; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return 'TASK_CREATE_CONFIG_FILE'; + } +} diff --git a/install/update/old/phpbb/install/module/requirements/task/check_server_environment.php b/install/update/old/phpbb/install/module/requirements/task/check_server_environment.php new file mode 100644 index 0000000..29f9777 --- /dev/null +++ b/install/update/old/phpbb/install/module/requirements/task/check_server_environment.php @@ -0,0 +1,209 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install\module\requirements\task; + +/** + * Installer task that checks if the server meats phpBB requirements + */ +class check_server_environment extends \phpbb\install\task_base +{ + /** + * @var \phpbb\install\helper\database + */ + protected $database_helper; + + /** + * @var \phpbb\install\helper\iohandler\iohandler_interface + */ + protected $response_helper; + + /** + * @var bool + */ + protected $tests_passed; + + /** + * Constructor + * + * @param \phpbb\install\helper\database $database_helper + * @param \phpbb\install\helper\iohandler\iohandler_interface $response + */ + public function __construct(\phpbb\install\helper\database $database_helper, + \phpbb\install\helper\iohandler\iohandler_interface $response) + { + $this->database_helper = $database_helper; + $this->response_helper = $response; + $this->tests_passed = true; + + parent::__construct(true); + } + + /** + * {@inheritdoc} + */ + public function run() + { + // + // Check requirements + // The error messages should be set in the check_ functions + // + + // Check PHP version + $this->check_php_version(); + + // Check for getimagesize() + $this->check_image_size(); + + // Check for PCRE support + $this->check_pcre(); + + // Check for JSON support + $this->check_json(); + + // XML extension support check + $this->check_xml(); + + // Check for dbms support + $this->check_available_dbms(); + + return $this->tests_passed; + } + + /** + * Sets $this->tests_passed + * + * @param bool $is_passed + */ + protected function set_test_passed($is_passed) + { + // If one test failed, tests_passed should be false + $this->tests_passed = (!$this->tests_passed) ? false : $is_passed; + } + + /** + * Check if the requirements for PHP version is met + */ + protected function check_php_version() + { + $php_version = PHP_VERSION; + + if (version_compare($php_version, '5.4') < 0) + { + $this->response_helper->add_error_message('PHP_VERSION_REQD', 'PHP_VERSION_REQD_EXPLAIN'); + + $this->set_test_passed(false); + return; + } + + $this->set_test_passed(true); + } + + /** + * Checks if the installed PHP has getimagesize() available + */ + protected function check_image_size() + { + if (!@function_exists('getimagesize')) + { + $this->response_helper->add_error_message('PHP_GETIMAGESIZE_SUPPORT', 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + return; + } + + $this->set_test_passed(true); + } + + /** + * Checks if the installed PHP supports PCRE + */ + protected function check_pcre() + { + if (@preg_match('//u', '')) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PCRE_UTF_SUPPORT', 'PCRE_UTF_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * Checks whether PHP's JSON extension is available or not + */ + protected function check_json() + { + if (@extension_loaded('json')) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PHP_JSON_SUPPORT', 'PHP_JSON_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * Checks whether or not the XML PHP extension is available (Required by the text formatter) + */ + protected function check_xml() + { + if (class_exists('DOMDocument')) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PHP_XML_SUPPORT', 'PHP_XML_SUPPORT_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * Check if any supported DBMS is available + */ + protected function check_available_dbms() + { + $available_dbms = $this->database_helper->get_available_dbms(false, true); + + if ($available_dbms['ANY_DB_SUPPORT']) + { + $this->set_test_passed(true); + return; + } + + $this->response_helper->add_error_message('PHP_SUPPORTED_DB', 'PHP_SUPPORTED_DB_EXPLAIN'); + + $this->set_test_passed(false); + } + + /** + * {@inheritdoc} + */ + static public function get_step_count() + { + return 0; + } + + /** + * {@inheritdoc} + */ + public function get_task_lang_name() + { + return ''; + } +} diff --git a/install/update/old/phpbb/install/module_base.php b/install/update/old/phpbb/install/module_base.php new file mode 100644 index 0000000..93c10bd --- /dev/null +++ b/install/update/old/phpbb/install/module_base.php @@ -0,0 +1,213 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\install; + +use phpbb\di\ordered_service_collection; +use phpbb\install\exception\resource_limit_reached_exception; +use phpbb\install\helper\config; +use phpbb\install\helper\iohandler\iohandler_interface; + +/** + * Base class for installer module + */ +abstract class module_base implements module_interface +{ + /** + * @var config + */ + protected $install_config; + + /** + * @var iohandler_interface + */ + protected $iohandler; + + /** + * @var bool + */ + protected $is_essential; + + /** + * Array of tasks for installer module + * + * @var ordered_service_collection + */ + protected $task_collection; + + /** + * @var array + */ + protected $task_step_count; + + /** + * @var bool + */ + protected $allow_progress_bar; + + /** + * Installer module constructor + * + * @param ordered_service_collection $tasks array of installer tasks for installer module + * @param bool $essential flag indicating whether the module is essential or not + * @param bool $allow_progress_bar flag indicating whether or not to send progress information from within the module + */ + public function __construct(ordered_service_collection $tasks, $essential = true, $allow_progress_bar = true) + { + $this->task_collection = $tasks; + $this->is_essential = $essential; + $this->allow_progress_bar = $allow_progress_bar; + } + + /** + * Dependency getter + * + * @param config $config + * @param iohandler_interface $iohandler + */ + public function setup(config $config, iohandler_interface $iohandler) + { + $this->install_config = $config; + $this->iohandler = $iohandler; + } + + /** + * {@inheritdoc} + */ + public function is_essential() + { + return $this->is_essential; + } + + /** + * {@inheritdoc} + * + * Overwrite this method if your task is non-essential! + */ + public function check_requirements() + { + return true; + } + + /** + * {@inheritdoc} + */ + public function run() + { + // Recover install progress + $task_index = $this->recover_progress(); + $iterator = $this->task_collection->getIterator(); + + if ($task_index < $iterator->count()) + { + $iterator->seek($task_index); + } + else + { + $this->install_config->set_finished_task(0); + return; + } + + while ($iterator->valid()) + { + $task = $iterator->current(); + $name = $iterator->key(); + + // Check if we can run the task + if (!$task->is_essential() && !$task->check_requirements()) + { + $this->iohandler->add_log_message(array( + 'SKIP_TASK', + $name, + )); + + $this->install_config->increment_current_task_progress($this->task_step_count[$name]); + } + else + { + // Send progress information + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + + $this->iohandler->send_response(); + } + + $task->run(); + + if ($this->allow_progress_bar) + { + // Only increment progress by one, as if a task has more than one steps + // then that should be incremented in the task itself + $this->install_config->increment_current_task_progress(); + } + } + + $task_index++; + $this->install_config->set_finished_task($task_index); + $iterator->next(); + + // Send progress information + if ($this->allow_progress_bar) + { + $this->iohandler->set_progress( + $task->get_task_lang_name(), + $this->install_config->get_current_task_progress() + ); + } + + $this->iohandler->send_response(); + + // Stop execution if resource limit is reached + if ($iterator->valid() && ($this->install_config->get_time_remaining() <= 0 || $this->install_config->get_memory_remaining() <= 0)) + { + throw new resource_limit_reached_exception(); + } + } + + // Module finished, so clear task progress + $this->install_config->set_finished_task(0); + } + + /** + * Returns the next task's name + * + * @return string Index of the array element of the next task + */ + protected function recover_progress() + { + $progress_array = $this->install_config->get_progress_data(); + return $progress_array['last_task_index']; + } + + /** + * {@inheritdoc} + */ + public function get_step_count() + { + $task_step_count = 0; + $task_class_names = $this->task_collection->get_service_classes(); + + foreach ($task_class_names as $name => $task_class) + { + $step_count = $task_class::get_step_count(); + $task_step_count += $step_count; + $this->task_step_count[$name] = $step_count; + } + + return $task_step_count; + } +} diff --git a/install/update/old/phpbb/language/language_file_loader.php b/install/update/old/phpbb/language/language_file_loader.php new file mode 100644 index 0000000..b6816af --- /dev/null +++ b/install/update/old/phpbb/language/language_file_loader.php @@ -0,0 +1,206 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\language; + +use \phpbb\language\exception\language_file_not_found; + +/** + * Language file loader + */ +class language_file_loader +{ + /** + * @var string Path to phpBB's root + */ + protected $phpbb_root_path; + + /** + * @var string Extension of PHP files + */ + protected $php_ext; + + /** + * @var \phpbb\extension\manager Extension manager + */ + protected $extension_manager; + + /** + * Constructor + * + * @param string $phpbb_root_path Path to phpBB's root + * @param string $php_ext Extension of PHP files + */ + public function __construct($phpbb_root_path, $php_ext) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->extension_manager = null; + } + + /** + * Extension manager setter + * + * @param \phpbb\extension\manager $extension_manager Extension manager + */ + public function set_extension_manager(\phpbb\extension\manager $extension_manager) + { + $this->extension_manager = $extension_manager; + } + + /** + * Loads language array for the given component + * + * @param string $component Name of the language component + * @param string|array $locale ISO code of the language to load, or array of ISO codes if you want to + * specify additional language fallback steps + * @param array $lang Array reference containing language strings + */ + public function load($component, $locale, &$lang) + { + $locale = (array) $locale; + + // Determine path to language directory + $path = $this->phpbb_root_path . 'language/'; + + $this->load_file($path, $component, $locale, $lang); + } + + /** + * Loads language array for the given extension component + * + * @param string $extension Name of the extension + * @param string $component Name of the language component + * @param string|array $locale ISO code of the language to load, or array of ISO codes if you want to + * specify additional language fallback steps + * @param array $lang Array reference containing language strings + */ + public function load_extension($extension, $component, $locale, &$lang) + { + // Check if extension manager was loaded + if ($this->extension_manager === null) + { + // If not, let's return + return; + } + + $locale = (array) $locale; + + // Determine path to language directory + $path = $this->extension_manager->get_extension_path($extension, true) . 'language/'; + + $this->load_file($path, $component, $locale, $lang); + } + + /** + * Prepares language file loading + * + * @param string $path Path to search for file in + * @param string $component Name of the language component + * @param array $locale Array containing language fallback options + * @param array $lang Array reference of language strings + */ + protected function load_file($path, $component, $locale, &$lang) + { + // This is BC stuff and not the best idea as it makes language fallback + // implementation quite hard like below. + if (strpos($this->phpbb_root_path . $component, $path) === 0) + { + // Filter out the path + $path_diff = str_replace($path, '', dirname($this->phpbb_root_path . $component)); + $language_file = basename($component, '.' . $this->php_ext); + $component = ''; + + // This step is needed to resolve language/en/subdir style $component + // $path already points to the language base directory so we need to eliminate + // the first directory from the path (that should be the language directory) + $path_diff_parts = explode('/', $path_diff); + + if (count($path_diff_parts) > 1) + { + array_shift($path_diff_parts); + $component = implode('/', $path_diff_parts) . '/'; + } + + $component .= $language_file; + } + + // Determine filename + $filename = $component . '.' . $this->php_ext; + + // Determine path to file + $file_path = $this->get_language_file_path($path, $filename, $locale); + + // Load language array + $this->load_language_file($file_path, $lang); + } + + /** + * This function implements language fallback logic + * + * @param string $path Path to language directory + * @param string $filename Filename to load language strings from + * + * @return string Relative path to language file + * + * @throws language_file_not_found When the path to the file cannot be resolved + */ + protected function get_language_file_path($path, $filename, $locales) + { + $language_file_path = $filename; + + // Language fallback logic + foreach ($locales as $locale) + { + $language_file_path = $path . $locale . '/' . $filename; + + // If we are in install, try to use the updated version, when available + if (defined('IN_INSTALL')) + { + $install_language_path = str_replace('language/', 'install/update/new/language/', $language_file_path); + if (file_exists($install_language_path)) + { + return $install_language_path; + } + } + + if (file_exists($language_file_path)) + { + return $language_file_path; + } + } + + // The language file is not exist + throw new language_file_not_found('Language file ' . $language_file_path . ' couldn\'t be opened.'); + } + + /** + * Loads language file + * + * @param string $path Path to language file to load + * @param array $lang Reference of the array of language strings + */ + protected function load_language_file($path, &$lang) + { + // Do not suppress error if in DEBUG mode + if (defined('DEBUG')) + { + include $path; + } + else + { + @include $path; + } + } +} diff --git a/install/update/old/phpbb/lock/db.php b/install/update/old/phpbb/lock/db.php new file mode 100644 index 0000000..85ba9a7 --- /dev/null +++ b/install/update/old/phpbb/lock/db.php @@ -0,0 +1,146 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\lock; + +/** +* Database locking class +*/ +class db +{ + /** + * Name of the config variable this lock uses + * @var string + */ + private $config_name; + + /** + * Unique identifier for this lock. + * + * @var string + */ + private $unique_id; + + /** + * Stores the state of this lock + * @var bool + */ + private $locked; + + /** + * The phpBB configuration + * @var \phpbb\config\config + */ + private $config; + + /** + * A database connection + * @var \phpbb\db\driver\driver_interface + */ + private $db; + + /** + * Creates a named released instance of the lock. + * + * You have to call acquire() to actually create the lock. + * + * @param string $config_name A config variable to be used for locking + * @param \phpbb\config\config $config The phpBB configuration + * @param \phpbb\db\driver\driver_interface $db A database connection + */ + public function __construct($config_name, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db) + { + $this->config_name = $config_name; + $this->config = $config; + $this->db = $db; + } + + /** + * Tries to acquire the lock by updating + * the configuration variable in the database. + * + * As a lock may only be held by one process at a time, lock + * acquisition may fail if another process is holding the lock + * or if another process obtained the lock but never released it. + * Locks are forcibly released after a timeout of 1 hour. + * + * @return bool true if lock was acquired + * false otherwise + */ + public function acquire() + { + if ($this->locked) + { + return false; + } + + if (!isset($this->config[$this->config_name])) + { + $this->config->set($this->config_name, '0', false); + } + $lock_value = $this->config[$this->config_name]; + + // make sure lock cannot be acquired by multiple processes + if ($lock_value) + { + // if the other process is running more than an hour already we have to assume it + // aborted without cleaning the lock + $time = explode(' ', $lock_value); + $time = $time[0]; + + if ($time + 3600 >= time()) + { + return false; + } + } + + $this->unique_id = time() . ' ' . unique_id(); + + // try to update the config value, if it was already modified by another + // process we failed to acquire the lock. + $this->locked = $this->config->set_atomic($this->config_name, $lock_value, $this->unique_id, false); + + return $this->locked; + } + + /** + * Does this process own the lock? + * + * @return bool true if lock is owned + * false otherwise + */ + public function owns_lock() + { + return (bool) $this->locked; + } + + /** + * Releases the lock. + * + * The lock must have been previously obtained, that is, acquire() call + * was issued and returned true. + * + * Note: Attempting to release a lock that is already released, + * that is, calling release() multiple times, is harmless. + * + * @return null + */ + public function release() + { + if ($this->locked) + { + $this->config->set_atomic($this->config_name, $this->unique_id, '0', false); + $this->locked = false; + } + } +} diff --git a/install/update/old/phpbb/lock/flock.php b/install/update/old/phpbb/lock/flock.php new file mode 100644 index 0000000..df88e14 --- /dev/null +++ b/install/update/old/phpbb/lock/flock.php @@ -0,0 +1,141 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\lock; + +/** +* File locking class +*/ +class flock +{ + /** + * Path to the file to which access is controlled + * + * @var string + */ + private $path; + + /** + * File pointer for the lock file + * @var string + */ + private $lock_fp; + + /** + * Constructor. + * + * You have to call acquire() to actually acquire the lock. + * + * @param string $path Path to the file to which access is controlled + */ + public function __construct($path) + { + $this->path = $path; + $this->lock_fp = null; + } + + /** + * Tries to acquire the lock. + * + * If the lock is already held by another process, this call will block + * until the other process releases the lock. If a lock is acquired and + * is not released before script finishes but the process continues to + * live (apache/fastcgi) then subsequent processes trying to acquire + * the same lock will be blocked forever. + * + * If the lock is already held by the same process via another instance + * of this class, this call will block forever. + * + * If flock function is disabled in php or fails to work, lock + * acquisition will fail and false will be returned. + * + * @return bool true if lock was acquired + * false otherwise + */ + public function acquire() + { + if ($this->lock_fp) + { + return false; + } + + // For systems that can't have two processes opening + // one file for writing simultaneously + if (file_exists($this->path . '.lock')) + { + $mode = 'rb'; + } + else + { + $mode = 'wb'; + } + + $this->lock_fp = @fopen($this->path . '.lock', $mode); + + if ($mode == 'wb') + { + if (!$this->lock_fp) + { + // Two processes may attempt to create lock file at the same time. + // Have the losing process try opening the lock file again for reading + // on the assumption that the winning process created it + $mode = 'rb'; + $this->lock_fp = @fopen($this->path . '.lock', $mode); + } + else + { + // Only need to set mode when the lock file is written + @chmod($this->path . '.lock', 0666); + } + } + + if ($this->lock_fp) + { + @flock($this->lock_fp, LOCK_EX); + } + + return (bool) $this->lock_fp; + } + + /** + * Does this process own the lock? + * + * @return bool true if lock is owned + * false otherwise + */ + public function owns_lock() + { + return (bool) $this->lock_fp; + } + + /** + * Releases the lock. + * + * The lock must have been previously obtained, that is, acquire() call + * was issued and returned true. + * + * Note: Attempting to release a lock that is already released, + * that is, calling release() multiple times, is harmless. + * + * @return null + */ + public function release() + { + if ($this->lock_fp) + { + @flock($this->lock_fp, LOCK_UN); + fclose($this->lock_fp); + $this->lock_fp = null; + } + } +} diff --git a/install/update/old/phpbb/message/form.php b/install/update/old/phpbb/message/form.php new file mode 100644 index 0000000..63bada9 --- /dev/null +++ b/install/update/old/phpbb/message/form.php @@ -0,0 +1,175 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\message; + +/** +* Abstract class form +*/ +abstract class form +{ + /** @var \phpbb\auth\auth */ + protected $auth; + /** @var \phpbb\config\config */ + protected $config; + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + /** @var \phpbb\message\message */ + protected $message; + /** @var \phpbb\user */ + protected $user; + + /** @var string */ + protected $phpbb_root_path; + /** @var string */ + protected $phpEx; + + /** @var array */ + protected $errors = array(); + /** @var bool */ + protected $cc_sender; + /** @var string */ + protected $body; + + /** + * Construct + * + * @param \phpbb\auth\auth $auth + * @param \phpbb\config\config $config + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\user $user + * @param string $phpbb_root_path + * @param string $phpEx + */ + public function __construct(\phpbb\auth\auth $auth, \phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, \phpbb\user $user, $phpbb_root_path, $phpEx) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->phpEx = $phpEx; + $this->user = $user; + $this->auth = $auth; + $this->config = $config; + $this->db = $db; + + $this->message = new message($config['server_name']); + $this->message->set_sender_from_user($this->user); + } + + /** + * Returns the title for the email form page + * + * @return string + */ + public function get_page_title() + { + return $this->user->lang['SEND_EMAIL']; + } + + /** + * Returns the file name of the form template + * + * @return string + */ + public function get_template_file() + { + return 'memberlist_email.html'; + } + + /** + * Checks whether the user is allowed to use the form + * + * @return false|string Error string if not allowed, false otherwise + */ + public function check_allow() + { + if (!$this->config['email_enable']) + { + return 'EMAIL_DISABLED'; + } + + if (time() - $this->user->data['user_emailtime'] < $this->config['flood_interval']) + { + return 'FLOOD_EMAIL_LIMIT'; + } + + return false; + } + + /** + * Get the return link after the message has been sent + * + * @return string + */ + public function get_return_message() + { + return sprintf($this->user->lang['RETURN_INDEX'], '', ''); + } + + /** + * Bind the values of the request to the form + * + * @param \phpbb\request\request_interface $request + * @return null + */ + public function bind(\phpbb\request\request_interface $request) + { + $this->cc_sender = $request->is_set_post('cc_sender'); + $this->body = $request->variable('message', '', true); + } + + /** + * Submit form, generate the email and send it + * + * @param \messenger $messenger + * @return null + */ + public function submit(\messenger $messenger) + { + if (!check_form_key('memberlist_email')) + { + $this->errors[] = 'FORM_INVALID'; + } + + if (!count($this->errors)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_emailtime = ' . time() . ' + WHERE user_id = ' . $this->user->data['user_id']; + $this->db->sql_query($sql); + + if ($this->cc_sender && $this->user->data['is_registered']) + { + $this->message->cc_sender(); + } + + $this->message->send($messenger, phpbb_get_board_contact($this->config, $this->phpEx)); + + meta_refresh(3, append_sid($this->phpbb_root_path . 'index.' . $this->phpEx)); + trigger_error($this->user->lang['EMAIL_SENT'] . '

' . $this->get_return_message()); + } + } + + /** + * Render the template of the form + * + * @param \phpbb\template\template $template + * @return null + */ + public function render(\phpbb\template\template $template) + { + add_form_key('memberlist_email'); + + $template->assign_vars(array( + 'ERROR_MESSAGE' => (count($this->errors)) ? implode('
', $this->errors) : '', + )); + } +} diff --git a/install/update/old/phpbb/mimetype/guesser.php b/install/update/old/phpbb/mimetype/guesser.php new file mode 100644 index 0000000..8baa770 --- /dev/null +++ b/install/update/old/phpbb/mimetype/guesser.php @@ -0,0 +1,156 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\mimetype; + +class guesser +{ + /** + * @const Default priority for mimetype guessers + */ + const PRIORITY_DEFAULT = 0; + + /** + * @var array guessers + */ + protected $guessers; + + /** + * Construct a mimetype guesser object + * + * @param array $mimetype_guessers Mimetype guesser service collection + */ + public function __construct($mimetype_guessers) + { + $this->register_guessers($mimetype_guessers); + } + + /** + * Register MimeTypeGuessers and sort them by priority + * + * @param array $mimetype_guessers Mimetype guesser service collection + * + * @throws \LogicException If incorrect or not mimetype guessers have + * been supplied to class + */ + protected function register_guessers($mimetype_guessers) + { + foreach ($mimetype_guessers as $guesser) + { + $is_supported = (method_exists($guesser, 'is_supported')) ? 'is_supported' : ''; + $is_supported = (method_exists($guesser, 'isSupported')) ? 'isSupported' : $is_supported; + + if (empty($is_supported)) + { + throw new \LogicException('Incorrect mimetype guesser supplied.'); + } + + if ($guesser->$is_supported()) + { + $this->guessers[] = $guesser; + } + } + + if (empty($this->guessers)) + { + throw new \LogicException('No mimetype guesser supplied.'); + } + + // Sort guessers by priority + usort($this->guessers, array($this, 'sort_priority')); + } + + /** + * Sort the priority of supplied guessers + * This is a compare function for usort. A guesser with higher priority + * should be used first and vice versa. usort() orders the array values + * from low to high depending on what the comparison function returns + * to it. Return value should be smaller than 0 if value a is smaller + * than value b. This has been reversed in the comparision function in + * order to sort the guessers from high to low. + * Method has been set to public in order to allow proper testing. + * + * @param object $guesser_a Mimetype guesser a + * @param object $guesser_b Mimetype guesser b + * + * @return int If both guessers have the same priority 0, bigger + * than 0 if first guesser has lower priority, and lower + * than 0 if first guesser has higher priority + */ + public function sort_priority($guesser_a, $guesser_b) + { + $priority_a = (int) (method_exists($guesser_a, 'get_priority')) ? $guesser_a->get_priority() : self::PRIORITY_DEFAULT; + $priority_b = (int) (method_exists($guesser_b, 'get_priority')) ? $guesser_b->get_priority() : self::PRIORITY_DEFAULT; + + return $priority_b - $priority_a; + } + + /** + * Guess mimetype of supplied file + * + * @param string $file Path to file + * @param string $file_name The real file name + * + * @return string Guess for mimetype of file + */ + public function guess($file, $file_name = '') + { + if (!is_file($file)) + { + return false; + } + + if (!is_readable($file)) + { + return false; + } + + $mimetype = 'application/octet-stream'; + + foreach ($this->guessers as $guesser) + { + $mimetype_guess = $guesser->guess($file, $file_name); + + $mimetype = $this->choose_mime_type($mimetype, $mimetype_guess); + } + // Return any mimetype if we got a result or the fallback value + return $mimetype; + } + + /** + * Choose the best mime type based on the current mime type and the guess + * If a guesser returns nulls or application/octet-stream, we will keep + * the current guess. Guesses with a slash inside them will be favored over + * already existing ones. However, any guess that will pass the first check + * will always overwrite the default application/octet-stream. + * + * @param string $mime_type The current mime type + * @param string $guess The current mime type guess + * + * @return string The best mime type based on current mime type and guess + */ + public function choose_mime_type($mime_type, $guess) + { + if ($guess === null || $guess == 'application/octet-stream') + { + return $mime_type; + } + + if ($mime_type == 'application/octet-stream' || strpos($guess, '/') !== false) + { + $mime_type = $guess; + } + + return $mime_type; + } +} diff --git a/install/update/old/phpbb/notification/type/approve_post.php b/install/update/old/phpbb/notification/type/approve_post.php new file mode 100644 index 0000000..e4b111e --- /dev/null +++ b/install/update/old/phpbb/notification/type/approve_post.php @@ -0,0 +1,149 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Post approved notifications class +* This class handles notifications for posts when they are approved (to their authors) +*/ + +class approve_post extends \phpbb\notification\type\post +{ + /** + * Get notification type name + * + * @return string + */ + public function get_type() + { + return 'notification.type.approve_post'; + } + + /** + * Language key used to output the text + * + * @var string + */ + protected $language_key = 'NOTIFICATION_POST_APPROVED'; + + /** + * Inherit notification read status from post. + * + * @var bool + */ + protected $inherit_read_status = false; + + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use it's default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + static public $notification_option = array( + 'id' => 'moderation_queue', + 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', + 'group' => 'NOTIFICATION_GROUP_POSTING', + ); + + /** + * Is available + */ + public function is_available() + { + return !$this->auth->acl_get('m_approve'); + } + + /** + * Find the users who want to receive notifications + * + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification + * + * @return array + */ + public function find_users_for_notification($post, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + ), $options); + + $users = array(); + $users[$post['poster_id']] = $this->notification_manager->get_default_methods(); + + return $this->get_authorised_recipients(array_keys($users), $post['forum_id'], array_merge($options, array( + 'item_type' => static::$notification_option['id'], + ))); + } + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $post Post data from submit_post + * @param array $notify_users Notify users list + * Formated from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($post, $notify_users) + { + // In the parent class, this is used to check if the post is already + // read by a user and marks the notification read if it was marked read. + // Returning an empty array in effect, forces it to be marked as unread + // (and also saves a query) + return array(); + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($post, $pre_create_data = array()) + { + $this->set_data('post_subject', $post['post_subject']); + + parent::create_insert_array($post, $pre_create_data); + + $this->notification_time = time(); + } + + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; + + return $data; + } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'post_approved'; + } + + /** + * {inheritDoc} + */ + public function get_redirect_url() + { + return $this->get_url(); + } +} diff --git a/install/update/old/phpbb/notification/type/approve_topic.php b/install/update/old/phpbb/notification/type/approve_topic.php new file mode 100644 index 0000000..f8a3fde --- /dev/null +++ b/install/update/old/phpbb/notification/type/approve_topic.php @@ -0,0 +1,140 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Topic approved notifications class +* This class handles notifications for topics when they are approved (for authors) +*/ + +class approve_topic extends \phpbb\notification\type\topic +{ + /** + * Get notification type name + * + * @return string + */ + public function get_type() + { + return 'notification.type.approve_topic'; + } + + /** + * Language key used to output the text + * + * @var string + */ + protected $language_key = 'NOTIFICATION_TOPIC_APPROVED'; + + /** + * Inherit notification read status from topic. + * + * @var bool + */ + protected $inherit_read_status = false; + + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use it's default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + static public $notification_option = array( + 'id' => 'moderation_queue', + 'lang' => 'NOTIFICATION_TYPE_MODERATION_QUEUE', + 'group' => 'NOTIFICATION_GROUP_POSTING', + ); + + /** + * Is available + */ + public function is_available() + { + return !$this->auth->acl_get('m_approve'); + } + + /** + * Find the users who want to receive notifications + * + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification + * + * @return array + */ + public function find_users_for_notification($post, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + ), $options); + + $users = array(); + $users[$post['poster_id']] = $this->notification_manager->get_default_methods(); + + return $this->get_authorised_recipients(array_keys($users), $post['forum_id'], array_merge($options, array( + 'item_type' => static::$notification_option['id'], + ))); + } + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $post Post data from submit_post + * @param array $notify_users Notify users list + * Formated from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($post, $notify_users) + { + // In the parent class, this is used to check if the post is already + // read by a user and marks the notification read if it was marked read. + // Returning an empty array in effect, forces it to be marked as unread + // (and also saves a query) + return array(); + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($post, $pre_create_data = array()) + { + + parent::create_insert_array($post, $pre_create_data); + + $this->notification_time = time(); + } + + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = parent::get_insert_array(); + $data['notification_time'] = $this->notification_time; + + return $data; + } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'topic_approved'; + } +} diff --git a/install/update/old/phpbb/notification/type/base.php b/install/update/old/phpbb/notification/type/base.php new file mode 100644 index 0000000..77ed7f2 --- /dev/null +++ b/install/update/old/phpbb/notification/type/base.php @@ -0,0 +1,577 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Base notifications class +*/ +abstract class base implements \phpbb\notification\type\type_interface +{ + /** @var \phpbb\notification\manager */ + protected $notification_manager; + + /** @var \phpbb\db\driver\driver_interface */ + protected $db; + + /** @var \phpbb\language\language */ + protected $language; + + /** @var \phpbb\user */ + protected $user; + + /** @var \phpbb\auth\auth */ + protected $auth; + + /** @var string */ + protected $phpbb_root_path; + + /** @var string */ + protected $php_ext; + + /** @var string */ + protected $user_notifications_table; + + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use its default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + static public $notification_option = false; + + /** + * The notification_type_id, set upon creation of the class + * This is the notification_type_id from the notification_types table + * + * @var int + */ + protected $notification_type_id; + + /** + * Identification data + * notification_type_id - ID of the item type (auto generated, from notification types table) + * item_id - ID of the item (e.g. post_id, msg_id) + * item_parent_id - Parent item id (ex: for topic => forum_id, for post => topic_id, etc) + * user_id + * notification_read + * notification_time + * notification_data (special serialized field that each notification type can use to store stuff) + * + * @var array $data Notification row from the database + * This must be private, all interaction should use __get(), __set(), get_data(), set_data() + */ + private $data = array(); + + /** + * Notification Type Base Constructor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\language\language $language + * @param \phpbb\user $user + * @param \phpbb\auth\auth $auth + * @param string $phpbb_root_path + * @param string $php_ext + * @param string $user_notifications_table + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\language\language $language, \phpbb\user $user, \phpbb\auth\auth $auth, $phpbb_root_path, $php_ext, $user_notifications_table) + { + $this->db = $db; + $this->language = $language; + $this->user = $user; + $this->auth = $auth; + + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->user_notifications_table = $user_notifications_table; + } + + /** + * Set notification manager (required) + * + * @param \phpbb\notification\manager $notification_manager + */ + public function set_notification_manager(\phpbb\notification\manager $notification_manager) + { + $this->notification_manager = $notification_manager; + + $this->notification_type_id = $this->notification_manager->get_notification_type_id($this->get_type()); + } + + /** + * Set initial data from the database + * + * @param array $data Row directly from the database + */ + public function set_initial_data($data = array()) + { + // The row from the database (unless this is a new notification we're going to add) + $this->data = $data; + $this->data['notification_data'] = (isset($this->data['notification_data'])) ? unserialize($this->data['notification_data']) : array(); + } + + /** + * Magic method to get data from this notification + * + * @param mixed $name + * @return mixed + */ + public function __get($name) + { + return (!isset($this->data[$name])) ? null : $this->data[$name]; + } + + + /** + * Magic method to set data on this notification + * + * @param mixed $name + * @param mixed $value + * + * @return null + */ + public function __set($name, $value) + { + $this->data[$name] = $value; + } + + + /** + * Magic method to get a string of this notification + * + * Primarily for testing + * + * @return mixed + */ + public function __toString() + { + return (!empty($this->data)) ? var_export($this->data, true) : $this->get_type(); + } + + /** + * Get special data (only important for the classes that extend this) + * + * @param string $name Name of the variable to get + * @return mixed + */ + protected function get_data($name) + { + return ($name === false) ? $this->data['notification_data'] : ((isset($this->data['notification_data'][$name])) ? $this->data['notification_data'][$name] : null); + } + + /** + * Set special data (only important for the classes that extend this) + * + * @param string $name Name of the variable to set + * @param mixed $value Value to set to the variable + * @return mixed + */ + protected function set_data($name, $value) + { + $this->data['notification_data'][$name] = $value; + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($type_data, $pre_create_data = array()) + { + // Defaults + $this->data = array_merge(array( + 'item_id' => static::get_item_id($type_data), + 'notification_type_id' => $this->notification_type_id, + 'item_parent_id' => static::get_item_parent_id($type_data), + + 'notification_time' => time(), + 'notification_read' => false, + + 'notification_data' => array(), + ), $this->data); + } + + /** + * {@inheritdoc} + */ + public function get_insert_array() + { + $data = $this->data; + + $data['notification_data'] = serialize($data['notification_data']); + + return $data; + } + + /** + * Function for preparing the data for update in an SQL query + * (The service handles insertion) + * + * @param array $type_data Data unique to this notification type + * @return array Array of data ready to be updated in the database + */ + public function create_update_array($type_data) + { + $this->create_insert_array($type_data); + $data = $this->get_insert_array(); + + // Unset data unique to each row + unset( + $data['notification_time'], // Also unsetting time, since it always tries to change the time to current (if you actually need to change the time, over-ride this function) + $data['notification_id'], + $data['notification_read'], + $data['user_id'] + ); + + return $data; + } + + /** + * Mark this item read + * + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string|null If $return is False, nothing will be returned, else the sql code to update this item + */ + public function mark_read($return = false) + { + return $this->mark(false, $return); + } + + /** + * Mark this item unread + * + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string|null If $return is False, nothing will be returned, else the sql code to update this item + */ + public function mark_unread($return = false) + { + return $this->mark(true, $return); + } + + /** + * {inheritDoc} + */ + public function get_redirect_url() + { + return $this->get_url(); + } + + /** + * Prepare to output the notification to the template + * + * @return array Template variables + */ + public function prepare_for_display() + { + $mark_hash = generate_link_hash('mark_notification_read'); + + if ($this->get_url()) + { + $u_mark_read = append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id . '&hash=' . $mark_hash); + } + else + { + $redirect = (($this->user->page['page_dir']) ? $this->user->page['page_dir'] . '/' : '') . $this->user->page['page_name'] . (($this->user->page['query_string']) ? '?' . $this->user->page['query_string'] : ''); + + $u_mark_read = append_sid($this->phpbb_root_path . 'index.' . $this->php_ext, 'mark_notification=' . $this->notification_id . '&hash=' . $mark_hash . '&redirect=' . urlencode($redirect)); + } + + return array( + 'NOTIFICATION_ID' => $this->notification_id, + 'STYLING' => $this->get_style_class(), + 'AVATAR' => $this->get_avatar(), + 'FORMATTED_TITLE' => $this->get_title(), + 'REFERENCE' => $this->get_reference(), + 'FORUM' => $this->get_forum(), + 'REASON' => $this->get_reason(), + 'URL' => $this->get_url(), + 'TIME' => $this->user->format_date($this->notification_time), + 'UNREAD' => !$this->notification_read, + 'U_MARK_READ' => (!$this->notification_read) ? $u_mark_read : '', + ); + } + + /** + * -------------- Fall back functions ------------------- + */ + + /** + * URL to unsubscribe to this notification (fall back) + * + * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item + * @return false + */ + public function get_unsubscribe_url($method = false) + { + return false; + } + + /** + * Get the CSS style class of the notification (fall back) + * + * @return string + */ + public function get_style_class() + { + return ''; + } + + /** + * Get the user's avatar (fall back) + * + * @return string + */ + public function get_avatar() + { + return ''; + } + + /** + * Get the reference of the notifcation (fall back) + * + * @return string + */ + public function get_reference() + { + return ''; + } + + /** + * Get the forum of the notification reference (fall back) + * + * @return string + */ + public function get_forum() + { + return ''; + } + + /** + * Get the reason for the notifcation (fall back) + * + * @return string + */ + public function get_reason() + { + return ''; + } + + /** + * Get the special items to load (fall back) + * + * @return array + */ + public function get_load_special() + { + return array(); + } + + /** + * Load the special items (fall back) + * + * @param array $data + * @param array $notifications + */ + public function load_special($data, $notifications) + { + return; + } + + /** + * Is available (fall back) + * + * @return bool + */ + public function is_available() + { + return true; + } + + /** + * Pre create insert array function (fall back) + * + * @param array $type_data + * @param array $notify_users + * @return array + */ + public function pre_create_insert_array($type_data, $notify_users) + { + return array(); + } + + /** + * -------------- Helper functions ------------------- + */ + + /** + * Find the users who want to receive notifications (helper) + * + * @param array|bool $user_ids User IDs to check if they want to receive notifications + * (Bool False to check all users besides anonymous and bots (USER_IGNORE)) + * @param array $options + * @return array + */ + protected function check_user_notification_options($user_ids = false, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + 'item_type' => $this->get_type(), + 'item_id' => 0, // Global by default + ), $options); + + if ($user_ids === false) + { + $user_ids = array(); + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . ' + WHERE user_id <> ' . ANONYMOUS . ' + AND user_type <> ' . USER_IGNORE; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $user_ids[] = $row['user_id']; + } + $this->db->sql_freeresult($result); + } + + if (empty($user_ids)) + { + return array(); + } + + $rowset = $output = array(); + + $sql = 'SELECT user_id, method, notify + FROM ' . $this->user_notifications_table . ' + WHERE ' . $this->db->sql_in_set('user_id', $user_ids) . " + AND item_type = '" . $this->db->sql_escape($options['item_type']) . "' + AND item_id = " . (int) $options['item_id']; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + if (isset($options['ignore_users'][$row['user_id']]) && in_array($row['method'], $options['ignore_users'][$row['user_id']])) + { + continue; + } + + if (!isset($rowset[$row['user_id']])) + { + $rowset[$row['user_id']] = array(); + } + $rowset[$row['user_id']][$row['method']] = $row['notify']; + + if (!isset($output[$row['user_id']])) + { + $output[$row['user_id']] = array(); + } + if ($row['notify']) + { + $output[$row['user_id']][] = $row['method']; + } + } + + $this->db->sql_freeresult($result); + + $default_methods = $this->notification_manager->get_default_methods(); + + foreach ($user_ids as $user_id) + { + if (isset($options['ignore_users'][$user_id])) + { + continue; + } + if (!array_key_exists($user_id, $rowset)) + { + // No rows at all for this user, use the default methods + $output[$user_id] = $default_methods; + } + else + { + foreach ($default_methods as $default_method) + { + if (!array_key_exists($default_method, $rowset[$user_id])) + { + // No user preference for this type recorded, but it should be enabled by default. + $output[$user_id][] = $default_method; + } + } + } + } + + return $output; + } + + /** + * Mark this item read/unread helper + * + * @param bool $unread Unread (True/False) (Default: False) + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string|null If $return is False, nothing will be returned, else the sql code to update this item + */ + protected function mark($unread = true, $return = false) + { + $this->notification_read = (bool) !$unread; + + if ($return) + { + $where = array( + 'notification_type_id = ' . (int) $this->notification_type_id, + 'item_id = ' . (int) $this->item_id, + 'user_id = ' . (int) $this->user_id, + ); + + $where = implode(' AND ', $where); + return $where; + } + else + { + $this->notification_manager->mark_notifications($this->get_type(), (int) $this->item_id, (int) $this->user_id, false, $this->notification_read); + } + + return null; + } + + /** + * Get a list of users that are authorised to receive notifications + * + * @param array $users Array of users that have subscribed to a notification + * @param int $forum_id Forum ID of the forum + * @param array $options Array of notification options + * @param bool $sort Whether the users array should be sorted. Default: false + * @return array Array of users that are authorised recipients + */ + protected function get_authorised_recipients($users, $forum_id, $options, $sort = false) + { + if (empty($users)) + { + return array(); + } + + $users = array_unique($users); + + if ($sort) + { + sort($users); + } + + $auth_read = $this->auth->acl_get_list($users, 'f_read', $forum_id); + + if (empty($auth_read)) + { + return array(); + } + + return $this->check_user_notification_options($auth_read[$forum_id]['f_read'], $options); + } +} diff --git a/install/update/old/phpbb/notification/type/post.php b/install/update/old/phpbb/notification/type/post.php new file mode 100644 index 0000000..254f4c0 --- /dev/null +++ b/install/update/old/phpbb/notification/type/post.php @@ -0,0 +1,467 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Post notifications class +* This class handles notifications for replies to a topic +*/ + +class post extends \phpbb\notification\type\base +{ + /** + * Get notification type name + * + * @return string + */ + public function get_type() + { + return 'notification.type.post'; + } + + /** + * Language key used to output the text + * + * @var string + */ + protected $language_key = 'NOTIFICATION_POST'; + + /** + * Inherit notification read status from post. + * + * @var bool + */ + protected $inherit_read_status = true; + + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use it's default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + static public $notification_option = array( + 'lang' => 'NOTIFICATION_TYPE_POST', + 'group' => 'NOTIFICATION_GROUP_POSTING', + ); + + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var \phpbb\config\config */ + protected $config; + + public function set_config(\phpbb\config\config $config) + { + $this->config = $config; + } + + public function set_user_loader(\phpbb\user_loader $user_loader) + { + $this->user_loader = $user_loader; + } + + /** + * Is available + */ + public function is_available() + { + return $this->config['allow_topic_notify']; + } + + /** + * Get the id of the item + * + * @param array $post The data from the post + * @return int The post id + */ + static public function get_item_id($post) + { + return (int) $post['post_id']; + } + + /** + * Get the id of the parent + * + * @param array $post The data from the post + * @return int The topic id + */ + static public function get_item_parent_id($post) + { + return (int) $post['topic_id']; + } + + /** + * Find the users who want to receive notifications + * + * @param array $post Data from submit_post + * @param array $options Options for finding users for notification + * + * @return array + */ + public function find_users_for_notification($post, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + ), $options); + + $users = array(); + + $sql = 'SELECT user_id + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . (int) $post['topic_id'] . ' + AND notify_status = ' . NOTIFY_YES . ' + AND user_id <> ' . (int) $post['poster_id']; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $users[] = (int) $row['user_id']; + } + $this->db->sql_freeresult($result); + + $sql = 'SELECT user_id + FROM ' . FORUMS_WATCH_TABLE . ' + WHERE forum_id = ' . (int) $post['forum_id'] . ' + AND notify_status = ' . NOTIFY_YES . ' + AND user_id <> ' . (int) $post['poster_id']; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $users[] = (int) $row['user_id']; + } + $this->db->sql_freeresult($result); + + $notify_users = $this->get_authorised_recipients($users, $post['forum_id'], $options, true); + + if (empty($notify_users)) + { + return array(); + } + + // Try to find the users who already have been notified about replies and have not read the topic since and just update their notifications + $notified_users = $this->notification_manager->get_notified_users($this->get_type(), array( + 'item_parent_id' => static::get_item_parent_id($post), + 'read' => 0, + )); + + foreach ($notified_users as $user => $notification_data) + { + unset($notify_users[$user]); + + /** @var post $notification */ + $notification = $this->notification_manager->get_item_type_class($this->get_type(), $notification_data); + $update_responders = $notification->add_responders($post); + if (!empty($update_responders)) + { + $this->notification_manager->update_notification($notification, $update_responders, array( + 'item_parent_id' => self::get_item_parent_id($post), + 'read' => 0, + 'user_id' => $user, + )); + } + } + + return $notify_users; + } + + /** + * Get the user's avatar + */ + public function get_avatar() + { + return $this->user_loader->get_avatar($this->get_data('poster_id'), false, true); + } + + /** + * Get the HTML formatted title of this notification + * + * @return string + */ + public function get_title() + { + $responders = $this->get_data('responders'); + $usernames = array(); + + if (!is_array($responders)) + { + $responders = array(); + } + + $responders = array_merge(array(array( + 'poster_id' => $this->get_data('poster_id'), + 'username' => $this->get_data('post_username'), + )), $responders); + + $responders_cnt = count($responders); + $responders = $this->trim_user_ary($responders); + $trimmed_responders_cnt = $responders_cnt - count($responders); + + foreach ($responders as $responder) + { + if ($responder['username']) + { + $usernames[] = $responder['username']; + } + else + { + $usernames[] = $this->user_loader->get_username($responder['poster_id'], 'no_profile'); + } + } + + if ($trimmed_responders_cnt > 20) + { + $usernames[] = $this->language->lang('NOTIFICATION_MANY_OTHERS'); + } + else if ($trimmed_responders_cnt) + { + $usernames[] = $this->language->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt); + } + + return $this->language->lang( + $this->language_key, + phpbb_generate_string_list($usernames, $this->user), + $responders_cnt + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('topic_title')) + ); + } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'topic_notify'; + } + + /** + * Get email template variables + * + * @return array + */ + public function get_email_template_variables() + { + if ($this->get_data('post_username')) + { + $username = $this->get_data('post_username'); + } + else + { + $username = $this->user_loader->get_username($this->get_data('poster_id'), 'username'); + } + + return array( + 'AUTHOR_NAME' => htmlspecialchars_decode($username), + 'POST_SUBJECT' => htmlspecialchars_decode(censor_text($this->get_data('post_subject'))), + 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))), + + 'U_VIEW_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?p={$this->item_id}#p{$this->item_id}", + 'U_NEWEST_POST' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}&e=1&view=unread#unread", + 'U_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}", + 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?f={$this->get_data('forum_id')}&t={$this->item_parent_id}", + 'U_FORUM' => generate_board_url() . "/viewforum.{$this->php_ext}?f={$this->get_data('forum_id')}", + 'U_STOP_WATCHING_TOPIC' => generate_board_url() . "/viewtopic.{$this->php_ext}?uid={$this->user_id}&f={$this->get_data('forum_id')}&t={$this->item_parent_id}&unwatch=topic", + ); + } + + /** + * Get the url to this item + * + * @return string URL + */ + public function get_url() + { + return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "p={$this->item_id}#p{$this->item_id}"); + } + + /** + * {inheritDoc} + */ + public function get_redirect_url() + { + return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "t={$this->item_parent_id}&view=unread#unread"); + } + + /** + * Users needed to query before this notification can be displayed + * + * @return array Array of user_ids + */ + public function users_to_query() + { + $responders = $this->get_data('responders'); + $users = array( + $this->get_data('poster_id'), + ); + + if (is_array($responders)) + { + foreach ($responders as $responder) + { + $users[] = $responder['poster_id']; + } + } + + return $this->trim_user_ary($users); + } + + /** + * Trim the user array passed down to 3 users if the array contains + * more than 4 users. + * + * @param array $users Array of users + * @return array Trimmed array of user_ids + */ + public function trim_user_ary($users) + { + if (count($users) > 4) + { + array_splice($users, 3); + } + return $users; + } + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $post Post data from submit_post + * @param array $notify_users Notify users list + * Formated from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($post, $notify_users) + { + if (!count($notify_users) || !$this->inherit_read_status) + { + return array(); + } + + $tracking_data = array(); + $sql = 'SELECT user_id, mark_time FROM ' . TOPICS_TRACK_TABLE . ' + WHERE topic_id = ' . (int) $post['topic_id'] . ' + AND ' . $this->db->sql_in_set('user_id', array_keys($notify_users)); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $tracking_data[$row['user_id']] = $row['mark_time']; + } + $this->db->sql_freeresult($result); + + return $tracking_data; + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($post, $pre_create_data = array()) + { + $this->set_data('poster_id', $post['poster_id']); + + $this->set_data('topic_title', $post['topic_title']); + + $this->set_data('post_subject', $post['post_subject']); + + $this->set_data('post_username', (($post['poster_id'] == ANONYMOUS) ? $post['post_username'] : '')); + + $this->set_data('forum_id', $post['forum_id']); + + $this->set_data('forum_name', $post['forum_name']); + + $this->notification_time = $post['post_time']; + + // Topics can be "read" before they are public (while awaiting approval). + // Make sure that if the user has read the topic, it's marked as read in the notification + if ($this->inherit_read_status && isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time) + { + $this->notification_read = true; + } + + parent::create_insert_array($post, $pre_create_data); + } + + /** + * Add responders to the notification + * + * @param mixed $post + * @return array Array of responder data + */ + public function add_responders($post) + { + // Do not add them as a responder if they were the original poster that created the notification + if ($this->get_data('poster_id') == $post['poster_id']) + { + return array(); + } + + $responders = $this->get_data('responders'); + + $responders = ($responders === null) ? array() : $responders; + + // Do not add more than 25 responders, + // we trim the username list to "a, b, c and x others" anyway + // so there is no use to add all of them anyway. + if (count($responders) > 25) + { + return array(); + } + + foreach ($responders as $responder) + { + // Do not add them as a responder multiple times + if ($responder['poster_id'] == $post['poster_id']) + { + return array(); + } + } + + $responders[] = array( + 'poster_id' => $post['poster_id'], + 'username' => (($post['poster_id'] == ANONYMOUS) ? $post['post_username'] : ''), + ); + + $this->set_data('responders', $responders); + + $serialized_data = serialize($this->get_data(false)); + + // If the data is longer then 4000 characters, it would cause a SQL error. + // We don't add the username to the list if this is the case. + if (utf8_strlen($serialized_data) >= 4000) + { + return array(); + } + + $data_array = array_merge(array( + 'post_time' => $post['post_time'], + 'post_id' => $post['post_id'], + 'topic_id' => $post['topic_id'] + ), $this->get_data(false)); + + return $data_array; + } +} diff --git a/install/update/old/phpbb/notification/type/topic.php b/install/update/old/phpbb/notification/type/topic.php new file mode 100644 index 0000000..5c42afa --- /dev/null +++ b/install/update/old/phpbb/notification/type/topic.php @@ -0,0 +1,307 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Topic notifications class +* This class handles notifications for new topics +*/ + +class topic extends \phpbb\notification\type\base +{ + /** + * Get notification type name + * + * @return string + */ + public function get_type() + { + return 'notification.type.topic'; + } + + /** + * Language key used to output the text + * + * @var string + */ + protected $language_key = 'NOTIFICATION_TOPIC'; + + /** + * Inherit notification read status from topic. + * + * @var bool + */ + protected $inherit_read_status = true; + + /** + * Notification option data (for outputting to the user) + * + * @var bool|array False if the service should use it's default data + * Array of data (including keys 'id', 'lang', and 'group') + */ + static public $notification_option = array( + 'lang' => 'NOTIFICATION_TYPE_TOPIC', + 'group' => 'NOTIFICATION_GROUP_POSTING', + ); + + /** @var \phpbb\user_loader */ + protected $user_loader; + + /** @var \phpbb\config\config */ + protected $config; + + public function set_config(\phpbb\config\config $config) + { + $this->config = $config; + } + + public function set_user_loader(\phpbb\user_loader $user_loader) + { + $this->user_loader = $user_loader; + } + + /** + * Is available + */ + public function is_available() + { + return $this->config['allow_forum_notify']; + } + + /** + * Get the id of the item + * + * @param array $post The data from the post + * @return int The topic id + */ + static public function get_item_id($post) + { + return (int) $post['topic_id']; + } + + /** + * Get the id of the parent + * + * @param array $post The data from the post + * @return int The forum id + */ + static public function get_item_parent_id($post) + { + return (int) $post['forum_id']; + } + + /** + * Find the users who want to receive notifications + * + * @param array $topic Data from the topic + * @param array $options Options for finding users for notification + * + * @return array + */ + public function find_users_for_notification($topic, $options = array()) + { + $options = array_merge(array( + 'ignore_users' => array(), + ), $options); + + $users = array(); + + $sql = 'SELECT user_id + FROM ' . FORUMS_WATCH_TABLE . ' + WHERE forum_id = ' . (int) $topic['forum_id'] . ' + AND notify_status = ' . NOTIFY_YES . ' + AND user_id <> ' . (int) $topic['poster_id']; + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $users[] = (int) $row['user_id']; + } + $this->db->sql_freeresult($result); + + return $this->get_authorised_recipients($users, $topic['forum_id'], $options); + } + + /** + * Get the user's avatar + */ + public function get_avatar() + { + return $this->user_loader->get_avatar($this->get_data('poster_id'), false, true); + } + + /** + * Get the HTML formatted title of this notification + * + * @return string + */ + public function get_title() + { + if ($this->get_data('post_username')) + { + $username = $this->get_data('post_username'); + } + else + { + $username = $this->user_loader->get_username($this->get_data('poster_id'), 'no_profile'); + } + + return $this->language->lang( + $this->language_key, + $username + ); + } + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference() + { + return $this->language->lang( + 'NOTIFICATION_REFERENCE', + censor_text($this->get_data('topic_title')) + ); + } + + /** + * Get the forum of the notification reference + * + * @return string + */ + public function get_forum() + { + return $this->language->lang( + 'NOTIFICATION_FORUM', + $this->get_data('forum_name') + ); + } + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template() + { + return 'newtopic_notify'; + } + + /** + * Get email template variables + * + * @return array + */ + public function get_email_template_variables() + { + $board_url = generate_board_url(); + + if ($this->get_data('post_username')) + { + $username = $this->get_data('post_username'); + } + else + { + $username = $this->user_loader->get_username($this->get_data('poster_id'), 'username'); + } + + return array( + 'AUTHOR_NAME' => htmlspecialchars_decode($username), + 'FORUM_NAME' => htmlspecialchars_decode($this->get_data('forum_name')), + 'TOPIC_TITLE' => htmlspecialchars_decode(censor_text($this->get_data('topic_title'))), + + 'U_TOPIC' => "{$board_url}/viewtopic.{$this->php_ext}?f={$this->item_parent_id}&t={$this->item_id}", + 'U_VIEW_TOPIC' => "{$board_url}/viewtopic.{$this->php_ext}?f={$this->item_parent_id}&t={$this->item_id}", + 'U_FORUM' => "{$board_url}/viewforum.{$this->php_ext}?f={$this->item_parent_id}", + 'U_STOP_WATCHING_FORUM' => "{$board_url}/viewforum.{$this->php_ext}?uid={$this->user_id}&f={$this->item_parent_id}&unwatch=forum", + ); + } + + /** + * Get the url to this item + * + * @return string URL + */ + public function get_url() + { + return append_sid($this->phpbb_root_path . 'viewtopic.' . $this->php_ext, "f={$this->item_parent_id}&t={$this->item_id}"); + } + + /** + * Users needed to query before this notification can be displayed + * + * @return array Array of user_ids + */ + public function users_to_query() + { + return array($this->get_data('poster_id')); + } + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $post Post data from submit_post + * @param array $notify_users Notify users list + * Formated from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($post, $notify_users) + { + if (!count($notify_users) || !$this->inherit_read_status) + { + return array(); + } + + $tracking_data = array(); + $sql = 'SELECT user_id, mark_time FROM ' . TOPICS_TRACK_TABLE . ' + WHERE topic_id = ' . (int) $post['topic_id'] . ' + AND ' . $this->db->sql_in_set('user_id', array_keys($notify_users)); + $result = $this->db->sql_query($sql); + while ($row = $this->db->sql_fetchrow($result)) + { + $tracking_data[$row['user_id']] = $row['mark_time']; + } + $this->db->sql_freeresult($result); + + return $tracking_data; + } + + /** + * {@inheritdoc} + */ + public function create_insert_array($post, $pre_create_data = array()) + { + $this->set_data('poster_id', $post['poster_id']); + + $this->set_data('topic_title', $post['topic_title']); + + $this->set_data('post_username', (($post['poster_id'] == ANONYMOUS) ? $post['post_username'] : '')); + + $this->set_data('forum_name', $post['forum_name']); + + $this->notification_time = $post['post_time']; + + // Topics can be "read" before they are public (while awaiting approval). + // Make sure that if the user has read the topic, it's marked as read in the notification + if ($this->inherit_read_status && isset($pre_create_data[$this->user_id]) && $pre_create_data[$this->user_id] >= $this->notification_time) + { + $this->notification_read = true; + } + + parent::create_insert_array($post, $pre_create_data); + } +} diff --git a/install/update/old/phpbb/notification/type/type_interface.php b/install/update/old/phpbb/notification/type/type_interface.php new file mode 100644 index 0000000..f9f832b --- /dev/null +++ b/install/update/old/phpbb/notification/type/type_interface.php @@ -0,0 +1,218 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\notification\type; + +/** +* Base notifications interface +*/ +interface type_interface +{ + /** + * Get notification type name + * + * @return string + */ + public function get_type(); + + /** + * Set initial data from the database + * + * @param array $data Row directly from the database + */ + public function set_initial_data($data); + + /** + * Get the id of the item + * + * @param array $type_data The type specific data + */ + static public function get_item_id($type_data); + + /** + * Get the id of the parent + * + * @param array $type_data The type specific data + */ + static public function get_item_parent_id($type_data); + + /** + * Is this type available to the current user (defines whether or not it will be shown in the UCP Edit notification options) + * + * @return bool True/False whether or not this is available to the user + */ + public function is_available(); + + /** + * Find the users who want to receive notifications + * + * @param array $type_data The type specific data + * @param array $options Options for finding users for notification + * ignore_users => array of users and user types that should not receive notifications from this type because they've already been notified + * e.g.: array(2 => array(''), 3 => array('', 'email'), ...) + * + * @return array + */ + public function find_users_for_notification($type_data, $options); + + /** + * Users needed to query before this notification can be displayed + * + * @return array Array of user_ids + */ + public function users_to_query(); + + /** + * Get the special items to load + * + * @return array Data will be combined sent to load_special() so you can run a single query and get data required for this notification type + */ + public function get_load_special(); + + /** + * Load the special items + * + * @param array $data Data from get_load_special() + * @param array $notifications Array of notifications (key is notification_id, value is the notification objects) + */ + public function load_special($data, $notifications); + + /** + * Get the CSS style class of the notification + * + * @return string + */ + public function get_style_class(); + + /** + * Get the HTML formatted title of this notification + * + * @return string + */ + public function get_title(); + + /** + * Get the HTML formatted reference of the notification + * + * @return string + */ + public function get_reference(); + + /** + * Get the forum of the notification reference + * + * @return string + */ + public function get_forum(); + + /** + * Get the url to this item + * + * @return string URL + */ + public function get_url(); + + /** + * Get the url to redirect after the item has been marked as read + * + * @return string URL + */ + public function get_redirect_url(); + + /** + * URL to unsubscribe to this notification + * + * @param string|bool $method Method name to unsubscribe from (email|jabber|etc), False to unsubscribe from all notifications for this item + */ + public function get_unsubscribe_url($method); + + /** + * Get the user's avatar (the user who caused the notification typically) + * + * @return string + */ + public function get_avatar(); + + /** + * Prepare to output the notification to the template + */ + public function prepare_for_display(); + + /** + * Get email template + * + * @return string|bool + */ + public function get_email_template(); + + /** + * Get email template variables + * + * @return array + */ + public function get_email_template_variables(); + + /** + * Pre create insert array function + * This allows you to perform certain actions, like run a query + * and load data, before create_insert_array() is run. The data + * returned from this function will be sent to create_insert_array(). + * + * @param array $type_data The type specific data + * @param array $notify_users Notify users list + * Formated from find_users_for_notification() + * @return array Whatever you want to send to create_insert_array(). + */ + public function pre_create_insert_array($type_data, $notify_users); + + /** + * Function for preparing the data for insertion in an SQL query + * + * @param array $type_data The type specific data + * @param array $pre_create_data Data from pre_create_insert_array() + */ + public function create_insert_array($type_data, $pre_create_data); + + /** + * Function for getting the data for insertion in an SQL query + * + * @return array Array of data ready to be inserted into the database + */ + public function get_insert_array(); + + /** + * Function for preparing the data for update in an SQL query + * (The service handles insertion) + * + * @param array $type_data Data unique to this notification type + * + * @return array Array of data ready to be updated in the database + */ + public function create_update_array($type_data); + + /** + * Mark this item read + * + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string + */ + public function mark_read($return = false); + + /** + * Mark this item unread + * + * @param bool $return True to return a string containing the SQL code to update this item, False to execute it (Default: False) + * @return string + */ + public function mark_unread($return = false); +} diff --git a/install/update/old/phpbb/passwords/manager.php b/install/update/old/phpbb/passwords/manager.php new file mode 100644 index 0000000..fad76a9 --- /dev/null +++ b/install/update/old/phpbb/passwords/manager.php @@ -0,0 +1,407 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\passwords; + +class manager +{ + /** + * Default hashing method + */ + protected $type = false; + + /** + * Hashing algorithm type map + * Will be used to map hash prefix to type + */ + protected $type_map = false; + + /** + * Service collection of hashing algorithms + * Needs to be public for passwords helper + */ + public $algorithms = false; + + /** + * Password convert flag. Signals that password should be converted + */ + public $convert_flag = false; + + /** + * Passwords helper + * @var \phpbb\passwords\helper + */ + protected $helper; + + /** + * phpBB configuration + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var bool Whether or not initialized() has been called + */ + private $initialized = false; + + /** + * @var array Hashing driver service collection + */ + private $hashing_algorithms; + + /** + * @var array List of default driver types + */ + private $defaults; + + /** + * Construct a passwords object + * + * @param \phpbb\config\config $config phpBB configuration + * @param array $hashing_algorithms Hashing driver service collection + * @param \phpbb\passwords\helper $helper Passwords helper object + * @param array $defaults List of default driver types + */ + public function __construct(\phpbb\config\config $config, $hashing_algorithms, helper $helper, $defaults) + { + $this->config = $config; + $this->helper = $helper; + $this->hashing_algorithms = $hashing_algorithms; + $this->defaults = $defaults; + } + + /** + * Initialize the internal state + */ + protected function initialize() + { + if (!$this->initialized) + { + $this->initialized = true; + $this->fill_type_map($this->hashing_algorithms); + $this->register_default_type($this->defaults); + } + } + + /** + * Register default type + * Will register the first supported type from the list of default types + * + * @param array $defaults List of default types in order from first to + * use to last to use + */ + protected function register_default_type($defaults) + { + foreach ($defaults as $type) + { + if ($this->algorithms[$type]->is_supported()) + { + $this->type = $this->algorithms[$type]->get_prefix(); + break; + } + } + } + + /** + * Fill algorithm type map + * + * @param \phpbb\di\service_collection $hashing_algorithms + */ + protected function fill_type_map($hashing_algorithms) + { + foreach ($hashing_algorithms as $algorithm) + { + if (!isset($this->type_map[$algorithm->get_prefix()])) + { + $this->type_map[$algorithm->get_prefix()] = $algorithm; + } + } + $this->algorithms = $hashing_algorithms; + } + + /** + * Get the algorithm specified by a specific prefix + * + * @param string $prefix Password hash prefix + * + * @return object|bool The hash type object or false if prefix is not + * supported + */ + protected function get_algorithm($prefix) + { + if (isset($this->type_map[$prefix])) + { + return $this->type_map[$prefix]; + } + else + { + return false; + } + } + + /** + * Detect the hash type of the supplied hash + * + * @param string $hash Password hash that should be checked + * + * @return object|bool The hash type object or false if the specified + * type is not supported + */ + public function detect_algorithm($hash) + { + /* + * preg_match() will also show hashing algos like $2a\H$, which + * is a combination of bcrypt and phpass. Legacy algorithms + * like md5 will not be matched by this and need to be treated + * differently. + */ + if (!preg_match('#^\$([a-zA-Z0-9\\\]*?)\$#', $hash, $match)) + { + return false; + } + + $this->initialize(); + + // Be on the lookout for multiple hashing algorithms + // 2 is correct: H\2a > 2, H\P > 2 + if (strlen($match[1]) > 2 && strpos($match[1], '\\') !== false) + { + $hash_types = explode('\\', $match[1]); + $return_ary = array(); + foreach ($hash_types as $type) + { + // we do not support the same hashing + // algorithm more than once + if (isset($return_ary[$type])) + { + return false; + } + + $return_ary[$type] = $this->get_algorithm('$' . $type . '$'); + + if (empty($return_ary[$type])) + { + return false; + } + } + return $return_ary; + } + + // get_algorithm() will automatically return false if prefix + // is not supported + return $this->get_algorithm($match[0]); + } + + /** + * Hash supplied password + * + * @param string $password Password that should be hashed + * @param string $type Hash type. Will default to standard hash type if + * none is supplied + * @return string|bool Password hash of supplied password or false if + * if something went wrong during hashing + */ + public function hash($password, $type = '') + { + if (strlen($password) > 4096) + { + // If the password is too huge, we will simply reject it + // and not let the server try to hash it. + return false; + } + + $this->initialize(); + + // Try to retrieve algorithm by service name if type doesn't + // start with dollar sign + if (!is_array($type) && strpos($type, '$') !== 0 && isset($this->algorithms[$type])) + { + $type = $this->algorithms[$type]->get_prefix(); + } + + $type = ($type === '') ? $this->type : $type; + + if (is_array($type)) + { + return $this->combined_hash_password($password, $type); + } + + if (isset($this->type_map[$type])) + { + $hashing_algorithm = $this->type_map[$type]; + } + else + { + return false; + } + + return $hashing_algorithm->hash($password); + } + + /** + * Check supplied password against hash and set convert_flag if password + * needs to be converted to different format (preferrably newer one) + * + * @param string $password Password that should be checked + * @param string $hash Stored hash + * @param array $user_row User's row in users table + * @return string|bool True if password is correct, false if not + */ + public function check($password, $hash, $user_row = array()) + { + if (strlen($password) > 4096) + { + // If the password is too huge, we will simply reject it + // and not let the server try to hash it. + return false; + } + + // Empty hashes can't be checked + if (empty($hash)) + { + return false; + } + + $this->initialize(); + + // First find out what kind of hash we're dealing with + $stored_hash_type = $this->detect_algorithm($hash); + if ($stored_hash_type == false) + { + // Still check MD5 hashes as that is what the installer + // will default to for the admin user + return $this->get_algorithm('$H$')->check($password, $hash); + } + + // Multiple hash passes needed + if (is_array($stored_hash_type)) + { + $correct = $this->check_combined_hash($password, $stored_hash_type, $hash); + $this->convert_flag = ($correct === true) ? true : false; + return $correct; + } + + if ($stored_hash_type->get_prefix() !== $this->type) + { + $this->convert_flag = true; + } + else + { + if ($stored_hash_type instanceof driver\rehashable_driver_interface) + { + $this->convert_flag = $stored_hash_type->needs_rehash($hash); + } + else + { + $this->convert_flag = false; + } + } + + // Check all legacy hash types if prefix is $CP$ + if ($stored_hash_type->get_prefix() === '$CP$') + { + // Remove $CP$ prefix for proper checking + $hash = substr($hash, 4); + + foreach ($this->type_map as $algorithm) + { + if ($algorithm->is_legacy() && $algorithm->check($password, $hash, $user_row) === true) + { + return true; + } + } + } + + return $stored_hash_type->check($password, $hash); + } + + /** + * Create combined hash from already hashed password + * + * @param string $password_hash Complete current password hash + * @param string $type Type of the hashing algorithm the password hash + * should be combined with + * @return string|bool Combined password hash if combined hashing was + * successful, else false + */ + public function combined_hash_password($password_hash, $type) + { + $this->initialize(); + + $data = array( + 'prefix' => '$', + 'settings' => '$', + ); + $hash_settings = $this->helper->get_combined_hash_settings($password_hash); + $hash = $hash_settings[0]; + + // Put settings of current hash into data array + $stored_hash_type = $this->detect_algorithm($password_hash); + $this->helper->combine_hash_output($data, 'prefix', $stored_hash_type->get_prefix()); + $this->helper->combine_hash_output($data, 'settings', $stored_hash_type->get_settings_only($password_hash)); + + // Hash current hash with the defined types + foreach ($type as $cur_type) + { + if (isset($this->algorithms[$cur_type])) + { + $new_hash_type = $this->algorithms[$cur_type]; + } + else + { + $new_hash_type = $this->get_algorithm($cur_type); + } + + if (!$new_hash_type) + { + return false; + } + + $new_hash = $new_hash_type->hash(str_replace($stored_hash_type->get_settings_only($password_hash), '', $hash)); + $this->helper->combine_hash_output($data, 'prefix', $new_hash_type->get_prefix()); + $this->helper->combine_hash_output($data, 'settings', substr(str_replace('$', '\\', $new_hash_type->get_settings_only($new_hash, true)), 0)); + $hash = str_replace($new_hash_type->get_settings_only($new_hash), '', $this->helper->obtain_hash_only($new_hash)); + } + return $this->helper->combine_hash_output($data, 'hash', $hash); + } + + /** + * Check combined password hash against the supplied password + * + * @param string $password Password entered by user + * @param array $stored_hash_type An array containing the hash types + * as described by stored password hash + * @param string $hash Stored password hash + * + * @return bool True if password is correct, false if not + */ + public function check_combined_hash($password, $stored_hash_type, $hash) + { + $i = 0; + $data = array( + 'prefix' => '$', + 'settings' => '$', + ); + $hash_settings = $this->helper->get_combined_hash_settings($hash); + foreach ($stored_hash_type as $key => $hash_type) + { + $rebuilt_hash = $this->helper->rebuild_hash($hash_type->get_prefix(), $hash_settings[$i]); + $this->helper->combine_hash_output($data, 'prefix', $key); + $this->helper->combine_hash_output($data, 'settings', $hash_settings[$i]); + $cur_hash = $hash_type->hash($password, $rebuilt_hash); + $password = str_replace($rebuilt_hash, '', $cur_hash); + $i++; + } + return ($hash === $this->helper->combine_hash_output($data, 'hash', $password)); + } +} diff --git a/install/update/old/phpbb/permissions.php b/install/update/old/phpbb/permissions.php new file mode 100644 index 0000000..7697884 --- /dev/null +++ b/install/update/old/phpbb/permissions.php @@ -0,0 +1,364 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +class permissions +{ + /** + * Event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher + * @param \phpbb\user $user User Object + */ + public function __construct(\phpbb\event\dispatcher_interface $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: + * '' => array( + * 'lang' => 'Language Key with a Short description', // Optional, if not set, + * // the permissions identifier '' 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.0-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: + * '' => array( + * 'lang' => 'Language Key with a Short description', // Optional, if not set, + * // the permissions identifier '' 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'; + } + + /** + * Checks if a category has been defined + * + * @param string $category Identifier of the category + * @return bool True if the category is defined, false otherwise + */ + public function category_defined($category) + { + return isset($this->categories[$category]); + } + + /** + * Checks if a permission has been defined + * + * @param string $permission Identifier of the permission + * @return bool True if the permission is defined, false otherwise + */ + public function permission_defined($permission) + { + return isset($this->permissions[$permission]); + } + + /** + * 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_list_topics' => array('lang' => 'ACL_F_LIST_TOPICS', '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_announce_global' => array('lang' => 'ACL_F_ANNOUNCE_GLOBAL', '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_softdelete' => array('lang' => 'ACL_F_SOFTDELETE', '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_info' => array('lang' => 'ACL_M_INFO', 'cat' => 'post_actions'), + 'm_softdelete' => array('lang' => 'ACL_M_SOFTDELETE', 'cat' => 'post_actions'), + + 'm_move' => array('lang' => 'ACL_M_MOVE', 'cat' => 'topic_actions'), + 'm_lock' => array('lang' => 'ACL_M_LOCK', 'cat' => 'topic_actions'), + 'm_split' => array('lang' => 'ACL_M_SPLIT', 'cat' => 'topic_actions'), + 'm_merge' => array('lang' => 'ACL_M_MERGE', 'cat' => 'topic_actions'), + + 'm_warn' => array('lang' => 'ACL_M_WARN', 'cat' => 'misc'), + 'm_pm_report' => array('lang' => 'ACL_M_PM_REPORT', '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/install/update/old/phpbb/plupload/plupload.php b/install/update/old/phpbb/plupload/plupload.php new file mode 100644 index 0000000..eb698fb --- /dev/null +++ b/install/update/old/phpbb/plupload/plupload.php @@ -0,0 +1,402 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\plupload; + +/** +* This class handles all server-side plupload functions +*/ +class plupload +{ + /** + * @var string + */ + protected $phpbb_root_path; + + /** + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var \phpbb\request\request_interface + */ + protected $request; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * @var \bantu\IniGetWrapper\IniGetWrapper + */ + protected $php_ini; + + /** + * @var \phpbb\mimetype\guesser + */ + protected $mimetype_guesser; + + /** + * Final destination for uploaded files, i.e. the "files" directory. + * @var string + */ + protected $upload_directory; + + /** + * Temporary upload directory for plupload uploads. + * @var string + */ + protected $temporary_directory; + + /** + * Constructor. + * + * @param string $phpbb_root_path + * @param \phpbb\config\config $config + * @param \phpbb\request\request_interface $request + * @param \phpbb\user $user + * @param \bantu\IniGetWrapper\IniGetWrapper $php_ini + * @param \phpbb\mimetype\guesser $mimetype_guesser + */ + public function __construct($phpbb_root_path, \phpbb\config\config $config, \phpbb\request\request_interface $request, \phpbb\user $user, \bantu\IniGetWrapper\IniGetWrapper $php_ini, \phpbb\mimetype\guesser $mimetype_guesser) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->config = $config; + $this->request = $request; + $this->user = $user; + $this->php_ini = $php_ini; + $this->mimetype_guesser = $mimetype_guesser; + + $this->set_default_directories(); + } + + /** + * Plupload allows for chunking so we must check for that and assemble + * the whole file first before performing any checks on it. + * + * @param string $form_name The name of the file element in the upload form + * + * @return array|null null if there are no chunks to piece together + * otherwise array containing the path to the + * pieced-together file and its size + */ + public function handle_upload($form_name) + { + $chunks_expected = $this->request->variable('chunks', 0); + + // If chunking is disabled or we are not using plupload, just return + // and handle the file as usual + if ($chunks_expected < 2) + { + return; + } + + $file_name = $this->request->variable('name', ''); + $chunk = $this->request->variable('chunk', 0); + + $this->user->add_lang('plupload'); + $this->prepare_temporary_directory(); + + $file_path = $this->temporary_filepath($file_name); + $this->integrate_uploaded_file($form_name, $chunk, $file_path); + + // If we are done with all the chunks, strip the .part suffix and then + // handle the resulting file as normal, otherwise die and await the + // next chunk. + if ($chunk == $chunks_expected - 1) + { + rename("{$file_path}.part", $file_path); + + // Reset upload directories to defaults once completed + $this->set_default_directories(); + + // Need to modify some of the $_FILES values to reflect the new file + return array( + 'tmp_name' => $file_path, + 'name' => $this->request->variable('real_filename', '', true), + 'size' => filesize($file_path), + 'type' => $this->mimetype_guesser->guess($file_path, $file_name), + ); + } + else + { + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'jsonrpc' => '2.0', + 'id' => 'id', + 'result' => null, + )); + } + } + + /** + * Fill in the plupload configuration options in the template + * + * @param \phpbb\cache\service $cache + * @param \phpbb\template\template $template + * @param string $s_action The URL to submit the POST data to + * @param int $forum_id The ID of the forum + * @param int $max_files Maximum number of files allowed. 0 for unlimited. + * + * @return null + */ + public function configure(\phpbb\cache\service $cache, \phpbb\template\template $template, $s_action, $forum_id, $max_files) + { + $filters = $this->generate_filter_string($cache, $forum_id); + $chunk_size = $this->get_chunk_size(); + $resize = $this->generate_resize_string(); + + $template->assign_vars(array( + 'S_RESIZE' => $resize, + 'S_PLUPLOAD' => true, + 'FILTERS' => $filters, + 'CHUNK_SIZE' => $chunk_size, + 'S_PLUPLOAD_URL' => htmlspecialchars_decode($s_action), + 'MAX_ATTACHMENTS' => $max_files, + 'ATTACH_ORDER' => ($this->config['display_order']) ? 'asc' : 'desc', + 'L_TOO_MANY_ATTACHMENTS' => $this->user->lang('TOO_MANY_ATTACHMENTS', $max_files), + )); + + $this->user->add_lang('plupload'); + } + + /** + * Checks whether the page request was sent by plupload or not + * + * @return bool + */ + public function is_active() + { + return $this->request->header('X-PHPBB-USING-PLUPLOAD', false); + } + + /** + * Returns whether the current HTTP request is a multipart request. + * + * @return bool + */ + public function is_multipart() + { + $content_type = $this->request->server('CONTENT_TYPE'); + + return strpos($content_type, 'multipart') === 0; + } + + /** + * Sends an error message back to the client via JSON response + * + * @param int $code The error code + * @param string $msg The translation string of the message to be sent + * + * @return null + */ + public function emit_error($code, $msg) + { + $json_response = new \phpbb\json_response(); + $json_response->send(array( + 'jsonrpc' => '2.0', + 'id' => 'id', + 'error' => array( + 'code' => $code, + 'message' => $this->user->lang($msg), + ), + )); + } + + /** + * Looks at the list of allowed extensions and generates a string + * appropriate for use in configuring plupload with + * + * @param \phpbb\cache\service $cache + * @param string $forum_id The ID of the forum + * + * @return string + */ + public function generate_filter_string(\phpbb\cache\service $cache, $forum_id) + { + $attach_extensions = $cache->obtain_attach_extensions($forum_id); + unset($attach_extensions['_allowed_']); + $groups = array(); + + // Re-arrange the extension array to $groups[$group_name][] + foreach ($attach_extensions as $extension => $extension_info) + { + if (!isset($groups[$extension_info['group_name']])) + { + $groups[$extension_info['group_name']] = array(); + } + + $groups[$extension_info['group_name']][] = $extension; + } + + $filters = array(); + foreach ($groups as $group => $extensions) + { + $filters[] = sprintf( + "{title: '%s', extensions: '%s'}", + addslashes(ucfirst(strtolower($group))), + addslashes(implode(',', $extensions)) + ); + } + + return implode(',', $filters); + } + + /** + * Generates a string that is used to tell plupload to automatically resize + * files before uploading them. + * + * @return string + */ + public function generate_resize_string() + { + $resize = ''; + if ($this->config['img_max_height'] > 0 && $this->config['img_max_width'] > 0) + { + $resize = sprintf( + 'resize: {width: %d, height: %d, quality: 85},', + (int) $this->config['img_max_width'], + (int) $this->config['img_max_height'] + ); + } + + return $resize; + } + + /** + * Checks various php.ini values and the maximum file size to determine + * the maximum size chunks a file can be split up into for upload + * + * @return int + */ + public function get_chunk_size() + { + $max = min( + $this->php_ini->getBytes('upload_max_filesize'), + $this->php_ini->getBytes('post_max_size'), + max(1, $this->php_ini->getBytes('memory_limit')), + $this->config['max_filesize'] + ); + + // Use half of the maximum possible to leave plenty of room for other + // POST data. + return floor($max / 2); + } + + protected function temporary_filepath($file_name) + { + // Must preserve the extension for plupload to work. + return sprintf( + '%s/%s_%s%s', + $this->temporary_directory, + $this->config['plupload_salt'], + md5($file_name), + \phpbb\files\filespec::get_extension($file_name) + ); + } + + /** + * Checks whether the chunk we are about to deal with was actually uploaded + * by PHP and actually exists, if not, it generates an error + * + * @param string $form_name The name of the file in the form data + * + * @return null + */ + protected function integrate_uploaded_file($form_name, $chunk, $file_path) + { + $is_multipart = $this->is_multipart(); + $upload = $this->request->file($form_name); + if ($is_multipart && (!isset($upload['tmp_name']) || !is_uploaded_file($upload['tmp_name']))) + { + $this->emit_error(103, 'PLUPLOAD_ERR_MOVE_UPLOADED'); + } + + $tmp_file = $this->temporary_filepath($upload['tmp_name']); + + if (!phpbb_is_writable($this->temporary_directory) || !move_uploaded_file($upload['tmp_name'], $tmp_file)) + { + $this->emit_error(103, 'PLUPLOAD_ERR_MOVE_UPLOADED'); + } + + $out = fopen("{$file_path}.part", $chunk == 0 ? 'wb' : 'ab'); + if (!$out) + { + $this->emit_error(102, 'PLUPLOAD_ERR_OUTPUT'); + } + + $in = fopen(($is_multipart) ? $tmp_file : 'php://input', 'rb'); + if (!$in) + { + $this->emit_error(101, 'PLUPLOAD_ERR_INPUT'); + } + + while ($buf = fread($in, 4096)) + { + fwrite($out, $buf); + } + + fclose($in); + fclose($out); + + if ($is_multipart) + { + unlink($tmp_file); + } + } + + /** + * Creates the temporary directory if it does not already exist. + * + * @return null + */ + protected function prepare_temporary_directory() + { + if (!file_exists($this->temporary_directory)) + { + mkdir($this->temporary_directory); + + copy( + $this->upload_directory . '/index.htm', + $this->temporary_directory . '/index.htm' + ); + } + } + + /** + * Sets the default directories for uploads + * + * @return null + */ + protected function set_default_directories() + { + $this->upload_directory = $this->phpbb_root_path . $this->config['upload_path']; + $this->temporary_directory = $this->upload_directory . '/plupload'; + } + + /** + * Sets the upload directories to the specified paths + * + * @param string $upload_directory Upload directory + * @param string $temporary_directory Temporary directory + * + * @return null + */ + public function set_upload_directories($upload_directory, $temporary_directory) + { + $this->upload_directory = $upload_directory; + $this->temporary_directory = $temporary_directory; + } +} diff --git a/install/update/old/phpbb/report/report_handler.php b/install/update/old/phpbb/report/report_handler.php new file mode 100644 index 0000000..854318c --- /dev/null +++ b/install/update/old/phpbb/report/report_handler.php @@ -0,0 +1,104 @@ + + * @license GNU General Public License, version 2 (GPL-2.0) + * + * For full copyright and license information, please see + * the docs/CREDITS.txt file. + * + */ + +namespace phpbb\report; + +abstract class report_handler implements report_handler_interface +{ + /** + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var \phpbb\auth\auth + */ + protected $auth; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * @var \phpbb\notification\manager + */ + protected $notifications; + + /** + * @var array + */ + protected $report_data; + + /** + * Construtor + * + * @param \phpbb\db\driver\driver_interface $db + * @param \phpbb\event\dispatcher_interface $dispatcher + * @param \phpbb\config\db $config + * @param \phpbb\auth\auth $auth + * @param \phpbb\user $user + * @param \phpbb\notification\manager $notification + */ + public function __construct(\phpbb\db\driver\driver_interface $db, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\auth\auth $auth, \phpbb\user $user, \phpbb\notification\manager $notification) + { + $this->db = $db; + $this->dispatcher = $dispatcher; + $this->config = $config; + $this->auth = $auth; + $this->user = $user; + $this->notifications = $notification; + $this->report_data = array(); + } + + /** + * Creates a report entity in the database + * + * @param array $report_data + * @return int the ID of the created entity + */ + protected function create_report(array $report_data) + { + $sql_ary = array( + 'reason_id' => (int) $report_data['reason_id'], + 'post_id' => $report_data['post_id'], + 'pm_id' => $report_data['pm_id'], + 'user_id' => (int) $this->user->data['user_id'], + 'user_notify' => (int) $report_data['user_notify'], + 'report_closed' => 0, + 'report_time' => (int) time(), + 'report_text' => (string) $report_data['report_text'], + 'reported_post_text' => $report_data['reported_post_text'], + 'reported_post_uid' => $report_data['reported_post_uid'], + 'reported_post_bitfield' => $report_data['reported_post_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'], + ); + + $sql = 'INSERT INTO ' . REPORTS_TABLE . ' ' . $this->db->sql_build_array('INSERT', $sql_ary); + $this->db->sql_query($sql); + + return $this->db->sql_nextid(); + } +} diff --git a/install/update/old/phpbb/request/request.php b/install/update/old/phpbb/request/request.php new file mode 100644 index 0000000..a0267d1 --- /dev/null +++ b/install/update/old/phpbb/request/request.php @@ -0,0 +1,454 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\request; + +/** +* All application input is accessed through this class. +* +* It provides a method to disable access to input data through super globals. +* This should force MOD authors to read about data validation. +*/ +class request implements \phpbb\request\request_interface +{ + /** + * @var array The names of super global variables that this class should protect if super globals are disabled. + */ + protected $super_globals = array( + \phpbb\request\request_interface::POST => '_POST', + \phpbb\request\request_interface::GET => '_GET', + \phpbb\request\request_interface::REQUEST => '_REQUEST', + \phpbb\request\request_interface::COOKIE => '_COOKIE', + \phpbb\request\request_interface::SERVER => '_SERVER', + \phpbb\request\request_interface::FILES => '_FILES', + ); + + /** + * @var array Stores original contents of $_REQUEST array. + */ + protected $original_request = null; + + /** + * @var + */ + protected $super_globals_disabled = false; + + /** + * @var array An associative array that has the value of super global constants as keys and holds their data as values. + */ + protected $input; + + /** + * @var \phpbb\request\type_cast_helper_interface An instance of a type cast helper providing convenience methods for type conversions. + */ + protected $type_cast_helper; + + /** + * Initialises the request class, that means it stores all input data in {@link $input input} + * and then calls {@link \phpbb\request\deactivated_super_global \phpbb\request\deactivated_super_global} + */ + public function __construct(\phpbb\request\type_cast_helper_interface $type_cast_helper = null, $disable_super_globals = true) + { + if ($type_cast_helper) + { + $this->type_cast_helper = $type_cast_helper; + } + else + { + $this->type_cast_helper = new \phpbb\request\type_cast_helper(); + } + + foreach ($this->super_globals as $const => $super_global) + { + $this->input[$const] = isset($GLOBALS[$super_global]) ? $GLOBALS[$super_global] : array(); + } + + // simulate request_order = GP + $this->original_request = $this->input[\phpbb\request\request_interface::REQUEST]; + $this->input[\phpbb\request\request_interface::REQUEST] = $this->input[\phpbb\request\request_interface::POST] + $this->input[\phpbb\request\request_interface::GET]; + + if ($disable_super_globals) + { + $this->disable_super_globals(); + } + } + + /** + * Getter for $super_globals_disabled + * + * @return bool Whether super globals are disabled or not. + */ + public function super_globals_disabled() + { + return $this->super_globals_disabled; + } + + /** + * Disables access of super globals specified in $super_globals. + * This is achieved by overwriting the super globals with instances of {@link \phpbb\request\deactivated_super_global \phpbb\request\deactivated_super_global} + */ + public function disable_super_globals() + { + if (!$this->super_globals_disabled) + { + foreach ($this->super_globals as $const => $super_global) + { + unset($GLOBALS[$super_global]); + $GLOBALS[$super_global] = new \phpbb\request\deactivated_super_global($this, $super_global, $const); + } + + $this->super_globals_disabled = true; + } + } + + /** + * Enables access of super globals specified in $super_globals if they were disabled by {@link disable_super_globals disable_super_globals}. + * This is achieved by making the super globals point to the data stored within this class in {@link $input input}. + */ + public function enable_super_globals() + { + if ($this->super_globals_disabled) + { + foreach ($this->super_globals as $const => $super_global) + { + $GLOBALS[$super_global] = $this->input[$const]; + } + + $GLOBALS['_REQUEST'] = $this->original_request; + + $this->super_globals_disabled = false; + } + } + + /** + * This function allows overwriting or setting a value in one of the super global arrays. + * + * Changes which are performed on the super globals directly will not have any effect on the results of + * other methods this class provides. Using this function should be avoided if possible! It will + * consume twice the the amount of memory of the value + * + * @param string $var_name The name of the variable that shall be overwritten + * @param mixed $value The value which the variable shall contain. + * If this is null the variable will be unset. + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global shall be changed + */ + public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST) + { + if (!isset($this->super_globals[$super_global])) + { + return; + } + + // setting to null means unsetting + if ($value === null) + { + unset($this->input[$super_global][$var_name]); + if (!$this->super_globals_disabled()) + { + unset($GLOBALS[$this->super_globals[$super_global]][$var_name]); + } + } + else + { + $this->input[$super_global][$var_name] = $value; + if (!$this->super_globals_disabled()) + { + $GLOBALS[$this->super_globals[$super_global]][$var_name] = $value; + } + } + } + + /** + * Central type safe input handling function. + * All variables in GET or POST requests should be retrieved through this function to maximise security. + * + * @param string|array $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST) + { + return $this->_variable($var_name, $default, $multibyte, $super_global, true); + } + + /** + * Get a variable, but without trimming strings. + * Same functionality as variable(), except does not run trim() on strings. + * This method should be used when handling passwords. + * + * @param string|array $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + public function untrimmed_variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST) + { + return $this->_variable($var_name, $default, $multibyte, $super_global, false); + } + + /** + * {@inheritdoc} + */ + public function raw_variable($var_name, $default, $super_global = \phpbb\request\request_interface::REQUEST) + { + $path = false; + + // deep direct access to multi dimensional arrays + if (is_array($var_name)) + { + $path = $var_name; + // make sure at least the variable name is specified + if (empty($path)) + { + return (is_array($default)) ? array() : $default; + } + // the variable name is the first element on the path + $var_name = array_shift($path); + } + + if (!isset($this->input[$super_global][$var_name])) + { + return (is_array($default)) ? array() : $default; + } + $var = $this->input[$super_global][$var_name]; + + if ($path) + { + // walk through the array structure and find the element we are looking for + foreach ($path as $key) + { + if (is_array($var) && isset($var[$key])) + { + $var = $var[$key]; + } + else + { + return (is_array($default)) ? array() : $default; + } + } + } + + return $var; + } + + /** + * Shortcut method to retrieve SERVER variables. + * + * Also fall back to getenv(), some CGI setups may need it (probably not, but + * whatever). + * + * @param string|array $var_name See \phpbb\request\request_interface::variable + * @param mixed $Default See \phpbb\request\request_interface::variable + * + * @return mixed The server variable value. + */ + public function server($var_name, $default = '') + { + $multibyte = true; + + if ($this->is_set($var_name, \phpbb\request\request_interface::SERVER)) + { + return $this->variable($var_name, $default, $multibyte, \phpbb\request\request_interface::SERVER); + } + else + { + $var = getenv($var_name); + $this->type_cast_helper->recursive_set_var($var, $default, $multibyte); + return $var; + } + } + + /** + * Shortcut method to retrieve the value of client HTTP headers. + * + * @param string|array $header_name The name of the header to retrieve. + * @param mixed $default See \phpbb\request\request_interface::variable + * + * @return mixed The header value. + */ + public function header($header_name, $default = '') + { + $var_name = 'HTTP_' . str_replace('-', '_', strtoupper($header_name)); + return $this->server($var_name, $default); + } + + /** + * Shortcut method to retrieve $_FILES variables + * + * @param string $form_name The name of the file input form element + * + * @return array The uploaded file's information or an empty array if the + * variable does not exist in _FILES. + */ + public function file($form_name) + { + return $this->variable($form_name, array('name' => 'none'), true, \phpbb\request\request_interface::FILES); + } + + /** + * Checks whether a certain variable was sent via POST. + * To make sure that a request was sent using POST you should call this function + * on at least one variable. + * + * @param string $name The name of the form variable which should have a + * _p suffix to indicate the check in the code that creates the form too. + * + * @return bool True if the variable was set in a POST request, false otherwise. + */ + public function is_set_post($name) + { + return $this->is_set($name, \phpbb\request\request_interface::POST); + } + + /** + * Checks whether a certain variable is set in one of the super global + * arrays. + * + * @param string $var Name of the variable + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies the super global which shall be checked + * + * @return bool True if the variable was sent as input + */ + public function is_set($var, $super_global = \phpbb\request\request_interface::REQUEST) + { + return isset($this->input[$super_global][$var]); + } + + /** + * Checks whether the current request is an AJAX request (XMLHttpRequest) + * + * @return bool True if the current request is an ajax request + */ + public function is_ajax() + { + return $this->header('X-Requested-With') == 'XMLHttpRequest'; + } + + /** + * Checks if the current request is happening over HTTPS. + * + * @return bool True if the request is secure. + */ + public function is_secure() + { + $https = $this->server('HTTPS'); + $https = $this->server('HTTP_X_FORWARDED_PROTO') === 'https' ? 'on' : $https; + return !empty($https) && $https !== 'off'; + } + + /** + * Returns all variable names for a given super global + * + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * The super global from which names shall be taken + * + * @return array All variable names that are set for the super global. + * Pay attention when using these, they are unsanitised! + */ + public function variable_names($super_global = \phpbb\request\request_interface::REQUEST) + { + if (!isset($this->input[$super_global])) + { + return array(); + } + + return array_keys($this->input[$super_global]); + } + + /** + * Helper function used by variable() and untrimmed_variable(). + * + * @param string|array $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * @param bool $trim Indicates whether trim() should be applied to string values. + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + protected function _variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST, $trim = true) + { + $var = $this->raw_variable($var_name, $default, $super_global); + + // Return prematurely if raw variable is empty array or the same as + // the default. Using strict comparison to ensure that one can't + // prevent proper type checking on any input variable + if ($var === array() || $var === $default) + { + return $var; + } + + $this->type_cast_helper->recursive_set_var($var, $default, $multibyte, $trim); + + return $var; + } + + /** + * {@inheritdoc} + */ + public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST) + { + return $this->input[$super_global]; + } + + /** + * {@inheritdoc} + */ + public function escape($var, $multibyte) + { + if (is_array($var)) + { + $result = array(); + foreach ($var as $key => $value) + { + $this->type_cast_helper->set_var($key, $key, gettype($key), $multibyte); + $result[$key] = $this->escape($value, $multibyte); + } + $var = $result; + } + else + { + $this->type_cast_helper->set_var($var, $var, 'string', $multibyte); + } + + return $var; + } +} diff --git a/install/update/old/phpbb/request/request_interface.php b/install/update/old/phpbb/request/request_interface.php new file mode 100644 index 0000000..3bfa8bb --- /dev/null +++ b/install/update/old/phpbb/request/request_interface.php @@ -0,0 +1,177 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\request; + +/** +* An interface through which all application input can be accessed. +*/ +interface request_interface +{ + /**#@+ + * Constant identifying the super global with the same name. + */ + const POST = 0; + const GET = 1; + const REQUEST = 2; + const COOKIE = 3; + const SERVER = 4; + const FILES = 5; + /**#@-*/ + + /** + * This function allows overwriting or setting a value in one of the super global arrays. + * + * Changes which are performed on the super globals directly will not have any effect on the results of + * other methods this class provides. Using this function should be avoided if possible! It will + * consume twice the the amount of memory of the value + * + * @param string $var_name The name of the variable that shall be overwritten + * @param mixed $value The value which the variable shall contain. + * If this is null the variable will be unset. + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global shall be changed + */ + public function overwrite($var_name, $value, $super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Central type safe input handling function. + * All variables in GET or POST requests should be retrieved through this function to maximise security. + * + * @param string|array $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param bool $multibyte If $default is a string this paramater has to be true if the variable may contain any UTF-8 characters + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + public function variable($var_name, $default, $multibyte = false, $super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Get a variable without trimming strings and without escaping. + * This method MUST NOT be used with queries. + * Same functionality as variable(), except does not run trim() on strings + * and does not escape input. + * This method should only be used when the raw input is needed without + * any escaping, i.e. for database password during the installation. + * + * @param string|array $var_name The form variable's name from which data shall be retrieved. + * If the value is an array this may be an array of indizes which will give + * direct access to a value at any depth. E.g. if the value of "var" is array(1 => "a") + * then specifying array("var", 1) as the name will return "a". + * @param mixed $default A default value that is returned if the variable was not set. + * This function will always return a value of the same type as the default. + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies which super global should be used + * + * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the + * the same as that of $default. If the variable is not set $default is returned. + */ + public function raw_variable($var_name, $default, $super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Shortcut method to retrieve SERVER variables. + * + * @param string|array $var_name See \phpbb\request\request_interface::variable + * @param mixed $default See \phpbb\request\request_interface::variable + * + * @return mixed The server variable value. + */ + public function server($var_name, $default = ''); + + /** + * Shortcut method to retrieve the value of client HTTP headers. + * + * @param string|array $header_name The name of the header to retrieve. + * @param mixed $default See \phpbb\request\request_interface::variable + * + * @return mixed The header value. + */ + public function header($var_name, $default = ''); + + /** + * Checks whether a certain variable was sent via POST. + * To make sure that a request was sent using POST you should call this function + * on at least one variable. + * + * @param string $name The name of the form variable which should have a + * _p suffix to indicate the check in the code that creates the form too. + * + * @return bool True if the variable was set in a POST request, false otherwise. + */ + public function is_set_post($name); + + /** + * Checks whether a certain variable is set in one of the super global + * arrays. + * + * @param string $var Name of the variable + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * Specifies the super global which shall be checked + * + * @return bool True if the variable was sent as input + */ + public function is_set($var, $super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Checks whether the current request is an AJAX request (XMLHttpRequest) + * + * @return bool True if the current request is an ajax request + */ + public function is_ajax(); + + /** + * Checks if the current request is happening over HTTPS. + * + * @return bool True if the request is secure. + */ + public function is_secure(); + + /** + * Returns all variable names for a given super global + * + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * The super global from which names shall be taken + * + * @return array All variable names that are set for the super global. + * Pay attention when using these, they are unsanitised! + */ + public function variable_names($super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Returns the original array of the requested super global + * + * @param \phpbb\request\request_interface::POST|GET|REQUEST|COOKIE $super_global + * The super global which will be returned + * + * @return array The original array of the requested super global. + */ + public function get_super_global($super_global = \phpbb\request\request_interface::REQUEST); + + /** + * Escape a string variable. + * + * @param mixed $value The contents to fill with + * @param bool $multibyte Indicates whether string values may contain UTF-8 characters. + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks. + * @return string|array + */ + public function escape($value, $multibyte); +} diff --git a/install/update/old/phpbb/request/type_cast_helper.php b/install/update/old/phpbb/request/type_cast_helper.php new file mode 100644 index 0000000..9124949 --- /dev/null +++ b/install/update/old/phpbb/request/type_cast_helper.php @@ -0,0 +1,124 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\request; + +/** +* A helper class that provides convenience methods for type casting. +*/ +class type_cast_helper implements \phpbb\request\type_cast_helper_interface +{ + /** + * Set variable $result to a particular type. + * + * @param mixed &$result The variable to fill + * @param mixed $var The contents to fill with + * @param mixed $type The variable type. Will be used with {@link settype()} + * @param bool $multibyte Indicates whether string values may contain UTF-8 characters. + * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks. + * @param bool $trim Indicates whether trim() should be applied to string values. + * Default is true. + */ + public function set_var(&$result, $var, $type, $multibyte = false, $trim = true) + { + settype($var, $type); + $result = $var; + + if ($type == 'string') + { + $result = str_replace(array("\r\n", "\r", "\0"), array("\n", "\n", ''), $result); + + if ($trim) + { + $result = trim($result); + } + + $result = htmlspecialchars($result, ENT_COMPAT, 'UTF-8'); + + if ($multibyte) + { + $result = utf8_normalize_nfc($result); + } + + if (!empty($result)) + { + // Make sure multibyte characters are wellformed + if ($multibyte) + { + if (!preg_match('/^./u', $result)) + { + $result = ''; + } + } + else + { + // no multibyte, allow only ASCII (0-127) + $result = preg_replace('/[\x80-\xFF]/', '?', $result); + } + } + } + } + + /** + * Recursively sets a variable to a given type using {@link set_var set_var} + * + * @param string $var The value which shall be sanitised (passed by reference). + * @param mixed $default Specifies the type $var shall have. + * If it is an array and $var is not one, then an empty array is returned. + * Otherwise var is cast to the same type, and if $default is an array all + * keys and values are cast recursively using this function too. + * @param bool $multibyte Indicates whether string keys and values may contain UTF-8 characters. + * Default is false, causing all bytes outside the ASCII range (0-127) to + * be replaced with question marks. + * @param bool $trim Indicates whether trim() should be applied to string values. + * Default is true. + */ + public function recursive_set_var(&$var, $default, $multibyte, $trim = true) + { + if (is_array($var) !== is_array($default)) + { + $var = (is_array($default)) ? array() : $default; + return; + } + + if (!is_array($default)) + { + $type = gettype($default); + $this->set_var($var, $var, $type, $multibyte, $trim); + } + else + { + // make sure there is at least one key/value pair to use get the + // types from + if (empty($default)) + { + $var = array(); + return; + } + + list($default_key, $default_value) = each($default); + $key_type = gettype($default_key); + + $_var = $var; + $var = array(); + + foreach ($_var as $k => $v) + { + $this->set_var($k, $k, $key_type, $multibyte); + + $this->recursive_set_var($v, $default_value, $multibyte, $trim); + $var[$k] = $v; + } + } + } +} diff --git a/install/update/old/phpbb/search/fulltext_mysql.php b/install/update/old/phpbb/search/fulltext_mysql.php new file mode 100644 index 0000000..137ed74 --- /dev/null +++ b/install/update/old/phpbb/search/fulltext_mysql.php @@ -0,0 +1,1227 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\search; + +/** +* Fulltext search for MySQL +*/ +class fulltext_mysql extends \phpbb\search\base +{ + /** + * Associative array holding index stats + * @var array + */ + protected $stats = array(); + + /** + * Holds the words entered by user, obtained by splitting the entered query on whitespace + * @var array + */ + protected $split_words = array(); + + /** + * Config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Database connection + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Associative array stores the min and max word length to be searched + * @var array + */ + protected $word_length = array(); + + /** + * Contains tidied search query. + * Operators are prefixed in search query and common words excluded + * @var string + */ + protected $search_query; + + /** + * Contains common words. + * Common words are words with length less/more than min/max length + * @var array + */ + protected $common_words = array(); + + /** + * Constructor + * Creates a new \phpbb\search\fulltext_mysql, which is used as a search backend + * + * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + */ + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) + { + $this->config = $config; + $this->db = $db; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->user = $user; + + $this->word_length = array('min' => $this->config['fulltext_mysql_min_word_len'], 'max' => $this->config['fulltext_mysql_max_word_len']); + + /** + * Load the UTF tools + */ + if (!function_exists('utf8_strlen')) + { + include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + } + + $error = false; + } + + /** + * Returns the name of this search backend to be displayed to administrators + * + * @return string Name + */ + public function get_name() + { + return 'MySQL Fulltext'; + } + + /** + * Returns the search_query + * + * @return string search query + */ + public function get_search_query() + { + return $this->search_query; + } + + /** + * Returns the common_words array + * + * @return array common words that are ignored by search backend + */ + public function get_common_words() + { + return $this->common_words; + } + + /** + * Returns the word_length array + * + * @return array min and max word length for searching + */ + public function get_word_length() + { + return $this->word_length; + } + + /** + * Checks for correct MySQL version and stores min/max word length in the config + * + * @return string|bool Language key of the error/incompatiblity occurred + */ + public function init() + { + if ($this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli') + { + return $this->user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_DATABASE']; + } + + $result = $this->db->sql_query('SHOW TABLE STATUS LIKE \'' . POSTS_TABLE . '\''); + $info = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + $engine = ''; + if (isset($info['Engine'])) + { + $engine = $info['Engine']; + } + else if (isset($info['Type'])) + { + $engine = $info['Type']; + } + + $fulltext_supported = + $engine === 'MyISAM' || + // FULLTEXT is supported on InnoDB since MySQL 5.6.4 according to + // http://dev.mysql.com/doc/refman/5.6/en/innodb-storage-engine.html + // We also require https://bugs.mysql.com/bug.php?id=67004 to be + // fixed for proper overall operation. Hence we require 5.6.8. + $engine === 'InnoDB' && + phpbb_version_compare($this->db->sql_server_info(true), '5.6.8', '>='); + + if (!$fulltext_supported) + { + return $this->user->lang['FULLTEXT_MYSQL_NOT_SUPPORTED']; + } + + $sql = 'SHOW VARIABLES + LIKE \'ft\_%\''; + $result = $this->db->sql_query($sql); + + $mysql_info = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $mysql_info[$row['Variable_name']] = $row['Value']; + } + $this->db->sql_freeresult($result); + + $this->config->set('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']); + $this->config->set('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']); + + return false; + } + + /** + * Splits keywords entered by a user into an array of words stored in $this->split_words + * Stores the tidied search query in $this->search_query + * + * @param string &$keywords Contains the keyword as entered by the user + * @param string $terms is either 'all' or 'any' + * @return bool false if no valid keywords were found and otherwise true + */ + public function split_keywords(&$keywords, $terms) + { + if ($terms == 'all') + { + $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#(^|\s)\+#', '#(^|\s)-#', '#(^|\s)\|#'); + $replace = array(' +', ' |', ' -', ' +', ' -', ' |'); + + $keywords = preg_replace($match, $replace, $keywords); + } + + // Filter out as above + $split_keywords = preg_replace("#[\n\r\t]+#", ' ', trim(htmlspecialchars_decode($keywords))); + + // Split words + $split_keywords = preg_replace('#([^\p{L}\p{N}\'*"()])#u', '$1$1', str_replace('\'\'', '\' \'', trim($split_keywords))); + $matches = array(); + preg_match_all('#(?:[^\p{L}\p{N}*"()]|^)([+\-|]?(?:[\p{L}\p{N}*"()]+\'?)*[\p{L}\p{N}*"()])(?:[^\p{L}\p{N}*"()]|$)#u', $split_keywords, $matches); + $this->split_words = $matches[1]; + + // We limit the number of allowed keywords to minimize load on the database + if ($this->config['max_num_search_keywords'] && count($this->split_words) > $this->config['max_num_search_keywords']) + { + trigger_error($this->user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', (int) $this->config['max_num_search_keywords'], count($this->split_words))); + } + + // to allow phrase search, we need to concatenate quoted words + $tmp_split_words = array(); + $phrase = ''; + foreach ($this->split_words as $word) + { + if ($phrase) + { + $phrase .= ' ' . $word; + if (strpos($word, '"') !== false && substr_count($word, '"') % 2 == 1) + { + $tmp_split_words[] = $phrase; + $phrase = ''; + } + } + else if (strpos($word, '"') !== false && substr_count($word, '"') % 2 == 1) + { + $phrase = $word; + } + else + { + $tmp_split_words[] = $word; + } + } + if ($phrase) + { + $tmp_split_words[] = $phrase; + } + + $this->split_words = $tmp_split_words; + + unset($tmp_split_words); + unset($phrase); + + foreach ($this->split_words as $i => $word) + { + // Check for not allowed search queries for InnoDB. + // We assume similar restrictions for MyISAM, which is usually even + // slower but not as restrictive as InnoDB. + // InnoDB full-text search does not support the use of a leading + // plus sign with wildcard ('+*'), a plus and minus sign + // combination ('+-'), or leading a plus and minus sign combination. + // InnoDB full-text search only supports leading plus or minus signs. + // For example, InnoDB supports '+apple' but does not support 'apple+'. + // Specifying a trailing plus or minus sign causes InnoDB to report + // a syntax error. InnoDB full-text search does not support the use + // of multiple operators on a single search word, as in this example: + // '++apple'. Use of multiple operators on a single search word + // returns a syntax error to standard out. + // Also, ensure that the wildcard character is only used at the + // end of the line as it's intended by MySQL. + if (preg_match('#^(\+[+-]|\+\*|.+[+-]$|.+\*(?!$))#', $word)) + { + unset($this->split_words[$i]); + continue; + } + + $clean_word = preg_replace('#^[+\-|"]#', '', $word); + + // check word length + $clean_len = utf8_strlen(str_replace('*', '', $clean_word)); + if (($clean_len < $this->config['fulltext_mysql_min_word_len']) || ($clean_len > $this->config['fulltext_mysql_max_word_len'])) + { + $this->common_words[] = $word; + unset($this->split_words[$i]); + } + } + + if ($terms == 'any') + { + $this->search_query = ''; + foreach ($this->split_words as $word) + { + if ((strpos($word, '+') === 0) || (strpos($word, '-') === 0) || (strpos($word, '|') === 0)) + { + $word = substr($word, 1); + } + $this->search_query .= $word . ' '; + } + } + else + { + $this->search_query = ''; + foreach ($this->split_words as $word) + { + if ((strpos($word, '+') === 0) || (strpos($word, '-') === 0)) + { + $this->search_query .= $word . ' '; + } + else if (strpos($word, '|') === 0) + { + $this->search_query .= substr($word, 1) . ' '; + } + else + { + $this->search_query .= '+' . $word . ' '; + } + } + } + + $this->search_query = utf8_htmlspecialchars($this->search_query); + + if ($this->search_query) + { + $this->split_words = array_values($this->split_words); + sort($this->split_words); + return true; + } + return false; + } + + /** + * Turns text into an array of words + * @param string $text contains post text/subject + */ + public function split_message($text) + { + // Split words + $text = preg_replace('#([^\p{L}\p{N}\'*])#u', '$1$1', str_replace('\'\'', '\' \'', trim($text))); + $matches = array(); + preg_match_all('#(?:[^\p{L}\p{N}*]|^)([+\-|]?(?:[\p{L}\p{N}*]+\'?)*[\p{L}\p{N}*])(?:[^\p{L}\p{N}*]|$)#u', $text, $matches); + $text = $matches[1]; + + // remove too short or too long words + $text = array_values($text); + for ($i = 0, $n = count($text); $i < $n; $i++) + { + $text[$i] = trim($text[$i]); + if (utf8_strlen($text[$i]) < $this->config['fulltext_mysql_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_mysql_max_word_len']) + { + unset($text[$i]); + } + } + + return array_values($text); + } + + /** + * Performs a search on keywords depending on display specific params. You have to run split_keywords() first + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param string $fields contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched) + * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @return boolean|int total number of results + */ + public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No keywords? No posts + if (!$this->search_query) + { + return false; + } + + // generate a search_key from all the options to identify the results + $search_key_array = array( + implode(', ', $this->split_words), + $type, + $fields, + $terms, + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary) + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_mysql_by_keyword_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_by_keyword_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + if ($start < 0) + { + $start = 0; + } + + // try reading the results from cache + $result_count = 0; + if ($this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $result_count; + } + + $id_ary = array(); + + $join_topic = ($type == 'posts') ? false : true; + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_sort_table = $sql_sort_join = ''; + + switch ($sql_sort[0]) + { + case 'u': + $sql_sort_table = USERS_TABLE . ' u, '; + $sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster '; + break; + + case 't': + $join_topic = true; + break; + + case 'f': + $sql_sort_table = FORUMS_TABLE . ' f, '; + $sql_sort_join = ' AND f.forum_id = p.forum_id '; + break; + } + + // Build some display specific sql strings + switch ($fields) + { + case 'titleonly': + $sql_match = 'p.post_subject'; + $sql_match_where = ' AND p.post_id = t.topic_first_post_id'; + $join_topic = true; + break; + + case 'msgonly': + $sql_match = 'p.post_text'; + $sql_match_where = ''; + break; + + case 'firstpost': + $sql_match = 'p.post_subject, p.post_text'; + $sql_match_where = ' AND p.post_id = t.topic_first_post_id'; + $join_topic = true; + break; + + default: + $sql_match = 'p.post_subject, p.post_text'; + $sql_match_where = ''; + break; + } + + $search_query = $this->search_query; + + /** + * Allow changing the query used to search for posts using fulltext_mysql + * + * @event core.search_mysql_keywords_main_query_before + * @var string search_query The parsed keywords used for this search + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var bool join_topic Weather or not TOPICS_TABLE should be CROSS JOIN'ED + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant) + * @var array ex_fid_ary Which forums not to search on + * @var int topic_id Limit the search to this topic_id only + * @var string sql_sort_table Extra tables to include in the SQL query. + * Used in conjunction with sql_sort_join + * @var string sql_sort_join SQL conditions to join all the tables used together. + * Used in conjunction with sql_sort_table + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sql_match Which columns to do the search on. + * @var string sql_match_where Extra conditions to use to properly filter the matching process + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'search_query', + 'result_count', + 'join_topic', + 'author_ary', + 'author_name', + 'ex_fid_ary', + 'topic_id', + 'sql_sort_table', + 'sql_sort_join', + 'sort_days', + 'sql_match', + 'sql_match_where', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_keywords_main_query_before', compact($vars))); + + $sql_select = (!$result_count) ? 'SQL_CALC_FOUND_ROWS ' : ''; + $sql_select = ($type == 'posts') ? $sql_select . 'p.post_id' : 'DISTINCT ' . $sql_select . 't.topic_id'; + $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; + $field = ($type == 'posts') ? 'post_id' : 'topic_id'; + if (count($author_ary) && $author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = ' AND (' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else if (count($author_ary)) + { + $sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary); + } + else + { + $sql_author = ''; + } + + $sql_where_options = $sql_sort_join; + $sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : ''; + $sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : ''; + $sql_where_options .= (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_where_options .= ' AND ' . $post_visibility; + $sql_where_options .= $sql_author; + $sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $sql_where_options .= $sql_match_where; + + $sql = "SELECT $sql_select + FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p + WHERE MATCH ($sql_match) AGAINST ('" . $this->db->sql_escape(htmlspecialchars_decode($this->search_query)) . "' IN BOOLEAN MODE) + $sql_where_options + ORDER BY $sql_sort"; + $this->db->sql_return_on_error(true); + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + + // if the total result count is not cached yet, retrieve it from the db + if (!$result_count && count($id_ary)) + { + $sql_found_rows = 'SELECT FOUND_ROWS() as result_count'; + $result = $this->db->sql_query($sql_found_rows); + $result_count = (int) $this->db->sql_fetchfield('result_count'); + $this->db->sql_freeresult($result); + + if (!$result_count) + { + return false; + } + } + + if ($start >= $result_count) + { + $start = floor(($result_count - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + } + + // store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page + $this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, (int) $per_page); + + return $result_count; + } + + /** + * Performs a search on an author's posts without caring about message contents. Depends on display specific params + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param boolean $firstpost_only if true, only topic starting posts will be considered + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @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, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No author? No posts + if (!count($author_ary)) + { + return 0; + } + + // generate a search_key from all the options to identify the results + $search_key_array = array( + '', + $type, + ($firstpost_only) ? 'firstpost' : '', + '', + '', + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary), + $author_name, + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_mysql_by_author_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var boolean firstpost_only Flag indicating if only topic starting posts are considered + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'firstpost_only', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_by_author_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + if ($start < 0) + { + $start = 0; + } + + // try reading the results from cache + $result_count = 0; + if ($this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $result_count; + } + + $id_ary = array(); + + // Create some display specific sql strings + if ($author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else + { + $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); + } + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; + $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_sort_table = $sql_sort_join = ''; + switch ($sql_sort[0]) + { + case 'u': + $sql_sort_table = USERS_TABLE . ' u, '; + $sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster '; + break; + + case 't': + $sql_sort_table = ($type == 'posts' && !$firstpost_only) ? TOPICS_TABLE . ' t, ' : ''; + $sql_sort_join = ($type == 'posts' && !$firstpost_only) ? ' AND t.topic_id = p.topic_id ' : ''; + break; + + case 'f': + $sql_sort_table = FORUMS_TABLE . ' f, '; + $sql_sort_join = ' AND f.forum_id = p.forum_id '; + break; + } + + $m_approve_fid_sql = ' AND ' . $post_visibility; + + /** + * Allow changing the query used to search for posts by author in fulltext_mysql + * + * @event core.search_mysql_author_query_before + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen + * @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table + * @var string type Either "posts" or "topics" specifying the type of search being made + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on + * @var string sql_author SQL WHERE condition for the post author ids + * @var int topic_id Limit the search to this topic_id only + * @var string sql_topic_id SQL of topic_id + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var string sort_days Time, in days, that the oldest post showing can have + * @var string sql_time The SQL to search on the time specifyed by sort_days + * @var bool firstpost_only Wether or not to search only on the first post of the topics + * @var string sql_firstpost The SQL with the conditions to join the tables when using firstpost_only + * @var array ex_fid_ary Forum ids that must not be searched on + * @var array sql_fora SQL query for ex_fid_ary + * @var string m_approve_fid_sql WHERE clause condition on post_visibility restrictions + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'result_count', + 'sql_sort_table', + 'sql_sort_join', + 'type', + 'author_ary', + 'author_name', + 'sql_author', + 'topic_id', + 'sql_topic_id', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'sort_days', + 'sql_time', + 'firstpost_only', + 'sql_firstpost', + 'ex_fid_ary', + 'sql_fora', + 'm_approve_fid_sql', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_author_query_before', compact($vars))); + + // If the cache was completely empty count the results + $calc_results = ($result_count) ? '' : 'SQL_CALC_FOUND_ROWS '; + + // Build the query for really selecting the post_ids + if ($type == 'posts') + { + $sql = "SELECT {$calc_results}p.post_id + FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . " + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + $sql_sort_join + $sql_time + ORDER BY $sql_sort"; + $field = 'post_id'; + } + else + { + $sql = "SELECT {$calc_results}t.topic_id + FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + AND t.topic_id = p.topic_id + $sql_sort_join + $sql_time + GROUP BY t.topic_id + ORDER BY $sql_sort"; + $field = 'topic_id'; + } + + // Only read one block of posts from the db and then cache it + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + // retrieve the total result count if needed + if (!$result_count) + { + $sql_found_rows = 'SELECT FOUND_ROWS() as result_count'; + $result = $this->db->sql_query($sql_found_rows); + $result_count = (int) $this->db->sql_fetchfield('result_count'); + $this->db->sql_freeresult($result); + + if (!$result_count) + { + return false; + } + } + + if ($start >= $result_count) + { + $start = floor(($result_count - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + } + + if (count($id_ary)) + { + $this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, $per_page); + + return $result_count; + } + return false; + } + + /** + * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated + * + * @param string $mode contains the post mode: edit, post, reply, quote ... + * @param int $post_id contains the post id of the post to index + * @param string $message contains the post text of the post + * @param string $subject contains the subject of the post to index + * @param int $poster_id contains the user id of the poster + * @param int $forum_id contains the forum id of parent forum of the post + */ + public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) + { + // Split old and new post/subject to obtain array of words + $split_text = $this->split_message($message); + $split_title = ($subject) ? $this->split_message($subject) : array(); + + $words = array_unique(array_merge($split_text, $split_title)); + + /** + * Event to modify method arguments and words before the MySQL search index is updated + * + * @event core.search_mysql_index_before + * @var string mode Contains the post mode: edit, post, reply, quote + * @var int post_id The id of the post which is modified/created + * @var string message New or updated post content + * @var string subject New or updated post subject + * @var int poster_id Post author's user id + * @var int forum_id The id of the forum in which the post is located + * @var array words List of words added to the index + * @var array split_text Array of words from the message + * @var array split_title Array of words from the title + * @since 3.2.3-RC1 + */ + $vars = array( + 'mode', + 'post_id', + 'message', + 'subject', + 'poster_id', + 'forum_id', + 'words', + 'split_text', + 'split_title', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_index_before', compact($vars))); + + unset($split_text); + unset($split_title); + + // destroy cached search results containing any of the words removed or added + $this->destroy_cache($words, array($poster_id)); + + unset($words); + } + + /** + * Destroy cached results, that might be outdated after deleting a post + */ + public function index_remove($post_ids, $author_ids, $forum_ids) + { + $this->destroy_cache(array(), array_unique($author_ids)); + } + + /** + * Destroy old cache entries + */ + public function tidy() + { + // destroy too old cached search results + $this->destroy_cache(array()); + + $this->config->set('search_last_gc', time(), false); + } + + /** + * Create fulltext index + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function create_index($acp_module, $u_action) + { + // Make sure we can actually use MySQL with fulltext indexes + if ($error = $this->init()) + { + return $error; + } + + if (empty($this->stats)) + { + $this->get_stats(); + } + + $alter_list = array(); + + if (!isset($this->stats['post_subject'])) + { + $alter_entry = array(); + if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) + { + $alter_entry[] = 'MODIFY post_subject varchar(255) COLLATE utf8_unicode_ci DEFAULT \'\' NOT NULL'; + } + else + { + $alter_entry[] = 'MODIFY post_subject text NOT NULL'; + } + $alter_entry[] = 'ADD FULLTEXT (post_subject)'; + $alter_list[] = $alter_entry; + } + + if (!isset($this->stats['post_content'])) + { + $alter_entry = array(); + if ($this->db->get_sql_layer() == 'mysqli' || version_compare($this->db->sql_server_info(true), '4.1.3', '>=')) + { + $alter_entry[] = 'MODIFY post_text mediumtext COLLATE utf8_unicode_ci NOT NULL'; + } + else + { + $alter_entry[] = 'MODIFY post_text mediumtext NOT NULL'; + } + + $alter_entry[] = 'ADD FULLTEXT post_content (post_text, post_subject)'; + $alter_list[] = $alter_entry; + } + + $sql_queries = []; + + foreach ($alter_list as $alter) + { + $sql_queries[] = 'ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter); + } + + if (!isset($this->stats['post_text'])) + { + $sql_queries[] = 'ALTER TABLE ' . POSTS_TABLE . ' ADD FULLTEXT post_text (post_text)'; + } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the MySQL search index is created + * + * @event core.search_mysql_create_index_before + * @var array sql_queries Array with queries for creating the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_create_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } + + $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); + + return false; + } + + /** + * Drop fulltext index + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function delete_index($acp_module, $u_action) + { + // Make sure we can actually use MySQL with fulltext indexes + if ($error = $this->init()) + { + return $error; + } + + if (empty($this->stats)) + { + $this->get_stats(); + } + + $alter = array(); + + if (isset($this->stats['post_subject'])) + { + $alter[] = 'DROP INDEX post_subject'; + } + + if (isset($this->stats['post_content'])) + { + $alter[] = 'DROP INDEX post_content'; + } + + if (isset($this->stats['post_text'])) + { + $alter[] = 'DROP INDEX post_text'; + } + + $sql_queries = []; + + if (count($alter)) + { + $sql_queries[] = 'ALTER TABLE ' . POSTS_TABLE . ' ' . implode(', ', $alter); + } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the MySQL search index is deleted + * + * @event core.search_mysql_delete_index_before + * @var array sql_queries Array with queries for deleting the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_mysql_delete_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } + + $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); + + return false; + } + + /** + * Returns true if both FULLTEXT indexes exist + */ + public function index_created() + { + if (empty($this->stats)) + { + $this->get_stats(); + } + + return isset($this->stats['post_subject']) && isset($this->stats['post_content']) && isset($this->stats['post_text']); + } + + /** + * Returns an associative array containing information about the indexes + */ + public function index_stats() + { + if (empty($this->stats)) + { + $this->get_stats(); + } + + return array( + $this->user->lang['FULLTEXT_MYSQL_TOTAL_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] : 0, + ); + } + + /** + * Computes the stats and store them in the $this->stats associative array + */ + protected function get_stats() + { + if (strpos($this->db->get_sql_layer(), 'mysql') === false) + { + $this->stats = array(); + return; + } + + $sql = 'SHOW INDEX + FROM ' . POSTS_TABLE; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // deal with older MySQL versions which didn't use Index_type + $index_type = (isset($row['Index_type'])) ? $row['Index_type'] : $row['Comment']; + + if ($index_type == 'FULLTEXT') + { + if ($row['Key_name'] == 'post_subject') + { + $this->stats['post_subject'] = $row; + } + else if ($row['Key_name'] == 'post_text') + { + $this->stats['post_text'] = $row; + } + else if ($row['Key_name'] == 'post_content') + { + $this->stats['post_content'] = $row; + } + } + } + $this->db->sql_freeresult($result); + + $this->stats['total_posts'] = empty($this->stats) ? 0 : $this->db->get_estimated_row_count(POSTS_TABLE); + } + + /** + * Display a note, that UTF-8 support is not available with certain versions of PHP + * + * @return associative array containing template and config variables + */ + public function acp() + { + $tpl = ' +
+

' . $this->user->lang['FULLTEXT_MYSQL_MIN_SEARCH_CHARS_EXPLAIN'] . '
+
' . $this->config['fulltext_mysql_min_word_len'] . '
+
+
+

' . $this->user->lang['FULLTEXT_MYSQL_MAX_SEARCH_CHARS_EXPLAIN'] . '
+
' . $this->config['fulltext_mysql_max_word_len'] . '
+
+ '; + + // These are fields required in the config table + return array( + 'tpl' => $tpl, + 'config' => array() + ); + } +} diff --git a/install/update/old/phpbb/search/fulltext_native.php b/install/update/old/phpbb/search/fulltext_native.php new file mode 100644 index 0000000..c83de75 --- /dev/null +++ b/install/update/old/phpbb/search/fulltext_native.php @@ -0,0 +1,2062 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\search; + +/** +* phpBB's own db driven fulltext search, version 2 +*/ +class fulltext_native extends \phpbb\search\base +{ + const UTF8_HANGUL_FIRST = "\xEA\xB0\x80"; + const UTF8_HANGUL_LAST = "\xED\x9E\xA3"; + const UTF8_CJK_FIRST = "\xE4\xB8\x80"; + const UTF8_CJK_LAST = "\xE9\xBE\xBB"; + const UTF8_CJK_B_FIRST = "\xF0\xA0\x80\x80"; + const UTF8_CJK_B_LAST = "\xF0\xAA\x9B\x96"; + + /** + * Associative array holding index stats + * @var array + */ + protected $stats = array(); + + /** + * Associative array stores the min and max word length to be searched + * @var array + */ + protected $word_length = array(); + + /** + * Contains tidied search query. + * Operators are prefixed in search query and common words excluded + * @var string + */ + protected $search_query; + + /** + * Contains common words. + * Common words are words with length less/more than min/max length + * @var array + */ + protected $common_words = array(); + + /** + * Post ids of posts containing words that are to be included + * @var array + */ + protected $must_contain_ids = array(); + + /** + * Post ids of posts containing words that should not be included + * @var array + */ + protected $must_not_contain_ids = array(); + + /** + * Post ids of posts containing at least one word that needs to be excluded + * @var array + */ + protected $must_exclude_one_ids = array(); + + /** + * Relative path to board root + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP Extension + * @var string + */ + protected $php_ext; + + /** + * Config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Database connection + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Initialises the fulltext_native search backend with min/max word length + * + * @param boolean|string &$error is passed by reference and should either be set to false on success or an error message on failure + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + */ + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $phpEx; + $this->config = $config; + $this->db = $db; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->user = $user; + + $this->word_length = array('min' => (int) $this->config['fulltext_native_min_chars'], 'max' => (int) $this->config['fulltext_native_max_chars']); + + /** + * Load the UTF tools + */ + if (!function_exists('utf8_decode_ncr')) + { + include($this->phpbb_root_path . 'includes/utf/utf_tools.' . $this->php_ext); + } + + $error = false; + } + + /** + * Returns the name of this search backend to be displayed to administrators + * + * @return string Name + */ + public function get_name() + { + return 'phpBB Native Fulltext'; + } + + /** + * Returns the search_query + * + * @return string search query + */ + public function get_search_query() + { + return $this->search_query; + } + + /** + * Returns the common_words array + * + * @return array common words that are ignored by search backend + */ + public function get_common_words() + { + return $this->common_words; + } + + /** + * Returns the word_length array + * + * @return array min and max word length for searching + */ + public function get_word_length() + { + return $this->word_length; + } + + /** + * This function fills $this->search_query with the cleaned user search query + * + * If $terms is 'any' then the words will be extracted from the search query + * and combined with | inside brackets. They will afterwards be treated like + * an standard search query. + * + * Then it analyses the query and fills the internal arrays $must_not_contain_ids, + * $must_contain_ids and $must_exclude_one_ids which are later used by keyword_search() + * + * @param string $keywords contains the search query string as entered by the user + * @param string $terms is either 'all' (use search query as entered, default words to 'must be contained in post') + * or 'any' (find all posts containing at least one of the given words) + * @return boolean false if no valid keywords were found and otherwise true + */ + public function split_keywords($keywords, $terms) + { + $tokens = '+-|()* '; + + $keywords = trim($this->cleanup($keywords, $tokens)); + + // allow word|word|word without brackets + if ((strpos($keywords, ' ') === false) && (strpos($keywords, '|') !== false) && (strpos($keywords, '(') === false)) + { + $keywords = '(' . $keywords . ')'; + } + + $open_bracket = $space = false; + for ($i = 0, $n = strlen($keywords); $i < $n; $i++) + { + if ($open_bracket !== false) + { + switch ($keywords[$i]) + { + case ')': + if ($open_bracket + 1 == $i) + { + $keywords[$i - 1] = '|'; + $keywords[$i] = '|'; + } + $open_bracket = false; + break; + case '(': + $keywords[$i] = '|'; + break; + case '+': + case '-': + case ' ': + $keywords[$i] = '|'; + break; + case '*': + // $i can never be 0 here since $open_bracket is initialised to false + if (strpos($tokens, $keywords[$i - 1]) !== false && ($i + 1 === $n || strpos($tokens, $keywords[$i + 1]) !== false)) + { + $keywords[$i] = '|'; + } + break; + } + } + else + { + switch ($keywords[$i]) + { + case ')': + $keywords[$i] = ' '; + break; + case '(': + $open_bracket = $i; + $space = false; + break; + case '|': + $keywords[$i] = ' '; + break; + case '-': + case '+': + $space = $keywords[$i]; + break; + case ' ': + if ($space !== false) + { + $keywords[$i] = $space; + } + break; + default: + $space = false; + } + } + } + + if ($open_bracket !== false) + { + $keywords .= ')'; + } + + $match = array( + '# +#', + '#\|\|+#', + '#(\+|\-)(?:\+|\-)+#', + '#\(\|#', + '#\|\)#', + ); + $replace = array( + ' ', + '|', + '$1', + '(', + ')', + ); + + $keywords = preg_replace($match, $replace, $keywords); + $num_keywords = count(explode(' ', $keywords)); + + // We limit the number of allowed keywords to minimize load on the database + if ($this->config['max_num_search_keywords'] && $num_keywords > $this->config['max_num_search_keywords']) + { + trigger_error($this->user->lang('MAX_NUM_SEARCH_KEYWORDS_REFINE', (int) $this->config['max_num_search_keywords'], $num_keywords)); + } + + // $keywords input format: each word separated by a space, words in a bracket are not separated + + // the user wants to search for any word, convert the search query + if ($terms == 'any') + { + $words = array(); + + preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $words); + if (count($words[1])) + { + $keywords = '(' . implode('|', $words[1]) . ')'; + } + } + + // Remove non trailing wildcards from each word to prevent a full table scan (it's now using the database index) + $match = '#\*(?!$|\s)#'; + $replace = '$1'; + $keywords = preg_replace($match, $replace, $keywords); + + // Only allow one wildcard in the search query to limit the database load + $match = '#\*#'; + $replace = '$1'; + $count_wildcards = substr_count($keywords, '*'); + + // Reverse the string to remove all wildcards except the first one + $keywords = strrev(preg_replace($match, $replace, strrev($keywords), $count_wildcards - 1)); + unset($count_wildcards); + + // set the search_query which is shown to the user + $this->search_query = $keywords; + + $exact_words = array(); + preg_match_all('#([^\\s+\\-|()]+)(?:$|[\\s+\\-|()])#u', $keywords, $exact_words); + $exact_words = $exact_words[1]; + + $common_ids = $words = array(); + + if (count($exact_words)) + { + $sql = 'SELECT word_id, word_text, word_common + FROM ' . SEARCH_WORDLIST_TABLE . ' + WHERE ' . $this->db->sql_in_set('word_text', $exact_words) . ' + ORDER BY word_count ASC'; + $result = $this->db->sql_query($sql); + + // store an array of words and ids, remove common words + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['word_common']) + { + $this->common_words[] = $row['word_text']; + $common_ids[$row['word_text']] = (int) $row['word_id']; + continue; + } + + $words[$row['word_text']] = (int) $row['word_id']; + } + $this->db->sql_freeresult($result); + } + + // Handle +, - without preceeding whitespace character + $match = array('#(\S)\+#', '#(\S)-#'); + $replace = array('$1 +', '$1 +'); + + $keywords = preg_replace($match, $replace, $keywords); + + // now analyse the search query, first split it using the spaces + $query = explode(' ', $keywords); + + $this->must_contain_ids = array(); + $this->must_not_contain_ids = array(); + $this->must_exclude_one_ids = array(); + + foreach ($query as $word) + { + if (empty($word)) + { + continue; + } + + // words which should not be included + if ($word[0] == '-') + { + $word = substr($word, 1); + + // a group of which at least one may not be in the resulting posts + if ($word[0] == '(') + { + $word = array_unique(explode('|', substr($word, 1, -1))); + $mode = 'must_exclude_one'; + } + // one word which should not be in the resulting posts + else + { + $mode = 'must_not_contain'; + } + $ignore_no_id = true; + } + // words which have to be included + else + { + // no prefix is the same as a +prefix + if ($word[0] == '+') + { + $word = substr($word, 1); + } + + // a group of words of which at least one word should be in every resulting post + if ($word[0] == '(') + { + $word = array_unique(explode('|', substr($word, 1, -1))); + } + $ignore_no_id = false; + $mode = 'must_contain'; + } + + if (empty($word)) + { + continue; + } + + // if this is an array of words then retrieve an id for each + if (is_array($word)) + { + $non_common_words = array(); + $id_words = array(); + foreach ($word as $i => $word_part) + { + if (strpos($word_part, '*') !== false) + { + $len = utf8_strlen(str_replace('*', '', $word_part)); + if ($len >= $this->word_length['min'] && $len <= $this->word_length['max']) + { + $id_words[] = '\'' . $this->db->sql_escape(str_replace('*', '%', $word_part)) . '\''; + $non_common_words[] = $word_part; + } + else + { + $this->common_words[] = $word_part; + } + } + else if (isset($words[$word_part])) + { + $id_words[] = $words[$word_part]; + $non_common_words[] = $word_part; + } + else + { + $len = utf8_strlen($word_part); + if ($len < $this->word_length['min'] || $len > $this->word_length['max']) + { + $this->common_words[] = $word_part; + } + } + } + if (count($id_words)) + { + sort($id_words); + if (count($id_words) > 1) + { + $this->{$mode . '_ids'}[] = $id_words; + } + else + { + $mode = ($mode == 'must_exclude_one') ? 'must_not_contain' : $mode; + $this->{$mode . '_ids'}[] = $id_words[0]; + } + } + // throw an error if we shall not ignore unexistant words + else if (!$ignore_no_id && count($non_common_words)) + { + trigger_error(sprintf($this->user->lang['WORDS_IN_NO_POST'], implode($this->user->lang['COMMA_SEPARATOR'], $non_common_words))); + } + unset($non_common_words); + } + // else we only need one id + else if (($wildcard = strpos($word, '*') !== false) || isset($words[$word])) + { + if ($wildcard) + { + $len = utf8_strlen(str_replace('*', '', $word)); + if ($len >= $this->word_length['min'] && $len <= $this->word_length['max']) + { + $this->{$mode . '_ids'}[] = '\'' . $this->db->sql_escape(str_replace('*', '%', $word)) . '\''; + } + else + { + $this->common_words[] = $word; + } + } + else + { + $this->{$mode . '_ids'}[] = $words[$word]; + } + } + else + { + if (!isset($common_ids[$word])) + { + $len = utf8_strlen($word); + if ($len < $this->word_length['min'] || $len > $this->word_length['max']) + { + $this->common_words[] = $word; + } + } + } + } + + // Return true if all words are not common words + if (count($exact_words) - count($this->common_words) > 0) + { + return true; + } + return false; + } + + /** + * Performs a search on keywords depending on display specific params. You have to run split_keywords() first + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param string $fields contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched) + * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @return boolean|int total number of results + */ + public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No keywords? No posts. + if (empty($this->search_query)) + { + return false; + } + + // we can't search for negatives only + if (empty($this->must_contain_ids)) + { + return false; + } + + $must_contain_ids = $this->must_contain_ids; + $must_not_contain_ids = $this->must_not_contain_ids; + $must_exclude_one_ids = $this->must_exclude_one_ids; + + sort($must_contain_ids); + sort($must_not_contain_ids); + sort($must_exclude_one_ids); + + // generate a search_key from all the options to identify the results + $search_key_array = array( + serialize($must_contain_ids), + serialize($must_not_contain_ids), + serialize($must_exclude_one_ids), + $type, + $fields, + $terms, + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary), + $author_name, + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_native_by_keyword_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var array must_contain_ids Array with post ids of posts containing words that are to be included + * @var array must_not_contain_ids Array with post ids of posts containing words that should not be included + * @var array must_exclude_one_ids Array with post ids of posts containing at least one word that needs to be excluded + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'must_contain_ids', + 'must_not_contain_ids', + 'must_exclude_one_ids', + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_by_keyword_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + // try reading the results from cache + $total_results = 0; + if ($this->obtain_ids($search_key, $total_results, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $total_results; + } + + $id_ary = array(); + + $sql_where = array(); + $m_num = 0; + $w_num = 0; + + $sql_array = array( + 'SELECT' => ($type == 'posts') ? 'p.post_id' : 'p.topic_id', + 'FROM' => array( + SEARCH_WORDMATCH_TABLE => array(), + SEARCH_WORDLIST_TABLE => array(), + ), + 'LEFT_JOIN' => array(array( + 'FROM' => array(POSTS_TABLE => 'p'), + 'ON' => 'm0.post_id = p.post_id', + )), + ); + + $title_match = ''; + $left_join_topics = false; + $group_by = true; + // Build some display specific sql strings + switch ($fields) + { + case 'titleonly': + $title_match = 'title_match = 1'; + $group_by = false; + // no break + case 'firstpost': + $left_join_topics = true; + $sql_where[] = 'p.post_id = t.topic_first_post_id'; + break; + + case 'msgonly': + $title_match = 'title_match = 0'; + $group_by = false; + break; + } + + if ($type == 'topics') + { + $left_join_topics = true; + $group_by = true; + } + + /** + * @todo Add a query optimizer (handle stuff like "+(4|3) +4") + */ + + foreach ($this->must_contain_ids as $subquery) + { + if (is_array($subquery)) + { + $group_by = true; + + $word_id_sql = array(); + $word_ids = array(); + foreach ($subquery as $id) + { + if (is_string($id)) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(SEARCH_WORDLIST_TABLE => 'w' . $w_num), + 'ON' => "w$w_num.word_text LIKE $id" + ); + $word_ids[] = "w$w_num.word_id"; + + $w_num++; + } + else + { + $word_ids[] = $id; + } + } + + $sql_where[] = $this->db->sql_in_set("m$m_num.word_id", $word_ids); + + unset($word_id_sql); + unset($word_ids); + } + else if (is_string($subquery)) + { + $sql_array['FROM'][SEARCH_WORDLIST_TABLE][] = 'w' . $w_num; + + $sql_where[] = "w$w_num.word_text LIKE $subquery"; + $sql_where[] = "m$m_num.word_id = w$w_num.word_id"; + + $group_by = true; + $w_num++; + } + else + { + $sql_where[] = "m$m_num.word_id = $subquery"; + } + + $sql_array['FROM'][SEARCH_WORDMATCH_TABLE][] = 'm' . $m_num; + + if ($title_match) + { + $sql_where[] = "m$m_num.$title_match"; + } + + if ($m_num != 0) + { + $sql_where[] = "m$m_num.post_id = m0.post_id"; + } + $m_num++; + } + + foreach ($this->must_not_contain_ids as $key => $subquery) + { + if (is_string($subquery)) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(SEARCH_WORDLIST_TABLE => 'w' . $w_num), + 'ON' => "w$w_num.word_text LIKE $subquery" + ); + + $this->must_not_contain_ids[$key] = "w$w_num.word_id"; + + $group_by = true; + $w_num++; + } + } + + if (count($this->must_not_contain_ids)) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(SEARCH_WORDMATCH_TABLE => 'm' . $m_num), + 'ON' => $this->db->sql_in_set("m$m_num.word_id", $this->must_not_contain_ids) . (($title_match) ? " AND m$m_num.$title_match" : '') . " AND m$m_num.post_id = m0.post_id" + ); + + $sql_where[] = "m$m_num.word_id IS NULL"; + $m_num++; + } + + foreach ($this->must_exclude_one_ids as $ids) + { + $is_null_joins = array(); + foreach ($ids as $id) + { + if (is_string($id)) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(SEARCH_WORDLIST_TABLE => 'w' . $w_num), + 'ON' => "w$w_num.word_text LIKE $id" + ); + $id = "w$w_num.word_id"; + + $group_by = true; + $w_num++; + } + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(SEARCH_WORDMATCH_TABLE => 'm' . $m_num), + 'ON' => "m$m_num.word_id = $id AND m$m_num.post_id = m0.post_id" . (($title_match) ? " AND m$m_num.$title_match" : '') + ); + $is_null_joins[] = "m$m_num.word_id IS NULL"; + + $m_num++; + } + $sql_where[] = '(' . implode(' OR ', $is_null_joins) . ')'; + } + + $sql_where[] = $post_visibility; + + $search_query = $this->search_query; + $must_exclude_one_ids = $this->must_exclude_one_ids; + $must_not_contain_ids = $this->must_not_contain_ids; + $must_contain_ids = $this->must_contain_ids; + + /** + * Allow changing the query used for counting for posts using fulltext_native + * + * @event core.search_native_keywords_count_query_before + * @var string search_query The parsed keywords used for this search + * @var array must_not_contain_ids Ids that cannot be taken into account for the results + * @var array must_exclude_one_ids Ids that cannot be on the results + * @var array must_contain_ids Ids that must be on the results + * @var int total_results The previous result count for the format of the query + * Set to 0 to force a re-count + * @var array sql_array The data on how to search in the DB at this point + * @var bool left_join_topics Whether or not TOPICS_TABLE should be CROSS JOIN'ED + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant) + * @var array ex_fid_ary Which forums not to search on + * @var int topic_id Limit the search to this topic_id only + * @var string sql_sort_table Extra tables to include in the SQL query. + * Used in conjunction with sql_sort_join + * @var string sql_sort_join SQL conditions to join all the tables used together. + * Used in conjunction with sql_sort_table + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sql_where An array of the current WHERE clause conditions + * @var string sql_match Which columns to do the search on + * @var string sql_match_where Extra conditions to use to properly filter the matching process + * @var bool group_by Whether or not the SQL query requires a GROUP BY for the elements in the SELECT clause + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'search_query', + 'must_not_contain_ids', + 'must_exclude_one_ids', + 'must_contain_ids', + 'total_results', + 'sql_array', + 'left_join_topics', + 'author_ary', + 'author_name', + 'ex_fid_ary', + 'topic_id', + 'sql_sort_table', + 'sql_sort_join', + 'sort_days', + 'sql_where', + 'sql_match', + 'sql_match_where', + 'group_by', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_keywords_count_query_before', compact($vars))); + + if ($topic_id) + { + $sql_where[] = 'p.topic_id = ' . $topic_id; + } + + if (count($author_ary)) + { + if ($author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else + { + $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); + } + $sql_where[] = $sql_author; + } + + if (count($ex_fid_ary)) + { + $sql_where[] = $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true); + } + + if ($sort_days) + { + $sql_where[] = 'p.post_time >= ' . (time() - ($sort_days * 86400)); + } + + $sql_array['WHERE'] = implode(' AND ', $sql_where); + + $is_mysql = false; + // if the total result count is not cached yet, retrieve it from the db + if (!$total_results) + { + $sql = ''; + $sql_array_count = $sql_array; + + if ($left_join_topics) + { + $sql_array_count['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'p.topic_id = t.topic_id' + ); + } + + switch ($this->db->get_sql_layer()) + { + case 'mysql4': + case 'mysqli': + + // 3.x does not support SQL_CALC_FOUND_ROWS + // $sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT']; + $is_mysql = true; + + break; + + case 'sqlite3': + $sql_array_count['SELECT'] = ($type == 'posts') ? 'DISTINCT p.post_id' : 'DISTINCT p.topic_id'; + $sql = 'SELECT COUNT(' . (($type == 'posts') ? 'post_id' : 'topic_id') . ') as total_results + FROM (' . $this->db->sql_build_query('SELECT', $sql_array_count) . ')'; + + // no break + + default: + $sql_array_count['SELECT'] = ($type == 'posts') ? 'COUNT(DISTINCT p.post_id) AS total_results' : 'COUNT(DISTINCT p.topic_id) AS total_results'; + $sql = (!$sql) ? $this->db->sql_build_query('SELECT', $sql_array_count) : $sql; + + $result = $this->db->sql_query($sql); + $total_results = (int) $this->db->sql_fetchfield('total_results'); + $this->db->sql_freeresult($result); + + if (!$total_results) + { + return false; + } + break; + } + + unset($sql_array_count, $sql); + } + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + + switch ($sql_sort[0]) + { + case 'u': + $sql_array['FROM'][USERS_TABLE] = 'u'; + $sql_where[] = 'u.user_id = p.poster_id '; + break; + + case 't': + $left_join_topics = true; + break; + + case 'f': + $sql_array['FROM'][FORUMS_TABLE] = 'f'; + $sql_where[] = 'f.forum_id = p.forum_id'; + break; + } + + if ($left_join_topics) + { + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'p.topic_id = t.topic_id' + ); + } + + // if using mysql and the total result count is not calculated yet, get it from the db + if (!$total_results && $is_mysql) + { + // Also count rows for the query as if there was not LIMIT. Add SQL_CALC_FOUND_ROWS to SQL + $sql_array['SELECT'] = 'SQL_CALC_FOUND_ROWS ' . $sql_array['SELECT']; + } + + $sql_array['WHERE'] = implode(' AND ', $sql_where); + $sql_array['GROUP_BY'] = ($group_by) ? (($type == 'posts') ? 'p.post_id' : 'p.topic_id') . ', ' . $sort_by_sql[$sort_key] : ''; + $sql_array['ORDER_BY'] = $sql_sort; + + unset($sql_where, $sql_sort, $group_by); + + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[(($type == 'posts') ? 'post_id' : 'topic_id')]; + } + $this->db->sql_freeresult($result); + + if (!$total_results && $is_mysql) + { + // Get the number of results as calculated by MySQL + $sql_count = 'SELECT FOUND_ROWS() as total_results'; + $result = $this->db->sql_query($sql_count); + $total_results = (int) $this->db->sql_fetchfield('total_results'); + $this->db->sql_freeresult($result); + + if (!$total_results) + { + return false; + } + } + + if ($start >= $total_results) + { + $start = floor(($total_results - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[(($type == 'posts') ? 'post_id' : 'topic_id')]; + } + $this->db->sql_freeresult($result); + + } + + // store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page + $this->save_ids($search_key, $this->search_query, $author_ary, $total_results, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, (int) $per_page); + + return $total_results; + } + + /** + * Performs a search on an author's posts without caring about message contents. Depends on display specific params + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param boolean $firstpost_only if true, only topic starting posts will be considered + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @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, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No author? No posts + if (!count($author_ary)) + { + return 0; + } + + // generate a search_key from all the options to identify the results + $search_key_array = array( + '', + $type, + ($firstpost_only) ? 'firstpost' : '', + '', + '', + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary), + $author_name, + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_native_by_author_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var boolean firstpost_only Flag indicating if only topic starting posts are considered + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'firstpost_only', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_by_author_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + // try reading the results from cache + $total_results = 0; + if ($this->obtain_ids($search_key, $total_results, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $total_results; + } + + $id_ary = array(); + + // Create some display specific sql strings + if ($author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else + { + $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); + } + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; + $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; + $post_visibility = ($post_visibility) ? ' AND ' . $post_visibility : ''; + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_sort_table = $sql_sort_join = ''; + switch ($sql_sort[0]) + { + case 'u': + $sql_sort_table = USERS_TABLE . ' u, '; + $sql_sort_join = ' AND u.user_id = p.poster_id '; + break; + + case 't': + $sql_sort_table = ($type == 'posts' && !$firstpost_only) ? TOPICS_TABLE . ' t, ' : ''; + $sql_sort_join = ($type == 'posts' && !$firstpost_only) ? ' AND t.topic_id = p.topic_id ' : ''; + break; + + case 'f': + $sql_sort_table = FORUMS_TABLE . ' f, '; + $sql_sort_join = ' AND f.forum_id = p.forum_id '; + break; + } + + $select = ($type == 'posts') ? 'p.post_id' : 't.topic_id'; + $is_mysql = false; + + /** + * Allow changing the query used to search for posts by author in fulltext_native + * + * @event core.search_native_author_count_query_before + * @var int total_results The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var string type The type of search being made + * @var string select SQL SELECT clause for what to get + * @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen + * @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table + * @var array sql_author SQL WHERE condition for the post author ids + * @var int topic_id Limit the search to this topic_id only + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var string sort_days Time, in days, that the oldest post showing can have + * @var string sql_time The SQL to search on the time specifyed by sort_days + * @var bool firstpost_only Wether or not to search only on the first post of the topics + * @var string sql_firstpost The SQL used in the WHERE claused to filter by firstpost. + * @var array ex_fid_ary Forum ids that must not be searched on + * @var array sql_fora SQL query for ex_fid_ary + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'total_results', + 'type', + 'select', + 'sql_sort_table', + 'sql_sort_join', + 'sql_author', + 'topic_id', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'sort_days', + 'sql_time', + 'firstpost_only', + 'sql_firstpost', + 'ex_fid_ary', + 'sql_fora', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_author_count_query_before', compact($vars))); + + // If the cache was completely empty count the results + if (!$total_results) + { + switch ($this->db->get_sql_layer()) + { + case 'mysql4': + case 'mysqli': +// $select = 'SQL_CALC_FOUND_ROWS ' . $select; + $is_mysql = true; + break; + + default: + if ($type == 'posts') + { + $sql = 'SELECT COUNT(p.post_id) as total_results + FROM ' . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . " + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $post_visibility + $sql_fora + $sql_time"; + } + else + { + if ($this->db->get_sql_layer() == 'sqlite3') + { + $sql = 'SELECT COUNT(topic_id) as total_results + FROM (SELECT DISTINCT t.topic_id'; + } + else + { + $sql = 'SELECT COUNT(DISTINCT t.topic_id) as total_results'; + } + + $sql .= ' FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $post_visibility + $sql_fora + AND t.topic_id = p.topic_id + $sql_time" . ($this->db->get_sql_layer() == 'sqlite3' ? ')' : ''); + } + $result = $this->db->sql_query($sql); + + $total_results = (int) $this->db->sql_fetchfield('total_results'); + $this->db->sql_freeresult($result); + + if (!$total_results) + { + return false; + } + break; + } + } + + // Build the query for really selecting the post_ids + if ($type == 'posts') + { + $sql = "SELECT $select + FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t' : '') . " + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $post_visibility + $sql_fora + $sql_sort_join + $sql_time + ORDER BY $sql_sort"; + $field = 'post_id'; + } + else + { + $sql = "SELECT $select + FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $post_visibility + $sql_fora + AND t.topic_id = p.topic_id + $sql_sort_join + $sql_time + GROUP BY t.topic_id, " . $sort_by_sql[$sort_key] . ' + ORDER BY ' . $sql_sort; + $field = 'topic_id'; + } + + // Only read one block of posts from the db and then cache it + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + if (!$total_results && $is_mysql) + { + // Count rows for the executed queries. Replace $select within $sql with SQL_CALC_FOUND_ROWS, and run it. + $sql_calc = str_replace('SELECT ' . $select, 'SELECT SQL_CALC_FOUND_ROWS ' . $select, $sql); + + $result = $this->db->sql_query($sql_calc); + $this->db->sql_freeresult($result); + + $sql_count = 'SELECT FOUND_ROWS() as total_results'; + $result = $this->db->sql_query($sql_count); + $total_results = (int) $this->db->sql_fetchfield('total_results'); + $this->db->sql_freeresult($result); + + if (!$total_results) + { + return false; + } + } + + if ($start >= $total_results) + { + $start = floor(($total_results - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + } + + if (count($id_ary)) + { + $this->save_ids($search_key, '', $author_ary, $total_results, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, $per_page); + + return $total_results; + } + return false; + } + + /** + * Split a text into words of a given length + * + * The text is converted to UTF-8, cleaned up, and split. Then, words that + * conform to the defined length range are returned in an array. + * + * NOTE: duplicates are NOT removed from the return array + * + * @param string $text Text to split, encoded in UTF-8 + * @return array Array of UTF-8 words + */ + public function split_message($text) + { + $match = $words = array(); + + /** + * Taken from the original code + */ + // Do not index code + $match[] = '#\[code(?:=.*?)?(\:?[0-9a-z]{5,})\].*?\[\/code(\:?[0-9a-z]{5,})\]#is'; + // BBcode + $match[] = '#\[\/?[a-z0-9\*\+\-]+(?:=.*?)?(?::[a-z])?(\:?[0-9a-z]{5,})\]#'; + + $min = $this->word_length['min']; + + $isset_min = $min - 1; + + /** + * Clean up the string, remove HTML tags, remove BBCodes + */ + $word = strtok($this->cleanup(preg_replace($match, ' ', strip_tags($text)), -1), ' '); + + while (strlen($word)) + { + if (strlen($word) > 255 || strlen($word) <= $isset_min) + { + /** + * Words longer than 255 bytes are ignored. This will have to be + * changed whenever we change the length of search_wordlist.word_text + * + * Words shorter than $isset_min bytes are ignored, too + */ + $word = strtok(' '); + continue; + } + + $len = utf8_strlen($word); + + /** + * Test whether the word is too short to be indexed. + * + * Note that this limit does NOT apply to CJK and Hangul + */ + if ($len < $min) + { + /** + * Note: this could be optimized. If the codepoint is lower than Hangul's range + * we know that it will also be lower than CJK ranges + */ + if ((strncmp($word, self::UTF8_HANGUL_FIRST, 3) < 0 || strncmp($word, self::UTF8_HANGUL_LAST, 3) > 0) + && (strncmp($word, self::UTF8_CJK_FIRST, 3) < 0 || strncmp($word, self::UTF8_CJK_LAST, 3) > 0) + && (strncmp($word, self::UTF8_CJK_B_FIRST, 4) < 0 || strncmp($word, self::UTF8_CJK_B_LAST, 4) > 0)) + { + $word = strtok(' '); + continue; + } + } + + $words[] = $word; + $word = strtok(' '); + } + + return $words; + } + + /** + * Updates wordlist and wordmatch tables when a message is posted or changed + * + * @param string $mode Contains the post mode: edit, post, reply, quote + * @param int $post_id The id of the post which is modified/created + * @param string &$message New or updated post content + * @param string &$subject New or updated post subject + * @param int $poster_id Post author's user id + * @param int $forum_id The id of the forum in which the post is located + */ + public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) + { + if (!$this->config['fulltext_native_load_upd']) + { + /** + * The search indexer is disabled, return + */ + return; + } + + // Split old and new post/subject to obtain array of 'words' + $split_text = $this->split_message($message); + $split_title = $this->split_message($subject); + + $cur_words = array('post' => array(), 'title' => array()); + + $words = array(); + if ($mode == 'edit') + { + $words['add']['post'] = array(); + $words['add']['title'] = array(); + $words['del']['post'] = array(); + $words['del']['title'] = array(); + + $sql = 'SELECT w.word_id, w.word_text, m.title_match + FROM ' . SEARCH_WORDLIST_TABLE . ' w, ' . SEARCH_WORDMATCH_TABLE . " m + WHERE m.post_id = $post_id + AND w.word_id = m.word_id"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $which = ($row['title_match']) ? 'title' : 'post'; + $cur_words[$which][$row['word_text']] = $row['word_id']; + } + $this->db->sql_freeresult($result); + + $words['add']['post'] = array_diff($split_text, array_keys($cur_words['post'])); + $words['add']['title'] = array_diff($split_title, array_keys($cur_words['title'])); + $words['del']['post'] = array_diff(array_keys($cur_words['post']), $split_text); + $words['del']['title'] = array_diff(array_keys($cur_words['title']), $split_title); + } + else + { + $words['add']['post'] = $split_text; + $words['add']['title'] = $split_title; + $words['del']['post'] = array(); + $words['del']['title'] = array(); + } + + /** + * Event to modify method arguments and words before the native search index is updated + * + * @event core.search_native_index_before + * @var string mode Contains the post mode: edit, post, reply, quote + * @var int post_id The id of the post which is modified/created + * @var string message New or updated post content + * @var string subject New or updated post subject + * @var int poster_id Post author's user id + * @var int forum_id The id of the forum in which the post is located + * @var array words Grouped lists of words added to or remove from the index + * @var array split_text Array of words from the message + * @var array split_title Array of words from the title + * @var array cur_words Array of words currently in the index for comparing to new words + * when mode is edit. Empty for other modes. + * @since 3.2.3-RC1 + */ + $vars = array( + 'mode', + 'post_id', + 'message', + 'subject', + 'poster_id', + 'forum_id', + 'words', + 'split_text', + 'split_title', + 'cur_words', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_index_before', compact($vars))); + + unset($split_text); + unset($split_title); + + // Get unique words from the above arrays + $unique_add_words = array_unique(array_merge($words['add']['post'], $words['add']['title'])); + + // We now have unique arrays of all words to be added and removed and + // individual arrays of added and removed words for text and title. What + // we need to do now is add the new words (if they don't already exist) + // and then add (or remove) matches between the words and this post + if (count($unique_add_words)) + { + $sql = 'SELECT word_id, word_text + FROM ' . SEARCH_WORDLIST_TABLE . ' + WHERE ' . $this->db->sql_in_set('word_text', $unique_add_words); + $result = $this->db->sql_query($sql); + + $word_ids = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $word_ids[$row['word_text']] = $row['word_id']; + } + $this->db->sql_freeresult($result); + $new_words = array_diff($unique_add_words, array_keys($word_ids)); + + $this->db->sql_transaction('begin'); + if (count($new_words)) + { + $sql_ary = array(); + + foreach ($new_words as $word) + { + $sql_ary[] = array('word_text' => (string) $word, 'word_count' => 0); + } + $this->db->sql_return_on_error(true); + $this->db->sql_multi_insert(SEARCH_WORDLIST_TABLE, $sql_ary); + $this->db->sql_return_on_error(false); + } + unset($new_words, $sql_ary); + } + else + { + $this->db->sql_transaction('begin'); + } + + // now update the search match table, remove links to removed words and add links to new words + foreach ($words['del'] as $word_in => $word_ary) + { + $title_match = ($word_in == 'title') ? 1 : 0; + + if (count($word_ary)) + { + $sql_in = array(); + foreach ($word_ary as $word) + { + $sql_in[] = $cur_words[$word_in][$word]; + } + + $sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . ' + WHERE ' . $this->db->sql_in_set('word_id', $sql_in) . ' + AND post_id = ' . intval($post_id) . " + AND title_match = $title_match"; + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' + SET word_count = word_count - 1 + WHERE ' . $this->db->sql_in_set('word_id', $sql_in) . ' + AND word_count > 0'; + $this->db->sql_query($sql); + + unset($sql_in); + } + } + + $this->db->sql_return_on_error(true); + foreach ($words['add'] as $word_in => $word_ary) + { + $title_match = ($word_in == 'title') ? 1 : 0; + + if (count($word_ary)) + { + $sql = 'INSERT INTO ' . SEARCH_WORDMATCH_TABLE . ' (post_id, word_id, title_match) + SELECT ' . (int) $post_id . ', word_id, ' . (int) $title_match . ' + FROM ' . SEARCH_WORDLIST_TABLE . ' + WHERE ' . $this->db->sql_in_set('word_text', $word_ary); + $this->db->sql_query($sql); + + $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' + SET word_count = word_count + 1 + WHERE ' . $this->db->sql_in_set('word_text', $word_ary); + $this->db->sql_query($sql); + } + } + $this->db->sql_return_on_error(false); + + $this->db->sql_transaction('commit'); + + // destroy cached search results containing any of the words removed or added + $this->destroy_cache(array_unique(array_merge($words['add']['post'], $words['add']['title'], $words['del']['post'], $words['del']['title'])), array($poster_id)); + + unset($unique_add_words); + unset($words); + unset($cur_words); + } + + /** + * Removes entries from the wordmatch table for the specified post_ids + */ + public function index_remove($post_ids, $author_ids, $forum_ids) + { + if (count($post_ids)) + { + $sql = 'SELECT w.word_id, w.word_text, m.title_match + FROM ' . SEARCH_WORDMATCH_TABLE . ' m, ' . SEARCH_WORDLIST_TABLE . ' w + WHERE ' . $this->db->sql_in_set('m.post_id', $post_ids) . ' + AND w.word_id = m.word_id'; + $result = $this->db->sql_query($sql); + + $message_word_ids = $title_word_ids = $word_texts = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + if ($row['title_match']) + { + $title_word_ids[] = $row['word_id']; + } + else + { + $message_word_ids[] = $row['word_id']; + } + $word_texts[] = $row['word_text']; + } + $this->db->sql_freeresult($result); + + if (count($title_word_ids)) + { + $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' + SET word_count = word_count - 1 + WHERE ' . $this->db->sql_in_set('word_id', $title_word_ids) . ' + AND word_count > 0'; + $this->db->sql_query($sql); + } + + if (count($message_word_ids)) + { + $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' + SET word_count = word_count - 1 + WHERE ' . $this->db->sql_in_set('word_id', $message_word_ids) . ' + AND word_count > 0'; + $this->db->sql_query($sql); + } + + unset($title_word_ids); + unset($message_word_ids); + + $sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . ' + WHERE ' . $this->db->sql_in_set('post_id', $post_ids); + $this->db->sql_query($sql); + } + + $this->destroy_cache(array_unique($word_texts), array_unique($author_ids)); + } + + /** + * Tidy up indexes: Tag 'common words' and remove + * words no longer referenced in the match table + */ + public function tidy() + { + // Is the fulltext indexer disabled? If yes then we need not + // carry on ... it's okay ... I know when I'm not wanted boo hoo + if (!$this->config['fulltext_native_load_upd']) + { + $this->config->set('search_last_gc', time(), false); + return; + } + + $destroy_cache_words = array(); + + // Remove common words + if ($this->config['num_posts'] >= 100 && $this->config['fulltext_native_common_thres']) + { + $common_threshold = ((double) $this->config['fulltext_native_common_thres']) / 100.0; + // First, get the IDs of common words + $sql = 'SELECT word_id, word_text + FROM ' . SEARCH_WORDLIST_TABLE . ' + WHERE word_count > ' . floor($this->config['num_posts'] * $common_threshold) . ' + OR word_common = 1'; + $result = $this->db->sql_query($sql); + + $sql_in = array(); + while ($row = $this->db->sql_fetchrow($result)) + { + $sql_in[] = $row['word_id']; + $destroy_cache_words[] = $row['word_text']; + } + $this->db->sql_freeresult($result); + + if (count($sql_in)) + { + // Flag the words + $sql = 'UPDATE ' . SEARCH_WORDLIST_TABLE . ' + SET word_common = 1 + WHERE ' . $this->db->sql_in_set('word_id', $sql_in); + $this->db->sql_query($sql); + + // by setting search_last_gc to the new time here we make sure that if a user reloads because the + // following query takes too long, he won't run into it again + $this->config->set('search_last_gc', time(), false); + + // Delete the matches + $sql = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE . ' + WHERE ' . $this->db->sql_in_set('word_id', $sql_in); + $this->db->sql_query($sql); + } + unset($sql_in); + } + + if (count($destroy_cache_words)) + { + // destroy cached search results containing any of the words that are now common or were removed + $this->destroy_cache(array_unique($destroy_cache_words)); + } + + $this->config->set('search_last_gc', time(), false); + } + + /** + * Deletes all words from the index + */ + public function delete_index($acp_module, $u_action) + { + $sql_queries = []; + + switch ($this->db->get_sql_layer()) + { + case 'sqlite3': + $sql_queries[] = 'DELETE FROM ' . SEARCH_WORDLIST_TABLE; + $sql_queries[] = 'DELETE FROM ' . SEARCH_WORDMATCH_TABLE; + $sql_queries[] = 'DELETE FROM ' . SEARCH_RESULTS_TABLE; + break; + + default: + $sql_queries[] = 'TRUNCATE TABLE ' . SEARCH_WORDLIST_TABLE; + $sql_queries[] = 'TRUNCATE TABLE ' . SEARCH_WORDMATCH_TABLE; + $sql_queries[] = 'TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE; + break; + } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the native search index is deleted + * + * @event core.search_native_delete_index_before + * @var array sql_queries Array with queries for deleting the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_native_delete_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } + } + + /** + * Returns true if both FULLTEXT indexes exist + */ + public function index_created() + { + if (!count($this->stats)) + { + $this->get_stats(); + } + + return ($this->stats['total_words'] && $this->stats['total_matches']) ? true : false; + } + + /** + * Returns an associative array containing information about the indexes + */ + public function index_stats() + { + if (!count($this->stats)) + { + $this->get_stats(); + } + + return array( + $this->user->lang['TOTAL_WORDS'] => $this->stats['total_words'], + $this->user->lang['TOTAL_MATCHES'] => $this->stats['total_matches']); + } + + protected function get_stats() + { + $this->stats['total_words'] = $this->db->get_estimated_row_count(SEARCH_WORDLIST_TABLE); + $this->stats['total_matches'] = $this->db->get_estimated_row_count(SEARCH_WORDMATCH_TABLE); + } + + /** + * Clean up a text to remove non-alphanumeric characters + * + * This method receives a UTF-8 string, normalizes and validates it, replaces all + * non-alphanumeric characters with strings then returns the result. + * + * Any number of "allowed chars" can be passed as a UTF-8 string in NFC. + * + * @param string $text Text to split, in UTF-8 (not normalized or sanitized) + * @param string $allowed_chars String of special chars to allow + * @param string $encoding Text encoding + * @return string Cleaned up text, only alphanumeric chars are left + */ + protected function cleanup($text, $allowed_chars = null, $encoding = 'utf-8') + { + static $conv = array(), $conv_loaded = array(); + $allow = array(); + + // Convert the text to UTF-8 + $encoding = strtolower($encoding); + if ($encoding != 'utf-8') + { + $text = utf8_recode($text, $encoding); + } + + $utf_len_mask = array( + "\xC0" => 2, + "\xD0" => 2, + "\xE0" => 3, + "\xF0" => 4 + ); + + /** + * Replace HTML entities and NCRs + */ + $text = htmlspecialchars_decode(utf8_decode_ncr($text), ENT_QUOTES); + + /** + * Normalize to NFC + */ + $text = \Normalizer::normalize($text); + + /** + * The first thing we do is: + * + * - convert ASCII-7 letters to lowercase + * - remove the ASCII-7 non-alpha characters + * - remove the bytes that should not appear in a valid UTF-8 string: 0xC0, + * 0xC1 and 0xF5-0xFF + * + * @todo in theory, the third one is already taken care of during normalization and those chars should have been replaced by Unicode replacement chars + */ + $sb_match = "ISTCPAMELRDOJBNHFGVWUQKYXZ\r\n\t!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\xC0\xC1\xF5\xF6\xF7\xF8\xF9\xFA\xFB\xFC\xFD\xFE\xFF"; + $sb_replace = 'istcpamelrdojbnhfgvwuqkyxz '; + + /** + * This is the list of legal ASCII chars, it is automatically extended + * with ASCII chars from $allowed_chars + */ + $legal_ascii = ' eaisntroludcpmghbfvq10xy2j9kw354867z'; + + /** + * Prepare an array containing the extra chars to allow + */ + if (isset($allowed_chars[0])) + { + $pos = 0; + $len = strlen($allowed_chars); + do + { + $c = $allowed_chars[$pos]; + + if ($c < "\x80") + { + /** + * ASCII char + */ + $sb_pos = strpos($sb_match, $c); + if (is_int($sb_pos)) + { + /** + * Remove the char from $sb_match and its corresponding + * replacement in $sb_replace + */ + $sb_match = substr($sb_match, 0, $sb_pos) . substr($sb_match, $sb_pos + 1); + $sb_replace = substr($sb_replace, 0, $sb_pos) . substr($sb_replace, $sb_pos + 1); + $legal_ascii .= $c; + } + + ++$pos; + } + else + { + /** + * UTF-8 char + */ + $utf_len = $utf_len_mask[$c & "\xF0"]; + $allow[substr($allowed_chars, $pos, $utf_len)] = 1; + $pos += $utf_len; + } + } + while ($pos < $len); + } + + $text = strtr($text, $sb_match, $sb_replace); + $ret = ''; + + $pos = 0; + $len = strlen($text); + + do + { + /** + * Do all consecutive ASCII chars at once + */ + if ($spn = strspn($text, $legal_ascii, $pos)) + { + $ret .= substr($text, $pos, $spn); + $pos += $spn; + } + + if ($pos >= $len) + { + return $ret; + } + + /** + * Capture the UTF char + */ + $utf_len = $utf_len_mask[$text[$pos] & "\xF0"]; + $utf_char = substr($text, $pos, $utf_len); + $pos += $utf_len; + + if (($utf_char >= self::UTF8_HANGUL_FIRST && $utf_char <= self::UTF8_HANGUL_LAST) + || ($utf_char >= self::UTF8_CJK_FIRST && $utf_char <= self::UTF8_CJK_LAST) + || ($utf_char >= self::UTF8_CJK_B_FIRST && $utf_char <= self::UTF8_CJK_B_LAST)) + { + /** + * All characters within these ranges are valid + * + * We separate them with a space in order to index each character + * individually + */ + $ret .= ' ' . $utf_char . ' '; + continue; + } + + if (isset($allow[$utf_char])) + { + /** + * The char is explicitly allowed + */ + $ret .= $utf_char; + continue; + } + + if (isset($conv[$utf_char])) + { + /** + * The char is mapped to something, maybe to itself actually + */ + $ret .= $conv[$utf_char]; + continue; + } + + /** + * The char isn't mapped, but did we load its conversion table? + * + * The search indexer table is split into blocks. The block number of + * each char is equal to its codepoint right-shifted for 11 bits. It + * means that out of the 11, 16 or 21 meaningful bits of a 2-, 3- or + * 4- byte sequence we only keep the leftmost 0, 5 or 10 bits. Thus, + * all UTF chars encoded in 2 bytes are in the same first block. + */ + if (isset($utf_char[2])) + { + if (isset($utf_char[3])) + { + /** + * 1111 0nnn 10nn nnnn 10nx xxxx 10xx xxxx + * 0000 0111 0011 1111 0010 0000 + */ + $idx = ((ord($utf_char[0]) & 0x07) << 7) | ((ord($utf_char[1]) & 0x3F) << 1) | ((ord($utf_char[2]) & 0x20) >> 5); + } + else + { + /** + * 1110 nnnn 10nx xxxx 10xx xxxx + * 0000 0111 0010 0000 + */ + $idx = ((ord($utf_char[0]) & 0x07) << 1) | ((ord($utf_char[1]) & 0x20) >> 5); + } + } + else + { + /** + * 110x xxxx 10xx xxxx + * 0000 0000 0000 0000 + */ + $idx = 0; + } + + /** + * Check if the required conv table has been loaded already + */ + if (!isset($conv_loaded[$idx])) + { + $conv_loaded[$idx] = 1; + $file = $this->phpbb_root_path . 'includes/utf/data/search_indexer_' . $idx . '.' . $this->php_ext; + + if (file_exists($file)) + { + $conv += include($file); + } + } + + if (isset($conv[$utf_char])) + { + $ret .= $conv[$utf_char]; + } + else + { + /** + * We add an entry to the conversion table so that we + * don't have to convert to codepoint and perform the checks + * that are above this block + */ + $conv[$utf_char] = ' '; + $ret .= ' '; + } + } + while (1); + + return $ret; + } + + /** + * Returns a list of options for the ACP to display + */ + public function acp() + { + /** + * if we need any options, copied from fulltext_native for now, will have to be adjusted or removed + */ + + $tpl = ' +
+

' . $this->user->lang['YES_SEARCH_UPDATE_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['MIN_SEARCH_CHARS_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['MAX_SEARCH_CHARS_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['COMMON_WORD_THRESHOLD_EXPLAIN'] . '
+
%
+
+ '; + + // These are fields required in the config table + return array( + 'tpl' => $tpl, + 'config' => array('fulltext_native_load_upd' => 'bool', 'fulltext_native_min_chars' => 'integer:0:255', 'fulltext_native_max_chars' => 'integer:0:255', 'fulltext_native_common_thres' => 'double:0:100') + ); + } +} diff --git a/install/update/old/phpbb/search/fulltext_postgres.php b/install/update/old/phpbb/search/fulltext_postgres.php new file mode 100644 index 0000000..2f387e7 --- /dev/null +++ b/install/update/old/phpbb/search/fulltext_postgres.php @@ -0,0 +1,1178 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\search; + +/** +* Fulltext search for PostgreSQL +*/ +class fulltext_postgres extends \phpbb\search\base +{ + /** + * Associative array holding index stats + * @var array + */ + protected $stats = array(); + + /** + * Holds the words entered by user, obtained by splitting the entered query on whitespace + * @var array + */ + protected $split_words = array(); + + /** + * Stores the tsearch query + * @var string + */ + protected $tsearch_query; + + /** + * True if phrase search is supported. + * PostgreSQL fulltext currently doesn't support it + * @var boolean + */ + protected $phrase_search = false; + + /** + * Config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Database connection + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Contains tidied search query. + * Operators are prefixed in search query and common words excluded + * @var string + */ + protected $search_query; + + /** + * Contains common words. + * Common words are words with length less/more than min/max length + * @var array + */ + protected $common_words = array(); + + /** + * Associative array stores the min and max word length to be searched + * @var array + */ + protected $word_length = array(); + + /** + * Constructor + * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend + * + * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + */ + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) + { + $this->config = $config; + $this->db = $db; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->user = $user; + + $this->word_length = array('min' => $this->config['fulltext_postgres_min_word_len'], 'max' => $this->config['fulltext_postgres_max_word_len']); + + /** + * Load the UTF tools + */ + if (!function_exists('utf8_strlen')) + { + include($phpbb_root_path . 'includes/utf/utf_tools.' . $phpEx); + } + + $error = false; + } + + /** + * Returns the name of this search backend to be displayed to administrators + * + * @return string Name + */ + public function get_name() + { + return 'PostgreSQL Fulltext'; + } + + /** + * Returns the search_query + * + * @return string search query + */ + public function get_search_query() + { + return $this->search_query; + } + + /** + * Returns the common_words array + * + * @return array common words that are ignored by search backend + */ + public function get_common_words() + { + return $this->common_words; + } + + /** + * Returns the word_length array + * + * @return array min and max word length for searching + */ + public function get_word_length() + { + return $this->word_length; + } + + /** + * Returns if phrase search is supported or not + * + * @return bool + */ + public function supports_phrase_search() + { + return $this->phrase_search; + } + + /** + * Checks for correct PostgreSQL version and stores min/max word length in the config + * + * @return string|bool Language key of the error/incompatiblity occurred + */ + public function init() + { + if ($this->db->get_sql_layer() != 'postgres') + { + return $this->user->lang['FULLTEXT_POSTGRES_INCOMPATIBLE_DATABASE']; + } + + return false; + } + + /** + * Splits keywords entered by a user into an array of words stored in $this->split_words + * Stores the tidied search query in $this->search_query + * + * @param string &$keywords Contains the keyword as entered by the user + * @param string $terms is either 'all' or 'any' + * @return bool false if no valid keywords were found and otherwise true + */ + public function split_keywords(&$keywords, $terms) + { + if ($terms == 'all') + { + $match = array('#\sand\s#iu', '#\sor\s#iu', '#\snot\s#iu', '#(^|\s)\+#', '#(^|\s)-#', '#(^|\s)\|#'); + $replace = array(' +', ' |', ' -', ' +', ' -', ' |'); + + $keywords = preg_replace($match, $replace, $keywords); + } + + // Filter out as above + $split_keywords = preg_replace("#[\"\n\r\t]+#", ' ', trim(htmlspecialchars_decode($keywords))); + + // Split words + $split_keywords = preg_replace('#([^\p{L}\p{N}\'*"()])#u', '$1$1', str_replace('\'\'', '\' \'', trim($split_keywords))); + $matches = array(); + preg_match_all('#(?:[^\p{L}\p{N}*"()]|^)([+\-|]?(?:[\p{L}\p{N}*"()]+\'?)*[\p{L}\p{N}*"()])(?:[^\p{L}\p{N}*"()]|$)#u', $split_keywords, $matches); + $this->split_words = $matches[1]; + + foreach ($this->split_words as $i => $word) + { + $clean_word = preg_replace('#^[+\-|"]#', '', $word); + + // check word length + $clean_len = utf8_strlen(str_replace('*', '', $clean_word)); + if (($clean_len < $this->config['fulltext_postgres_min_word_len']) || ($clean_len > $this->config['fulltext_postgres_max_word_len'])) + { + $this->common_words[] = $word; + unset($this->split_words[$i]); + } + } + + if ($terms == 'any') + { + $this->search_query = ''; + $this->tsearch_query = ''; + foreach ($this->split_words as $word) + { + if ((strpos($word, '+') === 0) || (strpos($word, '-') === 0) || (strpos($word, '|') === 0)) + { + $word = substr($word, 1); + } + $this->search_query .= $word . ' '; + $this->tsearch_query .= '|' . $word . ' '; + } + } + else + { + $this->search_query = ''; + $this->tsearch_query = ''; + foreach ($this->split_words as $word) + { + if (strpos($word, '+') === 0) + { + $this->search_query .= $word . ' '; + $this->tsearch_query .= '&' . substr($word, 1) . ' '; + } + else if (strpos($word, '-') === 0) + { + $this->search_query .= $word . ' '; + $this->tsearch_query .= '&!' . substr($word, 1) . ' '; + } + else if (strpos($word, '|') === 0) + { + $this->search_query .= $word . ' '; + $this->tsearch_query .= '|' . substr($word, 1) . ' '; + } + else + { + $this->search_query .= '+' . $word . ' '; + $this->tsearch_query .= '&' . $word . ' '; + } + } + } + + $this->tsearch_query = substr($this->tsearch_query, 1); + $this->search_query = utf8_htmlspecialchars($this->search_query); + + if ($this->search_query) + { + $this->split_words = array_values($this->split_words); + sort($this->split_words); + return true; + } + return false; + } + + /** + * Turns text into an array of words + * @param string $text contains post text/subject + */ + public function split_message($text) + { + // Split words + $text = preg_replace('#([^\p{L}\p{N}\'*])#u', '$1$1', str_replace('\'\'', '\' \'', trim($text))); + $matches = array(); + preg_match_all('#(?:[^\p{L}\p{N}*]|^)([+\-|]?(?:[\p{L}\p{N}*]+\'?)*[\p{L}\p{N}*])(?:[^\p{L}\p{N}*]|$)#u', $text, $matches); + $text = $matches[1]; + + // remove too short or too long words + $text = array_values($text); + for ($i = 0, $n = count($text); $i < $n; $i++) + { + $text[$i] = trim($text[$i]); + if (utf8_strlen($text[$i]) < $this->config['fulltext_postgres_min_word_len'] || utf8_strlen($text[$i]) > $this->config['fulltext_postgres_max_word_len']) + { + unset($text[$i]); + } + } + + return array_values($text); + } + + /** + * Performs a search on keywords depending on display specific params. You have to run split_keywords() first + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param string $fields contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched) + * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @return boolean|int total number of results + */ + public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No keywords? No posts + if (!$this->search_query) + { + return false; + } + + // When search query contains queries like -foo + if (strpos($this->search_query, '+') === false) + { + return false; + } + + // generate a search_key from all the options to identify the results + $search_key_array = array( + implode(', ', $this->split_words), + $type, + $fields, + $terms, + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary) + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_postgres_by_keyword_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_by_keyword_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + if ($start < 0) + { + $start = 0; + } + + // try reading the results from cache + $result_count = 0; + if ($this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $result_count; + } + + $id_ary = array(); + + $join_topic = ($type == 'posts') ? false : true; + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_sort_table = $sql_sort_join = ''; + + switch ($sql_sort[0]) + { + case 'u': + $sql_sort_table = USERS_TABLE . ' u, '; + $sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster '; + break; + + case 't': + $join_topic = true; + break; + + case 'f': + $sql_sort_table = FORUMS_TABLE . ' f, '; + $sql_sort_join = ' AND f.forum_id = p.forum_id '; + break; + } + + // Build some display specific sql strings + switch ($fields) + { + case 'titleonly': + $sql_match = 'p.post_subject'; + $sql_match_where = ' AND p.post_id = t.topic_first_post_id'; + $join_topic = true; + break; + + case 'msgonly': + $sql_match = 'p.post_text'; + $sql_match_where = ''; + break; + + case 'firstpost': + $sql_match = 'p.post_subject, p.post_text'; + $sql_match_where = ' AND p.post_id = t.topic_first_post_id'; + $join_topic = true; + break; + + default: + $sql_match = 'p.post_subject, p.post_text'; + $sql_match_where = ''; + break; + } + + $tsearch_query = $this->tsearch_query; + + /** + * Allow changing the query used to search for posts using fulltext_postgres + * + * @event core.search_postgres_keywords_main_query_before + * @var string tsearch_query The parsed keywords used for this search + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var bool join_topic Weather or not TOPICS_TABLE should be CROSS JOIN'ED + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on (!empty(author_ary) must be true, to be relevant) + * @var array ex_fid_ary Which forums not to search on + * @var int topic_id Limit the search to this topic_id only + * @var string sql_sort_table Extra tables to include in the SQL query. + * Used in conjunction with sql_sort_join + * @var string sql_sort_join SQL conditions to join all the tables used together. + * Used in conjunction with sql_sort_table + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sql_match Which columns to do the search on. + * @var string sql_match_where Extra conditions to use to properly filter the matching process + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'tsearch_query', + 'result_count', + 'join_topic', + 'author_ary', + 'author_name', + 'ex_fid_ary', + 'topic_id', + 'sql_sort_table', + 'sql_sort_join', + 'sort_days', + 'sql_match', + 'sql_match_where', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_keywords_main_query_before', compact($vars))); + + $sql_select = ($type == 'posts') ? 'p.post_id' : 'DISTINCT t.topic_id, ' . $sort_by_sql[$sort_key]; + $sql_from = ($join_topic) ? TOPICS_TABLE . ' t, ' : ''; + $field = ($type == 'posts') ? 'post_id' : 'topic_id'; + + if (count($author_ary) && $author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else if (count($author_ary)) + { + $sql_author = ' AND ' . $this->db->sql_in_set('p.poster_id', $author_ary); + } + else + { + $sql_author = ''; + } + + $sql_where_options = $sql_sort_join; + $sql_where_options .= ($topic_id) ? ' AND p.topic_id = ' . $topic_id : ''; + $sql_where_options .= ($join_topic) ? ' AND t.topic_id = p.topic_id' : ''; + $sql_where_options .= (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_where_options .= ' AND ' . $post_visibility; + $sql_where_options .= $sql_author; + $sql_where_options .= ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $sql_where_options .= $sql_match_where; + + $sql_match = str_replace(',', " || ' ' ||", $sql_match); + $tmp_sql_match = "to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', " . $sql_match . ") @@ to_tsquery ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', '" . $this->db->sql_escape($this->tsearch_query) . "')"; + + $this->db->sql_transaction('begin'); + + $sql_from = "FROM $sql_from$sql_sort_table" . POSTS_TABLE . " p"; + $sql_where = "WHERE (" . $tmp_sql_match . ") + $sql_where_options"; + $sql = "SELECT $sql_select + $sql_from + $sql_where + ORDER BY $sql_sort"; + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + + // if the total result count is not cached yet, retrieve it from the db + if (!$result_count) + { + $sql_count = "SELECT COUNT(*) as result_count + $sql_from + $sql_where"; + $result = $this->db->sql_query($sql_count); + $result_count = (int) $this->db->sql_fetchfield('result_count'); + $this->db->sql_freeresult($result); + + if (!$result_count) + { + return false; + } + } + + $this->db->sql_transaction('commit'); + + if ($start >= $result_count) + { + $start = floor(($result_count - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + } + + // store the ids, from start on then delete anything that isn't on the current page because we only need ids for one page + $this->save_ids($search_key, implode(' ', $this->split_words), $author_ary, $result_count, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, (int) $per_page); + + return $result_count; + } + + /** + * Performs a search on an author's posts without caring about message contents. Depends on display specific params + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param boolean $firstpost_only if true, only topic starting posts will be considered + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @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, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + // No author? No posts + if (!count($author_ary)) + { + return 0; + } + + // generate a search_key from all the options to identify the results + $search_key_array = array( + '', + $type, + ($firstpost_only) ? 'firstpost' : '', + '', + '', + $sort_days, + $sort_key, + $topic_id, + implode(',', $ex_fid_ary), + $post_visibility, + implode(',', $author_ary), + $author_name, + ); + + /** + * Allow changing the search_key for cached results + * + * @event core.search_postgres_by_author_modify_search_key + * @var array search_key_array Array with search parameters to generate the search_key + * @var string type Searching type ('posts', 'topics') + * @var boolean firstpost_only Flag indicating if only topic starting posts are considered + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @since 3.1.7-RC1 + */ + $vars = array( + 'search_key_array', + 'type', + 'firstpost_only', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_by_author_modify_search_key', compact($vars))); + + $search_key = md5(implode('#', $search_key_array)); + + if ($start < 0) + { + $start = 0; + } + + // try reading the results from cache + $result_count = 0; + if ($this->obtain_ids($search_key, $result_count, $id_ary, $start, $per_page, $sort_dir) == SEARCH_RESULT_IN_CACHE) + { + return $result_count; + } + + $id_ary = array(); + + // Create some display specific sql strings + if ($author_name) + { + // first one matches post of registered users, second one guests and deleted users + $sql_author = '(' . $this->db->sql_in_set('p.poster_id', array_diff($author_ary, array(ANONYMOUS)), false, true) . ' OR p.post_username ' . $author_name . ')'; + } + else + { + $sql_author = $this->db->sql_in_set('p.poster_id', $author_ary); + } + $sql_fora = (count($ex_fid_ary)) ? ' AND ' . $this->db->sql_in_set('p.forum_id', $ex_fid_ary, true) : ''; + $sql_topic_id = ($topic_id) ? ' AND p.topic_id = ' . (int) $topic_id : ''; + $sql_time = ($sort_days) ? ' AND p.post_time >= ' . (time() - ($sort_days * 86400)) : ''; + $sql_firstpost = ($firstpost_only) ? ' AND p.post_id = t.topic_first_post_id' : ''; + + // Build sql strings for sorting + $sql_sort = $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + $sql_sort_table = $sql_sort_join = ''; + switch ($sql_sort[0]) + { + case 'u': + $sql_sort_table = USERS_TABLE . ' u, '; + $sql_sort_join = ($type == 'posts') ? ' AND u.user_id = p.poster_id ' : ' AND u.user_id = t.topic_poster '; + break; + + case 't': + $sql_sort_table = ($type == 'posts' && !$firstpost_only) ? TOPICS_TABLE . ' t, ' : ''; + $sql_sort_join = ($type == 'posts' && !$firstpost_only) ? ' AND t.topic_id = p.topic_id ' : ''; + break; + + case 'f': + $sql_sort_table = FORUMS_TABLE . ' f, '; + $sql_sort_join = ' AND f.forum_id = p.forum_id '; + break; + } + + $m_approve_fid_sql = ' AND ' . $post_visibility; + + /** + * Allow changing the query used to search for posts by author in fulltext_postgres + * + * @event core.search_postgres_author_count_query_before + * @var int result_count The previous result count for the format of the query. + * Set to 0 to force a re-count + * @var string sql_sort_table CROSS JOIN'ed table to allow doing the sort chosen + * @var string sql_sort_join Condition to define how to join the CROSS JOIN'ed table specifyed in sql_sort_table + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name An extra username to search on + * @var string sql_author SQL WHERE condition for the post author ids + * @var int topic_id Limit the search to this topic_id only + * @var string sql_topic_id SQL of topic_id + * @var string sort_by_sql The possible predefined sort types + * @var string sort_key The sort type used from the possible sort types + * @var string sort_dir "a" for ASC or "d" dor DESC for the sort order used + * @var string sql_sort The result SQL when processing sort_by_sql + sort_key + sort_dir + * @var string sort_days Time, in days, that the oldest post showing can have + * @var string sql_time The SQL to search on the time specifyed by sort_days + * @var bool firstpost_only Wether or not to search only on the first post of the topics + * @var array ex_fid_ary Forum ids that must not be searched on + * @var array sql_fora SQL query for ex_fid_ary + * @var string m_approve_fid_sql WHERE clause condition on post_visibility restrictions + * @var int start How many posts to skip in the search results (used for pagination) + * @since 3.1.5-RC1 + */ + $vars = array( + 'result_count', + 'sql_sort_table', + 'sql_sort_join', + 'author_ary', + 'author_name', + 'sql_author', + 'topic_id', + 'sql_topic_id', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sql_sort', + 'sort_days', + 'sql_time', + 'firstpost_only', + 'ex_fid_ary', + 'sql_fora', + 'm_approve_fid_sql', + 'start', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_author_count_query_before', compact($vars))); + + // Build the query for really selecting the post_ids + if ($type == 'posts') + { + $sql = "SELECT p.post_id + FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . " + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + $sql_sort_join + $sql_time + ORDER BY $sql_sort"; + $field = 'post_id'; + } + else + { + $sql = "SELECT t.topic_id + FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + AND t.topic_id = p.topic_id + $sql_sort_join + $sql_time + GROUP BY t.topic_id, $sort_by_sql[$sort_key] + ORDER BY $sql_sort"; + $field = 'topic_id'; + } + + $this->db->sql_transaction('begin'); + + // Only read one block of posts from the db and then cache it + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = $row[$field]; + } + $this->db->sql_freeresult($result); + + // retrieve the total result count if needed + if (!$result_count) + { + if ($type == 'posts') + { + $sql_count = "SELECT COUNT(*) as result_count + FROM " . $sql_sort_table . POSTS_TABLE . ' p' . (($firstpost_only) ? ', ' . TOPICS_TABLE . ' t ' : ' ') . " + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + $sql_sort_join + $sql_time"; + } + else + { + $sql_count = "SELECT COUNT(*) as result_count + FROM " . $sql_sort_table . TOPICS_TABLE . ' t, ' . POSTS_TABLE . " p + WHERE $sql_author + $sql_topic_id + $sql_firstpost + $m_approve_fid_sql + $sql_fora + AND t.topic_id = p.topic_id + $sql_sort_join + $sql_time + GROUP BY t.topic_id, $sort_by_sql[$sort_key]"; + } + + $this->db->sql_query($sql_count); + $result_count = (int) $this->db->sql_fetchfield('result_count'); + + if (!$result_count) + { + return false; + } + } + + $this->db->sql_transaction('commit'); + + if ($start >= $result_count) + { + $start = floor(($result_count - 1) / $per_page) * $per_page; + + $result = $this->db->sql_query_limit($sql, $this->config['search_block_size'], $start); + while ($row = $this->db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $this->db->sql_freeresult($result); + + $id_ary = array_unique($id_ary); + } + + if (count($id_ary)) + { + $this->save_ids($search_key, '', $author_ary, $result_count, $id_ary, $start, $sort_dir); + $id_ary = array_slice($id_ary, 0, $per_page); + + return $result_count; + } + return false; + } + + /** + * Destroys cached search results, that contained one of the new words in a post so the results won't be outdated + * + * @param string $mode contains the post mode: edit, post, reply, quote ... + * @param int $post_id contains the post id of the post to index + * @param string $message contains the post text of the post + * @param string $subject contains the subject of the post to index + * @param int $poster_id contains the user id of the poster + * @param int $forum_id contains the forum id of parent forum of the post + */ + public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) + { + // Split old and new post/subject to obtain array of words + $split_text = $this->split_message($message); + $split_title = ($subject) ? $this->split_message($subject) : array(); + + $words = array_unique(array_merge($split_text, $split_title)); + + /** + * Event to modify method arguments and words before the PostgreSQL search index is updated + * + * @event core.search_postgres_index_before + * @var string mode Contains the post mode: edit, post, reply, quote + * @var int post_id The id of the post which is modified/created + * @var string message New or updated post content + * @var string subject New or updated post subject + * @var int poster_id Post author's user id + * @var int forum_id The id of the forum in which the post is located + * @var array words Array of words added to the index + * @var array split_text Array of words from the message + * @var array split_title Array of words from the title + * @since 3.2.3-RC1 + */ + $vars = array( + 'mode', + 'post_id', + 'message', + 'subject', + 'poster_id', + 'forum_id', + 'words', + 'split_text', + 'split_title', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_index_before', compact($vars))); + + unset($split_text); + unset($split_title); + + // destroy cached search results containing any of the words removed or added + $this->destroy_cache($words, array($poster_id)); + + unset($words); + } + + /** + * Destroy cached results, that might be outdated after deleting a post + */ + public function index_remove($post_ids, $author_ids, $forum_ids) + { + $this->destroy_cache(array(), $author_ids); + } + + /** + * Destroy old cache entries + */ + public function tidy() + { + // destroy too old cached search results + $this->destroy_cache(array()); + + $this->config->set('search_last_gc', time(), false); + } + + /** + * Create fulltext index + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function create_index($acp_module, $u_action) + { + // Make sure we can actually use PostgreSQL with fulltext indexes + if ($error = $this->init()) + { + return $error; + } + + if (empty($this->stats)) + { + $this->get_stats(); + } + + $sql_queries = []; + + if (!isset($this->stats['post_subject'])) + { + $sql_queries[] = "CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_subject ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_subject))"; + } + + if (!isset($this->stats['post_content'])) + { + $sql_queries[] = "CREATE INDEX " . POSTS_TABLE . "_" . $this->config['fulltext_postgres_ts_name'] . "_post_content ON " . POSTS_TABLE . " USING gin (to_tsvector ('" . $this->db->sql_escape($this->config['fulltext_postgres_ts_name']) . "', post_text || ' ' || post_subject))"; + } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the Postgres search index is created + * + * @event core.search_postgres_create_index_before + * @var array sql_queries Array with queries for creating the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_create_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } + + $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); + + return false; + } + + /** + * Drop fulltext index + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function delete_index($acp_module, $u_action) + { + // Make sure we can actually use PostgreSQL with fulltext indexes + if ($error = $this->init()) + { + return $error; + } + + if (empty($this->stats)) + { + $this->get_stats(); + } + + $sql_queries = []; + + if (isset($this->stats['post_subject'])) + { + $sql_queries[] = 'DROP INDEX ' . $this->stats['post_subject']['relname']; + } + + if (isset($this->stats['post_content'])) + { + $sql_queries[] = 'DROP INDEX ' . $this->stats['post_content']['relname']; + } + + $stats = $this->stats; + + /** + * Event to modify SQL queries before the Postgres search index is created + * + * @event core.search_postgres_delete_index_before + * @var array sql_queries Array with queries for deleting the search index + * @var array stats Array with statistics of the current index (read only) + * @since 3.2.3-RC1 + */ + $vars = array( + 'sql_queries', + 'stats', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_postgres_delete_index_before', compact($vars))); + + foreach ($sql_queries as $sql_query) + { + $this->db->sql_query($sql_query); + } + + $this->db->sql_query('TRUNCATE TABLE ' . SEARCH_RESULTS_TABLE); + + return false; + } + + /** + * Returns true if both FULLTEXT indexes exist + */ + public function index_created() + { + if (empty($this->stats)) + { + $this->get_stats(); + } + + return (isset($this->stats['post_subject']) && isset($this->stats['post_content'])) ? true : false; + } + + /** + * Returns an associative array containing information about the indexes + */ + public function index_stats() + { + if (empty($this->stats)) + { + $this->get_stats(); + } + + return array( + $this->user->lang['FULLTEXT_POSTGRES_TOTAL_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] : 0, + ); + } + + /** + * Computes the stats and store them in the $this->stats associative array + */ + protected function get_stats() + { + if ($this->db->get_sql_layer() != 'postgres') + { + $this->stats = array(); + return; + } + + $sql = "SELECT c2.relname, pg_catalog.pg_get_indexdef(i.indexrelid, 0, true) AS indexdef + FROM pg_catalog.pg_class c1, pg_catalog.pg_index i, pg_catalog.pg_class c2 + WHERE c1.relname = '" . POSTS_TABLE . "' + AND pg_catalog.pg_table_is_visible(c1.oid) + AND c1.oid = i.indrelid + AND i.indexrelid = c2.oid"; + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + // deal with older PostgreSQL versions which didn't use Index_type + if (strpos($row['indexdef'], 'to_tsvector') !== false) + { + if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_subject' || $row['relname'] == POSTS_TABLE . '_post_subject') + { + $this->stats['post_subject'] = $row; + } + else if ($row['relname'] == POSTS_TABLE . '_' . $this->config['fulltext_postgres_ts_name'] . '_post_content' || $row['relname'] == POSTS_TABLE . '_post_content') + { + $this->stats['post_content'] = $row; + } + } + } + $this->db->sql_freeresult($result); + + $this->stats['total_posts'] = $this->config['num_posts']; + } + + /** + * Display various options that can be configured for the backend from the acp + * + * @return associative array containing template and config variables + */ + public function acp() + { + $tpl = ' +
+

' . $this->user->lang['FULLTEXT_POSTGRES_VERSION_CHECK_EXPLAIN'] . '
+
' . (($this->db->get_sql_layer() == 'postgres') ? $this->user->lang['YES'] : $this->user->lang['NO']) . '
+
+
+

' . $this->user->lang['FULLTEXT_POSTGRES_TS_NAME_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['FULLTEXT_POSTGRES_MIN_WORD_LEN_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['FULLTEXT_POSTGRES_MAX_WORD_LEN_EXPLAIN'] . '
+
+
+ '; + + // These are fields required in the config table + return array( + 'tpl' => $tpl, + 'config' => array('fulltext_postgres_ts_name' => 'string', 'fulltext_postgres_min_word_len' => 'integer:0:255', 'fulltext_postgres_max_word_len' => 'integer:0:255') + ); + } +} diff --git a/install/update/old/phpbb/search/fulltext_sphinx.php b/install/update/old/phpbb/search/fulltext_sphinx.php new file mode 100644 index 0000000..2c2eb84 --- /dev/null +++ b/install/update/old/phpbb/search/fulltext_sphinx.php @@ -0,0 +1,992 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\search; + +define('SPHINX_MAX_MATCHES', 20000); +define('SPHINX_CONNECT_RETRIES', 3); +define('SPHINX_CONNECT_WAIT_TIME', 300); + +/** +* Fulltext search based on the sphinx search deamon +*/ +class fulltext_sphinx +{ + /** + * Associative array holding index stats + * @var array + */ + protected $stats = array(); + + /** + * Holds the words entered by user, obtained by splitting the entered query on whitespace + * @var array + */ + protected $split_words = array(); + + /** + * Holds unique sphinx id + * @var string + */ + protected $id; + + /** + * Stores the names of both main and delta sphinx indexes + * separated by a semicolon + * @var string + */ + protected $indexes; + + /** + * Sphinx searchd client object + * @var SphinxClient + */ + protected $sphinx; + + /** + * Relative path to board root + * @var string + */ + protected $phpbb_root_path; + + /** + * PHP Extension + * @var string + */ + protected $php_ext; + + /** + * Auth object + * @var \phpbb\auth\auth + */ + protected $auth; + + /** + * Config object + * @var \phpbb\config\config + */ + protected $config; + + /** + * Database connection + * @var \phpbb\db\driver\driver_interface + */ + protected $db; + + /** + * Database Tools object + * @var \phpbb\db\tools\tools_interface + */ + protected $db_tools; + + /** + * Stores the database type if supported by sphinx + * @var string + */ + protected $dbtype; + + /** + * phpBB event dispatcher object + * @var \phpbb\event\dispatcher_interface + */ + protected $phpbb_dispatcher; + + /** + * User object + * @var \phpbb\user + */ + protected $user; + + /** + * Stores the generated content of the sphinx config file + * @var string + */ + protected $config_file_data = ''; + + /** + * Contains tidied search query. + * Operators are prefixed in search query and common words excluded + * @var string + */ + protected $search_query; + + /** + * Constructor + * Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend + * + * @param string|bool $error Any error that occurs is passed on through this reference variable otherwise false + * @param string $phpbb_root_path Relative path to phpBB root + * @param string $phpEx PHP file extension + * @param \phpbb\auth\auth $auth Auth object + * @param \phpbb\config\config $config Config object + * @param \phpbb\db\driver\driver_interface Database object + * @param \phpbb\user $user User object + * @param \phpbb\event\dispatcher_interface $phpbb_dispatcher Event dispatcher object + */ + public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher) + { + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $phpEx; + $this->config = $config; + $this->phpbb_dispatcher = $phpbb_dispatcher; + $this->user = $user; + $this->db = $db; + $this->auth = $auth; + + // Initialize \phpbb\db\tools\tools object + global $phpbb_container; // TODO inject into object + $this->db_tools = $phpbb_container->get('dbal.tools'); + + if (!$this->config['fulltext_sphinx_id']) + { + $this->config->set('fulltext_sphinx_id', unique_id()); + } + $this->id = $this->config['fulltext_sphinx_id']; + $this->indexes = 'index_phpbb_' . $this->id . '_delta;index_phpbb_' . $this->id . '_main'; + + if (!class_exists('SphinxClient')) + { + require($this->phpbb_root_path . 'includes/sphinxapi.' . $this->php_ext); + } + + // Initialize sphinx client + $this->sphinx = new \SphinxClient(); + + $this->sphinx->SetServer(($this->config['fulltext_sphinx_host'] ? $this->config['fulltext_sphinx_host'] : 'localhost'), ($this->config['fulltext_sphinx_port'] ? (int) $this->config['fulltext_sphinx_port'] : 9312)); + + $error = false; + } + + /** + * Returns the name of this search backend to be displayed to administrators + * + * @return string Name + */ + public function get_name() + { + return 'Sphinx Fulltext'; + } + + /** + * Returns the search_query + * + * @return string search query + */ + public function get_search_query() + { + return $this->search_query; + } + + /** + * Returns false as there is no word_len array + * + * @return false + */ + public function get_word_length() + { + return false; + } + + /** + * Returns an empty array as there are no common_words + * + * @return array common words that are ignored by search backend + */ + public function get_common_words() + { + return array(); + } + + /** + * Checks permissions and paths, if everything is correct it generates the config file + * + * @return string|bool Language key of the error/incompatiblity encountered, or false if successful + */ + public function init() + { + if ($this->db->get_sql_layer() != 'mysql' && $this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli' && $this->db->get_sql_layer() != 'postgres') + { + return $this->user->lang['FULLTEXT_SPHINX_WRONG_DATABASE']; + } + + // Move delta to main index each hour + $this->config->set('search_gc', 3600); + + return false; + } + + /** + * Generates content of sphinx.conf + * + * @return bool True if sphinx.conf content is correctly generated, false otherwise + */ + protected function config_generate() + { + // Check if Database is supported by Sphinx + if ($this->db->get_sql_layer() =='mysql' || $this->db->get_sql_layer() == 'mysql4' || $this->db->get_sql_layer() == 'mysqli') + { + $this->dbtype = 'mysql'; + } + else if ($this->db->get_sql_layer() == 'postgres') + { + $this->dbtype = 'pgsql'; + } + else + { + $this->config_file_data = $this->user->lang('FULLTEXT_SPHINX_WRONG_DATABASE'); + return false; + } + + // Check if directory paths have been filled + if (!$this->config['fulltext_sphinx_data_path']) + { + $this->config_file_data = $this->user->lang('FULLTEXT_SPHINX_NO_CONFIG_DATA'); + return false; + } + + include($this->phpbb_root_path . 'config.' . $this->php_ext); + + /* Now that we're sure everything was entered correctly, + generate a config for the index. We use a config value + fulltext_sphinx_id for this, as it should be unique. */ + $config_object = new \phpbb\search\sphinx\config($this->config_file_data); + $config_data = array( + 'source source_phpbb_' . $this->id . '_main' => array( + array('type', $this->dbtype . ' # mysql or pgsql'), + // This config value sql_host needs to be changed incase sphinx and sql are on different servers + array('sql_host', $dbhost . ' # SQL server host sphinx connects to'), + array('sql_user', '[dbuser]'), + array('sql_pass', '[dbpassword]'), + array('sql_db', $dbname), + array('sql_port', $dbport . ' # optional, default is 3306 for mysql and 5432 for pgsql'), + array('sql_query_pre', 'SET NAMES \'utf8\''), + array('sql_query_pre', 'UPDATE ' . SPHINX_TABLE . ' SET max_doc_id = (SELECT MAX(post_id) FROM ' . POSTS_TABLE . ') WHERE counter_id = 1'), + array('sql_query_range', 'SELECT MIN(post_id), MAX(post_id) FROM ' . POSTS_TABLE . ''), + array('sql_range_step', '5000'), + array('sql_query', 'SELECT + p.post_id AS id, + p.forum_id, + p.topic_id, + p.poster_id, + p.post_visibility, + CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post, + p.post_time, + p.post_subject, + p.post_subject as title, + p.post_text as data, + t.topic_last_post_time, + 0 as deleted + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t + WHERE + p.topic_id = t.topic_id + AND p.post_id >= $start AND p.post_id <= $end'), + array('sql_query_post', ''), + array('sql_query_post_index', 'UPDATE ' . SPHINX_TABLE . ' SET max_doc_id = $maxid WHERE counter_id = 1'), + array('sql_attr_uint', 'forum_id'), + array('sql_attr_uint', 'topic_id'), + array('sql_attr_uint', 'poster_id'), + array('sql_attr_uint', 'post_visibility'), + array('sql_attr_bool', 'topic_first_post'), + array('sql_attr_bool', 'deleted'), + array('sql_attr_timestamp', 'post_time'), + array('sql_attr_timestamp', 'topic_last_post_time'), + array('sql_attr_string', 'post_subject'), + ), + 'source source_phpbb_' . $this->id . '_delta : source_phpbb_' . $this->id . '_main' => array( + array('sql_query_pre', 'SET NAMES \'utf8\''), + array('sql_query_range', ''), + array('sql_range_step', ''), + array('sql_query', 'SELECT + p.post_id AS id, + p.forum_id, + p.topic_id, + p.poster_id, + p.post_visibility, + CASE WHEN p.post_id = t.topic_first_post_id THEN 1 ELSE 0 END as topic_first_post, + p.post_time, + p.post_subject, + p.post_subject as title, + p.post_text as data, + t.topic_last_post_time, + 0 as deleted + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t + WHERE + p.topic_id = t.topic_id + AND p.post_id >= ( SELECT max_doc_id FROM ' . SPHINX_TABLE . ' WHERE counter_id=1 )'), + array('sql_query_post_index', ''), + ), + 'index index_phpbb_' . $this->id . '_main' => array( + array('path', $this->config['fulltext_sphinx_data_path'] . 'index_phpbb_' . $this->id . '_main'), + array('source', 'source_phpbb_' . $this->id . '_main'), + array('docinfo', 'extern'), + array('morphology', 'none'), + array('stopwords', ''), + array('min_word_len', '2'), + array('charset_table', 'U+FF10..U+FF19->0..9, 0..9, U+FF41..U+FF5A->a..z, U+FF21..U+FF3A->a..z, A..Z->a..z, a..z, U+0149, U+017F, U+0138, U+00DF, U+00FF, U+00C0..U+00D6->U+00E0..U+00F6, U+00E0..U+00F6, U+00D8..U+00DE->U+00F8..U+00FE, U+00F8..U+00FE, U+0100->U+0101, U+0101, U+0102->U+0103, U+0103, U+0104->U+0105, U+0105, U+0106->U+0107, U+0107, U+0108->U+0109, U+0109, U+010A->U+010B, U+010B, U+010C->U+010D, U+010D, U+010E->U+010F, U+010F, U+0110->U+0111, U+0111, U+0112->U+0113, U+0113, U+0114->U+0115, U+0115, U+0116->U+0117, U+0117, U+0118->U+0119, U+0119, U+011A->U+011B, U+011B, U+011C->U+011D, U+011D, U+011E->U+011F, U+011F, U+0130->U+0131, U+0131, U+0132->U+0133, U+0133, U+0134->U+0135, U+0135, U+0136->U+0137, U+0137, U+0139->U+013A, U+013A, U+013B->U+013C, U+013C, U+013D->U+013E, U+013E, U+013F->U+0140, U+0140, U+0141->U+0142, U+0142, U+0143->U+0144, U+0144, U+0145->U+0146, U+0146, U+0147->U+0148, U+0148, U+014A->U+014B, U+014B, U+014C->U+014D, U+014D, U+014E->U+014F, U+014F, U+0150->U+0151, U+0151, U+0152->U+0153, U+0153, U+0154->U+0155, U+0155, U+0156->U+0157, U+0157, U+0158->U+0159, U+0159, U+015A->U+015B, U+015B, U+015C->U+015D, U+015D, U+015E->U+015F, U+015F, U+0160->U+0161, U+0161, U+0162->U+0163, U+0163, U+0164->U+0165, U+0165, U+0166->U+0167, U+0167, U+0168->U+0169, U+0169, U+016A->U+016B, U+016B, U+016C->U+016D, U+016D, U+016E->U+016F, U+016F, U+0170->U+0171, U+0171, U+0172->U+0173, U+0173, U+0174->U+0175, U+0175, U+0176->U+0177, U+0177, U+0178->U+00FF, U+00FF, U+0179->U+017A, U+017A, U+017B->U+017C, U+017C, U+017D->U+017E, U+017E, U+0410..U+042F->U+0430..U+044F, U+0430..U+044F, U+4E00..U+9FFF'), + array('min_prefix_len', '0'), + array('min_infix_len', '0'), + ), + 'index index_phpbb_' . $this->id . '_delta : index_phpbb_' . $this->id . '_main' => array( + array('path', $this->config['fulltext_sphinx_data_path'] . 'index_phpbb_' . $this->id . '_delta'), + array('source', 'source_phpbb_' . $this->id . '_delta'), + ), + 'indexer' => array( + array('mem_limit', $this->config['fulltext_sphinx_indexer_mem_limit'] . 'M'), + ), + 'searchd' => array( + array('listen' , ($this->config['fulltext_sphinx_host'] ? $this->config['fulltext_sphinx_host'] : 'localhost') . ':' . ($this->config['fulltext_sphinx_port'] ? $this->config['fulltext_sphinx_port'] : '9312')), + array('log', $this->config['fulltext_sphinx_data_path'] . 'log/searchd.log'), + array('query_log', $this->config['fulltext_sphinx_data_path'] . 'log/sphinx-query.log'), + array('read_timeout', '5'), + array('max_children', '30'), + array('pid_file', $this->config['fulltext_sphinx_data_path'] . 'searchd.pid'), + array('binlog_path', $this->config['fulltext_sphinx_data_path']), + ), + ); + + $non_unique = array('sql_query_pre' => true, 'sql_attr_uint' => true, 'sql_attr_timestamp' => true, 'sql_attr_str2ordinal' => true, 'sql_attr_bool' => true); + $delete = array('sql_group_column' => true, 'sql_date_column' => true, 'sql_str2ordinal_column' => true); + + /** + * Allow adding/changing the Sphinx configuration data + * + * @event core.search_sphinx_modify_config_data + * @var array config_data Array with the Sphinx configuration data + * @var array non_unique Array with the Sphinx non-unique variables to delete + * @var array delete Array with the Sphinx variables to delete + * @since 3.1.7-RC1 + */ + $vars = array( + 'config_data', + 'non_unique', + 'delete', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_sphinx_modify_config_data', compact($vars))); + + foreach ($config_data as $section_name => $section_data) + { + $section = $config_object->get_section_by_name($section_name); + if (!$section) + { + $section = $config_object->add_section($section_name); + } + + foreach ($delete as $key => $void) + { + $section->delete_variables_by_name($key); + } + + foreach ($non_unique as $key => $void) + { + $section->delete_variables_by_name($key); + } + + foreach ($section_data as $entry) + { + $key = $entry[0]; + $value = $entry[1]; + + if (!isset($non_unique[$key])) + { + $variable = $section->get_variable_by_name($key); + if (!$variable) + { + $section->create_variable($key, $value); + } + else + { + $variable->set_value($value); + } + } + else + { + $section->create_variable($key, $value); + } + } + } + $this->config_file_data = $config_object->get_data(); + + return true; + } + + /** + * Splits keywords entered by a user into an array of words stored in $this->split_words + * Stores the tidied search query in $this->search_query + * + * @param string $keywords Contains the keyword as entered by the user + * @param string $terms is either 'all' or 'any' + * @return false if no valid keywords were found and otherwise true + */ + public function split_keywords(&$keywords, $terms) + { + if ($terms == 'all') + { + $match = array('#\sand\s#i', '#\sor\s#i', '#\snot\s#i', '#\+#', '#-#', '#\|#', '#@#'); + $replace = array(' & ', ' | ', ' - ', ' +', ' -', ' |', ''); + + $keywords = preg_replace($match, $replace, $keywords); + $this->sphinx->SetMatchMode(SPH_MATCH_EXTENDED); + } + else + { + $this->sphinx->SetMatchMode(SPH_MATCH_ANY); + } + + // Keep quotes and new lines + $keywords = str_replace(array('"', "\n"), array('"', ' '), trim($keywords)); + + if (strlen($keywords) > 0) + { + $this->search_query = str_replace('"', '"', $keywords); + return true; + } + + return false; + } + + /** + * Performs a search on keywords depending on display specific params. You have to run split_keywords() first + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param string $fields contains either titleonly (topic titles should be searched), msgonly (only message bodies should be searched), firstpost (only subject and body of the first post should be searched) or all (all post bodies and subjects should be searched) + * @param string $terms is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids if the author should be ignored during the search the array is empty + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @param int $per_page number of ids each page is supposed to contain + * @return boolean|int total number of results + */ + public function keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, &$start, $per_page) + { + global $user, $phpbb_log; + + // No keywords? No posts. + if (!strlen($this->search_query) && !count($author_ary)) + { + return false; + } + + $id_ary = array(); + + // Sorting + + if ($type == 'topics') + { + switch ($sort_key) + { + case 'a': + $this->sphinx->SetGroupBy('topic_id', SPH_GROUPBY_ATTR, 'poster_id ' . (($sort_dir == 'a') ? 'ASC' : 'DESC')); + break; + + case 'f': + $this->sphinx->SetGroupBy('topic_id', SPH_GROUPBY_ATTR, 'forum_id ' . (($sort_dir == 'a') ? 'ASC' : 'DESC')); + break; + + case 'i': + + case 's': + $this->sphinx->SetGroupBy('topic_id', SPH_GROUPBY_ATTR, 'post_subject ' . (($sort_dir == 'a') ? 'ASC' : 'DESC')); + break; + + case 't': + + default: + $this->sphinx->SetGroupBy('topic_id', SPH_GROUPBY_ATTR, 'topic_last_post_time ' . (($sort_dir == 'a') ? 'ASC' : 'DESC')); + break; + } + } + else + { + switch ($sort_key) + { + case 'a': + $this->sphinx->SetSortMode(($sort_dir == 'a') ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC, 'poster_id'); + break; + + case 'f': + $this->sphinx->SetSortMode(($sort_dir == 'a') ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC, 'forum_id'); + break; + + case 'i': + + case 's': + $this->sphinx->SetSortMode(($sort_dir == 'a') ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC, 'post_subject'); + break; + + case 't': + + default: + $this->sphinx->SetSortMode(($sort_dir == 'a') ? SPH_SORT_ATTR_ASC : SPH_SORT_ATTR_DESC, 'post_time'); + break; + } + } + + // Most narrow filters first + if ($topic_id) + { + $this->sphinx->SetFilter('topic_id', array($topic_id)); + } + + /** + * Allow modifying the Sphinx search options + * + * @event core.search_sphinx_keywords_modify_options + * @var string type Searching type ('posts', 'topics') + * @var string fields Searching fields ('titleonly', 'msgonly', 'firstpost', 'all') + * @var string terms Searching terms ('all', 'any') + * @var int sort_days Time, in days, of the oldest possible post to list + * @var string sort_key The sort type used from the possible sort types + * @var int topic_id Limit the search to this topic_id only + * @var array ex_fid_ary Which forums not to search on + * @var string post_visibility Post visibility data + * @var array author_ary Array of user_id containing the users to filter the results to + * @var string author_name The username to search on + * @var object sphinx The Sphinx searchd client object + * @since 3.1.7-RC1 + */ + $sphinx = $this->sphinx; + $vars = array( + 'type', + 'fields', + 'terms', + 'sort_days', + 'sort_key', + 'topic_id', + 'ex_fid_ary', + 'post_visibility', + 'author_ary', + 'author_name', + 'sphinx', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_sphinx_keywords_modify_options', compact($vars))); + $this->sphinx = $sphinx; + unset($sphinx); + + $search_query_prefix = ''; + + switch ($fields) + { + case 'titleonly': + // Only search the title + if ($terms == 'all') + { + $search_query_prefix = '@title '; + } + // Weight for the title + $this->sphinx->SetFieldWeights(array("title" => 5, "data" => 1)); + // 1 is first_post, 0 is not first post + $this->sphinx->SetFilter('topic_first_post', array(1)); + break; + + case 'msgonly': + // Only search the body + if ($terms == 'all') + { + $search_query_prefix = '@data '; + } + // Weight for the body + $this->sphinx->SetFieldWeights(array("title" => 1, "data" => 5)); + break; + + case 'firstpost': + // More relative weight for the title, also search the body + $this->sphinx->SetFieldWeights(array("title" => 5, "data" => 1)); + // 1 is first_post, 0 is not first post + $this->sphinx->SetFilter('topic_first_post', array(1)); + break; + + default: + // More relative weight for the title, also search the body + $this->sphinx->SetFieldWeights(array("title" => 5, "data" => 1)); + break; + } + + if (count($author_ary)) + { + $this->sphinx->SetFilter('poster_id', $author_ary); + } + + // As this is not simply possible at the moment, we limit the result to approved posts. + // This will make it impossible for moderators to search unapproved and softdeleted posts, + // but at least it will also cause the same for normal users. + $this->sphinx->SetFilter('post_visibility', array(ITEM_APPROVED)); + + if (count($ex_fid_ary)) + { + // All forums that a user is allowed to access + $fid_ary = array_unique(array_intersect(array_keys($this->auth->acl_getf('f_read', true)), array_keys($this->auth->acl_getf('f_search', true)))); + // All forums that the user wants to and can search in + $search_forums = array_diff($fid_ary, $ex_fid_ary); + + if (count($search_forums)) + { + $this->sphinx->SetFilter('forum_id', $search_forums); + } + } + + $this->sphinx->SetFilter('deleted', array(0)); + + $this->sphinx->SetLimits((int) $start, (int) $per_page, SPHINX_MAX_MATCHES); + $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes); + + // Could be connection to localhost:9312 failed (errno=111, + // msg=Connection refused) during rotate, retry if so + $retries = SPHINX_CONNECT_RETRIES; + while (!$result && (strpos($this->sphinx->GetLastError(), "errno=111,") !== false) && $retries--) + { + usleep(SPHINX_CONNECT_WAIT_TIME); + $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes); + } + + if ($this->sphinx->GetLastError()) + { + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_SPHINX_ERROR', false, array($this->sphinx->GetLastError())); + if ($this->auth->acl_get('a_')) + { + trigger_error($this->user->lang('SPHINX_SEARCH_FAILED', $this->sphinx->GetLastError())); + } + else + { + trigger_error($this->user->lang('SPHINX_SEARCH_FAILED_LOG')); + } + } + + $result_count = $result['total_found']; + + if ($result_count && $start >= $result_count) + { + $start = floor(($result_count - 1) / $per_page) * $per_page; + + $this->sphinx->SetLimits((int) $start, (int) $per_page, SPHINX_MAX_MATCHES); + $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes); + + // Could be connection to localhost:9312 failed (errno=111, + // msg=Connection refused) during rotate, retry if so + $retries = SPHINX_CONNECT_RETRIES; + while (!$result && (strpos($this->sphinx->GetLastError(), "errno=111,") !== false) && $retries--) + { + usleep(SPHINX_CONNECT_WAIT_TIME); + $result = $this->sphinx->Query($search_query_prefix . $this->sphinx->EscapeString(str_replace('"', '"', $this->search_query)), $this->indexes); + } + } + + $id_ary = array(); + if (isset($result['matches'])) + { + if ($type == 'posts') + { + $id_ary = array_keys($result['matches']); + } + else + { + foreach ($result['matches'] as $key => $value) + { + $id_ary[] = $value['attrs']['topic_id']; + } + } + } + else + { + return false; + } + + $id_ary = array_slice($id_ary, 0, (int) $per_page); + + return $result_count; + } + + /** + * Performs a search on an author's posts without caring about message contents. Depends on display specific params + * + * @param string $type contains either posts or topics depending on what should be searched for + * @param boolean $firstpost_only if true, only topic starting posts will be considered + * @param array $sort_by_sql contains SQL code for the ORDER BY part of a query + * @param string $sort_key is the key of $sort_by_sql for the selected sorting + * @param string $sort_dir is either a or d representing ASC and DESC + * @param string $sort_days specifies the maximum amount of days a post may be old + * @param array $ex_fid_ary specifies an array of forum ids which should not be searched + * @param string $post_visibility specifies which types of posts the user can view in which forums + * @param int $topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @param array $author_ary an array of author ids + * @param string $author_name specifies the author match, when ANONYMOUS is also a search-match + * @param array &$id_ary passed by reference, to be filled with ids for the page specified by $start and $per_page, should be ordered + * @param int $start indicates the first index of the page + * @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, $post_visibility, $topic_id, $author_ary, $author_name, &$id_ary, $start, $per_page) + { + $this->search_query = ''; + + $this->sphinx->SetMatchMode(SPH_MATCH_FULLSCAN); + $fields = ($firstpost_only) ? 'firstpost' : 'all'; + $terms = 'all'; + return $this->keyword_search($type, $fields, $terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $post_visibility, $topic_id, $author_ary, $author_name, $id_ary, $start, $per_page); + } + + /** + * Updates wordlist and wordmatch tables when a message is posted or changed + * + * @param string $mode Contains the post mode: edit, post, reply, quote + * @param int $post_id The id of the post which is modified/created + * @param string &$message New or updated post content + * @param string &$subject New or updated post subject + * @param int $poster_id Post author's user id + * @param int $forum_id The id of the forum in which the post is located + */ + public function index($mode, $post_id, &$message, &$subject, $poster_id, $forum_id) + { + /** + * Event to modify method arguments before the Sphinx search index is updated + * + * @event core.search_sphinx_index_before + * @var string mode Contains the post mode: edit, post, reply, quote + * @var int post_id The id of the post which is modified/created + * @var string message New or updated post content + * @var string subject New or updated post subject + * @var int poster_id Post author's user id + * @var int forum_id The id of the forum in which the post is located + * @since 3.2.3-RC1 + */ + $vars = array( + 'mode', + 'post_id', + 'message', + 'subject', + 'poster_id', + 'forum_id', + ); + extract($this->phpbb_dispatcher->trigger_event('core.search_sphinx_index_before', compact($vars))); + + if ($mode == 'edit') + { + $this->sphinx->UpdateAttributes($this->indexes, array('forum_id', 'poster_id'), array((int) $post_id => array((int) $forum_id, (int) $poster_id))); + } + else if ($mode != 'post' && $post_id) + { + // Update topic_last_post_time for full topic + $sql_array = array( + 'SELECT' => 'p1.post_id', + 'FROM' => array( + POSTS_TABLE => 'p1', + ), + 'LEFT_JOIN' => array(array( + 'FROM' => array( + POSTS_TABLE => 'p2' + ), + 'ON' => 'p1.topic_id = p2.topic_id', + )), + 'WHERE' => 'p2.post_id = ' . ((int) $post_id), + ); + + $sql = $this->db->sql_build_query('SELECT', $sql_array); + $result = $this->db->sql_query($sql); + + $post_updates = array(); + $post_time = time(); + while ($row = $this->db->sql_fetchrow($result)) + { + $post_updates[(int) $row['post_id']] = array($post_time); + } + $this->db->sql_freeresult($result); + + if (count($post_updates)) + { + $this->sphinx->UpdateAttributes($this->indexes, array('topic_last_post_time'), $post_updates); + } + } + } + + /** + * Delete a post from the index after it was deleted + */ + public function index_remove($post_ids, $author_ids, $forum_ids) + { + $values = array(); + foreach ($post_ids as $post_id) + { + $values[$post_id] = array(1); + } + + $this->sphinx->UpdateAttributes($this->indexes, array('deleted'), $values); + } + + /** + * Nothing needs to be destroyed + */ + public function tidy($create = false) + { + $this->config->set('search_last_gc', time(), false); + } + + /** + * Create sphinx table + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function create_index($acp_module, $u_action) + { + if (!$this->index_created()) + { + $table_data = array( + 'COLUMNS' => array( + 'counter_id' => array('UINT', 0), + 'max_doc_id' => array('UINT', 0), + ), + 'PRIMARY_KEY' => 'counter_id', + ); + $this->db_tools->sql_create_table(SPHINX_TABLE, $table_data); + + $sql = 'TRUNCATE TABLE ' . SPHINX_TABLE; + $this->db->sql_query($sql); + + $data = array( + 'counter_id' => '1', + 'max_doc_id' => '0', + ); + $sql = 'INSERT INTO ' . SPHINX_TABLE . ' ' . $this->db->sql_build_array('INSERT', $data); + $this->db->sql_query($sql); + } + + return false; + } + + /** + * Drop sphinx table + * + * @return string|bool error string is returned incase of errors otherwise false + */ + public function delete_index($acp_module, $u_action) + { + if (!$this->index_created()) + { + return false; + } + + $this->db_tools->sql_table_drop(SPHINX_TABLE); + + return false; + } + + /** + * Returns true if the sphinx table was created + * + * @return bool true if sphinx table was created + */ + public function index_created($allow_new_files = true) + { + $created = false; + + if ($this->db_tools->sql_table_exists(SPHINX_TABLE)) + { + $created = true; + } + + return $created; + } + + /** + * Returns an associative array containing information about the indexes + * + * @return string|bool Language string of error false otherwise + */ + public function index_stats() + { + if (empty($this->stats)) + { + $this->get_stats(); + } + + return array( + $this->user->lang['FULLTEXT_SPHINX_MAIN_POSTS'] => ($this->index_created()) ? $this->stats['main_posts'] : 0, + $this->user->lang['FULLTEXT_SPHINX_DELTA_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] - $this->stats['main_posts'] : 0, + $this->user->lang['FULLTEXT_MYSQL_TOTAL_POSTS'] => ($this->index_created()) ? $this->stats['total_posts'] : 0, + ); + } + + /** + * Collects stats that can be displayed on the index maintenance page + */ + protected function get_stats() + { + if ($this->index_created()) + { + $sql = 'SELECT COUNT(post_id) as total_posts + FROM ' . POSTS_TABLE; + $result = $this->db->sql_query($sql); + $this->stats['total_posts'] = (int) $this->db->sql_fetchfield('total_posts'); + $this->db->sql_freeresult($result); + + $sql = 'SELECT COUNT(p.post_id) as main_posts + FROM ' . POSTS_TABLE . ' p, ' . SPHINX_TABLE . ' m + WHERE p.post_id <= m.max_doc_id + AND m.counter_id = 1'; + $result = $this->db->sql_query($sql); + $this->stats['main_posts'] = (int) $this->db->sql_fetchfield('main_posts'); + $this->db->sql_freeresult($result); + } + } + + /** + * Returns a list of options for the ACP to display + * + * @return associative array containing template and config variables + */ + public function acp() + { + $config_vars = array( + 'fulltext_sphinx_data_path' => 'string', + 'fulltext_sphinx_host' => 'string', + 'fulltext_sphinx_port' => 'string', + 'fulltext_sphinx_indexer_mem_limit' => 'int', + ); + + $tpl = ' + ' . $this->user->lang['FULLTEXT_SPHINX_CONFIGURE']. ' +
+

' . $this->user->lang['FULLTEXT_SPHINX_DATA_PATH_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['FULLTEXT_SPHINX_HOST_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['FULLTEXT_SPHINX_PORT_EXPLAIN'] . '
+
+
+
+

' . $this->user->lang['FULLTEXT_SPHINX_INDEXER_MEM_LIMIT_EXPLAIN'] . '
+
' . $this->user->lang['MIB'] . '
+
+
+

' . $this->user->lang['FULLTEXT_SPHINX_CONFIG_FILE_EXPLAIN'] . '
+
' . (($this->config_generate()) ? '' : $this->config_file_data) . '
+
+ '; + + // These are fields required in the config table + return array( + 'tpl' => $tpl, + 'config' => $config_vars + ); + } +} diff --git a/install/update/old/phpbb/session.php b/install/update/old/phpbb/session.php new file mode 100644 index 0000000..31f32af --- /dev/null +++ b/install/update/old/phpbb/session.php @@ -0,0 +1,1650 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* Session class +*/ +class session +{ + var $cookie_data = array(); + var $page = array(); + var $data = array(); + var $browser = ''; + var $forwarded_for = ''; + var $host = ''; + var $session_id = ''; + var $ip = ''; + var $load = 0; + var $time_now = 0; + var $update_session_page = true; + + /** + * Extract current session page + * + * @param string $root_path current root path (phpbb_root_path) + * @return array + */ + static function extract_current_page($root_path) + { + global $request, $symfony_request, $phpbb_filesystem; + + $page_array = array(); + + // First of all, get the request uri... + $script_name = $request->escape($symfony_request->getScriptName(), true); + $args = $request->escape(explode('&', $symfony_request->getQueryString()), true); + + // If we are unable to get the script name we use REQUEST_URI as a failover and note it within the page array for easier support... + if (!$script_name) + { + $script_name = htmlspecialchars_decode($request->server('REQUEST_URI')); + $script_name = (($pos = strpos($script_name, '?')) !== false) ? substr($script_name, 0, $pos) : $script_name; + $page_array['failover'] = 1; + } + + // Replace backslashes and doubled slashes (could happen on some proxy setups) + $script_name = str_replace(array('\\', '//'), '/', $script_name); + + // Now, remove the sid and let us get a clean query string... + $use_args = array(); + + // Since some browser do not encode correctly we need to do this with some "special" characters... + // " -> %22, ' => %27, < -> %3C, > -> %3E + $find = array('"', "'", '<', '>', '"', '<', '>'); + $replace = array('%22', '%27', '%3C', '%3E', '%22', '%3C', '%3E'); + + foreach ($args as $key => $argument) + { + if (strpos($argument, 'sid=') === 0) + { + continue; + } + + $use_args[] = str_replace($find, $replace, $argument); + } + unset($args); + + // The following examples given are for an request uri of {path to the phpbb directory}/adm/index.php?i=10&b=2 + + // The current query string + $query_string = trim(implode('&', $use_args)); + + // basenamed page name (for example: index.php) + $page_name = (substr($script_name, -1, 1) == '/') ? '' : basename($script_name); + $page_name = urlencode(htmlspecialchars($page_name)); + + $symfony_request_path = $phpbb_filesystem->clean_path($symfony_request->getPathInfo()); + if ($symfony_request_path !== '/') + { + $page_name .= str_replace('%2F', '/', urlencode($symfony_request_path)); + } + + if (substr($root_path, 0, 2) === './' && strpos($root_path, '..') === false) + { + $root_dirs = explode('/', str_replace('\\', '/', rtrim($root_path, '/'))); + $page_dirs = explode('/', str_replace('\\', '/', '.')); + } + else + { + // current directory within the phpBB root (for example: adm) + $root_dirs = explode('/', str_replace('\\', '/', $phpbb_filesystem->realpath($root_path))); + $page_dirs = explode('/', str_replace('\\', '/', $phpbb_filesystem->realpath('./'))); + } + + $intersection = array_intersect_assoc($root_dirs, $page_dirs); + + $root_dirs = array_diff_assoc($root_dirs, $intersection); + $page_dirs = array_diff_assoc($page_dirs, $intersection); + + $page_dir = str_repeat('../', count($root_dirs)) . implode('/', $page_dirs); + + if ($page_dir && substr($page_dir, -1, 1) == '/') + { + $page_dir = substr($page_dir, 0, -1); + } + + // Current page from phpBB root (for example: adm/index.php?i=10&b=2) + $page = (($page_dir) ? $page_dir . '/' : '') . $page_name; + if ($query_string) + { + $page .= '?' . $query_string; + } + + // The script path from the webroot to the current directory (for example: /phpBB3/adm/) : always prefixed with / and ends in / + $script_path = $symfony_request->getBasePath(); + + // The script path from the webroot to the phpBB root (for example: /phpBB3/) + $script_dirs = explode('/', $script_path); + array_splice($script_dirs, -count($page_dirs)); + $root_script_path = implode('/', $script_dirs) . (count($root_dirs) ? '/' . implode('/', $root_dirs) : ''); + + // We are on the base level (phpBB root == webroot), lets adjust the variables a bit... + if (!$root_script_path) + { + $root_script_path = ($page_dir) ? str_replace($page_dir, '', $script_path) : $script_path; + } + + $script_path .= (substr($script_path, -1, 1) == '/') ? '' : '/'; + $root_script_path .= (substr($root_script_path, -1, 1) == '/') ? '' : '/'; + + $forum_id = $request->variable('f', 0); + // maximum forum id value is maximum value of mediumint unsigned column + $forum_id = ($forum_id > 0 && $forum_id < 16777215) ? $forum_id : 0; + + $page_array += array( + 'page_name' => $page_name, + 'page_dir' => $page_dir, + + 'query_string' => $query_string, + 'script_path' => str_replace(' ', '%20', htmlspecialchars($script_path)), + 'root_script_path' => str_replace(' ', '%20', htmlspecialchars($root_script_path)), + + 'page' => $page, + 'forum' => $forum_id, + ); + + return $page_array; + } + + /** + * Get valid hostname/port. HTTP_HOST is used, SERVER_NAME if HTTP_HOST not present. + */ + function extract_current_hostname() + { + global $config, $request; + + // Get hostname + $host = htmlspecialchars_decode($request->header('Host', $request->server('SERVER_NAME'))); + + // Should be a string and lowered + $host = (string) strtolower($host); + + // If host is equal the cookie domain or the server name (if config is set), then we assume it is valid + if ((isset($config['cookie_domain']) && $host === $config['cookie_domain']) || (isset($config['server_name']) && $host === $config['server_name'])) + { + return $host; + } + + // Is the host actually a IP? If so, we use the IP... (IPv4) + if (long2ip(ip2long($host)) === $host) + { + return $host; + } + + // Now return the hostname (this also removes any port definition). The http:// is prepended to construct a valid URL, hosts never have a scheme assigned + $host = @parse_url('http://' . $host); + $host = (!empty($host['host'])) ? $host['host'] : ''; + + // Remove any portions not removed by parse_url (#) + $host = str_replace('#', '', $host); + + // If, by any means, the host is now empty, we will use a "best approach" way to guess one + if (empty($host)) + { + if (!empty($config['server_name'])) + { + $host = $config['server_name']; + } + else if (!empty($config['cookie_domain'])) + { + $host = (strpos($config['cookie_domain'], '.') === 0) ? substr($config['cookie_domain'], 1) : $config['cookie_domain']; + } + else + { + // Set to OS hostname or localhost + $host = (function_exists('php_uname')) ? php_uname('n') : 'localhost'; + } + } + + // It may be still no valid host, but for sure only a hostname (we may further expand on the cookie domain... if set) + return $host; + } + + /** + * Start session management + * + * This is where all session activity begins. We gather various pieces of + * information from the client and server. We test to see if a session already + * exists. If it does, fine and dandy. If it doesn't we'll go on to create a + * new one ... pretty logical heh? We also examine the system load (if we're + * running on a system which makes such information readily available) and + * halt if it's above an admin definable limit. + * + * @param bool $update_session_page if true the session page gets updated. + * This can be set to circumvent certain scripts to update the users last visited page. + */ + function session_begin($update_session_page = true) + { + global $phpEx, $SID, $_SID, $_EXTRA_URL, $db, $config, $phpbb_root_path; + global $request, $phpbb_container, $user, $phpbb_log, $phpbb_dispatcher; + + // Give us some basic information + $this->time_now = time(); + $this->cookie_data = array('u' => 0, 'k' => ''); + $this->update_session_page = $update_session_page; + $this->browser = $request->header('User-Agent'); + $this->referer = $request->header('Referer'); + $this->forwarded_for = $request->header('X-Forwarded-For'); + + $this->host = $this->extract_current_hostname(); + $this->page = $this->extract_current_page($phpbb_root_path); + + // if the forwarded for header shall be checked we have to validate its contents + if ($config['forwarded_for_check']) + { + $this->forwarded_for = preg_replace('# {2,}#', ' ', str_replace(',', ' ', $this->forwarded_for)); + + // split the list of IPs + $ips = explode(' ', $this->forwarded_for); + foreach ($ips as $ip) + { + // check IPv4 first, the IPv6 is hopefully only going to be used very seldomly + if (!empty($ip) && !preg_match(get_preg_expression('ipv4'), $ip) && !preg_match(get_preg_expression('ipv6'), $ip)) + { + // contains invalid data, don't use the forwarded for header + $this->forwarded_for = ''; + break; + } + } + } + else + { + $this->forwarded_for = ''; + } + + if ($request->is_set($config['cookie_name'] . '_sid', \phpbb\request\request_interface::COOKIE) || $request->is_set($config['cookie_name'] . '_u', \phpbb\request\request_interface::COOKIE)) + { + $this->cookie_data['u'] = $request->variable($config['cookie_name'] . '_u', 0, false, \phpbb\request\request_interface::COOKIE); + $this->cookie_data['k'] = $request->variable($config['cookie_name'] . '_k', '', false, \phpbb\request\request_interface::COOKIE); + $this->session_id = $request->variable($config['cookie_name'] . '_sid', '', false, \phpbb\request\request_interface::COOKIE); + + $SID = (defined('NEED_SID')) ? '?sid=' . $this->session_id : '?sid='; + $_SID = (defined('NEED_SID')) ? $this->session_id : ''; + + if (empty($this->session_id)) + { + $this->session_id = $_SID = $request->variable('sid', ''); + $SID = '?sid=' . $this->session_id; + $this->cookie_data = array('u' => 0, 'k' => ''); + } + } + else + { + $this->session_id = $_SID = $request->variable('sid', ''); + $SID = '?sid=' . $this->session_id; + } + + $_EXTRA_URL = array(); + + // Why no forwarded_for et al? Well, too easily spoofed. With the results of my recent requests + // it's pretty clear that in the majority of cases you'll at least be left with a proxy/cache ip. + $ip = htmlspecialchars_decode($request->server('REMOTE_ADDR')); + $ip = preg_replace('# {2,}#', ' ', str_replace(',', ' ', $ip)); + + /** + * Event to alter user IP address + * + * @event core.session_ip_after + * @var string ip REMOTE_ADDR + * @since 3.1.10-RC1 + */ + $vars = array('ip'); + extract($phpbb_dispatcher->trigger_event('core.session_ip_after', compact($vars))); + + // split the list of IPs + $ips = explode(' ', trim($ip)); + + // Default IP if REMOTE_ADDR is invalid + $this->ip = '127.0.0.1'; + + foreach ($ips as $ip) + { + if (function_exists('phpbb_ip_normalise')) + { + // Normalise IP address + $ip = phpbb_ip_normalise($ip); + + if (empty($ip)) + { + // IP address is invalid. + break; + } + + // IP address is valid. + $this->ip = $ip; + + // Skip legacy code. + continue; + } + + if (preg_match(get_preg_expression('ipv4'), $ip)) + { + $this->ip = $ip; + } + else if (preg_match(get_preg_expression('ipv6'), $ip)) + { + // Quick check for IPv4-mapped address in IPv6 + if (stripos($ip, '::ffff:') === 0) + { + $ipv4 = substr($ip, 7); + + if (preg_match(get_preg_expression('ipv4'), $ipv4)) + { + $ip = $ipv4; + } + } + + $this->ip = $ip; + } + else + { + // We want to use the last valid address in the chain + // Leave foreach loop when address is invalid + break; + } + } + + $this->load = false; + + // Load limit check (if applicable) + if ($config['limit_load'] || $config['limit_search_load']) + { + if ((function_exists('sys_getloadavg') && $load = sys_getloadavg()) || ($load = explode(' ', @file_get_contents('/proc/loadavg')))) + { + $this->load = array_slice($load, 0, 1); + $this->load = floatval($this->load[0]); + } + else + { + $config->set('limit_load', '0'); + $config->set('limit_search_load', '0'); + } + } + + // if no session id is set, redirect to index.php + $session_id = $request->variable('sid', ''); + if (defined('NEED_SID') && (empty($session_id) || $this->session_id !== $session_id)) + { + send_status_line(401, 'Unauthorized'); + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + // if session id is set + if (!empty($this->session_id)) + { + $sql = 'SELECT u.*, s.* + FROM ' . SESSIONS_TABLE . ' s, ' . USERS_TABLE . " u + WHERE s.session_id = '" . $db->sql_escape($this->session_id) . "' + AND u.user_id = s.session_user_id"; + $result = $db->sql_query($sql); + $this->data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Did the session exist in the DB? + if (isset($this->data['user_id'])) + { + // Validate IP length according to admin ... enforces an IP + // check on bots if admin requires this +// $quadcheck = ($config['ip_check_bot'] && $this->data['user_type'] & USER_BOT) ? 4 : $config['ip_check']; + + if (strpos($this->ip, ':') !== false && strpos($this->data['session_ip'], ':') !== false) + { + $s_ip = short_ipv6($this->data['session_ip'], $config['ip_check']); + $u_ip = short_ipv6($this->ip, $config['ip_check']); + } + else + { + $s_ip = implode('.', array_slice(explode('.', $this->data['session_ip']), 0, $config['ip_check'])); + $u_ip = implode('.', array_slice(explode('.', $this->ip), 0, $config['ip_check'])); + } + + $s_browser = ($config['browser_check']) ? trim(strtolower(substr($this->data['session_browser'], 0, 149))) : ''; + $u_browser = ($config['browser_check']) ? trim(strtolower(substr($this->browser, 0, 149))) : ''; + + $s_forwarded_for = ($config['forwarded_for_check']) ? substr($this->data['session_forwarded_for'], 0, 254) : ''; + $u_forwarded_for = ($config['forwarded_for_check']) ? substr($this->forwarded_for, 0, 254) : ''; + + // referer checks + // The @ before $config['referer_validation'] suppresses notices present while running the updater + $check_referer_path = (@$config['referer_validation'] == REFERER_VALIDATE_PATH); + $referer_valid = true; + + // we assume HEAD and TRACE to be foul play and thus only whitelist GET + if (@$config['referer_validation'] && strtolower($request->server('REQUEST_METHOD')) !== 'get') + { + $referer_valid = $this->validate_referer($check_referer_path); + } + + if ($u_ip === $s_ip && $s_browser === $u_browser && $s_forwarded_for === $u_forwarded_for && $referer_valid) + { + $session_expired = false; + + // Check whether the session is still valid if we have one + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $provider = $provider_collection->get_provider(); + + if (!($provider instanceof \phpbb\auth\provider\provider_interface)) + { + throw new \RuntimeException($provider . ' must implement \phpbb\auth\provider\provider_interface'); + } + + $ret = $provider->validate_session($this->data); + if ($ret !== null && !$ret) + { + $session_expired = true; + } + + if (!$session_expired) + { + // Check the session length timeframe if autologin is not enabled. + // Else check the autologin length... and also removing those having autologin enabled but no longer allowed board-wide. + if (!$this->data['session_autologin']) + { + if ($this->data['session_time'] < $this->time_now - ($config['session_length'] + 60)) + { + $session_expired = true; + } + } + else if (!$config['allow_autologin'] || ($config['max_autologin_time'] && $this->data['session_time'] < $this->time_now - (86400 * (int) $config['max_autologin_time']) + 60)) + { + $session_expired = true; + } + } + + if (!$session_expired) + { + $this->data['is_registered'] = ($this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false; + $this->data['is_bot'] = (!$this->data['is_registered'] && $this->data['user_id'] != ANONYMOUS) ? true : false; + $this->data['user_lang'] = basename($this->data['user_lang']); + + // Is user banned? Are they excluded? Won't return on ban, exists within method + $this->check_ban_for_current_session($config); + + return true; + } + } + else + { + // Added logging temporarly to help debug bugs... + if (defined('DEBUG') && $this->data['user_id'] != ANONYMOUS) + { + if ($referer_valid) + { + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_IP_BROWSER_FORWARDED_CHECK', false, array( + $u_ip, + $s_ip, + $u_browser, + $s_browser, + htmlspecialchars($u_forwarded_for), + htmlspecialchars($s_forwarded_for) + )); + } + else + { + $phpbb_log->add('critical', $user->data['user_id'], $user->ip, 'LOG_REFERER_INVALID', false, array($this->referer)); + } + } + } + } + } + + // If we reach here then no (valid) session exists. So we'll create a new one + return $this->session_create(); + } + + /** + * Create a new session + * + * If upon trying to start a session we discover there is nothing existing we + * jump here. Additionally this method is called directly during login to regenerate + * the session for the specific user. In this method we carry out a number of tasks; + * garbage collection, (search)bot checking, banned user comparison. Basically + * though this method will result in a new session for a specific user. + */ + function session_create($user_id = false, $set_admin = false, $persist_login = false, $viewonline = true) + { + global $SID, $_SID, $db, $config, $cache, $phpbb_container, $phpbb_dispatcher; + + $this->data = array(); + + /* Garbage collection ... remove old sessions updating user information + // if necessary. It means (potentially) 11 queries but only infrequently + if ($this->time_now > $config['session_last_gc'] + $config['session_gc']) + { + $this->session_gc(); + }*/ + + // Do we allow autologin on this board? No? Then override anything + // that may be requested here + if (!$config['allow_autologin']) + { + $this->cookie_data['k'] = $persist_login = false; + } + + /** + * Here we do a bot check, oh er saucy! No, not that kind of bot + * check. We loop through the list of bots defined by the admin and + * see if we have any useragent and/or IP matches. If we do, this is a + * bot, act accordingly + */ + $bot = false; + $active_bots = $cache->obtain_bots(); + + foreach ($active_bots as $row) + { + if ($row['bot_agent'] && preg_match('#' . str_replace('\*', '.*?', preg_quote($row['bot_agent'], '#')) . '#i', $this->browser)) + { + $bot = $row['user_id']; + } + + // If ip is supplied, we will make sure the ip is matching too... + if ($row['bot_ip'] && ($bot || !$row['bot_agent'])) + { + // Set bot to false, then we only have to set it to true if it is matching + $bot = false; + + foreach (explode(',', $row['bot_ip']) as $bot_ip) + { + $bot_ip = trim($bot_ip); + + if (!$bot_ip) + { + continue; + } + + if (strpos($this->ip, $bot_ip) === 0) + { + $bot = (int) $row['user_id']; + break; + } + } + } + + if ($bot) + { + break; + } + } + + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $provider = $provider_collection->get_provider(); + $this->data = $provider->autologin(); + + if ($user_id !== false && isset($this->data['user_id']) && $this->data['user_id'] != $user_id) + { + $this->data = array(); + } + + if (isset($this->data['user_id'])) + { + $this->cookie_data['k'] = ''; + $this->cookie_data['u'] = $this->data['user_id']; + } + + // If we're presented with an autologin key we'll join against it. + // Else if we've been passed a user_id we'll grab data based on that + if (isset($this->cookie_data['k']) && $this->cookie_data['k'] && $this->cookie_data['u'] && empty($this->data)) + { + $sql = 'SELECT u.* + FROM ' . USERS_TABLE . ' u, ' . SESSIONS_KEYS_TABLE . ' k + WHERE u.user_id = ' . (int) $this->cookie_data['u'] . ' + AND u.user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ") + AND k.user_id = u.user_id + AND k.key_id = '" . $db->sql_escape(md5($this->cookie_data['k'])) . "'"; + $result = $db->sql_query($sql); + $user_data = $db->sql_fetchrow($result); + + if ($user_id === false || (isset($user_data['user_id']) && $user_id == $user_data['user_id'])) + { + $this->data = $user_data; + $bot = false; + } + + $db->sql_freeresult($result); + } + + if ($user_id !== false && empty($this->data)) + { + $this->cookie_data['k'] = ''; + $this->cookie_data['u'] = $user_id; + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $this->cookie_data['u'] . ' + AND user_type IN (' . USER_NORMAL . ', ' . USER_FOUNDER . ')'; + $result = $db->sql_query($sql); + $this->data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + $bot = false; + } + + // Bot user, if they have a SID in the Request URI we need to get rid of it + // otherwise they'll index this page with the SID, duplicate content oh my! + if ($bot && isset($_GET['sid'])) + { + send_status_line(301, 'Moved Permanently'); + redirect(build_url(array('sid'))); + } + + // If no data was returned one or more of the following occurred: + // Key didn't match one in the DB + // User does not exist + // User is inactive + // User is bot + if (!is_array($this->data) || !count($this->data)) + { + $this->cookie_data['k'] = ''; + $this->cookie_data['u'] = ($bot) ? $bot : ANONYMOUS; + + if (!$bot) + { + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $this->cookie_data['u']; + } + else + { + // We give bots always the same session if it is not yet expired. + $sql = 'SELECT u.*, s.* + FROM ' . USERS_TABLE . ' u + LEFT JOIN ' . SESSIONS_TABLE . ' s ON (s.session_user_id = u.user_id) + WHERE u.user_id = ' . (int) $bot; + } + + $result = $db->sql_query($sql); + $this->data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + if ($this->data['user_id'] != ANONYMOUS && !$bot) + { + $this->data['session_last_visit'] = (isset($this->data['session_time']) && $this->data['session_time']) ? $this->data['session_time'] : (($this->data['user_lastvisit']) ? $this->data['user_lastvisit'] : time()); + } + else + { + $this->data['session_last_visit'] = $this->time_now; + } + + // Force user id to be integer... + $this->data['user_id'] = (int) $this->data['user_id']; + + // At this stage we should have a filled data array, defined cookie u and k data. + // data array should contain recent session info if we're a real user and a recent + // session exists in which case session_id will also be set + + // Is user banned? Are they excluded? Won't return on ban, exists within method + $this->check_ban_for_current_session($config); + + $this->data['is_registered'] = (!$bot && $this->data['user_id'] != ANONYMOUS && ($this->data['user_type'] == USER_NORMAL || $this->data['user_type'] == USER_FOUNDER)) ? true : false; + $this->data['is_bot'] = ($bot) ? true : false; + + // If our friend is a bot, we re-assign a previously assigned session + if ($this->data['is_bot'] && $bot == $this->data['user_id'] && $this->data['session_id']) + { + // Only assign the current session if the ip, browser and forwarded_for match... + if (strpos($this->ip, ':') !== false && strpos($this->data['session_ip'], ':') !== false) + { + $s_ip = short_ipv6($this->data['session_ip'], $config['ip_check']); + $u_ip = short_ipv6($this->ip, $config['ip_check']); + } + else + { + $s_ip = implode('.', array_slice(explode('.', $this->data['session_ip']), 0, $config['ip_check'])); + $u_ip = implode('.', array_slice(explode('.', $this->ip), 0, $config['ip_check'])); + } + + $s_browser = ($config['browser_check']) ? trim(strtolower(substr($this->data['session_browser'], 0, 149))) : ''; + $u_browser = ($config['browser_check']) ? trim(strtolower(substr($this->browser, 0, 149))) : ''; + + $s_forwarded_for = ($config['forwarded_for_check']) ? substr($this->data['session_forwarded_for'], 0, 254) : ''; + $u_forwarded_for = ($config['forwarded_for_check']) ? substr($this->forwarded_for, 0, 254) : ''; + + if ($u_ip === $s_ip && $s_browser === $u_browser && $s_forwarded_for === $u_forwarded_for) + { + $this->session_id = $this->data['session_id']; + + // Only update session DB a minute or so after last update or if page changes + if ($this->time_now - $this->data['session_time'] > 60 || ($this->update_session_page && $this->data['session_page'] != $this->page['page'])) + { + // Update the last visit time + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $this->data['session_time'] . ' + WHERE user_id = ' . (int) $this->data['user_id']; + $db->sql_query($sql); + } + + $SID = '?sid='; + $_SID = ''; + return true; + } + else + { + // If the ip and browser does not match make sure we only have one bot assigned to one session + $db->sql_query('DELETE FROM ' . SESSIONS_TABLE . ' WHERE session_user_id = ' . $this->data['user_id']); + } + } + + $session_autologin = (($this->cookie_data['k'] || $persist_login) && $this->data['is_registered']) ? true : false; + $set_admin = ($set_admin && $this->data['is_registered']) ? true : false; + + // Create or update the session + $sql_ary = array( + 'session_user_id' => (int) $this->data['user_id'], + 'session_start' => (int) $this->time_now, + 'session_last_visit' => (int) $this->data['session_last_visit'], + 'session_time' => (int) $this->time_now, + 'session_browser' => (string) trim(substr($this->browser, 0, 149)), + 'session_forwarded_for' => (string) $this->forwarded_for, + 'session_ip' => (string) $this->ip, + 'session_autologin' => ($session_autologin) ? 1 : 0, + 'session_admin' => ($set_admin) ? 1 : 0, + 'session_viewonline' => ($viewonline) ? 1 : 0, + ); + + if ($this->update_session_page) + { + $sql_ary['session_page'] = (string) substr($this->page['page'], 0, 199); + $sql_ary['session_forum_id'] = $this->page['forum']; + } + + $db->sql_return_on_error(true); + + $sql = 'DELETE + FROM ' . SESSIONS_TABLE . ' + WHERE session_id = \'' . $db->sql_escape($this->session_id) . '\' + AND session_user_id = ' . ANONYMOUS; + + if (!defined('IN_ERROR_HANDLER') && (!$this->session_id || !$db->sql_query($sql) || !$db->sql_affectedrows())) + { + // Limit new sessions in 1 minute period (if required) + if (empty($this->data['session_time']) && $config['active_sessions']) + { +// $db->sql_return_on_error(false); + + $sql = 'SELECT COUNT(session_id) AS sessions + FROM ' . SESSIONS_TABLE . ' + WHERE session_time >= ' . ($this->time_now - 60); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ((int) $row['sessions'] > (int) $config['active_sessions']) + { + send_status_line(503, 'Service Unavailable'); + trigger_error('BOARD_UNAVAILABLE'); + } + } + } + + // Since we re-create the session id here, the inserted row must be unique. Therefore, we display potential errors. + // Commented out because it will not allow forums to update correctly +// $db->sql_return_on_error(false); + + // Something quite important: session_page always holds the *last* page visited, except for the *first* visit. + // We are not able to simply have an empty session_page btw, therefore we need to tell phpBB how to detect this special case. + // If the session id is empty, we have a completely new one and will set an "identifier" here. This identifier is able to be checked later. + if (empty($this->data['session_id'])) + { + // This is a temporary variable, only set for the very first visit + $this->data['session_created'] = true; + } + + $this->session_id = $this->data['session_id'] = md5(unique_id()); + + $sql_ary['session_id'] = (string) $this->session_id; + $sql_ary['session_page'] = (string) substr($this->page['page'], 0, 199); + $sql_ary['session_forum_id'] = $this->page['forum']; + + $sql = 'INSERT INTO ' . SESSIONS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + + $db->sql_return_on_error(false); + + // Regenerate autologin/persistent login key + if ($session_autologin) + { + $this->set_login_key(); + } + + // refresh data + $SID = '?sid=' . $this->session_id; + $_SID = $this->session_id; + $this->data = array_merge($this->data, $sql_ary); + + if (!$bot) + { + $cookie_expire = $this->time_now + (($config['max_autologin_time']) ? 86400 * (int) $config['max_autologin_time'] : 31536000); + + $this->set_cookie('u', $this->cookie_data['u'], $cookie_expire); + $this->set_cookie('k', $this->cookie_data['k'], $cookie_expire); + $this->set_cookie('sid', $this->session_id, $cookie_expire); + + unset($cookie_expire); + + $sql = 'SELECT COUNT(session_id) AS sessions + FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . (int) $this->data['user_id'] . ' + AND session_time >= ' . (int) ($this->time_now - (max((int) $config['session_length'], (int) $config['form_token_lifetime']))); + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ((int) $row['sessions'] <= 1 || empty($this->data['user_form_salt'])) + { + $this->data['user_form_salt'] = unique_id(); + // Update the form key + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_form_salt = \'' . $db->sql_escape($this->data['user_form_salt']) . '\' + WHERE user_id = ' . (int) $this->data['user_id']; + $db->sql_query($sql); + } + } + else + { + $this->data['session_time'] = $this->data['session_last_visit'] = $this->time_now; + + // Update the last visit time + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $this->data['session_time'] . ' + WHERE user_id = ' . (int) $this->data['user_id']; + $db->sql_query($sql); + + $SID = '?sid='; + $_SID = ''; + } + + $session_data = $sql_ary; + /** + * Event to send new session data to extension + * Read-only event + * + * @event core.session_create_after + * @var array session_data Associative array of session keys to be updated + * @since 3.1.6-RC1 + */ + $vars = array('session_data'); + extract($phpbb_dispatcher->trigger_event('core.session_create_after', compact($vars))); + unset($session_data); + + return true; + } + + /** + * Kills a session + * + * This method does what it says on the tin. It will delete a pre-existing session. + * It resets cookie information (destroying any autologin key within that cookie data) + * and update the users information from the relevant session data. It will then + * grab guest user information. + */ + function session_kill($new_session = true) + { + global $SID, $_SID, $db, $phpbb_container, $phpbb_dispatcher; + + $sql = 'DELETE FROM ' . SESSIONS_TABLE . " + WHERE session_id = '" . $db->sql_escape($this->session_id) . "' + AND session_user_id = " . (int) $this->data['user_id']; + $db->sql_query($sql); + + $user_id = (int) $this->data['user_id']; + $session_id = $this->session_id; + /** + * Event to send session kill information to extension + * Read-only event + * + * @event core.session_kill_after + * @var int user_id user_id of the session user. + * @var string session_id current user's session_id + * @var bool new_session should we create new session for user + * @since 3.1.6-RC1 + */ + $vars = array('user_id', 'session_id', 'new_session'); + extract($phpbb_dispatcher->trigger_event('core.session_kill_after', compact($vars))); + unset($user_id); + unset($session_id); + + // Allow connecting logout with external auth method logout + /* @var $provider_collection \phpbb\auth\provider_collection */ + $provider_collection = $phpbb_container->get('auth.provider_collection'); + $provider = $provider_collection->get_provider(); + $provider->logout($this->data, $new_session); + + if ($this->data['user_id'] != ANONYMOUS) + { + // Delete existing session, update last visit info first! + if (!isset($this->data['session_time'])) + { + $this->data['session_time'] = time(); + } + + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $this->data['session_time'] . ' + WHERE user_id = ' . (int) $this->data['user_id']; + $db->sql_query($sql); + + if ($this->cookie_data['k']) + { + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE user_id = ' . (int) $this->data['user_id'] . " + AND key_id = '" . $db->sql_escape(md5($this->cookie_data['k'])) . "'"; + $db->sql_query($sql); + } + + // Reset the data array + $this->data = array(); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . ANONYMOUS; + $result = $db->sql_query($sql); + $this->data = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + $cookie_expire = $this->time_now - 31536000; + $this->set_cookie('u', '', $cookie_expire); + $this->set_cookie('k', '', $cookie_expire); + $this->set_cookie('sid', '', $cookie_expire); + unset($cookie_expire); + + $SID = '?sid='; + $this->session_id = $_SID = ''; + + // To make sure a valid session is created we create one for the anonymous user + if ($new_session) + { + $this->session_create(ANONYMOUS); + } + + return true; + } + + /** + * Session garbage collection + * + * This looks a lot more complex than it really is. Effectively we are + * deleting any sessions older than an admin definable limit. Due to the + * way in which we maintain session data we have to ensure we update user + * data before those sessions are destroyed. In addition this method + * removes autologin key information that is older than an admin defined + * limit. + */ + function session_gc() + { + global $db, $config, $phpbb_container, $phpbb_dispatcher; + + $batch_size = 10; + + if (!$this->time_now) + { + $this->time_now = time(); + } + + // Firstly, delete guest sessions + $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . ANONYMOUS . ' + AND session_time < ' . (int) ($this->time_now - $config['session_length']); + $db->sql_query($sql); + + // Get expired sessions, only most recent for each user + $sql = 'SELECT session_user_id, session_page, MAX(session_time) AS recent_time + FROM ' . SESSIONS_TABLE . ' + WHERE session_time < ' . ($this->time_now - $config['session_length']) . ' + GROUP BY session_user_id, session_page'; + $result = $db->sql_query_limit($sql, $batch_size); + + $del_user_id = array(); + $del_sessions = 0; + + while ($row = $db->sql_fetchrow($result)) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $row['recent_time'] . ", user_lastpage = '" . $db->sql_escape($row['session_page']) . "' + WHERE user_id = " . (int) $row['session_user_id']; + $db->sql_query($sql); + + $del_user_id[] = (int) $row['session_user_id']; + $del_sessions++; + } + $db->sql_freeresult($result); + + if (count($del_user_id)) + { + // Delete expired sessions + $sql = 'DELETE FROM ' . SESSIONS_TABLE . ' + WHERE ' . $db->sql_in_set('session_user_id', $del_user_id) . ' + AND session_time < ' . ($this->time_now - $config['session_length']); + $db->sql_query($sql); + } + + if ($del_sessions < $batch_size) + { + // Less than 10 users, update gc timer ... else we want gc + // called again to delete other sessions + $config->set('session_last_gc', $this->time_now, false); + + if ($config['max_autologin_time']) + { + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE last_login < ' . (time() - (86400 * (int) $config['max_autologin_time'])); + $db->sql_query($sql); + } + + // only called from CRON; should be a safe workaround until the infrastructure gets going + /* @var $captcha_factory \phpbb\captcha\factory */ + $captcha_factory = $phpbb_container->get('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']); + $db->sql_query($sql); + } + + /** + * Event to trigger extension on session_gc + * + * @event core.session_gc_after + * @since 3.1.6-RC1 + */ + $phpbb_dispatcher->dispatch('core.session_gc_after'); + + return; + } + + /** + * Sets a cookie + * + * Sets a cookie of the given name with the specified data for the given length of time. If no time is specified, a session cookie will be set. + * + * @param string $name Name of the cookie, will be automatically prefixed with the phpBB cookie name. track becomes [cookie_name]_track then. + * @param string $cookiedata The data to hold within the cookie + * @param int $cookietime The expiration time as UNIX timestamp. If 0 is provided, a session cookie is set. + * @param bool $httponly Use HttpOnly. Defaults to true. Use false to make cookie accessible by client-side scripts. + */ + function set_cookie($name, $cookiedata, $cookietime, $httponly = true) + { + global $config; + + // If headers are already set, we just return + if (headers_sent()) + { + return; + } + + $name_data = rawurlencode($config['cookie_name'] . '_' . $name) . '=' . rawurlencode($cookiedata); + $expire = gmdate('D, d-M-Y H:i:s \\G\\M\\T', $cookietime); + $domain = (!$config['cookie_domain'] || $config['cookie_domain'] == '127.0.0.1' || strpos($config['cookie_domain'], '.') === false) ? '' : '; domain=' . $config['cookie_domain']; + + header('Set-Cookie: ' . $name_data . (($cookietime) ? '; expires=' . $expire : '') . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . ';' . (($httponly) ? ' HttpOnly' : ''), false); + } + + /** + * Check for banned user + * + * Checks whether the supplied user is banned by id, ip or email. If no parameters + * are passed to the method pre-existing session data is used. + * + * @param int|false $user_id The user id + * @param mixed $user_ips Can contain a string with one IP or an array of multiple IPs + * @param string|false $user_email The user email + * @param bool $return If $return is false this routine does not return on finding a banned user, + * it outputs a relevant message and stops execution. + */ + function check_ban($user_id = false, $user_ips = false, $user_email = false, $return = false) + { + global $config, $db, $phpbb_dispatcher; + + if (defined('IN_CHECK_BAN') || defined('SKIP_CHECK_BAN')) + { + return; + } + + $banned = false; + $cache_ttl = 3600; + $where_sql = array(); + + $sql = 'SELECT ban_ip, ban_userid, ban_email, ban_exclude, ban_give_reason, ban_end + FROM ' . BANLIST_TABLE . ' + WHERE '; + + // Determine which entries to check, only return those + if ($user_email === false) + { + $where_sql[] = "ban_email = ''"; + } + + if ($user_ips === false) + { + $where_sql[] = "(ban_ip = '' OR ban_exclude = 1)"; + } + + if ($user_id === false) + { + $where_sql[] = '(ban_userid = 0 OR ban_exclude = 1)'; + } + else + { + $cache_ttl = ($user_id == ANONYMOUS) ? 3600 : 0; + $_sql = '(ban_userid = ' . $user_id; + + if ($user_email !== false) + { + $_sql .= " OR ban_email <> ''"; + } + + if ($user_ips !== false) + { + $_sql .= " OR ban_ip <> ''"; + } + + $_sql .= ')'; + + $where_sql[] = $_sql; + } + + $sql .= (count($where_sql)) ? implode(' AND ', $where_sql) : ''; + $result = $db->sql_query($sql, $cache_ttl); + + $ban_triggered_by = 'user'; + while ($row = $db->sql_fetchrow($result)) + { + if ($row['ban_end'] && $row['ban_end'] < time()) + { + continue; + } + + $ip_banned = false; + if (!empty($row['ban_ip'])) + { + if (!is_array($user_ips)) + { + $ip_banned = preg_match('#^' . str_replace('\*', '.*?', preg_quote($row['ban_ip'], '#')) . '$#i', $user_ips); + } + else + { + foreach ($user_ips as $user_ip) + { + if (preg_match('#^' . str_replace('\*', '.*?', preg_quote($row['ban_ip'], '#')) . '$#i', $user_ip)) + { + $ip_banned = true; + break; + } + } + } + } + + if ((!empty($row['ban_userid']) && intval($row['ban_userid']) == $user_id) || + $ip_banned || + (!empty($row['ban_email']) && preg_match('#^' . str_replace('\*', '.*?', preg_quote($row['ban_email'], '#')) . '$#i', $user_email))) + { + if (!empty($row['ban_exclude'])) + { + $banned = false; + break; + } + else + { + $banned = true; + $ban_row = $row; + + if (!empty($row['ban_userid']) && intval($row['ban_userid']) == $user_id) + { + $ban_triggered_by = 'user'; + } + else if ($ip_banned) + { + $ban_triggered_by = 'ip'; + } + else + { + $ban_triggered_by = 'email'; + } + + // Don't break. Check if there is an exclude rule for this user + } + } + } + $db->sql_freeresult($result); + + /** + * Event to set custom ban type + * + * @event core.session_set_custom_ban + * @var bool return If $return is false this routine does not return on finding a banned user, it outputs a relevant message and stops execution + * @var bool banned Check if user already banned + * @var array|false ban_row Ban data + * @var string ban_triggered_by Method that caused ban, can be your custom method + * @since 3.1.3-RC1 + */ + $ban_row = isset($ban_row) ? $ban_row : false; + $vars = array('return', 'banned', 'ban_row', 'ban_triggered_by'); + extract($phpbb_dispatcher->trigger_event('core.session_set_custom_ban', compact($vars))); + + if ($banned && !$return) + { + global $phpbb_root_path, $phpEx; + + // If the session is empty we need to create a valid one... + if (empty($this->session_id)) + { + // This seems to be no longer needed? - #14971 +// $this->session_create(ANONYMOUS); + } + + // Initiate environment ... since it won't be set at this stage + $this->setup(); + + // Logout the user, banned users are unable to use the normal 'logout' link + if ($this->data['user_id'] != ANONYMOUS) + { + $this->session_kill(); + } + + // We show a login box here to allow founders accessing the board if banned by IP + if (defined('IN_LOGIN') && $this->data['user_id'] == ANONYMOUS) + { + $this->setup('ucp'); + $this->data['is_registered'] = $this->data['is_bot'] = false; + + // Set as a precaution to allow login_box() handling this case correctly as well as this function not being executed again. + define('IN_CHECK_BAN', 1); + + login_box("index.$phpEx"); + + // The false here is needed, else the user is able to circumvent the ban. + $this->session_kill(false); + } + + // Ok, we catch the case of an empty session id for the anonymous user... + // This can happen if the user is logging in, banned by username and the login_box() being called "again". + if (empty($this->session_id) && defined('IN_CHECK_BAN')) + { + $this->session_create(ANONYMOUS); + } + + // Determine which message to output + $till_date = ($ban_row['ban_end']) ? $this->format_date($ban_row['ban_end']) : ''; + $message = ($ban_row['ban_end']) ? 'BOARD_BAN_TIME' : 'BOARD_BAN_PERM'; + + $contact_link = phpbb_get_board_contact_link($config, $phpbb_root_path, $phpEx); + $message = sprintf($this->lang[$message], $till_date, '', ''); + $message .= ($ban_row['ban_give_reason']) ? '

' . sprintf($this->lang['BOARD_BAN_REASON'], $ban_row['ban_give_reason']) : ''; + $message .= '

' . $this->lang['BAN_TRIGGERED_BY_' . strtoupper($ban_triggered_by)] . ''; + + // A very special case... we are within the cron script which is not supposed to print out the ban message... show blank page + if (defined('IN_CRON')) + { + garbage_collection(); + exit_handler(); + exit; + } + + // To circumvent session_begin returning a valid value and the check_ban() not called on second page view, we kill the session again + $this->session_kill(false); + + trigger_error($message); + } + + if (!empty($ban_row)) + { + $ban_row['ban_triggered_by'] = $ban_triggered_by; + } + + return ($banned && $ban_row) ? $ban_row : $banned; + } + + /** + * Check the current session for bans + * + * @return true if session user is banned. + */ + protected function check_ban_for_current_session($config) + { + if (!defined('SKIP_CHECK_BAN') && $this->data['user_type'] != USER_FOUNDER) + { + if (!$config['forwarded_for_check']) + { + $this->check_ban($this->data['user_id'], $this->ip); + } + else + { + $ips = explode(' ', $this->forwarded_for); + $ips[] = $this->ip; + $this->check_ban($this->data['user_id'], $ips); + } + } + } + + /** + * Check if ip is blacklisted + * This should be called only where absolutely necessary + * + * Only IPv4 (rbldns does not support AAAA records/IPv6 lookups) + * + * @author satmd (from the php manual) + * @param string $mode register/post - spamcop for example is ommitted for posting + * @param string|false $ip the IPv4 address to check + * + * @return false if ip is not blacklisted, else an array([checked server], [lookup]) + */ + function check_dnsbl($mode, $ip = false) + { + if ($ip === false) + { + $ip = $this->ip; + } + + // Neither Spamhaus nor Spamcop supports IPv6 addresses. + if (strpos($ip, ':') !== false) + { + return false; + } + + $dnsbl_check = array( + 'sbl.spamhaus.org' => 'http://www.spamhaus.org/query/bl?ip=', + ); + + if ($mode == 'register') + { + $dnsbl_check['bl.spamcop.net'] = 'http://spamcop.net/bl.shtml?'; + } + + if ($ip) + { + $quads = explode('.', $ip); + $reverse_ip = $quads[3] . '.' . $quads[2] . '.' . $quads[1] . '.' . $quads[0]; + + // Need to be listed on all servers... + $listed = true; + $info = array(); + + foreach ($dnsbl_check as $dnsbl => $lookup) + { + if (phpbb_checkdnsrr($reverse_ip . '.' . $dnsbl . '.', 'A') === true) + { + $info = array($dnsbl, $lookup . $ip); + } + else + { + $listed = false; + } + } + + if ($listed) + { + return $info; + } + } + + return false; + } + + /** + * Check if URI is blacklisted + * This should be called only where absolutly necessary, for example on the submitted website field + * This function is not in use at the moment and is only included for testing purposes, it may not work at all! + * This means it is untested at the moment and therefore commented out + * + * @param string $uri URI to check + * @return true if uri is on blacklist, else false. Only blacklist is checked (~zero FP), no grey lists + function check_uribl($uri) + { + // Normally parse_url() is not intended to parse uris + // We need to get the top-level domain name anyway... change. + $uri = parse_url($uri); + + if ($uri === false || empty($uri['host'])) + { + return false; + } + + $uri = trim($uri['host']); + + if ($uri) + { + // One problem here... the return parameter for the "windows" method is different from what + // we expect... this may render this check useless... + if (phpbb_checkdnsrr($uri . '.multi.uribl.com.', 'A') === true) + { + return true; + } + } + + return false; + } + */ + + /** + * Set/Update a persistent login key + * + * This method creates or updates a persistent session key. When a user makes + * use of persistent (formerly auto-) logins a key is generated and stored in the + * DB. When they revisit with the same key it's automatically updated in both the + * DB and cookie. Multiple keys may exist for each user representing different + * browsers or locations. As with _any_ non-secure-socket no passphrase login this + * remains vulnerable to exploit. + */ + function set_login_key($user_id = false, $key = false, $user_ip = false) + { + global $db; + + $user_id = ($user_id === false) ? $this->data['user_id'] : $user_id; + $user_ip = ($user_ip === false) ? $this->ip : $user_ip; + $key = ($key === false) ? (($this->cookie_data['k']) ? $this->cookie_data['k'] : false) : $key; + + $key_id = unique_id(hexdec(substr($this->session_id, 0, 8))); + + $sql_ary = array( + 'key_id' => (string) md5($key_id), + 'last_ip' => (string) $user_ip, + 'last_login' => (int) time() + ); + + if (!$key) + { + $sql_ary += array( + 'user_id' => (int) $user_id + ); + } + + if ($key) + { + $sql = 'UPDATE ' . SESSIONS_KEYS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + WHERE user_id = ' . (int) $user_id . " + AND key_id = '" . $db->sql_escape(md5($key)) . "'"; + } + else + { + $sql = 'INSERT INTO ' . SESSIONS_KEYS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + } + $db->sql_query($sql); + + $this->cookie_data['k'] = $key_id; + + return false; + } + + /** + * Reset all login keys for the specified user + * + * This method removes all current login keys for a specified (or the current) + * user. It will be called on password change to render old keys unusable + */ + function reset_login_keys($user_id = false) + { + global $db; + + $user_id = ($user_id === false) ? (int) $this->data['user_id'] : (int) $user_id; + + $sql = 'DELETE FROM ' . SESSIONS_KEYS_TABLE . ' + WHERE user_id = ' . (int) $user_id; + $db->sql_query($sql); + + // If the user is logged in, update last visit info first before deleting sessions + $sql = 'SELECT session_time, session_page + FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . (int) $user_id . ' + ORDER BY session_time DESC'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $sql = 'UPDATE ' . USERS_TABLE . ' + SET user_lastvisit = ' . (int) $row['session_time'] . ", user_lastpage = '" . $db->sql_escape($row['session_page']) . "' + WHERE user_id = " . (int) $user_id; + $db->sql_query($sql); + } + + // Let's also clear any current sessions for the specified user_id + // If it's the current user then we'll leave this session intact + $sql_where = 'session_user_id = ' . (int) $user_id; + $sql_where .= ($user_id === (int) $this->data['user_id']) ? " AND session_id <> '" . $db->sql_escape($this->session_id) . "'" : ''; + + $sql = 'DELETE FROM ' . SESSIONS_TABLE . " + WHERE $sql_where"; + $db->sql_query($sql); + + // We're changing the password of the current user and they have a key + // Lets regenerate it to be safe + if ($user_id === (int) $this->data['user_id'] && $this->cookie_data['k']) + { + $this->set_login_key($user_id); + } + } + + + /** + * Check if the request originated from the same page. + * @param bool $check_script_path If true, the path will be checked as well + */ + function validate_referer($check_script_path = false) + { + global $config, $request; + + // no referer - nothing to validate, user's fault for turning it off (we only check on POST; so meta can't be the reason) + if (empty($this->referer) || empty($this->host)) + { + return true; + } + + $host = htmlspecialchars($this->host); + $ref = substr($this->referer, strpos($this->referer, '://') + 3); + + if (!(stripos($ref, $host) === 0) && (!$config['force_server_vars'] || !(stripos($ref, $config['server_name']) === 0))) + { + return false; + } + else if ($check_script_path && rtrim($this->page['root_script_path'], '/') !== '') + { + $ref = substr($ref, strlen($host)); + $server_port = $request->server('SERVER_PORT', 0); + + if ($server_port !== 80 && $server_port !== 443 && stripos($ref, ":$server_port") === 0) + { + $ref = substr($ref, strlen(":$server_port")); + } + + if (!(stripos(rtrim($ref, '/'), rtrim($this->page['root_script_path'], '/')) === 0)) + { + return false; + } + } + + return true; + } + + + function unset_admin() + { + global $db; + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET session_admin = 0 + WHERE session_id = \'' . $db->sql_escape($this->session_id) . '\''; + $db->sql_query($sql); + } + + /** + * Update the session data + * + * @param array $session_data associative array of session keys to be updated + * @param string $session_id optional session_id, defaults to current user's session_id + */ + public function update_session($session_data, $session_id = null) + { + global $db, $phpbb_dispatcher; + + $session_id = ($session_id) ? $session_id : $this->session_id; + + $sql = 'UPDATE ' . SESSIONS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $session_data) . " + WHERE session_id = '" . $db->sql_escape($session_id) . "'"; + $db->sql_query($sql); + + /** + * Event to send update session information to extension + * Read-only event + * + * @event core.update_session_after + * @var array session_data Associative array of session keys to be updated + * @var string session_id current user's session_id + * @since 3.1.6-RC1 + */ + $vars = array('session_data', 'session_id'); + extract($phpbb_dispatcher->trigger_event('core.update_session_after', compact($vars))); + } + + public function update_session_infos() + { + global $config, $db, $request; + + // No need to update if it's a new session. Informations are already inserted by session_create() + if (isset($this->data['session_created']) && $this->data['session_created']) + { + return; + } + + // Do not update the session page for ajax requests, so the view online still works as intended + $page_changed = $this->update_session_page && $this->data['session_page'] != $this->page['page'] && !$request->is_ajax(); + + // Only update session DB a minute or so after last update or if page changes + if ($this->time_now - (isset($this->data['session_time']) ? $this->data['session_time'] : 0) > 60 || $page_changed) + { + $sql_ary = array('session_time' => $this->time_now); + + if ($page_changed) + { + $sql_ary['session_page'] = substr($this->page['page'], 0, 199); + $sql_ary['session_forum_id'] = $this->page['forum']; + } + + $db->sql_return_on_error(true); + + $this->update_session($sql_ary); + + $db->sql_return_on_error(false); + + $this->data = array_merge($this->data, $sql_ary); + + if ($this->data['user_id'] != ANONYMOUS && isset($config['new_member_post_limit']) && $this->data['user_new'] && $config['new_member_post_limit'] <= $this->data['user_posts']) + { + $this->leave_newly_registered(); + } + } + } +} diff --git a/install/update/old/phpbb/template/asset.php b/install/update/old/phpbb/template/asset.php new file mode 100644 index 0000000..cb00f16 --- /dev/null +++ b/install/update/old/phpbb/template/asset.php @@ -0,0 +1,210 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template; + +class asset +{ + protected $components = array(); + + /** @var \phpbb\path_helper **/ + protected $path_helper; + + /** @var \phpbb\filesystem\filesystem */ + protected $filesystem; + + /** + * Constructor + * + * @param string $url URL + * @param \phpbb\path_helper $path_helper Path helper object + * @param \phpbb\filesystem\filesystem $filesystem + */ + public function __construct($url, \phpbb\path_helper $path_helper, \phpbb\filesystem\filesystem $filesystem) + { + $this->path_helper = $path_helper; + $this->filesystem = $filesystem; + + $this->set_url($url); + } + + /** + * Set URL + * + * @param string $url URL + */ + public function set_url($url) + { + if (version_compare(PHP_VERSION, '5.4.7') < 0 && substr($url, 0, 2) === '//') + { + // Workaround for PHP 5.4.6 and older bug #62844 - add fake scheme and then remove it + $this->components = parse_url('http:' . $url); + $this->components['scheme'] = ''; + return; + } + $this->components = parse_url($url); + } + + /** + * Convert URL components into string + * + * @param array $components URL components + * @return string URL + */ + protected function join_url($components) + { + $path = ''; + if (isset($components['scheme'])) + { + $path = $components['scheme'] === '' ? '//' : $components['scheme'] . '://'; + } + + if (isset($components['user']) || isset($components['pass'])) + { + if ($path === '' && !isset($components['port'])) + { + $path = '//'; + } + $path .= $components['user']; + if (isset($components['pass'])) + { + $path .= ':' . $components['pass']; + } + $path .= '@'; + } + + if (isset($components['host'])) + { + if ($path === '' && !isset($components['port'])) + { + $path = '//'; + } + $path .= $components['host']; + if (isset($components['port'])) + { + $path .= ':' . $components['port']; + } + } + + if (isset($components['path'])) + { + $path .= $components['path']; + } + + if (isset($components['query'])) + { + $path .= '?' . $components['query']; + } + + if (isset($components['fragment'])) + { + $path .= '#' . $components['fragment']; + } + + return $path; + } + + /** + * Get URL + * + * @return string URL + */ + public function get_url() + { + return $this->path_helper->update_web_root_path($this->join_url($this->components)); + } + + /** + * Checks if URL is local and relative + * + * @return boolean True if URL is local and relative + */ + public function is_relative() + { + if (empty($this->components) || !isset($this->components['path'])) + { + // Invalid URL + return false; + } + return !isset($this->components['scheme']) && !isset($this->components['host']) && substr($this->components['path'], 0, 1) !== '/'; + } + + /** + * Get path component of current URL + * + * @return string Path + */ + public function get_path() + { + return isset($this->components['path']) ? $this->components['path'] : ''; + } + + /** + * Set path component + * + * @param string $path Path component + * @param boolean $urlencode If true, parts of path should be encoded with rawurlencode() + */ + public function set_path($path, $urlencode = false) + { + // Since 1.7.0 Twig returns the real path of the file. We need it to be relative. + $real_root_path = $this->filesystem->realpath($this->path_helper->get_phpbb_root_path()) . DIRECTORY_SEPARATOR; + + // If the asset is under the phpBB root path we need to remove its path and then prepend $phpbb_root_path + if ($real_root_path && substr($path . DIRECTORY_SEPARATOR, 0, strlen($real_root_path)) === $real_root_path) + { + $path = $this->path_helper->get_phpbb_root_path() . str_replace('\\', '/', substr($path, strlen($real_root_path))); + } + else + { + // Else we make the path relative to the current working directory + $real_root_path = $this->filesystem->realpath('.') . DIRECTORY_SEPARATOR; + if ($real_root_path && substr($path . DIRECTORY_SEPARATOR, 0, strlen($real_root_path)) === $real_root_path) + { + $path = str_replace('\\', '/', substr($path, strlen($real_root_path))); + } + } + + if ($urlencode) + { + $paths = explode('/', $path); + foreach ($paths as &$dir) + { + $dir = rawurlencode($dir); + } + $path = implode('/', $paths); + } + + $this->components['path'] = $path; + } + + /** + * Add assets_version parameter to URL. + * Parameter will not be added if assets_version already exists in URL + * + * @param string $version Version + */ + public function add_assets_version($version) + { + if (!isset($this->components['query'])) + { + $this->components['query'] = 'assets_version=' . $version; + return; + } + $query = $this->components['query']; + if (!preg_match('/(^|[&;])assets_version=/', $query)) + { + $this->components['query'] = $query . '&assets_version=' . $version; + } + } +} diff --git a/install/update/old/phpbb/template/context.php b/install/update/old/phpbb/template/context.php new file mode 100644 index 0000000..202e29c --- /dev/null +++ b/install/update/old/phpbb/template/context.php @@ -0,0 +1,631 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template; + +/** +* Stores variables assigned to template. +*/ +class context +{ + /** + * variable that holds all the data we'll be substituting into + * the compiled templates. Takes form: + * --> $this->tpldata[block][iteration#][child][iteration#][child2][iteration#][variablename] == value + * if it's a root-level variable, it'll be like this: + * --> $this->tpldata[.][0][varname] == value + * + * @var array + */ + private $tpldata = array('.' => array(0 => array())); + + /** + * @var array Reference to template->tpldata['.'][0] + */ + private $rootref; + + /** + * @var bool + */ + private $num_rows_is_set; + + public function __construct() + { + $this->clear(); + } + + /** + * Clears template data set. + */ + public function clear() + { + $this->tpldata = array('.' => array(0 => array())); + $this->rootref = &$this->tpldata['.'][0]; + $this->num_rows_is_set = false; + } + + /** + * 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 true + */ + public function assign_var($varname, $varval) + { + $this->rootref[$varname] = $varval; + + return true; + } + + /** + * 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 true + */ + public function append_var($varname, $varval) + { + $this->rootref[$varname] = (isset($this->rootref[$varname]) ? $this->rootref[$varname] : '') . $varval; + + return true; + } + + /** + * Retreive a single scalar value from a single key. + * + * @param string $varname Variable name + * @return mixed Variable value, or null if not set + */ + public function retrieve_var($varname) + { + return isset($this->rootref[$varname]) ? $this->rootref[$varname] : null; + } + + /** + * Returns a reference to template data array. + * + * This function is public so that template renderer may invoke it. + * Users should alter template variables via functions in \phpbb\template\template. + * + * Note: modifying returned array will affect data stored in the context. + * + * @return array template data + */ + public function &get_data_ref() + { + // returning a reference directly is not + // something php is capable of doing + $ref = &$this->tpldata; + + if (!$this->num_rows_is_set) + { + /* + * We do not set S_NUM_ROWS while adding a row, to reduce the complexity + * If we would set it on adding, each subsequent adding would cause + * n modifications, resulting in a O(n!) complexity, rather then O(n) + */ + foreach ($ref as $loop_name => &$loop_data) + { + if ($loop_name === '.') + { + continue; + } + + $this->set_num_rows($loop_data); + } + $this->num_rows_is_set = true; + } + + return $ref; + } + + /** + * Set S_NUM_ROWS for each row in this template block + * + * @param array $loop_data + */ + protected function set_num_rows(&$loop_data) + { + $s_num_rows = count($loop_data); + foreach ($loop_data as &$mod_block) + { + foreach ($mod_block as $sub_block_name => &$sub_block) + { + // If the key name is lowercase and the data is an array, + // it could be a template loop. So we set the S_NUM_ROWS there + // aswell. + if ($sub_block_name === strtolower($sub_block_name) && is_array($sub_block)) + { + $this->set_num_rows($sub_block); + } + } + + // Check whether we are inside a block before setting the variable + if (isset($mod_block['S_BLOCK_NAME'])) + { + $mod_block['S_NUM_ROWS'] = $s_num_rows; + } + } + } + + /** + * Returns a reference to template root scope. + * + * This function is public so that template renderer may invoke it. + * Users should not need to invoke this function. + * + * Note: modifying returned array will affect data stored in the context. + * + * @return array template data + */ + public function &get_root_ref() + { + // rootref is already a reference + return $this->rootref; + } + + /** + * 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 true + */ + public function assign_block_vars($blockname, array $vararray) + { + $this->num_rows_is_set = false; + + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; + + $block = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + $pos = strpos($blocks[$i], '['); + $name = ($pos !== false) ? substr($blocks[$i], 0, $pos) : $blocks[$i]; + $block = &$block[$name]; + $block_count = empty($block) ? 0 : count($block) - 1; + $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? $block_count : (min((int) substr($blocks[$i], $pos + 1, -1), $block_count)); + $block = &$block[$index]; + } + + // $block = &$block[$blocks[$i]]; // Do not traverse the last block as it might be empty + $name = $blocks[$i]; + + // Assign S_ROW_COUNT and S_ROW_NUM + $s_row_count = isset($block[$name]) ? count($block[$name]) : 0; + $vararray['S_ROW_COUNT'] = $vararray['S_ROW_NUM'] = $s_row_count; + + // Assign S_FIRST_ROW + if (!$s_row_count) + { + $vararray['S_FIRST_ROW'] = true; + } + + // Assign S_BLOCK_NAME + $vararray['S_BLOCK_NAME'] = $name; + + // Now the tricky part, we always assign S_LAST_ROW and remove the entry before + // This is much more clever than going through the complete template data on display (phew) + $vararray['S_LAST_ROW'] = true; + if ($s_row_count > 0) + { + unset($block[$name][($s_row_count - 1)]['S_LAST_ROW']); + } + + // Now we add the block that we're actually assigning to. + // We're adding a new iteration to this block with the given + // variable assignments. + $block[$name][] = $vararray; + + return true; + } + + /** + * Assign key variable pairs from an array to a whole specified block loop + * + * @param string $blockname Name of block to assign $block_vars_array to + * @param array $block_vars_array An array of hashes of variable name => value pairs + * @return true + */ + public function assign_block_vars_array($blockname, array $block_vars_array) + { + foreach ($block_vars_array as $vararray) + { + $this->assign_block_vars($blockname, $vararray); + } + + return true; + } + + /** + * Retrieve key variable pairs from the specified block + * + * @param string $blockname Name of block to retrieve $vararray from + * @param array $vararray An array of variable names, empty array retrieves all vars + * @return array of hashes with variable name as key and retrieved value or null as value + */ + public function retrieve_block_vars($blockname, array $vararray) + { + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; + + $block = $this->tpldata; + for ($i = 0; $i <= $blockcount; $i++) + { + if (($pos = strpos($blocks[$i], '[')) !== false) + { + $name = substr($blocks[$i], 0, $pos); + + if (empty($block[$name])) + { + return array(); + } + + if (strpos($blocks[$i], '[]') === $pos) + { + $index = count($block[$name]) - 1; + } + else + { + $index = min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1); + } + } + else + { + $name = $blocks[$i]; + if (empty($block[$name])) + { + return array(); + } + + $index = count($block[$name]) - 1; + } + $block = $block[$name]; + $block = $block[$index]; + } + + $result = array(); + if ($vararray === array()) + { + // The calculated vars that depend on the block position are excluded from the complete block returned results + $excluded_vars = array('S_FIRST_ROW', 'S_LAST_ROW', 'S_BLOCK_NAME', 'S_NUM_ROWS', 'S_ROW_COUNT', 'S_ROW_NUM'); + + foreach ($block as $varname => $varvalue) + { + if ($varname === strtoupper($varname) && !is_array($varvalue) && !in_array($varname, $excluded_vars)) + { + $result[$varname] = $varvalue; + } + } + } + else + { + foreach ($vararray as $varname) + { + $result[$varname] = isset($block[$varname]) ? $block[$varname] : null; + } + } + return $result; + } + + /** + * Find the index for a specified key in the innermost specified block + * + * @param string $blockname the blockname, for example 'loop' + * @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 search for] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @return mixed false if not found, index position otherwise; be sure to test with === + */ + public function find_key_index($blockname, $key) + { + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; + + $block = $this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + $pos = strpos($blocks[$i], '['); + $name = ($pos !== false) ? substr($blocks[$i], 0, $pos) : $blocks[$i]; + + if (!isset($block[$name])) + { + return false; + } + + $index = (!$pos || strpos($blocks[$i], '[]') === $pos) ? (count($block[$name]) - 1) : (min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1)); + + if (!isset($block[$name][$index])) + { + return false; + } + $block = $block[$name][$index]; + } + + if (!isset($block[$blocks[$i]])) + { + return false; + } + $block = $block[$blocks[$i]]; // Traverse the last block + + // Change key to zero (change first position) if false and to last position if true + if (is_bool($key)) + { + return (!$key) ? 0 : count($block) - 1; + } + + // Get correct position if array given + if (is_array($key)) + { + // Search array to get correct position + list($search_key, $search_value) = @each($key); + foreach ($block as $i => $val_ary) + { + if ($val_ary[$search_key] === $search_value) + { + return $i; + } + } + } + + return (is_int($key) && ((0 <= $key) && ($key < count($block)))) ? $key : false; + } + + /** + * 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', 'change' and 'delete') + * + * 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). + * If delete, the vararray is ignored, and the block at the given position (counting from zero) is removed. + * + * 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') + { + $this->num_rows_is_set = false; + + // For nested block, $blockcount > 0, for top-level block, $blockcount == 0 + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; + + $block = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + if (($pos = strpos($blocks[$i], '[')) !== false) + { + $name = substr($blocks[$i], 0, $pos); + + if (strpos($blocks[$i], '[]') === $pos) + { + $index = count($block[$name]) - 1; + } + else + { + $index = min((int) substr($blocks[$i], $pos + 1, -1), count($block[$name]) - 1); + } + } + else + { + $name = $blocks[$i]; + $index = count($block[$name]) - 1; + } + $block = &$block[$name]; + $block = &$block[$index]; + } + $name = $blocks[$i]; + + // If last block does not exist and we are inserting, and not searching for key, we create it empty; otherwise, nothing to do + if (!isset($block[$name])) + { + if ($mode != 'insert' || is_array($key)) + { + return false; + } + $block[$name] = array(); + } + + $block = &$block[$name]; // Now we can traverse the last block + + // Change key to zero (change first position) if false and to last position if true + if ($key === false || $key === true) + { + $key = ($key === false) ? 0 : count($block); + } + + // Get correct position if array given + if (is_array($key)) + { + // Search array to get correct position + list($search_key, $search_value) = @each($key); + + $key = null; + foreach ($block as $i => $val_ary) + { + if ($val_ary[$search_key] === $search_value) + { + $key = $i; + break; + } + } + + // key/value pair not found + if ($key === null) + { + return false; + } + } + + // Insert Block + if ($mode == 'insert') + { + // Make sure we are not exceeding the last iteration + if ($key >= count($block)) + { + $key = count($block); + unset($block[($key - 1)]['S_LAST_ROW']); + $vararray['S_LAST_ROW'] = true; + } + if ($key <= 0) + { + $key = 0; + unset($block[0]['S_FIRST_ROW']); + $vararray['S_FIRST_ROW'] = true; + } + + // Assign S_BLOCK_NAME + $vararray['S_BLOCK_NAME'] = $name; + + // Re-position template blocks + for ($i = count($block); $i > $key; $i--) + { + $block[$i] = $block[$i-1]; + + $block[$i]['S_ROW_COUNT'] = $block[$i]['S_ROW_NUM'] = $i; + } + + // Insert vararray at given position + $block[$key] = $vararray; + $block[$key]['S_ROW_COUNT'] = $block[$key]['S_ROW_NUM'] = $key; + + return true; + } + + // Which block to change? + if ($mode == 'change') + { + // If key is out of bounds, do not change anything + if ($key > count($block) || $key < 0) + { + return false; + } + + if ($key == count($block)) + { + $key--; + } + + $block[$key] = array_merge($block[$key], $vararray); + + return true; + } + + // Delete Block + if ($mode == 'delete') + { + // If we are exceeding last iteration, do not delete anything + if ($key > count($block) || $key < 0) + { + return false; + } + + // If we are positioned at the end, we remove the last element + if ($key == count($block)) + { + $key--; + } + + // We are deleting the last element in the block, so remove the block + if (count($block) === 1) + { + $block = null; // unset($block); does not work on references + return true; + } + + // Re-position template blocks + for ($i = $key; $i < count($block)-1; $i++) + { + $block[$i] = $block[$i+1]; + $block[$i]['S_ROW_COUNT'] = $block[$i]['S_ROW_NUM'] = $i; + } + + // Remove the last element + unset($block[$i]); + + // Set first and last elements again, in case they were removed + $block[0]['S_FIRST_ROW'] = true; + $block[count($block)-1]['S_LAST_ROW'] = true; + + return true; + } + + return false; + } + + /** + * Reset/empty complete block + * + * @param string $blockname Name of block to destroy + * @return true + */ + public function destroy_block_vars($blockname) + { + $this->num_rows_is_set = false; + if (strpos($blockname, '.') !== false) + { + // Nested block. + $blocks = explode('.', $blockname); + $blockcount = count($blocks) - 1; + + $str = &$this->tpldata; + for ($i = 0; $i < $blockcount; $i++) + { + $str = &$str[$blocks[$i]]; + $str = &$str[count($str) - 1]; + } + + unset($str[$blocks[$blockcount]]); + } + else + { + // Top-level block. + unset($this->tpldata[$blockname]); + } + + return true; + } +} diff --git a/install/update/old/phpbb/template/template.php b/install/update/old/phpbb/template/template.php new file mode 100644 index 0000000..df83d5b --- /dev/null +++ b/install/update/old/phpbb/template/template.php @@ -0,0 +1,224 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template; + +interface template +{ + + /** + * Clear the cache + * + * @return \phpbb\template\template + */ + public function clear_cache(); + + /** + * Sets the template filenames for handles. + * + * @param array $filename_array Should be a hash of handle => filename pairs. + * @return \phpbb\template\template $this + */ + public function set_filenames(array $filename_array); + + /** + * Get the style tree of the style preferred by the current user + * + * @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\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\template $this + */ + public function set_custom_style($names, $paths); + + /** + * Clears all variables and blocks assigned to this template. + * + * @return \phpbb\template\template $this + */ + public function destroy(); + + /** + * Reset/empty complete block + * + * @param string $blockname Name of block to destroy + * @return \phpbb\template\template $this + */ + public function destroy_block_vars($blockname); + + /** + * Display a template for provided handle. + * + * The template will be loaded and compiled, if necessary, first. + * + * This function calls hooks. + * + * @param string $handle Handle to display + * @return \phpbb\template\template $this + */ + public function display($handle); + + /** + * Display the handle and assign the output to a template variable + * or return the compiled result. + * + * @param string $handle Handle to operate on + * @param string $template_var Template variable to assign compiled handle to + * @param bool $return_content If true return compiled handle, otherwise assign to $template_var + * @return \phpbb\template\template|string if $return_content is true return string of the compiled handle, otherwise return $this + */ + public function assign_display($handle, $template_var = '', $return_content = true); + + /** + * Assign key variable pairs from an array + * + * @param array $vararray A hash of variable name => value pairs + * @return \phpbb\template\template $this + */ + public function assign_vars(array $vararray); + + /** + * Assign a single scalar value to a single key. + * + * Value can be a string, an integer or a boolean. + * + * @param string $varname Variable name + * @param string $varval Value to assign to variable + * @return \phpbb\template\template $this + */ + public function assign_var($varname, $varval); + + /** + * Append text to the string value stored in a key. + * + * Text is appended using the string concatenation operator (.). + * + * @param string $varname Variable name + * @param string $varval Value to append to variable + * @return \phpbb\template\template $this + */ + public function append_var($varname, $varval); + + /** + * Retrieve multiple template values + * + * @param array $vararray An array with variable names + * @return array A hash of variable name => value pairs (value is null if not set) + */ + public function retrieve_vars(array $vararray); + + /** + * Retreive a single scalar value from a single key. + * + * @param string $varname Variable name + * @return mixed Variable value, or null if not set + */ + public function retrieve_var($varname); + + /** + * 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\template $this + */ + public function assign_block_vars($blockname, array $vararray); + + /** + * Assign key variable pairs from an array to a whole specified block loop + * @param string $blockname Name of block to assign $block_vars_array to + * @param array $block_vars_array An array of hashes of variable name => value pairs + * @return \phpbb\template\template $this + */ + public function assign_block_vars_array($blockname, array $block_vars_array); + + /** + * Retrieve variable values from an specified block + * @param string $blockname Name of block to retrieve $vararray from + * @param array $vararray An array with variable names, empty array gets all vars + * @return array A hash of variable name => value pairs (value is null if not set) + */ + public function retrieve_block_vars($blockname, array $vararray); + + /** + * Change already assigned key variable pair (one-dimensional - single loop entry) + * + * An example of how to use this function: + * {@example alter_block_array.php} + * + * @param string $blockname the blockname, for example 'loop' + * @param array $vararray the var array to insert/add or merge + * @param mixed $key Key to search for + * + * array: KEY => VALUE [the key/value pair to search for within the loop to determine the correct position] + * + * int: Position [the position to change or insert at directly given] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @param string $mode Mode to execute (valid modes are 'insert', 'change' and 'delete') + * + * 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). + * If delete, the vararray is ignored, and the block at the given position (counting from zero) is removed. + * + * 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'); + + /** + * Find the index for a specified key in the innermost specified block + * + * @param string $blockname the blockname, for example 'loop' + * @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 search for] + * + * If key is false the position is set to 0 + * If key is true the position is set to the last entry + * + * @return mixed false if not found, index position otherwise; be sure to test with === + */ + public function find_key_index($blockname, $key); + + /** + * Get path to template for handle (required for BBCode parser) + * + * @param string $handle Handle to retrieve the source file + * @return string + */ + public function get_source_file_for_handle($handle); +} diff --git a/install/update/old/phpbb/template/twig/extension.php b/install/update/old/phpbb/template/twig/extension.php new file mode 100644 index 0000000..f6f8e03 --- /dev/null +++ b/install/update/old/phpbb/template/twig/extension.php @@ -0,0 +1,185 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig; + +class extension extends \Twig_Extension +{ + /** @var \phpbb\template\context */ + protected $context; + + /** @var \phpbb\language\language */ + protected $language; + + /** + * Constructor + * + * @param \phpbb\template\context $context + * @param \phpbb\language\language $language + * @return \phpbb\template\twig\extension + */ + public function __construct(\phpbb\template\context $context, $language) + { + $this->context = $context; + $this->language = $language; + } + + /** + * Get the name of this extension + * + * @return string + */ + public function getName() + { + return 'phpbb'; + } + + /** + * Returns the token parser instance to add to the existing list. + * + * @return array An array of Twig_TokenParser instances + */ + public function getTokenParsers() + { + return array( + new \phpbb\template\twig\tokenparser\defineparser, + new \phpbb\template\twig\tokenparser\includeparser, + new \phpbb\template\twig\tokenparser\includejs, + new \phpbb\template\twig\tokenparser\includecss, + new \phpbb\template\twig\tokenparser\event, + new \phpbb\template\twig\tokenparser\includephp, + new \phpbb\template\twig\tokenparser\php, + ); + } + + /** + * Returns a list of filters to add to the existing list. + * + * @return array An array of filters + */ + public function getFilters() + { + return array( + new \Twig_SimpleFilter('subset', array($this, 'loop_subset'), array('needs_environment' => true)), + // @deprecated 3.2.0 Uses twig's JS escape method instead of addslashes + new \Twig_SimpleFilter('addslashes', 'addslashes'), + ); + } + + /** + * Returns a list of global functions to add to the existing list. + * + * @return array An array of global functions + */ + public function getFunctions() + { + return array( + new \Twig_SimpleFunction('lang', array($this, 'lang')), + ); + } + + /** + * Returns a list of operators to add to the existing list. + * + * @return array An array of operators + */ + public function getOperators() + { + return array( + array( + '!' => array('precedence' => 50, 'class' => 'Twig_Node_Expression_Unary_Not'), + ), + array( + // precedence settings are copied from similar operators in Twig core extension + '||' => array('precedence' => 10, 'class' => 'Twig_Node_Expression_Binary_Or', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '&&' => array('precedence' => 15, 'class' => 'Twig_Node_Expression_Binary_And', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + + 'eq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Equal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + + 'ne' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'neq' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '<>' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_NotEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + + '===' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\equalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + '!==' => array('precedence' => 20, 'class' => '\phpbb\template\twig\node\expression\binary\notequalequal', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + + 'gt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Greater', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'gte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'ge' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_GreaterEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'lt' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_Less', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'lte' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + 'le' => array('precedence' => 20, 'class' => 'Twig_Node_Expression_Binary_LessEqual', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + + 'mod' => array('precedence' => 60, 'class' => 'Twig_Node_Expression_Binary_Mod', 'associativity' => \Twig_ExpressionParser::OPERATOR_LEFT), + ), + ); + } + + /** + * Grabs a subset of a loop + * + * @param \Twig_Environment $env A Twig_Environment instance + * @param mixed $item A variable + * @param integer $start Start of the subset + * @param integer $end End of the subset + * @param Boolean $preserveKeys Whether to preserve key or not (when the input is an array) + * + * @return mixed The sliced variable + */ + function loop_subset(\Twig_Environment $env, $item, $start, $end = null, $preserveKeys = false) + { + // We do almost the same thing as Twig's slice (array_slice), except when $end is positive + if ($end >= 1) + { + // When end is > 1, subset will end on the last item in an array with the specified $end + // This is different from slice in that it is the number we end on rather than the number + // of items to grab (length) + + // Start must always be the actual starting number for this calculation (not negative) + $start = ($start < 0) ? count($item) + $start : $start; + $end = $end - $start; + } + + // We always include the last element (this was the past design) + $end = ($end == -1 || $end === null) ? null : $end + 1; + + return twig_slice($env, $item, $start, $end, $preserveKeys); + } + + /** + * Get output for a language variable (L_FOO, LA_FOO) + * + * This function checks to see if the language var was outputted to $context + * (e.g. in the ACP, L_TITLE) + * If not, we return the result of $user->lang() + * + * @return string + */ + function lang() + { + $args = func_get_args(); + $key = $args[0]; + + $context_vars = $this->context->get_root_ref(); + + if (is_string($key) && isset($context_vars['L_' . $key])) + { + return $context_vars['L_' . $key]; + } + + // LA_ is transformed into lang(\'$1\')|escape('js'), so we should not + // need to check for it + + return call_user_func_array(array($this->language, 'lang'), $args); + } +} diff --git a/install/update/old/phpbb/template/twig/lexer.php b/install/update/old/phpbb/template/twig/lexer.php new file mode 100644 index 0000000..d0bcfa6 --- /dev/null +++ b/install/update/old/phpbb/template/twig/lexer.php @@ -0,0 +1,368 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig; + +class lexer extends \Twig_Lexer +{ + public function set_environment(\Twig_Environment $env) + { + $this->env = $env; + } + + public function tokenize($code, $filename = null) + { + // Handle \Twig_Source format input + if ($code instanceof \Twig_Source) + { + $source = $code; + $code = $source->getCode(); + $filename = $source->getName(); + } + + // Our phpBB tags + // Commented out tokens are handled separately from the main replace + $phpbb_tags = array( + /*'BEGIN', + 'BEGINELSE', + 'END', + 'IF', + 'ELSE', + 'ELSEIF', + 'ENDIF', + 'DEFINE', + 'UNDEFINE',*/ + 'ENDDEFINE', + 'INCLUDE', + 'INCLUDEPHP', + 'INCLUDEJS', + 'INCLUDECSS', + 'PHP', + 'ENDPHP', + 'EVENT', + ); + + // Twig tag masks + $twig_tags = array( + 'autoescape', + 'endautoescape', + 'if', + 'elseif', + 'else', + 'endif', + 'block', + 'endblock', + 'use', + 'extends', + 'embed', + 'filter', + 'endfilter', + 'flush', + 'for', + 'endfor', + 'macro', + 'endmacro', + 'import', + 'from', + 'sandbox', + 'endsandbox', + 'set', + 'endset', + 'spaceless', + 'endspaceless', + 'verbatim', + 'endverbatim', + ); + + // Fix tokens that may have inline variables (e.g. with Twig style, {% TOKEN %} + // This also strips outer parenthesis, becomes + $code = preg_replace('##', '{% $1 $2 %}', $code); + + // Replace all of our twig masks with Twig code (e.g. with {% block $1 %}) + $code = $this->replace_twig_tag_masks($code, $twig_tags); + + // Replace all of our language variables, {L_VARNAME}, with Twig style, {{ lang('NAME') }} + // Appends any filters after lang() + $code = preg_replace('#{L_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2 }}', $code); + + // Replace all of our escaped language variables, {LA_VARNAME}, with Twig style, {{ lang('NAME')|escape('js') }} + // Appends any filters after lang(), but before escape('js') + $code = preg_replace('#{LA_([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ lang(\'$1\')$2|escape(\'js\') }}', $code); + + // Replace all of our variables, {VARNAME}, with Twig style, {{ VARNAME }} + // Appends any filters + $code = preg_replace('#{([a-zA-Z0-9_\.]+)(\|[^}]+?)?}#', '{{ $1$2 }}', $code); + + // Tokenize \Twig_Source instance + return parent::tokenize(new \Twig_Source($code, $filename)); + } + + /** + * Strip surrounding quotes + * + * First step to fix tokens that may have inline variables + * E.g. #', '', $code); + } + + /** + * Fix tokens that may have inline variables + * + * Second step to fix tokens that may have inline variables + * E.g. "; + }; + + return preg_replace_callback('##', $callback, $code); + } + + /** + * Add surrounding quotes + * + * Last step to fix tokens that may have inline variables + * E.g. #', '', $code); + } + + /** + * Fix begin tokens (convert our BEGIN to Twig for) + * + * Not meant to be used outside of this context, public because the anonymous function calls this + * + * @param string $code + * @param array $parent_nodes (used in recursion) + * @return string + */ + public function fix_begin_tokens($code, $parent_nodes = array()) + { + // PHP 5.3 cannot use $this in an anonymous function, so use this as a work-around + $parent_class = $this; + $callback = function ($matches) use ($parent_class, $parent_nodes) + { + $hard_parents = explode('.', $matches[1]); + array_pop($hard_parents); // ends with . + if ($hard_parents) + { + $parent_nodes = array_merge($hard_parents, $parent_nodes); + } + + $name = $matches[2]; + $subset = trim(substr($matches[3], 1, -1)); // Remove parenthesis + $body = $matches[4]; + + // Replace + $body = str_replace('', '{% else %}', $body); + + // Is the designer wanting to call another loop in a loop? + // + // + // + // + // 'loop2' is actually on the same nesting level as 'loop' you assign + // variables to it with template->assign_block_vars('loop2', array(...)) + if (strpos($name, '!') === 0) + { + // Count the number if ! occurrences + $count = substr_count($name, '!'); + for ($i = 0; $i < $count; $i++) + { + array_pop($parent_nodes); + $name = substr($name, 1); + } + } + + // Remove all parent nodes, e.g. foo, bar from foo.bar.foobar.VAR + foreach ($parent_nodes as $node) + { + $body = preg_replace('#([^a-zA-Z0-9_])' . $node . '\.([a-zA-Z0-9_]+)\.#', '$1$2.', $body); + } + + // Add current node to list of parent nodes for child nodes + $parent_nodes[] = $name; + + // Recursive...fix any child nodes + $body = $parent_class->fix_begin_tokens($body, $parent_nodes); + + // Need the parent variable name + array_pop($parent_nodes); + $parent = (!empty($parent_nodes)) ? end($parent_nodes) . '.' : ''; + + if ($subset !== '') + { + $subset = '|subset(' . $subset . ')'; + } + + $parent = ($parent) ?: 'loops.'; + // Turn into a Twig for loop + return "{% for {$name} in {$parent}{$name}{$subset} %}{$body}{% endfor %}"; + }; + + return preg_replace_callback('#(.+?)#s', $callback, $code); + } + + /** + * Fix IF statements + * + * @param string $code + * @return string + */ + protected function fix_if_tokens($code) + { + // Replace ELSE IF with ELSEIF + $code = preg_replace('##', '', $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 + $inner = preg_replace('#(\s\(*!?)\$([a-zA-Z_0-9]+)#', '$1definition.$2', $inner); + + // Replace .foo with loops.foo|length + $inner = preg_replace('#(\s\(*!?)\.([a-zA-Z_0-9]+)([^a-zA-Z_0-9\.])#', '$1loops.$2|length$3', $inner); + + // Replace .foo.bar with foo.bar|length + $inner = preg_replace('#(\s\(*!?)\.([a-zA-Z_0-9\.]+)([^a-zA-Z_0-9\.])#', '$1$2|length$3', $inner); + + return ""; + }; + + return preg_replace_callback('##', $callback, $code); + } + + /** + * Fix DEFINE statements and {$VARNAME} variables + * + * @param string $code + * @return string + */ + protected function fix_define_tokens($code) + { + /** + * Changing $VARNAME to definition.varname because set is only local + * context (e.g. DEFINE $TEST will only make $TEST available in current + * template and any child templates, but not any parent templates). + * + * DEFINE handles setting it properly to definition in its node, but the + * variables reading FROM it need to be altered to definition.VARNAME + * + * Setting up definition as a class in the array passed to Twig + * ($context) makes set definition.TEST available in the global context + */ + + // Replace #', '{% DEFINE $1 %}', $code); + + // Changing UNDEFINE NAME to DEFINE NAME = null to save from creating an extra token parser/node + $code = preg_replace('##', '{% DEFINE $1= null %}', $code); + + // Replace all of our variables, {$VARNAME}, with Twig style, {{ definition.VARNAME }} + $code = preg_replace('#{\$([a-zA-Z0-9_\.]+)}#', '{{ definition.$1 }}', $code); + + // Replace all of our variables, ~ $VARNAME ~, with Twig style, ~ definition.VARNAME ~ + $code = preg_replace('#~ \$([a-zA-Z0-9_\.]+) ~#', '~ definition.$1 ~', $code); + + return $code; + } + + /** + * Replace Twig tag masks with Twig tag calls + * + * E.g. with {% block foo %} + * + * @param string $code + * @param array $twig_tags All tags we want to create a mask for + * @return string + */ + protected function replace_twig_tag_masks($code, $twig_tags) + { + $callback = function ($matches) + { + $matches[1] = strtolower($matches[1]); + + return "{% {$matches[1]}{$matches[2]}%}"; + }; + + foreach ($twig_tags as &$tag) + { + $tag = strtoupper($tag); + } + + // twig_tags is an array of the twig tags, which are all lowercase, but we use all uppercase tags + $code = preg_replace_callback('##',$callback, $code); + + return $code; + } +} diff --git a/install/update/old/phpbb/template/twig/loader.php b/install/update/old/phpbb/template/twig/loader.php new file mode 100644 index 0000000..c13e3ee --- /dev/null +++ b/install/update/old/phpbb/template/twig/loader.php @@ -0,0 +1,176 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig; + +/** +* Twig Template loader +*/ +class loader extends \Twig_Loader_Filesystem +{ + protected $safe_directories = array(); + + /** + * @var \phpbb\filesystem\filesystem_interface + */ + protected $filesystem; + + /** + * Constructor + * + * @param \phpbb\filesystem\filesystem_interface $filesystem + * @param string|array $paths + */ + public function __construct(\phpbb\filesystem\filesystem_interface $filesystem, $paths = array()) + { + $this->filesystem = $filesystem; + + parent::__construct($paths, $this->filesystem->realpath(dirname(__FILE__))); + } + + /** + * Set safe directories + * + * @param array $directories Array of directories that are safe (empty to clear) + * @return \Twig_Loader_Filesystem + */ + public function setSafeDirectories($directories = array()) + { + $this->safe_directories = array(); + + if (!empty($directories)) + { + foreach ($directories as $directory) + { + $this->addSafeDirectory($directory); + } + } + + return $this; + } + + /** + * Add safe directory + * + * @param string $directory Directory that should be added + * @return \Twig_Loader_Filesystem + */ + public function addSafeDirectory($directory) + { + $directory = $this->filesystem->realpath($directory); + + if ($directory !== false) + { + $this->safe_directories[] = $directory; + } + + return $this; + } + + /** + * Get current safe directories + * + * @return array + */ + public function getSafeDirectories() + { + return $this->safe_directories; + } + + /** + * Override for parent::validateName() + * + * This is done because we added support for safe directories, and when Twig + * findTemplate() is called, validateName() is called first, which would + * always throw an exception if the file is outside of the configured + * template directories. + */ + protected function validateName($name) + { + return; + } + + /** + * Adds a realpath call to fix a BC break in Twig 1.26 (https://github.com/twigphp/Twig/issues/2145) + * + * {@inheritdoc} + */ + public function addPath($path, $namespace = self::MAIN_NAMESPACE) + { + return parent::addPath($this->filesystem->realpath($path), $namespace); + } + + /** + * Find the template + * + * Override for Twig_Loader_Filesystem::findTemplate to add support + * for loading from safe directories. + */ + protected function findTemplate($name) + { + $name = (string) $name; + + // normalize name + $name = preg_replace('#/{2,}#', '/', strtr($name, '\\', '/')); + + // If this is in the cache we can skip the entire process below + // as it should have already been validated + if (isset($this->cache[$name])) + { + return $this->cache[$name]; + } + + // First, find the template name. The override above of validateName + // causes the validateName process to be skipped for this call + $file = parent::findTemplate($name); + + try + { + // Try validating the name (which may throw an exception) + parent::validateName($name); + } + catch (\Twig_Error_Loader $e) + { + if (strpos($e->getRawMessage(), 'Looks like you try to load a template outside configured directories') === 0) + { + // Ok, so outside of the configured template directories, we + // can now check if we're within a "safe" directory + + // Find the real path of the directory the file is in + $directory = $this->filesystem->realpath(dirname($file)); + + if ($directory === false) + { + // Some sort of error finding the actual path, must throw the exception + throw $e; + } + + foreach ($this->safe_directories as $safe_directory) + { + if (strpos($directory, $safe_directory) === 0) + { + // The directory being loaded is below a directory + // that is "safe". We're good to load it! + return $file; + } + } + } + + // Not within any safe directories + throw $e; + } + + // No exception from validateName, safe to load. + return $file; + } +} diff --git a/install/update/old/phpbb/template/twig/node/definenode.php b/install/update/old/phpbb/template/twig/node/definenode.php new file mode 100644 index 0000000..ddbd151 --- /dev/null +++ b/install/update/old/phpbb/template/twig/node/definenode.php @@ -0,0 +1,57 @@ + +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\node; + +class definenode extends \Twig_Node +{ + public function __construct($capture, \Twig_NodeInterface $name, \Twig_NodeInterface $value, $lineno, $tag = null) + { + parent::__construct(array('name' => $name, 'value' => $value), array('capture' => $capture, 'safe' => false), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ + public function compile(\Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + if ($this->getAttribute('capture')) + { + $compiler + ->write("ob_start();\n") + ->subcompile($this->getNode('value')) + ; + + $compiler->write("\$value = ('' === \$value = ob_get_clean()) ? '' : new \Twig_Markup(\$value, \$this->env->getCharset());\n"); + } + else + { + $compiler + ->write("\$value = ") + ->subcompile($this->getNode('value')) + ->raw(";\n") + ; + } + + $compiler + ->write("\$context['definition']->set('") + ->raw($this->getNode('name')->getAttribute('name')) + ->raw("', \$value);\n") + ; + } +} diff --git a/install/update/old/phpbb/template/twig/node/includeasset.php b/install/update/old/phpbb/template/twig/node/includeasset.php new file mode 100644 index 0000000..12034b7 --- /dev/null +++ b/install/update/old/phpbb/template/twig/node/includeasset.php @@ -0,0 +1,71 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\node; + +abstract class includeasset extends \Twig_Node +{ + /** @var \Twig_Environment */ + protected $environment; + + public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $tag = null) + { + $this->environment = $environment; + + parent::__construct(array('expr' => $expr), array(), $lineno, $tag); + } + /** + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ + public function compile(\Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + $config = $this->environment->get_phpbb_config(); + + $compiler + ->write("\$asset_file = ") + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ->write("\$asset = new \phpbb\\template\\asset(\$asset_file, \$this->getEnvironment()->get_path_helper(), \$this->getEnvironment()->get_filesystem());\n") + ->write("if (substr(\$asset_file, 0, 2) !== './' && \$asset->is_relative()) {\n") + ->indent() + ->write("\$asset_path = \$asset->get_path();") + ->write("\$local_file = \$this->getEnvironment()->get_phpbb_root_path() . \$asset_path;\n") + ->write("if (!file_exists(\$local_file)) {\n") + ->indent() + ->write("\$local_file = \$this->getEnvironment()->findTemplate(\$asset_path);\n") + ->write("\$asset->set_path(\$local_file, true);\n") + ->outdent() + ->write("}\n") + ->outdent() + ->write("}\n") + ->write("\n") + ->write("if (\$asset->is_relative()) {\n") + ->indent() + ->write("\$asset->add_assets_version('{$config['assets_version']}');\n") + ->outdent() + ->write("}\n") + ->write("\$this->getEnvironment()->get_assets_bag()->add_{$this->get_setters_name()}(\$asset);") + ; + } + + /** + * Get the name of the assets bag setter + * + * @return string (e.g. 'script') + */ + abstract public function get_setters_name(); +} diff --git a/install/update/old/phpbb/template/twig/node/includephp.php b/install/update/old/phpbb/template/twig/node/includephp.php new file mode 100644 index 0000000..76182c2 --- /dev/null +++ b/install/update/old/phpbb/template/twig/node/includephp.php @@ -0,0 +1,91 @@ + +* Sections (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\node; + +class includephp extends \Twig_Node +{ + /** @var \Twig_Environment */ + protected $environment; + + public function __construct(\Twig_Node_Expression $expr, \phpbb\template\twig\environment $environment, $lineno, $ignoreMissing = false, $tag = null) + { + $this->environment = $environment; + + parent::__construct(array('expr' => $expr), array('ignore_missing' => (Boolean) $ignoreMissing), $lineno, $tag); + } + + /** + * Compiles the node to PHP. + * + * @param \Twig_Compiler A Twig_Compiler instance + */ + public function compile(\Twig_Compiler $compiler) + { + $compiler->addDebugInfo($this); + + $config = $this->environment->get_phpbb_config(); + + if (!$config['tpl_allow_php']) + { + $compiler + ->write("// INCLUDEPHP Disabled\n") + ; + + return; + } + + if ($this->getAttribute('ignore_missing')) + { + $compiler + ->write("try {\n") + ->indent() + ; + } + + $compiler + ->write("\$location = ") + ->subcompile($this->getNode('expr')) + ->raw(";\n") + ->write("if (phpbb_is_absolute(\$location)) {\n") + ->indent() + // Absolute path specified + ->write("require(\$location);\n") + ->outdent() + ->write("} else if (file_exists(\$this->getEnvironment()->get_phpbb_root_path() . \$location)) {\n") + ->indent() + // PHP file relative to phpbb_root_path + ->write("require(\$this->getEnvironment()->get_phpbb_root_path() . \$location);\n") + ->outdent() + ->write("} else {\n") + ->indent() + // Local path (behaves like INCLUDE) + ->write("require(\$this->getEnvironment()->getLoader()->getCacheKey(\$location));\n") + ->outdent() + ->write("}\n") + ; + + if ($this->getAttribute('ignore_missing')) + { + $compiler + ->outdent() + ->write("} catch (\Twig_Error_Loader \$e) {\n") + ->indent() + ->write("// ignore missing template\n") + ->outdent() + ->write("}\n\n") + ; + } + } +} diff --git a/install/update/old/phpbb/template/twig/tokenparser/defineparser.php b/install/update/old/phpbb/template/twig/tokenparser/defineparser.php new file mode 100644 index 0000000..b755836 --- /dev/null +++ b/install/update/old/phpbb/template/twig/tokenparser/defineparser.php @@ -0,0 +1,76 @@ + +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class defineparser extends \Twig_TokenParser +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + * @throws \Twig_Error_Syntax + * @throws \phpbb\template\twig\node\definenode + */ + public function parse(\Twig_Token $token) + { + $lineno = $token->getLine(); + $stream = $this->parser->getStream(); + $name = $this->parser->getExpressionParser()->parseExpression(); + + $capture = false; + if ($stream->test(\Twig_Token::OPERATOR_TYPE, '=')) + { + $stream->next(); + $value = $this->parser->getExpressionParser()->parseExpression(); + + if ($value instanceof \Twig_Node_Expression_Name) + { + // This would happen if someone improperly formed their DEFINE syntax + // e.g. + throw new \Twig_Error_Syntax('Invalid DEFINE', $token->getLine(), $this->parser->getFilename()); + } + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + } + else + { + $capture = true; + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + $value = $this->parser->subparse(array($this, 'decideBlockEnd'), true); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + } + + return new \phpbb\template\twig\node\definenode($capture, $name, $value, $lineno, $this->getTag()); + } + + public function decideBlockEnd(\Twig_Token $token) + { + return $token->test('ENDDEFINE'); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'DEFINE'; + } +} diff --git a/install/update/old/phpbb/template/twig/tokenparser/event.php b/install/update/old/phpbb/template/twig/tokenparser/event.php new file mode 100644 index 0000000..f73ef4a --- /dev/null +++ b/install/update/old/phpbb/template/twig/tokenparser/event.php @@ -0,0 +1,44 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class event extends \Twig_TokenParser +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(\Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $stream = $this->parser->getStream(); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new \phpbb\template\twig\node\event($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'EVENT'; + } +} diff --git a/install/update/old/phpbb/template/twig/tokenparser/includecss.php b/install/update/old/phpbb/template/twig/tokenparser/includecss.php new file mode 100644 index 0000000..1f30811 --- /dev/null +++ b/install/update/old/phpbb/template/twig/tokenparser/includecss.php @@ -0,0 +1,44 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class includecss extends \Twig_TokenParser +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(\Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $stream = $this->parser->getStream(); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new \phpbb\template\twig\node\includecss($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDECSS'; + } +} diff --git a/install/update/old/phpbb/template/twig/tokenparser/includejs.php b/install/update/old/phpbb/template/twig/tokenparser/includejs.php new file mode 100644 index 0000000..4b67d2c --- /dev/null +++ b/install/update/old/phpbb/template/twig/tokenparser/includejs.php @@ -0,0 +1,44 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class includejs extends \Twig_TokenParser +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(\Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $stream = $this->parser->getStream(); + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new \phpbb\template\twig\node\includejs($expr, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDEJS'; + } +} diff --git a/install/update/old/phpbb/template/twig/tokenparser/includeparser.php b/install/update/old/phpbb/template/twig/tokenparser/includeparser.php new file mode 100644 index 0000000..aa7236a --- /dev/null +++ b/install/update/old/phpbb/template/twig/tokenparser/includeparser.php @@ -0,0 +1,44 @@ + +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class includeparser extends \Twig_TokenParser_Include +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(\Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + list($variables, $only, $ignoreMissing) = $this->parseArguments(); + + return new \phpbb\template\twig\node\includenode($expr, $variables, $only, $ignoreMissing, $token->getLine(), $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDE'; + } +} diff --git a/install/update/old/phpbb/template/twig/tokenparser/includephp.php b/install/update/old/phpbb/template/twig/tokenparser/includephp.php new file mode 100644 index 0000000..3992636 --- /dev/null +++ b/install/update/old/phpbb/template/twig/tokenparser/includephp.php @@ -0,0 +1,55 @@ + +* @copyright Portions (c) 2009 Fabien Potencier, Armin Ronacher +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class includephp extends \Twig_TokenParser +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(\Twig_Token $token) + { + $expr = $this->parser->getExpressionParser()->parseExpression(); + + $stream = $this->parser->getStream(); + + $ignoreMissing = false; + if ($stream->test(\Twig_Token::NAME_TYPE, 'ignore')) + { + $stream->next(); + $stream->expect(\Twig_Token::NAME_TYPE, 'missing'); + + $ignoreMissing = true; + } + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new \phpbb\template\twig\node\includephp($expr, $this->parser->getEnvironment(), $token->getLine(), $ignoreMissing, $this->getTag()); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'INCLUDEPHP'; + } +} diff --git a/install/update/old/phpbb/template/twig/tokenparser/php.php b/install/update/old/phpbb/template/twig/tokenparser/php.php new file mode 100644 index 0000000..f11ce35 --- /dev/null +++ b/install/update/old/phpbb/template/twig/tokenparser/php.php @@ -0,0 +1,52 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\template\twig\tokenparser; + +class php extends \Twig_TokenParser +{ + /** + * Parses a token and returns a node. + * + * @param \Twig_Token $token A Twig_Token instance + * + * @return \Twig_NodeInterface A Twig_NodeInterface instance + */ + public function parse(\Twig_Token $token) + { + $stream = $this->parser->getStream(); + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + $body = $this->parser->subparse(array($this, 'decideEnd'), true); + + $stream->expect(\Twig_Token::BLOCK_END_TYPE); + + return new \phpbb\template\twig\node\php($body, $this->parser->getEnvironment(), $token->getLine(), $this->getTag()); + } + + public function decideEnd(\Twig_Token $token) + { + return $token->test('ENDPHP'); + } + + /** + * Gets the tag name associated with this token parser. + * + * @return string The tag name + */ + public function getTag() + { + return 'PHP'; + } +} diff --git a/install/update/old/phpbb/textformatter/s9e/bbcode_merger.php b/install/update/old/phpbb/textformatter/s9e/bbcode_merger.php new file mode 100644 index 0000000..a05ca3c --- /dev/null +++ b/install/update/old/phpbb/textformatter/s9e/bbcode_merger.php @@ -0,0 +1,183 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +use phpbb\textformatter\s9e\factory; +use s9e\TextFormatter\Configurator\Helpers\TemplateHelper; +use s9e\TextFormatter\Configurator\Items\UnsafeTemplate; + +class bbcode_merger +{ + /** + * @var \s9e\TextFormatter\Configurator $configurator Configurator instance used to inspect BBCodes + */ + protected $configurator; + + /** + * @param \phpbb\textformatter\s9e\factory $factory + */ + public function __construct(factory $factory) + { + $this->configurator = $factory->get_configurator(); + } + + /** + * Merge two BBCode definitions + * + * All of the arrays contain a "usage" element and a "template" element + * + * @throws InvalidArgumentException if a definition cannot be interpreted + * @throws RuntimeException if something unexpected occurs + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + public function merge_bbcodes(array $without, array $with) + { + $without = $this->create_bbcode($without); + $with = $this->create_bbcode($with); + + // Select the appropriate strategy for merging this BBCode + if ($this->is_content_bbcode($without, $with)) + { + $merged = $this->merge_content_bbcode($without, $with); + } + else + { + $merged = $this->merge_optional_bbcode($without, $with); + } + + $merged['template'] = $this->normalize_template($merged['template']); + + return $merged; + } + + /** + * Create a custom BBCode for inspection + * + * @param array $definition Original BBCode definition + * @return array Updated definition containing a BBCode object and a Tag + */ + protected function create_bbcode(array $definition) + { + $bbcode = $this->configurator->BBCodes->addCustom( + $definition['usage'], + new UnsafeTemplate($definition['template']) + ); + + $definition['bbcode'] = $bbcode; + $definition['tag'] = $this->configurator->tags[$bbcode->tagName]; + + return $definition; + } + + /** + * Indent given template for readability + * + * @param string $template + * @return string + */ + protected function indent_template($template) + { + $dom = TemplateHelper::loadTemplate($template); + $dom->formatOutput = true; + $template = TemplateHelper::saveTemplate($dom); + + // Remove the first level of indentation if the template starts with whitespace + if (preg_match('(^\\n +)', $template, $m)) + { + $template = str_replace($m[0], "\n", $template); + } + + return trim($template); + } + + /** + * Test whether the two definitions form a "content"-style BBCode + * + * Such BBCodes include the [URL] BBCode, which uses its text content as + * attribute if none is provided + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + protected function is_content_bbcode(array $without, array $with) + { + // Test whether we find the same non-TEXT token between "]" and "[" in the usage + // as between ">" and "<" in the template + return (preg_match('(\\]\\s*(\\{(?!TEXT)[^}]+\\})\\s*\\[)', $without['usage'], $m) + && preg_match('(>[^<]*?' . preg_quote($m[1]) . '[^>]*?<)s', $without['template'])); + } + + /** + * Merge the two BBCode definitions of a "content"-style BBCode + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + protected function merge_content_bbcode(array $without, array $with) + { + // Convert [X={X}] into [X={X;useContent}] + $usage = preg_replace('(\\})', ';useContent}', $with['usage'], 1); + + // Use the template from the definition that uses an attribute + $template = $with['tag']->template; + + return ['usage' => $usage, 'template' => $template]; + } + + /** + * Merge the two BBCode definitions of a BBCode with an optional argument + * + * Such BBCodes include the [QUOTE] BBCode, which takes an optional argument + * but otherwise does not behave differently + * + * @param array $without BBCode definition without an attribute + * @param array $with BBCode definition with an attribute + * @return array Merged definition + */ + protected function merge_optional_bbcode(array $without, array $with) + { + // Convert [X={X}] into [X={X?}] + $usage = preg_replace('(\\})', '?}', $with['usage'], 1); + + // Build a template for both versions + $template = '' . $with['tag']->template . '' . $without['tag']->template . ''; + + return ['usage' => $usage, 'template' => $template]; + } + + /** + * Normalize a template + * + * @param string $template + * @return string + */ + protected function normalize_template($template) + { + // Normalize the template to simplify it + $template = $this->configurator->templateNormalizer->normalizeTemplate($template); + + // Convert xsl:value-of elements back to {L_} tokens where applicable + $template = preg_replace('()', '{$1}', $template); + + // Beautify the template + $template = $this->indent_template($template); + + return $template; + } +} diff --git a/install/update/old/phpbb/textformatter/s9e/factory.php b/install/update/old/phpbb/textformatter/s9e/factory.php new file mode 100644 index 0000000..6191b9a --- /dev/null +++ b/install/update/old/phpbb/textformatter/s9e/factory.php @@ -0,0 +1,676 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +use s9e\TextFormatter\Configurator; +use s9e\TextFormatter\Configurator\Items\AttributeFilters\RegexpFilter; +use s9e\TextFormatter\Configurator\Items\UnsafeTemplate; + +/** +* Creates s9e\TextFormatter objects +*/ +class factory implements \phpbb\textformatter\cache_interface +{ + /** + * @var \phpbb\textformatter\s9e\link_helper + */ + protected $link_helper; + + /** + * @var \phpbb\cache\driver\driver_interface + */ + protected $cache; + + /** + * @var string Path to the cache dir + */ + protected $cache_dir; + + /** + * @var string Cache key used for the parser + */ + protected $cache_key_parser; + + /** + * @var string Cache key used for the renderer + */ + protected $cache_key_renderer; + + /** + * @var \phpbb\config\config + */ + protected $config; + + /** + * @var array Custom tokens used in bbcode.html and their corresponding token from the definition + */ + protected $custom_tokens = array( + 'email' => array('{DESCRIPTION}' => '{TEXT}'), + 'flash' => array('{WIDTH}' => '{NUMBER1}', '{HEIGHT}' => '{NUMBER2}'), + 'img' => array('{URL}' => '{IMAGEURL}'), + 'list' => array('{LIST_TYPE}' => '{HASHMAP}'), + 'quote' => array('{USERNAME}' => '{TEXT1}'), + 'size' => array('{SIZE}' => '{FONTSIZE}'), + 'url' => array('{DESCRIPTION}' => '{TEXT}'), + ); + + /** + * @var \phpbb\textformatter\data_access + */ + protected $data_access; + + /** + * @var array Default BBCode definitions + */ + protected $default_definitions = array( + 'attachment' => '[ATTACHMENT index={NUMBER} filename={TEXT;useContent}]', + 'b' => '[B]{TEXT}[/B]', + 'code' => '[CODE lang={IDENTIFIER;optional}]{TEXT}[/CODE]', + 'color' => '[COLOR={COLOR}]{TEXT}[/COLOR]', + 'email' => '[EMAIL={EMAIL;useContent} subject={TEXT1;optional;postFilter=rawurlencode} body={TEXT2;optional;postFilter=rawurlencode}]{TEXT}[/EMAIL]', + 'flash' => '[FLASH={NUMBER1},{NUMBER2} width={NUMBER1;postFilter=#flashwidth} height={NUMBER2;postFilter=#flashheight} url={URL;useContent} /]', + 'i' => '[I]{TEXT}[/I]', + 'img' => '[IMG src={IMAGEURL;useContent}]', + 'list' => '[LIST type={HASHMAP=1:decimal,a:lower-alpha,A:upper-alpha,i:lower-roman,I:upper-roman;optional;postFilter=#simpletext} #createChild=LI]{TEXT}[/LIST]', + 'li' => '[* $tagName=LI]{TEXT}[/*]', + 'quote' => + "[QUOTE + author={TEXT1;optional} + post_id={UINT;optional} + post_url={URL;optional;postFilter=#false} + profile_url={URL;optional;postFilter=#false} + time={UINT;optional} + url={URL;optional} + user_id={UINT;optional} + author={PARSE=/^\\[url=(?'url'.*?)](?'author'.*)\\[\\/url]$/i} + author={PARSE=/^\\[url](?'author'(?'url'.*?))\\[\\/url]$/i} + author={PARSE=/(?'url'https?:\\/\\/[^[\\]]+)/i} + ]{TEXT2}[/QUOTE]", + 'size' => '[SIZE={FONTSIZE}]{TEXT}[/SIZE]', + 'u' => '[U]{TEXT}[/U]', + 'url' => '[URL={URL;useContent} $forceLookahead=true]{TEXT}[/URL]', + ); + + /** + * @var array Default templates, taken from bbcode::bbcode_tpl() + */ + protected $default_templates = array( + 'b' => '', + 'i' => '', + 'u' => '', + 'img' => '{L_IMAGE}', + 'size' => '', + 'color' => '', + 'email' => ' + + mailto: + + + ? + subject= + &body= + + + + ', + ); + + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \phpbb\log\log_interface + */ + protected $log; + + /** + * Constructor + * + * @param \phpbb\textformatter\data_access $data_access + * @param \phpbb\cache\driver\driver_interface $cache + * @param \phpbb\event\dispatcher_interface $dispatcher + * @param \phpbb\config\config $config + * @param \phpbb\textformatter\s9e\link_helper $link_helper + * @param \phpbb\log\log_interface $log + * @param string $cache_dir Path to the cache dir + * @param string $cache_key_parser Cache key used for the parser + * @param string $cache_key_renderer Cache key used for the renderer + */ + public function __construct(\phpbb\textformatter\data_access $data_access, \phpbb\cache\driver\driver_interface $cache, \phpbb\event\dispatcher_interface $dispatcher, \phpbb\config\config $config, \phpbb\textformatter\s9e\link_helper $link_helper, \phpbb\log\log_interface $log, $cache_dir, $cache_key_parser, $cache_key_renderer) + { + $this->link_helper = $link_helper; + $this->cache = $cache; + $this->cache_dir = $cache_dir; + $this->cache_key_parser = $cache_key_parser; + $this->cache_key_renderer = $cache_key_renderer; + $this->config = $config; + $this->data_access = $data_access; + $this->dispatcher = $dispatcher; + $this->log = $log; + } + + /** + * {@inheritdoc} + */ + public function invalidate() + { + $this->regenerate(); + } + + /** + * {@inheritdoc} + * + * Will remove old renderers from the cache dir but won't touch the current renderer + */ + public function tidy() + { + // Get the name of current renderer + $renderer_data = $this->cache->get($this->cache_key_renderer); + $renderer_file = ($renderer_data) ? $renderer_data['class'] . '.php' : null; + + foreach (glob($this->cache_dir . 's9e_*') as $filename) + { + // Only remove the file if it's not the current renderer + if (!$renderer_file || substr($filename, -strlen($renderer_file)) !== $renderer_file) + { + unlink($filename); + } + } + } + + /** + * Generate and return a new configured instance of s9e\TextFormatter\Configurator + * + * @return Configurator + */ + public function get_configurator() + { + // Create a new Configurator + $configurator = new Configurator; + + /** + * Modify the s9e\TextFormatter configurator before the default settings are set + * + * @event core.text_formatter_s9e_configure_before + * @var \s9e\TextFormatter\Configurator configurator Configurator instance + * @since 3.2.0-a1 + */ + $vars = array('configurator'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_before', compact($vars))); + + // Reset the list of allowed schemes + foreach ($configurator->urlConfig->getAllowedSchemes() as $scheme) + { + $configurator->urlConfig->disallowScheme($scheme); + } + foreach (explode(',', $this->config['allowed_schemes_links']) as $scheme) + { + $configurator->urlConfig->allowScheme(trim($scheme)); + } + + // Convert newlines to br elements by default + $configurator->rootRules->enableAutoLineBreaks(); + + // Don't automatically ignore text in places where text is not allowed + $configurator->rulesGenerator->remove('IgnoreTextIfDisallowed'); + + // Don't remove comments and instead convert them to xsl:comment elements + $configurator->templateNormalizer->remove('RemoveComments'); + $configurator->templateNormalizer->add('TransposeComments'); + + // Set the rendering engine and configure it to save to the cache dir + $configurator->rendering->engine = 'PHP'; + $configurator->rendering->engine->cacheDir = $this->cache_dir; + $configurator->rendering->engine->defaultClassPrefix = 's9e_renderer_'; + $configurator->rendering->engine->enableQuickRenderer = true; + + // Create custom filters for BBCode tokens that are supported in phpBB but not in + // s9e\TextFormatter + $filter = new RegexpFilter('#^' . get_preg_expression('relative_url') . '$#Du'); + $configurator->attributeFilters->add('#local_url', $filter); + $configurator->attributeFilters->add('#relative_url', $filter); + + // INTTEXT regexp from acp_bbcodes + $filter = new RegexpFilter('!^([\p{L}\p{N}\-+,_. ]+)$!Du'); + $configurator->attributeFilters->add('#inttext', $filter); + + // Create custom filters for Flash restrictions, which use the same values as the image + // restrictions but have their own error message + $configurator->attributeFilters + ->add('#flashheight', __NAMESPACE__ . '\\parser::filter_flash_height') + ->addParameterByName('max_img_height') + ->addParameterByName('logger'); + + $configurator->attributeFilters + ->add('#flashwidth', __NAMESPACE__ . '\\parser::filter_flash_width') + ->addParameterByName('max_img_width') + ->addParameterByName('logger'); + + // Create a custom filter for phpBB's per-mode font size limits + $configurator->attributeFilters + ->add('#fontsize', __NAMESPACE__ . '\\parser::filter_font_size') + ->addParameterByName('max_font_size') + ->addParameterByName('logger') + ->markAsSafeInCSS(); + + // Create a custom filter for image URLs + $configurator->attributeFilters + ->add('#imageurl', __NAMESPACE__ . '\\parser::filter_img_url') + ->addParameterByName('urlConfig') + ->addParameterByName('logger') + ->addParameterByName('max_img_height') + ->addParameterByName('max_img_width') + ->markAsSafeAsURL() + ->setJS('UrlFilter.filter'); + + // Add default BBCodes + foreach ($this->get_default_bbcodes($configurator) as $bbcode) + { + $this->add_bbcode($configurator, $bbcode['usage'], $bbcode['template']); + } + if (isset($configurator->tags['QUOTE'])) + { + // Remove the nesting limit and let other services remove quotes at parsing time + $configurator->tags['QUOTE']->nestingLimit = PHP_INT_MAX; + } + + // Modify the template to disable images/flash depending on user's settings + foreach (array('FLASH', 'IMG') as $name) + { + $tag = $configurator->tags[$name]; + $tag->template = '' . $tag->template . ''; + } + + // Load custom BBCodes + foreach ($this->data_access->get_bbcodes() as $row) + { + // Insert the board's URL before {LOCAL_URL} tokens + $tpl = preg_replace_callback( + '#\\{LOCAL_URL\\d*\\}#', + function ($m) + { + return generate_board_url() . '/' . $m[0]; + }, + $row['bbcode_tpl'] + ); + $this->add_bbcode($configurator, $row['bbcode_match'], $tpl); + } + + // Load smilies + foreach ($this->data_access->get_smilies() as $row) + { + $configurator->Emoticons->set( + $row['code'], + '{.}' + ); + } + + if (isset($configurator->Emoticons)) + { + // Force emoticons to be rendered as text if $S_VIEWSMILIES is not set + $configurator->Emoticons->notIfCondition = 'not($S_VIEWSMILIES)'; + + // Only parse emoticons at the beginning of the text or if they're preceded by any + // one of: a new line, a space, a dot, or a right square bracket + $configurator->Emoticons->notAfter = '[^\\n .\\]]'; + + // Ignore emoticons that are immediately followed by a "word" character + $configurator->Emoticons->notBefore = '\\w'; + } + + // Load the censored words + $censor = $this->data_access->get_censored_words(); + if (!empty($censor)) + { + // Use a namespaced tag to avoid collisions + $configurator->plugins->load('Censor', array('tagName' => 'censor:tag')); + foreach ($censor as $row) + { + $configurator->Censor->add($row['word'], $row['replacement']); + } + } + + // Load the magic links plugins. We do that after BBCodes so that they use the same tags + $this->configure_autolink($configurator); + + // Register some vars with a default value. Those should be set at runtime by whatever calls + // the parser + $configurator->registeredVars['max_font_size'] = 0; + $configurator->registeredVars['max_img_height'] = 0; + $configurator->registeredVars['max_img_width'] = 0; + + // Load the Emoji plugin and modify its tag's template to obey viewsmilies + $tag = $configurator->Emoji->getTag(); + $tag->template = ' + + {.} + + + {.} + + '; + $tag->template = '' . str_replace('class="emoji"', 'class="emoji smilies"', $tag->template) . ''; + + /** + * Modify the s9e\TextFormatter configurator after the default settings are set + * + * @event core.text_formatter_s9e_configure_after + * @var \s9e\TextFormatter\Configurator configurator Configurator instance + * @since 3.2.0-a1 + */ + $vars = array('configurator'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_after', compact($vars))); + + return $configurator; + } + + /** + * Regenerate and cache a new parser and renderer + * + * @return array Associative array with at least two elements: "parser" and "renderer" + */ + public function regenerate() + { + $configurator = $this->get_configurator(); + + // Get the censor helper and remove the Censor plugin if applicable + if (isset($configurator->Censor)) + { + $censor = $configurator->Censor->getHelper(); + unset($configurator->Censor); + unset($configurator->tags['censor:tag']); + } + + $objects = $configurator->finalize(); + + /** + * Access the objects returned by finalize() before they are saved to cache + * + * @event core.text_formatter_s9e_configure_finalize + * @var array objects Array containing a "parser" object, a "renderer" object and optionally a "js" string + * @since 3.2.2-RC1 + */ + $vars = array('objects'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_configure_finalize', compact($vars))); + + $parser = $objects['parser']; + $renderer = $objects['renderer']; + + // Cache the parser as-is + $this->cache->put($this->cache_key_parser, $parser); + + // We need to cache the name of the renderer's generated class + $renderer_data = array('class' => get_class($renderer)); + if (isset($censor)) + { + $renderer_data['censor'] = $censor; + } + $this->cache->put($this->cache_key_renderer, $renderer_data); + + return array('parser' => $parser, 'renderer' => $renderer); + } + + /** + * Add a BBCode to given configurator + * + * @param Configurator $configurator + * @param string $usage + * @param string $template + * @return void + */ + protected function add_bbcode(Configurator $configurator, $usage, $template) + { + try + { + $configurator->BBCodes->addCustom($usage, new UnsafeTemplate($template)); + } + catch (\Exception $e) + { + $this->log->add('critical', null, null, 'LOG_BBCODE_CONFIGURATION_ERROR', false, [$usage, $e->getMessage()]); + } + } + + /** + * Configure the Autolink / Autoemail plugins used to linkify text + * + * @param \s9e\TextFormatter\Configurator $configurator + * @return void + */ + protected function configure_autolink(Configurator $configurator) + { + $configurator->plugins->load('Autoemail'); + $configurator->plugins->load('Autolink', array('matchWww' => true)); + + // Add a tag filter that creates a tag that stores and replace the + // content of a link created by the Autolink plugin + $configurator->Autolink->getTag()->filterChain + ->add(array($this->link_helper, 'generate_link_text_tag')) + ->resetParameters() + ->addParameterByName('tag') + ->addParameterByName('parser'); + + // Create a tag that will be used to display the truncated text by + // replacing the original content with the content of the @text attribute + $tag = $configurator->tags->add('LINK_TEXT'); + $tag->attributes->add('text'); + $tag->template = ''; + + $tag->filterChain + ->add(array($this->link_helper, 'truncate_local_url')) + ->resetParameters() + ->addParameterByName('tag') + ->addParameterByValue(generate_board_url() . '/'); + $tag->filterChain + ->add(array($this->link_helper, 'truncate_text')) + ->resetParameters() + ->addParameterByName('tag'); + $tag->filterChain + ->add(array($this->link_helper, 'cleanup_tag')) + ->resetParameters() + ->addParameterByName('tag') + ->addParameterByName('parser'); + } + + /** + * Escape a literal to be used in an HTML attribute in an XSL template + * + * Escapes "HTML special chars" for obvious reasons and curly braces to avoid them + * being interpreted as an attribute value template + * + * @param string $value Original string + * @return string Escaped string + */ + protected function escape_html_attribute($value) + { + return htmlspecialchars(strtr($value, ['{' => '{{', '}' => '}}']), ENT_COMPAT | ENT_XML1, 'UTF-8'); + } + + /** + * Return the default BBCodes configuration + * + * @return array 2D array. Each element has a 'usage' key, a 'template' key, and an optional 'options' key + */ + protected function get_default_bbcodes($configurator) + { + // For each BBCode, build an associative array matching style_ids to their template + $templates = array(); + foreach ($this->data_access->get_styles_templates() as $style_id => $data) + { + foreach ($this->extract_templates($data['template']) as $bbcode_name => $template) + { + $templates[$bbcode_name][$style_id] = $template; + } + + // Add default templates wherever missing, or for BBCodes that were not specified in + // this template's bitfield. For instance, prosilver has a custom template for b but its + // bitfield does not enable it so the default template is used instead + foreach ($this->default_templates as $bbcode_name => $template) + { + if (!isset($templates[$bbcode_name][$style_id]) || !in_array($bbcode_name, $data['bbcodes'], true)) + { + $templates[$bbcode_name][$style_id] = $template; + } + } + } + + // Replace custom tokens and normalize templates + foreach ($templates as $bbcode_name => $style_templates) + { + foreach ($style_templates as $i => $template) + { + if (isset($this->custom_tokens[$bbcode_name])) + { + $template = strtr($template, $this->custom_tokens[$bbcode_name]); + } + + $templates[$bbcode_name][$i] = $configurator->templateNormalizer->normalizeTemplate($template); + } + } + + $bbcodes = array(); + foreach ($this->default_definitions as $bbcode_name => $usage) + { + $bbcodes[$bbcode_name] = array( + 'usage' => $usage, + 'template' => $this->merge_templates($templates[$bbcode_name]), + ); + } + + return $bbcodes; + } + + /** + * Extract and recompose individual BBCode templates from a style's template file + * + * @param string $template Style template (bbcode.html) + * @return array Associative array matching BBCode names to their template + */ + protected function extract_templates($template) + { + // Capture the template fragments + // Allow either phpBB template or the Twig syntax + preg_match_all('#(.*?)#s', $template, $matches, PREG_SET_ORDER) ?: + preg_match_all('#{% for (.*?) in .*? %}(.*?){% endfor %}#s', $template, $matches, PREG_SET_ORDER); + + $fragments = array(); + foreach ($matches as $match) + { + // Normalize the whitespace + $fragment = preg_replace('#>\\n\\t*<#', '><', trim($match[2])); + + $fragments[$match[1]] = $fragment; + } + + // Automatically recompose templates split between *_open and *_close + foreach ($fragments as $fragment_name => $fragment) + { + if (preg_match('#^(\\w+)_close$#', $fragment_name, $match)) + { + $bbcode_name = $match[1]; + + if (isset($fragments[$bbcode_name . '_open'])) + { + $templates[$bbcode_name] = $fragments[$bbcode_name . '_open'] . '' . $fragment; + } + } + } + + // Manually recompose and overwrite irregular templates + $templates['list'] = + ' + + ' . $fragments['ulist_open_default'] . '' . $fragments['ulist_close'] . ' + + + ' . $fragments['olist_open'] . '' . $fragments['olist_close'] . ' + + + ' . $fragments['ulist_open'] . '' . $fragments['ulist_close'] . ' + + '; + + $templates['li'] = $fragments['listitem'] . '' . $fragments['listitem_close']; + + // Replace the regular quote template with the extended quote template if available + if (isset($fragments['quote_extended'])) + { + $templates['quote'] = $fragments['quote_extended']; + } + + // The [attachment] BBCode uses the inline_attachment template to output a comment that + // is post-processed by parse_attachments() + $templates['attachment'] = $fragments['inline_attachment_open'] . ' ia ia ' . $fragments['inline_attachment_close']; + + // Add fragments as templates + foreach ($fragments as $fragment_name => $fragment) + { + if (preg_match('#^\\w+$#', $fragment_name)) + { + $templates[$fragment_name] = $fragment; + } + } + + // Keep only templates that are named after an existing BBCode + $templates = array_intersect_key($templates, $this->default_definitions); + + return $templates; + } + + /** + * Merge the templates from any number of styles into one BBCode template + * + * When multiple templates are available for the same BBCode (because of multiple styles) we + * merge them into a single template that uses an xsl:choose construct that determines which + * style to use at rendering time. + * + * @param array $style_templates Associative array matching style_ids to their template + * @return string + */ + protected function merge_templates(array $style_templates) + { + // Return the template as-is if there's only one style or all styles share the same template + if (count(array_unique($style_templates)) === 1) + { + return end($style_templates); + } + + // Group identical templates together + $grouped_templates = array(); + foreach ($style_templates as $style_id => $style_template) + { + $grouped_templates[$style_template][] = '$STYLE_ID=' . $style_id; + } + + // Sort templates by frequency descending + $templates_cnt = array_map('sizeof', $grouped_templates); + array_multisort($grouped_templates, $templates_cnt); + + // Remove the most frequent template from the list; It becomes the default + reset($grouped_templates); + $default_template = key($grouped_templates); + unset($grouped_templates[$default_template]); + + // Build an xsl:choose switch + $template = ''; + foreach ($grouped_templates as $style_template => $exprs) + { + $template .= '' . $style_template . ''; + } + $template .= '' . $default_template . ''; + + return $template; + } +} diff --git a/install/update/old/phpbb/textformatter/s9e/link_helper.php b/install/update/old/phpbb/textformatter/s9e/link_helper.php new file mode 100644 index 0000000..483794a --- /dev/null +++ b/install/update/old/phpbb/textformatter/s9e/link_helper.php @@ -0,0 +1,115 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +class link_helper +{ + /** + * Clean up and invalidate a LINK_TEXT tag if applicable + * + * Will invalidate the tag if its replacement text is the same as the original + * text and would have no visible effect + * + * @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag + * @param \s9e\TextFormatter\Parser $parser Parser + * @return void + */ + public function cleanup_tag(\s9e\TextFormatter\Parser\Tag $tag, \s9e\TextFormatter\Parser $parser) + { + // Invalidate if the content of the tag matches the text attribute + $text = substr($parser->getText(), $tag->getPos(), $tag->getLen()); + if ($text === $tag->getAttribute('text')) + { + $tag->invalidate(); + } + } + + /** + * Create a LINK_TEXT tag inside of a link + * + * Meant to only apply to linkified URLs and [url] BBCodes without a parameter + * + * @param \s9e\TextFormatter\Parser\Tag $tag URL tag (start tag) + * @param \s9e\TextFormatter\Parser $parser Parser + * @return void + */ + public function generate_link_text_tag(\s9e\TextFormatter\Parser\Tag $tag, \s9e\TextFormatter\Parser $parser) + { + // Only create a LINK_TEXT tag if the start tag is paired with an end + // tag, which is the case with tags from the Autolink plugins and with + // the [url] BBCode when its content is used for the URL + if (!$tag->getEndTag() || !$this->should_shorten($tag, $parser->getText())) + { + return; + } + + // Capture the text between the start tag and its end tag + $start = $tag->getPos() + $tag->getLen(); + $end = $tag->getEndTag()->getPos(); + $length = $end - $start; + $text = substr($parser->getText(), $start, $length); + + // Create a tag that consumes the link's text and make it depends on this tag + $link_text_tag = $parser->addSelfClosingTag('LINK_TEXT', $start, $length); + $link_text_tag->setAttribute('text', $text); + $tag->cascadeInvalidationTo($link_text_tag); + } + + /** + * Test whether we should shorten this tag's text + * + * Will test whether the tag either does not use any markup or uses a single + * [url] BBCode + * + * @param \s9e\TextFormatter\Parser\Tag $tag URL tag + * @param string $text Original text + * @return bool + */ + protected function should_shorten(\s9e\TextFormatter\Parser\Tag $tag, $text) + { + return ($tag->getLen() === 0 || strtolower(substr($text, $tag->getPos(), $tag->getLen())) === '[url]'); + } + + /** + * Remove the board's root URL from a the start of a string + * + * @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag + * @param string $board_url Forum's root URL (with trailing slash) + * @return void + */ + public function truncate_local_url(\s9e\TextFormatter\Parser\Tag $tag, $board_url) + { + $text = $tag->getAttribute('text'); + if (stripos($text, $board_url) === 0 && strlen($text) > strlen($board_url)) + { + $tag->setAttribute('text', substr($text, strlen($board_url))); + } + } + + /** + * Truncate the replacement text set in a LINK_TEXT tag + * + * @param \s9e\TextFormatter\Parser\Tag $tag LINK_TEXT tag + * @return void + */ + public function truncate_text(\s9e\TextFormatter\Parser\Tag $tag) + { + $text = $tag->getAttribute('text'); + if (utf8_strlen($text) > 55) + { + $text = utf8_substr($text, 0, 39) . ' ... ' . utf8_substr($text, -10); + $tag->setAttribute('text', $text); + } + } +} diff --git a/install/update/old/phpbb/textformatter/s9e/parser.php b/install/update/old/phpbb/textformatter/s9e/parser.php new file mode 100644 index 0000000..3698dca --- /dev/null +++ b/install/update/old/phpbb/textformatter/s9e/parser.php @@ -0,0 +1,399 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +use s9e\TextFormatter\Parser\AttributeFilters\UrlFilter; +use s9e\TextFormatter\Parser\Logger; + +/** +* s9e\TextFormatter\Parser adapter +*/ +class parser implements \phpbb\textformatter\parser_interface +{ + /** + * @var \phpbb\event\dispatcher_interface + */ + protected $dispatcher; + + /** + * @var \s9e\TextFormatter\Parser + */ + protected $parser; + + /** + * Constructor + * + * @param \phpbb\cache\driver_interface $cache + * @param string $key Cache key + * @param factory $factory + * @param \phpbb\event\dispatcher_interface $dispatcher + */ + public function __construct(\phpbb\cache\driver\driver_interface $cache, $key, factory $factory, \phpbb\event\dispatcher_interface $dispatcher) + { + $parser = $cache->get($key); + if (!$parser) + { + $objects = $factory->regenerate(); + $parser = $objects['parser']; + } + + $this->dispatcher = $dispatcher; + $this->parser = $parser; + + $parser = $this; + + /** + * Configure the parser service + * + * Can be used to: + * - toggle features or BBCodes + * - register variables or custom parsers in the s9e\TextFormatter parser + * - configure the s9e\TextFormatter parser's runtime settings + * + * @event core.text_formatter_s9e_parser_setup + * @var \phpbb\textformatter\s9e\parser parser This parser service + * @since 3.2.0-a1 + */ + $vars = array('parser'); + extract($dispatcher->trigger_event('core.text_formatter_s9e_parser_setup', compact($vars))); + } + + /** + * {@inheritdoc} + */ + public function parse($text) + { + $parser = $this; + + /** + * Modify a text before it is parsed + * + * @event core.text_formatter_s9e_parse_before + * @var \phpbb\textformatter\s9e\parser parser This parser service + * @var string text The original text + * @since 3.2.0-a1 + */ + $vars = array('parser', 'text'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_parse_before', compact($vars))); + + $xml = $this->parser->parse($text); + + /** + * Modify a parsed text in its XML form + * + * @event core.text_formatter_s9e_parse_after + * @var \phpbb\textformatter\s9e\parser parser This parser service + * @var string xml The parsed text, in XML + * @since 3.2.0-a1 + */ + $vars = array('parser', 'xml'); + extract($this->dispatcher->trigger_event('core.text_formatter_s9e_parse_after', compact($vars))); + + return $xml; + } + + /** + * {@inheritdoc} + */ + public function disable_bbcode($name) + { + $this->parser->disableTag(strtoupper($name)); + } + + /** + * {@inheritdoc} + */ + public function disable_bbcodes() + { + $this->parser->disablePlugin('BBCodes'); + } + + /** + * {@inheritdoc} + */ + public function disable_censor() + { + $this->parser->disablePlugin('Censor'); + } + + /** + * {@inheritdoc} + */ + public function disable_magic_url() + { + $this->parser->disablePlugin('Autoemail'); + $this->parser->disablePlugin('Autolink'); + } + + /** + * {@inheritdoc} + */ + public function disable_smilies() + { + $this->parser->disablePlugin('Emoticons'); + $this->parser->disablePlugin('Emoji'); + } + + /** + * {@inheritdoc} + */ + public function enable_bbcode($name) + { + $this->parser->enableTag(strtoupper($name)); + } + + /** + * {@inheritdoc} + */ + public function enable_bbcodes() + { + $this->parser->enablePlugin('BBCodes'); + } + + /** + * {@inheritdoc} + */ + public function enable_censor() + { + $this->parser->enablePlugin('Censor'); + } + + /** + * {@inheritdoc} + */ + public function enable_magic_url() + { + $this->parser->enablePlugin('Autoemail'); + $this->parser->enablePlugin('Autolink'); + } + + /** + * {@inheritdoc} + */ + public function enable_smilies() + { + $this->parser->enablePlugin('Emoticons'); + $this->parser->enablePlugin('Emoji'); + } + + /** + * {@inheritdoc} + * + * This will convert the log entries found in s9e\TextFormatter's logger into phpBB error + * messages + */ + public function get_errors() + { + $errors = array(); + foreach ($this->parser->getLogger()->getLogs() as $entry) + { + list(, $msg, $context) = $entry; + + if ($msg === 'Tag limit exceeded') + { + if ($context['tagName'] === 'E') + { + $errors[] = array('TOO_MANY_SMILIES', $context['tagLimit']); + } + else if ($context['tagName'] === 'URL') + { + $errors[] = array('TOO_MANY_URLS', $context['tagLimit']); + } + } + else if ($msg === 'MAX_FONT_SIZE_EXCEEDED') + { + $errors[] = array($msg, $context['max_size']); + } + else if (preg_match('/^MAX_(?:FLASH|IMG)_(HEIGHT|WIDTH)_EXCEEDED$/D', $msg, $m)) + { + $errors[] = array($msg, $context['max_' . strtolower($m[1])]); + } + else if ($msg === 'Tag is disabled') + { + $name = strtolower($context['tag']->getName()); + $errors[] = array('UNAUTHORISED_BBCODE', '[' . $name . ']'); + } + else if ($msg === 'UNABLE_GET_IMAGE_SIZE') + { + $errors[] = array($msg); + } + } + + // Deduplicate error messages. array_unique() only works on strings so we have to serialize + if (!empty($errors)) + { + $errors = array_map('unserialize', array_unique(array_map('serialize', $errors))); + } + + return $errors; + } + + /** + * Return the instance of s9e\TextFormatter\Parser used by this object + * + * @return \s9e\TextFormatter\Parser + */ + public function get_parser() + { + return $this->parser; + } + + /** + * {@inheritdoc} + */ + public function set_var($name, $value) + { + if ($name === 'max_smilies') + { + $this->parser->setTagLimit('E', $value ?: PHP_INT_MAX); + } + else if ($name === 'max_urls') + { + $this->parser->setTagLimit('URL', $value ?: PHP_INT_MAX); + } + else + { + $this->parser->registeredVars[$name] = $value; + } + } + + /** + * {@inheritdoc} + */ + public function set_vars(array $vars) + { + foreach ($vars as $name => $value) + { + $this->set_var($name, $value); + } + } + + /** + * Filter a flash object's height + * + * @see bbcode_firstpass::bbcode_flash() + * + * @param string $height + * @param integer $max_height + * @param Logger $logger + * @return mixed Original value if valid, FALSE otherwise + */ + static public function filter_flash_height($height, $max_height, Logger $logger) + { + if ($max_height && $height > $max_height) + { + $logger->err('MAX_FLASH_HEIGHT_EXCEEDED', array('max_height' => $max_height)); + + return false; + } + + return $height; + } + + /** + * Filter a flash object's width + * + * @see bbcode_firstpass::bbcode_flash() + * + * @param string $width + * @param integer $max_width + * @param Logger $logger + * @return mixed Original value if valid, FALSE otherwise + */ + static public function filter_flash_width($width, $max_width, Logger $logger) + { + if ($max_width && $width > $max_width) + { + $logger->err('MAX_FLASH_WIDTH_EXCEEDED', array('max_width' => $max_width)); + + return false; + } + + return $width; + } + + /** + * Filter the value used in a [size] BBCode + * + * @see bbcode_firstpass::bbcode_size() + * + * @param string $size Original size + * @param integer $max_size Maximum allowed size + * @param Logger $logger + * @return mixed Original value if valid, FALSE otherwise + */ + static public function filter_font_size($size, $max_size, Logger $logger) + { + if ($max_size && $size > $max_size) + { + $logger->err('MAX_FONT_SIZE_EXCEEDED', array('max_size' => $max_size)); + + return false; + } + + if ($size < 1) + { + return false; + } + + return $size; + } + + /** + * Filter an image's URL to enforce restrictions on its dimensions + * + * @see bbcode_firstpass::bbcode_img() + * + * @param string $url Original URL + * @param array $url_config Config used by the URL filter + * @param Logger $logger + * @param integer $max_height Maximum height allowed + * @param integer $max_width Maximum width allowed + * @return string|bool Original value if valid, FALSE otherwise + */ + static public function filter_img_url($url, array $url_config, Logger $logger, $max_height, $max_width) + { + // Validate the URL + $url = UrlFilter::filter($url, $url_config, $logger); + if ($url === false) + { + return false; + } + + if ($max_height || $max_width) + { + $imagesize = new \FastImageSize\FastImageSize(); + $size_info = $imagesize->getImageSize($url); + if ($size_info === false) + { + $logger->err('UNABLE_GET_IMAGE_SIZE'); + return false; + } + + if ($max_height && $max_height < $size_info['height']) + { + $logger->err('MAX_IMG_HEIGHT_EXCEEDED', array('max_height' => $max_height)); + return false; + } + + if ($max_width && $max_width < $size_info['width']) + { + $logger->err('MAX_IMG_WIDTH_EXCEEDED', array('max_width' => $max_width)); + return false; + } + } + + return $url; + } +} diff --git a/install/update/old/phpbb/textformatter/s9e/quote_helper.php b/install/update/old/phpbb/textformatter/s9e/quote_helper.php new file mode 100644 index 0000000..86c33c7 --- /dev/null +++ b/install/update/old/phpbb/textformatter/s9e/quote_helper.php @@ -0,0 +1,81 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb\textformatter\s9e; + +class quote_helper +{ + /** + * @var string Base URL for a post link, uses {POST_ID} as placeholder + */ + protected $post_url; + + /** + * @var string Base URL for a profile link, uses {USER_ID} as placeholder + */ + protected $profile_url; + + /** + * @var \phpbb\user + */ + protected $user; + + /** + * Constructor + * + * @param \phpbb\user $user + * @param string $root_path + * @param string $php_ext + */ + public function __construct(\phpbb\user $user, $root_path, $php_ext) + { + $this->post_url = append_sid($root_path . 'viewtopic.' . $php_ext, 'p={POST_ID}#p{POST_ID}', false); + $this->profile_url = append_sid($root_path . 'memberlist.' . $php_ext, 'mode=viewprofile&u={USER_ID}', false); + $this->user = $user; + } + + /** + * Inject dynamic metadata into QUOTE tags in given XML + * + * @param string $xml Original XML + * @return string Modified XML + */ + public function inject_metadata($xml) + { + $post_url = $this->post_url; + $profile_url = $this->profile_url; + $user = $this->user; + + return \s9e\TextFormatter\Utils::replaceAttributes( + $xml, + 'QUOTE', + function ($attributes) use ($post_url, $profile_url, $user) + { + if (isset($attributes['post_id'])) + { + $attributes['post_url'] = str_replace('{POST_ID}', $attributes['post_id'], $post_url); + } + if (isset($attributes['time'])) + { + $attributes['date'] = $user->format_date($attributes['time']); + } + if (isset($attributes['user_id'])) + { + $attributes['profile_url'] = str_replace('{USER_ID}', $attributes['user_id'], $profile_url); + } + + return $attributes; + } + ); + } +} diff --git a/install/update/old/phpbb/user.php b/install/update/old/phpbb/user.php new file mode 100644 index 0000000..7363290 --- /dev/null +++ b/install/update/old/phpbb/user.php @@ -0,0 +1,814 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* Base user class +* +* This is the overarching class which contains (through session extend) +* all methods utilised for user functionality during a session. +*/ +class user extends \phpbb\session +{ + /** + * @var \phpbb\language\language + */ + protected $language; + + var $style = array(); + var $date_format; + + /** + * DateTimeZone object holding the timezone of the user + */ + public $timezone; + + /** + * @var string Class name of datetime object + */ + protected $datetime; + + var $lang_name = false; + var $lang_id = false; + var $lang_path; + var $img_lang; + var $img_array = array(); + + /** @var bool */ + protected $is_setup_flag; + + // Able to add new options (up to id 31) + var $keyoptions = array('viewimg' => 0, 'viewflash' => 1, 'viewsmilies' => 2, 'viewsigs' => 3, 'viewavatars' => 4, 'viewcensors' => 5, 'attachsig' => 6, 'bbcode' => 8, 'smilies' => 9, 'sig_bbcode' => 15, 'sig_smilies' => 16, 'sig_links' => 17); + + /** + * Constructor to set the lang path + * + * @param \phpbb\language\language $lang phpBB's Language loader + * @param string $datetime_class Class name of datetime class + */ + function __construct(\phpbb\language\language $lang, $datetime_class) + { + global $phpbb_root_path; + + $this->lang_path = $phpbb_root_path . 'language/'; + $this->language = $lang; + $this->datetime = $datetime_class; + + $this->is_setup_flag = false; + } + + /** + * Returns whether user::setup was called + * + * @return bool + */ + public function is_setup() + { + return $this->is_setup_flag; + } + + /** + * Magic getter for BC compatibility + * + * Implement array access for user::lang. + * + * @param string $param_name Name of the BC component the user want to access + * + * @return array The appropriate array + * + * @deprecated 3.2.0-dev (To be removed: 4.0.0) + */ + public function __get($param_name) + { + if ($param_name === 'lang') + { + return $this->language->get_lang_array(); + } + else if ($param_name === 'help') + { + $help_array = $this->language->get_lang_array(); + return $help_array['__help']; + } + + return array(); + } + + /** + * Setup basic user-specific items (style, language, ...) + */ + function setup($lang_set = false, $style_id = false) + { + global $db, $request, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; + global $phpbb_dispatcher; + + $this->language->set_default_language($config['default_lang']); + + if ($this->data['user_id'] != ANONYMOUS) + { + $user_lang_name = (file_exists($this->lang_path . $this->data['user_lang'] . "/common.$phpEx")) ? $this->data['user_lang'] : basename($config['default_lang']); + $user_date_format = $this->data['user_dateformat']; + $user_timezone = $this->data['user_timezone']; + } + else + { + $lang_override = $request->variable('language', ''); + if ($lang_override) + { + $this->set_cookie('lang', $lang_override, 0, false); + } + else + { + $lang_override = $request->variable($config['cookie_name'] . '_lang', '', true, \phpbb\request\request_interface::COOKIE); + } + + if ($lang_override) + { + $use_lang = basename($lang_override); + $user_lang_name = (file_exists($this->lang_path . $use_lang . "/common.$phpEx")) ? $use_lang : basename($config['default_lang']); + $this->data['user_lang'] = $user_lang_name; + } + else + { + $user_lang_name = basename($config['default_lang']); + } + + $user_date_format = $config['default_dateformat']; + $user_timezone = $config['board_timezone']; + + /** + * If a guest user is surfing, we try to guess his/her language first by obtaining the browser language + * If re-enabled we need to make sure only those languages installed are checked + * Commented out so we do not loose the code. + + if ($request->header('Accept-Language')) + { + $accept_lang_ary = explode(',', $request->header('Accept-Language')); + + foreach ($accept_lang_ary as $accept_lang) + { + // Set correct format ... guess full xx_YY form + $accept_lang = substr($accept_lang, 0, 2) . '_' . strtoupper(substr($accept_lang, 3, 2)); + $accept_lang = basename($accept_lang); + + if (file_exists($this->lang_path . $accept_lang . "/common.$phpEx")) + { + $user_lang_name = $config['default_lang'] = $accept_lang; + break; + } + else + { + // No match on xx_YY so try xx + $accept_lang = substr($accept_lang, 0, 2); + $accept_lang = basename($accept_lang); + + if (file_exists($this->lang_path . $accept_lang . "/common.$phpEx")) + { + $user_lang_name = $config['default_lang'] = $accept_lang; + break; + } + } + } + } + */ + } + + $user_data = $this->data; + $lang_set_ext = array(); + + /** + * Event to load language files and modify user data on every page + * + * Note: To load language file with this event, see description + * of lang_set_ext variable. + * + * @event core.user_setup + * @var array user_data Array with user's data row + * @var string user_lang_name Basename of the user's langauge + * @var string user_date_format User's date/time format + * @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.0-a1 + */ + $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; + $this->lang_name = $user_lang_name; + $this->date_format = $user_date_format; + + $this->language->set_user_language($user_lang_name); + + try + { + $this->timezone = new \DateTimeZone($user_timezone); + } + catch (\Exception $e) + { + // If the timezone the user has selected is invalid, we fall back to UTC. + $this->timezone = new \DateTimeZone('UTC'); + } + + $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->variable('style', 0); + if ($style_request && (!$config['override_user_style'] || $auth->acl_get('a_styles')) && !defined('ADMIN_START')) + { + global $SID, $_EXTRA_URL; + + $style_id = $style_request; + $SID .= '&style=' . $style_id; + $_EXTRA_URL = array('style=' . $style_id); + } + else + { + // Set up style + $style_id = ($style_id) ? $style_id : ((!$config['override_user_style']) ? $this->data['user_style'] : $config['default_style']); + } + + $sql = 'SELECT * + FROM ' . STYLES_TABLE . " s + WHERE s.style_id = $style_id"; + $result = $db->sql_query($sql, 3600); + $this->style = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + // Fallback to user's standard style + if (!$this->style && $style_id != $this->data['user_style']) + { + $style_id = $this->data['user_style']; + + $sql = 'SELECT * + FROM ' . STYLES_TABLE . " s + WHERE s.style_id = $style_id"; + $result = $db->sql_query($sql, 3600); + $this->style = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + if (!$this->style) + { + trigger_error('NO_STYLE_DATA', E_USER_ERROR); + } + + // Now parse the cfg file and cache it + $parsed_items = $cache->obtain_cfg_items($this->style); + + $check_for = array( + 'pagination_sep' => (string) ', ' + ); + + foreach ($check_for as $key => $default_value) + { + $this->style[$key] = (isset($parsed_items[$key])) ? $parsed_items[$key] : $default_value; + settype($this->style[$key], gettype($default_value)); + + if (is_string($default_value)) + { + $this->style[$key] = htmlspecialchars($this->style[$key]); + } + } + + $template->set_style(); + + $this->img_lang = $this->lang_name; + + // Call phpbb_user_session_handler() in case external application want to "bend" some variables or replace classes... + // After calling it we continue script execution... + phpbb_user_session_handler(); + + /** + * Execute code at the end of user setup + * + * @event core.user_setup_after + * @since 3.1.6-RC1 + */ + $phpbb_dispatcher->dispatch('core.user_setup_after'); + + // If this function got called from the error handler we are finished here. + if (defined('IN_ERROR_HANDLER')) + { + return; + } + + // Disable board if the install/ directory is still present + // For the brave development army we do not care about this, else we need to comment out this everytime we develop locally + if (!defined('DEBUG') && !defined('ADMIN_START') && !defined('IN_INSTALL') && !defined('IN_LOGIN') && file_exists($phpbb_root_path . 'install') && !is_file($phpbb_root_path . 'install')) + { + // Adjust the message slightly according to the permissions + if ($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) + { + $message = 'REMOVE_INSTALL'; + } + else + { + $message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE'; + } + trigger_error($message); + } + + // Is board disabled and user not an admin or moderator? + if ($config['board_disable'] && !defined('IN_INSTALL') && !defined('IN_LOGIN') && !defined('SKIP_CHECK_DISABLED') && !$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) + { + if ($this->data['is_bot']) + { + send_status_line(503, 'Service Unavailable'); + } + + $message = (!empty($config['board_disable_msg'])) ? $config['board_disable_msg'] : 'BOARD_DISABLE'; + trigger_error($message); + } + + // Is load exceeded? + if ($config['limit_load'] && $this->load !== false) + { + if ($this->load > floatval($config['limit_load']) && !defined('IN_LOGIN') && !defined('IN_ADMIN')) + { + // Set board disabled to true to let the admins/mods get the proper notification + $config['board_disable'] = '1'; + + if (!$auth->acl_gets('a_', 'm_') && !$auth->acl_getf_global('m_')) + { + if ($this->data['is_bot']) + { + send_status_line(503, 'Service Unavailable'); + } + trigger_error('BOARD_UNAVAILABLE'); + } + } + } + + if (isset($this->data['session_viewonline'])) + { + // Make sure the user is able to hide his session + if (!$this->data['session_viewonline']) + { + // Reset online status if not allowed to hide the session... + if (!$auth->acl_get('u_hideonline')) + { + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET session_viewonline = 1 + WHERE session_user_id = ' . $this->data['user_id']; + $db->sql_query($sql); + $this->data['session_viewonline'] = 1; + } + } + else if (!$this->data['user_allow_viewonline']) + { + // the user wants to hide and is allowed to -> cloaking device on. + if ($auth->acl_get('u_hideonline')) + { + $sql = 'UPDATE ' . SESSIONS_TABLE . ' + SET session_viewonline = 0 + WHERE session_user_id = ' . $this->data['user_id']; + $db->sql_query($sql); + $this->data['session_viewonline'] = 0; + } + } + } + + // Does the user need to change their password? If so, redirect to the + // ucp profile reg_details page ... of course do not redirect if we're already in the ucp + if (!defined('IN_ADMIN') && !defined('ADMIN_START') && $config['chg_passforce'] && !empty($this->data['is_registered']) && $auth->acl_get('u_chgpasswd') && $this->data['user_passchg'] < time() - ($config['chg_passforce'] * 86400)) + { + if (strpos($this->page['query_string'], 'mode=reg_details') === false && $this->page['page_name'] != "ucp.$phpEx") + { + redirect(append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=profile&mode=reg_details')); + } + } + + $this->is_setup_flag = true; + + return; + } + + /** + * More advanced language substitution + * Function to mimic sprintf() with the possibility of using phpBB's language system to substitute nullar/singular/plural forms. + * Params are the language key and the parameters to be substituted. + * This function/functionality is inspired by SHS` and Ashe. + * + * Example call: $user->lang('NUM_POSTS_IN_QUEUE', 1); + * + * If the first parameter is an array, the elements are used as keys and subkeys to get the language entry: + * Example: $user->lang(array('datetime', 'AGO'), 1) uses $user->lang['datetime']['AGO'] as language entry. + * + * @deprecated 3.2.0-dev (To be removed 4.0.0) + */ + function lang() + { + $args = func_get_args(); + return call_user_func_array(array($this->language, 'lang'), $args); + } + + /** + * Determine which plural form we should use. + * For some languages this is not as simple as for English. + * + * @param $number int|float The number we want to get the plural case for. Float numbers are floored. + * @param $force_rule mixed False to use the plural rule of the language package + * or an integer to force a certain plural rule + * @return int|bool The plural-case we need to use for the number plural-rule combination, false if $force_rule + * was invalid. + * + * @deprecated: 3.2.0-dev (To be removed: 3.3.0) + */ + function get_plural_form($number, $force_rule = false) + { + return $this->language->get_plural_form($number, $force_rule); + } + + /** + * Add Language Items - use_db and use_help are assigned where needed (only use them to force inclusion) + * + * @param mixed $lang_set specifies the language entries to include + * @param bool $use_db internal variable for recursion, do not use @deprecated 3.2.0-dev (To be removed: 3.3.0) + * @param bool $use_help internal variable for recursion, do not use @deprecated 3.2.0-dev (To be removed: 3.3.0) + * @param string $ext_name The extension to load language from, or empty for core files + * + * Examples: + * + * $lang_set = array('posting', 'help' => 'faq'); + * $lang_set = array('posting', 'viewtopic', 'help' => array('bbcode', 'faq')) + * $lang_set = array(array('posting', 'viewtopic'), 'help' => array('bbcode', 'faq')) + * $lang_set = 'posting' + * $lang_set = array('help' => 'faq', 'db' => array('help:faq', 'posting')) + * + * + * Note: $use_db and $use_help should be removed. The old function was kept for BC purposes, + * so the BC logic is handled here. + * + * @deprecated: 3.2.0-dev (To be removed: 3.3.0) + */ + function add_lang($lang_set, $use_db = false, $use_help = false, $ext_name = '') + { + if (is_array($lang_set)) + { + foreach ($lang_set as $key => $lang_file) + { + // Please do not delete this line. + // We have to force the type here, else [array] language inclusion will not work + $key = (string) $key; + + if ($key == 'db') + { + // This is never used + $this->add_lang($lang_file, true, $use_help, $ext_name); + } + else if ($key == 'help') + { + $this->add_lang($lang_file, $use_db, true, $ext_name); + } + else if (!is_array($lang_file)) + { + $this->set_lang($lang_file, $use_help, $ext_name); + } + else + { + $this->add_lang($lang_file, $use_db, $use_help, $ext_name); + } + } + unset($lang_set); + } + else if ($lang_set) + { + $this->set_lang($lang_set, $use_help, $ext_name); + } + } + + /** + * BC function for loading language files + * + * @deprecated 3.2.0-dev (To be removed: 3.3.0) + */ + private function set_lang($lang_set, $use_help, $ext_name) + { + if (empty($ext_name)) + { + $ext_name = null; + } + + if ($use_help && strpos($lang_set, '/') !== false) + { + $component = dirname($lang_set) . '/help_' . basename($lang_set); + + if ($component[0] === '/') + { + $component = substr($component, 1); + } + } + else + { + $component = (($use_help) ? 'help_' : '') . $lang_set; + } + + $this->language->add_lang($component, $ext_name); + } + + /** + * Add Language Items from an extension - use_db and use_help are assigned where needed (only use them to force inclusion) + * + * @param string $ext_name The extension to load language from, or empty for core files + * @param mixed $lang_set specifies the language entries to include + * @param bool $use_db internal variable for recursion, do not use + * @param bool $use_help internal variable for recursion, do not use + * + * Note: $use_db and $use_help should be removed. Kept for BC purposes. + * + * @deprecated: 3.2.0-dev (To be removed: 3.3.0) + */ + function add_lang_ext($ext_name, $lang_set, $use_db = false, $use_help = false) + { + if ($ext_name === '/') + { + $ext_name = ''; + } + + $this->add_lang($lang_set, $use_db, $use_help, $ext_name); + } + + /** + * Format user date + * + * @param int $gmepoch unix timestamp + * @param string $format date format in date() notation. | used to indicate relative dates, for example |d m Y|, h:i is translated to Today, h:i. + * @param bool $forcedate force non-relative date format. + * + * @return mixed translated date + */ + function format_date($gmepoch, $format = false, $forcedate = false) + { + global $phpbb_dispatcher; + static $utc; + + if (!isset($utc)) + { + $utc = new \DateTimeZone('UTC'); + } + + $format_date_override = false; + $function_arguments = func_get_args(); + /** + * Execute code and/or override format_date() + * + * To override the format_date() function generated value + * set $format_date_override to new return value + * + * @event core.user_format_date_override + * @var DateTimeZone utc Is DateTimeZone in UTC + * @var array function_arguments is array comprising a function's argument list + * @var string format_date_override Shall we return custom format (string) or not (false) + * @since 3.2.1-RC1 + */ + $vars = array('utc', 'function_arguments', 'format_date_override'); + extract($phpbb_dispatcher->trigger_event('core.user_format_date_override', compact($vars))); + + if (!$format_date_override) + { + $time = new $this->datetime($this, '@' . (int) $gmepoch, $utc); + $time->setTimezone($this->timezone); + + return $time->format($format, $forcedate); + } + else + { + return $format_date_override; + } + } + + /** + * Create a \phpbb\datetime object in the context of the current user + * + * @since 3.1 + * @param string $time String in a format accepted by strtotime(). + * @param DateTimeZone $timezone Time zone of the time. + * @return \phpbb\datetime Date time object linked to the current users locale + */ + public function create_datetime($time = 'now', \DateTimeZone $timezone = null) + { + $timezone = $timezone ?: $this->timezone; + return new $this->datetime($this, $time, $timezone); + } + + /** + * Get the UNIX timestamp for a datetime in the users timezone, so we can store it in the database. + * + * @param string $format Format of the entered date/time + * @param string $time Date/time with the timezone applied + * @param DateTimeZone $timezone Timezone of the date/time, falls back to timezone of current user + * @return int Returns the unix timestamp + */ + public function get_timestamp_from_format($format, $time, \DateTimeZone $timezone = null) + { + $timezone = $timezone ?: $this->timezone; + $date = \DateTime::createFromFormat($format, $time, $timezone); + return ($date !== false) ? $date->format('U') : false; + } + + /** + * Get language id currently used by the user + */ + function get_iso_lang_id() + { + global $config, $db; + + if (!empty($this->lang_id)) + { + return $this->lang_id; + } + + if (!$this->lang_name) + { + $this->lang_name = $config['default_lang']; + } + + $sql = 'SELECT lang_id + FROM ' . LANG_TABLE . " + WHERE lang_iso = '" . $db->sql_escape($this->lang_name) . "'"; + $result = $db->sql_query($sql); + $this->lang_id = (int) $db->sql_fetchfield('lang_id'); + $db->sql_freeresult($result); + + return $this->lang_id; + } + + /** + * Get users profile fields + */ + function get_profile_fields($user_id) + { + global $db; + + if (isset($this->profile_fields)) + { + return; + } + + $sql = 'SELECT * + FROM ' . PROFILE_FIELDS_DATA_TABLE . " + WHERE user_id = $user_id"; + $result = $db->sql_query_limit($sql, 1); + $this->profile_fields = (!($row = $db->sql_fetchrow($result))) ? array() : $row; + $db->sql_freeresult($result); + } + + /** + * Specify/Get image + */ + function img($img, $alt = '') + { + $title = ''; + + if ($alt) + { + $alt = $this->language->lang($alt); + $title = ' title="' . $alt . '"'; + } + return '' . $alt . ''; + } + + /** + * Get option bit field from user options. + * + * @param int $key option key, as defined in $keyoptions property. + * @param int $data bit field value to use, or false to use $this->data['user_options'] + * @return bool true if the option is set in the bit field, false otherwise + */ + function optionget($key, $data = false) + { + $var = ($data !== false) ? $data : $this->data['user_options']; + return phpbb_optionget($this->keyoptions[$key], $var); + } + + /** + * Set option bit field for user options. + * + * @param int $key Option key, as defined in $keyoptions property. + * @param bool $value True to set the option, false to clear the option. + * @param int $data Current bit field value, or false to use $this->data['user_options'] + * @return int|bool If $data is false, the bit field is modified and + * written back to $this->data['user_options'], and + * return value is true if the bit field changed and + * false otherwise. If $data is not false, the new + * bitfield value is returned. + */ + function optionset($key, $value, $data = false) + { + $var = ($data !== false) ? $data : $this->data['user_options']; + + $new_var = phpbb_optionset($this->keyoptions[$key], $value, $var); + + if ($data === false) + { + if ($new_var != $var) + { + $this->data['user_options'] = $new_var; + return true; + } + else + { + return false; + } + } + else + { + return $new_var; + } + } + + /** + * Funtion to make the user leave the NEWLY_REGISTERED system group. + * @access public + */ + function leave_newly_registered() + { + if (empty($this->data['user_new'])) + { + return false; + } + + if (!function_exists('remove_newly_registered')) + { + global $phpbb_root_path, $phpEx; + + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + if ($group = remove_newly_registered($this->data['user_id'], $this->data)) + { + $this->data['group_id'] = $group; + + } + $this->data['user_permissions'] = ''; + $this->data['user_new'] = 0; + + return true; + } + + /** + * Returns all password protected forum ids the user is currently NOT authenticated for. + * + * @return array Array of forum ids + * @access public + */ + function get_passworded_forums() + { + global $db; + + $sql = 'SELECT f.forum_id, fa.user_id + FROM ' . FORUMS_TABLE . ' f + LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa + ON (fa.forum_id = f.forum_id + AND fa.session_id = '" . $db->sql_escape($this->session_id) . "') + WHERE f.forum_password <> ''"; + $result = $db->sql_query($sql); + + $forum_ids = array(); + while ($row = $db->sql_fetchrow($result)) + { + $forum_id = (int) $row['forum_id']; + + if ($row['user_id'] != $this->data['user_id']) + { + $forum_ids[$forum_id] = $forum_id; + } + } + $db->sql_freeresult($result); + + return $forum_ids; + } +} diff --git a/install/update/old/phpbb/user_loader.php b/install/update/old/phpbb/user_loader.php new file mode 100644 index 0000000..9297450 --- /dev/null +++ b/install/update/old/phpbb/user_loader.php @@ -0,0 +1,238 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +namespace phpbb; + +/** +* User loader class +* +* This handles loading users from the database and +* storing in them in a temporary cache so we do not +* have to query the same user multiple times in +* different services. +*/ +class user_loader +{ + /** @var \phpbb\db\driver\driver_interface */ + protected $db = null; + + /** @var string */ + protected $phpbb_root_path = null; + + /** @var string */ + protected $php_ext = null; + + /** @var string */ + protected $users_table = null; + + /** + * Users loaded from the DB + * + * @var array Array of user data that we've loaded from the DB + */ + protected $users = array(); + + /** + * User loader constructor + * + * @param \phpbb\db\driver\driver_interface $db A database connection + * @param string $phpbb_root_path Path to the phpbb includes directory. + * @param string $php_ext php file extension + * @param string $users_table The name of the database table (phpbb_users) + */ + public function __construct(\phpbb\db\driver\driver_interface $db, $phpbb_root_path, $php_ext, $users_table) + { + $this->db = $db; + + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->users_table = $users_table; + } + + /** + * Load user helper + * + * @param array $user_ids + * @param array $ignore_types user types to ignore + */ + public function load_users(array $user_ids, array $ignore_types = array()) + { + $user_ids[] = ANONYMOUS; + + // Make user_ids unique and convert to integer. + $user_ids = array_map('intval', array_unique($user_ids)); + + // Do not load users we already have in $this->users + $user_ids = array_diff($user_ids, array_keys($this->users)); + + if (count($user_ids)) + { + $sql = 'SELECT * + FROM ' . $this->users_table . ' + WHERE ' . $this->db->sql_in_set('user_id', $user_ids) . ' + AND ' . $this->db->sql_in_set('user_type', $ignore_types, true, true); + $result = $this->db->sql_query($sql); + + while ($row = $this->db->sql_fetchrow($result)) + { + $this->users[$row['user_id']] = $row; + } + $this->db->sql_freeresult($result); + } + } + + /** + * Load a user by username + * + * Stores the full data in the user cache so they do not need to be loaded again + * Returns the user id so you may use get_user() from the returned value + * + * @param string $username Raw username to load (will be cleaned) + * @return int User ID for the username + */ + public function load_user_by_username($username) + { + $sql = 'SELECT * + FROM ' . $this->users_table . " + WHERE username_clean = '" . $this->db->sql_escape(utf8_clean_string($username)) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if ($row) + { + $this->users[$row['user_id']] = $row; + + return $row['user_id']; + } + + return ANONYMOUS; + } + + /** + * Get a user row from our users cache + * + * @param int $user_id User ID of the user you want to retreive + * @param bool $query Should we query the database if this user has not yet been loaded? + * Typically this should be left as false and you should make sure + * you load users ahead of time with load_users() + * @return array|bool Row from the database of the user or Anonymous if the user wasn't loaded/does not exist + * or bool False if the anonymous user was not loaded + */ + public function get_user($user_id, $query = false) + { + if (isset($this->users[$user_id])) + { + return $this->users[$user_id]; + } + // Query them if we must (if ANONYMOUS is sent as the user_id and we have not loaded Anonymous yet, we must load Anonymous as a last resort) + else if ($query || $user_id == ANONYMOUS) + { + $this->load_users(array($user_id)); + + return $this->get_user($user_id); + } + + return $this->get_user(ANONYMOUS); + } + + /** + * Get username + * + * @param int $user_id User ID of the user you want to retreive the username for + * @param string $mode The mode to load (same as get_username_string). One of the following: + * profile (for getting an url to the profile) + * username (for obtaining the username) + * colour (for obtaining the user colour) + * full (for obtaining a html string representing a coloured link to the users profile) + * no_profile (the same as full but forcing no profile link) + * @param string $guest_username Optional parameter to specify the guest username. It will be used in favor of the GUEST language variable then. + * @param string $custom_profile_url Optional parameter to specify a profile url. The user id get appended to this url as &u={user_id} + * @param bool $query Should we query the database if this user has not yet been loaded? + * Typically this should be left as false and you should make sure + * you load users ahead of time with load_users() + * @return string + */ + public function get_username($user_id, $mode, $guest_username = false, $custom_profile_url = false, $query = false) + { + if (!($user = $this->get_user($user_id, $query))) + { + return ''; + } + + return get_username_string($mode, $user['user_id'], $user['username'], $user['user_colour'], $guest_username, $custom_profile_url); + } + + /** + * Get avatar + * + * @param int $user_id User ID of the user you want to retrieve the avatar for + * @param bool $query Should we query the database if this user has not yet been loaded? + * Typically this should be left as false and you should make sure + * you load users ahead of time with load_users() + * @param bool @lazy If true, will be lazy loaded (requires JS) + * @return string + */ + public function get_avatar($user_id, $query = false, $lazy = false) + { + if (!($user = $this->get_user($user_id, $query))) + { + return ''; + } + + $row = array( + 'avatar' => $user['user_avatar'], + 'avatar_type' => $user['user_avatar_type'], + 'avatar_width' => $user['user_avatar_width'], + 'avatar_height' => $user['user_avatar_height'], + ); + + return phpbb_get_avatar($row, 'USER_AVATAR', false, $lazy); + } + + /** + * Get rank + * + * @param int $user_id User ID of the user you want to retreive the rank for + * @param bool $query Should we query the database if this user has not yet been loaded? + * Typically this should be left as false and you should make sure + * you load users ahead of time with load_users() + * @return array Array with keys 'rank_title', 'rank_img', and 'rank_img_src' + */ + public function get_rank($user_id, $query = false) + { + if (!($user = $this->get_user($user_id, $query))) + { + return ''; + } + + if (!function_exists('phpbb_get_user_rank')) + { + include($this->phpbb_root_path . 'includes/functions_display.' . $this->php_ext); + } + + $rank = array( + 'rank_title', + 'rank_img', + 'rank_img_src', + ); + + $user_rank_data = phpbb_get_user_rank($user, (($user['user_id'] == ANONYMOUS) ? false : $user['user_posts'])); + $rank['rank_title'] = $user_rank_data['title']; + $rank['rank_img'] = $user_rank_data['img']; + $rank['rank_img_src'] = $user_rank_data['img_src']; + + return $rank; + } +} diff --git a/install/update/old/posting.php b/install/update/old/posting.php new file mode 100644 index 0000000..75085a5 --- /dev/null +++ b/install/update/old/posting.php @@ -0,0 +1,1990 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); +include($phpbb_root_path . 'includes/message_parser.' . $phpEx); + + +// Start session management +$user->session_begin(); +$auth->acl($user->data); + + +// Grab only parameters needed here +$post_id = $request->variable('p', 0); +$topic_id = $request->variable('t', 0); +$forum_id = $request->variable('f', 0); +$draft_id = $request->variable('d', 0); + +$preview = (isset($_POST['preview'])) ? true : false; +$save = (isset($_POST['save'])) ? true : false; +$load = (isset($_POST['load'])) ? true : false; +$confirm = $request->is_set_post('confirm'); +$cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false; + +$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview); +$submit = $request->is_set_post('post') && !$refresh && !$preview; +$mode = $request->variable('mode', ''); + +// If the user is not allowed to delete the post, we try to soft delete it, so we overwrite the mode here. +if ($mode == 'delete' && (($confirm && !$request->is_set_post('delete_permanent')) || !$auth->acl_gets('f_delete', 'm_delete', $forum_id))) +{ + $mode = 'soft_delete'; +} + +$error = $post_data = array(); +$current_time = time(); + +/** +* This event allows you to alter the above parameters, such as submit and mode +* +* Note: $refresh must be true to retain previously submitted form data. +* +* Note: The template class will not work properly until $user->setup() is +* called, and it has not been called yet. Extensions requiring template +* assignments should use an event that comes later in this file. +* +* @event core.modify_posting_parameters +* @var int post_id ID of the post +* @var int topic_id ID of the topic +* @var int forum_id ID of the forum +* @var int draft_id ID of the draft +* @var bool submit Whether or not the form has been submitted +* @var bool preview Whether or not the post is being previewed +* @var bool save Whether or not a draft is being saved +* @var bool load Whether or not a draft is being loaded +* @var bool cancel Whether or not to cancel the form (returns to +* viewtopic or viewforum depending on if the user +* is posting a new topic or editing a post) +* @var bool refresh Whether or not to retain previously submitted data +* @var string mode What action to take if the form has been submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var array error Any error strings; a non-empty array aborts +* form submission. +* NOTE: Should be actual language strings, NOT +* language keys. +* @since 3.1.0-a1 +* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist +* @changed 3.2.4-RC1 Remove unused 'lastclick' var +*/ +$vars = array( + 'post_id', + 'topic_id', + 'forum_id', + 'draft_id', + 'submit', + 'preview', + 'save', + 'load', + 'cancel', + 'refresh', + 'mode', + 'error', +); +extract($phpbb_dispatcher->trigger_event('core.modify_posting_parameters', compact($vars))); + +// Was cancel pressed? If so then redirect to the appropriate page +if ($cancel) +{ + $f = ($forum_id) ? 'f=' . $forum_id . '&' : ''; + $redirect = ($post_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 'p=' . $post_id) . '#p' . $post_id : (($topic_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $f . 't=' . $topic_id) : (($forum_id) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}index.$phpEx"))); + redirect($redirect); +} + +if (in_array($mode, array('post', 'reply', 'quote', 'edit', 'delete')) && !$forum_id) +{ + trigger_error('NO_FORUM'); +} + +/* @var $phpbb_content_visibility \phpbb\content_visibility */ +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +// We need to know some basic information in all cases before we do anything. +switch ($mode) +{ + case 'post': + $sql = 'SELECT * + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + break; + + case 'bump': + case 'reply': + if (!$topic_id) + { + trigger_error('NO_TOPIC'); + } + + // Force forum id + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $f_id = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + $forum_id = (!$f_id) ? $forum_id : $f_id; + + $sql = 'SELECT f.*, t.* + FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f + WHERE t.topic_id = $topic_id + AND f.forum_id = t.forum_id + AND " . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'); + break; + + case 'quote': + case 'edit': + case 'delete': + case 'soft_delete': + if (!$post_id) + { + $user->setup('posting'); + trigger_error('NO_POST'); + } + + // Force forum id + $sql = 'SELECT forum_id + FROM ' . POSTS_TABLE . ' + WHERE post_id = ' . $post_id; + $result = $db->sql_query($sql); + $f_id = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + $forum_id = (!$f_id) ? $forum_id : $f_id; + + $sql = 'SELECT f.*, t.*, p.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_sig_bbcode_bitfield + FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . ' f, ' . USERS_TABLE . " u + WHERE p.post_id = $post_id + AND t.topic_id = p.topic_id + AND u.user_id = p.poster_id + AND f.forum_id = t.forum_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.'); + break; + + case 'smilies': + $sql = ''; + generate_smilies('window', $forum_id); + break; + + case 'popup': + if ($forum_id) + { + $sql = 'SELECT forum_style + FROM ' . FORUMS_TABLE . ' + WHERE forum_id = ' . $forum_id; + } + else + { + phpbb_upload_popup(); + return; + } + break; + + default: + $sql = ''; + break; +} + +if (!$sql) +{ + $user->setup('posting'); + trigger_error('NO_POST_MODE'); +} + +$result = $db->sql_query($sql); +$post_data = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +if (!$post_data) +{ + if (!($mode == 'post' || $mode == 'bump' || $mode == 'reply')) + { + $user->setup('posting'); + } + trigger_error(($mode == 'post' || $mode == 'bump' || $mode == 'reply') ? 'NO_TOPIC' : 'NO_POST'); +} + +// Not able to reply to unapproved posts/topics +// TODO: add more descriptive language key +if ($auth->acl_get('m_approve', $forum_id) && ((($mode == 'reply' || $mode == 'bump') && $post_data['topic_visibility'] != ITEM_APPROVED) || ($mode == 'quote' && $post_data['post_visibility'] != ITEM_APPROVED))) +{ + trigger_error(($mode == 'reply' || $mode == 'bump') ? 'TOPIC_UNAPPROVED' : 'POST_UNAPPROVED'); +} + +if ($mode == 'popup') +{ + phpbb_upload_popup($post_data['forum_style']); + return; +} + +$user->setup(array('posting', 'mcp', 'viewtopic'), $post_data['forum_style']); + +if ($config['enable_post_confirm'] && !$user->data['is_registered']) +{ + $captcha = $phpbb_container->get('captcha.factory')->get_instance($config['captcha_plugin']); + $captcha->init(CONFIRM_POST); +} + +// Use post_row values in favor of submitted ones... +$forum_id = (!empty($post_data['forum_id'])) ? (int) $post_data['forum_id'] : (int) $forum_id; +$topic_id = (!empty($post_data['topic_id'])) ? (int) $post_data['topic_id'] : (int) $topic_id; +$post_id = (!empty($post_data['post_id'])) ? (int) $post_data['post_id'] : (int) $post_id; + +// Need to login to passworded forum first? +if ($post_data['forum_password']) +{ + login_forum_box(array( + 'forum_id' => $forum_id, + 'forum_name' => $post_data['forum_name'], + 'forum_password' => $post_data['forum_password']) + ); +} + +// Check permissions +if ($user->data['is_bot']) +{ + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); +} + +// Is the user able to read within this forum? +if (!$auth->acl_get('f_read', $forum_id)) +{ + if ($user->data['user_id'] != ANONYMOUS) + { + trigger_error('USER_CANNOT_READ'); + } + $message = $user->lang['LOGIN_EXPLAIN_POST']; + + if ($request->is_ajax()) + { + $json = new phpbb\json_response(); + $json->send(array( + 'title' => $user->lang['INFORMATION'], + 'message' => $message, + )); + } + + login_box('', $message); +} + +// Permission to do the action asked? +$is_authed = false; + +switch ($mode) +{ + case 'post': + if ($auth->acl_get('f_post', $forum_id)) + { + $is_authed = true; + } + break; + + case 'bump': + if ($auth->acl_get('f_bump', $forum_id)) + { + $is_authed = true; + } + break; + + case 'quote': + + $post_data['post_edit_locked'] = 0; + + // no break; + + case 'reply': + if ($auth->acl_get('f_reply', $forum_id)) + { + $is_authed = true; + } + break; + + case 'edit': + if ($user->data['is_registered'] && $auth->acl_gets('f_edit', 'm_edit', $forum_id)) + { + $is_authed = true; + } + break; + + case 'delete': + if ($user->data['is_registered'] && ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)))) + { + $is_authed = true; + } + + // no break; + + case 'soft_delete': + if (!$is_authed && $user->data['is_registered'] && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked'])) + { + // Fall back to soft_delete if we have no permissions to delete posts but to soft delete them + $is_authed = true; + $mode = 'soft_delete'; + } + break; +} +/** +* This event allows you to do extra auth checks and verify if the user +* has the required permissions +* +* Extensions should only change the error and is_authed variables. +* +* @event core.modify_posting_auth +* @var int post_id ID of the post +* @var int topic_id ID of the topic +* @var int forum_id ID of the forum +* @var int draft_id ID of the draft +* @var bool submit Whether or not the form has been submitted +* @var bool preview Whether or not the post is being previewed +* @var bool save Whether or not a draft is being saved +* @var bool load Whether or not a draft is being loaded +* @var bool refresh Whether or not to retain previously submitted data +* @var string mode What action to take if the form has been submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var array error Any error strings; a non-empty array aborts +* form submission. +* NOTE: Should be actual language strings, NOT +* language keys. +* @var bool is_authed Does the user have the required permissions? +* @var array post_data All post data from database +* @since 3.1.3-RC1 +* @changed 3.1.10-RC1 Added post_data +* @changed 3.2.4-RC1 Remove unused 'lastclick' var +*/ +$vars = array( + 'post_id', + 'topic_id', + 'forum_id', + 'draft_id', + 'submit', + 'preview', + 'save', + 'load', + 'refresh', + 'mode', + 'error', + 'is_authed', + 'post_data', +); +extract($phpbb_dispatcher->trigger_event('core.modify_posting_auth', compact($vars))); + +if (!$is_authed || !empty($error)) +{ + $check_auth = ($mode == 'quote') ? 'reply' : (($mode == 'soft_delete') ? 'delete' : $mode); + + if ($user->data['is_registered']) + { + trigger_error(empty($error) ? 'USER_CANNOT_' . strtoupper($check_auth) : implode('
', $error)); + } + $message = $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)]; + + if ($request->is_ajax()) + { + $json = new phpbb\json_response(); + $json->send(array( + 'title' => $user->lang['INFORMATION'], + 'message' => $message, + )); + } + + login_box('', $message); +} + +// Is the user able to post within this forum? +if ($post_data['forum_type'] != FORUM_POST && in_array($mode, array('post', 'bump', 'quote', 'reply'))) +{ + trigger_error('USER_CANNOT_FORUM_POST'); +} + +// Forum/Topic locked? +if (($post_data['forum_status'] == ITEM_LOCKED || (isset($post_data['topic_status']) && $post_data['topic_status'] == ITEM_LOCKED)) && !$auth->acl_get('m_edit', $forum_id)) +{ + trigger_error(($post_data['forum_status'] == ITEM_LOCKED) ? 'FORUM_LOCKED' : 'TOPIC_LOCKED'); +} + +// Can we edit this post ... if we're a moderator with rights then always yes +// else it depends on editing times, lock status and if we're the correct user +if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id)) +{ + $force_edit_allowed = false; + + $s_cannot_edit = $user->data['user_id'] != $post_data['poster_id']; + $s_cannot_edit_time = $config['edit_time'] && $post_data['post_time'] <= time() - ($config['edit_time'] * 60); + $s_cannot_edit_locked = $post_data['post_edit_locked']; + + /** + * This event allows you to modify the conditions for the "cannot edit post" checks + * + * @event core.posting_modify_cannot_edit_conditions + * @var array post_data Array with post data + * @var bool force_edit_allowed Allow the user to edit the post (all permissions and conditions are ignored) + * @var bool s_cannot_edit User can not edit the post because it's not his + * @var bool s_cannot_edit_locked User can not edit the post because it's locked + * @var bool s_cannot_edit_time User can not edit the post because edit_time has passed + * @since 3.1.0-b4 + */ + $vars = array( + 'post_data', + 'force_edit_allowed', + 's_cannot_edit', + 's_cannot_edit_locked', + 's_cannot_edit_time', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_cannot_edit_conditions', compact($vars))); + + if (!$force_edit_allowed) + { + if ($s_cannot_edit) + { + trigger_error('USER_CANNOT_EDIT'); + } + else if ($s_cannot_edit_time) + { + trigger_error('CANNOT_EDIT_TIME'); + } + else if ($s_cannot_edit_locked) + { + trigger_error('CANNOT_EDIT_POST_LOCKED'); + } + } +} + +// Handle delete mode... +if ($mode == 'delete' || $mode == 'soft_delete') +{ + if ($mode == 'soft_delete' && $post_data['post_visibility'] == ITEM_DELETED) + { + $user->setup('posting'); + trigger_error('NO_POST'); + } + + $delete_reason = $request->variable('delete_reason', '', true); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete' && !$request->is_set_post('delete_permanent')), $delete_reason); + return; +} + +// Handle bump mode... +if ($mode == 'bump') +{ + if ($bump_time = bump_topic_allowed($forum_id, $post_data['topic_bumped'], $post_data['topic_last_post_time'], $post_data['topic_poster'], $post_data['topic_last_poster_id']) + && check_link_hash($request->variable('hash', ''), "topic_{$post_data['topic_id']}")) + { + $meta_url = phpbb_bump_topic($forum_id, $topic_id, $post_data, $current_time); + meta_refresh(3, $meta_url); + $message = $user->lang['TOPIC_BUMPED']; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('VIEW_MESSAGE', '', ''); + $message .= '

' . $user->lang('RETURN_FORUM', '', ''); + } + + trigger_error($message); + } + + trigger_error('BUMP_ERROR'); +} + +// Subject length limiting to 60 characters if first post... +if ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_data['post_id'])) +{ + $template->assign_var('S_NEW_MESSAGE', true); +} + +// Determine some vars +if (isset($post_data['poster_id']) && $post_data['poster_id'] == ANONYMOUS) +{ + $post_data['quote_username'] = (!empty($post_data['post_username'])) ? $post_data['post_username'] : $user->lang['GUEST']; +} +else +{ + $post_data['quote_username'] = isset($post_data['username']) ? $post_data['username'] : ''; +} + +$post_data['post_edit_locked'] = (isset($post_data['post_edit_locked'])) ? (int) $post_data['post_edit_locked'] : 0; +$post_data['post_subject_md5'] = (isset($post_data['post_subject']) && $mode == 'edit') ? md5($post_data['post_subject']) : ''; +$post_data['post_subject'] = (in_array($mode, array('quote', 'edit'))) ? $post_data['post_subject'] : ((isset($post_data['topic_title'])) ? $post_data['topic_title'] : ''); +$post_data['topic_time_limit'] = (isset($post_data['topic_time_limit'])) ? (($post_data['topic_time_limit']) ? (int) $post_data['topic_time_limit'] / 86400 : (int) $post_data['topic_time_limit']) : 0; +$post_data['poll_length'] = (!empty($post_data['poll_length'])) ? (int) $post_data['poll_length'] / 86400 : 0; +$post_data['poll_start'] = (!empty($post_data['poll_start'])) ? (int) $post_data['poll_start'] : 0; +$post_data['icon_id'] = (!isset($post_data['icon_id']) || in_array($mode, array('quote', 'reply'))) ? 0 : (int) $post_data['icon_id']; +$post_data['poll_options'] = array(); + +// Get Poll Data +if ($post_data['poll_start']) +{ + $sql = 'SELECT poll_option_text + FROM ' . POLL_OPTIONS_TABLE . " + WHERE topic_id = $topic_id + ORDER BY poll_option_id"; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $post_data['poll_options'][] = trim($row['poll_option_text']); + } + $db->sql_freeresult($result); +} + +/** +* This event allows you to modify the post data before parsing +* +* @event core.posting_modify_post_data +* @var int forum_id ID of the forum +* @var string mode What action to take if the form has been submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var array post_data Array with post data +* @var int post_id ID of the post +* @var int topic_id ID of the topic +* @since 3.2.2-RC1 +*/ +$vars = array( + 'forum_id', + 'mode', + 'post_data', + 'post_id', + 'topic_id', +); +extract($phpbb_dispatcher->trigger_event('core.posting_modify_post_data', compact($vars))); + +if ($mode == 'edit') +{ + $original_poll_data = array( + 'poll_title' => $post_data['poll_title'], + 'poll_length' => $post_data['poll_length'], + 'poll_max_options' => $post_data['poll_max_options'], + 'poll_option_text' => implode("\n", $post_data['poll_options']), + 'poll_start' => $post_data['poll_start'], + 'poll_last_vote' => $post_data['poll_last_vote'], + 'poll_vote_change' => $post_data['poll_vote_change'], + ); +} + +$orig_poll_options_size = count($post_data['poll_options']); + +$message_parser = new parse_message(); +/* @var $plupload \phpbb\plupload\plupload */ +$plupload = $phpbb_container->get('plupload'); + +/* @var $mimetype_guesser \phpbb\mimetype\guesser */ +$mimetype_guesser = $phpbb_container->get('mimetype.guesser'); +$message_parser->set_plupload($plupload); + +if (isset($post_data['post_text'])) +{ + $message_parser->message = &$post_data['post_text']; + unset($post_data['post_text']); +} + +// Set some default variables +$uninit = array('post_attachment' => 0, 'poster_id' => $user->data['user_id'], 'enable_magic_url' => 0, 'topic_status' => 0, 'topic_type' => POST_NORMAL, 'post_subject' => '', 'topic_title' => '', 'post_time' => 0, 'post_edit_reason' => '', 'notify_set' => 0); + +/** +* This event allows you to modify the default variables for post_data, and unset them in post_data if needed +* +* @event core.posting_modify_default_variables +* @var array post_data Array with post data +* @var array uninit Array with default vars to put into post_data, if they aren't there +* @since 3.2.5-RC1 +*/ +$vars = array( + 'post_data', + 'uninit', +); +extract($phpbb_dispatcher->trigger_event('core.posting_modify_default_variables', compact($vars))); + +foreach ($uninit as $var_name => $default_value) +{ + if (!isset($post_data[$var_name])) + { + $post_data[$var_name] = $default_value; + } +} +unset($uninit); + +// Always check if the submitted attachment data is valid and belongs to the user. +// Further down (especially in submit_post()) we do not check this again. +$message_parser->get_submitted_attachment_data($post_data['poster_id']); + +if ($post_data['post_attachment'] && !$submit && !$refresh && !$preview && $mode == 'edit') +{ + // Do not change to SELECT * + $sql = 'SELECT attach_id, is_orphan, attach_comment, real_filename, filesize + FROM ' . ATTACHMENTS_TABLE . " + WHERE post_msg_id = $post_id + AND in_message = 0 + AND is_orphan = 0 + ORDER BY attach_id DESC"; + $result = $db->sql_query($sql); + $message_parser->attachment_data = array_merge($message_parser->attachment_data, $db->sql_fetchrowset($result)); + $db->sql_freeresult($result); +} + +if ($post_data['poster_id'] == ANONYMOUS) +{ + $post_data['username'] = ($mode == 'quote' || $mode == 'edit') ? trim($post_data['post_username']) : ''; +} +else +{ + $post_data['username'] = ($mode == 'quote' || $mode == 'edit') ? trim($post_data['username']) : ''; +} + +$post_data['enable_urls'] = $post_data['enable_magic_url']; + +if ($mode != 'edit') +{ + $post_data['enable_sig'] = ($config['allow_sig'] && $user->optionget('attachsig')) ? true: false; + $post_data['enable_smilies'] = ($config['allow_smilies'] && $user->optionget('smilies')) ? true : false; + $post_data['enable_bbcode'] = ($config['allow_bbcode'] && $user->optionget('bbcode')) ? true : false; + $post_data['enable_urls'] = true; +} + +if ($mode == 'post') +{ + $post_data['topic_status'] = ($request->is_set_post('lock_topic') && $auth->acl_gets('m_lock', 'f_user_lock', $forum_id)) ? ITEM_LOCKED : ITEM_UNLOCKED; +} + +$post_data['enable_magic_url'] = $post_data['drafts'] = false; + +// User own some drafts? +if ($user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) +{ + $sql = 'SELECT draft_id + FROM ' . DRAFTS_TABLE . ' + WHERE user_id = ' . $user->data['user_id'] . + (($forum_id) ? ' AND forum_id = ' . (int) $forum_id : '') . + (($topic_id) ? ' AND topic_id = ' . (int) $topic_id : '') . + (($draft_id) ? " AND draft_id <> $draft_id" : ''); + $result = $db->sql_query_limit($sql, 1); + + if ($db->sql_fetchrow($result)) + { + $post_data['drafts'] = true; + } + $db->sql_freeresult($result); +} + +$check_value = (($post_data['enable_bbcode']+1) << 8) + (($post_data['enable_smilies']+1) << 4) + (($post_data['enable_urls']+1) << 2) + (($post_data['enable_sig']+1) << 1); + +// Check if user is watching this topic +if ($mode != 'post' && $config['allow_topic_notify'] && $user->data['is_registered']) +{ + $sql = 'SELECT topic_id + FROM ' . TOPICS_WATCH_TABLE . ' + WHERE topic_id = ' . $topic_id . ' + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + $post_data['notify_set'] = (int) $db->sql_fetchfield('topic_id'); + $db->sql_freeresult($result); +} + +// Do we want to edit our post ? +if ($mode == 'edit' && $post_data['bbcode_uid']) +{ + $message_parser->bbcode_uid = $post_data['bbcode_uid']; +} + +// HTML, BBCode, Smilies, Images and Flash status +$bbcode_status = ($config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id)) ? true : false; +$smilies_status = ($config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id)) ? true : false; +$img_status = ($bbcode_status && $auth->acl_get('f_img', $forum_id)) ? true : false; +$url_status = ($config['allow_post_links']) ? true : false; +$flash_status = ($bbcode_status && $auth->acl_get('f_flash', $forum_id) && $config['allow_post_flash']) ? true : false; +$quote_status = true; + +// Save Draft +if ($save && $user->data['is_registered'] && $auth->acl_get('u_savedrafts') && ($mode == 'reply' || $mode == 'post' || $mode == 'quote')) +{ + $subject = $request->variable('subject', '', true); + $subject = (!$subject && $mode != 'post') ? $post_data['topic_title'] : $subject; + $message = $request->variable('message', '', true); + + if ($subject && $message) + { + if (confirm_box(true)) + { + $message_parser->message = $message; + $message_parser->parse($post_data['enable_bbcode'], ($config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']); + + $sql = 'INSERT INTO ' . DRAFTS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'user_id' => (int) $user->data['user_id'], + 'topic_id' => (int) $topic_id, + 'forum_id' => (int) $forum_id, + 'save_time' => (int) $current_time, + 'draft_subject' => (string) $subject, + 'draft_message' => (string) $message_parser->message) + ); + $db->sql_query($sql); + + $meta_info = ($mode == 'post') ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id) : append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id"); + + meta_refresh(3, $meta_info); + + $message = $user->lang['DRAFT_SAVED'] . '

'; + $message .= ($mode != 'post') ? sprintf($user->lang['RETURN_TOPIC'], '', '') . '

' : ''; + $message .= sprintf($user->lang['RETURN_FORUM'], '', ''); + + trigger_error($message); + } + else + { + $s_hidden_fields = build_hidden_fields(array( + 'mode' => $mode, + 'save' => true, + 'f' => $forum_id, + 't' => $topic_id, + 'subject' => $subject, + 'message' => $message, + 'attachment_data' => $message_parser->attachment_data, + ) + ); + + $hidden_fields = array( + 'icon_id' => 0, + + 'disable_bbcode' => false, + 'disable_smilies' => false, + 'disable_magic_url' => false, + 'attach_sig' => true, + 'lock_topic' => false, + + 'topic_type' => POST_NORMAL, + 'topic_time_limit' => 0, + + 'poll_title' => '', + 'poll_option_text' => '', + 'poll_max_options' => 1, + 'poll_length' => 0, + 'poll_vote_change' => false, + ); + + foreach ($hidden_fields as $name => $default) + { + if (!isset($_POST[$name])) + { + // Don't include it, if its not available + unset($hidden_fields[$name]); + continue; + } + + if (is_bool($default)) + { + // Use the string representation + $hidden_fields[$name] = $request->variable($name, ''); + } + else + { + $hidden_fields[$name] = $request->variable($name, $default); + } + } + + $s_hidden_fields .= build_hidden_fields($hidden_fields); + + confirm_box(false, 'SAVE_DRAFT', $s_hidden_fields); + } + } + else + { + if (utf8_clean_string($subject) === '') + { + $error[] = $user->lang['EMPTY_SUBJECT']; + } + + if (utf8_clean_string($message) === '') + { + $error[] = $user->lang['TOO_FEW_CHARS']; + } + } + unset($subject, $message); +} + +// Load requested Draft +if ($draft_id && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $user->data['is_registered'] && $auth->acl_get('u_savedrafts')) +{ + $sql = 'SELECT draft_subject, draft_message + FROM ' . DRAFTS_TABLE . " + WHERE draft_id = $draft_id + AND user_id = " . $user->data['user_id']; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if ($row) + { + $post_data['post_subject'] = $row['draft_subject']; + $message_parser->message = $row['draft_message']; + + $template->assign_var('S_DRAFT_LOADED', true); + } + else + { + $draft_id = 0; + } +} + +// Load draft overview +if ($load && ($mode == 'reply' || $mode == 'quote' || $mode == 'post') && $post_data['drafts']) +{ + load_drafts($topic_id, $forum_id); +} + +/** @var \phpbb\textformatter\utils_interface $bbcode_utils */ +$bbcode_utils = $phpbb_container->get('text_formatter.utils'); + +if ($submit || $preview || $refresh) +{ + $post_data['topic_cur_post_id'] = $request->variable('topic_cur_post_id', 0); + $post_data['post_subject'] = $request->variable('subject', '', true); + $message_parser->message = $request->variable('message', '', true); + + $post_data['username'] = $request->variable('username', $post_data['username'], true); + $post_data['post_edit_reason'] = ($request->variable('edit_reason', false, false, \phpbb\request\request_interface::POST) && $mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? $request->variable('edit_reason', '', true) : ''; + + $post_data['orig_topic_type'] = $post_data['topic_type']; + $post_data['topic_type'] = $request->variable('topic_type', (($mode != 'post') ? (int) $post_data['topic_type'] : POST_NORMAL)); + $post_data['topic_time_limit'] = $request->variable('topic_time_limit', (($mode != 'post') ? (int) $post_data['topic_time_limit'] : 0)); + + if ($post_data['enable_icons'] && $auth->acl_get('f_icons', $forum_id)) + { + $post_data['icon_id'] = $request->variable('icon', (int) $post_data['icon_id']); + } + + $post_data['enable_bbcode'] = (!$bbcode_status || isset($_POST['disable_bbcode'])) ? false : true; + $post_data['enable_smilies'] = (!$smilies_status || isset($_POST['disable_smilies'])) ? false : true; + $post_data['enable_urls'] = (isset($_POST['disable_magic_url'])) ? 0 : 1; + $post_data['enable_sig'] = (!$config['allow_sig'] || !$auth->acl_get('f_sigs', $forum_id) || !$auth->acl_get('u_sig')) ? false : ((isset($_POST['attach_sig']) && $user->data['is_registered']) ? true : false); + + if ($config['allow_topic_notify'] && $user->data['is_registered']) + { + $notify = (isset($_POST['notify'])) ? true : false; + } + else + { + $notify = false; + } + + $topic_lock = (isset($_POST['lock_topic'])) ? true : false; + $post_lock = (isset($_POST['lock_post'])) ? true : false; + $poll_delete = (isset($_POST['poll_delete'])) ? true : false; + + if ($submit) + { + $status_switch = (($post_data['enable_bbcode']+1) << 8) + (($post_data['enable_smilies']+1) << 4) + (($post_data['enable_urls']+1) << 2) + (($post_data['enable_sig']+1) << 1); + $status_switch = ($status_switch != $check_value); + } + else + { + $status_switch = 1; + } + + // Delete Poll + if ($poll_delete && $mode == 'edit' && count($post_data['poll_options']) && + ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))) + { + if ($submit && check_form_key('posting')) + { + $sql = 'DELETE FROM ' . POLL_OPTIONS_TABLE . " + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + + $sql = 'DELETE FROM ' . POLL_VOTES_TABLE . " + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + + $topic_sql = array( + 'poll_title' => '', + 'poll_start' => 0, + 'poll_length' => 0, + 'poll_last_vote' => 0, + 'poll_max_options' => 0, + 'poll_vote_change' => 0 + ); + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET ' . $db->sql_build_array('UPDATE', $topic_sql) . " + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + } + + $post_data['poll_title'] = $post_data['poll_option_text'] = ''; + $post_data['poll_vote_change'] = $post_data['poll_max_options'] = $post_data['poll_length'] = 0; + } + else + { + $post_data['poll_title'] = $request->variable('poll_title', '', true); + $post_data['poll_length'] = $request->variable('poll_length', 0); + $post_data['poll_option_text'] = $request->variable('poll_option_text', '', true); + $post_data['poll_max_options'] = $request->variable('poll_max_options', 1); + $post_data['poll_vote_change'] = ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id) && isset($_POST['poll_vote_change'])) ? 1 : 0; + } + + // If replying/quoting and last post id has changed + // give user option to continue submit or return to post + // notify and show user the post made between his request and the final submit + if (($mode == 'reply' || $mode == 'quote') && $post_data['topic_cur_post_id'] && $post_data['topic_cur_post_id'] != $post_data['topic_last_post_id']) + { + // Only do so if it is allowed forum-wide + if ($post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) + { + if (topic_review($topic_id, $forum_id, 'post_review', $post_data['topic_cur_post_id'])) + { + $template->assign_var('S_POST_REVIEW', true); + } + + $submit = false; + $refresh = true; + } + } + + // Parse Attachments - before checksum is calculated + $message_parser->parse_attachments('fileupload', $mode, $forum_id, $submit, $preview, $refresh); + + /** + * This event allows you to modify message text before parsing + * + * @event core.posting_modify_message_text + * @var array post_data Array with post data + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete|bump|smilies|popup + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var bool submit Whether or not the form has been submitted + * @var bool preview Whether or not the post is being previewed + * @var bool save Whether or not a draft is being saved + * @var bool load Whether or not a draft is being loaded + * @var bool cancel Whether or not to cancel the form (returns to + * viewtopic or viewforum depending on if the user + * is posting a new topic or editing a post) + * @var bool refresh Whether or not to retain previously submitted data + * @var object message_parser The message parser object + * @var array error Array of errors + * @since 3.1.2-RC1 + * @changed 3.1.11-RC1 Added error + */ + $vars = array( + 'post_data', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'submit', + 'preview', + 'save', + 'load', + 'cancel', + 'refresh', + 'message_parser', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_message_text', compact($vars))); + + // Grab md5 'checksum' of new message + $message_md5 = md5($message_parser->message); + + // If editing and checksum has changed we know the post was edited while we're editing + // Notify and show user the changed post + if ($mode == 'edit' && $post_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) + { + $edit_post_message_checksum = $request->variable('edit_post_message_checksum', ''); + $edit_post_subject_checksum = $request->variable('edit_post_subject_checksum', ''); + + // $post_data['post_checksum'] is the checksum of the post submitted in the meantime + // $message_md5 is the checksum of the post we're about to submit + // $edit_post_message_checksum is the checksum of the post we're editing + // ... + + // We make sure nobody else made exactly the same change + // we're about to submit by also checking $message_md5 != $post_data['post_checksum'] + if ($edit_post_message_checksum !== '' && + $edit_post_message_checksum != $post_data['post_checksum'] && + $message_md5 != $post_data['post_checksum'] + || + $edit_post_subject_checksum !== '' && + $edit_post_subject_checksum != $post_data['post_subject_md5'] && + md5($post_data['post_subject']) != $post_data['post_subject_md5']) + { + if (topic_review($topic_id, $forum_id, 'post_review_edit', $post_id)) + { + $template->assign_vars(array( + 'S_POST_REVIEW' => true, + + 'L_POST_REVIEW' => $user->lang['POST_REVIEW_EDIT'], + 'L_POST_REVIEW_EXPLAIN' => $user->lang['POST_REVIEW_EDIT_EXPLAIN'], + )); + } + + $submit = false; + $refresh = true; + } + } + + // Check checksum ... don't re-parse message if the same + $update_message = ($mode != 'edit' || $message_md5 != $post_data['post_checksum'] || $status_switch || strlen($post_data['bbcode_uid']) < BBCODE_UID_LEN) ? true : false; + + // Also check if subject got updated... + $update_subject = $mode != 'edit' || ($post_data['post_subject_md5'] && $post_data['post_subject_md5'] != md5($post_data['post_subject'])); + + // Parse message + if ($update_message) + { + if (count($message_parser->warn_msg)) + { + $error[] = implode('
', $message_parser->warn_msg); + $message_parser->warn_msg = array(); + } + + if (!$preview || !empty($message_parser->message)) + { + $message_parser->parse($post_data['enable_bbcode'], ($config['allow_post_links']) ? $post_data['enable_urls'] : false, $post_data['enable_smilies'], $img_status, $flash_status, $quote_status, $config['allow_post_links']); + } + + // On a refresh we do not care about message parsing errors + if (count($message_parser->warn_msg) && $refresh && !$preview) + { + $message_parser->warn_msg = array(); + } + } + else + { + $message_parser->bbcode_bitfield = $post_data['bbcode_bitfield']; + } + + $ignore_flood = $auth->acl_get('u_ignoreflood') ? true : $auth->acl_get('f_ignoreflood', $forum_id); + if ($mode != 'edit' && !$preview && !$refresh && $config['flood_interval'] && !$ignore_flood) + { + // Flood check + $last_post_time = 0; + + if ($user->data['is_registered']) + { + $last_post_time = $user->data['user_lastpost_time']; + } + else + { + $sql = 'SELECT post_time AS last_post_time + FROM ' . POSTS_TABLE . " + WHERE poster_ip = '" . $user->ip . "' + AND post_time > " . ($current_time - $config['flood_interval']); + $result = $db->sql_query_limit($sql, 1); + if ($row = $db->sql_fetchrow($result)) + { + $last_post_time = $row['last_post_time']; + } + $db->sql_freeresult($result); + } + + if ($last_post_time && ($current_time - $last_post_time) < intval($config['flood_interval'])) + { + $error[] = $user->lang['FLOOD_ERROR']; + } + } + + // Validate username + if (($post_data['username'] && !$user->data['is_registered']) || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS && $post_data['username'] && $post_data['post_username'] && $post_data['post_username'] != $post_data['username'])) + { + if (!function_exists('validate_username')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $user->add_lang('ucp'); + + if (($result = validate_username($post_data['username'], (!empty($post_data['post_username'])) ? $post_data['post_username'] : '')) !== false) + { + $error[] = $user->lang[$result . '_USERNAME']; + } + + if (($result = validate_string($post_data['username'], false, $config['min_name_chars'], $config['max_name_chars'])) !== false) + { + $min_max_amount = ($result == 'TOO_SHORT') ? $config['min_name_chars'] : $config['max_name_chars']; + $error[] = $user->lang('FIELD_' . $result, $min_max_amount, $user->lang['USERNAME']); + } + } + + if ($config['enable_post_confirm'] && !$user->data['is_registered'] && in_array($mode, array('quote', 'post', 'reply'))) + { + $captcha_data = array( + 'message' => $request->variable('message', '', true), + 'subject' => $request->variable('subject', '', true), + 'username' => $request->variable('username', '', true), + ); + $vc_response = $captcha->validate($captcha_data); + if ($vc_response) + { + $error[] = $vc_response; + } + } + + // check form + if (($submit || $preview) && !check_form_key('posting')) + { + $error[] = $user->lang['FORM_INVALID']; + } + + if ($submit && $mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED && !isset($_POST['soft_delete']) && $auth->acl_get('m_approve', $forum_id)) + { + $is_first_post = ($post_id == $post_data['topic_first_post_id'] || !$post_data['topic_posts_approved']); + $is_last_post = ($post_id == $post_data['topic_last_post_id'] || !$post_data['topic_posts_approved']); + $updated_post_data = $phpbb_content_visibility->set_post_visibility(ITEM_APPROVED, $post_id, $post_data['topic_id'], $post_data['forum_id'], $user->data['user_id'], time(), '', $is_first_post, $is_last_post); + + if (!empty($updated_post_data)) + { + // Update the post_data, so we don't need to refetch it. + $post_data = array_merge($post_data, $updated_post_data); + } + } + + // Parse subject + if (!$preview && !$refresh && utf8_clean_string($post_data['post_subject']) === '' && ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id))) + { + $error[] = $user->lang['EMPTY_SUBJECT']; + } + + // Check for out-of-bounds characters that are currently + // not supported by utf8_bin in MySQL + if (preg_match_all('/[\x{10000}-\x{10FFFF}]/u', $post_data['post_subject'], $matches)) + { + $character_list = implode('
', $matches[0]); + $error[] = $user->lang('UNSUPPORTED_CHARACTERS_SUBJECT', $character_list); + } + + $post_data['poll_last_vote'] = (isset($post_data['poll_last_vote'])) ? $post_data['poll_last_vote'] : 0; + + if ($post_data['poll_option_text'] && + ($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/)) + && $auth->acl_get('f_poll', $forum_id)) + { + $poll = array( + 'poll_title' => $post_data['poll_title'], + 'poll_length' => $post_data['poll_length'], + 'poll_max_options' => $post_data['poll_max_options'], + 'poll_option_text' => $post_data['poll_option_text'], + 'poll_start' => $post_data['poll_start'], + 'poll_last_vote' => $post_data['poll_last_vote'], + 'poll_vote_change' => $post_data['poll_vote_change'], + 'enable_bbcode' => $post_data['enable_bbcode'], + 'enable_urls' => $post_data['enable_urls'], + 'enable_smilies' => $post_data['enable_smilies'], + 'img_status' => $img_status + ); + + $message_parser->parse_poll($poll); + + $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : array(); + $post_data['poll_title'] = (isset($poll['poll_title'])) ? $poll['poll_title'] : ''; + + /* We reset votes, therefore also allow removing options + if ($post_data['poll_last_vote'] && ($poll['poll_options_size'] < $orig_poll_options_size)) + { + $message_parser->warn_msg[] = $user->lang['NO_DELETE_POLL_OPTIONS']; + }*/ + } + else if ($mode == 'edit' && $post_id == $post_data['topic_first_post_id'] && $auth->acl_get('f_poll', $forum_id)) + { + // The user removed all poll options, this is equal to deleting the poll. + $poll = array( + 'poll_title' => '', + 'poll_length' => 0, + 'poll_max_options' => 0, + 'poll_option_text' => '', + 'poll_start' => 0, + 'poll_last_vote' => 0, + 'poll_vote_change' => 0, + 'poll_options' => array(), + ); + + $post_data['poll_options'] = array(); + $post_data['poll_title'] = ''; + $post_data['poll_start'] = $post_data['poll_length'] = $post_data['poll_max_options'] = $post_data['poll_last_vote'] = $post_data['poll_vote_change'] = 0; + } + else if (!$auth->acl_get('f_poll', $forum_id) && ($mode == 'edit') && ($post_id == $post_data['topic_first_post_id']) && !$bbcode_utils->is_empty($original_poll_data['poll_title'])) + { + // We have a poll but the editing user is not permitted to create/edit it. + // So we just keep the original poll-data. + // Decode the poll title and options text fisrt. + $original_poll_data['poll_title'] = $bbcode_utils->unparse($original_poll_data['poll_title']); + $original_poll_data['poll_option_text'] = $bbcode_utils->unparse($original_poll_data['poll_option_text']); + $original_poll_data['poll_options'] = explode("\n", $original_poll_data['poll_option_text']); + + $poll = array_merge($original_poll_data, array( + 'enable_bbcode' => $post_data['enable_bbcode'], + 'enable_urls' => $post_data['enable_urls'], + 'enable_smilies' => $post_data['enable_smilies'], + 'img_status' => $img_status, + )); + + $message_parser->parse_poll($poll); + + $post_data['poll_options'] = (isset($poll['poll_options'])) ? $poll['poll_options'] : array(); + $post_data['poll_title'] = (isset($poll['poll_title'])) ? $poll['poll_title'] : ''; + } + else + { + $poll = array(); + } + + // Check topic type + if ($post_data['topic_type'] != POST_NORMAL && ($mode == 'post' || ($mode == 'edit' && $post_data['topic_first_post_id'] == $post_id))) + { + switch ($post_data['topic_type']) + { + case POST_GLOBAL: + $auth_option = 'f_announce_global'; + break; + + case POST_ANNOUNCE: + $auth_option = 'f_announce'; + break; + + case POST_STICKY: + $auth_option = 'f_sticky'; + break; + + default: + $auth_option = ''; + break; + } + + if ($auth_option != '' && !$auth->acl_get($auth_option, $forum_id)) + { + // There is a special case where a user edits his post whereby the topic type got changed by an admin/mod. + // Another case would be a mod not having sticky permissions for example but edit permissions. + if ($mode == 'edit') + { + // To prevent non-authed users messing around with the topic type we reset it to the original one. + $post_data['topic_type'] = $post_data['orig_topic_type']; + } + else + { + $error[] = $user->lang['CANNOT_POST_' . str_replace('F_', '', strtoupper($auth_option))]; + } + } + } + + if (count($message_parser->warn_msg)) + { + $error[] = implode('
', $message_parser->warn_msg); + } + + // DNSBL check + if ($config['check_dnsbl'] && !$refresh) + { + if (($dnsbl = $user->check_dnsbl('post')) !== false) + { + $error[] = sprintf($user->lang['IP_BLACKLISTED'], $user->ip, $dnsbl[1]); + } + } + + /** + * This event allows you to define errors before the post action is performed + * + * @event core.posting_modify_submission_errors + * @var array post_data Array with post data + * @var array poll Array with poll data from post (must be used instead of the post_data equivalent) + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete|bump|smilies|popup + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var bool submit Whether or not the form has been submitted + * @var array error Any error strings; a non-empty array aborts form submission. + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + * @changed 3.1.5-RC1 Added poll array to the event + * @changed 3.2.0-a1 Removed undefined page_title + */ + $vars = array( + 'post_data', + 'poll', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'submit', + 'error', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submission_errors', compact($vars))); + + // Store message, sync counters + if (!count($error) && $submit) + { + if ($submit) + { + // Lock/Unlock Topic + $change_topic_status = $post_data['topic_status']; + $perm_lock_unlock = ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED)) ? true : false; + + if ($post_data['topic_status'] == ITEM_LOCKED && !$topic_lock && $perm_lock_unlock) + { + $change_topic_status = ITEM_UNLOCKED; + } + else if ($post_data['topic_status'] == ITEM_UNLOCKED && $topic_lock && $perm_lock_unlock) + { + $change_topic_status = ITEM_LOCKED; + } + + if ($change_topic_status != $post_data['topic_status']) + { + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_status = $change_topic_status + WHERE topic_id = $topic_id + AND topic_moved_id = 0"; + $db->sql_query($sql); + + $user_lock = ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $post_data['topic_poster']) ? 'USER_' : ''; + + $phpbb_log->add('mod', $user->data['user_id'], $user->ip, 'LOG_' . $user_lock . (($change_topic_status == ITEM_LOCKED) ? 'LOCK' : 'UNLOCK'), false, array( + 'forum_id' => $forum_id, + 'topic_id' => $topic_id, + $post_data['topic_title'] + )); + } + + // Lock/Unlock Post Edit + if ($mode == 'edit' && $post_data['post_edit_locked'] == ITEM_LOCKED && !$post_lock && $auth->acl_get('m_edit', $forum_id)) + { + $post_data['post_edit_locked'] = ITEM_UNLOCKED; + } + else if ($mode == 'edit' && $post_data['post_edit_locked'] == ITEM_UNLOCKED && $post_lock && $auth->acl_get('m_edit', $forum_id)) + { + $post_data['post_edit_locked'] = ITEM_LOCKED; + } + + $data = array( + 'topic_title' => (empty($post_data['topic_title'])) ? $post_data['post_subject'] : $post_data['topic_title'], + 'topic_first_post_id' => (isset($post_data['topic_first_post_id'])) ? (int) $post_data['topic_first_post_id'] : 0, + 'topic_last_post_id' => (isset($post_data['topic_last_post_id'])) ? (int) $post_data['topic_last_post_id'] : 0, + 'topic_time_limit' => (int) $post_data['topic_time_limit'], + 'topic_attachment' => (isset($post_data['topic_attachment'])) ? (int) $post_data['topic_attachment'] : 0, + 'post_id' => (int) $post_id, + 'topic_id' => (int) $topic_id, + 'forum_id' => (int) $forum_id, + 'icon_id' => (int) $post_data['icon_id'], + 'poster_id' => (int) $post_data['poster_id'], + 'enable_sig' => (bool) $post_data['enable_sig'], + 'enable_bbcode' => (bool) $post_data['enable_bbcode'], + 'enable_smilies' => (bool) $post_data['enable_smilies'], + 'enable_urls' => (bool) $post_data['enable_urls'], + 'enable_indexing' => (bool) $post_data['enable_indexing'], + 'message_md5' => (string) $message_md5, + 'post_checksum' => (isset($post_data['post_checksum'])) ? (string) $post_data['post_checksum'] : '', + 'post_edit_reason' => $post_data['post_edit_reason'], + 'post_edit_user' => ($mode == 'edit') ? $user->data['user_id'] : ((isset($post_data['post_edit_user'])) ? (int) $post_data['post_edit_user'] : 0), + 'forum_parents' => $post_data['forum_parents'], + 'forum_name' => $post_data['forum_name'], + 'notify' => $notify, + 'notify_set' => $post_data['notify_set'], + 'poster_ip' => (isset($post_data['poster_ip'])) ? $post_data['poster_ip'] : $user->ip, + 'post_edit_locked' => (int) $post_data['post_edit_locked'], + 'bbcode_bitfield' => $message_parser->bbcode_bitfield, + 'bbcode_uid' => $message_parser->bbcode_uid, + 'message' => $message_parser->message, + 'attachment_data' => $message_parser->attachment_data, + 'filename_data' => $message_parser->filename_data, + 'topic_status' => $post_data['topic_status'], + + 'topic_visibility' => (isset($post_data['topic_visibility'])) ? $post_data['topic_visibility'] : false, + 'post_visibility' => (isset($post_data['post_visibility'])) ? $post_data['post_visibility'] : false, + ); + + if ($mode == 'edit') + { + $data['topic_posts_approved'] = $post_data['topic_posts_approved']; + $data['topic_posts_unapproved'] = $post_data['topic_posts_unapproved']; + $data['topic_posts_softdeleted'] = $post_data['topic_posts_softdeleted']; + } + + // Only return the username when it is either a guest posting or we are editing a post and + // the username was supplied; otherwise post_data might hold the data of the post that is + // being quoted (which could result in the username being returned being that of the quoted + // post's poster, not the poster of the current post). See: PHPBB3-11769 for more information. + $post_author_name = ((!$user->data['is_registered'] || $mode == 'edit') && $post_data['username'] !== '') ? $post_data['username'] : ''; + + /** + * This event allows you to define errors before the post action is performed + * + * @event core.posting_modify_submit_post_before + * @var array post_data Array with post data + * @var array poll Array with poll data + * @var array data Array with post data going to be stored in the database + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var string post_author_name Author name for guest posts + * @var bool update_message Boolean if the post message was changed + * @var bool update_subject Boolean if the post subject was changed + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.2.0-a1 Removed undefined page_title + */ + $vars = array( + 'post_data', + 'poll', + 'data', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'post_author_name', + 'update_message', + 'update_subject', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submit_post_before', compact($vars))); + + // The last parameter tells submit_post if search indexer has to be run + $redirect_url = submit_post($mode, $post_data['post_subject'], $post_author_name, $post_data['topic_type'], $poll, $data, $update_message, ($update_message || $update_subject) ? true : false); + + /** + * This event allows you to define errors after the post action is performed + * + * @event core.posting_modify_submit_post_after + * @var array post_data Array with post data + * @var array poll Array with poll data + * @var array data Array with post data going to be stored in the database + * @var string mode What action to take if the form is submitted + * post|reply|quote|edit|delete + * @var int post_id ID of the post + * @var int topic_id ID of the topic + * @var int forum_id ID of the forum + * @var string post_author_name Author name for guest posts + * @var bool update_message Boolean if the post message was changed + * @var bool update_subject Boolean if the post subject was changed + * @var string redirect_url URL the user is going to be redirected to + * NOTE: Should be actual language strings, NOT language keys. + * @since 3.1.0-RC5 + * @changed 3.1.6-RC1 remove submit and error from event Submit and Error are checked previously prior to running event + * @change 3.2.0-a1 Removed undefined page_title + */ + $vars = array( + 'post_data', + 'poll', + 'data', + 'mode', + 'post_id', + 'topic_id', + 'forum_id', + 'post_author_name', + 'update_message', + 'update_subject', + 'redirect_url', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_submit_post_after', compact($vars))); + + if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === true) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) + { + $captcha->reset(); + } + + // Handle delete mode... + if ($request->is_set_post('delete') || $request->is_set_post('delete_permanent')) + { + $delete_reason = $request->variable('delete_reason', '', true); + phpbb_handle_post_delete($forum_id, $topic_id, $post_id, $post_data, !$request->is_set_post('delete_permanent'), $delete_reason); + return; + } + + // Check the permissions for post approval. + // Moderators must go through post approval like ordinary users. + if ((!$auth->acl_get('f_noapprove', $data['forum_id']) && empty($data['force_approved_state'])) || (isset($data['force_approved_state']) && !$data['force_approved_state'])) + { + meta_refresh(10, $redirect_url); + $message = ($mode == 'edit') ? $user->lang['POST_EDITED_MOD'] : $user->lang['POST_STORED_MOD']; + $message .= (($user->data['user_id'] == ANONYMOUS) ? '' : ' '. $user->lang['POST_APPROVAL_NOTIFY']); + $message .= '

' . sprintf($user->lang['RETURN_FORUM'], '', ''); + trigger_error($message); + } + + redirect($redirect_url); + } + } +} + +// Preview +if (!count($error) && $preview) +{ + $post_data['post_time'] = ($mode == 'edit') ? $post_data['post_time'] : $current_time; + + $preview_message = $message_parser->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies'], false); + + $preview_signature = ($mode == 'edit') ? $post_data['user_sig'] : $user->data['user_sig']; + $preview_signature_uid = ($mode == 'edit') ? $post_data['user_sig_bbcode_uid'] : $user->data['user_sig_bbcode_uid']; + $preview_signature_bitfield = ($mode == 'edit') ? $post_data['user_sig_bbcode_bitfield'] : $user->data['user_sig_bbcode_bitfield']; + + // Signature + if ($post_data['enable_sig'] && $config['allow_sig'] && $preview_signature && $auth->acl_get('f_sigs', $forum_id)) + { + $flags = ($config['allow_sig_bbcode']) ? OPTION_FLAG_BBCODE : 0; + $flags |= ($config['allow_sig_links']) ? OPTION_FLAG_LINKS : 0; + $flags |= ($config['allow_sig_smilies']) ? OPTION_FLAG_SMILIES : 0; + + $preview_signature = generate_text_for_display($preview_signature, $preview_signature_uid, $preview_signature_bitfield, $flags, false); + } + else + { + $preview_signature = ''; + } + + $preview_subject = censor_text($post_data['post_subject']); + + // Poll Preview + if (!$poll_delete && ($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/)) + && $auth->acl_get('f_poll', $forum_id)) + { + $parse_poll = new parse_message($post_data['poll_title']); + $parse_poll->bbcode_uid = $message_parser->bbcode_uid; + $parse_poll->bbcode_bitfield = $message_parser->bbcode_bitfield; + + $parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']); + + if ($post_data['poll_length']) + { + $poll_end = ($post_data['poll_length'] * 86400) + (($post_data['poll_start']) ? $post_data['poll_start'] : time()); + } + + $template->assign_vars(array( + 'S_HAS_POLL_OPTIONS' => (count($post_data['poll_options'])), + 'S_IS_MULTI_CHOICE' => ($post_data['poll_max_options'] > 1) ? true : false, + + 'POLL_QUESTION' => $parse_poll->message, + + 'L_POLL_LENGTH' => ($post_data['poll_length']) ? sprintf($user->lang['POLL_RUN_TILL'], $user->format_date($poll_end)) : '', + 'L_MAX_VOTES' => $user->lang('MAX_OPTIONS_SELECT', (int) $post_data['poll_max_options']), + )); + + $preview_poll_options = array(); + foreach ($post_data['poll_options'] as $poll_option) + { + $parse_poll->message = $poll_option; + $parse_poll->format_display($post_data['enable_bbcode'], $post_data['enable_urls'], $post_data['enable_smilies']); + $preview_poll_options[] = $parse_poll->message; + } + unset($parse_poll); + + foreach ($preview_poll_options as $key => $option) + { + $template->assign_block_vars('poll_option', array( + 'POLL_OPTION_CAPTION' => $option, + 'POLL_OPTION_ID' => $key + 1) + ); + } + unset($preview_poll_options); + } + + // Attachment Preview + if (count($message_parser->attachment_data)) + { + $template->assign_var('S_HAS_ATTACHMENTS', true); + + $update_count = array(); + $attachment_data = $message_parser->attachment_data; + + parse_attachments($forum_id, $preview_message, $attachment_data, $update_count, true); + + foreach ($attachment_data as $i => $attachment) + { + $template->assign_block_vars('attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + unset($attachment_data); + } + + if (!count($error)) + { + $template->assign_vars(array( + 'PREVIEW_SUBJECT' => $preview_subject, + 'PREVIEW_MESSAGE' => $preview_message, + 'PREVIEW_SIGNATURE' => $preview_signature, + + 'S_DISPLAY_PREVIEW' => !empty($preview_message), + )); + } +} + +// Remove quotes that would become nested too deep before decoding the text +$generate_quote = ($mode == 'quote' && !$submit && !$preview && !$refresh); +if ($generate_quote && $config['max_quote_depth'] > 0) +{ + $tmp_bbcode_uid = $message_parser->bbcode_uid; + $message_parser->bbcode_uid = $post_data['bbcode_uid']; + $message_parser->remove_nested_quotes($config['max_quote_depth'] - 1); + $message_parser->bbcode_uid = $tmp_bbcode_uid; +} + +// Decode text for message display +$post_data['bbcode_uid'] = ($mode == 'quote' && !$preview && !$refresh && !count($error)) ? $post_data['bbcode_uid'] : $message_parser->bbcode_uid; +$message_parser->decode_message($post_data['bbcode_uid']); + +if ($generate_quote) +{ + // Remove attachment bbcode tags from the quoted message to avoid mixing with the new post attachments if any + $message_parser->message = preg_replace('#\[attachment=([0-9]+)\](.*?)\[\/attachment\]#uis', '\\2', $message_parser->message); + + $quote_attributes = array( + 'author' => $post_data['quote_username'], + 'post_id' => $post_data['post_id'], + 'time' => $post_data['post_time'], + 'user_id' => $post_data['poster_id'], + ); + + /** + * This event allows you to modify the quote attributes of the post being quoted + * + * @event core.posting_modify_quote_attributes + * @var array quote_attributes Array with quote attributes + * @var array post_data Array with post data + * @since 3.2.6-RC1 + */ + $vars = array( + 'quote_attributes', + 'post_data', + ); + extract($phpbb_dispatcher->trigger_event('core.posting_modify_quote_attributes', compact($vars))); + + /** @var \phpbb\language\language $language */ + $language = $phpbb_container->get('language'); + phpbb_format_quote($language, $message_parser, $bbcode_utils, $bbcode_status, $quote_attributes); +} + +if (($mode == 'reply' || $mode == 'quote') && !$submit && !$preview && !$refresh) +{ + $post_data['post_subject'] = ((strpos($post_data['post_subject'], 'Re: ') !== 0) ? 'Re: ' : '') . censor_text($post_data['post_subject']); +} + +$attachment_data = $message_parser->attachment_data; +$filename_data = $message_parser->filename_data; +$post_data['post_text'] = $message_parser->message; + +if (count($post_data['poll_options']) || (isset($post_data['poll_title']) && !$bbcode_utils->is_empty($post_data['poll_title']))) +{ + $message_parser->message = $post_data['poll_title']; + $message_parser->bbcode_uid = $post_data['bbcode_uid']; + + $message_parser->decode_message(); + $post_data['poll_title'] = $message_parser->message; + + $message_parser->message = implode("\n", $post_data['poll_options']); + $message_parser->decode_message(); + $post_data['poll_options'] = explode("\n", $message_parser->message); +} + +// MAIN POSTING PAGE BEGINS HERE + +// Forum moderators? +$moderators = array(); +if ($config['load_moderators']) +{ + get_moderators($moderators, $forum_id); +} + +// Generate smiley listing +generate_smilies('inline', $forum_id); + +// Generate inline attachment select box +posting_gen_inline_attachments($attachment_data); + +// Do show topic type selection only in first post. +$topic_type_toggle = false; + +if ($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id'])) +{ + $topic_type_toggle = posting_gen_topic_types($forum_id, $post_data['topic_type']); +} + +$s_topic_icons = false; +if ($post_data['enable_icons'] && $auth->acl_get('f_icons', $forum_id)) +{ + $s_topic_icons = posting_gen_topic_icons($mode, $post_data['icon_id']); +} + +$bbcode_checked = (isset($post_data['enable_bbcode'])) ? !$post_data['enable_bbcode'] : (($config['allow_bbcode']) ? !$user->optionget('bbcode') : 1); +$smilies_checked = (isset($post_data['enable_smilies'])) ? !$post_data['enable_smilies'] : (($config['allow_smilies']) ? !$user->optionget('smilies') : 1); +$urls_checked = (isset($post_data['enable_urls'])) ? !$post_data['enable_urls'] : 0; +$sig_checked = $post_data['enable_sig']; +$lock_topic_checked = (isset($topic_lock) && $topic_lock) ? $topic_lock : (($post_data['topic_status'] == ITEM_LOCKED) ? 1 : 0); +$lock_post_checked = (isset($post_lock)) ? $post_lock : $post_data['post_edit_locked']; + +// If the user is replying or posting and not already watching this topic but set to always being notified we need to overwrite this setting +$notify_set = ($mode != 'edit' && $config['allow_topic_notify'] && $user->data['is_registered'] && !$post_data['notify_set']) ? $user->data['user_notify'] : $post_data['notify_set']; +$notify_checked = (isset($notify)) ? $notify : (($mode == 'post') ? $user->data['user_notify'] : $notify_set); + +// Page title & action URL +$s_action = append_sid("{$phpbb_root_path}posting.$phpEx", "mode=$mode&f=$forum_id"); +$s_action .= ($topic_id) ? "&t=$topic_id" : ''; +$s_action .= ($post_id) ? "&p=$post_id" : ''; + +switch ($mode) +{ + case 'post': + $page_title = $user->lang['POST_TOPIC']; + break; + + case 'quote': + case 'reply': + $page_title = $user->lang['POST_REPLY']; + break; + + case 'delete': + case 'edit': + $page_title = $user->lang['EDIT_POST']; + break; +} + +// Build Navigation Links +generate_forum_nav($post_data); + +// Build Forum Rules +generate_forum_rules($post_data); + +// Posting uses is_solved for legacy reasons. Plugins have to use is_solved to force themselves to be displayed. +if ($config['enable_post_confirm'] && !$user->data['is_registered'] && (isset($captcha) && $captcha->is_solved() === false) && ($mode == 'post' || $mode == 'reply' || $mode == 'quote')) +{ + + $template->assign_vars(array( + 'S_CONFIRM_CODE' => true, + 'CAPTCHA_TEMPLATE' => $captcha->get_template(), + )); +} + +$s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '' : ''; +$s_hidden_fields .= ($draft_id || isset($_REQUEST['draft_loaded'])) ? '' : ''; + +if ($mode == 'edit') +{ + $s_hidden_fields .= build_hidden_fields(array( + 'edit_post_message_checksum' => $post_data['post_checksum'], + 'edit_post_subject_checksum' => $post_data['post_subject_md5'], + )); +} + +// Add the confirm id/code pair to the hidden fields, else an error is displayed on next submit/preview +if (isset($captcha) && $captcha->is_solved() !== false) +{ + $s_hidden_fields .= build_hidden_fields($captcha->get_hidden_fields()); +} + +$form_enctype = (@ini_get('file_uploads') == '0' || strtolower(@ini_get('file_uploads')) == 'off' || !$config['allow_attachments'] || !$auth->acl_get('u_attach') || !$auth->acl_get('f_attach', $forum_id)) ? '' : ' enctype="multipart/form-data"'; +add_form_key('posting'); + +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); + +// Build array of variables for main posting page +$page_data = array( + 'L_POST_A' => $page_title, + 'L_ICON' => ($mode == 'reply' || $mode == 'quote' || ($mode == 'edit' && $post_id != $post_data['topic_first_post_id'])) ? $user->lang['POST_ICON'] : $user->lang['TOPIC_ICON'], + 'L_MESSAGE_BODY_EXPLAIN' => $user->lang('MESSAGE_BODY_EXPLAIN', (int) $config['max_post_chars']), + 'L_DELETE_POST_PERMANENTLY' => $user->lang('DELETE_POST_PERMANENTLY', 1), + + 'FORUM_NAME' => $post_data['forum_name'], + 'FORUM_DESC' => ($post_data['forum_desc']) ? generate_text_for_display($post_data['forum_desc'], $post_data['forum_desc_uid'], $post_data['forum_desc_bitfield'], $post_data['forum_desc_options']) : '', + 'TOPIC_TITLE' => censor_text($post_data['topic_title']), + 'MODERATORS' => (count($moderators)) ? implode($user->lang['COMMA_SEPARATOR'], $moderators[$forum_id]) : '', + 'USERNAME' => ((!$preview && $mode != 'quote') || $preview) ? $post_data['username'] : '', + 'SUBJECT' => $post_data['post_subject'], + 'MESSAGE' => $post_data['post_text'], + 'BBCODE_STATUS' => $user->lang(($bbcode_status ? 'BBCODE_IS_ON' : 'BBCODE_IS_OFF'), '', ''), + 'IMG_STATUS' => ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'], + 'FLASH_STATUS' => ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'], + 'SMILIES_STATUS' => ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'], + 'URL_STATUS' => ($bbcode_status && $url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'], + 'MAX_FONT_SIZE' => (int) $config['max_post_font_size'], + 'MINI_POST_IMG' => $user->img('icon_post_target', $user->lang['POST']), + 'POST_DATE' => ($post_data['post_time']) ? $user->format_date($post_data['post_time']) : '', + 'ERROR' => (count($error)) ? implode('
', $error) : '', + 'TOPIC_TIME_LIMIT' => (int) $post_data['topic_time_limit'], + 'EDIT_REASON' => $request->variable('edit_reason', '', true), + 'SHOW_PANEL' => $request->variable('show_panel', ''), + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id"), + 'U_VIEW_TOPIC' => ($mode != 'post') ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id") : '', + 'U_PROGRESS_BAR' => append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup"), + 'UA_PROGRESS_BAR' => addslashes(append_sid("{$phpbb_root_path}posting.$phpEx", "f=$forum_id&mode=popup")), + + 'S_PRIVMSGS' => false, + 'S_CLOSE_PROGRESS_WINDOW' => (isset($_POST['add_file'])) ? true : false, + 'S_EDIT_POST' => ($mode == 'edit') ? true : false, + 'S_EDIT_REASON' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, + 'S_DISPLAY_USERNAME' => (!$user->data['is_registered'] || ($mode == 'edit' && $post_data['poster_id'] == ANONYMOUS)) ? true : false, + 'S_SHOW_TOPIC_ICONS' => $s_topic_icons, + 'S_DELETE_ALLOWED' => ($mode == 'edit' && (($post_id == $post_data['topic_last_post_id'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id) && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])) || $auth->acl_get('m_delete', $forum_id))) ? true : false, + 'S_BBCODE_ALLOWED' => ($bbcode_status) ? 1 : 0, + 'S_BBCODE_CHECKED' => ($bbcode_checked) ? ' checked="checked"' : '', + 'S_SMILIES_ALLOWED' => $smilies_status, + 'S_SMILIES_CHECKED' => ($smilies_checked) ? ' checked="checked"' : '', + 'S_SIG_ALLOWED' => ($auth->acl_get('f_sigs', $forum_id) && $config['allow_sig'] && $user->data['is_registered']) ? true : false, + 'S_SIGNATURE_CHECKED' => ($sig_checked) ? ' checked="checked"' : '', + 'S_NOTIFY_ALLOWED' => (!$user->data['is_registered'] || ($mode == 'edit' && $user->data['user_id'] != $post_data['poster_id']) || !$config['allow_topic_notify'] || !$config['email_enable']) ? false : true, + 'S_NOTIFY_CHECKED' => ($notify_checked) ? ' checked="checked"' : '', + 'S_LOCK_TOPIC_ALLOWED' => (($mode == 'edit' || $mode == 'reply' || $mode == 'quote' || $mode == 'post') && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && !empty($post_data['topic_poster']) && $user->data['user_id'] == $post_data['topic_poster'] && $post_data['topic_status'] == ITEM_UNLOCKED))) ? true : false, + 'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '', + 'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false, + 'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '', + 'S_SOFTDELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '', + 'S_SOFTDELETE_ALLOWED' => ($mode == 'edit' && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false, + 'S_RESTORE_ALLOWED' => $auth->acl_get('m_approve', $forum_id), + 'S_IS_DELETED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? true : false, + 'S_LINKS_ALLOWED' => $url_status, + 'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '', + 'S_TYPE_TOGGLE' => $topic_type_toggle, + 'S_SAVE_ALLOWED' => ($auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $mode != 'edit') ? true : false, + 'S_HAS_DRAFTS' => ($auth->acl_get('u_savedrafts') && $user->data['is_registered'] && $post_data['drafts']) ? true : false, + 'S_FORM_ENCTYPE' => $form_enctype, + + 'S_BBCODE_IMG' => $img_status, + 'S_BBCODE_URL' => $url_status, + 'S_BBCODE_FLASH' => $flash_status, + 'S_BBCODE_QUOTE' => $quote_status, + + 'S_POST_ACTION' => $s_action, + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_ATTACH_DATA' => json_encode($message_parser->attachment_data), + 'S_IN_POSTING' => true, +); + +// Build custom bbcodes array +display_custom_bbcodes(); + +// Poll entry +if (($mode == 'post' || ($mode == 'edit' && $post_id == $post_data['topic_first_post_id']/* && (!$post_data['poll_last_vote'] || $auth->acl_get('m_edit', $forum_id))*/)) + && $auth->acl_get('f_poll', $forum_id)) +{ + $page_data = array_merge($page_data, array( + 'S_SHOW_POLL_BOX' => true, + 'S_POLL_VOTE_CHANGE' => ($auth->acl_get('f_votechg', $forum_id) && $auth->acl_get('f_vote', $forum_id)), + 'S_POLL_DELETE' => ($mode == 'edit' && count($post_data['poll_options']) && ((!$post_data['poll_last_vote'] && $post_data['poster_id'] == $user->data['user_id'] && $auth->acl_get('f_delete', $forum_id)) || $auth->acl_get('m_delete', $forum_id))), + 'S_POLL_DELETE_CHECKED' => (!empty($poll_delete)) ? true : false, + + 'L_POLL_OPTIONS_EXPLAIN' => $user->lang('POLL_OPTIONS_' . (($mode == 'edit') ? 'EDIT_' : '') . 'EXPLAIN', (int) $config['max_poll_options']), + + 'VOTE_CHANGE_CHECKED' => (!empty($post_data['poll_vote_change'])) ? ' checked="checked"' : '', + 'POLL_TITLE' => (isset($post_data['poll_title'])) ? $post_data['poll_title'] : '', + 'POLL_OPTIONS' => (!empty($post_data['poll_options'])) ? implode("\n", $post_data['poll_options']) : '', + 'POLL_MAX_OPTIONS' => (isset($post_data['poll_max_options'])) ? (int) $post_data['poll_max_options'] : 1, + 'POLL_LENGTH' => $post_data['poll_length'], + ) + ); +} + +/** +* This event allows you to modify template variables for the posting screen +* +* @event core.posting_modify_template_vars +* @var array post_data Array with post data +* @var array moderators Array with forum moderators +* @var string mode What action to take if the form is submitted +* post|reply|quote|edit|delete|bump|smilies|popup +* @var string page_title Title of the mode page +* @var bool s_topic_icons Whether or not to show the topic icons +* @var string form_enctype If attachments are allowed for this form +* "multipart/form-data" or empty string +* @var string s_action The URL to submit the POST data to +* @var string s_hidden_fields Concatenated hidden input tags of posting form +* @var int post_id ID of the post +* @var int topic_id ID of the topic +* @var int forum_id ID of the forum +* @var int draft_id ID of the draft +* @var bool submit Whether or not the form has been submitted +* @var bool preview Whether or not the post is being previewed +* @var bool save Whether or not a draft is being saved +* @var bool load Whether or not a draft is being loaded +* @var bool cancel Whether or not to cancel the form (returns to +* viewtopic or viewforum depending on if the user +* is posting a new topic or editing a post) +* @var array error Any error strings; a non-empty array aborts +* form submission. +* NOTE: Should be actual language strings, NOT +* language keys. +* @var bool refresh Whether or not to retain previously submitted data +* @var array page_data Posting page data that should be passed to the +* posting page via $template->assign_vars() +* @var object message_parser The message parser object +* @since 3.1.0-a1 +* @changed 3.1.0-b3 Added vars post_data, moderators, mode, page_title, +* s_topic_icons, form_enctype, s_action, s_hidden_fields, +* post_id, topic_id, forum_id, submit, preview, save, load, +* delete, cancel, refresh, error, page_data, message_parser +* @changed 3.1.2-RC1 Removed 'delete' var as it does not exist +* @changed 3.1.5-RC1 Added poll variables to the page_data array +* @changed 3.1.6-RC1 Added 'draft_id' var +*/ +$vars = array( + 'post_data', + 'moderators', + 'mode', + 'page_title', + 's_topic_icons', + 'form_enctype', + 's_action', + 's_hidden_fields', + 'post_id', + 'topic_id', + 'forum_id', + 'draft_id', + 'submit', + 'preview', + 'save', + 'load', + 'cancel', + 'refresh', + 'error', + 'page_data', + 'message_parser', +); +extract($phpbb_dispatcher->trigger_event('core.posting_modify_template_vars', compact($vars))); + +// Start assigning vars for main posting page ... +$template->assign_vars($page_data); + +// Show attachment box for adding attachments if true +$allowed = ($auth->acl_get('f_attach', $forum_id) && $auth->acl_get('u_attach') && $config['allow_attachments'] && $form_enctype); + +if ($allowed) +{ + $max_files = ($auth->acl_get('a_') || $auth->acl_get('m_', $forum_id)) ? 0 : (int) $config['max_attachments']; + $plupload->configure($cache, $template, $s_action, $forum_id, $max_files); +} + +// Attachment entry +posting_gen_attachment_entry($attachment_data, $filename_data, $allowed); + +// Output page ... +page_header($page_title); + +$template->set_filenames(array( + 'body' => 'posting_body.html') +); + +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + +// Topic review +if ($mode == 'reply' || $mode == 'quote') +{ + if (topic_review($topic_id, $forum_id)) + { + $template->assign_var('S_DISPLAY_REVIEW', true); + } +} + +page_footer(); diff --git a/install/update/old/report.php b/install/update/old/report.php new file mode 100644 index 0000000..bb26b97 --- /dev/null +++ b/install/update/old/report.php @@ -0,0 +1,41 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +use Symfony\Component\HttpFoundation\RedirectResponse; + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); + +$post_id = $request->variable('p', 0); +$pm_id = $request->variable('pm', 0); + +$redirect_route_name = ($pm_id === 0) ? 'phpbb_report_post_controller' : 'phpbb_report_pm_controller'; + +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); +$response = new RedirectResponse( + $controller_helper->route($redirect_route_name, array( + 'id' => ($pm_id === 0) ? $post_id : $pm_id, + )), + 301 +); +$response->send(); diff --git a/install/update/old/search.php b/install/update/old/search.php new file mode 100644 index 0000000..97a8f32 --- /dev/null +++ b/install/update/old/search.php @@ -0,0 +1,1552 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('search'); + +// Define initial vars +$mode = $request->variable('mode', ''); +$search_id = $request->variable('search_id', ''); +$start = max($request->variable('start', 0), 0); +$post_id = $request->variable('p', 0); +$topic_id = $request->variable('t', 0); +$view = $request->variable('view', ''); + +$submit = $request->variable('submit', false); +$keywords = $request->variable('keywords', '', true); +$add_keywords = $request->variable('add_keywords', '', true); +$author = $request->variable('author', '', true); +$author_id = $request->variable('author_id', 0); +$show_results = ($topic_id) ? 'posts' : $request->variable('sr', 'posts'); +$show_results = ($show_results == 'posts') ? 'posts' : 'topics'; +$search_terms = $request->variable('terms', 'all'); +$search_fields = $request->variable('sf', 'all'); +$search_child = $request->variable('sc', true); + +$sort_days = $request->variable('st', 0); +$sort_key = $request->variable('sk', 't'); +$sort_dir = $request->variable('sd', 'd'); + +$return_chars = $request->variable('ch', ($topic_id) ? -1 : 300); +$search_forum = $request->variable('fid', array(0)); + +// We put login boxes for the case if search_id is newposts, egosearch or unreadposts +// because a guest should be able to log in even if guests search is not permitted + +switch ($search_id) +{ + // Egosearch is an author search + case 'egosearch': + $author_id = $user->data['user_id']; + if ($user->data['user_id'] == ANONYMOUS) + { + login_box('', $user->lang['LOGIN_EXPLAIN_EGOSEARCH']); + } + break; + + // Search for unread posts needs to be allowed and user to be logged in if topics tracking for guests is disabled + case 'unreadposts': + if (!$config['load_unreads_search']) + { + $template->assign_var('S_NO_SEARCH', true); + trigger_error('NO_SEARCH_UNREADS'); + } + else if (!$config['load_anon_lastread'] && !$user->data['is_registered']) + { + login_box('', $user->lang['LOGIN_EXPLAIN_UNREADSEARCH']); + } + break; + + // The "new posts" search uses user_lastvisit which is user based, so it should require user to log in. + case 'newposts': + if ($user->data['user_id'] == ANONYMOUS) + { + login_box('', $user->lang['LOGIN_EXPLAIN_NEWPOSTS']); + } + break; + + default: + // There's nothing to do here for now ;) + break; +} + +// Is user able to search? Has search been disabled? +if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !$config['load_search']) +{ + $template->assign_var('S_NO_SEARCH', true); + trigger_error('NO_SEARCH'); +} + +// Check search load limit +if ($user->load && $config['limit_search_load'] && ($user->load > doubleval($config['limit_search_load']))) +{ + $template->assign_var('S_NO_SEARCH', true); + trigger_error('NO_SEARCH_LOAD'); +} + +// It is applicable if the configuration setting is non-zero, and the user cannot +// ignore the flood setting, and the search is a keyword search. +$interval = ($user->data['user_id'] == ANONYMOUS) ? $config['search_anonymous_interval'] : $config['search_interval']; +if ($interval && !in_array($search_id, array('unreadposts', 'unanswered', 'active_topics', 'egosearch')) && !$auth->acl_get('u_ignoreflood')) +{ + if ($user->data['user_last_search'] > time() - $interval) + { + $template->assign_var('S_NO_SEARCH', true); + trigger_error($user->lang('NO_SEARCH_TIME', (int) ($user->data['user_last_search'] + $interval - time()))); + } +} + +// Define some vars +$limit_days = array(0 => $user->lang['ALL_RESULTS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); +$sort_by_text = array('a' => $user->lang['SORT_AUTHOR'], 't' => $user->lang['SORT_TIME'], 'f' => $user->lang['SORT_FORUM'], 'i' => $user->lang['SORT_TOPIC_TITLE'], 's' => $user->lang['SORT_POST_SUBJECT']); + +$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; +gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + +/* @var $phpbb_content_visibility \phpbb\content_visibility */ +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +/* @var $pagination \phpbb\pagination */ +$pagination = $phpbb_container->get('pagination'); + +/** +* This event allows you to alter the above parameters, such as keywords and submit +* +* @event core.search_modify_submit_parameters +* @var string keywords The search keywords +* @var string author Specifies the author match, when ANONYMOUS is also a search-match +* @var int author_id ID of the author to search by +* @var string search_id Predefined search type name +* @var bool submit Whether or not the form has been submitted +* @since 3.1.10-RC1 +*/ +$vars = array( + 'keywords', + 'author', + 'author_id', + 'search_id', + 'submit', +); +extract($phpbb_dispatcher->trigger_event('core.search_modify_submit_parameters', compact($vars))); + +if ($keywords || $author || $author_id || $search_id || $submit) +{ + // clear arrays + $id_ary = array(); + + // If we are looking for authors get their ids + $author_id_ary = array(); + $sql_author_match = ''; + if ($author_id) + { + $author_id_ary[] = $author_id; + } + else if ($author) + { + if ((strpos($author, '*') !== false) && (utf8_strlen(str_replace(array('*', '%'), '', $author)) < $config['min_search_author_chars'])) + { + trigger_error($user->lang('TOO_FEW_AUTHOR_CHARS', (int) $config['min_search_author_chars'])); + } + + $sql_where = (strpos($author, '*') !== false) ? ' username_clean ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " username_clean = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; + + $sql = 'SELECT user_id + FROM ' . USERS_TABLE . " + WHERE $sql_where + AND user_type <> " . USER_IGNORE; + $result = $db->sql_query_limit($sql, 100); + + while ($row = $db->sql_fetchrow($result)) + { + $author_id_ary[] = (int) $row['user_id']; + } + $db->sql_freeresult($result); + + $sql_where = (strpos($author, '*') !== false) ? ' post_username ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " post_username = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; + + $sql = 'SELECT 1 as guest_post + FROM ' . POSTS_TABLE . " + WHERE $sql_where + AND poster_id = " . ANONYMOUS; + $result = $db->sql_query_limit($sql, 1); + $found_guest_post = $db->sql_fetchfield('guest_post'); + $db->sql_freeresult($result); + + if ($found_guest_post) + { + $author_id_ary[] = ANONYMOUS; + $sql_author_match = (strpos($author, '*') !== false) ? ' ' . $db->sql_like_expression(str_replace('*', $db->get_any_char(), utf8_clean_string($author))) : " = '" . $db->sql_escape(utf8_clean_string($author)) . "'"; + } + + if (!count($author_id_ary)) + { + trigger_error('NO_SEARCH_RESULTS'); + } + } + + // if we search in an existing search result just add the additional keywords. But we need to use "all search terms"-mode + // so we can keep the old keywords in their old mode, but add the new ones as required words + if ($add_keywords) + { + if ($search_terms == 'all') + { + $keywords .= ' ' . $add_keywords; + } + else + { + $search_terms = 'all'; + $keywords = implode(' |', explode(' ', preg_replace('#\s+#u', ' ', $keywords))) . ' ' .$add_keywords; + } + } + + // Which forums should not be searched? Author searches are also carried out in unindexed forums + if (empty($keywords) && count($author_id_ary)) + { + $ex_fid_ary = array_keys($auth->acl_getf('!f_read', true)); + } + else + { + $ex_fid_ary = array_unique(array_merge(array_keys($auth->acl_getf('!f_read', true)), array_keys($auth->acl_getf('!f_search', true)))); + } + + $not_in_fid = (count($ex_fid_ary)) ? 'WHERE ' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . " OR (f.forum_password <> '' AND fa.user_id <> " . (int) $user->data['user_id'] . ')' : ""; + + $sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.right_id, f.forum_password, f.forum_flags, fa.user_id + FROM ' . FORUMS_TABLE . ' f + LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id + AND fa.session_id = '" . $db->sql_escape($user->session_id) . "') + $not_in_fid + ORDER BY f.left_id"; + $result = $db->sql_query($sql); + + $right_id = 0; + $reset_search_forum = true; + while ($row = $db->sql_fetchrow($result)) + { + if ($row['forum_password'] && $row['user_id'] != $user->data['user_id']) + { + $ex_fid_ary[] = (int) $row['forum_id']; + continue; + } + + // Exclude forums from active topics + if (!($row['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) && ($search_id == 'active_topics')) + { + $ex_fid_ary[] = (int) $row['forum_id']; + continue; + } + + if (count($search_forum)) + { + if ($search_child) + { + if (in_array($row['forum_id'], $search_forum) && $row['right_id'] > $right_id) + { + $right_id = (int) $row['right_id']; + } + else if ($row['right_id'] < $right_id) + { + continue; + } + } + + if (!in_array($row['forum_id'], $search_forum)) + { + $ex_fid_ary[] = (int) $row['forum_id']; + $reset_search_forum = false; + } + } + } + $db->sql_freeresult($result); + + // find out in which forums the user is allowed to view posts + $m_approve_posts_fid_sql = $phpbb_content_visibility->get_global_visibility_sql('post', $ex_fid_ary, 'p.'); + $m_approve_topics_fid_sql = $phpbb_content_visibility->get_global_visibility_sql('topic', $ex_fid_ary, 't.'); + + if ($reset_search_forum) + { + $search_forum = array(); + } + + // Select which method we'll use to obtain the post_id or topic_id information + $search_type = $config['search_type']; + + if (!class_exists($search_type)) + { + trigger_error('NO_SUCH_SEARCH_MODULE'); + } + // We do some additional checks in the module to ensure it can actually be utilised + $error = false; + $search = new $search_type($error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user, $phpbb_dispatcher); + + if ($error) + { + trigger_error($error); + } + + // let the search module split up the keywords + if ($keywords) + { + $correct_query = $search->split_keywords($keywords, $search_terms); + $common_words = $search->get_common_words(); + if (!$correct_query || (!$search->get_search_query() && !count($author_id_ary) && !$search_id)) + { + $ignored = (count($common_words)) ? sprintf($user->lang['IGNORED_TERMS_EXPLAIN'], implode(' ', $common_words)) . '
' : ''; + $word_length = $search->get_word_length(); + if ($word_length) + { + trigger_error($ignored . $user->lang('NO_KEYWORDS', $user->lang('CHARACTERS', (int) $word_length['min']), $user->lang('CHARACTERS', (int) $word_length['max']))); + } + else + { + trigger_error($ignored); + } + } + } + + if (!$keywords && count($author_id_ary)) + { + // if it is an author search we want to show topics by default + $show_results = ($topic_id) ? 'posts' : $request->variable('sr', ($search_id == 'egosearch') ? 'topics' : 'posts'); + $show_results = ($show_results == 'posts') ? 'posts' : 'topics'; + } + + // define some variables needed for retrieving post_id/topic_id information + $sort_by_sql = array('a' => 'u.username_clean', 't' => (($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'), 'f' => 'f.forum_id', 'i' => 't.topic_title', 's' => (($show_results == 'posts') ? 'p.post_subject' : 't.topic_title')); + + /** + * Event to modify the SQL parameters before pre-made searches + * + * @event core.search_modify_param_before + * @var string keywords String of the specified keywords + * @var array sort_by_sql Array of SQL sorting instructions + * @var array ex_fid_ary Array of excluded forum ids + * @var array author_id_ary Array of exclusive author ids + * @var string search_id The id of the search request + * @var array id_ary Array of post or topic ids for search result + * @var string show_results 'posts' or 'topics' type of ids + * @since 3.1.3-RC1 + * @changed 3.1.10-RC1 Added id_ary, show_results + */ + $vars = array( + 'keywords', + 'sort_by_sql', + 'ex_fid_ary', + 'author_id_ary', + 'search_id', + 'id_ary', + 'show_results', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_param_before', compact($vars))); + + // pre-made searches + $sql = $field = $l_search_title = ''; + if ($search_id) + { + switch ($search_id) + { + // Oh holy Bob, bring us some activity... + case 'active_topics': + $l_search_title = $user->lang['SEARCH_ACTIVE_TOPICS']; + $show_results = 'topics'; + $sort_key = 't'; + $sort_dir = 'd'; + $sort_days = $request->variable('st', 7); + $sort_by_sql['t'] = 't.topic_last_post_time'; + + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + $s_sort_key = $s_sort_dir = ''; + + $last_post_time_sql = ($sort_days) ? ' AND t.topic_last_post_time > ' . (time() - ($sort_days * 24 * 3600)) : ''; + + $sql = 'SELECT t.topic_last_post_time, t.topic_id + FROM ' . TOPICS_TABLE . " t + WHERE t.topic_moved_id = 0 + $last_post_time_sql + AND " . $m_approve_topics_fid_sql . ' + ' . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . ' + ORDER BY t.topic_last_post_time DESC'; + $field = 'topic_id'; + break; + + case 'unanswered': + $l_search_title = $user->lang['SEARCH_UNANSWERED']; + $show_results = $request->variable('sr', 'topics'); + $show_results = ($show_results == 'posts') ? 'posts' : 'topics'; + $sort_by_sql['t'] = ($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'; + $sort_by_sql['s'] = ($show_results == 'posts') ? 'p.post_subject' : 't.topic_title'; + $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + + $sort_join = ($sort_key == 'f') ? FORUMS_TABLE . ' f, ' : ''; + $sql_sort = ($sort_key == 'f') ? ' AND f.forum_id = p.forum_id ' . $sql_sort : $sql_sort; + + if ($sort_days) + { + $last_post_time = 'AND p.post_time > ' . (time() - ($sort_days * 24 * 3600)); + } + else + { + $last_post_time = ''; + } + + if ($sort_key == 'a') + { + $sort_join = USERS_TABLE . ' u, '; + $sql_sort = ' AND u.user_id = p.poster_id ' . $sql_sort; + } + if ($show_results == 'posts') + { + $sql = "SELECT p.post_id + FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t + WHERE t.topic_posts_approved = 1 + AND p.topic_id = t.topic_id + $last_post_time + AND $m_approve_posts_fid_sql + " . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; + $field = 'post_id'; + } + else + { + $sql = 'SELECT DISTINCT ' . $sort_by_sql[$sort_key] . ", p.topic_id + FROM $sort_join" . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t + WHERE t.topic_posts_approved = 1 + AND t.topic_moved_id = 0 + AND p.topic_id = t.topic_id + $last_post_time + AND $m_approve_topics_fid_sql + " . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; + $field = 'topic_id'; + } + break; + + case 'unreadposts': + $l_search_title = $user->lang['SEARCH_UNREAD']; + // force sorting + $show_results = 'topics'; + $sort_key = 't'; + $sort_by_sql['t'] = 't.topic_last_post_time'; + $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + + $sql_where = 'AND t.topic_moved_id = 0 + AND ' . $m_approve_topics_fid_sql . ' + ' . ((count($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : ''); + + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; + + $template->assign_var('U_MARK_ALL_READ', ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}index.$phpEx", 'hash=' . generate_link_hash('global') . '&mark=forums&mark_time=' . time()) : ''); + break; + + case 'newposts': + $l_search_title = $user->lang['SEARCH_NEW']; + // force sorting + $show_results = ($request->variable('sr', 'topics') == 'posts') ? 'posts' : 'topics'; + $sort_key = 't'; + $sort_dir = 'd'; + $sort_by_sql['t'] = ($show_results == 'posts') ? 'p.post_time' : 't.topic_last_post_time'; + $sql_sort = 'ORDER BY ' . $sort_by_sql[$sort_key] . (($sort_dir == 'a') ? ' ASC' : ' DESC'); + + gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param); + $s_sort_key = $s_sort_dir = $u_sort_param = $s_limit_days = ''; + + if ($show_results == 'posts') + { + $sql = 'SELECT p.post_id + FROM ' . POSTS_TABLE . ' p + WHERE p.post_time > ' . $user->data['user_lastvisit'] . ' + AND ' . $m_approve_posts_fid_sql . ' + ' . ((count($ex_fid_ary)) ? ' AND ' . $db->sql_in_set('p.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; + $field = 'post_id'; + } + else + { + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t + WHERE t.topic_last_post_time > ' . $user->data['user_lastvisit'] . ' + AND t.topic_moved_id = 0 + AND ' . $m_approve_topics_fid_sql . ' + ' . ((count($ex_fid_ary)) ? 'AND ' . $db->sql_in_set('t.forum_id', $ex_fid_ary, true) : '') . " + $sql_sort"; +/* + [Fix] queued replies missing from "view new posts" (Bug #42705 - Patch by Paul) + - Creates temporary table, query is far from optimized + + $sql = 'SELECT t.topic_id + FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p + WHERE p.post_time > ' . $user->data['user_lastvisit'] . ' + AND t.topic_id = p.topic_id + AND t.topic_moved_id = 0 + AND ' . $m_approve_topics_fid_sql . " + GROUP BY t.topic_id + $sql_sort"; +*/ + $field = 'topic_id'; + } + break; + + case 'egosearch': + $l_search_title = $user->lang['SEARCH_SELF']; + break; + } + } + + /** + * Event to modify data after pre-made searches + * + * @event core.search_modify_param_after + * @var string l_search_title The title of the search page + * @var string search_id Predefined search type name + * @var string show_results Display topics or posts + * @var string sql SQL query corresponding to the pre-made search id + * @since 3.1.7-RC1 + */ + $vars = array( + 'l_search_title', + 'search_id', + 'show_results', + 'sql', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_param_after', compact($vars))); + + // show_results should not change after this + $per_page = ($show_results == 'posts') ? $config['posts_per_page'] : $config['topics_per_page']; + $total_match_count = 0; + + // Set limit for the $total_match_count to reduce server load + $total_matches_limit = 1000; + $found_more_search_matches = false; + + if ($search_id) + { + if ($sql) + { + // Only return up to $total_matches_limit+1 ids (the last one will be removed later) + $result = $db->sql_query_limit($sql, $total_matches_limit + 1); + + while ($row = $db->sql_fetchrow($result)) + { + $id_ary[] = (int) $row[$field]; + } + $db->sql_freeresult($result); + } + else if ($search_id == 'unreadposts') + { + // Only return up to $total_matches_limit+1 ids (the last one will be removed later) + $id_ary = array_keys(get_unread_topics($user->data['user_id'], $sql_where, $sql_sort, $total_matches_limit + 1)); + } + else + { + $search_id = ''; + } + + $total_match_count = count($id_ary); + if ($total_match_count) + { + // Limit the number to $total_matches_limit for pre-made searches + if ($total_match_count > $total_matches_limit) + { + $found_more_search_matches = true; + $total_match_count = $total_matches_limit; + } + + // Make sure $start is set to the last page if it exceeds the amount + $start = $pagination->validate_start($start, $per_page, $total_match_count); + + $id_ary = array_slice($id_ary, $start, $per_page); + } + else + { + // Set $start to 0 if no matches were found + $start = 0; + } + } + + // make sure that some arrays are always in the same order + sort($ex_fid_ary); + sort($author_id_ary); + + if ($search->get_search_query()) + { + $total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); + } + else if (count($author_id_ary)) + { + $firstpost_only = ($search_fields === 'firstpost' || $search_fields == 'titleonly') ? true : false; + $total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_posts_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page); + } + + /** + * Event to search otherwise than by keywords or author + * + * @event core.search_backend_search_after + * @var string show_results 'posts' or 'topics' type of ids + * @var string search_fields The data fields to search in + * @var string search_terms Is either 'all' (use query as entered, words without prefix should default to "have to be in field") or 'any' (ignore search query parts and just return all posts that contain any of the specified words) + * @var array sort_by_sql Array of SQL sorting instructions + * @var string sort_key The sort key + * @var string sort_dir The sort direction + * @var int sort_days Limit the age of results + * @var array ex_fid_ary Array of excluded forum ids + * @var string m_approve_posts_fid_sql Specifies which types of posts the user can view in which forums + * @var int topic_id is set to 0 or a topic id, if it is not 0 then only posts in this topic should be searched + * @var array author_id_ary Array of exclusive author ids + * @var string sql_author_match Specifies the author match, when ANONYMOUS is also a search-match + * @var array id_ary Array of post or topic ids for search result + * @var int start The starting id of the results + * @var int per_page Number of ids each page is supposed to contain + * @var int total_match_count The total number of search matches + * @since 3.1.10-RC1 + */ + $vars = array( + 'show_results', + 'search_fields', + 'search_terms', + 'sort_by_sql', + 'sort_key', + 'sort_dir', + 'sort_days', + 'ex_fid_ary', + 'm_approve_posts_fid_sql', + 'topic_id', + 'author_id_ary', + 'sql_author_match', + 'id_ary', + 'start', + 'per_page', + 'total_match_count', + ); + extract($phpbb_dispatcher->trigger_event('core.search_backend_search_after', compact($vars))); + + $sql_where = ''; + + if (count($id_ary)) + { + $sql_where .= $db->sql_in_set(($show_results == 'posts') ? 'p.post_id' : 't.topic_id', $id_ary); + $sql_where .= (count($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : ''; + $sql_where .= ' AND ' . (($show_results == 'posts') ? $m_approve_posts_fid_sql : $m_approve_topics_fid_sql); + } + + if ($show_results == 'posts') + { + include($phpbb_root_path . 'includes/functions_posting.' . $phpEx); + } + else + { + include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + } + + $user->add_lang('viewtopic'); + + // Grab icons + $icons = $cache->obtain_icons(); + + // define some vars for urls + // A single wildcard will make the search results look ugly + $hilit = phpbb_clean_search_string(str_replace(array('+', '-', '|', '(', ')', '"'), ' ', $keywords)); + $hilit = str_replace(' ', '|', $hilit); + + $u_hilit = urlencode(htmlspecialchars_decode(str_replace('|', ' ', $hilit))); + $u_show_results = '&sr=' . $show_results; + $u_search_forum = implode('&fid%5B%5D=', $search_forum); + + $u_search = append_sid("{$phpbb_root_path}search.$phpEx", $u_sort_param . $u_show_results); + $u_search .= ($search_id) ? '&search_id=' . $search_id : ''; + $u_search .= ($u_hilit) ? '&keywords=' . urlencode(htmlspecialchars_decode($keywords)) : ''; + $u_search .= ($search_terms != 'all') ? '&terms=' . $search_terms : ''; + $u_search .= ($topic_id) ? '&t=' . $topic_id : ''; + $u_search .= ($author) ? '&author=' . urlencode(htmlspecialchars_decode($author)) : ''; + $u_search .= ($author_id) ? '&author_id=' . $author_id : ''; + $u_search .= ($u_search_forum) ? '&fid%5B%5D=' . $u_search_forum : ''; + $u_search .= (!$search_child) ? '&sc=0' : ''; + $u_search .= ($search_fields != 'all') ? '&sf=' . $search_fields : ''; + $u_search .= ($return_chars != 300) ? '&ch=' . $return_chars : ''; + + /** + * Event to add or modify search URL parameters + * + * @event core.search_modify_url_parameters + * @var string u_search Search URL parameters string + * @var string search_id Predefined search type name + * @var string show_results String indicating the show results mode + * @var string sql_where The SQL WHERE string used by search to get topic data + * @var int total_match_count The total number of search matches + * @var array ex_fid_ary Array of excluded forum ids + * @since 3.1.7-RC1 + * @changed 3.1.10-RC1 Added show_results, sql_where, total_match_count + * @changed 3.1.11-RC1 Added ex_fid_ary + */ + $vars = array( + 'u_search', + 'search_id', + 'show_results', + 'sql_where', + 'total_match_count', + 'ex_fid_ary', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_url_parameters', compact($vars))); + + if ($sql_where) + { + if ($show_results == 'posts') + { + // @todo Joining this query to the one below? + $sql = 'SELECT zebra_id, friend, foe + FROM ' . ZEBRA_TABLE . ' + WHERE user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + $zebra = array(); + while ($row = $db->sql_fetchrow($result)) + { + $zebra[($row['friend']) ? 'friend' : 'foe'][] = $row['zebra_id']; + } + $db->sql_freeresult($result); + + $sql_array = array( + 'SELECT' => 'p.*, f.forum_id, f.forum_name, t.*, u.username, u.username_clean, u.user_sig, u.user_sig_bbcode_uid, u.user_colour', + 'FROM' => array( + POSTS_TABLE => 'p', + ), + 'LEFT_JOIN' => array( + array( + 'FROM' => array(TOPICS_TABLE => 't'), + 'ON' => 'p.topic_id = t.topic_id', + ), + array( + 'FROM' => array(FORUMS_TABLE => 'f'), + 'ON' => 'p.forum_id = f.forum_id', + ), + array( + 'FROM' => array(USERS_TABLE => 'u'), + 'ON' => 'p.poster_id = u.user_id', + ), + ), + 'WHERE' => $sql_where, + 'ORDER_BY' => $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'), + ); + + /** + * Event to modify the SQL query before the posts data is retrieved + * + * @event core.search_get_posts_data + * @var array sql_array The SQL array + * @var array zebra Array of zebra data for the current user + * @var int total_match_count The total number of search matches + * @var string keywords String of the specified keywords + * @var array sort_by_sql Array of SQL sorting instructions + * @var string s_sort_dir The sort direction + * @var string s_sort_key The sort key + * @var string s_limit_days Limit the age of results + * @var array ex_fid_ary Array of excluded forum ids + * @var array author_id_ary Array of exclusive author ids + * @var string search_fields The data fields to search in + * @var int search_id The id of the search request + * @var int start The starting id of the results + * @since 3.1.0-b3 + */ + $vars = array( + 'sql_array', + 'zebra', + 'total_match_count', + 'keywords', + 'sort_by_sql', + 's_sort_dir', + 's_sort_key', + 's_limit_days', + 'ex_fid_ary', + 'author_id_ary', + 'search_fields', + 'search_id', + 'start', + ); + extract($phpbb_dispatcher->trigger_event('core.search_get_posts_data', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); + } + else + { + $sql_from = TOPICS_TABLE . ' t + LEFT JOIN ' . FORUMS_TABLE . ' f ON (f.forum_id = t.forum_id) + ' . (($sort_key == 'a') ? ' LEFT JOIN ' . USERS_TABLE . ' u ON (u.user_id = t.topic_poster) ' : ''); + $sql_select = 't.*, f.forum_id, f.forum_name'; + + if ($user->data['is_registered']) + { + if ($config['load_db_track'] && $author_id !== $user->data['user_id']) + { + $sql_from .= ' LEFT JOIN ' . TOPICS_POSTED_TABLE . ' tp ON (tp.user_id = ' . $user->data['user_id'] . ' + AND t.topic_id = tp.topic_id)'; + $sql_select .= ', tp.topic_posted'; + } + + if ($config['load_db_lastread']) + { + $sql_from .= ' LEFT JOIN ' . TOPICS_TRACK_TABLE . ' tt ON (tt.user_id = ' . $user->data['user_id'] . ' + AND t.topic_id = tt.topic_id) + LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' + AND ft.forum_id = f.forum_id)'; + $sql_select .= ', tt.mark_time, ft.mark_time as f_mark_time'; + } + } + + if ($config['load_anon_lastread'] || ($user->data['is_registered'] && !$config['load_db_lastread'])) + { + $tracking_topics = $request->variable($config['cookie_name'] . '_track', '', true, \phpbb\request\request_interface::COOKIE); + $tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array(); + } + + $sql_order_by = $sort_by_sql[$sort_key] . ' ' . (($sort_dir == 'd') ? 'DESC' : 'ASC'); + + /** + * 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 + * @var int total_match_count The total number of search matches + * @var array sort_by_sql Array of SQL sorting instructions + * @var string sort_dir The sorting direction + * @var string sort_key The sorting key + * @var string sql_order_by The SQL ORDER BY string used by search to get topic data + * @since 3.1.0-a1 + * @changed 3.1.0-RC5 Added total_match_count + * @changed 3.1.7-RC1 Added sort_by_sql, sort_dir, sort_key, sql_order_by + */ + $vars = array( + 'sql_select', + 'sql_from', + 'sql_where', + 'total_match_count', + 'sort_by_sql', + 'sort_dir', + 'sort_key', + 'sql_order_by', + ); + extract($phpbb_dispatcher->trigger_event('core.search_get_topic_data', compact($vars))); + + $sql = "SELECT $sql_select + FROM $sql_from + WHERE $sql_where + ORDER BY $sql_order_by"; + } + $result = $db->sql_query($sql); + $result_topic_id = 0; + + $rowset = $attachments = $topic_tracking_info = array(); + + if ($show_results == 'topics') + { + $forums = $rowset = $shadow_topic_list = array(); + while ($row = $db->sql_fetchrow($result)) + { + $row['forum_id'] = (int) $row['forum_id']; + $row['topic_id'] = (int) $row['topic_id']; + + if ($row['topic_status'] == ITEM_MOVED) + { + $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id']; + } + + $rowset[$row['topic_id']] = $row; + + if (!isset($forums[$row['forum_id']]) && $user->data['is_registered'] && $config['load_db_lastread']) + { + $forums[$row['forum_id']]['mark_time'] = $row['f_mark_time']; + } + $forums[$row['forum_id']]['topic_list'][] = $row['topic_id']; + $forums[$row['forum_id']]['rowset'][$row['topic_id']] = &$rowset[$row['topic_id']]; + } + $db->sql_freeresult($result); + + // If we have some shadow topics, update the rowset to reflect their topic information + if (count($shadow_topic_list)) + { + $sql = 'SELECT * + FROM ' . TOPICS_TABLE . ' + WHERE ' . $db->sql_in_set('topic_id', array_keys($shadow_topic_list)); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $orig_topic_id = $shadow_topic_list[$row['topic_id']]; + + // We want to retain some values + $row = array_merge($row, array( + 'topic_moved_id' => $rowset[$orig_topic_id]['topic_moved_id'], + 'topic_status' => $rowset[$orig_topic_id]['topic_status'], + 'forum_name' => $rowset[$orig_topic_id]['forum_name']) + ); + + $rowset[$orig_topic_id] = $row; + } + $db->sql_freeresult($result); + } + unset($shadow_topic_list); + + foreach ($forums as $forum_id => $forum) + { + if ($user->data['is_registered'] && $config['load_db_lastread']) + { + $topic_tracking_info[$forum_id] = get_topic_tracking($forum_id, $forum['topic_list'], $forum['rowset'], array($forum_id => $forum['mark_time'])); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $topic_tracking_info[$forum_id] = get_complete_topic_tracking($forum_id, $forum['topic_list']); + + if (!$user->data['is_registered']) + { + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + } + } + unset($forums); + } + else + { + $text_only_message = ''; + $attach_list = array(); + + while ($row = $db->sql_fetchrow($result)) + { + /** + * Modify the row of a post result before the post_text is trimmed + * + * @event core.search_modify_post_row + * @var string hilit String to highlight + * @var array row Array with the post data + * @var string u_hilit Highlight string to be injected into URL + * @var string view Search results view mode + * @var array zebra Array with zebra data for the current user + * @since 3.2.2-RC1 + */ + $vars = array( + 'hilit', + 'row', + 'u_hilit', + 'view', + 'zebra', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_post_row', compact($vars))); + + // We pre-process some variables here for later usage + $row['post_text'] = censor_text($row['post_text']); + + $text_only_message = $row['post_text']; + // make list items visible as such + if ($row['bbcode_uid']) + { + $text_only_message = str_replace('[*:' . $row['bbcode_uid'] . ']', '⋅ ', $text_only_message); + // no BBCode in text only message + strip_bbcode($text_only_message, $row['bbcode_uid']); + } + + if ($return_chars == -1 || utf8_strlen($text_only_message) < ($return_chars + 3)) + { + $row['display_text_only'] = false; + + // Does this post have an attachment? If so, add it to the list + if ($row['post_attachment'] && $config['allow_attachments']) + { + $attach_list[$row['forum_id']][] = $row['post_id']; + } + } + else + { + $row['post_text'] = $text_only_message; + $row['display_text_only'] = true; + } + + $rowset[] = $row; + } + $db->sql_freeresult($result); + + unset($text_only_message); + + // Pull attachment data + if (count($attach_list)) + { + $use_attach_list = $attach_list; + $attach_list = array(); + + foreach ($use_attach_list as $forum_id => $_list) + { + if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) + { + $attach_list = array_merge($attach_list, $_list); + } + } + } + + if (count($attach_list)) + { + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . ' + AND in_message = 0 + ORDER BY filetime DESC, post_msg_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + } + } + + if ($hilit) + { + // Remove bad highlights + $hilit_array = array_filter(explode('|', $hilit), 'strlen'); + foreach ($hilit_array as $key => $value) + { + $hilit_array[$key] = phpbb_clean_search_string($value); + $hilit_array[$key] = str_replace('\*', '\w*?', preg_quote($hilit_array[$key], '#')); + $hilit_array[$key] = preg_replace('#(^|\s)\\\\w\*\?(\s|$)#', '$1\w+?$2', $hilit_array[$key]); + } + $hilit = implode('|', $hilit_array); + } + + /** + * Modify the rowset data + * + * @event core.search_modify_rowset + * @var array attachments Array with posts attachments data + * @var string hilit String to highlight + * @var array rowset Array with the search results data + * @var string show_results String indicating the show results mode + * @var array topic_tracking_info Array with the topics tracking data + * @var string u_hilit Highlight string to be injected into URL + * @var string view Search results view mode + * @var array zebra Array with zebra data for the current user + * @since 3.1.0-b4 + * @changed 3.1.0-b5 Added var show_results + */ + $vars = array( + 'attachments', + 'hilit', + 'rowset', + 'show_results', + 'topic_tracking_info', + 'u_hilit', + 'view', + 'zebra', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_rowset', compact($vars))); + + foreach ($rowset as $row) + { + $forum_id = $row['forum_id']; + $result_topic_id = $row['topic_id']; + $topic_title = censor_text($row['topic_title']); + $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1; + + $view_topic_url_params = "f=$forum_id&t=$result_topic_id" . (($u_hilit) ? "&hilit=$u_hilit" : ''); + $view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params); + + if ($show_results == 'topics') + { + if ($config['load_db_track'] && $author_id === $user->data['user_id']) + { + $row['topic_posted'] = 1; + } + + $folder_img = $folder_alt = $topic_type = ''; + topic_status($row, $replies, (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false, $folder_img, $folder_alt, $topic_type); + + $unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false; + + $topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false; + $topic_deleted = $row['topic_visibility'] == ITEM_DELETED; + $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : ''; + $u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&mode=deleted_topics&t=$result_topic_id", true, $user->session_id) : $u_mcp_queue; + + $row['topic_title'] = preg_replace('#(?!<.*)(?]*(?:)#isu', '$1', $row['topic_title']); + + $tpl_ary = array( + 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_SUBJECT' => $row['topic_last_post_subject'], + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + + 'TOPIC_TYPE' => $topic_type, + + 'TOPIC_IMG_STYLE' => $folder_img, + 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), + 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], + + 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', + 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', + 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + + 'S_TOPIC_TYPE' => $row['topic_type'], + 'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false, + 'S_UNREAD_TOPIC' => $unread_topic, + + 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false, + 'S_TOPIC_UNAPPROVED' => $topic_unapproved, + 'S_POSTS_UNAPPROVED' => $posts_unapproved, + 'S_TOPIC_DELETED' => $topic_deleted, + 'S_HAS_POLL' => ($row['poll_start']) ? true : false, + + 'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'], + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'U_NEWEST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread', + 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&t=' . $result_topic_id, true, $user->session_id), + 'U_MCP_QUEUE' => $u_mcp_queue, + ); + } + else + { + if ((isset($zebra['foe']) && in_array($row['poster_id'], $zebra['foe'])) && (!$view || $view != 'show' || $post_id != $row['post_id'])) + { + $template->assign_block_vars('searchresults', array( + 'S_IGNORE_POST' => true, + + 'L_IGNORE_POST' => sprintf($user->lang['POST_BY_FOE'], $row['username'], "', '')) + ); + + continue; + } + + // Replace naughty words such as farty pants + $row['post_subject'] = censor_text($row['post_subject']); + + if ($row['display_text_only']) + { + // now find context for the searched words + $row['post_text'] = get_context($row['post_text'], array_filter(explode('|', $hilit), 'strlen'), $return_chars); + $row['post_text'] = bbcode_nl2br($row['post_text']); + } + else + { + $parse_flags = ($row['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + $row['post_text'] = generate_text_for_display($row['post_text'], $row['bbcode_uid'], $row['bbcode_bitfield'], $parse_flags, false); + + if (!empty($attachments[$row['post_id']])) + { + parse_attachments($forum_id, $row['post_text'], $attachments[$row['post_id']], $update_count); + + // we only display inline attachments + unset($attachments[$row['post_id']]); + } + } + + if ($hilit) + { + // post highlighting + $row['post_text'] = preg_replace('#(?!<.*)(?]*(?:)#isu', '$1', $row['post_text']); + $row['post_subject'] = preg_replace('#(?!<.*)(?]*(?:)#isu', '$1', $row['post_subject']); + } + + $tpl_ary = array( + 'POST_AUTHOR_FULL' => get_username_string('full', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => get_username_string('colour', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => get_username_string('username', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => get_username_string('profile', $row['poster_id'], $row['username'], $row['user_colour'], $row['post_username']), + + 'POST_SUBJECT' => $row['post_subject'], + 'POST_DATE' => (!empty($row['post_time'])) ? $user->format_date($row['post_time']) : '', + 'MESSAGE' => $row['post_text'] + ); + } + + $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, + + 'FORUM_TITLE' => $row['forum_name'], + 'TOPIC_TITLE' => $topic_title, + 'TOPIC_REPLIES' => $replies, + 'TOPIC_VIEWS' => $row['topic_views'], + + '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'] : '', + )); + + /** + * 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 + * @var string show_results Display topics or posts + * @var string topic_title Cleaned topic title + * @var int replies The number of topic replies + * @var string view_topic_url The URL to the topic + * @var string folder_img The folder image of the topic + * @var string folder_alt The alt attribute of the topic folder img + * @var int topic_type The topic type + * @var bool unread_topic Whether the topic has unread posts + * @var bool topic_unapproved Whether the topic is unapproved + * @var int posts_unapproved The number of unapproved posts + * @var bool topic_deleted Whether the topic has been deleted + * @var string u_mcp_queue The URL to the corresponding MCP queue page + * @var array zebra The zebra data of the current user + * @var array attachments All the attachments of the search results + * @since 3.1.0-a1 + * @changed 3.1.0-b3 Added vars show_results, topic_title, replies, + * view_topic_url, folder_img, folder_alt, topic_type, unread_topic, + * topic_unapproved, posts_unapproved, topic_deleted, u_mcp_queue, + * zebra, attachments + */ + $vars = array( + 'row', + 'tpl_ary', + 'show_results', + 'topic_title', + 'replies', + 'view_topic_url', + 'folder_img', + 'folder_alt', + 'topic_type', + 'unread_topic', + 'topic_unapproved', + 'posts_unapproved', + 'topic_deleted', + 'u_mcp_queue', + 'zebra', + 'attachments', + ); + extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars))); + + $template->assign_block_vars('searchresults', $tpl_ary); + + if ($show_results == 'topics') + { + $pagination->generate_template_pagination($view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); + } + } + + if ($topic_id && ($topic_id == $result_topic_id)) + { + $template->assign_vars(array( + 'SEARCH_TOPIC' => $topic_title, + 'L_RETURN_TO_TOPIC' => $user->lang('RETURN_TO', $topic_title), + 'U_SEARCH_TOPIC' => $view_topic_url + )); + } + } + unset($rowset); + + // Output header + if ($found_more_search_matches) + { + $l_search_matches = $user->lang('FOUND_MORE_SEARCH_MATCHES', (int) $total_match_count); + } + else + { + $l_search_matches = $user->lang('FOUND_SEARCH_MATCHES', (int) $total_match_count); + } + + // Check if search backend supports phrase search or not + $phrase_search_disabled = ''; + if (strpos(html_entity_decode($keywords), '"') !== false && method_exists($search, 'supports_phrase_search')) + { + $phrase_search_disabled = $search->supports_phrase_search() ? false : true; + } + + $pagination->generate_template_pagination($u_search, 'pagination', 'start', $total_match_count, $per_page, $start); + + $template->assign_vars(array( + 'SEARCH_TITLE' => $l_search_title, + 'SEARCH_MATCHES' => $l_search_matches, + 'SEARCH_WORDS' => $keywords, + 'SEARCHED_QUERY' => $search->get_search_query(), + 'IGNORED_WORDS' => (!empty($common_words)) ? implode(' ', $common_words) : '', + + 'PHRASE_SEARCH_DISABLED' => $phrase_search_disabled, + + 'TOTAL_MATCHES' => $total_match_count, + 'SEARCH_IN_RESULTS' => ($search_id) ? false : true, + + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_SEARCH_ACTION' => $u_search, + 'S_SHOW_TOPICS' => ($show_results == 'posts') ? false : true, + + 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), + 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'), + 'POLL_IMG' => $user->img('icon_topic_poll', 'TOPIC_POLL'), + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + + 'U_SEARCH_WORDS' => $u_search, + )); + + /** + * Modify the title and/or load data for the search results page + * + * @event core.search_results_modify_search_title + * @var int author_id ID of the author to search by + * @var string l_search_title The title of the search page + * @var string search_id Predefined search type name + * @var string show_results Search results output mode - topics or posts + * @var int start The starting id of the results + * @var int total_match_count The count of search results + * @var string keywords The search keywords + * @since 3.1.0-RC4 + * @changed 3.1.6-RC1 Added total_match_count and keywords + */ + $vars = array( + 'author_id', + 'l_search_title', + 'search_id', + 'show_results', + 'start', + 'total_match_count', + 'keywords', + ); + extract($phpbb_dispatcher->trigger_event('core.search_results_modify_search_title', compact($vars))); + + page_header(($l_search_title) ? $l_search_title : $user->lang['SEARCH']); + + $template->set_filenames(array( + 'body' => 'search_results.html') + ); + make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + + page_footer(); +} + +// Search forum +$rowset = array(); +$s_forums = ''; +$sql = 'SELECT f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id, f.forum_password, f.enable_indexing, fa.user_id + FROM ' . FORUMS_TABLE . ' f + LEFT JOIN ' . FORUMS_ACCESS_TABLE . " fa ON (fa.forum_id = f.forum_id + AND fa.session_id = '" . $db->sql_escape($user->session_id) . "') + ORDER BY f.left_id ASC"; +$result = $db->sql_query($sql); + +while ($row = $db->sql_fetchrow($result)) +{ + $rowset[(int) $row['forum_id']] = $row; +} +$db->sql_freeresult($result); + +$right = $cat_right = $padding_inc = 0; +$padding = $forum_list = $holding = ''; +$pad_store = array('0' => ''); + +/** +* Modify the forum select list for advanced search page +* +* @event core.search_modify_forum_select_list +* @var array rowset Array with the forums list data +* @since 3.1.10-RC1 +*/ +$vars = array('rowset'); +extract($phpbb_dispatcher->trigger_event('core.search_modify_forum_select_list', compact($vars))); + +foreach ($rowset as $row) +{ + if ($row['forum_type'] == FORUM_CAT && ($row['left_id'] + 1 == $row['right_id'])) + { + // Non-postable forum with no subforums, don't display + continue; + } + + if ($row['forum_type'] == FORUM_POST && ($row['left_id'] + 1 == $row['right_id']) && !$row['enable_indexing']) + { + // Postable forum with no subforums and indexing disabled, don't display + continue; + } + + if ($row['forum_type'] == FORUM_LINK || ($row['forum_password'] && !$row['user_id'])) + { + // if this forum is a link or password protected (user has not entered the password yet) then skip to the next branch + continue; + } + + if ($row['left_id'] < $right) + { + $padding .= '   '; + $pad_store[$row['parent_id']] = $padding; + } + else if ($row['left_id'] > $right + 1) + { + if (isset($pad_store[$row['parent_id']])) + { + $padding = $pad_store[$row['parent_id']]; + } + else + { + continue; + } + } + + $right = $row['right_id']; + + if ($auth->acl_gets('!f_search', '!f_list', $row['forum_id'])) + { + // if the user does not have permissions to search or see this forum skip only this forum/category + continue; + } + + $selected = (in_array($row['forum_id'], $search_forum)) ? ' selected="selected"' : ''; + + if ($row['left_id'] > $cat_right) + { + // make sure we don't forget anything + $s_forums .= $holding; + $holding = ''; + } + + if ($row['right_id'] - $row['left_id'] > 1) + { + $cat_right = max($cat_right, $row['right_id']); + + $holding .= ''; + } + else + { + $s_forums .= $holding . ''; + $holding = ''; + } +} + +if ($holding) +{ + $s_forums .= $holding; +} + +unset($pad_store); +unset($rowset); + +if (!$s_forums) +{ + trigger_error('NO_SEARCH'); +} + +// Number of chars returned +$s_characters = ''; +$s_characters .= ''; +$s_characters .= ''; +$s_characters .= ''; + +for ($i = 100; $i <= 1000; $i += 100) +{ + $selected = ($i == 300) ? ' selected="selected"' : ''; + $s_characters .= ''; +} + +$s_hidden_fields = array('t' => $topic_id); + +if ($_SID) +{ + $s_hidden_fields['sid'] = $_SID; +} + +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + +$template->assign_vars(array( + 'S_SEARCH_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx", false, true, 0), // We force no ?sid= appending by using 0 + 'S_HIDDEN_FIELDS' => build_hidden_fields($s_hidden_fields), + 'S_CHARACTER_OPTIONS' => $s_characters, + 'S_FORUM_OPTIONS' => $s_forums, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_IN_SEARCH' => true, +)); + +// only show recent searches to search administrators +if ($auth->acl_get('a_search')) +{ + // Handle large objects differently for Oracle and MSSQL + switch ($db->get_sql_layer()) + { + case 'oracle': + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE dbms_lob.getlength(search_keywords) > 0 + ORDER BY search_time DESC'; + break; + + case 'mssql_odbc': + case 'mssqlnative': + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE DATALENGTH(search_keywords) > 0 + ORDER BY search_time DESC'; + break; + + default: + $sql = 'SELECT search_time, search_keywords + FROM ' . SEARCH_RESULTS_TABLE . ' + WHERE search_keywords <> \'\' + ORDER BY search_time DESC'; + break; + } + $result = $db->sql_query_limit($sql, 5); + + while ($row = $db->sql_fetchrow($result)) + { + $keywords = $row['search_keywords']; + + $template->assign_block_vars('recentsearch', array( + 'KEYWORDS' => $keywords, + 'TIME' => $user->format_date($row['search_time']), + + 'U_KEYWORDS' => append_sid("{$phpbb_root_path}search.$phpEx", 'keywords=' . urlencode(htmlspecialchars_decode($keywords))) + )); + } + $db->sql_freeresult($result); +} + +// Output the basic page +page_header($user->lang['SEARCH']); + +$template->set_filenames(array( + 'body' => 'search_body.html') +); +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + +page_footer(); diff --git a/install/update/old/styles/prosilver/style.cfg b/install/update/old/styles/prosilver/style.cfg new file mode 100644 index 0000000..4485b17 --- /dev/null +++ b/install/update/old/styles/prosilver/style.cfg @@ -0,0 +1,32 @@ +# +# phpBB Style Configuration File +# +# This file is part of the phpBB Forum Software package. +# +# @copyright (c) phpBB Limited +# @license GNU General Public License, version 2 (GPL-2.0) +# +# For full copyright and license information, please see +# the docs/CREDITS.txt file. +# +# At the left is the name, please do not change this +# At the right the value is entered +# +# Values get trimmed, if you want to add a space in front or at the end of +# the value, then enclose the value with single or double quotes. +# Single and double quotes do not need to be escaped. +# +# + +# General Information about this style +name = prosilver +copyright = © phpBB Limited, 2007 +style_version = 3.2.7 +phpbb_version = 3.2.7 + +# Defining a different template bitfield +# template_bitfield = //g= + +# Parent style +# Set value to empty or to this style's name if this style does not have a parent style +parent = prosilver diff --git a/install/update/old/styles/prosilver/template/attachment.html b/install/update/old/styles/prosilver/template/attachment.html new file mode 100644 index 0000000..0978d91 --- /dev/null +++ b/install/update/old/styles/prosilver/template/attachment.html @@ -0,0 +1,48 @@ + + + + +

[{_file.DENIED_MESSAGE}]

+ + + + +
+
{_file.DOWNLOAD_NAME}
+
{_file.COMMENT}
+
+ + + +
+
{_file.DOWNLOAD_NAME}
+
{_file.COMMENT}
+
{_file.DOWNLOAD_NAME} ({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}
+
+ + + +
+
{_file.UPLOAD_ICON} {_file.DOWNLOAD_NAME}
+
{_file.COMMENT}
+
({_file.FILESIZE} {_file.SIZE_LANG}) {_file.L_DOWNLOAD_COUNT}
+
+ + + + + + + + + + + + +

{_file.DOWNLOAD_NAME} [ {_file.FILESIZE} {_file.SIZE_LANG} | {_file.L_DOWNLOAD_COUNT} ]

+ + + + + + diff --git a/install/update/old/styles/prosilver/template/bbcode.html b/install/update/old/styles/prosilver/template/bbcode.html new file mode 100644 index 0000000..940c0ac --- /dev/null +++ b/install/update/old/styles/prosilver/template/bbcode.html @@ -0,0 +1,75 @@ +
    +
      +
    + +
      +
    + +
  • +
  • + +
    {USERNAME} {L_WROTE}{L_COLON} +
    +
    + +
    + + uncited + +
    + + + + + + + + + + + + + + + + + + + + + +
    +
    +
    +
    + +
    +
    + + +

    {L_CODE}{L_COLON} {L_SELECT_ALL_CODE}

    
    +
    + +
    +
    + + + + + + + + + + +{TEXT} + +{TEXT} + +{L_IMAGE} + +{DESCRIPTION} + +{DESCRIPTION} + + diff --git a/install/update/old/styles/prosilver/template/captcha_recaptcha.html b/install/update/old/styles/prosilver/template/captcha_recaptcha.html new file mode 100644 index 0000000..a123f54 --- /dev/null +++ b/install/update/old/styles/prosilver/template/captcha_recaptcha.html @@ -0,0 +1,30 @@ + +
    +
    + +

    {L_CONFIRMATION}

    +

    {L_CONFIRM_EXPLAIN}

    + +
    + + + +
    +

    {L_RECAPTCHA_EXPLAIN}
    +
    + + +
    +
    +
    + +{L_RECAPTCHA_NOT_AVAILABLE} + + + +
    +
    +
    + diff --git a/install/update/old/styles/prosilver/template/forum_fn.js b/install/update/old/styles/prosilver/template/forum_fn.js new file mode 100644 index 0000000..3f28f8a --- /dev/null +++ b/install/update/old/styles/prosilver/template/forum_fn.js @@ -0,0 +1,937 @@ +/* global phpbb */ + +/** +* phpBB3 forum functions +*/ + +/** +* Find a member +*/ +function find_username(url) { + 'use strict'; + + popup(url, 760, 570, '_usersearch'); + return false; +} + +/** +* Window popup +*/ +function popup(url, width, height, name) { + 'use strict'; + + if (!name) { + name = '_popup'; + } + + window.open(url.replace(/&/g, '&'), name, 'height=' + height + ',resizable=yes,scrollbars=yes, width=' + width); + return false; +} + +/** +* Jump to page +*/ +function pageJump(item) { + 'use strict'; + + var page = parseInt(item.val(), 10), + perPage = item.attr('data-per-page'), + baseUrl = item.attr('data-base-url'), + startName = item.attr('data-start-name'); + + if (page !== null && !isNaN(page) && page === Math.floor(page) && page > 0) { + if (baseUrl.indexOf('?') === -1) { + document.location.href = baseUrl + '?' + startName + '=' + ((page - 1) * perPage); + } else { + document.location.href = baseUrl.replace(/&/g, '&') + '&' + startName + '=' + ((page - 1) * perPage); + } + } +} + +/** +* Mark/unmark checklist +* id = ID of parent container, name = name prefix, state = state [true/false] +*/ +function marklist(id, name, state) { + 'use strict'; + + jQuery('#' + id + ' input[type=checkbox][name]').each(function() { + var $this = jQuery(this); + if ($this.attr('name').substr(0, name.length) === name && !$this.prop('disabled')) { + $this.prop('checked', state); + } + }); +} + +/** +* Resize viewable area for attached image or topic review panel (possibly others to come) +* e = element +*/ +function viewableArea(e, itself) { + 'use strict'; + + if (!e) { + return; + } + + if (!itself) { + e = e.parentNode; + } + + if (!e.vaHeight) { + // Store viewable area height before changing style to auto + e.vaHeight = e.offsetHeight; + e.vaMaxHeight = e.style.maxHeight; + e.style.height = 'auto'; + e.style.maxHeight = 'none'; + e.style.overflow = 'visible'; + } else { + // Restore viewable area height to the default + e.style.height = e.vaHeight + 'px'; + e.style.overflow = 'auto'; + e.style.maxHeight = e.vaMaxHeight; + e.vaHeight = false; + } +} + +/** +* Alternate display of subPanels +*/ +jQuery(function($) { + 'use strict'; + + $('.sub-panels').each(function() { + + var $childNodes = $('a[data-subpanel]', this), + panels = $childNodes.map(function () { + return this.getAttribute('data-subpanel'); + }), + showPanel = this.getAttribute('data-show-panel'); + + if (panels.length) { + activateSubPanel(showPanel, panels); + $childNodes.click(function () { + activateSubPanel(this.getAttribute('data-subpanel'), panels); + return false; + }); + } + }); +}); + +/** +* Activate specific subPanel +*/ +function activateSubPanel(p, panels) { + 'use strict'; + + var i, showPanel; + + if (typeof p === 'string') { + showPanel = p; + } + $('input[name="show_panel"]').val(showPanel); + + if (typeof panels === 'undefined') { + panels = jQuery('.sub-panels a[data-subpanel]').map(function() { + return this.getAttribute('data-subpanel'); + }); + } + + for (i = 0; i < panels.length; i++) { + jQuery('#' + panels[i]).css('display', panels[i] === showPanel ? 'block' : 'none'); + jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === showPanel); + } +} + +function selectCode(a) { + 'use strict'; + + // Get ID of code block + var e = a.parentNode.parentNode.getElementsByTagName('CODE')[0]; + var s, r; + + // Not IE and IE9+ + if (window.getSelection) { + s = window.getSelection(); + // Safari and Chrome + if (s.setBaseAndExtent) { + var l = (e.innerText.length > 1) ? e.innerText.length - 1 : 1; + try { + s.setBaseAndExtent(e, 0, e, l); + } catch (error) { + r = document.createRange(); + r.selectNodeContents(e); + s.removeAllRanges(); + s.addRange(r); + } + } + // Firefox and Opera + else { + // workaround for bug # 42885 + if (window.opera && e.innerHTML.substring(e.innerHTML.length - 4) === '
    ') { + e.innerHTML = e.innerHTML + ' '; + } + + r = document.createRange(); + r.selectNodeContents(e); + s.removeAllRanges(); + s.addRange(r); + } + } + // Some older browsers + else if (document.getSelection) { + s = document.getSelection(); + r = document.createRange(); + r.selectNodeContents(e); + s.removeAllRanges(); + s.addRange(r); + } + // IE + else if (document.selection) { + r = document.body.createTextRange(); + r.moveToElementText(e); + r.select(); + } +} + +var inAutocomplete = false; +var lastKeyEntered = ''; + +/** +* Check event key +*/ +function phpbbCheckKey(event) { + 'use strict'; + + // Keycode is array down or up? + if (event.keyCode && (event.keyCode === 40 || event.keyCode === 38)) { + inAutocomplete = true; + } + + // Make sure we are not within an "autocompletion" field + if (inAutocomplete) { + // If return pressed and key changed we reset the autocompletion + if (!lastKeyEntered || lastKeyEntered === event.which) { + inAutocomplete = false; + return true; + } + } + + // Keycode is not return, then return. ;) + if (event.which !== 13) { + lastKeyEntered = event.which; + return true; + } + + return false; +} + +/** +* Apply onkeypress event for forcing default submit button on ENTER key press +*/ +jQuery(function($) { + 'use strict'; + + $('form input[type=text], form input[type=password]').on('keypress', function (e) { + var defaultButton = $(this).parents('form').find('input[type=submit].default-submit-action'); + + if (!defaultButton || defaultButton.length <= 0) { + return true; + } + + if (phpbbCheckKey(e)) { + return true; + } + + if ((e.which && e.which === 13) || (e.keyCode && e.keyCode === 13)) { + defaultButton.click(); + return false; + } + + return true; + }); +}); + +/** +* Functions for user search popup +*/ +function insertUser(formId, value) { + 'use strict'; + + var $form = jQuery(formId), + formName = $form.attr('data-form-name'), + fieldName = $form.attr('data-field-name'), + item = opener.document.forms[formName][fieldName]; + + if (item.value.length && item.type === 'textarea') { + value = item.value + '\n' + value; + } + + item.value = value; +} + +function insert_marked_users(formId, users) { + 'use strict'; + + $(users).filter(':checked').each(function() { + insertUser(formId, this.value); + }); + + window.close(); +} + +function insert_single_user(formId, user) { + 'use strict'; + + insertUser(formId, user); + window.close(); +} + +/** +* Parse document block +*/ +function parseDocument($container) { + 'use strict'; + + var test = document.createElement('div'), + oldBrowser = (typeof test.style.borderRadius === 'undefined'), + $body = $('body'); + + /** + * Reset avatar dimensions when changing URL or EMAIL + */ + $container.find('input[data-reset-on-edit]').on('keyup', function() { + $(this.getAttribute('data-reset-on-edit')).val(''); + }); + + /** + * Pagination + */ + $container.find('.pagination .page-jump-form :button').click(function() { + var $input = $(this).siblings('input.inputbox'); + pageJump($input); + }); + + $container.find('.pagination .page-jump-form input.inputbox').on('keypress', function(event) { + if (event.which === 13 || event.keyCode === 13) { + event.preventDefault(); + pageJump($(this)); + } + }); + + $container.find('.pagination .dropdown-trigger').click(function() { + var $dropdownContainer = $(this).parent(); + // Wait a little bit to make sure the dropdown has activated + setTimeout(function() { + if ($dropdownContainer.hasClass('dropdown-visible')) { + $dropdownContainer.find('input.inputbox').focus(); + } + }, 100); + }); + + /** + * Adjust HTML code for IE8 and older versions + */ + // if (oldBrowser) { + // // Fix .linklist.bulletin lists + // $container + // .find('ul.linklist.bulletin > li') + // .filter(':first-child, .rightside:last-child') + // .addClass('no-bulletin'); + // } + + /** + * Resize navigation (breadcrumbs) block to keep all links on same line + */ + $container.find('.navlinks').each(function() { + var $this = $(this), + $left = $this.children().not('.rightside'), + $right = $this.children('.rightside'); + + if ($left.length !== 1 || !$right.length) { + return; + } + + function resize() { + var width = 0, + diff = $left.outerWidth(true) - $left.width(), + minWidth = Math.max($this.width() / 3, 240), + maxWidth; + + $right.each(function() { + var $this = $(this); + if ($this.is(':visible')) { + width += $this.outerWidth(true); + } + }); + + maxWidth = $this.width() - width - diff; + $left.css('max-width', Math.floor(Math.max(maxWidth, minWidth)) + 'px'); + } + + resize(); + $(window).resize(resize); + }); + + /** + * Makes breadcrumbs responsive + */ + $container.find('.breadcrumbs:not([data-skip-responsive])').each(function() { + var $this = $(this), + $links = $this.find('.crumb'), + length = $links.length, + classes = ['wrapped-max', 'wrapped-wide', 'wrapped-medium', 'wrapped-small', 'wrapped-tiny'], + classesLength = classes.length, + maxHeight = 0, + lastWidth = false, + wrapped = false; + + // Set tooltips + $this.find('a').each(function() { + var $link = $(this); + $link.attr('title', $link.text()); + }); + + // Function that checks breadcrumbs + function check() { + var height = $this.height(), + width; + + // Test max-width set in code for .navlinks above + width = parseInt($this.css('max-width'), 10); + if (!width) { + width = $body.width(); + } + + maxHeight = parseInt($this.css('line-height'), 10); + $links.each(function() { + if ($(this).height() > 0) { + maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); + } + }); + + if (height <= maxHeight) { + if (!wrapped || lastWidth === false || lastWidth >= width) { + return; + } + } + lastWidth = width; + + if (wrapped) { + $this.removeClass('wrapped').find('.crumb.wrapped').removeClass('wrapped ' + classes.join(' ')); + if ($this.height() <= maxHeight) { + return; + } + } + + wrapped = true; + $this.addClass('wrapped'); + if ($this.height() <= maxHeight) { + return; + } + + for (var i = 0; i < classesLength; i++) { + for (var j = length - 1; j >= 0; j--) { + $links.eq(j).addClass('wrapped ' + classes[i]); + if ($this.height() <= maxHeight) { + return; + } + } + } + } + + // Run function and set event + check(); + $(window).resize(check); + }); + + /** + * Responsive link lists + */ + var selector = '.linklist:not(.navlinks, [data-skip-responsive]),' + + '.postbody .post-buttons:not([data-skip-responsive])'; + $container.find(selector).each(function() { + var $this = $(this), + filterSkip = '.breadcrumbs, [data-skip-responsive]', + filterLast = '.edit-icon, .quote-icon, [data-last-responsive]', + $linksAll = $this.children(), + $linksNotSkip = $linksAll.not(filterSkip), // All items that can potentially be hidden + $linksFirst = $linksNotSkip.not(filterLast), // The items that will be hidden first + $linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last + persistent = $this.attr('id') === 'nav-main', // Does this list already have a menu (such as quick-links)? + html = '', + slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured. + + // Add a hidden drop-down menu to each links list (except those that already have one) + if (!persistent) { + if ($linksNotSkip.is('.rightside')) { + $linksNotSkip.filter('.rightside:first').before(html); + $this.children('.responsive-menu').addClass('rightside'); + } else { + $this.append(html); + } + } + + // Set some object references and initial states + var $menu = $this.children('.responsive-menu'), + $menuContents = $menu.find('.dropdown-contents'), + persistentContent = $menuContents.find('li:not(.separator)').length, + lastWidth = false, + compact = false, + responsive1 = false, + responsive2 = false, + copied1 = false, + copied2 = false, + maxHeight = 0; + + // Find the tallest element in the list (we assume that all elements are roughly the same height) + $linksAll.each(function() { + if (!$(this).height()) { + return; + } + maxHeight = Math.max(maxHeight, $(this).outerHeight(true)); + }); + if (maxHeight < 1) { + return; // Shouldn't be possible, but just in case, abort + } else { + maxHeight = maxHeight + slack; + } + + function check() { + var width = $body.width(); + // We can't make it any smaller than this, so just skip + if (responsive2 && compact && (width <= lastWidth)) { + return; + } + lastWidth = width; + + // Reset responsive and compact layout + if (responsive1 || responsive2) { + $linksNotSkip.removeClass('hidden'); + $menuContents.children('.clone').addClass('hidden'); + responsive1 = responsive2 = false; + } + if (compact) { + $this.removeClass('compact'); + compact = false; + } + + // Unhide the quick-links menu if it has "persistent" content + if (persistent && persistentContent) { + $menu.removeClass('hidden'); + } else { + $menu.addClass('hidden'); + } + + // Nothing to resize if block's height is not bigger than tallest element's height + if ($this.height() <= maxHeight) { + return; + } + + // STEP 1: Compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 2: First responsive set - compact + if (compact) { + $this.removeClass('compact'); + compact = false; + } + // Copy the list items to the dropdown + if (!copied1) { + var $clones1 = $linksFirst.clone(); + $menuContents.prepend($clones1.addClass('clone clone-first').removeClass('leftside rightside')); + + if ($this.hasClass('post-buttons')) { + $('.button', $menuContents).removeClass('button'); + $('.sr-only', $menuContents).removeClass('sr-only'); + $('.js-responsive-menu-link').addClass('button').addClass('button-icon-only'); + $('.js-responsive-menu-link .icon').removeClass('fa-bars').addClass('fa-ellipsis-h'); + } + copied1 = true; + } + if (!responsive1) { + $linksFirst.addClass('hidden'); + responsive1 = true; + $menuContents.children('.clone-first').removeClass('hidden'); + $menu.removeClass('hidden'); + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 3: First responsive set + compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 4: Last responsive set - compact + if (!$linksLast.length) { + return; // No other links to hide, can't do more + } + if (compact) { + $this.removeClass('compact'); + compact = false; + } + // Copy the list items to the dropdown + if (!copied2) { + var $clones2 = $linksLast.clone(); + $menuContents.prepend($clones2.addClass('clone clone-last').removeClass('leftside rightside')); + copied2 = true; + } + if (!responsive2) { + $linksLast.addClass('hidden'); + responsive2 = true; + $menuContents.children('.clone-last').removeClass('hidden'); + } + if ($this.height() <= maxHeight) { + return; + } + + // STEP 5: Last responsive set + compact + if (!compact) { + $this.addClass('compact'); + compact = true; + } + } + + if (!persistent) { + phpbb.registerDropdown($menu.find('a.js-responsive-menu-link'), $menu.find('.dropdown'), false); + } + + // If there are any images in the links list, run the check again after they have loaded + $linksAll.find('img').each(function() { + $(this).on('load', function() { + check(); + }); + }); + + check(); + $(window).resize(check); + }); + + /** + * Do not run functions below for old browsers + */ + if (oldBrowser) { + return; + } + + /** + * Adjust topiclist lists with check boxes + */ + $container.find('ul.topiclist dd.mark').siblings('dt').children('.list-inner').addClass('with-mark'); + + /** + * Appends contents of all extra columns to first column in + * .topiclist lists for mobile devices. Copies contents as is. + * + * To add that functionality to .topiclist list simply add + * responsive-show-all to list of classes + */ + $container.find('.topiclist.responsive-show-all > li > dl').each(function() { + var $this = $(this), + $block = $this.find('dt .responsive-show:last-child'), + first = true; + + // Create block that is visible only on mobile devices + if (!$block.length) { + $this.find('dt > .list-inner').append('
+ +
+
+ + + + +
+
+ +
    + + + + + +
  • + +
    +
    + +
    + + + + + + {forumrow.FORUM_IMAGE} + + + {forumrow.FORUM_NAME} +
    {forumrow.FORUM_DESC} + +
    {forumrow.L_MODERATOR_STR}{L_COLON} {forumrow.MODERATORS} + + + +
    {forumrow.L_SUBFORUM_STR}{L_COLON} + + + {forumrow.subforum.SUBFORUM_NAME}{L_COMMA_SEPARATOR} + + + + + + + +
    +
    + +
    {L_REDIRECTS}{L_COLON} {forumrow.CLICKS}
    + +
    {forumrow.TOPICS} {L_TOPICS}
    +
    {forumrow.POSTS} {L_POSTS}
    +
    + + + + {L_TOPICS_UNAPPROVED} + + + + {L_POSTS_UNAPPROVED_FORUM} + + + + {L_LAST_POST} + + + {forumrow.LAST_POST_SUBJECT_TRUNCATED}
    + + {L_POST_BY_AUTHOR} {forumrow.LAST_POSTER_FULL} + + + {L_VIEW_LATEST_POST} + + +
    {forumrow.LAST_POST_TIME} + + {% if forumrow.U_UNAPPROVED_TOPICS %} + {{ lang('TOPIC_UNAPPROVED_FORUM', forumrow.TOPICS) }} + {% else %} + {{ lang('NO_POSTS') }} + {% endif %} + +
    +
    + +
     
    + +
    + +
  • + + + + +
+ +
+
+ + + + +
+
+ {L_NO_FORUMS} +
+
+ diff --git a/install/update/old/styles/prosilver/template/mcp_forum.html b/install/update/old/styles/prosilver/template/mcp_forum.html new file mode 100644 index 0000000..f6c518e --- /dev/null +++ b/install/update/old/styles/prosilver/template/mcp_forum.html @@ -0,0 +1,153 @@ + + + + + +

{L_FORUM}{L_COLON} {FORUM_NAME}

+ +
+ +
+
+ +
+ +
+ + +
    +
  • +
    +
    {L_TOPICS}
    +
    {L_REPLIES}
    +
    {L_LAST_POST}
    +
    {L_MARK}
    +
    +
  • +
+ + +
    +
  • {L_NO_TOPICS}

  • +
+ + +
+ + + +
+ +
+
+ + +
+ + + + + + {S_FORM_TOKEN} +
+ +
+ + diff --git a/install/update/old/styles/prosilver/template/mcp_move.html b/install/update/old/styles/prosilver/template/mcp_move.html new file mode 100644 index 0000000..45a9ae8 --- /dev/null +++ b/install/update/old/styles/prosilver/template/mcp_move.html @@ -0,0 +1,71 @@ + + +

{MESSAGE_TITLE}

+

{MESSAGE_TEXT}

+ +

{ADDITIONAL_MSG}

+ + + + + + + + + + + +
+   + +
+ + + + + + + +
+ +
+
+ +
+

{MESSAGE_TITLE}

+

{ADDITIONAL_MSG}

+ +
+
+
+
+
+
+
+
+
 
+
{MESSAGE_TEXT}
+
+
+ +
+ {S_HIDDEN_FIELDS}  + + {S_FORM_TOKEN} +
+ +
+ +
+
+
+ + + diff --git a/install/update/old/styles/prosilver/template/mcp_topic.html b/install/update/old/styles/prosilver/template/mcp_topic.html new file mode 100644 index 0000000..b56ed18 --- /dev/null +++ b/install/update/old/styles/prosilver/template/mcp_topic.html @@ -0,0 +1,202 @@ + + + + +
+ +
+
+ +
+
+

{L_POSTS_PER_PAGE_EXPLAIN}
+
+
+
+
+
{S_SELECT_SORT_DAYS}  
+
+
+ + +
+

{L_SPLIT_TOPIC_EXPLAIN}

+ + +
+
+
+
+
+ + + +
+
+
+
+ +
+
+
+
+
+ + + +
+

{L_MERGE_TOPIC_EXPLAIN}

+
+
+
+ + {L_SELECT_TOPIC} +
+
{TO_TOPIC_INFO}
+
+
+ + +
+
+ +
+
+ +

+ {L_EXPAND_VIEW} + {L_TOPIC_REVIEW}{L_COLON} {TOPIC_TITLE} +

+ +
+ + +
+
+ +
+ + + +

{postrow.POST_SUBJECT}

+ + + +

+ + {postrow.MINI_POST} + {L_POSTED} {postrow.POST_DATE} {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} [ {L_POST_DETAILS} ] +

+ + + +

+ {L_POST_UNAPPROVED} +

+ + + +

+ {L_POST_DELETED} +

+ + + +

+ {L_POST_REPORTED} +

+ + +
{postrow.MESSAGE}
+ + + + +
+
{L_ATTACHMENTS}
+ +
{postrow.attachment.DISPLAY_ATTACHMENT}
+ +
+ + + + +
+ +
+
+ +
+ +
+ +
+ +
+ +
+
+ +
+   + + +{S_HIDDEN_FIELDS} +{S_FORM_TOKEN} +
+ +
+ + diff --git a/install/update/old/styles/prosilver/template/memberlist_body.html b/install/update/old/styles/prosilver/template/memberlist_body.html new file mode 100644 index 0000000..5f03ad9 --- /dev/null +++ b/install/update/old/styles/prosilver/template/memberlist_body.html @@ -0,0 +1,179 @@ + + + +
+ + + + + + + + +{% EVENT memberlist_body_page_header_after %} + + + {% EVENT memberlist_body_group_name_before %} +

style="color:#{GROUP_COLOR};">{GROUP_NAME}

+ {% EVENT memberlist_body_group_name_after %} + +

{L_MANAGE_GROUP}

+ +

{GROUP_DESC} {GROUP_TYPE}

+ + {% EVENT memberlist_body_group_desc_after %} + +

+ {AVATAR_IMG} + {% EVENT memberlist_body_group_rank_before %} + {RANK_IMG} + {GROUP_RANK} + {% EVENT memberlist_body_group_rank_after %} +

+ + {% EVENT memberlist_body_page_title_before %} +

{PAGE_TITLE}{L_COLON} {SEARCH_WORDS}

+ +
+ + + +
+ + + +
+
+ + + + + + + + + + {% EVENT memberlist_body_memberlist_after %} + + + + + + + + + + + + + + +
{L_RANK}{L_GROUP_LEADER}{L_USERNAME}{L_POSTS}{L_COMMA_SEPARATOR} {custom_fields.PROFILE_FIELD_NAME}{L_JOINED}{L_LAST_ACTIVE}
 
+ +
+
+ +
+
+ + + + + + + + + + + {% EVENT memberlist_body_leaders_set_after %} + + + + + + + {% EVENT memberlist_body_show_group_after %} + + + + + + + + + + + + + + + {% EVENT memberlist_body_memberrow_after %} + + + + + + + +
{L_RANK}{L_GROUP_MEMBERS}{L_USERNAME}{L_POSTS}{% for field in custom_fields %}{% if not loop.first %}{L_COMMA_SEPARATOR} {% endif %}{{ field.PROFILE_FIELD_NAME }}{% endfor %}{L_JOINED}{L_LAST_ACTIVE}{L_GROUP_MEMBERS}{L_POSTS}{L_COMMA_SEPARATOR} {custom_fields.PROFILE_FIELD_NAME}{L_JOINED}{L_LAST_ACTIVE}
{memberrow.RANK_IMG}{memberrow.RANK_TITLE} {memberrow.USERNAME_FULL} ({L_INACTIVE})
{L_SELECT} ]
{memberrow.POSTS}{memberrow.POSTS}
{memberrow.custom_fields.PROFILE_FIELD_VALUE}
 
{memberrow.JOINED}{memberrow.LAST_ACTIVE} 
{L_NO_MEMBERS}
+ +
+
+ + +
+ + +
+ + + +
+
+ + + +
+ + + +
+ + +
+ +
+ +
+ +{% EVENT memberlist_body_page_footer_before %} + + + + + + + diff --git a/install/update/old/styles/prosilver/template/memberlist_search.html b/install/update/old/styles/prosilver/template/memberlist_search.html new file mode 100644 index 0000000..b1c7a81 --- /dev/null +++ b/install/update/old/styles/prosilver/template/memberlist_search.html @@ -0,0 +1,87 @@ +

{L_FIND_USERNAME}

+ +
+
+
+ +

{L_FIND_USERNAME_EXPLAIN}

+ + +
+
+
+
+ + +
+
+ +
+
+
+
+ + +
+
+
+
+ +
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ + +
+ +
+ +
+ +
+   + + {S_FORM_TOKEN} +
+ +
+
+ +
diff --git a/install/update/old/styles/prosilver/template/navbar_header.html b/install/update/old/styles/prosilver/template/navbar_header.html new file mode 100644 index 0000000..dc29285 --- /dev/null +++ b/install/update/old/styles/prosilver/template/navbar_header.html @@ -0,0 +1,210 @@ + diff --git a/install/update/old/styles/prosilver/template/overall_footer.html b/install/update/old/styles/prosilver/template/overall_footer.html new file mode 100644 index 0000000..bdff1a0 --- /dev/null +++ b/install/update/old/styles/prosilver/template/overall_footer.html @@ -0,0 +1,120 @@ + +
+ + + + + +
+ +
+ + {RUN_CRON_TASK} +
+ + + + + + + + + + + + + + + + + + +{$SCRIPTS} + + + + + diff --git a/install/update/old/styles/prosilver/template/overall_header.html b/install/update/old/styles/prosilver/template/overall_header.html new file mode 100644 index 0000000..09824d0 --- /dev/null +++ b/install/update/old/styles/prosilver/template/overall_header.html @@ -0,0 +1,131 @@ + + + + + + +{META} +<!-- IF UNREAD_NOTIFICATIONS_COUNT -->({UNREAD_NOTIFICATIONS_COUNT}) <!-- ENDIF --><!-- IF not S_VIEWTOPIC and not S_VIEWFORUM -->{SITENAME} - <!-- ENDIF --><!-- IF S_IN_MCP -->{L_MCP} - <!-- ELSEIF S_IN_UCP -->{L_UCP} - <!-- ENDIF -->{PAGE_TITLE}<!-- IF S_VIEWTOPIC or S_VIEWFORUM --> - {SITENAME}<!-- ENDIF --> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{$STYLESHEETS} + + + + + + + + +
+ + + + + + +
+ +
+
+ {L_INFORMATION}{L_COLON} {L_BOARD_DISABLED} +
+
+ + + diff --git a/install/update/old/styles/prosilver/template/plupload.html b/install/update/old/styles/prosilver/template/plupload.html new file mode 100644 index 0000000..1eb8437 --- /dev/null +++ b/install/update/old/styles/prosilver/template/plupload.html @@ -0,0 +1,67 @@ + + + diff --git a/install/update/old/styles/prosilver/template/posting_attach_body.html b/install/update/old/styles/prosilver/template/posting_attach_body.html new file mode 100644 index 0000000..b46e9c9 --- /dev/null +++ b/install/update/old/styles/prosilver/template/posting_attach_body.html @@ -0,0 +1,93 @@ +
+
+ +

{L_ADD_ATTACHMENT_EXPLAIN}

+ +
+
+
+
+ + +
+
+
+
+
+
+
+ +
+ +
+ + {% EVENT posting_attach_body_file_list_before %} +
+
+ + + + + + + + + + + + + + + + + {% EVENT posting_attach_body_attach_row_before %} + + {% EVENT posting_attach_body_attach_row_prepend %} + + + + + + + {% EVENT posting_attach_body_attach_row_append %} + + {% EVENT posting_attach_body_attach_row_after %} + +
{L_PLUPLOAD_FILENAME}{L_FILE_COMMENT}{L_PLUPLOAD_SIZE}{L_PLUPLOAD_STATUS}
+ + +   + + + + + + + + + + + + +
+ {attach_row.FILENAME} + {% EVENT posting_attach_body_attach_row_controls_prepend %} + +   + + + {% EVENT posting_attach_body_attach_row_controls_append %} + + + + {attach_row.S_HIDDEN} + + {attach_row.FILESIZE} + + +
+
+
+ {% EVENT posting_attach_body_file_list_after %} +
+
diff --git a/install/update/old/styles/prosilver/template/posting_buttons.html b/install/update/old/styles/prosilver/template/posting_buttons.html new file mode 100644 index 0000000..122afdf --- /dev/null +++ b/install/update/old/styles/prosilver/template/posting_buttons.html @@ -0,0 +1,126 @@ + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/install/update/old/styles/prosilver/template/posting_layout.html b/install/update/old/styles/prosilver/template/posting_layout.html new file mode 100644 index 0000000..bca9195 --- /dev/null +++ b/install/update/old/styles/prosilver/template/posting_layout.html @@ -0,0 +1,86 @@ + + + +

{TOPIC_TITLE}

+ +

{FORUM_NAME}

+ + + +
+
+ + + {L_FORUM_RULES} + + {L_FORUM_RULES}
+ {FORUM_RULES} + + +
+
+ + +
+ + +
+
+ +

{L_INFORMATION}

+

{L_DRAFT_LOADED}

+ +
+
+ + + + + + + +
+
+
+

{L_SELECT_DESTINATION_FORUM}

+

{L_UNGLOBALISE_EXPLAIN}

+
+
+
+
+ +
+
 
+
+
+
+ +
+
+ + + + +
+
+ +

{L_POST_A}

+ + + + + {S_FORM_TOKEN} +
+
+ + + + + + + + + +
+ + diff --git a/install/update/old/styles/prosilver/template/posting_poll_body.html b/install/update/old/styles/prosilver/template/posting_poll_body.html new file mode 100644 index 0000000..ee7100a --- /dev/null +++ b/install/update/old/styles/prosilver/template/posting_poll_body.html @@ -0,0 +1,53 @@ +
+
+ + +

{L_ADD_POLL_EXPLAIN}

+ + +
+ +
+
+
+
+ + + +
+
+
+
+
+

{L_POLL_OPTIONS_EXPLAIN}
+
+
+ +
+ +
+
+
+
{L_POLL_MAX_OPTIONS_EXPLAIN}
+
+
+
+
+
{L_POLL_FOR_EXPLAIN}
+
+ + +
+ +
+
+
+
+ + + + +
+ +
+
diff --git a/install/update/old/styles/prosilver/template/posting_review.html b/install/update/old/styles/prosilver/template/posting_review.html new file mode 100644 index 0000000..1304046 --- /dev/null +++ b/install/update/old/styles/prosilver/template/posting_review.html @@ -0,0 +1,44 @@ +

{L_POST_REVIEW}

+ +

{L_POST_REVIEW_EXPLAIN}

+ + + +
+
+ {post_review_row.L_IGNORE_POST} + +
+
+ + +
+

{post_review_row.POST_SUBJECT}

+

+ + {post_review_row.MINI_POST} + + + {post_review_row.MINI_POST} + + + {L_POST_BY_AUTHOR} {post_review_row.POST_AUTHOR_FULL} » {post_review_row.POST_DATE} +

+
{post_review_row.MESSAGE}
+ + +
+
{L_ATTACHMENTS}
+ +
{post_review_row.attachment.DISPLAY_ATTACHMENT}
+ +
+ + +
+ +
+
+ + +
diff --git a/install/update/old/styles/prosilver/template/posting_topic_review.html b/install/update/old/styles/prosilver/template/posting_topic_review.html new file mode 100644 index 0000000..93c4484 --- /dev/null +++ b/install/update/old/styles/prosilver/template/posting_topic_review.html @@ -0,0 +1,89 @@ + +

+ {L_EXPAND_VIEW} + {L_TOPIC_REVIEW}{L_COLON} {TOPIC_TITLE} +

+ +
+ + + + +
+
+ {topic_review_row.L_IGNORE_POST} + +
+
+ {topic_review_row.L_DELETE_POST} + +
+
+ + +
+

{topic_review_row.POST_SUBJECT}

+ + + + + + +

+ + {topic_review_row.MINI_POST} + + + {topic_review_row.MINI_POST} + + + {L_POST_BY_AUTHOR} {topic_review_row.POST_AUTHOR_FULL} » {topic_review_row.POST_DATE} +

+ + +
{topic_review_row.MESSAGE}
+ + + + +
+
{L_ATTACHMENTS}
+ +
{topic_review_row.attachment.DISPLAY_ATTACHMENT}
+ +
+ + + + + +
+
+
+ +
+ +
+ +

+ + {L_BACK_TO_TOP} + +

diff --git a/install/update/old/styles/prosilver/template/search_results.html b/install/update/old/styles/prosilver/template/search_results.html new file mode 100644 index 0000000..d4dc6aa --- /dev/null +++ b/install/update/old/styles/prosilver/template/search_results.html @@ -0,0 +1,242 @@ + + + + +

{SEARCH_TITLE}{SEARCH_MATCHES}{L_COLON} {SEARCH_WORDS}

+

{L_SEARCHED_QUERY}{L_COLON} {SEARCHED_QUERY}

+

{L_IGNORED_TERMS}{L_COLON} {IGNORED_WORDS}

+

{L_PHRASE_SEARCH_DISABLED}

+ + + + + + + + + + +
+ + + + + + + + +
+ + + + + +
+ +
+
    +
  • +
    +
    {L_TOPICS}
    +
    {L_REPLIES}
    +
    {L_VIEWS}
    +
    {L_LAST_POST}
    +
    +
  • +
+ + +
+
+ +
+
+ {L_NO_SEARCH_RESULTS} +
+
+ + + + + + +
+
+ + +
+ {searchresults.L_IGNORE_POST} +
+ +
+ +
{L_POST_BY_AUTHOR} {searchresults.POST_AUTHOR_FULL}
+
{searchresults.POST_DATE}
+
{L_FORUM}{L_COLON} {searchresults.FORUM_TITLE}
+
{L_TOPIC}{L_COLON} {searchresults.TOPIC_TITLE}
+ +
{L_REPLIES}{L_COLON} {searchresults.TOPIC_REPLIES}
+
{L_VIEWS}{L_COLON} {searchresults.TOPIC_VIEWS}
+ +
+ +
+

{searchresults.POST_SUBJECT}

+
{searchresults.MESSAGE}
+ +
+ + + + + + +
+
+ + +
+
+ {L_NO_SEARCH_RESULTS} +
+
+ + + +
+ +
+ +
+ + + +
+ + + + diff --git a/install/update/old/styles/prosilver/template/simple_footer.html b/install/update/old/styles/prosilver/template/simple_footer.html new file mode 100644 index 0000000..1ef44d1 --- /dev/null +++ b/install/update/old/styles/prosilver/template/simple_footer.html @@ -0,0 +1,40 @@ +
+ + + +
+
 
+
+
+ +
+ + + +

+
+
+ + + +
+
+
+ + + + + + + + + +{$SCRIPTS} + +{% EVENT simple_footer_body_after %} + + + diff --git a/install/update/old/styles/prosilver/template/ucp_agreement.html b/install/update/old/styles/prosilver/template/ucp_agreement.html new file mode 100644 index 0000000..ace6525 --- /dev/null +++ b/install/update/old/styles/prosilver/template/ucp_agreement.html @@ -0,0 +1,73 @@ + + + + + + + +
+

+ + {S_HIDDEN_FIELDS} +

+
+ +
+ + + +
+ +
+
+
+

{SITENAME} - {L_REGISTRATION}

+ +

{L_COPPA_BIRTHDAY}{L_TERMS_OF_USE}

+ +
+
+
+ +
+
+
+ + {L_COPPA_NO}  {L_COPPA_YES} + +   + + + {S_HIDDEN_FIELDS} + {S_FORM_TOKEN} +
+
+
+
+ + + +
+
+
+

{SITENAME} - {AGREEMENT_TITLE}

+

{AGREEMENT_TEXT}

+
+

{L_BACK}

+
+
+
+ + + + diff --git a/install/update/old/styles/prosilver/template/ucp_attachments.html b/install/update/old/styles/prosilver/template/ucp_attachments.html new file mode 100644 index 0000000..696f621 --- /dev/null +++ b/install/update/old/styles/prosilver/template/ucp_attachments.html @@ -0,0 +1,83 @@ + + +
+ +

{L_TITLE}

+ +
+
+ +

{L_ATTACHMENTS_EXPLAIN}

+ + +
+ +
+ + + + +
+ + {S_FORM_TOKEN} + + +
+ + +

{L_UCP_NO_ATTACHMENTS}

+ + +
+
+ + +
+ + + {S_FORM_TOKEN} +
+ +
+ + diff --git a/install/update/old/styles/prosilver/template/ucp_avatar_options_upload.html b/install/update/old/styles/prosilver/template/ucp_avatar_options_upload.html new file mode 100644 index 0000000..63a734e --- /dev/null +++ b/install/update/old/styles/prosilver/template/ucp_avatar_options_upload.html @@ -0,0 +1,11 @@ +
+
+
+
+ + +
+

{L_UPLOAD_AVATAR_URL_EXPLAIN}
+
+
+ diff --git a/install/update/old/styles/prosilver/template/ucp_groups_manage.html b/install/update/old/styles/prosilver/template/ucp_groups_manage.html new file mode 100644 index 0000000..f2b4f00 --- /dev/null +++ b/install/update/old/styles/prosilver/template/ucp_groups_manage.html @@ -0,0 +1,247 @@ + + + style="color:#{GROUP_COLOR};">{L_USERGROUPS} :: {GROUP_NAME} + +
+ +
+
+ + +
+

{ERROR_MSG}

+
+ + +

{L_GROUPS_EXPLAIN}

+ + +

{L_GROUP_DETAILS}

+ +
+
+
+
style="color: #{GROUP_COLOUR};">{GROUP_NAME} +
+
+
+
+
+
  
+
+ +
+

{L_GROUP_TYPE_EXPLAIN}
+
+ + + + +
+
+ + + +
+ +
+
+ +
+
+

{L_GROUP_SETTINGS_SAVE}

+ +
+
+

{L_GROUP_COLOR_EXPLAIN}
+
+ +     + [ {L_COLOUR_SWATCH} ] + +
+
+
+
+
+
+
+ +
+
+ + + +
+ {S_HIDDEN_FIELDS} +   + + {S_FORM_TOKEN} +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
{L_GROUP_LEAD}{L_GROUP_DEFAULT}{L_POSTS}{L_JOINED}{L_MARK}
{leader.USERNAME_FULL}{L_YES}{L_NO}{leader.USER_POSTS}{leader.JOINED} 
+ + + + + + + + + + + + + + + + + + +
{L_GROUP_PENDING}{L_GROUP_DEFAULT}{L_POSTS}{L_JOINED}{L_MARK}
+ + + + + + + + + + + + + + + + + + + + + + +
{L_GROUP_APPROVED}{L_GROUP_DEFAULT}{L_POSTS}{L_JOINED}{L_MARK}
{member.USERNAME_FULL}{L_YES}{L_NO}{member.USER_POSTS}{member.JOINED}
+ + + + + + + + + + + +
{L_MEMBERS}
{L_GROUPS_NO_MEMBERS}
+ + +
+ +
+ + +
+
+ +
+ + + +
+ +
+
+ +

{L_ADD_USERS}

+ +

{L_ADD_USERS_UCP_EXPLAIN}

+ +
+
+

{L_USER_GROUP_DEFAULT_EXPLAIN}
+
+ + +
+
+
+

{L_USERNAMES_EXPLAIN}
+
+
{L_FIND_USERNAME}
+
+
+ +
+
+ +
+ + {S_FORM_TOKEN} +
+ + + + +
    +
  • +
    +
    {L_GROUP_LEADER}
    +
    {L_OPTIONS}
    +
    +
  • +
+ + +

{L_NO_LEADERS}

+ + +
+
+ + + + + diff --git a/install/update/old/styles/prosilver/template/ucp_pm_history.html b/install/update/old/styles/prosilver/template/ucp_pm_history.html new file mode 100644 index 0000000..6362a0b --- /dev/null +++ b/install/update/old/styles/prosilver/template/ucp_pm_history.html @@ -0,0 +1,57 @@ + +

+ {L_EXPAND_VIEW} + {L_MESSAGE_HISTORY}{L_COLON} +

+ + +
+ + +
+
+ +
+

class="current">{history_row.SUBJECT}

+ + + + + + + + +

+ {history_row.MINI_POST} {L_SENT_AT}{L_COLON} {history_row.SENT_DATE} +
+ {L_MESSAGE_BY_AUTHOR} {history_row.MESSAGE_AUTHOR_FULL} +

+
{history_row.MESSAGE}{L_MESSAGE_REMOVED_FROM_OUTBOX}
+ +
+ +
+
+ +
+ + +
+

+ + {L_BACK_TO_TOP} + +

+ diff --git a/install/update/old/styles/prosilver/template/ucp_pm_viewmessage_print.html b/install/update/old/styles/prosilver/template/ucp_pm_viewmessage_print.html new file mode 100644 index 0000000..7a88492 --- /dev/null +++ b/install/update/old/styles/prosilver/template/ucp_pm_viewmessage_print.html @@ -0,0 +1,50 @@ + + + + + + +{META} +{SITENAME} • {PAGE_TITLE} + + + + + + +
+ + + + +
+
{PAGE_NUMBER}
+
+

{SUBJECT}

+
{L_SENT_AT} {SENT_DATE}
+
{L_PM_FROM} {MESSAGE_AUTHOR}
+ +
{L_TO} {to_recipient.NAME} 
+ + +
{L_BCC} {bcc_recipient.NAME} 
+ +
+
{MESSAGE}
+
+
+
+ + +
+ + + diff --git a/install/update/old/styles/prosilver/template/ucp_profile_profile_info.html b/install/update/old/styles/prosilver/template/ucp_profile_profile_info.html new file mode 100644 index 0000000..69eda8c --- /dev/null +++ b/install/update/old/styles/prosilver/template/ucp_profile_profile_info.html @@ -0,0 +1,51 @@ + + +
+ +

{L_TITLE} [ {L_VIEW_PROFILE} ]

+ +
+
+

{L_PROFILE_INFO_NOTICE}

+ +
+

{ERROR}

+ + +
+

{L_BIRTHDAY_EXPLAIN}
+
+ + + +
+
+ + +
+
+
+
+ + +
+
for="{profile_fields.FIELD_ID}">{profile_fields.LANG_NAME}{L_COLON} * +
{profile_fields.LANG_EXPLAIN}
+
{profile_fields.ERROR}
+
{profile_fields.FIELD}
+
+ + +
+ +
+
+ +
+ {S_HIDDEN_FIELDS}  + + {S_FORM_TOKEN} +
+
+ + diff --git a/install/update/old/styles/prosilver/template/ucp_register.html b/install/update/old/styles/prosilver/template/ucp_register.html new file mode 100644 index 0000000..bf39990 --- /dev/null +++ b/install/update/old/styles/prosilver/template/ucp_register.html @@ -0,0 +1,106 @@ + + + + +
+ +
+
+ +

{SITENAME} - {L_REGISTRATION}

+ +
+
{ERROR}
+ +
{L_REG_COND}
+ + +
+

{L_USERNAME_EXPLAIN}
+
+
+
+
+
+
+
+

{L_PASSWORD_EXPLAIN}
+
+
+
+
+
+
+ + +
+ + +
+
+
+
+ + + + + +
{L_ITEMS_REQUIRED}
+ + +
+
for="{profile_fields.FIELD_ID}">{profile_fields.LANG_NAME}{L_COLON} * +
{profile_fields.LANG_EXPLAIN} +
{profile_fields.ERROR}
+
{profile_fields.FIELD}
+
+ + + + +
+
+
+ + + + + + +
+
+ +

{L_COPPA_COMPLIANCE}

+ +

{L_COPPA_EXPLAIN}

+
+
+ + + + +
+
+ +
+ {S_HIDDEN_FIELDS} +   + + {S_FORM_TOKEN} +
+ +
+
+
+ + diff --git a/install/update/old/styles/prosilver/template/viewforum_body.html b/install/update/old/styles/prosilver/template/viewforum_body.html new file mode 100644 index 0000000..d7099f3 --- /dev/null +++ b/install/update/old/styles/prosilver/template/viewforum_body.html @@ -0,0 +1,313 @@ + + +

{FORUM_NAME}

+ + +
+ +
{FORUM_DESC}
+

{L_MODERATOR}{L_MODERATORS}{L_COLON} {MODERATORS}

+
+ + + +
+
+ + + {L_FORUM_RULES} + + {L_FORUM_RULES}
+ {FORUM_RULES} + + +
+
+ + + + + + + + + + +
+ + + + + + + {L_BUTTON_FORUM_LOCKED} + + {L_BUTTON_NEW_TOPIC} + + + + + + + + + + + +
+ + + + +
+
+ {L_NO_READ_ACCESS} +
+
+ + + +
+ +
+
+ +
+

{L_LOGIN_LOGOUT}  •  {L_REGISTER}

+ +
+
+
+
+
+
+
+
+
+
+
+
+
 
+
+
+ {S_LOGIN_REDIRECT} + {S_FORM_TOKEN_LOGIN} +
+
+ +
+
+ +
+ + + + + + + + + + + +
+
+ + + +
+
+
    +
  • +
    + id="active_topics">
    {L_ACTIVE_TOPICS}{L_ANNOUNCEMENTS}{L_TOPICS}
    +
    {L_REPLIES}
    +
    {L_VIEWS}
    +
    {L_LAST_POST}
    +
    +
  • +
+ +
+
+ + + + +
+
+ {L_NO_TOPICS} +
+
+ +
+
+ {L_NO_FORUMS_IN_CATEGORY} +
+
+ + + + +
+ + + + + + {L_BUTTON_FORUM_LOCKED} + + {L_BUTTON_NEW_TOPIC} + + + + + + + +
+ +
+ + + +
+ + + + + +
+

{L_WHO_IS_ONLINE}

+

{LOGGED_IN_USER_LIST}

+
+ + + +
+

{L_FORUM_PERMISSIONS}

+

{rules.RULE}

+
+ + + diff --git a/install/update/old/styles/prosilver/template/viewtopic_body.html b/install/update/old/styles/prosilver/template/viewtopic_body.html new file mode 100644 index 0000000..8d7e26f --- /dev/null +++ b/install/update/old/styles/prosilver/template/viewtopic_body.html @@ -0,0 +1,452 @@ + + + +

{TOPIC_TITLE}

+ + +
{FORUM_DESC}
+ + +

+ {L_MODERATOR}{L_MODERATORS}{L_COLON} {MODERATORS} +

+ + + +
+
+ + + {L_FORUM_RULES} + + {L_FORUM_RULES}
+ {FORUM_RULES} + + +
+
+ + +
+ + + + + + {L_BUTTON_TOPIC_LOCKED} + + {L_BUTTON_POST_REPLY} + + + + + + + + + + + + + + + + +
+ + + + +
+ +
+
+ +
+

{POLL_QUESTION}

+

{L_POLL_LENGTH}
{L_MAX_VOTES}

+ +
+ + +
title="{L_POLL_VOTED_OPTION}" data-alt-text="{L_POLL_VOTED_OPTION}" data-poll-option-id="{poll_option.POLL_OPTION_ID}"> +
{poll_option.POLL_OPTION_CAPTION}
+
checked="checked" /> checked="checked" />
+
{poll_option.POLL_OPTION_RESULT}
+
{L_NO_VOTES}{poll_option.POLL_OPTION_PERCENT}
+
+ + + +
+
 
+
{L_TOTAL_VOTES}{L_COLON} {TOTAL_VOTES}
+
+ + +
+
 
+
+
+ + + +
+
 
+
{L_VIEW_RESULTS}
+
+ +
+ +
+ +
+ {S_FORM_TOKEN} + {S_HIDDEN_FIELDS} +
+ +
+
+ + + + + + + + data-url="{postrow.U_MINI_POST}"> + +
+
+ +
style="display: none;"> +
+
+ + + {postrow.POSTER_AVATAR}{postrow.POSTER_AVATAR} + + +
+ + {postrow.POST_AUTHOR_FULL}{postrow.POST_AUTHOR_FULL} + +
+ + +
{postrow.RANK_TITLE}
{postrow.RANK_IMG}
+ + +
{L_POSTS}{L_COLON} {postrow.POSTER_POSTS}
+
{L_JOINED}{L_COLON} {postrow.POSTER_JOINED}
+
{L_WARNINGS}{L_COLON} {postrow.POSTER_WARNINGS}
+ + + +
{postrow.PROFILE_FIELD1_NAME}{L_COLON} {postrow.PROFILE_FIELD1_VALUE}
+ + + + + +
{postrow.custom_fields.PROFILE_FIELD_NAME}{L_COLON} {postrow.custom_fields.PROFILE_FIELD_VALUE}
+ + + + + + +
+ {L_CONTACT}{L_COLON} + +
+ + + +
+ +
+ + +
+ {postrow.L_POST_DELETED_MESSAGE}
+ {postrow.L_POST_DISPLAY} +
+ +
+ {postrow.L_IGNORE_POST}
+ {postrow.L_POST_DISPLAY} +
+ + +
style="display: none;"> + + +

class="first">{postrow.POST_ICON_IMG_ALT} {postrow.POST_SUBJECT}

+ + + + + + + + + + + +

+ + {postrow.MINI_POST} + + + {postrow.MINI_POST} + + + {L_POST_BY_AUTHOR} {postrow.POST_AUTHOR_FULL} » {postrow.POST_DATE} +

+ + + +
+

+ + {L_POST_UNAPPROVED_ACTION} + + + + {S_FORM_TOKEN} +

+
+ +
+

+ {L_POST_DELETED_ACTION} + + + + + + {S_FORM_TOKEN} +

+
+ + + +

+ {L_POST_REPORTED} +

+ + +
{postrow.MESSAGE}
+ + + + +
+
+ {L_ATTACHMENTS} +
+ +
{postrow.attachment.DISPLAY_ATTACHMENT}
+ +
+ + + +
{L_DOWNLOAD_NOTICE}
+ +
+ {postrow.DELETED_MESSAGE} +
{L_REASON}{L_COLON} {postrow.DELETE_REASON} +
+ +
+ {postrow.EDITED_MESSAGE} +
{L_REASON}{L_COLON} {postrow.EDIT_REASON} +
+ + +


{postrow.BUMPED_MESSAGE}
+ +
{postrow.SIGNATURE}
+ + +
+ +
+ + + + + +
+
+ +
+ + + + + + + + +
+ + + + + + {L_BUTTON_TOPIC_LOCKED} + + {L_BUTTON_POST_REPLY} + + + + + + + + +
+ +
+ + + + + + + + + + + +
+ + + + + +
+

{L_WHO_IS_ONLINE}

+

{LOGGED_IN_USER_LIST}

+
+ + + diff --git a/install/update/old/styles/prosilver/template/viewtopic_print.html b/install/update/old/styles/prosilver/template/viewtopic_print.html new file mode 100644 index 0000000..b504949 --- /dev/null +++ b/install/update/old/styles/prosilver/template/viewtopic_print.html @@ -0,0 +1,46 @@ + + + + + + +{META} +{SITENAME} • {PAGE_TITLE} + + + + + + +
+ + + + +
+
{PAGE_NUMBER}
+ +
+

{postrow.POST_SUBJECT}

+
{L_POSTED}{L_COLON} {postrow.POST_DATE}
+
{L_POST_BY_AUTHOR} {postrow.POST_AUTHOR}
+
{postrow.MESSAGE}
+
+
+ +
+ + +
+ + + diff --git a/install/update/old/styles/prosilver/theme/colours.css b/install/update/old/styles/prosilver/theme/colours.css new file mode 100644 index 0000000..ffaa710 --- /dev/null +++ b/install/update/old/styles/prosilver/theme/colours.css @@ -0,0 +1,1163 @@ +/* +-------------------------------------------------------------- +Colours and backgrounds for common.css +-------------------------------------------------------------- */ + +html, body { + color: #536482; + background-color: #F5F7FA; +} + +h1 { + color: #FFFFFF; +} + +h2 { + color: #28313F; +} + +h3 { + border-bottom-color: #CCCCCC; + color: #115098; +} + +hr { + border-color: #FFFFFF; + border-top-color: #CCCCCC; +} + +/* +-------------------------------------------------------------- +Colours and backgrounds for links.css +-------------------------------------------------------------- */ + +a { color: #105289; } +a:hover { color: #D31141; } + +/* Links on gradient backgrounds */ +.forumbg .header a, .forabg .header a, th a { + color: #FFFFFF; +} + +.forumbg .header a:hover, .forabg .header a:hover, th a:hover { + color: #A8D8FF; +} + +/* Notification mark read link */ +.dropdown-extended a.mark_read { + background-color: #FFFFFF; +} + +/* Post body links */ +.postlink { + border-bottom-color: #368AD2; + color: #368AD2; +} + +.postlink:visited { + border-bottom-color: #5D8FBD; + color: #5D8FBD; +} + +.postlink:hover { + background-color: #D0E4F6; + color: #0D4473; +} + +.signature a, .signature a:hover { + background-color: transparent; +} + +/* Back to top of page */ +.top i { + color: #999999; +} + +/* Arrow links */ +.arrow-left:hover, .arrow-right:hover { + color: #368AD2; +} + +/* Round cornered boxes and backgrounds +---------------------------------------- */ +.wrap { + background-color: #FFF; + border-color: #E6E9ED; +} + +.headerbar { + color: #FFFFFF; +} + +.headerbar, .forumbg { + background-color: #12A3EB; + background-image: -webkit-linear-gradient(top, #6ACEFF 0%, #0076B1 2px, #12A3EB 92px, #12A3EB 100%); + background-image: linear-gradient(to bottom, #6ACEFF 0%,#0076B1 2px,#12A3EB 92px,#12A3EB 100%); + background-repeat: repeat-x; +} + +.forabg { + background-color: #0076B1; + background-image: -webkit-linear-gradient(top, #6ACEFF 0%, #12A3EB 2px, #0076B1 92px, #0076B1 100%); + background-image: linear-gradient(to bottom, #6ACEFF 0%,#12A3EB 2px,#0076B1 92px,#0076B1 100%); + background-repeat: repeat-x; +} + +.navbar { + background-color: #CADCEB; +} + +.panel { + background-color: #ECF1F3; + color: #28313F; +} + +.post:target .content { + color: #000000; +} + +.post:target h3 a { + color: #000000; +} + +.bg1 { + background-color: #ECF3F7; +} + +table.zebra-list tr:nth-child(odd) td, ul.zebra-list li:nth-child(odd) { + background-color: #ECF3F7; +} + +.bg2 { + background-color: #E1EBF2; +} + +table.zebra-list tr:nth-child(even) td, ul.zebra-list li:nth-child(even) { + background-color: #E1EBF2; +} + +.bg3 { + background-color: #CADCEB; +} + +.ucprowbg { + background-color: #DCDEE2; +} + +.fieldsbg { + background-color: #E7E8EA; +} + +.site_logo { + background-image: url("./images/site_logo.gif"); +} + +/* Horizontal lists +----------------------------------------*/ + +ul.navlinks { + border-top-color: #FFFFFF; +} + +/* Table styles +----------------------------------------*/ +table.table1 thead th { + color: #FFFFFF; +} + +table.table1 tbody tr { + border-color: #BFC1CF; +} + +table.table1 tbody tr:hover, table.table1 tbody tr.hover { + background-color: #CFE1F6; + color: #000; +} + +table.table1 td { + color: #536482; +} + +table.table1 tbody td { + border-top-color: #FAFAFA; +} + +table.table1 tbody th { + border-bottom-color: #000000; + color: #333333; + background-color: #FFFFFF; +} + +table.info tbody th { + color: #000000; +} + +/* Misc layout styles +---------------------------------------- */ +dl.details dt { + color: #000000; +} + +dl.details dd { + color: #536482; +} + +.sep { + color: #1198D9; +} + +/* Icon styles +---------------------------------------- */ +.icon.icon-blue, a:hover .icon.icon-blue { + color: #196db5; +} + +.icon.icon-green, a:hover .icon.icon-green{ + color: #1b9A1B; +} + +.icon.icon-red, a:hover .icon.icon-red{ + color: #BC2A4D; +} + +.icon.icon-orange, a:hover .icon.icon-orange{ + color: #FF6600; +} + +.icon.icon-bluegray, a:hover .icon.icon-bluegray{ + color: #536482; +} + +.icon.icon-gray, a:hover .icon.icon-gray{ + color: #777777; +} + +.icon.icon-lightgray, a:hover .icon.icon-lightgray{ + color: #999999; +} + +.icon.icon-black, a:hover .icon.icon-black{ + color: #333333; +} + +.alert_close .icon:before { + background-color: #FFFFFF; +} + +/* Jumpbox */ +.jumpbox .dropdown li { + border-top-color: #CCCCCC; +} + +.jumpbox-cat-link { + background-color: #0076b1; + border-top-color: #0076B1; + color: #FFFFFF; +} + +.jumpbox-cat-link:hover { + background-color: #12A3EB; + border-top-color: #12A3EB; + color: #FFFFFF; +} + +.jumpbox-forum-link { + background-color: #E1EBF2; +} + +.jumpbox-forum-link:hover { + background-color: #F6F4D0; +} + +.jumpbox .dropdown .pointer-inner { + border-color: #E1EBF2 transparent; +} + +.jumpbox-sub-link { + background-color: #E1EBF2; +} + +.jumpbox-sub-link:hover { + background-color: #F1F8FF; +} + +/* Miscellaneous styles +---------------------------------------- */ + +.copyright { + color: #555555; +} + +.error { + color: #BC2A4D; +} + +.reported { + background-color: #F7ECEF; +} + +li.reported:hover { + background-color: #ECD5D8 !important; +} +.sticky, .announce { + /* you can add a background for stickies and announcements*/ +} + +div.rules { + background-color: #ECD5D8; + color: #BC2A4D; +} + +p.post-notice { + background-color: #ECD5D8; + background-image: none; +} + +/* +-------------------------------------------------------------- +Colours and backgrounds for content.css +-------------------------------------------------------------- */ + +ul.forums { + background-color: #EEF5F9; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #D2E0EB 0%, #EEF5F9 100%); + background-image: linear-gradient(to bottom, #D2E0EB 0%,#EEF5F9 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D2E0EB', endColorstr='#EEF5F9',GradientType=0 ); /* IE6-9 */ +} + +ul.topiclist li { + color: #4C5D77; +} + +ul.topiclist dd { + border-left-color: #FFFFFF; +} + +.rtl ul.topiclist dd { + border-right-color: #FFFFFF; + border-left-color: transparent; +} + +li.row { + border-top-color: #FFFFFF; + border-bottom-color: #00608F; +} + +li.row strong { + color: #000000; +} + +li.row:hover { + background-color: #F6F4D0; +} + +li.row:hover dd { + border-left-color: #CCCCCC; +} + +.rtl li.row:hover dd { + border-right-color: #CCCCCC; + border-left-color: transparent; +} + +li.header dt, li.header dd { + color: #FFFFFF; +} + +/* Post body styles +----------------------------------------*/ +.postbody { + color: #333333; +} + +/* Content container styles +----------------------------------------*/ +.content { + color: #333333; +} + +.content h2, .panel h2 { + color: #115098; + border-bottom-color: #CCCCCC; +} + +dl.faq dt { + color: #333333; +} + +.posthilit { + background-color: #F3BFCC; + color: #BC2A4D; +} + +.announce, .unreadpost { + /* Highlight the announcements & unread posts box */ +} + +/* Post signature */ +.signature { + border-top-color: #CCCCCC; +} + +/* Post noticies */ +.notice { + border-top-color: #CCCCCC; +} + +/* BB Code styles +----------------------------------------*/ +/* Quote block */ +blockquote { + background-color: #EBEADD; + border-color:#DBDBCE; +} + +blockquote blockquote { + /* Nested quotes */ + background-color:#EFEED9; +} + +blockquote blockquote blockquote { + /* Nested quotes */ + background-color: #EBEADD; +} + +/* Code block */ +.codebox { + background-color: #FFFFFF; + border-color: #C9D2D8; +} + +.codebox p { + border-bottom-color: #CCCCCC; +} + +.codebox code { + color: #2E8B57; +} + +/* Attachments +----------------------------------------*/ +.attachbox { + background-color: #FFFFFF; + border-color: #C9D2D8; +} + +.pm-message .attachbox { + background-color: #F2F3F3; +} + +.attachbox dd { + border-top-color: #C9D2D8; +} + +.attachbox p { + color: #666666; +} + +.attachbox p.stats { + color: #666666; +} + +.attach-image img { + border-color: #999999; +} + +/* Inline image thumbnails */ + +dl.file dd { + color: #666666; +} + +dl.thumbnail img { + border-color: #666666; + background-color: #FFFFFF; +} + +dl.thumbnail dd { + color: #666666; +} + +dl.thumbnail dt a:hover { + background-color: #EEEEEE; +} + +dl.thumbnail dt a:hover img { + border-color: #368AD2; +} + +/* Post poll styles +----------------------------------------*/ + +fieldset.polls dl { + border-top-color: #DCDEE2; + color: #666666; +} + +fieldset.polls dl.voted { + color: #000000; +} + +fieldset.polls dd div { + color: #FFFFFF; +} + +.rtl .pollbar1, .rtl .pollbar2, .rtl .pollbar3, .rtl .pollbar4, .rtl .pollbar5 { + border-right-color: transparent; +} + +.pollbar1 { + background-color: #AA2346; + border-bottom-color: #74162C; + border-right-color: #74162C; +} + +.rtl .pollbar1 { + border-left-color: #74162C; +} + +.pollbar2 { + background-color: #BE1E4A; + border-bottom-color: #8C1C38; + border-right-color: #8C1C38; +} + +.rtl .pollbar2 { + border-left-color: #8C1C38; +} + +.pollbar3 { + background-color: #D11A4E; + border-bottom-color: #AA2346; + border-right-color: #AA2346; +} + +.rtl .pollbar3 { + border-left-color: #AA2346; +} + +.pollbar4 { + background-color: #E41653; + border-bottom-color: #BE1E4A; + border-right-color: #BE1E4A; +} + +.rtl .pollbar4 { + border-left-color: #BE1E4A; +} + +.pollbar5 { + background-color: #F81157; + border-bottom-color: #D11A4E; + border-right-color: #D11A4E; +} + +.rtl .pollbar5 { + border-left-color: #D11A4E; +} + +/* Poster profile block +----------------------------------------*/ +.postprofile { + color: #666666; + border-color: #FFFFFF; +} + +.pm .postprofile { + border-color: #DDDDDD; +} + +.postprofile strong { + color: #000000; +} + +.online { + background-image: url("./en/icon_user_online.gif"); +} + +dd.profile-warnings { + color: #BC2A4D; +} + +/* +-------------------------------------------------------------- +Colours and backgrounds for buttons.css +-------------------------------------------------------------- */ +.button { + border-color: #C7C3BF; + background-color: #E9E9E9; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #FFFFFF 0%, #E9E9E9 100%); + background-image: linear-gradient(to bottom, #FFFFFF 0%,#E9E9E9 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#FFFFFF', endColorstr='#E9E9E9',GradientType=0 ); /* IE6-9 */ + box-shadow: 0 0 0 1px #FFFFFF inset; + -webkit-box-shadow: 0 0 0 1px #FFFFFF inset; + color: #D31141; +} + +.button:hover, +.button:focus { + border-color: #0A8ED0; + background-color: #FFFFFF; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #E9E9E9 0%, #FFFFFF 100%); + background-image: linear-gradient(to bottom, #E9E9E9 0%,#FFFFFF 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#E9E9E9', endColorstr='#FFFFFF',GradientType=0 ); /* IE6-9 */ + text-shadow: 1px 1px 0 #FFFFFF, -1px -1px 0 #FFFFFF, -1px -1px 0 rgba(188, 42, 77, 0.2); +} + + +.button .icon, +.button-secondary { + color: #8f8f8f; +} + +.button-secondary:focus, +.button-secondary:hover, +.button:focus .icon, +.button:hover .icon { + color: #0A8ED0; +} + +.button-search:hover, +.button-search-end:hover { + border-color: #C7C3BF; +} + +.caret { border-color: #DADADA; } +.caret { border-color: #C7C3BF; } + +.contact-icons a { border-color: #DCDCDC; } +.contact-icons a:hover { background-color: #F2F6F9; } + +/* Pagination +---------------------------------------- */ + +.pagination li a { + background: #ECEDEE; + filter: none; + border-color: #B4BAC0; + box-shadow: none; + -webkit-box-shadow: none; + color: #5C758C; +} + +.pagination li.ellipsis span { + background: transparent; + color: #000000; +} + +.pagination li.active span { + background: #4692BF; + border-color: #4692BF; + color: #FFFFFF; +} + +.pagination li a:hover, .pagination li a:hover .icon, .pagination .dropdown-visible a.dropdown-trigger, .nojs .pagination .dropdown-container:hover a.dropdown-trigger { + background: #368AD2; + border-color: #368AD2; + filter: none; + color: #FFFFFF; + text-shadow: none; +} + +/* Search box +--------------------------------------------- */ + +.search-box .inputbox, +.search-box .inputbox:hover, +.search-box .inputbox:focus { + border-color: #C7C3BF; +} + +.search-header { + box-shadow: 0 0 10px #0075B0; +} + +/* Icon images +---------------------------------------- */ + +.contact-icon { background-image: url("./images/icons_contact.png"); } + +/* Profile & navigation icons */ +.pm-icon { background-position: 0 0; } +.email-icon { background-position: -21px 0; } +.jabber-icon { background-position: -80px 0; } +.phpbb_icq-icon { background-position: -61px 0 ; } +.phpbb_wlm-icon { background-position: -182px 0; } +.phpbb_aol-icon { background-position: -244px 0; } +.phpbb_website-icon { background-position: -40px 0; } +.phpbb_youtube-icon { background-position: -98px 0; } +.phpbb_facebook-icon { background-position: -119px 0; } +.phpbb_googleplus-icon { background-position: -140px 0; } +.phpbb_skype-icon { background-position: -161px 0; } +.phpbb_twitter-icon { background-position: -203px 0; } +.phpbb_yahoo-icon { background-position: -224px 0; } + +/* Forum icons & Topic icons */ +.global_read { background-image: url("./images/announce_read.gif"); } +.global_read_mine { background-image: url("./images/announce_read_mine.gif"); } +.global_read_locked { background-image: url("./images/announce_read_locked.gif"); } +.global_read_locked_mine { background-image: url("./images/announce_read_locked_mine.gif"); } +.global_unread { background-image: url("./images/announce_unread.gif"); } +.global_unread_mine { background-image: url("./images/announce_unread_mine.gif"); } +.global_unread_locked { background-image: url("./images/announce_unread_locked.gif"); } +.global_unread_locked_mine { background-image: url("./images/announce_unread_locked_mine.gif"); } + +.announce_read { background-image: url("./images/announce_read.gif"); } +.announce_read_mine { background-image: url("./images/announce_read_mine.gif"); } +.announce_read_locked { background-image: url("./images/announce_read_locked.gif"); } +.announce_read_locked_mine { background-image: url("./images/announce_read_locked_mine.gif"); } +.announce_unread { background-image: url("./images/announce_unread.gif"); } +.announce_unread_mine { background-image: url("./images/announce_unread_mine.gif"); } +.announce_unread_locked { background-image: url("./images/announce_unread_locked.gif"); } +.announce_unread_locked_mine { background-image: url("./images/announce_unread_locked_mine.gif"); } + +.forum_link { background-image: url("./images/forum_link.gif"); } +.forum_read { background-image: url("./images/forum_read.gif"); } +.forum_read_locked { background-image: url("./images/forum_read_locked.gif"); } +.forum_read_subforum { background-image: url("./images/forum_read_subforum.gif"); } +.forum_unread { background-image: url("./images/forum_unread.gif"); } +.forum_unread_locked { background-image: url("./images/forum_unread_locked.gif"); } +.forum_unread_subforum { background-image: url("./images/forum_unread_subforum.gif"); } + +.sticky_read { background-image: url("./images/sticky_read.gif"); } +.sticky_read_mine { background-image: url("./images/sticky_read_mine.gif"); } +.sticky_read_locked { background-image: url("./images/sticky_read_locked.gif"); } +.sticky_read_locked_mine { background-image: url("./images/sticky_read_locked_mine.gif"); } +.sticky_unread { background-image: url("./images/sticky_unread.gif"); } +.sticky_unread_mine { background-image: url("./images/sticky_unread_mine.gif"); } +.sticky_unread_locked { background-image: url("./images/sticky_unread_locked.gif"); } +.sticky_unread_locked_mine { background-image: url("./images/sticky_unread_locked_mine.gif"); } + +.topic_moved { background-image: url("./images/topic_moved.gif"); } +.pm_read, +.topic_read { background-image: url("./images/topic_read.gif"); } +.topic_read_mine { background-image: url("./images/topic_read_mine.gif"); } +.topic_read_hot { background-image: url("./images/topic_read_hot.gif"); } +.topic_read_hot_mine { background-image: url("./images/topic_read_hot_mine.gif"); } +.topic_read_locked { background-image: url("./images/topic_read_locked.gif"); } +.topic_read_locked_mine { background-image: url("./images/topic_read_locked_mine.gif"); } +.pm_unread, +.topic_unread { background-image: url("./images/topic_unread.gif"); } +.topic_unread_mine { background-image: url("./images/topic_unread_mine.gif"); } +.topic_unread_hot { background-image: url("./images/topic_unread_hot.gif"); } +.topic_unread_hot_mine { background-image: url("./images/topic_unread_hot_mine.gif"); } +.topic_unread_locked { background-image: url("./images/topic_unread_locked.gif"); } +.topic_unread_locked_mine { background-image: url("./images/topic_unread_locked_mine.gif"); } + + +/* +-------------------------------------------------------------- +Colours and backgrounds for cp.css +-------------------------------------------------------------- */ + +/* Main CP box +----------------------------------------*/ + +.panel-container h3, .panel-container hr, .cp-menu hr { + border-color: #A4B3BF; +} + +.panel-container .panel li.row { + border-bottom-color: #B5C1CB; + border-top-color: #F9F9F9; +} + +ul.cplist { + border-top-color: #B5C1CB; +} + +.panel-container .panel li.header dd, .panel-container .panel li.header dt { + color: #000000; +} + +.panel-container table.table1 thead th { + color: #333333; + border-bottom-color: #333333; +} + +.cp-main .pm-message { + border-color: #DBDEE2; + background-color: #FFFFFF; +} + +/* CP tabbed menu +----------------------------------------*/ +.tabs .tab > a { + background: #BACCD9; + color: #536482; +} + +.tabs .tab > a:hover { + background: #DDEDFB; + color: #D31141; +} + +.tabs .activetab > a, +.tabs .activetab > a:hover { + background-color: #CADCEB; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #E2F2FF 0%, #CADCEB 100%); + background-image: linear-gradient(to bottom, #E2F2FF 0%,#CADCEB 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#E2F2FF', endColorstr='#CADCEB',GradientType=0 ); /* IE6-9 */ + border-color: #CADCEB; + box-shadow: 0 1px 1px #F2F9FF inset; + color: #333333; +} + +.tabs .activetab > a:hover { + color: #000000; +} + +/* Mini tabbed menu used in MCP +----------------------------------------*/ +.minitabs .tab > a { + background-color: #E1EBF2; +} + +.minitabs .activetab > a, +.minitabs .activetab > a:hover { + background-color: #F9F9F9; + color: #333333; +} + +/* Responsive tabs +----------------------------------------*/ +.responsive-tab .responsive-tab-link:before { + border-color: #536482; +} + +.responsive-tab .responsive-tab-link:hover:before { + border-color: #D31141; +} + +/* UCP navigation menu +----------------------------------------*/ + +/* Link styles for the sub-section links */ +.navigation a { + color: #333; + background: #CADCEB; /* Old browsers */ /* FF3.6+ */ + background: -webkit-linear-gradient(left, #B4C4D1 50%, #CADCEB 100%); + background: linear-gradient(to right, #B4C4D1 50%,#CADCEB 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#B4C4D1', endColorstr='#CADCEB',GradientType=1 ); /* IE6-9 */ +} + +.rtl .navigation a { + background: #B4C4D1; /* Old browsers */ /* FF3.6+ */ + background: -webkit-linear-gradient(left, #CADCEB 50%, #B4C4D1 100%); + background: linear-gradient(to right, #CADCEB 50%,#B4C4D1 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#CADCEB', endColorstr='#B4C4D1',GradientType=1 ); /* IE6-9 */ +} + +.navigation a:hover { + background: #AABAC6; + color: #BC2A4D; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} + +.navigation .active-subsection a { + background: #F9F9F9; + color: #D31141; + filter: progid:DXImageTransform.Microsoft.gradient(enabled = false); +} + +.navigation .active-subsection a:hover { + color: #D31141; +} + +@media only screen and (max-width: 900px), only screen and (max-device-width: 900px) +{ + #navigation a, .rtl #navigation a { + background: #B2C2CF; + } +} + +/* Preferences pane layout +----------------------------------------*/ +.panel-container h2 { + color: #333333; +} + +.panel-container .panel { + background-color: #F9F9F9; +} + +.cp-main .pm { + background-color: #FFFFFF; +} + +/* Friends list */ +.cp-mini { + background-color: #EEF5F9; +} + +dl.mini dt { + color: #425067; +} + +/* PM Styles +----------------------------------------*/ +/* PM Message history */ +.current { + color: #000000 !important; +} + +/* PM marking colours */ +.pmlist li.pm_message_reported_colour, .pm_message_reported_colour { + border-left-color: #BC2A4D; + border-right-color: #BC2A4D; +} + +.pmlist li.pm_marked_colour, .pm_marked_colour { + border-color: #FF6600; +} + +.pmlist li.pm_replied_colour, .pm_replied_colour { + border-color: #A9B8C2; +} + +.pmlist li.pm_friend_colour, .pm_friend_colour { + border-color: #5D8FBD; +} + +.pmlist li.pm_foe_colour, .pm_foe_colour { + border-color: #000000; +} + +/* Avatar gallery */ +.gallery label { + background: #FFFFFF; + border-color: #CCC; +} + +.gallery label:hover { + background-color: #EEE; +} + +/* +-------------------------------------------------------------- +Colours and backgrounds for forms.css +-------------------------------------------------------------- */ + +/* General form styles +----------------------------------------*/ +select { + border-color: #666666; + background-color: #FAFAFA; + color: #000; +} + +label { + color: #425067; +} + +option.disabled-option { + color: graytext; +} + +/* Definition list layout for forms +---------------------------------------- */ +dd label { + color: #333; +} + +fieldset.fields1 { + background-color: transparent; +} + +/* Hover effects */ +fieldset dl:hover dt label { + color: #000000; +} + +fieldset.fields2 dl:hover dt label { + color: inherit; +} + +/* Quick-login on index page */ +fieldset.quick-login input.inputbox { + background-color: #F2F3F3; +} + +/* Posting page styles +----------------------------------------*/ + +.message-box textarea { + color: #333333; +} + +.message-box textarea.drag-n-drop { + outline-color: rgba(102, 102, 102, 0.5); +} + +.message-box textarea.drag-n-drop-highlight { + outline-color: rgba(17, 163, 234, 0.5); +} + +/* Input field styles +---------------------------------------- */ +.inputbox { + background-color: #FFFFFF; + border-color: #B4BAC0; + color: #333333; +} + +.inputbox:-moz-placeholder { + color: #333333; +} + +.inputbox::-webkit-input-placeholder { + color: #333333; +} + +.inputbox:hover { + border-color: #11A3EA; +} + +.inputbox:focus { + border-color: #11A3EA; +} + +.inputbox:focus:-moz-placeholder { + color: transparent; +} + +.inputbox:focus::-webkit-input-placeholder { + color: transparent; +} + + +/* Form button styles +---------------------------------------- */ + +a.button1, input.button1, input.button3, a.button2, input.button2 { + color: #000; + background-color: #EFEFEF; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #D2D2D2 0%, #EFEFEF 100%); + background-image: linear-gradient(to bottom, #D2D2D2 0%,#EFEFEF 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#D2D2D2', endColorstr='#EFEFEF',GradientType=0 ); /* IE6-9 */ +} + +a.button1, input.button1 { + border-color: #666666; +} + +input.button3 { + background-image: none; +} + +/* Alternative button */ +a.button2, input.button2, input.button3 { + border-color: #666666; +} + +/* button in the style of the form buttons */ +a.button1, a.button2 { + color: #000000; +} + +/* Hover states */ +a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover { + border-color: #D31141; + color: #D31141; + background-color: #D2D2D2; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #EFEFEF 0%, #D2D2D2 100%); + background-image: linear-gradient(to bottom, #EFEFEF 0%,#D2D2D2 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#EFEFEF', endColorstr='#D2D2D2',GradientType=0 ); /* IE6-9 */ +} + +/* Focus states */ +input.button1:focus, input.button2:focus, input.button3:focus { + border-color: #11A3EA; + color: #0F4987; +} + +input.disabled { + color: #666666; +} + +/* jQuery popups +---------------------------------------- */ +.phpbb_alert { + background-color: #FFFFFF; + border-color: #999999; +} +.darken { + background-color: #000000; +} + +.loading_indicator { + background-color: #000000; + background-image: url("./images/loading.gif"); +} + +.dropdown-extended ul li { + border-top-color: #B9B9B9; +} + +.dropdown-extended ul li:hover { + background-color: #CFE1F6; + color: #000000; +} + +.dropdown-extended .header, .dropdown-extended .footer { + border-color: #B9B9B9; + color: #000000; +} + +.dropdown-extended .footer { + border-top-style: solid; + border-top-width: 1px; +} + +.dropdown-extended .header { + background-color: #F1F8FF; /* Old browsers */ /* FF3.6+ */ + background-image: -webkit-linear-gradient(top, #F1F8FF 0%, #CADCEB 100%); + background-image: linear-gradient(to bottom, #F1F8FF 0%,#CADCEB 100%); /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#F1F8FF', endColorstr='#CADCEB',GradientType=0 ); /* IE6-9 */ +} + +.dropdown .pointer { + border-color: #B9B9B9 transparent; +} + +.dropdown .pointer-inner { + border-color: #FFF transparent; +} + +.dropdown-extended .pointer-inner { + border-color: #F1F8FF transparent; +} + +.dropdown .dropdown-contents { + background: #fff; + border-color: #B9B9B9; + box-shadow: 1px 3px 5px rgba(0, 0, 0, 0.2); +} + +.dropdown-up .dropdown-contents { + box-shadow: 1px 0 5px rgba(0, 0, 0, 0.2); +} + +.dropdown li, .dropdown li li { + border-color: #DCDCDC; +} + +.dropdown li.separator { + border-color: #DCDCDC; +} + +/* Notifications +---------------------------------------- */ + +.notification_list p.notification-time { + color: #4C5D77; +} + +li.notification-reported strong, li.notification-disapproved strong { + color: #D31141; +} + +.badge { + background-color: #D31141; + color: #ffffff; +} diff --git a/install/update/old/styles/prosilver/theme/common.css b/install/update/old/styles/prosilver/theme/common.css new file mode 100644 index 0000000..a0dc5e0 --- /dev/null +++ b/install/update/old/styles/prosilver/theme/common.css @@ -0,0 +1,1287 @@ +/* General Markup Styles +---------------------------------------- */ +html { + font-size: 100%; + /* Always show a scrollbar for short pages - stops the jump when the scrollbar appears. non-IE browsers */ + height: 101%; +} + +body { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 10px; + line-height: normal; + margin: 0; + padding: 12px 0; + word-wrap: break-word; + -webkit-print-color-adjust: exact; +} + +h1 { + /* Forum name */ + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + margin-right: 200px; + margin-top: 15px; + font-weight: bold; + font-size: 2em; +} + +h2 { + /* Forum header titles */ + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + font-weight: normal; + font-size: 2em; + margin: 0.8em 0 0.2em 0; +} + +h2.solo { + margin-bottom: 1em; +} + +h3 { + /* Sub-headers (also used as post headers, but defined later) */ + font-family: Arial, Helvetica, sans-serif; + font-weight: bold; + text-transform: uppercase; + border-bottom: 1px solid transparent; + margin-bottom: 3px; + padding-bottom: 2px; + font-size: 1.05em; + margin-top: 20px; +} + +h4 { + /* Forum and topic list titles */ + font-family: "Trebuchet MS", Verdana, Helvetica, Arial, Sans-serif; + font-size: 1.3em; +} + +p { + line-height: 1.3em; + font-size: 1.1em; + margin-bottom: 1.5em; +} + +img { + border-width: 0; +} + +hr { + border: 0 solid transparent; + border-top-width: 1px; + height: 1px; + margin: 5px 0; + display: block; + clear: both; +} + +hr.dashed { + border-top-style: dashed; + margin: 10px 0; +} + +hr.divider { + display: none; +} + +p.right { + text-align: right; +} + +p.jumpbox-return { + margin-top: 10px; + margin-bottom: 0; + float: left; +} + +b, strong { + font-weight: bold; +} + +.text-strong { + font-weight: bold; +} + +i, em { + font-style: italic; +} + +.text-italics { + font-style: italic; +} + +u { + text-decoration: underline; +} + +ul { + list-style-type: disc; +} + +ol { + list-style-type: decimal; +} + +li { + display: list-item; +} + +ul ul, ol ul { + list-style-type: circle; +} + +ol ol ul, ol ul ul, ul ol ul, ul ul ul { + list-style-type: square; +} + +a:hover { text-decoration: underline; } + +/* Main blocks +---------------------------------------- */ +.wrap { + border: 1px solid transparent; + border-radius: 8px; + margin: 0 auto; + max-width: 1152px; + min-width: 625px; + padding: 15px; +} + +@media only screen and (max-width: 1220px), only screen and (max-device-width: 1220px) { + .wrap { + margin: 0 12px; + } +} + +.page-body { + margin: 4px 0; + clear: both; +} + +.page-footer { + clear: both; +} + +.page-footer h3 { + margin-top: 20px; +} + +.logo { + float: left; + width: auto; + padding: 10px 13px 0 10px; +} + +.logo:hover { + text-decoration: none; +} + +.site_logo { + display: inline-block; + width: 149px; + height: 52px; +} + +/* Site description and logo */ +.site-description { + float: left; + width: 65%; +} + +.site-description h1 { + margin-right: 0; +} + +/* Round cornered boxes and backgrounds +---------------------------------------- */ +.headerbar { + margin-bottom: 4px; + padding: 5px; + border-radius: 7px; +} + +.navbar { + padding: 3px 10px; + border-radius: 7px; +} + +.forabg { + margin-bottom: 4px; + padding: 5px; + clear: both; + border-radius: 7px; +} + +.forumbg { + margin-bottom: 4px; + padding: 5px; + clear: both; + border-radius: 7px; +} + +.panel { + margin-bottom: 4px; + padding: 5px 10px; + border-radius: 7px; +} + +.post { + padding: 5px 10px; + margin-bottom: 4px; + background-repeat: no-repeat; + background-position: 100% 0; + border-radius: 7px; + position: relative; +} + +.rowbg { + margin: 5px 5px 2px 5px; +} + +/* Horizontal lists +----------------------------------------*/ +.navbar ul.linklist { + padding: 2px 0; + list-style-type: none; +} + +ul.linklist { + display: block; + margin: 0; +} + +.cp-main .panel { + padding: 5px 10px; +} + +ul.linklist > li { + float: left; + font-size: 1.1em; + line-height: 2.2em; + list-style-type: none; + margin-right: 7px; + padding-top: 1px; + width: auto; +} + +ul.linklist > li.rightside, p.rightside, a.rightside { + float: right; + margin-right: 0; + margin-left: 7px; + text-align: right; +} + +ul.navlinks { + border-top: 1px solid transparent; +} + +ul.leftside { + float: left; + margin-left: 0; + margin-right: 5px; + text-align: left; +} + +ul.rightside { + float: right; + margin-left: 5px; + margin-right: -5px; + text-align: right; +} + +ul.linklist li.responsive-menu { + position: relative; + margin: 0 5px 0 0; +} + +.hasjs ul.linklist.leftside, .hasjs ul.linklist.rightside { + max-width: 48%; +} + +.hasjs ul.linklist.fullwidth { + max-width: none; +} + +li.responsive-menu.dropdown-right .dropdown { + left: -9px; +} + +li.responsive-menu.dropdown-left .dropdown { + right: -6px; +} + +ul.linklist .dropdown { + top: 22px; +} + +ul.linklist .dropdown-up .dropdown { + bottom: 18px; + top: auto; +} + +/* Bulletin icons for list items +----------------------------------------*/ +ul.linklist.bulletin > li:before { + display: inline-block; + content: "\2022"; + font-size: inherit; + line-height: inherit; + padding-right: 4px; +} + +ul.linklist.bulletin > li:first-child:before, +ul.linklist.bulletin > li.rightside:last-child:before { + content: none; +} + +ul.linklist.bulletin > li.no-bulletin:before { + content: none; +} + +.responsive-menu:before { + display: none !important; +} + +/* Profile in overall_header.html */ +.header-profile { + display: inline-block; + vertical-align: top; +} + +a.header-avatar, +a.header-avatar:hover { + text-decoration: none; +} + +a.header-avatar img { + margin-bottom: 2px; + max-height: 20px; + vertical-align: middle; + width: auto; +} + +a.header-avatar span:after { + content: '\f0dd'; + display: inline-block; + font: normal normal normal 14px/1 FontAwesome; + padding-left: 6px; + padding-top: 2px; + vertical-align: top; +} + +/* Dropdown menu +----------------------------------------*/ +.dropdown-container { + position: relative; +} + +.dropdown-container-right { + float: right; +} + +.dropdown-container-left { + float: left; +} + +.nojs .dropdown-container:hover .dropdown { + display: block !important; +} + +.dropdown { + display: none; + position: absolute; + left: 0; + top: 1.2em; + z-index: 2; + border: 1px solid transparent; + border-radius: 5px; + padding: 9px 0 0; + margin-right: -500px; +} + +.dropdown.live-search { + top: auto; +} + +.dropdown-container.topic-tools { + float: left; +} + +.dropdown-up .dropdown { + top: auto; + bottom: 1.2em; + padding: 0 0 9px; +} + +.dropdown-left .dropdown, .nojs .rightside .dropdown { + left: auto; + right: 0; + margin-left: -500px; + margin-right: 0; +} + +.dropdown-button-control .dropdown { + top: 24px; +} + +.dropdown-button-control.dropdown-up .dropdown { + top: auto; + bottom: 24px; +} + +.dropdown .pointer, .dropdown .pointer-inner { + position: absolute; + width: 0; + height: 0; + border-top-width: 0; + border-bottom: 10px solid transparent; + border-left: 10px dashed transparent; + border-right: 10px dashed transparent; + -webkit-transform: rotate(360deg); /* better anti-aliasing in webkit */ + display: block; +} + +.dropdown-up .pointer, .dropdown-up .pointer-inner { + border-bottom-width: 0; + border-top: 10px solid transparent; +} + +.dropdown .pointer { + right: auto; + left: 10px; + top: -1px; + z-index: 3; +} + +.dropdown-up .pointer { + bottom: -1px; + top: auto; +} + +.dropdown-left .dropdown .pointer, .nojs .rightside .dropdown .pointer { + left: auto; + right: 10px; +} + +.dropdown .pointer-inner { + top: auto; + bottom: -11px; + left: -10px; +} + +.dropdown-up .pointer-inner { + bottom: auto; + top: -11px; +} + +.dropdown .dropdown-contents { + z-index: 2; + overflow: hidden; + overflow-y: auto; + border: 1px solid transparent; + border-radius: 5px; + padding: 5px; + position: relative; + max-height: 300px; +} + +.dropdown-contents a { + display: block; + padding: 5px; +} + +.jumpbox { + margin: 5px 0; +} + +.jumpbox .dropdown li { + border-top: 1px solid transparent; +} + +.jumpbox .dropdown-select { + margin: 0; +} + +.jumpbox .dropdown-contents { + padding: 0; + text-decoration: none; +} + +.jumpbox .dropdown-contents li { + padding: 0; +} + +.jumpbox .dropdown-contents a { + margin-right: 20px; + padding: 5px 10px; + text-decoration: none; + width: 100%; +} + +.jumpbox .spacer { + display: inline-block; + width: 0px; +} + +.jumpbox .spacer + .spacer { + width: 20px; +} + +.dropdown-contents a { + display: block; + padding: 5px; +} + +.jumpbox .dropdown-select { + margin: 0; +} + +.jumpbox .dropdown-contents a { + text-decoration: none; +} + +.dropdown li { + display: list-item; + border-top: 1px dotted transparent; + float: none !important; + line-height: normal !important; + font-size: 1em !important; + list-style: none; + margin: 0; + white-space: nowrap; + text-align: left; +} + +.dropdown-contents > li { + padding-right: 15px; +} + +.dropdown-nonscroll > li { + padding-right: 0; +} + +.dropdown li:first-child, .dropdown li.separator + li, .dropdown li li { + border-top: 0; +} + +.dropdown li li:first-child { + margin-top: 4px; +} + +.dropdown li li:last-child { + padding-bottom: 0; +} + +.dropdown li li { + border-top: 1px dotted transparent; + padding-left: 18px; +} + +.wrap .dropdown li, .dropdown.wrap li, .dropdown-extended li { + white-space: normal; +} + +.dropdown li.separator { + border-top: 1px solid transparent; + padding: 0; +} + +.dropdown li.separator:first-child, .dropdown li.separator:last-child { + display: none !important; +} + +/* Responsive breadcrumbs +----------------------------------------*/ +.breadcrumbs .crumb { + float: left; + font-weight: bold; + word-wrap: normal; +} + +.breadcrumbs .crumb:before { + content: '\2039'; + font-weight: bold; + padding: 0 0.5em; +} + +.breadcrumbs .crumb:first-child:before { + content: none; +} + +.breadcrumbs .crumb a { + white-space: nowrap; + text-overflow: ellipsis; + vertical-align: bottom; + overflow: hidden; +} + +.breadcrumbs.wrapped .crumb a { letter-spacing: -.3px; } +.breadcrumbs.wrapped .crumb.wrapped-medium a { letter-spacing: -.4px; } +.breadcrumbs.wrapped .crumb.wrapped-tiny a { letter-spacing: -.5px; } + +.breadcrumbs .crumb.wrapped-max a { max-width: 120px; } +.breadcrumbs .crumb.wrapped-wide a { max-width: 100px; } +.breadcrumbs .crumb.wrapped-medium a { max-width: 80px; } +.breadcrumbs .crumb.wrapped-small a { max-width: 60px; } +.breadcrumbs .crumb.wrapped-tiny a { max-width: 40px; } + +/* Table styles +----------------------------------------*/ +table.table1 { + width: 100%; +} + +.ucp-main table.table1 { + padding: 2px; +} + +table.table1 thead th { + font-weight: normal; + text-transform: uppercase; + line-height: 1.3em; + font-size: 1em; + padding: 0 0 4px 3px; +} + +table.table1 thead th span { + padding-left: 7px; +} + +table.table1 tbody tr { + border: 1px solid transparent; +} + +table.table1 td { + font-size: 1.1em; +} + +table.table1 tbody td { + padding: 5px; + border-top: 1px solid transparent; +} + +table.table1 tbody th { + padding: 5px; + border-bottom: 1px solid transparent; + text-align: left; +} + +/* Specific column styles */ +table.table1 .name { text-align: left; } +table.table1 .center { text-align: center; } +table.table1 .reportby { width: 15%; } +table.table1 .posts { text-align: center; width: 7%; } +table.table1 .joined { text-align: left; width: 15%; } +table.table1 .active { text-align: left; width: 15%; } +table.table1 .mark { text-align: center; width: 7%; } +table.table1 .info { text-align: left; width: 30%; } +table.table1 .info div { width: 100%; white-space: normal; overflow: hidden; } +table.table1 .autocol { line-height: 2em; white-space: nowrap; } +table.table1 thead .autocol { padding-left: 1em; } + +table.table1 span.rank-img { + float: right; + width: auto; +} + +table.info td { + padding: 3px; +} + +table.info tbody th { + padding: 3px; + text-align: right; + vertical-align: top; + font-weight: normal; +} + +.forumbg table.table1 { + margin: 0; +} + +.forumbg-table > .inner { + margin: 0 -1px; +} + +.color_palette_placeholder table { + border-collapse: separate; + border-spacing: 1px; +} + +/* Misc layout styles +---------------------------------------- */ +/* column[1-2] styles are containers for two column layouts */ +.column1 { + float: left; + clear: left; + width: 49%; +} + +.column2 { + float: right; + clear: right; + width: 49%; +} + +/* General classes for placing floating blocks */ +.left-box { + float: left; + width: auto; + text-align: left; + max-width: 100%; +} + +.left-box.profile-details { + width: 80%; +} + +.right-box { + float: right; + width: auto; + text-align: right; + max-width: 100%; +} + +dl.details { + /*font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif;*/ + font-size: 1.1em; +} + +dl.details dt { + float: left; + clear: left; + width: 30%; + text-align: right; + display: block; +} + +dl.details dd { + margin-left: 0; + padding-left: 5px; + margin-bottom: 5px; + float: left; + width: 65%; + overflow: hidden; + text-overflow: ellipsis; +} + +.clearfix, fieldset dl, ul.topiclist dl, dl.polls { + overflow: hidden; +} + +fieldset.fields1 ul.recipients { + list-style-type: none; + line-height: 1.8; + max-height: 150px; + overflow-y: auto; +} + +fieldset.fields1 dd.recipients { + clear: left; + margin-left: 1em; +} + +fieldset.fields1 ul.recipients input.button2{ + font-size: 0.8em; + margin-right: 0; + padding: 0; +} + +fieldset.fields1 dl.pmlist > dt { + width: auto !important; +} + +fieldset.fields1 dl.pmlist dd.recipients { + margin-left: 0 !important; +} + +/* Action-bars (container for post/reply buttons, pagination, etc.) +---------------------------------------- */ +.action-bar { + font-size: 11px; + margin: 4px 0; +} + +.forabg + .action-bar { + margin-top: 2em; +} + +.action-bar .button { + margin-right: 5px; + float: left; +} + +.action-bar .button-search { + margin-right: 0; +} + +/* Pagination +---------------------------------------- */ +.pagination { + float: right; + text-align: right; + width: auto; +} + +.action-bar.bar-bottom .pagination { + margin-top: 0; +} + +.action-bar .pagination .button { + margin-right: 0; + float: none; +} + +.pagination > ul { + display: inline-block; + list-style: none !important; + margin-left: 5px; +} + +.pagination > ul > li { + display: inline-block !important; + padding: 0; + font-size: 100%; + line-height: normal; + vertical-align: middle; +} + +.pagination li a, .pagination li span { + border-radius: 2px; + padding: 2px 5px; +} + +.pagination li.active span { + display: inline-block; + font-size: 13px; + font-weight: normal; + font-family: "Open Sans", "Droid Sans", Verdana, Arial, Helvetica; + line-height: 1.4; + text-align: center; + white-space: nowrap; + vertical-align: middle; + border: 1px solid transparent; +} + +.pagination li.ellipsis span { + border: none; + padding: 0; +} + +.pagination li.page-jump { + margin-right: 5px; +} + +.pagination li.page-jump a { + padding: 0 8px; +} + +.pagination li.page-jump a i { + font-size: 21px; +} + +.pagination .arrow a { + padding: 2px 0; +} + +/* Pagination in viewforum for multipage topics */ +.row .pagination { + display: block; + margin-top: 3px; + margin-bottom: 3px; +} + +.row .pagination > ul { + margin: 0; +} + +.row .pagination li a, .row .pagination li span { + border-radius: 2px; + padding: 1px 3px; + font-size: 9px; +} + +/* jQuery popups +---------------------------------------- */ +.phpbb_alert { + border: 1px solid transparent; + display: none; + left: 0; + padding: 0 25px 20px 25px; + position: fixed; + right: 0; + top: 150px; + z-index: 50; + width: 620px; + margin: 0 auto; +} + +@media only screen and (max-height: 500px), only screen and (max-device-width: 500px) +{ + .phpbb_alert { + top: 25px; + } +} + +.phpbb_alert .alert_close { + float: right; + margin-right: -36px; + margin-top: -8px; +} + +.phpbb_alert p { + margin: 8px 0; + padding-bottom: 8px; +} + +.phpbb_alert label { + display: block; + margin: 8px 0; + padding-bottom: 8px; +} + +.phpbb_alert div.alert_text > p, +.phpbb_alert div.alert_text > label, +.phpbb_alert div.alert_text > select, +.phpbb_alert div.alert_text > textarea, +.phpbb_alert div.alert_text > input { + font-size: 1.1em; +} + +.darkenwrapper { + display: none; + position: relative; + z-index: 44; +} + +.darken { + position: fixed; + left: 0; + top: 0; + width: 100%; + height: 100%; + opacity: 0.5; + z-index: 45; +} + +.loading_indicator { + background: center center no-repeat; + border-radius: 5px; + display: none; + opacity: 0.8; + margin-top: -50px; + margin-left: -50px; + height: 50px; + width: 50px; + position: fixed; + left: 50%; + top: 50%; + z-index: 51; +} + +/* Miscellaneous styles +---------------------------------------- */ +.copyright { + font-size: 10px; + text-align: center; + padding: 10px; +} + +.footer-row { + font-size: 10px; + line-height: 1.8; + margin: 0; +} + +.small { + font-size: 0.9em !important; +} + +.titlespace { + margin-bottom: 15px; +} + +.headerspace { + margin-top: 20px; +} + +.error { + font-weight: bold; + font-size: 1em; +} + +div.rules { + margin: 10px 0; + font-size: 1.1em; + padding: 5px 10px; + border-radius: 7px; +} + +div.rules ul, div.rules ol { + margin-left: 20px; +} + +p.post-notice { + position: relative; + padding: 5px; + min-height: 14px; + margin-bottom: 1em; +} + +form > p.post-notice strong { + line-height: 20px; +} + +.stat-block { + clear: both; +} + +.top-anchor { + display: block; + position: absolute; + top: -20px; +} + +.clear { + display: block; + clear: both; + font-size: 1px; + line-height: 1px; + background: transparent; +} + +/* Inner box-model clearing */ +.inner:after, +ul.linklist:after, +.action-bar:after, +.notification_text:after, +.tabs-container:after, +.tabs > ul:after, +.minitabs > ul:after, +.postprofile .avatar-container:after { + clear: both; + content: ''; + display: block; +} + +.emoji { + min-height: 18px; + min-width: 18px; + height: 1em; + width: 1em; +} + +.smilies { + vertical-align: text-bottom; +} + +.icon-notification { + position: relative; +} + +.member-search { + float: left; + margin: 0; + padding: 6px 10px; +} + +.member-search strong { + font-size: 0.95em; +} + +.dropdown-extended { + display: none; + z-index: 1; +} + +.dropdown-extended ul { + max-height: 350px; + overflow-y: auto; + overflow-x: hidden; + clear: both; +} + +.dropdown-extended ul li { + padding: 0; + margin: 0 !important; + float: none; + border-top: 1px solid; + list-style-type: none; + font-size: 0.95em; + clear: both; + position: relative; +} + +.dropdown-extended ul li:first-child { + border-top: none; +} + +.dropdown-extended ul li.no_notifications { + padding: 10px; +} + +.dropdown-extended .dropdown-contents { + max-height: none; + padding: 0; + position: absolute; + width: 340px; +} + +.nojs .dropdown-extended .dropdown-contents { + position: relative; +} + +.dropdown-extended .header { + padding: 0 10px; + font-family: Arial, "Helvetica Neue", Helvetica, Arial, sans-serif; + font-weight: bold; + text-align: left; + text-shadow: 1px 1px 1px white; + text-transform: uppercase; + line-height: 3em; + border-bottom: 1px solid; + border-radius: 5px 5px 0 0; +} + +.dropdown-extended .header .header_settings { + float: right; + font-weight: normal; + text-transform: none; +} + +.dropdown-extended .header .header_settings a { + display: inline-block; + padding: 0 5px; +} + +.dropdown-extended .header:after { + content: ''; + display: table; + clear: both; +} + +.dropdown-extended .footer { + text-align: center; + font-size: 1.1em; +} + +.dropdown-extended ul li a, .dropdown-extended ul li.no-url { + padding: 8px; +} + +.dropdown-extended .footer > a { + padding: 5px 0; +} + +.dropdown-extended ul li a, .notification_list dt > a, .dropdown-extended .footer > a { + display: block; + text-decoration: none; +} + +.notification_list ul li img { + float: left; + max-height: 50px; + max-width: 50px; + width: auto !important; + height: auto !important; + margin-right: 5px; +} + +.notification_list ul li p { + margin-bottom: 4px; + font-size: 1em; +} + +.notification_list p.notification-reference, +.notification_list p.notification-location, +.notification_list li a p.notification-reason { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.notification_list p.notification-time { + font-size: 0.9em; + margin: 0; + text-align: right; +} + +.notification_list div.notifications { + margin-left: 50px; + padding: 5px; +} + +.notification_list div.notifications a { + display: block; +} + +.notification_list p.notifications_title { + font-family: "Trebuchet MS", Arial, Helvetica, sans-serif; + font-size: 1.2em !important; +} + +.notification_list p.notifications_title strong { + font-weight: bold; +} + +.notification_list p.notifications_time { + font-size: 0.9em !important; +} + +.notification_text { + margin-left: 58px; +} + +.badge { + border-radius: 10px; + opacity: 0.8; + text-align: center; + white-space: nowrap; + font-size: 10px; + line-height: 1; + float: right; + display: inline-block; + margin-left: 3px; + vertical-align: baseline; + position: relative; + top: 3px; + padding: 4px 6px; +} + +.badge.hidden { + display: none; +} + +/* Navbar specific list items +----------------------------------------*/ + +.linklist .quick-links { + margin: 0 7px 0 0; +} + +.linklist.compact .rightside > a > span { + display: none; +} + +.dropdown-page-jump .dropdown { + top: 20px; +} + +.dropdown-page-jump.dropdown-up .dropdown { + bottom: 20px; +} + +.dropdown-page-jump input.tiny { + width: 50px; +} + +.dropdown .clone.hidden { + display: none; +} + +.dropdown .clone.hidden + li.separator { + display: none; +} + +.dropdown .clone.hidden + li { + border-top: none; +} diff --git a/install/update/old/styles/prosilver/theme/forms.css b/install/update/old/styles/prosilver/theme/forms.css new file mode 100644 index 0000000..5646a7d --- /dev/null +++ b/install/update/old/styles/prosilver/theme/forms.css @@ -0,0 +1,429 @@ +/* Form Styles +---------------------------------------- */ + +/* General form styles +----------------------------------------*/ +fieldset { + border-width: 0; + font-family: Verdana, Helvetica, Arial, sans-serif; + font-size: 1.1em; +} + +input { + font-weight: normal; + vertical-align: middle; + padding: 0 3px; + font-size: 1em; + font-family: Verdana, Helvetica, Arial, sans-serif; +} + +select { + font-family: Verdana, Helvetica, Arial, sans-serif; + font-weight: normal; + cursor: pointer; + vertical-align: middle; + border: 1px solid transparent; + padding: 1px; + font-size: 1em; +} + +select:focus { + outline-style: none; +} + +option { + padding-right: 1em; +} + +select optgroup option { + padding-right: 1em; + font-family: Verdana, Helvetica, Arial, sans-serif; +} + +textarea { + font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + width: 60%; + padding: 2px; + font-size: 1em; + line-height: 1.4em; +} + +label { + cursor: default; + padding-right: 5px; +} + +label input { + vertical-align: middle; +} + +label img { + vertical-align: middle; +} + +/* Definition list layout for forms +---------------------------------------- */ +fieldset dl { + padding: 4px 0; +} + +fieldset dt { + float: left; + width: 40%; + text-align: left; + display: block; +} + +fieldset dd { + margin-left: 41%; + vertical-align: top; + margin-bottom: 3px; +} + +/* Specific layout 1 */ +fieldset.fields1 dt { + width: 15em; + border-right-width: 0; +} + +fieldset.fields1 dd { + margin-left: 15em; + border-left-width: 0; +} + +fieldset.fields1 div { + margin-bottom: 3px; +} + +/* Set it back to 0px for the reCaptcha divs: PHPBB3-9587 */ +fieldset.fields1 .live-search div { + margin-bottom: 0; +} + +/* Specific layout 2 */ +fieldset.fields2 dt { + width: 15em; + border-right-width: 0; +} + +fieldset.fields2 dd { + margin-left: 16em; + border-left-width: 0; +} + +/* Form elements */ +dt label { + font-weight: bold; + text-align: left; +} + +dd label { + white-space: nowrap; +} + +dd input, dd textarea { + margin-right: 3px; +} + +dd select { + width: auto; +} + +dd select[multiple] { + width: 100%; +} + +dd textarea { + width: 85%; +} + +/* Hover effects */ +.timezone { + width: 95%; +} + +/* Browser-specific tweaks */ +button::-moz-focus-inner { + padding: 0; + border: 0 +} + +/* Quick-login on index page */ +fieldset.quick-login { + margin-top: 5px; +} + +fieldset.quick-login input { + width: auto; +} + +fieldset.quick-login input.inputbox { + width: 15%; + vertical-align: middle; + margin-right: 5px; +} + +fieldset.quick-login label { + white-space: nowrap; + padding-right: 2px; +} + +/* Display options on viewtopic/viewforum pages */ +fieldset.display-options { + text-align: center; + margin: 3px 0 5px 0; +} + +fieldset.display-options label { + white-space: nowrap; + padding-right: 2px; +} + +fieldset.display-options a { + margin-top: 3px; +} + +.dropdown fieldset.display-options { + font-size: 1em; + margin: 0; + padding: 0; +} + +.dropdown fieldset.display-options label { + display: block; + margin: 4px; + padding: 0; + text-align: right; + white-space: nowrap; +} + +.dropdown fieldset.display-options select { + min-width: 120px; +} + +/* Display actions for ucp and mcp pages */ +fieldset.display-actions { + text-align: right; + line-height: 2em; + white-space: nowrap; + padding-right: 1em; +} + +fieldset.display-actions label { + white-space: nowrap; + padding-right: 2px; +} + +fieldset.sort-options { + line-height: 2em; +} + +/* MCP forum selection*/ +fieldset.forum-selection { + margin: 5px 0 3px 0; + float: right; +} + +fieldset.forum-selection2 { + margin: 13px 0 3px 0; + float: right; +} + +/* Submit button fieldset */ +fieldset.submit-buttons { + text-align: center; + vertical-align: middle; + margin: 5px 0; +} + +fieldset.submit-buttons input { + vertical-align: middle; +} + +/* Posting page styles +----------------------------------------*/ + +/* Buttons used in the editor */ +.format-buttons { + margin: 15px 0 2px 0; +} + +.format-buttons input, .format-buttons select { + vertical-align: middle; +} + +/* Main message box */ +.message-box { + width: 80%; +} + +.message-box textarea { + font-family: "Trebuchet MS", Verdana, Helvetica, Arial, sans-serif; + width: 450px; + height: 270px; + min-width: 100%; + max-width: 100%; + font-size: 1.2em; + resize: vertical; + outline: 3px dashed transparent; + outline-offset: -4px; + -webkit-transition: all .5s ease, height 1ms linear; + -moz-transition: all .5s ease, height 1ms linear; + -ms-transition: all .5s ease, height 1ms linear; + -o-transition: all .5s ease, height 1ms linear; + transition: all .5s ease, height 1ms linear; +} + +/* Emoticons panel */ +.smiley-box { + width: 18%; + float: right; +} + +.smiley-box img { + margin: 3px; +} + +/* Input field styles +---------------------------------------- */ +.inputbox { + border: 1px solid transparent; + padding: 2px; +} + +.inputbox:hover, .inputbox:focus { + border: 1px solid transparent; + outline-style: none; +} + +input.inputbox { width: 85%; } +input.medium { width: 50%; } +input.narrow { width: 25%; } +input.tiny { width: 150px; } + +textarea.inputbox { + width: 85%; +} + +.autowidth { + width: auto !important; +} + +input[type="number"] { + -moz-padding-end: 0; +} + +input[type="search"] { + -webkit-appearance: textfield; + -webkit-box-sizing: content-box; +} + +input[type="search"]::-webkit-search-decoration, input[type="search"]::-webkit-search-results-button, input[type="search"]::-webkit-search-results-decoration { + display: none; +} + +input[type="search"]::-webkit-search-cancel-button { + cursor: pointer; +} + +/* Form button styles +---------------------------------------- */ +input.button1, input.button2 { + font-size: 1em; +} + +a.button1, input.button1, input.button3, a.button2, input.button2 { + width: auto !important; + padding-top: 1px; + padding-bottom: 1px; + font-family: "Lucida Grande", Verdana, Helvetica, Arial, sans-serif; + background: transparent none repeat-x top left; + line-height: 1.5; +} + +a.button1, input.button1 { + font-weight: bold; + border: 1px solid transparent; +} + +input.button3 { + padding: 0; + margin: 0; + line-height: 5px; + height: 12px; + background-image: none; + font-variant: small-caps; +} + +input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"] { + cursor: pointer; +} + +/* Alternative button */ +a.button2, input.button2, input.button3 { + border: 1px solid transparent; +} + +/* button in the style of the form buttons */ +a.button1, a.button2 { + text-decoration: none; + padding: 0 3px; + vertical-align: text-bottom; +} + +/* Hover states */ +a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover { + border: 1px solid transparent; +} + +input.disabled { + font-weight: normal; +} + +/* Focus states */ +input.button1:focus, input.button2:focus, input.button3:focus { + outline-style: none; +} + +/* Topic and forum Search */ +.search-box { + float: left; +} + +.search-box .inputbox { + background-image: none; + border-right-width: 0; + border-radius: 4px 0 0 4px; + float: left; + height: 24px; + padding: 3px; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; +} + +/* Search box (header) +--------------------------------------------- */ +.search-header { + border-radius: 4px; + display: block; + float: right; + margin-right: 5px; + margin-top: 30px; +} + +.search-header .inputbox { border: 0; } + +.navbar .linklist > li.responsive-search { display: none; } + +input.search { + background-image: none; + background-repeat: no-repeat; + background-position: left 1px; + padding-left: 17px; +} + +.full { width: 95%; } +.medium { width: 50%;} +.narrow { width: 25%;} +.tiny { width: 10%;} diff --git a/install/update/old/styles/prosilver/theme/icons.css b/install/update/old/styles/prosilver/theme/icons.css new file mode 100644 index 0000000..6643f12 --- /dev/null +++ b/install/update/old/styles/prosilver/theme/icons.css @@ -0,0 +1,96 @@ +/* -------------------------------------------------------------- + $Icons +-------------------------------------------------------------- */ + +/* Global module setup +--------------------------------*/ + +/* Renamed version of .fa class for agnostic useage of icon fonts. + * Just change the name of the font after the 14/1 to the name of + * the font you wish to use. + */ +.icon, .button .icon, blockquote cite:before, .uncited:before { + display: inline-block; + font-weight: normal; + font-style: normal; + font-variant: normal; + font-family: FontAwesome; + font-size: 14px; + line-height: 1; + text-rendering: auto; /* optimizelegibility throws things off #1094 */ + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon:before { padding-right: 2px; } + +.button .icon:before { + padding-right: 0; +} + +/* Icon size classes - Default size is 14px, use these for small variations */ + +.icon.icon-xl { + font-size: 20px; +} + +.icon.icon-lg { + font-size: 16px; +} + +.icon.icon-md { + font-size: 10px; +} + +.icon.icon-sm { + font-size: 8px; +} + +/* icon modifiers */ +.icon-tiny { + width: 12px; + transform: scale(0.65, 0.75); + vertical-align: text-bottom; + font-size: 16px; +} + +.arrow-left .icon { + float: left; +} + +.arrow-left:hover .icon { + margin-left: -5px; + margin-right: 5px; +} + +.arrow-right .icon { + float: right; +} + +.arrow-right:hover .icon { + margin-left: 5px; + margin-right: -5px; +} + +.post-buttons .dropdown-contents .icon { + float: right; + margin-left: 5px; +} + +.alert_close .icon:before { + padding: 0; + border-radius: 50%; + width: 11px; + display: block; + line-height: .9; + height: 12px; +} + +blockquote cite:before, .uncited:before { + content: '\f10d'; /* Font Awesome quote-left */ +} + +.rtl blockquote cite:before, .rtl .uncited:before { + content: '\f10e'; /* Font Awesome quote-right */ +} + diff --git a/install/update/old/styles/prosilver/theme/plupload.css b/install/update/old/styles/prosilver/theme/plupload.css new file mode 100644 index 0000000..f466803 --- /dev/null +++ b/install/update/old/styles/prosilver/theme/plupload.css @@ -0,0 +1,86 @@ +.attach-panel-multi { + display: none; + margin-bottom: 1em; +} + +.file-list td { + vertical-align: middle; +} + +.attach-name { + width: 50%; +} + +.attach-comment { + width: 30%; +} + +.attach-comment .inputbox { + resize: vertical; + width: 100%; +} + +.attach-filesize { + width: 15%; +} + +.attach-status { + width: 5%; +} + +.attach-filesize, .attach-status { + text-align: center; +} + +.attach-controls { + display: inline-block; + float: right; +} + +.nojs .file-inline-bbcode { + display: none; +} + +.file-total-progress { + height: 2px; + display: block; + position: relative; + margin: 4px -10px -6px -10px; +} + +.file-progress { + background-color: #CCCCCC; + display:inline-block; + height: 8px; + width: 50px; +} + +.file-progress-bar, .file-total-progress-bar { + background-color: green; + display: block; + height: 100%; + width: 0; +} + +.file-status.file-working { + background: url('./images/plupload/throbber.gif'); +} + +.file-status.file-uploaded { + background: url('./images/plupload/done.gif'); +} + +.file-status.file-error { + background: url('./images/plupload/error.gif'); +} + +.file-status { + display: inline-block; + height: 16px; + width: 16px; +} + +.file-name { + max-width: 65%; + vertical-align: bottom; +} diff --git a/install/update/old/styles/prosilver/theme/print.css b/install/update/old/styles/prosilver/theme/print.css new file mode 100644 index 0000000..9445279 --- /dev/null +++ b/install/update/old/styles/prosilver/theme/print.css @@ -0,0 +1,150 @@ +/* Print Style Sheet +---------------------------------------- */ + + +/* Lots still TODO here! */ + +/* General markup styles */ +* { + padding: 0; + margin: 0; +} + +body { + font: 11pt Verdana, Arial, Helvetica, sans-serif; + color:#000000; +} + +a:link { color: #000000; text-decoration: none; } +a:visited { color: #000000; text-decoration: none; } +a:active { color: #000000; text-decoration: none; } + +img, .noprint, .navbar, .box1, .divider, .signature { display: none; } +/* Display smilies (Bug #47265) */ +.content img { + display: inline; +} + +/* Container for the main body */ +.wrap { + margin: 0 2em; +} + +p { font-size: 85%; } +.copyright { font-size: 75%; } +.page-number { float:right; width: auto; text-align: right; font-size: 75%; } + +h1, h2, h3, h1 a, h2 a, h3 a { + font-family: "Trebuchet MS",georgia,Verdana,Sans-serif; + color: #000000; + background: none; + text-decoration: none; + font-weight: bold; +} + +h1 { font-size: 20pt; } +h2 { font-size: 16pt; margin-top: 1em; } +h3 { font-size: 14pt; margin-top: 1em; } + +.content { + font-size: 11pt; + line-height: 14pt; + margin-bottom: 1em; + font-family: "Lucida Grande", "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif; + overflow: hidden; +} + +/* CSS2 Print tip from: http://www.alistapart.com/articles/goingtoprint/ */ +.postbody a:link, .postbody a:visited, .postbody a:hover, .postbody a:active { + text-decoration: underline; + padding: 0.1em 0.2em; + margin: -0.1em -0.2em; + color: #666; + background: none; + font-size: 100%; +} + +html>body .postbody a:link:after, html>body .postbody a:visited:after { + content: " (" attr(href) ") "; + font-size: 90%; + text-decoration: none; +} + +hr { + height: 1px; + background-color: #999999; + border-width: 0; +} + +.author { + font-family: Verdana, Arial, Helvetica, sans-serif; + font-size: 75%; + margin-bottom: 0.6em; +} + +.date { + font-family: Verdana, Arial, Helvetica, sans-serif; + float: right; + position: relative; + text-align: right; + font-size: 75%; +} + +/* Dont want to print url for names or titles in content area */ +.postbody .author a:link, .postbody .author a:visited, +html>body .postbody .author a:link:after, +html>body .postbody .author a:visited:after, +.postquote .quote-by a:link, .postquote .quote-by a:visited, +html>body .postquote .quote-by a:link:after, +html>body .postquote .quote-by a:visited:after, +html>body .postbody h1 a:link:after, html>body .postbody h2 a:link:after { + text-decoration: none; + content: ""; +} + +/* Poster profile */ +.postprofile { display: none; } +.grip-show { display:none; } + +/* Quote */ +.postquote, blockquote { + font-size: 85%; + margin: 1em 18% 1em 4%; + padding: 0.5em; + position: relative; + line-height: 1.5em; + border: 1px #999999 solid; +} + +.postquote img { display: none; } +.postquote span { display: block; } +.postquote span .postquote { font-size: 100%; } +.quote-by, blockquote cite { + color: black; + display : block; + font-weight: bold; +} + +/* List */ +ol, ul { + margin-left: 15pt +} + +/* Misc page elements */ +div.spacer { clear: both; } + +code { display: block; } + +/* Accessibility tweaks: Mozilla.org */ +.skip_link { display: none; } + +.codebox p { display: none; } + +/* stylelint-disable declaration-property-unit-whitelist */ +.emoji { + min-height: 18px; + min-width: 18px; + height: 1em; + width: 1em; +} +/* stylelint-enable declaration-property-unit-whitelist */ diff --git a/install/update/old/styles/prosilver/theme/stylesheet.css b/install/update/old/styles/prosilver/theme/stylesheet.css new file mode 100644 index 0000000..45eb5b6 --- /dev/null +++ b/install/update/old/styles/prosilver/theme/stylesheet.css @@ -0,0 +1,21 @@ +/* phpBB3 Style Sheet + -------------------------------------------------------------- + Style name: prosilver (the default phpBB 3.2.x style) + Based on style: + Original author: Tom Beddard ( http://www.subblue.com/ ) + Modified by: phpBB Limited ( https://www.phpbb.com/ ) + -------------------------------------------------------------- +*/ + +@import url("normalize.css?v=3.2"); +@import url("base.css?v=3.2"); +@import url("utilities.css?v=3.2"); +@import url("common.css?v=3.2"); +@import url("links.css?v=3.2"); +@import url("content.css?v=3.2"); +@import url("buttons.css?v=3.2"); +@import url("cp.css?v=3.2"); +@import url("forms.css?v=3.2"); +@import url("icons.css?v=3.2"); +@import url("colours.css?v=3.2"); +@import url("responsive.css?v=3.2"); diff --git a/install/update/old/ucp.php b/install/update/old/ucp.php new file mode 100644 index 0000000..96a3efe --- /dev/null +++ b/install/update/old/ucp.php @@ -0,0 +1,406 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +require($phpbb_root_path . 'common.' . $phpEx); +require($phpbb_root_path . 'includes/functions_user.' . $phpEx); +require($phpbb_root_path . 'includes/functions_module.' . $phpEx); + +// Basic parameter data +$id = $request->variable('i', ''); +$mode = $request->variable('mode', ''); + +if (in_array($mode, array('login', 'login_link', 'logout', 'confirm', 'sendpassword', 'activate'))) +{ + define('IN_LOGIN', true); +} + +if ($mode === 'delete_cookies') +{ + define('SKIP_CHECK_BAN', true); + define('SKIP_CHECK_DISABLED', true); +} + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('ucp'); + +// Setting a variable to let the style designer know where he is... +$template->assign_var('S_IN_UCP', true); + +$module = new p_master(); +$default = false; + +// Basic "global" modes +switch ($mode) +{ + case 'activate': + $module->load('ucp', 'activate'); + $module->display($user->lang['UCP_ACTIVATE']); + + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + break; + + case 'resend_act': + $module->load('ucp', 'resend'); + $module->display($user->lang['UCP_RESEND']); + break; + + case 'sendpassword': + $module->load('ucp', 'remind'); + $module->display($user->lang['UCP_REMIND']); + break; + + case 'register': + if ($user->data['is_registered'] || isset($_REQUEST['not_agreed'])) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + $module->load('ucp', 'register'); + $module->display($user->lang['REGISTER']); + break; + + case 'confirm': + $module->load('ucp', 'confirm'); + break; + + case 'login': + if ($user->data['is_registered']) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + login_box($request->variable('redirect', "index.$phpEx")); + break; + + case 'login_link': + if ($user->data['is_registered']) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + $module->load('ucp', 'login_link'); + $module->display($user->lang['UCP_LOGIN_LINK']); + break; + + case 'logout': + if ($user->data['user_id'] != ANONYMOUS && $request->is_set('sid') && $request->variable('sid', '') === $user->session_id) + { + $user->session_kill(); + } + else if ($user->data['user_id'] != ANONYMOUS) + { + meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); + + $message = $user->lang['LOGOUT_FAILED'] . '

' . sprintf($user->lang['RETURN_INDEX'], '
', ' '); + trigger_error($message); + } + + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + break; + + case 'terms': + case 'privacy': + + $message = ($mode == 'terms') ? 'TERMS_OF_USE_CONTENT' : 'PRIVACY_POLICY'; + $title = ($mode == 'terms') ? 'TERMS_USE' : 'PRIVACY'; + + if (empty($user->lang[$message])) + { + if ($user->data['is_registered']) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + login_box(); + } + + $template->set_filenames(array( + 'body' => 'ucp_agreement.html') + ); + + // Disable online list + page_header($user->lang[$title]); + + $template->assign_vars(array( + 'S_AGREEMENT' => true, + 'AGREEMENT_TITLE' => $user->lang[$title], + 'AGREEMENT_TEXT' => sprintf($user->lang[$message], $config['sitename'], generate_board_url()), + 'U_BACK' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=login'), + 'L_BACK' => $user->lang['BACK_TO_PREV'], + )); + + page_footer(); + + break; + + case 'delete_cookies': + + // Delete Cookies with dynamic names (do NOT delete poll cookies) + if (confirm_box(true)) + { + $set_time = time() - 31536000; + + foreach ($request->variable_names(\phpbb\request\request_interface::COOKIE) as $cookie_name) + { + $cookie_data = $request->variable($cookie_name, '', true, \phpbb\request\request_interface::COOKIE); + + // Only delete board cookies, no other ones... + if (strpos($cookie_name, $config['cookie_name'] . '_') !== 0) + { + continue; + } + + $cookie_name = str_replace($config['cookie_name'] . '_', '', $cookie_name); + + /** + * Event to save custom cookies from deletion + * + * @event core.ucp_delete_cookies + * @var string cookie_name Cookie name to checking + * @var bool retain_cookie Do we retain our cookie or not, true if retain + * @since 3.1.3-RC1 + */ + $retain_cookie = false; + $vars = array('cookie_name', 'retain_cookie'); + extract($phpbb_dispatcher->trigger_event('core.ucp_delete_cookies', compact($vars))); + if ($retain_cookie) + { + continue; + } + + // Polls are stored as {cookie_name}_poll_{topic_id}, cookie_name_ got removed, therefore checking for poll_ + if (strpos($cookie_name, 'poll_') !== 0) + { + $user->set_cookie($cookie_name, '', $set_time); + } + } + + $user->set_cookie('track', '', $set_time); + $user->set_cookie('u', '', $set_time); + $user->set_cookie('k', '', $set_time); + $user->set_cookie('sid', '', $set_time); + + // We destroy the session here, the user will be logged out nevertheless + $user->session_kill(); + $user->session_begin(); + + meta_refresh(3, append_sid("{$phpbb_root_path}index.$phpEx")); + + $message = $user->lang['COOKIES_DELETED'] . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + trigger_error($message); + } + else + { + confirm_box(false, 'DELETE_COOKIES', ''); + } + + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + + break; + + case 'switch_perm': + + $user_id = $request->variable('u', 0); + + $sql = 'SELECT * + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . (int) $user_id; + $result = $db->sql_query($sql); + $user_row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$auth->acl_get('a_switchperm') || !$user_row || $user_id == $user->data['user_id'] || !check_link_hash($request->variable('hash', ''), 'switchperm')) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + include($phpbb_root_path . 'includes/acp/auth.' . $phpEx); + + $auth_admin = new auth_admin(); + if (!$auth_admin->ghost_permissions($user_id, $user->data['user_id'])) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_TRANSFER_PERMISSIONS', false, array($user_row['username'])); + + $message = sprintf($user->lang['PERMISSIONS_TRANSFERRED'], $user_row['username']) . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + + /** + * Event to run code after permissions are switched + * + * @event core.ucp_switch_permissions + * @var int user_id User ID to switch permission to + * @var array user_row User data + * @var string message Success message + * @since 3.1.11-RC1 + */ + $vars = array('user_id', 'user_row', 'message'); + extract($phpbb_dispatcher->trigger_event('core.ucp_switch_permissions', compact($vars))); + + trigger_error($message); + + break; + + case 'restore_perm': + + if (!$user->data['user_perm_from'] || !$auth->acl_get('a_switchperm')) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + $auth->acl_cache($user->data); + + $sql = 'SELECT username + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user->data['user_perm_from']; + $result = $db->sql_query($sql); + $username = $db->sql_fetchfield('username'); + $db->sql_freeresult($result); + + $phpbb_log->add('admin', $user->data['user_id'], $user->ip, 'LOG_ACL_RESTORE_PERMISSIONS', false, array($username)); + + $message = $user->lang['PERMISSIONS_RESTORED'] . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); + + /** + * Event to run code after permissions are restored + * + * @event core.ucp_restore_permissions + * @var string username User name + * @var string message Success message + * @since 3.1.11-RC1 + */ + $vars = array('username', 'message'); + extract($phpbb_dispatcher->trigger_event('core.ucp_restore_permissions', compact($vars))); + + trigger_error($message); + + break; + + default: + $default = true; + break; +} + +// We use this approach because it does not impose large code changes +if (!$default) +{ + return true; +} + +// Only registered users can go beyond this point +if (!$user->data['is_registered']) +{ + if ($user->data['is_bot']) + { + redirect(append_sid("{$phpbb_root_path}index.$phpEx")); + } + + if ($id == 'pm' && $mode == 'view' && isset($_GET['p'])) + { + $redirect_url = append_sid("{$phpbb_root_path}ucp.$phpEx?i=pm&p=" . $request->variable('p', 0)); + login_box($redirect_url, $user->lang['LOGIN_EXPLAIN_UCP']); + } + + login_box('', $user->lang['LOGIN_EXPLAIN_UCP']); +} + +// Instantiate module system and generate list of available modules +$module->list_modules('ucp'); + +// Check if the zebra module is set +if ($module->is_active('zebra', 'friends')) +{ + // Output listing of friends online + $update_time = $config['load_online_time'] * 60; + + $sql_ary = array( + 'SELECT' => 'u.user_id, u.username, u.username_clean, u.user_colour, MAX(s.session_time) as online_time, MIN(s.session_viewonline) AS viewonline', + + 'FROM' => array( + USERS_TABLE => 'u', + ZEBRA_TABLE => 'z', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(SESSIONS_TABLE => 's'), + 'ON' => 's.session_user_id = z.zebra_id', + ), + ), + + 'WHERE' => 'z.user_id = ' . $user->data['user_id'] . ' + AND z.friend = 1 + AND u.user_id = z.zebra_id', + + 'GROUP_BY' => 'z.zebra_id, u.user_id, u.username_clean, u.user_colour, u.username', + + 'ORDER_BY' => 'u.username_clean ASC', + ); + + $sql = $db->sql_build_query('SELECT_DISTINCT', $sql_ary); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $which = (time() - $update_time < $row['online_time'] && ($row['viewonline'] || $auth->acl_get('u_viewonline'))) ? 'online' : 'offline'; + + $template->assign_block_vars("friends_{$which}", array( + 'USER_ID' => $row['user_id'], + + 'U_PROFILE' => get_username_string('profile', $row['user_id'], $row['username'], $row['user_colour']), + 'USER_COLOUR' => get_username_string('colour', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME' => get_username_string('username', $row['user_id'], $row['username'], $row['user_colour']), + 'USERNAME_FULL' => get_username_string('full', $row['user_id'], $row['username'], $row['user_colour'])) + ); + } + $db->sql_freeresult($result); +} + +// Do not display subscribed topics/forums if not allowed +if (!$config['allow_topic_notify'] && !$config['allow_forum_notify']) +{ + $module->set_display('main', 'subscribed', false); +} + +/** +* Use this event to enable and disable additional UCP modules +* +* @event core.ucp_display_module_before +* @var p_master module Object holding all modules and their status +* @var mixed id Active module category (can be the int or string) +* @var string mode Active module +* @since 3.1.0-a1 +*/ +$vars = array('module', 'id', 'mode'); +extract($phpbb_dispatcher->trigger_event('core.ucp_display_module_before', compact($vars))); + +// Select the active module +$module->set_active($id, $mode); + +// Load and execute the relevant module +$module->load_active(); + +// Assign data to the template engine for the list of modules +$module->assign_tpl_vars(append_sid("{$phpbb_root_path}ucp.$phpEx")); + +// Generate the page, do not display/query online list +$module->display($module->get_page_title()); diff --git a/install/update/old/viewforum.php b/install/update/old/viewforum.php new file mode 100644 index 0000000..5525a0d --- /dev/null +++ b/install/update/old/viewforum.php @@ -0,0 +1,1059 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); + +// Start session +$user->session_begin(); +$auth->acl($user->data); + +// Start initial var setup +$forum_id = $request->variable('f', 0); +$mark_read = $request->variable('mark', ''); +$start = $request->variable('start', 0); + +$default_sort_days = (!empty($user->data['user_topic_show_days'])) ? $user->data['user_topic_show_days'] : 0; +$default_sort_key = (!empty($user->data['user_topic_sortby_type'])) ? $user->data['user_topic_sortby_type'] : 't'; +$default_sort_dir = (!empty($user->data['user_topic_sortby_dir'])) ? $user->data['user_topic_sortby_dir'] : 'd'; + +$sort_days = $request->variable('st', $default_sort_days); +$sort_key = $request->variable('sk', $default_sort_key); +$sort_dir = $request->variable('sd', $default_sort_dir); + +/* @var $pagination \phpbb\pagination */ +$pagination = $phpbb_container->get('pagination'); + +// Check if the user has actually sent a forum ID with his/her request +// If not give them a nice error page. +if (!$forum_id) +{ + trigger_error('NO_FORUM'); +} + +$sql_from = FORUMS_TABLE . ' f'; +$lastread_select = ''; + +// Grab appropriate forum data +if ($config['load_db_lastread'] && $user->data['is_registered']) +{ + $sql_from .= ' LEFT JOIN ' . FORUMS_TRACK_TABLE . ' ft ON (ft.user_id = ' . $user->data['user_id'] . ' + AND ft.forum_id = f.forum_id)'; + $lastread_select .= ', ft.mark_time'; +} + +if ($user->data['is_registered']) +{ + $sql_from .= ' LEFT JOIN ' . FORUMS_WATCH_TABLE . ' fw ON (fw.forum_id = f.forum_id AND fw.user_id = ' . $user->data['user_id'] . ')'; + $lastread_select .= ', fw.notify_status'; +} + +$sql = "SELECT f.* $lastread_select + FROM $sql_from + WHERE f.forum_id = $forum_id"; +$result = $db->sql_query($sql); +$forum_data = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +if (!$forum_data) +{ + trigger_error('NO_FORUM'); +} + + +// Configure style, language, etc. +$user->setup('viewforum', $forum_data['forum_style']); + +// Redirect to login upon emailed notification links +if (isset($_GET['e']) && !$user->data['is_registered']) +{ + login_box('', $user->lang['LOGIN_NOTIFY_FORUM']); +} + +// Permissions check +if (!$auth->acl_gets('f_list', 'f_list_topics', 'f_read', $forum_id) || ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link'] && !$auth->acl_get('f_read', $forum_id))) +{ + if ($user->data['user_id'] != ANONYMOUS) + { + send_status_line(403, 'Forbidden'); + trigger_error('SORRY_AUTH_READ'); + } + + login_box('', $user->lang['LOGIN_VIEWFORUM']); +} + +// Forum is passworded ... check whether access has been granted to this +// user this session, if not show login box +if ($forum_data['forum_password']) +{ + login_forum_box($forum_data); +} + +// Is this forum a link? ... User got here either because the +// number of clicks is being tracked or they guessed the id +if ($forum_data['forum_type'] == FORUM_LINK && $forum_data['forum_link']) +{ + // Does it have click tracking enabled? + if ($forum_data['forum_flags'] & FORUM_FLAG_LINK_TRACK) + { + $sql = 'UPDATE ' . FORUMS_TABLE . ' + SET forum_posts_approved = forum_posts_approved + 1 + WHERE forum_id = ' . $forum_id; + $db->sql_query($sql); + } + + // We redirect to the url. The third parameter indicates that external redirects are allowed. + redirect($forum_data['forum_link'], false, true); + return; +} + +// Build navigation links +generate_forum_nav($forum_data); + +// Forum Rules +if ($auth->acl_get('f_read', $forum_id)) +{ + generate_forum_rules($forum_data); +} + +// Do we have subforums? +$active_forum_ary = $moderators = array(); + +if ($forum_data['left_id'] != $forum_data['right_id'] - 1) +{ + list($active_forum_ary, $moderators) = display_forums($forum_data, $config['load_moderators'], $config['load_moderators']); +} +else +{ + $template->assign_var('S_HAS_SUBFORUM', false); + if ($config['load_moderators']) + { + get_moderators($moderators, $forum_id); + } +} + +// Is a forum specific topic count required? +if ($forum_data['forum_topics_per_page']) +{ + $config['topics_per_page'] = $forum_data['forum_topics_per_page']; +} + +/* @var $phpbb_content_visibility \phpbb\content_visibility */ +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +// Dump out the page header and load viewforum template +$topics_count = $phpbb_content_visibility->get_count('forum_topics', $forum_data, $forum_id); +$start = $pagination->validate_start($start, $config['topics_per_page'], $topics_count); + +$page_title = $forum_data['forum_name'] . ($start ? ' - ' . $user->lang('PAGE_TITLE_NUMBER', $pagination->get_on_page($config['topics_per_page'], $start)) : ''); + +/** +* You can use this event to modify the page title of the viewforum page +* +* @event core.viewforum_modify_page_title +* @var string page_title Title of the viewforum page +* @var array forum_data Array with forum data +* @var int forum_id The forum ID +* @var int start Start offset used to calculate the page +* @since 3.2.2-RC1 +*/ +$vars = array('page_title', 'forum_data', 'forum_id', 'start'); +extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_page_title', compact($vars))); + +page_header($page_title, true, $forum_id); + +$template->set_filenames(array( + 'body' => 'viewforum_body.html') +); + +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_id); + +$template->assign_vars(array( + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . (($start == 0) ? '' : "&start=$start")), +)); + +// Not postable forum or showing active topics? +if (!($forum_data['forum_type'] == FORUM_POST || (($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) && $forum_data['forum_type'] == FORUM_CAT))) +{ + page_footer(); +} + +// Ok, if someone has only list-access, we only display the forum list. +// We also make this circumstance available to the template in case we want to display a notice. ;) +if (!$auth->acl_gets('f_read', 'f_list_topics', $forum_id)) +{ + // Add form token for login box + add_form_key('login', '_LOGIN'); + + $template->assign_vars(array( + 'S_NO_READ_ACCESS' => true, + )); + + page_footer(); +} + +// Handle marking posts +if ($mark_read == 'topics') +{ + $token = $request->variable('hash', ''); + if (check_link_hash($token, 'global')) + { + markread('topics', array($forum_id), false, $request->variable('mark_time', 0)); + } + $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + meta_refresh(3, $redirect_url); + + if ($request->is_ajax()) + { + // Tell the ajax script what language vars and URL need to be replaced + $data = array( + 'NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'], + 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'], + 'U_MARK_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics&mark_time=" . time()) : '', + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['TOPICS_MARKED'] + ); + $json_response = new \phpbb\json_response(); + $json_response->send($data); + } + + trigger_error($user->lang['TOPICS_MARKED'] . '

' . sprintf($user->lang['RETURN_FORUM'], '', '')); +} + +// Do the forum Prune thang - cron type job ... +if (!$config['use_system_cron']) +{ + /* @var $cron \phpbb\cron\manager */ + $cron = $phpbb_container->get('cron.manager'); + + $task = $cron->find_task('cron.task.core.prune_forum'); + $task->set_forum_data($forum_data); + + if ($task->is_ready()) + { + $url = $task->get_url(); + $template->assign_var('RUN_CRON_TASK', 'cron'); + } + else + { + // See if we should prune the shadow topics instead + $task = $cron->find_task('cron.task.core.prune_shadow_topics'); + $task->set_forum_data($forum_data); + + if ($task->is_ready()) + { + $url = $task->get_url(); + $template->assign_var('RUN_CRON_TASK', 'cron'); + } + } +} + +// Forum rules and subscription info +$s_watching_forum = array( + 'link' => '', + 'link_toggle' => '', + 'title' => '', + 'title_toggle' => '', + 'is_watching' => false, +); + +if ($config['allow_forum_notify'] && $forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_subscribe', $forum_id) || $user->data['user_id'] == ANONYMOUS)) +{ + $notify_status = (isset($forum_data['notify_status'])) ? $forum_data['notify_status'] : NULL; + watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0, $notify_status, $start, $forum_data['forum_name']); +} + +$s_forum_rules = ''; +gen_forum_auth_level('forum', $forum_id, $forum_data['forum_status']); + +// Topic ordering options +$limit_days = array(0 => $user->lang['ALL_TOPICS'], 1 => $user->lang['1_DAY'], 7 => $user->lang['7_DAYS'], 14 => $user->lang['2_WEEKS'], 30 => $user->lang['1_MONTH'], 90 => $user->lang['3_MONTHS'], 180 => $user->lang['6_MONTHS'], 365 => $user->lang['1_YEAR']); + +$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 'r' => $user->lang['REPLIES'], 's' => $user->lang['SUBJECT'], 'v' => $user->lang['VIEWS']); +$sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => array('t.topic_last_post_time', 't.topic_last_post_id'), 'r' => (($auth->acl_get('m_approve', $forum_id)) ? 't.topic_posts_approved + t.topic_posts_unapproved + t.topic_posts_softdeleted' : 't.topic_posts_approved'), 's' => 'LOWER(t.topic_title)', 'v' => 't.topic_views'); + +/** + * Modify the topic ordering if needed + * + * @event core.viewforum_modify_topic_ordering + * @var array sort_by_text Topic ordering options + * @var array sort_by_sql Topic orderings options SQL equivalent + * @since 3.2.5-RC1 + */ +$vars = array( + 'sort_by_text', + 'sort_by_sql', +); +extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topic_ordering', compact($vars))); + +$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; +gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); + +// Limit topics to certain time frame, obtain correct topic count +if ($sort_days) +{ + $min_post_time = time() - ($sort_days * 86400); + + $sql_array = array( + 'SELECT' => 'COUNT(t.topic_id) AS num_topics', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'WHERE' => 't.forum_id = ' . $forum_id . ' + AND (t.topic_last_post_time >= ' . $min_post_time . ' + OR t.topic_type = ' . POST_ANNOUNCE . ' + OR t.topic_type = ' . POST_GLOBAL . ') + AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.'), + ); + + /** + * Modify the sort data SQL query for getting additional fields if needed + * + * @event core.viewforum_modify_sort_data_sql + * @var int forum_id The forum_id whose topics are being listed + * @var int start Variable containing start for pagination + * @var int sort_days The oldest topic displayable in elapsed days + * @var string sort_key The sorting by. It is one of the first character of (in low case): + * Author, Post time, Replies, Subject, Views + * @var string sort_dir Either "a" for ascending or "d" for descending + * @var array sql_array The SQL array to get the data of all topics + * @since 3.1.9-RC1 + */ + $vars = array( + 'forum_id', + 'start', + 'sort_days', + 'sort_key', + 'sort_dir', + 'sql_array', + ); + extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_sort_data_sql', compact($vars))); + + $result = $db->sql_query($db->sql_build_query('SELECT', $sql_array)); + $topics_count = (int) $db->sql_fetchfield('num_topics'); + $db->sql_freeresult($result); + + if (isset($_POST['sort'])) + { + $start = 0; + } + $sql_limit_time = "AND t.topic_last_post_time >= $min_post_time"; + + // Make sure we have information about day selection ready + $template->assign_var('S_SORT_DAYS', true); +} +else +{ + $sql_limit_time = ''; +} + +// Basic pagewide vars +$post_alt = ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['FORUM_LOCKED'] : $user->lang['POST_NEW_TOPIC']; + +// Display active topics? +$s_display_active = ($forum_data['forum_type'] == FORUM_CAT && ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false; + +$s_search_hidden_fields = array('fid' => array($forum_id)); +if ($_SID) +{ + $s_search_hidden_fields['sid'] = $_SID; +} + +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + +$template->assign_vars(array( + 'MODERATORS' => (!empty($moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $moderators[$forum_id]) : '', + + 'POST_IMG' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', $post_alt) : $user->img('button_topic_new', $post_alt), + 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'), + 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), + 'FOLDER_IMG' => $user->img('topic_read', 'NO_UNREAD_POSTS'), + 'FOLDER_UNREAD_IMG' => $user->img('topic_unread', 'UNREAD_POSTS'), + 'FOLDER_HOT_IMG' => $user->img('topic_read_hot', 'NO_UNREAD_POSTS_HOT'), + 'FOLDER_HOT_UNREAD_IMG' => $user->img('topic_unread_hot', 'UNREAD_POSTS_HOT'), + 'FOLDER_LOCKED_IMG' => $user->img('topic_read_locked', 'NO_UNREAD_POSTS_LOCKED'), + 'FOLDER_LOCKED_UNREAD_IMG' => $user->img('topic_unread_locked', 'UNREAD_POSTS_LOCKED'), + 'FOLDER_STICKY_IMG' => $user->img('sticky_read', 'POST_STICKY'), + 'FOLDER_STICKY_UNREAD_IMG' => $user->img('sticky_unread', 'POST_STICKY'), + 'FOLDER_ANNOUNCE_IMG' => $user->img('announce_read', 'POST_ANNOUNCEMENT'), + 'FOLDER_ANNOUNCE_UNREAD_IMG'=> $user->img('announce_unread', 'POST_ANNOUNCEMENT'), + 'FOLDER_MOVED_IMG' => $user->img('topic_moved', 'TOPIC_MOVED'), + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'TOPIC_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'TOPIC_UNAPPROVED'), + 'DELETED_IMG' => $user->img('icon_topic_deleted', 'TOPIC_DELETED'), + 'POLL_IMG' => $user->img('icon_topic_poll', 'TOPIC_POLL'), + 'GOTO_PAGE_IMG' => $user->img('icon_post_target', 'GOTO_PAGE'), + + 'L_NO_TOPICS' => ($forum_data['forum_status'] == ITEM_LOCKED) ? $user->lang['POST_FORUM_LOCKED'] : $user->lang['NO_TOPICS'], + + 'S_DISPLAY_POST_INFO' => ($forum_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, + + 'S_IS_POSTABLE' => ($forum_data['forum_type'] == FORUM_POST) ? true : false, + 'S_USER_CAN_POST' => ($auth->acl_get('f_post', $forum_id)) ? true : false, + 'S_DISPLAY_ACTIVE' => $s_display_active, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_TOPIC_ICONS' => ($s_display_active && count($active_forum_ary)) ? max($active_forum_ary['enable_icons']) : (($forum_data['enable_icons']) ? true : false), + 'U_WATCH_FORUM_LINK' => $s_watching_forum['link'], + 'U_WATCH_FORUM_TOGGLE' => $s_watching_forum['link_toggle'], + 'S_WATCH_FORUM_TITLE' => $s_watching_forum['title'], + 'S_WATCH_FORUM_TOGGLE' => $s_watching_forum['title_toggle'], + 'S_WATCHING_FORUM' => $s_watching_forum['is_watching'], + 'S_FORUM_ACTION' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . (($start == 0) ? '' : "&start=$start")), + 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, + 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"), + 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), + 'S_SINGLE_MODERATOR' => (!empty($moderators[$forum_id]) && count($moderators[$forum_id]) > 1) ? false : true, + 'S_IS_LOCKED' => ($forum_data['forum_status'] == ITEM_LOCKED) ? true : false, + 'S_VIEWFORUM' => true, + + 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "f=$forum_id&i=main&mode=forum_view", true, $user->session_id) : '', + 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=post&f=' . $forum_id) : '', + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($start == 0) ? '' : "&start=$start")), + 'U_CANONICAL' => generate_board_url() . '/' . append_sid("viewforum.$phpEx", "f=$forum_id" . (($start) ? "&start=$start" : ''), true, ''), + 'U_MARK_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics&mark_time=" . time()) : '', +)); + +// Grab icons +$icons = $cache->obtain_icons(); + +// Grab all topic data +$rowset = $announcement_list = $topic_list = $global_announce_forums = array(); + +$sql_array = array( + 'SELECT' => 't.*', + 'FROM' => array( + TOPICS_TABLE => 't' + ), + 'LEFT_JOIN' => array(), +); + +/** +* Event to modify the SQL query before the topic data is retrieved +* +* It may also be used to override the above assigned template vars +* +* @event core.viewforum_get_topic_data +* @var array forum_data Array with forum data +* @var array sql_array The SQL array to get the data of all topics +* @var int forum_id The forum_id whose topics are being listed +* @var int topics_count The total number of topics for display +* @var int sort_days The oldest topic displayable in elapsed days +* @var string sort_key The sorting by. It is one of the first character of (in low case): +* Author, Post time, Replies, Subject, Views +* @var string sort_dir Either "a" for ascending or "d" for descending +* @since 3.1.0-a1 +* @changed 3.1.0-RC4 Added forum_data var +* @changed 3.1.4-RC1 Added forum_id, topics_count, sort_days, sort_key and sort_dir vars +* @changed 3.1.9-RC1 Fix types of properties +*/ +$vars = array( + 'forum_data', + 'sql_array', + 'forum_id', + 'topics_count', + 'sort_days', + 'sort_key', + 'sort_dir', +); +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']) +{ + if ($config['load_db_track']) + { + $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_POSTED_TABLE => 'tp'), 'ON' => 'tp.topic_id = t.topic_id AND tp.user_id = ' . $user->data['user_id']); + $sql_array['SELECT'] .= ', tp.topic_posted'; + } + + if ($config['load_db_lastread']) + { + $sql_array['LEFT_JOIN'][] = array('FROM' => array(TOPICS_TRACK_TABLE => 'tt'), 'ON' => 'tt.topic_id = t.topic_id AND tt.user_id = ' . $user->data['user_id']); + $sql_array['SELECT'] .= ', tt.mark_time'; + + if ($s_display_active && count($active_forum_ary)) + { + $sql_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TRACK_TABLE => 'ft'), 'ON' => 'ft.forum_id = t.forum_id AND ft.user_id = ' . $user->data['user_id']); + $sql_array['SELECT'] .= ', ft.mark_time AS forum_mark_time'; + } + } +} + +if ($forum_data['forum_type'] == FORUM_POST) +{ + // Get global announcement forums + $g_forum_ary = $auth->acl_getf('f_read', true); + $g_forum_ary = array_unique(array_keys($g_forum_ary)); + + $sql_anounce_array['LEFT_JOIN'] = $sql_array['LEFT_JOIN']; + $sql_anounce_array['LEFT_JOIN'][] = array('FROM' => array(FORUMS_TABLE => 'f'), 'ON' => 'f.forum_id = t.forum_id'); + $sql_anounce_array['SELECT'] = $sql_array['SELECT'] . ', f.forum_name'; + + // Obtain announcements ... removed sort ordering, sort by time in all cases + $sql_ary = array( + 'SELECT' => $sql_anounce_array['SELECT'], + 'FROM' => $sql_array['FROM'], + 'LEFT_JOIN' => $sql_anounce_array['LEFT_JOIN'], + + 'WHERE' => '(t.forum_id = ' . $forum_id . ' + AND t.topic_type = ' . POST_ANNOUNCE . ') OR + (' . $db->sql_in_set('t.forum_id', $g_forum_ary, false, true) . ' + AND t.topic_type = ' . POST_GLOBAL . ')', + + 'ORDER_BY' => 't.topic_time DESC', + ); + + /** + * Event to modify the SQL query before the announcement topic ids data is retrieved + * + * @event core.viewforum_get_announcement_topic_ids_data + * @var array forum_data Data about the forum + * @var array g_forum_ary Global announcement forums array + * @var array sql_anounce_array SQL announcement array + * @var array sql_ary SQL query array to get the announcement topic ids data + * @var int forum_id The forum ID + * + * @since 3.1.10-RC1 + */ + $vars = array( + 'forum_data', + 'g_forum_ary', + 'sql_anounce_array', + 'sql_ary', + 'forum_id', + ); + extract($phpbb_dispatcher->trigger_event('core.viewforum_get_announcement_topic_ids_data', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_ary); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if (!$phpbb_content_visibility->is_visible('topic', $row['forum_id'], $row)) + { + // Do not display announcements that are waiting for approval or soft deleted. + continue; + } + + $rowset[$row['topic_id']] = $row; + $announcement_list[] = $row['topic_id']; + + if ($forum_id != $row['forum_id']) + { + $topics_count++; + $global_announce_forums[] = $row['forum_id']; + } + } + $db->sql_freeresult($result); +} + +$forum_tracking_info = array(); + +if ($user->data['is_registered'] && $config['load_db_lastread']) +{ + $forum_tracking_info[$forum_id] = $forum_data['mark_time']; + + if (!empty($global_announce_forums)) + { + $sql = 'SELECT forum_id, mark_time + FROM ' . FORUMS_TRACK_TABLE . ' + WHERE ' . $db->sql_in_set('forum_id', $global_announce_forums) . ' + AND user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $forum_tracking_info[$row['forum_id']] = $row['mark_time']; + } + $db->sql_freeresult($result); + } +} + +// If the user is trying to reach late pages, start searching from the end +$store_reverse = false; +$sql_limit = $config['topics_per_page']; +if ($start > $topics_count / 2) +{ + $store_reverse = true; + + // Select the sort order + $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC'); + + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $topics_count - count($announcement_list)); + $sql_start = $pagination->reverse_start($start, $sql_limit, $topics_count - count($announcement_list)); +} +else +{ + // Select the sort order + $direction = (($sort_dir == 'd') ? 'DESC' : 'ASC'); + $sql_start = $start; +} + +/** + * Modify the topics sort ordering if needed + * + * @event core.viewforum_modify_sort_direction + * @var string direction Topics sort order + * @since 3.2.5-RC1 + */ +$vars = array( + 'direction', +); +extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_sort_direction', compact($vars))); + +if (is_array($sort_by_sql[$sort_key])) +{ + $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; +} +else +{ + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; +} + +if ($forum_data['forum_type'] == FORUM_POST || !count($active_forum_ary)) +{ + $sql_where = 't.forum_id = ' . $forum_id; +} +else if (empty($active_forum_ary['exclude_forum_id'])) +{ + $sql_where = $db->sql_in_set('t.forum_id', $active_forum_ary['forum_id']); +} +else +{ + $get_forum_ids = array_diff($active_forum_ary['forum_id'], $active_forum_ary['exclude_forum_id']); + $sql_where = (count($get_forum_ids)) ? $db->sql_in_set('t.forum_id', $get_forum_ids) : 't.forum_id = ' . $forum_id; +} + +// Grab just the sorted topic ids +$sql_ary = array( + 'SELECT' => 't.topic_id', + 'FROM' => array( + TOPICS_TABLE => 't', + ), + 'WHERE' => "$sql_where + AND t.topic_type IN (" . POST_NORMAL . ', ' . POST_STICKY . ") + $sql_approved + $sql_limit_time", + 'ORDER_BY' => 't.topic_type ' . ((!$store_reverse) ? 'DESC' : 'ASC') . ', ' . $sql_sort_order, +); + +/** +* Event to modify the SQL query before the topic ids data is retrieved +* +* @event core.viewforum_get_topic_ids_data +* @var array forum_data Data about the forum +* @var array sql_ary SQL query array to get the topic ids data +* @var string sql_approved Topic visibility SQL string +* @var int sql_limit Number of records to select +* @var string sql_limit_time SQL string to limit topic_last_post_time data +* @var array sql_sort_order SQL sorting string +* @var int sql_start Offset point to start selection from +* @var string sql_where SQL WHERE clause string +* @var bool store_reverse Flag indicating if we select from the late pages +* +* @since 3.1.0-RC4 +* +* @changed 3.1.3 Added forum_data +*/ +$vars = array( + 'forum_data', + 'sql_ary', + 'sql_approved', + 'sql_limit', + 'sql_limit_time', + 'sql_sort_order', + 'sql_start', + 'sql_where', + 'store_reverse', +); +extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_ids_data', compact($vars))); + +$sql = $db->sql_build_query('SELECT', $sql_ary); +$result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + +while ($row = $db->sql_fetchrow($result)) +{ + $topic_list[] = (int) $row['topic_id']; +} +$db->sql_freeresult($result); + +// For storing shadow topics +$shadow_topic_list = array(); + +if (count($topic_list)) +{ + // SQL array for obtaining topics/stickies + $sql_array = array( + 'SELECT' => $sql_array['SELECT'], + 'FROM' => $sql_array['FROM'], + 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], + + 'WHERE' => $db->sql_in_set('t.topic_id', $topic_list), + ); + + // If store_reverse, then first obtain topics, then stickies, else the other way around... + // Funnily enough you typically save one query if going from the last page to the middle (store_reverse) because + // the number of stickies are not known + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + if ($row['topic_status'] == ITEM_MOVED) + { + $shadow_topic_list[$row['topic_moved_id']] = $row['topic_id']; + } + + $rowset[$row['topic_id']] = $row; + } + $db->sql_freeresult($result); +} + +// If we have some shadow topics, update the rowset to reflect their topic information +if (count($shadow_topic_list)) +{ + // SQL array for obtaining shadow topics + $sql_array = array( + 'SELECT' => 't.*', + 'FROM' => array( + TOPICS_TABLE => 't' + ), + 'WHERE' => $db->sql_in_set('t.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 array sql_array SQL array to get the data of any shadowtopics + * @since 3.1.0-a1 + */ + $vars = array('sql_array'); + extract($phpbb_dispatcher->trigger_event('core.viewforum_get_shadowtopic_data', compact($vars))); + + $sql = $db->sql_build_query('SELECT', $sql_array); + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $orig_topic_id = $shadow_topic_list[$row['topic_id']]; + + // If the shadow topic is already listed within the rowset (happens for active topics for example), then do not include it... + if (isset($rowset[$row['topic_id']])) + { + // We need to remove any trace regarding this topic. :) + unset($rowset[$orig_topic_id]); + unset($topic_list[array_search($orig_topic_id, $topic_list)]); + $topics_count--; + + continue; + } + + // Do not include those topics the user has no permission to access + if (!$auth->acl_gets('f_read', 'f_list_topics', $row['forum_id'])) + { + // We need to remove any trace regarding this topic. :) + unset($rowset[$orig_topic_id]); + unset($topic_list[array_search($orig_topic_id, $topic_list)]); + $topics_count--; + + continue; + } + + // We want to retain some values + $row = array_merge($row, array( + 'topic_moved_id' => $rowset[$orig_topic_id]['topic_moved_id'], + 'topic_status' => $rowset[$orig_topic_id]['topic_status'], + 'topic_type' => $rowset[$orig_topic_id]['topic_type'], + 'topic_title' => $rowset[$orig_topic_id]['topic_title'], + )); + + // Shadow topics are never reported + $row['topic_reported'] = 0; + + $rowset[$orig_topic_id] = $row; + } + $db->sql_freeresult($result); +} +unset($shadow_topic_list); + +// Ok, adjust topics count for active topics list +if ($s_display_active) +{ + $topics_count = 1; +} + +// We need to remove the global announcements from the forums total topic count, +// otherwise the number is different from the one on the forum list +$total_topic_count = $topics_count - count($announcement_list); + +$base_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", "f=$forum_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '')); +$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_topic_count, $config['topics_per_page'], $start); + +$template->assign_vars(array( + 'TOTAL_TOPICS' => ($s_display_active) ? false : $user->lang('VIEW_FORUM_TOPICS', (int) $total_topic_count), +)); + +$topic_list = ($store_reverse) ? array_merge($announcement_list, array_reverse($topic_list)) : array_merge($announcement_list, $topic_list); +$topic_tracking_info = $tracking_topics = array(); + +/** +* Modify topics data before we display the viewforum page +* +* @event core.viewforum_modify_topics_data +* @var array topic_list Array with current viewforum page topic ids +* @var array rowset Array with topics data (in topic_id => topic_data format) +* @var int total_topic_count Forum's total topic count +* @var int forum_id Forum identifier +* @since 3.1.0-b3 +* @changed 3.1.11-RC1 Added forum_id +*/ +$vars = array('topic_list', 'rowset', 'total_topic_count', 'forum_id'); +extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topics_data', compact($vars))); + +// Okay, lets dump out the page ... +if (count($topic_list)) +{ + $mark_forum_read = true; + $mark_time_forum = 0; + + // Generate topic forum list... + $topic_forum_list = array(); + foreach ($rowset as $t_id => $row) + { + if (isset($forum_tracking_info[$row['forum_id']])) + { + $row['forum_mark_time'] = $forum_tracking_info[$row['forum_id']]; + } + + $topic_forum_list[$row['forum_id']]['forum_mark_time'] = ($config['load_db_lastread'] && $user->data['is_registered'] && isset($row['forum_mark_time'])) ? $row['forum_mark_time'] : 0; + $topic_forum_list[$row['forum_id']]['topics'][] = (int) $t_id; + } + + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + foreach ($topic_forum_list as $f_id => $topic_row) + { + $topic_tracking_info += get_topic_tracking($f_id, $topic_row['topics'], $rowset, array($f_id => $topic_row['forum_mark_time'])); + } + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + foreach ($topic_forum_list as $f_id => $topic_row) + { + $topic_tracking_info += get_complete_topic_tracking($f_id, $topic_row['topics']); + } + } + + unset($topic_forum_list); + + if (!$s_display_active) + { + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $mark_time_forum = (!empty($forum_data['mark_time'])) ? $forum_data['mark_time'] : $user->data['user_lastmark']; + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + if (!$user->data['is_registered']) + { + $user->data['user_lastmark'] = (isset($tracking_topics['l'])) ? (int) (base_convert($tracking_topics['l'], 36, 10) + $config['board_startdate']) : 0; + } + $mark_time_forum = (isset($tracking_topics['f'][$forum_id])) ? (int) (base_convert($tracking_topics['f'][$forum_id], 36, 10) + $config['board_startdate']) : $user->data['user_lastmark']; + } + } + + $s_type_switch = 0; + foreach ($topic_list as $topic_id) + { + $row = &$rowset[$topic_id]; + + $topic_forum_id = ($row['forum_id']) ? (int) $row['forum_id'] : $forum_id; + + // This will allow the style designer to output a different header + // or even separate the list of announcements from sticky and normal topics + $s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; + + // Replies + $replies = $phpbb_content_visibility->get_count('topic_posts', $row, $topic_forum_id) - 1; + + if ($row['topic_status'] == ITEM_MOVED) + { + $topic_id = $row['topic_moved_id']; + $unread_topic = false; + } + else + { + $unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false; + } + + // Get folder img, topic status/type related information + $folder_img = $folder_alt = $topic_type = ''; + topic_status($row, $replies, $unread_topic, $folder_img, $folder_alt, $topic_type); + + // Generate all the URIs ... + $view_topic_url_params = 'f=' . $row['forum_id'] . '&t=' . $topic_id; + $view_topic_url = $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params) : false; + + $topic_unapproved = (($row['topic_visibility'] == ITEM_UNAPPROVED || $row['topic_visibility'] == ITEM_REAPPROVE) && $auth->acl_get('m_approve', $row['forum_id'])); + $posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_posts_unapproved'] && $auth->acl_get('m_approve', $row['forum_id'])); + $topic_deleted = $row['topic_visibility'] == ITEM_DELETED; + + $u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$topic_id", true, $user->session_id) : ''; + $u_mcp_queue = (!$u_mcp_queue && $topic_deleted) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=deleted_topics&t=' . $topic_id, true, $user->session_id) : $u_mcp_queue; + + // Send vars to template + $topic_row = array( + 'FORUM_ID' => $row['forum_id'], + 'TOPIC_ID' => $topic_id, + 'TOPIC_AUTHOR' => get_username_string('username', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'FIRST_POST_TIME' => $user->format_date($row['topic_time']), + 'LAST_POST_SUBJECT' => censor_text($row['topic_last_post_subject']), + 'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']), + 'LAST_VIEW_TIME' => $user->format_date($row['topic_last_view_time']), + 'LAST_POST_AUTHOR' => get_username_string('username', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_COLOUR' => get_username_string('colour', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + + 'REPLIES' => $replies, + 'VIEWS' => $row['topic_views'], + 'TOPIC_TITLE' => censor_text($row['topic_title']), + 'TOPIC_TYPE' => $topic_type, + 'FORUM_NAME' => (isset($row['forum_name'])) ? $row['forum_name'] : $forum_data['forum_name'], + + 'TOPIC_IMG_STYLE' => $folder_img, + 'TOPIC_FOLDER_IMG' => $user->img($folder_img, $folder_alt), + 'TOPIC_FOLDER_IMG_ALT' => $user->lang[$folder_alt], + + 'TOPIC_ICON_IMG' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['img'] : '', + 'TOPIC_ICON_IMG_WIDTH' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['width'] : '', + 'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '', + 'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', + 'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '', + + 'S_TOPIC_TYPE' => $row['topic_type'], + 'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false, + 'S_UNREAD_TOPIC' => $unread_topic, + 'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $row['forum_id'])) ? true : false, + 'S_TOPIC_UNAPPROVED' => $topic_unapproved, + 'S_POSTS_UNAPPROVED' => $posts_unapproved, + 'S_TOPIC_DELETED' => $topic_deleted, + 'S_HAS_POLL' => ($row['poll_start']) ? true : false, + 'S_POST_ANNOUNCE' => ($row['topic_type'] == POST_ANNOUNCE) ? true : false, + 'S_POST_GLOBAL' => ($row['topic_type'] == POST_GLOBAL) ? true : false, + 'S_POST_STICKY' => ($row['topic_type'] == POST_STICKY) ? true : false, + 'S_TOPIC_LOCKED' => ($row['topic_status'] == ITEM_LOCKED) ? true : false, + 'S_TOPIC_MOVED' => ($row['topic_status'] == ITEM_MOVED) ? true : false, + + 'U_NEWEST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&view=unread') . '#unread' : false, + 'U_LAST_POST' => $auth->acl_get('f_read', $forum_id) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'] : false, + 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']), + 'U_TOPIC_AUTHOR' => get_username_string('profile', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']), + 'U_VIEW_TOPIC' => $view_topic_url, + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id']), + 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=reports&f=' . $row['forum_id'] . '&t=' . $topic_id, true, $user->session_id), + 'U_MCP_QUEUE' => $u_mcp_queue, + + 'S_TOPIC_TYPE_SWITCH' => ($s_type_switch == $s_type_switch_test) ? -1 : $s_type_switch_test, + ); + + /** + * Modify the topic data before it is assigned to the template + * + * @event core.viewforum_modify_topicrow + * @var array row Array with topic data + * @var array topic_row Template array with topic data + * @var bool s_type_switch Flag indicating if the topic type is [global] announcement + * @var bool s_type_switch_test Flag indicating if the test topic type is [global] announcement + * @since 3.1.0-a1 + * + * @changed 3.1.10-RC1 Added s_type_switch, s_type_switch_test + */ + $vars = array('row', 'topic_row', 's_type_switch', 's_type_switch_test'); + extract($phpbb_dispatcher->trigger_event('core.viewforum_modify_topicrow', compact($vars))); + + $template->assign_block_vars('topicrow', $topic_row); + + $pagination->generate_template_pagination($view_topic_url, 'topicrow.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true); + + $s_type_switch = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0; + + /** + * Event after the topic data has been assigned to the template + * + * @event core.viewforum_topic_row_after + * @var array row Array with the topic data + * @var array rowset Array with topics data (in topic_id => topic_data format) + * @var bool s_type_switch Flag indicating if the topic type is [global] announcement + * @var int topic_id The topic ID + * @var array topic_list Array with current viewforum page topic ids + * @var array topic_row Template array with topic data + * @since 3.1.3-RC1 + */ + $vars = array( + 'row', + 'rowset', + 's_type_switch', + 'topic_id', + 'topic_list', + 'topic_row', + ); + extract($phpbb_dispatcher->trigger_event('core.viewforum_topic_row_after', compact($vars))); + + if ($unread_topic) + { + $mark_forum_read = false; + } + + unset($rowset[$topic_id]); + } +} + +/** +* This event is to perform additional actions on viewforum page +* +* @event core.viewforum_generate_page_after +* @var array forum_data Array with the forum data +* @since 3.2.2-RC1 +*/ +$vars = array('forum_data'); +extract($phpbb_dispatcher->trigger_event('core.viewforum_generate_page_after', compact($vars))); + +// This is rather a fudge but it's the best I can think of without requiring information +// on all topics (as we do in 2.0.x). It looks for unread or new topics, if it doesn't find +// any it updates the forum last read cookie. This requires that the user visit the forum +// after reading a topic +if ($forum_data['forum_type'] == FORUM_POST && count($topic_list) && $mark_forum_read) +{ + update_forum_tracking_info($forum_id, $forum_data['forum_last_post_time'], false, $mark_time_forum); +} + +page_footer(); diff --git a/install/update/old/viewonline.php b/install/update/old/viewonline.php new file mode 100644 index 0000000..d5ddb0b --- /dev/null +++ b/install/update/old/viewonline.php @@ -0,0 +1,517 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); +$user->setup('memberlist'); + +// Get and set some variables +$mode = $request->variable('mode', ''); +$session_id = $request->variable('s', ''); +$start = $request->variable('start', 0); +$sort_key = $request->variable('sk', 'b'); +$sort_dir = $request->variable('sd', 'd'); +$show_guests = ($config['load_online_guests']) ? $request->variable('sg', 0) : 0; + +// Can this user view profiles/memberlist? +if (!$auth->acl_gets('u_viewprofile', 'a_user', 'a_useradd', 'a_userdel')) +{ + if ($user->data['user_id'] != ANONYMOUS) + { + send_status_line(403, 'Forbidden'); + trigger_error('NO_VIEW_USERS'); + } + + login_box('', $user->lang['LOGIN_EXPLAIN_VIEWONLINE']); +} + +/* @var $pagination \phpbb\pagination */ +$pagination = $phpbb_container->get('pagination'); + +/* @var $viewonline_helper \phpbb\viewonline_helper */ +$viewonline_helper = $phpbb_container->get('viewonline_helper'); + +$sort_key_text = array('a' => $user->lang['SORT_USERNAME'], 'b' => $user->lang['SORT_JOINED'], 'c' => $user->lang['SORT_LOCATION']); +$sort_key_sql = array('a' => 'u.username_clean', 'b' => 's.session_time', 'c' => 's.session_page'); + +// Sorting and order +if (!isset($sort_key_text[$sort_key])) +{ + $sort_key = 'b'; +} + +$order_by = $sort_key_sql[$sort_key] . ' ' . (($sort_dir == 'a') ? 'ASC' : 'DESC'); + +// Whois requested +if ($mode == 'whois' && $auth->acl_get('a_') && $session_id) +{ + if (!function_exists('user_get_id_name')) + { + include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + } + + $sql = 'SELECT u.user_id, u.username, u.user_type, s.session_ip + FROM ' . USERS_TABLE . ' u, ' . SESSIONS_TABLE . " s + WHERE s.session_id = '" . $db->sql_escape($session_id) . "' + AND u.user_id = s.session_user_id"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + $template->assign_var('WHOIS', user_ipwhois($row['session_ip'])); + } + $db->sql_freeresult($result); + + // Output the page + page_header($user->lang['WHO_IS_ONLINE']); + + $template->set_filenames(array( + 'body' => 'viewonline_whois.html') + ); + make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + + page_footer(); +} + +$user->update_session_infos(); + +// Forum info +$sql_ary = array( + 'SELECT' => 'f.forum_id, f.forum_name, f.parent_id, f.forum_type, f.left_id, f.right_id', + 'FROM' => array( + FORUMS_TABLE => 'f', + ), + 'ORDER_BY' => 'f.left_id ASC', +); + +/** +* Modify the forum data SQL query for getting additional fields if needed +* +* @event core.viewonline_modify_forum_data_sql +* @var array sql_ary The SQL array +* @since 3.1.5-RC1 +*/ +$vars = array('sql_ary'); +extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_forum_data_sql', compact($vars))); + +$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary), 600); +unset($sql_ary); + +$forum_data = array(); +while ($row = $db->sql_fetchrow($result)) +{ + $forum_data[$row['forum_id']] = $row; +} +$db->sql_freeresult($result); + +$guest_counter = 0; + +// Get number of online guests (if we do not display them) +if (!$show_guests) +{ + switch ($db->get_sql_layer()) + { + case 'sqlite3': + $sql = 'SELECT COUNT(session_ip) as num_guests + FROM ( + SELECT DISTINCT session_ip + FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . ANONYMOUS . ' + AND session_time >= ' . (time() - ($config['load_online_time'] * 60)) . + ')'; + break; + + default: + $sql = 'SELECT COUNT(DISTINCT session_ip) as num_guests + FROM ' . SESSIONS_TABLE . ' + WHERE session_user_id = ' . ANONYMOUS . ' + AND session_time >= ' . (time() - ($config['load_online_time'] * 60)); + break; + } + $result = $db->sql_query($sql); + $guest_counter = (int) $db->sql_fetchfield('num_guests'); + $db->sql_freeresult($result); +} + +// Get user list +$sql_ary = array( + 'SELECT' => 'u.user_id, u.username, u.username_clean, u.user_type, u.user_colour, s.session_id, s.session_time, s.session_page, s.session_ip, s.session_browser, s.session_viewonline, s.session_forum_id', + 'FROM' => array( + USERS_TABLE => 'u', + SESSIONS_TABLE => 's', + ), + 'WHERE' => 'u.user_id = s.session_user_id + AND s.session_time >= ' . (time() - ($config['load_online_time'] * 60)) . + ((!$show_guests) ? ' AND s.session_user_id <> ' . ANONYMOUS : ''), + 'ORDER_BY' => $order_by, +); + +/** +* Modify the SQL query for getting the user data to display viewonline list +* +* @event core.viewonline_modify_sql +* @var array sql_ary The SQL array +* @var bool show_guests Do we display guests in the list +* @var int guest_counter Number of guests displayed +* @var array forum_data Array with forum data +* @since 3.1.0-a1 +* @changed 3.1.0-a2 Added vars guest_counter and forum_data +*/ +$vars = array('sql_ary', 'show_guests', 'guest_counter', 'forum_data'); +extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_sql', compact($vars))); + +$result = $db->sql_query($db->sql_build_query('SELECT', $sql_ary)); + +$prev_id = $prev_ip = $user_list = array(); +$logged_visible_online = $logged_hidden_online = $counter = 0; + +/** @var \phpbb\controller\helper $controller_helper */ +$controller_helper = $phpbb_container->get('controller.helper'); + +/** @var \phpbb\group\helper $group_helper */ +$group_helper = $phpbb_container->get('group_helper'); + +while ($row = $db->sql_fetchrow($result)) +{ + if ($row['user_id'] != ANONYMOUS && !isset($prev_id[$row['user_id']])) + { + $view_online = $s_user_hidden = false; + $user_colour = ($row['user_colour']) ? ' style="color:#' . $row['user_colour'] . '" class="username-coloured"' : ''; + + $username_full = ($row['user_type'] != USER_IGNORE) ? get_username_string('full', $row['user_id'], $row['username'], $row['user_colour']) : '' . $row['username'] . ''; + + if (!$row['session_viewonline']) + { + $view_online = ($auth->acl_get('u_viewonline') || $row['user_id'] === $user->data['user_id']) ? true : false; + $logged_hidden_online++; + + $username_full = '' . $username_full . ''; + $s_user_hidden = true; + } + else + { + $view_online = true; + $logged_visible_online++; + } + + $prev_id[$row['user_id']] = 1; + + if ($view_online) + { + $counter++; + } + + if (!$view_online || $counter > $start + $config['topics_per_page'] || $counter <= $start) + { + continue; + } + } + else if ($show_guests && $row['user_id'] == ANONYMOUS && !isset($prev_ip[$row['session_ip']])) + { + $prev_ip[$row['session_ip']] = 1; + $guest_counter++; + $counter++; + + if ($counter > $start + $config['topics_per_page'] || $counter <= $start) + { + continue; + } + + $s_user_hidden = false; + $username_full = get_username_string('full', $row['user_id'], $user->lang['GUEST']); + } + else + { + continue; + } + + $on_page = $viewonline_helper->get_user_page($row['session_page']); + + switch ($on_page[1]) + { + case 'index': + $location = $user->lang['INDEX']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + case $phpbb_adm_relative_path . 'index': + $location = $user->lang['ACP']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + case 'posting': + case 'viewforum': + case 'viewtopic': + $forum_id = $row['session_forum_id']; + + if ($forum_id && $auth->acl_get('f_list', $forum_id)) + { + $location = ''; + $location_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); + + if ($forum_data[$forum_id]['forum_type'] == FORUM_LINK) + { + $location = sprintf($user->lang['READING_LINK'], $forum_data[$forum_id]['forum_name']); + break; + } + + switch ($on_page[1]) + { + case 'posting': + preg_match('#mode=([a-z]+)#', $row['session_page'], $on_page); + $posting_mode = (!empty($on_page[1])) ? $on_page[1] : ''; + + switch ($posting_mode) + { + case 'reply': + case 'quote': + $location = sprintf($user->lang['REPLYING_MESSAGE'], $forum_data[$forum_id]['forum_name']); + break; + + default: + $location = sprintf($user->lang['POSTING_MESSAGE'], $forum_data[$forum_id]['forum_name']); + break; + } + break; + + case 'viewtopic': + $location = sprintf($user->lang['READING_TOPIC'], $forum_data[$forum_id]['forum_name']); + break; + + case 'viewforum': + $location = sprintf($user->lang['READING_FORUM'], $forum_data[$forum_id]['forum_name']); + break; + } + } + else + { + $location = $user->lang['INDEX']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + } + break; + + case 'search': + $location = $user->lang['SEARCHING_FORUMS']; + $location_url = append_sid("{$phpbb_root_path}search.$phpEx"); + break; + + case 'viewonline': + $location = $user->lang['VIEWING_ONLINE']; + $location_url = append_sid("{$phpbb_root_path}viewonline.$phpEx"); + break; + + case 'memberlist': + $location_url = append_sid("{$phpbb_root_path}memberlist.$phpEx"); + + if (strpos($row['session_page'], 'mode=viewprofile') !== false) + { + $location = $user->lang['VIEWING_MEMBER_PROFILE']; + } + else if (strpos($row['session_page'], 'mode=contactadmin') !== false) + { + $location = $user->lang['VIEWING_CONTACT_ADMIN']; + $location_url = append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=contactadmin'); + } + else + { + $location = $user->lang['VIEWING_MEMBERS']; + } + break; + + case 'mcp': + $location = $user->lang['VIEWING_MCP']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + case 'ucp': + $location = $user->lang['VIEWING_UCP']; + + // Grab some common modules + $url_params = array( + 'mode=register' => 'VIEWING_REGISTER', + 'i=pm&mode=compose' => 'POSTING_PRIVATE_MESSAGE', + 'i=pm&' => 'VIEWING_PRIVATE_MESSAGES', + 'i=profile&' => 'CHANGING_PROFILE', + 'i=prefs&' => 'CHANGING_PREFERENCES', + ); + + foreach ($url_params as $param => $lang) + { + if (strpos($row['session_page'], $param) !== false) + { + $location = $user->lang[$lang]; + break; + } + } + + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + case 'download/file': + $location = $user->lang['DOWNLOADING_FILE']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + case 'report': + $location = $user->lang['REPORTING_POST']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + break; + + default: + $location = $user->lang['INDEX']; + $location_url = append_sid("{$phpbb_root_path}index.$phpEx"); + + if ($row['session_page'] === 'app.' . $phpEx . '/help/faq' || + $row['session_page'] === 'app.' . $phpEx . '/help/bbcode') + { + $location = $user->lang['VIEWING_FAQ']; + $location_url = $controller_helper->route('phpbb_help_faq_controller'); + } + break; + } + + /** + * Overwrite the location's name and URL, which are displayed in the list + * + * @event core.viewonline_overwrite_location + * @var array on_page File name and query string + * @var array row Array with the users sql row + * @var string location Page name to displayed in the list + * @var string location_url Page url to displayed in the list + * @var array forum_data Array with forum data + * @since 3.1.0-a1 + * @changed 3.1.0-a2 Added var forum_data + */ + $vars = array('on_page', 'row', 'location', 'location_url', 'forum_data'); + extract($phpbb_dispatcher->trigger_event('core.viewonline_overwrite_location', compact($vars))); + + $template_row = array( + 'USERNAME' => $row['username'], + 'USERNAME_COLOUR' => $row['user_colour'], + 'USERNAME_FULL' => $username_full, + 'LASTUPDATE' => $user->format_date($row['session_time']), + 'FORUM_LOCATION' => $location, + 'USER_IP' => ($auth->acl_get('a_')) ? (($mode == 'lookup' && $session_id == $row['session_id']) ? gethostbyaddr($row['session_ip']) : $row['session_ip']) : '', + 'USER_BROWSER' => ($auth->acl_get('a_user')) ? $row['session_browser'] : '', + + 'U_USER_PROFILE' => ($row['user_type'] != USER_IGNORE) ? get_username_string('profile', $row['user_id'], '') : '', + 'U_USER_IP' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'mode=lookup' . (($mode != 'lookup' || $row['session_id'] != $session_id) ? '&s=' . $row['session_id'] : '') . "&sg=$show_guests&start=$start&sk=$sort_key&sd=$sort_dir"), + 'U_WHOIS' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'mode=whois&s=' . $row['session_id']), + 'U_FORUM_LOCATION' => $location_url, + + 'S_USER_HIDDEN' => $s_user_hidden, + 'S_GUEST' => ($row['user_id'] == ANONYMOUS) ? true : false, + 'S_USER_TYPE' => $row['user_type'], + ); + + /** + * Modify viewonline template data before it is displayed in the list + * + * @event core.viewonline_modify_user_row + * @var array on_page File name and query string + * @var array row Array with the users sql row + * @var array forum_data Array with forum data + * @var array template_row Array with template variables for the user row + * @since 3.1.0-RC4 + */ + $vars = array('on_page', 'row', 'forum_data', 'template_row'); + extract($phpbb_dispatcher->trigger_event('core.viewonline_modify_user_row', compact($vars))); + + $template->assign_block_vars('user_row', $template_row); +} +$db->sql_freeresult($result); +unset($prev_id, $prev_ip); + +$order_legend = ($config['legend_sort_groupname']) ? 'group_name' : 'group_legend'; +// Grab group details for legend display +if ($auth->acl_gets('a_group', 'a_groupadd', 'a_groupdel')) +{ + $sql = 'SELECT group_id, group_name, group_colour, group_type, group_legend + FROM ' . GROUPS_TABLE . ' + WHERE group_legend > 0 + ORDER BY ' . $order_legend . ' ASC'; +} +else +{ + $sql = 'SELECT g.group_id, g.group_name, g.group_colour, g.group_type, g.group_legend + FROM ' . GROUPS_TABLE . ' g + LEFT JOIN ' . USER_GROUP_TABLE . ' ug + ON ( + g.group_id = ug.group_id + AND ug.user_id = ' . $user->data['user_id'] . ' + AND ug.user_pending = 0 + ) + WHERE g.group_legend > 0 + AND (g.group_type <> ' . GROUP_HIDDEN . ' OR ug.user_id = ' . $user->data['user_id'] . ') + ORDER BY g.' . $order_legend . ' ASC'; +} +$result = $db->sql_query($sql); + +$legend = ''; +while ($row = $db->sql_fetchrow($result)) +{ + if ($row['group_name'] == 'BOTS') + { + $legend .= (($legend != '') ? ', ' : '') . '' . $user->lang['G_BOTS'] . ''; + } + else + { + $legend .= (($legend != '') ? ', ' : '') . '' . $group_helper->get_name($row['group_name']) . ''; + } +} +$db->sql_freeresult($result); + +// Refreshing the page every 60 seconds... +meta_refresh(60, append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir&start=$start")); + +$start = $pagination->validate_start($start, $config['topics_per_page'], $counter); +$base_url = append_sid("{$phpbb_root_path}viewonline.$phpEx", "sg=$show_guests&sk=$sort_key&sd=$sort_dir"); +$pagination->generate_template_pagination($base_url, 'pagination', 'start', $counter, $config['topics_per_page'], $start); + +// Send data to template +$template->assign_vars(array( + 'TOTAL_REGISTERED_USERS_ONLINE' => $user->lang('REG_USERS_ONLINE', (int) $logged_visible_online, $user->lang('HIDDEN_USERS_ONLINE', (int) $logged_hidden_online)), + 'TOTAL_GUEST_USERS_ONLINE' => $user->lang('GUEST_USERS_ONLINE', (int) $guest_counter), + 'LEGEND' => $legend, + + 'U_SORT_USERNAME' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=a&sd=' . (($sort_key == 'a' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), + 'U_SORT_UPDATED' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=b&sd=' . (($sort_key == 'b' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), + 'U_SORT_LOCATION' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sk=c&sd=' . (($sort_key == 'c' && $sort_dir == 'a') ? 'd' : 'a') . '&sg=' . ((int) $show_guests)), + + 'U_SWITCH_GUEST_DISPLAY' => append_sid("{$phpbb_root_path}viewonline.$phpEx", 'sg=' . ((int) !$show_guests)), + 'L_SWITCH_GUEST_DISPLAY' => ($show_guests) ? $user->lang['HIDE_GUESTS'] : $user->lang['DISPLAY_GUESTS'], + 'S_SWITCH_GUEST_DISPLAY' => ($config['load_online_guests']) ? true : false, + 'S_VIEWONLINE' => true, +)); + +// We do not need to load the who is online box here. ;) +$config['load_online'] = false; + +// Output the page +page_header($user->lang['WHO_IS_ONLINE']); + +$template->set_filenames(array( + 'body' => 'viewonline_body.html') +); +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx")); + +page_footer(); diff --git a/install/update/old/viewtopic.php b/install/update/old/viewtopic.php new file mode 100644 index 0000000..eb2d52c --- /dev/null +++ b/install/update/old/viewtopic.php @@ -0,0 +1,2380 @@ + +* @license GNU General Public License, version 2 (GPL-2.0) +* +* For full copyright and license information, please see +* the docs/CREDITS.txt file. +* +*/ + +/** +* @ignore +*/ +define('IN_PHPBB', true); +$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; +$phpEx = substr(strrchr(__FILE__, '.'), 1); +include($phpbb_root_path . 'common.' . $phpEx); +include($phpbb_root_path . 'includes/functions_display.' . $phpEx); +include($phpbb_root_path . 'includes/bbcode.' . $phpEx); +include($phpbb_root_path . 'includes/functions_user.' . $phpEx); + +// Start session management +$user->session_begin(); +$auth->acl($user->data); + +// Initial var setup +$forum_id = $request->variable('f', 0); +$topic_id = $request->variable('t', 0); +$post_id = $request->variable('p', 0); +$voted_id = $request->variable('vote_id', array('' => 0)); + +$voted_id = (count($voted_id) > 1) ? array_unique($voted_id) : $voted_id; + + +$start = $request->variable('start', 0); +$view = $request->variable('view', ''); + +$default_sort_days = (!empty($user->data['user_post_show_days'])) ? $user->data['user_post_show_days'] : 0; +$default_sort_key = (!empty($user->data['user_post_sortby_type'])) ? $user->data['user_post_sortby_type'] : 't'; +$default_sort_dir = (!empty($user->data['user_post_sortby_dir'])) ? $user->data['user_post_sortby_dir'] : 'a'; + +$sort_days = $request->variable('st', $default_sort_days); +$sort_key = $request->variable('sk', $default_sort_key); +$sort_dir = $request->variable('sd', $default_sort_dir); + +$update = $request->variable('update', false); + +/* @var $pagination \phpbb\pagination */ +$pagination = $phpbb_container->get('pagination'); + +$s_can_vote = false; +/** +* @todo normalize? +*/ +$hilit_words = $request->variable('hilit', '', true); + +// Do we have a topic or post id? +if (!$topic_id && !$post_id) +{ + trigger_error('NO_TOPIC'); +} + +/* @var $phpbb_content_visibility \phpbb\content_visibility */ +$phpbb_content_visibility = $phpbb_container->get('content.visibility'); + +// Find topic id if user requested a newer or older topic +if ($view && !$post_id) +{ + if (!$forum_id) + { + $sql = 'SELECT forum_id + FROM ' . TOPICS_TABLE . " + WHERE topic_id = $topic_id"; + $result = $db->sql_query($sql); + $forum_id = (int) $db->sql_fetchfield('forum_id'); + $db->sql_freeresult($result); + + if (!$forum_id) + { + trigger_error('NO_TOPIC'); + } + } + + if ($view == 'unread') + { + // Get topic tracking info + $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id); + $topic_last_read = (isset($topic_tracking_info[$topic_id])) ? $topic_tracking_info[$topic_id] : 0; + + $sql = 'SELECT post_id, topic_id, forum_id + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . " + AND post_time > $topic_last_read + AND forum_id = $forum_id + ORDER BY post_time ASC, post_id ASC"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $sql = 'SELECT topic_last_post_id as post_id, topic_id, forum_id + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + } + + if (!$row) + { + // Setup user environment so we can process lang string + $user->setup('viewtopic'); + + trigger_error('NO_TOPIC'); + } + + $post_id = $row['post_id']; + $topic_id = $row['topic_id']; + } + else if ($view == 'next' || $view == 'previous') + { + $sql_condition = ($view == 'next') ? '>' : '<'; + $sql_ordering = ($view == 'next') ? 'ASC' : 'DESC'; + + $sql = 'SELECT forum_id, topic_last_post_time + FROM ' . TOPICS_TABLE . ' + WHERE topic_id = ' . $topic_id; + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $user->setup('viewtopic'); + // OK, the topic doesn't exist. This error message is not helpful, but technically correct. + trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS'); + } + else + { + $sql = 'SELECT topic_id, forum_id + FROM ' . TOPICS_TABLE . ' + WHERE forum_id = ' . $row['forum_id'] . " + AND topic_moved_id = 0 + AND topic_last_post_time $sql_condition {$row['topic_last_post_time']} + AND " . $phpbb_content_visibility->get_visibility_sql('topic', $row['forum_id']) . " + ORDER BY topic_last_post_time $sql_ordering, topic_last_post_id $sql_ordering"; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $sql = 'SELECT forum_style + FROM ' . FORUMS_TABLE . " + WHERE forum_id = $forum_id"; + $result = $db->sql_query($sql); + $forum_style = (int) $db->sql_fetchfield('forum_style'); + $db->sql_freeresult($result); + + $user->setup('viewtopic', $forum_style); + trigger_error(($view == 'next') ? 'NO_NEWER_TOPICS' : 'NO_OLDER_TOPICS'); + } + else + { + $topic_id = $row['topic_id']; + $forum_id = $row['forum_id']; + } + } + } + + if (isset($row) && $row['forum_id']) + { + $forum_id = $row['forum_id']; + } +} + +// This rather complex gaggle of code handles querying for topics but +// also allows for direct linking to a post (and the calculation of which +// page the post is on and the correct display of viewtopic) +$sql_array = array( + 'SELECT' => 't.*, f.*', + + 'FROM' => array(FORUMS_TABLE => 'f'), +); + +// The FROM-Order is quite important here, else t.* columns can not be correctly bound. +if ($post_id) +{ + $sql_array['SELECT'] .= ', p.post_visibility, p.post_time, p.post_id'; + $sql_array['FROM'][POSTS_TABLE] = 'p'; +} + +// Topics table need to be the last in the chain +$sql_array['FROM'][TOPICS_TABLE] = 't'; + +if ($user->data['is_registered']) +{ + $sql_array['SELECT'] .= ', tw.notify_status'; + $sql_array['LEFT_JOIN'] = array(); + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_WATCH_TABLE => 'tw'), + 'ON' => 'tw.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tw.topic_id' + ); + + if ($config['allow_bookmarks']) + { + $sql_array['SELECT'] .= ', bm.topic_id as bookmarked'; + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(BOOKMARKS_TABLE => 'bm'), + 'ON' => 'bm.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = bm.topic_id' + ); + } + + if ($config['load_db_lastread']) + { + $sql_array['SELECT'] .= ', tt.mark_time, ft.mark_time as forum_mark_time'; + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(TOPICS_TRACK_TABLE => 'tt'), + 'ON' => 'tt.user_id = ' . $user->data['user_id'] . ' AND t.topic_id = tt.topic_id' + ); + + $sql_array['LEFT_JOIN'][] = array( + 'FROM' => array(FORUMS_TRACK_TABLE => 'ft'), + 'ON' => 'ft.user_id = ' . $user->data['user_id'] . ' AND t.forum_id = ft.forum_id' + ); + } +} + +if (!$post_id) +{ + $sql_array['WHERE'] = "t.topic_id = $topic_id"; +} +else +{ + $sql_array['WHERE'] = "p.post_id = $post_id AND t.topic_id = p.topic_id"; +} + +$sql_array['WHERE'] .= ' AND f.forum_id = t.forum_id'; + +$sql = $db->sql_build_query('SELECT', $sql_array); +$result = $db->sql_query($sql); +$topic_data = $db->sql_fetchrow($result); +$db->sql_freeresult($result); + +// link to unapproved post or incorrect link +if (!$topic_data) +{ + // If post_id was submitted, we try at least to display the topic as a last resort... + if ($post_id && $topic_id) + { + redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id" . (($forum_id) ? "&f=$forum_id" : ''))); + } + + trigger_error('NO_TOPIC'); +} + +$forum_id = (int) $topic_data['forum_id']; + +/** + * Modify the forum ID to handle the correct display of viewtopic if needed + * + * @event core.viewtopic_modify_forum_id + * @var string forum_id forum ID + * @var array topic_data array of topic's data + * @since 3.2.5-RC1 + */ +$vars = array( + 'forum_id', + 'topic_data', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_forum_id', compact($vars))); + +// If the request is missing the f parameter, the forum id in the user session data is 0 at the moment. +// Let's fix that now so that the user can't hide from the forum's Who Is Online list. +$user->page['forum'] = $forum_id; + +// Now we know the forum_id and can check the permissions +if (!$phpbb_content_visibility->is_visible('topic', $forum_id, $topic_data)) +{ + trigger_error('NO_TOPIC'); +} + +// This is for determining where we are (page) +if ($post_id) +{ + // are we where we are supposed to be? + if (($topic_data['post_visibility'] == ITEM_UNAPPROVED || $topic_data['post_visibility'] == ITEM_REAPPROVE) && !$auth->acl_get('m_approve', $topic_data['forum_id'])) + { + // If post_id was submitted, we try at least to display the topic as a last resort... + if ($topic_id) + { + redirect(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id" . (($forum_id) ? "&f=$forum_id" : ''))); + } + + trigger_error('NO_TOPIC'); + } + if ($post_id == $topic_data['topic_first_post_id'] || $post_id == $topic_data['topic_last_post_id']) + { + $check_sort = ($post_id == $topic_data['topic_first_post_id']) ? 'd' : 'a'; + + if ($sort_dir == $check_sort) + { + $topic_data['prev_posts'] = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1; + } + else + { + $topic_data['prev_posts'] = 0; + } + } + else + { + $sql = 'SELECT COUNT(p.post_id) AS prev_posts + FROM ' . POSTS_TABLE . " p + WHERE p.topic_id = {$topic_data['topic_id']} + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.'); + + if ($sort_dir == 'd') + { + $sql .= " AND (p.post_time > {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id >= {$topic_data['post_id']}))"; + } + else + { + $sql .= " AND (p.post_time < {$topic_data['post_time']} OR (p.post_time = {$topic_data['post_time']} AND p.post_id <= {$topic_data['post_id']}))"; + } + + $result = $db->sql_query($sql); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + $topic_data['prev_posts'] = $row['prev_posts'] - 1; + } +} + +$topic_id = (int) $topic_data['topic_id']; +$topic_replies = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1; + +// Check sticky/announcement/global time limit +if (($topic_data['topic_type'] != POST_NORMAL) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time()) +{ + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_type = ' . POST_NORMAL . ', topic_time_limit = 0 + WHERE topic_id = ' . $topic_id; + $db->sql_query($sql); + + $topic_data['topic_type'] = POST_NORMAL; + $topic_data['topic_time_limit'] = 0; +} + +// Setup look and feel +$user->setup('viewtopic', $topic_data['forum_style']); + +if ($view == 'print' && !$auth->acl_get('f_print', $forum_id)) +{ + send_status_line(403, 'Forbidden'); + trigger_error('NO_AUTH_PRINT_TOPIC'); +} + +$overrides_f_read_check = false; +$overrides_forum_password_check = false; +$topic_tracking_info = isset($topic_tracking_info) ? $topic_tracking_info : null; + +/** +* Event to apply extra permissions and to override original phpBB's f_read permission and forum password check +* on viewtopic access +* +* @event core.viewtopic_before_f_read_check +* @var int forum_id The forum id from where the topic belongs +* @var int topic_id The id of the topic the user tries to access +* @var int post_id The id of the post the user tries to start viewing at. +* It may be 0 for none given. +* @var array topic_data All the information from the topic and forum tables for this topic +* It includes posts information if post_id is not 0 +* @var bool overrides_f_read_check Set true to remove f_read check afterwards +* @var bool overrides_forum_password_check Set true to remove forum_password check afterwards +* @var array topic_tracking_info Information upon calling get_topic_tracking() +* Set it to NULL to allow auto-filling later. +* Set it to an array to override original data. +* @since 3.1.3-RC1 +*/ +$vars = array( + 'forum_id', + 'topic_id', + 'post_id', + 'topic_data', + 'overrides_f_read_check', + 'overrides_forum_password_check', + 'topic_tracking_info', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_before_f_read_check', compact($vars))); + +// Start auth check +if (!$overrides_f_read_check && !$auth->acl_get('f_read', $forum_id)) +{ + if ($user->data['user_id'] != ANONYMOUS) + { + send_status_line(403, 'Forbidden'); + trigger_error('SORRY_AUTH_READ'); + } + + login_box('', $user->lang['LOGIN_VIEWFORUM']); +} + +// Forum is passworded ... check whether access has been granted to this +// user this session, if not show login box +if (!$overrides_forum_password_check && $topic_data['forum_password']) +{ + login_forum_box($topic_data); +} + +// Redirect to login upon emailed notification links if user is not logged in. +if (isset($_GET['e']) && $user->data['user_id'] == ANONYMOUS) +{ + login_box(build_url('e') . '#unread', $user->lang['LOGIN_NOTIFY_TOPIC']); +} + +// What is start equal to? +if ($post_id) +{ + $start = floor(($topic_data['prev_posts']) / $config['posts_per_page']) * $config['posts_per_page']; +} + +// Get topic tracking info +if (!isset($topic_tracking_info)) +{ + $topic_tracking_info = array(); + + // Get topic tracking info + if ($config['load_db_lastread'] && $user->data['is_registered']) + { + $tmp_topic_data = array($topic_id => $topic_data); + $topic_tracking_info = get_topic_tracking($forum_id, $topic_id, $tmp_topic_data, array($forum_id => $topic_data['forum_mark_time'])); + unset($tmp_topic_data); + } + else if ($config['load_anon_lastread'] || $user->data['is_registered']) + { + $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id); + } +} + +// Post ordering options +$limit_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']); + +$sort_by_text = array('a' => $user->lang['AUTHOR'], 't' => $user->lang['POST_TIME'], 's' => $user->lang['SUBJECT']); +$sort_by_sql = array('a' => array('u.username_clean', 'p.post_id'), 't' => array('p.post_time', 'p.post_id'), 's' => array('p.post_subject', 'p.post_id')); +$join_user_sql = array('a' => true, 't' => false, 's' => false); + +$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = ''; + +gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir); + +// Obtain correct post count and ordering SQL if user has +// requested anything different +if ($sort_days) +{ + $min_post_time = time() - ($sort_days * 86400); + + $sql = 'SELECT COUNT(post_id) AS num_posts + FROM ' . POSTS_TABLE . " + WHERE topic_id = $topic_id + AND post_time >= $min_post_time + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id); + $result = $db->sql_query($sql); + $total_posts = (int) $db->sql_fetchfield('num_posts'); + $db->sql_freeresult($result); + + $limit_posts_time = "AND p.post_time >= $min_post_time "; + + if (isset($_POST['sort'])) + { + $start = 0; + } +} +else +{ + $total_posts = $topic_replies + 1; + $limit_posts_time = ''; +} + +// Was a highlight request part of the URI? +$highlight_match = $highlight = ''; +if ($hilit_words) +{ + $highlight_match = phpbb_clean_search_string($hilit_words); + $highlight = urlencode($highlight_match); + $highlight_match = str_replace('\*', '\w+?', preg_quote($highlight_match, '#')); + $highlight_match = preg_replace('#(?<=^|\s)\\\\w\*\?(?=\s|$)#', '\w+?', $highlight_match); + $highlight_match = str_replace(' ', '|', $highlight_match); +} + +// Make sure $start is set to the last page if it exceeds the amount +$start = $pagination->validate_start($start, $config['posts_per_page'], $total_posts); + +// General Viewtopic URL for return links +$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); + +// Are we watching this topic? +$s_watching_topic = array( + 'link' => '', + 'link_toggle' => '', + 'title' => '', + 'title_toggle' => '', + 'is_watching' => false, +); + +if ($config['allow_topic_notify']) +{ + $notify_status = (isset($topic_data['notify_status'])) ? $topic_data['notify_status'] : null; + watch_topic_forum('topic', $s_watching_topic, $user->data['user_id'], $forum_id, $topic_id, $notify_status, $start, $topic_data['topic_title']); + + // Reset forum notification if forum notify is set + if ($config['allow_forum_notify'] && $auth->acl_get('f_subscribe', $forum_id)) + { + $s_watching_forum = $s_watching_topic; + watch_topic_forum('forum', $s_watching_forum, $user->data['user_id'], $forum_id, 0); + } +} + +/** +* Event to modify highlight. +* +* @event core.viewtopic_highlight_modify +* @var string highlight String to be highlighted +* @var string highlight_match Highlight string to be used in preg_replace +* @var array topic_data Topic data +* @var int start Pagination start +* @var int total_posts Number of posts +* @var string viewtopic_url Current viewtopic URL +* @since 3.1.11-RC1 +*/ +$vars = array( + 'highlight', + 'highlight_match', + 'topic_data', + 'start', + 'total_posts', + 'viewtopic_url', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_highlight_modify', compact($vars))); + +// Bookmarks +if ($config['allow_bookmarks'] && $user->data['is_registered'] && $request->variable('bookmark', 0)) +{ + if (check_link_hash($request->variable('hash', ''), "topic_$topic_id")) + { + if (!$topic_data['bookmarked']) + { + $sql = 'INSERT INTO ' . BOOKMARKS_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'user_id' => $user->data['user_id'], + 'topic_id' => $topic_id, + )); + $db->sql_query($sql); + } + else + { + $sql = 'DELETE FROM ' . BOOKMARKS_TABLE . " + WHERE user_id = {$user->data['user_id']} + AND topic_id = $topic_id"; + $db->sql_query($sql); + } + $message = (($topic_data['bookmarked']) ? $user->lang['BOOKMARK_REMOVED'] : $user->lang['BOOKMARK_ADDED']); + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); + } + } + else + { + $message = $user->lang['BOOKMARK_ERR']; + + if (!$request->is_ajax()) + { + $message .= '

' . $user->lang('RETURN_TOPIC', '', ''); + } + } + meta_refresh(3, $viewtopic_url); + + trigger_error($message); +} + +// Grab ranks +$ranks = $cache->obtain_ranks(); + +// Grab icons +$icons = $cache->obtain_icons(); + +// Grab extensions +$extensions = array(); +if ($topic_data['topic_attachment']) +{ + $extensions = $cache->obtain_attach_extensions($forum_id); +} + +// Forum rules listing +$s_forum_rules = ''; +gen_forum_auth_level('topic', $forum_id, $topic_data['forum_status']); + +// Quick mod tools +$allow_change_type = ($auth->acl_get('m_', $forum_id) || ($user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster'])) ? true : false; + +$s_quickmod_action = append_sid( + "{$phpbb_root_path}mcp.$phpEx", + array( + 'f' => $forum_id, + 't' => $topic_id, + 'start' => $start, + 'quickmod' => 1, + 'redirect' => urlencode(str_replace('&', '&', $viewtopic_url)), + ), + true, + $user->session_id +); + +$quickmod_array = array( +// 'key' => array('LANG_KEY', $userHasPermissions), + + 'lock' => array('LOCK_TOPIC', ($topic_data['topic_status'] == ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id) || ($auth->acl_get('f_user_lock', $forum_id) && $user->data['is_registered'] && $user->data['user_id'] == $topic_data['topic_poster']))), + 'unlock' => array('UNLOCK_TOPIC', ($topic_data['topic_status'] != ITEM_UNLOCKED) && ($auth->acl_get('m_lock', $forum_id))), + 'delete_topic' => array('DELETE_TOPIC', ($auth->acl_get('m_delete', $forum_id) || (($topic_data['topic_visibility'] != ITEM_DELETED) && $auth->acl_get('m_softdelete', $forum_id)))), + 'restore_topic' => array('RESTORE_TOPIC', (($topic_data['topic_visibility'] == ITEM_DELETED) && $auth->acl_get('m_approve', $forum_id))), + 'move' => array('MOVE_TOPIC', $auth->acl_get('m_move', $forum_id) && $topic_data['topic_status'] != ITEM_MOVED), + 'split' => array('SPLIT_TOPIC', $auth->acl_get('m_split', $forum_id)), + 'merge' => array('MERGE_POSTS', $auth->acl_get('m_merge', $forum_id)), + 'merge_topic' => array('MERGE_TOPIC', $auth->acl_get('m_merge', $forum_id)), + 'fork' => array('FORK_TOPIC', $auth->acl_get('m_move', $forum_id)), + 'make_normal' => array('MAKE_NORMAL', ($allow_change_type && $auth->acl_gets('f_sticky', 'f_announce', 'f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_NORMAL)), + 'make_sticky' => array('MAKE_STICKY', ($allow_change_type && $auth->acl_get('f_sticky', $forum_id) && $topic_data['topic_type'] != POST_STICKY)), + 'make_announce' => array('MAKE_ANNOUNCE', ($allow_change_type && $auth->acl_get('f_announce', $forum_id) && $topic_data['topic_type'] != POST_ANNOUNCE)), + 'make_global' => array('MAKE_GLOBAL', ($allow_change_type && $auth->acl_get('f_announce_global', $forum_id) && $topic_data['topic_type'] != POST_GLOBAL)), + 'topic_logs' => array('VIEW_TOPIC_LOGS', $auth->acl_get('m_', $forum_id)), +); + +/** +* Event to modify data in the quickmod_array before it gets sent to the +* phpbb_add_quickmod_option function. +* +* @event core.viewtopic_add_quickmod_option_before +* @var int forum_id Forum ID +* @var int post_id Post ID +* @var array quickmod_array Array with quick moderation options data +* @var array topic_data Array with topic data +* @var int topic_id Topic ID +* @var array topic_tracking_info Array with topic tracking data +* @var string viewtopic_url URL to the topic page +* @var bool allow_change_type Topic change permissions check +* @since 3.1.9-RC1 +*/ +$vars = array( + 'forum_id', + 'post_id', + 'quickmod_array', + 'topic_data', + 'topic_id', + 'topic_tracking_info', + 'viewtopic_url', + 'allow_change_type', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_add_quickmod_option_before', compact($vars))); + +foreach ($quickmod_array as $option => $qm_ary) +{ + if (!empty($qm_ary[1])) + { + phpbb_add_quickmod_option($s_quickmod_action, $option, $qm_ary[0]); + } +} + +// Navigation links +generate_forum_nav($topic_data); + +// Forum Rules +generate_forum_rules($topic_data); + +// Moderators +$forum_moderators = array(); +if ($config['load_moderators']) +{ + get_moderators($forum_moderators, $forum_id); +} + +// This is only used for print view so ... +$server_path = (!$view) ? $phpbb_root_path : generate_board_url() . '/'; + +// Replace naughty words in title +$topic_data['topic_title'] = censor_text($topic_data['topic_title']); + +$s_search_hidden_fields = array( + 't' => $topic_id, + 'sf' => 'msgonly', +); +if ($_SID) +{ + $s_search_hidden_fields['sid'] = $_SID; +} + +if (!empty($_EXTRA_URL)) +{ + foreach ($_EXTRA_URL as $url_param) + { + $url_param = explode('=', $url_param, 2); + $s_search_hidden_fields[$url_param[0]] = $url_param[1]; + } +} + +// If we've got a hightlight set pass it on to pagination. +$base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); + +/** +* Event to modify data before template variables are being assigned +* +* @event core.viewtopic_assign_template_vars_before +* @var string base_url URL to be passed to generate pagination +* @var int forum_id Forum ID +* @var int post_id Post ID +* @var array quickmod_array Array with quick moderation options data +* @var int start Pagination information +* @var array topic_data Array with topic data +* @var int topic_id Topic ID +* @var array topic_tracking_info Array with topic tracking data +* @var int total_posts Topic total posts count +* @var string viewtopic_url URL to the topic page +* @since 3.1.0-RC4 +* @changed 3.1.2-RC1 Added viewtopic_url +*/ +$vars = array( + 'base_url', + 'forum_id', + 'post_id', + 'quickmod_array', + 'start', + 'topic_data', + 'topic_id', + 'topic_tracking_info', + 'total_posts', + 'viewtopic_url', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_assign_template_vars_before', compact($vars))); + +$pagination->generate_template_pagination($base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start); + +// Send vars to template +$template->assign_vars(array( + 'FORUM_ID' => $forum_id, + 'FORUM_NAME' => $topic_data['forum_name'], + 'FORUM_DESC' => generate_text_for_display($topic_data['forum_desc'], $topic_data['forum_desc_uid'], $topic_data['forum_desc_bitfield'], $topic_data['forum_desc_options']), + 'TOPIC_ID' => $topic_id, + 'TOPIC_TITLE' => $topic_data['topic_title'], + 'TOPIC_POSTER' => $topic_data['topic_poster'], + + 'TOPIC_AUTHOR_FULL' => get_username_string('full', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), + 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), + 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), + + 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), + 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', + 'MODERATORS' => (isset($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', + + 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), + 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), + 'REPLY_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'TOPIC_LOCKED') : $user->img('button_topic_reply', 'REPLY_TO_TOPIC'), + 'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'), + 'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'), + 'DELETED_IMG' => $user->img('icon_topic_deleted', 'POST_DELETED_RESTORE'), + 'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'), + 'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'), + 'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'), + 'PM_IMG' => $user->img('icon_contact_pm', 'SEND_PRIVATE_MESSAGE'), + 'EMAIL_IMG' => $user->img('icon_contact_email', 'SEND_EMAIL'), + 'JABBER_IMG' => $user->img('icon_contact_jabber', 'JABBER') , + 'REPORT_IMG' => $user->img('icon_post_report', 'REPORT_POST'), + 'REPORTED_IMG' => $user->img('icon_topic_reported', 'POST_REPORTED'), + 'UNAPPROVED_IMG' => $user->img('icon_topic_unapproved', 'POST_UNAPPROVED'), + 'WARN_IMG' => $user->img('icon_user_warn', 'WARN_USER'), + + 'S_IS_LOCKED' => ($topic_data['topic_status'] == ITEM_UNLOCKED && $topic_data['forum_status'] == ITEM_UNLOCKED) ? false : true, + 'S_SELECT_SORT_DIR' => $s_sort_dir, + 'S_SELECT_SORT_KEY' => $s_sort_key, + 'S_SELECT_SORT_DAYS' => $s_limit_days, + 'S_SINGLE_MODERATOR' => (!empty($forum_moderators[$forum_id]) && count($forum_moderators[$forum_id]) > 1) ? false : true, + 'S_TOPIC_ACTION' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")), + 'S_MOD_ACTION' => $s_quickmod_action, + + 'L_RETURN_TO_FORUM' => $user->lang('RETURN_TO', $topic_data['forum_name']), + 'S_VIEWTOPIC' => true, + 'S_UNREAD_VIEW' => $view == 'unread', + 'S_DISPLAY_SEARCHBOX' => ($auth->acl_get('u_search') && $auth->acl_get('f_search', $forum_id) && $config['load_search']) ? true : false, + 'S_SEARCHBOX_ACTION' => append_sid("{$phpbb_root_path}search.$phpEx"), + 'S_SEARCH_LOCAL_HIDDEN_FIELDS' => build_hidden_fields($s_search_hidden_fields), + + 'S_DISPLAY_POST_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, + 'S_DISPLAY_REPLY_INFO' => ($topic_data['forum_type'] == FORUM_POST && ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS)) ? true : false, + 'S_ENABLE_FEEDS_TOPIC' => ($config['feed_topic'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $topic_data['forum_options'])) ? true : false, + + 'U_TOPIC' => "{$server_path}viewtopic.$phpEx?f=$forum_id&t=$topic_id", + 'U_FORUM' => $server_path, + 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . (strlen($u_sort_param) ? "&$u_sort_param" : '')), + 'U_CANONICAL' => generate_board_url() . '/' . append_sid("viewtopic.$phpEx", "t=$topic_id" . (($start) ? "&start=$start" : ''), true, ''), + 'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id), + 'U_VIEW_OLDER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=previous"), + 'U_VIEW_NEWER_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=next"), + 'U_PRINT_TOPIC' => ($auth->acl_get('f_print', $forum_id)) ? $viewtopic_url . '&view=print' : '', + 'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&t=$topic_id") : '', + + 'U_WATCH_TOPIC' => $s_watching_topic['link'], + 'U_WATCH_TOPIC_TOGGLE' => $s_watching_topic['link_toggle'], + 'S_WATCH_TOPIC_TITLE' => $s_watching_topic['title'], + 'S_WATCH_TOPIC_TOGGLE' => $s_watching_topic['title_toggle'], + 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], + + 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', + 'S_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], + 'S_BOOKMARK_TOGGLE' => (!$user->data['is_registered'] || !$config['allow_bookmarks'] || !$topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], + 'S_BOOKMARKED_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? true : false, + + 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=post&f=$forum_id") : '', + 'U_POST_REPLY_TOPIC' => ($auth->acl_get('f_reply', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id") : '', + 'U_BUMP_TOPIC' => (bump_topic_allowed($forum_id, $topic_data['topic_bumped'], $topic_data['topic_last_post_time'], $topic_data['topic_poster'], $topic_data['topic_last_poster_id'])) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=bump&f=$forum_id&t=$topic_id&hash=" . generate_link_hash("topic_$topic_id")) : '') +); + +// Does this topic contain a poll? +if (!empty($topic_data['poll_start'])) +{ + $sql = 'SELECT o.*, p.bbcode_bitfield, p.bbcode_uid + FROM ' . POLL_OPTIONS_TABLE . ' o, ' . POSTS_TABLE . " p + WHERE o.topic_id = $topic_id + AND p.post_id = {$topic_data['topic_first_post_id']} + AND p.topic_id = o.topic_id + ORDER BY o.poll_option_id"; + $result = $db->sql_query($sql); + + $poll_info = $vote_counts = array(); + while ($row = $db->sql_fetchrow($result)) + { + $poll_info[] = $row; + $option_id = (int) $row['poll_option_id']; + $vote_counts[$option_id] = (int) $row['poll_option_total']; + } + $db->sql_freeresult($result); + + $cur_voted_id = array(); + if ($user->data['is_registered']) + { + $sql = 'SELECT poll_option_id + FROM ' . POLL_VOTES_TABLE . ' + WHERE topic_id = ' . $topic_id . ' + AND vote_user_id = ' . $user->data['user_id']; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $cur_voted_id[] = $row['poll_option_id']; + } + $db->sql_freeresult($result); + } + else + { + // Cookie based guest tracking ... I don't like this but hum ho + // it's oft requested. This relies on "nice" users who don't feel + // the need to delete cookies to mess with results. + if ($request->is_set($config['cookie_name'] . '_poll_' . $topic_id, \phpbb\request\request_interface::COOKIE)) + { + $cur_voted_id = explode(',', $request->variable($config['cookie_name'] . '_poll_' . $topic_id, '', true, \phpbb\request\request_interface::COOKIE)); + $cur_voted_id = array_map('intval', $cur_voted_id); + } + } + + // Can not vote at all if no vote permission + $s_can_vote = ($auth->acl_get('f_vote', $forum_id) && + (($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) && + $topic_data['topic_status'] != ITEM_LOCKED && + $topic_data['forum_status'] != ITEM_LOCKED && + (!count($cur_voted_id) || + ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']))) ? true : false; + $s_display_results = (!$s_can_vote || ($s_can_vote && count($cur_voted_id)) || $view == 'viewpoll') ? true : false; + + /** + * Event to manipulate the poll data + * + * @event core.viewtopic_modify_poll_data + * @var array cur_voted_id Array with options' IDs current user has voted for + * @var int forum_id The topic's forum id + * @var array poll_info Array with the poll information + * @var bool s_can_vote Flag indicating if a user can vote + * @var bool s_display_results Flag indicating if results or poll options should be displayed + * @var int topic_id The id of the topic the user tries to access + * @var array topic_data All the information from the topic and forum tables for this topic + * @var string viewtopic_url URL to the topic page + * @var array vote_counts Array with the vote counts for every poll option + * @var array voted_id Array with updated options' IDs current user is voting for + * @since 3.1.5-RC1 + */ + $vars = array( + 'cur_voted_id', + 'forum_id', + 'poll_info', + 's_can_vote', + 's_display_results', + 'topic_id', + 'topic_data', + 'viewtopic_url', + 'vote_counts', + 'voted_id', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_data', compact($vars))); + + if ($update && $s_can_vote) + { + + if (!count($voted_id) || count($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id) || !check_form_key('posting')) + { + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); + + meta_refresh(5, $redirect_url); + if (!count($voted_id)) + { + $message = 'NO_VOTE_OPTION'; + } + else if (count($voted_id) > $topic_data['poll_max_options']) + { + $message = 'TOO_MANY_VOTE_OPTIONS'; + } + else if (in_array(VOTE_CONVERTED, $cur_voted_id)) + { + $message = 'VOTE_CONVERTED'; + } + else + { + $message = 'FORM_INVALID'; + } + + $message = $user->lang[$message] . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + trigger_error($message); + } + + foreach ($voted_id as $option) + { + if (in_array($option, $cur_voted_id)) + { + continue; + } + + $sql = 'UPDATE ' . POLL_OPTIONS_TABLE . ' + SET poll_option_total = poll_option_total + 1 + WHERE poll_option_id = ' . (int) $option . ' + AND topic_id = ' . (int) $topic_id; + $db->sql_query($sql); + + $vote_counts[$option]++; + + if ($user->data['is_registered']) + { + $sql_ary = array( + 'topic_id' => (int) $topic_id, + 'poll_option_id' => (int) $option, + 'vote_user_id' => (int) $user->data['user_id'], + 'vote_user_ip' => (string) $user->ip, + ); + + $sql = 'INSERT INTO ' . POLL_VOTES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary); + $db->sql_query($sql); + } + } + + foreach ($cur_voted_id as $option) + { + if (!in_array($option, $voted_id)) + { + $sql = 'UPDATE ' . POLL_OPTIONS_TABLE . ' + SET poll_option_total = poll_option_total - 1 + WHERE poll_option_id = ' . (int) $option . ' + AND topic_id = ' . (int) $topic_id; + $db->sql_query($sql); + + $vote_counts[$option]--; + + if ($user->data['is_registered']) + { + $sql = 'DELETE FROM ' . POLL_VOTES_TABLE . ' + WHERE topic_id = ' . (int) $topic_id . ' + AND poll_option_id = ' . (int) $option . ' + AND vote_user_id = ' . (int) $user->data['user_id']; + $db->sql_query($sql); + } + } + } + + if ($user->data['user_id'] == ANONYMOUS && !$user->data['is_bot']) + { + $user->set_cookie('poll_' . $topic_id, implode(',', $voted_id), time() + 31536000); + } + + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET poll_last_vote = ' . time() . " + WHERE topic_id = $topic_id"; + //, topic_last_post_time = ' . time() . " -- for bumping topics with new votes, ignore for now + $db->sql_query($sql); + + $redirect_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start")); + $message = $user->lang['VOTE_SUBMITTED'] . '

' . sprintf($user->lang['RETURN_TOPIC'], '', ''); + + if ($request->is_ajax()) + { + // Filter out invalid options + $valid_user_votes = array_intersect(array_keys($vote_counts), $voted_id); + + $data = array( + 'NO_VOTES' => $user->lang['NO_VOTES'], + 'success' => true, + 'user_votes' => array_flip($valid_user_votes), + 'vote_counts' => $vote_counts, + 'total_votes' => array_sum($vote_counts), + 'can_vote' => !count($valid_user_votes) || ($auth->acl_get('f_votechg', $forum_id) && $topic_data['poll_vote_change']), + ); + + /** + * Event to manipulate the poll data sent by AJAX response + * + * @event core.viewtopic_modify_poll_ajax_data + * @var array data JSON response data + * @var array valid_user_votes Valid user votes + * @var array vote_counts Vote counts + * @var int forum_id Forum ID + * @var array topic_data Topic data + * @var array poll_info Array with the poll information + * @since 3.2.4-RC1 + */ + $vars = array( + 'data', + 'valid_user_votes', + 'vote_counts', + 'forum_id', + 'topic_data', + 'poll_info', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_ajax_data', compact($vars))); + + $json_response = new \phpbb\json_response(); + $json_response->send($data); + } + + meta_refresh(5, $redirect_url); + trigger_error($message); + } + + $poll_total = 0; + $poll_most = 0; + foreach ($poll_info as $poll_option) + { + $poll_total += $poll_option['poll_option_total']; + $poll_most = ($poll_option['poll_option_total'] >= $poll_most) ? $poll_option['poll_option_total'] : $poll_most; + } + + $parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES; + + for ($i = 0, $size = count($poll_info); $i < $size; $i++) + { + $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'] = generate_text_for_display($topic_data['poll_title'], $poll_info[0]['bbcode_uid'], $poll_info[0]['bbcode_bitfield'], $parse_flags, true); + + $poll_template_data = $poll_options_template_data = array(); + foreach ($poll_info as $poll_option) + { + $option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0; + $option_pct_txt = sprintf("%.1d%%", round($option_pct * 100)); + $option_pct_rel = ($poll_most > 0) ? $poll_option['poll_option_total'] / $poll_most : 0; + $option_pct_rel_txt = sprintf("%.1d%%", round($option_pct_rel * 100)); + $option_most_votes = ($poll_option['poll_option_total'] > 0 && $poll_option['poll_option_total'] == $poll_most) ? true : false; + + $poll_options_template_data[] = array( + 'POLL_OPTION_ID' => $poll_option['poll_option_id'], + 'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'], + 'POLL_OPTION_RESULT' => $poll_option['poll_option_total'], + 'POLL_OPTION_PERCENT' => $option_pct_txt, + 'POLL_OPTION_PERCENT_REL' => $option_pct_rel_txt, + 'POLL_OPTION_PCT' => round($option_pct * 100), + 'POLL_OPTION_WIDTH' => round($option_pct * 250), + 'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false, + 'POLL_OPTION_MOST_VOTES' => $option_most_votes, + ); + } + + $poll_end = $topic_data['poll_length'] + $topic_data['poll_start']; + + $poll_template_data = array( + 'POLL_QUESTION' => $topic_data['poll_title'], + 'TOTAL_VOTES' => $poll_total, + 'POLL_LEFT_CAP_IMG' => $user->img('poll_left'), + 'POLL_RIGHT_CAP_IMG'=> $user->img('poll_right'), + + 'L_MAX_VOTES' => $user->lang('MAX_OPTIONS_SELECT', (int) $topic_data['poll_max_options']), + 'L_POLL_LENGTH' => ($topic_data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '', + + 'S_HAS_POLL' => true, + 'S_CAN_VOTE' => $s_can_vote, + 'S_DISPLAY_RESULTS' => $s_display_results, + 'S_IS_MULTI_CHOICE' => ($topic_data['poll_max_options'] > 1) ? true : false, + 'S_POLL_ACTION' => $viewtopic_url, + + 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll', + ); + + /** + * Event to add/modify poll template data + * + * @event core.viewtopic_modify_poll_template_data + * @var array cur_voted_id Array with options' IDs current user has voted for + * @var int poll_end The poll end time + * @var array poll_info Array with the poll information + * @var array poll_options_template_data Array with the poll options template data + * @var array poll_template_data Array with the common poll template data + * @var int poll_total Total poll votes count + * @var int poll_most Mostly voted option votes count + * @var array topic_data All the information from the topic and forum tables for this topic + * @var string viewtopic_url URL to the topic page + * @var array vote_counts Array with the vote counts for every poll option + * @var array voted_id Array with updated options' IDs current user is voting for + * @since 3.1.5-RC1 + */ + $vars = array( + 'cur_voted_id', + 'poll_end', + 'poll_info', + 'poll_options_template_data', + 'poll_template_data', + 'poll_total', + 'poll_most', + 'topic_data', + 'viewtopic_url', + 'vote_counts', + 'voted_id', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_poll_template_data', compact($vars))); + + $template->assign_block_vars_array('poll_option', $poll_options_template_data); + + $template->assign_vars($poll_template_data); + + unset($poll_end, $poll_info, $poll_options_template_data, $poll_template_data, $voted_id); +} + +// If the user is trying to reach the second half of the topic, fetch it starting from the end +$store_reverse = false; +$sql_limit = $config['posts_per_page']; +$sql_sort_order = $direction = ''; + +if ($start > $total_posts / 2) +{ + $store_reverse = true; + + // Select the sort order + $direction = (($sort_dir == 'd') ? 'ASC' : 'DESC'); + + $sql_limit = $pagination->reverse_limit($start, $sql_limit, $total_posts); + $sql_start = $pagination->reverse_start($start, $sql_limit, $total_posts); +} +else +{ + // Select the sort order + $direction = (($sort_dir == 'd') ? 'DESC' : 'ASC'); + $sql_start = $start; +} + +if (is_array($sort_by_sql[$sort_key])) +{ + $sql_sort_order = implode(' ' . $direction . ', ', $sort_by_sql[$sort_key]) . ' ' . $direction; +} +else +{ + $sql_sort_order = $sort_by_sql[$sort_key] . ' ' . $direction; +} + +// Container for user details, only process once +$post_list = $user_cache = $id_cache = $attachments = $attach_list = $rowset = $update_count = $post_edit_list = $post_delete_list = array(); +$has_unapproved_attachments = $has_approved_attachments = $display_notice = false; +$i = $i_total = 0; + +// Go ahead and pull all data for this topic +$sql = 'SELECT p.post_id + FROM ' . POSTS_TABLE . ' p' . (($join_user_sql[$sort_key]) ? ', ' . USERS_TABLE . ' u': '') . " + WHERE p.topic_id = $topic_id + AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.') . " + " . (($join_user_sql[$sort_key]) ? 'AND u.user_id = p.poster_id': '') . " + $limit_posts_time + ORDER BY $sql_sort_order"; + +/** +* Event to modify the SQL query that gets post_list +* +* @event core.viewtopic_modify_post_list_sql +* @var string sql The SQL query to generate the post_list +* @var int sql_limit The number of posts the query fetches +* @var int sql_start The index the query starts to fetch from +* @var string sort_key Key the posts are sorted by +* @var string sort_days Display posts of previous x days +* @var int forum_id Forum ID +* @since 3.2.4-RC1 +*/ +$vars = array( + 'sql', + 'sql_limit', + 'sql_start', + 'sort_key', + 'sort_days', + 'forum_id', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_list_sql', compact($vars))); + +$result = $db->sql_query_limit($sql, $sql_limit, $sql_start); + +$i = ($store_reverse) ? $sql_limit - 1 : 0; +while ($row = $db->sql_fetchrow($result)) +{ + $post_list[$i] = (int) $row['post_id']; + ($store_reverse) ? $i-- : $i++; +} +$db->sql_freeresult($result); + +if (!count($post_list)) +{ + if ($sort_days) + { + trigger_error('NO_POSTS_TIME_FRAME'); + } + else + { + trigger_error('NO_TOPIC'); + } +} + +// Holding maximum post time for marking topic read +// We need to grab it because we do reverse ordering sometimes +$max_post_time = 0; + +$sql_ary = array( + 'SELECT' => 'u.*, z.friend, z.foe, p.*', + + 'FROM' => array( + USERS_TABLE => 'u', + POSTS_TABLE => 'p', + ), + + 'LEFT_JOIN' => array( + array( + 'FROM' => array(ZEBRA_TABLE => 'z'), + 'ON' => 'z.user_id = ' . $user->data['user_id'] . ' AND z.zebra_id = p.poster_id', + ), + ), + + 'WHERE' => $db->sql_in_set('p.post_id', $post_list) . ' + AND u.user_id = p.poster_id', +); + +/** +* Event to modify the SQL query before the post and poster data is retrieved +* +* @event core.viewtopic_get_post_data +* @var int forum_id Forum ID +* @var int topic_id Topic ID +* @var array topic_data Array with topic data +* @var array post_list Array with post_ids we are going to retrieve +* @var int sort_days Display posts of previous x days +* @var string sort_key Key the posts are sorted by +* @var string sort_dir Direction the posts are sorted by +* @var int start Pagination information +* @var array sql_ary The SQL array to get the data of posts and posters +* @since 3.1.0-a1 +* @changed 3.1.0-a2 Added vars forum_id, topic_id, topic_data, post_list, sort_days, sort_key, sort_dir, start +*/ +$vars = array( + 'forum_id', + 'topic_id', + 'topic_data', + 'post_list', + 'sort_days', + 'sort_key', + 'sort_dir', + 'start', + 'sql_ary', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_post_data', compact($vars))); + +$sql = $db->sql_build_query('SELECT', $sql_ary); +$result = $db->sql_query($sql); + +$now = $user->create_datetime(); +$now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset()); + +// Posts are stored in the $rowset array while $attach_list, $user_cache +// and the global bbcode_bitfield are built +while ($row = $db->sql_fetchrow($result)) +{ + // Set max_post_time + if ($row['post_time'] > $max_post_time) + { + $max_post_time = $row['post_time']; + } + + $poster_id = (int) $row['poster_id']; + + // Does post have an attachment? If so, add it to the list + if ($row['post_attachment'] && $config['allow_attachments']) + { + $attach_list[] = (int) $row['post_id']; + + if ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) + { + $has_unapproved_attachments = true; + } + else if ($row['post_visibility'] == ITEM_APPROVED) + { + $has_approved_attachments = true; + } + } + + $rowset_data = array( + 'hide_post' => (($row['foe'] || $row['post_visibility'] == ITEM_DELETED) && ($view != 'show' || $post_id != $row['post_id'])) ? true : false, + + 'post_id' => $row['post_id'], + 'post_time' => $row['post_time'], + 'user_id' => $row['user_id'], + 'username' => $row['username'], + 'user_colour' => $row['user_colour'], + 'topic_id' => $row['topic_id'], + 'forum_id' => $row['forum_id'], + 'post_subject' => $row['post_subject'], + 'post_edit_count' => $row['post_edit_count'], + 'post_edit_time' => $row['post_edit_time'], + 'post_edit_reason' => $row['post_edit_reason'], + 'post_edit_user' => $row['post_edit_user'], + 'post_edit_locked' => $row['post_edit_locked'], + 'post_delete_time' => $row['post_delete_time'], + 'post_delete_reason'=> $row['post_delete_reason'], + 'post_delete_user' => $row['post_delete_user'], + + // Make sure the icon actually exists + 'icon_id' => (isset($icons[$row['icon_id']]['img'], $icons[$row['icon_id']]['height'], $icons[$row['icon_id']]['width'])) ? $row['icon_id'] : 0, + 'post_attachment' => $row['post_attachment'], + 'post_visibility' => $row['post_visibility'], + 'post_reported' => $row['post_reported'], + 'post_username' => $row['post_username'], + 'post_text' => $row['post_text'], + 'bbcode_uid' => $row['bbcode_uid'], + 'bbcode_bitfield' => $row['bbcode_bitfield'], + 'enable_smilies' => $row['enable_smilies'], + 'enable_sig' => $row['enable_sig'], + 'friend' => $row['friend'], + 'foe' => $row['foe'], + ); + + /** + * Modify the post rowset containing data to be displayed with posts + * + * @event core.viewtopic_post_rowset_data + * @var array rowset_data Array with the rowset data for this post + * @var array row Array with original user and post data + * @since 3.1.0-a1 + */ + $vars = array('rowset_data', 'row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_rowset_data', compact($vars))); + + $rowset[$row['post_id']] = $rowset_data; + + // Cache various user specific data ... so we don't have to recompute + // this each time the same user appears on this page + if (!isset($user_cache[$poster_id])) + { + if ($poster_id == ANONYMOUS) + { + $user_cache_data = array( + 'user_type' => USER_IGNORE, + 'joined' => '', + 'posts' => '', + + 'sig' => '', + 'sig_bbcode_uid' => '', + 'sig_bbcode_bitfield' => '', + + 'online' => false, + 'avatar' => ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($row) : '', + 'rank_title' => '', + 'rank_image' => '', + 'rank_image_src' => '', + 'pm' => '', + 'email' => '', + 'jabber' => '', + 'search' => '', + 'age' => '', + + 'username' => $row['username'], + 'user_colour' => $row['user_colour'], + 'contact_user' => '', + + 'warnings' => 0, + 'allow_pm' => 0, + ); + + /** + * Modify the guest user's data displayed with the posts + * + * @event core.viewtopic_cache_guest_data + * @var array user_cache_data Array with the user's data + * @var int poster_id Poster's user id + * @var array row Array with original user and post data + * @since 3.1.0-a1 + */ + $vars = array('user_cache_data', 'poster_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_guest_data', compact($vars))); + + $user_cache[$poster_id] = $user_cache_data; + + $user_rank_data = phpbb_get_user_rank($row, false); + $user_cache[$poster_id]['rank_title'] = $user_rank_data['title']; + $user_cache[$poster_id]['rank_image'] = $user_rank_data['img']; + $user_cache[$poster_id]['rank_image_src'] = $user_rank_data['img_src']; + } + else + { + $user_sig = ''; + + // We add the signature to every posters entry because enable_sig is post dependent + if ($row['user_sig'] && $config['allow_sig'] && $user->optionget('viewsigs')) + { + $user_sig = $row['user_sig']; + } + + $id_cache[] = $poster_id; + + $user_cache_data = array( + 'user_type' => $row['user_type'], + 'user_inactive_reason' => $row['user_inactive_reason'], + + 'joined' => $user->format_date($row['user_regdate']), + 'posts' => $row['user_posts'], + 'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0, + + 'sig' => $user_sig, + 'sig_bbcode_uid' => (!empty($row['user_sig_bbcode_uid'])) ? $row['user_sig_bbcode_uid'] : '', + 'sig_bbcode_bitfield' => (!empty($row['user_sig_bbcode_bitfield'])) ? $row['user_sig_bbcode_bitfield'] : '', + + 'viewonline' => $row['user_allow_viewonline'], + 'allow_pm' => $row['user_allow_pm'], + + 'avatar' => ($user->optionget('viewavatars')) ? phpbb_get_user_avatar($row) : '', + 'age' => '', + + 'rank_title' => '', + 'rank_image' => '', + 'rank_image_src' => '', + + 'username' => $row['username'], + 'user_colour' => $row['user_colour'], + 'contact_user' => $user->lang('CONTACT_USER', get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['username'])), + + 'online' => false, + 'jabber' => ($config['jab_enable'] && $row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', + 'search' => ($config['load_search'] && $auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '', + + 'author_full' => get_username_string('full', $poster_id, $row['username'], $row['user_colour']), + 'author_colour' => get_username_string('colour', $poster_id, $row['username'], $row['user_colour']), + 'author_username' => get_username_string('username', $poster_id, $row['username'], $row['user_colour']), + 'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']), + ); + + /** + * Modify the users' data displayed with their posts + * + * @event core.viewtopic_cache_user_data + * @var array user_cache_data Array with the user's data + * @var int poster_id Poster's user id + * @var array row Array with original user and post data + * @since 3.1.0-a1 + */ + $vars = array('user_cache_data', 'poster_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_user_data', compact($vars))); + + $user_cache[$poster_id] = $user_cache_data; + + $user_rank_data = phpbb_get_user_rank($row, $row['user_posts']); + $user_cache[$poster_id]['rank_title'] = $user_rank_data['title']; + $user_cache[$poster_id]['rank_image'] = $user_rank_data['img']; + $user_cache[$poster_id]['rank_image_src'] = $user_rank_data['img_src']; + + if ((!empty($row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) + { + $user_cache[$poster_id]['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$poster_id") : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); + } + else + { + $user_cache[$poster_id]['email'] = ''; + } + + if ($config['allow_birthdays'] && !empty($row['user_birthday'])) + { + list($bday_day, $bday_month, $bday_year) = array_map('intval', explode('-', $row['user_birthday'])); + + if ($bday_year) + { + $diff = $now['mon'] - $bday_month; + if ($diff == 0) + { + $diff = ($now['mday'] - $bday_day < 0) ? 1 : 0; + } + else + { + $diff = ($diff < 0) ? 1 : 0; + } + + $user_cache[$poster_id]['age'] = (int) ($now['year'] - $bday_year - $diff); + } + } + } + } +} +$db->sql_freeresult($result); + +// Load custom profile fields +if ($config['load_cpf_viewtopic']) +{ + /* @var $cp \phpbb\profilefields\manager */ + $cp = $phpbb_container->get('profilefields.manager'); + + // Grab all profile fields from users in id cache for later use - similar to the poster cache + $profile_fields_tmp = $cp->grab_profile_fields_data($id_cache); + + // filter out fields not to be displayed on viewtopic. Yes, it's a hack, but this shouldn't break any MODs. + $profile_fields_cache = array(); + foreach ($profile_fields_tmp as $profile_user_id => $profile_fields) + { + $profile_fields_cache[$profile_user_id] = array(); + foreach ($profile_fields as $used_ident => $profile_field) + { + if ($profile_field['data']['field_show_on_vt']) + { + $profile_fields_cache[$profile_user_id][$used_ident] = $profile_field; + } + } + } + unset($profile_fields_tmp); +} + +// Generate online information for user +if ($config['load_onlinetrack'] && count($id_cache)) +{ + $sql = 'SELECT session_user_id, MAX(session_time) as online_time, MIN(session_viewonline) AS viewonline + FROM ' . SESSIONS_TABLE . ' + WHERE ' . $db->sql_in_set('session_user_id', $id_cache) . ' + GROUP BY session_user_id'; + $result = $db->sql_query($sql); + + $update_time = $config['load_online_time'] * 60; + while ($row = $db->sql_fetchrow($result)) + { + $user_cache[$row['session_user_id']]['online'] = (time() - $update_time < $row['online_time'] && (($row['viewonline']) || $auth->acl_get('u_viewonline'))) ? true : false; + } + $db->sql_freeresult($result); +} +unset($id_cache); + +// Pull attachment data +if (count($attach_list)) +{ + if ($auth->acl_get('u_download') && $auth->acl_get('f_download', $forum_id)) + { + $sql = 'SELECT * + FROM ' . ATTACHMENTS_TABLE . ' + WHERE ' . $db->sql_in_set('post_msg_id', $attach_list) . ' + AND in_message = 0 + ORDER BY attach_id DESC, post_msg_id ASC'; + $result = $db->sql_query($sql); + + while ($row = $db->sql_fetchrow($result)) + { + $attachments[$row['post_msg_id']][] = $row; + } + $db->sql_freeresult($result); + + // No attachments exist, but post table thinks they do so go ahead and reset post_attach flags + if (!count($attachments)) + { + $sql = 'UPDATE ' . POSTS_TABLE . ' + SET post_attachment = 0 + WHERE ' . $db->sql_in_set('post_id', $attach_list); + $db->sql_query($sql); + + // We need to update the topic indicator too if the complete topic is now without an attachment + if (count($rowset) != $total_posts) + { + // Not all posts are displayed so we query the db to find if there's any attachment for this topic + $sql = 'SELECT a.post_msg_id as post_id + FROM ' . ATTACHMENTS_TABLE . ' a, ' . POSTS_TABLE . " p + WHERE p.topic_id = $topic_id + AND p.post_visibility = " . ITEM_APPROVED . ' + AND p.topic_id = a.topic_id'; + $result = $db->sql_query_limit($sql, 1); + $row = $db->sql_fetchrow($result); + $db->sql_freeresult($result); + + if (!$row) + { + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_attachment = 0 + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + } + } + else + { + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_attachment = 0 + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + } + } + else if ($has_approved_attachments && !$topic_data['topic_attachment']) + { + // Topic has approved attachments but its flag is wrong + $sql = 'UPDATE ' . TOPICS_TABLE . " + SET topic_attachment = 1 + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + + $topic_data['topic_attachment'] = 1; + } + else if ($has_unapproved_attachments && !$topic_data['topic_attachment']) + { + // Topic has only unapproved attachments but we have the right to see and download them + $topic_data['topic_attachment'] = 1; + } + } + else + { + $display_notice = true; + } +} + +if ($config['enable_accurate_pm_button']) +{ + // Get the list of users who can receive private messages + $can_receive_pm_list = $auth->acl_get_list(array_keys($user_cache), 'u_readpm'); + $can_receive_pm_list = (empty($can_receive_pm_list) || !isset($can_receive_pm_list[0]['u_readpm'])) ? array() : $can_receive_pm_list[0]['u_readpm']; + + // Get the list of permanently banned users + $permanently_banned_users = phpbb_get_banned_user_ids(array_keys($user_cache), false); +} +else +{ + $can_receive_pm_list = array_keys($user_cache); + $permanently_banned_users = []; +} + +$i_total = count($rowset) - 1; +$prev_post_id = ''; + +$template->assign_vars(array( + 'S_HAS_ATTACHMENTS' => $topic_data['topic_attachment'], + 'S_NUM_POSTS' => count($post_list)) +); + +/** +* Event to modify the post, poster and attachment data before assigning the posts +* +* @event core.viewtopic_modify_post_data +* @var int forum_id Forum ID +* @var int topic_id Topic ID +* @var array topic_data Array with topic data +* @var array post_list Array with post_ids we are going to display +* @var array rowset Array with post_id => post data +* @var array user_cache Array with prepared user data +* @var int start Pagination information +* @var int sort_days Display posts of previous x days +* @var string sort_key Key the posts are sorted by +* @var string sort_dir Direction the posts are sorted by +* @var bool display_notice Shall we display a notice instead of attachments +* @var bool has_approved_attachments Does the topic have approved attachments +* @var array attachments List of attachments post_id => array of attachments +* @var array permanently_banned_users List of permanently banned users +* @var array can_receive_pm_list Array with posters that can receive pms +* @since 3.1.0-RC3 +*/ +$vars = array( + 'forum_id', + 'topic_id', + 'topic_data', + 'post_list', + 'rowset', + 'user_cache', + 'sort_days', + 'sort_key', + 'sort_dir', + 'start', + 'permanently_banned_users', + 'can_receive_pm_list', + 'display_notice', + 'has_approved_attachments', + 'attachments', +); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_data', compact($vars))); + +// Output the posts +$first_unread = $post_unread = false; +for ($i = 0, $end = count($post_list); $i < $end; ++$i) +{ + // A non-existing rowset only happens if there was no user present for the entered poster_id + // This could be a broken posts table. + if (!isset($rowset[$post_list[$i]])) + { + continue; + } + + $row = $rowset[$post_list[$i]]; + $poster_id = $row['user_id']; + + // End signature parsing, only if needed + if ($user_cache[$poster_id]['sig'] && $row['enable_sig'] && empty($user_cache[$poster_id]['sig_parsed'])) + { + $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); + $user_cache[$poster_id]['sig_parsed'] = true; + } + + // Parse the message and subject + $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']])) + { + parse_attachments($forum_id, $message, $attachments[$row['post_id']], $update_count); + } + + // Replace naughty words such as farty pants + $row['post_subject'] = censor_text($row['post_subject']); + + // Highlight active words (primarily for search) + if ($highlight_match) + { + $message = preg_replace('#(?!<.*)(?]*(?:)#is', '\1', $message); + $row['post_subject'] = preg_replace('#(?!<.*)(?]*(?:)#is', '\1', $row['post_subject']); + } + + // Editing information + if (($row['post_edit_count'] && $config['display_last_edited']) || $row['post_edit_reason']) + { + // Get usernames for all following posts if not already stored + if (!count($post_edit_list) && ($row['post_edit_reason'] || ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])))) + { + // Remove all post_ids already parsed (we do not have to check them) + $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i); + + $sql = 'SELECT DISTINCT u.user_id, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . $db->sql_in_set('p.post_id', $post_storage_list) . ' + AND p.post_edit_count <> 0 + AND p.post_edit_user <> 0 + AND p.post_edit_user = u.user_id'; + $result2 = $db->sql_query($sql); + while ($user_edit_row = $db->sql_fetchrow($result2)) + { + $post_edit_list[$user_edit_row['user_id']] = $user_edit_row; + } + $db->sql_freeresult($result2); + + unset($post_storage_list); + } + + if ($row['post_edit_reason']) + { + // User having edited the post also being the post author? + if (!$row['post_edit_user'] || $row['post_edit_user'] == $poster_id) + { + $display_username = get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + } + else + { + $display_username = get_username_string('full', $row['post_edit_user'], $post_edit_list[$row['post_edit_user']]['username'], $post_edit_list[$row['post_edit_user']]['user_colour']); + } + + $l_edited_by = $user->lang('EDITED_TIMES_TOTAL', (int) $row['post_edit_count'], $display_username, $user->format_date($row['post_edit_time'], false, true)); + } + else + { + if ($row['post_edit_user'] && !isset($user_cache[$row['post_edit_user']])) + { + $user_cache[$row['post_edit_user']] = $post_edit_list[$row['post_edit_user']]; + } + + // User having edited the post also being the post author? + if (!$row['post_edit_user'] || $row['post_edit_user'] == $poster_id) + { + $display_username = get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + } + else + { + $display_username = get_username_string('full', $row['post_edit_user'], $user_cache[$row['post_edit_user']]['username'], $user_cache[$row['post_edit_user']]['user_colour']); + } + + $l_edited_by = $user->lang('EDITED_TIMES_TOTAL', (int) $row['post_edit_count'], $display_username, $user->format_date($row['post_edit_time'], false, true)); + } + } + else + { + $l_edited_by = ''; + } + + // Deleting information + if ($row['post_visibility'] == ITEM_DELETED && $row['post_delete_user']) + { + // Get usernames for all following posts if not already stored + if (!count($post_delete_list) && ($row['post_delete_reason'] || ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']])))) + { + // Remove all post_ids already parsed (we do not have to check them) + $post_storage_list = (!$store_reverse) ? array_slice($post_list, $i) : array_slice(array_reverse($post_list), $i); + + $sql = 'SELECT DISTINCT u.user_id, u.username, u.user_colour + FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u + WHERE ' . $db->sql_in_set('p.post_id', $post_storage_list) . ' + AND p.post_delete_user <> 0 + AND p.post_delete_user = u.user_id'; + $result2 = $db->sql_query($sql); + while ($user_delete_row = $db->sql_fetchrow($result2)) + { + $post_delete_list[$user_delete_row['user_id']] = $user_delete_row; + } + $db->sql_freeresult($result2); + + unset($post_storage_list); + } + + if ($row['post_delete_user'] && !isset($user_cache[$row['post_delete_user']])) + { + $user_cache[$row['post_delete_user']] = $post_delete_list[$row['post_delete_user']]; + } + + $display_postername = get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']); + + // User having deleted the post also being the post author? + if (!$row['post_delete_user'] || $row['post_delete_user'] == $poster_id) + { + $display_username = $display_postername; + } + else + { + $display_username = get_username_string('full', $row['post_delete_user'], $user_cache[$row['post_delete_user']]['username'], $user_cache[$row['post_delete_user']]['user_colour']); + } + + if ($row['post_delete_reason']) + { + $l_deleted_message = $user->lang('POST_DELETED_BY_REASON', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true), $row['post_delete_reason']); + } + else + { + $l_deleted_message = $user->lang('POST_DELETED_BY', $display_postername, $display_username, $user->format_date($row['post_delete_time'], false, true)); + } + $l_deleted_by = $user->lang('DELETED_INFORMATION', $display_username, $user->format_date($row['post_delete_time'], false, true)); + } + else + { + $l_deleted_by = $l_deleted_message = ''; + } + + // Bump information + if ($topic_data['topic_bumped'] && $row['post_id'] == $topic_data['topic_last_post_id'] && isset($user_cache[$topic_data['topic_bumper']]) ) + { + // It is safe to grab the username from the user cache array, we are at the last + // post and only the topic poster and last poster are allowed to bump. + // Admins and mods are bound to the above rules too... + $l_bumped_by = sprintf($user->lang['BUMPED_BY'], $user_cache[$topic_data['topic_bumper']]['username'], $user->format_date($topic_data['topic_last_post_time'], false, true)); + } + else + { + $l_bumped_by = ''; + } + + $cp_row = array(); + + // + if ($config['load_cpf_viewtopic']) + { + $cp_row = (isset($profile_fields_cache[$poster_id])) ? $cp->generate_profile_fields_template_data($profile_fields_cache[$poster_id]) : array(); + } + + $post_unread = (isset($topic_tracking_info[$topic_id]) && $row['post_time'] > $topic_tracking_info[$topic_id]) ? true : false; + + $s_first_unread = false; + if (!$first_unread && $post_unread) + { + $s_first_unread = $first_unread = true; + } + + $force_edit_allowed = $force_delete_allowed = $force_softdelete_allowed = false; + + $s_cannot_edit = !$auth->acl_get('f_edit', $forum_id) || $user->data['user_id'] != $poster_id; + $s_cannot_edit_time = $config['edit_time'] && $row['post_time'] <= time() - ($config['edit_time'] * 60); + $s_cannot_edit_locked = $topic_data['topic_status'] == ITEM_LOCKED || $row['post_edit_locked']; + + $s_cannot_delete = $user->data['user_id'] != $poster_id || ( + !$auth->acl_get('f_delete', $forum_id) && + (!$auth->acl_get('f_softdelete', $forum_id) || $row['post_visibility'] == ITEM_DELETED) + ); + $s_cannot_delete_lastpost = $topic_data['topic_last_post_id'] != $row['post_id']; + $s_cannot_delete_time = $config['delete_time'] && $row['post_time'] <= time() - ($config['delete_time'] * 60); + // we do not want to allow removal of the last post if a moderator locked it! + $s_cannot_delete_locked = $topic_data['topic_status'] == ITEM_LOCKED || $row['post_edit_locked']; + + /** + * This event allows you to modify the conditions for the "can edit post" and "can delete post" checks + * + * @event core.viewtopic_modify_post_action_conditions + * @var array row Array with post data + * @var array topic_data Array with topic data + * @var bool force_edit_allowed Allow the user to edit the post (all permissions and conditions are ignored) + * @var bool s_cannot_edit User can not edit the post because it's not his + * @var bool s_cannot_edit_locked User can not edit the post because it's locked + * @var bool s_cannot_edit_time User can not edit the post because edit_time has passed + * @var bool force_delete_allowed Allow the user to delete the post (all permissions and conditions are ignored) + * @var bool s_cannot_delete User can not delete the post because it's not his + * @var bool s_cannot_delete_lastpost User can not delete the post because it's not the last post of the topic + * @var bool s_cannot_delete_locked User can not delete the post because it's locked + * @var bool s_cannot_delete_time User can not delete the post because edit_time has passed + * @var bool force_softdelete_allowed Allow the user to ыoftdelete the post (all permissions and conditions are ignored) + * @since 3.1.0-b4 + * @changed 3.1.11-RC1 Added force_softdelete_allowed var + */ + $vars = array( + 'row', + 'topic_data', + 'force_edit_allowed', + 's_cannot_edit', + 's_cannot_edit_locked', + 's_cannot_edit_time', + 'force_delete_allowed', + 's_cannot_delete', + 's_cannot_delete_lastpost', + 's_cannot_delete_locked', + 's_cannot_delete_time', + 'force_softdelete_allowed', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_action_conditions', compact($vars))); + + $edit_allowed = $force_edit_allowed || ($user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || ( + !$s_cannot_edit && + !$s_cannot_edit_time && + !$s_cannot_edit_locked + ))); + + $quote_allowed = $auth->acl_get('m_edit', $forum_id) || ($topic_data['topic_status'] != ITEM_LOCKED && + ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('f_reply', $forum_id)) + ); + + // Only display the quote button if the post is quotable. Posts not approved are not quotable. + $quote_allowed = ($quote_allowed && $row['post_visibility'] == ITEM_APPROVED) ? true : false; + + $delete_allowed = $force_delete_allowed || ($user->data['is_registered'] && ( + ($auth->acl_get('m_delete', $forum_id) || ($auth->acl_get('m_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) || + (!$s_cannot_delete && !$s_cannot_delete_lastpost && !$s_cannot_delete_time && !$s_cannot_delete_locked) + )); + + $softdelete_allowed = $force_softdelete_allowed || (($auth->acl_get('m_softdelete', $forum_id) || + ($auth->acl_get('f_softdelete', $forum_id) && $user->data['user_id'] == $poster_id)) && ($row['post_visibility'] != ITEM_DELETED)); + + $permanent_delete_allowed = $force_delete_allowed || ($auth->acl_get('m_delete', $forum_id) || + ($auth->acl_get('f_delete', $forum_id) && $user->data['user_id'] == $poster_id)); + + // Can this user receive a Private Message? + $can_receive_pm = ( + // They must be a "normal" user + $user_cache[$poster_id]['user_type'] != USER_IGNORE && + + // They must not be deactivated by the administrator + ($user_cache[$poster_id]['user_type'] != USER_INACTIVE || $user_cache[$poster_id]['user_inactive_reason'] != INACTIVE_MANUAL) && + + // They must be able to read PMs + in_array($poster_id, $can_receive_pm_list) && + + // They must not be permanently banned + !in_array($poster_id, $permanently_banned_users) && + + // They must allow users to contact via PM + (($auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) || $user_cache[$poster_id]['allow_pm']) + ); + + $u_pm = ''; + + if ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && $can_receive_pm) + { + $u_pm = append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']); + } + + // + $post_row = array( + 'POST_AUTHOR_FULL' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_full'] : get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR_COLOUR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_colour'] : get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'POST_AUTHOR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_username'] : get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + 'U_POST_AUTHOR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_profile'] : get_username_string('profile', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), + + 'RANK_TITLE' => $user_cache[$poster_id]['rank_title'], + 'RANK_IMG' => $user_cache[$poster_id]['rank_image'], + 'RANK_IMG_SRC' => $user_cache[$poster_id]['rank_image_src'], + 'POSTER_JOINED' => $user_cache[$poster_id]['joined'], + 'POSTER_POSTS' => $user_cache[$poster_id]['posts'], + 'POSTER_AVATAR' => $user_cache[$poster_id]['avatar'], + 'POSTER_WARNINGS' => $auth->acl_get('m_warn') ? $user_cache[$poster_id]['warnings'] : '', + 'POSTER_AGE' => $user_cache[$poster_id]['age'], + 'CONTACT_USER' => $user_cache[$poster_id]['contact_user'], + + 'POST_DATE' => $user->format_date($row['post_time'], false, ($view == 'print') ? true : false), + 'POST_SUBJECT' => $row['post_subject'], + 'MESSAGE' => $message, + 'SIGNATURE' => ($row['enable_sig']) ? $user_cache[$poster_id]['sig'] : '', + 'EDITED_MESSAGE' => $l_edited_by, + 'EDIT_REASON' => $row['post_edit_reason'], + 'DELETED_MESSAGE' => $l_deleted_by, + 'DELETE_REASON' => $row['post_delete_reason'], + 'BUMPED_MESSAGE' => $l_bumped_by, + + 'MINI_POST_IMG' => ($post_unread) ? $user->img('icon_post_target_unread', 'UNREAD_POST') : $user->img('icon_post_target', 'POST'), + 'POST_ICON_IMG' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['img'] : '', + 'POST_ICON_IMG_WIDTH' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['width'] : '', + 'POST_ICON_IMG_HEIGHT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['height'] : '', + 'POST_ICON_IMG_ALT' => ($topic_data['enable_icons'] && !empty($row['icon_id'])) ? $icons[$row['icon_id']]['alt'] : '', + 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), + 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), + + 'U_EDIT' => ($edit_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : '', + 'U_QUOTE' => ($quote_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f=$forum_id&p={$row['post_id']}") : '', + 'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '', + 'U_DELETE' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=' . (($softdelete_allowed) ? 'soft_delete' : 'delete') . "&f=$forum_id&p={$row['post_id']}") : '', + + 'U_SEARCH' => $user_cache[$poster_id]['search'], + 'U_PM' => $u_pm, + 'U_EMAIL' => $user_cache[$poster_id]['email'], + 'U_JABBER' => $user_cache[$poster_id]['jabber'], + + 'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p={$row['post_id']}&f=$forum_id&redirect=" . urlencode(str_replace('&', '&', $viewtopic_url . '&p=' . $row['post_id'] . '#p' . $row['post_id']))), + 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? $phpbb_container->get('controller.helper')->route('phpbb_report_post_controller', array('id' => $row['post_id'])) : '', + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_MCP_RESTORE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_data['topic_visibility'] != ITEM_DELETED) ? 'deleted_posts' : 'deleted_topics') . '&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . '#p' . $row['post_id'], + 'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '', + 'U_PREV_POST_ID' => $prev_post_id, + 'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $poster_id, true, $user->session_id) : '', + 'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + + 'POST_ID' => $row['post_id'], + 'POST_NUMBER' => $i + $start + 1, + 'POSTER_ID' => $poster_id, + 'MINI_POST' => ($post_unread) ? $user->lang['UNREAD_POST'] : $user->lang['POST'], + + + 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, + 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && count($attachments[$row['post_id']]) > 1, + 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED || $row['post_visibility'] == ITEM_REAPPROVE) ? true : false, + 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false, + 'L_POST_DELETED_MESSAGE' => $l_deleted_message, + 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false, + 'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'], + 'S_FRIEND' => ($row['friend']) ? true : false, + 'S_UNREAD_POST' => $post_unread, + 'S_FIRST_UNREAD' => $s_first_unread, + 'S_CUSTOM_FIELDS' => (isset($cp_row['row']) && count($cp_row['row'])) ? true : false, + 'S_TOPIC_POSTER' => ($topic_data['topic_poster'] == $poster_id) ? true : false, + 'S_FIRST_POST' => ($topic_data['topic_first_post_id'] == $row['post_id']) ? true : false, + + 'S_IGNORE_POST' => ($row['foe']) ? true : false, + 'L_IGNORE_POST' => ($row['foe']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username'])) : '', + 'S_POST_HIDDEN' => $row['hide_post'], + 'L_POST_DISPLAY' => ($row['hide_post']) ? $user->lang('POST_DISPLAY', '', '') : '', + 'S_DELETE_PERMANENT' => $permanent_delete_allowed, + ); + + $user_poster_data = $user_cache[$poster_id]; + + $current_row_number = $i; + + /** + * Modify the posts template block + * + * @event core.viewtopic_modify_post_row + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var int end Number of posts on this page + * @var int total_posts Total posts count + * @var int poster_id Post author id + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @var array attachments List of attachments + * @var array user_poster_data Poster's data from user cache + * @var array post_row Template block array of the post + * @var array topic_data Array with topic data + * @var array user_cache Array with cached user data + * @var array post_edit_list Array with post edited list + * @since 3.1.0-a1 + * @changed 3.1.0-a3 Added vars start, current_row_number, end, attachments + * @changed 3.1.0-b3 Added topic_data array, total_posts + * @changed 3.1.0-RC3 Added poster_id + * @changed 3.2.2-RC1 Added user_cache and post_edit_list + */ + $vars = array( + 'start', + 'current_row_number', + 'end', + 'total_posts', + 'poster_id', + 'row', + 'cp_row', + 'attachments', + 'user_poster_data', + 'post_row', + 'topic_data', + 'user_cache', + 'post_edit_list', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); + + $i = $current_row_number; + + if (isset($cp_row['row']) && count($cp_row['row'])) + { + $post_row = array_merge($post_row, $cp_row['row']); + } + + // Dump vars into template + $template->assign_block_vars('postrow', $post_row); + + $contact_fields = array( + array( + 'ID' => 'pm', + 'NAME' => $user->lang['SEND_PRIVATE_MESSAGE'], + 'U_CONTACT' => $post_row['U_PM'], + ), + array( + 'ID' => 'email', + 'NAME' => $user->lang['SEND_EMAIL'], + 'U_CONTACT' => $user_cache[$poster_id]['email'], + ), + array( + 'ID' => 'jabber', + 'NAME' => $user->lang['JABBER'], + 'U_CONTACT' => $user_cache[$poster_id]['jabber'], + ), + ); + + foreach ($contact_fields as $field) + { + if ($field['U_CONTACT']) + { + $template->assign_block_vars('postrow.contact', $field); + } + } + + if (!empty($cp_row['blockrow'])) + { + foreach ($cp_row['blockrow'] as $field_data) + { + $template->assign_block_vars('postrow.custom_fields', $field_data); + + if ($field_data['S_PROFILE_CONTACT']) + { + $template->assign_block_vars('postrow.contact', array( + 'ID' => $field_data['PROFILE_FIELD_IDENT'], + 'NAME' => $field_data['PROFILE_FIELD_NAME'], + 'U_CONTACT' => $field_data['PROFILE_FIELD_CONTACT'], + )); + } + } + } + + // Display not already displayed Attachments for this post, we already parsed them. ;) + if (!empty($attachments[$row['post_id']])) + { + foreach ($attachments[$row['post_id']] as $attachment) + { + $template->assign_block_vars('postrow.attachment', array( + 'DISPLAY_ATTACHMENT' => $attachment) + ); + } + } + + $current_row_number = $i; + + /** + * Event after the post data has been assigned to the template + * + * @event core.viewtopic_post_row_after + * @var int start Start item of this page + * @var int current_row_number Number of the post on this page + * @var int end Number of posts on this page + * @var int total_posts Total posts count + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @var array attachments List of attachments + * @var array user_poster_data Poster's data from user cache + * @var array post_row Template block array of the post + * @var array topic_data Array with topic data + * @since 3.1.0-a3 + * @changed 3.1.0-b3 Added topic_data array, total_posts + */ + $vars = array( + 'start', + 'current_row_number', + 'end', + 'total_posts', + 'row', + 'cp_row', + 'attachments', + 'user_poster_data', + 'post_row', + 'topic_data', + ); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_post_row_after', compact($vars))); + + $i = $current_row_number; + + $prev_post_id = $row['post_id']; + + unset($rowset[$post_list[$i]]); + unset($attachments[$row['post_id']]); +} +unset($rowset, $user_cache); + +// Update topic view and if necessary attachment view counters ... but only for humans and if this is the first 'page view' +if (isset($user->data['session_page']) && !$user->data['is_bot'] && (strpos($user->data['session_page'], '&t=' . $topic_id) === false || isset($user->data['session_created']))) +{ + $sql = 'UPDATE ' . TOPICS_TABLE . ' + SET topic_views = topic_views + 1, topic_last_view_time = ' . time() . " + WHERE topic_id = $topic_id"; + $db->sql_query($sql); + + // Update the attachment download counts + if (count($update_count)) + { + $sql = 'UPDATE ' . ATTACHMENTS_TABLE . ' + SET download_count = download_count + 1 + WHERE ' . $db->sql_in_set('attach_id', array_unique($update_count)); + $db->sql_query($sql); + } +} + +// Only mark topic if it's currently unread. Also make sure we do not set topic tracking back if earlier pages are viewed. +if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id] && $max_post_time > $topic_tracking_info[$topic_id]) +{ + markread('topic', $forum_id, $topic_id, $max_post_time); + + // Update forum info + $all_marked_read = update_forum_tracking_info($forum_id, $topic_data['forum_last_post_time'], (isset($topic_data['forum_mark_time'])) ? $topic_data['forum_mark_time'] : false, false); +} +else +{ + $all_marked_read = true; +} + +// If there are absolutely no more unread posts in this forum +// and unread posts shown, we can safely show the #unread link +if ($all_marked_read) +{ + if ($post_unread) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => '#unread', + )); + } + else if (isset($topic_tracking_info[$topic_id]) && $topic_data['topic_last_post_time'] > $topic_tracking_info[$topic_id]) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', + )); + } +} +else if (!$all_marked_read) +{ + $last_page = ((floor($start / $config['posts_per_page']) + 1) == max(ceil($total_posts / $config['posts_per_page']), 1)) ? true : false; + + // What can happen is that we are at the last displayed page. If so, we also display the #unread link based in $post_unread + if ($last_page && $post_unread) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => '#unread', + )); + } + else if (!$last_page) + { + $template->assign_vars(array( + 'U_VIEW_UNREAD_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&view=unread") . '#unread', + )); + } +} + +// let's set up quick_reply +$s_quick_reply = false; +if ($user->data['is_registered'] && $config['allow_quick_reply'] && ($topic_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) && $auth->acl_get('f_reply', $forum_id)) +{ + // Quick reply enabled forum + $s_quick_reply = (($topic_data['forum_status'] == ITEM_UNLOCKED && $topic_data['topic_status'] == ITEM_UNLOCKED) || $auth->acl_get('m_edit', $forum_id)) ? true : false; +} + +if ($s_can_vote || $s_quick_reply) +{ + add_form_key('posting'); + + if ($s_quick_reply) + { + $s_attach_sig = $config['allow_sig'] && $user->optionget('attachsig') && $auth->acl_get('f_sigs', $forum_id) && $auth->acl_get('u_sig'); + $s_smilies = $config['allow_smilies'] && $user->optionget('smilies') && $auth->acl_get('f_smilies', $forum_id); + $s_bbcode = $config['allow_bbcode'] && $user->optionget('bbcode') && $auth->acl_get('f_bbcode', $forum_id); + $s_notify = $config['allow_topic_notify'] && ($user->data['user_notify'] || $s_watching_topic['is_watching']); + + $qr_hidden_fields = array( + 'topic_cur_post_id' => (int) $topic_data['topic_last_post_id'], + 'topic_id' => (int) $topic_data['topic_id'], + 'forum_id' => (int) $forum_id, + ); + + // Originally we use checkboxes and check with isset(), so we only provide them if they would be checked + (!$s_bbcode) ? $qr_hidden_fields['disable_bbcode'] = 1 : true; + (!$s_smilies) ? $qr_hidden_fields['disable_smilies'] = 1 : true; + (!$config['allow_post_links']) ? $qr_hidden_fields['disable_magic_url'] = 1 : true; + ($s_attach_sig) ? $qr_hidden_fields['attach_sig'] = 1 : true; + ($s_notify) ? $qr_hidden_fields['notify'] = 1 : true; + ($topic_data['topic_status'] == ITEM_LOCKED) ? $qr_hidden_fields['lock_topic'] = 1 : true; + + $template->assign_vars(array( + 'S_QUICK_REPLY' => true, + 'U_QR_ACTION' => append_sid("{$phpbb_root_path}posting.$phpEx", "mode=reply&f=$forum_id&t=$topic_id"), + 'QR_HIDDEN_FIELDS' => build_hidden_fields($qr_hidden_fields), + 'SUBJECT' => 'Re: ' . censor_text($topic_data['topic_title']), + )); + } +} +// now I have the urge to wash my hands :( + + +// We overwrite $_REQUEST['f'] if there is no forum specified +// to be able to display the correct online list. +// One downside is that the user currently viewing this topic/post is not taken into account. +if (!$request->variable('f', 0)) +{ + $request->overwrite('f', $forum_id); +} + +// We need to do the same with the topic_id. See #53025. +if (!$request->variable('t', 0) && !empty($topic_id)) +{ + $request->overwrite('t', $topic_id); +} + +$page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], $pagination->get_on_page($config['posts_per_page'], $start)) : ''); + +/** +* You can use this event to modify the page title of the viewtopic page +* +* @event core.viewtopic_modify_page_title +* @var string page_title Title of the viewtopic page +* @var array topic_data Array with topic data +* @var int forum_id Forum ID of the topic +* @var int start Start offset used to calculate the page +* @var array post_list Array with post_ids we are going to display +* @since 3.1.0-a1 +* @changed 3.1.0-RC4 Added post_list var +*/ +$vars = array('page_title', 'topic_data', 'forum_id', 'start', 'post_list'); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars))); + +// Output the page +page_header($page_title, true, $forum_id); + +$template->set_filenames(array( + 'body' => ($view == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html') +); +make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"), $forum_id); + +page_footer(); diff --git a/language/fr/acp/attachments.php b/language/fr/acp/attachments.php index e39c5d6..fc9ba0c 100644 --- a/language/fr/acp/attachments.php +++ b/language/fr/acp/attachments.php @@ -67,7 +67,6 @@ $lang = array_merge($lang, [ 'ATTACH_QUOTA_EXPLAIN' => 'La taille maximale de l’espace de stockage qui sera alloué à la totalité des pièces jointes transférées sur le forum. Réglez cette valeur sur « 0 » si vous ne souhaitez pas limiter la taille de cet espace.', 'ATTACH_TO_POST' => 'Insérer au message', - 'CAT_FLASH_FILES' => 'Fichiers Flash', 'CAT_IMAGES' => 'Images', 'CHECK_CONTENT' => 'Vérifier les pièces jointes', 'CHECK_CONTENT_EXPLAIN' => 'Certains navigateurs internet peuvent faire erreur en attribuant un type MIME erroné aux fichiers transférés. Cette option permet de rejeter les fichiers qui présentent un risque de provoquer cette erreur.', @@ -98,7 +97,6 @@ $lang = array_merge($lang, [ 'EXT_GROUP_ARCHIVES' => 'Archives', 'EXT_GROUP_DOCUMENTS' => 'Documents', 'EXT_GROUP_DOWNLOADABLE_FILES' => 'Fichiers téléchargeables', - 'EXT_GROUP_FLASH_FILES' => 'Fichiers Flash', 'EXT_GROUP_IMAGES' => 'Images', 'EXT_GROUP_PLAIN_TEXT' => 'Texte brut', diff --git a/language/fr/acp/board.php b/language/fr/acp/board.php index ca1b3c1..d1d9ad5 100644 --- a/language/fr/acp/board.php +++ b/language/fr/acp/board.php @@ -37,34 +37,36 @@ if (empty($lang) || !is_array($lang)) // Board Settings $lang = array_merge($lang, [ - 'ACP_BOARD_SETTINGS_EXPLAIN' => 'Depuis cette page, vous pouvez effectuer les opérations basiques de votre forum, comme lui attribuer un nom et une description, régler son fuseau horaire ou encore définir sa langue par défaut.', - 'BOARD_INDEX_TEXT' => 'Texte de l’accueil du forum', - 'BOARD_INDEX_TEXT_EXPLAIN' => 'Ce texte sera affiché comme accueil du forum dans le chemin de navigation du forum. Si aucun texte n’est spécifié, « Accueil du forum » sera affiché par défaut.', - 'BOARD_STYLE' => 'Style du forum', - 'CUSTOM_DATEFORMAT' => 'Personnaliser…', - 'DEFAULT_DATE_FORMAT' => 'Format de la date', - 'DEFAULT_DATE_FORMAT_EXPLAIN' => 'Le format de la date est similaire au format utilisé par la fonction « date() » de PHP.', - 'DEFAULT_LANGUAGE' => 'Langue par défaut', - 'DEFAULT_STYLE' => 'Style par défaut', - 'DEFAULT_STYLE_EXPLAIN' => 'Le style par défaut affiché aux utilisateurs nouvellement inscrits.', - 'DISABLE_BOARD' => 'Désactiver le forum', - 'DISABLE_BOARD_EXPLAIN' => 'Le forum sera inaccessible aux utilisateurs qui ne sont ni administrateurs ni modérateurs. Si vous le souhaitez, vous pouvez également fournir une explication, limitée à 255 caractères au maximum, qui sera affichée aux utilisateurs.', - 'DISPLAY_LAST_SUBJECT' => 'Afficher le sujet du dernier message publié dans la liste des forums', - 'DISPLAY_LAST_SUBJECT_EXPLAIN' => 'Le sujet du dernier message qui a été publié dans un forum sera affiché dans la liste des forums sous la forme d’un lien redirigeant vers le dernier message. Les sujets publiés dans les forums protégés par un mot de passe ou en lecture seule ne sont pas affichés.', - 'GUEST_STYLE' => 'Style des invités', - 'GUEST_STYLE_EXPLAIN' => 'Le style affiché aux utilisateurs qui ne sont pas connectés à un compte.', - 'OVERRIDE_STYLE' => 'Remplacer le style des utilisateurs', - 'OVERRIDE_STYLE_EXPLAIN' => 'Le style des utilisateurs et des invités sera remplacé par celui qui a été sélectionné dans le menu « Style par défaut ».', - 'SITE_DESC' => 'Description du forum', - 'SITE_HOME_TEXT' => 'Texte du lien du site internet principal', - 'SITE_HOME_TEXT_EXPLAIN' => 'Ce texte, affiché sous forme de lien redirigeant vers votre site internet, sera inséré dans les liens de navigation de votre forum. Si aucun texte n’est spécifié dans ce champ, « Page d’accueil » sera alors affiché par défaut.', - 'SITE_HOME_URL' => 'Lien du site internet principal', - 'SITE_HOME_URL_EXPLAIN' => 'Si vous saisissez un lien, il sera inséré dans les liens de navigation de votre forum et remplacera par la destination souhaitée le lien présent sur le logo du forum qui redirige par défaut les utilisateurs sur l’accueil du forum. Veuillez saisir un lien absolu, tel que « https://www.phpbb.com ».', - 'SITE_NAME' => 'Nom du forum', - 'SYSTEM_TIMEZONE' => 'Fuseau horaire affiché aux invités', - 'SYSTEM_TIMEZONE_EXPLAIN' => 'Le fuseau horaire de ce menu ne concerne que les utilisateurs qui ne sont pas connectés à un compte, tels que les invités et les robots. Les utilisateurs connectés à un compte peuvent régler leur fuseau horaire lors de leur inscription ou depuis le panneau de contrôle de l’utilisateur.', - 'WARNINGS_EXPIRE' => 'Durée des avertissements', - 'WARNINGS_EXPIRE_EXPLAIN' => 'Le nombre de jours qui s’écouleront avant qu’un avertissement n’expire automatiquement. Réglez cette valeur sur « 0 » afin de ne pas faire expirer les avertissements dans le temps.', + 'ACP_BOARD_SETTINGS_EXPLAIN' => 'Depuis cette page, vous pouvez effectuer les opérations basiques de votre forum, comme lui attribuer un nom et une description, régler son fuseau horaire ou encore définir sa langue par défaut.', + 'BOARD_INDEX_TEXT' => 'Texte de l’accueil du forum', + 'BOARD_INDEX_TEXT_EXPLAIN' => 'Ce texte sera affiché comme accueil du forum dans le chemin de navigation du forum. Si aucun texte n’est spécifié, « Accueil du forum » sera affiché par défaut.', + 'BOARD_STYLE' => 'Style du forum', + 'CUSTOM_DATEFORMAT' => 'Personnaliser…', + 'DEFAULT_DATE_FORMAT' => 'Format de la date', + 'DEFAULT_DATE_FORMAT_EXPLAIN' => 'Le format de la date est similaire au format utilisé par la fonction « date() » de PHP.', + 'DEFAULT_LANGUAGE' => 'Langue par défaut', + 'DEFAULT_STYLE' => 'Style par défaut', + 'DEFAULT_STYLE_EXPLAIN' => 'Le style par défaut affiché aux utilisateurs nouvellement inscrits.', + 'DISABLE_BOARD' => 'Désactiver le forum', + 'DISABLE_BOARD_EXPLAIN' => 'Le forum sera inaccessible aux utilisateurs qui ne sont ni administrateurs ni modérateurs. Si vous le souhaitez, vous pouvez également fournir une explication, limitée à 255 caractères au maximum, qui sera affichée aux utilisateurs.', + 'DISPLAY_LAST_SUBJECT' => 'Afficher le sujet du dernier message publié dans la liste des forums', + 'DISPLAY_LAST_SUBJECT_EXPLAIN' => 'Le sujet du dernier message qui a été publié dans un forum sera affiché dans la liste des forums sous la forme d’un lien redirigeant vers le dernier message. Les sujets publiés dans les forums protégés par un mot de passe ou en lecture seule ne sont pas affichés.', + 'DISPLAY_UNAPPROVED_POSTS' => 'Afficher les messages non approuvés à l’auteur', + 'DISPLAY_UNAPPROVED_POSTS_EXPLAIN' => 'Les messages non approuvés peuvent être visibles par leur auteur. Cette option n’impacte pas les messages publiés par les invités.', + 'GUEST_STYLE' => 'Style des invités', + 'GUEST_STYLE_EXPLAIN' => 'Le style affiché aux utilisateurs qui ne sont pas connectés à un compte.', + 'OVERRIDE_STYLE' => 'Remplacer le style des utilisateurs', + 'OVERRIDE_STYLE_EXPLAIN' => 'Le style des utilisateurs et des invités sera remplacé par celui qui a été sélectionné dans le menu « Style par défaut ».', + 'SITE_DESC' => 'Description du forum', + 'SITE_HOME_TEXT' => 'Texte du lien du site internet principal', + 'SITE_HOME_TEXT_EXPLAIN' => 'Ce texte, affiché sous forme de lien redirigeant vers votre site internet, sera inséré dans les liens de navigation de votre forum. Si aucun texte n’est spécifié dans ce champ, « Page d’accueil » sera alors affiché par défaut.', + 'SITE_HOME_URL' => 'Lien du site internet principal', + 'SITE_HOME_URL_EXPLAIN' => 'Si vous saisissez un lien, il sera inséré dans les liens de navigation de votre forum et remplacera par la destination souhaitée le lien présent sur le logo du forum qui redirige par défaut les utilisateurs sur l’accueil du forum. Veuillez saisir un lien absolu, tel que « https://www.phpbb.com ».', + 'SITE_NAME' => 'Nom du forum', + 'SYSTEM_TIMEZONE' => 'Fuseau horaire affiché aux invités', + 'SYSTEM_TIMEZONE_EXPLAIN' => 'Le fuseau horaire de ce menu ne concerne que les utilisateurs qui ne sont pas connectés à un compte, tels que les invités et les robots. Les utilisateurs connectés à un compte peuvent régler leur fuseau horaire lors de leur inscription ou depuis le panneau de contrôle de l’utilisateur.', + 'WARNINGS_EXPIRE' => 'Durée des avertissements', + 'WARNINGS_EXPIRE_EXPLAIN' => 'Le nombre de jours qui s’écouleront avant qu’un avertissement n’expire automatiquement. Réglez cette valeur sur « 0 » afin de ne pas faire expirer les avertissements dans le temps.', ]); // Board Features @@ -110,9 +112,9 @@ $lang = array_merge($lang, [ 'ALLOW_GRAVATAR' => 'Autoriser les images de Gravatar', 'ALLOW_LOCAL' => 'Autoriser les images de la galerie d’avatars', 'ALLOW_REMOTE' => 'Autoriser les images distantes', - 'ALLOW_REMOTE_EXPLAIN' => 'Les avatars situés sur un site internet externe.
Attention : l’activation de cette fonctionnalité peut permettre aux utilisateurs de vérifier l’existence de fichiers et de services qui ne sont accessibles que sur le réseau local.', + 'ALLOW_REMOTE_EXPLAIN' => 'Les avatars situés sur un site internet externe.
Attention : l’activation de cette fonctionnalité peut permettre aux utilisateurs de vérifier l’existence de fichiers et de services qui ne sont accessibles que sur le réseau local.', 'ALLOW_REMOTE_UPLOAD' => 'Autoriser le transfert d’images distantes', - 'ALLOW_REMOTE_UPLOAD_EXPLAIN' => 'Les utilisateurs du forum pourront transférer sur votre serveur des images hébergées sur des sites internet externes et les utiliser comme avatars.
Attention : l’activation de cette fonctionnalité peut permettre aux utilisateurs de vérifier l’existence de fichiers et de services qui ne sont accessibles que sur le réseau local', + 'ALLOW_REMOTE_UPLOAD_EXPLAIN' => 'Les utilisateurs du forum pourront transférer sur votre serveur des images hébergées sur des sites internet externes et les utiliser comme avatars.
Attention : l’activation de cette fonctionnalité peut permettre aux utilisateurs de vérifier l’existence de fichiers et de services qui ne sont accessibles que sur le réseau local', 'ALLOW_UPLOAD' => 'Autoriser le transfert d’images locales', 'AVATAR_GALLERY_PATH' => 'Chemin vers la galerie d’avatars', 'AVATAR_GALLERY_PATH_EXPLAIN' => 'Le chemin relatif à la racine du répertoire de votre forum, tel que « images/avatars/gallery ».
Pour des raisons de sécurité, les deux points, tels que « ../ », seront retirés du chemin.', @@ -370,7 +372,7 @@ $lang = array_merge($lang, [ 'ACP_CONTACT_SETTINGS_EXPLAIN' => 'Depuis cette page, vous pouvez activer, modifier et désactiver la page de contact.', 'CONTACT_US_ENABLE' => 'Activer la page de contact', - 'CONTACT_US_ENABLE_EXPLAIN' => 'Cette page permet aux utilisateurs d’envoyer des courriels aux administrateurs du forum. Veuillez noter que le paramètre de l’envoi des courriels sur le forum doit être activé. Vous trouverez ce paramètre dans « Général > Communication > Paramètres des courriels ».', + 'CONTACT_US_ENABLE_EXPLAIN' => 'Cette page permet aux utilisateurs d’envoyer des courriels aux administrateurs du forum. Veuillez noter que le paramètre de l’envoi des courriels sur le forum doit être activé. Vous trouverez ce paramètre dans « Général > Communication > Paramètres des courriels ».', 'CONTACT_US_INFO' => 'Informations de la page de contact', 'CONTACT_US_INFO_EXPLAIN' => 'Le message est affiché sur la page de contact', @@ -436,7 +438,7 @@ $lang = array_merge($lang, [ 'AUTH_PROVIDER_OAUTH_TITLE' => 'OAuth', 'AUTH_PROVIDER_OAUTH_SECRET' => 'Secret', - 'APACHE_SETUP_BEFORE_USE' => 'Vous devez configurer l’authentification par Apache avant de pouvoir faire fonctionner phpBB sous cette méthode d’authentification. Le nom d’utilisateur que vous utilisez afin de vous authentifier par Apache doit être identique à votre nom d’utilisateur sur le forum. L’authentification par Apache ne peut être utilisé que si « mod_php » (qui ne doit pas être avec une version CGI) et « safe_mode » sont désactivés.', + 'APACHE_SETUP_BEFORE_USE' => 'Vous devez configurer l’authentification par Apache avant de pouvoir faire fonctionner phpBB sous cette méthode d’authentification. Le nom d’utilisateur que vous utilisez afin de vous authentifier par Apache doit être identique à votre nom d’utilisateur sur le forum. L’authentification par Apache ne doit être utilisé qu’avec « mod_php » (qui ne doit pas être avec une version CGI).', 'LDAP' => 'LDAP', 'LDAP_DN' => 'Base LDAP vers « dn »', @@ -564,9 +566,11 @@ $lang = array_merge($lang, [ 'CONTACT_EMAIL_NAME' => 'Nom du contact', 'CONTACT_EMAIL_NAME_EXPLAIN' => 'Le nom du contact qui s’affichera aux destinataires des courriels. Laissez ce champ vide si vous ne souhaitez pas afficher de nom de contact.', 'EMAIL_FORCE_SENDER' => 'Forcer l’adresse de courriel d’expédition', - 'EMAIL_FORCE_SENDER_EXPLAIN' => 'L’adresse de courriel d’expédition utilisera la fonction « Return-Path » au lieu d’utiliser l’utilisateur et le nom d’hôte local du serveur. Veuillez noter que ce paramètre est ignoré si vous utilisez le protocole SMTP.
Attention : vous devez vous assurer que le serveur soit ajouté en tant qu’utilisateur de confiance dans la configuration du service d’envoi de courriels.', + 'EMAIL_FORCE_SENDER_EXPLAIN' => 'L’adresse de courriel d’expédition utilisera la fonction « Return-Path » au lieu d’utiliser l’utilisateur et le nom d’hôte local du serveur. Veuillez noter que ce paramètre est ignoré si vous utilisez le protocole SMTP.
Attention : vous devez vous assurer que le serveur soit ajouté en tant qu’utilisateur de confiance dans la configuration du service d’envoi de courriels.', 'EMAIL_PACKAGE_SIZE' => 'Nombre de courriels envoyés en une seule fois', 'EMAIL_PACKAGE_SIZE_EXPLAIN' => 'Le nombre de courriels envoyés en une seule fois. Ce paramètre est appliqué à la file d’attente de la messagerie électronique interne. Si vous rencontrez des difficultés lors de l’envoi de courriels alors que cette option est activée, nous vous conseillons de régler cette valeur sur « 0 ».', + 'EMAIL_MAX_CHUNK_SIZE' => 'Nombre maximal de destinataires par courriel', + 'EMAIL_MAX_CHUNK_SIZE_EXPLAIN' => 'Si possible, prenez soin de ne pas dépasser le nombre maximal de destinataires par courriel que votre serveur de messagerie peut supporter.', 'EMAIL_SIG' => 'Signature des courriels', 'EMAIL_SIG_EXPLAIN' => 'Ce texte sera inséré en bas de tous les courriels envoyés à partir du forum.', 'ENABLE_EMAIL' => 'Envoi des courriels à partir du forum', @@ -586,8 +590,8 @@ $lang = array_merge($lang, [ 'SMTP_POP_BEFORE_SMTP' => 'POP-BEFORE-SMTP', 'SMTP_PORT' => 'Port du serveur SMTP', 'SMTP_PORT_EXPLAIN' => 'Ne modifiez ce dernier que si votre serveur SMTP utilise un port différent dont vous avez connaissance.', - 'SMTP_SERVER' => 'Adresse et protocole du serveur SMTP', - 'SMTP_SERVER_EXPLAIN' => 'Veuillez noter que vous devez renseigner le protocole utilisé par le serveur. Si vous utilisez SSL, cela ressemblera à « ssl://exemple.com ».', + 'SMTP_SERVER' => 'Adresse du serveur SMTP', + 'SMTP_SERVER_EXPLAIN' => 'Ne renseignez pas de protocole (« ssl:// » ou « tls:// ») mis à part si votre hébergeur de courriels vous indique de le faire.', 'SMTP_SETTINGS' => 'Paramètres du protocole SMTP', 'SMTP_USERNAME' => 'Nom d’utilisateur SMTP', 'SMTP_USERNAME_EXPLAIN' => 'Ne saisissez un nom d’utilisateur que si votre serveur SMTP le demande.', diff --git a/language/fr/acp/common.php b/language/fr/acp/common.php index 0b1d7ce..50cdcb6 100644 --- a/language/fr/acp/common.php +++ b/language/fr/acp/common.php @@ -172,10 +172,11 @@ $lang = array_merge($lang, [ 'ACP_SERVER_SETTINGS' => 'Paramètres du serveur', 'ACP_SIGNATURE_SETTINGS' => 'Paramètres des signatures', 'ACP_SMILIES' => 'Émoticônes', - 'ACP_STYLE_MANAGEMENT' => 'Gestion des styles', - 'ACP_STYLES' => 'Styles', - 'ACP_STYLES_CACHE' => 'Vider le cache', - 'ACP_STYLES_INSTALL' => 'Installer des styles', + + 'ACP_STYLE_MANAGEMENT' => 'Gestion des styles', + 'ACP_STYLES' => 'Styles', + 'ACP_STYLES_CACHE' => 'Vider le cache', + 'ACP_STYLES_INSTALL' => 'Installer des styles', 'ACP_SUBMIT_CHANGES' => 'Sauvegarder les modifications', @@ -225,20 +226,11 @@ $lang = array_merge($lang, [ 'BACK' => 'Retour', - 'CANNOT_CHANGE_FILE_GROUP' => 'Impossible de modifier le groupe du fichier', - 'CANNOT_CHANGE_FILE_PERMISSIONS' => 'Impossible de modifier les permissions du fichier', - 'CANNOT_COPY_FILES' => 'Impossible de copier les fichiers', - 'CANNOT_CREATE_SYMLINK' => 'Impossible de créer un lien symbolique', - 'CANNOT_DELETE_FILES' => 'Impossible de supprimer les fichiers du système', - 'CANNOT_DUMP_FILE' => 'Impossible de vider le fichier', - 'CANNOT_MIRROR_DIRECTORY' => 'Impossible de répliquer le répertoire', - 'CANNOT_RENAME_FILE' => 'Impossible de renommer un fichier du système', - 'CANNOT_TOUCH_FILES' => 'Impossible de déterminer si le fichier existe', - 'CONTAINER_EXCEPTION' => 'Une erreur est survenue lors de la construction du conteneur en raison d’une extension installée. Par mesure de sécurité, toutes les extensions ont été temporairement désactivées. Veuillez essayer de vider le cache de votre forum. Toutes les extensions seront automatiquement réactivées lorsque cette erreur de conteneur sera corrigée. Si cette erreur persiste, veuillez demander une assistance sur notre site internet (en anglais).', 'EXCEPTION' => 'Exception', - 'COLOUR_SWATCH' => 'Palette de couleurs internet', + 'COLOUR_SWATCH' => 'Palette de couleurs internet', + 'CONFIG_UPDATED' => 'La configuration a été mise à jour.', 'CRON_LOCK_ERROR' => 'Impossible d’obtenir le verrouillage de « cron ».', 'CRON_NO_SUCH_TASK' => 'La tâche cron « %s » est introuvable.', @@ -324,7 +316,7 @@ $lang = array_merge($lang, [ 'TOTAL_SIZE' => 'Taille totale', 'UCP' => 'Panneau de contrôle de l’utilisateur', - 'URL_INVALID' => 'L’adresse spécifiée concernant le paramètre « %1$s » est invalide.', + 'URL_INVALID' => 'L’adresse spécifiée concernant le paramètre « %1$s » est invalide.', 'USERNAMES_EXPLAIN' => 'Veuillez insérer chaque nom d’utilisateur sur une nouvelle ligne.', 'USER_CONTROL_PANEL' => 'Panneau de contrôle de l’utilisateur', @@ -552,7 +544,7 @@ $lang = array_merge($lang, [ 'LOG_BBCODE_ADD' => 'Ajout d’un nouveau BBCode
» %s', 'LOG_BBCODE_EDIT' => 'Modification d’un BBCode
» %s', 'LOG_BBCODE_DELETE' => 'Suppression d’un BBCode
» %s', - 'LOG_BBCODE_CONFIGURATION_ERROR' => 'Une erreur est survenue lors de la configuration du BBCode : %1$s
» %2$s', + 'LOG_BBCODE_CONFIGURATION_ERROR' => 'Une erreur est survenue lors de la configuration du BBCode : %1$s
» %2$s', 'LOG_BOT_ADDED' => 'Ajout d’un nouveau robot
» %s', 'LOG_BOT_DELETE' => 'Suppression d’un robot
» %s', @@ -706,7 +698,7 @@ $lang = array_merge($lang, [ 'LOG_U_ROLE_EDIT' => 'Modification d’un rôle d’utilisateur
» %s', 'LOG_U_ROLE_REMOVED' => 'Suppression d’un rôle d’utilisateur
» %s', - 'LOG_PLUPLOAD_TIDY_FAILED' => 'Le rangement a échoué car il n’a pas été possible d’ouvrir %1$s. Veuillez vérifier les permissions.
Exception : %2$s
Localisation : %3$s', + 'LOG_PLUPLOAD_TIDY_FAILED' => 'Le rangement a échoué car il est impossible d’ouvrir %1$s. Veuillez vérifier les permissions.
Exception : %2$s
Localisation : %3$s', 'LOG_PROFILE_FIELD_ACTIVATE' => 'Activation d’un champ de profil
» %s', 'LOG_PROFILE_FIELD_CREATE' => 'Ajout d’un champ de profil
» %s', diff --git a/language/fr/acp/database.php b/language/fr/acp/database.php index 3a208f6..3f7a37f 100644 --- a/language/fr/acp/database.php +++ b/language/fr/acp/database.php @@ -37,12 +37,12 @@ if (empty($lang) || !is_array($lang)) // Database Backup/Restore $lang = array_merge($lang, [ - 'ACP_BACKUP_EXPLAIN' => 'Depuis cette page, vous pouvez sauvegarder toutes les données relatives à votre forum. L’archive de sauvegarde sera stockée dans votre répertoire « store/ ». Selon la configuration de votre serveur, vous pourrez compresser cette archive sous plusieurs formats.', + 'ACP_BACKUP_EXPLAIN' => 'Depuis cette page, vous pouvez sauvegarder toutes les données relatives à votre forum. L’archive de sauvegarde sera stockée dans votre répertoire « store/ ». Selon la configuration de votre serveur, vous pourrez compresser cette archive sous plusieurs formats.', 'ACP_RESTORE_EXPLAIN' => 'Cette opération effectuera une restauration complète de toutes les tables de phpBB à partir d’un fichier de sauvegarde. Si votre serveur est compatible avec cette fonctionnalité, vous pouvez utiliser un fichier texte compressé sous le format GZip ou BZip2 qui sera automatiquement décompressé. Veuillez noter que cette opération remplacera toutes les données existantes. La restauration est un processus qui peut durer un certain temps, veillez à ne pas vous déplacer sur une autre page tant que l’opération n’est pas terminée. Les sauvegardes sont stockées dans le répertoire « store/ » et sont supposées être générées par l’outil de restauration présent par défaut dans le logiciel phpBB. Il est possible que la restauration des bases de données qui n’ont pas été sauvegardées avec cet outil ne fonctionnent pas.', 'BACKUP_DELETE' => 'Le fichier de sauvegarde a été supprimé.', 'BACKUP_INVALID' => 'Le fichier de sauvegarde que vous avez sélectionné est invalide.', - 'BACKUP_NOT_SUPPORTED' => 'Le fichier de sauvegarde que vous avez sélectionné n’est pas supporté.', + 'BACKUP_NOT_SUPPORTED' => 'Le fichier de sauvegarde que vous avez sélectionné n’est pas pris en charge.', 'BACKUP_OPTIONS' => 'Options de sauvegarde', 'BACKUP_SUCCESS' => 'Le fichier de sauvegarde a été créé.', 'BACKUP_TYPE' => 'Type de sauvegarde', diff --git a/language/fr/acp/extensions.php b/language/fr/acp/extensions.php index ac86307..d65a635 100644 --- a/language/fr/acp/extensions.php +++ b/language/fr/acp/extensions.php @@ -44,7 +44,7 @@ $lang = array_merge($lang, [ 'EXTENSION_NOT_AVAILABLE' => 'Cette extension n’est pas disponible sur ce forum. Veuillez vérifier la compatibilité de vos versions de phpBB et de PHP.', 'EXTENSION_DIR_INVALID' => 'Cette extension est construite avec une structure de répertoire invalide et ne peut donc pas être activée.', 'EXTENSION_NOT_ENABLEABLE' => 'Cette extension ne peut pas être activée. Veuillez vérifier les prérequis de l’extension.', - 'EXTENSION_NOT_INSTALLED' => 'L’extension « %s » n’est pas disponible. Veuillez vérifier si elle a été correctement installée.', + 'EXTENSION_NOT_INSTALLED' => 'L’extension « %s » n’est pas disponible. Veuillez vérifier si elle a été correctement installée.', 'DETAILS' => 'Informations', diff --git a/language/fr/acp/forums.php b/language/fr/acp/forums.php index 741355d..bf40e6d 100644 --- a/language/fr/acp/forums.php +++ b/language/fr/acp/forums.php @@ -76,7 +76,7 @@ $lang = array_merge($lang, [ 'ENABLE_TOPIC_ICONS' => 'Activer les icônes de sujet', 'FORUM_ADMIN' => 'Administration du forum', - 'FORUM_ADMIN_EXPLAIN' => 'Dans phpBB 3.2, tout est basé sur la notion de forum. Ainsi, même les catégories ne sont plus qu’un type de forum. Chaque forum peut contenir un nombre illimité de sous-forums et vous pouvez spécifier s’ils peuvent contenir ou non des messages (comme c’était le cas avec les anciennes catégories). Depuis cette page, vous pouvez, de manière individuelle, ajouter, modifier, supprimer, verrouiller ou déverrouiller les forums et définir certaines permissions additionnelles. Si certains messages et sujets ne sont plus synchronisés, vous pouvez également exécuter une resynchronisation. Si vous souhaitez que les forums que vous créez soient visibles publiquement, n’oubliez pas de copier ou de définir les permissions de chaque nouveau forum.', + 'FORUM_ADMIN_EXPLAIN' => 'Dans phpBB 3.3, tout est basé sur la notion de forum. Ainsi, même les catégories ne sont plus qu’un type de forum. Chaque forum peut contenir un nombre illimité de sous-forums et vous pouvez spécifier s’ils peuvent contenir ou non des messages (comme c’était le cas avec les anciennes catégories). Depuis cette page, vous pouvez, de manière individuelle, ajouter, modifier, supprimer, verrouiller ou déverrouiller les forums et définir certaines permissions additionnelles. Si certains messages et sujets ne sont plus synchronisés, vous pouvez également exécuter une resynchronisation. Si vous souhaitez que les forums que vous créez soient visibles publiquement, n’oubliez pas de copier ou de définir les permissions de chaque nouveau forum.', 'FORUM_AUTO_PRUNE' => 'Activer le délestage automatique', 'FORUM_AUTO_PRUNE_EXPLAIN' => 'Si cette option est activée, les sujets de ce forum seront délestés selon les paramètres de fréquence et d’intervalles du délestage automatique spécifiés ci-dessous.', 'FORUM_CREATED' => 'Le forum a été créé.', @@ -96,6 +96,7 @@ $lang = array_merge($lang, [ 'FORUM_LINK_TRACK_EXPLAIN' => 'Le nombre de redirections effectués à partir du forum-lien seront comptabilisées et affichées.', 'FORUM_NAME' => 'Nom du forum', 'FORUM_NAME_EMPTY' => 'Vous devez saisir le nom de ce forum.', + 'FORUM_NAME_EMOJI' => 'Le nom du forum que vous saisi est invalide.
Il contient les caractères suivants qui ne sont pas pris en charge :
%s', 'FORUM_PARENT' => 'Forum parent', 'FORUM_PASSWORD' => 'Mot de passe du forum', 'FORUM_PASSWORD_CONFIRM' => 'Confirmer le mot de passe du forum', @@ -126,12 +127,14 @@ $lang = array_merge($lang, [ 'GENERAL_FORUM_SETTINGS' => 'Paramètres généraux du forum', - 'LINK' => 'Lien', - 'LIST_INDEX' => 'Lister ce forum dans la légende du forum parent', - 'LIST_INDEX_EXPLAIN' => 'Si cette option est activée, ce forum sera listé sur l’index du forum et sur divers endroits dans un lien disponible dans la légende du forum parent.', - 'LIST_SUBFORUMS' => 'Lister les sous-forums dans la légende de ce forum', - 'LIST_SUBFORUMS_EXPLAIN' => 'Si cette option est activée, les sous-forums de ce forum seront listés sur l’index du forum et sur divers endroits dans un lien disponible dans la légende de ce forum.', - 'LOCKED' => 'Verrouillé', + 'LINK' => 'Lien', + 'LIMIT_SUBFORUMS' => 'Limiter la légende aux sous-forums enfants directs', + 'LIMIT_SUBFORUMS_EXPLAIN' => 'Limite l’affichage des sous-forums aux sous-forums qui descendent directement du forum actuel. Si cette option est désactivée, les sous-forums seront affichés en prenant en compte l’option « Lister ce sous-forum dans la légende du forum parent », peu importe la profondeur.', + 'LIST_INDEX' => 'Lister ce sous-forum dans la légende du forum parent', + 'LIST_INDEX_EXPLAIN' => 'Si cette option est activée, ce sous-forum sera listé sur l’index du forum et sur divers endroits dans un lien disponible dans la légende du forum parent.', + 'LIST_SUBFORUMS' => 'Lister les sous-forums dans la légende de ce forum', + 'LIST_SUBFORUMS_EXPLAIN' => 'Si cette option est activée, les sous-forums de ce forum seront listés sur l’index du forum et sur divers endroits dans un lien disponible dans la légende de ce forum.', + 'LOCKED' => 'Verrouillé', 'MOVE_POSTS_NO_POSTABLE_FORUM' => 'Ce forum ne peut pas recevoir le contenu que vous souhaitez déplacer. Veuillez sélectionner un forum dans lequel il est possible de publier des messages.', 'MOVE_POSTS_TO' => 'Déplacer les messages dans', diff --git a/language/fr/acp/groups.php b/language/fr/acp/groups.php index de21364..9c1e4b7 100644 --- a/language/fr/acp/groups.php +++ b/language/fr/acp/groups.php @@ -110,7 +110,7 @@ $lang = array_merge($lang, [ 'GROUP_USERS_ADDED' => 'Les nouveaux utilisateurs ont été ajoutés au groupe d’utilisateurs.', 'GROUP_USERS_EXIST' => 'Les utilisateurs sont déjà membres de ce groupe d’utilisateurs.', 'GROUP_USERS_REMOVE' => 'Les utilisateurs ont été supprimés de ce groupe d’utilisateurs. Ils ont été transférés dans le groupe d’utilisateurs par défaut.', - 'GROUP_USERS_INVALID' => 'Aucun utilisateur n’a été ajouté au groupe d’utilisateurs étant donné que les noms d’utilisateurs suivants n’existent pas : %s', + 'GROUP_USERS_INVALID' => 'Aucun utilisateur n’a été ajouté au groupe d’utilisateurs étant donné que les noms d’utilisateurs suivants n’existent pas : %s', 'LEGEND_EXPLAIN' => 'Cette liste correspond aux groupes d’utilisateurs qui sont affichés dans la légende des groupes :', 'LEGEND_SETTINGS' => 'Paramètres de la légende', diff --git a/language/fr/acp/permissions.php b/language/fr/acp/permissions.php index 7ba9103..d6cd71a 100644 --- a/language/fr/acp/permissions.php +++ b/language/fr/acp/permissions.php @@ -53,7 +53,7 @@ $lang = array_merge($lang, [
-

Pour plus d’informations concernant la configuration des permissions sur votre forum, veuillez consulter la section sur la configuration des permissions de notre guide de démarrage rapide (en anglais).

+

Pour plus d’informations concernant la configuration des permissions sur votre forum, veuillez consulter la section sur la configuration des permissions de notre guide de démarrage rapide (en anglais).

', 'ACL_NEVER' => 'Jamais', diff --git a/language/fr/acp/permissions_phpbb.php b/language/fr/acp/permissions_phpbb.php index 31b91f5..df010e8 100644 --- a/language/fr/acp/permissions_phpbb.php +++ b/language/fr/acp/permissions_phpbb.php @@ -76,6 +76,7 @@ $lang = array_merge($lang, [ 'ACL_U_SAVEDRAFTS' => 'Peut enregistrer des messages comme brouillons', 'ACL_U_CHGCENSORS' => 'Peut désactiver la censure de mots', 'ACL_U_SIG' => 'Peut insérer une signature', + 'ACL_U_EMOJI' => 'Peut utiliser des émojis et des caractères spéciaux dans le titre des sujets', 'ACL_U_SENDPM' => 'Peut envoyer des messages privés', 'ACL_U_MASSPM' => 'Peut envoyer des messages privés à plusieurs utilisateurs', diff --git a/language/fr/acp/posting.php b/language/fr/acp/posting.php index 4a8044a..ee851b5 100644 --- a/language/fr/acp/posting.php +++ b/language/fr/acp/posting.php @@ -41,7 +41,7 @@ $lang = array_merge($lang, [ 'ACP_BBCODES_EXPLAIN' => 'Le BBCode est une implémentation spéciale du code HTML qui offre un meilleur contrôle sur la mise en forme. De cette page, vous pouvez ajouter, supprimer et modifier des BBCodes personnalisés.', 'ADD_BBCODE' => 'Ajouter un nouveau BBCode', - 'BBCODE_DANGER' => 'Le BBCode que vous essayez d’ajouter semble utiliser une chaîne de symboles « {TEXT} » dans un attribut HTML. Cela peut présenter une éventuelle faille de sécurité XSS. Veuillez plutôt essayer d’utiliser un type plus restrictif, tel que « {SIMPLETEXT} » ou « {INTTEXT} ». Ne procédez à cette opération que si vous comprenez les risque encourus et que vous considérez que l’utilisation de « {TEXT} » est absolumement inévitable.', + 'BBCODE_DANGER' => 'Le BBCode que vous essayez d’ajouter semble représenter une vulnérabilité. Si le BBCode utilise une chaîne de symboles « {TEXT} » dans un contexte sensible, privilégiez plutôt l’utilisation d’un type plus restrictif. Ne procédez à cette opération que si vous comprenez parfaitement les risques encourus.', 'BBCODE_DANGER_PROCEED' => 'Procéder', //'I understand the risk', 'BBCODE_ADDED' => 'Le BBCode a été ajouté.', @@ -55,7 +55,7 @@ $lang = array_merge($lang, [ 'BBCODE_INVALID_TAG_NAME' => 'Le nom de la balise BBCode que vous avez spécifié existe déjà.', 'BBCODE_INVALID' => 'Votre BBCode est construit dans une architecture invalide.', - 'BBCODE_OPEN_ENDED_TAG' => 'Votre BBCode personnalisé doit contenir une balise d’ouverture et de fermeture.', + 'BBCODE_INVALID_TEMPLATE' => 'Votre modèle de BBCode est invalide.', 'BBCODE_TAG' => 'Balise', 'BBCODE_TAG_TOO_LONG' => 'Le nom de la balise que vous avez spécifié est trop long.', 'BBCODE_TAG_DEF_TOO_LONG' => 'La définition de la balise que vous avez spécifiée est trop longue, veuillez la raccourcir.', @@ -77,13 +77,13 @@ $lang = array_merge($lang, [ 'TOO_MANY_BBCODES' => 'Vous ne pouvez pas créer d’autres BBCodes. Veuillez supprimer un ou plusieurs BBCodes et réessayer.', 'tokens' => [ - 'TEXT' => 'Du texte, comprenant les caractères étrangers, les chiffres, etc. Vous ne devriez pas utiliser cette chaîne de symboles dans les balises HTML. Essayez d’utiliser à la place « IDENTIFIER », « INTTEXT » ou « SIMPLETEXT ».', + 'TEXT' => 'Du texte, comprenant les caractères étrangers, les chiffres, etc.', 'SIMPLETEXT' => 'Des caractères de l’alphabet latin (A–Z), des chiffres, des espaces, des virgules, des points, des tirets, des tirets bas et des signes plus et moins.', 'INTTEXT' => 'Des lettres de caractères Unicode, des chiffres, des espaces, des virgules, des points, des tirets bas et des espaces insécables et des signes plus et moins.', 'IDENTIFIER' => 'Des caractères de l’alphabet latin (A–Z), des chiffres, des tirets et des tirets bas.', 'NUMBER' => 'Une série de chiffres.', 'EMAIL' => 'Une adresse de courriel correcte.', - 'URL' => 'Une adresse universelle correcte utilisant n’importe quel protocole (HTTP, FTP, etc.) ne pouvant pas être utilisée pour des injections de Javascript. Si aucun protocole n’est renseigné, « http:// » sera utilisé par défaut.', + 'URL' => 'Une adresse universelle correcte utilisant n’importe quel protocole autorisé (HTTP, FTP, etc.) ne pouvant pas être utilisée pour des injections de Javascript. Si aucun protocole n’est renseigné, « http:// » sera utilisé par défaut.', 'LOCAL_URL' => 'Une adresse universelle locale. L’adresse doit être relative à la page du sujet et ne doit pas contenir de nom de serveur ou de protocole, tels que des liens qui sont précédés de « %s »', 'RELATIVE_URL' => 'Une adresse universelle relative. Vous pouvez utiliser des résultats partiels d’une adresse universelle, mais soyez vigilant, car une adresse universelle complète est une adresse universelle relative valide. Lorsque vous souhaitez utiliser les adresses universelles relatives de votre forum, utilisez la variable « LOCAL_URL ».', 'COLOR' => 'Une couleur HTML qui peut être dans une forme hexadécimale « #FF1234 » ou un nom de couleur CSS (en anglais), tel que « black » ou « fuchsia ».', diff --git a/language/fr/acp/profile.php b/language/fr/acp/profile.php index 7a836f6..4869f70 100644 --- a/language/fr/acp/profile.php +++ b/language/fr/acp/profile.php @@ -110,7 +110,7 @@ $lang = array_merge($lang, [ 'FIRST_OPTION' => 'Première option', 'HIDE_PROFILE_FIELD' => 'Masquer le champ de profil', - 'HIDE_PROFILE_FIELD_EXPLAIN' => 'Le champ de profil sera invisible à tous les utilisateurs, seuls les administrateurs et les modérateurs pourront toujours le voir. Si l’affichage est désactivé dans le panneau de contrôle de l’utilisateur, l’utilisateur ne pourra pas voir ou modifier ce champ et ce dernier ne pourra être modifié que par un administrateur.', + 'HIDE_PROFILE_FIELD_EXPLAIN' => 'Le champ de profil sera invisible à tous les utilisateurs. Seuls les administrateurs et les modérateurs seront toujours capables de voir ce champ. Si l’affichage est désactivé dans le panneau de contrôle de l’utilisateur, l’utilisateur ne pourra pas voir ou modifier ce champ et ce dernier ne pourra être modifié que par un administrateur.', 'INVALID_CHARS_FIELD_IDENT' => 'L’identification du champ ne peut contenir que des lettres minuscules situées entre A et E et des tirets bas', 'INVALID_FIELD_IDENT_LEN' => 'L’identification du champ est limitée à 17 caractères', diff --git a/language/fr/acp/styles.php b/language/fr/acp/styles.php index b36ef7a..c9ae208 100644 --- a/language/fr/acp/styles.php +++ b/language/fr/acp/styles.php @@ -36,7 +36,7 @@ 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 $lang = array_merge($lang, [ - 'ACP_STYLES_EXPLAIN' => 'Depuis cette page, vous pouvez gérer les styles disponibles sur votre forum. Vous pouvez installer de nouveaux styles et modifier, supprimer, désactiver et réactiver les styles déjà installés. Vous pouvez également voir à quoi ressemble un style en utilisant la fonctionnalité de prévisualisation. De même, vous pouvez consulter le compteur du nombre total d’utilisateurs de chaque style. Veuillez cependant noter que lorsque vous remplacez un style, la comptabilisation du nombre total d’utilisateurs ne sera pas répercutée sur le style qui le remplacera.', + 'ACP_STYLES_EXPLAIN' => 'Depuis cette page, vous pouvez gérer les styles disponibles sur votre forum.
Veuillez noter que vous ne pouvez pas désinstaller le style « prosilver » qui est le style par défaut de phpBB.', 'CANNOT_BE_INSTALLED' => 'Ne peut pas être installé', 'CONFIRM_UNINSTALL_STYLES' => 'Êtes-vous sûr de vouloir désinstaller ces styles ?', @@ -55,7 +55,7 @@ $lang = array_merge($lang, [ 'INVALID_STYLE_ID' => 'L’identifiant du style est invalide.', 'NO_MATCHING_STYLES_FOUND' => 'Aucun style ne correspond à votre requête.', - 'NO_UNINSTALLED_STYLE' => 'Aucun style n’a été désinstallé.', + 'NO_UNINSTALLED_STYLE' => 'Aucun style n’est en attente d’installation.', 'PURGED_CACHE' => 'Le cache a été vidé.', @@ -83,7 +83,8 @@ $lang = array_merge($lang, [ 'STYLE_USED_BY' => 'Utilisé par (incluant les robots)', 'STYLE_VERSION' => 'Version du style', - 'UNINSTALL_DEFAULT' => 'Vous ne pouvez pas désinstaller le style par défaut.', + 'UNINSTALL_PROSILVER' => 'Vous ne pouvez pas désinstaller le style « prosilver ».', + 'UNINSTALL_DEFAULT' => 'Vous ne pouvez pas désinstaller le style par défaut.', 'BROWSE_STYLES_DATABASE' => 'Parcourir la base de données des styles', ]); diff --git a/language/fr/captcha_recaptcha.php b/language/fr/captcha_recaptcha.php index befb452..b7f942c 100644 --- a/language/fr/captcha_recaptcha.php +++ b/language/fr/captcha_recaptcha.php @@ -42,10 +42,10 @@ $lang = array_merge($lang, [ 'RECAPTCHA_INCORRECT' => 'La vérification a échoué', 'RECAPTCHA_NOSCRIPT' => 'Vous devez activer JavaScript dans votre navigateur afin de charger le formulaire.', - 'RECAPTCHA_PUBLIC' => 'Clé publique de reCAPTCHA', - 'RECAPTCHA_PUBLIC_EXPLAIN' => 'Votre clé publique de reCAPTCHA. Les clés sont disponibles sur le site de reCAPTCHA (en anglais).', - 'RECAPTCHA_PRIVATE' => 'Clé privée de reCAPTCHA', - 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Votre clé privée de reCAPTCHA. Les clés sont disponibles sur le site de reCAPTCHA (en anglais).', + 'RECAPTCHA_PUBLIC' => 'Clé du site', + 'RECAPTCHA_PUBLIC_EXPLAIN' => 'Votre clé de site sur reCAPTCHA. Les clés sont disponibles sur le site de reCAPTCHA (en anglais). Veuillez utiliser le type de badge « Invisible reCAPTCHA » de reCAPTCHA v2.', + 'RECAPTCHA_PRIVATE' => 'Clé secrète', + 'RECAPTCHA_PRIVATE_EXPLAIN' => 'Votre clé secrète sur reCAPTCHA. Les clés sont disponibles sur le site de reCAPTCHA (en anglais). Veuillez utiliser le type de badge « Invisible reCAPTCHA » de reCAPTCHA v2.', - 'RECAPTCHA_EXPLAIN' => 'Veuillez compléter la vérification suivante afin de nous permettre de nous prémunir contre les soumissions automatisées et intensives effectuées par des robots malveillants.', + 'RECAPTCHA_INVISIBLE' => 'Ce CAPTCHA est actuellement invisible. Pour vérifier qu’il fonctionne correctement, une petite icône devrait apparaître dans le coin en bas à droite de cette page.', ]); diff --git a/language/fr/cli.php b/language/fr/cli.php index 234d4c3..ab86bbd 100644 --- a/language/fr/cli.php +++ b/language/fr/cli.php @@ -79,8 +79,6 @@ $lang = array_merge($lang, [ 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RANGE_SIZE' => 'Nombre approximatif d’enregistrements à traiter à la fois', 'CLI_DESCRIPTION_REPARSER_REPARSE_OPT_RESUME' => 'Démarrer la réanalyse syntaxique où la dernière exécution s’est arrêtée', - 'CLI_DESCRIPTION_RECALCULATE_EMAIL_HASH' => 'Recalcule la colonne « user_email_hash » de la table des utilisateurs.', - 'CLI_DESCRIPTION_SET_ATOMIC_CONFIG' => 'Configure une valeur de l’option de configuration uniquement lorsque l’ancienne valeur est identique à la valeur actuelle', 'CLI_DESCRIPTION_SET_CONFIG' => 'Configure une valeur de l’option de configuration', @@ -118,20 +116,19 @@ $lang = array_merge($lang, [ 'CLI_EXTENSION_ENABLE_FAILURE' => 'Impossible d’activer l’extension « %s »', 'CLI_EXTENSION_ENABLE_SUCCESS' => 'L’extension « %s » a été activée', 'CLI_EXTENSION_ENABLED' => 'L’extension « %s » est déjà activée', - 'CLI_EXTENSION_NOT_EXIST' => 'L’extension « %s » n’existe pas', + 'CLI_EXTENSION_NOT_EXIST' => 'L’extension « %s » n’existe pas', 'CLI_EXTENSION_NAME' => 'Nom de l’extension', 'CLI_EXTENSION_PURGE_FAILURE' => 'Impossible de purger l’extension « %s »', 'CLI_EXTENSION_PURGE_SUCCESS' => 'L’extension « %s » a été purgée', 'CLI_EXTENSION_UPDATE_FAILURE' => 'Impossible de mettre à jour l’extension « %s »', 'CLI_EXTENSION_UPDATE_SUCCESS' => 'L’extension « %s » a été mise à jour', 'CLI_EXTENSION_NOT_FOUND' => 'Aucune extension.', - 'CLI_EXTENSION_NOT_ENABLEABLE' => 'L’extension « %s » n’est pas activable.', + 'CLI_EXTENSION_NOT_ENABLEABLE' => 'L’extension « %s » n’est pas activable.', 'CLI_EXTENSIONS_AVAILABLE' => 'Disponible', 'CLI_EXTENSIONS_DISABLED' => 'Désactivée', 'CLI_EXTENSIONS_ENABLED' => 'Activée', 'CLI_FIXUP_FIX_LEFT_RIGHT_IDS_SUCCESS' => 'L’arborescence des forums et des modules a été réparée.', - 'CLI_FIXUP_RECALCULATE_EMAIL_HASH_SUCCESS' => 'Tous les hachages des courriels ont été recalculés.', 'CLI_FIXUP_UPDATE_HASH_BCRYPT_SUCCESS' => 'Les hachages des mots de passe obsolètes ont été encodés avec « bcrypt ».', 'CLI_MIGRATION_NAME' => 'Le nom de la migration, espaces de noms inclus (veuillez utiliser des barres obliques à la place de barres obliques inversées).', diff --git a/language/fr/common.php b/language/fr/common.php index 3dfff7e..fd5d207 100644 --- a/language/fr/common.php +++ b/language/fr/common.php @@ -86,8 +86,10 @@ $lang = array_merge($lang, [ 'ATTACHED_IMAGE_NOT_IMAGE' => 'L’image que vous avez souhaité transférer est invalide.', 'AUTHOR' => 'Auteur', 'AUTH_NO_PROFILE_CREATED' => 'Une erreur est survenue lors de la création du profil de l’utilisateur.', + 'AUTH_PROVIDER_OAUTH_ERROR_ALREADY_LINKED' => 'Ce service externe est déjà associé à un autre compte de ce forum.', 'AUTH_PROVIDER_OAUTH_ERROR_INVALID_ENTRY' => 'L’entrée de la base de données est invalide.', 'AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE' => 'Le type de service spécifié dans le gestionnaire de service OAuth est invalide.', + 'AUTH_PROVIDER_OAUTH_ERROR_REQUEST' => 'Une erreur est survenue lors du traitement de votre requête OAuth.', 'AUTH_PROVIDER_OAUTH_ERROR_SERVICE_NOT_CREATED' => 'Le service OAuth n’a pas été créé', 'AUTH_PROVIDER_OAUTH_SERVICE_BITLY' => 'Bitly', 'AUTH_PROVIDER_OAUTH_SERVICE_FACEBOOK' => 'Facebook', @@ -261,6 +263,17 @@ $lang = array_merge($lang, [ 'FSOCK_DISABLED' => 'L’opération a échoué car la fonction « fsockopen » est désactivée ou le serveur interrogé est introuvable.', 'FSOCK_TIMEOUT' => 'Le délai de réponse a expiré lors de la lecture du flux réseau.', + 'FILESYSTEM_CANNOT_CHANGE_FILE_GROUP' => 'Impossible de modifier le groupe du fichier', + 'FILESYSTEM_CANNOT_CHANGE_FILE_PERMISSIONS' => 'Impossible de modifier les permissions du fichier', + 'FILESYSTEM_CANNOT_COPY_FILES' => 'Impossible de copier les fichiers', + 'FILESYSTEM_CANNOT_CREATE_SYMLINK' => 'Impossible de créer un lien symbolique', + 'FILESYSTEM_CANNOT_CREATE_DIRECTORY' => 'Impossible de créer le répertoire', + 'FILESYSTEM_CANNOT_DELETE_FILES' => 'Impossible de supprimer les fichiers du système', + 'FILESYSTEM_CANNOT_DUMP_FILE' => 'Impossible de vider le contenu du fichier', + 'FILESYSTEM_CANNOT_MIRROR_DIRECTORY' => 'Impossible de répliquer le répertoire', + 'FILESYSTEM_CANNOT_RENAME_FILE' => 'Impossible de renommer un fichier du système', + 'FILESYSTEM_CANNOT_TOUCH_FILES' => 'Impossible de créer ou de modifier les horodatages des fichiers', + 'FTP_FSOCK_HOST' => 'Hôte FTP', 'FTP_FSOCK_HOST_EXPLAIN' => 'Le serveur FTP qui est utilisé afin de vous connecter à votre site.', 'FTP_FSOCK_PASSWORD' => 'Mot de passe FTP', @@ -366,7 +379,7 @@ $lang = array_merge($lang, [ 'LDAP_SEARCH_FAILED' => 'Le répertoire LDAP est introuvable.', 'LEGEND' => 'Légende', 'LIVE_SEARCHES_NOT_ALLOWED' => 'Les prédictions de recherche ne sont pas autorisées.', - 'LOADING' => 'Chargement', + 'LOADING' => 'Chargement…', 'LOCATION' => 'Localisation', 'LOCK_POST' => 'Verrouiller le message', 'LOCK_POST_EXPLAIN' => 'Il ne pourra plus être modifié', @@ -375,11 +388,11 @@ $lang = array_merge($lang, [ 'LOGIN_CHECK_PM' => 'Connectez-vous afin de consulter vos messages privés.', 'LOGIN_CONFIRMATION' => 'Confirmation de connexion', 'LOGIN_CONFIRM_EXPLAIN' => 'Pour des raisons de sécurité, vous devez saisir un code de confirmation après avoir échoué plusieurs fois lors de vos tentatives de connexion. Le code est affiché dans l’image affichée ci-dessous. Si vous éprouvez des difficultés à lire ce code correctement, veuillez contacter un %sadministrateur du forum%s.', // Unused - 'LOGIN_ERROR_ATTEMPTS' => 'Vous avez dépassé le nombre maximal de tentatives de connexion autorisées. En plus de votre nom d’utilisateur et de votre mot de passe, vous devez à présent résoudre le CAPTCHA affiché ci-dessous.', + 'LOGIN_ERROR_ATTEMPTS' => 'Vous avez dépassé le nombre maximal de tentatives de connexion autorisées. En plus de renseigner votre nom d’utilisateur et de votre mot de passe, vous devez également passer le test CAPTCHA.', 'LOGIN_ERROR_EXTERNAL_AUTH_APACHE' => 'Une erreur est survenue lors de votre authentification par Apache.', 'LOGIN_ERROR_OAUTH_SERVICE_DOES_NOT_EXIST' => 'Le service OAuth est introuvable.', 'LOGIN_ERROR_PASSWORD' => 'Le mot de passe que vous avez spécifié est incorrect. Veuillez vérifier votre mot de passe et réessayer. Si ce problème persiste, veuillez contacter un %sadministrateur du forum%s.', - 'LOGIN_ERROR_PASSWORD_CONVERT' => 'Il n’a pas été possible de convertir votre mot de passe lors de la mise à jour du logiciel de ce forum de discussions. Veuillez %sdemander un nouveau mot de passe%s. Si ce problème persiste, veuillez contacter un %sadministrateur du forum%s.', + 'LOGIN_ERROR_PASSWORD_CONVERT' => 'La conversion de votre mot de passe a échoué lors de la mise à jour du logiciel de ce forum de discussions. Veuillez %sdemander un nouveau mot de passe%s. Si ce problème persiste, veuillez %scontacter un administrateur du forum%s.', 'LOGIN_ERROR_USERNAME' => 'Le nom d’utilisateur que vous avez spécifié est incorrect. Veuillez vérifier votre nom d’utilisateur et réessayer. Si ce problème persiste, veuillez contacter un %sadministrateur du forum%s.', 'LOGIN_FORUM' => 'Vous devez saisir le mot de passe de ce forum afin de consulter et de publier des sujets et des messages.', 'LOGIN_INFO' => 'Vous devez être inscrit avant de pouvoir vous connecter. L’inscription est rapide et vous offre de nombreux avantages. Les administrateurs du forum peuvent accorder des fonctionnalités supplémentaires aux utilisateurs inscrits. Avant de vous inscrire, assurez-vous d’avoir pris connaissance de nos conditions d’utilisation et de notre politique de confidentialité. Veuillez également prendre le temps de consulter attentivement toutes les règles du forum lors de votre navigation.', @@ -517,7 +530,8 @@ $lang = array_merge($lang, [ 'NO_POSTS_TIME_FRAME' => 'Aucun message n’a été publié dans ce sujet lors de cette période.', 'NO_FEED_ENABLED' => 'Les flux ne sont pas disponibles sur ce forum.', 'NO_FEED' => 'Le flux que vous souhaitez consulter n’est pas disponible.', - 'NO_STYLE_DATA' => 'Impossible d’accéder aux données du style', + 'NO_STYLE_DATA' => 'Impossible d’accéder aux données du style concernant l’« user_style » %s paramétré pour le « user_id » %s', + 'NO_STYLE_CFG' => 'Impossible d’accéder au fichier de configuration du style concernant : %s', 'NO_SUBJECT' => 'Aucun sujet n’a été spécifié', // Used for posts having no subject defined but displayed within management pages. 'NO_SUCH_SEARCH_MODULE' => 'Le module de recherche que vous avez spécifié est introuvable.', 'NO_SUPPORTED_AUTH_METHODS' => 'Aucune méthode d’authentification n’est prise en charge.', @@ -600,7 +614,8 @@ $lang = array_merge($lang, [ 'POST_TIME' => 'Date du message', 'POST_TOPIC' => 'Publier un nouveau sujet', 'POST_UNAPPROVED_ACTION' => 'Message en attente d’approbation :', - 'POST_UNAPPROVED' => 'Ce message n’a pas encore été approuvé.', + 'POST_UNAPPROVED' => 'Ce message n’a pas été approuvé.', + 'POST_UNAPPROVED_EXPLAIN' => 'Ce message ne sera visible aux autres utilisateurs que lorsqu’il sera approuvé.', 'POWERED_BY' => 'Développé par %s', 'PREVIEW' => 'Prévisualiser', 'PREVIOUS' => 'Précédent', // Used in pagination diff --git a/language/fr/email/admin_activate.txt b/language/fr/email/admin_activate.txt index 051a0b5..a043e72 100644 --- a/language/fr/email/admin_activate.txt +++ b/language/fr/email/admin_activate.txt @@ -7,7 +7,7 @@ Le compte de « {USERNAME} » a été désactivé ou nouvellement créé. Vous Si vous souhaitez consulter le profil de cet utilisateur, veuillez cliquer sur le lien suivant : {U_USER_DETAILS} -Si vous souhaitez activer le compte de cet utilisateur, veuillez cliquer sur le lien suivant : +Vous pouvez activer dès à présent le compte de cet utilisateur en cliquant sur le lien suivant : {U_ACTIVATE} {EMAIL_SIG} diff --git a/language/fr/email/newtopic_notify.txt b/language/fr/email/newtopic_notify.txt index 0245589..39ef572 100644 --- a/language/fr/email/newtopic_notify.txt +++ b/language/fr/email/newtopic_notify.txt @@ -7,7 +7,7 @@ Vous recevez cette notification car vous surveillez le forum « {FORUM_NAME}  {U_FORUM} -Pour consulter directement ce nouveau sujet, vous pouvez cliquer sur le lien suivant : +Pour consulter directement ce nouveau sujet, vous pouvez cliquer sur le lien suivant : {U_TOPIC} diff --git a/language/fr/email/user_forgot_password.txt b/language/fr/email/user_forgot_password.txt new file mode 100644 index 0000000..14b3fb2 --- /dev/null +++ b/language/fr/email/user_forgot_password.txt @@ -0,0 +1,13 @@ +Subject: Réinitialisation de mot de passe + +Bonjour {USERNAME}, + +Vous recevez cette notification car vous (ou quelqu’un se faisant passer pour vous) avez demandé à récupérer un mot de passe oublié sur votre compte sur « {SITENAME} ». + +Pour réinitialiser votre mot de passe, veuillez cliquer sur le lien ci-dessous : + +{U_RESET_PASSWORD} + +Si vous n’êtes pas à l’origine de cette demande, vous pouvez ignorer ce courriel. Si vous continuez à recevoir cette notification, veuillez contacter un administrateur du forum. + +{EMAIL_SIG} diff --git a/language/fr/help/faq.php b/language/fr/help/faq.php index 2e9326d..aa68462 100644 --- a/language/fr/help/faq.php +++ b/language/fr/help/faq.php @@ -41,7 +41,7 @@ $lang = array_merge($lang, [ 'HELP_FAQ_BLOCK_SEARCH' => 'Recherche dans les forums', 'HELP_FAQ_BLOCK_USERSETTINGS' => 'Préférences et paramètres des utilisateurs', - 'HELP_FAQ_BOOKMARKS_DIFFERENCE_ANSWER' => 'Dans phpBB 3.0, la fonctionnalité qui vous permettait d’ajouter un sujet aux favoris était similaire à celle présente dans votre navigateur internet. Vous ne receviez aucune notification lorsqu’un sujet ajouté aux favoris était mis à jour. Dans phpBB 3.2, les favoris sont davantage similaires aux abonnements. Vous pouvez à présent recevoir une notification lorsqu’un sujet ajouté aux favoris est mis à jour. L’abonnement, quant à lui, vous préviendra de la mise à jour d’un forum ou d’un sujet auquel vous êtes abonné. Les options de notification des favoris et des abonnements peuvent être modifiés depuis le panneau de contrôle de l’utilisateur, sous les « Préférences du forum ».', + 'HELP_FAQ_BOOKMARKS_DIFFERENCE_ANSWER' => 'Dans phpBB 3.0, la fonctionnalité qui vous permettait d’ajouter un sujet aux favoris était similaire à celle présente dans votre navigateur internet. Vous ne receviez aucune notification lorsqu’un sujet ajouté aux favoris était mis à jour. Dans phpBB 3.3, les favoris sont davantage similaires aux abonnements. Vous pouvez à présent recevoir une notification lorsqu’un sujet ajouté aux favoris est mis à jour. L’abonnement, quant à lui, vous préviendra de la mise à jour d’un forum ou d’un sujet auquel vous êtes abonné. Les options de notification des favoris et des abonnements peuvent être modifiés depuis le panneau de contrôle de l’utilisateur, sous les « Préférences du forum ».', 'HELP_FAQ_BOOKMARKS_DIFFERENCE_QUESTION' => 'Quelle est la différence entre les favoris et les abonnements ?', 'HELP_FAQ_BOOKMARKS_FORUM_ANSWER' => 'Vous pouvez vous abonner à un forum spécifique en cliquant sur le lien « S’abonner au forum » situé en bas de la page du forum.', 'HELP_FAQ_BOOKMARKS_FORUM_QUESTION' => 'Comment puis-je m’abonner à un forum spécifique ?', @@ -110,7 +110,7 @@ $lang = array_merge($lang, [ 'HELP_FAQ_LOGIN_CANNOT_REGISTER_QUESTION' => 'Pourquoi ne puis-je pas m’inscrire ?', 'HELP_FAQ_LOGIN_COPPA_ANSWER' => 'La COPPA (pour « Child Online Privacy and Protection Act ») est une loi des États-Unis d’Amérique qui demande aux sites internet collectant potentiellement des informations sur les mineurs âgés de moins de 13 ans un consentement écrit des parents ou des tuteurs légaux des mineurs concernés. Si vous ne savez pas si cette loi s’applique également aux mineurs âgés de moins de 13 ans inscrits sur votre forum, nous vous conseillons de contacter un conseiller juridique qui pourra vous renseigner. Veuillez noter que phpBB Limited et que les propriétaires de ce forum ne peuvent pas vous proposer d’assistance légale et ne doivent donc pas être contactés à ce sujet, excepté lorsque l’assistance porte sur la question « Qui dois-je contacter à propos de problèmes d’abus ou d’ordres légaux liés à ce forum ? ».', 'HELP_FAQ_LOGIN_COPPA_QUESTION' => 'Qu’est-ce que la COPPA ?', - 'HELP_FAQ_LOGIN_DELETE_COOKIES_ANSWER' => 'Cette option vous permet d’effacer tous les cookies générés par phpBB 3.2 qui conservent votre authentification et votre connexion au forum. Les cookies permettent également d’enregistrer le statut des messages (s’ils sont lus ou non lus) dans le cas où cette fonctionnalité a été activée par un administrateur du forum. Si vous rencontrez des problèmes récurrents de connexion et de déconnexion au forum, essayez de supprimer les cookies.', + 'HELP_FAQ_LOGIN_DELETE_COOKIES_ANSWER' => 'Cette option vous permet d’effacer tous les cookies générés par phpBB 3.3 qui conservent votre authentification et votre connexion au forum. Les cookies permettent également d’enregistrer le statut des messages (s’ils sont lus ou non lus) dans le cas où cette fonctionnalité a été activée par un administrateur du forum. Si vous rencontrez des problèmes récurrents de connexion et de déconnexion au forum, essayez de supprimer les cookies.', 'HELP_FAQ_LOGIN_DELETE_COOKIES_QUESTION' => 'À quoi sert « Supprimer les cookies » ?', 'HELP_FAQ_LOGIN_LOST_PASSWORD_ANSWER' => 'Pas de panique ! Bien que votre mot de passe ne puisse pas être récupéré, il peut facilement être réinitialisé. Veuillez vous rendre sur la page de connexion et cliquer sur « J’ai perdu mon mot de passe ». Suivez les instructions et vous devriez être en mesure de pouvoir vous connecter de nouveau rapidement.
Cependant, si vous ne pouvez pas réinitialiser votre mot de passe, nous vous invitons à contacter un administrateur du forum.', 'HELP_FAQ_LOGIN_LOST_PASSWORD_QUESTION' => 'J’ai perdu mon mot de passe !', diff --git a/language/fr/install.php b/language/fr/install.php index e232291..7a77d5a 100644 --- a/language/fr/install.php +++ b/language/fr/install.php @@ -44,18 +44,18 @@ $lang = array_merge($lang, [ // Introduction page 'INTRODUCTION_TITLE' => 'Introduction', - 'INTRODUCTION_BODY' => 'Bienvenue sur phpBB 3.2 !

phpBB® est le logiciel de forum de discussions libre et gratuit le plus populaire dans le monde. Il est l’aboutissement d’un développement qui a débuté en 2000. Tout comme ses versions précédentes, phpBB 3.2 est riche en fonctionnalités, facile d’accès et entièrement pris en charge par phpBB Limited. Il améliore considérablement ce qui a rendu phpBB 2.0 populaire et ajoute des fonctionnalités demandées qui manquaient aux versions antérieures. Nous espérons avoir répondu convenablement à vos attentes.

Cet assistant vous guidera au cours de l’installation et de la mise à jour du logiciel, ainsi que la conversion d’un logiciel de forum de discussions (dont phpBB 2.0) vers phpBB 3.2. Pour plus d’informations, veuillez consulter le guide d’installation (en anglais).

Si vous souhaitez vous renseigner sur la licence du logiciel ou sur l’assistance mise à votre disposition, veuillez sélectionner les éléments appropriés situés sur le menu latéral de gauche. Pour continuer, veuillez sélectionner l’onglet approprié situé en haut de cette page.', + 'INTRODUCTION_BODY' => 'Bienvenue sur phpBB 3.3 !

phpBB® est le logiciel de forum de discussions libre et gratuit le plus populaire dans le monde. Il est l’aboutissement d’un développement qui a débuté en 2000. Tout comme ses versions précédentes, phpBB 3.3 est riche en fonctionnalités, facile d’accès et entièrement pris en charge par phpBB Limited. Il améliore considérablement ce qui a rendu phpBB 2.0 populaire et ajoute des fonctionnalités demandées qui manquaient aux versions antérieures. Nous espérons avoir répondu convenablement à vos attentes.

Cet assistant vous guidera au cours de l’installation et de la mise à jour du logiciel, ainsi que la conversion d’un logiciel de forum de discussions (dont phpBB 2.0) vers phpBB 3.3. Pour plus d’informations, veuillez consulter le guide d’installation (en anglais).

Si vous souhaitez vous renseigner sur la licence du logiciel ou sur l’assistance mise à votre disposition, veuillez sélectionner les éléments appropriés situés sur le menu latéral de gauche. Pour continuer, veuillez sélectionner l’onglet approprié situé en haut de cette page.', // Support page 'SUPPORT_TITLE' => 'Assistance', - 'SUPPORT_BODY' => 'La dernière version stable de phpBB 3 vous permet de bénéficier d’une assistance complète et gratuite comprenant :

  • l’installation
  • la configuration
  • les questions techniques
  • les problèmes en relation avec de potentiels bogues du logiciel
  • la mise à jour d’une version « Release Candidate » (RC) vers la dernière version stable
  • la conversion de phpBB 2.0 vers phpBB 3.2
  • la conversion d’un logiciel de forum de discussions vers phpBB 3.2 (veuillez consulter le forum relatif aux convertisseurs (en anglais))

Nous encourageons vivement les utilisateurs des versions « Beta » de phpBB 3.2 à procéder à une nouvelle installation vers la dernière version stable.

Extensions et styles

Concernant les problèmes relatifs aux extensions, veuillez publier vos questions dans le forum relatif aux extensions (en anglais).
Concernant les problèmes relatifs aux styles, aux modèles et aux thèmes, veuillez publier vos questions dans le forum relatif aux styles (en anglais).

Si votre question est spécifique à une archive, veuillez publier directement votre demande dans le sujet dédié à cette archive.

Assistance


La section d’assistance (en anglais)
Le guide de démarrage rapide (en anglais)

Si vous souhaitez vous assurer d’être tenu au courant des dernières versions et nouveautés de notre logiciel, suivez-nous Twitter (en anglais) et Facebook (en anglais).

', + 'SUPPORT_BODY' => 'La dernière version stable de phpBB 3 vous permet de bénéficier d’une assistance complète et gratuite comprenant :

  • l’installation
  • la configuration
  • les questions techniques
  • les problèmes en relation avec de potentiels bogues du logiciel
  • la mise à jour d’une version « Release Candidate » (RC) vers la dernière version stable
  • la conversion de phpBB 2.0 vers phpBB 3.3
  • la conversion d’un logiciel de forum de discussions vers phpBB 3.3 (veuillez consulter le forum relatif aux convertisseurs (en anglais))

Nous encourageons vivement les utilisateurs des versions « Beta » de phpBB 3.3 à procéder à une nouvelle installation vers la dernière version stable.

Extensions et styles

Concernant les problèmes relatifs aux extensions, veuillez publier vos questions dans le forum relatif aux extensions (en anglais).
Concernant les problèmes relatifs aux styles, aux modèles et aux thèmes, veuillez publier vos questions dans le forum relatif aux styles (en anglais).

Si votre question est spécifique à une archive, veuillez publier directement votre demande dans le sujet dédié à cette archive.

Assistance


La section d’assistance (en anglais)
Le guide de démarrage rapide (en anglais)

Si vous souhaitez vous assurer d’être tenu au courant des dernières versions et nouveautés de notre logiciel, suivez-nous Twitter (en anglais) et Facebook (en anglais).

', // License 'LICENSE_TITLE' => 'Licence publique générale', // Install page 'INSTALL_INTRO' => 'Bienvenue sur l’assistant d’installation', - 'INSTALL_INTRO_BODY' => 'Cet assistant va vous permettre d’installer phpBB 3.2 sur votre serveur.

Avant de continuer, assurez-vous d’avoir à disposition les informations concernant votre base de données. Si vous ne les connaissez pas, veuillez les demander à votre hébergeur. Vous aurez besoin des informations suivantes :

+ 'INSTALL_INTRO_BODY' => 'Cet assistant va vous permettre d’installer phpBB 3.3 sur votre serveur.

Avant de continuer, assurez-vous d’avoir à disposition les informations concernant votre base de données. Si vous ne les connaissez pas, veuillez les demander à votre hébergeur. Vous aurez besoin des informations suivantes :

  • Le type de votre base de données
  • @@ -67,7 +67,7 @@ $lang = array_merge($lang, [

    Attention : si vous procédez à une installation en utilisant SQLite, vous devrez saisir le chemin complet de votre fichier de base de données dans le champ DSN et laisser les champs du nom d’utilisateur et du mot de passe vides. Pour des raisons de sécurité, vous devriez vous assurer que le fichier de base de données ne soit pas situé dans un endroit accessible sur internet.

    -

    phpBB 3.2 est compatible avec les bases de données suivantes :

    +

    phpBB 3.3 est compatible avec les bases de données suivantes :

    • MySQL 3.23+ (MySQLi pris en charge)
    • PostgreSQL 8.3+
    • @@ -104,7 +104,7 @@ $lang = array_merge($lang, [ // Server requirements 'PHP_VERSION_REQD' => 'Version de PHP', - 'PHP_VERSION_REQD_EXPLAIN' => 'phpBB requiert la version 5.4.0 ou supérieure de PHP.', + 'PHP_VERSION_REQD_EXPLAIN' => 'phpBB requiert la version 7.1.3 ou supérieure de PHP.', 'PHP_GETIMAGESIZE_SUPPORT' => 'La fonction PHP « getimagesize() » est requise.', 'PHP_GETIMAGESIZE_SUPPORT_EXPLAIN' => 'La fonction PHP « getimagesize() » est disponible.', 'PCRE_UTF_SUPPORT' => 'Support de PCRE UTF-8', @@ -185,7 +185,6 @@ $lang = array_merge($lang, [ // Database options 'DB_OPTION_MSSQL_ODBC' => 'MSSQL Server 2000+ via ODBC', 'DB_OPTION_MSSQLNATIVE' => 'MSSQL Server 2005+ [ Natif ]', - 'DB_OPTION_MYSQL' => 'MySQL', 'DB_OPTION_MYSQLI' => 'MySQL avec l’extension MySQLi', 'DB_OPTION_ORACLE' => 'Oracle', 'DB_OPTION_POSTGRES' => 'PostgreSQL', @@ -237,7 +236,7 @@ $lang = array_merge($lang, [ 'CONFIG_SITE_DESC' => 'Une courte description de votre forum', 'CONFIG_SITENAME' => 'votredomaine.com', - 'DEFAULT_INSTALL_POST' => 'Ceci est un exemple de message de votre nouvelle installation de phpBB 3.2. Tout semble fonctionner correctement ! Si vous le souhaitez, vous pouvez supprimer ce message et continuer à configurer votre forum. Lors du processus d’installation, votre première catégorie et votre premier forum ont été assignés à un ensemble de permissions relatif aux groupes d’utilisateurs que sont les administrateurs, les modérateurs généraux, les utilisateurs inscrits, les utilisateurs COPPA inscrits, les invités et les robots. Si vous souhaitez supprimer également cette première catégorie et ce premier forum, n’oubliez pas d’assigner les permissions appropriées à tous les groupes d’utilisateurs pour chaque nouvelle catégorie et nouveau forum que vous créez. Il est recommandé de renommer cette première catégorie et ce premier forum, puis de copier leurs permissions sur chaque nouvelle catégorie et nouveau forum lors de leur création. Bonne continuation !', + 'DEFAULT_INSTALL_POST' => 'Ceci est un exemple de message de votre nouvelle installation de phpBB 3.3. Tout semble fonctionner correctement ! Si vous le souhaitez, vous pouvez supprimer ce message et continuer à configurer votre forum. Lors du processus d’installation, votre première catégorie et votre premier forum ont été assignés à un ensemble de permissions relatif aux groupes d’utilisateurs que sont les administrateurs, les modérateurs généraux, les utilisateurs inscrits, les utilisateurs COPPA inscrits, les invités et les robots. Si vous souhaitez supprimer également cette première catégorie et ce premier forum, n’oubliez pas d’assigner les permissions appropriées à tous les groupes d’utilisateurs pour chaque nouvelle catégorie et nouveau forum que vous créez. Il est recommandé de renommer cette première catégorie et ce premier forum, puis de copier leurs permissions sur chaque nouvelle catégorie et nouveau forum lors de leur création. Bonne continuation !', 'FORUMS_FIRST_CATEGORY' => 'Votre première catégorie', 'FORUMS_TEST_FORUM_DESC' => 'La description de votre premier forum.', @@ -274,7 +273,7 @@ $lang = array_merge($lang, [ 'SMILIES_VERY_HAPPY' => 'Heureux', 'SMILIES_WINK' => 'Clin d’œil', - 'TOPICS_TOPIC_TITLE' => 'Bienvenue sur phpBB 3.2', + 'TOPICS_TOPIC_TITLE' => 'Bienvenue sur phpBB 3.3', ]); // Common navigation items' translation @@ -355,7 +354,7 @@ $lang = array_merge($lang, [

      Mettre à jour votre installation avec l’archive complète

      -

      Il est recommandé de mettre à jour votre forum en utilisant l’archive complète. Néanmoins, si les fichiers systèmes de phpBB ont été modifiés sur votre installation, il est préférable d’utiliser l’archive de mise à jour automatique afin de préserver les modifications apportées. Vous pouvez également mettre à jour votre installation en utilisant des méthodes alternatives listées dans le document « INSTALL.html ». Les étapes pour mettre à jour phpBB 3.2 en utilisant l’archive complète sont :

      +

      Il est recommandé de mettre à jour votre forum en utilisant l’archive complète. Néanmoins, si les fichiers systèmes de phpBB ont été modifiés sur votre installation, il est préférable d’utiliser l’archive de mise à jour automatique afin de préserver les modifications apportées. Vous pouvez également mettre à jour votre installation en utilisant des méthodes alternatives listées dans le document « INSTALL.html ». Les étapes pour mettre à jour phpBB 3.3 en utilisant l’archive complète sont :

      1. Sauvegardez les fichiers et la base de données de votre forum.
      2. Accédez à la page des téléchargements (en anglais) et téléchargez la dernière version de l’archive complète.
      3. @@ -377,7 +376,7 @@ $lang = array_merge($lang, [

        Mettre à jour votre installation avec l’archive de mise à jour automatique

        -

        Il n’est recommandé de mettre à jour votre forum en utilisant l’archive de mise à jour automatique que dans le cas où les fichiers systèmes de phpBB ont été modifiés sur votre installation. Vous pouvez également mettre à jour votre installation en utilisant des méthodes alternatives listées dans le document « INSTALL.html ». Les étapes pour mettre à jour phpBB 3.2 en utilisant l’archive de mise à jour automatique sont :

        +

        Il n’est recommandé de mettre à jour votre forum en utilisant l’archive de mise à jour automatique que dans le cas où les fichiers systèmes de phpBB ont été modifiés sur votre installation. Vous pouvez également mettre à jour votre installation en utilisant des méthodes alternatives listées dans le document « INSTALL.html ». Les étapes pour mettre à jour phpBB 3.3 en utilisant l’archive de mise à jour automatique sont :

        1. Accédez à la page des téléchargements (en anglais) et téléchargez la dernière version de l’archive de mise à jour automatique.

        2. @@ -492,7 +491,7 @@ $lang = array_merge($lang, [ 'CONVERT_NOT_EXIST' => 'Le convertisseur que vous avez spécifié est introuvable.', 'DEV_NO_TEST_FILE' => 'Aucune valeur n’a été spécifiée dans le convertisseur concernant la variable test_file. Si vous êtes un utilisateur de ce convertisseur, vous ne devriez pas être en mesure de voir cette erreur. Veuillez rapporter ce message à l’auteur du convertisseur. Si vous êtes l’auteur du convertisseur, vous devez spécifier le nom d’un fichier existant dans le forum source afin de permettre la validation du chemin vers ce dernier.', 'COULD_NOT_FIND_PATH' => 'Le chemin menant à votre ancien forum est introuvable. Veuillez vérifier vos paramètres et réessayer.
          » Le chemin source spédifié était « %s ».', - 'CONFIG_PHPBB_EMPTY' => 'La variable de configuration « %s » de phpBB 3.2 est vide.', + 'CONFIG_PHPBB_EMPTY' => 'La variable de configuration « %s » de phpBB 3.3 est vide.', 'MAKE_FOLDER_WRITABLE' => 'Veuillez vous assurer que ce répertoire existe et que ses droits d’accès soient disponibles pour écriture par votre serveur, puis réessayez :
          »%s.', 'MAKE_FOLDERS_WRITABLE' => 'Veuillez vous assurer que ces répertoires existent et que leurs droits d’accès soient disponibles pour écriture par votre serveur, puis réessayez :
          »%s.', @@ -526,7 +525,7 @@ $lang = array_merge($lang, [ 'DEFAULT_PREFIX_IS' => 'Le convertisseur n’a pas été en mesure de trouver de tables comportant ce préfixe. Veuillez vous assurer d’avoir correctement spécifié les informations sur le forum que vous souhaitez convertir. Le préfixe de table par défaut concernant « %1$s » est « %2$s ».', 'SPECIFY_OPTIONS' => 'Spécifier les options de conversion', 'FORUM_PATH' => 'Chemin du forum', - 'FORUM_PATH_EXPLAIN' => 'Le chemin relatif sur le disque vers votre ancien forum depuis la racine de cette installation de phpBB 3.2.', + 'FORUM_PATH_EXPLAIN' => 'Le chemin relatif sur le disque vers votre ancien forum depuis la racine de cette installation de phpBB 3.3.', 'REFRESH_PAGE' => 'Actualiser la page pour continuer la conversion', 'REFRESH_PAGE_EXPLAIN' => 'Si cette option est activée, le convertisseur actualisera à chaque étape la page pour continuer la conversion. Nous vous conseillons de ne pas activer cette option s’il s’agit de votre première conversion, en particulier si votre but est de tester cet outil et de déterminer en avance les possibles erreurs.', @@ -562,7 +561,7 @@ $lang = array_merge($lang, [ // Finish conversion 'CONVERT_COMPLETE' => 'Conversion terminée', - 'CONVERT_COMPLETE_EXPLAIN' => 'Félicitations ! Vous avez converti votre forum à phpBB 3.2. Vous pouvez à présent vous connecter et accéder à votre forum. Veuillez vous assurer que les paramètres ont été correctement transférés avant de mettre en ligne votre forum en supprimant le répertoire d’installation. Il vous est possible d’obtenir une assistance sur l’utilisation de phpBB grâce à sa documentation (en anglais) et ses forums d’assistance (en anglais).', + 'CONVERT_COMPLETE_EXPLAIN' => 'Félicitations ! Vous avez converti votre forum à phpBB 3.3. Vous pouvez à présent vous connecter et accéder à votre forum. Veuillez vous assurer que les paramètres ont été correctement transférés avant de mettre en ligne votre forum en supprimant le répertoire d’installation. Il vous est possible d’obtenir une assistance sur l’utilisation de phpBB grâce à sa documentation (en anglais) et ses forums d’assistance (en anglais).', 'CONV_ERROR_ATTACH_FTP_DIR' => 'Le transfert de pièces jointes par FTP est activé sur l’ancien forum. Veuillez désactiver cette option et vous assurer qu’un répertoire valide de transfert a bien été spécifié, puis copiez toutes les pièces jointes dans ce nouveau répertoire en ligne. Une fois cette opération effectuée, redémarrez le convertisseur.', 'CONV_ERROR_CONFIG_EMPTY' => 'Aucune information de configuration sur ce convertisseur n’est disponible.', diff --git a/language/fr/migrator.php b/language/fr/migrator.php index 2b9fd34..f813896 100644 --- a/language/fr/migrator.php +++ b/language/fr/migrator.php @@ -45,7 +45,7 @@ $lang = array_merge($lang, [ 'MIGRATION_DATA_IN_PROGRESS' => 'Installation des données : %1$s ; durée : %2$.2f secondes', 'MIGRATION_DATA_RUNNING' => 'Installation des données : %s.', 'MIGRATION_EFFECTIVELY_INSTALLED' => 'Migration déjà installée (mais ignorée) : %s', - 'MIGRATION_EXCEPTION_ERROR' => 'Une erreur est survenue lors de la requête et une exception a été exécutée. Les modifications effectuées avant que l’erreur ne survienne ont été restaurées au mieux mais vous devriez vérifier que votre forum fonctionne correctement.', + 'MIGRATION_EXCEPTION_ERROR' => 'Une erreur est survenue lors de la requête et une exception a été exécutée. Les modifications effectuées avant que l’erreur ne survienne ont été restaurées au mieux mais vous devriez vérifier que votre forum fonctionne correctement :

          %s', 'MIGRATION_NOT_FULFILLABLE' => 'La migration « %1$s » n’est pas exécutable car la migration « %2$s » est manquante.', 'MIGRATION_NOT_INSTALLED' => 'La migration « %s » n’est pas installée.', 'MIGRATION_NOT_VALID' => '%s n’est pas une migration valide.', diff --git a/language/fr/posting.php b/language/fr/posting.php index ab54885..86a6a12 100644 --- a/language/fr/posting.php +++ b/language/fr/posting.php @@ -36,15 +36,16 @@ 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 $lang = array_merge($lang, [ - 'ADD_ATTACHMENT' => 'Insérer une pièce jointe', - 'ADD_ATTACHMENT_EXPLAIN' => 'Si vous souhaitez insérer un ou plusieurs fichiers, veuillez renseigner les informations demandées ci-dessous.', - 'ADD_FILE' => 'Ajouter le fichier', - 'ADD_POLL' => 'Créer un sondage', - 'ADD_POLL_EXPLAIN' => 'Laissez ces champs vides si vous ne souhaitez pas insérer de sondage à votre sujet.', - 'ALREADY_DELETED' => 'Le message a déjà été supprimé.', - 'ATTACH_DISK_FULL' => 'Vous ne pouvez pas transférer cette pièce jointe car l’espace disque est insuffisant.', - 'ATTACH_QUOTA_REACHED' => 'La limite du nombre de pièces jointes sur le forum a été atteinte.', - 'ATTACH_SIG' => 'Insérer une signature (personnalisable dans le panneau de contrôle de l’utilisateur)', + 'ADD_ATTACHMENT' => 'Insérer une pièce jointe', + 'ADD_ATTACHMENT_EXPLAIN' => 'Si vous souhaitez insérer un ou plusieurs fichiers, veuillez renseigner les informations demandées ci-dessous.', + 'ADD_FILE' => 'Ajouter le fichier', + 'ADD_POLL' => 'Créer un sondage', + 'ADD_POLL_EXPLAIN' => 'Laissez ces champs vides si vous ne souhaitez pas insérer de sondage à votre sujet.', + 'ALREADY_DELETED' => 'Le message a déjà été supprimé.', + 'ATTACH_COMMENT_NO_EMOJIS' => 'Le commentaire de la pièce jointe contient des caractères non autorisés (émojis).', + 'ATTACH_DISK_FULL' => 'Vous ne pouvez pas transférer cette pièce jointe car l’espace disque est insuffisant.', + 'ATTACH_QUOTA_REACHED' => 'La limite du nombre de pièces jointes sur le forum a été atteinte.', + 'ATTACH_SIG' => 'Insérer une signature (personnalisable dans le panneau de contrôle de l’utilisateur)', 'BBCODE_A_HELP' => 'Insérer une pièce jointe dans une ligne : [attachment=]nomdufichier.ext[/attachment]', 'BBCODE_B_HELP' => 'Texte en gras : [b]texte[/b]', @@ -265,7 +266,6 @@ $lang = array_merge($lang, [ 'TOPIC_BUMPED' => 'Le sujet a été remonté.', 'UNAUTHORISED_BBCODE' => 'Vous ne pouvez pas utiliser certains BBCodes : %s.', - 'UNGLOBALISE_EXPLAIN' => 'Pour rétablir cette annonce générale en sujet standard, vous devez sélectionner le forum dans lequel vous souhaitez voir apparaître ce sujet.', 'UNSUPPORTED_CHARACTERS_MESSAGE' => 'Votre message contient les caractères non pris en charge suivants :
          %s', 'UNSUPPORTED_CHARACTERS_SUBJECT' => 'Votre sujet contient les caractères non pris en charge suivants :
          %s', 'UPDATE_COMMENT' => 'Mettre à jour la description', diff --git a/language/fr/ucp.php b/language/fr/ucp.php index 76addfd..8685b5c 100644 --- a/language/fr/ucp.php +++ b/language/fr/ucp.php @@ -61,7 +61,7 @@ $lang = array_merge($lang, [ 'ACCOUNT_ACTIVE' => 'Votre compte est à présent activé. Nous vous remercions de votre inscription.', 'ACCOUNT_ACTIVE_ADMIN' => 'Le compte est à présent activé.', 'ACCOUNT_ACTIVE_PROFILE' => 'Votre compte est à présent réactivé.', - 'ACCOUNT_ADDED' => 'Votre compte a été créé, nous vous remercions de votre inscription. Vous pouvez à présent vous connecter avec votre nom d’utilisateur et votre mot de passe.', + 'ACCOUNT_ADDED' => 'Votre compte a été créé, nous vous remercions de votre inscription.', 'ACCOUNT_COPPA' => 'Votre compte a été créé mais nécessite d’être activé. Pour plus d’informations, veuillez consulter votre messagerie.', 'ACCOUNT_EMAIL_CHANGED' => 'Votre compte a été mis à jour. Cependant, vous devez le réactiver car vous avez modifié votre adresse de courriel. Une clé d’activation a été envoyée sur la nouvelle adresse de courriel que vous avez spécifiée. Pour plus d’informations, veuillez consulter votre messagerie.', 'ACCOUNT_EMAIL_CHANGED_ADMIN' => 'Votre compte a été mis à jour. Cependant, un administrateur doit le réactiver car vous avez modifié votre adresse de courriel. Vous serez informé lors de la réactivation de votre compte.', @@ -88,6 +88,7 @@ $lang = array_merge($lang, [ 'ATTACHMENTS_EXPLAIN' => 'Depuis cette page, vous pouvez consulter la liste des pièces jointes que vous avez transférées et insérées à vos messages sur le forum.', 'ATTACHMENTS_DELETED' => 'Les pièces jointes ont été supprimées.', 'ATTACHMENT_DELETED' => 'La pièce jointe a été supprimée.', + 'ATTACHMENT_LOCKED' => 'Vous ne pouvez pas supprimer la pièce jointe car ce sujet est verrouillé.', 'AUTOLOGIN_SESSION_KEYS_DELETED' => 'Les clés de connexions automatiques ont été supprimées.', 'AVATAR_CATEGORY' => 'Catégorie', 'AVATAR_DRIVER_GRAVATAR_TITLE' => 'Avatar de Gravatar', @@ -114,7 +115,7 @@ $lang = array_merge($lang, [ 'BIRTHDAY' => 'Anniversaire', 'BIRTHDAY_EXPLAIN' => 'Si vous saisissez une année, votre âge sera affiché lors de votre anniversaire.', 'BOARD_DATE_FORMAT' => 'Mon format de date', - 'BOARD_DATE_FORMAT_EXPLAIN' => 'La syntaxe qui est utilisée est identique à la fonction PHP « date() ».', + 'BOARD_DATE_FORMAT_EXPLAIN' => 'La syntaxe qui est utilisée est identique à la fonction « date() » de PHP.', 'BOARD_LANGUAGE' => 'Ma langue', 'BOARD_STYLE' => 'Mon style sur le forum', 'BOARD_TIMEZONE' => 'Mon fuseau horaire', @@ -400,6 +401,7 @@ $lang = array_merge($lang, [ 'NO_OLDER_PM' => 'Aucun ancien message.', 'NO_PASSWORD_SUPPLIED' => 'Vous ne pouvez pas vous connecter sans saisir de mot de passe.', 'NO_RECIPIENT' => 'Aucun destinataire n’a été spécifié.', + 'NO_RESET_TOKEN' => 'Vous n’avez pas renseigné de jeton de réinitialisation de mot de passe.', 'NO_RULES_DEFINED' => 'Aucune règle n’a été spécifiée.', 'NO_SAVED_DRAFTS' => 'Aucun brouillon n’a été enregistré.', 'NO_TO_RECIPIENT' => 'Aucun', @@ -407,13 +409,14 @@ $lang = array_merge($lang, [ 'NO_WATCHED_SELECTED' => 'Aucun abonnement à un forum ou un sujet n’a été sélectionné.', 'NO_WATCHED_TOPICS' => 'Aucun abonnement à un sujet.', - 'PASS_TYPE_ALPHA_EXPLAIN' => 'Le mot de passe doit être compris entre %1$s et %2$s de long, doit contenir des lettres (sans accent) en majuscules et en minuscules et doit contenir des chiffres.', - 'PASS_TYPE_ANY_EXPLAIN' => 'Doit être compris entre %1$s et %2$s.', - 'PASS_TYPE_CASE_EXPLAIN' => 'Le mot de passe doit être compris entre %1$s et %2$s de long et doit contenir des lettres en majuscules et en minuscules.', - 'PASS_TYPE_SYMBOL_EXPLAIN' => 'Le mot de passe doit être compris entre %1$s et %2$s de long, doit contenir des lettres en majuscules et en minuscules, doit contenir des chiffres et doit contenir des symboles.', + 'PASS_TYPE_ALPHA_EXPLAIN' => 'Le mot de passe doit contenir un minimum de %1$s caractères, doit contenir des lettres (sans accent) en majuscules et en minuscules et doit contenir des chiffres.', + 'PASS_TYPE_ANY_EXPLAIN' => 'Doit contenir un minimum de %1$s caractères.', + 'PASS_TYPE_CASE_EXPLAIN' => 'Le mot de passe doit contenir un minimum de %1$s caractères et doit contenir des lettres en majuscules et en minuscules.', + 'PASS_TYPE_SYMBOL_EXPLAIN' => 'Le mot de passe doit contenir un minimum de %1$s caractères, doit contenir des lettres en majuscules et en minuscules, doit contenir des chiffres et doit contenir des symboles.', 'PASSWORD' => 'Mot de passe', 'PASSWORD_ACTIVATED' => 'Votre nouveau mot de passe a été activé.', - 'PASSWORD_UPDATED_IF_EXISTED' => 'Si votre compte existe, un nouveau mot de passe a été envoyé sur l’adresse de courriel associée. Si vous ne recevez pas de courriel, il se peut que vous ayez été banni, que votre compte ne soit pas activé ou que vous n’avez pas l’autorisation de modifier votre mot de passe. Pour plus d’informations, veuillez contacter un administrateur. De même, n’oubliez pas de vérifier que le courriel ne soit pas considéré comme courriel indésirable par votre service de messagerie électronique.', + 'PASSWORD_RESET' => 'Votre mot de passe a été réinitialisé.', + 'PASSWORD_RESET_LINK_SENT' => 'Si votre compte existe, un lien pour réinitialiser votre mot de passe a été envoyé sur l’adresse de courriel que vous avez enregistrée. Si vous ne recevez pas de courriel, il se peut que vous ayez été banni, que votre compte ne soit pas activé, que vous avez demandé un trop grand nombre de réinitialisation de mot de passe dans un laps de temps trop court ou que vous n’êtes pas autorisé à modifier votre mot de passe. Pour plus d’informations, veuillez contacter un administrateur. De même, n’oubliez pas de vérifier si votre courriel n’ait pas été considéré comme courriel indésirable par le filtre de votre messagerie électronique.', 'PERMISSIONS_RESTORED' => 'Les permissions par défaut ont été restaurées.', 'PERMISSIONS_TRANSFERRED' => 'Les permissions de « %s » ont été transférées. Vous pouvez à présent parcourir le forum avec les permissions de cet utilisateur.
          Veuillez noter que les permissions d’administration ne sont pas transférées. Vous pouvez restaurer vos permissions à tout moment.', 'PM_DISABLED' => 'La messagerie privée a été désactivée sur ce forum.', @@ -448,6 +451,7 @@ $lang = array_merge($lang, [ 'RECIPIENT' => 'Destinataire', 'RECIPIENTS' => 'Destinataires', 'REGISTRATION' => 'Inscription', + 'OAUTH_REGISTRATION' => 'Inscription via services externes', 'RELEASE_MESSAGES' => '%sRendre disponible tous les messages en liste d’attente%s… Ils seront triés de nouveau dans les boîtes appropriées si assez d’espace a été libéré.', 'REMOVE_ADDRESS' => 'Supprimer l’adresse', 'REMOVE_SELECTED_BOOKMARKS' => 'Supprimer les sujets sélectionnés des favoris', @@ -460,6 +464,8 @@ $lang = array_merge($lang, [ 'REPLIED_MESSAGE' => 'Réponse au message', 'REPLY_TO_ALL' => 'Répondre à l’expéditeur et à tous les destinataires.', 'REPORT_PM' => 'Rapporter le message privé', + 'RESET_PASSWORD' => 'Réinitialiser le mot de passe', + 'RESET_TOKEN_EXPIRED_OR_INVALID' => 'Le jeton de réinitialisation de mot de passe que vous avez renseigné est invalide ou a expiré.', 'RESIGN_SELECTED' => 'Décocher la sélection', 'RETURN_FOLDER' => '%1$sRevenir sur la boîte précédente%2$s', 'RETURN_UCP' => '%sRevenir sur le panneau de contrôle de l’utilisateur%s', @@ -475,7 +481,6 @@ $lang = array_merge($lang, [ 'SAME_PASSWORD_ERROR' => 'Le mot de passe que vous avez spécifié est identique à votre mot de passe actuel.', 'SEARCH_YOUR_POSTS' => 'Afficher vos messages', - 'SEND_PASSWORD' => 'Envoyer le mot de passe', 'SENT_AT' => 'Date d’envoi', // Used before dates in private messages 'SHOW_EMAIL' => 'Autoriser les utilisateurs à me contacter par courriel', 'SIGNATURE_EXPLAIN' => 'La signature est un bloc de texte qui sera inséré au pied de tous vos messages. Elle est limitée à %d caractères.', @@ -559,7 +564,6 @@ $lang = array_merge($lang, [ 'UCP_PASSWORD_RESET_DISABLED' => 'La réinitialisation des mots de passe a été désactivée. Si vous souhaitez obtenir de l’aide afin d’accéder à votre compte, veuillez contacter un %sadministrateur du forum%s', 'UCP_REGISTER_DISABLE' => 'L’inscription de nouveaux comptes est désactivée.', - 'UCP_REMIND' => 'Envoyer le mot de passe', 'UCP_RESEND' => 'Envoyer le courriel d’activation', 'UCP_WELCOME' => 'Bienvenue sur le panneau de contrôle de l’utilisateur. Dans ce dernier, vous pouvez consulter et mettre à jour votre profil, vos préférences et vos abonnements aux forums et aux sujets. Si les administrateurs du forum ont activé la messagerie privée, vous pouvez également envoyer des messages aux autres utilisateurs. Veuillez vous assurer d’avoir consulté toutes les annonces avant de continuer.', 'UCP_ZEBRA' => 'Amis et ignorés', diff --git a/styles/Milk_v2/style.cfg b/styles/Milk_v2/style.cfg index b8187a5..5db874d 100644 --- a/styles/Milk_v2/style.cfg +++ b/styles/Milk_v2/style.cfg @@ -21,11 +21,11 @@ # General Information about this style name = Milk v2 copyright = © PlanetStyles.net - Premium Forum Themes -style_version = 2.0.11 -phpbb_version = 3.2.8 +style_version = 2.1.2 +phpbb_version = 3.3.0 # Defining a different template bitfield -# template_bitfield = lNg= +# template_bitfield = //g= # Parent style # Set value to empty or to this style's name if this style does not have a parent style diff --git a/styles/Milk_v2/template/forum_fn.js b/styles/Milk_v2/template/forum_fn.js index 597ddc2..8947b37 100644 --- a/styles/Milk_v2/template/forum_fn.js +++ b/styles/Milk_v2/template/forum_fn.js @@ -522,7 +522,7 @@ function parseDocument($container) { $linksLast = $linksNotSkip.filter(filterLast), // The items that will be hidden last persistent = $this.attr('id') === 'nav-main', // Does this list already have a menu (such as quick-links)? html = '', - slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occured. + slack = 3; // Vertical slack space (in pixels). Determines how sensitive the script is in determining whether a line-break has occurred. // Add a hidden drop-down menu to each links list (except those that already have one) if (!persistent) { @@ -1102,4 +1102,13 @@ if( $('.collapse-trigger').length ) this.slideUp(100); }, }); + + // Add user icon in front of forumlist mods + $("span.forumlist_mods a").each(function(i) { + $(this).prepend(""); + }); + // Remove the comma seperator + $("span.forumlist_mods").each(function() { + $(this).html($(this).html().replace(/,/g , '')); + }); } diff --git a/styles/Milk_v2/template/forumlist_body.html b/styles/Milk_v2/template/forumlist_body.html index b6e9d43..407f483 100644 --- a/styles/Milk_v2/template/forumlist_body.html +++ b/styles/Milk_v2/template/forumlist_body.html @@ -17,7 +17,13 @@
        3. -
          +
          + + {forumrow.FORUM_NAME} + + {L_FORUM} + +
          @@ -36,19 +42,19 @@
- +
    -
  • +
  • - -
    + +
    @@ -70,7 +76,7 @@ {L_REDIRECTS}{L_COLON} {forumrow.CLICKS} {L_TOPICS}{L_COLON} {forumrow.TOPICS}   {L_POSTS}{L_COLON} {forumrow.POSTS} -
    +
- + -
{forumrow.L_MODERATOR_STR}{L_COLON} {forumrow.MODERATORS} +
{forumrow.L_MODERATOR_STR}{L_COLON} {forumrow.MODERATORS}

{forumrow.L_SUBFORUM_STR}{L_COLON} - +
  • @@ -136,7 +142,7 @@ {L_VIEW_LATEST_POST} -
    {forumrow.LAST_POST_TIME} +
    {% if forumrow.U_UNAPPROVED_TOPICS %} {{ lang('TOPIC_UNAPPROVED_FORUM', forumrow.TOPICS) }} @@ -172,4 +178,4 @@
  • -
    \ No newline at end of file +
    diff --git a/styles/Milk_v2/template/forumlist_grid.html b/styles/Milk_v2/template/forumlist_grid.html index 4724d0a..ac2799e 100644 --- a/styles/Milk_v2/template/forumlist_grid.html +++ b/styles/Milk_v2/template/forumlist_grid.html @@ -11,23 +11,19 @@ + + + + + {forumrow.FORUM_NAME} + + {L_FORUM} + + + +
    - - -
    - - -
    -
    - \ No newline at end of file + diff --git a/styles/Milk_v2/theme/blank.css b/styles/Milk_v2/theme/blank.css new file mode 100644 index 0000000..34f1449 --- /dev/null +++ b/styles/Milk_v2/theme/blank.css @@ -0,0 +1,3 @@ +/* This file is intentionally left blank. +It's used by the light/dark toggle +If deleted, you'll get a console log error (but things will still work) */ diff --git a/styles/Milk_v2/theme/buttons.css b/styles/Milk_v2/theme/buttons.css index c13e627..8f66174 100644 --- a/styles/Milk_v2/theme/buttons.css +++ b/styles/Milk_v2/theme/buttons.css @@ -18,6 +18,11 @@ border: 1px solid transparent; } +.post .button { + padding-top: 6px; + padding-bottom: 6px; +} + .button:focus, .button:hover { text-decoration: none; diff --git a/styles/Milk_v2/theme/colour-presets/Aqua.css b/styles/Milk_v2/theme/colour-presets/Aqua.css index 3e30d78..790b0f3 100644 --- a/styles/Milk_v2/theme/colour-presets/Aqua.css +++ b/styles/Milk_v2/theme/colour-presets/Aqua.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #51e2c3; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #51e2c3; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #51e2c3; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#51e2c3+0,83bcfd+100 */ background: rgb(81,226,195); /* Old browsers */ background: -moz-linear-gradient(left, rgba(81,226,195,1) 0%, rgba(131,188,253,1) 100%); /* FF3.6-15 */ @@ -30,7 +30,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, background: -moz-linear-gradient(left, rgba(81,226,195,0.58) 0%, rgba(131,188,253,0.8) 100%); /* FF3.6-15 */ background: -webkit-linear-gradient(left, rgba(81,226,195,0.58) 0%,rgba(131,188,253,0.8) 100%); /* Chrome10-25,Safari5.1-6 */ background: linear-gradient(to right, rgba(81,226,195,0.58) 0%,rgba(131,188,253,0.8) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9451e2c3', endColorstr='#cc83bcfd',GradientType=1 ); /* IE6-9 */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#9451e2c3', endColorstr='#cc83bcfd',GradientType=1 ); /* IE6-9 */ } @@ -47,4 +47,4 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { /* Border light */ .specialbutton:hover { border-color: #56edcd; -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/colour-presets/Blue_Lagoon.css b/styles/Milk_v2/theme/colour-presets/Blue_Lagoon.css index c24ab78..0f1b142 100644 --- a/styles/Milk_v2/theme/colour-presets/Blue_Lagoon.css +++ b/styles/Milk_v2/theme/colour-presets/Blue_Lagoon.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #191654; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #191654; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #191654; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#191654+0,43c6ac+100 */ background: #191654; /* Old browsers */ background: -moz-linear-gradient(left, #191654 0%, #43c6ac 100%); /* FF3.6-15 */ @@ -48,4 +48,3 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { .specialbutton:hover { border-color: #27237e; } - diff --git a/styles/Milk_v2/theme/colour-presets/Blush.css b/styles/Milk_v2/theme/colour-presets/Blush.css index 0e762a5..3edd22a 100644 --- a/styles/Milk_v2/theme/colour-presets/Blush.css +++ b/styles/Milk_v2/theme/colour-presets/Blush.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #f15f79; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #f15f79; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #f15f79; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#f15f79+0,b24592+100 */ background: #f15f79; /* Old browsers */ background: -moz-linear-gradient(left, #f15f79 0%, #b24592 100%); /* FF3.6-15 */ @@ -48,4 +48,3 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { .specialbutton:hover { border-color: #ff768e; } - diff --git a/styles/Milk_v2/theme/colour-presets/Calm_Darya.css b/styles/Milk_v2/theme/colour-presets/Calm_Darya.css index e7e83e0..1910295 100644 --- a/styles/Milk_v2/theme/colour-presets/Calm_Darya.css +++ b/styles/Milk_v2/theme/colour-presets/Calm_Darya.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #49a09d; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #49a09d; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #49a09d; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#49a09d+0,5f2c82+100 */ background: #49a09d; /* Old browsers */ background: -moz-linear-gradient(left, #49a09d 0%, #5f2c82 100%); /* FF3.6-15 */ @@ -47,4 +47,4 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { /* Border light */ .specialbutton:hover { border-color: #52b5b2; -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/colour-presets/Electric_Violet.css b/styles/Milk_v2/theme/colour-presets/Electric_Violet.css index 164dbe3..e2fd0c4 100644 --- a/styles/Milk_v2/theme/colour-presets/Electric_Violet.css +++ b/styles/Milk_v2/theme/colour-presets/Electric_Violet.css @@ -1,10 +1,10 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #8e54e9; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { background: #8e54e9; } @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#8e54e9+0,4776e6+100 */ background: #8e54e9; /* Old browsers */ background: -moz-linear-gradient(left, #8e54e9 0%, #4776e6 100%); /* FF3.6-15 */ diff --git a/styles/Milk_v2/theme/colour-presets/HoneyDew.css b/styles/Milk_v2/theme/colour-presets/HoneyDew.css index 1a9697a..3742a94 100644 --- a/styles/Milk_v2/theme/colour-presets/HoneyDew.css +++ b/styles/Milk_v2/theme/colour-presets/HoneyDew.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #ade7ad; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #ade7ad; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #ade7ad; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#f8ffae+0,43c6ac+100 */ background: #f8ffae; /* Old browsers */ background: -moz-linear-gradient(left, #f8ffae 0%, #43c6ac 100%); /* FF3.6-15 */ @@ -47,4 +47,4 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { /* Border light */ .specialbutton:hover { border-color: #b8f4b8; -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/colour-presets/Hot_Red.css b/styles/Milk_v2/theme/colour-presets/Hot_Red.css index 75ef3b5..17a98d5 100644 --- a/styles/Milk_v2/theme/colour-presets/Hot_Red.css +++ b/styles/Milk_v2/theme/colour-presets/Hot_Red.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #ea384d; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #ea384d; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #ea384d; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ea384d+0,d31027+100 */ background: rgb(234,56,77); /* Old browsers */ background: -moz-linear-gradient(left, rgba(234,56,77,1) 0%, rgba(211,16,39,1) 100%); /* FF3.6-15 */ @@ -47,4 +47,4 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { /* Border light */ .specialbutton:hover { border-color: #fb485d; -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/colour-presets/Ibiza_Sunset.css b/styles/Milk_v2/theme/colour-presets/Ibiza_Sunset.css index e89100c..e5b8b4c 100644 --- a/styles/Milk_v2/theme/colour-presets/Ibiza_Sunset.css +++ b/styles/Milk_v2/theme/colour-presets/Ibiza_Sunset.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #ff6a00; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #ff6a00; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #ff6a00; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ff6a00+0,ee0979+100 */ background: #ff6a00; /* Old browsers */ background: -moz-linear-gradient(left, #ff6a00 0%, #ee0979 100%); /* FF3.6-15 */ @@ -47,4 +47,4 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { /* Border light */ .specialbutton:hover { border-color: #ff7e22; -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/colour-presets/Little_Leaf.css b/styles/Milk_v2/theme/colour-presets/Little_Leaf.css index 054a74f..77d46b5 100644 --- a/styles/Milk_v2/theme/colour-presets/Little_Leaf.css +++ b/styles/Milk_v2/theme/colour-presets/Little_Leaf.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #8dc26f; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #8dc26f; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #8dc26f; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#8dc26f+0,76b852+100 */ background: #8dc26f; /* Old browsers */ background: -moz-linear-gradient(left, #8dc26f 0%, #76b852 100%); /* FF3.6-15 */ @@ -47,4 +47,4 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { /* Border light */ .specialbutton:hover { border-color: #9dd57d; -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/colour-presets/Neon_Blue.css b/styles/Milk_v2/theme/colour-presets/Neon_Blue.css index 557862a..0021ed6 100644 --- a/styles/Milk_v2/theme/colour-presets/Neon_Blue.css +++ b/styles/Milk_v2/theme/colour-presets/Neon_Blue.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #52D4FF; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #52D4FF; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #52D4FF; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#52d4ff+0,0caade+100 */ background: rgb(82,212,255); /* Old browsers */ background: -moz-linear-gradient(left, rgba(82,212,255,1) 0%, rgba(12,170,222,1) 100%); /* FF3.6-15 */ @@ -48,4 +48,3 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { .specialbutton:hover { border-color: #76ddff; } - diff --git a/styles/Milk_v2/theme/colour-presets/Nighthawk.css b/styles/Milk_v2/theme/colour-presets/Nighthawk.css index 4197945..1dcbab5 100644 --- a/styles/Milk_v2/theme/colour-presets/Nighthawk.css +++ b/styles/Milk_v2/theme/colour-presets/Nighthawk.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #2c3e50; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #2c3e50; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #2c3e50; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#2c3e50+0,2980b9+100 */ background: #2c3e50; /* Old browsers */ background: -moz-linear-gradient(left, #2c3e50 0%, #2980b9 100%); /* FF3.6-15 */ @@ -30,7 +30,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, background: -moz-linear-gradient(left, rgba(44,62,80,0.8) 0%, rgba(41,128,185,0.8) 100%); /* FF3.6-15 */ background: -webkit-linear-gradient(left, rgba(44,62,80,0.8) 0%,rgba(41,128,185,0.8) 100%); /* Chrome10-25,Safari5.1-6 */ background: linear-gradient(to right, rgba(44,62,80,0.8) 0%,rgba(41,128,185,0.8) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc2c3e50', endColorstr='#cc2980b9',GradientType=1 ); /* IE6-9 */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc2c3e50', endColorstr='#cc2980b9',GradientType=1 ); /* IE6-9 */ } @@ -48,4 +48,3 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { .specialbutton:hover { border-color: #415b74; } - diff --git a/styles/Milk_v2/theme/colour-presets/Pacific_Dream.css b/styles/Milk_v2/theme/colour-presets/Pacific_Dream.css index 2a64c54..551f091 100644 --- a/styles/Milk_v2/theme/colour-presets/Pacific_Dream.css +++ b/styles/Milk_v2/theme/colour-presets/Pacific_Dream.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #0f3443; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #0f3443; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #0f3443; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#0f3443+0,34e89e+100&0.8+0,0.8+100 */ background: -moz-linear-gradient(left, rgba(15,52,67,0.8) 0%, rgba(52,232,158,0.8) 100%); /* FF3.6-15 */ background: -webkit-linear-gradient(left, rgba(15,52,67,0.8) 0%,rgba(52,232,158,0.8) 100%); /* Chrome10-25,Safari5.1-6 */ @@ -47,4 +47,3 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { .specialbutton:hover { border-color: #154558; } - diff --git a/styles/Milk_v2/theme/colour-presets/Peach.css b/styles/Milk_v2/theme/colour-presets/Peach.css index 3597bad..d91a857 100644 --- a/styles/Milk_v2/theme/colour-presets/Peach.css +++ b/styles/Milk_v2/theme/colour-presets/Peach.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #f8a697; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #f8a697; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #f8a697; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#ffedbc+0,ed4264+100 */ background: rgb(255,237,188); /* Old browsers */ background: -moz-linear-gradient(left, rgba(255,237,188,1) 0%, rgba(237,66,100,1) 100%); /* FF3.6-15 */ @@ -47,4 +47,4 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { /* Border light */ .specialbutton:hover { border-color: #f4b2a6; -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/colour-presets/Purple_Love.css b/styles/Milk_v2/theme/colour-presets/Purple_Love.css index b2bde48..4a7093d 100644 --- a/styles/Milk_v2/theme/colour-presets/Purple_Love.css +++ b/styles/Milk_v2/theme/colour-presets/Purple_Love.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #B06AB3; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #B06AB3; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #B06AB3; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#b06ab3+0,4568dc+100 */ background: rgb(176,106,179); /* Old browsers */ background: -moz-linear-gradient(left, rgba(176,106,179,1) 0%, rgba(69,104,220,1) 100%); /* FF3.6-15 */ @@ -48,4 +48,3 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { .specialbutton:hover { border-color: #cd81d0; } - diff --git a/styles/Milk_v2/theme/colour-presets/Rose_Water.css b/styles/Milk_v2/theme/colour-presets/Rose_Water.css index 0822c21..2d43181 100644 --- a/styles/Milk_v2/theme/colour-presets/Rose_Water.css +++ b/styles/Milk_v2/theme/colour-presets/Rose_Water.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #5fc3e4; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #5fc3e4; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #5fc3e4; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#5fc3e4+0,e55d87+100 */ background: #5fc3e4; /* Old browsers */ background: -moz-linear-gradient(left, #5fc3e4 0%, #e55d87 100%); /* FF3.6-15 */ @@ -30,7 +30,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, background: -moz-linear-gradient(left, rgba(95,195,228,0.8) 0%, rgba(96,194,227,0.8) 1%, rgba(229,93,135,0.8) 100%); /* FF3.6-15 */ background: -webkit-linear-gradient(left, rgba(95,195,228,0.8) 0%,rgba(96,194,227,0.8) 1%,rgba(229,93,135,0.8) 100%); /* Chrome10-25,Safari5.1-6 */ background: linear-gradient(to right, rgba(95,195,228,0.8) 0%,rgba(96,194,227,0.8) 1%,rgba(229,93,135,0.8) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc5fc3e4', endColorstr='#cce55d87',GradientType=1 ); /* IE6-9 */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc5fc3e4', endColorstr='#cce55d87',GradientType=1 ); /* IE6-9 */ } @@ -48,4 +48,3 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { .specialbutton:hover { border-color: #78deff; } - diff --git a/styles/Milk_v2/theme/colour-presets/Sahara.css b/styles/Milk_v2/theme/colour-presets/Sahara.css index 8f5f440..4d878a0 100644 --- a/styles/Milk_v2/theme/colour-presets/Sahara.css +++ b/styles/Milk_v2/theme/colour-presets/Sahara.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #f9d423; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #f9d423; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #f9d423; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#f9d423+1,ff4e50+100 */ background: #f9d423; /* Old browsers */ background: -moz-linear-gradient(left, #f9d423 1%, #ff4e50 100%); /* FF3.6-15 */ @@ -48,4 +48,4 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { /* Border light */ .specialbutton:hover { border-color: #f4d74b; -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/colour-presets/Titanium.css b/styles/Milk_v2/theme/colour-presets/Titanium.css index e82b33d..8cf1f69 100644 --- a/styles/Milk_v2/theme/colour-presets/Titanium.css +++ b/styles/Milk_v2/theme/colour-presets/Titanium.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #859398; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #859398; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #859398; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#859398+0,283048+100 */ background: #859398; /* Old browsers */ background: -moz-linear-gradient(left, #859398 0%, #283048 100%); /* FF3.6-15 */ @@ -47,4 +47,4 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { /* Border light */ .specialbutton:hover { border-color: #9cacb2; -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/colour-presets/Warm_Sunset.css b/styles/Milk_v2/theme/colour-presets/Warm_Sunset.css index 5d68398..24b8d64 100644 --- a/styles/Milk_v2/theme/colour-presets/Warm_Sunset.css +++ b/styles/Milk_v2/theme/colour-presets/Warm_Sunset.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #4a569d; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #4a569d; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #4a569d; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#4a569d+1,dc2424+100 */ background: #4a569d; /* Old browsers */ background: -moz-linear-gradient(left, #4a569d 1%, #dc2424 100%); /* FF3.6-15 */ @@ -30,7 +30,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, background: -moz-linear-gradient(left, rgba(74,86,157,0.8) 0%, rgba(75,86,156,0.8) 1%, rgba(220,36,36,0.8) 100%); /* FF3.6-15 */ background: -webkit-linear-gradient(left, rgba(74,86,157,0.8) 0%,rgba(75,86,156,0.8) 1%,rgba(220,36,36,0.8) 100%); /* Chrome10-25,Safari5.1-6 */ background: linear-gradient(to right, rgba(74,86,157,0.8) 0%,rgba(75,86,156,0.8) 1%,rgba(220,36,36,0.8) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc4a569d', endColorstr='#ccdc2424',GradientType=1 ); /* IE6-9 */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc4a569d', endColorstr='#ccdc2424',GradientType=1 ); /* IE6-9 */ } @@ -48,4 +48,3 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { .specialbutton:hover { border-color: #5e6dc2; } - diff --git a/styles/Milk_v2/theme/colour-presets/default.css b/styles/Milk_v2/theme/colour-presets/default.css index e6ffc7e..e6ec7b2 100644 --- a/styles/Milk_v2/theme/colour-presets/default.css +++ b/styles/Milk_v2/theme/colour-presets/default.css @@ -1,11 +1,11 @@ /* Color */ -a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread { +a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, .icon.fa-file.icon-red, a:hover .icon.fa-file.icon-red, .navigation .active-subsection a, .navigation .active-subsection a:hover, .navigation a:hover, .tabs .tab > a:hover, .tabs .activetab > a, .tabs .activetab > a:hover, a.postlink, a.postlink:visited, .navbar_in_header .badge, .button:focus .icon, .button:hover .icon, .dark_base .social_links_footer a span, .dark_base h2, .dark_base h2 a, .dark_base a:link, .dark_base a:visited, .button-secondary:focus, .button-secondary:hover, .notification_unread, .topic_type { color: #00ACFF; } /* Background Solid */ -.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .topic_type, .badge, .grid_unread { - background: #00ACFF; +.pagination li a:hover, .pagination li.active span, .pagination li a:focus, .jumpbox-cat-link, .dropdown-contents > li > a:hover, a.button1:hover, input.button1:hover, a.button2:hover, input.button2:hover, input.button3:hover, a.no_avatar:hover, .jumpbox-cat-link:hover, input.button1:focus, input.button2:focus, input.button3:focus, .specialbutton, input.specialbutton, .panel .specialbutton, a.specialbutton, .scrollToTop, a.specialbutton, .dark_base .social_links_footer a:hover span, .badge, .grid_unread { + background: #00ACFF; } /* Borders Dark */ @@ -14,7 +14,7 @@ a:hover, .navbar_footer a, .copyright_bar a, .social_links_footer a:hover span, } /* Background Gradient */ -.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before { +.headerbar, body.content_block_header_block li.header, body.content_block_header_stripe li.header:before, .no_avatar, .social_links_footer, .forumbg-table, .sidebar_block_stripe:before, .fancy_panel:before, .tile_row_2:before { /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#4a569d+1,dc2424+100 */ background: #00ACFF; } @@ -40,4 +40,3 @@ a.scrollToTop:hover, input.specialbutton:hover, a.specialbutton:hover { .specialbutton:hover { border-color: #45c2ff; } - diff --git a/styles/Milk_v2/theme/colours.css b/styles/Milk_v2/theme/colours.css index 16d7f49..8aec7cd 100644 --- a/styles/Milk_v2/theme/colours.css +++ b/styles/Milk_v2/theme/colours.css @@ -4,7 +4,7 @@ Colours and backgrounds for common.css -------------------------------------------------------------- */ html, body { - color: #4C5D77; + color: rgba(0,0,0,.4); background-color: #ECF0F1; } @@ -37,6 +37,10 @@ Colours and backgrounds for links.css a { color: #676767; } a:hover { transition:.2s; } +a.forumtitle, a.topictitle { + color: #303030; +} + body.high_contrast_links .navbar_footer a, body.high_contrast_links .copyright_bar a { color: #CCCCCC !important; @@ -93,7 +97,7 @@ body.content_block_header_block .forumbg .header a:hover, body.content_block_hea } .forabg, .forumbg, .viewtopic_wrapper { - background-color: #F8F8F8; + background-color: rgba(0,0,0,.025); } .navbar { @@ -426,7 +430,7 @@ blockquote blockquote blockquote { .codebox code { color: #2E8B57; background-color: #F8F8F8; - border-left: 5px solid; + border-left: 3px solid; } /* Attachments @@ -616,9 +620,7 @@ Colours and backgrounds for buttons.css ---------------------------------------- */ .pagination li a { - background: #ECEDEE; filter: none; - border-color: #B4BAC0; box-shadow: none; -webkit-box-shadow: none; color: #5C758C; @@ -1085,13 +1087,12 @@ body.content_block_header_stripe li.header { background: #FFFFFF; } +.forumlist_grid .grid_image_container { + background: #FFFFFF; +} + .forumlist_grid .grid_colour_overlay { color: #FFFFFF; - /* Permalink - use to edit and share this gradient: http://colorzilla.com/gradient-editor/#000000+0,000000+100&0+0,0.55+100 */ - background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.55) 100%); /* FF3.6-15 */ - background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,0.55) 100%); /* Chrome10-25,Safari5.1-6 */ - background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,0.55) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#00000000', endColorstr='#8c000000',GradientType=0 ); /* IE6-9 */ text-shadow: 0 1px 3px rgba(0,0,0,0.4); } diff --git a/styles/Milk_v2/theme/colours_dark.css b/styles/Milk_v2/theme/colours_dark.css index 03d07a4..b80f44c 100644 --- a/styles/Milk_v2/theme/colours_dark.css +++ b/styles/Milk_v2/theme/colours_dark.css @@ -1,18 +1,24 @@ +/* White */ +.grid_cat_title a { + color: #CCCCCC !important; +} + + /* Dark Backgrounds */ html { - background-color: #1c262f; + background-color: #1c262f; } .panel, .panel.bg2 { - background-color: #1c262f; + background-color: #1c262f; } .forabg, .forumbg, .viewtopic_wrapper { - background-color: #1c262f; + background-color: #1c262f; } .bg3 { - background-color: #1c262f; + background-color: #1c262f; } body.content_block_header_stripe li.header, .alt_block li.header { @@ -20,7 +26,7 @@ body.content_block_header_stripe li.header, .alt_block li.header { } div.rules { - background-color: #1c262f; + background-color: #1c262f; } a.button1, input.button1, input.button3, a.button2, input.button2, .inputbox, .button { @@ -29,7 +35,7 @@ a.button1, input.button1, input.button3, a.button2, input.button2, .inputbox, .b } .panel-container .panel .inputbox, .panel-container .panel select, .panel-container .panel .pm .button, .panel-container .panel .button-secondary, .panel .pm .button { - background-color: #1c262f; + background-color: #1c262f; } fieldset.quick-login input.inputbox { @@ -54,17 +60,13 @@ fieldset.quick-login input.inputbox { color: #1c262f !important; } -.topic_type { - background-color: #1c262f; -} - .tabs .activetab > a, .tabs .activetab > a:hover { background-color: #1c262f !important; border-color: #1c262f; } .navigation a, .tabs .tab > a:hover { - background-color: #1c262f; + background-color: #1c262f; } @@ -78,20 +80,20 @@ fieldset.quick-login input.inputbox { } dl.attachbox, .codebox code, blockquote, blockquote blockquote blockquote { - background-color: #1c262f; + background-color: #1c262f; } -/* Light Backgrounds */ +/* Light Backgrounds */ /* Border color: 27313b */ -#inner-wrap { - background-color: #252f39; +#inner-wrap, .search-results li:hover, .search-results li.active { + background-color: #252f39; } .bg1, .bg2, .viewtopic_wrapper .phpbb-ads-center { background-color: #252F39; } -li.row, .forumlist_grid .grid_desc { +li.row { background-color: #252f39; border-color: #252F39; } @@ -105,7 +107,7 @@ li.row, .forumlist_grid .grid_desc { } .navigation a:hover { - background-color: #252f39; + background-color: #252f39; } .panel .inputbox, .panel .button, select, .dropdown-contents .button2 { @@ -118,7 +120,7 @@ li.row, .forumlist_grid .grid_desc { } .navigation .active-subsection a { - background-color: #252f39; + background-color: #252f39; } .cp-mini { @@ -133,6 +135,10 @@ blockquote blockquote { background-color: #252f39; } +.grid_image_container { + background-color: #252f39 !important; +} + /* Light Neural Text */ @@ -141,7 +147,7 @@ blockquote blockquote { /* Stuff */ -html, body, .copyright_bar, .navbar_footer, .content, .signature, .postprofile, .panel, dd label, .pm .postprofile, .postbody, .post:target .content { +html, body, .copyright_bar, .navbar_footer, .content, .signature, .postprofile, .panel, dd label, .pm .postprofile, .postbody, .post:target .content, .mini_label, .mini_number, .forumlist_grid .forum_description { color: #90a3c0; } @@ -154,7 +160,7 @@ html, body, .copyright_bar, .navbar_footer, .content, .signature, .postprofile, } .panel-container .panel li.row { - border-bottom-color: #323f4e; + border-bottom-color: #323f4e; } .dropdown .pointer, .dropdown .pointer-inner { @@ -181,7 +187,7 @@ li.row strong, .postprofile strong, .button .icon, .button-secondary, .inputbox, a.jumpbox-cat-link, th a { - color: #FFFFFF !important; + color: #FFFFFF !important; } @@ -394,4 +400,4 @@ ul.cplist, .forumlist_grid dl.row-item { .pm_unread { background-image: url("./images/icons/png/icon_unread.png"); /* IE8 + below */ background-image: linear-gradient(transparent, transparent), url("./images/icons/svg/icon_unread.svg"); /* Modern browsers */ -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/common.css b/styles/Milk_v2/theme/common.css index 634cebf..2e055cd 100644 --- a/styles/Milk_v2/theme/common.css +++ b/styles/Milk_v2/theme/common.css @@ -132,7 +132,7 @@ a:hover { text-decoration: underline; } .logo { display: block; width: auto; - padding: 0; + padding: 0; } .logo:hover { @@ -167,21 +167,21 @@ a:hover { text-decoration: underline; } float: right; } -body.navbar_i_header .site-description {margin: 50px auto 100px;} +body.navbar_i_header .site-description {margin: 100px auto 100px;} body.navbar_i_header .site-description.logo_left {margin: 100px 50px 100px;} body.navbar_i_header .site-description.logo_right {margin: 100px 50px 100px;} body.navbar_o_header .site-description {margin: 50px auto 100px;} body.navbar_o_header .site-description.logo_left {margin: 50px 50px 100px;} body.navbar_o_header .site-description.logo_right {margin: 50px 50px 100px;} - + .site-description h1 { margin-right: 0; margin-top: 30px; } .site-description p { - margin-bottom: 0; + margin-bottom: 0; } /* Round cornered boxes and backgrounds @@ -214,6 +214,10 @@ body.navbar_o_header .site-description.logo_right {margin: 50px 50px 100px;} clear: both; } +.forumlist_grid .forabg { + margin-bottom: 45px; +} + .panel { margin-bottom: 15px; padding: 15px; @@ -491,6 +495,11 @@ a.header-avatar span:after { padding: 5px; } +ul.search-results li { + width: 200px; + padding: 5px; +} + .jumpbox { margin: 5px 0; } @@ -790,6 +799,11 @@ fieldset.fields1 dl.pmlist dd.recipients { margin: 0 0 30px; } +.jumpbox-return { + position: relative; + z-index: 3; +} + .action-bar.bar-bottom { margin-top: 30px; } @@ -842,7 +856,7 @@ fieldset.fields1 dl.pmlist dd.recipients { } .pagination li a, .pagination li span { - padding: 2px 5px; + padding: 4px 7px; } .pagination li.active span { @@ -868,14 +882,14 @@ fieldset.fields1 dl.pmlist dd.recipients { } .pagination .arrow a { - padding: 2px 0; + padding: 4px 3px; } /* Pagination in viewforum for multipage topics */ .row .pagination { display: block; margin-top: 3px; - margin-bottom: 3px; + margin-bottom: 3px; } .row .pagination > ul { @@ -961,7 +975,7 @@ fieldset.fields1 dl.pmlist dd.recipients { .copyright { padding: 5px; text-align: center; - + } .titlespace { @@ -979,7 +993,7 @@ fieldset.fields1 dl.pmlist dd.recipients { div.rules { margin-bottom: 30px; padding: 15px; - border-left: 5px solid; + border-left: 3px solid; } div.rules ul, div.rules ol { diff --git a/styles/Milk_v2/theme/content.css b/styles/Milk_v2/theme/content.css index 5512065..2feb61f 100644 --- a/styles/Milk_v2/theme/content.css +++ b/styles/Milk_v2/theme/content.css @@ -2,7 +2,7 @@ ---------------------------------------- */ ul.forums, ul.topics { - padding: 10px 10px 5px; + padding: 10px; } ul.topiclist { @@ -49,7 +49,7 @@ ul.topiclist.missing-column dt { } ul.topiclist.missing-column li.header dt { - margin-right: -425px; + margin-right: -425px; } ul.topiclist.two-long-columns dt { @@ -57,7 +57,7 @@ ul.topiclist.two-long-columns dt { } ul.topiclist.two-long-columns li.header dt { - margin-right: -330px; + margin-right: -330px; } ul.topiclist.two-columns dt { @@ -100,7 +100,7 @@ ul.topiclist dfn { } .list-inner img { - max-width: 100%; + max-width: 100%; } .forum-image { @@ -111,14 +111,14 @@ ul.topiclist dfn { li.row { border-bottom: 1px solid transparent; - padding: 15px; - margin-bottom: 5px !important; + padding: 12px; + margin-bottom: 0px !important; } li.header dt, li.header dd { line-height: 1em; border-left-width: 0; - margin: 14px 0 14px 0; + margin: 14px 0; padding-top: 2px; padding-bottom: 2px; } @@ -165,6 +165,7 @@ dl.row-item { dl.row-item dt { background-repeat: no-repeat; background-position: 5px 95%; /* Position of topic icon */ + background-size: 12px; } dl.row-item dt .list-inner { @@ -172,7 +173,7 @@ dl.row-item dt .list-inner { } dl.row-item dt, dl.row-item dd { - min-height: 35px; + min-height: 43px; } dl.row-item dt a { @@ -246,7 +247,7 @@ dd.extra, dd.mark { /* Merlin Framework Adjustment */ .postprofile_Left .postbody { - float: right; + float: right; } .postbody h3 { @@ -439,7 +440,7 @@ blockquote { margin: 30px 1px 30px 25px; overflow: hidden; padding: 15px; - border-left: 5px solid; + border-left: 3px solid; } blockquote blockquote { @@ -788,4 +789,4 @@ table.fixed-width-table { .postbody .content::-webkit-scrollbar-thumb, .topicreview::-webkit-scrollbar-thumb, .post_details::-webkit-scrollbar-thumb, .codebox code::-webkit-scrollbar-thumb, .attachbox dd::-webkit-scrollbar-thumb, .attach-image::-webkit-scrollbar-thumb, .dropdown-extended ul::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, .3); border-radius: 3px; -} \ No newline at end of file +} diff --git a/styles/Milk_v2/theme/fonts.css b/styles/Milk_v2/theme/fonts.css index c910821..fe8cc6b 100644 --- a/styles/Milk_v2/theme/fonts.css +++ b/styles/Milk_v2/theme/fonts.css @@ -36,9 +36,14 @@ a.forumtitle, a.topictitle {font-size: 1.2em;} .pagination li a {font-size: 0.9em;} .contact-icons {font-size: 0;} .topic_type {font-size: 0.9em;} -.forumlist_grid_title {font-size: 1.2em;} +.forumlist_grid_title {font-size: 1.4em;} .grid_unread {font-size: 0.8em;} li.row dd.simpleposts span {font-size: 1.5em;} +li.header dt {font-size: 1.2em;} +.tile_title {font-size: 1.3em;} +.mini_number {font-size: 1.2em;} +.forumlist_grid span.forum_description {font-size: 14px;} +.forumlist_grid span.grid_cat_title {font-size: 2em;} @@ -59,8 +64,7 @@ table.info tbody th {font-weight: normal;} .notification_list p.notifications_title strong {font-weight: 500;} .button {font-weight: normal;} ul.topiclist dt {font-weight: normal;} -li.header dt, li.header dd {font-weight: 500;} -li.header dt {font-weight: 500;} +li.header dt, li.header dd {font-weight: 300;} dd.posts, dd.topics, dd.views, dd.extra, dd.mark {font-weight: 300;} li.row dd.simpleposts span {font-weight: 300;} dl.faq dt {font-weight: 500;} @@ -90,10 +94,15 @@ a.button1, input.button1 {font-weight: 500;} input.button3 {font-variant: small-caps;} input.disabled {font-weight: normal;} .jumpbox-cat-link, .jumpbox-forum-link { font-weight: 500; } -a.forumtitle {font-weight: 500;} -a.topictitle {font-weight: 500;} -a.lastsubject {font-weight: 500;text-decoration: none;} +a.forumtitle {font-weight: 400;} +a.topictitle {font-weight: 400;} +a.lastsubject {font-weight: 400;text-decoration: none;} .postprofile a, .postprofile dt.author a {font-weight: 500; text-decoration: none;} .search .postprofile a {font-weight: normal;} .username-coloured {font-weight: 500;} .grid_unread {font-weight: 300;} +.tile_title {font-weight: 600;} +.forumlist_grid .forum_description {font-weight: 300 !important;} +.mini_label {font-weight: 400;} +.mini_number {font-weight: 600;} +.grid_cat_title {font-weight: 600;} diff --git a/styles/Milk_v2/theme/forms.css b/styles/Milk_v2/theme/forms.css index 4167144..dd0705d 100644 --- a/styles/Milk_v2/theme/forms.css +++ b/styles/Milk_v2/theme/forms.css @@ -347,7 +347,7 @@ input.button3 { background-image: none; } -input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"] { +input[type="button"], input[type="submit"], input[type="reset"], input[type="checkbox"], input[type="radio"], .search-results li { cursor: pointer; } diff --git a/styles/Milk_v2/theme/icons.css b/styles/Milk_v2/theme/icons.css index 411feca..dc9780e 100644 --- a/styles/Milk_v2/theme/icons.css +++ b/styles/Milk_v2/theme/icons.css @@ -5,7 +5,7 @@ /* Global module setup --------------------------------*/ -/* Renamed version of .fa class for agnostic useage of icon fonts. +/* Renamed version of .fa class for agnostic usage of icon fonts. * Just change the name of the font after the 14/1 to the name of * the font you wish to use. */ diff --git a/styles/Milk_v2/theme/icons_forums_topics.css b/styles/Milk_v2/theme/icons_forums_topics.css index 62fa722..33273ef 100644 --- a/styles/Milk_v2/theme/icons_forums_topics.css +++ b/styles/Milk_v2/theme/icons_forums_topics.css @@ -216,4 +216,211 @@ .pm_unread { background-image: url("./images/icons/png/icon_unread.png"); /* IE8 + below */ background-image: linear-gradient(transparent, transparent), url("./images/icons/svg/icon_unread.svg"); /* Modern browsers */ -} \ No newline at end of file +} + + + + + +/* ------- New Forum & Topic Icons (Pulsing) ------- */ + +/* Switches */ +.css_icons_enabled dl.row-item {background-image: none;} +.css_icons_disabled .forums .row-item:before, .css_icons_disabled .topics .row-item:before, .css_icons_disabled .pmlist .row-item:before, .css_icons_disabled .cplist .row-item:before, .css_icons_disabled .forums .row-item:after, .css_icons_disabled .topics .row-item:after, .css_icons_disabled .pmlist .row-item:after, .css_icons_disabled .cplist .row-item:after {display: none;} + + +.forums .row-item:before, .topics .row-item:before, .pmlist .row-item:before, .cplist .row-item:before { + font-family: FontAwesome; + color: #FFFFFF; + text-align: center; + position: absolute; + left: 11px; + top: 7px; + width: 32px; + height: 32px; + line-height: 32px; + border: 1px solid rgba(0,0,0,0.1); + color: rgba(0,0,0,0.1); +} + +/* Adjustments for dark UI */ +.dark_base .forums .row-item:before, .dark_base .topics .row-item:before, .dark_base .pmlist .row-item:before, .dark_base .cplist .row-item:before { + border: 1px solid rgba(255,255,255,.15); + color: rgba(255,255,255,.15); +} + + + +/* Rows with 'last topic subject' have an extra 10px padding top, so we need to account for this with bigger top value */ +.forums .row_has_subject .row-item:before { + top: 17px; +} + +/* Spotted topics */ +.global_read_mine:after, .global_read_locked_mine:after, .global_unread_mine:after, .global_unread_locked_mine:after, .announce_read_mine:after, .announce_read_locked_mine:after, .announce_unread_mine:after, .announce_unread_locked_mine:after, .sticky_read_mine:after, .sticky_read_locked_mine:after, .sticky_unread_mine:after, .sticky_unread_locked_mine:after, .topic_read_mine:after, .topic_read_hot_mine:after, .topic_unread_mine:after, .topic_unread_hot_mine:after, .topic_read_locked_mine:after, .topic_unread_locked_mine:after { + position: absolute; + top: 8px; + left: 35px; + font-family: FontAwesome; + content: "\f111"; + font-size: 6px; + width: 6px; + height: 6px; + border: 2px solid #ffffff; + border-radius: 6px; + color: rgba(0,0,0,0.1); + background: #FFFFFF; +} + +/* Adjustments for dark UI */ +.dark_base .global_read_mine:after, .dark_base .global_read_locked_mine:after, .dark_base .global_unread_mine:after, .dark_base .global_unread_locked_mine:after, .dark_base .announce_read_mine:after, .dark_base .announce_read_locked_mine:after, .dark_base .announce_unread_mine:after, .dark_base .announce_unread_locked_mine:after, .dark_base .sticky_read_mine:after, .dark_base .sticky_read_locked_mine:after, .dark_base .sticky_unread_mine:after, .dark_base .sticky_unread_locked_mine:after, .dark_base .topic_read_mine:after, .dark_base .topic_read_hot_mine:after, .dark_base .topic_unread_mine:after, .dark_base .topic_unread_hot_mine:after, .dark_base .topic_read_locked_mine:after, .dark_base .topic_unread_locked_mine:after { + border: 2px solid #252F39; + color: rgba(255,255,255,.1) !important; + background: #252F39 !important; +} + + + + +/* Set the icons */ /* Megaphone */ +.global_read:before {content: "\f0a1";} +.global_read_mine:before {content: "\f0a1";} +.global_read_locked:before {content: "\f0a1";} +.global_read_locked_mine:before {content: "\f0a1";} +.global_unread:before {content: "\f0a1";} +.global_unread_mine:before {content: "\f0a1";} +.global_unread_locked:before {content: "\f0a1";} +.global_unread_locked_mine:before {content: "\f0a1";} + + /* Megaphone */ +.announce_read:before {content: "\f0a1";} +.announce_read_mine:before {content: "\f0a1";} +.announce_read_locked:before {content: "\f0a1";} +.announce_read_locked_mine:before {content: "\f0a1";} +.announce_unread:before {content: "\f0a1";} +.announce_unread_mine:before {content: "\f0a1";} +.announce_unread_locked:before {content: "\f0a1";} +.announce_unread_locked_mine:before {content: "\f0a1";} + + /* External link */ +.forum_link:before {content: "\f08e";} + + /* Speech Bubble */ +.forum_read:before {content: "\f068";} +.forum_read_subforum:before {content: "\f068";} + + /* Check */ +.forum_unread:before {content: "\f00c";} +.forum_unread_subforum:before {content: "\f00c";} + + /* Pin */ +.sticky_read:before {content: "\f08d";} +.sticky_read_mine:before {content: "\f08d";} +.sticky_read_locked:before {content: "\f08d";} +.sticky_read_locked_mine:before {content: "\f08d";} +.sticky_unread:before {content: "\f08d";} +.sticky_unread_mine:before {content: "\f08d";} +.sticky_unread_locked:before {content: "\f08d";} +.sticky_unread_locked_mine:before {content: "\f08d";} + + /* Right arrow */ +.topic_moved:before {content: "\f061";} + + /* Envelope */ +.pm_read:before {content: "\f0e0";} +.pm_unread:before {content: "\f0e0";} + + /* Bar */ +.topic_read:before {content: "\f068";} +.topic_read_mine:before {content: "\f068";} +.topic_read_hot:before {content: "\f068";} +.topic_read_hot_mine:before {content: "\f068";} +.topic_unread:before {content: "\f068";} +.topic_unread_mine:before {content: "\f068";} +.topic_unread_hot:before {content: "\f068";} +.topic_unread_hot_mine:before {content: "\f068";} + + /* Cross */ +.forum_read_locked:before {content: "\f00d";} +.forum_unread_locked:before {content: "\f00d";} +.topic_read_locked:before {content: "\f00d";} +.topic_read_locked_mine:before {content: "\f00d";} +.topic_unread_locked:before {content: "\f00d";} +.topic_unread_locked_mine:before {content: "\f00d";} + +/* Forum link and moved topics */ +.forum_link:before, .topic_moved:before { + border: 1px solid #0090f5 !important; + color: #0090f5 !important; +} + +/* Unread States */ +.global_unread:before, .global_unread_mine:before, .announce_unread:before, .announce_unread_mine:before, .forum_unread:before, .forum_unread_subforum:before, .sticky_unread:before, .sticky_unread_mine:before, .pm_unread:before, .topic_unread:before, .topic_unread_mine:before, .topic_unread_hot:before, .topic_unread_hot_mine:before { + animation: UnreadPulse 1.4s infinite; + border: 1px solid #84bd00 !important; + color: #84bd00 !important; +} + +/* Unread (dot) States */ +.global_unread:after, .global_unread_mine:after, .announce_unread:after, .announce_unread_mine:after, .forum_unread:after, .forum_unread_subforum:after, .sticky_unread:after, .sticky_unread_mine:after, .pm_unread:after, .topic_unread:after, .topic_unread_mine:after, .topic_unread_hot:after, .topic_unread_hot_mine:after { + color: #84bd00 !important; + background-color: #FFFFFF; +} + +/* Override unread locked with red */ +.global_unread_locked:before, .global_unread_locked_mine:before, .announce_unread_locked:before, .announce_unread_locked_mine:before, .forum_unread_locked:before, .sticky_unread_locked:before, .sticky_unread_locked_mine:before, .topic_unread_locked:before, .topic_unread_locked_mine:before { + animation: UnreadLockedPulse 1.4s infinite; + border: 1px solid #bd0000 !important; + color: #bd0000 !important; +} + +/* Unread (locked) states */ +.global_unread_locked:after, .global_unread_locked_mine:after, .announce_unread_locked:after, .announce_unread_locked_mine:after, .forum_unread_locked:after, .sticky_unread_locked:after, .sticky_unread_locked_mine:after, .topic_unread_locked:after, .topic_unread_locked_mine:after { + color: #bd0000 !important; + background-color: #FFFFFF; +} + + + +.forum_link { + +} + + +/* Box shadow for unread pulse icons */ +@keyframes UnreadPulse { + 0% { + -moz-box-shadow: 0 0 0 0 rgba(132,189,0,0.4); + box-shadow: 0 0 0 0 rgba(132,189,0,0.4); + -webkit-box-shadow: 0 0 0 0 rgba(132,189,0,0.4); + } + 70% { + -moz-box-shadow: 0 0 0 8px rgba(132,189,0,0); + box-shadow: 0 0 0 8px rgba(132,189,0, 0); + -webkit-box-shadow: 0 0 0 8px rgba(132,189,0,0); + } + 100% { + -moz-box-shadow: 0 0 0 0 rgba(132,189,0,0); + box-shadow: 0 0 0 0 rgba(132,189,0,0); + -webkit-box-shadow: 0 0 0 0 rgba(132,189,0,0); + } +} + +/* Box shadow for unread pulse icons */ +@keyframes UnreadLockedPulse { + 0% { + -moz-box-shadow: 0 0 0 0 rgba(189,0,0,0.4); + box-shadow: 0 0 0 0 rgba(189,0,0,0.4); +-webkit-box-shadow: 0 0 0 0 rgba(189,0,0,0.4); + } + 70% { + -moz-box-shadow: 0 0 0 8px rgba(189,0,0,0); + box-shadow: 0 0 0 8px rgba(189,0,0, 0); + -webkit-box-shadow: 0 0 0 8px rgba(189,0,0,0); + } + 100% { + -moz-box-shadow: 0 0 0 0 rgba(189,0,0,0); + box-shadow: 0 0 0 0 rgba(189,0,0,0); + -webkit-box-shadow: 0 0 0 0 rgba(189,0,0,0); + } +} diff --git a/styles/Milk_v2/theme/images/comment.png b/styles/Milk_v2/theme/images/comment.png new file mode 100644 index 0000000000000000000000000000000000000000..3993adb55d1d66dd07b82b5e05121f3ef46cff55 GIT binary patch literal 5558 zcmV;n6-nxeP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000W%Nkl*d!vs?nWi0RgS z0DHO)(*JKH17DEKKhXE`eLpF)UyyK2*9O2N5u$dw!3GV`0dNgqWboP}&B!$wW=n!D z$_s=tKen*48Afx9s3q1f6n)RnV;~K!vDl83EAix;F zhlrW}3}7y~@***y!J53pmp#l0d>lb*<%=O6V8`Kv)1j!_UJ%BG|lD&-0pb4pc z5h8u10jPC8UGjG7*m`))G+K!)Mc_y>z6hOqXbv_Sak#hrLucgyx(H|Vj#XC23GtJb zJ{Q53aw9~bOQD{lxWik#-JNR+R#p12Su6oJ8Y10QZ6KP8v>srLaC-C!K`x*1HZr=T zC2?j`7@URx9)R~6A@q~&9U9}`q$Sd|X^he=0aNAoeE{FlfNI;AXe;_?f?$87(gf&| z`G&i+o+Zy9h`F@O&59r2yb5;4X@Qben z9&>;znFju~>3;~83HnZ}Nj~9&?bgMvszDE5s;zK>o=9HNe zh(mxL6Cg7z&y1~g1n4NQ-JzL#{aIlZg8(jq+{-nRH^Vp?*P9YR#)fT}3Y#pd4Qi95)2UDku8(}N48&T91LwC3T@Ps`ve&zkxU8TFaa`$e`bu;*WPNp z#tl-|btWYMBYQXo9^+Oaj!PuSodBHj&EMcAW4uAQu3&)hCSC3X;2y)->o3z~^%3Dr z;xwsEOn>QUs8|{K695PwvG)+J)XJ0q2PQz~Xq_43Q`jLmV4_9^US0$+OY@3MNG_BLWC7up*npuF#GXJE|YD&vr}%M?-+L z2Wz%8L9Y>%?mJm~0P!J*3IVt*JU;r0fp$p0yXpY=UD9S97#=~7;{nv{QxQ+|s3S&a z#x-e3DGPJs)NmXEY!#-uybL6oscLzB7H2E=2xkVptO=m|up_oZMQS3IYuBe}E-gfmi%FgghLRhVb^ z_YX+Wdnn25Rh9pQ#h?+cHBnXRd6XmscvjYz7E%->Gz49ZUYh0bK34$#2JjaQPa7p6 zz)|D!uUQM6gxVBpjqH!sc?c?n#WNb-C#~Cch&81GQ?E)~+Z5h&TJL5hb4*M1nqoJ$d;-nHvP@ z-XglGBq}q@GI_Jqh(Z@ZLxZ|62P3-AKHckwg5Td$mH;1yY38i6cXLgcr9SJ5iGrUK$Uf1<|R`6#TY9bCJxkE5*1qz74qi{rilj*! z;b$P6!WOSpw`KQCauBXFSR%n0!zy@y0o`mznYBeFmKF$VA8hK5KGArpL{&yM6W~Pz2yFu2scfx^UVLGnIzw{S^|qCKnFp|R8)!B zhFqHNy!==hl;05?fv$7g`Z0oY1*-Ayvdl>od7dxo`FIDqsc(pGmZ1KB55Q;CGnFl} ze7Zw6_sI50d9DQT4SqfY@WtS!en9`EtwmVoQckvW6WIJTvbj z-lm5|cC1H#yQ<>w2Kv)Ix5)81jd^+iAV}$6k@05a!m=>XG{Q}8$s4RIX8bmSrVcWe zwDcv;@)_ASX99>Bn#Zh+QprHDZTqW2QGyV)GLgTg7GVaqEg}lY%OyVp_$NX~OlU@3 zRCGBgjJQ>A>$0KnQKybQ@(?{RYD)kyTkc69?jqJ#IWp;kn^+VQ1r&`Ht(y}Po-VDW z3rUb(OQaEd|7-FjNtUX-^bHdrh29X+Mn^I1rQ-R9N;oOHc8hv}qx8F?zQB{NmNb4F zde1o%z@BActRpMjSC7xD^sh`q~3l%5Prr^9^u>{c5|TNG#q< zVz5VFr>QXZp|5oqLI3D?Q*FTn$T@u6CPx# literal 0 HcmV?d00001 diff --git a/styles/Milk_v2/theme/images/hex.png b/styles/Milk_v2/theme/images/hex.png new file mode 100644 index 0000000000000000000000000000000000000000..8cbe5cd188ad55a163a5e910b5d50c5340c4399b GIT binary patch literal 78712 zcmX6^1z1$w(_f{#OF#)}q#Nm!SZP>FlOq(3o?k(Cw$Unz_>d!9tSn?OzunQ|~I3@IkYKZ-=19XkT^584)O zPR#e*u!!ONb?;o;*|zJQ(Wm-3@!hg>c=1t3ZJ7yj^{jGCY6cBA+B=X5)3==|kU#t;#rp-wAc25r5+Z{0z&o% znGDj?dxC;eK*aKAy6^w8Rp9Tk0-Q>zdEfk2ST4W-{hc$Kt}e%GX2b_FHe!L#FF&VB za`b#nq2LMN!&^HCGR=K1;Ut*t*webNS> zhjo3QEPFn6=|0-s`n`X+zFh0rcpJcD6rg~7v)1$bLM5MSEDj^+%hFD)!b2n0^8@u1 zUEhZ<&3dfFo9cwlF|w&q=REmz;nHy|zZfQ;%{Erq?~%k;`9W1S;xD{m?~05}k*<`P z@b#cw8`mJvS*v6BG&4Gqzt#8kF^}g{iARMj29UqShd5^t$XNC*ht_bd!~i-7B%2k$ zS|vq!(M`_Yg-X?pveb?BU?LDC{kE@18ebaI%%94|grzJ{nmJ^&ikj7gb6S#`uS?x3 zB;E;^qer_5SIi0T?lXEuH*;G62C~#3I?-p^g|HW2BJ}8E(8*GQZ)m#}kqIN;(hP+W ztJ5jN_!YS|BD83<6{*j}TwV%?8p^l8LOrPLe!f+WLrsf|nKUC*wO%hJZPdaGO@3R-D z@hQHdj~`kvv#miBPGF~D8w}opZ}o2RZc%R0o*7`mzeqag-DqwwYYf{cQEcOH^KGM= z|KyR<&P~-=F3Q#-;E&apF3)bzs8kOvBI0vP6(0Rg`awCrJSTDLl@*!QwRPnlw1r?f z@ijPkTz7J0UtuqK59z`K8z+S1`#_i_GesIX8o4Ef2YKaBl>&;XNQwb1ETh`l9duH?Q`uBt=M8?P2UQ6ZC=gIVvOmeQtcAB z+My<;re(2cQD})}k)xJGo*(2f92L^5()&>+Pd%&p(`H*g4VEcIttUIJElz2OTL6C_ zWA*5~k2`DY&qwOkNU@UQY+)H*C0^ZHjq?Nx3AD|h&Nt~$Fvc!(Ve+|O#0v2#%LWT& z0iQ}Ux4EHhNm6o>Ua4ZKda1%;yFkTpA-tent`%}0fGahi#AL{%U>S=*f$wV0Yc3aJ z7LuxpiCk82l-TA|X1B_EbUGBC{LJVu_RmmpEL{28zI#XI%lWAFXn$9DserAAT8sS_ zbrBmu{{9!gv*UYe&Vj|h>M};Xk}~<96F(=f2f>;r-sjH9N6X_yS@#=mzTLF%x9`to zL}jF9R8~DuJxSG2Z7yIb5LFRX85sRNnln0^!k;F_J;$?~wwpGWw%TZ-@2St;P}I<5 z{-I_|zW{R5(B=@VFAT}o)7Cetl`n^vGt9P@w-yo<{l|1JMXepEX=FZA!tC%(B__`*~PoxN_hKN3u9a8fE|TVEdL5^wQaA z-D~m^o>rUIb6m7oc_MIPeG#FRXY?ACs znkDx~;mUVP{H)?795(M41Y7u8B>FilAirny;CdhIl&OR{SSth^>^fE-j?Y6k;2T(* z-ef;H2aTM*W+Qqof(uEDISAQBk|b5az(NWCN#U~=kw!6`5qU7gV1DhP?y;ofoDi4@ z`y*q>`Wk$u$g1iUcLZzW|N8b9Z$A5Wa}ZPUk2Vz?mE|;%4ANA08haiwk#_Fyaj+lG z(j~O2@eP&-mOB>iBW32nHBY}BA{#khC!!76*8V6%fxN?PkS^HM(r2DyMXRwi*R|*z z4IdUxD$QUUJ^o!gy!b;f{WSCWn6QU%J+2`?L|OM8wcbv9nT>GGd*`oOD6gDhk40!n=;gKxHDxbp{}^Jui0$OV$x!NXXRan0d7)B@=h|Y1J3+H z9nPvw-SOp>+#+Z4DDz_L_Xe5f+|Kt+ZRUkTh*41qtvsy@tvfA&lgZ`!&vQ2p6DO43 zZC89pGm8do*N@^u9gEs8v{h#;X3XzD+}B=9RD_r8-z44J8taMbUeXNJ>KC6;Alsu_ixZU$$s71zs6X-evKot;2z~&wvIOS z#+}-dn$t!)^(<9BO*8f0;EO@a$KT=;vj;0)4+@KK@Y4C-L%u4VYYka1><3Q8Tb_+Y z!4u)WejK+;CW|=@-n*uVRU16V(-wT_`lQ@*%|>tE96*_jMsvE}x2FURX&*O#lL z%YH6QkBE`hc@L(O^0tp{pDrYirRHUpLuVumo|gWcE`77<^2j=$SW>t~4gNm%1iOsI zlR=41i5&^S2|3IV5*HTUkZ^h2e<+k0GaF;fAbZMr8mS;7<@CFmIh;dG{G7;6K1+`8 zwD-w>Jm@;4s9fyt>3`iZYyh&rKsG$l1c`*PH=ywq4_8Iuz2Z7wUK%fH?5J==F2t?)>_vx2B z=mm4`2U#gC&xN+fc^9gYnmP{u+=2~2slXXt0n&CTumh=07kzMfiKT)g=2zj5Cy zmu8i3PY)>qX`>gL1FZ zRI&M2$k)$Lf9#Co-z)f3r+Ry3?v4Pmpd#?2Q-%J2ls!KBo~MkBjqUI6Ti^ZN9Ju)V z7nZU9Z+h{}!q(Q-{ii2C{c@dsVMC7O{li0BFHg^(4h|0N5USV#>)Lr0V2=G&_2%R2 z`-}O1)3`L}S%%paTBkle-0}jeavR(H_Y|-YV`Jk<(Y)(TsEBH(-=mUw!Rh_ooyg>C#=mT*IRFD@_n%XLcs_i7&>6*s@sg6S)o#^hwO z`<3&retsDaj*f++7QD+VD+R0HfM)@MG#oyC`t*-cvC_<1oV@eDN& zv7;8fxxEz@laTnBHd;_;t$cI@3_^vd%1)o}?oxHqMlHO)eajRV7jNNw*d5EXuGd%n z$F1F6%WH_SNos+{R|1~ZL%)B*0jQftH+w^TJeDc3U2B;2PYmbhwfBoFtE>N`Y8E@o`z+{6EzJ82!Ij_+EY|@bmROX2s>% zhV#NDErnW#)o29=zS2YjOKop!OQ>mTZ->tw)|V3vzPtAo!aY%71bC7>nYF%$?q?`m z2GEp!4HX&=ysq48Fs>|oBjE@AMtQ2jRSoj6ya*6V0WhZL9z5pW3J0hg zsqJWPPB}R}EddL)CS*-b=oLYd9hQ(vMO0TgmXr=eDxiX>4cw;)9IMl$% zhp`jR)}GI<&IankySuw}tEYv41gu+^-Eo+tOLA0@9{`4z&)KrIXykXcwx&gYWrzaQ zO!%xcsCwC<6%`~W8-9K7t1B!aE^bkHD60(ctT*NY;L1O>gnD=gDjX$h>Q&B7-TE}( z5KQQB@-V$xvJ*IGa2x_SXy4M=$%%tvDdHvd1LZVrXajh#1$fOr^%&XKFeXIYyEH?$ z{lOdL`gggfJ3_$>F$wol`B^P*mMj%;2akdKaXmM7fem|j=><%d>2~fT{(ShJE6Bsc zBcEMdLZT25)@_u6nKMAkKa~XJo&Oiu!2h=BME&=7&Fvi>0-e{ue!K&8=;Y+YqJ3{j z1@7P`QKgz2qjhXT;<>uCq|&;~ffMv}=b$k-`$=6;VZx{ zWEUBbAZF z7UhIH^w+Qt%KZuMrIJMVWvilR6QT!8zH@&o6rBN%KPTRGw6*=-H;TIAlJ&Z6mIOmD z0qJ+{5t>R3@0-!KX}V?O^QkAXa-WuB#%62o25AVRMNcsh8k|kUshES9WrQe{$H<=m zojY-^PXKd%;$xjbfyDXNMFrDijkc9q4sq>;)*&e13jG)9(_Jl6C@%&H6<#Srz{L)= z^S^fw61)H-^%O@*Ar}<|qYRKrNF#D~?JQlH^~iA5uF--NEe-Mv&5nP~@w(IGzIS33 z5NcRP)oMq0XT{?DmohGzRNSw&~a3K38hG;?=PJsZF z7clPzAt?C+gBfGH&3!WmGDVv+aq`>mg$6IZ+V@;&LYEx`+uPd{QB45*p*>bgQk*%q zd;9gEV*)=;)h4L-)HQ17*5@_HrV*tted7Uy&XHgGp?%rmdTt(8{>|5SwBPY9mVy3) z{gBjHmvbBVTh#qCV2vOS3zX9y@`C){n|4$(VPHtL zR4HVNCHngBV5jY?NLJxKQT?H^5}h*r{{J>NO)D&~=r#c}Tc}MR^5fJ4c~=O3fPBNZ zIV37jF8(5D%=mSDT+V=%9;SIk7x(z^kPhsLT|(_K z{4W>d7<2f33Rl_vKNz#<8)t0H`LSUrF@RQYR!%zT&}|wm#W7k!M?*b&Z-iVnqn6p> zr+|HfZ)cbfCXji%*vc(0RohYzdbKxxQvsVVrq{C~X}(wDI(2P6mW5eWgj;o}CHB#}gjE6XsR+nt z(uDpjx~J1b_M24$mm9#cxplOB+{3?rU9psY-<>y?De>yM6hD(6<1qQl21s7;k?7mWD59sI>LFd)UI;T#O{@tbzft{2M@zY#$SQT&-eM z6z|oAw%{zNzG!rZzdhqI%*QtV`2j5R=xMfssUJE;ZLU$z|ZgB(qiQ-tT^Tx%G!4@@t&j-`4p{`%^jAG*uTpyzRn#c z7ZO~Nh)0Q6OyKk$%OOiF@5vzG(t0s9_}F#pDv-!N{u$MTRWvM}mnnzBSDDmSV*<8^ zi6ZSZ4fBR5rUwjgS)#7}Q*G)56>=a_5P2QzI-Djp(g~4s;44pOz5{riMCluyan5jO zl8Kr>vXXLao|CrH8jms&Iz+|U$@0{i{zgP9L?M2OJE$$vLKgCY$W$dYLk?zEEp(N% zN*e@0D;@o`MGNgaUNyKD`8=C&Ja8v`WRSGwlKdslbX|=j(*H!^?s5# zt>797xNyp+y5!pY?<9;8+z*j1?ZBcx#a6`U;_moRHSU`C=FJ-*KJE3{hp!fl{yl>K z6zU!KRd|LS^-gdz9(jhI-!26SP23}_xMP^SEqNSu9gwR<3~RNRphMMn_*ONJ?&6uP z?es5$0P|V-cddk}S55J<3{1*#%wPVcWecph$3wAFq5IM#GiWfqXn~@52BT1k1&V!} zinracV)h}S7l;5K7S${)H8Z)*EdNGZ!u!dHm=Hx3w&-vSQMm1#Z@}z4fxo|4-(Z&L zw^NRfEiSHsm`ZQJSKWcMql?CxpU{+{zZa;5-3ESaB6{ktWt5G<6sVTHXZD9jKPc0V zE?Uw(`cZ|EkWPBC&evC6vAO7<%*L`vWtXQ_eM6K1a}m|7Gqk?5)BhUe6soF(##4jx zdxT&n`=;Coc@(oqHP-HhZFz-PQp+lTa**;4dnd~U>Pp6MI%6ALC0YtKFUx?))N~tW z*n#w=iYJLZmpp(rd~8Ey<8yqlHH#d5FKdL>1GV6pdw&|QOp$*$M~nY(VC1W4LCfN9 z%zQMD0Iw4BiMT<0&W*lBlfs~=v)BvuvXQ3}!7-hb$^zKiYdiA=7Xr8!*I1}yesOy%?L zYG@ufXNx3FxAV&UQQoGv(Ep9uJUty?;If%+WGbXl10{P`YaD&fzFlPO^j%8owHOlL zOTXmAK`;KZi55ZnoCop3y!pk9f;UP(a(w$Tmb|)x#Y}~2ti^1E>UB4TG>%M^E!sF6 z=xToXIy)i#BItzHfKij2 zf~l5#zHZh<>Jkk;H|cQc!K&vchmE?PbNmfKq1 z1`1t~>u_VPizzhqerr$m=;T~3b1BQBbR38cr`_6wTnBV~fE3eq zXR2173iS}MwF{@$))(C#+PsMOrF#{SV%bJWt+0!mnFy*L1$~s7HktO1A)9+rnY}15 zYl9xiCDBADkel(W9J|+k(co}Z65#7$+f?~LPibm4f8->TkTys#DiBZUA{SahNYu`k z+NF)Ez)0QA?|u1X6GYYiw$w>}exFvGep|MD_q^H6YjIp@LA7 zthP~1g>ETdD{$|C7&*rJTOnjSu+9~(I}|vXK`)r*kVwT_*A(Sa_%gSxJRtlLGd$)jurTgU+mm9b1J2Qe_PnCWxZwvPU6xfwcG^+M;u?A`!?f%T49a?FNQ~ zhmZaq*`8E^5xiPVLvuu-=2u(8|Q<~>Y9(gE> zbae+(Q2@k9-u+!`SELKec5%Ai>JMi8k4Ds9Ou2WqyPA&fwfXO9`6A8XoJuwLs6%5~ zW3vH{mz>9nL*vxC)6eU8{auySVYzf5v7SYDt(-92e~;y+{Xzbk)~g?1rigxv-R5d* z=WKjWdMj*nI&0jS4s4wowGHIbjdvItuV23|0APptls=EH2_Vyfm{ggWv@Scm>WR|v z`dA22fUb8H0txO(tq5Tl-SvvpZ3|r3ZH+~qcE+O>uKKMQ`8|tpq!ZcouxeLV)%Ndg z+rQve;-3T)o?4_L5r)2oH&C;sMcBkYa$Qf$nFI?usT3lj6xM4=7FzG{VJ(r4^J}ud znFm4o*GSaRs4TEmOi$+cp-W-5VT8@rY${j=E#+xrekHGPxcqMX8wJXQmgt_qL1qgDn~R@nx`=?j_LlQ8tT~bxJTFC-dLVN`%#K-5glw~Tx9yTTd-t!!s5RA_>WK0 z)6&S)*8a6&Q}g7E5q45;|6M0~wER*pC&>EFST?^(=nx09X69il?99RGy}93L5bVz% z=oXW9_+|dejYdTOXzzWDZ{J^e3fIoM4=t;wtwfP#)-m*AaB$>)5(XyRnt5fp{f!dt zTW8=^ z88>O==)_)HHm9vwo^)7Hgg?V@c_T{tWkW@FJhhYzIW5P5u<=vHL3Pi(0w1ziX$jS? zL%MFgmq#_;Q^LW#aliDCJTInF`$Tqpca)^yI~42uXENalZ}%TC^MSvFKM!h^8mTgw z&La@L6BzlLYqxT#+32vD(ES{O2zB^JOXPP2I_MuYWh@gkPo#K`6|$`U%&nw_1+#7@XJqg2j!jRUOwrNZrEWT zIy#Y}(yP7psM2c2-)s5KL!(E8S}q%XYvWK;S|@0oi>1Hm7!G_U>eE&OFv6nIUH4Ij^&Vjc3NmKL&egF? z1G+062^m_jrvtKAZ?LV0P0a}@*Qi6`Q)ShW$o4dk-G#K15IITVHFu5kiI8Gp#m5h0 z(H)yP3>0#QXSR6ZQ9Z#qmV|qvLI=w&g7{1hx3M4En`Yj)8QX60IoD@unCBhg7graS4D)D&#F=8h`b6vWM1h(8Q5a}*s;mw`C8 z9^ZQB3n%WxAQm4_wFK8siV?vs*}Oj7tXRpX!HSLgq_c8!c0IVwgpZnp9z4}k`(~E} z%UyIi@3jQtwO@oTYYsKl*t^eoy!@$jN*rL6X~g+Ldy0%!q+;hF{LE{qbo17Pt$ntP3(zK6NFkz`>6`4Meyh5q1S*@)ggSX1>g*epfK2M-%7 z(f>3KY4uo0k+JZmeEuH5+rR^x&KZ5B!`2@^e#~Fu6IEd9kRcTkW6Wc=)dmL@Hy_Od z@JW1)HvN`a8+})Gl$pZs4t~xetpX*f`AwW1NWwg~9*3dea|Y6XgZJ75kp+1|IEARO zQi!cA3V#t5rUPgcHv@r!6k8ss{E(-5MA*HC%YnB!#LJ=KY`-%3v6p!~z zNF(&*r&Y@&#!GeuK@6Lk`v9;SVQ~jp?)Dz?>A~zlBGcj!y9s?6Hj||eiU+v|v}c>% z<75y3sNSQi(|&MbRPh&faZTMC9HsT$hyiR|Db?`;rcvrF4OUufObEtjD%{YoAwu7U zz5GjD8Vwm}7YPNGK3(qJ6`IQx)g*s8LU*6aDOTS5l{F8QhT=u1A zRNlZQYqfD#8bhC)sRQ5Gfla$6RtJl1ctv`p!Aoa_3KFmHE^?$s#cizc?-Vf$&hCf= zJ*Pa9!unjI1sb2$^p4Ggm|V|Le@OP^59hhlM#y|fH*!q>(7 zc{jY(wIkL(kU_l#QA)aCOM3y1bEcp=iq@ggqTXv;uwhK8tNKS;oz`G$7Nr*tBs(T@`TO5aV*tiLM| z2|T2b=BC|0WcE|@)J^=Awa7dPeQNRuL-2I=3gQG=Q*SW;pquKX+Z7^3G7>(m{bi8TWrQWXym4?wWN>Tm1p z%I=KkrG}xn{`A*XtP`S{Kw$8-ud~G#6Ot2CpFeN_O}U`c%=o5!iWc)jsJq_DUP6jD zVpz=y6t%G*VpEwB&TZN~krJZclhG8ES3oA$x>;!UNrmcC!))sxiaf8^WEmRZ#2BLG zFlY9Lyaz~f83l2k^e_<)khF9age_JI(fDvpm0b&5`&d5)kCRG>1K;# z$ammT&83v!tPuc!?tt~LDXB0f4WzMO`j>IX%y$~ ztM4k5UA}#DT)z|z86Og-Q;+1B>AQ~J(xKN%F_a|pLkeyUDSEA-pB-cKDRiWGn1a(y zs{yDLdCjsg1Y{hX!CIlE+L+6f6H#wW6cao;+=?Mw)01r0cjy$bS}sM|14%a_ir{#d zywxkS$%SbJfd{{nS|pjgR(5)yt(e{+s5qsr{ZL?(^lG;GB6{16F)9I7p~BECZLQ`~ zt8F?<%rvz&(_+?hc2{Hj8m7UL{(zpgd6;^KIg`y$DnEF$4Gq$h-sVtibCpdND;}IX z==q5Wiz1tRG{-8GQWEa4H0}7;pY4XC%q9D-{v{)FG@ zM{RQ1OC{2Kf!PO(=zeKu2vNu&Kg28Vr90!1zI#<71}xl`!Vs2S{k`;{3OTg7)m$LZZRE!M*d&vCvTTt368H)Se06`oXI*`F;C7v+a}h|HF-P>4*7Gbgeq zn^}`eBUKKI|1iL+dHbb?fcWyJW!WU)=vTOq8`u2L1rF*rQ2p6m63FBfdYfHGD zYmkRAK}oU@EQz*ki}YT9xNBfp!GT+Eouhg0tCstZNcBJtP6d*WiFD6_6 ztU=Az1v=Eg8d3_lSsMrBCRcXmTEwmqVxh(?VR2EKA>{VtHjdpel+9pv18#vo@p4Db z<^lLbLXfJQu3(NVxB6u;GxvqFp}|9bXH=rP@EMqYc6#^$!JUoiS7N2V*sqJa6ej*j=YQpzGTZE7z^8#Zzrw z*sn$#%{K$edC3$q8QD~EFU(7psA9a9N1bxGqrq@=$ZBB(_9tUwr3m#`k1EaPW31Rp z!8(!_+UAcXt_hfI5f*>MV314p{Kg2GP#mB(!j3*s#uy(AHp-C!cY;q`;9hU*^-s-g0mruew~@Pp)xH2$~K9K z=vq$9g^}(b?yko(UU;0HW`vW_)K03gpg%^(s z?fM8UuN>o5{nOWS0{5wVsZM{nY z>`Txfb4mUyBSn{Vg;?xD)_2TI(usaV?40#$@d8m8d?MU~x2@5PKz*kK zo-{@fCo`$o-zfz~+Cd-lVq~S(dh4Q4QhuYOZxD8vYZzOmM2{ShgNf@HLT3eR9Us6_ zBu0BUXy={gOH0lRFl$<~7qUo96TACUHp-ooEA&Q|OeJecutLgG1X2DT$c><=Sy`WZXRW&^daLvVv z?Ch;ihI#(tN_8i}1U~C-wn}<#Cc%d2%A&IX+hvFILkzcsYPQ>yez1c4+J7J7ec4ey zP4{QS2R9vsi_Df{4y;BKXgbPht3#<3l#JZMC$vbrO6FDgjz!W*!ASxrZi}rb;p2-h z5jA+a4((P8=0k>o26--1>Td0C+Esn!WSp`DfkNav^yi}^`OjfX!QD;P%hIqgEE`rq zvQ~^{?)>_ohj&<*-W2U4$mo1g!>a0UiI21Ei({#l;iPxA${^wTSDQzLTqL@}>Dm_} z@z&!;zS2*PV-yo+l2MfVLcwTcAan)4>7eHatc$u3u-8MIeXTPg`w0U zsWyQhlYU|$p30)B$*p?m@Upn5;XBgEBahkyQl8l6q=5$6gv?b;0@F52$ zd+=zG2~F-VM|I&h8|)r=6dTu(j%^h1kBLAh)3ezchsj&GcqVXlUZmt;Ws$WKbAvqRPw#50 z{bl(6ur>aDHhmcuwrC#*c#gRGu|$;73p?T;&tP~1oovs%^DGG0Vv2%&SlDMo2#?`I ziw+Z4D#sgP5v`$U3lWi}ksKDXNslQ4RYB28(nBiYz7^SRCoV07#+$_zGqQO?rWjqg zDT&s990;pYdMs)bcc?T{)^K=RXXlu@Sc>PNpX6m0c4&+y4gUP;^=b~0kL9nri1hKH zS;spvCXv^LHfyji@uVWif}Wpp7EW)hQnjlOSms)KUS43M;_m+aTfJ0Qu>SDheTEtwVC}-EjK%p{yxq#5mnB%8;U$p3}d| zMlDPe|4y$Pem9{)qV+^jr$~t&vXg5(SAx_?geHa%Ggd8+kq6&Tat0C+=chW`3~oX| zCl}B_#j4PoGFZ|u&vNWi*eQeCR%;&Cst8NeT+^yK-L!O9%XG}QYqpPE1a|eVmrdBMu3K1U1zM)Z zrPA$Nh)AKX4VF)0jEWl`ST9qSjN||G-vDb3Vn?BToYGq8{?`iPB=j3H5qIzG>dIT5 zt1(sQ!t|E-#J6)*kVJ-dn8jN=ZM{vmVV&w3$LV`Tim`g`vDur{Q4sE&E$Tq|)8=0* z)kXXlD)Egbp}g%41f{FH|J4=AsJ*Y76}4@ShGV0(JOcGrRF1L?^S8CXqN}%LKJ@0} zGTgi{th&bK(*la8mdwWlHI=UL0sbz)Y;{l{ac?a2VEv6W>4Ap;1fVFRb1?Zmy6 zmKBovp1v$#ZZhNxvwn~^#G-!L;W=m6?&~+W^<1^Cht4xp1kxwB5PE~Fut1kHR8tCc zz6d^e)%zTr0dO$F4ghkKqr&!c&ToDA(F6xez({(T+D8Q|IuifA!KQ9X7>pX!8LI&u zT}T^3njYSYQ~>bkZtbD-w5it6!*aA&jo|Ke^kCDSN!rr3brQbYWNm$M<0stNvtE}gHh3FK&SQ$8A;Rc;B==XEVxSl^2?Y!j(NZ_ zd7AyMMUdAx)QZG3qS14|GJ=m;ve{_+5mKq*Z3L}m!|>ADE4ZQIkzr<)&NM>ON~I3O zgTnFc^&IsgMj5}VwBC$fP%X@#zFGkB4rB1`3!1Ps>6VL*p00T(daQ7Vi17s_!Dd>$ zRY~RF46l~^>9(pwAE)@M%NKOYSWDjo5t*)=>~+;lu|g-=c-x^E>6nt@I!E4b zKYJui;LO3FeqqF#)o*+e!1GJ~ZD=Jy8V9_Y-9g1%iw9|Q?-iOf($v1M$xkhZi@+Ss zahCFDds890M%D=TyUzgXa7#8VfwNL{{;n{ReaVP)96-RJovQ}QNr~)x<|6HQzf?4r zqx!2D8e!319gB&Sk3kG|QzZkq%RKEEMs+%haZNLoc_s(shQt_vi``liS*bvh3d1!7 zp}jfmk{!Zy?sU=E$BsOf@Rb#~KYzRxS^fcBGNFmtEm_2pOT^ z+VJ!a84qaONw;2Vyh)m%jPBDH!=|csEe47J?P8;Z`-Hv4&;867@@><|g0ISa{QRCu z-(-yxgGo1Bn%H#a;`Y)e4f}P-Y;Vf-+jzXs5G_$mbkL+_4bqy_7b zOoD{=QP?ON^u};oj>73*jC4XHur};ou%)~9H%7&;&nMNe_(;3?8xmTICakWbwUK}26Uxk<@Y$wKl%m-ECZMvbXEwh!X!xaN79oB7Z7 zsP<>HLIMdLM)u`Z1gKQ8m{j1Ut?H-JZgqiaFwn^Sy`+QKBtL&TGO>@NkB*e2f>L{; z(L`&jEUDOFoblDdtHJP}cF1w%Yf9BehN62{(w8wYB2y$GT$^x<3-Dh({p1fXZnzBF zwS95bn*BRVPs-IF(a{&kz8NOWv2LHh3d@ti+$;U<9QT&L`_WU>~$t05tW7Kv~_a~><&-i_H+ z$G>FzuP1wQ)P*nGELRl8lpro8ZF2F#^jr(S>rG_WX#xBOw z3km||+|U_g)al>z1y4W&V@5{C4s2n?+o{;OMf)qoPwbncTFd!TpxH|R+Ci9S-meU= z8wp2jxR6MSi-{#d`v#*yI%Edkh;aU(gOy_H>EiATV`fSlb6x;B0MY?=Hc`d@X4x1T z^ifpsbc(Qr;_F9#9Xh-?&%yO&?N{RrcP+lH)_yA;aU>m1lwxjqr+2RZQc|PJr6#arTZjZ~x?QuA`xMofc~I)F zPmP@Us~l*>Bx5L8T86UFgi>bg0@=s@>%jM+M)7w2&ACFTbO*m1n3Ig^Ib|>92!u;` zUYj1zEYlo%xSQ`mgfap93Lo2zvq?EM7X(_sW^yqR#w>YrZT`F=sK2X$Y&m`@dl;E= zIK`r?NINC?Wwm+NH`!JZN29OCXghjS`&0W`9h?yrX$Og)b3bGZsdlrmRY}q*hw9gA zQ&wW9OXujO`~o-)WPHuva_&ixg&;;5Wo0j?dvDZQ-9t#NLUcq@85x)e#2dU zKxc$?-cVJVqG2?Zik3k8AQrh{41$7!Qwzaks5Tp(@AVnpY7`!T+%T9moAj7Q+bZL( zwVnm~J%f_r;xE)Ke<>jH-7^?8PMyoy*imUhNvK|8+0R_ni62TISI!;&bII+|tRr92 z8-``;%I4zJ!0)TA60>PdOyFTZ;#SdN1kdu?;K=VpF`M~EvobV$SO<6~N?61}ym^7~i zlB0Un6i5>lcWdFyudL9}?n})nIcV{wnGwZ=eC!Xc=X0OCMg4nTJ`iGk+I$JlGO?8`QA7{lI3RcZ0L zWpvmqQN);<#m)aYrzYCZ=>Yd_;F*o6C`EZY3I~*3q28=)OoSaa9R;TiU&+^531>y8 z_}aiv5;~zRyyi*&>Sc^4@{J?QW!*u>Cix#S%K5sOezl3#+@&0;o#)q5<3>tis#&`= zgFYtS|YThLXgpvEqZ3YmIjj*5zJzx?lq7bNWEyMvPtTlBG0rb5J_ zB6^2o%I4Wp@vexL`1L_O<)o!gUr~GNfUAn!O6BYv45Uj|1JW6OlX#f6OHWmcl2+lPnj=J<7MWS@Q$&B{}UZt z;ZJABW)<;Njy2W!!xIF#`fD_Pst+kTA>13%HVL4XUByr{5TQb1M`>}Zjr}=P$x8@3 z>Z~s7eef-y`u{%6Z!k3TF&=Ko%>s|{S2OfhjSZ!jDxqh5t<$mKOk*aJ{hg>~VwE?2I79E<&^{wnCq%uCsir1lDTjS8 z)Topwffg^cm+I2IZR)5^Ysz|9=_}CRJLz!hr?w;ZI`&)QZ`NHY3dbNVmMJWMvD?*J zOThdAhe~$JSmP-L6o(GxrN#ebt>dBYW4?b`dunh`BG3s~r| zQVrBtrxxbi4Zg=@A~Dl9r3t8&36Ip+7}3i%1TaRzz`-D3Vv7uHv`R%v`=|$Dvb^g> z;$cZ^nOe&ak)_q*34w%~q&WS@P+gWVogd#vl#+*l^S{-@W&z)S|2(^ZgvQIPOQ%mJ z_Gk);l`Ao6ffGo1NF}!rG%~;H6nX0ooY(VcIS!+R6ci#%>B1smdsZgd=GqFO#2+i; z7H#TNfnLt{E^u>pJN?)TRA&`4oH-%Qqcxxt$RcEL#c}iL{Pc>7++}>Zu8bwjzJI}SK^m>BBy-{ zx{jd7VkL>dNu+=TR;xI2^(5%9iFW7Y$~bp1dtA2Di%8-35u4f>lwESUA#{t$YWWDe zBvmVUk#wn%=R;d>OXg)!oU^*Vv^h377yk}VV=4jG2H zL_KVhn4ynUr&kj8%fZL*)oDS%cAnOCDdlxLVO)Wj-Jo4Iiv9 z=S9`4PnXrVv1aBhMDq4!nd?mLNhqI3o_z72Co#0L#cTbmVsYj)UWB5~x(S`|8|=cV zqe4iDH@X;7uFtX=CT`LHk#yeSRQ~@Tw>MeYTlR=!lQNGjn`1>*B;!~`WN$JK!XX@c zcaXia4vuvW$sWf_q>Li}9-;27XR^oB~TZ9nH6gc1(E0u~uSS_c$@@GweM)}J>H=m3c&t6-C{!Xov& zqnLoe$u`AUMa6l_M&YnF+FWahZb~ZSr6l1*Nml%+j>w7H{|3DOT~{M% zmG4{n2YD?hH5&&p6~bdtfZqFXYl~L^`x_9L1J`Tdn>UXTAG=N`D?&uTYYunDo>^rm z&e3ka%=hy;6xIK9gMK z*y%A1tn=#T_5l+Yt{FvBc;CNWvnhyAOW0?EWZYLiG7JzX9D^xp@LaIY*_XyVq>6|0Qi4qRsupiVQ4Q(C%C1_; z+IxzQA?E!Q^ogks`-8qIvsY&kw4Of_=$11baz$z9_Acmuls%J`jzv2~{y>X`Ya1-t zOj(>$=AC^=h@XY_m^`uPC*`Q=-v4xuKO{fG{JA-|$6&s6e0{J~&Vz2UlgbPF(e{G} zaHT(FkfD~YQnuf@&JT7VYXprCUk2;Y@UOI6!Zy`>g-=_3j%1W;PD@gt*T-bkQq_Hu z>kD$PC%vY0%ETm$EpS|I}vk!^b1d!B?@z}1{JkTMNd)$A z^o3P{U$PlT`?Zcfs06M&cQ_7pzK`&ekp?5|?7tR}`^(dvJfYUP3ph%P`T|f22K>fx zxR6lp21iTEIs;w%nNHgoc`ct~=0Qu>?a z;EFbDwM*-1g;100h(%n4(+VnG;f-^w?<-l$u>md3cNY()GOrD#A211ij z+!b%iVvD$3moPoiryP#vd_*rT$ZWQ{NUeU1e!_PzeVZc`>U4Gij1~iUV2W^y#W=;J z8tlr7o!-bq3m`D4SO>non3vj zxT&Dt7z^_E2_|kr1DqNsNo|$S60}K$j5Q!R4IJgtB{}SALf$ArlyUt)3A39eV_1q< zl;AWwC#k5JmhW&VDoTNm)55Ck6j&rKLvKYB4CzlLXEO$j$UeYRmS zSM5-h5`MB~x}GPOOodOh@-cWkoH4lUM=(a=?HEG!W8xe%w*zkBc&K`MdTQ=wt{d0^ z1}S~N0kp_R$JkYsJbk^kT49>1CH`#F;To5Q{3+mu@ZYih49Rz;&V*&D&x` z`q-M8a&015OKQM%3~MD1(bYbQSp}A|6JXs@0(e}C%-!}#nfxtUkVj0PO3zOoRpAFl zZd77W#fQL`9Zcn?&R%0-VVp+R%a?5a>>b5=tV+0YQGFQcw`0J!>nT&jm2yPatDs+< zGyMr|8T>s^IY)M2d<$?CKWAxxmeDn=JuFY&0*nUA*vTRQm z78d?+S?&@MKKVGVJ-U5vW0O2Du{#wdY;J!yiuO#IuHJY-2}l2#tPV;5UBC@_D_J^Y z>x}Hvo^tL~{(1r&2592mM^xb>I*t7kQFzXCV%^+-t{%PlYj|_JKIF>3(r`kLLjguh zHqFsMPABs|>$&!@(@1pPS~Z9{gBH0lHZTG7{j6+3g?$BoljQ;J>5}&TF(kOGnLWM1 z&-=l$ja+lt=cmtMk}|Dbej1Jy3B>=Z;C47b3kktCni6z}+j{HS?pPL}Ug5!s;je5jk_Rw>hF+v+>t}hq~QWkGhChu55YTZJVk#(K<}7QJk@@ zBU*Xz7a#&S1bl&q-8}77o{%k^C(jiDC2qNT?^5nrK&LGub?K1rPT1Qqm;6kT7~X@G zhSSALxo++JfbD*3OKP|6z<2|T(~bnoX0;@2COfNv8|j=&Wql~9k|-{q9?oaU-~lfT zd01rpk@IzEsQ$MS<%Jx1s<58H)ZfmpL#Z{>2smvB)AZNw7+HGkTCm6aw6t5>VJ$Kx zPPm@5gNT$F=+E`Qib~sw^(&YVrH&R6P@LxGvSW?0`Wdh<3{@lul1379u*YLb32k0T zv}{eix};(wAF1tg`S=urTpfzKd@(oC!T#LtPXB?bH^KXyJN`>g08>K!NT zeM<~{LK;`OlsRVeojk%T^e98VCu30u6~Rc_IJalmU^zR!uoM~(BB}J&SLCx?ZaN|9 z@Rk6lds0NwC@qt$`|XY7ZvfVbUf0>6DO0-L15>lr0na+c8{N&oRar<=(lY6-q0#+(Ln> zen!?X?TDS!eQUDzmagw)%1>EJOKU-riY~KF(iU3f0-l?nHvN>enEU78wgmGPuM8=5 zpmhZFkVERvSw9d{FKA|tqi*TCJkJq>X$zu$PKj36%#3J0nb?B3X9$$iGolEI4N$h7 z&&1FgfuJ&06H&@|zZJYlRv=hI8U1~#-b%ur4(gq%nS|4S4gTK0x@SW7wi6_&2VitJII%1)&fmzR@V;cF4;ubnaGe_BK zhG9CcTjvhKaZan%g;yQRri$w$H32djNvTchLfC;yuP-eDL*2@T`C98dZ0#Ie&j}!b%Ne+ z=Z{@zRb;^*b}Txbga=EMb2IlLbc}|6RqhQ#rtPl#q9MY1-J}oqpGl+{m73MH8H(k? zo0Cn>*S53wD*AMITgYN8=p0J%*aF}#D6g_$hI|gE2-bnWvZ`7a-H)2S zHyog33vWSO*?!}zS@SuZwN1-2^Hbi5K@ES)=%U?HG~v|xo4(Dzn`~{DmJ&uwQ_7I+ z|M0y;u@~}=4vn~-6&>gwr;Ck5@!3XAy9!;EOjx>c$LmRowkH*fS}%-AYVv_{jZ~GD zFwWQlityeBjW{>ghL~ROQVHtJY(qO?p{e3z8XO6ldXv&8jSaKTR8=9Rm=@!YCWGVE ztMDI!1|c-J(LP5i70-)_l?FcKr;96kxaJ+QeWkt@|A)5iZ0;Yd4)ogW^~ecDn#oEgEd0{q6-9fjS-H~-q`*7WfYK*`VkOL~%JUhCd-Cda zV>OSxNhpVLXT!GQTLJc>J=8}`QpWG_$!i!V@w`DPOanM@0TsG$@q?> z9%*ylav{F2Blzj}#qMnPOeO-}GAr@p^p8|7y3=B1*+08mh;qHiZR{9AfTttW!JW=8 zpvEUW>79~0^76f*P@uSCm{n<9bJOze!Sb)=sAu7M0+Jyb(ID$PT!n;S8$&-=sk@;y zHEGtYF?N8l4x-&9*{;;)5J}l`%M_{x6j6JRn~=m2K(#VkAP`Zvv(!@Jj2v|Cko>(CX{|X3Z@zwMbgv&U)&9ImXF&?v0=OQAiR`~a5_Fg_f(@12q;{uA%wzdzKj>ncy=Ww2)O#hWc z2G6K^)gX4u>fdH8gER1oBHfZ2Y`$u5;^0cJ`65250tazOV`1nc#QWrX%jWKDuN$O- zUV1QZm+K>fem8&^@lH(F0sC#hF6+O>AyKX7holjNt~1ALK^!a2A^|9JD%B2HJ|^mM z)k10;rtTX7q|DqoM?4bS$U$iCa1d+0T^+c-Oi-Mu|F1i?ddlB4UU{S(Ltq(*3O9RN zU(dY*s5+1=$a=qHY-GB*6C|1e$)4{m26n=pHG@Ay8k!)*y&Do z8c)XF1wh@PO^@P55io@_=?Z#OlwE9Cdy%oK2O#e-k_nXMbB^H!QRR+PYkp1L=!$*Z z6Vttu;Sj;;+$c$U0f9v)wpglYFPjh$E7c$6B)3_p8o1&HdM#-14?;uUM7?>!D!QZc z^_?P=eM<}P$#~|7T&nL`xU}NQ4|ZdNpq72z&f{ZWMgA&9p?!FNjF%Eg>qjq zFi*Y>sI1@XCa`E~l(OA`ztHfSaz9uaJeqoUMyGS}qQ4C;XBi2WI(a4% zVMOmB@Z9^^uM*tc zh6g`
      6_;z1D~3!9|aG0#+u(l)W@P)Bt%Gw6dY$WPdYYfL^Hv%a01Iq*JMekO}q z!Eg_5;MWdM+lWf00UKa`AL6$Q0gKY=s@>~IxW*GjNFsa9Tfh*(+P=V!F}i)Wx#_<3 zU_96ES|)j8Pmvfs&+9XZH1q(O20gB0LxHQik{ora^XLY~GL4@9Ei%1+(H6shKp-(x z%OrFSaBQ-DwE&t4S(>8b?xY`zk5nUf6LW@C7KL-!A8`#DTOK9NJhibOP(WtP8I;NC zSCPg#KNA7bLH7c&XUciDzsWc{)4s#6K+?=c9qrPF-|_M-to{!8b#-V<3Wy4j4&U6QG;tKT6Ckj>+KlaM2VVoUyK`F7~er3Oee1w-BvIC`f6 zrE=Ghbb$dwT1SmtIFxNdS+^;(Rnf$J(Ph$5HgdJWZuuLcD^MFN>sdu%RaOmcqH=F2`co1Oo&|s*faAM} z3Wc`Sa4$2o;5`=Vfa`Id2sewMZ%dYE+&cpDkn5~-3L&x!VdpH@yU8Jc$KG5Ro zYG?X68OXjgFZ4GuN#=CzQBrvnoxEP|5jcOo{`mv2NW=Z3%UEfXBypotnXY;B_jlE6 zI;uOSPvmRs4r;IuR2T?ZzKGKEQu=?4>@2sWE}oAWo;2p9cWYSBv#l9c0R%7d+#h#d zWER%x|j zQrk~g7NEo(xvPKN-gN&`-G$)MywWeYE~0qv=r-C@6?0Wd+2M0H9)}UNt>UnpP_L8j z`taUuA(=aGxfUQI8CEUStS&nXA6=bp1bnwyo&s=4oa6m>$4#ltTmr4c_jpQ^A=z>nf_>n;1i7cP0zw0(CqMLkjx}8cw3%pkWC8Bg>aDoTeD|)_VX~n^cyr823+!iI zSZ#2(hUTo>=@bpUO<#Zizp*Hr8q}MyUA)IrG=&EMiz|mn+1`xJt9Q84z0M+E^)%%N zp!b=-+3Dffd?a@Xc%KBmmS}jn{yCK9S9w3t9bo zNFoUbS*)N7dPS)SN4+W0Vsa#rhg2k2-cNCG99ytltoot)Txp$SE>y=g^9+y@f0zaJ z`RG5xDgi{CSGLb$5ykY7%0iegOcr&x;i|5CPkQn?;D8qCH{ev|$yUZ%`CyO8CiPq; zJx{zyJ+8R4>dvuEU1W zu7VgPZp;MI_yxnR1ew(rU`p|iHEgo!-;PJ02Ir$!Ep{n+R|HN{xd~@(x zVo4Xr2SqGxKeiHeT3083QMSOjRphv>E4RY2#UE01|1bpRUvB4aR&{r^gAt{?r^4px zbvV7|=I^NqY+K_~=`aCc!L#)3K+era!4EkSe;mO%U8IczrH0eqarnuZhi++|~*FovVjk%Od9SKoOT10E>5kfhQ!-V}0B zDHlaN_zq}Iq{hs;+&HU3zLjXo>M#*pT29h{*HS}Z$R>W$5i%_yCMDX2n(+N#VTuHQ zA;hy6_+!|Jzlxa%<6QemopgNmt<7N0CU+)^HBJSKHgMy=h2`SEl3i1#>#sr#Z44me zd@Ir#J}8|N;Kj{H4KICzLBPmBfM2p1bpUfJms><};y5vfT@`CwM&HJ7ozB{jci9+~ z1qR5d8TfZ{SB0xOXD@9}`{f6c-9pEb6e(lAXKa=$eYJXGJxBX8H^RnpbRnz?mysAPfhH za^FUI@?7)|j|zl;{QbLbj6K}hJVu@w#>JQFeOVz$$K5IJwPN~@gBQ`yEecT_e5bq) z{M9*zO-Yp=&zp2R@xS$@&Q)~Nt$Ka){ks&#rNUePa&D*ExJsCEVEra1qHm;2r= zSp~}R1Qt*D==1WWRJ>iaZ|y}Mg(XZc*6=3)bVk6Ok#{329Nu%DU%Cm&L-fs)7nkA} zD$#*cCt_<)1GE{*QGRphnkl!^x_9@M{VJz0H)-QhYM*dnO|*C{ttI7K zn+2xw{_+i()@>V~-i%2rLKlj`m!~nIrVG2utL!?WI$iDPCj4@AnPo8~U~}b=lP-xj#j&+!LF3#$)HEC2 zd)2Yz!ir4(C0&nZ>QwF)9Zq#M)$+-wOMD>3D$$brGqhjMEZ%)1shGju5-n{ktL*lm zY{!a`eIwIMMzwW4ET+$3)J}h#d-w*kanC(dVDhx!;YStI8no)2Dp(jqE3)tD8jowfk_-zaD4}BdR-K z3Sj`>L4V!+R=y~MS9B82?Z!ZwQlAw=Uu+q#F~eGP;O6>Akoapo(s5d&!=RUnQdM*P z#44=BPw8zY1CdX;9e`;>!g0c z;iumgBPN;l7t*v8u#-a8e~~~rluj5Qe8`QW>4{k&+KaYeFh;!ux5j2qt&8b;+3Kp~&0b*i+IoFuUMD*xu0fiR?(Bh>(togBX^Q3K?Ttd;H z5qvj=Zv_Yz0V@_is49ZHhkE za+kuBrt}ZtfTxy4M~#^rG{*R}fQMOy48V$X;Fktcwluy;E3Ir>Zq|Qyxv2eCG5bH# z{Pa3@AKDK0?rE})OBaZ0eS?m{OE_l1V+(p<8NP3CyXO!|DR6g{W za)4Hj+oPN$HXJ8)is`J{b}L!jQkmMRgwOM`S@RrU7j{_QHO0)cO%3BeX3^byS9vV~!PU4N&KE)q8$uh^t)bQsl~$mo>w< z%Y`pBTg1;!KeSDO!p_Tlz~4u>*ff}2J14XG3m2D_vWrx@IsQ0mOYn?)@p5Rfify_G zBvABA$X_&3H-k;?jSC0P6*%2n_dsHW6NFoG7?hOe&dn-iEGgU@Ia%o0u0&fGxuVmz zYotdB-#P`QIX&qtyoM;DJgK}inIXbc$$j@dyG08D^>sCE%!8r!WAVoq56`3Q)2};J z*S-)e8hl@}YAE3aT2www6$7Zxz}>UzU)kZL1-x+J`Mj>5I6RZpIAn=`GNb4Y z$(Mqt~(&H>Z>#Bt!iZ@l{r78=SLC$redKKvo1vT$p4j!KAX zon9z1b=R+P6--EZO~R@bcIph*7M#typFujW{He-cR9XFXVOST(U_+8?&z2`$?@Pag!7`>;N4nOZz`dGHt7IVE2rq(G2; z`Y{Gp$k{zFx}}nc-+PR}jy?U*o{&GvSyjg&qz}LrzG7^@ZoX3Y6p+z9 z=6f9;9_0DN)EM^~z0Mld(K84euN@HwR7t7kI-|4J$F4BmYEyR)(p5sw*CQ&_%<31t z1+~^l6WRG>8zJSmgoFe}8A`}^?@`k`+{)>#+bq_9szsCU%})oWna!NNYz=V|-r3TU z5votk%3r`mC{~yW2hHpU=#`hN=W4RW`#>L}Pe`K(NV>A@NG{4Sco zLdEFvTd)cM$pc~CEUte4?i8o0lePZzqetMk1S|~3~3MNEiZc{9o+K1;37W*@H~LPb3+KA{QxB|qM%zV zNv``>7tg5bkf}TLCBS0%`+J}JCjCE>@^oNLCcu`m>G>&@smzFV{kJMaiXUk>DWa0y zW=TdffM;1B>uN+amXm5XtkN4Yz-!eHU<3GnK}Hh*^Z8W;=PJPa`FHj2=AXoe9kS;C zc(R0U+uuoC4qo+z2zx6iH_v_fRnN3+Ap*Z+q`t4x26i;MDfy)3o3qNH!S!NKX@T)| z9-Hl$U)B#Rn*BiK>HXsat&#TBRlhx&W&ju6O+48oV6qR_0r3`$-yIRAF_amvl|Pko z2bE2%CoRZ8gQ81JuFPw_ZOM~s`|b`p2jyjGe{@YU8dO)|xM0h$oa@m*TSNJ84ohRl zLYz)f>fJsUUdU98z_kVqR_W{aH2(H)!8h-X0*_84H=ypWN@N}?79N+J6|=IvUDYsG zUH&>SP(i*=AKO_?Ih=?RPOYvHB3*NDpecyKQdOH#9evpU`3eAKi*u3*l%hHY-~R>X z3jwKD>#UGxO-U0qScDgC|{E zX>*NKc*6L`e#6@&``!0P)Fbv9qL%@gkEJ>;*r+*V-g6 z{7O%*0Q;Vc9WuiL2Js0|dR}lPMyhpN7#2FNWs;MJ8umVd3B3Fm%H=Wqt7!QCKt({M zZf$%in?~hGs7s1O@TcRD5u5-pXUCu=Q!ab#JKc6xC`vV%)&P=KwkspLQV!=f!i$4&yjut$A3}*7O#xkn8)|*lN%>^(ZuPSIbc~9r&p5|Gz4_d$XcBYNW`sj|* zV>^}X7r9v(_i!x?ay>J;uV>)nPYI0tJ;6n{#Chk{A!y^~NNIpe#_C!ppQgz}k9*_( zjLbM+qv%A~gStyeMc8o&MDp)a&mXps`VtH8>2F$*vd=LM0UuYvwj$Ukhn)*mYeALggo7i(?gFY zE=9PKVzvtW@ov%4J@X6RYa5NcnsVindHUpoRKAZNmvcr^PZ7o3X(2=|0oTqaExiW7 z{NbRoZ8EC{Rvr52=_`#bM__%7KVv?gCGdWo^IK6sIX>ETF3Vpl)5Ng)a$A7UM6el%O{H&-Vkw*%^u#L2~nv|32}&ti9z$>UI+IrA|Q9!igK z!J8MXvtDkb-84jx8`$GtzR%??|68d67J*mX_Xzy#&xcBKB&X31?rmD6^lTg%@4&qT z*aO;m6T;hBm>vOAA<87#0b?*gU;Zb$aZXkG)VQX_zb3{xr#si(MrlqA;-pyQn0ONR z%(q!iBz|Y4d9xgT9E1Fll`0Ef=a2VJ!`g42@_d}*^g^Pkr0=v3r9LTrXNQfOl&_zVqX?KgWhm<9&enWFT3>^(2MC)65G}P&{Ukwyi>~$vk@ktet`t4L2`B<}}AT=Qo+AHtAM?D@T=#k{+XEjt5$Vdls!NdUycgXd?EoBmUP zEUG(UU1x@7D9ISSICOBdc1JO+5lc?|xZ#**_G+1H#WwC!oO$2sy1My4kGF^~W>{q| z%BR@3*k`I?=q+liFOaed{m22NN6(;Em3;=C8FP_kQv?DSMBG9ZYlAfSCt-=>x}{O=)>}MxEjjMa!^(mq9!*{*)e|Ib|OV9H%Q>#LRd(1C6Y82AM_IJvU zx?Y;U=*tfOAhl~~E=Bm3H)MUd7XuvLujT3W+)$N;rSl zXW4ub9)n;|uGoh~!}T6>G?8Rm#v4jmee*S1kacMnS%wHItWPYf@V~Q8{<0VXVk`p{ zi@dP>z(45}G>aN^5D~EJGOjTw<>I)uV2oispE6J}1|y`cX~??1xML%dWPVKjq&cb- z-H+(+x20*wN|d=*`ldD&Cg^~r+&1jcx{C!t8pRZ>NxTnKRFlV5iq`QaTGua*;C?C3_C*~UP15Gb&GP7kT)+W^sg!tMU2#%+%byFc)T z5T#MoUTgH6Gpb%5Be&L@8xt0bOR0vP?Kx^%jnM~XN$eDl(q%Zff`-3;KW>B0wg6O} zKqOHg&XHWL^b^D$`f`8gPk38YUAFVmc=SUP-{x{0ZFRuUFqx`4_SIw|OMeXF&D|#o zDZU@3K3LojWU0K~{KU=0WhQS>(ORk0upAnUR%9pWpK2WVeeyZy=uVg1(8ORzfV@%- zrc1Hw7_ReeQ`SfZN)Qq_*K0B(2jVUL^+UNAdn6%TLn(4Ke%abWg!!Ur!{$jZt(5(g zq7GegBGDp}H#iPptE zR1A)gO!^p@%|$zyY=C0gQmFNiF+QK0Axn*nza=S(u zU#go7o_%=QAL9mS#c)b@qx^=g&}b?mj08%XqqwYiA$ z!}eHxd3VP2pU;#W%nmxvCVXd8q@gwbR5U)BKABHk#LN8ac9~k_14SIYQa|L90=qM- zyi00P$bZvJ{vfX(s7Wq`i=E{fUYw-mJMV^@Et3fX|84IhYy4b|T*dr%xsRk1{qrq_ z@-w8N0bpaDYFC}_#o%KnTwqX)!&u=(IJuL^;e5wQsUr{oVD}Yp9>9NkFGc-#7W>@2 ztNSX(luCOJJE3O5jIY>X+f=S7pj4rZpk`r#tjbcxYPC$1?PyT^chF=tg700I0anw%=J@3L>qA z;jV?(!c3E{%U}tTPf2`HM}EAuML)oRaN5}lgfb+~aw)4Ly(mNEpjG(8s*Z6#g4$6p z4F>=^GVAFBV}_#HjoIrLlA)lv+OIG3QMOr0N|RN#mEP35o3hgJt5~b%vXBXF+u*Qz z(H()_J4=}aTN}tGeZoILfJ)v>nBA=pYZg8Yv)0E1r2VBSpz?pR(!Crk81yyS7oy-N z<3{L_#CjnL1pw_#I&yXcG(YaW(P{S*W1*^41<9Hoos0Xq5!qorIKK`M2H&l#hxR1n znSdGpP2(wkttHwU2sF7Op%9?7f*Jf>YI;(EZ&KMKisGw-!n2KcI*)^~>-2fHnOva0 zlmGYs!%|~maZ+lQ7Jz`qn*%~i3o3SyxD0>&y1aSkpfXG3VqM$+v^LY5KrIo;K@%cK zux9ET?c@EllDVsI^Yh?;5iLRaCEpJZYaV!<+{^cF8>nF<<##!Kj*_y}BzL|A+CVui z*(!L0H$`hg^4wsN}EXR<28Jng5d8535YYEZVE^6`Ca%1sOPNDG1$h@us7d2F%PV=pPQS&WeDWbWW26JwgD?u5 zE{RYxa2-v-aCNn&KNm+}-2Gi2j29au+>d8d+>%;9@1HI2{n}}}UJflo8u2clZ4ac{ zauJN}*ZI+(R{19q;ayVq*xbx215124Bt4JTU0rg#$?-t7_E>V124rt0Oc`mJP>Siw zDcUUJpz*2l7?g@dURmx(75NowGu?HiziP0xNe$iltS&T(^)ke%DL%(0B`d!xnac0_ z17s;J>StJp5S!nl0d#*RIWhAEZthficbDHym6=mHkJP1^nal(h>o&(gTf_x@_PHkTE z+wPRe*aWYs)+ipCUIJJ9Z$6bbq7etbZfdDlZBC~z<6s_$0>zzM(V`O9;TC&Wo%@lB zA#4~}CLBL<%_lEi{A>9;KD_f^#}gfO0bn23d47)76Q#E_#s`%_GrSoi{3*wfwQ1D3 zMoairL^U<^Fk6TGJxFDoQQWPk*x2tX=tFzePquo1y5&j6lW6db#h4>qhFW`cUPhxJ zdW$p6B}LiGrefbPQgK!Sk*8d_E}@T^I=h??1yL|ow@c}!g$4e8LGDaVmtkH@c!d&p zeUt_nm9`PM@^qm0S~XT8l!TjdB?ItY0wxct&N3EUx~Wl#IA&g9_r%FY#1D6nP%=_c z1T^?<@(n@B^#TeY3S_Leu)C`TC#jUaOud`8&_G$gw1(*#QvJ(gtcTqdjn2_$_4TxR z9~S5I@rfj+&r~7%NY7uNs4exySQI$)o)-pvqJ8R}n_=fKjJE&i=oR8DR;+V zFEN%f%(i9ch@!8d+Yga0s`2+!@=9$j%zUHqiO45CV0EVV2@G#EF9`lvwcHxap_^j)SY5>B zjtKZ-6;jm{0Q6!{U)n#FamEk2RA_E8&d>Yt{)qO{>RU+}??ErWNdrm9(@SXtvAv6; z&ad1xajiUb^-dexfZ(t8~Pz8wU_mFC|0Fc15}h5r=H4Ng zY|}5G8n7Q8Y{-y7->Wq^M^SBPiqsZ%d0*qf(o1^4>Px4 zIZ(c6nDj=^^D%I0$zcV40}(q!wrYDE%MywlG(U;-F9ruPS;NN?(tg%D8di=g2DUwj zGp}}Xo>dstm1Ap)PX13S3HGr^-BFlWM7Ciq8UW>TBwk+fQFJcY|VS3Gx zQ|eSTT1prkQxAZ0?oSlYco_KnVTx|2ppJsF1tNWXGd`R?ztFgOkj_cepN5;5s?7XA z>*qm6y7Dbpxybm9k(8A@LlxyI>Q7<%m`msPZ1P_~Yzd$VwhH(G{Nhd+z_$Y&zp#oN z0ITrdxR%T+U-;|G2N5ZAS|tg?gHLN+=Ev6J1w(82=tgOaw0R_!oqGCqhEL6Dd~|#O zug}K+qU^3O>Hrv2`%eG{m2)OcH)Qaalbfwq^7IzaPV&gHh%|tR0tX@0FAhJ+nd~=& zaNz?}IY}l3m8jX_;h41eP1xSMy?d0M@qBz=2Ai7huh4kq4Aj&sF4KogSPQ|(?s%vM zleN5S+>c%0)WTzg+>Jp&CitPBZJ`b zuzH`)7g{tdb--Jk5@~k9>quPw$)XvOvLgM7g69xr4WSVu9m3VQ;)jb48eASvPfx>D zyY}}Fh)mRdI*pd8#R#~Ox^bo2?^2Sa} zuAuIPV%>N>#NU1iT!indv0NcMLnKaRgB;qyN&c2Sjm2h>BBLXIM}sWiQ`_y+=xFJd zWVtPwfSjL2CMAd!MXhAP9?~24nH4JP)mh-Q3Bf3OZlnjCnTneg6Ctd8Ja}zK_7S3vzEIZMJ58 z$tNHi{lcvsF1V$&^ho@YHv^!V32wIaEZEcLttPVxWH3Nt^v9HvB84Sf-#l}->{&qB znfZrx_bjj)hKk`l>`f56xdi@O6KtGZuU?oa&pdZI{g3+X-cJ)eP*ZDkQ^2PjB-MfwRjm0xm*v(1-|V%@nV-@Lsf1rd>6 zJCCQ;%%W&SUx!|b18Iu0Nr`-0xqHnq5JYh)9N0Uo436{nqe3Z9D%(yJ?d^u5?+@V{ z5Q$UoEUvg?8{FV&l>MavyJ!tY)T8`GF#`VAk~BVf zJ`h}`-2iZBaw2}^8n6BJu>1#FiQ$98ipMrV_o^zUL2kfn%`}dJ;AS$8H+jJX+oJaU zN!TOdoixMGrTvD!AFtUcAR2lMDhH`dZ!?CsUN&`d+uAlF)!OC&;QAXQ@k{v&&(^C; zPbgJpiPygFSUS4jT5b3tAwbVswG}A~}RD zU%GRzWY~)kJrV}RmuSwn&X7IqaC?ACzMaF&b4-Wp- zo)PmjW#mR(F#YfOEG=kkcKh||;bQ}Zyn|TxmzE}_{C`>52%zQ}ki4n%WMZJ|n`+Kq zQp})ZBwxhG99}BU)jagXGq6;D@1PXF5a(v%HzZJud7;6e`pJ`j%^geabAzkAtj&M1$a1@oXq8U1<{rc+w8_9xB}L$$ycRgjRRtWQ9~9KK0fYoGZ`eAn1@Z9DvSWl13zi^O!In@(XH@^z zcSuP+z!dx;aley?!r@eFt-*muTXQzTM$C&pEFf>$2^CPHY(KU#`EZ<%L#Y)t@F%?J znWm1*@0h*}hF5j|{sxhEL!mgvTKsr@A2!AxG^zteD04KZ)n}u-BgDX9or=cOO+buL zY||ZM)b@g?xM5E@`^~`_N;+QBXHFL)%r-=q?ksrEcBU3u`=cF}W|lC?{(!>toANq~ z(!62_drX7B@dy(l_6qRBRU*>{bhQ$8E;DjjC`sJ10!bX-ULdtT(7=nLc zU*Ae5(CJ+jTYA?6DUOns0y~|u7gD1V6;4@1h{IGq(R|C1kCprZ*i(%yR=)ASG^ZuB zSHK=m#7Qb_^xekLfuGz*-E*s)FMRI_NcyXo4?Y1DUaC6dFRR(4G+B7%7m~ugj^zLj z65oE!*WJ!Dny&WjiD(CUbh!W}N>I5Ih?TJY!aF-Y%Vm4<-O$Il#^@Ubx^FvU;-`r29hh&%g0`a^Wzj=IDvd{cA_!ks~$O+e#ryqyP$*Uo_HZ)^)V3ejQ6B z)?1?S4FyB9;!cXpwh~NX~{kcXhSeCh(baqM97mqnhi33y) zgtn@n_>!?ugU2+o59{JZVbvch|$R>pz>%?EnU(T z;Byr2s50PL+mZ8B*vmV|Rs@}5zJk+G;#kFm%3=Bp( z<0Q>71~F2-i83gkVP-4ad;_Dc|DcRQX>TDm~fO<(_H4JMBtW#%4cdH);-_T>OKBUd=l8xptXO&xN(jLJ*5pg+t&PvHZQ-8Tmi_ zEY5-o5*Ln=d6?f`dJJ}^{+NJA$nK_C4}SKWKYd3LCVds#Fs0txh=1I|*-VDM4<6*E z0_-L>tW55IPSvy})5jt0Ir&Qc_L82ANzxCBjAbzTcm4kYwGNYOaA`>Q8j$z9keIDU zxA;#?TSz%bArLFQ0wQU%8AM_sLO6B5W#sp7eIr_6A^IVkKEd6?5ytiPvHlwyZOJO)Q3!;xE+R` zhN?&MahTLj+MLX;c@^mAZGdO94&$sQJG3@{34QJgP??23$?=U9)q4CM;s|Uw@<~rO zmFI!j1z;6_o?gr8%E@2X?9^l>?BQ$wc0A`AR09#q5rhWjZy?=&g~+wYT(9H~T?qak zOJ^NT_v8O@(=}tdrlz~*UdD90)7|dXd0k9SH^amjrn`1ATru6PT#kSJs^`oPYV?9?W)F z8NY#P#h8sHx~t+IogJNMLh2%NV@TA#W^cbpPBi7F zeCOnme8>^iYA5enZToEme(WZ`eAdB`DXx_Vdvy$X@dGp4Wfbn zZ$xufH7Qp$<&eOg$*{if0|0gZIy1#7zR$6DhC1HN+4l@Vw1V$27?D z{h%%fpeVSS(t9=~aCJc+=1Ur%>w|SNpj?Hw7^`%f%rw;BPbDkK>75lu&QtItV6H)7 zJsg=!GIouY(88eNNa0sE(Jw@3P{*SfX%m+^)eMLjp(8ZU+VddQ?a#Aa*4HT;_vM<5-@HTOZ($5Xbou;&fsfNO6u8^ z{YzYX=J#H(d2`((lpD*!^uG{UTPC8_3L2;=9|$v{AWc@UshT`&oV7{TRV~<9lmpQ} zV>T~s79D@fvMjSI{sFOy|5bZQ-A`3bxdWjz9#T3T5;7e^>~VBK8>wlAtPEyQk}__GTFCCniBMK4|7Y1wzKkZ!v3@G?jLWzPgza&5c1P&3LiT2{1GfV)!s^ zHGQJ;zobL9OheJfVt8vLtI*GNz|-WbU;lZONRdYTF-#J<*y&^|g2%>9E9^ zyb%>aLGc>ciK6=w?KQx7r6+CQtH%r)*xX1Yuoy(mWzWHBBEj9VS5iyTBlf;CW3q^u zWrgg?HOwmlUdcVaa~>W0aqx%1Y7_%B0)kc!^b2Yzr)xl5 zFBS-;WMr1UubpAs4XKUz3X5iHkv1ku1mLN@ZtUUPb$t}A4yw5ZJVstc0o^4l0gn}Fob zLeo)e(gz@i9LVCB4|pSLZoDBuzq=6$1l0M?Dv(6Xy1DEMtc6{|{-6>|<*XNm** zRNuc+AN!(L5a*40%P!ZD-!6Qmajvf|)DnVUv>Ku2mn&OGiwr6ebEv{LIg0p0oB_3Y z1L`H!sHJ*Kj+ZvZ3NLt!B;echz`$#iIOLfD(C>M{0_cC}eZtm(O|5Ot#Ff&Nta0%- zua}|Le^*qhnOnciV8Yp@-hFT+Fl0%0yo>Ph&Vq7KHa_BahY;+>3vl~0H~u@3q*KPU z6aoNCd%icSF=TSXL!TJ8J-oU%tEAbpFKB-e-n;1no_;8+SgA!YhQ}-9TnGrM*<%Kq zot+e{BXVLC*OH9etXj)Jl0CH^NLH{eKH(!>X{Ox=XsdykJc%oQq?zYUhrgn>-%W|x zRhco_RrpLjXtm?OZt>xfxAN@CnF69U|NNem)X=r%|g$p~^;M z?eGT>Aw4nb%ZH{xe_f^*opl(DIP)yd0^b?jD=zu3uda?!>wC%k7R%wtQ10W^f%9ES z`<-=3;kAEMJ-?Rq;A_9Nla0LKn$kTpx>~;jshP%R>I2G4OT7NNW#!1f(kflZlou=P zMCmz&lx?LWp`}K$jdu`+XdjPZ-`GgarC8wI;u^>u`FUHJy4(jDgznmpsy~qnleAOI zc@EV}xB~*l33+!m{H_t!)o+YTUt~w?dfb@&p_}S-{N8yd=FSYcpJ06?D)3{zeDT}x zk55dBH&8HNzxbRqdEf5tFOgxaraTU+QvA2@%KEx0C)r6MG$GmOtt)=xmik_Zf_|5U zedcbfA3g}v=TGWdCjd-onfnLGk0hm}yqWs^-%t4JhqXJEyemjH*#8_Do$dQppxF;@ z1Aiv1KcG)Xgk$208Vfv)VjPOOXW4RVocr*!AYiwnwnOK}>fZHGyiY`h)XeU;l4C0H zhGzXEI=1i_^hRlIoI>EuaIxm@I_l=~{@!s0#?_)BpXg%tPU!XSkUKUSkWjwI24%(R zclch|)O|*~>+r<3M6BzHDSF$?ACq;JZn^Dqgg7r7|1?41>laaqb4#)%yrDAbcYr$IZishPR~sy(?sJ|NR3HHg(fNMUBkAdDjQc6c zn^k&em%6lsZu`Dx_t+9=!#Gx1 znwY+}D(M{1(zjyqVn|D7XMJsr$`g1#4r8W4rSs|BF|V9ECj@X*%NG`3p_#s9^U9VA zS3~qtAxF&2VPufnXGUdO`J*%VuD|I)rjcZHa&NDU^9@-Dgpf`+h807-R0>Xr@pea- zvP+5I=8O__7zSN~@;C(u%mru>(Np=VBufIBCm-N>3{h(wLz%+Hqn6Rf?@W9Uiy`)> zb3;-hSWuCM#!hmkIj@na$B-Jqm!c<|Ib#2aXAZxU}o zD{or1^xr@Xyb>i7SW`>3*;E5n(ckM~0@z>-w3UD#_ff7a|>2f5b2gMiS|< z9Ui8nV4ayTp&YZ8;3z6Z$<(z_rsSsj?^B`42a+RqAp8a4@SokKH$BGU`Cjg)feqih z3Rk##4rvIQ+NQV{ny-UY`KHP=V<*+dl9aQpr+0P52t0l(`2C_~L86UL@S0iSe&t4` zmZOFqlxTZ%JVIs7s1Q5ePnFuy*--5tK<=F-9kSU;5d;3EAxS#-40!4uZE9tM1}N<_ zoEevcpRvm`S;qKnyVF3q1gJjURbE!9_$ zNn&l)0UquXWq+fm{j)LI0tb9#zVd|L(2&rr-`p+d&d0ZXJVjaGv^Qj%(ob!9+T@B< zP7ebx)vFM)fLIGPR3;V}ZhjXQJWd@coeMZrfn39f{Hk#A`K6Dv?OpTWNJJ7LEG6b^i(%->e8mr_(616x!i)Wu3qj{~p`{ zg5)oY_i>_m<|uGU%US9oao;-a%$3z_Nq)usIOfm&Mh4qv)D)D#QW+)u?^%)3H@U82 zY(z~(eUHLMJm}23^$^ey&+yI_GkdL|B8 z@(TM5muAD+&8g+P1}H^W=jVce_3@`!_n`Kk7vjZ$iN>=69DuL`WKF+{;EEI&!Q>zS zPKoJ@8u9IN`UbEWz@rE|QvgG_3V2SxPEQPa$ITK6xh(zouwhhcf!WA!@@S-A_)8;g ze7kcgxjacB57gOjAi@40i8u=}13Yaqwk4X7cOi*_n0G)hu{Pm7+c;aRYlp27kycZ^ zt`gZ{>hyuz|08yaM>le6po)&Frwu|B2k4PYoL*o8$AeIe+uHs*fYkaMC^fQjc^O16 zvWC%ZG}D~314$#^)=GiQz2&$tf|;uFfM>mLWBqM$%-DMQ4tBG(-ddNX#Egr$d&(61 z@gnr33|#89 zUknzw_E{`Dzw#U^sS5e)6W`!xSD;+*Pu2B5SO$<78y+VcVV4oUFBIgsb`9u#sl&o} z6%T8-U;}xeT{b=d2f#Ol)qrUNHb)lYXJNC)npQeTe3wIv`-7H`b)wbqnietJc=J}zmq<(_1&a{Lo|0V$ceQh`P+YD-&{b^g8jO{zuko|{7b}_Ih@w9L$(5Tks}39rT&{<&g_sL9!&Zd2)IP~6SD*g?sB zF}*u(+fO!uTPd|fjhK6i#`|mJH!Vjq`bhVz`@%NX_9`qcOQBe2;C5Q2yQ7bKEh#Ub zZ_-)wWTQBTGkD%=Ado;+Qgw@rMR0E@=KxKTSrw@HVZn=kPq zP(U{!KI6b%#1S=A0Z&)q>3C*9Pcjk#YO}{Rn$;ViwTch|*9inX zjs2SLw)*%K&^Na@Bo)ujoCnE^V4m86h{C%*6vqeuk@$(ML+3^P(l~n8C}y~-wR6fx zsASu#&;$iEUM233s{}M5xw22<0Y3dobcK~pR`J)G9hE^qBSQtL*7`@)OJ3M``~iW2V+{ z+C!Xv;-HqgBS&`jKo+YF^YI161A_^6UK2wx&7w&ydqK_ixXb@M>G&t~Sp$Yk+QP)m zqKqjq_bTb5&5x2Jt@IXVQd7!9PV&5_WgT4T-&Tm)?9ceSwa>cp_eQL5)KPn$B+yJ} z&%5ZC)`mR?E5cshdmpdyWlK&VhjOW9>CmQ{AP#!4*ZsU^`%^P`qG*X<(YA_&vW;1A z`X%Gy8-M0>;VbOR)WKcci&5psL5l0G`m_}e6T3G4uT2~9iH#yaI5my;6hG&0q&6K0 z5>5|REtQmr{)qjwYxn82)RjeAp7|ZCjr$D0yKfjdQNFRZmhl*2SoFoyfM;_&K5dMA zJ05HVejh(zTN+M5$GxLc zzw)*ITeg6|T2D6dzBS^tbOz7(X5CYbk!TB0R*pB4W46sbYD)cHGpG3XVx-Uc`gS~1 z{owA-_a4x{02$9!Cv-n39;%)GKHEjX#+!V~!5~6x4FEJovb`nZly5LTe@?n%so>=oqa{Z05K=p6Q**Z5nYcedYX-Qh!9ufu^_otfJmEz#y6a zL2|C7@gl>3fdVQ_^_eRCmxRg0#XpuGqxN#!^(VZ#*hl{@0^hx>YaRj9iZxHOzTVFT zf zUO9fu;fd!|UuP&C~^17D`mXMCgLZ$3RS$%AT4Yw}QRYdl~ zCcJ}N<2u{x&+Yr~EiHGSNhP_ksHKl1W*nVFkn5_JGW zfoF8y+09X9A>3X2a&Z9=&n#L4furG;Y4!T(b>{zM-hZL-Frdf`aNlwL5GO7GL*;Jv zCLib|p>gi-1J0d1{}% zeeG!X2ammUrFgc;N!GK?rP%3|l&QzZM?l|XS)Z(zT9(YgZZk)ljDbC~q>^VF@E^AK z_Mrv5%3TYzvxfkh(LKzpp3m zk@)q`U+4&_eL}OT@6TK+RaE(?Yo%{&vQ**x$73JqwOr`u-SlHj^x8>k`K6a*s)vpR z%lRVJ?9-nlR54R#6ogZa8i(<96)@bi1A>Fp`G*UhcA8>&FR@6abhO(1w|z{S``$O% z2xAR)uL2%2D}8Wt4jy>*=EYLOcy{!qmfQg&1npBr$J|QEZJ0n+~oul%)dx5HU?#8 zW>|HRev{+Ol<*mm+$w>eOdHDAMyl$3Pk-UM9BB79r86M}P|5?145bgU9vGDJu-#*9 zsa3N8&+_yxUgK_}a?wA@yG@{irPe|ZI>RaA?3@>AUs(uLP@LZr-{ z^9UI zbLG|G%O%{Jrl8uBAS%B8KYsm_`A<(_V(oUTG`{=~gNsMT30>)<4MCN|^C@8j;QT}Y z3%r!0Rg69ZM9fVjpIdrEpx>&=qpzLWme|#z zkCaW|la@1Z0PDL#1Ga&)gbor~#dFw4-p2nI{Ag}rvCpvdLuo@+Tr{wHJ@Hra2apc0 znI3#HQvcXDL4OYS>K<3sez%())UP@8{!^)suprw>MF@UG%}+4RJLuxkcw30;hr&`D%7v0fAD$quifOjLt|gNq#5>P?6NI)t6B*kUz~ICJqLH0kmM= z2G!fSd}l6gBQ#;V9wUK-j2z(!@mrQx#+Ae*0r+r@7qyF%4g4Z~y@ z6IkEn`)Cw*B!`E-I-_6+{xInKq^m55S_-VU&x+?R}VZc#3mLUI)iUG127bxU_wqA(jNyV^F}nT4*{o3oS!c!Cnh7^t z>FL6KeIOs!IKVJ_8EFtALajDe37ekT+}T_LE`S$4hu~vvr(I=k+PB^(o&Vgw{1+%I zdg$=YA;trvh6UrOu>V9Pgj^^BDFd^=3yS)i!ihsx9$S(Y&lVS)B=;>kn#Eo983)a^ z54*|cdKrh7Xx83pr5(MrWPB_3lT02&MOA1-mnLJ}k*ov7R`%t{NSs1rJZX7>!%jsH zeWsSq@Y<-owk=$>6{U9)EIUnF5MoXZAk7|@4q-y`&dGgi>aI{x^0U{sYh#wa8EcB| z!wKqHd93x^gv=oCq}}hp%K&U`(^=Vg17Z84pphnz2CF=SoO3gCB@ z&$GnYa4uCRb^)R@AcMQ#|MGsgED0%_)_#a95Llke^ZQIbTauck39v_BWH<7ixw?8j z;m=UR^ODv07a;ZaKRI0j4;@jep`Xco=g1|XVF}e1HZT&AiJf_=cSoXOhh*#Y3ku@% z!F6xDO7f#JO?CE26uI;lnva;r$2kS=A;9b(T^V87J2cxEp97W*T?NkK%QAE?de9}Q zb$mlon&Gj>*M8B3{~^EtdVj;|#@YJ!eSD?8cR=4%LQYK7E-tJ?Zg~dXb}l4+o~o+I zA?$D@ku)gZ2DzjNfj*VkFJNj08Rz5ypXlW>JDH z+w0ru7`@jdma)yl9L_7XD6CY%nJK*0V}~JG!SioFTu=hh^oW=a0C>@8zv^e<(-#^% z^OYNTRkf@~h#kRCAXoDltpJg0V&NBW>yIkXe;1}8{$$M&L(Lm$B6%q9K&7+;V4l%N zQa)|58KffE54&`c@lO)eGTyYd7->>3`WAkdkUN9>kW-KK2S{HBe@s9Ds;N|lPlJw< zCSCJN7_%&K6+4~u)r6(u=5~%L>N^2aV%NFxc&khmZXUD8(h6R0kc5*{Ha=vTL)}M- z9J4xVMAH423<&ESi)C+nJ)MF0lAVh>S_BZ+aCxF%#fbIRJ7+Ax@^#a_V z5qe_e3f)$Ba{X!!k(`39nLa1my56jb?M`3FenhSqXPV2)4bqhp&@D;WQAR3nI&igA zi$uizn33$*rRc>=`uVf}m*{LhYV64QEjMLd4`yU?!u2S~t9Y=<5mPB+y(WKN&pw*u z_ftDd8L?TfQ50;21J?LE9mt4Pna->m31R>iyuX1zH9*oIl%d`8sLxP&3FxIJjF{BY zq5Fc()FDi8D>W*R*4kaVhZFTUiQM9k6o#ifra-2~;3iF+E8} zy0oxv)3g%$PR-R>etO*ZKxnkETv_F#d`{|%l~V`18I(43T6w`8B?`~c)N)NdQ1&u< z7D4M(BQK-D7i;l8=Er4Gcyuc%xd%z6Nh4MNB?s}8 za{t)4KiZd5&EaYG%?t6=(xs*H!b)!lqGZkLcIGj`JTKUE^9gYMgE5F_zN?1h*`?-l zQ*;h8Xb(~O%e<-bs=bnIh_ra5#mpK!HO`TqsPIgbFdD~|%EXF~kd&Z$B3ij?9?BgG zwdbgLJdm~Zeq$*=wn(}_h0|AIch1AzL;Q78;QsEibgW7J)y74QooOe{VKNvx;aL4@ z`$SrB@#ZHUF}NMD&i=TC*d*;`5`?XO#Q2x9O2!9_QzX=O*??Ii?77`+{%{lFvxput zC6)T&0ip*rqZG_iO&$9~n`j`BV{~B&R5>K9Q1=Tfg4ZnIeAb z8cf3Dc}`WXIRC*%ZMZ z`o#qfE;7-oKC%KBc-pRxgeLoC?P-q&{?E3K)L8>ou z*|-GJ4VGws7D`*18va*&sv%vUd%wzECNp_Ya&@&h8PzT>h%=WJvC0D!#vy0Z7H}Y` z8CA`AriyZQq0aQqPd!%993DG23&&`#!n(=szkm7?^Y67FT!EE3ZZn6m73%qh{Bu~d zCFW`4q=7niftfh3tuW3OuFWAMOpz|aSR>x+e z@j+(=M#2x=bQh%{#J!(TYOWE5g_x7HBXj>Ccg+TgE@_OyISW$HLQM2JJkni<;5oMM zUOIFK-|qA`kU*k_%0@W>2|M_>lCTugV&?f~s~s^^O$7yzhcmSn-?f#7>rc|a;<1<2 zh!@m$#9V1~^QM^0VzFFx^fH>!r%9nhkBhPo7TTD{mQ$mYB-q-=CmD#a@Pn#FTs6yOu)R#xBlekcM_R zU^&XY`24DS>2D1>R#r?R3#=j@hI(QC2_h)i7ui)C%0yR-VS-$BwL3_1jP4zh!ky1P zk=FWpDAq_bHVi8uW+eY?W70otgf{GRGOZ8y zLon5-1kY4Vnqoh7;@h@A9K@=#l^;E1qN&p22dTe%;eB}*B+NXq z+kPWGhSlVjn;;IxqK`Sk?$S5&$gouJOjSB2nB1G3Tmhqxa_IBzHWh;`xgv?I=rP0= zFJ;p;xe;QKF=aU#PN`QkeUlC>17*al91G%*Z$PkA;nSWI=O|{k0ki}31<`Tc{fQih zWR9j60f313QRXcBF@Ypji!N*AE*GqwAx^eql{;7cx4E%OJ^Q|cci=NMM9Gz>gIAP- zSMC66EiNyuPvP}3Sn12|y1P$$vl@}Yb))Wx!XZJC$u%&x$or|LiIEMF{0zn_zHdPqSd`_`5G7wo!A3(P8m>;)C5ye$85 zA|La0c2ZVukT7_7c1X5@vzJ8flVoKiaf<@6=IRL!^5rmZ0TXmr!)GQd&%S)Km*g^N z?vb%@@*(6@Qv|c_djTDgdp-2u4SV<9D(m$7C7RUkrQF;S&Ir$aZBLHb5EJx%D)C@9 z6bU#bBHsLY>g?f@^R;RzBFad6nT!_eijfEH2XE+RQ8v_19mXq|^|MNR3R<~WAs}Qd z?D~{l^NWw*c=pn7!+F}Yh##fhxHrS5@)aPKF{!Ob&3Iw<&RBcg#BDQckeC0mS*pu5 ziJlnvqxqfb6fvF6L2f+}Lp(O%**zmlZ^-5&k{7!o_k0V>N3_<^>;AkL-jx3R>O@+g zfxIrWo8+n=EJ`q?2s!p|nI*#hFpsRX3jtB{8YPXRI5`DgR@=4As#oeJvBtk>y*A14 zF&=SXF~YUm3SQN6Jk&5z2v${aK0OS#A>7uT@PYBPpY-%y9)YzZK)$}dnZPIpWYLlx zZZtItjC2(KSr7{66O*`Kx(__Mnv8jo^F%GqRTHEgvGG@YqW~~ZpWJFrpYU!R{ptm5 zAMCe&uRM$X4NQjqaMD-W3!0Z^Ke!JnkxrZZBoE(M7W=FrUQYUDt~?_4gDEFG=Pn4d zv??kST`xFh_UqE@L`g6+(he9cs~4>17+I8ib9hP*48~0}wO=FLE8=S*>SQq~ISNvaOw}}!* z0?pcvp5AD0-n=OV9zeO)2e67)vyI{M(42&$g5N}-!re%UA_(x*lv<8Q9tZg=jIf zY^UF>TgBk>PMZ?o2b4pvQhg!LnGSoh>{PLnH%G<3*mtgfHI%vyocLe2ZLDZr&32KS zI_yMln7kLb(UY%mDAJK-F7%+Wpv%*#pT+vJ=C3S_Y z|76p&%rDiiE66MC!#|u+diH;dgg0DK; z!(HWv+&$K!sCQk#z{~NXXY`eYoZ zQm= z4*Ul$VASW|1CH86(9tU=atFul*Ow?>{?XrNX-^Y=r61hh>~sRofogIX=jCToUXqZy zHXvH!|3SjVPfrz$2LTy_2k?AAVK<0RncPJA&`#k!y0U-9t{ikYs{cLzG3S`$E~|&i?q^eXcqoqp+~91^;vi>}{+PrX5bnwFYQ1rF ziIpFBhMQ4BzQ2m`Y}Gq$-bw*M;-{s2e5g)aJ#Y=&kMF_EP3JqSSbx&Bk%IHwawAPT z#aRQvpHj4pLWbQO23P>%9*~DkZl#=I@eGb(^_!{!veVt4NFF1q`1K#+cDV_(D@TZ& zT`|gs5wKkbrzg}(U^wBS7)FEa<`9eEhTrEd!Z1q~nLpuw-#%YLe(9;bs zDy1+_LDLFZ_~h|FwD`fgK^4<8vzp#E>!05g&z@6ucreB#v(}Wn+9M5jSt7d9W-q zUPEIz%_A>N(HK@OQE{7ytZjWw&!kTwL7bkvk~*{0z*bPABBwazh~~+me)MY~WUX_M zZ%nE{i1e|!(V1Nws|hzEPITCitLWR7!Qf)V zT4#vnv|&n2U;Jn$p&VcxiRz%lmS$SsemJ66U|)=LuYZOU(jsn$SX(7zSZz>r9YpC_ zGsjs!!^`pXLT`m9@Bp>Hg&|habjctBq$R&aafEe~rt-Q%AQ3|gwR`8oOOA_wB%l58 zD79K^PmPwXJVDGw_9U6**9Am=Q;{K2$I`IVB>=pg5NkW~LaA0UW*hcxoyoKt4a|Yb z5;>E=?C@LsUe4x=IQ$z{6)6N@T8XsLm_2z2O1RvhzjrAQJ4;q<870Q=zWvH{EI!63S89usp~dutrCKd-zG=uGl$ zW( z4wa7>&}}=H8JO(IC;fbN3_y_wm{wDDGYaU|4prH$XDxZ?|m*maiJJNIQ8mrK+vCT4(?nrDU_D|N@OCW0E zLR8ucU~Vd!@4=f5JcN6g3k_VDs&WVu?8F1ak zoN@d7p0tFnm(StE?t;;fl7cqUG@i0`)D&Ois^b^z{bQ&#l!07Cp^afqDDOfjNkiYx z?7aE-ol9eD(HW@Q=n1;?uJRP#fWCWaCVC~vh0drfzLFY)eI6q77oHx5@)5@DSr&8&-KIVf!ZAAJv#5^9HILk;n>*B-5Gu=;8T#XIJrkoqqTMw5nF*I! zLy@Z1>W{i(yPi> zx-C>`Po(+X?e%(xSjTo=F%zifK|ZKyd2k1-3h@gKRBXOD&nwfjqYmbKZ_bUAzMicj zI8I&I=N2GA5>-=8J*Q`9H86E3D)5PqfdsPWw}4EkXy| z?UsCH`XNTOC|baLgI|MSkG=hwlLJR30hhs@Km*g8uv# zlrsXI#XafmG5|6{hUjXN`v${vAn8dmb{c`IT!4W2y#`1Ro>y)mIU=#GSv!Zb5M=G^rAY^AD`?<$MIwC1Bgmpw){65h)=YYtfu5coi|DSUM+*R9 ztn;QmEX(BxdL$|?lXnbdI8p|nO?$Zp=@Ed!Fq4RBINzVPd;)Bf4hTNyN(WXJ)T)V% zzb!MctEFoeBwnPO%B97~xql+@2nYI__b#y8Z|yOv$xrO|)sqt@9WVHZ!U}X;J;7jI z*EtG-$aq}ma0Hi}oc$`RK|iErkn@z;XYOu|KA~D?(IePTaBHaeHWR;%^Zncq1^F_{JME(rZg7nZ@~ODd@aV%^!`%x4X1it^=vCuw0a z5FYBV_2W z&5xu31AZFq6Gd+6#2tNA)>A&Y*6_C*-Daeg=jP+nb+%-S3+C=UM6owZ#@}4@s0qY? zc8zD(WIn!oiON+by@9Zl`J3b0JUc@qPw&uR*%_bJcOBOGvaehVWq*7v#u!=75aGWJ z29CSOTP297Hwr(;w8TMD3lTcsBAzPLJ@?3E-b<~=qHEgmpMXoL<#3JwaIykh#xcOc81LSBgs3LF$D74byGN_XNXzoZF;y$XI3ug!yXakh<)hlU50JGk z#LTBMrgW59eIUmKDKndvPgqwgT#I4M*q~^6_txmc$f||?kcN&IP0nC7Yn;{!v(GuN z?0CFw(VV6lf1!O^Ny~&$T}qlCaOcH(>$RIsElZhFOdi~jXLZ1$*x~>b@UG*)2dRIS$JYkGo@OU&o9E&L_Tv_2+ox{uRBHAQI z?)!eog>VG;!3-2bWyfSqmkAoV6X~o!RH7KD-JKDCQ~%>I#ZtA|eqi3_W9tj?%!}<{ z65oXD4Hp^7QY71F7B?9xEqk??{_XCWP!*ETo|6incjHd9DlYR%KWmu0rkuzQ=d2)?}>k_PnJ`TiucRcSrI3vkFRv*cE_5;}i#$i&%)R5qj z3Yw}5UIT_*YlDrZ3g_+F5Wtgq_2-Xix7J4pFr8*37!wkx`=)(GlYhRiON}4&UQZ}q zlV6YJvo31+aEbs>xj*V;q|v+sshr0rozvd5oy8+ zgFohMn+ue6ixmcBDmJTBPt{8{ow)|$9zFe_;uSxyjDa)ZkVrJ|-Q$DL;WPI(py8QW z4!PJ95OB`?6`dv8I2_OB&z4HX#R|`GMP$}4ck2DV8jf*4i~&$XV3Rd`-w>o8d_%%a zbv9PW@F|dsl=ay&b7c|_QRbtPYVdiK*JN$S7a4x?2eCN=w$r|T!Rp8Zo(h=YV;IEF zk^#VwnFavyB}}n@PMZPJ6k5hO>A4fx<53cbXv!a!HI()S@W2TjRXVHg8=>w{qED=m zA72>1b!}tNi;h(^a#8TQZ5+^hRD2v)-RIPhK*9{%$K*BUQ@elH^<^ex2>snfYvP>x zpvLi`tAekhyS*Ny19+NFBx#$B%4KeHVWZ7l4^t;`nnO!bIT@FCriy;4y&Oz>i5W

      VoSDlwPF}HTpXD$uaVxL>cZJ=JR(fu_m)p8m6Fk!|}M zc@C(^+-2;w(DbYirN5BAB%g?vQoM72Q~XSI5NTw$Z~B|rn$;;4q@d4vf~}ic|MJPc zH54vq@q6vW=bWAe*;&^NP{Ng!T!Xi-Rb%nVfCurxE6 za?WQRH{_LU51C-z5pcxy!@ITQ&wr^i-O($0sIwWR4~Cuwb}`ncF8RHJEW*A=y(hg( zTzTf>0r+T%(9dHD^L!SmNU|Eq*OB#-W4G4LO1~);mEuSmY(VvWVuUZJ@)CKJB4*eM z;(}4(E3x&*=cP@me&d61x+qt(pk`tBqs$dkUDH%=yf-RN1Nn|rD7a2pqQ0Wc%L*U_ z)DEwP4)NrvzM>T9n&ciD)r{Msz}BgsF0InmluEsO^WFCiFz;rrWOI%r^`zi(^^usX<+7IMEk$KwQ2)Ss#S|$YE!4RSzzD>Uah#*(uf6Pk1xTf z`_}VUX18-bB>S0C6&3A3i`KgmqtD?9n+GL;en0oi9Is{Ix_*D?rHB2K*)D#sqJyuk zv&R=+EOE`W1*3s}|B`8S;<&`vx8^PTilv+TshGt8N|mf6XGU8Ge`YQ=k7KJT;>owO zjJ0P!(?3RNI+W9$ss0P42_7ZZMs_Z7Ojp-yzm@YU*S6mtc@j|gep}Y7*Pdpdiba<7 zM22E?ULwJ>gtI0YWB72MN7M-bW(SOji&8$d%69KwYG&2g@lKfPr4o-MZE0c56eN&Y zs~!ZQ^Ctcp*D*K~-BMDcNW`G_Xah1FflbLjHP-{}06Sg+52ZVQh+>FmE!(H;+!s!` z90f zLIjP`sYfIUk$cRMydWj|^NLrafh^HQ--Qs>Xr>gBT~-%brr)PYV=1N=rG_#{>@G)( z>8ytoE%h)OXGO#VOf?zI;RwL#nHiRD{y`0~fonOwMH<6SY2%ec1@|Tm8 z)L-361c}S=Z)KgZV2iO}uqUn@;Mw4iPc_4SAO_LxPBHNhkfgyNR<)+0xAjth)_onw`U;V-}5KU)0DAoswi-;xh# zQ)9Cr%W)pvOxd&6pSWlzKT(*)C>VFy z4cHzx8|&4~9G(&d0AG=GQuRY+4}Y)kul&WZaR`&25p=$fFhWF7vTT*dSGn>VM9Hce z(&q_7DpU{U@ld-)F8)erEsi#ZUwqDeK4sSOeKe8Xan9^vn2O;-g`%mlY!261wsGSU z{Y|J)mrmaq?lJnUol~}xmr0rN-B_q7#%%T3_|g)yh0tO*Q6eoSVCT=1ZCyFROw`L$ zx;h=Mp8i_qHeQsE9R~COHw<+01jRLFbQqFW!}fY!EW=jbj8`P~1y6D`@ra_`^(L#n zmAjvkQ`V)U<)xogFI>_C(;nA)^C4e5jgQplNJr5GMaPcyvr<6kgn?#z*bu6t4|}tg zgYa#Tr<%yIWv~gJ+x_H={`W`JAhXxBCrvf^SzF0^>nfkdcRXWYb!v>Hx;uz2nQ5}F z3l}n*=oIL~grj3Hx5Ihf?*o!2^Is!Baqi0{Bv}0N#Y3t!$zqPeJa^iJ?5VB{a%B2g z-~0H8(SI2DeqSK@*z*1R7XVbb7m|=$?LOR(U$~7~d+_q68t_-~C>UGsJf(`jbekDbBa7Ta4&5w^v z$P8rH(H?wG1Ld`;w25hRgX)b6RRQ_+9i)^8fB*|9;|XszOi#b$r|C8O*Pa1~n}Vi?7%pG*u&j=%B-Que~RzB`4b@ z=-h4~d03OBBLLbw$n~$pj%oG3j##Y*VLU)qg(6%u(FP8FsjFt_(C#6X;*95%jm(Th z6PZbxgDK7ghUXrJww}t_ipq&(+W!B?(OE||{kCBorBj+wA|TR8Ge$^*#H4YAB5ZUs zLJ*X$(J*QtAsyoAmM-Z=8YU?dDbb($etrMq95@?0z<8efy07bV3GP~r(#ipASVO9Jv2YRye~g7;W46S)i#{(+AK8(ur_t@B zq#RWWOY>5l89R1PMd9L-XDg-mp`w5?8O%uZL0h2~niVHl`lL>o_fytM6!_KExd~F-j=&&{zmYWwm#E5~X{;=rEP;jJ=UA@jvSy)Wy#G zE3Plgt%hpT^3uYcdj#2_jOJ4BjrtE&iiP9mWTJiFp~^$pCRx>Kr=Zk=*B+4rk6-Fx z4lxux6V&xi-H_k)IwrN908T6K@O}Yj*rw`Gl7uOJx$BRS63!Y-UDDw7Ng>2$aLAY@ zAg1+`9}g>4>Q@yc<#Jq|C4+ottZeM%j^^DBsyFX(8W@x&^*+6QQP&-QzS3J9`5wo{ zQY-Wi^E-$;0jc_TsHeK$R$xvB%uZS`85|w1SBN$2Mj(LlN3$W`&hwHPIjfI)JW#}q zFNfe?sC5SKstIY_nG?5?;q4mbk!e^OZqpmBQ~hfj&UNs%_-k?Ag`qt`F@}Tg+YB%z z?k!S!Xq}Q;OH4-EAm6bO2(X1KSARESv@Q2ZN60A+cMLex>10*GPM?;zktZHl$$2$- za2|WsZ4W#J+qd%uJ^{SppF!_JSs&6zlc>iTxe4ak9hq{iJ8%L)+F}u14WM;W^f$K) z|L;XxK8HYk@-~t;zWyeDfW0Xz%7(H_wZV#|HSk)X1-(0gEWoDtPG)$b;fK5e^cN?V zhF^(ns79UYXLlMbq$9^becL-KE8zP!N(v+5Q4H3a81YQPt;SA5e=+DMO|-uDzBb3h z0OY(w-4AaXl2oW+Bco1Yi;v?)v!DCNy1$TAxOvE-(Nfy-8GyU z3b+KiY~wn4Q3J6>wwTW=xBtz1wq8N36XMZJuxuXVfGZ-)-iZnkj)O#0fU*NOAj|%7 zTJLC|*Jw`qLtBq>u#bOXaoI1hLT@_YXdjJH?Q&w?nU!o+GS^H6RBYh9`W`C40v+!@ zs;BK|?(%kZv#K_m{`oAZCh1daNeK-+@mrOi-q?!oT@KkfO}I=B_Fo(4E9EJty#G6E zMU!06euiL2G&^FExC6cO?U698vwB}6ZU6whwAD&_a9ybSbAQVqV!;CGMGt+SPYk(y}?lbNb z@Q=(I4)(?!g?ec_ADL5rgpZtfOR#3HmjYvBhJcXdEeC(i2sOvbtcmOR3W~N$=)IBx z4zT0xgriUal))2+l$F%OD`ZZCJ!IlT1VEOB6}BwLRVm6V1U$RHcz<`i5c6+hp-xT0 zm~-@hc=41~UG{PHe5wwb&A0guU7oeZe9i~k$oXyR2RjpDRo_!BPU1k5=QoP@RMXV! zZ7+crN`ZIE5`Vaxy`y;IZ+>M@e+cyBM3$Jh&A5*5kwhj)HS5$aMIGNGP|cEDF*2`U ztAZFv;FygC%NHbk=7mQ6s*a&bGGstcH>>rRgsl3?g&p&3bwUeW2 zV$Z<^_gWd1U(hhfrD38{sr}V>hHZ-GL)V$FM*IsVLWboumDzvIh(3M_#sxA3l>~Vv z790I^8H>Z$G`rkDEj-@9AoC--hI<-NRubAC$_R4BVDzZgvnznN1O@ssia@m(hAc?Q z0#5#lPe}d%t(a2+xK0AZe}%x?l5C3ZM})%nsi+>CJ1p+=vcr#UWTqEvYaE4BYD>;D zE;xXl_sG0urs^zLHC7I(n6AE8@w|g9*)1*Y${{OPIb0pB_V_^`OXIBF(f8GiQ}S?2 zJ7!h}Bic)a`|j(w~s`xw!VQQ#?Fk@N}vV5Wur{-?vX8_B|KOM z?8g6lhU)jCcPI9kXK0tZ4n`B#OLg~e>N+|)+WfzM8v&9tvw;jE0^T_dRF7pB)7gg- z*)XW$RG338964s9q%in;|1}K0ZRw;+XwY!AjkABk^@AX+ddKmM%TDFDDu^b!(PBUNf{vlTE+Q zt~khPVnnn`$``Sov$~RNUf{LfdgltR7L=5fz&eR4HSK*#s@f&cdTH5+`knuubUSuB zEy~=S(WeaOg(P1d{LR~HDJsES0*mc%Ht6T~IF5FQUyK+rtyA+q$%=9iPYr!*r%V&B)>=A{|?x4al-&BWQ9mG}$gG zF|=O$6y)-tcmnyrqv)LQ981xZoZet$lX6U9rVBI23iP!%xm z6NZM0OP>zaQ^L|pQ`suzje=w*N{rBujSbmqHH^S>IRgZ6S+Z{6du#L~5>T%B>}5nm zmlJe7X!uF}Y_&aBO8tSce9M`qwc?o*VkjZN6jxTdUUe2A@dV7*$h)SK6w?!^C3gi>;+)0)u}(k@@sX3cP)@hcauhNn-w0bOdlEt346wu=^s3@UKKL*DXJ@o!K%@)n@Mqz}YawPAQmcfn zR}ZI>R#k^K7gXP)g|y6HyUKH9d9wCD7A&?X(U5P`kZ7txmC5ea-FQ`Mvp?reVv($K z%QIss)(Twl>-e#H=Wp3(ab(!{1IJtAx0yVT)$GA>eT_8M2riG&sYEa*h_!4(tAX|a z?!BfooX|bD>r*5r;A~A9_FiWkI_ksdoU_e{twwXt8yo`%Q_s)XOc5aFAkrzkPssoC zU`vCTM{kr~{$gYw*+zRr*(3wS^Fr1yjX}@LoDFy4zu|y*#ND21#)uQGau60G8NYp3 zn%XP~w8TcaB{=e?%Fzhr5=qbc7FvFaGaMfGDH>O(MZqVZg`XG6;b<+_H#Sz;`>B{| zi4j=dAd^;FeuiHFj`-rokH99V#;dA$V#Bz8?D(gK>ID}F;JyT~Qoz@i{Q@z^XMq^= z>dYpS2)Z47=*s)OU>`zqkJrk|vU^1r}1GKGN7sqi&ST4ce_iG8)55@=*e#KLKv6IjXNt zCb7?W#gXszl!hE!?RXP%@&gW0HFyp5zdDft5saU|f3@Hg8HcpS`xo+kvVQ~kC?E@D zNU{N@y^TGBkt!*Ke}?SYwbK+5ivAN=a=B_6qa^b2U9Aq3W?eQdDb*|v&NDeF)7Snq z*%?_CEiMmcP5s1#aM`-@ymvw_e_0eEO)M`%aN%K}&x3GYwvvrT^yID3mms zNFI#cGH%7*yL`_h_jSh1wlru8^Gmg7xQ%P1ceF42sjsdDTcoKBatui|0OrH%G82`; zS(4U%C@jPf%*kL)nW}sQmrXMcgccto*WEX+bvu;uE0k*pX-^LQe*<>l*M<5)Gy_F7 z@8V7tXE`F`0`BIl43k}KuqGQQh{_}{!|ygx^4hyckU2Q&2<2OAv0QDaLw}H&} zpRqD4S(3J|*TH#5c?zq$Dshw1XFh-MfE(VvBWZ#NtI;sI_oYE>q5Wx=yv@^vKfNPhNK37eiP=~_^NJ=`R7?5`FTUmjHMF6sr z$XHXQs;sv0t#9M&g%$;5j<$=35Y129)o2KALAVCNz8sS>jYU-#9xJ@`=7N~0v2a^r zZQc7|ED=!O2wZN{8QeOWMK?OCHR3BOz>kX@2a#R0mo6KMnVZ1jE!YX%EMQ&?BrOmUF z+AFz{dKRhngb~$Qmaf-AR9d0=n`I|)lP`{I{?JFndHV;EqT;LO%s}KJ&-a++Oe-(j z6N(^3CYl?D-^3>LR{+j${!Swuons`Jn|{uz0J|hWR;Z_aLLve~!{}6;hd4`&u_-^g zRfwG{O(P_R1zTyf8&XQ6(;JXub*6-NnuH<7N{c7zez63zVIpc9lk;dEmWLnmauJZ` z@GBKX$FaXgL;qIi^6aIzzJvhG;Q)65U{D+8pC|313wK?xHU>&Nw zum6w->4#T5h)VUoM0pP!RXJQrL@#`cQNy$*glG(XxO$seCs|T_-!X%%k6DT147pl&u{*FYjEMhO&;N|cvr6*!2@Hqkfi7a3PWc^a#4@KYCa+sQ8vw=UXcJow1@>z<)_#}yY-fRGvV75(#S;9x z{WIpUJUhwX=TnbxrOH54fGP|w`RDhqYipiQg*pQEM!CMHq|l=H<;rcxZx0S`g&7VG zX!nE{*!z`_>f5vd99ls5h8anhE-!bCoSHQGP3FH23CaIwKjq=D{rvAEmj7tL9v7JN z6e(qLQ8-M;5OE50hba66w#TQSqJLy7O9m#0eHaKlOaP`smqnhcB`W-hkwA9J_wn@m zz_<04>p#HUu|ihaQW{&51TOLugY7(QRrT#i@3f6fd#dVat{&>}`vDRQkN?Jr=aWlv zVk(NAMN8xZ-I6$V0wC58c(2v7bgD)DFtP01=}HQp@#kumw-&;D8h3Rt4bdZkdv}Me=AYbf0DviTd z`LNB0#!|#yr71DR;~6&=Ies%#A#-1HvwdcQGbgx6MOD_N>C5 z8$YsOn<-ceM03X#h%g55r&}SxKf5y};5+XvUzN-p1KXYU2{=cvwNlCGFNW0H)z3!5 ze56Ys@#p$uZUgm%U0CDyYRf>MP)IersDlP&1JnjvMhK}a+Mp@=3jT2I?kLF{x|IL- zR-X2&H^M(ln$*n*8M=69ZJ*%HvJ%V zdu7bu>3OAn_Ijo%lz^3Lv@~xUZ)#$;}yUs_iNrQRP?SgKCS!t+sb%}B~$W*EvOE?6cw7De* zIaYUQYzpr#{L?BDUoC~>h67hx?kr5l>T1DUx0V1&41YEs*9?YSkt_cjb0Ue+r)+ui({B6+|>{# zsC8ue63$on%pf-aC{V|e$BltzfBc*T8opvqfdQCHOVx@-TZ+&zJob}MWG8LM7OT`D`Sqz&wcWOu`ulmWp@$Y?wp2xu z-Iai&-zV0xs*;pH9yz45K+vkyjEEGNNR2-NTbWXcWlJ@@ACslfsDx{Xp&}DR-q0PK ziOva_whg+)R%qkQNBc6Z@Wvfjueb!Sl-i1dSR}lQh_frMTj5(A0T}*ujpClzku#fMLli+FbBaRR5T}LFPrZHb>e|2VLg+$&M zv%JyEpN_UXIcV9UjlHs4Ne~EP>~M}VK9H@}i_?|GkwMU&L5$g;!Pbc}>7?`!adSv+ z$iVjuDebz>xe`-ss;9hct9(G$E8g*?+D<7`i1SCsix5sO(=6gTn*TJW{C9;fc;N8%oP`{g1_ z%|i*bF3~M;Wq*U1%>(FCe*NfC3*f))-?8Hur1mRSNc1UrQ6aur^>8KT`>+hhrG$E& zvfC{MN?WW16@lY$W1VOkfiv)nso zWaY0)8t0%x;bKn7)rikz`ZMI5Bi_0e%R8^JWLc|UqXdRq6RroaP)aWChg=N&@w6unT%W&QxwQJCTC9#ay}|QP@Bf&9UAWJf z(dkoZzC7S@|1|79E!NpMXb#wPJdqy)!leA|y6b0uNEgUR3*Yt>QTS_CoiZ5)jBudKZ?2j@*aAWeNz`f!cU-bX( zXgKa21N!gsO&4Y2iy89US@ThX>25@|#WQ<7>1l!<7RM{VG1J3_Sy+?5RHL$Qp3r@N zZ&A5nJWNumJ*bvLy01#B_>jCZ!s&M~C;+aSvC=V}%M@<5=fG9PnCOqUs@l{D?-D>wxM^vdmL?Kr6|dwaErWx8y?XUZAI}bxgRISwub<75 zm%H@_wtW6AqxCHDi7U|QXm#lWWL|BmhmLN#chA7=U-gFofNIJ69M1Vt{VGP9qgLaQ zXRgAnQ(hPg#!f@%@y7IX{}|)MKfC%9@KUBIhL5q3`Y{b*&~JUOvv0xpTXJt0M(2P+ zbV@Pt4%P)X@MPtx17GnLL5}$7Mu{Uh2q7WI#!XS#ot4pT=fK-nG`y1`IO6a8&2hgt zAt#fA%!7l9AD2)G*MeJSx{eau1NaNMR3ZXg*G&+*OVMBMLUQF06`9^5@6uPh@SGrj z8avrAP*2ftYlXG!B))&yLhs{&J27R+^y7a46F@MoMKRtFud4ZSL=4fYHylM%>9G{2 zo(pN6EAGj}Lp6TP`8;HQy7Uhj`MDg?towi%3*04s%RCFHEpqG|GNL%j zK}9>{{RC@{>CdZF2RI}&Lfqgs25nCFw>4COGP3KD`tLRt zo06!D$G4j zgmHcvc(SMVJ)2K}DA)Pzr%yb%xVV5lZ$AJz`HS#s_{9FEmqI)x)x`0|#0(`>k-apG z^o?#aDYZJedHDulCiyi$-ZoZ8V0F686yw;Bd$5fmR{^~8OEh*7Z)AP+JR#jSe7D-= zaK!|F$6pS!_-hXe@Vd$7vA)F0QTr*s-Pga3^D86p((%rzy?ntoR_fq4MoyE>MM_X_ z*E|uwV`uAUT<()3MlE3QU+H}rQT37Q_FqZ|8nTzszAO0a1|xr6bOy$H)o}X7`%Ge7 zbE=WwSZNnd4Qb%L@YJFDXdMLKdzzV-eb1^dZ3W_pL8pfZG{c4}OYG~xkbrpo4_#Gv z>_?V-=6(O})>-4#xhTq2GfP`4lYgr-C%KoLe4*W>Lp@XP=`vP@E3!)z8;;Pg8@iu~ zs&kGtd?V?w`Y5*aou0mYF-mKDeKu392O&w(-jABihf$gpSgjWGLmx@L+U(9jXHkRGCjk0O2)HOd=J-v`d zbtW>ny)uPQF=5TxUPo}eO%HJ0nyun6>*NXrd{3ReesI1?SJ+89baW!?vZab?S`Mq= zMsk!`(JT3(7GBhD~ak4H{`LUMH>NXYU=7n2gJx#LFnU8F!trJ*{Vz}23vMjq5 zw}X*{H7MMBJ~^A3CyWUTDnB9Dl!-A^fP?7(~w7Sj5ZTFE;4J#An^W8Be!R8=Ao* z#7+WexwD9ozh8~f=rfFC@O}+Qk*%ij&4u+3BKS#?X!4fQWsu5bMGz&w{uFO9x0kbh zeP8L_B1?bH_dKIw1cr0MpD58ON>J`?wtNJsvi7_r)3T~BjJ_z8Qt@2B2X`iLm1WN7;EgOJ^~ zzh%6{*mr!S8(D8MwyKyu7ORWJ55(^J6&3us#2=u!hj{jfg#%~kugjW`J9^)2hD34)8MRCV)=w@NJ&yl8sShBs`#gZ^-;|z z^kw`|0D9ZIGQT&DO1TRGXWAJ^CDeHW|I8y0>4vWJmCh@Xb92>5f;k$ zOirc}8#w069w}AB9Pk)&f_vLzPN^~iH5UaTs8m$cr}+i)ja&Is1;aE5+>?_9z?BKe zqV03(`kw9nw8O`%@lT28^Fv$p<{fIFH8OwLpgIl2-ooSxiay8T2JIFiUYr1Fm&PI&vV3~pk~P@k zP-(QD@;GwE416~khh-WvY_k;N|Nf5&rKAMg%>(TL29cW(Yz1Ri^;pV9f7O{gvcj%s z{^TFF2MA5zmXD=>lUDV^st`SI?%mHL*%1RoaZAhra4SKSu~$W&)im4Nc3{ z_i|1O5J2=1Ayf85z9H9**LCKw8ED`%7%#ASzclC3k_U9@VgyVT_~)bzT#I`t7&MEN zFl6P$Tl3M|fCSD_+M$#^<|X8ycPR#WYonAv=uIVI^o}q+%-E2pM!D0MkJJnv!<=c< zj|!4SyJKos>ADdvdteh~EJSog^JztPS z4)d!>2|~&fQ#dUz6-2-U;_bPU?^WnIJu}ALTK}Jfl($~ZWW$MpJWZs+QKJA^ZfkYU zqkE5^nv{HM7HcvOXtS>Q6rPr~8*;0Aya1=>YMJfcfW5K0Reo4(jgY>%%hPpq`{)4P zv|J*nG%;Kt;-!<}DLJh7oV3LF3_5p$+YGot3;#jltm-6nj#}U%N;dsuE^$q1?5Upq zlm9jdfOg@~Fs>a6oD9UK{0x1zrYUS1bA`$mE?@t7{(2OAI}dh&9YV`;X2~G=H%86k z)y5%E!PNfEi4d<9Q1)i%6ep9;4t)WT!D!x*j_5==w0zFIR`-5i|1gJh;G;!~h$R+2 z+rT2?Ro5GrBeE6 zxfhsgzWfqm>jMy2!%0?7lNr^2Z}z$JBz%E`T|JTmr0#e@t*T)45lEaxe>*+(_%e0i z4gQ$)Ma47a25iDtt2aUPn2+>9Ip$1(r|)j{2H-;Hq@JvnX$DC|RgD*o19>jO5)-(X zyMUy}<%@Y*`p2$u+@S&!W?3LpYkr)kjmy^i{4`=dSeDX<>(9ve%AKpSy#p0bT4yot z7PcIo{$+){Md^~@&4g|Mp1h)J?&JI5q~4%p?LPcN9q0Vnm!se&{xD+)Nx6#jVSnzeF2kng4$`7Ir8}UG#20%sZ!G1!nmJR@_UJPB9ascJ zX1&OGJLgV^UQU68-fQ_iMmqIYrnX?-`;59Kb`JU~_kE9{`9Q41W*hbdcc6$r1sbyf zcXCWPe*9FRFapXL0?GeldHZe`7iM^bF=y`1wso<@{HI7?hvx!gqR?eCF5MR;G?4}3 zo7)$Ey*f|(whoa$m#%$!zzX3Bi-nB6L$SQLl^3o>u9uT`Tqgmi4MtwTA~Y{kK#zE7 z)nS4$T>7=3)DBQQpV~s%LzhS^bLF%=q9*OaP3>PO2bhFMm3K=0<%$odz&@_-JoaS3 zWYS?}C_6GCxH}VQqucVSXBW;5PhA2(gICa~a=sr6Z}6si!1st0FXT%FsvVO6I8ydt ztN%cq4d^c^R`YQHZ318N&Q?!3o@e``Tq1abIfyVxnj{hvOiA6#Dm#4=fwz3edg6)t zCJOv|yvbuC1R1R@3rl#9}1xUapj` z#5^+%5UkE}H_wV3Un(&)pH|r`JGf1ALBiXh$4PdJSuY`JvLi{(@DA5Pe{mactxPSwg-4el$A7Yw#7PnB4ZU29 zqS^|$N10-4MUiaMyWQG3$7W;=AhiR)bTYUHF$jY>PmHo{s3^>fZh8M!!UVBu=c1F3 z(YgTr>htnbgG7#U9rOxCcE;zt;5{`@!|&B>TXiDX0)(Cikg1bDl=Qi?ty1)2Efhq8 z9vyJK8M#H}cU$MAa94kHHq*W7vb&wK51HLjUUoql^k|V4?=#5y2k6WLTux7b^Mr4k z!9HXmp}1aO6jAU4voREA{{d_56X;nXiT>agtRAm0T4eF@DH5`No4)AM|IJa z*XjK{n%uEako?x~Sd#vV#eQTmi7?SbD<+uw5$b*jC;GXt`bZQo5Lg@&L6S?VIc8m& zavR*s_0^dBeqD8Qg}}EbUhHD_fBijvh3Sgay~}oKuA%)X^uO$aw{L4l1td*0p-$_9 z$Z!=ZCpK+ns=aTopYxJRBCjMltbj&ue;4FYlOt)9T+}D)R-O%2T)nyOj8U@gT(ywZ z!Gn(R3Dmtcck`Bl#~Sz@T&vHIpFeZ?-(egj#4`ATUl4&X`1_dkZ-oP^78@UZGpo`+6tH@* z+cA>M@j!k*M7}$e zDB<{9RIZu|ln+b>e+=C~@Z$(a(}lx@*3Z+rSdCY+3Vv>j@ z@wbehS~tU_T~>O3uX_ADwbSpk_vLcJT_RCo9nJoqqRLSF`Z`{R$U{Njdm}}Cqcf|m zr&Xr-4Hx9Y1#-vYIHN6ra8xMZ-r zmD6y)oW^nV*<<`K@c~|rOQy>vsETCtF%cF5%|{Tdl6E=7@^3hnTgTu17HURd@SOM; z%aq4@L|R#r^-F&?eHA+EYLIjUhEnZugpP>SR|{hnMFp7o6?bl3Mr_#za0!&c;JxlK zsl0s#kERviz8rgfwgS*bPt9MW3V@!0AW5-JYzd35mbp!t^Uv2|_v1cU0+drfsZ?~x zn^FJ0<`p-GwPJhluvAl_`r1)N@2m!cOcdiba@*8ab z3+RWO+uhv->IlBLwO?K{#y|U&$wVQK=n;BzUtno$q6uMd&S|X+95K~*0AL)H1*yE+ zYc`cPBr*Hx{F(X=<0I*?{MhVKdTizfbG-wXepgBt*qV~}KJ@tVr`3;TQO^N-M2(*{evuO1H&gB*G!DH&->1rhrVN<*~n9bQUd3lbAH$ zfNmJF`z>Sc2Te07Tz=B4b(+6Ju@d*Kym023cO?rF^*u5^@9-Hln(sw7_-nbaIwGCa zC4BT=mdiBw1Z08YKOQ;;Gh2S&4Q>68-4g3Pm8x4H-sc9u)dL?Q5F{r_xmyc?61nx%N`}<*EX4fNgTA48ca3*BB)dKMb5Ap)f>nUjUgR zUG(JPw}99S$uHW)YI3f|%P#|hgUB}}#bqbqj~&Qn>~G(3M-Mw{x9-VwumV4$#3<;) zMCr#?Q$qahYUsvO&g+$s&D7Aaqc2YWr+rM`e}kyKPN=aX4|255K4ZSOu8Q-6TvsTN zpGBRUF^OuJLWV9|&0n4Wk_2OdqlP;mg9Ysyv|lu2_t=~!cB9ncR?N`LV_5Aih+w%8 zW;f9J2*8Gp)ns{#`c?{WI1gf~0?QZ9+Nsr9#vWWTbHFq}X}YhUJ~+;NBtsitTK#PC zVtqz>;^#Qd&bPtD&e(Km!xyBAJ>K|zFZTiHh*+4y@bKWjku9Q`TCp(GRlg;V7YP<5mB*(`2o`5AfbUxq z(T>B<4^iB_3GrmHz2q^Tu+9FWF~s}mP>ZP)hOUrTuija2fpwk|{%f%tOEg-qGQG{F zCUd)naT2aJ`P)`HV-xnl)m)r2BRAh5L{e@{fhp*=!5)eOiUW$+zuZMN6hWu=zyXEN zf_k2iLhm_L?P*0X@p!vr8VF{ZCtU+*zpnGMF7H2PTv?6)s0khPq}-(KNikC_Q)Rnv z;Dul}A(yu6jPKO#bUQl~M&tG*fcO^J^B-?ip zRpt})aUIOZk7%tf@V(6b&RZ&9&T%v%Kg+D(QzB<^=-ud@$-%*y^jnui+c!h44Sk!$ltn{|N*<1*n*DQmo2uOgAY$_m ze`Jhbcs}Z)lN@XxdBF+L5sb9#!23WyTySrE*%@F912)K+cOf#cZ!J}hGjS-(bQEI& zp?DSGAwV`%ZO@H+?UjX*?PI)q4~)N@1?u+-$^}hSYQX@1kk28#QXqf==I0Vz|2LO%SmBePXu*aWL%+$Sl+!JqV*|iAkW+wv7S=z(BhMdKBXBJc;a{LlM?0pzI<4r zHe1b1qqlETATIR^zUC|tpax|})CQPa3t{UQ8wiHwLFO4cXz`vGRNDS@n6J+HJPGYu z%tLsK{@EaNi6|lU-gnyvzo!KyNj1Y&MxxHOnQQl(1_loNT>H*|Y73xki8(qGeTG&E z6==)a^&*I=-D}>&cbLFGynMnXxM38P<()zdl6@M^CyTXI!LO#SQ1Ff;lC$2Pc8MJ~ zJusc8g>=q+bQbZuC(XMqGT_{P7#R;4(fL({OKHs+)nr@8JPS|PVBUeI8d-Y#)9Fm@ zn#-2T=l{9=To78}B)bouOHDj4*haE`b& zA9Hx@Mdni3A@8S*?c!Wt*!y4JpBRlYRFl1)(o(o$QY-CfkVR8usSeOJI9nsVMIykj1H$fXBkIS?CcSqM5&sPKU|&9 zFX^vUx8PuBQTIaY-34yBSBDS-q5TssHs+i`dncC=SL`!AdDUpwB4QR_;Nzf+xAPO+ zB#v2R=UmiF>XRU`kT{3O^oQ{XNKRDeS2*E!(J?_0Ih$4Wk&AaebGR%=(1FK0)Uz zxS|lH){#wHTUe#mWxN|ZK8D9nKz@}hdZCH2KYo7u`y>Nn77fuL|2pta7kt!s#r&-u ziX<+WYVz85p<2&iAU*7Zessy|dMIhvqw!9e-ES=kz~W9w+|5xqPy% zm0(Bhi^MgK{fgePCPum$5Cq}ba-wOr11LlvUo5p-MdDywh(%@gXPU41cuW2ZpaQ-ma4SLsuB-CQ?x&FlW?d>9tuN^?H zFKKw!&^~1!O;FiH#obT6V9dO)QQK^6%Z%FC+?*Q}8OsNh&AI)3M?twzg#@^M{HvIM zj^i>QngWDyOqqd|mz1N9COgG3J1+M`ZFl4;gmW8dgr0C!hBMJvkp2Q?z=Ryj!_@A` z@w(m&W*d? z990c=CFsyq*|@kbrE+^dVVakB5bvtsjV7_-w)UKYP}JkzJk$#=@?NEua? zI*9jS(q82Cj_*l~1r~9c-q;}0G2sJ^%Np4M;rusFquyjL!kCkYUx%n;DM>5Qg%=Uo zX;lS?fU2K15DANQlc4yE$DE|$Vy1lHaG(8+v(G|pXCgs0fByo4vU9D8CWZ1Bpu$H| zsw8&)B*IZhhlq!JE2g3Ui=or0L&2)Nw17*_O2DnVf|qa_GhW47V#l64d_WryC{4X| zGtTddy#W6%aQj8Y&zsTVcKymE&MGdba5i9EuHFE9CL zaXc1$cWv0<@>u>yoHL4Vr_QAJwtbN4)Nq&{fsi1m8wH0vO;ub_j$-}1xAMp!RBv$}Bp zw8-pe%1dULX>;-ArbWDFL;x}~9P(_iZxGI6mD4^^Rasm1{67I=niHjjG@}GJC6>2S z1*|KeGLdpz{^G15(nosJ8S8+rp0Ba=a8qKB!wSj6vC{$m*gN_4ybLEYJehNv{1|M& zQ2i11+106Zi4Dv&NZnv9$}~m~lIPV|@$GXfSB9n}3?RE)ZDiyiDZDG8hVEY5IHrwA zY@p|zxKPkEk3JZ29YG8Q2x61j1^N%{wP{@PIPxl6UoSMbBsCq2>6Mm9Uvesd`GH5sGssv&v{RxqMopegCpJYWVDzs$T6vqT+EUW)iGJaxrlCWr12e{BuV0!Pw$cl z-%g%{@JaDZGAAA%Xmjgf4s@kxE{bJdzxPpRK4r`qn^7`M365vyY;GxSOc-5Nc zu@SmLG3)TwQBG0+&^$5dLqyDf<6-x#%e7cps8((#v9Dz~8_IUgi`6N!OtALs7C%!j zI=Y~3OgoeWFXv=0I?`ZZ0qv9}V3Qfl-rNeQ=5%n!GZ zz4p-Z!;8h%=1Ioo)wj^yp2&8L)NcvL56SJV3f-K7?pfeDRA6Oh$N`+Eoz>{RC1o^G z6wML@p}Pc1Qo+Fe#b-$zeWv{gP8>UbxhU}5CSy(33*DcE0v?=7Le}kkK!=p`s+8wV zDZp|o27GwGUuhLRSL!fP?9}o>Hy1Q#(MoV(Si!2zn*ISiBW={)V5Dc@>ztuUy(wsO z`J zxbxlzxr%7R2(<-+3&>btBzcCB7t8hJdg>_lPRsR7xCpm^X)HrD?@nkoNtD?4Xp=-% zzs|o{y^@MnIO9JMuJ!y~ltk8Q96=*15D?AqTr-$`w*G;1X2XT5SvM49v%ylnDnvZ! zzIaqGh-gDr)4d)B#)$k;dJg|;nwkW3(wg##U)hlX7(9=8JqDVD6w>HR=^ zzv2yirbKLvgRcmEJ}Q5pV0rD&@i6P#IXm(-B z=6*3WS>p)mKQ}gMbMPR@8t@>i=L_jMNC6Kuye~F*D@-upr3SMrmMGNClPHM|5ykPi zP4G%NDC=jS;v}MO%xe}r!T3}@c+{h+l=}fkMzVs5@}8;t(d$>QKH2B6hE4ax9wmyx zGFsU*HMX-4D)v;6gT*Fgh9EpDz)~+E-fLRn(caL2iDuJDQo*s4ggs_~`2L)I7VjK6 z%0braW2rK*`Z9lw|BpvIqN1;G%;yxZ{85|n}6*U4;zv;br8<5Yh`1NE=MJiit|Gn>rnXS-lx=bBhykEjuBuSe)txOF%2QwDY zr@a@QKLQ_)RxZ8KXQr?USFO962#i7XTVIQCT#!V&a;!bfSNnvaR^=7J0*240)8}Jh zhC$Y@?KYegsSl6wE1HOcuAfdnzev|TCg(iTrYURLNWQm|?fvEAhceHs&{34oT+Y1` zixhX!^Upt&bq!z-BPh*!Ih?4u2#-~yO!F4mLOOi%h+N+pg#jX?ZqgAX&3K`K7tlRsJ>(*muQ%*0UXIm)M6|1f@+ zWQjt{k6C-(%TlRc`0>6uNzqenXiXs(iJ=PVx8{+Y&q;zpn>~w4lQM{r!~}7Szx&Ie;v?!XdS4B2!~l zb{pGA_D}&^Ci@Iwuo_dr@sNZ!FLbAak-F$wLRn};nRlnGbI#`W|NdA0?!F6#Pa_3 zjC(25_8Q52(@{=t6;N@&sAeaTH6`gl--%!kV2Pn_O;h_oCTDGEb5hYqgQ#X|)}nzR)WlzJub` zc3UfM01wO&vSCx5HTsR01~c4!GJ|i(2Tooe@Ym1S4ajF*M~IaERLX5i9C?8xpI+ZI z+(_FnfArh^rydhq_-!?Z*B_-nyUEVcPIvnVB;8N8 zR#BM1qIqUqYEz=mB1)`#Wfr(nY^Ha@LrPE!%t+Z!7LKuhdp%ZC^3T(Y0$!zGYk@J&VC86IYB zZ>%`_e|7<$A}=b7LwCPrUML)nFCF~4zPh9;Z-gFEpuYFNlFmA;$@hQzpdd&|3rHhU zV;|X2#wOAo(l{E4QIaF1QE3<;C9omgpp0%2MHo2;$fQde6bV6*=l=el{l6VMj$OO2 z>pI`(`8wBVe=M>d@{c{cP2X;`g{)!hb1f!1)hIvUDd{e=8D zEHKXfg6lw>tZDWfC=H#lo03Niq*1)L;VPZHm15--@zFC0A7;D$qP` zIbjMKNR(~-a6#oYWGm7vA>q!HwiHN>L;i_r{W5NP^AF-I+svz@xi;f2FjM^;P0!&Q zgVh^B7W~Bw<|n(}hNmEuk`q3Q=j}=#26Q4{gL|bf3iIoMYsu~3jMcveMfa!EV#FVV zxYY;hxkIh?ivwI}Y(6GbJCXgmLKH3Esre2^f3|_MrA1jN4AVjm=sA22 z4o&dDtvE1M7pM@Dd2J*&ADsaZJNmO-y@jMSHCOd1jJZdFi(~Gq-`|un3MVAyB|j$6 zGYq}I8m*NI&Pm<{a;Sj4LxM-8OW^NC@BXauOXG4`z;M98En(dpr77L?L}OB$@8+(7 z*xS3ZUu~K1u(|r6{!oKlfUMV-Xo(tIYWvUkrJTW<67ie!IKI}G{tx(vwJh2#tlNQE z=@|ATmx(Cg7)?l!oyv`f1EIIZ$Q6`S?+83HyRa?y8UY~2T~`k1bhq?hJH#EN#eieY zFCUW9ozlke>pz1*q1K+3s#ey04NFS2<~^#Mn_Z4H&rp2YV-Qn9q#(r+5b{^xPldiQ z2~d0unq2aX&@3+HyoJ0cGUfv96q?#bXbdO(cua-1=Vlk~A9~0fMcOpo-||G@JZqm= z-X@@V05y%lP6Ccj&LVLouQMwA`u*=b5*1sZ4h^8o1##s&liE+a^ZXQn4me<)i~){5 z^lsrz{{;>;rqLq?M&(G6#&ZCM>bL1!T9>STdAb{9^d*@CpkTq^MFtdn{)I7_zpEjH z|3Bk$47rpbVGYFS8CXqe)g9}(gt>Fyj$sb!vCj*%)oJwFA;Vh75kG9EjA7xjy!_#5 z}I)YB`D4{BH`;)?iXp_bp$wx2FZik41$*Pw8< zDW^`4$`e_CN1*b}#&h&nrw>wN??aCU;|uiAI?~9^1?}TMgJA4%YJ@qwkD7=tR;A`S ztF{^^>J};HC?xeDxYS^`HzF#*<{`>0Nx!BLPp|lQ>yw4eQ0iy>7eTP? z08$5J0G7hFW=4t020;;n2yu}o-;a1__!!%8AQQ5v)J60#mDu^s9aIhK2cUHS&)Kz* zJiN>kw(;xlU(btKCq=sIuey%DiE0wEFRD+?Y`;rRIW}lsN7tWCaQT-j-i_ia1VYP+0fwetcQyMoyJZtsE0HTL~Lh~sT*LCLve*!338&0&XIcqyom3;tl zs0h!n)#kcdW1IioQyCIYkQ_i^7MT?7EJ( zoQM6Nj!eWGeOq1W4qYAEr26yUOmQzP5`PDydP}E&!Yxc*V7{RKVWNWR(@JBDd0=Y- zhL^pxZ$jR<1NT1zuhro!fbjcqZ*T7ih-9jA&=#WRs>ZMOCcoIS9yS5Ggud!z^2KB`8BaF7xBhLNMXTk z^x<7Wk&RsnN_>WIovQQrK*F@CSLsprX^J&W#4($&w+CC8at~-;E>&EH-B351R(_s6 zR-#I`_(fF}0O$GT^dzP7dWxYwVD!rJe4d=M$xl@HoVHe~wCz@neS9KHW51+%XLk@T zoa8wvB(2yo!E8=;fZA?O#Hy?`$$t4VL{9@3GOpj|^hxzbRv>wdu#QyeCYMZA5wCKGc@f#6P~G38B- z&z((SY|kokl)R7ZZ~Jsqdw$yu0Cw!%6$P7&7}!g*bI%8;b+wJ%BUZI`fXs7-t+_4* zBx`Yl#wa*lH?jJu$>*;iDutBYyb`O!%oyG|MDckUGX8K3fy~z+@@#$@0Su{TUJ9l!%S|?#^Zxu}ey-jYhf89 zbpbQJ&5AqTZRv8k7{|2Gs&-QR*8zI~;NgL%yCkmQ%G)=^4_W7mMOi9}>0ue7yYJQ7 z9kjHEIPB^~<%-=t1FTAsL)$M>lZ79+11Z`&?uD@&xL&(37+9fF35(lNo0;Nf1ffaa zVw{Aa@dwOB4wk>&8}Lhm&yzpZ&B4g}=3me{om7I-7h6xaTd&cu$8PTI)GVlNsB{cG z2RVK8DJ~tGjMKQTuwc&<>vU7$fBfIgs$jby#AHBM1Gjm@xUW1{&Cb(pkGdT3iZajb zV4OI8e8|n!c)vbz8oAL36uwmQj5yhA4gPg@e8)pc)n`eL{o(vpe%sta9f*XCP#x>e zYg;gS`l6l9-u97E^27yB)Gr8XGM*q>s*dG2OGVcmU{?VcK^6v6&s1 zMPISb+g=hThOn-y6_{0H_WKigxp;YcSv5n3xjOp~XTBKLgtnfmX1}LDEij=5Oh5By zXrAt5OY`Ht+=7O-!Z08TV1=|@X?2{D>CKb?XTY`X0*3+Je;x%F zK*03q>?{{NEJ3`PZr<{{3{%@NnOxD++xrMmoXh3_@!Q(5zUMUTq18C6-sV71;22k( z`#Gch-?Lw+|0@R756?RXWOUG0OqG%~I0tY2++cIetSmp10%%G*ebJXJ$>x(r+ja?{ z0zN92ynWqJRGlp0i1;BpbH4&R)(Bey`4=ezoIlbpC8plUOYj9{;13|JZ&{-}_Tax9 znALQD5eMhSLTeGvvydMvgtRNP_5Y& z%r(3*XShg;{@iyWeqwR_Kv~zB##cCR%XGXxw{l2nV-xW|`=-xH!6)YZ(?1a139X!v z@O7mol(G6GkWbmD%R>S`8`&o*#nJ{`-Gbz^SLKDytz$&g)5kabx%EA+zWY|W&UZJK z`{2PP?&o_wFYC6%65B20Su2j-uig54W0gH5_)X$0Pnvd`XQ+UVDB#cM_VbKI<#IXe zoa=insj*uf6UFz8%?7bmtZnHrM=fMGOOh+F(jMGWK>p|?-w=TZIz^MJ;tMl*o~U_o z`{FQHSA#RZD(f&DKomVN$mJKck&NMFuVgSX5rm5|x&hmmR>z zM_|eBylQNei2Vl_D!N$O<{-_IRq8j@1W^3B#A3^lzF4@@(4MnUGS5LEBFT??ZH9%G zJz40YK~i_z(`saaHqi2Y*&I#Erf*l>ALaJ99hYG@#`?PjGNo(~gIs>iae@B+&^okE z`8{owx^(gQn7-*!YQ`BB%yKp5EHu`)NYr20`qg&7!)fpfwF^S{UWE_9VRY4g zCdL0%V9x-+oA{r2WPJaA90_o2mCUg>n2jT$oK6FeJFUL)`F5CH4&-|B_IZoEo)nZ? z`SOWEGe@lPi|bB=xXO=L@fIJ$Ay+0HZ87e@=T7cbHMcpgC;|T6+WIK%rbAMNazRCW@ScrVToDf zIO9uRRoF_f)hub#7)>|FZSzX?5ufU7>0S)nI}W065KVOxeqTZ_R=8ApZaH@XJtE&tvtoc$IakNU72%@{B^3cYz;|bt78yA8~armDBL7)Z6vOQ4X8+tEcu`^UVRF}JHqkbq(4N@0ez-E zdhnO;weVIQ##bsm)}r*}TN4wppH>P;c2f5$_K~pF7cAFXCCQt&O|mQj3GDe z28SLWbyiOr;k24Bi-`|%-o46iOskyjfE{n|-o-Oz@H&QP`KyV|T}M1sv)F>*2MdEt z0dF_#u9O#9x4pFH4<+#x;wk#!8PDajqbm$}Gp)i|FuarRgT^)ZY+C&txe;Hc343a&l#llxL9s^sSZAsV_oqfAKj;zq#pve<0w z9@=dliN$l88P$Ze3Kzng6~7ZC$^sIpIja2Y^2@{>vizfPPt9ZO%V}0*&9yIaJuHnY zkuQ?0H~!3nGHBn<#waTfKJ54;%AQ61ynhDH8D0j68j!$;;+36?{RmQDdUf*WGa_}< z_8&W2+v&r{t=%KCq=ki&0_~u`*za8{Sm$V3NO|)8yep%G)}vG2_J+3Bujcl166uHz z?KeQjb`Fwu{N)@L1?WN^OFQ;4>Gz)QDJ*RMCmhePb)RkpaBcng@#CEeqm#a&Xc|g& zDnSd)Qw_EKrnZ1LVd22!h6lCNY^DGTb@QBw1pW{bgo!RNYBkc0jTu42vwd~#xJ7hg zA7uRflBfXvN2_@ZR0JnYsjl@ucFl>%a5fU2^?*fR_?*LGSC%3L4--!defIP~MRB;U z1YyMInk4VgWc3H9`@zyJ%5lsZy_)Ze|E_Sg*YlQ$x6B{ghhC%z>fWs5s~9f-H#KFJ z5UZ43dOo5MbUyw=!@{zwx7Tj`d-i-yzjFCIwCM;g?R~~}>6ojk*=Ku>c@ke$%4BVB z1BFbmw_4xtLPs>Z@7=76nW^=s#jP(|caT^Qjut1WZXel~Q%>5+yfQE0JaEaImCwby zH%3mHG9tW1!GtR@xz`b~hSk#cJvmG6O^!g(OHQ)ZsmjU3wjXBxg1YSXKoM&0W(TO^ z;ywzJtT)~ss4?L6cEGn3rWxKte3_w=&CJ{8IM}hXoV-O^ocj>}dnkG&_zR1Zb_+EF zLtnf%`5rcN8h+at*SnaP=U%cnWGdXwv6}XiUjvv$CKAVTJ32x8r^KR`*u)jkeyR=g`a5IkaA)Wz<> zgYAoIbHhnDVzS)>k|(bVQgQ_hExTxsX#`FbS@HLAY?=2iTvd2vdA*4iGMQA1>bvr; ze~uDAQJn!@7RNn3u(J=+5FnEiz7>Gr38hX`iyt z5|c78lDF(+B|UjdCJ801y;gkQr^HWknw-4F((AV-5c9bg=|Ug5+}+YoAv{0Ty$q@` zls>$)17k&8qu4l7m^o+vCfdmT6K6k{X1g2b%B~`X_r8IUm-OOY_uWFRcQDxYfjaov z=(plJ!{6x7(e`P4{LE`DF(n0lnNYpHTmgMZdQ4#nA%=~Q78&o~yP1=bzO2Tjmggr3 z4F(acWZ+7fX_;27t5yX=DtFy+ORh|#JoI;Tu?=d4{f$Q)XYcgP^<^a1{7;eD&WS-C zvvrj~aCxUNT4kVhWb-zWLqmw30&8jm?dEPDkkqq}z1fW)>K;dzkUFhW1IIOEN$WvB59U8G(S+OK91 zm^Us7;+*eeDIxyBjM6J*T^9!>(NohN_Bd4GG}Hhrs=`HUtnIcU*m2tqR8k#J;KTChwV-)X5qE59@ClP17-3 z&1U)2RGdtzqK?Z>FKw<>ypOd>RW9-0P;l%*Tr8bq?CC%I!f{N%#B%R3%+E*1$(=!q(b@xTqRzo&=UuA~&u=dEFgVw5S~6hR)QLQ?E*Y>FrAcAJ!An(# z6OC(peF=I@A=Muqz=&p8!R-hdB&>`&Wrnw1-kDaK4gFQ)b=ekO;quChg<`bY(TY8+;0!NlO=yI5noX>h8 zITF~}t)d?y?)y7e2jrFhWo;ZB#%FR<%n2jeo@U0lnr1)q56b6Q4osI}p=P_ke?@q< zR!<^;*aTLS$8X-Bl*pRE2DTup`dnzhU|;9=nI%C$LE6Egw297e{U>|juXK#cS7Y`^ z>}+i6W(iDGorFB~X|FybW!cWnOo?1~VFQORRqa8pv^aj~^HKSI$m0MyK!uMZZB2q3 zfgB?rkodLa-$@3Y77RV*WTb3Yc=)hIl>Z$e+qvN;Gceqr2F*VkH<)@!M?WSz+|_LH z0yj*kaVm`}Ge;_l5-xYX9rv9HQ5ze)1g}g&lx~Ix(ZBF)1nkSro?Mb0Qbfm-7mh12 zBZLn&Vfk)hpR{qr=+fHa(XElKZE-MiZ8I+6j&RYo<;Boza<%FFrzHm>Btz!b)-b*n zvcLAd3l+l0#eZte43lSpWW*TUXS~$7LnDoH^@l?xC))$Y1rcnC*d^@s7>1y0PUyrD zQD1^@CQWkW2$kC$bcNQ17!% zl@f}fVwfpMA8GF+UT645VE$^{Fs1%v|9$#{rF|jStJ5-h@G9sl>M^5Mq$VaPaM|Ny z>3zU&G^KjLnLu7ShTwPAk4ga(X>;R5UDpXO^1)#~&fn8OJOKZ)4( zuShPgwT&aBaIVd1w~mViw+ap8GSC58USO`{aavO9xgQ#M6;w?nVxv-#JFz;K>ZEsP zb*69d8M^z^>$DHQ@njdAkjORzYM`m| zwKf64DEluyC~xa_+)vLN?NcKyt@|*T--}-gJgTC#DxBOOC}Stc>l4yvNaUt?BNSX) z>WNw9W4tG*DNR!2d>{Osk3mY>&8sLQMVxg$)ZB4%CX09?Yhc3YklnCk>Qb2BV!R`H zW6&HiBfs^#fb!{D@=xqfes*FXqvX*yHyRbEP5U34#mSv_xl*WU3{$ME_r4BPbjs)* z$(XE;33~_8&loY^LvIHUiLbQP0*K!OS;yphk$`lw&cTVSPqaWuSp$!O`lqSTJIscf z8Wbx&eiYZ*KRv7DT~Z6u<%F`A$mCr!*UGXJ3ozAepZ4YdyTH$5HdgLeZ1MGq?+S?F zu)A7dGn;T_l`qFzz5+wU4%tf0euu;w&-*OrKT);W6Kv5RKC0HGdSk$>P%PiO;0~*i zg-9mo%2fZC?|fh5d$Ec~FU65Db?`3x%bV?S@X2*X^UpieAri++f@j{ItR(D!kYqMy zl~-OVbPFPbHOMUU^Uv0D^rnpAmw%8g);?WksNuyD;;0){wp5IXxT^-S+FqVZ$@{n| z9vid!Nwl^2XJ?#&IWWissR>14K`-Mib#p{i<4ZKWL{uLS6DB?}wl~GSk=ghBsu>*Sng)E@-w~KH@_rF1qjCpw@?$1Y z4g`r=L+8)YteA{EQcl%xU6-tn>Xt5^yMiR4L#W=bCCkXjk0uFzQH#_XYxZLBkd|!8Yv~yvi4^BSp;xKVUVL_|R zkn79~^Y`TBlxYfPw+f#ptjV*SxP zTgqniG^&!_@u;9#Y;~~MU(ou``FTiiSQzN7*h+YK_){WtlgsXNpN{h)5?YVR1!D4% z>^@|O(??MSfO3EO-^{jaNXJ5nLn>EW_bvA>1Ly&#p)=A__T}vCY=5eNB4|VTWcdqC zXUlW@4DDV6CKx&}wz@G}C?XYNBD(1JTxwoS2+`Hi0iXMrQ=6ZJ6Z&Fv!}wB?E>}hc z?!718*m!L4)S@Ayqod7_-IRDI#d9E~k=BNW!n$X@n{mHZrZOoF8OWh~%d%!{L7`^td_GmBbvnd=uwMb8E+2Q6><8NDIRO@#bB3dXF{qNlM1WSTTVmUe_ zt{JxbSV!q#RmA9VAyu$8KBViT5wgFET-GzN)P~!^3kn*?*IBOY4;uV?22JJrPPb_` z+P-yITzw>;_|Lsu0Nzs5=Na(d5v}aI!Lcq3$(Vn(THr5VISpc?_HhJ@DU@{MiWfF7 zyWAW2HyuQ?R5D!)8x~(GNcDx$bQVgLF0?B_(VIpgcEYeB=kPf9l?+^+a@9_$0bmerpovDl%M zWk!^+zQ+n~ZqreIh|(Hb>81Po-v}Gd56xqfsUr0FnK9QD zS)hz(TD#1XF3CflZOoSWGF7Rfle1(oS`1j0Nu@Y_pkDB_Li-y-tQL(fR|BSHufv#i zdvKmo_zC&Bn1G$^jJ^R{y)ji>;RR)UhG<9cviO?T)I}kDr3B6A>!Eo^4-bP(hkx@}6==w$B z+VAz@oPZ|{&tv+w#@;i_Om8vgNXU)YVt}X}{>h%aA8A35WLR=q^h43UsGS0{4=Hu| z4i0ul(crWRZ9RpdCMAESST0AHY%MU+`W`g({lLw!tE7`JQKkB;dX$l1iOdZ7Q!8Dh zm$Ss9l?_WtgZ(Y3iy$x#D*p`P-FRy#h3OX}EQ-(z>jTr?T^;!W37Lh<^ZjQ-(n3hp>cjYbS+H83&8~Gz0?fPHtU>+K4_RqH* zl3ehqxeDNY?SKTzA|pc<-LfX}qj?*|jZMSk?ddJf9%nDYQ!dhjBrCG`z0(@E$5`;P zq5MD^QL!RS)xAx0#c8___;LmEA3BA|)4Mf6(5Po^wOBjcy5ZFb9v z&xHO!{T`L_S&~>x4!@F0b-stB0XNrOmh%Ey~0QnuUwOO zvRPI-=1Lk%*~wWLKSXDHt@P?5Rfr#oX6Q)cabP_!K$li{46!7bkEnQB@q!Wp4bSqw z?K9f#b5Sr1YN(+>W||2`|H|!#YQ&&H_DWS{n+}eMClnu~wxGw+-S&Q?22B=nsA9dEW(~ z1!qcV8pst3nKHyC4h6PbGhK!OalJ*azXqDUSnXH$x@BN(&tQ;5%z9F#=!=T?@e`9G zAzTt9koP-`bkOM2dTP3&3`#QVS7?=y%y-|VMlHQFQr6cZ6L`56uOxZjGAm}k2feWZ z5cz5B^_WvjF*S!c?rF;2l=I%c9AMbTNy=_T)%uu z$&=jpJ_#UG%A4)%M!fQRa>tWe^sUiR9`5=@P=%Oh(+dM@o6raRUyE|-xSvNbGy3SsiHh+@1Dz0` zP^sH$sQ9S-AsxO!N?5j+i2&-G5bvgWZw8}rp5HovFa8Q7U};D08Dxo^v{jD)6W2O* zn0@7D*u&Nh&07ca!Hp-6aT_1ZeWs=Us7Tbody .postbody .author a:link:after, html>body .postbody .author a:visited:after, diff --git a/styles/Milk_v2/theme/responsive/large-desktops.css b/styles/Milk_v2/theme/responsive/large-desktops.css index 1e6b5bd..e0f240a 100644 --- a/styles/Milk_v2/theme/responsive/large-desktops.css +++ b/styles/Milk_v2/theme/responsive/large-desktops.css @@ -1,50 +1,50 @@ @media (min-width: 1200px) { - + body{ border-top-color: #F3F;} - + /* Fix the body layout for large desktop devices */ .body-layout-Boxed .wrap {width: 1200px;} - - + + /* Forumlist Colums (also see squishy.css for fluid/both fix) - ---------------------------------------- */ - + ---------------------------------------- */ + /* Remove the 'topics' column */ body.sidebar-both.body-layout-Boxed .forabg dd.posts, body.sidebar-both.body-layout-Boxed .forumbg dd.views { display: none; } - - /* Or, reduce the width of 'simpleposts' by 50% (from 190 to 95) */ + + /* Or, reduce the width of 'simpleposts' by 50% (from 190 to 95) */ body.sidebar-both.body-layout-Boxed dd.simpleposts, body.sidebar-both.body-layout-Boxed dd.simpleposts { - width: 95px; - } - + width: 95px; + } + /* Adjust the other margins to account for the (now missing) 95px */ body.sidebar-both.body-layout-Boxed ul.topiclist dt { margin-right: -395px; } - + body.sidebar-both.body-layout-Boxed ul.topiclist dt .list-inner { margin-right: 395px; } - + body.sidebar-both.body-layout-Boxed li.header dt { - margin-right: -425px; + margin-right: -425px; } - + /* UCP columns - ---------------------------------------- */ - + ---------------------------------------- */ + body.sidebar-both.body-layout-Boxed ul.topiclist.pmlist dt .list-inner { margin-right: 95px; /* Creates the space */ } body.sidebar-both.body-layout-Boxed ul.topiclist.two-columns dt { - margin-right: -95px; + margin-right: -95px; } body.sidebar-both.body-layout-Boxed ul.topiclist.two-columns li.header dt { - margin-right: -130px; - } - + margin-right: -130px; + } + /* UCP Two long columns */ body.sidebar-both.body-layout-Boxed ul.two-long-columns dt .list-inner { margin-right: 0; @@ -52,98 +52,121 @@ body.sidebar-both ul.two-long-columns dd.lastpost { display: none; } - + /* MCP Columns ---------------------------------------- */ - + /* Manually enabling the responsive layout. First, we remove the second column header */ - body.sidebar-both.body-layout-Boxed .missing-column dd, + body.sidebar-both.body-layout-Boxed .missing-column dd, body.sidebar-right-only.body-layout-Boxed .missing-column dd { display: none; } - + /* But we still want the mark column, so re-enable that */ - body.sidebar-both.body-layout-Boxed .missing-column dd.mark, + body.sidebar-both.body-layout-Boxed .missing-column dd.mark, body.sidebar-right-only.body-layout-Boxed .missing-column dd.mark { display: block; } - + /* Reduce the left column margin to 95px, just enough for the mark box */ - body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column dt, + body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column dt, body.sidebar-right-only.body-layout-Boxed ul.topiclist.missing-column dt { margin-right: -95px; } - body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column dt .list-inner, - body.sidebar-right-only.body-layout-Boxed ul.topiclist.missing-column dt .list-inner { + body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column dt .list-inner, + body.sidebar-right-only.body-layout-Boxed ul.topiclist.missing-column dt .list-inner { margin-right: 95px; } /* Then enable the extra info below */ - body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column .responsive-show, + body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column .responsive-show, body.sidebar-right-only.body-layout-Boxed ul.topiclist.missing-column .responsive-show { display: block !important; } - - /* Hacky bookmark fix */ + + /* Hacky bookmark fix */ body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column li.header dt, body.sidebar-both.body-layout-Fluid ul.topiclist.missing-column li.header dt, body.sidebar-right-only.body-layout-Boxed ul.topiclist.missing-column li.header dt { margin-right: -125px; /* 95px + 30px padding */ - } - - - + } + + + /* Manually enabling the responsive layout. First, we remove the second column header */ body.sidebar-both.body-layout-Boxed ul.topiclist.two-long-columns dd, body.sidebar-right-only.body-layout-Boxed ul.topiclist.two-long-columns dd { - display: none; + display: none; } - + /* Increase the left column width to 100% */ body.sidebar-both.body-layout-Boxed ul.topiclist.two-long-columns dt, body.sidebar-right-only.body-layout-Boxed ul.topiclist.two-long-columns dt { - margin-right: 0; + margin-right: 0; } - /* Then enable the extra info below */ + /* Then enable the extra info below */ body.sidebar-both.body-layout-Boxed ul.topiclist.two-long-columns .responsive-show, body.sidebar-right-only.body-layout-Boxed ul.topiclist.two-long-columns .responsive-show { display: block !important; } - - - + + + /* Custom Login Page ---------------------------------------- */ - + /* Clear the veritcal alignment. Make it wider for larger screens */ .login_container { width: 900px; } - + /* For ACP Auth (and login_body.html...probably), reduce container width to 450px */ .auth-page-admin .login_container { width: 450px; - } - + } + /* Split the columns down */ .login_container_left, .login_container_right { width: 50%; display: table-cell; vertical-align: middle; } - + /* Min height for left column content, so that it's taller than the registration box */ .login_container_left_section_content { min-height: 400px; } - + /* For ACP Auth (and login_body.html...probably), remove min-height */ .auth-page-admin .login_container_left_section_content { min-height: 0; } - /* responsive logo - ---------------------------------------- */ - -} \ No newline at end of file + /* Grid + ---------------------------------------- */ + + /***** Remove desc & last post, make topics & posts wider. Reduce row 1 height & overflow */ + body.sidebar-right-only.body-layout-Boxed .forumlist_grid .forum_description { + display: none; + } + + body.sidebar-right-only.body-layout-Boxed .forumlist_grid .tile_row_1 { + height: 75px; + } + + body.sidebar-right-only.body-layout-Boxed .forumlist_grid .tile_row_2 { + margin-top: 0; + } + + body.sidebar-right-only.body-layout-Boxed .forumlist_grid .tile_row_25 { + width: 50%; + } + + body.sidebar-right-only.body-layout-Boxed .forumlist_grid .tile_row_50 { + display: none; + } + /* End minimal squishy fix */ + + +} diff --git a/styles/Milk_v2/theme/responsive/medium-ipad.css b/styles/Milk_v2/theme/responsive/medium-ipad.css index f87b9df..4c9bbcc 100644 --- a/styles/Milk_v2/theme/responsive/medium-ipad.css +++ b/styles/Milk_v2/theme/responsive/medium-ipad.css @@ -1,7 +1,7 @@ @media (min-width: 992px)and (max-width: 1199px) { - + body{ border-top-color: #0F9;} - + /* Global Containers ---------------------------------------- */ @@ -9,78 +9,105 @@ .body-layout-Boxed #wrap { padding: 0 15px; width: auto; - } - + } + /* Sidebar Adjustments ----------------------------*/ - + /* Hide left sidebar on tiny screens */ #leftcolumn { display: none; } - + /* Clear center column padding */ #contentcolumn { padding-left: 0; } - + /* Expand center column to fill empty gap */ #contentcolumn { margin-left: 0; } - + /* Grid Forumlist ---------------------------------------- */ - + /* Turn 3 columns into 2 */ .forumlist_grid li.row { - width: 50%; + width: 50%; } - + + /***** Remove desc & last post, make topics & posts wider. Reduce row 1 height & overflow */ + body.sidebar-right-only .forumlist_grid .forum_description, + body.sidebar-both .forumlist_grid .forum_description { + display: none; + } + + body.sidebar-right-only .forumlist_grid .tile_row_1, + body.sidebar-both .forumlist_grid .tile_row_1 { + height: 75px; + } + + body.sidebar-right-only .forumlist_grid .tile_row_2, + body.sidebar-both .forumlist_grid .tile_row_2 { + margin-top: 0; + } + + body.sidebar-right-only .forumlist_grid .tile_row_25, + body.sidebar-both .forumlist_grid .tile_row_25 { + width: 50%; + } + + body.sidebar-right-only .forumlist_grid .tile_row_50, + body.sidebar-both .forumlist_grid .tile_row_50 { + display: none; + } + /* End minimal squishy fix */ + /* Forumlist Colums - ---------------------------------------- */ - + ---------------------------------------- */ + /* Remove the 'last post' column */ - body.sidebar-both .forabg dd.lastpost, + body.sidebar-both .forabg dd.lastpost, body.sidebar-both .forumbg dd.lastpost, body.sidebar-right-only .forabg dd.lastpost, body.sidebar-right-only .forumbg dd.lastpost { display: none; } - + /* Increase the other margins to account for the (now missing) 300px */ - body.sidebar-both ul.topiclist.forums dt, + body.sidebar-both ul.topiclist.forums dt, body.sidebar-right-only ul.topiclist.forums dt, - body.sidebar-both ul.topiclist.topics dt, + body.sidebar-both ul.topiclist.topics dt, body.sidebar-right-only ul.topiclist.topics dt{ margin-right: -195px; } - - body.sidebar-both ul.topiclist dt .list-inner, + + body.sidebar-both ul.topiclist dt .list-inner, body.sidebar-right-only ul.topiclist dt .list-inner { margin-right: 195px; } - - body.sidebar-both li.header dt, - body.sidebar-right-only li.header dt { - margin-right: -235px; - } - - + body.sidebar-both li.header dt, + body.sidebar-right-only li.header dt { + margin-right: -235px; + } + + + /* UCP Columns ---------------------------------------- */ - + /* For the UCP columns, we need to override this */ body.sidebar-both ul.topiclist.pmlist dt, body.sidebar-right-only ul.topiclist.pmlist dt { margin-right: -95px; } - - /* Same again... */ + + /* Same again... */ body.sidebar-both ul.topiclist.pmlist dt .list-inner, body.sidebar-right-only ul.topiclist.pmlist dt .list-inner { margin-right: 95px; - } - + } + /* UCP Two long columns */ body.sidebar-both ul.two-long-columns dt .list-inner { margin-right: 0; @@ -88,11 +115,11 @@ body.sidebar-both ul.two-long-columns dd.lastpost { display: none; } - - + + /* MCP Columns ---------------------------------------- */ - + /* Manually enabling the responsive layout. First, we remove the second column */ body.sidebar-both.body-layout-Boxed .missing-column dd, body.sidebar-both.body-layout-Fluid .missing-column dd, @@ -100,121 +127,121 @@ body.sidebar-right-only.body-layout-Fluid .missing-column dd { display: none; } - + /* But we still want the mark column, so re-enable that */ - body.sidebar-both.body-layout-Boxed .missing-column dd.mark, - body.sidebar-both.body-layout-Fluid .missing-column dd.mark, + body.sidebar-both.body-layout-Boxed .missing-column dd.mark, + body.sidebar-both.body-layout-Fluid .missing-column dd.mark, body.sidebar-right-only.body-layout-Boxed .missing-column dd.mark, body.sidebar-right-only.body-layout-Fluid .missing-column dd.mark { display: block; } - + /* Reduce the left column margin to 95px, just enough for the mark box */ - body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column dt, + body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column dt, body.sidebar-both.body-layout-Fluid ul.topiclist.missing-column dt, body.sidebar-right-only.body-layout-Boxed ul.topiclist.missing-column dt, body.sidebar-right-only.body-layout-Fluid ul.topiclist.missing-column dt { margin-right: -95px; } - + body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column dt .list-inner, body.sidebar-both.body-layout-Fluid ul.topiclist.missing-column dt .list-inner, body.sidebar-right-only.body-layout-Boxed ul.topiclist.missing-column dt .list-inner, - body.sidebar-right-only.body-layout-Fluid ul.topiclist.missing-column dt .list-inner { + body.sidebar-right-only.body-layout-Fluid ul.topiclist.missing-column dt .list-inner { margin-right: 95px; } - + /* Then enable the extra info below */ - body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column .responsive-show, + body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column .responsive-show, body.sidebar-both.body-layout-Fluid ul.topiclist.missing-column .responsive-show, body.sidebar-right-only.body-layout-Boxed ul.topiclist.missing-column .responsive-show, body.sidebar-right-only.body-layout-Fluid ul.topiclist.missing-column .responsive-show { display: block !important; } - - /* Hacky bookmark fix */ + + /* Hacky bookmark fix */ body.sidebar-both.body-layout-Boxed ul.topiclist.missing-column li.header dt, - body.sidebar-both.body-layout-Fluid ul.topiclist.missing-column li.header dt, + body.sidebar-both.body-layout-Fluid ul.topiclist.missing-column li.header dt, body.sidebar-right-only.body-layout-Boxed ul.topiclist.missing-column li.header dt, body.sidebar-right-only.body-layout-Fluid ul.topiclist.missing-column li.header dt { margin-right: -125px; /* 95px + 30px padding */ - } - + } + /* Manually enabling the responsive layout. First, we remove the second column header */ body.sidebar-both.body-layout-Boxed ul.topiclist.two-long-columns dd, body.sidebar-both.body-layout-Fluid ul.topiclist.two-long-columns dd, body.sidebar-right-only.body-layout-Fluid ul.topiclist.two-long-columns dd { - display: none; + display: none; } - + /* Increase the left column width to 100% */ body.sidebar-both.body-layout-Boxed ul.topiclist.two-long-columns dt, body.sidebar-both.body-layout-Fluid ul.topiclist.two-long-columns dt, body.sidebar-right-only.body-layout-Fluid ul.topiclist.two-long-columns dt .list-inner { - margin-right: 0; + margin-right: 0; } - /* Then enable the extra info below */ + /* Then enable the extra info below */ body.sidebar-both.body-layout-Boxed ul.topiclist.two-long-columns .responsive-show, body.sidebar-both.body-layout-Fluid ul.topiclist.two-long-columns .responsive-show, body.sidebar-right-only.body-layout-Fluid ul.topiclist.two-long-columns .responsive-show { display: block !important; } - - - - - + + + + + /* Custom Login Page ---------------------------------------- */ - + /* Clear the veritcal alignment. Make it wider for larger screens */ .login_container { width: 900px; } - + /* For ACP Auth (and login_body.html...probably), reduce container width to 450px */ .auth-page-admin .login_container { width: 450px; - } - + } + /* Split the columns down */ .login_container_left, .login_container_right { width: 50%; display: table-cell; vertical-align: middle; } - + /* Min height for left column content, so that it's taller than the registration box */ .login_container_left_section_content { min-height: 400px; } - + /* For ACP Auth (and login_body.html...probably), remove min-height */ .auth-page-admin .login_container_left_section_content { min-height: 0; } - + /* Subforums in column - ---------------------------------------- */ + ---------------------------------------- */ ul.sub-list { width: 100%; - } - + } + /* responsive logo - ---------------------------------------- */ - + ---------------------------------------- */ + /* override the dynamic inline width so that we can relatively resize logo below */ #site-description { width: 100% !important; } - + #site-description img { max-width: 85%; } - - -} \ No newline at end of file + + +} diff --git a/styles/Milk_v2/theme/rounded.css b/styles/Milk_v2/theme/rounded.css new file mode 100644 index 0000000..8cbfceb --- /dev/null +++ b/styles/Milk_v2/theme/rounded.css @@ -0,0 +1,87 @@ +.forabg, .forumbg { + border-radius: 0 0 10px 10px; +} + +li.header { + border-radius: 10px 10px 0 0; +} + +li.row:first-child { + border-radius: 10px 10px 0 0; +} + +li.row:last-child { + border-radius: 0 0 10px 10px; +} + +li.row:only-child { + border-radius: 10px; +} + +#inner-wrap { + border-radius: 10px; +} + +input.button1, a.button1, input.button2, a.button2, input.button3, .specialbutton, .button { + border-radius: 25px; +} + +.post { + border-radius: 10px; +} + +.rules { + border-radius: 10px; +} + +.codebox code, blockquote { + border-radius: 10px; +} + +select { + border-radius: 25px; +} + +.inputbox[type=text], .inputbox[type=url], .inputbox[type=password] { + border-radius: 25px; +} + +textarea { + border-radius: 10px; +} + +.panel { + border-radius: 10px; +} + +.search-box .inputbox { + border-radius: 25px 0 0 25px; +} + +.search-box button.button-search { + border-radius: 0; +} + +.search-box a.button-search-end { + border-radius: 0 25px 25px 0; +} + +.pagination li span { + border-radius: 10px; +} + +.forumlist_grid li.row, .grid_image_container, .forumlist_grid_forum_image, .grid_colour_overlay { + border-radius: 15px; +} + +.tile_row_2:before { + border-radius: 2px; +} + +.forumlist_grid .forabg { + border-radius: 10px; +} + +.viewtopic_wrapper { + border-radius: 10px; +} diff --git a/styles/Milk_v2/theme/stylesheet.css b/styles/Milk_v2/theme/stylesheet.css new file mode 100644 index 0000000..0d19a04 --- /dev/null +++ b/styles/Milk_v2/theme/stylesheet.css @@ -0,0 +1,40 @@ +/* phpBB3 Style Sheet + -------------------------------------------------------------- + phpBB style name: Milk v2 + Based on style: Merlin Framework (http://www.planetstyles.net) + -------------------------------------------------------------- +*/ + +/* Core */ +@import url("merlin.css?v=3.3"); +@import url("normalize.css?v=3.3"); +@import url("base.css?v=3.3"); +@import url("utilities.css?v=3.3"); +@import url("common.css?v=3.3"); +@import url("links.css?v=3.3"); +@import url("content.css?v=3.3"); +@import url("buttons.css?v=3.3"); +@import url("cp.css?v=3.3"); +@import url("forms.css?v=3.3"); + +/* Icons */ +@import url("icons.css?v=3.3"); +@import url("icons_forums_topics.css?v=3.3"); + +/* Custom Additions */ +@import url("animate.css?v=3.3"); +@import url("tooltipster.bundle.min.css?v=3.3"); +@import url("tooltipster-sideTip-borderless.min.css?v=3.3"); + +/* Responsive */ +@import url("responsive/responsive.css?v=3.3"); +@import url("responsive/xs-phones.css?v=3.3"); +@import url("responsive/small-smaller-tablets.css?v=3.3"); +@import url("responsive/medium-ipad.css?v=3.3"); +@import url("responsive/large-desktops.css?v=3.3"); +@import url("responsive/squishy.css?v=3.3"); + +/* Facelift */ +@import url("colours.css?v=3.3"); +@import url("fonts.css?v=3.3"); +@import url("milk.css?v=3.3"); diff --git a/vendor/autoload.php b/vendor/autoload.php index ab14645..96570e4 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer/autoload_real.php'; -return ComposerAutoloaderInit55438ae291a1dfe4cf962a21b03284ed::getLoader(); +return ComposerAutoloaderInit5ba2d544c5d0bf61b3c77aaea4d92d6b::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index 3c6870d..fea54a1 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -6,7 +6,10 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'CallbackFilterIterator' => $vendorDir . '/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php', + 'ArithmeticError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php', + 'AssertionError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php', + 'DivisionByZeroError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php', + 'Error' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/Error.php', 'FastImageSize\\FastImageSize' => $vendorDir . '/marc1706/fast-image-size/lib/FastImageSize.php', 'FastImageSize\\Type\\TypeBase' => $vendorDir . '/marc1706/fast-image-size/lib/Type/TypeBase.php', 'FastImageSize\\Type\\TypeBmp' => $vendorDir . '/marc1706/fast-image-size/lib/Type/TypeBmp.php', @@ -21,117 +24,76 @@ return array( 'FastImageSize\\Type\\TypeTif' => $vendorDir . '/marc1706/fast-image-size/lib/Type/TypeTif.php', 'FastImageSize\\Type\\TypeWbmp' => $vendorDir . '/marc1706/fast-image-size/lib/Type/TypeWbmp.php', 'FastImageSize\\Type\\TypeWebp' => $vendorDir . '/marc1706/fast-image-size/lib/Type/TypeWebp.php', - 'GuzzleHttp\\BatchResults' => $vendorDir . '/guzzlehttp/guzzle/src/BatchResults.php', 'GuzzleHttp\\Client' => $vendorDir . '/guzzlehttp/guzzle/src/Client.php', 'GuzzleHttp\\ClientInterface' => $vendorDir . '/guzzlehttp/guzzle/src/ClientInterface.php', - 'GuzzleHttp\\Collection' => $vendorDir . '/guzzlehttp/guzzle/src/Collection.php', 'GuzzleHttp\\Cookie\\CookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php', 'GuzzleHttp\\Cookie\\CookieJarInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php', 'GuzzleHttp\\Cookie\\FileCookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php', 'GuzzleHttp\\Cookie\\SessionCookieJar' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php', 'GuzzleHttp\\Cookie\\SetCookie' => $vendorDir . '/guzzlehttp/guzzle/src/Cookie/SetCookie.php', - 'GuzzleHttp\\Event\\AbstractEvent' => $vendorDir . '/guzzlehttp/guzzle/src/Event/AbstractEvent.php', - 'GuzzleHttp\\Event\\AbstractRequestEvent' => $vendorDir . '/guzzlehttp/guzzle/src/Event/AbstractRequestEvent.php', - 'GuzzleHttp\\Event\\AbstractRetryableEvent' => $vendorDir . '/guzzlehttp/guzzle/src/Event/AbstractRetryableEvent.php', - 'GuzzleHttp\\Event\\AbstractTransferEvent' => $vendorDir . '/guzzlehttp/guzzle/src/Event/AbstractTransferEvent.php', - 'GuzzleHttp\\Event\\BeforeEvent' => $vendorDir . '/guzzlehttp/guzzle/src/Event/BeforeEvent.php', - 'GuzzleHttp\\Event\\CompleteEvent' => $vendorDir . '/guzzlehttp/guzzle/src/Event/CompleteEvent.php', - 'GuzzleHttp\\Event\\Emitter' => $vendorDir . '/guzzlehttp/guzzle/src/Event/Emitter.php', - 'GuzzleHttp\\Event\\EmitterInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Event/EmitterInterface.php', - 'GuzzleHttp\\Event\\EndEvent' => $vendorDir . '/guzzlehttp/guzzle/src/Event/EndEvent.php', - 'GuzzleHttp\\Event\\ErrorEvent' => $vendorDir . '/guzzlehttp/guzzle/src/Event/ErrorEvent.php', - 'GuzzleHttp\\Event\\EventInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Event/EventInterface.php', - 'GuzzleHttp\\Event\\HasEmitterInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Event/HasEmitterInterface.php', - 'GuzzleHttp\\Event\\HasEmitterTrait' => $vendorDir . '/guzzlehttp/guzzle/src/Event/HasEmitterTrait.php', - 'GuzzleHttp\\Event\\ListenerAttacherTrait' => $vendorDir . '/guzzlehttp/guzzle/src/Event/ListenerAttacherTrait.php', - 'GuzzleHttp\\Event\\ProgressEvent' => $vendorDir . '/guzzlehttp/guzzle/src/Event/ProgressEvent.php', - 'GuzzleHttp\\Event\\RequestEvents' => $vendorDir . '/guzzlehttp/guzzle/src/Event/RequestEvents.php', - 'GuzzleHttp\\Event\\SubscriberInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Event/SubscriberInterface.php', 'GuzzleHttp\\Exception\\BadResponseException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/BadResponseException.php', 'GuzzleHttp\\Exception\\ClientException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ClientException.php', 'GuzzleHttp\\Exception\\ConnectException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ConnectException.php', - 'GuzzleHttp\\Exception\\CouldNotRewindStreamException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/CouldNotRewindStreamException.php', - 'GuzzleHttp\\Exception\\ParseException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ParseException.php', + 'GuzzleHttp\\Exception\\GuzzleException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/GuzzleException.php', + 'GuzzleHttp\\Exception\\InvalidArgumentException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php', 'GuzzleHttp\\Exception\\RequestException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/RequestException.php', + 'GuzzleHttp\\Exception\\SeekException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/SeekException.php', 'GuzzleHttp\\Exception\\ServerException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/ServerException.php', - 'GuzzleHttp\\Exception\\StateException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/StateException.php', 'GuzzleHttp\\Exception\\TooManyRedirectsException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php', 'GuzzleHttp\\Exception\\TransferException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/TransferException.php', - 'GuzzleHttp\\Exception\\XmlParseException' => $vendorDir . '/guzzlehttp/guzzle/src/Exception/XmlParseException.php', - 'GuzzleHttp\\HasDataTrait' => $vendorDir . '/guzzlehttp/guzzle/src/HasDataTrait.php', - 'GuzzleHttp\\Message\\AbstractMessage' => $vendorDir . '/guzzlehttp/guzzle/src/Message/AbstractMessage.php', - 'GuzzleHttp\\Message\\AppliesHeadersInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Message/AppliesHeadersInterface.php', - 'GuzzleHttp\\Message\\FutureResponse' => $vendorDir . '/guzzlehttp/guzzle/src/Message/FutureResponse.php', - 'GuzzleHttp\\Message\\MessageFactory' => $vendorDir . '/guzzlehttp/guzzle/src/Message/MessageFactory.php', - 'GuzzleHttp\\Message\\MessageFactoryInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Message/MessageFactoryInterface.php', - 'GuzzleHttp\\Message\\MessageInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Message/MessageInterface.php', - 'GuzzleHttp\\Message\\MessageParser' => $vendorDir . '/guzzlehttp/guzzle/src/Message/MessageParser.php', - 'GuzzleHttp\\Message\\Request' => $vendorDir . '/guzzlehttp/guzzle/src/Message/Request.php', - 'GuzzleHttp\\Message\\RequestInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Message/RequestInterface.php', - 'GuzzleHttp\\Message\\Response' => $vendorDir . '/guzzlehttp/guzzle/src/Message/Response.php', - 'GuzzleHttp\\Message\\ResponseInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Message/ResponseInterface.php', - 'GuzzleHttp\\Mimetypes' => $vendorDir . '/guzzlehttp/guzzle/src/Mimetypes.php', + 'GuzzleHttp\\HandlerStack' => $vendorDir . '/guzzlehttp/guzzle/src/HandlerStack.php', + 'GuzzleHttp\\Handler\\CurlFactory' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlFactory.php', + 'GuzzleHttp\\Handler\\CurlFactoryInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php', + 'GuzzleHttp\\Handler\\CurlHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlHandler.php', + 'GuzzleHttp\\Handler\\CurlMultiHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php', + 'GuzzleHttp\\Handler\\EasyHandle' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/EasyHandle.php', + 'GuzzleHttp\\Handler\\MockHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/MockHandler.php', + 'GuzzleHttp\\Handler\\Proxy' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/Proxy.php', + 'GuzzleHttp\\Handler\\StreamHandler' => $vendorDir . '/guzzlehttp/guzzle/src/Handler/StreamHandler.php', + 'GuzzleHttp\\MessageFormatter' => $vendorDir . '/guzzlehttp/guzzle/src/MessageFormatter.php', + 'GuzzleHttp\\Middleware' => $vendorDir . '/guzzlehttp/guzzle/src/Middleware.php', 'GuzzleHttp\\Pool' => $vendorDir . '/guzzlehttp/guzzle/src/Pool.php', - 'GuzzleHttp\\Post\\MultipartBody' => $vendorDir . '/guzzlehttp/guzzle/src/Post/MultipartBody.php', - 'GuzzleHttp\\Post\\PostBody' => $vendorDir . '/guzzlehttp/guzzle/src/Post/PostBody.php', - 'GuzzleHttp\\Post\\PostBodyInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Post/PostBodyInterface.php', - 'GuzzleHttp\\Post\\PostFile' => $vendorDir . '/guzzlehttp/guzzle/src/Post/PostFile.php', - 'GuzzleHttp\\Post\\PostFileInterface' => $vendorDir . '/guzzlehttp/guzzle/src/Post/PostFileInterface.php', - 'GuzzleHttp\\Query' => $vendorDir . '/guzzlehttp/guzzle/src/Query.php', - 'GuzzleHttp\\QueryParser' => $vendorDir . '/guzzlehttp/guzzle/src/QueryParser.php', - 'GuzzleHttp\\RequestFsm' => $vendorDir . '/guzzlehttp/guzzle/src/RequestFsm.php', - 'GuzzleHttp\\RingBridge' => $vendorDir . '/guzzlehttp/guzzle/src/RingBridge.php', - 'GuzzleHttp\\Ring\\Client\\ClientUtils' => $vendorDir . '/guzzlehttp/ringphp/src/Client/ClientUtils.php', - 'GuzzleHttp\\Ring\\Client\\CurlFactory' => $vendorDir . '/guzzlehttp/ringphp/src/Client/CurlFactory.php', - 'GuzzleHttp\\Ring\\Client\\CurlHandler' => $vendorDir . '/guzzlehttp/ringphp/src/Client/CurlHandler.php', - 'GuzzleHttp\\Ring\\Client\\CurlMultiHandler' => $vendorDir . '/guzzlehttp/ringphp/src/Client/CurlMultiHandler.php', - 'GuzzleHttp\\Ring\\Client\\Middleware' => $vendorDir . '/guzzlehttp/ringphp/src/Client/Middleware.php', - 'GuzzleHttp\\Ring\\Client\\MockHandler' => $vendorDir . '/guzzlehttp/ringphp/src/Client/MockHandler.php', - 'GuzzleHttp\\Ring\\Client\\StreamHandler' => $vendorDir . '/guzzlehttp/ringphp/src/Client/StreamHandler.php', - 'GuzzleHttp\\Ring\\Core' => $vendorDir . '/guzzlehttp/ringphp/src/Core.php', - 'GuzzleHttp\\Ring\\Exception\\CancelledException' => $vendorDir . '/guzzlehttp/ringphp/src/Exception/CancelledException.php', - 'GuzzleHttp\\Ring\\Exception\\CancelledFutureAccessException' => $vendorDir . '/guzzlehttp/ringphp/src/Exception/CancelledFutureAccessException.php', - 'GuzzleHttp\\Ring\\Exception\\ConnectException' => $vendorDir . '/guzzlehttp/ringphp/src/Exception/ConnectException.php', - 'GuzzleHttp\\Ring\\Exception\\RingException' => $vendorDir . '/guzzlehttp/ringphp/src/Exception/RingException.php', - 'GuzzleHttp\\Ring\\Future\\BaseFutureTrait' => $vendorDir . '/guzzlehttp/ringphp/src/Future/BaseFutureTrait.php', - 'GuzzleHttp\\Ring\\Future\\CompletedFutureArray' => $vendorDir . '/guzzlehttp/ringphp/src/Future/CompletedFutureArray.php', - 'GuzzleHttp\\Ring\\Future\\CompletedFutureValue' => $vendorDir . '/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php', - 'GuzzleHttp\\Ring\\Future\\FutureArray' => $vendorDir . '/guzzlehttp/ringphp/src/Future/FutureArray.php', - 'GuzzleHttp\\Ring\\Future\\FutureArrayInterface' => $vendorDir . '/guzzlehttp/ringphp/src/Future/FutureArrayInterface.php', - 'GuzzleHttp\\Ring\\Future\\FutureInterface' => $vendorDir . '/guzzlehttp/ringphp/src/Future/FutureInterface.php', - 'GuzzleHttp\\Ring\\Future\\FutureValue' => $vendorDir . '/guzzlehttp/ringphp/src/Future/FutureValue.php', - 'GuzzleHttp\\Ring\\Future\\MagicFutureTrait' => $vendorDir . '/guzzlehttp/ringphp/src/Future/MagicFutureTrait.php', - 'GuzzleHttp\\Stream\\AppendStream' => $vendorDir . '/guzzlehttp/streams/src/AppendStream.php', - 'GuzzleHttp\\Stream\\AsyncReadStream' => $vendorDir . '/guzzlehttp/streams/src/AsyncReadStream.php', - 'GuzzleHttp\\Stream\\BufferStream' => $vendorDir . '/guzzlehttp/streams/src/BufferStream.php', - 'GuzzleHttp\\Stream\\CachingStream' => $vendorDir . '/guzzlehttp/streams/src/CachingStream.php', - 'GuzzleHttp\\Stream\\DroppingStream' => $vendorDir . '/guzzlehttp/streams/src/DroppingStream.php', - 'GuzzleHttp\\Stream\\Exception\\CannotAttachException' => $vendorDir . '/guzzlehttp/streams/src/Exception/CannotAttachException.php', - 'GuzzleHttp\\Stream\\Exception\\SeekException' => $vendorDir . '/guzzlehttp/streams/src/Exception/SeekException.php', - 'GuzzleHttp\\Stream\\FnStream' => $vendorDir . '/guzzlehttp/streams/src/FnStream.php', - 'GuzzleHttp\\Stream\\GuzzleStreamWrapper' => $vendorDir . '/guzzlehttp/streams/src/GuzzleStreamWrapper.php', - 'GuzzleHttp\\Stream\\InflateStream' => $vendorDir . '/guzzlehttp/streams/src/InflateStream.php', - 'GuzzleHttp\\Stream\\LazyOpenStream' => $vendorDir . '/guzzlehttp/streams/src/LazyOpenStream.php', - 'GuzzleHttp\\Stream\\LimitStream' => $vendorDir . '/guzzlehttp/streams/src/LimitStream.php', - 'GuzzleHttp\\Stream\\MetadataStreamInterface' => $vendorDir . '/guzzlehttp/streams/src/MetadataStreamInterface.php', - 'GuzzleHttp\\Stream\\NoSeekStream' => $vendorDir . '/guzzlehttp/streams/src/NoSeekStream.php', - 'GuzzleHttp\\Stream\\NullStream' => $vendorDir . '/guzzlehttp/streams/src/NullStream.php', - 'GuzzleHttp\\Stream\\PumpStream' => $vendorDir . '/guzzlehttp/streams/src/PumpStream.php', - 'GuzzleHttp\\Stream\\Stream' => $vendorDir . '/guzzlehttp/streams/src/Stream.php', - 'GuzzleHttp\\Stream\\StreamDecoratorTrait' => $vendorDir . '/guzzlehttp/streams/src/StreamDecoratorTrait.php', - 'GuzzleHttp\\Stream\\StreamInterface' => $vendorDir . '/guzzlehttp/streams/src/StreamInterface.php', - 'GuzzleHttp\\Stream\\Utils' => $vendorDir . '/guzzlehttp/streams/src/Utils.php', - 'GuzzleHttp\\Subscriber\\Cookie' => $vendorDir . '/guzzlehttp/guzzle/src/Subscriber/Cookie.php', - 'GuzzleHttp\\Subscriber\\History' => $vendorDir . '/guzzlehttp/guzzle/src/Subscriber/History.php', - 'GuzzleHttp\\Subscriber\\HttpError' => $vendorDir . '/guzzlehttp/guzzle/src/Subscriber/HttpError.php', - 'GuzzleHttp\\Subscriber\\Mock' => $vendorDir . '/guzzlehttp/guzzle/src/Subscriber/Mock.php', - 'GuzzleHttp\\Subscriber\\Prepare' => $vendorDir . '/guzzlehttp/guzzle/src/Subscriber/Prepare.php', - 'GuzzleHttp\\Subscriber\\Redirect' => $vendorDir . '/guzzlehttp/guzzle/src/Subscriber/Redirect.php', - 'GuzzleHttp\\ToArrayInterface' => $vendorDir . '/guzzlehttp/guzzle/src/ToArrayInterface.php', - 'GuzzleHttp\\Transaction' => $vendorDir . '/guzzlehttp/guzzle/src/Transaction.php', + 'GuzzleHttp\\PrepareBodyMiddleware' => $vendorDir . '/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php', + 'GuzzleHttp\\Promise\\AggregateException' => $vendorDir . '/guzzlehttp/promises/src/AggregateException.php', + 'GuzzleHttp\\Promise\\CancellationException' => $vendorDir . '/guzzlehttp/promises/src/CancellationException.php', + 'GuzzleHttp\\Promise\\Coroutine' => $vendorDir . '/guzzlehttp/promises/src/Coroutine.php', + 'GuzzleHttp\\Promise\\EachPromise' => $vendorDir . '/guzzlehttp/promises/src/EachPromise.php', + 'GuzzleHttp\\Promise\\FulfilledPromise' => $vendorDir . '/guzzlehttp/promises/src/FulfilledPromise.php', + 'GuzzleHttp\\Promise\\Promise' => $vendorDir . '/guzzlehttp/promises/src/Promise.php', + 'GuzzleHttp\\Promise\\PromiseInterface' => $vendorDir . '/guzzlehttp/promises/src/PromiseInterface.php', + 'GuzzleHttp\\Promise\\PromisorInterface' => $vendorDir . '/guzzlehttp/promises/src/PromisorInterface.php', + 'GuzzleHttp\\Promise\\RejectedPromise' => $vendorDir . '/guzzlehttp/promises/src/RejectedPromise.php', + 'GuzzleHttp\\Promise\\RejectionException' => $vendorDir . '/guzzlehttp/promises/src/RejectionException.php', + 'GuzzleHttp\\Promise\\TaskQueue' => $vendorDir . '/guzzlehttp/promises/src/TaskQueue.php', + 'GuzzleHttp\\Promise\\TaskQueueInterface' => $vendorDir . '/guzzlehttp/promises/src/TaskQueueInterface.php', + 'GuzzleHttp\\Psr7\\AppendStream' => $vendorDir . '/guzzlehttp/psr7/src/AppendStream.php', + 'GuzzleHttp\\Psr7\\BufferStream' => $vendorDir . '/guzzlehttp/psr7/src/BufferStream.php', + 'GuzzleHttp\\Psr7\\CachingStream' => $vendorDir . '/guzzlehttp/psr7/src/CachingStream.php', + 'GuzzleHttp\\Psr7\\DroppingStream' => $vendorDir . '/guzzlehttp/psr7/src/DroppingStream.php', + 'GuzzleHttp\\Psr7\\FnStream' => $vendorDir . '/guzzlehttp/psr7/src/FnStream.php', + 'GuzzleHttp\\Psr7\\InflateStream' => $vendorDir . '/guzzlehttp/psr7/src/InflateStream.php', + 'GuzzleHttp\\Psr7\\LazyOpenStream' => $vendorDir . '/guzzlehttp/psr7/src/LazyOpenStream.php', + 'GuzzleHttp\\Psr7\\LimitStream' => $vendorDir . '/guzzlehttp/psr7/src/LimitStream.php', + 'GuzzleHttp\\Psr7\\MessageTrait' => $vendorDir . '/guzzlehttp/psr7/src/MessageTrait.php', + 'GuzzleHttp\\Psr7\\MultipartStream' => $vendorDir . '/guzzlehttp/psr7/src/MultipartStream.php', + 'GuzzleHttp\\Psr7\\NoSeekStream' => $vendorDir . '/guzzlehttp/psr7/src/NoSeekStream.php', + 'GuzzleHttp\\Psr7\\PumpStream' => $vendorDir . '/guzzlehttp/psr7/src/PumpStream.php', + 'GuzzleHttp\\Psr7\\Request' => $vendorDir . '/guzzlehttp/psr7/src/Request.php', + 'GuzzleHttp\\Psr7\\Response' => $vendorDir . '/guzzlehttp/psr7/src/Response.php', + 'GuzzleHttp\\Psr7\\Rfc7230' => $vendorDir . '/guzzlehttp/psr7/src/Rfc7230.php', + 'GuzzleHttp\\Psr7\\ServerRequest' => $vendorDir . '/guzzlehttp/psr7/src/ServerRequest.php', + 'GuzzleHttp\\Psr7\\Stream' => $vendorDir . '/guzzlehttp/psr7/src/Stream.php', + 'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => $vendorDir . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php', + 'GuzzleHttp\\Psr7\\StreamWrapper' => $vendorDir . '/guzzlehttp/psr7/src/StreamWrapper.php', + 'GuzzleHttp\\Psr7\\UploadedFile' => $vendorDir . '/guzzlehttp/psr7/src/UploadedFile.php', + 'GuzzleHttp\\Psr7\\Uri' => $vendorDir . '/guzzlehttp/psr7/src/Uri.php', + 'GuzzleHttp\\Psr7\\UriNormalizer' => $vendorDir . '/guzzlehttp/psr7/src/UriNormalizer.php', + 'GuzzleHttp\\Psr7\\UriResolver' => $vendorDir . '/guzzlehttp/psr7/src/UriResolver.php', + 'GuzzleHttp\\RedirectMiddleware' => $vendorDir . '/guzzlehttp/guzzle/src/RedirectMiddleware.php', + 'GuzzleHttp\\RequestOptions' => $vendorDir . '/guzzlehttp/guzzle/src/RequestOptions.php', + 'GuzzleHttp\\RetryMiddleware' => $vendorDir . '/guzzlehttp/guzzle/src/RetryMiddleware.php', + 'GuzzleHttp\\TransferStats' => $vendorDir . '/guzzlehttp/guzzle/src/TransferStats.php', 'GuzzleHttp\\UriTemplate' => $vendorDir . '/guzzlehttp/guzzle/src/UriTemplate.php', - 'GuzzleHttp\\Url' => $vendorDir . '/guzzlehttp/guzzle/src/Url.php', - 'GuzzleHttp\\Utils' => $vendorDir . '/guzzlehttp/guzzle/src/Utils.php', 'Normalizer' => $vendorDir . '/patchwork/utf8/src/Normalizer.php', 'OAuth\\Common\\AutoLoader' => $vendorDir . '/lusitanian/oauth/src/OAuth/Common/AutoLoader.php', 'OAuth\\Common\\Consumer\\Credentials' => $vendorDir . '/lusitanian/oauth/src/OAuth/Common/Consumer/Credentials.php', @@ -229,6 +191,10 @@ return array( 'OAuth\\OAuth2\\Token\\StdOAuth2Token' => $vendorDir . '/lusitanian/oauth/src/OAuth/OAuth2/Token/StdOAuth2Token.php', 'OAuth\\OAuth2\\Token\\TokenInterface' => $vendorDir . '/lusitanian/oauth/src/OAuth/OAuth2/Token/TokenInterface.php', 'OAuth\\ServiceFactory' => $vendorDir . '/lusitanian/oauth/src/OAuth/ServiceFactory.php', + 'PackageVersions\\FallbackVersions' => $vendorDir . '/ocramius/package-versions/src/PackageVersions/FallbackVersions.php', + 'PackageVersions\\Installer' => $vendorDir . '/ocramius/package-versions/src/PackageVersions/Installer.php', + 'PackageVersions\\Versions' => $vendorDir . '/ocramius/package-versions/src/PackageVersions/Versions.php', + 'ParseError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/ParseError.php', 'Patchwork\\PHP\\Shim\\Iconv' => $vendorDir . '/patchwork/utf8/src/Patchwork/PHP/Shim/Iconv.php', 'Patchwork\\PHP\\Shim\\Intl' => $vendorDir . '/patchwork/utf8/src/Patchwork/PHP/Shim/Intl.php', 'Patchwork\\PHP\\Shim\\Mbstring' => $vendorDir . '/patchwork/utf8/src/Patchwork/PHP/Shim/Mbstring.php', @@ -249,7 +215,6 @@ return array( 'ProxyManager\\Exception\\InvalidProxyDirectoryException' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Exception/InvalidProxyDirectoryException.php', 'ProxyManager\\Exception\\UnsupportedProxiedClassException' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Exception/UnsupportedProxiedClassException.php', 'ProxyManager\\Factory\\AbstractBaseFactory' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Factory/AbstractBaseFactory.php', - 'ProxyManager\\Factory\\AbstractLazyFactory' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Factory/AbstractLazyFactory.php', 'ProxyManager\\Factory\\AccessInterceptorScopeLocalizerFactory' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorScopeLocalizerFactory.php', 'ProxyManager\\Factory\\AccessInterceptorValueHolderFactory' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorValueHolderFactory.php', 'ProxyManager\\Factory\\LazyLoadingGhostFactory' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Factory/LazyLoadingGhostFactory.php', @@ -270,15 +235,15 @@ return array( 'ProxyManager\\Generator\\ClassGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Generator/ClassGenerator.php', 'ProxyManager\\Generator\\MagicMethodGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Generator/MagicMethodGenerator.php', 'ProxyManager\\Generator\\MethodGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Generator/MethodGenerator.php', - 'ProxyManager\\Generator\\ParameterGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Generator/ParameterGenerator.php', 'ProxyManager\\Generator\\Util\\ClassGeneratorUtils' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ClassGeneratorUtils.php', + 'ProxyManager\\Generator\\Util\\ProxiedMethodReturnExpression' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ProxiedMethodReturnExpression.php', 'ProxyManager\\Generator\\Util\\UniqueIdentifierGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Generator/Util/UniqueIdentifierGenerator.php', 'ProxyManager\\Inflector\\ClassNameInflector' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Inflector/ClassNameInflector.php', 'ProxyManager\\Inflector\\ClassNameInflectorInterface' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Inflector/ClassNameInflectorInterface.php', 'ProxyManager\\Inflector\\Util\\ParameterEncoder' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterEncoder.php', 'ProxyManager\\Inflector\\Util\\ParameterHasher' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterHasher.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizerGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizerGenerator.php', - 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\Constructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Constructor.php', + 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\BindProxyProperties' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/BindProxyProperties.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\InterceptedMethod' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/InterceptedMethod.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\MagicClone' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicClone.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\MagicGet' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicGet.php', @@ -286,15 +251,16 @@ return array( 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\MagicSet' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSet.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\MagicSleep' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSleep.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\MagicUnset' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicUnset.php', + 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\StaticProxyConstructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/StaticProxyConstructor.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\Util\\InterceptorGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGenerator.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolderGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolderGenerator.php', - 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\Constructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Constructor.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\InterceptedMethod' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/InterceptedMethod.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\MagicClone' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicClone.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\MagicGet' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicGet.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\MagicIsset' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicIsset.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\MagicSet' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicSet.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\MagicUnset' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicUnset.php', + 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\StaticProxyConstructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/StaticProxyConstructor.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\Util\\InterceptorGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGenerator.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptor\\MethodGenerator\\MagicWakeup' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/MagicWakeup.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptor\\MethodGenerator\\SetMethodPrefixInterceptor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/SetMethodPrefixInterceptor.php', @@ -307,7 +273,6 @@ return array( 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\GetProxyInitializer' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/GetProxyInitializer.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\InitializeProxy' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/InitializeProxy.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\IsProxyInitialized' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/IsProxyInitialized.php', - 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\LazyLoadingMethodInterceptor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/LazyLoadingMethodInterceptor.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\MagicClone' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicClone.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\MagicGet' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicGet.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\MagicIsset' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicIsset.php', @@ -317,6 +282,8 @@ return array( 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\SetProxyInitializer' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/SetProxyInitializer.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\PropertyGenerator\\InitializationTracker' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializationTracker.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\PropertyGenerator\\InitializerProperty' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializerProperty.php', + 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\PropertyGenerator\\PrivatePropertiesMap' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/PrivatePropertiesMap.php', + 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\PropertyGenerator\\ProtectedPropertiesMap' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/ProtectedPropertiesMap.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolderGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolderGenerator.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolder\\MethodGenerator\\GetProxyInitializer' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/GetProxyInitializer.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolder\\MethodGenerator\\InitializeProxy' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/InitializeProxy.php', @@ -331,26 +298,30 @@ return array( 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolder\\MethodGenerator\\SetProxyInitializer' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/SetProxyInitializer.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolder\\PropertyGenerator\\InitializerProperty' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/InitializerProperty.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolder\\PropertyGenerator\\ValueHolderProperty' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/ValueHolderProperty.php', - 'ProxyManager\\ProxyGenerator\\LazyLoading\\MethodGenerator\\Constructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoading/MethodGenerator/Constructor.php', + 'ProxyManager\\ProxyGenerator\\LazyLoading\\MethodGenerator\\StaticProxyConstructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoading/MethodGenerator/StaticProxyConstructor.php', 'ProxyManager\\ProxyGenerator\\NullObjectGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObjectGenerator.php', - 'ProxyManager\\ProxyGenerator\\NullObject\\MethodGenerator\\Constructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/Constructor.php', 'ProxyManager\\ProxyGenerator\\NullObject\\MethodGenerator\\NullObjectMethodInterceptor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/NullObjectMethodInterceptor.php', - 'ProxyManager\\ProxyGenerator\\PropertyGenerator\\PublicPropertiesDefaults' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/PropertyGenerator/PublicPropertiesDefaults.php', + 'ProxyManager\\ProxyGenerator\\NullObject\\MethodGenerator\\StaticProxyConstructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/StaticProxyConstructor.php', 'ProxyManager\\ProxyGenerator\\PropertyGenerator\\PublicPropertiesMap' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/PropertyGenerator/PublicPropertiesMap.php', 'ProxyManager\\ProxyGenerator\\ProxyGeneratorInterface' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ProxyGeneratorInterface.php', 'ProxyManager\\ProxyGenerator\\RemoteObjectGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObjectGenerator.php', - 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\Constructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/Constructor.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\MagicGet' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicGet.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\MagicIsset' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicIsset.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\MagicSet' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicSet.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\MagicUnset' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicUnset.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\RemoteObjectMethod' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/RemoteObjectMethod.php', + 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\StaticProxyConstructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/StaticProxyConstructor.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\PropertyGenerator\\AdapterProperty' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/PropertyGenerator/AdapterProperty.php', + 'ProxyManager\\ProxyGenerator\\Util\\GetMethodIfExists' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/GetMethodIfExists.php', + 'ProxyManager\\ProxyGenerator\\Util\\Properties' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/Properties.php', 'ProxyManager\\ProxyGenerator\\Util\\ProxiedMethodsFilter' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/ProxiedMethodsFilter.php', 'ProxyManager\\ProxyGenerator\\Util\\PublicScopeSimulator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/PublicScopeSimulator.php', + 'ProxyManager\\ProxyGenerator\\Util\\UnsetPropertiesGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/UnsetPropertiesGenerator.php', + 'ProxyManager\\ProxyGenerator\\ValueHolder\\MethodGenerator\\Constructor' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/Constructor.php', 'ProxyManager\\ProxyGenerator\\ValueHolder\\MethodGenerator\\GetWrappedValueHolderValue' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/GetWrappedValueHolderValue.php', 'ProxyManager\\ProxyGenerator\\ValueHolder\\MethodGenerator\\MagicSleep' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/MagicSleep.php', 'ProxyManager\\Proxy\\AccessInterceptorInterface' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorInterface.php', + 'ProxyManager\\Proxy\\AccessInterceptorValueHolderInterface' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorValueHolderInterface.php', 'ProxyManager\\Proxy\\Exception\\RemoteObjectException' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Proxy/Exception/RemoteObjectException.php', 'ProxyManager\\Proxy\\FallbackValueHolderInterface' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Proxy/FallbackValueHolderInterface.php', 'ProxyManager\\Proxy\\GhostObjectInterface' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Proxy/GhostObjectInterface.php', @@ -370,7 +341,18 @@ return array( 'ProxyManager\\Signature\\SignatureCheckerInterface' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureCheckerInterface.php', 'ProxyManager\\Signature\\SignatureGenerator' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGenerator.php', 'ProxyManager\\Signature\\SignatureGeneratorInterface' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGeneratorInterface.php', + 'ProxyManager\\Stub\\EmptyClassStub' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Stub/EmptyClassStub.php', 'ProxyManager\\Version' => $vendorDir . '/ocramius/proxy-manager/src/ProxyManager/Version.php', + 'Psr\\Container\\ContainerExceptionInterface' => $vendorDir . '/psr/container/src/ContainerExceptionInterface.php', + 'Psr\\Container\\ContainerInterface' => $vendorDir . '/psr/container/src/ContainerInterface.php', + 'Psr\\Container\\NotFoundExceptionInterface' => $vendorDir . '/psr/container/src/NotFoundExceptionInterface.php', + 'Psr\\Http\\Message\\MessageInterface' => $vendorDir . '/psr/http-message/src/MessageInterface.php', + 'Psr\\Http\\Message\\RequestInterface' => $vendorDir . '/psr/http-message/src/RequestInterface.php', + 'Psr\\Http\\Message\\ResponseInterface' => $vendorDir . '/psr/http-message/src/ResponseInterface.php', + 'Psr\\Http\\Message\\ServerRequestInterface' => $vendorDir . '/psr/http-message/src/ServerRequestInterface.php', + 'Psr\\Http\\Message\\StreamInterface' => $vendorDir . '/psr/http-message/src/StreamInterface.php', + 'Psr\\Http\\Message\\UploadedFileInterface' => $vendorDir . '/psr/http-message/src/UploadedFileInterface.php', + 'Psr\\Http\\Message\\UriInterface' => $vendorDir . '/psr/http-message/src/UriInterface.php', 'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/Psr/Log/AbstractLogger.php', 'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/Psr/Log/InvalidArgumentException.php', 'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/Psr/Log/LogLevel.php', @@ -391,20 +373,7 @@ return array( 'ReCaptcha\\RequestMethod\\SocketPost' => $vendorDir . '/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php', 'ReCaptcha\\RequestParameters' => $vendorDir . '/google/recaptcha/src/ReCaptcha/RequestParameters.php', 'ReCaptcha\\Response' => $vendorDir . '/google/recaptcha/src/ReCaptcha/Response.php', - 'React\\Promise\\CancellablePromiseInterface' => $vendorDir . '/react/promise/src/CancellablePromiseInterface.php', - 'React\\Promise\\CancellationQueue' => $vendorDir . '/react/promise/src/CancellationQueue.php', - 'React\\Promise\\Deferred' => $vendorDir . '/react/promise/src/Deferred.php', - 'React\\Promise\\Exception\\LengthException' => $vendorDir . '/react/promise/src/Exception/LengthException.php', - 'React\\Promise\\ExtendedPromiseInterface' => $vendorDir . '/react/promise/src/ExtendedPromiseInterface.php', - 'React\\Promise\\FulfilledPromise' => $vendorDir . '/react/promise/src/FulfilledPromise.php', - 'React\\Promise\\LazyPromise' => $vendorDir . '/react/promise/src/LazyPromise.php', - 'React\\Promise\\Promise' => $vendorDir . '/react/promise/src/Promise.php', - 'React\\Promise\\PromiseInterface' => $vendorDir . '/react/promise/src/PromiseInterface.php', - 'React\\Promise\\PromisorInterface' => $vendorDir . '/react/promise/src/PromisorInterface.php', - 'React\\Promise\\RejectedPromise' => $vendorDir . '/react/promise/src/RejectedPromise.php', - 'React\\Promise\\UnhandledRejectionException' => $vendorDir . '/react/promise/src/UnhandledRejectionException.php', - 'RecursiveCallbackFilterIterator' => $vendorDir . '/symfony/polyfill-php54/Resources/stubs/RecursiveCallbackFilterIterator.php', - 'SessionHandlerInterface' => $vendorDir . '/symfony/polyfill-php54/Resources/stubs/SessionHandlerInterface.php', + 'SessionUpdateTimestampHandlerInterface' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php', 'Symfony\\Bridge\\ProxyManager\\LazyProxy\\Instantiator\\LazyLoadingValueHolderFactoryV1' => $vendorDir . '/symfony/proxy-manager-bridge/LazyProxy/Instantiator/LazyLoadingValueHolderFactoryV1.php', 'Symfony\\Bridge\\ProxyManager\\LazyProxy\\Instantiator\\LazyLoadingValueHolderFactoryV2' => $vendorDir . '/symfony/proxy-manager-bridge/LazyProxy/Instantiator/LazyLoadingValueHolderFactoryV2.php', 'Symfony\\Bridge\\ProxyManager\\LazyProxy\\Instantiator\\RuntimeInstantiator' => $vendorDir . '/symfony/proxy-manager-bridge/LazyProxy/Instantiator/RuntimeInstantiator.php', @@ -421,12 +390,16 @@ return array( 'Symfony\\Bridge\\Twig\\Extension\\FormExtension' => $vendorDir . '/symfony/twig-bridge/Extension/FormExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\HttpFoundationExtension' => $vendorDir . '/symfony/twig-bridge/Extension/HttpFoundationExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\HttpKernelExtension' => $vendorDir . '/symfony/twig-bridge/Extension/HttpKernelExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\HttpKernelRuntime' => $vendorDir . '/symfony/twig-bridge/Extension/HttpKernelRuntime.php', + 'Symfony\\Bridge\\Twig\\Extension\\InitRuntimeInterface' => $vendorDir . '/symfony/twig-bridge/Extension/InitRuntimeInterface.php', 'Symfony\\Bridge\\Twig\\Extension\\LogoutUrlExtension' => $vendorDir . '/symfony/twig-bridge/Extension/LogoutUrlExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension' => $vendorDir . '/symfony/twig-bridge/Extension/ProfilerExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\RoutingExtension' => $vendorDir . '/symfony/twig-bridge/Extension/RoutingExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\SecurityExtension' => $vendorDir . '/symfony/twig-bridge/Extension/SecurityExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\StopwatchExtension' => $vendorDir . '/symfony/twig-bridge/Extension/StopwatchExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\TranslationExtension' => $vendorDir . '/symfony/twig-bridge/Extension/TranslationExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\WebLinkExtension' => $vendorDir . '/symfony/twig-bridge/Extension/WebLinkExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\WorkflowExtension' => $vendorDir . '/symfony/twig-bridge/Extension/WorkflowExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\YamlExtension' => $vendorDir . '/symfony/twig-bridge/Extension/YamlExtension.php', 'Symfony\\Bridge\\Twig\\Form\\TwigRenderer' => $vendorDir . '/symfony/twig-bridge/Form/TwigRenderer.php', 'Symfony\\Bridge\\Twig\\Form\\TwigRendererEngine' => $vendorDir . '/symfony/twig-bridge/Form/TwigRendererEngine.php', @@ -436,7 +409,6 @@ return array( 'Symfony\\Bridge\\Twig\\NodeVisitor\\TranslationDefaultDomainNodeVisitor' => $vendorDir . '/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php', 'Symfony\\Bridge\\Twig\\NodeVisitor\\TranslationNodeVisitor' => $vendorDir . '/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php', 'Symfony\\Bridge\\Twig\\Node\\DumpNode' => $vendorDir . '/symfony/twig-bridge/Node/DumpNode.php', - 'Symfony\\Bridge\\Twig\\Node\\FormEnctypeNode' => $vendorDir . '/symfony/twig-bridge/Node/FormEnctypeNode.php', 'Symfony\\Bridge\\Twig\\Node\\FormThemeNode' => $vendorDir . '/symfony/twig-bridge/Node/FormThemeNode.php', 'Symfony\\Bridge\\Twig\\Node\\RenderBlockNode' => $vendorDir . '/symfony/twig-bridge/Node/RenderBlockNode.php', 'Symfony\\Bridge\\Twig\\Node\\SearchAndRenderBlockNode' => $vendorDir . '/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php', @@ -451,6 +423,7 @@ return array( 'Symfony\\Bridge\\Twig\\TokenParser\\TransTokenParser' => $vendorDir . '/symfony/twig-bridge/TokenParser/TransTokenParser.php', 'Symfony\\Bridge\\Twig\\Translation\\TwigExtractor' => $vendorDir . '/symfony/twig-bridge/Translation/TwigExtractor.php', 'Symfony\\Bridge\\Twig\\TwigEngine' => $vendorDir . '/symfony/twig-bridge/TwigEngine.php', + 'Symfony\\Bridge\\Twig\\UndefinedCallableHandler' => $vendorDir . '/symfony/twig-bridge/UndefinedCallableHandler.php', 'Symfony\\Component\\Config\\ConfigCache' => $vendorDir . '/symfony/config/ConfigCache.php', 'Symfony\\Component\\Config\\ConfigCacheFactory' => $vendorDir . '/symfony/config/ConfigCacheFactory.php', 'Symfony\\Component\\Config\\ConfigCacheFactoryInterface' => $vendorDir . '/symfony/config/ConfigCacheFactoryInterface.php', @@ -493,15 +466,17 @@ return array( 'Symfony\\Component\\Config\\Definition\\Processor' => $vendorDir . '/symfony/config/Definition/Processor.php', 'Symfony\\Component\\Config\\Definition\\PrototypeNodeInterface' => $vendorDir . '/symfony/config/Definition/PrototypeNodeInterface.php', 'Symfony\\Component\\Config\\Definition\\PrototypedArrayNode' => $vendorDir . '/symfony/config/Definition/PrototypedArrayNode.php', - 'Symfony\\Component\\Config\\Definition\\ReferenceDumper' => $vendorDir . '/symfony/config/Definition/ReferenceDumper.php', 'Symfony\\Component\\Config\\Definition\\ScalarNode' => $vendorDir . '/symfony/config/Definition/ScalarNode.php', 'Symfony\\Component\\Config\\Definition\\VariableNode' => $vendorDir . '/symfony/config/Definition/VariableNode.php', + 'Symfony\\Component\\Config\\DependencyInjection\\ConfigCachePass' => $vendorDir . '/symfony/config/DependencyInjection/ConfigCachePass.php', 'Symfony\\Component\\Config\\Exception\\FileLoaderImportCircularReferenceException' => $vendorDir . '/symfony/config/Exception/FileLoaderImportCircularReferenceException.php', 'Symfony\\Component\\Config\\Exception\\FileLoaderLoadException' => $vendorDir . '/symfony/config/Exception/FileLoaderLoadException.php', + 'Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException' => $vendorDir . '/symfony/config/Exception/FileLocatorFileNotFoundException.php', 'Symfony\\Component\\Config\\FileLocator' => $vendorDir . '/symfony/config/FileLocator.php', 'Symfony\\Component\\Config\\FileLocatorInterface' => $vendorDir . '/symfony/config/FileLocatorInterface.php', 'Symfony\\Component\\Config\\Loader\\DelegatingLoader' => $vendorDir . '/symfony/config/Loader/DelegatingLoader.php', 'Symfony\\Component\\Config\\Loader\\FileLoader' => $vendorDir . '/symfony/config/Loader/FileLoader.php', + 'Symfony\\Component\\Config\\Loader\\GlobFileLoader' => $vendorDir . '/symfony/config/Loader/GlobFileLoader.php', 'Symfony\\Component\\Config\\Loader\\Loader' => $vendorDir . '/symfony/config/Loader/Loader.php', 'Symfony\\Component\\Config\\Loader\\LoaderInterface' => $vendorDir . '/symfony/config/Loader/LoaderInterface.php', 'Symfony\\Component\\Config\\Loader\\LoaderResolver' => $vendorDir . '/symfony/config/Loader/LoaderResolver.php', @@ -509,19 +484,31 @@ return array( 'Symfony\\Component\\Config\\ResourceCheckerConfigCache' => $vendorDir . '/symfony/config/ResourceCheckerConfigCache.php', 'Symfony\\Component\\Config\\ResourceCheckerConfigCacheFactory' => $vendorDir . '/symfony/config/ResourceCheckerConfigCacheFactory.php', 'Symfony\\Component\\Config\\ResourceCheckerInterface' => $vendorDir . '/symfony/config/ResourceCheckerInterface.php', - 'Symfony\\Component\\Config\\Resource\\BCResourceInterfaceChecker' => $vendorDir . '/symfony/config/Resource/BCResourceInterfaceChecker.php', + 'Symfony\\Component\\Config\\Resource\\ClassExistenceResource' => $vendorDir . '/symfony/config/Resource/ClassExistenceResource.php', + 'Symfony\\Component\\Config\\Resource\\ComposerResource' => $vendorDir . '/symfony/config/Resource/ComposerResource.php', 'Symfony\\Component\\Config\\Resource\\DirectoryResource' => $vendorDir . '/symfony/config/Resource/DirectoryResource.php', 'Symfony\\Component\\Config\\Resource\\FileExistenceResource' => $vendorDir . '/symfony/config/Resource/FileExistenceResource.php', 'Symfony\\Component\\Config\\Resource\\FileResource' => $vendorDir . '/symfony/config/Resource/FileResource.php', + 'Symfony\\Component\\Config\\Resource\\GlobResource' => $vendorDir . '/symfony/config/Resource/GlobResource.php', + 'Symfony\\Component\\Config\\Resource\\ReflectionClassResource' => $vendorDir . '/symfony/config/Resource/ReflectionClassResource.php', + 'Symfony\\Component\\Config\\Resource\\ReflectionMethodHhvmWrapper' => $vendorDir . '/symfony/config/Resource/ReflectionClassResource.php', + 'Symfony\\Component\\Config\\Resource\\ReflectionParameterHhvmWrapper' => $vendorDir . '/symfony/config/Resource/ReflectionClassResource.php', 'Symfony\\Component\\Config\\Resource\\ResourceInterface' => $vendorDir . '/symfony/config/Resource/ResourceInterface.php', 'Symfony\\Component\\Config\\Resource\\SelfCheckingResourceChecker' => $vendorDir . '/symfony/config/Resource/SelfCheckingResourceChecker.php', 'Symfony\\Component\\Config\\Resource\\SelfCheckingResourceInterface' => $vendorDir . '/symfony/config/Resource/SelfCheckingResourceInterface.php', + 'Symfony\\Component\\Config\\Util\\Exception\\InvalidXmlException' => $vendorDir . '/symfony/config/Util/Exception/InvalidXmlException.php', + 'Symfony\\Component\\Config\\Util\\Exception\\XmlParsingException' => $vendorDir . '/symfony/config/Util/Exception/XmlParsingException.php', 'Symfony\\Component\\Config\\Util\\XmlUtils' => $vendorDir . '/symfony/config/Util/XmlUtils.php', 'Symfony\\Component\\Console\\Application' => $vendorDir . '/symfony/console/Application.php', + 'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => $vendorDir . '/symfony/console/CommandLoader/CommandLoaderInterface.php', + 'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => $vendorDir . '/symfony/console/CommandLoader/ContainerCommandLoader.php', + 'Symfony\\Component\\Console\\CommandLoader\\FactoryCommandLoader' => $vendorDir . '/symfony/console/CommandLoader/FactoryCommandLoader.php', 'Symfony\\Component\\Console\\Command\\Command' => $vendorDir . '/symfony/console/Command/Command.php', 'Symfony\\Component\\Console\\Command\\HelpCommand' => $vendorDir . '/symfony/console/Command/HelpCommand.php', 'Symfony\\Component\\Console\\Command\\ListCommand' => $vendorDir . '/symfony/console/Command/ListCommand.php', + 'Symfony\\Component\\Console\\Command\\LockableTrait' => $vendorDir . '/symfony/console/Command/LockableTrait.php', 'Symfony\\Component\\Console\\ConsoleEvents' => $vendorDir . '/symfony/console/ConsoleEvents.php', + 'Symfony\\Component\\Console\\DependencyInjection\\AddConsoleCommandPass' => $vendorDir . '/symfony/console/DependencyInjection/AddConsoleCommandPass.php', 'Symfony\\Component\\Console\\Descriptor\\ApplicationDescription' => $vendorDir . '/symfony/console/Descriptor/ApplicationDescription.php', 'Symfony\\Component\\Console\\Descriptor\\Descriptor' => $vendorDir . '/symfony/console/Descriptor/Descriptor.php', 'Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => $vendorDir . '/symfony/console/Descriptor/DescriptorInterface.php', @@ -529,7 +516,9 @@ return array( 'Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => $vendorDir . '/symfony/console/Descriptor/MarkdownDescriptor.php', 'Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => $vendorDir . '/symfony/console/Descriptor/TextDescriptor.php', 'Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => $vendorDir . '/symfony/console/Descriptor/XmlDescriptor.php', + 'Symfony\\Component\\Console\\EventListener\\ErrorListener' => $vendorDir . '/symfony/console/EventListener/ErrorListener.php', 'Symfony\\Component\\Console\\Event\\ConsoleCommandEvent' => $vendorDir . '/symfony/console/Event/ConsoleCommandEvent.php', + 'Symfony\\Component\\Console\\Event\\ConsoleErrorEvent' => $vendorDir . '/symfony/console/Event/ConsoleErrorEvent.php', 'Symfony\\Component\\Console\\Event\\ConsoleEvent' => $vendorDir . '/symfony/console/Event/ConsoleEvent.php', 'Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent' => $vendorDir . '/symfony/console/Event/ConsoleExceptionEvent.php', 'Symfony\\Component\\Console\\Event\\ConsoleTerminateEvent' => $vendorDir . '/symfony/console/Event/ConsoleTerminateEvent.php', @@ -546,7 +535,6 @@ return array( 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleStack' => $vendorDir . '/symfony/console/Formatter/OutputFormatterStyleStack.php', 'Symfony\\Component\\Console\\Helper\\DebugFormatterHelper' => $vendorDir . '/symfony/console/Helper/DebugFormatterHelper.php', 'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => $vendorDir . '/symfony/console/Helper/DescriptorHelper.php', - 'Symfony\\Component\\Console\\Helper\\DialogHelper' => $vendorDir . '/symfony/console/Helper/DialogHelper.php', 'Symfony\\Component\\Console\\Helper\\FormatterHelper' => $vendorDir . '/symfony/console/Helper/FormatterHelper.php', 'Symfony\\Component\\Console\\Helper\\Helper' => $vendorDir . '/symfony/console/Helper/Helper.php', 'Symfony\\Component\\Console\\Helper\\HelperInterface' => $vendorDir . '/symfony/console/Helper/HelperInterface.php', @@ -554,13 +542,11 @@ return array( 'Symfony\\Component\\Console\\Helper\\InputAwareHelper' => $vendorDir . '/symfony/console/Helper/InputAwareHelper.php', 'Symfony\\Component\\Console\\Helper\\ProcessHelper' => $vendorDir . '/symfony/console/Helper/ProcessHelper.php', 'Symfony\\Component\\Console\\Helper\\ProgressBar' => $vendorDir . '/symfony/console/Helper/ProgressBar.php', - 'Symfony\\Component\\Console\\Helper\\ProgressHelper' => $vendorDir . '/symfony/console/Helper/ProgressHelper.php', 'Symfony\\Component\\Console\\Helper\\ProgressIndicator' => $vendorDir . '/symfony/console/Helper/ProgressIndicator.php', 'Symfony\\Component\\Console\\Helper\\QuestionHelper' => $vendorDir . '/symfony/console/Helper/QuestionHelper.php', 'Symfony\\Component\\Console\\Helper\\SymfonyQuestionHelper' => $vendorDir . '/symfony/console/Helper/SymfonyQuestionHelper.php', 'Symfony\\Component\\Console\\Helper\\Table' => $vendorDir . '/symfony/console/Helper/Table.php', 'Symfony\\Component\\Console\\Helper\\TableCell' => $vendorDir . '/symfony/console/Helper/TableCell.php', - 'Symfony\\Component\\Console\\Helper\\TableHelper' => $vendorDir . '/symfony/console/Helper/TableHelper.php', 'Symfony\\Component\\Console\\Helper\\TableSeparator' => $vendorDir . '/symfony/console/Helper/TableSeparator.php', 'Symfony\\Component\\Console\\Helper\\TableStyle' => $vendorDir . '/symfony/console/Helper/TableStyle.php', 'Symfony\\Component\\Console\\Input\\ArgvInput' => $vendorDir . '/symfony/console/Input/ArgvInput.php', @@ -571,6 +557,7 @@ return array( 'Symfony\\Component\\Console\\Input\\InputDefinition' => $vendorDir . '/symfony/console/Input/InputDefinition.php', 'Symfony\\Component\\Console\\Input\\InputInterface' => $vendorDir . '/symfony/console/Input/InputInterface.php', 'Symfony\\Component\\Console\\Input\\InputOption' => $vendorDir . '/symfony/console/Input/InputOption.php', + 'Symfony\\Component\\Console\\Input\\StreamableInputInterface' => $vendorDir . '/symfony/console/Input/StreamableInputInterface.php', 'Symfony\\Component\\Console\\Input\\StringInput' => $vendorDir . '/symfony/console/Input/StringInput.php', 'Symfony\\Component\\Console\\Logger\\ConsoleLogger' => $vendorDir . '/symfony/console/Logger/ConsoleLogger.php', 'Symfony\\Component\\Console\\Output\\BufferedOutput' => $vendorDir . '/symfony/console/Output/BufferedOutput.php', @@ -583,25 +570,24 @@ return array( 'Symfony\\Component\\Console\\Question\\ChoiceQuestion' => $vendorDir . '/symfony/console/Question/ChoiceQuestion.php', 'Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => $vendorDir . '/symfony/console/Question/ConfirmationQuestion.php', 'Symfony\\Component\\Console\\Question\\Question' => $vendorDir . '/symfony/console/Question/Question.php', - 'Symfony\\Component\\Console\\Shell' => $vendorDir . '/symfony/console/Shell.php', 'Symfony\\Component\\Console\\Style\\OutputStyle' => $vendorDir . '/symfony/console/Style/OutputStyle.php', 'Symfony\\Component\\Console\\Style\\StyleInterface' => $vendorDir . '/symfony/console/Style/StyleInterface.php', 'Symfony\\Component\\Console\\Style\\SymfonyStyle' => $vendorDir . '/symfony/console/Style/SymfonyStyle.php', + 'Symfony\\Component\\Console\\Terminal' => $vendorDir . '/symfony/console/Terminal.php', 'Symfony\\Component\\Console\\Tester\\ApplicationTester' => $vendorDir . '/symfony/console/Tester/ApplicationTester.php', 'Symfony\\Component\\Console\\Tester\\CommandTester' => $vendorDir . '/symfony/console/Tester/CommandTester.php', 'Symfony\\Component\\Debug\\BufferingLogger' => $vendorDir . '/symfony/debug/BufferingLogger.php', 'Symfony\\Component\\Debug\\Debug' => $vendorDir . '/symfony/debug/Debug.php', 'Symfony\\Component\\Debug\\DebugClassLoader' => $vendorDir . '/symfony/debug/DebugClassLoader.php', 'Symfony\\Component\\Debug\\ErrorHandler' => $vendorDir . '/symfony/debug/ErrorHandler.php', - 'Symfony\\Component\\Debug\\ErrorHandlerCanary' => $vendorDir . '/symfony/debug/ErrorHandler.php', 'Symfony\\Component\\Debug\\ExceptionHandler' => $vendorDir . '/symfony/debug/ExceptionHandler.php', 'Symfony\\Component\\Debug\\Exception\\ClassNotFoundException' => $vendorDir . '/symfony/debug/Exception/ClassNotFoundException.php', 'Symfony\\Component\\Debug\\Exception\\ContextErrorException' => $vendorDir . '/symfony/debug/Exception/ContextErrorException.php', - 'Symfony\\Component\\Debug\\Exception\\DummyException' => $vendorDir . '/symfony/debug/Exception/DummyException.php', 'Symfony\\Component\\Debug\\Exception\\FatalErrorException' => $vendorDir . '/symfony/debug/Exception/FatalErrorException.php', 'Symfony\\Component\\Debug\\Exception\\FatalThrowableError' => $vendorDir . '/symfony/debug/Exception/FatalThrowableError.php', 'Symfony\\Component\\Debug\\Exception\\FlattenException' => $vendorDir . '/symfony/debug/Exception/FlattenException.php', 'Symfony\\Component\\Debug\\Exception\\OutOfMemoryException' => $vendorDir . '/symfony/debug/Exception/OutOfMemoryException.php', + 'Symfony\\Component\\Debug\\Exception\\SilencedErrorContext' => $vendorDir . '/symfony/debug/Exception/SilencedErrorContext.php', 'Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException' => $vendorDir . '/symfony/debug/Exception/UndefinedFunctionException.php', 'Symfony\\Component\\Debug\\Exception\\UndefinedMethodException' => $vendorDir . '/symfony/debug/Exception/UndefinedMethodException.php', 'Symfony\\Component\\Debug\\FatalErrorHandler\\ClassNotFoundFatalErrorHandler' => $vendorDir . '/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php', @@ -609,9 +595,20 @@ return array( 'Symfony\\Component\\Debug\\FatalErrorHandler\\UndefinedFunctionFatalErrorHandler' => $vendorDir . '/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php', 'Symfony\\Component\\Debug\\FatalErrorHandler\\UndefinedMethodFatalErrorHandler' => $vendorDir . '/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php', 'Symfony\\Component\\DependencyInjection\\Alias' => $vendorDir . '/symfony/dependency-injection/Alias.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\ArgumentInterface' => $vendorDir . '/symfony/dependency-injection/Argument/ArgumentInterface.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\BoundArgument' => $vendorDir . '/symfony/dependency-injection/Argument/BoundArgument.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\IteratorArgument' => $vendorDir . '/symfony/dependency-injection/Argument/IteratorArgument.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\RewindableGenerator' => $vendorDir . '/symfony/dependency-injection/Argument/RewindableGenerator.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\ServiceClosureArgument' => $vendorDir . '/symfony/dependency-injection/Argument/ServiceClosureArgument.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\TaggedIteratorArgument' => $vendorDir . '/symfony/dependency-injection/Argument/TaggedIteratorArgument.php', + 'Symfony\\Component\\DependencyInjection\\ChildDefinition' => $vendorDir . '/symfony/dependency-injection/ChildDefinition.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\AbstractRecursivePass' => $vendorDir . '/symfony/dependency-injection/Compiler/AbstractRecursivePass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\AnalyzeServiceReferencesPass' => $vendorDir . '/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\AutoAliasServicePass' => $vendorDir . '/symfony/dependency-injection/Compiler/AutoAliasServicePass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\AutowireExceptionPass' => $vendorDir . '/symfony/dependency-injection/Compiler/AutowireExceptionPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\AutowirePass' => $vendorDir . '/symfony/dependency-injection/Compiler/AutowirePass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\AutowireRequiredMethodsPass' => $vendorDir . '/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\CheckArgumentsValidityPass' => $vendorDir . '/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\CheckCircularReferencesPass' => $vendorDir . '/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\CheckDefinitionValidityPass' => $vendorDir . '/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\CheckExceptionOnInvalidReferenceBehaviorPass' => $vendorDir . '/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php', @@ -619,26 +616,47 @@ return array( 'Symfony\\Component\\DependencyInjection\\Compiler\\Compiler' => $vendorDir . '/symfony/dependency-injection/Compiler/Compiler.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface' => $vendorDir . '/symfony/dependency-injection/Compiler/CompilerPassInterface.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\DecoratorServicePass' => $vendorDir . '/symfony/dependency-injection/Compiler/DecoratorServicePass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\DefinitionErrorExceptionPass' => $vendorDir . '/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ExtensionCompilerPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ExtensionCompilerPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\FactoryReturnTypePass' => $vendorDir . '/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\InlineServiceDefinitionsPass' => $vendorDir . '/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\LoggingFormatter' => $vendorDir . '/symfony/dependency-injection/Compiler/LoggingFormatter.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationContainerBuilder' => $vendorDir . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationParameterBag' => $vendorDir . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationPass' => $vendorDir . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\PassConfig' => $vendorDir . '/symfony/dependency-injection/Compiler/PassConfig.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\PriorityTaggedServiceTrait' => $vendorDir . '/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\RegisterEnvVarProcessorsPass' => $vendorDir . '/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\RegisterServiceSubscribersPass' => $vendorDir . '/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\RemoveAbstractDefinitionsPass' => $vendorDir . '/symfony/dependency-injection/Compiler/RemoveAbstractDefinitionsPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\RemovePrivateAliasesPass' => $vendorDir . '/symfony/dependency-injection/Compiler/RemovePrivateAliasesPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\RemoveUnusedDefinitionsPass' => $vendorDir . '/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\RepeatablePassInterface' => $vendorDir . '/symfony/dependency-injection/Compiler/RepeatablePassInterface.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\RepeatedPass' => $vendorDir . '/symfony/dependency-injection/Compiler/RepeatedPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ReplaceAliasByActualDefinitionPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveBindingsPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveBindingsPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveChildDefinitionsPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveClassPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveClassPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveDefinitionTemplatesPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveDefinitionTemplatesPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveEnvPlaceholdersPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveFactoryClassPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveHotPathPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveHotPathPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveInstanceofConditionalsPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveInvalidReferencesPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveNamedArgumentsPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveParameterPlaceHoldersPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolvePrivatesPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolvePrivatesPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveReferencesToAliasesPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveServiceSubscribersPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveTaggedIteratorArgumentPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ResolveTaggedIteratorArgumentPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ServiceLocatorTagPass' => $vendorDir . '/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ServiceReferenceGraph' => $vendorDir . '/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ServiceReferenceGraphEdge' => $vendorDir . '/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ServiceReferenceGraphNode' => $vendorDir . '/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php', + 'Symfony\\Component\\DependencyInjection\\Config\\AutowireServiceResource' => $vendorDir . '/symfony/dependency-injection/Config/AutowireServiceResource.php', + 'Symfony\\Component\\DependencyInjection\\Config\\ContainerParametersResource' => $vendorDir . '/symfony/dependency-injection/Config/ContainerParametersResource.php', + 'Symfony\\Component\\DependencyInjection\\Config\\ContainerParametersResourceChecker' => $vendorDir . '/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php', 'Symfony\\Component\\DependencyInjection\\Container' => $vendorDir . '/symfony/dependency-injection/Container.php', - 'Symfony\\Component\\DependencyInjection\\ContainerAware' => $vendorDir . '/symfony/dependency-injection/ContainerAware.php', 'Symfony\\Component\\DependencyInjection\\ContainerAwareInterface' => $vendorDir . '/symfony/dependency-injection/ContainerAwareInterface.php', 'Symfony\\Component\\DependencyInjection\\ContainerAwareTrait' => $vendorDir . '/symfony/dependency-injection/ContainerAwareTrait.php', 'Symfony\\Component\\DependencyInjection\\ContainerBuilder' => $vendorDir . '/symfony/dependency-injection/ContainerBuilder.php', @@ -651,17 +669,19 @@ return array( 'Symfony\\Component\\DependencyInjection\\Dumper\\PhpDumper' => $vendorDir . '/symfony/dependency-injection/Dumper/PhpDumper.php', 'Symfony\\Component\\DependencyInjection\\Dumper\\XmlDumper' => $vendorDir . '/symfony/dependency-injection/Dumper/XmlDumper.php', 'Symfony\\Component\\DependencyInjection\\Dumper\\YamlDumper' => $vendorDir . '/symfony/dependency-injection/Dumper/YamlDumper.php', + 'Symfony\\Component\\DependencyInjection\\EnvVarProcessor' => $vendorDir . '/symfony/dependency-injection/EnvVarProcessor.php', + 'Symfony\\Component\\DependencyInjection\\EnvVarProcessorInterface' => $vendorDir . '/symfony/dependency-injection/EnvVarProcessorInterface.php', + 'Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException' => $vendorDir . '/symfony/dependency-injection/Exception/AutowiringFailedException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\BadMethodCallException' => $vendorDir . '/symfony/dependency-injection/Exception/BadMethodCallException.php', + 'Symfony\\Component\\DependencyInjection\\Exception\\EnvNotFoundException' => $vendorDir . '/symfony/dependency-injection/Exception/EnvNotFoundException.php', + 'Symfony\\Component\\DependencyInjection\\Exception\\EnvParameterException' => $vendorDir . '/symfony/dependency-injection/Exception/EnvParameterException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/dependency-injection/Exception/ExceptionInterface.php', - 'Symfony\\Component\\DependencyInjection\\Exception\\InactiveScopeException' => $vendorDir . '/symfony/dependency-injection/Exception/InactiveScopeException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/dependency-injection/Exception/InvalidArgumentException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\LogicException' => $vendorDir . '/symfony/dependency-injection/Exception/LogicException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\OutOfBoundsException' => $vendorDir . '/symfony/dependency-injection/Exception/OutOfBoundsException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\ParameterCircularReferenceException' => $vendorDir . '/symfony/dependency-injection/Exception/ParameterCircularReferenceException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException' => $vendorDir . '/symfony/dependency-injection/Exception/ParameterNotFoundException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException' => $vendorDir . '/symfony/dependency-injection/Exception/RuntimeException.php', - 'Symfony\\Component\\DependencyInjection\\Exception\\ScopeCrossingInjectionException' => $vendorDir . '/symfony/dependency-injection/Exception/ScopeCrossingInjectionException.php', - 'Symfony\\Component\\DependencyInjection\\Exception\\ScopeWideningInjectionException' => $vendorDir . '/symfony/dependency-injection/Exception/ScopeWideningInjectionException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException' => $vendorDir . '/symfony/dependency-injection/Exception/ServiceCircularReferenceException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException' => $vendorDir . '/symfony/dependency-injection/Exception/ServiceNotFoundException.php', 'Symfony\\Component\\DependencyInjection\\ExpressionLanguage' => $vendorDir . '/symfony/dependency-injection/ExpressionLanguage.php', @@ -670,33 +690,68 @@ return array( 'Symfony\\Component\\DependencyInjection\\Extension\\Extension' => $vendorDir . '/symfony/dependency-injection/Extension/Extension.php', 'Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface' => $vendorDir . '/symfony/dependency-injection/Extension/ExtensionInterface.php', 'Symfony\\Component\\DependencyInjection\\Extension\\PrependExtensionInterface' => $vendorDir . '/symfony/dependency-injection/Extension/PrependExtensionInterface.php', - 'Symfony\\Component\\DependencyInjection\\IntrospectableContainerInterface' => $vendorDir . '/symfony/dependency-injection/IntrospectableContainerInterface.php', 'Symfony\\Component\\DependencyInjection\\LazyProxy\\Instantiator\\InstantiatorInterface' => $vendorDir . '/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php', 'Symfony\\Component\\DependencyInjection\\LazyProxy\\Instantiator\\RealServiceInstantiator' => $vendorDir . '/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php', 'Symfony\\Component\\DependencyInjection\\LazyProxy\\PhpDumper\\DumperInterface' => $vendorDir . '/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php', 'Symfony\\Component\\DependencyInjection\\LazyProxy\\PhpDumper\\NullDumper' => $vendorDir . '/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php', + 'Symfony\\Component\\DependencyInjection\\LazyProxy\\ProxyHelper' => $vendorDir . '/symfony/dependency-injection/LazyProxy/ProxyHelper.php', 'Symfony\\Component\\DependencyInjection\\Loader\\ClosureLoader' => $vendorDir . '/symfony/dependency-injection/Loader/ClosureLoader.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\AbstractConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\AbstractServiceConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\AliasConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/AliasConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\DefaultsConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\InlineServiceConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/InlineServiceConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\InstanceofConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ParametersConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/ParametersConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\PrototypeConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ReferenceConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/ReferenceConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ServiceConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ServicesConfigurator' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\AbstractTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/AbstractTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\ArgumentTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/ArgumentTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\AutoconfigureTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/AutoconfigureTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\AutowireTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/AutowireTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\BindTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/BindTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\CallTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\ClassTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/ClassTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\ConfiguratorTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/ConfiguratorTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\DecorateTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\DeprecateTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/DeprecateTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\FactoryTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\FileTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/FileTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\LazyTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/LazyTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\ParentTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\PropertyTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/PropertyTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\PublicTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/PublicTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\ShareTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/ShareTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\SyntheticTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/SyntheticTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\TagTrait' => $vendorDir . '/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php', 'Symfony\\Component\\DependencyInjection\\Loader\\DirectoryLoader' => $vendorDir . '/symfony/dependency-injection/Loader/DirectoryLoader.php', 'Symfony\\Component\\DependencyInjection\\Loader\\FileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/FileLoader.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\GlobFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/GlobFileLoader.php', 'Symfony\\Component\\DependencyInjection\\Loader\\IniFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/IniFileLoader.php', 'Symfony\\Component\\DependencyInjection\\Loader\\PhpFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/PhpFileLoader.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\ProtectedPhpFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/PhpFileLoader.php', 'Symfony\\Component\\DependencyInjection\\Loader\\XmlFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/XmlFileLoader.php', 'Symfony\\Component\\DependencyInjection\\Loader\\YamlFileLoader' => $vendorDir . '/symfony/dependency-injection/Loader/YamlFileLoader.php', 'Symfony\\Component\\DependencyInjection\\Parameter' => $vendorDir . '/symfony/dependency-injection/Parameter.php', + 'Symfony\\Component\\DependencyInjection\\ParameterBag\\EnvPlaceholderParameterBag' => $vendorDir . '/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php', 'Symfony\\Component\\DependencyInjection\\ParameterBag\\FrozenParameterBag' => $vendorDir . '/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php', 'Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag' => $vendorDir . '/symfony/dependency-injection/ParameterBag/ParameterBag.php', 'Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBagInterface' => $vendorDir . '/symfony/dependency-injection/ParameterBag/ParameterBagInterface.php', 'Symfony\\Component\\DependencyInjection\\Reference' => $vendorDir . '/symfony/dependency-injection/Reference.php', 'Symfony\\Component\\DependencyInjection\\ResettableContainerInterface' => $vendorDir . '/symfony/dependency-injection/ResettableContainerInterface.php', - 'Symfony\\Component\\DependencyInjection\\Scope' => $vendorDir . '/symfony/dependency-injection/Scope.php', - 'Symfony\\Component\\DependencyInjection\\ScopeInterface' => $vendorDir . '/symfony/dependency-injection/ScopeInterface.php', - 'Symfony\\Component\\DependencyInjection\\SimpleXMLElement' => $vendorDir . '/symfony/dependency-injection/SimpleXMLElement.php', + 'Symfony\\Component\\DependencyInjection\\ServiceLocator' => $vendorDir . '/symfony/dependency-injection/ServiceLocator.php', + 'Symfony\\Component\\DependencyInjection\\ServiceSubscriberInterface' => $vendorDir . '/symfony/dependency-injection/ServiceSubscriberInterface.php', 'Symfony\\Component\\DependencyInjection\\TaggedContainerInterface' => $vendorDir . '/symfony/dependency-injection/TaggedContainerInterface.php', + 'Symfony\\Component\\DependencyInjection\\TypedReference' => $vendorDir . '/symfony/dependency-injection/TypedReference.php', 'Symfony\\Component\\DependencyInjection\\Variable' => $vendorDir . '/symfony/dependency-injection/Variable.php', 'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/ContainerAwareEventDispatcher.php', 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php', 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => $vendorDir . '/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php', 'Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener' => $vendorDir . '/symfony/event-dispatcher/Debug/WrappedListener.php', + 'Symfony\\Component\\EventDispatcher\\DependencyInjection\\ExtractingEventDispatcher' => $vendorDir . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php', 'Symfony\\Component\\EventDispatcher\\DependencyInjection\\RegisterListenersPass' => $vendorDir . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php', 'Symfony\\Component\\EventDispatcher\\Event' => $vendorDir . '/symfony/event-dispatcher/Event.php', 'Symfony\\Component\\EventDispatcher\\EventDispatcher' => $vendorDir . '/symfony/event-dispatcher/EventDispatcher.php', @@ -710,31 +765,17 @@ return array( 'Symfony\\Component\\Filesystem\\Exception\\IOExceptionInterface' => $vendorDir . '/symfony/filesystem/Exception/IOExceptionInterface.php', 'Symfony\\Component\\Filesystem\\Filesystem' => $vendorDir . '/symfony/filesystem/Filesystem.php', 'Symfony\\Component\\Filesystem\\LockHandler' => $vendorDir . '/symfony/filesystem/LockHandler.php', - 'Symfony\\Component\\Finder\\Adapter\\AbstractAdapter' => $vendorDir . '/symfony/finder/Adapter/AbstractAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\AbstractFindAdapter' => $vendorDir . '/symfony/finder/Adapter/AbstractFindAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\AdapterInterface' => $vendorDir . '/symfony/finder/Adapter/AdapterInterface.php', - 'Symfony\\Component\\Finder\\Adapter\\BsdFindAdapter' => $vendorDir . '/symfony/finder/Adapter/BsdFindAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\GnuFindAdapter' => $vendorDir . '/symfony/finder/Adapter/GnuFindAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\PhpAdapter' => $vendorDir . '/symfony/finder/Adapter/PhpAdapter.php', 'Symfony\\Component\\Finder\\Comparator\\Comparator' => $vendorDir . '/symfony/finder/Comparator/Comparator.php', 'Symfony\\Component\\Finder\\Comparator\\DateComparator' => $vendorDir . '/symfony/finder/Comparator/DateComparator.php', 'Symfony\\Component\\Finder\\Comparator\\NumberComparator' => $vendorDir . '/symfony/finder/Comparator/NumberComparator.php', 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException' => $vendorDir . '/symfony/finder/Exception/AccessDeniedException.php', - 'Symfony\\Component\\Finder\\Exception\\AdapterFailureException' => $vendorDir . '/symfony/finder/Exception/AdapterFailureException.php', 'Symfony\\Component\\Finder\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/finder/Exception/ExceptionInterface.php', - 'Symfony\\Component\\Finder\\Exception\\OperationNotPermitedException' => $vendorDir . '/symfony/finder/Exception/OperationNotPermitedException.php', - 'Symfony\\Component\\Finder\\Exception\\ShellCommandFailureException' => $vendorDir . '/symfony/finder/Exception/ShellCommandFailureException.php', - 'Symfony\\Component\\Finder\\Expression\\Expression' => $vendorDir . '/symfony/finder/Expression/Expression.php', - 'Symfony\\Component\\Finder\\Expression\\Glob' => $vendorDir . '/symfony/finder/Expression/Glob.php', - 'Symfony\\Component\\Finder\\Expression\\Regex' => $vendorDir . '/symfony/finder/Expression/Regex.php', - 'Symfony\\Component\\Finder\\Expression\\ValueInterface' => $vendorDir . '/symfony/finder/Expression/ValueInterface.php', 'Symfony\\Component\\Finder\\Finder' => $vendorDir . '/symfony/finder/Finder.php', 'Symfony\\Component\\Finder\\Glob' => $vendorDir . '/symfony/finder/Glob.php', 'Symfony\\Component\\Finder\\Iterator\\CustomFilterIterator' => $vendorDir . '/symfony/finder/Iterator/CustomFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\DateRangeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/DateRangeFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\DepthRangeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/DepthRangeFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\ExcludeDirectoryFilterIterator' => $vendorDir . '/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\FilePathsIterator' => $vendorDir . '/symfony/finder/Iterator/FilePathsIterator.php', 'Symfony\\Component\\Finder\\Iterator\\FileTypeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FileTypeFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\FilecontentFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FilecontentFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\FilenameFilterIterator' => $vendorDir . '/symfony/finder/Iterator/FilenameFilterIterator.php', @@ -744,8 +785,6 @@ return array( 'Symfony\\Component\\Finder\\Iterator\\RecursiveDirectoryIterator' => $vendorDir . '/symfony/finder/Iterator/RecursiveDirectoryIterator.php', 'Symfony\\Component\\Finder\\Iterator\\SizeRangeFilterIterator' => $vendorDir . '/symfony/finder/Iterator/SizeRangeFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => $vendorDir . '/symfony/finder/Iterator/SortableIterator.php', - 'Symfony\\Component\\Finder\\Shell\\Command' => $vendorDir . '/symfony/finder/Shell/Command.php', - 'Symfony\\Component\\Finder\\Shell\\Shell' => $vendorDir . '/symfony/finder/Shell/Shell.php', 'Symfony\\Component\\Finder\\SplFileInfo' => $vendorDir . '/symfony/finder/SplFileInfo.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeader' => $vendorDir . '/symfony/http-foundation/AcceptHeader.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeaderItem' => $vendorDir . '/symfony/http-foundation/AcceptHeaderItem.php', @@ -753,6 +792,8 @@ return array( 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse' => $vendorDir . '/symfony/http-foundation/BinaryFileResponse.php', 'Symfony\\Component\\HttpFoundation\\Cookie' => $vendorDir . '/symfony/http-foundation/Cookie.php', 'Symfony\\Component\\HttpFoundation\\Exception\\ConflictingHeadersException' => $vendorDir . '/symfony/http-foundation/Exception/ConflictingHeadersException.php', + 'Symfony\\Component\\HttpFoundation\\Exception\\RequestExceptionInterface' => $vendorDir . '/symfony/http-foundation/Exception/RequestExceptionInterface.php', + 'Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException' => $vendorDir . '/symfony/http-foundation/Exception/SuspiciousOperationException.php', 'Symfony\\Component\\HttpFoundation\\ExpressionRequestMatcher' => $vendorDir . '/symfony/http-foundation/ExpressionRequestMatcher.php', 'Symfony\\Component\\HttpFoundation\\FileBag' => $vendorDir . '/symfony/http-foundation/FileBag.php', 'Symfony\\Component\\HttpFoundation\\File\\Exception\\AccessDeniedException' => $vendorDir . '/symfony/http-foundation/File/Exception/AccessDeniedException.php', @@ -768,6 +809,7 @@ return array( 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeExtensionGuesser' => $vendorDir . '/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php', 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesser' => $vendorDir . '/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php', 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesserInterface' => $vendorDir . '/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php', + 'Symfony\\Component\\HttpFoundation\\File\\Stream' => $vendorDir . '/symfony/http-foundation/File/Stream.php', 'Symfony\\Component\\HttpFoundation\\File\\UploadedFile' => $vendorDir . '/symfony/http-foundation/File/UploadedFile.php', 'Symfony\\Component\\HttpFoundation\\HeaderBag' => $vendorDir . '/symfony/http-foundation/HeaderBag.php', 'Symfony\\Component\\HttpFoundation\\IpUtils' => $vendorDir . '/symfony/http-foundation/IpUtils.php', @@ -789,8 +831,9 @@ return array( 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface' => $vendorDir . '/symfony/http-foundation/Session/Flash/FlashBagInterface.php', 'Symfony\\Component\\HttpFoundation\\Session\\Session' => $vendorDir . '/symfony/http-foundation/Session/Session.php', 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface' => $vendorDir . '/symfony/http-foundation/Session/SessionBagInterface.php', + 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagProxy' => $vendorDir . '/symfony/http-foundation/Session/SessionBagProxy.php', 'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface' => $vendorDir . '/symfony/http-foundation/Session/SessionInterface.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\LegacyPdoSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/LegacyPdoSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\AbstractSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MongoDbSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php', @@ -798,6 +841,7 @@ return array( 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NullSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\StrictSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\WriteCheckSessionHandler' => $vendorDir . '/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag' => $vendorDir . '/symfony/http-foundation/Session/Storage/MetadataBag.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage' => $vendorDir . '/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php', @@ -813,6 +857,7 @@ return array( 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface' => $vendorDir . '/symfony/http-kernel/Bundle/BundleInterface.php', 'Symfony\\Component\\HttpKernel\\CacheClearer\\CacheClearerInterface' => $vendorDir . '/symfony/http-kernel/CacheClearer/CacheClearerInterface.php', 'Symfony\\Component\\HttpKernel\\CacheClearer\\ChainCacheClearer' => $vendorDir . '/symfony/http-kernel/CacheClearer/ChainCacheClearer.php', + 'Symfony\\Component\\HttpKernel\\CacheClearer\\Psr6CacheClearer' => $vendorDir . '/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php', 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmer' => $vendorDir . '/symfony/http-kernel/CacheWarmer/CacheWarmer.php', 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerAggregate' => $vendorDir . '/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php', 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface' => $vendorDir . '/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php', @@ -820,9 +865,23 @@ return array( 'Symfony\\Component\\HttpKernel\\Client' => $vendorDir . '/symfony/http-kernel/Client.php', 'Symfony\\Component\\HttpKernel\\Config\\EnvParametersResource' => $vendorDir . '/symfony/http-kernel/Config/EnvParametersResource.php', 'Symfony\\Component\\HttpKernel\\Config\\FileLocator' => $vendorDir . '/symfony/http-kernel/Config/FileLocator.php', + 'Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadata' => $vendorDir . '/symfony/http-kernel/ControllerMetadata/ArgumentMetadata.php', + 'Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadataFactory' => $vendorDir . '/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php', + 'Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadataFactoryInterface' => $vendorDir . '/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactoryInterface.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver' => $vendorDir . '/symfony/http-kernel/Controller/ArgumentResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface' => $vendorDir . '/symfony/http-kernel/Controller/ArgumentResolverInterface.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\DefaultValueResolver' => $vendorDir . '/symfony/http-kernel/Controller/ArgumentResolver/DefaultValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestAttributeValueResolver' => $vendorDir . '/symfony/http-kernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestValueResolver' => $vendorDir . '/symfony/http-kernel/Controller/ArgumentResolver/RequestValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\ServiceValueResolver' => $vendorDir . '/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\SessionValueResolver' => $vendorDir . '/symfony/http-kernel/Controller/ArgumentResolver/SessionValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\VariadicValueResolver' => $vendorDir . '/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentValueResolverInterface' => $vendorDir . '/symfony/http-kernel/Controller/ArgumentValueResolverInterface.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ContainerControllerResolver' => $vendorDir . '/symfony/http-kernel/Controller/ContainerControllerResolver.php', 'Symfony\\Component\\HttpKernel\\Controller\\ControllerReference' => $vendorDir . '/symfony/http-kernel/Controller/ControllerReference.php', 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver' => $vendorDir . '/symfony/http-kernel/Controller/ControllerResolver.php', 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface' => $vendorDir . '/symfony/http-kernel/Controller/ControllerResolverInterface.php', + 'Symfony\\Component\\HttpKernel\\Controller\\TraceableArgumentResolver' => $vendorDir . '/symfony/http-kernel/Controller/TraceableArgumentResolver.php', 'Symfony\\Component\\HttpKernel\\Controller\\TraceableControllerResolver' => $vendorDir . '/symfony/http-kernel/Controller/TraceableControllerResolver.php', 'Symfony\\Component\\HttpKernel\\DataCollector\\AjaxDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/AjaxDataCollector.php', 'Symfony\\Component\\HttpKernel\\DataCollector\\ConfigDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/ConfigDataCollector.php', @@ -838,22 +897,26 @@ return array( 'Symfony\\Component\\HttpKernel\\DataCollector\\RouterDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/RouterDataCollector.php', 'Symfony\\Component\\HttpKernel\\DataCollector\\TimeDataCollector' => $vendorDir . '/symfony/http-kernel/DataCollector/TimeDataCollector.php', 'Symfony\\Component\\HttpKernel\\DataCollector\\Util\\ValueExporter' => $vendorDir . '/symfony/http-kernel/DataCollector/Util/ValueExporter.php', - 'Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler' => $vendorDir . '/symfony/http-kernel/Debug/ErrorHandler.php', - 'Symfony\\Component\\HttpKernel\\Debug\\ExceptionHandler' => $vendorDir . '/symfony/http-kernel/Debug/ExceptionHandler.php', + 'Symfony\\Component\\HttpKernel\\Debug\\FileLinkFormatter' => $vendorDir . '/symfony/http-kernel/Debug/FileLinkFormatter.php', 'Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher' => $vendorDir . '/symfony/http-kernel/Debug/TraceableEventDispatcher.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\AddAnnotatedClassesToCachePass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\AddClassesToCachePass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ConfigurableExtension' => $vendorDir . '/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php', - 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel' => $vendorDir . '/symfony/http-kernel/DependencyInjection/ContainerAwareHttpKernel.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ControllerArgumentValueResolverPass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\Extension' => $vendorDir . '/symfony/http-kernel/DependencyInjection/Extension.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\FragmentRendererPass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\LazyLoadingFragmentHandler' => $vendorDir . '/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\LoggerPass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/LoggerPass.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\MergeExtensionConfigurationPass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php', - 'Symfony\\Component\\HttpKernel\\DependencyInjection\\RegisterListenersPass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/RegisterListenersPass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\RegisterControllerArgumentLocatorsPass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\RemoveEmptyControllerArgumentLocatorsPass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ResettableServicePass' => $vendorDir . '/symfony/http-kernel/DependencyInjection/ResettableServicePass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ServicesResetter' => $vendorDir . '/symfony/http-kernel/DependencyInjection/ServicesResetter.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\AbstractSessionListener' => $vendorDir . '/symfony/http-kernel/EventListener/AbstractSessionListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\AbstractTestSessionListener' => $vendorDir . '/symfony/http-kernel/EventListener/AbstractTestSessionListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\AddRequestFormatsListener' => $vendorDir . '/symfony/http-kernel/EventListener/AddRequestFormatsListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\DebugHandlersListener' => $vendorDir . '/symfony/http-kernel/EventListener/DebugHandlersListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\DumpListener' => $vendorDir . '/symfony/http-kernel/EventListener/DumpListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\ErrorsLoggerListener' => $vendorDir . '/symfony/http-kernel/EventListener/ErrorsLoggerListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\EsiListener' => $vendorDir . '/symfony/http-kernel/EventListener/EsiListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener' => $vendorDir . '/symfony/http-kernel/EventListener/ExceptionListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\FragmentListener' => $vendorDir . '/symfony/http-kernel/EventListener/FragmentListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener' => $vendorDir . '/symfony/http-kernel/EventListener/LocaleListener.php', @@ -867,6 +930,7 @@ return array( 'Symfony\\Component\\HttpKernel\\EventListener\\TestSessionListener' => $vendorDir . '/symfony/http-kernel/EventListener/TestSessionListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\TranslatorListener' => $vendorDir . '/symfony/http-kernel/EventListener/TranslatorListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\ValidateRequestListener' => $vendorDir . '/symfony/http-kernel/EventListener/ValidateRequestListener.php', + 'Symfony\\Component\\HttpKernel\\Event\\FilterControllerArgumentsEvent' => $vendorDir . '/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php', 'Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent' => $vendorDir . '/symfony/http-kernel/Event/FilterControllerEvent.php', 'Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent' => $vendorDir . '/symfony/http-kernel/Event/FilterResponseEvent.php', 'Symfony\\Component\\HttpKernel\\Event\\FinishRequestEvent' => $vendorDir . '/symfony/http-kernel/Event/FinishRequestEvent.php', @@ -900,9 +964,8 @@ return array( 'Symfony\\Component\\HttpKernel\\Fragment\\InlineFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Fragment/InlineFragmentRenderer.php', 'Symfony\\Component\\HttpKernel\\Fragment\\RoutableFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php', 'Symfony\\Component\\HttpKernel\\Fragment\\SsiFragmentRenderer' => $vendorDir . '/symfony/http-kernel/Fragment/SsiFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\AbstractSurrogate' => $vendorDir . '/symfony/http-kernel/HttpCache/AbstractSurrogate.php', 'Symfony\\Component\\HttpKernel\\HttpCache\\Esi' => $vendorDir . '/symfony/http-kernel/HttpCache/Esi.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\EsiResponseCacheStrategy' => $vendorDir . '/symfony/http-kernel/HttpCache/EsiResponseCacheStrategy.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\EsiResponseCacheStrategyInterface' => $vendorDir . '/symfony/http-kernel/HttpCache/EsiResponseCacheStrategyInterface.php', 'Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache' => $vendorDir . '/symfony/http-kernel/HttpCache/HttpCache.php', 'Symfony\\Component\\HttpKernel\\HttpCache\\ResponseCacheStrategy' => $vendorDir . '/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php', 'Symfony\\Component\\HttpKernel\\HttpCache\\ResponseCacheStrategyInterface' => $vendorDir . '/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php', @@ -917,28 +980,39 @@ return array( 'Symfony\\Component\\HttpKernel\\KernelEvents' => $vendorDir . '/symfony/http-kernel/KernelEvents.php', 'Symfony\\Component\\HttpKernel\\KernelInterface' => $vendorDir . '/symfony/http-kernel/KernelInterface.php', 'Symfony\\Component\\HttpKernel\\Log\\DebugLoggerInterface' => $vendorDir . '/symfony/http-kernel/Log/DebugLoggerInterface.php', - 'Symfony\\Component\\HttpKernel\\Log\\LoggerInterface' => $vendorDir . '/symfony/http-kernel/Log/LoggerInterface.php', - 'Symfony\\Component\\HttpKernel\\Log\\NullLogger' => $vendorDir . '/symfony/http-kernel/Log/NullLogger.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\BaseMemcacheProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/BaseMemcacheProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Log\\Logger' => $vendorDir . '/symfony/http-kernel/Log/Logger.php', 'Symfony\\Component\\HttpKernel\\Profiler\\FileProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/FileProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MemcacheProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/MemcacheProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MemcachedProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/MemcachedProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MongoDbProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/MongoDbProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MysqlProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/MysqlProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\PdoProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/PdoProfilerStorage.php', 'Symfony\\Component\\HttpKernel\\Profiler\\Profile' => $vendorDir . '/symfony/http-kernel/Profiler/Profile.php', 'Symfony\\Component\\HttpKernel\\Profiler\\Profiler' => $vendorDir . '/symfony/http-kernel/Profiler/Profiler.php', 'Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface' => $vendorDir . '/symfony/http-kernel/Profiler/ProfilerStorageInterface.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\RedisProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/RedisProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\SqliteProfilerStorage' => $vendorDir . '/symfony/http-kernel/Profiler/SqliteProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\RebootableInterface' => $vendorDir . '/symfony/http-kernel/RebootableInterface.php', 'Symfony\\Component\\HttpKernel\\TerminableInterface' => $vendorDir . '/symfony/http-kernel/TerminableInterface.php', 'Symfony\\Component\\HttpKernel\\UriSigner' => $vendorDir . '/symfony/http-kernel/UriSigner.php', + 'Symfony\\Component\\Process\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/process/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Process\\Exception\\InvalidArgumentException' => $vendorDir . '/symfony/process/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\Process\\Exception\\LogicException' => $vendorDir . '/symfony/process/Exception/LogicException.php', + 'Symfony\\Component\\Process\\Exception\\ProcessFailedException' => $vendorDir . '/symfony/process/Exception/ProcessFailedException.php', + 'Symfony\\Component\\Process\\Exception\\ProcessTimedOutException' => $vendorDir . '/symfony/process/Exception/ProcessTimedOutException.php', + 'Symfony\\Component\\Process\\Exception\\RuntimeException' => $vendorDir . '/symfony/process/Exception/RuntimeException.php', + 'Symfony\\Component\\Process\\ExecutableFinder' => $vendorDir . '/symfony/process/ExecutableFinder.php', + 'Symfony\\Component\\Process\\InputStream' => $vendorDir . '/symfony/process/InputStream.php', + 'Symfony\\Component\\Process\\PhpExecutableFinder' => $vendorDir . '/symfony/process/PhpExecutableFinder.php', + 'Symfony\\Component\\Process\\PhpProcess' => $vendorDir . '/symfony/process/PhpProcess.php', + 'Symfony\\Component\\Process\\Pipes\\AbstractPipes' => $vendorDir . '/symfony/process/Pipes/AbstractPipes.php', + 'Symfony\\Component\\Process\\Pipes\\PipesInterface' => $vendorDir . '/symfony/process/Pipes/PipesInterface.php', + 'Symfony\\Component\\Process\\Pipes\\UnixPipes' => $vendorDir . '/symfony/process/Pipes/UnixPipes.php', + 'Symfony\\Component\\Process\\Pipes\\WindowsPipes' => $vendorDir . '/symfony/process/Pipes/WindowsPipes.php', + 'Symfony\\Component\\Process\\Process' => $vendorDir . '/symfony/process/Process.php', + 'Symfony\\Component\\Process\\ProcessBuilder' => $vendorDir . '/symfony/process/ProcessBuilder.php', + 'Symfony\\Component\\Process\\ProcessUtils' => $vendorDir . '/symfony/process/ProcessUtils.php', 'Symfony\\Component\\Routing\\Annotation\\Route' => $vendorDir . '/symfony/routing/Annotation/Route.php', 'Symfony\\Component\\Routing\\CompiledRoute' => $vendorDir . '/symfony/routing/CompiledRoute.php', + 'Symfony\\Component\\Routing\\DependencyInjection\\RoutingResolverPass' => $vendorDir . '/symfony/routing/DependencyInjection/RoutingResolverPass.php', 'Symfony\\Component\\Routing\\Exception\\ExceptionInterface' => $vendorDir . '/symfony/routing/Exception/ExceptionInterface.php', 'Symfony\\Component\\Routing\\Exception\\InvalidParameterException' => $vendorDir . '/symfony/routing/Exception/InvalidParameterException.php', 'Symfony\\Component\\Routing\\Exception\\MethodNotAllowedException' => $vendorDir . '/symfony/routing/Exception/MethodNotAllowedException.php', 'Symfony\\Component\\Routing\\Exception\\MissingMandatoryParametersException' => $vendorDir . '/symfony/routing/Exception/MissingMandatoryParametersException.php', + 'Symfony\\Component\\Routing\\Exception\\NoConfigurationException' => $vendorDir . '/symfony/routing/Exception/NoConfigurationException.php', 'Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException' => $vendorDir . '/symfony/routing/Exception/ResourceNotFoundException.php', 'Symfony\\Component\\Routing\\Exception\\RouteNotFoundException' => $vendorDir . '/symfony/routing/Exception/RouteNotFoundException.php', 'Symfony\\Component\\Routing\\Generator\\ConfigurableRequirementsInterface' => $vendorDir . '/symfony/routing/Generator/ConfigurableRequirementsInterface.php', @@ -951,21 +1025,26 @@ return array( 'Symfony\\Component\\Routing\\Loader\\AnnotationDirectoryLoader' => $vendorDir . '/symfony/routing/Loader/AnnotationDirectoryLoader.php', 'Symfony\\Component\\Routing\\Loader\\AnnotationFileLoader' => $vendorDir . '/symfony/routing/Loader/AnnotationFileLoader.php', 'Symfony\\Component\\Routing\\Loader\\ClosureLoader' => $vendorDir . '/symfony/routing/Loader/ClosureLoader.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\CollectionConfigurator' => $vendorDir . '/symfony/routing/Loader/Configurator/CollectionConfigurator.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\ImportConfigurator' => $vendorDir . '/symfony/routing/Loader/Configurator/ImportConfigurator.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\RouteConfigurator' => $vendorDir . '/symfony/routing/Loader/Configurator/RouteConfigurator.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\RoutingConfigurator' => $vendorDir . '/symfony/routing/Loader/Configurator/RoutingConfigurator.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\Traits\\AddTrait' => $vendorDir . '/symfony/routing/Loader/Configurator/Traits/AddTrait.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\Traits\\RouteTrait' => $vendorDir . '/symfony/routing/Loader/Configurator/Traits/RouteTrait.php', 'Symfony\\Component\\Routing\\Loader\\DependencyInjection\\ServiceRouterLoader' => $vendorDir . '/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php', 'Symfony\\Component\\Routing\\Loader\\DirectoryLoader' => $vendorDir . '/symfony/routing/Loader/DirectoryLoader.php', + 'Symfony\\Component\\Routing\\Loader\\GlobFileLoader' => $vendorDir . '/symfony/routing/Loader/GlobFileLoader.php', 'Symfony\\Component\\Routing\\Loader\\ObjectRouteLoader' => $vendorDir . '/symfony/routing/Loader/ObjectRouteLoader.php', 'Symfony\\Component\\Routing\\Loader\\PhpFileLoader' => $vendorDir . '/symfony/routing/Loader/PhpFileLoader.php', - 'Symfony\\Component\\Routing\\Loader\\RecursiveCallbackFilterIterator' => $vendorDir . '/symfony/routing/Loader/AnnotationDirectoryLoader.php', + 'Symfony\\Component\\Routing\\Loader\\ProtectedPhpFileLoader' => $vendorDir . '/symfony/routing/Loader/PhpFileLoader.php', 'Symfony\\Component\\Routing\\Loader\\XmlFileLoader' => $vendorDir . '/symfony/routing/Loader/XmlFileLoader.php', 'Symfony\\Component\\Routing\\Loader\\YamlFileLoader' => $vendorDir . '/symfony/routing/Loader/YamlFileLoader.php', - 'Symfony\\Component\\Routing\\Matcher\\ApacheUrlMatcher' => $vendorDir . '/symfony/routing/Matcher/ApacheUrlMatcher.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\ApacheMatcherDumper' => $vendorDir . '/symfony/routing/Matcher/Dumper/ApacheMatcherDumper.php', 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperCollection' => $vendorDir . '/symfony/routing/Matcher/Dumper/DumperCollection.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperPrefixCollection' => $vendorDir . '/symfony/routing/Matcher/Dumper/DumperPrefixCollection.php', 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperRoute' => $vendorDir . '/symfony/routing/Matcher/Dumper/DumperRoute.php', 'Symfony\\Component\\Routing\\Matcher\\Dumper\\MatcherDumper' => $vendorDir . '/symfony/routing/Matcher/Dumper/MatcherDumper.php', 'Symfony\\Component\\Routing\\Matcher\\Dumper\\MatcherDumperInterface' => $vendorDir . '/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php', 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper' => $vendorDir . '/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\StaticPrefixCollection' => $vendorDir . '/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php', 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcher' => $vendorDir . '/symfony/routing/Matcher/RedirectableUrlMatcher.php', 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcherInterface' => $vendorDir . '/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php', 'Symfony\\Component\\Routing\\Matcher\\RequestMatcherInterface' => $vendorDir . '/symfony/routing/Matcher/RequestMatcherInterface.php', @@ -981,6 +1060,7 @@ return array( 'Symfony\\Component\\Routing\\RouteCompilerInterface' => $vendorDir . '/symfony/routing/RouteCompilerInterface.php', 'Symfony\\Component\\Routing\\Router' => $vendorDir . '/symfony/routing/Router.php', 'Symfony\\Component\\Routing\\RouterInterface' => $vendorDir . '/symfony/routing/RouterInterface.php', + 'Symfony\\Component\\Yaml\\Command\\LintCommand' => $vendorDir . '/symfony/yaml/Command/LintCommand.php', 'Symfony\\Component\\Yaml\\Dumper' => $vendorDir . '/symfony/yaml/Dumper.php', 'Symfony\\Component\\Yaml\\Escaper' => $vendorDir . '/symfony/yaml/Escaper.php', 'Symfony\\Component\\Yaml\\Exception\\DumpException' => $vendorDir . '/symfony/yaml/Exception/DumpException.php', @@ -989,13 +1069,21 @@ return array( 'Symfony\\Component\\Yaml\\Exception\\RuntimeException' => $vendorDir . '/symfony/yaml/Exception/RuntimeException.php', 'Symfony\\Component\\Yaml\\Inline' => $vendorDir . '/symfony/yaml/Inline.php', 'Symfony\\Component\\Yaml\\Parser' => $vendorDir . '/symfony/yaml/Parser.php', + 'Symfony\\Component\\Yaml\\Tag\\TaggedValue' => $vendorDir . '/symfony/yaml/Tag/TaggedValue.php', 'Symfony\\Component\\Yaml\\Unescaper' => $vendorDir . '/symfony/yaml/Unescaper.php', 'Symfony\\Component\\Yaml\\Yaml' => $vendorDir . '/symfony/yaml/Yaml.php', 'Symfony\\Polyfill\\Ctype\\Ctype' => $vendorDir . '/symfony/polyfill-ctype/Ctype.php', 'Symfony\\Polyfill\\Mbstring\\Mbstring' => $vendorDir . '/symfony/polyfill-mbstring/Mbstring.php', - 'Symfony\\Polyfill\\Php54\\Php54' => $vendorDir . '/symfony/polyfill-php54/Php54.php', - 'Symfony\\Polyfill\\Php55\\Php55' => $vendorDir . '/symfony/polyfill-php55/Php55.php', - 'Symfony\\Polyfill\\Php55\\Php55ArrayColumn' => $vendorDir . '/symfony/polyfill-php55/Php55ArrayColumn.php', + 'Symfony\\Polyfill\\Php56\\Php56' => $vendorDir . '/symfony/polyfill-php56/Php56.php', + 'Symfony\\Polyfill\\Php70\\Php70' => $vendorDir . '/symfony/polyfill-php70/Php70.php', + 'Symfony\\Polyfill\\Util\\Binary' => $vendorDir . '/symfony/polyfill-util/Binary.php', + 'Symfony\\Polyfill\\Util\\BinaryNoFuncOverload' => $vendorDir . '/symfony/polyfill-util/BinaryNoFuncOverload.php', + 'Symfony\\Polyfill\\Util\\BinaryOnFuncOverload' => $vendorDir . '/symfony/polyfill-util/BinaryOnFuncOverload.php', + 'Symfony\\Polyfill\\Util\\TestListener' => $vendorDir . '/symfony/polyfill-util/TestListener.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV5' => $vendorDir . '/symfony/polyfill-util/TestListenerForV5.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV6' => $vendorDir . '/symfony/polyfill-util/TestListenerForV6.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV7' => $vendorDir . '/symfony/polyfill-util/TestListenerForV7.php', + 'Symfony\\Polyfill\\Util\\TestListenerTrait' => $vendorDir . '/symfony/polyfill-util/TestListenerTrait.php', 'Twig\\Cache\\CacheInterface' => $vendorDir . '/twig/twig/src/Cache/CacheInterface.php', 'Twig\\Cache\\FilesystemCache' => $vendorDir . '/twig/twig/src/Cache/FilesystemCache.php', 'Twig\\Cache\\NullCache' => $vendorDir . '/twig/twig/src/Cache/NullCache.php', @@ -1006,6 +1094,7 @@ return array( 'Twig\\Error\\RuntimeError' => $vendorDir . '/twig/twig/src/Error/RuntimeError.php', 'Twig\\Error\\SyntaxError' => $vendorDir . '/twig/twig/src/Error/SyntaxError.php', 'Twig\\ExpressionParser' => $vendorDir . '/twig/twig/src/ExpressionParser.php', + 'Twig\\ExtensionSet' => $vendorDir . '/twig/twig/src/ExtensionSet.php', 'Twig\\Extension\\AbstractExtension' => $vendorDir . '/twig/twig/src/Extension/AbstractExtension.php', 'Twig\\Extension\\CoreExtension' => $vendorDir . '/twig/twig/src/Extension/CoreExtension.php', 'Twig\\Extension\\DebugExtension' => $vendorDir . '/twig/twig/src/Extension/DebugExtension.php', @@ -1031,6 +1120,7 @@ return array( 'Twig\\NodeTraverser' => $vendorDir . '/twig/twig/src/NodeTraverser.php', 'Twig\\NodeVisitor\\AbstractNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php', 'Twig\\NodeVisitor\\EscaperNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php', + 'Twig\\NodeVisitor\\MacroAutoImportNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php', 'Twig\\NodeVisitor\\NodeVisitorInterface' => $vendorDir . '/twig/twig/src/NodeVisitor/NodeVisitorInterface.php', 'Twig\\NodeVisitor\\OptimizerNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php', 'Twig\\NodeVisitor\\SafeAnalysisNodeVisitor' => $vendorDir . '/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php', @@ -1046,6 +1136,7 @@ return array( 'Twig\\Node\\EmbedNode' => $vendorDir . '/twig/twig/src/Node/EmbedNode.php', 'Twig\\Node\\Expression\\AbstractExpression' => $vendorDir . '/twig/twig/src/Node/Expression/AbstractExpression.php', 'Twig\\Node\\Expression\\ArrayExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ArrayExpression.php', + 'Twig\\Node\\Expression\\ArrowFunctionExpression' => $vendorDir . '/twig/twig/src/Node/Expression/ArrowFunctionExpression.php', 'Twig\\Node\\Expression\\AssignNameExpression' => $vendorDir . '/twig/twig/src/Node/Expression/AssignNameExpression.php', 'Twig\\Node\\Expression\\Binary\\AbstractBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/AbstractBinary.php', 'Twig\\Node\\Expression\\Binary\\AddBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/AddBinary.php', @@ -1071,6 +1162,7 @@ return array( 'Twig\\Node\\Expression\\Binary\\OrBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/OrBinary.php', 'Twig\\Node\\Expression\\Binary\\PowerBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/PowerBinary.php', 'Twig\\Node\\Expression\\Binary\\RangeBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/RangeBinary.php', + 'Twig\\Node\\Expression\\Binary\\SpaceshipBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php', 'Twig\\Node\\Expression\\Binary\\StartsWithBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php', 'Twig\\Node\\Expression\\Binary\\SubBinary' => $vendorDir . '/twig/twig/src/Node/Expression/Binary/SubBinary.php', 'Twig\\Node\\Expression\\BlockReferenceExpression' => $vendorDir . '/twig/twig/src/Node/Expression/BlockReferenceExpression.php', @@ -1099,6 +1191,7 @@ return array( 'Twig\\Node\\Expression\\Unary\\NegUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/NegUnary.php', 'Twig\\Node\\Expression\\Unary\\NotUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/NotUnary.php', 'Twig\\Node\\Expression\\Unary\\PosUnary' => $vendorDir . '/twig/twig/src/Node/Expression/Unary/PosUnary.php', + 'Twig\\Node\\Expression\\VariadicExpression' => $vendorDir . '/twig/twig/src/Node/Expression/VariadicExpression.php', 'Twig\\Node\\FlushNode' => $vendorDir . '/twig/twig/src/Node/FlushNode.php', 'Twig\\Node\\ForLoopNode' => $vendorDir . '/twig/twig/src/Node/ForLoopNode.php', 'Twig\\Node\\ForNode' => $vendorDir . '/twig/twig/src/Node/ForNode.php', @@ -1114,7 +1207,6 @@ return array( 'Twig\\Node\\SandboxNode' => $vendorDir . '/twig/twig/src/Node/SandboxNode.php', 'Twig\\Node\\SandboxedPrintNode' => $vendorDir . '/twig/twig/src/Node/SandboxedPrintNode.php', 'Twig\\Node\\SetNode' => $vendorDir . '/twig/twig/src/Node/SetNode.php', - 'Twig\\Node\\SetTempNode' => $vendorDir . '/twig/twig/src/Node/SetTempNode.php', 'Twig\\Node\\SpacelessNode' => $vendorDir . '/twig/twig/src/Node/SpacelessNode.php', 'Twig\\Node\\TextNode' => $vendorDir . '/twig/twig/src/Node/TextNode.php', 'Twig\\Node\\WithNode' => $vendorDir . '/twig/twig/src/Node/WithNode.php', @@ -1145,6 +1237,7 @@ return array( 'Twig\\Test\\NodeTestCase' => $vendorDir . '/twig/twig/src/Test/NodeTestCase.php', 'Twig\\Token' => $vendorDir . '/twig/twig/src/Token.php', 'Twig\\TokenParser\\AbstractTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AbstractTokenParser.php', + 'Twig\\TokenParser\\ApplyTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/ApplyTokenParser.php', 'Twig\\TokenParser\\AutoEscapeTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/AutoEscapeTokenParser.php', 'Twig\\TokenParser\\BlockTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/BlockTokenParser.php', 'Twig\\TokenParser\\DeprecatedTokenParser' => $vendorDir . '/twig/twig/src/TokenParser/DeprecatedTokenParser.php', @@ -1171,13 +1264,11 @@ return array( 'Twig\\TwigTest' => $vendorDir . '/twig/twig/src/TwigTest.php', 'Twig\\Util\\DeprecationCollector' => $vendorDir . '/twig/twig/src/Util/DeprecationCollector.php', 'Twig\\Util\\TemplateDirIterator' => $vendorDir . '/twig/twig/src/Util/TemplateDirIterator.php', - 'Twig_Autoloader' => $vendorDir . '/twig/twig/lib/Twig/Autoloader.php', 'Twig_BaseNodeVisitor' => $vendorDir . '/twig/twig/lib/Twig/BaseNodeVisitor.php', 'Twig_CacheInterface' => $vendorDir . '/twig/twig/lib/Twig/CacheInterface.php', 'Twig_Cache_Filesystem' => $vendorDir . '/twig/twig/lib/Twig/Cache/Filesystem.php', 'Twig_Cache_Null' => $vendorDir . '/twig/twig/lib/Twig/Cache/Null.php', 'Twig_Compiler' => $vendorDir . '/twig/twig/lib/Twig/Compiler.php', - 'Twig_CompilerInterface' => $vendorDir . '/twig/twig/lib/Twig/CompilerInterface.php', 'Twig_ContainerRuntimeLoader' => $vendorDir . '/twig/twig/lib/Twig/ContainerRuntimeLoader.php', 'Twig_Environment' => $vendorDir . '/twig/twig/lib/Twig/Environment.php', 'Twig_Error' => $vendorDir . '/twig/twig/lib/Twig/Error.php', @@ -1188,6 +1279,7 @@ return array( 'Twig_ExpressionParser' => $vendorDir . '/twig/twig/lib/Twig/ExpressionParser.php', 'Twig_Extension' => $vendorDir . '/twig/twig/lib/Twig/Extension.php', 'Twig_ExtensionInterface' => $vendorDir . '/twig/twig/lib/Twig/ExtensionInterface.php', + 'Twig_ExtensionSet' => $vendorDir . '/twig/twig/lib/Twig/ExtensionSet.php', 'Twig_Extension_Core' => $vendorDir . '/twig/twig/lib/Twig/Extension/Core.php', 'Twig_Extension_Debug' => $vendorDir . '/twig/twig/lib/Twig/Extension/Debug.php', 'Twig_Extension_Escaper' => $vendorDir . '/twig/twig/lib/Twig/Extension/Escaper.php', @@ -1201,28 +1293,15 @@ return array( 'Twig_FactoryRuntimeLoader' => $vendorDir . '/twig/twig/lib/Twig/FactoryRuntimeLoader.php', 'Twig_FileExtensionEscapingStrategy' => $vendorDir . '/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php', 'Twig_Filter' => $vendorDir . '/twig/twig/lib/Twig/Filter.php', - 'Twig_FilterCallableInterface' => $vendorDir . '/twig/twig/lib/Twig/FilterCallableInterface.php', - 'Twig_FilterInterface' => $vendorDir . '/twig/twig/lib/Twig/FilterInterface.php', - 'Twig_Filter_Function' => $vendorDir . '/twig/twig/lib/Twig/Filter/Function.php', - 'Twig_Filter_Method' => $vendorDir . '/twig/twig/lib/Twig/Filter/Method.php', - 'Twig_Filter_Node' => $vendorDir . '/twig/twig/lib/Twig/Filter/Node.php', 'Twig_Function' => $vendorDir . '/twig/twig/lib/Twig/Function.php', - 'Twig_FunctionCallableInterface' => $vendorDir . '/twig/twig/lib/Twig/FunctionCallableInterface.php', - 'Twig_FunctionInterface' => $vendorDir . '/twig/twig/lib/Twig/FunctionInterface.php', - 'Twig_Function_Function' => $vendorDir . '/twig/twig/lib/Twig/Function/Function.php', - 'Twig_Function_Method' => $vendorDir . '/twig/twig/lib/Twig/Function/Method.php', - 'Twig_Function_Node' => $vendorDir . '/twig/twig/lib/Twig/Function/Node.php', 'Twig_Lexer' => $vendorDir . '/twig/twig/lib/Twig/Lexer.php', - 'Twig_LexerInterface' => $vendorDir . '/twig/twig/lib/Twig/LexerInterface.php', 'Twig_LoaderInterface' => $vendorDir . '/twig/twig/lib/Twig/LoaderInterface.php', 'Twig_Loader_Array' => $vendorDir . '/twig/twig/lib/Twig/Loader/Array.php', 'Twig_Loader_Chain' => $vendorDir . '/twig/twig/lib/Twig/Loader/Chain.php', 'Twig_Loader_Filesystem' => $vendorDir . '/twig/twig/lib/Twig/Loader/Filesystem.php', - 'Twig_Loader_String' => $vendorDir . '/twig/twig/lib/Twig/Loader/String.php', 'Twig_Markup' => $vendorDir . '/twig/twig/lib/Twig/Markup.php', 'Twig_Node' => $vendorDir . '/twig/twig/lib/Twig/Node.php', 'Twig_NodeCaptureInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeCaptureInterface.php', - 'Twig_NodeInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeInterface.php', 'Twig_NodeOutputInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeOutputInterface.php', 'Twig_NodeTraverser' => $vendorDir . '/twig/twig/lib/Twig/NodeTraverser.php', 'Twig_NodeVisitorInterface' => $vendorDir . '/twig/twig/lib/Twig/NodeVisitorInterface.php', @@ -1271,7 +1350,6 @@ return array( 'Twig_Node_Expression_Call' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Call.php', 'Twig_Node_Expression_Conditional' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Conditional.php', 'Twig_Node_Expression_Constant' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Constant.php', - 'Twig_Node_Expression_ExtensionReference' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php', 'Twig_Node_Expression_Filter' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Filter.php', 'Twig_Node_Expression_Filter_Default' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Filter/Default.php', 'Twig_Node_Expression_Function' => $vendorDir . '/twig/twig/lib/Twig/Node/Expression/Function.php', @@ -1305,12 +1383,10 @@ return array( 'Twig_Node_Sandbox' => $vendorDir . '/twig/twig/lib/Twig/Node/Sandbox.php', 'Twig_Node_SandboxedPrint' => $vendorDir . '/twig/twig/lib/Twig/Node/SandboxedPrint.php', 'Twig_Node_Set' => $vendorDir . '/twig/twig/lib/Twig/Node/Set.php', - 'Twig_Node_SetTemp' => $vendorDir . '/twig/twig/lib/Twig/Node/SetTemp.php', 'Twig_Node_Spaceless' => $vendorDir . '/twig/twig/lib/Twig/Node/Spaceless.php', 'Twig_Node_Text' => $vendorDir . '/twig/twig/lib/Twig/Node/Text.php', 'Twig_Node_With' => $vendorDir . '/twig/twig/lib/Twig/Node/With.php', 'Twig_Parser' => $vendorDir . '/twig/twig/lib/Twig/Parser.php', - 'Twig_ParserInterface' => $vendorDir . '/twig/twig/lib/Twig/ParserInterface.php', 'Twig_Profiler_Dumper_Base' => $vendorDir . '/twig/twig/lib/Twig/Profiler/Dumper/Base.php', 'Twig_Profiler_Dumper_Blackfire' => $vendorDir . '/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php', 'Twig_Profiler_Dumper_Html' => $vendorDir . '/twig/twig/lib/Twig/Profiler/Dumper/Html.php', @@ -1334,20 +1410,12 @@ return array( 'Twig_Source' => $vendorDir . '/twig/twig/lib/Twig/Source.php', 'Twig_SourceContextLoaderInterface' => $vendorDir . '/twig/twig/lib/Twig/SourceContextLoaderInterface.php', 'Twig_Template' => $vendorDir . '/twig/twig/lib/Twig/Template.php', - 'Twig_TemplateInterface' => $vendorDir . '/twig/twig/lib/Twig/TemplateInterface.php', 'Twig_TemplateWrapper' => $vendorDir . '/twig/twig/lib/Twig/TemplateWrapper.php', 'Twig_Test' => $vendorDir . '/twig/twig/lib/Twig/Test.php', - 'Twig_TestCallableInterface' => $vendorDir . '/twig/twig/lib/Twig/TestCallableInterface.php', - 'Twig_TestInterface' => $vendorDir . '/twig/twig/lib/Twig/TestInterface.php', - 'Twig_Test_Function' => $vendorDir . '/twig/twig/lib/Twig/Test/Function.php', 'Twig_Test_IntegrationTestCase' => $vendorDir . '/twig/twig/lib/Twig/Test/IntegrationTestCase.php', - 'Twig_Test_Method' => $vendorDir . '/twig/twig/lib/Twig/Test/Method.php', - 'Twig_Test_Node' => $vendorDir . '/twig/twig/lib/Twig/Test/Node.php', 'Twig_Test_NodeTestCase' => $vendorDir . '/twig/twig/lib/Twig/Test/NodeTestCase.php', 'Twig_Token' => $vendorDir . '/twig/twig/lib/Twig/Token.php', 'Twig_TokenParser' => $vendorDir . '/twig/twig/lib/Twig/TokenParser.php', - 'Twig_TokenParserBroker' => $vendorDir . '/twig/twig/lib/Twig/TokenParserBroker.php', - 'Twig_TokenParserBrokerInterface' => $vendorDir . '/twig/twig/lib/Twig/TokenParserBrokerInterface.php', 'Twig_TokenParserInterface' => $vendorDir . '/twig/twig/lib/Twig/TokenParserInterface.php', 'Twig_TokenParser_AutoEscape' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/AutoEscape.php', 'Twig_TokenParser_Block' => $vendorDir . '/twig/twig/lib/Twig/TokenParser/Block.php', @@ -1371,12 +1439,14 @@ return array( 'Twig_TokenStream' => $vendorDir . '/twig/twig/lib/Twig/TokenStream.php', 'Twig_Util_DeprecationCollector' => $vendorDir . '/twig/twig/lib/Twig/Util/DeprecationCollector.php', 'Twig_Util_TemplateDirIterator' => $vendorDir . '/twig/twig/lib/Twig/Util/TemplateDirIterator.php', + 'TypeError' => $vendorDir . '/symfony/polyfill-php70/Resources/stubs/TypeError.php', 'Zend\\Code\\Annotation\\AnnotationCollection' => $vendorDir . '/zendframework/zend-code/src/Annotation/AnnotationCollection.php', 'Zend\\Code\\Annotation\\AnnotationInterface' => $vendorDir . '/zendframework/zend-code/src/Annotation/AnnotationInterface.php', 'Zend\\Code\\Annotation\\AnnotationManager' => $vendorDir . '/zendframework/zend-code/src/Annotation/AnnotationManager.php', 'Zend\\Code\\Annotation\\Parser\\DoctrineAnnotationParser' => $vendorDir . '/zendframework/zend-code/src/Annotation/Parser/DoctrineAnnotationParser.php', 'Zend\\Code\\Annotation\\Parser\\GenericAnnotationParser' => $vendorDir . '/zendframework/zend-code/src/Annotation/Parser/GenericAnnotationParser.php', 'Zend\\Code\\Annotation\\Parser\\ParserInterface' => $vendorDir . '/zendframework/zend-code/src/Annotation/Parser/ParserInterface.php', + 'Zend\\Code\\DeclareStatement' => $vendorDir . '/zendframework/zend-code/src/DeclareStatement.php', 'Zend\\Code\\Exception\\BadMethodCallException' => $vendorDir . '/zendframework/zend-code/src/Exception/BadMethodCallException.php', 'Zend\\Code\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-code/src/Exception/ExceptionInterface.php', 'Zend\\Code\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-code/src/Exception/InvalidArgumentException.php', @@ -1398,12 +1468,14 @@ return array( 'Zend\\Code\\Generator\\DocBlock\\Tag\\ReturnTag' => $vendorDir . '/zendframework/zend-code/src/Generator/DocBlock/Tag/ReturnTag.php', 'Zend\\Code\\Generator\\DocBlock\\Tag\\TagInterface' => $vendorDir . '/zendframework/zend-code/src/Generator/DocBlock/Tag/TagInterface.php', 'Zend\\Code\\Generator\\DocBlock\\Tag\\ThrowsTag' => $vendorDir . '/zendframework/zend-code/src/Generator/DocBlock/Tag/ThrowsTag.php', + 'Zend\\Code\\Generator\\DocBlock\\Tag\\VarTag' => $vendorDir . '/zendframework/zend-code/src/Generator/DocBlock/Tag/VarTag.php', 'Zend\\Code\\Generator\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-code/src/Generator/Exception/ExceptionInterface.php', 'Zend\\Code\\Generator\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-code/src/Generator/Exception/InvalidArgumentException.php', 'Zend\\Code\\Generator\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-code/src/Generator/Exception/RuntimeException.php', 'Zend\\Code\\Generator\\FileGenerator' => $vendorDir . '/zendframework/zend-code/src/Generator/FileGenerator.php', 'Zend\\Code\\Generator\\FileGeneratorRegistry' => $vendorDir . '/zendframework/zend-code/src/Generator/FileGeneratorRegistry.php', 'Zend\\Code\\Generator\\GeneratorInterface' => $vendorDir . '/zendframework/zend-code/src/Generator/GeneratorInterface.php', + 'Zend\\Code\\Generator\\InterfaceGenerator' => $vendorDir . '/zendframework/zend-code/src/Generator/InterfaceGenerator.php', 'Zend\\Code\\Generator\\MethodGenerator' => $vendorDir . '/zendframework/zend-code/src/Generator/MethodGenerator.php', 'Zend\\Code\\Generator\\ParameterGenerator' => $vendorDir . '/zendframework/zend-code/src/Generator/ParameterGenerator.php', 'Zend\\Code\\Generator\\PropertyGenerator' => $vendorDir . '/zendframework/zend-code/src/Generator/PropertyGenerator.php', @@ -1411,6 +1483,7 @@ return array( 'Zend\\Code\\Generator\\TraitGenerator' => $vendorDir . '/zendframework/zend-code/src/Generator/TraitGenerator.php', 'Zend\\Code\\Generator\\TraitUsageGenerator' => $vendorDir . '/zendframework/zend-code/src/Generator/TraitUsageGenerator.php', 'Zend\\Code\\Generator\\TraitUsageInterface' => $vendorDir . '/zendframework/zend-code/src/Generator/TraitUsageInterface.php', + 'Zend\\Code\\Generator\\TypeGenerator' => $vendorDir . '/zendframework/zend-code/src/Generator/TypeGenerator.php', 'Zend\\Code\\Generator\\ValueGenerator' => $vendorDir . '/zendframework/zend-code/src/Generator/ValueGenerator.php', 'Zend\\Code\\Generic\\Prototype\\PrototypeClassFactory' => $vendorDir . '/zendframework/zend-code/src/Generic/Prototype/PrototypeClassFactory.php', 'Zend\\Code\\Generic\\Prototype\\PrototypeGenericInterface' => $vendorDir . '/zendframework/zend-code/src/Generic/Prototype/PrototypeGenericInterface.php', @@ -1429,6 +1502,7 @@ return array( 'Zend\\Code\\Reflection\\DocBlock\\Tag\\ReturnTag' => $vendorDir . '/zendframework/zend-code/src/Reflection/DocBlock/Tag/ReturnTag.php', 'Zend\\Code\\Reflection\\DocBlock\\Tag\\TagInterface' => $vendorDir . '/zendframework/zend-code/src/Reflection/DocBlock/Tag/TagInterface.php', 'Zend\\Code\\Reflection\\DocBlock\\Tag\\ThrowsTag' => $vendorDir . '/zendframework/zend-code/src/Reflection/DocBlock/Tag/ThrowsTag.php', + 'Zend\\Code\\Reflection\\DocBlock\\Tag\\VarTag' => $vendorDir . '/zendframework/zend-code/src/Reflection/DocBlock/Tag/VarTag.php', 'Zend\\Code\\Reflection\\Exception\\BadMethodCallException' => $vendorDir . '/zendframework/zend-code/src/Reflection/Exception/BadMethodCallException.php', 'Zend\\Code\\Reflection\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-code/src/Reflection/Exception/ExceptionInterface.php', 'Zend\\Code\\Reflection\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-code/src/Reflection/Exception/InvalidArgumentException.php', @@ -1468,117 +1542,46 @@ return array( 'Zend\\EventManager\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-eventmanager/src/Exception/ExceptionInterface.php', 'Zend\\EventManager\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-eventmanager/src/Exception/InvalidArgumentException.php', 'Zend\\EventManager\\Exception\\InvalidCallbackException' => $vendorDir . '/zendframework/zend-eventmanager/src/Exception/InvalidCallbackException.php', + 'Zend\\EventManager\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-eventmanager/src/Exception/RuntimeException.php', 'Zend\\EventManager\\FilterChain' => $vendorDir . '/zendframework/zend-eventmanager/src/FilterChain.php', 'Zend\\EventManager\\Filter\\FilterInterface' => $vendorDir . '/zendframework/zend-eventmanager/src/Filter/FilterInterface.php', 'Zend\\EventManager\\Filter\\FilterIterator' => $vendorDir . '/zendframework/zend-eventmanager/src/Filter/FilterIterator.php', - 'Zend\\EventManager\\GlobalEventManager' => $vendorDir . '/zendframework/zend-eventmanager/src/GlobalEventManager.php', + 'Zend\\EventManager\\LazyEventListener' => $vendorDir . '/zendframework/zend-eventmanager/src/LazyEventListener.php', + 'Zend\\EventManager\\LazyListener' => $vendorDir . '/zendframework/zend-eventmanager/src/LazyListener.php', + 'Zend\\EventManager\\LazyListenerAggregate' => $vendorDir . '/zendframework/zend-eventmanager/src/LazyListenerAggregate.php', 'Zend\\EventManager\\ListenerAggregateInterface' => $vendorDir . '/zendframework/zend-eventmanager/src/ListenerAggregateInterface.php', 'Zend\\EventManager\\ListenerAggregateTrait' => $vendorDir . '/zendframework/zend-eventmanager/src/ListenerAggregateTrait.php', - 'Zend\\EventManager\\ProvidesEvents' => $vendorDir . '/zendframework/zend-eventmanager/src/ProvidesEvents.php', 'Zend\\EventManager\\ResponseCollection' => $vendorDir . '/zendframework/zend-eventmanager/src/ResponseCollection.php', - 'Zend\\EventManager\\SharedEventAggregateAwareInterface' => $vendorDir . '/zendframework/zend-eventmanager/src/SharedEventAggregateAwareInterface.php', 'Zend\\EventManager\\SharedEventManager' => $vendorDir . '/zendframework/zend-eventmanager/src/SharedEventManager.php', - 'Zend\\EventManager\\SharedEventManagerAwareInterface' => $vendorDir . '/zendframework/zend-eventmanager/src/SharedEventManagerAwareInterface.php', 'Zend\\EventManager\\SharedEventManagerInterface' => $vendorDir . '/zendframework/zend-eventmanager/src/SharedEventManagerInterface.php', - 'Zend\\EventManager\\SharedListenerAggregateInterface' => $vendorDir . '/zendframework/zend-eventmanager/src/SharedListenerAggregateInterface.php', - 'Zend\\EventManager\\StaticEventManager' => $vendorDir . '/zendframework/zend-eventmanager/src/StaticEventManager.php', - 'Zend\\Stdlib\\AbstractOptions' => $vendorDir . '/zendframework/zend-stdlib/src/AbstractOptions.php', - 'Zend\\Stdlib\\ArrayObject' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayObject.php', - 'Zend\\Stdlib\\ArraySerializableInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ArraySerializableInterface.php', - 'Zend\\Stdlib\\ArrayStack' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayStack.php', - 'Zend\\Stdlib\\ArrayUtils' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeRemoveKey' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKey' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKey.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKeyInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php', - 'Zend\\Stdlib\\CallbackHandler' => $vendorDir . '/zendframework/zend-stdlib/src/CallbackHandler.php', - 'Zend\\Stdlib\\DateTime' => $vendorDir . '/zendframework/zend-stdlib/src/DateTime.php', - 'Zend\\Stdlib\\DispatchableInterface' => $vendorDir . '/zendframework/zend-stdlib/src/DispatchableInterface.php', - 'Zend\\Stdlib\\ErrorHandler' => $vendorDir . '/zendframework/zend-stdlib/src/ErrorHandler.php', - 'Zend\\Stdlib\\Exception\\BadMethodCallException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/BadMethodCallException.php', - 'Zend\\Stdlib\\Exception\\DomainException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/DomainException.php', - 'Zend\\Stdlib\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/ExceptionInterface.php', - 'Zend\\Stdlib\\Exception\\ExtensionNotLoadedException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/ExtensionNotLoadedException.php', - 'Zend\\Stdlib\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/InvalidArgumentException.php', - 'Zend\\Stdlib\\Exception\\InvalidCallbackException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/InvalidCallbackException.php', - 'Zend\\Stdlib\\Exception\\LogicException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/LogicException.php', - 'Zend\\Stdlib\\Exception\\RuntimeException' => $vendorDir . '/zendframework/zend-stdlib/src/Exception/RuntimeException.php', - 'Zend\\Stdlib\\Extractor\\ExtractionInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Extractor/ExtractionInterface.php', - 'Zend\\Stdlib\\Glob' => $vendorDir . '/zendframework/zend-stdlib/src/Glob.php', - 'Zend\\Stdlib\\Guard\\AllGuardsTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/AllGuardsTrait.php', - 'Zend\\Stdlib\\Guard\\ArrayOrTraversableGuardTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php', - 'Zend\\Stdlib\\Guard\\EmptyGuardTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/EmptyGuardTrait.php', - 'Zend\\Stdlib\\Guard\\GuardUtils' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/GuardUtils.php', - 'Zend\\Stdlib\\Guard\\NullGuardTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Guard/NullGuardTrait.php', - 'Zend\\Stdlib\\Hydrator\\AbstractHydrator' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/AbstractHydrator.php', - 'Zend\\Stdlib\\Hydrator\\Aggregate\\AggregateHydrator' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Aggregate/AggregateHydrator.php', - 'Zend\\Stdlib\\Hydrator\\Aggregate\\ExtractEvent' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Aggregate/ExtractEvent.php', - 'Zend\\Stdlib\\Hydrator\\Aggregate\\HydrateEvent' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydrateEvent.php', - 'Zend\\Stdlib\\Hydrator\\Aggregate\\HydratorListener' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydratorListener.php', - 'Zend\\Stdlib\\Hydrator\\ArraySerializable' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/ArraySerializable.php', - 'Zend\\Stdlib\\Hydrator\\ClassMethods' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/ClassMethods.php', - 'Zend\\Stdlib\\Hydrator\\DelegatingHydrator' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/DelegatingHydrator.php', - 'Zend\\Stdlib\\Hydrator\\DelegatingHydratorFactory' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/DelegatingHydratorFactory.php', - 'Zend\\Stdlib\\Hydrator\\FilterEnabledInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/FilterEnabledInterface.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\FilterComposite' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Filter/FilterComposite.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\FilterInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Filter/FilterInterface.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\FilterProviderInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Filter/FilterProviderInterface.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\GetFilter' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Filter/GetFilter.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\HasFilter' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Filter/HasFilter.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\IsFilter' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Filter/IsFilter.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\MethodMatchFilter' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Filter/MethodMatchFilter.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\NumberOfParameterFilter' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Filter/NumberOfParameterFilter.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\OptionalParametersFilter' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Filter/OptionalParametersFilter.php', - 'Zend\\Stdlib\\Hydrator\\HydrationInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/HydrationInterface.php', - 'Zend\\Stdlib\\Hydrator\\HydratorAwareInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/HydratorAwareInterface.php', - 'Zend\\Stdlib\\Hydrator\\HydratorAwareTrait' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/HydratorAwareTrait.php', - 'Zend\\Stdlib\\Hydrator\\HydratorInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/HydratorInterface.php', - 'Zend\\Stdlib\\Hydrator\\HydratorOptionsInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/HydratorOptionsInterface.php', - 'Zend\\Stdlib\\Hydrator\\HydratorPluginManager' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/HydratorPluginManager.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategyEnabledInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategyEnabledInterface.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\ArrayMapNamingStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/ArrayMapNamingStrategy.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\CompositeNamingStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/CompositeNamingStrategy.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\IdentityNamingStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/IdentityNamingStrategy.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\MapNamingStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/MapNamingStrategy.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\NamingStrategyInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/NamingStrategyInterface.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\UnderscoreNamingStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/UnderscoreNamingStrategy.php', - 'Zend\\Stdlib\\Hydrator\\ObjectProperty' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/ObjectProperty.php', - 'Zend\\Stdlib\\Hydrator\\Reflection' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Reflection.php', - 'Zend\\Stdlib\\Hydrator\\StrategyEnabledInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/StrategyEnabledInterface.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\BooleanStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Strategy/BooleanStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\ClosureStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Strategy/ClosureStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\DateTimeFormatterStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Strategy/DateTimeFormatterStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\DefaultStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Strategy/DefaultStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\Exception\\ExceptionInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/ExceptionInterface.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\Exception\\InvalidArgumentException' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/InvalidArgumentException.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\ExplodeStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Strategy/ExplodeStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\SerializableStrategy' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Strategy/SerializableStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\StrategyChain' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyChain.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\StrategyInterface' => $vendorDir . '/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyInterface.php', - 'Zend\\Stdlib\\InitializableInterface' => $vendorDir . '/zendframework/zend-stdlib/src/InitializableInterface.php', - 'Zend\\Stdlib\\JsonSerializable' => $vendorDir . '/zendframework/zend-stdlib/src/JsonSerializable.php', - 'Zend\\Stdlib\\JsonSerializable\\PhpLegacyCompatibility' => $vendorDir . '/zendframework/zend-stdlib/src/JsonSerializable/PhpLegacyCompatibility.php', - 'Zend\\Stdlib\\Message' => $vendorDir . '/zendframework/zend-stdlib/src/Message.php', - 'Zend\\Stdlib\\MessageInterface' => $vendorDir . '/zendframework/zend-stdlib/src/MessageInterface.php', - 'Zend\\Stdlib\\ParameterObjectInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ParameterObjectInterface.php', - 'Zend\\Stdlib\\Parameters' => $vendorDir . '/zendframework/zend-stdlib/src/Parameters.php', - 'Zend\\Stdlib\\ParametersInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ParametersInterface.php', - 'Zend\\Stdlib\\PriorityList' => $vendorDir . '/zendframework/zend-stdlib/src/PriorityList.php', - 'Zend\\Stdlib\\PriorityQueue' => $vendorDir . '/zendframework/zend-stdlib/src/PriorityQueue.php', - 'Zend\\Stdlib\\Request' => $vendorDir . '/zendframework/zend-stdlib/src/Request.php', - 'Zend\\Stdlib\\RequestInterface' => $vendorDir . '/zendframework/zend-stdlib/src/RequestInterface.php', - 'Zend\\Stdlib\\Response' => $vendorDir . '/zendframework/zend-stdlib/src/Response.php', - 'Zend\\Stdlib\\ResponseInterface' => $vendorDir . '/zendframework/zend-stdlib/src/ResponseInterface.php', - 'Zend\\Stdlib\\SplPriorityQueue' => $vendorDir . '/zendframework/zend-stdlib/src/SplPriorityQueue.php', - 'Zend\\Stdlib\\SplQueue' => $vendorDir . '/zendframework/zend-stdlib/src/SplQueue.php', - 'Zend\\Stdlib\\SplStack' => $vendorDir . '/zendframework/zend-stdlib/src/SplStack.php', - 'Zend\\Stdlib\\StringUtils' => $vendorDir . '/zendframework/zend-stdlib/src/StringUtils.php', - 'Zend\\Stdlib\\StringWrapper\\AbstractStringWrapper' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php', - 'Zend\\Stdlib\\StringWrapper\\Iconv' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/Iconv.php', - 'Zend\\Stdlib\\StringWrapper\\Intl' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/Intl.php', - 'Zend\\Stdlib\\StringWrapper\\MbString' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/MbString.php', - 'Zend\\Stdlib\\StringWrapper\\Native' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/Native.php', - 'Zend\\Stdlib\\StringWrapper\\StringWrapperInterface' => $vendorDir . '/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php', + 'Zend\\EventManager\\SharedEventsCapableInterface' => $vendorDir . '/zendframework/zend-eventmanager/src/SharedEventsCapableInterface.php', + 'Zend\\EventManager\\Test\\EventListenerIntrospectionTrait' => $vendorDir . '/zendframework/zend-eventmanager/src/Test/EventListenerIntrospectionTrait.php', 'bantu\\IniGetWrapper\\IniGetWrapper' => $vendorDir . '/bantu/ini-get-wrapper/src/IniGetWrapper.php', + 's9e\\RegexpBuilder\\Builder' => $vendorDir . '/s9e/regexp-builder/src/Builder.php', + 's9e\\RegexpBuilder\\Escaper' => $vendorDir . '/s9e/regexp-builder/src/Escaper.php', + 's9e\\RegexpBuilder\\Input\\BaseImplementation' => $vendorDir . '/s9e/regexp-builder/src/Input/BaseImplementation.php', + 's9e\\RegexpBuilder\\Input\\Bytes' => $vendorDir . '/s9e/regexp-builder/src/Input/Bytes.php', + 's9e\\RegexpBuilder\\Input\\InputInterface' => $vendorDir . '/s9e/regexp-builder/src/Input/InputInterface.php', + 's9e\\RegexpBuilder\\Input\\Utf8' => $vendorDir . '/s9e/regexp-builder/src/Input/Utf8.php', + 's9e\\RegexpBuilder\\MetaCharacters' => $vendorDir . '/s9e/regexp-builder/src/MetaCharacters.php', + 's9e\\RegexpBuilder\\Output\\BaseImplementation' => $vendorDir . '/s9e/regexp-builder/src/Output/BaseImplementation.php', + 's9e\\RegexpBuilder\\Output\\Bytes' => $vendorDir . '/s9e/regexp-builder/src/Output/Bytes.php', + 's9e\\RegexpBuilder\\Output\\JavaScript' => $vendorDir . '/s9e/regexp-builder/src/Output/JavaScript.php', + 's9e\\RegexpBuilder\\Output\\OutputInterface' => $vendorDir . '/s9e/regexp-builder/src/Output/OutputInterface.php', + 's9e\\RegexpBuilder\\Output\\PHP' => $vendorDir . '/s9e/regexp-builder/src/Output/PHP.php', + 's9e\\RegexpBuilder\\Output\\PrintableAscii' => $vendorDir . '/s9e/regexp-builder/src/Output/PrintableAscii.php', + 's9e\\RegexpBuilder\\Output\\Utf8' => $vendorDir . '/s9e/regexp-builder/src/Output/Utf8.php', + 's9e\\RegexpBuilder\\Passes\\AbstractPass' => $vendorDir . '/s9e/regexp-builder/src/Passes/AbstractPass.php', + 's9e\\RegexpBuilder\\Passes\\CoalesceOptionalStrings' => $vendorDir . '/s9e/regexp-builder/src/Passes/CoalesceOptionalStrings.php', + 's9e\\RegexpBuilder\\Passes\\CoalesceSingleCharacterPrefix' => $vendorDir . '/s9e/regexp-builder/src/Passes/CoalesceSingleCharacterPrefix.php', + 's9e\\RegexpBuilder\\Passes\\GroupSingleCharacters' => $vendorDir . '/s9e/regexp-builder/src/Passes/GroupSingleCharacters.php', + 's9e\\RegexpBuilder\\Passes\\MergePrefix' => $vendorDir . '/s9e/regexp-builder/src/Passes/MergePrefix.php', + 's9e\\RegexpBuilder\\Passes\\MergeSuffix' => $vendorDir . '/s9e/regexp-builder/src/Passes/MergeSuffix.php', + 's9e\\RegexpBuilder\\Passes\\PassInterface' => $vendorDir . '/s9e/regexp-builder/src/Passes/PassInterface.php', + 's9e\\RegexpBuilder\\Passes\\PromoteSingleStrings' => $vendorDir . '/s9e/regexp-builder/src/Passes/PromoteSingleStrings.php', + 's9e\\RegexpBuilder\\Passes\\Recurse' => $vendorDir . '/s9e/regexp-builder/src/Passes/Recurse.php', + 's9e\\RegexpBuilder\\Runner' => $vendorDir . '/s9e/regexp-builder/src/Runner.php', + 's9e\\RegexpBuilder\\Serializer' => $vendorDir . '/s9e/regexp-builder/src/Serializer.php', 's9e\\TextFormatter\\Bundle' => $vendorDir . '/s9e/text-formatter/src/Bundle.php', 's9e\\TextFormatter\\Bundles\\Fatdown' => $vendorDir . '/s9e/text-formatter/src/Bundles/Fatdown.php', 's9e\\TextFormatter\\Bundles\\Fatdown\\Renderer' => $vendorDir . '/s9e/text-formatter/src/Bundles/Fatdown/Renderer.php', @@ -1588,55 +1591,56 @@ return array( 's9e\\TextFormatter\\Bundles\\MediaPack\\Renderer' => $vendorDir . '/s9e/text-formatter/src/Bundles/MediaPack/Renderer.php', 's9e\\TextFormatter\\Configurator' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', 's9e\\TextFormatter\\Configurator\\Bundle' => $vendorDir . '/s9e/text-formatter/src/Configurator/Bundle.php', - 's9e\\TextFormatter\\Configurator\\BundleGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\BundleGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator/BundleGenerator.php', 's9e\\TextFormatter\\Configurator\\Bundles\\Fatdown' => $vendorDir . '/s9e/text-formatter/src/Configurator/Bundles/Fatdown.php', 's9e\\TextFormatter\\Configurator\\Bundles\\Forum' => $vendorDir . '/s9e/text-formatter/src/Configurator/Bundles/Forum.php', 's9e\\TextFormatter\\Configurator\\Bundles\\MediaPack' => $vendorDir . '/s9e/text-formatter/src/Configurator/Bundles/MediaPack.php', - 's9e\\TextFormatter\\Configurator\\Collections\\AttributeCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\AttributeFilterChain' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\AttributeFilterCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Collections\\AttributeCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/AttributeCollection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\AttributeFilterChain' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/AttributeFilterChain.php', + 's9e\\TextFormatter\\Configurator\\Collections\\AttributeFilterCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/AttributeFilterCollection.php', 's9e\\TextFormatter\\Configurator\\Collections\\AttributeList' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/AttributeList.php', - 's9e\\TextFormatter\\Configurator\\Collections\\AttributePreprocessorCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\Collection' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\FilterChain' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\HostnameList' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Collections\\AttributePreprocessorCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/AttributePreprocessorCollection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\Collection' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/Collection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\FilterChain' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/FilterChain.php', + 's9e\\TextFormatter\\Configurator\\Collections\\HostnameList' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/HostnameList.php', 's9e\\TextFormatter\\Configurator\\Collections\\MinifierList' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/MinifierList.php', - 's9e\\TextFormatter\\Configurator\\Collections\\NormalizedCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\NormalizedList' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\PluginCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\RulesGeneratorList' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\Ruleset' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\SchemeList' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\TagCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\TagFilterChain' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Collections\\NormalizedCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/NormalizedCollection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\NormalizedList' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/NormalizedList.php', + 's9e\\TextFormatter\\Configurator\\Collections\\PluginCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/PluginCollection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\RulesGeneratorList' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/RulesGeneratorList.php', + 's9e\\TextFormatter\\Configurator\\Collections\\Ruleset' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/Ruleset.php', + 's9e\\TextFormatter\\Configurator\\Collections\\SchemeList' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/SchemeList.php', + 's9e\\TextFormatter\\Configurator\\Collections\\TagCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/TagCollection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\TagFilterChain' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/TagFilterChain.php', 's9e\\TextFormatter\\Configurator\\Collections\\TagList' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/TagList.php', - 's9e\\TextFormatter\\Configurator\\Collections\\TemplateCheckList' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\TemplateNormalizationList' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\TemplateParameterCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\ConfigProvider' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Collections\\TemplateCheckList' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/TemplateCheckList.php', + 's9e\\TextFormatter\\Configurator\\Collections\\TemplateNormalizationList' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/TemplateNormalizationList.php', + 's9e\\TextFormatter\\Configurator\\Collections\\TemplateParameterCollection' => $vendorDir . '/s9e/text-formatter/src/Configurator/Collections/TemplateParameterCollection.php', + 's9e\\TextFormatter\\Configurator\\ConfigProvider' => $vendorDir . '/s9e/text-formatter/src/Configurator/ConfigProvider.php', 's9e\\TextFormatter\\Configurator\\Exceptions\\UnsafeTemplateException' => $vendorDir . '/s9e/text-formatter/src/Configurator/Exceptions/UnsafeTemplateException.php', - 's9e\\TextFormatter\\Configurator\\FilterableConfigValue' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\AVTHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\CharacterClassBuilder' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\ConfigHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\FilterableConfigValue' => $vendorDir . '/s9e/text-formatter/src/Configurator/FilterableConfigValue.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\AVTHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/AVTHelper.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\ConfigHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/ConfigHelper.php', 's9e\\TextFormatter\\Configurator\\Helpers\\ContextSafeness' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/ContextSafeness.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\ElementInspector' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\NodeLocator' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\RegexpBuilder' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\ElementInspector' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/ElementInspector.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\FilterHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/FilterHelper.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\FilterSyntaxMatcher' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/FilterSyntaxMatcher.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\NodeLocator' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/NodeLocator.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\RegexpBuilder' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/RegexpBuilder.php', 's9e\\TextFormatter\\Configurator\\Helpers\\RegexpParser' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/RegexpParser.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\RulesHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateInspector' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateLoader' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\RulesHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/RulesHelper.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/TemplateHelper.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateInspector' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/TemplateInspector.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateLoader' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/TemplateLoader.php', 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateModifier' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/TemplateModifier.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\IRProcessor' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Normalizer' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Optimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Parser' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\XPathHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\Attribute' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/TemplateParser.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\IRProcessor' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/IRProcessor.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Normalizer' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/Normalizer.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Optimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/Optimizer.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Parser' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/Parser.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\XPathHelper' => $vendorDir . '/s9e/text-formatter/src/Configurator/Helpers/XPathHelper.php', + 's9e\\TextFormatter\\Configurator\\Items\\Attribute' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/Attribute.php', + 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/AttributeFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\AlnumFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/AlnumFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\ChoiceFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/ChoiceFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\ColorFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/ColorFilter.php', @@ -1658,24 +1662,24 @@ return array( 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\SimpletextFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/SimpletextFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\TimestampFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/TimestampFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\UintFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/UintFilter.php', - 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\UrlFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\UrlFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/UrlFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributePreprocessor' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/AttributePreprocessor.php', - 's9e\\TextFormatter\\Configurator\\Items\\Filter' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\ProgrammableCallback' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\Regexp' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\Tag' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\TagFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\Template' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Items\\Filter' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/Filter.php', + 's9e\\TextFormatter\\Configurator\\Items\\ProgrammableCallback' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/ProgrammableCallback.php', + 's9e\\TextFormatter\\Configurator\\Items\\Regexp' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/Regexp.php', + 's9e\\TextFormatter\\Configurator\\Items\\Tag' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/Tag.php', + 's9e\\TextFormatter\\Configurator\\Items\\TagFilter' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/TagFilter.php', + 's9e\\TextFormatter\\Configurator\\Items\\Template' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/Template.php', 's9e\\TextFormatter\\Configurator\\Items\\TemplateDocument' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/TemplateDocument.php', 's9e\\TextFormatter\\Configurator\\Items\\UnsafeTemplate' => $vendorDir . '/s9e/text-formatter/src/Configurator/Items/UnsafeTemplate.php', 's9e\\TextFormatter\\Configurator\\JavaScript' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\CallbackGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/CallbackGenerator.php', - 's9e\\TextFormatter\\Configurator\\JavaScript\\Code' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\JavaScript\\Code' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/Code.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\ConfigOptimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/ConfigOptimizer.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\ConfigValue' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/ConfigValue.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\Dictionary' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/Dictionary.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\Encoder' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/Encoder.php', - 's9e\\TextFormatter\\Configurator\\JavaScript\\FunctionProvider' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\JavaScript\\FunctionProvider' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/FunctionProvider.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\HintGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/HintGenerator.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\Minifier' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/Minifier.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\Minifiers\\ClosureCompilerApplication' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/Minifiers/ClosureCompilerApplication.php', @@ -1686,100 +1690,115 @@ return array( 's9e\\TextFormatter\\Configurator\\JavaScript\\OnlineMinifier' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/OnlineMinifier.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\RegexpConvertor' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/RegexpConvertor.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\StylesheetCompressor' => $vendorDir . '/s9e/text-formatter/src/Configurator/JavaScript/StylesheetCompressor.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\AbstractOptimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\BranchOutputOptimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\ControlStructuresOptimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Optimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Quick' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Serializer' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\SwitchStatement' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\RecursiveParser' => $vendorDir . '/s9e/text-formatter/src/Configurator/RecursiveParser.php', + 's9e\\TextFormatter\\Configurator\\RecursiveParser\\AbstractRecursiveMatcher' => $vendorDir . '/s9e/text-formatter/src/Configurator/RecursiveParser/AbstractRecursiveMatcher.php', + 's9e\\TextFormatter\\Configurator\\RecursiveParser\\CachingRecursiveParser' => $vendorDir . '/s9e/text-formatter/src/Configurator/RecursiveParser/CachingRecursiveParser.php', + 's9e\\TextFormatter\\Configurator\\RecursiveParser\\MatcherInterface' => $vendorDir . '/s9e/text-formatter/src/Configurator/RecursiveParser/MatcherInterface.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerator.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\AbstractOptimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/AbstractOptimizer.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\BranchOutputOptimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/BranchOutputOptimizer.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\ControlStructuresOptimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/ControlStructuresOptimizer.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Optimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/Optimizer.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Quick' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/Quick.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Serializer' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/Serializer.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\SwitchStatement' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/SwitchStatement.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\AbstractConvertor' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/AbstractConvertor.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\BooleanFunctions' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/BooleanFunctions.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\BooleanOperators' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/BooleanOperators.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\Comparisons' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/Comparisons.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\Core' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/Core.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\Math' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/Math.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\MultiByteStringManipulation' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/MultiByteStringManipulation.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\SingleByteStringFunctions' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/SingleByteStringFunctions.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\SingleByteStringManipulation' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/SingleByteStringManipulation.php', 's9e\\TextFormatter\\Configurator\\RendererGenerators\\Unformatted' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/Unformatted.php', 's9e\\TextFormatter\\Configurator\\RendererGenerators\\XSLT' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/XSLT.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\XSLT\\Optimizer' => $vendorDir . '/s9e/text-formatter/src/Configurator/RendererGenerators/XSLT/Optimizer.php', - 's9e\\TextFormatter\\Configurator\\Rendering' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Rendering' => $vendorDir . '/s9e/text-formatter/src/Configurator/Rendering.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerator.php', 's9e\\TextFormatter\\Configurator\\RulesGenerators\\AllowAll' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/AllowAll.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\AutoCloseIfVoid' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\AutoReopenFormattingElements' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\BlockElementsCloseFormattingElements' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\BlockElementsFosterFormattingElements' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\DisableAutoLineBreaksIfNewLinesArePreserved' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\EnforceContentModels' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\EnforceOptionalEndTags' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreTagsInCode' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreTextIfDisallowed' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreWhitespaceAroundBlockElements' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\Interfaces\\BooleanRulesGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\Interfaces\\TargetedRulesGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\AutoCloseIfVoid' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/AutoCloseIfVoid.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\AutoReopenFormattingElements' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/AutoReopenFormattingElements.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\BlockElementsCloseFormattingElements' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/BlockElementsCloseFormattingElements.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\BlockElementsFosterFormattingElements' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/BlockElementsFosterFormattingElements.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\DisableAutoLineBreaksIfNewLinesArePreserved' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/DisableAutoLineBreaksIfNewLinesArePreserved.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\EnforceContentModels' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/EnforceContentModels.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\EnforceOptionalEndTags' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/EnforceOptionalEndTags.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreTagsInCode' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/IgnoreTagsInCode.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreTextIfDisallowed' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/IgnoreTextIfDisallowed.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreWhitespaceAroundBlockElements' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/IgnoreWhitespaceAroundBlockElements.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\Interfaces\\BooleanRulesGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/Interfaces/BooleanRulesGenerator.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\Interfaces\\TargetedRulesGenerator' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/Interfaces/TargetedRulesGenerator.php', 's9e\\TextFormatter\\Configurator\\RulesGenerators\\ManageParagraphs' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/ManageParagraphs.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\TrimFirstLineInCodeBlocks' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateCheck' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecker' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\AbstractDynamicContentCheck' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\AbstractFlashRestriction' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowAttributeSets' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowCopy' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDisableOutputEscaping' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDynamicAttributeNames' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDynamicElementNames' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\TrimFirstLineInCodeBlocks' => $vendorDir . '/s9e/text-formatter/src/Configurator/RulesGenerators/TrimFirstLineInCodeBlocks.php', + 's9e\\TextFormatter\\Configurator\\TemplateCheck' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateCheck.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecker' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecker.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\AbstractDynamicContentCheck' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/AbstractDynamicContentCheck.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\AbstractFlashRestriction' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/AbstractFlashRestriction.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowAttributeSets' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowAttributeSets.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowCopy' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowCopy.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDisableOutputEscaping' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowDisableOutputEscaping.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDynamicAttributeNames' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowDynamicAttributeNames.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDynamicElementNames' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowDynamicElementNames.php', 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowElement' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowElement.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowElementNS' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowElementNS' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowElementNS.php', 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowFlashFullScreen' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowFlashFullScreen.php', 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowNodeByXPath' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowNodeByXPath.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowObjectParamsWithGeneratedName' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowPHPTags' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeCopyOf' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicCSS' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicJS' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicURL' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowXPathFunction' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowObjectParamsWithGeneratedName' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowObjectParamsWithGeneratedName.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowPHPTags' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowPHPTags.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeCopyOf' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeCopyOf.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicCSS' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeDynamicCSS.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicJS' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeDynamicJS.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicURL' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeDynamicURL.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowXPathFunction' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowXPathFunction.php', 's9e\\TextFormatter\\Configurator\\TemplateChecks\\RestrictFlashNetworking' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/RestrictFlashNetworking.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\RestrictFlashScriptAccess' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractChooseOptimization' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractConstantFolding' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractNormalization' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\RestrictFlashScriptAccess' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateChecks/RestrictFlashScriptAccess.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractChooseOptimization' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/AbstractChooseOptimization.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractConstantFolding' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/AbstractConstantFolding.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractNormalization' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/AbstractNormalization.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\ConvertCurlyExpressionsInText' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/ConvertCurlyExpressionsInText.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\Custom' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/Custom.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\EnforceHTMLOmittedEndTags' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FixUnescapedCurlyBracesInHtmlAttributes' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FoldArithmeticConstants' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FoldConstantXPathExpressions' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineAttributes' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineCDATA' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineElements' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineInferredValues' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineTextElements' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineXPathLiterals' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\DeoptimizeIf' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/DeoptimizeIf.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\EnforceHTMLOmittedEndTags' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/EnforceHTMLOmittedEndTags.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FixUnescapedCurlyBracesInHtmlAttributes' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/FixUnescapedCurlyBracesInHtmlAttributes.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FoldArithmeticConstants' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/FoldArithmeticConstants.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FoldConstantXPathExpressions' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/FoldConstantXPathExpressions.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineAttributes' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineAttributes.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineCDATA' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineCDATA.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineElements' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineElements.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineInferredValues' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineInferredValues.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineTextElements' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineTextElements.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineXPathLiterals' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineXPathLiterals.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MergeConsecutiveCopyOf' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/MergeConsecutiveCopyOf.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MergeIdenticalConditionalBranches' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/MergeIdenticalConditionalBranches.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MinifyInlineCSS' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MinifyXPathExpressions' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeAttributeNames' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeElementNames' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeUrls' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeChoose' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeChooseText' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeConditionalAttributes' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeConditionalValueOf' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MinifyInlineCSS' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/MinifyInlineCSS.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MinifyXPathExpressions' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/MinifyXPathExpressions.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeAttributeNames' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/NormalizeAttributeNames.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeElementNames' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/NormalizeElementNames.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeUrls' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/NormalizeUrls.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeChoose' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeChoose.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeChooseDeadBranches' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeChooseDeadBranches.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeChooseText' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeChooseText.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeConditionalAttributes' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeConditionalAttributes.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeConditionalValueOf' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeConditionalValueOf.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeNestedConditionals' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeNestedConditionals.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\PreserveSingleSpaces' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveComments' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveInterElementWhitespace' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveLivePreviewAttributes' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\SetRelNoreferrerOnTargetedLinks' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\PreserveSingleSpaces' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/PreserveSingleSpaces.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveComments' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/RemoveComments.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveInterElementWhitespace' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/RemoveInterElementWhitespace.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveLivePreviewAttributes' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/RemoveLivePreviewAttributes.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RenameLivePreviewEvent' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/RenameLivePreviewEvent.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\SetRelNoreferrerOnTargetedLinks' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/SetRelNoreferrerOnTargetedLinks.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\SortAttributesByName' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/SortAttributesByName.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\TransposeComments' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/TransposeComments.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\UninlineAttributes' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizer' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Traits\\CollectionProxy' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Traits\\Configurable' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Traits\\TemplateSafeness' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\UrlConfig' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Validators\\AttributeName' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Validators\\TagName' => $vendorDir . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\UninlineAttributes' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/UninlineAttributes.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizer' => $vendorDir . '/s9e/text-formatter/src/Configurator/TemplateNormalizer.php', + 's9e\\TextFormatter\\Configurator\\Traits\\CollectionProxy' => $vendorDir . '/s9e/text-formatter/src/Configurator/Traits/CollectionProxy.php', + 's9e\\TextFormatter\\Configurator\\Traits\\Configurable' => $vendorDir . '/s9e/text-formatter/src/Configurator/Traits/Configurable.php', + 's9e\\TextFormatter\\Configurator\\Traits\\TemplateSafeness' => $vendorDir . '/s9e/text-formatter/src/Configurator/Traits/TemplateSafeness.php', + 's9e\\TextFormatter\\Configurator\\UrlConfig' => $vendorDir . '/s9e/text-formatter/src/Configurator/UrlConfig.php', + 's9e\\TextFormatter\\Configurator\\Validators\\AttributeName' => $vendorDir . '/s9e/text-formatter/src/Configurator/Validators/AttributeName.php', + 's9e\\TextFormatter\\Configurator\\Validators\\TagName' => $vendorDir . '/s9e/text-formatter/src/Configurator/Validators/TagName.php', 's9e\\TextFormatter\\Configurator\\Validators\\TemplateParameterName' => $vendorDir . '/s9e/text-formatter/src/Configurator/Validators/TemplateParameterName.php', 's9e\\TextFormatter\\Parser' => $vendorDir . '/s9e/text-formatter/src/Parser.php', 's9e\\TextFormatter\\Parser\\AttributeFilters\\EmailFilter' => $vendorDir . '/s9e/text-formatter/src/Parser/AttributeFilters/EmailFilter.php', @@ -1834,6 +1853,7 @@ return array( 's9e\\TextFormatter\\Plugins\\Litedown\\Parser' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\LinkAttributesSetter' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/LinkAttributesSetter.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\ParsedText' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/ParsedText.php', + 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\AbstractInlineMarkup' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/AbstractInlineMarkup.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\AbstractPass' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/AbstractPass.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\AbstractScript' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/AbstractScript.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\Blocks' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/Blocks.php', @@ -1841,6 +1861,7 @@ return array( 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\ForcedLineBreaks' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/ForcedLineBreaks.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\Images' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/Images.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\InlineCode' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/InlineCode.php', + 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\InlineSpoiler' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/InlineSpoiler.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\LinkReferences' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/LinkReferences.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\Links' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/Links.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\Strikethrough' => $vendorDir . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/Strikethrough.php', diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index febd533..a865bcf 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -8,9 +8,10 @@ $baseDir = dirname($vendorDir); return array( '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', - 'e40631d46120a9c38ea139981f8dab26' => $vendorDir . '/ircmaxell/password-compat/lib/password.php', - 'edc6464955a37aa4d5fbf39d40fb6ee7' => $vendorDir . '/symfony/polyfill-php55/bootstrap.php', - '3e2471375464aac821502deb0ac64275' => $vendorDir . '/symfony/polyfill-php54/bootstrap.php', - 'ad155f8f1cf0d418fe49e248db8c661b' => $vendorDir . '/react/promise/src/functions_include.php', - '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', + '023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php', + 'bd9634f2d41831496de0d3dfe4c94881' => $vendorDir . '/symfony/polyfill-php56/bootstrap.php', + '7b11c4dc42b3b3023073cb14e519683c' => $vendorDir . '/ralouphie/getallheaders/src/getallheaders.php', + 'a0edc8309cc5e1d60e3047b5df6b7052' => $vendorDir . '/guzzlehttp/psr7/src/functions_include.php', + 'c964ee0ededf28c96ebd9db5099ef910' => $vendorDir . '/guzzlehttp/promises/src/functions_include.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => $vendorDir . '/guzzlehttp/guzzle/src/functions_include.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 1801ab0..72dc9cb 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -7,17 +7,19 @@ $baseDir = dirname($vendorDir); return array( 's9e\\TextFormatter\\' => array($vendorDir . '/s9e/text-formatter/src'), + 's9e\\RegexpBuilder\\' => array($vendorDir . '/s9e/regexp-builder/src'), 'bantu\\IniGetWrapper\\' => array($vendorDir . '/bantu/ini-get-wrapper/src'), - 'Zend\\Stdlib\\' => array($vendorDir . '/zendframework/zend-stdlib/src'), 'Zend\\EventManager\\' => array($vendorDir . '/zendframework/zend-eventmanager/src'), 'Zend\\Code\\' => array($vendorDir . '/zendframework/zend-code/src'), 'Twig\\' => array($vendorDir . '/twig/twig/src'), - 'Symfony\\Polyfill\\Php55\\' => array($vendorDir . '/symfony/polyfill-php55'), - 'Symfony\\Polyfill\\Php54\\' => array($vendorDir . '/symfony/polyfill-php54'), + 'Symfony\\Polyfill\\Util\\' => array($vendorDir . '/symfony/polyfill-util'), + 'Symfony\\Polyfill\\Php70\\' => array($vendorDir . '/symfony/polyfill-php70'), + 'Symfony\\Polyfill\\Php56\\' => array($vendorDir . '/symfony/polyfill-php56'), 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), 'Symfony\\Component\\Yaml\\' => array($vendorDir . '/symfony/yaml'), 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), + 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'), 'Symfony\\Component\\HttpKernel\\' => array($vendorDir . '/symfony/http-kernel'), 'Symfony\\Component\\HttpFoundation\\' => array($vendorDir . '/symfony/http-foundation'), 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'), @@ -29,12 +31,14 @@ return array( 'Symfony\\Component\\Config\\' => array($vendorDir . '/symfony/config'), 'Symfony\\Bridge\\Twig\\' => array($vendorDir . '/symfony/twig-bridge'), 'Symfony\\Bridge\\ProxyManager\\' => array($vendorDir . '/symfony/proxy-manager-bridge'), - 'React\\Promise\\' => array($vendorDir . '/react/promise/src'), 'ReCaptcha\\' => array($vendorDir . '/google/recaptcha/src/ReCaptcha'), 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), + 'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-message/src'), + 'Psr\\Container\\' => array($vendorDir . '/psr/container/src'), 'Patchwork\\' => array($vendorDir . '/patchwork/utf8/src/Patchwork'), - 'GuzzleHttp\\Stream\\' => array($vendorDir . '/guzzlehttp/streams/src'), - 'GuzzleHttp\\Ring\\' => array($vendorDir . '/guzzlehttp/ringphp/src'), + 'PackageVersions\\' => array($vendorDir . '/ocramius/package-versions/src/PackageVersions'), + 'GuzzleHttp\\Psr7\\' => array($vendorDir . '/guzzlehttp/psr7/src'), + 'GuzzleHttp\\Promise\\' => array($vendorDir . '/guzzlehttp/promises/src'), 'GuzzleHttp\\' => array($vendorDir . '/guzzlehttp/guzzle/src'), 'FastImageSize\\tests\\' => array($vendorDir . '/marc1706/fast-image-size/tests'), 'FastImageSize\\' => array($vendorDir . '/marc1706/fast-image-size/lib'), diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 34a73aa..3b8071c 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit55438ae291a1dfe4cf962a21b03284ed +class ComposerAutoloaderInit5ba2d544c5d0bf61b3c77aaea4d92d6b { private static $loader; @@ -19,15 +19,15 @@ class ComposerAutoloaderInit55438ae291a1dfe4cf962a21b03284ed return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit55438ae291a1dfe4cf962a21b03284ed', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit5ba2d544c5d0bf61b3c77aaea4d92d6b', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit55438ae291a1dfe4cf962a21b03284ed', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit5ba2d544c5d0bf61b3c77aaea4d92d6b', 'loadClassLoader')); $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit5ba2d544c5d0bf61b3c77aaea4d92d6b::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -48,19 +48,19 @@ class ComposerAutoloaderInit55438ae291a1dfe4cf962a21b03284ed $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit5ba2d544c5d0bf61b3c77aaea4d92d6b::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire55438ae291a1dfe4cf962a21b03284ed($fileIdentifier, $file); + composerRequire5ba2d544c5d0bf61b3c77aaea4d92d6b($fileIdentifier, $file); } return $loader; } } -function composerRequire55438ae291a1dfe4cf962a21b03284ed($fileIdentifier, $file) +function composerRequire5ba2d544c5d0bf61b3c77aaea4d92d6b($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 79e8b52..0da03a4 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,22 +4,24 @@ namespace Composer\Autoload; -class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed +class ComposerStaticInit5ba2d544c5d0bf61b3c77aaea4d92d6b { public static $files = array ( '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', - 'e40631d46120a9c38ea139981f8dab26' => __DIR__ . '/..' . '/ircmaxell/password-compat/lib/password.php', - 'edc6464955a37aa4d5fbf39d40fb6ee7' => __DIR__ . '/..' . '/symfony/polyfill-php55/bootstrap.php', - '3e2471375464aac821502deb0ac64275' => __DIR__ . '/..' . '/symfony/polyfill-php54/bootstrap.php', - 'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php', - '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', + '023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php', + 'bd9634f2d41831496de0d3dfe4c94881' => __DIR__ . '/..' . '/symfony/polyfill-php56/bootstrap.php', + '7b11c4dc42b3b3023073cb14e519683c' => __DIR__ . '/..' . '/ralouphie/getallheaders/src/getallheaders.php', + 'a0edc8309cc5e1d60e3047b5df6b7052' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/functions_include.php', + 'c964ee0ededf28c96ebd9db5099ef910' => __DIR__ . '/..' . '/guzzlehttp/promises/src/functions_include.php', + '37a3dc5111fe8f707ab4c132ef1dbc62' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/functions_include.php', ); public static $prefixLengthsPsr4 = array ( 's' => array ( 's9e\\TextFormatter\\' => 18, + 's9e\\RegexpBuilder\\' => 18, ), 'b' => array ( @@ -27,7 +29,6 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed ), 'Z' => array ( - 'Zend\\Stdlib\\' => 12, 'Zend\\EventManager\\' => 18, 'Zend\\Code\\' => 10, ), @@ -37,12 +38,14 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed ), 'S' => array ( - 'Symfony\\Polyfill\\Php55\\' => 23, - 'Symfony\\Polyfill\\Php54\\' => 23, + 'Symfony\\Polyfill\\Util\\' => 22, + 'Symfony\\Polyfill\\Php70\\' => 23, + 'Symfony\\Polyfill\\Php56\\' => 23, 'Symfony\\Polyfill\\Mbstring\\' => 26, 'Symfony\\Polyfill\\Ctype\\' => 23, 'Symfony\\Component\\Yaml\\' => 23, 'Symfony\\Component\\Routing\\' => 26, + 'Symfony\\Component\\Process\\' => 26, 'Symfony\\Component\\HttpKernel\\' => 29, 'Symfony\\Component\\HttpFoundation\\' => 33, 'Symfony\\Component\\Finder\\' => 25, @@ -57,18 +60,20 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed ), 'R' => array ( - 'React\\Promise\\' => 14, 'ReCaptcha\\' => 10, ), 'P' => array ( 'Psr\\Log\\' => 8, + 'Psr\\Http\\Message\\' => 17, + 'Psr\\Container\\' => 14, 'Patchwork\\' => 10, + 'PackageVersions\\' => 16, ), 'G' => array ( - 'GuzzleHttp\\Stream\\' => 18, - 'GuzzleHttp\\Ring\\' => 16, + 'GuzzleHttp\\Psr7\\' => 16, + 'GuzzleHttp\\Promise\\' => 19, 'GuzzleHttp\\' => 11, ), 'F' => @@ -83,14 +88,14 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed array ( 0 => __DIR__ . '/..' . '/s9e/text-formatter/src', ), + 's9e\\RegexpBuilder\\' => + array ( + 0 => __DIR__ . '/..' . '/s9e/regexp-builder/src', + ), 'bantu\\IniGetWrapper\\' => array ( 0 => __DIR__ . '/..' . '/bantu/ini-get-wrapper/src', ), - 'Zend\\Stdlib\\' => - array ( - 0 => __DIR__ . '/..' . '/zendframework/zend-stdlib/src', - ), 'Zend\\EventManager\\' => array ( 0 => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src', @@ -103,13 +108,17 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed array ( 0 => __DIR__ . '/..' . '/twig/twig/src', ), - 'Symfony\\Polyfill\\Php55\\' => + 'Symfony\\Polyfill\\Util\\' => array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-php55', + 0 => __DIR__ . '/..' . '/symfony/polyfill-util', ), - 'Symfony\\Polyfill\\Php54\\' => + 'Symfony\\Polyfill\\Php70\\' => array ( - 0 => __DIR__ . '/..' . '/symfony/polyfill-php54', + 0 => __DIR__ . '/..' . '/symfony/polyfill-php70', + ), + 'Symfony\\Polyfill\\Php56\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-php56', ), 'Symfony\\Polyfill\\Mbstring\\' => array ( @@ -127,6 +136,10 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed array ( 0 => __DIR__ . '/..' . '/symfony/routing', ), + 'Symfony\\Component\\Process\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/process', + ), 'Symfony\\Component\\HttpKernel\\' => array ( 0 => __DIR__ . '/..' . '/symfony/http-kernel', @@ -171,10 +184,6 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed array ( 0 => __DIR__ . '/..' . '/symfony/proxy-manager-bridge', ), - 'React\\Promise\\' => - array ( - 0 => __DIR__ . '/..' . '/react/promise/src', - ), 'ReCaptcha\\' => array ( 0 => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha', @@ -183,17 +192,29 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed array ( 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', ), + 'Psr\\Http\\Message\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/http-message/src', + ), + 'Psr\\Container\\' => + array ( + 0 => __DIR__ . '/..' . '/psr/container/src', + ), 'Patchwork\\' => array ( 0 => __DIR__ . '/..' . '/patchwork/utf8/src/Patchwork', ), - 'GuzzleHttp\\Stream\\' => + 'PackageVersions\\' => array ( - 0 => __DIR__ . '/..' . '/guzzlehttp/streams/src', + 0 => __DIR__ . '/..' . '/ocramius/package-versions/src/PackageVersions', ), - 'GuzzleHttp\\Ring\\' => + 'GuzzleHttp\\Psr7\\' => array ( - 0 => __DIR__ . '/..' . '/guzzlehttp/ringphp/src', + 0 => __DIR__ . '/..' . '/guzzlehttp/psr7/src', + ), + 'GuzzleHttp\\Promise\\' => + array ( + 0 => __DIR__ . '/..' . '/guzzlehttp/promises/src', ), 'GuzzleHttp\\' => array ( @@ -238,7 +259,10 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed ); public static $classMap = array ( - 'CallbackFilterIterator' => __DIR__ . '/..' . '/symfony/polyfill-php54/Resources/stubs/CallbackFilterIterator.php', + 'ArithmeticError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ArithmeticError.php', + 'AssertionError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/AssertionError.php', + 'DivisionByZeroError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/DivisionByZeroError.php', + 'Error' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/Error.php', 'FastImageSize\\FastImageSize' => __DIR__ . '/..' . '/marc1706/fast-image-size/lib/FastImageSize.php', 'FastImageSize\\Type\\TypeBase' => __DIR__ . '/..' . '/marc1706/fast-image-size/lib/Type/TypeBase.php', 'FastImageSize\\Type\\TypeBmp' => __DIR__ . '/..' . '/marc1706/fast-image-size/lib/Type/TypeBmp.php', @@ -253,117 +277,76 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'FastImageSize\\Type\\TypeTif' => __DIR__ . '/..' . '/marc1706/fast-image-size/lib/Type/TypeTif.php', 'FastImageSize\\Type\\TypeWbmp' => __DIR__ . '/..' . '/marc1706/fast-image-size/lib/Type/TypeWbmp.php', 'FastImageSize\\Type\\TypeWebp' => __DIR__ . '/..' . '/marc1706/fast-image-size/lib/Type/TypeWebp.php', - 'GuzzleHttp\\BatchResults' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/BatchResults.php', 'GuzzleHttp\\Client' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Client.php', 'GuzzleHttp\\ClientInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/ClientInterface.php', - 'GuzzleHttp\\Collection' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Collection.php', 'GuzzleHttp\\Cookie\\CookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/CookieJar.php', 'GuzzleHttp\\Cookie\\CookieJarInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php', 'GuzzleHttp\\Cookie\\FileCookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/FileCookieJar.php', 'GuzzleHttp\\Cookie\\SessionCookieJar' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php', 'GuzzleHttp\\Cookie\\SetCookie' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Cookie/SetCookie.php', - 'GuzzleHttp\\Event\\AbstractEvent' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/AbstractEvent.php', - 'GuzzleHttp\\Event\\AbstractRequestEvent' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/AbstractRequestEvent.php', - 'GuzzleHttp\\Event\\AbstractRetryableEvent' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/AbstractRetryableEvent.php', - 'GuzzleHttp\\Event\\AbstractTransferEvent' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/AbstractTransferEvent.php', - 'GuzzleHttp\\Event\\BeforeEvent' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/BeforeEvent.php', - 'GuzzleHttp\\Event\\CompleteEvent' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/CompleteEvent.php', - 'GuzzleHttp\\Event\\Emitter' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/Emitter.php', - 'GuzzleHttp\\Event\\EmitterInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/EmitterInterface.php', - 'GuzzleHttp\\Event\\EndEvent' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/EndEvent.php', - 'GuzzleHttp\\Event\\ErrorEvent' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/ErrorEvent.php', - 'GuzzleHttp\\Event\\EventInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/EventInterface.php', - 'GuzzleHttp\\Event\\HasEmitterInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/HasEmitterInterface.php', - 'GuzzleHttp\\Event\\HasEmitterTrait' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/HasEmitterTrait.php', - 'GuzzleHttp\\Event\\ListenerAttacherTrait' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/ListenerAttacherTrait.php', - 'GuzzleHttp\\Event\\ProgressEvent' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/ProgressEvent.php', - 'GuzzleHttp\\Event\\RequestEvents' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/RequestEvents.php', - 'GuzzleHttp\\Event\\SubscriberInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Event/SubscriberInterface.php', 'GuzzleHttp\\Exception\\BadResponseException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/BadResponseException.php', 'GuzzleHttp\\Exception\\ClientException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ClientException.php', 'GuzzleHttp\\Exception\\ConnectException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ConnectException.php', - 'GuzzleHttp\\Exception\\CouldNotRewindStreamException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/CouldNotRewindStreamException.php', - 'GuzzleHttp\\Exception\\ParseException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ParseException.php', + 'GuzzleHttp\\Exception\\GuzzleException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/GuzzleException.php', + 'GuzzleHttp\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/InvalidArgumentException.php', 'GuzzleHttp\\Exception\\RequestException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/RequestException.php', + 'GuzzleHttp\\Exception\\SeekException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/SeekException.php', 'GuzzleHttp\\Exception\\ServerException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/ServerException.php', - 'GuzzleHttp\\Exception\\StateException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/StateException.php', 'GuzzleHttp\\Exception\\TooManyRedirectsException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php', 'GuzzleHttp\\Exception\\TransferException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/TransferException.php', - 'GuzzleHttp\\Exception\\XmlParseException' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Exception/XmlParseException.php', - 'GuzzleHttp\\HasDataTrait' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/HasDataTrait.php', - 'GuzzleHttp\\Message\\AbstractMessage' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/AbstractMessage.php', - 'GuzzleHttp\\Message\\AppliesHeadersInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/AppliesHeadersInterface.php', - 'GuzzleHttp\\Message\\FutureResponse' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/FutureResponse.php', - 'GuzzleHttp\\Message\\MessageFactory' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/MessageFactory.php', - 'GuzzleHttp\\Message\\MessageFactoryInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/MessageFactoryInterface.php', - 'GuzzleHttp\\Message\\MessageInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/MessageInterface.php', - 'GuzzleHttp\\Message\\MessageParser' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/MessageParser.php', - 'GuzzleHttp\\Message\\Request' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/Request.php', - 'GuzzleHttp\\Message\\RequestInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/RequestInterface.php', - 'GuzzleHttp\\Message\\Response' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/Response.php', - 'GuzzleHttp\\Message\\ResponseInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Message/ResponseInterface.php', - 'GuzzleHttp\\Mimetypes' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Mimetypes.php', + 'GuzzleHttp\\HandlerStack' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/HandlerStack.php', + 'GuzzleHttp\\Handler\\CurlFactory' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlFactory.php', + 'GuzzleHttp\\Handler\\CurlFactoryInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php', + 'GuzzleHttp\\Handler\\CurlHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlHandler.php', + 'GuzzleHttp\\Handler\\CurlMultiHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php', + 'GuzzleHttp\\Handler\\EasyHandle' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/EasyHandle.php', + 'GuzzleHttp\\Handler\\MockHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/MockHandler.php', + 'GuzzleHttp\\Handler\\Proxy' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/Proxy.php', + 'GuzzleHttp\\Handler\\StreamHandler' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Handler/StreamHandler.php', + 'GuzzleHttp\\MessageFormatter' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/MessageFormatter.php', + 'GuzzleHttp\\Middleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Middleware.php', 'GuzzleHttp\\Pool' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Pool.php', - 'GuzzleHttp\\Post\\MultipartBody' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Post/MultipartBody.php', - 'GuzzleHttp\\Post\\PostBody' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Post/PostBody.php', - 'GuzzleHttp\\Post\\PostBodyInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Post/PostBodyInterface.php', - 'GuzzleHttp\\Post\\PostFile' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Post/PostFile.php', - 'GuzzleHttp\\Post\\PostFileInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Post/PostFileInterface.php', - 'GuzzleHttp\\Query' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Query.php', - 'GuzzleHttp\\QueryParser' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/QueryParser.php', - 'GuzzleHttp\\RequestFsm' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RequestFsm.php', - 'GuzzleHttp\\RingBridge' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RingBridge.php', - 'GuzzleHttp\\Ring\\Client\\ClientUtils' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Client/ClientUtils.php', - 'GuzzleHttp\\Ring\\Client\\CurlFactory' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Client/CurlFactory.php', - 'GuzzleHttp\\Ring\\Client\\CurlHandler' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Client/CurlHandler.php', - 'GuzzleHttp\\Ring\\Client\\CurlMultiHandler' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Client/CurlMultiHandler.php', - 'GuzzleHttp\\Ring\\Client\\Middleware' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Client/Middleware.php', - 'GuzzleHttp\\Ring\\Client\\MockHandler' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Client/MockHandler.php', - 'GuzzleHttp\\Ring\\Client\\StreamHandler' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Client/StreamHandler.php', - 'GuzzleHttp\\Ring\\Core' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Core.php', - 'GuzzleHttp\\Ring\\Exception\\CancelledException' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Exception/CancelledException.php', - 'GuzzleHttp\\Ring\\Exception\\CancelledFutureAccessException' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Exception/CancelledFutureAccessException.php', - 'GuzzleHttp\\Ring\\Exception\\ConnectException' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Exception/ConnectException.php', - 'GuzzleHttp\\Ring\\Exception\\RingException' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Exception/RingException.php', - 'GuzzleHttp\\Ring\\Future\\BaseFutureTrait' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Future/BaseFutureTrait.php', - 'GuzzleHttp\\Ring\\Future\\CompletedFutureArray' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Future/CompletedFutureArray.php', - 'GuzzleHttp\\Ring\\Future\\CompletedFutureValue' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Future/CompletedFutureValue.php', - 'GuzzleHttp\\Ring\\Future\\FutureArray' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Future/FutureArray.php', - 'GuzzleHttp\\Ring\\Future\\FutureArrayInterface' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Future/FutureArrayInterface.php', - 'GuzzleHttp\\Ring\\Future\\FutureInterface' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Future/FutureInterface.php', - 'GuzzleHttp\\Ring\\Future\\FutureValue' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Future/FutureValue.php', - 'GuzzleHttp\\Ring\\Future\\MagicFutureTrait' => __DIR__ . '/..' . '/guzzlehttp/ringphp/src/Future/MagicFutureTrait.php', - 'GuzzleHttp\\Stream\\AppendStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/AppendStream.php', - 'GuzzleHttp\\Stream\\AsyncReadStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/AsyncReadStream.php', - 'GuzzleHttp\\Stream\\BufferStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/BufferStream.php', - 'GuzzleHttp\\Stream\\CachingStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/CachingStream.php', - 'GuzzleHttp\\Stream\\DroppingStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/DroppingStream.php', - 'GuzzleHttp\\Stream\\Exception\\CannotAttachException' => __DIR__ . '/..' . '/guzzlehttp/streams/src/Exception/CannotAttachException.php', - 'GuzzleHttp\\Stream\\Exception\\SeekException' => __DIR__ . '/..' . '/guzzlehttp/streams/src/Exception/SeekException.php', - 'GuzzleHttp\\Stream\\FnStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/FnStream.php', - 'GuzzleHttp\\Stream\\GuzzleStreamWrapper' => __DIR__ . '/..' . '/guzzlehttp/streams/src/GuzzleStreamWrapper.php', - 'GuzzleHttp\\Stream\\InflateStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/InflateStream.php', - 'GuzzleHttp\\Stream\\LazyOpenStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/LazyOpenStream.php', - 'GuzzleHttp\\Stream\\LimitStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/LimitStream.php', - 'GuzzleHttp\\Stream\\MetadataStreamInterface' => __DIR__ . '/..' . '/guzzlehttp/streams/src/MetadataStreamInterface.php', - 'GuzzleHttp\\Stream\\NoSeekStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/NoSeekStream.php', - 'GuzzleHttp\\Stream\\NullStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/NullStream.php', - 'GuzzleHttp\\Stream\\PumpStream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/PumpStream.php', - 'GuzzleHttp\\Stream\\Stream' => __DIR__ . '/..' . '/guzzlehttp/streams/src/Stream.php', - 'GuzzleHttp\\Stream\\StreamDecoratorTrait' => __DIR__ . '/..' . '/guzzlehttp/streams/src/StreamDecoratorTrait.php', - 'GuzzleHttp\\Stream\\StreamInterface' => __DIR__ . '/..' . '/guzzlehttp/streams/src/StreamInterface.php', - 'GuzzleHttp\\Stream\\Utils' => __DIR__ . '/..' . '/guzzlehttp/streams/src/Utils.php', - 'GuzzleHttp\\Subscriber\\Cookie' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Subscriber/Cookie.php', - 'GuzzleHttp\\Subscriber\\History' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Subscriber/History.php', - 'GuzzleHttp\\Subscriber\\HttpError' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Subscriber/HttpError.php', - 'GuzzleHttp\\Subscriber\\Mock' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Subscriber/Mock.php', - 'GuzzleHttp\\Subscriber\\Prepare' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Subscriber/Prepare.php', - 'GuzzleHttp\\Subscriber\\Redirect' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Subscriber/Redirect.php', - 'GuzzleHttp\\ToArrayInterface' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/ToArrayInterface.php', - 'GuzzleHttp\\Transaction' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Transaction.php', + 'GuzzleHttp\\PrepareBodyMiddleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php', + 'GuzzleHttp\\Promise\\AggregateException' => __DIR__ . '/..' . '/guzzlehttp/promises/src/AggregateException.php', + 'GuzzleHttp\\Promise\\CancellationException' => __DIR__ . '/..' . '/guzzlehttp/promises/src/CancellationException.php', + 'GuzzleHttp\\Promise\\Coroutine' => __DIR__ . '/..' . '/guzzlehttp/promises/src/Coroutine.php', + 'GuzzleHttp\\Promise\\EachPromise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/EachPromise.php', + 'GuzzleHttp\\Promise\\FulfilledPromise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/FulfilledPromise.php', + 'GuzzleHttp\\Promise\\Promise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/Promise.php', + 'GuzzleHttp\\Promise\\PromiseInterface' => __DIR__ . '/..' . '/guzzlehttp/promises/src/PromiseInterface.php', + 'GuzzleHttp\\Promise\\PromisorInterface' => __DIR__ . '/..' . '/guzzlehttp/promises/src/PromisorInterface.php', + 'GuzzleHttp\\Promise\\RejectedPromise' => __DIR__ . '/..' . '/guzzlehttp/promises/src/RejectedPromise.php', + 'GuzzleHttp\\Promise\\RejectionException' => __DIR__ . '/..' . '/guzzlehttp/promises/src/RejectionException.php', + 'GuzzleHttp\\Promise\\TaskQueue' => __DIR__ . '/..' . '/guzzlehttp/promises/src/TaskQueue.php', + 'GuzzleHttp\\Promise\\TaskQueueInterface' => __DIR__ . '/..' . '/guzzlehttp/promises/src/TaskQueueInterface.php', + 'GuzzleHttp\\Psr7\\AppendStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/AppendStream.php', + 'GuzzleHttp\\Psr7\\BufferStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/BufferStream.php', + 'GuzzleHttp\\Psr7\\CachingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/CachingStream.php', + 'GuzzleHttp\\Psr7\\DroppingStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/DroppingStream.php', + 'GuzzleHttp\\Psr7\\FnStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/FnStream.php', + 'GuzzleHttp\\Psr7\\InflateStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/InflateStream.php', + 'GuzzleHttp\\Psr7\\LazyOpenStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LazyOpenStream.php', + 'GuzzleHttp\\Psr7\\LimitStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/LimitStream.php', + 'GuzzleHttp\\Psr7\\MessageTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MessageTrait.php', + 'GuzzleHttp\\Psr7\\MultipartStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/MultipartStream.php', + 'GuzzleHttp\\Psr7\\NoSeekStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/NoSeekStream.php', + 'GuzzleHttp\\Psr7\\PumpStream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/PumpStream.php', + 'GuzzleHttp\\Psr7\\Request' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Request.php', + 'GuzzleHttp\\Psr7\\Response' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Response.php', + 'GuzzleHttp\\Psr7\\Rfc7230' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Rfc7230.php', + 'GuzzleHttp\\Psr7\\ServerRequest' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/ServerRequest.php', + 'GuzzleHttp\\Psr7\\Stream' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Stream.php', + 'GuzzleHttp\\Psr7\\StreamDecoratorTrait' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamDecoratorTrait.php', + 'GuzzleHttp\\Psr7\\StreamWrapper' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/StreamWrapper.php', + 'GuzzleHttp\\Psr7\\UploadedFile' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UploadedFile.php', + 'GuzzleHttp\\Psr7\\Uri' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/Uri.php', + 'GuzzleHttp\\Psr7\\UriNormalizer' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriNormalizer.php', + 'GuzzleHttp\\Psr7\\UriResolver' => __DIR__ . '/..' . '/guzzlehttp/psr7/src/UriResolver.php', + 'GuzzleHttp\\RedirectMiddleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RedirectMiddleware.php', + 'GuzzleHttp\\RequestOptions' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RequestOptions.php', + 'GuzzleHttp\\RetryMiddleware' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/RetryMiddleware.php', + 'GuzzleHttp\\TransferStats' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/TransferStats.php', 'GuzzleHttp\\UriTemplate' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/UriTemplate.php', - 'GuzzleHttp\\Url' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Url.php', - 'GuzzleHttp\\Utils' => __DIR__ . '/..' . '/guzzlehttp/guzzle/src/Utils.php', 'Normalizer' => __DIR__ . '/..' . '/patchwork/utf8/src/Normalizer.php', 'OAuth\\Common\\AutoLoader' => __DIR__ . '/..' . '/lusitanian/oauth/src/OAuth/Common/AutoLoader.php', 'OAuth\\Common\\Consumer\\Credentials' => __DIR__ . '/..' . '/lusitanian/oauth/src/OAuth/Common/Consumer/Credentials.php', @@ -461,6 +444,10 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'OAuth\\OAuth2\\Token\\StdOAuth2Token' => __DIR__ . '/..' . '/lusitanian/oauth/src/OAuth/OAuth2/Token/StdOAuth2Token.php', 'OAuth\\OAuth2\\Token\\TokenInterface' => __DIR__ . '/..' . '/lusitanian/oauth/src/OAuth/OAuth2/Token/TokenInterface.php', 'OAuth\\ServiceFactory' => __DIR__ . '/..' . '/lusitanian/oauth/src/OAuth/ServiceFactory.php', + 'PackageVersions\\FallbackVersions' => __DIR__ . '/..' . '/ocramius/package-versions/src/PackageVersions/FallbackVersions.php', + 'PackageVersions\\Installer' => __DIR__ . '/..' . '/ocramius/package-versions/src/PackageVersions/Installer.php', + 'PackageVersions\\Versions' => __DIR__ . '/..' . '/ocramius/package-versions/src/PackageVersions/Versions.php', + 'ParseError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/ParseError.php', 'Patchwork\\PHP\\Shim\\Iconv' => __DIR__ . '/..' . '/patchwork/utf8/src/Patchwork/PHP/Shim/Iconv.php', 'Patchwork\\PHP\\Shim\\Intl' => __DIR__ . '/..' . '/patchwork/utf8/src/Patchwork/PHP/Shim/Intl.php', 'Patchwork\\PHP\\Shim\\Mbstring' => __DIR__ . '/..' . '/patchwork/utf8/src/Patchwork/PHP/Shim/Mbstring.php', @@ -481,7 +468,6 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'ProxyManager\\Exception\\InvalidProxyDirectoryException' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Exception/InvalidProxyDirectoryException.php', 'ProxyManager\\Exception\\UnsupportedProxiedClassException' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Exception/UnsupportedProxiedClassException.php', 'ProxyManager\\Factory\\AbstractBaseFactory' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Factory/AbstractBaseFactory.php', - 'ProxyManager\\Factory\\AbstractLazyFactory' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Factory/AbstractLazyFactory.php', 'ProxyManager\\Factory\\AccessInterceptorScopeLocalizerFactory' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorScopeLocalizerFactory.php', 'ProxyManager\\Factory\\AccessInterceptorValueHolderFactory' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorValueHolderFactory.php', 'ProxyManager\\Factory\\LazyLoadingGhostFactory' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Factory/LazyLoadingGhostFactory.php', @@ -502,15 +488,15 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'ProxyManager\\Generator\\ClassGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Generator/ClassGenerator.php', 'ProxyManager\\Generator\\MagicMethodGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Generator/MagicMethodGenerator.php', 'ProxyManager\\Generator\\MethodGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Generator/MethodGenerator.php', - 'ProxyManager\\Generator\\ParameterGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Generator/ParameterGenerator.php', 'ProxyManager\\Generator\\Util\\ClassGeneratorUtils' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ClassGeneratorUtils.php', + 'ProxyManager\\Generator\\Util\\ProxiedMethodReturnExpression' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ProxiedMethodReturnExpression.php', 'ProxyManager\\Generator\\Util\\UniqueIdentifierGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Generator/Util/UniqueIdentifierGenerator.php', 'ProxyManager\\Inflector\\ClassNameInflector' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Inflector/ClassNameInflector.php', 'ProxyManager\\Inflector\\ClassNameInflectorInterface' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Inflector/ClassNameInflectorInterface.php', 'ProxyManager\\Inflector\\Util\\ParameterEncoder' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterEncoder.php', 'ProxyManager\\Inflector\\Util\\ParameterHasher' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterHasher.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizerGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizerGenerator.php', - 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\Constructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Constructor.php', + 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\BindProxyProperties' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/BindProxyProperties.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\InterceptedMethod' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/InterceptedMethod.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\MagicClone' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicClone.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\MagicGet' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicGet.php', @@ -518,15 +504,16 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\MagicSet' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSet.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\MagicSleep' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSleep.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\MagicUnset' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicUnset.php', + 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\StaticProxyConstructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/StaticProxyConstructor.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorScopeLocalizer\\MethodGenerator\\Util\\InterceptorGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGenerator.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolderGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolderGenerator.php', - 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\Constructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Constructor.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\InterceptedMethod' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/InterceptedMethod.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\MagicClone' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicClone.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\MagicGet' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicGet.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\MagicIsset' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicIsset.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\MagicSet' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicSet.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\MagicUnset' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicUnset.php', + 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\StaticProxyConstructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/StaticProxyConstructor.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptorValueHolder\\MethodGenerator\\Util\\InterceptorGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGenerator.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptor\\MethodGenerator\\MagicWakeup' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/MagicWakeup.php', 'ProxyManager\\ProxyGenerator\\AccessInterceptor\\MethodGenerator\\SetMethodPrefixInterceptor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/SetMethodPrefixInterceptor.php', @@ -539,7 +526,6 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\GetProxyInitializer' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/GetProxyInitializer.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\InitializeProxy' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/InitializeProxy.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\IsProxyInitialized' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/IsProxyInitialized.php', - 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\LazyLoadingMethodInterceptor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/LazyLoadingMethodInterceptor.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\MagicClone' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicClone.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\MagicGet' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicGet.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\MagicIsset' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicIsset.php', @@ -549,6 +535,8 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\MethodGenerator\\SetProxyInitializer' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/SetProxyInitializer.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\PropertyGenerator\\InitializationTracker' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializationTracker.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\PropertyGenerator\\InitializerProperty' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializerProperty.php', + 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\PropertyGenerator\\PrivatePropertiesMap' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/PrivatePropertiesMap.php', + 'ProxyManager\\ProxyGenerator\\LazyLoadingGhost\\PropertyGenerator\\ProtectedPropertiesMap' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/ProtectedPropertiesMap.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolderGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolderGenerator.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolder\\MethodGenerator\\GetProxyInitializer' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/GetProxyInitializer.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolder\\MethodGenerator\\InitializeProxy' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/InitializeProxy.php', @@ -563,26 +551,30 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolder\\MethodGenerator\\SetProxyInitializer' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/SetProxyInitializer.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolder\\PropertyGenerator\\InitializerProperty' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/InitializerProperty.php', 'ProxyManager\\ProxyGenerator\\LazyLoadingValueHolder\\PropertyGenerator\\ValueHolderProperty' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/ValueHolderProperty.php', - 'ProxyManager\\ProxyGenerator\\LazyLoading\\MethodGenerator\\Constructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoading/MethodGenerator/Constructor.php', + 'ProxyManager\\ProxyGenerator\\LazyLoading\\MethodGenerator\\StaticProxyConstructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoading/MethodGenerator/StaticProxyConstructor.php', 'ProxyManager\\ProxyGenerator\\NullObjectGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObjectGenerator.php', - 'ProxyManager\\ProxyGenerator\\NullObject\\MethodGenerator\\Constructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/Constructor.php', 'ProxyManager\\ProxyGenerator\\NullObject\\MethodGenerator\\NullObjectMethodInterceptor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/NullObjectMethodInterceptor.php', - 'ProxyManager\\ProxyGenerator\\PropertyGenerator\\PublicPropertiesDefaults' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/PropertyGenerator/PublicPropertiesDefaults.php', + 'ProxyManager\\ProxyGenerator\\NullObject\\MethodGenerator\\StaticProxyConstructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/StaticProxyConstructor.php', 'ProxyManager\\ProxyGenerator\\PropertyGenerator\\PublicPropertiesMap' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/PropertyGenerator/PublicPropertiesMap.php', 'ProxyManager\\ProxyGenerator\\ProxyGeneratorInterface' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ProxyGeneratorInterface.php', 'ProxyManager\\ProxyGenerator\\RemoteObjectGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObjectGenerator.php', - 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\Constructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/Constructor.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\MagicGet' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicGet.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\MagicIsset' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicIsset.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\MagicSet' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicSet.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\MagicUnset' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicUnset.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\RemoteObjectMethod' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/RemoteObjectMethod.php', + 'ProxyManager\\ProxyGenerator\\RemoteObject\\MethodGenerator\\StaticProxyConstructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/StaticProxyConstructor.php', 'ProxyManager\\ProxyGenerator\\RemoteObject\\PropertyGenerator\\AdapterProperty' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/PropertyGenerator/AdapterProperty.php', + 'ProxyManager\\ProxyGenerator\\Util\\GetMethodIfExists' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/GetMethodIfExists.php', + 'ProxyManager\\ProxyGenerator\\Util\\Properties' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/Properties.php', 'ProxyManager\\ProxyGenerator\\Util\\ProxiedMethodsFilter' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/ProxiedMethodsFilter.php', 'ProxyManager\\ProxyGenerator\\Util\\PublicScopeSimulator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/PublicScopeSimulator.php', + 'ProxyManager\\ProxyGenerator\\Util\\UnsetPropertiesGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/UnsetPropertiesGenerator.php', + 'ProxyManager\\ProxyGenerator\\ValueHolder\\MethodGenerator\\Constructor' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/Constructor.php', 'ProxyManager\\ProxyGenerator\\ValueHolder\\MethodGenerator\\GetWrappedValueHolderValue' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/GetWrappedValueHolderValue.php', 'ProxyManager\\ProxyGenerator\\ValueHolder\\MethodGenerator\\MagicSleep' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/MagicSleep.php', 'ProxyManager\\Proxy\\AccessInterceptorInterface' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorInterface.php', + 'ProxyManager\\Proxy\\AccessInterceptorValueHolderInterface' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorValueHolderInterface.php', 'ProxyManager\\Proxy\\Exception\\RemoteObjectException' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Proxy/Exception/RemoteObjectException.php', 'ProxyManager\\Proxy\\FallbackValueHolderInterface' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Proxy/FallbackValueHolderInterface.php', 'ProxyManager\\Proxy\\GhostObjectInterface' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Proxy/GhostObjectInterface.php', @@ -602,7 +594,18 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'ProxyManager\\Signature\\SignatureCheckerInterface' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureCheckerInterface.php', 'ProxyManager\\Signature\\SignatureGenerator' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGenerator.php', 'ProxyManager\\Signature\\SignatureGeneratorInterface' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGeneratorInterface.php', + 'ProxyManager\\Stub\\EmptyClassStub' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Stub/EmptyClassStub.php', 'ProxyManager\\Version' => __DIR__ . '/..' . '/ocramius/proxy-manager/src/ProxyManager/Version.php', + 'Psr\\Container\\ContainerExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerExceptionInterface.php', + 'Psr\\Container\\ContainerInterface' => __DIR__ . '/..' . '/psr/container/src/ContainerInterface.php', + 'Psr\\Container\\NotFoundExceptionInterface' => __DIR__ . '/..' . '/psr/container/src/NotFoundExceptionInterface.php', + 'Psr\\Http\\Message\\MessageInterface' => __DIR__ . '/..' . '/psr/http-message/src/MessageInterface.php', + 'Psr\\Http\\Message\\RequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/RequestInterface.php', + 'Psr\\Http\\Message\\ResponseInterface' => __DIR__ . '/..' . '/psr/http-message/src/ResponseInterface.php', + 'Psr\\Http\\Message\\ServerRequestInterface' => __DIR__ . '/..' . '/psr/http-message/src/ServerRequestInterface.php', + 'Psr\\Http\\Message\\StreamInterface' => __DIR__ . '/..' . '/psr/http-message/src/StreamInterface.php', + 'Psr\\Http\\Message\\UploadedFileInterface' => __DIR__ . '/..' . '/psr/http-message/src/UploadedFileInterface.php', + 'Psr\\Http\\Message\\UriInterface' => __DIR__ . '/..' . '/psr/http-message/src/UriInterface.php', 'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/Psr/Log/AbstractLogger.php', 'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/Psr/Log/InvalidArgumentException.php', 'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/Psr/Log/LogLevel.php', @@ -623,20 +626,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'ReCaptcha\\RequestMethod\\SocketPost' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php', 'ReCaptcha\\RequestParameters' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/RequestParameters.php', 'ReCaptcha\\Response' => __DIR__ . '/..' . '/google/recaptcha/src/ReCaptcha/Response.php', - 'React\\Promise\\CancellablePromiseInterface' => __DIR__ . '/..' . '/react/promise/src/CancellablePromiseInterface.php', - 'React\\Promise\\CancellationQueue' => __DIR__ . '/..' . '/react/promise/src/CancellationQueue.php', - 'React\\Promise\\Deferred' => __DIR__ . '/..' . '/react/promise/src/Deferred.php', - 'React\\Promise\\Exception\\LengthException' => __DIR__ . '/..' . '/react/promise/src/Exception/LengthException.php', - 'React\\Promise\\ExtendedPromiseInterface' => __DIR__ . '/..' . '/react/promise/src/ExtendedPromiseInterface.php', - 'React\\Promise\\FulfilledPromise' => __DIR__ . '/..' . '/react/promise/src/FulfilledPromise.php', - 'React\\Promise\\LazyPromise' => __DIR__ . '/..' . '/react/promise/src/LazyPromise.php', - 'React\\Promise\\Promise' => __DIR__ . '/..' . '/react/promise/src/Promise.php', - 'React\\Promise\\PromiseInterface' => __DIR__ . '/..' . '/react/promise/src/PromiseInterface.php', - 'React\\Promise\\PromisorInterface' => __DIR__ . '/..' . '/react/promise/src/PromisorInterface.php', - 'React\\Promise\\RejectedPromise' => __DIR__ . '/..' . '/react/promise/src/RejectedPromise.php', - 'React\\Promise\\UnhandledRejectionException' => __DIR__ . '/..' . '/react/promise/src/UnhandledRejectionException.php', - 'RecursiveCallbackFilterIterator' => __DIR__ . '/..' . '/symfony/polyfill-php54/Resources/stubs/RecursiveCallbackFilterIterator.php', - 'SessionHandlerInterface' => __DIR__ . '/..' . '/symfony/polyfill-php54/Resources/stubs/SessionHandlerInterface.php', + 'SessionUpdateTimestampHandlerInterface' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/SessionUpdateTimestampHandlerInterface.php', 'Symfony\\Bridge\\ProxyManager\\LazyProxy\\Instantiator\\LazyLoadingValueHolderFactoryV1' => __DIR__ . '/..' . '/symfony/proxy-manager-bridge/LazyProxy/Instantiator/LazyLoadingValueHolderFactoryV1.php', 'Symfony\\Bridge\\ProxyManager\\LazyProxy\\Instantiator\\LazyLoadingValueHolderFactoryV2' => __DIR__ . '/..' . '/symfony/proxy-manager-bridge/LazyProxy/Instantiator/LazyLoadingValueHolderFactoryV2.php', 'Symfony\\Bridge\\ProxyManager\\LazyProxy\\Instantiator\\RuntimeInstantiator' => __DIR__ . '/..' . '/symfony/proxy-manager-bridge/LazyProxy/Instantiator/RuntimeInstantiator.php', @@ -653,12 +643,16 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Bridge\\Twig\\Extension\\FormExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/FormExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\HttpFoundationExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/HttpFoundationExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\HttpKernelExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/HttpKernelExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\HttpKernelRuntime' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/HttpKernelRuntime.php', + 'Symfony\\Bridge\\Twig\\Extension\\InitRuntimeInterface' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/InitRuntimeInterface.php', 'Symfony\\Bridge\\Twig\\Extension\\LogoutUrlExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/LogoutUrlExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\ProfilerExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/ProfilerExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\RoutingExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/RoutingExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\SecurityExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/SecurityExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\StopwatchExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/StopwatchExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\TranslationExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/TranslationExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\WebLinkExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/WebLinkExtension.php', + 'Symfony\\Bridge\\Twig\\Extension\\WorkflowExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/WorkflowExtension.php', 'Symfony\\Bridge\\Twig\\Extension\\YamlExtension' => __DIR__ . '/..' . '/symfony/twig-bridge/Extension/YamlExtension.php', 'Symfony\\Bridge\\Twig\\Form\\TwigRenderer' => __DIR__ . '/..' . '/symfony/twig-bridge/Form/TwigRenderer.php', 'Symfony\\Bridge\\Twig\\Form\\TwigRendererEngine' => __DIR__ . '/..' . '/symfony/twig-bridge/Form/TwigRendererEngine.php', @@ -668,7 +662,6 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Bridge\\Twig\\NodeVisitor\\TranslationDefaultDomainNodeVisitor' => __DIR__ . '/..' . '/symfony/twig-bridge/NodeVisitor/TranslationDefaultDomainNodeVisitor.php', 'Symfony\\Bridge\\Twig\\NodeVisitor\\TranslationNodeVisitor' => __DIR__ . '/..' . '/symfony/twig-bridge/NodeVisitor/TranslationNodeVisitor.php', 'Symfony\\Bridge\\Twig\\Node\\DumpNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/DumpNode.php', - 'Symfony\\Bridge\\Twig\\Node\\FormEnctypeNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/FormEnctypeNode.php', 'Symfony\\Bridge\\Twig\\Node\\FormThemeNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/FormThemeNode.php', 'Symfony\\Bridge\\Twig\\Node\\RenderBlockNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/RenderBlockNode.php', 'Symfony\\Bridge\\Twig\\Node\\SearchAndRenderBlockNode' => __DIR__ . '/..' . '/symfony/twig-bridge/Node/SearchAndRenderBlockNode.php', @@ -683,6 +676,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Bridge\\Twig\\TokenParser\\TransTokenParser' => __DIR__ . '/..' . '/symfony/twig-bridge/TokenParser/TransTokenParser.php', 'Symfony\\Bridge\\Twig\\Translation\\TwigExtractor' => __DIR__ . '/..' . '/symfony/twig-bridge/Translation/TwigExtractor.php', 'Symfony\\Bridge\\Twig\\TwigEngine' => __DIR__ . '/..' . '/symfony/twig-bridge/TwigEngine.php', + 'Symfony\\Bridge\\Twig\\UndefinedCallableHandler' => __DIR__ . '/..' . '/symfony/twig-bridge/UndefinedCallableHandler.php', 'Symfony\\Component\\Config\\ConfigCache' => __DIR__ . '/..' . '/symfony/config/ConfigCache.php', 'Symfony\\Component\\Config\\ConfigCacheFactory' => __DIR__ . '/..' . '/symfony/config/ConfigCacheFactory.php', 'Symfony\\Component\\Config\\ConfigCacheFactoryInterface' => __DIR__ . '/..' . '/symfony/config/ConfigCacheFactoryInterface.php', @@ -725,15 +719,17 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Config\\Definition\\Processor' => __DIR__ . '/..' . '/symfony/config/Definition/Processor.php', 'Symfony\\Component\\Config\\Definition\\PrototypeNodeInterface' => __DIR__ . '/..' . '/symfony/config/Definition/PrototypeNodeInterface.php', 'Symfony\\Component\\Config\\Definition\\PrototypedArrayNode' => __DIR__ . '/..' . '/symfony/config/Definition/PrototypedArrayNode.php', - 'Symfony\\Component\\Config\\Definition\\ReferenceDumper' => __DIR__ . '/..' . '/symfony/config/Definition/ReferenceDumper.php', 'Symfony\\Component\\Config\\Definition\\ScalarNode' => __DIR__ . '/..' . '/symfony/config/Definition/ScalarNode.php', 'Symfony\\Component\\Config\\Definition\\VariableNode' => __DIR__ . '/..' . '/symfony/config/Definition/VariableNode.php', + 'Symfony\\Component\\Config\\DependencyInjection\\ConfigCachePass' => __DIR__ . '/..' . '/symfony/config/DependencyInjection/ConfigCachePass.php', 'Symfony\\Component\\Config\\Exception\\FileLoaderImportCircularReferenceException' => __DIR__ . '/..' . '/symfony/config/Exception/FileLoaderImportCircularReferenceException.php', 'Symfony\\Component\\Config\\Exception\\FileLoaderLoadException' => __DIR__ . '/..' . '/symfony/config/Exception/FileLoaderLoadException.php', + 'Symfony\\Component\\Config\\Exception\\FileLocatorFileNotFoundException' => __DIR__ . '/..' . '/symfony/config/Exception/FileLocatorFileNotFoundException.php', 'Symfony\\Component\\Config\\FileLocator' => __DIR__ . '/..' . '/symfony/config/FileLocator.php', 'Symfony\\Component\\Config\\FileLocatorInterface' => __DIR__ . '/..' . '/symfony/config/FileLocatorInterface.php', 'Symfony\\Component\\Config\\Loader\\DelegatingLoader' => __DIR__ . '/..' . '/symfony/config/Loader/DelegatingLoader.php', 'Symfony\\Component\\Config\\Loader\\FileLoader' => __DIR__ . '/..' . '/symfony/config/Loader/FileLoader.php', + 'Symfony\\Component\\Config\\Loader\\GlobFileLoader' => __DIR__ . '/..' . '/symfony/config/Loader/GlobFileLoader.php', 'Symfony\\Component\\Config\\Loader\\Loader' => __DIR__ . '/..' . '/symfony/config/Loader/Loader.php', 'Symfony\\Component\\Config\\Loader\\LoaderInterface' => __DIR__ . '/..' . '/symfony/config/Loader/LoaderInterface.php', 'Symfony\\Component\\Config\\Loader\\LoaderResolver' => __DIR__ . '/..' . '/symfony/config/Loader/LoaderResolver.php', @@ -741,19 +737,31 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Config\\ResourceCheckerConfigCache' => __DIR__ . '/..' . '/symfony/config/ResourceCheckerConfigCache.php', 'Symfony\\Component\\Config\\ResourceCheckerConfigCacheFactory' => __DIR__ . '/..' . '/symfony/config/ResourceCheckerConfigCacheFactory.php', 'Symfony\\Component\\Config\\ResourceCheckerInterface' => __DIR__ . '/..' . '/symfony/config/ResourceCheckerInterface.php', - 'Symfony\\Component\\Config\\Resource\\BCResourceInterfaceChecker' => __DIR__ . '/..' . '/symfony/config/Resource/BCResourceInterfaceChecker.php', + 'Symfony\\Component\\Config\\Resource\\ClassExistenceResource' => __DIR__ . '/..' . '/symfony/config/Resource/ClassExistenceResource.php', + 'Symfony\\Component\\Config\\Resource\\ComposerResource' => __DIR__ . '/..' . '/symfony/config/Resource/ComposerResource.php', 'Symfony\\Component\\Config\\Resource\\DirectoryResource' => __DIR__ . '/..' . '/symfony/config/Resource/DirectoryResource.php', 'Symfony\\Component\\Config\\Resource\\FileExistenceResource' => __DIR__ . '/..' . '/symfony/config/Resource/FileExistenceResource.php', 'Symfony\\Component\\Config\\Resource\\FileResource' => __DIR__ . '/..' . '/symfony/config/Resource/FileResource.php', + 'Symfony\\Component\\Config\\Resource\\GlobResource' => __DIR__ . '/..' . '/symfony/config/Resource/GlobResource.php', + 'Symfony\\Component\\Config\\Resource\\ReflectionClassResource' => __DIR__ . '/..' . '/symfony/config/Resource/ReflectionClassResource.php', + 'Symfony\\Component\\Config\\Resource\\ReflectionMethodHhvmWrapper' => __DIR__ . '/..' . '/symfony/config/Resource/ReflectionClassResource.php', + 'Symfony\\Component\\Config\\Resource\\ReflectionParameterHhvmWrapper' => __DIR__ . '/..' . '/symfony/config/Resource/ReflectionClassResource.php', 'Symfony\\Component\\Config\\Resource\\ResourceInterface' => __DIR__ . '/..' . '/symfony/config/Resource/ResourceInterface.php', 'Symfony\\Component\\Config\\Resource\\SelfCheckingResourceChecker' => __DIR__ . '/..' . '/symfony/config/Resource/SelfCheckingResourceChecker.php', 'Symfony\\Component\\Config\\Resource\\SelfCheckingResourceInterface' => __DIR__ . '/..' . '/symfony/config/Resource/SelfCheckingResourceInterface.php', + 'Symfony\\Component\\Config\\Util\\Exception\\InvalidXmlException' => __DIR__ . '/..' . '/symfony/config/Util/Exception/InvalidXmlException.php', + 'Symfony\\Component\\Config\\Util\\Exception\\XmlParsingException' => __DIR__ . '/..' . '/symfony/config/Util/Exception/XmlParsingException.php', 'Symfony\\Component\\Config\\Util\\XmlUtils' => __DIR__ . '/..' . '/symfony/config/Util/XmlUtils.php', 'Symfony\\Component\\Console\\Application' => __DIR__ . '/..' . '/symfony/console/Application.php', + 'Symfony\\Component\\Console\\CommandLoader\\CommandLoaderInterface' => __DIR__ . '/..' . '/symfony/console/CommandLoader/CommandLoaderInterface.php', + 'Symfony\\Component\\Console\\CommandLoader\\ContainerCommandLoader' => __DIR__ . '/..' . '/symfony/console/CommandLoader/ContainerCommandLoader.php', + 'Symfony\\Component\\Console\\CommandLoader\\FactoryCommandLoader' => __DIR__ . '/..' . '/symfony/console/CommandLoader/FactoryCommandLoader.php', 'Symfony\\Component\\Console\\Command\\Command' => __DIR__ . '/..' . '/symfony/console/Command/Command.php', 'Symfony\\Component\\Console\\Command\\HelpCommand' => __DIR__ . '/..' . '/symfony/console/Command/HelpCommand.php', 'Symfony\\Component\\Console\\Command\\ListCommand' => __DIR__ . '/..' . '/symfony/console/Command/ListCommand.php', + 'Symfony\\Component\\Console\\Command\\LockableTrait' => __DIR__ . '/..' . '/symfony/console/Command/LockableTrait.php', 'Symfony\\Component\\Console\\ConsoleEvents' => __DIR__ . '/..' . '/symfony/console/ConsoleEvents.php', + 'Symfony\\Component\\Console\\DependencyInjection\\AddConsoleCommandPass' => __DIR__ . '/..' . '/symfony/console/DependencyInjection/AddConsoleCommandPass.php', 'Symfony\\Component\\Console\\Descriptor\\ApplicationDescription' => __DIR__ . '/..' . '/symfony/console/Descriptor/ApplicationDescription.php', 'Symfony\\Component\\Console\\Descriptor\\Descriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/Descriptor.php', 'Symfony\\Component\\Console\\Descriptor\\DescriptorInterface' => __DIR__ . '/..' . '/symfony/console/Descriptor/DescriptorInterface.php', @@ -761,7 +769,9 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Console\\Descriptor\\MarkdownDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/MarkdownDescriptor.php', 'Symfony\\Component\\Console\\Descriptor\\TextDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/TextDescriptor.php', 'Symfony\\Component\\Console\\Descriptor\\XmlDescriptor' => __DIR__ . '/..' . '/symfony/console/Descriptor/XmlDescriptor.php', + 'Symfony\\Component\\Console\\EventListener\\ErrorListener' => __DIR__ . '/..' . '/symfony/console/EventListener/ErrorListener.php', 'Symfony\\Component\\Console\\Event\\ConsoleCommandEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleCommandEvent.php', + 'Symfony\\Component\\Console\\Event\\ConsoleErrorEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleErrorEvent.php', 'Symfony\\Component\\Console\\Event\\ConsoleEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleEvent.php', 'Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleExceptionEvent.php', 'Symfony\\Component\\Console\\Event\\ConsoleTerminateEvent' => __DIR__ . '/..' . '/symfony/console/Event/ConsoleTerminateEvent.php', @@ -778,7 +788,6 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Console\\Formatter\\OutputFormatterStyleStack' => __DIR__ . '/..' . '/symfony/console/Formatter/OutputFormatterStyleStack.php', 'Symfony\\Component\\Console\\Helper\\DebugFormatterHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DebugFormatterHelper.php', 'Symfony\\Component\\Console\\Helper\\DescriptorHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DescriptorHelper.php', - 'Symfony\\Component\\Console\\Helper\\DialogHelper' => __DIR__ . '/..' . '/symfony/console/Helper/DialogHelper.php', 'Symfony\\Component\\Console\\Helper\\FormatterHelper' => __DIR__ . '/..' . '/symfony/console/Helper/FormatterHelper.php', 'Symfony\\Component\\Console\\Helper\\Helper' => __DIR__ . '/..' . '/symfony/console/Helper/Helper.php', 'Symfony\\Component\\Console\\Helper\\HelperInterface' => __DIR__ . '/..' . '/symfony/console/Helper/HelperInterface.php', @@ -786,13 +795,11 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Console\\Helper\\InputAwareHelper' => __DIR__ . '/..' . '/symfony/console/Helper/InputAwareHelper.php', 'Symfony\\Component\\Console\\Helper\\ProcessHelper' => __DIR__ . '/..' . '/symfony/console/Helper/ProcessHelper.php', 'Symfony\\Component\\Console\\Helper\\ProgressBar' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressBar.php', - 'Symfony\\Component\\Console\\Helper\\ProgressHelper' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressHelper.php', 'Symfony\\Component\\Console\\Helper\\ProgressIndicator' => __DIR__ . '/..' . '/symfony/console/Helper/ProgressIndicator.php', 'Symfony\\Component\\Console\\Helper\\QuestionHelper' => __DIR__ . '/..' . '/symfony/console/Helper/QuestionHelper.php', 'Symfony\\Component\\Console\\Helper\\SymfonyQuestionHelper' => __DIR__ . '/..' . '/symfony/console/Helper/SymfonyQuestionHelper.php', 'Symfony\\Component\\Console\\Helper\\Table' => __DIR__ . '/..' . '/symfony/console/Helper/Table.php', 'Symfony\\Component\\Console\\Helper\\TableCell' => __DIR__ . '/..' . '/symfony/console/Helper/TableCell.php', - 'Symfony\\Component\\Console\\Helper\\TableHelper' => __DIR__ . '/..' . '/symfony/console/Helper/TableHelper.php', 'Symfony\\Component\\Console\\Helper\\TableSeparator' => __DIR__ . '/..' . '/symfony/console/Helper/TableSeparator.php', 'Symfony\\Component\\Console\\Helper\\TableStyle' => __DIR__ . '/..' . '/symfony/console/Helper/TableStyle.php', 'Symfony\\Component\\Console\\Input\\ArgvInput' => __DIR__ . '/..' . '/symfony/console/Input/ArgvInput.php', @@ -803,6 +810,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Console\\Input\\InputDefinition' => __DIR__ . '/..' . '/symfony/console/Input/InputDefinition.php', 'Symfony\\Component\\Console\\Input\\InputInterface' => __DIR__ . '/..' . '/symfony/console/Input/InputInterface.php', 'Symfony\\Component\\Console\\Input\\InputOption' => __DIR__ . '/..' . '/symfony/console/Input/InputOption.php', + 'Symfony\\Component\\Console\\Input\\StreamableInputInterface' => __DIR__ . '/..' . '/symfony/console/Input/StreamableInputInterface.php', 'Symfony\\Component\\Console\\Input\\StringInput' => __DIR__ . '/..' . '/symfony/console/Input/StringInput.php', 'Symfony\\Component\\Console\\Logger\\ConsoleLogger' => __DIR__ . '/..' . '/symfony/console/Logger/ConsoleLogger.php', 'Symfony\\Component\\Console\\Output\\BufferedOutput' => __DIR__ . '/..' . '/symfony/console/Output/BufferedOutput.php', @@ -815,25 +823,24 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Console\\Question\\ChoiceQuestion' => __DIR__ . '/..' . '/symfony/console/Question/ChoiceQuestion.php', 'Symfony\\Component\\Console\\Question\\ConfirmationQuestion' => __DIR__ . '/..' . '/symfony/console/Question/ConfirmationQuestion.php', 'Symfony\\Component\\Console\\Question\\Question' => __DIR__ . '/..' . '/symfony/console/Question/Question.php', - 'Symfony\\Component\\Console\\Shell' => __DIR__ . '/..' . '/symfony/console/Shell.php', 'Symfony\\Component\\Console\\Style\\OutputStyle' => __DIR__ . '/..' . '/symfony/console/Style/OutputStyle.php', 'Symfony\\Component\\Console\\Style\\StyleInterface' => __DIR__ . '/..' . '/symfony/console/Style/StyleInterface.php', 'Symfony\\Component\\Console\\Style\\SymfonyStyle' => __DIR__ . '/..' . '/symfony/console/Style/SymfonyStyle.php', + 'Symfony\\Component\\Console\\Terminal' => __DIR__ . '/..' . '/symfony/console/Terminal.php', 'Symfony\\Component\\Console\\Tester\\ApplicationTester' => __DIR__ . '/..' . '/symfony/console/Tester/ApplicationTester.php', 'Symfony\\Component\\Console\\Tester\\CommandTester' => __DIR__ . '/..' . '/symfony/console/Tester/CommandTester.php', 'Symfony\\Component\\Debug\\BufferingLogger' => __DIR__ . '/..' . '/symfony/debug/BufferingLogger.php', 'Symfony\\Component\\Debug\\Debug' => __DIR__ . '/..' . '/symfony/debug/Debug.php', 'Symfony\\Component\\Debug\\DebugClassLoader' => __DIR__ . '/..' . '/symfony/debug/DebugClassLoader.php', 'Symfony\\Component\\Debug\\ErrorHandler' => __DIR__ . '/..' . '/symfony/debug/ErrorHandler.php', - 'Symfony\\Component\\Debug\\ErrorHandlerCanary' => __DIR__ . '/..' . '/symfony/debug/ErrorHandler.php', 'Symfony\\Component\\Debug\\ExceptionHandler' => __DIR__ . '/..' . '/symfony/debug/ExceptionHandler.php', 'Symfony\\Component\\Debug\\Exception\\ClassNotFoundException' => __DIR__ . '/..' . '/symfony/debug/Exception/ClassNotFoundException.php', 'Symfony\\Component\\Debug\\Exception\\ContextErrorException' => __DIR__ . '/..' . '/symfony/debug/Exception/ContextErrorException.php', - 'Symfony\\Component\\Debug\\Exception\\DummyException' => __DIR__ . '/..' . '/symfony/debug/Exception/DummyException.php', 'Symfony\\Component\\Debug\\Exception\\FatalErrorException' => __DIR__ . '/..' . '/symfony/debug/Exception/FatalErrorException.php', 'Symfony\\Component\\Debug\\Exception\\FatalThrowableError' => __DIR__ . '/..' . '/symfony/debug/Exception/FatalThrowableError.php', 'Symfony\\Component\\Debug\\Exception\\FlattenException' => __DIR__ . '/..' . '/symfony/debug/Exception/FlattenException.php', 'Symfony\\Component\\Debug\\Exception\\OutOfMemoryException' => __DIR__ . '/..' . '/symfony/debug/Exception/OutOfMemoryException.php', + 'Symfony\\Component\\Debug\\Exception\\SilencedErrorContext' => __DIR__ . '/..' . '/symfony/debug/Exception/SilencedErrorContext.php', 'Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException' => __DIR__ . '/..' . '/symfony/debug/Exception/UndefinedFunctionException.php', 'Symfony\\Component\\Debug\\Exception\\UndefinedMethodException' => __DIR__ . '/..' . '/symfony/debug/Exception/UndefinedMethodException.php', 'Symfony\\Component\\Debug\\FatalErrorHandler\\ClassNotFoundFatalErrorHandler' => __DIR__ . '/..' . '/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php', @@ -841,9 +848,20 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Debug\\FatalErrorHandler\\UndefinedFunctionFatalErrorHandler' => __DIR__ . '/..' . '/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php', 'Symfony\\Component\\Debug\\FatalErrorHandler\\UndefinedMethodFatalErrorHandler' => __DIR__ . '/..' . '/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php', 'Symfony\\Component\\DependencyInjection\\Alias' => __DIR__ . '/..' . '/symfony/dependency-injection/Alias.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\ArgumentInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/Argument/ArgumentInterface.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\BoundArgument' => __DIR__ . '/..' . '/symfony/dependency-injection/Argument/BoundArgument.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\IteratorArgument' => __DIR__ . '/..' . '/symfony/dependency-injection/Argument/IteratorArgument.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\RewindableGenerator' => __DIR__ . '/..' . '/symfony/dependency-injection/Argument/RewindableGenerator.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\ServiceClosureArgument' => __DIR__ . '/..' . '/symfony/dependency-injection/Argument/ServiceClosureArgument.php', + 'Symfony\\Component\\DependencyInjection\\Argument\\TaggedIteratorArgument' => __DIR__ . '/..' . '/symfony/dependency-injection/Argument/TaggedIteratorArgument.php', + 'Symfony\\Component\\DependencyInjection\\ChildDefinition' => __DIR__ . '/..' . '/symfony/dependency-injection/ChildDefinition.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\AbstractRecursivePass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/AbstractRecursivePass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\AnalyzeServiceReferencesPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\AutoAliasServicePass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/AutoAliasServicePass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\AutowireExceptionPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/AutowireExceptionPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\AutowirePass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/AutowirePass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\AutowireRequiredMethodsPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/AutowireRequiredMethodsPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\CheckArgumentsValidityPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\CheckCircularReferencesPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\CheckDefinitionValidityPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\CheckExceptionOnInvalidReferenceBehaviorPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php', @@ -851,26 +869,47 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\DependencyInjection\\Compiler\\Compiler' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/Compiler.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\CompilerPassInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/CompilerPassInterface.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\DecoratorServicePass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/DecoratorServicePass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\DefinitionErrorExceptionPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/DefinitionErrorExceptionPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ExtensionCompilerPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ExtensionCompilerPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\FactoryReturnTypePass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\InlineServiceDefinitionsPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\LoggingFormatter' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/LoggingFormatter.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationContainerBuilder' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationParameterBag' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\MergeExtensionConfigurationPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\PassConfig' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/PassConfig.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\PriorityTaggedServiceTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\RegisterEnvVarProcessorsPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\RegisterServiceSubscribersPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\RemoveAbstractDefinitionsPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/RemoveAbstractDefinitionsPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\RemovePrivateAliasesPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/RemovePrivateAliasesPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\RemoveUnusedDefinitionsPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\RepeatablePassInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/RepeatablePassInterface.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\RepeatedPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/RepeatedPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ReplaceAliasByActualDefinitionPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ReplaceAliasByActualDefinitionPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveBindingsPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveBindingsPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveChildDefinitionsPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveClassPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveClassPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveDefinitionTemplatesPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveDefinitionTemplatesPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveEnvPlaceholdersPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveFactoryClassPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveHotPathPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveHotPathPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveInstanceofConditionalsPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveInvalidReferencesPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveNamedArgumentsPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveParameterPlaceHoldersPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolvePrivatesPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolvePrivatesPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveReferencesToAliasesPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveServiceSubscribersPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ResolveTaggedIteratorArgumentPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ResolveTaggedIteratorArgumentPass.php', + 'Symfony\\Component\\DependencyInjection\\Compiler\\ServiceLocatorTagPass' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ServiceReferenceGraph' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ServiceReferenceGraphEdge' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php', 'Symfony\\Component\\DependencyInjection\\Compiler\\ServiceReferenceGraphNode' => __DIR__ . '/..' . '/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php', + 'Symfony\\Component\\DependencyInjection\\Config\\AutowireServiceResource' => __DIR__ . '/..' . '/symfony/dependency-injection/Config/AutowireServiceResource.php', + 'Symfony\\Component\\DependencyInjection\\Config\\ContainerParametersResource' => __DIR__ . '/..' . '/symfony/dependency-injection/Config/ContainerParametersResource.php', + 'Symfony\\Component\\DependencyInjection\\Config\\ContainerParametersResourceChecker' => __DIR__ . '/..' . '/symfony/dependency-injection/Config/ContainerParametersResourceChecker.php', 'Symfony\\Component\\DependencyInjection\\Container' => __DIR__ . '/..' . '/symfony/dependency-injection/Container.php', - 'Symfony\\Component\\DependencyInjection\\ContainerAware' => __DIR__ . '/..' . '/symfony/dependency-injection/ContainerAware.php', 'Symfony\\Component\\DependencyInjection\\ContainerAwareInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/ContainerAwareInterface.php', 'Symfony\\Component\\DependencyInjection\\ContainerAwareTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/ContainerAwareTrait.php', 'Symfony\\Component\\DependencyInjection\\ContainerBuilder' => __DIR__ . '/..' . '/symfony/dependency-injection/ContainerBuilder.php', @@ -883,17 +922,19 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\DependencyInjection\\Dumper\\PhpDumper' => __DIR__ . '/..' . '/symfony/dependency-injection/Dumper/PhpDumper.php', 'Symfony\\Component\\DependencyInjection\\Dumper\\XmlDumper' => __DIR__ . '/..' . '/symfony/dependency-injection/Dumper/XmlDumper.php', 'Symfony\\Component\\DependencyInjection\\Dumper\\YamlDumper' => __DIR__ . '/..' . '/symfony/dependency-injection/Dumper/YamlDumper.php', + 'Symfony\\Component\\DependencyInjection\\EnvVarProcessor' => __DIR__ . '/..' . '/symfony/dependency-injection/EnvVarProcessor.php', + 'Symfony\\Component\\DependencyInjection\\EnvVarProcessorInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/EnvVarProcessorInterface.php', + 'Symfony\\Component\\DependencyInjection\\Exception\\AutowiringFailedException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/AutowiringFailedException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\BadMethodCallException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/BadMethodCallException.php', + 'Symfony\\Component\\DependencyInjection\\Exception\\EnvNotFoundException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/EnvNotFoundException.php', + 'Symfony\\Component\\DependencyInjection\\Exception\\EnvParameterException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/EnvParameterException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/ExceptionInterface.php', - 'Symfony\\Component\\DependencyInjection\\Exception\\InactiveScopeException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/InactiveScopeException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/InvalidArgumentException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/LogicException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\OutOfBoundsException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/OutOfBoundsException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\ParameterCircularReferenceException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/ParameterCircularReferenceException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/ParameterNotFoundException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/RuntimeException.php', - 'Symfony\\Component\\DependencyInjection\\Exception\\ScopeCrossingInjectionException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/ScopeCrossingInjectionException.php', - 'Symfony\\Component\\DependencyInjection\\Exception\\ScopeWideningInjectionException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/ScopeWideningInjectionException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/ServiceCircularReferenceException.php', 'Symfony\\Component\\DependencyInjection\\Exception\\ServiceNotFoundException' => __DIR__ . '/..' . '/symfony/dependency-injection/Exception/ServiceNotFoundException.php', 'Symfony\\Component\\DependencyInjection\\ExpressionLanguage' => __DIR__ . '/..' . '/symfony/dependency-injection/ExpressionLanguage.php', @@ -902,33 +943,68 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\DependencyInjection\\Extension\\Extension' => __DIR__ . '/..' . '/symfony/dependency-injection/Extension/Extension.php', 'Symfony\\Component\\DependencyInjection\\Extension\\ExtensionInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/Extension/ExtensionInterface.php', 'Symfony\\Component\\DependencyInjection\\Extension\\PrependExtensionInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/Extension/PrependExtensionInterface.php', - 'Symfony\\Component\\DependencyInjection\\IntrospectableContainerInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/IntrospectableContainerInterface.php', 'Symfony\\Component\\DependencyInjection\\LazyProxy\\Instantiator\\InstantiatorInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/Instantiator/InstantiatorInterface.php', 'Symfony\\Component\\DependencyInjection\\LazyProxy\\Instantiator\\RealServiceInstantiator' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php', 'Symfony\\Component\\DependencyInjection\\LazyProxy\\PhpDumper\\DumperInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/PhpDumper/DumperInterface.php', 'Symfony\\Component\\DependencyInjection\\LazyProxy\\PhpDumper\\NullDumper' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/PhpDumper/NullDumper.php', + 'Symfony\\Component\\DependencyInjection\\LazyProxy\\ProxyHelper' => __DIR__ . '/..' . '/symfony/dependency-injection/LazyProxy/ProxyHelper.php', 'Symfony\\Component\\DependencyInjection\\Loader\\ClosureLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/ClosureLoader.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\AbstractConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\AbstractServiceConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/AbstractServiceConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\AliasConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/AliasConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ContainerConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\DefaultsConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\InlineServiceConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/InlineServiceConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\InstanceofConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ParametersConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/ParametersConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\PrototypeConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/PrototypeConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ReferenceConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/ReferenceConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ServiceConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/ServiceConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\ServicesConfigurator' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/ServicesConfigurator.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\AbstractTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/AbstractTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\ArgumentTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/ArgumentTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\AutoconfigureTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/AutoconfigureTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\AutowireTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/AutowireTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\BindTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/BindTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\CallTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/CallTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\ClassTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/ClassTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\ConfiguratorTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/ConfiguratorTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\DecorateTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\DeprecateTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/DeprecateTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\FactoryTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\FileTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/FileTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\LazyTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/LazyTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\ParentTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/ParentTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\PropertyTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/PropertyTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\PublicTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/PublicTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\ShareTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/ShareTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\SyntheticTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/SyntheticTrait.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\Configurator\\Traits\\TagTrait' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php', 'Symfony\\Component\\DependencyInjection\\Loader\\DirectoryLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/DirectoryLoader.php', 'Symfony\\Component\\DependencyInjection\\Loader\\FileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/FileLoader.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\GlobFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/GlobFileLoader.php', 'Symfony\\Component\\DependencyInjection\\Loader\\IniFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/IniFileLoader.php', 'Symfony\\Component\\DependencyInjection\\Loader\\PhpFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/PhpFileLoader.php', + 'Symfony\\Component\\DependencyInjection\\Loader\\ProtectedPhpFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/PhpFileLoader.php', 'Symfony\\Component\\DependencyInjection\\Loader\\XmlFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/XmlFileLoader.php', 'Symfony\\Component\\DependencyInjection\\Loader\\YamlFileLoader' => __DIR__ . '/..' . '/symfony/dependency-injection/Loader/YamlFileLoader.php', 'Symfony\\Component\\DependencyInjection\\Parameter' => __DIR__ . '/..' . '/symfony/dependency-injection/Parameter.php', + 'Symfony\\Component\\DependencyInjection\\ParameterBag\\EnvPlaceholderParameterBag' => __DIR__ . '/..' . '/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php', 'Symfony\\Component\\DependencyInjection\\ParameterBag\\FrozenParameterBag' => __DIR__ . '/..' . '/symfony/dependency-injection/ParameterBag/FrozenParameterBag.php', 'Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag' => __DIR__ . '/..' . '/symfony/dependency-injection/ParameterBag/ParameterBag.php', 'Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBagInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/ParameterBag/ParameterBagInterface.php', 'Symfony\\Component\\DependencyInjection\\Reference' => __DIR__ . '/..' . '/symfony/dependency-injection/Reference.php', 'Symfony\\Component\\DependencyInjection\\ResettableContainerInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/ResettableContainerInterface.php', - 'Symfony\\Component\\DependencyInjection\\Scope' => __DIR__ . '/..' . '/symfony/dependency-injection/Scope.php', - 'Symfony\\Component\\DependencyInjection\\ScopeInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/ScopeInterface.php', - 'Symfony\\Component\\DependencyInjection\\SimpleXMLElement' => __DIR__ . '/..' . '/symfony/dependency-injection/SimpleXMLElement.php', + 'Symfony\\Component\\DependencyInjection\\ServiceLocator' => __DIR__ . '/..' . '/symfony/dependency-injection/ServiceLocator.php', + 'Symfony\\Component\\DependencyInjection\\ServiceSubscriberInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/ServiceSubscriberInterface.php', 'Symfony\\Component\\DependencyInjection\\TaggedContainerInterface' => __DIR__ . '/..' . '/symfony/dependency-injection/TaggedContainerInterface.php', + 'Symfony\\Component\\DependencyInjection\\TypedReference' => __DIR__ . '/..' . '/symfony/dependency-injection/TypedReference.php', 'Symfony\\Component\\DependencyInjection\\Variable' => __DIR__ . '/..' . '/symfony/dependency-injection/Variable.php', 'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/ContainerAwareEventDispatcher.php', 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php', 'Symfony\\Component\\EventDispatcher\\Debug\\TraceableEventDispatcherInterface' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/TraceableEventDispatcherInterface.php', 'Symfony\\Component\\EventDispatcher\\Debug\\WrappedListener' => __DIR__ . '/..' . '/symfony/event-dispatcher/Debug/WrappedListener.php', + 'Symfony\\Component\\EventDispatcher\\DependencyInjection\\ExtractingEventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php', 'Symfony\\Component\\EventDispatcher\\DependencyInjection\\RegisterListenersPass' => __DIR__ . '/..' . '/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php', 'Symfony\\Component\\EventDispatcher\\Event' => __DIR__ . '/..' . '/symfony/event-dispatcher/Event.php', 'Symfony\\Component\\EventDispatcher\\EventDispatcher' => __DIR__ . '/..' . '/symfony/event-dispatcher/EventDispatcher.php', @@ -942,31 +1018,17 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Filesystem\\Exception\\IOExceptionInterface' => __DIR__ . '/..' . '/symfony/filesystem/Exception/IOExceptionInterface.php', 'Symfony\\Component\\Filesystem\\Filesystem' => __DIR__ . '/..' . '/symfony/filesystem/Filesystem.php', 'Symfony\\Component\\Filesystem\\LockHandler' => __DIR__ . '/..' . '/symfony/filesystem/LockHandler.php', - 'Symfony\\Component\\Finder\\Adapter\\AbstractAdapter' => __DIR__ . '/..' . '/symfony/finder/Adapter/AbstractAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\AbstractFindAdapter' => __DIR__ . '/..' . '/symfony/finder/Adapter/AbstractFindAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\AdapterInterface' => __DIR__ . '/..' . '/symfony/finder/Adapter/AdapterInterface.php', - 'Symfony\\Component\\Finder\\Adapter\\BsdFindAdapter' => __DIR__ . '/..' . '/symfony/finder/Adapter/BsdFindAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\GnuFindAdapter' => __DIR__ . '/..' . '/symfony/finder/Adapter/GnuFindAdapter.php', - 'Symfony\\Component\\Finder\\Adapter\\PhpAdapter' => __DIR__ . '/..' . '/symfony/finder/Adapter/PhpAdapter.php', 'Symfony\\Component\\Finder\\Comparator\\Comparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/Comparator.php', 'Symfony\\Component\\Finder\\Comparator\\DateComparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/DateComparator.php', 'Symfony\\Component\\Finder\\Comparator\\NumberComparator' => __DIR__ . '/..' . '/symfony/finder/Comparator/NumberComparator.php', 'Symfony\\Component\\Finder\\Exception\\AccessDeniedException' => __DIR__ . '/..' . '/symfony/finder/Exception/AccessDeniedException.php', - 'Symfony\\Component\\Finder\\Exception\\AdapterFailureException' => __DIR__ . '/..' . '/symfony/finder/Exception/AdapterFailureException.php', 'Symfony\\Component\\Finder\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/finder/Exception/ExceptionInterface.php', - 'Symfony\\Component\\Finder\\Exception\\OperationNotPermitedException' => __DIR__ . '/..' . '/symfony/finder/Exception/OperationNotPermitedException.php', - 'Symfony\\Component\\Finder\\Exception\\ShellCommandFailureException' => __DIR__ . '/..' . '/symfony/finder/Exception/ShellCommandFailureException.php', - 'Symfony\\Component\\Finder\\Expression\\Expression' => __DIR__ . '/..' . '/symfony/finder/Expression/Expression.php', - 'Symfony\\Component\\Finder\\Expression\\Glob' => __DIR__ . '/..' . '/symfony/finder/Expression/Glob.php', - 'Symfony\\Component\\Finder\\Expression\\Regex' => __DIR__ . '/..' . '/symfony/finder/Expression/Regex.php', - 'Symfony\\Component\\Finder\\Expression\\ValueInterface' => __DIR__ . '/..' . '/symfony/finder/Expression/ValueInterface.php', 'Symfony\\Component\\Finder\\Finder' => __DIR__ . '/..' . '/symfony/finder/Finder.php', 'Symfony\\Component\\Finder\\Glob' => __DIR__ . '/..' . '/symfony/finder/Glob.php', 'Symfony\\Component\\Finder\\Iterator\\CustomFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/CustomFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\DateRangeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/DateRangeFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\DepthRangeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/DepthRangeFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\ExcludeDirectoryFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php', - 'Symfony\\Component\\Finder\\Iterator\\FilePathsIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilePathsIterator.php', 'Symfony\\Component\\Finder\\Iterator\\FileTypeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FileTypeFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\FilecontentFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilecontentFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\FilenameFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/FilenameFilterIterator.php', @@ -976,8 +1038,6 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Finder\\Iterator\\RecursiveDirectoryIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/RecursiveDirectoryIterator.php', 'Symfony\\Component\\Finder\\Iterator\\SizeRangeFilterIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/SizeRangeFilterIterator.php', 'Symfony\\Component\\Finder\\Iterator\\SortableIterator' => __DIR__ . '/..' . '/symfony/finder/Iterator/SortableIterator.php', - 'Symfony\\Component\\Finder\\Shell\\Command' => __DIR__ . '/..' . '/symfony/finder/Shell/Command.php', - 'Symfony\\Component\\Finder\\Shell\\Shell' => __DIR__ . '/..' . '/symfony/finder/Shell/Shell.php', 'Symfony\\Component\\Finder\\SplFileInfo' => __DIR__ . '/..' . '/symfony/finder/SplFileInfo.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeader' => __DIR__ . '/..' . '/symfony/http-foundation/AcceptHeader.php', 'Symfony\\Component\\HttpFoundation\\AcceptHeaderItem' => __DIR__ . '/..' . '/symfony/http-foundation/AcceptHeaderItem.php', @@ -985,6 +1045,8 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\HttpFoundation\\BinaryFileResponse' => __DIR__ . '/..' . '/symfony/http-foundation/BinaryFileResponse.php', 'Symfony\\Component\\HttpFoundation\\Cookie' => __DIR__ . '/..' . '/symfony/http-foundation/Cookie.php', 'Symfony\\Component\\HttpFoundation\\Exception\\ConflictingHeadersException' => __DIR__ . '/..' . '/symfony/http-foundation/Exception/ConflictingHeadersException.php', + 'Symfony\\Component\\HttpFoundation\\Exception\\RequestExceptionInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Exception/RequestExceptionInterface.php', + 'Symfony\\Component\\HttpFoundation\\Exception\\SuspiciousOperationException' => __DIR__ . '/..' . '/symfony/http-foundation/Exception/SuspiciousOperationException.php', 'Symfony\\Component\\HttpFoundation\\ExpressionRequestMatcher' => __DIR__ . '/..' . '/symfony/http-foundation/ExpressionRequestMatcher.php', 'Symfony\\Component\\HttpFoundation\\FileBag' => __DIR__ . '/..' . '/symfony/http-foundation/FileBag.php', 'Symfony\\Component\\HttpFoundation\\File\\Exception\\AccessDeniedException' => __DIR__ . '/..' . '/symfony/http-foundation/File/Exception/AccessDeniedException.php', @@ -1000,6 +1062,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeExtensionGuesser' => __DIR__ . '/..' . '/symfony/http-foundation/File/MimeType/MimeTypeExtensionGuesser.php', 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesser' => __DIR__ . '/..' . '/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php', 'Symfony\\Component\\HttpFoundation\\File\\MimeType\\MimeTypeGuesserInterface' => __DIR__ . '/..' . '/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php', + 'Symfony\\Component\\HttpFoundation\\File\\Stream' => __DIR__ . '/..' . '/symfony/http-foundation/File/Stream.php', 'Symfony\\Component\\HttpFoundation\\File\\UploadedFile' => __DIR__ . '/..' . '/symfony/http-foundation/File/UploadedFile.php', 'Symfony\\Component\\HttpFoundation\\HeaderBag' => __DIR__ . '/..' . '/symfony/http-foundation/HeaderBag.php', 'Symfony\\Component\\HttpFoundation\\IpUtils' => __DIR__ . '/..' . '/symfony/http-foundation/IpUtils.php', @@ -1021,8 +1084,9 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\HttpFoundation\\Session\\Flash\\FlashBagInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Flash/FlashBagInterface.php', 'Symfony\\Component\\HttpFoundation\\Session\\Session' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Session.php', 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionBagInterface.php', + 'Symfony\\Component\\HttpFoundation\\Session\\SessionBagProxy' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionBagProxy.php', 'Symfony\\Component\\HttpFoundation\\Session\\SessionInterface' => __DIR__ . '/..' . '/symfony/http-foundation/Session/SessionInterface.php', - 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\LegacyPdoSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/LegacyPdoSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\AbstractSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcacheSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MemcachedSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MongoDbSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/MongoDbSessionHandler.php', @@ -1030,6 +1094,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NativeSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/NativeSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\NullSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/NullSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\PdoSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php', + 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\StrictSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\WriteCheckSessionHandler' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MetadataBag' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/MetadataBag.php', 'Symfony\\Component\\HttpFoundation\\Session\\Storage\\MockArraySessionStorage' => __DIR__ . '/..' . '/symfony/http-foundation/Session/Storage/MockArraySessionStorage.php', @@ -1045,6 +1110,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Bundle/BundleInterface.php', 'Symfony\\Component\\HttpKernel\\CacheClearer\\CacheClearerInterface' => __DIR__ . '/..' . '/symfony/http-kernel/CacheClearer/CacheClearerInterface.php', 'Symfony\\Component\\HttpKernel\\CacheClearer\\ChainCacheClearer' => __DIR__ . '/..' . '/symfony/http-kernel/CacheClearer/ChainCacheClearer.php', + 'Symfony\\Component\\HttpKernel\\CacheClearer\\Psr6CacheClearer' => __DIR__ . '/..' . '/symfony/http-kernel/CacheClearer/Psr6CacheClearer.php', 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmer' => __DIR__ . '/..' . '/symfony/http-kernel/CacheWarmer/CacheWarmer.php', 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerAggregate' => __DIR__ . '/..' . '/symfony/http-kernel/CacheWarmer/CacheWarmerAggregate.php', 'Symfony\\Component\\HttpKernel\\CacheWarmer\\CacheWarmerInterface' => __DIR__ . '/..' . '/symfony/http-kernel/CacheWarmer/CacheWarmerInterface.php', @@ -1052,9 +1118,23 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\HttpKernel\\Client' => __DIR__ . '/..' . '/symfony/http-kernel/Client.php', 'Symfony\\Component\\HttpKernel\\Config\\EnvParametersResource' => __DIR__ . '/..' . '/symfony/http-kernel/Config/EnvParametersResource.php', 'Symfony\\Component\\HttpKernel\\Config\\FileLocator' => __DIR__ . '/..' . '/symfony/http-kernel/Config/FileLocator.php', + 'Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadata' => __DIR__ . '/..' . '/symfony/http-kernel/ControllerMetadata/ArgumentMetadata.php', + 'Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadataFactory' => __DIR__ . '/..' . '/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php', + 'Symfony\\Component\\HttpKernel\\ControllerMetadata\\ArgumentMetadataFactoryInterface' => __DIR__ . '/..' . '/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactoryInterface.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ArgumentResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolverInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ArgumentResolverInterface.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\DefaultValueResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ArgumentResolver/DefaultValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestAttributeValueResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ArgumentResolver/RequestAttributeValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestValueResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ArgumentResolver/RequestValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\ServiceValueResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\SessionValueResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ArgumentResolver/SessionValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\VariadicValueResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ArgumentValueResolverInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ArgumentValueResolverInterface.php', + 'Symfony\\Component\\HttpKernel\\Controller\\ContainerControllerResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ContainerControllerResolver.php', 'Symfony\\Component\\HttpKernel\\Controller\\ControllerReference' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ControllerReference.php', 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ControllerResolver.php', 'Symfony\\Component\\HttpKernel\\Controller\\ControllerResolverInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/ControllerResolverInterface.php', + 'Symfony\\Component\\HttpKernel\\Controller\\TraceableArgumentResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/TraceableArgumentResolver.php', 'Symfony\\Component\\HttpKernel\\Controller\\TraceableControllerResolver' => __DIR__ . '/..' . '/symfony/http-kernel/Controller/TraceableControllerResolver.php', 'Symfony\\Component\\HttpKernel\\DataCollector\\AjaxDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/AjaxDataCollector.php', 'Symfony\\Component\\HttpKernel\\DataCollector\\ConfigDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/ConfigDataCollector.php', @@ -1070,22 +1150,26 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\HttpKernel\\DataCollector\\RouterDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/RouterDataCollector.php', 'Symfony\\Component\\HttpKernel\\DataCollector\\TimeDataCollector' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/TimeDataCollector.php', 'Symfony\\Component\\HttpKernel\\DataCollector\\Util\\ValueExporter' => __DIR__ . '/..' . '/symfony/http-kernel/DataCollector/Util/ValueExporter.php', - 'Symfony\\Component\\HttpKernel\\Debug\\ErrorHandler' => __DIR__ . '/..' . '/symfony/http-kernel/Debug/ErrorHandler.php', - 'Symfony\\Component\\HttpKernel\\Debug\\ExceptionHandler' => __DIR__ . '/..' . '/symfony/http-kernel/Debug/ExceptionHandler.php', + 'Symfony\\Component\\HttpKernel\\Debug\\FileLinkFormatter' => __DIR__ . '/..' . '/symfony/http-kernel/Debug/FileLinkFormatter.php', 'Symfony\\Component\\HttpKernel\\Debug\\TraceableEventDispatcher' => __DIR__ . '/..' . '/symfony/http-kernel/Debug/TraceableEventDispatcher.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\AddAnnotatedClassesToCachePass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\AddClassesToCachePass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/AddClassesToCachePass.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ConfigurableExtension' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/ConfigurableExtension.php', - 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ContainerAwareHttpKernel' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/ContainerAwareHttpKernel.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ControllerArgumentValueResolverPass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/ControllerArgumentValueResolverPass.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\Extension' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/Extension.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\FragmentRendererPass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\LazyLoadingFragmentHandler' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/LazyLoadingFragmentHandler.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\LoggerPass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/LoggerPass.php', 'Symfony\\Component\\HttpKernel\\DependencyInjection\\MergeExtensionConfigurationPass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php', - 'Symfony\\Component\\HttpKernel\\DependencyInjection\\RegisterListenersPass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/RegisterListenersPass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\RegisterControllerArgumentLocatorsPass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\RemoveEmptyControllerArgumentLocatorsPass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ResettableServicePass' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/ResettableServicePass.php', + 'Symfony\\Component\\HttpKernel\\DependencyInjection\\ServicesResetter' => __DIR__ . '/..' . '/symfony/http-kernel/DependencyInjection/ServicesResetter.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\AbstractSessionListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/AbstractSessionListener.php', + 'Symfony\\Component\\HttpKernel\\EventListener\\AbstractTestSessionListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/AbstractTestSessionListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\AddRequestFormatsListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/AddRequestFormatsListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\DebugHandlersListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/DebugHandlersListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\DumpListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/DumpListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\ErrorsLoggerListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/ErrorsLoggerListener.php', - 'Symfony\\Component\\HttpKernel\\EventListener\\EsiListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/EsiListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\ExceptionListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/ExceptionListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\FragmentListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/FragmentListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\LocaleListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/LocaleListener.php', @@ -1099,6 +1183,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\HttpKernel\\EventListener\\TestSessionListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/TestSessionListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\TranslatorListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/TranslatorListener.php', 'Symfony\\Component\\HttpKernel\\EventListener\\ValidateRequestListener' => __DIR__ . '/..' . '/symfony/http-kernel/EventListener/ValidateRequestListener.php', + 'Symfony\\Component\\HttpKernel\\Event\\FilterControllerArgumentsEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php', 'Symfony\\Component\\HttpKernel\\Event\\FilterControllerEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/FilterControllerEvent.php', 'Symfony\\Component\\HttpKernel\\Event\\FilterResponseEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/FilterResponseEvent.php', 'Symfony\\Component\\HttpKernel\\Event\\FinishRequestEvent' => __DIR__ . '/..' . '/symfony/http-kernel/Event/FinishRequestEvent.php', @@ -1132,9 +1217,8 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\HttpKernel\\Fragment\\InlineFragmentRenderer' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/InlineFragmentRenderer.php', 'Symfony\\Component\\HttpKernel\\Fragment\\RoutableFragmentRenderer' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php', 'Symfony\\Component\\HttpKernel\\Fragment\\SsiFragmentRenderer' => __DIR__ . '/..' . '/symfony/http-kernel/Fragment/SsiFragmentRenderer.php', + 'Symfony\\Component\\HttpKernel\\HttpCache\\AbstractSurrogate' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/AbstractSurrogate.php', 'Symfony\\Component\\HttpKernel\\HttpCache\\Esi' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/Esi.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\EsiResponseCacheStrategy' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/EsiResponseCacheStrategy.php', - 'Symfony\\Component\\HttpKernel\\HttpCache\\EsiResponseCacheStrategyInterface' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/EsiResponseCacheStrategyInterface.php', 'Symfony\\Component\\HttpKernel\\HttpCache\\HttpCache' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/HttpCache.php', 'Symfony\\Component\\HttpKernel\\HttpCache\\ResponseCacheStrategy' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/ResponseCacheStrategy.php', 'Symfony\\Component\\HttpKernel\\HttpCache\\ResponseCacheStrategyInterface' => __DIR__ . '/..' . '/symfony/http-kernel/HttpCache/ResponseCacheStrategyInterface.php', @@ -1149,28 +1233,39 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\HttpKernel\\KernelEvents' => __DIR__ . '/..' . '/symfony/http-kernel/KernelEvents.php', 'Symfony\\Component\\HttpKernel\\KernelInterface' => __DIR__ . '/..' . '/symfony/http-kernel/KernelInterface.php', 'Symfony\\Component\\HttpKernel\\Log\\DebugLoggerInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Log/DebugLoggerInterface.php', - 'Symfony\\Component\\HttpKernel\\Log\\LoggerInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Log/LoggerInterface.php', - 'Symfony\\Component\\HttpKernel\\Log\\NullLogger' => __DIR__ . '/..' . '/symfony/http-kernel/Log/NullLogger.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\BaseMemcacheProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/BaseMemcacheProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\Log\\Logger' => __DIR__ . '/..' . '/symfony/http-kernel/Log/Logger.php', 'Symfony\\Component\\HttpKernel\\Profiler\\FileProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/FileProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MemcacheProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/MemcacheProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MemcachedProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/MemcachedProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MongoDbProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/MongoDbProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\MysqlProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/MysqlProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\PdoProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/PdoProfilerStorage.php', 'Symfony\\Component\\HttpKernel\\Profiler\\Profile' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/Profile.php', 'Symfony\\Component\\HttpKernel\\Profiler\\Profiler' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/Profiler.php', 'Symfony\\Component\\HttpKernel\\Profiler\\ProfilerStorageInterface' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/ProfilerStorageInterface.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\RedisProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/RedisProfilerStorage.php', - 'Symfony\\Component\\HttpKernel\\Profiler\\SqliteProfilerStorage' => __DIR__ . '/..' . '/symfony/http-kernel/Profiler/SqliteProfilerStorage.php', + 'Symfony\\Component\\HttpKernel\\RebootableInterface' => __DIR__ . '/..' . '/symfony/http-kernel/RebootableInterface.php', 'Symfony\\Component\\HttpKernel\\TerminableInterface' => __DIR__ . '/..' . '/symfony/http-kernel/TerminableInterface.php', 'Symfony\\Component\\HttpKernel\\UriSigner' => __DIR__ . '/..' . '/symfony/http-kernel/UriSigner.php', + 'Symfony\\Component\\Process\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/process/Exception/ExceptionInterface.php', + 'Symfony\\Component\\Process\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/symfony/process/Exception/InvalidArgumentException.php', + 'Symfony\\Component\\Process\\Exception\\LogicException' => __DIR__ . '/..' . '/symfony/process/Exception/LogicException.php', + 'Symfony\\Component\\Process\\Exception\\ProcessFailedException' => __DIR__ . '/..' . '/symfony/process/Exception/ProcessFailedException.php', + 'Symfony\\Component\\Process\\Exception\\ProcessTimedOutException' => __DIR__ . '/..' . '/symfony/process/Exception/ProcessTimedOutException.php', + 'Symfony\\Component\\Process\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/process/Exception/RuntimeException.php', + 'Symfony\\Component\\Process\\ExecutableFinder' => __DIR__ . '/..' . '/symfony/process/ExecutableFinder.php', + 'Symfony\\Component\\Process\\InputStream' => __DIR__ . '/..' . '/symfony/process/InputStream.php', + 'Symfony\\Component\\Process\\PhpExecutableFinder' => __DIR__ . '/..' . '/symfony/process/PhpExecutableFinder.php', + 'Symfony\\Component\\Process\\PhpProcess' => __DIR__ . '/..' . '/symfony/process/PhpProcess.php', + 'Symfony\\Component\\Process\\Pipes\\AbstractPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/AbstractPipes.php', + 'Symfony\\Component\\Process\\Pipes\\PipesInterface' => __DIR__ . '/..' . '/symfony/process/Pipes/PipesInterface.php', + 'Symfony\\Component\\Process\\Pipes\\UnixPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/UnixPipes.php', + 'Symfony\\Component\\Process\\Pipes\\WindowsPipes' => __DIR__ . '/..' . '/symfony/process/Pipes/WindowsPipes.php', + 'Symfony\\Component\\Process\\Process' => __DIR__ . '/..' . '/symfony/process/Process.php', + 'Symfony\\Component\\Process\\ProcessBuilder' => __DIR__ . '/..' . '/symfony/process/ProcessBuilder.php', + 'Symfony\\Component\\Process\\ProcessUtils' => __DIR__ . '/..' . '/symfony/process/ProcessUtils.php', 'Symfony\\Component\\Routing\\Annotation\\Route' => __DIR__ . '/..' . '/symfony/routing/Annotation/Route.php', 'Symfony\\Component\\Routing\\CompiledRoute' => __DIR__ . '/..' . '/symfony/routing/CompiledRoute.php', + 'Symfony\\Component\\Routing\\DependencyInjection\\RoutingResolverPass' => __DIR__ . '/..' . '/symfony/routing/DependencyInjection/RoutingResolverPass.php', 'Symfony\\Component\\Routing\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/symfony/routing/Exception/ExceptionInterface.php', 'Symfony\\Component\\Routing\\Exception\\InvalidParameterException' => __DIR__ . '/..' . '/symfony/routing/Exception/InvalidParameterException.php', 'Symfony\\Component\\Routing\\Exception\\MethodNotAllowedException' => __DIR__ . '/..' . '/symfony/routing/Exception/MethodNotAllowedException.php', 'Symfony\\Component\\Routing\\Exception\\MissingMandatoryParametersException' => __DIR__ . '/..' . '/symfony/routing/Exception/MissingMandatoryParametersException.php', + 'Symfony\\Component\\Routing\\Exception\\NoConfigurationException' => __DIR__ . '/..' . '/symfony/routing/Exception/NoConfigurationException.php', 'Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException' => __DIR__ . '/..' . '/symfony/routing/Exception/ResourceNotFoundException.php', 'Symfony\\Component\\Routing\\Exception\\RouteNotFoundException' => __DIR__ . '/..' . '/symfony/routing/Exception/RouteNotFoundException.php', 'Symfony\\Component\\Routing\\Generator\\ConfigurableRequirementsInterface' => __DIR__ . '/..' . '/symfony/routing/Generator/ConfigurableRequirementsInterface.php', @@ -1183,21 +1278,26 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Routing\\Loader\\AnnotationDirectoryLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/AnnotationDirectoryLoader.php', 'Symfony\\Component\\Routing\\Loader\\AnnotationFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/AnnotationFileLoader.php', 'Symfony\\Component\\Routing\\Loader\\ClosureLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/ClosureLoader.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\CollectionConfigurator' => __DIR__ . '/..' . '/symfony/routing/Loader/Configurator/CollectionConfigurator.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\ImportConfigurator' => __DIR__ . '/..' . '/symfony/routing/Loader/Configurator/ImportConfigurator.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\RouteConfigurator' => __DIR__ . '/..' . '/symfony/routing/Loader/Configurator/RouteConfigurator.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\RoutingConfigurator' => __DIR__ . '/..' . '/symfony/routing/Loader/Configurator/RoutingConfigurator.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\Traits\\AddTrait' => __DIR__ . '/..' . '/symfony/routing/Loader/Configurator/Traits/AddTrait.php', + 'Symfony\\Component\\Routing\\Loader\\Configurator\\Traits\\RouteTrait' => __DIR__ . '/..' . '/symfony/routing/Loader/Configurator/Traits/RouteTrait.php', 'Symfony\\Component\\Routing\\Loader\\DependencyInjection\\ServiceRouterLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/DependencyInjection/ServiceRouterLoader.php', 'Symfony\\Component\\Routing\\Loader\\DirectoryLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/DirectoryLoader.php', + 'Symfony\\Component\\Routing\\Loader\\GlobFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/GlobFileLoader.php', 'Symfony\\Component\\Routing\\Loader\\ObjectRouteLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/ObjectRouteLoader.php', 'Symfony\\Component\\Routing\\Loader\\PhpFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/PhpFileLoader.php', - 'Symfony\\Component\\Routing\\Loader\\RecursiveCallbackFilterIterator' => __DIR__ . '/..' . '/symfony/routing/Loader/AnnotationDirectoryLoader.php', + 'Symfony\\Component\\Routing\\Loader\\ProtectedPhpFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/PhpFileLoader.php', 'Symfony\\Component\\Routing\\Loader\\XmlFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/XmlFileLoader.php', 'Symfony\\Component\\Routing\\Loader\\YamlFileLoader' => __DIR__ . '/..' . '/symfony/routing/Loader/YamlFileLoader.php', - 'Symfony\\Component\\Routing\\Matcher\\ApacheUrlMatcher' => __DIR__ . '/..' . '/symfony/routing/Matcher/ApacheUrlMatcher.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\ApacheMatcherDumper' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/ApacheMatcherDumper.php', 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperCollection' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/DumperCollection.php', - 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperPrefixCollection' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/DumperPrefixCollection.php', 'Symfony\\Component\\Routing\\Matcher\\Dumper\\DumperRoute' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/DumperRoute.php', 'Symfony\\Component\\Routing\\Matcher\\Dumper\\MatcherDumper' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/MatcherDumper.php', 'Symfony\\Component\\Routing\\Matcher\\Dumper\\MatcherDumperInterface' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/MatcherDumperInterface.php', 'Symfony\\Component\\Routing\\Matcher\\Dumper\\PhpMatcherDumper' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php', + 'Symfony\\Component\\Routing\\Matcher\\Dumper\\StaticPrefixCollection' => __DIR__ . '/..' . '/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php', 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcher' => __DIR__ . '/..' . '/symfony/routing/Matcher/RedirectableUrlMatcher.php', 'Symfony\\Component\\Routing\\Matcher\\RedirectableUrlMatcherInterface' => __DIR__ . '/..' . '/symfony/routing/Matcher/RedirectableUrlMatcherInterface.php', 'Symfony\\Component\\Routing\\Matcher\\RequestMatcherInterface' => __DIR__ . '/..' . '/symfony/routing/Matcher/RequestMatcherInterface.php', @@ -1213,6 +1313,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Routing\\RouteCompilerInterface' => __DIR__ . '/..' . '/symfony/routing/RouteCompilerInterface.php', 'Symfony\\Component\\Routing\\Router' => __DIR__ . '/..' . '/symfony/routing/Router.php', 'Symfony\\Component\\Routing\\RouterInterface' => __DIR__ . '/..' . '/symfony/routing/RouterInterface.php', + 'Symfony\\Component\\Yaml\\Command\\LintCommand' => __DIR__ . '/..' . '/symfony/yaml/Command/LintCommand.php', 'Symfony\\Component\\Yaml\\Dumper' => __DIR__ . '/..' . '/symfony/yaml/Dumper.php', 'Symfony\\Component\\Yaml\\Escaper' => __DIR__ . '/..' . '/symfony/yaml/Escaper.php', 'Symfony\\Component\\Yaml\\Exception\\DumpException' => __DIR__ . '/..' . '/symfony/yaml/Exception/DumpException.php', @@ -1221,13 +1322,21 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Symfony\\Component\\Yaml\\Exception\\RuntimeException' => __DIR__ . '/..' . '/symfony/yaml/Exception/RuntimeException.php', 'Symfony\\Component\\Yaml\\Inline' => __DIR__ . '/..' . '/symfony/yaml/Inline.php', 'Symfony\\Component\\Yaml\\Parser' => __DIR__ . '/..' . '/symfony/yaml/Parser.php', + 'Symfony\\Component\\Yaml\\Tag\\TaggedValue' => __DIR__ . '/..' . '/symfony/yaml/Tag/TaggedValue.php', 'Symfony\\Component\\Yaml\\Unescaper' => __DIR__ . '/..' . '/symfony/yaml/Unescaper.php', 'Symfony\\Component\\Yaml\\Yaml' => __DIR__ . '/..' . '/symfony/yaml/Yaml.php', 'Symfony\\Polyfill\\Ctype\\Ctype' => __DIR__ . '/..' . '/symfony/polyfill-ctype/Ctype.php', 'Symfony\\Polyfill\\Mbstring\\Mbstring' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/Mbstring.php', - 'Symfony\\Polyfill\\Php54\\Php54' => __DIR__ . '/..' . '/symfony/polyfill-php54/Php54.php', - 'Symfony\\Polyfill\\Php55\\Php55' => __DIR__ . '/..' . '/symfony/polyfill-php55/Php55.php', - 'Symfony\\Polyfill\\Php55\\Php55ArrayColumn' => __DIR__ . '/..' . '/symfony/polyfill-php55/Php55ArrayColumn.php', + 'Symfony\\Polyfill\\Php56\\Php56' => __DIR__ . '/..' . '/symfony/polyfill-php56/Php56.php', + 'Symfony\\Polyfill\\Php70\\Php70' => __DIR__ . '/..' . '/symfony/polyfill-php70/Php70.php', + 'Symfony\\Polyfill\\Util\\Binary' => __DIR__ . '/..' . '/symfony/polyfill-util/Binary.php', + 'Symfony\\Polyfill\\Util\\BinaryNoFuncOverload' => __DIR__ . '/..' . '/symfony/polyfill-util/BinaryNoFuncOverload.php', + 'Symfony\\Polyfill\\Util\\BinaryOnFuncOverload' => __DIR__ . '/..' . '/symfony/polyfill-util/BinaryOnFuncOverload.php', + 'Symfony\\Polyfill\\Util\\TestListener' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListener.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV5' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListenerForV5.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV6' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListenerForV6.php', + 'Symfony\\Polyfill\\Util\\TestListenerForV7' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListenerForV7.php', + 'Symfony\\Polyfill\\Util\\TestListenerTrait' => __DIR__ . '/..' . '/symfony/polyfill-util/TestListenerTrait.php', 'Twig\\Cache\\CacheInterface' => __DIR__ . '/..' . '/twig/twig/src/Cache/CacheInterface.php', 'Twig\\Cache\\FilesystemCache' => __DIR__ . '/..' . '/twig/twig/src/Cache/FilesystemCache.php', 'Twig\\Cache\\NullCache' => __DIR__ . '/..' . '/twig/twig/src/Cache/NullCache.php', @@ -1238,6 +1347,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig\\Error\\RuntimeError' => __DIR__ . '/..' . '/twig/twig/src/Error/RuntimeError.php', 'Twig\\Error\\SyntaxError' => __DIR__ . '/..' . '/twig/twig/src/Error/SyntaxError.php', 'Twig\\ExpressionParser' => __DIR__ . '/..' . '/twig/twig/src/ExpressionParser.php', + 'Twig\\ExtensionSet' => __DIR__ . '/..' . '/twig/twig/src/ExtensionSet.php', 'Twig\\Extension\\AbstractExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/AbstractExtension.php', 'Twig\\Extension\\CoreExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/CoreExtension.php', 'Twig\\Extension\\DebugExtension' => __DIR__ . '/..' . '/twig/twig/src/Extension/DebugExtension.php', @@ -1263,6 +1373,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig\\NodeTraverser' => __DIR__ . '/..' . '/twig/twig/src/NodeTraverser.php', 'Twig\\NodeVisitor\\AbstractNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/AbstractNodeVisitor.php', 'Twig\\NodeVisitor\\EscaperNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/EscaperNodeVisitor.php', + 'Twig\\NodeVisitor\\MacroAutoImportNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/MacroAutoImportNodeVisitor.php', 'Twig\\NodeVisitor\\NodeVisitorInterface' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/NodeVisitorInterface.php', 'Twig\\NodeVisitor\\OptimizerNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/OptimizerNodeVisitor.php', 'Twig\\NodeVisitor\\SafeAnalysisNodeVisitor' => __DIR__ . '/..' . '/twig/twig/src/NodeVisitor/SafeAnalysisNodeVisitor.php', @@ -1278,6 +1389,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig\\Node\\EmbedNode' => __DIR__ . '/..' . '/twig/twig/src/Node/EmbedNode.php', 'Twig\\Node\\Expression\\AbstractExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/AbstractExpression.php', 'Twig\\Node\\Expression\\ArrayExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ArrayExpression.php', + 'Twig\\Node\\Expression\\ArrowFunctionExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/ArrowFunctionExpression.php', 'Twig\\Node\\Expression\\AssignNameExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/AssignNameExpression.php', 'Twig\\Node\\Expression\\Binary\\AbstractBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/AbstractBinary.php', 'Twig\\Node\\Expression\\Binary\\AddBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/AddBinary.php', @@ -1303,6 +1415,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig\\Node\\Expression\\Binary\\OrBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/OrBinary.php', 'Twig\\Node\\Expression\\Binary\\PowerBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/PowerBinary.php', 'Twig\\Node\\Expression\\Binary\\RangeBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/RangeBinary.php', + 'Twig\\Node\\Expression\\Binary\\SpaceshipBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/SpaceshipBinary.php', 'Twig\\Node\\Expression\\Binary\\StartsWithBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/StartsWithBinary.php', 'Twig\\Node\\Expression\\Binary\\SubBinary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Binary/SubBinary.php', 'Twig\\Node\\Expression\\BlockReferenceExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/BlockReferenceExpression.php', @@ -1331,6 +1444,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig\\Node\\Expression\\Unary\\NegUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/NegUnary.php', 'Twig\\Node\\Expression\\Unary\\NotUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/NotUnary.php', 'Twig\\Node\\Expression\\Unary\\PosUnary' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/Unary/PosUnary.php', + 'Twig\\Node\\Expression\\VariadicExpression' => __DIR__ . '/..' . '/twig/twig/src/Node/Expression/VariadicExpression.php', 'Twig\\Node\\FlushNode' => __DIR__ . '/..' . '/twig/twig/src/Node/FlushNode.php', 'Twig\\Node\\ForLoopNode' => __DIR__ . '/..' . '/twig/twig/src/Node/ForLoopNode.php', 'Twig\\Node\\ForNode' => __DIR__ . '/..' . '/twig/twig/src/Node/ForNode.php', @@ -1346,7 +1460,6 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig\\Node\\SandboxNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SandboxNode.php', 'Twig\\Node\\SandboxedPrintNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SandboxedPrintNode.php', 'Twig\\Node\\SetNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SetNode.php', - 'Twig\\Node\\SetTempNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SetTempNode.php', 'Twig\\Node\\SpacelessNode' => __DIR__ . '/..' . '/twig/twig/src/Node/SpacelessNode.php', 'Twig\\Node\\TextNode' => __DIR__ . '/..' . '/twig/twig/src/Node/TextNode.php', 'Twig\\Node\\WithNode' => __DIR__ . '/..' . '/twig/twig/src/Node/WithNode.php', @@ -1377,6 +1490,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig\\Test\\NodeTestCase' => __DIR__ . '/..' . '/twig/twig/src/Test/NodeTestCase.php', 'Twig\\Token' => __DIR__ . '/..' . '/twig/twig/src/Token.php', 'Twig\\TokenParser\\AbstractTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AbstractTokenParser.php', + 'Twig\\TokenParser\\ApplyTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/ApplyTokenParser.php', 'Twig\\TokenParser\\AutoEscapeTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/AutoEscapeTokenParser.php', 'Twig\\TokenParser\\BlockTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/BlockTokenParser.php', 'Twig\\TokenParser\\DeprecatedTokenParser' => __DIR__ . '/..' . '/twig/twig/src/TokenParser/DeprecatedTokenParser.php', @@ -1403,13 +1517,11 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig\\TwigTest' => __DIR__ . '/..' . '/twig/twig/src/TwigTest.php', 'Twig\\Util\\DeprecationCollector' => __DIR__ . '/..' . '/twig/twig/src/Util/DeprecationCollector.php', 'Twig\\Util\\TemplateDirIterator' => __DIR__ . '/..' . '/twig/twig/src/Util/TemplateDirIterator.php', - 'Twig_Autoloader' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Autoloader.php', 'Twig_BaseNodeVisitor' => __DIR__ . '/..' . '/twig/twig/lib/Twig/BaseNodeVisitor.php', 'Twig_CacheInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/CacheInterface.php', 'Twig_Cache_Filesystem' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Cache/Filesystem.php', 'Twig_Cache_Null' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Cache/Null.php', 'Twig_Compiler' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Compiler.php', - 'Twig_CompilerInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/CompilerInterface.php', 'Twig_ContainerRuntimeLoader' => __DIR__ . '/..' . '/twig/twig/lib/Twig/ContainerRuntimeLoader.php', 'Twig_Environment' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Environment.php', 'Twig_Error' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Error.php', @@ -1420,6 +1532,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig_ExpressionParser' => __DIR__ . '/..' . '/twig/twig/lib/Twig/ExpressionParser.php', 'Twig_Extension' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension.php', 'Twig_ExtensionInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/ExtensionInterface.php', + 'Twig_ExtensionSet' => __DIR__ . '/..' . '/twig/twig/lib/Twig/ExtensionSet.php', 'Twig_Extension_Core' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/Core.php', 'Twig_Extension_Debug' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/Debug.php', 'Twig_Extension_Escaper' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Extension/Escaper.php', @@ -1433,28 +1546,15 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig_FactoryRuntimeLoader' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FactoryRuntimeLoader.php', 'Twig_FileExtensionEscapingStrategy' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FileExtensionEscapingStrategy.php', 'Twig_Filter' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Filter.php', - 'Twig_FilterCallableInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FilterCallableInterface.php', - 'Twig_FilterInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FilterInterface.php', - 'Twig_Filter_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Filter/Function.php', - 'Twig_Filter_Method' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Filter/Method.php', - 'Twig_Filter_Node' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Filter/Node.php', 'Twig_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Function.php', - 'Twig_FunctionCallableInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FunctionCallableInterface.php', - 'Twig_FunctionInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/FunctionInterface.php', - 'Twig_Function_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Function/Function.php', - 'Twig_Function_Method' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Function/Method.php', - 'Twig_Function_Node' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Function/Node.php', 'Twig_Lexer' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Lexer.php', - 'Twig_LexerInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/LexerInterface.php', 'Twig_LoaderInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/LoaderInterface.php', 'Twig_Loader_Array' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Loader/Array.php', 'Twig_Loader_Chain' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Loader/Chain.php', 'Twig_Loader_Filesystem' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Loader/Filesystem.php', - 'Twig_Loader_String' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Loader/String.php', 'Twig_Markup' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Markup.php', 'Twig_Node' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node.php', 'Twig_NodeCaptureInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeCaptureInterface.php', - 'Twig_NodeInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeInterface.php', 'Twig_NodeOutputInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeOutputInterface.php', 'Twig_NodeTraverser' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeTraverser.php', 'Twig_NodeVisitorInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/NodeVisitorInterface.php', @@ -1503,7 +1603,6 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig_Node_Expression_Call' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Call.php', 'Twig_Node_Expression_Conditional' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Conditional.php', 'Twig_Node_Expression_Constant' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Constant.php', - 'Twig_Node_Expression_ExtensionReference' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/ExtensionReference.php', 'Twig_Node_Expression_Filter' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Filter.php', 'Twig_Node_Expression_Filter_Default' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Filter/Default.php', 'Twig_Node_Expression_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Expression/Function.php', @@ -1537,12 +1636,10 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig_Node_Sandbox' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Sandbox.php', 'Twig_Node_SandboxedPrint' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/SandboxedPrint.php', 'Twig_Node_Set' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Set.php', - 'Twig_Node_SetTemp' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/SetTemp.php', 'Twig_Node_Spaceless' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Spaceless.php', 'Twig_Node_Text' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/Text.php', 'Twig_Node_With' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Node/With.php', 'Twig_Parser' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Parser.php', - 'Twig_ParserInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/ParserInterface.php', 'Twig_Profiler_Dumper_Base' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/Dumper/Base.php', 'Twig_Profiler_Dumper_Blackfire' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/Dumper/Blackfire.php', 'Twig_Profiler_Dumper_Html' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Profiler/Dumper/Html.php', @@ -1566,20 +1663,12 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig_Source' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Source.php', 'Twig_SourceContextLoaderInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/SourceContextLoaderInterface.php', 'Twig_Template' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Template.php', - 'Twig_TemplateInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TemplateInterface.php', 'Twig_TemplateWrapper' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TemplateWrapper.php', 'Twig_Test' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test.php', - 'Twig_TestCallableInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TestCallableInterface.php', - 'Twig_TestInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TestInterface.php', - 'Twig_Test_Function' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Function.php', 'Twig_Test_IntegrationTestCase' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/IntegrationTestCase.php', - 'Twig_Test_Method' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Method.php', - 'Twig_Test_Node' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/Node.php', 'Twig_Test_NodeTestCase' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Test/NodeTestCase.php', 'Twig_Token' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Token.php', 'Twig_TokenParser' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser.php', - 'Twig_TokenParserBroker' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParserBroker.php', - 'Twig_TokenParserBrokerInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParserBrokerInterface.php', 'Twig_TokenParserInterface' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParserInterface.php', 'Twig_TokenParser_AutoEscape' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/AutoEscape.php', 'Twig_TokenParser_Block' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenParser/Block.php', @@ -1603,12 +1692,14 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Twig_TokenStream' => __DIR__ . '/..' . '/twig/twig/lib/Twig/TokenStream.php', 'Twig_Util_DeprecationCollector' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Util/DeprecationCollector.php', 'Twig_Util_TemplateDirIterator' => __DIR__ . '/..' . '/twig/twig/lib/Twig/Util/TemplateDirIterator.php', + 'TypeError' => __DIR__ . '/..' . '/symfony/polyfill-php70/Resources/stubs/TypeError.php', 'Zend\\Code\\Annotation\\AnnotationCollection' => __DIR__ . '/..' . '/zendframework/zend-code/src/Annotation/AnnotationCollection.php', 'Zend\\Code\\Annotation\\AnnotationInterface' => __DIR__ . '/..' . '/zendframework/zend-code/src/Annotation/AnnotationInterface.php', 'Zend\\Code\\Annotation\\AnnotationManager' => __DIR__ . '/..' . '/zendframework/zend-code/src/Annotation/AnnotationManager.php', 'Zend\\Code\\Annotation\\Parser\\DoctrineAnnotationParser' => __DIR__ . '/..' . '/zendframework/zend-code/src/Annotation/Parser/DoctrineAnnotationParser.php', 'Zend\\Code\\Annotation\\Parser\\GenericAnnotationParser' => __DIR__ . '/..' . '/zendframework/zend-code/src/Annotation/Parser/GenericAnnotationParser.php', 'Zend\\Code\\Annotation\\Parser\\ParserInterface' => __DIR__ . '/..' . '/zendframework/zend-code/src/Annotation/Parser/ParserInterface.php', + 'Zend\\Code\\DeclareStatement' => __DIR__ . '/..' . '/zendframework/zend-code/src/DeclareStatement.php', 'Zend\\Code\\Exception\\BadMethodCallException' => __DIR__ . '/..' . '/zendframework/zend-code/src/Exception/BadMethodCallException.php', 'Zend\\Code\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-code/src/Exception/ExceptionInterface.php', 'Zend\\Code\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-code/src/Exception/InvalidArgumentException.php', @@ -1630,12 +1721,14 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Zend\\Code\\Generator\\DocBlock\\Tag\\ReturnTag' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/DocBlock/Tag/ReturnTag.php', 'Zend\\Code\\Generator\\DocBlock\\Tag\\TagInterface' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/DocBlock/Tag/TagInterface.php', 'Zend\\Code\\Generator\\DocBlock\\Tag\\ThrowsTag' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/DocBlock/Tag/ThrowsTag.php', + 'Zend\\Code\\Generator\\DocBlock\\Tag\\VarTag' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/DocBlock/Tag/VarTag.php', 'Zend\\Code\\Generator\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/Exception/ExceptionInterface.php', 'Zend\\Code\\Generator\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/Exception/InvalidArgumentException.php', 'Zend\\Code\\Generator\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/Exception/RuntimeException.php', 'Zend\\Code\\Generator\\FileGenerator' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/FileGenerator.php', 'Zend\\Code\\Generator\\FileGeneratorRegistry' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/FileGeneratorRegistry.php', 'Zend\\Code\\Generator\\GeneratorInterface' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/GeneratorInterface.php', + 'Zend\\Code\\Generator\\InterfaceGenerator' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/InterfaceGenerator.php', 'Zend\\Code\\Generator\\MethodGenerator' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/MethodGenerator.php', 'Zend\\Code\\Generator\\ParameterGenerator' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/ParameterGenerator.php', 'Zend\\Code\\Generator\\PropertyGenerator' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/PropertyGenerator.php', @@ -1643,6 +1736,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Zend\\Code\\Generator\\TraitGenerator' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/TraitGenerator.php', 'Zend\\Code\\Generator\\TraitUsageGenerator' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/TraitUsageGenerator.php', 'Zend\\Code\\Generator\\TraitUsageInterface' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/TraitUsageInterface.php', + 'Zend\\Code\\Generator\\TypeGenerator' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/TypeGenerator.php', 'Zend\\Code\\Generator\\ValueGenerator' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generator/ValueGenerator.php', 'Zend\\Code\\Generic\\Prototype\\PrototypeClassFactory' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generic/Prototype/PrototypeClassFactory.php', 'Zend\\Code\\Generic\\Prototype\\PrototypeGenericInterface' => __DIR__ . '/..' . '/zendframework/zend-code/src/Generic/Prototype/PrototypeGenericInterface.php', @@ -1661,6 +1755,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Zend\\Code\\Reflection\\DocBlock\\Tag\\ReturnTag' => __DIR__ . '/..' . '/zendframework/zend-code/src/Reflection/DocBlock/Tag/ReturnTag.php', 'Zend\\Code\\Reflection\\DocBlock\\Tag\\TagInterface' => __DIR__ . '/..' . '/zendframework/zend-code/src/Reflection/DocBlock/Tag/TagInterface.php', 'Zend\\Code\\Reflection\\DocBlock\\Tag\\ThrowsTag' => __DIR__ . '/..' . '/zendframework/zend-code/src/Reflection/DocBlock/Tag/ThrowsTag.php', + 'Zend\\Code\\Reflection\\DocBlock\\Tag\\VarTag' => __DIR__ . '/..' . '/zendframework/zend-code/src/Reflection/DocBlock/Tag/VarTag.php', 'Zend\\Code\\Reflection\\Exception\\BadMethodCallException' => __DIR__ . '/..' . '/zendframework/zend-code/src/Reflection/Exception/BadMethodCallException.php', 'Zend\\Code\\Reflection\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-code/src/Reflection/Exception/ExceptionInterface.php', 'Zend\\Code\\Reflection\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-code/src/Reflection/Exception/InvalidArgumentException.php', @@ -1700,117 +1795,46 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 'Zend\\EventManager\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/Exception/ExceptionInterface.php', 'Zend\\EventManager\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/Exception/InvalidArgumentException.php', 'Zend\\EventManager\\Exception\\InvalidCallbackException' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/Exception/InvalidCallbackException.php', + 'Zend\\EventManager\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/Exception/RuntimeException.php', 'Zend\\EventManager\\FilterChain' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/FilterChain.php', 'Zend\\EventManager\\Filter\\FilterInterface' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/Filter/FilterInterface.php', 'Zend\\EventManager\\Filter\\FilterIterator' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/Filter/FilterIterator.php', - 'Zend\\EventManager\\GlobalEventManager' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/GlobalEventManager.php', + 'Zend\\EventManager\\LazyEventListener' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/LazyEventListener.php', + 'Zend\\EventManager\\LazyListener' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/LazyListener.php', + 'Zend\\EventManager\\LazyListenerAggregate' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/LazyListenerAggregate.php', 'Zend\\EventManager\\ListenerAggregateInterface' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/ListenerAggregateInterface.php', 'Zend\\EventManager\\ListenerAggregateTrait' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/ListenerAggregateTrait.php', - 'Zend\\EventManager\\ProvidesEvents' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/ProvidesEvents.php', 'Zend\\EventManager\\ResponseCollection' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/ResponseCollection.php', - 'Zend\\EventManager\\SharedEventAggregateAwareInterface' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/SharedEventAggregateAwareInterface.php', 'Zend\\EventManager\\SharedEventManager' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/SharedEventManager.php', - 'Zend\\EventManager\\SharedEventManagerAwareInterface' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/SharedEventManagerAwareInterface.php', 'Zend\\EventManager\\SharedEventManagerInterface' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/SharedEventManagerInterface.php', - 'Zend\\EventManager\\SharedListenerAggregateInterface' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/SharedListenerAggregateInterface.php', - 'Zend\\EventManager\\StaticEventManager' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/StaticEventManager.php', - 'Zend\\Stdlib\\AbstractOptions' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/AbstractOptions.php', - 'Zend\\Stdlib\\ArrayObject' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayObject.php', - 'Zend\\Stdlib\\ArraySerializableInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArraySerializableInterface.php', - 'Zend\\Stdlib\\ArrayStack' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayStack.php', - 'Zend\\Stdlib\\ArrayUtils' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeRemoveKey' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeRemoveKey.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKey' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKey.php', - 'Zend\\Stdlib\\ArrayUtils\\MergeReplaceKeyInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ArrayUtils/MergeReplaceKeyInterface.php', - 'Zend\\Stdlib\\CallbackHandler' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/CallbackHandler.php', - 'Zend\\Stdlib\\DateTime' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/DateTime.php', - 'Zend\\Stdlib\\DispatchableInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/DispatchableInterface.php', - 'Zend\\Stdlib\\ErrorHandler' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ErrorHandler.php', - 'Zend\\Stdlib\\Exception\\BadMethodCallException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/BadMethodCallException.php', - 'Zend\\Stdlib\\Exception\\DomainException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/DomainException.php', - 'Zend\\Stdlib\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/ExceptionInterface.php', - 'Zend\\Stdlib\\Exception\\ExtensionNotLoadedException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/ExtensionNotLoadedException.php', - 'Zend\\Stdlib\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/InvalidArgumentException.php', - 'Zend\\Stdlib\\Exception\\InvalidCallbackException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/InvalidCallbackException.php', - 'Zend\\Stdlib\\Exception\\LogicException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/LogicException.php', - 'Zend\\Stdlib\\Exception\\RuntimeException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Exception/RuntimeException.php', - 'Zend\\Stdlib\\Extractor\\ExtractionInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Extractor/ExtractionInterface.php', - 'Zend\\Stdlib\\Glob' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Glob.php', - 'Zend\\Stdlib\\Guard\\AllGuardsTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/AllGuardsTrait.php', - 'Zend\\Stdlib\\Guard\\ArrayOrTraversableGuardTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/ArrayOrTraversableGuardTrait.php', - 'Zend\\Stdlib\\Guard\\EmptyGuardTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/EmptyGuardTrait.php', - 'Zend\\Stdlib\\Guard\\GuardUtils' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/GuardUtils.php', - 'Zend\\Stdlib\\Guard\\NullGuardTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Guard/NullGuardTrait.php', - 'Zend\\Stdlib\\Hydrator\\AbstractHydrator' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/AbstractHydrator.php', - 'Zend\\Stdlib\\Hydrator\\Aggregate\\AggregateHydrator' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Aggregate/AggregateHydrator.php', - 'Zend\\Stdlib\\Hydrator\\Aggregate\\ExtractEvent' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Aggregate/ExtractEvent.php', - 'Zend\\Stdlib\\Hydrator\\Aggregate\\HydrateEvent' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydrateEvent.php', - 'Zend\\Stdlib\\Hydrator\\Aggregate\\HydratorListener' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Aggregate/HydratorListener.php', - 'Zend\\Stdlib\\Hydrator\\ArraySerializable' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/ArraySerializable.php', - 'Zend\\Stdlib\\Hydrator\\ClassMethods' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/ClassMethods.php', - 'Zend\\Stdlib\\Hydrator\\DelegatingHydrator' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/DelegatingHydrator.php', - 'Zend\\Stdlib\\Hydrator\\DelegatingHydratorFactory' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/DelegatingHydratorFactory.php', - 'Zend\\Stdlib\\Hydrator\\FilterEnabledInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/FilterEnabledInterface.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\FilterComposite' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Filter/FilterComposite.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\FilterInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Filter/FilterInterface.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\FilterProviderInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Filter/FilterProviderInterface.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\GetFilter' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Filter/GetFilter.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\HasFilter' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Filter/HasFilter.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\IsFilter' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Filter/IsFilter.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\MethodMatchFilter' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Filter/MethodMatchFilter.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\NumberOfParameterFilter' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Filter/NumberOfParameterFilter.php', - 'Zend\\Stdlib\\Hydrator\\Filter\\OptionalParametersFilter' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Filter/OptionalParametersFilter.php', - 'Zend\\Stdlib\\Hydrator\\HydrationInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/HydrationInterface.php', - 'Zend\\Stdlib\\Hydrator\\HydratorAwareInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/HydratorAwareInterface.php', - 'Zend\\Stdlib\\Hydrator\\HydratorAwareTrait' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/HydratorAwareTrait.php', - 'Zend\\Stdlib\\Hydrator\\HydratorInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/HydratorInterface.php', - 'Zend\\Stdlib\\Hydrator\\HydratorOptionsInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/HydratorOptionsInterface.php', - 'Zend\\Stdlib\\Hydrator\\HydratorPluginManager' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/HydratorPluginManager.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategyEnabledInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategyEnabledInterface.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\ArrayMapNamingStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/ArrayMapNamingStrategy.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\CompositeNamingStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/CompositeNamingStrategy.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\IdentityNamingStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/IdentityNamingStrategy.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\MapNamingStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/MapNamingStrategy.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\NamingStrategyInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/NamingStrategyInterface.php', - 'Zend\\Stdlib\\Hydrator\\NamingStrategy\\UnderscoreNamingStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/NamingStrategy/UnderscoreNamingStrategy.php', - 'Zend\\Stdlib\\Hydrator\\ObjectProperty' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/ObjectProperty.php', - 'Zend\\Stdlib\\Hydrator\\Reflection' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Reflection.php', - 'Zend\\Stdlib\\Hydrator\\StrategyEnabledInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/StrategyEnabledInterface.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\BooleanStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Strategy/BooleanStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\ClosureStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Strategy/ClosureStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\DateTimeFormatterStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Strategy/DateTimeFormatterStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\DefaultStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Strategy/DefaultStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\Exception\\ExceptionInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/ExceptionInterface.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\Exception\\InvalidArgumentException' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Strategy/Exception/InvalidArgumentException.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\ExplodeStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Strategy/ExplodeStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\SerializableStrategy' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Strategy/SerializableStrategy.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\StrategyChain' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyChain.php', - 'Zend\\Stdlib\\Hydrator\\Strategy\\StrategyInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Hydrator/Strategy/StrategyInterface.php', - 'Zend\\Stdlib\\InitializableInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/InitializableInterface.php', - 'Zend\\Stdlib\\JsonSerializable' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/JsonSerializable.php', - 'Zend\\Stdlib\\JsonSerializable\\PhpLegacyCompatibility' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/JsonSerializable/PhpLegacyCompatibility.php', - 'Zend\\Stdlib\\Message' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Message.php', - 'Zend\\Stdlib\\MessageInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/MessageInterface.php', - 'Zend\\Stdlib\\ParameterObjectInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ParameterObjectInterface.php', - 'Zend\\Stdlib\\Parameters' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Parameters.php', - 'Zend\\Stdlib\\ParametersInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ParametersInterface.php', - 'Zend\\Stdlib\\PriorityList' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/PriorityList.php', - 'Zend\\Stdlib\\PriorityQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/PriorityQueue.php', - 'Zend\\Stdlib\\Request' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Request.php', - 'Zend\\Stdlib\\RequestInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/RequestInterface.php', - 'Zend\\Stdlib\\Response' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/Response.php', - 'Zend\\Stdlib\\ResponseInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/ResponseInterface.php', - 'Zend\\Stdlib\\SplPriorityQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/SplPriorityQueue.php', - 'Zend\\Stdlib\\SplQueue' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/SplQueue.php', - 'Zend\\Stdlib\\SplStack' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/SplStack.php', - 'Zend\\Stdlib\\StringUtils' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringUtils.php', - 'Zend\\Stdlib\\StringWrapper\\AbstractStringWrapper' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/AbstractStringWrapper.php', - 'Zend\\Stdlib\\StringWrapper\\Iconv' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/Iconv.php', - 'Zend\\Stdlib\\StringWrapper\\Intl' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/Intl.php', - 'Zend\\Stdlib\\StringWrapper\\MbString' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/MbString.php', - 'Zend\\Stdlib\\StringWrapper\\Native' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/Native.php', - 'Zend\\Stdlib\\StringWrapper\\StringWrapperInterface' => __DIR__ . '/..' . '/zendframework/zend-stdlib/src/StringWrapper/StringWrapperInterface.php', + 'Zend\\EventManager\\SharedEventsCapableInterface' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/SharedEventsCapableInterface.php', + 'Zend\\EventManager\\Test\\EventListenerIntrospectionTrait' => __DIR__ . '/..' . '/zendframework/zend-eventmanager/src/Test/EventListenerIntrospectionTrait.php', 'bantu\\IniGetWrapper\\IniGetWrapper' => __DIR__ . '/..' . '/bantu/ini-get-wrapper/src/IniGetWrapper.php', + 's9e\\RegexpBuilder\\Builder' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Builder.php', + 's9e\\RegexpBuilder\\Escaper' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Escaper.php', + 's9e\\RegexpBuilder\\Input\\BaseImplementation' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Input/BaseImplementation.php', + 's9e\\RegexpBuilder\\Input\\Bytes' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Input/Bytes.php', + 's9e\\RegexpBuilder\\Input\\InputInterface' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Input/InputInterface.php', + 's9e\\RegexpBuilder\\Input\\Utf8' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Input/Utf8.php', + 's9e\\RegexpBuilder\\MetaCharacters' => __DIR__ . '/..' . '/s9e/regexp-builder/src/MetaCharacters.php', + 's9e\\RegexpBuilder\\Output\\BaseImplementation' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Output/BaseImplementation.php', + 's9e\\RegexpBuilder\\Output\\Bytes' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Output/Bytes.php', + 's9e\\RegexpBuilder\\Output\\JavaScript' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Output/JavaScript.php', + 's9e\\RegexpBuilder\\Output\\OutputInterface' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Output/OutputInterface.php', + 's9e\\RegexpBuilder\\Output\\PHP' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Output/PHP.php', + 's9e\\RegexpBuilder\\Output\\PrintableAscii' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Output/PrintableAscii.php', + 's9e\\RegexpBuilder\\Output\\Utf8' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Output/Utf8.php', + 's9e\\RegexpBuilder\\Passes\\AbstractPass' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Passes/AbstractPass.php', + 's9e\\RegexpBuilder\\Passes\\CoalesceOptionalStrings' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Passes/CoalesceOptionalStrings.php', + 's9e\\RegexpBuilder\\Passes\\CoalesceSingleCharacterPrefix' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Passes/CoalesceSingleCharacterPrefix.php', + 's9e\\RegexpBuilder\\Passes\\GroupSingleCharacters' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Passes/GroupSingleCharacters.php', + 's9e\\RegexpBuilder\\Passes\\MergePrefix' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Passes/MergePrefix.php', + 's9e\\RegexpBuilder\\Passes\\MergeSuffix' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Passes/MergeSuffix.php', + 's9e\\RegexpBuilder\\Passes\\PassInterface' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Passes/PassInterface.php', + 's9e\\RegexpBuilder\\Passes\\PromoteSingleStrings' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Passes/PromoteSingleStrings.php', + 's9e\\RegexpBuilder\\Passes\\Recurse' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Passes/Recurse.php', + 's9e\\RegexpBuilder\\Runner' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Runner.php', + 's9e\\RegexpBuilder\\Serializer' => __DIR__ . '/..' . '/s9e/regexp-builder/src/Serializer.php', 's9e\\TextFormatter\\Bundle' => __DIR__ . '/..' . '/s9e/text-formatter/src/Bundle.php', 's9e\\TextFormatter\\Bundles\\Fatdown' => __DIR__ . '/..' . '/s9e/text-formatter/src/Bundles/Fatdown.php', 's9e\\TextFormatter\\Bundles\\Fatdown\\Renderer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Bundles/Fatdown/Renderer.php', @@ -1820,55 +1844,56 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 's9e\\TextFormatter\\Bundles\\MediaPack\\Renderer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Bundles/MediaPack/Renderer.php', 's9e\\TextFormatter\\Configurator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', 's9e\\TextFormatter\\Configurator\\Bundle' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Bundle.php', - 's9e\\TextFormatter\\Configurator\\BundleGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\BundleGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/BundleGenerator.php', 's9e\\TextFormatter\\Configurator\\Bundles\\Fatdown' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Bundles/Fatdown.php', 's9e\\TextFormatter\\Configurator\\Bundles\\Forum' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Bundles/Forum.php', 's9e\\TextFormatter\\Configurator\\Bundles\\MediaPack' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Bundles/MediaPack.php', - 's9e\\TextFormatter\\Configurator\\Collections\\AttributeCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\AttributeFilterChain' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\AttributeFilterCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Collections\\AttributeCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/AttributeCollection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\AttributeFilterChain' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/AttributeFilterChain.php', + 's9e\\TextFormatter\\Configurator\\Collections\\AttributeFilterCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/AttributeFilterCollection.php', 's9e\\TextFormatter\\Configurator\\Collections\\AttributeList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/AttributeList.php', - 's9e\\TextFormatter\\Configurator\\Collections\\AttributePreprocessorCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\Collection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\FilterChain' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\HostnameList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Collections\\AttributePreprocessorCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/AttributePreprocessorCollection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\Collection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/Collection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\FilterChain' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/FilterChain.php', + 's9e\\TextFormatter\\Configurator\\Collections\\HostnameList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/HostnameList.php', 's9e\\TextFormatter\\Configurator\\Collections\\MinifierList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/MinifierList.php', - 's9e\\TextFormatter\\Configurator\\Collections\\NormalizedCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\NormalizedList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\PluginCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\RulesGeneratorList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\Ruleset' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\SchemeList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\TagCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\TagFilterChain' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Collections\\NormalizedCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/NormalizedCollection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\NormalizedList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/NormalizedList.php', + 's9e\\TextFormatter\\Configurator\\Collections\\PluginCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/PluginCollection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\RulesGeneratorList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/RulesGeneratorList.php', + 's9e\\TextFormatter\\Configurator\\Collections\\Ruleset' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/Ruleset.php', + 's9e\\TextFormatter\\Configurator\\Collections\\SchemeList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/SchemeList.php', + 's9e\\TextFormatter\\Configurator\\Collections\\TagCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/TagCollection.php', + 's9e\\TextFormatter\\Configurator\\Collections\\TagFilterChain' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/TagFilterChain.php', 's9e\\TextFormatter\\Configurator\\Collections\\TagList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/TagList.php', - 's9e\\TextFormatter\\Configurator\\Collections\\TemplateCheckList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\TemplateNormalizationList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Collections\\TemplateParameterCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\ConfigProvider' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Collections\\TemplateCheckList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/TemplateCheckList.php', + 's9e\\TextFormatter\\Configurator\\Collections\\TemplateNormalizationList' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/TemplateNormalizationList.php', + 's9e\\TextFormatter\\Configurator\\Collections\\TemplateParameterCollection' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Collections/TemplateParameterCollection.php', + 's9e\\TextFormatter\\Configurator\\ConfigProvider' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/ConfigProvider.php', 's9e\\TextFormatter\\Configurator\\Exceptions\\UnsafeTemplateException' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Exceptions/UnsafeTemplateException.php', - 's9e\\TextFormatter\\Configurator\\FilterableConfigValue' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\AVTHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\CharacterClassBuilder' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\ConfigHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\FilterableConfigValue' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/FilterableConfigValue.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\AVTHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/AVTHelper.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\ConfigHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/ConfigHelper.php', 's9e\\TextFormatter\\Configurator\\Helpers\\ContextSafeness' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/ContextSafeness.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\ElementInspector' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\NodeLocator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\RegexpBuilder' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\ElementInspector' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/ElementInspector.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\FilterHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/FilterHelper.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\FilterSyntaxMatcher' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/FilterSyntaxMatcher.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\NodeLocator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/NodeLocator.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\RegexpBuilder' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/RegexpBuilder.php', 's9e\\TextFormatter\\Configurator\\Helpers\\RegexpParser' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/RegexpParser.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\RulesHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateInspector' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateLoader' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\RulesHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/RulesHelper.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/TemplateHelper.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateInspector' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/TemplateInspector.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateLoader' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/TemplateLoader.php', 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateModifier' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/TemplateModifier.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\IRProcessor' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Normalizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Optimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Parser' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Helpers\\XPathHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\Attribute' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/TemplateParser.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\IRProcessor' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/IRProcessor.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Normalizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/Normalizer.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Optimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/Optimizer.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\TemplateParser\\Parser' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/TemplateParser/Parser.php', + 's9e\\TextFormatter\\Configurator\\Helpers\\XPathHelper' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Helpers/XPathHelper.php', + 's9e\\TextFormatter\\Configurator\\Items\\Attribute' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/Attribute.php', + 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/AttributeFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\AlnumFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/AlnumFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\ChoiceFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/ChoiceFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\ColorFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/ColorFilter.php', @@ -1890,24 +1915,24 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\SimpletextFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/SimpletextFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\TimestampFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/TimestampFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\UintFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/UintFilter.php', - 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\UrlFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Items\\AttributeFilters\\UrlFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/AttributeFilters/UrlFilter.php', 's9e\\TextFormatter\\Configurator\\Items\\AttributePreprocessor' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/AttributePreprocessor.php', - 's9e\\TextFormatter\\Configurator\\Items\\Filter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\ProgrammableCallback' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\Regexp' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\Tag' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\TagFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Items\\Template' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Items\\Filter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/Filter.php', + 's9e\\TextFormatter\\Configurator\\Items\\ProgrammableCallback' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/ProgrammableCallback.php', + 's9e\\TextFormatter\\Configurator\\Items\\Regexp' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/Regexp.php', + 's9e\\TextFormatter\\Configurator\\Items\\Tag' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/Tag.php', + 's9e\\TextFormatter\\Configurator\\Items\\TagFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/TagFilter.php', + 's9e\\TextFormatter\\Configurator\\Items\\Template' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/Template.php', 's9e\\TextFormatter\\Configurator\\Items\\TemplateDocument' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/TemplateDocument.php', 's9e\\TextFormatter\\Configurator\\Items\\UnsafeTemplate' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Items/UnsafeTemplate.php', 's9e\\TextFormatter\\Configurator\\JavaScript' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\CallbackGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/CallbackGenerator.php', - 's9e\\TextFormatter\\Configurator\\JavaScript\\Code' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\JavaScript\\Code' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/Code.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\ConfigOptimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/ConfigOptimizer.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\ConfigValue' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/ConfigValue.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\Dictionary' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/Dictionary.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\Encoder' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/Encoder.php', - 's9e\\TextFormatter\\Configurator\\JavaScript\\FunctionProvider' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\JavaScript\\FunctionProvider' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/FunctionProvider.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\HintGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/HintGenerator.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\Minifier' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/Minifier.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\Minifiers\\ClosureCompilerApplication' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/Minifiers/ClosureCompilerApplication.php', @@ -1918,100 +1943,115 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 's9e\\TextFormatter\\Configurator\\JavaScript\\OnlineMinifier' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/OnlineMinifier.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\RegexpConvertor' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/RegexpConvertor.php', 's9e\\TextFormatter\\Configurator\\JavaScript\\StylesheetCompressor' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/JavaScript/StylesheetCompressor.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\AbstractOptimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\BranchOutputOptimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\ControlStructuresOptimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Optimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Quick' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Serializer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\SwitchStatement' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\RecursiveParser' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RecursiveParser.php', + 's9e\\TextFormatter\\Configurator\\RecursiveParser\\AbstractRecursiveMatcher' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RecursiveParser/AbstractRecursiveMatcher.php', + 's9e\\TextFormatter\\Configurator\\RecursiveParser\\CachingRecursiveParser' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RecursiveParser/CachingRecursiveParser.php', + 's9e\\TextFormatter\\Configurator\\RecursiveParser\\MatcherInterface' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RecursiveParser/MatcherInterface.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerator.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\AbstractOptimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/AbstractOptimizer.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\BranchOutputOptimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/BranchOutputOptimizer.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\ControlStructuresOptimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/ControlStructuresOptimizer.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Optimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/Optimizer.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Quick' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/Quick.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\Serializer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/Serializer.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\SwitchStatement' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/SwitchStatement.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\AbstractConvertor' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/AbstractConvertor.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\BooleanFunctions' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/BooleanFunctions.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\BooleanOperators' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/BooleanOperators.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\Comparisons' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/Comparisons.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\Core' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/Core.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\Math' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/Math.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\MultiByteStringManipulation' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/MultiByteStringManipulation.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\SingleByteStringFunctions' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/SingleByteStringFunctions.php', + 's9e\\TextFormatter\\Configurator\\RendererGenerators\\PHP\\XPathConvertor\\Convertors\\SingleByteStringManipulation' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/PHP/XPathConvertor/Convertors/SingleByteStringManipulation.php', 's9e\\TextFormatter\\Configurator\\RendererGenerators\\Unformatted' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/Unformatted.php', 's9e\\TextFormatter\\Configurator\\RendererGenerators\\XSLT' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/XSLT.php', - 's9e\\TextFormatter\\Configurator\\RendererGenerators\\XSLT\\Optimizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RendererGenerators/XSLT/Optimizer.php', - 's9e\\TextFormatter\\Configurator\\Rendering' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\Rendering' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Rendering.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerator.php', 's9e\\TextFormatter\\Configurator\\RulesGenerators\\AllowAll' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/AllowAll.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\AutoCloseIfVoid' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\AutoReopenFormattingElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\BlockElementsCloseFormattingElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\BlockElementsFosterFormattingElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\DisableAutoLineBreaksIfNewLinesArePreserved' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\EnforceContentModels' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\EnforceOptionalEndTags' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreTagsInCode' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreTextIfDisallowed' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreWhitespaceAroundBlockElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\Interfaces\\BooleanRulesGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\Interfaces\\TargetedRulesGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\AutoCloseIfVoid' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/AutoCloseIfVoid.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\AutoReopenFormattingElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/AutoReopenFormattingElements.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\BlockElementsCloseFormattingElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/BlockElementsCloseFormattingElements.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\BlockElementsFosterFormattingElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/BlockElementsFosterFormattingElements.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\DisableAutoLineBreaksIfNewLinesArePreserved' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/DisableAutoLineBreaksIfNewLinesArePreserved.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\EnforceContentModels' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/EnforceContentModels.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\EnforceOptionalEndTags' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/EnforceOptionalEndTags.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreTagsInCode' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/IgnoreTagsInCode.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreTextIfDisallowed' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/IgnoreTextIfDisallowed.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\IgnoreWhitespaceAroundBlockElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/IgnoreWhitespaceAroundBlockElements.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\Interfaces\\BooleanRulesGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/Interfaces/BooleanRulesGenerator.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\Interfaces\\TargetedRulesGenerator' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/Interfaces/TargetedRulesGenerator.php', 's9e\\TextFormatter\\Configurator\\RulesGenerators\\ManageParagraphs' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/ManageParagraphs.php', - 's9e\\TextFormatter\\Configurator\\RulesGenerators\\TrimFirstLineInCodeBlocks' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateCheck' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecker' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\AbstractDynamicContentCheck' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\AbstractFlashRestriction' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowAttributeSets' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowCopy' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDisableOutputEscaping' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDynamicAttributeNames' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDynamicElementNames' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\RulesGenerators\\TrimFirstLineInCodeBlocks' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/RulesGenerators/TrimFirstLineInCodeBlocks.php', + 's9e\\TextFormatter\\Configurator\\TemplateCheck' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateCheck.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecker' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecker.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\AbstractDynamicContentCheck' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/AbstractDynamicContentCheck.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\AbstractFlashRestriction' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/AbstractFlashRestriction.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowAttributeSets' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowAttributeSets.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowCopy' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowCopy.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDisableOutputEscaping' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowDisableOutputEscaping.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDynamicAttributeNames' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowDynamicAttributeNames.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowDynamicElementNames' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowDynamicElementNames.php', 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowElement' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowElement.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowElementNS' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowElementNS' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowElementNS.php', 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowFlashFullScreen' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowFlashFullScreen.php', 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowNodeByXPath' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowNodeByXPath.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowObjectParamsWithGeneratedName' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowPHPTags' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeCopyOf' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicCSS' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicJS' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicURL' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowXPathFunction' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowObjectParamsWithGeneratedName' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowObjectParamsWithGeneratedName.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowPHPTags' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowPHPTags.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeCopyOf' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeCopyOf.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicCSS' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeDynamicCSS.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicJS' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeDynamicJS.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowUnsafeDynamicURL' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowUnsafeDynamicURL.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\DisallowXPathFunction' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/DisallowXPathFunction.php', 's9e\\TextFormatter\\Configurator\\TemplateChecks\\RestrictFlashNetworking' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/RestrictFlashNetworking.php', - 's9e\\TextFormatter\\Configurator\\TemplateChecks\\RestrictFlashScriptAccess' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractChooseOptimization' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractConstantFolding' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractNormalization' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateChecks\\RestrictFlashScriptAccess' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateChecks/RestrictFlashScriptAccess.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractChooseOptimization' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/AbstractChooseOptimization.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractConstantFolding' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/AbstractConstantFolding.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\AbstractNormalization' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/AbstractNormalization.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\ConvertCurlyExpressionsInText' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/ConvertCurlyExpressionsInText.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\Custom' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/Custom.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\EnforceHTMLOmittedEndTags' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FixUnescapedCurlyBracesInHtmlAttributes' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FoldArithmeticConstants' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FoldConstantXPathExpressions' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineAttributes' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineCDATA' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineInferredValues' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineTextElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineXPathLiterals' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\DeoptimizeIf' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/DeoptimizeIf.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\EnforceHTMLOmittedEndTags' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/EnforceHTMLOmittedEndTags.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FixUnescapedCurlyBracesInHtmlAttributes' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/FixUnescapedCurlyBracesInHtmlAttributes.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FoldArithmeticConstants' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/FoldArithmeticConstants.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\FoldConstantXPathExpressions' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/FoldConstantXPathExpressions.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineAttributes' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineAttributes.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineCDATA' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineCDATA.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineElements.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineInferredValues' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineInferredValues.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineTextElements' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineTextElements.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\InlineXPathLiterals' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/InlineXPathLiterals.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MergeConsecutiveCopyOf' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/MergeConsecutiveCopyOf.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MergeIdenticalConditionalBranches' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/MergeIdenticalConditionalBranches.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MinifyInlineCSS' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MinifyXPathExpressions' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeAttributeNames' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeElementNames' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeUrls' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeChoose' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeChooseText' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeConditionalAttributes' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeConditionalValueOf' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MinifyInlineCSS' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/MinifyInlineCSS.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\MinifyXPathExpressions' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/MinifyXPathExpressions.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeAttributeNames' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/NormalizeAttributeNames.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeElementNames' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/NormalizeElementNames.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\NormalizeUrls' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/NormalizeUrls.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeChoose' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeChoose.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeChooseDeadBranches' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeChooseDeadBranches.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeChooseText' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeChooseText.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeConditionalAttributes' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeConditionalAttributes.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeConditionalValueOf' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeConditionalValueOf.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\OptimizeNestedConditionals' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/OptimizeNestedConditionals.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\PreserveSingleSpaces' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveComments' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveInterElementWhitespace' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveLivePreviewAttributes' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\SetRelNoreferrerOnTargetedLinks' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\PreserveSingleSpaces' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/PreserveSingleSpaces.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveComments' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/RemoveComments.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveInterElementWhitespace' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/RemoveInterElementWhitespace.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RemoveLivePreviewAttributes' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/RemoveLivePreviewAttributes.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\RenameLivePreviewEvent' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/RenameLivePreviewEvent.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\SetRelNoreferrerOnTargetedLinks' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/SetRelNoreferrerOnTargetedLinks.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\SortAttributesByName' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/SortAttributesByName.php', 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\TransposeComments' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/TransposeComments.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\UninlineAttributes' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\TemplateNormalizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Traits\\CollectionProxy' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Traits\\Configurable' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Traits\\TemplateSafeness' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\UrlConfig' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Validators\\AttributeName' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', - 's9e\\TextFormatter\\Configurator\\Validators\\TagName' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizations\\UninlineAttributes' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizations/UninlineAttributes.php', + 's9e\\TextFormatter\\Configurator\\TemplateNormalizer' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/TemplateNormalizer.php', + 's9e\\TextFormatter\\Configurator\\Traits\\CollectionProxy' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Traits/CollectionProxy.php', + 's9e\\TextFormatter\\Configurator\\Traits\\Configurable' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Traits/Configurable.php', + 's9e\\TextFormatter\\Configurator\\Traits\\TemplateSafeness' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Traits/TemplateSafeness.php', + 's9e\\TextFormatter\\Configurator\\UrlConfig' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/UrlConfig.php', + 's9e\\TextFormatter\\Configurator\\Validators\\AttributeName' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Validators/AttributeName.php', + 's9e\\TextFormatter\\Configurator\\Validators\\TagName' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Validators/TagName.php', 's9e\\TextFormatter\\Configurator\\Validators\\TemplateParameterName' => __DIR__ . '/..' . '/s9e/text-formatter/src/Configurator/Validators/TemplateParameterName.php', 's9e\\TextFormatter\\Parser' => __DIR__ . '/..' . '/s9e/text-formatter/src/Parser.php', 's9e\\TextFormatter\\Parser\\AttributeFilters\\EmailFilter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Parser/AttributeFilters/EmailFilter.php', @@ -2066,6 +2106,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 's9e\\TextFormatter\\Plugins\\Litedown\\Parser' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\LinkAttributesSetter' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/LinkAttributesSetter.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\ParsedText' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/ParsedText.php', + 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\AbstractInlineMarkup' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/AbstractInlineMarkup.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\AbstractPass' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/AbstractPass.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\AbstractScript' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/AbstractScript.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\Blocks' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/Blocks.php', @@ -2073,6 +2114,7 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\ForcedLineBreaks' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/ForcedLineBreaks.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\Images' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/Images.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\InlineCode' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/InlineCode.php', + 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\InlineSpoiler' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/InlineSpoiler.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\LinkReferences' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/LinkReferences.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\Links' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/Links.php', 's9e\\TextFormatter\\Plugins\\Litedown\\Parser\\Passes\\Strikethrough' => __DIR__ . '/..' . '/s9e/text-formatter/src/Plugins/Litedown/Parser/Passes/Strikethrough.php', @@ -2110,10 +2152,10 @@ class ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed::$prefixDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed::$prefixesPsr0; - $loader->classMap = ComposerStaticInit55438ae291a1dfe4cf962a21b03284ed::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit5ba2d544c5d0bf61b3c77aaea4d92d6b::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit5ba2d544c5d0bf61b3c77aaea4d92d6b::$prefixDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInit5ba2d544c5d0bf61b3c77aaea4d92d6b::$prefixesPsr0; + $loader->classMap = ComposerStaticInit5ba2d544c5d0bf61b3c77aaea4d92d6b::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 5916772..2e48b38 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -33,30 +33,32 @@ }, { "name": "google/recaptcha", - "version": "1.1.2", - "version_normalized": "1.1.2.0", + "version": "1.2.3", + "version_normalized": "1.2.3.0", "source": { "type": "git", "url": "https://github.com/google/recaptcha.git", - "reference": "2b7e00566afca82a38a1d3adb8e42c118006296e" + "reference": "98c4a6573b27e8b0990ea8789c74ea378795134c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/recaptcha/zipball/2b7e00566afca82a38a1d3adb8e42c118006296e", - "reference": "2b7e00566afca82a38a1d3adb8e42c118006296e", + "url": "https://api.github.com/repos/google/recaptcha/zipball/98c4a6573b27e8b0990ea8789c74ea378795134c", + "reference": "98c4a6573b27e8b0990ea8789c74ea378795134c", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "4.5.*" + "friendsofphp/php-cs-fixer": "^2.2.20|^2.15", + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7.5.11" }, - "time": "2015-09-02T17:23:59+00:00", + "time": "2019-08-16T15:48:25+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } }, "installation-source": "dist", @@ -69,8 +71,8 @@ "license": [ "BSD-3-Clause" ], - "description": "Client library for reCAPTCHA, a free service that protect websites from spam and abuse.", - "homepage": "http://www.google.com/recaptcha/", + "description": "Client library for reCAPTCHA, a free service that protects websites from spam and abuse.", + "homepage": "https://www.google.com/recaptcha/", "keywords": [ "Abuse", "captcha", @@ -80,35 +82,49 @@ }, { "name": "guzzlehttp/guzzle", - "version": "5.3.3", - "version_normalized": "5.3.3.0", + "version": "6.5.2", + "version_normalized": "6.5.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "93bbdb30d59be6cd9839495306c65f2907370eb9" + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/93bbdb30d59be6cd9839495306c65f2907370eb9", - "reference": "93bbdb30d59be6cd9839495306c65f2907370eb9", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/43ece0e75098b7ecd8d13918293029e555a50f82", + "reference": "43ece0e75098b7ecd8d13918293029e555a50f82", "shasum": "" }, "require": { - "guzzlehttp/ringphp": "^1.1", - "php": ">=5.4.0", - "react/promise": "^2.2" + "ext-json": "*", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.6.1", + "php": ">=5.5" }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.1" }, - "time": "2018-07-31T13:33:10+00:00", + "suggest": { + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "time": "2019-12-23T11:57:10+00:00", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.5-dev" + } + }, "installation-source": "dist", "autoload": { "psr-4": { "GuzzleHttp\\": "src/" - } + }, + "files": [ + "src/functions_include.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -121,7 +137,7 @@ "homepage": "https://github.com/mtdowling" } ], - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", + "description": "Guzzle is a PHP HTTP client library", "homepage": "http://guzzlephp.org/", "keywords": [ "client", @@ -134,134 +150,40 @@ ] }, { - "name": "guzzlehttp/ringphp", - "version": "1.1.1", - "version_normalized": "1.1.1.0", + "name": "guzzlehttp/promises", + "version": "v1.3.1", + "version_normalized": "1.3.1.0", "source": { "type": "git", - "url": "https://github.com/guzzle/RingPHP.git", - "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b" + "url": "https://github.com/guzzle/promises.git", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/RingPHP/zipball/5e2a174052995663dd68e6b5ad838afd47dd615b", - "reference": "5e2a174052995663dd68e6b5ad838afd47dd615b", + "url": "https://api.github.com/repos/guzzle/promises/zipball/a59da6cf61d80060647ff4d3eb2c03a2bc694646", + "reference": "a59da6cf61d80060647ff4d3eb2c03a2bc694646", "shasum": "" }, "require": { - "guzzlehttp/streams": "~3.0", - "php": ">=5.4.0", - "react/promise": "~2.0" + "php": ">=5.5.0" }, "require-dev": { - "ext-curl": "*", - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.0" }, - "suggest": { - "ext-curl": "Guzzle will use specific adapters if cURL is present" - }, - "time": "2018-07-31T13:22:33+00:00", + "time": "2016-12-20T10:07:11+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "1.4-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "GuzzleHttp\\Ring\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple API and specification that abstracts away the details of HTTP into a single PHP function." - }, - { - "name": "guzzlehttp/streams", - "version": "3.0.0", - "version_normalized": "3.0.0.0", - "source": { - "type": "git", - "url": "https://github.com/guzzle/streams.git", - "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/guzzle/streams/zipball/47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", - "reference": "47aaa48e27dae43d39fc1cea0ccf0d84ac1a2ba5", - "shasum": "" - }, - "require": { - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "time": "2014-10-12T19:18:40+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "GuzzleHttp\\Stream\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Provides a simple abstraction over streams of data", - "homepage": "http://guzzlephp.org/", - "keywords": [ - "Guzzle", - "stream" - ] - }, - { - "name": "ircmaxell/password-compat", - "version": "v1.0.4", - "version_normalized": "1.0.4.0", - "source": { - "type": "git", - "url": "https://github.com/ircmaxell/password_compat.git", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ircmaxell/password_compat/zipball/5c5cde8822a69545767f7c7f3058cb15ff84614c", - "reference": "5c5cde8822a69545767f7c7f3058cb15ff84614c", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "4.*" - }, - "time": "2014-11-20T16:49:30+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { + "GuzzleHttp\\Promise\\": "src/" + }, "files": [ - "lib/password.php" + "src/functions_include.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -270,16 +192,87 @@ ], "authors": [ { - "name": "Anthony Ferrara", - "email": "ircmaxell@php.net", - "homepage": "http://blog.ircmaxell.com" + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" } ], - "description": "A compatibility library for the proposed simplified password hashing algorithm: https://wiki.php.net/rfc/password_hash", - "homepage": "https://github.com/ircmaxell/password_compat", + "description": "Guzzle promises library", "keywords": [ - "hashing", - "password" + "promise" + ] + }, + { + "name": "guzzlehttp/psr7", + "version": "1.6.1", + "version_normalized": "1.6.1.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/239400de7a173fe9901b9ac7c06497751f00727a", + "reference": "239400de7a173fe9901b9ac7c06497751f00727a", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "ext-zlib": "*", + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "time": "2019-07-01T23:21:34+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" ] }, { @@ -353,17 +346,17 @@ }, { "name": "marc1706/fast-image-size", - "version": "v1.1.4", - "version_normalized": "1.1.4.0", + "version": "v1.1.6", + "version_normalized": "1.1.6.0", "source": { "type": "git", "url": "https://github.com/marc1706/fast-image-size.git", - "reference": "c4ded0223a4e49ae45a2183a69f6afac5baf7250" + "reference": "3a3a2b036be20f43fa06ce00dfa754df503e6684" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/marc1706/fast-image-size/zipball/c4ded0223a4e49ae45a2183a69f6afac5baf7250", - "reference": "c4ded0223a4e49ae45a2183a69f6afac5baf7250", + "url": "https://api.github.com/repos/marc1706/fast-image-size/zipball/3a3a2b036be20f43fa06ce00dfa754df503e6684", + "reference": "3a3a2b036be20f43fa06ce00dfa754df503e6684", "shasum": "" }, "require": { @@ -371,10 +364,15 @@ "php": ">=5.3.0" }, "require-dev": { - "phpunit/phpunit": "4.*" + "phpunit/phpunit": "^4.8" }, - "time": "2017-10-23T18:52:01+00:00", + "time": "2019-12-07T08:02:07+00:00", "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, "installation-source": "dist", "autoload": { "psr-4": { @@ -406,41 +404,99 @@ ] }, { - "name": "ocramius/proxy-manager", - "version": "1.0.2", - "version_normalized": "1.0.2.0", + "name": "ocramius/package-versions", + "version": "1.4.2", + "version_normalized": "1.4.2.0", "source": { "type": "git", - "url": "https://github.com/Ocramius/ProxyManager.git", - "reference": "57e9272ec0e8deccf09421596e0e2252df440e11" + "url": "https://github.com/Ocramius/PackageVersions.git", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/57e9272ec0e8deccf09421596e0e2252df440e11", - "reference": "57e9272ec0e8deccf09421596e0e2252df440e11", + "url": "https://api.github.com/repos/Ocramius/PackageVersions/zipball/44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", + "reference": "44af6f3a2e2e04f2af46bcb302ad9600cba41c7d", "shasum": "" }, "require": { - "php": ">=5.3.3", - "zendframework/zend-code": ">2.2.5,<3.0" + "composer-plugin-api": "^1.0.0", + "php": "^7.1.0" }, "require-dev": { + "composer/composer": "^1.6.3", + "doctrine/coding-standard": "^5.0.1", + "ext-zip": "*", + "infection/infection": "^0.7.1", + "phpunit/phpunit": "^7.5.17" + }, + "time": "2019-11-15T16:17:10+00:00", + "type": "composer-plugin", + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)" + }, + { + "name": "ocramius/proxy-manager", + "version": "2.1.1", + "version_normalized": "2.1.1.0", + "source": { + "type": "git", + "url": "https://github.com/Ocramius/ProxyManager.git", + "reference": "e18ac876b2e4819c76349de8f78ccc8ef1554cd7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Ocramius/ProxyManager/zipball/e18ac876b2e4819c76349de8f78ccc8ef1554cd7", + "reference": "e18ac876b2e4819c76349de8f78ccc8ef1554cd7", + "shasum": "" + }, + "require": { + "ocramius/package-versions": "^1.1.1", + "php": "^7.1.0", + "zendframework/zend-code": "^3.1.0" + }, + "require-dev": { + "couscous/couscous": "^1.5.2", "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "1.5.*" + "humbug/humbug": "dev-master@DEV", + "nikic/php-parser": "^3.0.4", + "phpbench/phpbench": "^0.12.2", + "phpstan/phpstan": "^0.6.4", + "phpunit/phpunit": "^5.6.4", + "phpunit/phpunit-mock-objects": "^3.4.1", + "squizlabs/php_codesniffer": "^2.7.0" }, "suggest": { "ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects", "zendframework/zend-json": "To have the JsonRpc adapter (Remote Object feature)", "zendframework/zend-soap": "To have the Soap adapter (Remote Object feature)", - "zendframework/zend-stdlib": "To use the hydrator proxy", "zendframework/zend-xmlrpc": "To have the XmlRpc adapter (Remote Object feature)" }, - "time": "2015-08-09T04:28:19+00:00", + "time": "2017-05-04T11:12:50+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } }, "installation-source": "dist", @@ -457,7 +513,7 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "http://ocramius.github.io/" } ], "description": "A library providing utilities to generate, instantiate and generally operate with Object Proxies", @@ -472,36 +528,32 @@ }, { "name": "paragonie/random_compat", - "version": "v1.4.3", - "version_normalized": "1.4.3.0", + "version": "v9.99.99", + "version_normalized": "9.99.99.0", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "9b3899e3c3ddde89016f576edb8c489708ad64cd" + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/9b3899e3c3ddde89016f576edb8c489708ad64cd", - "reference": "9b3899e3c3ddde89016f576edb8c489708ad64cd", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", + "reference": "84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95", "shasum": "" }, "require": { - "php": ">=5.2.0" + "php": "^7" }, "require-dev": { - "phpunit/phpunit": "4.*|5.*" + "phpunit/phpunit": "4.*|5.*", + "vimeo/psalm": "^1" }, "suggest": { "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." }, - "time": "2017-03-13T16:22:52+00:00", + "time": "2018-07-02T15:55:56+00:00", "type": "library", "installation-source": "dist", - "autoload": { - "files": [ - "lib/random.php" - ] - }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" @@ -516,36 +568,40 @@ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", "keywords": [ "csprng", + "polyfill", "pseudorandom", "random" ] }, { "name": "patchwork/utf8", - "version": "v1.3.1", - "version_normalized": "1.3.1.0", + "version": "v1.3.2", + "version_normalized": "1.3.2.0", "source": { "type": "git", "url": "https://github.com/tchwork/utf8.git", - "reference": "30ec6451aec7d2536f0af8fe535f70c764f2c47a" + "reference": "d296e0026e7ce10b2a9fe594feca9628ef00e9e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tchwork/utf8/zipball/30ec6451aec7d2536f0af8fe535f70c764f2c47a", - "reference": "30ec6451aec7d2536f0af8fe535f70c764f2c47a", + "url": "https://api.github.com/repos/tchwork/utf8/zipball/d296e0026e7ce10b2a9fe594feca9628ef00e9e8", + "reference": "d296e0026e7ce10b2a9fe594feca9628ef00e9e8", "shasum": "" }, "require": { "lib-pcre": ">=7.3", "php": ">=5.3.0" }, + "require-dev": { + "symfony/phpunit-bridge": "^3.4|^4.4" + }, "suggest": { "ext-iconv": "Use iconv for best performance", "ext-intl": "Use Intl for best performance", "ext-mbstring": "Use Mbstring for best performance", "ext-wfio": "Use WFIO for UTF-8 filesystem access on Windows" }, - "time": "2016-05-18T13:57:10+00:00", + "time": "2019-12-03T14:44:12+00:00", "type": "library", "extra": { "branch-alias": { @@ -582,24 +638,24 @@ ] }, { - "name": "psr/log", - "version": "1.1.0", - "version_normalized": "1.1.0.0", + "name": "psr/container", + "version": "1.0.0", + "version_normalized": "1.0.0.0", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd" + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", - "reference": "6c001f1daafa3a3ac1d8ff69ee4db8e799a654dd", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", "shasum": "" }, "require": { "php": ">=5.3.0" }, - "time": "2018-11-20T15:27:04+00:00", + "time": "2017-02-14T16:28:37+00:00", "type": "library", "extra": { "branch-alias": { @@ -607,6 +663,109 @@ } }, "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ] + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "version_normalized": "1.0.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2016-08-06T14:39:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ] + }, + { + "name": "psr/log", + "version": "1.1.2", + "version_normalized": "1.1.2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", + "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "time": "2019-11-01T11:05:21+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1.x-dev" + } + }, + "installation-source": "dist", "autoload": { "psr-4": { "Psr\\Log\\": "Psr/Log/" @@ -631,35 +790,33 @@ ] }, { - "name": "react/promise", - "version": "v2.7.1", - "version_normalized": "2.7.1.0", + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "version_normalized": "3.0.3.0", "source": { "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d" + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/31ffa96f8d2ed0341a57848cbb84d88b89dd664d", - "reference": "31ffa96f8d2ed0341a57848cbb84d88b89dd664d", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=5.6" }, "require-dev": { - "phpunit/phpunit": "~4.8" + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" }, - "time": "2019-01-07T21:25:54+00:00", + "time": "2019-03-08T08:55:37+00:00", "type": "library", "installation-source": "dist", "autoload": { - "psr-4": { - "React\\Promise\\": "src/" - }, "files": [ - "src/functions_include.php" + "src/getallheaders.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -668,41 +825,77 @@ ], "authors": [ { - "name": "Jan Sorgalla", - "email": "jsorgalla@gmail.com" + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" } ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "description": "A polyfill for getallheaders." + }, + { + "name": "s9e/regexp-builder", + "version": "1.4.3", + "version_normalized": "1.4.3.0", + "source": { + "type": "git", + "url": "https://github.com/s9e/RegexpBuilder.git", + "reference": "59d0167a909659d718f53964f7653d2c83a5f8fe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/s9e/RegexpBuilder/zipball/59d0167a909659d718f53964f7653d2c83a5f8fe", + "reference": "59d0167a909659d718f53964f7653d2c83a5f8fe", + "shasum": "" + }, + "require": { + "lib-pcre": ">=7.2", + "php": ">=5.5.1" + }, + "require-dev": { + "phpunit/phpunit": "<5.8" + }, + "time": "2019-04-26T17:55:23+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "s9e\\RegexpBuilder\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Single-purpose library that generates regular expressions that match a list of strings.", + "homepage": "https://github.com/s9e/RegexpBuilder/", "keywords": [ - "promise", - "promises" + "regexp" ] }, { "name": "s9e/text-formatter", - "version": "1.4.2", - "version_normalized": "1.4.2.0", + "version": "2.3.1", + "version_normalized": "2.3.1.0", "source": { "type": "git", "url": "https://github.com/s9e/TextFormatter.git", - "reference": "dc7efff70b67b9cee00881ad3bef0a1da076b31e" + "reference": "65a0605f163b8ffcf7145357f167b153f31cd168" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/dc7efff70b67b9cee00881ad3bef0a1da076b31e", - "reference": "dc7efff70b67b9cee00881ad3bef0a1da076b31e", + "url": "https://api.github.com/repos/s9e/TextFormatter/zipball/65a0605f163b8ffcf7145357f167b153f31cd168", + "reference": "65a0605f163b8ffcf7145357f167b153f31cd168", "shasum": "" }, "require": { "ext-dom": "*", "ext-filter": "*", - "lib-pcre": ">=7.2", - "php": ">=5.4.7" + "lib-pcre": ">=8.13", + "php": ">=7.1", + "s9e/regexp-builder": "^1.4" }, "require-dev": { "matthiasmullie/minify": "*", - "php-coveralls/php-coveralls": "*", - "s9e/regexp-builder": "1.*" + "phpunit/phpunit": "^7 || 8.2.*" }, "suggest": { "ext-curl": "Improves the performance of the MediaEmbed plugin and some JavaScript minifiers", @@ -713,8 +906,11 @@ "ext-xsl": "Enables the XSLT renderer", "ext-zlib": "Enables gzip compression when scraping content via the MediaEmbed plugin" }, - "time": "2019-03-27T14:19:41+00:00", + "time": "2019-12-26T19:14:01+00:00", "type": "library", + "extra": { + "version": "2.3.1" + }, "installation-source": "dist", "autoload": { "psr-4": { @@ -747,35 +943,42 @@ }, { "name": "symfony/config", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "7dd5f5040dc04c118d057fb5886563963eb70011" + "reference": "a599a867d0e4a07c342b5f1e656b3915a540ddbe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/7dd5f5040dc04c118d057fb5886563963eb70011", - "reference": "7dd5f5040dc04c118d057fb5886563963eb70011", + "url": "https://api.github.com/repos/symfony/config/zipball/a599a867d0e4a07c342b5f1e656b3915a540ddbe", + "reference": "a599a867d0e4a07c342b5f1e656b3915a540ddbe", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/filesystem": "~2.3|~3.0.0", + "php": "^5.5.9|>=7.0.8", + "symfony/filesystem": "~2.8|~3.0|~4.0", "symfony/polyfill-ctype": "~1.8" }, + "conflict": { + "symfony/dependency-injection": "<3.3", + "symfony/finder": "<3.3" + }, "require-dev": { - "symfony/yaml": "~2.7|~3.0.0" + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/event-dispatcher": "~3.3|~4.0", + "symfony/finder": "~3.3|~4.0", + "symfony/yaml": "~3.0|~4.0" }, "suggest": { "symfony/yaml": "To use the yaml reference dumper" }, - "time": "2018-11-26T09:38:12+00:00", + "time": "2019-12-01T10:45:41+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -806,39 +1009,50 @@ }, { "name": "symfony/console", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12" + "reference": "1ee23b3b659b06c622f2bd2492a229e416eb4586" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12", - "reference": "cbcf4b5e233af15cd2bbd50dee1ccc9b7927dc12", + "url": "https://api.github.com/repos/symfony/console/zipball/1ee23b3b659b06c622f2bd2492a229e416eb4586", + "reference": "1ee23b3b659b06c622f2bd2492a229e416eb4586", "shasum": "" }, "require": { - "php": ">=5.3.9", - "symfony/debug": "^2.7.2|~3.0.0", + "php": "^5.5.9|>=7.0.8", + "symfony/debug": "~2.8|~3.0|~4.0", "symfony/polyfill-mbstring": "~1.0" }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { "psr/log": "~1.0", - "symfony/event-dispatcher": "~2.1|~3.0.0", - "symfony/process": "~2.1|~3.0.0" + "symfony/config": "~3.3|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.3|~4.0" }, "suggest": { - "psr/log-implementation": "For using the console logger", + "psr/log": "For using the console logger", "symfony/event-dispatcher": "", + "symfony/lock": "", "symfony/process": "" }, - "time": "2018-11-20T15:55:20+00:00", + "time": "2019-12-01T10:04:45+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -869,35 +1083,34 @@ }, { "name": "symfony/debug", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "74251c8d50dd3be7c4ce0c7b862497cdc641a5d0" + "reference": "f72e33fdb1170b326e72c3157f0cd456351dd086" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/74251c8d50dd3be7c4ce0c7b862497cdc641a5d0", - "reference": "74251c8d50dd3be7c4ce0c7b862497cdc641a5d0", + "url": "https://api.github.com/repos/symfony/debug/zipball/f72e33fdb1170b326e72c3157f0cd456351dd086", + "reference": "f72e33fdb1170b326e72c3157f0cd456351dd086", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0" }, "conflict": { "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" }, "require-dev": { - "symfony/class-loader": "~2.2|~3.0.0", - "symfony/http-kernel": "~2.3.24|~2.5.9|^2.6.2|~3.0.0" + "symfony/http-kernel": "~2.8|~3.0|~4.0" }, - "time": "2018-11-11T11:18:13+00:00", + "time": "2019-10-24T15:33:53+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -928,41 +1141,49 @@ }, { "name": "symfony/dependency-injection", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "a2f40df187f0053bc361bcea3b27ff2b85744d9f" + "reference": "0d201916bfb3af939fec3c0c8815ea16c60ac1a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/a2f40df187f0053bc361bcea3b27ff2b85744d9f", - "reference": "a2f40df187f0053bc361bcea3b27ff2b85744d9f", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/0d201916bfb3af939fec3c0c8815ea16c60ac1a2", + "reference": "0d201916bfb3af939fec3c0c8815ea16c60ac1a2", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8", + "psr/container": "^1.0" }, "conflict": { - "symfony/expression-language": "<2.6" + "symfony/config": "<3.3.7", + "symfony/finder": "<3.3", + "symfony/proxy-manager-bridge": "<3.4", + "symfony/yaml": "<3.4" + }, + "provide": { + "psr/container-implementation": "1.0" }, "require-dev": { - "symfony/config": "~2.2|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/yaml": "~2.3.42|~2.7.14|~2.8.7|~3.0.7" + "symfony/config": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "symfony/config": "", "symfony/expression-language": "For using expressions in service container configuration", + "symfony/finder": "For using double-star glob patterns or when GLOB_BRACE portability is required", "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", "symfony/yaml": "" }, - "time": "2018-11-11T11:18:13+00:00", + "time": "2019-12-01T08:33:36+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -993,38 +1214,41 @@ }, { "name": "symfony/event-dispatcher", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0" + "reference": "f9031c22ec127d4a2450760f81a8677fe8a10177" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a77e974a5fecb4398833b0709210e3d5e334ffb0", - "reference": "a77e974a5fecb4398833b0709210e3d5e334ffb0", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/f9031c22ec127d4a2450760f81a8677fe8a10177", + "reference": "f9031c22ec127d4a2450760f81a8677fe8a10177", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8" + }, + "conflict": { + "symfony/dependency-injection": "<3.3" }, "require-dev": { "psr/log": "~1.0", - "symfony/config": "^2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.6|~3.0.0", - "symfony/expression-language": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0" + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/dependency-injection": "", "symfony/http-kernel": "" }, - "time": "2018-11-21T14:20:20+00:00", + "time": "2019-10-24T15:33:53+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -1055,28 +1279,28 @@ }, { "name": "symfony/filesystem", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "7ae46872dad09dffb7fe1e93a0937097339d0080" + "reference": "00cdad0936d06fab136944bc2342b762b1c3a4a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/7ae46872dad09dffb7fe1e93a0937097339d0080", - "reference": "7ae46872dad09dffb7fe1e93a0937097339d0080", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/00cdad0936d06fab136944bc2342b762b1c3a4a2", + "reference": "00cdad0936d06fab136944bc2342b762b1c3a4a2", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-ctype": "~1.8" }, - "time": "2018-11-11T11:18:13+00:00", + "time": "2019-11-25T16:36:22+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -1107,27 +1331,27 @@ }, { "name": "symfony/finder", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "1444eac52273e345d9b95129bf914639305a9ba4" + "reference": "290ae21279b37bfd287cdcce640d51204e84afdf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/1444eac52273e345d9b95129bf914639305a9ba4", - "reference": "1444eac52273e345d9b95129bf914639305a9ba4", + "url": "https://api.github.com/repos/symfony/finder/zipball/290ae21279b37bfd287cdcce640d51204e84afdf", + "reference": "290ae21279b37bfd287cdcce640d51204e84afdf", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8" }, - "time": "2018-11-11T11:18:13+00:00", + "time": "2019-11-17T21:55:15+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -1158,33 +1382,32 @@ }, { "name": "symfony/http-foundation", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "d0ab719bedc9fc6748a95b2dcb04137292a27b92" + "reference": "d2d0cfe8e319d9df44c4cca570710fcf221d4593" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d0ab719bedc9fc6748a95b2dcb04137292a27b92", - "reference": "d0ab719bedc9fc6748a95b2dcb04137292a27b92", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/d2d0cfe8e319d9df44c4cca570710fcf221d4593", + "reference": "d2d0cfe8e319d9df44c4cca570710fcf221d4593", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-mbstring": "~1.1", - "symfony/polyfill-php54": "~1.0", - "symfony/polyfill-php55": "~1.0" + "symfony/polyfill-php70": "~1.6" }, "require-dev": { - "symfony/expression-language": "~2.4|~3.0.0" + "symfony/expression-language": "~2.8|~3.0|~4.0" }, - "time": "2018-11-25T11:27:05+00:00", + "time": "2019-11-28T12:52:59+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -1215,62 +1438,68 @@ }, { "name": "symfony/http-kernel", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "3df0207d4c973eb9c91b38a608aef4654dc256fa" + "reference": "c42c8339acb28cfff0fb1786948db4d23d609ff7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/3df0207d4c973eb9c91b38a608aef4654dc256fa", - "reference": "3df0207d4c973eb9c91b38a608aef4654dc256fa", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/c42c8339acb28cfff0fb1786948db4d23d609ff7", + "reference": "c42c8339acb28cfff0fb1786948db4d23d609ff7", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": "^5.5.9|>=7.0.8", "psr/log": "~1.0", - "symfony/debug": "^2.6.2", - "symfony/event-dispatcher": "^2.6.7|~3.0.0", - "symfony/http-foundation": "~2.7.36|~2.8.29|~3.1.6", - "symfony/polyfill-ctype": "~1.8" + "symfony/debug": "^3.3.3|~4.0", + "symfony/event-dispatcher": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-php56": "~1.8" }, "conflict": { - "symfony/config": "<2.7", + "symfony/config": "<2.8", + "symfony/dependency-injection": "<3.4.10|<4.0.10,>=4", + "symfony/var-dumper": "<3.3", "twig/twig": "<1.34|<2.4,>=2" }, + "provide": { + "psr/log-implementation": "1.0" + }, "require-dev": { - "symfony/browser-kit": "~2.3|~3.0.0", - "symfony/class-loader": "~2.1|~3.0.0", - "symfony/config": "~2.8", - "symfony/console": "~2.3|~3.0.0", - "symfony/css-selector": "^2.0.5|~3.0.0", - "symfony/dependency-injection": "~2.8|~3.0.0", - "symfony/dom-crawler": "^2.0.5|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", - "symfony/finder": "^2.0.5|~3.0.0", - "symfony/process": "^2.0.5|~3.0.0", - "symfony/routing": "~2.8|~3.0.0", - "symfony/stopwatch": "~2.3|~3.0.0", - "symfony/templating": "~2.2|~3.0.0", - "symfony/translation": "^2.0.5|~3.0.0", - "symfony/var-dumper": "~2.6|~3.0.0" + "psr/cache": "~1.0", + "symfony/browser-kit": "~2.8|~3.0|~4.0", + "symfony/class-loader": "~2.8|~3.0", + "symfony/config": "~2.8|~3.0|~4.0", + "symfony/console": "~2.8|~3.0|~4.0", + "symfony/css-selector": "~2.8|~3.0|~4.0", + "symfony/dependency-injection": "^3.4.10|^4.0.10", + "symfony/dom-crawler": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/process": "~2.8|~3.0|~4.0", + "symfony/routing": "~3.4|~4.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~3.3|~4.0" }, "suggest": { "symfony/browser-kit": "", - "symfony/class-loader": "", "symfony/config": "", "symfony/console": "", "symfony/dependency-injection": "", "symfony/finder": "", "symfony/var-dumper": "" }, - "time": "2018-12-06T14:45:07+00:00", + "time": "2019-12-01T13:50:37+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -1301,17 +1530,17 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.11.0", - "version_normalized": "1.11.0.0", + "version": "v1.13.1", + "version_normalized": "1.13.1.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "82ebae02209c21113908c229e9883c419720738a" + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", - "reference": "82ebae02209c21113908c229e9883c419720738a", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", "shasum": "" }, "require": { @@ -1320,11 +1549,11 @@ "suggest": { "ext-ctype": "For best performance" }, - "time": "2019-02-06T07:57:58+00:00", + "time": "2019-11-27T13:56:44+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.13-dev" } }, "installation-source": "dist", @@ -1342,12 +1571,12 @@ ], "authors": [ { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" }, { - "name": "Gert de Pagter", - "email": "backendtea@gmail.com" + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony polyfill for ctype functions", @@ -1361,17 +1590,17 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.11.0", - "version_normalized": "1.11.0.0", + "version": "v1.13.1", + "version_normalized": "1.13.1.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fe5e94c604826c35a32fa832f35bd036b6799609" + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609", - "reference": "fe5e94c604826c35a32fa832f35bd036b6799609", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", + "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", "shasum": "" }, "require": { @@ -1380,11 +1609,11 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2019-02-06T07:57:58+00:00", + "time": "2019-11-27T14:18:11+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.13-dev" } }, "installation-source": "dist", @@ -1421,34 +1650,93 @@ ] }, { - "name": "symfony/polyfill-php54", - "version": "v1.11.0", - "version_normalized": "1.11.0.0", + "name": "symfony/polyfill-php56", + "version": "v1.13.1", + "version_normalized": "1.13.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php54.git", - "reference": "2964b17ddc32dba7bcba009d5501c84d3fba1452" + "url": "https://github.com/symfony/polyfill-php56.git", + "reference": "53dd1cdf3cb986893ccf2b96665b25b3abb384f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php54/zipball/2964b17ddc32dba7bcba009d5501c84d3fba1452", - "reference": "2964b17ddc32dba7bcba009d5501c84d3fba1452", + "url": "https://api.github.com/repos/symfony/polyfill-php56/zipball/53dd1cdf3cb986893ccf2b96665b25b3abb384f4", + "reference": "53dd1cdf3cb986893ccf2b96665b25b3abb384f4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=5.3.3", + "symfony/polyfill-util": "~1.0" }, - "time": "2019-02-06T07:57:58+00:00", + "time": "2019-11-27T13:56:44+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.13-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php54\\": "" + "Symfony\\Polyfill\\Php56\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ] + }, + { + "name": "symfony/polyfill-php70", + "version": "v1.13.1", + "version_normalized": "1.13.1.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "af23c7bb26a73b850840823662dda371484926c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4", + "reference": "af23c7bb26a73b850840823662dda371484926c4", + "shasum": "" + }, + "require": { + "paragonie/random_compat": "~1.0|~2.0|~9.99", + "php": ">=5.3.3" + }, + "time": "2019-11-27T13:56:44+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.13-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Php70\\": "" }, "files": [ "bootstrap.php" @@ -1471,7 +1759,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 5.4+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -1481,39 +1769,35 @@ ] }, { - "name": "symfony/polyfill-php55", - "version": "v1.11.0", - "version_normalized": "1.11.0.0", + "name": "symfony/polyfill-util", + "version": "v1.13.1", + "version_normalized": "1.13.1.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php55.git", - "reference": "96fa25cef405ea452919559a0025d5dc16e30e4c" + "url": "https://github.com/symfony/polyfill-util.git", + "reference": "964a67f293b66b95883a5ed918a65354fcd2258f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/96fa25cef405ea452919559a0025d5dc16e30e4c", - "reference": "96fa25cef405ea452919559a0025d5dc16e30e4c", + "url": "https://api.github.com/repos/symfony/polyfill-util/zipball/964a67f293b66b95883a5ed918a65354fcd2258f", + "reference": "964a67f293b66b95883a5ed918a65354fcd2258f", "shasum": "" }, "require": { - "ircmaxell/password-compat": "~1.0", "php": ">=5.3.3" }, - "time": "2019-02-06T07:57:58+00:00", + "time": "2019-11-27T13:56:44+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.11-dev" + "dev-master": "1.13-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Symfony\\Polyfill\\Php55\\": "" - }, - "files": [ - "bootstrap.php" - ] + "Symfony\\Polyfill\\Util\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1529,43 +1813,94 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 5.5+ features to lower PHP versions", + "description": "Symfony utilities for portability of PHP codes", "homepage": "https://symfony.com", "keywords": [ + "compat", "compatibility", "polyfill", - "portable", "shim" ] }, { - "name": "symfony/proxy-manager-bridge", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "name": "symfony/process", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", - "url": "https://github.com/symfony/proxy-manager-bridge.git", - "reference": "9c5f8d58e9c8017affdbeaec86c89d558aee4ec8" + "url": "https://github.com/symfony/process.git", + "reference": "9a4545c01e1e4f473492bd52b71e574dcc401ca2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/9c5f8d58e9c8017affdbeaec86c89d558aee4ec8", - "reference": "9c5f8d58e9c8017affdbeaec86c89d558aee4ec8", + "url": "https://api.github.com/repos/symfony/process/zipball/9a4545c01e1e4f473492bd52b71e574dcc401ca2", + "reference": "9a4545c01e1e4f473492bd52b71e574dcc401ca2", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8" + }, + "time": "2019-11-28T10:05:51+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.4-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com" + }, + { + "name": "symfony/proxy-manager-bridge", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/proxy-manager-bridge.git", + "reference": "3c185a0e45ea13334aaf7b0fa9726922816ebec6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/proxy-manager-bridge/zipball/3c185a0e45ea13334aaf7b0fa9726922816ebec6", + "reference": "3c185a0e45ea13334aaf7b0fa9726922816ebec6", "shasum": "" }, "require": { "ocramius/proxy-manager": "~0.4|~1.0|~2.0", - "php": ">=5.3.9", - "symfony/dependency-injection": "~2.8|~3.0.0" + "php": "^5.5.9|>=7.0.8", + "symfony/dependency-injection": "~3.4|~4.0" }, "require-dev": { - "symfony/config": "~2.3|~3.0.0" + "symfony/config": "~2.8|~3.0|~4.0" }, - "time": "2018-11-11T11:18:13+00:00", + "time": "2019-08-29T14:54:55+00:00", "type": "symfony-bridge", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -1596,46 +1931,48 @@ }, { "name": "symfony/routing", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "8b0df6869d1997baafff6a1541826eac5a03d067" + "reference": "b689ccd48e234ea404806d94b07eeb45f9f6f06a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/8b0df6869d1997baafff6a1541826eac5a03d067", - "reference": "8b0df6869d1997baafff6a1541826eac5a03d067", + "url": "https://api.github.com/repos/symfony/routing/zipball/b689ccd48e234ea404806d94b07eeb45f9f6f06a", + "reference": "b689ccd48e234ea404806d94b07eeb45f9f6f06a", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": "^5.5.9|>=7.0.8" }, "conflict": { - "symfony/config": "<2.7" + "symfony/config": "<3.3.1", + "symfony/dependency-injection": "<3.3", + "symfony/yaml": "<3.4" }, "require-dev": { "doctrine/annotations": "~1.0", "psr/log": "~1.0", - "symfony/config": "~2.7|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", - "symfony/http-foundation": "~2.3|~3.0.0", - "symfony/yaml": "^2.0.5|~3.0.0" + "symfony/config": "^3.3.1|~4.0", + "symfony/dependency-injection": "~3.3|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/http-foundation": "~2.8|~3.0|~4.0", + "symfony/yaml": "~3.4|~4.0" }, "suggest": { "doctrine/annotations": "For using the annotation loader", "symfony/config": "For using the all-in-one router or any loader", - "symfony/dependency-injection": "For loading routes from a service", "symfony/expression-language": "For using expression matching", "symfony/http-foundation": "For using a Symfony Request object", "symfony/yaml": "For using the YAML loader" }, - "time": "2018-11-20T15:55:20+00:00", + "time": "2019-12-01T08:33:36+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -1672,43 +2009,48 @@ }, { "name": "symfony/twig-bridge", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/twig-bridge.git", - "reference": "ecc1e30d05fa99f25b504e2d6a8684555ae39f7c" + "reference": "49b824ddc7f2d250a1f172349cd9a111d63287c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/ecc1e30d05fa99f25b504e2d6a8684555ae39f7c", - "reference": "ecc1e30d05fa99f25b504e2d6a8684555ae39f7c", + "url": "https://api.github.com/repos/symfony/twig-bridge/zipball/49b824ddc7f2d250a1f172349cd9a111d63287c0", + "reference": "49b824ddc7f2d250a1f172349cd9a111d63287c0", "shasum": "" }, "require": { - "php": ">=5.3.9", - "twig/twig": "~1.34|~2.4" + "php": "^5.5.9|>=7.0.8", + "twig/twig": "^1.41|^2.10" }, "conflict": { - "symfony/form": "<2.8.23" + "symfony/console": "<3.4", + "symfony/form": "<3.4.31|>=4.0,<4.3.4" }, "require-dev": { - "symfony/asset": "~2.7|~3.0.0", - "symfony/console": "~2.8|~3.0.0", - "symfony/expression-language": "~2.4|~3.0.0", - "symfony/finder": "~2.3|~3.0.0", - "symfony/form": "^2.8.23", - "symfony/http-foundation": "^2.8.29|~3.0.0", - "symfony/http-kernel": "~2.8|~3.0.0", + "fig/link-util": "^1.0", + "symfony/asset": "~2.8|~3.0|~4.0", + "symfony/console": "~3.4|~4.0", + "symfony/dependency-injection": "~2.8|~3.0|~4.0", + "symfony/expression-language": "~2.8|~3.0|~4.0", + "symfony/finder": "~2.8|~3.0|~4.0", + "symfony/form": "^3.4.31|^4.3.4", + "symfony/http-foundation": "^3.3.11|~4.0", + "symfony/http-kernel": "~3.2|~4.0", "symfony/polyfill-intl-icu": "~1.0", - "symfony/routing": "~2.2|~3.0.0", - "symfony/security": "^2.8.31|^3.3.13", - "symfony/security-acl": "~2.6|~3.0.0", - "symfony/stopwatch": "~2.2|~3.0.0", - "symfony/templating": "~2.1|~3.0.0", - "symfony/translation": "~2.7|~3.0.0", - "symfony/var-dumper": "~2.7.16|~2.8.9|~3.0.9", - "symfony/yaml": "^2.0.5|~3.0.0" + "symfony/routing": "~2.8|~3.0|~4.0", + "symfony/security": "^2.8.31|^3.3.13|~4.0", + "symfony/security-acl": "~2.8|~3.0", + "symfony/stopwatch": "~2.8|~3.0|~4.0", + "symfony/templating": "~2.8|~3.0|~4.0", + "symfony/translation": "~2.8|~3.0|~4.0", + "symfony/var-dumper": "~2.8.10|~3.1.4|~3.2|~4.0", + "symfony/web-link": "~3.3|~4.0", + "symfony/workflow": "~3.3|~4.0", + "symfony/yaml": "~2.8|~3.0|~4.0" }, "suggest": { "symfony/asset": "For using the AssetExtension", @@ -1722,13 +2064,14 @@ "symfony/templating": "For using the TwigEngine", "symfony/translation": "For using the TranslationExtension", "symfony/var-dumper": "For using the DumpExtension", + "symfony/web-link": "For using the WebLinkExtension", "symfony/yaml": "For using the YamlExtension" }, - "time": "2018-11-11T11:18:13+00:00", + "time": "2019-11-30T08:19:08+00:00", "type": "symfony-bridge", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -1759,28 +2102,37 @@ }, { "name": "symfony/yaml", - "version": "v2.8.49", - "version_normalized": "2.8.49.0", + "version": "v3.4.36", + "version_normalized": "3.4.36.0", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "02c1859112aa779d9ab394ae4f3381911d84052b" + "reference": "dab657db15207879217fc81df4f875947bf68804" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/02c1859112aa779d9ab394ae4f3381911d84052b", - "reference": "02c1859112aa779d9ab394ae4f3381911d84052b", + "url": "https://api.github.com/repos/symfony/yaml/zipball/dab657db15207879217fc81df4f875947bf68804", + "reference": "dab657db15207879217fc81df4f875947bf68804", "shasum": "" }, "require": { - "php": ">=5.3.9", + "php": "^5.5.9|>=7.0.8", "symfony/polyfill-ctype": "~1.8" }, - "time": "2018-11-11T11:18:13+00:00", + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "time": "2019-10-24T15:33:53+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.8-dev" + "dev-master": "3.4-dev" } }, "installation-source": "dist", @@ -1811,33 +2163,34 @@ }, { "name": "twig/twig", - "version": "v1.39.1", - "version_normalized": "1.39.1.0", + "version": "v2.12.2", + "version_normalized": "2.12.2.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec" + "reference": "d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec", - "reference": "23e7b6f0cfa1d7ba3de69f30d8e05cf957412fec", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed", + "reference": "d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed", "shasum": "" }, "require": { - "php": ">=5.4.0", - "symfony/polyfill-ctype": "^1.8" + "php": "^7.0", + "symfony/polyfill-ctype": "^1.8", + "symfony/polyfill-mbstring": "^1.3" }, "require-dev": { "psr/container": "^1.0", - "symfony/debug": "^2.7", - "symfony/phpunit-bridge": "^3.4.19|^4.1.8" + "symfony/debug": "^3.4|^4.2", + "symfony/phpunit-bridge": "^4.4@dev|^5.0" }, - "time": "2019-04-16T17:12:57+00:00", + "time": "2019-11-11T16:52:09+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.39-dev" + "dev-master": "2.12-dev" } }, "installation-source": "dist", @@ -1860,15 +2213,15 @@ "homepage": "http://fabien.potencier.org", "role": "Lead Developer" }, - { - "name": "Armin Ronacher", - "email": "armin.ronacher@active-4.com", - "role": "Project Founder" - }, { "name": "Twig Team", "homepage": "https://twig.symfony.com/contributors", "role": "Contributors" + }, + { + "name": "Armin Ronacher", + "email": "armin.ronacher@active-4.com", + "role": "Project Founder" } ], "description": "Twig, the flexible, fast, and secure template language for PHP", @@ -1879,40 +2232,44 @@ }, { "name": "zendframework/zend-code", - "version": "2.5.1", - "version_normalized": "2.5.1.0", + "version": "3.4.1", + "version_normalized": "3.4.1.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-code.git", - "reference": "5d998f261ec2a55171c71da57a11622745680153" + "reference": "268040548f92c2bfcba164421c1add2ba43abaaa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-code/zipball/5d998f261ec2a55171c71da57a11622745680153", - "reference": "5d998f261ec2a55171c71da57a11622745680153", + "url": "https://api.github.com/repos/zendframework/zend-code/zipball/268040548f92c2bfcba164421c1add2ba43abaaa", + "reference": "268040548f92c2bfcba164421c1add2ba43abaaa", "shasum": "" }, "require": { - "php": ">=5.3.23", - "zendframework/zend-eventmanager": "~2.5" + "php": "^7.1", + "zendframework/zend-eventmanager": "^2.6 || ^3.0" + }, + "conflict": { + "phpspec/prophecy": "<1.9.0" }, "require-dev": { - "doctrine/common": ">=2.1", - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-stdlib": "~2.5", - "zendframework/zend-version": "~2.5" + "doctrine/annotations": "^1.7", + "ext-phar": "*", + "phpunit/phpunit": "^7.5.16 || ^8.4", + "zendframework/zend-coding-standard": "^1.0", + "zendframework/zend-stdlib": "^2.7 || ^3.0" }, "suggest": { - "doctrine/common": "Doctrine\\Common >=2.1 for annotation features", + "doctrine/annotations": "Doctrine\\Common\\Annotations >=1.0 for annotation features", "zendframework/zend-stdlib": "Zend\\Stdlib component" }, - "time": "2015-06-03T15:31:59+00:00", + "time": "2019-12-10T19:21:15+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" + "dev-master": "3.4.x-dev", + "dev-develop": "3.5.x-dev", + "dev-dev-4.0": "4.0.x-dev" } }, "installation-source": "dist", @@ -1925,42 +2282,48 @@ "license": [ "BSD-3-Clause" ], - "description": "provides facilities to generate arbitrary code using an object oriented interface", - "homepage": "https://github.com/zendframework/zend-code", + "description": "Extensions to the PHP Reflection API, static code scanning, and code generation", "keywords": [ + "ZendFramework", "code", - "zf2" + "zf" ] }, { "name": "zendframework/zend-eventmanager", - "version": "2.5.1", - "version_normalized": "2.5.1.0", + "version": "3.2.1", + "version_normalized": "3.2.1.0", "source": { "type": "git", "url": "https://github.com/zendframework/zend-eventmanager.git", - "reference": "d94a16039144936f107f906896349900fd634443" + "reference": "a5e2583a211f73604691586b8406ff7296a946dd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/d94a16039144936f107f906896349900fd634443", - "reference": "d94a16039144936f107f906896349900fd634443", + "url": "https://api.github.com/repos/zendframework/zend-eventmanager/zipball/a5e2583a211f73604691586b8406ff7296a946dd", + "reference": "a5e2583a211f73604691586b8406ff7296a946dd", "shasum": "" }, "require": { - "php": ">=5.3.23", - "zendframework/zend-stdlib": "~2.5" + "php": "^5.6 || ^7.0" }, "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0" + "athletic/athletic": "^0.1", + "container-interop/container-interop": "^1.1.0", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1.2", + "zendframework/zend-coding-standard": "~1.0.0", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0" }, - "time": "2015-06-03T15:32:01+00:00", + "suggest": { + "container-interop/container-interop": "^1.1.0, to use the lazy listeners feature", + "zendframework/zend-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature" + }, + "time": "2018-04-25T15:33:34+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" + "dev-master": "3.2-dev", + "dev-develop": "3.3-dev" } }, "installation-source": "dist", @@ -1973,67 +2336,12 @@ "license": [ "BSD-3-Clause" ], + "description": "Trigger and listen to events within a PHP application", "homepage": "https://github.com/zendframework/zend-eventmanager", "keywords": [ + "event", "eventmanager", - "zf2" - ] - }, - { - "name": "zendframework/zend-stdlib", - "version": "2.5.1", - "version_normalized": "2.5.1.0", - "source": { - "type": "git", - "url": "https://github.com/zendframework/zend-stdlib.git", - "reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-stdlib/zipball/cc8e90a60dd5d44b9730b77d07b97550091da1ae", - "reference": "cc8e90a60dd5d44b9730b77d07b97550091da1ae", - "shasum": "" - }, - "require": { - "php": ">=5.3.23" - }, - "require-dev": { - "fabpot/php-cs-fixer": "1.7.*", - "phpunit/phpunit": "~4.0", - "zendframework/zend-config": "~2.5", - "zendframework/zend-eventmanager": "~2.5", - "zendframework/zend-filter": "~2.5", - "zendframework/zend-inputfilter": "~2.5", - "zendframework/zend-serializer": "~2.5", - "zendframework/zend-servicemanager": "~2.5" - }, - "suggest": { - "zendframework/zend-eventmanager": "To support aggregate hydrator usage", - "zendframework/zend-filter": "To support naming strategy hydrator usage", - "zendframework/zend-serializer": "Zend\\Serializer component", - "zendframework/zend-servicemanager": "To support hydrator plugin manager usage" - }, - "time": "2015-06-03T15:32:03+00:00", - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev", - "dev-develop": "2.6-dev" - } - }, - "installation-source": "dist", - "autoload": { - "psr-4": { - "Zend\\Stdlib\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "homepage": "https://github.com/zendframework/zend-stdlib", - "keywords": [ - "stdlib", + "events", "zf2" ] } diff --git a/vendor/google/recaptcha/.github/ISSUE_TEMPLATE/bug_report.md b/vendor/google/recaptcha/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..a14dcfe --- /dev/null +++ b/vendor/google/recaptcha/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,28 @@ +--- +name: PHP client issue +about: Report an issue with the PHP client library + +--- + +**Issue description** + + +**Environment** + + + * OS name and version: + * PHP version: + * Web server name and version: + * `google/recaptcha` version: + * Browser name and version: + +**Reproducing the issue** + + + * URL (optional): + * Code (optional): + + ***User steps*** + + + 1. Visit page... diff --git a/vendor/google/recaptcha/ARCHITECTURE.md b/vendor/google/recaptcha/ARCHITECTURE.md new file mode 100644 index 0000000..13add26 --- /dev/null +++ b/vendor/google/recaptcha/ARCHITECTURE.md @@ -0,0 +1,64 @@ +# Architecture + +The general pattern of usage is to instantiate the `ReCaptcha` class with your +secret key, specify any additional validation rules, and then call `verify()` +with the reCAPTCHA response and user's IP address. For example: + +```php +setExpectedHostname('recaptcha-demo.appspot.com') + ->verify($gRecaptchaResponse, $remoteIp); +if ($resp->isSuccess()) { + // Verified! +} else { + $errors = $resp->getErrorCodes(); +} +``` + +By default, this will use the +[`stream_context_create()`](https://secure.php.net/stream_context_create) and +[`file_get_contents()`](https://secure.php.net/file_get_contents) to make a POST +request to the reCAPTCHA service. This is handled by the +[`RequestMethod\Post`](./src/ReCaptcha/RequestMethod/Post.php) class. + +## Alternate request methods + +You may need to use other methods for making requests in your environment. The +[`ReCaptcha`](./src/ReCaptcha/ReCaptcha.php) class allows an optional +[`RequestMethod`](./src/ReCaptcha/RequestMethod.php) instance to configure this. +For example, if you want to use [cURL](https://secure.php.net/curl) instead you +can do this: + +```php +=5.3.2" + "php": ">=5.5" }, "require-dev": { - "phpunit/phpunit": "4.5.*" + "phpunit/phpunit": "^4.8.36|^5.7.27|^6.59|^7.5.11", + "friendsofphp/php-cs-fixer": "^2.2.20|^2.15", + "php-coveralls/php-coveralls": "^2.1" }, "autoload": { "psr-4": { @@ -22,7 +24,16 @@ }, "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-master": "1.2.x-dev" } + }, + "scripts": { + "lint": "vendor/bin/php-cs-fixer -vvv fix --using-cache=no --dry-run .", + "lint-fix": "vendor/bin/php-cs-fixer -vvv fix --using-cache=no .", + "test": "vendor/bin/phpunit --colors=always", + "serve-examples": "@php -S localhost:8080 -t examples" + }, + "config": { + "process-timeout": 0 } } diff --git a/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php b/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php index e2f7c34..177fa44 100644 --- a/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php +++ b/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php @@ -2,26 +2,34 @@ /** * This is a PHP library that handles calling reCAPTCHA. * - * @copyright Copyright (c) 2015, Google Inc. - * @link http://www.google.com/recaptcha + * BSD 3-Clause License + * @copyright (c) 2019, Google Inc. + * @link https://www.google.com/recaptcha + * All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace ReCaptcha; @@ -35,16 +43,82 @@ class ReCaptcha * Version of this client library. * @const string */ - const VERSION = 'php_1.1.2'; + const VERSION = 'php_1.2.3'; + + /** + * URL for reCAPTCHA siteverify API + * @const string + */ + const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; + + /** + * Invalid JSON received + * @const string + */ + const E_INVALID_JSON = 'invalid-json'; + + /** + * Could not connect to service + * @const string + */ + const E_CONNECTION_FAILED = 'connection-failed'; + + /** + * Did not receive a 200 from the service + * @const string + */ + const E_BAD_RESPONSE = 'bad-response'; + + /** + * Not a success, but no error codes received! + * @const string + */ + const E_UNKNOWN_ERROR = 'unknown-error'; + + /** + * ReCAPTCHA response not provided + * @const string + */ + const E_MISSING_INPUT_RESPONSE = 'missing-input-response'; + + /** + * Expected hostname did not match + * @const string + */ + const E_HOSTNAME_MISMATCH = 'hostname-mismatch'; + + /** + * Expected APK package name did not match + * @const string + */ + const E_APK_PACKAGE_NAME_MISMATCH = 'apk_package_name-mismatch'; + + /** + * Expected action did not match + * @const string + */ + const E_ACTION_MISMATCH = 'action-mismatch'; + + /** + * Score threshold not met + * @const string + */ + const E_SCORE_THRESHOLD_NOT_MET = 'score-threshold-not-met'; + + /** + * Challenge timeout + * @const string + */ + const E_CHALLENGE_TIMEOUT = 'challenge-timeout'; /** * Shared secret for the site. - * @var type string + * @var string */ private $secret; /** - * Method used to communicate with service. Defaults to POST request. + * Method used to communicate with service. Defaults to POST request. * @var RequestMethod */ private $requestMethod; @@ -52,8 +126,9 @@ class ReCaptcha /** * Create a configured instance to use the reCAPTCHA service. * - * @param string $secret shared secret between site and reCAPTCHA server. + * @param string $secret The shared key between your site and reCAPTCHA. * @param RequestMethod $requestMethod method used to send the request. Defaults to POST. + * @throws \RuntimeException if $secret is invalid */ public function __construct($secret, RequestMethod $requestMethod = null) { @@ -66,19 +141,14 @@ class ReCaptcha } $this->secret = $secret; - - if (!is_null($requestMethod)) { - $this->requestMethod = $requestMethod; - } else { - $this->requestMethod = new RequestMethod\Post(); - } + $this->requestMethod = (is_null($requestMethod)) ? new RequestMethod\Post() : $requestMethod; } /** * Calls the reCAPTCHA siteverify API to verify whether the user passes - * CAPTCHA test. + * CAPTCHA test and additionally runs any specified additional checks * - * @param string $response The value of 'g-recaptcha-response' in the submitted form. + * @param string $response The user response token provided by reCAPTCHA, verifying the user on your site. * @param string $remoteIp The end user's IP address. * @return Response Response from the service. */ @@ -86,12 +156,114 @@ class ReCaptcha { // Discard empty solution submissions if (empty($response)) { - $recaptchaResponse = new Response(false, array('missing-input-response')); + $recaptchaResponse = new Response(false, array(self::E_MISSING_INPUT_RESPONSE)); return $recaptchaResponse; } $params = new RequestParameters($this->secret, $response, $remoteIp, self::VERSION); $rawResponse = $this->requestMethod->submit($params); - return Response::fromJson($rawResponse); + $initialResponse = Response::fromJson($rawResponse); + $validationErrors = array(); + + if (isset($this->hostname) && strcasecmp($this->hostname, $initialResponse->getHostname()) !== 0) { + $validationErrors[] = self::E_HOSTNAME_MISMATCH; + } + + if (isset($this->apkPackageName) && strcasecmp($this->apkPackageName, $initialResponse->getApkPackageName()) !== 0) { + $validationErrors[] = self::E_APK_PACKAGE_NAME_MISMATCH; + } + + if (isset($this->action) && strcasecmp($this->action, $initialResponse->getAction()) !== 0) { + $validationErrors[] = self::E_ACTION_MISMATCH; + } + + if (isset($this->threshold) && $this->threshold > $initialResponse->getScore()) { + $validationErrors[] = self::E_SCORE_THRESHOLD_NOT_MET; + } + + if (isset($this->timeoutSeconds)) { + $challengeTs = strtotime($initialResponse->getChallengeTs()); + + if ($challengeTs > 0 && time() - $challengeTs > $this->timeoutSeconds) { + $validationErrors[] = self::E_CHALLENGE_TIMEOUT; + } + } + + if (empty($validationErrors)) { + return $initialResponse; + } + + return new Response( + false, + array_merge($initialResponse->getErrorCodes(), $validationErrors), + $initialResponse->getHostname(), + $initialResponse->getChallengeTs(), + $initialResponse->getApkPackageName(), + $initialResponse->getScore(), + $initialResponse->getAction() + ); + } + + /** + * Provide a hostname to match against in verify() + * This should be without a protocol or trailing slash, e.g. www.google.com + * + * @param string $hostname Expected hostname + * @return ReCaptcha Current instance for fluent interface + */ + public function setExpectedHostname($hostname) + { + $this->hostname = $hostname; + return $this; + } + + /** + * Provide an APK package name to match against in verify() + * + * @param string $apkPackageName Expected APK package name + * @return ReCaptcha Current instance for fluent interface + */ + public function setExpectedApkPackageName($apkPackageName) + { + $this->apkPackageName = $apkPackageName; + return $this; + } + + /** + * Provide an action to match against in verify() + * This should be set per page. + * + * @param string $action Expected action + * @return ReCaptcha Current instance for fluent interface + */ + public function setExpectedAction($action) + { + $this->action = $action; + return $this; + } + + /** + * Provide a threshold to meet or exceed in verify() + * Threshold should be a float between 0 and 1 which will be tested as response >= threshold. + * + * @param float $threshold Expected threshold + * @return ReCaptcha Current instance for fluent interface + */ + public function setScoreThreshold($threshold) + { + $this->threshold = floatval($threshold); + return $this; + } + + /** + * Provide a timeout in seconds to test against the challenge timestamp in verify() + * + * @param int $timeoutSeconds Expected hostname + * @return ReCaptcha Current instance for fluent interface + */ + public function setChallengeTimeout($timeoutSeconds) + { + $this->timeoutSeconds = $timeoutSeconds; + return $this; } } diff --git a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php index fc4dde5..0a2a671 100644 --- a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php +++ b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod.php @@ -2,26 +2,34 @@ /** * This is a PHP library that handles calling reCAPTCHA. * - * @copyright Copyright (c) 2015, Google Inc. - * @link http://www.google.com/recaptcha + * BSD 3-Clause License + * @copyright (c) 2019, Google Inc. + * @link https://www.google.com/recaptcha + * All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace ReCaptcha; diff --git a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php index 20ee530..eb99842 100644 --- a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php +++ b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Curl.php @@ -2,26 +2,34 @@ /** * This is a PHP library that handles calling reCAPTCHA. * - * @copyright Copyright (c) 2015, Google Inc. - * @link http://www.google.com/recaptcha + * BSD 3-Clause License + * @copyright (c) 2019, Google Inc. + * @link https://www.google.com/recaptcha + * All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace ReCaptcha\RequestMethod; diff --git a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php index e06d1cc..1bd7cce 100644 --- a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php +++ b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/CurlPost.php @@ -2,30 +2,39 @@ /** * This is a PHP library that handles calling reCAPTCHA. * - * @copyright Copyright (c) 2015, Google Inc. - * @link http://www.google.com/recaptcha + * BSD 3-Clause License + * @copyright (c) 2019, Google Inc. + * @link https://www.google.com/recaptcha + * All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace ReCaptcha\RequestMethod; +use ReCaptcha\ReCaptcha; use ReCaptcha\RequestMethod; use ReCaptcha\RequestParameters; @@ -36,25 +45,28 @@ use ReCaptcha\RequestParameters; */ class CurlPost implements RequestMethod { - /** - * URL to which requests are sent via cURL. - * @const string - */ - const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; - /** * Curl connection to the reCAPTCHA service * @var Curl */ private $curl; - public function __construct(Curl $curl = null) + /** + * URL for reCAPTCHA siteverify API + * @var string + */ + private $siteVerifyUrl; + + /** + * Only needed if you want to override the defaults + * + * @param Curl $curl Curl resource + * @param string $siteVerifyUrl URL for reCAPTCHA siteverify API + */ + public function __construct(Curl $curl = null, $siteVerifyUrl = null) { - if (!is_null($curl)) { - $this->curl = $curl; - } else { - $this->curl = new Curl(); - } + $this->curl = (is_null($curl)) ? new Curl() : $curl; + $this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl; } /** @@ -65,7 +77,7 @@ class CurlPost implements RequestMethod */ public function submit(RequestParameters $params) { - $handle = $this->curl->init(self::SITE_VERIFY_URL); + $handle = $this->curl->init($this->siteVerifyUrl); $options = array( CURLOPT_POST => true, @@ -83,6 +95,10 @@ class CurlPost implements RequestMethod $response = $this->curl->exec($handle); $this->curl->close($handle); - return $response; + if ($response !== false) { + return $response; + } + + return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}'; } } diff --git a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php index 7770d90..a4ff716 100644 --- a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php +++ b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Post.php @@ -2,30 +2,39 @@ /** * This is a PHP library that handles calling reCAPTCHA. * - * @copyright Copyright (c) 2015, Google Inc. - * @link http://www.google.com/recaptcha + * BSD 3-Clause License + * @copyright (c) 2019, Google Inc. + * @link https://www.google.com/recaptcha + * All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace ReCaptcha\RequestMethod; +use ReCaptcha\ReCaptcha; use ReCaptcha\RequestMethod; use ReCaptcha\RequestParameters; @@ -35,10 +44,20 @@ use ReCaptcha\RequestParameters; class Post implements RequestMethod { /** - * URL to which requests are POSTed. - * @const string + * URL for reCAPTCHA siteverify API + * @var string */ - const SITE_VERIFY_URL = 'https://www.google.com/recaptcha/api/siteverify'; + private $siteVerifyUrl; + + /** + * Only needed if you want to override the defaults + * + * @param string $siteVerifyUrl URL for reCAPTCHA siteverify API + */ + public function __construct($siteVerifyUrl = null) + { + $this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl; + } /** * Submit the POST request with the specified parameters. @@ -48,23 +67,22 @@ class Post implements RequestMethod */ public function submit(RequestParameters $params) { - /** - * PHP 5.6.0 changed the way you specify the peer name for SSL context options. - * Using "CN_name" will still work, but it will raise deprecated errors. - */ - $peer_key = version_compare(PHP_VERSION, '5.6.0', '<') ? 'CN_name' : 'peer_name'; $options = array( 'http' => array( 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => $params->toQueryString(), - // Force the peer to validate (not needed in 5.6.0+, but still works + // Force the peer to validate (not needed in 5.6.0+, but still works) 'verify_peer' => true, - // Force the peer validation to use www.google.com - $peer_key => 'www.google.com', ), ); $context = stream_context_create($options); - return file_get_contents(self::SITE_VERIFY_URL, false, $context); + $response = file_get_contents($this->siteVerifyUrl, false, $context); + + if ($response !== false) { + return $response; + } + + return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}'; } } diff --git a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php index d3c8792..236bd5f 100644 --- a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php +++ b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/Socket.php @@ -2,26 +2,34 @@ /** * This is a PHP library that handles calling reCAPTCHA. * - * @copyright Copyright (c) 2015, Google Inc. - * @link http://www.google.com/recaptcha + * BSD 3-Clause License + * @copyright (c) 2019, Google Inc. + * @link https://www.google.com/recaptcha + * All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace ReCaptcha\RequestMethod; @@ -36,7 +44,7 @@ class Socket /** * fsockopen - * + * * @see http://php.net/fsockopen * @param string $hostname * @param int $port @@ -51,14 +59,13 @@ class Socket if ($this->handle != false && $errno === 0 && $errstr === '') { return $this->handle; - } else { - return false; } + return false; } /** * fwrite - * + * * @see http://php.net/fwrite * @param string $string * @param int $length @@ -71,7 +78,7 @@ class Socket /** * fgets - * + * * @see http://php.net/fgets * @param int $length * @return string @@ -83,7 +90,7 @@ class Socket /** * feof - * + * * @see http://php.net/feof * @return bool */ @@ -94,7 +101,7 @@ class Socket /** * fclose - * + * * @see http://php.net/fclose * @return bool */ diff --git a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php index 4754121..7edffb8 100644 --- a/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php +++ b/vendor/google/recaptcha/src/ReCaptcha/RequestMethod/SocketPost.php @@ -2,61 +2,49 @@ /** * This is a PHP library that handles calling reCAPTCHA. * - * @copyright Copyright (c) 2015, Google Inc. - * @link http://www.google.com/recaptcha + * BSD 3-Clause License + * @copyright (c) 2019, Google Inc. + * @link https://www.google.com/recaptcha + * All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace ReCaptcha\RequestMethod; +use ReCaptcha\ReCaptcha; use ReCaptcha\RequestMethod; use ReCaptcha\RequestParameters; /** * Sends a POST request to the reCAPTCHA service, but makes use of fsockopen() * instead of get_file_contents(). This is to account for people who may be on - * servers where allow_furl_open is disabled. + * servers where allow_url_open is disabled. */ class SocketPost implements RequestMethod { - /** - * reCAPTCHA service host. - * @const string - */ - const RECAPTCHA_HOST = 'www.google.com'; - - /** - * @const string reCAPTCHA service path - */ - const SITE_VERIFY_PATH = '/recaptcha/api/siteverify'; - - /** - * @const string Bad request error - */ - const BAD_REQUEST = '{"success": false, "error-codes": ["invalid-request"]}'; - - /** - * @const string Bad response error - */ - const BAD_RESPONSE = '{"success": false, "error-codes": ["invalid-response"]}'; - /** * Socket to the reCAPTCHA service * @var Socket @@ -64,17 +52,15 @@ class SocketPost implements RequestMethod private $socket; /** - * Constructor + * Only needed if you want to override the defaults * * @param \ReCaptcha\RequestMethod\Socket $socket optional socket, injectable for testing + * @param string $siteVerifyUrl URL for reCAPTCHA siteverify API */ - public function __construct(Socket $socket = null) + public function __construct(Socket $socket = null, $siteVerifyUrl = null) { - if (!is_null($socket)) { - $this->socket = $socket; - } else { - $this->socket = new Socket(); - } + $this->socket = (is_null($socket)) ? new Socket() : $socket; + $this->siteVerifyUrl = (is_null($siteVerifyUrl)) ? ReCaptcha::SITE_VERIFY_URL : $siteVerifyUrl; } /** @@ -87,15 +73,16 @@ class SocketPost implements RequestMethod { $errno = 0; $errstr = ''; + $urlParsed = parse_url($this->siteVerifyUrl); - if (false === $this->socket->fsockopen('ssl://' . self::RECAPTCHA_HOST, 443, $errno, $errstr, 30)) { - return self::BAD_REQUEST; + if (false === $this->socket->fsockopen('ssl://' . $urlParsed['host'], 443, $errno, $errstr, 30)) { + return '{"success": false, "error-codes": ["'.ReCaptcha::E_CONNECTION_FAILED.'"]}'; } $content = $params->toQueryString(); - $request = "POST " . self::SITE_VERIFY_PATH . " HTTP/1.1\r\n"; - $request .= "Host: " . self::RECAPTCHA_HOST . "\r\n"; + $request = "POST " . $urlParsed['path'] . " HTTP/1.1\r\n"; + $request .= "Host: " . $urlParsed['host'] . "\r\n"; $request .= "Content-Type: application/x-www-form-urlencoded\r\n"; $request .= "Content-length: " . strlen($content) . "\r\n"; $request .= "Connection: close\r\n\r\n"; @@ -111,7 +98,7 @@ class SocketPost implements RequestMethod $this->socket->fclose(); if (0 !== strpos($response, 'HTTP/1.1 200 OK')) { - return self::BAD_RESPONSE; + return '{"success": false, "error-codes": ["'.ReCaptcha::E_BAD_RESPONSE.'"]}'; } $parts = preg_split("#\n\s*\n#Uis", $response); diff --git a/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php b/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php index cb66f26..e9ba453 100644 --- a/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php +++ b/vendor/google/recaptcha/src/ReCaptcha/RequestParameters.php @@ -2,26 +2,34 @@ /** * This is a PHP library that handles calling reCAPTCHA. * - * @copyright Copyright (c) 2015, Google Inc. - * @link http://www.google.com/recaptcha + * BSD 3-Clause License + * @copyright (c) 2019, Google Inc. + * @link https://www.google.com/recaptcha + * All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace ReCaptcha; @@ -32,13 +40,13 @@ namespace ReCaptcha; class RequestParameters { /** - * Site secret. + * The shared key between your site and reCAPTCHA. * @var string */ private $secret; /** - * Form response. + * The user response token provided by reCAPTCHA, verifying the user on your site. * @var string */ private $response; diff --git a/vendor/google/recaptcha/src/ReCaptcha/Response.php b/vendor/google/recaptcha/src/ReCaptcha/Response.php index d2d8a8b..55838c0 100644 --- a/vendor/google/recaptcha/src/ReCaptcha/Response.php +++ b/vendor/google/recaptcha/src/ReCaptcha/Response.php @@ -2,26 +2,34 @@ /** * This is a PHP library that handles calling reCAPTCHA. * - * @copyright Copyright (c) 2015, Google Inc. - * @link http://www.google.com/recaptcha + * BSD 3-Clause License + * @copyright (c) 2019, Google Inc. + * @link https://www.google.com/recaptcha + * All rights reserved. * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. + * 3. Neither the name of the copyright holder nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ namespace ReCaptcha; @@ -32,7 +40,7 @@ namespace ReCaptcha; class Response { /** - * Succes or failure. + * Success or failure. * @var boolean */ private $success = false; @@ -43,6 +51,36 @@ class Response */ private $errorCodes = array(); + /** + * The hostname of the site where the reCAPTCHA was solved. + * @var string + */ + private $hostname; + + /** + * Timestamp of the challenge load (ISO format yyyy-MM-dd'T'HH:mm:ssZZ) + * @var string + */ + private $challengeTs; + + /** + * APK package name + * @var string + */ + private $apkPackageName; + + /** + * Score assigned to the request + * @var float + */ + private $score; + + /** + * Action as specified by the page + * @var string + */ + private $action; + /** * Build the response from the expected JSON returned by the service. * @@ -54,29 +92,45 @@ class Response $responseData = json_decode($json, true); if (!$responseData) { - return new Response(false, array('invalid-json')); + return new Response(false, array(ReCaptcha::E_INVALID_JSON)); } + $hostname = isset($responseData['hostname']) ? $responseData['hostname'] : null; + $challengeTs = isset($responseData['challenge_ts']) ? $responseData['challenge_ts'] : null; + $apkPackageName = isset($responseData['apk_package_name']) ? $responseData['apk_package_name'] : null; + $score = isset($responseData['score']) ? floatval($responseData['score']) : null; + $action = isset($responseData['action']) ? $responseData['action'] : null; + if (isset($responseData['success']) && $responseData['success'] == true) { - return new Response(true); + return new Response(true, array(), $hostname, $challengeTs, $apkPackageName, $score, $action); } if (isset($responseData['error-codes']) && is_array($responseData['error-codes'])) { - return new Response(false, $responseData['error-codes']); + return new Response(false, $responseData['error-codes'], $hostname, $challengeTs, $apkPackageName, $score, $action); } - return new Response(false); + return new Response(false, array(ReCaptcha::E_UNKNOWN_ERROR), $hostname, $challengeTs, $apkPackageName, $score, $action); } /** * Constructor. * * @param boolean $success + * @param string $hostname + * @param string $challengeTs + * @param string $apkPackageName + * @param float $score + * @param string $action * @param array $errorCodes */ - public function __construct($success, array $errorCodes = array()) + public function __construct($success, array $errorCodes = array(), $hostname = null, $challengeTs = null, $apkPackageName = null, $score = null, $action = null) { $this->success = $success; + $this->hostname = $hostname; + $this->challengeTs = $challengeTs; + $this->apkPackageName = $apkPackageName; + $this->score = $score; + $this->action = $action; $this->errorCodes = $errorCodes; } @@ -99,4 +153,66 @@ class Response { return $this->errorCodes; } + + /** + * Get hostname. + * + * @return string + */ + public function getHostname() + { + return $this->hostname; + } + + /** + * Get challenge timestamp + * + * @return string + */ + public function getChallengeTs() + { + return $this->challengeTs; + } + + /** + * Get APK package name + * + * @return string + */ + public function getApkPackageName() + { + return $this->apkPackageName; + } + /** + * Get score + * + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * Get action + * + * @return string + */ + public function getAction() + { + return $this->action; + } + + public function toArray() + { + return array( + 'success' => $this->isSuccess(), + 'hostname' => $this->getHostname(), + 'challenge_ts' => $this->getChallengeTs(), + 'apk_package_name' => $this->getApkPackageName(), + 'score' => $this->getScore(), + 'action' => $this->getAction(), + 'error-codes' => $this->getErrorCodes(), + ); + } } diff --git a/vendor/google/recaptcha/src/autoload.php b/vendor/google/recaptcha/src/autoload.php index a53cbd7..7947a10 100644 --- a/vendor/google/recaptcha/src/autoload.php +++ b/vendor/google/recaptcha/src/autoload.php @@ -1,16 +1,45 @@ setRiskyAllowed(true) + ->setRules([ + '@PSR2' => true, + 'array_syntax' => ['syntax' => 'short'], + 'declare_strict_types' => false, + 'concat_space' => ['spacing'=>'one'], + 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], + 'ordered_imports' => true, + // 'phpdoc_align' => ['align'=>'vertical'], + // 'native_function_invocation' => true, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->in(__DIR__.'/src') + ->in(__DIR__.'/tests') + ->name('*.php') + ) +; + +return $config; diff --git a/vendor/guzzlehttp/guzzle/Dockerfile b/vendor/guzzlehttp/guzzle/Dockerfile new file mode 100644 index 0000000..f6a0952 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/Dockerfile @@ -0,0 +1,18 @@ +FROM composer:latest as setup + +RUN mkdir /guzzle + +WORKDIR /guzzle + +RUN set -xe \ + && composer init --name=guzzlehttp/test --description="Simple project for testing Guzzle scripts" --author="Márk Sági-Kazár " --no-interaction \ + && composer require guzzlehttp/guzzle + + +FROM php:7.3 + +RUN mkdir /guzzle + +WORKDIR /guzzle + +COPY --from=setup /guzzle /guzzle diff --git a/vendor/guzzlehttp/guzzle/LICENSE b/vendor/guzzlehttp/guzzle/LICENSE index 9af9fba..50a177b 100644 --- a/vendor/guzzlehttp/guzzle/LICENSE +++ b/vendor/guzzlehttp/guzzle/LICENSE @@ -1,4 +1,4 @@ -Copyright (c) 2011-2015 Michael Dowling, https://github.com/mtdowling +Copyright (c) 2011-2018 Michael Dowling, https://github.com/mtdowling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/guzzlehttp/guzzle/composer.json b/vendor/guzzlehttp/guzzle/composer.json index d8bb120..bbf0ff2 100644 --- a/vendor/guzzlehttp/guzzle/composer.json +++ b/vendor/guzzlehttp/guzzle/composer.json @@ -1,8 +1,16 @@ { "name": "guzzlehttp/guzzle", "type": "library", - "description": "Guzzle is a PHP HTTP client library and framework for building RESTful web service clients", - "keywords": ["framework", "http", "rest", "web service", "curl", "client", "HTTP client"], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "framework", + "http", + "rest", + "web service", + "curl", + "client", + "HTTP client" + ], "homepage": "http://guzzlephp.org/", "license": "MIT", "authors": [ @@ -13,26 +21,39 @@ } ], "require": { - "php": ">=5.4.0", - "guzzlehttp/ringphp": "^1.1", - "react/promise": "^2.2" + "php": ">=5.5", + "ext-json": "*", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.6.1" }, "require-dev": { "ext-curl": "*", - "phpunit/phpunit": "^4.0" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.4 || ^7.0", + "psr/log": "^1.1" + }, + "suggest": { + "psr/log": "Required for using the Log middleware", + "ext-intl": "Required for Internationalized Domain Name (IDN) support" + }, + "config": { + "sort-packages": true + }, + "extra": { + "branch-alias": { + "dev-master": "6.5-dev" + } }, "autoload": { "psr-4": { "GuzzleHttp\\": "src/" - } + }, + "files": [ + "src/functions_include.php" + ] }, "autoload-dev": { "psr-4": { "GuzzleHttp\\Tests\\": "tests/" } - }, - "scripts": { - "test": "make test", - "test-ci": "make coverage" } } diff --git a/vendor/guzzlehttp/guzzle/src/Client.php b/vendor/guzzlehttp/guzzle/src/Client.php index cf5dd46..f2bf204 100644 --- a/vendor/guzzlehttp/guzzle/src/Client.php +++ b/vendor/guzzlehttp/guzzle/src/Client.php @@ -1,332 +1,326 @@ [ - * 'http://www.foo.com/{version}/', - * ['version' => '123'] - * ], - * 'defaults' => [ - * 'timeout' => 10, - * 'allow_redirects' => false, - * 'proxy' => '192.168.16.1:10' - * ] + * 'base_uri' => 'http://www.foo.com/1.0/', + * 'timeout' => 0, + * 'allow_redirects' => false, + * 'proxy' => '192.168.16.1:10' * ]); * - * @param array $config Client configuration settings - * - base_url: Base URL of the client that is merged into relative URLs. - * Can be a string or an array that contains a URI template followed - * by an associative array of expansion variables to inject into the - * URI template. - * - handler: callable RingPHP handler used to transfer requests - * - message_factory: Factory used to create request and response object - * - defaults: Default request options to apply to each request - * - emitter: Event emitter used for request events - * - fsm: (internal use only) The request finite state machine. A - * function that accepts a transaction and optional final state. The - * function is responsible for transitioning a request through its - * lifecycle events. + * Client configuration settings include the following options: + * + * - handler: (callable) Function that transfers HTTP requests over the + * wire. The function is called with a Psr7\Http\Message\RequestInterface + * and array of transfer options, and must return a + * GuzzleHttp\Promise\PromiseInterface that is fulfilled with a + * Psr7\Http\Message\ResponseInterface on success. "handler" is a + * constructor only option that cannot be overridden in per/request + * options. If no handler is provided, a default handler will be created + * that enables all of the request options below by attaching all of the + * default middleware to the handler. + * - base_uri: (string|UriInterface) Base URI of the client that is merged + * into relative URIs. Can be a string or instance of UriInterface. + * - **: any request option + * + * @param array $config Client configuration settings. + * + * @see \GuzzleHttp\RequestOptions for a list of available request options. */ public function __construct(array $config = []) { - $this->configureBaseUrl($config); + if (!isset($config['handler'])) { + $config['handler'] = HandlerStack::create(); + } elseif (!is_callable($config['handler'])) { + throw new \InvalidArgumentException('handler must be a callable'); + } + + // Convert the base_uri to a UriInterface + if (isset($config['base_uri'])) { + $config['base_uri'] = Psr7\uri_for($config['base_uri']); + } + $this->configureDefaults($config); - - if (isset($config['emitter'])) { - $this->emitter = $config['emitter']; - } - - $this->messageFactory = isset($config['message_factory']) - ? $config['message_factory'] - : new MessageFactory(); - - if (isset($config['fsm'])) { - $this->fsm = $config['fsm']; - } else { - if (isset($config['handler'])) { - $handler = $config['handler']; - } elseif (isset($config['adapter'])) { - $handler = $config['adapter']; - } else { - $handler = Utils::getDefaultHandler(); - } - $this->fsm = new RequestFsm($handler, $this->messageFactory); - } - } - - public function getDefaultOption($keyOrPath = null) - { - return $keyOrPath === null - ? $this->defaults - : Utils::getPath($this->defaults, $keyOrPath); - } - - public function setDefaultOption($keyOrPath, $value) - { - Utils::setPath($this->defaults, $keyOrPath, $value); - } - - public function getBaseUrl() - { - return (string) $this->baseUrl; - } - - public function createRequest($method, $url = null, array $options = []) - { - $options = $this->mergeDefaults($options); - // Use a clone of the client's emitter - $options['config']['emitter'] = clone $this->getEmitter(); - $url = $url || (is_string($url) && strlen($url)) - ? $this->buildUrl($url) - : (string) $this->baseUrl; - - return $this->messageFactory->createRequest($method, $url, $options); - } - - public function get($url = null, $options = []) - { - return $this->send($this->createRequest('GET', $url, $options)); - } - - public function head($url = null, array $options = []) - { - return $this->send($this->createRequest('HEAD', $url, $options)); - } - - public function delete($url = null, array $options = []) - { - return $this->send($this->createRequest('DELETE', $url, $options)); - } - - public function put($url = null, array $options = []) - { - return $this->send($this->createRequest('PUT', $url, $options)); - } - - public function patch($url = null, array $options = []) - { - return $this->send($this->createRequest('PATCH', $url, $options)); - } - - public function post($url = null, array $options = []) - { - return $this->send($this->createRequest('POST', $url, $options)); - } - - public function options($url = null, array $options = []) - { - return $this->send($this->createRequest('OPTIONS', $url, $options)); - } - - public function send(RequestInterface $request) - { - $isFuture = $request->getConfig()->get('future'); - $trans = new Transaction($this, $request, $isFuture); - $fn = $this->fsm; - - try { - $fn($trans); - if ($isFuture) { - // Turn the normal response into a future if needed. - return $trans->response instanceof FutureInterface - ? $trans->response - : new FutureResponse(new FulfilledPromise($trans->response)); - } - // Resolve deep futures if this is not a future - // transaction. This accounts for things like retries - // that do not have an immediate side-effect. - while ($trans->response instanceof FutureInterface) { - $trans->response = $trans->response->wait(); - } - return $trans->response; - } catch (\Exception $e) { - if ($isFuture) { - // Wrap the exception in a promise - return new FutureResponse(new RejectedPromise($e)); - } - throw RequestException::wrapException($trans->request, $e); - } catch (\TypeError $error) { - $exception = new \Exception($error->getMessage(), $error->getCode(), $error); - if ($isFuture) { - // Wrap the exception in a promise - return new FutureResponse(new RejectedPromise($exception)); - } - throw RequestException::wrapException($trans->request, $exception); - } } /** - * Get an array of default options to apply to the client + * @param string $method + * @param array $args * - * @return array + * @return Promise\PromiseInterface */ - protected function getDefaultOptions() + public function __call($method, $args) { - $settings = [ - 'allow_redirects' => true, - 'exceptions' => true, - 'decode_content' => true, - 'verify' => true - ]; - - // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. - // We can only trust the HTTP_PROXY environment variable in a CLI - // process due to the fact that PHP has no reliable mechanism to - // get environment variables that start with "HTTP_". - if (php_sapi_name() == 'cli' && getenv('HTTP_PROXY')) { - $settings['proxy']['http'] = getenv('HTTP_PROXY'); + if (count($args) < 1) { + throw new \InvalidArgumentException('Magic request methods require a URI and optional options array'); } - if ($proxy = getenv('HTTPS_PROXY')) { - $settings['proxy']['https'] = $proxy; - } + $uri = $args[0]; + $opts = isset($args[1]) ? $args[1] : []; - return $settings; + return substr($method, -5) === 'Async' + ? $this->requestAsync(substr($method, 0, -5), $uri, $opts) + : $this->request($method, $uri, $opts); } /** - * Expand a URI template and inherit from the base URL if it's relative + * Asynchronously send an HTTP request. * - * @param string|array $url URL or an array of the URI template to expand - * followed by a hash of template varnames. - * @return string - * @throws \InvalidArgumentException + * @param array $options Request options to apply to the given + * request and to the transfer. See \GuzzleHttp\RequestOptions. + * + * @return Promise\PromiseInterface */ - private function buildUrl($url) + public function sendAsync(RequestInterface $request, array $options = []) { - // URI template (absolute or relative) - if (!is_array($url)) { - return strpos($url, '://') - ? (string) $url - : (string) $this->baseUrl->combine($url); - } + // Merge the base URI into the request URI if needed. + $options = $this->prepareDefaults($options); - if (!isset($url[1])) { - throw new \InvalidArgumentException('You must provide a hash of ' - . 'varname options in the second element of a URL array.'); - } - - // Absolute URL - if (strpos($url[0], '://')) { - return Utils::uriTemplate($url[0], $url[1]); - } - - // Combine the relative URL with the base URL - return (string) $this->baseUrl->combine( - Utils::uriTemplate($url[0], $url[1]) + return $this->transfer( + $request->withUri($this->buildUri($request->getUri(), $options), $request->hasHeader('Host')), + $options ); } - private function configureBaseUrl(&$config) + /** + * Send an HTTP request. + * + * @param array $options Request options to apply to the given + * request and to the transfer. See \GuzzleHttp\RequestOptions. + * + * @return ResponseInterface + * @throws GuzzleException + */ + public function send(RequestInterface $request, array $options = []) { - if (!isset($config['base_url'])) { - $this->baseUrl = new Url('', ''); - } elseif (!is_array($config['base_url'])) { - $this->baseUrl = Url::fromString($config['base_url']); - } elseif (count($config['base_url']) < 2) { - throw new \InvalidArgumentException('You must provide a hash of ' - . 'varname options in the second element of a base_url array.'); - } else { - $this->baseUrl = Url::fromString( - Utils::uriTemplate( - $config['base_url'][0], - $config['base_url'][1] - ) - ); - $config['base_url'] = (string) $this->baseUrl; - } + $options[RequestOptions::SYNCHRONOUS] = true; + return $this->sendAsync($request, $options)->wait(); } - private function configureDefaults($config) + /** + * Create and send an asynchronous HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. Use an array to provide a URL + * template and additional variables to use in the URL template expansion. + * + * @param string $method HTTP method + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. + * + * @return Promise\PromiseInterface + */ + public function requestAsync($method, $uri = '', array $options = []) { - if (!isset($config['defaults'])) { - $this->defaults = $this->getDefaultOptions(); - } else { - $this->defaults = array_replace( - $this->getDefaultOptions(), - $config['defaults'] - ); + $options = $this->prepareDefaults($options); + // Remove request modifying parameter because it can be done up-front. + $headers = isset($options['headers']) ? $options['headers'] : []; + $body = isset($options['body']) ? $options['body'] : null; + $version = isset($options['version']) ? $options['version'] : '1.1'; + // Merge the URI into the base URI. + $uri = $this->buildUri($uri, $options); + if (is_array($body)) { + $this->invalidBody(); + } + $request = new Psr7\Request($method, $uri, $headers, $body, $version); + // Remove the option so that they are not doubly-applied. + unset($options['headers'], $options['body'], $options['version']); + + return $this->transfer($request, $options); + } + + /** + * Create and send an HTTP request. + * + * Use an absolute path to override the base path of the client, or a + * relative path to append to the base path of the client. The URL can + * contain the query string as well. + * + * @param string $method HTTP method. + * @param string|UriInterface $uri URI object or string. + * @param array $options Request options to apply. See \GuzzleHttp\RequestOptions. + * + * @return ResponseInterface + * @throws GuzzleException + */ + public function request($method, $uri = '', array $options = []) + { + $options[RequestOptions::SYNCHRONOUS] = true; + return $this->requestAsync($method, $uri, $options)->wait(); + } + + /** + * Get a client configuration option. + * + * These options include default request options of the client, a "handler" + * (if utilized by the concrete client), and a "base_uri" if utilized by + * the concrete client. + * + * @param string|null $option The config option to retrieve. + * + * @return mixed + */ + public function getConfig($option = null) + { + return $option === null + ? $this->config + : (isset($this->config[$option]) ? $this->config[$option] : null); + } + + /** + * @param string|null $uri + * + * @return UriInterface + */ + private function buildUri($uri, array $config) + { + // for BC we accept null which would otherwise fail in uri_for + $uri = Psr7\uri_for($uri === null ? '' : $uri); + + if (isset($config['base_uri'])) { + $uri = Psr7\UriResolver::resolve(Psr7\uri_for($config['base_uri']), $uri); } - // Add the default user-agent header - if (!isset($this->defaults['headers'])) { - $this->defaults['headers'] = [ - 'User-Agent' => Utils::getDefaultUserAgent() - ]; - } elseif (!Core::hasHeader($this->defaults, 'User-Agent')) { - // Add the User-Agent header if one was not already set - $this->defaults['headers']['User-Agent'] = Utils::getDefaultUserAgent(); + if (isset($config['idn_conversion']) && ($config['idn_conversion'] !== false)) { + $idnOptions = ($config['idn_conversion'] === true) ? IDNA_DEFAULT : $config['idn_conversion']; + $uri = _idn_uri_convert($uri, $idnOptions); + } + + return $uri->getScheme() === '' && $uri->getHost() !== '' ? $uri->withScheme('http') : $uri; + } + + /** + * Configures the default options for a client. + * + * @param array $config + * @return void + */ + private function configureDefaults(array $config) + { + $defaults = [ + 'allow_redirects' => RedirectMiddleware::$defaultSettings, + 'http_errors' => true, + 'decode_content' => true, + 'verify' => true, + 'cookies' => false + ]; + + // idn_to_ascii() is a part of ext-intl and might be not available + $defaults['idn_conversion'] = function_exists('idn_to_ascii') + // Old ICU versions don't have this constant, so we are basically stuck (see https://github.com/guzzle/guzzle/pull/2424 + // and https://github.com/guzzle/guzzle/issues/2448 for details) + && ( + defined('INTL_IDNA_VARIANT_UTS46') + || + PHP_VERSION_ID < 70200 + ); + + // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. + + // We can only trust the HTTP_PROXY environment variable in a CLI + // process due to the fact that PHP has no reliable mechanism to + // get environment variables that start with "HTTP_". + if (php_sapi_name() === 'cli' && getenv('HTTP_PROXY')) { + $defaults['proxy']['http'] = getenv('HTTP_PROXY'); + } + + if ($proxy = getenv('HTTPS_PROXY')) { + $defaults['proxy']['https'] = $proxy; + } + + if ($noProxy = getenv('NO_PROXY')) { + $cleanedNoProxy = str_replace(' ', '', $noProxy); + $defaults['proxy']['no'] = explode(',', $cleanedNoProxy); + } + + $this->config = $config + $defaults; + + if (!empty($config['cookies']) && $config['cookies'] === true) { + $this->config['cookies'] = new CookieJar(); + } + + // Add the default user-agent header. + if (!isset($this->config['headers'])) { + $this->config['headers'] = ['User-Agent' => default_user_agent()]; + } else { + // Add the User-Agent header if one was not already set. + foreach (array_keys($this->config['headers']) as $name) { + if (strtolower($name) === 'user-agent') { + return; + } + } + $this->config['headers']['User-Agent'] = default_user_agent(); } } /** - * Merges default options into the array passed by reference. + * Merges default options into the array. * * @param array $options Options to modify by reference * * @return array */ - private function mergeDefaults($options) + private function prepareDefaults(array $options) { - $defaults = $this->defaults; + $defaults = $this->config; - // Case-insensitively merge in default headers if both defaults and - // options have headers specified. - if (!empty($defaults['headers']) && !empty($options['headers'])) { - // Create a set of lowercased keys that are present. - $lkeys = []; - foreach (array_keys($options['headers']) as $k) { - $lkeys[strtolower($k)] = true; - } - // Merge in lowercase default keys when not present in above set. - foreach ($defaults['headers'] as $key => $value) { - if (!isset($lkeys[strtolower($key)])) { - $options['headers'][$key] = $value; - } - } - // No longer need to merge in headers. + if (!empty($defaults['headers'])) { + // Default headers are only added if they are not present. + $defaults['_conditional'] = $defaults['headers']; unset($defaults['headers']); } - $result = array_replace_recursive($defaults, $options); - foreach ($options as $k => $v) { + // Special handling for headers is required as they are added as + // conditional headers and as headers passed to a request ctor. + if (array_key_exists('headers', $options)) { + // Allows default headers to be unset. + if ($options['headers'] === null) { + $defaults['_conditional'] = []; + unset($options['headers']); + } elseif (!is_array($options['headers'])) { + throw new \InvalidArgumentException('headers must be an array'); + } + } + + // Shallow merge defaults underneath options. + $result = $options + $defaults; + + // Remove null values. + foreach ($result as $k => $v) { if ($v === null) { unset($result[$k]); } @@ -336,27 +330,182 @@ class Client implements ClientInterface } /** - * @deprecated Use {@see GuzzleHttp\Pool} instead. - * @see GuzzleHttp\Pool + * Transfers the given request and applies request options. + * + * The URI of the request is not modified and the request options are used + * as-is without merging in default options. + * + * @param array $options See \GuzzleHttp\RequestOptions. + * + * @return Promise\PromiseInterface */ - public function sendAll($requests, array $options = []) + private function transfer(RequestInterface $request, array $options) { - Pool::send($this, $requests, $options); + // save_to -> sink + if (isset($options['save_to'])) { + $options['sink'] = $options['save_to']; + unset($options['save_to']); + } + + // exceptions -> http_errors + if (isset($options['exceptions'])) { + $options['http_errors'] = $options['exceptions']; + unset($options['exceptions']); + } + + $request = $this->applyOptions($request, $options); + /** @var HandlerStack $handler */ + $handler = $options['handler']; + + try { + return Promise\promise_for($handler($request, $options)); + } catch (\Exception $e) { + return Promise\rejection_for($e); + } } /** - * @deprecated Use GuzzleHttp\Utils::getDefaultHandler + * Applies the array of request options to a request. + * + * @param RequestInterface $request + * @param array $options + * + * @return RequestInterface */ - public static function getDefaultHandler() + private function applyOptions(RequestInterface $request, array &$options) { - return Utils::getDefaultHandler(); + $modify = [ + 'set_headers' => [], + ]; + + if (isset($options['headers'])) { + $modify['set_headers'] = $options['headers']; + unset($options['headers']); + } + + if (isset($options['form_params'])) { + if (isset($options['multipart'])) { + throw new \InvalidArgumentException('You cannot use ' + . 'form_params and multipart at the same time. Use the ' + . 'form_params option if you want to send application/' + . 'x-www-form-urlencoded requests, and the multipart ' + . 'option to send multipart/form-data requests.'); + } + $options['body'] = http_build_query($options['form_params'], '', '&'); + unset($options['form_params']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'application/x-www-form-urlencoded'; + } + + if (isset($options['multipart'])) { + $options['body'] = new Psr7\MultipartStream($options['multipart']); + unset($options['multipart']); + } + + if (isset($options['json'])) { + $options['body'] = \GuzzleHttp\json_encode($options['json']); + unset($options['json']); + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'application/json'; + } + + if (!empty($options['decode_content']) + && $options['decode_content'] !== true + ) { + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Accept-Encoding'], $options['_conditional']); + $modify['set_headers']['Accept-Encoding'] = $options['decode_content']; + } + + if (isset($options['body'])) { + if (is_array($options['body'])) { + $this->invalidBody(); + } + $modify['body'] = Psr7\stream_for($options['body']); + unset($options['body']); + } + + if (!empty($options['auth']) && is_array($options['auth'])) { + $value = $options['auth']; + $type = isset($value[2]) ? strtolower($value[2]) : 'basic'; + switch ($type) { + case 'basic': + // Ensure that we don't have the header in different case and set the new value. + $modify['set_headers'] = Psr7\_caseless_remove(['Authorization'], $modify['set_headers']); + $modify['set_headers']['Authorization'] = 'Basic ' + . base64_encode("$value[0]:$value[1]"); + break; + case 'digest': + // @todo: Do not rely on curl + $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_DIGEST; + $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]"; + break; + case 'ntlm': + $options['curl'][CURLOPT_HTTPAUTH] = CURLAUTH_NTLM; + $options['curl'][CURLOPT_USERPWD] = "$value[0]:$value[1]"; + break; + } + } + + if (isset($options['query'])) { + $value = $options['query']; + if (is_array($value)) { + $value = http_build_query($value, null, '&', PHP_QUERY_RFC3986); + } + if (!is_string($value)) { + throw new \InvalidArgumentException('query must be a string or array'); + } + $modify['query'] = $value; + unset($options['query']); + } + + // Ensure that sink is not an invalid value. + if (isset($options['sink'])) { + // TODO: Add more sink validation? + if (is_bool($options['sink'])) { + throw new \InvalidArgumentException('sink must not be a boolean'); + } + } + + $request = Psr7\modify_request($request, $modify); + if ($request->getBody() instanceof Psr7\MultipartStream) { + // Use a multipart/form-data POST if a Content-Type is not set. + // Ensure that we don't have the header in different case and set the new value. + $options['_conditional'] = Psr7\_caseless_remove(['Content-Type'], $options['_conditional']); + $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' + . $request->getBody()->getBoundary(); + } + + // Merge in conditional headers if they are not present. + if (isset($options['_conditional'])) { + // Build up the changes so it's in a single clone of the message. + $modify = []; + foreach ($options['_conditional'] as $k => $v) { + if (!$request->hasHeader($k)) { + $modify['set_headers'][$k] = $v; + } + } + $request = Psr7\modify_request($request, $modify); + // Don't pass this internal value along to middleware/handlers. + unset($options['_conditional']); + } + + return $request; } /** - * @deprecated Use GuzzleHttp\Utils::getDefaultUserAgent + * Throw Exception with pre-set message. + * @return void + * @throws InvalidArgumentException Invalid body. */ - public static function getDefaultUserAgent() + private function invalidBody() { - return Utils::getDefaultUserAgent(); + throw new \InvalidArgumentException('Passing in the "body" request ' + . 'option as an array to send a POST request has been deprecated. ' + . 'Please use the "form_params" request option to send a ' + . 'application/x-www-form-urlencoded request, or the "multipart" ' + . 'request option to send a multipart/form-data request.'); } } diff --git a/vendor/guzzlehttp/guzzle/src/ClientInterface.php b/vendor/guzzlehttp/guzzle/src/ClientInterface.php index 6668597..0c8d42a 100644 --- a/vendor/guzzlehttp/guzzle/src/ClientInterface.php +++ b/vendor/guzzlehttp/guzzle/src/ClientInterface.php @@ -1,150 +1,87 @@ getExpires() || $allowSessionCookies) { + if (!$cookie->getDiscard()) { + return true; + } } - return $value; + return false; + } + + /** + * Finds and returns the cookie based on the name + * + * @param string $name cookie name to search for + * @return SetCookie|null cookie that was found or null if not found + */ + public function getCookieByName($name) + { + // don't allow a non string name + if ($name === null || !is_scalar($name)) { + return null; + } + foreach ($this->cookies as $cookie) { + if ($cookie->getName() !== null && strcasecmp($cookie->getName(), $name) === 0) { + return $cookie; + } + } + + return null; } public function toArray() @@ -92,7 +122,7 @@ class CookieJar implements CookieJarInterface, ToArrayInterface } elseif (!$path) { $this->cookies = array_filter( $this->cookies, - function (SetCookie $cookie) use ($path, $domain) { + function (SetCookie $cookie) use ($domain) { return !$cookie->matchesDomain($domain); } ); @@ -128,6 +158,13 @@ class CookieJar implements CookieJarInterface, ToArrayInterface public function setCookie(SetCookie $cookie) { + // If the name string is empty (but not 0), ignore the set-cookie + // string entirely. + $name = $cookie->getName(); + if (!$name && $name !== '0') { + return false; + } + // Only allow cookies with set and valid domain, name, value $result = $cookie->validate(); if ($result !== true) { @@ -194,38 +231,69 @@ class CookieJar implements CookieJarInterface, ToArrayInterface RequestInterface $request, ResponseInterface $response ) { - if ($cookieHeader = $response->getHeaderAsArray('Set-Cookie')) { + if ($cookieHeader = $response->getHeader('Set-Cookie')) { foreach ($cookieHeader as $cookie) { $sc = SetCookie::fromString($cookie); if (!$sc->getDomain()) { - $sc->setDomain($request->getHost()); + $sc->setDomain($request->getUri()->getHost()); + } + if (0 !== strpos($sc->getPath(), '/')) { + $sc->setPath($this->getCookiePathFromRequest($request)); } $this->setCookie($sc); } } } - public function addCookieHeader(RequestInterface $request) + /** + * Computes cookie path following RFC 6265 section 5.1.4 + * + * @link https://tools.ietf.org/html/rfc6265#section-5.1.4 + * + * @param RequestInterface $request + * @return string + */ + private function getCookiePathFromRequest(RequestInterface $request) + { + $uriPath = $request->getUri()->getPath(); + if ('' === $uriPath) { + return '/'; + } + if (0 !== strpos($uriPath, '/')) { + return '/'; + } + if ('/' === $uriPath) { + return '/'; + } + if (0 === $lastSlashPos = strrpos($uriPath, '/')) { + return '/'; + } + + return substr($uriPath, 0, $lastSlashPos); + } + + public function withCookieHeader(RequestInterface $request) { $values = []; - $scheme = $request->getScheme(); - $host = $request->getHost(); - $path = $request->getPath(); + $uri = $request->getUri(); + $scheme = $uri->getScheme(); + $host = $uri->getHost(); + $path = $uri->getPath() ?: '/'; foreach ($this->cookies as $cookie) { if ($cookie->matchesPath($path) && $cookie->matchesDomain($host) && !$cookie->isExpired() && - (!$cookie->getSecure() || $scheme == 'https') + (!$cookie->getSecure() || $scheme === 'https') ) { $values[] = $cookie->getName() . '=' - . self::getCookieValue($cookie->getValue()); + . $cookie->getValue(); } } - if ($values) { - $request->setHeader('Cookie', implode('; ', $values)); - } + return $values + ? $request->withHeader('Cookie', implode('; ', $values)) + : $request; } /** diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php index 4ea8567..6ee1188 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/CookieJarInterface.php @@ -1,8 +1,8 @@ filename = $cookieFile; + $this->storeSessionCookies = $storeSessionCookies; if (file_exists($cookieFile)) { $this->load($cookieFile); @@ -45,15 +50,15 @@ class FileCookieJar extends CookieJar { $json = []; foreach ($this as $cookie) { - if ($cookie->getExpires() && !$cookie->getDiscard()) { + /** @var SetCookie $cookie */ + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { $json[] = $cookie->toArray(); } } - if (false === file_put_contents($filename, json_encode($json))) { - // @codeCoverageIgnoreStart + $jsonStr = \GuzzleHttp\json_encode($json); + if (false === file_put_contents($filename, $jsonStr, LOCK_EX)) { throw new \RuntimeException("Unable to save file {$filename}"); - // @codeCoverageIgnoreEnd } } @@ -69,14 +74,14 @@ class FileCookieJar extends CookieJar { $json = file_get_contents($filename); if (false === $json) { - // @codeCoverageIgnoreStart throw new \RuntimeException("Unable to load file {$filename}"); - // @codeCoverageIgnoreEnd + } elseif ($json === '') { + return; } - $data = Utils::jsonDecode($json, true); + $data = \GuzzleHttp\json_decode($json, true); if (is_array($data)) { - foreach (Utils::jsonDecode($json, true) as $cookie) { + foreach (json_decode($json, true) as $cookie) { $this->setCookie(new SetCookie($cookie)); } } elseif (strlen($data)) { diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php index 71a02d5..0224a24 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php @@ -1,8 +1,6 @@ sessionKey = $sessionKey; + $this->storeSessionCookies = $storeSessionCookies; $this->load(); } @@ -37,7 +43,8 @@ class SessionCookieJar extends CookieJar { $json = []; foreach ($this as $cookie) { - if ($cookie->getExpires() && !$cookie->getDiscard()) { + /** @var SetCookie $cookie */ + if (CookieJar::shouldPersist($cookie, $this->storeSessionCookies)) { $json[] = $cookie->toArray(); } } @@ -50,11 +57,10 @@ class SessionCookieJar extends CookieJar */ protected function load() { - $cookieJar = isset($_SESSION[$this->sessionKey]) - ? $_SESSION[$this->sessionKey] - : null; - - $data = Utils::jsonDecode($cookieJar, true); + if (!isset($_SESSION[$this->sessionKey])) { + return; + } + $data = json_decode($_SESSION[$this->sessionKey], true); if (is_array($data)) { foreach ($data as $cookie) { $this->setCookie(new SetCookie($cookie)); diff --git a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php index 6fdee0d..3d776a7 100644 --- a/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +++ b/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php @@ -1,12 +1,10 @@ data['Name'] . '=' . $this->data['Value'] . '; '; foreach ($this->data as $k => $v) { - if ($k != 'Name' && $k != 'Value' && $v !== null && $v !== false) { - if ($k == 'Expires') { + if ($k !== 'Name' && $k !== 'Value' && $v !== null && $v !== false) { + if ($k === 'Expires') { $str .= 'Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $v) . '; '; } else { $str .= ($v === true ? $k : "{$k}={$v}") . '; '; @@ -230,7 +227,7 @@ class SetCookie implements ToArrayInterface /** * Get whether or not this is a secure cookie * - * @return null|bool + * @return bool|null */ public function getSecure() { @@ -250,7 +247,7 @@ class SetCookie implements ToArrayInterface /** * Get whether or not this is a session cookie * - * @return null|bool + * @return bool|null */ public function getDiscard() { @@ -288,15 +285,43 @@ class SetCookie implements ToArrayInterface } /** - * Check if the cookie matches a path value + * Check if the cookie matches a path value. * - * @param string $path Path to check against + * A request-path path-matches a given cookie-path if at least one of + * the following conditions holds: + * + * - The cookie-path and the request-path are identical. + * - The cookie-path is a prefix of the request-path, and the last + * character of the cookie-path is %x2F ("/"). + * - The cookie-path is a prefix of the request-path, and the first + * character of the request-path that is not included in the cookie- + * path is a %x2F ("/") character. + * + * @param string $requestPath Path to check against * * @return bool */ - public function matchesPath($path) + public function matchesPath($requestPath) { - return !$this->getPath() || 0 === stripos($path, $this->getPath()); + $cookiePath = $this->getPath(); + + // Match on exact matches or when path is the default empty "/" + if ($cookiePath === '/' || $cookiePath == $requestPath) { + return true; + } + + // Ensure that the cookie-path is a prefix of the request path. + if (0 !== strpos($requestPath, $cookiePath)) { + return false; + } + + // Match if the last character of the cookie-path is "/" + if (substr($cookiePath, -1, 1) === '/') { + return true; + } + + // Match if the first character not included in cookie path is "/" + return substr($requestPath, strlen($cookiePath), 1) === '/'; } /** @@ -323,7 +348,7 @@ class SetCookie implements ToArrayInterface return false; } - return (bool) preg_match('/\.' . preg_quote($cookieDomain) . '$/i', $domain); + return (bool) preg_match('/\.' . preg_quote($cookieDomain, '/') . '$/', $domain); } /** @@ -350,8 +375,13 @@ class SetCookie implements ToArrayInterface } // Check if any of the invalid characters are present in the cookie name - if (preg_match("/[=,; \t\r\n\013\014]/", $name)) { - return "Cookie name must not cannot invalid characters: =,; \\t\\r\\n\\013\\014"; + if (preg_match( + '/[\x00-\x20\x22\x28-\x29\x2c\x2f\x3a-\x40\x5c\x7b\x7d\x7f]/', + $name + )) { + return 'Cookie name must not contain invalid characters: ASCII ' + . 'Control characters (0-31;127), space, tab and the ' + . 'following characters: ()<>@,;:\"/?={}'; } // Value must not be empty, but can be 0 diff --git a/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php b/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php index fd78431..427d896 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/BadResponseException.php @@ -1,7 +1,27 @@ getStatusCode() : 0; parent::__construct($message, $code, $previous); $this->request = $request; $this->response = $response; + $this->handlerContext = $handlerContext; } /** @@ -43,13 +47,9 @@ class RequestException extends TransferException */ public static function wrapException(RequestInterface $request, \Exception $e) { - if ($e instanceof RequestException) { - return $e; - } elseif ($e instanceof ConnectException) { - return new HttpConnectException($e->getMessage(), $request, null, $e); - } else { - return new RequestException($e->getMessage(), $request, null, $e); - } + return $e instanceof RequestException + ? $e + : new RequestException($e->getMessage(), $request, null, $e); } /** @@ -58,35 +58,91 @@ class RequestException extends TransferException * @param RequestInterface $request Request * @param ResponseInterface $response Response received * @param \Exception $previous Previous exception + * @param array $ctx Optional handler context. * * @return self */ public static function create( RequestInterface $request, ResponseInterface $response = null, - \Exception $previous = null + \Exception $previous = null, + array $ctx = [] ) { if (!$response) { - return new self('Error completing request', $request, null, $previous); + return new self( + 'Error completing request', + $request, + null, + $previous, + $ctx + ); } - $level = floor($response->getStatusCode() / 100); - if ($level == '4') { - $label = 'Client error response'; - $className = __NAMESPACE__ . '\\ClientException'; - } elseif ($level == '5') { - $label = 'Server error response'; - $className = __NAMESPACE__ . '\\ServerException'; + $level = (int) floor($response->getStatusCode() / 100); + if ($level === 4) { + $label = 'Client error'; + $className = ClientException::class; + } elseif ($level === 5) { + $label = 'Server error'; + $className = ServerException::class; } else { - $label = 'Unsuccessful response'; + $label = 'Unsuccessful request'; $className = __CLASS__; } - $message = $label . ' [url] ' . $request->getUrl() - . ' [status code] ' . $response->getStatusCode() - . ' [reason phrase] ' . $response->getReasonPhrase(); + $uri = $request->getUri(); + $uri = static::obfuscateUri($uri); - return new $className($message, $request, $response, $previous); + // Client Error: `GET /` resulted in a `404 Not Found` response: + // ... (truncated) + $message = sprintf( + '%s: `%s %s` resulted in a `%s %s` response', + $label, + $request->getMethod(), + $uri, + $response->getStatusCode(), + $response->getReasonPhrase() + ); + + $summary = static::getResponseBodySummary($response); + + if ($summary !== null) { + $message .= ":\n{$summary}\n"; + } + + return new $className($message, $request, $response, $previous, $ctx); + } + + /** + * Get a short summary of the response + * + * Will return `null` if the response is not printable. + * + * @param ResponseInterface $response + * + * @return string|null + */ + public static function getResponseBodySummary(ResponseInterface $response) + { + return \GuzzleHttp\Psr7\get_message_body_summary($response); + } + + /** + * Obfuscates URI if there is a username and a password present + * + * @param UriInterface $uri + * + * @return UriInterface + */ + private static function obfuscateUri(UriInterface $uri) + { + $userInfo = $uri->getUserInfo(); + + if (false !== ($pos = strpos($userInfo, ':'))) { + return $uri->withUserInfo(substr($userInfo, 0, $pos), '***'); + } + + return $uri; } /** @@ -118,4 +174,19 @@ class RequestException extends TransferException { return $this->response !== null; } + + /** + * Get contextual information about the error from the underlying handler. + * + * The contents of this array will vary depending on which handler you are + * using. It may also be just an empty array. Relying on this data will + * couple you to a specific handler, but can give more debug information + * when needed. + * + * @return array + */ + public function getHandlerContext() + { + return $this->handlerContext; + } } diff --git a/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php b/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php new file mode 100644 index 0000000..a77c289 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Exception/SeekException.php @@ -0,0 +1,27 @@ +stream = $stream; + $msg = $msg ?: 'Could not seek the stream to position ' . $pos; + parent::__construct($msg); + } + + /** + * @return StreamInterface + */ + public function getStream() + { + return $this->stream; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php index 7cdd340..127094c 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/ServerException.php @@ -4,4 +4,6 @@ namespace GuzzleHttp\Exception; /** * Exception when a server error is encountered (5xx codes) */ -class ServerException extends BadResponseException {} +class ServerException extends BadResponseException +{ +} diff --git a/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php b/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php index b60a967..fff0525 100644 --- a/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php +++ b/vendor/guzzlehttp/guzzle/src/Exception/TooManyRedirectsException.php @@ -1,4 +1,6 @@ maxHandles = $maxHandles; + } + + public function create(RequestInterface $request, array $options) + { + if (isset($options['curl']['body_as_string'])) { + $options['_body_as_string'] = $options['curl']['body_as_string']; + unset($options['curl']['body_as_string']); + } + + $easy = new EasyHandle; + $easy->request = $request; + $easy->options = $options; + $conf = $this->getDefaultConf($easy); + $this->applyMethod($easy, $conf); + $this->applyHandlerOptions($easy, $conf); + $this->applyHeaders($easy, $conf); + unset($conf['_headers']); + + // Add handler options from the request configuration options + if (isset($options['curl'])) { + $conf = array_replace($conf, $options['curl']); + } + + $conf[CURLOPT_HEADERFUNCTION] = $this->createHeaderFn($easy); + $easy->handle = $this->handles + ? array_pop($this->handles) + : curl_init(); + curl_setopt_array($easy->handle, $conf); + + return $easy; + } + + public function release(EasyHandle $easy) + { + $resource = $easy->handle; + unset($easy->handle); + + if (count($this->handles) >= $this->maxHandles) { + curl_close($resource); + } else { + // Remove all callback functions as they can hold onto references + // and are not cleaned up by curl_reset. Using curl_setopt_array + // does not work for some reason, so removing each one + // individually. + curl_setopt($resource, CURLOPT_HEADERFUNCTION, null); + curl_setopt($resource, CURLOPT_READFUNCTION, null); + curl_setopt($resource, CURLOPT_WRITEFUNCTION, null); + curl_setopt($resource, CURLOPT_PROGRESSFUNCTION, null); + curl_reset($resource); + $this->handles[] = $resource; + } + } + + /** + * Completes a cURL transaction, either returning a response promise or a + * rejected promise. + * + * @param callable $handler + * @param EasyHandle $easy + * @param CurlFactoryInterface $factory Dictates how the handle is released + * + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public static function finish( + callable $handler, + EasyHandle $easy, + CurlFactoryInterface $factory + ) { + if (isset($easy->options['on_stats'])) { + self::invokeStats($easy); + } + + if (!$easy->response || $easy->errno) { + return self::finishError($handler, $easy, $factory); + } + + // Return the response if it is present and there is no error. + $factory->release($easy); + + // Rewind the body of the response if possible. + $body = $easy->response->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + + return new FulfilledPromise($easy->response); + } + + private static function invokeStats(EasyHandle $easy) + { + $curlStats = curl_getinfo($easy->handle); + $curlStats['appconnect_time'] = curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME); + $stats = new TransferStats( + $easy->request, + $easy->response, + $curlStats['total_time'], + $easy->errno, + $curlStats + ); + call_user_func($easy->options['on_stats'], $stats); + } + + private static function finishError( + callable $handler, + EasyHandle $easy, + CurlFactoryInterface $factory + ) { + // Get error information and release the handle to the factory. + $ctx = [ + 'errno' => $easy->errno, + 'error' => curl_error($easy->handle), + 'appconnect_time' => curl_getinfo($easy->handle, CURLINFO_APPCONNECT_TIME), + ] + curl_getinfo($easy->handle); + $ctx[self::CURL_VERSION_STR] = curl_version()['version']; + $factory->release($easy); + + // Retry when nothing is present or when curl failed to rewind. + if (empty($easy->options['_err_message']) + && (!$easy->errno || $easy->errno == 65) + ) { + return self::retryFailedRewind($handler, $easy, $ctx); + } + + return self::createRejection($easy, $ctx); + } + + private static function createRejection(EasyHandle $easy, array $ctx) + { + static $connectionErrors = [ + CURLE_OPERATION_TIMEOUTED => true, + CURLE_COULDNT_RESOLVE_HOST => true, + CURLE_COULDNT_CONNECT => true, + CURLE_SSL_CONNECT_ERROR => true, + CURLE_GOT_NOTHING => true, + ]; + + // If an exception was encountered during the onHeaders event, then + // return a rejected promise that wraps that exception. + if ($easy->onHeadersException) { + return \GuzzleHttp\Promise\rejection_for( + new RequestException( + 'An error was encountered during the on_headers event', + $easy->request, + $easy->response, + $easy->onHeadersException, + $ctx + ) + ); + } + if (version_compare($ctx[self::CURL_VERSION_STR], self::LOW_CURL_VERSION_NUMBER)) { + $message = sprintf( + 'cURL error %s: %s (%s)', + $ctx['errno'], + $ctx['error'], + 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html' + ); + } else { + $message = sprintf( + 'cURL error %s: %s (%s) for %s', + $ctx['errno'], + $ctx['error'], + 'see https://curl.haxx.se/libcurl/c/libcurl-errors.html', + $easy->request->getUri() + ); + } + + // Create a connection exception if it was a specific error code. + $error = isset($connectionErrors[$easy->errno]) + ? new ConnectException($message, $easy->request, null, $ctx) + : new RequestException($message, $easy->request, $easy->response, null, $ctx); + + return \GuzzleHttp\Promise\rejection_for($error); + } + + private function getDefaultConf(EasyHandle $easy) + { + $conf = [ + '_headers' => $easy->request->getHeaders(), + CURLOPT_CUSTOMREQUEST => $easy->request->getMethod(), + CURLOPT_URL => (string) $easy->request->getUri()->withFragment(''), + CURLOPT_RETURNTRANSFER => false, + CURLOPT_HEADER => false, + CURLOPT_CONNECTTIMEOUT => 150, + ]; + + if (defined('CURLOPT_PROTOCOLS')) { + $conf[CURLOPT_PROTOCOLS] = CURLPROTO_HTTP | CURLPROTO_HTTPS; + } + + $version = $easy->request->getProtocolVersion(); + if ($version == 1.1) { + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_1; + } elseif ($version == 2.0) { + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_2_0; + } else { + $conf[CURLOPT_HTTP_VERSION] = CURL_HTTP_VERSION_1_0; + } + + return $conf; + } + + private function applyMethod(EasyHandle $easy, array &$conf) + { + $body = $easy->request->getBody(); + $size = $body->getSize(); + + if ($size === null || $size > 0) { + $this->applyBody($easy->request, $easy->options, $conf); + return; + } + + $method = $easy->request->getMethod(); + if ($method === 'PUT' || $method === 'POST') { + // See http://tools.ietf.org/html/rfc7230#section-3.3.2 + if (!$easy->request->hasHeader('Content-Length')) { + $conf[CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; + } + } elseif ($method === 'HEAD') { + $conf[CURLOPT_NOBODY] = true; + unset( + $conf[CURLOPT_WRITEFUNCTION], + $conf[CURLOPT_READFUNCTION], + $conf[CURLOPT_FILE], + $conf[CURLOPT_INFILE] + ); + } + } + + private function applyBody(RequestInterface $request, array $options, array &$conf) + { + $size = $request->hasHeader('Content-Length') + ? (int) $request->getHeaderLine('Content-Length') + : null; + + // Send the body as a string if the size is less than 1MB OR if the + // [curl][body_as_string] request value is set. + if (($size !== null && $size < 1000000) || + !empty($options['_body_as_string']) + ) { + $conf[CURLOPT_POSTFIELDS] = (string) $request->getBody(); + // Don't duplicate the Content-Length header + $this->removeHeader('Content-Length', $conf); + $this->removeHeader('Transfer-Encoding', $conf); + } else { + $conf[CURLOPT_UPLOAD] = true; + if ($size !== null) { + $conf[CURLOPT_INFILESIZE] = $size; + $this->removeHeader('Content-Length', $conf); + } + $body = $request->getBody(); + if ($body->isSeekable()) { + $body->rewind(); + } + $conf[CURLOPT_READFUNCTION] = function ($ch, $fd, $length) use ($body) { + return $body->read($length); + }; + } + + // If the Expect header is not present, prevent curl from adding it + if (!$request->hasHeader('Expect')) { + $conf[CURLOPT_HTTPHEADER][] = 'Expect:'; + } + + // cURL sometimes adds a content-type by default. Prevent this. + if (!$request->hasHeader('Content-Type')) { + $conf[CURLOPT_HTTPHEADER][] = 'Content-Type:'; + } + } + + private function applyHeaders(EasyHandle $easy, array &$conf) + { + foreach ($conf['_headers'] as $name => $values) { + foreach ($values as $value) { + $value = (string) $value; + if ($value === '') { + // cURL requires a special format for empty headers. + // See https://github.com/guzzle/guzzle/issues/1882 for more details. + $conf[CURLOPT_HTTPHEADER][] = "$name;"; + } else { + $conf[CURLOPT_HTTPHEADER][] = "$name: $value"; + } + } + } + + // Remove the Accept header if one was not set + if (!$easy->request->hasHeader('Accept')) { + $conf[CURLOPT_HTTPHEADER][] = 'Accept:'; + } + } + + /** + * Remove a header from the options array. + * + * @param string $name Case-insensitive header to remove + * @param array $options Array of options to modify + */ + private function removeHeader($name, array &$options) + { + foreach (array_keys($options['_headers']) as $key) { + if (!strcasecmp($key, $name)) { + unset($options['_headers'][$key]); + return; + } + } + } + + private function applyHandlerOptions(EasyHandle $easy, array &$conf) + { + $options = $easy->options; + if (isset($options['verify'])) { + if ($options['verify'] === false) { + unset($conf[CURLOPT_CAINFO]); + $conf[CURLOPT_SSL_VERIFYHOST] = 0; + $conf[CURLOPT_SSL_VERIFYPEER] = false; + } else { + $conf[CURLOPT_SSL_VERIFYHOST] = 2; + $conf[CURLOPT_SSL_VERIFYPEER] = true; + if (is_string($options['verify'])) { + // Throw an error if the file/folder/link path is not valid or doesn't exist. + if (!file_exists($options['verify'])) { + throw new \InvalidArgumentException( + "SSL CA bundle not found: {$options['verify']}" + ); + } + // If it's a directory or a link to a directory use CURLOPT_CAPATH. + // If not, it's probably a file, or a link to a file, so use CURLOPT_CAINFO. + if (is_dir($options['verify']) || + (is_link($options['verify']) && is_dir(readlink($options['verify'])))) { + $conf[CURLOPT_CAPATH] = $options['verify']; + } else { + $conf[CURLOPT_CAINFO] = $options['verify']; + } + } + } + } + + if (!empty($options['decode_content'])) { + $accept = $easy->request->getHeaderLine('Accept-Encoding'); + if ($accept) { + $conf[CURLOPT_ENCODING] = $accept; + } else { + $conf[CURLOPT_ENCODING] = ''; + // Don't let curl send the header over the wire + $conf[CURLOPT_HTTPHEADER][] = 'Accept-Encoding:'; + } + } + + if (isset($options['sink'])) { + $sink = $options['sink']; + if (!is_string($sink)) { + $sink = \GuzzleHttp\Psr7\stream_for($sink); + } elseif (!is_dir(dirname($sink))) { + // Ensure that the directory exists before failing in curl. + throw new \RuntimeException(sprintf( + 'Directory %s does not exist for sink value of %s', + dirname($sink), + $sink + )); + } else { + $sink = new LazyOpenStream($sink, 'w+'); + } + $easy->sink = $sink; + $conf[CURLOPT_WRITEFUNCTION] = function ($ch, $write) use ($sink) { + return $sink->write($write); + }; + } else { + // Use a default temp stream if no sink was set. + $conf[CURLOPT_FILE] = fopen('php://temp', 'w+'); + $easy->sink = Psr7\stream_for($conf[CURLOPT_FILE]); + } + $timeoutRequiresNoSignal = false; + if (isset($options['timeout'])) { + $timeoutRequiresNoSignal |= $options['timeout'] < 1; + $conf[CURLOPT_TIMEOUT_MS] = $options['timeout'] * 1000; + } + + // CURL default value is CURL_IPRESOLVE_WHATEVER + if (isset($options['force_ip_resolve'])) { + if ('v4' === $options['force_ip_resolve']) { + $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V4; + } elseif ('v6' === $options['force_ip_resolve']) { + $conf[CURLOPT_IPRESOLVE] = CURL_IPRESOLVE_V6; + } + } + + if (isset($options['connect_timeout'])) { + $timeoutRequiresNoSignal |= $options['connect_timeout'] < 1; + $conf[CURLOPT_CONNECTTIMEOUT_MS] = $options['connect_timeout'] * 1000; + } + + if ($timeoutRequiresNoSignal && strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $conf[CURLOPT_NOSIGNAL] = true; + } + + if (isset($options['proxy'])) { + if (!is_array($options['proxy'])) { + $conf[CURLOPT_PROXY] = $options['proxy']; + } else { + $scheme = $easy->request->getUri()->getScheme(); + if (isset($options['proxy'][$scheme])) { + $host = $easy->request->getUri()->getHost(); + if (!isset($options['proxy']['no']) || + !\GuzzleHttp\is_host_in_noproxy($host, $options['proxy']['no']) + ) { + $conf[CURLOPT_PROXY] = $options['proxy'][$scheme]; + } + } + } + } + + if (isset($options['cert'])) { + $cert = $options['cert']; + if (is_array($cert)) { + $conf[CURLOPT_SSLCERTPASSWD] = $cert[1]; + $cert = $cert[0]; + } + if (!file_exists($cert)) { + throw new \InvalidArgumentException( + "SSL certificate not found: {$cert}" + ); + } + $conf[CURLOPT_SSLCERT] = $cert; + } + + if (isset($options['ssl_key'])) { + if (is_array($options['ssl_key'])) { + if (count($options['ssl_key']) === 2) { + list($sslKey, $conf[CURLOPT_SSLKEYPASSWD]) = $options['ssl_key']; + } else { + list($sslKey) = $options['ssl_key']; + } + } + + $sslKey = isset($sslKey) ? $sslKey: $options['ssl_key']; + + if (!file_exists($sslKey)) { + throw new \InvalidArgumentException( + "SSL private key not found: {$sslKey}" + ); + } + $conf[CURLOPT_SSLKEY] = $sslKey; + } + + if (isset($options['progress'])) { + $progress = $options['progress']; + if (!is_callable($progress)) { + throw new \InvalidArgumentException( + 'progress client option must be callable' + ); + } + $conf[CURLOPT_NOPROGRESS] = false; + $conf[CURLOPT_PROGRESSFUNCTION] = function () use ($progress) { + $args = func_get_args(); + // PHP 5.5 pushed the handle onto the start of the args + if (is_resource($args[0])) { + array_shift($args); + } + call_user_func_array($progress, $args); + }; + } + + if (!empty($options['debug'])) { + $conf[CURLOPT_STDERR] = \GuzzleHttp\debug_resource($options['debug']); + $conf[CURLOPT_VERBOSE] = true; + } + } + + /** + * This function ensures that a response was set on a transaction. If one + * was not set, then the request is retried if possible. This error + * typically means you are sending a payload, curl encountered a + * "Connection died, retrying a fresh connect" error, tried to rewind the + * stream, and then encountered a "necessary data rewind wasn't possible" + * error, causing the request to be sent through curl_multi_info_read() + * without an error status. + */ + private static function retryFailedRewind( + callable $handler, + EasyHandle $easy, + array $ctx + ) { + try { + // Only rewind if the body has been read from. + $body = $easy->request->getBody(); + if ($body->tell() > 0) { + $body->rewind(); + } + } catch (\RuntimeException $e) { + $ctx['error'] = 'The connection unexpectedly failed without ' + . 'providing an error. The request would have been retried, ' + . 'but attempting to rewind the request body failed. ' + . 'Exception: ' . $e; + return self::createRejection($easy, $ctx); + } + + // Retry no more than 3 times before giving up. + if (!isset($easy->options['_curl_retries'])) { + $easy->options['_curl_retries'] = 1; + } elseif ($easy->options['_curl_retries'] == 2) { + $ctx['error'] = 'The cURL request was retried 3 times ' + . 'and did not succeed. The most likely reason for the failure ' + . 'is that cURL was unable to rewind the body of the request ' + . 'and subsequent retries resulted in the same error. Turn on ' + . 'the debug option to see what went wrong. See ' + . 'https://bugs.php.net/bug.php?id=47204 for more information.'; + return self::createRejection($easy, $ctx); + } else { + $easy->options['_curl_retries']++; + } + + return $handler($easy->request, $easy->options); + } + + private function createHeaderFn(EasyHandle $easy) + { + if (isset($easy->options['on_headers'])) { + $onHeaders = $easy->options['on_headers']; + + if (!is_callable($onHeaders)) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + } else { + $onHeaders = null; + } + + return function ($ch, $h) use ( + $onHeaders, + $easy, + &$startingResponse + ) { + $value = trim($h); + if ($value === '') { + $startingResponse = true; + $easy->createResponse(); + if ($onHeaders !== null) { + try { + $onHeaders($easy->response); + } catch (\Exception $e) { + // Associate the exception with the handle and trigger + // a curl header write error by returning 0. + $easy->onHeadersException = $e; + return -1; + } + } + } elseif ($startingResponse) { + $startingResponse = false; + $easy->headers = [$value]; + } else { + $easy->headers[] = $value; + } + return strlen($h); + }; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php new file mode 100644 index 0000000..b0fc236 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlFactoryInterface.php @@ -0,0 +1,27 @@ +factory = isset($options['handle_factory']) + ? $options['handle_factory'] + : new CurlFactory(3); + } + + public function __invoke(RequestInterface $request, array $options) + { + if (isset($options['delay'])) { + usleep($options['delay'] * 1000); + } + + $easy = $this->factory->create($request, $options); + curl_exec($easy->handle); + $easy->errno = curl_errno($easy->handle); + + return CurlFactory::finish($this, $easy, $this->factory); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php new file mode 100644 index 0000000..b73e5c7 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php @@ -0,0 +1,219 @@ +factory = isset($options['handle_factory']) + ? $options['handle_factory'] : new CurlFactory(50); + + if (isset($options['select_timeout'])) { + $this->selectTimeout = $options['select_timeout']; + } elseif ($selectTimeout = getenv('GUZZLE_CURL_SELECT_TIMEOUT')) { + $this->selectTimeout = $selectTimeout; + } else { + $this->selectTimeout = 1; + } + + $this->options = isset($options['options']) ? $options['options'] : []; + } + + public function __get($name) + { + if ($name === '_mh') { + $this->_mh = curl_multi_init(); + + foreach ($this->options as $option => $value) { + // A warning is raised in case of a wrong option. + curl_multi_setopt($this->_mh, $option, $value); + } + + // Further calls to _mh will return the value directly, without entering the + // __get() method at all. + return $this->_mh; + } + + throw new \BadMethodCallException(); + } + + public function __destruct() + { + if (isset($this->_mh)) { + curl_multi_close($this->_mh); + unset($this->_mh); + } + } + + public function __invoke(RequestInterface $request, array $options) + { + $easy = $this->factory->create($request, $options); + $id = (int) $easy->handle; + + $promise = new Promise( + [$this, 'execute'], + function () use ($id) { + return $this->cancel($id); + } + ); + + $this->addRequest(['easy' => $easy, 'deferred' => $promise]); + + return $promise; + } + + /** + * Ticks the curl event loop. + */ + public function tick() + { + // Add any delayed handles if needed. + if ($this->delays) { + $currentTime = \GuzzleHttp\_current_time(); + foreach ($this->delays as $id => $delay) { + if ($currentTime >= $delay) { + unset($this->delays[$id]); + curl_multi_add_handle( + $this->_mh, + $this->handles[$id]['easy']->handle + ); + } + } + } + + // Step through the task queue which may add additional requests. + P\queue()->run(); + + if ($this->active && + curl_multi_select($this->_mh, $this->selectTimeout) === -1 + ) { + // Perform a usleep if a select returns -1. + // See: https://bugs.php.net/bug.php?id=61141 + usleep(250); + } + + while (curl_multi_exec($this->_mh, $this->active) === CURLM_CALL_MULTI_PERFORM); + + $this->processMessages(); + } + + /** + * Runs until all outstanding connections have completed. + */ + public function execute() + { + $queue = P\queue(); + + while ($this->handles || !$queue->isEmpty()) { + // If there are no transfers, then sleep for the next delay + if (!$this->active && $this->delays) { + usleep($this->timeToNext()); + } + $this->tick(); + } + } + + private function addRequest(array $entry) + { + $easy = $entry['easy']; + $id = (int) $easy->handle; + $this->handles[$id] = $entry; + if (empty($easy->options['delay'])) { + curl_multi_add_handle($this->_mh, $easy->handle); + } else { + $this->delays[$id] = \GuzzleHttp\_current_time() + ($easy->options['delay'] / 1000); + } + } + + /** + * Cancels a handle from sending and removes references to it. + * + * @param int $id Handle ID to cancel and remove. + * + * @return bool True on success, false on failure. + */ + private function cancel($id) + { + // Cannot cancel if it has been processed. + if (!isset($this->handles[$id])) { + return false; + } + + $handle = $this->handles[$id]['easy']->handle; + unset($this->delays[$id], $this->handles[$id]); + curl_multi_remove_handle($this->_mh, $handle); + curl_close($handle); + + return true; + } + + private function processMessages() + { + while ($done = curl_multi_info_read($this->_mh)) { + $id = (int) $done['handle']; + curl_multi_remove_handle($this->_mh, $done['handle']); + + if (!isset($this->handles[$id])) { + // Probably was cancelled. + continue; + } + + $entry = $this->handles[$id]; + unset($this->handles[$id], $this->delays[$id]); + $entry['easy']->errno = $done['result']; + $entry['deferred']->resolve( + CurlFactory::finish( + $this, + $entry['easy'], + $this->factory + ) + ); + } + } + + private function timeToNext() + { + $currentTime = \GuzzleHttp\_current_time(); + $nextTime = PHP_INT_MAX; + foreach ($this->delays as $time) { + if ($time < $nextTime) { + $nextTime = $time; + } + } + + return max(0, $nextTime - $currentTime) * 1000000; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php new file mode 100644 index 0000000..7754e91 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/EasyHandle.php @@ -0,0 +1,92 @@ +headers)) { + throw new \RuntimeException('No headers have been received'); + } + + // HTTP-version SP status-code SP reason-phrase + $startLine = explode(' ', array_shift($this->headers), 3); + $headers = \GuzzleHttp\headers_from_lines($this->headers); + $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); + + if (!empty($this->options['decode_content']) + && isset($normalizedKeys['content-encoding']) + ) { + $headers['x-encoded-content-encoding'] + = $headers[$normalizedKeys['content-encoding']]; + unset($headers[$normalizedKeys['content-encoding']]); + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] + = $headers[$normalizedKeys['content-length']]; + + $bodyLength = (int) $this->sink->getSize(); + if ($bodyLength) { + $headers[$normalizedKeys['content-length']] = $bodyLength; + } else { + unset($headers[$normalizedKeys['content-length']]); + } + } + } + + // Attach a response to the easy handle with the parsed headers. + $this->response = new Response( + $startLine[1], + $headers, + $this->sink, + substr($startLine[0], 5), + isset($startLine[2]) ? (string) $startLine[2] : null + ); + } + + public function __get($name) + { + $msg = $name === 'handle' + ? 'The EasyHandle has been released' + : 'Invalid property: ' . $name; + throw new \BadMethodCallException($msg); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php new file mode 100644 index 0000000..5b312bc --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/MockHandler.php @@ -0,0 +1,195 @@ +onFulfilled = $onFulfilled; + $this->onRejected = $onRejected; + + if ($queue) { + call_user_func_array([$this, 'append'], $queue); + } + } + + public function __invoke(RequestInterface $request, array $options) + { + if (!$this->queue) { + throw new \OutOfBoundsException('Mock queue is empty'); + } + + if (isset($options['delay']) && is_numeric($options['delay'])) { + usleep($options['delay'] * 1000); + } + + $this->lastRequest = $request; + $this->lastOptions = $options; + $response = array_shift($this->queue); + + if (isset($options['on_headers'])) { + if (!is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + try { + $options['on_headers']($response); + } catch (\Exception $e) { + $msg = 'An error was encountered during the on_headers event'; + $response = new RequestException($msg, $request, $response, $e); + } + } + + if (is_callable($response)) { + $response = call_user_func($response, $request, $options); + } + + $response = $response instanceof \Exception + ? \GuzzleHttp\Promise\rejection_for($response) + : \GuzzleHttp\Promise\promise_for($response); + + return $response->then( + function ($value) use ($request, $options) { + $this->invokeStats($request, $options, $value); + if ($this->onFulfilled) { + call_user_func($this->onFulfilled, $value); + } + if (isset($options['sink'])) { + $contents = (string) $value->getBody(); + $sink = $options['sink']; + + if (is_resource($sink)) { + fwrite($sink, $contents); + } elseif (is_string($sink)) { + file_put_contents($sink, $contents); + } elseif ($sink instanceof \Psr\Http\Message\StreamInterface) { + $sink->write($contents); + } + } + + return $value; + }, + function ($reason) use ($request, $options) { + $this->invokeStats($request, $options, null, $reason); + if ($this->onRejected) { + call_user_func($this->onRejected, $reason); + } + return \GuzzleHttp\Promise\rejection_for($reason); + } + ); + } + + /** + * Adds one or more variadic requests, exceptions, callables, or promises + * to the queue. + */ + public function append() + { + foreach (func_get_args() as $value) { + if ($value instanceof ResponseInterface + || $value instanceof \Exception + || $value instanceof PromiseInterface + || is_callable($value) + ) { + $this->queue[] = $value; + } else { + throw new \InvalidArgumentException('Expected a response or ' + . 'exception. Found ' . \GuzzleHttp\describe_type($value)); + } + } + } + + /** + * Get the last received request. + * + * @return RequestInterface + */ + public function getLastRequest() + { + return $this->lastRequest; + } + + /** + * Get the last received request options. + * + * @return array + */ + public function getLastOptions() + { + return $this->lastOptions; + } + + /** + * Returns the number of remaining items in the queue. + * + * @return int + */ + public function count() + { + return count($this->queue); + } + + public function reset() + { + $this->queue = []; + } + + private function invokeStats( + RequestInterface $request, + array $options, + ResponseInterface $response = null, + $reason = null + ) { + if (isset($options['on_stats'])) { + $transferTime = isset($options['transfer_time']) ? $options['transfer_time'] : 0; + $stats = new TransferStats($request, $response, $transferTime, $reason); + call_user_func($options['on_stats'], $stats); + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php new file mode 100644 index 0000000..f8b00be --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Handler/Proxy.php @@ -0,0 +1,55 @@ +withoutHeader('Expect'); + + // Append a content-length header if body size is zero to match + // cURL's behavior. + if (0 === $request->getBody()->getSize()) { + $request = $request->withHeader('Content-Length', '0'); + } + + return $this->createResponse( + $request, + $options, + $this->createStream($request, $options), + $startTime + ); + } catch (\InvalidArgumentException $e) { + throw $e; + } catch (\Exception $e) { + // Determine if the error was a networking error. + $message = $e->getMessage(); + // This list can probably get more comprehensive. + if (strpos($message, 'getaddrinfo') // DNS lookup failed + || strpos($message, 'Connection refused') + || strpos($message, "couldn't connect to host") // error on HHVM + || strpos($message, "connection attempt failed") + ) { + $e = new ConnectException($e->getMessage(), $request, $e); + } + $e = RequestException::wrapException($request, $e); + $this->invokeStats($options, $request, $startTime, null, $e); + + return \GuzzleHttp\Promise\rejection_for($e); + } + } + + private function invokeStats( + array $options, + RequestInterface $request, + $startTime, + ResponseInterface $response = null, + $error = null + ) { + if (isset($options['on_stats'])) { + $stats = new TransferStats( + $request, + $response, + \GuzzleHttp\_current_time() - $startTime, + $error, + [] + ); + call_user_func($options['on_stats'], $stats); + } + } + + private function createResponse( + RequestInterface $request, + array $options, + $stream, + $startTime + ) { + $hdrs = $this->lastHeaders; + $this->lastHeaders = []; + $parts = explode(' ', array_shift($hdrs), 3); + $ver = explode('/', $parts[0])[1]; + $status = $parts[1]; + $reason = isset($parts[2]) ? $parts[2] : null; + $headers = \GuzzleHttp\headers_from_lines($hdrs); + list($stream, $headers) = $this->checkDecode($options, $headers, $stream); + $stream = Psr7\stream_for($stream); + $sink = $stream; + + if (strcasecmp('HEAD', $request->getMethod())) { + $sink = $this->createSink($stream, $options); + } + + $response = new Psr7\Response($status, $headers, $sink, $ver, $reason); + + if (isset($options['on_headers'])) { + try { + $options['on_headers']($response); + } catch (\Exception $e) { + $msg = 'An error was encountered during the on_headers event'; + $ex = new RequestException($msg, $request, $response, $e); + return \GuzzleHttp\Promise\rejection_for($ex); + } + } + + // Do not drain when the request is a HEAD request because they have + // no body. + if ($sink !== $stream) { + $this->drain( + $stream, + $sink, + $response->getHeaderLine('Content-Length') + ); + } + + $this->invokeStats($options, $request, $startTime, $response, null); + + return new FulfilledPromise($response); + } + + private function createSink(StreamInterface $stream, array $options) + { + if (!empty($options['stream'])) { + return $stream; + } + + $sink = isset($options['sink']) + ? $options['sink'] + : fopen('php://temp', 'r+'); + + return is_string($sink) + ? new Psr7\LazyOpenStream($sink, 'w+') + : Psr7\stream_for($sink); + } + + private function checkDecode(array $options, array $headers, $stream) + { + // Automatically decode responses when instructed. + if (!empty($options['decode_content'])) { + $normalizedKeys = \GuzzleHttp\normalize_header_keys($headers); + if (isset($normalizedKeys['content-encoding'])) { + $encoding = $headers[$normalizedKeys['content-encoding']]; + if ($encoding[0] === 'gzip' || $encoding[0] === 'deflate') { + $stream = new Psr7\InflateStream( + Psr7\stream_for($stream) + ); + $headers['x-encoded-content-encoding'] + = $headers[$normalizedKeys['content-encoding']]; + // Remove content-encoding header + unset($headers[$normalizedKeys['content-encoding']]); + // Fix content-length header + if (isset($normalizedKeys['content-length'])) { + $headers['x-encoded-content-length'] + = $headers[$normalizedKeys['content-length']]; + + $length = (int) $stream->getSize(); + if ($length === 0) { + unset($headers[$normalizedKeys['content-length']]); + } else { + $headers[$normalizedKeys['content-length']] = [$length]; + } + } + } + } + } + + return [$stream, $headers]; + } + + /** + * Drains the source stream into the "sink" client option. + * + * @param StreamInterface $source + * @param StreamInterface $sink + * @param string $contentLength Header specifying the amount of + * data to read. + * + * @return StreamInterface + * @throws \RuntimeException when the sink option is invalid. + */ + private function drain( + StreamInterface $source, + StreamInterface $sink, + $contentLength + ) { + // If a content-length header is provided, then stop reading once + // that number of bytes has been read. This can prevent infinitely + // reading from a stream when dealing with servers that do not honor + // Connection: Close headers. + Psr7\copy_to_stream( + $source, + $sink, + (strlen($contentLength) > 0 && (int) $contentLength > 0) ? (int) $contentLength : -1 + ); + + $sink->seek(0); + $source->close(); + + return $sink; + } + + /** + * Create a resource and check to ensure it was created successfully + * + * @param callable $callback Callable that returns stream resource + * + * @return resource + * @throws \RuntimeException on error + */ + private function createResource(callable $callback) + { + $errors = null; + set_error_handler(function ($_, $msg, $file, $line) use (&$errors) { + $errors[] = [ + 'message' => $msg, + 'file' => $file, + 'line' => $line + ]; + return true; + }); + + $resource = $callback(); + restore_error_handler(); + + if (!$resource) { + $message = 'Error creating resource: '; + foreach ($errors as $err) { + foreach ($err as $key => $value) { + $message .= "[$key] $value" . PHP_EOL; + } + } + throw new \RuntimeException(trim($message)); + } + + return $resource; + } + + private function createStream(RequestInterface $request, array $options) + { + static $methods; + if (!$methods) { + $methods = array_flip(get_class_methods(__CLASS__)); + } + + // HTTP/1.1 streams using the PHP stream wrapper require a + // Connection: close header + if ($request->getProtocolVersion() == '1.1' + && !$request->hasHeader('Connection') + ) { + $request = $request->withHeader('Connection', 'close'); + } + + // Ensure SSL is verified by default + if (!isset($options['verify'])) { + $options['verify'] = true; + } + + $params = []; + $context = $this->getDefaultContext($request); + + if (isset($options['on_headers']) && !is_callable($options['on_headers'])) { + throw new \InvalidArgumentException('on_headers must be callable'); + } + + if (!empty($options)) { + foreach ($options as $key => $value) { + $method = "add_{$key}"; + if (isset($methods[$method])) { + $this->{$method}($request, $context, $value, $params); + } + } + } + + if (isset($options['stream_context'])) { + if (!is_array($options['stream_context'])) { + throw new \InvalidArgumentException('stream_context must be an array'); + } + $context = array_replace_recursive( + $context, + $options['stream_context'] + ); + } + + // Microsoft NTLM authentication only supported with curl handler + if (isset($options['auth']) + && is_array($options['auth']) + && isset($options['auth'][2]) + && 'ntlm' == $options['auth'][2] + ) { + throw new \InvalidArgumentException('Microsoft NTLM authentication only supported with curl handler'); + } + + $uri = $this->resolveHost($request, $options); + + $context = $this->createResource( + function () use ($context, $params) { + return stream_context_create($context, $params); + } + ); + + return $this->createResource( + function () use ($uri, &$http_response_header, $context, $options) { + $resource = fopen((string) $uri, 'r', null, $context); + $this->lastHeaders = $http_response_header; + + if (isset($options['read_timeout'])) { + $readTimeout = $options['read_timeout']; + $sec = (int) $readTimeout; + $usec = ($readTimeout - $sec) * 100000; + stream_set_timeout($resource, $sec, $usec); + } + + return $resource; + } + ); + } + + private function resolveHost(RequestInterface $request, array $options) + { + $uri = $request->getUri(); + + if (isset($options['force_ip_resolve']) && !filter_var($uri->getHost(), FILTER_VALIDATE_IP)) { + if ('v4' === $options['force_ip_resolve']) { + $records = dns_get_record($uri->getHost(), DNS_A); + if (!isset($records[0]['ip'])) { + throw new ConnectException( + sprintf( + "Could not resolve IPv4 address for host '%s'", + $uri->getHost() + ), + $request + ); + } + $uri = $uri->withHost($records[0]['ip']); + } elseif ('v6' === $options['force_ip_resolve']) { + $records = dns_get_record($uri->getHost(), DNS_AAAA); + if (!isset($records[0]['ipv6'])) { + throw new ConnectException( + sprintf( + "Could not resolve IPv6 address for host '%s'", + $uri->getHost() + ), + $request + ); + } + $uri = $uri->withHost('[' . $records[0]['ipv6'] . ']'); + } + } + + return $uri; + } + + private function getDefaultContext(RequestInterface $request) + { + $headers = ''; + foreach ($request->getHeaders() as $name => $value) { + foreach ($value as $val) { + $headers .= "$name: $val\r\n"; + } + } + + $context = [ + 'http' => [ + 'method' => $request->getMethod(), + 'header' => $headers, + 'protocol_version' => $request->getProtocolVersion(), + 'ignore_errors' => true, + 'follow_location' => 0, + ], + ]; + + $body = (string) $request->getBody(); + + if (!empty($body)) { + $context['http']['content'] = $body; + // Prevent the HTTP handler from adding a Content-Type header. + if (!$request->hasHeader('Content-Type')) { + $context['http']['header'] .= "Content-Type:\r\n"; + } + } + + $context['http']['header'] = rtrim($context['http']['header']); + + return $context; + } + + private function add_proxy(RequestInterface $request, &$options, $value, &$params) + { + if (!is_array($value)) { + $options['http']['proxy'] = $value; + } else { + $scheme = $request->getUri()->getScheme(); + if (isset($value[$scheme])) { + if (!isset($value['no']) + || !\GuzzleHttp\is_host_in_noproxy( + $request->getUri()->getHost(), + $value['no'] + ) + ) { + $options['http']['proxy'] = $value[$scheme]; + } + } + } + } + + private function add_timeout(RequestInterface $request, &$options, $value, &$params) + { + if ($value > 0) { + $options['http']['timeout'] = $value; + } + } + + private function add_verify(RequestInterface $request, &$options, $value, &$params) + { + if ($value === true) { + // PHP 5.6 or greater will find the system cert by default. When + // < 5.6, use the Guzzle bundled cacert. + if (PHP_VERSION_ID < 50600) { + $options['ssl']['cafile'] = \GuzzleHttp\default_ca_bundle(); + } + } elseif (is_string($value)) { + $options['ssl']['cafile'] = $value; + if (!file_exists($value)) { + throw new \RuntimeException("SSL CA bundle not found: $value"); + } + } elseif ($value === false) { + $options['ssl']['verify_peer'] = false; + $options['ssl']['verify_peer_name'] = false; + return; + } else { + throw new \InvalidArgumentException('Invalid verify request option'); + } + + $options['ssl']['verify_peer'] = true; + $options['ssl']['verify_peer_name'] = true; + $options['ssl']['allow_self_signed'] = false; + } + + private function add_cert(RequestInterface $request, &$options, $value, &$params) + { + if (is_array($value)) { + $options['ssl']['passphrase'] = $value[1]; + $value = $value[0]; + } + + if (!file_exists($value)) { + throw new \RuntimeException("SSL certificate not found: {$value}"); + } + + $options['ssl']['local_cert'] = $value; + } + + private function add_progress(RequestInterface $request, &$options, $value, &$params) + { + $this->addNotification( + $params, + function ($code, $a, $b, $c, $transferred, $total) use ($value) { + if ($code == STREAM_NOTIFY_PROGRESS) { + $value($total, $transferred, null, null); + } + } + ); + } + + private function add_debug(RequestInterface $request, &$options, $value, &$params) + { + if ($value === false) { + return; + } + + static $map = [ + STREAM_NOTIFY_CONNECT => 'CONNECT', + STREAM_NOTIFY_AUTH_REQUIRED => 'AUTH_REQUIRED', + STREAM_NOTIFY_AUTH_RESULT => 'AUTH_RESULT', + STREAM_NOTIFY_MIME_TYPE_IS => 'MIME_TYPE_IS', + STREAM_NOTIFY_FILE_SIZE_IS => 'FILE_SIZE_IS', + STREAM_NOTIFY_REDIRECTED => 'REDIRECTED', + STREAM_NOTIFY_PROGRESS => 'PROGRESS', + STREAM_NOTIFY_FAILURE => 'FAILURE', + STREAM_NOTIFY_COMPLETED => 'COMPLETED', + STREAM_NOTIFY_RESOLVE => 'RESOLVE', + ]; + static $args = ['severity', 'message', 'message_code', + 'bytes_transferred', 'bytes_max']; + + $value = \GuzzleHttp\debug_resource($value); + $ident = $request->getMethod() . ' ' . $request->getUri()->withFragment(''); + $this->addNotification( + $params, + function () use ($ident, $value, $map, $args) { + $passed = func_get_args(); + $code = array_shift($passed); + fprintf($value, '<%s> [%s] ', $ident, $map[$code]); + foreach (array_filter($passed) as $i => $v) { + fwrite($value, $args[$i] . ': "' . $v . '" '); + } + fwrite($value, "\n"); + } + ); + } + + private function addNotification(array &$params, callable $notify) + { + // Wrap the existing function if needed. + if (!isset($params['notification'])) { + $params['notification'] = $notify; + } else { + $params['notification'] = $this->callArray([ + $params['notification'], + $notify + ]); + } + } + + private function callArray(array $functions) + { + return function () use ($functions) { + $args = func_get_args(); + foreach ($functions as $fn) { + call_user_func_array($fn, $args); + } + }; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/HandlerStack.php b/vendor/guzzlehttp/guzzle/src/HandlerStack.php new file mode 100644 index 0000000..6a49cc0 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/HandlerStack.php @@ -0,0 +1,277 @@ +push(Middleware::httpErrors(), 'http_errors'); + $stack->push(Middleware::redirect(), 'allow_redirects'); + $stack->push(Middleware::cookies(), 'cookies'); + $stack->push(Middleware::prepareBody(), 'prepare_body'); + + return $stack; + } + + /** + * @param callable $handler Underlying HTTP handler. + */ + public function __construct(callable $handler = null) + { + $this->handler = $handler; + } + + /** + * Invokes the handler stack as a composed handler + * + * @param RequestInterface $request + * @param array $options + * + * @return ResponseInterface|PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) + { + $handler = $this->resolve(); + + return $handler($request, $options); + } + + /** + * Dumps a string representation of the stack. + * + * @return string + */ + public function __toString() + { + $depth = 0; + $stack = []; + if ($this->handler) { + $stack[] = "0) Handler: " . $this->debugCallable($this->handler); + } + + $result = ''; + foreach (array_reverse($this->stack) as $tuple) { + $depth++; + $str = "{$depth}) Name: '{$tuple[1]}', "; + $str .= "Function: " . $this->debugCallable($tuple[0]); + $result = "> {$str}\n{$result}"; + $stack[] = $str; + } + + foreach (array_keys($stack) as $k) { + $result .= "< {$stack[$k]}\n"; + } + + return $result; + } + + /** + * Set the HTTP handler that actually returns a promise. + * + * @param callable $handler Accepts a request and array of options and + * returns a Promise. + */ + public function setHandler(callable $handler) + { + $this->handler = $handler; + $this->cached = null; + } + + /** + * Returns true if the builder has a handler. + * + * @return bool + */ + public function hasHandler() + { + return (bool) $this->handler; + } + + /** + * Unshift a middleware to the bottom of the stack. + * + * @param callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function unshift(callable $middleware, $name = null) + { + array_unshift($this->stack, [$middleware, $name]); + $this->cached = null; + } + + /** + * Push a middleware to the top of the stack. + * + * @param callable $middleware Middleware function + * @param string $name Name to register for this middleware. + */ + public function push(callable $middleware, $name = '') + { + $this->stack[] = [$middleware, $name]; + $this->cached = null; + } + + /** + * Add a middleware before another middleware by name. + * + * @param string $findName Middleware to find + * @param callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function before($findName, callable $middleware, $withName = '') + { + $this->splice($findName, $withName, $middleware, true); + } + + /** + * Add a middleware after another middleware by name. + * + * @param string $findName Middleware to find + * @param callable $middleware Middleware function + * @param string $withName Name to register for this middleware. + */ + public function after($findName, callable $middleware, $withName = '') + { + $this->splice($findName, $withName, $middleware, false); + } + + /** + * Remove a middleware by instance or name from the stack. + * + * @param callable|string $remove Middleware to remove by instance or name. + */ + public function remove($remove) + { + $this->cached = null; + $idx = is_callable($remove) ? 0 : 1; + $this->stack = array_values(array_filter( + $this->stack, + function ($tuple) use ($idx, $remove) { + return $tuple[$idx] !== $remove; + } + )); + } + + /** + * Compose the middleware and handler into a single callable function. + * + * @return callable + */ + public function resolve() + { + if (!$this->cached) { + if (!($prev = $this->handler)) { + throw new \LogicException('No handler has been specified'); + } + + foreach (array_reverse($this->stack) as $fn) { + $prev = $fn[0]($prev); + } + + $this->cached = $prev; + } + + return $this->cached; + } + + /** + * @param string $name + * @return int + */ + private function findByName($name) + { + foreach ($this->stack as $k => $v) { + if ($v[1] === $name) { + return $k; + } + } + + throw new \InvalidArgumentException("Middleware not found: $name"); + } + + /** + * Splices a function into the middleware list at a specific position. + * + * @param string $findName + * @param string $withName + * @param callable $middleware + * @param bool $before + */ + private function splice($findName, $withName, callable $middleware, $before) + { + $this->cached = null; + $idx = $this->findByName($findName); + $tuple = [$middleware, $withName]; + + if ($before) { + if ($idx === 0) { + array_unshift($this->stack, $tuple); + } else { + $replacement = [$tuple, $this->stack[$idx]]; + array_splice($this->stack, $idx, 1, $replacement); + } + } elseif ($idx === count($this->stack) - 1) { + $this->stack[] = $tuple; + } else { + $replacement = [$this->stack[$idx], $tuple]; + array_splice($this->stack, $idx, 1, $replacement); + } + } + + /** + * Provides a debug string for a given callable. + * + * @param array|callable $fn Function to write as a string. + * + * @return string + */ + private function debugCallable($fn) + { + if (is_string($fn)) { + return "callable({$fn})"; + } + + if (is_array($fn)) { + return is_string($fn[0]) + ? "callable({$fn[0]}::{$fn[1]})" + : "callable(['" . get_class($fn[0]) . "', '{$fn[1]}'])"; + } + + return 'callable(' . spl_object_hash($fn) . ')'; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/MessageFormatter.php b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php new file mode 100644 index 0000000..dc36bb5 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/MessageFormatter.php @@ -0,0 +1,185 @@ +>>>>>>>\n{request}\n<<<<<<<<\n{response}\n--------\n{error}"; + const SHORT = '[{ts}] "{method} {target} HTTP/{version}" {code}'; + + /** @var string Template used to format log messages */ + private $template; + + /** + * @param string $template Log message template + */ + public function __construct($template = self::CLF) + { + $this->template = $template ?: self::CLF; + } + + /** + * Returns a formatted message string. + * + * @param RequestInterface $request Request that was sent + * @param ResponseInterface $response Response that was received + * @param \Exception $error Exception that was received + * + * @return string + */ + public function format( + RequestInterface $request, + ResponseInterface $response = null, + \Exception $error = null + ) { + $cache = []; + + return preg_replace_callback( + '/{\s*([A-Za-z_\-\.0-9]+)\s*}/', + function (array $matches) use ($request, $response, $error, &$cache) { + if (isset($cache[$matches[1]])) { + return $cache[$matches[1]]; + } + + $result = ''; + switch ($matches[1]) { + case 'request': + $result = Psr7\str($request); + break; + case 'response': + $result = $response ? Psr7\str($response) : ''; + break; + case 'req_headers': + $result = trim($request->getMethod() + . ' ' . $request->getRequestTarget()) + . ' HTTP/' . $request->getProtocolVersion() . "\r\n" + . $this->headers($request); + break; + case 'res_headers': + $result = $response ? + sprintf( + 'HTTP/%s %d %s', + $response->getProtocolVersion(), + $response->getStatusCode(), + $response->getReasonPhrase() + ) . "\r\n" . $this->headers($response) + : 'NULL'; + break; + case 'req_body': + $result = $request->getBody(); + break; + case 'res_body': + $result = $response ? $response->getBody() : 'NULL'; + break; + case 'ts': + case 'date_iso_8601': + $result = gmdate('c'); + break; + case 'date_common_log': + $result = date('d/M/Y:H:i:s O'); + break; + case 'method': + $result = $request->getMethod(); + break; + case 'version': + $result = $request->getProtocolVersion(); + break; + case 'uri': + case 'url': + $result = $request->getUri(); + break; + case 'target': + $result = $request->getRequestTarget(); + break; + case 'req_version': + $result = $request->getProtocolVersion(); + break; + case 'res_version': + $result = $response + ? $response->getProtocolVersion() + : 'NULL'; + break; + case 'host': + $result = $request->getHeaderLine('Host'); + break; + case 'hostname': + $result = gethostname(); + break; + case 'code': + $result = $response ? $response->getStatusCode() : 'NULL'; + break; + case 'phrase': + $result = $response ? $response->getReasonPhrase() : 'NULL'; + break; + case 'error': + $result = $error ? $error->getMessage() : 'NULL'; + break; + default: + // handle prefixed dynamic headers + if (strpos($matches[1], 'req_header_') === 0) { + $result = $request->getHeaderLine(substr($matches[1], 11)); + } elseif (strpos($matches[1], 'res_header_') === 0) { + $result = $response + ? $response->getHeaderLine(substr($matches[1], 11)) + : 'NULL'; + } + } + + $cache[$matches[1]] = $result; + return $result; + }, + $this->template + ); + } + + /** + * Get headers from message as string + * + * @return string + */ + private function headers(MessageInterface $message) + { + $result = ''; + foreach ($message->getHeaders() as $name => $values) { + $result .= $name . ': ' . implode(', ', $values) . "\r\n"; + } + + return trim($result); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Middleware.php b/vendor/guzzlehttp/guzzle/src/Middleware.php new file mode 100644 index 0000000..bffc197 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/Middleware.php @@ -0,0 +1,254 @@ +withCookieHeader($request); + return $handler($request, $options) + ->then( + function ($response) use ($cookieJar, $request) { + $cookieJar->extractCookies($request, $response); + return $response; + } + ); + }; + }; + } + + /** + * Middleware that throws exceptions for 4xx or 5xx responses when the + * "http_error" request option is set to true. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function httpErrors() + { + return function (callable $handler) { + return function ($request, array $options) use ($handler) { + if (empty($options['http_errors'])) { + return $handler($request, $options); + } + return $handler($request, $options)->then( + function (ResponseInterface $response) use ($request) { + $code = $response->getStatusCode(); + if ($code < 400) { + return $response; + } + throw RequestException::create($request, $response); + } + ); + }; + }; + } + + /** + * Middleware that pushes history data to an ArrayAccess container. + * + * @param array|\ArrayAccess $container Container to hold the history (by reference). + * + * @return callable Returns a function that accepts the next handler. + * @throws \InvalidArgumentException if container is not an array or ArrayAccess. + */ + public static function history(&$container) + { + if (!is_array($container) && !$container instanceof \ArrayAccess) { + throw new \InvalidArgumentException('history container must be an array or object implementing ArrayAccess'); + } + + return function (callable $handler) use (&$container) { + return function ($request, array $options) use ($handler, &$container) { + return $handler($request, $options)->then( + function ($value) use ($request, &$container, $options) { + $container[] = [ + 'request' => $request, + 'response' => $value, + 'error' => null, + 'options' => $options + ]; + return $value; + }, + function ($reason) use ($request, &$container, $options) { + $container[] = [ + 'request' => $request, + 'response' => null, + 'error' => $reason, + 'options' => $options + ]; + return \GuzzleHttp\Promise\rejection_for($reason); + } + ); + }; + }; + } + + /** + * Middleware that invokes a callback before and after sending a request. + * + * The provided listener cannot modify or alter the response. It simply + * "taps" into the chain to be notified before returning the promise. The + * before listener accepts a request and options array, and the after + * listener accepts a request, options array, and response promise. + * + * @param callable $before Function to invoke before forwarding the request. + * @param callable $after Function invoked after forwarding. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function tap(callable $before = null, callable $after = null) + { + return function (callable $handler) use ($before, $after) { + return function ($request, array $options) use ($handler, $before, $after) { + if ($before) { + $before($request, $options); + } + $response = $handler($request, $options); + if ($after) { + $after($request, $options, $response); + } + return $response; + }; + }; + } + + /** + * Middleware that handles request redirects. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function redirect() + { + return function (callable $handler) { + return new RedirectMiddleware($handler); + }; + } + + /** + * Middleware that retries requests based on the boolean result of + * invoking the provided "decider" function. + * + * If no delay function is provided, a simple implementation of exponential + * backoff will be utilized. + * + * @param callable $decider Function that accepts the number of retries, + * a request, [response], and [exception] and + * returns true if the request is to be retried. + * @param callable $delay Function that accepts the number of retries and + * returns the number of milliseconds to delay. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function retry(callable $decider, callable $delay = null) + { + return function (callable $handler) use ($decider, $delay) { + return new RetryMiddleware($decider, $handler, $delay); + }; + } + + /** + * Middleware that logs requests, responses, and errors using a message + * formatter. + * + * @param LoggerInterface $logger Logs messages. + * @param MessageFormatter $formatter Formatter used to create message strings. + * @param string $logLevel Level at which to log requests. + * + * @return callable Returns a function that accepts the next handler. + */ + public static function log(LoggerInterface $logger, MessageFormatter $formatter, $logLevel = 'info' /* \Psr\Log\LogLevel::INFO */) + { + return function (callable $handler) use ($logger, $formatter, $logLevel) { + return function ($request, array $options) use ($handler, $logger, $formatter, $logLevel) { + return $handler($request, $options)->then( + function ($response) use ($logger, $request, $formatter, $logLevel) { + $message = $formatter->format($request, $response); + $logger->log($logLevel, $message); + return $response; + }, + function ($reason) use ($logger, $request, $formatter) { + $response = $reason instanceof RequestException + ? $reason->getResponse() + : null; + $message = $formatter->format($request, $response, $reason); + $logger->notice($message); + return \GuzzleHttp\Promise\rejection_for($reason); + } + ); + }; + }; + } + + /** + * This middleware adds a default content-type if possible, a default + * content-length or transfer-encoding header, and the expect header. + * + * @return callable + */ + public static function prepareBody() + { + return function (callable $handler) { + return new PrepareBodyMiddleware($handler); + }; + } + + /** + * Middleware that applies a map function to the request before passing to + * the next handler. + * + * @param callable $fn Function that accepts a RequestInterface and returns + * a RequestInterface. + * @return callable + */ + public static function mapRequest(callable $fn) + { + return function (callable $handler) use ($fn) { + return function ($request, array $options) use ($handler, $fn) { + return $handler($fn($request), $options); + }; + }; + } + + /** + * Middleware that applies a map function to the resolved promise's + * response. + * + * @param callable $fn Function that accepts a ResponseInterface and + * returns a ResponseInterface. + * @return callable + */ + public static function mapResponse(callable $fn) + { + return function (callable $handler) use ($fn) { + return function ($request, array $options) use ($handler, $fn) { + return $handler($request, $options)->then($fn); + }; + }; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/Pool.php b/vendor/guzzlehttp/guzzle/src/Pool.php index 7b9d83a..5838db4 100644 --- a/vendor/guzzlehttp/guzzle/src/Pool.php +++ b/vendor/guzzlehttp/guzzle/src/Pool.php @@ -1,97 +1,87 @@ client = $client; - $this->iter = $this->coerceIterable($requests); - $this->deferred = new Deferred(); - $this->promise = $this->deferred->promise(); - $this->poolSize = isset($options['pool_size']) - ? $options['pool_size'] : 25; - $this->eventListeners = $this->prepareListeners( - $options, - ['before', 'complete', 'error', 'end'] - ); + // Backwards compatibility. + if (isset($config['pool_size'])) { + $config['concurrency'] = $config['pool_size']; + } elseif (!isset($config['concurrency'])) { + $config['concurrency'] = 25; + } + + if (isset($config['options'])) { + $opts = $config['options']; + unset($config['options']); + } else { + $opts = []; + } + + $iterable = \GuzzleHttp\Promise\iter_for($requests); + $requests = function () use ($iterable, $client, $opts) { + foreach ($iterable as $key => $rfn) { + if ($rfn instanceof RequestInterface) { + yield $key => $client->sendAsync($rfn, $opts); + } elseif (is_callable($rfn)) { + yield $key => $rfn($opts); + } else { + throw new \InvalidArgumentException('Each value yielded by ' + . 'the iterator must be a Psr7\Http\Message\RequestInterface ' + . 'or a callable that returns a promise that fulfills ' + . 'with a Psr7\Message\Http\ResponseInterface object.'); + } + } + }; + + $this->each = new EachPromise($requests(), $config); } /** - * Sends multiple requests in parallel and returns an array of responses + * Get promise + * + * @return PromiseInterface + */ + public function promise() + { + return $this->each->promise(); + } + + /** + * Sends multiple requests concurrently and returns an array of responses * and exceptions that uses the same ordering as the provided requests. * * IMPORTANT: This method keeps every request and response in memory, and @@ -99,11 +89,12 @@ class Pool implements FutureInterface * indeterminate number of requests concurrently. * * @param ClientInterface $client Client used to send the requests - * @param array|\Iterator $requests Requests to send in parallel + * @param array|\Iterator $requests Requests to send concurrently. * @param array $options Passes through the options available in * {@see GuzzleHttp\Pool::__construct} * - * @return BatchResults Returns a container for the results. + * @return array Returns an array containing the response or an exception + * in the same order that the requests were sent. * @throws \InvalidArgumentException if the event format is incorrect. */ public static function batch( @@ -111,223 +102,33 @@ class Pool implements FutureInterface $requests, array $options = [] ) { - $hash = new \SplObjectStorage(); - foreach ($requests as $request) { - $hash->attach($request); - } + $res = []; + self::cmpCallback($options, 'fulfilled', $res); + self::cmpCallback($options, 'rejected', $res); + $pool = new static($client, $requests, $options); + $pool->promise()->wait(); + ksort($res); - // In addition to the normally run events when requests complete, add - // and event to continuously track the results of transfers in the hash. - (new self($client, $requests, RequestEvents::convertEventArray( - $options, - ['end'], - [ - 'priority' => RequestEvents::LATE, - 'fn' => function (EndEvent $e) use ($hash) { - $hash[$e->getRequest()] = $e->getException() - ? $e->getException() - : $e->getResponse(); - } - ] - )))->wait(); - - return new BatchResults($hash); + return $res; } /** - * Creates a Pool and immediately sends the requests. + * Execute callback(s) * - * @param ClientInterface $client Client used to send the requests - * @param array|\Iterator $requests Requests to send in parallel - * @param array $options Passes through the options available in - * {@see GuzzleHttp\Pool::__construct} + * @return void */ - public static function send( - ClientInterface $client, - $requests, - array $options = [] - ) { - $pool = new self($client, $requests, $options); - $pool->wait(); - } - - private function getPoolSize() + private static function cmpCallback(array &$options, $name, array &$results) { - return is_callable($this->poolSize) - ? call_user_func($this->poolSize, count($this->waitQueue)) - : $this->poolSize; - } - - /** - * Add as many requests as possible up to the current pool limit. - */ - private function addNextRequests() - { - $limit = max($this->getPoolSize() - count($this->waitQueue), 0); - while ($limit--) { - if (!$this->addNextRequest()) { - break; - } + if (!isset($options[$name])) { + $options[$name] = function ($v, $k) use (&$results) { + $results[$k] = $v; + }; + } else { + $currentFn = $options[$name]; + $options[$name] = function ($v, $k) use (&$results, $currentFn) { + $currentFn($v, $k); + $results[$k] = $v; + }; } } - - public function wait() - { - if ($this->isRealized) { - return false; - } - - // Seed the pool with N number of requests. - $this->addNextRequests(); - - // Stop if the pool was cancelled while transferring requests. - if ($this->isRealized) { - return false; - } - - // Wait on any outstanding FutureResponse objects. - while ($response = array_pop($this->waitQueue)) { - try { - $response->wait(); - } catch (\Exception $e) { - // Eat exceptions because they should be handled asynchronously - } - $this->addNextRequests(); - } - - // Clean up no longer needed state. - $this->isRealized = true; - $this->waitQueue = $this->eventListeners = []; - $this->client = $this->iter = null; - $this->deferred->resolve(true); - - return true; - } - - /** - * {@inheritdoc} - * - * Attempt to cancel all outstanding requests (requests that are queued for - * dereferencing). Returns true if all outstanding requests can be - * cancelled. - * - * @return bool - */ - public function cancel() - { - if ($this->isRealized) { - return false; - } - - $success = $this->isRealized = true; - foreach ($this->waitQueue as $response) { - if (!$response->cancel()) { - $success = false; - } - } - - return $success; - } - - /** - * Returns a promise that is invoked when the pool completed. There will be - * no passed value. - * - * {@inheritdoc} - */ - public function then( - callable $onFulfilled = null, - callable $onRejected = null, - callable $onProgress = null - ) { - return $this->promise->then($onFulfilled, $onRejected, $onProgress); - } - - public function promise() - { - return $this->promise; - } - - private function coerceIterable($requests) - { - if ($requests instanceof \Iterator) { - return $requests; - } elseif (is_array($requests)) { - return new \ArrayIterator($requests); - } - - throw new \InvalidArgumentException('Expected Iterator or array. ' - . 'Found ' . Core::describeType($requests)); - } - - /** - * Adds the next request to pool and tracks what requests need to be - * dereferenced when completing the pool. - */ - private function addNextRequest() - { - add_next: - - if ($this->isRealized || !$this->iter || !$this->iter->valid()) { - return false; - } - - $request = $this->iter->current(); - $this->iter->next(); - - if (!($request instanceof RequestInterface)) { - throw new \InvalidArgumentException(sprintf( - 'All requests in the provided iterator must implement ' - . 'RequestInterface. Found %s', - Core::describeType($request) - )); - } - - // Be sure to use "lazy" futures, meaning they do not send right away. - $request->getConfig()->set('future', 'lazy'); - $hash = spl_object_hash($request); - $this->attachListeners($request, $this->eventListeners); - $request->getEmitter()->on('before', [$this, '_trackRetries'], RequestEvents::EARLY); - $response = $this->client->send($request); - $this->waitQueue[$hash] = $response; - $promise = $response->promise(); - - // Don't recursively call itself for completed or rejected responses. - if ($promise instanceof FulfilledPromise - || $promise instanceof RejectedPromise - ) { - try { - $this->finishResponse($request, $response->wait(), $hash); - } catch (\Exception $e) { - $this->finishResponse($request, $e, $hash); - } - goto add_next; - } - - // Use this function for both resolution and rejection. - $thenFn = function ($value) use ($request, $hash) { - $this->finishResponse($request, $value, $hash); - if (!$request->getConfig()->get('_pool_retries')) { - $this->addNextRequests(); - } - }; - - $promise->then($thenFn, $thenFn); - - return true; - } - - public function _trackRetries(BeforeEvent $e) - { - $e->getRequest()->getConfig()->set('_pool_retries', $e->getRetryCount()); - } - - private function finishResponse($request, $value, $hash) - { - unset($this->waitQueue[$hash]); - $result = $value instanceof ResponseInterface - ? ['request' => $request, 'response' => $value, 'error' => null] - : ['request' => $request, 'response' => null, 'error' => $value]; - $this->deferred->notify($result); - } } diff --git a/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php new file mode 100644 index 0000000..568a1e9 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php @@ -0,0 +1,111 @@ +nextHandler = $nextHandler; + } + + /** + * @param RequestInterface $request + * @param array $options + * + * @return PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) + { + $fn = $this->nextHandler; + + // Don't do anything if the request has no body. + if ($request->getBody()->getSize() === 0) { + return $fn($request, $options); + } + + $modify = []; + + // Add a default content-type if possible. + if (!$request->hasHeader('Content-Type')) { + if ($uri = $request->getBody()->getMetadata('uri')) { + if ($type = Psr7\mimetype_from_filename($uri)) { + $modify['set_headers']['Content-Type'] = $type; + } + } + } + + // Add a default content-length or transfer-encoding header. + if (!$request->hasHeader('Content-Length') + && !$request->hasHeader('Transfer-Encoding') + ) { + $size = $request->getBody()->getSize(); + if ($size !== null) { + $modify['set_headers']['Content-Length'] = $size; + } else { + $modify['set_headers']['Transfer-Encoding'] = 'chunked'; + } + } + + // Add the expect header if needed. + $this->addExpectHeader($request, $options, $modify); + + return $fn(Psr7\modify_request($request, $modify), $options); + } + + /** + * Add expect header + * + * @return void + */ + private function addExpectHeader( + RequestInterface $request, + array $options, + array &$modify + ) { + // Determine if the Expect header should be used + if ($request->hasHeader('Expect')) { + return; + } + + $expect = isset($options['expect']) ? $options['expect'] : null; + + // Return if disabled or if you're not using HTTP/1.1 or HTTP/2.0 + if ($expect === false || $request->getProtocolVersion() < 1.1) { + return; + } + + // The expect header is unconditionally enabled + if ($expect === true) { + $modify['set_headers']['Expect'] = '100-Continue'; + return; + } + + // By default, send the expect header when the payload is > 1mb + if ($expect === null) { + $expect = 1048576; + } + + // Always add if the body cannot be rewound, the size cannot be + // determined, or the size is greater than the cutoff threshold + $body = $request->getBody(); + $size = $body->getSize(); + + if ($size === null || $size >= (int) $expect || !$body->isSeekable()) { + $modify['set_headers']['Expect'] = '100-Continue'; + } + } +} diff --git a/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php new file mode 100644 index 0000000..2f30126 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/RedirectMiddleware.php @@ -0,0 +1,255 @@ + 5, + 'protocols' => ['http', 'https'], + 'strict' => false, + 'referer' => false, + 'track_redirects' => false, + ]; + + /** @var callable */ + private $nextHandler; + + /** + * @param callable $nextHandler Next handler to invoke. + */ + public function __construct(callable $nextHandler) + { + $this->nextHandler = $nextHandler; + } + + /** + * @param RequestInterface $request + * @param array $options + * + * @return PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) + { + $fn = $this->nextHandler; + + if (empty($options['allow_redirects'])) { + return $fn($request, $options); + } + + if ($options['allow_redirects'] === true) { + $options['allow_redirects'] = self::$defaultSettings; + } elseif (!is_array($options['allow_redirects'])) { + throw new \InvalidArgumentException('allow_redirects must be true, false, or array'); + } else { + // Merge the default settings with the provided settings + $options['allow_redirects'] += self::$defaultSettings; + } + + if (empty($options['allow_redirects']['max'])) { + return $fn($request, $options); + } + + return $fn($request, $options) + ->then(function (ResponseInterface $response) use ($request, $options) { + return $this->checkRedirect($request, $options, $response); + }); + } + + /** + * @param RequestInterface $request + * @param array $options + * @param ResponseInterface $response + * + * @return ResponseInterface|PromiseInterface + */ + public function checkRedirect( + RequestInterface $request, + array $options, + ResponseInterface $response + ) { + if (substr($response->getStatusCode(), 0, 1) != '3' + || !$response->hasHeader('Location') + ) { + return $response; + } + + $this->guardMax($request, $options); + $nextRequest = $this->modifyRequest($request, $options, $response); + + if (isset($options['allow_redirects']['on_redirect'])) { + call_user_func( + $options['allow_redirects']['on_redirect'], + $request, + $response, + $nextRequest->getUri() + ); + } + + /** @var PromiseInterface|ResponseInterface $promise */ + $promise = $this($nextRequest, $options); + + // Add headers to be able to track history of redirects. + if (!empty($options['allow_redirects']['track_redirects'])) { + return $this->withTracking( + $promise, + (string) $nextRequest->getUri(), + $response->getStatusCode() + ); + } + + return $promise; + } + + /** + * Enable tracking on promise. + * + * @return PromiseInterface + */ + private function withTracking(PromiseInterface $promise, $uri, $statusCode) + { + return $promise->then( + function (ResponseInterface $response) use ($uri, $statusCode) { + // Note that we are pushing to the front of the list as this + // would be an earlier response than what is currently present + // in the history header. + $historyHeader = $response->getHeader(self::HISTORY_HEADER); + $statusHeader = $response->getHeader(self::STATUS_HISTORY_HEADER); + array_unshift($historyHeader, $uri); + array_unshift($statusHeader, $statusCode); + return $response->withHeader(self::HISTORY_HEADER, $historyHeader) + ->withHeader(self::STATUS_HISTORY_HEADER, $statusHeader); + } + ); + } + + /** + * Check for too many redirects + * + * @return void + * + * @throws TooManyRedirectsException Too many redirects. + */ + private function guardMax(RequestInterface $request, array &$options) + { + $current = isset($options['__redirect_count']) + ? $options['__redirect_count'] + : 0; + $options['__redirect_count'] = $current + 1; + $max = $options['allow_redirects']['max']; + + if ($options['__redirect_count'] > $max) { + throw new TooManyRedirectsException( + "Will not follow more than {$max} redirects", + $request + ); + } + } + + /** + * @param RequestInterface $request + * @param array $options + * @param ResponseInterface $response + * + * @return RequestInterface + */ + public function modifyRequest( + RequestInterface $request, + array $options, + ResponseInterface $response + ) { + // Request modifications to apply. + $modify = []; + $protocols = $options['allow_redirects']['protocols']; + + // Use a GET request if this is an entity enclosing request and we are + // not forcing RFC compliance, but rather emulating what all browsers + // would do. + $statusCode = $response->getStatusCode(); + if ($statusCode == 303 || + ($statusCode <= 302 && !$options['allow_redirects']['strict']) + ) { + $modify['method'] = 'GET'; + $modify['body'] = ''; + } + + $uri = $this->redirectUri($request, $response, $protocols); + if (isset($options['idn_conversion']) && ($options['idn_conversion'] !== false)) { + $idnOptions = ($options['idn_conversion'] === true) ? IDNA_DEFAULT : $options['idn_conversion']; + $uri = _idn_uri_convert($uri, $idnOptions); + } + + $modify['uri'] = $uri; + Psr7\rewind_body($request); + + // Add the Referer header if it is told to do so and only + // add the header if we are not redirecting from https to http. + if ($options['allow_redirects']['referer'] + && $modify['uri']->getScheme() === $request->getUri()->getScheme() + ) { + $uri = $request->getUri()->withUserInfo(''); + $modify['set_headers']['Referer'] = (string) $uri; + } else { + $modify['remove_headers'][] = 'Referer'; + } + + // Remove Authorization header if host is different. + if ($request->getUri()->getHost() !== $modify['uri']->getHost()) { + $modify['remove_headers'][] = 'Authorization'; + } + + return Psr7\modify_request($request, $modify); + } + + /** + * Set the appropriate URL on the request based on the location header + * + * @param RequestInterface $request + * @param ResponseInterface $response + * @param array $protocols + * + * @return UriInterface + */ + private function redirectUri( + RequestInterface $request, + ResponseInterface $response, + array $protocols + ) { + $location = Psr7\UriResolver::resolve( + $request->getUri(), + new Psr7\Uri($response->getHeaderLine('Location')) + ); + + // Ensure that the redirect URI is allowed based on the protocols. + if (!in_array($location->getScheme(), $protocols)) { + throw new BadResponseException( + sprintf( + 'Redirect URI, %s, does not use one of the allowed redirect protocols: %s', + $location, + implode(', ', $protocols) + ), + $request, + $response + ); + } + + return $location; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/RequestOptions.php b/vendor/guzzlehttp/guzzle/src/RequestOptions.php new file mode 100644 index 0000000..355f658 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/RequestOptions.php @@ -0,0 +1,263 @@ +decider = $decider; + $this->nextHandler = $nextHandler; + $this->delay = $delay ?: __CLASS__ . '::exponentialDelay'; + } + + /** + * Default exponential backoff delay function. + * + * @param int $retries + * + * @return int milliseconds. + */ + public static function exponentialDelay($retries) + { + return (int) pow(2, $retries - 1) * 1000; + } + + /** + * @param RequestInterface $request + * @param array $options + * + * @return PromiseInterface + */ + public function __invoke(RequestInterface $request, array $options) + { + if (!isset($options['retries'])) { + $options['retries'] = 0; + } + + $fn = $this->nextHandler; + return $fn($request, $options) + ->then( + $this->onFulfilled($request, $options), + $this->onRejected($request, $options) + ); + } + + /** + * Execute fulfilled closure + * + * @return mixed + */ + private function onFulfilled(RequestInterface $req, array $options) + { + return function ($value) use ($req, $options) { + if (!call_user_func( + $this->decider, + $options['retries'], + $req, + $value, + null + )) { + return $value; + } + return $this->doRetry($req, $options, $value); + }; + } + + /** + * Execute rejected closure + * + * @return callable + */ + private function onRejected(RequestInterface $req, array $options) + { + return function ($reason) use ($req, $options) { + if (!call_user_func( + $this->decider, + $options['retries'], + $req, + null, + $reason + )) { + return \GuzzleHttp\Promise\rejection_for($reason); + } + return $this->doRetry($req, $options); + }; + } + + /** + * @return self + */ + private function doRetry(RequestInterface $request, array $options, ResponseInterface $response = null) + { + $options['delay'] = call_user_func($this->delay, ++$options['retries'], $response); + + return $this($request, $options); + } +} diff --git a/vendor/guzzlehttp/guzzle/src/TransferStats.php b/vendor/guzzlehttp/guzzle/src/TransferStats.php new file mode 100644 index 0000000..87fb3c0 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/TransferStats.php @@ -0,0 +1,126 @@ +request = $request; + $this->response = $response; + $this->transferTime = $transferTime; + $this->handlerErrorData = $handlerErrorData; + $this->handlerStats = $handlerStats; + } + + /** + * @return RequestInterface + */ + public function getRequest() + { + return $this->request; + } + + /** + * Returns the response that was received (if any). + * + * @return ResponseInterface|null + */ + public function getResponse() + { + return $this->response; + } + + /** + * Returns true if a response was received. + * + * @return bool + */ + public function hasResponse() + { + return $this->response !== null; + } + + /** + * Gets handler specific error data. + * + * This might be an exception, a integer representing an error code, or + * anything else. Relying on this value assumes that you know what handler + * you are using. + * + * @return mixed + */ + public function getHandlerErrorData() + { + return $this->handlerErrorData; + } + + /** + * Get the effective URI the request was sent to. + * + * @return UriInterface + */ + public function getEffectiveUri() + { + return $this->request->getUri(); + } + + /** + * Get the estimated time the request was being transferred by the handler. + * + * @return float|null Time in seconds. + */ + public function getTransferTime() + { + return $this->transferTime; + } + + /** + * Gets an array of all of the handler specific transfer data. + * + * @return array + */ + public function getHandlerStats() + { + return $this->handlerStats; + } + + /** + * Get a specific handler statistic from the handler by name. + * + * @param string $stat Handler specific transfer stat to retrieve. + * + * @return mixed|null + */ + public function getHandlerStat($stat) + { + return isset($this->handlerStats[$stat]) + ? $this->handlerStats[$stat] + : null; + } +} diff --git a/vendor/guzzlehttp/guzzle/src/UriTemplate.php b/vendor/guzzlehttp/guzzle/src/UriTemplate.php index 55dfeb5..96dcfd0 100644 --- a/vendor/guzzlehttp/guzzle/src/UriTemplate.php +++ b/vendor/guzzlehttp/guzzle/src/UriTemplate.php @@ -15,25 +15,25 @@ class UriTemplate private $variables; /** @var array Hash for quick operator lookups */ - private static $operatorHash = array( - '' => array('prefix' => '', 'joiner' => ',', 'query' => false), - '+' => array('prefix' => '', 'joiner' => ',', 'query' => false), - '#' => array('prefix' => '#', 'joiner' => ',', 'query' => false), - '.' => array('prefix' => '.', 'joiner' => '.', 'query' => false), - '/' => array('prefix' => '/', 'joiner' => '/', 'query' => false), - ';' => array('prefix' => ';', 'joiner' => ';', 'query' => true), - '?' => array('prefix' => '?', 'joiner' => '&', 'query' => true), - '&' => array('prefix' => '&', 'joiner' => '&', 'query' => true) - ); + private static $operatorHash = [ + '' => ['prefix' => '', 'joiner' => ',', 'query' => false], + '+' => ['prefix' => '', 'joiner' => ',', 'query' => false], + '#' => ['prefix' => '#', 'joiner' => ',', 'query' => false], + '.' => ['prefix' => '.', 'joiner' => '.', 'query' => false], + '/' => ['prefix' => '/', 'joiner' => '/', 'query' => false], + ';' => ['prefix' => ';', 'joiner' => ';', 'query' => true], + '?' => ['prefix' => '?', 'joiner' => '&', 'query' => true], + '&' => ['prefix' => '&', 'joiner' => '&', 'query' => true] + ]; /** @var array Delimiters */ - private static $delims = array(':', '/', '?', '#', '[', ']', '@', '!', '$', - '&', '\'', '(', ')', '*', '+', ',', ';', '='); + private static $delims = [':', '/', '?', '#', '[', ']', '@', '!', '$', + '&', '\'', '(', ')', '*', '+', ',', ';', '=']; /** @var array Percent encoded delimiters */ - private static $delimsPct = array('%3A', '%2F', '%3F', '%23', '%5B', '%5D', + private static $delimsPct = ['%3A', '%2F', '%3F', '%23', '%5B', '%5D', '%40', '%21', '%24', '%26', '%27', '%28', '%29', '%2A', '%2B', '%2C', - '%3B', '%3D'); + '%3B', '%3D']; public function expand($template, array $variables) { @@ -60,7 +60,7 @@ class UriTemplate */ private function parseExpression($expression) { - $result = array(); + $result = []; if (isset(self::$operatorHash[$expression[0]])) { $result['operator'] = $expression[0]; @@ -71,12 +71,12 @@ class UriTemplate foreach (explode(',', $expression) as $value) { $value = trim($value); - $varspec = array(); + $varspec = []; if ($colonPos = strpos($value, ':')) { $varspec['value'] = substr($value, 0, $colonPos); $varspec['modifier'] = ':'; $varspec['position'] = (int) substr($value, $colonPos + 1); - } elseif (substr($value, -1) == '*') { + } elseif (substr($value, -1) === '*') { $varspec['modifier'] = '*'; $varspec['value'] = substr($value, 0, -1); } else { @@ -98,16 +98,15 @@ class UriTemplate */ private function expandMatch(array $matches) { - static $rfc1738to3986 = array('+' => '%20', '%7e' => '~'); + static $rfc1738to3986 = ['+' => '%20', '%7e' => '~']; - $replacements = array(); + $replacements = []; $parsed = self::parseExpression($matches[1]); $prefix = self::$operatorHash[$parsed['operator']]['prefix']; $joiner = self::$operatorHash[$parsed['operator']]['joiner']; $useQuery = self::$operatorHash[$parsed['operator']]['query']; foreach ($parsed['values'] as $value) { - if (!isset($this->variables[$value['value']])) { continue; } @@ -117,11 +116,9 @@ class UriTemplate $expanded = ''; if (is_array($variable)) { - $isAssoc = $this->isAssoc($variable); - $kvp = array(); + $kvp = []; foreach ($variable as $key => $var) { - if ($isAssoc) { $key = rawurlencode($key); $isNestedArray = is_array($var); @@ -131,14 +128,14 @@ class UriTemplate if (!$isNestedArray) { $var = rawurlencode($var); - if ($parsed['operator'] == '+' || - $parsed['operator'] == '#' + if ($parsed['operator'] === '+' || + $parsed['operator'] === '#' ) { $var = $this->decodeReserved($var); } } - if ($value['modifier'] == '*') { + if ($value['modifier'] === '*') { if ($isAssoc) { if ($isNestedArray) { // Nested arrays must allow for deeply nested @@ -160,7 +157,7 @@ class UriTemplate if (empty($variable)) { $actuallyUseQuery = false; - } elseif ($value['modifier'] == '*') { + } elseif ($value['modifier'] === '*') { $expanded = implode($joiner, $kvp); if ($isAssoc) { // Don't prepend the value name when using the explode @@ -179,19 +176,18 @@ class UriTemplate } $expanded = implode(',', $kvp); } - } else { - if ($value['modifier'] == ':') { + if ($value['modifier'] === ':') { $variable = substr($variable, 0, $value['position']); } $expanded = rawurlencode($variable); - if ($parsed['operator'] == '+' || $parsed['operator'] == '#') { + if ($parsed['operator'] === '+' || $parsed['operator'] === '#') { $expanded = $this->decodeReserved($expanded); } } if ($actuallyUseQuery) { - if (!$expanded && $joiner != '&') { + if (!$expanded && $joiner !== '&') { $expanded = $value['value']; } else { $expanded = $value['value'] . '=' . $expanded; diff --git a/vendor/guzzlehttp/guzzle/src/functions.php b/vendor/guzzlehttp/guzzle/src/functions.php new file mode 100644 index 0000000..5e806f6 --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/functions.php @@ -0,0 +1,394 @@ +expand($template, $variables); +} + +/** + * Debug function used to describe the provided value type and class. + * + * @param mixed $input + * + * @return string Returns a string containing the type of the variable and + * if a class is provided, the class name. + */ +function describe_type($input) +{ + switch (gettype($input)) { + case 'object': + return 'object(' . get_class($input) . ')'; + case 'array': + return 'array(' . count($input) . ')'; + default: + ob_start(); + var_dump($input); + // normalize float vs double + return str_replace('double(', 'float(', rtrim(ob_get_clean())); + } +} + +/** + * Parses an array of header lines into an associative array of headers. + * + * @param iterable $lines Header lines array of strings in the following + * format: "Name: Value" + * @return array + */ +function headers_from_lines($lines) +{ + $headers = []; + + foreach ($lines as $line) { + $parts = explode(':', $line, 2); + $headers[trim($parts[0])][] = isset($parts[1]) + ? trim($parts[1]) + : null; + } + + return $headers; +} + +/** + * Returns a debug stream based on the provided variable. + * + * @param mixed $value Optional value + * + * @return resource + */ +function debug_resource($value = null) +{ + if (is_resource($value)) { + return $value; + } elseif (defined('STDOUT')) { + return STDOUT; + } + + return fopen('php://output', 'w'); +} + +/** + * Chooses and creates a default handler to use based on the environment. + * + * The returned handler is not wrapped by any default middlewares. + * + * @throws \RuntimeException if no viable Handler is available. + * @return callable Returns the best handler for the given system. + */ +function choose_handler() +{ + $handler = null; + if (function_exists('curl_multi_exec') && function_exists('curl_exec')) { + $handler = Proxy::wrapSync(new CurlMultiHandler(), new CurlHandler()); + } elseif (function_exists('curl_exec')) { + $handler = new CurlHandler(); + } elseif (function_exists('curl_multi_exec')) { + $handler = new CurlMultiHandler(); + } + + if (ini_get('allow_url_fopen')) { + $handler = $handler + ? Proxy::wrapStreaming($handler, new StreamHandler()) + : new StreamHandler(); + } elseif (!$handler) { + throw new \RuntimeException('GuzzleHttp requires cURL, the ' + . 'allow_url_fopen ini setting, or a custom HTTP handler.'); + } + + return $handler; +} + +/** + * Get the default User-Agent string to use with Guzzle + * + * @return string + */ +function default_user_agent() +{ + static $defaultAgent = ''; + + if (!$defaultAgent) { + $defaultAgent = 'GuzzleHttp/' . Client::VERSION; + if (extension_loaded('curl') && function_exists('curl_version')) { + $defaultAgent .= ' curl/' . \curl_version()['version']; + } + $defaultAgent .= ' PHP/' . PHP_VERSION; + } + + return $defaultAgent; +} + +/** + * Returns the default cacert bundle for the current system. + * + * First, the openssl.cafile and curl.cainfo php.ini settings are checked. + * If those settings are not configured, then the common locations for + * bundles found on Red Hat, CentOS, Fedora, Ubuntu, Debian, FreeBSD, OS X + * and Windows are checked. If any of these file locations are found on + * disk, they will be utilized. + * + * Note: the result of this function is cached for subsequent calls. + * + * @return string + * @throws \RuntimeException if no bundle can be found. + */ +function default_ca_bundle() +{ + static $cached = null; + static $cafiles = [ + // Red Hat, CentOS, Fedora (provided by the ca-certificates package) + '/etc/pki/tls/certs/ca-bundle.crt', + // Ubuntu, Debian (provided by the ca-certificates package) + '/etc/ssl/certs/ca-certificates.crt', + // FreeBSD (provided by the ca_root_nss package) + '/usr/local/share/certs/ca-root-nss.crt', + // SLES 12 (provided by the ca-certificates package) + '/var/lib/ca-certificates/ca-bundle.pem', + // OS X provided by homebrew (using the default path) + '/usr/local/etc/openssl/cert.pem', + // Google app engine + '/etc/ca-certificates.crt', + // Windows? + 'C:\\windows\\system32\\curl-ca-bundle.crt', + 'C:\\windows\\curl-ca-bundle.crt', + ]; + + if ($cached) { + return $cached; + } + + if ($ca = ini_get('openssl.cafile')) { + return $cached = $ca; + } + + if ($ca = ini_get('curl.cainfo')) { + return $cached = $ca; + } + + foreach ($cafiles as $filename) { + if (file_exists($filename)) { + return $cached = $filename; + } + } + + throw new \RuntimeException( + <<< EOT +No system CA bundle could be found in any of the the common system locations. +PHP versions earlier than 5.6 are not properly configured to use the system's +CA bundle by default. In order to verify peer certificates, you will need to +supply the path on disk to a certificate bundle to the 'verify' request +option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not +need a specific certificate bundle, then Mozilla provides a commonly used CA +bundle which can be downloaded here (provided by the maintainer of cURL): +https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt. Once +you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP +ini setting to point to the path to the file, allowing you to omit the 'verify' +request option. See http://curl.haxx.se/docs/sslcerts.html for more +information. +EOT + ); +} + +/** + * Creates an associative array of lowercase header names to the actual + * header casing. + * + * @param array $headers + * + * @return array + */ +function normalize_header_keys(array $headers) +{ + $result = []; + foreach (array_keys($headers) as $key) { + $result[strtolower($key)] = $key; + } + + return $result; +} + +/** + * Returns true if the provided host matches any of the no proxy areas. + * + * This method will strip a port from the host if it is present. Each pattern + * can be matched with an exact match (e.g., "foo.com" == "foo.com") or a + * partial match: (e.g., "foo.com" == "baz.foo.com" and ".foo.com" == + * "baz.foo.com", but ".foo.com" != "foo.com"). + * + * Areas are matched in the following cases: + * 1. "*" (without quotes) always matches any hosts. + * 2. An exact match. + * 3. The area starts with "." and the area is the last part of the host. e.g. + * '.mit.edu' will match any host that ends with '.mit.edu'. + * + * @param string $host Host to check against the patterns. + * @param array $noProxyArray An array of host patterns. + * + * @return bool + */ +function is_host_in_noproxy($host, array $noProxyArray) +{ + if (strlen($host) === 0) { + throw new \InvalidArgumentException('Empty host provided'); + } + + // Strip port if present. + if (strpos($host, ':')) { + $host = explode($host, ':', 2)[0]; + } + + foreach ($noProxyArray as $area) { + // Always match on wildcards. + if ($area === '*') { + return true; + } elseif (empty($area)) { + // Don't match on empty values. + continue; + } elseif ($area === $host) { + // Exact matches. + return true; + } else { + // Special match if the area when prefixed with ".". Remove any + // existing leading "." and add a new leading ".". + $area = '.' . ltrim($area, '.'); + if (substr($host, -(strlen($area))) === $area) { + return true; + } + } + } + + return false; +} + +/** + * Wrapper for json_decode that throws when an error occurs. + * + * @param string $json JSON data to parse + * @param bool $assoc When true, returned objects will be converted + * into associative arrays. + * @param int $depth User specified recursion depth. + * @param int $options Bitmask of JSON decode options. + * + * @return mixed + * @throws Exception\InvalidArgumentException if the JSON cannot be decoded. + * @link http://www.php.net/manual/en/function.json-decode.php + */ +function json_decode($json, $assoc = false, $depth = 512, $options = 0) +{ + $data = \json_decode($json, $assoc, $depth, $options); + if (JSON_ERROR_NONE !== json_last_error()) { + throw new Exception\InvalidArgumentException( + 'json_decode error: ' . json_last_error_msg() + ); + } + + return $data; +} + +/** + * Wrapper for JSON encoding that throws when an error occurs. + * + * @param mixed $value The value being encoded + * @param int $options JSON encode option bitmask + * @param int $depth Set the maximum depth. Must be greater than zero. + * + * @return string + * @throws Exception\InvalidArgumentException if the JSON cannot be encoded. + * @link http://www.php.net/manual/en/function.json-encode.php + */ +function json_encode($value, $options = 0, $depth = 512) +{ + $json = \json_encode($value, $options, $depth); + if (JSON_ERROR_NONE !== json_last_error()) { + throw new Exception\InvalidArgumentException( + 'json_encode error: ' . json_last_error_msg() + ); + } + + return $json; +} + +/** + * Wrapper for the hrtime() or microtime() functions + * (depending on the PHP version, one of the two is used) + * + * @return float|mixed UNIX timestamp + * @internal + */ +function _current_time() +{ + return function_exists('hrtime') ? hrtime(true) / 1e9 : microtime(true); +} + + +/** + * @param int $options + * + * @return UriInterface + * + * @internal + */ +function _idn_uri_convert(UriInterface $uri, $options = 0) +{ + if ($uri->getHost()) { + $idnaVariant = defined('INTL_IDNA_VARIANT_UTS46') ? INTL_IDNA_VARIANT_UTS46 : 0; + $asciiHost = $idnaVariant === 0 + ? idn_to_ascii($uri->getHost(), $options) + : idn_to_ascii($uri->getHost(), $options, $idnaVariant, $info); + if ($asciiHost === false) { + $errorBitSet = isset($info['errors']) ? $info['errors'] : 0; + + $errorConstants = array_filter(array_keys(get_defined_constants()), function ($name) { + return substr($name, 0, 11) === 'IDNA_ERROR_'; + }); + + $errors = []; + foreach ($errorConstants as $errorConstant) { + if ($errorBitSet & constant($errorConstant)) { + $errors[] = $errorConstant; + } + } + + $errorMessage = 'IDN conversion failed'; + if ($errors) { + $errorMessage .= ' (errors: ' . implode(', ', $errors) . ')'; + } + + throw new InvalidArgumentException($errorMessage); + } else { + if ($uri->getHost() !== $asciiHost) { + // Replace URI only if the ASCII version is different + $uri = $uri->withHost($asciiHost); + } + } + } + + return $uri; +} diff --git a/vendor/guzzlehttp/guzzle/src/functions_include.php b/vendor/guzzlehttp/guzzle/src/functions_include.php new file mode 100644 index 0000000..a93393a --- /dev/null +++ b/vendor/guzzlehttp/guzzle/src/functions_include.php @@ -0,0 +1,6 @@ + + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/guzzlehttp/promises/Makefile b/vendor/guzzlehttp/promises/Makefile new file mode 100644 index 0000000..8d5b3ef --- /dev/null +++ b/vendor/guzzlehttp/promises/Makefile @@ -0,0 +1,13 @@ +all: clean test + +test: + vendor/bin/phpunit + +coverage: + vendor/bin/phpunit --coverage-html=artifacts/coverage + +view-coverage: + open artifacts/coverage/index.html + +clean: + rm -rf artifacts/* diff --git a/vendor/guzzlehttp/promises/README.md b/vendor/guzzlehttp/promises/README.md new file mode 100644 index 0000000..7b607e2 --- /dev/null +++ b/vendor/guzzlehttp/promises/README.md @@ -0,0 +1,504 @@ +# Guzzle Promises + +[Promises/A+](https://promisesaplus.com/) implementation that handles promise +chaining and resolution iteratively, allowing for "infinite" promise chaining +while keeping the stack size constant. Read [this blog post](https://blog.domenic.me/youre-missing-the-point-of-promises/) +for a general introduction to promises. + +- [Features](#features) +- [Quick start](#quick-start) +- [Synchronous wait](#synchronous-wait) +- [Cancellation](#cancellation) +- [API](#api) + - [Promise](#promise) + - [FulfilledPromise](#fulfilledpromise) + - [RejectedPromise](#rejectedpromise) +- [Promise interop](#promise-interop) +- [Implementation notes](#implementation-notes) + + +# Features + +- [Promises/A+](https://promisesaplus.com/) implementation. +- Promise resolution and chaining is handled iteratively, allowing for + "infinite" promise chaining. +- Promises have a synchronous `wait` method. +- Promises can be cancelled. +- Works with any object that has a `then` function. +- C# style async/await coroutine promises using + `GuzzleHttp\Promise\coroutine()`. + + +# Quick start + +A *promise* represents the eventual result of an asynchronous operation. The +primary way of interacting with a promise is through its `then` method, which +registers callbacks to receive either a promise's eventual value or the reason +why the promise cannot be fulfilled. + + +## Callbacks + +Callbacks are registered with the `then` method by providing an optional +`$onFulfilled` followed by an optional `$onRejected` function. + + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then( + // $onFulfilled + function ($value) { + echo 'The promise was fulfilled.'; + }, + // $onRejected + function ($reason) { + echo 'The promise was rejected.'; + } +); +``` + +*Resolving* a promise means that you either fulfill a promise with a *value* or +reject a promise with a *reason*. Resolving a promises triggers callbacks +registered with the promises's `then` method. These callbacks are triggered +only once and in the order in which they were added. + + +## Resolving a promise + +Promises are fulfilled using the `resolve($value)` method. Resolving a promise +with any value other than a `GuzzleHttp\Promise\RejectedPromise` will trigger +all of the onFulfilled callbacks (resolving a promise with a rejected promise +will reject the promise and trigger the `$onRejected` callbacks). + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise + ->then(function ($value) { + // Return a value and don't break the chain + return "Hello, " . $value; + }) + // This then is executed after the first then and receives the value + // returned from the first then. + ->then(function ($value) { + echo $value; + }); + +// Resolving the promise triggers the $onFulfilled callbacks and outputs +// "Hello, reader". +$promise->resolve('reader.'); +``` + + +## Promise forwarding + +Promises can be chained one after the other. Each then in the chain is a new +promise. The return value of a promise is what's forwarded to the next +promise in the chain. Returning a promise in a `then` callback will cause the +subsequent promises in the chain to only be fulfilled when the returned promise +has been fulfilled. The next promise in the chain will be invoked with the +resolved value of the promise. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$nextPromise = new Promise(); + +$promise + ->then(function ($value) use ($nextPromise) { + echo $value; + return $nextPromise; + }) + ->then(function ($value) { + echo $value; + }); + +// Triggers the first callback and outputs "A" +$promise->resolve('A'); +// Triggers the second callback and outputs "B" +$nextPromise->resolve('B'); +``` + +## Promise rejection + +When a promise is rejected, the `$onRejected` callbacks are invoked with the +rejection reason. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + echo $reason; +}); + +$promise->reject('Error!'); +// Outputs "Error!" +``` + +## Rejection forwarding + +If an exception is thrown in an `$onRejected` callback, subsequent +`$onRejected` callbacks are invoked with the thrown exception as the reason. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + throw new \Exception($reason); +})->then(null, function ($reason) { + assert($reason->getMessage() === 'Error!'); +}); + +$promise->reject('Error!'); +``` + +You can also forward a rejection down the promise chain by returning a +`GuzzleHttp\Promise\RejectedPromise` in either an `$onFulfilled` or +`$onRejected` callback. + +```php +use GuzzleHttp\Promise\Promise; +use GuzzleHttp\Promise\RejectedPromise; + +$promise = new Promise(); +$promise->then(null, function ($reason) { + return new RejectedPromise($reason); +})->then(null, function ($reason) { + assert($reason === 'Error!'); +}); + +$promise->reject('Error!'); +``` + +If an exception is not thrown in a `$onRejected` callback and the callback +does not return a rejected promise, downstream `$onFulfilled` callbacks are +invoked using the value returned from the `$onRejected` callback. + +```php +use GuzzleHttp\Promise\Promise; +use GuzzleHttp\Promise\RejectedPromise; + +$promise = new Promise(); +$promise + ->then(null, function ($reason) { + return "It's ok"; + }) + ->then(function ($value) { + assert($value === "It's ok"); + }); + +$promise->reject('Error!'); +``` + +# Synchronous wait + +You can synchronously force promises to complete using a promise's `wait` +method. When creating a promise, you can provide a wait function that is used +to synchronously force a promise to complete. When a wait function is invoked +it is expected to deliver a value to the promise or reject the promise. If the +wait function does not deliver a value, then an exception is thrown. The wait +function provided to a promise constructor is invoked when the `wait` function +of the promise is called. + +```php +$promise = new Promise(function () use (&$promise) { + $promise->resolve('foo'); +}); + +// Calling wait will return the value of the promise. +echo $promise->wait(); // outputs "foo" +``` + +If an exception is encountered while invoking the wait function of a promise, +the promise is rejected with the exception and the exception is thrown. + +```php +$promise = new Promise(function () use (&$promise) { + throw new \Exception('foo'); +}); + +$promise->wait(); // throws the exception. +``` + +Calling `wait` on a promise that has been fulfilled will not trigger the wait +function. It will simply return the previously resolved value. + +```php +$promise = new Promise(function () { die('this is not called!'); }); +$promise->resolve('foo'); +echo $promise->wait(); // outputs "foo" +``` + +Calling `wait` on a promise that has been rejected will throw an exception. If +the rejection reason is an instance of `\Exception` the reason is thrown. +Otherwise, a `GuzzleHttp\Promise\RejectionException` is thrown and the reason +can be obtained by calling the `getReason` method of the exception. + +```php +$promise = new Promise(); +$promise->reject('foo'); +$promise->wait(); +``` + +> PHP Fatal error: Uncaught exception 'GuzzleHttp\Promise\RejectionException' with message 'The promise was rejected with value: foo' + + +## Unwrapping a promise + +When synchronously waiting on a promise, you are joining the state of the +promise into the current state of execution (i.e., return the value of the +promise if it was fulfilled or throw an exception if it was rejected). This is +called "unwrapping" the promise. Waiting on a promise will by default unwrap +the promise state. + +You can force a promise to resolve and *not* unwrap the state of the promise +by passing `false` to the first argument of the `wait` function: + +```php +$promise = new Promise(); +$promise->reject('foo'); +// This will not throw an exception. It simply ensures the promise has +// been resolved. +$promise->wait(false); +``` + +When unwrapping a promise, the resolved value of the promise will be waited +upon until the unwrapped value is not a promise. This means that if you resolve +promise A with a promise B and unwrap promise A, the value returned by the +wait function will be the value delivered to promise B. + +**Note**: when you do not unwrap the promise, no value is returned. + + +# Cancellation + +You can cancel a promise that has not yet been fulfilled using the `cancel()` +method of a promise. When creating a promise you can provide an optional +cancel function that when invoked cancels the action of computing a resolution +of the promise. + + +# API + + +## Promise + +When creating a promise object, you can provide an optional `$waitFn` and +`$cancelFn`. `$waitFn` is a function that is invoked with no arguments and is +expected to resolve the promise. `$cancelFn` is a function with no arguments +that is expected to cancel the computation of a promise. It is invoked when the +`cancel()` method of a promise is called. + +```php +use GuzzleHttp\Promise\Promise; + +$promise = new Promise( + function () use (&$promise) { + $promise->resolve('waited'); + }, + function () { + // do something that will cancel the promise computation (e.g., close + // a socket, cancel a database query, etc...) + } +); + +assert('waited' === $promise->wait()); +``` + +A promise has the following methods: + +- `then(callable $onFulfilled, callable $onRejected) : PromiseInterface` + + Appends fulfillment and rejection handlers to the promise, and returns a new promise resolving to the return value of the called handler. + +- `otherwise(callable $onRejected) : PromiseInterface` + + Appends a rejection handler callback to the promise, and returns a new promise resolving to the return value of the callback if it is called, or to its original fulfillment value if the promise is instead fulfilled. + +- `wait($unwrap = true) : mixed` + + Synchronously waits on the promise to complete. + + `$unwrap` controls whether or not the value of the promise is returned for a + fulfilled promise or if an exception is thrown if the promise is rejected. + This is set to `true` by default. + +- `cancel()` + + Attempts to cancel the promise if possible. The promise being cancelled and + the parent most ancestor that has not yet been resolved will also be + cancelled. Any promises waiting on the cancelled promise to resolve will also + be cancelled. + +- `getState() : string` + + Returns the state of the promise. One of `pending`, `fulfilled`, or + `rejected`. + +- `resolve($value)` + + Fulfills the promise with the given `$value`. + +- `reject($reason)` + + Rejects the promise with the given `$reason`. + + +## FulfilledPromise + +A fulfilled promise can be created to represent a promise that has been +fulfilled. + +```php +use GuzzleHttp\Promise\FulfilledPromise; + +$promise = new FulfilledPromise('value'); + +// Fulfilled callbacks are immediately invoked. +$promise->then(function ($value) { + echo $value; +}); +``` + + +## RejectedPromise + +A rejected promise can be created to represent a promise that has been +rejected. + +```php +use GuzzleHttp\Promise\RejectedPromise; + +$promise = new RejectedPromise('Error'); + +// Rejected callbacks are immediately invoked. +$promise->then(null, function ($reason) { + echo $reason; +}); +``` + + +# Promise interop + +This library works with foreign promises that have a `then` method. This means +you can use Guzzle promises with [React promises](https://github.com/reactphp/promise) +for example. When a foreign promise is returned inside of a then method +callback, promise resolution will occur recursively. + +```php +// Create a React promise +$deferred = new React\Promise\Deferred(); +$reactPromise = $deferred->promise(); + +// Create a Guzzle promise that is fulfilled with a React promise. +$guzzlePromise = new \GuzzleHttp\Promise\Promise(); +$guzzlePromise->then(function ($value) use ($reactPromise) { + // Do something something with the value... + // Return the React promise + return $reactPromise; +}); +``` + +Please note that wait and cancel chaining is no longer possible when forwarding +a foreign promise. You will need to wrap a third-party promise with a Guzzle +promise in order to utilize wait and cancel functions with foreign promises. + + +## Event Loop Integration + +In order to keep the stack size constant, Guzzle promises are resolved +asynchronously using a task queue. When waiting on promises synchronously, the +task queue will be automatically run to ensure that the blocking promise and +any forwarded promises are resolved. When using promises asynchronously in an +event loop, you will need to run the task queue on each tick of the loop. If +you do not run the task queue, then promises will not be resolved. + +You can run the task queue using the `run()` method of the global task queue +instance. + +```php +// Get the global task queue +$queue = \GuzzleHttp\Promise\queue(); +$queue->run(); +``` + +For example, you could use Guzzle promises with React using a periodic timer: + +```php +$loop = React\EventLoop\Factory::create(); +$loop->addPeriodicTimer(0, [$queue, 'run']); +``` + +*TODO*: Perhaps adding a `futureTick()` on each tick would be faster? + + +# Implementation notes + + +## Promise resolution and chaining is handled iteratively + +By shuffling pending handlers from one owner to another, promises are +resolved iteratively, allowing for "infinite" then chaining. + +```php +then(function ($v) { + // The stack size remains constant (a good thing) + echo xdebug_get_stack_depth() . ', '; + return $v + 1; + }); +} + +$parent->resolve(0); +var_dump($p->wait()); // int(1000) + +``` + +When a promise is fulfilled or rejected with a non-promise value, the promise +then takes ownership of the handlers of each child promise and delivers values +down the chain without using recursion. + +When a promise is resolved with another promise, the original promise transfers +all of its pending handlers to the new promise. When the new promise is +eventually resolved, all of the pending handlers are delivered the forwarded +value. + + +## A promise is the deferred. + +Some promise libraries implement promises using a deferred object to represent +a computation and a promise object to represent the delivery of the result of +the computation. This is a nice separation of computation and delivery because +consumers of the promise cannot modify the value that will be eventually +delivered. + +One side effect of being able to implement promise resolution and chaining +iteratively is that you need to be able for one promise to reach into the state +of another promise to shuffle around ownership of handlers. In order to achieve +this without making the handlers of a promise publicly mutable, a promise is +also the deferred value, allowing promises of the same parent class to reach +into and modify the private properties of promises of the same type. While this +does allow consumers of the value to modify the resolution or rejection of the +deferred, it is a small price to pay for keeping the stack size constant. + +```php +$promise = new Promise(); +$promise->then(function ($value) { echo $value; }); +// The promise is the deferred value, so you can deliver a value to it. +$promise->resolve('foo'); +// prints "foo" +``` diff --git a/vendor/guzzlehttp/promises/composer.json b/vendor/guzzlehttp/promises/composer.json new file mode 100644 index 0000000..ec41a61 --- /dev/null +++ b/vendor/guzzlehttp/promises/composer.json @@ -0,0 +1,34 @@ +{ + "name": "guzzlehttp/promises", + "description": "Guzzle promises library", + "keywords": ["promise"], + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": ["src/functions_include.php"] + }, + "scripts": { + "test": "vendor/bin/phpunit", + "test-ci": "vendor/bin/phpunit --coverage-text" + }, + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + } +} diff --git a/vendor/guzzlehttp/promises/src/AggregateException.php b/vendor/guzzlehttp/promises/src/AggregateException.php new file mode 100644 index 0000000..6a5690c --- /dev/null +++ b/vendor/guzzlehttp/promises/src/AggregateException.php @@ -0,0 +1,16 @@ +then(function ($v) { echo $v; }); + * + * @param callable $generatorFn Generator function to wrap into a promise. + * + * @return Promise + * @link https://github.com/petkaantonov/bluebird/blob/master/API.md#generators inspiration + */ +final class Coroutine implements PromiseInterface +{ + /** + * @var PromiseInterface|null + */ + private $currentPromise; + + /** + * @var Generator + */ + private $generator; + + /** + * @var Promise + */ + private $result; + + public function __construct(callable $generatorFn) + { + $this->generator = $generatorFn(); + $this->result = new Promise(function () { + while (isset($this->currentPromise)) { + $this->currentPromise->wait(); + } + }); + $this->nextCoroutine($this->generator->current()); + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + return $this->result->then($onFulfilled, $onRejected); + } + + public function otherwise(callable $onRejected) + { + return $this->result->otherwise($onRejected); + } + + public function wait($unwrap = true) + { + return $this->result->wait($unwrap); + } + + public function getState() + { + return $this->result->getState(); + } + + public function resolve($value) + { + $this->result->resolve($value); + } + + public function reject($reason) + { + $this->result->reject($reason); + } + + public function cancel() + { + $this->currentPromise->cancel(); + $this->result->cancel(); + } + + private function nextCoroutine($yielded) + { + $this->currentPromise = promise_for($yielded) + ->then([$this, '_handleSuccess'], [$this, '_handleFailure']); + } + + /** + * @internal + */ + public function _handleSuccess($value) + { + unset($this->currentPromise); + try { + $next = $this->generator->send($value); + if ($this->generator->valid()) { + $this->nextCoroutine($next); + } else { + $this->result->resolve($value); + } + } catch (Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } + + /** + * @internal + */ + public function _handleFailure($reason) + { + unset($this->currentPromise); + try { + $nextYield = $this->generator->throw(exception_for($reason)); + // The throw was caught, so keep iterating on the coroutine + $this->nextCoroutine($nextYield); + } catch (Exception $exception) { + $this->result->reject($exception); + } catch (Throwable $throwable) { + $this->result->reject($throwable); + } + } +} diff --git a/vendor/guzzlehttp/promises/src/EachPromise.php b/vendor/guzzlehttp/promises/src/EachPromise.php new file mode 100644 index 0000000..d0ddf60 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/EachPromise.php @@ -0,0 +1,229 @@ +iterable = iter_for($iterable); + + if (isset($config['concurrency'])) { + $this->concurrency = $config['concurrency']; + } + + if (isset($config['fulfilled'])) { + $this->onFulfilled = $config['fulfilled']; + } + + if (isset($config['rejected'])) { + $this->onRejected = $config['rejected']; + } + } + + public function promise() + { + if ($this->aggregate) { + return $this->aggregate; + } + + try { + $this->createPromise(); + $this->iterable->rewind(); + $this->refillPending(); + } catch (\Throwable $e) { + $this->aggregate->reject($e); + } catch (\Exception $e) { + $this->aggregate->reject($e); + } + + return $this->aggregate; + } + + private function createPromise() + { + $this->mutex = false; + $this->aggregate = new Promise(function () { + reset($this->pending); + if (empty($this->pending) && !$this->iterable->valid()) { + $this->aggregate->resolve(null); + return; + } + + // Consume a potentially fluctuating list of promises while + // ensuring that indexes are maintained (precluding array_shift). + while ($promise = current($this->pending)) { + next($this->pending); + $promise->wait(); + if ($this->aggregate->getState() !== PromiseInterface::PENDING) { + return; + } + } + }); + + // Clear the references when the promise is resolved. + $clearFn = function () { + $this->iterable = $this->concurrency = $this->pending = null; + $this->onFulfilled = $this->onRejected = null; + }; + + $this->aggregate->then($clearFn, $clearFn); + } + + private function refillPending() + { + if (!$this->concurrency) { + // Add all pending promises. + while ($this->addPending() && $this->advanceIterator()); + return; + } + + // Add only up to N pending promises. + $concurrency = is_callable($this->concurrency) + ? call_user_func($this->concurrency, count($this->pending)) + : $this->concurrency; + $concurrency = max($concurrency - count($this->pending), 0); + // Concurrency may be set to 0 to disallow new promises. + if (!$concurrency) { + return; + } + // Add the first pending promise. + $this->addPending(); + // Note this is special handling for concurrency=1 so that we do + // not advance the iterator after adding the first promise. This + // helps work around issues with generators that might not have the + // next value to yield until promise callbacks are called. + while (--$concurrency + && $this->advanceIterator() + && $this->addPending()); + } + + private function addPending() + { + if (!$this->iterable || !$this->iterable->valid()) { + return false; + } + + $promise = promise_for($this->iterable->current()); + $idx = $this->iterable->key(); + + $this->pending[$idx] = $promise->then( + function ($value) use ($idx) { + if ($this->onFulfilled) { + call_user_func( + $this->onFulfilled, $value, $idx, $this->aggregate + ); + } + $this->step($idx); + }, + function ($reason) use ($idx) { + if ($this->onRejected) { + call_user_func( + $this->onRejected, $reason, $idx, $this->aggregate + ); + } + $this->step($idx); + } + ); + + return true; + } + + private function advanceIterator() + { + // Place a lock on the iterator so that we ensure to not recurse, + // preventing fatal generator errors. + if ($this->mutex) { + return false; + } + + $this->mutex = true; + + try { + $this->iterable->next(); + $this->mutex = false; + return true; + } catch (\Throwable $e) { + $this->aggregate->reject($e); + $this->mutex = false; + return false; + } catch (\Exception $e) { + $this->aggregate->reject($e); + $this->mutex = false; + return false; + } + } + + private function step($idx) + { + // If the promise was already resolved, then ignore this step. + if ($this->aggregate->getState() !== PromiseInterface::PENDING) { + return; + } + + unset($this->pending[$idx]); + + // Only refill pending promises if we are not locked, preventing the + // EachPromise to recursively invoke the provided iterator, which + // cause a fatal error: "Cannot resume an already running generator" + if ($this->advanceIterator() && !$this->checkIfFinished()) { + // Add more pending promises if possible. + $this->refillPending(); + } + } + + private function checkIfFinished() + { + if (!$this->pending && !$this->iterable->valid()) { + // Resolve the promise if there's nothing left to do. + $this->aggregate->resolve(null); + return true; + } + + return false; + } +} diff --git a/vendor/guzzlehttp/promises/src/FulfilledPromise.php b/vendor/guzzlehttp/promises/src/FulfilledPromise.php new file mode 100644 index 0000000..dbbeeb9 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/FulfilledPromise.php @@ -0,0 +1,82 @@ +value = $value; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + // Return itself if there is no onFulfilled function. + if (!$onFulfilled) { + return $this; + } + + $queue = queue(); + $p = new Promise([$queue, 'run']); + $value = $this->value; + $queue->add(static function () use ($p, $value, $onFulfilled) { + if ($p->getState() === self::PENDING) { + try { + $p->resolve($onFulfilled($value)); + } catch (\Throwable $e) { + $p->reject($e); + } catch (\Exception $e) { + $p->reject($e); + } + } + }); + + return $p; + } + + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + + public function wait($unwrap = true, $defaultDelivery = null) + { + return $unwrap ? $this->value : null; + } + + public function getState() + { + return self::FULFILLED; + } + + public function resolve($value) + { + if ($value !== $this->value) { + throw new \LogicException("Cannot resolve a fulfilled promise"); + } + } + + public function reject($reason) + { + throw new \LogicException("Cannot reject a fulfilled promise"); + } + + public function cancel() + { + // pass + } +} diff --git a/vendor/guzzlehttp/promises/src/Promise.php b/vendor/guzzlehttp/promises/src/Promise.php new file mode 100644 index 0000000..844ada0 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/Promise.php @@ -0,0 +1,280 @@ +waitFn = $waitFn; + $this->cancelFn = $cancelFn; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + if ($this->state === self::PENDING) { + $p = new Promise(null, [$this, 'cancel']); + $this->handlers[] = [$p, $onFulfilled, $onRejected]; + $p->waitList = $this->waitList; + $p->waitList[] = $this; + return $p; + } + + // Return a fulfilled promise and immediately invoke any callbacks. + if ($this->state === self::FULFILLED) { + return $onFulfilled + ? promise_for($this->result)->then($onFulfilled) + : promise_for($this->result); + } + + // It's either cancelled or rejected, so return a rejected promise + // and immediately invoke any callbacks. + $rejection = rejection_for($this->result); + return $onRejected ? $rejection->then(null, $onRejected) : $rejection; + } + + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + + public function wait($unwrap = true) + { + $this->waitIfPending(); + + $inner = $this->result instanceof PromiseInterface + ? $this->result->wait($unwrap) + : $this->result; + + if ($unwrap) { + if ($this->result instanceof PromiseInterface + || $this->state === self::FULFILLED + ) { + return $inner; + } else { + // It's rejected so "unwrap" and throw an exception. + throw exception_for($inner); + } + } + } + + public function getState() + { + return $this->state; + } + + public function cancel() + { + if ($this->state !== self::PENDING) { + return; + } + + $this->waitFn = $this->waitList = null; + + if ($this->cancelFn) { + $fn = $this->cancelFn; + $this->cancelFn = null; + try { + $fn(); + } catch (\Throwable $e) { + $this->reject($e); + } catch (\Exception $e) { + $this->reject($e); + } + } + + // Reject the promise only if it wasn't rejected in a then callback. + if ($this->state === self::PENDING) { + $this->reject(new CancellationException('Promise has been cancelled')); + } + } + + public function resolve($value) + { + $this->settle(self::FULFILLED, $value); + } + + public function reject($reason) + { + $this->settle(self::REJECTED, $reason); + } + + private function settle($state, $value) + { + if ($this->state !== self::PENDING) { + // Ignore calls with the same resolution. + if ($state === $this->state && $value === $this->result) { + return; + } + throw $this->state === $state + ? new \LogicException("The promise is already {$state}.") + : new \LogicException("Cannot change a {$this->state} promise to {$state}"); + } + + if ($value === $this) { + throw new \LogicException('Cannot fulfill or reject a promise with itself'); + } + + // Clear out the state of the promise but stash the handlers. + $this->state = $state; + $this->result = $value; + $handlers = $this->handlers; + $this->handlers = null; + $this->waitList = $this->waitFn = null; + $this->cancelFn = null; + + if (!$handlers) { + return; + } + + // If the value was not a settled promise or a thenable, then resolve + // it in the task queue using the correct ID. + if (!method_exists($value, 'then')) { + $id = $state === self::FULFILLED ? 1 : 2; + // It's a success, so resolve the handlers in the queue. + queue()->add(static function () use ($id, $value, $handlers) { + foreach ($handlers as $handler) { + self::callHandler($id, $value, $handler); + } + }); + } elseif ($value instanceof Promise + && $value->getState() === self::PENDING + ) { + // We can just merge our handlers onto the next promise. + $value->handlers = array_merge($value->handlers, $handlers); + } else { + // Resolve the handlers when the forwarded promise is resolved. + $value->then( + static function ($value) use ($handlers) { + foreach ($handlers as $handler) { + self::callHandler(1, $value, $handler); + } + }, + static function ($reason) use ($handlers) { + foreach ($handlers as $handler) { + self::callHandler(2, $reason, $handler); + } + } + ); + } + } + + /** + * Call a stack of handlers using a specific callback index and value. + * + * @param int $index 1 (resolve) or 2 (reject). + * @param mixed $value Value to pass to the callback. + * @param array $handler Array of handler data (promise and callbacks). + * + * @return array Returns the next group to resolve. + */ + private static function callHandler($index, $value, array $handler) + { + /** @var PromiseInterface $promise */ + $promise = $handler[0]; + + // The promise may have been cancelled or resolved before placing + // this thunk in the queue. + if ($promise->getState() !== self::PENDING) { + return; + } + + try { + if (isset($handler[$index])) { + $promise->resolve($handler[$index]($value)); + } elseif ($index === 1) { + // Forward resolution values as-is. + $promise->resolve($value); + } else { + // Forward rejections down the chain. + $promise->reject($value); + } + } catch (\Throwable $reason) { + $promise->reject($reason); + } catch (\Exception $reason) { + $promise->reject($reason); + } + } + + private function waitIfPending() + { + if ($this->state !== self::PENDING) { + return; + } elseif ($this->waitFn) { + $this->invokeWaitFn(); + } elseif ($this->waitList) { + $this->invokeWaitList(); + } else { + // If there's not wait function, then reject the promise. + $this->reject('Cannot wait on a promise that has ' + . 'no internal wait function. You must provide a wait ' + . 'function when constructing the promise to be able to ' + . 'wait on a promise.'); + } + + queue()->run(); + + if ($this->state === self::PENDING) { + $this->reject('Invoking the wait callback did not resolve the promise'); + } + } + + private function invokeWaitFn() + { + try { + $wfn = $this->waitFn; + $this->waitFn = null; + $wfn(true); + } catch (\Exception $reason) { + if ($this->state === self::PENDING) { + // The promise has not been resolved yet, so reject the promise + // with the exception. + $this->reject($reason); + } else { + // The promise was already resolved, so there's a problem in + // the application. + throw $reason; + } + } + } + + private function invokeWaitList() + { + $waitList = $this->waitList; + $this->waitList = null; + + foreach ($waitList as $result) { + while (true) { + $result->waitIfPending(); + + if ($result->result instanceof Promise) { + $result = $result->result; + } else { + if ($result->result instanceof PromiseInterface) { + $result->result->wait(false); + } + break; + } + } + } + } +} diff --git a/vendor/guzzlehttp/promises/src/PromiseInterface.php b/vendor/guzzlehttp/promises/src/PromiseInterface.php new file mode 100644 index 0000000..8f5f4b9 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/PromiseInterface.php @@ -0,0 +1,93 @@ +reason = $reason; + } + + public function then( + callable $onFulfilled = null, + callable $onRejected = null + ) { + // If there's no onRejected callback then just return self. + if (!$onRejected) { + return $this; + } + + $queue = queue(); + $reason = $this->reason; + $p = new Promise([$queue, 'run']); + $queue->add(static function () use ($p, $reason, $onRejected) { + if ($p->getState() === self::PENDING) { + try { + // Return a resolved promise if onRejected does not throw. + $p->resolve($onRejected($reason)); + } catch (\Throwable $e) { + // onRejected threw, so return a rejected promise. + $p->reject($e); + } catch (\Exception $e) { + // onRejected threw, so return a rejected promise. + $p->reject($e); + } + } + }); + + return $p; + } + + public function otherwise(callable $onRejected) + { + return $this->then(null, $onRejected); + } + + public function wait($unwrap = true, $defaultDelivery = null) + { + if ($unwrap) { + throw exception_for($this->reason); + } + } + + public function getState() + { + return self::REJECTED; + } + + public function resolve($value) + { + throw new \LogicException("Cannot resolve a rejected promise"); + } + + public function reject($reason) + { + if ($reason !== $this->reason) { + throw new \LogicException("Cannot reject a rejected promise"); + } + } + + public function cancel() + { + // pass + } +} diff --git a/vendor/guzzlehttp/promises/src/RejectionException.php b/vendor/guzzlehttp/promises/src/RejectionException.php new file mode 100644 index 0000000..07c1136 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/RejectionException.php @@ -0,0 +1,47 @@ +reason = $reason; + + $message = 'The promise was rejected'; + + if ($description) { + $message .= ' with reason: ' . $description; + } elseif (is_string($reason) + || (is_object($reason) && method_exists($reason, '__toString')) + ) { + $message .= ' with reason: ' . $this->reason; + } elseif ($reason instanceof \JsonSerializable) { + $message .= ' with reason: ' + . json_encode($this->reason, JSON_PRETTY_PRINT); + } + + parent::__construct($message); + } + + /** + * Returns the rejection reason. + * + * @return mixed + */ + public function getReason() + { + return $this->reason; + } +} diff --git a/vendor/guzzlehttp/promises/src/TaskQueue.php b/vendor/guzzlehttp/promises/src/TaskQueue.php new file mode 100644 index 0000000..6e8a2a0 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/TaskQueue.php @@ -0,0 +1,66 @@ +run(); + */ +class TaskQueue implements TaskQueueInterface +{ + private $enableShutdown = true; + private $queue = []; + + public function __construct($withShutdown = true) + { + if ($withShutdown) { + register_shutdown_function(function () { + if ($this->enableShutdown) { + // Only run the tasks if an E_ERROR didn't occur. + $err = error_get_last(); + if (!$err || ($err['type'] ^ E_ERROR)) { + $this->run(); + } + } + }); + } + } + + public function isEmpty() + { + return !$this->queue; + } + + public function add(callable $task) + { + $this->queue[] = $task; + } + + public function run() + { + /** @var callable $task */ + while ($task = array_shift($this->queue)) { + $task(); + } + } + + /** + * The task queue will be run and exhausted by default when the process + * exits IFF the exit is not the result of a PHP E_ERROR error. + * + * You can disable running the automatic shutdown of the queue by calling + * this function. If you disable the task queue shutdown process, then you + * MUST either run the task queue (as a result of running your event loop + * or manually using the run() method) or wait on each outstanding promise. + * + * Note: This shutdown will occur before any destructors are triggered. + */ + public function disableShutdown() + { + $this->enableShutdown = false; + } +} diff --git a/vendor/guzzlehttp/promises/src/TaskQueueInterface.php b/vendor/guzzlehttp/promises/src/TaskQueueInterface.php new file mode 100644 index 0000000..ac8306e --- /dev/null +++ b/vendor/guzzlehttp/promises/src/TaskQueueInterface.php @@ -0,0 +1,25 @@ + + * while ($eventLoop->isRunning()) { + * GuzzleHttp\Promise\queue()->run(); + * } + * + * + * @param TaskQueueInterface $assign Optionally specify a new queue instance. + * + * @return TaskQueueInterface + */ +function queue(TaskQueueInterface $assign = null) +{ + static $queue; + + if ($assign) { + $queue = $assign; + } elseif (!$queue) { + $queue = new TaskQueue(); + } + + return $queue; +} + +/** + * Adds a function to run in the task queue when it is next `run()` and returns + * a promise that is fulfilled or rejected with the result. + * + * @param callable $task Task function to run. + * + * @return PromiseInterface + */ +function task(callable $task) +{ + $queue = queue(); + $promise = new Promise([$queue, 'run']); + $queue->add(function () use ($task, $promise) { + try { + $promise->resolve($task()); + } catch (\Throwable $e) { + $promise->reject($e); + } catch (\Exception $e) { + $promise->reject($e); + } + }); + + return $promise; +} + +/** + * Creates a promise for a value if the value is not a promise. + * + * @param mixed $value Promise or value. + * + * @return PromiseInterface + */ +function promise_for($value) +{ + if ($value instanceof PromiseInterface) { + return $value; + } + + // Return a Guzzle promise that shadows the given promise. + if (method_exists($value, 'then')) { + $wfn = method_exists($value, 'wait') ? [$value, 'wait'] : null; + $cfn = method_exists($value, 'cancel') ? [$value, 'cancel'] : null; + $promise = new Promise($wfn, $cfn); + $value->then([$promise, 'resolve'], [$promise, 'reject']); + return $promise; + } + + return new FulfilledPromise($value); +} + +/** + * Creates a rejected promise for a reason if the reason is not a promise. If + * the provided reason is a promise, then it is returned as-is. + * + * @param mixed $reason Promise or reason. + * + * @return PromiseInterface + */ +function rejection_for($reason) +{ + if ($reason instanceof PromiseInterface) { + return $reason; + } + + return new RejectedPromise($reason); +} + +/** + * Create an exception for a rejected promise value. + * + * @param mixed $reason + * + * @return \Exception|\Throwable + */ +function exception_for($reason) +{ + return $reason instanceof \Exception || $reason instanceof \Throwable + ? $reason + : new RejectionException($reason); +} + +/** + * Returns an iterator for the given value. + * + * @param mixed $value + * + * @return \Iterator + */ +function iter_for($value) +{ + if ($value instanceof \Iterator) { + return $value; + } elseif (is_array($value)) { + return new \ArrayIterator($value); + } else { + return new \ArrayIterator([$value]); + } +} + +/** + * Synchronously waits on a promise to resolve and returns an inspection state + * array. + * + * Returns a state associative array containing a "state" key mapping to a + * valid promise state. If the state of the promise is "fulfilled", the array + * will contain a "value" key mapping to the fulfilled value of the promise. If + * the promise is rejected, the array will contain a "reason" key mapping to + * the rejection reason of the promise. + * + * @param PromiseInterface $promise Promise or value. + * + * @return array + */ +function inspect(PromiseInterface $promise) +{ + try { + return [ + 'state' => PromiseInterface::FULFILLED, + 'value' => $promise->wait() + ]; + } catch (RejectionException $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()]; + } catch (\Throwable $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; + } catch (\Exception $e) { + return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; + } +} + +/** + * Waits on all of the provided promises, but does not unwrap rejected promises + * as thrown exception. + * + * Returns an array of inspection state arrays. + * + * @param PromiseInterface[] $promises Traversable of promises to wait upon. + * + * @return array + * @see GuzzleHttp\Promise\inspect for the inspection state array format. + */ +function inspect_all($promises) +{ + $results = []; + foreach ($promises as $key => $promise) { + $results[$key] = inspect($promise); + } + + return $results; +} + +/** + * Waits on all of the provided promises and returns the fulfilled values. + * + * Returns an array that contains the value of each promise (in the same order + * the promises were provided). An exception is thrown if any of the promises + * are rejected. + * + * @param mixed $promises Iterable of PromiseInterface objects to wait on. + * + * @return array + * @throws \Exception on error + * @throws \Throwable on error in PHP >=7 + */ +function unwrap($promises) +{ + $results = []; + foreach ($promises as $key => $promise) { + $results[$key] = $promise->wait(); + } + + return $results; +} + +/** + * Given an array of promises, return a promise that is fulfilled when all the + * items in the array are fulfilled. + * + * The promise's fulfillment value is an array with fulfillment values at + * respective positions to the original array. If any promise in the array + * rejects, the returned promise is rejected with the rejection reason. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ +function all($promises) +{ + $results = []; + return each( + $promises, + function ($value, $idx) use (&$results) { + $results[$idx] = $value; + }, + function ($reason, $idx, Promise $aggregate) { + $aggregate->reject($reason); + } + )->then(function () use (&$results) { + ksort($results); + return $results; + }); +} + +/** + * Initiate a competitive race between multiple promises or values (values will + * become immediately fulfilled promises). + * + * When count amount of promises have been fulfilled, the returned promise is + * fulfilled with an array that contains the fulfillment values of the winners + * in order of resolution. + * + * This prommise is rejected with a {@see GuzzleHttp\Promise\AggregateException} + * if the number of fulfilled promises is less than the desired $count. + * + * @param int $count Total number of promises. + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ +function some($count, $promises) +{ + $results = []; + $rejections = []; + + return each( + $promises, + function ($value, $idx, PromiseInterface $p) use (&$results, $count) { + if ($p->getState() !== PromiseInterface::PENDING) { + return; + } + $results[$idx] = $value; + if (count($results) >= $count) { + $p->resolve(null); + } + }, + function ($reason) use (&$rejections) { + $rejections[] = $reason; + } + )->then( + function () use (&$results, &$rejections, $count) { + if (count($results) !== $count) { + throw new AggregateException( + 'Not enough promises to fulfill count', + $rejections + ); + } + ksort($results); + return array_values($results); + } + ); +} + +/** + * Like some(), with 1 as count. However, if the promise fulfills, the + * fulfillment value is not an array of 1 but the value directly. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + */ +function any($promises) +{ + return some(1, $promises)->then(function ($values) { return $values[0]; }); +} + +/** + * Returns a promise that is fulfilled when all of the provided promises have + * been fulfilled or rejected. + * + * The returned promise is fulfilled with an array of inspection state arrays. + * + * @param mixed $promises Promises or values. + * + * @return PromiseInterface + * @see GuzzleHttp\Promise\inspect for the inspection state array format. + */ +function settle($promises) +{ + $results = []; + + return each( + $promises, + function ($value, $idx) use (&$results) { + $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value]; + }, + function ($reason, $idx) use (&$results) { + $results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason]; + } + )->then(function () use (&$results) { + ksort($results); + return $results; + }); +} + +/** + * Given an iterator that yields promises or values, returns a promise that is + * fulfilled with a null value when the iterator has been consumed or the + * aggregate promise has been fulfilled or rejected. + * + * $onFulfilled is a function that accepts the fulfilled value, iterator + * index, and the aggregate promise. The callback can invoke any necessary side + * effects and choose to resolve or reject the aggregate promise if needed. + * + * $onRejected is a function that accepts the rejection reason, iterator + * index, and the aggregate promise. The callback can invoke any necessary side + * effects and choose to resolve or reject the aggregate promise if needed. + * + * @param mixed $iterable Iterator or array to iterate over. + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + */ +function each( + $iterable, + callable $onFulfilled = null, + callable $onRejected = null +) { + return (new EachPromise($iterable, [ + 'fulfilled' => $onFulfilled, + 'rejected' => $onRejected + ]))->promise(); +} + +/** + * Like each, but only allows a certain number of outstanding promises at any + * given time. + * + * $concurrency may be an integer or a function that accepts the number of + * pending promises and returns a numeric concurrency limit value to allow for + * dynamic a concurrency size. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * @param callable $onRejected + * + * @return PromiseInterface + */ +function each_limit( + $iterable, + $concurrency, + callable $onFulfilled = null, + callable $onRejected = null +) { + return (new EachPromise($iterable, [ + 'fulfilled' => $onFulfilled, + 'rejected' => $onRejected, + 'concurrency' => $concurrency + ]))->promise(); +} + +/** + * Like each_limit, but ensures that no promise in the given $iterable argument + * is rejected. If any promise is rejected, then the aggregate promise is + * rejected with the encountered rejection. + * + * @param mixed $iterable + * @param int|callable $concurrency + * @param callable $onFulfilled + * + * @return PromiseInterface + */ +function each_limit_all( + $iterable, + $concurrency, + callable $onFulfilled = null +) { + return each_limit( + $iterable, + $concurrency, + $onFulfilled, + function ($reason, $idx, PromiseInterface $aggregate) { + $aggregate->reject($reason); + } + ); +} + +/** + * Returns true if a promise is fulfilled. + * + * @param PromiseInterface $promise + * + * @return bool + */ +function is_fulfilled(PromiseInterface $promise) +{ + return $promise->getState() === PromiseInterface::FULFILLED; +} + +/** + * Returns true if a promise is rejected. + * + * @param PromiseInterface $promise + * + * @return bool + */ +function is_rejected(PromiseInterface $promise) +{ + return $promise->getState() === PromiseInterface::REJECTED; +} + +/** + * Returns true if a promise is fulfilled or rejected. + * + * @param PromiseInterface $promise + * + * @return bool + */ +function is_settled(PromiseInterface $promise) +{ + return $promise->getState() !== PromiseInterface::PENDING; +} + +/** + * @see Coroutine + * + * @param callable $generatorFn + * + * @return PromiseInterface + */ +function coroutine(callable $generatorFn) +{ + return new Coroutine($generatorFn); +} diff --git a/vendor/guzzlehttp/promises/src/functions_include.php b/vendor/guzzlehttp/promises/src/functions_include.php new file mode 100644 index 0000000..34cd171 --- /dev/null +++ b/vendor/guzzlehttp/promises/src/functions_include.php @@ -0,0 +1,6 @@ +withPath('foo')->withHost('example.com')` will throw an exception + because the path of a URI with an authority must start with a slash "/" or be empty + - `(new Uri())->withScheme('http')` will return `'http://localhost'` + +### Deprecated + +- `Uri::resolve` in favor of `UriResolver::resolve` +- `Uri::removeDotSegments` in favor of `UriResolver::removeDotSegments` + +### Fixed + +- `Stream::read` when length parameter <= 0. +- `copy_to_stream` reads bytes in chunks instead of `maxLen` into memory. +- `ServerRequest::getUriFromGlobals` when `Host` header contains port. +- Compatibility of URIs with `file` scheme and empty host. + + +## [1.3.1] - 2016-06-25 + +### Fixed + +- `Uri::__toString` for network path references, e.g. `//example.org`. +- Missing lowercase normalization for host. +- Handling of URI components in case they are `'0'` in a lot of places, + e.g. as a user info password. +- `Uri::withAddedHeader` to correctly merge headers with different case. +- Trimming of header values in `Uri::withAddedHeader`. Header values may + be surrounded by whitespace which should be ignored according to RFC 7230 + Section 3.2.4. This does not apply to header names. +- `Uri::withAddedHeader` with an array of header values. +- `Uri::resolve` when base path has no slash and handling of fragment. +- Handling of encoding in `Uri::with(out)QueryValue` so one can pass the + key/value both in encoded as well as decoded form to those methods. This is + consistent with withPath, withQuery etc. +- `ServerRequest::withoutAttribute` when attribute value is null. + + +## [1.3.0] - 2016-04-13 + +### Added + +- Remaining interfaces needed for full PSR7 compatibility + (ServerRequestInterface, UploadedFileInterface, etc.). +- Support for stream_for from scalars. + +### Changed + +- Can now extend Uri. + +### Fixed +- A bug in validating request methods by making it more permissive. + + +## [1.2.3] - 2016-02-18 + +### Fixed + +- Support in `GuzzleHttp\Psr7\CachingStream` for seeking forward on remote + streams, which can sometimes return fewer bytes than requested with `fread`. +- Handling of gzipped responses with FNAME headers. + + +## [1.2.2] - 2016-01-22 + +### Added + +- Support for URIs without any authority. +- Support for HTTP 451 'Unavailable For Legal Reasons.' +- Support for using '0' as a filename. +- Support for including non-standard ports in Host headers. + + +## [1.2.1] - 2015-11-02 + +### Changes + +- Now supporting negative offsets when seeking to SEEK_END. + + +## [1.2.0] - 2015-08-15 + +### Changed + +- Body as `"0"` is now properly added to a response. +- Now allowing forward seeking in CachingStream. +- Now properly parsing HTTP requests that contain proxy targets in + `parse_request`. +- functions.php is now conditionally required. +- user-info is no longer dropped when resolving URIs. + + +## [1.1.0] - 2015-06-24 + +### Changed + +- URIs can now be relative. +- `multipart/form-data` headers are now overridden case-insensitively. +- URI paths no longer encode the following characters because they are allowed + in URIs: "(", ")", "*", "!", "'" +- A port is no longer added to a URI when the scheme is missing and no port is + present. + + +## 1.0.0 - 2015-05-19 + +Initial release. + +Currently unsupported: + +- `Psr\Http\Message\ServerRequestInterface` +- `Psr\Http\Message\UploadedFileInterface` + + + +[Unreleased]: https://github.com/guzzle/psr7/compare/1.6.0...HEAD +[1.6.0]: https://github.com/guzzle/psr7/compare/1.5.2...1.6.0 +[1.5.2]: https://github.com/guzzle/psr7/compare/1.5.1...1.5.2 +[1.5.1]: https://github.com/guzzle/psr7/compare/1.5.0...1.5.1 +[1.5.0]: https://github.com/guzzle/psr7/compare/1.4.2...1.5.0 +[1.4.2]: https://github.com/guzzle/psr7/compare/1.4.1...1.4.2 +[1.4.1]: https://github.com/guzzle/psr7/compare/1.4.0...1.4.1 +[1.4.0]: https://github.com/guzzle/psr7/compare/1.3.1...1.4.0 +[1.3.1]: https://github.com/guzzle/psr7/compare/1.3.0...1.3.1 +[1.3.0]: https://github.com/guzzle/psr7/compare/1.2.3...1.3.0 +[1.2.3]: https://github.com/guzzle/psr7/compare/1.2.2...1.2.3 +[1.2.2]: https://github.com/guzzle/psr7/compare/1.2.1...1.2.2 +[1.2.1]: https://github.com/guzzle/psr7/compare/1.2.0...1.2.1 +[1.2.0]: https://github.com/guzzle/psr7/compare/1.1.0...1.2.0 +[1.1.0]: https://github.com/guzzle/psr7/compare/1.0.0...1.1.0 diff --git a/vendor/guzzlehttp/psr7/LICENSE b/vendor/guzzlehttp/psr7/LICENSE new file mode 100644 index 0000000..581d95f --- /dev/null +++ b/vendor/guzzlehttp/psr7/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2015 Michael Dowling, https://github.com/mtdowling + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/guzzlehttp/psr7/README.md b/vendor/guzzlehttp/psr7/README.md new file mode 100644 index 0000000..c60a6a3 --- /dev/null +++ b/vendor/guzzlehttp/psr7/README.md @@ -0,0 +1,745 @@ +# PSR-7 Message Implementation + +This repository contains a full [PSR-7](http://www.php-fig.org/psr/psr-7/) +message implementation, several stream decorators, and some helpful +functionality like query string parsing. + + +[![Build Status](https://travis-ci.org/guzzle/psr7.svg?branch=master)](https://travis-ci.org/guzzle/psr7) + + +# Stream implementation + +This package comes with a number of stream implementations and stream +decorators. + + +## AppendStream + +`GuzzleHttp\Psr7\AppendStream` + +Reads from multiple streams, one after the other. + +```php +use GuzzleHttp\Psr7; + +$a = Psr7\stream_for('abc, '); +$b = Psr7\stream_for('123.'); +$composed = new Psr7\AppendStream([$a, $b]); + +$composed->addStream(Psr7\stream_for(' Above all listen to me')); + +echo $composed; // abc, 123. Above all listen to me. +``` + + +## BufferStream + +`GuzzleHttp\Psr7\BufferStream` + +Provides a buffer stream that can be written to fill a buffer, and read +from to remove bytes from the buffer. + +This stream returns a "hwm" metadata value that tells upstream consumers +what the configured high water mark of the stream is, or the maximum +preferred size of the buffer. + +```php +use GuzzleHttp\Psr7; + +// When more than 1024 bytes are in the buffer, it will begin returning +// false to writes. This is an indication that writers should slow down. +$buffer = new Psr7\BufferStream(1024); +``` + + +## CachingStream + +The CachingStream is used to allow seeking over previously read bytes on +non-seekable streams. This can be useful when transferring a non-seekable +entity body fails due to needing to rewind the stream (for example, resulting +from a redirect). Data that is read from the remote stream will be buffered in +a PHP temp stream so that previously read bytes are cached first in memory, +then on disk. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for(fopen('http://www.google.com', 'r')); +$stream = new Psr7\CachingStream($original); + +$stream->read(1024); +echo $stream->tell(); +// 1024 + +$stream->seek(0); +echo $stream->tell(); +// 0 +``` + + +## DroppingStream + +`GuzzleHttp\Psr7\DroppingStream` + +Stream decorator that begins dropping data once the size of the underlying +stream becomes too full. + +```php +use GuzzleHttp\Psr7; + +// Create an empty stream +$stream = Psr7\stream_for(); + +// Start dropping data when the stream has more than 10 bytes +$dropping = new Psr7\DroppingStream($stream, 10); + +$dropping->write('01234567890123456789'); +echo $stream; // 0123456789 +``` + + +## FnStream + +`GuzzleHttp\Psr7\FnStream` + +Compose stream implementations based on a hash of functions. + +Allows for easy testing and extension of a provided stream without needing +to create a concrete class for a simple extension point. + +```php + +use GuzzleHttp\Psr7; + +$stream = Psr7\stream_for('hi'); +$fnStream = Psr7\FnStream::decorate($stream, [ + 'rewind' => function () use ($stream) { + echo 'About to rewind - '; + $stream->rewind(); + echo 'rewound!'; + } +]); + +$fnStream->rewind(); +// Outputs: About to rewind - rewound! +``` + + +## InflateStream + +`GuzzleHttp\Psr7\InflateStream` + +Uses PHP's zlib.inflate filter to inflate deflate or gzipped content. + +This stream decorator skips the first 10 bytes of the given stream to remove +the gzip header, converts the provided stream to a PHP stream resource, +then appends the zlib.inflate filter. The stream is then converted back +to a Guzzle stream resource to be used as a Guzzle stream. + + +## LazyOpenStream + +`GuzzleHttp\Psr7\LazyOpenStream` + +Lazily reads or writes to a file that is opened only after an IO operation +take place on the stream. + +```php +use GuzzleHttp\Psr7; + +$stream = new Psr7\LazyOpenStream('/path/to/file', 'r'); +// The file has not yet been opened... + +echo $stream->read(10); +// The file is opened and read from only when needed. +``` + + +## LimitStream + +`GuzzleHttp\Psr7\LimitStream` + +LimitStream can be used to read a subset or slice of an existing stream object. +This can be useful for breaking a large file into smaller pieces to be sent in +chunks (e.g. Amazon S3's multipart upload API). + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for(fopen('/tmp/test.txt', 'r+')); +echo $original->getSize(); +// >>> 1048576 + +// Limit the size of the body to 1024 bytes and start reading from byte 2048 +$stream = new Psr7\LimitStream($original, 1024, 2048); +echo $stream->getSize(); +// >>> 1024 +echo $stream->tell(); +// >>> 0 +``` + + +## MultipartStream + +`GuzzleHttp\Psr7\MultipartStream` + +Stream that when read returns bytes for a streaming multipart or +multipart/form-data stream. + + +## NoSeekStream + +`GuzzleHttp\Psr7\NoSeekStream` + +NoSeekStream wraps a stream and does not allow seeking. + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for('foo'); +$noSeek = new Psr7\NoSeekStream($original); + +echo $noSeek->read(3); +// foo +var_export($noSeek->isSeekable()); +// false +$noSeek->seek(0); +var_export($noSeek->read(3)); +// NULL +``` + + +## PumpStream + +`GuzzleHttp\Psr7\PumpStream` + +Provides a read only stream that pumps data from a PHP callable. + +When invoking the provided callable, the PumpStream will pass the amount of +data requested to read to the callable. The callable can choose to ignore +this value and return fewer or more bytes than requested. Any extra data +returned by the provided callable is buffered internally until drained using +the read() function of the PumpStream. The provided callable MUST return +false when there is no more data to read. + + +## Implementing stream decorators + +Creating a stream decorator is very easy thanks to the +`GuzzleHttp\Psr7\StreamDecoratorTrait`. This trait provides methods that +implement `Psr\Http\Message\StreamInterface` by proxying to an underlying +stream. Just `use` the `StreamDecoratorTrait` and implement your custom +methods. + +For example, let's say we wanted to call a specific function each time the last +byte is read from a stream. This could be implemented by overriding the +`read()` method. + +```php +use Psr\Http\Message\StreamInterface; +use GuzzleHttp\Psr7\StreamDecoratorTrait; + +class EofCallbackStream implements StreamInterface +{ + use StreamDecoratorTrait; + + private $callback; + + public function __construct(StreamInterface $stream, callable $cb) + { + $this->stream = $stream; + $this->callback = $cb; + } + + public function read($length) + { + $result = $this->stream->read($length); + + // Invoke the callback when EOF is hit. + if ($this->eof()) { + call_user_func($this->callback); + } + + return $result; + } +} +``` + +This decorator could be added to any existing stream and used like so: + +```php +use GuzzleHttp\Psr7; + +$original = Psr7\stream_for('foo'); + +$eofStream = new EofCallbackStream($original, function () { + echo 'EOF!'; +}); + +$eofStream->read(2); +$eofStream->read(1); +// echoes "EOF!" +$eofStream->seek(0); +$eofStream->read(3); +// echoes "EOF!" +``` + + +## PHP StreamWrapper + +You can use the `GuzzleHttp\Psr7\StreamWrapper` class if you need to use a +PSR-7 stream as a PHP stream resource. + +Use the `GuzzleHttp\Psr7\StreamWrapper::getResource()` method to create a PHP +stream from a PSR-7 stream. + +```php +use GuzzleHttp\Psr7\StreamWrapper; + +$stream = GuzzleHttp\Psr7\stream_for('hello!'); +$resource = StreamWrapper::getResource($stream); +echo fread($resource, 6); // outputs hello! +``` + + +# Function API + +There are various functions available under the `GuzzleHttp\Psr7` namespace. + + +## `function str` + +`function str(MessageInterface $message)` + +Returns the string representation of an HTTP message. + +```php +$request = new GuzzleHttp\Psr7\Request('GET', 'http://example.com'); +echo GuzzleHttp\Psr7\str($request); +``` + + +## `function uri_for` + +`function uri_for($uri)` + +This function accepts a string or `Psr\Http\Message\UriInterface` and returns a +UriInterface for the given value. If the value is already a `UriInterface`, it +is returned as-is. + +```php +$uri = GuzzleHttp\Psr7\uri_for('http://example.com'); +assert($uri === GuzzleHttp\Psr7\uri_for($uri)); +``` + + +## `function stream_for` + +`function stream_for($resource = '', array $options = [])` + +Create a new stream based on the input type. + +Options is an associative array that can contain the following keys: + +* - metadata: Array of custom metadata. +* - size: Size of the stream. + +This method accepts the following `$resource` types: + +- `Psr\Http\Message\StreamInterface`: Returns the value as-is. +- `string`: Creates a stream object that uses the given string as the contents. +- `resource`: Creates a stream object that wraps the given PHP stream resource. +- `Iterator`: If the provided value implements `Iterator`, then a read-only + stream object will be created that wraps the given iterable. Each time the + stream is read from, data from the iterator will fill a buffer and will be + continuously called until the buffer is equal to the requested read size. + Subsequent read calls will first read from the buffer and then call `next` + on the underlying iterator until it is exhausted. +- `object` with `__toString()`: If the object has the `__toString()` method, + the object will be cast to a string and then a stream will be returned that + uses the string value. +- `NULL`: When `null` is passed, an empty stream object is returned. +- `callable` When a callable is passed, a read-only stream object will be + created that invokes the given callable. The callable is invoked with the + number of suggested bytes to read. The callable can return any number of + bytes, but MUST return `false` when there is no more data to return. The + stream object that wraps the callable will invoke the callable until the + number of requested bytes are available. Any additional bytes will be + buffered and used in subsequent reads. + +```php +$stream = GuzzleHttp\Psr7\stream_for('foo'); +$stream = GuzzleHttp\Psr7\stream_for(fopen('/path/to/file', 'r')); + +$generator = function ($bytes) { + for ($i = 0; $i < $bytes; $i++) { + yield ' '; + } +} + +$stream = GuzzleHttp\Psr7\stream_for($generator(100)); +``` + + +## `function parse_header` + +`function parse_header($header)` + +Parse an array of header values containing ";" separated data into an array of +associative arrays representing the header key value pair data of the header. +When a parameter does not contain a value, but just contains a key, this +function will inject a key with a '' string value. + + +## `function normalize_header` + +`function normalize_header($header)` + +Converts an array of header values that may contain comma separated headers +into an array of headers with no comma separated values. + + +## `function modify_request` + +`function modify_request(RequestInterface $request, array $changes)` + +Clone and modify a request with the given changes. This method is useful for +reducing the number of clones needed to mutate a message. + +The changes can be one of: + +- method: (string) Changes the HTTP method. +- set_headers: (array) Sets the given headers. +- remove_headers: (array) Remove the given headers. +- body: (mixed) Sets the given body. +- uri: (UriInterface) Set the URI. +- query: (string) Set the query string value of the URI. +- version: (string) Set the protocol version. + + +## `function rewind_body` + +`function rewind_body(MessageInterface $message)` + +Attempts to rewind a message body and throws an exception on failure. The body +of the message will only be rewound if a call to `tell()` returns a value other +than `0`. + + +## `function try_fopen` + +`function try_fopen($filename, $mode)` + +Safely opens a PHP stream resource using a filename. + +When fopen fails, PHP normally raises a warning. This function adds an error +handler that checks for errors and throws an exception instead. + + +## `function copy_to_string` + +`function copy_to_string(StreamInterface $stream, $maxLen = -1)` + +Copy the contents of a stream into a string until the given number of bytes +have been read. + + +## `function copy_to_stream` + +`function copy_to_stream(StreamInterface $source, StreamInterface $dest, $maxLen = -1)` + +Copy the contents of a stream into another stream until the given number of +bytes have been read. + + +## `function hash` + +`function hash(StreamInterface $stream, $algo, $rawOutput = false)` + +Calculate a hash of a Stream. This method reads the entire stream to calculate +a rolling hash (based on PHP's hash_init functions). + + +## `function readline` + +`function readline(StreamInterface $stream, $maxLength = null)` + +Read a line from the stream up to the maximum allowed buffer length. + + +## `function parse_request` + +`function parse_request($message)` + +Parses a request message string into a request object. + + +## `function parse_response` + +`function parse_response($message)` + +Parses a response message string into a response object. + + +## `function parse_query` + +`function parse_query($str, $urlEncoding = true)` + +Parse a query string into an associative array. + +If multiple values are found for the same key, the value of that key value pair +will become an array. This function does not parse nested PHP style arrays into +an associative array (e.g., `foo[a]=1&foo[b]=2` will be parsed into +`['foo[a]' => '1', 'foo[b]' => '2']`). + + +## `function build_query` + +`function build_query(array $params, $encoding = PHP_QUERY_RFC3986)` + +Build a query string from an array of key value pairs. + +This function can use the return value of parse_query() to build a query string. +This function does not modify the provided keys when an array is encountered +(like http_build_query would). + + +## `function mimetype_from_filename` + +`function mimetype_from_filename($filename)` + +Determines the mimetype of a file by looking at its extension. + + +## `function mimetype_from_extension` + +`function mimetype_from_extension($extension)` + +Maps a file extensions to a mimetype. + + +# Additional URI Methods + +Aside from the standard `Psr\Http\Message\UriInterface` implementation in form of the `GuzzleHttp\Psr7\Uri` class, +this library also provides additional functionality when working with URIs as static methods. + +## URI Types + +An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference. +An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, +the base URI. Relative references can be divided into several forms according to +[RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2): + +- network-path references, e.g. `//example.com/path` +- absolute-path references, e.g. `/path` +- relative-path references, e.g. `subpath` + +The following methods can be used to identify the type of the URI. + +### `GuzzleHttp\Psr7\Uri::isAbsolute` + +`public static function isAbsolute(UriInterface $uri): bool` + +Whether the URI is absolute, i.e. it has a scheme. + +### `GuzzleHttp\Psr7\Uri::isNetworkPathReference` + +`public static function isNetworkPathReference(UriInterface $uri): bool` + +Whether the URI is a network-path reference. A relative reference that begins with two slash characters is +termed an network-path reference. + +### `GuzzleHttp\Psr7\Uri::isAbsolutePathReference` + +`public static function isAbsolutePathReference(UriInterface $uri): bool` + +Whether the URI is a absolute-path reference. A relative reference that begins with a single slash character is +termed an absolute-path reference. + +### `GuzzleHttp\Psr7\Uri::isRelativePathReference` + +`public static function isRelativePathReference(UriInterface $uri): bool` + +Whether the URI is a relative-path reference. A relative reference that does not begin with a slash character is +termed a relative-path reference. + +### `GuzzleHttp\Psr7\Uri::isSameDocumentReference` + +`public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool` + +Whether the URI is a same-document reference. A same-document reference refers to a URI that is, aside from its +fragment component, identical to the base URI. When no base URI is given, only an empty URI reference +(apart from its fragment) is considered a same-document reference. + +## URI Components + +Additional methods to work with URI components. + +### `GuzzleHttp\Psr7\Uri::isDefaultPort` + +`public static function isDefaultPort(UriInterface $uri): bool` + +Whether the URI has the default port of the current scheme. `Psr\Http\Message\UriInterface::getPort` may return null +or the standard port. This method can be used independently of the implementation. + +### `GuzzleHttp\Psr7\Uri::composeComponents` + +`public static function composeComponents($scheme, $authority, $path, $query, $fragment): string` + +Composes a URI reference string from its various components according to +[RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called +manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. + +### `GuzzleHttp\Psr7\Uri::fromParts` + +`public static function fromParts(array $parts): UriInterface` + +Creates a URI from a hash of [`parse_url`](http://php.net/manual/en/function.parse-url.php) components. + + +### `GuzzleHttp\Psr7\Uri::withQueryValue` + +`public static function withQueryValue(UriInterface $uri, $key, $value): UriInterface` + +Creates a new URI with a specific query string value. Any existing query string values that exactly match the +provided key are removed and replaced with the given key value pair. A value of null will set the query string +key without a value, e.g. "key" instead of "key=value". + +### `GuzzleHttp\Psr7\Uri::withQueryValues` + +`public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface` + +Creates a new URI with multiple query string values. It has the same behavior as `withQueryValue()` but for an +associative array of key => value. + +### `GuzzleHttp\Psr7\Uri::withoutQueryValue` + +`public static function withoutQueryValue(UriInterface $uri, $key): UriInterface` + +Creates a new URI with a specific query string value removed. Any existing query string values that exactly match the +provided key are removed. + +## Reference Resolution + +`GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according +to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers +do when resolving a link in a website based on the current request URI. + +### `GuzzleHttp\Psr7\UriResolver::resolve` + +`public static function resolve(UriInterface $base, UriInterface $rel): UriInterface` + +Converts the relative URI into a new URI that is resolved against the base URI. + +### `GuzzleHttp\Psr7\UriResolver::removeDotSegments` + +`public static function removeDotSegments(string $path): string` + +Removes dot segments from a path and returns the new path according to +[RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4). + +### `GuzzleHttp\Psr7\UriResolver::relativize` + +`public static function relativize(UriInterface $base, UriInterface $target): UriInterface` + +Returns the target URI as a relative reference from the base URI. This method is the counterpart to resolve(): + +```php +(string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) +``` + +One use-case is to use the current request URI as base URI and then generate relative links in your documents +to reduce the document size or offer self-contained downloadable document archives. + +```php +$base = new Uri('http://example.com/a/b/'); +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. +echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. +echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. +``` + +## Normalization and Comparison + +`GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to +[RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6). + +### `GuzzleHttp\Psr7\UriNormalizer::normalize` + +`public static function normalize(UriInterface $uri, $flags = self::PRESERVING_NORMALIZATIONS): UriInterface` + +Returns a normalized URI. The scheme and host component are already normalized to lowercase per PSR-7 UriInterface. +This methods adds additional normalizations that can be configured with the `$flags` parameter which is a bitmask +of normalizations to apply. The following normalizations are available: + +- `UriNormalizer::PRESERVING_NORMALIZATIONS` + + Default normalizations which only include the ones that preserve semantics. + +- `UriNormalizer::CAPITALIZE_PERCENT_ENCODING` + + All letters within a percent-encoding triplet (e.g., "%3A") are case-insensitive, and should be capitalized. + + Example: `http://example.org/a%c2%b1b` → `http://example.org/a%C2%B1b` + +- `UriNormalizer::DECODE_UNRESERVED_CHARACTERS` + + Decodes percent-encoded octets of unreserved characters. For consistency, percent-encoded octets in the ranges of + ALPHA (%41–%5A and %61–%7A), DIGIT (%30–%39), hyphen (%2D), period (%2E), underscore (%5F), or tilde (%7E) should + not be created by URI producers and, when found in a URI, should be decoded to their corresponding unreserved + characters by URI normalizers. + + Example: `http://example.org/%7Eusern%61me/` → `http://example.org/~username/` + +- `UriNormalizer::CONVERT_EMPTY_PATH` + + Converts the empty path to "/" for http and https URIs. + + Example: `http://example.org` → `http://example.org/` + +- `UriNormalizer::REMOVE_DEFAULT_HOST` + + Removes the default host of the given URI scheme from the URI. Only the "file" scheme defines the default host + "localhost". All of `file:/myfile`, `file:///myfile`, and `file://localhost/myfile` are equivalent according to + RFC 3986. + + Example: `file://localhost/myfile` → `file:///myfile` + +- `UriNormalizer::REMOVE_DEFAULT_PORT` + + Removes the default port of the given URI scheme from the URI. + + Example: `http://example.org:80/` → `http://example.org/` + +- `UriNormalizer::REMOVE_DOT_SEGMENTS` + + Removes unnecessary dot-segments. Dot-segments in relative-path references are not removed as it would + change the semantics of the URI reference. + + Example: `http://example.org/../a/b/../c/./d.html` → `http://example.org/a/c/d.html` + +- `UriNormalizer::REMOVE_DUPLICATE_SLASHES` + + Paths which include two or more adjacent slashes are converted to one. Webservers usually ignore duplicate slashes + and treat those URIs equivalent. But in theory those URIs do not need to be equivalent. So this normalization + may change the semantics. Encoded slashes (%2F) are not removed. + + Example: `http://example.org//foo///bar.html` → `http://example.org/foo/bar.html` + +- `UriNormalizer::SORT_QUERY_PARAMETERS` + + Sort query parameters with their values in alphabetical order. However, the order of parameters in a URI may be + significant (this is not defined by the standard). So this normalization is not safe and may change the semantics + of the URI. + + Example: `?lang=en&article=fred` → `?article=fred&lang=en` + +### `GuzzleHttp\Psr7\UriNormalizer::isEquivalent` + +`public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS): bool` + +Whether two URIs can be considered equivalent. Both URIs are normalized automatically before comparison with the given +`$normalizations` bitmask. The method also accepts relative URI references and returns true when they are equivalent. +This of course assumes they will be resolved against the same base URI. If this is not the case, determination of +equivalence or difference of relative references does not mean anything. diff --git a/vendor/guzzlehttp/psr7/composer.json b/vendor/guzzlehttp/psr7/composer.json new file mode 100644 index 0000000..168a055 --- /dev/null +++ b/vendor/guzzlehttp/psr7/composer.json @@ -0,0 +1,49 @@ +{ + "name": "guzzlehttp/psr7", + "type": "library", + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": ["request", "response", "message", "stream", "http", "uri", "url", "psr-7"], + "license": "MIT", + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Schultze", + "homepage": "https://github.com/Tobion" + } + ], + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0", + "ralouphie/getallheaders": "^2.0.5 || ^3.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.36 || ^5.7.27 || ^6.5.8", + "ext-zlib": "*" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "suggest": { + "zendframework/zend-httphandlerrunner": "Emit PSR-7 responses" + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": ["src/functions_include.php"] + }, + "autoload-dev": { + "psr-4": { + "GuzzleHttp\\Tests\\Psr7\\": "tests/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/AppendStream.php b/vendor/guzzlehttp/psr7/src/AppendStream.php new file mode 100644 index 0000000..472a0d6 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/AppendStream.php @@ -0,0 +1,241 @@ +addStream($stream); + } + } + + public function __toString() + { + try { + $this->rewind(); + return $this->getContents(); + } catch (\Exception $e) { + return ''; + } + } + + /** + * Add a stream to the AppendStream + * + * @param StreamInterface $stream Stream to append. Must be readable. + * + * @throws \InvalidArgumentException if the stream is not readable + */ + public function addStream(StreamInterface $stream) + { + if (!$stream->isReadable()) { + throw new \InvalidArgumentException('Each stream must be readable'); + } + + // The stream is only seekable if all streams are seekable + if (!$stream->isSeekable()) { + $this->seekable = false; + } + + $this->streams[] = $stream; + } + + public function getContents() + { + return copy_to_string($this); + } + + /** + * Closes each attached stream. + * + * {@inheritdoc} + */ + public function close() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->close(); + } + + $this->streams = []; + } + + /** + * Detaches each attached stream. + * + * Returns null as it's not clear which underlying stream resource to return. + * + * {@inheritdoc} + */ + public function detach() + { + $this->pos = $this->current = 0; + $this->seekable = true; + + foreach ($this->streams as $stream) { + $stream->detach(); + } + + $this->streams = []; + } + + public function tell() + { + return $this->pos; + } + + /** + * Tries to calculate the size by adding the size of each stream. + * + * If any of the streams do not return a valid number, then the size of the + * append stream cannot be determined and null is returned. + * + * {@inheritdoc} + */ + public function getSize() + { + $size = 0; + + foreach ($this->streams as $stream) { + $s = $stream->getSize(); + if ($s === null) { + return null; + } + $size += $s; + } + + return $size; + } + + public function eof() + { + return !$this->streams || + ($this->current >= count($this->streams) - 1 && + $this->streams[$this->current]->eof()); + } + + public function rewind() + { + $this->seek(0); + } + + /** + * Attempts to seek to the given position. Only supports SEEK_SET. + * + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if (!$this->seekable) { + throw new \RuntimeException('This AppendStream is not seekable'); + } elseif ($whence !== SEEK_SET) { + throw new \RuntimeException('The AppendStream can only seek with SEEK_SET'); + } + + $this->pos = $this->current = 0; + + // Rewind each stream + foreach ($this->streams as $i => $stream) { + try { + $stream->rewind(); + } catch (\Exception $e) { + throw new \RuntimeException('Unable to seek stream ' + . $i . ' of the AppendStream', 0, $e); + } + } + + // Seek to the actual position by reading from each stream + while ($this->pos < $offset && !$this->eof()) { + $result = $this->read(min(8096, $offset - $this->pos)); + if ($result === '') { + break; + } + } + } + + /** + * Reads from all of the appended streams until the length is met or EOF. + * + * {@inheritdoc} + */ + public function read($length) + { + $buffer = ''; + $total = count($this->streams) - 1; + $remaining = $length; + $progressToNext = false; + + while ($remaining > 0) { + + // Progress to the next stream if needed. + if ($progressToNext || $this->streams[$this->current]->eof()) { + $progressToNext = false; + if ($this->current === $total) { + break; + } + $this->current++; + } + + $result = $this->streams[$this->current]->read($remaining); + + // Using a loose comparison here to match on '', false, and null + if ($result == null) { + $progressToNext = true; + continue; + } + + $buffer .= $result; + $remaining = $length - strlen($buffer); + } + + $this->pos += strlen($buffer); + + return $buffer; + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return false; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function write($string) + { + throw new \RuntimeException('Cannot write to an AppendStream'); + } + + public function getMetadata($key = null) + { + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/BufferStream.php b/vendor/guzzlehttp/psr7/src/BufferStream.php new file mode 100644 index 0000000..af4d4c2 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/BufferStream.php @@ -0,0 +1,137 @@ +hwm = $hwm; + } + + public function __toString() + { + return $this->getContents(); + } + + public function getContents() + { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + public function close() + { + $this->buffer = ''; + } + + public function detach() + { + $this->close(); + } + + public function getSize() + { + return strlen($this->buffer); + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return true; + } + + public function isSeekable() + { + return false; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + throw new \RuntimeException('Cannot seek a BufferStream'); + } + + public function eof() + { + return strlen($this->buffer) === 0; + } + + public function tell() + { + throw new \RuntimeException('Cannot determine the position of a BufferStream'); + } + + /** + * Reads data from the buffer. + */ + public function read($length) + { + $currentLength = strlen($this->buffer); + + if ($length >= $currentLength) { + // No need to slice the buffer because we don't have enough data. + $result = $this->buffer; + $this->buffer = ''; + } else { + // Slice up the result to provide a subset of the buffer. + $result = substr($this->buffer, 0, $length); + $this->buffer = substr($this->buffer, $length); + } + + return $result; + } + + /** + * Writes data to the buffer. + */ + public function write($string) + { + $this->buffer .= $string; + + // TODO: What should happen here? + if (strlen($this->buffer) >= $this->hwm) { + return false; + } + + return strlen($string); + } + + public function getMetadata($key = null) + { + if ($key == 'hwm') { + return $this->hwm; + } + + return $key ? null : []; + } +} diff --git a/vendor/guzzlehttp/psr7/src/CachingStream.php b/vendor/guzzlehttp/psr7/src/CachingStream.php new file mode 100644 index 0000000..ed68f08 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/CachingStream.php @@ -0,0 +1,138 @@ +remoteStream = $stream; + $this->stream = $target ?: new Stream(fopen('php://temp', 'r+')); + } + + public function getSize() + { + return max($this->stream->getSize(), $this->remoteStream->getSize()); + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + if ($whence == SEEK_SET) { + $byte = $offset; + } elseif ($whence == SEEK_CUR) { + $byte = $offset + $this->tell(); + } elseif ($whence == SEEK_END) { + $size = $this->remoteStream->getSize(); + if ($size === null) { + $size = $this->cacheEntireStream(); + } + $byte = $size + $offset; + } else { + throw new \InvalidArgumentException('Invalid whence'); + } + + $diff = $byte - $this->stream->getSize(); + + if ($diff > 0) { + // Read the remoteStream until we have read in at least the amount + // of bytes requested, or we reach the end of the file. + while ($diff > 0 && !$this->remoteStream->eof()) { + $this->read($diff); + $diff = $byte - $this->stream->getSize(); + } + } else { + // We can just do a normal seek since we've already seen this byte. + $this->stream->seek($byte); + } + } + + public function read($length) + { + // Perform a regular read on any previously read data from the buffer + $data = $this->stream->read($length); + $remaining = $length - strlen($data); + + // More data was requested so read from the remote stream + if ($remaining) { + // If data was written to the buffer in a position that would have + // been filled from the remote stream, then we must skip bytes on + // the remote stream to emulate overwriting bytes from that + // position. This mimics the behavior of other PHP stream wrappers. + $remoteData = $this->remoteStream->read( + $remaining + $this->skipReadBytes + ); + + if ($this->skipReadBytes) { + $len = strlen($remoteData); + $remoteData = substr($remoteData, $this->skipReadBytes); + $this->skipReadBytes = max(0, $this->skipReadBytes - $len); + } + + $data .= $remoteData; + $this->stream->write($remoteData); + } + + return $data; + } + + public function write($string) + { + // When appending to the end of the currently read stream, you'll want + // to skip bytes from being read from the remote stream to emulate + // other stream wrappers. Basically replacing bytes of data of a fixed + // length. + $overflow = (strlen($string) + $this->tell()) - $this->remoteStream->tell(); + if ($overflow > 0) { + $this->skipReadBytes += $overflow; + } + + return $this->stream->write($string); + } + + public function eof() + { + return $this->stream->eof() && $this->remoteStream->eof(); + } + + /** + * Close both the remote stream and buffer stream + */ + public function close() + { + $this->remoteStream->close() && $this->stream->close(); + } + + private function cacheEntireStream() + { + $target = new FnStream(['write' => 'strlen']); + copy_to_stream($this, $target); + + return $this->tell(); + } +} diff --git a/vendor/guzzlehttp/psr7/src/DroppingStream.php b/vendor/guzzlehttp/psr7/src/DroppingStream.php new file mode 100644 index 0000000..8935c80 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/DroppingStream.php @@ -0,0 +1,42 @@ +stream = $stream; + $this->maxLength = $maxLength; + } + + public function write($string) + { + $diff = $this->maxLength - $this->stream->getSize(); + + // Begin returning 0 when the underlying stream is too large. + if ($diff <= 0) { + return 0; + } + + // Write the stream or a subset of the stream if needed. + if (strlen($string) < $diff) { + return $this->stream->write($string); + } + + return $this->stream->write(substr($string, 0, $diff)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/FnStream.php b/vendor/guzzlehttp/psr7/src/FnStream.php new file mode 100644 index 0000000..73daea6 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/FnStream.php @@ -0,0 +1,158 @@ +methods = $methods; + + // Create the functions on the class + foreach ($methods as $name => $fn) { + $this->{'_fn_' . $name} = $fn; + } + } + + /** + * Lazily determine which methods are not implemented. + * @throws \BadMethodCallException + */ + public function __get($name) + { + throw new \BadMethodCallException(str_replace('_fn_', '', $name) + . '() is not implemented in the FnStream'); + } + + /** + * The close method is called on the underlying stream only if possible. + */ + public function __destruct() + { + if (isset($this->_fn_close)) { + call_user_func($this->_fn_close); + } + } + + /** + * An unserialize would allow the __destruct to run when the unserialized value goes out of scope. + * @throws \LogicException + */ + public function __wakeup() + { + throw new \LogicException('FnStream should never be unserialized'); + } + + /** + * Adds custom functionality to an underlying stream by intercepting + * specific method calls. + * + * @param StreamInterface $stream Stream to decorate + * @param array $methods Hash of method name to a closure + * + * @return FnStream + */ + public static function decorate(StreamInterface $stream, array $methods) + { + // If any of the required methods were not provided, then simply + // proxy to the decorated stream. + foreach (array_diff(self::$slots, array_keys($methods)) as $diff) { + $methods[$diff] = [$stream, $diff]; + } + + return new self($methods); + } + + public function __toString() + { + return call_user_func($this->_fn___toString); + } + + public function close() + { + return call_user_func($this->_fn_close); + } + + public function detach() + { + return call_user_func($this->_fn_detach); + } + + public function getSize() + { + return call_user_func($this->_fn_getSize); + } + + public function tell() + { + return call_user_func($this->_fn_tell); + } + + public function eof() + { + return call_user_func($this->_fn_eof); + } + + public function isSeekable() + { + return call_user_func($this->_fn_isSeekable); + } + + public function rewind() + { + call_user_func($this->_fn_rewind); + } + + public function seek($offset, $whence = SEEK_SET) + { + call_user_func($this->_fn_seek, $offset, $whence); + } + + public function isWritable() + { + return call_user_func($this->_fn_isWritable); + } + + public function write($string) + { + return call_user_func($this->_fn_write, $string); + } + + public function isReadable() + { + return call_user_func($this->_fn_isReadable); + } + + public function read($length) + { + return call_user_func($this->_fn_read, $length); + } + + public function getContents() + { + return call_user_func($this->_fn_getContents); + } + + public function getMetadata($key = null) + { + return call_user_func($this->_fn_getMetadata, $key); + } +} diff --git a/vendor/guzzlehttp/psr7/src/InflateStream.php b/vendor/guzzlehttp/psr7/src/InflateStream.php new file mode 100644 index 0000000..5e4f602 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/InflateStream.php @@ -0,0 +1,52 @@ +read(10); + $filenameHeaderLength = $this->getLengthOfPossibleFilenameHeader($stream, $header); + // Skip the header, that is 10 + length of filename + 1 (nil) bytes + $stream = new LimitStream($stream, -1, 10 + $filenameHeaderLength); + $resource = StreamWrapper::getResource($stream); + stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ); + $this->stream = $stream->isSeekable() ? new Stream($resource) : new NoSeekStream(new Stream($resource)); + } + + /** + * @param StreamInterface $stream + * @param $header + * @return int + */ + private function getLengthOfPossibleFilenameHeader(StreamInterface $stream, $header) + { + $filename_header_length = 0; + + if (substr(bin2hex($header), 6, 2) === '08') { + // we have a filename, read until nil + $filename_header_length = 1; + while ($stream->read(1) !== chr(0)) { + $filename_header_length++; + } + } + + return $filename_header_length; + } +} diff --git a/vendor/guzzlehttp/psr7/src/LazyOpenStream.php b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php new file mode 100644 index 0000000..02cec3a --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LazyOpenStream.php @@ -0,0 +1,39 @@ +filename = $filename; + $this->mode = $mode; + } + + /** + * Creates the underlying stream lazily when required. + * + * @return StreamInterface + */ + protected function createStream() + { + return stream_for(try_fopen($this->filename, $this->mode)); + } +} diff --git a/vendor/guzzlehttp/psr7/src/LimitStream.php b/vendor/guzzlehttp/psr7/src/LimitStream.php new file mode 100644 index 0000000..e4f239e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/LimitStream.php @@ -0,0 +1,155 @@ +stream = $stream; + $this->setLimit($limit); + $this->setOffset($offset); + } + + public function eof() + { + // Always return true if the underlying stream is EOF + if ($this->stream->eof()) { + return true; + } + + // No limit and the underlying stream is not at EOF + if ($this->limit == -1) { + return false; + } + + return $this->stream->tell() >= $this->offset + $this->limit; + } + + /** + * Returns the size of the limited subset of data + * {@inheritdoc} + */ + public function getSize() + { + if (null === ($length = $this->stream->getSize())) { + return null; + } elseif ($this->limit == -1) { + return $length - $this->offset; + } else { + return min($this->limit, $length - $this->offset); + } + } + + /** + * Allow for a bounded seek on the read limited stream + * {@inheritdoc} + */ + public function seek($offset, $whence = SEEK_SET) + { + if ($whence !== SEEK_SET || $offset < 0) { + throw new \RuntimeException(sprintf( + 'Cannot seek to offset %s with whence %s', + $offset, + $whence + )); + } + + $offset += $this->offset; + + if ($this->limit !== -1) { + if ($offset > $this->offset + $this->limit) { + $offset = $this->offset + $this->limit; + } + } + + $this->stream->seek($offset); + } + + /** + * Give a relative tell() + * {@inheritdoc} + */ + public function tell() + { + return $this->stream->tell() - $this->offset; + } + + /** + * Set the offset to start limiting from + * + * @param int $offset Offset to seek to and begin byte limiting from + * + * @throws \RuntimeException if the stream cannot be seeked. + */ + public function setOffset($offset) + { + $current = $this->stream->tell(); + + if ($current !== $offset) { + // If the stream cannot seek to the offset position, then read to it + if ($this->stream->isSeekable()) { + $this->stream->seek($offset); + } elseif ($current > $offset) { + throw new \RuntimeException("Could not seek to stream offset $offset"); + } else { + $this->stream->read($offset - $current); + } + } + + $this->offset = $offset; + } + + /** + * Set the limit of bytes that the decorator allows to be read from the + * stream. + * + * @param int $limit Number of bytes to allow to be read from the stream. + * Use -1 for no limit. + */ + public function setLimit($limit) + { + $this->limit = $limit; + } + + public function read($length) + { + if ($this->limit == -1) { + return $this->stream->read($length); + } + + // Check if the current position is less than the total allowed + // bytes + original offset + $remaining = ($this->offset + $this->limit) - $this->stream->tell(); + if ($remaining > 0) { + // Only return the amount of requested data, ensuring that the byte + // limit is not exceeded + return $this->stream->read(min($remaining, $length)); + } + + return ''; + } +} diff --git a/vendor/guzzlehttp/psr7/src/MessageTrait.php b/vendor/guzzlehttp/psr7/src/MessageTrait.php new file mode 100644 index 0000000..a7966d1 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -0,0 +1,213 @@ + array of values */ + private $headers = []; + + /** @var array Map of lowercase header name => original name at registration */ + private $headerNames = []; + + /** @var string */ + private $protocol = '1.1'; + + /** @var StreamInterface */ + private $stream; + + public function getProtocolVersion() + { + return $this->protocol; + } + + public function withProtocolVersion($version) + { + if ($this->protocol === $version) { + return $this; + } + + $new = clone $this; + $new->protocol = $version; + return $new; + } + + public function getHeaders() + { + return $this->headers; + } + + public function hasHeader($header) + { + return isset($this->headerNames[strtolower($header)]); + } + + public function getHeader($header) + { + $header = strtolower($header); + + if (!isset($this->headerNames[$header])) { + return []; + } + + $header = $this->headerNames[$header]; + + return $this->headers[$header]; + } + + public function getHeaderLine($header) + { + return implode(', ', $this->getHeader($header)); + } + + public function withHeader($header, $value) + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + unset($new->headers[$new->headerNames[$normalized]]); + } + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + + return $new; + } + + public function withAddedHeader($header, $value) + { + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $new->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + } + + return $new; + } + + public function withoutHeader($header) + { + $normalized = strtolower($header); + + if (!isset($this->headerNames[$normalized])) { + return $this; + } + + $header = $this->headerNames[$normalized]; + + $new = clone $this; + unset($new->headers[$header], $new->headerNames[$normalized]); + + return $new; + } + + public function getBody() + { + if (!$this->stream) { + $this->stream = stream_for(''); + } + + return $this->stream; + } + + public function withBody(StreamInterface $body) + { + if ($body === $this->stream) { + return $this; + } + + $new = clone $this; + $new->stream = $body; + return $new; + } + + private function setHeaders(array $headers) + { + $this->headerNames = $this->headers = []; + foreach ($headers as $header => $value) { + if (is_int($header)) { + // Numeric array keys are converted to int by PHP but having a header name '123' is not forbidden by the spec + // and also allowed in withHeader(). So we need to cast it to string again for the following assertion to pass. + $header = (string) $header; + } + $this->assertHeader($header); + $value = $this->normalizeHeaderValue($value); + $normalized = strtolower($header); + if (isset($this->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $this->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $this->headerNames[$normalized] = $header; + $this->headers[$header] = $value; + } + } + } + + private function normalizeHeaderValue($value) + { + if (!is_array($value)) { + return $this->trimHeaderValues([$value]); + } + + if (count($value) === 0) { + throw new \InvalidArgumentException('Header value can not be an empty array.'); + } + + return $this->trimHeaderValues($value); + } + + /** + * Trims whitespace from the header values. + * + * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. + * + * header-field = field-name ":" OWS field-value OWS + * OWS = *( SP / HTAB ) + * + * @param string[] $values Header values + * + * @return string[] Trimmed header values + * + * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + */ + private function trimHeaderValues(array $values) + { + return array_map(function ($value) { + if (!is_scalar($value) && null !== $value) { + throw new \InvalidArgumentException(sprintf( + 'Header value must be scalar or null but %s provided.', + is_object($value) ? get_class($value) : gettype($value) + )); + } + + return trim((string) $value, " \t"); + }, $values); + } + + private function assertHeader($header) + { + if (!is_string($header)) { + throw new \InvalidArgumentException(sprintf( + 'Header name must be a string but %s provided.', + is_object($header) ? get_class($header) : gettype($header) + )); + } + + if ($header === '') { + throw new \InvalidArgumentException('Header name can not be empty.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/MultipartStream.php b/vendor/guzzlehttp/psr7/src/MultipartStream.php new file mode 100644 index 0000000..c0fd584 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/MultipartStream.php @@ -0,0 +1,153 @@ +boundary = $boundary ?: sha1(uniqid('', true)); + $this->stream = $this->createStream($elements); + } + + /** + * Get the boundary + * + * @return string + */ + public function getBoundary() + { + return $this->boundary; + } + + public function isWritable() + { + return false; + } + + /** + * Get the headers needed before transferring the content of a POST file + */ + private function getHeaders(array $headers) + { + $str = ''; + foreach ($headers as $key => $value) { + $str .= "{$key}: {$value}\r\n"; + } + + return "--{$this->boundary}\r\n" . trim($str) . "\r\n\r\n"; + } + + /** + * Create the aggregate stream that will be used to upload the POST data + */ + protected function createStream(array $elements) + { + $stream = new AppendStream(); + + foreach ($elements as $element) { + $this->addElement($stream, $element); + } + + // Add the trailing boundary with CRLF + $stream->addStream(stream_for("--{$this->boundary}--\r\n")); + + return $stream; + } + + private function addElement(AppendStream $stream, array $element) + { + foreach (['contents', 'name'] as $key) { + if (!array_key_exists($key, $element)) { + throw new \InvalidArgumentException("A '{$key}' key is required"); + } + } + + $element['contents'] = stream_for($element['contents']); + + if (empty($element['filename'])) { + $uri = $element['contents']->getMetadata('uri'); + if (substr($uri, 0, 6) !== 'php://') { + $element['filename'] = $uri; + } + } + + list($body, $headers) = $this->createElement( + $element['name'], + $element['contents'], + isset($element['filename']) ? $element['filename'] : null, + isset($element['headers']) ? $element['headers'] : [] + ); + + $stream->addStream(stream_for($this->getHeaders($headers))); + $stream->addStream($body); + $stream->addStream(stream_for("\r\n")); + } + + /** + * @return array + */ + private function createElement($name, StreamInterface $stream, $filename, array $headers) + { + // Set a default content-disposition header if one was no provided + $disposition = $this->getHeader($headers, 'content-disposition'); + if (!$disposition) { + $headers['Content-Disposition'] = ($filename === '0' || $filename) + ? sprintf('form-data; name="%s"; filename="%s"', + $name, + basename($filename)) + : "form-data; name=\"{$name}\""; + } + + // Set a default content-length header if one was no provided + $length = $this->getHeader($headers, 'content-length'); + if (!$length) { + if ($length = $stream->getSize()) { + $headers['Content-Length'] = (string) $length; + } + } + + // Set a default Content-Type if one was not supplied + $type = $this->getHeader($headers, 'content-type'); + if (!$type && ($filename === '0' || $filename)) { + if ($type = mimetype_from_filename($filename)) { + $headers['Content-Type'] = $type; + } + } + + return [$stream, $headers]; + } + + private function getHeader(array $headers, $key) + { + $lowercaseHeader = strtolower($key); + foreach ($headers as $k => $v) { + if (strtolower($k) === $lowercaseHeader) { + return $v; + } + } + + return null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/NoSeekStream.php b/vendor/guzzlehttp/psr7/src/NoSeekStream.php new file mode 100644 index 0000000..2332218 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/NoSeekStream.php @@ -0,0 +1,22 @@ +source = $source; + $this->size = isset($options['size']) ? $options['size'] : null; + $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; + $this->buffer = new BufferStream(); + } + + public function __toString() + { + try { + return copy_to_string($this); + } catch (\Exception $e) { + return ''; + } + } + + public function close() + { + $this->detach(); + } + + public function detach() + { + $this->tellPos = false; + $this->source = null; + } + + public function getSize() + { + return $this->size; + } + + public function tell() + { + return $this->tellPos; + } + + public function eof() + { + return !$this->source; + } + + public function isSeekable() + { + return false; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + throw new \RuntimeException('Cannot seek a PumpStream'); + } + + public function isWritable() + { + return false; + } + + public function write($string) + { + throw new \RuntimeException('Cannot write to a PumpStream'); + } + + public function isReadable() + { + return true; + } + + public function read($length) + { + $data = $this->buffer->read($length); + $readLen = strlen($data); + $this->tellPos += $readLen; + $remaining = $length - $readLen; + + if ($remaining) { + $this->pump($remaining); + $data .= $this->buffer->read($remaining); + $this->tellPos += strlen($data) - $readLen; + } + + return $data; + } + + public function getContents() + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + + return isset($this->metadata[$key]) ? $this->metadata[$key] : null; + } + + private function pump($length) + { + if ($this->source) { + do { + $data = call_user_func($this->source, $length); + if ($data === false || $data === null) { + $this->source = null; + return; + } + $this->buffer->write($data); + $length -= strlen($data); + } while ($length > 0); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Request.php b/vendor/guzzlehttp/psr7/src/Request.php new file mode 100644 index 0000000..59f337d --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Request.php @@ -0,0 +1,151 @@ +assertMethod($method); + if (!($uri instanceof UriInterface)) { + $uri = new Uri($uri); + } + + $this->method = strtoupper($method); + $this->uri = $uri; + $this->setHeaders($headers); + $this->protocol = $version; + + if (!isset($this->headerNames['host'])) { + $this->updateHostFromUri(); + } + + if ($body !== '' && $body !== null) { + $this->stream = stream_for($body); + } + } + + public function getRequestTarget() + { + if ($this->requestTarget !== null) { + return $this->requestTarget; + } + + $target = $this->uri->getPath(); + if ($target == '') { + $target = '/'; + } + if ($this->uri->getQuery() != '') { + $target .= '?' . $this->uri->getQuery(); + } + + return $target; + } + + public function withRequestTarget($requestTarget) + { + if (preg_match('#\s#', $requestTarget)) { + throw new InvalidArgumentException( + 'Invalid request target provided; cannot contain whitespace' + ); + } + + $new = clone $this; + $new->requestTarget = $requestTarget; + return $new; + } + + public function getMethod() + { + return $this->method; + } + + public function withMethod($method) + { + $this->assertMethod($method); + $new = clone $this; + $new->method = strtoupper($method); + return $new; + } + + public function getUri() + { + return $this->uri; + } + + public function withUri(UriInterface $uri, $preserveHost = false) + { + if ($uri === $this->uri) { + return $this; + } + + $new = clone $this; + $new->uri = $uri; + + if (!$preserveHost || !isset($this->headerNames['host'])) { + $new->updateHostFromUri(); + } + + return $new; + } + + private function updateHostFromUri() + { + $host = $this->uri->getHost(); + + if ($host == '') { + return; + } + + if (($port = $this->uri->getPort()) !== null) { + $host .= ':' . $port; + } + + if (isset($this->headerNames['host'])) { + $header = $this->headerNames['host']; + } else { + $header = 'Host'; + $this->headerNames['host'] = 'Host'; + } + // Ensure Host is the first header. + // See: http://tools.ietf.org/html/rfc7230#section-5.4 + $this->headers = [$header => [$host]] + $this->headers; + } + + private function assertMethod($method) + { + if (!is_string($method) || $method === '') { + throw new \InvalidArgumentException('Method must be a non-empty string.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Response.php b/vendor/guzzlehttp/psr7/src/Response.php new file mode 100644 index 0000000..e7e04d8 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Response.php @@ -0,0 +1,154 @@ + 'Continue', + 101 => 'Switching Protocols', + 102 => 'Processing', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-status', + 208 => 'Already Reported', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 306 => 'Switch Proxy', + 307 => 'Temporary Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Time-out', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Large', + 415 => 'Unsupported Media Type', + 416 => 'Requested range not satisfiable', + 417 => 'Expectation Failed', + 418 => 'I\'m a teapot', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 425 => 'Unordered Collection', + 426 => 'Upgrade Required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + 451 => 'Unavailable For Legal Reasons', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Time-out', + 505 => 'HTTP Version not supported', + 506 => 'Variant Also Negotiates', + 507 => 'Insufficient Storage', + 508 => 'Loop Detected', + 511 => 'Network Authentication Required', + ]; + + /** @var string */ + private $reasonPhrase = ''; + + /** @var int */ + private $statusCode = 200; + + /** + * @param int $status Status code + * @param array $headers Response headers + * @param string|null|resource|StreamInterface $body Response body + * @param string $version Protocol version + * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) + */ + public function __construct( + $status = 200, + array $headers = [], + $body = null, + $version = '1.1', + $reason = null + ) { + $this->assertStatusCodeIsInteger($status); + $status = (int) $status; + $this->assertStatusCodeRange($status); + + $this->statusCode = $status; + + if ($body !== '' && $body !== null) { + $this->stream = stream_for($body); + } + + $this->setHeaders($headers); + if ($reason == '' && isset(self::$phrases[$this->statusCode])) { + $this->reasonPhrase = self::$phrases[$this->statusCode]; + } else { + $this->reasonPhrase = (string) $reason; + } + + $this->protocol = $version; + } + + public function getStatusCode() + { + return $this->statusCode; + } + + public function getReasonPhrase() + { + return $this->reasonPhrase; + } + + public function withStatus($code, $reasonPhrase = '') + { + $this->assertStatusCodeIsInteger($code); + $code = (int) $code; + $this->assertStatusCodeRange($code); + + $new = clone $this; + $new->statusCode = $code; + if ($reasonPhrase == '' && isset(self::$phrases[$new->statusCode])) { + $reasonPhrase = self::$phrases[$new->statusCode]; + } + $new->reasonPhrase = $reasonPhrase; + return $new; + } + + private function assertStatusCodeIsInteger($statusCode) + { + if (filter_var($statusCode, FILTER_VALIDATE_INT) === false) { + throw new \InvalidArgumentException('Status code must be an integer value.'); + } + } + + private function assertStatusCodeRange($statusCode) + { + if ($statusCode < 100 || $statusCode >= 600) { + throw new \InvalidArgumentException('Status code must be an integer value between 1xx and 5xx.'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/Rfc7230.php b/vendor/guzzlehttp/psr7/src/Rfc7230.php new file mode 100644 index 0000000..505e474 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Rfc7230.php @@ -0,0 +1,18 @@ +@,;:\\\"/[\]?={}\x01-\x20\x7F]++):[ \t]*+((?:[ \t]*+[\x21-\x7E\x80-\xFF]++)*+)[ \t]*+\r?\n)m"; + const HEADER_FOLD_REGEX = "(\r?\n[ \t]++)"; +} diff --git a/vendor/guzzlehttp/psr7/src/ServerRequest.php b/vendor/guzzlehttp/psr7/src/ServerRequest.php new file mode 100644 index 0000000..1a09a6c --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -0,0 +1,376 @@ +serverParams = $serverParams; + + parent::__construct($method, $uri, $headers, $body, $version); + } + + /** + * Return an UploadedFile instance array. + * + * @param array $files A array which respect $_FILES structure + * @throws InvalidArgumentException for unrecognized values + * @return array + */ + public static function normalizeFiles(array $files) + { + $normalized = []; + + foreach ($files as $key => $value) { + if ($value instanceof UploadedFileInterface) { + $normalized[$key] = $value; + } elseif (is_array($value) && isset($value['tmp_name'])) { + $normalized[$key] = self::createUploadedFileFromSpec($value); + } elseif (is_array($value)) { + $normalized[$key] = self::normalizeFiles($value); + continue; + } else { + throw new InvalidArgumentException('Invalid value in files specification'); + } + } + + return $normalized; + } + + /** + * Create and return an UploadedFile instance from a $_FILES specification. + * + * If the specification represents an array of values, this method will + * delegate to normalizeNestedFileSpec() and return that return value. + * + * @param array $value $_FILES struct + * @return array|UploadedFileInterface + */ + private static function createUploadedFileFromSpec(array $value) + { + if (is_array($value['tmp_name'])) { + return self::normalizeNestedFileSpec($value); + } + + return new UploadedFile( + $value['tmp_name'], + (int) $value['size'], + (int) $value['error'], + $value['name'], + $value['type'] + ); + } + + /** + * Normalize an array of file specifications. + * + * Loops through all nested files and returns a normalized array of + * UploadedFileInterface instances. + * + * @param array $files + * @return UploadedFileInterface[] + */ + private static function normalizeNestedFileSpec(array $files = []) + { + $normalizedFiles = []; + + foreach (array_keys($files['tmp_name']) as $key) { + $spec = [ + 'tmp_name' => $files['tmp_name'][$key], + 'size' => $files['size'][$key], + 'error' => $files['error'][$key], + 'name' => $files['name'][$key], + 'type' => $files['type'][$key], + ]; + $normalizedFiles[$key] = self::createUploadedFileFromSpec($spec); + } + + return $normalizedFiles; + } + + /** + * Return a ServerRequest populated with superglobals: + * $_GET + * $_POST + * $_COOKIE + * $_FILES + * $_SERVER + * + * @return ServerRequestInterface + */ + public static function fromGlobals() + { + $method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; + $headers = getallheaders(); + $uri = self::getUriFromGlobals(); + $body = new CachingStream(new LazyOpenStream('php://input', 'r+')); + $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? str_replace('HTTP/', '', $_SERVER['SERVER_PROTOCOL']) : '1.1'; + + $serverRequest = new ServerRequest($method, $uri, $headers, $body, $protocol, $_SERVER); + + return $serverRequest + ->withCookieParams($_COOKIE) + ->withQueryParams($_GET) + ->withParsedBody($_POST) + ->withUploadedFiles(self::normalizeFiles($_FILES)); + } + + private static function extractHostAndPortFromAuthority($authority) + { + $uri = 'http://'.$authority; + $parts = parse_url($uri); + if (false === $parts) { + return [null, null]; + } + + $host = isset($parts['host']) ? $parts['host'] : null; + $port = isset($parts['port']) ? $parts['port'] : null; + + return [$host, $port]; + } + + /** + * Get a Uri populated with values from $_SERVER. + * + * @return UriInterface + */ + public static function getUriFromGlobals() + { + $uri = new Uri(''); + + $uri = $uri->withScheme(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' ? 'https' : 'http'); + + $hasPort = false; + if (isset($_SERVER['HTTP_HOST'])) { + list($host, $port) = self::extractHostAndPortFromAuthority($_SERVER['HTTP_HOST']); + if ($host !== null) { + $uri = $uri->withHost($host); + } + + if ($port !== null) { + $hasPort = true; + $uri = $uri->withPort($port); + } + } elseif (isset($_SERVER['SERVER_NAME'])) { + $uri = $uri->withHost($_SERVER['SERVER_NAME']); + } elseif (isset($_SERVER['SERVER_ADDR'])) { + $uri = $uri->withHost($_SERVER['SERVER_ADDR']); + } + + if (!$hasPort && isset($_SERVER['SERVER_PORT'])) { + $uri = $uri->withPort($_SERVER['SERVER_PORT']); + } + + $hasQuery = false; + if (isset($_SERVER['REQUEST_URI'])) { + $requestUriParts = explode('?', $_SERVER['REQUEST_URI'], 2); + $uri = $uri->withPath($requestUriParts[0]); + if (isset($requestUriParts[1])) { + $hasQuery = true; + $uri = $uri->withQuery($requestUriParts[1]); + } + } + + if (!$hasQuery && isset($_SERVER['QUERY_STRING'])) { + $uri = $uri->withQuery($_SERVER['QUERY_STRING']); + } + + return $uri; + } + + + /** + * {@inheritdoc} + */ + public function getServerParams() + { + return $this->serverParams; + } + + /** + * {@inheritdoc} + */ + public function getUploadedFiles() + { + return $this->uploadedFiles; + } + + /** + * {@inheritdoc} + */ + public function withUploadedFiles(array $uploadedFiles) + { + $new = clone $this; + $new->uploadedFiles = $uploadedFiles; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getCookieParams() + { + return $this->cookieParams; + } + + /** + * {@inheritdoc} + */ + public function withCookieParams(array $cookies) + { + $new = clone $this; + $new->cookieParams = $cookies; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getQueryParams() + { + return $this->queryParams; + } + + /** + * {@inheritdoc} + */ + public function withQueryParams(array $query) + { + $new = clone $this; + $new->queryParams = $query; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getParsedBody() + { + return $this->parsedBody; + } + + /** + * {@inheritdoc} + */ + public function withParsedBody($data) + { + $new = clone $this; + $new->parsedBody = $data; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * {@inheritdoc} + */ + public function getAttribute($attribute, $default = null) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $default; + } + + return $this->attributes[$attribute]; + } + + /** + * {@inheritdoc} + */ + public function withAttribute($attribute, $value) + { + $new = clone $this; + $new->attributes[$attribute] = $value; + + return $new; + } + + /** + * {@inheritdoc} + */ + public function withoutAttribute($attribute) + { + if (false === array_key_exists($attribute, $this->attributes)) { + return $this; + } + + $new = clone $this; + unset($new->attributes[$attribute]); + + return $new; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Stream.php b/vendor/guzzlehttp/psr7/src/Stream.php new file mode 100644 index 0000000..d9e7409 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Stream.php @@ -0,0 +1,267 @@ +size = $options['size']; + } + + $this->customMetadata = isset($options['metadata']) + ? $options['metadata'] + : []; + + $this->stream = $stream; + $meta = stream_get_meta_data($this->stream); + $this->seekable = $meta['seekable']; + $this->readable = (bool)preg_match(self::READABLE_MODES, $meta['mode']); + $this->writable = (bool)preg_match(self::WRITABLE_MODES, $meta['mode']); + $this->uri = $this->getMetadata('uri'); + } + + /** + * Closes the stream when the destructed + */ + public function __destruct() + { + $this->close(); + } + + public function __toString() + { + try { + $this->seek(0); + return (string) stream_get_contents($this->stream); + } catch (\Exception $e) { + return ''; + } + } + + public function getContents() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $contents = stream_get_contents($this->stream); + + if ($contents === false) { + throw new \RuntimeException('Unable to read stream contents'); + } + + return $contents; + } + + public function close() + { + if (isset($this->stream)) { + if (is_resource($this->stream)) { + fclose($this->stream); + } + $this->detach(); + } + } + + public function detach() + { + if (!isset($this->stream)) { + return null; + } + + $result = $this->stream; + unset($this->stream); + $this->size = $this->uri = null; + $this->readable = $this->writable = $this->seekable = false; + + return $result; + } + + public function getSize() + { + if ($this->size !== null) { + return $this->size; + } + + if (!isset($this->stream)) { + return null; + } + + // Clear the stat cache if the stream has a URI + if ($this->uri) { + clearstatcache(true, $this->uri); + } + + $stats = fstat($this->stream); + if (isset($stats['size'])) { + $this->size = $stats['size']; + return $this->size; + } + + return null; + } + + public function isReadable() + { + return $this->readable; + } + + public function isWritable() + { + return $this->writable; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function eof() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + return feof($this->stream); + } + + public function tell() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $result = ftell($this->stream); + + if ($result === false) { + throw new \RuntimeException('Unable to determine stream position'); + } + + return $result; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + $whence = (int) $whence; + + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->seekable) { + throw new \RuntimeException('Stream is not seekable'); + } + if (fseek($this->stream, $offset, $whence) === -1) { + throw new \RuntimeException('Unable to seek to stream position ' + . $offset . ' with whence ' . var_export($whence, true)); + } + } + + public function read($length) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + if ($length < 0) { + throw new \RuntimeException('Length parameter cannot be negative'); + } + + if (0 === $length) { + return ''; + } + + $string = fread($this->stream, $length); + if (false === $string) { + throw new \RuntimeException('Unable to read from stream'); + } + + return $string; + } + + public function write($string) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->writable) { + throw new \RuntimeException('Cannot write to a non-writable stream'); + } + + // We can't know the size after writing anything + $this->size = null; + $result = fwrite($this->stream, $string); + + if ($result === false) { + throw new \RuntimeException('Unable to write to stream'); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!isset($this->stream)) { + return $key ? null : []; + } elseif (!$key) { + return $this->customMetadata + stream_get_meta_data($this->stream); + } elseif (isset($this->customMetadata[$key])) { + return $this->customMetadata[$key]; + } + + $meta = stream_get_meta_data($this->stream); + + return isset($meta[$key]) ? $meta[$key] : null; + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php new file mode 100644 index 0000000..daec6f5 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -0,0 +1,149 @@ +stream = $stream; + } + + /** + * Magic method used to create a new stream if streams are not added in + * the constructor of a decorator (e.g., LazyOpenStream). + * + * @param string $name Name of the property (allows "stream" only). + * + * @return StreamInterface + */ + public function __get($name) + { + if ($name == 'stream') { + $this->stream = $this->createStream(); + return $this->stream; + } + + throw new \UnexpectedValueException("$name not found on class"); + } + + public function __toString() + { + try { + if ($this->isSeekable()) { + $this->seek(0); + } + return $this->getContents(); + } catch (\Exception $e) { + // Really, PHP? https://bugs.php.net/bug.php?id=53648 + trigger_error('StreamDecorator::__toString exception: ' + . (string) $e, E_USER_ERROR); + return ''; + } + } + + public function getContents() + { + return copy_to_string($this); + } + + /** + * Allow decorators to implement custom methods + * + * @param string $method Missing method name + * @param array $args Method arguments + * + * @return mixed + */ + public function __call($method, array $args) + { + $result = call_user_func_array([$this->stream, $method], $args); + + // Always return the wrapped object if the result is a return $this + return $result === $this->stream ? $this : $result; + } + + public function close() + { + $this->stream->close(); + } + + public function getMetadata($key = null) + { + return $this->stream->getMetadata($key); + } + + public function detach() + { + return $this->stream->detach(); + } + + public function getSize() + { + return $this->stream->getSize(); + } + + public function eof() + { + return $this->stream->eof(); + } + + public function tell() + { + return $this->stream->tell(); + } + + public function isReadable() + { + return $this->stream->isReadable(); + } + + public function isWritable() + { + return $this->stream->isWritable(); + } + + public function isSeekable() + { + return $this->stream->isSeekable(); + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + $this->stream->seek($offset, $whence); + } + + public function read($length) + { + return $this->stream->read($length); + } + + public function write($string) + { + return $this->stream->write($string); + } + + /** + * Implement in subclasses to dynamically create streams when requested. + * + * @return StreamInterface + * @throws \BadMethodCallException + */ + protected function createStream() + { + throw new \BadMethodCallException('Not implemented'); + } +} diff --git a/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/vendor/guzzlehttp/psr7/src/StreamWrapper.php new file mode 100644 index 0000000..0f3a285 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/StreamWrapper.php @@ -0,0 +1,161 @@ +isReadable()) { + $mode = $stream->isWritable() ? 'r+' : 'r'; + } elseif ($stream->isWritable()) { + $mode = 'w'; + } else { + throw new \InvalidArgumentException('The stream must be readable, ' + . 'writable, or both.'); + } + + return fopen('guzzle://stream', $mode, null, self::createStreamContext($stream)); + } + + /** + * Creates a stream context that can be used to open a stream as a php stream resource. + * + * @param StreamInterface $stream + * + * @return resource + */ + public static function createStreamContext(StreamInterface $stream) + { + return stream_context_create([ + 'guzzle' => ['stream' => $stream] + ]); + } + + /** + * Registers the stream wrapper if needed + */ + public static function register() + { + if (!in_array('guzzle', stream_get_wrappers())) { + stream_wrapper_register('guzzle', __CLASS__); + } + } + + public function stream_open($path, $mode, $options, &$opened_path) + { + $options = stream_context_get_options($this->context); + + if (!isset($options['guzzle']['stream'])) { + return false; + } + + $this->mode = $mode; + $this->stream = $options['guzzle']['stream']; + + return true; + } + + public function stream_read($count) + { + return $this->stream->read($count); + } + + public function stream_write($data) + { + return (int) $this->stream->write($data); + } + + public function stream_tell() + { + return $this->stream->tell(); + } + + public function stream_eof() + { + return $this->stream->eof(); + } + + public function stream_seek($offset, $whence) + { + $this->stream->seek($offset, $whence); + + return true; + } + + public function stream_cast($cast_as) + { + $stream = clone($this->stream); + + return $stream->detach(); + } + + public function stream_stat() + { + static $modeMap = [ + 'r' => 33060, + 'rb' => 33060, + 'r+' => 33206, + 'w' => 33188, + 'wb' => 33188 + ]; + + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => $modeMap[$this->mode], + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => $this->stream->getSize() ?: 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } + + public function url_stat($path, $flags) + { + return [ + 'dev' => 0, + 'ino' => 0, + 'mode' => 0, + 'nlink' => 0, + 'uid' => 0, + 'gid' => 0, + 'rdev' => 0, + 'size' => 0, + 'atime' => 0, + 'mtime' => 0, + 'ctime' => 0, + 'blksize' => 0, + 'blocks' => 0 + ]; + } +} diff --git a/vendor/guzzlehttp/psr7/src/UploadedFile.php b/vendor/guzzlehttp/psr7/src/UploadedFile.php new file mode 100644 index 0000000..e62bd5c --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UploadedFile.php @@ -0,0 +1,316 @@ +setError($errorStatus); + $this->setSize($size); + $this->setClientFilename($clientFilename); + $this->setClientMediaType($clientMediaType); + + if ($this->isOk()) { + $this->setStreamOrFile($streamOrFile); + } + } + + /** + * Depending on the value set file or stream variable + * + * @param mixed $streamOrFile + * @throws InvalidArgumentException + */ + private function setStreamOrFile($streamOrFile) + { + if (is_string($streamOrFile)) { + $this->file = $streamOrFile; + } elseif (is_resource($streamOrFile)) { + $this->stream = new Stream($streamOrFile); + } elseif ($streamOrFile instanceof StreamInterface) { + $this->stream = $streamOrFile; + } else { + throw new InvalidArgumentException( + 'Invalid stream or file provided for UploadedFile' + ); + } + } + + /** + * @param int $error + * @throws InvalidArgumentException + */ + private function setError($error) + { + if (false === is_int($error)) { + throw new InvalidArgumentException( + 'Upload file error status must be an integer' + ); + } + + if (false === in_array($error, UploadedFile::$errors)) { + throw new InvalidArgumentException( + 'Invalid error status for UploadedFile' + ); + } + + $this->error = $error; + } + + /** + * @param int $size + * @throws InvalidArgumentException + */ + private function setSize($size) + { + if (false === is_int($size)) { + throw new InvalidArgumentException( + 'Upload file size must be an integer' + ); + } + + $this->size = $size; + } + + /** + * @param mixed $param + * @return boolean + */ + private function isStringOrNull($param) + { + return in_array(gettype($param), ['string', 'NULL']); + } + + /** + * @param mixed $param + * @return boolean + */ + private function isStringNotEmpty($param) + { + return is_string($param) && false === empty($param); + } + + /** + * @param string|null $clientFilename + * @throws InvalidArgumentException + */ + private function setClientFilename($clientFilename) + { + if (false === $this->isStringOrNull($clientFilename)) { + throw new InvalidArgumentException( + 'Upload file client filename must be a string or null' + ); + } + + $this->clientFilename = $clientFilename; + } + + /** + * @param string|null $clientMediaType + * @throws InvalidArgumentException + */ + private function setClientMediaType($clientMediaType) + { + if (false === $this->isStringOrNull($clientMediaType)) { + throw new InvalidArgumentException( + 'Upload file client media type must be a string or null' + ); + } + + $this->clientMediaType = $clientMediaType; + } + + /** + * Return true if there is no upload error + * + * @return boolean + */ + private function isOk() + { + return $this->error === UPLOAD_ERR_OK; + } + + /** + * @return boolean + */ + public function isMoved() + { + return $this->moved; + } + + /** + * @throws RuntimeException if is moved or not ok + */ + private function validateActive() + { + if (false === $this->isOk()) { + throw new RuntimeException('Cannot retrieve stream due to upload error'); + } + + if ($this->isMoved()) { + throw new RuntimeException('Cannot retrieve stream after it has already been moved'); + } + } + + /** + * {@inheritdoc} + * @throws RuntimeException if the upload was not successful. + */ + public function getStream() + { + $this->validateActive(); + + if ($this->stream instanceof StreamInterface) { + return $this->stream; + } + + return new LazyOpenStream($this->file, 'r+'); + } + + /** + * {@inheritdoc} + * + * @see http://php.net/is_uploaded_file + * @see http://php.net/move_uploaded_file + * @param string $targetPath Path to which to move the uploaded file. + * @throws RuntimeException if the upload was not successful. + * @throws InvalidArgumentException if the $path specified is invalid. + * @throws RuntimeException on any error during the move operation, or on + * the second or subsequent call to the method. + */ + public function moveTo($targetPath) + { + $this->validateActive(); + + if (false === $this->isStringNotEmpty($targetPath)) { + throw new InvalidArgumentException( + 'Invalid path provided for move operation; must be a non-empty string' + ); + } + + if ($this->file) { + $this->moved = php_sapi_name() == 'cli' + ? rename($this->file, $targetPath) + : move_uploaded_file($this->file, $targetPath); + } else { + copy_to_stream( + $this->getStream(), + new LazyOpenStream($targetPath, 'w') + ); + + $this->moved = true; + } + + if (false === $this->moved) { + throw new RuntimeException( + sprintf('Uploaded file could not be moved to %s', $targetPath) + ); + } + } + + /** + * {@inheritdoc} + * + * @return int|null The file size in bytes or null if unknown. + */ + public function getSize() + { + return $this->size; + } + + /** + * {@inheritdoc} + * + * @see http://php.net/manual/en/features.file-upload.errors.php + * @return int One of PHP's UPLOAD_ERR_XXX constants. + */ + public function getError() + { + return $this->error; + } + + /** + * {@inheritdoc} + * + * @return string|null The filename sent by the client or null if none + * was provided. + */ + public function getClientFilename() + { + return $this->clientFilename; + } + + /** + * {@inheritdoc} + */ + public function getClientMediaType() + { + return $this->clientMediaType; + } +} diff --git a/vendor/guzzlehttp/psr7/src/Uri.php b/vendor/guzzlehttp/psr7/src/Uri.php new file mode 100644 index 0000000..825a25e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/Uri.php @@ -0,0 +1,760 @@ + 80, + 'https' => 443, + 'ftp' => 21, + 'gopher' => 70, + 'nntp' => 119, + 'news' => 119, + 'telnet' => 23, + 'tn3270' => 23, + 'imap' => 143, + 'pop' => 110, + 'ldap' => 389, + ]; + + private static $charUnreserved = 'a-zA-Z0-9_\-\.~'; + private static $charSubDelims = '!\$&\'\(\)\*\+,;='; + private static $replaceQuery = ['=' => '%3D', '&' => '%26']; + + /** @var string Uri scheme. */ + private $scheme = ''; + + /** @var string Uri user info. */ + private $userInfo = ''; + + /** @var string Uri host. */ + private $host = ''; + + /** @var int|null Uri port. */ + private $port; + + /** @var string Uri path. */ + private $path = ''; + + /** @var string Uri query string. */ + private $query = ''; + + /** @var string Uri fragment. */ + private $fragment = ''; + + /** + * @param string $uri URI to parse + */ + public function __construct($uri = '') + { + // weak type check to also accept null until we can add scalar type hints + if ($uri != '') { + $parts = parse_url($uri); + if ($parts === false) { + throw new \InvalidArgumentException("Unable to parse URI: $uri"); + } + $this->applyParts($parts); + } + } + + public function __toString() + { + return self::composeComponents( + $this->scheme, + $this->getAuthority(), + $this->path, + $this->query, + $this->fragment + ); + } + + /** + * Composes a URI reference string from its various components. + * + * Usually this method does not need to be called manually but instead is used indirectly via + * `Psr\Http\Message\UriInterface::__toString`. + * + * PSR-7 UriInterface treats an empty component the same as a missing component as + * getQuery(), getFragment() etc. always return a string. This explains the slight + * difference to RFC 3986 Section 5.3. + * + * Another adjustment is that the authority separator is added even when the authority is missing/empty + * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with + * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But + * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to + * that format). + * + * @param string $scheme + * @param string $authority + * @param string $path + * @param string $query + * @param string $fragment + * + * @return string + * + * @link https://tools.ietf.org/html/rfc3986#section-5.3 + */ + public static function composeComponents($scheme, $authority, $path, $query, $fragment) + { + $uri = ''; + + // weak type checks to also accept null until we can add scalar type hints + if ($scheme != '') { + $uri .= $scheme . ':'; + } + + if ($authority != ''|| $scheme === 'file') { + $uri .= '//' . $authority; + } + + $uri .= $path; + + if ($query != '') { + $uri .= '?' . $query; + } + + if ($fragment != '') { + $uri .= '#' . $fragment; + } + + return $uri; + } + + /** + * Whether the URI has the default port of the current scheme. + * + * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used + * independently of the implementation. + * + * @param UriInterface $uri + * + * @return bool + */ + public static function isDefaultPort(UriInterface $uri) + { + return $uri->getPort() === null + || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]); + } + + /** + * Whether the URI is absolute, i.e. it has a scheme. + * + * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true + * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative + * to another URI, the base URI. Relative references can be divided into several forms: + * - network-path references, e.g. '//example.com/path' + * - absolute-path references, e.g. '/path' + * - relative-path references, e.g. 'subpath' + * + * @param UriInterface $uri + * + * @return bool + * @see Uri::isNetworkPathReference + * @see Uri::isAbsolutePathReference + * @see Uri::isRelativePathReference + * @link https://tools.ietf.org/html/rfc3986#section-4 + */ + public static function isAbsolute(UriInterface $uri) + { + return $uri->getScheme() !== ''; + } + + /** + * Whether the URI is a network-path reference. + * + * A relative reference that begins with two slash characters is termed an network-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isNetworkPathReference(UriInterface $uri) + { + return $uri->getScheme() === '' && $uri->getAuthority() !== ''; + } + + /** + * Whether the URI is a absolute-path reference. + * + * A relative reference that begins with a single slash character is termed an absolute-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isAbsolutePathReference(UriInterface $uri) + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && isset($uri->getPath()[0]) + && $uri->getPath()[0] === '/'; + } + + /** + * Whether the URI is a relative-path reference. + * + * A relative reference that does not begin with a slash character is termed a relative-path reference. + * + * @param UriInterface $uri + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isRelativePathReference(UriInterface $uri) + { + return $uri->getScheme() === '' + && $uri->getAuthority() === '' + && (!isset($uri->getPath()[0]) || $uri->getPath()[0] !== '/'); + } + + /** + * Whether the URI is a same-document reference. + * + * A same-document reference refers to a URI that is, aside from its fragment + * component, identical to the base URI. When no base URI is given, only an empty + * URI reference (apart from its fragment) is considered a same-document reference. + * + * @param UriInterface $uri The URI to check + * @param UriInterface|null $base An optional base URI to compare against + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-4.4 + */ + public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) + { + if ($base !== null) { + $uri = UriResolver::resolve($base, $uri); + + return ($uri->getScheme() === $base->getScheme()) + && ($uri->getAuthority() === $base->getAuthority()) + && ($uri->getPath() === $base->getPath()) + && ($uri->getQuery() === $base->getQuery()); + } + + return $uri->getScheme() === '' && $uri->getAuthority() === '' && $uri->getPath() === '' && $uri->getQuery() === ''; + } + + /** + * Removes dot segments from a path and returns the new path. + * + * @param string $path + * + * @return string + * + * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead. + * @see UriResolver::removeDotSegments + */ + public static function removeDotSegments($path) + { + return UriResolver::removeDotSegments($path); + } + + /** + * Converts the relative URI into a new URI that is resolved against the base URI. + * + * @param UriInterface $base Base URI + * @param string|UriInterface $rel Relative URI + * + * @return UriInterface + * + * @deprecated since version 1.4. Use UriResolver::resolve instead. + * @see UriResolver::resolve + */ + public static function resolve(UriInterface $base, $rel) + { + if (!($rel instanceof UriInterface)) { + $rel = new self($rel); + } + + return UriResolver::resolve($base, $rel); + } + + /** + * Creates a new URI with a specific query string value removed. + * + * Any existing query string values that exactly match the provided key are + * removed. + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Query string key to remove. + * + * @return UriInterface + */ + public static function withoutQueryValue(UriInterface $uri, $key) + { + $result = self::getFilteredQueryString($uri, [$key]); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with a specific query string value. + * + * Any existing query string values that exactly match the provided key are + * removed and replaced with the given key value pair. + * + * A value of null will set the query string key without a value, e.g. "key" + * instead of "key=value". + * + * @param UriInterface $uri URI to use as a base. + * @param string $key Key to set. + * @param string|null $value Value to set + * + * @return UriInterface + */ + public static function withQueryValue(UriInterface $uri, $key, $value) + { + $result = self::getFilteredQueryString($uri, [$key]); + + $result[] = self::generateQueryString($key, $value); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with multiple specific query string values. + * + * It has the same behavior as withQueryValue() but for an associative array of key => value. + * + * @param UriInterface $uri URI to use as a base. + * @param array $keyValueArray Associative array of key and values + * + * @return UriInterface + */ + public static function withQueryValues(UriInterface $uri, array $keyValueArray) + { + $result = self::getFilteredQueryString($uri, array_keys($keyValueArray)); + + foreach ($keyValueArray as $key => $value) { + $result[] = self::generateQueryString($key, $value); + } + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a URI from a hash of `parse_url` components. + * + * @param array $parts + * + * @return UriInterface + * @link http://php.net/manual/en/function.parse-url.php + * + * @throws \InvalidArgumentException If the components do not form a valid URI. + */ + public static function fromParts(array $parts) + { + $uri = new self(); + $uri->applyParts($parts); + $uri->validateState(); + + return $uri; + } + + public function getScheme() + { + return $this->scheme; + } + + public function getAuthority() + { + $authority = $this->host; + if ($this->userInfo !== '') { + $authority = $this->userInfo . '@' . $authority; + } + + if ($this->port !== null) { + $authority .= ':' . $this->port; + } + + return $authority; + } + + public function getUserInfo() + { + return $this->userInfo; + } + + public function getHost() + { + return $this->host; + } + + public function getPort() + { + return $this->port; + } + + public function getPath() + { + return $this->path; + } + + public function getQuery() + { + return $this->query; + } + + public function getFragment() + { + return $this->fragment; + } + + public function withScheme($scheme) + { + $scheme = $this->filterScheme($scheme); + + if ($this->scheme === $scheme) { + return $this; + } + + $new = clone $this; + $new->scheme = $scheme; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withUserInfo($user, $password = null) + { + $info = $this->filterUserInfoComponent($user); + if ($password !== null) { + $info .= ':' . $this->filterUserInfoComponent($password); + } + + if ($this->userInfo === $info) { + return $this; + } + + $new = clone $this; + $new->userInfo = $info; + $new->validateState(); + + return $new; + } + + public function withHost($host) + { + $host = $this->filterHost($host); + + if ($this->host === $host) { + return $this; + } + + $new = clone $this; + $new->host = $host; + $new->validateState(); + + return $new; + } + + public function withPort($port) + { + $port = $this->filterPort($port); + + if ($this->port === $port) { + return $this; + } + + $new = clone $this; + $new->port = $port; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withPath($path) + { + $path = $this->filterPath($path); + + if ($this->path === $path) { + return $this; + } + + $new = clone $this; + $new->path = $path; + $new->validateState(); + + return $new; + } + + public function withQuery($query) + { + $query = $this->filterQueryAndFragment($query); + + if ($this->query === $query) { + return $this; + } + + $new = clone $this; + $new->query = $query; + + return $new; + } + + public function withFragment($fragment) + { + $fragment = $this->filterQueryAndFragment($fragment); + + if ($this->fragment === $fragment) { + return $this; + } + + $new = clone $this; + $new->fragment = $fragment; + + return $new; + } + + /** + * Apply parse_url parts to a URI. + * + * @param array $parts Array of parse_url parts to apply. + */ + private function applyParts(array $parts) + { + $this->scheme = isset($parts['scheme']) + ? $this->filterScheme($parts['scheme']) + : ''; + $this->userInfo = isset($parts['user']) + ? $this->filterUserInfoComponent($parts['user']) + : ''; + $this->host = isset($parts['host']) + ? $this->filterHost($parts['host']) + : ''; + $this->port = isset($parts['port']) + ? $this->filterPort($parts['port']) + : null; + $this->path = isset($parts['path']) + ? $this->filterPath($parts['path']) + : ''; + $this->query = isset($parts['query']) + ? $this->filterQueryAndFragment($parts['query']) + : ''; + $this->fragment = isset($parts['fragment']) + ? $this->filterQueryAndFragment($parts['fragment']) + : ''; + if (isset($parts['pass'])) { + $this->userInfo .= ':' . $this->filterUserInfoComponent($parts['pass']); + } + + $this->removeDefaultPort(); + } + + /** + * @param string $scheme + * + * @return string + * + * @throws \InvalidArgumentException If the scheme is invalid. + */ + private function filterScheme($scheme) + { + if (!is_string($scheme)) { + throw new \InvalidArgumentException('Scheme must be a string'); + } + + return strtolower($scheme); + } + + /** + * @param string $component + * + * @return string + * + * @throws \InvalidArgumentException If the user info is invalid. + */ + private function filterUserInfoComponent($component) + { + if (!is_string($component)) { + throw new \InvalidArgumentException('User info must be a string'); + } + + return preg_replace_callback( + '/(?:[^%' . self::$charUnreserved . self::$charSubDelims . ']+|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $component + ); + } + + /** + * @param string $host + * + * @return string + * + * @throws \InvalidArgumentException If the host is invalid. + */ + private function filterHost($host) + { + if (!is_string($host)) { + throw new \InvalidArgumentException('Host must be a string'); + } + + return strtolower($host); + } + + /** + * @param int|null $port + * + * @return int|null + * + * @throws \InvalidArgumentException If the port is invalid. + */ + private function filterPort($port) + { + if ($port === null) { + return null; + } + + $port = (int) $port; + if (0 > $port || 0xffff < $port) { + throw new \InvalidArgumentException( + sprintf('Invalid port: %d. Must be between 0 and 65535', $port) + ); + } + + return $port; + } + + /** + * @param UriInterface $uri + * @param array $keys + * + * @return array + */ + private static function getFilteredQueryString(UriInterface $uri, array $keys) + { + $current = $uri->getQuery(); + + if ($current === '') { + return []; + } + + $decodedKeys = array_map('rawurldecode', $keys); + + return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { + return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); + }); + } + + /** + * @param string $key + * @param string|null $value + * + * @return string + */ + private static function generateQueryString($key, $value) + { + // Query string separators ("=", "&") within the key or value need to be encoded + // (while preventing double-encoding) before setting the query string. All other + // chars that need percent-encoding will be encoded by withQuery(). + $queryString = strtr($key, self::$replaceQuery); + + if ($value !== null) { + $queryString .= '=' . strtr($value, self::$replaceQuery); + } + + return $queryString; + } + + private function removeDefaultPort() + { + if ($this->port !== null && self::isDefaultPort($this)) { + $this->port = null; + } + } + + /** + * Filters the path of a URI + * + * @param string $path + * + * @return string + * + * @throws \InvalidArgumentException If the path is invalid. + */ + private function filterPath($path) + { + if (!is_string($path)) { + throw new \InvalidArgumentException('Path must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $path + ); + } + + /** + * Filters the query string or fragment of a URI. + * + * @param string $str + * + * @return string + * + * @throws \InvalidArgumentException If the query or fragment is invalid. + */ + private function filterQueryAndFragment($str) + { + if (!is_string($str)) { + throw new \InvalidArgumentException('Query and fragment must be a string'); + } + + return preg_replace_callback( + '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $str + ); + } + + private function rawurlencodeMatchZero(array $match) + { + return rawurlencode($match[0]); + } + + private function validateState() + { + if ($this->host === '' && ($this->scheme === 'http' || $this->scheme === 'https')) { + $this->host = self::HTTP_DEFAULT_HOST; + } + + if ($this->getAuthority() === '') { + if (0 === strpos($this->path, '//')) { + throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); + } + if ($this->scheme === '' && false !== strpos(explode('/', $this->path, 2)[0], ':')) { + throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); + } + } elseif (isset($this->path[0]) && $this->path[0] !== '/') { + @trigger_error( + 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI ' . + 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', + E_USER_DEPRECATED + ); + $this->path = '/'. $this->path; + //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); + } + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriNormalizer.php b/vendor/guzzlehttp/psr7/src/UriNormalizer.php new file mode 100644 index 0000000..384c29e --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriNormalizer.php @@ -0,0 +1,216 @@ +getPath() === '' && + ($uri->getScheme() === 'http' || $uri->getScheme() === 'https') + ) { + $uri = $uri->withPath('/'); + } + + if ($flags & self::REMOVE_DEFAULT_HOST && $uri->getScheme() === 'file' && $uri->getHost() === 'localhost') { + $uri = $uri->withHost(''); + } + + if ($flags & self::REMOVE_DEFAULT_PORT && $uri->getPort() !== null && Uri::isDefaultPort($uri)) { + $uri = $uri->withPort(null); + } + + if ($flags & self::REMOVE_DOT_SEGMENTS && !Uri::isRelativePathReference($uri)) { + $uri = $uri->withPath(UriResolver::removeDotSegments($uri->getPath())); + } + + if ($flags & self::REMOVE_DUPLICATE_SLASHES) { + $uri = $uri->withPath(preg_replace('#//++#', '/', $uri->getPath())); + } + + if ($flags & self::SORT_QUERY_PARAMETERS && $uri->getQuery() !== '') { + $queryKeyValues = explode('&', $uri->getQuery()); + sort($queryKeyValues); + $uri = $uri->withQuery(implode('&', $queryKeyValues)); + } + + return $uri; + } + + /** + * Whether two URIs can be considered equivalent. + * + * Both URIs are normalized automatically before comparison with the given $normalizations bitmask. The method also + * accepts relative URI references and returns true when they are equivalent. This of course assumes they will be + * resolved against the same base URI. If this is not the case, determination of equivalence or difference of + * relative references does not mean anything. + * + * @param UriInterface $uri1 An URI to compare + * @param UriInterface $uri2 An URI to compare + * @param int $normalizations A bitmask of normalizations to apply, see constants + * + * @return bool + * @link https://tools.ietf.org/html/rfc3986#section-6.1 + */ + public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, $normalizations = self::PRESERVING_NORMALIZATIONS) + { + return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); + } + + private static function capitalizePercentEncoding(UriInterface $uri) + { + $regex = '/(?:%[A-Fa-f0-9]{2})++/'; + + $callback = function (array $match) { + return strtoupper($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private static function decodeUnreservedCharacters(UriInterface $uri) + { + $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; + + $callback = function (array $match) { + return rawurldecode($match[0]); + }; + + return + $uri->withPath( + preg_replace_callback($regex, $callback, $uri->getPath()) + )->withQuery( + preg_replace_callback($regex, $callback, $uri->getQuery()) + ); + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/UriResolver.php b/vendor/guzzlehttp/psr7/src/UriResolver.php new file mode 100644 index 0000000..c1cb8a2 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/UriResolver.php @@ -0,0 +1,219 @@ +getScheme() != '') { + return $rel->withPath(self::removeDotSegments($rel->getPath())); + } + + if ($rel->getAuthority() != '') { + $targetAuthority = $rel->getAuthority(); + $targetPath = self::removeDotSegments($rel->getPath()); + $targetQuery = $rel->getQuery(); + } else { + $targetAuthority = $base->getAuthority(); + if ($rel->getPath() === '') { + $targetPath = $base->getPath(); + $targetQuery = $rel->getQuery() != '' ? $rel->getQuery() : $base->getQuery(); + } else { + if ($rel->getPath()[0] === '/') { + $targetPath = $rel->getPath(); + } else { + if ($targetAuthority != '' && $base->getPath() === '') { + $targetPath = '/' . $rel->getPath(); + } else { + $lastSlashPos = strrpos($base->getPath(), '/'); + if ($lastSlashPos === false) { + $targetPath = $rel->getPath(); + } else { + $targetPath = substr($base->getPath(), 0, $lastSlashPos + 1) . $rel->getPath(); + } + } + } + $targetPath = self::removeDotSegments($targetPath); + $targetQuery = $rel->getQuery(); + } + } + + return new Uri(Uri::composeComponents( + $base->getScheme(), + $targetAuthority, + $targetPath, + $targetQuery, + $rel->getFragment() + )); + } + + /** + * Returns the target URI as a relative reference from the base URI. + * + * This method is the counterpart to resolve(): + * + * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) + * + * One use-case is to use the current request URI as base URI and then generate relative links in your documents + * to reduce the document size or offer self-contained downloadable document archives. + * + * $base = new Uri('http://example.com/a/b/'); + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. + * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. + * + * This method also accepts a target that is already relative and will try to relativize it further. Only a + * relative-path reference will be returned as-is. + * + * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well + * + * @param UriInterface $base Base URI + * @param UriInterface $target Target URI + * + * @return UriInterface The relative URI reference + */ + public static function relativize(UriInterface $base, UriInterface $target) + { + if ($target->getScheme() !== '' && + ($base->getScheme() !== $target->getScheme() || $target->getAuthority() === '' && $base->getAuthority() !== '') + ) { + return $target; + } + + if (Uri::isRelativePathReference($target)) { + // As the target is already highly relative we return it as-is. It would be possible to resolve + // the target with `$target = self::resolve($base, $target);` and then try make it more relative + // by removing a duplicate query. But let's not do that automatically. + return $target; + } + + if ($target->getAuthority() !== '' && $base->getAuthority() !== $target->getAuthority()) { + return $target->withScheme(''); + } + + // We must remove the path before removing the authority because if the path starts with two slashes, the URI + // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also + // invalid. + $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); + + if ($base->getPath() !== $target->getPath()) { + return $emptyPathUri->withPath(self::getRelativePath($base, $target)); + } + + if ($base->getQuery() === $target->getQuery()) { + // Only the target fragment is left. And it must be returned even if base and target fragment are the same. + return $emptyPathUri->withQuery(''); + } + + // If the base URI has a query but the target has none, we cannot return an empty path reference as it would + // inherit the base query component when resolving. + if ($target->getQuery() === '') { + $segments = explode('/', $target->getPath()); + $lastSegment = end($segments); + + return $emptyPathUri->withPath($lastSegment === '' ? './' : $lastSegment); + } + + return $emptyPathUri; + } + + private static function getRelativePath(UriInterface $base, UriInterface $target) + { + $sourceSegments = explode('/', $base->getPath()); + $targetSegments = explode('/', $target->getPath()); + array_pop($sourceSegments); + $targetLastSegment = array_pop($targetSegments); + foreach ($sourceSegments as $i => $segment) { + if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { + unset($sourceSegments[$i], $targetSegments[$i]); + } else { + break; + } + } + $targetSegments[] = $targetLastSegment; + $relativePath = str_repeat('../', count($sourceSegments)) . implode('/', $targetSegments); + + // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". + // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used + // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. + if ('' === $relativePath || false !== strpos(explode('/', $relativePath, 2)[0], ':')) { + $relativePath = "./$relativePath"; + } elseif ('/' === $relativePath[0]) { + if ($base->getAuthority() != '' && $base->getPath() === '') { + // In this case an extra slash is added by resolve() automatically. So we must not add one here. + $relativePath = ".$relativePath"; + } else { + $relativePath = "./$relativePath"; + } + } + + return $relativePath; + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/vendor/guzzlehttp/psr7/src/functions.php b/vendor/guzzlehttp/psr7/src/functions.php new file mode 100644 index 0000000..8e6dafe --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/functions.php @@ -0,0 +1,899 @@ +getMethod() . ' ' + . $message->getRequestTarget()) + . ' HTTP/' . $message->getProtocolVersion(); + if (!$message->hasHeader('host')) { + $msg .= "\r\nHost: " . $message->getUri()->getHost(); + } + } elseif ($message instanceof ResponseInterface) { + $msg = 'HTTP/' . $message->getProtocolVersion() . ' ' + . $message->getStatusCode() . ' ' + . $message->getReasonPhrase(); + } else { + throw new \InvalidArgumentException('Unknown message type'); + } + + foreach ($message->getHeaders() as $name => $values) { + $msg .= "\r\n{$name}: " . implode(', ', $values); + } + + return "{$msg}\r\n\r\n" . $message->getBody(); +} + +/** + * Returns a UriInterface for the given value. + * + * This function accepts a string or {@see Psr\Http\Message\UriInterface} and + * returns a UriInterface for the given value. If the value is already a + * `UriInterface`, it is returned as-is. + * + * @param string|UriInterface $uri + * + * @return UriInterface + * @throws \InvalidArgumentException + */ +function uri_for($uri) +{ + if ($uri instanceof UriInterface) { + return $uri; + } elseif (is_string($uri)) { + return new Uri($uri); + } + + throw new \InvalidArgumentException('URI must be a string or UriInterface'); +} + +/** + * Create a new stream based on the input type. + * + * Options is an associative array that can contain the following keys: + * - metadata: Array of custom metadata. + * - size: Size of the stream. + * + * @param resource|string|null|int|float|bool|StreamInterface|callable|\Iterator $resource Entity body data + * @param array $options Additional options + * + * @return StreamInterface + * @throws \InvalidArgumentException if the $resource arg is not valid. + */ +function stream_for($resource = '', array $options = []) +{ + if (is_scalar($resource)) { + $stream = fopen('php://temp', 'r+'); + if ($resource !== '') { + fwrite($stream, $resource); + fseek($stream, 0); + } + return new Stream($stream, $options); + } + + switch (gettype($resource)) { + case 'resource': + return new Stream($resource, $options); + case 'object': + if ($resource instanceof StreamInterface) { + return $resource; + } elseif ($resource instanceof \Iterator) { + return new PumpStream(function () use ($resource) { + if (!$resource->valid()) { + return false; + } + $result = $resource->current(); + $resource->next(); + return $result; + }, $options); + } elseif (method_exists($resource, '__toString')) { + return stream_for((string) $resource, $options); + } + break; + case 'NULL': + return new Stream(fopen('php://temp', 'r+'), $options); + } + + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + + throw new \InvalidArgumentException('Invalid resource type: ' . gettype($resource)); +} + +/** + * Parse an array of header values containing ";" separated data into an + * array of associative arrays representing the header key value pair + * data of the header. When a parameter does not contain a value, but just + * contains a key, this function will inject a key with a '' string value. + * + * @param string|array $header Header to parse into components. + * + * @return array Returns the parsed header values. + */ +function parse_header($header) +{ + static $trimmed = "\"' \n\t\r"; + $params = $matches = []; + + foreach (normalize_header($header) as $val) { + $part = []; + foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) { + if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { + $m = $matches[0]; + if (isset($m[1])) { + $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed); + } else { + $part[] = trim($m[0], $trimmed); + } + } + } + if ($part) { + $params[] = $part; + } + } + + return $params; +} + +/** + * Converts an array of header values that may contain comma separated + * headers into an array of headers with no comma separated values. + * + * @param string|array $header Header to normalize. + * + * @return array Returns the normalized header field values. + */ +function normalize_header($header) +{ + if (!is_array($header)) { + return array_map('trim', explode(',', $header)); + } + + $result = []; + foreach ($header as $value) { + foreach ((array) $value as $v) { + if (strpos($v, ',') === false) { + $result[] = $v; + continue; + } + foreach (preg_split('/,(?=([^"]*"[^"]*")*[^"]*$)/', $v) as $vv) { + $result[] = trim($vv); + } + } + } + + return $result; +} + +/** + * Clone and modify a request with the given changes. + * + * The changes can be one of: + * - method: (string) Changes the HTTP method. + * - set_headers: (array) Sets the given headers. + * - remove_headers: (array) Remove the given headers. + * - body: (mixed) Sets the given body. + * - uri: (UriInterface) Set the URI. + * - query: (string) Set the query string value of the URI. + * - version: (string) Set the protocol version. + * + * @param RequestInterface $request Request to clone and modify. + * @param array $changes Changes to apply. + * + * @return RequestInterface + */ +function modify_request(RequestInterface $request, array $changes) +{ + if (!$changes) { + return $request; + } + + $headers = $request->getHeaders(); + + if (!isset($changes['uri'])) { + $uri = $request->getUri(); + } else { + // Remove the host header if one is on the URI + if ($host = $changes['uri']->getHost()) { + $changes['set_headers']['Host'] = $host; + + if ($port = $changes['uri']->getPort()) { + $standardPorts = ['http' => 80, 'https' => 443]; + $scheme = $changes['uri']->getScheme(); + if (isset($standardPorts[$scheme]) && $port != $standardPorts[$scheme]) { + $changes['set_headers']['Host'] .= ':'.$port; + } + } + } + $uri = $changes['uri']; + } + + if (!empty($changes['remove_headers'])) { + $headers = _caseless_remove($changes['remove_headers'], $headers); + } + + if (!empty($changes['set_headers'])) { + $headers = _caseless_remove(array_keys($changes['set_headers']), $headers); + $headers = $changes['set_headers'] + $headers; + } + + if (isset($changes['query'])) { + $uri = $uri->withQuery($changes['query']); + } + + if ($request instanceof ServerRequestInterface) { + return (new ServerRequest( + isset($changes['method']) ? $changes['method'] : $request->getMethod(), + $uri, + $headers, + isset($changes['body']) ? $changes['body'] : $request->getBody(), + isset($changes['version']) + ? $changes['version'] + : $request->getProtocolVersion(), + $request->getServerParams() + )) + ->withParsedBody($request->getParsedBody()) + ->withQueryParams($request->getQueryParams()) + ->withCookieParams($request->getCookieParams()) + ->withUploadedFiles($request->getUploadedFiles()); + } + + return new Request( + isset($changes['method']) ? $changes['method'] : $request->getMethod(), + $uri, + $headers, + isset($changes['body']) ? $changes['body'] : $request->getBody(), + isset($changes['version']) + ? $changes['version'] + : $request->getProtocolVersion() + ); +} + +/** + * Attempts to rewind a message body and throws an exception on failure. + * + * The body of the message will only be rewound if a call to `tell()` returns a + * value other than `0`. + * + * @param MessageInterface $message Message to rewind + * + * @throws \RuntimeException + */ +function rewind_body(MessageInterface $message) +{ + $body = $message->getBody(); + + if ($body->tell()) { + $body->rewind(); + } +} + +/** + * Safely opens a PHP stream resource using a filename. + * + * When fopen fails, PHP normally raises a warning. This function adds an + * error handler that checks for errors and throws an exception instead. + * + * @param string $filename File to open + * @param string $mode Mode used to open the file + * + * @return resource + * @throws \RuntimeException if the file cannot be opened + */ +function try_fopen($filename, $mode) +{ + $ex = null; + set_error_handler(function () use ($filename, $mode, &$ex) { + $ex = new \RuntimeException(sprintf( + 'Unable to open %s using mode %s: %s', + $filename, + $mode, + func_get_args()[1] + )); + }); + + $handle = fopen($filename, $mode); + restore_error_handler(); + + if ($ex) { + /** @var $ex \RuntimeException */ + throw $ex; + } + + return $handle; +} + +/** + * Copy the contents of a stream into a string until the given number of + * bytes have been read. + * + * @param StreamInterface $stream Stream to read + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * @return string + * @throws \RuntimeException on error. + */ +function copy_to_string(StreamInterface $stream, $maxLen = -1) +{ + $buffer = ''; + + if ($maxLen === -1) { + while (!$stream->eof()) { + $buf = $stream->read(1048576); + // Using a loose equality here to match on '' and false. + if ($buf == null) { + break; + } + $buffer .= $buf; + } + return $buffer; + } + + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + // Using a loose equality here to match on '' and false. + if ($buf == null) { + break; + } + $buffer .= $buf; + $len = strlen($buffer); + } + + return $buffer; +} + +/** + * Copy the contents of a stream into another stream until the given number + * of bytes have been read. + * + * @param StreamInterface $source Stream to read from + * @param StreamInterface $dest Stream to write to + * @param int $maxLen Maximum number of bytes to read. Pass -1 + * to read the entire stream. + * + * @throws \RuntimeException on error. + */ +function copy_to_stream( + StreamInterface $source, + StreamInterface $dest, + $maxLen = -1 +) { + $bufferSize = 8192; + + if ($maxLen === -1) { + while (!$source->eof()) { + if (!$dest->write($source->read($bufferSize))) { + break; + } + } + } else { + $remaining = $maxLen; + while ($remaining > 0 && !$source->eof()) { + $buf = $source->read(min($bufferSize, $remaining)); + $len = strlen($buf); + if (!$len) { + break; + } + $remaining -= $len; + $dest->write($buf); + } + } +} + +/** + * Calculate a hash of a Stream + * + * @param StreamInterface $stream Stream to calculate the hash for + * @param string $algo Hash algorithm (e.g. md5, crc32, etc) + * @param bool $rawOutput Whether or not to use raw output + * + * @return string Returns the hash of the stream + * @throws \RuntimeException on error. + */ +function hash( + StreamInterface $stream, + $algo, + $rawOutput = false +) { + $pos = $stream->tell(); + + if ($pos > 0) { + $stream->rewind(); + } + + $ctx = hash_init($algo); + while (!$stream->eof()) { + hash_update($ctx, $stream->read(1048576)); + } + + $out = hash_final($ctx, (bool) $rawOutput); + $stream->seek($pos); + + return $out; +} + +/** + * Read a line from the stream up to the maximum allowed buffer length + * + * @param StreamInterface $stream Stream to read from + * @param int $maxLength Maximum buffer length + * + * @return string + */ +function readline(StreamInterface $stream, $maxLength = null) +{ + $buffer = ''; + $size = 0; + + while (!$stream->eof()) { + // Using a loose equality here to match on '' and false. + if (null == ($byte = $stream->read(1))) { + return $buffer; + } + $buffer .= $byte; + // Break when a new line is found or the max length - 1 is reached + if ($byte === "\n" || ++$size === $maxLength - 1) { + break; + } + } + + return $buffer; +} + +/** + * Parses a request message string into a request object. + * + * @param string $message Request message string. + * + * @return Request + */ +function parse_request($message) +{ + $data = _parse_message($message); + $matches = []; + if (!preg_match('/^[\S]+\s+([a-zA-Z]+:\/\/|\/).*/', $data['start-line'], $matches)) { + throw new \InvalidArgumentException('Invalid request string'); + } + $parts = explode(' ', $data['start-line'], 3); + $version = isset($parts[2]) ? explode('/', $parts[2])[1] : '1.1'; + + $request = new Request( + $parts[0], + $matches[1] === '/' ? _parse_request_uri($parts[1], $data['headers']) : $parts[1], + $data['headers'], + $data['body'], + $version + ); + + return $matches[1] === '/' ? $request : $request->withRequestTarget($parts[1]); +} + +/** + * Parses a response message string into a response object. + * + * @param string $message Response message string. + * + * @return Response + */ +function parse_response($message) +{ + $data = _parse_message($message); + // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space + // between status-code and reason-phrase is required. But browsers accept + // responses without space and reason as well. + if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { + throw new \InvalidArgumentException('Invalid response string: ' . $data['start-line']); + } + $parts = explode(' ', $data['start-line'], 3); + + return new Response( + $parts[1], + $data['headers'], + $data['body'], + explode('/', $parts[0])[1], + isset($parts[2]) ? $parts[2] : null + ); +} + +/** + * Parse a query string into an associative array. + * + * If multiple values are found for the same key, the value of that key + * value pair will become an array. This function does not parse nested + * PHP style arrays into an associative array (e.g., foo[a]=1&foo[b]=2 will + * be parsed into ['foo[a]' => '1', 'foo[b]' => '2']). + * + * @param string $str Query string to parse + * @param int|bool $urlEncoding How the query string is encoded + * + * @return array + */ +function parse_query($str, $urlEncoding = true) +{ + $result = []; + + if ($str === '') { + return $result; + } + + if ($urlEncoding === true) { + $decoder = function ($value) { + return rawurldecode(str_replace('+', ' ', $value)); + }; + } elseif ($urlEncoding === PHP_QUERY_RFC3986) { + $decoder = 'rawurldecode'; + } elseif ($urlEncoding === PHP_QUERY_RFC1738) { + $decoder = 'urldecode'; + } else { + $decoder = function ($str) { return $str; }; + } + + foreach (explode('&', $str) as $kvp) { + $parts = explode('=', $kvp, 2); + $key = $decoder($parts[0]); + $value = isset($parts[1]) ? $decoder($parts[1]) : null; + if (!isset($result[$key])) { + $result[$key] = $value; + } else { + if (!is_array($result[$key])) { + $result[$key] = [$result[$key]]; + } + $result[$key][] = $value; + } + } + + return $result; +} + +/** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of parse_query() to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like http_build_query would). + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + * @return string + */ +function build_query(array $params, $encoding = PHP_QUERY_RFC3986) +{ + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function ($str) { return $str; }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder($k); + if (!is_array($v)) { + $qs .= $k; + if ($v !== null) { + $qs .= '=' . $encoder($v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + if ($vv !== null) { + $qs .= '=' . $encoder($vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; +} + +/** + * Determines the mimetype of a file by looking at its extension. + * + * @param $filename + * + * @return null|string + */ +function mimetype_from_filename($filename) +{ + return mimetype_from_extension(pathinfo($filename, PATHINFO_EXTENSION)); +} + +/** + * Maps a file extensions to a mimetype. + * + * @param $extension string The file extension. + * + * @return string|null + * @link http://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x/conf/mime.types + */ +function mimetype_from_extension($extension) +{ + static $mimetypes = [ + '3gp' => 'video/3gpp', + '7z' => 'application/x-7z-compressed', + 'aac' => 'audio/x-aac', + 'ai' => 'application/postscript', + 'aif' => 'audio/x-aiff', + 'asc' => 'text/plain', + 'asf' => 'video/x-ms-asf', + 'atom' => 'application/atom+xml', + 'avi' => 'video/x-msvideo', + 'bmp' => 'image/bmp', + 'bz2' => 'application/x-bzip2', + 'cer' => 'application/pkix-cert', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-ca-cert', + 'css' => 'text/css', + 'csv' => 'text/csv', + 'cu' => 'application/cu-seeme', + 'deb' => 'application/x-debian-package', + 'doc' => 'application/msword', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'dvi' => 'application/x-dvi', + 'eot' => 'application/vnd.ms-fontobject', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'etx' => 'text/x-setext', + 'flac' => 'audio/flac', + 'flv' => 'video/x-flv', + 'gif' => 'image/gif', + 'gz' => 'application/gzip', + 'htm' => 'text/html', + 'html' => 'text/html', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'ini' => 'text/plain', + 'iso' => 'application/x-iso9660-image', + 'jar' => 'application/java-archive', + 'jpe' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpg' => 'image/jpeg', + 'js' => 'text/javascript', + 'json' => 'application/json', + 'latex' => 'application/x-latex', + 'log' => 'text/plain', + 'm4a' => 'audio/mp4', + 'm4v' => 'video/mp4', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mov' => 'video/quicktime', + 'mkv' => 'video/x-matroska', + 'mp3' => 'audio/mpeg', + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4v' => 'video/mp4', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'oga' => 'audio/ogg', + 'ogg' => 'audio/ogg', + 'ogv' => 'video/ogg', + 'ogx' => 'application/ogg', + 'pbm' => 'image/x-portable-bitmap', + 'pdf' => 'application/pdf', + 'pgm' => 'image/x-portable-graymap', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'ppm' => 'image/x-portable-pixmap', + 'ppt' => 'application/vnd.ms-powerpoint', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'ps' => 'application/postscript', + 'qt' => 'video/quicktime', + 'rar' => 'application/x-rar-compressed', + 'ras' => 'image/x-cmu-raster', + 'rss' => 'application/rss+xml', + 'rtf' => 'application/rtf', + 'sgm' => 'text/sgml', + 'sgml' => 'text/sgml', + 'svg' => 'image/svg+xml', + 'swf' => 'application/x-shockwave-flash', + 'tar' => 'application/x-tar', + 'tif' => 'image/tiff', + 'tiff' => 'image/tiff', + 'torrent' => 'application/x-bittorrent', + 'ttf' => 'application/x-font-ttf', + 'txt' => 'text/plain', + 'wav' => 'audio/x-wav', + 'webm' => 'video/webm', + 'webp' => 'image/webp', + 'wma' => 'audio/x-ms-wma', + 'wmv' => 'video/x-ms-wmv', + 'woff' => 'application/x-font-woff', + 'wsdl' => 'application/wsdl+xml', + 'xbm' => 'image/x-xbitmap', + 'xls' => 'application/vnd.ms-excel', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'xml' => 'application/xml', + 'xpm' => 'image/x-xpixmap', + 'xwd' => 'image/x-xwindowdump', + 'yaml' => 'text/yaml', + 'yml' => 'text/yaml', + 'zip' => 'application/zip', + ]; + + $extension = strtolower($extension); + + return isset($mimetypes[$extension]) + ? $mimetypes[$extension] + : null; +} + +/** + * Parses an HTTP message into an associative array. + * + * The array contains the "start-line" key containing the start line of + * the message, "headers" key containing an associative array of header + * array values, and a "body" key containing the body of the message. + * + * @param string $message HTTP request or response to parse. + * + * @return array + * @internal + */ +function _parse_message($message) +{ + if (!$message) { + throw new \InvalidArgumentException('Invalid message'); + } + + $message = ltrim($message, "\r\n"); + + $messageParts = preg_split("/\r?\n\r?\n/", $message, 2); + + if ($messageParts === false || count($messageParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing header delimiter'); + } + + list($rawHeaders, $body) = $messageParts; + $rawHeaders .= "\r\n"; // Put back the delimiter we split previously + $headerParts = preg_split("/\r?\n/", $rawHeaders, 2); + + if ($headerParts === false || count($headerParts) !== 2) { + throw new \InvalidArgumentException('Invalid message: Missing status line'); + } + + list($startLine, $rawHeaders) = $headerParts; + + if (preg_match("/(?:^HTTP\/|^[A-Z]+ \S+ HTTP\/)(\d+(?:\.\d+)?)/i", $startLine, $matches) && $matches[1] === '1.0') { + // Header folding is deprecated for HTTP/1.1, but allowed in HTTP/1.0 + $rawHeaders = preg_replace(Rfc7230::HEADER_FOLD_REGEX, ' ', $rawHeaders); + } + + /** @var array[] $headerLines */ + $count = preg_match_all(Rfc7230::HEADER_REGEX, $rawHeaders, $headerLines, PREG_SET_ORDER); + + // If these aren't the same, then one line didn't match and there's an invalid header. + if ($count !== substr_count($rawHeaders, "\n")) { + // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4 + if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { + throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); + } + + throw new \InvalidArgumentException('Invalid header syntax'); + } + + $headers = []; + + foreach ($headerLines as $headerLine) { + $headers[$headerLine[1]][] = $headerLine[2]; + } + + return [ + 'start-line' => $startLine, + 'headers' => $headers, + 'body' => $body, + ]; +} + +/** + * Constructs a URI for an HTTP request message. + * + * @param string $path Path from the start-line + * @param array $headers Array of headers (each value an array). + * + * @return string + * @internal + */ +function _parse_request_uri($path, array $headers) +{ + $hostKey = array_filter(array_keys($headers), function ($k) { + return strtolower($k) === 'host'; + }); + + // If no host is found, then a full URI cannot be constructed. + if (!$hostKey) { + return $path; + } + + $host = $headers[reset($hostKey)][0]; + $scheme = substr($host, -4) === ':443' ? 'https' : 'http'; + + return $scheme . '://' . $host . '/' . ltrim($path, '/'); +} + +/** + * Get a short summary of the message body + * + * Will return `null` if the response is not printable. + * + * @param MessageInterface $message The message to get the body summary + * @param int $truncateAt The maximum allowed size of the summary + * + * @return null|string + */ +function get_message_body_summary(MessageInterface $message, $truncateAt = 120) +{ + $body = $message->getBody(); + + if (!$body->isSeekable() || !$body->isReadable()) { + return null; + } + + $size = $body->getSize(); + + if ($size === 0) { + return null; + } + + $summary = $body->read($truncateAt); + $body->rewind(); + + if ($size > $truncateAt) { + $summary .= ' (truncated...)'; + } + + // Matches any printable character, including unicode characters: + // letters, marks, numbers, punctuation, spacing, and separators. + if (preg_match('/[^\pL\pM\pN\pP\pS\pZ\n\r\t]/', $summary)) { + return null; + } + + return $summary; +} + +/** @internal */ +function _caseless_remove($keys, array $data) +{ + $result = []; + + foreach ($keys as &$key) { + $key = strtolower($key); + } + + foreach ($data as $k => $v) { + if (!in_array(strtolower($k), $keys)) { + $result[$k] = $v; + } + } + + return $result; +} diff --git a/vendor/guzzlehttp/psr7/src/functions_include.php b/vendor/guzzlehttp/psr7/src/functions_include.php new file mode 100644 index 0000000..96a4a83 --- /dev/null +++ b/vendor/guzzlehttp/psr7/src/functions_include.php @@ -0,0 +1,6 @@ +=5.3.3" + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, "autoload": { "classmap": [ "src/" @@ -359,20 +370,20 @@ "keywords": [ "timer" ], - "time": "2015-06-21 08:01:12" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", - "version": "1.4.6", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b" + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3ab72c62e550370a6cd5dc873e1a04ab57562f5b", - "reference": "3ab72c62e550370a6cd5dc873e1a04ab57562f5b", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/1ce90ba27c42e4e44e6d8458241466380b51fa16", + "reference": "1ce90ba27c42e4e44e6d8458241466380b51fa16", "shasum": "" }, "require": { @@ -408,20 +419,20 @@ "keywords": [ "tokenizer" ], - "time": "2015-08-16 08:51:00" + "time": "2017-12-04T08:55:13+00:00" }, { "name": "phpunit/phpunit", - "version": "4.8.5", + "version": "4.8.36", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "9b7417edaf28059ea63d86be941e6004dbfcc0cc" + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9b7417edaf28059ea63d86be941e6004dbfcc0cc", - "reference": "9b7417edaf28059ea63d86be941e6004dbfcc0cc", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/46023de9a91eec7dfb06cc56cb4e260017298517", + "reference": "46023de9a91eec7dfb06cc56cb4e260017298517", "shasum": "" }, "require": { @@ -435,9 +446,9 @@ "phpunit/php-code-coverage": "~2.1", "phpunit/php-file-iterator": "~1.4", "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": ">=1.0.6", + "phpunit/php-timer": "^1.0.6", "phpunit/phpunit-mock-objects": "~2.3", - "sebastian/comparator": "~1.1", + "sebastian/comparator": "~1.2.2", "sebastian/diff": "~1.2", "sebastian/environment": "~1.3", "sebastian/exporter": "~1.2", @@ -480,20 +491,20 @@ "testing", "xunit" ], - "time": "2015-08-19 09:20:57" + "time": "2017-06-21T08:07:12+00:00" }, { "name": "phpunit/phpunit-mock-objects", - "version": "2.3.7", + "version": "2.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "5e2645ad49d196e020b85598d7c97e482725786a" + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a", - "reference": "5e2645ad49d196e020b85598d7c97e482725786a", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983", + "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983", "shasum": "" }, "require": { @@ -536,26 +547,26 @@ "mock", "xunit" ], - "time": "2015-08-19 09:14:08" + "time": "2015-10-02T06:51:40+00:00" }, { "name": "sebastian/comparator", - "version": "1.2.0", + "version": "1.2.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22" + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/937efb279bd37a375bcadf584dec0726f84dbf22", - "reference": "937efb279bd37a375bcadf584dec0726f84dbf22", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", + "reference": "2b7424b55f5047b47ac6e5ccb20b2aea4011d9be", "shasum": "" }, "require": { "php": ">=5.3.3", "sebastian/diff": "~1.2", - "sebastian/exporter": "~1.2" + "sebastian/exporter": "~1.2 || ~2.0" }, "require-dev": { "phpunit/phpunit": "~4.4" @@ -600,32 +611,32 @@ "compare", "equality" ], - "time": "2015-07-26 15:48:44" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", - "version": "1.3.0", + "version": "1.4.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3" + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/863df9687835c62aa423a22412d26fa2ebde3fd3", - "reference": "863df9687835c62aa423a22412d26fa2ebde3fd3", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7f066a26a962dbe58ddea9f72a4e82874a3975a4", + "reference": "7f066a26a962dbe58ddea9f72a4e82874a3975a4", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.2" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.3-dev" + "dev-master": "1.4-dev" } }, "autoload": { @@ -648,31 +659,31 @@ } ], "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", + "homepage": "https://github.com/sebastianbergmann/diff", "keywords": [ "diff" ], - "time": "2015-02-22 15:13:53" + "time": "2017-05-22T07:24:03+00:00" }, { "name": "sebastian/environment", - "version": "1.3.2", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44" + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44", - "reference": "6324c907ce7a52478eeeaede764f48733ef5ae44", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "^4.8 || ^5.0" }, "type": "library", "extra": { @@ -702,20 +713,20 @@ "environment", "hhvm" ], - "time": "2015-08-03 06:14:51" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e" + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/7ae5513327cb536431847bcc0c10edba2701064e", - "reference": "7ae5513327cb536431847bcc0c10edba2701064e", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/42c4c2eec485ee3e159ec9884f95b431287edde4", + "reference": "42c4c2eec485ee3e159ec9884f95b431287edde4", "shasum": "" }, "require": { @@ -723,12 +734,13 @@ "sebastian/recursion-context": "~1.0" }, "require-dev": { + "ext-mbstring": "*", "phpunit/phpunit": "~4.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -768,20 +780,20 @@ "export", "exporter" ], - "time": "2015-06-21 07:55:53" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/global-state", - "version": "1.0.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", - "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4", + "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4", "shasum": "" }, "require": { @@ -819,20 +831,20 @@ "keywords": [ "global state" ], - "time": "2014-10-06 09:23:50" + "time": "2015-10-12T03:26:01+00:00" }, { "name": "sebastian/recursion-context", - "version": "1.0.1", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba" + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/994d4a811bafe801fb06dccbee797863ba2792ba", - "reference": "994d4a811bafe801fb06dccbee797863ba2792ba", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/b19cc3298482a335a95f3016d2f8a6950f0fbcd7", + "reference": "b19cc3298482a335a95f3016d2f8a6950f0fbcd7", "shasum": "" }, "require": { @@ -872,7 +884,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2015-06-21 08:04:50" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", @@ -907,38 +919,97 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-06-21T13:59:46+00:00" }, { - "name": "symfony/yaml", - "version": "v2.7.3", + "name": "symfony/polyfill-ctype", + "version": "v1.10.0", "source": { "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "71340e996171474a53f3d29111d046be4ad8a0ff" + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/71340e996171474a53f3d29111d046be4ad8a0ff", - "reference": "71340e996171474a53f3d29111d046be4ad8a0ff", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "shasum": "" }, "require": { - "php": ">=5.3.9" + "php": ">=5.3.3" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" + "suggest": { + "ext-ctype": "For best performance" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.7-dev" + "dev-master": "1.9-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "time": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/yaml", + "version": "v2.8.49", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "02c1859112aa779d9ab394ae4f3381911d84052b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/02c1859112aa779d9ab394ae4f3381911d84052b", + "reference": "02c1859112aa779d9ab394ae4f3381911d84052b", + "shasum": "" + }, + "require": { + "php": ">=5.3.9", + "symfony/polyfill-ctype": "~1.8" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.8-dev" } }, "autoload": { "psr-4": { "Symfony\\Component\\Yaml\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -956,7 +1027,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2015-07-28 14:07:07" + "time": "2018-11-11T11:18:13+00:00" } ], "aliases": [], @@ -965,7 +1036,11 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.3.0" + "php": ">=5.3.0", + "ext-mbstring": "*" }, - "platform-dev": [] + "platform-dev": [], + "platform-overrides": { + "php": "5.4.7" + } } diff --git a/vendor/marc1706/fast-image-size/lib/FastImageSize.php b/vendor/marc1706/fast-image-size/lib/FastImageSize.php index f904433..64ab224 100644 --- a/vendor/marc1706/fast-image-size/lib/FastImageSize.php +++ b/vendor/marc1706/fast-image-size/lib/FastImageSize.php @@ -74,25 +74,6 @@ class FastImageSize /** @var array An array containing the classes of supported image types */ protected $type; - /** - * Constructor for fastImageSize class - */ - public function __construct() - { - foreach ($this->supportedTypes as $imageType => $extension) - { - $className = '\FastImageSize\Type\Type' . mb_convert_case(mb_strtolower($imageType), MB_CASE_TITLE); - $this->type[$imageType] = new $className($this); - - // Create class map - foreach ($extension as $ext) - { - /** @var Type\TypeInterface */ - $this->classMap[$ext] = $this->type[$imageType]; - } - } - } - /** * Get image dimensions of supplied image * @@ -132,6 +113,7 @@ class FastImageSize if ($data !== false) { + $this->loadAllTypes(); foreach ($this->type as $imageType) { $imageType->getSize($filename); @@ -153,6 +135,7 @@ class FastImageSize protected function getImageSizeByExtension($file, $extension) { $extension = strtolower($extension); + $this->loadExtension($extension); if (isset($this->classMap[$extension])) { $this->classMap[$extension]->getSize($file); @@ -225,4 +208,58 @@ class FastImageSize { return sizeof($this->size) > 1 ? $this->size : false; } + + /** + * Load all supported types + */ + protected function loadAllTypes() + { + foreach ($this->supportedTypes as $imageType => $extension) + { + $this->loadType($imageType); + } + } + + /** + * Load an image type by extension + * + * @param string $extension Extension of image + */ + protected function loadExtension($extension) + { + if (isset($this->classMap[$extension])) + { + return; + } + foreach ($this->supportedTypes as $imageType => $extensions) + { + if (in_array($extension, $extensions, true)) + { + $this->loadType($imageType); + } + } + } + + /** + * Load an image type + * + * @param string $imageType Mimetype + */ + protected function loadType($imageType) + { + if (isset($this->type[$imageType])) + { + return; + } + + $className = '\FastImageSize\Type\Type' . mb_convert_case(mb_strtolower($imageType), MB_CASE_TITLE); + $this->type[$imageType] = new $className($this); + + // Create class map + foreach ($this->supportedTypes[$imageType] as $ext) + { + /** @var Type\TypeInterface */ + $this->classMap[$ext] = $this->type[$imageType]; + } + } } diff --git a/vendor/marc1706/fast-image-size/lib/Type/TypeJpeg.php b/vendor/marc1706/fast-image-size/lib/Type/TypeJpeg.php index 9d7392c..7f59966 100644 --- a/vendor/marc1706/fast-image-size/lib/Type/TypeJpeg.php +++ b/vendor/marc1706/fast-image-size/lib/Type/TypeJpeg.php @@ -15,7 +15,7 @@ class TypeJpeg extends TypeBase { /** @var int JPEG max header size. Headers can be bigger, but we'll abort * going through the header after this */ - const JPEG_MAX_HEADER_SIZE = 124576; + const JPEG_MAX_HEADER_SIZE = 786432; // = 768 kiB /** @var string JPEG header */ const JPEG_HEADER = "\xFF\xD8"; @@ -43,17 +43,6 @@ class TypeJpeg extends TypeBase "\xCF" ); - /** @var array JPEG APP markers */ - protected $appMarkers = array( - "\xE0", - "\xE1", - "\xE2", - "\xE3", - "\xEC", - "\xED", - "\xEE", - ); - /** @var string|bool JPEG data stream */ protected $data = ''; diff --git a/vendor/marc1706/fast-image-size/lib/Type/TypeTif.php b/vendor/marc1706/fast-image-size/lib/Type/TypeTif.php index 0e5c301..08aef66 100644 --- a/vendor/marc1706/fast-image-size/lib/Type/TypeTif.php +++ b/vendor/marc1706/fast-image-size/lib/Type/TypeTif.php @@ -14,8 +14,8 @@ namespace FastImageSize\Type; class TypeTif extends TypeBase { /** @var int TIF header size. The header might be larger but the dimensions - * should be in the first 51200 bytes */ - const TIF_HEADER_SIZE = 51200; + * should be in the first 256 kiB bytes */ + const TIF_HEADER_SIZE = 262144; /** @var int TIF tag for image height */ const TIF_TAG_IMAGE_HEIGHT = 257; @@ -23,15 +23,6 @@ class TypeTif extends TypeBase /** @var int TIF tag for image width */ const TIF_TAG_IMAGE_WIDTH = 256; - /** @var int TIF tag for exif IFD offset */ - const TIF_TAG_EXIF_OFFSET = 34665; - - /** @var int TIF tag for Image X resolution in pixels */ - const TIF_TAG_EXIF_IMAGE_WIDTH = 0xA002; - - /** @var int TIF tag for Image Y resolution in pixels */ - const TIF_TAG_EXIF_IMAGE_HEIGHT = 0xA003; - /** @var int TIF tag type for short */ const TIF_TAG_TYPE_SHORT = 3; @@ -77,7 +68,12 @@ class TypeTif extends TypeBase list(, $offset) = unpack($this->typeLong, substr($data, self::LONG_SIZE, self::LONG_SIZE)); // Get size of IFD - list(, $sizeIfd) = unpack($this->typeShort, substr($data, $offset, self::SHORT_SIZE)); + $ifdSizeInfo = substr($data, $offset, self::SHORT_SIZE); + if (empty($ifdSizeInfo)) + { + return; + } + list(, $sizeIfd) = unpack($this->typeShort, $ifdSizeInfo); // Skip 2 bytes that define the IFD size $offset += self::SHORT_SIZE; diff --git a/vendor/ocramius/package-versions/CHANGELOG.md b/vendor/ocramius/package-versions/CHANGELOG.md new file mode 100644 index 0000000..a838c56 --- /dev/null +++ b/vendor/ocramius/package-versions/CHANGELOG.md @@ -0,0 +1,120 @@ +# CHANGELOG + +## 1.1.3 - 2017-09-06 + +This release fixes a bug that caused PackageVersions to prevent +the `composer remove` and `composer update` commands to fail when +this package is removed. + +In addition to that, mutation testing has been added to the suite, +ensuring that the package is accurately and extensively tested. + +Total issues resolved: **3** + +- [40: Mutation testing, PHP 7.1 testing](https://github.com/Ocramius/PackageVersions/pull/40) thanks to @Ocramius +- [41: Removing this package on install results in file access error](https://github.com/Ocramius/PackageVersions/issues/41) thanks to @Xerkus +- [46: #41 Avoid issues when the package is scheduled for removal](https://github.com/Ocramius/PackageVersions/pull/46) thanks to @Jean85 + +## 1.1.2 - 2016-12-30 + +This release fixes a bug that caused PackageVersions to be enabled +even when it was part of a globally installed package. + +Total issues resolved: **3** + +- [35: remove all temp directories](https://github.com/Ocramius/PackageVersions/pull/35) +- [38: Interferes with other projects when installed globally](https://github.com/Ocramius/PackageVersions/issues/38) +- [39: Ignore the global plugin when updating local projects](https://github.com/Ocramius/PackageVersions/pull/39) + +## 1.1.1 - 2016-07-25 + +This release removes the [`"files"`](https://getcomposer.org/doc/04-schema.md#files) directive from +[`composer.json`](https://github.com/Ocramius/PackageVersions/commit/86f2636f7c5e7b56fa035fa3826d5fcf80b6dc72), +as it is no longer needed for `composer install --classmap-authoritative`. +Also, that directive was causing issues with HHVM installations, since +PackageVersions is not compatible with it. + +Total issues resolved: **1** + +- [34: Fatal error during travis build after update to 1.1.0](https://github.com/Ocramius/PackageVersions/issues/34) + +## 1.1.0 - 2016-07-22 + +This release introduces support for running `composer install --classmap-authoritative` +and `composer install --no-scripts`. Please note that performance +while using these modes may be degraded, but the package will +still work. + +Additionally, the package was tuned to prevent the plugin from +running twice at installation. + +Total issues resolved: **10** + +- [18: Fails when using composer install --no-scripts](https://github.com/Ocramius/PackageVersions/issues/18) +- [20: CS (spacing)](https://github.com/Ocramius/PackageVersions/pull/20) +- [22: Document the way the require-dev section is treated](https://github.com/Ocramius/PackageVersions/issues/22) +- [23: Underline that composer.lock is used as source of information](https://github.com/Ocramius/PackageVersions/pull/23) +- [27: Fix incompatibility with --classmap-authoritative](https://github.com/Ocramius/PackageVersions/pull/27) +- [29: mention optimize-autoloader composer.json config option in README](https://github.com/Ocramius/PackageVersions/pull/29) +- [30: The version class is generated twice during composer update](https://github.com/Ocramius/PackageVersions/issues/30) +- [31: Remove double registration of the event listeners](https://github.com/Ocramius/PackageVersions/pull/31) +- [32: Update the usage of mock APIs to use the new API](https://github.com/Ocramius/PackageVersions/pull/32) +- [33: Fix for #18 - support running with --no-scripts flag](https://github.com/Ocramius/PackageVersions/pull/33) + +## 1.0.4 - 2016-04-23 + +This release includes a fix/workaround for composer/composer#5237, +which causes `ocramius/package-versions` to sometimes generate a +`Versions` class with malformed name (something like +`Versions_composer_tmp0`) when running `composer require `. + +Total issues resolved: **2** + +- [16: Workaround for composer/composer#5237 - class parsing](https://github.com/Ocramius/PackageVersions/pull/16) +- [17: Weird Class name being generated](https://github.com/Ocramius/PackageVersions/issues/17) + +## 1.0.3 - 2016-02-26 + +This release fixes an issue related to concurrent autoloader +re-generation caused by multiple composer plugins being installed. +The issue was solved by removing autoloader re-generation from this +package, but it may still affect other packages. + +It is now recommended that you run `composer dump-autoload --optimize` +after installation when using this particular package. +Please note that `composer (install|update) -o` is not sufficient +to avoid autoload overhead when using this particular package. + +Total issues resolved: **1** + +- [15: Remove autoload re-dump optimization](https://github.com/Ocramius/PackageVersions/pull/15) + +## 1.0.2 - 2016-02-24 + +This release fixes issues related to installing the component without +any dev dependencies or with packages that don't have a source or dist +reference, which is usual with packages defined directly in the +`composer.json`. + +Total issues resolved: **3** + +- [11: fix composer install --no-dev PHP7](https://github.com/Ocramius/PackageVersions/pull/11) +- [12: Packages don't always have a source/reference](https://github.com/Ocramius/PackageVersions/issues/12) +- [13: Fix #12 - support dist and missing package version references](https://github.com/Ocramius/PackageVersions/pull/13) + +## 1.0.1 - 2016-02-01 + +This release fixes an issue related with composer updates to +already installed versions. +Using `composer require` within a package that already used +`ocramius/package-versions` caused the installation to be unable +to write the `PackageVersions\Versions` class to a file. + +Total issues resolved: **6** + +- [2: remove unused use statement](https://github.com/Ocramius/PackageVersions/pull/2) +- [3: Remove useless files from dist package](https://github.com/Ocramius/PackageVersions/pull/3) +- [5: failed to open stream: phar error: write operations disabled by the php.ini setting phar.readonly](https://github.com/Ocramius/PackageVersions/issues/5) +- [6: Fix/#5 use composer vendor dir](https://github.com/Ocramius/PackageVersions/pull/6) +- [7: Hotfix - #5 generate package versions also when in phar context](https://github.com/Ocramius/PackageVersions/pull/7) +- [8: Versions class should be ignored by VCS, as it is an install-time artifact](https://github.com/Ocramius/PackageVersions/pull/8) diff --git a/vendor/ocramius/package-versions/CONTRIBUTING.md b/vendor/ocramius/package-versions/CONTRIBUTING.md new file mode 100644 index 0000000..7180617 --- /dev/null +++ b/vendor/ocramius/package-versions/CONTRIBUTING.md @@ -0,0 +1,39 @@ +--- +title: Contributing +--- + +# Contributing + + * Coding standard for the project is [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) + * The project will follow strict [object calisthenics](http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php) + * Any contribution must provide tests for additional introduced conditions + * Any un-confirmed issue needs a failing test case before being accepted + * Pull requests must be sent from a new hotfix/feature branch, not from `master`. + +## Installation + +To install the project and run the tests, you need to clone it first: + +```sh +$ git clone git://github.com/Ocramius/PackageVersions.git +``` + +You will then need to run a composer installation: + +```sh +$ cd PackageVersions +$ curl -s https://getcomposer.org/installer | php +$ php composer.phar update +``` + +## Testing + +The PHPUnit version to be used is the one installed as a dev- dependency via composer: + +```sh +$ ./vendor/bin/phpunit +``` + +Accepted coverage for new contributions is 80%. Any contribution not satisfying this requirement +won't be merged. + diff --git a/vendor/ocramius/package-versions/LICENSE b/vendor/ocramius/package-versions/LICENSE new file mode 100644 index 0000000..a90b079 --- /dev/null +++ b/vendor/ocramius/package-versions/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2016 Marco Pivetta + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/ocramius/package-versions/README.md b/vendor/ocramius/package-versions/README.md new file mode 100644 index 0000000..c9b6103 --- /dev/null +++ b/vendor/ocramius/package-versions/README.md @@ -0,0 +1,60 @@ +# Package Versions + +This utility provides quick and easy access to version information of composer dependencies. + +This information is derived from the ```composer.lock``` file which is (re)generated during ```composer install``` or ```composer update```. + +```php +$version = \PackageVersions\Versions::getVersion('ocramius/package-versions'); + +var_dump($version); // 1.0.0@0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33 +``` + +[![Build Status](https://travis-ci.org/Ocramius/PackageVersions.svg?branch=master)](https://travis-ci.org/Ocramius/PackageVersions) +[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/Ocramius/PackageVersions/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/Ocramius/PackageVersions/?branch=master) +[![Code Coverage](https://scrutinizer-ci.com/g/Ocramius/PackageVersions/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/Ocramius/PackageVersions/?branch=master) +[![Downloads](https://img.shields.io/packagist/dt/ocramius/package-versions.svg)](https://packagist.org/packages/ocramius/package-versions) +[![Packagist](https://img.shields.io/packagist/v/ocramius/package-versions.svg)](https://packagist.org/packages/ocramius/package-versions) +[![Dependencies](https://tidelift.com/badges/github/packagist/ocramius%2Fpackage-versions)](https://tidelift.com/subscription/pkg/packagist-ocramius%2Fpackage-versions?utm_source=packagist-ocramius%2Fpackage-versions&utm_medium=readme) + +### Installation + +```sh +composer require ocramius/package-versions +``` + +It is suggested that you use a optimized composer autoloader in order to prevent +autoload I/O when accessing the `PackageVersions\Versions` API: + +Therefore you should use `optimize-autoloader: true` in your composer.json: +``` +... + "config": { + "optimize-autoloader": true + }, +... +``` +see https://getcomposer.org/doc/06-config.md#optimize-autoloader + +In case you manually generate your autoloader via the CLI use the `--optimize` flag: + +```sh +composer dump-autoload --optimize +``` + +### Use-cases + +This repository implements `PackageVersions\Versions::getVersion()` in such a way that no IO +happens when calling it, because the list of package versions is compiled during composer +installation. + +This is especially useful when you want to generate assets/code/artifacts that are computed from +the current version of a certain dependency. Doing so at runtime by checking the installed +version of a package would be too expensive, and this package mitigates that. + +## Professional Support + +[Professionally supported `ocramius/package-versions` is available through Tidelift](https://tidelift.com/subscription/pkg/packagist-ocramius-package-versions?utm_source=packagist-ocramius-package-versions&utm_medium=referral&utm_campaign=readme). + +You can also contact the maintainer at ocramius@gmail.com for looking into issues related to this package +in your private projects. diff --git a/vendor/ocramius/package-versions/composer.json b/vendor/ocramius/package-versions/composer.json new file mode 100644 index 0000000..2062e76 --- /dev/null +++ b/vendor/ocramius/package-versions/composer.json @@ -0,0 +1,43 @@ +{ + "name": "ocramius/package-versions", + "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "type": "composer-plugin", + "license": "MIT", + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com" + } + ], + "require": { + "php": "^7.1.0", + "composer-plugin-api": "^1.0.0" + }, + "require-dev": { + "phpunit/phpunit": "^7.5.17", + "infection/infection": "^0.7.1", + "composer/composer": "^1.6.3", + "ext-zip": "*", + "doctrine/coding-standard": "^5.0.1" + }, + "autoload": { + "psr-4": { + "PackageVersions\\": "src/PackageVersions" + } + }, + "autoload-dev": { + "psr-4": { + "PackageVersionsTest\\": "test/PackageVersionsTest" + } + }, + "extra": { + "class": "PackageVersions\\Installer", + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "scripts": { + "post-update-cmd": "PackageVersions\\Installer::dumpVersionsClass", + "post-install-cmd": "PackageVersions\\Installer::dumpVersionsClass" + } +} diff --git a/vendor/ocramius/package-versions/composer.lock b/vendor/ocramius/package-versions/composer.lock new file mode 100644 index 0000000..f161dc1 --- /dev/null +++ b/vendor/ocramius/package-versions/composer.lock @@ -0,0 +1,2869 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "content-hash": "8193d241c36d581f93f05282ea504ec5", + "packages": [], + "packages-dev": [ + { + "name": "composer/ca-bundle", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/composer/ca-bundle.git", + "reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/d2c0a83b7533d6912e8d516756ebd34f893e9169", + "reference": "d2c0a83b7533d6912e8d516756ebd34f893e9169", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "ext-pcre": "*", + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", + "psr/log": "^1.0", + "symfony/process": "^2.5 || ^3.0 || ^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\CaBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.", + "keywords": [ + "cabundle", + "cacert", + "certificate", + "ssl", + "tls" + ], + "time": "2018-03-29T19:57:20+00:00" + }, + { + "name": "composer/composer", + "version": "1.6.4", + "source": { + "type": "git", + "url": "https://github.com/composer/composer.git", + "reference": "86ad51e8a3c64c9782446aae740a61fc6faa2522" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/composer/zipball/86ad51e8a3c64c9782446aae740a61fc6faa2522", + "reference": "86ad51e8a3c64c9782446aae740a61fc6faa2522", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "composer/semver": "^1.0", + "composer/spdx-licenses": "^1.2", + "justinrainbow/json-schema": "^3.0 || ^4.0 || ^5.0", + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0", + "seld/cli-prompt": "^1.0", + "seld/jsonlint": "^1.4", + "seld/phar-utils": "^1.0", + "symfony/console": "^2.7 || ^3.0 || ^4.0", + "symfony/filesystem": "^2.7 || ^3.0 || ^4.0", + "symfony/finder": "^2.7 || ^3.0 || ^4.0", + "symfony/process": "^2.7 || ^3.0 || ^4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7", + "phpunit/phpunit-mock-objects": "^2.3 || ^3.0" + }, + "suggest": { + "ext-openssl": "Enabling the openssl extension allows you to access https URLs for repositories and packages", + "ext-zip": "Enabling the zip extension allows you to unzip archives", + "ext-zlib": "Allow gzip compression of HTTP requests" + }, + "bin": [ + "bin/composer" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.6-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\": "src/Composer" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Composer helps you declare, manage and install dependencies of PHP projects, ensuring you have the right stack everywhere.", + "homepage": "https://getcomposer.org/", + "keywords": [ + "autoload", + "dependency", + "package" + ], + "time": "2018-04-13T10:04:24+00:00" + }, + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + }, + { + "name": "composer/spdx-licenses", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/composer/spdx-licenses.git", + "reference": "7e111c50db92fa2ced140f5ba23b4e261bc77a30" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/7e111c50db92fa2ced140f5ba23b4e261bc77a30", + "reference": "7e111c50db92fa2ced140f5ba23b4e261bc77a30", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Spdx\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "SPDX licenses list and validation library.", + "keywords": [ + "license", + "spdx", + "validator" + ], + "time": "2018-01-31T13:17:27+00:00" + }, + { + "name": "dealerdirect/phpcodesniffer-composer-installer", + "version": "v0.5.0", + "source": { + "type": "git", + "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", + "reference": "e749410375ff6fb7a040a68878c656c2e610b132" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132", + "reference": "e749410375ff6fb7a040a68878c656c2e610b132", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": "^5.3|^7", + "squizlabs/php_codesniffer": "^2|^3" + }, + "require-dev": { + "composer/composer": "*", + "phpcompatibility/php-compatibility": "^9.0", + "sensiolabs/security-checker": "^4.1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" + }, + "autoload": { + "psr-4": { + "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Franck Nijhof", + "email": "franck.nijhof@dealerdirect.com", + "homepage": "http://www.frenck.nl", + "role": "Developer / IT Manager" + } + ], + "description": "PHP_CodeSniffer Standards Composer Installer Plugin", + "homepage": "http://www.dealerdirect.com", + "keywords": [ + "PHPCodeSniffer", + "PHP_CodeSniffer", + "code quality", + "codesniffer", + "composer", + "installer", + "phpcs", + "plugin", + "qa", + "quality", + "standard", + "standards", + "style guide", + "stylecheck", + "tests" + ], + "time": "2018-10-26T13:21:45+00:00" + }, + { + "name": "doctrine/coding-standard", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/coding-standard.git", + "reference": "9017efe98b47329cbd895d43f596747c8ef27307" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/coding-standard/zipball/9017efe98b47329cbd895d43f596747c8ef27307", + "reference": "9017efe98b47329cbd895d43f596747c8ef27307", + "shasum": "" + }, + "require": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", + "php": "^7.1", + "slevomat/coding-standard": "^4.8.0", + "squizlabs/php_codesniffer": "^3.3.2" + }, + "type": "phpcodesniffer-standard", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Sniffs\\": "lib/Doctrine/Sniffs" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Steve Müller", + "email": "st.mueller@dzh-online.de" + } + ], + "description": "The Doctrine Coding Standard is a set of PHPCS rules applied to all Doctrine projects.", + "homepage": "https://www.doctrine-project.org/projects/coding-standard.html", + "keywords": [ + "checks", + "code", + "coding", + "cs", + "doctrine", + "rules", + "sniffer", + "sniffs", + "standard", + "style" + ], + "time": "2019-01-31T13:22:30+00:00" + }, + { + "name": "doctrine/instantiator", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/instantiator.git", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "reference": "185b8868aa9bf7159f5f953ed5afb2d7fcdc3bda", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "ext-pdo": "*", + "ext-phar": "*", + "phpunit/phpunit": "^6.2.3", + "squizlabs/php_codesniffer": "^3.0.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marco Pivetta", + "email": "ocramius@gmail.com", + "homepage": "http://ocramius.github.com/" + } + ], + "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", + "homepage": "https://github.com/doctrine/instantiator", + "keywords": [ + "constructor", + "instantiate" + ], + "time": "2017-07-22T11:58:36+00:00" + }, + { + "name": "infection/infection", + "version": "0.7.1", + "source": { + "type": "git", + "url": "https://github.com/infection/infection.git", + "reference": "44751a5835ec44e7f2754ddcf21a2012f8219c23" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/infection/infection/zipball/44751a5835ec44e7f2754ddcf21a2012f8219c23", + "reference": "44751a5835ec44e7f2754ddcf21a2012f8219c23", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^3.0", + "padraic/phar-updater": "^1.0.4", + "php": "^7.0", + "pimple/pimple": "^3.2", + "sebastian/diff": "^1.4 || ^2.0 || ^3.0", + "symfony/console": "^3.2 || ^4.0", + "symfony/finder": "^3.2 || ^4.0", + "symfony/process": "^3.2 || ^4.0", + "symfony/yaml": "^3.2 || ^4.0" + }, + "conflict": { + "symfony/process": "3.4.2" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.1" + }, + "bin": [ + "bin/infection" + ], + "type": "library", + "autoload": { + "psr-4": { + "Infection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Maks Rafalko", + "email": "maks.rafalko@gmail.com", + "homepage": "https://twitter.com/maks_rafalko" + } + ], + "description": "Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.", + "keywords": [ + "coverage", + "mutant", + "mutation framework", + "mutation testing", + "testing", + "unit testing" + ], + "time": "2018-02-02T11:25:42+00:00" + }, + { + "name": "justinrainbow/json-schema", + "version": "5.2.7", + "source": { + "type": "git", + "url": "https://github.com/justinrainbow/json-schema.git", + "reference": "8560d4314577199ba51bf2032f02cd1315587c23" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/justinrainbow/json-schema/zipball/8560d4314577199ba51bf2032f02cd1315587c23", + "reference": "8560d4314577199ba51bf2032f02cd1315587c23", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.1", + "json-schema/json-schema-test-suite": "1.2.0", + "phpunit/phpunit": "^4.8.35" + }, + "bin": [ + "bin/validate-json" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "JsonSchema\\": "src/JsonSchema/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "description": "A library to validate a json schema.", + "homepage": "https://github.com/justinrainbow/json-schema", + "keywords": [ + "json", + "schema" + ], + "time": "2018-02-14T22:26:30+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.7.0", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "reference": "3b8a3a99ba1f6a3952ac2747d989303cbd6b7a3e", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/collections": "^1.0", + "doctrine/common": "^2.6", + "phpunit/phpunit": "^4.1" + }, + "type": "library", + "autoload": { + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + }, + "files": [ + "src/DeepCopy/deep_copy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "time": "2017-10-19T19:58:43+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v3.1.5", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "reference": "bb87e28e7d7b8d9a7fda231d37457c9210faf6ce", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "~4.0|~5.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "time": "2018-02-28T20:30:58+00:00" + }, + { + "name": "padraic/humbug_get_contents", + "version": "1.1.2", + "source": { + "type": "git", + "url": "https://github.com/humbug/file_get_contents.git", + "reference": "dcb086060c9dd6b2f51d8f7a895500307110b7a7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/humbug/file_get_contents/zipball/dcb086060c9dd6b2f51d8f7a895500307110b7a7", + "reference": "dcb086060c9dd6b2f51d8f7a895500307110b7a7", + "shasum": "" + }, + "require": { + "composer/ca-bundle": "^1.0", + "ext-openssl": "*", + "php": "^5.3 || ^7.0 || ^7.1 || ^7.2" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.1", + "mikey179/vfsstream": "^1.6", + "phpunit/phpunit": "^4.8 || ^5.7 || ^6.5" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": false + }, + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Humbug\\": "src/" + }, + "files": [ + "src/function.php", + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Padraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + }, + { + "name": "Théo Fidry", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Secure wrapper for accessing HTTPS resources with file_get_contents for PHP 5.3+", + "homepage": "https://github.com/padraic/file_get_contents", + "keywords": [ + "download", + "file_get_contents", + "http", + "https", + "ssl", + "tls" + ], + "time": "2018-02-12T18:47:17+00:00" + }, + { + "name": "padraic/phar-updater", + "version": "v1.0.6", + "source": { + "type": "git", + "url": "https://github.com/humbug/phar-updater.git", + "reference": "d01d3b8f26e541ac9b9eeba1e18d005d852f7ff1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/humbug/phar-updater/zipball/d01d3b8f26e541ac9b9eeba1e18d005d852f7ff1", + "reference": "d01d3b8f26e541ac9b9eeba1e18d005d852f7ff1", + "shasum": "" + }, + "require": { + "padraic/humbug_get_contents": "^1.0", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Humbug\\SelfUpdate\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + } + ], + "description": "A thing to make PHAR self-updating easy and secure.", + "keywords": [ + "humbug", + "phar", + "self-update", + "update" + ], + "time": "2018-03-30T12:52:15+00:00" + }, + { + "name": "phar-io/manifest", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/2df402786ab5368a0169091f61a7c1e0eb6852d0", + "reference": "2df402786ab5368a0169091f61a7c1e0eb6852d0", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-phar": "*", + "phar-io/version": "^1.0.1", + "php": "^5.6 || ^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "time": "2017-03-05T18:14:27+00:00" + }, + { + "name": "phar-io/version", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/a70c0ced4be299a63d32fa96d9281d03e94041df", + "reference": "a70c0ced4be299a63d32fa96d9281d03e94041df", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "time": "2017-03-05T17:38:23+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", + "shasum": "" + }, + "require": { + "php": ">=5.5" + }, + "require-dev": { + "phpunit/phpunit": "^4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "time": "2017-09-11T18:02:19+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "4.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/94fd0001232e47129dd3504189fa1c7225010d08", + "reference": "94fd0001232e47129dd3504189fa1c7225010d08", + "shasum": "" + }, + "require": { + "php": "^7.0", + "phpdocumentor/reflection-common": "^1.0.0", + "phpdocumentor/type-resolver": "^0.4.0", + "webmozart/assert": "^1.0" + }, + "require-dev": { + "doctrine/instantiator": "~1.0.5", + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^6.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "time": "2017-11-30T07:14:17+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "0.4.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", + "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", + "shasum": "" + }, + "require": { + "php": "^5.5 || ^7.0", + "phpdocumentor/reflection-common": "^1.0" + }, + "require-dev": { + "mockery/mockery": "^0.9.4", + "phpunit/phpunit": "^5.2||^4.8.24" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "time": "2017-07-14T14:27:02+00:00" + }, + { + "name": "phpspec/prophecy", + "version": "1.7.6", + "source": { + "type": "git", + "url": "https://github.com/phpspec/prophecy.git", + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.2", + "php": "^5.3|^7.0", + "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", + "sebastian/comparator": "^1.1|^2.0|^3.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0" + }, + "require-dev": { + "phpspec/phpspec": "^2.5|^3.2", + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "autoload": { + "psr-0": { + "Prophecy\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Konstantin Kudryashov", + "email": "ever.zet@gmail.com", + "homepage": "http://everzet.com" + }, + { + "name": "Marcello Duarte", + "email": "marcello.duarte@gmail.com" + } + ], + "description": "Highly opinionated mocking framework for PHP 5.3+", + "homepage": "https://github.com/phpspec/prophecy", + "keywords": [ + "Double", + "Dummy", + "fake", + "mock", + "spy", + "stub" + ], + "time": "2018-04-18T13:57:24+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "6.0.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "52187754b0eed0b8159f62a6fa30073327e8c2ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/52187754b0eed0b8159f62a6fa30073327e8c2ca", + "reference": "52187754b0eed0b8159f62a6fa30073327e8c2ca", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-xmlwriter": "*", + "php": "^7.1", + "phpunit/php-file-iterator": "^1.4.2", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-token-stream": "^3.0", + "sebastian/code-unit-reverse-lookup": "^1.0.1", + "sebastian/environment": "^3.1", + "sebastian/version": "^2.0.1", + "theseer/tokenizer": "^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-xdebug": "^2.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2018-04-29T14:59:09+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.4.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/730b01bc3e867237eaac355e06a36b85dd93a8b4", + "reference": "730b01bc3e867237eaac355e06a36b85dd93a8b4", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2017-11-27T13:52:08+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "1.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2015-06-21T13:50:34+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b8454ea6958c3dee38453d3bd571e023108c91f", + "reference": "8b8454ea6958c3dee38453d3bd571e023108c91f", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2018-02-01T13:07:23+00:00" + }, + { + "name": "phpunit/php-token-stream", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "reference": "21ad88bbba7c3d93530d93994e0a33cd45f02ace", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2018-02-01T13:16:43+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "7.1.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "ca64dba53b88aba6af32aebc6b388068db95c435" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/ca64dba53b88aba6af32aebc6b388068db95c435", + "reference": "ca64dba53b88aba6af32aebc6b388068db95c435", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "myclabs/deep-copy": "^1.6.1", + "phar-io/manifest": "^1.0.1", + "phar-io/version": "^1.0", + "php": "^7.1", + "phpspec/prophecy": "^1.7", + "phpunit/php-code-coverage": "^6.0.1", + "phpunit/php-file-iterator": "^1.4.3", + "phpunit/php-text-template": "^1.2.1", + "phpunit/php-timer": "^2.0", + "phpunit/phpunit-mock-objects": "^6.1.1", + "sebastian/comparator": "^3.0", + "sebastian/diff": "^3.0", + "sebastian/environment": "^3.1", + "sebastian/exporter": "^3.1", + "sebastian/global-state": "^2.0", + "sebastian/object-enumerator": "^3.0.3", + "sebastian/resource-operations": "^1.0", + "sebastian/version": "^2.0.1" + }, + "require-dev": { + "ext-pdo": "*" + }, + "suggest": { + "ext-xdebug": "*", + "phpunit/php-invoker": "^2.0" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2018-04-29T15:09:19+00:00" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "6.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "70c740bde8fd9ea9ea295be1cd875dd7b267e157" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/70c740bde8fd9ea9ea295be1cd875dd7b267e157", + "reference": "70c740bde8fd9ea9ea295be1cd875dd7b267e157", + "shasum": "" + }, + "require": { + "doctrine/instantiator": "^1.0.5", + "php": "^7.1", + "phpunit/php-text-template": "^1.2.1", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2018-04-11T04:50:36+00:00" + }, + { + "name": "pimple/pimple", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/silexphp/Pimple.git", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", + "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/container": "^1.0" + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2.x-dev" + } + }, + "autoload": { + "psr-0": { + "Pimple": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "Pimple, a simple Dependency Injection Container", + "homepage": "http://pimple.sensiolabs.org", + "keywords": [ + "container", + "dependency injection" + ], + "time": "2018-01-21T07:42:36+00:00" + }, + { + "name": "psr/container", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "time": "2017-02-14T16:28:37+00:00" + }, + { + "name": "psr/log", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10T12:19:37+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7 || ^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "time": "2017-03-04T06:30:41+00:00" + }, + { + "name": "sebastian/comparator", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "ed5fd2281113729f1ebcc64d101ad66028aeb3d5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/ed5fd2281113729f1ebcc64d101ad66028aeb3d5", + "reference": "ed5fd2281113729f1ebcc64d101ad66028aeb3d5", + "shasum": "" + }, + "require": { + "php": "^7.1", + "sebastian/diff": "^3.0", + "sebastian/exporter": "^3.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "time": "2018-04-18T13:33:00+00:00" + }, + { + "name": "sebastian/diff", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/e09160918c66281713f1c324c1f4c4c3037ba1e8", + "reference": "e09160918c66281713f1c324c1f4c4c3037ba1e8", + "shasum": "" + }, + "require": { + "php": "^7.1" + }, + "require-dev": { + "phpunit/phpunit": "^7.0", + "symfony/process": "^2 || ^3.3 || ^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "time": "2018-02-01T13:45:15+00:00" + }, + { + "name": "sebastian/environment", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "reference": "cd0871b3975fb7fc44d11314fd1ee20925fce4f5", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "http://www.github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "time": "2017-07-01T08:51:00+00:00" + }, + { + "name": "sebastian/exporter", + "version": "3.1.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", + "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "ext-mbstring": "*", + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "http://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "time": "2017-04-03T13:19:02+00:00" + }, + { + "name": "sebastian/global-state", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "reference": "e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "suggest": { + "ext-uopz": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "http://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "time": "2017-04-27T15:39:26+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", + "shasum": "" + }, + "require": { + "php": "^7.0", + "sebastian/object-reflector": "^1.1.1", + "sebastian/recursion-context": "^3.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "time": "2017-08-03T12:35:26+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "773f97c67f28de00d397be301821b06708fca0be" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", + "reference": "773f97c67f28de00d397be301821b06708fca0be", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "time": "2017-03-29T09:07:27+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", + "shasum": "" + }, + "require": { + "php": "^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "http://www.github.com/sebastianbergmann/recursion-context", + "time": "2017-03-03T06:23:57+00:00" + }, + { + "name": "sebastian/resource-operations", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/resource-operations.git", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "reference": "ce990bb21759f94aeafd30209e8cfcdfa8bc3f52", + "shasum": "" + }, + "require": { + "php": ">=5.6.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides a list of PHP built-in functions that operate on resources", + "homepage": "https://www.github.com/sebastianbergmann/resource-operations", + "time": "2015-07-28T20:34:47+00:00" + }, + { + "name": "sebastian/version", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", + "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "time": "2016-10-03T07:35:21+00:00" + }, + { + "name": "seld/cli-prompt", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/cli-prompt.git", + "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/cli-prompt/zipball/a19a7376a4689d4d94cab66ab4f3c816019ba8dd", + "reference": "a19a7376a4689d4d94cab66ab4f3c816019ba8dd", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\CliPrompt\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "Allows you to prompt for user input on the command line, and optionally hide the characters they type", + "keywords": [ + "cli", + "console", + "hidden", + "input", + "prompt" + ], + "time": "2017-03-18T11:32:45+00:00" + }, + { + "name": "seld/jsonlint", + "version": "1.7.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/jsonlint.git", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/d15f59a67ff805a44c50ea0516d2341740f81a38", + "reference": "d15f59a67ff805a44c50ea0516d2341740f81a38", + "shasum": "" + }, + "require": { + "php": "^5.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.0" + }, + "bin": [ + "bin/jsonlint" + ], + "type": "library", + "autoload": { + "psr-4": { + "Seld\\JsonLint\\": "src/Seld/JsonLint/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "JSON Linter", + "keywords": [ + "json", + "linter", + "parser", + "validator" + ], + "time": "2018-01-24T12:46:19+00:00" + }, + { + "name": "seld/phar-utils", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/phar-utils.git", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/7009b5139491975ef6486545a39f3e6dad5ac30a", + "reference": "7009b5139491975ef6486545a39f3e6dad5ac30a", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Seld\\PharUtils\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be" + } + ], + "description": "PHAR file format utilities, for when PHP phars you up", + "keywords": [ + "phra" + ], + "time": "2015-10-13T18:44:15+00:00" + }, + { + "name": "slevomat/coding-standard", + "version": "4.8.7", + "source": { + "type": "git", + "url": "https://github.com/slevomat/coding-standard.git", + "reference": "bff96313d8c7c2ba57a4edb13c1c141df8988c58" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/slevomat/coding-standard/zipball/bff96313d8c7c2ba57a4edb13c1c141df8988c58", + "reference": "bff96313d8c7c2ba57a4edb13c1c141df8988c58", + "shasum": "" + }, + "require": { + "php": "^7.1", + "squizlabs/php_codesniffer": "^3.4.0" + }, + "require-dev": { + "jakub-onderka/php-parallel-lint": "1.0.0", + "phing/phing": "2.16.1", + "phpstan/phpstan": "0.9.2", + "phpstan/phpstan-phpunit": "0.9.4", + "phpstan/phpstan-strict-rules": "0.9", + "phpunit/phpunit": "7.5.1" + }, + "type": "phpcodesniffer-standard", + "autoload": { + "psr-4": { + "SlevomatCodingStandard\\": "SlevomatCodingStandard" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.", + "time": "2019-01-03T13:15:50+00:00" + }, + { + "name": "squizlabs/php_codesniffer", + "version": "3.4.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "379deb987e26c7cd103a7b387aea178baec96e48" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/379deb987e26c7cd103a7b387aea178baec96e48", + "reference": "379deb987e26c7cd103a7b387aea178baec96e48", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.4.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + }, + "bin": [ + "bin/phpcs", + "bin/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2018-12-19T23:57:18+00:00" + }, + { + "name": "symfony/console", + "version": "v4.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "3e820bc2c520a87ca209ad8fa961c97f42e0b4ae" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/3e820bc2c520a87ca209ad8fa961c97f42e0b4ae", + "reference": "3e820bc2c520a87ca209ad8fa961c97f42e0b4ae", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0" + }, + "suggest": { + "psr/log-implementation": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Console Component", + "homepage": "https://symfony.com", + "time": "2018-04-30T01:23:47+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v4.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21", + "reference": "5d2d655b2c72fc4d9bf7e9bf14f72a447b940f21", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Filesystem Component", + "homepage": "https://symfony.com", + "time": "2018-02-22T10:50:29+00:00" + }, + { + "name": "symfony/finder", + "version": "v4.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/ca27c02b7a3fef4828c998c2ff9ba7aae1641c49", + "reference": "ca27c02b7a3fef4828c998c2ff9ba7aae1641c49", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Finder Component", + "homepage": "https://symfony.com", + "time": "2018-04-04T05:10:37+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.8.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "3296adf6a6454a050679cde90f95350ad604b171" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", + "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "time": "2018-04-26T10:06:28+00:00" + }, + { + "name": "symfony/process", + "version": "v4.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25", + "reference": "d7dc1ee5dfe9f732cb1bba7310f5b99f2b7a6d25", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Process Component", + "homepage": "https://symfony.com", + "time": "2018-04-03T05:24:00+00:00" + }, + { + "name": "symfony/yaml", + "version": "v4.0.9", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "275ad099e4cbe612a2acbca14a16dd1c5311324d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/275ad099e4cbe612a2acbca14a16dd1c5311324d", + "reference": "275ad099e4cbe612a2acbca14a16dd1c5311324d", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "conflict": { + "symfony/console": "<3.4" + }, + "require-dev": { + "symfony/console": "~3.4|~4.0" + }, + "suggest": { + "symfony/console": "For validating YAML files using the lint command" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.0-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Yaml\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "https://symfony.com", + "time": "2018-04-08T08:49:08+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "reference": "cb2f008f3f05af2893a87208fe6a6c4985483f8b", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "time": "2017-04-07T12:08:54+00:00" + }, + { + "name": "webmozart/assert", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/webmozart/assert.git", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozart/assert/zipball/0df1908962e7a3071564e857d86874dad1ef204a", + "reference": "0df1908962e7a3071564e857d86874dad1ef204a", + "shasum": "" + }, + "require": { + "php": "^5.3.3 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.6", + "sebastian/version": "^1.0.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "time": "2018-01-29T19:49:41+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^7.1.0" + }, + "platform-dev": { + "ext-zip": "*" + } +} diff --git a/vendor/ocramius/package-versions/infection.json.dist b/vendor/ocramius/package-versions/infection.json.dist new file mode 100644 index 0000000..b883a21 --- /dev/null +++ b/vendor/ocramius/package-versions/infection.json.dist @@ -0,0 +1,11 @@ +{ + "timeout": 10, + "source": { + "directories": [ + "src" + ] + }, + "logs": { + "text": "infection-log.txt" + } +} \ No newline at end of file diff --git a/vendor/ocramius/package-versions/phpcs.xml.dist b/vendor/ocramius/package-versions/phpcs.xml.dist new file mode 100644 index 0000000..e169c61 --- /dev/null +++ b/vendor/ocramius/package-versions/phpcs.xml.dist @@ -0,0 +1,21 @@ + + + + + + + + + + + src + test + + + src/PackageVersions/Versions.php + + + + src/PackageVersions/Installer.php + + diff --git a/vendor/ocramius/package-versions/src/PackageVersions/FallbackVersions.php b/vendor/ocramius/package-versions/src/PackageVersions/FallbackVersions.php new file mode 100644 index 0000000..7c20e41 --- /dev/null +++ b/vendor/ocramius/package-versions/src/PackageVersions/FallbackVersions.php @@ -0,0 +1,121 @@ + + */ + private static function getVersions(array $packageData) : Generator + { + foreach ($packageData as $package) { + yield $package['name'] => $package['version'] . '@' . ( + $package['source']['reference'] ?? $package['dist']['reference'] ?? '' + ); + } + + yield self::ROOT_PACKAGE_NAME => self::ROOT_PACKAGE_NAME; + } +} diff --git a/vendor/ocramius/package-versions/src/PackageVersions/Installer.php b/vendor/ocramius/package-versions/src/PackageVersions/Installer.php new file mode 100644 index 0000000..ec8edca --- /dev/null +++ b/vendor/ocramius/package-versions/src/PackageVersions/Installer.php @@ -0,0 +1,201 @@ + 'dumpVersionsClass', + ScriptEvents::POST_UPDATE_CMD => 'dumpVersionsClass', + ]; + } + + /** + * @throws RuntimeException + */ + public static function dumpVersionsClass(Event $composerEvent) : void + { + $composer = $composerEvent->getComposer(); + $rootPackage = $composer->getPackage(); + $versions = iterator_to_array(self::getVersions($composer->getLocker(), $rootPackage)); + + if (! array_key_exists('ocramius/package-versions', $versions)) { + //plugin must be globally installed - we only want to generate versions for projects which specifically + //require ocramius/package-versions + return; + } + + $versionClass = self::generateVersionsClass($rootPackage->getName(), $versions); + + self::writeVersionClassToFile($versionClass, $composer, $composerEvent->getIO()); + } + + /** + * @param string[] $versions + */ + private static function generateVersionsClass(string $rootPackageName, array $versions) : string + { + return sprintf( + self::$generatedClassTemplate, + 'fin' . 'al ' . 'cla' . 'ss ' . 'Versions', // note: workaround for regex-based code parsers :-( + $rootPackageName, + var_export($versions, true) + ); + } + + /** + * @throws RuntimeException + */ + private static function writeVersionClassToFile(string $versionClassSource, Composer $composer, IOInterface $io) : void + { + $installPath = self::locateRootPackageInstallPath($composer->getConfig(), $composer->getPackage()) + . '/src/PackageVersions/Versions.php'; + + if (! file_exists(dirname($installPath))) { + $io->write('ocramius/package-versions: Package not found (probably scheduled for removal); generation of version class skipped.'); + + return; + } + + $io->write('ocramius/package-versions: Generating version class...'); + + $installPathTmp = $installPath . '_' . uniqid('tmp', true); + file_put_contents($installPathTmp, $versionClassSource); + chmod($installPathTmp, 0664); + rename($installPathTmp, $installPath); + + $io->write('ocramius/package-versions: ...done generating version class'); + } + + /** + * @throws RuntimeException + */ + private static function locateRootPackageInstallPath( + Config $composerConfig, + RootPackageInterface $rootPackage + ) : string { + if (self::getRootPackageAlias($rootPackage)->getName() === 'ocramius/package-versions') { + return dirname($composerConfig->get('vendor-dir')); + } + + return $composerConfig->get('vendor-dir') . '/ocramius/package-versions'; + } + + private static function getRootPackageAlias(RootPackageInterface $rootPackage) : PackageInterface + { + $package = $rootPackage; + + while ($package instanceof AliasPackage) { + $package = $package->getAliasOf(); + } + + return $package; + } + + /** + * @return Generator|string[] + */ + private static function getVersions(Locker $locker, RootPackageInterface $rootPackage) : Generator + { + $lockData = $locker->getLockData(); + + $lockData['packages-dev'] = $lockData['packages-dev'] ?? []; + + foreach (array_merge($lockData['packages'], $lockData['packages-dev']) as $package) { + yield $package['name'] => $package['version'] . '@' . ( + $package['source']['reference']?? $package['dist']['reference'] ?? '' + ); + } + + foreach ($rootPackage->getReplaces() as $replace) { + $version = $replace->getPrettyConstraint(); + if ($version === 'self.version') { + $version = $rootPackage->getPrettyVersion(); + } + + yield $replace->getTarget() => $version . '@' . $rootPackage->getSourceReference(); + } + + yield $rootPackage->getName() => $rootPackage->getPrettyVersion() . '@' . $rootPackage->getSourceReference(); + } +} diff --git a/vendor/ocramius/package-versions/src/PackageVersions/Versions.php b/vendor/ocramius/package-versions/src/PackageVersions/Versions.php new file mode 100644 index 0000000..43eafbe --- /dev/null +++ b/vendor/ocramius/package-versions/src/PackageVersions/Versions.php @@ -0,0 +1,116 @@ + 'v1.0.1@4770c7feab370c62e23db4f31c112b7c6d90aee2', + 'google/recaptcha' => '1.2.3@98c4a6573b27e8b0990ea8789c74ea378795134c', + 'guzzlehttp/guzzle' => '6.5.2@43ece0e75098b7ecd8d13918293029e555a50f82', + 'guzzlehttp/promises' => 'v1.3.1@a59da6cf61d80060647ff4d3eb2c03a2bc694646', + 'guzzlehttp/psr7' => '1.6.1@239400de7a173fe9901b9ac7c06497751f00727a', + 'lusitanian/oauth' => 'v0.8.11@fc11a53db4b66da555a6a11fce294f574a8374f9', + 'marc1706/fast-image-size' => 'v1.1.6@3a3a2b036be20f43fa06ce00dfa754df503e6684', + 'ocramius/package-versions' => '1.4.2@44af6f3a2e2e04f2af46bcb302ad9600cba41c7d', + 'ocramius/proxy-manager' => '2.1.1@e18ac876b2e4819c76349de8f78ccc8ef1554cd7', + 'paragonie/random_compat' => 'v9.99.99@84b4dfb120c6f9b4ff7b3685f9b8f1aa365a0c95', + 'patchwork/utf8' => 'v1.3.2@d296e0026e7ce10b2a9fe594feca9628ef00e9e8', + 'psr/container' => '1.0.0@b7ce3b176482dbbc1245ebf52b181af44c2cf55f', + 'psr/http-message' => '1.0.1@f6561bf28d520154e4b0ec72be95418abe6d9363', + 'psr/log' => '1.1.2@446d54b4cb6bf489fc9d75f55843658e6f25d801', + 'ralouphie/getallheaders' => '3.0.3@120b605dfeb996808c31b6477290a714d356e822', + 's9e/regexp-builder' => '1.4.3@59d0167a909659d718f53964f7653d2c83a5f8fe', + 's9e/text-formatter' => '2.3.1@65a0605f163b8ffcf7145357f167b153f31cd168', + 'symfony/config' => 'v3.4.36@a599a867d0e4a07c342b5f1e656b3915a540ddbe', + 'symfony/console' => 'v3.4.36@1ee23b3b659b06c622f2bd2492a229e416eb4586', + 'symfony/debug' => 'v3.4.36@f72e33fdb1170b326e72c3157f0cd456351dd086', + 'symfony/dependency-injection' => 'v3.4.36@0d201916bfb3af939fec3c0c8815ea16c60ac1a2', + 'symfony/event-dispatcher' => 'v3.4.36@f9031c22ec127d4a2450760f81a8677fe8a10177', + 'symfony/filesystem' => 'v3.4.36@00cdad0936d06fab136944bc2342b762b1c3a4a2', + 'symfony/finder' => 'v3.4.36@290ae21279b37bfd287cdcce640d51204e84afdf', + 'symfony/http-foundation' => 'v3.4.36@d2d0cfe8e319d9df44c4cca570710fcf221d4593', + 'symfony/http-kernel' => 'v3.4.36@c42c8339acb28cfff0fb1786948db4d23d609ff7', + 'symfony/polyfill-ctype' => 'v1.13.1@f8f0b461be3385e56d6de3dbb5a0df24c0c275e3', + 'symfony/polyfill-mbstring' => 'v1.13.1@7b4aab9743c30be783b73de055d24a39cf4b954f', + 'symfony/polyfill-php56' => 'v1.13.1@53dd1cdf3cb986893ccf2b96665b25b3abb384f4', + 'symfony/polyfill-php70' => 'v1.13.1@af23c7bb26a73b850840823662dda371484926c4', + 'symfony/polyfill-util' => 'v1.13.1@964a67f293b66b95883a5ed918a65354fcd2258f', + 'symfony/process' => 'v3.4.36@9a4545c01e1e4f473492bd52b71e574dcc401ca2', + 'symfony/proxy-manager-bridge' => 'v3.4.36@3c185a0e45ea13334aaf7b0fa9726922816ebec6', + 'symfony/routing' => 'v3.4.36@b689ccd48e234ea404806d94b07eeb45f9f6f06a', + 'symfony/twig-bridge' => 'v3.4.36@49b824ddc7f2d250a1f172349cd9a111d63287c0', + 'symfony/yaml' => 'v3.4.36@dab657db15207879217fc81df4f875947bf68804', + 'twig/twig' => 'v2.12.2@d761fd1f1c6b867ae09a7d8119a6d95d06dc44ed', + 'zendframework/zend-code' => '3.4.1@268040548f92c2bfcba164421c1add2ba43abaaa', + 'zendframework/zend-eventmanager' => '3.2.1@a5e2583a211f73604691586b8406ff7296a946dd', + 'blackfire/php-sdk' => 'v1.21.0@1aa41771641ac268c5a2a0fc520e0da0e1f6698a', + 'composer/ca-bundle' => '1.2.5@62e8fc2dc550e5d6d8c9360c7721662670f58149', + 'doctrine/instantiator' => '1.3.0@ae466f726242e637cebdd526a7d991b9433bacf1', + 'fabpot/goutte' => 'v3.2.3@3f0eaf0a40181359470651f1565b3e07e3dd31b8', + 'facebook/webdriver' => '1.7.1@e43de70f3c7166169d0f14a374505392734160e5', + 'laravel/homestead' => 'v7.20.0@cae38adcfdde1de1c4581e7a33872adaf9fbf926', + 'michelf/php-markdown' => '1.9.0@c83178d49e372ca967d1a8c77ae4e051b3a3c75c', + 'myclabs/deep-copy' => '1.9.4@579bb7356d91f9456ccd505f24ca8b667966a0a7', + 'nikic/php-parser' => 'v3.1.5@bb87e28e7d7b8d9a7fda231d37457c9210faf6ce', + 'phar-io/manifest' => '1.0.3@7761fcacf03b4d4f16e7ccb606d4879ca431fcf4', + 'phar-io/version' => '2.0.1@45a2ec53a73c70ce41d55cedef9063630abaf1b6', + 'phing/phing' => '2.16.1@cbe0f969e434e269af91b4160b86fe899c6e07c7', + 'phpdocumentor/reflection-docblock' => '2.0.5@e6a969a640b00d8daa3c66518b0405fb41ae0c4b', + 'phpspec/prophecy' => '1.10.1@cbe1df668b3fe136bcc909126a0f529a78d4cbbc', + 'phpunit/dbunit' => '4.0.0@e77b469c3962b5a563f09a2a989f1c9bd38b8615', + 'phpunit/php-code-coverage' => '6.1.4@807e6013b00af69b6c5d9ceb4282d0393dbb9d8d', + 'phpunit/php-file-iterator' => '2.0.2@050bedf145a257b1ff02746c31894800e5122946', + 'phpunit/php-text-template' => '1.2.1@31f8b717e51d9a2afca6c9f046f5d69fc27c8686', + 'phpunit/php-timer' => '2.1.2@1038454804406b0b5f5f520358e78c1c2f71501e', + 'phpunit/php-token-stream' => '3.1.1@995192df77f63a59e47f025390d2d1fdf8f425ff', + 'phpunit/phpunit' => '7.5.18@fcf6c4bfafaadc07785528b06385cce88935474d', + 'pimple/pimple' => 'v3.2.3@9e403941ef9d65d20cba7d54e29fe906db42cf32', + 'sami/sami' => 'v4.1.2@19b8a82b858bd31544c468317c8307188ccb4022', + 'sebastian/code-unit-reverse-lookup' => '1.0.1@4419fcdb5eabb9caa61a27c7a1db532a6b55dd18', + 'sebastian/comparator' => '3.0.2@5de4fc177adf9bce8df98d8d141a7559d7ccf6da', + 'sebastian/diff' => '3.0.2@720fcc7e9b5cf384ea68d9d930d480907a0c1a29', + 'sebastian/environment' => '4.2.3@464c90d7bdf5ad4e8a6aea15c091fec0603d4368', + 'sebastian/exporter' => '3.1.2@68609e1261d215ea5b21b7987539cbfbe156ec3e', + 'sebastian/global-state' => '2.0.0@e8ba02eed7bbbb9e59e43dedd3dddeff4a56b0c4', + 'sebastian/object-enumerator' => '3.0.3@7cfd9e65d11ffb5af41198476395774d4c8a84c5', + 'sebastian/object-reflector' => '1.1.1@773f97c67f28de00d397be301821b06708fca0be', + 'sebastian/recursion-context' => '3.0.0@5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8', + 'sebastian/resource-operations' => '2.0.1@4d7a795d35b889bf80a0cc04e08d77cedfa917a9', + 'sebastian/version' => '2.0.1@99732be0ddb3361e16ad77b68ba41efc8e979019', + 'squizlabs/php_codesniffer' => '3.5.3@557a1fc7ac702c66b0bbfe16ab3d55839ef724cb', + 'symfony/browser-kit' => 'v3.4.36@2e4c991e27a97a8c27745720b030ff85a5cebdf6', + 'symfony/css-selector' => 'v3.4.36@f819f71ae3ba6f396b4c015bd5895de7d2f1f85f', + 'symfony/dom-crawler' => 'v3.4.36@6bcffd2eabc4ca087faaaf54e26c8ff3a40284f3', + 'theseer/tokenizer' => '1.1.3@11336f6f84e16a720dae9d8e6ed5019efa85a0f9', + 'phpbb/phpbb-core' => '3.3.x-dev@8d00784dfe2c8bcb10843ff70b4cfa998d703285', + 'phpbb/phpbb' => '3.3.x-dev@8d00784dfe2c8bcb10843ff70b4cfa998d703285', +); + + private function __construct() + { + } + + /** + * @throws \OutOfBoundsException If a version cannot be located. + */ + public static function getVersion(string $packageName) : string + { + if (isset(self::VERSIONS[$packageName])) { + return self::VERSIONS[$packageName]; + } + + throw new \OutOfBoundsException( + 'Required package "' . $packageName . '" is not installed: check your ./vendor/composer/installed.json and/or ./composer.lock files' + ); + } +} diff --git a/vendor/ocramius/proxy-manager/CHANGELOG.md b/vendor/ocramius/proxy-manager/CHANGELOG.md new file mode 100644 index 0000000..5d2dfb2 --- /dev/null +++ b/vendor/ocramius/proxy-manager/CHANGELOG.md @@ -0,0 +1,375 @@ +--- +title: Changelog +--- + +This is a list of changes/improvements that were introduced in ProxyManager + +## 2.1.1 + +This release provides aggressive improvements in static introspection via +[phpstan/phpstan](https://github.com/phpstan/phpstan). No functional +changes, just removed possible bugs due to excessive parameter count +in method calls, as well as test type hint fixes. + +Total issues resolved: **3** + +- [351: Travis already has xdebug pre-installed for PHP 7.1](https://github.com/Ocramius/ProxyManager/pull/351) +- [358: Fix #351 - travis has xdebug pre-installed for PHP 7.1](https://github.com/Ocramius/ProxyManager/pull/358) +- [361: PHPStan inspection fixes](https://github.com/Ocramius/ProxyManager/pull/361) + +## 2.1.0 + +### Improved + +- Introduced support for PHP 7.1, `void` and nullable (`?`) + types [#314](https://github.com/Ocramius/ProxyManager/issues/314) + [#327](https://github.com/Ocramius/ProxyManager/pull/327) +- The test suite is now fully CI-covered by mutation testing [#348](https://github.com/Ocramius/ProxyManager/pull/348) +- Moved all performance testing to PHPBench [#326](https://github.com/Ocramius/ProxyManager/pull/326) +- PHP 7.0 support dropped [#327](https://github.com/Ocramius/ProxyManager/pull/327) + +Total issues resolved: **9** + +- [290: Branch-alias version bump: master bump to 3.0.x](https://github.com/Ocramius/ProxyManager/pull/290) +- [314: Nullable params type](https://github.com/Ocramius/ProxyManager/issues/314) +- [326: Moved performance tests to phpbench-based suite](https://github.com/Ocramius/ProxyManager/pull/326) +- [327: PHP 7.1 support](https://github.com/Ocramius/ProxyManager/pull/327) +- [336: Hotfix tests for php 7 support](https://github.com/Ocramius/ProxyManager/pull/336) +- [339: Provided type ?... is invalid](https://github.com/Ocramius/ProxyManager/issues/339) +- [343: Fix typo in ghost objects lazy loading code example](https://github.com/Ocramius/ProxyManager/pull/343) +- [348: Introduced full mutation testing](https://github.com/Ocramius/ProxyManager/pull/348) +- [349: install xdebug manually for php 7.1](https://github.com/Ocramius/ProxyManager/pull/349) + +## 2.0.4 + +### Fixed + +- Remove deprecated `getMock` usage from tests [#325](https://github.com/Ocramius/ProxyManager/pull/325) +- Fix incorrect type in docs example [#329](https://github.com/Ocramius/ProxyManager/pull/329) +- Bug when proxy `__get` magic method [#344](https://github.com/Ocramius/ProxyManager/pull/344) +- Fix lazy loading value holder magic method support [#345](https://github.com/Ocramius/ProxyManager/pull/345) + +## 2.0.3 + +### Fixed + +- Various test suite cleanups, mostly because of + [new PHPUnit 5.4.0 deprecations being introduced](https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-5.4.0) + [#318](https://github.com/Ocramius/ProxyManager/issues/318) +- Removed `zendframework/zend-code:3.0.3` from installable dependencies, since + a critical bug was introduced in it [#321](https://github.com/Ocramius/ProxyManager/issues/321) + [#323](https://github.com/Ocramius/ProxyManager/issues/323) + [#324](https://github.com/Ocramius/ProxyManager/issues/324). Please upgrade to + `zendframework/zend-code:3.0.4` or newer. + +## 2.0.2 + +### Fixed + +- Various optimizations were performed in the [`ocramius/package-versions`](https://github.com/Ocramius/PackageVersions) + integration in order to prevent "class not found" fatals. [#294](https://github.com/Ocramius/ProxyManager/issues/294) +- Null objects produced via a given class name were not extending from the given class name, causing obvious LSP + compliance and type-compatibility issues. [#300](https://github.com/Ocramius/ProxyManager/issues/300) + [#301](https://github.com/Ocramius/ProxyManager/issues/301) +- Specific installation versions were removed from the [README.md](README.md) install instructions, since composer + is installing the latest available version by default. [#305](https://github.com/Ocramius/ProxyManager/issues/305) +- PHP 7.0.6 support was dropped. PHP 7.0.6 includes some nasty reflection bugs that caused `__isset` to be called when + `ReflectionProperty#getValue()` is used (https://bugs.php.net/72174). + [#306](https://github.com/Ocramius/ProxyManager/issues/306) + [#308](https://github.com/Ocramius/ProxyManager/issues/308) +- PHP 7.0.7 contains additional limitations as to when `$this` can be used. Specifically, `$this` cannot be used as a + parameter name for closures that have an already assigned `$this`. Due to `$this` being incorrectly used as parameter + name within this library, running ProxyManager on PHP 7.0.7 would have caused a fatal error. + [#306](https://github.com/Ocramius/ProxyManager/issues/306) + [#308](https://github.com/Ocramius/ProxyManager/issues/308) + [#316](https://github.com/Ocramius/ProxyManager/issues/316) +- PHP 7.1.0-DEV includes type-checks for incompatible arithmetic operations: some of those operations were erroneously + performed in the library internals. [#308](https://github.com/Ocramius/ProxyManager/issues/308) + +## 2.0.1 + +### Fixed + +- Travis-CI environment was fixed to test the library using the minimum dependencies version. + +### Added + +- Added unit test to make sure that properties skipped should be preserved even being cloned. + +## 2.0.0 + +### BC Breaks + +Please refer to [the upgrade documentation](UPGRADE.md) to see which backwards-incompatible +changes were applied to this release. + +### New features + +#### PHP 7 support + +ProxyManager will now correctly operate in PHP 7 environments. + +#### PHP 7 Return type hints + +ProxyManager will now correctly mimic signatures of methods with return type hints: + +```php +class SayHello +{ + public function hello() : string + { + return 'hello!'; + } +} +``` + +#### PHP 7 Scalar type hints + +ProxyManager will now correctly mimic signatures of methods with scalar type hints + +```php +class SayHello +{ + public function hello(string $name) : string + { + return 'hello, ' . $name; + } +} +``` + +#### PHP 5.6 Variadics support + +ProxyManager will now correctly mimic behavior of methods with variadic parameters: + +```php +class SayHello +{ + public function hello(string ...$names) : string + { + return 'hello, ' . implode(', ', $names); + } +} +``` + +By-ref variadic arguments are also supported: + +```php +class SayHello +{ + public function hello(string ... & $names) + { + foreach ($names as & $name) { + $name = 'hello, ' . $name; + } + } +} +``` + +#### Constructors in proxies are not replaced anymore + +In ProxyManager v1.x, the constructor of a proxy was completely replaced with a method +accepting proxy-specific parameters. + +This is no longer true, and you will be able to use the constructor of your objects as +if the class wasn't proxied at all: + +```php +class SayHello +{ + public function __construct() + { + echo 'Hello!'; + } +} + +/* @var $proxyGenerator \ProxyManager\ProxyGenerator\ProxyGeneratorInterface */ +$proxyClass = $proxyGenerator->generateProxy( + new ReflectionClass(SayHello::class), + new ClassGenerator('ProxyClassName') +); + +eval('generate()); + +$proxyName = $proxyClass->getName(); +$object = new ProxyClassName(); // echoes "Hello!" + +var_dump($object); // a proxy object +``` + +If you still want to manually build a proxy (without factories), a +`public static staticProxyConstructor` method is added to the generated proxy classes. + +#### Friend classes support + +You can now access state of "friend objects" at any time. + +```php +class EmailAddress +{ + private $address; + + public function __construct(string $address) + { + assertEmail($address); + + $this->address = $address; + } + + public function equalsTo(EmailAddress $other) + { + return $this->address === $other->address; + } +} +``` + +When using lazy-loading or access-interceptors, the `equalsTo` method will +properly work, as even `protected` and `private` access are now correctly proxied. + +#### Ghost objects now only lazy-load on state-access + +Lazy loading ghost objects now trigger lazy-loading only when their state is accessed. +This also implies that lazy loading ghost objects cannot be used with interfaces anymore. + +```php +class AccessPolicy +{ + private $policyName; + + /** + * Calling this method WILL cause lazy-loading, when using a ghost object, + * as the method is accessing the object's state + */ + public function getPolicyName() : string + { + return $this->policyName; + } + + /** + * Calling this method WILL NOT cause lazy-loading, when using a ghost object, + * as the method is not reading any from the object. + */ + public function allowAccess() : bool + { + return false; + } +} +``` + +#### Faster ghost object state initialization + +Lazy loading ghost objects can now be initialized in a more efficient way, by avoiding +reflection or setters: + +```php +class Foo +{ + private $a; + protected $b; + public $c; +} + +$factory = new \ProxyManager\Factory\LazyLoadingGhostFactory(); + +$proxy = $factory-createProxy( + Foo::class, + function ( + GhostObjectInterface $proxy, + string $method, + array $parameters, + & $initializer, + array $properties + ) { + $initializer = null; + + $properties["\0Foo\0a"] = 'abc'; + $properties["\0*\0b"] = 'def'; + $properties['c'] = 'ghi'; + + return true; + } +); + + +$reflectionA = new ReflectionProperty(Foo::class, 'a'); +$reflectionA->setAccessible(true); + +var_dump($reflectionA->getValue($proxy)); // dumps "abc" + +$reflectionB = new ReflectionProperty(Foo::class, 'b'); +$reflectionB->setAccessible(true); + +var_dump($reflectionB->getValue($proxy)); // dumps "def" + +var_dump($proxy->c); // dumps "ghi" +``` + +#### Skipping lazy-loaded properties in generated proxies + +Lazy loading ghost objects can now skip lazy-loading for certain properties. +This is especially useful when you have properties that are always available, +such as identifiers of entities: + +```php +class User +{ + private $id; + private $username; + + public function getId() : int + { + return $this->id; + } + + public function getUsername() : string + { + return $this->username; + } +} + +/* @var $proxy User */ +$proxy = (new \ProxyManager\Factory\LazyLoadingGhostFactory())->createProxy( + User::class, + function ( + GhostObjectInterface $proxy, + string $method, + array $parameters, + & $initializer, + array $properties + ) { + $initializer = null; + + var_dump('Triggered lazy-loading!'); + + $properties["\0User\0username"] = 'Ocramius'; + + return true; + }, + [ + 'skippedProperties' => [ + "\0User\0id", + ], + ] +); + +$idReflection = new \ReflectionProperty(User::class, 'id'); + +$idReflection->setAccessible(true); +$idReflection->setValue($proxy, 123); + +var_dump($proxy->getId()); // 123 +var_dump($proxy->getUsername()); // "Triggered lazy-loading!", then "Ocramius" +``` + +#### Proxies are now always generated on-the-fly by default + +Proxies are now automatically generated any time you require them: no configuration +needed. If you want to gain better performance, you may still want to read +the [tuning for production docs](docs/tuning-for-production.md). + +#### Proxy names are now hashed, simplified signature is attached to them + +Proxy classes now have shorter names, as the parameters used to generate them are +hashed into their name. A signature is attached to proxy classes (as a private static +property) so that proxy classes aren't re-used across library updates. +Upgrading ProxyManager will now cause all proxies to be re-generated automatically, +while the old proxy files are going to be ignored. diff --git a/vendor/ocramius/proxy-manager/README.md b/vendor/ocramius/proxy-manager/README.md index c377830..830ae4c 100644 --- a/vendor/ocramius/proxy-manager/README.md +++ b/vendor/ocramius/proxy-manager/README.md @@ -1,8 +1,8 @@ # Proxy Manager -This library aims at providing abstraction for generating various kinds of [proxy classes](http://marco-pivetta.com/proxy-pattern-in-php/). +This library aims at providing abstraction for generating various kinds of [proxy classes](http://ocramius.github.io/presentations/proxy-pattern-in-php/). -![ProxyManager](proxy-manager.png) +![ProxyManager](https://raw.githubusercontent.com/Ocramius/ProxyManager/917bf1698243a1079aaa27ed8ea08c2aef09f4cb/proxy-manager.png) [![Build Status](https://travis-ci.org/Ocramius/ProxyManager.png?branch=master)](https://travis-ci.org/Ocramius/ProxyManager) [![Code Coverage](https://scrutinizer-ci.com/g/Ocramius/ProxyManager/badges/coverage.png?s=ca3b9ceb9e36aeec0e57569cc8983394b7d2a59e)](https://scrutinizer-ci.com/g/Ocramius/ProxyManager/) @@ -19,14 +19,19 @@ This library aims at providing abstraction for generating various kinds of [prox ## Documentation -You can learn about the proxy pattern and how to use the **ProxyManager** on the [online documentation](http://ocramius.github.io/ProxyManager). +You can learn about the proxy pattern and how to use the **ProxyManager** in the [docs](docs), which are also +[compiled to HTML](http://ocramius.github.io/ProxyManager). + +## Help/Support + +[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Ocramius/ProxyManager?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) ## Installation The suggested installation method is via [composer](https://getcomposer.org/): ```sh -php composer.phar require ocramius/proxy-manager:1.0.* +php composer.phar require ocramius/proxy-manager ``` ## Proxy example @@ -37,9 +42,9 @@ Here's how you build a lazy loadable object with ProxyManager using a *Virtual P $factory = new \ProxyManager\Factory\LazyLoadingValueHolderFactory(); $proxy = $factory->createProxy( - 'MyApp\HeavyComplexObject', + \MyApp\HeavyComplexObject::class, function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) { - $wrappedObject = new HeavyComplexObject(); // instantiation logic here + $wrappedObject = new \MyApp\HeavyComplexObject(); // instantiation logic here $initializer = null; // turning off further lazy initialization } ); diff --git a/vendor/ocramius/proxy-manager/STABILITY.md b/vendor/ocramius/proxy-manager/STABILITY.md index 6da8cb6..bd2a3c9 100644 --- a/vendor/ocramius/proxy-manager/STABILITY.md +++ b/vendor/ocramius/proxy-manager/STABILITY.md @@ -1,10 +1,14 @@ +--- +title: Stability +--- + This is a list of supported versions, with their expected release/support time-frames: -# 0.5.x +# 2.0.x - * Release date: 2013-12-01 - * Bug fixes: till 2015-03-11 - * Security fixes: till 2015-12-11 + * Release date: 2016-01-30 + * Bug fixes: till 2017-12-31 + * Security fixes: till 2018-12-31 # 1.0.x @@ -12,8 +16,8 @@ This is a list of supported versions, with their expected release/support time-f * Bug fixes: till 2015-12-11 * Security fixes: till 2016-12-11 -# 2.0.x +# 0.5.x - * Release date: TBA - * Bug fixes: TBA - * Security fixes: TBA + * Release date: 2013-12-01 + * Bug fixes: till 2015-03-11 + * Security fixes: till 2015-12-11 diff --git a/vendor/ocramius/proxy-manager/UPGRADE.md b/vendor/ocramius/proxy-manager/UPGRADE.md index d0de61d..bee4e2a 100644 --- a/vendor/ocramius/proxy-manager/UPGRADE.md +++ b/vendor/ocramius/proxy-manager/UPGRADE.md @@ -1,5 +1,38 @@ +--- +title: Upgrade +--- + This is a list of backwards compatibility (BC) breaks introduced in ProxyManager: +# 2.0.0 + + * PHP `~7.0` is now required to use ProxyManager + * HHVM compatibility is not guaranteed, as HHVM is not yet PHP 7 compliant + * All classes and interfaces now use [strict scalar type hints](http://php.net/manual/en/functions.arguments.php#functions.arguments.type-declaration). + If you extended or implemented anything from the `ProxyManager\` namespace, you probably need to change + that code to adapt it to the new signature. + * All classes and interfaces now use [return type declarations](http://php.net/manual/en/functions.returning-values.php#functions.returning-values.type-declaration). + If you extended or implemented anything from the `ProxyManager\` namespace, you probably need to change + that code to adapt it to the new signature. + * ProxyManager will no longer write proxies to disk by default: + the [`EvaluatingGeneratorStrategy`](src/GeneratorStrategy/EvaluatingGeneratorStrategy.php) is used instead. + If you still want ProxyManager to write files to disk, please refer to the [tuning for production docs](docs/tuning-for-production.md) + * Ghost objects were entirely rewritten, for better support and improved performance. Lazy-loading is not + triggered by public API access, but by property access (private and public). While this is not really a BC + break, you are encouraged to check your applications if you rely on [ghost objects](docs/lazy-loading-ghost-object.md). + * If ProxyManager can't find a proxy, it will now automatically attempt to auto-generate it, regardless of + the settings passed to it. + * `ProxyManager\Configuration#setAutoGenerateProxies()` was removed. Please look for calls to this method and + remove them. + * Private properties are now also correctly handled by ProxyManager: accessing proxy state via friend classes + (protected or private scope) does not require any particular workarounds anymore. + * `ProxyManager\Version::VERSION` was removed. Please use `ProxyManager\Version::getVersion()` instead. + * PHP 4 style constructors are no longer supported + +# 1.0.0 + +`1.0.0` is be fully compatible with `0.5.0`. + # 0.5.0 * The Generated Hydrator has been removed - it is now available as a separate project diff --git a/vendor/ocramius/proxy-manager/composer.json b/vendor/ocramius/proxy-manager/composer.json index 0c5d206..4510413 100644 --- a/vendor/ocramius/proxy-manager/composer.json +++ b/vendor/ocramius/proxy-manager/composer.json @@ -15,24 +15,30 @@ { "name": "Marco Pivetta", "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" + "homepage": "http://ocramius.github.io/" } ], "require": { - "php": ">=5.3.3", - "zendframework/zend-code": ">2.2.5,<3.0" + "php": "^7.1.0", + "zendframework/zend-code": "^3.1.0", + "ocramius/package-versions": "^1.1.1" }, "require-dev": { - "ext-phar": "*", - "phpunit/phpunit": "~4.0", - "squizlabs/php_codesniffer": "1.5.*" + "ext-phar": "*", + "phpunit/phpunit": "^5.6.4", + "phpunit/phpunit-mock-objects": "^3.4.1", + "squizlabs/php_codesniffer": "^2.7.0", + "couscous/couscous": "^1.5.2", + "phpbench/phpbench": "^0.12.2", + "phpstan/phpstan": "^0.6.4", + "nikic/php-parser": "^3.0.4", + "humbug/humbug": "dev-master@DEV" }, "suggest": { - "zendframework/zend-stdlib": "To use the hydrator proxy", "ocramius/generated-hydrator": "To have very fast object to array to object conversion for ghost objects", - "zendframework/zend-xmlrpc": "To have the XmlRpc adapter (Remote Object feature)", - "zendframework/zend-json": "To have the JsonRpc adapter (Remote Object feature)", - "zendframework/zend-soap": "To have the Soap adapter (Remote Object feature)" + "zendframework/zend-xmlrpc": "To have the XmlRpc adapter (Remote Object feature)", + "zendframework/zend-json": "To have the JsonRpc adapter (Remote Object feature)", + "zendframework/zend-soap": "To have the Soap adapter (Remote Object feature)" }, "autoload": { "psr-0": { @@ -41,13 +47,14 @@ }, "autoload-dev": { "psr-0": { + "ProxyManagerBench\\": "tests", "ProxyManagerTest\\": "tests", "ProxyManagerTestAsset\\": "tests" } }, "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "3.0.x-dev" } } } diff --git a/vendor/ocramius/proxy-manager/doc-template/css/highlight.dark.css b/vendor/ocramius/proxy-manager/doc-template/css/highlight.dark.css new file mode 100644 index 0000000..b2f3725 --- /dev/null +++ b/vendor/ocramius/proxy-manager/doc-template/css/highlight.dark.css @@ -0,0 +1,125 @@ +/* + Copyright (c) 2006, Ivan Sagalaev + All rights reserved. + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of highlight.js nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +.hljs { + display: block; + overflow-x: auto; + padding: 0.5em; + background: #444; + -webkit-text-size-adjust: none; +} + +.hljs-keyword, +.hljs-literal, +.hljs-change, +.hljs-winutils, +.hljs-flow, +.nginx .hljs-title, +.tex .hljs-special { + color: white; +} + +.hljs, +.hljs-subst { + color: #ddd; +} + +.hljs-string, +.hljs-title, +.hljs-type, +.ini .hljs-title, +.hljs-tag .hljs-value, +.css .hljs-rules .hljs-value, +.hljs-preprocessor, +.hljs-pragma, +.ruby .hljs-symbol, +.ruby .hljs-symbol .hljs-string, +.ruby .hljs-class .hljs-parent, +.hljs-built_in, +.django .hljs-template_tag, +.django .hljs-variable, +.smalltalk .hljs-class, +.hljs-javadoc, +.ruby .hljs-string, +.django .hljs-filter .hljs-argument, +.smalltalk .hljs-localvars, +.smalltalk .hljs-array, +.hljs-attr_selector, +.hljs-pseudo, +.hljs-addition, +.hljs-stream, +.hljs-envvar, +.apache .hljs-tag, +.apache .hljs-cbracket, +.tex .hljs-command, +.hljs-prompt, +.coffeescript .hljs-attribute { + color: #d88; +} + +.hljs-comment, +.hljs-annotation, +.hljs-decorator, +.hljs-pi, +.hljs-doctype, +.hljs-deletion, +.hljs-shebang, +.apache .hljs-sqbracket, +.tex .hljs-formula { + color: #777; +} + +.hljs-keyword, +.hljs-literal, +.hljs-title, +.css .hljs-id, +.hljs-phpdoc, +.hljs-dartdoc, +.hljs-type, +.vbscript .hljs-built_in, +.rsl .hljs-built_in, +.smalltalk .hljs-class, +.diff .hljs-header, +.hljs-chunk, +.hljs-winutils, +.bash .hljs-variable, +.apache .hljs-tag, +.tex .hljs-special, +.hljs-request, +.hljs-status { + font-weight: bold; +} + +.coffeescript .javascript, +.javascript .xml, +.tex .hljs-formula, +.xml .javascript, +.xml .vbscript, +.xml .css, +.xml .hljs-cdata { + opacity: 0.5; +} diff --git a/vendor/ocramius/proxy-manager/doc-template/css/main.css b/vendor/ocramius/proxy-manager/doc-template/css/main.css new file mode 100644 index 0000000..040851d --- /dev/null +++ b/vendor/ocramius/proxy-manager/doc-template/css/main.css @@ -0,0 +1,179 @@ +html { font-family: sans-serif; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; } +body { margin: 0; } +[hidden], template { display: none; } +a { background: transparent; } +a:active, a:hover { outline: 0; } +h1 { font-size: 2em; margin: 0.67em 0; } +img { border: 0; } +svg:not(:root) { overflow: hidden; } +figure { margin: 1em 40px; } +hr { -moz-box-sizing: content-box; box-sizing: content-box; height: 0; } +pre { overflow: auto; } +code, kbd, pre, samp { font-family: 'Menlo', 'Monaco', monospace; font-size: 1em; } +button, input, optgroup, select, textarea { color: inherit; font: inherit; margin: 0; } +button { overflow: visible; } +button, select { text-transform: none; } +button, html input[type="button"], input[type="reset"], input[type="submit"] { -webkit-appearance: button; cursor: pointer; } +h1, h2, h3, h4, h5, h6, p, ul, ol, li { margin: 0; padding: 0; line-height: normal; } +a { color: #31811D; text-decoration: none; } +a:hover { color: #2F611C; text-decoration: none; } +h3 { margin-bottom: 1em; color: #17324f; font-weight: 400; font-size: 3em; } +h4 { margin-bottom: 1em; font-weight: 400; font-size: 1.375em; } +p { margin-bottom: 1.5em; font-size: 1.125em; } +hr { margin: 2.5em 0; padding: 0; width: 100%; height: 3px; border: 0; background: #e6eaef; } +pre code { border-radius: 4px; font-size: 15px; padding: 20px; border: 1px solid #EBEBEB; } +.content h1 { padding-bottom: 12px; border-bottom: 1px solid #EFEFEF; margin-bottom: 20px; } +.main-nav ul li{ position: relative;} +.main-nav ul li{ position: relative;} +.main-nav ul li:hover { background: #2F611C;} +.main-nav ul li:hover > ul { display:block } +.main-nav ul li > ul { display:none; position: absolute; list-style: none; width: 100%; z-index: 9;} +.main-nav ul li > ul li a { color: #BFE5F1; display: block; background: #2F611C; padding: 20px;} +.main-nav ul li > ul li a:hover { background: #1C440C;} + +/* Menu Sidebar*/ +.button-block { padding-top: 15px; } +.button-block .btn-1 { margin-right: 6px; } +.btn, .spy-nav a { position: relative; display: inline-block; margin: 0; padding: 0 20px; height: 57px; border: 0; vertical-align: top; text-align: center; text-transform: uppercase; font-weight: 400; font-size: 1.125em; transitionP: all .2s; line-height: 57px; } +.btn.btn-action, .spy-nav a.btn-action { background: #ee2d4d; color: #fff; } +.btn.btn-action:hover, .spy-nav a.btn-action:hover { background: #bf0f2d; } +.btn.btn-default, .spy-nav a { background: #31811D; color: #fff; } +.btn.btn-default:hover, .spy-nav a:hover { background: #2F611C; color: #fff; } +.btn.btn-text, .spy-nav a.btn-text { color: #18324f; font-weight: 600; } +.btn.btn-full, .spy-nav a { display: block; } +@media only screen and (max-width: 480px) { + .site-header{ position: fixed !important; top: 0; z-index: 999999} + .page-title-wrapper{ margin-top: 70px;} + .main-wrapper iframe{ width: 42% !important; float: left; margin-left: 8%;} + .content iframe{width: 100%; height: 100%;} +} + +.btn-top { position: relative; display: inline-block; float: right; margin: 20px 0 0; padding: 0 30px 0 50px; height: 57px; border: 2px solid #31811D; color: #31811D; vertical-align: top; text-align: center; text-transform: uppercase; font-weight: 600; font-size: 1.125em; line-height: 53px; transition: all .2s; } +.btn-top:before { background-position: 0 -140px; width: 52px; height: 52px; position: absolute; top: 0; left: 0; content: ''; } +@media only screen and (min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2) { .btn-top:before { background-position: 0 -140px; background-size: 152px auto; width: 52px; height: 52px; } } +.btn-top:hover { border-color: #2F611C; color: #2F611C; } +@media only screen and (max-width: 768px) { .btn-top { float: none; margin-top: 0; margin-bottom: 30px; white-space: nowrap; } } +@media only screen and (max-width: 480px) { .btn-top { font-size: 0.9em; line-height: 46px; height: 48px; padding-right: 22px; padding-left: 47px; } } + +.btn-download { float: right; padding-left: 50px; } +.btn-download:before { background-position: -18px -116px; width: 16px; height: 16px; position: absolute; top: 50%; left: 20px; margin-top: -7px; content: ''; } +@media only screen and (min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2) { .btn-download:before { background-position: -18px -116px; background-size: 152px auto; width: 16px; height: 16px; } } + +.btn-done { float: right; padding-left: 50px; } +.btn-done:before { background-position: 0 -116px; width: 18px; height: 14px; position: absolute; top: 50%; margin-top: -7px; left: 20px; content: ''; } +@media only screen and (min-resolution: 2dppx), (-webkit-min-device-pixel-ratio: 2) { .btn-done:before { background-position: 0 -116px; background-size: 152px auto; width: 18px; height: 13.5px; margin-top: -6.75px; } } + +.btn-cancel { float: right; } + +*, *:before, *:after { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } + +html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; min-width: 280px; } +@media only screen and (min-width: 64.063em) and (max-width: 90em) { html { min-width: 960px; } } + +body { font-size: 16px; font-family: 'Source Sans Pro', sans-serif; min-width: 290px; } +@media only screen and (max-width: 480px) { body.page-home { background-image: none; } } + +img { max-width: 100%; height: auto !important; } + +input { -webkit-appearance: none; -webkit-border-radius: 0; border-radius: 0; } + +main { overflow: hidden; } + +.clearfix:after { content: ""; display: table; clear: both; } + +.container { width: 60em; margin-left: auto; margin-right: auto; } +.container:after { content: " "; display: block; clear: both; } +@media only screen and (max-width: 1024px) { .container { margin-left: 15px; margin-right: 15px; width: auto; } } + +.content ul { padding-left: 19px; list-style-type: square; margin-top: 15px; } + +/* Menu top */ +.main-nav { float: right; } +.fixed-wrapper .main-nav { display: none; } +.active .main-nav { display: block; } +.main-nav > ul { list-style: none; } +.main-nav > ul > li { float: left; } +.main-nav > ul > li > a { display: block; padding: 22px 30px; color: #fff; text-decoration: none; text-transform: uppercase; font-weight: 600; font-size: 1.375em; line-height: 29px; transition: all .2s; } +.main-nav > ul > li > a:hover { color: #bfe5f1; background-color: #2F611C; } +.main-nav > ul > li > a.active { background-color: #2F611C; color: #fff; } +.main-nav > ul > li > a.opened { background-color: #18324f; } +@media only screen and (max-width: 600px) { .main-nav { font-size: 0.86em; } + .main-nav > ul > li > a { padding-left: 18px; padding-right: 18px; } } +@media only screen and (max-width: 480px) { .main-nav > ul > li > a { font-size: 0.95em; padding: 22px 6px; } } + +.site-header { position: relative; width: 100%; background: #31811D; } +.site-header h1 { float: left; margin: 15px 0; } +.site-header h1 a { display: block; } +.site-header h1 img { display: block; max-height: 42px; } +@media only screen and (max-width: 480px) { .site-header h1 img { max-height: 42px; } } + +.page-title-wrapper { position: relative; padding: 26px 0 55px; text-align: center; } +.page-title-wrapper .page-title { margin-top: 44px; color: #17324f; font-weight: 400; font-size: 3.75em; } +.page-title-wrapper .linguistics { padding: 0 2em 13px; border-bottom: 1px solid #D4DBE3; color: #18324f; text-transform: uppercase; font-weight: 400; font-size: 1.25em; } +@media only screen and (max-width: 768px) { .page-title-wrapper { font-size: 0.8em; } } +@media only screen and (max-width: 480px) { .page-title-wrapper { font-size: 0.65em; } } + +.site-footer { margin-top: 20px; padding-top: 50px; padding-bottom: 50px; background: #18324f; color: #7c8ea3; text-align: center; } +.site-footer .container { position: relative; } +.footer-logos ul li{ list-style: none; display: inline-block;} +.footer-logos ul li a{ padding-left: 10px; padding-right: 10px} +.site-footer a{ color: white !important;} +.site-footer p { text-align: left; display: block; margin-bottom: 1.5em; font-size: 1.125em; } +@media only screen and (max-width: 1024px) { .site-footer p { margin-left: 0; } } +@media only screen and (max-width: 768px) { .site-footer p { text-align: center; margin-left: auto; } } +@media only screen and (max-width: 600px) { .site-footer { font-size: 0.9em; } } + +.main-logo { display: block; float: left; margin: 30px 0; } +.fixed-wrapper .main-logo { display: none; } +.main-logo img { display: block; } +.main-logo figure { position: relative; margin: 0; max-width: 56px; } +.main-logo figcaption { position: absolute; width: 160px; top: 20px; left: 68px; } +.active .main-logo { display: block; margin: 0; } +.active .main-logo figure { max-width: 42px; } +.active .main-logo figcaption { width: 120px; top: 15px; left: 55px; } +@media only screen and (max-width: 480px) { .main-logo figcaption { display: none; } } + +.container { width: 60em; margin-left: auto; margin-right: auto; } +.container:after { content: " "; display: block; clear: both; } +@media only screen and (max-width: 1024px) { .container { margin-left: 15px; margin-right: 15px; width: auto; } } + +.component-demo { position: relative; padding: 1px 0 0; background: #e6eaef; } +.component-demo:before { background-image: url("../img/enf.png"); } +@media only screen and (max-width: 480px) { .component-demo { padding: 40px 0 0; } } + +.component-info .container { position: relative; } +.component-info .sidebar { width: 220px; float: left; margin-top: 75px; } +.component-info .sidebar .component-meta { margin-top: 10px; font-size: 1.125em; } +.component-info .sidebar .component-meta span { white-space: nowrap; margin-bottom: 10px; padding-left: 25px; color: #18324f; } +.component-info .sidebar.sticky { position: fixed; margin-top: 38px; } +.component-info .content { width: 64.58333333%; float: right; margin-top: 60px; margin-bottom: 75px; } +.component-info .content h3 { margin-bottom: .75em; font-size: 2.75em; } +.component-info .content p { margin-bottom: 1.75em; line-height: 1.45; } +@media only screen and (max-width: 480px) { .component-info .content .section-title { font-size: 2.1em; } } +@media only screen and (max-width: 768px) { .component-info .sidebar { float: none; margin-left: auto; margin-right: auto; } + .component-info .sidebar .component-meta { margin-top: 30px; text-align: center; } + .component-info .sidebar.sticky { position: relative; margin-top: 75px; } + .component-info .content { float: none; width: 100%; } } +@media only screen and (max-width: 480px) { .component-info .content { margin-bottom: 0; } } + +.spy-nav { margin-bottom: 10px; } +.spy-nav ul { list-style: none; } +.spy-nav a { padding-top: 9px; padding-bottom: 10px; height: auto; border-bottom: 1px solid #4B8B20; text-align: left; text-transform: none; font-size: 1.375em; line-height: normal; } +.spy-nav .active a { border-bottom-color: #fff; background: #fff; color: #17324f; } +.spy-nav select{ width: 100%; margin-bottom: 10px} + +.main-wrapper { margin: 44px auto 44px; max-width: 600px; } +.main-wrapper label { display: block; margin-bottom: .75em; color: #3f4e5e; font-size: 1.25em; } +.main-wrapper .text-field { padding: 0 15px; width: 100%; height: 40px; border: 1px solid #CBD3DD; font-size: 1.125em; } +.main-wrapper ::-webkit-input-placeholder { color: #CBD3DD; font-style: italic; font-size: 18px; } +.main-wrapper :-moz-placeholder { color: #CBD3DD; font-style: italic; font-size: 18px; } +.main-wrapper ::-moz-placeholder { color: #CBD3DD; font-style: italic; font-size: 18px; } +.main-wrapper :-ms-input-placeholder { color: #CBD3DD; font-style: italic; font-size: 18px; } + +.page-icon-wrapper:before, .page-icon-wrapper .logo-asp:before, .page-icon-wrapper .logo-hibernate:before, .page-icon-wrapper .logo-angularjs:before, .page-icon-wrapper .logo-requirejs:before, .page-icon-wrapper .logo-reward:before, .component-demo:before {background-repeat: no-repeat; background-size: 100%; width: 92px; height: 108px; position: absolute; left: 50%; margin-left: -46px; top: 0; bottom: auto; margin-top: -28px; content: ''; } + +.container { width: 60em; margin-left: auto; margin-right: auto; } +.container:after { content: " "; display: block; clear: both; } +@media only screen and (max-width: 1024px) { .container { margin-left: 15px; margin-right: 15px; width: auto; } } + +.bcms-clearfix:after {content: ""; visibility: hidden; display: block; height: 0; clear: both; } diff --git a/vendor/ocramius/proxy-manager/doc-template/default.twig b/vendor/ocramius/proxy-manager/doc-template/default.twig new file mode 100644 index 0000000..63b8f93 --- /dev/null +++ b/vendor/ocramius/proxy-manager/doc-template/default.twig @@ -0,0 +1,117 @@ + + + + ProxyManager Documentation{% if title is defined %} - {{ title }}{% endif %} + + + + + + + + + + + + + + +

      +
      +
      +
      + +

      Proxy Manager

      +
      +
      + +
      +
      +
      + + + + +
      +
      +
      +
      +
      +
      + + + +
      + {% block content %} + + {{ content|raw }} + + {% endblock %} +
      +
      +
      +
      +
      + + +
      + + diff --git a/vendor/ocramius/proxy-manager/doc-template/favicon.ico b/vendor/ocramius/proxy-manager/doc-template/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..797ca03ca2873c95b28747e923d3a77a57784f0d GIT binary patch literal 173246 zcmeI52Y?mD{m1u?13?t9Au8&rC`!G4bismHP_Y-VV6P}DhzJ}Vu7f2Qjj={!Vu{h1 z#2$@N6T1isR{*=luCd_%{XgG%JLmFvWna0w2fTsr?Y`Ze+28!;_nkhoj+4bd=MIOz zxz62pWIJ6Q$Jra`@+hF|#?@v!%eHh3f)_G>ue|a~N0>Z$vNLVkG#z*1_j%v}@B(-k zOaQslr%yM}a&C?p?PWBO(ZGhQ0r6P8*Kx{}DVuRT1Uv-(2Lc{^&-r6u49|7o*pv@! zxUtVjp3%Ujsevo5xWc*o^2-hPCr+H01)qz+ufV6k%lpvt&$xdZ7zA>FGilN!r>3T6 z(^O<8))@_KKpGHNFSy_W!&%kk`Q053Uj>$fP_9S&UC;BgK<@0>vz@E1x=Qs2XX@0c z8;~|KqGmL(X=q^P%$cTbuX0~ph4d+ZZ@^m;eT6xj{x_BZ$Tt($8-IA!ucyW82-2CXxbI(SID@G z1~M9Gc@3O>_Sw#?S+h)?TzmxCpbw}4?}2#u?f2P_33my+&nKVJ`%J#0I)~Z@8JE#O zMguLQf$Ofj&Tvolad_AjTnd%~zg$k{xwm=GRIoEJa;T3$ZIF!1Xdt73=F@=6S(o#w zgLeVP!oerO_aGTg$Lm*p3jYLS!8W$vf%E2zd?w_K1~yR*sP9efZSf2KYg}$HxC?v( z;^l5CpVvHs`@sG{eGj((aT86cOtdo^NUa9MDPiv1xjOa)m0%4>mdENJRGZ=J6omCY zVO$IPRaRDJDX&tUpscJcwaUnZmeIf_paJpb+H0>hyoXadZVS!_FN6OB$#VY{g-5+& zH;&_h#tDB0$%d=^eTUivPl98>7IxlHrY?}QX=DP}h&2FL zn#S|SjvcExyT#xJ@Ht49lV1|X9boX)S6|(Rqj{IheN)fiJPQu^R88cDKXdo^PXe=L2n(|(CW%!Z{t_CYWvK;)LFl<@enRD~5#fuj=joFKr z8dGrB2I~DC!D#R(NJX8afpF&19_ZorVVJ%Fy))x78rW1dpt0N;=3O{H4LlE0 z(H4IbZciYrrna~prwgZZjp3{9!ShBQ{B8qh&*As0DUe5f77FKF!rhLed5_+g$p^xv zM&{batO0BP?r}4Y8b7-qd7DW9pCd<5VBe+Clj{{q)my+y~49 z?}B7y`<5{Nf-Iwe`Zi3xN8_6rm(jq+t^wJ*2WsQ@2aCZ+AX#o{9PjsF1ZXQBt8CRV z5vTmZf^h7dgWC!F3y`d=T4#I{C?v0G>W@%9km)B(B(*Yr(p>}Cx|jPq@cVM`21u4m zKM}@rU>yAEqIJKj=c_M)wf{+}Mf_JCLU{<`D?iv09LxC=;0KVb?C%i9bg;8z=4kSq zq=e3R&S)UbG$0WrT4R{Mc{i+U5*`~R%+EeFFkc#@V_VKv^9_H~5 zvldU>*Sp?(@4aS=9^-hXZlU@>d3m|oFIsb01vLLJ*}Uu_IS+a65?adY8E0l1}l`cp-AA zudpreAI|w7faVz_n-6?U7&U~Mcl`0kD~~bp(=p>R8c1gih=+p8N1!>o7l2nlvg3L3 z{~vG`P`KtjsT{NJw(AuYLl=66UxN!vMe+QZin=B9N2yZs|$!>1jJFV)(io5bV#og7z&Ya6F z2g$}=eT>h5u7pl zpVL4iNVd$=oLkMk9izGgN7Lsfd*2Y8#_v@=yJd9;mM8UU*?seHS}aoA-3^0#F-08T-~8**C#OaA$j)zu0oMx#O0~ z@Wo5%iMSXL2lZK~@8Ttpte&Lfmk9F$bhNE)6DZ%|dMcxl2`i%kqk#htJka!aFIcd^ zlsS|)D%VDWKZ9>TGQ5{xm1`O!*jsCVWz%X~sE>U^cQ*f;FkyoDsddJ)Ks`uSXX;z| z8yL+y%sS&abLKe82m1EyyP>NsBY&D`K;^K2or#wkkLnAq1s{QAZCH87U0?)xissnb zzJxT1eQLx|9-ur;@uO~_wZNsEt8XI}b0O?p;(Yo?v-KW})JUHRWmDCFwOh6KvDNNi z3Rnh`<-O+qJ&m0n&(ZX2b2N6lG3#3Tw0SA<-2xm5)YqZ1JXxKtB#ap#*R5-q{AOd; zXC`jVqXFB0rE-LFS$3*%?I*!nkgT09CyYsOVMogawU>3iDLAb&e){RB4L8w)j_Mn@ z7`z752a=3_l|Gt(a60&02{m7c*iv5U>?XaC;oZk&nF|X|d!dXO~ z(uck=GiO)%%ckt4XF=a6Mb|w!uLSA~NhS}FU#*3_4;(se?yBE%&j*?Xi~&!RsK|aVpJ$)w;G*z}D8zbE;EU(V5m6KMgboFqu49ZHnbU`x19oJ%DqAb*0Gs+Eg^4akYytzPQN_ z;J@bC90eW+$=aK2^=&W>?4oi_kX@@^D&rz+Kze%h)mM$aR6jyzJD|hMfYt&elLyGJ z@?*^v(9aDPwEXM)urS)04fd``hbXiMRsF{XL)lLUsP*;LIuz*og4o!peq= zhs|DGOJ>flY(;jN zs8fBvkUBEuex;lC9 zX8b+?+zV3CH=uEXeU!dx6SRgCABGPft~}s$@ZCnrf8_-)64zZhHcK6Vbkw@KWZH>p zBWiByd2qg~%6ZOBIh0J9Z*8imX1P;P-l+0_82nhh5p!Ss|B^b+@g?*F^j+LwRgmye z{Vm?P{-lTc22Ka++xZzJQy-|pzu9XfVF45LXzRmpLcDkpc+1Rp>kdt%nCS>az6=hfm0cn=o}${V(X8|v@# z)|WTd^QQ}{8oCu!QwOM78K=e~KTbNCHkk5cup7VUf_H$@F_C;=DdB9V@LJNz{>6We zIpPKQ32bbf4~@?X;#{hBfW|me=}7xT%YN;`Mr24*dpY(f1&spu1e0}lOR zLU+!e0vl_2A1+=?iEsY`<_DG3`kxmR$u86e&_2jYAJR(wGMzYTKBx9zO?2O}ck!!v zN0DBe^6R$jhXWnp{mq*Y_mu~H21e5ka85n-)Rc`0l75Ng{a!y`6NcuCjljNgWMir5 z_fsEOan<`-@L(eNeiP$=fN{>6!kYTF#Wju2(ZBm4VJ;~xG&bm_i|T46;1-bV-Xd!V zqec0@eiCXqe5 zN^6vzY&y1|1-d~$y+&piho0Dnp|JcvB;wqGH0l|)eT!|&U1;+zCe8wtfHdA=v`$#=t??h&E|hV zvVH#E^lnl9WB1N}`|YRl|6JgAyia3iJ(O?YCo5f`@*7!p0#5>!>ubUPx##*F4X<*4 zcf~0cc>p%yP197JYmMNOU<~%RrN)TW20iPnvz%D-Mhh3Natg6^xN;zP&nIU-V4Pqm zC-2RxLl5WcI@JBod3gTyng1nx%=+BZw_#dJMOqdL}~KV40d7dLr1M8yA@k3 z#V*ZyKetS3dcXH%VAX1~4yK?+b71QK2qKk>-s_qVR6&11JM|f)iz{YbUq1bJ$Tk{$ z>c-_Qj%w3f1pen<^Ts9I`M+2ju#@6e6d@0=Iz`ti@3mKu=KTE{d0lSi$K1L|ALM$=jmIY(4@K4kIsVtZ7A;=7 z*FZRf@MGpcClj}3v=6VXHSnH!poe!pN~qjDX20g-EnJ~F{^Q`rH$M5Hvb0xW4P1NR z`OqL+<@dmWt5svSn*M8!;t4hjOWfzq< zIQvZfPg9%@JM1vi*Q)xJyEaGT`ZK^v;MIR~oVN)7#eLa1_Kw*PY4FJpaq1xX6VkzX z)+V<{wpw88`@iOVGvcQ)jbDLS+_(2{BW_#pd{WW#X(vDOT(WIP%`^EoI0tARnrWlj z`J<}eYOW911$%$iCpUg1ub41$+?!7B{a-o-(^n^@i&S{-M?8vI%fI*hr7HW+1Gb!h zg7Y0!j&l^ofGB zBb7;;a9E0mc#2G&knKJ<9%}nfV?4i&@&)AqAe(DbfbAEE#(&*=6m)a_CM2Jabe7#b zgspYsSPE_d$&MW>Osyqb0tzNyIVJn3Ie${wp9df6d~$*{v-L;k(N|a;p0~!W!uhD%bl<%RxKczqM zprdEs@620Jo<(}}MR&@RQ?ag3dB>e#DB*VIsQDbR@{4BWzuNuSwy*>ckBPB@>^^ABMROIoFt_pZI>y zbC<9WLYBfw#Q8{P*}=ouh542o=UafI!QF#3vWTjob38 zS9Z*2|F2@k4Aa34t6AohvWHJWkk@P6xHPi2&oH%bN~?qO`3K(>p!}x}P*qPpQLlVL z;{u_45BK}QlV{%1cgmHME<;3^wq|dOk=5I5fTXnL#eT3bt{1+E`_39;F zOaQWTKYVx=f4lOm87oW&n~*FnaydQ&6c3GGo~F6X{rdHDKKtx5BdXRkYd;g>a0>Uo za-WSA?>BjVZ=OwPPLPju4&}cY%g3L_l`jQa`xlGjQSVQ=a`I27&A4%Sam5P1?O}1N zRC{KXrpb6;f!T+Uc70X7)+*iR@>%8of}#a=ZHmg7%S+y1T|Tm#`aoqv51x71eLfuL zz1O}wapql(=sOjAu)aw+lfe$Q|ByUh{MWc)tMXsmmpud7we2U5#e*+-cAVzNs;o^1 zcl6Omn=yLiQoVjEQ2j*lxR3IBE0x*D9CJ*QsGf1o&OGx6_t{wS*8OVc1GZJX1zpT?*rO#YGzd@hfUYt9H3+bZ>afR${aKMUy+5ze({Lb|gCGHJ@ z5er@nTrzbo`kU<0p|3Qw&wofdT~B%6m-60>$*OP4?jP3L{8t$${)4vIbtSO<c;=3+}~52+O_N}D^9B( z?fyh?y&G~p>GD{7zTn)89%ByB`rMbmCG+ZOyQm&euW`bMU4K#aK>iXqcGe#Q^qKh5 zttTz?y^wpr{&3%X^GEr&V4d=Tbl|^i7`s7{`5V8x0W%LUtZ>W+E2dpQzo+~jil5J2zY%pIJq=m-YT&%9tBw9* z>6rUk-~A#O2fw?(eN%rs_uO+$x_RYF2mZ_Uv3b>h?*_5TJ$t_ve;PwidOnO-AIY3s z{u76Tfi1`1;k=*ZjKqDtQ*-*<{muIE{F}hWGurWM-g%N_71^MJ`$UKKcI_8$W((_-1Zd;byk%-*_)eL+g*CAUA8l|A|6 z9u9kxQHQVZ4c>6&{0vTyE`i%4XS@^h6$S7=zoLF~{NCXDkExH*a~=s?G3Dxrx^?xg zc|g-imtF1N%gV2{E-0L9P5!(6UbfwT5;p&>PrH8uK50Ik)3ayKaM5b6>Q4;-(6n=$+94?5@|(}vM}Vf;)4Ke}N=Oe?HCxgtMMFS~DTr!fn)?cKRPXCR-=#}udTz?Yn!evlpU z^E8OXece|cGs)&L?c2AHsSa!+Rv8kr{11JJ@&T1IZhb&|PmTf)fTq1BRCXOU=dXUb zFFxGB_c1!CpS>te=J_+fSLMFy_xp1E(B*9%^N~u`uJ6CZ-+F{SuVr3eCF6z*S8C1T zG+^_Qi1~op0VC)CgTB+5q)$^{;CJZwFW_*}puN&Tefui={kYcTKXxl#wBe}vFMi9r zr^q+D$#1&!`AN^pho}SWiCq5%;-$v?k5|1wy!PwxWBLy{9tS=Le)52KcrMTHyRem% z^I!23{{`8f>YE(5;az8fmni$!s_Yt2zRWNG8{kv{ywKcvzv^q&=d>0_{AZuOPRPaD zV^e0Y&-ultOb22L)!UFoO!y03%t$#c7k z@0^=&tSArm>spKdw!X|!?OoeX9?RCnhZAhQ!EYR!`#EG%-COzCOt2Ox9`}$Zs87RJ z*>7dEdcmLO4c-Z2>BQc@hWb$3f`WpW`671GEc~}|&~eeCMJ68@H+HNuZStkNUU+qR z?Sb>3{mEyapVq%zUA(9+TYYKi;>7=cweN_tW5Ji=Blr(_!mg52{Eycam9KL8U2E12 zoK9F;`x}-2YBvpA_|ng3Pg{J$)X5Wjy!haahW8g-aDn+wd%W*&4gRa#7KgF*_Sknk z>tF7`&lZ*=@y4||o>#d~9E1|E8i-trnh9qbF2uHNKY0uruYaC=Vh?>I@A8}e95Eg(d842C9tmZ2 zMLp|so7O66yzk7S`O6i*gv3$4p|t_j8@A&3Ky3b-{DC<}4f8uM4rHG=^LA(K>{}Ch zw>-55|7D+UTX_`r{UNYrShSb&42O1Ex)(LuC*UlG|t<5nnSk$+t&P`NKt9=>xzq8 zPLDw@yN>@&uJ_cvM9O{}3C$x?T*2PJ?|06=Y{MJS69*U=(mlX~*~c&8G>AHDdNN za9{dbxf$VI3u5Jw_WtkkD_3?ZNMb&8OY>j0Db8SEg_Q#WUS;<`e$`3ozTr$ij>fmB?((i#5S zx75a%3~U=C8vk|gX}G_mzLlI;8-HHZQvBaxhaF6L$+}hblb3;?KrCC<{YT-`b{tLK zkrHJm8Hm>JxMjcU=C8Q%Fne=IPSp+i_wS$NTY}z|=ed0)-Zn-oz11T}NjUB+)aK-W zcH8z&>7q4GKkbE6RevJ(Y5U1z+3|9C)~9$uoinH`@%C&=l9AmM+#lXm#u-(7>KSO?`~9^rk-5NrM;EXCtT6rbDN= z{-;abAK7i$ud#^t+_*Gy94r~tE=aXg zxY7adCPsxV ztN&-#@FCM~#N&COJWTEFasBCYFYz(QH<1??Xl)RA0MLHOc8*c3{8RU@p*_+rZxP=P z{M3J6WJ~a0^fJ`VkK$57-j?4k#W!!_B#jY33-7 z&B1@k?dE}Yj*-Sg{OIrz{B@IG%?q-wx%gkie!SY3kGZ;iu*bK7AG=ixG`gYKP#q(D>9U8xMMtajWapHF{(o*D0J&=}TY zU^x@ZcJF3w-|6cpx)sMtp z{gzqp(w8=ja?2^YHa*(>eWyI-6w}{Nzn{h~ehqB?wWx3T>YRT1R?!0gbNmyvg)QIw zns0y5p074*j9>T2VdV*T)O^HKix;kR^5?wn>($N4f0c>Yo**vE4rAG>?rToK8M0T7 zX|b=D`Vbczi=&t^FBP z@pjzeD9`q^9nHDQ#Axf+iVhsbx_}QHKAy(6(bim8Sheaqz&C2% zX^eixj2SJ~KdC+jaTpzGj}hN}DLg+!{v>ZI`Cn2^ANj1M&H&19cyb!}*5ypN^2vMc zb?mffF?Cgq`K5!?eC2%VBFyQb4!zDdd@k!#*_fq#DsSF0U!sZ&a>{cBc%W~+>3WYm zR<20LyLeXX6jI86=jfLx`?Y?hZg)8IPoLb^w>~B~CF30@Z;I1*-fJzUzeq1CnY+{} zVZ49)Cn#?#>(2o;AA6ebl~oyrXLdy`h;{ZZgg;3c5>B7XzpNy{#J#yeL` zY3ru1`o0G8+`VA+kbOsdH+cU;0)vhiA1Ik{N1$+Fq;=Hf3k#R87+l~=-_7^M0>>VEY=A!Q0PkN1hucr|E;H=APu$$^;6Ta5dyvuF z4rmAzPktyc_<+Mm@37prcJMl3=K-@{limM!+_-T8WU$YycSNoqsjFPsyLazw$t$NY zIM@8#zkv1p_`IfdGnZ2@G2wBZHb*y2#vzkU#}~P_i}F38wVc)GH!;af%PvDs|XLe-&kh^KenleA?dxs2B-l2K#P5Bk)=K|SQWO<|CTZP|?z!6|f z8sSJ}5%*sNird%V)Yj&{3^6}H-_{dlFDHR7fgkZtWupEck0TwFCL@5K{#n(R$I7NW{J)iJG18Jcz`@4_ie|mQ zm_TDNuH*%S4jbo}|9{{eTT#Zt)v!OKE(8wYrdafZobL0)4^3q;Bv;nFHJ4# zFQM=6I%KlzeAth(Ay?}eRL_aW$v%Mk!#?tnCTn@-XxWp>6wZY*5WOEw_5Y*J4HV6N z?Uy+L^!*Jy_F}*Mui|}e>DPA_ELhNydcfVZzx{CY8)Vy0@@j6L#xD4M1MuTF(lZ*P zxE9O;>Mu(68q!4_L)G`o05dKXQ6kzMR#&@};=YtLo*fk}FTNpu8i zCu@u`)_Wt}SH1sCY*~Hks!ya1s1s@a(qy1MO3D8q=mH##p|+M&{-g9m4$bNK6Nsc+ z@Ab7jSDPySEAE=NUs}6Ld*j^T^2Sd+;5PDrEj4eTKzrcF3HAtaifdM-9>Fn*{fWni zZd~da+bFVf`b}$Fj&oEyS>x{BH1M9Q&*lu)$Yg2EV9b~?rVfD3i3b-0+vog?AC3PJ z-oO*CShw%bLKjz9i*@7`3Ze`;RIO_D1KJdfY*KsKE=kdA=ldIl(ds{fp(`Ca0_>fo*6#C_Qe zvYm=N@vH^NOC|qHYqiIx8OJMtGs}GD0blXlG5L%g7O=)%b6i{7nX!Mf*N54IuNwK( z2dKR4X7Z;F`PD0(Ubp#Mqad4s!w&Unl^rJlmGPn6Sjn|Z$j3VMM*R@klIptlx8JvI7MHe;AUDjL&@qlM`Mds@{ex~OW zfaKJ;dK>AFV{4m)d4FDBo~@UihHMFP+SN`z>s9+))0hoc)TZ~l=Ko37(RM9jy?aTT%>PwezewvCD(ZU?5AQyo zql@RRaC+Uj+S!+Hcl&W}`WQRLR(kRK3UCwnEtn2Ut*y)6tvlj~BW%9z9C_Ty&d|Yw zdN7`UX6c!gt4c1sIZ!tcicau-Bs0ieesk>Iu9K@uz>fB2NS_5yr&m!_AHeh z{5G$&{HIK~+m;LPJ8<&JCkObJy#alM0bS$1=KuBg&i}LJkdD~p=Db5~fl8n;jK!cD zd;wzFr|z!+MG8xKN;)`wmrr>Sa%nD?#!MvVT4bC?UY*_2<-cUnJ4r{ik){EgzsJ(= z6QqsCq*Ka&rBNRI*L)u80XxB)e*r&jfbV(k(t=;D$~NoWXQs!uJx>}Ia7JAAljbyN zE`a7KD=vR!UoJCW(P_Bcw^_=L_uO+&Q_iZN4E=A;wT_gTSxN_`CD+1+H+1MQr|`r% z&X7~4I0cJ798*}m>c60=uiup`oSxrdJ!M|$?3c0GAkXy3=KHHY zVCVk3*TT;KS2zk^@fF~14)5xSownn+1@~?NvFy{{zmYJ^9AJf+4$j7nqsDYs1IgNe zoJAasUhR61=9X9WO6i#Q7K4?*>Mh#wGyEK-`Bh4Po6pBM`uhH-jj#5^C}sUWcBy$Z zwhuj=eR{7k7SPbUh`n?M-t>kIs#T9A>_bw>+JEW+I}(p4T%P>^r_L{)@|sg}&Bt-e zr*^&4%<@p@%%zPQ&VV`W1!($5>XfHG?#kiSUAS}2Tb#=Nt69Aku`cVJYEw^F+d^qC zgt~D2k75@Q`LA$QX6qf^ckL{TCbp9DN@+9h@5n#Y62m)n{xRZsb}= zd%wA5Rk<(z0*&|G=#j(96X~eE3Af~VlQvP(*RJ!@F)scO;G5UlE0b?vX|K#b__SBG zv1^z^+*W%Bq>IycJk{Puwqw9&Zd_QeSih(CDqx@fW*3!w(J8Gl`>0Li{k9$wj`QAY z&+=@p_9iT-_O~x_D)}EyDasGX7gSf(nBLDmZT4ZFGwbTLMkyVfIF3x>&)yuDy7AEb zuESN2Q=Z=3PJJzITVyov{lt|a66fvpRXjIP{_Hxl=HS2j@JeTiGqj;A8%AJpOqi10cWJ%x$_I`6M@GYu$o^iWP0ef9=!PT&{@r zl-UodvQGUF@${*l((ih{E52a0Gw|l`e2LfG{I}eIH+y1-FZ;AvjR&5ix-Lgw@o0&M zln3x_F16h*0UAdU$NmPk0nIuVpt_ab0lI>RfaQ0zqvnvzL2l*0j@AswH4FdU1W@@1 zv~N`{uzl#^c<;UTd-l}rqVHG?uk}}Mxvy)sgZeZIsgn?gfnW`gylaqgXde6@TuWZn z3{Kw}%vZg?Vx@Fg1N`dnzJltNowR>=$vl7K6cWF=`L8*`s<&z%Fl_K#AZ|yqS$pqQ zp4%OmGOrm_9e0r8zvKZsfX9Jk{U125d-v{5V>odK?8AfV7j7PKj{8olr)bB2^K4IG z{My$vC;tzeLfOc-C}=L(_hdqwt#)B)CZp~j`E&$e|2q%gLh5f-TCDW z9kt(KK6{>}+KK<#6NPsk08}@Mq%-ez)wT8m0_Z5(=s@E8vHAg$Zt@BF<8gqQbeP=Y@>z?x2b9dc!S5xm- z7}hl>|A&`p3{CatRqUPHa2YnK?^AefHPZP%sW+(4Ep7G!8$4yXQ%pVIwEHXTUvlH| z1>+pYmC(NKUy=GT3)P>fV`%U1c=}Lk^Z9n5nWsegACGGZ{!1QD*?A~-`I%1}uE*vF z^K7%$t>e*`ZObqgbPrJN{#Cv;PeOyDPX2*nQ@9Y`-Jt>(pUWq4Pw;P#wT6lM!o3qbujT#8KlMDQ&Na|8Cx?e9*ot z7XQ^Rd6@c7`t<3uUNoDV|9W9Db9(csi(<#e0nPV|WWV0)%jvr=Q2({QAD9k~@eH#s z5M_Q>;_w$Y9;(w^-gEl9S^CCtDqLUtox!SxT?zXc_dQo1P@9q5?ks;!DlUj!VYutK(smtEs)1GDHONwgV*{qQ9w|u^bmkzEs^Ak#G@6$(l z81jAW#)Z79uD2PZr@oS`W6Xp+b4|Q+D4)u&tlvRv*m}^4Ty!T-X_x1GWh0#4z=)v5yw1Mj-L30IDJuYHU?A5^rU!5MIB{BvzQ z(M;K?_@B?bVAcq9APzUW@le0~qLQlm%`{f0HB5;*^(AVLG1?UU2y>+yzE>yV&OfJ3 zazgQSYJX6#?M6CRAN$4He_v&5x;V7~=FOX@Jm7pF872P{ zaDRJ_5&7pwevS1j46q~67-J;ec&{rzox$F-*>>C|+`C$W|9WrX4gYZpu6f5{Ji86; z+6CCP-?6L*;nTL7Q;45%QE2gN!S5TWZ>}yMnd)4Q>N_VR`F>Ht{8yiy8B3^WY)@EA z+;GG3J@lIPCfq`6uk_8(L|sesUvjElsyZ~bdOEOcYP@zF?p$+jH222vBGLG!(x3VP zlpg_&$!pG%EhHk#~kN2$Tkhwy^ilMsBY+7Kpmm?wQt5P zYHz+LG$8ohq=O05|D36ch9Mg37ypxSt-*hln{GW|E9~0u+I7uksh~g1^s&o-YddjY z`zLCzcg{5@&yH)n#(5uL;u)`;9{ub^7;l15o`?JWH8PB6{ibPq@EwMTuWd>G7tVX# z(Hg%#fB!&b`32xR5L%Xn`~4Dp+l^<}m>6?8W?6a|sdS3jej?|9xDxiEX9N$B) zJ-~CFl_$mOduU1iE50f>&3Aq(8@9uCAN6VHDqqWn&aTfc;d|TtYf?Yf9xE+E?+>i{ z+_{={e0|NH#|@_MC20y*bod#NS(=bfeRM9{nVhb>lr@dAT0${5AF@ z-bddEKj7@-*G#n*|JA+~he3Pn_Bx+7E}Op#bOI6e+R`^XV{`+MYbB7J9}u^F#YM%{ zuT$TlI4r+}q5LkC=iz>T!gB`#Uu~n7=D*_JZ|-vXsaB}GI|5s$@5)ylK<(^-+JCoS z8t`B77(U|(@l|yh?;IWFRWpjK>)WU=@Q9oLt4E_ctsyXTeX8nr$M1_E9M?myY25Mr z{jT`l>2)(>BVT+G^&Nh0wif>-o7T)K55R8wgSS99+YY^^{dcsdis6Zlt?k5d^=Z&o zpN%})+uU6plPV8g%lY45WCoAN6gHfJqPTI>^~_-SoG@j{aa9Eg1HxpAo{UntOCfqC;| ze=ErFzhWhQ33X-o*EoJC*TemOlssd5o@H%Pa_xSbPOZs*?ACmPi0_N3pX*9sc@xgg zz1N=N*_~wXDtptxDK3%+?8^CnfaKMfUDMv~vE=O3sgtR@vILwsxFUj0%-1k ze)($F=+xC9pB>k@skEwb^J4Z7$S;pP4?nM*cE9vc)liJzM&ONar1MXyJB=yDZ-4eB zPnBy;{wofeo2ohhW#~@W@UtMCjfYy8JG#hz7WhO_n1Yj49T)5k7urGt|k zF195O>W`DmYr!Pi23gv>gKwvW6_sbSuZQYER{+1`eb4f~o!$I1Y`Ebrwif>-OTP-$ z0nGY#wR`{L)BgX*a~JG$$Fq*+1*VHrTfg-7HLP>0*B%{qZNT4{m$RMvJPWJV&#MYp zH(azp>j~<|fKNa)&f9yd7*{CaS;j+CSN2Pf>B4{6KenuP@9#k<*CYMD20xpr++`2t zv@nYkPB_8j0dR68@%YG%%W{qd>LZvvd-i&AN`CGOeZe~*QhdGFl~10m_7BJP!i;vI zHTf^OG^c+1Q{NQ_&IaH3B4`-L-iTPH#L5Dy(b>ma;`DLb&}Bb`H=_c`D;ASM~bt(eh+>+*}P+& zKx6z!2maIcr7UaQ8r%M}Pagaq{9jO5wW@7V^=fDIZD57m1D{7bb<7yc_= z;zk1F-uK~eYt_4Z_3D*s^&}LYXFM<;*;Mw6vs#lk(&i5~VC7vdhY#ZZ`|h)rXbyv!Bp$ghG#j>SiZ&sHLjsK!Q%3R-0Pw^3d$$M zVXk)p%Euz{-Fsc*eO34~-;B5KjOUmR{Fl6DpO8wkrY4?w?{`waW}mCn*M;NJq4(JW z&EF+IqYf|>&aQH~{T?z7;@sp9nj4f?wX!Y0=L6*rvAD1Me`YQ8)*3SzKJzK>D^qr! zPW)G-G*^aozH!fchZDO3!>5!fCy9W>Z*d#!h+G;25QjA;a0cI6Hs!X~=qRt?+G*fh z;N^Lw^VfK;xBO|1K_V_~_`is`Z)!hRHWXs(@A%}zSNJ(v8C486T=|kLD+^uHUa+q#OTjIgWj64c(JIIiYc|tMS`L zoD1FW#;-0?{ha#yU4Ea0e0DtWMb6C{9m&dhF8CLS#CPv?)gvxB`|Puw+}zx_<`sJ5 zmM;94OocVfgIlyhD zY<65jYjn$qV>a!BHk?lbe&;Z!I4FdW%z|6V;ZDzDPKy?USV z`;6y~m0ma|6}5EYzamn^-WmPOcX#SfgCk#qSp3lax5xu}sU4s_bJM}?Hti)dua7#w z_Q?0J8xPG3r~;3JaIG-jvyCa%@__#R`=>gIO?cZ5Ig-9}Gd3pf z42LTpfmr3F?rXn{TH4*y!HhJ6`uSJ*jE9Y@>OSL&Z~MS0n77i|>%8AJi@p`8(p6Bp za@-L-47}fe3wPe4{MUY;E^m6m6}zU!%k^;Q-|_5k!E`Vq%`gjj>{viJ*~48^e}VS> zHs3+$*|TTTHsK?kmG(cnHgPEBM0?JSycrYp!wz{ z_OEXT***5c@x*&gbp`Pz-LMv!1h1^I&Xw=&18tnUwZ-UOBxo5JyZ#xwRe`wXUNZEvW;Uw{2|TjsYR z9eaaX@E-7{ceL{s<-g=t`R`&|IPgfE+=<1lbic3s?%bI(XPR&L#Iuh`Xxe*!lioka zk>=JO8u3#GcDefMtBoD0?I@(m6|&Dy?}hI=&)hdbV*-}}eG_C;;J)fGHTji%!$;JCTNy!3tp0*6&gL?+a}3Epin9-TpxBv8Q>o>CW3!$@d8T zhFfbaL;Izr%8`EWCy@5Ck)Ob`;7sZQTgk3erxa4<@+#f$22_}Df&F6>;s0{_E_wsA zM@p)6NjjOdQ65bib>jEQ;0d6%onOv-pIbq??*vjMqOWjd|H=b6>N^-WZ6f?vK6ixj zJ;gnhjYvNWWt65=g`bynfU-a2@DRy)v7lBil>1d?;jZ9o7c&?cG(K;l^DX zIsczxPvM=5Df`PO{9m+Wi+N9V{0S2#82#&&CAQvnwptFeS4{@XQx{@jl``Gq`d5xI@Nzi8V(~Zlc@`OZDS>2$?Yn; zJ#R^DO|$Y_LArPIUybKo z0^S1u2fS$&@A+E%{}X!|b>4aBWvR`_Z@;un>2sq-jk06S623>? zFTrw93wBZb&N$IbA>e6hZhQNIiG0}kYP0ysGt6jU~zbmZ&@Z$5R#Z+<*=#!Z39 z_|4B_W%^xwM*n}i{snRQ}rsPo6^j!W9@>DrvbIWLen7L z-=+>ndL0Y4u=&d=r<{_Ke%+{v9mh>~EYPkI(!79u!ExZ^4G>xzJO=b5UTqaO^>b+L zU`si*8D&edDe4B>U`H2#mq8-)1iUsU|F3}au%+!en)a#Q70(>PBKiXh`A#0ZvGaq1 z=lY!>M$LP|nL26WSyLuY`rni*Ck3Kl?bOMaO*ne?{RzJ-oQ(Zuzvc9qxy*MGFJ8RZ znK5IA(VuupT5XFyPXRB2pMY2I@t&)XU@5qiuy;@%&ABNXd<)pZ4{Ci+QBjed7hwAZ zHt3_cFSLe}O{ra=ba&H#FU}W$RP-HxPdE>OBjCR38BO&L)hk=WDZb!bWQjHJRsCNR zC39=JY15{uj&I9+jlb;&9snALjhE}8&ua{)2K1#Zn8ne|?NnKiahsk7#0&M^%MLhK z+fQx4JAm5tp|%t6Z?!9b4T{KX%v|Ey+FB>F5C}NpzUoUCUwm;JWbTjd zt_2^0cy%B8{MUr{N5a{Uqt*eKd4keQ#% z^si&aWi$|~0r5n6f%*urk)43XmEQ!Rb`|e$wOL;Pr-Q9k#wiaFTEg*8#V76fZ}UPo z|Lu&7Cjs&GM-Z=$L!Vdvp?r5|rKfH0wS>Mi@7QoPpth%g?Ktk*AFTnY1s{M=8;ke1 z+OYS6gL#LUTPoWZn$z*VwBo-jkI^ybIdF71$GgBcAYPq@KCf}z8$dpNh^CFNd`8H) zj0WP-fE^2hpK3FzAL@Sa6$rJtcz=J0J*sWnfBN+4*|N=9vt~J3Q_via_oM~?&pPWY z)32|xc-gXLlBpNaoL$YmiC2fA&woo84}(#lqw-XJe@gwk8JE#OA{vnG*txyfl**9K z*wt9hp99H`L&<(u0D_&o6ZwEC50w{iEfH}e`cZhG)$0G^qS`!?!>x;VxVyhn96=`!Oo8c0?HM;&#Pu_f7)%g2j3KO&n|22+p^EPDI0%+dVV<6U8WT>9P{a!^lv(VLE_8m%}@#Dv*N_ClV zG8$;o0JdiPsKqC>E%U&yKq}@Ee@!^Q2g9*vGY?g^oQkmm!t~33&0)Gs&nN5LcN%@M z7l-ET4g$Akb#!dgsjsisu?Lt18bK(p=HXwT~zJeVsJCiJm7eF zANst;9B&1K7$a;0$4nWkclvS7!T;x;d#)+pQ~2adnzLJoj7vZ&`a{%D@H;RJv{jrf z{KPr)OhyAOtpV{s?NOI+vRCzYj{z#fRhEbHI^N&)gfWNkcUQkU=VtA6ta8wmC#CIw z8%N2&d3TOifpaSDC@N5XiPFi!$z&Mv>5bIv&@E!O0>v`uB+x8Z3(<+Au;%W3Mz z+hN0M%fAfNwhy)Wcz&xbtZ>fe9owqyq4z`^C*WD-6-o17bM;x9W8$VTdB6HRP64T! z53!W6CJ~=*nh<X-!bZWi+rMYC!pb%?m0jD#Ss}cdG!YSZDk#;XDWq0h@^{>KhP3 z9ru&wzrs)-yW&HB){fsJz&#)pZG5fEy%ywAm&vyIS*&_ZXgo8&Ga5)o4XE4{FWowU z#`cGRyFe<&!qwJZ0*YBjm(9_%3v{&3y_Qh8b(QwC1C$Y?GaX&frAwPoOq$IDW))?QO!C0=g@o z5!$tD*VISH^|<)2viF!{jxqAO{hB)vhV}+|1Eiu2^CID#jy|?g{vy5TJvwGwMgtqG z2IkJ4+thwmeHsqz1T^Pv8Az5_%153DgLpnX0{?aTyJ4DjHDv?3Sy_5A0mx#c<*i5RNzTT>F|Z{s{Kv9cC^u z=Vt@o^Z$5OW0-@%ogfwMl+Ow0Mo@}OW?m!bCNJDn(mWH-j0QqAAP%U`tNZ}8=l6j? zZDMga9?pk*_I<)wOt`(l`JBg^pRBQkE5IH={gi7!xNzgSrguI94n>B|ZGWipzKqLg zAfo}t>@(82b7xaeS6%?Rz?bph1+W&x!?$qHYFzE_;QJV1>0M6&wavqY6VElZWnKr$ zceVp2kJI>}>iZd&(LhE6>ubQ}za3}a72eDQD?vQm3-_$}7^{CF*8OndhP$?!cg+KP zY7Z5T2J6Q*b0wpJj0QqAVELlFfO@jV^oqbu;4=`8Z|QRFE9AQ!456NH_B^J}Z{`f7 z!}oMT^_=;g(Lg$DKy78Ula&v^DeY->5XT2Wtaf}$=Lg>-)8CQraQNOybN1|*UOMYH zBU?rT>8=6ssJgn^)Sp$B!m(}Pn)dS1IA5yj>xt$UdcWo(Pe88iC97o2xQqre8c3}M zG#^KE{8cB=5uWK=gLC0tBS@6L$@tTroi)g?_jliY*EG*LwXx2GmeD{)16~b?|CF_+ zoaGzC>KhmcZUtY0WccjYuf`?s0VAmAx0O5=UO6-884YAK&^#K@9726BOX~{U^?#k< z<5A#A@ICO$<#?Xc+`{L;$&~qB#Cf&z^-ZIN3l}y|L^GjgG?39iL=CX7rgPe9r$Zwr`=Lr6W_MV(^)A0bWMgQzL;~DPnJJ9r*XAS)BDl)y8LVR6!+n`!atJJ zu;E9M&!nj3^Kb$P37;z@w9=!CQ(MN5ZP!g7-QO`+f3d_e{%oiGMZa+5FFNGhqQ54Z z{Iz^HmvZ$tr;I;1)WFNQU&b-$a&@q~{AbM>&M!~+Il=I;#-KCzC7=5{XOs!jwcud* zdViUFpIGTE`u(ihK2481Wkj&H&n-tfXze2({*1<&})`yFSv{>bGFH;2&hbB+C)Tl_KpJCJ|h!VlMfCo};M zTtyiF@Xu+I4~dNRatX(;b@BsqCF*@QeEGxu5`KG=K0$s2?@52;SJ?A*T-e;$4=0p2 z_CE3l`RELH<#(LJ-INSIGh7lH`5iZW}tyWF5oU*-Wv#$()YC#a8F;}fxh{%_&tZhriuFT#V5@@dj+-SC6=o#6ep z%0HDqWaXiko21|1Z^}c*+1Y8c)l(*ap?v54k4rxsr4N;--ML>D;eMXE?|HvG23=4d z@(Ui(1EhFv&}@SD`EAM%ep&yVM)hxuEa=;WXZ_poBi(P)#c`Cs1?w+EiC-{2?M?l~ z^L{sf(<@B*gFKQS`Aq)jgt8gYx@g5 z^8Q%&dD^dh>&t(OiBYWh^NO6AGOw&MPJ<4Q{C52}rH}gr@iggU_19z{dY=EJpUT^y zy>Q-iU-jSh?I+g#w$wjd`#4g3a=MmTK8`8lee2%$@-xrJ{kFgO&r|JSc{eGVrGQhcz}#&+^w?viX-SxRt-b zKa(EV9g64YEd;b%^!zdCf4Db)Y(xDtt118X=5GW?`KSB8yLFSk9On>| zK9`vKdW!gPfYo#@>w#iD<8jpkq`X@^+EJ$Kd5}6KGcEoI~RTZM&5_(c{y+R z=7Q=!3g5cmxe4D~(r@Z(_O>yD(E6L_?k~@I&eo~F-JyMG@x4-Bk7|t)hgK_`GKliiNuOH`>1^orzkN#!`fAcq2XDVON zv-pm9@=t!?_7CU{Ih3DHwp*Trv=7?JkM+-Kc1ZsMmvBadO=5f7N2YzVM=*Rn8QQ)H zwhzf4D1XcNyI%Y7O)io@Nq(J$Z~y2{coz(x{D$!5Lc=!~W&a-MmEX26-F&Hg==+2B zvn8KGSg-x*UN;ou{%-oM^s((fxBc58DBtGm`R9Hu{~Cv-LHUFH3nzc9`~MGPk;ixd literal 0 HcmV?d00001 diff --git a/vendor/ocramius/proxy-manager/doc-template/img/block.png b/vendor/ocramius/proxy-manager/doc-template/img/block.png new file mode 100644 index 0000000000000000000000000000000000000000..fb8f17aaf8479d5e92fb9715d81f5f7c1b262c04 GIT binary patch literal 2373 zcmaJ@dpwi-A77fwhSb4Aw>6Ot+iY%atTi@SHN?W{NOpNJc59b5zo+aR+7hm)JV3&L%XwVB7%wLvzVPC8y8alAfPZn3BoGk) zBo#pmhWiOb0NexRfn>R2F>o&&3gh99!(d$CSXYc28smz_;*b~&-rWn2@q~YU5V~k0 zb__m*?Ef{E&LSYlWfDQq~0;!0l8(fUNK9mseCjuA}fru^;aHqQ%94C+n#Bl;4+|Lj0 zL}Rcxe7(Kw3xGz$Q~6>EgUDEWDe%o7}@on<~zHZ$`y1nk$T#^I=88%YMB)a_O z^WtrBVe4%=UPe{D=}Y(n*1s|ev6MHlDq@MV5(abWilAtSSQr8dh}lcP3^0J}y`BrL zLpW!UU_bcPIc6MF{*ryA5b$%0s~SkKJe~NVWNTF8Z+A|A@OejgH&icstTpz!`=R7@ z@zt^8kB5>2cfb5lLa8)AcBu6FxtRmxD)LWSUi2m6IkVqm)g6UfKsC|5dr_$;Uu0Qc zZ?m#;JO()K3^_P|+!;NyYWx29xW$7{N73HuF%EjQl$l=kpqUfIDKBjTR`s=ISHF+f zY?P02YKGaHTyCj(qZE&In%Mmd<}stLY`8qMA}z1p$}eYkgF>=mVB}bZ z9x|_Z>R@NE$yZ8EdvtAfrCo|`@f?$QV-Guvbi3*t=jUb@i@g?C&v*j?zc5~K zz;HWcwCq%4+oTG8lcHYjrPv(fYV7nrtF@@jtReAN+Xu@h)TDIPn${#m*_>WTd}#OO z_+>lhC^QrO;U`o{lOn|*gDOL17i1prwtQtu?c<#XOa~N}1|;WJZYDSnTf}?_^(M_4 z*^$u&FT8t))$2JM2us4XC}2a zhA(h1J)^Y?UevHTS4C_!>NSQ&N%QB+!9KH|b@6gDRBVeU$C=cH6E&ri&n{X^Eo_W_ zCbd8v9;pTA`)_jV;b<`s^>|1#T8q<~og39|1ST2MroOA~%HA zo^A00i~}PqU}Jq+_>e)v#!l-Sg{rPWtIOt6efvtU#%%w9pjBLA>CP^34F5*%$atCT7aL+J^PQLgbsC8rlS;aWV5&&SxC7`~7o9OF%g+ zT5cMNF@IO~*D!Cy0QTVF;T2pX)q%-zd_7{~?Y85UFAEApw(<-divi^#4|avr-cQh` zcfY=|$>{E&@UgkcOjcXjP#bzE)`rMi| zOPHcm^1;bzFVAEKS>*M2Cx(slN0M8r9Cq!D8E+Zq-OIdx>PSM}@X-|l&S8kAvW>d$ zwKk#qZT|~xj4-issz1>r(r|M7wtJa|6PpY?P2LX6q+_krVmFu~$fLxq&YhO(ZO@$B z7$`fJ{TuZ5jFvgww~=R|>Vj7Vsdo#dTOqKe*B4p7^RW1}bpOGrJ*e0F&M#EFvTP(i z{ot7+>)Hz)%WbMZ8TNihKC}8B@=8UG>Jg#8Z{c2rDQlp72O$bnq$Rc^f-pq|$MR%% zH0d0!&7!2GJ(`ZSme!G>@&fkYdH1TT>(&7$WPD&&gMZ$JznG;+#gwxagwI6}rNWXA P>wj#hlt6N=Z?y7n2#Vl( literal 0 HcmV?d00001 diff --git a/vendor/ocramius/proxy-manager/doc-template/img/enf.png b/vendor/ocramius/proxy-manager/doc-template/img/enf.png new file mode 100644 index 0000000000000000000000000000000000000000..7e15bdda716cc1ce495de59800877f4965ce335e GIT binary patch literal 3738 zcmV;L4rTF)P)Px#X;4g5MF0Q*|NsC0|NsC0|NsC0|NsC0|NsC0|NsC0 z|NsBtEI!vNGSwddUL(?iQ-zz)aD>>UMH|Z=!>MTg-EJf@sOVKJU&?+nL zjFtG&)aPq;^RKr3@$&rU=-f+C>QZITDk?alJbC~C019+cPE!EY#Q*A#uNOLL*d@DX z000fSNkl$P*l9Xl|*`}uKKE|NFO~1 zUS6K^lsn7Y_g}vs5c~Jf*H(T$9QvOhuf6>E^H^2#?Um)*+v8NpFF^kL7mg27>QLOT zumAR6U;BU1euPq|;@*FLweq=tkW#1OJ{-SL-VZSH{p}Ho`~6GF`{qks6}KVvw(G?# zZc{$7UVdz^Uf#aDs$^I%8!L5s3;fuBH2~W13(5XtdvA?gB?&?{4Wl;=;U`-wb$$z^ z;%)#P=^Og{YN*sVu?u+Pw?Is7(=^D*#1M+{*7&xW;%+)ro#`*C5{LvkO|y+s=i-hU zRUyL5eJ+{iE4qKF8^uj&MM!#qlEH+d!tuVP{#zBdAz!ZE7pJ@%y5lZDHm{AYiIYNF z_uBBv^?ekv9_iH3zRQM}uI~q3C3PzVSTk=u5=A?6^9`?A+;w9ov!P3nh6RQr$S3?H|YRED~Qe$*Au4?~y!~5qZ z#obm3Kqy4SVOXwu)`85^5bD-9*zl_BJG&KVm3Pd%(r7sKjf6ob>Ds#hu9Bb@X=urn%}aK(6og7369gUfI0XSCXr2c%``OE6Vz%E}Pf-sL?k9l=fSk^W$2rCoq*UeS1>4!{S$Zd9BXHha=o0Rzbz8(z7-w?-5E>-{H5 z!l{SxUZBmC6d14SwMi8Q5@bgG_UGaauWVkEgfjvV?7b%FI+3Yb!jOPvlIUw*WojhJ zMH^lzZZ@lZD5(=QAqoRMy@De)B9$|8eyL-X{M#pY5-RmSXBGG1Gr60bvEh}?>(u$a zzAW7E%Jn_DyDZrS$n`zhfXv~t0hKE#BieR-K3?jwdF`DB;wA`i z#Pl4{6rY`dSI`9c55R_wC*Wj|*+AtWFa|pr+3>3CJ7OY85bz(QQVS)QeaZ~|NFP7ckBXW^BS105Y8B&Fzk8ZwPRxvMpcLsRU)}?S!i4KhF3PP!N$eh z@bcz0*uLwrgd2~Md*_L69fJv!lN03J;(v#dv2F`Dob zMOq`Gc0^N=ZER>RI+gKA;3IJx(SdRnX(EXtqN9+CL7pAZM4S?PGV&wS1{#kvIFk{n zHW0yzh$gWE^stbJBjo|~2CtDX$v^`>co#>$P8jO@$f&`^LS%_B+vA#Fp?t^QF&mgN_48;rMnEIrdE`dTbF>3cd2S5ix@`Y(aCwNZQaoIB_}FKi ziJVQ!Z!QG6N?L~$8{vRdgZD1IKW0dOeS@@Zbp?tfsi6( z&qB}i$yPt)o?LWCT`JQ;UM*}1ZJ^$b;|5E`W-hSNvy9W1tM*XlgM$pQCj~0y)tgWm zqR*0L;0v)^Do{P4bPoCw@N_A5mf>adWPBPuTp7Grj-7dU*_?4|mZHxFKLdMarJx)& z`ikI!eH_-%`IVBo(N8N|;Cd=eNjq(S#<5*yaVdT-F;q&^OpIsXL8GHiIxpiX*=ZY{ zfIVbj@RZ!8q~9-*Udmj!!J-7DR(ycmEle>622W`otfkh%)BsNjB^3gULcn`;<%)t# zC2CoQmrbzQufj~E=nEE8*jA}*I#2MjIZxU6=X7dhx-%O*{WRWJ z=Ah8$5_5Eox5Hw_g8ATSS}a7TN?C{<&N@L$z|%Bbgg&=Y&cI#@z6d?U&n2#by&QZ2 zI$k!ff;|oHjf~7h$IGU}qBo80od@ojD?KmuV8H9z?yP&bQiI_J>!=J_=mTs|QF|tg zXU6Z@-~i_dh37d^)y|pdULPL(b|yToln=wH=aE+Gnb@8zH#t38W~9{w_dqboeM2Or zmlRs*0G(Cf2$ga`TRe^j3p?e6rKxzqJYYC5NKgvgGbJ?~4VtYC(X|e4uuPkfJ_}o? zDfLD(W|EA9&ymphEX$ZW;$_nz#^+d}cb;4ZK7o#x%`0JF4sM`pOuTFk^$%-cuK}*m z6*zt_5srdihP@6rqaW-_`Rk2Znu0MiqFd#yuhBd>cXzJ&8zJ4SA`i@C*l@;U*k-Q0FhS z{Cj4pxK~e!H|TkzvyBOPcutSKEEViQRN8%G1kF`4vQ4xui7)-_z6{-P4 z%pT*I{m0aeAq5b((lwmLpo4DXSj_iFBjeIC?9D)u$#p($pnWTaA2n8R!~j>W1OvykbGn+8QkwPV+8Z058Y#%^1(uw6c5 zD?sCn*x(})kGh?VbLLDOPc4YY7R&+Pr0AO;&0JEbSGzf5;qo~>Pe*<8qu0Ot!l7P_ zxhULf7+0Zs#f(5_4uW0$wyXuGyVt!JopzxjG&~nZ;FS8p@>NWwtuVC;MI`pL&CVxM z;2_`8*0`nGk(9toe}qt^Q}kZY6*dYS<(Nnp$6y}qS}7?=1x#1mEWiMp?0$~cjaB6) zb_`?ERs{o6Mhwe^;1%c;RY;2|C2*A`#cDxI%#ie^%+NJL97To=Pq||$dW!WQ_B@og?3DbaImZb`(v~YyG zENQYdRJ5^$kCx!uc<+S}iO^et{AEdg5QQVbU+nfX2ul5uvw%*@(pX%U`{mEA;TxwP z#d0Y=O2#P}q8PRcW1!Uh)__tX^zwM#lY;O$ORxLVkYY$^O%Fw~Jgukm-=_QAM;p*C z;A3CjL8!RTdJcv>j^WnW7e9YYO8u7D#}yufB^%xwR>?Zg*pm(Kjj-2y)En;t-fvgj zD?LFfP>qtNO41OOzTLgv;6cD@!@E-6ho7XSbN07*qoM6N<$ Ef{OK7t^fc4 literal 0 HcmV?d00001 diff --git a/vendor/ocramius/proxy-manager/docs/access-interceptor-scope-localizer.md b/vendor/ocramius/proxy-manager/docs/access-interceptor-scope-localizer.md index a03ac09..1d11851 100644 --- a/vendor/ocramius/proxy-manager/docs/access-interceptor-scope-localizer.md +++ b/vendor/ocramius/proxy-manager/docs/access-interceptor-scope-localizer.md @@ -1,3 +1,7 @@ +--- +title: Access Interceptor Scope Localizer Proxy +--- + # Access Interceptor Scope Localizer Proxy An access interceptor scope localizer is a smart reference proxy that allows you to dynamically @@ -60,8 +64,10 @@ would break an [access interceptor value holder](access-interceptor-value-holder will cause the two objects to be un-synchronized, with possible unexpected behaviour. * serializing or un-serializing an access interceptor scope localizer (or the real instance) will not cause the real instance (or the proxy) to be serialized or un-serialized - * if a proxied object contains private properties, then an exception will be thrown if you use - PHP `< 5.4.0`. + * methods using `func_get_args()`, `func_get_arg()` and `func_num_arg()` will not function properly + for parameters that are not part of the proxied object interface: use + [variadic arguments](http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list) + instead. ## Example @@ -86,8 +92,8 @@ $factory = new Factory(); $proxy = $factory->createProxy( new Foo(), - array('doFoo' => function () { echo "PreFoo!\n"; }), - array('doFoo' => function () { echo "PostFoo!\n"; }) + ['doFoo' => function () { echo "PreFoo!\n"; }], + ['doFoo' => function () { echo "PostFoo!\n"; }] ); $proxy->doFoo(); diff --git a/vendor/ocramius/proxy-manager/docs/access-interceptor-value-holder.md b/vendor/ocramius/proxy-manager/docs/access-interceptor-value-holder.md index e47e941..e57bcd9 100644 --- a/vendor/ocramius/proxy-manager/docs/access-interceptor-value-holder.md +++ b/vendor/ocramius/proxy-manager/docs/access-interceptor-value-holder.md @@ -1,3 +1,7 @@ +--- +title: Access Interceptor Value Holder Proxy +--- + # Access Interceptor Value Holder Proxy An access interceptor value holder is a smart reference proxy that allows you to dynamically @@ -35,8 +39,8 @@ $factory = new Factory(); $proxy = $factory->createProxy( new Foo(), - array('doFoo' => function () { echo "PreFoo!\n"; }), - array('doFoo' => function () { echo "PostFoo!\n"; }) + ['doFoo' => function () { echo "PreFoo!\n"; }], + ['doFoo' => function () { echo "PostFoo!\n"; }] ); $proxy->doFoo(); @@ -54,10 +58,8 @@ PostFoo! A proxy produced by the [`ProxyManager\Factory\AccessInterceptorValueHolderFactory`](https://github.com/Ocramius/ProxyManager/blob/master/src/ProxyManager/Factory/AccessInterceptorValueHolderFactory.php) -implements both the -[`ProxyManager\Proxy\ValueHolderInterface`](https://github.com/Ocramius/ProxyManager/blob/master/src/ProxyManager/Proxy/ValueHolderInterface.php) -and the -[`ProxyManager\Proxy\AccessInterceptorInterface`](https://github.com/Ocramius/ProxyManager/blob/master/src/ProxyManager/Proxy/ValueHolderInterface.php). +implements the +[`ProxyManager\Proxy\AccessInterceptorValueHolderInterface`](https://github.com/Ocramius/ProxyManager/blob/master/src/ProxyManager/Proxy/AccessInterceptorValueHolderInterface.php). Therefore, you can set an access interceptor callback by calling: @@ -68,7 +70,7 @@ $proxy->setMethodSuffixInterceptor('methodName', function () { echo 'post'; }); You can also listen to public properties access by attaching interceptors to `__get`, `__set`, `__isset` and `__unset`. -A prefix interceptor (executed before method logic) should have following signature: +A prefix interceptor (executed before method logic) should have the following signature: ```php /** @@ -85,7 +87,7 @@ A prefix interceptor (executed before method logic) should have following signat $prefixInterceptor = function ($proxy, $instance, $method, $params, & $returnEarly) {}; ``` -A suffix interceptor (executed after method logic) should have following signature: +A suffix interceptor (executed after method logic) should have the following signature: ```php /** @@ -103,6 +105,13 @@ A suffix interceptor (executed after method logic) should have following signatu $suffixInterceptor = function ($proxy, $instance, $method, $params, $returnValue, & $returnEarly) {}; ``` +## Known limitations + + * methods using `func_get_args()`, `func_get_arg()` and `func_num_arg()` will not function properly + for parameters that are not part of the proxied object interface: use + [variadic arguments](http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list) + instead. + ## Tuning performance for production -See [Tuning ProxyManager for Production](https://github.com/Ocramius/ProxyManager/blob/master/docs/tuning-for-production.md). \ No newline at end of file +See [Tuning ProxyManager for Production](https://github.com/Ocramius/ProxyManager/blob/master/docs/tuning-for-production.md). diff --git a/vendor/ocramius/proxy-manager/docs/copyright.md b/vendor/ocramius/proxy-manager/docs/copyright.md new file mode 100644 index 0000000..12c062a --- /dev/null +++ b/vendor/ocramius/proxy-manager/docs/copyright.md @@ -0,0 +1,15 @@ +--- +title: License +--- + +# License + +Copyright (c) 2013 Marco Pivetta + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--- diff --git a/vendor/ocramius/proxy-manager/docs/credits.md b/vendor/ocramius/proxy-manager/docs/credits.md new file mode 100644 index 0000000..baa10c8 --- /dev/null +++ b/vendor/ocramius/proxy-manager/docs/credits.md @@ -0,0 +1,26 @@ +--- +title: Credits +--- + +# Credits + +The idea was originated by a [talk about Proxies in PHP OOP](http://marco-pivetta.com/proxy-pattern-in-php/) that I gave at the [@phpugffm](https://twitter.com/phpugffm) in January 2013. + +--- + +### Contributors + +- [Marco Pivetta](https://github.com/Ocramius) +- [Jefersson Nathan](https://github.com/malukenho) +- [Blanchon Vincent](https://github.com/blanchonvincent) +- [Markus Staab](https://github.com/staabm) +- [Gordon Stratton](https://github.com/gws) +- [Prolic](https://github.com/prolic) +- [Guillaume Royer](https://github.com/guilro) +- [Robert Reiz](https://github.com/reiz) +- [Lee Davis](https://github.com/leedavis81) +- [flip111](https://github.com/flip111) +- [Krzysztof Menzyk](https://github.com/krymen) +- [Aleksey Khudyakov](https://github.com/Xerkus) +- [Alexander](https://github.com/asm89) +- [Raul Fraile](https://github.com/raulfraile) diff --git a/vendor/ocramius/proxy-manager/docs/download.md b/vendor/ocramius/proxy-manager/docs/download.md new file mode 100644 index 0000000..d64ab25 --- /dev/null +++ b/vendor/ocramius/proxy-manager/docs/download.md @@ -0,0 +1,11 @@ +--- +title: Download / Installation +--- + +## Download / Installation + +The suggested installation method is via [composer](https://getcomposer.org/). + +```sh +php composer.phar require ocramius/proxy-manager:1.0.* +``` diff --git a/vendor/ocramius/proxy-manager/docs/generator-strategies.md b/vendor/ocramius/proxy-manager/docs/generator-strategies.md index e4022d5..e879757 100644 --- a/vendor/ocramius/proxy-manager/docs/generator-strategies.md +++ b/vendor/ocramius/proxy-manager/docs/generator-strategies.md @@ -1,3 +1,7 @@ +--- +title: Generator strategies +--- + # Generator strategies ProxyManager allows you to generate classes based on generator strategies and a @@ -13,4 +17,4 @@ Currently, 3 generator strategies are shipped with ProxyManager: where you want to generate multiple classes at runtime * [`ProxyManager\GeneratorStrategy\FileWriterGeneratorStrategy`](https://github.com/Ocramius/ProxyManager/blob/master/src/ProxyManager/GeneratorStrategy/FileWriterGeneratorStrategy.php), which accepts a [`ProxyManager\FileLocator\FileLocatorInterface`](https://github.com/Ocramius/ProxyManager/blob/master/src/ProxyManager/FileLocator/FileLocatorInterface.php) - instance as constructor parameter, and based on it, writes the generated class to a file before returning its code. \ No newline at end of file + instance as constructor parameter, and based on it, writes the generated class to a file before returning its code. diff --git a/vendor/ocramius/proxy-manager/docs/lazy-loading-ghost-object.md b/vendor/ocramius/proxy-manager/docs/lazy-loading-ghost-object.md index 15ae426..d94e6d8 100644 --- a/vendor/ocramius/proxy-manager/docs/lazy-loading-ghost-object.md +++ b/vendor/ocramius/proxy-manager/docs/lazy-loading-ghost-object.md @@ -1,7 +1,17 @@ +--- +title: Lazy Loading Ghost Object Proxies +--- + # Lazy Loading Ghost Object Proxies -A lazy loading ghost object proxy is a ghost proxy that looks exactly like the real instance of the proxied subject, -but which has all properties nulled before initialization. +A Lazy Loading Ghost is a type of proxy object. + +More specifically, it is a fake object that looks exactly like an object +that you want to interact with, but is actually just an empty instance +that gets all properties populated as soon as they are needed. + +Those properties do not really exist until the ghost object is actually +initialized. ## Lazy loading with the Ghost Object @@ -41,20 +51,20 @@ subject, they are better suited for representing dataset rows. ## When do I use a ghost object? -You usually need a ghost object in cases where following applies +You usually need a ghost object in cases where following applies: - * you are building a small data-mapper and want to lazily load data across associations in your object graph - * you want to initialize objects representing rows in a large dataset - * you want to compare instances of lazily initialized objects without the risk of comparing a proxy with a real subject + * you are building a small data-mapper and want to lazily load data across associations in your object graph; + * you want to initialize objects representing rows in a large dataset; + * you want to compare instances of lazily initialized objects without the risk of comparing a proxy with a real subject; * you are aware of the internal state of the object and are confident in working with its internals via reflection - or direct property access + or direct property access. ## Usage examples [ProxyManager](https://github.com/Ocramius/ProxyManager) provides a factory that creates lazy loading ghost objects. To use it, follow these steps: -First of all, define your object's logic without taking care of lazy loading: +First, define your object's logic without taking care of lazy loading: ```php namespace MyApp; @@ -74,88 +84,186 @@ class Customer } ``` -Then use the proxy manager to create a ghost object of it. -You will be responsible of setting its state during lazy loading: +Then, use the proxy manager to create a ghost object of it. +You will be responsible for setting its state during lazy loading: ```php namespace MyApp; use ProxyManager\Factory\LazyLoadingGhostFactory; -use ProxyManager\Proxy\LazyLoadingInterface; +use ProxyManager\Proxy\GhostObjectInterface; require_once __DIR__ . '/vendor/autoload.php'; $factory = new LazyLoadingGhostFactory(); -$initializer = function (LazyLoadingInterface $proxy, $method, array $parameters, & $initializer) { +$initializer = function ( + GhostObjectInterface $ghostObject, + string $method, + array $parameters, + & $initializer, + array $properties +) { $initializer = null; // disable initialization // load data and modify the object here - $proxy->setName('Agent'); - $proxy->setSurname('Smith'); + $properties["\0MyApp\\Customer\0name"] = 'Agent'; + $properties["\0MyApp\\Customer\0surname"] = 'Smith'; + + // you may also call methods on the object, but remember that + // the constructor was not called yet: + $ghostObject->setSurname('Smith'); return true; // confirm that initialization occurred correctly }; -$instance = $factory->createProxy('MyApp\Customer', $initializer); +$ghostObject = $factory->createProxy(\MyApp\Customer::class, $initializer); ``` -You can now simply use your object as before: +You can now use your object as before: ```php -// this will just work as before -echo $proxy->getName() . ' ' . $proxy->getSurname(); // Agent Smith +// this will work as before +echo $ghostObject->getName() . ' ' . $ghostObject->getSurname(); // Agent Smith ``` ## Lazy Initialization -As you can see, we use a closure to handle lazy initialization of the proxy instance at runtime. -The initializer closure signature for ghost objects should be as following: +We use a closure to handle lazy initialization of the proxy instance at runtime. +The initializer closure signature for ghost objects is: ```php /** - * @var object $proxy the instance the ghost object proxy that is being initialized - * @var string $method the name of the method that triggered lazy initialization - * @var array $parameters an ordered list of parameters passed to the method that - * triggered initialization, indexed by parameter name - * @var Closure $initializer a reference to the property that is the initializer for the - * proxy. Set it to null to disable further initialization + * @var object $ghostObject The instance of the ghost object proxy that is being initialized. + * @var string $method The name of the method that triggered lazy initialization. + * @var array $parameters An ordered list of parameters passed to the method that + * triggered initialization, indexed by parameter name. + * @var Closure $initializer A reference to the property that is the initializer for the + * proxy. Set it to null to disable further initialization. + * @var array $properties By-ref array with the properties defined in the object, with their + * default values pre-assigned. Keys are in the same format that + * an (array) cast of an object would provide: + * - `"\0Ns\\ClassName\0propertyName"` for `private $propertyName` + * defined on `Ns\ClassName` + * - `"\0Ns\\ClassName\0propertyName"` for `protected $propertyName` + * defined in any level of the hierarchy + * - `"propertyName"` for `public $propertyName` + * defined in any level of the hierarchy * * @return bool true on success */ -$initializer = function ($proxy, $method, $parameters, & $initializer) {}; +$initializer = function ( + \ProxyManager\Proxy\GhostObjectInterface $ghostObject, + string $method, + array $parameters, + & $initializer, + array $properties +) {}; ``` The initializer closure should usually be coded like following: ```php -$initializer = function ($proxy, $method, $parameters, & $initializer) { +$initializer = function ( + \ProxyManager\Proxy\GhostObjectInterface $ghostObject, + string $method, + array $parameters, + & $initializer, + array $properties +) { $initializer = null; // disable initializer for this proxy instance - // modify the object with loaded data - $proxy->setFoo(/* ... */); - $proxy->setBar(/* ... */); + // initialize properties (please read further on) + $properties["\0ClassName\0foo"] = 'foo'; + $properties["\0ClassName\0bar"] = 'bar'; return true; // report success }; ``` +### Lazy initialization `$properties` explained + +The assignments to properties in this closure use unusual `"\0"` sequences. +This is to be consistent with how PHP represents private and protected properties when +casting an object to an array. +`ProxyManager` simply copies a reference to the properties into the `$properties` array passed to the +initializer, which allows you to set the state of the object without accessing any of its public +API. (This is a very important detail for mapper implementations!) + +Specifically: + + * `"\0Ns\\ClassName\0propertyName"` means `private $propertyName` defined in `Ns\ClassName`; + * `"\0*\0propertyName"` means `protected $propertyName` defined in any level of the class + hierarchy; + * `"propertyName"` means `public $propertyName` defined in any level of the class hierarchy. + +Therefore, given this class: + +```php +namespace MyNamespace; + +class MyClass +{ + private $property1; + protected $property2; + public $property3; +} +``` + +Its appropriate initialization code would be: + +```php +namespace MyApp; + +use ProxyManager\Factory\LazyLoadingGhostFactory; +use ProxyManager\Proxy\GhostObjectInterface; + +require_once __DIR__ . '/vendor/autoload.php'; + +$factory = new LazyLoadingGhostFactory(); +$initializer = function ( + GhostObjectInterface $ghostObject, + string $method, + array $parameters, + & $initializer, + array $properties +) { + $initializer = null; + + $properties["\0MyNamespace\\MyClass\0property1"] = 'foo'; //private property of MyNamespace\MyClass + $properties["\0*\0property2"] = 'bar'; //protected property in MyClass's hierarchy + $properties["property3"] = 'baz'; //public property in MyClass's hierarchy + + return true; +}; + +$instance = $factory->createProxy(\MyNamespace\MyClass::class, $initializer); +``` + +This code would initialize `$property1`, `$property2` and `$property3` +respectively to `"foo"`, `"bar"` and `"baz"`. + +You may read the default values for those properties by reading the respective array keys. + +Although it is possible to initialize the object by interacting with its public API, it is +not safe to do so, because the object only contains default property values since its constructor was not called. + +## Proxy implementation + The [`ProxyManager\Factory\LazyLoadingGhostFactory`](https://github.com/Ocramius/ProxyManager/blob/master/src/ProxyManager/Factory/LazyLoadingGhostFactory.php) -produces proxies that implement both the -[`ProxyManager\Proxy\GhostObjectInterface`](https://github.com/Ocramius/ProxyManager/blob/master/src/ProxyManager/Proxy/GhostObjectInterface.php) -and the -[`ProxyManager\Proxy\LazyLoadingInterface`](https://github.com/Ocramius/ProxyManager/blob/master/src/ProxyManager/Proxy/LazyLoadingInterface.php). +produces proxies that implement the +[`ProxyManager\Proxy\GhostObjectInterface`](https://github.com/Ocramius/ProxyManager/blob/master/src/ProxyManager/Proxy/GhostObjectInterface.php). At any point in time, you can set a new initializer for the proxy: ```php -$proxy->setProxyInitializer($initializer); +$ghostObject->setProxyInitializer($initializer); ``` In your initializer, you **MUST** turn off any further initialization: ```php -$proxy->setProxyInitializer(null); +$ghostObject->setProxyInitializer(null); ``` or @@ -164,43 +272,137 @@ or $initializer = null; // if you use the initializer passed by reference to the closure ``` +Remember to call `$ghostObject->setProxyInitializer(null);`, or to set `$initializer = null` inside your +initializer closure to disable initialization of your proxy, or else initialization will trigger +more than once. + ## Triggering Initialization -A lazy loading ghost object is initialized whenever you access any property or method of it. +A lazy loading ghost object is initialized whenever you access any of its properties. Any of the following interactions would trigger lazy initialization: ```php -// calling a method -$proxy->someMethod(); +// calling a method (only if the method accesses internal state) +$ghostObject->someMethod(); // reading a property -echo $proxy->someProperty; +echo $ghostObject->someProperty; // writing a property -$proxy->someProperty = 'foo'; +$ghostObject->someProperty = 'foo'; // checking for existence of a property -isset($proxy->someProperty); +isset($ghostObject->someProperty); // removing a property -unset($proxy->someProperty); +unset($ghostObject->someProperty); + +// accessing a property via reflection +$reflection = new \ReflectionProperty($ghostObject, 'someProperty'); +$reflection->setAccessible(true); +$reflection->getValue($ghostObject); // cloning the entire proxy -clone $proxy; +clone $ghostObject; // serializing the proxy -$unserialized = unserialize(serialize($proxy)); +$unserialized = unserialize(serialize($ghostObject)); ``` -Remember to call `$proxy->setProxyInitializer(null);` to disable initialization of your proxy, or it will happen more -than once. +A method like following would never trigger lazy loading, in the context of a ghost object: + +```php +public function sayHello() : string +{ + return 'Look ma! No property accessed!'; +} +``` + +## Skipping properties (properties that should not be initialized) + +In some contexts, you may want some properties to be completely ignored by the lazy-loading +system. + +An example for that (in data mappers) is entities with identifiers: an identifier is usually + + * lightweight + * known at all times + +This means that it can be set in our object at all times, and we never need to lazy-load +it. Here is a typical example: + +```php +namespace MyApp; + +class User +{ + private $id; + private $username; + private $passwordHash; + private $email; + private $address; + // ... + + public function getId() : int + { + return $this->id; + } +} +``` + +If we want to skip the property `$id` from lazy-loading, we might want to tell that to +the `LazyLoadingGhostFactory`. Here is a longer example, with a more near-real-world +scenario: + +```php +namespace MyApp; + +use ProxyManager\Factory\LazyLoadingGhostFactory; +use ProxyManager\Proxy\GhostObjectInterface; + +require_once __DIR__ . '/vendor/autoload.php'; + +$factory = new LazyLoadingGhostFactory(); +$initializer = function ( + GhostObjectInterface $ghostObject, + string $method, + array $parameters, + & $initializer, + array $properties +) { + $initializer = null; + + // note that `getId` won't initialize our proxy here + $properties["\0MyApp\\User\0username"] = $db->fetchField('users', 'username', $ghostObject->getId(); + $properties["\0MyApp\\User\0passwordHash"] = $db->fetchField('users', 'passwordHash', $ghostObject->getId(); + $properties["\0MyApp\\User\0email"] = $db->fetchField('users', 'email', $ghostObject->getId(); + $properties["\0MyApp\\User\0address"] = $db->fetchField('users', 'address', $ghostObject->getId(); + + return true; +}; +$proxyOptions = [ + 'skippedProperties' => [ + "\0MyApp\\User\0id", + ], +]; + +$instance = $factory->createProxy(User::class, $initializer, $proxyOptions); + +$idReflection = new \ReflectionProperty(User::class, 'id'); + +$idReflection->setAccessible(true); + +// write the identifier into our ghost object (assuming `setId` doesn't exist) +$idReflection->setValue($instance, 1234); +``` + +In this example, we pass a `skippedProperties` array to our proxy factory. Note the use of the `"\0"` parameter syntax as described above. ## Proxying interfaces -You can also generate proxies from an interface FQCN. By proxying an interface, you will only be able to access the -methods defined by the interface itself, even if the `wrappedObject` implements more methods. This will anyway save -some memory since the proxy won't contain any properties. +A lazy loading ghost object cannot proxy an interface directly, as it operates directly around +the state of an object. Use a [Virtual Proxy](lazy-loading-value-holder.md) for that instead. ## Tuning performance for production -See [Tuning ProxyManager for Production](https://github.com/Ocramius/ProxyManager/blob/master/docs/tuning-for-production.md). +See [Tuning ProxyManager for Production](tuning-for-production.md). diff --git a/vendor/ocramius/proxy-manager/docs/lazy-loading-value-holder.md b/vendor/ocramius/proxy-manager/docs/lazy-loading-value-holder.md index c6b503e..326ce70 100644 --- a/vendor/ocramius/proxy-manager/docs/lazy-loading-value-holder.md +++ b/vendor/ocramius/proxy-manager/docs/lazy-loading-value-holder.md @@ -1,3 +1,7 @@ +--- +title: Lazy Loading Value Holder Proxy +--- + # Lazy Loading Value Holder Proxy A lazy loading value holder proxy is a virtual proxy that wraps and lazily initializes a "real" instance of the proxied @@ -66,7 +70,7 @@ class HeavyComplexObject } public function doFoo() { - echo "OK!" + echo 'OK!'; } } ``` @@ -89,7 +93,7 @@ $initializer = function (& $wrappedObject, LazyLoadingInterface $proxy, $method, return true; // confirm that initialization occurred correctly }; -$instance = $factory->createProxy('MyApp\HeavyComplexObject', $initializer); +$proxy = $factory->createProxy('MyApp\HeavyComplexObject', $initializer); ``` You can now simply use your object as before: @@ -110,20 +114,20 @@ The initializer closure signature should be as following: * set it to your real object * @var object $proxy the instance proxy that is being initialized * @var string $method the name of the method that triggered lazy initialization - * @var string $parameters an ordered list of parameters passed to the method that + * @var array $parameters an ordered list of parameters passed to the method that * triggered initialization, indexed by parameter name * @var Closure $initializer a reference to the property that is the initializer for the * proxy. Set it to null to disable further initialization * * @return bool true on success */ -$initializer = function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) {}; +$initializer = function (& $wrappedObject, $proxy, $method, array $parameters, & $initializer) {}; ``` The initializer closure should usually be coded like following: ```php -$initializer = function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) { +$initializer = function (& $wrappedObject, $proxy, $method, array $parameters, & $initializer) { $newlyCreatedObject = new Foo(); // instantiation logic $newlyCreatedObject->setBar('baz') // instantiation logic $newlyCreatedObject->setBat('bam') // instantiation logic @@ -197,6 +201,13 @@ You can also generate proxies from an interface FQCN. By proxying an interface, methods defined by the interface itself, even if the `wrappedObject` implements more methods. This will anyway save some memory since the proxy won't contain useless inherited properties. +## Known limitations + + * methods using `func_get_args()`, `func_get_arg()` and `func_num_arg()` will not function properly + for parameters that are not part of the proxied object interface: use + [variadic arguments](http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list) + instead. + ## Tuning performance for production -See [Tuning ProxyManager for Production](https://github.com/Ocramius/ProxyManager/blob/master/docs/tuning-for-production.md). +See [Tuning ProxyManager for Production](tuning-for-production.md). diff --git a/vendor/ocramius/proxy-manager/docs/null-object.md b/vendor/ocramius/proxy-manager/docs/null-object.md index aca1739..376deed 100644 --- a/vendor/ocramius/proxy-manager/docs/null-object.md +++ b/vendor/ocramius/proxy-manager/docs/null-object.md @@ -1,3 +1,7 @@ +--- +title: Null Object Proxy +--- + # Null Object Proxy A Null Object proxy is a [null object pattern](http://en.wikipedia.org/wiki/Null_Object_pattern) implementation. @@ -9,7 +13,7 @@ In your application, when you can't return the object related to the request, th for the return value and handle the failing condition gracefully, thus generating an explosion of conditionals throughout your code. Fortunately, this seemingly-tangled situation can be sorted out simply by creating a polymorphic implementation of the domain object, which would implement the same interface as the one of the object in question, only that its methods -wouldn’t do anything, therefore offloading client code from doing repetitive checks for ugly null values when the operation +wouldn't do anything, therefore offloading client code from doing repetitive checks for ugly null values when the operation is executed. ## Usage examples @@ -24,16 +28,20 @@ class UserMapper } public function fetchById($id) { - $this->adapter->select("users", array("id" => $id)); + $this->adapter->select('users', ['id' => $id]); + if (!$row = $this->adapter->fetch()) { return null; } + return $this->createUser($row); } private function createUser(array $row) { - $user = new Entity\User($row["name"], $row["email"]); - $user->setId($row["id"]); + $user = new Entity\User($row['name'], $row['email']); + + $user->setId($row['id']); + return $user; } } @@ -62,7 +70,8 @@ class UserMapper } public function fetchById($id) { - $this->adapter->select("users", array("id" => $id)); + $this->adapter->select('users', ['id' => $id]); + return $this->createUser($this->adapter->fetch()); } @@ -72,8 +81,11 @@ class UserMapper return $factory->createProxy('Entity\User'); } - $user = new Entity\User($row["name"], $row["email"]); - $user->setId($row["id"]); + + $user = new Entity\User($row['name'], $row['email']); + + $user->setId($row['id']); + return $user; } } @@ -86,4 +98,4 @@ methods defined by the interface itself, and like with the object, the methods a ## Tuning performance for production -See [Tuning ProxyManager for Production](https://github.com/Ocramius/ProxyManager/blob/master/docs/tuning-for-production.md). +See [Tuning ProxyManager for Production](tuning-for-production.md). diff --git a/vendor/ocramius/proxy-manager/docs/remote-object.md b/vendor/ocramius/proxy-manager/docs/remote-object.md index 1e040bd..494d674 100644 --- a/vendor/ocramius/proxy-manager/docs/remote-object.md +++ b/vendor/ocramius/proxy-manager/docs/remote-object.md @@ -1,3 +1,7 @@ +--- +title: Remote Object Proxy +--- + # Remote Object Proxy The remote object implementation is a mechanism that enables an local object to control an other object on an other server. @@ -88,13 +92,20 @@ interface AdapterInterface * * @return mixed */ - public function call($wrappedClass, $method, array $params = array()); + public function call($wrappedClass, $method, array $params = []); } ``` It is very easy to create your own implementation (for RESTful web services, for example). Simply pass your own adapter instance to your factory at construction time +## Known limitations + + * methods using `func_get_args()`, `func_get_arg()` and `func_num_arg()` will not function properly + for parameters that are not part of the proxied object interface: use + [variadic arguments](http://php.net/manual/en/functions.arguments.php#functions.variable-arg-list) + instead. + ## Tuning performance for production -See [Tuning ProxyManager for Production](https://github.com/Ocramius/ProxyManager/blob/master/docs/tuning-for-production.md). +See [Tuning ProxyManager for Production](tuning-for-production.md). diff --git a/vendor/ocramius/proxy-manager/docs/tuning-for-production.md b/vendor/ocramius/proxy-manager/docs/tuning-for-production.md index 48ccf9f..66004d8 100644 --- a/vendor/ocramius/proxy-manager/docs/tuning-for-production.md +++ b/vendor/ocramius/proxy-manager/docs/tuning-for-production.md @@ -1,3 +1,7 @@ +--- +title: Tuning the ProxyManager for production +--- + ## Tuning the ProxyManager for production By default, all proxy factories generate the required proxy classes at runtime. diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Autoloader/Autoloader.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Autoloader/Autoloader.php index 91a6fc2..e33f9c4 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Autoloader/Autoloader.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Autoloader/Autoloader.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Autoloader; use ProxyManager\FileLocator\FileLocatorInterface; @@ -52,7 +54,7 @@ class Autoloader implements AutoloaderInterface /** * {@inheritDoc} */ - public function __invoke($className) + public function __invoke(string $className) : bool { if (class_exists($className, false) || ! $this->classNameInflector->isProxyClassName($className)) { return false; @@ -64,6 +66,8 @@ class Autoloader implements AutoloaderInterface return false; } + /* @noinspection PhpIncludeInspection */ + /* @noinspection UsingInclusionOnceReturnValueInspection */ return (bool) require_once $file; } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Autoloader/AutoloaderInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Autoloader/AutoloaderInterface.php index 9670f98..c110caf 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Autoloader/AutoloaderInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Autoloader/AutoloaderInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Autoloader; /** @@ -33,5 +35,5 @@ interface AutoloaderInterface * * @return bool */ - public function __invoke($className); + public function __invoke(string $className) : bool; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php index 3bf1d9a..fa84175 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Configuration.php @@ -16,12 +16,14 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager; use ProxyManager\Autoloader\Autoloader; use ProxyManager\Autoloader\AutoloaderInterface; use ProxyManager\FileLocator\FileLocator; -use ProxyManager\GeneratorStrategy\FileWriterGeneratorStrategy; +use ProxyManager\GeneratorStrategy\EvaluatingGeneratorStrategy; use ProxyManager\GeneratorStrategy\GeneratorStrategyInterface; use ProxyManager\Inflector\ClassNameInflector; use ProxyManager\Inflector\ClassNameInflectorInterface; @@ -82,37 +84,12 @@ class Configuration */ protected $classSignatureGenerator; - /** - * @deprecated deprecated since version 0.5 - * @codeCoverageIgnore - */ - public function setAutoGenerateProxies() - { - } - - /** - * @return bool - * - * @deprecated deprecated since version 0.5 - * @codeCoverageIgnore - */ - public function doesAutoGenerateProxies() - { - return true; - } - - /** - * @param AutoloaderInterface $proxyAutoloader - */ - public function setProxyAutoloader(AutoloaderInterface $proxyAutoloader) + public function setProxyAutoloader(AutoloaderInterface $proxyAutoloader) : void { $this->proxyAutoloader = $proxyAutoloader; } - /** - * @return AutoloaderInterface - */ - public function getProxyAutoloader() + public function getProxyAutoloader() : AutoloaderInterface { return $this->proxyAutoloader ?: $this->proxyAutoloader = new Autoloader( @@ -121,119 +98,75 @@ class Configuration ); } - /** - * @param string $proxiesNamespace - */ - public function setProxiesNamespace($proxiesNamespace) + public function setProxiesNamespace(string $proxiesNamespace) : void { $this->proxiesNamespace = $proxiesNamespace; } - /** - * @return string - */ - public function getProxiesNamespace() + public function getProxiesNamespace() : string { return $this->proxiesNamespace; } - /** - * @param string $proxiesTargetDir - */ - public function setProxiesTargetDir($proxiesTargetDir) + public function setProxiesTargetDir(string $proxiesTargetDir) : void { - $this->proxiesTargetDir = (string) $proxiesTargetDir; + $this->proxiesTargetDir = $proxiesTargetDir; } - /** - * @return string - */ - public function getProxiesTargetDir() + public function getProxiesTargetDir() : string { return $this->proxiesTargetDir ?: $this->proxiesTargetDir = sys_get_temp_dir(); } - /** - * @param GeneratorStrategyInterface $generatorStrategy - */ - public function setGeneratorStrategy(GeneratorStrategyInterface $generatorStrategy) + public function setGeneratorStrategy(GeneratorStrategyInterface $generatorStrategy) : void { $this->generatorStrategy = $generatorStrategy; } - /** - * @return GeneratorStrategyInterface - */ - public function getGeneratorStrategy() + public function getGeneratorStrategy() : GeneratorStrategyInterface { return $this->generatorStrategy - ?: $this->generatorStrategy = new FileWriterGeneratorStrategy( - new FileLocator($this->getProxiesTargetDir()) - ); + ?: $this->generatorStrategy = new EvaluatingGeneratorStrategy(); } - /** - * @param ClassNameInflectorInterface $classNameInflector - */ - public function setClassNameInflector(ClassNameInflectorInterface $classNameInflector) + public function setClassNameInflector(ClassNameInflectorInterface $classNameInflector) : void { $this->classNameInflector = $classNameInflector; } - /** - * @return ClassNameInflectorInterface - */ - public function getClassNameInflector() + public function getClassNameInflector() : ClassNameInflectorInterface { return $this->classNameInflector ?: $this->classNameInflector = new ClassNameInflector($this->getProxiesNamespace()); } - /** - * @param SignatureGeneratorInterface $signatureGenerator - */ - public function setSignatureGenerator(SignatureGeneratorInterface $signatureGenerator) + public function setSignatureGenerator(SignatureGeneratorInterface $signatureGenerator) : void { $this->signatureGenerator = $signatureGenerator; } - /** - * @return SignatureGeneratorInterface - */ - public function getSignatureGenerator() + public function getSignatureGenerator() : SignatureGeneratorInterface { return $this->signatureGenerator ?: $this->signatureGenerator = new SignatureGenerator(); } - /** - * @param SignatureCheckerInterface $signatureChecker - */ - public function setSignatureChecker(SignatureCheckerInterface $signatureChecker) + public function setSignatureChecker(SignatureCheckerInterface $signatureChecker) : void { $this->signatureChecker = $signatureChecker; } - /** - * @return SignatureCheckerInterface - */ - public function getSignatureChecker() + public function getSignatureChecker() : SignatureCheckerInterface { return $this->signatureChecker ?: $this->signatureChecker = new SignatureChecker($this->getSignatureGenerator()); } - /** - * @param ClassSignatureGeneratorInterface $classSignatureGenerator - */ - public function setClassSignatureGenerator(ClassSignatureGeneratorInterface $classSignatureGenerator) + public function setClassSignatureGenerator(ClassSignatureGeneratorInterface $classSignatureGenerator) : void { $this->classSignatureGenerator = $classSignatureGenerator; } - /** - * @return ClassSignatureGeneratorInterface - */ - public function getClassSignatureGenerator() + public function getClassSignatureGenerator() : ClassSignatureGeneratorInterface { return $this->classSignatureGenerator ?: new ClassSignatureGenerator($this->getSignatureGenerator()); diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/DisabledMethodException.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/DisabledMethodException.php index 42f4eda..b15773e 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/DisabledMethodException.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/DisabledMethodException.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Exception; use BadMethodCallException; @@ -30,13 +32,8 @@ class DisabledMethodException extends BadMethodCallException implements Exceptio { const NAME = __CLASS__; - /** - * @param string $method - * - * @return self - */ - public static function disabledMethod($method) + public static function disabledMethod(string $method) : self { - return new self(sprintf('Method "%s" is forcefully disabled', (string) $method)); + return new self(sprintf('Method "%s" is forcefully disabled', $method)); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/ExceptionInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/ExceptionInterface.php index 34c7d86..fe99fdc 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/ExceptionInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/ExceptionInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Exception; /** diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/FileNotWritableException.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/FileNotWritableException.php index 7d9a99f..862a980 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/FileNotWritableException.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/FileNotWritableException.php @@ -16,11 +16,10 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Exception; -use InvalidArgumentException; -use ReflectionClass; -use ReflectionMethod; use UnexpectedValueException; /** @@ -31,13 +30,7 @@ use UnexpectedValueException; */ class FileNotWritableException extends UnexpectedValueException implements ExceptionInterface { - /** - * @param string $fromPath - * @param string $toPath - * - * @return self - */ - public static function fromInvalidMoveOperation($fromPath, $toPath) + public static function fromInvalidMoveOperation(string $fromPath, string $toPath) : self { return new self(sprintf( 'Could not move file "%s" to location "%s": ' @@ -48,19 +41,26 @@ class FileNotWritableException extends UnexpectedValueException implements Excep } /** + * @deprecated this method is unused, and will be removed in ProxyManager 3.0.0 + * * @param string $path * * @return self */ - public static function fromNonWritableLocation($path) + public static function fromNonWritableLocation($path) : self { - $messages = array(); + $messages = []; + $destination = realpath($path); - if (($destination = realpath($path)) && ! is_file($destination)) { + if (! $destination) { + $messages[] = 'path does not exist'; + } + + if ($destination && ! is_file($destination)) { $messages[] = 'exists and is not a file'; } - if (! is_writable($destination)) { + if ($destination && ! is_writable($destination)) { $messages[] = 'is not writable'; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/InvalidProxiedClassException.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/InvalidProxiedClassException.php index 5dc08d1..373465b 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/InvalidProxiedClassException.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/InvalidProxiedClassException.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Exception; use InvalidArgumentException; @@ -30,32 +32,17 @@ use ReflectionMethod; */ class InvalidProxiedClassException extends InvalidArgumentException implements ExceptionInterface { - /** - * @param ReflectionClass $reflection - * - * @return self - */ - public static function interfaceNotSupported(ReflectionClass $reflection) + public static function interfaceNotSupported(ReflectionClass $reflection) : self { return new self(sprintf('Provided interface "%s" cannot be proxied', $reflection->getName())); } - /** - * @param ReflectionClass $reflection - * - * @return self - */ - public static function finalClassNotSupported(ReflectionClass $reflection) + public static function finalClassNotSupported(ReflectionClass $reflection) : self { return new self(sprintf('Provided class "%s" is final and cannot be proxied', $reflection->getName())); } - /** - * @param ReflectionClass $reflection - * - * @return self - */ - public static function abstractProtectedMethodsNotSupported(ReflectionClass $reflection) + public static function abstractProtectedMethodsNotSupported(ReflectionClass $reflection) : self { return new self(sprintf( 'Provided class "%s" has following protected abstract methods, and therefore cannot be proxied:' . "\n%s", @@ -63,12 +50,12 @@ class InvalidProxiedClassException extends InvalidArgumentException implements E implode( "\n", array_map( - function (ReflectionMethod $reflectionMethod) { + function (ReflectionMethod $reflectionMethod) : string { return $reflectionMethod->getDeclaringClass()->getName() . '::' . $reflectionMethod->getName(); }, array_filter( $reflection->getMethods(), - function (ReflectionMethod $method) { + function (ReflectionMethod $method) : bool { return $method->isAbstract() && $method->isProtected(); } ) diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/InvalidProxyDirectoryException.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/InvalidProxyDirectoryException.php index cb5d0ea..d4f7915 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/InvalidProxyDirectoryException.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/InvalidProxyDirectoryException.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Exception; use InvalidArgumentException; @@ -28,13 +30,8 @@ use InvalidArgumentException; */ class InvalidProxyDirectoryException extends InvalidArgumentException implements ExceptionInterface { - /** - * @param string $directory - * - * @return self - */ - public static function proxyDirectoryNotFound($directory) + public static function proxyDirectoryNotFound(string $directory) : self { - return new self(sprintf('Provided directory "%s" does not exist', (string) $directory)); + return new self(sprintf('Provided directory "%s" does not exist', $directory)); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/UnsupportedProxiedClassException.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/UnsupportedProxiedClassException.php index 68f8215..7f05d28 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/UnsupportedProxiedClassException.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Exception/UnsupportedProxiedClassException.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Exception; use LogicException; @@ -29,12 +31,7 @@ use ReflectionProperty; */ class UnsupportedProxiedClassException extends LogicException implements ExceptionInterface { - /** - * @param ReflectionProperty $property - * - * @return self - */ - public static function unsupportedLocalizedReflectionProperty(ReflectionProperty $property) + public static function unsupportedLocalizedReflectionProperty(ReflectionProperty $property) : self { return new self( sprintf( diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AbstractBaseFactory.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AbstractBaseFactory.php index cbc7b1a..d8a39b5 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AbstractBaseFactory.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AbstractBaseFactory.php @@ -16,10 +16,15 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory; use ProxyManager\Configuration; use ProxyManager\Generator\ClassGenerator; +use ProxyManager\ProxyGenerator\ProxyGeneratorInterface; +use ProxyManager\Signature\Exception\InvalidSignatureException; +use ProxyManager\Signature\Exception\MissingSignatureException; use ProxyManager\Version; use ReflectionClass; @@ -41,7 +46,7 @@ abstract class AbstractBaseFactory * * @var string[] */ - private $checkedClasses = array(); + private $checkedClasses = []; /** * @param \ProxyManager\Configuration $configuration @@ -53,27 +58,39 @@ abstract class AbstractBaseFactory /** * Generate a proxy from a class name - * @param string $className + * + * @param string $className + * @param mixed[] $proxyOptions + * * @return string proxy class name + * + * @throws InvalidSignatureException + * @throws MissingSignatureException + * @throws \OutOfBoundsException */ - protected function generateProxy($className) + protected function generateProxy(string $className, array $proxyOptions = []) : string { - if (isset($this->checkedClasses[$className])) { + if (\array_key_exists($className, $this->checkedClasses)) { return $this->checkedClasses[$className]; } - $proxyParameters = array( + $proxyParameters = [ 'className' => $className, 'factory' => get_class($this), - 'proxyManagerVersion' => Version::VERSION - ); + 'proxyManagerVersion' => Version::getVersion(), + ]; $proxyClassName = $this ->configuration ->getClassNameInflector() ->getProxyClassName($className, $proxyParameters); if (! class_exists($proxyClassName)) { - $this->generateProxyClass($proxyClassName, $className, $proxyParameters); + $this->generateProxyClass( + $proxyClassName, + $className, + $proxyParameters, + $proxyOptions + ); } $this @@ -84,29 +101,33 @@ abstract class AbstractBaseFactory return $this->checkedClasses[$className] = $proxyClassName; } - /** - * @return \ProxyManager\ProxyGenerator\ProxyGeneratorInterface - */ - abstract protected function getGenerator(); + abstract protected function getGenerator() : ProxyGeneratorInterface; /** * Generates the provided `$proxyClassName` from the given `$className` and `$proxyParameters` - * @param string $proxyClassName - * @param string $className - * @param array $proxyParameters * - * @return void + * @param string $proxyClassName + * @param string $className + * @param array $proxyParameters + * @param mixed[] $proxyOptions */ - private function generateProxyClass($proxyClassName, $className, array $proxyParameters) - { + private function generateProxyClass( + string $proxyClassName, + string $className, + array $proxyParameters, + array $proxyOptions = [] + ) : void { $className = $this->configuration->getClassNameInflector()->getUserClassName($className); $phpClass = new ClassGenerator($proxyClassName); - $this->getGenerator()->generate(new ReflectionClass($className), $phpClass); + $this->getGenerator()->generate(new ReflectionClass($className), $phpClass, $proxyOptions); $phpClass = $this->configuration->getClassSignatureGenerator()->addSignature($phpClass, $proxyParameters); - $this->configuration->getGeneratorStrategy()->generate($phpClass); - $this->configuration->getProxyAutoloader()->__invoke($proxyClassName); + $this->configuration->getGeneratorStrategy()->generate($phpClass, $proxyOptions); + + $autoloader = $this->configuration->getProxyAutoloader(); + + $autoloader($proxyClassName); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorScopeLocalizerFactory.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorScopeLocalizerFactory.php index 57d78e7..c6ed1e4 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorScopeLocalizerFactory.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorScopeLocalizerFactory.php @@ -16,9 +16,15 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory; +use ProxyManager\Proxy\AccessInterceptorInterface; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizerGenerator; +use ProxyManager\ProxyGenerator\ProxyGeneratorInterface; +use ProxyManager\Signature\Exception\InvalidSignatureException; +use ProxyManager\Signature\Exception\MissingSignatureException; /** * Factory responsible of producing proxy objects @@ -40,19 +46,26 @@ class AccessInterceptorScopeLocalizerFactory extends AbstractBaseFactory * @param \Closure[] $suffixInterceptors an array (indexed by method name) of interceptor closures to be called * after method logic is executed * - * @return \ProxyManager\Proxy\AccessInterceptorInterface + * @return AccessInterceptorInterface + * + * @throws InvalidSignatureException + * @throws MissingSignatureException + * @throws \OutOfBoundsException */ - public function createProxy($instance, array $prefixInterceptors = array(), array $suffixInterceptors = array()) - { + public function createProxy( + $instance, + array $prefixInterceptors = [], + array $suffixInterceptors = [] + ) : AccessInterceptorInterface { $proxyClassName = $this->generateProxy(get_class($instance)); - return new $proxyClassName($instance, $prefixInterceptors, $suffixInterceptors); + return $proxyClassName::staticProxyConstructor($instance, $prefixInterceptors, $suffixInterceptors); } /** * {@inheritDoc} */ - protected function getGenerator() + protected function getGenerator() : ProxyGeneratorInterface { return $this->generator ?: $this->generator = new AccessInterceptorScopeLocalizerGenerator(); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorValueHolderFactory.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorValueHolderFactory.php index d5ef504..a6eb6ce 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorValueHolderFactory.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/AccessInterceptorValueHolderFactory.php @@ -16,9 +16,15 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory; +use ProxyManager\Proxy\AccessInterceptorValueHolderInterface; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolderGenerator; +use ProxyManager\ProxyGenerator\ProxyGeneratorInterface; +use ProxyManager\Signature\Exception\InvalidSignatureException; +use ProxyManager\Signature\Exception\MissingSignatureException; /** * Factory responsible of producing proxy objects @@ -40,19 +46,26 @@ class AccessInterceptorValueHolderFactory extends AbstractBaseFactory * @param \Closure[] $suffixInterceptors an array (indexed by method name) of interceptor closures to be called * after method logic is executed * - * @return \ProxyManager\Proxy\AccessInterceptorInterface|\ProxyManager\Proxy\ValueHolderInterface + * @return AccessInterceptorValueHolderInterface + * + * @throws InvalidSignatureException + * @throws MissingSignatureException + * @throws \OutOfBoundsException */ - public function createProxy($instance, array $prefixInterceptors = array(), array $suffixInterceptors = array()) - { + public function createProxy( + $instance, + array $prefixInterceptors = [], + array $suffixInterceptors = [] + ) : AccessInterceptorValueHolderInterface { $proxyClassName = $this->generateProxy(get_class($instance)); - return new $proxyClassName($instance, $prefixInterceptors, $suffixInterceptors); + return $proxyClassName::staticProxyConstructor($instance, $prefixInterceptors, $suffixInterceptors); } /** * {@inheritDoc} */ - protected function getGenerator() + protected function getGenerator() : ProxyGeneratorInterface { return $this->generator ?: $this->generator = new AccessInterceptorValueHolderGenerator(); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/LazyLoadingGhostFactory.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/LazyLoadingGhostFactory.php index 73e030c..d771546 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/LazyLoadingGhostFactory.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/LazyLoadingGhostFactory.php @@ -16,19 +16,24 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory; +use Closure; +use ProxyManager\Proxy\GhostObjectInterface; use ProxyManager\ProxyGenerator\LazyLoadingGhostGenerator; +use ProxyManager\ProxyGenerator\ProxyGeneratorInterface; +use ProxyManager\Signature\Exception\InvalidSignatureException; +use ProxyManager\Signature\Exception\MissingSignatureException; /** * Factory responsible of producing ghost instances * * @author Marco Pivetta * @license MIT - * - * @method \ProxyManager\Proxy\GhostObjectInterface createProxy($className, \Closure $initializer) */ -class LazyLoadingGhostFactory extends AbstractLazyFactory +class LazyLoadingGhostFactory extends AbstractBaseFactory { /** * @var \ProxyManager\ProxyGenerator\LazyLoadingGhostGenerator|null @@ -38,8 +43,60 @@ class LazyLoadingGhostFactory extends AbstractLazyFactory /** * {@inheritDoc} */ - protected function getGenerator() + protected function getGenerator() : ProxyGeneratorInterface { return $this->generator ?: $this->generator = new LazyLoadingGhostGenerator(); } + + /** + * Creates a new lazy proxy instance of the given class with + * the given initializer + * + * Please refer to the following documentation when using this method: + * + * @link https://github.com/Ocramius/ProxyManager/blob/master/docs/lazy-loading-ghost-object.md + * + * @param string $className name of the class to be proxied + * @param Closure $initializer initializer to be passed to the proxy. The initializer closure should have following + * signature: + * + * + * $initializer = function ( + * GhostObjectInterface $proxy, + * string $method, + * array $parameters, + * & $initializer, + * array $properties + * ) {}; + * + * + * Where: + * - $proxy is the proxy instance on which the initializer is acting + * - $method is the name of the method that triggered the lazy initialization + * - $parameters are the parameters that were passed to $method + * - $initializer by-ref initializer - should be assigned null in the initializer body + * - $properties a by-ref map of the properties of the object, indexed by PHP + * internal property name. Assign values to it to initialize the + * object state + * + * @param mixed[] $proxyOptions a set of options to be used when generating the proxy. Currently supports only + * key "skippedProperties", which allows to skip lazy-loading of some properties. + * "skippedProperties" is a string[], containing a list of properties referenced + * via PHP's internal property name (i.e. "\0ClassName\0propertyName") + * + * @return GhostObjectInterface + * + * @throws MissingSignatureException + * @throws InvalidSignatureException + * @throws \OutOfBoundsException + */ + public function createProxy( + string $className, + Closure $initializer, + array $proxyOptions = [] + ) : GhostObjectInterface { + $proxyClassName = $this->generateProxy($className, $proxyOptions); + + return $proxyClassName::staticProxyConstructor($initializer); + } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/LazyLoadingValueHolderFactory.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/LazyLoadingValueHolderFactory.php index c1449be..ae75acd 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/LazyLoadingValueHolderFactory.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/LazyLoadingValueHolderFactory.php @@ -16,29 +16,41 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory; +use ProxyManager\Proxy\VirtualProxyInterface; use ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator; +use ProxyManager\ProxyGenerator\ProxyGeneratorInterface; /** * Factory responsible of producing virtual proxy instances * * @author Marco Pivetta * @license MIT - * - * @method \ProxyManager\Proxy\VirtualProxyInterface createProxy($className, \Closure $initializer) */ -class LazyLoadingValueHolderFactory extends AbstractLazyFactory +class LazyLoadingValueHolderFactory extends AbstractBaseFactory { /** * @var \ProxyManager\ProxyGenerator\LazyLoadingValueHolderGenerator|null */ private $generator; + public function createProxy( + string $className, + \Closure $initializer, + array $proxyOptions = [] + ) : VirtualProxyInterface { + $proxyClassName = $this->generateProxy($className, $proxyOptions); + + return $proxyClassName::staticProxyConstructor($initializer); + } + /** * {@inheritDoc} */ - protected function getGenerator() + protected function getGenerator() : ProxyGeneratorInterface { return $this->generator ?: $this->generator = new LazyLoadingValueHolderGenerator(); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/NullObjectFactory.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/NullObjectFactory.php index 9c605cb..150d4c0 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/NullObjectFactory.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/NullObjectFactory.php @@ -16,9 +16,15 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory; +use ProxyManager\Proxy\NullObjectInterface; use ProxyManager\ProxyGenerator\NullObjectGenerator; +use ProxyManager\ProxyGenerator\ProxyGeneratorInterface; +use ProxyManager\Signature\Exception\InvalidSignatureException; +use ProxyManager\Signature\Exception\MissingSignatureException; /** * Factory responsible of producing proxy objects @@ -36,20 +42,24 @@ class NullObjectFactory extends AbstractBaseFactory /** * @param object $instanceOrClassName the object to be wrapped or interface to transform to null object * - * @return \ProxyManager\Proxy\NullobjectInterface + * @return NullObjectInterface + * + * @throws InvalidSignatureException + * @throws MissingSignatureException + * @throws \OutOfBoundsException */ - public function createProxy($instanceOrClassName) + public function createProxy($instanceOrClassName) : NullObjectInterface { $className = is_object($instanceOrClassName) ? get_class($instanceOrClassName) : $instanceOrClassName; $proxyClassName = $this->generateProxy($className); - return new $proxyClassName(); + return $proxyClassName::staticProxyConstructor(); } /** * {@inheritDoc} */ - protected function getGenerator() + protected function getGenerator() : ProxyGeneratorInterface { return $this->generator ?: $this->generator = new NullObjectGenerator(); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/BaseAdapter.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/BaseAdapter.php index 814d327..187e40c 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/BaseAdapter.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/BaseAdapter.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory\RemoteObject\Adapter; use ProxyManager\Factory\RemoteObject\AdapterInterface; @@ -41,7 +43,7 @@ abstract class BaseAdapter implements AdapterInterface * * @var string[] */ - protected $map = array(); + protected $map = []; /** * Constructor @@ -49,7 +51,7 @@ abstract class BaseAdapter implements AdapterInterface * @param Client $client * @param array $map map of service names to their aliases */ - public function __construct(Client $client, array $map = array()) + public function __construct(Client $client, array $map = []) { $this->client = $client; $this->map = $map; @@ -58,11 +60,11 @@ abstract class BaseAdapter implements AdapterInterface /** * {@inheritDoc} */ - public function call($wrappedClass, $method, array $params = array()) + public function call(string $wrappedClass, string $method, array $params = []) { $serviceName = $this->getServiceName($wrappedClass, $method); - if (isset($this->map[$serviceName])) { + if (\array_key_exists($serviceName, $this->map)) { $serviceName = $this->map[$serviceName]; } @@ -77,5 +79,5 @@ abstract class BaseAdapter implements AdapterInterface * * @return string Service name */ - abstract protected function getServiceName($wrappedClass, $method); + abstract protected function getServiceName(string $wrappedClass, string $method) : string; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/JsonRpc.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/JsonRpc.php index aff2700..23384e0 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/JsonRpc.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/JsonRpc.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory\RemoteObject\Adapter; /** @@ -29,7 +31,7 @@ class JsonRpc extends BaseAdapter /** * {@inheritDoc} */ - protected function getServiceName($wrappedClass, $method) + protected function getServiceName(string $wrappedClass, string $method) : string { return $wrappedClass . '.' . $method; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/Soap.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/Soap.php index 69de386..66cbd0c 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/Soap.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/Soap.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory\RemoteObject\Adapter; /** @@ -29,8 +31,8 @@ class Soap extends BaseAdapter /** * {@inheritDoc} */ - protected function getServiceName($wrappedClass, $method) + protected function getServiceName(string $wrappedClass, string $method) : string { - return (string) $method; + return $method; } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/XmlRpc.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/XmlRpc.php index 0485ccd..625fbb1 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/XmlRpc.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/Adapter/XmlRpc.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory\RemoteObject\Adapter; /** @@ -29,7 +31,7 @@ class XmlRpc extends BaseAdapter /** * {@inheritDoc} */ - protected function getServiceName($wrappedClass, $method) + protected function getServiceName(string $wrappedClass, string $method) : string { return $wrappedClass . '.' . $method; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/AdapterInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/AdapterInterface.php index 4168f9d..72ee312 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/AdapterInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObject/AdapterInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory\RemoteObject; /** @@ -33,5 +35,5 @@ interface AdapterInterface * @param string $method * @param array $params */ - public function call($wrappedClass, $method, array $params = array()); + public function call(string $wrappedClass, string $method, array $params = []); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObjectFactory.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObjectFactory.php index 52778d3..ac3fc72 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObjectFactory.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Factory/RemoteObjectFactory.php @@ -16,11 +16,17 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Factory; use ProxyManager\Configuration; use ProxyManager\Factory\RemoteObject\AdapterInterface; +use ProxyManager\Proxy\RemoteObjectInterface; +use ProxyManager\ProxyGenerator\ProxyGeneratorInterface; use ProxyManager\ProxyGenerator\RemoteObjectGenerator; +use ProxyManager\Signature\Exception\InvalidSignatureException; +use ProxyManager\Signature\Exception\MissingSignatureException; /** * Factory responsible of producing remote proxy objects @@ -56,20 +62,25 @@ class RemoteObjectFactory extends AbstractBaseFactory /** * @param string|object $instanceOrClassName * - * @return \ProxyManager\Proxy\RemoteObjectInterface + * @return RemoteObjectInterface + * + * @throws InvalidSignatureException + * @throws MissingSignatureException + * @throws \OutOfBoundsException */ - public function createProxy($instanceOrClassName) + public function createProxy($instanceOrClassName) : RemoteObjectInterface { - $className = is_object($instanceOrClassName) ? get_class($instanceOrClassName) : $instanceOrClassName; - $proxyClassName = $this->generateProxy($className); + $proxyClassName = $this->generateProxy( + is_object($instanceOrClassName) ? get_class($instanceOrClassName) : $instanceOrClassName + ); - return new $proxyClassName($this->adapter); + return $proxyClassName::staticProxyConstructor($this->adapter); } /** * {@inheritDoc} */ - protected function getGenerator() + protected function getGenerator() : ProxyGeneratorInterface { return $this->generator ?: $this->generator = new RemoteObjectGenerator(); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/FileLocator/FileLocator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/FileLocator/FileLocator.php index 197595e..4473a3c 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/FileLocator/FileLocator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/FileLocator/FileLocator.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\FileLocator; use ProxyManager\Exception\InvalidProxyDirectoryException; @@ -38,19 +40,21 @@ class FileLocator implements FileLocatorInterface * * @throws \ProxyManager\Exception\InvalidProxyDirectoryException */ - public function __construct($proxiesDirectory) + public function __construct(string $proxiesDirectory) { - $this->proxiesDirectory = realpath($proxiesDirectory); + $absolutePath = realpath($proxiesDirectory); - if (false === $this->proxiesDirectory) { + if (false === $absolutePath) { throw InvalidProxyDirectoryException::proxyDirectoryNotFound($proxiesDirectory); } + + $this->proxiesDirectory = $absolutePath; } /** * {@inheritDoc} */ - public function getProxyFileName($className) + public function getProxyFileName(string $className) : string { return $this->proxiesDirectory . DIRECTORY_SEPARATOR . str_replace('\\', '', $className) . '.php'; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/FileLocator/FileLocatorInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/FileLocator/FileLocatorInterface.php index c52ac02..4535016 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/FileLocator/FileLocatorInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/FileLocator/FileLocatorInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\FileLocator; /** @@ -33,5 +35,5 @@ interface FileLocatorInterface * * @return string */ - public function getProxyFileName($className); + public function getProxyFileName(string $className) : string; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/ClassGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/ClassGenerator.php index 0304c42..6d2ae96 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/ClassGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/ClassGenerator.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Generator; use Zend\Code\Generator\ClassGenerator as ZendClassGenerator; @@ -31,7 +33,7 @@ class ClassGenerator extends ZendClassGenerator /** * {@inheritDoc} */ - public function setExtendedClass($extendedClass) + public function setExtendedClass($extendedClass) : parent { if ($extendedClass) { $extendedClass = '\\' . trim($extendedClass, '\\'); @@ -43,7 +45,7 @@ class ClassGenerator extends ZendClassGenerator /** * {@inheritDoc} */ - public function setImplementedInterfaces(array $interfaces) + public function setImplementedInterfaces(array $interfaces) : parent { foreach ($interfaces as & $interface) { $interface = '\\' . trim($interface, '\\'); diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/MagicMethodGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/MagicMethodGenerator.php index 462aa8f..328ba13 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/MagicMethodGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/MagicMethodGenerator.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Generator; use ReflectionClass; @@ -33,7 +35,7 @@ class MagicMethodGenerator extends MethodGenerator * @param string $name * @param array $parameters */ - public function __construct(ReflectionClass $originalClass, $name, array $parameters = array()) + public function __construct(ReflectionClass $originalClass, string $name, array $parameters = []) { parent::__construct( $name, diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/MethodGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/MethodGenerator.php index cffd6af..31cfc57 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/MethodGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/MethodGenerator.php @@ -16,9 +16,10 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Generator; -use Zend\Code\Generator\DocBlockGenerator; use Zend\Code\Generator\MethodGenerator as ZendMethodGenerator; use Zend\Code\Reflection\MethodReflection; @@ -31,131 +32,15 @@ use Zend\Code\Reflection\MethodReflection; class MethodGenerator extends ZendMethodGenerator { /** - * @var bool - */ - protected $returnsReference = false; - - /** - * @param boolean $returnsReference - */ - public function setReturnsReference($returnsReference) - { - $this->returnsReference = (bool) $returnsReference; - } - - /** - * @return boolean - */ - public function returnsReference() - { - return $this->returnsReference; - } - - /** - * @override enforces generation of \ProxyManager\Generator\MethodGenerator - * * {@inheritDoc} */ - public static function fromReflection(MethodReflection $reflectionMethod) + public static function fromReflection(MethodReflection $reflectionMethod) : self { /* @var $method self */ - $method = new static(); + $method = parent::fromReflection($reflectionMethod); - $method->setSourceContent($reflectionMethod->getContents(false)); - $method->setSourceDirty(false); - - if ($reflectionMethod->getDocComment() != '') { - $method->setDocBlock(DocBlockGenerator::fromReflection($reflectionMethod->getDocBlock())); - } - - $method->setFinal($reflectionMethod->isFinal()); - $method->setVisibility(self::extractVisibility($reflectionMethod)); - - foreach ($reflectionMethod->getParameters() as $reflectionParameter) { - $method->setParameter(ParameterGenerator::fromReflection($reflectionParameter)); - } - - $method->setStatic($reflectionMethod->isStatic()); - $method->setName($reflectionMethod->getName()); - $method->setBody($reflectionMethod->getBody()); - $method->setReturnsReference($reflectionMethod->returnsReference()); + $method->setInterface(false); return $method; } - - /** - * Retrieves the visibility for the given method reflection - * - * @param MethodReflection $reflectionMethod - * - * @return string - */ - private static function extractVisibility(MethodReflection $reflectionMethod) - { - if ($reflectionMethod->isPrivate()) { - return static::VISIBILITY_PRIVATE; - } - - if ($reflectionMethod->isProtected()) { - return static::VISIBILITY_PROTECTED; - } - - return static::VISIBILITY_PUBLIC; - } - - /** - * @override fixes by-reference return value in zf2's method generator - * - * {@inheritDoc} - */ - public function generate() - { - $output = ''; - $indent = $this->getIndentation(); - - if (null !== ($docBlock = $this->getDocBlock())) { - $docBlock->setIndentation($indent); - - $output .= $docBlock->generate(); - } - - $output .= $indent . $this->generateMethodDeclaration() . self::LINE_FEED . $indent . '{' . self::LINE_FEED; - - if ($this->body) { - $output .= preg_replace('#^(.+?)$#m', $indent . $indent . '$1', trim($this->body)) - . self::LINE_FEED; - } - - $output .= $indent . '}' . self::LINE_FEED; - - return $output; - } - - /** - * @return string - */ - private function generateMethodDeclaration() - { - $output = $this->generateVisibility() - . ' function ' - . (($this->returnsReference()) ? '& ' : '') - . $this->getName() . '('; - - $parameterOutput = array(); - - foreach ($this->getParameters() as $parameter) { - $parameterOutput[] = $parameter->generate(); - } - - return $output . implode(', ', $parameterOutput) . ')'; - } - - /** - * @return string - */ - private function generateVisibility() - { - return $this->isAbstract() ? 'abstract ' : (($this->isFinal()) ? 'final ' : '') - . ($this->getVisibility() . (($this->isStatic()) ? ' static' : '')); - } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ClassGeneratorUtils.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ClassGeneratorUtils.php index 62e130c..2fdddbe 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ClassGeneratorUtils.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ClassGeneratorUtils.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Generator\Util; use ReflectionClass; @@ -30,18 +32,11 @@ use Zend\Code\Generator\MethodGenerator; */ final class ClassGeneratorUtils { - /** - * @param ReflectionClass $originalClass - * @param ClassGenerator $classGenerator - * @param MethodGenerator $generatedMethod - * - * @return void|false - */ public static function addMethodIfNotFinal( ReflectionClass $originalClass, ClassGenerator $classGenerator, MethodGenerator $generatedMethod - ) { + ) : bool { $methodName = $generatedMethod->getName(); if ($originalClass->hasMethod($methodName) && $originalClass->getMethod($methodName)->isFinal()) { @@ -49,5 +44,7 @@ final class ClassGeneratorUtils } $classGenerator->addMethodFromGenerator($generatedMethod); + + return true; } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ProxiedMethodReturnExpression.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ProxiedMethodReturnExpression.php new file mode 100644 index 0000000..e7aab00 --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/ProxiedMethodReturnExpression.php @@ -0,0 +1,41 @@ + + * @license MIT + */ +final class ProxiedMethodReturnExpression +{ + public static function generate(string $returnedValueExpression, ?\ReflectionMethod $originalMethod) : string + { + if ($originalMethod && 'void' === (string) $originalMethod->getReturnType()) { + return $returnedValueExpression . ";\nreturn;"; + } + + return 'return ' . $returnedValueExpression . ';'; + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/UniqueIdentifierGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/UniqueIdentifierGenerator.php index 4bb2b77..e249f88 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/UniqueIdentifierGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Generator/Util/UniqueIdentifierGenerator.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Generator\Util; /** @@ -37,7 +39,7 @@ abstract class UniqueIdentifierGenerator * * @return string */ - public static function getIdentifier($name) + public static function getIdentifier(string $name) : string { return str_replace( '.', diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/GeneratorStrategy/BaseGeneratorStrategy.php b/vendor/ocramius/proxy-manager/src/ProxyManager/GeneratorStrategy/BaseGeneratorStrategy.php index 1e77120..781e667 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/GeneratorStrategy/BaseGeneratorStrategy.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/GeneratorStrategy/BaseGeneratorStrategy.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\GeneratorStrategy; use Zend\Code\Generator\ClassGenerator; @@ -31,7 +33,7 @@ class BaseGeneratorStrategy implements GeneratorStrategyInterface /** * {@inheritDoc} */ - public function generate(ClassGenerator $classGenerator) + public function generate(ClassGenerator $classGenerator) : string { return $classGenerator->generate(); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/GeneratorStrategy/EvaluatingGeneratorStrategy.php b/vendor/ocramius/proxy-manager/src/ProxyManager/GeneratorStrategy/EvaluatingGeneratorStrategy.php index bdb4688..4d5863d 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/GeneratorStrategy/EvaluatingGeneratorStrategy.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/GeneratorStrategy/EvaluatingGeneratorStrategy.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\GeneratorStrategy; use Zend\Code\Generator\ClassGenerator; @@ -38,7 +40,9 @@ class EvaluatingGeneratorStrategy implements GeneratorStrategyInterface */ public function __construct() { + // @codeCoverageIgnoreStart $this->canEval = ! ini_get('suhosin.executor.disable_eval'); + // @codeCoverageIgnoreEnd } /** @@ -46,21 +50,22 @@ class EvaluatingGeneratorStrategy implements GeneratorStrategyInterface * * {@inheritDoc} */ - public function generate(ClassGenerator $classGenerator) + public function generate(ClassGenerator $classGenerator) : string { $code = $classGenerator->generate(); + // @codeCoverageIgnoreStart if (! $this->canEval) { - // @codeCoverageIgnoreStart - $fileName = sys_get_temp_dir() . '/EvaluatingGeneratorStrategy.php.tmp.' . uniqid('', true); + $fileName = tempnam(sys_get_temp_dir(), 'EvaluatingGeneratorStrategy.php.tmp.'); file_put_contents($fileName, "getNamespaceName(), '\\') . '\\' . trim($classGenerator->getName(), '\\'); @@ -68,15 +72,11 @@ class FileWriterGeneratorStrategy implements GeneratorStrategyInterface try { $this->writeFile("proxyNamespace = (string) $proxyNamespace; + $this->proxyNamespace = $proxyNamespace; $this->proxyMarker = '\\' . static::PROXY_MARKER . '\\'; $this->proxyMarkerLength = strlen($this->proxyMarker); $this->parameterHasher = new ParameterHasher(); @@ -62,7 +64,7 @@ final class ClassNameInflector implements ClassNameInflectorInterface /** * {@inheritDoc} */ - public function getUserClassName($className) + public function getUserClassName(string $className) : string { $className = ltrim($className, '\\'); @@ -80,7 +82,7 @@ final class ClassNameInflector implements ClassNameInflectorInterface /** * {@inheritDoc} */ - public function getProxyClassName($className, array $options = array()) + public function getProxyClassName(string $className, array $options = []) : string { return $this->proxyNamespace . $this->proxyMarker @@ -91,7 +93,7 @@ final class ClassNameInflector implements ClassNameInflectorInterface /** * {@inheritDoc} */ - public function isProxyClassName($className) + public function isProxyClassName(string $className) : bool { return false !== strrpos($className, $this->proxyMarker); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/ClassNameInflectorInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/ClassNameInflectorInterface.php index 71fc432..7846a6e 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/ClassNameInflectorInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/ClassNameInflectorInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Inflector; /** @@ -38,7 +40,7 @@ interface ClassNameInflectorInterface * * @return string */ - public function getUserClassName($className); + public function getUserClassName(string $className) : string; /** * Retrieve the class name of the proxy for the given user-defined class name @@ -48,7 +50,7 @@ interface ClassNameInflectorInterface * * @return string */ - public function getProxyClassName($className, array $options = array()); + public function getProxyClassName(string $className, array $options = []) : string; /** * Retrieve whether the provided class name is a proxy @@ -57,5 +59,5 @@ interface ClassNameInflectorInterface * * @return bool */ - public function isProxyClassName($className); + public function isProxyClassName(string $className) : bool; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterEncoder.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterEncoder.php index a1a4b17..6b9c544 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterEncoder.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterEncoder.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Inflector\Util; /** @@ -34,7 +36,7 @@ class ParameterEncoder * * @return string */ - public function encodeParameters(array $parameters) + public function encodeParameters(array $parameters) : string { return base64_encode(serialize($parameters)); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterHasher.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterHasher.php index 970b158..420523f 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterHasher.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Inflector/Util/ParameterHasher.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Inflector\Util; /** @@ -33,7 +35,7 @@ class ParameterHasher * * @return string */ - public function hashParameters(array $parameters) + public function hashParameters(array $parameters) : string { return md5(serialize($parameters)); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorInterface.php index 49d70f2..346ec60 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy; /** @@ -34,7 +36,7 @@ interface AccessInterceptorInterface extends ProxyInterface * A prefix interceptor should have a signature like following: * * - * $prefixInterceptor = function ($proxy, $instance, $method, $params, & $returnEarly) {}; + * $interceptor = function ($proxy, $instance, string $method, array $params, & $returnEarly) {}; * * * @param string $methodName name of the intercepted method @@ -42,7 +44,7 @@ interface AccessInterceptorInterface extends ProxyInterface * * @return void */ - public function setMethodPrefixInterceptor($methodName, \Closure $prefixInterceptor = null); + public function setMethodPrefixInterceptor(string $methodName, \Closure $prefixInterceptor = null); /** * Set or remove the suffix interceptor for a method @@ -52,7 +54,7 @@ interface AccessInterceptorInterface extends ProxyInterface * A prefix interceptor should have a signature like following: * * - * $suffixInterceptor = function ($proxy, $instance, $method, $params, $returnValue, & $returnEarly) {}; + * $interceptor = function ($proxy, $instance, string $method, array $params, $returnValue, & $returnEarly) {}; * * * @param string $methodName name of the intercepted method @@ -60,5 +62,5 @@ interface AccessInterceptorInterface extends ProxyInterface * * @return void */ - public function setMethodSuffixInterceptor($methodName, \Closure $suffixInterceptor = null); + public function setMethodSuffixInterceptor(string $methodName, \Closure $suffixInterceptor = null); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorValueHolderInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorValueHolderInterface.php new file mode 100644 index 0000000..e29f30f --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/AccessInterceptorValueHolderInterface.php @@ -0,0 +1,31 @@ + + * @license MIT + */ +interface AccessInterceptorValueHolderInterface extends AccessInterceptorInterface, ValueHolderInterface +{ +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/Exception/RemoteObjectException.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/Exception/RemoteObjectException.php index 636a029..26ed44b 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/Exception/RemoteObjectException.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/Exception/RemoteObjectException.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy\Exception; use RuntimeException; diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/FallbackValueHolderInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/FallbackValueHolderInterface.php index bf4bc2a..8e80dba 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/FallbackValueHolderInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/FallbackValueHolderInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy; /** diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/GhostObjectInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/GhostObjectInterface.php index 77df518..2178411 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/GhostObjectInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/GhostObjectInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy; /** diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/LazyLoadingInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/LazyLoadingInterface.php index 1da90e6..23eda12 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/LazyLoadingInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/LazyLoadingInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy; /** @@ -34,7 +36,7 @@ interface LazyLoadingInterface extends ProxyInterface * An initializer should have a signature like following: * * - * $initializer = function (& $wrappedObject, $proxy, $method, $parameters, & $initializer) {}; + * $initializer = function (& $wrappedObject, $proxy, string $method, array $parameters, & $initializer) {}; * * * @param \Closure|null $initializer @@ -53,12 +55,12 @@ interface LazyLoadingInterface extends ProxyInterface * * @return bool true if the proxy could be initialized */ - public function initializeProxy(); + public function initializeProxy() : bool; /** * Retrieves current initialization status of the proxy * * @return bool */ - public function isProxyInitialized(); + public function isProxyInitialized() : bool; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/NullObjectInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/NullObjectInterface.php index cd41115..b14c496 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/NullObjectInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/NullObjectInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy; /** diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/ProxyInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/ProxyInterface.php index 7d402b4..61cda47 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/ProxyInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/ProxyInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy; /** diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/RemoteObjectInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/RemoteObjectInterface.php index 264fa5e..6285b56 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/RemoteObjectInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/RemoteObjectInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy; /** diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/SmartReferenceInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/SmartReferenceInterface.php index 2380b32..07eb80b 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/SmartReferenceInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/SmartReferenceInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy; /** diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/ValueHolderInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/ValueHolderInterface.php index 126d543..43ef4df 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/ValueHolderInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/ValueHolderInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy; /** diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/VirtualProxyInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/VirtualProxyInterface.php index fc108c7..fb1df60 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/VirtualProxyInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Proxy/VirtualProxyInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Proxy; /** diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/MagicWakeup.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/MagicWakeup.php index 5b7c19d..30c562a 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/MagicWakeup.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/MagicWakeup.php @@ -16,11 +16,14 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptor\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; +use ProxyManager\ProxyGenerator\Util\Properties; +use ProxyManager\ProxyGenerator\Util\UnsetPropertiesGenerator; use ReflectionClass; -use ReflectionProperty; /** * Magic `__wakeup` for lazy loading value holder objects @@ -32,19 +35,16 @@ class MagicWakeup extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass */ public function __construct(ReflectionClass $originalClass) { parent::__construct($originalClass, '__wakeup'); - /* @var $publicProperties \ReflectionProperty[] */ - $publicProperties = $originalClass->getProperties(ReflectionProperty::IS_PUBLIC); - $unsetProperties = array(); - - foreach ($publicProperties as $publicProperty) { - $unsetProperties[] = '$this->' . $publicProperty->getName(); - } - - $this->setBody($unsetProperties ? 'unset(' . implode(', ', $unsetProperties) . ");" : ''); + $this->setBody(UnsetPropertiesGenerator::generateSnippet( + Properties::fromReflectionClass($originalClass), + 'this' + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/SetMethodPrefixInterceptor.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/SetMethodPrefixInterceptor.php index 85ba613..61546cb 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/SetMethodPrefixInterceptor.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/SetMethodPrefixInterceptor.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptor\MethodGenerator; +use Closure; use ProxyManager\Generator\MethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use Zend\Code\Generator\PropertyGenerator; /** @@ -33,6 +36,10 @@ class SetMethodPrefixInterceptor extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $prefixInterceptor + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(PropertyGenerator $prefixInterceptor) { @@ -40,11 +47,11 @@ class SetMethodPrefixInterceptor extends MethodGenerator $interceptor = new ParameterGenerator('prefixInterceptor'); - $interceptor->setType('Closure'); + $interceptor->setType(Closure::class); $interceptor->setDefaultValue(null); - $this->setParameter(new ParameterGenerator('methodName')); + $this->setParameter(new ParameterGenerator('methodName', 'string')); $this->setParameter($interceptor); - $this->setDocblock('{@inheritDoc}'); + $this->setDocBlock('{@inheritDoc}'); $this->setBody('$this->' . $prefixInterceptor->getName() . '[$methodName] = $prefixInterceptor;'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/SetMethodSuffixInterceptor.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/SetMethodSuffixInterceptor.php index 74cf81f..bf92fa1 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/SetMethodSuffixInterceptor.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/MethodGenerator/SetMethodSuffixInterceptor.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptor\MethodGenerator; +use Closure; use ProxyManager\Generator\MethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use Zend\Code\Generator\PropertyGenerator; /** @@ -33,6 +36,10 @@ class SetMethodSuffixInterceptor extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $suffixInterceptor + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(PropertyGenerator $suffixInterceptor) { @@ -40,11 +47,11 @@ class SetMethodSuffixInterceptor extends MethodGenerator $interceptor = new ParameterGenerator('suffixInterceptor'); - $interceptor->setType('Closure'); + $interceptor->setType(Closure::class); $interceptor->setDefaultValue(null); - $this->setParameter(new ParameterGenerator('methodName')); + $this->setParameter(new ParameterGenerator('methodName', 'string')); $this->setParameter($interceptor); - $this->setDocblock('{@inheritDoc}'); + $this->setDocBlock('{@inheritDoc}'); $this->setBody('$this->' . $suffixInterceptor->getName() . '[$methodName] = $suffixInterceptor;'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/PropertyGenerator/MethodPrefixInterceptors.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/PropertyGenerator/MethodPrefixInterceptors.php index b9c44a2..b210472 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/PropertyGenerator/MethodPrefixInterceptors.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/PropertyGenerator/MethodPrefixInterceptors.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptor\PropertyGenerator; use ProxyManager\Generator\Util\UniqueIdentifierGenerator; @@ -31,13 +33,15 @@ class MethodPrefixInterceptors extends PropertyGenerator { /** * Constructor + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct() { parent::__construct(UniqueIdentifierGenerator::getIdentifier('methodPrefixInterceptors')); - $this->setDefaultValue(array()); + $this->setDefaultValue([]); $this->setVisibility(self::VISIBILITY_PRIVATE); - $this->setDocblock('@var \\Closure[] map of interceptors to be called per-method before execution'); + $this->setDocBlock('@var \\Closure[] map of interceptors to be called per-method before execution'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/PropertyGenerator/MethodSuffixInterceptors.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/PropertyGenerator/MethodSuffixInterceptors.php index a11d6c2..88622a8 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/PropertyGenerator/MethodSuffixInterceptors.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptor/PropertyGenerator/MethodSuffixInterceptors.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptor\PropertyGenerator; use ProxyManager\Generator\Util\UniqueIdentifierGenerator; @@ -31,13 +33,15 @@ class MethodSuffixInterceptors extends PropertyGenerator { /** * Constructor + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct() { parent::__construct(UniqueIdentifierGenerator::getIdentifier('methodSuffixInterceptors')); - $this->setDefaultValue(array()); + $this->setDefaultValue([]); $this->setVisibility(self::VISIBILITY_PRIVATE); - $this->setDocblock('@var \\Closure[] map of interceptors to be called per-method after execution'); + $this->setDocBlock('@var \\Closure[] map of interceptors to be called per-method after execution'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/BindProxyProperties.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/BindProxyProperties.php new file mode 100644 index 0000000..939a3e1 --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/BindProxyProperties.php @@ -0,0 +1,89 @@ + + * @license MIT + */ +class BindProxyProperties extends MethodGenerator +{ + /** + * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $prefixInterceptors + * @param PropertyGenerator $suffixInterceptors + */ + public function __construct( + ReflectionClass $originalClass, + PropertyGenerator $prefixInterceptors, + PropertyGenerator $suffixInterceptors + ) { + parent::__construct( + 'bindProxyProperties', + [ + new ParameterGenerator('localizedObject', $originalClass->getName()), + new ParameterGenerator('prefixInterceptors', 'array', []), + new ParameterGenerator('suffixInterceptors', 'array', []), + ], + static::FLAG_PRIVATE, + null, + "@override constructor to setup interceptors\n\n" + . "@param \\" . $originalClass->getName() . " \$localizedObject\n" + . "@param \\Closure[] \$prefixInterceptors method interceptors to be used before method logic\n" + . "@param \\Closure[] \$suffixInterceptors method interceptors to be used before method logic" + ); + + $localizedProperties = []; + + $properties = Properties::fromReflectionClass($originalClass); + + foreach ($properties->getAccessibleProperties() as $property) { + $propertyName = $property->getName(); + + $localizedProperties[] = '$this->' . $propertyName . ' = & $localizedObject->' . $propertyName . ';'; + } + + foreach ($properties->getPrivateProperties() as $property) { + $propertyName = $property->getName(); + + $localizedProperties[] = "\\Closure::bind(function () use (\$localizedObject) {\n " + . '$this->' . $propertyName . ' = & $localizedObject->' . $propertyName . ";\n" + . '}, $this, ' . var_export($property->getDeclaringClass()->getName(), true) + . ')->__invoke();'; + } + + $this->setBody( + ($localizedProperties ? implode("\n\n", $localizedProperties) . "\n\n" : '') + . '$this->' . $prefixInterceptors->getName() . " = \$prefixInterceptors;\n" + . '$this->' . $suffixInterceptors->getName() . " = \$suffixInterceptors;" + ); + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/InterceptedMethod.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/InterceptedMethod.php index 22068f7..bc452c0 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/InterceptedMethod.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/InterceptedMethod.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator; use ProxyManager\Generator\MethodGenerator; @@ -37,30 +39,31 @@ class InterceptedMethod extends MethodGenerator * @param \Zend\Code\Generator\PropertyGenerator $suffixInterceptors * * @return self + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public static function generateMethod( MethodReflection $originalMethod, PropertyGenerator $prefixInterceptors, PropertyGenerator $suffixInterceptors - ) { + ) : self { /* @var $method self */ $method = static::fromReflection($originalMethod); - $forwardedParams = array(); + $forwardedParams = []; foreach ($originalMethod->getParameters() as $parameter) { - $forwardedParams[] = '$' . $parameter->getName(); + $forwardedParams[] = ($parameter->isVariadic() ? '...' : '') . '$' . $parameter->getName(); } - $method->setDocblock('{@inheritDoc}'); - $method->setBody( - InterceptorGenerator::createInterceptedMethodBody( - '$returnValue = parent::' - . $originalMethod->getName() . '(' . implode(', ', $forwardedParams) . ');', - $method, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $method->setDocBlock('{@inheritDoc}'); + $method->setBody(InterceptorGenerator::createInterceptedMethodBody( + '$returnValue = parent::' + . $originalMethod->getName() . '(' . implode(', ', $forwardedParams) . ');', + $method, + $prefixInterceptors, + $suffixInterceptors, + $originalMethod + )); return $method; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicClone.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicClone.php index 98e9b19..1ee658c 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicClone.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicClone.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util\InterceptorGenerator; +use ProxyManager\ProxyGenerator\Util\GetMethodIfExists; use ReflectionClass; use Zend\Code\Generator\PropertyGenerator; @@ -33,6 +36,10 @@ class MagicClone extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $prefixInterceptors + * @param PropertyGenerator $suffixInterceptors */ public function __construct( ReflectionClass $originalClass, @@ -41,13 +48,14 @@ class MagicClone extends MagicMethodGenerator ) { parent::__construct($originalClass, '__clone'); - $this->setBody( - InterceptorGenerator::createInterceptedMethodBody( - $originalClass->hasMethod('__clone') ? '$returnValue = parent::__clone();' : '$returnValue = null;', - $this, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $parent = GetMethodIfExists::get($originalClass, '__clone'); + + $this->setBody(InterceptorGenerator::createInterceptedMethodBody( + $parent ? '$returnValue = parent::__clone();' : '$returnValue = null;', + $this, + $prefixInterceptors, + $suffixInterceptors, + $parent + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicGet.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicGet.php index 930b9d7..8f95e91 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicGet.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicGet.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\Util\GetMethodIfExists; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util\InterceptorGenerator; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -37,21 +40,24 @@ class MagicGet extends MagicMethodGenerator * @param ReflectionClass $originalClass * @param PropertyGenerator $prefixInterceptors * @param PropertyGenerator $suffixInterceptors + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, PropertyGenerator $prefixInterceptors, PropertyGenerator $suffixInterceptors ) { - parent::__construct($originalClass, '__get', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__get', [new ParameterGenerator('name')]); - $override = $originalClass->hasMethod('__get'); + $parent = GetMethodIfExists::get($originalClass, '__get'); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($parent ? "{@inheritDoc}\n" : '') . '@param string $name'); - if ($override) { - $callParent = '$returnValue = & parent::__get($name);'; - } else { + $callParent = '$returnValue = & parent::__get($name);'; + + if (! $parent) { $callParent = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_GET, 'name', @@ -61,13 +67,12 @@ class MagicGet extends MagicMethodGenerator ); } - $this->setBody( - InterceptorGenerator::createInterceptedMethodBody( - $callParent, - $this, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $this->setBody(InterceptorGenerator::createInterceptedMethodBody( + $callParent, + $this, + $prefixInterceptors, + $suffixInterceptors, + $parent + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicIsset.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicIsset.php index 26eb275..01774d3 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicIsset.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicIsset.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\Util\GetMethodIfExists; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util\InterceptorGenerator; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -37,21 +40,24 @@ class MagicIsset extends MagicMethodGenerator * @param ReflectionClass $originalClass * @param PropertyGenerator $prefixInterceptors * @param PropertyGenerator $suffixInterceptors + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, PropertyGenerator $prefixInterceptors, PropertyGenerator $suffixInterceptors ) { - parent::__construct($originalClass, '__isset', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__isset', [new ParameterGenerator('name')]); - $override = $originalClass->hasMethod('__isset'); + $parent = GetMethodIfExists::get($originalClass, '__isset'); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($parent ? "{@inheritDoc}\n" : '') . '@param string $name'); - if ($override) { - $callParent = '$returnValue = & parent::__isset($name);'; - } else { + $callParent = '$returnValue = & parent::__isset($name);'; + + if (! $parent) { $callParent = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_ISSET, 'name', @@ -61,13 +67,12 @@ class MagicIsset extends MagicMethodGenerator ); } - $this->setBody( - InterceptorGenerator::createInterceptedMethodBody( - $callParent, - $this, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $this->setBody(InterceptorGenerator::createInterceptedMethodBody( + $callParent, + $this, + $prefixInterceptors, + $suffixInterceptors, + $parent + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSet.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSet.php index e756207..2e1181a 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSet.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSet.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\Util\GetMethodIfExists; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util\InterceptorGenerator; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -37,6 +40,9 @@ class MagicSet extends MagicMethodGenerator * @param \ReflectionClass $originalClass * @param \Zend\Code\Generator\PropertyGenerator $prefixInterceptors * @param \Zend\Code\Generator\PropertyGenerator $suffixInterceptors + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, @@ -46,16 +52,16 @@ class MagicSet extends MagicMethodGenerator parent::__construct( $originalClass, '__set', - array(new ParameterGenerator('name'), new ParameterGenerator('value')) + [new ParameterGenerator('name'), new ParameterGenerator('value')] ); - $override = $originalClass->hasMethod('__set'); + $parent = GetMethodIfExists::get($originalClass, '__set'); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($parent ? "{@inheritDoc}\n" : '') . '@param string $name'); - if ($override) { - $callParent = '$returnValue = & parent::__set($name, $value);'; - } else { + $callParent = '$returnValue = & parent::__set($name, $value);'; + + if (! $parent) { $callParent = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_SET, 'name', @@ -65,13 +71,12 @@ class MagicSet extends MagicMethodGenerator ); } - $this->setBody( - InterceptorGenerator::createInterceptedMethodBody( - $callParent, - $this, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $this->setBody(InterceptorGenerator::createInterceptedMethodBody( + $callParent, + $this, + $prefixInterceptors, + $suffixInterceptors, + $parent + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSleep.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSleep.php index 3ea4a25..8bbd10a 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSleep.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicSleep.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util\InterceptorGenerator; +use ProxyManager\ProxyGenerator\Util\GetMethodIfExists; use ReflectionClass; use Zend\Code\Generator\PropertyGenerator; @@ -33,6 +36,10 @@ class MagicSleep extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $prefixInterceptors + * @param PropertyGenerator $suffixInterceptors */ public function __construct( ReflectionClass $originalClass, @@ -41,17 +48,16 @@ class MagicSleep extends MagicMethodGenerator ) { parent::__construct($originalClass, '__sleep'); - $callParent = $originalClass->hasMethod('__sleep') - ? '$returnValue = & parent::__sleep();' - : '$returnValue = array_keys((array) $this);'; + $parent = GetMethodIfExists::get($originalClass, '__sleep'); - $this->setBody( - InterceptorGenerator::createInterceptedMethodBody( - $callParent, - $this, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $callParent = $parent ? '$returnValue = & parent::__sleep();' : '$returnValue = array_keys((array) $this);'; + + $this->setBody(InterceptorGenerator::createInterceptedMethodBody( + $callParent, + $this, + $prefixInterceptors, + $suffixInterceptors, + $parent + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicUnset.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicUnset.php index 3d40420..26315ed 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicUnset.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/MagicUnset.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\Util\GetMethodIfExists; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util\InterceptorGenerator; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -37,21 +40,24 @@ class MagicUnset extends MagicMethodGenerator * @param ReflectionClass $originalClass * @param PropertyGenerator $prefixInterceptors * @param PropertyGenerator $suffixInterceptors + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, PropertyGenerator $prefixInterceptors, PropertyGenerator $suffixInterceptors ) { - parent::__construct($originalClass, '__unset', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__unset', [new ParameterGenerator('name')]); - $override = $originalClass->hasMethod('__unset'); + $parent = GetMethodIfExists::get($originalClass, '__unset'); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($parent ? "{@inheritDoc}\n" : '') . '@param string $name'); - if ($override) { - $callParent = '$returnValue = & parent::__unset($name);'; - } else { + $callParent = '$returnValue = & parent::__unset($name);'; + + if (! $parent) { $callParent = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_UNSET, 'name', @@ -61,13 +67,12 @@ class MagicUnset extends MagicMethodGenerator ); } - $this->setBody( - InterceptorGenerator::createInterceptedMethodBody( - $callParent, - $this, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $this->setBody(InterceptorGenerator::createInterceptedMethodBody( + $callParent, + $this, + $prefixInterceptors, + $suffixInterceptors, + $parent + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/StaticProxyConstructor.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/StaticProxyConstructor.php new file mode 100644 index 0000000..89f8da9 --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/StaticProxyConstructor.php @@ -0,0 +1,76 @@ + + * @license MIT + */ +class StaticProxyConstructor extends MethodGenerator +{ + /** + * Constructor + * + * @param ReflectionClass $originalClass + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + */ + public function __construct(ReflectionClass $originalClass) + { + parent::__construct('staticProxyConstructor', [], static::FLAG_PUBLIC | static::FLAG_STATIC); + + $localizedObject = new ParameterGenerator('localizedObject'); + $prefix = new ParameterGenerator('prefixInterceptors'); + $suffix = new ParameterGenerator('suffixInterceptors'); + + $localizedObject->setType($originalClass->getName()); + $prefix->setDefaultValue([]); + $suffix->setDefaultValue([]); + $prefix->setType('array'); + $suffix->setType('array'); + + $this->setParameter($localizedObject); + $this->setParameter($prefix); + $this->setParameter($suffix); + $this->setReturnType($originalClass->getName()); + + $this->setDocBlock( + "Constructor to setup interceptors\n\n" + . "@param \\" . $originalClass->getName() . " \$localizedObject\n" + . "@param \\Closure[] \$prefixInterceptors method interceptors to be used before method logic\n" + . "@param \\Closure[] \$suffixInterceptors method interceptors to be used before method logic\n\n" + . '@return self' + ); + $this->setBody( + 'static $reflection;' . "\n\n" + . '$reflection = $reflection ?: $reflection = new \ReflectionClass(__CLASS__);' . "\n" + . '$instance = $reflection->newInstanceWithoutConstructor();' . "\n\n" + . '$instance->bindProxyProperties($localizedObject, $prefixInterceptors, $suffixInterceptors);' . "\n\n" + . 'return $instance;' + ); + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGenerator.php index c434635..abe4d37 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizer/MethodGenerator/Util/InterceptorGenerator.php @@ -16,9 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Util; use ProxyManager\Generator\MethodGenerator; +use ProxyManager\Generator\Util\ProxiedMethodReturnExpression; use Zend\Code\Generator\PropertyGenerator; /** @@ -27,8 +30,7 @@ use Zend\Code\Generator\PropertyGenerator; * @author Marco Pivetta * @license MIT * - * @internal - this class is just here as a small utility for this component, - * don't use it in your own code + * @private - this class is just here as a small utility for this component, don't use it in your own code */ class InterceptorGenerator { @@ -39,19 +41,21 @@ class InterceptorGenerator * @param \ProxyManager\Generator\MethodGenerator $method * @param \Zend\Code\Generator\PropertyGenerator $prefixInterceptors * @param \Zend\Code\Generator\PropertyGenerator $suffixInterceptors + * @param \ReflectionMethod|null $originalMethod * * @return string */ public static function createInterceptedMethodBody( - $methodBody, + string $methodBody, MethodGenerator $method, PropertyGenerator $prefixInterceptors, - PropertyGenerator $suffixInterceptors - ) { - $name = var_export($method->getName(), true); - $prefixInterceptors = $prefixInterceptors->getName(); - $suffixInterceptors = $suffixInterceptors->getName(); - $params = array(); + PropertyGenerator $suffixInterceptors, + ?\ReflectionMethod $originalMethod + ) : string { + $name = var_export($method->getName(), true); + $prefixInterceptorsName = $prefixInterceptors->getName(); + $suffixInterceptorsName = $suffixInterceptors->getName(); + $params = []; foreach ($method->getParameters() as $parameter) { $parameterName = $parameter->getName(); @@ -60,23 +64,23 @@ class InterceptorGenerator $paramsString = 'array(' . implode(', ', $params) . ')'; - return "if (isset(\$this->$prefixInterceptors" . "[$name])) {\n" + return "if (isset(\$this->$prefixInterceptorsName" . "[$name])) {\n" . " \$returnEarly = false;\n" - . " \$prefixReturnValue = \$this->$prefixInterceptors" . "[$name]->__invoke(" + . " \$prefixReturnValue = \$this->$prefixInterceptorsName" . "[$name]->__invoke(" . "\$this, \$this, $name, $paramsString, \$returnEarly);\n\n" . " if (\$returnEarly) {\n" - . " return \$prefixReturnValue;\n" + . ' ' . ProxiedMethodReturnExpression::generate('$prefixReturnValue', $originalMethod) . "\n" . " }\n" . "}\n\n" . $methodBody . "\n\n" - . "if (isset(\$this->$suffixInterceptors" . "[$name])) {\n" + . "if (isset(\$this->$suffixInterceptorsName" . "[$name])) {\n" . " \$returnEarly = false;\n" - . " \$suffixReturnValue = \$this->$suffixInterceptors" . "[$name]->__invoke(" + . " \$suffixReturnValue = \$this->$suffixInterceptorsName" . "[$name]->__invoke(" . "\$this, \$this, $name, $paramsString, \$returnValue, \$returnEarly);\n\n" . " if (\$returnEarly) {\n" - . " return \$suffixReturnValue;\n" + . ' ' . ProxiedMethodReturnExpression::generate('$suffixReturnValue', $originalMethod) . "\n" . " }\n" . "}\n\n" - . "return \$returnValue;"; + . ProxiedMethodReturnExpression::generate('$returnValue', $originalMethod); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizerGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizerGenerator.php index b6edee3..2daa376 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizerGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorScopeLocalizerGenerator.php @@ -16,13 +16,18 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator; +use ProxyManager\Exception\InvalidProxiedClassException; use ProxyManager\Generator\Util\ClassGeneratorUtils; +use ProxyManager\Proxy\AccessInterceptorInterface; use ProxyManager\ProxyGenerator\AccessInterceptor\MethodGenerator\SetMethodPrefixInterceptor; use ProxyManager\ProxyGenerator\AccessInterceptor\MethodGenerator\SetMethodSuffixInterceptor; use ProxyManager\ProxyGenerator\AccessInterceptor\PropertyGenerator\MethodPrefixInterceptors; -use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\Constructor; +use ProxyManager\ProxyGenerator\AccessInterceptor\PropertyGenerator\MethodSuffixInterceptors; +use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\BindProxyProperties; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\InterceptedMethod; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\MagicClone; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\MagicGet; @@ -30,6 +35,7 @@ use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\ use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\MagicSet; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\MagicSleep; use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\MagicUnset; +use ProxyManager\ProxyGenerator\AccessInterceptorScopeLocalizer\MethodGenerator\StaticProxyConstructor; use ProxyManager\ProxyGenerator\Assertion\CanProxyAssertion; use ProxyManager\ProxyGenerator\Util\ProxiedMethodsFilter; use ReflectionClass; @@ -51,15 +57,19 @@ class AccessInterceptorScopeLocalizerGenerator implements ProxyGeneratorInterfac { /** * {@inheritDoc} + * + * @throws \InvalidArgumentException + * @throws InvalidProxiedClassException + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function generate(ReflectionClass $originalClass, ClassGenerator $classGenerator) { CanProxyAssertion::assertClassCanBeProxied($originalClass, false); $classGenerator->setExtendedClass($originalClass->getName()); - $classGenerator->setImplementedInterfaces(array('ProxyManager\\Proxy\\AccessInterceptorInterface')); + $classGenerator->setImplementedInterfaces([AccessInterceptorInterface::class]); $classGenerator->addPropertyFromGenerator($prefixInterceptors = new MethodPrefixInterceptors()); - $classGenerator->addPropertyFromGenerator($suffixInterceptors = new MethodPrefixInterceptors()); + $classGenerator->addPropertyFromGenerator($suffixInterceptors = new MethodSuffixInterceptors()); array_map( function (MethodGenerator $generatedMethod) use ($originalClass, $classGenerator) { @@ -67,20 +77,15 @@ class AccessInterceptorScopeLocalizerGenerator implements ProxyGeneratorInterfac }, array_merge( array_map( - function (ReflectionMethod $method) use ($prefixInterceptors, $suffixInterceptors) { - return InterceptedMethod::generateMethod( - new MethodReflection($method->getDeclaringClass()->getName(), $method->getName()), - $prefixInterceptors, - $suffixInterceptors - ); - }, + $this->buildMethodInterceptor($prefixInterceptors, $suffixInterceptors), ProxiedMethodsFilter::getProxiedMethods( $originalClass, - array('__get', '__set', '__isset', '__unset', '__clone', '__sleep') + ['__get', '__set', '__isset', '__unset', '__clone', '__sleep'] ) ), - array( - new Constructor($originalClass, $prefixInterceptors, $suffixInterceptors), + [ + new StaticProxyConstructor($originalClass), + new BindProxyProperties($originalClass, $prefixInterceptors, $suffixInterceptors), new SetMethodPrefixInterceptor($prefixInterceptors), new SetMethodSuffixInterceptor($suffixInterceptors), new MagicGet($originalClass, $prefixInterceptors, $suffixInterceptors), @@ -89,8 +94,21 @@ class AccessInterceptorScopeLocalizerGenerator implements ProxyGeneratorInterfac new MagicUnset($originalClass, $prefixInterceptors, $suffixInterceptors), new MagicSleep($originalClass, $prefixInterceptors, $suffixInterceptors), new MagicClone($originalClass, $prefixInterceptors, $suffixInterceptors), - ) + ] ) ); } + + private function buildMethodInterceptor( + MethodPrefixInterceptors $prefixInterceptors, + MethodSuffixInterceptors $suffixInterceptors + ) : callable { + return function (ReflectionMethod $method) use ($prefixInterceptors, $suffixInterceptors) : InterceptedMethod { + return InterceptedMethod::generateMethod( + new MethodReflection($method->getDeclaringClass()->getName(), $method->getName()), + $prefixInterceptors, + $suffixInterceptors + ); + }; + } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/InterceptedMethod.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/InterceptedMethod.php index e882e32..6e50d96 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/InterceptedMethod.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/InterceptedMethod.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator; use ProxyManager\Generator\MethodGenerator; @@ -38,32 +40,33 @@ class InterceptedMethod extends MethodGenerator * @param \Zend\Code\Generator\PropertyGenerator $suffixInterceptors * * @return self + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public static function generateMethod( MethodReflection $originalMethod, PropertyGenerator $valueHolderProperty, PropertyGenerator $prefixInterceptors, PropertyGenerator $suffixInterceptors - ) { + ) : self { /* @var $method self */ $method = static::fromReflection($originalMethod); - $forwardedParams = array(); + $forwardedParams = []; foreach ($originalMethod->getParameters() as $parameter) { - $forwardedParams[] = '$' . $parameter->getName(); + $forwardedParams[] = ($parameter->isVariadic() ? '...' : '') . '$' . $parameter->getName(); } - $method->setDocblock('{@inheritDoc}'); - $method->setBody( - InterceptorGenerator::createInterceptedMethodBody( - '$returnValue = $this->' . $valueHolderProperty->getName() . '->' - . $originalMethod->getName() . '(' . implode(', ', $forwardedParams) . ');', - $method, - $valueHolderProperty, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $method->setDocBlock('{@inheritDoc}'); + $method->setBody(InterceptorGenerator::createInterceptedMethodBody( + '$returnValue = $this->' . $valueHolderProperty->getName() . '->' + . $originalMethod->getName() . '(' . implode(', ', $forwardedParams) . ');', + $method, + $valueHolderProperty, + $prefixInterceptors, + $suffixInterceptors, + $originalMethod + )); return $method; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicClone.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicClone.php index 764ba77..bb4adbb 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicClone.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicClone.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; @@ -32,6 +34,11 @@ class MagicClone extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $valueHolderProperty + * @param PropertyGenerator $prefixInterceptors + * @param PropertyGenerator $suffixInterceptors */ public function __construct( ReflectionClass $originalClass, @@ -52,7 +59,7 @@ class MagicClone extends MagicMethodGenerator . "}\n\n" . "foreach (\$this->$suffix as \$key => \$value) {\n" . " \$this->$suffix" . "[\$key] = clone \$value;\n" - . "}" + . '}' ); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicGet.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicGet.php index 8096281..df47b8b 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicGet.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicGet.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\Util\GetMethodIfExists; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\Util\InterceptorGenerator; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; @@ -36,6 +39,15 @@ class MagicGet extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $valueHolder + * @param PropertyGenerator $prefixInterceptors + * @param PropertyGenerator $suffixInterceptors + * @param PublicPropertiesMap $publicProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, @@ -44,12 +56,12 @@ class MagicGet extends MagicMethodGenerator PropertyGenerator $suffixInterceptors, PublicPropertiesMap $publicProperties ) { - parent::__construct($originalClass, '__get', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__get', [new ParameterGenerator('name')]); - $override = $originalClass->hasMethod('__get'); + $parent = GetMethodIfExists::get($originalClass, '__get'); $valueHolderName = $valueHolder->getName(); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($parent ? "{@inheritDoc}\n" : '') . '@param string $name'); $callParent = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_GET, @@ -65,14 +77,13 @@ class MagicGet extends MagicMethodGenerator . "\n} else {\n $callParent\n}\n\n"; } - $this->setBody( - InterceptorGenerator::createInterceptedMethodBody( - $callParent, - $this, - $valueHolder, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $this->setBody(InterceptorGenerator::createInterceptedMethodBody( + $callParent, + $this, + $valueHolder, + $prefixInterceptors, + $suffixInterceptors, + $parent + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicIsset.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicIsset.php index 2647b35..c9e66ca 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicIsset.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicIsset.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\Util\GetMethodIfExists; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\Util\InterceptorGenerator; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; @@ -36,6 +39,14 @@ class MagicIsset extends MagicMethodGenerator { /** * Constructor + * @param ReflectionClass $originalClass + * @param PropertyGenerator $valueHolder + * @param PropertyGenerator $prefixInterceptors + * @param PropertyGenerator $suffixInterceptors + * @param PublicPropertiesMap $publicProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, @@ -44,12 +55,12 @@ class MagicIsset extends MagicMethodGenerator PropertyGenerator $suffixInterceptors, PublicPropertiesMap $publicProperties ) { - parent::__construct($originalClass, '__isset', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__isset', [new ParameterGenerator('name')]); - $override = $originalClass->hasMethod('__isset'); + $parent = GetMethodIfExists::get($originalClass, '__isset'); $valueHolderName = $valueHolder->getName(); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($parent ? "{@inheritDoc}\n" : '') . '@param string $name'); $callParent = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_ISSET, @@ -65,14 +76,13 @@ class MagicIsset extends MagicMethodGenerator . "\n} else {\n $callParent\n}\n\n"; } - $this->setBody( - InterceptorGenerator::createInterceptedMethodBody( - $callParent, - $this, - $valueHolder, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $this->setBody(InterceptorGenerator::createInterceptedMethodBody( + $callParent, + $this, + $valueHolder, + $prefixInterceptors, + $suffixInterceptors, + $parent + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicSet.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicSet.php index b443b77..61fee64 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicSet.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicSet.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\Util\GetMethodIfExists; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\Util\InterceptorGenerator; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; @@ -36,6 +39,14 @@ class MagicSet extends MagicMethodGenerator { /** * Constructor + * @param ReflectionClass $originalClass + * @param PropertyGenerator $valueHolder + * @param PropertyGenerator $prefixInterceptors + * @param PropertyGenerator $suffixInterceptors + * @param PublicPropertiesMap $publicProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, @@ -47,13 +58,13 @@ class MagicSet extends MagicMethodGenerator parent::__construct( $originalClass, '__set', - array(new ParameterGenerator('name'), new ParameterGenerator('value')) + [new ParameterGenerator('name'), new ParameterGenerator('value')] ); - $override = $originalClass->hasMethod('__set'); + $parent = GetMethodIfExists::get($originalClass, '__set'); $valueHolderName = $valueHolder->getName(); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($parent ? "{@inheritDoc}\n" : '') . '@param string $name'); $callParent = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_SET, @@ -69,14 +80,13 @@ class MagicSet extends MagicMethodGenerator . "\n} else {\n $callParent\n}\n\n"; } - $this->setBody( - InterceptorGenerator::createInterceptedMethodBody( - $callParent, - $this, - $valueHolder, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $this->setBody(InterceptorGenerator::createInterceptedMethodBody( + $callParent, + $this, + $valueHolder, + $prefixInterceptors, + $suffixInterceptors, + $parent + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicUnset.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicUnset.php index bdf3a1a..9fb6a3e 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicUnset.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/MagicUnset.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\Util\GetMethodIfExists; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\Util\InterceptorGenerator; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; @@ -36,6 +39,14 @@ class MagicUnset extends MagicMethodGenerator { /** * Constructor + * @param ReflectionClass $originalClass + * @param PropertyGenerator $valueHolder + * @param PropertyGenerator $prefixInterceptors + * @param PropertyGenerator $suffixInterceptors + * @param PublicPropertiesMap $publicProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, @@ -44,12 +55,12 @@ class MagicUnset extends MagicMethodGenerator PropertyGenerator $suffixInterceptors, PublicPropertiesMap $publicProperties ) { - parent::__construct($originalClass, '__unset', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__unset', [new ParameterGenerator('name')]); - $override = $originalClass->hasMethod('__unset'); + $parent = GetMethodIfExists::get($originalClass, '__unset'); $valueHolderName = $valueHolder->getName(); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($parent ? "{@inheritDoc}\n" : '') . '@param string $name'); $callParent = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_UNSET, @@ -67,14 +78,13 @@ class MagicUnset extends MagicMethodGenerator $callParent .= '$returnValue = false;'; - $this->setBody( - InterceptorGenerator::createInterceptedMethodBody( - $callParent, - $this, - $valueHolder, - $prefixInterceptors, - $suffixInterceptors - ) - ); + $this->setBody(InterceptorGenerator::createInterceptedMethodBody( + $callParent, + $this, + $valueHolder, + $prefixInterceptors, + $suffixInterceptors, + $parent + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/StaticProxyConstructor.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/StaticProxyConstructor.php new file mode 100644 index 0000000..78be69b --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/StaticProxyConstructor.php @@ -0,0 +1,88 @@ + + * @license MIT + */ +class StaticProxyConstructor extends MethodGenerator +{ + /** + * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $valueHolder + * @param PropertyGenerator $prefixInterceptors + * @param PropertyGenerator $suffixInterceptors + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + */ + public function __construct( + ReflectionClass $originalClass, + PropertyGenerator $valueHolder, + PropertyGenerator $prefixInterceptors, + PropertyGenerator $suffixInterceptors + ) { + parent::__construct('staticProxyConstructor', [], static::FLAG_PUBLIC | static::FLAG_STATIC); + + $prefix = new ParameterGenerator('prefixInterceptors'); + $suffix = new ParameterGenerator('suffixInterceptors'); + + $prefix->setDefaultValue([]); + $suffix->setDefaultValue([]); + $prefix->setType('array'); + $suffix->setType('array'); + + $this->setParameter(new ParameterGenerator('wrappedObject')); + $this->setParameter($prefix); + $this->setParameter($suffix); + $this->setReturnType($originalClass->getName()); + + $this->setDocBlock( + "Constructor to setup interceptors\n\n" + . "@param \\" . $originalClass->getName() . " \$wrappedObject\n" + . "@param \\Closure[] \$prefixInterceptors method interceptors to be used before method logic\n" + . "@param \\Closure[] \$suffixInterceptors method interceptors to be used before method logic\n\n" + . '@return self' + ); + + $this->setBody( + 'static $reflection;' . "\n\n" + . '$reflection = $reflection ?: $reflection = new \ReflectionClass(__CLASS__);' . "\n" + . '$instance = (new \ReflectionClass(get_class()))->newInstanceWithoutConstructor();' . "\n\n" + . UnsetPropertiesGenerator::generateSnippet(Properties::fromReflectionClass($originalClass), 'instance') + . '$instance->' . $valueHolder->getName() . " = \$wrappedObject;\n" + . '$instance->' . $prefixInterceptors->getName() . " = \$prefixInterceptors;\n" + . '$instance->' . $suffixInterceptors->getName() . " = \$suffixInterceptors;\n\n" + . 'return $instance;' + ); + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGenerator.php index 0a6f58a..3996c19 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolder/MethodGenerator/Util/InterceptorGenerator.php @@ -16,9 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\Util; use ProxyManager\Generator\MethodGenerator; +use ProxyManager\Generator\Util\ProxiedMethodReturnExpression; use Zend\Code\Generator\PropertyGenerator; /** @@ -27,8 +30,7 @@ use Zend\Code\Generator\PropertyGenerator; * @author Marco Pivetta * @license MIT * - * @internal - this class is just here as a small utility for this component, - * don't use it in your own code + * @private - this class is just here as a small utility for this component, don't use it in your own code */ class InterceptorGenerator { @@ -40,21 +42,23 @@ class InterceptorGenerator * @param \Zend\Code\Generator\PropertyGenerator $valueHolder * @param \Zend\Code\Generator\PropertyGenerator $prefixInterceptors * @param \Zend\Code\Generator\PropertyGenerator $suffixInterceptors + * @param \ReflectionMethod|null $originalMethod * * @return string */ public static function createInterceptedMethodBody( - $methodBody, + string $methodBody, MethodGenerator $method, PropertyGenerator $valueHolder, PropertyGenerator $prefixInterceptors, - PropertyGenerator $suffixInterceptors - ) { - $name = var_export($method->getName(), true); - $valueHolder = $valueHolder->getName(); - $prefixInterceptors = $prefixInterceptors->getName(); - $suffixInterceptors = $suffixInterceptors->getName(); - $params = array(); + PropertyGenerator $suffixInterceptors, + ?\ReflectionMethod $originalMethod + ) : string { + $name = var_export($method->getName(), true); + $valueHolderName = $valueHolder->getName(); + $prefixInterceptorsName = $prefixInterceptors->getName(); + $suffixInterceptorsName = $suffixInterceptors->getName(); + $params = []; foreach ($method->getParameters() as $parameter) { $parameterName = $parameter->getName(); @@ -63,23 +67,23 @@ class InterceptorGenerator $paramsString = 'array(' . implode(', ', $params) . ')'; - return "if (isset(\$this->$prefixInterceptors" . "[$name])) {\n" + return "if (isset(\$this->$prefixInterceptorsName" . "[$name])) {\n" . " \$returnEarly = false;\n" - . " \$prefixReturnValue = \$this->$prefixInterceptors" . "[$name]->__invoke(" - . "\$this, \$this->$valueHolder, $name, $paramsString, \$returnEarly);\n\n" + . " \$prefixReturnValue = \$this->$prefixInterceptorsName" . "[$name]->__invoke(" + . "\$this, \$this->$valueHolderName, $name, $paramsString, \$returnEarly);\n\n" . " if (\$returnEarly) {\n" - . " return \$prefixReturnValue;\n" + . ' ' . ProxiedMethodReturnExpression::generate('$prefixReturnValue', $originalMethod) . "\n" . " }\n" . "}\n\n" . $methodBody . "\n\n" - . "if (isset(\$this->$suffixInterceptors" . "[$name])) {\n" + . "if (isset(\$this->$suffixInterceptorsName" . "[$name])) {\n" . " \$returnEarly = false;\n" - . " \$suffixReturnValue = \$this->$suffixInterceptors" . "[$name]->__invoke(" - . "\$this, \$this->$valueHolder, $name, $paramsString, \$returnValue, \$returnEarly);\n\n" + . " \$suffixReturnValue = \$this->$suffixInterceptorsName" . "[$name]->__invoke(" + . "\$this, \$this->$valueHolderName, $name, $paramsString, \$returnValue, \$returnEarly);\n\n" . " if (\$returnEarly) {\n" - . " return \$suffixReturnValue;\n" + . ' ' . ProxiedMethodReturnExpression::generate('$suffixReturnValue', $originalMethod) . "\n" . " }\n" . "}\n\n" - . "return \$returnValue;"; + . ProxiedMethodReturnExpression::generate('$returnValue', $originalMethod); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolderGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolderGenerator.php index 4b05549..eb00bc1 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolderGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/AccessInterceptorValueHolderGenerator.php @@ -16,25 +16,31 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator; +use ProxyManager\Exception\InvalidProxiedClassException; use ProxyManager\Generator\Util\ClassGeneratorUtils; +use ProxyManager\Proxy\AccessInterceptorValueHolderInterface; use ProxyManager\ProxyGenerator\AccessInterceptor\MethodGenerator\MagicWakeup; use ProxyManager\ProxyGenerator\AccessInterceptor\MethodGenerator\SetMethodPrefixInterceptor; use ProxyManager\ProxyGenerator\AccessInterceptor\MethodGenerator\SetMethodSuffixInterceptor; use ProxyManager\ProxyGenerator\AccessInterceptor\PropertyGenerator\MethodPrefixInterceptors; use ProxyManager\ProxyGenerator\AccessInterceptor\PropertyGenerator\MethodSuffixInterceptors; -use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\Constructor; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\InterceptedMethod; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\MagicClone; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\MagicGet; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\MagicIsset; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\MagicSet; use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\MagicUnset; +use ProxyManager\ProxyGenerator\AccessInterceptorValueHolder\MethodGenerator\StaticProxyConstructor; use ProxyManager\ProxyGenerator\Assertion\CanProxyAssertion; use ProxyManager\ProxyGenerator\LazyLoadingValueHolder\PropertyGenerator\ValueHolderProperty; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; +use ProxyManager\ProxyGenerator\Util\Properties; use ProxyManager\ProxyGenerator\Util\ProxiedMethodsFilter; +use ProxyManager\ProxyGenerator\ValueHolder\MethodGenerator\Constructor; use ProxyManager\ProxyGenerator\ValueHolder\MethodGenerator\GetWrappedValueHolderValue; use ProxyManager\ProxyGenerator\ValueHolder\MethodGenerator\MagicSleep; use ReflectionClass; @@ -56,16 +62,17 @@ class AccessInterceptorValueHolderGenerator implements ProxyGeneratorInterface { /** * {@inheritDoc} + * + * @throws \InvalidArgumentException + * @throws InvalidProxiedClassException + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function generate(ReflectionClass $originalClass, ClassGenerator $classGenerator) { CanProxyAssertion::assertClassCanBeProxied($originalClass); - $publicProperties = new PublicPropertiesMap($originalClass); - $interfaces = array( - 'ProxyManager\\Proxy\\AccessInterceptorInterface', - 'ProxyManager\\Proxy\\ValueHolderInterface', - ); + $publicProperties = new PublicPropertiesMap(Properties::fromReflectionClass($originalClass)); + $interfaces = [AccessInterceptorValueHolderInterface::class]; if ($originalClass->isInterface()) { $interfaces[] = $originalClass->getName(); @@ -85,18 +92,12 @@ class AccessInterceptorValueHolderGenerator implements ProxyGeneratorInterface }, array_merge( array_map( - function (ReflectionMethod $method) use ($prefixInterceptors, $suffixInterceptors, $valueHolder) { - return InterceptedMethod::generateMethod( - new MethodReflection($method->getDeclaringClass()->getName(), $method->getName()), - $valueHolder, - $prefixInterceptors, - $suffixInterceptors - ); - }, + $this->buildMethodInterceptor($prefixInterceptors, $suffixInterceptors, $valueHolder), ProxiedMethodsFilter::getProxiedMethods($originalClass) ), - array( - new Constructor($originalClass, $valueHolder, $prefixInterceptors, $suffixInterceptors), + [ + Constructor::generateMethod($originalClass, $valueHolder), + new StaticProxyConstructor($originalClass, $valueHolder, $prefixInterceptors, $suffixInterceptors), new GetWrappedValueHolderValue($valueHolder), new SetMethodPrefixInterceptor($prefixInterceptors), new SetMethodSuffixInterceptor($suffixInterceptors), @@ -130,9 +131,24 @@ class AccessInterceptorValueHolderGenerator implements ProxyGeneratorInterface ), new MagicClone($originalClass, $valueHolder, $prefixInterceptors, $suffixInterceptors), new MagicSleep($originalClass, $valueHolder), - new MagicWakeup($originalClass, $valueHolder), - ) + new MagicWakeup($originalClass), + ] ) ); } + + private function buildMethodInterceptor( + MethodPrefixInterceptors $prefixes, + MethodSuffixInterceptors $suffixes, + ValueHolderProperty $valueHolder + ) : callable { + return function (ReflectionMethod $method) use ($prefixes, $suffixes, $valueHolder) : InterceptedMethod { + return InterceptedMethod::generateMethod( + new MethodReflection($method->getDeclaringClass()->getName(), $method->getName()), + $valueHolder, + $prefixes, + $suffixes + ); + }; + } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Assertion/CanProxyAssertion.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Assertion/CanProxyAssertion.php index 213e15d..16210b6 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Assertion/CanProxyAssertion.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Assertion/CanProxyAssertion.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\Assertion; use BadMethodCallException; @@ -47,7 +49,7 @@ final class CanProxyAssertion * * @throws InvalidProxiedClassException */ - public static function assertClassCanBeProxied(ReflectionClass $originalClass, $allowInterfaces = true) + public static function assertClassCanBeProxied(ReflectionClass $originalClass, bool $allowInterfaces = true) : void { self::isNotFinal($originalClass); self::hasNoAbstractProtectedMethods($originalClass); @@ -62,7 +64,7 @@ final class CanProxyAssertion * * @throws InvalidProxiedClassException */ - private static function isNotFinal(ReflectionClass $originalClass) + private static function isNotFinal(ReflectionClass $originalClass) : void { if ($originalClass->isFinal()) { throw InvalidProxiedClassException::finalClassNotSupported($originalClass); @@ -74,11 +76,11 @@ final class CanProxyAssertion * * @throws InvalidProxiedClassException */ - private static function hasNoAbstractProtectedMethods(ReflectionClass $originalClass) + private static function hasNoAbstractProtectedMethods(ReflectionClass $originalClass) : void { $protectedAbstract = array_filter( $originalClass->getMethods(), - function (ReflectionMethod $method) { + function (ReflectionMethod $method) : bool { return $method->isAbstract() && $method->isProtected(); } ); @@ -93,7 +95,7 @@ final class CanProxyAssertion * * @throws InvalidProxiedClassException */ - private static function isNotInterface(ReflectionClass $originalClass) + private static function isNotInterface(ReflectionClass $originalClass) : void { if ($originalClass->isInterface()) { throw InvalidProxiedClassException::interfaceNotSupported($originalClass); diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoading/MethodGenerator/StaticProxyConstructor.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoading/MethodGenerator/StaticProxyConstructor.php new file mode 100644 index 0000000..5d0320f --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoading/MethodGenerator/StaticProxyConstructor.php @@ -0,0 +1,61 @@ + + * @license MIT + */ +class StaticProxyConstructor extends MethodGenerator +{ + /** + * Static constructor + * + * @param PropertyGenerator $initializerProperty + * @param Properties $properties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + */ + public function __construct(PropertyGenerator $initializerProperty, Properties $properties) + { + parent::__construct('staticProxyConstructor', [], static::FLAG_PUBLIC | static::FLAG_STATIC); + + $this->setParameter(new ParameterGenerator('initializer')); + + $this->setDocBlock("Constructor for lazy initialization\n\n@param \\Closure|null \$initializer"); + $this->setBody( + 'static $reflection;' . "\n\n" + . '$reflection = $reflection ?: $reflection = new \ReflectionClass(__CLASS__);' . "\n" + . '$instance = (new \ReflectionClass(get_class()))->newInstanceWithoutConstructor();' . "\n\n" + . UnsetPropertiesGenerator::generateSnippet($properties, 'instance') + . '$instance->' . $initializerProperty->getName() . ' = $initializer;' . "\n\n" + . 'return $instance;' + ); + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/CallInitializer.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/CallInitializer.php index 36f2794..92b7013 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/CallInitializer.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/CallInitializer.php @@ -16,11 +16,15 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\Generator\Util\UniqueIdentifierGenerator; +use ProxyManager\ProxyGenerator\Util\Properties; +use ReflectionProperty; use Zend\Code\Generator\PropertyGenerator; /** @@ -34,34 +38,160 @@ class CallInitializer extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $initializerProperty + * @param PropertyGenerator $initTracker + * @param Properties $properties */ public function __construct( PropertyGenerator $initializerProperty, - PropertyGenerator $publicPropsDefaults, - PropertyGenerator $initTracker + PropertyGenerator $initTracker, + Properties $properties ) { - parent::__construct(UniqueIdentifierGenerator::getIdentifier('callInitializer')); - $this->setDocblock("Triggers initialization logic for this ghost object"); + $docBlock = <<<'DOCBLOCK' +Triggers initialization logic for this ghost object - $this->setParameters(array( - new ParameterGenerator('methodName'), - new ParameterGenerator('parameters', 'array'), - )); +@param string $methodName +@param mixed[] $parameters - $this->setVisibility(static::VISIBILITY_PRIVATE); +@return mixed +DOCBLOCK; + + parent::__construct( + UniqueIdentifierGenerator::getIdentifier('callInitializer'), + [ + new ParameterGenerator('methodName'), + new ParameterGenerator('parameters', 'array'), + ], + static::FLAG_PRIVATE, + null, + $docBlock + ); $initializer = $initializerProperty->getName(); $initialization = $initTracker->getName(); - $this->setBody( - 'if ($this->' . $initialization . ' || ! $this->' . $initializer . ') {' . "\n return;\n}\n\n" - . "\$this->" . $initialization . " = true;\n\n" - . "foreach (self::\$" . $publicPropsDefaults->getName() . " as \$key => \$default) {\n" - . " \$this->\$key = \$default;\n" - . "}\n\n" - . '$this->' . $initializer . '->__invoke' - . '($this, $methodName, $parameters, $this->' . $initializer . ');' . "\n\n" - . "\$this->" . $initialization . " = false;" + $bodyTemplate = <<<'PHP' +if ($this->%s || ! $this->%s) { + return; +} + +$this->%s = true; + +%s +%s + +$result = $this->%s->__invoke($this, $methodName, $parameters, $this->%s, $properties); +$this->%s = false; + +return $result; +PHP; + + $this->setBody(sprintf( + $bodyTemplate, + $initialization, + $initializer, + $initialization, + $this->propertiesInitializationCode($properties), + $this->propertiesReferenceArrayCode($properties), + $initializer, + $initializer, + $initialization + )); + } + + private function propertiesInitializationCode(Properties $properties) : string + { + $assignments = []; + + foreach ($properties->getAccessibleProperties() as $property) { + $assignments[] = '$this->' + . $property->getName() + . ' = ' . $this->getExportedPropertyDefaultValue($property) + . ';'; + } + + foreach ($properties->getGroupedPrivateProperties() as $className => $privateProperties) { + $cacheKey = 'cache' . str_replace('\\', '_', $className); + $assignments[] = 'static $' . $cacheKey . ";\n\n" + . '$' . $cacheKey . ' ?: $' . $cacheKey . " = \\Closure::bind(function (\$instance) {\n" + . $this->getPropertyDefaultsAssignments($privateProperties) . "\n" + . '}, null, ' . var_export($className, true) . ");\n\n" + . '$' . $cacheKey . "(\$this);\n\n"; + } + + return implode("\n", $assignments) . "\n\n"; + } + + /** + * @param ReflectionProperty[] $properties + * + * @return string + */ + private function getPropertyDefaultsAssignments(array $properties) : string + { + return implode( + "\n", + array_map( + function (ReflectionProperty $property) : string { + return ' $instance->' . $property->getName() + . ' = ' . $this->getExportedPropertyDefaultValue($property) . ';'; + }, + $properties + ) ); } + + private function propertiesReferenceArrayCode(Properties $properties) : string + { + $assignments = []; + + foreach ($properties->getAccessibleProperties() as $propertyInternalName => $property) { + $assignments[] = ' ' + . var_export($propertyInternalName, true) . ' => & $this->' . $property->getName() + . ','; + } + + $code = "\$properties = [\n" . implode("\n", $assignments) . "\n];\n\n"; + + // must use assignments, as direct reference during array definition causes a fatal error (not sure why) + foreach ($properties->getGroupedPrivateProperties() as $className => $classPrivateProperties) { + $cacheKey = 'cacheFetch' . str_replace('\\', '_', $className); + + $code .= 'static $' . $cacheKey . ";\n\n" + . '$' . $cacheKey . ' ?: $' . $cacheKey + . " = \\Closure::bind(function (\$instance, array & \$properties) {\n" + . $this->generatePrivatePropertiesAssignmentsCode($classPrivateProperties) + . "}, \$this, " . var_export($className, true) . ");\n\n" + . '$' . $cacheKey . "(\$this, \$properties);"; + } + + return $code; + } + + /** + * @param ReflectionProperty[] $properties indexed by internal name + * + * @return string + */ + private function generatePrivatePropertiesAssignmentsCode(array $properties) : string + { + $code = ''; + + foreach ($properties as $property) { + $key = "\0" . $property->getDeclaringClass()->getName() . "\0" . $property->getName(); + $code .= ' $properties[' . var_export($key, true) . '] = ' + . '& $instance->' . $property->getName() . ";\n"; + } + + return $code; + } + + private function getExportedPropertyDefaultValue(ReflectionProperty $property) : string + { + $name = $property->getName(); + $defaults = $property->getDeclaringClass()->getDefaultProperties(); + + return var_export($defaults[$name] ?? null, true); + } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/GetProxyInitializer.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/GetProxyInitializer.php index 5b1d75a..5e7370b 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/GetProxyInitializer.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/GetProxyInitializer.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MethodGenerator; @@ -32,11 +34,15 @@ class GetProxyInitializer extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $initializerProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(PropertyGenerator $initializerProperty) { parent::__construct('getProxyInitializer'); - $this->setDocblock('{@inheritDoc}'); + $this->setDocBlock('{@inheritDoc}'); $this->setBody('return $this->' . $initializerProperty->getName() . ';'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/InitializeProxy.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/InitializeProxy.php index 90723c3..eccef15 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/InitializeProxy.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/InitializeProxy.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MethodGenerator; @@ -33,15 +35,21 @@ class InitializeProxy extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $initializerProperty + * @param ZendMethodGenerator $callInitializer + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(PropertyGenerator $initializerProperty, ZendMethodGenerator $callInitializer) { parent::__construct('initializeProxy'); - $this->setDocblock('{@inheritDoc}'); + $this->setDocBlock('{@inheritDoc}'); + $this->setReturnType('bool'); $this->setBody( 'return $this->' . $initializerProperty->getName() . ' && $this->' . $callInitializer->getName() - . '(\'initializeProxy\', array());' + . '(\'initializeProxy\', []);' ); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/IsProxyInitialized.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/IsProxyInitialized.php index 110ef31..00d95a9 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/IsProxyInitialized.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/IsProxyInitialized.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MethodGenerator; @@ -32,11 +34,16 @@ class IsProxyInitialized extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $initializerProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(PropertyGenerator $initializerProperty) { parent::__construct('isProxyInitialized'); - $this->setDocblock('{@inheritDoc}'); + $this->setDocBlock('{@inheritDoc}'); + $this->setReturnType('bool'); $this->setBody('return ! $this->' . $initializerProperty->getName() . ';'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicClone.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicClone.php index 34d999b..2a76f35 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicClone.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicClone.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; @@ -33,6 +35,10 @@ class MagicClone extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param MethodGenerator $callInitializer */ public function __construct( ReflectionClass $originalClass, @@ -43,7 +49,7 @@ class MagicClone extends MagicMethodGenerator $this->setBody( '$this->' . $initializerProperty->getName() . ' && $this->' . $callInitializer->getName() - . '(\'__clone\', array());' + . '(\'__clone\', []);' . ($originalClass->hasMethod('__clone') ? "\n\nparent::__clone();" : '') ); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicGet.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicGet.php index 007b659..b02c6d9 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicGet.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicGet.php @@ -16,10 +16,15 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\InitializationTracker; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\PrivatePropertiesMap; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\ProtectedPropertiesMap; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -35,43 +40,120 @@ use Zend\Code\Generator\PropertyGenerator; class MagicGet extends MagicMethodGenerator { /** - * @param \ReflectionClass $originalClass - * @param \Zend\Code\Generator\PropertyGenerator $initializerProperty - * @param \Zend\Code\Generator\MethodGenerator $callInitializer - * @param \ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap $publicProperties + * @var string + */ + private $callParentTemplate = <<<'PHP' +$this->%s && ! $this->%s && $this->%s('__get', array('name' => $name)); + +if (isset(self::$%s[$name])) { + return $this->$name; +} + +if (isset(self::$%s[$name])) { + if ($this->%s) { + return $this->$name; + } + + // check protected property access via compatible class + $callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $caller = isset($callers[1]) ? $callers[1] : []; + $object = isset($caller['object']) ? $caller['object'] : ''; + $expectedType = self::$%s[$name]; + + if ($object instanceof $expectedType) { + return $this->$name; + } + + $class = isset($caller['class']) ? $caller['class'] : ''; + + if ($class === $expectedType || is_subclass_of($class, $expectedType) || $class === 'ReflectionProperty') { + return $this->$name; + } +} elseif (isset(self::$%s[$name])) { + // check private property access via same class + $callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $caller = isset($callers[1]) ? $callers[1] : []; + $class = isset($caller['class']) ? $caller['class'] : ''; + + static $accessorCache = []; + + if (isset(self::$%s[$name][$class])) { + $cacheKey = $class . '#' . $name; + $accessor = isset($accessorCache[$cacheKey]) + ? $accessorCache[$cacheKey] + : $accessorCache[$cacheKey] = \Closure::bind(function & ($instance) use ($name) { + return $instance->$name; + }, null, $class); + + return $accessor($this); + } + + if ($this->%s || 'ReflectionProperty' === $class) { + $tmpClass = key(self::$%s[$name]); + $cacheKey = $tmpClass . '#' . $name; + $accessor = isset($accessorCache[$cacheKey]) + ? $accessorCache[$cacheKey] + : $accessorCache[$cacheKey] = \Closure::bind(function & ($instance) use ($name) { + return $instance->$name; + }, null, $tmpClass); + + return $accessor($this); + } +} + +%s +PHP; + + /** + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param MethodGenerator $callInitializer + * @param PublicPropertiesMap $publicProperties + * @param ProtectedPropertiesMap $protectedProperties + * @param PrivatePropertiesMap $privateProperties + * @param InitializationTracker $initializationTracker + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, PropertyGenerator $initializerProperty, MethodGenerator $callInitializer, - PublicPropertiesMap $publicProperties + PublicPropertiesMap $publicProperties, + ProtectedPropertiesMap $protectedProperties, + PrivatePropertiesMap $privateProperties, + InitializationTracker $initializationTracker ) { - parent::__construct($originalClass, '__get', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__get', [new ParameterGenerator('name')]); - $override = $originalClass->hasMethod('__get'); - $callParent = ''; + $override = $originalClass->hasMethod('__get'); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); - if (! $publicProperties->isEmpty()) { - $callParent = 'if (isset(self::$' . $publicProperties->getName() . "[\$name])) {\n" - . ' return $this->$name;' - . "\n}\n\n"; - } + $parentAccess = 'return parent::__get($name);'; - if ($override) { - $callParent .= 'return parent::__get($name);'; - } else { - $callParent .= PublicScopeSimulator::getPublicAccessSimulationCode( + if (! $override) { + $parentAccess = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_GET, 'name' ); } - $this->setBody( - '$this->' . $initializerProperty->getName() . ' && $this->' . $callInitializer->getName() - . '(\'__get\', array(\'name\' => $name));' - . "\n\n" . $callParent - ); + $this->setBody(sprintf( + $this->callParentTemplate, + $initializerProperty->getName(), + $initializationTracker->getName(), + $callInitializer->getName(), + $publicProperties->getName(), + $protectedProperties->getName(), + $initializationTracker->getName(), + $protectedProperties->getName(), + $privateProperties->getName(), + $privateProperties->getName(), + $initializationTracker->getName(), + $privateProperties->getName(), + $parentAccess + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicIsset.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicIsset.php index 84c77fa..516fd7b 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicIsset.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicIsset.php @@ -16,10 +16,14 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\PrivatePropertiesMap; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\ProtectedPropertiesMap; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -35,43 +39,110 @@ use Zend\Code\Generator\PropertyGenerator; class MagicIsset extends MagicMethodGenerator { /** - * @param \ReflectionClass $originalClass - * @param \Zend\Code\Generator\PropertyGenerator $initializerProperty - * @param \Zend\Code\Generator\MethodGenerator $callInitializer - * @param \ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap $publicProperties + * @var string + */ + private $callParentTemplate = <<<'PHP' +%s + +if (isset(self::$%s[$name])) { + return isset($this->$name); +} + +if (isset(self::$%s[$name])) { + // check protected property access via compatible class + $callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $caller = isset($callers[1]) ? $callers[1] : []; + $object = isset($caller['object']) ? $caller['object'] : ''; + $expectedType = self::$%s[$name]; + + if ($object instanceof $expectedType) { + return isset($this->$name); + } + + $class = isset($caller['class']) ? $caller['class'] : ''; + + if ($class === $expectedType || is_subclass_of($class, $expectedType)) { + return isset($this->$name); + } +} else { + // check private property access via same class + $callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $caller = isset($callers[1]) ? $callers[1] : []; + $class = isset($caller['class']) ? $caller['class'] : ''; + + static $accessorCache = []; + + if (isset(self::$%s[$name][$class])) { + $cacheKey = $class . '#' . $name; + $accessor = isset($accessorCache[$cacheKey]) + ? $accessorCache[$cacheKey] + : $accessorCache[$cacheKey] = \Closure::bind(function ($instance) use ($name) { + return isset($instance->$name); + }, null, $class); + + return $accessor($this); + } + + if ('ReflectionProperty' === $class) { + $tmpClass = key(self::$%s[$name]); + $cacheKey = $tmpClass . '#' . $name; + $accessor = isset($accessorCache[$cacheKey]) + ? $accessorCache[$cacheKey] + : $accessorCache[$cacheKey] = \Closure::bind(function ($instance) use ($name) { + return isset($instance->$name); + }, null, $tmpClass); + + return $accessor($this); + } +} + +%s +PHP; + + /** + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param MethodGenerator $callInitializer + * @param PublicPropertiesMap $publicProperties + * @param ProtectedPropertiesMap $protectedProperties + * @param PrivatePropertiesMap $privateProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, PropertyGenerator $initializerProperty, MethodGenerator $callInitializer, - PublicPropertiesMap $publicProperties + PublicPropertiesMap $publicProperties, + ProtectedPropertiesMap $protectedProperties, + PrivatePropertiesMap $privateProperties ) { - parent::__construct($originalClass, '__isset', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__isset', [new ParameterGenerator('name')]); - $override = $originalClass->hasMethod('__isset'); - $callParent = ''; + $override = $originalClass->hasMethod('__isset'); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); - if (! $publicProperties->isEmpty()) { - $callParent = 'if (isset(self::$' . $publicProperties->getName() . "[\$name])) {\n" - . ' return isset($this->$name);' - . "\n}\n\n"; - } + $parentAccess = 'return parent::__isset($name);'; - if ($override) { - $callParent .= 'return parent::__isset($name);'; - } else { - $callParent .= PublicScopeSimulator::getPublicAccessSimulationCode( + if (! $override) { + $parentAccess = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_ISSET, 'name' ); } - $this->setBody( + $this->setBody(sprintf( + $this->callParentTemplate, '$this->' . $initializerProperty->getName() . ' && $this->' . $callInitializer->getName() - . '(\'__isset\', array(\'name\' => $name));' - . "\n\n" . $callParent - ); + . '(\'__isset\', array(\'name\' => $name));', + $publicProperties->getName(), + $protectedProperties->getName(), + $protectedProperties->getName(), + $privateProperties->getName(), + $privateProperties->getName(), + $parentAccess + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicSet.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicSet.php index 902a16d..72f97e7 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicSet.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicSet.php @@ -16,10 +16,14 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\PrivatePropertiesMap; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\ProtectedPropertiesMap; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -35,47 +39,116 @@ use Zend\Code\Generator\PropertyGenerator; class MagicSet extends MagicMethodGenerator { /** - * @param \ReflectionClass $originalClass - * @param \Zend\Code\Generator\PropertyGenerator $initializerProperty - * @param \Zend\Code\Generator\MethodGenerator $callInitializer - * @param \ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap $publicProperties + * @var string + */ + private $callParentTemplate = <<<'PHP' +%s + +if (isset(self::$%s[$name])) { + return ($this->$name = $value); +} + +if (isset(self::$%s[$name])) { + // check protected property access via compatible class + $callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $caller = isset($callers[1]) ? $callers[1] : []; + $object = isset($caller['object']) ? $caller['object'] : ''; + $expectedType = self::$%s[$name]; + + if ($object instanceof $expectedType) { + return ($this->$name = $value); + } + + $class = isset($caller['class']) ? $caller['class'] : ''; + + if ($class === $expectedType || is_subclass_of($class, $expectedType) || $class === 'ReflectionProperty') { + return ($this->$name = $value); + } +} elseif (isset(self::$%s[$name])) { + // check private property access via same class + $callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $caller = isset($callers[1]) ? $callers[1] : []; + $class = isset($caller['class']) ? $caller['class'] : ''; + + static $accessorCache = []; + + if (isset(self::$%s[$name][$class])) { + $cacheKey = $class . '#' . $name; + $accessor = isset($accessorCache[$cacheKey]) + ? $accessorCache[$cacheKey] + : $accessorCache[$cacheKey] = \Closure::bind(function ($instance, $value) use ($name) { + return ($instance->$name = $value); + }, null, $class); + + return $accessor($this, $value); + } + + if ('ReflectionProperty' === $class) { + $tmpClass = key(self::$%s[$name]); + $cacheKey = $tmpClass . '#' . $name; + $accessor = isset($accessorCache[$cacheKey]) + ? $accessorCache[$cacheKey] + : $accessorCache[$cacheKey] = \Closure::bind(function ($instance, $value) use ($name) { + return ($instance->$name = $value); + }, null, $tmpClass); + + return $accessor($this, $value); + } +} + +%s +PHP; + + /** + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param MethodGenerator $callInitializer + * @param PublicPropertiesMap $publicProperties + * @param ProtectedPropertiesMap $protectedProperties + * @param PrivatePropertiesMap $privateProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, PropertyGenerator $initializerProperty, MethodGenerator $callInitializer, - PublicPropertiesMap $publicProperties + PublicPropertiesMap $publicProperties, + ProtectedPropertiesMap $protectedProperties, + PrivatePropertiesMap $privateProperties ) { parent::__construct( $originalClass, '__set', - array(new ParameterGenerator('name'), new ParameterGenerator('value')) + [new ParameterGenerator('name'), new ParameterGenerator('value')] ); - $override = $originalClass->hasMethod('__set'); - $callParent = ''; + $override = $originalClass->hasMethod('__set'); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); - if (! $publicProperties->isEmpty()) { - $callParent = 'if (isset(self::$' . $publicProperties->getName() . "[\$name])) {\n" - . ' return ($this->$name = $value);' - . "\n}\n\n"; - } + $parentAccess = 'return parent::__set($name, $value);'; - if ($override) { - $callParent .= 'return parent::__set($name, $value);'; - } else { - $callParent .= PublicScopeSimulator::getPublicAccessSimulationCode( + if (! $override) { + $parentAccess = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_SET, 'name', 'value' ); } - $this->setBody( + $this->setBody(sprintf( + $this->callParentTemplate, '$this->' . $initializerProperty->getName() . ' && $this->' . $callInitializer->getName() - . '(\'__set\', array(\'name\' => $name, \'value\' => $value));' . "\n\n" . $callParent - ); + . '(\'__set\', array(\'name\' => $name, \'value\' => $value));', + $publicProperties->getName(), + $protectedProperties->getName(), + $protectedProperties->getName(), + $privateProperties->getName(), + $privateProperties->getName(), + $privateProperties->getName(), + $parentAccess + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicSleep.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicSleep.php index a8036b2..a30dadf 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicSleep.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicSleep.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; @@ -33,6 +35,10 @@ class MagicSleep extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param MethodGenerator $callInitializer */ public function __construct( ReflectionClass $originalClass, @@ -43,7 +49,7 @@ class MagicSleep extends MagicMethodGenerator $this->setBody( '$this->' . $initializerProperty->getName() . ' && $this->' . $callInitializer->getName() - . '(\'__sleep\', array());' . "\n\n" + . '(\'__sleep\', []);' . "\n\n" . ($originalClass->hasMethod('__sleep') ? 'return parent::__sleep();' : 'return array_keys((array) $this);') ); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicUnset.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicUnset.php index 5a5bd23..20e352f 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicUnset.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/MagicUnset.php @@ -16,10 +16,14 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\PrivatePropertiesMap; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\ProtectedPropertiesMap; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -35,44 +39,117 @@ use Zend\Code\Generator\PropertyGenerator; class MagicUnset extends MagicMethodGenerator { /** - * @param \ReflectionClass $originalClass - * @param \Zend\Code\Generator\PropertyGenerator $initializerProperty - * @param \Zend\Code\Generator\MethodGenerator $callInitializer - * @param \ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap $publicProperties + * @var string + */ + private $callParentTemplate = <<<'PHP' +%s + +if (isset(self::$%s[$name])) { + unset($this->$name); + + return; +} + +if (isset(self::$%s[$name])) { + // check protected property access via compatible class + $callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $caller = isset($callers[1]) ? $callers[1] : []; + $object = isset($caller['object']) ? $caller['object'] : ''; + $expectedType = self::$%s[$name]; + + if ($object instanceof $expectedType) { + unset($this->$name); + + return; + } + + $class = isset($caller['class']) ? $caller['class'] : ''; + + if ($class === $expectedType || is_subclass_of($class, $expectedType) || $class === 'ReflectionProperty') { + unset($this->$name); + + return; + } +} elseif (isset(self::$%s[$name])) { + // check private property access via same class + $callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); + $caller = isset($callers[1]) ? $callers[1] : []; + $class = isset($caller['class']) ? $caller['class'] : ''; + + static $accessorCache = []; + + if (isset(self::$%s[$name][$class])) { + $cacheKey = $class . '#' . $name; + $accessor = isset($accessorCache[$cacheKey]) + ? $accessorCache[$cacheKey] + : $accessorCache[$cacheKey] = \Closure::bind(function ($instance) use ($name) { + unset($instance->$name); + }, null, $class); + + return $accessor($this); + } + + if ('ReflectionProperty' === $class) { + $tmpClass = key(self::$%s[$name]); + $cacheKey = $tmpClass . '#' . $name; + $accessor = isset($accessorCache[$cacheKey]) + ? $accessorCache[$cacheKey] + : $accessorCache[$cacheKey] = \Closure::bind(function ($instance) use ($name) { + unset($instance->$name); + }, null, $tmpClass); + + return $accessor($this); + } +} + +%s +PHP; + + /** + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param MethodGenerator $callInitializer + * @param PublicPropertiesMap $publicProperties + * @param ProtectedPropertiesMap $protectedProperties + * @param PrivatePropertiesMap $privateProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, PropertyGenerator $initializerProperty, MethodGenerator $callInitializer, - PublicPropertiesMap $publicProperties + PublicPropertiesMap $publicProperties, + ProtectedPropertiesMap $protectedProperties, + PrivatePropertiesMap $privateProperties ) { - parent::__construct($originalClass, '__unset', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__unset', [new ParameterGenerator('name')]); - $override = $originalClass->hasMethod('__unset'); - $callParent = ''; + $override = $originalClass->hasMethod('__unset'); - $this->setDocblock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($override ? "{@inheritDoc}\n" : '') . '@param string $name'); - if (! $publicProperties->isEmpty()) { - $callParent = 'if (isset(self::$' . $publicProperties->getName() . "[\$name])) {\n" - . ' unset($this->$name);' - . "\n\n return;" - . "\n}\n\n"; - } + $parentAccess = 'return parent::__unset($name);'; - if ($override) { - $callParent .= "return parent::__unset(\$name);"; - } else { - $callParent .= PublicScopeSimulator::getPublicAccessSimulationCode( + if (! $override) { + $parentAccess = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_UNSET, 'name' ); } - $this->setBody( + $this->setBody(sprintf( + $this->callParentTemplate, '$this->' . $initializerProperty->getName() . ' && $this->' . $callInitializer->getName() - . '(\'__unset\', array(\'name\' => $name));' - . "\n\n" . $callParent - ); + . '(\'__unset\', array(\'name\' => $name));', + $publicProperties->getName(), + $protectedProperties->getName(), + $protectedProperties->getName(), + $privateProperties->getName(), + $privateProperties->getName(), + $privateProperties->getName(), + $parentAccess + )); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/SetProxyInitializer.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/SetProxyInitializer.php index 30e37bb..eb4cf40 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/SetProxyInitializer.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/SetProxyInitializer.php @@ -16,10 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator; use ProxyManager\Generator\MethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use Zend\Code\Generator\PropertyGenerator; /** @@ -33,17 +35,17 @@ class SetProxyInitializer extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $initializerProperty */ public function __construct(PropertyGenerator $initializerProperty) { - parent::__construct('setProxyInitializer'); - - $initializerParameter = new ParameterGenerator('initializer'); - - $initializerParameter->setType('Closure'); - $initializerParameter->setDefaultValue(null); - $this->setParameter($initializerParameter); - $this->setDocblock('{@inheritDoc}'); - $this->setBody('$this->' . $initializerProperty->getName() . ' = $initializer;'); + parent::__construct( + 'setProxyInitializer', + [(new ParameterGenerator('initializer', 'Closure'))->setDefaultValue(null)], + self::FLAG_PUBLIC, + '$this->' . $initializerProperty->getName() . ' = $initializer;', + '{@inheritDoc}' + ); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializationTracker.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializationTracker.php index c303f1c..232b513 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializationTracker.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializationTracker.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator; use ProxyManager\Generator\Util\UniqueIdentifierGenerator; @@ -31,13 +33,15 @@ class InitializationTracker extends PropertyGenerator { /** * Constructor + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct() { parent::__construct(UniqueIdentifierGenerator::getIdentifier('initializationTracker')); $this->setVisibility(self::VISIBILITY_PRIVATE); - $this->setDocblock('@var bool tracks initialization status - true while the object is initializing'); + $this->setDocBlock('@var bool tracks initialization status - true while the object is initializing'); $this->setDefaultValue(false); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializerProperty.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializerProperty.php index 554889f..ecc14af 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializerProperty.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/InitializerProperty.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator; use ProxyManager\Generator\Util\UniqueIdentifierGenerator; @@ -31,12 +33,14 @@ class InitializerProperty extends PropertyGenerator { /** * Constructor + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct() { parent::__construct(UniqueIdentifierGenerator::getIdentifier('initializer')); $this->setVisibility(self::VISIBILITY_PRIVATE); - $this->setDocblock('@var \\Closure|null initializer responsible for generating the wrapped object'); + $this->setDocBlock('@var \\Closure|null initializer responsible for generating the wrapped object'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/PrivatePropertiesMap.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/PrivatePropertiesMap.php new file mode 100644 index 0000000..560d086 --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/PrivatePropertiesMap.php @@ -0,0 +1,75 @@ + + * @license MIT + */ +class PrivatePropertiesMap extends PropertyGenerator +{ + const KEY_DEFAULT_VALUE = 'defaultValue'; + + /** + * Constructor + * + * @param Properties $properties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + */ + public function __construct(Properties $properties) + { + parent::__construct( + UniqueIdentifierGenerator::getIdentifier('privateProperties') + ); + + $this->setVisibility(self::VISIBILITY_PRIVATE); + $this->setStatic(true); + $this->setDocBlock( + '@var array[][] visibility and default value of defined properties, indexed by property name and class name' + ); + $this->setDefaultValue($this->getMap($properties)); + } + + /** + * @param Properties $properties + * + * @return int[][]|mixed[][] + */ + private function getMap(Properties $properties) : array + { + $map = []; + + foreach ($properties->getPrivateProperties() as $property) { + $propertyKey = & $map[$property->getName()]; + + $propertyKey[$property->getDeclaringClass()->getName()] = true; + } + + return $map; + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/ProtectedPropertiesMap.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/ProtectedPropertiesMap.php new file mode 100644 index 0000000..0051339 --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/PropertyGenerator/ProtectedPropertiesMap.php @@ -0,0 +1,74 @@ + + * @license MIT + */ +class ProtectedPropertiesMap extends PropertyGenerator +{ + const KEY_DEFAULT_VALUE = 'defaultValue'; + + /** + * Constructor + * + * @param Properties $properties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + */ + public function __construct(Properties $properties) + { + parent::__construct( + UniqueIdentifierGenerator::getIdentifier('protectedProperties') + ); + + $this->setVisibility(self::VISIBILITY_PRIVATE); + $this->setStatic(true); + $this->setDocBlock( + '@var string[][] declaring class name of defined protected properties, indexed by property name' + ); + $this->setDefaultValue($this->getMap($properties)); + } + + /** + * + * @param Properties $properties + * + * @return int[][]|mixed[][] + */ + private function getMap(Properties $properties) : array + { + $map = []; + + foreach ($properties->getProtectedProperties() as $property) { + $map[$property->getName()] = $property->getDeclaringClass()->getName(); + } + + return $map; + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhostGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhostGenerator.php index 1f9d88e..ab5819f 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhostGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingGhostGenerator.php @@ -16,16 +16,20 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator; +use ProxyManager\Exception\InvalidProxiedClassException; +use ProxyManager\Generator\MethodGenerator as ProxyManagerMethodGenerator; use ProxyManager\Generator\Util\ClassGeneratorUtils; +use ProxyManager\Proxy\GhostObjectInterface; use ProxyManager\ProxyGenerator\Assertion\CanProxyAssertion; -use ProxyManager\ProxyGenerator\LazyLoading\MethodGenerator\Constructor; +use ProxyManager\ProxyGenerator\LazyLoading\MethodGenerator\StaticProxyConstructor; use ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\CallInitializer; use ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\GetProxyInitializer; use ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\InitializeProxy; use ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\IsProxyInitialized; -use ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\LazyLoadingMethodInterceptor; use ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\MagicClone; use ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\MagicGet; use ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\MagicIsset; @@ -35,8 +39,10 @@ use ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\MagicUnset; use ProxyManager\ProxyGenerator\LazyLoadingGhost\MethodGenerator\SetProxyInitializer; use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\InitializationTracker; use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\InitializerProperty; -use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesDefaults; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\PrivatePropertiesMap; +use ProxyManager\ProxyGenerator\LazyLoadingGhost\PropertyGenerator\ProtectedPropertiesMap; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; +use ProxyManager\ProxyGenerator\Util\Properties; use ProxyManager\ProxyGenerator\Util\ProxiedMethodsFilter; use ReflectionClass; use ReflectionMethod; @@ -56,59 +62,104 @@ class LazyLoadingGhostGenerator implements ProxyGeneratorInterface { /** * {@inheritDoc} + * + * @throws InvalidProxiedClassException + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ - public function generate(ReflectionClass $originalClass, ClassGenerator $classGenerator) + public function generate(ReflectionClass $originalClass, ClassGenerator $classGenerator, array $proxyOptions = []) { - CanProxyAssertion::assertClassCanBeProxied($originalClass); + CanProxyAssertion::assertClassCanBeProxied($originalClass, false); - $interfaces = array('ProxyManager\\Proxy\\GhostObjectInterface'); - $publicProperties = new PublicPropertiesMap($originalClass); - $publicPropsDefaults = new PublicPropertiesDefaults($originalClass); + $filteredProperties = Properties::fromReflectionClass($originalClass) + ->filter($proxyOptions['skippedProperties'] ?? []); - if ($originalClass->isInterface()) { - $interfaces[] = $originalClass->getName(); - } else { - $classGenerator->setExtendedClass($originalClass->getName()); - } + $publicProperties = new PublicPropertiesMap($filteredProperties); + $privateProperties = new PrivatePropertiesMap($filteredProperties); + $protectedProperties = new ProtectedPropertiesMap($filteredProperties); - $classGenerator->setImplementedInterfaces($interfaces); + $classGenerator->setExtendedClass($originalClass->getName()); + $classGenerator->setImplementedInterfaces([GhostObjectInterface::class]); $classGenerator->addPropertyFromGenerator($initializer = new InitializerProperty()); $classGenerator->addPropertyFromGenerator($initializationTracker = new InitializationTracker()); $classGenerator->addPropertyFromGenerator($publicProperties); - $classGenerator->addPropertyFromGenerator($publicPropsDefaults); + $classGenerator->addPropertyFromGenerator($privateProperties); + $classGenerator->addPropertyFromGenerator($protectedProperties); - $init = new CallInitializer($initializer, $publicPropsDefaults, $initializationTracker); + $init = new CallInitializer($initializer, $initializationTracker, $filteredProperties); array_map( function (MethodGenerator $generatedMethod) use ($originalClass, $classGenerator) { ClassGeneratorUtils::addMethodIfNotFinal($originalClass, $classGenerator, $generatedMethod); }, array_merge( - array_map( - function (ReflectionMethod $method) use ($initializer, $init) { - return LazyLoadingMethodInterceptor::generateMethod( - new MethodReflection($method->getDeclaringClass()->getName(), $method->getName()), - $initializer, - $init - ); - }, - ProxiedMethodsFilter::getProxiedMethods($originalClass) - ), - array( + $this->getAbstractProxiedMethods($originalClass), + [ $init, - new Constructor($originalClass, $initializer), - new MagicGet($originalClass, $initializer, $init, $publicProperties), - new MagicSet($originalClass, $initializer, $init, $publicProperties), - new MagicIsset($originalClass, $initializer, $init, $publicProperties), - new MagicUnset($originalClass, $initializer, $init, $publicProperties), - new MagicClone($originalClass, $initializer, $init, $publicProperties), - new MagicSleep($originalClass, $initializer, $init, $publicProperties), + new StaticProxyConstructor($initializer, $filteredProperties), + new MagicGet( + $originalClass, + $initializer, + $init, + $publicProperties, + $protectedProperties, + $privateProperties, + $initializationTracker + ), + new MagicSet( + $originalClass, + $initializer, + $init, + $publicProperties, + $protectedProperties, + $privateProperties + ), + new MagicIsset( + $originalClass, + $initializer, + $init, + $publicProperties, + $protectedProperties, + $privateProperties + ), + new MagicUnset( + $originalClass, + $initializer, + $init, + $publicProperties, + $protectedProperties, + $privateProperties + ), + new MagicClone($originalClass, $initializer, $init), + new MagicSleep($originalClass, $initializer, $init), new SetProxyInitializer($initializer), new GetProxyInitializer($initializer), new InitializeProxy($initializer, $init), new IsProxyInitialized($initializer), - ) + ] ) ); } + + /** + * Retrieves all abstract methods to be proxied + * + * @param ReflectionClass $originalClass + * + * @return MethodGenerator[] + */ + private function getAbstractProxiedMethods(ReflectionClass $originalClass) : array + { + return array_map( + function (ReflectionMethod $method) : ProxyManagerMethodGenerator { + $generated = ProxyManagerMethodGenerator + ::fromReflection(new MethodReflection($method->getDeclaringClass()->getName(), $method->getName())); + + $generated->setAbstract(false); + + return $generated; + }, + ProxiedMethodsFilter::getAbstractProxiedMethods($originalClass) + ); + } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/GetProxyInitializer.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/GetProxyInitializer.php index 3dd0854..c784c6e 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/GetProxyInitializer.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/GetProxyInitializer.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; use ProxyManager\Generator\MethodGenerator; @@ -32,11 +34,15 @@ class GetProxyInitializer extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $initializerProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(PropertyGenerator $initializerProperty) { parent::__construct('getProxyInitializer'); - $this->setDocblock('{@inheritDoc}'); + $this->setDocBlock('{@inheritDoc}'); $this->setBody('return $this->' . $initializerProperty->getName() . ';'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/InitializeProxy.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/InitializeProxy.php index 4c358b1..205122d 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/InitializeProxy.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/InitializeProxy.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; use ProxyManager\Generator\MethodGenerator; @@ -32,11 +34,17 @@ class InitializeProxy extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $initializerProperty + * @param PropertyGenerator $valueHolderProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(PropertyGenerator $initializerProperty, PropertyGenerator $valueHolderProperty) { parent::__construct('initializeProxy'); - $this->setDocblock('{@inheritDoc}'); + $this->setDocBlock('{@inheritDoc}'); + $this->setReturnType('bool'); $initializer = $initializerProperty->getName(); diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/IsProxyInitialized.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/IsProxyInitialized.php index 34fdd0b..7e8ae9f 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/IsProxyInitialized.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/IsProxyInitialized.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; use ProxyManager\Generator\MethodGenerator; @@ -32,11 +34,16 @@ class IsProxyInitialized extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $valueHolderProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(PropertyGenerator $valueHolderProperty) { parent::__construct('isProxyInitialized'); - $this->setDocblock('{@inheritDoc}'); + $this->setDocBlock('{@inheritDoc}'); + $this->setReturnType('bool'); $this->setBody('return null !== $this->' . $valueHolderProperty->getName() . ';'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/LazyLoadingMethodInterceptor.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/LazyLoadingMethodInterceptor.php index b4ce370..f426cf1 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/LazyLoadingMethodInterceptor.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/LazyLoadingMethodInterceptor.php @@ -16,9 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; use ProxyManager\Generator\MethodGenerator; +use ProxyManager\Generator\Util\ProxiedMethodReturnExpression; use Zend\Code\Generator\PropertyGenerator; use Zend\Code\Reflection\MethodReflection; @@ -35,26 +38,29 @@ class LazyLoadingMethodInterceptor extends MethodGenerator * @param \Zend\Code\Generator\PropertyGenerator $initializerProperty * @param \Zend\Code\Generator\PropertyGenerator $valueHolderProperty * - * @return LazyLoadingMethodInterceptor|static + * @return self + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public static function generateMethod( MethodReflection $originalMethod, PropertyGenerator $initializerProperty, PropertyGenerator $valueHolderProperty - ) { + ) : self { /* @var $method self */ $method = static::fromReflection($originalMethod); $initializerName = $initializerProperty->getName(); $valueHolderName = $valueHolderProperty->getName(); $parameters = $originalMethod->getParameters(); $methodName = $originalMethod->getName(); - $initializerParams = array(); - $forwardedParams = array(); + $initializerParams = []; + $forwardedParams = []; foreach ($parameters as $parameter) { $parameterName = $parameter->getName(); + $variadicPrefix = $parameter->isVariadic() ? '...' : ''; $initializerParams[] = var_export($parameterName, true) . ' => $' . $parameterName; - $forwardedParams[] = '$' . $parameterName; + $forwardedParams[] = $variadicPrefix . '$' . $parameterName; } $method->setBody( @@ -62,10 +68,12 @@ class LazyLoadingMethodInterceptor extends MethodGenerator . ' && $this->' . $initializerName . '->__invoke($this->' . $valueHolderName . ', $this, ' . var_export($methodName, true) . ', array(' . implode(', ', $initializerParams) . '), $this->' . $initializerName . ");\n\n" - . 'return $this->' . $valueHolderName . '->' - . $methodName . '(' . implode(', ', $forwardedParams) . ');' + . ProxiedMethodReturnExpression::generate( + '$this->' . $valueHolderName . '->' . $methodName . '(' . implode(', ', $forwardedParams) . ')', + $originalMethod + ) ); - $method->setDocblock('{@inheritDoc}'); + $method->setDocBlock('{@inheritDoc}'); return $method; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicClone.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicClone.php index d62c46a..a8e2b47 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicClone.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicClone.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; @@ -32,6 +34,10 @@ class MagicClone extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param PropertyGenerator $valueHolderProperty */ public function __construct( ReflectionClass $originalClass, diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicGet.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicGet.php index 43b3ec5..e4e6648 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicGet.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicGet.php @@ -16,10 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -35,6 +37,14 @@ class MagicGet extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param PropertyGenerator $valueHolderProperty + * @param PublicPropertiesMap $publicProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, @@ -42,9 +52,11 @@ class MagicGet extends MagicMethodGenerator PropertyGenerator $valueHolderProperty, PublicPropertiesMap $publicProperties ) { - parent::__construct($originalClass, '__get', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__get', [new ParameterGenerator('name')]); - $this->setDocblock(($originalClass->hasMethod('__get') ? "{@inheritDoc}\n" : '') . '@param string $name'); + $hasParent = $originalClass->hasMethod('__get'); + + $this->setDocBlock(($hasParent ? "{@inheritDoc}\n" : '') . '@param string $name'); $initializer = $initializerProperty->getName(); $valueHolder = $valueHolderProperty->getName(); @@ -52,16 +64,33 @@ class MagicGet extends MagicMethodGenerator . ' return $this->' . $valueHolder . '->$name;' . "\n}\n\n"; - $callParent .= PublicScopeSimulator::getPublicAccessSimulationCode( - PublicScopeSimulator::OPERATION_GET, - 'name', - null, - $valueHolderProperty - ); + if ($hasParent) { + $this->setInitializerBody( + $initializer, + $valueHolder, + $callParent . 'return $this->' . $valueHolder . '->__get($name);' + ); + return; + } + + $this->setInitializerBody( + $initializer, + $valueHolder, + $callParent . PublicScopeSimulator::getPublicAccessSimulationCode( + PublicScopeSimulator::OPERATION_GET, + 'name', + null, + $valueHolderProperty + ) + ); + } + + private function setInitializerBody(string $initializer, string $valueHolder, string $callParent) : void + { $this->setBody( '$this->' . $initializer . ' && $this->' . $initializer - . '->__invoke($this->' . $valueHolder . ', $this, \'__get\', array(\'name\' => $name), $this->' + . '->__invoke($this->' . $valueHolder . ', $this, \'__get\', [\'name\' => $name], $this->' . $initializer . ');' . "\n\n" . $callParent ); diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicIsset.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicIsset.php index 11607a4..9ebc1de 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicIsset.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicIsset.php @@ -16,10 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -35,6 +37,14 @@ class MagicIsset extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param PropertyGenerator $valueHolderProperty + * @param PublicPropertiesMap $publicProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, @@ -42,13 +52,13 @@ class MagicIsset extends MagicMethodGenerator PropertyGenerator $valueHolderProperty, PublicPropertiesMap $publicProperties ) { - parent::__construct($originalClass, '__isset', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__isset', [new ParameterGenerator('name')]); $initializer = $initializerProperty->getName(); $valueHolder = $valueHolderProperty->getName(); $callParent = ''; - $this->setDocblock(($originalClass->hasMethod('__isset') ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($originalClass->hasMethod('__isset') ? "{@inheritDoc}\n" : '') . '@param string $name'); if (! $publicProperties->isEmpty()) { $callParent = 'if (isset(self::$' . $publicProperties->getName() . "[\$name])) {\n" diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicSet.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicSet.php index 4530319..9ffe718 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicSet.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicSet.php @@ -16,10 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -35,6 +37,14 @@ class MagicSet extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param PropertyGenerator $valueHolderProperty + * @param PublicPropertiesMap $publicProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, @@ -45,16 +55,15 @@ class MagicSet extends MagicMethodGenerator parent::__construct( $originalClass, '__set', - array(new ParameterGenerator('name'), new ParameterGenerator('value')) + [new ParameterGenerator('name'), new ParameterGenerator('value')] ); + $hasParent = $originalClass->hasMethod('__set'); $initializer = $initializerProperty->getName(); $valueHolder = $valueHolderProperty->getName(); $callParent = ''; - $this->setDocblock( - ($originalClass->hasMethod('__set') ? "{@inheritDoc}\n" : '') . "@param string \$name\n@param mixed \$value" - ); + $this->setDocBlock(($hasParent ? "{@inheritDoc}\n" : '') . "@param string \$name\n@param mixed \$value"); if (! $publicProperties->isEmpty()) { $callParent = 'if (isset(self::$' . $publicProperties->getName() . "[\$name])) {\n" @@ -62,12 +71,14 @@ class MagicSet extends MagicMethodGenerator . "\n}\n\n"; } - $callParent .= PublicScopeSimulator::getPublicAccessSimulationCode( - PublicScopeSimulator::OPERATION_SET, - 'name', - 'value', - $valueHolderProperty - ); + $callParent .= $hasParent + ? 'return $this->' . $valueHolder . '->__set($name, $value);' + : PublicScopeSimulator::getPublicAccessSimulationCode( + PublicScopeSimulator::OPERATION_SET, + 'name', + 'value', + $valueHolderProperty + ); $this->setBody( '$this->' . $initializer . ' && $this->' . $initializer diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicSleep.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicSleep.php index 20051c8..7151491 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicSleep.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicSleep.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; @@ -32,6 +34,10 @@ class MagicSleep extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param PropertyGenerator $valueHolderProperty */ public function __construct( ReflectionClass $originalClass, diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicUnset.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicUnset.php index 0c33954..ba5316b 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicUnset.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/MagicUnset.php @@ -16,10 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; use ProxyManager\ProxyGenerator\Util\PublicScopeSimulator; use ReflectionClass; @@ -35,6 +37,14 @@ class MagicUnset extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $initializerProperty + * @param PropertyGenerator $valueHolderProperty + * @param PublicPropertiesMap $publicProperties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, @@ -42,13 +52,14 @@ class MagicUnset extends MagicMethodGenerator PropertyGenerator $valueHolderProperty, PublicPropertiesMap $publicProperties ) { - parent::__construct($originalClass, '__unset', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__unset', [new ParameterGenerator('name')]); + $hasParent = $originalClass->hasMethod('__unset'); $initializer = $initializerProperty->getName(); $valueHolder = $valueHolderProperty->getName(); $callParent = ''; - $this->setDocblock(($originalClass->hasMethod('__isset') ? "{@inheritDoc}\n" : '') . '@param string $name'); + $this->setDocBlock(($hasParent ? "{@inheritDoc}\n" : '') . '@param string $name'); if (! $publicProperties->isEmpty()) { $callParent = 'if (isset(self::$' . $publicProperties->getName() . "[\$name])) {\n" @@ -56,12 +67,14 @@ class MagicUnset extends MagicMethodGenerator . "\n}\n\n"; } - $callParent .= PublicScopeSimulator::getPublicAccessSimulationCode( - PublicScopeSimulator::OPERATION_UNSET, - 'name', - null, - $valueHolderProperty - ); + $callParent .= $hasParent + ? 'return $this->' . $valueHolder . '->__unset($name);' + : PublicScopeSimulator::getPublicAccessSimulationCode( + PublicScopeSimulator::OPERATION_UNSET, + 'name', + null, + $valueHolderProperty + ); $this->setBody( '$this->' . $initializer . ' && $this->' . $initializer diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/SetProxyInitializer.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/SetProxyInitializer.php index db3400f..5fcac7d 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/SetProxyInitializer.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/MethodGenerator/SetProxyInitializer.php @@ -16,10 +16,13 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator; +use Closure; use ProxyManager\Generator\MethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use Zend\Code\Generator\PropertyGenerator; /** @@ -33,6 +36,10 @@ class SetProxyInitializer extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $initializerProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(PropertyGenerator $initializerProperty) { @@ -40,10 +47,10 @@ class SetProxyInitializer extends MethodGenerator $initializerParameter = new ParameterGenerator('initializer'); - $initializerParameter->setType('Closure'); + $initializerParameter->setType(Closure::class); $initializerParameter->setDefaultValue(null); $this->setParameter($initializerParameter); - $this->setDocblock('{@inheritDoc}'); + $this->setDocBlock('{@inheritDoc}'); $this->setBody('$this->' . $initializerProperty->getName() . ' = $initializer;'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/InitializerProperty.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/InitializerProperty.php index e7b436b..f65ec04 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/InitializerProperty.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/InitializerProperty.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\PropertyGenerator; use ProxyManager\Generator\Util\UniqueIdentifierGenerator; @@ -31,12 +33,14 @@ class InitializerProperty extends PropertyGenerator { /** * Constructor + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct() { parent::__construct(UniqueIdentifierGenerator::getIdentifier('initializer')); $this->setVisibility(self::VISIBILITY_PRIVATE); - $this->setDocblock('@var \\Closure|null initializer responsible for generating the wrapped object'); + $this->setDocBlock('@var \\Closure|null initializer responsible for generating the wrapped object'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/ValueHolderProperty.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/ValueHolderProperty.php index 71895dc..1c8b2f5 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/ValueHolderProperty.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolder/PropertyGenerator/ValueHolderProperty.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\LazyLoadingValueHolder\PropertyGenerator; use ProxyManager\Generator\Util\UniqueIdentifierGenerator; @@ -31,12 +33,14 @@ class ValueHolderProperty extends PropertyGenerator { /** * Constructor + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct() { parent::__construct(UniqueIdentifierGenerator::getIdentifier('valueHolder')); $this->setVisibility(self::VISIBILITY_PRIVATE); - $this->setDocblock('@var \\Closure|null initializer responsible for generating the wrapped object'); + $this->setDocBlock('@var \\Closure|null initializer responsible for generating the wrapped object'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolderGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolderGenerator.php index 0a9ab36..c7aeb39 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolderGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/LazyLoadingValueHolderGenerator.php @@ -16,12 +16,16 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator; +use ProxyManager\Exception\InvalidProxiedClassException; use ProxyManager\Generator\Util\ClassGeneratorUtils; +use ProxyManager\Proxy\VirtualProxyInterface; use ProxyManager\ProxyGenerator\AccessInterceptor\MethodGenerator\MagicWakeup; use ProxyManager\ProxyGenerator\Assertion\CanProxyAssertion; -use ProxyManager\ProxyGenerator\LazyLoading\MethodGenerator\Constructor; +use ProxyManager\ProxyGenerator\LazyLoading\MethodGenerator\StaticProxyConstructor; use ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\GetProxyInitializer; use ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\InitializeProxy; use ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\IsProxyInitialized; @@ -36,7 +40,9 @@ use ProxyManager\ProxyGenerator\LazyLoadingValueHolder\MethodGenerator\SetProxyI use ProxyManager\ProxyGenerator\LazyLoadingValueHolder\PropertyGenerator\InitializerProperty; use ProxyManager\ProxyGenerator\LazyLoadingValueHolder\PropertyGenerator\ValueHolderProperty; use ProxyManager\ProxyGenerator\PropertyGenerator\PublicPropertiesMap; +use ProxyManager\ProxyGenerator\Util\Properties; use ProxyManager\ProxyGenerator\Util\ProxiedMethodsFilter; +use ProxyManager\ProxyGenerator\ValueHolder\MethodGenerator\Constructor; use ProxyManager\ProxyGenerator\ValueHolder\MethodGenerator\GetWrappedValueHolderValue; use ReflectionClass; use ReflectionMethod; @@ -56,13 +62,17 @@ class LazyLoadingValueHolderGenerator implements ProxyGeneratorInterface { /** * {@inheritDoc} + * + * @throws InvalidProxiedClassException + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + * @throws \InvalidArgumentException */ public function generate(ReflectionClass $originalClass, ClassGenerator $classGenerator) { CanProxyAssertion::assertClassCanBeProxied($originalClass); - $interfaces = array('ProxyManager\\Proxy\\VirtualProxyInterface'); - $publicProperties = new PublicPropertiesMap($originalClass); + $interfaces = [VirtualProxyInterface::class]; + $publicProperties = new PublicPropertiesMap(Properties::fromReflectionClass($originalClass)); if ($originalClass->isInterface()) { $interfaces[] = $originalClass->getName(); @@ -81,17 +91,12 @@ class LazyLoadingValueHolderGenerator implements ProxyGeneratorInterface }, array_merge( array_map( - function (ReflectionMethod $method) use ($initializer, $valueHolder) { - return LazyLoadingMethodInterceptor::generateMethod( - new MethodReflection($method->getDeclaringClass()->getName(), $method->getName()), - $initializer, - $valueHolder - ); - }, + $this->buildLazyLoadingMethodInterceptor($initializer, $valueHolder), ProxiedMethodsFilter::getProxiedMethods($originalClass) ), - array( - new Constructor($originalClass, $initializer), + [ + new StaticProxyConstructor($initializer, Properties::fromReflectionClass($originalClass)), + Constructor::generateMethod($originalClass, $valueHolder), new MagicGet($originalClass, $initializer, $valueHolder, $publicProperties), new MagicSet($originalClass, $initializer, $valueHolder, $publicProperties), new MagicIsset($originalClass, $initializer, $valueHolder, $publicProperties), @@ -104,8 +109,21 @@ class LazyLoadingValueHolderGenerator implements ProxyGeneratorInterface new InitializeProxy($initializer, $valueHolder), new IsProxyInitialized($valueHolder), new GetWrappedValueHolderValue($valueHolder), - ) + ] ) ); } + + private function buildLazyLoadingMethodInterceptor( + InitializerProperty $initializer, + ValueHolderProperty $valueHolder + ) : callable { + return function (ReflectionMethod $method) use ($initializer, $valueHolder) : LazyLoadingMethodInterceptor { + return LazyLoadingMethodInterceptor::generateMethod( + new MethodReflection($method->getDeclaringClass()->getName(), $method->getName()), + $initializer, + $valueHolder + ); + }; + } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/NullObjectMethodInterceptor.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/NullObjectMethodInterceptor.php index 2b63e50..cf77f57 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/NullObjectMethodInterceptor.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/NullObjectMethodInterceptor.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\NullObject\MethodGenerator; use ProxyManager\Generator\MethodGenerator; @@ -33,21 +35,29 @@ class NullObjectMethodInterceptor extends MethodGenerator /** * @param \Zend\Code\Reflection\MethodReflection $originalMethod * - * @return NullObjectMethodInterceptor|static + * @return self|static */ - public static function generateMethod(MethodReflection $originalMethod) + public static function generateMethod(MethodReflection $originalMethod) : self { /* @var $method self */ $method = static::fromReflection($originalMethod); + if ('void' === (string) $originalMethod->getReturnType()) { + $method->setBody(''); + + return $method; + } + if ($originalMethod->returnsReference()) { $reference = UniqueIdentifierGenerator::getIdentifier('ref'); $method->setBody("\$$reference = null;\nreturn \$$reference;"); - } else { - $method->setBody(''); + + return $method; } + $method->setBody(''); + return $method; } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/StaticProxyConstructor.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/StaticProxyConstructor.php new file mode 100644 index 0000000..63c2e1f --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObject/MethodGenerator/StaticProxyConstructor.php @@ -0,0 +1,63 @@ + + * @license MIT + */ +class StaticProxyConstructor extends MethodGenerator +{ + /** + * Constructor + * + * @param ReflectionClass $originalClass Reflection of the class to proxy + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + */ + public function __construct(ReflectionClass $originalClass) + { + parent::__construct('staticProxyConstructor', [], static::FLAG_PUBLIC | static::FLAG_STATIC); + + $nullableProperties = array_map( + function (ReflectionProperty $publicProperty) : string { + return '$instance->' . $publicProperty->getName() . ' = null;'; + }, + Properties::fromReflectionClass($originalClass)->getPublicProperties() + ); + + $this->setDocBlock('Constructor for null object initialization'); + $this->setBody( + 'static $reflection;' . "\n\n" + . '$reflection = $reflection ?: $reflection = new \ReflectionClass(__CLASS__);' . "\n" + . '$instance = (new \ReflectionClass(get_class()))->newInstanceWithoutConstructor();' . "\n\n" + . ($nullableProperties ? implode("\n", $nullableProperties) . "\n\n" : '') + . 'return $instance;' + ); + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObjectGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObjectGenerator.php index db177ac..b77e68c 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObjectGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/NullObjectGenerator.php @@ -16,12 +16,16 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator; +use ProxyManager\Exception\InvalidProxiedClassException; use ProxyManager\Generator\Util\ClassGeneratorUtils; +use ProxyManager\Proxy\NullObjectInterface; use ProxyManager\ProxyGenerator\Assertion\CanProxyAssertion; -use ProxyManager\ProxyGenerator\NullObject\MethodGenerator\Constructor; use ProxyManager\ProxyGenerator\NullObject\MethodGenerator\NullObjectMethodInterceptor; +use ProxyManager\ProxyGenerator\NullObject\MethodGenerator\StaticProxyConstructor; use ProxyManager\ProxyGenerator\Util\ProxiedMethodsFilter; use ReflectionClass; use Zend\Code\Generator\ClassGenerator; @@ -39,20 +43,25 @@ class NullObjectGenerator implements ProxyGeneratorInterface { /** * {@inheritDoc} + * + * @throws InvalidProxiedClassException + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function generate(ReflectionClass $originalClass, ClassGenerator $classGenerator) { CanProxyAssertion::assertClassCanBeProxied($originalClass); - $interfaces = array('ProxyManager\\Proxy\\NullObjectInterface'); + $interfaces = [NullObjectInterface::class]; if ($originalClass->isInterface()) { $interfaces[] = $originalClass->getName(); + } else { + $classGenerator->setExtendedClass($originalClass->getName()); } $classGenerator->setImplementedInterfaces($interfaces); - foreach (ProxiedMethodsFilter::getProxiedMethods($originalClass) as $method) { + foreach (ProxiedMethodsFilter::getProxiedMethods($originalClass, []) as $method) { $classGenerator->addMethodFromGenerator( NullObjectMethodInterceptor::generateMethod( new MethodReflection($method->getDeclaringClass()->getName(), $method->getName()) @@ -60,6 +69,10 @@ class NullObjectGenerator implements ProxyGeneratorInterface ); } - ClassGeneratorUtils::addMethodIfNotFinal($originalClass, $classGenerator, new Constructor($originalClass)); + ClassGeneratorUtils::addMethodIfNotFinal( + $originalClass, + $classGenerator, + new StaticProxyConstructor($originalClass) + ); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/PropertyGenerator/PublicPropertiesMap.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/PropertyGenerator/PublicPropertiesMap.php index 5682a4a..cd7b462 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/PropertyGenerator/PublicPropertiesMap.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/PropertyGenerator/PublicPropertiesMap.php @@ -16,11 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\PropertyGenerator; use ProxyManager\Generator\Util\UniqueIdentifierGenerator; -use ReflectionClass; -use ReflectionProperty; +use ProxyManager\ProxyGenerator\Util\Properties; use Zend\Code\Generator\PropertyGenerator; /** @@ -34,30 +35,32 @@ class PublicPropertiesMap extends PropertyGenerator /** * @var bool[] */ - private $publicProperties = array(); + private $publicProperties = []; /** - * @param \ReflectionClass $originalClass + * @param Properties $properties + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ - public function __construct(ReflectionClass $originalClass) + public function __construct(Properties $properties) { parent::__construct(UniqueIdentifierGenerator::getIdentifier('publicProperties')); - foreach ($originalClass->getProperties(ReflectionProperty::IS_PUBLIC) as $publicProperty) { + foreach ($properties->getPublicProperties() as $publicProperty) { $this->publicProperties[$publicProperty->getName()] = true; } $this->setDefaultValue($this->publicProperties); $this->setVisibility(self::VISIBILITY_PRIVATE); $this->setStatic(true); - $this->setDocblock('@var bool[] map of public properties of the parent class'); + $this->setDocBlock('@var bool[] map of public properties of the parent class'); } /** * @return bool whether there are no public properties */ - public function isEmpty() + public function isEmpty() : bool { - return empty($this->publicProperties); + return ! $this->publicProperties; } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ProxyGeneratorInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ProxyGeneratorInterface.php index df88aa8..7ec9bbd 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ProxyGeneratorInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ProxyGeneratorInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator; use ReflectionClass; diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicGet.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicGet.php index c1841dc..b73af88 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicGet.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicGet.php @@ -16,10 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use ReflectionClass; use Zend\Code\Generator\PropertyGenerator; @@ -35,12 +37,14 @@ class MagicGet extends MagicMethodGenerator * Constructor * @param ReflectionClass $originalClass * @param \Zend\Code\Generator\PropertyGenerator $adapterProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(ReflectionClass $originalClass, PropertyGenerator $adapterProperty) { - parent::__construct($originalClass, '__get', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__get', [new ParameterGenerator('name')]); - $this->setDocblock('@param string $name'); + $this->setDocBlock('@param string $name'); $this->setBody( '$return = $this->' . $adapterProperty->getName() . '->call(' . var_export($originalClass->getName(), true) . ', \'__get\', array($name));' . "\n\n" . 'return $return;' diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicIsset.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicIsset.php index 254977c..1432252 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicIsset.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicIsset.php @@ -16,10 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use ReflectionClass; use Zend\Code\Generator\PropertyGenerator; @@ -35,12 +37,14 @@ class MagicIsset extends MagicMethodGenerator * Constructor * @param ReflectionClass $originalClass * @param \Zend\Code\Generator\PropertyGenerator $adapterProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(ReflectionClass $originalClass, PropertyGenerator $adapterProperty) { - parent::__construct($originalClass, '__isset', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__isset', [new ParameterGenerator('name')]); - $this->setDocblock('@param string $name'); + $this->setDocBlock('@param string $name'); $this->setBody( '$return = $this->' . $adapterProperty->getName() . '->call(' . var_export($originalClass->getName(), true) . ', \'__isset\', array($name));' . "\n\n" diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicSet.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicSet.php index 2b3c917..e5606f2 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicSet.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicSet.php @@ -16,10 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use ReflectionClass; use Zend\Code\Generator\PropertyGenerator; @@ -35,16 +37,18 @@ class MagicSet extends MagicMethodGenerator * Constructor * @param ReflectionClass $originalClass * @param \Zend\Code\Generator\PropertyGenerator $adapterProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(ReflectionClass $originalClass, PropertyGenerator $adapterProperty) { parent::__construct( $originalClass, '__set', - array(new ParameterGenerator('name'), new ParameterGenerator('value')) + [new ParameterGenerator('name'), new ParameterGenerator('value')] ); - $this->setDocblock('@param string \$name\n@param mixed \$value'); + $this->setDocBlock('@param string \$name\n@param mixed \$value'); $this->setBody( '$return = $this->' . $adapterProperty->getName() . '->call(' . var_export($originalClass->getName(), true) . ', \'__set\', array($name, $value));' . "\n\n" diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicUnset.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicUnset.php index fa7aba8..34c4016 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicUnset.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/MagicUnset.php @@ -16,10 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; -use ProxyManager\Generator\ParameterGenerator; +use Zend\Code\Generator\ParameterGenerator; use ReflectionClass; use Zend\Code\Generator\PropertyGenerator; @@ -36,12 +38,14 @@ class MagicUnset extends MagicMethodGenerator * * @param ReflectionClass $originalClass * @param PropertyGenerator $adapterProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(ReflectionClass $originalClass, PropertyGenerator $adapterProperty) { - parent::__construct($originalClass, '__unset', array(new ParameterGenerator('name'))); + parent::__construct($originalClass, '__unset', [new ParameterGenerator('name')]); - $this->setDocblock('@param string $name'); + $this->setDocBlock('@param string $name'); $this->setBody( '$return = $this->' . $adapterProperty->getName() . '->call(' . var_export($originalClass->getName(), true) . ', \'__unset\', array($name));' . "\n\n" diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/RemoteObjectMethod.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/RemoteObjectMethod.php index e8476a6..e9139f3 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/RemoteObjectMethod.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/RemoteObjectMethod.php @@ -16,10 +16,14 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator; use ProxyManager\Generator\MethodGenerator; +use ProxyManager\Generator\Util\ProxiedMethodReturnExpression; use ReflectionClass; +use Zend\Code\Generator\ParameterGenerator; use Zend\Code\Generator\PropertyGenerator; use Zend\Code\Reflection\MethodReflection; @@ -36,26 +40,27 @@ class RemoteObjectMethod extends MethodGenerator * @param \Zend\Code\Generator\PropertyGenerator $adapterProperty * @param \ReflectionClass $originalClass * - * @return RemoteObjectMethod|static + * @return self|static */ public static function generateMethod( MethodReflection $originalMethod, PropertyGenerator $adapterProperty, ReflectionClass $originalClass - ) { + ) : self { /* @var $method self */ $method = static::fromReflection($originalMethod); - $parameters = $originalMethod->getParameters(); - $list = array(); - - foreach ($parameters as $parameter) { - $list[] = '$' . $parameter->getName(); - } + $list = array_values(array_map( + function (ParameterGenerator $parameter) : string { + return '$' . $parameter->getName(); + }, + $method->getParameters() + )); $method->setBody( - '$return = $this->' . $adapterProperty->getName() . '->call(' . var_export($originalClass->getName(), true) + '$return = $this->' . $adapterProperty->getName() + . '->call(' . var_export($originalClass->getName(), true) . ', ' . var_export($originalMethod->getName(), true) . ', array('. implode(', ', $list) .'));' . "\n\n" - . 'return $return;' + . ProxiedMethodReturnExpression::generate('$return', $originalMethod) ); return $method; diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/StaticProxyConstructor.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/StaticProxyConstructor.php new file mode 100644 index 0000000..f4f70a4 --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/MethodGenerator/StaticProxyConstructor.php @@ -0,0 +1,67 @@ + + * @author Marco Pivetta + * @license MIT + */ +class StaticProxyConstructor extends MethodGenerator +{ + /** + * Constructor + * + * @param ReflectionClass $originalClass Reflection of the class to proxy + * @param PropertyGenerator $adapter Adapter property + */ + public function __construct(ReflectionClass $originalClass, PropertyGenerator $adapter) + { + $adapterName = $adapter->getName(); + + parent::__construct( + 'staticProxyConstructor', + [new ParameterGenerator($adapterName, AdapterInterface::class)], + MethodGenerator::FLAG_PUBLIC | MethodGenerator::FLAG_STATIC, + null, + 'Constructor for remote object control\n\n' + . '@param \\ProxyManager\\Factory\\RemoteObject\\AdapterInterface \$adapter' + ); + + $body = 'static $reflection;' . "\n\n" + . '$reflection = $reflection ?: $reflection = new \ReflectionClass(__CLASS__);' . "\n" + . '$instance = (new \ReflectionClass(get_class()))->newInstanceWithoutConstructor();' . "\n\n" + . '$instance->' . $adapterName . ' = $' . $adapterName . ";\n\n" + . UnsetPropertiesGenerator::generateSnippet(Properties::fromReflectionClass($originalClass), 'instance'); + + $this->setBody($body . "\n\nreturn \$instance;"); + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/PropertyGenerator/AdapterProperty.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/PropertyGenerator/AdapterProperty.php index 5ab1dd1..b78b327 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/PropertyGenerator/AdapterProperty.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObject/PropertyGenerator/AdapterProperty.php @@ -16,8 +16,11 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\RemoteObject\PropertyGenerator; +use ProxyManager\Factory\RemoteObject\AdapterInterface; use ProxyManager\Generator\Util\UniqueIdentifierGenerator; use Zend\Code\Generator\PropertyGenerator; @@ -31,12 +34,14 @@ class AdapterProperty extends PropertyGenerator { /** * Constructor + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct() { parent::__construct(UniqueIdentifierGenerator::getIdentifier('adapter')); $this->setVisibility(self::VISIBILITY_PRIVATE); - $this->setDocblock('@var \\ProxyManager\\Factory\\RemoteObject\\AdapterInterface Remote web service adapter'); + $this->setDocBlock('@var \\' . AdapterInterface::class . ' Remote web service adapter'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObjectGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObjectGenerator.php index 8a4a4e9..75118a6 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObjectGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/RemoteObjectGenerator.php @@ -16,16 +16,20 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator; +use ProxyManager\Exception\InvalidProxiedClassException; use ProxyManager\Generator\Util\ClassGeneratorUtils; +use ProxyManager\Proxy\RemoteObjectInterface; use ProxyManager\ProxyGenerator\Assertion\CanProxyAssertion; -use ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\Constructor; use ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\MagicGet; use ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\MagicIsset; use ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\MagicSet; use ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\MagicUnset; use ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\RemoteObjectMethod; +use ProxyManager\ProxyGenerator\RemoteObject\MethodGenerator\StaticProxyConstructor; use ProxyManager\ProxyGenerator\RemoteObject\PropertyGenerator\AdapterProperty; use ProxyManager\ProxyGenerator\Util\ProxiedMethodsFilter; use ReflectionClass; @@ -46,12 +50,15 @@ class RemoteObjectGenerator implements ProxyGeneratorInterface { /** * {@inheritDoc} + * + * @throws InvalidProxiedClassException + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function generate(ReflectionClass $originalClass, ClassGenerator $classGenerator) { CanProxyAssertion::assertClassCanBeProxied($originalClass); - $interfaces = array('ProxyManager\\Proxy\\RemoteObjectInterface'); + $interfaces = [RemoteObjectInterface::class]; if ($originalClass->isInterface()) { $interfaces[] = $originalClass->getName(); @@ -68,7 +75,7 @@ class RemoteObjectGenerator implements ProxyGeneratorInterface }, array_merge( array_map( - function (ReflectionMethod $method) use ($adapter, $originalClass) { + function (ReflectionMethod $method) use ($adapter, $originalClass) : RemoteObjectMethod { return RemoteObjectMethod::generateMethod( new MethodReflection($method->getDeclaringClass()->getName(), $method->getName()), $adapter, @@ -77,16 +84,16 @@ class RemoteObjectGenerator implements ProxyGeneratorInterface }, ProxiedMethodsFilter::getProxiedMethods( $originalClass, - array('__get', '__set', '__isset', '__unset') + ['__get', '__set', '__isset', '__unset'] ) ), - array( - new Constructor($originalClass, $adapter), + [ + new StaticProxyConstructor($originalClass, $adapter), new MagicGet($originalClass, $adapter), new MagicSet($originalClass, $adapter), new MagicIsset($originalClass, $adapter), new MagicUnset($originalClass, $adapter), - ) + ] ) ); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/GetMethodIfExists.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/GetMethodIfExists.php new file mode 100644 index 0000000..eb6974b --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/GetMethodIfExists.php @@ -0,0 +1,42 @@ + + * @license MIT + */ +final class GetMethodIfExists +{ + private function __construct() + { + } + + public static function get(ReflectionClass $class, string $method) : ?ReflectionMethod + { + return $class->hasMethod($method) ? $class->getMethod($method) : null; + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/Properties.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/Properties.php new file mode 100644 index 0000000..96dc06c --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/Properties.php @@ -0,0 +1,166 @@ + + * @license MIT + */ +final class Properties +{ + /** + * @var array|\ReflectionProperty[] + */ + private $properties; + + /** + * @param ReflectionProperty[] $properties + */ + private function __construct(array $properties) + { + $this->properties = $properties; + } + + public static function fromReflectionClass(ReflectionClass $reflection) : self + { + $class = $reflection; + $properties = []; + + do { + $properties = array_merge( + $properties, + array_values(array_filter( + $class->getProperties(), + function (ReflectionProperty $property) use ($class) : bool { + return $class->getName() === $property->getDeclaringClass()->getName() + && ! $property->isStatic(); + } + )) + ); + } while ($class = $class->getParentClass()); + + return new self($properties); + } + + /** + * @param string[] $excludedProperties + * + * @return self + */ + public function filter(array $excludedProperties) : self + { + $properties = $this->getInstanceProperties(); + + foreach ($excludedProperties as $propertyName) { + unset($properties[$propertyName]); + } + + return new self($properties); + } + + /** + * @return ReflectionProperty[] indexed by the property internal visibility-aware name + */ + public function getPublicProperties() : array + { + $publicProperties = []; + + foreach ($this->properties as $property) { + if ($property->isPublic()) { + $publicProperties[$property->getName()] = $property; + } + } + + return $publicProperties; + } + + /** + * @return ReflectionProperty[] indexed by the property internal visibility-aware name (\0*\0propertyName) + */ + public function getProtectedProperties() : array + { + $protectedProperties = []; + + foreach ($this->properties as $property) { + if ($property->isProtected()) { + $protectedProperties["\0*\0" . $property->getName()] = $property; + } + } + + return $protectedProperties; + } + + /** + * @return ReflectionProperty[] indexed by the property internal visibility-aware name (\0ClassName\0propertyName) + */ + public function getPrivateProperties() : array + { + $privateProperties = []; + + foreach ($this->properties as $property) { + if ($property->isPrivate()) { + $declaringClass = $property->getDeclaringClass()->getName(); + + $privateProperties["\0" . $declaringClass . "\0" . $property->getName()] = $property; + } + } + + return $privateProperties; + } + + /** + * @return ReflectionProperty[] indexed by the property internal visibility-aware name (\0*\0propertyName) + */ + public function getAccessibleProperties() : array + { + return array_merge($this->getPublicProperties(), $this->getProtectedProperties()); + } + + /** + * @return ReflectionProperty[][] indexed by class name and property name + */ + public function getGroupedPrivateProperties() : array + { + $propertiesMap = []; + + foreach ($this->getPrivateProperties() as $property) { + $class = & $propertiesMap[$property->getDeclaringClass()->getName()]; + + $class[$property->getName()] = $property; + } + + return $propertiesMap; + } + + /** + * @return ReflectionProperty[] indexed by the property internal visibility-aware name (\0*\0propertyName) + */ + public function getInstanceProperties() : array + { + return array_merge($this->getAccessibleProperties(), $this->getPrivateProperties()); + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/ProxiedMethodsFilter.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/ProxiedMethodsFilter.php index 6024e33..13126bf 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/ProxiedMethodsFilter.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/ProxiedMethodsFilter.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\Util; use ReflectionClass; @@ -27,30 +29,74 @@ use ReflectionMethod; * @author Marco Pivetta * @license MIT */ -class ProxiedMethodsFilter +final class ProxiedMethodsFilter { + /** + * @var string[] + */ + private static $defaultExcluded = [ + '__get', + '__set', + '__isset', + '__unset', + '__clone', + '__sleep', + '__wakeup', + ]; + /** * @param ReflectionClass $class reflection class from which methods should be extracted * @param string[] $excluded methods to be ignored * * @return ReflectionMethod[] */ - public static function getProxiedMethods( - ReflectionClass $class, - array $excluded = array('__get', '__set', '__isset', '__unset', '__clone', '__sleep', '__wakeup') - ) { + public static function getProxiedMethods(ReflectionClass $class, array $excluded = null) : array + { + return self::doFilter($class, (null === $excluded) ? self::$defaultExcluded : $excluded); + } + + /** + * @param ReflectionClass $class reflection class from which methods should be extracted + * @param string[] $excluded methods to be ignored + * + * @return ReflectionMethod[] + */ + public static function getAbstractProxiedMethods(ReflectionClass $class, array $excluded = null) : array + { + return self::doFilter($class, (null === $excluded) ? self::$defaultExcluded : $excluded, true); + } + + /** + * @param ReflectionClass $class + * @param string[] $excluded + * @param bool $requireAbstract + * + * @return ReflectionMethod[] + */ + private static function doFilter(ReflectionClass $class, array $excluded, bool $requireAbstract = false) : array + { $ignored = array_flip(array_map('strtolower', $excluded)); return array_filter( $class->getMethods(ReflectionMethod::IS_PUBLIC), - function (ReflectionMethod $method) use ($ignored) { - return ! ( - $method->isConstructor() - || isset($ignored[strtolower($method->getName())]) - || $method->isFinal() - || $method->isStatic() + function (ReflectionMethod $method) use ($ignored, $requireAbstract) : bool { + return (! $requireAbstract || $method->isAbstract()) && ! ( + \array_key_exists(strtolower($method->getName()), $ignored) + || self::methodCannotBeProxied($method) ); } ); } + + /** + * Checks whether the method cannot be proxied + * + * @param ReflectionMethod $method + * + * @return bool + */ + private static function methodCannotBeProxied(ReflectionMethod $method) : bool + { + return $method->isConstructor() || $method->isFinal() || $method->isStatic(); + } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/PublicScopeSimulator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/PublicScopeSimulator.php index a908e58..253b73a 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/PublicScopeSimulator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/PublicScopeSimulator.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\Util; use Zend\Code\Generator\PropertyGenerator; @@ -53,12 +55,12 @@ class PublicScopeSimulator * @throws \InvalidArgumentException */ public static function getPublicAccessSimulationCode( - $operationType, - $nameParameter, + string $operationType, + string $nameParameter, $valueParameter = null, PropertyGenerator $valueHolder = null, $returnPropertyName = null - ) { + ) : string { $byRef = self::getByRefReturnValue($operationType); $value = static::OPERATION_SET === $operationType ? ', $value' : ''; $target = '$this'; @@ -71,7 +73,7 @@ class PublicScopeSimulator . 'if (! $realInstanceReflection->hasProperty($' . $nameParameter . ')) {' . "\n" . ' $targetObject = ' . $target . ';' . "\n\n" . self::getUndefinedPropertyNotice($operationType, $nameParameter) - . ' ' . self::getOperation($operationType, $nameParameter, $valueParameter) . ";\n" + . ' ' . self::getOperation($operationType, $nameParameter, $valueParameter) . "\n" . " return;\n" . '}' . "\n\n" . '$targetObject = ' . self::getTargetObject($valueHolder) . ";\n" @@ -94,18 +96,23 @@ class PublicScopeSimulator * * @return string */ - private static function getUndefinedPropertyNotice($operationType, $nameParameter) + private static function getUndefinedPropertyNotice(string $operationType, string $nameParameter) : string { if (static::OPERATION_GET !== $operationType) { return ''; } - // return ' $backtrace = debug_backtrace(false);' . "\n" - . ' trigger_error(\'Undefined property: \' . get_parent_class($this) . \'::$\' . $' - . $nameParameter - . ' . \' in \' . $backtrace[0][\'file\'] . \' on line \' . $backtrace[0][\'line\'], \E_USER_NOTICE);' - . "\n"; + . ' trigger_error(' . "\n" + . ' sprintf(' . "\n" + . ' \'Undefined property: %s::$%s in %s on line %s\',' . "\n" + . ' get_parent_class($this),' . "\n" + . ' $' . $nameParameter . ',' . "\n" + . ' $backtrace[0][\'file\'],' . "\n" + . ' $backtrace[0][\'line\']' . "\n" + . ' ),' . "\n" + . ' \E_USER_NOTICE' . "\n" + . ' );' . "\n"; } /** @@ -119,7 +126,7 @@ class PublicScopeSimulator * * @return string */ - private static function getByRefReturnValue($operationType) + private static function getByRefReturnValue(string $operationType) : string { return (static::OPERATION_GET === $operationType || static::OPERATION_SET === $operationType) ? '& ' : ''; } @@ -131,7 +138,7 @@ class PublicScopeSimulator * * @return string */ - private static function getTargetObject(PropertyGenerator $valueHolder = null) + private static function getTargetObject(PropertyGenerator $valueHolder = null) : string { if ($valueHolder) { return '$this->' . $valueHolder->getName(); @@ -149,11 +156,11 @@ class PublicScopeSimulator * * @throws \InvalidArgumentException */ - private static function getOperation($operationType, $nameParameter, $valueParameter) + private static function getOperation(string $operationType, string $nameParameter, $valueParameter) : string { switch ($operationType) { case static::OPERATION_GET: - return 'return $targetObject->$' . $nameParameter . ";"; + return 'return $targetObject->$' . $nameParameter . ';'; case static::OPERATION_SET: if (! $valueParameter) { throw new \InvalidArgumentException('Parameter $valueParameter not provided'); @@ -170,21 +177,15 @@ class PublicScopeSimulator } /** - * Generates code to bind operations to the parent scope if supported by the current PHP implementation + * Generates code to bind operations to the parent scope * * @return string */ - private static function getScopeReBind() + private static function getScopeReBind() : string { - if (! method_exists('Closure', 'bind')) { - // @codeCoverageIgnoreStart - return ''; - // @codeCoverageIgnoreEnd - } - - return ' $backtrace = debug_backtrace(true);' . "\n" - . ' $scopeObject = isset($backtrace[1][\'object\'])' - . ' ? $backtrace[1][\'object\'] : new \stdClass();' . "\n" - . ' $accessor = $accessor->bindTo($scopeObject, get_class($scopeObject));' . "\n"; + return '$backtrace = debug_backtrace(true);' . "\n" + . '$scopeObject = isset($backtrace[1][\'object\'])' + . ' ? $backtrace[1][\'object\'] : new \ProxyManager\Stub\EmptyClassStub();' . "\n" + . '$accessor = $accessor->bindTo($scopeObject, get_class($scopeObject));' . "\n"; } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/UnsetPropertiesGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/UnsetPropertiesGenerator.php new file mode 100644 index 0000000..88a6f3c --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/Util/UnsetPropertiesGenerator.php @@ -0,0 +1,110 @@ + + * @license MIT + */ +final class UnsetPropertiesGenerator +{ + private static $closureTemplate = <<<'PHP' +\Closure::bind(function (\%s $instance) { + %s +}, $%s, %s)->__invoke($%s); +PHP; + + public static function generateSnippet(Properties $properties, string $instanceName) : string + { + return self::generateUnsetAccessiblePropertiesCode($properties, $instanceName) + . self::generateUnsetPrivatePropertiesCode($properties, $instanceName); + } + + private static function generateUnsetAccessiblePropertiesCode(Properties $properties, string $instanceName) : string + { + $accessibleProperties = $properties->getAccessibleProperties(); + + if (! $accessibleProperties) { + return ''; + } + + return self::generateUnsetStatement($accessibleProperties, $instanceName) . "\n\n"; + } + + private static function generateUnsetPrivatePropertiesCode(Properties $properties, string $instanceName) : string + { + $groups = $properties->getGroupedPrivateProperties(); + + if (! $groups) { + return ''; + } + + $unsetClosureCalls = []; + + /* @var $privateProperties \ReflectionProperty[] */ + foreach ($groups as $privateProperties) { + /* @var $firstProperty \ReflectionProperty */ + $firstProperty = reset($privateProperties); + + $unsetClosureCalls[] = self::generateUnsetClassPrivatePropertiesBlock( + $firstProperty->getDeclaringClass(), + $privateProperties, + $instanceName + ); + } + + return implode("\n\n", $unsetClosureCalls) . "\n\n"; + } + + private static function generateUnsetClassPrivatePropertiesBlock( + \ReflectionClass $declaringClass, + array $properties, + string $instanceName + ) : string { + $declaringClassName = $declaringClass->getName(); + + return sprintf( + self::$closureTemplate, + $declaringClassName, + self::generateUnsetStatement($properties, 'instance'), + $instanceName, + var_export($declaringClassName, true), + $instanceName + ); + } + + private static function generateUnsetStatement(array $properties, string $instanceName) : string + { + return 'unset(' + . implode( + ', ', + array_map( + function (\ReflectionProperty $property) use ($instanceName) : string { + return '$' . $instanceName . '->' . $property->getName(); + }, + $properties + ) + ) + . ');'; + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/Constructor.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/Constructor.php new file mode 100644 index 0000000..32a9560 --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/Constructor.php @@ -0,0 +1,123 @@ + + * @license MIT + */ +class Constructor extends MethodGenerator +{ + /** + * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $valueHolder + * + * @return self + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException + */ + public static function generateMethod(ReflectionClass $originalClass, PropertyGenerator $valueHolder) : self + { + $originalConstructor = self::getConstructor($originalClass); + + $constructor = $originalConstructor + ? self::fromReflection($originalConstructor) + : new self('__construct'); + + $constructor->setDocBlock('{@inheritDoc}'); + $constructor->setBody( + 'static $reflection;' . "\n\n" + . 'if (! $this->' . $valueHolder->getName() . ') {' . "\n" + . ' $reflection = $reflection ?: new \ReflectionClass(' + . var_export($originalClass->getName(), true) + . ");\n" + . ' $this->' . $valueHolder->getName() . ' = $reflection->newInstanceWithoutConstructor();' . "\n" + . UnsetPropertiesGenerator::generateSnippet(Properties::fromReflectionClass($originalClass), 'this') + . '}' + . self::generateOriginalConstructorCall($originalClass, $valueHolder) + ); + + return $constructor; + } + + private static function generateOriginalConstructorCall( + ReflectionClass $class, + PropertyGenerator $valueHolder + ) : string { + $originalConstructor = self::getConstructor($class); + + if (! $originalConstructor) { + return ''; + } + + $constructor = self::fromReflection($originalConstructor); + + return "\n\n" + . '$this->' . $valueHolder->getName() . '->' . $constructor->getName() . '(' + . implode( + ', ', + array_map( + function (ParameterGenerator $parameter) : string { + return ($parameter->getVariadic() ? '...' : '') . '$' . $parameter->getName(); + }, + $constructor->getParameters() + ) + ) + . ');'; + } + + /** + * @param ReflectionClass $class + * + * @return MethodReflection|null + */ + private static function getConstructor(ReflectionClass $class) + { + $constructors = array_map( + function (\ReflectionMethod $method) : MethodReflection { + return new MethodReflection( + $method->getDeclaringClass()->getName(), + $method->getName() + ); + }, + array_filter( + $class->getMethods(), + function (\ReflectionMethod $method) : bool { + return $method->isConstructor(); + } + ) + ); + + return reset($constructors) ?: null; + } +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/GetWrappedValueHolderValue.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/GetWrappedValueHolderValue.php index 7db81d3..ad1bbe7 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/GetWrappedValueHolderValue.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/GetWrappedValueHolderValue.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\ValueHolder\MethodGenerator; use ProxyManager\Generator\MethodGenerator; @@ -32,11 +34,15 @@ class GetWrappedValueHolderValue extends MethodGenerator { /** * Constructor + * + * @param PropertyGenerator $valueHolderProperty + * + * @throws \Zend\Code\Generator\Exception\InvalidArgumentException */ public function __construct(PropertyGenerator $valueHolderProperty) { parent::__construct('getWrappedValueHolderValue'); - $this->setDocblock('{@inheritDoc}'); + $this->setDocBlock('{@inheritDoc}'); $this->setBody('return $this->' . $valueHolderProperty->getName() . ';'); } } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/MagicSleep.php b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/MagicSleep.php index 17aa0fd..97a68b1 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/MagicSleep.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/ProxyGenerator/ValueHolder/MethodGenerator/MagicSleep.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\ProxyGenerator\ValueHolder\MethodGenerator; use ProxyManager\Generator\MagicMethodGenerator; @@ -32,6 +34,9 @@ class MagicSleep extends MagicMethodGenerator { /** * Constructor + * + * @param ReflectionClass $originalClass + * @param PropertyGenerator $valueHolderProperty */ public function __construct(ReflectionClass $originalClass, PropertyGenerator $valueHolderProperty) { diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/ClassSignatureGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/ClassSignatureGenerator.php index 70e90ac..066126d 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/ClassSignatureGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/ClassSignatureGenerator.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Signature; use Zend\Code\Generator\ClassGenerator; @@ -44,8 +46,10 @@ final class ClassSignatureGenerator implements ClassSignatureGeneratorInterface /** * {@inheritDoc} + * + * @throws \Zend\Code\Exception\InvalidArgumentException */ - public function addSignature(ClassGenerator $classGenerator, array $parameters) + public function addSignature(ClassGenerator $classGenerator, array $parameters) : ClassGenerator { $classGenerator->addPropertyFromGenerator(new PropertyGenerator( 'signature' . $this->signatureGenerator->generateSignatureKey($parameters), diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/ClassSignatureGeneratorInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/ClassSignatureGeneratorInterface.php index a5553ed..281b1cf 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/ClassSignatureGeneratorInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/ClassSignatureGeneratorInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Signature; use Zend\Code\Generator\ClassGenerator; @@ -36,5 +38,5 @@ interface ClassSignatureGeneratorInterface * * @return ClassGenerator */ - public function addSignature(ClassGenerator $classGenerator, array $parameters); + public function addSignature(ClassGenerator $classGenerator, array $parameters) : ClassGenerator; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/ExceptionInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/ExceptionInterface.php index c103153..c554817 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/ExceptionInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/ExceptionInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Signature\Exception; /** diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/InvalidSignatureException.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/InvalidSignatureException.php index 7e974fc..1373656 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/InvalidSignatureException.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/InvalidSignatureException.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Signature\Exception; use ReflectionClass; @@ -37,8 +39,12 @@ class InvalidSignatureException extends UnexpectedValueException implements Exce * * @return self */ - public static function fromInvalidSignature(ReflectionClass $class, array $parameters, $signature, $expected) - { + public static function fromInvalidSignature( + ReflectionClass $class, + array $parameters, + string $signature, + string $expected + ) : self { return new self(sprintf( 'Found signature "%s" for class "%s" does not correspond to expected signature "%s" for %d parameters', $signature, diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/MissingSignatureException.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/MissingSignatureException.php index e53f527..1e221a4 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/MissingSignatureException.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/Exception/MissingSignatureException.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Signature\Exception; use ReflectionClass; @@ -36,7 +38,7 @@ class MissingSignatureException extends UnexpectedValueException implements Exce * * @return self */ - public static function fromMissingSignature(ReflectionClass $class, array $parameters, $expected) + public static function fromMissingSignature(ReflectionClass $class, array $parameters, string $expected) : self { return new self(sprintf( 'No signature found for class "%s", expected signature "%s" for %d parameters', diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureChecker.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureChecker.php index 0a674ec..80ca622 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureChecker.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureChecker.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Signature; use ProxyManager\Signature\Exception\InvalidSignatureException; @@ -52,7 +54,7 @@ final class SignatureChecker implements SignatureCheckerInterface $signature = $this->signatureGenerator->generateSignature($parameters); $defaultProperties = $class->getDefaultProperties(); - if (! isset($defaultProperties[$propertyName])) { + if (! \array_key_exists($propertyName, $defaultProperties)) { throw MissingSignatureException::fromMissingSignature($class, $parameters, $signature); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureCheckerInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureCheckerInterface.php index ded6561..be019f3 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureCheckerInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureCheckerInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Signature; use ReflectionClass; diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGenerator.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGenerator.php index 473d3ea..64b88c1 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGenerator.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGenerator.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Signature; use ProxyManager\Inflector\Util\ParameterEncoder; @@ -51,7 +53,7 @@ final class SignatureGenerator implements SignatureGeneratorInterface /** * {@inheritDoc} */ - public function generateSignature(array $parameters) + public function generateSignature(array $parameters) : string { return $this->parameterEncoder->encodeParameters($parameters); } @@ -59,7 +61,7 @@ final class SignatureGenerator implements SignatureGeneratorInterface /** * {@inheritDoc} */ - public function generateSignatureKey(array $parameters) + public function generateSignatureKey(array $parameters) : string { return $this->parameterHasher->hashParameters($parameters); } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGeneratorInterface.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGeneratorInterface.php index 68ad30b..22a6d44 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGeneratorInterface.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Signature/SignatureGeneratorInterface.php @@ -16,6 +16,8 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager\Signature; /** @@ -33,7 +35,7 @@ interface SignatureGeneratorInterface * * @return string */ - public function generateSignature(array $parameters); + public function generateSignature(array $parameters) : string; /** * Generates a signature key to be looked up when verifying generated code validity @@ -42,5 +44,5 @@ interface SignatureGeneratorInterface * * @return string */ - public function generateSignatureKey(array $parameters); + public function generateSignatureKey(array $parameters) : string; } diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Stub/EmptyClassStub.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Stub/EmptyClassStub.php new file mode 100644 index 0000000..50d8510 --- /dev/null +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Stub/EmptyClassStub.php @@ -0,0 +1,31 @@ + + * @license MIT + */ +final class EmptyClassStub +{ +} diff --git a/vendor/ocramius/proxy-manager/src/ProxyManager/Version.php b/vendor/ocramius/proxy-manager/src/ProxyManager/Version.php index a036711..b0c82dd 100644 --- a/vendor/ocramius/proxy-manager/src/ProxyManager/Version.php +++ b/vendor/ocramius/proxy-manager/src/ProxyManager/Version.php @@ -16,8 +16,12 @@ * and is licensed under the MIT license. */ +declare(strict_types=1); + namespace ProxyManager; +use PackageVersions\Versions; + /** * Version class - to be adjusted when a new release is created. * @@ -28,12 +32,23 @@ namespace ProxyManager; */ final class Version { - const VERSION = '1.0.0'; - /** * Private constructor - this class is not meant to be instantiated */ private function __construct() { } + + /** + * Retrieves the package version in the format @, + * where the detected version is what composer could detect. + * + * @return string + * + * @throws \OutOfBoundsException + */ + public static function getVersion() : string + { + return Versions::getVersion('ocramius/proxy-manager'); + } } diff --git a/vendor/paragonie/random_compat/composer.json b/vendor/paragonie/random_compat/composer.json index d363f4c..1fa8de9 100644 --- a/vendor/paragonie/random_compat/composer.json +++ b/vendor/paragonie/random_compat/composer.json @@ -1,35 +1,34 @@ { - "name": "paragonie/random_compat", - "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", - "keywords": [ - "csprng", - "random", - "pseudorandom" - ], - "license": "MIT", - "type": "library", - "authors": [ - { - "name": "Paragon Initiative Enterprises", - "email": "security@paragonie.com", - "homepage": "https://paragonie.com" - } - ], - "support": { - "issues": "https://github.com/paragonie/random_compat/issues", - "email": "info@paragonie.com", - "source": "https://github.com/paragonie/random_compat" - }, - "require": { - "php": ">=5.2.0" - }, - "require-dev": { - "phpunit/phpunit": "4.*|5.*" - }, - "suggest": { - "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." - }, - "autoload": { - "files": ["lib/random.php"] + "name": "paragonie/random_compat", + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "random", + "polyfill", + "pseudorandom" + ], + "license": "MIT", + "type": "library", + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" } + ], + "support": { + "issues": "https://github.com/paragonie/random_compat/issues", + "email": "info@paragonie.com", + "source": "https://github.com/paragonie/random_compat" + }, + "require": { + "php": "^7" + }, + "require-dev": { + "vimeo/psalm": "^1", + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + } } diff --git a/vendor/paragonie/random_compat/lib/random.php b/vendor/paragonie/random_compat/lib/random.php index 8a29adc..c7731a5 100644 --- a/vendor/paragonie/random_compat/lib/random.php +++ b/vendor/paragonie/random_compat/lib/random.php @@ -3,12 +3,12 @@ * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * - * @version 1.4.3 - * @released 2018-04-04 + * @version 2.99.99 + * @released 2018-06-06 * * The MIT License (MIT) * - * Copyright (c) 2015 - 2016 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -29,219 +29,4 @@ * SOFTWARE. */ -if (!defined('PHP_VERSION_ID')) { - // This constant was introduced in PHP 5.2.7 - $RandomCompatversion = array_map('intval', explode('.', PHP_VERSION)); - define( - 'PHP_VERSION_ID', - $RandomCompatversion[0] * 10000 - + $RandomCompatversion[1] * 100 - + $RandomCompatversion[2] - ); - $RandomCompatversion = null; -} - -/** - * PHP 7.0.0 and newer have these functions natively. - */ -if (PHP_VERSION_ID >= 70000) { - return; -} - -if (!defined('RANDOM_COMPAT_READ_BUFFER')) { - define('RANDOM_COMPAT_READ_BUFFER', 8); -} - -$RandomCompatDIR = dirname(__FILE__); - -require_once $RandomCompatDIR . '/byte_safe_strings.php'; -require_once $RandomCompatDIR . '/cast_to_int.php'; -require_once $RandomCompatDIR . '/error_polyfill.php'; - -if (!is_callable('random_bytes')) { - /** - * PHP 5.2.0 - 5.6.x way to implement random_bytes() - * - * We use conditional statements here to define the function in accordance - * to the operating environment. It's a micro-optimization. - * - * In order of preference: - * 1. Use libsodium if available. - * 2. fread() /dev/urandom if available (never on Windows) - * 3. mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM) - * 4. COM('CAPICOM.Utilities.1')->GetRandom() - * - * See RATIONALE.md for our reasoning behind this particular order - */ - if (extension_loaded('libsodium')) { - // See random_bytes_libsodium.php - if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { - require_once $RandomCompatDIR . '/random_bytes_libsodium.php'; - } elseif (method_exists('Sodium', 'randombytes_buf')) { - require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php'; - } - } - - /** - * Reading directly from /dev/urandom: - */ - if (DIRECTORY_SEPARATOR === '/') { - // DIRECTORY_SEPARATOR === '/' on Unix-like OSes -- this is a fast - // way to exclude Windows. - $RandomCompatUrandom = true; - $RandomCompat_basedir = ini_get('open_basedir'); - - if (!empty($RandomCompat_basedir)) { - $RandomCompat_open_basedir = explode( - PATH_SEPARATOR, - strtolower($RandomCompat_basedir) - ); - $RandomCompatUrandom = (array() !== array_intersect( - array('/dev', '/dev/', '/dev/urandom'), - $RandomCompat_open_basedir - )); - $RandomCompat_open_basedir = null; - } - - if ( - !is_callable('random_bytes') - && - $RandomCompatUrandom - && - @is_readable('/dev/urandom') - ) { - // Error suppression on is_readable() in case of an open_basedir - // or safe_mode failure. All we care about is whether or not we - // can read it at this point. If the PHP environment is going to - // panic over trying to see if the file can be read in the first - // place, that is not helpful to us here. - - // See random_bytes_dev_urandom.php - require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php'; - } - // Unset variables after use - $RandomCompat_basedir = null; - } else { - $RandomCompatUrandom = false; - } - - /** - * mcrypt_create_iv() - * - * We only want to use mcypt_create_iv() if: - * - * - random_bytes() hasn't already been defined - * - the mcrypt extensions is loaded - * - One of these two conditions is true: - * - We're on Windows (DIRECTORY_SEPARATOR !== '/') - * - We're not on Windows and /dev/urandom is readabale - * (i.e. we're not in a chroot jail) - * - Special case: - * - If we're not on Windows, but the PHP version is between - * 5.6.10 and 5.6.12, we don't want to use mcrypt. It will - * hang indefinitely. This is bad. - * - If we're on Windows, we want to use PHP >= 5.3.7 or else - * we get insufficient entropy errors. - */ - if ( - !is_callable('random_bytes') - && - // Windows on PHP < 5.3.7 is broken, but non-Windows is not known to be. - (DIRECTORY_SEPARATOR === '/' || PHP_VERSION_ID >= 50307) - && - // Prevent this code from hanging indefinitely on non-Windows; - // see https://bugs.php.net/bug.php?id=69833 - ( - DIRECTORY_SEPARATOR !== '/' || - (PHP_VERSION_ID <= 50609 || PHP_VERSION_ID >= 50613) - ) - && - extension_loaded('mcrypt') - ) { - // See random_bytes_mcrypt.php - require_once $RandomCompatDIR . '/random_bytes_mcrypt.php'; - } - $RandomCompatUrandom = null; - - /** - * This is a Windows-specific fallback, for when the mcrypt extension - * isn't loaded. - */ - if ( - !is_callable('random_bytes') - && - extension_loaded('com_dotnet') - && - class_exists('COM') - ) { - $RandomCompat_disabled_classes = preg_split( - '#\s*,\s*#', - strtolower(ini_get('disable_classes')) - ); - - if (!in_array('com', $RandomCompat_disabled_classes)) { - try { - $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); - if (method_exists($RandomCompatCOMtest, 'GetRandom')) { - // See random_bytes_com_dotnet.php - require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php'; - } - } catch (com_exception $e) { - // Don't try to use it. - } - } - $RandomCompat_disabled_classes = null; - $RandomCompatCOMtest = null; - } - - /** - * openssl_random_pseudo_bytes() - */ - if ( - ( - // Unix-like with PHP >= 5.3.0 or - ( - DIRECTORY_SEPARATOR === '/' - && - PHP_VERSION_ID >= 50300 - ) - || - // Windows with PHP >= 5.4.1 - PHP_VERSION_ID >= 50401 - ) - && - !function_exists('random_bytes') - && - extension_loaded('openssl') - ) { - // See random_bytes_openssl.php - require_once $RandomCompatDIR . '/random_bytes_openssl.php'; - } - - /** - * throw new Exception - */ - if (!is_callable('random_bytes')) { - /** - * We don't have any more options, so let's throw an exception right now - * and hope the developer won't let it fail silently. - * - * @param mixed $length - * @return void - * @throws Exception - */ - function random_bytes($length) - { - unset($length); // Suppress "variable not used" warnings. - throw new Exception( - 'There is no suitable CSPRNG installed on your system' - ); - } - } -} - -if (!is_callable('random_int')) { - require_once $RandomCompatDIR . '/random_int.php'; -} - -$RandomCompatDIR = null; +// NOP diff --git a/vendor/paragonie/random_compat/psalm.xml b/vendor/paragonie/random_compat/psalm.xml index f501315..596d99d 100644 --- a/vendor/paragonie/random_compat/psalm.xml +++ b/vendor/paragonie/random_compat/psalm.xml @@ -8,8 +8,12 @@ + + + + diff --git a/vendor/patchwork/utf8/appveyor.yml b/vendor/patchwork/utf8/appveyor.yml index aba4afd..bfbf099 100644 --- a/vendor/patchwork/utf8/appveyor.yml +++ b/vendor/patchwork/utf8/appveyor.yml @@ -17,12 +17,10 @@ init: install: - IF EXIST c:\php (SET PHP=0) ELSE (mkdir c:\php) - cd c:\php - - IF %PHP%==1 appveyor DownloadFile http://windows.php.net/downloads/releases/archives/php-5.5.9-nts-Win32-VC11-x86.zip + - IF %PHP%==1 appveyor DownloadFile https://github.com/symfony/binary-utils/releases/download/v0.1/php-5.5.9-nts-Win32-VC11-x86.zip - IF %PHP%==1 7z x php-5.5.9-nts-Win32-VC11-x86.zip -y >nul - IF %PHP%==1 del /Q *.zip - - IF %PHP%==1 appveyor DownloadFile https://phar.phpunit.de/phpunit-4.8.15.phar - IF %PHP%==1 echo @php %%~dp0composer.phar %%* > composer.bat - - IF %PHP%==1 echo @php %%~dp0phpunit-4.8.15.phar %%* > phpunit.bat - IF %PHP%==1 copy /Y php.ini-development php.ini - IF %PHP%==1 echo max_execution_time=1200 >> php.ini - IF %PHP%==1 echo date.timezone="UTC" >> php.ini @@ -34,6 +32,7 @@ install: - cd c:\projects\utf8 - IF %APPVEYOR_REPO_BRANCH%==master (SET COMPOSER_ROOT_VERSION=dev-master) ELSE (SET COMPOSER_ROOT_VERSION=%APPVEYOR_REPO_BRANCH%.x-dev) - composer update --prefer-source --no-progress --ansi + - vendor/bin/simple-phpunit install test_script: - - phpunit + - vendor/bin/simple-phpunit diff --git a/vendor/patchwork/utf8/composer.json b/vendor/patchwork/utf8/composer.json index 6e0e64b..74bff70 100644 --- a/vendor/patchwork/utf8/composer.json +++ b/vendor/patchwork/utf8/composer.json @@ -32,5 +32,8 @@ "branch-alias": { "dev-master": "1.3-dev" } + }, + "require-dev": { + "symfony/phpunit-bridge": "^3.4|^4.4" } } diff --git a/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/charset/translit.ser b/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/charset/translit.ser index 5e5652d..f26c89d 100644 --- a/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/charset/translit.ser +++ b/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/charset/translit.ser @@ -1 +1 @@ -a:3960:{s:2:"µ";s:2:"μ";s:2:"¼";s:7:" 1⁄4 ";s:2:"½";s:7:" 1⁄2 ";s:2:"¾";s:7:" 3⁄4 ";s:2:"IJ";s:2:"IJ";s:2:"ij";s:2:"ij";s:2:"Ŀ";s:3:"L·";s:2:"ŀ";s:3:"l·";s:2:"ʼn";s:3:"ʼn";s:2:"ſ";s:1:"s";s:2:"DŽ";s:3:"DŽ";s:2:"Dž";s:3:"Dž";s:2:"dž";s:3:"dž";s:2:"LJ";s:2:"LJ";s:2:"Lj";s:2:"Lj";s:2:"lj";s:2:"lj";s:2:"NJ";s:2:"NJ";s:2:"Nj";s:2:"Nj";s:2:"nj";s:2:"nj";s:2:"DZ";s:2:"DZ";s:2:"Dz";s:2:"Dz";s:2:"dz";s:2:"dz";s:2:"ϐ";s:2:"β";s:2:"ϑ";s:2:"θ";s:2:"ϒ";s:2:"Υ";s:2:"ϕ";s:2:"φ";s:2:"ϖ";s:2:"π";s:2:"ϰ";s:2:"κ";s:2:"ϱ";s:2:"ρ";s:2:"ϲ";s:2:"ς";s:2:"ϴ";s:2:"Θ";s:2:"ϵ";s:2:"ε";s:2:"Ϲ";s:2:"Σ";s:2:"և";s:4:"եւ";s:2:"ٵ";s:4:"اٴ";s:2:"ٶ";s:4:"وٴ";s:2:"ٷ";s:4:"ۇٴ";s:2:"ٸ";s:4:"يٴ";s:3:"ำ";s:6:"ํา";s:3:"ຳ";s:6:"ໍາ";s:3:"ໜ";s:6:"ຫນ";s:3:"ໝ";s:6:"ຫມ";s:3:"ཷ";s:6:"ྲཱྀ";s:3:"ཹ";s:6:"ླཱྀ";s:3:"ẚ";s:3:"aʾ";s:3:"․";s:1:".";s:3:"‥";s:2:"..";s:3:"…";s:3:"...";s:3:"″";s:6:"′′";s:3:"‴";s:9:"′′′";s:3:"‶";s:6:"‵‵";s:3:"‷";s:9:"‵‵‵";s:3:"‼";s:2:"!!";s:3:"⁇";s:2:"??";s:3:"⁈";s:2:"?!";s:3:"⁉";s:2:"!?";s:3:"⁗";s:12:"′′′′";s:3:"₨";s:2:"Rs";s:3:"℀";s:3:"a/c";s:3:"℁";s:3:"a/s";s:3:"ℂ";s:1:"C";s:3:"℃";s:3:"°C";s:3:"℅";s:3:"c/o";s:3:"℆";s:3:"c/u";s:3:"ℇ";s:2:"Ɛ";s:3:"℉";s:3:"°F";s:3:"ℊ";s:1:"g";s:3:"ℋ";s:1:"H";s:3:"ℌ";s:1:"H";s:3:"ℍ";s:1:"H";s:3:"ℎ";s:1:"h";s:3:"ℏ";s:2:"ħ";s:3:"ℐ";s:1:"I";s:3:"ℑ";s:1:"I";s:3:"ℒ";s:1:"L";s:3:"ℓ";s:1:"l";s:3:"ℕ";s:1:"N";s:3:"№";s:2:"No";s:3:"ℙ";s:1:"P";s:3:"ℚ";s:1:"Q";s:3:"ℛ";s:1:"R";s:3:"ℜ";s:1:"R";s:3:"ℝ";s:1:"R";s:3:"℡";s:3:"TEL";s:3:"ℤ";s:1:"Z";s:3:"ℨ";s:1:"Z";s:3:"ℬ";s:1:"B";s:3:"ℭ";s:1:"C";s:3:"ℯ";s:1:"e";s:3:"ℰ";s:1:"E";s:3:"ℱ";s:1:"F";s:3:"ℳ";s:1:"M";s:3:"ℴ";s:1:"o";s:3:"ℵ";s:2:"א";s:3:"ℶ";s:2:"ב";s:3:"ℷ";s:2:"ג";s:3:"ℸ";s:2:"ד";s:3:"ℹ";s:1:"i";s:3:"℻";s:3:"FAX";s:3:"ℼ";s:2:"π";s:3:"ℽ";s:2:"γ";s:3:"ℾ";s:2:"Γ";s:3:"ℿ";s:2:"Π";s:3:"⅀";s:3:"∑";s:3:"ⅅ";s:1:"D";s:3:"ⅆ";s:1:"d";s:3:"ⅇ";s:1:"e";s:3:"ⅈ";s:1:"i";s:3:"ⅉ";s:1:"j";s:3:"⅐";s:7:" 1⁄7 ";s:3:"⅑";s:7:" 1⁄9 ";s:3:"⅒";s:8:" 1⁄10 ";s:3:"⅓";s:7:" 1⁄3 ";s:3:"⅔";s:7:" 2⁄3 ";s:3:"⅕";s:7:" 1⁄5 ";s:3:"⅖";s:7:" 2⁄5 ";s:3:"⅗";s:7:" 3⁄5 ";s:3:"⅘";s:7:" 4⁄5 ";s:3:"⅙";s:7:" 1⁄6 ";s:3:"⅚";s:7:" 5⁄6 ";s:3:"⅛";s:7:" 1⁄8 ";s:3:"⅜";s:7:" 3⁄8 ";s:3:"⅝";s:7:" 5⁄8 ";s:3:"⅞";s:7:" 7⁄8 ";s:3:"⅟";s:6:" 1⁄ ";s:3:"Ⅰ";s:1:"I";s:3:"Ⅱ";s:2:"II";s:3:"Ⅲ";s:3:"III";s:3:"Ⅳ";s:2:"IV";s:3:"Ⅴ";s:1:"V";s:3:"Ⅵ";s:2:"VI";s:3:"Ⅶ";s:3:"VII";s:3:"Ⅷ";s:4:"VIII";s:3:"Ⅸ";s:2:"IX";s:3:"Ⅹ";s:1:"X";s:3:"Ⅺ";s:2:"XI";s:3:"Ⅻ";s:3:"XII";s:3:"Ⅼ";s:1:"L";s:3:"Ⅽ";s:1:"C";s:3:"Ⅾ";s:1:"D";s:3:"Ⅿ";s:1:"M";s:3:"ⅰ";s:1:"i";s:3:"ⅱ";s:2:"ii";s:3:"ⅲ";s:3:"iii";s:3:"ⅳ";s:2:"iv";s:3:"ⅴ";s:1:"v";s:3:"ⅵ";s:2:"vi";s:3:"ⅶ";s:3:"vii";s:3:"ⅷ";s:4:"viii";s:3:"ⅸ";s:2:"ix";s:3:"ⅹ";s:1:"x";s:3:"ⅺ";s:2:"xi";s:3:"ⅻ";s:3:"xii";s:3:"ⅼ";s:1:"l";s:3:"ⅽ";s:1:"c";s:3:"ⅾ";s:1:"d";s:3:"ⅿ";s:1:"m";s:3:"↉";s:7:" 0⁄3 ";s:3:"∬";s:6:"∫∫";s:3:"∭";s:9:"∫∫∫";s:3:"∯";s:6:"∮∮";s:3:"∰";s:9:"∮∮∮";s:3:"①";s:3:"(1)";s:3:"②";s:3:"(2)";s:3:"③";s:3:"(3)";s:3:"④";s:3:"(4)";s:3:"⑤";s:3:"(5)";s:3:"⑥";s:3:"(6)";s:3:"⑦";s:3:"(7)";s:3:"⑧";s:3:"(8)";s:3:"⑨";s:3:"(9)";s:3:"⑩";s:4:"(10)";s:3:"⑪";s:4:"(11)";s:3:"⑫";s:4:"(12)";s:3:"⑬";s:4:"(13)";s:3:"⑭";s:4:"(14)";s:3:"⑮";s:4:"(15)";s:3:"⑯";s:4:"(16)";s:3:"⑰";s:4:"(17)";s:3:"⑱";s:4:"(18)";s:3:"⑲";s:4:"(19)";s:3:"⑳";s:4:"(20)";s:3:"⑴";s:3:"(1)";s:3:"⑵";s:3:"(2)";s:3:"⑶";s:3:"(3)";s:3:"⑷";s:3:"(4)";s:3:"⑸";s:3:"(5)";s:3:"⑹";s:3:"(6)";s:3:"⑺";s:3:"(7)";s:3:"⑻";s:3:"(8)";s:3:"⑼";s:3:"(9)";s:3:"⑽";s:4:"(10)";s:3:"⑾";s:4:"(11)";s:3:"⑿";s:4:"(12)";s:3:"⒀";s:4:"(13)";s:3:"⒁";s:4:"(14)";s:3:"⒂";s:4:"(15)";s:3:"⒃";s:4:"(16)";s:3:"⒄";s:4:"(17)";s:3:"⒅";s:4:"(18)";s:3:"⒆";s:4:"(19)";s:3:"⒇";s:4:"(20)";s:3:"⒈";s:2:"1.";s:3:"⒉";s:2:"2.";s:3:"⒊";s:2:"3.";s:3:"⒋";s:2:"4.";s:3:"⒌";s:2:"5.";s:3:"⒍";s:2:"6.";s:3:"⒎";s:2:"7.";s:3:"⒏";s:2:"8.";s:3:"⒐";s:2:"9.";s:3:"⒑";s:3:"10.";s:3:"⒒";s:3:"11.";s:3:"⒓";s:3:"12.";s:3:"⒔";s:3:"13.";s:3:"⒕";s:3:"14.";s:3:"⒖";s:3:"15.";s:3:"⒗";s:3:"16.";s:3:"⒘";s:3:"17.";s:3:"⒙";s:3:"18.";s:3:"⒚";s:3:"19.";s:3:"⒛";s:3:"20.";s:3:"⒜";s:3:"(a)";s:3:"⒝";s:3:"(b)";s:3:"⒞";s:3:"(c)";s:3:"⒟";s:3:"(d)";s:3:"⒠";s:3:"(e)";s:3:"⒡";s:3:"(f)";s:3:"⒢";s:3:"(g)";s:3:"⒣";s:3:"(h)";s:3:"⒤";s:3:"(i)";s:3:"⒥";s:3:"(j)";s:3:"⒦";s:3:"(k)";s:3:"⒧";s:3:"(l)";s:3:"⒨";s:3:"(m)";s:3:"⒩";s:3:"(n)";s:3:"⒪";s:3:"(o)";s:3:"⒫";s:3:"(p)";s:3:"⒬";s:3:"(q)";s:3:"⒭";s:3:"(r)";s:3:"⒮";s:3:"(s)";s:3:"⒯";s:3:"(t)";s:3:"⒰";s:3:"(u)";s:3:"⒱";s:3:"(v)";s:3:"⒲";s:3:"(w)";s:3:"⒳";s:3:"(x)";s:3:"⒴";s:3:"(y)";s:3:"⒵";s:3:"(z)";s:3:"Ⓐ";s:3:"(A)";s:3:"Ⓑ";s:3:"(B)";s:3:"Ⓒ";s:3:"(C)";s:3:"Ⓓ";s:3:"(D)";s:3:"Ⓔ";s:3:"(E)";s:3:"Ⓕ";s:3:"(F)";s:3:"Ⓖ";s:3:"(G)";s:3:"Ⓗ";s:3:"(H)";s:3:"Ⓘ";s:3:"(I)";s:3:"Ⓙ";s:3:"(J)";s:3:"Ⓚ";s:3:"(K)";s:3:"Ⓛ";s:3:"(L)";s:3:"Ⓜ";s:3:"(M)";s:3:"Ⓝ";s:3:"(N)";s:3:"Ⓞ";s:3:"(O)";s:3:"Ⓟ";s:3:"(P)";s:3:"Ⓠ";s:3:"(Q)";s:3:"Ⓡ";s:3:"(R)";s:3:"Ⓢ";s:3:"(S)";s:3:"Ⓣ";s:3:"(T)";s:3:"Ⓤ";s:3:"(U)";s:3:"Ⓥ";s:3:"(V)";s:3:"Ⓦ";s:3:"(W)";s:3:"Ⓧ";s:3:"(X)";s:3:"Ⓨ";s:3:"(Y)";s:3:"Ⓩ";s:3:"(Z)";s:3:"ⓐ";s:3:"(a)";s:3:"ⓑ";s:3:"(b)";s:3:"ⓒ";s:3:"(c)";s:3:"ⓓ";s:3:"(d)";s:3:"ⓔ";s:3:"(e)";s:3:"ⓕ";s:3:"(f)";s:3:"ⓖ";s:3:"(g)";s:3:"ⓗ";s:3:"(h)";s:3:"ⓘ";s:3:"(i)";s:3:"ⓙ";s:3:"(j)";s:3:"ⓚ";s:3:"(k)";s:3:"ⓛ";s:3:"(l)";s:3:"ⓜ";s:3:"(m)";s:3:"ⓝ";s:3:"(n)";s:3:"ⓞ";s:3:"(o)";s:3:"ⓟ";s:3:"(p)";s:3:"ⓠ";s:3:"(q)";s:3:"ⓡ";s:3:"(r)";s:3:"ⓢ";s:3:"(s)";s:3:"ⓣ";s:3:"(t)";s:3:"ⓤ";s:3:"(u)";s:3:"ⓥ";s:3:"(v)";s:3:"ⓦ";s:3:"(w)";s:3:"ⓧ";s:3:"(x)";s:3:"ⓨ";s:3:"(y)";s:3:"ⓩ";s:3:"(z)";s:3:"⓪";s:3:"(0)";s:3:"⨌";s:12:"∫∫∫∫";s:3:"⩴";s:3:"::=";s:3:"⩵";s:2:"==";s:3:"⩶";s:3:"===";s:3:"⺟";s:3:"母";s:3:"⻳";s:3:"龟";s:3:"⼀";s:3:"一";s:3:"⼁";s:3:"丨";s:3:"⼂";s:3:"丶";s:3:"⼃";s:3:"丿";s:3:"⼄";s:3:"乙";s:3:"⼅";s:3:"亅";s:3:"⼆";s:3:"二";s:3:"⼇";s:3:"亠";s:3:"⼈";s:3:"人";s:3:"⼉";s:3:"儿";s:3:"⼊";s:3:"入";s:3:"⼋";s:3:"八";s:3:"⼌";s:3:"冂";s:3:"⼍";s:3:"冖";s:3:"⼎";s:3:"冫";s:3:"⼏";s:3:"几";s:3:"⼐";s:3:"凵";s:3:"⼑";s:3:"刀";s:3:"⼒";s:3:"力";s:3:"⼓";s:3:"勹";s:3:"⼔";s:3:"匕";s:3:"⼕";s:3:"匚";s:3:"⼖";s:3:"匸";s:3:"⼗";s:3:"十";s:3:"⼘";s:3:"卜";s:3:"⼙";s:3:"卩";s:3:"⼚";s:3:"厂";s:3:"⼛";s:3:"厶";s:3:"⼜";s:3:"又";s:3:"⼝";s:3:"口";s:3:"⼞";s:3:"囗";s:3:"⼟";s:3:"土";s:3:"⼠";s:3:"士";s:3:"⼡";s:3:"夂";s:3:"⼢";s:3:"夊";s:3:"⼣";s:3:"夕";s:3:"⼤";s:3:"大";s:3:"⼥";s:3:"女";s:3:"⼦";s:3:"子";s:3:"⼧";s:3:"宀";s:3:"⼨";s:3:"寸";s:3:"⼩";s:3:"小";s:3:"⼪";s:3:"尢";s:3:"⼫";s:3:"尸";s:3:"⼬";s:3:"屮";s:3:"⼭";s:3:"山";s:3:"⼮";s:3:"巛";s:3:"⼯";s:3:"工";s:3:"⼰";s:3:"己";s:3:"⼱";s:3:"巾";s:3:"⼲";s:3:"干";s:3:"⼳";s:3:"幺";s:3:"⼴";s:3:"广";s:3:"⼵";s:3:"廴";s:3:"⼶";s:3:"廾";s:3:"⼷";s:3:"弋";s:3:"⼸";s:3:"弓";s:3:"⼹";s:3:"彐";s:3:"⼺";s:3:"彡";s:3:"⼻";s:3:"彳";s:3:"⼼";s:3:"心";s:3:"⼽";s:3:"戈";s:3:"⼾";s:3:"戶";s:3:"⼿";s:3:"手";s:3:"⽀";s:3:"支";s:3:"⽁";s:3:"攴";s:3:"⽂";s:3:"文";s:3:"⽃";s:3:"斗";s:3:"⽄";s:3:"斤";s:3:"⽅";s:3:"方";s:3:"⽆";s:3:"无";s:3:"⽇";s:3:"日";s:3:"⽈";s:3:"曰";s:3:"⽉";s:3:"月";s:3:"⽊";s:3:"木";s:3:"⽋";s:3:"欠";s:3:"⽌";s:3:"止";s:3:"⽍";s:3:"歹";s:3:"⽎";s:3:"殳";s:3:"⽏";s:3:"毋";s:3:"⽐";s:3:"比";s:3:"⽑";s:3:"毛";s:3:"⽒";s:3:"氏";s:3:"⽓";s:3:"气";s:3:"⽔";s:3:"水";s:3:"⽕";s:3:"火";s:3:"⽖";s:3:"爪";s:3:"⽗";s:3:"父";s:3:"⽘";s:3:"爻";s:3:"⽙";s:3:"爿";s:3:"⽚";s:3:"片";s:3:"⽛";s:3:"牙";s:3:"⽜";s:3:"牛";s:3:"⽝";s:3:"犬";s:3:"⽞";s:3:"玄";s:3:"⽟";s:3:"玉";s:3:"⽠";s:3:"瓜";s:3:"⽡";s:3:"瓦";s:3:"⽢";s:3:"甘";s:3:"⽣";s:3:"生";s:3:"⽤";s:3:"用";s:3:"⽥";s:3:"田";s:3:"⽦";s:3:"疋";s:3:"⽧";s:3:"疒";s:3:"⽨";s:3:"癶";s:3:"⽩";s:3:"白";s:3:"⽪";s:3:"皮";s:3:"⽫";s:3:"皿";s:3:"⽬";s:3:"目";s:3:"⽭";s:3:"矛";s:3:"⽮";s:3:"矢";s:3:"⽯";s:3:"石";s:3:"⽰";s:3:"示";s:3:"⽱";s:3:"禸";s:3:"⽲";s:3:"禾";s:3:"⽳";s:3:"穴";s:3:"⽴";s:3:"立";s:3:"⽵";s:3:"竹";s:3:"⽶";s:3:"米";s:3:"⽷";s:3:"糸";s:3:"⽸";s:3:"缶";s:3:"⽹";s:3:"网";s:3:"⽺";s:3:"羊";s:3:"⽻";s:3:"羽";s:3:"⽼";s:3:"老";s:3:"⽽";s:3:"而";s:3:"⽾";s:3:"耒";s:3:"⽿";s:3:"耳";s:3:"⾀";s:3:"聿";s:3:"⾁";s:3:"肉";s:3:"⾂";s:3:"臣";s:3:"⾃";s:3:"自";s:3:"⾄";s:3:"至";s:3:"⾅";s:3:"臼";s:3:"⾆";s:3:"舌";s:3:"⾇";s:3:"舛";s:3:"⾈";s:3:"舟";s:3:"⾉";s:3:"艮";s:3:"⾊";s:3:"色";s:3:"⾋";s:3:"艸";s:3:"⾌";s:3:"虍";s:3:"⾍";s:3:"虫";s:3:"⾎";s:3:"血";s:3:"⾏";s:3:"行";s:3:"⾐";s:3:"衣";s:3:"⾑";s:3:"襾";s:3:"⾒";s:3:"見";s:3:"⾓";s:3:"角";s:3:"⾔";s:3:"言";s:3:"⾕";s:3:"谷";s:3:"⾖";s:3:"豆";s:3:"⾗";s:3:"豕";s:3:"⾘";s:3:"豸";s:3:"⾙";s:3:"貝";s:3:"⾚";s:3:"赤";s:3:"⾛";s:3:"走";s:3:"⾜";s:3:"足";s:3:"⾝";s:3:"身";s:3:"⾞";s:3:"車";s:3:"⾟";s:3:"辛";s:3:"⾠";s:3:"辰";s:3:"⾡";s:3:"辵";s:3:"⾢";s:3:"邑";s:3:"⾣";s:3:"酉";s:3:"⾤";s:3:"釆";s:3:"⾥";s:3:"里";s:3:"⾦";s:3:"金";s:3:"⾧";s:3:"長";s:3:"⾨";s:3:"門";s:3:"⾩";s:3:"阜";s:3:"⾪";s:3:"隶";s:3:"⾫";s:3:"隹";s:3:"⾬";s:3:"雨";s:3:"⾭";s:3:"靑";s:3:"⾮";s:3:"非";s:3:"⾯";s:3:"面";s:3:"⾰";s:3:"革";s:3:"⾱";s:3:"韋";s:3:"⾲";s:3:"韭";s:3:"⾳";s:3:"音";s:3:"⾴";s:3:"頁";s:3:"⾵";s:3:"風";s:3:"⾶";s:3:"飛";s:3:"⾷";s:3:"食";s:3:"⾸";s:3:"首";s:3:"⾹";s:3:"香";s:3:"⾺";s:3:"馬";s:3:"⾻";s:3:"骨";s:3:"⾼";s:3:"高";s:3:"⾽";s:3:"髟";s:3:"⾾";s:3:"鬥";s:3:"⾿";s:3:"鬯";s:3:"⿀";s:3:"鬲";s:3:"⿁";s:3:"鬼";s:3:"⿂";s:3:"魚";s:3:"⿃";s:3:"鳥";s:3:"⿄";s:3:"鹵";s:3:"⿅";s:3:"鹿";s:3:"⿆";s:3:"麥";s:3:"⿇";s:3:"麻";s:3:"⿈";s:3:"黃";s:3:"⿉";s:3:"黍";s:3:"⿊";s:3:"黑";s:3:"⿋";s:3:"黹";s:3:"⿌";s:3:"黽";s:3:"⿍";s:3:"鼎";s:3:"⿎";s:3:"鼓";s:3:"⿏";s:3:"鼠";s:3:"⿐";s:3:"鼻";s:3:"⿑";s:3:"齊";s:3:"⿒";s:3:"齒";s:3:"⿓";s:3:"龍";s:3:"⿔";s:3:"龜";s:3:"⿕";s:3:"龠";s:3:" ";s:1:" ";s:3:"〶";s:3:"〒";s:3:"〸";s:3:"十";s:3:"〹";s:3:"卄";s:3:"〺";s:3:"卅";s:3:"ㄱ";s:3:"ᄀ";s:3:"ㄲ";s:3:"ᄁ";s:3:"ㄳ";s:3:"ᆪ";s:3:"ㄴ";s:3:"ᄂ";s:3:"ㄵ";s:3:"ᆬ";s:3:"ㄶ";s:3:"ᆭ";s:3:"ㄷ";s:3:"ᄃ";s:3:"ㄸ";s:3:"ᄄ";s:3:"ㄹ";s:3:"ᄅ";s:3:"ㄺ";s:3:"ᆰ";s:3:"ㄻ";s:3:"ᆱ";s:3:"ㄼ";s:3:"ᆲ";s:3:"ㄽ";s:3:"ᆳ";s:3:"ㄾ";s:3:"ᆴ";s:3:"ㄿ";s:3:"ᆵ";s:3:"ㅀ";s:3:"ᄚ";s:3:"ㅁ";s:3:"ᄆ";s:3:"ㅂ";s:3:"ᄇ";s:3:"ㅃ";s:3:"ᄈ";s:3:"ㅄ";s:3:"ᄡ";s:3:"ㅅ";s:3:"ᄉ";s:3:"ㅆ";s:3:"ᄊ";s:3:"ㅇ";s:3:"ᄋ";s:3:"ㅈ";s:3:"ᄌ";s:3:"ㅉ";s:3:"ᄍ";s:3:"ㅊ";s:3:"ᄎ";s:3:"ㅋ";s:3:"ᄏ";s:3:"ㅌ";s:3:"ᄐ";s:3:"ㅍ";s:3:"ᄑ";s:3:"ㅎ";s:3:"ᄒ";s:3:"ㅏ";s:3:"ᅡ";s:3:"ㅐ";s:3:"ᅢ";s:3:"ㅑ";s:3:"ᅣ";s:3:"ㅒ";s:3:"ᅤ";s:3:"ㅓ";s:3:"ᅥ";s:3:"ㅔ";s:3:"ᅦ";s:3:"ㅕ";s:3:"ᅧ";s:3:"ㅖ";s:3:"ᅨ";s:3:"ㅗ";s:3:"ᅩ";s:3:"ㅘ";s:3:"ᅪ";s:3:"ㅙ";s:3:"ᅫ";s:3:"ㅚ";s:3:"ᅬ";s:3:"ㅛ";s:3:"ᅭ";s:3:"ㅜ";s:3:"ᅮ";s:3:"ㅝ";s:3:"ᅯ";s:3:"ㅞ";s:3:"ᅰ";s:3:"ㅟ";s:3:"ᅱ";s:3:"ㅠ";s:3:"ᅲ";s:3:"ㅡ";s:3:"ᅳ";s:3:"ㅢ";s:3:"ᅴ";s:3:"ㅣ";s:3:"ᅵ";s:3:"ㅤ";s:3:"ᅠ";s:3:"ㅥ";s:3:"ᄔ";s:3:"ㅦ";s:3:"ᄕ";s:3:"ㅧ";s:3:"ᇇ";s:3:"ㅨ";s:3:"ᇈ";s:3:"ㅩ";s:3:"ᇌ";s:3:"ㅪ";s:3:"ᇎ";s:3:"ㅫ";s:3:"ᇓ";s:3:"ㅬ";s:3:"ᇗ";s:3:"ㅭ";s:3:"ᇙ";s:3:"ㅮ";s:3:"ᄜ";s:3:"ㅯ";s:3:"ᇝ";s:3:"ㅰ";s:3:"ᇟ";s:3:"ㅱ";s:3:"ᄝ";s:3:"ㅲ";s:3:"ᄞ";s:3:"ㅳ";s:3:"ᄠ";s:3:"ㅴ";s:3:"ᄢ";s:3:"ㅵ";s:3:"ᄣ";s:3:"ㅶ";s:3:"ᄧ";s:3:"ㅷ";s:3:"ᄩ";s:3:"ㅸ";s:3:"ᄫ";s:3:"ㅹ";s:3:"ᄬ";s:3:"ㅺ";s:3:"ᄭ";s:3:"ㅻ";s:3:"ᄮ";s:3:"ㅼ";s:3:"ᄯ";s:3:"ㅽ";s:3:"ᄲ";s:3:"ㅾ";s:3:"ᄶ";s:3:"ㅿ";s:3:"ᅀ";s:3:"ㆀ";s:3:"ᅇ";s:3:"ㆁ";s:3:"ᅌ";s:3:"ㆂ";s:3:"ᇱ";s:3:"ㆃ";s:3:"ᇲ";s:3:"ㆄ";s:3:"ᅗ";s:3:"ㆅ";s:3:"ᅘ";s:3:"ㆆ";s:3:"ᅙ";s:3:"ㆇ";s:3:"ᆄ";s:3:"ㆈ";s:3:"ᆅ";s:3:"ㆉ";s:3:"ᆈ";s:3:"ㆊ";s:3:"ᆑ";s:3:"ㆋ";s:3:"ᆒ";s:3:"ㆌ";s:3:"ᆔ";s:3:"ㆍ";s:3:"ᆞ";s:3:"ㆎ";s:3:"ᆡ";s:3:"㈀";s:5:"(ᄀ)";s:3:"㈁";s:5:"(ᄂ)";s:3:"㈂";s:5:"(ᄃ)";s:3:"㈃";s:5:"(ᄅ)";s:3:"㈄";s:5:"(ᄆ)";s:3:"㈅";s:5:"(ᄇ)";s:3:"㈆";s:5:"(ᄉ)";s:3:"㈇";s:5:"(ᄋ)";s:3:"㈈";s:5:"(ᄌ)";s:3:"㈉";s:5:"(ᄎ)";s:3:"㈊";s:5:"(ᄏ)";s:3:"㈋";s:5:"(ᄐ)";s:3:"㈌";s:5:"(ᄑ)";s:3:"㈍";s:5:"(ᄒ)";s:3:"㈎";s:8:"(가)";s:3:"㈏";s:8:"(나)";s:3:"㈐";s:8:"(다)";s:3:"㈑";s:8:"(라)";s:3:"㈒";s:8:"(마)";s:3:"㈓";s:8:"(바)";s:3:"㈔";s:8:"(사)";s:3:"㈕";s:8:"(아)";s:3:"㈖";s:8:"(자)";s:3:"㈗";s:8:"(차)";s:3:"㈘";s:8:"(카)";s:3:"㈙";s:8:"(타)";s:3:"㈚";s:8:"(파)";s:3:"㈛";s:8:"(하)";s:3:"㈜";s:8:"(주)";s:3:"㈝";s:17:"(오전)";s:3:"㈞";s:14:"(오후)";s:3:"㈠";s:5:"(一)";s:3:"㈡";s:5:"(二)";s:3:"㈢";s:5:"(三)";s:3:"㈣";s:5:"(四)";s:3:"㈤";s:5:"(五)";s:3:"㈥";s:5:"(六)";s:3:"㈦";s:5:"(七)";s:3:"㈧";s:5:"(八)";s:3:"㈨";s:5:"(九)";s:3:"㈩";s:5:"(十)";s:3:"㈪";s:5:"(月)";s:3:"㈫";s:5:"(火)";s:3:"㈬";s:5:"(水)";s:3:"㈭";s:5:"(木)";s:3:"㈮";s:5:"(金)";s:3:"㈯";s:5:"(土)";s:3:"㈰";s:5:"(日)";s:3:"㈱";s:5:"(株)";s:3:"㈲";s:5:"(有)";s:3:"㈳";s:5:"(社)";s:3:"㈴";s:5:"(名)";s:3:"㈵";s:5:"(特)";s:3:"㈶";s:5:"(財)";s:3:"㈷";s:5:"(祝)";s:3:"㈸";s:5:"(労)";s:3:"㈹";s:5:"(代)";s:3:"㈺";s:5:"(呼)";s:3:"㈻";s:5:"(学)";s:3:"㈼";s:5:"(監)";s:3:"㈽";s:5:"(企)";s:3:"㈾";s:5:"(資)";s:3:"㈿";s:5:"(協)";s:3:"㉀";s:5:"(祭)";s:3:"㉁";s:5:"(休)";s:3:"㉂";s:5:"(自)";s:3:"㉃";s:5:"(至)";s:3:"㉄";s:5:"(問)";s:3:"㉅";s:5:"(幼)";s:3:"㉆";s:5:"(文)";s:3:"㉇";s:5:"(箏)";s:3:"㉐";s:3:"PTE";s:3:"㉑";s:4:"(21)";s:3:"㉒";s:4:"(22)";s:3:"㉓";s:4:"(23)";s:3:"㉔";s:4:"(24)";s:3:"㉕";s:4:"(25)";s:3:"㉖";s:4:"(26)";s:3:"㉗";s:4:"(27)";s:3:"㉘";s:4:"(28)";s:3:"㉙";s:4:"(29)";s:3:"㉚";s:4:"(30)";s:3:"㉛";s:4:"(31)";s:3:"㉜";s:4:"(32)";s:3:"㉝";s:4:"(33)";s:3:"㉞";s:4:"(34)";s:3:"㉟";s:4:"(35)";s:3:"㉠";s:5:"(ᄀ)";s:3:"㉡";s:5:"(ᄂ)";s:3:"㉢";s:5:"(ᄃ)";s:3:"㉣";s:5:"(ᄅ)";s:3:"㉤";s:5:"(ᄆ)";s:3:"㉥";s:5:"(ᄇ)";s:3:"㉦";s:5:"(ᄉ)";s:3:"㉧";s:5:"(ᄋ)";s:3:"㉨";s:5:"(ᄌ)";s:3:"㉩";s:5:"(ᄎ)";s:3:"㉪";s:5:"(ᄏ)";s:3:"㉫";s:5:"(ᄐ)";s:3:"㉬";s:5:"(ᄑ)";s:3:"㉭";s:5:"(ᄒ)";s:3:"㉮";s:8:"(가)";s:3:"㉯";s:8:"(나)";s:3:"㉰";s:8:"(다)";s:3:"㉱";s:8:"(라)";s:3:"㉲";s:8:"(마)";s:3:"㉳";s:8:"(바)";s:3:"㉴";s:8:"(사)";s:3:"㉵";s:8:"(아)";s:3:"㉶";s:8:"(자)";s:3:"㉷";s:8:"(차)";s:3:"㉸";s:8:"(카)";s:3:"㉹";s:8:"(타)";s:3:"㉺";s:8:"(파)";s:3:"㉻";s:8:"(하)";s:3:"㉼";s:17:"(참고)";s:3:"㉽";s:14:"(주의)";s:3:"㉾";s:8:"(우)";s:3:"㊀";s:5:"(一)";s:3:"㊁";s:5:"(二)";s:3:"㊂";s:5:"(三)";s:3:"㊃";s:5:"(四)";s:3:"㊄";s:5:"(五)";s:3:"㊅";s:5:"(六)";s:3:"㊆";s:5:"(七)";s:3:"㊇";s:5:"(八)";s:3:"㊈";s:5:"(九)";s:3:"㊉";s:5:"(十)";s:3:"㊊";s:5:"(月)";s:3:"㊋";s:5:"(火)";s:3:"㊌";s:5:"(水)";s:3:"㊍";s:5:"(木)";s:3:"㊎";s:5:"(金)";s:3:"㊏";s:5:"(土)";s:3:"㊐";s:5:"(日)";s:3:"㊑";s:5:"(株)";s:3:"㊒";s:5:"(有)";s:3:"㊓";s:5:"(社)";s:3:"㊔";s:5:"(名)";s:3:"㊕";s:5:"(特)";s:3:"㊖";s:5:"(財)";s:3:"㊗";s:5:"(祝)";s:3:"㊘";s:5:"(労)";s:3:"㊙";s:5:"(秘)";s:3:"㊚";s:5:"(男)";s:3:"㊛";s:5:"(女)";s:3:"㊜";s:5:"(適)";s:3:"㊝";s:5:"(優)";s:3:"㊞";s:5:"(印)";s:3:"㊟";s:5:"(注)";s:3:"㊠";s:5:"(項)";s:3:"㊡";s:5:"(休)";s:3:"㊢";s:5:"(写)";s:3:"㊣";s:5:"(正)";s:3:"㊤";s:5:"(上)";s:3:"㊥";s:5:"(中)";s:3:"㊦";s:5:"(下)";s:3:"㊧";s:5:"(左)";s:3:"㊨";s:5:"(右)";s:3:"㊩";s:5:"(医)";s:3:"㊪";s:5:"(宗)";s:3:"㊫";s:5:"(学)";s:3:"㊬";s:5:"(監)";s:3:"㊭";s:5:"(企)";s:3:"㊮";s:5:"(資)";s:3:"㊯";s:5:"(協)";s:3:"㊰";s:5:"(夜)";s:3:"㊱";s:4:"(36)";s:3:"㊲";s:4:"(37)";s:3:"㊳";s:4:"(38)";s:3:"㊴";s:4:"(39)";s:3:"㊵";s:4:"(40)";s:3:"㊶";s:4:"(41)";s:3:"㊷";s:4:"(42)";s:3:"㊸";s:4:"(43)";s:3:"㊹";s:4:"(44)";s:3:"㊺";s:4:"(45)";s:3:"㊻";s:4:"(46)";s:3:"㊼";s:4:"(47)";s:3:"㊽";s:4:"(48)";s:3:"㊾";s:4:"(49)";s:3:"㊿";s:4:"(50)";s:3:"㋀";s:4:"1月";s:3:"㋁";s:4:"2月";s:3:"㋂";s:4:"3月";s:3:"㋃";s:4:"4月";s:3:"㋄";s:4:"5月";s:3:"㋅";s:4:"6月";s:3:"㋆";s:4:"7月";s:3:"㋇";s:4:"8月";s:3:"㋈";s:4:"9月";s:3:"㋉";s:5:"10月";s:3:"㋊";s:5:"11月";s:3:"㋋";s:5:"12月";s:3:"㋌";s:2:"Hg";s:3:"㋍";s:3:"erg";s:3:"㋎";s:2:"eV";s:3:"㋏";s:3:"LTD";s:3:"㋐";s:5:"(ア)";s:3:"㋑";s:5:"(イ)";s:3:"㋒";s:5:"(ウ)";s:3:"㋓";s:5:"(エ)";s:3:"㋔";s:5:"(オ)";s:3:"㋕";s:5:"(カ)";s:3:"㋖";s:5:"(キ)";s:3:"㋗";s:5:"(ク)";s:3:"㋘";s:5:"(ケ)";s:3:"㋙";s:5:"(コ)";s:3:"㋚";s:5:"(サ)";s:3:"㋛";s:5:"(シ)";s:3:"㋜";s:5:"(ス)";s:3:"㋝";s:5:"(セ)";s:3:"㋞";s:5:"(ソ)";s:3:"㋟";s:5:"(タ)";s:3:"㋠";s:5:"(チ)";s:3:"㋡";s:5:"(ツ)";s:3:"㋢";s:5:"(テ)";s:3:"㋣";s:5:"(ト)";s:3:"㋤";s:5:"(ナ)";s:3:"㋥";s:5:"(ニ)";s:3:"㋦";s:5:"(ヌ)";s:3:"㋧";s:5:"(ネ)";s:3:"㋨";s:5:"(ノ)";s:3:"㋩";s:5:"(ハ)";s:3:"㋪";s:5:"(ヒ)";s:3:"㋫";s:5:"(フ)";s:3:"㋬";s:5:"(ヘ)";s:3:"㋭";s:5:"(ホ)";s:3:"㋮";s:5:"(マ)";s:3:"㋯";s:5:"(ミ)";s:3:"㋰";s:5:"(ム)";s:3:"㋱";s:5:"(メ)";s:3:"㋲";s:5:"(モ)";s:3:"㋳";s:5:"(ヤ)";s:3:"㋴";s:5:"(ユ)";s:3:"㋵";s:5:"(ヨ)";s:3:"㋶";s:5:"(ラ)";s:3:"㋷";s:5:"(リ)";s:3:"㋸";s:5:"(ル)";s:3:"㋹";s:5:"(レ)";s:3:"㋺";s:5:"(ロ)";s:3:"㋻";s:5:"(ワ)";s:3:"㋼";s:5:"(ヰ)";s:3:"㋽";s:5:"(ヱ)";s:3:"㋾";s:5:"(ヲ)";s:3:"㌀";s:12:"アパート";s:3:"㌁";s:12:"アルファ";s:3:"㌂";s:12:"アンペア";s:3:"㌃";s:9:"アール";s:3:"㌄";s:12:"イニング";s:3:"㌅";s:9:"インチ";s:3:"㌆";s:9:"ウォン";s:3:"㌇";s:15:"エスクード";s:3:"㌈";s:12:"エーカー";s:3:"㌉";s:9:"オンス";s:3:"㌊";s:9:"オーム";s:3:"㌋";s:9:"カイリ";s:3:"㌌";s:12:"カラット";s:3:"㌍";s:12:"カロリー";s:3:"㌎";s:9:"ガロン";s:3:"㌏";s:9:"ガンマ";s:3:"㌐";s:6:"ギガ";s:3:"㌑";s:9:"ギニー";s:3:"㌒";s:12:"キュリー";s:3:"㌓";s:12:"ギルダー";s:3:"㌔";s:6:"キロ";s:3:"㌕";s:15:"キログラム";s:3:"㌖";s:18:"キロメートル";s:3:"㌗";s:15:"キロワット";s:3:"㌘";s:9:"グラム";s:3:"㌙";s:15:"グラムトン";s:3:"㌚";s:15:"クルゼイロ";s:3:"㌛";s:12:"クローネ";s:3:"㌜";s:9:"ケース";s:3:"㌝";s:9:"コルナ";s:3:"㌞";s:9:"コーポ";s:3:"㌟";s:12:"サイクル";s:3:"㌠";s:15:"サンチーム";s:3:"㌡";s:12:"シリング";s:3:"㌢";s:9:"センチ";s:3:"㌣";s:9:"セント";s:3:"㌤";s:9:"ダース";s:3:"㌥";s:6:"デシ";s:3:"㌦";s:6:"ドル";s:3:"㌧";s:6:"トン";s:3:"㌨";s:6:"ナノ";s:3:"㌩";s:9:"ノット";s:3:"㌪";s:9:"ハイツ";s:3:"㌫";s:15:"パーセント";s:3:"㌬";s:9:"パーツ";s:3:"㌭";s:12:"バーレル";s:3:"㌮";s:15:"ピアストル";s:3:"㌯";s:9:"ピクル";s:3:"㌰";s:6:"ピコ";s:3:"㌱";s:6:"ビル";s:3:"㌲";s:15:"ファラッド";s:3:"㌳";s:12:"フィート";s:3:"㌴";s:15:"ブッシェル";s:3:"㌵";s:9:"フラン";s:3:"㌶";s:15:"ヘクタール";s:3:"㌷";s:6:"ペソ";s:3:"㌸";s:9:"ペニヒ";s:3:"㌹";s:9:"ヘルツ";s:3:"㌺";s:9:"ペンス";s:3:"㌻";s:9:"ページ";s:3:"㌼";s:9:"ベータ";s:3:"㌽";s:12:"ポイント";s:3:"㌾";s:9:"ボルト";s:3:"㌿";s:6:"ホン";s:3:"㍀";s:9:"ポンド";s:3:"㍁";s:9:"ホール";s:3:"㍂";s:9:"ホーン";s:3:"㍃";s:12:"マイクロ";s:3:"㍄";s:9:"マイル";s:3:"㍅";s:9:"マッハ";s:3:"㍆";s:9:"マルク";s:3:"㍇";s:15:"マンション";s:3:"㍈";s:12:"ミクロン";s:3:"㍉";s:6:"ミリ";s:3:"㍊";s:15:"ミリバール";s:3:"㍋";s:6:"メガ";s:3:"㍌";s:12:"メガトン";s:3:"㍍";s:12:"メートル";s:3:"㍎";s:9:"ヤード";s:3:"㍏";s:9:"ヤール";s:3:"㍐";s:9:"ユアン";s:3:"㍑";s:12:"リットル";s:3:"㍒";s:6:"リラ";s:3:"㍓";s:9:"ルピー";s:3:"㍔";s:12:"ルーブル";s:3:"㍕";s:6:"レム";s:3:"㍖";s:15:"レントゲン";s:3:"㍗";s:9:"ワット";s:3:"㍘";s:4:"0点";s:3:"㍙";s:4:"1点";s:3:"㍚";s:4:"2点";s:3:"㍛";s:4:"3点";s:3:"㍜";s:4:"4点";s:3:"㍝";s:4:"5点";s:3:"㍞";s:4:"6点";s:3:"㍟";s:4:"7点";s:3:"㍠";s:4:"8点";s:3:"㍡";s:4:"9点";s:3:"㍢";s:5:"10点";s:3:"㍣";s:5:"11点";s:3:"㍤";s:5:"12点";s:3:"㍥";s:5:"13点";s:3:"㍦";s:5:"14点";s:3:"㍧";s:5:"15点";s:3:"㍨";s:5:"16点";s:3:"㍩";s:5:"17点";s:3:"㍪";s:5:"18点";s:3:"㍫";s:5:"19点";s:3:"㍬";s:5:"20点";s:3:"㍭";s:5:"21点";s:3:"㍮";s:5:"22点";s:3:"㍯";s:5:"23点";s:3:"㍰";s:5:"24点";s:3:"㍱";s:3:"hPa";s:3:"㍲";s:2:"da";s:3:"㍳";s:2:"AU";s:3:"㍴";s:3:"bar";s:3:"㍵";s:2:"oV";s:3:"㍶";s:2:"pc";s:3:"㍷";s:2:"dm";s:3:"㍸";s:4:"dm²";s:3:"㍹";s:4:"dm³";s:3:"㍺";s:2:"IU";s:3:"㍻";s:6:"平成";s:3:"㍼";s:6:"昭和";s:3:"㍽";s:6:"大正";s:3:"㍾";s:6:"明治";s:3:"㍿";s:12:"株式会社";s:3:"㎀";s:2:"pA";s:3:"㎁";s:2:"nA";s:3:"㎂";s:3:"μA";s:3:"㎃";s:2:"mA";s:3:"㎄";s:2:"kA";s:3:"㎅";s:2:"KB";s:3:"㎆";s:2:"MB";s:3:"㎇";s:2:"GB";s:3:"㎈";s:3:"cal";s:3:"㎉";s:4:"kcal";s:3:"㎊";s:2:"pF";s:3:"㎋";s:2:"nF";s:3:"㎌";s:3:"μF";s:3:"㎍";s:3:"μg";s:3:"㎎";s:2:"mg";s:3:"㎏";s:2:"kg";s:3:"㎐";s:2:"Hz";s:3:"㎑";s:3:"kHz";s:3:"㎒";s:3:"MHz";s:3:"㎓";s:3:"GHz";s:3:"㎔";s:3:"THz";s:3:"㎕";s:5:"μℓ";s:3:"㎖";s:4:"mℓ";s:3:"㎗";s:4:"dℓ";s:3:"㎘";s:4:"kℓ";s:3:"㎙";s:2:"fm";s:3:"㎚";s:2:"nm";s:3:"㎛";s:3:"μm";s:3:"㎜";s:2:"mm";s:3:"㎝";s:2:"cm";s:3:"㎞";s:2:"km";s:3:"㎟";s:4:"mm²";s:3:"㎠";s:4:"cm²";s:3:"㎡";s:3:"m²";s:3:"㎢";s:4:"km²";s:3:"㎣";s:4:"mm³";s:3:"㎤";s:4:"cm³";s:3:"㎥";s:3:"m³";s:3:"㎦";s:4:"km³";s:3:"㎧";s:5:"m∕s";s:3:"㎨";s:7:"m∕s²";s:3:"㎩";s:2:"Pa";s:3:"㎪";s:3:"kPa";s:3:"㎫";s:3:"MPa";s:3:"㎬";s:3:"GPa";s:3:"㎭";s:3:"rad";s:3:"㎮";s:7:"rad∕s";s:3:"㎯";s:9:"rad∕s²";s:3:"㎰";s:2:"ps";s:3:"㎱";s:2:"ns";s:3:"㎲";s:3:"μs";s:3:"㎳";s:2:"ms";s:3:"㎴";s:2:"pV";s:3:"㎵";s:2:"nV";s:3:"㎶";s:3:"μV";s:3:"㎷";s:2:"mV";s:3:"㎸";s:2:"kV";s:3:"㎹";s:2:"MV";s:3:"㎺";s:2:"pW";s:3:"㎻";s:2:"nW";s:3:"㎼";s:3:"μW";s:3:"㎽";s:2:"mW";s:3:"㎾";s:2:"kW";s:3:"㎿";s:2:"MW";s:3:"㏀";s:3:"kΩ";s:3:"㏁";s:3:"MΩ";s:3:"㏂";s:4:"a.m.";s:3:"㏃";s:2:"Bq";s:3:"㏄";s:2:"cc";s:3:"㏅";s:2:"cd";s:3:"㏆";s:6:"C∕kg";s:3:"㏇";s:3:"Co.";s:3:"㏈";s:2:"dB";s:3:"㏉";s:2:"Gy";s:3:"㏊";s:2:"ha";s:3:"㏋";s:2:"HP";s:3:"㏌";s:2:"in";s:3:"㏍";s:2:"KK";s:3:"㏎";s:2:"KM";s:3:"㏏";s:2:"kt";s:3:"㏐";s:2:"lm";s:3:"㏑";s:2:"ln";s:3:"㏒";s:3:"log";s:3:"㏓";s:2:"lx";s:3:"㏔";s:2:"mb";s:3:"㏕";s:3:"mil";s:3:"㏖";s:3:"mol";s:3:"㏗";s:2:"PH";s:3:"㏘";s:4:"p.m.";s:3:"㏙";s:3:"PPM";s:3:"㏚";s:2:"PR";s:3:"㏛";s:2:"sr";s:3:"㏜";s:2:"Sv";s:3:"㏝";s:2:"Wb";s:3:"㏞";s:5:"V∕m";s:3:"㏟";s:5:"A∕m";s:3:"㏠";s:4:"1日";s:3:"㏡";s:4:"2日";s:3:"㏢";s:4:"3日";s:3:"㏣";s:4:"4日";s:3:"㏤";s:4:"5日";s:3:"㏥";s:4:"6日";s:3:"㏦";s:4:"7日";s:3:"㏧";s:4:"8日";s:3:"㏨";s:4:"9日";s:3:"㏩";s:5:"10日";s:3:"㏪";s:5:"11日";s:3:"㏫";s:5:"12日";s:3:"㏬";s:5:"13日";s:3:"㏭";s:5:"14日";s:3:"㏮";s:5:"15日";s:3:"㏯";s:5:"16日";s:3:"㏰";s:5:"17日";s:3:"㏱";s:5:"18日";s:3:"㏲";s:5:"19日";s:3:"㏳";s:5:"20日";s:3:"㏴";s:5:"21日";s:3:"㏵";s:5:"22日";s:3:"㏶";s:5:"23日";s:3:"㏷";s:5:"24日";s:3:"㏸";s:5:"25日";s:3:"㏹";s:5:"26日";s:3:"㏺";s:5:"27日";s:3:"㏻";s:5:"28日";s:3:"㏼";s:5:"29日";s:3:"㏽";s:5:"30日";s:3:"㏾";s:5:"31日";s:3:"㏿";s:3:"gal";s:3:"豈";s:3:"豈";s:3:"更";s:3:"更";s:3:"車";s:3:"車";s:3:"賈";s:3:"賈";s:3:"滑";s:3:"滑";s:3:"串";s:3:"串";s:3:"句";s:3:"句";s:3:"龜";s:3:"龜";s:3:"龜";s:3:"龜";s:3:"契";s:3:"契";s:3:"金";s:3:"金";s:3:"喇";s:3:"喇";s:3:"奈";s:3:"奈";s:3:"懶";s:3:"懶";s:3:"癩";s:3:"癩";s:3:"羅";s:3:"羅";s:3:"蘿";s:3:"蘿";s:3:"螺";s:3:"螺";s:3:"裸";s:3:"裸";s:3:"邏";s:3:"邏";s:3:"樂";s:3:"樂";s:3:"洛";s:3:"洛";s:3:"烙";s:3:"烙";s:3:"珞";s:3:"珞";s:3:"落";s:3:"落";s:3:"酪";s:3:"酪";s:3:"駱";s:3:"駱";s:3:"亂";s:3:"亂";s:3:"卵";s:3:"卵";s:3:"欄";s:3:"欄";s:3:"爛";s:3:"爛";s:3:"蘭";s:3:"蘭";s:3:"鸞";s:3:"鸞";s:3:"嵐";s:3:"嵐";s:3:"濫";s:3:"濫";s:3:"藍";s:3:"藍";s:3:"襤";s:3:"襤";s:3:"拉";s:3:"拉";s:3:"臘";s:3:"臘";s:3:"蠟";s:3:"蠟";s:3:"廊";s:3:"廊";s:3:"朗";s:3:"朗";s:3:"浪";s:3:"浪";s:3:"狼";s:3:"狼";s:3:"郎";s:3:"郎";s:3:"來";s:3:"來";s:3:"冷";s:3:"冷";s:3:"勞";s:3:"勞";s:3:"擄";s:3:"擄";s:3:"櫓";s:3:"櫓";s:3:"爐";s:3:"爐";s:3:"盧";s:3:"盧";s:3:"老";s:3:"老";s:3:"蘆";s:3:"蘆";s:3:"虜";s:3:"虜";s:3:"路";s:3:"路";s:3:"露";s:3:"露";s:3:"魯";s:3:"魯";s:3:"鷺";s:3:"鷺";s:3:"碌";s:3:"碌";s:3:"祿";s:3:"祿";s:3:"綠";s:3:"綠";s:3:"菉";s:3:"菉";s:3:"錄";s:3:"錄";s:3:"鹿";s:3:"鹿";s:3:"論";s:3:"論";s:3:"壟";s:3:"壟";s:3:"弄";s:3:"弄";s:3:"籠";s:3:"籠";s:3:"聾";s:3:"聾";s:3:"牢";s:3:"牢";s:3:"磊";s:3:"磊";s:3:"賂";s:3:"賂";s:3:"雷";s:3:"雷";s:3:"壘";s:3:"壘";s:3:"屢";s:3:"屢";s:3:"樓";s:3:"樓";s:3:"淚";s:3:"淚";s:3:"漏";s:3:"漏";s:3:"累";s:3:"累";s:3:"縷";s:3:"縷";s:3:"陋";s:3:"陋";s:3:"勒";s:3:"勒";s:3:"肋";s:3:"肋";s:3:"凜";s:3:"凜";s:3:"凌";s:3:"凌";s:3:"稜";s:3:"稜";s:3:"綾";s:3:"綾";s:3:"菱";s:3:"菱";s:3:"陵";s:3:"陵";s:3:"讀";s:3:"讀";s:3:"拏";s:3:"拏";s:3:"樂";s:3:"樂";s:3:"諾";s:3:"諾";s:3:"丹";s:3:"丹";s:3:"寧";s:3:"寧";s:3:"怒";s:3:"怒";s:3:"率";s:3:"率";s:3:"異";s:3:"異";s:3:"北";s:3:"北";s:3:"磻";s:3:"磻";s:3:"便";s:3:"便";s:3:"復";s:3:"復";s:3:"不";s:3:"不";s:3:"泌";s:3:"泌";s:3:"數";s:3:"數";s:3:"索";s:3:"索";s:3:"參";s:3:"參";s:3:"塞";s:3:"塞";s:3:"省";s:3:"省";s:3:"葉";s:3:"葉";s:3:"說";s:3:"說";s:3:"殺";s:3:"殺";s:3:"辰";s:3:"辰";s:3:"沈";s:3:"沈";s:3:"拾";s:3:"拾";s:3:"若";s:3:"若";s:3:"掠";s:3:"掠";s:3:"略";s:3:"略";s:3:"亮";s:3:"亮";s:3:"兩";s:3:"兩";s:3:"凉";s:3:"凉";s:3:"梁";s:3:"梁";s:3:"糧";s:3:"糧";s:3:"良";s:3:"良";s:3:"諒";s:3:"諒";s:3:"量";s:3:"量";s:3:"勵";s:3:"勵";s:3:"呂";s:3:"呂";s:3:"女";s:3:"女";s:3:"廬";s:3:"廬";s:3:"旅";s:3:"旅";s:3:"濾";s:3:"濾";s:3:"礪";s:3:"礪";s:3:"閭";s:3:"閭";s:3:"驪";s:3:"驪";s:3:"麗";s:3:"麗";s:3:"黎";s:3:"黎";s:3:"力";s:3:"力";s:3:"曆";s:3:"曆";s:3:"歷";s:3:"歷";s:3:"轢";s:3:"轢";s:3:"年";s:3:"年";s:3:"憐";s:3:"憐";s:3:"戀";s:3:"戀";s:3:"撚";s:3:"撚";s:3:"漣";s:3:"漣";s:3:"煉";s:3:"煉";s:3:"璉";s:3:"璉";s:3:"秊";s:3:"秊";s:3:"練";s:3:"練";s:3:"聯";s:3:"聯";s:3:"輦";s:3:"輦";s:3:"蓮";s:3:"蓮";s:3:"連";s:3:"連";s:3:"鍊";s:3:"鍊";s:3:"列";s:3:"列";s:3:"劣";s:3:"劣";s:3:"咽";s:3:"咽";s:3:"烈";s:3:"烈";s:3:"裂";s:3:"裂";s:3:"說";s:3:"說";s:3:"廉";s:3:"廉";s:3:"念";s:3:"念";s:3:"捻";s:3:"捻";s:3:"殮";s:3:"殮";s:3:"簾";s:3:"簾";s:3:"獵";s:3:"獵";s:3:"令";s:3:"令";s:3:"囹";s:3:"囹";s:3:"寧";s:3:"寧";s:3:"嶺";s:3:"嶺";s:3:"怜";s:3:"怜";s:3:"玲";s:3:"玲";s:3:"瑩";s:3:"瑩";s:3:"羚";s:3:"羚";s:3:"聆";s:3:"聆";s:3:"鈴";s:3:"鈴";s:3:"零";s:3:"零";s:3:"靈";s:3:"靈";s:3:"領";s:3:"領";s:3:"例";s:3:"例";s:3:"禮";s:3:"禮";s:3:"醴";s:3:"醴";s:3:"隸";s:3:"隸";s:3:"惡";s:3:"惡";s:3:"了";s:3:"了";s:3:"僚";s:3:"僚";s:3:"寮";s:3:"寮";s:3:"尿";s:3:"尿";s:3:"料";s:3:"料";s:3:"樂";s:3:"樂";s:3:"燎";s:3:"燎";s:3:"療";s:3:"療";s:3:"蓼";s:3:"蓼";s:3:"遼";s:3:"遼";s:3:"龍";s:3:"龍";s:3:"暈";s:3:"暈";s:3:"阮";s:3:"阮";s:3:"劉";s:3:"劉";s:3:"杻";s:3:"杻";s:3:"柳";s:3:"柳";s:3:"流";s:3:"流";s:3:"溜";s:3:"溜";s:3:"琉";s:3:"琉";s:3:"留";s:3:"留";s:3:"硫";s:3:"硫";s:3:"紐";s:3:"紐";s:3:"類";s:3:"類";s:3:"六";s:3:"六";s:3:"戮";s:3:"戮";s:3:"陸";s:3:"陸";s:3:"倫";s:3:"倫";s:3:"崙";s:3:"崙";s:3:"淪";s:3:"淪";s:3:"輪";s:3:"輪";s:3:"律";s:3:"律";s:3:"慄";s:3:"慄";s:3:"栗";s:3:"栗";s:3:"率";s:3:"率";s:3:"隆";s:3:"隆";s:3:"利";s:3:"利";s:3:"吏";s:3:"吏";s:3:"履";s:3:"履";s:3:"易";s:3:"易";s:3:"李";s:3:"李";s:3:"梨";s:3:"梨";s:3:"泥";s:3:"泥";s:3:"理";s:3:"理";s:3:"痢";s:3:"痢";s:3:"罹";s:3:"罹";s:3:"裏";s:3:"裏";s:3:"裡";s:3:"裡";s:3:"里";s:3:"里";s:3:"離";s:3:"離";s:3:"匿";s:3:"匿";s:3:"溺";s:3:"溺";s:3:"吝";s:3:"吝";s:3:"燐";s:3:"燐";s:3:"璘";s:3:"璘";s:3:"藺";s:3:"藺";s:3:"隣";s:3:"隣";s:3:"鱗";s:3:"鱗";s:3:"麟";s:3:"麟";s:3:"林";s:3:"林";s:3:"淋";s:3:"淋";s:3:"臨";s:3:"臨";s:3:"立";s:3:"立";s:3:"笠";s:3:"笠";s:3:"粒";s:3:"粒";s:3:"狀";s:3:"狀";s:3:"炙";s:3:"炙";s:3:"識";s:3:"識";s:3:"什";s:3:"什";s:3:"茶";s:3:"茶";s:3:"刺";s:3:"刺";s:3:"切";s:3:"切";s:3:"度";s:3:"度";s:3:"拓";s:3:"拓";s:3:"糖";s:3:"糖";s:3:"宅";s:3:"宅";s:3:"洞";s:3:"洞";s:3:"暴";s:3:"暴";s:3:"輻";s:3:"輻";s:3:"行";s:3:"行";s:3:"降";s:3:"降";s:3:"見";s:3:"見";s:3:"廓";s:3:"廓";s:3:"兀";s:3:"兀";s:3:"嗀";s:3:"嗀";s:3:"﨎";s:1:"";s:3:"﨏";s:1:"";s:3:"塚";s:3:"塚";s:3:"﨑";s:1:"";s:3:"晴";s:3:"晴";s:3:"﨓";s:1:"";s:3:"﨔";s:1:"";s:3:"凞";s:3:"凞";s:3:"猪";s:3:"猪";s:3:"益";s:3:"益";s:3:"礼";s:3:"礼";s:3:"神";s:3:"神";s:3:"祥";s:3:"祥";s:3:"福";s:3:"福";s:3:"靖";s:3:"靖";s:3:"精";s:3:"精";s:3:"羽";s:3:"羽";s:3:"﨟";s:1:"";s:3:"蘒";s:3:"蘒";s:3:"﨡";s:1:"";s:3:"諸";s:3:"諸";s:3:"﨣";s:1:"";s:3:"﨤";s:1:"";s:3:"逸";s:3:"逸";s:3:"都";s:3:"都";s:3:"﨧";s:1:"";s:3:"﨨";s:1:"";s:3:"﨩";s:1:"";s:3:"飯";s:3:"飯";s:3:"飼";s:3:"飼";s:3:"館";s:3:"館";s:3:"鶴";s:3:"鶴";s:3:"郞";s:3:"郞";s:3:"隷";s:3:"隷";s:3:"侮";s:3:"侮";s:3:"僧";s:3:"僧";s:3:"免";s:3:"免";s:3:"勉";s:3:"勉";s:3:"勤";s:3:"勤";s:3:"卑";s:3:"卑";s:3:"喝";s:3:"喝";s:3:"嘆";s:3:"嘆";s:3:"器";s:3:"器";s:3:"塀";s:3:"塀";s:3:"墨";s:3:"墨";s:3:"層";s:3:"層";s:3:"屮";s:3:"屮";s:3:"悔";s:3:"悔";s:3:"慨";s:3:"慨";s:3:"憎";s:3:"憎";s:3:"懲";s:3:"懲";s:3:"敏";s:3:"敏";s:3:"既";s:3:"既";s:3:"暑";s:3:"暑";s:3:"梅";s:3:"梅";s:3:"海";s:3:"海";s:3:"渚";s:3:"渚";s:3:"漢";s:3:"漢";s:3:"煮";s:3:"煮";s:3:"爫";s:3:"爫";s:3:"琢";s:3:"琢";s:3:"碑";s:3:"碑";s:3:"社";s:3:"社";s:3:"祉";s:3:"祉";s:3:"祈";s:3:"祈";s:3:"祐";s:3:"祐";s:3:"祖";s:3:"祖";s:3:"祝";s:3:"祝";s:3:"禍";s:3:"禍";s:3:"禎";s:3:"禎";s:3:"穀";s:3:"穀";s:3:"突";s:3:"突";s:3:"節";s:3:"節";s:3:"練";s:3:"練";s:3:"縉";s:3:"縉";s:3:"繁";s:3:"繁";s:3:"署";s:3:"署";s:3:"者";s:3:"者";s:3:"臭";s:3:"臭";s:3:"艹";s:3:"艹";s:3:"艹";s:3:"艹";s:3:"著";s:3:"著";s:3:"褐";s:3:"褐";s:3:"視";s:3:"視";s:3:"謁";s:3:"謁";s:3:"謹";s:3:"謹";s:3:"賓";s:3:"賓";s:3:"贈";s:3:"贈";s:3:"辶";s:3:"辶";s:3:"逸";s:3:"逸";s:3:"難";s:3:"難";s:3:"響";s:3:"響";s:3:"頻";s:3:"頻";s:3:"恵";s:3:"恵";s:3:"𤋮";s:4:"𤋮";s:3:"舘";s:3:"舘";s:3:"並";s:3:"並";s:3:"况";s:3:"况";s:3:"全";s:3:"全";s:3:"侀";s:3:"侀";s:3:"充";s:3:"充";s:3:"冀";s:3:"冀";s:3:"勇";s:3:"勇";s:3:"勺";s:3:"勺";s:3:"喝";s:3:"喝";s:3:"啕";s:3:"啕";s:3:"喙";s:3:"喙";s:3:"嗢";s:3:"嗢";s:3:"塚";s:3:"塚";s:3:"墳";s:3:"墳";s:3:"奄";s:3:"奄";s:3:"奔";s:3:"奔";s:3:"婢";s:3:"婢";s:3:"嬨";s:3:"嬨";s:3:"廒";s:3:"廒";s:3:"廙";s:3:"廙";s:3:"彩";s:3:"彩";s:3:"徭";s:3:"徭";s:3:"惘";s:3:"惘";s:3:"慎";s:3:"慎";s:3:"愈";s:3:"愈";s:3:"憎";s:3:"憎";s:3:"慠";s:3:"慠";s:3:"懲";s:3:"懲";s:3:"戴";s:3:"戴";s:3:"揄";s:3:"揄";s:3:"搜";s:3:"搜";s:3:"摒";s:3:"摒";s:3:"敖";s:3:"敖";s:3:"晴";s:3:"晴";s:3:"朗";s:3:"朗";s:3:"望";s:3:"望";s:3:"杖";s:3:"杖";s:3:"歹";s:3:"歹";s:3:"殺";s:3:"殺";s:3:"流";s:3:"流";s:3:"滛";s:3:"滛";s:3:"滋";s:3:"滋";s:3:"漢";s:3:"漢";s:3:"瀞";s:3:"瀞";s:3:"煮";s:3:"煮";s:3:"瞧";s:3:"瞧";s:3:"爵";s:3:"爵";s:3:"犯";s:3:"犯";s:3:"猪";s:3:"猪";s:3:"瑱";s:3:"瑱";s:3:"甆";s:3:"甆";s:3:"画";s:3:"画";s:3:"瘝";s:3:"瘝";s:3:"瘟";s:3:"瘟";s:3:"益";s:3:"益";s:3:"盛";s:3:"盛";s:3:"直";s:3:"直";s:3:"睊";s:3:"睊";s:3:"着";s:3:"着";s:3:"磌";s:3:"磌";s:3:"窱";s:3:"窱";s:3:"節";s:3:"節";s:3:"类";s:3:"类";s:3:"絛";s:3:"絛";s:3:"練";s:3:"練";s:3:"缾";s:3:"缾";s:3:"者";s:3:"者";s:3:"荒";s:3:"荒";s:3:"華";s:3:"華";s:3:"蝹";s:3:"蝹";s:3:"襁";s:3:"襁";s:3:"覆";s:3:"覆";s:3:"視";s:3:"視";s:3:"調";s:3:"調";s:3:"諸";s:3:"諸";s:3:"請";s:3:"請";s:3:"謁";s:3:"謁";s:3:"諾";s:3:"諾";s:3:"諭";s:3:"諭";s:3:"謹";s:3:"謹";s:3:"變";s:3:"變";s:3:"贈";s:3:"贈";s:3:"輸";s:3:"輸";s:3:"遲";s:3:"遲";s:3:"醙";s:3:"醙";s:3:"鉶";s:3:"鉶";s:3:"陼";s:3:"陼";s:3:"難";s:3:"難";s:3:"靖";s:3:"靖";s:3:"韛";s:3:"韛";s:3:"響";s:3:"響";s:3:"頋";s:3:"頋";s:3:"頻";s:3:"頻";s:3:"鬒";s:3:"鬒";s:3:"龜";s:3:"龜";s:3:"𢡊";s:4:"𢡊";s:3:"𢡄";s:4:"𢡄";s:3:"𣏕";s:4:"𣏕";s:3:"㮝";s:3:"㮝";s:3:"䀘";s:3:"䀘";s:3:"䀹";s:3:"䀹";s:3:"𥉉";s:4:"𥉉";s:3:"𥳐";s:4:"𥳐";s:3:"𧻓";s:4:"𧻓";s:3:"齃";s:3:"齃";s:3:"龎";s:3:"龎";s:3:"ff";s:2:"ff";s:3:"fi";s:2:"fi";s:3:"fl";s:2:"fl";s:3:"ffi";s:3:"ffi";s:3:"ffl";s:3:"ffl";s:3:"ſt";s:3:"ſt";s:3:"st";s:2:"st";s:3:"ﬓ";s:4:"մն";s:3:"ﬔ";s:4:"մե";s:3:"ﬕ";s:4:"մի";s:3:"ﬖ";s:4:"վն";s:3:"ﬗ";s:4:"մխ";s:3:"ﬠ";s:2:"ע";s:3:"ﬡ";s:2:"א";s:3:"ﬢ";s:2:"ד";s:3:"ﬣ";s:2:"ה";s:3:"ﬤ";s:2:"כ";s:3:"ﬥ";s:2:"ל";s:3:"ﬦ";s:2:"ם";s:3:"ﬧ";s:2:"ר";s:3:"ﬨ";s:2:"ת";s:3:"﬩";s:1:"+";s:3:"ﭏ";s:4:"אל";s:3:"﹉";s:3:"‾";s:3:"﹊";s:3:"‾";s:3:"﹋";s:3:"‾";s:3:"﹌";s:3:"‾";s:3:"﹍";s:1:"_";s:3:"﹎";s:1:"_";s:3:"﹏";s:1:"_";s:3:"﹐";s:1:",";s:3:"﹑";s:3:"、";s:3:"﹒";s:1:".";s:3:"﹔";s:1:";";s:3:"﹕";s:1:":";s:3:"﹖";s:1:"?";s:3:"﹗";s:1:"!";s:3:"﹘";s:3:"—";s:3:"﹙";s:1:"(";s:3:"﹚";s:1:")";s:3:"﹛";s:1:"{";s:3:"﹜";s:1:"}";s:3:"﹝";s:3:"〔";s:3:"﹞";s:3:"〕";s:3:"﹟";s:1:"#";s:3:"﹠";s:1:"&";s:3:"﹡";s:1:"*";s:3:"﹢";s:1:"+";s:3:"﹣";s:1:"-";s:3:"﹤";s:1:"<";s:3:"﹥";s:1:">";s:3:"﹦";s:1:"=";s:3:"﹨";s:1:"\";s:3:"﹩";s:1:"$";s:3:"﹪";s:1:"%";s:3:"﹫";s:1:"@";s:3:"!";s:1:"!";s:3:""";s:1:""";s:3:"#";s:1:"#";s:3:"$";s:1:"$";s:3:"%";s:1:"%";s:3:"&";s:1:"&";s:3:"'";s:1:"'";s:3:"(";s:1:"(";s:3:")";s:1:")";s:3:"*";s:1:"*";s:3:"+";s:1:"+";s:3:",";s:1:",";s:3:"-";s:1:"-";s:3:".";s:1:".";s:3:"/";s:1:"/";s:3:"0";s:1:"0";s:3:"1";s:1:"1";s:3:"2";s:1:"2";s:3:"3";s:1:"3";s:3:"4";s:1:"4";s:3:"5";s:1:"5";s:3:"6";s:1:"6";s:3:"7";s:1:"7";s:3:"8";s:1:"8";s:3:"9";s:1:"9";s:3:":";s:1:":";s:3:";";s:1:";";s:3:"<";s:1:"<";s:3:"=";s:1:"=";s:3:">";s:1:">";s:3:"?";s:1:"?";s:3:"@";s:1:"@";s:3:"A";s:1:"A";s:3:"B";s:1:"B";s:3:"C";s:1:"C";s:3:"D";s:1:"D";s:3:"E";s:1:"E";s:3:"F";s:1:"F";s:3:"G";s:1:"G";s:3:"H";s:1:"H";s:3:"I";s:1:"I";s:3:"J";s:1:"J";s:3:"K";s:1:"K";s:3:"L";s:1:"L";s:3:"M";s:1:"M";s:3:"N";s:1:"N";s:3:"O";s:1:"O";s:3:"P";s:1:"P";s:3:"Q";s:1:"Q";s:3:"R";s:1:"R";s:3:"S";s:1:"S";s:3:"T";s:1:"T";s:3:"U";s:1:"U";s:3:"V";s:1:"V";s:3:"W";s:1:"W";s:3:"X";s:1:"X";s:3:"Y";s:1:"Y";s:3:"Z";s:1:"Z";s:3:"[";s:1:"[";s:3:"\";s:1:"\";s:3:"]";s:1:"]";s:3:"^";s:1:"^";s:3:"_";s:1:"_";s:3:"`";s:1:"`";s:3:"a";s:1:"a";s:3:"b";s:1:"b";s:3:"c";s:1:"c";s:3:"d";s:1:"d";s:3:"e";s:1:"e";s:3:"f";s:1:"f";s:3:"g";s:1:"g";s:3:"h";s:1:"h";s:3:"i";s:1:"i";s:3:"j";s:1:"j";s:3:"k";s:1:"k";s:3:"l";s:1:"l";s:3:"m";s:1:"m";s:3:"n";s:1:"n";s:3:"o";s:1:"o";s:3:"p";s:1:"p";s:3:"q";s:1:"q";s:3:"r";s:1:"r";s:3:"s";s:1:"s";s:3:"t";s:1:"t";s:3:"u";s:1:"u";s:3:"v";s:1:"v";s:3:"w";s:1:"w";s:3:"x";s:1:"x";s:3:"y";s:1:"y";s:3:"z";s:1:"z";s:3:"{";s:1:"{";s:3:"|";s:1:"|";s:3:"}";s:1:"}";s:3:"~";s:1:"~";s:3:"⦅";s:3:"⦅";s:3:"⦆";s:3:"⦆";s:3:"。";s:3:"。";s:3:"「";s:3:"「";s:3:"」";s:3:"」";s:3:"、";s:3:"、";s:3:"・";s:3:"・";s:3:"ヲ";s:3:"ヲ";s:3:"ァ";s:3:"ァ";s:3:"ィ";s:3:"ィ";s:3:"ゥ";s:3:"ゥ";s:3:"ェ";s:3:"ェ";s:3:"ォ";s:3:"ォ";s:3:"ャ";s:3:"ャ";s:3:"ュ";s:3:"ュ";s:3:"ョ";s:3:"ョ";s:3:"ッ";s:3:"ッ";s:3:"ー";s:3:"ー";s:3:"ア";s:3:"ア";s:3:"イ";s:3:"イ";s:3:"ウ";s:3:"ウ";s:3:"エ";s:3:"エ";s:3:"オ";s:3:"オ";s:3:"カ";s:3:"カ";s:3:"キ";s:3:"キ";s:3:"ク";s:3:"ク";s:3:"ケ";s:3:"ケ";s:3:"コ";s:3:"コ";s:3:"サ";s:3:"サ";s:3:"シ";s:3:"シ";s:3:"ス";s:3:"ス";s:3:"セ";s:3:"セ";s:3:"ソ";s:3:"ソ";s:3:"タ";s:3:"タ";s:3:"チ";s:3:"チ";s:3:"ツ";s:3:"ツ";s:3:"テ";s:3:"テ";s:3:"ト";s:3:"ト";s:3:"ナ";s:3:"ナ";s:3:"ニ";s:3:"ニ";s:3:"ヌ";s:3:"ヌ";s:3:"ネ";s:3:"ネ";s:3:"ノ";s:3:"ノ";s:3:"ハ";s:3:"ハ";s:3:"ヒ";s:3:"ヒ";s:3:"フ";s:3:"フ";s:3:"ヘ";s:3:"ヘ";s:3:"ホ";s:3:"ホ";s:3:"マ";s:3:"マ";s:3:"ミ";s:3:"ミ";s:3:"ム";s:3:"ム";s:3:"メ";s:3:"メ";s:3:"モ";s:3:"モ";s:3:"ヤ";s:3:"ヤ";s:3:"ユ";s:3:"ユ";s:3:"ヨ";s:3:"ヨ";s:3:"ラ";s:3:"ラ";s:3:"リ";s:3:"リ";s:3:"ル";s:3:"ル";s:3:"レ";s:3:"レ";s:3:"ロ";s:3:"ロ";s:3:"ワ";s:3:"ワ";s:3:"ン";s:3:"ン";s:3:"゙";s:3:"゙";s:3:"゚";s:3:"゚";s:3:"ᅠ";s:3:"ㅤ";s:3:"ᄀ";s:3:"ㄱ";s:3:"ᄁ";s:3:"ㄲ";s:3:"ᆪ";s:3:"ㄳ";s:3:"ᄂ";s:3:"ㄴ";s:3:"ᆬ";s:3:"ㄵ";s:3:"ᆭ";s:3:"ㄶ";s:3:"ᄃ";s:3:"ㄷ";s:3:"ᄄ";s:3:"ㄸ";s:3:"ᄅ";s:3:"ㄹ";s:3:"ᆰ";s:3:"ㄺ";s:3:"ᆱ";s:3:"ㄻ";s:3:"ᆲ";s:3:"ㄼ";s:3:"ᆳ";s:3:"ㄽ";s:3:"ᆴ";s:3:"ㄾ";s:3:"ᆵ";s:3:"ㄿ";s:3:"ᄚ";s:3:"ㅀ";s:3:"ᄆ";s:3:"ㅁ";s:3:"ᄇ";s:3:"ㅂ";s:3:"ᄈ";s:3:"ㅃ";s:3:"ᄡ";s:3:"ㅄ";s:3:"ᄉ";s:3:"ㅅ";s:3:"ᄊ";s:3:"ㅆ";s:3:"ᄋ";s:3:"ㅇ";s:3:"ᄌ";s:3:"ㅈ";s:3:"ᄍ";s:3:"ㅉ";s:3:"ᄎ";s:3:"ㅊ";s:3:"ᄏ";s:3:"ㅋ";s:3:"ᄐ";s:3:"ㅌ";s:3:"ᄑ";s:3:"ㅍ";s:3:"ᄒ";s:3:"ㅎ";s:3:"ᅡ";s:3:"ㅏ";s:3:"ᅢ";s:3:"ㅐ";s:3:"ᅣ";s:3:"ㅑ";s:3:"ᅤ";s:3:"ㅒ";s:3:"ᅥ";s:3:"ㅓ";s:3:"ᅦ";s:3:"ㅔ";s:3:"ᅧ";s:3:"ㅕ";s:3:"ᅨ";s:3:"ㅖ";s:3:"ᅩ";s:3:"ㅗ";s:3:"ᅪ";s:3:"ㅘ";s:3:"ᅫ";s:3:"ㅙ";s:3:"ᅬ";s:3:"ㅚ";s:3:"ᅭ";s:3:"ㅛ";s:3:"ᅮ";s:3:"ㅜ";s:3:"ᅯ";s:3:"ㅝ";s:3:"ᅰ";s:3:"ㅞ";s:3:"ᅱ";s:3:"ㅟ";s:3:"ᅲ";s:3:"ㅠ";s:3:"ᅳ";s:3:"ㅡ";s:3:"ᅴ";s:3:"ㅢ";s:3:"ᅵ";s:3:"ㅣ";s:3:"¢";s:2:"¢";s:3:"£";s:2:"£";s:3:"¬";s:2:"¬";s:3:" ̄";s:2:"¯";s:3:"¦";s:2:"¦";s:3:"¥";s:2:"¥";s:3:"₩";s:3:"₩";s:3:"│";s:3:"│";s:3:"←";s:3:"←";s:3:"↑";s:3:"↑";s:3:"→";s:3:"→";s:3:"↓";s:3:"↓";s:3:"■";s:3:"■";s:3:"○";s:3:"○";s:4:"𝐀";s:1:"A";s:4:"𝐁";s:1:"B";s:4:"𝐂";s:1:"C";s:4:"𝐃";s:1:"D";s:4:"𝐄";s:1:"E";s:4:"𝐅";s:1:"F";s:4:"𝐆";s:1:"G";s:4:"𝐇";s:1:"H";s:4:"𝐈";s:1:"I";s:4:"𝐉";s:1:"J";s:4:"𝐊";s:1:"K";s:4:"𝐋";s:1:"L";s:4:"𝐌";s:1:"M";s:4:"𝐍";s:1:"N";s:4:"𝐎";s:1:"O";s:4:"𝐏";s:1:"P";s:4:"𝐐";s:1:"Q";s:4:"𝐑";s:1:"R";s:4:"𝐒";s:1:"S";s:4:"𝐓";s:1:"T";s:4:"𝐔";s:1:"U";s:4:"𝐕";s:1:"V";s:4:"𝐖";s:1:"W";s:4:"𝐗";s:1:"X";s:4:"𝐘";s:1:"Y";s:4:"𝐙";s:1:"Z";s:4:"𝐚";s:1:"a";s:4:"𝐛";s:1:"b";s:4:"𝐜";s:1:"c";s:4:"𝐝";s:1:"d";s:4:"𝐞";s:1:"e";s:4:"𝐟";s:1:"f";s:4:"𝐠";s:1:"g";s:4:"𝐡";s:1:"h";s:4:"𝐢";s:1:"i";s:4:"𝐣";s:1:"j";s:4:"𝐤";s:1:"k";s:4:"𝐥";s:1:"l";s:4:"𝐦";s:1:"m";s:4:"𝐧";s:1:"n";s:4:"𝐨";s:1:"o";s:4:"𝐩";s:1:"p";s:4:"𝐪";s:1:"q";s:4:"𝐫";s:1:"r";s:4:"𝐬";s:1:"s";s:4:"𝐭";s:1:"t";s:4:"𝐮";s:1:"u";s:4:"𝐯";s:1:"v";s:4:"𝐰";s:1:"w";s:4:"𝐱";s:1:"x";s:4:"𝐲";s:1:"y";s:4:"𝐳";s:1:"z";s:4:"𝐴";s:1:"A";s:4:"𝐵";s:1:"B";s:4:"𝐶";s:1:"C";s:4:"𝐷";s:1:"D";s:4:"𝐸";s:1:"E";s:4:"𝐹";s:1:"F";s:4:"𝐺";s:1:"G";s:4:"𝐻";s:1:"H";s:4:"𝐼";s:1:"I";s:4:"𝐽";s:1:"J";s:4:"𝐾";s:1:"K";s:4:"𝐿";s:1:"L";s:4:"𝑀";s:1:"M";s:4:"𝑁";s:1:"N";s:4:"𝑂";s:1:"O";s:4:"𝑃";s:1:"P";s:4:"𝑄";s:1:"Q";s:4:"𝑅";s:1:"R";s:4:"𝑆";s:1:"S";s:4:"𝑇";s:1:"T";s:4:"𝑈";s:1:"U";s:4:"𝑉";s:1:"V";s:4:"𝑊";s:1:"W";s:4:"𝑋";s:1:"X";s:4:"𝑌";s:1:"Y";s:4:"𝑍";s:1:"Z";s:4:"𝑎";s:1:"a";s:4:"𝑏";s:1:"b";s:4:"𝑐";s:1:"c";s:4:"𝑑";s:1:"d";s:4:"𝑒";s:1:"e";s:4:"𝑓";s:1:"f";s:4:"𝑔";s:1:"g";s:4:"𝑖";s:1:"i";s:4:"𝑗";s:1:"j";s:4:"𝑘";s:1:"k";s:4:"𝑙";s:1:"l";s:4:"𝑚";s:1:"m";s:4:"𝑛";s:1:"n";s:4:"𝑜";s:1:"o";s:4:"𝑝";s:1:"p";s:4:"𝑞";s:1:"q";s:4:"𝑟";s:1:"r";s:4:"𝑠";s:1:"s";s:4:"𝑡";s:1:"t";s:4:"𝑢";s:1:"u";s:4:"𝑣";s:1:"v";s:4:"𝑤";s:1:"w";s:4:"𝑥";s:1:"x";s:4:"𝑦";s:1:"y";s:4:"𝑧";s:1:"z";s:4:"𝑨";s:1:"A";s:4:"𝑩";s:1:"B";s:4:"𝑪";s:1:"C";s:4:"𝑫";s:1:"D";s:4:"𝑬";s:1:"E";s:4:"𝑭";s:1:"F";s:4:"𝑮";s:1:"G";s:4:"𝑯";s:1:"H";s:4:"𝑰";s:1:"I";s:4:"𝑱";s:1:"J";s:4:"𝑲";s:1:"K";s:4:"𝑳";s:1:"L";s:4:"𝑴";s:1:"M";s:4:"𝑵";s:1:"N";s:4:"𝑶";s:1:"O";s:4:"𝑷";s:1:"P";s:4:"𝑸";s:1:"Q";s:4:"𝑹";s:1:"R";s:4:"𝑺";s:1:"S";s:4:"𝑻";s:1:"T";s:4:"𝑼";s:1:"U";s:4:"𝑽";s:1:"V";s:4:"𝑾";s:1:"W";s:4:"𝑿";s:1:"X";s:4:"𝒀";s:1:"Y";s:4:"𝒁";s:1:"Z";s:4:"𝒂";s:1:"a";s:4:"𝒃";s:1:"b";s:4:"𝒄";s:1:"c";s:4:"𝒅";s:1:"d";s:4:"𝒆";s:1:"e";s:4:"𝒇";s:1:"f";s:4:"𝒈";s:1:"g";s:4:"𝒉";s:1:"h";s:4:"𝒊";s:1:"i";s:4:"𝒋";s:1:"j";s:4:"𝒌";s:1:"k";s:4:"𝒍";s:1:"l";s:4:"𝒎";s:1:"m";s:4:"𝒏";s:1:"n";s:4:"𝒐";s:1:"o";s:4:"𝒑";s:1:"p";s:4:"𝒒";s:1:"q";s:4:"𝒓";s:1:"r";s:4:"𝒔";s:1:"s";s:4:"𝒕";s:1:"t";s:4:"𝒖";s:1:"u";s:4:"𝒗";s:1:"v";s:4:"𝒘";s:1:"w";s:4:"𝒙";s:1:"x";s:4:"𝒚";s:1:"y";s:4:"𝒛";s:1:"z";s:4:"𝒜";s:1:"A";s:4:"𝒞";s:1:"C";s:4:"𝒟";s:1:"D";s:4:"𝒢";s:1:"G";s:4:"𝒥";s:1:"J";s:4:"𝒦";s:1:"K";s:4:"𝒩";s:1:"N";s:4:"𝒪";s:1:"O";s:4:"𝒫";s:1:"P";s:4:"𝒬";s:1:"Q";s:4:"𝒮";s:1:"S";s:4:"𝒯";s:1:"T";s:4:"𝒰";s:1:"U";s:4:"𝒱";s:1:"V";s:4:"𝒲";s:1:"W";s:4:"𝒳";s:1:"X";s:4:"𝒴";s:1:"Y";s:4:"𝒵";s:1:"Z";s:4:"𝒶";s:1:"a";s:4:"𝒷";s:1:"b";s:4:"𝒸";s:1:"c";s:4:"𝒹";s:1:"d";s:4:"𝒻";s:1:"f";s:4:"𝒽";s:1:"h";s:4:"𝒾";s:1:"i";s:4:"𝒿";s:1:"j";s:4:"𝓀";s:1:"k";s:4:"𝓁";s:1:"l";s:4:"𝓂";s:1:"m";s:4:"𝓃";s:1:"n";s:4:"𝓅";s:1:"p";s:4:"𝓆";s:1:"q";s:4:"𝓇";s:1:"r";s:4:"𝓈";s:1:"s";s:4:"𝓉";s:1:"t";s:4:"𝓊";s:1:"u";s:4:"𝓋";s:1:"v";s:4:"𝓌";s:1:"w";s:4:"𝓍";s:1:"x";s:4:"𝓎";s:1:"y";s:4:"𝓏";s:1:"z";s:4:"𝓐";s:1:"A";s:4:"𝓑";s:1:"B";s:4:"𝓒";s:1:"C";s:4:"𝓓";s:1:"D";s:4:"𝓔";s:1:"E";s:4:"𝓕";s:1:"F";s:4:"𝓖";s:1:"G";s:4:"𝓗";s:1:"H";s:4:"𝓘";s:1:"I";s:4:"𝓙";s:1:"J";s:4:"𝓚";s:1:"K";s:4:"𝓛";s:1:"L";s:4:"𝓜";s:1:"M";s:4:"𝓝";s:1:"N";s:4:"𝓞";s:1:"O";s:4:"𝓟";s:1:"P";s:4:"𝓠";s:1:"Q";s:4:"𝓡";s:1:"R";s:4:"𝓢";s:1:"S";s:4:"𝓣";s:1:"T";s:4:"𝓤";s:1:"U";s:4:"𝓥";s:1:"V";s:4:"𝓦";s:1:"W";s:4:"𝓧";s:1:"X";s:4:"𝓨";s:1:"Y";s:4:"𝓩";s:1:"Z";s:4:"𝓪";s:1:"a";s:4:"𝓫";s:1:"b";s:4:"𝓬";s:1:"c";s:4:"𝓭";s:1:"d";s:4:"𝓮";s:1:"e";s:4:"𝓯";s:1:"f";s:4:"𝓰";s:1:"g";s:4:"𝓱";s:1:"h";s:4:"𝓲";s:1:"i";s:4:"𝓳";s:1:"j";s:4:"𝓴";s:1:"k";s:4:"𝓵";s:1:"l";s:4:"𝓶";s:1:"m";s:4:"𝓷";s:1:"n";s:4:"𝓸";s:1:"o";s:4:"𝓹";s:1:"p";s:4:"𝓺";s:1:"q";s:4:"𝓻";s:1:"r";s:4:"𝓼";s:1:"s";s:4:"𝓽";s:1:"t";s:4:"𝓾";s:1:"u";s:4:"𝓿";s:1:"v";s:4:"𝔀";s:1:"w";s:4:"𝔁";s:1:"x";s:4:"𝔂";s:1:"y";s:4:"𝔃";s:1:"z";s:4:"𝔄";s:1:"A";s:4:"𝔅";s:1:"B";s:4:"𝔇";s:1:"D";s:4:"𝔈";s:1:"E";s:4:"𝔉";s:1:"F";s:4:"𝔊";s:1:"G";s:4:"𝔍";s:1:"J";s:4:"𝔎";s:1:"K";s:4:"𝔏";s:1:"L";s:4:"𝔐";s:1:"M";s:4:"𝔑";s:1:"N";s:4:"𝔒";s:1:"O";s:4:"𝔓";s:1:"P";s:4:"𝔔";s:1:"Q";s:4:"𝔖";s:1:"S";s:4:"𝔗";s:1:"T";s:4:"𝔘";s:1:"U";s:4:"𝔙";s:1:"V";s:4:"𝔚";s:1:"W";s:4:"𝔛";s:1:"X";s:4:"𝔜";s:1:"Y";s:4:"𝔞";s:1:"a";s:4:"𝔟";s:1:"b";s:4:"𝔠";s:1:"c";s:4:"𝔡";s:1:"d";s:4:"𝔢";s:1:"e";s:4:"𝔣";s:1:"f";s:4:"𝔤";s:1:"g";s:4:"𝔥";s:1:"h";s:4:"𝔦";s:1:"i";s:4:"𝔧";s:1:"j";s:4:"𝔨";s:1:"k";s:4:"𝔩";s:1:"l";s:4:"𝔪";s:1:"m";s:4:"𝔫";s:1:"n";s:4:"𝔬";s:1:"o";s:4:"𝔭";s:1:"p";s:4:"𝔮";s:1:"q";s:4:"𝔯";s:1:"r";s:4:"𝔰";s:1:"s";s:4:"𝔱";s:1:"t";s:4:"𝔲";s:1:"u";s:4:"𝔳";s:1:"v";s:4:"𝔴";s:1:"w";s:4:"𝔵";s:1:"x";s:4:"𝔶";s:1:"y";s:4:"𝔷";s:1:"z";s:4:"𝔸";s:1:"A";s:4:"𝔹";s:1:"B";s:4:"𝔻";s:1:"D";s:4:"𝔼";s:1:"E";s:4:"𝔽";s:1:"F";s:4:"𝔾";s:1:"G";s:4:"𝕀";s:1:"I";s:4:"𝕁";s:1:"J";s:4:"𝕂";s:1:"K";s:4:"𝕃";s:1:"L";s:4:"𝕄";s:1:"M";s:4:"𝕆";s:1:"O";s:4:"𝕊";s:1:"S";s:4:"𝕋";s:1:"T";s:4:"𝕌";s:1:"U";s:4:"𝕍";s:1:"V";s:4:"𝕎";s:1:"W";s:4:"𝕏";s:1:"X";s:4:"𝕐";s:1:"Y";s:4:"𝕒";s:1:"a";s:4:"𝕓";s:1:"b";s:4:"𝕔";s:1:"c";s:4:"𝕕";s:1:"d";s:4:"𝕖";s:1:"e";s:4:"𝕗";s:1:"f";s:4:"𝕘";s:1:"g";s:4:"𝕙";s:1:"h";s:4:"𝕚";s:1:"i";s:4:"𝕛";s:1:"j";s:4:"𝕜";s:1:"k";s:4:"𝕝";s:1:"l";s:4:"𝕞";s:1:"m";s:4:"𝕟";s:1:"n";s:4:"𝕠";s:1:"o";s:4:"𝕡";s:1:"p";s:4:"𝕢";s:1:"q";s:4:"𝕣";s:1:"r";s:4:"𝕤";s:1:"s";s:4:"𝕥";s:1:"t";s:4:"𝕦";s:1:"u";s:4:"𝕧";s:1:"v";s:4:"𝕨";s:1:"w";s:4:"𝕩";s:1:"x";s:4:"𝕪";s:1:"y";s:4:"𝕫";s:1:"z";s:4:"𝕬";s:1:"A";s:4:"𝕭";s:1:"B";s:4:"𝕮";s:1:"C";s:4:"𝕯";s:1:"D";s:4:"𝕰";s:1:"E";s:4:"𝕱";s:1:"F";s:4:"𝕲";s:1:"G";s:4:"𝕳";s:1:"H";s:4:"𝕴";s:1:"I";s:4:"𝕵";s:1:"J";s:4:"𝕶";s:1:"K";s:4:"𝕷";s:1:"L";s:4:"𝕸";s:1:"M";s:4:"𝕹";s:1:"N";s:4:"𝕺";s:1:"O";s:4:"𝕻";s:1:"P";s:4:"𝕼";s:1:"Q";s:4:"𝕽";s:1:"R";s:4:"𝕾";s:1:"S";s:4:"𝕿";s:1:"T";s:4:"𝖀";s:1:"U";s:4:"𝖁";s:1:"V";s:4:"𝖂";s:1:"W";s:4:"𝖃";s:1:"X";s:4:"𝖄";s:1:"Y";s:4:"𝖅";s:1:"Z";s:4:"𝖆";s:1:"a";s:4:"𝖇";s:1:"b";s:4:"𝖈";s:1:"c";s:4:"𝖉";s:1:"d";s:4:"𝖊";s:1:"e";s:4:"𝖋";s:1:"f";s:4:"𝖌";s:1:"g";s:4:"𝖍";s:1:"h";s:4:"𝖎";s:1:"i";s:4:"𝖏";s:1:"j";s:4:"𝖐";s:1:"k";s:4:"𝖑";s:1:"l";s:4:"𝖒";s:1:"m";s:4:"𝖓";s:1:"n";s:4:"𝖔";s:1:"o";s:4:"𝖕";s:1:"p";s:4:"𝖖";s:1:"q";s:4:"𝖗";s:1:"r";s:4:"𝖘";s:1:"s";s:4:"𝖙";s:1:"t";s:4:"𝖚";s:1:"u";s:4:"𝖛";s:1:"v";s:4:"𝖜";s:1:"w";s:4:"𝖝";s:1:"x";s:4:"𝖞";s:1:"y";s:4:"𝖟";s:1:"z";s:4:"𝖠";s:1:"A";s:4:"𝖡";s:1:"B";s:4:"𝖢";s:1:"C";s:4:"𝖣";s:1:"D";s:4:"𝖤";s:1:"E";s:4:"𝖥";s:1:"F";s:4:"𝖦";s:1:"G";s:4:"𝖧";s:1:"H";s:4:"𝖨";s:1:"I";s:4:"𝖩";s:1:"J";s:4:"𝖪";s:1:"K";s:4:"𝖫";s:1:"L";s:4:"𝖬";s:1:"M";s:4:"𝖭";s:1:"N";s:4:"𝖮";s:1:"O";s:4:"𝖯";s:1:"P";s:4:"𝖰";s:1:"Q";s:4:"𝖱";s:1:"R";s:4:"𝖲";s:1:"S";s:4:"𝖳";s:1:"T";s:4:"𝖴";s:1:"U";s:4:"𝖵";s:1:"V";s:4:"𝖶";s:1:"W";s:4:"𝖷";s:1:"X";s:4:"𝖸";s:1:"Y";s:4:"𝖹";s:1:"Z";s:4:"𝖺";s:1:"a";s:4:"𝖻";s:1:"b";s:4:"𝖼";s:1:"c";s:4:"𝖽";s:1:"d";s:4:"𝖾";s:1:"e";s:4:"𝖿";s:1:"f";s:4:"𝗀";s:1:"g";s:4:"𝗁";s:1:"h";s:4:"𝗂";s:1:"i";s:4:"𝗃";s:1:"j";s:4:"𝗄";s:1:"k";s:4:"𝗅";s:1:"l";s:4:"𝗆";s:1:"m";s:4:"𝗇";s:1:"n";s:4:"𝗈";s:1:"o";s:4:"𝗉";s:1:"p";s:4:"𝗊";s:1:"q";s:4:"𝗋";s:1:"r";s:4:"𝗌";s:1:"s";s:4:"𝗍";s:1:"t";s:4:"𝗎";s:1:"u";s:4:"𝗏";s:1:"v";s:4:"𝗐";s:1:"w";s:4:"𝗑";s:1:"x";s:4:"𝗒";s:1:"y";s:4:"𝗓";s:1:"z";s:4:"𝗔";s:1:"A";s:4:"𝗕";s:1:"B";s:4:"𝗖";s:1:"C";s:4:"𝗗";s:1:"D";s:4:"𝗘";s:1:"E";s:4:"𝗙";s:1:"F";s:4:"𝗚";s:1:"G";s:4:"𝗛";s:1:"H";s:4:"𝗜";s:1:"I";s:4:"𝗝";s:1:"J";s:4:"𝗞";s:1:"K";s:4:"𝗟";s:1:"L";s:4:"𝗠";s:1:"M";s:4:"𝗡";s:1:"N";s:4:"𝗢";s:1:"O";s:4:"𝗣";s:1:"P";s:4:"𝗤";s:1:"Q";s:4:"𝗥";s:1:"R";s:4:"𝗦";s:1:"S";s:4:"𝗧";s:1:"T";s:4:"𝗨";s:1:"U";s:4:"𝗩";s:1:"V";s:4:"𝗪";s:1:"W";s:4:"𝗫";s:1:"X";s:4:"𝗬";s:1:"Y";s:4:"𝗭";s:1:"Z";s:4:"𝗮";s:1:"a";s:4:"𝗯";s:1:"b";s:4:"𝗰";s:1:"c";s:4:"𝗱";s:1:"d";s:4:"𝗲";s:1:"e";s:4:"𝗳";s:1:"f";s:4:"𝗴";s:1:"g";s:4:"𝗵";s:1:"h";s:4:"𝗶";s:1:"i";s:4:"𝗷";s:1:"j";s:4:"𝗸";s:1:"k";s:4:"𝗹";s:1:"l";s:4:"𝗺";s:1:"m";s:4:"𝗻";s:1:"n";s:4:"𝗼";s:1:"o";s:4:"𝗽";s:1:"p";s:4:"𝗾";s:1:"q";s:4:"𝗿";s:1:"r";s:4:"𝘀";s:1:"s";s:4:"𝘁";s:1:"t";s:4:"𝘂";s:1:"u";s:4:"𝘃";s:1:"v";s:4:"𝘄";s:1:"w";s:4:"𝘅";s:1:"x";s:4:"𝘆";s:1:"y";s:4:"𝘇";s:1:"z";s:4:"𝘈";s:1:"A";s:4:"𝘉";s:1:"B";s:4:"𝘊";s:1:"C";s:4:"𝘋";s:1:"D";s:4:"𝘌";s:1:"E";s:4:"𝘍";s:1:"F";s:4:"𝘎";s:1:"G";s:4:"𝘏";s:1:"H";s:4:"𝘐";s:1:"I";s:4:"𝘑";s:1:"J";s:4:"𝘒";s:1:"K";s:4:"𝘓";s:1:"L";s:4:"𝘔";s:1:"M";s:4:"𝘕";s:1:"N";s:4:"𝘖";s:1:"O";s:4:"𝘗";s:1:"P";s:4:"𝘘";s:1:"Q";s:4:"𝘙";s:1:"R";s:4:"𝘚";s:1:"S";s:4:"𝘛";s:1:"T";s:4:"𝘜";s:1:"U";s:4:"𝘝";s:1:"V";s:4:"𝘞";s:1:"W";s:4:"𝘟";s:1:"X";s:4:"𝘠";s:1:"Y";s:4:"𝘡";s:1:"Z";s:4:"𝘢";s:1:"a";s:4:"𝘣";s:1:"b";s:4:"𝘤";s:1:"c";s:4:"𝘥";s:1:"d";s:4:"𝘦";s:1:"e";s:4:"𝘧";s:1:"f";s:4:"𝘨";s:1:"g";s:4:"𝘩";s:1:"h";s:4:"𝘪";s:1:"i";s:4:"𝘫";s:1:"j";s:4:"𝘬";s:1:"k";s:4:"𝘭";s:1:"l";s:4:"𝘮";s:1:"m";s:4:"𝘯";s:1:"n";s:4:"𝘰";s:1:"o";s:4:"𝘱";s:1:"p";s:4:"𝘲";s:1:"q";s:4:"𝘳";s:1:"r";s:4:"𝘴";s:1:"s";s:4:"𝘵";s:1:"t";s:4:"𝘶";s:1:"u";s:4:"𝘷";s:1:"v";s:4:"𝘸";s:1:"w";s:4:"𝘹";s:1:"x";s:4:"𝘺";s:1:"y";s:4:"𝘻";s:1:"z";s:4:"𝘼";s:1:"A";s:4:"𝘽";s:1:"B";s:4:"𝘾";s:1:"C";s:4:"𝘿";s:1:"D";s:4:"𝙀";s:1:"E";s:4:"𝙁";s:1:"F";s:4:"𝙂";s:1:"G";s:4:"𝙃";s:1:"H";s:4:"𝙄";s:1:"I";s:4:"𝙅";s:1:"J";s:4:"𝙆";s:1:"K";s:4:"𝙇";s:1:"L";s:4:"𝙈";s:1:"M";s:4:"𝙉";s:1:"N";s:4:"𝙊";s:1:"O";s:4:"𝙋";s:1:"P";s:4:"𝙌";s:1:"Q";s:4:"𝙍";s:1:"R";s:4:"𝙎";s:1:"S";s:4:"𝙏";s:1:"T";s:4:"𝙐";s:1:"U";s:4:"𝙑";s:1:"V";s:4:"𝙒";s:1:"W";s:4:"𝙓";s:1:"X";s:4:"𝙔";s:1:"Y";s:4:"𝙕";s:1:"Z";s:4:"𝙖";s:1:"a";s:4:"𝙗";s:1:"b";s:4:"𝙘";s:1:"c";s:4:"𝙙";s:1:"d";s:4:"𝙚";s:1:"e";s:4:"𝙛";s:1:"f";s:4:"𝙜";s:1:"g";s:4:"𝙝";s:1:"h";s:4:"𝙞";s:1:"i";s:4:"𝙟";s:1:"j";s:4:"𝙠";s:1:"k";s:4:"𝙡";s:1:"l";s:4:"𝙢";s:1:"m";s:4:"𝙣";s:1:"n";s:4:"𝙤";s:1:"o";s:4:"𝙥";s:1:"p";s:4:"𝙦";s:1:"q";s:4:"𝙧";s:1:"r";s:4:"𝙨";s:1:"s";s:4:"𝙩";s:1:"t";s:4:"𝙪";s:1:"u";s:4:"𝙫";s:1:"v";s:4:"𝙬";s:1:"w";s:4:"𝙭";s:1:"x";s:4:"𝙮";s:1:"y";s:4:"𝙯";s:1:"z";s:4:"𝙰";s:1:"A";s:4:"𝙱";s:1:"B";s:4:"𝙲";s:1:"C";s:4:"𝙳";s:1:"D";s:4:"𝙴";s:1:"E";s:4:"𝙵";s:1:"F";s:4:"𝙶";s:1:"G";s:4:"𝙷";s:1:"H";s:4:"𝙸";s:1:"I";s:4:"𝙹";s:1:"J";s:4:"𝙺";s:1:"K";s:4:"𝙻";s:1:"L";s:4:"𝙼";s:1:"M";s:4:"𝙽";s:1:"N";s:4:"𝙾";s:1:"O";s:4:"𝙿";s:1:"P";s:4:"𝚀";s:1:"Q";s:4:"𝚁";s:1:"R";s:4:"𝚂";s:1:"S";s:4:"𝚃";s:1:"T";s:4:"𝚄";s:1:"U";s:4:"𝚅";s:1:"V";s:4:"𝚆";s:1:"W";s:4:"𝚇";s:1:"X";s:4:"𝚈";s:1:"Y";s:4:"𝚉";s:1:"Z";s:4:"𝚊";s:1:"a";s:4:"𝚋";s:1:"b";s:4:"𝚌";s:1:"c";s:4:"𝚍";s:1:"d";s:4:"𝚎";s:1:"e";s:4:"𝚏";s:1:"f";s:4:"𝚐";s:1:"g";s:4:"𝚑";s:1:"h";s:4:"𝚒";s:1:"i";s:4:"𝚓";s:1:"j";s:4:"𝚔";s:1:"k";s:4:"𝚕";s:1:"l";s:4:"𝚖";s:1:"m";s:4:"𝚗";s:1:"n";s:4:"𝚘";s:1:"o";s:4:"𝚙";s:1:"p";s:4:"𝚚";s:1:"q";s:4:"𝚛";s:1:"r";s:4:"𝚜";s:1:"s";s:4:"𝚝";s:1:"t";s:4:"𝚞";s:1:"u";s:4:"𝚟";s:1:"v";s:4:"𝚠";s:1:"w";s:4:"𝚡";s:1:"x";s:4:"𝚢";s:1:"y";s:4:"𝚣";s:1:"z";s:4:"𝚤";s:2:"ı";s:4:"𝚥";s:2:"ȷ";s:4:"𝚨";s:2:"Α";s:4:"𝚩";s:2:"Β";s:4:"𝚪";s:2:"Γ";s:4:"𝚫";s:2:"Δ";s:4:"𝚬";s:2:"Ε";s:4:"𝚭";s:2:"Ζ";s:4:"𝚮";s:2:"Η";s:4:"𝚯";s:2:"Θ";s:4:"𝚰";s:2:"Ι";s:4:"𝚱";s:2:"Κ";s:4:"𝚲";s:2:"Λ";s:4:"𝚳";s:2:"Μ";s:4:"𝚴";s:2:"Ν";s:4:"𝚵";s:2:"Ξ";s:4:"𝚶";s:2:"Ο";s:4:"𝚷";s:2:"Π";s:4:"𝚸";s:2:"Ρ";s:4:"𝚹";s:2:"ϴ";s:4:"𝚺";s:2:"Σ";s:4:"𝚻";s:2:"Τ";s:4:"𝚼";s:2:"Υ";s:4:"𝚽";s:2:"Φ";s:4:"𝚾";s:2:"Χ";s:4:"𝚿";s:2:"Ψ";s:4:"𝛀";s:2:"Ω";s:4:"𝛁";s:3:"∇";s:4:"𝛂";s:2:"α";s:4:"𝛃";s:2:"β";s:4:"𝛄";s:2:"γ";s:4:"𝛅";s:2:"δ";s:4:"𝛆";s:2:"ε";s:4:"𝛇";s:2:"ζ";s:4:"𝛈";s:2:"η";s:4:"𝛉";s:2:"θ";s:4:"𝛊";s:2:"ι";s:4:"𝛋";s:2:"κ";s:4:"𝛌";s:2:"λ";s:4:"𝛍";s:2:"μ";s:4:"𝛎";s:2:"ν";s:4:"𝛏";s:2:"ξ";s:4:"𝛐";s:2:"ο";s:4:"𝛑";s:2:"π";s:4:"𝛒";s:2:"ρ";s:4:"𝛓";s:2:"ς";s:4:"𝛔";s:2:"σ";s:4:"𝛕";s:2:"τ";s:4:"𝛖";s:2:"υ";s:4:"𝛗";s:2:"φ";s:4:"𝛘";s:2:"χ";s:4:"𝛙";s:2:"ψ";s:4:"𝛚";s:2:"ω";s:4:"𝛛";s:3:"∂";s:4:"𝛜";s:2:"ϵ";s:4:"𝛝";s:2:"ϑ";s:4:"𝛞";s:2:"ϰ";s:4:"𝛟";s:2:"ϕ";s:4:"𝛠";s:2:"ϱ";s:4:"𝛡";s:2:"ϖ";s:4:"𝛢";s:2:"Α";s:4:"𝛣";s:2:"Β";s:4:"𝛤";s:2:"Γ";s:4:"𝛥";s:2:"Δ";s:4:"𝛦";s:2:"Ε";s:4:"𝛧";s:2:"Ζ";s:4:"𝛨";s:2:"Η";s:4:"𝛩";s:2:"Θ";s:4:"𝛪";s:2:"Ι";s:4:"𝛫";s:2:"Κ";s:4:"𝛬";s:2:"Λ";s:4:"𝛭";s:2:"Μ";s:4:"𝛮";s:2:"Ν";s:4:"𝛯";s:2:"Ξ";s:4:"𝛰";s:2:"Ο";s:4:"𝛱";s:2:"Π";s:4:"𝛲";s:2:"Ρ";s:4:"𝛳";s:2:"ϴ";s:4:"𝛴";s:2:"Σ";s:4:"𝛵";s:2:"Τ";s:4:"𝛶";s:2:"Υ";s:4:"𝛷";s:2:"Φ";s:4:"𝛸";s:2:"Χ";s:4:"𝛹";s:2:"Ψ";s:4:"𝛺";s:2:"Ω";s:4:"𝛻";s:3:"∇";s:4:"𝛼";s:2:"α";s:4:"𝛽";s:2:"β";s:4:"𝛾";s:2:"γ";s:4:"𝛿";s:2:"δ";s:4:"𝜀";s:2:"ε";s:4:"𝜁";s:2:"ζ";s:4:"𝜂";s:2:"η";s:4:"𝜃";s:2:"θ";s:4:"𝜄";s:2:"ι";s:4:"𝜅";s:2:"κ";s:4:"𝜆";s:2:"λ";s:4:"𝜇";s:2:"μ";s:4:"𝜈";s:2:"ν";s:4:"𝜉";s:2:"ξ";s:4:"𝜊";s:2:"ο";s:4:"𝜋";s:2:"π";s:4:"𝜌";s:2:"ρ";s:4:"𝜍";s:2:"ς";s:4:"𝜎";s:2:"σ";s:4:"𝜏";s:2:"τ";s:4:"𝜐";s:2:"υ";s:4:"𝜑";s:2:"φ";s:4:"𝜒";s:2:"χ";s:4:"𝜓";s:2:"ψ";s:4:"𝜔";s:2:"ω";s:4:"𝜕";s:3:"∂";s:4:"𝜖";s:2:"ϵ";s:4:"𝜗";s:2:"ϑ";s:4:"𝜘";s:2:"ϰ";s:4:"𝜙";s:2:"ϕ";s:4:"𝜚";s:2:"ϱ";s:4:"𝜛";s:2:"ϖ";s:4:"𝜜";s:2:"Α";s:4:"𝜝";s:2:"Β";s:4:"𝜞";s:2:"Γ";s:4:"𝜟";s:2:"Δ";s:4:"𝜠";s:2:"Ε";s:4:"𝜡";s:2:"Ζ";s:4:"𝜢";s:2:"Η";s:4:"𝜣";s:2:"Θ";s:4:"𝜤";s:2:"Ι";s:4:"𝜥";s:2:"Κ";s:4:"𝜦";s:2:"Λ";s:4:"𝜧";s:2:"Μ";s:4:"𝜨";s:2:"Ν";s:4:"𝜩";s:2:"Ξ";s:4:"𝜪";s:2:"Ο";s:4:"𝜫";s:2:"Π";s:4:"𝜬";s:2:"Ρ";s:4:"𝜭";s:2:"ϴ";s:4:"𝜮";s:2:"Σ";s:4:"𝜯";s:2:"Τ";s:4:"𝜰";s:2:"Υ";s:4:"𝜱";s:2:"Φ";s:4:"𝜲";s:2:"Χ";s:4:"𝜳";s:2:"Ψ";s:4:"𝜴";s:2:"Ω";s:4:"𝜵";s:3:"∇";s:4:"𝜶";s:2:"α";s:4:"𝜷";s:2:"β";s:4:"𝜸";s:2:"γ";s:4:"𝜹";s:2:"δ";s:4:"𝜺";s:2:"ε";s:4:"𝜻";s:2:"ζ";s:4:"𝜼";s:2:"η";s:4:"𝜽";s:2:"θ";s:4:"𝜾";s:2:"ι";s:4:"𝜿";s:2:"κ";s:4:"𝝀";s:2:"λ";s:4:"𝝁";s:2:"μ";s:4:"𝝂";s:2:"ν";s:4:"𝝃";s:2:"ξ";s:4:"𝝄";s:2:"ο";s:4:"𝝅";s:2:"π";s:4:"𝝆";s:2:"ρ";s:4:"𝝇";s:2:"ς";s:4:"𝝈";s:2:"σ";s:4:"𝝉";s:2:"τ";s:4:"𝝊";s:2:"υ";s:4:"𝝋";s:2:"φ";s:4:"𝝌";s:2:"χ";s:4:"𝝍";s:2:"ψ";s:4:"𝝎";s:2:"ω";s:4:"𝝏";s:3:"∂";s:4:"𝝐";s:2:"ϵ";s:4:"𝝑";s:2:"ϑ";s:4:"𝝒";s:2:"ϰ";s:4:"𝝓";s:2:"ϕ";s:4:"𝝔";s:2:"ϱ";s:4:"𝝕";s:2:"ϖ";s:4:"𝝖";s:2:"Α";s:4:"𝝗";s:2:"Β";s:4:"𝝘";s:2:"Γ";s:4:"𝝙";s:2:"Δ";s:4:"𝝚";s:2:"Ε";s:4:"𝝛";s:2:"Ζ";s:4:"𝝜";s:2:"Η";s:4:"𝝝";s:2:"Θ";s:4:"𝝞";s:2:"Ι";s:4:"𝝟";s:2:"Κ";s:4:"𝝠";s:2:"Λ";s:4:"𝝡";s:2:"Μ";s:4:"𝝢";s:2:"Ν";s:4:"𝝣";s:2:"Ξ";s:4:"𝝤";s:2:"Ο";s:4:"𝝥";s:2:"Π";s:4:"𝝦";s:2:"Ρ";s:4:"𝝧";s:2:"ϴ";s:4:"𝝨";s:2:"Σ";s:4:"𝝩";s:2:"Τ";s:4:"𝝪";s:2:"Υ";s:4:"𝝫";s:2:"Φ";s:4:"𝝬";s:2:"Χ";s:4:"𝝭";s:2:"Ψ";s:4:"𝝮";s:2:"Ω";s:4:"𝝯";s:3:"∇";s:4:"𝝰";s:2:"α";s:4:"𝝱";s:2:"β";s:4:"𝝲";s:2:"γ";s:4:"𝝳";s:2:"δ";s:4:"𝝴";s:2:"ε";s:4:"𝝵";s:2:"ζ";s:4:"𝝶";s:2:"η";s:4:"𝝷";s:2:"θ";s:4:"𝝸";s:2:"ι";s:4:"𝝹";s:2:"κ";s:4:"𝝺";s:2:"λ";s:4:"𝝻";s:2:"μ";s:4:"𝝼";s:2:"ν";s:4:"𝝽";s:2:"ξ";s:4:"𝝾";s:2:"ο";s:4:"𝝿";s:2:"π";s:4:"𝞀";s:2:"ρ";s:4:"𝞁";s:2:"ς";s:4:"𝞂";s:2:"σ";s:4:"𝞃";s:2:"τ";s:4:"𝞄";s:2:"υ";s:4:"𝞅";s:2:"φ";s:4:"𝞆";s:2:"χ";s:4:"𝞇";s:2:"ψ";s:4:"𝞈";s:2:"ω";s:4:"𝞉";s:3:"∂";s:4:"𝞊";s:2:"ϵ";s:4:"𝞋";s:2:"ϑ";s:4:"𝞌";s:2:"ϰ";s:4:"𝞍";s:2:"ϕ";s:4:"𝞎";s:2:"ϱ";s:4:"𝞏";s:2:"ϖ";s:4:"𝞐";s:2:"Α";s:4:"𝞑";s:2:"Β";s:4:"𝞒";s:2:"Γ";s:4:"𝞓";s:2:"Δ";s:4:"𝞔";s:2:"Ε";s:4:"𝞕";s:2:"Ζ";s:4:"𝞖";s:2:"Η";s:4:"𝞗";s:2:"Θ";s:4:"𝞘";s:2:"Ι";s:4:"𝞙";s:2:"Κ";s:4:"𝞚";s:2:"Λ";s:4:"𝞛";s:2:"Μ";s:4:"𝞜";s:2:"Ν";s:4:"𝞝";s:2:"Ξ";s:4:"𝞞";s:2:"Ο";s:4:"𝞟";s:2:"Π";s:4:"𝞠";s:2:"Ρ";s:4:"𝞡";s:2:"ϴ";s:4:"𝞢";s:2:"Σ";s:4:"𝞣";s:2:"Τ";s:4:"𝞤";s:2:"Υ";s:4:"𝞥";s:2:"Φ";s:4:"𝞦";s:2:"Χ";s:4:"𝞧";s:2:"Ψ";s:4:"𝞨";s:2:"Ω";s:4:"𝞩";s:3:"∇";s:4:"𝞪";s:2:"α";s:4:"𝞫";s:2:"β";s:4:"𝞬";s:2:"γ";s:4:"𝞭";s:2:"δ";s:4:"𝞮";s:2:"ε";s:4:"𝞯";s:2:"ζ";s:4:"𝞰";s:2:"η";s:4:"𝞱";s:2:"θ";s:4:"𝞲";s:2:"ι";s:4:"𝞳";s:2:"κ";s:4:"𝞴";s:2:"λ";s:4:"𝞵";s:2:"μ";s:4:"𝞶";s:2:"ν";s:4:"𝞷";s:2:"ξ";s:4:"𝞸";s:2:"ο";s:4:"𝞹";s:2:"π";s:4:"𝞺";s:2:"ρ";s:4:"𝞻";s:2:"ς";s:4:"𝞼";s:2:"σ";s:4:"𝞽";s:2:"τ";s:4:"𝞾";s:2:"υ";s:4:"𝞿";s:2:"φ";s:4:"𝟀";s:2:"χ";s:4:"𝟁";s:2:"ψ";s:4:"𝟂";s:2:"ω";s:4:"𝟃";s:3:"∂";s:4:"𝟄";s:2:"ϵ";s:4:"𝟅";s:2:"ϑ";s:4:"𝟆";s:2:"ϰ";s:4:"𝟇";s:2:"ϕ";s:4:"𝟈";s:2:"ϱ";s:4:"𝟉";s:2:"ϖ";s:4:"𝟊";s:2:"Ϝ";s:4:"𝟋";s:2:"ϝ";s:4:"𝟎";s:1:"0";s:4:"𝟏";s:1:"1";s:4:"𝟐";s:1:"2";s:4:"𝟑";s:1:"3";s:4:"𝟒";s:1:"4";s:4:"𝟓";s:1:"5";s:4:"𝟔";s:1:"6";s:4:"𝟕";s:1:"7";s:4:"𝟖";s:1:"8";s:4:"𝟗";s:1:"9";s:4:"𝟘";s:1:"0";s:4:"𝟙";s:1:"1";s:4:"𝟚";s:1:"2";s:4:"𝟛";s:1:"3";s:4:"𝟜";s:1:"4";s:4:"𝟝";s:1:"5";s:4:"𝟞";s:1:"6";s:4:"𝟟";s:1:"7";s:4:"𝟠";s:1:"8";s:4:"𝟡";s:1:"9";s:4:"𝟢";s:1:"0";s:4:"𝟣";s:1:"1";s:4:"𝟤";s:1:"2";s:4:"𝟥";s:1:"3";s:4:"𝟦";s:1:"4";s:4:"𝟧";s:1:"5";s:4:"𝟨";s:1:"6";s:4:"𝟩";s:1:"7";s:4:"𝟪";s:1:"8";s:4:"𝟫";s:1:"9";s:4:"𝟬";s:1:"0";s:4:"𝟭";s:1:"1";s:4:"𝟮";s:1:"2";s:4:"𝟯";s:1:"3";s:4:"𝟰";s:1:"4";s:4:"𝟱";s:1:"5";s:4:"𝟲";s:1:"6";s:4:"𝟳";s:1:"7";s:4:"𝟴";s:1:"8";s:4:"𝟵";s:1:"9";s:4:"𝟶";s:1:"0";s:4:"𝟷";s:1:"1";s:4:"𝟸";s:1:"2";s:4:"𝟹";s:1:"3";s:4:"𝟺";s:1:"4";s:4:"𝟻";s:1:"5";s:4:"𝟼";s:1:"6";s:4:"𝟽";s:1:"7";s:4:"𝟾";s:1:"8";s:4:"𝟿";s:1:"9";s:4:"𞸀";s:2:"ا";s:4:"𞸁";s:2:"ب";s:4:"𞸂";s:2:"ج";s:4:"𞸃";s:2:"د";s:4:"𞸅";s:2:"و";s:4:"𞸆";s:2:"ز";s:4:"𞸇";s:2:"ح";s:4:"𞸈";s:2:"ط";s:4:"𞸉";s:2:"ي";s:4:"𞸊";s:2:"ك";s:4:"𞸋";s:2:"ل";s:4:"𞸌";s:2:"م";s:4:"𞸍";s:2:"ن";s:4:"𞸎";s:2:"س";s:4:"𞸏";s:2:"ع";s:4:"𞸐";s:2:"ف";s:4:"𞸑";s:2:"ص";s:4:"𞸒";s:2:"ق";s:4:"𞸓";s:2:"ر";s:4:"𞸔";s:2:"ش";s:4:"𞸕";s:2:"ت";s:4:"𞸖";s:2:"ث";s:4:"𞸗";s:2:"خ";s:4:"𞸘";s:2:"ذ";s:4:"𞸙";s:2:"ض";s:4:"𞸚";s:2:"ظ";s:4:"𞸛";s:2:"غ";s:4:"𞸜";s:2:"ٮ";s:4:"𞸝";s:2:"ں";s:4:"𞸞";s:2:"ڡ";s:4:"𞸟";s:2:"ٯ";s:4:"𞸡";s:2:"ب";s:4:"𞸢";s:2:"ج";s:4:"𞸤";s:2:"ه";s:4:"𞸧";s:2:"ح";s:4:"𞸩";s:2:"ي";s:4:"𞸪";s:2:"ك";s:4:"𞸫";s:2:"ل";s:4:"𞸬";s:2:"م";s:4:"𞸭";s:2:"ن";s:4:"𞸮";s:2:"س";s:4:"𞸯";s:2:"ع";s:4:"𞸰";s:2:"ف";s:4:"𞸱";s:2:"ص";s:4:"𞸲";s:2:"ق";s:4:"𞸴";s:2:"ش";s:4:"𞸵";s:2:"ت";s:4:"𞸶";s:2:"ث";s:4:"𞸷";s:2:"خ";s:4:"𞸹";s:2:"ض";s:4:"𞸻";s:2:"غ";s:4:"𞹂";s:2:"ج";s:4:"𞹇";s:2:"ح";s:4:"𞹉";s:2:"ي";s:4:"𞹋";s:2:"ل";s:4:"𞹍";s:2:"ن";s:4:"𞹎";s:2:"س";s:4:"𞹏";s:2:"ع";s:4:"𞹑";s:2:"ص";s:4:"𞹒";s:2:"ق";s:4:"𞹔";s:2:"ش";s:4:"𞹗";s:2:"خ";s:4:"𞹙";s:2:"ض";s:4:"𞹛";s:2:"غ";s:4:"𞹝";s:2:"ں";s:4:"𞹟";s:2:"ٯ";s:4:"𞹡";s:2:"ب";s:4:"𞹢";s:2:"ج";s:4:"𞹤";s:2:"ه";s:4:"𞹧";s:2:"ح";s:4:"𞹨";s:2:"ط";s:4:"𞹩";s:2:"ي";s:4:"𞹪";s:2:"ك";s:4:"𞹬";s:2:"م";s:4:"𞹭";s:2:"ن";s:4:"𞹮";s:2:"س";s:4:"𞹯";s:2:"ع";s:4:"𞹰";s:2:"ف";s:4:"𞹱";s:2:"ص";s:4:"𞹲";s:2:"ق";s:4:"𞹴";s:2:"ش";s:4:"𞹵";s:2:"ت";s:4:"𞹶";s:2:"ث";s:4:"𞹷";s:2:"خ";s:4:"𞹹";s:2:"ض";s:4:"𞹺";s:2:"ظ";s:4:"𞹻";s:2:"غ";s:4:"𞹼";s:2:"ٮ";s:4:"𞹾";s:2:"ڡ";s:4:"𞺀";s:2:"ا";s:4:"𞺁";s:2:"ب";s:4:"𞺂";s:2:"ج";s:4:"𞺃";s:2:"د";s:4:"𞺄";s:2:"ه";s:4:"𞺅";s:2:"و";s:4:"𞺆";s:2:"ز";s:4:"𞺇";s:2:"ح";s:4:"𞺈";s:2:"ط";s:4:"𞺉";s:2:"ي";s:4:"𞺋";s:2:"ل";s:4:"𞺌";s:2:"م";s:4:"𞺍";s:2:"ن";s:4:"𞺎";s:2:"س";s:4:"𞺏";s:2:"ع";s:4:"𞺐";s:2:"ف";s:4:"𞺑";s:2:"ص";s:4:"𞺒";s:2:"ق";s:4:"𞺓";s:2:"ر";s:4:"𞺔";s:2:"ش";s:4:"𞺕";s:2:"ت";s:4:"𞺖";s:2:"ث";s:4:"𞺗";s:2:"خ";s:4:"𞺘";s:2:"ذ";s:4:"𞺙";s:2:"ض";s:4:"𞺚";s:2:"ظ";s:4:"𞺛";s:2:"غ";s:4:"𞺡";s:2:"ب";s:4:"𞺢";s:2:"ج";s:4:"𞺣";s:2:"د";s:4:"𞺥";s:2:"و";s:4:"𞺦";s:2:"ز";s:4:"𞺧";s:2:"ح";s:4:"𞺨";s:2:"ط";s:4:"𞺩";s:2:"ي";s:4:"𞺫";s:2:"ل";s:4:"𞺬";s:2:"م";s:4:"𞺭";s:2:"ن";s:4:"𞺮";s:2:"س";s:4:"𞺯";s:2:"ع";s:4:"𞺰";s:2:"ف";s:4:"𞺱";s:2:"ص";s:4:"𞺲";s:2:"ق";s:4:"𞺳";s:2:"ر";s:4:"𞺴";s:2:"ش";s:4:"𞺵";s:2:"ت";s:4:"𞺶";s:2:"ث";s:4:"𞺷";s:2:"خ";s:4:"𞺸";s:2:"ذ";s:4:"𞺹";s:2:"ض";s:4:"𞺺";s:2:"ظ";s:4:"𞺻";s:2:"غ";s:4:"🄀";s:2:"0.";s:4:"🄁";s:2:"0,";s:4:"🄂";s:2:"1,";s:4:"🄃";s:2:"2,";s:4:"🄄";s:2:"3,";s:4:"🄅";s:2:"4,";s:4:"🄆";s:2:"5,";s:4:"🄇";s:2:"6,";s:4:"🄈";s:2:"7,";s:4:"🄉";s:2:"8,";s:4:"🄊";s:2:"9,";s:4:"🄐";s:3:"(A)";s:4:"🄑";s:3:"(B)";s:4:"🄒";s:3:"(C)";s:4:"🄓";s:3:"(D)";s:4:"🄔";s:3:"(E)";s:4:"🄕";s:3:"(F)";s:4:"🄖";s:3:"(G)";s:4:"🄗";s:3:"(H)";s:4:"🄘";s:3:"(I)";s:4:"🄙";s:3:"(J)";s:4:"🄚";s:3:"(K)";s:4:"🄛";s:3:"(L)";s:4:"🄜";s:3:"(M)";s:4:"🄝";s:3:"(N)";s:4:"🄞";s:3:"(O)";s:4:"🄟";s:3:"(P)";s:4:"🄠";s:3:"(Q)";s:4:"🄡";s:3:"(R)";s:4:"🄢";s:3:"(S)";s:4:"🄣";s:3:"(T)";s:4:"🄤";s:3:"(U)";s:4:"🄥";s:3:"(V)";s:4:"🄦";s:3:"(W)";s:4:"🄧";s:3:"(X)";s:4:"🄨";s:3:"(Y)";s:4:"🄩";s:3:"(Z)";s:4:"🄪";s:7:"〔S〕";s:4:"🄫";s:3:"(C)";s:4:"🄬";s:3:"(R)";s:4:"🄭";s:4:"(CD)";s:4:"🄮";s:4:"(WZ)";s:4:"🄰";s:1:"A";s:4:"🄱";s:1:"B";s:4:"🄲";s:1:"C";s:4:"🄳";s:1:"D";s:4:"🄴";s:1:"E";s:4:"🄵";s:1:"F";s:4:"🄶";s:1:"G";s:4:"🄷";s:1:"H";s:4:"🄸";s:1:"I";s:4:"🄹";s:1:"J";s:4:"🄺";s:1:"K";s:4:"🄻";s:1:"L";s:4:"🄼";s:1:"M";s:4:"🄽";s:1:"N";s:4:"🄾";s:1:"O";s:4:"🄿";s:1:"P";s:4:"🅀";s:1:"Q";s:4:"🅁";s:1:"R";s:4:"🅂";s:1:"S";s:4:"🅃";s:1:"T";s:4:"🅄";s:1:"U";s:4:"🅅";s:1:"V";s:4:"🅆";s:1:"W";s:4:"🅇";s:1:"X";s:4:"🅈";s:1:"Y";s:4:"🅉";s:1:"Z";s:4:"🅊";s:2:"HV";s:4:"🅋";s:2:"MV";s:4:"🅌";s:2:"SD";s:4:"🅍";s:2:"SS";s:4:"🅎";s:3:"PPV";s:4:"🅏";s:2:"WC";s:4:"🆐";s:2:"DJ";s:4:"🈀";s:6:"ほか";s:4:"🈁";s:6:"ココ";s:4:"🈂";s:3:"サ";s:4:"🈐";s:3:"手";s:4:"🈑";s:3:"字";s:4:"🈒";s:3:"双";s:4:"🈓";s:3:"デ";s:4:"🈔";s:3:"二";s:4:"🈕";s:3:"多";s:4:"🈖";s:3:"解";s:4:"🈗";s:3:"天";s:4:"🈘";s:3:"交";s:4:"🈙";s:3:"映";s:4:"🈚";s:3:"無";s:4:"🈛";s:3:"料";s:4:"🈜";s:3:"前";s:4:"🈝";s:3:"後";s:4:"🈞";s:3:"再";s:4:"🈟";s:3:"新";s:4:"🈠";s:3:"初";s:4:"🈡";s:3:"終";s:4:"🈢";s:3:"生";s:4:"🈣";s:3:"販";s:4:"🈤";s:3:"声";s:4:"🈥";s:3:"吹";s:4:"🈦";s:3:"演";s:4:"🈧";s:3:"投";s:4:"🈨";s:3:"捕";s:4:"🈩";s:3:"一";s:4:"🈪";s:3:"三";s:4:"🈫";s:3:"遊";s:4:"🈬";s:3:"左";s:4:"🈭";s:3:"中";s:4:"🈮";s:3:"右";s:4:"🈯";s:3:"指";s:4:"🈰";s:3:"走";s:4:"🈱";s:3:"打";s:4:"🈲";s:3:"禁";s:4:"🈳";s:3:"空";s:4:"🈴";s:3:"合";s:4:"🈵";s:3:"満";s:4:"🈶";s:3:"有";s:4:"🈷";s:3:"月";s:4:"🈸";s:3:"申";s:4:"🈹";s:3:"割";s:4:"🈺";s:3:"営";s:4:"🉀";s:9:"〔本〕";s:4:"🉁";s:9:"〔三〕";s:4:"🉂";s:9:"〔二〕";s:4:"🉃";s:9:"〔安〕";s:4:"🉄";s:9:"〔点〕";s:4:"🉅";s:9:"〔打〕";s:4:"🉆";s:9:"〔盗〕";s:4:"🉇";s:9:"〔勝〕";s:4:"🉈";s:9:"〔敗〕";s:4:"🉐";s:5:"(得)";s:4:"🉑";s:5:"(可)";s:4:"丽";s:3:"丽";s:4:"丸";s:3:"丸";s:4:"乁";s:3:"乁";s:4:"𠄢";s:4:"𠄢";s:4:"你";s:3:"你";s:4:"侮";s:3:"侮";s:4:"侻";s:3:"侻";s:4:"倂";s:3:"倂";s:4:"偺";s:3:"偺";s:4:"備";s:3:"備";s:4:"僧";s:3:"僧";s:4:"像";s:3:"像";s:4:"㒞";s:3:"㒞";s:4:"𠘺";s:4:"𠘺";s:4:"免";s:3:"免";s:4:"兔";s:3:"兔";s:4:"兤";s:3:"兤";s:4:"具";s:3:"具";s:4:"𠔜";s:4:"𠔜";s:4:"㒹";s:3:"㒹";s:4:"內";s:3:"內";s:4:"再";s:3:"再";s:4:"𠕋";s:4:"𠕋";s:4:"冗";s:3:"冗";s:4:"冤";s:3:"冤";s:4:"仌";s:3:"仌";s:4:"冬";s:3:"冬";s:4:"况";s:3:"况";s:4:"𩇟";s:4:"𩇟";s:4:"凵";s:3:"凵";s:4:"刃";s:3:"刃";s:4:"㓟";s:3:"㓟";s:4:"刻";s:3:"刻";s:4:"剆";s:3:"剆";s:4:"割";s:3:"割";s:4:"剷";s:3:"剷";s:4:"㔕";s:3:"㔕";s:4:"勇";s:3:"勇";s:4:"勉";s:3:"勉";s:4:"勤";s:3:"勤";s:4:"勺";s:3:"勺";s:4:"包";s:3:"包";s:4:"匆";s:3:"匆";s:4:"北";s:3:"北";s:4:"卉";s:3:"卉";s:4:"卑";s:3:"卑";s:4:"博";s:3:"博";s:4:"即";s:3:"即";s:4:"卽";s:3:"卽";s:4:"卿";s:3:"卿";s:4:"卿";s:3:"卿";s:4:"卿";s:3:"卿";s:4:"𠨬";s:4:"𠨬";s:4:"灰";s:3:"灰";s:4:"及";s:3:"及";s:4:"叟";s:3:"叟";s:4:"𠭣";s:4:"𠭣";s:4:"叫";s:3:"叫";s:4:"叱";s:3:"叱";s:4:"吆";s:3:"吆";s:4:"咞";s:3:"咞";s:4:"吸";s:3:"吸";s:4:"呈";s:3:"呈";s:4:"周";s:3:"周";s:4:"咢";s:3:"咢";s:4:"哶";s:3:"哶";s:4:"唐";s:3:"唐";s:4:"啓";s:3:"啓";s:4:"啣";s:3:"啣";s:4:"善";s:3:"善";s:4:"善";s:3:"善";s:4:"喙";s:3:"喙";s:4:"喫";s:3:"喫";s:4:"喳";s:3:"喳";s:4:"嗂";s:3:"嗂";s:4:"圖";s:3:"圖";s:4:"嘆";s:3:"嘆";s:4:"圗";s:3:"圗";s:4:"噑";s:3:"噑";s:4:"噴";s:3:"噴";s:4:"切";s:3:"切";s:4:"壮";s:3:"壮";s:4:"城";s:3:"城";s:4:"埴";s:3:"埴";s:4:"堍";s:3:"堍";s:4:"型";s:3:"型";s:4:"堲";s:3:"堲";s:4:"報";s:3:"報";s:4:"墬";s:3:"墬";s:4:"𡓤";s:4:"𡓤";s:4:"売";s:3:"売";s:4:"壷";s:3:"壷";s:4:"夆";s:3:"夆";s:4:"多";s:3:"多";s:4:"夢";s:3:"夢";s:4:"奢";s:3:"奢";s:4:"𡚨";s:4:"𡚨";s:4:"𡛪";s:4:"𡛪";s:4:"姬";s:3:"姬";s:4:"娛";s:3:"娛";s:4:"娧";s:3:"娧";s:4:"姘";s:3:"姘";s:4:"婦";s:3:"婦";s:4:"㛮";s:3:"㛮";s:4:"㛼";s:3:"㛼";s:4:"嬈";s:3:"嬈";s:4:"嬾";s:3:"嬾";s:4:"嬾";s:3:"嬾";s:4:"𡧈";s:4:"𡧈";s:4:"寃";s:3:"寃";s:4:"寘";s:3:"寘";s:4:"寧";s:3:"寧";s:4:"寳";s:3:"寳";s:4:"𡬘";s:4:"𡬘";s:4:"寿";s:3:"寿";s:4:"将";s:3:"将";s:4:"当";s:3:"当";s:4:"尢";s:3:"尢";s:4:"㞁";s:3:"㞁";s:4:"屠";s:3:"屠";s:4:"屮";s:3:"屮";s:4:"峀";s:3:"峀";s:4:"岍";s:3:"岍";s:4:"𡷤";s:4:"𡷤";s:4:"嵃";s:3:"嵃";s:4:"𡷦";s:4:"𡷦";s:4:"嵮";s:3:"嵮";s:4:"嵫";s:3:"嵫";s:4:"嵼";s:3:"嵼";s:4:"巡";s:3:"巡";s:4:"巢";s:3:"巢";s:4:"㠯";s:3:"㠯";s:4:"巽";s:3:"巽";s:4:"帨";s:3:"帨";s:4:"帽";s:3:"帽";s:4:"幩";s:3:"幩";s:4:"㡢";s:3:"㡢";s:4:"𢆃";s:4:"𢆃";s:4:"㡼";s:3:"㡼";s:4:"庰";s:3:"庰";s:4:"庳";s:3:"庳";s:4:"庶";s:3:"庶";s:4:"廊";s:3:"廊";s:4:"𪎒";s:4:"𪎒";s:4:"廾";s:3:"廾";s:4:"𢌱";s:4:"𢌱";s:4:"𢌱";s:4:"𢌱";s:4:"舁";s:3:"舁";s:4:"弢";s:3:"弢";s:4:"弢";s:3:"弢";s:4:"㣇";s:3:"㣇";s:4:"𣊸";s:4:"𣊸";s:4:"𦇚";s:4:"𦇚";s:4:"形";s:3:"形";s:4:"彫";s:3:"彫";s:4:"㣣";s:3:"㣣";s:4:"徚";s:3:"徚";s:4:"忍";s:3:"忍";s:4:"志";s:3:"志";s:4:"忹";s:3:"忹";s:4:"悁";s:3:"悁";s:4:"㤺";s:3:"㤺";s:4:"㤜";s:3:"㤜";s:4:"悔";s:3:"悔";s:4:"𢛔";s:4:"𢛔";s:4:"惇";s:3:"惇";s:4:"慈";s:3:"慈";s:4:"慌";s:3:"慌";s:4:"慎";s:3:"慎";s:4:"慌";s:3:"慌";s:4:"慺";s:3:"慺";s:4:"憎";s:3:"憎";s:4:"憲";s:3:"憲";s:4:"憤";s:3:"憤";s:4:"憯";s:3:"憯";s:4:"懞";s:3:"懞";s:4:"懲";s:3:"懲";s:4:"懶";s:3:"懶";s:4:"成";s:3:"成";s:4:"戛";s:3:"戛";s:4:"扝";s:3:"扝";s:4:"抱";s:3:"抱";s:4:"拔";s:3:"拔";s:4:"捐";s:3:"捐";s:4:"𢬌";s:4:"𢬌";s:4:"挽";s:3:"挽";s:4:"拼";s:3:"拼";s:4:"捨";s:3:"捨";s:4:"掃";s:3:"掃";s:4:"揤";s:3:"揤";s:4:"𢯱";s:4:"𢯱";s:4:"搢";s:3:"搢";s:4:"揅";s:3:"揅";s:4:"掩";s:3:"掩";s:4:"㨮";s:3:"㨮";s:4:"摩";s:3:"摩";s:4:"摾";s:3:"摾";s:4:"撝";s:3:"撝";s:4:"摷";s:3:"摷";s:4:"㩬";s:3:"㩬";s:4:"敏";s:3:"敏";s:4:"敬";s:3:"敬";s:4:"𣀊";s:4:"𣀊";s:4:"旣";s:3:"旣";s:4:"書";s:3:"書";s:4:"晉";s:3:"晉";s:4:"㬙";s:3:"㬙";s:4:"暑";s:3:"暑";s:4:"㬈";s:3:"㬈";s:4:"㫤";s:3:"㫤";s:4:"冒";s:3:"冒";s:4:"冕";s:3:"冕";s:4:"最";s:3:"最";s:4:"暜";s:3:"暜";s:4:"肭";s:3:"肭";s:4:"䏙";s:3:"䏙";s:4:"朗";s:3:"朗";s:4:"望";s:3:"望";s:4:"朡";s:3:"朡";s:4:"杞";s:3:"杞";s:4:"杓";s:3:"杓";s:4:"𣏃";s:4:"𣏃";s:4:"㭉";s:3:"㭉";s:4:"柺";s:3:"柺";s:4:"枅";s:3:"枅";s:4:"桒";s:3:"桒";s:4:"梅";s:3:"梅";s:4:"𣑭";s:4:"𣑭";s:4:"梎";s:3:"梎";s:4:"栟";s:3:"栟";s:4:"椔";s:3:"椔";s:4:"㮝";s:3:"㮝";s:4:"楂";s:3:"楂";s:4:"榣";s:3:"榣";s:4:"槪";s:3:"槪";s:4:"檨";s:3:"檨";s:4:"𣚣";s:4:"𣚣";s:4:"櫛";s:3:"櫛";s:4:"㰘";s:3:"㰘";s:4:"次";s:3:"次";s:4:"𣢧";s:4:"𣢧";s:4:"歔";s:3:"歔";s:4:"㱎";s:3:"㱎";s:4:"歲";s:3:"歲";s:4:"殟";s:3:"殟";s:4:"殺";s:3:"殺";s:4:"殻";s:3:"殻";s:4:"𣪍";s:4:"𣪍";s:4:"𡴋";s:4:"𡴋";s:4:"𣫺";s:4:"𣫺";s:4:"汎";s:3:"汎";s:4:"𣲼";s:4:"𣲼";s:4:"沿";s:3:"沿";s:4:"泍";s:3:"泍";s:4:"汧";s:3:"汧";s:4:"洖";s:3:"洖";s:4:"派";s:3:"派";s:4:"海";s:3:"海";s:4:"流";s:3:"流";s:4:"浩";s:3:"浩";s:4:"浸";s:3:"浸";s:4:"涅";s:3:"涅";s:4:"𣴞";s:4:"𣴞";s:4:"洴";s:3:"洴";s:4:"港";s:3:"港";s:4:"湮";s:3:"湮";s:4:"㴳";s:3:"㴳";s:4:"滋";s:3:"滋";s:4:"滇";s:3:"滇";s:4:"𣻑";s:4:"𣻑";s:4:"淹";s:3:"淹";s:4:"潮";s:3:"潮";s:4:"𣽞";s:4:"𣽞";s:4:"𣾎";s:4:"𣾎";s:4:"濆";s:3:"濆";s:4:"瀹";s:3:"瀹";s:4:"瀞";s:3:"瀞";s:4:"瀛";s:3:"瀛";s:4:"㶖";s:3:"㶖";s:4:"灊";s:3:"灊";s:4:"災";s:3:"災";s:4:"灷";s:3:"灷";s:4:"炭";s:3:"炭";s:4:"𠔥";s:4:"𠔥";s:4:"煅";s:3:"煅";s:4:"𤉣";s:4:"𤉣";s:4:"熜";s:3:"熜";s:4:"𤎫";s:4:"𤎫";s:4:"爨";s:3:"爨";s:4:"爵";s:3:"爵";s:4:"牐";s:3:"牐";s:4:"𤘈";s:4:"𤘈";s:4:"犀";s:3:"犀";s:4:"犕";s:3:"犕";s:4:"𤜵";s:4:"𤜵";s:4:"𤠔";s:4:"𤠔";s:4:"獺";s:3:"獺";s:4:"王";s:3:"王";s:4:"㺬";s:3:"㺬";s:4:"玥";s:3:"玥";s:4:"㺸";s:3:"㺸";s:4:"㺸";s:3:"㺸";s:4:"瑇";s:3:"瑇";s:4:"瑜";s:3:"瑜";s:4:"瑱";s:3:"瑱";s:4:"璅";s:3:"璅";s:4:"瓊";s:3:"瓊";s:4:"㼛";s:3:"㼛";s:4:"甤";s:3:"甤";s:4:"𤰶";s:4:"𤰶";s:4:"甾";s:3:"甾";s:4:"𤲒";s:4:"𤲒";s:4:"異";s:3:"異";s:4:"𢆟";s:4:"𢆟";s:4:"瘐";s:3:"瘐";s:4:"𤾡";s:4:"𤾡";s:4:"𤾸";s:4:"𤾸";s:4:"𥁄";s:4:"𥁄";s:4:"㿼";s:3:"㿼";s:4:"䀈";s:3:"䀈";s:4:"直";s:3:"直";s:4:"𥃳";s:4:"𥃳";s:4:"𥃲";s:4:"𥃲";s:4:"𥄙";s:4:"𥄙";s:4:"𥄳";s:4:"𥄳";s:4:"眞";s:3:"眞";s:4:"真";s:3:"真";s:4:"真";s:3:"真";s:4:"睊";s:3:"睊";s:4:"䀹";s:3:"䀹";s:4:"瞋";s:3:"瞋";s:4:"䁆";s:3:"䁆";s:4:"䂖";s:3:"䂖";s:4:"𥐝";s:4:"𥐝";s:4:"硎";s:3:"硎";s:4:"碌";s:3:"碌";s:4:"磌";s:3:"磌";s:4:"䃣";s:3:"䃣";s:4:"𥘦";s:4:"𥘦";s:4:"祖";s:3:"祖";s:4:"𥚚";s:4:"𥚚";s:4:"𥛅";s:4:"𥛅";s:4:"福";s:3:"福";s:4:"秫";s:3:"秫";s:4:"䄯";s:3:"䄯";s:4:"穀";s:3:"穀";s:4:"穊";s:3:"穊";s:4:"穏";s:3:"穏";s:4:"𥥼";s:4:"𥥼";s:4:"𥪧";s:4:"𥪧";s:4:"𥪧";s:4:"𥪧";s:4:"竮";s:3:"竮";s:4:"䈂";s:3:"䈂";s:4:"𥮫";s:4:"𥮫";s:4:"篆";s:3:"篆";s:4:"築";s:3:"築";s:4:"䈧";s:3:"䈧";s:4:"𥲀";s:4:"𥲀";s:4:"糒";s:3:"糒";s:4:"䊠";s:3:"䊠";s:4:"糨";s:3:"糨";s:4:"糣";s:3:"糣";s:4:"紀";s:3:"紀";s:4:"𥾆";s:4:"𥾆";s:4:"絣";s:3:"絣";s:4:"䌁";s:3:"䌁";s:4:"緇";s:3:"緇";s:4:"縂";s:3:"縂";s:4:"繅";s:3:"繅";s:4:"䌴";s:3:"䌴";s:4:"𦈨";s:4:"𦈨";s:4:"𦉇";s:4:"𦉇";s:4:"䍙";s:3:"䍙";s:4:"𦋙";s:4:"𦋙";s:4:"罺";s:3:"罺";s:4:"𦌾";s:4:"𦌾";s:4:"羕";s:3:"羕";s:4:"翺";s:3:"翺";s:4:"者";s:3:"者";s:4:"𦓚";s:4:"𦓚";s:4:"𦔣";s:4:"𦔣";s:4:"聠";s:3:"聠";s:4:"𦖨";s:4:"𦖨";s:4:"聰";s:3:"聰";s:4:"𣍟";s:4:"𣍟";s:4:"䏕";s:3:"䏕";s:4:"育";s:3:"育";s:4:"脃";s:3:"脃";s:4:"䐋";s:3:"䐋";s:4:"脾";s:3:"脾";s:4:"媵";s:3:"媵";s:4:"𦞧";s:4:"𦞧";s:4:"𦞵";s:4:"𦞵";s:4:"𣎓";s:4:"𣎓";s:4:"𣎜";s:4:"𣎜";s:4:"舁";s:3:"舁";s:4:"舄";s:3:"舄";s:4:"辞";s:3:"辞";s:4:"䑫";s:3:"䑫";s:4:"芑";s:3:"芑";s:4:"芋";s:3:"芋";s:4:"芝";s:3:"芝";s:4:"劳";s:3:"劳";s:4:"花";s:3:"花";s:4:"芳";s:3:"芳";s:4:"芽";s:3:"芽";s:4:"苦";s:3:"苦";s:4:"𦬼";s:4:"𦬼";s:4:"若";s:3:"若";s:4:"茝";s:3:"茝";s:4:"荣";s:3:"荣";s:4:"莭";s:3:"莭";s:4:"茣";s:3:"茣";s:4:"莽";s:3:"莽";s:4:"菧";s:3:"菧";s:4:"著";s:3:"著";s:4:"荓";s:3:"荓";s:4:"菊";s:3:"菊";s:4:"菌";s:3:"菌";s:4:"菜";s:3:"菜";s:4:"𦰶";s:4:"𦰶";s:4:"𦵫";s:4:"𦵫";s:4:"𦳕";s:4:"𦳕";s:4:"䔫";s:3:"䔫";s:4:"蓱";s:3:"蓱";s:4:"蓳";s:3:"蓳";s:4:"蔖";s:3:"蔖";s:4:"𧏊";s:4:"𧏊";s:4:"蕤";s:3:"蕤";s:4:"𦼬";s:4:"𦼬";s:4:"䕝";s:3:"䕝";s:4:"䕡";s:3:"䕡";s:4:"𦾱";s:4:"𦾱";s:4:"𧃒";s:4:"𧃒";s:4:"䕫";s:3:"䕫";s:4:"虐";s:3:"虐";s:4:"虜";s:3:"虜";s:4:"虧";s:3:"虧";s:4:"虩";s:3:"虩";s:4:"蚩";s:3:"蚩";s:4:"蚈";s:3:"蚈";s:4:"蜎";s:3:"蜎";s:4:"蛢";s:3:"蛢";s:4:"蝹";s:3:"蝹";s:4:"蜨";s:3:"蜨";s:4:"蝫";s:3:"蝫";s:4:"螆";s:3:"螆";s:4:"䗗";s:3:"䗗";s:4:"蟡";s:3:"蟡";s:4:"蠁";s:3:"蠁";s:4:"䗹";s:3:"䗹";s:4:"衠";s:3:"衠";s:4:"衣";s:3:"衣";s:4:"𧙧";s:4:"𧙧";s:4:"裗";s:3:"裗";s:4:"裞";s:3:"裞";s:4:"䘵";s:3:"䘵";s:4:"裺";s:3:"裺";s:4:"㒻";s:3:"㒻";s:4:"𧢮";s:4:"𧢮";s:4:"𧥦";s:4:"𧥦";s:4:"䚾";s:3:"䚾";s:4:"䛇";s:3:"䛇";s:4:"誠";s:3:"誠";s:4:"諭";s:3:"諭";s:4:"變";s:3:"變";s:4:"豕";s:3:"豕";s:4:"𧲨";s:4:"𧲨";s:4:"貫";s:3:"貫";s:4:"賁";s:3:"賁";s:4:"贛";s:3:"贛";s:4:"起";s:3:"起";s:4:"𧼯";s:4:"𧼯";s:4:"𠠄";s:4:"𠠄";s:4:"跋";s:3:"跋";s:4:"趼";s:3:"趼";s:4:"跰";s:3:"跰";s:4:"𠣞";s:4:"𠣞";s:4:"軔";s:3:"軔";s:4:"輸";s:3:"輸";s:4:"𨗒";s:4:"𨗒";s:4:"𨗭";s:4:"𨗭";s:4:"邔";s:3:"邔";s:4:"郱";s:3:"郱";s:4:"鄑";s:3:"鄑";s:4:"𨜮";s:4:"𨜮";s:4:"鄛";s:3:"鄛";s:4:"鈸";s:3:"鈸";s:4:"鋗";s:3:"鋗";s:4:"鋘";s:3:"鋘";s:4:"鉼";s:3:"鉼";s:4:"鏹";s:3:"鏹";s:4:"鐕";s:3:"鐕";s:4:"𨯺";s:4:"𨯺";s:4:"開";s:3:"開";s:4:"䦕";s:3:"䦕";s:4:"閷";s:3:"閷";s:4:"𨵷";s:4:"𨵷";s:4:"䧦";s:3:"䧦";s:4:"雃";s:3:"雃";s:4:"嶲";s:3:"嶲";s:4:"霣";s:3:"霣";s:4:"𩅅";s:4:"𩅅";s:4:"𩈚";s:4:"𩈚";s:4:"䩮";s:3:"䩮";s:4:"䩶";s:3:"䩶";s:4:"韠";s:3:"韠";s:4:"𩐊";s:4:"𩐊";s:4:"䪲";s:3:"䪲";s:4:"𩒖";s:4:"𩒖";s:4:"頋";s:3:"頋";s:4:"頋";s:3:"頋";s:4:"頩";s:3:"頩";s:4:"𩖶";s:4:"𩖶";s:4:"飢";s:3:"飢";s:4:"䬳";s:3:"䬳";s:4:"餩";s:3:"餩";s:4:"馧";s:3:"馧";s:4:"駂";s:3:"駂";s:4:"駾";s:3:"駾";s:4:"䯎";s:3:"䯎";s:4:"𩬰";s:4:"𩬰";s:4:"鬒";s:3:"鬒";s:4:"鱀";s:3:"鱀";s:4:"鳽";s:3:"鳽";s:4:"䳎";s:3:"䳎";s:4:"䳭";s:3:"䳭";s:4:"鵧";s:3:"鵧";s:4:"𪃎";s:4:"𪃎";s:4:"䳸";s:3:"䳸";s:4:"𪄅";s:4:"𪄅";s:4:"𪈎";s:4:"𪈎";s:4:"𪊑";s:4:"𪊑";s:4:"麻";s:3:"麻";s:4:"䵖";s:3:"䵖";s:4:"黹";s:3:"黹";s:4:"黾";s:3:"黾";s:4:"鼅";s:3:"鼅";s:4:"鼏";s:3:"鼏";s:4:"鼖";s:3:"鼖";s:4:"鼻";s:3:"鼻";s:4:"𪘀";s:4:"𪘀";s:2:"Æ";s:2:"AE";s:2:"Ð";s:1:"D";s:2:"Ø";s:1:"O";s:2:"Þ";s:2:"TH";s:2:"ß";s:2:"ss";s:2:"æ";s:2:"ae";s:2:"ð";s:1:"d";s:2:"ø";s:1:"o";s:2:"þ";s:2:"th";s:2:"Đ";s:1:"D";s:2:"đ";s:1:"d";s:2:"Ħ";s:1:"H";s:2:"ħ";s:1:"h";s:2:"ı";s:1:"i";s:2:"ĸ";s:1:"q";s:2:"Ł";s:1:"L";s:2:"ł";s:1:"l";s:2:"Ŋ";s:1:"N";s:2:"ŋ";s:1:"n";s:2:"Œ";s:2:"OE";s:2:"œ";s:2:"oe";s:2:"Ŧ";s:1:"T";s:2:"ŧ";s:1:"t";s:2:"ƀ";s:1:"b";s:2:"Ɓ";s:1:"B";s:2:"Ƃ";s:1:"B";s:2:"ƃ";s:1:"b";s:2:"Ƈ";s:1:"C";s:2:"ƈ";s:1:"c";s:2:"Ɖ";s:1:"D";s:2:"Ɗ";s:1:"D";s:2:"Ƌ";s:1:"D";s:2:"ƌ";s:1:"d";s:2:"Ɛ";s:1:"E";s:2:"Ƒ";s:1:"F";s:2:"ƒ";s:1:"f";s:2:"Ɠ";s:1:"G";s:2:"ƕ";s:2:"hv";s:2:"Ɩ";s:1:"I";s:2:"Ɨ";s:1:"I";s:2:"Ƙ";s:1:"K";s:2:"ƙ";s:1:"k";s:2:"ƚ";s:1:"l";s:2:"Ɲ";s:1:"N";s:2:"ƞ";s:1:"n";s:2:"Ƣ";s:2:"OI";s:2:"ƣ";s:2:"oi";s:2:"Ƥ";s:1:"P";s:2:"ƥ";s:1:"p";s:2:"ƫ";s:1:"t";s:2:"Ƭ";s:1:"T";s:2:"ƭ";s:1:"t";s:2:"Ʈ";s:1:"T";s:2:"Ʋ";s:1:"V";s:2:"Ƴ";s:1:"Y";s:2:"ƴ";s:1:"y";s:2:"Ƶ";s:1:"Z";s:2:"ƶ";s:1:"z";s:2:"Ǥ";s:1:"G";s:2:"ǥ";s:1:"g";s:2:"ȡ";s:1:"d";s:2:"Ȥ";s:1:"Z";s:2:"ȥ";s:1:"z";s:2:"ȴ";s:1:"l";s:2:"ȵ";s:1:"n";s:2:"ȶ";s:1:"t";s:2:"ȷ";s:1:"j";s:2:"ȸ";s:2:"db";s:2:"ȹ";s:2:"qp";s:2:"Ⱥ";s:1:"A";s:2:"Ȼ";s:1:"C";s:2:"ȼ";s:1:"c";s:2:"Ƚ";s:1:"L";s:2:"Ⱦ";s:1:"T";s:2:"ȿ";s:1:"s";s:2:"ɀ";s:1:"z";s:2:"Ƀ";s:1:"B";s:2:"Ʉ";s:1:"U";s:2:"Ɇ";s:1:"E";s:2:"ɇ";s:1:"e";s:2:"Ɉ";s:1:"J";s:2:"ɉ";s:1:"j";s:2:"Ɍ";s:1:"R";s:2:"ɍ";s:1:"r";s:2:"Ɏ";s:1:"Y";s:2:"ɏ";s:1:"y";s:2:"ɓ";s:1:"b";s:2:"ɕ";s:1:"c";s:2:"ɖ";s:1:"d";s:2:"ɗ";s:1:"d";s:2:"ɛ";s:1:"e";s:2:"ɟ";s:1:"j";s:2:"ɠ";s:1:"g";s:2:"ɡ";s:1:"g";s:2:"ɢ";s:1:"G";s:2:"ɦ";s:1:"h";s:2:"ɧ";s:1:"h";s:2:"ɨ";s:1:"i";s:2:"ɪ";s:1:"I";s:2:"ɫ";s:1:"l";s:2:"ɬ";s:1:"l";s:2:"ɭ";s:1:"l";s:2:"ɱ";s:1:"m";s:2:"ɲ";s:1:"n";s:2:"ɳ";s:1:"n";s:2:"ɴ";s:1:"N";s:2:"ɶ";s:2:"OE";s:2:"ɼ";s:1:"r";s:2:"ɽ";s:1:"r";s:2:"ɾ";s:1:"r";s:2:"ʀ";s:1:"R";s:2:"ʂ";s:1:"s";s:2:"ʈ";s:1:"t";s:2:"ʉ";s:1:"u";s:2:"ʋ";s:1:"v";s:2:"ʏ";s:1:"Y";s:2:"ʐ";s:1:"z";s:2:"ʑ";s:1:"z";s:2:"ʙ";s:1:"B";s:2:"ʛ";s:1:"G";s:2:"ʜ";s:1:"H";s:2:"ʝ";s:1:"j";s:2:"ʟ";s:1:"L";s:2:"ʠ";s:1:"q";s:2:"ʣ";s:2:"dz";s:2:"ʥ";s:2:"dz";s:2:"ʦ";s:2:"ts";s:2:"ʪ";s:2:"ls";s:2:"ʫ";s:2:"lz";s:3:"ᴀ";s:1:"A";s:3:"ᴁ";s:2:"AE";s:3:"ᴃ";s:1:"B";s:3:"ᴄ";s:1:"C";s:3:"ᴅ";s:1:"D";s:3:"ᴆ";s:1:"D";s:3:"ᴇ";s:1:"E";s:3:"ᴊ";s:1:"J";s:3:"ᴋ";s:1:"K";s:3:"ᴌ";s:1:"L";s:3:"ᴍ";s:1:"M";s:3:"ᴏ";s:1:"O";s:3:"ᴘ";s:1:"P";s:3:"ᴛ";s:1:"T";s:3:"ᴜ";s:1:"U";s:3:"ᴠ";s:1:"V";s:3:"ᴡ";s:1:"W";s:3:"ᴢ";s:1:"Z";s:3:"ᵫ";s:2:"ue";s:3:"ᵬ";s:1:"b";s:3:"ᵭ";s:1:"d";s:3:"ᵮ";s:1:"f";s:3:"ᵯ";s:1:"m";s:3:"ᵰ";s:1:"n";s:3:"ᵱ";s:1:"p";s:3:"ᵲ";s:1:"r";s:3:"ᵳ";s:1:"r";s:3:"ᵴ";s:1:"s";s:3:"ᵵ";s:1:"t";s:3:"ᵶ";s:1:"z";s:3:"ᵺ";s:2:"th";s:3:"ᵻ";s:1:"I";s:3:"ᵽ";s:1:"p";s:3:"ᵾ";s:1:"U";s:3:"ᶀ";s:1:"b";s:3:"ᶁ";s:1:"d";s:3:"ᶂ";s:1:"f";s:3:"ᶃ";s:1:"g";s:3:"ᶄ";s:1:"k";s:3:"ᶅ";s:1:"l";s:3:"ᶆ";s:1:"m";s:3:"ᶇ";s:1:"n";s:3:"ᶈ";s:1:"p";s:3:"ᶉ";s:1:"r";s:3:"ᶊ";s:1:"s";s:3:"ᶌ";s:1:"v";s:3:"ᶍ";s:1:"x";s:3:"ᶎ";s:1:"z";s:3:"ᶏ";s:1:"a";s:3:"ᶑ";s:1:"d";s:3:"ᶒ";s:1:"e";s:3:"ᶓ";s:1:"e";s:3:"ᶖ";s:1:"i";s:3:"ᶙ";s:1:"u";s:3:"ẜ";s:1:"s";s:3:"ẝ";s:1:"s";s:3:"ẞ";s:2:"SS";s:3:"Ỻ";s:2:"LL";s:3:"ỻ";s:2:"ll";s:3:"Ỽ";s:1:"V";s:3:"ỽ";s:1:"v";s:3:"Ỿ";s:1:"Y";s:3:"ỿ";s:1:"y";s:2:"©";s:3:"(C)";s:2:"®";s:3:"(R)";s:3:"₠";s:2:"CE";s:3:"₢";s:2:"Cr";s:3:"₣";s:3:"Fr.";s:3:"₤";s:2:"L.";s:3:"₧";s:3:"Pts";s:3:"₺";s:2:"TL";s:3:"₹";s:2:"Rs";s:3:"℞";s:2:"Rx";s:3:"〇";s:1:"0";s:3:"‘";s:1:"'";s:3:"’";s:1:"'";s:3:"‚";s:1:",";s:3:"‛";s:1:"'";s:3:"“";s:1:""";s:3:"”";s:1:""";s:3:"„";s:2:",,";s:3:"‟";s:1:""";s:3:"′";s:1:"'";s:3:"〝";s:1:""";s:3:"〞";s:1:""";s:2:"«";s:2:"<<";s:2:"»";s:2:">>";s:3:"‹";s:1:"<";s:3:"›";s:1:">";s:3:"‐";s:1:"-";s:3:"‑";s:1:"-";s:3:"‒";s:1:"-";s:3:"–";s:1:"-";s:3:"—";s:1:"-";s:3:"―";s:1:"-";s:3:"︱";s:1:"-";s:3:"︲";s:1:"-";s:3:"‖";s:2:"||";s:3:"⁄";s:1:"/";s:3:"⁅";s:1:"[";s:3:"⁆";s:1:"]";s:3:"⁎";s:1:"*";s:3:"、";s:1:",";s:3:"。";s:1:".";s:3:"〈";s:1:"<";s:3:"〉";s:1:">";s:3:"《";s:2:"<<";s:3:"》";s:2:">>";s:3:"〔";s:1:"[";s:3:"〕";s:1:"]";s:3:"〘";s:1:"[";s:3:"〙";s:1:"]";s:3:"〚";s:1:"[";s:3:"〛";s:1:"]";s:3:"︐";s:1:",";s:3:"︑";s:1:",";s:3:"︒";s:1:".";s:3:"︓";s:1:":";s:3:"︔";s:1:";";s:3:"︕";s:1:"!";s:3:"︖";s:1:"?";s:3:"︙";s:3:"...";s:3:"︰";s:2:"..";s:3:"︵";s:1:"(";s:3:"︶";s:1:")";s:3:"︷";s:1:"{";s:3:"︸";s:1:"}";s:3:"︹";s:1:"[";s:3:"︺";s:1:"]";s:3:"︽";s:2:"<<";s:3:"︾";s:2:">>";s:3:"︿";s:1:"<";s:3:"﹀";s:1:">";s:3:"﹇";s:1:"[";s:3:"﹈";s:1:"]";s:2:"×";s:1:"*";s:2:"÷";s:1:"/";s:3:"−";s:1:"-";s:3:"∕";s:1:"/";s:3:"∖";s:1:"\";s:3:"∣";s:1:"|";s:3:"∥";s:2:"||";s:3:"≪";s:2:"<<";s:3:"≫";s:2:">>";s:3:"⦅";s:2:"((";s:3:"⦆";s:2:"))";} \ No newline at end of file +a:4089:{s:2:"µ";s:2:"μ";s:2:"¼";s:7:" 1⁄4 ";s:2:"½";s:7:" 1⁄2 ";s:2:"¾";s:7:" 3⁄4 ";s:2:"IJ";s:2:"IJ";s:2:"ij";s:2:"ij";s:2:"Ŀ";s:3:"L·";s:2:"ŀ";s:3:"l·";s:2:"ʼn";s:3:"ʼn";s:2:"ſ";s:1:"s";s:2:"DŽ";s:3:"DŽ";s:2:"Dž";s:3:"Dž";s:2:"dž";s:3:"dž";s:2:"LJ";s:2:"LJ";s:2:"Lj";s:2:"Lj";s:2:"lj";s:2:"lj";s:2:"NJ";s:2:"NJ";s:2:"Nj";s:2:"Nj";s:2:"nj";s:2:"nj";s:2:"DZ";s:2:"DZ";s:2:"Dz";s:2:"Dz";s:2:"dz";s:2:"dz";s:2:"ϐ";s:2:"β";s:2:"ϑ";s:2:"θ";s:2:"ϒ";s:2:"Υ";s:2:"ϕ";s:2:"φ";s:2:"ϖ";s:2:"π";s:2:"ϰ";s:2:"κ";s:2:"ϱ";s:2:"ρ";s:2:"ϲ";s:2:"ς";s:2:"ϴ";s:2:"Θ";s:2:"ϵ";s:2:"ε";s:2:"Ϲ";s:2:"Σ";s:2:"և";s:4:"եւ";s:2:"ٵ";s:4:"اٴ";s:2:"ٶ";s:4:"وٴ";s:2:"ٷ";s:4:"ۇٴ";s:2:"ٸ";s:4:"يٴ";s:3:"ำ";s:6:"ํา";s:3:"ຳ";s:6:"ໍາ";s:3:"ໜ";s:6:"ຫນ";s:3:"ໝ";s:6:"ຫມ";s:3:"ཷ";s:6:"ྲཱྀ";s:3:"ཹ";s:6:"ླཱྀ";s:3:"ẚ";s:3:"aʾ";s:3:"․";s:1:".";s:3:"‥";s:2:"..";s:3:"…";s:3:"...";s:3:"″";s:6:"′′";s:3:"‴";s:9:"′′′";s:3:"‶";s:6:"‵‵";s:3:"‷";s:9:"‵‵‵";s:3:"‼";s:2:"!!";s:3:"⁇";s:2:"??";s:3:"⁈";s:2:"?!";s:3:"⁉";s:2:"!?";s:3:"⁗";s:12:"′′′′";s:3:"₨";s:2:"Rs";s:3:"℀";s:3:"a/c";s:3:"℁";s:3:"a/s";s:3:"ℂ";s:1:"C";s:3:"℃";s:3:"°C";s:3:"℅";s:3:"c/o";s:3:"℆";s:3:"c/u";s:3:"ℇ";s:2:"Ɛ";s:3:"℉";s:3:"°F";s:3:"ℊ";s:1:"g";s:3:"ℋ";s:1:"H";s:3:"ℌ";s:1:"H";s:3:"ℍ";s:1:"H";s:3:"ℎ";s:1:"h";s:3:"ℏ";s:2:"ħ";s:3:"ℐ";s:1:"I";s:3:"ℑ";s:1:"I";s:3:"ℒ";s:1:"L";s:3:"ℓ";s:1:"l";s:3:"ℕ";s:1:"N";s:3:"№";s:2:"No";s:3:"ℙ";s:1:"P";s:3:"ℚ";s:1:"Q";s:3:"ℛ";s:1:"R";s:3:"ℜ";s:1:"R";s:3:"ℝ";s:1:"R";s:3:"℡";s:3:"TEL";s:3:"ℤ";s:1:"Z";s:3:"ℨ";s:1:"Z";s:3:"ℬ";s:1:"B";s:3:"ℭ";s:1:"C";s:3:"ℯ";s:1:"e";s:3:"ℰ";s:1:"E";s:3:"ℱ";s:1:"F";s:3:"ℳ";s:1:"M";s:3:"ℴ";s:1:"o";s:3:"ℵ";s:2:"א";s:3:"ℶ";s:2:"ב";s:3:"ℷ";s:2:"ג";s:3:"ℸ";s:2:"ד";s:3:"ℹ";s:1:"i";s:3:"℻";s:3:"FAX";s:3:"ℼ";s:2:"π";s:3:"ℽ";s:2:"γ";s:3:"ℾ";s:2:"Γ";s:3:"ℿ";s:2:"Π";s:3:"⅀";s:3:"∑";s:3:"ⅅ";s:1:"D";s:3:"ⅆ";s:1:"d";s:3:"ⅇ";s:1:"e";s:3:"ⅈ";s:1:"i";s:3:"ⅉ";s:1:"j";s:3:"⅐";s:7:" 1⁄7 ";s:3:"⅑";s:7:" 1⁄9 ";s:3:"⅒";s:8:" 1⁄10 ";s:3:"⅓";s:7:" 1⁄3 ";s:3:"⅔";s:7:" 2⁄3 ";s:3:"⅕";s:7:" 1⁄5 ";s:3:"⅖";s:7:" 2⁄5 ";s:3:"⅗";s:7:" 3⁄5 ";s:3:"⅘";s:7:" 4⁄5 ";s:3:"⅙";s:7:" 1⁄6 ";s:3:"⅚";s:7:" 5⁄6 ";s:3:"⅛";s:7:" 1⁄8 ";s:3:"⅜";s:7:" 3⁄8 ";s:3:"⅝";s:7:" 5⁄8 ";s:3:"⅞";s:7:" 7⁄8 ";s:3:"⅟";s:6:" 1⁄ ";s:3:"Ⅰ";s:1:"I";s:3:"Ⅱ";s:2:"II";s:3:"Ⅲ";s:3:"III";s:3:"Ⅳ";s:2:"IV";s:3:"Ⅴ";s:1:"V";s:3:"Ⅵ";s:2:"VI";s:3:"Ⅶ";s:3:"VII";s:3:"Ⅷ";s:4:"VIII";s:3:"Ⅸ";s:2:"IX";s:3:"Ⅹ";s:1:"X";s:3:"Ⅺ";s:2:"XI";s:3:"Ⅻ";s:3:"XII";s:3:"Ⅼ";s:1:"L";s:3:"Ⅽ";s:1:"C";s:3:"Ⅾ";s:1:"D";s:3:"Ⅿ";s:1:"M";s:3:"ⅰ";s:1:"i";s:3:"ⅱ";s:2:"ii";s:3:"ⅲ";s:3:"iii";s:3:"ⅳ";s:2:"iv";s:3:"ⅴ";s:1:"v";s:3:"ⅵ";s:2:"vi";s:3:"ⅶ";s:3:"vii";s:3:"ⅷ";s:4:"viii";s:3:"ⅸ";s:2:"ix";s:3:"ⅹ";s:1:"x";s:3:"ⅺ";s:2:"xi";s:3:"ⅻ";s:3:"xii";s:3:"ⅼ";s:1:"l";s:3:"ⅽ";s:1:"c";s:3:"ⅾ";s:1:"d";s:3:"ⅿ";s:1:"m";s:3:"↉";s:7:" 0⁄3 ";s:3:"∬";s:6:"∫∫";s:3:"∭";s:9:"∫∫∫";s:3:"∯";s:6:"∮∮";s:3:"∰";s:9:"∮∮∮";s:3:"①";s:3:"(1)";s:3:"②";s:3:"(2)";s:3:"③";s:3:"(3)";s:3:"④";s:3:"(4)";s:3:"⑤";s:3:"(5)";s:3:"⑥";s:3:"(6)";s:3:"⑦";s:3:"(7)";s:3:"⑧";s:3:"(8)";s:3:"⑨";s:3:"(9)";s:3:"⑩";s:4:"(10)";s:3:"⑪";s:4:"(11)";s:3:"⑫";s:4:"(12)";s:3:"⑬";s:4:"(13)";s:3:"⑭";s:4:"(14)";s:3:"⑮";s:4:"(15)";s:3:"⑯";s:4:"(16)";s:3:"⑰";s:4:"(17)";s:3:"⑱";s:4:"(18)";s:3:"⑲";s:4:"(19)";s:3:"⑳";s:4:"(20)";s:3:"⑴";s:3:"(1)";s:3:"⑵";s:3:"(2)";s:3:"⑶";s:3:"(3)";s:3:"⑷";s:3:"(4)";s:3:"⑸";s:3:"(5)";s:3:"⑹";s:3:"(6)";s:3:"⑺";s:3:"(7)";s:3:"⑻";s:3:"(8)";s:3:"⑼";s:3:"(9)";s:3:"⑽";s:4:"(10)";s:3:"⑾";s:4:"(11)";s:3:"⑿";s:4:"(12)";s:3:"⒀";s:4:"(13)";s:3:"⒁";s:4:"(14)";s:3:"⒂";s:4:"(15)";s:3:"⒃";s:4:"(16)";s:3:"⒄";s:4:"(17)";s:3:"⒅";s:4:"(18)";s:3:"⒆";s:4:"(19)";s:3:"⒇";s:4:"(20)";s:3:"⒈";s:2:"1.";s:3:"⒉";s:2:"2.";s:3:"⒊";s:2:"3.";s:3:"⒋";s:2:"4.";s:3:"⒌";s:2:"5.";s:3:"⒍";s:2:"6.";s:3:"⒎";s:2:"7.";s:3:"⒏";s:2:"8.";s:3:"⒐";s:2:"9.";s:3:"⒑";s:3:"10.";s:3:"⒒";s:3:"11.";s:3:"⒓";s:3:"12.";s:3:"⒔";s:3:"13.";s:3:"⒕";s:3:"14.";s:3:"⒖";s:3:"15.";s:3:"⒗";s:3:"16.";s:3:"⒘";s:3:"17.";s:3:"⒙";s:3:"18.";s:3:"⒚";s:3:"19.";s:3:"⒛";s:3:"20.";s:3:"⒜";s:3:"(a)";s:3:"⒝";s:3:"(b)";s:3:"⒞";s:3:"(c)";s:3:"⒟";s:3:"(d)";s:3:"⒠";s:3:"(e)";s:3:"⒡";s:3:"(f)";s:3:"⒢";s:3:"(g)";s:3:"⒣";s:3:"(h)";s:3:"⒤";s:3:"(i)";s:3:"⒥";s:3:"(j)";s:3:"⒦";s:3:"(k)";s:3:"⒧";s:3:"(l)";s:3:"⒨";s:3:"(m)";s:3:"⒩";s:3:"(n)";s:3:"⒪";s:3:"(o)";s:3:"⒫";s:3:"(p)";s:3:"⒬";s:3:"(q)";s:3:"⒭";s:3:"(r)";s:3:"⒮";s:3:"(s)";s:3:"⒯";s:3:"(t)";s:3:"⒰";s:3:"(u)";s:3:"⒱";s:3:"(v)";s:3:"⒲";s:3:"(w)";s:3:"⒳";s:3:"(x)";s:3:"⒴";s:3:"(y)";s:3:"⒵";s:3:"(z)";s:3:"Ⓐ";s:3:"(A)";s:3:"Ⓑ";s:3:"(B)";s:3:"Ⓒ";s:3:"(C)";s:3:"Ⓓ";s:3:"(D)";s:3:"Ⓔ";s:3:"(E)";s:3:"Ⓕ";s:3:"(F)";s:3:"Ⓖ";s:3:"(G)";s:3:"Ⓗ";s:3:"(H)";s:3:"Ⓘ";s:3:"(I)";s:3:"Ⓙ";s:3:"(J)";s:3:"Ⓚ";s:3:"(K)";s:3:"Ⓛ";s:3:"(L)";s:3:"Ⓜ";s:3:"(M)";s:3:"Ⓝ";s:3:"(N)";s:3:"Ⓞ";s:3:"(O)";s:3:"Ⓟ";s:3:"(P)";s:3:"Ⓠ";s:3:"(Q)";s:3:"Ⓡ";s:3:"(R)";s:3:"Ⓢ";s:3:"(S)";s:3:"Ⓣ";s:3:"(T)";s:3:"Ⓤ";s:3:"(U)";s:3:"Ⓥ";s:3:"(V)";s:3:"Ⓦ";s:3:"(W)";s:3:"Ⓧ";s:3:"(X)";s:3:"Ⓨ";s:3:"(Y)";s:3:"Ⓩ";s:3:"(Z)";s:3:"ⓐ";s:3:"(a)";s:3:"ⓑ";s:3:"(b)";s:3:"ⓒ";s:3:"(c)";s:3:"ⓓ";s:3:"(d)";s:3:"ⓔ";s:3:"(e)";s:3:"ⓕ";s:3:"(f)";s:3:"ⓖ";s:3:"(g)";s:3:"ⓗ";s:3:"(h)";s:3:"ⓘ";s:3:"(i)";s:3:"ⓙ";s:3:"(j)";s:3:"ⓚ";s:3:"(k)";s:3:"ⓛ";s:3:"(l)";s:3:"ⓜ";s:3:"(m)";s:3:"ⓝ";s:3:"(n)";s:3:"ⓞ";s:3:"(o)";s:3:"ⓟ";s:3:"(p)";s:3:"ⓠ";s:3:"(q)";s:3:"ⓡ";s:3:"(r)";s:3:"ⓢ";s:3:"(s)";s:3:"ⓣ";s:3:"(t)";s:3:"ⓤ";s:3:"(u)";s:3:"ⓥ";s:3:"(v)";s:3:"ⓦ";s:3:"(w)";s:3:"ⓧ";s:3:"(x)";s:3:"ⓨ";s:3:"(y)";s:3:"ⓩ";s:3:"(z)";s:3:"⓪";s:3:"(0)";s:3:"⨌";s:12:"∫∫∫∫";s:3:"⩴";s:3:"::=";s:3:"⩵";s:2:"==";s:3:"⩶";s:3:"===";s:3:"⺟";s:3:"母";s:3:"⻳";s:3:"龟";s:3:"⼀";s:3:"一";s:3:"⼁";s:3:"丨";s:3:"⼂";s:3:"丶";s:3:"⼃";s:3:"丿";s:3:"⼄";s:3:"乙";s:3:"⼅";s:3:"亅";s:3:"⼆";s:3:"二";s:3:"⼇";s:3:"亠";s:3:"⼈";s:3:"人";s:3:"⼉";s:3:"儿";s:3:"⼊";s:3:"入";s:3:"⼋";s:3:"八";s:3:"⼌";s:3:"冂";s:3:"⼍";s:3:"冖";s:3:"⼎";s:3:"冫";s:3:"⼏";s:3:"几";s:3:"⼐";s:3:"凵";s:3:"⼑";s:3:"刀";s:3:"⼒";s:3:"力";s:3:"⼓";s:3:"勹";s:3:"⼔";s:3:"匕";s:3:"⼕";s:3:"匚";s:3:"⼖";s:3:"匸";s:3:"⼗";s:3:"十";s:3:"⼘";s:3:"卜";s:3:"⼙";s:3:"卩";s:3:"⼚";s:3:"厂";s:3:"⼛";s:3:"厶";s:3:"⼜";s:3:"又";s:3:"⼝";s:3:"口";s:3:"⼞";s:3:"囗";s:3:"⼟";s:3:"土";s:3:"⼠";s:3:"士";s:3:"⼡";s:3:"夂";s:3:"⼢";s:3:"夊";s:3:"⼣";s:3:"夕";s:3:"⼤";s:3:"大";s:3:"⼥";s:3:"女";s:3:"⼦";s:3:"子";s:3:"⼧";s:3:"宀";s:3:"⼨";s:3:"寸";s:3:"⼩";s:3:"小";s:3:"⼪";s:3:"尢";s:3:"⼫";s:3:"尸";s:3:"⼬";s:3:"屮";s:3:"⼭";s:3:"山";s:3:"⼮";s:3:"巛";s:3:"⼯";s:3:"工";s:3:"⼰";s:3:"己";s:3:"⼱";s:3:"巾";s:3:"⼲";s:3:"干";s:3:"⼳";s:3:"幺";s:3:"⼴";s:3:"广";s:3:"⼵";s:3:"廴";s:3:"⼶";s:3:"廾";s:3:"⼷";s:3:"弋";s:3:"⼸";s:3:"弓";s:3:"⼹";s:3:"彐";s:3:"⼺";s:3:"彡";s:3:"⼻";s:3:"彳";s:3:"⼼";s:3:"心";s:3:"⼽";s:3:"戈";s:3:"⼾";s:3:"戶";s:3:"⼿";s:3:"手";s:3:"⽀";s:3:"支";s:3:"⽁";s:3:"攴";s:3:"⽂";s:3:"文";s:3:"⽃";s:3:"斗";s:3:"⽄";s:3:"斤";s:3:"⽅";s:3:"方";s:3:"⽆";s:3:"无";s:3:"⽇";s:3:"日";s:3:"⽈";s:3:"曰";s:3:"⽉";s:3:"月";s:3:"⽊";s:3:"木";s:3:"⽋";s:3:"欠";s:3:"⽌";s:3:"止";s:3:"⽍";s:3:"歹";s:3:"⽎";s:3:"殳";s:3:"⽏";s:3:"毋";s:3:"⽐";s:3:"比";s:3:"⽑";s:3:"毛";s:3:"⽒";s:3:"氏";s:3:"⽓";s:3:"气";s:3:"⽔";s:3:"水";s:3:"⽕";s:3:"火";s:3:"⽖";s:3:"爪";s:3:"⽗";s:3:"父";s:3:"⽘";s:3:"爻";s:3:"⽙";s:3:"爿";s:3:"⽚";s:3:"片";s:3:"⽛";s:3:"牙";s:3:"⽜";s:3:"牛";s:3:"⽝";s:3:"犬";s:3:"⽞";s:3:"玄";s:3:"⽟";s:3:"玉";s:3:"⽠";s:3:"瓜";s:3:"⽡";s:3:"瓦";s:3:"⽢";s:3:"甘";s:3:"⽣";s:3:"生";s:3:"⽤";s:3:"用";s:3:"⽥";s:3:"田";s:3:"⽦";s:3:"疋";s:3:"⽧";s:3:"疒";s:3:"⽨";s:3:"癶";s:3:"⽩";s:3:"白";s:3:"⽪";s:3:"皮";s:3:"⽫";s:3:"皿";s:3:"⽬";s:3:"目";s:3:"⽭";s:3:"矛";s:3:"⽮";s:3:"矢";s:3:"⽯";s:3:"石";s:3:"⽰";s:3:"示";s:3:"⽱";s:3:"禸";s:3:"⽲";s:3:"禾";s:3:"⽳";s:3:"穴";s:3:"⽴";s:3:"立";s:3:"⽵";s:3:"竹";s:3:"⽶";s:3:"米";s:3:"⽷";s:3:"糸";s:3:"⽸";s:3:"缶";s:3:"⽹";s:3:"网";s:3:"⽺";s:3:"羊";s:3:"⽻";s:3:"羽";s:3:"⽼";s:3:"老";s:3:"⽽";s:3:"而";s:3:"⽾";s:3:"耒";s:3:"⽿";s:3:"耳";s:3:"⾀";s:3:"聿";s:3:"⾁";s:3:"肉";s:3:"⾂";s:3:"臣";s:3:"⾃";s:3:"自";s:3:"⾄";s:3:"至";s:3:"⾅";s:3:"臼";s:3:"⾆";s:3:"舌";s:3:"⾇";s:3:"舛";s:3:"⾈";s:3:"舟";s:3:"⾉";s:3:"艮";s:3:"⾊";s:3:"色";s:3:"⾋";s:3:"艸";s:3:"⾌";s:3:"虍";s:3:"⾍";s:3:"虫";s:3:"⾎";s:3:"血";s:3:"⾏";s:3:"行";s:3:"⾐";s:3:"衣";s:3:"⾑";s:3:"襾";s:3:"⾒";s:3:"見";s:3:"⾓";s:3:"角";s:3:"⾔";s:3:"言";s:3:"⾕";s:3:"谷";s:3:"⾖";s:3:"豆";s:3:"⾗";s:3:"豕";s:3:"⾘";s:3:"豸";s:3:"⾙";s:3:"貝";s:3:"⾚";s:3:"赤";s:3:"⾛";s:3:"走";s:3:"⾜";s:3:"足";s:3:"⾝";s:3:"身";s:3:"⾞";s:3:"車";s:3:"⾟";s:3:"辛";s:3:"⾠";s:3:"辰";s:3:"⾡";s:3:"辵";s:3:"⾢";s:3:"邑";s:3:"⾣";s:3:"酉";s:3:"⾤";s:3:"釆";s:3:"⾥";s:3:"里";s:3:"⾦";s:3:"金";s:3:"⾧";s:3:"長";s:3:"⾨";s:3:"門";s:3:"⾩";s:3:"阜";s:3:"⾪";s:3:"隶";s:3:"⾫";s:3:"隹";s:3:"⾬";s:3:"雨";s:3:"⾭";s:3:"靑";s:3:"⾮";s:3:"非";s:3:"⾯";s:3:"面";s:3:"⾰";s:3:"革";s:3:"⾱";s:3:"韋";s:3:"⾲";s:3:"韭";s:3:"⾳";s:3:"音";s:3:"⾴";s:3:"頁";s:3:"⾵";s:3:"風";s:3:"⾶";s:3:"飛";s:3:"⾷";s:3:"食";s:3:"⾸";s:3:"首";s:3:"⾹";s:3:"香";s:3:"⾺";s:3:"馬";s:3:"⾻";s:3:"骨";s:3:"⾼";s:3:"高";s:3:"⾽";s:3:"髟";s:3:"⾾";s:3:"鬥";s:3:"⾿";s:3:"鬯";s:3:"⿀";s:3:"鬲";s:3:"⿁";s:3:"鬼";s:3:"⿂";s:3:"魚";s:3:"⿃";s:3:"鳥";s:3:"⿄";s:3:"鹵";s:3:"⿅";s:3:"鹿";s:3:"⿆";s:3:"麥";s:3:"⿇";s:3:"麻";s:3:"⿈";s:3:"黃";s:3:"⿉";s:3:"黍";s:3:"⿊";s:3:"黑";s:3:"⿋";s:3:"黹";s:3:"⿌";s:3:"黽";s:3:"⿍";s:3:"鼎";s:3:"⿎";s:3:"鼓";s:3:"⿏";s:3:"鼠";s:3:"⿐";s:3:"鼻";s:3:"⿑";s:3:"齊";s:3:"⿒";s:3:"齒";s:3:"⿓";s:3:"龍";s:3:"⿔";s:3:"龜";s:3:"⿕";s:3:"龠";s:3:" ";s:1:" ";s:3:"〶";s:3:"〒";s:3:"〸";s:3:"十";s:3:"〹";s:3:"卄";s:3:"〺";s:3:"卅";s:3:"ㄱ";s:3:"ᄀ";s:3:"ㄲ";s:3:"ᄁ";s:3:"ㄳ";s:3:"ᆪ";s:3:"ㄴ";s:3:"ᄂ";s:3:"ㄵ";s:3:"ᆬ";s:3:"ㄶ";s:3:"ᆭ";s:3:"ㄷ";s:3:"ᄃ";s:3:"ㄸ";s:3:"ᄄ";s:3:"ㄹ";s:3:"ᄅ";s:3:"ㄺ";s:3:"ᆰ";s:3:"ㄻ";s:3:"ᆱ";s:3:"ㄼ";s:3:"ᆲ";s:3:"ㄽ";s:3:"ᆳ";s:3:"ㄾ";s:3:"ᆴ";s:3:"ㄿ";s:3:"ᆵ";s:3:"ㅀ";s:3:"ᄚ";s:3:"ㅁ";s:3:"ᄆ";s:3:"ㅂ";s:3:"ᄇ";s:3:"ㅃ";s:3:"ᄈ";s:3:"ㅄ";s:3:"ᄡ";s:3:"ㅅ";s:3:"ᄉ";s:3:"ㅆ";s:3:"ᄊ";s:3:"ㅇ";s:3:"ᄋ";s:3:"ㅈ";s:3:"ᄌ";s:3:"ㅉ";s:3:"ᄍ";s:3:"ㅊ";s:3:"ᄎ";s:3:"ㅋ";s:3:"ᄏ";s:3:"ㅌ";s:3:"ᄐ";s:3:"ㅍ";s:3:"ᄑ";s:3:"ㅎ";s:3:"ᄒ";s:3:"ㅏ";s:3:"ᅡ";s:3:"ㅐ";s:3:"ᅢ";s:3:"ㅑ";s:3:"ᅣ";s:3:"ㅒ";s:3:"ᅤ";s:3:"ㅓ";s:3:"ᅥ";s:3:"ㅔ";s:3:"ᅦ";s:3:"ㅕ";s:3:"ᅧ";s:3:"ㅖ";s:3:"ᅨ";s:3:"ㅗ";s:3:"ᅩ";s:3:"ㅘ";s:3:"ᅪ";s:3:"ㅙ";s:3:"ᅫ";s:3:"ㅚ";s:3:"ᅬ";s:3:"ㅛ";s:3:"ᅭ";s:3:"ㅜ";s:3:"ᅮ";s:3:"ㅝ";s:3:"ᅯ";s:3:"ㅞ";s:3:"ᅰ";s:3:"ㅟ";s:3:"ᅱ";s:3:"ㅠ";s:3:"ᅲ";s:3:"ㅡ";s:3:"ᅳ";s:3:"ㅢ";s:3:"ᅴ";s:3:"ㅣ";s:3:"ᅵ";s:3:"ㅤ";s:3:"ᅠ";s:3:"ㅥ";s:3:"ᄔ";s:3:"ㅦ";s:3:"ᄕ";s:3:"ㅧ";s:3:"ᇇ";s:3:"ㅨ";s:3:"ᇈ";s:3:"ㅩ";s:3:"ᇌ";s:3:"ㅪ";s:3:"ᇎ";s:3:"ㅫ";s:3:"ᇓ";s:3:"ㅬ";s:3:"ᇗ";s:3:"ㅭ";s:3:"ᇙ";s:3:"ㅮ";s:3:"ᄜ";s:3:"ㅯ";s:3:"ᇝ";s:3:"ㅰ";s:3:"ᇟ";s:3:"ㅱ";s:3:"ᄝ";s:3:"ㅲ";s:3:"ᄞ";s:3:"ㅳ";s:3:"ᄠ";s:3:"ㅴ";s:3:"ᄢ";s:3:"ㅵ";s:3:"ᄣ";s:3:"ㅶ";s:3:"ᄧ";s:3:"ㅷ";s:3:"ᄩ";s:3:"ㅸ";s:3:"ᄫ";s:3:"ㅹ";s:3:"ᄬ";s:3:"ㅺ";s:3:"ᄭ";s:3:"ㅻ";s:3:"ᄮ";s:3:"ㅼ";s:3:"ᄯ";s:3:"ㅽ";s:3:"ᄲ";s:3:"ㅾ";s:3:"ᄶ";s:3:"ㅿ";s:3:"ᅀ";s:3:"ㆀ";s:3:"ᅇ";s:3:"ㆁ";s:3:"ᅌ";s:3:"ㆂ";s:3:"ᇱ";s:3:"ㆃ";s:3:"ᇲ";s:3:"ㆄ";s:3:"ᅗ";s:3:"ㆅ";s:3:"ᅘ";s:3:"ㆆ";s:3:"ᅙ";s:3:"ㆇ";s:3:"ᆄ";s:3:"ㆈ";s:3:"ᆅ";s:3:"ㆉ";s:3:"ᆈ";s:3:"ㆊ";s:3:"ᆑ";s:3:"ㆋ";s:3:"ᆒ";s:3:"ㆌ";s:3:"ᆔ";s:3:"ㆍ";s:3:"ᆞ";s:3:"ㆎ";s:3:"ᆡ";s:3:"㈀";s:5:"(ᄀ)";s:3:"㈁";s:5:"(ᄂ)";s:3:"㈂";s:5:"(ᄃ)";s:3:"㈃";s:5:"(ᄅ)";s:3:"㈄";s:5:"(ᄆ)";s:3:"㈅";s:5:"(ᄇ)";s:3:"㈆";s:5:"(ᄉ)";s:3:"㈇";s:5:"(ᄋ)";s:3:"㈈";s:5:"(ᄌ)";s:3:"㈉";s:5:"(ᄎ)";s:3:"㈊";s:5:"(ᄏ)";s:3:"㈋";s:5:"(ᄐ)";s:3:"㈌";s:5:"(ᄑ)";s:3:"㈍";s:5:"(ᄒ)";s:3:"㈎";s:8:"(가)";s:3:"㈏";s:8:"(나)";s:3:"㈐";s:8:"(다)";s:3:"㈑";s:8:"(라)";s:3:"㈒";s:8:"(마)";s:3:"㈓";s:8:"(바)";s:3:"㈔";s:8:"(사)";s:3:"㈕";s:8:"(아)";s:3:"㈖";s:8:"(자)";s:3:"㈗";s:8:"(차)";s:3:"㈘";s:8:"(카)";s:3:"㈙";s:8:"(타)";s:3:"㈚";s:8:"(파)";s:3:"㈛";s:8:"(하)";s:3:"㈜";s:8:"(주)";s:3:"㈝";s:17:"(오전)";s:3:"㈞";s:14:"(오후)";s:3:"㈠";s:5:"(一)";s:3:"㈡";s:5:"(二)";s:3:"㈢";s:5:"(三)";s:3:"㈣";s:5:"(四)";s:3:"㈤";s:5:"(五)";s:3:"㈥";s:5:"(六)";s:3:"㈦";s:5:"(七)";s:3:"㈧";s:5:"(八)";s:3:"㈨";s:5:"(九)";s:3:"㈩";s:5:"(十)";s:3:"㈪";s:5:"(月)";s:3:"㈫";s:5:"(火)";s:3:"㈬";s:5:"(水)";s:3:"㈭";s:5:"(木)";s:3:"㈮";s:5:"(金)";s:3:"㈯";s:5:"(土)";s:3:"㈰";s:5:"(日)";s:3:"㈱";s:5:"(株)";s:3:"㈲";s:5:"(有)";s:3:"㈳";s:5:"(社)";s:3:"㈴";s:5:"(名)";s:3:"㈵";s:5:"(特)";s:3:"㈶";s:5:"(財)";s:3:"㈷";s:5:"(祝)";s:3:"㈸";s:5:"(労)";s:3:"㈹";s:5:"(代)";s:3:"㈺";s:5:"(呼)";s:3:"㈻";s:5:"(学)";s:3:"㈼";s:5:"(監)";s:3:"㈽";s:5:"(企)";s:3:"㈾";s:5:"(資)";s:3:"㈿";s:5:"(協)";s:3:"㉀";s:5:"(祭)";s:3:"㉁";s:5:"(休)";s:3:"㉂";s:5:"(自)";s:3:"㉃";s:5:"(至)";s:3:"㉄";s:5:"(問)";s:3:"㉅";s:5:"(幼)";s:3:"㉆";s:5:"(文)";s:3:"㉇";s:5:"(箏)";s:3:"㉐";s:3:"PTE";s:3:"㉑";s:4:"(21)";s:3:"㉒";s:4:"(22)";s:3:"㉓";s:4:"(23)";s:3:"㉔";s:4:"(24)";s:3:"㉕";s:4:"(25)";s:3:"㉖";s:4:"(26)";s:3:"㉗";s:4:"(27)";s:3:"㉘";s:4:"(28)";s:3:"㉙";s:4:"(29)";s:3:"㉚";s:4:"(30)";s:3:"㉛";s:4:"(31)";s:3:"㉜";s:4:"(32)";s:3:"㉝";s:4:"(33)";s:3:"㉞";s:4:"(34)";s:3:"㉟";s:4:"(35)";s:3:"㉠";s:5:"(ᄀ)";s:3:"㉡";s:5:"(ᄂ)";s:3:"㉢";s:5:"(ᄃ)";s:3:"㉣";s:5:"(ᄅ)";s:3:"㉤";s:5:"(ᄆ)";s:3:"㉥";s:5:"(ᄇ)";s:3:"㉦";s:5:"(ᄉ)";s:3:"㉧";s:5:"(ᄋ)";s:3:"㉨";s:5:"(ᄌ)";s:3:"㉩";s:5:"(ᄎ)";s:3:"㉪";s:5:"(ᄏ)";s:3:"㉫";s:5:"(ᄐ)";s:3:"㉬";s:5:"(ᄑ)";s:3:"㉭";s:5:"(ᄒ)";s:3:"㉮";s:8:"(가)";s:3:"㉯";s:8:"(나)";s:3:"㉰";s:8:"(다)";s:3:"㉱";s:8:"(라)";s:3:"㉲";s:8:"(마)";s:3:"㉳";s:8:"(바)";s:3:"㉴";s:8:"(사)";s:3:"㉵";s:8:"(아)";s:3:"㉶";s:8:"(자)";s:3:"㉷";s:8:"(차)";s:3:"㉸";s:8:"(카)";s:3:"㉹";s:8:"(타)";s:3:"㉺";s:8:"(파)";s:3:"㉻";s:8:"(하)";s:3:"㉼";s:17:"(참고)";s:3:"㉽";s:14:"(주의)";s:3:"㉾";s:8:"(우)";s:3:"㊀";s:5:"(一)";s:3:"㊁";s:5:"(二)";s:3:"㊂";s:5:"(三)";s:3:"㊃";s:5:"(四)";s:3:"㊄";s:5:"(五)";s:3:"㊅";s:5:"(六)";s:3:"㊆";s:5:"(七)";s:3:"㊇";s:5:"(八)";s:3:"㊈";s:5:"(九)";s:3:"㊉";s:5:"(十)";s:3:"㊊";s:5:"(月)";s:3:"㊋";s:5:"(火)";s:3:"㊌";s:5:"(水)";s:3:"㊍";s:5:"(木)";s:3:"㊎";s:5:"(金)";s:3:"㊏";s:5:"(土)";s:3:"㊐";s:5:"(日)";s:3:"㊑";s:5:"(株)";s:3:"㊒";s:5:"(有)";s:3:"㊓";s:5:"(社)";s:3:"㊔";s:5:"(名)";s:3:"㊕";s:5:"(特)";s:3:"㊖";s:5:"(財)";s:3:"㊗";s:5:"(祝)";s:3:"㊘";s:5:"(労)";s:3:"㊙";s:5:"(秘)";s:3:"㊚";s:5:"(男)";s:3:"㊛";s:5:"(女)";s:3:"㊜";s:5:"(適)";s:3:"㊝";s:5:"(優)";s:3:"㊞";s:5:"(印)";s:3:"㊟";s:5:"(注)";s:3:"㊠";s:5:"(項)";s:3:"㊡";s:5:"(休)";s:3:"㊢";s:5:"(写)";s:3:"㊣";s:5:"(正)";s:3:"㊤";s:5:"(上)";s:3:"㊥";s:5:"(中)";s:3:"㊦";s:5:"(下)";s:3:"㊧";s:5:"(左)";s:3:"㊨";s:5:"(右)";s:3:"㊩";s:5:"(医)";s:3:"㊪";s:5:"(宗)";s:3:"㊫";s:5:"(学)";s:3:"㊬";s:5:"(監)";s:3:"㊭";s:5:"(企)";s:3:"㊮";s:5:"(資)";s:3:"㊯";s:5:"(協)";s:3:"㊰";s:5:"(夜)";s:3:"㊱";s:4:"(36)";s:3:"㊲";s:4:"(37)";s:3:"㊳";s:4:"(38)";s:3:"㊴";s:4:"(39)";s:3:"㊵";s:4:"(40)";s:3:"㊶";s:4:"(41)";s:3:"㊷";s:4:"(42)";s:3:"㊸";s:4:"(43)";s:3:"㊹";s:4:"(44)";s:3:"㊺";s:4:"(45)";s:3:"㊻";s:4:"(46)";s:3:"㊼";s:4:"(47)";s:3:"㊽";s:4:"(48)";s:3:"㊾";s:4:"(49)";s:3:"㊿";s:4:"(50)";s:3:"㋀";s:4:"1月";s:3:"㋁";s:4:"2月";s:3:"㋂";s:4:"3月";s:3:"㋃";s:4:"4月";s:3:"㋄";s:4:"5月";s:3:"㋅";s:4:"6月";s:3:"㋆";s:4:"7月";s:3:"㋇";s:4:"8月";s:3:"㋈";s:4:"9月";s:3:"㋉";s:5:"10月";s:3:"㋊";s:5:"11月";s:3:"㋋";s:5:"12月";s:3:"㋌";s:2:"Hg";s:3:"㋍";s:3:"erg";s:3:"㋎";s:2:"eV";s:3:"㋏";s:3:"LTD";s:3:"㋐";s:5:"(ア)";s:3:"㋑";s:5:"(イ)";s:3:"㋒";s:5:"(ウ)";s:3:"㋓";s:5:"(エ)";s:3:"㋔";s:5:"(オ)";s:3:"㋕";s:5:"(カ)";s:3:"㋖";s:5:"(キ)";s:3:"㋗";s:5:"(ク)";s:3:"㋘";s:5:"(ケ)";s:3:"㋙";s:5:"(コ)";s:3:"㋚";s:5:"(サ)";s:3:"㋛";s:5:"(シ)";s:3:"㋜";s:5:"(ス)";s:3:"㋝";s:5:"(セ)";s:3:"㋞";s:5:"(ソ)";s:3:"㋟";s:5:"(タ)";s:3:"㋠";s:5:"(チ)";s:3:"㋡";s:5:"(ツ)";s:3:"㋢";s:5:"(テ)";s:3:"㋣";s:5:"(ト)";s:3:"㋤";s:5:"(ナ)";s:3:"㋥";s:5:"(ニ)";s:3:"㋦";s:5:"(ヌ)";s:3:"㋧";s:5:"(ネ)";s:3:"㋨";s:5:"(ノ)";s:3:"㋩";s:5:"(ハ)";s:3:"㋪";s:5:"(ヒ)";s:3:"㋫";s:5:"(フ)";s:3:"㋬";s:5:"(ヘ)";s:3:"㋭";s:5:"(ホ)";s:3:"㋮";s:5:"(マ)";s:3:"㋯";s:5:"(ミ)";s:3:"㋰";s:5:"(ム)";s:3:"㋱";s:5:"(メ)";s:3:"㋲";s:5:"(モ)";s:3:"㋳";s:5:"(ヤ)";s:3:"㋴";s:5:"(ユ)";s:3:"㋵";s:5:"(ヨ)";s:3:"㋶";s:5:"(ラ)";s:3:"㋷";s:5:"(リ)";s:3:"㋸";s:5:"(ル)";s:3:"㋹";s:5:"(レ)";s:3:"㋺";s:5:"(ロ)";s:3:"㋻";s:5:"(ワ)";s:3:"㋼";s:5:"(ヰ)";s:3:"㋽";s:5:"(ヱ)";s:3:"㋾";s:5:"(ヲ)";s:3:"㋿";s:6:"令和";s:3:"㌀";s:12:"アパート";s:3:"㌁";s:12:"アルファ";s:3:"㌂";s:12:"アンペア";s:3:"㌃";s:9:"アール";s:3:"㌄";s:12:"イニング";s:3:"㌅";s:9:"インチ";s:3:"㌆";s:9:"ウォン";s:3:"㌇";s:15:"エスクード";s:3:"㌈";s:12:"エーカー";s:3:"㌉";s:9:"オンス";s:3:"㌊";s:9:"オーム";s:3:"㌋";s:9:"カイリ";s:3:"㌌";s:12:"カラット";s:3:"㌍";s:12:"カロリー";s:3:"㌎";s:9:"ガロン";s:3:"㌏";s:9:"ガンマ";s:3:"㌐";s:6:"ギガ";s:3:"㌑";s:9:"ギニー";s:3:"㌒";s:12:"キュリー";s:3:"㌓";s:12:"ギルダー";s:3:"㌔";s:6:"キロ";s:3:"㌕";s:15:"キログラム";s:3:"㌖";s:18:"キロメートル";s:3:"㌗";s:15:"キロワット";s:3:"㌘";s:9:"グラム";s:3:"㌙";s:15:"グラムトン";s:3:"㌚";s:15:"クルゼイロ";s:3:"㌛";s:12:"クローネ";s:3:"㌜";s:9:"ケース";s:3:"㌝";s:9:"コルナ";s:3:"㌞";s:9:"コーポ";s:3:"㌟";s:12:"サイクル";s:3:"㌠";s:15:"サンチーム";s:3:"㌡";s:12:"シリング";s:3:"㌢";s:9:"センチ";s:3:"㌣";s:9:"セント";s:3:"㌤";s:9:"ダース";s:3:"㌥";s:6:"デシ";s:3:"㌦";s:6:"ドル";s:3:"㌧";s:6:"トン";s:3:"㌨";s:6:"ナノ";s:3:"㌩";s:9:"ノット";s:3:"㌪";s:9:"ハイツ";s:3:"㌫";s:15:"パーセント";s:3:"㌬";s:9:"パーツ";s:3:"㌭";s:12:"バーレル";s:3:"㌮";s:15:"ピアストル";s:3:"㌯";s:9:"ピクル";s:3:"㌰";s:6:"ピコ";s:3:"㌱";s:6:"ビル";s:3:"㌲";s:15:"ファラッド";s:3:"㌳";s:12:"フィート";s:3:"㌴";s:15:"ブッシェル";s:3:"㌵";s:9:"フラン";s:3:"㌶";s:15:"ヘクタール";s:3:"㌷";s:6:"ペソ";s:3:"㌸";s:9:"ペニヒ";s:3:"㌹";s:9:"ヘルツ";s:3:"㌺";s:9:"ペンス";s:3:"㌻";s:9:"ページ";s:3:"㌼";s:9:"ベータ";s:3:"㌽";s:12:"ポイント";s:3:"㌾";s:9:"ボルト";s:3:"㌿";s:6:"ホン";s:3:"㍀";s:9:"ポンド";s:3:"㍁";s:9:"ホール";s:3:"㍂";s:9:"ホーン";s:3:"㍃";s:12:"マイクロ";s:3:"㍄";s:9:"マイル";s:3:"㍅";s:9:"マッハ";s:3:"㍆";s:9:"マルク";s:3:"㍇";s:15:"マンション";s:3:"㍈";s:12:"ミクロン";s:3:"㍉";s:6:"ミリ";s:3:"㍊";s:15:"ミリバール";s:3:"㍋";s:6:"メガ";s:3:"㍌";s:12:"メガトン";s:3:"㍍";s:12:"メートル";s:3:"㍎";s:9:"ヤード";s:3:"㍏";s:9:"ヤール";s:3:"㍐";s:9:"ユアン";s:3:"㍑";s:12:"リットル";s:3:"㍒";s:6:"リラ";s:3:"㍓";s:9:"ルピー";s:3:"㍔";s:12:"ルーブル";s:3:"㍕";s:6:"レム";s:3:"㍖";s:15:"レントゲン";s:3:"㍗";s:9:"ワット";s:3:"㍘";s:4:"0点";s:3:"㍙";s:4:"1点";s:3:"㍚";s:4:"2点";s:3:"㍛";s:4:"3点";s:3:"㍜";s:4:"4点";s:3:"㍝";s:4:"5点";s:3:"㍞";s:4:"6点";s:3:"㍟";s:4:"7点";s:3:"㍠";s:4:"8点";s:3:"㍡";s:4:"9点";s:3:"㍢";s:5:"10点";s:3:"㍣";s:5:"11点";s:3:"㍤";s:5:"12点";s:3:"㍥";s:5:"13点";s:3:"㍦";s:5:"14点";s:3:"㍧";s:5:"15点";s:3:"㍨";s:5:"16点";s:3:"㍩";s:5:"17点";s:3:"㍪";s:5:"18点";s:3:"㍫";s:5:"19点";s:3:"㍬";s:5:"20点";s:3:"㍭";s:5:"21点";s:3:"㍮";s:5:"22点";s:3:"㍯";s:5:"23点";s:3:"㍰";s:5:"24点";s:3:"㍱";s:3:"hPa";s:3:"㍲";s:2:"da";s:3:"㍳";s:2:"AU";s:3:"㍴";s:3:"bar";s:3:"㍵";s:2:"oV";s:3:"㍶";s:2:"pc";s:3:"㍷";s:2:"dm";s:3:"㍸";s:4:"dm²";s:3:"㍹";s:4:"dm³";s:3:"㍺";s:2:"IU";s:3:"㍻";s:6:"平成";s:3:"㍼";s:6:"昭和";s:3:"㍽";s:6:"大正";s:3:"㍾";s:6:"明治";s:3:"㍿";s:12:"株式会社";s:3:"㎀";s:2:"pA";s:3:"㎁";s:2:"nA";s:3:"㎂";s:3:"μA";s:3:"㎃";s:2:"mA";s:3:"㎄";s:2:"kA";s:3:"㎅";s:2:"KB";s:3:"㎆";s:2:"MB";s:3:"㎇";s:2:"GB";s:3:"㎈";s:3:"cal";s:3:"㎉";s:4:"kcal";s:3:"㎊";s:2:"pF";s:3:"㎋";s:2:"nF";s:3:"㎌";s:3:"μF";s:3:"㎍";s:3:"μg";s:3:"㎎";s:2:"mg";s:3:"㎏";s:2:"kg";s:3:"㎐";s:2:"Hz";s:3:"㎑";s:3:"kHz";s:3:"㎒";s:3:"MHz";s:3:"㎓";s:3:"GHz";s:3:"㎔";s:3:"THz";s:3:"㎕";s:5:"μℓ";s:3:"㎖";s:4:"mℓ";s:3:"㎗";s:4:"dℓ";s:3:"㎘";s:4:"kℓ";s:3:"㎙";s:2:"fm";s:3:"㎚";s:2:"nm";s:3:"㎛";s:3:"μm";s:3:"㎜";s:2:"mm";s:3:"㎝";s:2:"cm";s:3:"㎞";s:2:"km";s:3:"㎟";s:4:"mm²";s:3:"㎠";s:4:"cm²";s:3:"㎡";s:3:"m²";s:3:"㎢";s:4:"km²";s:3:"㎣";s:4:"mm³";s:3:"㎤";s:4:"cm³";s:3:"㎥";s:3:"m³";s:3:"㎦";s:4:"km³";s:3:"㎧";s:5:"m∕s";s:3:"㎨";s:7:"m∕s²";s:3:"㎩";s:2:"Pa";s:3:"㎪";s:3:"kPa";s:3:"㎫";s:3:"MPa";s:3:"㎬";s:3:"GPa";s:3:"㎭";s:3:"rad";s:3:"㎮";s:7:"rad∕s";s:3:"㎯";s:9:"rad∕s²";s:3:"㎰";s:2:"ps";s:3:"㎱";s:2:"ns";s:3:"㎲";s:3:"μs";s:3:"㎳";s:2:"ms";s:3:"㎴";s:2:"pV";s:3:"㎵";s:2:"nV";s:3:"㎶";s:3:"μV";s:3:"㎷";s:2:"mV";s:3:"㎸";s:2:"kV";s:3:"㎹";s:2:"MV";s:3:"㎺";s:2:"pW";s:3:"㎻";s:2:"nW";s:3:"㎼";s:3:"μW";s:3:"㎽";s:2:"mW";s:3:"㎾";s:2:"kW";s:3:"㎿";s:2:"MW";s:3:"㏀";s:3:"kΩ";s:3:"㏁";s:3:"MΩ";s:3:"㏂";s:4:"a.m.";s:3:"㏃";s:2:"Bq";s:3:"㏄";s:2:"cc";s:3:"㏅";s:2:"cd";s:3:"㏆";s:6:"C∕kg";s:3:"㏇";s:3:"Co.";s:3:"㏈";s:2:"dB";s:3:"㏉";s:2:"Gy";s:3:"㏊";s:2:"ha";s:3:"㏋";s:2:"HP";s:3:"㏌";s:2:"in";s:3:"㏍";s:2:"KK";s:3:"㏎";s:2:"KM";s:3:"㏏";s:2:"kt";s:3:"㏐";s:2:"lm";s:3:"㏑";s:2:"ln";s:3:"㏒";s:3:"log";s:3:"㏓";s:2:"lx";s:3:"㏔";s:2:"mb";s:3:"㏕";s:3:"mil";s:3:"㏖";s:3:"mol";s:3:"㏗";s:2:"PH";s:3:"㏘";s:4:"p.m.";s:3:"㏙";s:3:"PPM";s:3:"㏚";s:2:"PR";s:3:"㏛";s:2:"sr";s:3:"㏜";s:2:"Sv";s:3:"㏝";s:2:"Wb";s:3:"㏞";s:5:"V∕m";s:3:"㏟";s:5:"A∕m";s:3:"㏠";s:4:"1日";s:3:"㏡";s:4:"2日";s:3:"㏢";s:4:"3日";s:3:"㏣";s:4:"4日";s:3:"㏤";s:4:"5日";s:3:"㏥";s:4:"6日";s:3:"㏦";s:4:"7日";s:3:"㏧";s:4:"8日";s:3:"㏨";s:4:"9日";s:3:"㏩";s:5:"10日";s:3:"㏪";s:5:"11日";s:3:"㏫";s:5:"12日";s:3:"㏬";s:5:"13日";s:3:"㏭";s:5:"14日";s:3:"㏮";s:5:"15日";s:3:"㏯";s:5:"16日";s:3:"㏰";s:5:"17日";s:3:"㏱";s:5:"18日";s:3:"㏲";s:5:"19日";s:3:"㏳";s:5:"20日";s:3:"㏴";s:5:"21日";s:3:"㏵";s:5:"22日";s:3:"㏶";s:5:"23日";s:3:"㏷";s:5:"24日";s:3:"㏸";s:5:"25日";s:3:"㏹";s:5:"26日";s:3:"㏺";s:5:"27日";s:3:"㏻";s:5:"28日";s:3:"㏼";s:5:"29日";s:3:"㏽";s:5:"30日";s:3:"㏾";s:5:"31日";s:3:"㏿";s:3:"gal";s:3:"豈";s:3:"豈";s:3:"更";s:3:"更";s:3:"車";s:3:"車";s:3:"賈";s:3:"賈";s:3:"滑";s:3:"滑";s:3:"串";s:3:"串";s:3:"句";s:3:"句";s:3:"龜";s:3:"龜";s:3:"龜";s:3:"龜";s:3:"契";s:3:"契";s:3:"金";s:3:"金";s:3:"喇";s:3:"喇";s:3:"奈";s:3:"奈";s:3:"懶";s:3:"懶";s:3:"癩";s:3:"癩";s:3:"羅";s:3:"羅";s:3:"蘿";s:3:"蘿";s:3:"螺";s:3:"螺";s:3:"裸";s:3:"裸";s:3:"邏";s:3:"邏";s:3:"樂";s:3:"樂";s:3:"洛";s:3:"洛";s:3:"烙";s:3:"烙";s:3:"珞";s:3:"珞";s:3:"落";s:3:"落";s:3:"酪";s:3:"酪";s:3:"駱";s:3:"駱";s:3:"亂";s:3:"亂";s:3:"卵";s:3:"卵";s:3:"欄";s:3:"欄";s:3:"爛";s:3:"爛";s:3:"蘭";s:3:"蘭";s:3:"鸞";s:3:"鸞";s:3:"嵐";s:3:"嵐";s:3:"濫";s:3:"濫";s:3:"藍";s:3:"藍";s:3:"襤";s:3:"襤";s:3:"拉";s:3:"拉";s:3:"臘";s:3:"臘";s:3:"蠟";s:3:"蠟";s:3:"廊";s:3:"廊";s:3:"朗";s:3:"朗";s:3:"浪";s:3:"浪";s:3:"狼";s:3:"狼";s:3:"郎";s:3:"郎";s:3:"來";s:3:"來";s:3:"冷";s:3:"冷";s:3:"勞";s:3:"勞";s:3:"擄";s:3:"擄";s:3:"櫓";s:3:"櫓";s:3:"爐";s:3:"爐";s:3:"盧";s:3:"盧";s:3:"老";s:3:"老";s:3:"蘆";s:3:"蘆";s:3:"虜";s:3:"虜";s:3:"路";s:3:"路";s:3:"露";s:3:"露";s:3:"魯";s:3:"魯";s:3:"鷺";s:3:"鷺";s:3:"碌";s:3:"碌";s:3:"祿";s:3:"祿";s:3:"綠";s:3:"綠";s:3:"菉";s:3:"菉";s:3:"錄";s:3:"錄";s:3:"鹿";s:3:"鹿";s:3:"論";s:3:"論";s:3:"壟";s:3:"壟";s:3:"弄";s:3:"弄";s:3:"籠";s:3:"籠";s:3:"聾";s:3:"聾";s:3:"牢";s:3:"牢";s:3:"磊";s:3:"磊";s:3:"賂";s:3:"賂";s:3:"雷";s:3:"雷";s:3:"壘";s:3:"壘";s:3:"屢";s:3:"屢";s:3:"樓";s:3:"樓";s:3:"淚";s:3:"淚";s:3:"漏";s:3:"漏";s:3:"累";s:3:"累";s:3:"縷";s:3:"縷";s:3:"陋";s:3:"陋";s:3:"勒";s:3:"勒";s:3:"肋";s:3:"肋";s:3:"凜";s:3:"凜";s:3:"凌";s:3:"凌";s:3:"稜";s:3:"稜";s:3:"綾";s:3:"綾";s:3:"菱";s:3:"菱";s:3:"陵";s:3:"陵";s:3:"讀";s:3:"讀";s:3:"拏";s:3:"拏";s:3:"樂";s:3:"樂";s:3:"諾";s:3:"諾";s:3:"丹";s:3:"丹";s:3:"寧";s:3:"寧";s:3:"怒";s:3:"怒";s:3:"率";s:3:"率";s:3:"異";s:3:"異";s:3:"北";s:3:"北";s:3:"磻";s:3:"磻";s:3:"便";s:3:"便";s:3:"復";s:3:"復";s:3:"不";s:3:"不";s:3:"泌";s:3:"泌";s:3:"數";s:3:"數";s:3:"索";s:3:"索";s:3:"參";s:3:"參";s:3:"塞";s:3:"塞";s:3:"省";s:3:"省";s:3:"葉";s:3:"葉";s:3:"說";s:3:"說";s:3:"殺";s:3:"殺";s:3:"辰";s:3:"辰";s:3:"沈";s:3:"沈";s:3:"拾";s:3:"拾";s:3:"若";s:3:"若";s:3:"掠";s:3:"掠";s:3:"略";s:3:"略";s:3:"亮";s:3:"亮";s:3:"兩";s:3:"兩";s:3:"凉";s:3:"凉";s:3:"梁";s:3:"梁";s:3:"糧";s:3:"糧";s:3:"良";s:3:"良";s:3:"諒";s:3:"諒";s:3:"量";s:3:"量";s:3:"勵";s:3:"勵";s:3:"呂";s:3:"呂";s:3:"女";s:3:"女";s:3:"廬";s:3:"廬";s:3:"旅";s:3:"旅";s:3:"濾";s:3:"濾";s:3:"礪";s:3:"礪";s:3:"閭";s:3:"閭";s:3:"驪";s:3:"驪";s:3:"麗";s:3:"麗";s:3:"黎";s:3:"黎";s:3:"力";s:3:"力";s:3:"曆";s:3:"曆";s:3:"歷";s:3:"歷";s:3:"轢";s:3:"轢";s:3:"年";s:3:"年";s:3:"憐";s:3:"憐";s:3:"戀";s:3:"戀";s:3:"撚";s:3:"撚";s:3:"漣";s:3:"漣";s:3:"煉";s:3:"煉";s:3:"璉";s:3:"璉";s:3:"秊";s:3:"秊";s:3:"練";s:3:"練";s:3:"聯";s:3:"聯";s:3:"輦";s:3:"輦";s:3:"蓮";s:3:"蓮";s:3:"連";s:3:"連";s:3:"鍊";s:3:"鍊";s:3:"列";s:3:"列";s:3:"劣";s:3:"劣";s:3:"咽";s:3:"咽";s:3:"烈";s:3:"烈";s:3:"裂";s:3:"裂";s:3:"說";s:3:"說";s:3:"廉";s:3:"廉";s:3:"念";s:3:"念";s:3:"捻";s:3:"捻";s:3:"殮";s:3:"殮";s:3:"簾";s:3:"簾";s:3:"獵";s:3:"獵";s:3:"令";s:3:"令";s:3:"囹";s:3:"囹";s:3:"寧";s:3:"寧";s:3:"嶺";s:3:"嶺";s:3:"怜";s:3:"怜";s:3:"玲";s:3:"玲";s:3:"瑩";s:3:"瑩";s:3:"羚";s:3:"羚";s:3:"聆";s:3:"聆";s:3:"鈴";s:3:"鈴";s:3:"零";s:3:"零";s:3:"靈";s:3:"靈";s:3:"領";s:3:"領";s:3:"例";s:3:"例";s:3:"禮";s:3:"禮";s:3:"醴";s:3:"醴";s:3:"隸";s:3:"隸";s:3:"惡";s:3:"惡";s:3:"了";s:3:"了";s:3:"僚";s:3:"僚";s:3:"寮";s:3:"寮";s:3:"尿";s:3:"尿";s:3:"料";s:3:"料";s:3:"樂";s:3:"樂";s:3:"燎";s:3:"燎";s:3:"療";s:3:"療";s:3:"蓼";s:3:"蓼";s:3:"遼";s:3:"遼";s:3:"龍";s:3:"龍";s:3:"暈";s:3:"暈";s:3:"阮";s:3:"阮";s:3:"劉";s:3:"劉";s:3:"杻";s:3:"杻";s:3:"柳";s:3:"柳";s:3:"流";s:3:"流";s:3:"溜";s:3:"溜";s:3:"琉";s:3:"琉";s:3:"留";s:3:"留";s:3:"硫";s:3:"硫";s:3:"紐";s:3:"紐";s:3:"類";s:3:"類";s:3:"六";s:3:"六";s:3:"戮";s:3:"戮";s:3:"陸";s:3:"陸";s:3:"倫";s:3:"倫";s:3:"崙";s:3:"崙";s:3:"淪";s:3:"淪";s:3:"輪";s:3:"輪";s:3:"律";s:3:"律";s:3:"慄";s:3:"慄";s:3:"栗";s:3:"栗";s:3:"率";s:3:"率";s:3:"隆";s:3:"隆";s:3:"利";s:3:"利";s:3:"吏";s:3:"吏";s:3:"履";s:3:"履";s:3:"易";s:3:"易";s:3:"李";s:3:"李";s:3:"梨";s:3:"梨";s:3:"泥";s:3:"泥";s:3:"理";s:3:"理";s:3:"痢";s:3:"痢";s:3:"罹";s:3:"罹";s:3:"裏";s:3:"裏";s:3:"裡";s:3:"裡";s:3:"里";s:3:"里";s:3:"離";s:3:"離";s:3:"匿";s:3:"匿";s:3:"溺";s:3:"溺";s:3:"吝";s:3:"吝";s:3:"燐";s:3:"燐";s:3:"璘";s:3:"璘";s:3:"藺";s:3:"藺";s:3:"隣";s:3:"隣";s:3:"鱗";s:3:"鱗";s:3:"麟";s:3:"麟";s:3:"林";s:3:"林";s:3:"淋";s:3:"淋";s:3:"臨";s:3:"臨";s:3:"立";s:3:"立";s:3:"笠";s:3:"笠";s:3:"粒";s:3:"粒";s:3:"狀";s:3:"狀";s:3:"炙";s:3:"炙";s:3:"識";s:3:"識";s:3:"什";s:3:"什";s:3:"茶";s:3:"茶";s:3:"刺";s:3:"刺";s:3:"切";s:3:"切";s:3:"度";s:3:"度";s:3:"拓";s:3:"拓";s:3:"糖";s:3:"糖";s:3:"宅";s:3:"宅";s:3:"洞";s:3:"洞";s:3:"暴";s:3:"暴";s:3:"輻";s:3:"輻";s:3:"行";s:3:"行";s:3:"降";s:3:"降";s:3:"見";s:3:"見";s:3:"廓";s:3:"廓";s:3:"兀";s:3:"兀";s:3:"嗀";s:3:"嗀";s:3:"﨎";s:1:"";s:3:"﨏";s:1:"";s:3:"塚";s:3:"塚";s:3:"﨑";s:1:"";s:3:"晴";s:3:"晴";s:3:"﨓";s:1:"";s:3:"﨔";s:1:"";s:3:"凞";s:3:"凞";s:3:"猪";s:3:"猪";s:3:"益";s:3:"益";s:3:"礼";s:3:"礼";s:3:"神";s:3:"神";s:3:"祥";s:3:"祥";s:3:"福";s:3:"福";s:3:"靖";s:3:"靖";s:3:"精";s:3:"精";s:3:"羽";s:3:"羽";s:3:"﨟";s:1:"";s:3:"蘒";s:3:"蘒";s:3:"﨡";s:1:"";s:3:"諸";s:3:"諸";s:3:"﨣";s:1:"";s:3:"﨤";s:1:"";s:3:"逸";s:3:"逸";s:3:"都";s:3:"都";s:3:"﨧";s:1:"";s:3:"﨨";s:1:"";s:3:"﨩";s:1:"";s:3:"飯";s:3:"飯";s:3:"飼";s:3:"飼";s:3:"館";s:3:"館";s:3:"鶴";s:3:"鶴";s:3:"郞";s:3:"郞";s:3:"隷";s:3:"隷";s:3:"侮";s:3:"侮";s:3:"僧";s:3:"僧";s:3:"免";s:3:"免";s:3:"勉";s:3:"勉";s:3:"勤";s:3:"勤";s:3:"卑";s:3:"卑";s:3:"喝";s:3:"喝";s:3:"嘆";s:3:"嘆";s:3:"器";s:3:"器";s:3:"塀";s:3:"塀";s:3:"墨";s:3:"墨";s:3:"層";s:3:"層";s:3:"屮";s:3:"屮";s:3:"悔";s:3:"悔";s:3:"慨";s:3:"慨";s:3:"憎";s:3:"憎";s:3:"懲";s:3:"懲";s:3:"敏";s:3:"敏";s:3:"既";s:3:"既";s:3:"暑";s:3:"暑";s:3:"梅";s:3:"梅";s:3:"海";s:3:"海";s:3:"渚";s:3:"渚";s:3:"漢";s:3:"漢";s:3:"煮";s:3:"煮";s:3:"爫";s:3:"爫";s:3:"琢";s:3:"琢";s:3:"碑";s:3:"碑";s:3:"社";s:3:"社";s:3:"祉";s:3:"祉";s:3:"祈";s:3:"祈";s:3:"祐";s:3:"祐";s:3:"祖";s:3:"祖";s:3:"祝";s:3:"祝";s:3:"禍";s:3:"禍";s:3:"禎";s:3:"禎";s:3:"穀";s:3:"穀";s:3:"突";s:3:"突";s:3:"節";s:3:"節";s:3:"練";s:3:"練";s:3:"縉";s:3:"縉";s:3:"繁";s:3:"繁";s:3:"署";s:3:"署";s:3:"者";s:3:"者";s:3:"臭";s:3:"臭";s:3:"艹";s:3:"艹";s:3:"艹";s:3:"艹";s:3:"著";s:3:"著";s:3:"褐";s:3:"褐";s:3:"視";s:3:"視";s:3:"謁";s:3:"謁";s:3:"謹";s:3:"謹";s:3:"賓";s:3:"賓";s:3:"贈";s:3:"贈";s:3:"辶";s:3:"辶";s:3:"逸";s:3:"逸";s:3:"難";s:3:"難";s:3:"響";s:3:"響";s:3:"頻";s:3:"頻";s:3:"恵";s:3:"恵";s:3:"𤋮";s:4:"𤋮";s:3:"舘";s:3:"舘";s:3:"並";s:3:"並";s:3:"况";s:3:"况";s:3:"全";s:3:"全";s:3:"侀";s:3:"侀";s:3:"充";s:3:"充";s:3:"冀";s:3:"冀";s:3:"勇";s:3:"勇";s:3:"勺";s:3:"勺";s:3:"喝";s:3:"喝";s:3:"啕";s:3:"啕";s:3:"喙";s:3:"喙";s:3:"嗢";s:3:"嗢";s:3:"塚";s:3:"塚";s:3:"墳";s:3:"墳";s:3:"奄";s:3:"奄";s:3:"奔";s:3:"奔";s:3:"婢";s:3:"婢";s:3:"嬨";s:3:"嬨";s:3:"廒";s:3:"廒";s:3:"廙";s:3:"廙";s:3:"彩";s:3:"彩";s:3:"徭";s:3:"徭";s:3:"惘";s:3:"惘";s:3:"慎";s:3:"慎";s:3:"愈";s:3:"愈";s:3:"憎";s:3:"憎";s:3:"慠";s:3:"慠";s:3:"懲";s:3:"懲";s:3:"戴";s:3:"戴";s:3:"揄";s:3:"揄";s:3:"搜";s:3:"搜";s:3:"摒";s:3:"摒";s:3:"敖";s:3:"敖";s:3:"晴";s:3:"晴";s:3:"朗";s:3:"朗";s:3:"望";s:3:"望";s:3:"杖";s:3:"杖";s:3:"歹";s:3:"歹";s:3:"殺";s:3:"殺";s:3:"流";s:3:"流";s:3:"滛";s:3:"滛";s:3:"滋";s:3:"滋";s:3:"漢";s:3:"漢";s:3:"瀞";s:3:"瀞";s:3:"煮";s:3:"煮";s:3:"瞧";s:3:"瞧";s:3:"爵";s:3:"爵";s:3:"犯";s:3:"犯";s:3:"猪";s:3:"猪";s:3:"瑱";s:3:"瑱";s:3:"甆";s:3:"甆";s:3:"画";s:3:"画";s:3:"瘝";s:3:"瘝";s:3:"瘟";s:3:"瘟";s:3:"益";s:3:"益";s:3:"盛";s:3:"盛";s:3:"直";s:3:"直";s:3:"睊";s:3:"睊";s:3:"着";s:3:"着";s:3:"磌";s:3:"磌";s:3:"窱";s:3:"窱";s:3:"節";s:3:"節";s:3:"类";s:3:"类";s:3:"絛";s:3:"絛";s:3:"練";s:3:"練";s:3:"缾";s:3:"缾";s:3:"者";s:3:"者";s:3:"荒";s:3:"荒";s:3:"華";s:3:"華";s:3:"蝹";s:3:"蝹";s:3:"襁";s:3:"襁";s:3:"覆";s:3:"覆";s:3:"視";s:3:"視";s:3:"調";s:3:"調";s:3:"諸";s:3:"諸";s:3:"請";s:3:"請";s:3:"謁";s:3:"謁";s:3:"諾";s:3:"諾";s:3:"諭";s:3:"諭";s:3:"謹";s:3:"謹";s:3:"變";s:3:"變";s:3:"贈";s:3:"贈";s:3:"輸";s:3:"輸";s:3:"遲";s:3:"遲";s:3:"醙";s:3:"醙";s:3:"鉶";s:3:"鉶";s:3:"陼";s:3:"陼";s:3:"難";s:3:"難";s:3:"靖";s:3:"靖";s:3:"韛";s:3:"韛";s:3:"響";s:3:"響";s:3:"頋";s:3:"頋";s:3:"頻";s:3:"頻";s:3:"鬒";s:3:"鬒";s:3:"龜";s:3:"龜";s:3:"𢡊";s:4:"𢡊";s:3:"𢡄";s:4:"𢡄";s:3:"𣏕";s:4:"𣏕";s:3:"㮝";s:3:"㮝";s:3:"䀘";s:3:"䀘";s:3:"䀹";s:3:"䀹";s:3:"𥉉";s:4:"𥉉";s:3:"𥳐";s:4:"𥳐";s:3:"𧻓";s:4:"𧻓";s:3:"齃";s:3:"齃";s:3:"龎";s:3:"龎";s:3:"ff";s:2:"ff";s:3:"fi";s:2:"fi";s:3:"fl";s:2:"fl";s:3:"ffi";s:3:"ffi";s:3:"ffl";s:3:"ffl";s:3:"ſt";s:3:"ſt";s:3:"st";s:2:"st";s:3:"ﬓ";s:4:"մն";s:3:"ﬔ";s:4:"մե";s:3:"ﬕ";s:4:"մի";s:3:"ﬖ";s:4:"վն";s:3:"ﬗ";s:4:"մխ";s:3:"ﬠ";s:2:"ע";s:3:"ﬡ";s:2:"א";s:3:"ﬢ";s:2:"ד";s:3:"ﬣ";s:2:"ה";s:3:"ﬤ";s:2:"כ";s:3:"ﬥ";s:2:"ל";s:3:"ﬦ";s:2:"ם";s:3:"ﬧ";s:2:"ר";s:3:"ﬨ";s:2:"ת";s:3:"﬩";s:1:"+";s:3:"ﭏ";s:4:"אל";s:3:"﹉";s:3:"‾";s:3:"﹊";s:3:"‾";s:3:"﹋";s:3:"‾";s:3:"﹌";s:3:"‾";s:3:"﹍";s:1:"_";s:3:"﹎";s:1:"_";s:3:"﹏";s:1:"_";s:3:"﹐";s:1:",";s:3:"﹑";s:3:"、";s:3:"﹒";s:1:".";s:3:"﹔";s:1:";";s:3:"﹕";s:1:":";s:3:"﹖";s:1:"?";s:3:"﹗";s:1:"!";s:3:"﹘";s:3:"—";s:3:"﹙";s:1:"(";s:3:"﹚";s:1:")";s:3:"﹛";s:1:"{";s:3:"﹜";s:1:"}";s:3:"﹝";s:3:"〔";s:3:"﹞";s:3:"〕";s:3:"﹟";s:1:"#";s:3:"﹠";s:1:"&";s:3:"﹡";s:1:"*";s:3:"﹢";s:1:"+";s:3:"﹣";s:1:"-";s:3:"﹤";s:1:"<";s:3:"﹥";s:1:">";s:3:"﹦";s:1:"=";s:3:"﹨";s:1:"\";s:3:"﹩";s:1:"$";s:3:"﹪";s:1:"%";s:3:"﹫";s:1:"@";s:3:"!";s:1:"!";s:3:""";s:1:""";s:3:"#";s:1:"#";s:3:"$";s:1:"$";s:3:"%";s:1:"%";s:3:"&";s:1:"&";s:3:"'";s:1:"'";s:3:"(";s:1:"(";s:3:")";s:1:")";s:3:"*";s:1:"*";s:3:"+";s:1:"+";s:3:",";s:1:",";s:3:"-";s:1:"-";s:3:".";s:1:".";s:3:"/";s:1:"/";s:3:"0";s:1:"0";s:3:"1";s:1:"1";s:3:"2";s:1:"2";s:3:"3";s:1:"3";s:3:"4";s:1:"4";s:3:"5";s:1:"5";s:3:"6";s:1:"6";s:3:"7";s:1:"7";s:3:"8";s:1:"8";s:3:"9";s:1:"9";s:3:":";s:1:":";s:3:";";s:1:";";s:3:"<";s:1:"<";s:3:"=";s:1:"=";s:3:">";s:1:">";s:3:"?";s:1:"?";s:3:"@";s:1:"@";s:3:"A";s:1:"A";s:3:"B";s:1:"B";s:3:"C";s:1:"C";s:3:"D";s:1:"D";s:3:"E";s:1:"E";s:3:"F";s:1:"F";s:3:"G";s:1:"G";s:3:"H";s:1:"H";s:3:"I";s:1:"I";s:3:"J";s:1:"J";s:3:"K";s:1:"K";s:3:"L";s:1:"L";s:3:"M";s:1:"M";s:3:"N";s:1:"N";s:3:"O";s:1:"O";s:3:"P";s:1:"P";s:3:"Q";s:1:"Q";s:3:"R";s:1:"R";s:3:"S";s:1:"S";s:3:"T";s:1:"T";s:3:"U";s:1:"U";s:3:"V";s:1:"V";s:3:"W";s:1:"W";s:3:"X";s:1:"X";s:3:"Y";s:1:"Y";s:3:"Z";s:1:"Z";s:3:"[";s:1:"[";s:3:"\";s:1:"\";s:3:"]";s:1:"]";s:3:"^";s:1:"^";s:3:"_";s:1:"_";s:3:"`";s:1:"`";s:3:"a";s:1:"a";s:3:"b";s:1:"b";s:3:"c";s:1:"c";s:3:"d";s:1:"d";s:3:"e";s:1:"e";s:3:"f";s:1:"f";s:3:"g";s:1:"g";s:3:"h";s:1:"h";s:3:"i";s:1:"i";s:3:"j";s:1:"j";s:3:"k";s:1:"k";s:3:"l";s:1:"l";s:3:"m";s:1:"m";s:3:"n";s:1:"n";s:3:"o";s:1:"o";s:3:"p";s:1:"p";s:3:"q";s:1:"q";s:3:"r";s:1:"r";s:3:"s";s:1:"s";s:3:"t";s:1:"t";s:3:"u";s:1:"u";s:3:"v";s:1:"v";s:3:"w";s:1:"w";s:3:"x";s:1:"x";s:3:"y";s:1:"y";s:3:"z";s:1:"z";s:3:"{";s:1:"{";s:3:"|";s:1:"|";s:3:"}";s:1:"}";s:3:"~";s:1:"~";s:3:"⦅";s:3:"⦅";s:3:"⦆";s:3:"⦆";s:3:"。";s:3:"。";s:3:"「";s:3:"「";s:3:"」";s:3:"」";s:3:"、";s:3:"、";s:3:"・";s:3:"・";s:3:"ヲ";s:3:"ヲ";s:3:"ァ";s:3:"ァ";s:3:"ィ";s:3:"ィ";s:3:"ゥ";s:3:"ゥ";s:3:"ェ";s:3:"ェ";s:3:"ォ";s:3:"ォ";s:3:"ャ";s:3:"ャ";s:3:"ュ";s:3:"ュ";s:3:"ョ";s:3:"ョ";s:3:"ッ";s:3:"ッ";s:3:"ー";s:3:"ー";s:3:"ア";s:3:"ア";s:3:"イ";s:3:"イ";s:3:"ウ";s:3:"ウ";s:3:"エ";s:3:"エ";s:3:"オ";s:3:"オ";s:3:"カ";s:3:"カ";s:3:"キ";s:3:"キ";s:3:"ク";s:3:"ク";s:3:"ケ";s:3:"ケ";s:3:"コ";s:3:"コ";s:3:"サ";s:3:"サ";s:3:"シ";s:3:"シ";s:3:"ス";s:3:"ス";s:3:"セ";s:3:"セ";s:3:"ソ";s:3:"ソ";s:3:"タ";s:3:"タ";s:3:"チ";s:3:"チ";s:3:"ツ";s:3:"ツ";s:3:"テ";s:3:"テ";s:3:"ト";s:3:"ト";s:3:"ナ";s:3:"ナ";s:3:"ニ";s:3:"ニ";s:3:"ヌ";s:3:"ヌ";s:3:"ネ";s:3:"ネ";s:3:"ノ";s:3:"ノ";s:3:"ハ";s:3:"ハ";s:3:"ヒ";s:3:"ヒ";s:3:"フ";s:3:"フ";s:3:"ヘ";s:3:"ヘ";s:3:"ホ";s:3:"ホ";s:3:"マ";s:3:"マ";s:3:"ミ";s:3:"ミ";s:3:"ム";s:3:"ム";s:3:"メ";s:3:"メ";s:3:"モ";s:3:"モ";s:3:"ヤ";s:3:"ヤ";s:3:"ユ";s:3:"ユ";s:3:"ヨ";s:3:"ヨ";s:3:"ラ";s:3:"ラ";s:3:"リ";s:3:"リ";s:3:"ル";s:3:"ル";s:3:"レ";s:3:"レ";s:3:"ロ";s:3:"ロ";s:3:"ワ";s:3:"ワ";s:3:"ン";s:3:"ン";s:3:"゙";s:3:"゙";s:3:"゚";s:3:"゚";s:3:"ᅠ";s:3:"ㅤ";s:3:"ᄀ";s:3:"ㄱ";s:3:"ᄁ";s:3:"ㄲ";s:3:"ᆪ";s:3:"ㄳ";s:3:"ᄂ";s:3:"ㄴ";s:3:"ᆬ";s:3:"ㄵ";s:3:"ᆭ";s:3:"ㄶ";s:3:"ᄃ";s:3:"ㄷ";s:3:"ᄄ";s:3:"ㄸ";s:3:"ᄅ";s:3:"ㄹ";s:3:"ᆰ";s:3:"ㄺ";s:3:"ᆱ";s:3:"ㄻ";s:3:"ᆲ";s:3:"ㄼ";s:3:"ᆳ";s:3:"ㄽ";s:3:"ᆴ";s:3:"ㄾ";s:3:"ᆵ";s:3:"ㄿ";s:3:"ᄚ";s:3:"ㅀ";s:3:"ᄆ";s:3:"ㅁ";s:3:"ᄇ";s:3:"ㅂ";s:3:"ᄈ";s:3:"ㅃ";s:3:"ᄡ";s:3:"ㅄ";s:3:"ᄉ";s:3:"ㅅ";s:3:"ᄊ";s:3:"ㅆ";s:3:"ᄋ";s:3:"ㅇ";s:3:"ᄌ";s:3:"ㅈ";s:3:"ᄍ";s:3:"ㅉ";s:3:"ᄎ";s:3:"ㅊ";s:3:"ᄏ";s:3:"ㅋ";s:3:"ᄐ";s:3:"ㅌ";s:3:"ᄑ";s:3:"ㅍ";s:3:"ᄒ";s:3:"ㅎ";s:3:"ᅡ";s:3:"ㅏ";s:3:"ᅢ";s:3:"ㅐ";s:3:"ᅣ";s:3:"ㅑ";s:3:"ᅤ";s:3:"ㅒ";s:3:"ᅥ";s:3:"ㅓ";s:3:"ᅦ";s:3:"ㅔ";s:3:"ᅧ";s:3:"ㅕ";s:3:"ᅨ";s:3:"ㅖ";s:3:"ᅩ";s:3:"ㅗ";s:3:"ᅪ";s:3:"ㅘ";s:3:"ᅫ";s:3:"ㅙ";s:3:"ᅬ";s:3:"ㅚ";s:3:"ᅭ";s:3:"ㅛ";s:3:"ᅮ";s:3:"ㅜ";s:3:"ᅯ";s:3:"ㅝ";s:3:"ᅰ";s:3:"ㅞ";s:3:"ᅱ";s:3:"ㅟ";s:3:"ᅲ";s:3:"ㅠ";s:3:"ᅳ";s:3:"ㅡ";s:3:"ᅴ";s:3:"ㅢ";s:3:"ᅵ";s:3:"ㅣ";s:3:"¢";s:2:"¢";s:3:"£";s:2:"£";s:3:"¬";s:2:"¬";s:3:" ̄";s:2:"¯";s:3:"¦";s:2:"¦";s:3:"¥";s:2:"¥";s:3:"₩";s:3:"₩";s:3:"│";s:3:"│";s:3:"←";s:3:"←";s:3:"↑";s:3:"↑";s:3:"→";s:3:"→";s:3:"↓";s:3:"↓";s:3:"■";s:3:"■";s:3:"○";s:3:"○";s:4:"𝐀";s:1:"A";s:4:"𝐁";s:1:"B";s:4:"𝐂";s:1:"C";s:4:"𝐃";s:1:"D";s:4:"𝐄";s:1:"E";s:4:"𝐅";s:1:"F";s:4:"𝐆";s:1:"G";s:4:"𝐇";s:1:"H";s:4:"𝐈";s:1:"I";s:4:"𝐉";s:1:"J";s:4:"𝐊";s:1:"K";s:4:"𝐋";s:1:"L";s:4:"𝐌";s:1:"M";s:4:"𝐍";s:1:"N";s:4:"𝐎";s:1:"O";s:4:"𝐏";s:1:"P";s:4:"𝐐";s:1:"Q";s:4:"𝐑";s:1:"R";s:4:"𝐒";s:1:"S";s:4:"𝐓";s:1:"T";s:4:"𝐔";s:1:"U";s:4:"𝐕";s:1:"V";s:4:"𝐖";s:1:"W";s:4:"𝐗";s:1:"X";s:4:"𝐘";s:1:"Y";s:4:"𝐙";s:1:"Z";s:4:"𝐚";s:1:"a";s:4:"𝐛";s:1:"b";s:4:"𝐜";s:1:"c";s:4:"𝐝";s:1:"d";s:4:"𝐞";s:1:"e";s:4:"𝐟";s:1:"f";s:4:"𝐠";s:1:"g";s:4:"𝐡";s:1:"h";s:4:"𝐢";s:1:"i";s:4:"𝐣";s:1:"j";s:4:"𝐤";s:1:"k";s:4:"𝐥";s:1:"l";s:4:"𝐦";s:1:"m";s:4:"𝐧";s:1:"n";s:4:"𝐨";s:1:"o";s:4:"𝐩";s:1:"p";s:4:"𝐪";s:1:"q";s:4:"𝐫";s:1:"r";s:4:"𝐬";s:1:"s";s:4:"𝐭";s:1:"t";s:4:"𝐮";s:1:"u";s:4:"𝐯";s:1:"v";s:4:"𝐰";s:1:"w";s:4:"𝐱";s:1:"x";s:4:"𝐲";s:1:"y";s:4:"𝐳";s:1:"z";s:4:"𝐴";s:1:"A";s:4:"𝐵";s:1:"B";s:4:"𝐶";s:1:"C";s:4:"𝐷";s:1:"D";s:4:"𝐸";s:1:"E";s:4:"𝐹";s:1:"F";s:4:"𝐺";s:1:"G";s:4:"𝐻";s:1:"H";s:4:"𝐼";s:1:"I";s:4:"𝐽";s:1:"J";s:4:"𝐾";s:1:"K";s:4:"𝐿";s:1:"L";s:4:"𝑀";s:1:"M";s:4:"𝑁";s:1:"N";s:4:"𝑂";s:1:"O";s:4:"𝑃";s:1:"P";s:4:"𝑄";s:1:"Q";s:4:"𝑅";s:1:"R";s:4:"𝑆";s:1:"S";s:4:"𝑇";s:1:"T";s:4:"𝑈";s:1:"U";s:4:"𝑉";s:1:"V";s:4:"𝑊";s:1:"W";s:4:"𝑋";s:1:"X";s:4:"𝑌";s:1:"Y";s:4:"𝑍";s:1:"Z";s:4:"𝑎";s:1:"a";s:4:"𝑏";s:1:"b";s:4:"𝑐";s:1:"c";s:4:"𝑑";s:1:"d";s:4:"𝑒";s:1:"e";s:4:"𝑓";s:1:"f";s:4:"𝑔";s:1:"g";s:4:"𝑖";s:1:"i";s:4:"𝑗";s:1:"j";s:4:"𝑘";s:1:"k";s:4:"𝑙";s:1:"l";s:4:"𝑚";s:1:"m";s:4:"𝑛";s:1:"n";s:4:"𝑜";s:1:"o";s:4:"𝑝";s:1:"p";s:4:"𝑞";s:1:"q";s:4:"𝑟";s:1:"r";s:4:"𝑠";s:1:"s";s:4:"𝑡";s:1:"t";s:4:"𝑢";s:1:"u";s:4:"𝑣";s:1:"v";s:4:"𝑤";s:1:"w";s:4:"𝑥";s:1:"x";s:4:"𝑦";s:1:"y";s:4:"𝑧";s:1:"z";s:4:"𝑨";s:1:"A";s:4:"𝑩";s:1:"B";s:4:"𝑪";s:1:"C";s:4:"𝑫";s:1:"D";s:4:"𝑬";s:1:"E";s:4:"𝑭";s:1:"F";s:4:"𝑮";s:1:"G";s:4:"𝑯";s:1:"H";s:4:"𝑰";s:1:"I";s:4:"𝑱";s:1:"J";s:4:"𝑲";s:1:"K";s:4:"𝑳";s:1:"L";s:4:"𝑴";s:1:"M";s:4:"𝑵";s:1:"N";s:4:"𝑶";s:1:"O";s:4:"𝑷";s:1:"P";s:4:"𝑸";s:1:"Q";s:4:"𝑹";s:1:"R";s:4:"𝑺";s:1:"S";s:4:"𝑻";s:1:"T";s:4:"𝑼";s:1:"U";s:4:"𝑽";s:1:"V";s:4:"𝑾";s:1:"W";s:4:"𝑿";s:1:"X";s:4:"𝒀";s:1:"Y";s:4:"𝒁";s:1:"Z";s:4:"𝒂";s:1:"a";s:4:"𝒃";s:1:"b";s:4:"𝒄";s:1:"c";s:4:"𝒅";s:1:"d";s:4:"𝒆";s:1:"e";s:4:"𝒇";s:1:"f";s:4:"𝒈";s:1:"g";s:4:"𝒉";s:1:"h";s:4:"𝒊";s:1:"i";s:4:"𝒋";s:1:"j";s:4:"𝒌";s:1:"k";s:4:"𝒍";s:1:"l";s:4:"𝒎";s:1:"m";s:4:"𝒏";s:1:"n";s:4:"𝒐";s:1:"o";s:4:"𝒑";s:1:"p";s:4:"𝒒";s:1:"q";s:4:"𝒓";s:1:"r";s:4:"𝒔";s:1:"s";s:4:"𝒕";s:1:"t";s:4:"𝒖";s:1:"u";s:4:"𝒗";s:1:"v";s:4:"𝒘";s:1:"w";s:4:"𝒙";s:1:"x";s:4:"𝒚";s:1:"y";s:4:"𝒛";s:1:"z";s:4:"𝒜";s:1:"A";s:4:"𝒞";s:1:"C";s:4:"𝒟";s:1:"D";s:4:"𝒢";s:1:"G";s:4:"𝒥";s:1:"J";s:4:"𝒦";s:1:"K";s:4:"𝒩";s:1:"N";s:4:"𝒪";s:1:"O";s:4:"𝒫";s:1:"P";s:4:"𝒬";s:1:"Q";s:4:"𝒮";s:1:"S";s:4:"𝒯";s:1:"T";s:4:"𝒰";s:1:"U";s:4:"𝒱";s:1:"V";s:4:"𝒲";s:1:"W";s:4:"𝒳";s:1:"X";s:4:"𝒴";s:1:"Y";s:4:"𝒵";s:1:"Z";s:4:"𝒶";s:1:"a";s:4:"𝒷";s:1:"b";s:4:"𝒸";s:1:"c";s:4:"𝒹";s:1:"d";s:4:"𝒻";s:1:"f";s:4:"𝒽";s:1:"h";s:4:"𝒾";s:1:"i";s:4:"𝒿";s:1:"j";s:4:"𝓀";s:1:"k";s:4:"𝓁";s:1:"l";s:4:"𝓂";s:1:"m";s:4:"𝓃";s:1:"n";s:4:"𝓅";s:1:"p";s:4:"𝓆";s:1:"q";s:4:"𝓇";s:1:"r";s:4:"𝓈";s:1:"s";s:4:"𝓉";s:1:"t";s:4:"𝓊";s:1:"u";s:4:"𝓋";s:1:"v";s:4:"𝓌";s:1:"w";s:4:"𝓍";s:1:"x";s:4:"𝓎";s:1:"y";s:4:"𝓏";s:1:"z";s:4:"𝓐";s:1:"A";s:4:"𝓑";s:1:"B";s:4:"𝓒";s:1:"C";s:4:"𝓓";s:1:"D";s:4:"𝓔";s:1:"E";s:4:"𝓕";s:1:"F";s:4:"𝓖";s:1:"G";s:4:"𝓗";s:1:"H";s:4:"𝓘";s:1:"I";s:4:"𝓙";s:1:"J";s:4:"𝓚";s:1:"K";s:4:"𝓛";s:1:"L";s:4:"𝓜";s:1:"M";s:4:"𝓝";s:1:"N";s:4:"𝓞";s:1:"O";s:4:"𝓟";s:1:"P";s:4:"𝓠";s:1:"Q";s:4:"𝓡";s:1:"R";s:4:"𝓢";s:1:"S";s:4:"𝓣";s:1:"T";s:4:"𝓤";s:1:"U";s:4:"𝓥";s:1:"V";s:4:"𝓦";s:1:"W";s:4:"𝓧";s:1:"X";s:4:"𝓨";s:1:"Y";s:4:"𝓩";s:1:"Z";s:4:"𝓪";s:1:"a";s:4:"𝓫";s:1:"b";s:4:"𝓬";s:1:"c";s:4:"𝓭";s:1:"d";s:4:"𝓮";s:1:"e";s:4:"𝓯";s:1:"f";s:4:"𝓰";s:1:"g";s:4:"𝓱";s:1:"h";s:4:"𝓲";s:1:"i";s:4:"𝓳";s:1:"j";s:4:"𝓴";s:1:"k";s:4:"𝓵";s:1:"l";s:4:"𝓶";s:1:"m";s:4:"𝓷";s:1:"n";s:4:"𝓸";s:1:"o";s:4:"𝓹";s:1:"p";s:4:"𝓺";s:1:"q";s:4:"𝓻";s:1:"r";s:4:"𝓼";s:1:"s";s:4:"𝓽";s:1:"t";s:4:"𝓾";s:1:"u";s:4:"𝓿";s:1:"v";s:4:"𝔀";s:1:"w";s:4:"𝔁";s:1:"x";s:4:"𝔂";s:1:"y";s:4:"𝔃";s:1:"z";s:4:"𝔄";s:1:"A";s:4:"𝔅";s:1:"B";s:4:"𝔇";s:1:"D";s:4:"𝔈";s:1:"E";s:4:"𝔉";s:1:"F";s:4:"𝔊";s:1:"G";s:4:"𝔍";s:1:"J";s:4:"𝔎";s:1:"K";s:4:"𝔏";s:1:"L";s:4:"𝔐";s:1:"M";s:4:"𝔑";s:1:"N";s:4:"𝔒";s:1:"O";s:4:"𝔓";s:1:"P";s:4:"𝔔";s:1:"Q";s:4:"𝔖";s:1:"S";s:4:"𝔗";s:1:"T";s:4:"𝔘";s:1:"U";s:4:"𝔙";s:1:"V";s:4:"𝔚";s:1:"W";s:4:"𝔛";s:1:"X";s:4:"𝔜";s:1:"Y";s:4:"𝔞";s:1:"a";s:4:"𝔟";s:1:"b";s:4:"𝔠";s:1:"c";s:4:"𝔡";s:1:"d";s:4:"𝔢";s:1:"e";s:4:"𝔣";s:1:"f";s:4:"𝔤";s:1:"g";s:4:"𝔥";s:1:"h";s:4:"𝔦";s:1:"i";s:4:"𝔧";s:1:"j";s:4:"𝔨";s:1:"k";s:4:"𝔩";s:1:"l";s:4:"𝔪";s:1:"m";s:4:"𝔫";s:1:"n";s:4:"𝔬";s:1:"o";s:4:"𝔭";s:1:"p";s:4:"𝔮";s:1:"q";s:4:"𝔯";s:1:"r";s:4:"𝔰";s:1:"s";s:4:"𝔱";s:1:"t";s:4:"𝔲";s:1:"u";s:4:"𝔳";s:1:"v";s:4:"𝔴";s:1:"w";s:4:"𝔵";s:1:"x";s:4:"𝔶";s:1:"y";s:4:"𝔷";s:1:"z";s:4:"𝔸";s:1:"A";s:4:"𝔹";s:1:"B";s:4:"𝔻";s:1:"D";s:4:"𝔼";s:1:"E";s:4:"𝔽";s:1:"F";s:4:"𝔾";s:1:"G";s:4:"𝕀";s:1:"I";s:4:"𝕁";s:1:"J";s:4:"𝕂";s:1:"K";s:4:"𝕃";s:1:"L";s:4:"𝕄";s:1:"M";s:4:"𝕆";s:1:"O";s:4:"𝕊";s:1:"S";s:4:"𝕋";s:1:"T";s:4:"𝕌";s:1:"U";s:4:"𝕍";s:1:"V";s:4:"𝕎";s:1:"W";s:4:"𝕏";s:1:"X";s:4:"𝕐";s:1:"Y";s:4:"𝕒";s:1:"a";s:4:"𝕓";s:1:"b";s:4:"𝕔";s:1:"c";s:4:"𝕕";s:1:"d";s:4:"𝕖";s:1:"e";s:4:"𝕗";s:1:"f";s:4:"𝕘";s:1:"g";s:4:"𝕙";s:1:"h";s:4:"𝕚";s:1:"i";s:4:"𝕛";s:1:"j";s:4:"𝕜";s:1:"k";s:4:"𝕝";s:1:"l";s:4:"𝕞";s:1:"m";s:4:"𝕟";s:1:"n";s:4:"𝕠";s:1:"o";s:4:"𝕡";s:1:"p";s:4:"𝕢";s:1:"q";s:4:"𝕣";s:1:"r";s:4:"𝕤";s:1:"s";s:4:"𝕥";s:1:"t";s:4:"𝕦";s:1:"u";s:4:"𝕧";s:1:"v";s:4:"𝕨";s:1:"w";s:4:"𝕩";s:1:"x";s:4:"𝕪";s:1:"y";s:4:"𝕫";s:1:"z";s:4:"𝕬";s:1:"A";s:4:"𝕭";s:1:"B";s:4:"𝕮";s:1:"C";s:4:"𝕯";s:1:"D";s:4:"𝕰";s:1:"E";s:4:"𝕱";s:1:"F";s:4:"𝕲";s:1:"G";s:4:"𝕳";s:1:"H";s:4:"𝕴";s:1:"I";s:4:"𝕵";s:1:"J";s:4:"𝕶";s:1:"K";s:4:"𝕷";s:1:"L";s:4:"𝕸";s:1:"M";s:4:"𝕹";s:1:"N";s:4:"𝕺";s:1:"O";s:4:"𝕻";s:1:"P";s:4:"𝕼";s:1:"Q";s:4:"𝕽";s:1:"R";s:4:"𝕾";s:1:"S";s:4:"𝕿";s:1:"T";s:4:"𝖀";s:1:"U";s:4:"𝖁";s:1:"V";s:4:"𝖂";s:1:"W";s:4:"𝖃";s:1:"X";s:4:"𝖄";s:1:"Y";s:4:"𝖅";s:1:"Z";s:4:"𝖆";s:1:"a";s:4:"𝖇";s:1:"b";s:4:"𝖈";s:1:"c";s:4:"𝖉";s:1:"d";s:4:"𝖊";s:1:"e";s:4:"𝖋";s:1:"f";s:4:"𝖌";s:1:"g";s:4:"𝖍";s:1:"h";s:4:"𝖎";s:1:"i";s:4:"𝖏";s:1:"j";s:4:"𝖐";s:1:"k";s:4:"𝖑";s:1:"l";s:4:"𝖒";s:1:"m";s:4:"𝖓";s:1:"n";s:4:"𝖔";s:1:"o";s:4:"𝖕";s:1:"p";s:4:"𝖖";s:1:"q";s:4:"𝖗";s:1:"r";s:4:"𝖘";s:1:"s";s:4:"𝖙";s:1:"t";s:4:"𝖚";s:1:"u";s:4:"𝖛";s:1:"v";s:4:"𝖜";s:1:"w";s:4:"𝖝";s:1:"x";s:4:"𝖞";s:1:"y";s:4:"𝖟";s:1:"z";s:4:"𝖠";s:1:"A";s:4:"𝖡";s:1:"B";s:4:"𝖢";s:1:"C";s:4:"𝖣";s:1:"D";s:4:"𝖤";s:1:"E";s:4:"𝖥";s:1:"F";s:4:"𝖦";s:1:"G";s:4:"𝖧";s:1:"H";s:4:"𝖨";s:1:"I";s:4:"𝖩";s:1:"J";s:4:"𝖪";s:1:"K";s:4:"𝖫";s:1:"L";s:4:"𝖬";s:1:"M";s:4:"𝖭";s:1:"N";s:4:"𝖮";s:1:"O";s:4:"𝖯";s:1:"P";s:4:"𝖰";s:1:"Q";s:4:"𝖱";s:1:"R";s:4:"𝖲";s:1:"S";s:4:"𝖳";s:1:"T";s:4:"𝖴";s:1:"U";s:4:"𝖵";s:1:"V";s:4:"𝖶";s:1:"W";s:4:"𝖷";s:1:"X";s:4:"𝖸";s:1:"Y";s:4:"𝖹";s:1:"Z";s:4:"𝖺";s:1:"a";s:4:"𝖻";s:1:"b";s:4:"𝖼";s:1:"c";s:4:"𝖽";s:1:"d";s:4:"𝖾";s:1:"e";s:4:"𝖿";s:1:"f";s:4:"𝗀";s:1:"g";s:4:"𝗁";s:1:"h";s:4:"𝗂";s:1:"i";s:4:"𝗃";s:1:"j";s:4:"𝗄";s:1:"k";s:4:"𝗅";s:1:"l";s:4:"𝗆";s:1:"m";s:4:"𝗇";s:1:"n";s:4:"𝗈";s:1:"o";s:4:"𝗉";s:1:"p";s:4:"𝗊";s:1:"q";s:4:"𝗋";s:1:"r";s:4:"𝗌";s:1:"s";s:4:"𝗍";s:1:"t";s:4:"𝗎";s:1:"u";s:4:"𝗏";s:1:"v";s:4:"𝗐";s:1:"w";s:4:"𝗑";s:1:"x";s:4:"𝗒";s:1:"y";s:4:"𝗓";s:1:"z";s:4:"𝗔";s:1:"A";s:4:"𝗕";s:1:"B";s:4:"𝗖";s:1:"C";s:4:"𝗗";s:1:"D";s:4:"𝗘";s:1:"E";s:4:"𝗙";s:1:"F";s:4:"𝗚";s:1:"G";s:4:"𝗛";s:1:"H";s:4:"𝗜";s:1:"I";s:4:"𝗝";s:1:"J";s:4:"𝗞";s:1:"K";s:4:"𝗟";s:1:"L";s:4:"𝗠";s:1:"M";s:4:"𝗡";s:1:"N";s:4:"𝗢";s:1:"O";s:4:"𝗣";s:1:"P";s:4:"𝗤";s:1:"Q";s:4:"𝗥";s:1:"R";s:4:"𝗦";s:1:"S";s:4:"𝗧";s:1:"T";s:4:"𝗨";s:1:"U";s:4:"𝗩";s:1:"V";s:4:"𝗪";s:1:"W";s:4:"𝗫";s:1:"X";s:4:"𝗬";s:1:"Y";s:4:"𝗭";s:1:"Z";s:4:"𝗮";s:1:"a";s:4:"𝗯";s:1:"b";s:4:"𝗰";s:1:"c";s:4:"𝗱";s:1:"d";s:4:"𝗲";s:1:"e";s:4:"𝗳";s:1:"f";s:4:"𝗴";s:1:"g";s:4:"𝗵";s:1:"h";s:4:"𝗶";s:1:"i";s:4:"𝗷";s:1:"j";s:4:"𝗸";s:1:"k";s:4:"𝗹";s:1:"l";s:4:"𝗺";s:1:"m";s:4:"𝗻";s:1:"n";s:4:"𝗼";s:1:"o";s:4:"𝗽";s:1:"p";s:4:"𝗾";s:1:"q";s:4:"𝗿";s:1:"r";s:4:"𝘀";s:1:"s";s:4:"𝘁";s:1:"t";s:4:"𝘂";s:1:"u";s:4:"𝘃";s:1:"v";s:4:"𝘄";s:1:"w";s:4:"𝘅";s:1:"x";s:4:"𝘆";s:1:"y";s:4:"𝘇";s:1:"z";s:4:"𝘈";s:1:"A";s:4:"𝘉";s:1:"B";s:4:"𝘊";s:1:"C";s:4:"𝘋";s:1:"D";s:4:"𝘌";s:1:"E";s:4:"𝘍";s:1:"F";s:4:"𝘎";s:1:"G";s:4:"𝘏";s:1:"H";s:4:"𝘐";s:1:"I";s:4:"𝘑";s:1:"J";s:4:"𝘒";s:1:"K";s:4:"𝘓";s:1:"L";s:4:"𝘔";s:1:"M";s:4:"𝘕";s:1:"N";s:4:"𝘖";s:1:"O";s:4:"𝘗";s:1:"P";s:4:"𝘘";s:1:"Q";s:4:"𝘙";s:1:"R";s:4:"𝘚";s:1:"S";s:4:"𝘛";s:1:"T";s:4:"𝘜";s:1:"U";s:4:"𝘝";s:1:"V";s:4:"𝘞";s:1:"W";s:4:"𝘟";s:1:"X";s:4:"𝘠";s:1:"Y";s:4:"𝘡";s:1:"Z";s:4:"𝘢";s:1:"a";s:4:"𝘣";s:1:"b";s:4:"𝘤";s:1:"c";s:4:"𝘥";s:1:"d";s:4:"𝘦";s:1:"e";s:4:"𝘧";s:1:"f";s:4:"𝘨";s:1:"g";s:4:"𝘩";s:1:"h";s:4:"𝘪";s:1:"i";s:4:"𝘫";s:1:"j";s:4:"𝘬";s:1:"k";s:4:"𝘭";s:1:"l";s:4:"𝘮";s:1:"m";s:4:"𝘯";s:1:"n";s:4:"𝘰";s:1:"o";s:4:"𝘱";s:1:"p";s:4:"𝘲";s:1:"q";s:4:"𝘳";s:1:"r";s:4:"𝘴";s:1:"s";s:4:"𝘵";s:1:"t";s:4:"𝘶";s:1:"u";s:4:"𝘷";s:1:"v";s:4:"𝘸";s:1:"w";s:4:"𝘹";s:1:"x";s:4:"𝘺";s:1:"y";s:4:"𝘻";s:1:"z";s:4:"𝘼";s:1:"A";s:4:"𝘽";s:1:"B";s:4:"𝘾";s:1:"C";s:4:"𝘿";s:1:"D";s:4:"𝙀";s:1:"E";s:4:"𝙁";s:1:"F";s:4:"𝙂";s:1:"G";s:4:"𝙃";s:1:"H";s:4:"𝙄";s:1:"I";s:4:"𝙅";s:1:"J";s:4:"𝙆";s:1:"K";s:4:"𝙇";s:1:"L";s:4:"𝙈";s:1:"M";s:4:"𝙉";s:1:"N";s:4:"𝙊";s:1:"O";s:4:"𝙋";s:1:"P";s:4:"𝙌";s:1:"Q";s:4:"𝙍";s:1:"R";s:4:"𝙎";s:1:"S";s:4:"𝙏";s:1:"T";s:4:"𝙐";s:1:"U";s:4:"𝙑";s:1:"V";s:4:"𝙒";s:1:"W";s:4:"𝙓";s:1:"X";s:4:"𝙔";s:1:"Y";s:4:"𝙕";s:1:"Z";s:4:"𝙖";s:1:"a";s:4:"𝙗";s:1:"b";s:4:"𝙘";s:1:"c";s:4:"𝙙";s:1:"d";s:4:"𝙚";s:1:"e";s:4:"𝙛";s:1:"f";s:4:"𝙜";s:1:"g";s:4:"𝙝";s:1:"h";s:4:"𝙞";s:1:"i";s:4:"𝙟";s:1:"j";s:4:"𝙠";s:1:"k";s:4:"𝙡";s:1:"l";s:4:"𝙢";s:1:"m";s:4:"𝙣";s:1:"n";s:4:"𝙤";s:1:"o";s:4:"𝙥";s:1:"p";s:4:"𝙦";s:1:"q";s:4:"𝙧";s:1:"r";s:4:"𝙨";s:1:"s";s:4:"𝙩";s:1:"t";s:4:"𝙪";s:1:"u";s:4:"𝙫";s:1:"v";s:4:"𝙬";s:1:"w";s:4:"𝙭";s:1:"x";s:4:"𝙮";s:1:"y";s:4:"𝙯";s:1:"z";s:4:"𝙰";s:1:"A";s:4:"𝙱";s:1:"B";s:4:"𝙲";s:1:"C";s:4:"𝙳";s:1:"D";s:4:"𝙴";s:1:"E";s:4:"𝙵";s:1:"F";s:4:"𝙶";s:1:"G";s:4:"𝙷";s:1:"H";s:4:"𝙸";s:1:"I";s:4:"𝙹";s:1:"J";s:4:"𝙺";s:1:"K";s:4:"𝙻";s:1:"L";s:4:"𝙼";s:1:"M";s:4:"𝙽";s:1:"N";s:4:"𝙾";s:1:"O";s:4:"𝙿";s:1:"P";s:4:"𝚀";s:1:"Q";s:4:"𝚁";s:1:"R";s:4:"𝚂";s:1:"S";s:4:"𝚃";s:1:"T";s:4:"𝚄";s:1:"U";s:4:"𝚅";s:1:"V";s:4:"𝚆";s:1:"W";s:4:"𝚇";s:1:"X";s:4:"𝚈";s:1:"Y";s:4:"𝚉";s:1:"Z";s:4:"𝚊";s:1:"a";s:4:"𝚋";s:1:"b";s:4:"𝚌";s:1:"c";s:4:"𝚍";s:1:"d";s:4:"𝚎";s:1:"e";s:4:"𝚏";s:1:"f";s:4:"𝚐";s:1:"g";s:4:"𝚑";s:1:"h";s:4:"𝚒";s:1:"i";s:4:"𝚓";s:1:"j";s:4:"𝚔";s:1:"k";s:4:"𝚕";s:1:"l";s:4:"𝚖";s:1:"m";s:4:"𝚗";s:1:"n";s:4:"𝚘";s:1:"o";s:4:"𝚙";s:1:"p";s:4:"𝚚";s:1:"q";s:4:"𝚛";s:1:"r";s:4:"𝚜";s:1:"s";s:4:"𝚝";s:1:"t";s:4:"𝚞";s:1:"u";s:4:"𝚟";s:1:"v";s:4:"𝚠";s:1:"w";s:4:"𝚡";s:1:"x";s:4:"𝚢";s:1:"y";s:4:"𝚣";s:1:"z";s:4:"𝚤";s:2:"ı";s:4:"𝚥";s:2:"ȷ";s:4:"𝚨";s:2:"Α";s:4:"𝚩";s:2:"Β";s:4:"𝚪";s:2:"Γ";s:4:"𝚫";s:2:"Δ";s:4:"𝚬";s:2:"Ε";s:4:"𝚭";s:2:"Ζ";s:4:"𝚮";s:2:"Η";s:4:"𝚯";s:2:"Θ";s:4:"𝚰";s:2:"Ι";s:4:"𝚱";s:2:"Κ";s:4:"𝚲";s:2:"Λ";s:4:"𝚳";s:2:"Μ";s:4:"𝚴";s:2:"Ν";s:4:"𝚵";s:2:"Ξ";s:4:"𝚶";s:2:"Ο";s:4:"𝚷";s:2:"Π";s:4:"𝚸";s:2:"Ρ";s:4:"𝚹";s:2:"ϴ";s:4:"𝚺";s:2:"Σ";s:4:"𝚻";s:2:"Τ";s:4:"𝚼";s:2:"Υ";s:4:"𝚽";s:2:"Φ";s:4:"𝚾";s:2:"Χ";s:4:"𝚿";s:2:"Ψ";s:4:"𝛀";s:2:"Ω";s:4:"𝛁";s:3:"∇";s:4:"𝛂";s:2:"α";s:4:"𝛃";s:2:"β";s:4:"𝛄";s:2:"γ";s:4:"𝛅";s:2:"δ";s:4:"𝛆";s:2:"ε";s:4:"𝛇";s:2:"ζ";s:4:"𝛈";s:2:"η";s:4:"𝛉";s:2:"θ";s:4:"𝛊";s:2:"ι";s:4:"𝛋";s:2:"κ";s:4:"𝛌";s:2:"λ";s:4:"𝛍";s:2:"μ";s:4:"𝛎";s:2:"ν";s:4:"𝛏";s:2:"ξ";s:4:"𝛐";s:2:"ο";s:4:"𝛑";s:2:"π";s:4:"𝛒";s:2:"ρ";s:4:"𝛓";s:2:"ς";s:4:"𝛔";s:2:"σ";s:4:"𝛕";s:2:"τ";s:4:"𝛖";s:2:"υ";s:4:"𝛗";s:2:"φ";s:4:"𝛘";s:2:"χ";s:4:"𝛙";s:2:"ψ";s:4:"𝛚";s:2:"ω";s:4:"𝛛";s:3:"∂";s:4:"𝛜";s:2:"ϵ";s:4:"𝛝";s:2:"ϑ";s:4:"𝛞";s:2:"ϰ";s:4:"𝛟";s:2:"ϕ";s:4:"𝛠";s:2:"ϱ";s:4:"𝛡";s:2:"ϖ";s:4:"𝛢";s:2:"Α";s:4:"𝛣";s:2:"Β";s:4:"𝛤";s:2:"Γ";s:4:"𝛥";s:2:"Δ";s:4:"𝛦";s:2:"Ε";s:4:"𝛧";s:2:"Ζ";s:4:"𝛨";s:2:"Η";s:4:"𝛩";s:2:"Θ";s:4:"𝛪";s:2:"Ι";s:4:"𝛫";s:2:"Κ";s:4:"𝛬";s:2:"Λ";s:4:"𝛭";s:2:"Μ";s:4:"𝛮";s:2:"Ν";s:4:"𝛯";s:2:"Ξ";s:4:"𝛰";s:2:"Ο";s:4:"𝛱";s:2:"Π";s:4:"𝛲";s:2:"Ρ";s:4:"𝛳";s:2:"ϴ";s:4:"𝛴";s:2:"Σ";s:4:"𝛵";s:2:"Τ";s:4:"𝛶";s:2:"Υ";s:4:"𝛷";s:2:"Φ";s:4:"𝛸";s:2:"Χ";s:4:"𝛹";s:2:"Ψ";s:4:"𝛺";s:2:"Ω";s:4:"𝛻";s:3:"∇";s:4:"𝛼";s:2:"α";s:4:"𝛽";s:2:"β";s:4:"𝛾";s:2:"γ";s:4:"𝛿";s:2:"δ";s:4:"𝜀";s:2:"ε";s:4:"𝜁";s:2:"ζ";s:4:"𝜂";s:2:"η";s:4:"𝜃";s:2:"θ";s:4:"𝜄";s:2:"ι";s:4:"𝜅";s:2:"κ";s:4:"𝜆";s:2:"λ";s:4:"𝜇";s:2:"μ";s:4:"𝜈";s:2:"ν";s:4:"𝜉";s:2:"ξ";s:4:"𝜊";s:2:"ο";s:4:"𝜋";s:2:"π";s:4:"𝜌";s:2:"ρ";s:4:"𝜍";s:2:"ς";s:4:"𝜎";s:2:"σ";s:4:"𝜏";s:2:"τ";s:4:"𝜐";s:2:"υ";s:4:"𝜑";s:2:"φ";s:4:"𝜒";s:2:"χ";s:4:"𝜓";s:2:"ψ";s:4:"𝜔";s:2:"ω";s:4:"𝜕";s:3:"∂";s:4:"𝜖";s:2:"ϵ";s:4:"𝜗";s:2:"ϑ";s:4:"𝜘";s:2:"ϰ";s:4:"𝜙";s:2:"ϕ";s:4:"𝜚";s:2:"ϱ";s:4:"𝜛";s:2:"ϖ";s:4:"𝜜";s:2:"Α";s:4:"𝜝";s:2:"Β";s:4:"𝜞";s:2:"Γ";s:4:"𝜟";s:2:"Δ";s:4:"𝜠";s:2:"Ε";s:4:"𝜡";s:2:"Ζ";s:4:"𝜢";s:2:"Η";s:4:"𝜣";s:2:"Θ";s:4:"𝜤";s:2:"Ι";s:4:"𝜥";s:2:"Κ";s:4:"𝜦";s:2:"Λ";s:4:"𝜧";s:2:"Μ";s:4:"𝜨";s:2:"Ν";s:4:"𝜩";s:2:"Ξ";s:4:"𝜪";s:2:"Ο";s:4:"𝜫";s:2:"Π";s:4:"𝜬";s:2:"Ρ";s:4:"𝜭";s:2:"ϴ";s:4:"𝜮";s:2:"Σ";s:4:"𝜯";s:2:"Τ";s:4:"𝜰";s:2:"Υ";s:4:"𝜱";s:2:"Φ";s:4:"𝜲";s:2:"Χ";s:4:"𝜳";s:2:"Ψ";s:4:"𝜴";s:2:"Ω";s:4:"𝜵";s:3:"∇";s:4:"𝜶";s:2:"α";s:4:"𝜷";s:2:"β";s:4:"𝜸";s:2:"γ";s:4:"𝜹";s:2:"δ";s:4:"𝜺";s:2:"ε";s:4:"𝜻";s:2:"ζ";s:4:"𝜼";s:2:"η";s:4:"𝜽";s:2:"θ";s:4:"𝜾";s:2:"ι";s:4:"𝜿";s:2:"κ";s:4:"𝝀";s:2:"λ";s:4:"𝝁";s:2:"μ";s:4:"𝝂";s:2:"ν";s:4:"𝝃";s:2:"ξ";s:4:"𝝄";s:2:"ο";s:4:"𝝅";s:2:"π";s:4:"𝝆";s:2:"ρ";s:4:"𝝇";s:2:"ς";s:4:"𝝈";s:2:"σ";s:4:"𝝉";s:2:"τ";s:4:"𝝊";s:2:"υ";s:4:"𝝋";s:2:"φ";s:4:"𝝌";s:2:"χ";s:4:"𝝍";s:2:"ψ";s:4:"𝝎";s:2:"ω";s:4:"𝝏";s:3:"∂";s:4:"𝝐";s:2:"ϵ";s:4:"𝝑";s:2:"ϑ";s:4:"𝝒";s:2:"ϰ";s:4:"𝝓";s:2:"ϕ";s:4:"𝝔";s:2:"ϱ";s:4:"𝝕";s:2:"ϖ";s:4:"𝝖";s:2:"Α";s:4:"𝝗";s:2:"Β";s:4:"𝝘";s:2:"Γ";s:4:"𝝙";s:2:"Δ";s:4:"𝝚";s:2:"Ε";s:4:"𝝛";s:2:"Ζ";s:4:"𝝜";s:2:"Η";s:4:"𝝝";s:2:"Θ";s:4:"𝝞";s:2:"Ι";s:4:"𝝟";s:2:"Κ";s:4:"𝝠";s:2:"Λ";s:4:"𝝡";s:2:"Μ";s:4:"𝝢";s:2:"Ν";s:4:"𝝣";s:2:"Ξ";s:4:"𝝤";s:2:"Ο";s:4:"𝝥";s:2:"Π";s:4:"𝝦";s:2:"Ρ";s:4:"𝝧";s:2:"ϴ";s:4:"𝝨";s:2:"Σ";s:4:"𝝩";s:2:"Τ";s:4:"𝝪";s:2:"Υ";s:4:"𝝫";s:2:"Φ";s:4:"𝝬";s:2:"Χ";s:4:"𝝭";s:2:"Ψ";s:4:"𝝮";s:2:"Ω";s:4:"𝝯";s:3:"∇";s:4:"𝝰";s:2:"α";s:4:"𝝱";s:2:"β";s:4:"𝝲";s:2:"γ";s:4:"𝝳";s:2:"δ";s:4:"𝝴";s:2:"ε";s:4:"𝝵";s:2:"ζ";s:4:"𝝶";s:2:"η";s:4:"𝝷";s:2:"θ";s:4:"𝝸";s:2:"ι";s:4:"𝝹";s:2:"κ";s:4:"𝝺";s:2:"λ";s:4:"𝝻";s:2:"μ";s:4:"𝝼";s:2:"ν";s:4:"𝝽";s:2:"ξ";s:4:"𝝾";s:2:"ο";s:4:"𝝿";s:2:"π";s:4:"𝞀";s:2:"ρ";s:4:"𝞁";s:2:"ς";s:4:"𝞂";s:2:"σ";s:4:"𝞃";s:2:"τ";s:4:"𝞄";s:2:"υ";s:4:"𝞅";s:2:"φ";s:4:"𝞆";s:2:"χ";s:4:"𝞇";s:2:"ψ";s:4:"𝞈";s:2:"ω";s:4:"𝞉";s:3:"∂";s:4:"𝞊";s:2:"ϵ";s:4:"𝞋";s:2:"ϑ";s:4:"𝞌";s:2:"ϰ";s:4:"𝞍";s:2:"ϕ";s:4:"𝞎";s:2:"ϱ";s:4:"𝞏";s:2:"ϖ";s:4:"𝞐";s:2:"Α";s:4:"𝞑";s:2:"Β";s:4:"𝞒";s:2:"Γ";s:4:"𝞓";s:2:"Δ";s:4:"𝞔";s:2:"Ε";s:4:"𝞕";s:2:"Ζ";s:4:"𝞖";s:2:"Η";s:4:"𝞗";s:2:"Θ";s:4:"𝞘";s:2:"Ι";s:4:"𝞙";s:2:"Κ";s:4:"𝞚";s:2:"Λ";s:4:"𝞛";s:2:"Μ";s:4:"𝞜";s:2:"Ν";s:4:"𝞝";s:2:"Ξ";s:4:"𝞞";s:2:"Ο";s:4:"𝞟";s:2:"Π";s:4:"𝞠";s:2:"Ρ";s:4:"𝞡";s:2:"ϴ";s:4:"𝞢";s:2:"Σ";s:4:"𝞣";s:2:"Τ";s:4:"𝞤";s:2:"Υ";s:4:"𝞥";s:2:"Φ";s:4:"𝞦";s:2:"Χ";s:4:"𝞧";s:2:"Ψ";s:4:"𝞨";s:2:"Ω";s:4:"𝞩";s:3:"∇";s:4:"𝞪";s:2:"α";s:4:"𝞫";s:2:"β";s:4:"𝞬";s:2:"γ";s:4:"𝞭";s:2:"δ";s:4:"𝞮";s:2:"ε";s:4:"𝞯";s:2:"ζ";s:4:"𝞰";s:2:"η";s:4:"𝞱";s:2:"θ";s:4:"𝞲";s:2:"ι";s:4:"𝞳";s:2:"κ";s:4:"𝞴";s:2:"λ";s:4:"𝞵";s:2:"μ";s:4:"𝞶";s:2:"ν";s:4:"𝞷";s:2:"ξ";s:4:"𝞸";s:2:"ο";s:4:"𝞹";s:2:"π";s:4:"𝞺";s:2:"ρ";s:4:"𝞻";s:2:"ς";s:4:"𝞼";s:2:"σ";s:4:"𝞽";s:2:"τ";s:4:"𝞾";s:2:"υ";s:4:"𝞿";s:2:"φ";s:4:"𝟀";s:2:"χ";s:4:"𝟁";s:2:"ψ";s:4:"𝟂";s:2:"ω";s:4:"𝟃";s:3:"∂";s:4:"𝟄";s:2:"ϵ";s:4:"𝟅";s:2:"ϑ";s:4:"𝟆";s:2:"ϰ";s:4:"𝟇";s:2:"ϕ";s:4:"𝟈";s:2:"ϱ";s:4:"𝟉";s:2:"ϖ";s:4:"𝟊";s:2:"Ϝ";s:4:"𝟋";s:2:"ϝ";s:4:"𝟎";s:1:"0";s:4:"𝟏";s:1:"1";s:4:"𝟐";s:1:"2";s:4:"𝟑";s:1:"3";s:4:"𝟒";s:1:"4";s:4:"𝟓";s:1:"5";s:4:"𝟔";s:1:"6";s:4:"𝟕";s:1:"7";s:4:"𝟖";s:1:"8";s:4:"𝟗";s:1:"9";s:4:"𝟘";s:1:"0";s:4:"𝟙";s:1:"1";s:4:"𝟚";s:1:"2";s:4:"𝟛";s:1:"3";s:4:"𝟜";s:1:"4";s:4:"𝟝";s:1:"5";s:4:"𝟞";s:1:"6";s:4:"𝟟";s:1:"7";s:4:"𝟠";s:1:"8";s:4:"𝟡";s:1:"9";s:4:"𝟢";s:1:"0";s:4:"𝟣";s:1:"1";s:4:"𝟤";s:1:"2";s:4:"𝟥";s:1:"3";s:4:"𝟦";s:1:"4";s:4:"𝟧";s:1:"5";s:4:"𝟨";s:1:"6";s:4:"𝟩";s:1:"7";s:4:"𝟪";s:1:"8";s:4:"𝟫";s:1:"9";s:4:"𝟬";s:1:"0";s:4:"𝟭";s:1:"1";s:4:"𝟮";s:1:"2";s:4:"𝟯";s:1:"3";s:4:"𝟰";s:1:"4";s:4:"𝟱";s:1:"5";s:4:"𝟲";s:1:"6";s:4:"𝟳";s:1:"7";s:4:"𝟴";s:1:"8";s:4:"𝟵";s:1:"9";s:4:"𝟶";s:1:"0";s:4:"𝟷";s:1:"1";s:4:"𝟸";s:1:"2";s:4:"𝟹";s:1:"3";s:4:"𝟺";s:1:"4";s:4:"𝟻";s:1:"5";s:4:"𝟼";s:1:"6";s:4:"𝟽";s:1:"7";s:4:"𝟾";s:1:"8";s:4:"𝟿";s:1:"9";s:4:"𞸀";s:2:"ا";s:4:"𞸁";s:2:"ب";s:4:"𞸂";s:2:"ج";s:4:"𞸃";s:2:"د";s:4:"𞸅";s:2:"و";s:4:"𞸆";s:2:"ز";s:4:"𞸇";s:2:"ح";s:4:"𞸈";s:2:"ط";s:4:"𞸉";s:2:"ي";s:4:"𞸊";s:2:"ك";s:4:"𞸋";s:2:"ل";s:4:"𞸌";s:2:"م";s:4:"𞸍";s:2:"ن";s:4:"𞸎";s:2:"س";s:4:"𞸏";s:2:"ع";s:4:"𞸐";s:2:"ف";s:4:"𞸑";s:2:"ص";s:4:"𞸒";s:2:"ق";s:4:"𞸓";s:2:"ر";s:4:"𞸔";s:2:"ش";s:4:"𞸕";s:2:"ت";s:4:"𞸖";s:2:"ث";s:4:"𞸗";s:2:"خ";s:4:"𞸘";s:2:"ذ";s:4:"𞸙";s:2:"ض";s:4:"𞸚";s:2:"ظ";s:4:"𞸛";s:2:"غ";s:4:"𞸜";s:2:"ٮ";s:4:"𞸝";s:2:"ں";s:4:"𞸞";s:2:"ڡ";s:4:"𞸟";s:2:"ٯ";s:4:"𞸡";s:2:"ب";s:4:"𞸢";s:2:"ج";s:4:"𞸤";s:2:"ه";s:4:"𞸧";s:2:"ح";s:4:"𞸩";s:2:"ي";s:4:"𞸪";s:2:"ك";s:4:"𞸫";s:2:"ل";s:4:"𞸬";s:2:"م";s:4:"𞸭";s:2:"ن";s:4:"𞸮";s:2:"س";s:4:"𞸯";s:2:"ع";s:4:"𞸰";s:2:"ف";s:4:"𞸱";s:2:"ص";s:4:"𞸲";s:2:"ق";s:4:"𞸴";s:2:"ش";s:4:"𞸵";s:2:"ت";s:4:"𞸶";s:2:"ث";s:4:"𞸷";s:2:"خ";s:4:"𞸹";s:2:"ض";s:4:"𞸻";s:2:"غ";s:4:"𞹂";s:2:"ج";s:4:"𞹇";s:2:"ح";s:4:"𞹉";s:2:"ي";s:4:"𞹋";s:2:"ل";s:4:"𞹍";s:2:"ن";s:4:"𞹎";s:2:"س";s:4:"𞹏";s:2:"ع";s:4:"𞹑";s:2:"ص";s:4:"𞹒";s:2:"ق";s:4:"𞹔";s:2:"ش";s:4:"𞹗";s:2:"خ";s:4:"𞹙";s:2:"ض";s:4:"𞹛";s:2:"غ";s:4:"𞹝";s:2:"ں";s:4:"𞹟";s:2:"ٯ";s:4:"𞹡";s:2:"ب";s:4:"𞹢";s:2:"ج";s:4:"𞹤";s:2:"ه";s:4:"𞹧";s:2:"ح";s:4:"𞹨";s:2:"ط";s:4:"𞹩";s:2:"ي";s:4:"𞹪";s:2:"ك";s:4:"𞹬";s:2:"م";s:4:"𞹭";s:2:"ن";s:4:"𞹮";s:2:"س";s:4:"𞹯";s:2:"ع";s:4:"𞹰";s:2:"ف";s:4:"𞹱";s:2:"ص";s:4:"𞹲";s:2:"ق";s:4:"𞹴";s:2:"ش";s:4:"𞹵";s:2:"ت";s:4:"𞹶";s:2:"ث";s:4:"𞹷";s:2:"خ";s:4:"𞹹";s:2:"ض";s:4:"𞹺";s:2:"ظ";s:4:"𞹻";s:2:"غ";s:4:"𞹼";s:2:"ٮ";s:4:"𞹾";s:2:"ڡ";s:4:"𞺀";s:2:"ا";s:4:"𞺁";s:2:"ب";s:4:"𞺂";s:2:"ج";s:4:"𞺃";s:2:"د";s:4:"𞺄";s:2:"ه";s:4:"𞺅";s:2:"و";s:4:"𞺆";s:2:"ز";s:4:"𞺇";s:2:"ح";s:4:"𞺈";s:2:"ط";s:4:"𞺉";s:2:"ي";s:4:"𞺋";s:2:"ل";s:4:"𞺌";s:2:"م";s:4:"𞺍";s:2:"ن";s:4:"𞺎";s:2:"س";s:4:"𞺏";s:2:"ع";s:4:"𞺐";s:2:"ف";s:4:"𞺑";s:2:"ص";s:4:"𞺒";s:2:"ق";s:4:"𞺓";s:2:"ر";s:4:"𞺔";s:2:"ش";s:4:"𞺕";s:2:"ت";s:4:"𞺖";s:2:"ث";s:4:"𞺗";s:2:"خ";s:4:"𞺘";s:2:"ذ";s:4:"𞺙";s:2:"ض";s:4:"𞺚";s:2:"ظ";s:4:"𞺛";s:2:"غ";s:4:"𞺡";s:2:"ب";s:4:"𞺢";s:2:"ج";s:4:"𞺣";s:2:"د";s:4:"𞺥";s:2:"و";s:4:"𞺦";s:2:"ز";s:4:"𞺧";s:2:"ح";s:4:"𞺨";s:2:"ط";s:4:"𞺩";s:2:"ي";s:4:"𞺫";s:2:"ل";s:4:"𞺬";s:2:"م";s:4:"𞺭";s:2:"ن";s:4:"𞺮";s:2:"س";s:4:"𞺯";s:2:"ع";s:4:"𞺰";s:2:"ف";s:4:"𞺱";s:2:"ص";s:4:"𞺲";s:2:"ق";s:4:"𞺳";s:2:"ر";s:4:"𞺴";s:2:"ش";s:4:"𞺵";s:2:"ت";s:4:"𞺶";s:2:"ث";s:4:"𞺷";s:2:"خ";s:4:"𞺸";s:2:"ذ";s:4:"𞺹";s:2:"ض";s:4:"𞺺";s:2:"ظ";s:4:"𞺻";s:2:"غ";s:4:"🄀";s:2:"0.";s:4:"🄁";s:2:"0,";s:4:"🄂";s:2:"1,";s:4:"🄃";s:2:"2,";s:4:"🄄";s:2:"3,";s:4:"🄅";s:2:"4,";s:4:"🄆";s:2:"5,";s:4:"🄇";s:2:"6,";s:4:"🄈";s:2:"7,";s:4:"🄉";s:2:"8,";s:4:"🄊";s:2:"9,";s:4:"🄐";s:3:"(A)";s:4:"🄑";s:3:"(B)";s:4:"🄒";s:3:"(C)";s:4:"🄓";s:3:"(D)";s:4:"🄔";s:3:"(E)";s:4:"🄕";s:3:"(F)";s:4:"🄖";s:3:"(G)";s:4:"🄗";s:3:"(H)";s:4:"🄘";s:3:"(I)";s:4:"🄙";s:3:"(J)";s:4:"🄚";s:3:"(K)";s:4:"🄛";s:3:"(L)";s:4:"🄜";s:3:"(M)";s:4:"🄝";s:3:"(N)";s:4:"🄞";s:3:"(O)";s:4:"🄟";s:3:"(P)";s:4:"🄠";s:3:"(Q)";s:4:"🄡";s:3:"(R)";s:4:"🄢";s:3:"(S)";s:4:"🄣";s:3:"(T)";s:4:"🄤";s:3:"(U)";s:4:"🄥";s:3:"(V)";s:4:"🄦";s:3:"(W)";s:4:"🄧";s:3:"(X)";s:4:"🄨";s:3:"(Y)";s:4:"🄩";s:3:"(Z)";s:4:"🄪";s:7:"〔S〕";s:4:"🄫";s:3:"(C)";s:4:"🄬";s:3:"(R)";s:4:"🄭";s:4:"(CD)";s:4:"🄮";s:4:"(WZ)";s:4:"🄰";s:1:"A";s:4:"🄱";s:1:"B";s:4:"🄲";s:1:"C";s:4:"🄳";s:1:"D";s:4:"🄴";s:1:"E";s:4:"🄵";s:1:"F";s:4:"🄶";s:1:"G";s:4:"🄷";s:1:"H";s:4:"🄸";s:1:"I";s:4:"🄹";s:1:"J";s:4:"🄺";s:1:"K";s:4:"🄻";s:1:"L";s:4:"🄼";s:1:"M";s:4:"🄽";s:1:"N";s:4:"🄾";s:1:"O";s:4:"🄿";s:1:"P";s:4:"🅀";s:1:"Q";s:4:"🅁";s:1:"R";s:4:"🅂";s:1:"S";s:4:"🅃";s:1:"T";s:4:"🅄";s:1:"U";s:4:"🅅";s:1:"V";s:4:"🅆";s:1:"W";s:4:"🅇";s:1:"X";s:4:"🅈";s:1:"Y";s:4:"🅉";s:1:"Z";s:4:"🅊";s:2:"HV";s:4:"🅋";s:2:"MV";s:4:"🅌";s:2:"SD";s:4:"🅍";s:2:"SS";s:4:"🅎";s:3:"PPV";s:4:"🅏";s:2:"WC";s:4:"🆐";s:2:"DJ";s:4:"🈀";s:6:"ほか";s:4:"🈁";s:6:"ココ";s:4:"🈂";s:3:"サ";s:4:"🈐";s:3:"手";s:4:"🈑";s:3:"字";s:4:"🈒";s:3:"双";s:4:"🈓";s:3:"デ";s:4:"🈔";s:3:"二";s:4:"🈕";s:3:"多";s:4:"🈖";s:3:"解";s:4:"🈗";s:3:"天";s:4:"🈘";s:3:"交";s:4:"🈙";s:3:"映";s:4:"🈚";s:3:"無";s:4:"🈛";s:3:"料";s:4:"🈜";s:3:"前";s:4:"🈝";s:3:"後";s:4:"🈞";s:3:"再";s:4:"🈟";s:3:"新";s:4:"🈠";s:3:"初";s:4:"🈡";s:3:"終";s:4:"🈢";s:3:"生";s:4:"🈣";s:3:"販";s:4:"🈤";s:3:"声";s:4:"🈥";s:3:"吹";s:4:"🈦";s:3:"演";s:4:"🈧";s:3:"投";s:4:"🈨";s:3:"捕";s:4:"🈩";s:3:"一";s:4:"🈪";s:3:"三";s:4:"🈫";s:3:"遊";s:4:"🈬";s:3:"左";s:4:"🈭";s:3:"中";s:4:"🈮";s:3:"右";s:4:"🈯";s:3:"指";s:4:"🈰";s:3:"走";s:4:"🈱";s:3:"打";s:4:"🈲";s:3:"禁";s:4:"🈳";s:3:"空";s:4:"🈴";s:3:"合";s:4:"🈵";s:3:"満";s:4:"🈶";s:3:"有";s:4:"🈷";s:3:"月";s:4:"🈸";s:3:"申";s:4:"🈹";s:3:"割";s:4:"🈺";s:3:"営";s:4:"🈻";s:3:"配";s:4:"🉀";s:9:"〔本〕";s:4:"🉁";s:9:"〔三〕";s:4:"🉂";s:9:"〔二〕";s:4:"🉃";s:9:"〔安〕";s:4:"🉄";s:9:"〔点〕";s:4:"🉅";s:9:"〔打〕";s:4:"🉆";s:9:"〔盗〕";s:4:"🉇";s:9:"〔勝〕";s:4:"🉈";s:9:"〔敗〕";s:4:"🉐";s:5:"(得)";s:4:"🉑";s:5:"(可)";s:4:"丽";s:3:"丽";s:4:"丸";s:3:"丸";s:4:"乁";s:3:"乁";s:4:"𠄢";s:4:"𠄢";s:4:"你";s:3:"你";s:4:"侮";s:3:"侮";s:4:"侻";s:3:"侻";s:4:"倂";s:3:"倂";s:4:"偺";s:3:"偺";s:4:"備";s:3:"備";s:4:"僧";s:3:"僧";s:4:"像";s:3:"像";s:4:"㒞";s:3:"㒞";s:4:"𠘺";s:4:"𠘺";s:4:"免";s:3:"免";s:4:"兔";s:3:"兔";s:4:"兤";s:3:"兤";s:4:"具";s:3:"具";s:4:"𠔜";s:4:"𠔜";s:4:"㒹";s:3:"㒹";s:4:"內";s:3:"內";s:4:"再";s:3:"再";s:4:"𠕋";s:4:"𠕋";s:4:"冗";s:3:"冗";s:4:"冤";s:3:"冤";s:4:"仌";s:3:"仌";s:4:"冬";s:3:"冬";s:4:"况";s:3:"况";s:4:"𩇟";s:4:"𩇟";s:4:"凵";s:3:"凵";s:4:"刃";s:3:"刃";s:4:"㓟";s:3:"㓟";s:4:"刻";s:3:"刻";s:4:"剆";s:3:"剆";s:4:"割";s:3:"割";s:4:"剷";s:3:"剷";s:4:"㔕";s:3:"㔕";s:4:"勇";s:3:"勇";s:4:"勉";s:3:"勉";s:4:"勤";s:3:"勤";s:4:"勺";s:3:"勺";s:4:"包";s:3:"包";s:4:"匆";s:3:"匆";s:4:"北";s:3:"北";s:4:"卉";s:3:"卉";s:4:"卑";s:3:"卑";s:4:"博";s:3:"博";s:4:"即";s:3:"即";s:4:"卽";s:3:"卽";s:4:"卿";s:3:"卿";s:4:"卿";s:3:"卿";s:4:"卿";s:3:"卿";s:4:"𠨬";s:4:"𠨬";s:4:"灰";s:3:"灰";s:4:"及";s:3:"及";s:4:"叟";s:3:"叟";s:4:"𠭣";s:4:"𠭣";s:4:"叫";s:3:"叫";s:4:"叱";s:3:"叱";s:4:"吆";s:3:"吆";s:4:"咞";s:3:"咞";s:4:"吸";s:3:"吸";s:4:"呈";s:3:"呈";s:4:"周";s:3:"周";s:4:"咢";s:3:"咢";s:4:"哶";s:3:"哶";s:4:"唐";s:3:"唐";s:4:"啓";s:3:"啓";s:4:"啣";s:3:"啣";s:4:"善";s:3:"善";s:4:"善";s:3:"善";s:4:"喙";s:3:"喙";s:4:"喫";s:3:"喫";s:4:"喳";s:3:"喳";s:4:"嗂";s:3:"嗂";s:4:"圖";s:3:"圖";s:4:"嘆";s:3:"嘆";s:4:"圗";s:3:"圗";s:4:"噑";s:3:"噑";s:4:"噴";s:3:"噴";s:4:"切";s:3:"切";s:4:"壮";s:3:"壮";s:4:"城";s:3:"城";s:4:"埴";s:3:"埴";s:4:"堍";s:3:"堍";s:4:"型";s:3:"型";s:4:"堲";s:3:"堲";s:4:"報";s:3:"報";s:4:"墬";s:3:"墬";s:4:"𡓤";s:4:"𡓤";s:4:"売";s:3:"売";s:4:"壷";s:3:"壷";s:4:"夆";s:3:"夆";s:4:"多";s:3:"多";s:4:"夢";s:3:"夢";s:4:"奢";s:3:"奢";s:4:"𡚨";s:4:"𡚨";s:4:"𡛪";s:4:"𡛪";s:4:"姬";s:3:"姬";s:4:"娛";s:3:"娛";s:4:"娧";s:3:"娧";s:4:"姘";s:3:"姘";s:4:"婦";s:3:"婦";s:4:"㛮";s:3:"㛮";s:4:"㛼";s:3:"㛼";s:4:"嬈";s:3:"嬈";s:4:"嬾";s:3:"嬾";s:4:"嬾";s:3:"嬾";s:4:"𡧈";s:4:"𡧈";s:4:"寃";s:3:"寃";s:4:"寘";s:3:"寘";s:4:"寧";s:3:"寧";s:4:"寳";s:3:"寳";s:4:"𡬘";s:4:"𡬘";s:4:"寿";s:3:"寿";s:4:"将";s:3:"将";s:4:"当";s:3:"当";s:4:"尢";s:3:"尢";s:4:"㞁";s:3:"㞁";s:4:"屠";s:3:"屠";s:4:"屮";s:3:"屮";s:4:"峀";s:3:"峀";s:4:"岍";s:3:"岍";s:4:"𡷤";s:4:"𡷤";s:4:"嵃";s:3:"嵃";s:4:"𡷦";s:4:"𡷦";s:4:"嵮";s:3:"嵮";s:4:"嵫";s:3:"嵫";s:4:"嵼";s:3:"嵼";s:4:"巡";s:3:"巡";s:4:"巢";s:3:"巢";s:4:"㠯";s:3:"㠯";s:4:"巽";s:3:"巽";s:4:"帨";s:3:"帨";s:4:"帽";s:3:"帽";s:4:"幩";s:3:"幩";s:4:"㡢";s:3:"㡢";s:4:"𢆃";s:4:"𢆃";s:4:"㡼";s:3:"㡼";s:4:"庰";s:3:"庰";s:4:"庳";s:3:"庳";s:4:"庶";s:3:"庶";s:4:"廊";s:3:"廊";s:4:"𪎒";s:4:"𪎒";s:4:"廾";s:3:"廾";s:4:"𢌱";s:4:"𢌱";s:4:"𢌱";s:4:"𢌱";s:4:"舁";s:3:"舁";s:4:"弢";s:3:"弢";s:4:"弢";s:3:"弢";s:4:"㣇";s:3:"㣇";s:4:"𣊸";s:4:"𣊸";s:4:"𦇚";s:4:"𦇚";s:4:"形";s:3:"形";s:4:"彫";s:3:"彫";s:4:"㣣";s:3:"㣣";s:4:"徚";s:3:"徚";s:4:"忍";s:3:"忍";s:4:"志";s:3:"志";s:4:"忹";s:3:"忹";s:4:"悁";s:3:"悁";s:4:"㤺";s:3:"㤺";s:4:"㤜";s:3:"㤜";s:4:"悔";s:3:"悔";s:4:"𢛔";s:4:"𢛔";s:4:"惇";s:3:"惇";s:4:"慈";s:3:"慈";s:4:"慌";s:3:"慌";s:4:"慎";s:3:"慎";s:4:"慌";s:3:"慌";s:4:"慺";s:3:"慺";s:4:"憎";s:3:"憎";s:4:"憲";s:3:"憲";s:4:"憤";s:3:"憤";s:4:"憯";s:3:"憯";s:4:"懞";s:3:"懞";s:4:"懲";s:3:"懲";s:4:"懶";s:3:"懶";s:4:"成";s:3:"成";s:4:"戛";s:3:"戛";s:4:"扝";s:3:"扝";s:4:"抱";s:3:"抱";s:4:"拔";s:3:"拔";s:4:"捐";s:3:"捐";s:4:"𢬌";s:4:"𢬌";s:4:"挽";s:3:"挽";s:4:"拼";s:3:"拼";s:4:"捨";s:3:"捨";s:4:"掃";s:3:"掃";s:4:"揤";s:3:"揤";s:4:"𢯱";s:4:"𢯱";s:4:"搢";s:3:"搢";s:4:"揅";s:3:"揅";s:4:"掩";s:3:"掩";s:4:"㨮";s:3:"㨮";s:4:"摩";s:3:"摩";s:4:"摾";s:3:"摾";s:4:"撝";s:3:"撝";s:4:"摷";s:3:"摷";s:4:"㩬";s:3:"㩬";s:4:"敏";s:3:"敏";s:4:"敬";s:3:"敬";s:4:"𣀊";s:4:"𣀊";s:4:"旣";s:3:"旣";s:4:"書";s:3:"書";s:4:"晉";s:3:"晉";s:4:"㬙";s:3:"㬙";s:4:"暑";s:3:"暑";s:4:"㬈";s:3:"㬈";s:4:"㫤";s:3:"㫤";s:4:"冒";s:3:"冒";s:4:"冕";s:3:"冕";s:4:"最";s:3:"最";s:4:"暜";s:3:"暜";s:4:"肭";s:3:"肭";s:4:"䏙";s:3:"䏙";s:4:"朗";s:3:"朗";s:4:"望";s:3:"望";s:4:"朡";s:3:"朡";s:4:"杞";s:3:"杞";s:4:"杓";s:3:"杓";s:4:"𣏃";s:4:"𣏃";s:4:"㭉";s:3:"㭉";s:4:"柺";s:3:"柺";s:4:"枅";s:3:"枅";s:4:"桒";s:3:"桒";s:4:"梅";s:3:"梅";s:4:"𣑭";s:4:"𣑭";s:4:"梎";s:3:"梎";s:4:"栟";s:3:"栟";s:4:"椔";s:3:"椔";s:4:"㮝";s:3:"㮝";s:4:"楂";s:3:"楂";s:4:"榣";s:3:"榣";s:4:"槪";s:3:"槪";s:4:"檨";s:3:"檨";s:4:"𣚣";s:4:"𣚣";s:4:"櫛";s:3:"櫛";s:4:"㰘";s:3:"㰘";s:4:"次";s:3:"次";s:4:"𣢧";s:4:"𣢧";s:4:"歔";s:3:"歔";s:4:"㱎";s:3:"㱎";s:4:"歲";s:3:"歲";s:4:"殟";s:3:"殟";s:4:"殺";s:3:"殺";s:4:"殻";s:3:"殻";s:4:"𣪍";s:4:"𣪍";s:4:"𡴋";s:4:"𡴋";s:4:"𣫺";s:4:"𣫺";s:4:"汎";s:3:"汎";s:4:"𣲼";s:4:"𣲼";s:4:"沿";s:3:"沿";s:4:"泍";s:3:"泍";s:4:"汧";s:3:"汧";s:4:"洖";s:3:"洖";s:4:"派";s:3:"派";s:4:"海";s:3:"海";s:4:"流";s:3:"流";s:4:"浩";s:3:"浩";s:4:"浸";s:3:"浸";s:4:"涅";s:3:"涅";s:4:"𣴞";s:4:"𣴞";s:4:"洴";s:3:"洴";s:4:"港";s:3:"港";s:4:"湮";s:3:"湮";s:4:"㴳";s:3:"㴳";s:4:"滋";s:3:"滋";s:4:"滇";s:3:"滇";s:4:"𣻑";s:4:"𣻑";s:4:"淹";s:3:"淹";s:4:"潮";s:3:"潮";s:4:"𣽞";s:4:"𣽞";s:4:"𣾎";s:4:"𣾎";s:4:"濆";s:3:"濆";s:4:"瀹";s:3:"瀹";s:4:"瀞";s:3:"瀞";s:4:"瀛";s:3:"瀛";s:4:"㶖";s:3:"㶖";s:4:"灊";s:3:"灊";s:4:"災";s:3:"災";s:4:"灷";s:3:"灷";s:4:"炭";s:3:"炭";s:4:"𠔥";s:4:"𠔥";s:4:"煅";s:3:"煅";s:4:"𤉣";s:4:"𤉣";s:4:"熜";s:3:"熜";s:4:"𤎫";s:4:"𤎫";s:4:"爨";s:3:"爨";s:4:"爵";s:3:"爵";s:4:"牐";s:3:"牐";s:4:"𤘈";s:4:"𤘈";s:4:"犀";s:3:"犀";s:4:"犕";s:3:"犕";s:4:"𤜵";s:4:"𤜵";s:4:"𤠔";s:4:"𤠔";s:4:"獺";s:3:"獺";s:4:"王";s:3:"王";s:4:"㺬";s:3:"㺬";s:4:"玥";s:3:"玥";s:4:"㺸";s:3:"㺸";s:4:"㺸";s:3:"㺸";s:4:"瑇";s:3:"瑇";s:4:"瑜";s:3:"瑜";s:4:"瑱";s:3:"瑱";s:4:"璅";s:3:"璅";s:4:"瓊";s:3:"瓊";s:4:"㼛";s:3:"㼛";s:4:"甤";s:3:"甤";s:4:"𤰶";s:4:"𤰶";s:4:"甾";s:3:"甾";s:4:"𤲒";s:4:"𤲒";s:4:"異";s:3:"異";s:4:"𢆟";s:4:"𢆟";s:4:"瘐";s:3:"瘐";s:4:"𤾡";s:4:"𤾡";s:4:"𤾸";s:4:"𤾸";s:4:"𥁄";s:4:"𥁄";s:4:"㿼";s:3:"㿼";s:4:"䀈";s:3:"䀈";s:4:"直";s:3:"直";s:4:"𥃳";s:4:"𥃳";s:4:"𥃲";s:4:"𥃲";s:4:"𥄙";s:4:"𥄙";s:4:"𥄳";s:4:"𥄳";s:4:"眞";s:3:"眞";s:4:"真";s:3:"真";s:4:"真";s:3:"真";s:4:"睊";s:3:"睊";s:4:"䀹";s:3:"䀹";s:4:"瞋";s:3:"瞋";s:4:"䁆";s:3:"䁆";s:4:"䂖";s:3:"䂖";s:4:"𥐝";s:4:"𥐝";s:4:"硎";s:3:"硎";s:4:"碌";s:3:"碌";s:4:"磌";s:3:"磌";s:4:"䃣";s:3:"䃣";s:4:"𥘦";s:4:"𥘦";s:4:"祖";s:3:"祖";s:4:"𥚚";s:4:"𥚚";s:4:"𥛅";s:4:"𥛅";s:4:"福";s:3:"福";s:4:"秫";s:3:"秫";s:4:"䄯";s:3:"䄯";s:4:"穀";s:3:"穀";s:4:"穊";s:3:"穊";s:4:"穏";s:3:"穏";s:4:"𥥼";s:4:"𥥼";s:4:"𥪧";s:4:"𥪧";s:4:"𥪧";s:4:"𥪧";s:4:"竮";s:3:"竮";s:4:"䈂";s:3:"䈂";s:4:"𥮫";s:4:"𥮫";s:4:"篆";s:3:"篆";s:4:"築";s:3:"築";s:4:"䈧";s:3:"䈧";s:4:"𥲀";s:4:"𥲀";s:4:"糒";s:3:"糒";s:4:"䊠";s:3:"䊠";s:4:"糨";s:3:"糨";s:4:"糣";s:3:"糣";s:4:"紀";s:3:"紀";s:4:"𥾆";s:4:"𥾆";s:4:"絣";s:3:"絣";s:4:"䌁";s:3:"䌁";s:4:"緇";s:3:"緇";s:4:"縂";s:3:"縂";s:4:"繅";s:3:"繅";s:4:"䌴";s:3:"䌴";s:4:"𦈨";s:4:"𦈨";s:4:"𦉇";s:4:"𦉇";s:4:"䍙";s:3:"䍙";s:4:"𦋙";s:4:"𦋙";s:4:"罺";s:3:"罺";s:4:"𦌾";s:4:"𦌾";s:4:"羕";s:3:"羕";s:4:"翺";s:3:"翺";s:4:"者";s:3:"者";s:4:"𦓚";s:4:"𦓚";s:4:"𦔣";s:4:"𦔣";s:4:"聠";s:3:"聠";s:4:"𦖨";s:4:"𦖨";s:4:"聰";s:3:"聰";s:4:"𣍟";s:4:"𣍟";s:4:"䏕";s:3:"䏕";s:4:"育";s:3:"育";s:4:"脃";s:3:"脃";s:4:"䐋";s:3:"䐋";s:4:"脾";s:3:"脾";s:4:"媵";s:3:"媵";s:4:"𦞧";s:4:"𦞧";s:4:"𦞵";s:4:"𦞵";s:4:"𣎓";s:4:"𣎓";s:4:"𣎜";s:4:"𣎜";s:4:"舁";s:3:"舁";s:4:"舄";s:3:"舄";s:4:"辞";s:3:"辞";s:4:"䑫";s:3:"䑫";s:4:"芑";s:3:"芑";s:4:"芋";s:3:"芋";s:4:"芝";s:3:"芝";s:4:"劳";s:3:"劳";s:4:"花";s:3:"花";s:4:"芳";s:3:"芳";s:4:"芽";s:3:"芽";s:4:"苦";s:3:"苦";s:4:"𦬼";s:4:"𦬼";s:4:"若";s:3:"若";s:4:"茝";s:3:"茝";s:4:"荣";s:3:"荣";s:4:"莭";s:3:"莭";s:4:"茣";s:3:"茣";s:4:"莽";s:3:"莽";s:4:"菧";s:3:"菧";s:4:"著";s:3:"著";s:4:"荓";s:3:"荓";s:4:"菊";s:3:"菊";s:4:"菌";s:3:"菌";s:4:"菜";s:3:"菜";s:4:"𦰶";s:4:"𦰶";s:4:"𦵫";s:4:"𦵫";s:4:"𦳕";s:4:"𦳕";s:4:"䔫";s:3:"䔫";s:4:"蓱";s:3:"蓱";s:4:"蓳";s:3:"蓳";s:4:"蔖";s:3:"蔖";s:4:"𧏊";s:4:"𧏊";s:4:"蕤";s:3:"蕤";s:4:"𦼬";s:4:"𦼬";s:4:"䕝";s:3:"䕝";s:4:"䕡";s:3:"䕡";s:4:"𦾱";s:4:"𦾱";s:4:"𧃒";s:4:"𧃒";s:4:"䕫";s:3:"䕫";s:4:"虐";s:3:"虐";s:4:"虜";s:3:"虜";s:4:"虧";s:3:"虧";s:4:"虩";s:3:"虩";s:4:"蚩";s:3:"蚩";s:4:"蚈";s:3:"蚈";s:4:"蜎";s:3:"蜎";s:4:"蛢";s:3:"蛢";s:4:"蝹";s:3:"蝹";s:4:"蜨";s:3:"蜨";s:4:"蝫";s:3:"蝫";s:4:"螆";s:3:"螆";s:4:"䗗";s:3:"䗗";s:4:"蟡";s:3:"蟡";s:4:"蠁";s:3:"蠁";s:4:"䗹";s:3:"䗹";s:4:"衠";s:3:"衠";s:4:"衣";s:3:"衣";s:4:"𧙧";s:4:"𧙧";s:4:"裗";s:3:"裗";s:4:"裞";s:3:"裞";s:4:"䘵";s:3:"䘵";s:4:"裺";s:3:"裺";s:4:"㒻";s:3:"㒻";s:4:"𧢮";s:4:"𧢮";s:4:"𧥦";s:4:"𧥦";s:4:"䚾";s:3:"䚾";s:4:"䛇";s:3:"䛇";s:4:"誠";s:3:"誠";s:4:"諭";s:3:"諭";s:4:"變";s:3:"變";s:4:"豕";s:3:"豕";s:4:"𧲨";s:4:"𧲨";s:4:"貫";s:3:"貫";s:4:"賁";s:3:"賁";s:4:"贛";s:3:"贛";s:4:"起";s:3:"起";s:4:"𧼯";s:4:"𧼯";s:4:"𠠄";s:4:"𠠄";s:4:"跋";s:3:"跋";s:4:"趼";s:3:"趼";s:4:"跰";s:3:"跰";s:4:"𠣞";s:4:"𠣞";s:4:"軔";s:3:"軔";s:4:"輸";s:3:"輸";s:4:"𨗒";s:4:"𨗒";s:4:"𨗭";s:4:"𨗭";s:4:"邔";s:3:"邔";s:4:"郱";s:3:"郱";s:4:"鄑";s:3:"鄑";s:4:"𨜮";s:4:"𨜮";s:4:"鄛";s:3:"鄛";s:4:"鈸";s:3:"鈸";s:4:"鋗";s:3:"鋗";s:4:"鋘";s:3:"鋘";s:4:"鉼";s:3:"鉼";s:4:"鏹";s:3:"鏹";s:4:"鐕";s:3:"鐕";s:4:"𨯺";s:4:"𨯺";s:4:"開";s:3:"開";s:4:"䦕";s:3:"䦕";s:4:"閷";s:3:"閷";s:4:"𨵷";s:4:"𨵷";s:4:"䧦";s:3:"䧦";s:4:"雃";s:3:"雃";s:4:"嶲";s:3:"嶲";s:4:"霣";s:3:"霣";s:4:"𩅅";s:4:"𩅅";s:4:"𩈚";s:4:"𩈚";s:4:"䩮";s:3:"䩮";s:4:"䩶";s:3:"䩶";s:4:"韠";s:3:"韠";s:4:"𩐊";s:4:"𩐊";s:4:"䪲";s:3:"䪲";s:4:"𩒖";s:4:"𩒖";s:4:"頋";s:3:"頋";s:4:"頋";s:3:"頋";s:4:"頩";s:3:"頩";s:4:"𩖶";s:4:"𩖶";s:4:"飢";s:3:"飢";s:4:"䬳";s:3:"䬳";s:4:"餩";s:3:"餩";s:4:"馧";s:3:"馧";s:4:"駂";s:3:"駂";s:4:"駾";s:3:"駾";s:4:"䯎";s:3:"䯎";s:4:"𩬰";s:4:"𩬰";s:4:"鬒";s:3:"鬒";s:4:"鱀";s:3:"鱀";s:4:"鳽";s:3:"鳽";s:4:"䳎";s:3:"䳎";s:4:"䳭";s:3:"䳭";s:4:"鵧";s:3:"鵧";s:4:"𪃎";s:4:"𪃎";s:4:"䳸";s:3:"䳸";s:4:"𪄅";s:4:"𪄅";s:4:"𪈎";s:4:"𪈎";s:4:"𪊑";s:4:"𪊑";s:4:"麻";s:3:"麻";s:4:"䵖";s:3:"䵖";s:4:"黹";s:3:"黹";s:4:"黾";s:3:"黾";s:4:"鼅";s:3:"鼅";s:4:"鼏";s:3:"鼏";s:4:"鼖";s:3:"鼖";s:4:"鼻";s:3:"鼻";s:4:"𪘀";s:4:"𪘀";s:2:"Æ";s:2:"AE";s:2:"Ð";s:1:"D";s:2:"Ø";s:1:"O";s:2:"Þ";s:2:"TH";s:2:"ß";s:2:"ss";s:2:"æ";s:2:"ae";s:2:"ð";s:1:"d";s:2:"ø";s:1:"o";s:2:"þ";s:2:"th";s:2:"Đ";s:1:"D";s:2:"đ";s:1:"d";s:2:"Ħ";s:1:"H";s:2:"ħ";s:1:"h";s:2:"ı";s:1:"i";s:2:"ĸ";s:1:"q";s:2:"Ł";s:1:"L";s:2:"ł";s:1:"l";s:2:"Ŋ";s:1:"N";s:2:"ŋ";s:1:"n";s:2:"Œ";s:2:"OE";s:2:"œ";s:2:"oe";s:2:"Ŧ";s:1:"T";s:2:"ŧ";s:1:"t";s:2:"ƀ";s:1:"b";s:2:"Ɓ";s:1:"B";s:2:"Ƃ";s:1:"B";s:2:"ƃ";s:1:"b";s:2:"Ƈ";s:1:"C";s:2:"ƈ";s:1:"c";s:2:"Ɖ";s:1:"D";s:2:"Ɗ";s:1:"D";s:2:"Ƌ";s:1:"D";s:2:"ƌ";s:1:"d";s:2:"Ɛ";s:1:"E";s:2:"Ƒ";s:1:"F";s:2:"ƒ";s:1:"f";s:2:"Ɠ";s:1:"G";s:2:"ƕ";s:2:"hv";s:2:"Ɩ";s:1:"I";s:2:"Ɨ";s:1:"I";s:2:"Ƙ";s:1:"K";s:2:"ƙ";s:1:"k";s:2:"ƚ";s:1:"l";s:2:"Ɲ";s:1:"N";s:2:"ƞ";s:1:"n";s:2:"Ƣ";s:2:"OI";s:2:"ƣ";s:2:"oi";s:2:"Ƥ";s:1:"P";s:2:"ƥ";s:1:"p";s:2:"ƫ";s:1:"t";s:2:"Ƭ";s:1:"T";s:2:"ƭ";s:1:"t";s:2:"Ʈ";s:1:"T";s:2:"Ʋ";s:1:"V";s:2:"Ƴ";s:1:"Y";s:2:"ƴ";s:1:"y";s:2:"Ƶ";s:1:"Z";s:2:"ƶ";s:1:"z";s:2:"Ǥ";s:1:"G";s:2:"ǥ";s:1:"g";s:2:"ȡ";s:1:"d";s:2:"Ȥ";s:1:"Z";s:2:"ȥ";s:1:"z";s:2:"ȴ";s:1:"l";s:2:"ȵ";s:1:"n";s:2:"ȶ";s:1:"t";s:2:"ȷ";s:1:"j";s:2:"ȸ";s:2:"db";s:2:"ȹ";s:2:"qp";s:2:"Ⱥ";s:1:"A";s:2:"Ȼ";s:1:"C";s:2:"ȼ";s:1:"c";s:2:"Ƚ";s:1:"L";s:2:"Ⱦ";s:1:"T";s:2:"ȿ";s:1:"s";s:2:"ɀ";s:1:"z";s:2:"Ƀ";s:1:"B";s:2:"Ʉ";s:1:"U";s:2:"Ɇ";s:1:"E";s:2:"ɇ";s:1:"e";s:2:"Ɉ";s:1:"J";s:2:"ɉ";s:1:"j";s:2:"Ɍ";s:1:"R";s:2:"ɍ";s:1:"r";s:2:"Ɏ";s:1:"Y";s:2:"ɏ";s:1:"y";s:2:"ɓ";s:1:"b";s:2:"ɕ";s:1:"c";s:2:"ɖ";s:1:"d";s:2:"ɗ";s:1:"d";s:2:"ɛ";s:1:"e";s:2:"ɟ";s:1:"j";s:2:"ɠ";s:1:"g";s:2:"ɡ";s:1:"g";s:2:"ɢ";s:1:"G";s:2:"ɦ";s:1:"h";s:2:"ɧ";s:1:"h";s:2:"ɨ";s:1:"i";s:2:"ɪ";s:1:"I";s:2:"ɫ";s:1:"l";s:2:"ɬ";s:1:"l";s:2:"ɭ";s:1:"l";s:2:"ɱ";s:1:"m";s:2:"ɲ";s:1:"n";s:2:"ɳ";s:1:"n";s:2:"ɴ";s:1:"N";s:2:"ɶ";s:2:"OE";s:2:"ɼ";s:1:"r";s:2:"ɽ";s:1:"r";s:2:"ɾ";s:1:"r";s:2:"ʀ";s:1:"R";s:2:"ʂ";s:1:"s";s:2:"ʈ";s:1:"t";s:2:"ʉ";s:1:"u";s:2:"ʋ";s:1:"v";s:2:"ʏ";s:1:"Y";s:2:"ʐ";s:1:"z";s:2:"ʑ";s:1:"z";s:2:"ʙ";s:1:"B";s:2:"ʛ";s:1:"G";s:2:"ʜ";s:1:"H";s:2:"ʝ";s:1:"j";s:2:"ʟ";s:1:"L";s:2:"ʠ";s:1:"q";s:2:"ʣ";s:2:"dz";s:2:"ʥ";s:2:"dz";s:2:"ʦ";s:2:"ts";s:2:"ʪ";s:2:"ls";s:2:"ʫ";s:2:"lz";s:3:"ᴀ";s:1:"A";s:3:"ᴁ";s:2:"AE";s:3:"ᴃ";s:1:"B";s:3:"ᴄ";s:1:"C";s:3:"ᴅ";s:1:"D";s:3:"ᴆ";s:1:"D";s:3:"ᴇ";s:1:"E";s:3:"ᴊ";s:1:"J";s:3:"ᴋ";s:1:"K";s:3:"ᴌ";s:1:"L";s:3:"ᴍ";s:1:"M";s:3:"ᴏ";s:1:"O";s:3:"ᴘ";s:1:"P";s:3:"ᴛ";s:1:"T";s:3:"ᴜ";s:1:"U";s:3:"ᴠ";s:1:"V";s:3:"ᴡ";s:1:"W";s:3:"ᴢ";s:1:"Z";s:3:"ᵫ";s:2:"ue";s:3:"ᵬ";s:1:"b";s:3:"ᵭ";s:1:"d";s:3:"ᵮ";s:1:"f";s:3:"ᵯ";s:1:"m";s:3:"ᵰ";s:1:"n";s:3:"ᵱ";s:1:"p";s:3:"ᵲ";s:1:"r";s:3:"ᵳ";s:1:"r";s:3:"ᵴ";s:1:"s";s:3:"ᵵ";s:1:"t";s:3:"ᵶ";s:1:"z";s:3:"ᵺ";s:2:"th";s:3:"ᵻ";s:1:"I";s:3:"ᵽ";s:1:"p";s:3:"ᵾ";s:1:"U";s:3:"ᶀ";s:1:"b";s:3:"ᶁ";s:1:"d";s:3:"ᶂ";s:1:"f";s:3:"ᶃ";s:1:"g";s:3:"ᶄ";s:1:"k";s:3:"ᶅ";s:1:"l";s:3:"ᶆ";s:1:"m";s:3:"ᶇ";s:1:"n";s:3:"ᶈ";s:1:"p";s:3:"ᶉ";s:1:"r";s:3:"ᶊ";s:1:"s";s:3:"ᶌ";s:1:"v";s:3:"ᶍ";s:1:"x";s:3:"ᶎ";s:1:"z";s:3:"ᶏ";s:1:"a";s:3:"ᶑ";s:1:"d";s:3:"ᶒ";s:1:"e";s:3:"ᶓ";s:1:"e";s:3:"ᶖ";s:1:"i";s:3:"ᶙ";s:1:"u";s:3:"ẜ";s:1:"s";s:3:"ẝ";s:1:"s";s:3:"ẞ";s:2:"SS";s:3:"Ỻ";s:2:"LL";s:3:"ỻ";s:2:"ll";s:3:"Ỽ";s:1:"V";s:3:"ỽ";s:1:"v";s:3:"Ỿ";s:1:"Y";s:3:"ỿ";s:1:"y";s:3:"Ⱡ";s:1:"L";s:3:"ⱡ";s:1:"l";s:3:"Ɫ";s:1:"L";s:3:"Ᵽ";s:1:"P";s:3:"Ɽ";s:1:"R";s:3:"ⱥ";s:1:"a";s:3:"ⱦ";s:1:"t";s:3:"Ⱨ";s:1:"H";s:3:"ⱨ";s:1:"h";s:3:"Ⱪ";s:1:"K";s:3:"ⱪ";s:1:"k";s:3:"Ⱬ";s:1:"Z";s:3:"ⱬ";s:1:"z";s:3:"Ɱ";s:1:"M";s:3:"ⱱ";s:1:"v";s:3:"Ⱳ";s:1:"W";s:3:"ⱳ";s:1:"w";s:3:"ⱴ";s:1:"v";s:3:"ⱸ";s:1:"e";s:3:"ⱺ";s:1:"o";s:3:"Ȿ";s:1:"S";s:3:"Ɀ";s:1:"Z";s:3:"ꜰ";s:1:"F";s:3:"ꜱ";s:1:"S";s:3:"Ꜳ";s:2:"AA";s:3:"ꜳ";s:2:"aa";s:3:"Ꜵ";s:2:"AO";s:3:"ꜵ";s:2:"ao";s:3:"Ꜷ";s:2:"AU";s:3:"ꜷ";s:2:"au";s:3:"Ꜹ";s:2:"AV";s:3:"ꜹ";s:2:"av";s:3:"Ꜻ";s:2:"AV";s:3:"ꜻ";s:2:"av";s:3:"Ꜽ";s:2:"AY";s:3:"ꜽ";s:2:"ay";s:3:"Ꝁ";s:1:"K";s:3:"ꝁ";s:1:"k";s:3:"Ꝃ";s:1:"K";s:3:"ꝃ";s:1:"k";s:3:"Ꝅ";s:1:"K";s:3:"ꝅ";s:1:"k";s:3:"Ꝇ";s:1:"L";s:3:"ꝇ";s:1:"l";s:3:"Ꝉ";s:1:"L";s:3:"ꝉ";s:1:"l";s:3:"Ꝋ";s:1:"O";s:3:"ꝋ";s:1:"o";s:3:"Ꝍ";s:1:"O";s:3:"ꝍ";s:1:"o";s:3:"Ꝏ";s:2:"OO";s:3:"ꝏ";s:2:"oo";s:3:"Ꝑ";s:1:"P";s:3:"ꝑ";s:1:"p";s:3:"Ꝓ";s:1:"P";s:3:"ꝓ";s:1:"p";s:3:"Ꝕ";s:1:"P";s:3:"ꝕ";s:1:"p";s:3:"Ꝗ";s:1:"Q";s:3:"ꝗ";s:1:"q";s:3:"Ꝙ";s:1:"Q";s:3:"ꝙ";s:1:"q";s:3:"Ꝟ";s:1:"V";s:3:"ꝟ";s:1:"v";s:3:"Ꝡ";s:2:"VY";s:3:"ꝡ";s:2:"vy";s:3:"Ꝥ";s:2:"TH";s:3:"ꝥ";s:2:"th";s:3:"Ꝧ";s:2:"TH";s:3:"ꝧ";s:2:"th";s:3:"ꝱ";s:1:"d";s:3:"ꝲ";s:1:"l";s:3:"ꝳ";s:1:"m";s:3:"ꝴ";s:1:"n";s:3:"ꝵ";s:1:"r";s:3:"ꝶ";s:1:"R";s:3:"ꝷ";s:1:"t";s:3:"Ꝺ";s:1:"D";s:3:"ꝺ";s:1:"d";s:3:"Ꝼ";s:1:"F";s:3:"ꝼ";s:1:"f";s:3:"Ꞇ";s:1:"T";s:3:"ꞇ";s:1:"t";s:3:"Ꞑ";s:1:"N";s:3:"ꞑ";s:1:"n";s:3:"Ꞓ";s:1:"C";s:3:"ꞓ";s:1:"c";s:3:"Ꞡ";s:1:"G";s:3:"ꞡ";s:1:"g";s:3:"Ꞣ";s:1:"K";s:3:"ꞣ";s:1:"k";s:3:"Ꞥ";s:1:"N";s:3:"ꞥ";s:1:"n";s:3:"Ꞧ";s:1:"R";s:3:"ꞧ";s:1:"r";s:3:"Ꞩ";s:1:"S";s:3:"ꞩ";s:1:"s";s:3:"Ɦ";s:1:"H";s:2:"©";s:3:"(C)";s:2:"®";s:3:"(R)";s:3:"₠";s:2:"CE";s:3:"₢";s:2:"Cr";s:3:"₣";s:3:"Fr.";s:3:"₤";s:2:"L.";s:3:"₧";s:3:"Pts";s:3:"₺";s:2:"TL";s:3:"₹";s:2:"Rs";s:3:"℗";s:3:"(P)";s:3:"℘";s:1:"P";s:3:"℞";s:2:"Rx";s:3:"〇";s:1:"0";s:2:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:2:"ʹ";s:1:"'";s:2:"ʺ";s:1:""";s:2:"ʻ";s:1:"'";s:2:"ʼ";s:1:"'";s:2:"ʽ";s:1:"'";s:2:"ˈ";s:1:"'";s:2:"ˋ";s:1:"`";s:3:"‘";s:1:"'";s:3:"’";s:1:"'";s:3:"‚";s:1:",";s:3:"‛";s:1:"'";s:3:"“";s:1:""";s:3:"”";s:1:""";s:3:"„";s:2:",,";s:3:"‟";s:1:""";s:3:"′";s:1:"'";s:3:"〝";s:1:""";s:3:"〞";s:1:""";s:2:"«";s:2:"<<";s:2:"»";s:2:">>";s:3:"‹";s:1:"<";s:3:"›";s:1:">";s:2:"­";s:1:"-";s:3:"‐";s:1:"-";s:3:"‑";s:1:"-";s:3:"‒";s:1:"-";s:3:"–";s:1:"-";s:3:"—";s:1:"-";s:3:"―";s:1:"-";s:3:"︱";s:1:"-";s:3:"︲";s:1:"-";s:2:"˂";s:1:"<";s:2:"˃";s:1:">";s:2:"˄";s:1:"^";s:2:"ˆ";s:1:"^";s:2:"ː";s:1:":";s:2:"˜";s:1:"~";s:3:"‖";s:2:"||";s:3:"⁄";s:1:"/";s:3:"⁅";s:1:"[";s:3:"⁆";s:1:"]";s:3:"⁎";s:1:"*";s:3:"、";s:1:",";s:3:"。";s:1:".";s:3:"〈";s:1:"<";s:3:"〉";s:1:">";s:3:"《";s:2:"<<";s:3:"》";s:2:">>";s:3:"〔";s:1:"[";s:3:"〕";s:1:"]";s:3:"〘";s:1:"[";s:3:"〙";s:1:"]";s:3:"〚";s:1:"[";s:3:"〛";s:1:"]";s:3:"︐";s:1:",";s:3:"︑";s:1:",";s:3:"︒";s:1:".";s:3:"︓";s:1:":";s:3:"︔";s:1:";";s:3:"︕";s:1:"!";s:3:"︖";s:1:"?";s:3:"︙";s:3:"...";s:3:"︰";s:2:"..";s:3:"︵";s:1:"(";s:3:"︶";s:1:")";s:3:"︷";s:1:"{";s:3:"︸";s:1:"}";s:3:"︹";s:1:"[";s:3:"︺";s:1:"]";s:3:"︽";s:2:"<<";s:3:"︾";s:2:">>";s:3:"︿";s:1:"<";s:3:"﹀";s:1:">";s:3:"﹇";s:1:"[";s:3:"﹈";s:1:"]";s:2:"×";s:1:"*";s:2:"÷";s:1:"/";s:2:"˖";s:1:"+";s:2:"˗";s:1:"-";s:3:"−";s:1:"-";s:3:"∕";s:1:"/";s:3:"∖";s:1:"\";s:3:"∣";s:1:"|";s:3:"∥";s:2:"||";s:3:"≪";s:2:"<<";s:3:"≫";s:2:">>";s:3:"⦅";s:2:"((";s:3:"⦆";s:2:"))";} \ No newline at end of file diff --git a/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/combiningClass.ser b/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/combiningClass.ser index 9a52768..99073a7 100644 --- a/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/combiningClass.ser +++ b/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/combiningClass.ser @@ -1 +1 @@ -a:745:{s:2:"̀";i:230;s:2:"́";i:230;s:2:"̂";i:230;s:2:"̃";i:230;s:2:"̄";i:230;s:2:"̅";i:230;s:2:"̆";i:230;s:2:"̇";i:230;s:2:"̈";i:230;s:2:"̉";i:230;s:2:"̊";i:230;s:2:"̋";i:230;s:2:"̌";i:230;s:2:"̍";i:230;s:2:"̎";i:230;s:2:"̏";i:230;s:2:"̐";i:230;s:2:"̑";i:230;s:2:"̒";i:230;s:2:"̓";i:230;s:2:"̔";i:230;s:2:"̕";i:232;s:2:"̖";i:220;s:2:"̗";i:220;s:2:"̘";i:220;s:2:"̙";i:220;s:2:"̚";i:232;s:2:"̛";i:216;s:2:"̜";i:220;s:2:"̝";i:220;s:2:"̞";i:220;s:2:"̟";i:220;s:2:"̠";i:220;s:2:"̡";i:202;s:2:"̢";i:202;s:2:"̣";i:220;s:2:"̤";i:220;s:2:"̥";i:220;s:2:"̦";i:220;s:2:"̧";i:202;s:2:"̨";i:202;s:2:"̩";i:220;s:2:"̪";i:220;s:2:"̫";i:220;s:2:"̬";i:220;s:2:"̭";i:220;s:2:"̮";i:220;s:2:"̯";i:220;s:2:"̰";i:220;s:2:"̱";i:220;s:2:"̲";i:220;s:2:"̳";i:220;s:2:"̴";i:1;s:2:"̵";i:1;s:2:"̶";i:1;s:2:"̷";i:1;s:2:"̸";i:1;s:2:"̹";i:220;s:2:"̺";i:220;s:2:"̻";i:220;s:2:"̼";i:220;s:2:"̽";i:230;s:2:"̾";i:230;s:2:"̿";i:230;s:2:"̀";i:230;s:2:"́";i:230;s:2:"͂";i:230;s:2:"̓";i:230;s:2:"̈́";i:230;s:2:"ͅ";i:240;s:2:"͆";i:230;s:2:"͇";i:220;s:2:"͈";i:220;s:2:"͉";i:220;s:2:"͊";i:230;s:2:"͋";i:230;s:2:"͌";i:230;s:2:"͍";i:220;s:2:"͎";i:220;s:2:"͐";i:230;s:2:"͑";i:230;s:2:"͒";i:230;s:2:"͓";i:220;s:2:"͔";i:220;s:2:"͕";i:220;s:2:"͖";i:220;s:2:"͗";i:230;s:2:"͘";i:232;s:2:"͙";i:220;s:2:"͚";i:220;s:2:"͛";i:230;s:2:"͜";i:233;s:2:"͝";i:234;s:2:"͞";i:234;s:2:"͟";i:233;s:2:"͠";i:234;s:2:"͡";i:234;s:2:"͢";i:233;s:2:"ͣ";i:230;s:2:"ͤ";i:230;s:2:"ͥ";i:230;s:2:"ͦ";i:230;s:2:"ͧ";i:230;s:2:"ͨ";i:230;s:2:"ͩ";i:230;s:2:"ͪ";i:230;s:2:"ͫ";i:230;s:2:"ͬ";i:230;s:2:"ͭ";i:230;s:2:"ͮ";i:230;s:2:"ͯ";i:230;s:2:"҃";i:230;s:2:"҄";i:230;s:2:"҅";i:230;s:2:"҆";i:230;s:2:"҇";i:230;s:2:"֑";i:220;s:2:"֒";i:230;s:2:"֓";i:230;s:2:"֔";i:230;s:2:"֕";i:230;s:2:"֖";i:220;s:2:"֗";i:230;s:2:"֘";i:230;s:2:"֙";i:230;s:2:"֚";i:222;s:2:"֛";i:220;s:2:"֜";i:230;s:2:"֝";i:230;s:2:"֞";i:230;s:2:"֟";i:230;s:2:"֠";i:230;s:2:"֡";i:230;s:2:"֢";i:220;s:2:"֣";i:220;s:2:"֤";i:220;s:2:"֥";i:220;s:2:"֦";i:220;s:2:"֧";i:220;s:2:"֨";i:230;s:2:"֩";i:230;s:2:"֪";i:220;s:2:"֫";i:230;s:2:"֬";i:230;s:2:"֭";i:222;s:2:"֮";i:228;s:2:"֯";i:230;s:2:"ְ";i:10;s:2:"ֱ";i:11;s:2:"ֲ";i:12;s:2:"ֳ";i:13;s:2:"ִ";i:14;s:2:"ֵ";i:15;s:2:"ֶ";i:16;s:2:"ַ";i:17;s:2:"ָ";i:18;s:2:"ֹ";i:19;s:2:"ֺ";i:19;s:2:"ֻ";i:20;s:2:"ּ";i:21;s:2:"ֽ";i:22;s:2:"ֿ";i:23;s:2:"ׁ";i:24;s:2:"ׂ";i:25;s:2:"ׄ";i:230;s:2:"ׅ";i:220;s:2:"ׇ";i:18;s:2:"ؐ";i:230;s:2:"ؑ";i:230;s:2:"ؒ";i:230;s:2:"ؓ";i:230;s:2:"ؔ";i:230;s:2:"ؕ";i:230;s:2:"ؖ";i:230;s:2:"ؗ";i:230;s:2:"ؘ";i:30;s:2:"ؙ";i:31;s:2:"ؚ";i:32;s:2:"ً";i:27;s:2:"ٌ";i:28;s:2:"ٍ";i:29;s:2:"َ";i:30;s:2:"ُ";i:31;s:2:"ِ";i:32;s:2:"ّ";i:33;s:2:"ْ";i:34;s:2:"ٓ";i:230;s:2:"ٔ";i:230;s:2:"ٕ";i:220;s:2:"ٖ";i:220;s:2:"ٗ";i:230;s:2:"٘";i:230;s:2:"ٙ";i:230;s:2:"ٚ";i:230;s:2:"ٛ";i:230;s:2:"ٜ";i:220;s:2:"ٝ";i:230;s:2:"ٞ";i:230;s:2:"ٟ";i:220;s:2:"ٰ";i:35;s:2:"ۖ";i:230;s:2:"ۗ";i:230;s:2:"ۘ";i:230;s:2:"ۙ";i:230;s:2:"ۚ";i:230;s:2:"ۛ";i:230;s:2:"ۜ";i:230;s:2:"۟";i:230;s:2:"۠";i:230;s:2:"ۡ";i:230;s:2:"ۢ";i:230;s:2:"ۣ";i:220;s:2:"ۤ";i:230;s:2:"ۧ";i:230;s:2:"ۨ";i:230;s:2:"۪";i:220;s:2:"۫";i:230;s:2:"۬";i:230;s:2:"ۭ";i:220;s:2:"ܑ";i:36;s:2:"ܰ";i:230;s:2:"ܱ";i:220;s:2:"ܲ";i:230;s:2:"ܳ";i:230;s:2:"ܴ";i:220;s:2:"ܵ";i:230;s:2:"ܶ";i:230;s:2:"ܷ";i:220;s:2:"ܸ";i:220;s:2:"ܹ";i:220;s:2:"ܺ";i:230;s:2:"ܻ";i:220;s:2:"ܼ";i:220;s:2:"ܽ";i:230;s:2:"ܾ";i:220;s:2:"ܿ";i:230;s:2:"݀";i:230;s:2:"݁";i:230;s:2:"݂";i:220;s:2:"݃";i:230;s:2:"݄";i:220;s:2:"݅";i:230;s:2:"݆";i:220;s:2:"݇";i:230;s:2:"݈";i:220;s:2:"݉";i:230;s:2:"݊";i:230;s:2:"߫";i:230;s:2:"߬";i:230;s:2:"߭";i:230;s:2:"߮";i:230;s:2:"߯";i:230;s:2:"߰";i:230;s:2:"߱";i:230;s:2:"߲";i:220;s:2:"߳";i:230;s:3:"ࠖ";i:230;s:3:"ࠗ";i:230;s:3:"࠘";i:230;s:3:"࠙";i:230;s:3:"ࠛ";i:230;s:3:"ࠜ";i:230;s:3:"ࠝ";i:230;s:3:"ࠞ";i:230;s:3:"ࠟ";i:230;s:3:"ࠠ";i:230;s:3:"ࠡ";i:230;s:3:"ࠢ";i:230;s:3:"ࠣ";i:230;s:3:"ࠥ";i:230;s:3:"ࠦ";i:230;s:3:"ࠧ";i:230;s:3:"ࠩ";i:230;s:3:"ࠪ";i:230;s:3:"ࠫ";i:230;s:3:"ࠬ";i:230;s:3:"࠭";i:230;s:3:"࡙";i:220;s:3:"࡚";i:220;s:3:"࡛";i:220;s:3:"ࣤ";i:230;s:3:"ࣥ";i:230;s:3:"ࣦ";i:220;s:3:"ࣧ";i:230;s:3:"ࣨ";i:230;s:3:"ࣩ";i:220;s:3:"࣪";i:230;s:3:"࣫";i:230;s:3:"࣬";i:230;s:3:"࣭";i:220;s:3:"࣮";i:220;s:3:"࣯";i:220;s:3:"ࣰ";i:27;s:3:"ࣱ";i:28;s:3:"ࣲ";i:29;s:3:"ࣳ";i:230;s:3:"ࣴ";i:230;s:3:"ࣵ";i:230;s:3:"ࣶ";i:220;s:3:"ࣷ";i:230;s:3:"ࣸ";i:230;s:3:"ࣹ";i:220;s:3:"ࣺ";i:220;s:3:"ࣻ";i:230;s:3:"ࣼ";i:230;s:3:"ࣽ";i:230;s:3:"ࣾ";i:230;s:3:"ࣿ";i:230;s:3:"़";i:7;s:3:"्";i:9;s:3:"॑";i:230;s:3:"॒";i:220;s:3:"॓";i:230;s:3:"॔";i:230;s:3:"়";i:7;s:3:"্";i:9;s:3:"਼";i:7;s:3:"੍";i:9;s:3:"઼";i:7;s:3:"્";i:9;s:3:"଼";i:7;s:3:"୍";i:9;s:3:"்";i:9;s:3:"్";i:9;s:3:"ౕ";i:84;s:3:"ౖ";i:91;s:3:"಼";i:7;s:3:"್";i:9;s:3:"്";i:9;s:3:"්";i:9;s:3:"ุ";i:103;s:3:"ู";i:103;s:3:"ฺ";i:9;s:3:"่";i:107;s:3:"้";i:107;s:3:"๊";i:107;s:3:"๋";i:107;s:3:"ຸ";i:118;s:3:"ູ";i:118;s:3:"່";i:122;s:3:"້";i:122;s:3:"໊";i:122;s:3:"໋";i:122;s:3:"༘";i:220;s:3:"༙";i:220;s:3:"༵";i:220;s:3:"༷";i:220;s:3:"༹";i:216;s:3:"ཱ";i:129;s:3:"ི";i:130;s:3:"ུ";i:132;s:3:"ེ";i:130;s:3:"ཻ";i:130;s:3:"ོ";i:130;s:3:"ཽ";i:130;s:3:"ྀ";i:130;s:3:"ྂ";i:230;s:3:"ྃ";i:230;s:3:"྄";i:9;s:3:"྆";i:230;s:3:"྇";i:230;s:3:"࿆";i:220;s:3:"့";i:7;s:3:"္";i:9;s:3:"်";i:9;s:3:"ႍ";i:220;s:3:"፝";i:230;s:3:"፞";i:230;s:3:"፟";i:230;s:3:"᜔";i:9;s:3:"᜴";i:9;s:3:"្";i:9;s:3:"៝";i:230;s:3:"ᢩ";i:228;s:3:"᤹";i:222;s:3:"᤺";i:230;s:3:"᤻";i:220;s:3:"ᨗ";i:230;s:3:"ᨘ";i:220;s:3:"᩠";i:9;s:3:"᩵";i:230;s:3:"᩶";i:230;s:3:"᩷";i:230;s:3:"᩸";i:230;s:3:"᩹";i:230;s:3:"᩺";i:230;s:3:"᩻";i:230;s:3:"᩼";i:230;s:3:"᩿";i:220;s:3:"᪰";i:230;s:3:"᪱";i:230;s:3:"᪲";i:230;s:3:"᪳";i:230;s:3:"᪴";i:230;s:3:"᪵";i:220;s:3:"᪶";i:220;s:3:"᪷";i:220;s:3:"᪸";i:220;s:3:"᪹";i:220;s:3:"᪺";i:220;s:3:"᪻";i:230;s:3:"᪼";i:230;s:3:"᪽";i:220;s:3:"᬴";i:7;s:3:"᭄";i:9;s:3:"᭫";i:230;s:3:"᭬";i:220;s:3:"᭭";i:230;s:3:"᭮";i:230;s:3:"᭯";i:230;s:3:"᭰";i:230;s:3:"᭱";i:230;s:3:"᭲";i:230;s:3:"᭳";i:230;s:3:"᮪";i:9;s:3:"᮫";i:9;s:3:"᯦";i:7;s:3:"᯲";i:9;s:3:"᯳";i:9;s:3:"᰷";i:7;s:3:"᳐";i:230;s:3:"᳑";i:230;s:3:"᳒";i:230;s:3:"᳔";i:1;s:3:"᳕";i:220;s:3:"᳖";i:220;s:3:"᳗";i:220;s:3:"᳘";i:220;s:3:"᳙";i:220;s:3:"᳚";i:230;s:3:"᳛";i:230;s:3:"᳜";i:220;s:3:"᳝";i:220;s:3:"᳞";i:220;s:3:"᳟";i:220;s:3:"᳠";i:230;s:3:"᳢";i:1;s:3:"᳣";i:1;s:3:"᳤";i:1;s:3:"᳥";i:1;s:3:"᳦";i:1;s:3:"᳧";i:1;s:3:"᳨";i:1;s:3:"᳭";i:220;s:3:"᳴";i:230;s:3:"᳸";i:230;s:3:"᳹";i:230;s:3:"᷀";i:230;s:3:"᷁";i:230;s:3:"᷂";i:220;s:3:"᷃";i:230;s:3:"᷄";i:230;s:3:"᷅";i:230;s:3:"᷆";i:230;s:3:"᷇";i:230;s:3:"᷈";i:230;s:3:"᷉";i:230;s:3:"᷊";i:220;s:3:"᷋";i:230;s:3:"᷌";i:230;s:3:"᷍";i:234;s:3:"᷎";i:214;s:3:"᷏";i:220;s:3:"᷐";i:202;s:3:"᷑";i:230;s:3:"᷒";i:230;s:3:"ᷓ";i:230;s:3:"ᷔ";i:230;s:3:"ᷕ";i:230;s:3:"ᷖ";i:230;s:3:"ᷗ";i:230;s:3:"ᷘ";i:230;s:3:"ᷙ";i:230;s:3:"ᷚ";i:230;s:3:"ᷛ";i:230;s:3:"ᷜ";i:230;s:3:"ᷝ";i:230;s:3:"ᷞ";i:230;s:3:"ᷟ";i:230;s:3:"ᷠ";i:230;s:3:"ᷡ";i:230;s:3:"ᷢ";i:230;s:3:"ᷣ";i:230;s:3:"ᷤ";i:230;s:3:"ᷥ";i:230;s:3:"ᷦ";i:230;s:3:"ᷧ";i:230;s:3:"ᷨ";i:230;s:3:"ᷩ";i:230;s:3:"ᷪ";i:230;s:3:"ᷫ";i:230;s:3:"ᷬ";i:230;s:3:"ᷭ";i:230;s:3:"ᷮ";i:230;s:3:"ᷯ";i:230;s:3:"ᷰ";i:230;s:3:"ᷱ";i:230;s:3:"ᷲ";i:230;s:3:"ᷳ";i:230;s:3:"ᷴ";i:230;s:3:"᷵";i:230;s:3:"᷼";i:233;s:3:"᷽";i:220;s:3:"᷾";i:230;s:3:"᷿";i:220;s:3:"⃐";i:230;s:3:"⃑";i:230;s:3:"⃒";i:1;s:3:"⃓";i:1;s:3:"⃔";i:230;s:3:"⃕";i:230;s:3:"⃖";i:230;s:3:"⃗";i:230;s:3:"⃘";i:1;s:3:"⃙";i:1;s:3:"⃚";i:1;s:3:"⃛";i:230;s:3:"⃜";i:230;s:3:"⃡";i:230;s:3:"⃥";i:1;s:3:"⃦";i:1;s:3:"⃧";i:230;s:3:"⃨";i:220;s:3:"⃩";i:230;s:3:"⃪";i:1;s:3:"⃫";i:1;s:3:"⃬";i:220;s:3:"⃭";i:220;s:3:"⃮";i:220;s:3:"⃯";i:220;s:3:"⃰";i:230;s:3:"⳯";i:230;s:3:"⳰";i:230;s:3:"⳱";i:230;s:3:"⵿";i:9;s:3:"ⷠ";i:230;s:3:"ⷡ";i:230;s:3:"ⷢ";i:230;s:3:"ⷣ";i:230;s:3:"ⷤ";i:230;s:3:"ⷥ";i:230;s:3:"ⷦ";i:230;s:3:"ⷧ";i:230;s:3:"ⷨ";i:230;s:3:"ⷩ";i:230;s:3:"ⷪ";i:230;s:3:"ⷫ";i:230;s:3:"ⷬ";i:230;s:3:"ⷭ";i:230;s:3:"ⷮ";i:230;s:3:"ⷯ";i:230;s:3:"ⷰ";i:230;s:3:"ⷱ";i:230;s:3:"ⷲ";i:230;s:3:"ⷳ";i:230;s:3:"ⷴ";i:230;s:3:"ⷵ";i:230;s:3:"ⷶ";i:230;s:3:"ⷷ";i:230;s:3:"ⷸ";i:230;s:3:"ⷹ";i:230;s:3:"ⷺ";i:230;s:3:"ⷻ";i:230;s:3:"ⷼ";i:230;s:3:"ⷽ";i:230;s:3:"ⷾ";i:230;s:3:"ⷿ";i:230;s:3:"〪";i:218;s:3:"〫";i:228;s:3:"〬";i:232;s:3:"〭";i:222;s:3:"〮";i:224;s:3:"〯";i:224;s:3:"゙";i:8;s:3:"゚";i:8;s:3:"꙯";i:230;s:3:"ꙴ";i:230;s:3:"ꙵ";i:230;s:3:"ꙶ";i:230;s:3:"ꙷ";i:230;s:3:"ꙸ";i:230;s:3:"ꙹ";i:230;s:3:"ꙺ";i:230;s:3:"ꙻ";i:230;s:3:"꙼";i:230;s:3:"꙽";i:230;s:3:"ꚟ";i:230;s:3:"꛰";i:230;s:3:"꛱";i:230;s:3:"꠆";i:9;s:3:"꣄";i:9;s:3:"꣠";i:230;s:3:"꣡";i:230;s:3:"꣢";i:230;s:3:"꣣";i:230;s:3:"꣤";i:230;s:3:"꣥";i:230;s:3:"꣦";i:230;s:3:"꣧";i:230;s:3:"꣨";i:230;s:3:"꣩";i:230;s:3:"꣪";i:230;s:3:"꣫";i:230;s:3:"꣬";i:230;s:3:"꣭";i:230;s:3:"꣮";i:230;s:3:"꣯";i:230;s:3:"꣰";i:230;s:3:"꣱";i:230;s:3:"꤫";i:220;s:3:"꤬";i:220;s:3:"꤭";i:220;s:3:"꥓";i:9;s:3:"꦳";i:7;s:3:"꧀";i:9;s:3:"ꪰ";i:230;s:3:"ꪲ";i:230;s:3:"ꪳ";i:230;s:3:"ꪴ";i:220;s:3:"ꪷ";i:230;s:3:"ꪸ";i:230;s:3:"ꪾ";i:230;s:3:"꪿";i:230;s:3:"꫁";i:230;s:3:"꫶";i:9;s:3:"꯭";i:9;s:3:"ﬞ";i:26;s:3:"︠";i:230;s:3:"︡";i:230;s:3:"︢";i:230;s:3:"︣";i:230;s:3:"︤";i:230;s:3:"︥";i:230;s:3:"︦";i:230;s:3:"︧";i:220;s:3:"︨";i:220;s:3:"︩";i:220;s:3:"︪";i:220;s:3:"︫";i:220;s:3:"︬";i:220;s:3:"︭";i:220;s:4:"𐇽";i:220;s:4:"𐋠";i:220;s:4:"𐍶";i:230;s:4:"𐍷";i:230;s:4:"𐍸";i:230;s:4:"𐍹";i:230;s:4:"𐍺";i:230;s:4:"𐨍";i:220;s:4:"𐨏";i:230;s:4:"𐨸";i:230;s:4:"𐨹";i:1;s:4:"𐨺";i:220;s:4:"𐨿";i:9;s:4:"𐫥";i:230;s:4:"𐫦";i:220;s:4:"𑁆";i:9;s:4:"𑁿";i:9;s:4:"𑂹";i:9;s:4:"𑂺";i:7;s:4:"𑄀";i:230;s:4:"𑄁";i:230;s:4:"𑄂";i:230;s:4:"𑄳";i:9;s:4:"𑄴";i:9;s:4:"𑅳";i:7;s:4:"𑇀";i:9;s:4:"𑈵";i:9;s:4:"𑈶";i:7;s:4:"𑋩";i:7;s:4:"𑋪";i:9;s:4:"𑌼";i:7;s:4:"𑍍";i:9;s:4:"𑍦";i:230;s:4:"𑍧";i:230;s:4:"𑍨";i:230;s:4:"𑍩";i:230;s:4:"𑍪";i:230;s:4:"𑍫";i:230;s:4:"𑍬";i:230;s:4:"𑍰";i:230;s:4:"𑍱";i:230;s:4:"𑍲";i:230;s:4:"𑍳";i:230;s:4:"𑍴";i:230;s:4:"𑓂";i:9;s:4:"𑓃";i:7;s:4:"𑖿";i:9;s:4:"𑗀";i:7;s:4:"𑘿";i:9;s:4:"𑚶";i:9;s:4:"𑚷";i:7;s:4:"𖫰";i:1;s:4:"𖫱";i:1;s:4:"𖫲";i:1;s:4:"𖫳";i:1;s:4:"𖫴";i:1;s:4:"𖬰";i:230;s:4:"𖬱";i:230;s:4:"𖬲";i:230;s:4:"𖬳";i:230;s:4:"𖬴";i:230;s:4:"𖬵";i:230;s:4:"𖬶";i:230;s:4:"𛲞";i:1;s:4:"𝅥";i:216;s:4:"𝅦";i:216;s:4:"𝅧";i:1;s:4:"𝅨";i:1;s:4:"𝅩";i:1;s:4:"𝅭";i:226;s:4:"𝅮";i:216;s:4:"𝅯";i:216;s:4:"𝅰";i:216;s:4:"𝅱";i:216;s:4:"𝅲";i:216;s:4:"𝅻";i:220;s:4:"𝅼";i:220;s:4:"𝅽";i:220;s:4:"𝅾";i:220;s:4:"𝅿";i:220;s:4:"𝆀";i:220;s:4:"𝆁";i:220;s:4:"𝆂";i:220;s:4:"𝆅";i:230;s:4:"𝆆";i:230;s:4:"𝆇";i:230;s:4:"𝆈";i:230;s:4:"𝆉";i:230;s:4:"𝆊";i:220;s:4:"𝆋";i:220;s:4:"𝆪";i:230;s:4:"𝆫";i:230;s:4:"𝆬";i:230;s:4:"𝆭";i:230;s:4:"𝉂";i:230;s:4:"𝉃";i:230;s:4:"𝉄";i:230;s:4:"𞣐";i:220;s:4:"𞣑";i:220;s:4:"𞣒";i:220;s:4:"𞣓";i:220;s:4:"𞣔";i:220;s:4:"𞣕";i:220;s:4:"𞣖";i:220;} \ No newline at end of file +a:862:{s:2:"̀";i:230;s:2:"́";i:230;s:2:"̂";i:230;s:2:"̃";i:230;s:2:"̄";i:230;s:2:"̅";i:230;s:2:"̆";i:230;s:2:"̇";i:230;s:2:"̈";i:230;s:2:"̉";i:230;s:2:"̊";i:230;s:2:"̋";i:230;s:2:"̌";i:230;s:2:"̍";i:230;s:2:"̎";i:230;s:2:"̏";i:230;s:2:"̐";i:230;s:2:"̑";i:230;s:2:"̒";i:230;s:2:"̓";i:230;s:2:"̔";i:230;s:2:"̕";i:232;s:2:"̖";i:220;s:2:"̗";i:220;s:2:"̘";i:220;s:2:"̙";i:220;s:2:"̚";i:232;s:2:"̛";i:216;s:2:"̜";i:220;s:2:"̝";i:220;s:2:"̞";i:220;s:2:"̟";i:220;s:2:"̠";i:220;s:2:"̡";i:202;s:2:"̢";i:202;s:2:"̣";i:220;s:2:"̤";i:220;s:2:"̥";i:220;s:2:"̦";i:220;s:2:"̧";i:202;s:2:"̨";i:202;s:2:"̩";i:220;s:2:"̪";i:220;s:2:"̫";i:220;s:2:"̬";i:220;s:2:"̭";i:220;s:2:"̮";i:220;s:2:"̯";i:220;s:2:"̰";i:220;s:2:"̱";i:220;s:2:"̲";i:220;s:2:"̳";i:220;s:2:"̴";i:1;s:2:"̵";i:1;s:2:"̶";i:1;s:2:"̷";i:1;s:2:"̸";i:1;s:2:"̹";i:220;s:2:"̺";i:220;s:2:"̻";i:220;s:2:"̼";i:220;s:2:"̽";i:230;s:2:"̾";i:230;s:2:"̿";i:230;s:2:"̀";i:230;s:2:"́";i:230;s:2:"͂";i:230;s:2:"̓";i:230;s:2:"̈́";i:230;s:2:"ͅ";i:240;s:2:"͆";i:230;s:2:"͇";i:220;s:2:"͈";i:220;s:2:"͉";i:220;s:2:"͊";i:230;s:2:"͋";i:230;s:2:"͌";i:230;s:2:"͍";i:220;s:2:"͎";i:220;s:2:"͐";i:230;s:2:"͑";i:230;s:2:"͒";i:230;s:2:"͓";i:220;s:2:"͔";i:220;s:2:"͕";i:220;s:2:"͖";i:220;s:2:"͗";i:230;s:2:"͘";i:232;s:2:"͙";i:220;s:2:"͚";i:220;s:2:"͛";i:230;s:2:"͜";i:233;s:2:"͝";i:234;s:2:"͞";i:234;s:2:"͟";i:233;s:2:"͠";i:234;s:2:"͡";i:234;s:2:"͢";i:233;s:2:"ͣ";i:230;s:2:"ͤ";i:230;s:2:"ͥ";i:230;s:2:"ͦ";i:230;s:2:"ͧ";i:230;s:2:"ͨ";i:230;s:2:"ͩ";i:230;s:2:"ͪ";i:230;s:2:"ͫ";i:230;s:2:"ͬ";i:230;s:2:"ͭ";i:230;s:2:"ͮ";i:230;s:2:"ͯ";i:230;s:2:"҃";i:230;s:2:"҄";i:230;s:2:"҅";i:230;s:2:"҆";i:230;s:2:"҇";i:230;s:2:"֑";i:220;s:2:"֒";i:230;s:2:"֓";i:230;s:2:"֔";i:230;s:2:"֕";i:230;s:2:"֖";i:220;s:2:"֗";i:230;s:2:"֘";i:230;s:2:"֙";i:230;s:2:"֚";i:222;s:2:"֛";i:220;s:2:"֜";i:230;s:2:"֝";i:230;s:2:"֞";i:230;s:2:"֟";i:230;s:2:"֠";i:230;s:2:"֡";i:230;s:2:"֢";i:220;s:2:"֣";i:220;s:2:"֤";i:220;s:2:"֥";i:220;s:2:"֦";i:220;s:2:"֧";i:220;s:2:"֨";i:230;s:2:"֩";i:230;s:2:"֪";i:220;s:2:"֫";i:230;s:2:"֬";i:230;s:2:"֭";i:222;s:2:"֮";i:228;s:2:"֯";i:230;s:2:"ְ";i:10;s:2:"ֱ";i:11;s:2:"ֲ";i:12;s:2:"ֳ";i:13;s:2:"ִ";i:14;s:2:"ֵ";i:15;s:2:"ֶ";i:16;s:2:"ַ";i:17;s:2:"ָ";i:18;s:2:"ֹ";i:19;s:2:"ֺ";i:19;s:2:"ֻ";i:20;s:2:"ּ";i:21;s:2:"ֽ";i:22;s:2:"ֿ";i:23;s:2:"ׁ";i:24;s:2:"ׂ";i:25;s:2:"ׄ";i:230;s:2:"ׅ";i:220;s:2:"ׇ";i:18;s:2:"ؐ";i:230;s:2:"ؑ";i:230;s:2:"ؒ";i:230;s:2:"ؓ";i:230;s:2:"ؔ";i:230;s:2:"ؕ";i:230;s:2:"ؖ";i:230;s:2:"ؗ";i:230;s:2:"ؘ";i:30;s:2:"ؙ";i:31;s:2:"ؚ";i:32;s:2:"ً";i:27;s:2:"ٌ";i:28;s:2:"ٍ";i:29;s:2:"َ";i:30;s:2:"ُ";i:31;s:2:"ِ";i:32;s:2:"ّ";i:33;s:2:"ْ";i:34;s:2:"ٓ";i:230;s:2:"ٔ";i:230;s:2:"ٕ";i:220;s:2:"ٖ";i:220;s:2:"ٗ";i:230;s:2:"٘";i:230;s:2:"ٙ";i:230;s:2:"ٚ";i:230;s:2:"ٛ";i:230;s:2:"ٜ";i:220;s:2:"ٝ";i:230;s:2:"ٞ";i:230;s:2:"ٟ";i:220;s:2:"ٰ";i:35;s:2:"ۖ";i:230;s:2:"ۗ";i:230;s:2:"ۘ";i:230;s:2:"ۙ";i:230;s:2:"ۚ";i:230;s:2:"ۛ";i:230;s:2:"ۜ";i:230;s:2:"۟";i:230;s:2:"۠";i:230;s:2:"ۡ";i:230;s:2:"ۢ";i:230;s:2:"ۣ";i:220;s:2:"ۤ";i:230;s:2:"ۧ";i:230;s:2:"ۨ";i:230;s:2:"۪";i:220;s:2:"۫";i:230;s:2:"۬";i:230;s:2:"ۭ";i:220;s:2:"ܑ";i:36;s:2:"ܰ";i:230;s:2:"ܱ";i:220;s:2:"ܲ";i:230;s:2:"ܳ";i:230;s:2:"ܴ";i:220;s:2:"ܵ";i:230;s:2:"ܶ";i:230;s:2:"ܷ";i:220;s:2:"ܸ";i:220;s:2:"ܹ";i:220;s:2:"ܺ";i:230;s:2:"ܻ";i:220;s:2:"ܼ";i:220;s:2:"ܽ";i:230;s:2:"ܾ";i:220;s:2:"ܿ";i:230;s:2:"݀";i:230;s:2:"݁";i:230;s:2:"݂";i:220;s:2:"݃";i:230;s:2:"݄";i:220;s:2:"݅";i:230;s:2:"݆";i:220;s:2:"݇";i:230;s:2:"݈";i:220;s:2:"݉";i:230;s:2:"݊";i:230;s:2:"߫";i:230;s:2:"߬";i:230;s:2:"߭";i:230;s:2:"߮";i:230;s:2:"߯";i:230;s:2:"߰";i:230;s:2:"߱";i:230;s:2:"߲";i:220;s:2:"߳";i:230;s:2:"߽";i:220;s:3:"ࠖ";i:230;s:3:"ࠗ";i:230;s:3:"࠘";i:230;s:3:"࠙";i:230;s:3:"ࠛ";i:230;s:3:"ࠜ";i:230;s:3:"ࠝ";i:230;s:3:"ࠞ";i:230;s:3:"ࠟ";i:230;s:3:"ࠠ";i:230;s:3:"ࠡ";i:230;s:3:"ࠢ";i:230;s:3:"ࠣ";i:230;s:3:"ࠥ";i:230;s:3:"ࠦ";i:230;s:3:"ࠧ";i:230;s:3:"ࠩ";i:230;s:3:"ࠪ";i:230;s:3:"ࠫ";i:230;s:3:"ࠬ";i:230;s:3:"࠭";i:230;s:3:"࡙";i:220;s:3:"࡚";i:220;s:3:"࡛";i:220;s:3:"࣓";i:220;s:3:"ࣔ";i:230;s:3:"ࣕ";i:230;s:3:"ࣖ";i:230;s:3:"ࣗ";i:230;s:3:"ࣘ";i:230;s:3:"ࣙ";i:230;s:3:"ࣚ";i:230;s:3:"ࣛ";i:230;s:3:"ࣜ";i:230;s:3:"ࣝ";i:230;s:3:"ࣞ";i:230;s:3:"ࣟ";i:230;s:3:"࣠";i:230;s:3:"࣡";i:230;s:3:"ࣣ";i:220;s:3:"ࣤ";i:230;s:3:"ࣥ";i:230;s:3:"ࣦ";i:220;s:3:"ࣧ";i:230;s:3:"ࣨ";i:230;s:3:"ࣩ";i:220;s:3:"࣪";i:230;s:3:"࣫";i:230;s:3:"࣬";i:230;s:3:"࣭";i:220;s:3:"࣮";i:220;s:3:"࣯";i:220;s:3:"ࣰ";i:27;s:3:"ࣱ";i:28;s:3:"ࣲ";i:29;s:3:"ࣳ";i:230;s:3:"ࣴ";i:230;s:3:"ࣵ";i:230;s:3:"ࣶ";i:220;s:3:"ࣷ";i:230;s:3:"ࣸ";i:230;s:3:"ࣹ";i:220;s:3:"ࣺ";i:220;s:3:"ࣻ";i:230;s:3:"ࣼ";i:230;s:3:"ࣽ";i:230;s:3:"ࣾ";i:230;s:3:"ࣿ";i:230;s:3:"़";i:7;s:3:"्";i:9;s:3:"॑";i:230;s:3:"॒";i:220;s:3:"॓";i:230;s:3:"॔";i:230;s:3:"়";i:7;s:3:"্";i:9;s:3:"৾";i:230;s:3:"਼";i:7;s:3:"੍";i:9;s:3:"઼";i:7;s:3:"્";i:9;s:3:"଼";i:7;s:3:"୍";i:9;s:3:"்";i:9;s:3:"్";i:9;s:3:"ౕ";i:84;s:3:"ౖ";i:91;s:3:"಼";i:7;s:3:"್";i:9;s:3:"഻";i:9;s:3:"഼";i:9;s:3:"്";i:9;s:3:"්";i:9;s:3:"ุ";i:103;s:3:"ู";i:103;s:3:"ฺ";i:9;s:3:"่";i:107;s:3:"้";i:107;s:3:"๊";i:107;s:3:"๋";i:107;s:3:"ຸ";i:118;s:3:"ູ";i:118;s:3:"຺";i:9;s:3:"່";i:122;s:3:"້";i:122;s:3:"໊";i:122;s:3:"໋";i:122;s:3:"༘";i:220;s:3:"༙";i:220;s:3:"༵";i:220;s:3:"༷";i:220;s:3:"༹";i:216;s:3:"ཱ";i:129;s:3:"ི";i:130;s:3:"ུ";i:132;s:3:"ེ";i:130;s:3:"ཻ";i:130;s:3:"ོ";i:130;s:3:"ཽ";i:130;s:3:"ྀ";i:130;s:3:"ྂ";i:230;s:3:"ྃ";i:230;s:3:"྄";i:9;s:3:"྆";i:230;s:3:"྇";i:230;s:3:"࿆";i:220;s:3:"့";i:7;s:3:"္";i:9;s:3:"်";i:9;s:3:"ႍ";i:220;s:3:"፝";i:230;s:3:"፞";i:230;s:3:"፟";i:230;s:3:"᜔";i:9;s:3:"᜴";i:9;s:3:"្";i:9;s:3:"៝";i:230;s:3:"ᢩ";i:228;s:3:"᤹";i:222;s:3:"᤺";i:230;s:3:"᤻";i:220;s:3:"ᨗ";i:230;s:3:"ᨘ";i:220;s:3:"᩠";i:9;s:3:"᩵";i:230;s:3:"᩶";i:230;s:3:"᩷";i:230;s:3:"᩸";i:230;s:3:"᩹";i:230;s:3:"᩺";i:230;s:3:"᩻";i:230;s:3:"᩼";i:230;s:3:"᩿";i:220;s:3:"᪰";i:230;s:3:"᪱";i:230;s:3:"᪲";i:230;s:3:"᪳";i:230;s:3:"᪴";i:230;s:3:"᪵";i:220;s:3:"᪶";i:220;s:3:"᪷";i:220;s:3:"᪸";i:220;s:3:"᪹";i:220;s:3:"᪺";i:220;s:3:"᪻";i:230;s:3:"᪼";i:230;s:3:"᪽";i:220;s:3:"᬴";i:7;s:3:"᭄";i:9;s:3:"᭫";i:230;s:3:"᭬";i:220;s:3:"᭭";i:230;s:3:"᭮";i:230;s:3:"᭯";i:230;s:3:"᭰";i:230;s:3:"᭱";i:230;s:3:"᭲";i:230;s:3:"᭳";i:230;s:3:"᮪";i:9;s:3:"᮫";i:9;s:3:"᯦";i:7;s:3:"᯲";i:9;s:3:"᯳";i:9;s:3:"᰷";i:7;s:3:"᳐";i:230;s:3:"᳑";i:230;s:3:"᳒";i:230;s:3:"᳔";i:1;s:3:"᳕";i:220;s:3:"᳖";i:220;s:3:"᳗";i:220;s:3:"᳘";i:220;s:3:"᳙";i:220;s:3:"᳚";i:230;s:3:"᳛";i:230;s:3:"᳜";i:220;s:3:"᳝";i:220;s:3:"᳞";i:220;s:3:"᳟";i:220;s:3:"᳠";i:230;s:3:"᳢";i:1;s:3:"᳣";i:1;s:3:"᳤";i:1;s:3:"᳥";i:1;s:3:"᳦";i:1;s:3:"᳧";i:1;s:3:"᳨";i:1;s:3:"᳭";i:220;s:3:"᳴";i:230;s:3:"᳸";i:230;s:3:"᳹";i:230;s:3:"᷀";i:230;s:3:"᷁";i:230;s:3:"᷂";i:220;s:3:"᷃";i:230;s:3:"᷄";i:230;s:3:"᷅";i:230;s:3:"᷆";i:230;s:3:"᷇";i:230;s:3:"᷈";i:230;s:3:"᷉";i:230;s:3:"᷊";i:220;s:3:"᷋";i:230;s:3:"᷌";i:230;s:3:"᷍";i:234;s:3:"᷎";i:214;s:3:"᷏";i:220;s:3:"᷐";i:202;s:3:"᷑";i:230;s:3:"᷒";i:230;s:3:"ᷓ";i:230;s:3:"ᷔ";i:230;s:3:"ᷕ";i:230;s:3:"ᷖ";i:230;s:3:"ᷗ";i:230;s:3:"ᷘ";i:230;s:3:"ᷙ";i:230;s:3:"ᷚ";i:230;s:3:"ᷛ";i:230;s:3:"ᷜ";i:230;s:3:"ᷝ";i:230;s:3:"ᷞ";i:230;s:3:"ᷟ";i:230;s:3:"ᷠ";i:230;s:3:"ᷡ";i:230;s:3:"ᷢ";i:230;s:3:"ᷣ";i:230;s:3:"ᷤ";i:230;s:3:"ᷥ";i:230;s:3:"ᷦ";i:230;s:3:"ᷧ";i:230;s:3:"ᷨ";i:230;s:3:"ᷩ";i:230;s:3:"ᷪ";i:230;s:3:"ᷫ";i:230;s:3:"ᷬ";i:230;s:3:"ᷭ";i:230;s:3:"ᷮ";i:230;s:3:"ᷯ";i:230;s:3:"ᷰ";i:230;s:3:"ᷱ";i:230;s:3:"ᷲ";i:230;s:3:"ᷳ";i:230;s:3:"ᷴ";i:230;s:3:"᷵";i:230;s:3:"᷶";i:232;s:3:"᷷";i:228;s:3:"᷸";i:228;s:3:"᷹";i:220;s:3:"᷻";i:230;s:3:"᷼";i:233;s:3:"᷽";i:220;s:3:"᷾";i:230;s:3:"᷿";i:220;s:3:"⃐";i:230;s:3:"⃑";i:230;s:3:"⃒";i:1;s:3:"⃓";i:1;s:3:"⃔";i:230;s:3:"⃕";i:230;s:3:"⃖";i:230;s:3:"⃗";i:230;s:3:"⃘";i:1;s:3:"⃙";i:1;s:3:"⃚";i:1;s:3:"⃛";i:230;s:3:"⃜";i:230;s:3:"⃡";i:230;s:3:"⃥";i:1;s:3:"⃦";i:1;s:3:"⃧";i:230;s:3:"⃨";i:220;s:3:"⃩";i:230;s:3:"⃪";i:1;s:3:"⃫";i:1;s:3:"⃬";i:220;s:3:"⃭";i:220;s:3:"⃮";i:220;s:3:"⃯";i:220;s:3:"⃰";i:230;s:3:"⳯";i:230;s:3:"⳰";i:230;s:3:"⳱";i:230;s:3:"⵿";i:9;s:3:"ⷠ";i:230;s:3:"ⷡ";i:230;s:3:"ⷢ";i:230;s:3:"ⷣ";i:230;s:3:"ⷤ";i:230;s:3:"ⷥ";i:230;s:3:"ⷦ";i:230;s:3:"ⷧ";i:230;s:3:"ⷨ";i:230;s:3:"ⷩ";i:230;s:3:"ⷪ";i:230;s:3:"ⷫ";i:230;s:3:"ⷬ";i:230;s:3:"ⷭ";i:230;s:3:"ⷮ";i:230;s:3:"ⷯ";i:230;s:3:"ⷰ";i:230;s:3:"ⷱ";i:230;s:3:"ⷲ";i:230;s:3:"ⷳ";i:230;s:3:"ⷴ";i:230;s:3:"ⷵ";i:230;s:3:"ⷶ";i:230;s:3:"ⷷ";i:230;s:3:"ⷸ";i:230;s:3:"ⷹ";i:230;s:3:"ⷺ";i:230;s:3:"ⷻ";i:230;s:3:"ⷼ";i:230;s:3:"ⷽ";i:230;s:3:"ⷾ";i:230;s:3:"ⷿ";i:230;s:3:"〪";i:218;s:3:"〫";i:228;s:3:"〬";i:232;s:3:"〭";i:222;s:3:"〮";i:224;s:3:"〯";i:224;s:3:"゙";i:8;s:3:"゚";i:8;s:3:"꙯";i:230;s:3:"ꙴ";i:230;s:3:"ꙵ";i:230;s:3:"ꙶ";i:230;s:3:"ꙷ";i:230;s:3:"ꙸ";i:230;s:3:"ꙹ";i:230;s:3:"ꙺ";i:230;s:3:"ꙻ";i:230;s:3:"꙼";i:230;s:3:"꙽";i:230;s:3:"ꚞ";i:230;s:3:"ꚟ";i:230;s:3:"꛰";i:230;s:3:"꛱";i:230;s:3:"꠆";i:9;s:3:"꣄";i:9;s:3:"꣠";i:230;s:3:"꣡";i:230;s:3:"꣢";i:230;s:3:"꣣";i:230;s:3:"꣤";i:230;s:3:"꣥";i:230;s:3:"꣦";i:230;s:3:"꣧";i:230;s:3:"꣨";i:230;s:3:"꣩";i:230;s:3:"꣪";i:230;s:3:"꣫";i:230;s:3:"꣬";i:230;s:3:"꣭";i:230;s:3:"꣮";i:230;s:3:"꣯";i:230;s:3:"꣰";i:230;s:3:"꣱";i:230;s:3:"꤫";i:220;s:3:"꤬";i:220;s:3:"꤭";i:220;s:3:"꥓";i:9;s:3:"꦳";i:7;s:3:"꧀";i:9;s:3:"ꪰ";i:230;s:3:"ꪲ";i:230;s:3:"ꪳ";i:230;s:3:"ꪴ";i:220;s:3:"ꪷ";i:230;s:3:"ꪸ";i:230;s:3:"ꪾ";i:230;s:3:"꪿";i:230;s:3:"꫁";i:230;s:3:"꫶";i:9;s:3:"꯭";i:9;s:3:"ﬞ";i:26;s:3:"︠";i:230;s:3:"︡";i:230;s:3:"︢";i:230;s:3:"︣";i:230;s:3:"︤";i:230;s:3:"︥";i:230;s:3:"︦";i:230;s:3:"︧";i:220;s:3:"︨";i:220;s:3:"︩";i:220;s:3:"︪";i:220;s:3:"︫";i:220;s:3:"︬";i:220;s:3:"︭";i:220;s:3:"︮";i:230;s:3:"︯";i:230;s:4:"𐇽";i:220;s:4:"𐋠";i:220;s:4:"𐍶";i:230;s:4:"𐍷";i:230;s:4:"𐍸";i:230;s:4:"𐍹";i:230;s:4:"𐍺";i:230;s:4:"𐨍";i:220;s:4:"𐨏";i:230;s:4:"𐨸";i:230;s:4:"𐨹";i:1;s:4:"𐨺";i:220;s:4:"𐨿";i:9;s:4:"𐫥";i:230;s:4:"𐫦";i:220;s:4:"𐴤";i:230;s:4:"𐴥";i:230;s:4:"𐴦";i:230;s:4:"𐴧";i:230;s:4:"𐽆";i:220;s:4:"𐽇";i:220;s:4:"𐽈";i:230;s:4:"𐽉";i:230;s:4:"𐽊";i:230;s:4:"𐽋";i:220;s:4:"𐽌";i:230;s:4:"𐽍";i:220;s:4:"𐽎";i:220;s:4:"𐽏";i:220;s:4:"𐽐";i:220;s:4:"𑁆";i:9;s:4:"𑁿";i:9;s:4:"𑂹";i:9;s:4:"𑂺";i:7;s:4:"𑄀";i:230;s:4:"𑄁";i:230;s:4:"𑄂";i:230;s:4:"𑄳";i:9;s:4:"𑄴";i:9;s:4:"𑅳";i:7;s:4:"𑇀";i:9;s:4:"𑇊";i:7;s:4:"𑈵";i:9;s:4:"𑈶";i:7;s:4:"𑋩";i:7;s:4:"𑋪";i:9;s:4:"𑌻";i:7;s:4:"𑌼";i:7;s:4:"𑍍";i:9;s:4:"𑍦";i:230;s:4:"𑍧";i:230;s:4:"𑍨";i:230;s:4:"𑍩";i:230;s:4:"𑍪";i:230;s:4:"𑍫";i:230;s:4:"𑍬";i:230;s:4:"𑍰";i:230;s:4:"𑍱";i:230;s:4:"𑍲";i:230;s:4:"𑍳";i:230;s:4:"𑍴";i:230;s:4:"𑑂";i:9;s:4:"𑑆";i:7;s:4:"𑑞";i:230;s:4:"𑓂";i:9;s:4:"𑓃";i:7;s:4:"𑖿";i:9;s:4:"𑗀";i:7;s:4:"𑘿";i:9;s:4:"𑚶";i:9;s:4:"𑚷";i:7;s:4:"𑜫";i:9;s:4:"𑠹";i:9;s:4:"𑠺";i:7;s:4:"𑧠";i:9;s:4:"𑨴";i:9;s:4:"𑩇";i:9;s:4:"𑪙";i:9;s:4:"𑰿";i:9;s:4:"𑵂";i:7;s:4:"𑵄";i:9;s:4:"𑵅";i:9;s:4:"𑶗";i:9;s:4:"𖫰";i:1;s:4:"𖫱";i:1;s:4:"𖫲";i:1;s:4:"𖫳";i:1;s:4:"𖫴";i:1;s:4:"𖬰";i:230;s:4:"𖬱";i:230;s:4:"𖬲";i:230;s:4:"𖬳";i:230;s:4:"𖬴";i:230;s:4:"𖬵";i:230;s:4:"𖬶";i:230;s:4:"𛲞";i:1;s:4:"𝅥";i:216;s:4:"𝅦";i:216;s:4:"𝅧";i:1;s:4:"𝅨";i:1;s:4:"𝅩";i:1;s:4:"𝅭";i:226;s:4:"𝅮";i:216;s:4:"𝅯";i:216;s:4:"𝅰";i:216;s:4:"𝅱";i:216;s:4:"𝅲";i:216;s:4:"𝅻";i:220;s:4:"𝅼";i:220;s:4:"𝅽";i:220;s:4:"𝅾";i:220;s:4:"𝅿";i:220;s:4:"𝆀";i:220;s:4:"𝆁";i:220;s:4:"𝆂";i:220;s:4:"𝆅";i:230;s:4:"𝆆";i:230;s:4:"𝆇";i:230;s:4:"𝆈";i:230;s:4:"𝆉";i:230;s:4:"𝆊";i:220;s:4:"𝆋";i:220;s:4:"𝆪";i:230;s:4:"𝆫";i:230;s:4:"𝆬";i:230;s:4:"𝆭";i:230;s:4:"𝉂";i:230;s:4:"𝉃";i:230;s:4:"𝉄";i:230;s:4:"𞀀";i:230;s:4:"𞀁";i:230;s:4:"𞀂";i:230;s:4:"𞀃";i:230;s:4:"𞀄";i:230;s:4:"𞀅";i:230;s:4:"𞀆";i:230;s:4:"𞀈";i:230;s:4:"𞀉";i:230;s:4:"𞀊";i:230;s:4:"𞀋";i:230;s:4:"𞀌";i:230;s:4:"𞀍";i:230;s:4:"𞀎";i:230;s:4:"𞀏";i:230;s:4:"𞀐";i:230;s:4:"𞀑";i:230;s:4:"𞀒";i:230;s:4:"𞀓";i:230;s:4:"𞀔";i:230;s:4:"𞀕";i:230;s:4:"𞀖";i:230;s:4:"𞀗";i:230;s:4:"𞀘";i:230;s:4:"𞀛";i:230;s:4:"𞀜";i:230;s:4:"𞀝";i:230;s:4:"𞀞";i:230;s:4:"𞀟";i:230;s:4:"𞀠";i:230;s:4:"𞀡";i:230;s:4:"𞀣";i:230;s:4:"𞀤";i:230;s:4:"𞀦";i:230;s:4:"𞀧";i:230;s:4:"𞀨";i:230;s:4:"𞀩";i:230;s:4:"𞀪";i:230;s:4:"𞄰";i:230;s:4:"𞄱";i:230;s:4:"𞄲";i:230;s:4:"𞄳";i:230;s:4:"𞄴";i:230;s:4:"𞄵";i:230;s:4:"𞄶";i:230;s:4:"𞋬";i:230;s:4:"𞋭";i:230;s:4:"𞋮";i:230;s:4:"𞋯";i:230;s:4:"𞣐";i:220;s:4:"𞣑";i:220;s:4:"𞣒";i:220;s:4:"𞣓";i:220;s:4:"𞣔";i:220;s:4:"𞣕";i:220;s:4:"𞣖";i:220;s:4:"𞥄";i:230;s:4:"𞥅";i:230;s:4:"𞥆";i:230;s:4:"𞥇";i:230;s:4:"𞥈";i:230;s:4:"𞥉";i:230;s:4:"𞥊";i:7;} \ No newline at end of file diff --git a/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/compatibilityDecomposition.ser b/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/compatibilityDecomposition.ser index 9ec5bcd..3173696 100644 --- a/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/compatibilityDecomposition.ser +++ b/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/compatibilityDecomposition.ser @@ -1 +1 @@ -a:3677:{s:2:" ";s:1:" ";s:2:"¨";s:3:" ̈";s:2:"ª";s:1:"a";s:2:"¯";s:3:" ̄";s:2:"²";s:1:"2";s:2:"³";s:1:"3";s:2:"´";s:3:" ́";s:2:"µ";s:2:"μ";s:2:"¸";s:3:" ̧";s:2:"¹";s:1:"1";s:2:"º";s:1:"o";s:2:"¼";s:5:"1⁄4";s:2:"½";s:5:"1⁄2";s:2:"¾";s:5:"3⁄4";s:2:"IJ";s:2:"IJ";s:2:"ij";s:2:"ij";s:2:"Ŀ";s:3:"L·";s:2:"ŀ";s:3:"l·";s:2:"ʼn";s:3:"ʼn";s:2:"ſ";s:1:"s";s:2:"DŽ";s:4:"DŽ";s:2:"Dž";s:4:"Dž";s:2:"dž";s:4:"dž";s:2:"LJ";s:2:"LJ";s:2:"Lj";s:2:"Lj";s:2:"lj";s:2:"lj";s:2:"NJ";s:2:"NJ";s:2:"Nj";s:2:"Nj";s:2:"nj";s:2:"nj";s:2:"DZ";s:2:"DZ";s:2:"Dz";s:2:"Dz";s:2:"dz";s:2:"dz";s:2:"ʰ";s:1:"h";s:2:"ʱ";s:2:"ɦ";s:2:"ʲ";s:1:"j";s:2:"ʳ";s:1:"r";s:2:"ʴ";s:2:"ɹ";s:2:"ʵ";s:2:"ɻ";s:2:"ʶ";s:2:"ʁ";s:2:"ʷ";s:1:"w";s:2:"ʸ";s:1:"y";s:2:"˘";s:3:" ̆";s:2:"˙";s:3:" ̇";s:2:"˚";s:3:" ̊";s:2:"˛";s:3:" ̨";s:2:"˜";s:3:" ̃";s:2:"˝";s:3:" ̋";s:2:"ˠ";s:2:"ɣ";s:2:"ˡ";s:1:"l";s:2:"ˢ";s:1:"s";s:2:"ˣ";s:1:"x";s:2:"ˤ";s:2:"ʕ";s:2:"ͺ";s:3:" ͅ";s:2:"΄";s:3:" ́";s:2:"΅";s:5:" ̈́";s:2:"ϐ";s:2:"β";s:2:"ϑ";s:2:"θ";s:2:"ϒ";s:2:"Υ";s:2:"ϓ";s:4:"Ύ";s:2:"ϔ";s:4:"Ϋ";s:2:"ϕ";s:2:"φ";s:2:"ϖ";s:2:"π";s:2:"ϰ";s:2:"κ";s:2:"ϱ";s:2:"ρ";s:2:"ϲ";s:2:"ς";s:2:"ϴ";s:2:"Θ";s:2:"ϵ";s:2:"ε";s:2:"Ϲ";s:2:"Σ";s:2:"և";s:4:"եւ";s:2:"ٵ";s:4:"اٴ";s:2:"ٶ";s:4:"وٴ";s:2:"ٷ";s:4:"ۇٴ";s:2:"ٸ";s:4:"يٴ";s:3:"ำ";s:6:"ํา";s:3:"ຳ";s:6:"ໍາ";s:3:"ໜ";s:6:"ຫນ";s:3:"ໝ";s:6:"ຫມ";s:3:"༌";s:3:"་";s:3:"ཷ";s:9:"ྲཱྀ";s:3:"ཹ";s:9:"ླཱྀ";s:3:"ჼ";s:3:"ნ";s:3:"ᴬ";s:1:"A";s:3:"ᴭ";s:2:"Æ";s:3:"ᴮ";s:1:"B";s:3:"ᴰ";s:1:"D";s:3:"ᴱ";s:1:"E";s:3:"ᴲ";s:2:"Ǝ";s:3:"ᴳ";s:1:"G";s:3:"ᴴ";s:1:"H";s:3:"ᴵ";s:1:"I";s:3:"ᴶ";s:1:"J";s:3:"ᴷ";s:1:"K";s:3:"ᴸ";s:1:"L";s:3:"ᴹ";s:1:"M";s:3:"ᴺ";s:1:"N";s:3:"ᴼ";s:1:"O";s:3:"ᴽ";s:2:"Ȣ";s:3:"ᴾ";s:1:"P";s:3:"ᴿ";s:1:"R";s:3:"ᵀ";s:1:"T";s:3:"ᵁ";s:1:"U";s:3:"ᵂ";s:1:"W";s:3:"ᵃ";s:1:"a";s:3:"ᵄ";s:2:"ɐ";s:3:"ᵅ";s:2:"ɑ";s:3:"ᵆ";s:3:"ᴂ";s:3:"ᵇ";s:1:"b";s:3:"ᵈ";s:1:"d";s:3:"ᵉ";s:1:"e";s:3:"ᵊ";s:2:"ə";s:3:"ᵋ";s:2:"ɛ";s:3:"ᵌ";s:2:"ɜ";s:3:"ᵍ";s:1:"g";s:3:"ᵏ";s:1:"k";s:3:"ᵐ";s:1:"m";s:3:"ᵑ";s:2:"ŋ";s:3:"ᵒ";s:1:"o";s:3:"ᵓ";s:2:"ɔ";s:3:"ᵔ";s:3:"ᴖ";s:3:"ᵕ";s:3:"ᴗ";s:3:"ᵖ";s:1:"p";s:3:"ᵗ";s:1:"t";s:3:"ᵘ";s:1:"u";s:3:"ᵙ";s:3:"ᴝ";s:3:"ᵚ";s:2:"ɯ";s:3:"ᵛ";s:1:"v";s:3:"ᵜ";s:3:"ᴥ";s:3:"ᵝ";s:2:"β";s:3:"ᵞ";s:2:"γ";s:3:"ᵟ";s:2:"δ";s:3:"ᵠ";s:2:"φ";s:3:"ᵡ";s:2:"χ";s:3:"ᵢ";s:1:"i";s:3:"ᵣ";s:1:"r";s:3:"ᵤ";s:1:"u";s:3:"ᵥ";s:1:"v";s:3:"ᵦ";s:2:"β";s:3:"ᵧ";s:2:"γ";s:3:"ᵨ";s:2:"ρ";s:3:"ᵩ";s:2:"φ";s:3:"ᵪ";s:2:"χ";s:3:"ᵸ";s:2:"н";s:3:"ᶛ";s:2:"ɒ";s:3:"ᶜ";s:1:"c";s:3:"ᶝ";s:2:"ɕ";s:3:"ᶞ";s:2:"ð";s:3:"ᶟ";s:2:"ɜ";s:3:"ᶠ";s:1:"f";s:3:"ᶡ";s:2:"ɟ";s:3:"ᶢ";s:2:"ɡ";s:3:"ᶣ";s:2:"ɥ";s:3:"ᶤ";s:2:"ɨ";s:3:"ᶥ";s:2:"ɩ";s:3:"ᶦ";s:2:"ɪ";s:3:"ᶧ";s:3:"ᵻ";s:3:"ᶨ";s:2:"ʝ";s:3:"ᶩ";s:2:"ɭ";s:3:"ᶪ";s:3:"ᶅ";s:3:"ᶫ";s:2:"ʟ";s:3:"ᶬ";s:2:"ɱ";s:3:"ᶭ";s:2:"ɰ";s:3:"ᶮ";s:2:"ɲ";s:3:"ᶯ";s:2:"ɳ";s:3:"ᶰ";s:2:"ɴ";s:3:"ᶱ";s:2:"ɵ";s:3:"ᶲ";s:2:"ɸ";s:3:"ᶳ";s:2:"ʂ";s:3:"ᶴ";s:2:"ʃ";s:3:"ᶵ";s:2:"ƫ";s:3:"ᶶ";s:2:"ʉ";s:3:"ᶷ";s:2:"ʊ";s:3:"ᶸ";s:3:"ᴜ";s:3:"ᶹ";s:2:"ʋ";s:3:"ᶺ";s:2:"ʌ";s:3:"ᶻ";s:1:"z";s:3:"ᶼ";s:2:"ʐ";s:3:"ᶽ";s:2:"ʑ";s:3:"ᶾ";s:2:"ʒ";s:3:"ᶿ";s:2:"θ";s:3:"ẚ";s:3:"aʾ";s:3:"ẛ";s:3:"ṡ";s:3:"᾽";s:3:" ̓";s:3:"᾿";s:3:" ̓";s:3:"῀";s:3:" ͂";s:3:"῁";s:5:" ̈͂";s:3:"῍";s:5:" ̓̀";s:3:"῎";s:5:" ̓́";s:3:"῏";s:5:" ̓͂";s:3:"῝";s:5:" ̔̀";s:3:"῞";s:5:" ̔́";s:3:"῟";s:5:" ̔͂";s:3:"῭";s:5:" ̈̀";s:3:"΅";s:5:" ̈́";s:3:"´";s:3:" ́";s:3:"῾";s:3:" ̔";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:"‑";s:3:"‐";s:3:"‗";s:3:" ̳";s:3:"․";s:1:".";s:3:"‥";s:2:"..";s:3:"…";s:3:"...";s:3:" ";s:1:" ";s:3:"″";s:6:"′′";s:3:"‴";s:9:"′′′";s:3:"‶";s:6:"‵‵";s:3:"‷";s:9:"‵‵‵";s:3:"‼";s:2:"!!";s:3:"‾";s:3:" ̅";s:3:"⁇";s:2:"??";s:3:"⁈";s:2:"?!";s:3:"⁉";s:2:"!?";s:3:"⁗";s:12:"′′′′";s:3:" ";s:1:" ";s:3:"⁰";s:1:"0";s:3:"ⁱ";s:1:"i";s:3:"⁴";s:1:"4";s:3:"⁵";s:1:"5";s:3:"⁶";s:1:"6";s:3:"⁷";s:1:"7";s:3:"⁸";s:1:"8";s:3:"⁹";s:1:"9";s:3:"⁺";s:1:"+";s:3:"⁻";s:3:"−";s:3:"⁼";s:1:"=";s:3:"⁽";s:1:"(";s:3:"⁾";s:1:")";s:3:"ⁿ";s:1:"n";s:3:"₀";s:1:"0";s:3:"₁";s:1:"1";s:3:"₂";s:1:"2";s:3:"₃";s:1:"3";s:3:"₄";s:1:"4";s:3:"₅";s:1:"5";s:3:"₆";s:1:"6";s:3:"₇";s:1:"7";s:3:"₈";s:1:"8";s:3:"₉";s:1:"9";s:3:"₊";s:1:"+";s:3:"₋";s:3:"−";s:3:"₌";s:1:"=";s:3:"₍";s:1:"(";s:3:"₎";s:1:")";s:3:"ₐ";s:1:"a";s:3:"ₑ";s:1:"e";s:3:"ₒ";s:1:"o";s:3:"ₓ";s:1:"x";s:3:"ₔ";s:2:"ə";s:3:"ₕ";s:1:"h";s:3:"ₖ";s:1:"k";s:3:"ₗ";s:1:"l";s:3:"ₘ";s:1:"m";s:3:"ₙ";s:1:"n";s:3:"ₚ";s:1:"p";s:3:"ₛ";s:1:"s";s:3:"ₜ";s:1:"t";s:3:"₨";s:2:"Rs";s:3:"℀";s:3:"a/c";s:3:"℁";s:3:"a/s";s:3:"ℂ";s:1:"C";s:3:"℃";s:3:"°C";s:3:"℅";s:3:"c/o";s:3:"℆";s:3:"c/u";s:3:"ℇ";s:2:"Ɛ";s:3:"℉";s:3:"°F";s:3:"ℊ";s:1:"g";s:3:"ℋ";s:1:"H";s:3:"ℌ";s:1:"H";s:3:"ℍ";s:1:"H";s:3:"ℎ";s:1:"h";s:3:"ℏ";s:2:"ħ";s:3:"ℐ";s:1:"I";s:3:"ℑ";s:1:"I";s:3:"ℒ";s:1:"L";s:3:"ℓ";s:1:"l";s:3:"ℕ";s:1:"N";s:3:"№";s:2:"No";s:3:"ℙ";s:1:"P";s:3:"ℚ";s:1:"Q";s:3:"ℛ";s:1:"R";s:3:"ℜ";s:1:"R";s:3:"ℝ";s:1:"R";s:3:"℠";s:2:"SM";s:3:"℡";s:3:"TEL";s:3:"™";s:2:"TM";s:3:"ℤ";s:1:"Z";s:3:"ℨ";s:1:"Z";s:3:"ℬ";s:1:"B";s:3:"ℭ";s:1:"C";s:3:"ℯ";s:1:"e";s:3:"ℰ";s:1:"E";s:3:"ℱ";s:1:"F";s:3:"ℳ";s:1:"M";s:3:"ℴ";s:1:"o";s:3:"ℵ";s:2:"א";s:3:"ℶ";s:2:"ב";s:3:"ℷ";s:2:"ג";s:3:"ℸ";s:2:"ד";s:3:"ℹ";s:1:"i";s:3:"℻";s:3:"FAX";s:3:"ℼ";s:2:"π";s:3:"ℽ";s:2:"γ";s:3:"ℾ";s:2:"Γ";s:3:"ℿ";s:2:"Π";s:3:"⅀";s:3:"∑";s:3:"ⅅ";s:1:"D";s:3:"ⅆ";s:1:"d";s:3:"ⅇ";s:1:"e";s:3:"ⅈ";s:1:"i";s:3:"ⅉ";s:1:"j";s:3:"⅐";s:5:"1⁄7";s:3:"⅑";s:5:"1⁄9";s:3:"⅒";s:6:"1⁄10";s:3:"⅓";s:5:"1⁄3";s:3:"⅔";s:5:"2⁄3";s:3:"⅕";s:5:"1⁄5";s:3:"⅖";s:5:"2⁄5";s:3:"⅗";s:5:"3⁄5";s:3:"⅘";s:5:"4⁄5";s:3:"⅙";s:5:"1⁄6";s:3:"⅚";s:5:"5⁄6";s:3:"⅛";s:5:"1⁄8";s:3:"⅜";s:5:"3⁄8";s:3:"⅝";s:5:"5⁄8";s:3:"⅞";s:5:"7⁄8";s:3:"⅟";s:4:"1⁄";s:3:"Ⅰ";s:1:"I";s:3:"Ⅱ";s:2:"II";s:3:"Ⅲ";s:3:"III";s:3:"Ⅳ";s:2:"IV";s:3:"Ⅴ";s:1:"V";s:3:"Ⅵ";s:2:"VI";s:3:"Ⅶ";s:3:"VII";s:3:"Ⅷ";s:4:"VIII";s:3:"Ⅸ";s:2:"IX";s:3:"Ⅹ";s:1:"X";s:3:"Ⅺ";s:2:"XI";s:3:"Ⅻ";s:3:"XII";s:3:"Ⅼ";s:1:"L";s:3:"Ⅽ";s:1:"C";s:3:"Ⅾ";s:1:"D";s:3:"Ⅿ";s:1:"M";s:3:"ⅰ";s:1:"i";s:3:"ⅱ";s:2:"ii";s:3:"ⅲ";s:3:"iii";s:3:"ⅳ";s:2:"iv";s:3:"ⅴ";s:1:"v";s:3:"ⅵ";s:2:"vi";s:3:"ⅶ";s:3:"vii";s:3:"ⅷ";s:4:"viii";s:3:"ⅸ";s:2:"ix";s:3:"ⅹ";s:1:"x";s:3:"ⅺ";s:2:"xi";s:3:"ⅻ";s:3:"xii";s:3:"ⅼ";s:1:"l";s:3:"ⅽ";s:1:"c";s:3:"ⅾ";s:1:"d";s:3:"ⅿ";s:1:"m";s:3:"↉";s:5:"0⁄3";s:3:"∬";s:6:"∫∫";s:3:"∭";s:9:"∫∫∫";s:3:"∯";s:6:"∮∮";s:3:"∰";s:9:"∮∮∮";s:3:"①";s:1:"1";s:3:"②";s:1:"2";s:3:"③";s:1:"3";s:3:"④";s:1:"4";s:3:"⑤";s:1:"5";s:3:"⑥";s:1:"6";s:3:"⑦";s:1:"7";s:3:"⑧";s:1:"8";s:3:"⑨";s:1:"9";s:3:"⑩";s:2:"10";s:3:"⑪";s:2:"11";s:3:"⑫";s:2:"12";s:3:"⑬";s:2:"13";s:3:"⑭";s:2:"14";s:3:"⑮";s:2:"15";s:3:"⑯";s:2:"16";s:3:"⑰";s:2:"17";s:3:"⑱";s:2:"18";s:3:"⑲";s:2:"19";s:3:"⑳";s:2:"20";s:3:"⑴";s:3:"(1)";s:3:"⑵";s:3:"(2)";s:3:"⑶";s:3:"(3)";s:3:"⑷";s:3:"(4)";s:3:"⑸";s:3:"(5)";s:3:"⑹";s:3:"(6)";s:3:"⑺";s:3:"(7)";s:3:"⑻";s:3:"(8)";s:3:"⑼";s:3:"(9)";s:3:"⑽";s:4:"(10)";s:3:"⑾";s:4:"(11)";s:3:"⑿";s:4:"(12)";s:3:"⒀";s:4:"(13)";s:3:"⒁";s:4:"(14)";s:3:"⒂";s:4:"(15)";s:3:"⒃";s:4:"(16)";s:3:"⒄";s:4:"(17)";s:3:"⒅";s:4:"(18)";s:3:"⒆";s:4:"(19)";s:3:"⒇";s:4:"(20)";s:3:"⒈";s:2:"1.";s:3:"⒉";s:2:"2.";s:3:"⒊";s:2:"3.";s:3:"⒋";s:2:"4.";s:3:"⒌";s:2:"5.";s:3:"⒍";s:2:"6.";s:3:"⒎";s:2:"7.";s:3:"⒏";s:2:"8.";s:3:"⒐";s:2:"9.";s:3:"⒑";s:3:"10.";s:3:"⒒";s:3:"11.";s:3:"⒓";s:3:"12.";s:3:"⒔";s:3:"13.";s:3:"⒕";s:3:"14.";s:3:"⒖";s:3:"15.";s:3:"⒗";s:3:"16.";s:3:"⒘";s:3:"17.";s:3:"⒙";s:3:"18.";s:3:"⒚";s:3:"19.";s:3:"⒛";s:3:"20.";s:3:"⒜";s:3:"(a)";s:3:"⒝";s:3:"(b)";s:3:"⒞";s:3:"(c)";s:3:"⒟";s:3:"(d)";s:3:"⒠";s:3:"(e)";s:3:"⒡";s:3:"(f)";s:3:"⒢";s:3:"(g)";s:3:"⒣";s:3:"(h)";s:3:"⒤";s:3:"(i)";s:3:"⒥";s:3:"(j)";s:3:"⒦";s:3:"(k)";s:3:"⒧";s:3:"(l)";s:3:"⒨";s:3:"(m)";s:3:"⒩";s:3:"(n)";s:3:"⒪";s:3:"(o)";s:3:"⒫";s:3:"(p)";s:3:"⒬";s:3:"(q)";s:3:"⒭";s:3:"(r)";s:3:"⒮";s:3:"(s)";s:3:"⒯";s:3:"(t)";s:3:"⒰";s:3:"(u)";s:3:"⒱";s:3:"(v)";s:3:"⒲";s:3:"(w)";s:3:"⒳";s:3:"(x)";s:3:"⒴";s:3:"(y)";s:3:"⒵";s:3:"(z)";s:3:"Ⓐ";s:1:"A";s:3:"Ⓑ";s:1:"B";s:3:"Ⓒ";s:1:"C";s:3:"Ⓓ";s:1:"D";s:3:"Ⓔ";s:1:"E";s:3:"Ⓕ";s:1:"F";s:3:"Ⓖ";s:1:"G";s:3:"Ⓗ";s:1:"H";s:3:"Ⓘ";s:1:"I";s:3:"Ⓙ";s:1:"J";s:3:"Ⓚ";s:1:"K";s:3:"Ⓛ";s:1:"L";s:3:"Ⓜ";s:1:"M";s:3:"Ⓝ";s:1:"N";s:3:"Ⓞ";s:1:"O";s:3:"Ⓟ";s:1:"P";s:3:"Ⓠ";s:1:"Q";s:3:"Ⓡ";s:1:"R";s:3:"Ⓢ";s:1:"S";s:3:"Ⓣ";s:1:"T";s:3:"Ⓤ";s:1:"U";s:3:"Ⓥ";s:1:"V";s:3:"Ⓦ";s:1:"W";s:3:"Ⓧ";s:1:"X";s:3:"Ⓨ";s:1:"Y";s:3:"Ⓩ";s:1:"Z";s:3:"ⓐ";s:1:"a";s:3:"ⓑ";s:1:"b";s:3:"ⓒ";s:1:"c";s:3:"ⓓ";s:1:"d";s:3:"ⓔ";s:1:"e";s:3:"ⓕ";s:1:"f";s:3:"ⓖ";s:1:"g";s:3:"ⓗ";s:1:"h";s:3:"ⓘ";s:1:"i";s:3:"ⓙ";s:1:"j";s:3:"ⓚ";s:1:"k";s:3:"ⓛ";s:1:"l";s:3:"ⓜ";s:1:"m";s:3:"ⓝ";s:1:"n";s:3:"ⓞ";s:1:"o";s:3:"ⓟ";s:1:"p";s:3:"ⓠ";s:1:"q";s:3:"ⓡ";s:1:"r";s:3:"ⓢ";s:1:"s";s:3:"ⓣ";s:1:"t";s:3:"ⓤ";s:1:"u";s:3:"ⓥ";s:1:"v";s:3:"ⓦ";s:1:"w";s:3:"ⓧ";s:1:"x";s:3:"ⓨ";s:1:"y";s:3:"ⓩ";s:1:"z";s:3:"⓪";s:1:"0";s:3:"⨌";s:12:"∫∫∫∫";s:3:"⩴";s:3:"::=";s:3:"⩵";s:2:"==";s:3:"⩶";s:3:"===";s:3:"ⱼ";s:1:"j";s:3:"ⱽ";s:1:"V";s:3:"ⵯ";s:3:"ⵡ";s:3:"⺟";s:3:"母";s:3:"⻳";s:3:"龟";s:3:"⼀";s:3:"一";s:3:"⼁";s:3:"丨";s:3:"⼂";s:3:"丶";s:3:"⼃";s:3:"丿";s:3:"⼄";s:3:"乙";s:3:"⼅";s:3:"亅";s:3:"⼆";s:3:"二";s:3:"⼇";s:3:"亠";s:3:"⼈";s:3:"人";s:3:"⼉";s:3:"儿";s:3:"⼊";s:3:"入";s:3:"⼋";s:3:"八";s:3:"⼌";s:3:"冂";s:3:"⼍";s:3:"冖";s:3:"⼎";s:3:"冫";s:3:"⼏";s:3:"几";s:3:"⼐";s:3:"凵";s:3:"⼑";s:3:"刀";s:3:"⼒";s:3:"力";s:3:"⼓";s:3:"勹";s:3:"⼔";s:3:"匕";s:3:"⼕";s:3:"匚";s:3:"⼖";s:3:"匸";s:3:"⼗";s:3:"十";s:3:"⼘";s:3:"卜";s:3:"⼙";s:3:"卩";s:3:"⼚";s:3:"厂";s:3:"⼛";s:3:"厶";s:3:"⼜";s:3:"又";s:3:"⼝";s:3:"口";s:3:"⼞";s:3:"囗";s:3:"⼟";s:3:"土";s:3:"⼠";s:3:"士";s:3:"⼡";s:3:"夂";s:3:"⼢";s:3:"夊";s:3:"⼣";s:3:"夕";s:3:"⼤";s:3:"大";s:3:"⼥";s:3:"女";s:3:"⼦";s:3:"子";s:3:"⼧";s:3:"宀";s:3:"⼨";s:3:"寸";s:3:"⼩";s:3:"小";s:3:"⼪";s:3:"尢";s:3:"⼫";s:3:"尸";s:3:"⼬";s:3:"屮";s:3:"⼭";s:3:"山";s:3:"⼮";s:3:"巛";s:3:"⼯";s:3:"工";s:3:"⼰";s:3:"己";s:3:"⼱";s:3:"巾";s:3:"⼲";s:3:"干";s:3:"⼳";s:3:"幺";s:3:"⼴";s:3:"广";s:3:"⼵";s:3:"廴";s:3:"⼶";s:3:"廾";s:3:"⼷";s:3:"弋";s:3:"⼸";s:3:"弓";s:3:"⼹";s:3:"彐";s:3:"⼺";s:3:"彡";s:3:"⼻";s:3:"彳";s:3:"⼼";s:3:"心";s:3:"⼽";s:3:"戈";s:3:"⼾";s:3:"戶";s:3:"⼿";s:3:"手";s:3:"⽀";s:3:"支";s:3:"⽁";s:3:"攴";s:3:"⽂";s:3:"文";s:3:"⽃";s:3:"斗";s:3:"⽄";s:3:"斤";s:3:"⽅";s:3:"方";s:3:"⽆";s:3:"无";s:3:"⽇";s:3:"日";s:3:"⽈";s:3:"曰";s:3:"⽉";s:3:"月";s:3:"⽊";s:3:"木";s:3:"⽋";s:3:"欠";s:3:"⽌";s:3:"止";s:3:"⽍";s:3:"歹";s:3:"⽎";s:3:"殳";s:3:"⽏";s:3:"毋";s:3:"⽐";s:3:"比";s:3:"⽑";s:3:"毛";s:3:"⽒";s:3:"氏";s:3:"⽓";s:3:"气";s:3:"⽔";s:3:"水";s:3:"⽕";s:3:"火";s:3:"⽖";s:3:"爪";s:3:"⽗";s:3:"父";s:3:"⽘";s:3:"爻";s:3:"⽙";s:3:"爿";s:3:"⽚";s:3:"片";s:3:"⽛";s:3:"牙";s:3:"⽜";s:3:"牛";s:3:"⽝";s:3:"犬";s:3:"⽞";s:3:"玄";s:3:"⽟";s:3:"玉";s:3:"⽠";s:3:"瓜";s:3:"⽡";s:3:"瓦";s:3:"⽢";s:3:"甘";s:3:"⽣";s:3:"生";s:3:"⽤";s:3:"用";s:3:"⽥";s:3:"田";s:3:"⽦";s:3:"疋";s:3:"⽧";s:3:"疒";s:3:"⽨";s:3:"癶";s:3:"⽩";s:3:"白";s:3:"⽪";s:3:"皮";s:3:"⽫";s:3:"皿";s:3:"⽬";s:3:"目";s:3:"⽭";s:3:"矛";s:3:"⽮";s:3:"矢";s:3:"⽯";s:3:"石";s:3:"⽰";s:3:"示";s:3:"⽱";s:3:"禸";s:3:"⽲";s:3:"禾";s:3:"⽳";s:3:"穴";s:3:"⽴";s:3:"立";s:3:"⽵";s:3:"竹";s:3:"⽶";s:3:"米";s:3:"⽷";s:3:"糸";s:3:"⽸";s:3:"缶";s:3:"⽹";s:3:"网";s:3:"⽺";s:3:"羊";s:3:"⽻";s:3:"羽";s:3:"⽼";s:3:"老";s:3:"⽽";s:3:"而";s:3:"⽾";s:3:"耒";s:3:"⽿";s:3:"耳";s:3:"⾀";s:3:"聿";s:3:"⾁";s:3:"肉";s:3:"⾂";s:3:"臣";s:3:"⾃";s:3:"自";s:3:"⾄";s:3:"至";s:3:"⾅";s:3:"臼";s:3:"⾆";s:3:"舌";s:3:"⾇";s:3:"舛";s:3:"⾈";s:3:"舟";s:3:"⾉";s:3:"艮";s:3:"⾊";s:3:"色";s:3:"⾋";s:3:"艸";s:3:"⾌";s:3:"虍";s:3:"⾍";s:3:"虫";s:3:"⾎";s:3:"血";s:3:"⾏";s:3:"行";s:3:"⾐";s:3:"衣";s:3:"⾑";s:3:"襾";s:3:"⾒";s:3:"見";s:3:"⾓";s:3:"角";s:3:"⾔";s:3:"言";s:3:"⾕";s:3:"谷";s:3:"⾖";s:3:"豆";s:3:"⾗";s:3:"豕";s:3:"⾘";s:3:"豸";s:3:"⾙";s:3:"貝";s:3:"⾚";s:3:"赤";s:3:"⾛";s:3:"走";s:3:"⾜";s:3:"足";s:3:"⾝";s:3:"身";s:3:"⾞";s:3:"車";s:3:"⾟";s:3:"辛";s:3:"⾠";s:3:"辰";s:3:"⾡";s:3:"辵";s:3:"⾢";s:3:"邑";s:3:"⾣";s:3:"酉";s:3:"⾤";s:3:"釆";s:3:"⾥";s:3:"里";s:3:"⾦";s:3:"金";s:3:"⾧";s:3:"長";s:3:"⾨";s:3:"門";s:3:"⾩";s:3:"阜";s:3:"⾪";s:3:"隶";s:3:"⾫";s:3:"隹";s:3:"⾬";s:3:"雨";s:3:"⾭";s:3:"靑";s:3:"⾮";s:3:"非";s:3:"⾯";s:3:"面";s:3:"⾰";s:3:"革";s:3:"⾱";s:3:"韋";s:3:"⾲";s:3:"韭";s:3:"⾳";s:3:"音";s:3:"⾴";s:3:"頁";s:3:"⾵";s:3:"風";s:3:"⾶";s:3:"飛";s:3:"⾷";s:3:"食";s:3:"⾸";s:3:"首";s:3:"⾹";s:3:"香";s:3:"⾺";s:3:"馬";s:3:"⾻";s:3:"骨";s:3:"⾼";s:3:"高";s:3:"⾽";s:3:"髟";s:3:"⾾";s:3:"鬥";s:3:"⾿";s:3:"鬯";s:3:"⿀";s:3:"鬲";s:3:"⿁";s:3:"鬼";s:3:"⿂";s:3:"魚";s:3:"⿃";s:3:"鳥";s:3:"⿄";s:3:"鹵";s:3:"⿅";s:3:"鹿";s:3:"⿆";s:3:"麥";s:3:"⿇";s:3:"麻";s:3:"⿈";s:3:"黃";s:3:"⿉";s:3:"黍";s:3:"⿊";s:3:"黑";s:3:"⿋";s:3:"黹";s:3:"⿌";s:3:"黽";s:3:"⿍";s:3:"鼎";s:3:"⿎";s:3:"鼓";s:3:"⿏";s:3:"鼠";s:3:"⿐";s:3:"鼻";s:3:"⿑";s:3:"齊";s:3:"⿒";s:3:"齒";s:3:"⿓";s:3:"龍";s:3:"⿔";s:3:"龜";s:3:"⿕";s:3:"龠";s:3:" ";s:1:" ";s:3:"〶";s:3:"〒";s:3:"〸";s:3:"十";s:3:"〹";s:3:"卄";s:3:"〺";s:3:"卅";s:3:"゛";s:4:" ゙";s:3:"゜";s:4:" ゚";s:3:"ゟ";s:6:"より";s:3:"ヿ";s:6:"コト";s:3:"ㄱ";s:3:"ᄀ";s:3:"ㄲ";s:3:"ᄁ";s:3:"ㄳ";s:3:"ᆪ";s:3:"ㄴ";s:3:"ᄂ";s:3:"ㄵ";s:3:"ᆬ";s:3:"ㄶ";s:3:"ᆭ";s:3:"ㄷ";s:3:"ᄃ";s:3:"ㄸ";s:3:"ᄄ";s:3:"ㄹ";s:3:"ᄅ";s:3:"ㄺ";s:3:"ᆰ";s:3:"ㄻ";s:3:"ᆱ";s:3:"ㄼ";s:3:"ᆲ";s:3:"ㄽ";s:3:"ᆳ";s:3:"ㄾ";s:3:"ᆴ";s:3:"ㄿ";s:3:"ᆵ";s:3:"ㅀ";s:3:"ᄚ";s:3:"ㅁ";s:3:"ᄆ";s:3:"ㅂ";s:3:"ᄇ";s:3:"ㅃ";s:3:"ᄈ";s:3:"ㅄ";s:3:"ᄡ";s:3:"ㅅ";s:3:"ᄉ";s:3:"ㅆ";s:3:"ᄊ";s:3:"ㅇ";s:3:"ᄋ";s:3:"ㅈ";s:3:"ᄌ";s:3:"ㅉ";s:3:"ᄍ";s:3:"ㅊ";s:3:"ᄎ";s:3:"ㅋ";s:3:"ᄏ";s:3:"ㅌ";s:3:"ᄐ";s:3:"ㅍ";s:3:"ᄑ";s:3:"ㅎ";s:3:"ᄒ";s:3:"ㅏ";s:3:"ᅡ";s:3:"ㅐ";s:3:"ᅢ";s:3:"ㅑ";s:3:"ᅣ";s:3:"ㅒ";s:3:"ᅤ";s:3:"ㅓ";s:3:"ᅥ";s:3:"ㅔ";s:3:"ᅦ";s:3:"ㅕ";s:3:"ᅧ";s:3:"ㅖ";s:3:"ᅨ";s:3:"ㅗ";s:3:"ᅩ";s:3:"ㅘ";s:3:"ᅪ";s:3:"ㅙ";s:3:"ᅫ";s:3:"ㅚ";s:3:"ᅬ";s:3:"ㅛ";s:3:"ᅭ";s:3:"ㅜ";s:3:"ᅮ";s:3:"ㅝ";s:3:"ᅯ";s:3:"ㅞ";s:3:"ᅰ";s:3:"ㅟ";s:3:"ᅱ";s:3:"ㅠ";s:3:"ᅲ";s:3:"ㅡ";s:3:"ᅳ";s:3:"ㅢ";s:3:"ᅴ";s:3:"ㅣ";s:3:"ᅵ";s:3:"ㅤ";s:3:"ᅠ";s:3:"ㅥ";s:3:"ᄔ";s:3:"ㅦ";s:3:"ᄕ";s:3:"ㅧ";s:3:"ᇇ";s:3:"ㅨ";s:3:"ᇈ";s:3:"ㅩ";s:3:"ᇌ";s:3:"ㅪ";s:3:"ᇎ";s:3:"ㅫ";s:3:"ᇓ";s:3:"ㅬ";s:3:"ᇗ";s:3:"ㅭ";s:3:"ᇙ";s:3:"ㅮ";s:3:"ᄜ";s:3:"ㅯ";s:3:"ᇝ";s:3:"ㅰ";s:3:"ᇟ";s:3:"ㅱ";s:3:"ᄝ";s:3:"ㅲ";s:3:"ᄞ";s:3:"ㅳ";s:3:"ᄠ";s:3:"ㅴ";s:3:"ᄢ";s:3:"ㅵ";s:3:"ᄣ";s:3:"ㅶ";s:3:"ᄧ";s:3:"ㅷ";s:3:"ᄩ";s:3:"ㅸ";s:3:"ᄫ";s:3:"ㅹ";s:3:"ᄬ";s:3:"ㅺ";s:3:"ᄭ";s:3:"ㅻ";s:3:"ᄮ";s:3:"ㅼ";s:3:"ᄯ";s:3:"ㅽ";s:3:"ᄲ";s:3:"ㅾ";s:3:"ᄶ";s:3:"ㅿ";s:3:"ᅀ";s:3:"ㆀ";s:3:"ᅇ";s:3:"ㆁ";s:3:"ᅌ";s:3:"ㆂ";s:3:"ᇱ";s:3:"ㆃ";s:3:"ᇲ";s:3:"ㆄ";s:3:"ᅗ";s:3:"ㆅ";s:3:"ᅘ";s:3:"ㆆ";s:3:"ᅙ";s:3:"ㆇ";s:3:"ᆄ";s:3:"ㆈ";s:3:"ᆅ";s:3:"ㆉ";s:3:"ᆈ";s:3:"ㆊ";s:3:"ᆑ";s:3:"ㆋ";s:3:"ᆒ";s:3:"ㆌ";s:3:"ᆔ";s:3:"ㆍ";s:3:"ᆞ";s:3:"ㆎ";s:3:"ᆡ";s:3:"㆒";s:3:"一";s:3:"㆓";s:3:"二";s:3:"㆔";s:3:"三";s:3:"㆕";s:3:"四";s:3:"㆖";s:3:"上";s:3:"㆗";s:3:"中";s:3:"㆘";s:3:"下";s:3:"㆙";s:3:"甲";s:3:"㆚";s:3:"乙";s:3:"㆛";s:3:"丙";s:3:"㆜";s:3:"丁";s:3:"㆝";s:3:"天";s:3:"㆞";s:3:"地";s:3:"㆟";s:3:"人";s:3:"㈀";s:5:"(ᄀ)";s:3:"㈁";s:5:"(ᄂ)";s:3:"㈂";s:5:"(ᄃ)";s:3:"㈃";s:5:"(ᄅ)";s:3:"㈄";s:5:"(ᄆ)";s:3:"㈅";s:5:"(ᄇ)";s:3:"㈆";s:5:"(ᄉ)";s:3:"㈇";s:5:"(ᄋ)";s:3:"㈈";s:5:"(ᄌ)";s:3:"㈉";s:5:"(ᄎ)";s:3:"㈊";s:5:"(ᄏ)";s:3:"㈋";s:5:"(ᄐ)";s:3:"㈌";s:5:"(ᄑ)";s:3:"㈍";s:5:"(ᄒ)";s:3:"㈎";s:8:"(가)";s:3:"㈏";s:8:"(나)";s:3:"㈐";s:8:"(다)";s:3:"㈑";s:8:"(라)";s:3:"㈒";s:8:"(마)";s:3:"㈓";s:8:"(바)";s:3:"㈔";s:8:"(사)";s:3:"㈕";s:8:"(아)";s:3:"㈖";s:8:"(자)";s:3:"㈗";s:8:"(차)";s:3:"㈘";s:8:"(카)";s:3:"㈙";s:8:"(타)";s:3:"㈚";s:8:"(파)";s:3:"㈛";s:8:"(하)";s:3:"㈜";s:8:"(주)";s:3:"㈝";s:17:"(오전)";s:3:"㈞";s:14:"(오후)";s:3:"㈠";s:5:"(一)";s:3:"㈡";s:5:"(二)";s:3:"㈢";s:5:"(三)";s:3:"㈣";s:5:"(四)";s:3:"㈤";s:5:"(五)";s:3:"㈥";s:5:"(六)";s:3:"㈦";s:5:"(七)";s:3:"㈧";s:5:"(八)";s:3:"㈨";s:5:"(九)";s:3:"㈩";s:5:"(十)";s:3:"㈪";s:5:"(月)";s:3:"㈫";s:5:"(火)";s:3:"㈬";s:5:"(水)";s:3:"㈭";s:5:"(木)";s:3:"㈮";s:5:"(金)";s:3:"㈯";s:5:"(土)";s:3:"㈰";s:5:"(日)";s:3:"㈱";s:5:"(株)";s:3:"㈲";s:5:"(有)";s:3:"㈳";s:5:"(社)";s:3:"㈴";s:5:"(名)";s:3:"㈵";s:5:"(特)";s:3:"㈶";s:5:"(財)";s:3:"㈷";s:5:"(祝)";s:3:"㈸";s:5:"(労)";s:3:"㈹";s:5:"(代)";s:3:"㈺";s:5:"(呼)";s:3:"㈻";s:5:"(学)";s:3:"㈼";s:5:"(監)";s:3:"㈽";s:5:"(企)";s:3:"㈾";s:5:"(資)";s:3:"㈿";s:5:"(協)";s:3:"㉀";s:5:"(祭)";s:3:"㉁";s:5:"(休)";s:3:"㉂";s:5:"(自)";s:3:"㉃";s:5:"(至)";s:3:"㉄";s:3:"問";s:3:"㉅";s:3:"幼";s:3:"㉆";s:3:"文";s:3:"㉇";s:3:"箏";s:3:"㉐";s:3:"PTE";s:3:"㉑";s:2:"21";s:3:"㉒";s:2:"22";s:3:"㉓";s:2:"23";s:3:"㉔";s:2:"24";s:3:"㉕";s:2:"25";s:3:"㉖";s:2:"26";s:3:"㉗";s:2:"27";s:3:"㉘";s:2:"28";s:3:"㉙";s:2:"29";s:3:"㉚";s:2:"30";s:3:"㉛";s:2:"31";s:3:"㉜";s:2:"32";s:3:"㉝";s:2:"33";s:3:"㉞";s:2:"34";s:3:"㉟";s:2:"35";s:3:"㉠";s:3:"ᄀ";s:3:"㉡";s:3:"ᄂ";s:3:"㉢";s:3:"ᄃ";s:3:"㉣";s:3:"ᄅ";s:3:"㉤";s:3:"ᄆ";s:3:"㉥";s:3:"ᄇ";s:3:"㉦";s:3:"ᄉ";s:3:"㉧";s:3:"ᄋ";s:3:"㉨";s:3:"ᄌ";s:3:"㉩";s:3:"ᄎ";s:3:"㉪";s:3:"ᄏ";s:3:"㉫";s:3:"ᄐ";s:3:"㉬";s:3:"ᄑ";s:3:"㉭";s:3:"ᄒ";s:3:"㉮";s:6:"가";s:3:"㉯";s:6:"나";s:3:"㉰";s:6:"다";s:3:"㉱";s:6:"라";s:3:"㉲";s:6:"마";s:3:"㉳";s:6:"바";s:3:"㉴";s:6:"사";s:3:"㉵";s:6:"아";s:3:"㉶";s:6:"자";s:3:"㉷";s:6:"차";s:3:"㉸";s:6:"카";s:3:"㉹";s:6:"타";s:3:"㉺";s:6:"파";s:3:"㉻";s:6:"하";s:3:"㉼";s:15:"참고";s:3:"㉽";s:12:"주의";s:3:"㉾";s:6:"우";s:3:"㊀";s:3:"一";s:3:"㊁";s:3:"二";s:3:"㊂";s:3:"三";s:3:"㊃";s:3:"四";s:3:"㊄";s:3:"五";s:3:"㊅";s:3:"六";s:3:"㊆";s:3:"七";s:3:"㊇";s:3:"八";s:3:"㊈";s:3:"九";s:3:"㊉";s:3:"十";s:3:"㊊";s:3:"月";s:3:"㊋";s:3:"火";s:3:"㊌";s:3:"水";s:3:"㊍";s:3:"木";s:3:"㊎";s:3:"金";s:3:"㊏";s:3:"土";s:3:"㊐";s:3:"日";s:3:"㊑";s:3:"株";s:3:"㊒";s:3:"有";s:3:"㊓";s:3:"社";s:3:"㊔";s:3:"名";s:3:"㊕";s:3:"特";s:3:"㊖";s:3:"財";s:3:"㊗";s:3:"祝";s:3:"㊘";s:3:"労";s:3:"㊙";s:3:"秘";s:3:"㊚";s:3:"男";s:3:"㊛";s:3:"女";s:3:"㊜";s:3:"適";s:3:"㊝";s:3:"優";s:3:"㊞";s:3:"印";s:3:"㊟";s:3:"注";s:3:"㊠";s:3:"項";s:3:"㊡";s:3:"休";s:3:"㊢";s:3:"写";s:3:"㊣";s:3:"正";s:3:"㊤";s:3:"上";s:3:"㊥";s:3:"中";s:3:"㊦";s:3:"下";s:3:"㊧";s:3:"左";s:3:"㊨";s:3:"右";s:3:"㊩";s:3:"医";s:3:"㊪";s:3:"宗";s:3:"㊫";s:3:"学";s:3:"㊬";s:3:"監";s:3:"㊭";s:3:"企";s:3:"㊮";s:3:"資";s:3:"㊯";s:3:"協";s:3:"㊰";s:3:"夜";s:3:"㊱";s:2:"36";s:3:"㊲";s:2:"37";s:3:"㊳";s:2:"38";s:3:"㊴";s:2:"39";s:3:"㊵";s:2:"40";s:3:"㊶";s:2:"41";s:3:"㊷";s:2:"42";s:3:"㊸";s:2:"43";s:3:"㊹";s:2:"44";s:3:"㊺";s:2:"45";s:3:"㊻";s:2:"46";s:3:"㊼";s:2:"47";s:3:"㊽";s:2:"48";s:3:"㊾";s:2:"49";s:3:"㊿";s:2:"50";s:3:"㋀";s:4:"1月";s:3:"㋁";s:4:"2月";s:3:"㋂";s:4:"3月";s:3:"㋃";s:4:"4月";s:3:"㋄";s:4:"5月";s:3:"㋅";s:4:"6月";s:3:"㋆";s:4:"7月";s:3:"㋇";s:4:"8月";s:3:"㋈";s:4:"9月";s:3:"㋉";s:5:"10月";s:3:"㋊";s:5:"11月";s:3:"㋋";s:5:"12月";s:3:"㋌";s:2:"Hg";s:3:"㋍";s:3:"erg";s:3:"㋎";s:2:"eV";s:3:"㋏";s:3:"LTD";s:3:"㋐";s:3:"ア";s:3:"㋑";s:3:"イ";s:3:"㋒";s:3:"ウ";s:3:"㋓";s:3:"エ";s:3:"㋔";s:3:"オ";s:3:"㋕";s:3:"カ";s:3:"㋖";s:3:"キ";s:3:"㋗";s:3:"ク";s:3:"㋘";s:3:"ケ";s:3:"㋙";s:3:"コ";s:3:"㋚";s:3:"サ";s:3:"㋛";s:3:"シ";s:3:"㋜";s:3:"ス";s:3:"㋝";s:3:"セ";s:3:"㋞";s:3:"ソ";s:3:"㋟";s:3:"タ";s:3:"㋠";s:3:"チ";s:3:"㋡";s:3:"ツ";s:3:"㋢";s:3:"テ";s:3:"㋣";s:3:"ト";s:3:"㋤";s:3:"ナ";s:3:"㋥";s:3:"ニ";s:3:"㋦";s:3:"ヌ";s:3:"㋧";s:3:"ネ";s:3:"㋨";s:3:"ノ";s:3:"㋩";s:3:"ハ";s:3:"㋪";s:3:"ヒ";s:3:"㋫";s:3:"フ";s:3:"㋬";s:3:"ヘ";s:3:"㋭";s:3:"ホ";s:3:"㋮";s:3:"マ";s:3:"㋯";s:3:"ミ";s:3:"㋰";s:3:"ム";s:3:"㋱";s:3:"メ";s:3:"㋲";s:3:"モ";s:3:"㋳";s:3:"ヤ";s:3:"㋴";s:3:"ユ";s:3:"㋵";s:3:"ヨ";s:3:"㋶";s:3:"ラ";s:3:"㋷";s:3:"リ";s:3:"㋸";s:3:"ル";s:3:"㋹";s:3:"レ";s:3:"㋺";s:3:"ロ";s:3:"㋻";s:3:"ワ";s:3:"㋼";s:3:"ヰ";s:3:"㋽";s:3:"ヱ";s:3:"㋾";s:3:"ヲ";s:3:"㌀";s:15:"アパート";s:3:"㌁";s:12:"アルファ";s:3:"㌂";s:15:"アンペア";s:3:"㌃";s:9:"アール";s:3:"㌄";s:15:"イニング";s:3:"㌅";s:9:"インチ";s:3:"㌆";s:9:"ウォン";s:3:"㌇";s:18:"エスクード";s:3:"㌈";s:12:"エーカー";s:3:"㌉";s:9:"オンス";s:3:"㌊";s:9:"オーム";s:3:"㌋";s:9:"カイリ";s:3:"㌌";s:12:"カラット";s:3:"㌍";s:12:"カロリー";s:3:"㌎";s:12:"ガロン";s:3:"㌏";s:12:"ガンマ";s:3:"㌐";s:12:"ギガ";s:3:"㌑";s:12:"ギニー";s:3:"㌒";s:12:"キュリー";s:3:"㌓";s:18:"ギルダー";s:3:"㌔";s:6:"キロ";s:3:"㌕";s:18:"キログラム";s:3:"㌖";s:18:"キロメートル";s:3:"㌗";s:15:"キロワット";s:3:"㌘";s:12:"グラム";s:3:"㌙";s:18:"グラムトン";s:3:"㌚";s:18:"クルゼイロ";s:3:"㌛";s:12:"クローネ";s:3:"㌜";s:9:"ケース";s:3:"㌝";s:9:"コルナ";s:3:"㌞";s:12:"コーポ";s:3:"㌟";s:12:"サイクル";s:3:"㌠";s:15:"サンチーム";s:3:"㌡";s:15:"シリング";s:3:"㌢";s:9:"センチ";s:3:"㌣";s:9:"セント";s:3:"㌤";s:12:"ダース";s:3:"㌥";s:9:"デシ";s:3:"㌦";s:9:"ドル";s:3:"㌧";s:6:"トン";s:3:"㌨";s:6:"ナノ";s:3:"㌩";s:9:"ノット";s:3:"㌪";s:9:"ハイツ";s:3:"㌫";s:18:"パーセント";s:3:"㌬";s:12:"パーツ";s:3:"㌭";s:15:"バーレル";s:3:"㌮";s:18:"ピアストル";s:3:"㌯";s:12:"ピクル";s:3:"㌰";s:9:"ピコ";s:3:"㌱";s:9:"ビル";s:3:"㌲";s:18:"ファラッド";s:3:"㌳";s:12:"フィート";s:3:"㌴";s:18:"ブッシェル";s:3:"㌵";s:9:"フラン";s:3:"㌶";s:15:"ヘクタール";s:3:"㌷";s:9:"ペソ";s:3:"㌸";s:12:"ペニヒ";s:3:"㌹";s:9:"ヘルツ";s:3:"㌺";s:12:"ペンス";s:3:"㌻";s:15:"ページ";s:3:"㌼";s:12:"ベータ";s:3:"㌽";s:15:"ポイント";s:3:"㌾";s:12:"ボルト";s:3:"㌿";s:6:"ホン";s:3:"㍀";s:15:"ポンド";s:3:"㍁";s:9:"ホール";s:3:"㍂";s:9:"ホーン";s:3:"㍃";s:12:"マイクロ";s:3:"㍄";s:9:"マイル";s:3:"㍅";s:9:"マッハ";s:3:"㍆";s:9:"マルク";s:3:"㍇";s:15:"マンション";s:3:"㍈";s:12:"ミクロン";s:3:"㍉";s:6:"ミリ";s:3:"㍊";s:18:"ミリバール";s:3:"㍋";s:9:"メガ";s:3:"㍌";s:15:"メガトン";s:3:"㍍";s:12:"メートル";s:3:"㍎";s:12:"ヤード";s:3:"㍏";s:9:"ヤール";s:3:"㍐";s:9:"ユアン";s:3:"㍑";s:12:"リットル";s:3:"㍒";s:6:"リラ";s:3:"㍓";s:12:"ルピー";s:3:"㍔";s:15:"ルーブル";s:3:"㍕";s:6:"レム";s:3:"㍖";s:18:"レントゲン";s:3:"㍗";s:9:"ワット";s:3:"㍘";s:4:"0点";s:3:"㍙";s:4:"1点";s:3:"㍚";s:4:"2点";s:3:"㍛";s:4:"3点";s:3:"㍜";s:4:"4点";s:3:"㍝";s:4:"5点";s:3:"㍞";s:4:"6点";s:3:"㍟";s:4:"7点";s:3:"㍠";s:4:"8点";s:3:"㍡";s:4:"9点";s:3:"㍢";s:5:"10点";s:3:"㍣";s:5:"11点";s:3:"㍤";s:5:"12点";s:3:"㍥";s:5:"13点";s:3:"㍦";s:5:"14点";s:3:"㍧";s:5:"15点";s:3:"㍨";s:5:"16点";s:3:"㍩";s:5:"17点";s:3:"㍪";s:5:"18点";s:3:"㍫";s:5:"19点";s:3:"㍬";s:5:"20点";s:3:"㍭";s:5:"21点";s:3:"㍮";s:5:"22点";s:3:"㍯";s:5:"23点";s:3:"㍰";s:5:"24点";s:3:"㍱";s:3:"hPa";s:3:"㍲";s:2:"da";s:3:"㍳";s:2:"AU";s:3:"㍴";s:3:"bar";s:3:"㍵";s:2:"oV";s:3:"㍶";s:2:"pc";s:3:"㍷";s:2:"dm";s:3:"㍸";s:3:"dm2";s:3:"㍹";s:3:"dm3";s:3:"㍺";s:2:"IU";s:3:"㍻";s:6:"平成";s:3:"㍼";s:6:"昭和";s:3:"㍽";s:6:"大正";s:3:"㍾";s:6:"明治";s:3:"㍿";s:12:"株式会社";s:3:"㎀";s:2:"pA";s:3:"㎁";s:2:"nA";s:3:"㎂";s:3:"μA";s:3:"㎃";s:2:"mA";s:3:"㎄";s:2:"kA";s:3:"㎅";s:2:"KB";s:3:"㎆";s:2:"MB";s:3:"㎇";s:2:"GB";s:3:"㎈";s:3:"cal";s:3:"㎉";s:4:"kcal";s:3:"㎊";s:2:"pF";s:3:"㎋";s:2:"nF";s:3:"㎌";s:3:"μF";s:3:"㎍";s:3:"μg";s:3:"㎎";s:2:"mg";s:3:"㎏";s:2:"kg";s:3:"㎐";s:2:"Hz";s:3:"㎑";s:3:"kHz";s:3:"㎒";s:3:"MHz";s:3:"㎓";s:3:"GHz";s:3:"㎔";s:3:"THz";s:3:"㎕";s:3:"μl";s:3:"㎖";s:2:"ml";s:3:"㎗";s:2:"dl";s:3:"㎘";s:2:"kl";s:3:"㎙";s:2:"fm";s:3:"㎚";s:2:"nm";s:3:"㎛";s:3:"μm";s:3:"㎜";s:2:"mm";s:3:"㎝";s:2:"cm";s:3:"㎞";s:2:"km";s:3:"㎟";s:3:"mm2";s:3:"㎠";s:3:"cm2";s:3:"㎡";s:2:"m2";s:3:"㎢";s:3:"km2";s:3:"㎣";s:3:"mm3";s:3:"㎤";s:3:"cm3";s:3:"㎥";s:2:"m3";s:3:"㎦";s:3:"km3";s:3:"㎧";s:5:"m∕s";s:3:"㎨";s:6:"m∕s2";s:3:"㎩";s:2:"Pa";s:3:"㎪";s:3:"kPa";s:3:"㎫";s:3:"MPa";s:3:"㎬";s:3:"GPa";s:3:"㎭";s:3:"rad";s:3:"㎮";s:7:"rad∕s";s:3:"㎯";s:8:"rad∕s2";s:3:"㎰";s:2:"ps";s:3:"㎱";s:2:"ns";s:3:"㎲";s:3:"μs";s:3:"㎳";s:2:"ms";s:3:"㎴";s:2:"pV";s:3:"㎵";s:2:"nV";s:3:"㎶";s:3:"μV";s:3:"㎷";s:2:"mV";s:3:"㎸";s:2:"kV";s:3:"㎹";s:2:"MV";s:3:"㎺";s:2:"pW";s:3:"㎻";s:2:"nW";s:3:"㎼";s:3:"μW";s:3:"㎽";s:2:"mW";s:3:"㎾";s:2:"kW";s:3:"㎿";s:2:"MW";s:3:"㏀";s:3:"kΩ";s:3:"㏁";s:3:"MΩ";s:3:"㏂";s:4:"a.m.";s:3:"㏃";s:2:"Bq";s:3:"㏄";s:2:"cc";s:3:"㏅";s:2:"cd";s:3:"㏆";s:6:"C∕kg";s:3:"㏇";s:3:"Co.";s:3:"㏈";s:2:"dB";s:3:"㏉";s:2:"Gy";s:3:"㏊";s:2:"ha";s:3:"㏋";s:2:"HP";s:3:"㏌";s:2:"in";s:3:"㏍";s:2:"KK";s:3:"㏎";s:2:"KM";s:3:"㏏";s:2:"kt";s:3:"㏐";s:2:"lm";s:3:"㏑";s:2:"ln";s:3:"㏒";s:3:"log";s:3:"㏓";s:2:"lx";s:3:"㏔";s:2:"mb";s:3:"㏕";s:3:"mil";s:3:"㏖";s:3:"mol";s:3:"㏗";s:2:"PH";s:3:"㏘";s:4:"p.m.";s:3:"㏙";s:3:"PPM";s:3:"㏚";s:2:"PR";s:3:"㏛";s:2:"sr";s:3:"㏜";s:2:"Sv";s:3:"㏝";s:2:"Wb";s:3:"㏞";s:5:"V∕m";s:3:"㏟";s:5:"A∕m";s:3:"㏠";s:4:"1日";s:3:"㏡";s:4:"2日";s:3:"㏢";s:4:"3日";s:3:"㏣";s:4:"4日";s:3:"㏤";s:4:"5日";s:3:"㏥";s:4:"6日";s:3:"㏦";s:4:"7日";s:3:"㏧";s:4:"8日";s:3:"㏨";s:4:"9日";s:3:"㏩";s:5:"10日";s:3:"㏪";s:5:"11日";s:3:"㏫";s:5:"12日";s:3:"㏬";s:5:"13日";s:3:"㏭";s:5:"14日";s:3:"㏮";s:5:"15日";s:3:"㏯";s:5:"16日";s:3:"㏰";s:5:"17日";s:3:"㏱";s:5:"18日";s:3:"㏲";s:5:"19日";s:3:"㏳";s:5:"20日";s:3:"㏴";s:5:"21日";s:3:"㏵";s:5:"22日";s:3:"㏶";s:5:"23日";s:3:"㏷";s:5:"24日";s:3:"㏸";s:5:"25日";s:3:"㏹";s:5:"26日";s:3:"㏺";s:5:"27日";s:3:"㏻";s:5:"28日";s:3:"㏼";s:5:"29日";s:3:"㏽";s:5:"30日";s:3:"㏾";s:5:"31日";s:3:"㏿";s:3:"gal";s:3:"ꚜ";s:2:"ъ";s:3:"ꚝ";s:2:"ь";s:3:"ꝰ";s:3:"ꝯ";s:3:"ꟸ";s:2:"Ħ";s:3:"ꟹ";s:2:"œ";s:3:"ꭜ";s:3:"ꜧ";s:3:"ꭝ";s:3:"ꬷ";s:3:"ꭞ";s:2:"ɫ";s:3:"ꭟ";s:3:"ꭒ";s:3:"ff";s:2:"ff";s:3:"fi";s:2:"fi";s:3:"fl";s:2:"fl";s:3:"ffi";s:3:"ffi";s:3:"ffl";s:3:"ffl";s:3:"ſt";s:2:"st";s:3:"st";s:2:"st";s:3:"ﬓ";s:4:"մն";s:3:"ﬔ";s:4:"մե";s:3:"ﬕ";s:4:"մի";s:3:"ﬖ";s:4:"վն";s:3:"ﬗ";s:4:"մխ";s:3:"ﬠ";s:2:"ע";s:3:"ﬡ";s:2:"א";s:3:"ﬢ";s:2:"ד";s:3:"ﬣ";s:2:"ה";s:3:"ﬤ";s:2:"כ";s:3:"ﬥ";s:2:"ל";s:3:"ﬦ";s:2:"ם";s:3:"ﬧ";s:2:"ר";s:3:"ﬨ";s:2:"ת";s:3:"﬩";s:1:"+";s:3:"ﭏ";s:4:"אל";s:3:"ﭐ";s:2:"ٱ";s:3:"ﭑ";s:2:"ٱ";s:3:"ﭒ";s:2:"ٻ";s:3:"ﭓ";s:2:"ٻ";s:3:"ﭔ";s:2:"ٻ";s:3:"ﭕ";s:2:"ٻ";s:3:"ﭖ";s:2:"پ";s:3:"ﭗ";s:2:"پ";s:3:"ﭘ";s:2:"پ";s:3:"ﭙ";s:2:"پ";s:3:"ﭚ";s:2:"ڀ";s:3:"ﭛ";s:2:"ڀ";s:3:"ﭜ";s:2:"ڀ";s:3:"ﭝ";s:2:"ڀ";s:3:"ﭞ";s:2:"ٺ";s:3:"ﭟ";s:2:"ٺ";s:3:"ﭠ";s:2:"ٺ";s:3:"ﭡ";s:2:"ٺ";s:3:"ﭢ";s:2:"ٿ";s:3:"ﭣ";s:2:"ٿ";s:3:"ﭤ";s:2:"ٿ";s:3:"ﭥ";s:2:"ٿ";s:3:"ﭦ";s:2:"ٹ";s:3:"ﭧ";s:2:"ٹ";s:3:"ﭨ";s:2:"ٹ";s:3:"ﭩ";s:2:"ٹ";s:3:"ﭪ";s:2:"ڤ";s:3:"ﭫ";s:2:"ڤ";s:3:"ﭬ";s:2:"ڤ";s:3:"ﭭ";s:2:"ڤ";s:3:"ﭮ";s:2:"ڦ";s:3:"ﭯ";s:2:"ڦ";s:3:"ﭰ";s:2:"ڦ";s:3:"ﭱ";s:2:"ڦ";s:3:"ﭲ";s:2:"ڄ";s:3:"ﭳ";s:2:"ڄ";s:3:"ﭴ";s:2:"ڄ";s:3:"ﭵ";s:2:"ڄ";s:3:"ﭶ";s:2:"ڃ";s:3:"ﭷ";s:2:"ڃ";s:3:"ﭸ";s:2:"ڃ";s:3:"ﭹ";s:2:"ڃ";s:3:"ﭺ";s:2:"چ";s:3:"ﭻ";s:2:"چ";s:3:"ﭼ";s:2:"چ";s:3:"ﭽ";s:2:"چ";s:3:"ﭾ";s:2:"ڇ";s:3:"ﭿ";s:2:"ڇ";s:3:"ﮀ";s:2:"ڇ";s:3:"ﮁ";s:2:"ڇ";s:3:"ﮂ";s:2:"ڍ";s:3:"ﮃ";s:2:"ڍ";s:3:"ﮄ";s:2:"ڌ";s:3:"ﮅ";s:2:"ڌ";s:3:"ﮆ";s:2:"ڎ";s:3:"ﮇ";s:2:"ڎ";s:3:"ﮈ";s:2:"ڈ";s:3:"ﮉ";s:2:"ڈ";s:3:"ﮊ";s:2:"ژ";s:3:"ﮋ";s:2:"ژ";s:3:"ﮌ";s:2:"ڑ";s:3:"ﮍ";s:2:"ڑ";s:3:"ﮎ";s:2:"ک";s:3:"ﮏ";s:2:"ک";s:3:"ﮐ";s:2:"ک";s:3:"ﮑ";s:2:"ک";s:3:"ﮒ";s:2:"گ";s:3:"ﮓ";s:2:"گ";s:3:"ﮔ";s:2:"گ";s:3:"ﮕ";s:2:"گ";s:3:"ﮖ";s:2:"ڳ";s:3:"ﮗ";s:2:"ڳ";s:3:"ﮘ";s:2:"ڳ";s:3:"ﮙ";s:2:"ڳ";s:3:"ﮚ";s:2:"ڱ";s:3:"ﮛ";s:2:"ڱ";s:3:"ﮜ";s:2:"ڱ";s:3:"ﮝ";s:2:"ڱ";s:3:"ﮞ";s:2:"ں";s:3:"ﮟ";s:2:"ں";s:3:"ﮠ";s:2:"ڻ";s:3:"ﮡ";s:2:"ڻ";s:3:"ﮢ";s:2:"ڻ";s:3:"ﮣ";s:2:"ڻ";s:3:"ﮤ";s:4:"ۀ";s:3:"ﮥ";s:4:"ۀ";s:3:"ﮦ";s:2:"ہ";s:3:"ﮧ";s:2:"ہ";s:3:"ﮨ";s:2:"ہ";s:3:"ﮩ";s:2:"ہ";s:3:"ﮪ";s:2:"ھ";s:3:"ﮫ";s:2:"ھ";s:3:"ﮬ";s:2:"ھ";s:3:"ﮭ";s:2:"ھ";s:3:"ﮮ";s:2:"ے";s:3:"ﮯ";s:2:"ے";s:3:"ﮰ";s:4:"ۓ";s:3:"ﮱ";s:4:"ۓ";s:3:"ﯓ";s:2:"ڭ";s:3:"ﯔ";s:2:"ڭ";s:3:"ﯕ";s:2:"ڭ";s:3:"ﯖ";s:2:"ڭ";s:3:"ﯗ";s:2:"ۇ";s:3:"ﯘ";s:2:"ۇ";s:3:"ﯙ";s:2:"ۆ";s:3:"ﯚ";s:2:"ۆ";s:3:"ﯛ";s:2:"ۈ";s:3:"ﯜ";s:2:"ۈ";s:3:"ﯝ";s:4:"ۇٴ";s:3:"ﯞ";s:2:"ۋ";s:3:"ﯟ";s:2:"ۋ";s:3:"ﯠ";s:2:"ۅ";s:3:"ﯡ";s:2:"ۅ";s:3:"ﯢ";s:2:"ۉ";s:3:"ﯣ";s:2:"ۉ";s:3:"ﯤ";s:2:"ې";s:3:"ﯥ";s:2:"ې";s:3:"ﯦ";s:2:"ې";s:3:"ﯧ";s:2:"ې";s:3:"ﯨ";s:2:"ى";s:3:"ﯩ";s:2:"ى";s:3:"ﯪ";s:6:"ئا";s:3:"ﯫ";s:6:"ئا";s:3:"ﯬ";s:6:"ئە";s:3:"ﯭ";s:6:"ئە";s:3:"ﯮ";s:6:"ئو";s:3:"ﯯ";s:6:"ئو";s:3:"ﯰ";s:6:"ئۇ";s:3:"ﯱ";s:6:"ئۇ";s:3:"ﯲ";s:6:"ئۆ";s:3:"ﯳ";s:6:"ئۆ";s:3:"ﯴ";s:6:"ئۈ";s:3:"ﯵ";s:6:"ئۈ";s:3:"ﯶ";s:6:"ئې";s:3:"ﯷ";s:6:"ئې";s:3:"ﯸ";s:6:"ئې";s:3:"ﯹ";s:6:"ئى";s:3:"ﯺ";s:6:"ئى";s:3:"ﯻ";s:6:"ئى";s:3:"ﯼ";s:2:"ی";s:3:"ﯽ";s:2:"ی";s:3:"ﯾ";s:2:"ی";s:3:"ﯿ";s:2:"ی";s:3:"ﰀ";s:6:"ئج";s:3:"ﰁ";s:6:"ئح";s:3:"ﰂ";s:6:"ئم";s:3:"ﰃ";s:6:"ئى";s:3:"ﰄ";s:6:"ئي";s:3:"ﰅ";s:4:"بج";s:3:"ﰆ";s:4:"بح";s:3:"ﰇ";s:4:"بخ";s:3:"ﰈ";s:4:"بم";s:3:"ﰉ";s:4:"بى";s:3:"ﰊ";s:4:"بي";s:3:"ﰋ";s:4:"تج";s:3:"ﰌ";s:4:"تح";s:3:"ﰍ";s:4:"تخ";s:3:"ﰎ";s:4:"تم";s:3:"ﰏ";s:4:"تى";s:3:"ﰐ";s:4:"تي";s:3:"ﰑ";s:4:"ثج";s:3:"ﰒ";s:4:"ثم";s:3:"ﰓ";s:4:"ثى";s:3:"ﰔ";s:4:"ثي";s:3:"ﰕ";s:4:"جح";s:3:"ﰖ";s:4:"جم";s:3:"ﰗ";s:4:"حج";s:3:"ﰘ";s:4:"حم";s:3:"ﰙ";s:4:"خج";s:3:"ﰚ";s:4:"خح";s:3:"ﰛ";s:4:"خم";s:3:"ﰜ";s:4:"سج";s:3:"ﰝ";s:4:"سح";s:3:"ﰞ";s:4:"سخ";s:3:"ﰟ";s:4:"سم";s:3:"ﰠ";s:4:"صح";s:3:"ﰡ";s:4:"صم";s:3:"ﰢ";s:4:"ضج";s:3:"ﰣ";s:4:"ضح";s:3:"ﰤ";s:4:"ضخ";s:3:"ﰥ";s:4:"ضم";s:3:"ﰦ";s:4:"طح";s:3:"ﰧ";s:4:"طم";s:3:"ﰨ";s:4:"ظم";s:3:"ﰩ";s:4:"عج";s:3:"ﰪ";s:4:"عم";s:3:"ﰫ";s:4:"غج";s:3:"ﰬ";s:4:"غم";s:3:"ﰭ";s:4:"فج";s:3:"ﰮ";s:4:"فح";s:3:"ﰯ";s:4:"فخ";s:3:"ﰰ";s:4:"فم";s:3:"ﰱ";s:4:"فى";s:3:"ﰲ";s:4:"في";s:3:"ﰳ";s:4:"قح";s:3:"ﰴ";s:4:"قم";s:3:"ﰵ";s:4:"قى";s:3:"ﰶ";s:4:"قي";s:3:"ﰷ";s:4:"كا";s:3:"ﰸ";s:4:"كج";s:3:"ﰹ";s:4:"كح";s:3:"ﰺ";s:4:"كخ";s:3:"ﰻ";s:4:"كل";s:3:"ﰼ";s:4:"كم";s:3:"ﰽ";s:4:"كى";s:3:"ﰾ";s:4:"كي";s:3:"ﰿ";s:4:"لج";s:3:"ﱀ";s:4:"لح";s:3:"ﱁ";s:4:"لخ";s:3:"ﱂ";s:4:"لم";s:3:"ﱃ";s:4:"لى";s:3:"ﱄ";s:4:"لي";s:3:"ﱅ";s:4:"مج";s:3:"ﱆ";s:4:"مح";s:3:"ﱇ";s:4:"مخ";s:3:"ﱈ";s:4:"مم";s:3:"ﱉ";s:4:"مى";s:3:"ﱊ";s:4:"مي";s:3:"ﱋ";s:4:"نج";s:3:"ﱌ";s:4:"نح";s:3:"ﱍ";s:4:"نخ";s:3:"ﱎ";s:4:"نم";s:3:"ﱏ";s:4:"نى";s:3:"ﱐ";s:4:"ني";s:3:"ﱑ";s:4:"هج";s:3:"ﱒ";s:4:"هم";s:3:"ﱓ";s:4:"هى";s:3:"ﱔ";s:4:"هي";s:3:"ﱕ";s:4:"يج";s:3:"ﱖ";s:4:"يح";s:3:"ﱗ";s:4:"يخ";s:3:"ﱘ";s:4:"يم";s:3:"ﱙ";s:4:"يى";s:3:"ﱚ";s:4:"يي";s:3:"ﱛ";s:4:"ذٰ";s:3:"ﱜ";s:4:"رٰ";s:3:"ﱝ";s:4:"ىٰ";s:3:"ﱞ";s:5:" ٌّ";s:3:"ﱟ";s:5:" ٍّ";s:3:"ﱠ";s:5:" َّ";s:3:"ﱡ";s:5:" ُّ";s:3:"ﱢ";s:5:" ِّ";s:3:"ﱣ";s:5:" ّٰ";s:3:"ﱤ";s:6:"ئر";s:3:"ﱥ";s:6:"ئز";s:3:"ﱦ";s:6:"ئم";s:3:"ﱧ";s:6:"ئن";s:3:"ﱨ";s:6:"ئى";s:3:"ﱩ";s:6:"ئي";s:3:"ﱪ";s:4:"بر";s:3:"ﱫ";s:4:"بز";s:3:"ﱬ";s:4:"بم";s:3:"ﱭ";s:4:"بن";s:3:"ﱮ";s:4:"بى";s:3:"ﱯ";s:4:"بي";s:3:"ﱰ";s:4:"تر";s:3:"ﱱ";s:4:"تز";s:3:"ﱲ";s:4:"تم";s:3:"ﱳ";s:4:"تن";s:3:"ﱴ";s:4:"تى";s:3:"ﱵ";s:4:"تي";s:3:"ﱶ";s:4:"ثر";s:3:"ﱷ";s:4:"ثز";s:3:"ﱸ";s:4:"ثم";s:3:"ﱹ";s:4:"ثن";s:3:"ﱺ";s:4:"ثى";s:3:"ﱻ";s:4:"ثي";s:3:"ﱼ";s:4:"فى";s:3:"ﱽ";s:4:"في";s:3:"ﱾ";s:4:"قى";s:3:"ﱿ";s:4:"قي";s:3:"ﲀ";s:4:"كا";s:3:"ﲁ";s:4:"كل";s:3:"ﲂ";s:4:"كم";s:3:"ﲃ";s:4:"كى";s:3:"ﲄ";s:4:"كي";s:3:"ﲅ";s:4:"لم";s:3:"ﲆ";s:4:"لى";s:3:"ﲇ";s:4:"لي";s:3:"ﲈ";s:4:"ما";s:3:"ﲉ";s:4:"مم";s:3:"ﲊ";s:4:"نر";s:3:"ﲋ";s:4:"نز";s:3:"ﲌ";s:4:"نم";s:3:"ﲍ";s:4:"نن";s:3:"ﲎ";s:4:"نى";s:3:"ﲏ";s:4:"ني";s:3:"ﲐ";s:4:"ىٰ";s:3:"ﲑ";s:4:"ير";s:3:"ﲒ";s:4:"يز";s:3:"ﲓ";s:4:"يم";s:3:"ﲔ";s:4:"ين";s:3:"ﲕ";s:4:"يى";s:3:"ﲖ";s:4:"يي";s:3:"ﲗ";s:6:"ئج";s:3:"ﲘ";s:6:"ئح";s:3:"ﲙ";s:6:"ئخ";s:3:"ﲚ";s:6:"ئم";s:3:"ﲛ";s:6:"ئه";s:3:"ﲜ";s:4:"بج";s:3:"ﲝ";s:4:"بح";s:3:"ﲞ";s:4:"بخ";s:3:"ﲟ";s:4:"بم";s:3:"ﲠ";s:4:"به";s:3:"ﲡ";s:4:"تج";s:3:"ﲢ";s:4:"تح";s:3:"ﲣ";s:4:"تخ";s:3:"ﲤ";s:4:"تم";s:3:"ﲥ";s:4:"ته";s:3:"ﲦ";s:4:"ثم";s:3:"ﲧ";s:4:"جح";s:3:"ﲨ";s:4:"جم";s:3:"ﲩ";s:4:"حج";s:3:"ﲪ";s:4:"حم";s:3:"ﲫ";s:4:"خج";s:3:"ﲬ";s:4:"خم";s:3:"ﲭ";s:4:"سج";s:3:"ﲮ";s:4:"سح";s:3:"ﲯ";s:4:"سخ";s:3:"ﲰ";s:4:"سم";s:3:"ﲱ";s:4:"صح";s:3:"ﲲ";s:4:"صخ";s:3:"ﲳ";s:4:"صم";s:3:"ﲴ";s:4:"ضج";s:3:"ﲵ";s:4:"ضح";s:3:"ﲶ";s:4:"ضخ";s:3:"ﲷ";s:4:"ضم";s:3:"ﲸ";s:4:"طح";s:3:"ﲹ";s:4:"ظم";s:3:"ﲺ";s:4:"عج";s:3:"ﲻ";s:4:"عم";s:3:"ﲼ";s:4:"غج";s:3:"ﲽ";s:4:"غم";s:3:"ﲾ";s:4:"فج";s:3:"ﲿ";s:4:"فح";s:3:"ﳀ";s:4:"فخ";s:3:"ﳁ";s:4:"فم";s:3:"ﳂ";s:4:"قح";s:3:"ﳃ";s:4:"قم";s:3:"ﳄ";s:4:"كج";s:3:"ﳅ";s:4:"كح";s:3:"ﳆ";s:4:"كخ";s:3:"ﳇ";s:4:"كل";s:3:"ﳈ";s:4:"كم";s:3:"ﳉ";s:4:"لج";s:3:"ﳊ";s:4:"لح";s:3:"ﳋ";s:4:"لخ";s:3:"ﳌ";s:4:"لم";s:3:"ﳍ";s:4:"له";s:3:"ﳎ";s:4:"مج";s:3:"ﳏ";s:4:"مح";s:3:"ﳐ";s:4:"مخ";s:3:"ﳑ";s:4:"مم";s:3:"ﳒ";s:4:"نج";s:3:"ﳓ";s:4:"نح";s:3:"ﳔ";s:4:"نخ";s:3:"ﳕ";s:4:"نم";s:3:"ﳖ";s:4:"نه";s:3:"ﳗ";s:4:"هج";s:3:"ﳘ";s:4:"هم";s:3:"ﳙ";s:4:"هٰ";s:3:"ﳚ";s:4:"يج";s:3:"ﳛ";s:4:"يح";s:3:"ﳜ";s:4:"يخ";s:3:"ﳝ";s:4:"يم";s:3:"ﳞ";s:4:"يه";s:3:"ﳟ";s:6:"ئم";s:3:"ﳠ";s:6:"ئه";s:3:"ﳡ";s:4:"بم";s:3:"ﳢ";s:4:"به";s:3:"ﳣ";s:4:"تم";s:3:"ﳤ";s:4:"ته";s:3:"ﳥ";s:4:"ثم";s:3:"ﳦ";s:4:"ثه";s:3:"ﳧ";s:4:"سم";s:3:"ﳨ";s:4:"سه";s:3:"ﳩ";s:4:"شم";s:3:"ﳪ";s:4:"شه";s:3:"ﳫ";s:4:"كل";s:3:"ﳬ";s:4:"كم";s:3:"ﳭ";s:4:"لم";s:3:"ﳮ";s:4:"نم";s:3:"ﳯ";s:4:"نه";s:3:"ﳰ";s:4:"يم";s:3:"ﳱ";s:4:"يه";s:3:"ﳲ";s:6:"ـَّ";s:3:"ﳳ";s:6:"ـُّ";s:3:"ﳴ";s:6:"ـِّ";s:3:"ﳵ";s:4:"طى";s:3:"ﳶ";s:4:"طي";s:3:"ﳷ";s:4:"عى";s:3:"ﳸ";s:4:"عي";s:3:"ﳹ";s:4:"غى";s:3:"ﳺ";s:4:"غي";s:3:"ﳻ";s:4:"سى";s:3:"ﳼ";s:4:"سي";s:3:"ﳽ";s:4:"شى";s:3:"ﳾ";s:4:"شي";s:3:"ﳿ";s:4:"حى";s:3:"ﴀ";s:4:"حي";s:3:"ﴁ";s:4:"جى";s:3:"ﴂ";s:4:"جي";s:3:"ﴃ";s:4:"خى";s:3:"ﴄ";s:4:"خي";s:3:"ﴅ";s:4:"صى";s:3:"ﴆ";s:4:"صي";s:3:"ﴇ";s:4:"ضى";s:3:"ﴈ";s:4:"ضي";s:3:"ﴉ";s:4:"شج";s:3:"ﴊ";s:4:"شح";s:3:"ﴋ";s:4:"شخ";s:3:"ﴌ";s:4:"شم";s:3:"ﴍ";s:4:"شر";s:3:"ﴎ";s:4:"سر";s:3:"ﴏ";s:4:"صر";s:3:"ﴐ";s:4:"ضر";s:3:"ﴑ";s:4:"طى";s:3:"ﴒ";s:4:"طي";s:3:"ﴓ";s:4:"عى";s:3:"ﴔ";s:4:"عي";s:3:"ﴕ";s:4:"غى";s:3:"ﴖ";s:4:"غي";s:3:"ﴗ";s:4:"سى";s:3:"ﴘ";s:4:"سي";s:3:"ﴙ";s:4:"شى";s:3:"ﴚ";s:4:"شي";s:3:"ﴛ";s:4:"حى";s:3:"ﴜ";s:4:"حي";s:3:"ﴝ";s:4:"جى";s:3:"ﴞ";s:4:"جي";s:3:"ﴟ";s:4:"خى";s:3:"ﴠ";s:4:"خي";s:3:"ﴡ";s:4:"صى";s:3:"ﴢ";s:4:"صي";s:3:"ﴣ";s:4:"ضى";s:3:"ﴤ";s:4:"ضي";s:3:"ﴥ";s:4:"شج";s:3:"ﴦ";s:4:"شح";s:3:"ﴧ";s:4:"شخ";s:3:"ﴨ";s:4:"شم";s:3:"ﴩ";s:4:"شر";s:3:"ﴪ";s:4:"سر";s:3:"ﴫ";s:4:"صر";s:3:"ﴬ";s:4:"ضر";s:3:"ﴭ";s:4:"شج";s:3:"ﴮ";s:4:"شح";s:3:"ﴯ";s:4:"شخ";s:3:"ﴰ";s:4:"شم";s:3:"ﴱ";s:4:"سه";s:3:"ﴲ";s:4:"شه";s:3:"ﴳ";s:4:"طم";s:3:"ﴴ";s:4:"سج";s:3:"ﴵ";s:4:"سح";s:3:"ﴶ";s:4:"سخ";s:3:"ﴷ";s:4:"شج";s:3:"ﴸ";s:4:"شح";s:3:"ﴹ";s:4:"شخ";s:3:"ﴺ";s:4:"طم";s:3:"ﴻ";s:4:"ظم";s:3:"ﴼ";s:4:"اً";s:3:"ﴽ";s:4:"اً";s:3:"ﵐ";s:6:"تجم";s:3:"ﵑ";s:6:"تحج";s:3:"ﵒ";s:6:"تحج";s:3:"ﵓ";s:6:"تحم";s:3:"ﵔ";s:6:"تخم";s:3:"ﵕ";s:6:"تمج";s:3:"ﵖ";s:6:"تمح";s:3:"ﵗ";s:6:"تمخ";s:3:"ﵘ";s:6:"جمح";s:3:"ﵙ";s:6:"جمح";s:3:"ﵚ";s:6:"حمي";s:3:"ﵛ";s:6:"حمى";s:3:"ﵜ";s:6:"سحج";s:3:"ﵝ";s:6:"سجح";s:3:"ﵞ";s:6:"سجى";s:3:"ﵟ";s:6:"سمح";s:3:"ﵠ";s:6:"سمح";s:3:"ﵡ";s:6:"سمج";s:3:"ﵢ";s:6:"سمم";s:3:"ﵣ";s:6:"سمم";s:3:"ﵤ";s:6:"صحح";s:3:"ﵥ";s:6:"صحح";s:3:"ﵦ";s:6:"صمم";s:3:"ﵧ";s:6:"شحم";s:3:"ﵨ";s:6:"شحم";s:3:"ﵩ";s:6:"شجي";s:3:"ﵪ";s:6:"شمخ";s:3:"ﵫ";s:6:"شمخ";s:3:"ﵬ";s:6:"شمم";s:3:"ﵭ";s:6:"شمم";s:3:"ﵮ";s:6:"ضحى";s:3:"ﵯ";s:6:"ضخم";s:3:"ﵰ";s:6:"ضخم";s:3:"ﵱ";s:6:"طمح";s:3:"ﵲ";s:6:"طمح";s:3:"ﵳ";s:6:"طمم";s:3:"ﵴ";s:6:"طمي";s:3:"ﵵ";s:6:"عجم";s:3:"ﵶ";s:6:"عمم";s:3:"ﵷ";s:6:"عمم";s:3:"ﵸ";s:6:"عمى";s:3:"ﵹ";s:6:"غمم";s:3:"ﵺ";s:6:"غمي";s:3:"ﵻ";s:6:"غمى";s:3:"ﵼ";s:6:"فخم";s:3:"ﵽ";s:6:"فخم";s:3:"ﵾ";s:6:"قمح";s:3:"ﵿ";s:6:"قمم";s:3:"ﶀ";s:6:"لحم";s:3:"ﶁ";s:6:"لحي";s:3:"ﶂ";s:6:"لحى";s:3:"ﶃ";s:6:"لجج";s:3:"ﶄ";s:6:"لجج";s:3:"ﶅ";s:6:"لخم";s:3:"ﶆ";s:6:"لخم";s:3:"ﶇ";s:6:"لمح";s:3:"ﶈ";s:6:"لمح";s:3:"ﶉ";s:6:"محج";s:3:"ﶊ";s:6:"محم";s:3:"ﶋ";s:6:"محي";s:3:"ﶌ";s:6:"مجح";s:3:"ﶍ";s:6:"مجم";s:3:"ﶎ";s:6:"مخج";s:3:"ﶏ";s:6:"مخم";s:3:"ﶒ";s:6:"مجخ";s:3:"ﶓ";s:6:"همج";s:3:"ﶔ";s:6:"همم";s:3:"ﶕ";s:6:"نحم";s:3:"ﶖ";s:6:"نحى";s:3:"ﶗ";s:6:"نجم";s:3:"ﶘ";s:6:"نجم";s:3:"ﶙ";s:6:"نجى";s:3:"ﶚ";s:6:"نمي";s:3:"ﶛ";s:6:"نمى";s:3:"ﶜ";s:6:"يمم";s:3:"ﶝ";s:6:"يمم";s:3:"ﶞ";s:6:"بخي";s:3:"ﶟ";s:6:"تجي";s:3:"ﶠ";s:6:"تجى";s:3:"ﶡ";s:6:"تخي";s:3:"ﶢ";s:6:"تخى";s:3:"ﶣ";s:6:"تمي";s:3:"ﶤ";s:6:"تمى";s:3:"ﶥ";s:6:"جمي";s:3:"ﶦ";s:6:"جحى";s:3:"ﶧ";s:6:"جمى";s:3:"ﶨ";s:6:"سخى";s:3:"ﶩ";s:6:"صحي";s:3:"ﶪ";s:6:"شحي";s:3:"ﶫ";s:6:"ضحي";s:3:"ﶬ";s:6:"لجي";s:3:"ﶭ";s:6:"لمي";s:3:"ﶮ";s:6:"يحي";s:3:"ﶯ";s:6:"يجي";s:3:"ﶰ";s:6:"يمي";s:3:"ﶱ";s:6:"ممي";s:3:"ﶲ";s:6:"قمي";s:3:"ﶳ";s:6:"نحي";s:3:"ﶴ";s:6:"قمح";s:3:"ﶵ";s:6:"لحم";s:3:"ﶶ";s:6:"عمي";s:3:"ﶷ";s:6:"كمي";s:3:"ﶸ";s:6:"نجح";s:3:"ﶹ";s:6:"مخي";s:3:"ﶺ";s:6:"لجم";s:3:"ﶻ";s:6:"كمم";s:3:"ﶼ";s:6:"لجم";s:3:"ﶽ";s:6:"نجح";s:3:"ﶾ";s:6:"جحي";s:3:"ﶿ";s:6:"حجي";s:3:"ﷀ";s:6:"مجي";s:3:"ﷁ";s:6:"فمي";s:3:"ﷂ";s:6:"بحي";s:3:"ﷃ";s:6:"كمم";s:3:"ﷄ";s:6:"عجم";s:3:"ﷅ";s:6:"صمم";s:3:"ﷆ";s:6:"سخي";s:3:"ﷇ";s:6:"نجي";s:3:"ﷰ";s:6:"صلے";s:3:"ﷱ";s:6:"قلے";s:3:"ﷲ";s:8:"الله";s:3:"ﷳ";s:8:"اكبر";s:3:"ﷴ";s:8:"محمد";s:3:"ﷵ";s:8:"صلعم";s:3:"ﷶ";s:8:"رسول";s:3:"ﷷ";s:8:"عليه";s:3:"ﷸ";s:8:"وسلم";s:3:"ﷹ";s:6:"صلى";s:3:"ﷺ";s:33:"صلى الله عليه وسلم";s:3:"ﷻ";s:15:"جل جلاله";s:3:"﷼";s:8:"ریال";s:3:"︐";s:1:",";s:3:"︑";s:3:"、";s:3:"︒";s:3:"。";s:3:"︓";s:1:":";s:3:"︔";s:1:";";s:3:"︕";s:1:"!";s:3:"︖";s:1:"?";s:3:"︗";s:3:"〖";s:3:"︘";s:3:"〗";s:3:"︙";s:3:"...";s:3:"︰";s:2:"..";s:3:"︱";s:3:"—";s:3:"︲";s:3:"–";s:3:"︳";s:1:"_";s:3:"︴";s:1:"_";s:3:"︵";s:1:"(";s:3:"︶";s:1:")";s:3:"︷";s:1:"{";s:3:"︸";s:1:"}";s:3:"︹";s:3:"〔";s:3:"︺";s:3:"〕";s:3:"︻";s:3:"【";s:3:"︼";s:3:"】";s:3:"︽";s:3:"《";s:3:"︾";s:3:"》";s:3:"︿";s:3:"〈";s:3:"﹀";s:3:"〉";s:3:"﹁";s:3:"「";s:3:"﹂";s:3:"」";s:3:"﹃";s:3:"『";s:3:"﹄";s:3:"』";s:3:"﹇";s:1:"[";s:3:"﹈";s:1:"]";s:3:"﹉";s:3:" ̅";s:3:"﹊";s:3:" ̅";s:3:"﹋";s:3:" ̅";s:3:"﹌";s:3:" ̅";s:3:"﹍";s:1:"_";s:3:"﹎";s:1:"_";s:3:"﹏";s:1:"_";s:3:"﹐";s:1:",";s:3:"﹑";s:3:"、";s:3:"﹒";s:1:".";s:3:"﹔";s:1:";";s:3:"﹕";s:1:":";s:3:"﹖";s:1:"?";s:3:"﹗";s:1:"!";s:3:"﹘";s:3:"—";s:3:"﹙";s:1:"(";s:3:"﹚";s:1:")";s:3:"﹛";s:1:"{";s:3:"﹜";s:1:"}";s:3:"﹝";s:3:"〔";s:3:"﹞";s:3:"〕";s:3:"﹟";s:1:"#";s:3:"﹠";s:1:"&";s:3:"﹡";s:1:"*";s:3:"﹢";s:1:"+";s:3:"﹣";s:1:"-";s:3:"﹤";s:1:"<";s:3:"﹥";s:1:">";s:3:"﹦";s:1:"=";s:3:"﹨";s:1:"\";s:3:"﹩";s:1:"$";s:3:"﹪";s:1:"%";s:3:"﹫";s:1:"@";s:3:"ﹰ";s:3:" ً";s:3:"ﹱ";s:4:"ـً";s:3:"ﹲ";s:3:" ٌ";s:3:"ﹴ";s:3:" ٍ";s:3:"ﹶ";s:3:" َ";s:3:"ﹷ";s:4:"ـَ";s:3:"ﹸ";s:3:" ُ";s:3:"ﹹ";s:4:"ـُ";s:3:"ﹺ";s:3:" ِ";s:3:"ﹻ";s:4:"ـِ";s:3:"ﹼ";s:3:" ّ";s:3:"ﹽ";s:4:"ـّ";s:3:"ﹾ";s:3:" ْ";s:3:"ﹿ";s:4:"ـْ";s:3:"ﺀ";s:2:"ء";s:3:"ﺁ";s:4:"آ";s:3:"ﺂ";s:4:"آ";s:3:"ﺃ";s:4:"أ";s:3:"ﺄ";s:4:"أ";s:3:"ﺅ";s:4:"ؤ";s:3:"ﺆ";s:4:"ؤ";s:3:"ﺇ";s:4:"إ";s:3:"ﺈ";s:4:"إ";s:3:"ﺉ";s:4:"ئ";s:3:"ﺊ";s:4:"ئ";s:3:"ﺋ";s:4:"ئ";s:3:"ﺌ";s:4:"ئ";s:3:"ﺍ";s:2:"ا";s:3:"ﺎ";s:2:"ا";s:3:"ﺏ";s:2:"ب";s:3:"ﺐ";s:2:"ب";s:3:"ﺑ";s:2:"ب";s:3:"ﺒ";s:2:"ب";s:3:"ﺓ";s:2:"ة";s:3:"ﺔ";s:2:"ة";s:3:"ﺕ";s:2:"ت";s:3:"ﺖ";s:2:"ت";s:3:"ﺗ";s:2:"ت";s:3:"ﺘ";s:2:"ت";s:3:"ﺙ";s:2:"ث";s:3:"ﺚ";s:2:"ث";s:3:"ﺛ";s:2:"ث";s:3:"ﺜ";s:2:"ث";s:3:"ﺝ";s:2:"ج";s:3:"ﺞ";s:2:"ج";s:3:"ﺟ";s:2:"ج";s:3:"ﺠ";s:2:"ج";s:3:"ﺡ";s:2:"ح";s:3:"ﺢ";s:2:"ح";s:3:"ﺣ";s:2:"ح";s:3:"ﺤ";s:2:"ح";s:3:"ﺥ";s:2:"خ";s:3:"ﺦ";s:2:"خ";s:3:"ﺧ";s:2:"خ";s:3:"ﺨ";s:2:"خ";s:3:"ﺩ";s:2:"د";s:3:"ﺪ";s:2:"د";s:3:"ﺫ";s:2:"ذ";s:3:"ﺬ";s:2:"ذ";s:3:"ﺭ";s:2:"ر";s:3:"ﺮ";s:2:"ر";s:3:"ﺯ";s:2:"ز";s:3:"ﺰ";s:2:"ز";s:3:"ﺱ";s:2:"س";s:3:"ﺲ";s:2:"س";s:3:"ﺳ";s:2:"س";s:3:"ﺴ";s:2:"س";s:3:"ﺵ";s:2:"ش";s:3:"ﺶ";s:2:"ش";s:3:"ﺷ";s:2:"ش";s:3:"ﺸ";s:2:"ش";s:3:"ﺹ";s:2:"ص";s:3:"ﺺ";s:2:"ص";s:3:"ﺻ";s:2:"ص";s:3:"ﺼ";s:2:"ص";s:3:"ﺽ";s:2:"ض";s:3:"ﺾ";s:2:"ض";s:3:"ﺿ";s:2:"ض";s:3:"ﻀ";s:2:"ض";s:3:"ﻁ";s:2:"ط";s:3:"ﻂ";s:2:"ط";s:3:"ﻃ";s:2:"ط";s:3:"ﻄ";s:2:"ط";s:3:"ﻅ";s:2:"ظ";s:3:"ﻆ";s:2:"ظ";s:3:"ﻇ";s:2:"ظ";s:3:"ﻈ";s:2:"ظ";s:3:"ﻉ";s:2:"ع";s:3:"ﻊ";s:2:"ع";s:3:"ﻋ";s:2:"ع";s:3:"ﻌ";s:2:"ع";s:3:"ﻍ";s:2:"غ";s:3:"ﻎ";s:2:"غ";s:3:"ﻏ";s:2:"غ";s:3:"ﻐ";s:2:"غ";s:3:"ﻑ";s:2:"ف";s:3:"ﻒ";s:2:"ف";s:3:"ﻓ";s:2:"ف";s:3:"ﻔ";s:2:"ف";s:3:"ﻕ";s:2:"ق";s:3:"ﻖ";s:2:"ق";s:3:"ﻗ";s:2:"ق";s:3:"ﻘ";s:2:"ق";s:3:"ﻙ";s:2:"ك";s:3:"ﻚ";s:2:"ك";s:3:"ﻛ";s:2:"ك";s:3:"ﻜ";s:2:"ك";s:3:"ﻝ";s:2:"ل";s:3:"ﻞ";s:2:"ل";s:3:"ﻟ";s:2:"ل";s:3:"ﻠ";s:2:"ل";s:3:"ﻡ";s:2:"م";s:3:"ﻢ";s:2:"م";s:3:"ﻣ";s:2:"م";s:3:"ﻤ";s:2:"م";s:3:"ﻥ";s:2:"ن";s:3:"ﻦ";s:2:"ن";s:3:"ﻧ";s:2:"ن";s:3:"ﻨ";s:2:"ن";s:3:"ﻩ";s:2:"ه";s:3:"ﻪ";s:2:"ه";s:3:"ﻫ";s:2:"ه";s:3:"ﻬ";s:2:"ه";s:3:"ﻭ";s:2:"و";s:3:"ﻮ";s:2:"و";s:3:"ﻯ";s:2:"ى";s:3:"ﻰ";s:2:"ى";s:3:"ﻱ";s:2:"ي";s:3:"ﻲ";s:2:"ي";s:3:"ﻳ";s:2:"ي";s:3:"ﻴ";s:2:"ي";s:3:"ﻵ";s:6:"لآ";s:3:"ﻶ";s:6:"لآ";s:3:"ﻷ";s:6:"لأ";s:3:"ﻸ";s:6:"لأ";s:3:"ﻹ";s:6:"لإ";s:3:"ﻺ";s:6:"لإ";s:3:"ﻻ";s:4:"لا";s:3:"ﻼ";s:4:"لا";s:3:"!";s:1:"!";s:3:""";s:1:""";s:3:"#";s:1:"#";s:3:"$";s:1:"$";s:3:"%";s:1:"%";s:3:"&";s:1:"&";s:3:"'";s:1:"'";s:3:"(";s:1:"(";s:3:")";s:1:")";s:3:"*";s:1:"*";s:3:"+";s:1:"+";s:3:",";s:1:",";s:3:"-";s:1:"-";s:3:".";s:1:".";s:3:"/";s:1:"/";s:3:"0";s:1:"0";s:3:"1";s:1:"1";s:3:"2";s:1:"2";s:3:"3";s:1:"3";s:3:"4";s:1:"4";s:3:"5";s:1:"5";s:3:"6";s:1:"6";s:3:"7";s:1:"7";s:3:"8";s:1:"8";s:3:"9";s:1:"9";s:3:":";s:1:":";s:3:";";s:1:";";s:3:"<";s:1:"<";s:3:"=";s:1:"=";s:3:">";s:1:">";s:3:"?";s:1:"?";s:3:"@";s:1:"@";s:3:"A";s:1:"A";s:3:"B";s:1:"B";s:3:"C";s:1:"C";s:3:"D";s:1:"D";s:3:"E";s:1:"E";s:3:"F";s:1:"F";s:3:"G";s:1:"G";s:3:"H";s:1:"H";s:3:"I";s:1:"I";s:3:"J";s:1:"J";s:3:"K";s:1:"K";s:3:"L";s:1:"L";s:3:"M";s:1:"M";s:3:"N";s:1:"N";s:3:"O";s:1:"O";s:3:"P";s:1:"P";s:3:"Q";s:1:"Q";s:3:"R";s:1:"R";s:3:"S";s:1:"S";s:3:"T";s:1:"T";s:3:"U";s:1:"U";s:3:"V";s:1:"V";s:3:"W";s:1:"W";s:3:"X";s:1:"X";s:3:"Y";s:1:"Y";s:3:"Z";s:1:"Z";s:3:"[";s:1:"[";s:3:"\";s:1:"\";s:3:"]";s:1:"]";s:3:"^";s:1:"^";s:3:"_";s:1:"_";s:3:"`";s:1:"`";s:3:"a";s:1:"a";s:3:"b";s:1:"b";s:3:"c";s:1:"c";s:3:"d";s:1:"d";s:3:"e";s:1:"e";s:3:"f";s:1:"f";s:3:"g";s:1:"g";s:3:"h";s:1:"h";s:3:"i";s:1:"i";s:3:"j";s:1:"j";s:3:"k";s:1:"k";s:3:"l";s:1:"l";s:3:"m";s:1:"m";s:3:"n";s:1:"n";s:3:"o";s:1:"o";s:3:"p";s:1:"p";s:3:"q";s:1:"q";s:3:"r";s:1:"r";s:3:"s";s:1:"s";s:3:"t";s:1:"t";s:3:"u";s:1:"u";s:3:"v";s:1:"v";s:3:"w";s:1:"w";s:3:"x";s:1:"x";s:3:"y";s:1:"y";s:3:"z";s:1:"z";s:3:"{";s:1:"{";s:3:"|";s:1:"|";s:3:"}";s:1:"}";s:3:"~";s:1:"~";s:3:"⦅";s:3:"⦅";s:3:"⦆";s:3:"⦆";s:3:"。";s:3:"。";s:3:"「";s:3:"「";s:3:"」";s:3:"」";s:3:"、";s:3:"、";s:3:"・";s:3:"・";s:3:"ヲ";s:3:"ヲ";s:3:"ァ";s:3:"ァ";s:3:"ィ";s:3:"ィ";s:3:"ゥ";s:3:"ゥ";s:3:"ェ";s:3:"ェ";s:3:"ォ";s:3:"ォ";s:3:"ャ";s:3:"ャ";s:3:"ュ";s:3:"ュ";s:3:"ョ";s:3:"ョ";s:3:"ッ";s:3:"ッ";s:3:"ー";s:3:"ー";s:3:"ア";s:3:"ア";s:3:"イ";s:3:"イ";s:3:"ウ";s:3:"ウ";s:3:"エ";s:3:"エ";s:3:"オ";s:3:"オ";s:3:"カ";s:3:"カ";s:3:"キ";s:3:"キ";s:3:"ク";s:3:"ク";s:3:"ケ";s:3:"ケ";s:3:"コ";s:3:"コ";s:3:"サ";s:3:"サ";s:3:"シ";s:3:"シ";s:3:"ス";s:3:"ス";s:3:"セ";s:3:"セ";s:3:"ソ";s:3:"ソ";s:3:"タ";s:3:"タ";s:3:"チ";s:3:"チ";s:3:"ツ";s:3:"ツ";s:3:"テ";s:3:"テ";s:3:"ト";s:3:"ト";s:3:"ナ";s:3:"ナ";s:3:"ニ";s:3:"ニ";s:3:"ヌ";s:3:"ヌ";s:3:"ネ";s:3:"ネ";s:3:"ノ";s:3:"ノ";s:3:"ハ";s:3:"ハ";s:3:"ヒ";s:3:"ヒ";s:3:"フ";s:3:"フ";s:3:"ヘ";s:3:"ヘ";s:3:"ホ";s:3:"ホ";s:3:"マ";s:3:"マ";s:3:"ミ";s:3:"ミ";s:3:"ム";s:3:"ム";s:3:"メ";s:3:"メ";s:3:"モ";s:3:"モ";s:3:"ヤ";s:3:"ヤ";s:3:"ユ";s:3:"ユ";s:3:"ヨ";s:3:"ヨ";s:3:"ラ";s:3:"ラ";s:3:"リ";s:3:"リ";s:3:"ル";s:3:"ル";s:3:"レ";s:3:"レ";s:3:"ロ";s:3:"ロ";s:3:"ワ";s:3:"ワ";s:3:"ン";s:3:"ン";s:3:"゙";s:3:"゙";s:3:"゚";s:3:"゚";s:3:"ᅠ";s:3:"ᅠ";s:3:"ᄀ";s:3:"ᄀ";s:3:"ᄁ";s:3:"ᄁ";s:3:"ᆪ";s:3:"ᆪ";s:3:"ᄂ";s:3:"ᄂ";s:3:"ᆬ";s:3:"ᆬ";s:3:"ᆭ";s:3:"ᆭ";s:3:"ᄃ";s:3:"ᄃ";s:3:"ᄄ";s:3:"ᄄ";s:3:"ᄅ";s:3:"ᄅ";s:3:"ᆰ";s:3:"ᆰ";s:3:"ᆱ";s:3:"ᆱ";s:3:"ᆲ";s:3:"ᆲ";s:3:"ᆳ";s:3:"ᆳ";s:3:"ᆴ";s:3:"ᆴ";s:3:"ᆵ";s:3:"ᆵ";s:3:"ᄚ";s:3:"ᄚ";s:3:"ᄆ";s:3:"ᄆ";s:3:"ᄇ";s:3:"ᄇ";s:3:"ᄈ";s:3:"ᄈ";s:3:"ᄡ";s:3:"ᄡ";s:3:"ᄉ";s:3:"ᄉ";s:3:"ᄊ";s:3:"ᄊ";s:3:"ᄋ";s:3:"ᄋ";s:3:"ᄌ";s:3:"ᄌ";s:3:"ᄍ";s:3:"ᄍ";s:3:"ᄎ";s:3:"ᄎ";s:3:"ᄏ";s:3:"ᄏ";s:3:"ᄐ";s:3:"ᄐ";s:3:"ᄑ";s:3:"ᄑ";s:3:"ᄒ";s:3:"ᄒ";s:3:"ᅡ";s:3:"ᅡ";s:3:"ᅢ";s:3:"ᅢ";s:3:"ᅣ";s:3:"ᅣ";s:3:"ᅤ";s:3:"ᅤ";s:3:"ᅥ";s:3:"ᅥ";s:3:"ᅦ";s:3:"ᅦ";s:3:"ᅧ";s:3:"ᅧ";s:3:"ᅨ";s:3:"ᅨ";s:3:"ᅩ";s:3:"ᅩ";s:3:"ᅪ";s:3:"ᅪ";s:3:"ᅫ";s:3:"ᅫ";s:3:"ᅬ";s:3:"ᅬ";s:3:"ᅭ";s:3:"ᅭ";s:3:"ᅮ";s:3:"ᅮ";s:3:"ᅯ";s:3:"ᅯ";s:3:"ᅰ";s:3:"ᅰ";s:3:"ᅱ";s:3:"ᅱ";s:3:"ᅲ";s:3:"ᅲ";s:3:"ᅳ";s:3:"ᅳ";s:3:"ᅴ";s:3:"ᅴ";s:3:"ᅵ";s:3:"ᅵ";s:3:"¢";s:2:"¢";s:3:"£";s:2:"£";s:3:"¬";s:2:"¬";s:3:" ̄";s:3:" ̄";s:3:"¦";s:2:"¦";s:3:"¥";s:2:"¥";s:3:"₩";s:3:"₩";s:3:"│";s:3:"│";s:3:"←";s:3:"←";s:3:"↑";s:3:"↑";s:3:"→";s:3:"→";s:3:"↓";s:3:"↓";s:3:"■";s:3:"■";s:3:"○";s:3:"○";s:4:"𝐀";s:1:"A";s:4:"𝐁";s:1:"B";s:4:"𝐂";s:1:"C";s:4:"𝐃";s:1:"D";s:4:"𝐄";s:1:"E";s:4:"𝐅";s:1:"F";s:4:"𝐆";s:1:"G";s:4:"𝐇";s:1:"H";s:4:"𝐈";s:1:"I";s:4:"𝐉";s:1:"J";s:4:"𝐊";s:1:"K";s:4:"𝐋";s:1:"L";s:4:"𝐌";s:1:"M";s:4:"𝐍";s:1:"N";s:4:"𝐎";s:1:"O";s:4:"𝐏";s:1:"P";s:4:"𝐐";s:1:"Q";s:4:"𝐑";s:1:"R";s:4:"𝐒";s:1:"S";s:4:"𝐓";s:1:"T";s:4:"𝐔";s:1:"U";s:4:"𝐕";s:1:"V";s:4:"𝐖";s:1:"W";s:4:"𝐗";s:1:"X";s:4:"𝐘";s:1:"Y";s:4:"𝐙";s:1:"Z";s:4:"𝐚";s:1:"a";s:4:"𝐛";s:1:"b";s:4:"𝐜";s:1:"c";s:4:"𝐝";s:1:"d";s:4:"𝐞";s:1:"e";s:4:"𝐟";s:1:"f";s:4:"𝐠";s:1:"g";s:4:"𝐡";s:1:"h";s:4:"𝐢";s:1:"i";s:4:"𝐣";s:1:"j";s:4:"𝐤";s:1:"k";s:4:"𝐥";s:1:"l";s:4:"𝐦";s:1:"m";s:4:"𝐧";s:1:"n";s:4:"𝐨";s:1:"o";s:4:"𝐩";s:1:"p";s:4:"𝐪";s:1:"q";s:4:"𝐫";s:1:"r";s:4:"𝐬";s:1:"s";s:4:"𝐭";s:1:"t";s:4:"𝐮";s:1:"u";s:4:"𝐯";s:1:"v";s:4:"𝐰";s:1:"w";s:4:"𝐱";s:1:"x";s:4:"𝐲";s:1:"y";s:4:"𝐳";s:1:"z";s:4:"𝐴";s:1:"A";s:4:"𝐵";s:1:"B";s:4:"𝐶";s:1:"C";s:4:"𝐷";s:1:"D";s:4:"𝐸";s:1:"E";s:4:"𝐹";s:1:"F";s:4:"𝐺";s:1:"G";s:4:"𝐻";s:1:"H";s:4:"𝐼";s:1:"I";s:4:"𝐽";s:1:"J";s:4:"𝐾";s:1:"K";s:4:"𝐿";s:1:"L";s:4:"𝑀";s:1:"M";s:4:"𝑁";s:1:"N";s:4:"𝑂";s:1:"O";s:4:"𝑃";s:1:"P";s:4:"𝑄";s:1:"Q";s:4:"𝑅";s:1:"R";s:4:"𝑆";s:1:"S";s:4:"𝑇";s:1:"T";s:4:"𝑈";s:1:"U";s:4:"𝑉";s:1:"V";s:4:"𝑊";s:1:"W";s:4:"𝑋";s:1:"X";s:4:"𝑌";s:1:"Y";s:4:"𝑍";s:1:"Z";s:4:"𝑎";s:1:"a";s:4:"𝑏";s:1:"b";s:4:"𝑐";s:1:"c";s:4:"𝑑";s:1:"d";s:4:"𝑒";s:1:"e";s:4:"𝑓";s:1:"f";s:4:"𝑔";s:1:"g";s:4:"𝑖";s:1:"i";s:4:"𝑗";s:1:"j";s:4:"𝑘";s:1:"k";s:4:"𝑙";s:1:"l";s:4:"𝑚";s:1:"m";s:4:"𝑛";s:1:"n";s:4:"𝑜";s:1:"o";s:4:"𝑝";s:1:"p";s:4:"𝑞";s:1:"q";s:4:"𝑟";s:1:"r";s:4:"𝑠";s:1:"s";s:4:"𝑡";s:1:"t";s:4:"𝑢";s:1:"u";s:4:"𝑣";s:1:"v";s:4:"𝑤";s:1:"w";s:4:"𝑥";s:1:"x";s:4:"𝑦";s:1:"y";s:4:"𝑧";s:1:"z";s:4:"𝑨";s:1:"A";s:4:"𝑩";s:1:"B";s:4:"𝑪";s:1:"C";s:4:"𝑫";s:1:"D";s:4:"𝑬";s:1:"E";s:4:"𝑭";s:1:"F";s:4:"𝑮";s:1:"G";s:4:"𝑯";s:1:"H";s:4:"𝑰";s:1:"I";s:4:"𝑱";s:1:"J";s:4:"𝑲";s:1:"K";s:4:"𝑳";s:1:"L";s:4:"𝑴";s:1:"M";s:4:"𝑵";s:1:"N";s:4:"𝑶";s:1:"O";s:4:"𝑷";s:1:"P";s:4:"𝑸";s:1:"Q";s:4:"𝑹";s:1:"R";s:4:"𝑺";s:1:"S";s:4:"𝑻";s:1:"T";s:4:"𝑼";s:1:"U";s:4:"𝑽";s:1:"V";s:4:"𝑾";s:1:"W";s:4:"𝑿";s:1:"X";s:4:"𝒀";s:1:"Y";s:4:"𝒁";s:1:"Z";s:4:"𝒂";s:1:"a";s:4:"𝒃";s:1:"b";s:4:"𝒄";s:1:"c";s:4:"𝒅";s:1:"d";s:4:"𝒆";s:1:"e";s:4:"𝒇";s:1:"f";s:4:"𝒈";s:1:"g";s:4:"𝒉";s:1:"h";s:4:"𝒊";s:1:"i";s:4:"𝒋";s:1:"j";s:4:"𝒌";s:1:"k";s:4:"𝒍";s:1:"l";s:4:"𝒎";s:1:"m";s:4:"𝒏";s:1:"n";s:4:"𝒐";s:1:"o";s:4:"𝒑";s:1:"p";s:4:"𝒒";s:1:"q";s:4:"𝒓";s:1:"r";s:4:"𝒔";s:1:"s";s:4:"𝒕";s:1:"t";s:4:"𝒖";s:1:"u";s:4:"𝒗";s:1:"v";s:4:"𝒘";s:1:"w";s:4:"𝒙";s:1:"x";s:4:"𝒚";s:1:"y";s:4:"𝒛";s:1:"z";s:4:"𝒜";s:1:"A";s:4:"𝒞";s:1:"C";s:4:"𝒟";s:1:"D";s:4:"𝒢";s:1:"G";s:4:"𝒥";s:1:"J";s:4:"𝒦";s:1:"K";s:4:"𝒩";s:1:"N";s:4:"𝒪";s:1:"O";s:4:"𝒫";s:1:"P";s:4:"𝒬";s:1:"Q";s:4:"𝒮";s:1:"S";s:4:"𝒯";s:1:"T";s:4:"𝒰";s:1:"U";s:4:"𝒱";s:1:"V";s:4:"𝒲";s:1:"W";s:4:"𝒳";s:1:"X";s:4:"𝒴";s:1:"Y";s:4:"𝒵";s:1:"Z";s:4:"𝒶";s:1:"a";s:4:"𝒷";s:1:"b";s:4:"𝒸";s:1:"c";s:4:"𝒹";s:1:"d";s:4:"𝒻";s:1:"f";s:4:"𝒽";s:1:"h";s:4:"𝒾";s:1:"i";s:4:"𝒿";s:1:"j";s:4:"𝓀";s:1:"k";s:4:"𝓁";s:1:"l";s:4:"𝓂";s:1:"m";s:4:"𝓃";s:1:"n";s:4:"𝓅";s:1:"p";s:4:"𝓆";s:1:"q";s:4:"𝓇";s:1:"r";s:4:"𝓈";s:1:"s";s:4:"𝓉";s:1:"t";s:4:"𝓊";s:1:"u";s:4:"𝓋";s:1:"v";s:4:"𝓌";s:1:"w";s:4:"𝓍";s:1:"x";s:4:"𝓎";s:1:"y";s:4:"𝓏";s:1:"z";s:4:"𝓐";s:1:"A";s:4:"𝓑";s:1:"B";s:4:"𝓒";s:1:"C";s:4:"𝓓";s:1:"D";s:4:"𝓔";s:1:"E";s:4:"𝓕";s:1:"F";s:4:"𝓖";s:1:"G";s:4:"𝓗";s:1:"H";s:4:"𝓘";s:1:"I";s:4:"𝓙";s:1:"J";s:4:"𝓚";s:1:"K";s:4:"𝓛";s:1:"L";s:4:"𝓜";s:1:"M";s:4:"𝓝";s:1:"N";s:4:"𝓞";s:1:"O";s:4:"𝓟";s:1:"P";s:4:"𝓠";s:1:"Q";s:4:"𝓡";s:1:"R";s:4:"𝓢";s:1:"S";s:4:"𝓣";s:1:"T";s:4:"𝓤";s:1:"U";s:4:"𝓥";s:1:"V";s:4:"𝓦";s:1:"W";s:4:"𝓧";s:1:"X";s:4:"𝓨";s:1:"Y";s:4:"𝓩";s:1:"Z";s:4:"𝓪";s:1:"a";s:4:"𝓫";s:1:"b";s:4:"𝓬";s:1:"c";s:4:"𝓭";s:1:"d";s:4:"𝓮";s:1:"e";s:4:"𝓯";s:1:"f";s:4:"𝓰";s:1:"g";s:4:"𝓱";s:1:"h";s:4:"𝓲";s:1:"i";s:4:"𝓳";s:1:"j";s:4:"𝓴";s:1:"k";s:4:"𝓵";s:1:"l";s:4:"𝓶";s:1:"m";s:4:"𝓷";s:1:"n";s:4:"𝓸";s:1:"o";s:4:"𝓹";s:1:"p";s:4:"𝓺";s:1:"q";s:4:"𝓻";s:1:"r";s:4:"𝓼";s:1:"s";s:4:"𝓽";s:1:"t";s:4:"𝓾";s:1:"u";s:4:"𝓿";s:1:"v";s:4:"𝔀";s:1:"w";s:4:"𝔁";s:1:"x";s:4:"𝔂";s:1:"y";s:4:"𝔃";s:1:"z";s:4:"𝔄";s:1:"A";s:4:"𝔅";s:1:"B";s:4:"𝔇";s:1:"D";s:4:"𝔈";s:1:"E";s:4:"𝔉";s:1:"F";s:4:"𝔊";s:1:"G";s:4:"𝔍";s:1:"J";s:4:"𝔎";s:1:"K";s:4:"𝔏";s:1:"L";s:4:"𝔐";s:1:"M";s:4:"𝔑";s:1:"N";s:4:"𝔒";s:1:"O";s:4:"𝔓";s:1:"P";s:4:"𝔔";s:1:"Q";s:4:"𝔖";s:1:"S";s:4:"𝔗";s:1:"T";s:4:"𝔘";s:1:"U";s:4:"𝔙";s:1:"V";s:4:"𝔚";s:1:"W";s:4:"𝔛";s:1:"X";s:4:"𝔜";s:1:"Y";s:4:"𝔞";s:1:"a";s:4:"𝔟";s:1:"b";s:4:"𝔠";s:1:"c";s:4:"𝔡";s:1:"d";s:4:"𝔢";s:1:"e";s:4:"𝔣";s:1:"f";s:4:"𝔤";s:1:"g";s:4:"𝔥";s:1:"h";s:4:"𝔦";s:1:"i";s:4:"𝔧";s:1:"j";s:4:"𝔨";s:1:"k";s:4:"𝔩";s:1:"l";s:4:"𝔪";s:1:"m";s:4:"𝔫";s:1:"n";s:4:"𝔬";s:1:"o";s:4:"𝔭";s:1:"p";s:4:"𝔮";s:1:"q";s:4:"𝔯";s:1:"r";s:4:"𝔰";s:1:"s";s:4:"𝔱";s:1:"t";s:4:"𝔲";s:1:"u";s:4:"𝔳";s:1:"v";s:4:"𝔴";s:1:"w";s:4:"𝔵";s:1:"x";s:4:"𝔶";s:1:"y";s:4:"𝔷";s:1:"z";s:4:"𝔸";s:1:"A";s:4:"𝔹";s:1:"B";s:4:"𝔻";s:1:"D";s:4:"𝔼";s:1:"E";s:4:"𝔽";s:1:"F";s:4:"𝔾";s:1:"G";s:4:"𝕀";s:1:"I";s:4:"𝕁";s:1:"J";s:4:"𝕂";s:1:"K";s:4:"𝕃";s:1:"L";s:4:"𝕄";s:1:"M";s:4:"𝕆";s:1:"O";s:4:"𝕊";s:1:"S";s:4:"𝕋";s:1:"T";s:4:"𝕌";s:1:"U";s:4:"𝕍";s:1:"V";s:4:"𝕎";s:1:"W";s:4:"𝕏";s:1:"X";s:4:"𝕐";s:1:"Y";s:4:"𝕒";s:1:"a";s:4:"𝕓";s:1:"b";s:4:"𝕔";s:1:"c";s:4:"𝕕";s:1:"d";s:4:"𝕖";s:1:"e";s:4:"𝕗";s:1:"f";s:4:"𝕘";s:1:"g";s:4:"𝕙";s:1:"h";s:4:"𝕚";s:1:"i";s:4:"𝕛";s:1:"j";s:4:"𝕜";s:1:"k";s:4:"𝕝";s:1:"l";s:4:"𝕞";s:1:"m";s:4:"𝕟";s:1:"n";s:4:"𝕠";s:1:"o";s:4:"𝕡";s:1:"p";s:4:"𝕢";s:1:"q";s:4:"𝕣";s:1:"r";s:4:"𝕤";s:1:"s";s:4:"𝕥";s:1:"t";s:4:"𝕦";s:1:"u";s:4:"𝕧";s:1:"v";s:4:"𝕨";s:1:"w";s:4:"𝕩";s:1:"x";s:4:"𝕪";s:1:"y";s:4:"𝕫";s:1:"z";s:4:"𝕬";s:1:"A";s:4:"𝕭";s:1:"B";s:4:"𝕮";s:1:"C";s:4:"𝕯";s:1:"D";s:4:"𝕰";s:1:"E";s:4:"𝕱";s:1:"F";s:4:"𝕲";s:1:"G";s:4:"𝕳";s:1:"H";s:4:"𝕴";s:1:"I";s:4:"𝕵";s:1:"J";s:4:"𝕶";s:1:"K";s:4:"𝕷";s:1:"L";s:4:"𝕸";s:1:"M";s:4:"𝕹";s:1:"N";s:4:"𝕺";s:1:"O";s:4:"𝕻";s:1:"P";s:4:"𝕼";s:1:"Q";s:4:"𝕽";s:1:"R";s:4:"𝕾";s:1:"S";s:4:"𝕿";s:1:"T";s:4:"𝖀";s:1:"U";s:4:"𝖁";s:1:"V";s:4:"𝖂";s:1:"W";s:4:"𝖃";s:1:"X";s:4:"𝖄";s:1:"Y";s:4:"𝖅";s:1:"Z";s:4:"𝖆";s:1:"a";s:4:"𝖇";s:1:"b";s:4:"𝖈";s:1:"c";s:4:"𝖉";s:1:"d";s:4:"𝖊";s:1:"e";s:4:"𝖋";s:1:"f";s:4:"𝖌";s:1:"g";s:4:"𝖍";s:1:"h";s:4:"𝖎";s:1:"i";s:4:"𝖏";s:1:"j";s:4:"𝖐";s:1:"k";s:4:"𝖑";s:1:"l";s:4:"𝖒";s:1:"m";s:4:"𝖓";s:1:"n";s:4:"𝖔";s:1:"o";s:4:"𝖕";s:1:"p";s:4:"𝖖";s:1:"q";s:4:"𝖗";s:1:"r";s:4:"𝖘";s:1:"s";s:4:"𝖙";s:1:"t";s:4:"𝖚";s:1:"u";s:4:"𝖛";s:1:"v";s:4:"𝖜";s:1:"w";s:4:"𝖝";s:1:"x";s:4:"𝖞";s:1:"y";s:4:"𝖟";s:1:"z";s:4:"𝖠";s:1:"A";s:4:"𝖡";s:1:"B";s:4:"𝖢";s:1:"C";s:4:"𝖣";s:1:"D";s:4:"𝖤";s:1:"E";s:4:"𝖥";s:1:"F";s:4:"𝖦";s:1:"G";s:4:"𝖧";s:1:"H";s:4:"𝖨";s:1:"I";s:4:"𝖩";s:1:"J";s:4:"𝖪";s:1:"K";s:4:"𝖫";s:1:"L";s:4:"𝖬";s:1:"M";s:4:"𝖭";s:1:"N";s:4:"𝖮";s:1:"O";s:4:"𝖯";s:1:"P";s:4:"𝖰";s:1:"Q";s:4:"𝖱";s:1:"R";s:4:"𝖲";s:1:"S";s:4:"𝖳";s:1:"T";s:4:"𝖴";s:1:"U";s:4:"𝖵";s:1:"V";s:4:"𝖶";s:1:"W";s:4:"𝖷";s:1:"X";s:4:"𝖸";s:1:"Y";s:4:"𝖹";s:1:"Z";s:4:"𝖺";s:1:"a";s:4:"𝖻";s:1:"b";s:4:"𝖼";s:1:"c";s:4:"𝖽";s:1:"d";s:4:"𝖾";s:1:"e";s:4:"𝖿";s:1:"f";s:4:"𝗀";s:1:"g";s:4:"𝗁";s:1:"h";s:4:"𝗂";s:1:"i";s:4:"𝗃";s:1:"j";s:4:"𝗄";s:1:"k";s:4:"𝗅";s:1:"l";s:4:"𝗆";s:1:"m";s:4:"𝗇";s:1:"n";s:4:"𝗈";s:1:"o";s:4:"𝗉";s:1:"p";s:4:"𝗊";s:1:"q";s:4:"𝗋";s:1:"r";s:4:"𝗌";s:1:"s";s:4:"𝗍";s:1:"t";s:4:"𝗎";s:1:"u";s:4:"𝗏";s:1:"v";s:4:"𝗐";s:1:"w";s:4:"𝗑";s:1:"x";s:4:"𝗒";s:1:"y";s:4:"𝗓";s:1:"z";s:4:"𝗔";s:1:"A";s:4:"𝗕";s:1:"B";s:4:"𝗖";s:1:"C";s:4:"𝗗";s:1:"D";s:4:"𝗘";s:1:"E";s:4:"𝗙";s:1:"F";s:4:"𝗚";s:1:"G";s:4:"𝗛";s:1:"H";s:4:"𝗜";s:1:"I";s:4:"𝗝";s:1:"J";s:4:"𝗞";s:1:"K";s:4:"𝗟";s:1:"L";s:4:"𝗠";s:1:"M";s:4:"𝗡";s:1:"N";s:4:"𝗢";s:1:"O";s:4:"𝗣";s:1:"P";s:4:"𝗤";s:1:"Q";s:4:"𝗥";s:1:"R";s:4:"𝗦";s:1:"S";s:4:"𝗧";s:1:"T";s:4:"𝗨";s:1:"U";s:4:"𝗩";s:1:"V";s:4:"𝗪";s:1:"W";s:4:"𝗫";s:1:"X";s:4:"𝗬";s:1:"Y";s:4:"𝗭";s:1:"Z";s:4:"𝗮";s:1:"a";s:4:"𝗯";s:1:"b";s:4:"𝗰";s:1:"c";s:4:"𝗱";s:1:"d";s:4:"𝗲";s:1:"e";s:4:"𝗳";s:1:"f";s:4:"𝗴";s:1:"g";s:4:"𝗵";s:1:"h";s:4:"𝗶";s:1:"i";s:4:"𝗷";s:1:"j";s:4:"𝗸";s:1:"k";s:4:"𝗹";s:1:"l";s:4:"𝗺";s:1:"m";s:4:"𝗻";s:1:"n";s:4:"𝗼";s:1:"o";s:4:"𝗽";s:1:"p";s:4:"𝗾";s:1:"q";s:4:"𝗿";s:1:"r";s:4:"𝘀";s:1:"s";s:4:"𝘁";s:1:"t";s:4:"𝘂";s:1:"u";s:4:"𝘃";s:1:"v";s:4:"𝘄";s:1:"w";s:4:"𝘅";s:1:"x";s:4:"𝘆";s:1:"y";s:4:"𝘇";s:1:"z";s:4:"𝘈";s:1:"A";s:4:"𝘉";s:1:"B";s:4:"𝘊";s:1:"C";s:4:"𝘋";s:1:"D";s:4:"𝘌";s:1:"E";s:4:"𝘍";s:1:"F";s:4:"𝘎";s:1:"G";s:4:"𝘏";s:1:"H";s:4:"𝘐";s:1:"I";s:4:"𝘑";s:1:"J";s:4:"𝘒";s:1:"K";s:4:"𝘓";s:1:"L";s:4:"𝘔";s:1:"M";s:4:"𝘕";s:1:"N";s:4:"𝘖";s:1:"O";s:4:"𝘗";s:1:"P";s:4:"𝘘";s:1:"Q";s:4:"𝘙";s:1:"R";s:4:"𝘚";s:1:"S";s:4:"𝘛";s:1:"T";s:4:"𝘜";s:1:"U";s:4:"𝘝";s:1:"V";s:4:"𝘞";s:1:"W";s:4:"𝘟";s:1:"X";s:4:"𝘠";s:1:"Y";s:4:"𝘡";s:1:"Z";s:4:"𝘢";s:1:"a";s:4:"𝘣";s:1:"b";s:4:"𝘤";s:1:"c";s:4:"𝘥";s:1:"d";s:4:"𝘦";s:1:"e";s:4:"𝘧";s:1:"f";s:4:"𝘨";s:1:"g";s:4:"𝘩";s:1:"h";s:4:"𝘪";s:1:"i";s:4:"𝘫";s:1:"j";s:4:"𝘬";s:1:"k";s:4:"𝘭";s:1:"l";s:4:"𝘮";s:1:"m";s:4:"𝘯";s:1:"n";s:4:"𝘰";s:1:"o";s:4:"𝘱";s:1:"p";s:4:"𝘲";s:1:"q";s:4:"𝘳";s:1:"r";s:4:"𝘴";s:1:"s";s:4:"𝘵";s:1:"t";s:4:"𝘶";s:1:"u";s:4:"𝘷";s:1:"v";s:4:"𝘸";s:1:"w";s:4:"𝘹";s:1:"x";s:4:"𝘺";s:1:"y";s:4:"𝘻";s:1:"z";s:4:"𝘼";s:1:"A";s:4:"𝘽";s:1:"B";s:4:"𝘾";s:1:"C";s:4:"𝘿";s:1:"D";s:4:"𝙀";s:1:"E";s:4:"𝙁";s:1:"F";s:4:"𝙂";s:1:"G";s:4:"𝙃";s:1:"H";s:4:"𝙄";s:1:"I";s:4:"𝙅";s:1:"J";s:4:"𝙆";s:1:"K";s:4:"𝙇";s:1:"L";s:4:"𝙈";s:1:"M";s:4:"𝙉";s:1:"N";s:4:"𝙊";s:1:"O";s:4:"𝙋";s:1:"P";s:4:"𝙌";s:1:"Q";s:4:"𝙍";s:1:"R";s:4:"𝙎";s:1:"S";s:4:"𝙏";s:1:"T";s:4:"𝙐";s:1:"U";s:4:"𝙑";s:1:"V";s:4:"𝙒";s:1:"W";s:4:"𝙓";s:1:"X";s:4:"𝙔";s:1:"Y";s:4:"𝙕";s:1:"Z";s:4:"𝙖";s:1:"a";s:4:"𝙗";s:1:"b";s:4:"𝙘";s:1:"c";s:4:"𝙙";s:1:"d";s:4:"𝙚";s:1:"e";s:4:"𝙛";s:1:"f";s:4:"𝙜";s:1:"g";s:4:"𝙝";s:1:"h";s:4:"𝙞";s:1:"i";s:4:"𝙟";s:1:"j";s:4:"𝙠";s:1:"k";s:4:"𝙡";s:1:"l";s:4:"𝙢";s:1:"m";s:4:"𝙣";s:1:"n";s:4:"𝙤";s:1:"o";s:4:"𝙥";s:1:"p";s:4:"𝙦";s:1:"q";s:4:"𝙧";s:1:"r";s:4:"𝙨";s:1:"s";s:4:"𝙩";s:1:"t";s:4:"𝙪";s:1:"u";s:4:"𝙫";s:1:"v";s:4:"𝙬";s:1:"w";s:4:"𝙭";s:1:"x";s:4:"𝙮";s:1:"y";s:4:"𝙯";s:1:"z";s:4:"𝙰";s:1:"A";s:4:"𝙱";s:1:"B";s:4:"𝙲";s:1:"C";s:4:"𝙳";s:1:"D";s:4:"𝙴";s:1:"E";s:4:"𝙵";s:1:"F";s:4:"𝙶";s:1:"G";s:4:"𝙷";s:1:"H";s:4:"𝙸";s:1:"I";s:4:"𝙹";s:1:"J";s:4:"𝙺";s:1:"K";s:4:"𝙻";s:1:"L";s:4:"𝙼";s:1:"M";s:4:"𝙽";s:1:"N";s:4:"𝙾";s:1:"O";s:4:"𝙿";s:1:"P";s:4:"𝚀";s:1:"Q";s:4:"𝚁";s:1:"R";s:4:"𝚂";s:1:"S";s:4:"𝚃";s:1:"T";s:4:"𝚄";s:1:"U";s:4:"𝚅";s:1:"V";s:4:"𝚆";s:1:"W";s:4:"𝚇";s:1:"X";s:4:"𝚈";s:1:"Y";s:4:"𝚉";s:1:"Z";s:4:"𝚊";s:1:"a";s:4:"𝚋";s:1:"b";s:4:"𝚌";s:1:"c";s:4:"𝚍";s:1:"d";s:4:"𝚎";s:1:"e";s:4:"𝚏";s:1:"f";s:4:"𝚐";s:1:"g";s:4:"𝚑";s:1:"h";s:4:"𝚒";s:1:"i";s:4:"𝚓";s:1:"j";s:4:"𝚔";s:1:"k";s:4:"𝚕";s:1:"l";s:4:"𝚖";s:1:"m";s:4:"𝚗";s:1:"n";s:4:"𝚘";s:1:"o";s:4:"𝚙";s:1:"p";s:4:"𝚚";s:1:"q";s:4:"𝚛";s:1:"r";s:4:"𝚜";s:1:"s";s:4:"𝚝";s:1:"t";s:4:"𝚞";s:1:"u";s:4:"𝚟";s:1:"v";s:4:"𝚠";s:1:"w";s:4:"𝚡";s:1:"x";s:4:"𝚢";s:1:"y";s:4:"𝚣";s:1:"z";s:4:"𝚤";s:2:"ı";s:4:"𝚥";s:2:"ȷ";s:4:"𝚨";s:2:"Α";s:4:"𝚩";s:2:"Β";s:4:"𝚪";s:2:"Γ";s:4:"𝚫";s:2:"Δ";s:4:"𝚬";s:2:"Ε";s:4:"𝚭";s:2:"Ζ";s:4:"𝚮";s:2:"Η";s:4:"𝚯";s:2:"Θ";s:4:"𝚰";s:2:"Ι";s:4:"𝚱";s:2:"Κ";s:4:"𝚲";s:2:"Λ";s:4:"𝚳";s:2:"Μ";s:4:"𝚴";s:2:"Ν";s:4:"𝚵";s:2:"Ξ";s:4:"𝚶";s:2:"Ο";s:4:"𝚷";s:2:"Π";s:4:"𝚸";s:2:"Ρ";s:4:"𝚹";s:2:"Θ";s:4:"𝚺";s:2:"Σ";s:4:"𝚻";s:2:"Τ";s:4:"𝚼";s:2:"Υ";s:4:"𝚽";s:2:"Φ";s:4:"𝚾";s:2:"Χ";s:4:"𝚿";s:2:"Ψ";s:4:"𝛀";s:2:"Ω";s:4:"𝛁";s:3:"∇";s:4:"𝛂";s:2:"α";s:4:"𝛃";s:2:"β";s:4:"𝛄";s:2:"γ";s:4:"𝛅";s:2:"δ";s:4:"𝛆";s:2:"ε";s:4:"𝛇";s:2:"ζ";s:4:"𝛈";s:2:"η";s:4:"𝛉";s:2:"θ";s:4:"𝛊";s:2:"ι";s:4:"𝛋";s:2:"κ";s:4:"𝛌";s:2:"λ";s:4:"𝛍";s:2:"μ";s:4:"𝛎";s:2:"ν";s:4:"𝛏";s:2:"ξ";s:4:"𝛐";s:2:"ο";s:4:"𝛑";s:2:"π";s:4:"𝛒";s:2:"ρ";s:4:"𝛓";s:2:"ς";s:4:"𝛔";s:2:"σ";s:4:"𝛕";s:2:"τ";s:4:"𝛖";s:2:"υ";s:4:"𝛗";s:2:"φ";s:4:"𝛘";s:2:"χ";s:4:"𝛙";s:2:"ψ";s:4:"𝛚";s:2:"ω";s:4:"𝛛";s:3:"∂";s:4:"𝛜";s:2:"ε";s:4:"𝛝";s:2:"θ";s:4:"𝛞";s:2:"κ";s:4:"𝛟";s:2:"φ";s:4:"𝛠";s:2:"ρ";s:4:"𝛡";s:2:"π";s:4:"𝛢";s:2:"Α";s:4:"𝛣";s:2:"Β";s:4:"𝛤";s:2:"Γ";s:4:"𝛥";s:2:"Δ";s:4:"𝛦";s:2:"Ε";s:4:"𝛧";s:2:"Ζ";s:4:"𝛨";s:2:"Η";s:4:"𝛩";s:2:"Θ";s:4:"𝛪";s:2:"Ι";s:4:"𝛫";s:2:"Κ";s:4:"𝛬";s:2:"Λ";s:4:"𝛭";s:2:"Μ";s:4:"𝛮";s:2:"Ν";s:4:"𝛯";s:2:"Ξ";s:4:"𝛰";s:2:"Ο";s:4:"𝛱";s:2:"Π";s:4:"𝛲";s:2:"Ρ";s:4:"𝛳";s:2:"Θ";s:4:"𝛴";s:2:"Σ";s:4:"𝛵";s:2:"Τ";s:4:"𝛶";s:2:"Υ";s:4:"𝛷";s:2:"Φ";s:4:"𝛸";s:2:"Χ";s:4:"𝛹";s:2:"Ψ";s:4:"𝛺";s:2:"Ω";s:4:"𝛻";s:3:"∇";s:4:"𝛼";s:2:"α";s:4:"𝛽";s:2:"β";s:4:"𝛾";s:2:"γ";s:4:"𝛿";s:2:"δ";s:4:"𝜀";s:2:"ε";s:4:"𝜁";s:2:"ζ";s:4:"𝜂";s:2:"η";s:4:"𝜃";s:2:"θ";s:4:"𝜄";s:2:"ι";s:4:"𝜅";s:2:"κ";s:4:"𝜆";s:2:"λ";s:4:"𝜇";s:2:"μ";s:4:"𝜈";s:2:"ν";s:4:"𝜉";s:2:"ξ";s:4:"𝜊";s:2:"ο";s:4:"𝜋";s:2:"π";s:4:"𝜌";s:2:"ρ";s:4:"𝜍";s:2:"ς";s:4:"𝜎";s:2:"σ";s:4:"𝜏";s:2:"τ";s:4:"𝜐";s:2:"υ";s:4:"𝜑";s:2:"φ";s:4:"𝜒";s:2:"χ";s:4:"𝜓";s:2:"ψ";s:4:"𝜔";s:2:"ω";s:4:"𝜕";s:3:"∂";s:4:"𝜖";s:2:"ε";s:4:"𝜗";s:2:"θ";s:4:"𝜘";s:2:"κ";s:4:"𝜙";s:2:"φ";s:4:"𝜚";s:2:"ρ";s:4:"𝜛";s:2:"π";s:4:"𝜜";s:2:"Α";s:4:"𝜝";s:2:"Β";s:4:"𝜞";s:2:"Γ";s:4:"𝜟";s:2:"Δ";s:4:"𝜠";s:2:"Ε";s:4:"𝜡";s:2:"Ζ";s:4:"𝜢";s:2:"Η";s:4:"𝜣";s:2:"Θ";s:4:"𝜤";s:2:"Ι";s:4:"𝜥";s:2:"Κ";s:4:"𝜦";s:2:"Λ";s:4:"𝜧";s:2:"Μ";s:4:"𝜨";s:2:"Ν";s:4:"𝜩";s:2:"Ξ";s:4:"𝜪";s:2:"Ο";s:4:"𝜫";s:2:"Π";s:4:"𝜬";s:2:"Ρ";s:4:"𝜭";s:2:"Θ";s:4:"𝜮";s:2:"Σ";s:4:"𝜯";s:2:"Τ";s:4:"𝜰";s:2:"Υ";s:4:"𝜱";s:2:"Φ";s:4:"𝜲";s:2:"Χ";s:4:"𝜳";s:2:"Ψ";s:4:"𝜴";s:2:"Ω";s:4:"𝜵";s:3:"∇";s:4:"𝜶";s:2:"α";s:4:"𝜷";s:2:"β";s:4:"𝜸";s:2:"γ";s:4:"𝜹";s:2:"δ";s:4:"𝜺";s:2:"ε";s:4:"𝜻";s:2:"ζ";s:4:"𝜼";s:2:"η";s:4:"𝜽";s:2:"θ";s:4:"𝜾";s:2:"ι";s:4:"𝜿";s:2:"κ";s:4:"𝝀";s:2:"λ";s:4:"𝝁";s:2:"μ";s:4:"𝝂";s:2:"ν";s:4:"𝝃";s:2:"ξ";s:4:"𝝄";s:2:"ο";s:4:"𝝅";s:2:"π";s:4:"𝝆";s:2:"ρ";s:4:"𝝇";s:2:"ς";s:4:"𝝈";s:2:"σ";s:4:"𝝉";s:2:"τ";s:4:"𝝊";s:2:"υ";s:4:"𝝋";s:2:"φ";s:4:"𝝌";s:2:"χ";s:4:"𝝍";s:2:"ψ";s:4:"𝝎";s:2:"ω";s:4:"𝝏";s:3:"∂";s:4:"𝝐";s:2:"ε";s:4:"𝝑";s:2:"θ";s:4:"𝝒";s:2:"κ";s:4:"𝝓";s:2:"φ";s:4:"𝝔";s:2:"ρ";s:4:"𝝕";s:2:"π";s:4:"𝝖";s:2:"Α";s:4:"𝝗";s:2:"Β";s:4:"𝝘";s:2:"Γ";s:4:"𝝙";s:2:"Δ";s:4:"𝝚";s:2:"Ε";s:4:"𝝛";s:2:"Ζ";s:4:"𝝜";s:2:"Η";s:4:"𝝝";s:2:"Θ";s:4:"𝝞";s:2:"Ι";s:4:"𝝟";s:2:"Κ";s:4:"𝝠";s:2:"Λ";s:4:"𝝡";s:2:"Μ";s:4:"𝝢";s:2:"Ν";s:4:"𝝣";s:2:"Ξ";s:4:"𝝤";s:2:"Ο";s:4:"𝝥";s:2:"Π";s:4:"𝝦";s:2:"Ρ";s:4:"𝝧";s:2:"Θ";s:4:"𝝨";s:2:"Σ";s:4:"𝝩";s:2:"Τ";s:4:"𝝪";s:2:"Υ";s:4:"𝝫";s:2:"Φ";s:4:"𝝬";s:2:"Χ";s:4:"𝝭";s:2:"Ψ";s:4:"𝝮";s:2:"Ω";s:4:"𝝯";s:3:"∇";s:4:"𝝰";s:2:"α";s:4:"𝝱";s:2:"β";s:4:"𝝲";s:2:"γ";s:4:"𝝳";s:2:"δ";s:4:"𝝴";s:2:"ε";s:4:"𝝵";s:2:"ζ";s:4:"𝝶";s:2:"η";s:4:"𝝷";s:2:"θ";s:4:"𝝸";s:2:"ι";s:4:"𝝹";s:2:"κ";s:4:"𝝺";s:2:"λ";s:4:"𝝻";s:2:"μ";s:4:"𝝼";s:2:"ν";s:4:"𝝽";s:2:"ξ";s:4:"𝝾";s:2:"ο";s:4:"𝝿";s:2:"π";s:4:"𝞀";s:2:"ρ";s:4:"𝞁";s:2:"ς";s:4:"𝞂";s:2:"σ";s:4:"𝞃";s:2:"τ";s:4:"𝞄";s:2:"υ";s:4:"𝞅";s:2:"φ";s:4:"𝞆";s:2:"χ";s:4:"𝞇";s:2:"ψ";s:4:"𝞈";s:2:"ω";s:4:"𝞉";s:3:"∂";s:4:"𝞊";s:2:"ε";s:4:"𝞋";s:2:"θ";s:4:"𝞌";s:2:"κ";s:4:"𝞍";s:2:"φ";s:4:"𝞎";s:2:"ρ";s:4:"𝞏";s:2:"π";s:4:"𝞐";s:2:"Α";s:4:"𝞑";s:2:"Β";s:4:"𝞒";s:2:"Γ";s:4:"𝞓";s:2:"Δ";s:4:"𝞔";s:2:"Ε";s:4:"𝞕";s:2:"Ζ";s:4:"𝞖";s:2:"Η";s:4:"𝞗";s:2:"Θ";s:4:"𝞘";s:2:"Ι";s:4:"𝞙";s:2:"Κ";s:4:"𝞚";s:2:"Λ";s:4:"𝞛";s:2:"Μ";s:4:"𝞜";s:2:"Ν";s:4:"𝞝";s:2:"Ξ";s:4:"𝞞";s:2:"Ο";s:4:"𝞟";s:2:"Π";s:4:"𝞠";s:2:"Ρ";s:4:"𝞡";s:2:"Θ";s:4:"𝞢";s:2:"Σ";s:4:"𝞣";s:2:"Τ";s:4:"𝞤";s:2:"Υ";s:4:"𝞥";s:2:"Φ";s:4:"𝞦";s:2:"Χ";s:4:"𝞧";s:2:"Ψ";s:4:"𝞨";s:2:"Ω";s:4:"𝞩";s:3:"∇";s:4:"𝞪";s:2:"α";s:4:"𝞫";s:2:"β";s:4:"𝞬";s:2:"γ";s:4:"𝞭";s:2:"δ";s:4:"𝞮";s:2:"ε";s:4:"𝞯";s:2:"ζ";s:4:"𝞰";s:2:"η";s:4:"𝞱";s:2:"θ";s:4:"𝞲";s:2:"ι";s:4:"𝞳";s:2:"κ";s:4:"𝞴";s:2:"λ";s:4:"𝞵";s:2:"μ";s:4:"𝞶";s:2:"ν";s:4:"𝞷";s:2:"ξ";s:4:"𝞸";s:2:"ο";s:4:"𝞹";s:2:"π";s:4:"𝞺";s:2:"ρ";s:4:"𝞻";s:2:"ς";s:4:"𝞼";s:2:"σ";s:4:"𝞽";s:2:"τ";s:4:"𝞾";s:2:"υ";s:4:"𝞿";s:2:"φ";s:4:"𝟀";s:2:"χ";s:4:"𝟁";s:2:"ψ";s:4:"𝟂";s:2:"ω";s:4:"𝟃";s:3:"∂";s:4:"𝟄";s:2:"ε";s:4:"𝟅";s:2:"θ";s:4:"𝟆";s:2:"κ";s:4:"𝟇";s:2:"φ";s:4:"𝟈";s:2:"ρ";s:4:"𝟉";s:2:"π";s:4:"𝟊";s:2:"Ϝ";s:4:"𝟋";s:2:"ϝ";s:4:"𝟎";s:1:"0";s:4:"𝟏";s:1:"1";s:4:"𝟐";s:1:"2";s:4:"𝟑";s:1:"3";s:4:"𝟒";s:1:"4";s:4:"𝟓";s:1:"5";s:4:"𝟔";s:1:"6";s:4:"𝟕";s:1:"7";s:4:"𝟖";s:1:"8";s:4:"𝟗";s:1:"9";s:4:"𝟘";s:1:"0";s:4:"𝟙";s:1:"1";s:4:"𝟚";s:1:"2";s:4:"𝟛";s:1:"3";s:4:"𝟜";s:1:"4";s:4:"𝟝";s:1:"5";s:4:"𝟞";s:1:"6";s:4:"𝟟";s:1:"7";s:4:"𝟠";s:1:"8";s:4:"𝟡";s:1:"9";s:4:"𝟢";s:1:"0";s:4:"𝟣";s:1:"1";s:4:"𝟤";s:1:"2";s:4:"𝟥";s:1:"3";s:4:"𝟦";s:1:"4";s:4:"𝟧";s:1:"5";s:4:"𝟨";s:1:"6";s:4:"𝟩";s:1:"7";s:4:"𝟪";s:1:"8";s:4:"𝟫";s:1:"9";s:4:"𝟬";s:1:"0";s:4:"𝟭";s:1:"1";s:4:"𝟮";s:1:"2";s:4:"𝟯";s:1:"3";s:4:"𝟰";s:1:"4";s:4:"𝟱";s:1:"5";s:4:"𝟲";s:1:"6";s:4:"𝟳";s:1:"7";s:4:"𝟴";s:1:"8";s:4:"𝟵";s:1:"9";s:4:"𝟶";s:1:"0";s:4:"𝟷";s:1:"1";s:4:"𝟸";s:1:"2";s:4:"𝟹";s:1:"3";s:4:"𝟺";s:1:"4";s:4:"𝟻";s:1:"5";s:4:"𝟼";s:1:"6";s:4:"𝟽";s:1:"7";s:4:"𝟾";s:1:"8";s:4:"𝟿";s:1:"9";s:4:"𞸀";s:2:"ا";s:4:"𞸁";s:2:"ب";s:4:"𞸂";s:2:"ج";s:4:"𞸃";s:2:"د";s:4:"𞸅";s:2:"و";s:4:"𞸆";s:2:"ز";s:4:"𞸇";s:2:"ح";s:4:"𞸈";s:2:"ط";s:4:"𞸉";s:2:"ي";s:4:"𞸊";s:2:"ك";s:4:"𞸋";s:2:"ل";s:4:"𞸌";s:2:"م";s:4:"𞸍";s:2:"ن";s:4:"𞸎";s:2:"س";s:4:"𞸏";s:2:"ع";s:4:"𞸐";s:2:"ف";s:4:"𞸑";s:2:"ص";s:4:"𞸒";s:2:"ق";s:4:"𞸓";s:2:"ر";s:4:"𞸔";s:2:"ش";s:4:"𞸕";s:2:"ت";s:4:"𞸖";s:2:"ث";s:4:"𞸗";s:2:"خ";s:4:"𞸘";s:2:"ذ";s:4:"𞸙";s:2:"ض";s:4:"𞸚";s:2:"ظ";s:4:"𞸛";s:2:"غ";s:4:"𞸜";s:2:"ٮ";s:4:"𞸝";s:2:"ں";s:4:"𞸞";s:2:"ڡ";s:4:"𞸟";s:2:"ٯ";s:4:"𞸡";s:2:"ب";s:4:"𞸢";s:2:"ج";s:4:"𞸤";s:2:"ه";s:4:"𞸧";s:2:"ح";s:4:"𞸩";s:2:"ي";s:4:"𞸪";s:2:"ك";s:4:"𞸫";s:2:"ل";s:4:"𞸬";s:2:"م";s:4:"𞸭";s:2:"ن";s:4:"𞸮";s:2:"س";s:4:"𞸯";s:2:"ع";s:4:"𞸰";s:2:"ف";s:4:"𞸱";s:2:"ص";s:4:"𞸲";s:2:"ق";s:4:"𞸴";s:2:"ش";s:4:"𞸵";s:2:"ت";s:4:"𞸶";s:2:"ث";s:4:"𞸷";s:2:"خ";s:4:"𞸹";s:2:"ض";s:4:"𞸻";s:2:"غ";s:4:"𞹂";s:2:"ج";s:4:"𞹇";s:2:"ح";s:4:"𞹉";s:2:"ي";s:4:"𞹋";s:2:"ل";s:4:"𞹍";s:2:"ن";s:4:"𞹎";s:2:"س";s:4:"𞹏";s:2:"ع";s:4:"𞹑";s:2:"ص";s:4:"𞹒";s:2:"ق";s:4:"𞹔";s:2:"ش";s:4:"𞹗";s:2:"خ";s:4:"𞹙";s:2:"ض";s:4:"𞹛";s:2:"غ";s:4:"𞹝";s:2:"ں";s:4:"𞹟";s:2:"ٯ";s:4:"𞹡";s:2:"ب";s:4:"𞹢";s:2:"ج";s:4:"𞹤";s:2:"ه";s:4:"𞹧";s:2:"ح";s:4:"𞹨";s:2:"ط";s:4:"𞹩";s:2:"ي";s:4:"𞹪";s:2:"ك";s:4:"𞹬";s:2:"م";s:4:"𞹭";s:2:"ن";s:4:"𞹮";s:2:"س";s:4:"𞹯";s:2:"ع";s:4:"𞹰";s:2:"ف";s:4:"𞹱";s:2:"ص";s:4:"𞹲";s:2:"ق";s:4:"𞹴";s:2:"ش";s:4:"𞹵";s:2:"ت";s:4:"𞹶";s:2:"ث";s:4:"𞹷";s:2:"خ";s:4:"𞹹";s:2:"ض";s:4:"𞹺";s:2:"ظ";s:4:"𞹻";s:2:"غ";s:4:"𞹼";s:2:"ٮ";s:4:"𞹾";s:2:"ڡ";s:4:"𞺀";s:2:"ا";s:4:"𞺁";s:2:"ب";s:4:"𞺂";s:2:"ج";s:4:"𞺃";s:2:"د";s:4:"𞺄";s:2:"ه";s:4:"𞺅";s:2:"و";s:4:"𞺆";s:2:"ز";s:4:"𞺇";s:2:"ح";s:4:"𞺈";s:2:"ط";s:4:"𞺉";s:2:"ي";s:4:"𞺋";s:2:"ل";s:4:"𞺌";s:2:"م";s:4:"𞺍";s:2:"ن";s:4:"𞺎";s:2:"س";s:4:"𞺏";s:2:"ع";s:4:"𞺐";s:2:"ف";s:4:"𞺑";s:2:"ص";s:4:"𞺒";s:2:"ق";s:4:"𞺓";s:2:"ر";s:4:"𞺔";s:2:"ش";s:4:"𞺕";s:2:"ت";s:4:"𞺖";s:2:"ث";s:4:"𞺗";s:2:"خ";s:4:"𞺘";s:2:"ذ";s:4:"𞺙";s:2:"ض";s:4:"𞺚";s:2:"ظ";s:4:"𞺛";s:2:"غ";s:4:"𞺡";s:2:"ب";s:4:"𞺢";s:2:"ج";s:4:"𞺣";s:2:"د";s:4:"𞺥";s:2:"و";s:4:"𞺦";s:2:"ز";s:4:"𞺧";s:2:"ح";s:4:"𞺨";s:2:"ط";s:4:"𞺩";s:2:"ي";s:4:"𞺫";s:2:"ل";s:4:"𞺬";s:2:"م";s:4:"𞺭";s:2:"ن";s:4:"𞺮";s:2:"س";s:4:"𞺯";s:2:"ع";s:4:"𞺰";s:2:"ف";s:4:"𞺱";s:2:"ص";s:4:"𞺲";s:2:"ق";s:4:"𞺳";s:2:"ر";s:4:"𞺴";s:2:"ش";s:4:"𞺵";s:2:"ت";s:4:"𞺶";s:2:"ث";s:4:"𞺷";s:2:"خ";s:4:"𞺸";s:2:"ذ";s:4:"𞺹";s:2:"ض";s:4:"𞺺";s:2:"ظ";s:4:"𞺻";s:2:"غ";s:4:"🄀";s:2:"0.";s:4:"🄁";s:2:"0,";s:4:"🄂";s:2:"1,";s:4:"🄃";s:2:"2,";s:4:"🄄";s:2:"3,";s:4:"🄅";s:2:"4,";s:4:"🄆";s:2:"5,";s:4:"🄇";s:2:"6,";s:4:"🄈";s:2:"7,";s:4:"🄉";s:2:"8,";s:4:"🄊";s:2:"9,";s:4:"🄐";s:3:"(A)";s:4:"🄑";s:3:"(B)";s:4:"🄒";s:3:"(C)";s:4:"🄓";s:3:"(D)";s:4:"🄔";s:3:"(E)";s:4:"🄕";s:3:"(F)";s:4:"🄖";s:3:"(G)";s:4:"🄗";s:3:"(H)";s:4:"🄘";s:3:"(I)";s:4:"🄙";s:3:"(J)";s:4:"🄚";s:3:"(K)";s:4:"🄛";s:3:"(L)";s:4:"🄜";s:3:"(M)";s:4:"🄝";s:3:"(N)";s:4:"🄞";s:3:"(O)";s:4:"🄟";s:3:"(P)";s:4:"🄠";s:3:"(Q)";s:4:"🄡";s:3:"(R)";s:4:"🄢";s:3:"(S)";s:4:"🄣";s:3:"(T)";s:4:"🄤";s:3:"(U)";s:4:"🄥";s:3:"(V)";s:4:"🄦";s:3:"(W)";s:4:"🄧";s:3:"(X)";s:4:"🄨";s:3:"(Y)";s:4:"🄩";s:3:"(Z)";s:4:"🄪";s:7:"〔S〕";s:4:"🄫";s:1:"C";s:4:"🄬";s:1:"R";s:4:"🄭";s:2:"CD";s:4:"🄮";s:2:"WZ";s:4:"🄰";s:1:"A";s:4:"🄱";s:1:"B";s:4:"🄲";s:1:"C";s:4:"🄳";s:1:"D";s:4:"🄴";s:1:"E";s:4:"🄵";s:1:"F";s:4:"🄶";s:1:"G";s:4:"🄷";s:1:"H";s:4:"🄸";s:1:"I";s:4:"🄹";s:1:"J";s:4:"🄺";s:1:"K";s:4:"🄻";s:1:"L";s:4:"🄼";s:1:"M";s:4:"🄽";s:1:"N";s:4:"🄾";s:1:"O";s:4:"🄿";s:1:"P";s:4:"🅀";s:1:"Q";s:4:"🅁";s:1:"R";s:4:"🅂";s:1:"S";s:4:"🅃";s:1:"T";s:4:"🅄";s:1:"U";s:4:"🅅";s:1:"V";s:4:"🅆";s:1:"W";s:4:"🅇";s:1:"X";s:4:"🅈";s:1:"Y";s:4:"🅉";s:1:"Z";s:4:"🅊";s:2:"HV";s:4:"🅋";s:2:"MV";s:4:"🅌";s:2:"SD";s:4:"🅍";s:2:"SS";s:4:"🅎";s:3:"PPV";s:4:"🅏";s:2:"WC";s:4:"🅪";s:2:"MC";s:4:"🅫";s:2:"MD";s:4:"🆐";s:2:"DJ";s:4:"🈀";s:6:"ほか";s:4:"🈁";s:6:"ココ";s:4:"🈂";s:3:"サ";s:4:"🈐";s:3:"手";s:4:"🈑";s:3:"字";s:4:"🈒";s:3:"双";s:4:"🈓";s:6:"デ";s:4:"🈔";s:3:"二";s:4:"🈕";s:3:"多";s:4:"🈖";s:3:"解";s:4:"🈗";s:3:"天";s:4:"🈘";s:3:"交";s:4:"🈙";s:3:"映";s:4:"🈚";s:3:"無";s:4:"🈛";s:3:"料";s:4:"🈜";s:3:"前";s:4:"🈝";s:3:"後";s:4:"🈞";s:3:"再";s:4:"🈟";s:3:"新";s:4:"🈠";s:3:"初";s:4:"🈡";s:3:"終";s:4:"🈢";s:3:"生";s:4:"🈣";s:3:"販";s:4:"🈤";s:3:"声";s:4:"🈥";s:3:"吹";s:4:"🈦";s:3:"演";s:4:"🈧";s:3:"投";s:4:"🈨";s:3:"捕";s:4:"🈩";s:3:"一";s:4:"🈪";s:3:"三";s:4:"🈫";s:3:"遊";s:4:"🈬";s:3:"左";s:4:"🈭";s:3:"中";s:4:"🈮";s:3:"右";s:4:"🈯";s:3:"指";s:4:"🈰";s:3:"走";s:4:"🈱";s:3:"打";s:4:"🈲";s:3:"禁";s:4:"🈳";s:3:"空";s:4:"🈴";s:3:"合";s:4:"🈵";s:3:"満";s:4:"🈶";s:3:"有";s:4:"🈷";s:3:"月";s:4:"🈸";s:3:"申";s:4:"🈹";s:3:"割";s:4:"🈺";s:3:"営";s:4:"🉀";s:9:"〔本〕";s:4:"🉁";s:9:"〔三〕";s:4:"🉂";s:9:"〔二〕";s:4:"🉃";s:9:"〔安〕";s:4:"🉄";s:9:"〔点〕";s:4:"🉅";s:9:"〔打〕";s:4:"🉆";s:9:"〔盗〕";s:4:"🉇";s:9:"〔勝〕";s:4:"🉈";s:9:"〔敗〕";s:4:"🉐";s:3:"得";s:4:"🉑";s:3:"可";} \ No newline at end of file +a:3680:{s:2:" ";s:1:" ";s:2:"¨";s:3:" ̈";s:2:"ª";s:1:"a";s:2:"¯";s:3:" ̄";s:2:"²";s:1:"2";s:2:"³";s:1:"3";s:2:"´";s:3:" ́";s:2:"µ";s:2:"μ";s:2:"¸";s:3:" ̧";s:2:"¹";s:1:"1";s:2:"º";s:1:"o";s:2:"¼";s:5:"1⁄4";s:2:"½";s:5:"1⁄2";s:2:"¾";s:5:"3⁄4";s:2:"IJ";s:2:"IJ";s:2:"ij";s:2:"ij";s:2:"Ŀ";s:3:"L·";s:2:"ŀ";s:3:"l·";s:2:"ʼn";s:3:"ʼn";s:2:"ſ";s:1:"s";s:2:"DŽ";s:4:"DŽ";s:2:"Dž";s:4:"Dž";s:2:"dž";s:4:"dž";s:2:"LJ";s:2:"LJ";s:2:"Lj";s:2:"Lj";s:2:"lj";s:2:"lj";s:2:"NJ";s:2:"NJ";s:2:"Nj";s:2:"Nj";s:2:"nj";s:2:"nj";s:2:"DZ";s:2:"DZ";s:2:"Dz";s:2:"Dz";s:2:"dz";s:2:"dz";s:2:"ʰ";s:1:"h";s:2:"ʱ";s:2:"ɦ";s:2:"ʲ";s:1:"j";s:2:"ʳ";s:1:"r";s:2:"ʴ";s:2:"ɹ";s:2:"ʵ";s:2:"ɻ";s:2:"ʶ";s:2:"ʁ";s:2:"ʷ";s:1:"w";s:2:"ʸ";s:1:"y";s:2:"˘";s:3:" ̆";s:2:"˙";s:3:" ̇";s:2:"˚";s:3:" ̊";s:2:"˛";s:3:" ̨";s:2:"˜";s:3:" ̃";s:2:"˝";s:3:" ̋";s:2:"ˠ";s:2:"ɣ";s:2:"ˡ";s:1:"l";s:2:"ˢ";s:1:"s";s:2:"ˣ";s:1:"x";s:2:"ˤ";s:2:"ʕ";s:2:"ͺ";s:3:" ͅ";s:2:"΄";s:3:" ́";s:2:"΅";s:5:" ̈́";s:2:"ϐ";s:2:"β";s:2:"ϑ";s:2:"θ";s:2:"ϒ";s:2:"Υ";s:2:"ϓ";s:4:"Ύ";s:2:"ϔ";s:4:"Ϋ";s:2:"ϕ";s:2:"φ";s:2:"ϖ";s:2:"π";s:2:"ϰ";s:2:"κ";s:2:"ϱ";s:2:"ρ";s:2:"ϲ";s:2:"ς";s:2:"ϴ";s:2:"Θ";s:2:"ϵ";s:2:"ε";s:2:"Ϲ";s:2:"Σ";s:2:"և";s:4:"եւ";s:2:"ٵ";s:4:"اٴ";s:2:"ٶ";s:4:"وٴ";s:2:"ٷ";s:4:"ۇٴ";s:2:"ٸ";s:4:"يٴ";s:3:"ำ";s:6:"ํา";s:3:"ຳ";s:6:"ໍາ";s:3:"ໜ";s:6:"ຫນ";s:3:"ໝ";s:6:"ຫມ";s:3:"༌";s:3:"་";s:3:"ཷ";s:9:"ྲཱྀ";s:3:"ཹ";s:9:"ླཱྀ";s:3:"ჼ";s:3:"ნ";s:3:"ᴬ";s:1:"A";s:3:"ᴭ";s:2:"Æ";s:3:"ᴮ";s:1:"B";s:3:"ᴰ";s:1:"D";s:3:"ᴱ";s:1:"E";s:3:"ᴲ";s:2:"Ǝ";s:3:"ᴳ";s:1:"G";s:3:"ᴴ";s:1:"H";s:3:"ᴵ";s:1:"I";s:3:"ᴶ";s:1:"J";s:3:"ᴷ";s:1:"K";s:3:"ᴸ";s:1:"L";s:3:"ᴹ";s:1:"M";s:3:"ᴺ";s:1:"N";s:3:"ᴼ";s:1:"O";s:3:"ᴽ";s:2:"Ȣ";s:3:"ᴾ";s:1:"P";s:3:"ᴿ";s:1:"R";s:3:"ᵀ";s:1:"T";s:3:"ᵁ";s:1:"U";s:3:"ᵂ";s:1:"W";s:3:"ᵃ";s:1:"a";s:3:"ᵄ";s:2:"ɐ";s:3:"ᵅ";s:2:"ɑ";s:3:"ᵆ";s:3:"ᴂ";s:3:"ᵇ";s:1:"b";s:3:"ᵈ";s:1:"d";s:3:"ᵉ";s:1:"e";s:3:"ᵊ";s:2:"ə";s:3:"ᵋ";s:2:"ɛ";s:3:"ᵌ";s:2:"ɜ";s:3:"ᵍ";s:1:"g";s:3:"ᵏ";s:1:"k";s:3:"ᵐ";s:1:"m";s:3:"ᵑ";s:2:"ŋ";s:3:"ᵒ";s:1:"o";s:3:"ᵓ";s:2:"ɔ";s:3:"ᵔ";s:3:"ᴖ";s:3:"ᵕ";s:3:"ᴗ";s:3:"ᵖ";s:1:"p";s:3:"ᵗ";s:1:"t";s:3:"ᵘ";s:1:"u";s:3:"ᵙ";s:3:"ᴝ";s:3:"ᵚ";s:2:"ɯ";s:3:"ᵛ";s:1:"v";s:3:"ᵜ";s:3:"ᴥ";s:3:"ᵝ";s:2:"β";s:3:"ᵞ";s:2:"γ";s:3:"ᵟ";s:2:"δ";s:3:"ᵠ";s:2:"φ";s:3:"ᵡ";s:2:"χ";s:3:"ᵢ";s:1:"i";s:3:"ᵣ";s:1:"r";s:3:"ᵤ";s:1:"u";s:3:"ᵥ";s:1:"v";s:3:"ᵦ";s:2:"β";s:3:"ᵧ";s:2:"γ";s:3:"ᵨ";s:2:"ρ";s:3:"ᵩ";s:2:"φ";s:3:"ᵪ";s:2:"χ";s:3:"ᵸ";s:2:"н";s:3:"ᶛ";s:2:"ɒ";s:3:"ᶜ";s:1:"c";s:3:"ᶝ";s:2:"ɕ";s:3:"ᶞ";s:2:"ð";s:3:"ᶟ";s:2:"ɜ";s:3:"ᶠ";s:1:"f";s:3:"ᶡ";s:2:"ɟ";s:3:"ᶢ";s:2:"ɡ";s:3:"ᶣ";s:2:"ɥ";s:3:"ᶤ";s:2:"ɨ";s:3:"ᶥ";s:2:"ɩ";s:3:"ᶦ";s:2:"ɪ";s:3:"ᶧ";s:3:"ᵻ";s:3:"ᶨ";s:2:"ʝ";s:3:"ᶩ";s:2:"ɭ";s:3:"ᶪ";s:3:"ᶅ";s:3:"ᶫ";s:2:"ʟ";s:3:"ᶬ";s:2:"ɱ";s:3:"ᶭ";s:2:"ɰ";s:3:"ᶮ";s:2:"ɲ";s:3:"ᶯ";s:2:"ɳ";s:3:"ᶰ";s:2:"ɴ";s:3:"ᶱ";s:2:"ɵ";s:3:"ᶲ";s:2:"ɸ";s:3:"ᶳ";s:2:"ʂ";s:3:"ᶴ";s:2:"ʃ";s:3:"ᶵ";s:2:"ƫ";s:3:"ᶶ";s:2:"ʉ";s:3:"ᶷ";s:2:"ʊ";s:3:"ᶸ";s:3:"ᴜ";s:3:"ᶹ";s:2:"ʋ";s:3:"ᶺ";s:2:"ʌ";s:3:"ᶻ";s:1:"z";s:3:"ᶼ";s:2:"ʐ";s:3:"ᶽ";s:2:"ʑ";s:3:"ᶾ";s:2:"ʒ";s:3:"ᶿ";s:2:"θ";s:3:"ẚ";s:3:"aʾ";s:3:"ẛ";s:3:"ṡ";s:3:"᾽";s:3:" ̓";s:3:"᾿";s:3:" ̓";s:3:"῀";s:3:" ͂";s:3:"῁";s:5:" ̈͂";s:3:"῍";s:5:" ̓̀";s:3:"῎";s:5:" ̓́";s:3:"῏";s:5:" ̓͂";s:3:"῝";s:5:" ̔̀";s:3:"῞";s:5:" ̔́";s:3:"῟";s:5:" ̔͂";s:3:"῭";s:5:" ̈̀";s:3:"΅";s:5:" ̈́";s:3:"´";s:3:" ́";s:3:"῾";s:3:" ̔";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:" ";s:1:" ";s:3:"‑";s:3:"‐";s:3:"‗";s:3:" ̳";s:3:"․";s:1:".";s:3:"‥";s:2:"..";s:3:"…";s:3:"...";s:3:" ";s:1:" ";s:3:"″";s:6:"′′";s:3:"‴";s:9:"′′′";s:3:"‶";s:6:"‵‵";s:3:"‷";s:9:"‵‵‵";s:3:"‼";s:2:"!!";s:3:"‾";s:3:" ̅";s:3:"⁇";s:2:"??";s:3:"⁈";s:2:"?!";s:3:"⁉";s:2:"!?";s:3:"⁗";s:12:"′′′′";s:3:" ";s:1:" ";s:3:"⁰";s:1:"0";s:3:"ⁱ";s:1:"i";s:3:"⁴";s:1:"4";s:3:"⁵";s:1:"5";s:3:"⁶";s:1:"6";s:3:"⁷";s:1:"7";s:3:"⁸";s:1:"8";s:3:"⁹";s:1:"9";s:3:"⁺";s:1:"+";s:3:"⁻";s:3:"−";s:3:"⁼";s:1:"=";s:3:"⁽";s:1:"(";s:3:"⁾";s:1:")";s:3:"ⁿ";s:1:"n";s:3:"₀";s:1:"0";s:3:"₁";s:1:"1";s:3:"₂";s:1:"2";s:3:"₃";s:1:"3";s:3:"₄";s:1:"4";s:3:"₅";s:1:"5";s:3:"₆";s:1:"6";s:3:"₇";s:1:"7";s:3:"₈";s:1:"8";s:3:"₉";s:1:"9";s:3:"₊";s:1:"+";s:3:"₋";s:3:"−";s:3:"₌";s:1:"=";s:3:"₍";s:1:"(";s:3:"₎";s:1:")";s:3:"ₐ";s:1:"a";s:3:"ₑ";s:1:"e";s:3:"ₒ";s:1:"o";s:3:"ₓ";s:1:"x";s:3:"ₔ";s:2:"ə";s:3:"ₕ";s:1:"h";s:3:"ₖ";s:1:"k";s:3:"ₗ";s:1:"l";s:3:"ₘ";s:1:"m";s:3:"ₙ";s:1:"n";s:3:"ₚ";s:1:"p";s:3:"ₛ";s:1:"s";s:3:"ₜ";s:1:"t";s:3:"₨";s:2:"Rs";s:3:"℀";s:3:"a/c";s:3:"℁";s:3:"a/s";s:3:"ℂ";s:1:"C";s:3:"℃";s:3:"°C";s:3:"℅";s:3:"c/o";s:3:"℆";s:3:"c/u";s:3:"ℇ";s:2:"Ɛ";s:3:"℉";s:3:"°F";s:3:"ℊ";s:1:"g";s:3:"ℋ";s:1:"H";s:3:"ℌ";s:1:"H";s:3:"ℍ";s:1:"H";s:3:"ℎ";s:1:"h";s:3:"ℏ";s:2:"ħ";s:3:"ℐ";s:1:"I";s:3:"ℑ";s:1:"I";s:3:"ℒ";s:1:"L";s:3:"ℓ";s:1:"l";s:3:"ℕ";s:1:"N";s:3:"№";s:2:"No";s:3:"ℙ";s:1:"P";s:3:"ℚ";s:1:"Q";s:3:"ℛ";s:1:"R";s:3:"ℜ";s:1:"R";s:3:"ℝ";s:1:"R";s:3:"℠";s:2:"SM";s:3:"℡";s:3:"TEL";s:3:"™";s:2:"TM";s:3:"ℤ";s:1:"Z";s:3:"ℨ";s:1:"Z";s:3:"ℬ";s:1:"B";s:3:"ℭ";s:1:"C";s:3:"ℯ";s:1:"e";s:3:"ℰ";s:1:"E";s:3:"ℱ";s:1:"F";s:3:"ℳ";s:1:"M";s:3:"ℴ";s:1:"o";s:3:"ℵ";s:2:"א";s:3:"ℶ";s:2:"ב";s:3:"ℷ";s:2:"ג";s:3:"ℸ";s:2:"ד";s:3:"ℹ";s:1:"i";s:3:"℻";s:3:"FAX";s:3:"ℼ";s:2:"π";s:3:"ℽ";s:2:"γ";s:3:"ℾ";s:2:"Γ";s:3:"ℿ";s:2:"Π";s:3:"⅀";s:3:"∑";s:3:"ⅅ";s:1:"D";s:3:"ⅆ";s:1:"d";s:3:"ⅇ";s:1:"e";s:3:"ⅈ";s:1:"i";s:3:"ⅉ";s:1:"j";s:3:"⅐";s:5:"1⁄7";s:3:"⅑";s:5:"1⁄9";s:3:"⅒";s:6:"1⁄10";s:3:"⅓";s:5:"1⁄3";s:3:"⅔";s:5:"2⁄3";s:3:"⅕";s:5:"1⁄5";s:3:"⅖";s:5:"2⁄5";s:3:"⅗";s:5:"3⁄5";s:3:"⅘";s:5:"4⁄5";s:3:"⅙";s:5:"1⁄6";s:3:"⅚";s:5:"5⁄6";s:3:"⅛";s:5:"1⁄8";s:3:"⅜";s:5:"3⁄8";s:3:"⅝";s:5:"5⁄8";s:3:"⅞";s:5:"7⁄8";s:3:"⅟";s:4:"1⁄";s:3:"Ⅰ";s:1:"I";s:3:"Ⅱ";s:2:"II";s:3:"Ⅲ";s:3:"III";s:3:"Ⅳ";s:2:"IV";s:3:"Ⅴ";s:1:"V";s:3:"Ⅵ";s:2:"VI";s:3:"Ⅶ";s:3:"VII";s:3:"Ⅷ";s:4:"VIII";s:3:"Ⅸ";s:2:"IX";s:3:"Ⅹ";s:1:"X";s:3:"Ⅺ";s:2:"XI";s:3:"Ⅻ";s:3:"XII";s:3:"Ⅼ";s:1:"L";s:3:"Ⅽ";s:1:"C";s:3:"Ⅾ";s:1:"D";s:3:"Ⅿ";s:1:"M";s:3:"ⅰ";s:1:"i";s:3:"ⅱ";s:2:"ii";s:3:"ⅲ";s:3:"iii";s:3:"ⅳ";s:2:"iv";s:3:"ⅴ";s:1:"v";s:3:"ⅵ";s:2:"vi";s:3:"ⅶ";s:3:"vii";s:3:"ⅷ";s:4:"viii";s:3:"ⅸ";s:2:"ix";s:3:"ⅹ";s:1:"x";s:3:"ⅺ";s:2:"xi";s:3:"ⅻ";s:3:"xii";s:3:"ⅼ";s:1:"l";s:3:"ⅽ";s:1:"c";s:3:"ⅾ";s:1:"d";s:3:"ⅿ";s:1:"m";s:3:"↉";s:5:"0⁄3";s:3:"∬";s:6:"∫∫";s:3:"∭";s:9:"∫∫∫";s:3:"∯";s:6:"∮∮";s:3:"∰";s:9:"∮∮∮";s:3:"①";s:1:"1";s:3:"②";s:1:"2";s:3:"③";s:1:"3";s:3:"④";s:1:"4";s:3:"⑤";s:1:"5";s:3:"⑥";s:1:"6";s:3:"⑦";s:1:"7";s:3:"⑧";s:1:"8";s:3:"⑨";s:1:"9";s:3:"⑩";s:2:"10";s:3:"⑪";s:2:"11";s:3:"⑫";s:2:"12";s:3:"⑬";s:2:"13";s:3:"⑭";s:2:"14";s:3:"⑮";s:2:"15";s:3:"⑯";s:2:"16";s:3:"⑰";s:2:"17";s:3:"⑱";s:2:"18";s:3:"⑲";s:2:"19";s:3:"⑳";s:2:"20";s:3:"⑴";s:3:"(1)";s:3:"⑵";s:3:"(2)";s:3:"⑶";s:3:"(3)";s:3:"⑷";s:3:"(4)";s:3:"⑸";s:3:"(5)";s:3:"⑹";s:3:"(6)";s:3:"⑺";s:3:"(7)";s:3:"⑻";s:3:"(8)";s:3:"⑼";s:3:"(9)";s:3:"⑽";s:4:"(10)";s:3:"⑾";s:4:"(11)";s:3:"⑿";s:4:"(12)";s:3:"⒀";s:4:"(13)";s:3:"⒁";s:4:"(14)";s:3:"⒂";s:4:"(15)";s:3:"⒃";s:4:"(16)";s:3:"⒄";s:4:"(17)";s:3:"⒅";s:4:"(18)";s:3:"⒆";s:4:"(19)";s:3:"⒇";s:4:"(20)";s:3:"⒈";s:2:"1.";s:3:"⒉";s:2:"2.";s:3:"⒊";s:2:"3.";s:3:"⒋";s:2:"4.";s:3:"⒌";s:2:"5.";s:3:"⒍";s:2:"6.";s:3:"⒎";s:2:"7.";s:3:"⒏";s:2:"8.";s:3:"⒐";s:2:"9.";s:3:"⒑";s:3:"10.";s:3:"⒒";s:3:"11.";s:3:"⒓";s:3:"12.";s:3:"⒔";s:3:"13.";s:3:"⒕";s:3:"14.";s:3:"⒖";s:3:"15.";s:3:"⒗";s:3:"16.";s:3:"⒘";s:3:"17.";s:3:"⒙";s:3:"18.";s:3:"⒚";s:3:"19.";s:3:"⒛";s:3:"20.";s:3:"⒜";s:3:"(a)";s:3:"⒝";s:3:"(b)";s:3:"⒞";s:3:"(c)";s:3:"⒟";s:3:"(d)";s:3:"⒠";s:3:"(e)";s:3:"⒡";s:3:"(f)";s:3:"⒢";s:3:"(g)";s:3:"⒣";s:3:"(h)";s:3:"⒤";s:3:"(i)";s:3:"⒥";s:3:"(j)";s:3:"⒦";s:3:"(k)";s:3:"⒧";s:3:"(l)";s:3:"⒨";s:3:"(m)";s:3:"⒩";s:3:"(n)";s:3:"⒪";s:3:"(o)";s:3:"⒫";s:3:"(p)";s:3:"⒬";s:3:"(q)";s:3:"⒭";s:3:"(r)";s:3:"⒮";s:3:"(s)";s:3:"⒯";s:3:"(t)";s:3:"⒰";s:3:"(u)";s:3:"⒱";s:3:"(v)";s:3:"⒲";s:3:"(w)";s:3:"⒳";s:3:"(x)";s:3:"⒴";s:3:"(y)";s:3:"⒵";s:3:"(z)";s:3:"Ⓐ";s:1:"A";s:3:"Ⓑ";s:1:"B";s:3:"Ⓒ";s:1:"C";s:3:"Ⓓ";s:1:"D";s:3:"Ⓔ";s:1:"E";s:3:"Ⓕ";s:1:"F";s:3:"Ⓖ";s:1:"G";s:3:"Ⓗ";s:1:"H";s:3:"Ⓘ";s:1:"I";s:3:"Ⓙ";s:1:"J";s:3:"Ⓚ";s:1:"K";s:3:"Ⓛ";s:1:"L";s:3:"Ⓜ";s:1:"M";s:3:"Ⓝ";s:1:"N";s:3:"Ⓞ";s:1:"O";s:3:"Ⓟ";s:1:"P";s:3:"Ⓠ";s:1:"Q";s:3:"Ⓡ";s:1:"R";s:3:"Ⓢ";s:1:"S";s:3:"Ⓣ";s:1:"T";s:3:"Ⓤ";s:1:"U";s:3:"Ⓥ";s:1:"V";s:3:"Ⓦ";s:1:"W";s:3:"Ⓧ";s:1:"X";s:3:"Ⓨ";s:1:"Y";s:3:"Ⓩ";s:1:"Z";s:3:"ⓐ";s:1:"a";s:3:"ⓑ";s:1:"b";s:3:"ⓒ";s:1:"c";s:3:"ⓓ";s:1:"d";s:3:"ⓔ";s:1:"e";s:3:"ⓕ";s:1:"f";s:3:"ⓖ";s:1:"g";s:3:"ⓗ";s:1:"h";s:3:"ⓘ";s:1:"i";s:3:"ⓙ";s:1:"j";s:3:"ⓚ";s:1:"k";s:3:"ⓛ";s:1:"l";s:3:"ⓜ";s:1:"m";s:3:"ⓝ";s:1:"n";s:3:"ⓞ";s:1:"o";s:3:"ⓟ";s:1:"p";s:3:"ⓠ";s:1:"q";s:3:"ⓡ";s:1:"r";s:3:"ⓢ";s:1:"s";s:3:"ⓣ";s:1:"t";s:3:"ⓤ";s:1:"u";s:3:"ⓥ";s:1:"v";s:3:"ⓦ";s:1:"w";s:3:"ⓧ";s:1:"x";s:3:"ⓨ";s:1:"y";s:3:"ⓩ";s:1:"z";s:3:"⓪";s:1:"0";s:3:"⨌";s:12:"∫∫∫∫";s:3:"⩴";s:3:"::=";s:3:"⩵";s:2:"==";s:3:"⩶";s:3:"===";s:3:"ⱼ";s:1:"j";s:3:"ⱽ";s:1:"V";s:3:"ⵯ";s:3:"ⵡ";s:3:"⺟";s:3:"母";s:3:"⻳";s:3:"龟";s:3:"⼀";s:3:"一";s:3:"⼁";s:3:"丨";s:3:"⼂";s:3:"丶";s:3:"⼃";s:3:"丿";s:3:"⼄";s:3:"乙";s:3:"⼅";s:3:"亅";s:3:"⼆";s:3:"二";s:3:"⼇";s:3:"亠";s:3:"⼈";s:3:"人";s:3:"⼉";s:3:"儿";s:3:"⼊";s:3:"入";s:3:"⼋";s:3:"八";s:3:"⼌";s:3:"冂";s:3:"⼍";s:3:"冖";s:3:"⼎";s:3:"冫";s:3:"⼏";s:3:"几";s:3:"⼐";s:3:"凵";s:3:"⼑";s:3:"刀";s:3:"⼒";s:3:"力";s:3:"⼓";s:3:"勹";s:3:"⼔";s:3:"匕";s:3:"⼕";s:3:"匚";s:3:"⼖";s:3:"匸";s:3:"⼗";s:3:"十";s:3:"⼘";s:3:"卜";s:3:"⼙";s:3:"卩";s:3:"⼚";s:3:"厂";s:3:"⼛";s:3:"厶";s:3:"⼜";s:3:"又";s:3:"⼝";s:3:"口";s:3:"⼞";s:3:"囗";s:3:"⼟";s:3:"土";s:3:"⼠";s:3:"士";s:3:"⼡";s:3:"夂";s:3:"⼢";s:3:"夊";s:3:"⼣";s:3:"夕";s:3:"⼤";s:3:"大";s:3:"⼥";s:3:"女";s:3:"⼦";s:3:"子";s:3:"⼧";s:3:"宀";s:3:"⼨";s:3:"寸";s:3:"⼩";s:3:"小";s:3:"⼪";s:3:"尢";s:3:"⼫";s:3:"尸";s:3:"⼬";s:3:"屮";s:3:"⼭";s:3:"山";s:3:"⼮";s:3:"巛";s:3:"⼯";s:3:"工";s:3:"⼰";s:3:"己";s:3:"⼱";s:3:"巾";s:3:"⼲";s:3:"干";s:3:"⼳";s:3:"幺";s:3:"⼴";s:3:"广";s:3:"⼵";s:3:"廴";s:3:"⼶";s:3:"廾";s:3:"⼷";s:3:"弋";s:3:"⼸";s:3:"弓";s:3:"⼹";s:3:"彐";s:3:"⼺";s:3:"彡";s:3:"⼻";s:3:"彳";s:3:"⼼";s:3:"心";s:3:"⼽";s:3:"戈";s:3:"⼾";s:3:"戶";s:3:"⼿";s:3:"手";s:3:"⽀";s:3:"支";s:3:"⽁";s:3:"攴";s:3:"⽂";s:3:"文";s:3:"⽃";s:3:"斗";s:3:"⽄";s:3:"斤";s:3:"⽅";s:3:"方";s:3:"⽆";s:3:"无";s:3:"⽇";s:3:"日";s:3:"⽈";s:3:"曰";s:3:"⽉";s:3:"月";s:3:"⽊";s:3:"木";s:3:"⽋";s:3:"欠";s:3:"⽌";s:3:"止";s:3:"⽍";s:3:"歹";s:3:"⽎";s:3:"殳";s:3:"⽏";s:3:"毋";s:3:"⽐";s:3:"比";s:3:"⽑";s:3:"毛";s:3:"⽒";s:3:"氏";s:3:"⽓";s:3:"气";s:3:"⽔";s:3:"水";s:3:"⽕";s:3:"火";s:3:"⽖";s:3:"爪";s:3:"⽗";s:3:"父";s:3:"⽘";s:3:"爻";s:3:"⽙";s:3:"爿";s:3:"⽚";s:3:"片";s:3:"⽛";s:3:"牙";s:3:"⽜";s:3:"牛";s:3:"⽝";s:3:"犬";s:3:"⽞";s:3:"玄";s:3:"⽟";s:3:"玉";s:3:"⽠";s:3:"瓜";s:3:"⽡";s:3:"瓦";s:3:"⽢";s:3:"甘";s:3:"⽣";s:3:"生";s:3:"⽤";s:3:"用";s:3:"⽥";s:3:"田";s:3:"⽦";s:3:"疋";s:3:"⽧";s:3:"疒";s:3:"⽨";s:3:"癶";s:3:"⽩";s:3:"白";s:3:"⽪";s:3:"皮";s:3:"⽫";s:3:"皿";s:3:"⽬";s:3:"目";s:3:"⽭";s:3:"矛";s:3:"⽮";s:3:"矢";s:3:"⽯";s:3:"石";s:3:"⽰";s:3:"示";s:3:"⽱";s:3:"禸";s:3:"⽲";s:3:"禾";s:3:"⽳";s:3:"穴";s:3:"⽴";s:3:"立";s:3:"⽵";s:3:"竹";s:3:"⽶";s:3:"米";s:3:"⽷";s:3:"糸";s:3:"⽸";s:3:"缶";s:3:"⽹";s:3:"网";s:3:"⽺";s:3:"羊";s:3:"⽻";s:3:"羽";s:3:"⽼";s:3:"老";s:3:"⽽";s:3:"而";s:3:"⽾";s:3:"耒";s:3:"⽿";s:3:"耳";s:3:"⾀";s:3:"聿";s:3:"⾁";s:3:"肉";s:3:"⾂";s:3:"臣";s:3:"⾃";s:3:"自";s:3:"⾄";s:3:"至";s:3:"⾅";s:3:"臼";s:3:"⾆";s:3:"舌";s:3:"⾇";s:3:"舛";s:3:"⾈";s:3:"舟";s:3:"⾉";s:3:"艮";s:3:"⾊";s:3:"色";s:3:"⾋";s:3:"艸";s:3:"⾌";s:3:"虍";s:3:"⾍";s:3:"虫";s:3:"⾎";s:3:"血";s:3:"⾏";s:3:"行";s:3:"⾐";s:3:"衣";s:3:"⾑";s:3:"襾";s:3:"⾒";s:3:"見";s:3:"⾓";s:3:"角";s:3:"⾔";s:3:"言";s:3:"⾕";s:3:"谷";s:3:"⾖";s:3:"豆";s:3:"⾗";s:3:"豕";s:3:"⾘";s:3:"豸";s:3:"⾙";s:3:"貝";s:3:"⾚";s:3:"赤";s:3:"⾛";s:3:"走";s:3:"⾜";s:3:"足";s:3:"⾝";s:3:"身";s:3:"⾞";s:3:"車";s:3:"⾟";s:3:"辛";s:3:"⾠";s:3:"辰";s:3:"⾡";s:3:"辵";s:3:"⾢";s:3:"邑";s:3:"⾣";s:3:"酉";s:3:"⾤";s:3:"釆";s:3:"⾥";s:3:"里";s:3:"⾦";s:3:"金";s:3:"⾧";s:3:"長";s:3:"⾨";s:3:"門";s:3:"⾩";s:3:"阜";s:3:"⾪";s:3:"隶";s:3:"⾫";s:3:"隹";s:3:"⾬";s:3:"雨";s:3:"⾭";s:3:"靑";s:3:"⾮";s:3:"非";s:3:"⾯";s:3:"面";s:3:"⾰";s:3:"革";s:3:"⾱";s:3:"韋";s:3:"⾲";s:3:"韭";s:3:"⾳";s:3:"音";s:3:"⾴";s:3:"頁";s:3:"⾵";s:3:"風";s:3:"⾶";s:3:"飛";s:3:"⾷";s:3:"食";s:3:"⾸";s:3:"首";s:3:"⾹";s:3:"香";s:3:"⾺";s:3:"馬";s:3:"⾻";s:3:"骨";s:3:"⾼";s:3:"高";s:3:"⾽";s:3:"髟";s:3:"⾾";s:3:"鬥";s:3:"⾿";s:3:"鬯";s:3:"⿀";s:3:"鬲";s:3:"⿁";s:3:"鬼";s:3:"⿂";s:3:"魚";s:3:"⿃";s:3:"鳥";s:3:"⿄";s:3:"鹵";s:3:"⿅";s:3:"鹿";s:3:"⿆";s:3:"麥";s:3:"⿇";s:3:"麻";s:3:"⿈";s:3:"黃";s:3:"⿉";s:3:"黍";s:3:"⿊";s:3:"黑";s:3:"⿋";s:3:"黹";s:3:"⿌";s:3:"黽";s:3:"⿍";s:3:"鼎";s:3:"⿎";s:3:"鼓";s:3:"⿏";s:3:"鼠";s:3:"⿐";s:3:"鼻";s:3:"⿑";s:3:"齊";s:3:"⿒";s:3:"齒";s:3:"⿓";s:3:"龍";s:3:"⿔";s:3:"龜";s:3:"⿕";s:3:"龠";s:3:" ";s:1:" ";s:3:"〶";s:3:"〒";s:3:"〸";s:3:"十";s:3:"〹";s:3:"卄";s:3:"〺";s:3:"卅";s:3:"゛";s:4:" ゙";s:3:"゜";s:4:" ゚";s:3:"ゟ";s:6:"より";s:3:"ヿ";s:6:"コト";s:3:"ㄱ";s:3:"ᄀ";s:3:"ㄲ";s:3:"ᄁ";s:3:"ㄳ";s:3:"ᆪ";s:3:"ㄴ";s:3:"ᄂ";s:3:"ㄵ";s:3:"ᆬ";s:3:"ㄶ";s:3:"ᆭ";s:3:"ㄷ";s:3:"ᄃ";s:3:"ㄸ";s:3:"ᄄ";s:3:"ㄹ";s:3:"ᄅ";s:3:"ㄺ";s:3:"ᆰ";s:3:"ㄻ";s:3:"ᆱ";s:3:"ㄼ";s:3:"ᆲ";s:3:"ㄽ";s:3:"ᆳ";s:3:"ㄾ";s:3:"ᆴ";s:3:"ㄿ";s:3:"ᆵ";s:3:"ㅀ";s:3:"ᄚ";s:3:"ㅁ";s:3:"ᄆ";s:3:"ㅂ";s:3:"ᄇ";s:3:"ㅃ";s:3:"ᄈ";s:3:"ㅄ";s:3:"ᄡ";s:3:"ㅅ";s:3:"ᄉ";s:3:"ㅆ";s:3:"ᄊ";s:3:"ㅇ";s:3:"ᄋ";s:3:"ㅈ";s:3:"ᄌ";s:3:"ㅉ";s:3:"ᄍ";s:3:"ㅊ";s:3:"ᄎ";s:3:"ㅋ";s:3:"ᄏ";s:3:"ㅌ";s:3:"ᄐ";s:3:"ㅍ";s:3:"ᄑ";s:3:"ㅎ";s:3:"ᄒ";s:3:"ㅏ";s:3:"ᅡ";s:3:"ㅐ";s:3:"ᅢ";s:3:"ㅑ";s:3:"ᅣ";s:3:"ㅒ";s:3:"ᅤ";s:3:"ㅓ";s:3:"ᅥ";s:3:"ㅔ";s:3:"ᅦ";s:3:"ㅕ";s:3:"ᅧ";s:3:"ㅖ";s:3:"ᅨ";s:3:"ㅗ";s:3:"ᅩ";s:3:"ㅘ";s:3:"ᅪ";s:3:"ㅙ";s:3:"ᅫ";s:3:"ㅚ";s:3:"ᅬ";s:3:"ㅛ";s:3:"ᅭ";s:3:"ㅜ";s:3:"ᅮ";s:3:"ㅝ";s:3:"ᅯ";s:3:"ㅞ";s:3:"ᅰ";s:3:"ㅟ";s:3:"ᅱ";s:3:"ㅠ";s:3:"ᅲ";s:3:"ㅡ";s:3:"ᅳ";s:3:"ㅢ";s:3:"ᅴ";s:3:"ㅣ";s:3:"ᅵ";s:3:"ㅤ";s:3:"ᅠ";s:3:"ㅥ";s:3:"ᄔ";s:3:"ㅦ";s:3:"ᄕ";s:3:"ㅧ";s:3:"ᇇ";s:3:"ㅨ";s:3:"ᇈ";s:3:"ㅩ";s:3:"ᇌ";s:3:"ㅪ";s:3:"ᇎ";s:3:"ㅫ";s:3:"ᇓ";s:3:"ㅬ";s:3:"ᇗ";s:3:"ㅭ";s:3:"ᇙ";s:3:"ㅮ";s:3:"ᄜ";s:3:"ㅯ";s:3:"ᇝ";s:3:"ㅰ";s:3:"ᇟ";s:3:"ㅱ";s:3:"ᄝ";s:3:"ㅲ";s:3:"ᄞ";s:3:"ㅳ";s:3:"ᄠ";s:3:"ㅴ";s:3:"ᄢ";s:3:"ㅵ";s:3:"ᄣ";s:3:"ㅶ";s:3:"ᄧ";s:3:"ㅷ";s:3:"ᄩ";s:3:"ㅸ";s:3:"ᄫ";s:3:"ㅹ";s:3:"ᄬ";s:3:"ㅺ";s:3:"ᄭ";s:3:"ㅻ";s:3:"ᄮ";s:3:"ㅼ";s:3:"ᄯ";s:3:"ㅽ";s:3:"ᄲ";s:3:"ㅾ";s:3:"ᄶ";s:3:"ㅿ";s:3:"ᅀ";s:3:"ㆀ";s:3:"ᅇ";s:3:"ㆁ";s:3:"ᅌ";s:3:"ㆂ";s:3:"ᇱ";s:3:"ㆃ";s:3:"ᇲ";s:3:"ㆄ";s:3:"ᅗ";s:3:"ㆅ";s:3:"ᅘ";s:3:"ㆆ";s:3:"ᅙ";s:3:"ㆇ";s:3:"ᆄ";s:3:"ㆈ";s:3:"ᆅ";s:3:"ㆉ";s:3:"ᆈ";s:3:"ㆊ";s:3:"ᆑ";s:3:"ㆋ";s:3:"ᆒ";s:3:"ㆌ";s:3:"ᆔ";s:3:"ㆍ";s:3:"ᆞ";s:3:"ㆎ";s:3:"ᆡ";s:3:"㆒";s:3:"一";s:3:"㆓";s:3:"二";s:3:"㆔";s:3:"三";s:3:"㆕";s:3:"四";s:3:"㆖";s:3:"上";s:3:"㆗";s:3:"中";s:3:"㆘";s:3:"下";s:3:"㆙";s:3:"甲";s:3:"㆚";s:3:"乙";s:3:"㆛";s:3:"丙";s:3:"㆜";s:3:"丁";s:3:"㆝";s:3:"天";s:3:"㆞";s:3:"地";s:3:"㆟";s:3:"人";s:3:"㈀";s:5:"(ᄀ)";s:3:"㈁";s:5:"(ᄂ)";s:3:"㈂";s:5:"(ᄃ)";s:3:"㈃";s:5:"(ᄅ)";s:3:"㈄";s:5:"(ᄆ)";s:3:"㈅";s:5:"(ᄇ)";s:3:"㈆";s:5:"(ᄉ)";s:3:"㈇";s:5:"(ᄋ)";s:3:"㈈";s:5:"(ᄌ)";s:3:"㈉";s:5:"(ᄎ)";s:3:"㈊";s:5:"(ᄏ)";s:3:"㈋";s:5:"(ᄐ)";s:3:"㈌";s:5:"(ᄑ)";s:3:"㈍";s:5:"(ᄒ)";s:3:"㈎";s:8:"(가)";s:3:"㈏";s:8:"(나)";s:3:"㈐";s:8:"(다)";s:3:"㈑";s:8:"(라)";s:3:"㈒";s:8:"(마)";s:3:"㈓";s:8:"(바)";s:3:"㈔";s:8:"(사)";s:3:"㈕";s:8:"(아)";s:3:"㈖";s:8:"(자)";s:3:"㈗";s:8:"(차)";s:3:"㈘";s:8:"(카)";s:3:"㈙";s:8:"(타)";s:3:"㈚";s:8:"(파)";s:3:"㈛";s:8:"(하)";s:3:"㈜";s:8:"(주)";s:3:"㈝";s:17:"(오전)";s:3:"㈞";s:14:"(오후)";s:3:"㈠";s:5:"(一)";s:3:"㈡";s:5:"(二)";s:3:"㈢";s:5:"(三)";s:3:"㈣";s:5:"(四)";s:3:"㈤";s:5:"(五)";s:3:"㈥";s:5:"(六)";s:3:"㈦";s:5:"(七)";s:3:"㈧";s:5:"(八)";s:3:"㈨";s:5:"(九)";s:3:"㈩";s:5:"(十)";s:3:"㈪";s:5:"(月)";s:3:"㈫";s:5:"(火)";s:3:"㈬";s:5:"(水)";s:3:"㈭";s:5:"(木)";s:3:"㈮";s:5:"(金)";s:3:"㈯";s:5:"(土)";s:3:"㈰";s:5:"(日)";s:3:"㈱";s:5:"(株)";s:3:"㈲";s:5:"(有)";s:3:"㈳";s:5:"(社)";s:3:"㈴";s:5:"(名)";s:3:"㈵";s:5:"(特)";s:3:"㈶";s:5:"(財)";s:3:"㈷";s:5:"(祝)";s:3:"㈸";s:5:"(労)";s:3:"㈹";s:5:"(代)";s:3:"㈺";s:5:"(呼)";s:3:"㈻";s:5:"(学)";s:3:"㈼";s:5:"(監)";s:3:"㈽";s:5:"(企)";s:3:"㈾";s:5:"(資)";s:3:"㈿";s:5:"(協)";s:3:"㉀";s:5:"(祭)";s:3:"㉁";s:5:"(休)";s:3:"㉂";s:5:"(自)";s:3:"㉃";s:5:"(至)";s:3:"㉄";s:3:"問";s:3:"㉅";s:3:"幼";s:3:"㉆";s:3:"文";s:3:"㉇";s:3:"箏";s:3:"㉐";s:3:"PTE";s:3:"㉑";s:2:"21";s:3:"㉒";s:2:"22";s:3:"㉓";s:2:"23";s:3:"㉔";s:2:"24";s:3:"㉕";s:2:"25";s:3:"㉖";s:2:"26";s:3:"㉗";s:2:"27";s:3:"㉘";s:2:"28";s:3:"㉙";s:2:"29";s:3:"㉚";s:2:"30";s:3:"㉛";s:2:"31";s:3:"㉜";s:2:"32";s:3:"㉝";s:2:"33";s:3:"㉞";s:2:"34";s:3:"㉟";s:2:"35";s:3:"㉠";s:3:"ᄀ";s:3:"㉡";s:3:"ᄂ";s:3:"㉢";s:3:"ᄃ";s:3:"㉣";s:3:"ᄅ";s:3:"㉤";s:3:"ᄆ";s:3:"㉥";s:3:"ᄇ";s:3:"㉦";s:3:"ᄉ";s:3:"㉧";s:3:"ᄋ";s:3:"㉨";s:3:"ᄌ";s:3:"㉩";s:3:"ᄎ";s:3:"㉪";s:3:"ᄏ";s:3:"㉫";s:3:"ᄐ";s:3:"㉬";s:3:"ᄑ";s:3:"㉭";s:3:"ᄒ";s:3:"㉮";s:6:"가";s:3:"㉯";s:6:"나";s:3:"㉰";s:6:"다";s:3:"㉱";s:6:"라";s:3:"㉲";s:6:"마";s:3:"㉳";s:6:"바";s:3:"㉴";s:6:"사";s:3:"㉵";s:6:"아";s:3:"㉶";s:6:"자";s:3:"㉷";s:6:"차";s:3:"㉸";s:6:"카";s:3:"㉹";s:6:"타";s:3:"㉺";s:6:"파";s:3:"㉻";s:6:"하";s:3:"㉼";s:15:"참고";s:3:"㉽";s:12:"주의";s:3:"㉾";s:6:"우";s:3:"㊀";s:3:"一";s:3:"㊁";s:3:"二";s:3:"㊂";s:3:"三";s:3:"㊃";s:3:"四";s:3:"㊄";s:3:"五";s:3:"㊅";s:3:"六";s:3:"㊆";s:3:"七";s:3:"㊇";s:3:"八";s:3:"㊈";s:3:"九";s:3:"㊉";s:3:"十";s:3:"㊊";s:3:"月";s:3:"㊋";s:3:"火";s:3:"㊌";s:3:"水";s:3:"㊍";s:3:"木";s:3:"㊎";s:3:"金";s:3:"㊏";s:3:"土";s:3:"㊐";s:3:"日";s:3:"㊑";s:3:"株";s:3:"㊒";s:3:"有";s:3:"㊓";s:3:"社";s:3:"㊔";s:3:"名";s:3:"㊕";s:3:"特";s:3:"㊖";s:3:"財";s:3:"㊗";s:3:"祝";s:3:"㊘";s:3:"労";s:3:"㊙";s:3:"秘";s:3:"㊚";s:3:"男";s:3:"㊛";s:3:"女";s:3:"㊜";s:3:"適";s:3:"㊝";s:3:"優";s:3:"㊞";s:3:"印";s:3:"㊟";s:3:"注";s:3:"㊠";s:3:"項";s:3:"㊡";s:3:"休";s:3:"㊢";s:3:"写";s:3:"㊣";s:3:"正";s:3:"㊤";s:3:"上";s:3:"㊥";s:3:"中";s:3:"㊦";s:3:"下";s:3:"㊧";s:3:"左";s:3:"㊨";s:3:"右";s:3:"㊩";s:3:"医";s:3:"㊪";s:3:"宗";s:3:"㊫";s:3:"学";s:3:"㊬";s:3:"監";s:3:"㊭";s:3:"企";s:3:"㊮";s:3:"資";s:3:"㊯";s:3:"協";s:3:"㊰";s:3:"夜";s:3:"㊱";s:2:"36";s:3:"㊲";s:2:"37";s:3:"㊳";s:2:"38";s:3:"㊴";s:2:"39";s:3:"㊵";s:2:"40";s:3:"㊶";s:2:"41";s:3:"㊷";s:2:"42";s:3:"㊸";s:2:"43";s:3:"㊹";s:2:"44";s:3:"㊺";s:2:"45";s:3:"㊻";s:2:"46";s:3:"㊼";s:2:"47";s:3:"㊽";s:2:"48";s:3:"㊾";s:2:"49";s:3:"㊿";s:2:"50";s:3:"㋀";s:4:"1月";s:3:"㋁";s:4:"2月";s:3:"㋂";s:4:"3月";s:3:"㋃";s:4:"4月";s:3:"㋄";s:4:"5月";s:3:"㋅";s:4:"6月";s:3:"㋆";s:4:"7月";s:3:"㋇";s:4:"8月";s:3:"㋈";s:4:"9月";s:3:"㋉";s:5:"10月";s:3:"㋊";s:5:"11月";s:3:"㋋";s:5:"12月";s:3:"㋌";s:2:"Hg";s:3:"㋍";s:3:"erg";s:3:"㋎";s:2:"eV";s:3:"㋏";s:3:"LTD";s:3:"㋐";s:3:"ア";s:3:"㋑";s:3:"イ";s:3:"㋒";s:3:"ウ";s:3:"㋓";s:3:"エ";s:3:"㋔";s:3:"オ";s:3:"㋕";s:3:"カ";s:3:"㋖";s:3:"キ";s:3:"㋗";s:3:"ク";s:3:"㋘";s:3:"ケ";s:3:"㋙";s:3:"コ";s:3:"㋚";s:3:"サ";s:3:"㋛";s:3:"シ";s:3:"㋜";s:3:"ス";s:3:"㋝";s:3:"セ";s:3:"㋞";s:3:"ソ";s:3:"㋟";s:3:"タ";s:3:"㋠";s:3:"チ";s:3:"㋡";s:3:"ツ";s:3:"㋢";s:3:"テ";s:3:"㋣";s:3:"ト";s:3:"㋤";s:3:"ナ";s:3:"㋥";s:3:"ニ";s:3:"㋦";s:3:"ヌ";s:3:"㋧";s:3:"ネ";s:3:"㋨";s:3:"ノ";s:3:"㋩";s:3:"ハ";s:3:"㋪";s:3:"ヒ";s:3:"㋫";s:3:"フ";s:3:"㋬";s:3:"ヘ";s:3:"㋭";s:3:"ホ";s:3:"㋮";s:3:"マ";s:3:"㋯";s:3:"ミ";s:3:"㋰";s:3:"ム";s:3:"㋱";s:3:"メ";s:3:"㋲";s:3:"モ";s:3:"㋳";s:3:"ヤ";s:3:"㋴";s:3:"ユ";s:3:"㋵";s:3:"ヨ";s:3:"㋶";s:3:"ラ";s:3:"㋷";s:3:"リ";s:3:"㋸";s:3:"ル";s:3:"㋹";s:3:"レ";s:3:"㋺";s:3:"ロ";s:3:"㋻";s:3:"ワ";s:3:"㋼";s:3:"ヰ";s:3:"㋽";s:3:"ヱ";s:3:"㋾";s:3:"ヲ";s:3:"㋿";s:6:"令和";s:3:"㌀";s:15:"アパート";s:3:"㌁";s:12:"アルファ";s:3:"㌂";s:15:"アンペア";s:3:"㌃";s:9:"アール";s:3:"㌄";s:15:"イニング";s:3:"㌅";s:9:"インチ";s:3:"㌆";s:9:"ウォン";s:3:"㌇";s:18:"エスクード";s:3:"㌈";s:12:"エーカー";s:3:"㌉";s:9:"オンス";s:3:"㌊";s:9:"オーム";s:3:"㌋";s:9:"カイリ";s:3:"㌌";s:12:"カラット";s:3:"㌍";s:12:"カロリー";s:3:"㌎";s:12:"ガロン";s:3:"㌏";s:12:"ガンマ";s:3:"㌐";s:12:"ギガ";s:3:"㌑";s:12:"ギニー";s:3:"㌒";s:12:"キュリー";s:3:"㌓";s:18:"ギルダー";s:3:"㌔";s:6:"キロ";s:3:"㌕";s:18:"キログラム";s:3:"㌖";s:18:"キロメートル";s:3:"㌗";s:15:"キロワット";s:3:"㌘";s:12:"グラム";s:3:"㌙";s:18:"グラムトン";s:3:"㌚";s:18:"クルゼイロ";s:3:"㌛";s:12:"クローネ";s:3:"㌜";s:9:"ケース";s:3:"㌝";s:9:"コルナ";s:3:"㌞";s:12:"コーポ";s:3:"㌟";s:12:"サイクル";s:3:"㌠";s:15:"サンチーム";s:3:"㌡";s:15:"シリング";s:3:"㌢";s:9:"センチ";s:3:"㌣";s:9:"セント";s:3:"㌤";s:12:"ダース";s:3:"㌥";s:9:"デシ";s:3:"㌦";s:9:"ドル";s:3:"㌧";s:6:"トン";s:3:"㌨";s:6:"ナノ";s:3:"㌩";s:9:"ノット";s:3:"㌪";s:9:"ハイツ";s:3:"㌫";s:18:"パーセント";s:3:"㌬";s:12:"パーツ";s:3:"㌭";s:15:"バーレル";s:3:"㌮";s:18:"ピアストル";s:3:"㌯";s:12:"ピクル";s:3:"㌰";s:9:"ピコ";s:3:"㌱";s:9:"ビル";s:3:"㌲";s:18:"ファラッド";s:3:"㌳";s:12:"フィート";s:3:"㌴";s:18:"ブッシェル";s:3:"㌵";s:9:"フラン";s:3:"㌶";s:15:"ヘクタール";s:3:"㌷";s:9:"ペソ";s:3:"㌸";s:12:"ペニヒ";s:3:"㌹";s:9:"ヘルツ";s:3:"㌺";s:12:"ペンス";s:3:"㌻";s:15:"ページ";s:3:"㌼";s:12:"ベータ";s:3:"㌽";s:15:"ポイント";s:3:"㌾";s:12:"ボルト";s:3:"㌿";s:6:"ホン";s:3:"㍀";s:15:"ポンド";s:3:"㍁";s:9:"ホール";s:3:"㍂";s:9:"ホーン";s:3:"㍃";s:12:"マイクロ";s:3:"㍄";s:9:"マイル";s:3:"㍅";s:9:"マッハ";s:3:"㍆";s:9:"マルク";s:3:"㍇";s:15:"マンション";s:3:"㍈";s:12:"ミクロン";s:3:"㍉";s:6:"ミリ";s:3:"㍊";s:18:"ミリバール";s:3:"㍋";s:9:"メガ";s:3:"㍌";s:15:"メガトン";s:3:"㍍";s:12:"メートル";s:3:"㍎";s:12:"ヤード";s:3:"㍏";s:9:"ヤール";s:3:"㍐";s:9:"ユアン";s:3:"㍑";s:12:"リットル";s:3:"㍒";s:6:"リラ";s:3:"㍓";s:12:"ルピー";s:3:"㍔";s:15:"ルーブル";s:3:"㍕";s:6:"レム";s:3:"㍖";s:18:"レントゲン";s:3:"㍗";s:9:"ワット";s:3:"㍘";s:4:"0点";s:3:"㍙";s:4:"1点";s:3:"㍚";s:4:"2点";s:3:"㍛";s:4:"3点";s:3:"㍜";s:4:"4点";s:3:"㍝";s:4:"5点";s:3:"㍞";s:4:"6点";s:3:"㍟";s:4:"7点";s:3:"㍠";s:4:"8点";s:3:"㍡";s:4:"9点";s:3:"㍢";s:5:"10点";s:3:"㍣";s:5:"11点";s:3:"㍤";s:5:"12点";s:3:"㍥";s:5:"13点";s:3:"㍦";s:5:"14点";s:3:"㍧";s:5:"15点";s:3:"㍨";s:5:"16点";s:3:"㍩";s:5:"17点";s:3:"㍪";s:5:"18点";s:3:"㍫";s:5:"19点";s:3:"㍬";s:5:"20点";s:3:"㍭";s:5:"21点";s:3:"㍮";s:5:"22点";s:3:"㍯";s:5:"23点";s:3:"㍰";s:5:"24点";s:3:"㍱";s:3:"hPa";s:3:"㍲";s:2:"da";s:3:"㍳";s:2:"AU";s:3:"㍴";s:3:"bar";s:3:"㍵";s:2:"oV";s:3:"㍶";s:2:"pc";s:3:"㍷";s:2:"dm";s:3:"㍸";s:3:"dm2";s:3:"㍹";s:3:"dm3";s:3:"㍺";s:2:"IU";s:3:"㍻";s:6:"平成";s:3:"㍼";s:6:"昭和";s:3:"㍽";s:6:"大正";s:3:"㍾";s:6:"明治";s:3:"㍿";s:12:"株式会社";s:3:"㎀";s:2:"pA";s:3:"㎁";s:2:"nA";s:3:"㎂";s:3:"μA";s:3:"㎃";s:2:"mA";s:3:"㎄";s:2:"kA";s:3:"㎅";s:2:"KB";s:3:"㎆";s:2:"MB";s:3:"㎇";s:2:"GB";s:3:"㎈";s:3:"cal";s:3:"㎉";s:4:"kcal";s:3:"㎊";s:2:"pF";s:3:"㎋";s:2:"nF";s:3:"㎌";s:3:"μF";s:3:"㎍";s:3:"μg";s:3:"㎎";s:2:"mg";s:3:"㎏";s:2:"kg";s:3:"㎐";s:2:"Hz";s:3:"㎑";s:3:"kHz";s:3:"㎒";s:3:"MHz";s:3:"㎓";s:3:"GHz";s:3:"㎔";s:3:"THz";s:3:"㎕";s:3:"μl";s:3:"㎖";s:2:"ml";s:3:"㎗";s:2:"dl";s:3:"㎘";s:2:"kl";s:3:"㎙";s:2:"fm";s:3:"㎚";s:2:"nm";s:3:"㎛";s:3:"μm";s:3:"㎜";s:2:"mm";s:3:"㎝";s:2:"cm";s:3:"㎞";s:2:"km";s:3:"㎟";s:3:"mm2";s:3:"㎠";s:3:"cm2";s:3:"㎡";s:2:"m2";s:3:"㎢";s:3:"km2";s:3:"㎣";s:3:"mm3";s:3:"㎤";s:3:"cm3";s:3:"㎥";s:2:"m3";s:3:"㎦";s:3:"km3";s:3:"㎧";s:5:"m∕s";s:3:"㎨";s:6:"m∕s2";s:3:"㎩";s:2:"Pa";s:3:"㎪";s:3:"kPa";s:3:"㎫";s:3:"MPa";s:3:"㎬";s:3:"GPa";s:3:"㎭";s:3:"rad";s:3:"㎮";s:7:"rad∕s";s:3:"㎯";s:8:"rad∕s2";s:3:"㎰";s:2:"ps";s:3:"㎱";s:2:"ns";s:3:"㎲";s:3:"μs";s:3:"㎳";s:2:"ms";s:3:"㎴";s:2:"pV";s:3:"㎵";s:2:"nV";s:3:"㎶";s:3:"μV";s:3:"㎷";s:2:"mV";s:3:"㎸";s:2:"kV";s:3:"㎹";s:2:"MV";s:3:"㎺";s:2:"pW";s:3:"㎻";s:2:"nW";s:3:"㎼";s:3:"μW";s:3:"㎽";s:2:"mW";s:3:"㎾";s:2:"kW";s:3:"㎿";s:2:"MW";s:3:"㏀";s:3:"kΩ";s:3:"㏁";s:3:"MΩ";s:3:"㏂";s:4:"a.m.";s:3:"㏃";s:2:"Bq";s:3:"㏄";s:2:"cc";s:3:"㏅";s:2:"cd";s:3:"㏆";s:6:"C∕kg";s:3:"㏇";s:3:"Co.";s:3:"㏈";s:2:"dB";s:3:"㏉";s:2:"Gy";s:3:"㏊";s:2:"ha";s:3:"㏋";s:2:"HP";s:3:"㏌";s:2:"in";s:3:"㏍";s:2:"KK";s:3:"㏎";s:2:"KM";s:3:"㏏";s:2:"kt";s:3:"㏐";s:2:"lm";s:3:"㏑";s:2:"ln";s:3:"㏒";s:3:"log";s:3:"㏓";s:2:"lx";s:3:"㏔";s:2:"mb";s:3:"㏕";s:3:"mil";s:3:"㏖";s:3:"mol";s:3:"㏗";s:2:"PH";s:3:"㏘";s:4:"p.m.";s:3:"㏙";s:3:"PPM";s:3:"㏚";s:2:"PR";s:3:"㏛";s:2:"sr";s:3:"㏜";s:2:"Sv";s:3:"㏝";s:2:"Wb";s:3:"㏞";s:5:"V∕m";s:3:"㏟";s:5:"A∕m";s:3:"㏠";s:4:"1日";s:3:"㏡";s:4:"2日";s:3:"㏢";s:4:"3日";s:3:"㏣";s:4:"4日";s:3:"㏤";s:4:"5日";s:3:"㏥";s:4:"6日";s:3:"㏦";s:4:"7日";s:3:"㏧";s:4:"8日";s:3:"㏨";s:4:"9日";s:3:"㏩";s:5:"10日";s:3:"㏪";s:5:"11日";s:3:"㏫";s:5:"12日";s:3:"㏬";s:5:"13日";s:3:"㏭";s:5:"14日";s:3:"㏮";s:5:"15日";s:3:"㏯";s:5:"16日";s:3:"㏰";s:5:"17日";s:3:"㏱";s:5:"18日";s:3:"㏲";s:5:"19日";s:3:"㏳";s:5:"20日";s:3:"㏴";s:5:"21日";s:3:"㏵";s:5:"22日";s:3:"㏶";s:5:"23日";s:3:"㏷";s:5:"24日";s:3:"㏸";s:5:"25日";s:3:"㏹";s:5:"26日";s:3:"㏺";s:5:"27日";s:3:"㏻";s:5:"28日";s:3:"㏼";s:5:"29日";s:3:"㏽";s:5:"30日";s:3:"㏾";s:5:"31日";s:3:"㏿";s:3:"gal";s:3:"ꚜ";s:2:"ъ";s:3:"ꚝ";s:2:"ь";s:3:"ꝰ";s:3:"ꝯ";s:3:"ꟸ";s:2:"Ħ";s:3:"ꟹ";s:2:"œ";s:3:"ꭜ";s:3:"ꜧ";s:3:"ꭝ";s:3:"ꬷ";s:3:"ꭞ";s:2:"ɫ";s:3:"ꭟ";s:3:"ꭒ";s:3:"ff";s:2:"ff";s:3:"fi";s:2:"fi";s:3:"fl";s:2:"fl";s:3:"ffi";s:3:"ffi";s:3:"ffl";s:3:"ffl";s:3:"ſt";s:2:"st";s:3:"st";s:2:"st";s:3:"ﬓ";s:4:"մն";s:3:"ﬔ";s:4:"մե";s:3:"ﬕ";s:4:"մի";s:3:"ﬖ";s:4:"վն";s:3:"ﬗ";s:4:"մխ";s:3:"ﬠ";s:2:"ע";s:3:"ﬡ";s:2:"א";s:3:"ﬢ";s:2:"ד";s:3:"ﬣ";s:2:"ה";s:3:"ﬤ";s:2:"כ";s:3:"ﬥ";s:2:"ל";s:3:"ﬦ";s:2:"ם";s:3:"ﬧ";s:2:"ר";s:3:"ﬨ";s:2:"ת";s:3:"﬩";s:1:"+";s:3:"ﭏ";s:4:"אל";s:3:"ﭐ";s:2:"ٱ";s:3:"ﭑ";s:2:"ٱ";s:3:"ﭒ";s:2:"ٻ";s:3:"ﭓ";s:2:"ٻ";s:3:"ﭔ";s:2:"ٻ";s:3:"ﭕ";s:2:"ٻ";s:3:"ﭖ";s:2:"پ";s:3:"ﭗ";s:2:"پ";s:3:"ﭘ";s:2:"پ";s:3:"ﭙ";s:2:"پ";s:3:"ﭚ";s:2:"ڀ";s:3:"ﭛ";s:2:"ڀ";s:3:"ﭜ";s:2:"ڀ";s:3:"ﭝ";s:2:"ڀ";s:3:"ﭞ";s:2:"ٺ";s:3:"ﭟ";s:2:"ٺ";s:3:"ﭠ";s:2:"ٺ";s:3:"ﭡ";s:2:"ٺ";s:3:"ﭢ";s:2:"ٿ";s:3:"ﭣ";s:2:"ٿ";s:3:"ﭤ";s:2:"ٿ";s:3:"ﭥ";s:2:"ٿ";s:3:"ﭦ";s:2:"ٹ";s:3:"ﭧ";s:2:"ٹ";s:3:"ﭨ";s:2:"ٹ";s:3:"ﭩ";s:2:"ٹ";s:3:"ﭪ";s:2:"ڤ";s:3:"ﭫ";s:2:"ڤ";s:3:"ﭬ";s:2:"ڤ";s:3:"ﭭ";s:2:"ڤ";s:3:"ﭮ";s:2:"ڦ";s:3:"ﭯ";s:2:"ڦ";s:3:"ﭰ";s:2:"ڦ";s:3:"ﭱ";s:2:"ڦ";s:3:"ﭲ";s:2:"ڄ";s:3:"ﭳ";s:2:"ڄ";s:3:"ﭴ";s:2:"ڄ";s:3:"ﭵ";s:2:"ڄ";s:3:"ﭶ";s:2:"ڃ";s:3:"ﭷ";s:2:"ڃ";s:3:"ﭸ";s:2:"ڃ";s:3:"ﭹ";s:2:"ڃ";s:3:"ﭺ";s:2:"چ";s:3:"ﭻ";s:2:"چ";s:3:"ﭼ";s:2:"چ";s:3:"ﭽ";s:2:"چ";s:3:"ﭾ";s:2:"ڇ";s:3:"ﭿ";s:2:"ڇ";s:3:"ﮀ";s:2:"ڇ";s:3:"ﮁ";s:2:"ڇ";s:3:"ﮂ";s:2:"ڍ";s:3:"ﮃ";s:2:"ڍ";s:3:"ﮄ";s:2:"ڌ";s:3:"ﮅ";s:2:"ڌ";s:3:"ﮆ";s:2:"ڎ";s:3:"ﮇ";s:2:"ڎ";s:3:"ﮈ";s:2:"ڈ";s:3:"ﮉ";s:2:"ڈ";s:3:"ﮊ";s:2:"ژ";s:3:"ﮋ";s:2:"ژ";s:3:"ﮌ";s:2:"ڑ";s:3:"ﮍ";s:2:"ڑ";s:3:"ﮎ";s:2:"ک";s:3:"ﮏ";s:2:"ک";s:3:"ﮐ";s:2:"ک";s:3:"ﮑ";s:2:"ک";s:3:"ﮒ";s:2:"گ";s:3:"ﮓ";s:2:"گ";s:3:"ﮔ";s:2:"گ";s:3:"ﮕ";s:2:"گ";s:3:"ﮖ";s:2:"ڳ";s:3:"ﮗ";s:2:"ڳ";s:3:"ﮘ";s:2:"ڳ";s:3:"ﮙ";s:2:"ڳ";s:3:"ﮚ";s:2:"ڱ";s:3:"ﮛ";s:2:"ڱ";s:3:"ﮜ";s:2:"ڱ";s:3:"ﮝ";s:2:"ڱ";s:3:"ﮞ";s:2:"ں";s:3:"ﮟ";s:2:"ں";s:3:"ﮠ";s:2:"ڻ";s:3:"ﮡ";s:2:"ڻ";s:3:"ﮢ";s:2:"ڻ";s:3:"ﮣ";s:2:"ڻ";s:3:"ﮤ";s:4:"ۀ";s:3:"ﮥ";s:4:"ۀ";s:3:"ﮦ";s:2:"ہ";s:3:"ﮧ";s:2:"ہ";s:3:"ﮨ";s:2:"ہ";s:3:"ﮩ";s:2:"ہ";s:3:"ﮪ";s:2:"ھ";s:3:"ﮫ";s:2:"ھ";s:3:"ﮬ";s:2:"ھ";s:3:"ﮭ";s:2:"ھ";s:3:"ﮮ";s:2:"ے";s:3:"ﮯ";s:2:"ے";s:3:"ﮰ";s:4:"ۓ";s:3:"ﮱ";s:4:"ۓ";s:3:"ﯓ";s:2:"ڭ";s:3:"ﯔ";s:2:"ڭ";s:3:"ﯕ";s:2:"ڭ";s:3:"ﯖ";s:2:"ڭ";s:3:"ﯗ";s:2:"ۇ";s:3:"ﯘ";s:2:"ۇ";s:3:"ﯙ";s:2:"ۆ";s:3:"ﯚ";s:2:"ۆ";s:3:"ﯛ";s:2:"ۈ";s:3:"ﯜ";s:2:"ۈ";s:3:"ﯝ";s:4:"ۇٴ";s:3:"ﯞ";s:2:"ۋ";s:3:"ﯟ";s:2:"ۋ";s:3:"ﯠ";s:2:"ۅ";s:3:"ﯡ";s:2:"ۅ";s:3:"ﯢ";s:2:"ۉ";s:3:"ﯣ";s:2:"ۉ";s:3:"ﯤ";s:2:"ې";s:3:"ﯥ";s:2:"ې";s:3:"ﯦ";s:2:"ې";s:3:"ﯧ";s:2:"ې";s:3:"ﯨ";s:2:"ى";s:3:"ﯩ";s:2:"ى";s:3:"ﯪ";s:6:"ئا";s:3:"ﯫ";s:6:"ئا";s:3:"ﯬ";s:6:"ئە";s:3:"ﯭ";s:6:"ئە";s:3:"ﯮ";s:6:"ئو";s:3:"ﯯ";s:6:"ئو";s:3:"ﯰ";s:6:"ئۇ";s:3:"ﯱ";s:6:"ئۇ";s:3:"ﯲ";s:6:"ئۆ";s:3:"ﯳ";s:6:"ئۆ";s:3:"ﯴ";s:6:"ئۈ";s:3:"ﯵ";s:6:"ئۈ";s:3:"ﯶ";s:6:"ئې";s:3:"ﯷ";s:6:"ئې";s:3:"ﯸ";s:6:"ئې";s:3:"ﯹ";s:6:"ئى";s:3:"ﯺ";s:6:"ئى";s:3:"ﯻ";s:6:"ئى";s:3:"ﯼ";s:2:"ی";s:3:"ﯽ";s:2:"ی";s:3:"ﯾ";s:2:"ی";s:3:"ﯿ";s:2:"ی";s:3:"ﰀ";s:6:"ئج";s:3:"ﰁ";s:6:"ئح";s:3:"ﰂ";s:6:"ئم";s:3:"ﰃ";s:6:"ئى";s:3:"ﰄ";s:6:"ئي";s:3:"ﰅ";s:4:"بج";s:3:"ﰆ";s:4:"بح";s:3:"ﰇ";s:4:"بخ";s:3:"ﰈ";s:4:"بم";s:3:"ﰉ";s:4:"بى";s:3:"ﰊ";s:4:"بي";s:3:"ﰋ";s:4:"تج";s:3:"ﰌ";s:4:"تح";s:3:"ﰍ";s:4:"تخ";s:3:"ﰎ";s:4:"تم";s:3:"ﰏ";s:4:"تى";s:3:"ﰐ";s:4:"تي";s:3:"ﰑ";s:4:"ثج";s:3:"ﰒ";s:4:"ثم";s:3:"ﰓ";s:4:"ثى";s:3:"ﰔ";s:4:"ثي";s:3:"ﰕ";s:4:"جح";s:3:"ﰖ";s:4:"جم";s:3:"ﰗ";s:4:"حج";s:3:"ﰘ";s:4:"حم";s:3:"ﰙ";s:4:"خج";s:3:"ﰚ";s:4:"خح";s:3:"ﰛ";s:4:"خم";s:3:"ﰜ";s:4:"سج";s:3:"ﰝ";s:4:"سح";s:3:"ﰞ";s:4:"سخ";s:3:"ﰟ";s:4:"سم";s:3:"ﰠ";s:4:"صح";s:3:"ﰡ";s:4:"صم";s:3:"ﰢ";s:4:"ضج";s:3:"ﰣ";s:4:"ضح";s:3:"ﰤ";s:4:"ضخ";s:3:"ﰥ";s:4:"ضم";s:3:"ﰦ";s:4:"طح";s:3:"ﰧ";s:4:"طم";s:3:"ﰨ";s:4:"ظم";s:3:"ﰩ";s:4:"عج";s:3:"ﰪ";s:4:"عم";s:3:"ﰫ";s:4:"غج";s:3:"ﰬ";s:4:"غم";s:3:"ﰭ";s:4:"فج";s:3:"ﰮ";s:4:"فح";s:3:"ﰯ";s:4:"فخ";s:3:"ﰰ";s:4:"فم";s:3:"ﰱ";s:4:"فى";s:3:"ﰲ";s:4:"في";s:3:"ﰳ";s:4:"قح";s:3:"ﰴ";s:4:"قم";s:3:"ﰵ";s:4:"قى";s:3:"ﰶ";s:4:"قي";s:3:"ﰷ";s:4:"كا";s:3:"ﰸ";s:4:"كج";s:3:"ﰹ";s:4:"كح";s:3:"ﰺ";s:4:"كخ";s:3:"ﰻ";s:4:"كل";s:3:"ﰼ";s:4:"كم";s:3:"ﰽ";s:4:"كى";s:3:"ﰾ";s:4:"كي";s:3:"ﰿ";s:4:"لج";s:3:"ﱀ";s:4:"لح";s:3:"ﱁ";s:4:"لخ";s:3:"ﱂ";s:4:"لم";s:3:"ﱃ";s:4:"لى";s:3:"ﱄ";s:4:"لي";s:3:"ﱅ";s:4:"مج";s:3:"ﱆ";s:4:"مح";s:3:"ﱇ";s:4:"مخ";s:3:"ﱈ";s:4:"مم";s:3:"ﱉ";s:4:"مى";s:3:"ﱊ";s:4:"مي";s:3:"ﱋ";s:4:"نج";s:3:"ﱌ";s:4:"نح";s:3:"ﱍ";s:4:"نخ";s:3:"ﱎ";s:4:"نم";s:3:"ﱏ";s:4:"نى";s:3:"ﱐ";s:4:"ني";s:3:"ﱑ";s:4:"هج";s:3:"ﱒ";s:4:"هم";s:3:"ﱓ";s:4:"هى";s:3:"ﱔ";s:4:"هي";s:3:"ﱕ";s:4:"يج";s:3:"ﱖ";s:4:"يح";s:3:"ﱗ";s:4:"يخ";s:3:"ﱘ";s:4:"يم";s:3:"ﱙ";s:4:"يى";s:3:"ﱚ";s:4:"يي";s:3:"ﱛ";s:4:"ذٰ";s:3:"ﱜ";s:4:"رٰ";s:3:"ﱝ";s:4:"ىٰ";s:3:"ﱞ";s:5:" ٌّ";s:3:"ﱟ";s:5:" ٍّ";s:3:"ﱠ";s:5:" َّ";s:3:"ﱡ";s:5:" ُّ";s:3:"ﱢ";s:5:" ِّ";s:3:"ﱣ";s:5:" ّٰ";s:3:"ﱤ";s:6:"ئر";s:3:"ﱥ";s:6:"ئز";s:3:"ﱦ";s:6:"ئم";s:3:"ﱧ";s:6:"ئن";s:3:"ﱨ";s:6:"ئى";s:3:"ﱩ";s:6:"ئي";s:3:"ﱪ";s:4:"بر";s:3:"ﱫ";s:4:"بز";s:3:"ﱬ";s:4:"بم";s:3:"ﱭ";s:4:"بن";s:3:"ﱮ";s:4:"بى";s:3:"ﱯ";s:4:"بي";s:3:"ﱰ";s:4:"تر";s:3:"ﱱ";s:4:"تز";s:3:"ﱲ";s:4:"تم";s:3:"ﱳ";s:4:"تن";s:3:"ﱴ";s:4:"تى";s:3:"ﱵ";s:4:"تي";s:3:"ﱶ";s:4:"ثر";s:3:"ﱷ";s:4:"ثز";s:3:"ﱸ";s:4:"ثم";s:3:"ﱹ";s:4:"ثن";s:3:"ﱺ";s:4:"ثى";s:3:"ﱻ";s:4:"ثي";s:3:"ﱼ";s:4:"فى";s:3:"ﱽ";s:4:"في";s:3:"ﱾ";s:4:"قى";s:3:"ﱿ";s:4:"قي";s:3:"ﲀ";s:4:"كا";s:3:"ﲁ";s:4:"كل";s:3:"ﲂ";s:4:"كم";s:3:"ﲃ";s:4:"كى";s:3:"ﲄ";s:4:"كي";s:3:"ﲅ";s:4:"لم";s:3:"ﲆ";s:4:"لى";s:3:"ﲇ";s:4:"لي";s:3:"ﲈ";s:4:"ما";s:3:"ﲉ";s:4:"مم";s:3:"ﲊ";s:4:"نر";s:3:"ﲋ";s:4:"نز";s:3:"ﲌ";s:4:"نم";s:3:"ﲍ";s:4:"نن";s:3:"ﲎ";s:4:"نى";s:3:"ﲏ";s:4:"ني";s:3:"ﲐ";s:4:"ىٰ";s:3:"ﲑ";s:4:"ير";s:3:"ﲒ";s:4:"يز";s:3:"ﲓ";s:4:"يم";s:3:"ﲔ";s:4:"ين";s:3:"ﲕ";s:4:"يى";s:3:"ﲖ";s:4:"يي";s:3:"ﲗ";s:6:"ئج";s:3:"ﲘ";s:6:"ئح";s:3:"ﲙ";s:6:"ئخ";s:3:"ﲚ";s:6:"ئم";s:3:"ﲛ";s:6:"ئه";s:3:"ﲜ";s:4:"بج";s:3:"ﲝ";s:4:"بح";s:3:"ﲞ";s:4:"بخ";s:3:"ﲟ";s:4:"بم";s:3:"ﲠ";s:4:"به";s:3:"ﲡ";s:4:"تج";s:3:"ﲢ";s:4:"تح";s:3:"ﲣ";s:4:"تخ";s:3:"ﲤ";s:4:"تم";s:3:"ﲥ";s:4:"ته";s:3:"ﲦ";s:4:"ثم";s:3:"ﲧ";s:4:"جح";s:3:"ﲨ";s:4:"جم";s:3:"ﲩ";s:4:"حج";s:3:"ﲪ";s:4:"حم";s:3:"ﲫ";s:4:"خج";s:3:"ﲬ";s:4:"خم";s:3:"ﲭ";s:4:"سج";s:3:"ﲮ";s:4:"سح";s:3:"ﲯ";s:4:"سخ";s:3:"ﲰ";s:4:"سم";s:3:"ﲱ";s:4:"صح";s:3:"ﲲ";s:4:"صخ";s:3:"ﲳ";s:4:"صم";s:3:"ﲴ";s:4:"ضج";s:3:"ﲵ";s:4:"ضح";s:3:"ﲶ";s:4:"ضخ";s:3:"ﲷ";s:4:"ضم";s:3:"ﲸ";s:4:"طح";s:3:"ﲹ";s:4:"ظم";s:3:"ﲺ";s:4:"عج";s:3:"ﲻ";s:4:"عم";s:3:"ﲼ";s:4:"غج";s:3:"ﲽ";s:4:"غم";s:3:"ﲾ";s:4:"فج";s:3:"ﲿ";s:4:"فح";s:3:"ﳀ";s:4:"فخ";s:3:"ﳁ";s:4:"فم";s:3:"ﳂ";s:4:"قح";s:3:"ﳃ";s:4:"قم";s:3:"ﳄ";s:4:"كج";s:3:"ﳅ";s:4:"كح";s:3:"ﳆ";s:4:"كخ";s:3:"ﳇ";s:4:"كل";s:3:"ﳈ";s:4:"كم";s:3:"ﳉ";s:4:"لج";s:3:"ﳊ";s:4:"لح";s:3:"ﳋ";s:4:"لخ";s:3:"ﳌ";s:4:"لم";s:3:"ﳍ";s:4:"له";s:3:"ﳎ";s:4:"مج";s:3:"ﳏ";s:4:"مح";s:3:"ﳐ";s:4:"مخ";s:3:"ﳑ";s:4:"مم";s:3:"ﳒ";s:4:"نج";s:3:"ﳓ";s:4:"نح";s:3:"ﳔ";s:4:"نخ";s:3:"ﳕ";s:4:"نم";s:3:"ﳖ";s:4:"نه";s:3:"ﳗ";s:4:"هج";s:3:"ﳘ";s:4:"هم";s:3:"ﳙ";s:4:"هٰ";s:3:"ﳚ";s:4:"يج";s:3:"ﳛ";s:4:"يح";s:3:"ﳜ";s:4:"يخ";s:3:"ﳝ";s:4:"يم";s:3:"ﳞ";s:4:"يه";s:3:"ﳟ";s:6:"ئم";s:3:"ﳠ";s:6:"ئه";s:3:"ﳡ";s:4:"بم";s:3:"ﳢ";s:4:"به";s:3:"ﳣ";s:4:"تم";s:3:"ﳤ";s:4:"ته";s:3:"ﳥ";s:4:"ثم";s:3:"ﳦ";s:4:"ثه";s:3:"ﳧ";s:4:"سم";s:3:"ﳨ";s:4:"سه";s:3:"ﳩ";s:4:"شم";s:3:"ﳪ";s:4:"شه";s:3:"ﳫ";s:4:"كل";s:3:"ﳬ";s:4:"كم";s:3:"ﳭ";s:4:"لم";s:3:"ﳮ";s:4:"نم";s:3:"ﳯ";s:4:"نه";s:3:"ﳰ";s:4:"يم";s:3:"ﳱ";s:4:"يه";s:3:"ﳲ";s:6:"ـَّ";s:3:"ﳳ";s:6:"ـُّ";s:3:"ﳴ";s:6:"ـِّ";s:3:"ﳵ";s:4:"طى";s:3:"ﳶ";s:4:"طي";s:3:"ﳷ";s:4:"عى";s:3:"ﳸ";s:4:"عي";s:3:"ﳹ";s:4:"غى";s:3:"ﳺ";s:4:"غي";s:3:"ﳻ";s:4:"سى";s:3:"ﳼ";s:4:"سي";s:3:"ﳽ";s:4:"شى";s:3:"ﳾ";s:4:"شي";s:3:"ﳿ";s:4:"حى";s:3:"ﴀ";s:4:"حي";s:3:"ﴁ";s:4:"جى";s:3:"ﴂ";s:4:"جي";s:3:"ﴃ";s:4:"خى";s:3:"ﴄ";s:4:"خي";s:3:"ﴅ";s:4:"صى";s:3:"ﴆ";s:4:"صي";s:3:"ﴇ";s:4:"ضى";s:3:"ﴈ";s:4:"ضي";s:3:"ﴉ";s:4:"شج";s:3:"ﴊ";s:4:"شح";s:3:"ﴋ";s:4:"شخ";s:3:"ﴌ";s:4:"شم";s:3:"ﴍ";s:4:"شر";s:3:"ﴎ";s:4:"سر";s:3:"ﴏ";s:4:"صر";s:3:"ﴐ";s:4:"ضر";s:3:"ﴑ";s:4:"طى";s:3:"ﴒ";s:4:"طي";s:3:"ﴓ";s:4:"عى";s:3:"ﴔ";s:4:"عي";s:3:"ﴕ";s:4:"غى";s:3:"ﴖ";s:4:"غي";s:3:"ﴗ";s:4:"سى";s:3:"ﴘ";s:4:"سي";s:3:"ﴙ";s:4:"شى";s:3:"ﴚ";s:4:"شي";s:3:"ﴛ";s:4:"حى";s:3:"ﴜ";s:4:"حي";s:3:"ﴝ";s:4:"جى";s:3:"ﴞ";s:4:"جي";s:3:"ﴟ";s:4:"خى";s:3:"ﴠ";s:4:"خي";s:3:"ﴡ";s:4:"صى";s:3:"ﴢ";s:4:"صي";s:3:"ﴣ";s:4:"ضى";s:3:"ﴤ";s:4:"ضي";s:3:"ﴥ";s:4:"شج";s:3:"ﴦ";s:4:"شح";s:3:"ﴧ";s:4:"شخ";s:3:"ﴨ";s:4:"شم";s:3:"ﴩ";s:4:"شر";s:3:"ﴪ";s:4:"سر";s:3:"ﴫ";s:4:"صر";s:3:"ﴬ";s:4:"ضر";s:3:"ﴭ";s:4:"شج";s:3:"ﴮ";s:4:"شح";s:3:"ﴯ";s:4:"شخ";s:3:"ﴰ";s:4:"شم";s:3:"ﴱ";s:4:"سه";s:3:"ﴲ";s:4:"شه";s:3:"ﴳ";s:4:"طم";s:3:"ﴴ";s:4:"سج";s:3:"ﴵ";s:4:"سح";s:3:"ﴶ";s:4:"سخ";s:3:"ﴷ";s:4:"شج";s:3:"ﴸ";s:4:"شح";s:3:"ﴹ";s:4:"شخ";s:3:"ﴺ";s:4:"طم";s:3:"ﴻ";s:4:"ظم";s:3:"ﴼ";s:4:"اً";s:3:"ﴽ";s:4:"اً";s:3:"ﵐ";s:6:"تجم";s:3:"ﵑ";s:6:"تحج";s:3:"ﵒ";s:6:"تحج";s:3:"ﵓ";s:6:"تحم";s:3:"ﵔ";s:6:"تخم";s:3:"ﵕ";s:6:"تمج";s:3:"ﵖ";s:6:"تمح";s:3:"ﵗ";s:6:"تمخ";s:3:"ﵘ";s:6:"جمح";s:3:"ﵙ";s:6:"جمح";s:3:"ﵚ";s:6:"حمي";s:3:"ﵛ";s:6:"حمى";s:3:"ﵜ";s:6:"سحج";s:3:"ﵝ";s:6:"سجح";s:3:"ﵞ";s:6:"سجى";s:3:"ﵟ";s:6:"سمح";s:3:"ﵠ";s:6:"سمح";s:3:"ﵡ";s:6:"سمج";s:3:"ﵢ";s:6:"سمم";s:3:"ﵣ";s:6:"سمم";s:3:"ﵤ";s:6:"صحح";s:3:"ﵥ";s:6:"صحح";s:3:"ﵦ";s:6:"صمم";s:3:"ﵧ";s:6:"شحم";s:3:"ﵨ";s:6:"شحم";s:3:"ﵩ";s:6:"شجي";s:3:"ﵪ";s:6:"شمخ";s:3:"ﵫ";s:6:"شمخ";s:3:"ﵬ";s:6:"شمم";s:3:"ﵭ";s:6:"شمم";s:3:"ﵮ";s:6:"ضحى";s:3:"ﵯ";s:6:"ضخم";s:3:"ﵰ";s:6:"ضخم";s:3:"ﵱ";s:6:"طمح";s:3:"ﵲ";s:6:"طمح";s:3:"ﵳ";s:6:"طمم";s:3:"ﵴ";s:6:"طمي";s:3:"ﵵ";s:6:"عجم";s:3:"ﵶ";s:6:"عمم";s:3:"ﵷ";s:6:"عمم";s:3:"ﵸ";s:6:"عمى";s:3:"ﵹ";s:6:"غمم";s:3:"ﵺ";s:6:"غمي";s:3:"ﵻ";s:6:"غمى";s:3:"ﵼ";s:6:"فخم";s:3:"ﵽ";s:6:"فخم";s:3:"ﵾ";s:6:"قمح";s:3:"ﵿ";s:6:"قمم";s:3:"ﶀ";s:6:"لحم";s:3:"ﶁ";s:6:"لحي";s:3:"ﶂ";s:6:"لحى";s:3:"ﶃ";s:6:"لجج";s:3:"ﶄ";s:6:"لجج";s:3:"ﶅ";s:6:"لخم";s:3:"ﶆ";s:6:"لخم";s:3:"ﶇ";s:6:"لمح";s:3:"ﶈ";s:6:"لمح";s:3:"ﶉ";s:6:"محج";s:3:"ﶊ";s:6:"محم";s:3:"ﶋ";s:6:"محي";s:3:"ﶌ";s:6:"مجح";s:3:"ﶍ";s:6:"مجم";s:3:"ﶎ";s:6:"مخج";s:3:"ﶏ";s:6:"مخم";s:3:"ﶒ";s:6:"مجخ";s:3:"ﶓ";s:6:"همج";s:3:"ﶔ";s:6:"همم";s:3:"ﶕ";s:6:"نحم";s:3:"ﶖ";s:6:"نحى";s:3:"ﶗ";s:6:"نجم";s:3:"ﶘ";s:6:"نجم";s:3:"ﶙ";s:6:"نجى";s:3:"ﶚ";s:6:"نمي";s:3:"ﶛ";s:6:"نمى";s:3:"ﶜ";s:6:"يمم";s:3:"ﶝ";s:6:"يمم";s:3:"ﶞ";s:6:"بخي";s:3:"ﶟ";s:6:"تجي";s:3:"ﶠ";s:6:"تجى";s:3:"ﶡ";s:6:"تخي";s:3:"ﶢ";s:6:"تخى";s:3:"ﶣ";s:6:"تمي";s:3:"ﶤ";s:6:"تمى";s:3:"ﶥ";s:6:"جمي";s:3:"ﶦ";s:6:"جحى";s:3:"ﶧ";s:6:"جمى";s:3:"ﶨ";s:6:"سخى";s:3:"ﶩ";s:6:"صحي";s:3:"ﶪ";s:6:"شحي";s:3:"ﶫ";s:6:"ضحي";s:3:"ﶬ";s:6:"لجي";s:3:"ﶭ";s:6:"لمي";s:3:"ﶮ";s:6:"يحي";s:3:"ﶯ";s:6:"يجي";s:3:"ﶰ";s:6:"يمي";s:3:"ﶱ";s:6:"ممي";s:3:"ﶲ";s:6:"قمي";s:3:"ﶳ";s:6:"نحي";s:3:"ﶴ";s:6:"قمح";s:3:"ﶵ";s:6:"لحم";s:3:"ﶶ";s:6:"عمي";s:3:"ﶷ";s:6:"كمي";s:3:"ﶸ";s:6:"نجح";s:3:"ﶹ";s:6:"مخي";s:3:"ﶺ";s:6:"لجم";s:3:"ﶻ";s:6:"كمم";s:3:"ﶼ";s:6:"لجم";s:3:"ﶽ";s:6:"نجح";s:3:"ﶾ";s:6:"جحي";s:3:"ﶿ";s:6:"حجي";s:3:"ﷀ";s:6:"مجي";s:3:"ﷁ";s:6:"فمي";s:3:"ﷂ";s:6:"بحي";s:3:"ﷃ";s:6:"كمم";s:3:"ﷄ";s:6:"عجم";s:3:"ﷅ";s:6:"صمم";s:3:"ﷆ";s:6:"سخي";s:3:"ﷇ";s:6:"نجي";s:3:"ﷰ";s:6:"صلے";s:3:"ﷱ";s:6:"قلے";s:3:"ﷲ";s:8:"الله";s:3:"ﷳ";s:8:"اكبر";s:3:"ﷴ";s:8:"محمد";s:3:"ﷵ";s:8:"صلعم";s:3:"ﷶ";s:8:"رسول";s:3:"ﷷ";s:8:"عليه";s:3:"ﷸ";s:8:"وسلم";s:3:"ﷹ";s:6:"صلى";s:3:"ﷺ";s:33:"صلى الله عليه وسلم";s:3:"ﷻ";s:15:"جل جلاله";s:3:"﷼";s:8:"ریال";s:3:"︐";s:1:",";s:3:"︑";s:3:"、";s:3:"︒";s:3:"。";s:3:"︓";s:1:":";s:3:"︔";s:1:";";s:3:"︕";s:1:"!";s:3:"︖";s:1:"?";s:3:"︗";s:3:"〖";s:3:"︘";s:3:"〗";s:3:"︙";s:3:"...";s:3:"︰";s:2:"..";s:3:"︱";s:3:"—";s:3:"︲";s:3:"–";s:3:"︳";s:1:"_";s:3:"︴";s:1:"_";s:3:"︵";s:1:"(";s:3:"︶";s:1:")";s:3:"︷";s:1:"{";s:3:"︸";s:1:"}";s:3:"︹";s:3:"〔";s:3:"︺";s:3:"〕";s:3:"︻";s:3:"【";s:3:"︼";s:3:"】";s:3:"︽";s:3:"《";s:3:"︾";s:3:"》";s:3:"︿";s:3:"〈";s:3:"﹀";s:3:"〉";s:3:"﹁";s:3:"「";s:3:"﹂";s:3:"」";s:3:"﹃";s:3:"『";s:3:"﹄";s:3:"』";s:3:"﹇";s:1:"[";s:3:"﹈";s:1:"]";s:3:"﹉";s:3:" ̅";s:3:"﹊";s:3:" ̅";s:3:"﹋";s:3:" ̅";s:3:"﹌";s:3:" ̅";s:3:"﹍";s:1:"_";s:3:"﹎";s:1:"_";s:3:"﹏";s:1:"_";s:3:"﹐";s:1:",";s:3:"﹑";s:3:"、";s:3:"﹒";s:1:".";s:3:"﹔";s:1:";";s:3:"﹕";s:1:":";s:3:"﹖";s:1:"?";s:3:"﹗";s:1:"!";s:3:"﹘";s:3:"—";s:3:"﹙";s:1:"(";s:3:"﹚";s:1:")";s:3:"﹛";s:1:"{";s:3:"﹜";s:1:"}";s:3:"﹝";s:3:"〔";s:3:"﹞";s:3:"〕";s:3:"﹟";s:1:"#";s:3:"﹠";s:1:"&";s:3:"﹡";s:1:"*";s:3:"﹢";s:1:"+";s:3:"﹣";s:1:"-";s:3:"﹤";s:1:"<";s:3:"﹥";s:1:">";s:3:"﹦";s:1:"=";s:3:"﹨";s:1:"\";s:3:"﹩";s:1:"$";s:3:"﹪";s:1:"%";s:3:"﹫";s:1:"@";s:3:"ﹰ";s:3:" ً";s:3:"ﹱ";s:4:"ـً";s:3:"ﹲ";s:3:" ٌ";s:3:"ﹴ";s:3:" ٍ";s:3:"ﹶ";s:3:" َ";s:3:"ﹷ";s:4:"ـَ";s:3:"ﹸ";s:3:" ُ";s:3:"ﹹ";s:4:"ـُ";s:3:"ﹺ";s:3:" ِ";s:3:"ﹻ";s:4:"ـِ";s:3:"ﹼ";s:3:" ّ";s:3:"ﹽ";s:4:"ـّ";s:3:"ﹾ";s:3:" ْ";s:3:"ﹿ";s:4:"ـْ";s:3:"ﺀ";s:2:"ء";s:3:"ﺁ";s:4:"آ";s:3:"ﺂ";s:4:"آ";s:3:"ﺃ";s:4:"أ";s:3:"ﺄ";s:4:"أ";s:3:"ﺅ";s:4:"ؤ";s:3:"ﺆ";s:4:"ؤ";s:3:"ﺇ";s:4:"إ";s:3:"ﺈ";s:4:"إ";s:3:"ﺉ";s:4:"ئ";s:3:"ﺊ";s:4:"ئ";s:3:"ﺋ";s:4:"ئ";s:3:"ﺌ";s:4:"ئ";s:3:"ﺍ";s:2:"ا";s:3:"ﺎ";s:2:"ا";s:3:"ﺏ";s:2:"ب";s:3:"ﺐ";s:2:"ب";s:3:"ﺑ";s:2:"ب";s:3:"ﺒ";s:2:"ب";s:3:"ﺓ";s:2:"ة";s:3:"ﺔ";s:2:"ة";s:3:"ﺕ";s:2:"ت";s:3:"ﺖ";s:2:"ت";s:3:"ﺗ";s:2:"ت";s:3:"ﺘ";s:2:"ت";s:3:"ﺙ";s:2:"ث";s:3:"ﺚ";s:2:"ث";s:3:"ﺛ";s:2:"ث";s:3:"ﺜ";s:2:"ث";s:3:"ﺝ";s:2:"ج";s:3:"ﺞ";s:2:"ج";s:3:"ﺟ";s:2:"ج";s:3:"ﺠ";s:2:"ج";s:3:"ﺡ";s:2:"ح";s:3:"ﺢ";s:2:"ح";s:3:"ﺣ";s:2:"ح";s:3:"ﺤ";s:2:"ح";s:3:"ﺥ";s:2:"خ";s:3:"ﺦ";s:2:"خ";s:3:"ﺧ";s:2:"خ";s:3:"ﺨ";s:2:"خ";s:3:"ﺩ";s:2:"د";s:3:"ﺪ";s:2:"د";s:3:"ﺫ";s:2:"ذ";s:3:"ﺬ";s:2:"ذ";s:3:"ﺭ";s:2:"ر";s:3:"ﺮ";s:2:"ر";s:3:"ﺯ";s:2:"ز";s:3:"ﺰ";s:2:"ز";s:3:"ﺱ";s:2:"س";s:3:"ﺲ";s:2:"س";s:3:"ﺳ";s:2:"س";s:3:"ﺴ";s:2:"س";s:3:"ﺵ";s:2:"ش";s:3:"ﺶ";s:2:"ش";s:3:"ﺷ";s:2:"ش";s:3:"ﺸ";s:2:"ش";s:3:"ﺹ";s:2:"ص";s:3:"ﺺ";s:2:"ص";s:3:"ﺻ";s:2:"ص";s:3:"ﺼ";s:2:"ص";s:3:"ﺽ";s:2:"ض";s:3:"ﺾ";s:2:"ض";s:3:"ﺿ";s:2:"ض";s:3:"ﻀ";s:2:"ض";s:3:"ﻁ";s:2:"ط";s:3:"ﻂ";s:2:"ط";s:3:"ﻃ";s:2:"ط";s:3:"ﻄ";s:2:"ط";s:3:"ﻅ";s:2:"ظ";s:3:"ﻆ";s:2:"ظ";s:3:"ﻇ";s:2:"ظ";s:3:"ﻈ";s:2:"ظ";s:3:"ﻉ";s:2:"ع";s:3:"ﻊ";s:2:"ع";s:3:"ﻋ";s:2:"ع";s:3:"ﻌ";s:2:"ع";s:3:"ﻍ";s:2:"غ";s:3:"ﻎ";s:2:"غ";s:3:"ﻏ";s:2:"غ";s:3:"ﻐ";s:2:"غ";s:3:"ﻑ";s:2:"ف";s:3:"ﻒ";s:2:"ف";s:3:"ﻓ";s:2:"ف";s:3:"ﻔ";s:2:"ف";s:3:"ﻕ";s:2:"ق";s:3:"ﻖ";s:2:"ق";s:3:"ﻗ";s:2:"ق";s:3:"ﻘ";s:2:"ق";s:3:"ﻙ";s:2:"ك";s:3:"ﻚ";s:2:"ك";s:3:"ﻛ";s:2:"ك";s:3:"ﻜ";s:2:"ك";s:3:"ﻝ";s:2:"ل";s:3:"ﻞ";s:2:"ل";s:3:"ﻟ";s:2:"ل";s:3:"ﻠ";s:2:"ل";s:3:"ﻡ";s:2:"م";s:3:"ﻢ";s:2:"م";s:3:"ﻣ";s:2:"م";s:3:"ﻤ";s:2:"م";s:3:"ﻥ";s:2:"ن";s:3:"ﻦ";s:2:"ن";s:3:"ﻧ";s:2:"ن";s:3:"ﻨ";s:2:"ن";s:3:"ﻩ";s:2:"ه";s:3:"ﻪ";s:2:"ه";s:3:"ﻫ";s:2:"ه";s:3:"ﻬ";s:2:"ه";s:3:"ﻭ";s:2:"و";s:3:"ﻮ";s:2:"و";s:3:"ﻯ";s:2:"ى";s:3:"ﻰ";s:2:"ى";s:3:"ﻱ";s:2:"ي";s:3:"ﻲ";s:2:"ي";s:3:"ﻳ";s:2:"ي";s:3:"ﻴ";s:2:"ي";s:3:"ﻵ";s:6:"لآ";s:3:"ﻶ";s:6:"لآ";s:3:"ﻷ";s:6:"لأ";s:3:"ﻸ";s:6:"لأ";s:3:"ﻹ";s:6:"لإ";s:3:"ﻺ";s:6:"لإ";s:3:"ﻻ";s:4:"لا";s:3:"ﻼ";s:4:"لا";s:3:"!";s:1:"!";s:3:""";s:1:""";s:3:"#";s:1:"#";s:3:"$";s:1:"$";s:3:"%";s:1:"%";s:3:"&";s:1:"&";s:3:"'";s:1:"'";s:3:"(";s:1:"(";s:3:")";s:1:")";s:3:"*";s:1:"*";s:3:"+";s:1:"+";s:3:",";s:1:",";s:3:"-";s:1:"-";s:3:".";s:1:".";s:3:"/";s:1:"/";s:3:"0";s:1:"0";s:3:"1";s:1:"1";s:3:"2";s:1:"2";s:3:"3";s:1:"3";s:3:"4";s:1:"4";s:3:"5";s:1:"5";s:3:"6";s:1:"6";s:3:"7";s:1:"7";s:3:"8";s:1:"8";s:3:"9";s:1:"9";s:3:":";s:1:":";s:3:";";s:1:";";s:3:"<";s:1:"<";s:3:"=";s:1:"=";s:3:">";s:1:">";s:3:"?";s:1:"?";s:3:"@";s:1:"@";s:3:"A";s:1:"A";s:3:"B";s:1:"B";s:3:"C";s:1:"C";s:3:"D";s:1:"D";s:3:"E";s:1:"E";s:3:"F";s:1:"F";s:3:"G";s:1:"G";s:3:"H";s:1:"H";s:3:"I";s:1:"I";s:3:"J";s:1:"J";s:3:"K";s:1:"K";s:3:"L";s:1:"L";s:3:"M";s:1:"M";s:3:"N";s:1:"N";s:3:"O";s:1:"O";s:3:"P";s:1:"P";s:3:"Q";s:1:"Q";s:3:"R";s:1:"R";s:3:"S";s:1:"S";s:3:"T";s:1:"T";s:3:"U";s:1:"U";s:3:"V";s:1:"V";s:3:"W";s:1:"W";s:3:"X";s:1:"X";s:3:"Y";s:1:"Y";s:3:"Z";s:1:"Z";s:3:"[";s:1:"[";s:3:"\";s:1:"\";s:3:"]";s:1:"]";s:3:"^";s:1:"^";s:3:"_";s:1:"_";s:3:"`";s:1:"`";s:3:"a";s:1:"a";s:3:"b";s:1:"b";s:3:"c";s:1:"c";s:3:"d";s:1:"d";s:3:"e";s:1:"e";s:3:"f";s:1:"f";s:3:"g";s:1:"g";s:3:"h";s:1:"h";s:3:"i";s:1:"i";s:3:"j";s:1:"j";s:3:"k";s:1:"k";s:3:"l";s:1:"l";s:3:"m";s:1:"m";s:3:"n";s:1:"n";s:3:"o";s:1:"o";s:3:"p";s:1:"p";s:3:"q";s:1:"q";s:3:"r";s:1:"r";s:3:"s";s:1:"s";s:3:"t";s:1:"t";s:3:"u";s:1:"u";s:3:"v";s:1:"v";s:3:"w";s:1:"w";s:3:"x";s:1:"x";s:3:"y";s:1:"y";s:3:"z";s:1:"z";s:3:"{";s:1:"{";s:3:"|";s:1:"|";s:3:"}";s:1:"}";s:3:"~";s:1:"~";s:3:"⦅";s:3:"⦅";s:3:"⦆";s:3:"⦆";s:3:"。";s:3:"。";s:3:"「";s:3:"「";s:3:"」";s:3:"」";s:3:"、";s:3:"、";s:3:"・";s:3:"・";s:3:"ヲ";s:3:"ヲ";s:3:"ァ";s:3:"ァ";s:3:"ィ";s:3:"ィ";s:3:"ゥ";s:3:"ゥ";s:3:"ェ";s:3:"ェ";s:3:"ォ";s:3:"ォ";s:3:"ャ";s:3:"ャ";s:3:"ュ";s:3:"ュ";s:3:"ョ";s:3:"ョ";s:3:"ッ";s:3:"ッ";s:3:"ー";s:3:"ー";s:3:"ア";s:3:"ア";s:3:"イ";s:3:"イ";s:3:"ウ";s:3:"ウ";s:3:"エ";s:3:"エ";s:3:"オ";s:3:"オ";s:3:"カ";s:3:"カ";s:3:"キ";s:3:"キ";s:3:"ク";s:3:"ク";s:3:"ケ";s:3:"ケ";s:3:"コ";s:3:"コ";s:3:"サ";s:3:"サ";s:3:"シ";s:3:"シ";s:3:"ス";s:3:"ス";s:3:"セ";s:3:"セ";s:3:"ソ";s:3:"ソ";s:3:"タ";s:3:"タ";s:3:"チ";s:3:"チ";s:3:"ツ";s:3:"ツ";s:3:"テ";s:3:"テ";s:3:"ト";s:3:"ト";s:3:"ナ";s:3:"ナ";s:3:"ニ";s:3:"ニ";s:3:"ヌ";s:3:"ヌ";s:3:"ネ";s:3:"ネ";s:3:"ノ";s:3:"ノ";s:3:"ハ";s:3:"ハ";s:3:"ヒ";s:3:"ヒ";s:3:"フ";s:3:"フ";s:3:"ヘ";s:3:"ヘ";s:3:"ホ";s:3:"ホ";s:3:"マ";s:3:"マ";s:3:"ミ";s:3:"ミ";s:3:"ム";s:3:"ム";s:3:"メ";s:3:"メ";s:3:"モ";s:3:"モ";s:3:"ヤ";s:3:"ヤ";s:3:"ユ";s:3:"ユ";s:3:"ヨ";s:3:"ヨ";s:3:"ラ";s:3:"ラ";s:3:"リ";s:3:"リ";s:3:"ル";s:3:"ル";s:3:"レ";s:3:"レ";s:3:"ロ";s:3:"ロ";s:3:"ワ";s:3:"ワ";s:3:"ン";s:3:"ン";s:3:"゙";s:3:"゙";s:3:"゚";s:3:"゚";s:3:"ᅠ";s:3:"ᅠ";s:3:"ᄀ";s:3:"ᄀ";s:3:"ᄁ";s:3:"ᄁ";s:3:"ᆪ";s:3:"ᆪ";s:3:"ᄂ";s:3:"ᄂ";s:3:"ᆬ";s:3:"ᆬ";s:3:"ᆭ";s:3:"ᆭ";s:3:"ᄃ";s:3:"ᄃ";s:3:"ᄄ";s:3:"ᄄ";s:3:"ᄅ";s:3:"ᄅ";s:3:"ᆰ";s:3:"ᆰ";s:3:"ᆱ";s:3:"ᆱ";s:3:"ᆲ";s:3:"ᆲ";s:3:"ᆳ";s:3:"ᆳ";s:3:"ᆴ";s:3:"ᆴ";s:3:"ᆵ";s:3:"ᆵ";s:3:"ᄚ";s:3:"ᄚ";s:3:"ᄆ";s:3:"ᄆ";s:3:"ᄇ";s:3:"ᄇ";s:3:"ᄈ";s:3:"ᄈ";s:3:"ᄡ";s:3:"ᄡ";s:3:"ᄉ";s:3:"ᄉ";s:3:"ᄊ";s:3:"ᄊ";s:3:"ᄋ";s:3:"ᄋ";s:3:"ᄌ";s:3:"ᄌ";s:3:"ᄍ";s:3:"ᄍ";s:3:"ᄎ";s:3:"ᄎ";s:3:"ᄏ";s:3:"ᄏ";s:3:"ᄐ";s:3:"ᄐ";s:3:"ᄑ";s:3:"ᄑ";s:3:"ᄒ";s:3:"ᄒ";s:3:"ᅡ";s:3:"ᅡ";s:3:"ᅢ";s:3:"ᅢ";s:3:"ᅣ";s:3:"ᅣ";s:3:"ᅤ";s:3:"ᅤ";s:3:"ᅥ";s:3:"ᅥ";s:3:"ᅦ";s:3:"ᅦ";s:3:"ᅧ";s:3:"ᅧ";s:3:"ᅨ";s:3:"ᅨ";s:3:"ᅩ";s:3:"ᅩ";s:3:"ᅪ";s:3:"ᅪ";s:3:"ᅫ";s:3:"ᅫ";s:3:"ᅬ";s:3:"ᅬ";s:3:"ᅭ";s:3:"ᅭ";s:3:"ᅮ";s:3:"ᅮ";s:3:"ᅯ";s:3:"ᅯ";s:3:"ᅰ";s:3:"ᅰ";s:3:"ᅱ";s:3:"ᅱ";s:3:"ᅲ";s:3:"ᅲ";s:3:"ᅳ";s:3:"ᅳ";s:3:"ᅴ";s:3:"ᅴ";s:3:"ᅵ";s:3:"ᅵ";s:3:"¢";s:2:"¢";s:3:"£";s:2:"£";s:3:"¬";s:2:"¬";s:3:" ̄";s:3:" ̄";s:3:"¦";s:2:"¦";s:3:"¥";s:2:"¥";s:3:"₩";s:3:"₩";s:3:"│";s:3:"│";s:3:"←";s:3:"←";s:3:"↑";s:3:"↑";s:3:"→";s:3:"→";s:3:"↓";s:3:"↓";s:3:"■";s:3:"■";s:3:"○";s:3:"○";s:4:"𝐀";s:1:"A";s:4:"𝐁";s:1:"B";s:4:"𝐂";s:1:"C";s:4:"𝐃";s:1:"D";s:4:"𝐄";s:1:"E";s:4:"𝐅";s:1:"F";s:4:"𝐆";s:1:"G";s:4:"𝐇";s:1:"H";s:4:"𝐈";s:1:"I";s:4:"𝐉";s:1:"J";s:4:"𝐊";s:1:"K";s:4:"𝐋";s:1:"L";s:4:"𝐌";s:1:"M";s:4:"𝐍";s:1:"N";s:4:"𝐎";s:1:"O";s:4:"𝐏";s:1:"P";s:4:"𝐐";s:1:"Q";s:4:"𝐑";s:1:"R";s:4:"𝐒";s:1:"S";s:4:"𝐓";s:1:"T";s:4:"𝐔";s:1:"U";s:4:"𝐕";s:1:"V";s:4:"𝐖";s:1:"W";s:4:"𝐗";s:1:"X";s:4:"𝐘";s:1:"Y";s:4:"𝐙";s:1:"Z";s:4:"𝐚";s:1:"a";s:4:"𝐛";s:1:"b";s:4:"𝐜";s:1:"c";s:4:"𝐝";s:1:"d";s:4:"𝐞";s:1:"e";s:4:"𝐟";s:1:"f";s:4:"𝐠";s:1:"g";s:4:"𝐡";s:1:"h";s:4:"𝐢";s:1:"i";s:4:"𝐣";s:1:"j";s:4:"𝐤";s:1:"k";s:4:"𝐥";s:1:"l";s:4:"𝐦";s:1:"m";s:4:"𝐧";s:1:"n";s:4:"𝐨";s:1:"o";s:4:"𝐩";s:1:"p";s:4:"𝐪";s:1:"q";s:4:"𝐫";s:1:"r";s:4:"𝐬";s:1:"s";s:4:"𝐭";s:1:"t";s:4:"𝐮";s:1:"u";s:4:"𝐯";s:1:"v";s:4:"𝐰";s:1:"w";s:4:"𝐱";s:1:"x";s:4:"𝐲";s:1:"y";s:4:"𝐳";s:1:"z";s:4:"𝐴";s:1:"A";s:4:"𝐵";s:1:"B";s:4:"𝐶";s:1:"C";s:4:"𝐷";s:1:"D";s:4:"𝐸";s:1:"E";s:4:"𝐹";s:1:"F";s:4:"𝐺";s:1:"G";s:4:"𝐻";s:1:"H";s:4:"𝐼";s:1:"I";s:4:"𝐽";s:1:"J";s:4:"𝐾";s:1:"K";s:4:"𝐿";s:1:"L";s:4:"𝑀";s:1:"M";s:4:"𝑁";s:1:"N";s:4:"𝑂";s:1:"O";s:4:"𝑃";s:1:"P";s:4:"𝑄";s:1:"Q";s:4:"𝑅";s:1:"R";s:4:"𝑆";s:1:"S";s:4:"𝑇";s:1:"T";s:4:"𝑈";s:1:"U";s:4:"𝑉";s:1:"V";s:4:"𝑊";s:1:"W";s:4:"𝑋";s:1:"X";s:4:"𝑌";s:1:"Y";s:4:"𝑍";s:1:"Z";s:4:"𝑎";s:1:"a";s:4:"𝑏";s:1:"b";s:4:"𝑐";s:1:"c";s:4:"𝑑";s:1:"d";s:4:"𝑒";s:1:"e";s:4:"𝑓";s:1:"f";s:4:"𝑔";s:1:"g";s:4:"𝑖";s:1:"i";s:4:"𝑗";s:1:"j";s:4:"𝑘";s:1:"k";s:4:"𝑙";s:1:"l";s:4:"𝑚";s:1:"m";s:4:"𝑛";s:1:"n";s:4:"𝑜";s:1:"o";s:4:"𝑝";s:1:"p";s:4:"𝑞";s:1:"q";s:4:"𝑟";s:1:"r";s:4:"𝑠";s:1:"s";s:4:"𝑡";s:1:"t";s:4:"𝑢";s:1:"u";s:4:"𝑣";s:1:"v";s:4:"𝑤";s:1:"w";s:4:"𝑥";s:1:"x";s:4:"𝑦";s:1:"y";s:4:"𝑧";s:1:"z";s:4:"𝑨";s:1:"A";s:4:"𝑩";s:1:"B";s:4:"𝑪";s:1:"C";s:4:"𝑫";s:1:"D";s:4:"𝑬";s:1:"E";s:4:"𝑭";s:1:"F";s:4:"𝑮";s:1:"G";s:4:"𝑯";s:1:"H";s:4:"𝑰";s:1:"I";s:4:"𝑱";s:1:"J";s:4:"𝑲";s:1:"K";s:4:"𝑳";s:1:"L";s:4:"𝑴";s:1:"M";s:4:"𝑵";s:1:"N";s:4:"𝑶";s:1:"O";s:4:"𝑷";s:1:"P";s:4:"𝑸";s:1:"Q";s:4:"𝑹";s:1:"R";s:4:"𝑺";s:1:"S";s:4:"𝑻";s:1:"T";s:4:"𝑼";s:1:"U";s:4:"𝑽";s:1:"V";s:4:"𝑾";s:1:"W";s:4:"𝑿";s:1:"X";s:4:"𝒀";s:1:"Y";s:4:"𝒁";s:1:"Z";s:4:"𝒂";s:1:"a";s:4:"𝒃";s:1:"b";s:4:"𝒄";s:1:"c";s:4:"𝒅";s:1:"d";s:4:"𝒆";s:1:"e";s:4:"𝒇";s:1:"f";s:4:"𝒈";s:1:"g";s:4:"𝒉";s:1:"h";s:4:"𝒊";s:1:"i";s:4:"𝒋";s:1:"j";s:4:"𝒌";s:1:"k";s:4:"𝒍";s:1:"l";s:4:"𝒎";s:1:"m";s:4:"𝒏";s:1:"n";s:4:"𝒐";s:1:"o";s:4:"𝒑";s:1:"p";s:4:"𝒒";s:1:"q";s:4:"𝒓";s:1:"r";s:4:"𝒔";s:1:"s";s:4:"𝒕";s:1:"t";s:4:"𝒖";s:1:"u";s:4:"𝒗";s:1:"v";s:4:"𝒘";s:1:"w";s:4:"𝒙";s:1:"x";s:4:"𝒚";s:1:"y";s:4:"𝒛";s:1:"z";s:4:"𝒜";s:1:"A";s:4:"𝒞";s:1:"C";s:4:"𝒟";s:1:"D";s:4:"𝒢";s:1:"G";s:4:"𝒥";s:1:"J";s:4:"𝒦";s:1:"K";s:4:"𝒩";s:1:"N";s:4:"𝒪";s:1:"O";s:4:"𝒫";s:1:"P";s:4:"𝒬";s:1:"Q";s:4:"𝒮";s:1:"S";s:4:"𝒯";s:1:"T";s:4:"𝒰";s:1:"U";s:4:"𝒱";s:1:"V";s:4:"𝒲";s:1:"W";s:4:"𝒳";s:1:"X";s:4:"𝒴";s:1:"Y";s:4:"𝒵";s:1:"Z";s:4:"𝒶";s:1:"a";s:4:"𝒷";s:1:"b";s:4:"𝒸";s:1:"c";s:4:"𝒹";s:1:"d";s:4:"𝒻";s:1:"f";s:4:"𝒽";s:1:"h";s:4:"𝒾";s:1:"i";s:4:"𝒿";s:1:"j";s:4:"𝓀";s:1:"k";s:4:"𝓁";s:1:"l";s:4:"𝓂";s:1:"m";s:4:"𝓃";s:1:"n";s:4:"𝓅";s:1:"p";s:4:"𝓆";s:1:"q";s:4:"𝓇";s:1:"r";s:4:"𝓈";s:1:"s";s:4:"𝓉";s:1:"t";s:4:"𝓊";s:1:"u";s:4:"𝓋";s:1:"v";s:4:"𝓌";s:1:"w";s:4:"𝓍";s:1:"x";s:4:"𝓎";s:1:"y";s:4:"𝓏";s:1:"z";s:4:"𝓐";s:1:"A";s:4:"𝓑";s:1:"B";s:4:"𝓒";s:1:"C";s:4:"𝓓";s:1:"D";s:4:"𝓔";s:1:"E";s:4:"𝓕";s:1:"F";s:4:"𝓖";s:1:"G";s:4:"𝓗";s:1:"H";s:4:"𝓘";s:1:"I";s:4:"𝓙";s:1:"J";s:4:"𝓚";s:1:"K";s:4:"𝓛";s:1:"L";s:4:"𝓜";s:1:"M";s:4:"𝓝";s:1:"N";s:4:"𝓞";s:1:"O";s:4:"𝓟";s:1:"P";s:4:"𝓠";s:1:"Q";s:4:"𝓡";s:1:"R";s:4:"𝓢";s:1:"S";s:4:"𝓣";s:1:"T";s:4:"𝓤";s:1:"U";s:4:"𝓥";s:1:"V";s:4:"𝓦";s:1:"W";s:4:"𝓧";s:1:"X";s:4:"𝓨";s:1:"Y";s:4:"𝓩";s:1:"Z";s:4:"𝓪";s:1:"a";s:4:"𝓫";s:1:"b";s:4:"𝓬";s:1:"c";s:4:"𝓭";s:1:"d";s:4:"𝓮";s:1:"e";s:4:"𝓯";s:1:"f";s:4:"𝓰";s:1:"g";s:4:"𝓱";s:1:"h";s:4:"𝓲";s:1:"i";s:4:"𝓳";s:1:"j";s:4:"𝓴";s:1:"k";s:4:"𝓵";s:1:"l";s:4:"𝓶";s:1:"m";s:4:"𝓷";s:1:"n";s:4:"𝓸";s:1:"o";s:4:"𝓹";s:1:"p";s:4:"𝓺";s:1:"q";s:4:"𝓻";s:1:"r";s:4:"𝓼";s:1:"s";s:4:"𝓽";s:1:"t";s:4:"𝓾";s:1:"u";s:4:"𝓿";s:1:"v";s:4:"𝔀";s:1:"w";s:4:"𝔁";s:1:"x";s:4:"𝔂";s:1:"y";s:4:"𝔃";s:1:"z";s:4:"𝔄";s:1:"A";s:4:"𝔅";s:1:"B";s:4:"𝔇";s:1:"D";s:4:"𝔈";s:1:"E";s:4:"𝔉";s:1:"F";s:4:"𝔊";s:1:"G";s:4:"𝔍";s:1:"J";s:4:"𝔎";s:1:"K";s:4:"𝔏";s:1:"L";s:4:"𝔐";s:1:"M";s:4:"𝔑";s:1:"N";s:4:"𝔒";s:1:"O";s:4:"𝔓";s:1:"P";s:4:"𝔔";s:1:"Q";s:4:"𝔖";s:1:"S";s:4:"𝔗";s:1:"T";s:4:"𝔘";s:1:"U";s:4:"𝔙";s:1:"V";s:4:"𝔚";s:1:"W";s:4:"𝔛";s:1:"X";s:4:"𝔜";s:1:"Y";s:4:"𝔞";s:1:"a";s:4:"𝔟";s:1:"b";s:4:"𝔠";s:1:"c";s:4:"𝔡";s:1:"d";s:4:"𝔢";s:1:"e";s:4:"𝔣";s:1:"f";s:4:"𝔤";s:1:"g";s:4:"𝔥";s:1:"h";s:4:"𝔦";s:1:"i";s:4:"𝔧";s:1:"j";s:4:"𝔨";s:1:"k";s:4:"𝔩";s:1:"l";s:4:"𝔪";s:1:"m";s:4:"𝔫";s:1:"n";s:4:"𝔬";s:1:"o";s:4:"𝔭";s:1:"p";s:4:"𝔮";s:1:"q";s:4:"𝔯";s:1:"r";s:4:"𝔰";s:1:"s";s:4:"𝔱";s:1:"t";s:4:"𝔲";s:1:"u";s:4:"𝔳";s:1:"v";s:4:"𝔴";s:1:"w";s:4:"𝔵";s:1:"x";s:4:"𝔶";s:1:"y";s:4:"𝔷";s:1:"z";s:4:"𝔸";s:1:"A";s:4:"𝔹";s:1:"B";s:4:"𝔻";s:1:"D";s:4:"𝔼";s:1:"E";s:4:"𝔽";s:1:"F";s:4:"𝔾";s:1:"G";s:4:"𝕀";s:1:"I";s:4:"𝕁";s:1:"J";s:4:"𝕂";s:1:"K";s:4:"𝕃";s:1:"L";s:4:"𝕄";s:1:"M";s:4:"𝕆";s:1:"O";s:4:"𝕊";s:1:"S";s:4:"𝕋";s:1:"T";s:4:"𝕌";s:1:"U";s:4:"𝕍";s:1:"V";s:4:"𝕎";s:1:"W";s:4:"𝕏";s:1:"X";s:4:"𝕐";s:1:"Y";s:4:"𝕒";s:1:"a";s:4:"𝕓";s:1:"b";s:4:"𝕔";s:1:"c";s:4:"𝕕";s:1:"d";s:4:"𝕖";s:1:"e";s:4:"𝕗";s:1:"f";s:4:"𝕘";s:1:"g";s:4:"𝕙";s:1:"h";s:4:"𝕚";s:1:"i";s:4:"𝕛";s:1:"j";s:4:"𝕜";s:1:"k";s:4:"𝕝";s:1:"l";s:4:"𝕞";s:1:"m";s:4:"𝕟";s:1:"n";s:4:"𝕠";s:1:"o";s:4:"𝕡";s:1:"p";s:4:"𝕢";s:1:"q";s:4:"𝕣";s:1:"r";s:4:"𝕤";s:1:"s";s:4:"𝕥";s:1:"t";s:4:"𝕦";s:1:"u";s:4:"𝕧";s:1:"v";s:4:"𝕨";s:1:"w";s:4:"𝕩";s:1:"x";s:4:"𝕪";s:1:"y";s:4:"𝕫";s:1:"z";s:4:"𝕬";s:1:"A";s:4:"𝕭";s:1:"B";s:4:"𝕮";s:1:"C";s:4:"𝕯";s:1:"D";s:4:"𝕰";s:1:"E";s:4:"𝕱";s:1:"F";s:4:"𝕲";s:1:"G";s:4:"𝕳";s:1:"H";s:4:"𝕴";s:1:"I";s:4:"𝕵";s:1:"J";s:4:"𝕶";s:1:"K";s:4:"𝕷";s:1:"L";s:4:"𝕸";s:1:"M";s:4:"𝕹";s:1:"N";s:4:"𝕺";s:1:"O";s:4:"𝕻";s:1:"P";s:4:"𝕼";s:1:"Q";s:4:"𝕽";s:1:"R";s:4:"𝕾";s:1:"S";s:4:"𝕿";s:1:"T";s:4:"𝖀";s:1:"U";s:4:"𝖁";s:1:"V";s:4:"𝖂";s:1:"W";s:4:"𝖃";s:1:"X";s:4:"𝖄";s:1:"Y";s:4:"𝖅";s:1:"Z";s:4:"𝖆";s:1:"a";s:4:"𝖇";s:1:"b";s:4:"𝖈";s:1:"c";s:4:"𝖉";s:1:"d";s:4:"𝖊";s:1:"e";s:4:"𝖋";s:1:"f";s:4:"𝖌";s:1:"g";s:4:"𝖍";s:1:"h";s:4:"𝖎";s:1:"i";s:4:"𝖏";s:1:"j";s:4:"𝖐";s:1:"k";s:4:"𝖑";s:1:"l";s:4:"𝖒";s:1:"m";s:4:"𝖓";s:1:"n";s:4:"𝖔";s:1:"o";s:4:"𝖕";s:1:"p";s:4:"𝖖";s:1:"q";s:4:"𝖗";s:1:"r";s:4:"𝖘";s:1:"s";s:4:"𝖙";s:1:"t";s:4:"𝖚";s:1:"u";s:4:"𝖛";s:1:"v";s:4:"𝖜";s:1:"w";s:4:"𝖝";s:1:"x";s:4:"𝖞";s:1:"y";s:4:"𝖟";s:1:"z";s:4:"𝖠";s:1:"A";s:4:"𝖡";s:1:"B";s:4:"𝖢";s:1:"C";s:4:"𝖣";s:1:"D";s:4:"𝖤";s:1:"E";s:4:"𝖥";s:1:"F";s:4:"𝖦";s:1:"G";s:4:"𝖧";s:1:"H";s:4:"𝖨";s:1:"I";s:4:"𝖩";s:1:"J";s:4:"𝖪";s:1:"K";s:4:"𝖫";s:1:"L";s:4:"𝖬";s:1:"M";s:4:"𝖭";s:1:"N";s:4:"𝖮";s:1:"O";s:4:"𝖯";s:1:"P";s:4:"𝖰";s:1:"Q";s:4:"𝖱";s:1:"R";s:4:"𝖲";s:1:"S";s:4:"𝖳";s:1:"T";s:4:"𝖴";s:1:"U";s:4:"𝖵";s:1:"V";s:4:"𝖶";s:1:"W";s:4:"𝖷";s:1:"X";s:4:"𝖸";s:1:"Y";s:4:"𝖹";s:1:"Z";s:4:"𝖺";s:1:"a";s:4:"𝖻";s:1:"b";s:4:"𝖼";s:1:"c";s:4:"𝖽";s:1:"d";s:4:"𝖾";s:1:"e";s:4:"𝖿";s:1:"f";s:4:"𝗀";s:1:"g";s:4:"𝗁";s:1:"h";s:4:"𝗂";s:1:"i";s:4:"𝗃";s:1:"j";s:4:"𝗄";s:1:"k";s:4:"𝗅";s:1:"l";s:4:"𝗆";s:1:"m";s:4:"𝗇";s:1:"n";s:4:"𝗈";s:1:"o";s:4:"𝗉";s:1:"p";s:4:"𝗊";s:1:"q";s:4:"𝗋";s:1:"r";s:4:"𝗌";s:1:"s";s:4:"𝗍";s:1:"t";s:4:"𝗎";s:1:"u";s:4:"𝗏";s:1:"v";s:4:"𝗐";s:1:"w";s:4:"𝗑";s:1:"x";s:4:"𝗒";s:1:"y";s:4:"𝗓";s:1:"z";s:4:"𝗔";s:1:"A";s:4:"𝗕";s:1:"B";s:4:"𝗖";s:1:"C";s:4:"𝗗";s:1:"D";s:4:"𝗘";s:1:"E";s:4:"𝗙";s:1:"F";s:4:"𝗚";s:1:"G";s:4:"𝗛";s:1:"H";s:4:"𝗜";s:1:"I";s:4:"𝗝";s:1:"J";s:4:"𝗞";s:1:"K";s:4:"𝗟";s:1:"L";s:4:"𝗠";s:1:"M";s:4:"𝗡";s:1:"N";s:4:"𝗢";s:1:"O";s:4:"𝗣";s:1:"P";s:4:"𝗤";s:1:"Q";s:4:"𝗥";s:1:"R";s:4:"𝗦";s:1:"S";s:4:"𝗧";s:1:"T";s:4:"𝗨";s:1:"U";s:4:"𝗩";s:1:"V";s:4:"𝗪";s:1:"W";s:4:"𝗫";s:1:"X";s:4:"𝗬";s:1:"Y";s:4:"𝗭";s:1:"Z";s:4:"𝗮";s:1:"a";s:4:"𝗯";s:1:"b";s:4:"𝗰";s:1:"c";s:4:"𝗱";s:1:"d";s:4:"𝗲";s:1:"e";s:4:"𝗳";s:1:"f";s:4:"𝗴";s:1:"g";s:4:"𝗵";s:1:"h";s:4:"𝗶";s:1:"i";s:4:"𝗷";s:1:"j";s:4:"𝗸";s:1:"k";s:4:"𝗹";s:1:"l";s:4:"𝗺";s:1:"m";s:4:"𝗻";s:1:"n";s:4:"𝗼";s:1:"o";s:4:"𝗽";s:1:"p";s:4:"𝗾";s:1:"q";s:4:"𝗿";s:1:"r";s:4:"𝘀";s:1:"s";s:4:"𝘁";s:1:"t";s:4:"𝘂";s:1:"u";s:4:"𝘃";s:1:"v";s:4:"𝘄";s:1:"w";s:4:"𝘅";s:1:"x";s:4:"𝘆";s:1:"y";s:4:"𝘇";s:1:"z";s:4:"𝘈";s:1:"A";s:4:"𝘉";s:1:"B";s:4:"𝘊";s:1:"C";s:4:"𝘋";s:1:"D";s:4:"𝘌";s:1:"E";s:4:"𝘍";s:1:"F";s:4:"𝘎";s:1:"G";s:4:"𝘏";s:1:"H";s:4:"𝘐";s:1:"I";s:4:"𝘑";s:1:"J";s:4:"𝘒";s:1:"K";s:4:"𝘓";s:1:"L";s:4:"𝘔";s:1:"M";s:4:"𝘕";s:1:"N";s:4:"𝘖";s:1:"O";s:4:"𝘗";s:1:"P";s:4:"𝘘";s:1:"Q";s:4:"𝘙";s:1:"R";s:4:"𝘚";s:1:"S";s:4:"𝘛";s:1:"T";s:4:"𝘜";s:1:"U";s:4:"𝘝";s:1:"V";s:4:"𝘞";s:1:"W";s:4:"𝘟";s:1:"X";s:4:"𝘠";s:1:"Y";s:4:"𝘡";s:1:"Z";s:4:"𝘢";s:1:"a";s:4:"𝘣";s:1:"b";s:4:"𝘤";s:1:"c";s:4:"𝘥";s:1:"d";s:4:"𝘦";s:1:"e";s:4:"𝘧";s:1:"f";s:4:"𝘨";s:1:"g";s:4:"𝘩";s:1:"h";s:4:"𝘪";s:1:"i";s:4:"𝘫";s:1:"j";s:4:"𝘬";s:1:"k";s:4:"𝘭";s:1:"l";s:4:"𝘮";s:1:"m";s:4:"𝘯";s:1:"n";s:4:"𝘰";s:1:"o";s:4:"𝘱";s:1:"p";s:4:"𝘲";s:1:"q";s:4:"𝘳";s:1:"r";s:4:"𝘴";s:1:"s";s:4:"𝘵";s:1:"t";s:4:"𝘶";s:1:"u";s:4:"𝘷";s:1:"v";s:4:"𝘸";s:1:"w";s:4:"𝘹";s:1:"x";s:4:"𝘺";s:1:"y";s:4:"𝘻";s:1:"z";s:4:"𝘼";s:1:"A";s:4:"𝘽";s:1:"B";s:4:"𝘾";s:1:"C";s:4:"𝘿";s:1:"D";s:4:"𝙀";s:1:"E";s:4:"𝙁";s:1:"F";s:4:"𝙂";s:1:"G";s:4:"𝙃";s:1:"H";s:4:"𝙄";s:1:"I";s:4:"𝙅";s:1:"J";s:4:"𝙆";s:1:"K";s:4:"𝙇";s:1:"L";s:4:"𝙈";s:1:"M";s:4:"𝙉";s:1:"N";s:4:"𝙊";s:1:"O";s:4:"𝙋";s:1:"P";s:4:"𝙌";s:1:"Q";s:4:"𝙍";s:1:"R";s:4:"𝙎";s:1:"S";s:4:"𝙏";s:1:"T";s:4:"𝙐";s:1:"U";s:4:"𝙑";s:1:"V";s:4:"𝙒";s:1:"W";s:4:"𝙓";s:1:"X";s:4:"𝙔";s:1:"Y";s:4:"𝙕";s:1:"Z";s:4:"𝙖";s:1:"a";s:4:"𝙗";s:1:"b";s:4:"𝙘";s:1:"c";s:4:"𝙙";s:1:"d";s:4:"𝙚";s:1:"e";s:4:"𝙛";s:1:"f";s:4:"𝙜";s:1:"g";s:4:"𝙝";s:1:"h";s:4:"𝙞";s:1:"i";s:4:"𝙟";s:1:"j";s:4:"𝙠";s:1:"k";s:4:"𝙡";s:1:"l";s:4:"𝙢";s:1:"m";s:4:"𝙣";s:1:"n";s:4:"𝙤";s:1:"o";s:4:"𝙥";s:1:"p";s:4:"𝙦";s:1:"q";s:4:"𝙧";s:1:"r";s:4:"𝙨";s:1:"s";s:4:"𝙩";s:1:"t";s:4:"𝙪";s:1:"u";s:4:"𝙫";s:1:"v";s:4:"𝙬";s:1:"w";s:4:"𝙭";s:1:"x";s:4:"𝙮";s:1:"y";s:4:"𝙯";s:1:"z";s:4:"𝙰";s:1:"A";s:4:"𝙱";s:1:"B";s:4:"𝙲";s:1:"C";s:4:"𝙳";s:1:"D";s:4:"𝙴";s:1:"E";s:4:"𝙵";s:1:"F";s:4:"𝙶";s:1:"G";s:4:"𝙷";s:1:"H";s:4:"𝙸";s:1:"I";s:4:"𝙹";s:1:"J";s:4:"𝙺";s:1:"K";s:4:"𝙻";s:1:"L";s:4:"𝙼";s:1:"M";s:4:"𝙽";s:1:"N";s:4:"𝙾";s:1:"O";s:4:"𝙿";s:1:"P";s:4:"𝚀";s:1:"Q";s:4:"𝚁";s:1:"R";s:4:"𝚂";s:1:"S";s:4:"𝚃";s:1:"T";s:4:"𝚄";s:1:"U";s:4:"𝚅";s:1:"V";s:4:"𝚆";s:1:"W";s:4:"𝚇";s:1:"X";s:4:"𝚈";s:1:"Y";s:4:"𝚉";s:1:"Z";s:4:"𝚊";s:1:"a";s:4:"𝚋";s:1:"b";s:4:"𝚌";s:1:"c";s:4:"𝚍";s:1:"d";s:4:"𝚎";s:1:"e";s:4:"𝚏";s:1:"f";s:4:"𝚐";s:1:"g";s:4:"𝚑";s:1:"h";s:4:"𝚒";s:1:"i";s:4:"𝚓";s:1:"j";s:4:"𝚔";s:1:"k";s:4:"𝚕";s:1:"l";s:4:"𝚖";s:1:"m";s:4:"𝚗";s:1:"n";s:4:"𝚘";s:1:"o";s:4:"𝚙";s:1:"p";s:4:"𝚚";s:1:"q";s:4:"𝚛";s:1:"r";s:4:"𝚜";s:1:"s";s:4:"𝚝";s:1:"t";s:4:"𝚞";s:1:"u";s:4:"𝚟";s:1:"v";s:4:"𝚠";s:1:"w";s:4:"𝚡";s:1:"x";s:4:"𝚢";s:1:"y";s:4:"𝚣";s:1:"z";s:4:"𝚤";s:2:"ı";s:4:"𝚥";s:2:"ȷ";s:4:"𝚨";s:2:"Α";s:4:"𝚩";s:2:"Β";s:4:"𝚪";s:2:"Γ";s:4:"𝚫";s:2:"Δ";s:4:"𝚬";s:2:"Ε";s:4:"𝚭";s:2:"Ζ";s:4:"𝚮";s:2:"Η";s:4:"𝚯";s:2:"Θ";s:4:"𝚰";s:2:"Ι";s:4:"𝚱";s:2:"Κ";s:4:"𝚲";s:2:"Λ";s:4:"𝚳";s:2:"Μ";s:4:"𝚴";s:2:"Ν";s:4:"𝚵";s:2:"Ξ";s:4:"𝚶";s:2:"Ο";s:4:"𝚷";s:2:"Π";s:4:"𝚸";s:2:"Ρ";s:4:"𝚹";s:2:"Θ";s:4:"𝚺";s:2:"Σ";s:4:"𝚻";s:2:"Τ";s:4:"𝚼";s:2:"Υ";s:4:"𝚽";s:2:"Φ";s:4:"𝚾";s:2:"Χ";s:4:"𝚿";s:2:"Ψ";s:4:"𝛀";s:2:"Ω";s:4:"𝛁";s:3:"∇";s:4:"𝛂";s:2:"α";s:4:"𝛃";s:2:"β";s:4:"𝛄";s:2:"γ";s:4:"𝛅";s:2:"δ";s:4:"𝛆";s:2:"ε";s:4:"𝛇";s:2:"ζ";s:4:"𝛈";s:2:"η";s:4:"𝛉";s:2:"θ";s:4:"𝛊";s:2:"ι";s:4:"𝛋";s:2:"κ";s:4:"𝛌";s:2:"λ";s:4:"𝛍";s:2:"μ";s:4:"𝛎";s:2:"ν";s:4:"𝛏";s:2:"ξ";s:4:"𝛐";s:2:"ο";s:4:"𝛑";s:2:"π";s:4:"𝛒";s:2:"ρ";s:4:"𝛓";s:2:"ς";s:4:"𝛔";s:2:"σ";s:4:"𝛕";s:2:"τ";s:4:"𝛖";s:2:"υ";s:4:"𝛗";s:2:"φ";s:4:"𝛘";s:2:"χ";s:4:"𝛙";s:2:"ψ";s:4:"𝛚";s:2:"ω";s:4:"𝛛";s:3:"∂";s:4:"𝛜";s:2:"ε";s:4:"𝛝";s:2:"θ";s:4:"𝛞";s:2:"κ";s:4:"𝛟";s:2:"φ";s:4:"𝛠";s:2:"ρ";s:4:"𝛡";s:2:"π";s:4:"𝛢";s:2:"Α";s:4:"𝛣";s:2:"Β";s:4:"𝛤";s:2:"Γ";s:4:"𝛥";s:2:"Δ";s:4:"𝛦";s:2:"Ε";s:4:"𝛧";s:2:"Ζ";s:4:"𝛨";s:2:"Η";s:4:"𝛩";s:2:"Θ";s:4:"𝛪";s:2:"Ι";s:4:"𝛫";s:2:"Κ";s:4:"𝛬";s:2:"Λ";s:4:"𝛭";s:2:"Μ";s:4:"𝛮";s:2:"Ν";s:4:"𝛯";s:2:"Ξ";s:4:"𝛰";s:2:"Ο";s:4:"𝛱";s:2:"Π";s:4:"𝛲";s:2:"Ρ";s:4:"𝛳";s:2:"Θ";s:4:"𝛴";s:2:"Σ";s:4:"𝛵";s:2:"Τ";s:4:"𝛶";s:2:"Υ";s:4:"𝛷";s:2:"Φ";s:4:"𝛸";s:2:"Χ";s:4:"𝛹";s:2:"Ψ";s:4:"𝛺";s:2:"Ω";s:4:"𝛻";s:3:"∇";s:4:"𝛼";s:2:"α";s:4:"𝛽";s:2:"β";s:4:"𝛾";s:2:"γ";s:4:"𝛿";s:2:"δ";s:4:"𝜀";s:2:"ε";s:4:"𝜁";s:2:"ζ";s:4:"𝜂";s:2:"η";s:4:"𝜃";s:2:"θ";s:4:"𝜄";s:2:"ι";s:4:"𝜅";s:2:"κ";s:4:"𝜆";s:2:"λ";s:4:"𝜇";s:2:"μ";s:4:"𝜈";s:2:"ν";s:4:"𝜉";s:2:"ξ";s:4:"𝜊";s:2:"ο";s:4:"𝜋";s:2:"π";s:4:"𝜌";s:2:"ρ";s:4:"𝜍";s:2:"ς";s:4:"𝜎";s:2:"σ";s:4:"𝜏";s:2:"τ";s:4:"𝜐";s:2:"υ";s:4:"𝜑";s:2:"φ";s:4:"𝜒";s:2:"χ";s:4:"𝜓";s:2:"ψ";s:4:"𝜔";s:2:"ω";s:4:"𝜕";s:3:"∂";s:4:"𝜖";s:2:"ε";s:4:"𝜗";s:2:"θ";s:4:"𝜘";s:2:"κ";s:4:"𝜙";s:2:"φ";s:4:"𝜚";s:2:"ρ";s:4:"𝜛";s:2:"π";s:4:"𝜜";s:2:"Α";s:4:"𝜝";s:2:"Β";s:4:"𝜞";s:2:"Γ";s:4:"𝜟";s:2:"Δ";s:4:"𝜠";s:2:"Ε";s:4:"𝜡";s:2:"Ζ";s:4:"𝜢";s:2:"Η";s:4:"𝜣";s:2:"Θ";s:4:"𝜤";s:2:"Ι";s:4:"𝜥";s:2:"Κ";s:4:"𝜦";s:2:"Λ";s:4:"𝜧";s:2:"Μ";s:4:"𝜨";s:2:"Ν";s:4:"𝜩";s:2:"Ξ";s:4:"𝜪";s:2:"Ο";s:4:"𝜫";s:2:"Π";s:4:"𝜬";s:2:"Ρ";s:4:"𝜭";s:2:"Θ";s:4:"𝜮";s:2:"Σ";s:4:"𝜯";s:2:"Τ";s:4:"𝜰";s:2:"Υ";s:4:"𝜱";s:2:"Φ";s:4:"𝜲";s:2:"Χ";s:4:"𝜳";s:2:"Ψ";s:4:"𝜴";s:2:"Ω";s:4:"𝜵";s:3:"∇";s:4:"𝜶";s:2:"α";s:4:"𝜷";s:2:"β";s:4:"𝜸";s:2:"γ";s:4:"𝜹";s:2:"δ";s:4:"𝜺";s:2:"ε";s:4:"𝜻";s:2:"ζ";s:4:"𝜼";s:2:"η";s:4:"𝜽";s:2:"θ";s:4:"𝜾";s:2:"ι";s:4:"𝜿";s:2:"κ";s:4:"𝝀";s:2:"λ";s:4:"𝝁";s:2:"μ";s:4:"𝝂";s:2:"ν";s:4:"𝝃";s:2:"ξ";s:4:"𝝄";s:2:"ο";s:4:"𝝅";s:2:"π";s:4:"𝝆";s:2:"ρ";s:4:"𝝇";s:2:"ς";s:4:"𝝈";s:2:"σ";s:4:"𝝉";s:2:"τ";s:4:"𝝊";s:2:"υ";s:4:"𝝋";s:2:"φ";s:4:"𝝌";s:2:"χ";s:4:"𝝍";s:2:"ψ";s:4:"𝝎";s:2:"ω";s:4:"𝝏";s:3:"∂";s:4:"𝝐";s:2:"ε";s:4:"𝝑";s:2:"θ";s:4:"𝝒";s:2:"κ";s:4:"𝝓";s:2:"φ";s:4:"𝝔";s:2:"ρ";s:4:"𝝕";s:2:"π";s:4:"𝝖";s:2:"Α";s:4:"𝝗";s:2:"Β";s:4:"𝝘";s:2:"Γ";s:4:"𝝙";s:2:"Δ";s:4:"𝝚";s:2:"Ε";s:4:"𝝛";s:2:"Ζ";s:4:"𝝜";s:2:"Η";s:4:"𝝝";s:2:"Θ";s:4:"𝝞";s:2:"Ι";s:4:"𝝟";s:2:"Κ";s:4:"𝝠";s:2:"Λ";s:4:"𝝡";s:2:"Μ";s:4:"𝝢";s:2:"Ν";s:4:"𝝣";s:2:"Ξ";s:4:"𝝤";s:2:"Ο";s:4:"𝝥";s:2:"Π";s:4:"𝝦";s:2:"Ρ";s:4:"𝝧";s:2:"Θ";s:4:"𝝨";s:2:"Σ";s:4:"𝝩";s:2:"Τ";s:4:"𝝪";s:2:"Υ";s:4:"𝝫";s:2:"Φ";s:4:"𝝬";s:2:"Χ";s:4:"𝝭";s:2:"Ψ";s:4:"𝝮";s:2:"Ω";s:4:"𝝯";s:3:"∇";s:4:"𝝰";s:2:"α";s:4:"𝝱";s:2:"β";s:4:"𝝲";s:2:"γ";s:4:"𝝳";s:2:"δ";s:4:"𝝴";s:2:"ε";s:4:"𝝵";s:2:"ζ";s:4:"𝝶";s:2:"η";s:4:"𝝷";s:2:"θ";s:4:"𝝸";s:2:"ι";s:4:"𝝹";s:2:"κ";s:4:"𝝺";s:2:"λ";s:4:"𝝻";s:2:"μ";s:4:"𝝼";s:2:"ν";s:4:"𝝽";s:2:"ξ";s:4:"𝝾";s:2:"ο";s:4:"𝝿";s:2:"π";s:4:"𝞀";s:2:"ρ";s:4:"𝞁";s:2:"ς";s:4:"𝞂";s:2:"σ";s:4:"𝞃";s:2:"τ";s:4:"𝞄";s:2:"υ";s:4:"𝞅";s:2:"φ";s:4:"𝞆";s:2:"χ";s:4:"𝞇";s:2:"ψ";s:4:"𝞈";s:2:"ω";s:4:"𝞉";s:3:"∂";s:4:"𝞊";s:2:"ε";s:4:"𝞋";s:2:"θ";s:4:"𝞌";s:2:"κ";s:4:"𝞍";s:2:"φ";s:4:"𝞎";s:2:"ρ";s:4:"𝞏";s:2:"π";s:4:"𝞐";s:2:"Α";s:4:"𝞑";s:2:"Β";s:4:"𝞒";s:2:"Γ";s:4:"𝞓";s:2:"Δ";s:4:"𝞔";s:2:"Ε";s:4:"𝞕";s:2:"Ζ";s:4:"𝞖";s:2:"Η";s:4:"𝞗";s:2:"Θ";s:4:"𝞘";s:2:"Ι";s:4:"𝞙";s:2:"Κ";s:4:"𝞚";s:2:"Λ";s:4:"𝞛";s:2:"Μ";s:4:"𝞜";s:2:"Ν";s:4:"𝞝";s:2:"Ξ";s:4:"𝞞";s:2:"Ο";s:4:"𝞟";s:2:"Π";s:4:"𝞠";s:2:"Ρ";s:4:"𝞡";s:2:"Θ";s:4:"𝞢";s:2:"Σ";s:4:"𝞣";s:2:"Τ";s:4:"𝞤";s:2:"Υ";s:4:"𝞥";s:2:"Φ";s:4:"𝞦";s:2:"Χ";s:4:"𝞧";s:2:"Ψ";s:4:"𝞨";s:2:"Ω";s:4:"𝞩";s:3:"∇";s:4:"𝞪";s:2:"α";s:4:"𝞫";s:2:"β";s:4:"𝞬";s:2:"γ";s:4:"𝞭";s:2:"δ";s:4:"𝞮";s:2:"ε";s:4:"𝞯";s:2:"ζ";s:4:"𝞰";s:2:"η";s:4:"𝞱";s:2:"θ";s:4:"𝞲";s:2:"ι";s:4:"𝞳";s:2:"κ";s:4:"𝞴";s:2:"λ";s:4:"𝞵";s:2:"μ";s:4:"𝞶";s:2:"ν";s:4:"𝞷";s:2:"ξ";s:4:"𝞸";s:2:"ο";s:4:"𝞹";s:2:"π";s:4:"𝞺";s:2:"ρ";s:4:"𝞻";s:2:"ς";s:4:"𝞼";s:2:"σ";s:4:"𝞽";s:2:"τ";s:4:"𝞾";s:2:"υ";s:4:"𝞿";s:2:"φ";s:4:"𝟀";s:2:"χ";s:4:"𝟁";s:2:"ψ";s:4:"𝟂";s:2:"ω";s:4:"𝟃";s:3:"∂";s:4:"𝟄";s:2:"ε";s:4:"𝟅";s:2:"θ";s:4:"𝟆";s:2:"κ";s:4:"𝟇";s:2:"φ";s:4:"𝟈";s:2:"ρ";s:4:"𝟉";s:2:"π";s:4:"𝟊";s:2:"Ϝ";s:4:"𝟋";s:2:"ϝ";s:4:"𝟎";s:1:"0";s:4:"𝟏";s:1:"1";s:4:"𝟐";s:1:"2";s:4:"𝟑";s:1:"3";s:4:"𝟒";s:1:"4";s:4:"𝟓";s:1:"5";s:4:"𝟔";s:1:"6";s:4:"𝟕";s:1:"7";s:4:"𝟖";s:1:"8";s:4:"𝟗";s:1:"9";s:4:"𝟘";s:1:"0";s:4:"𝟙";s:1:"1";s:4:"𝟚";s:1:"2";s:4:"𝟛";s:1:"3";s:4:"𝟜";s:1:"4";s:4:"𝟝";s:1:"5";s:4:"𝟞";s:1:"6";s:4:"𝟟";s:1:"7";s:4:"𝟠";s:1:"8";s:4:"𝟡";s:1:"9";s:4:"𝟢";s:1:"0";s:4:"𝟣";s:1:"1";s:4:"𝟤";s:1:"2";s:4:"𝟥";s:1:"3";s:4:"𝟦";s:1:"4";s:4:"𝟧";s:1:"5";s:4:"𝟨";s:1:"6";s:4:"𝟩";s:1:"7";s:4:"𝟪";s:1:"8";s:4:"𝟫";s:1:"9";s:4:"𝟬";s:1:"0";s:4:"𝟭";s:1:"1";s:4:"𝟮";s:1:"2";s:4:"𝟯";s:1:"3";s:4:"𝟰";s:1:"4";s:4:"𝟱";s:1:"5";s:4:"𝟲";s:1:"6";s:4:"𝟳";s:1:"7";s:4:"𝟴";s:1:"8";s:4:"𝟵";s:1:"9";s:4:"𝟶";s:1:"0";s:4:"𝟷";s:1:"1";s:4:"𝟸";s:1:"2";s:4:"𝟹";s:1:"3";s:4:"𝟺";s:1:"4";s:4:"𝟻";s:1:"5";s:4:"𝟼";s:1:"6";s:4:"𝟽";s:1:"7";s:4:"𝟾";s:1:"8";s:4:"𝟿";s:1:"9";s:4:"𞸀";s:2:"ا";s:4:"𞸁";s:2:"ب";s:4:"𞸂";s:2:"ج";s:4:"𞸃";s:2:"د";s:4:"𞸅";s:2:"و";s:4:"𞸆";s:2:"ز";s:4:"𞸇";s:2:"ح";s:4:"𞸈";s:2:"ط";s:4:"𞸉";s:2:"ي";s:4:"𞸊";s:2:"ك";s:4:"𞸋";s:2:"ل";s:4:"𞸌";s:2:"م";s:4:"𞸍";s:2:"ن";s:4:"𞸎";s:2:"س";s:4:"𞸏";s:2:"ع";s:4:"𞸐";s:2:"ف";s:4:"𞸑";s:2:"ص";s:4:"𞸒";s:2:"ق";s:4:"𞸓";s:2:"ر";s:4:"𞸔";s:2:"ش";s:4:"𞸕";s:2:"ت";s:4:"𞸖";s:2:"ث";s:4:"𞸗";s:2:"خ";s:4:"𞸘";s:2:"ذ";s:4:"𞸙";s:2:"ض";s:4:"𞸚";s:2:"ظ";s:4:"𞸛";s:2:"غ";s:4:"𞸜";s:2:"ٮ";s:4:"𞸝";s:2:"ں";s:4:"𞸞";s:2:"ڡ";s:4:"𞸟";s:2:"ٯ";s:4:"𞸡";s:2:"ب";s:4:"𞸢";s:2:"ج";s:4:"𞸤";s:2:"ه";s:4:"𞸧";s:2:"ح";s:4:"𞸩";s:2:"ي";s:4:"𞸪";s:2:"ك";s:4:"𞸫";s:2:"ل";s:4:"𞸬";s:2:"م";s:4:"𞸭";s:2:"ن";s:4:"𞸮";s:2:"س";s:4:"𞸯";s:2:"ع";s:4:"𞸰";s:2:"ف";s:4:"𞸱";s:2:"ص";s:4:"𞸲";s:2:"ق";s:4:"𞸴";s:2:"ش";s:4:"𞸵";s:2:"ت";s:4:"𞸶";s:2:"ث";s:4:"𞸷";s:2:"خ";s:4:"𞸹";s:2:"ض";s:4:"𞸻";s:2:"غ";s:4:"𞹂";s:2:"ج";s:4:"𞹇";s:2:"ح";s:4:"𞹉";s:2:"ي";s:4:"𞹋";s:2:"ل";s:4:"𞹍";s:2:"ن";s:4:"𞹎";s:2:"س";s:4:"𞹏";s:2:"ع";s:4:"𞹑";s:2:"ص";s:4:"𞹒";s:2:"ق";s:4:"𞹔";s:2:"ش";s:4:"𞹗";s:2:"خ";s:4:"𞹙";s:2:"ض";s:4:"𞹛";s:2:"غ";s:4:"𞹝";s:2:"ں";s:4:"𞹟";s:2:"ٯ";s:4:"𞹡";s:2:"ب";s:4:"𞹢";s:2:"ج";s:4:"𞹤";s:2:"ه";s:4:"𞹧";s:2:"ح";s:4:"𞹨";s:2:"ط";s:4:"𞹩";s:2:"ي";s:4:"𞹪";s:2:"ك";s:4:"𞹬";s:2:"م";s:4:"𞹭";s:2:"ن";s:4:"𞹮";s:2:"س";s:4:"𞹯";s:2:"ع";s:4:"𞹰";s:2:"ف";s:4:"𞹱";s:2:"ص";s:4:"𞹲";s:2:"ق";s:4:"𞹴";s:2:"ش";s:4:"𞹵";s:2:"ت";s:4:"𞹶";s:2:"ث";s:4:"𞹷";s:2:"خ";s:4:"𞹹";s:2:"ض";s:4:"𞹺";s:2:"ظ";s:4:"𞹻";s:2:"غ";s:4:"𞹼";s:2:"ٮ";s:4:"𞹾";s:2:"ڡ";s:4:"𞺀";s:2:"ا";s:4:"𞺁";s:2:"ب";s:4:"𞺂";s:2:"ج";s:4:"𞺃";s:2:"د";s:4:"𞺄";s:2:"ه";s:4:"𞺅";s:2:"و";s:4:"𞺆";s:2:"ز";s:4:"𞺇";s:2:"ح";s:4:"𞺈";s:2:"ط";s:4:"𞺉";s:2:"ي";s:4:"𞺋";s:2:"ل";s:4:"𞺌";s:2:"م";s:4:"𞺍";s:2:"ن";s:4:"𞺎";s:2:"س";s:4:"𞺏";s:2:"ع";s:4:"𞺐";s:2:"ف";s:4:"𞺑";s:2:"ص";s:4:"𞺒";s:2:"ق";s:4:"𞺓";s:2:"ر";s:4:"𞺔";s:2:"ش";s:4:"𞺕";s:2:"ت";s:4:"𞺖";s:2:"ث";s:4:"𞺗";s:2:"خ";s:4:"𞺘";s:2:"ذ";s:4:"𞺙";s:2:"ض";s:4:"𞺚";s:2:"ظ";s:4:"𞺛";s:2:"غ";s:4:"𞺡";s:2:"ب";s:4:"𞺢";s:2:"ج";s:4:"𞺣";s:2:"د";s:4:"𞺥";s:2:"و";s:4:"𞺦";s:2:"ز";s:4:"𞺧";s:2:"ح";s:4:"𞺨";s:2:"ط";s:4:"𞺩";s:2:"ي";s:4:"𞺫";s:2:"ل";s:4:"𞺬";s:2:"م";s:4:"𞺭";s:2:"ن";s:4:"𞺮";s:2:"س";s:4:"𞺯";s:2:"ع";s:4:"𞺰";s:2:"ف";s:4:"𞺱";s:2:"ص";s:4:"𞺲";s:2:"ق";s:4:"𞺳";s:2:"ر";s:4:"𞺴";s:2:"ش";s:4:"𞺵";s:2:"ت";s:4:"𞺶";s:2:"ث";s:4:"𞺷";s:2:"خ";s:4:"𞺸";s:2:"ذ";s:4:"𞺹";s:2:"ض";s:4:"𞺺";s:2:"ظ";s:4:"𞺻";s:2:"غ";s:4:"🄀";s:2:"0.";s:4:"🄁";s:2:"0,";s:4:"🄂";s:2:"1,";s:4:"🄃";s:2:"2,";s:4:"🄄";s:2:"3,";s:4:"🄅";s:2:"4,";s:4:"🄆";s:2:"5,";s:4:"🄇";s:2:"6,";s:4:"🄈";s:2:"7,";s:4:"🄉";s:2:"8,";s:4:"🄊";s:2:"9,";s:4:"🄐";s:3:"(A)";s:4:"🄑";s:3:"(B)";s:4:"🄒";s:3:"(C)";s:4:"🄓";s:3:"(D)";s:4:"🄔";s:3:"(E)";s:4:"🄕";s:3:"(F)";s:4:"🄖";s:3:"(G)";s:4:"🄗";s:3:"(H)";s:4:"🄘";s:3:"(I)";s:4:"🄙";s:3:"(J)";s:4:"🄚";s:3:"(K)";s:4:"🄛";s:3:"(L)";s:4:"🄜";s:3:"(M)";s:4:"🄝";s:3:"(N)";s:4:"🄞";s:3:"(O)";s:4:"🄟";s:3:"(P)";s:4:"🄠";s:3:"(Q)";s:4:"🄡";s:3:"(R)";s:4:"🄢";s:3:"(S)";s:4:"🄣";s:3:"(T)";s:4:"🄤";s:3:"(U)";s:4:"🄥";s:3:"(V)";s:4:"🄦";s:3:"(W)";s:4:"🄧";s:3:"(X)";s:4:"🄨";s:3:"(Y)";s:4:"🄩";s:3:"(Z)";s:4:"🄪";s:7:"〔S〕";s:4:"🄫";s:1:"C";s:4:"🄬";s:1:"R";s:4:"🄭";s:2:"CD";s:4:"🄮";s:2:"WZ";s:4:"🄰";s:1:"A";s:4:"🄱";s:1:"B";s:4:"🄲";s:1:"C";s:4:"🄳";s:1:"D";s:4:"🄴";s:1:"E";s:4:"🄵";s:1:"F";s:4:"🄶";s:1:"G";s:4:"🄷";s:1:"H";s:4:"🄸";s:1:"I";s:4:"🄹";s:1:"J";s:4:"🄺";s:1:"K";s:4:"🄻";s:1:"L";s:4:"🄼";s:1:"M";s:4:"🄽";s:1:"N";s:4:"🄾";s:1:"O";s:4:"🄿";s:1:"P";s:4:"🅀";s:1:"Q";s:4:"🅁";s:1:"R";s:4:"🅂";s:1:"S";s:4:"🅃";s:1:"T";s:4:"🅄";s:1:"U";s:4:"🅅";s:1:"V";s:4:"🅆";s:1:"W";s:4:"🅇";s:1:"X";s:4:"🅈";s:1:"Y";s:4:"🅉";s:1:"Z";s:4:"🅊";s:2:"HV";s:4:"🅋";s:2:"MV";s:4:"🅌";s:2:"SD";s:4:"🅍";s:2:"SS";s:4:"🅎";s:3:"PPV";s:4:"🅏";s:2:"WC";s:4:"🅪";s:2:"MC";s:4:"🅫";s:2:"MD";s:4:"🅬";s:2:"MR";s:4:"🆐";s:2:"DJ";s:4:"🈀";s:6:"ほか";s:4:"🈁";s:6:"ココ";s:4:"🈂";s:3:"サ";s:4:"🈐";s:3:"手";s:4:"🈑";s:3:"字";s:4:"🈒";s:3:"双";s:4:"🈓";s:6:"デ";s:4:"🈔";s:3:"二";s:4:"🈕";s:3:"多";s:4:"🈖";s:3:"解";s:4:"🈗";s:3:"天";s:4:"🈘";s:3:"交";s:4:"🈙";s:3:"映";s:4:"🈚";s:3:"無";s:4:"🈛";s:3:"料";s:4:"🈜";s:3:"前";s:4:"🈝";s:3:"後";s:4:"🈞";s:3:"再";s:4:"🈟";s:3:"新";s:4:"🈠";s:3:"初";s:4:"🈡";s:3:"終";s:4:"🈢";s:3:"生";s:4:"🈣";s:3:"販";s:4:"🈤";s:3:"声";s:4:"🈥";s:3:"吹";s:4:"🈦";s:3:"演";s:4:"🈧";s:3:"投";s:4:"🈨";s:3:"捕";s:4:"🈩";s:3:"一";s:4:"🈪";s:3:"三";s:4:"🈫";s:3:"遊";s:4:"🈬";s:3:"左";s:4:"🈭";s:3:"中";s:4:"🈮";s:3:"右";s:4:"🈯";s:3:"指";s:4:"🈰";s:3:"走";s:4:"🈱";s:3:"打";s:4:"🈲";s:3:"禁";s:4:"🈳";s:3:"空";s:4:"🈴";s:3:"合";s:4:"🈵";s:3:"満";s:4:"🈶";s:3:"有";s:4:"🈷";s:3:"月";s:4:"🈸";s:3:"申";s:4:"🈹";s:3:"割";s:4:"🈺";s:3:"営";s:4:"🈻";s:3:"配";s:4:"🉀";s:9:"〔本〕";s:4:"🉁";s:9:"〔三〕";s:4:"🉂";s:9:"〔二〕";s:4:"🉃";s:9:"〔安〕";s:4:"🉄";s:9:"〔点〕";s:4:"🉅";s:9:"〔打〕";s:4:"🉆";s:9:"〔盗〕";s:4:"🉇";s:9:"〔勝〕";s:4:"🉈";s:9:"〔敗〕";s:4:"🉐";s:3:"得";s:4:"🉑";s:3:"可";} \ No newline at end of file diff --git a/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/lowerCase.ser b/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/lowerCase.ser index 13dabdd..d15728d 100644 --- a/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/lowerCase.ser +++ b/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/lowerCase.ser @@ -1 +1 @@ -a:1092:{s:1:"A";s:1:"a";s:1:"B";s:1:"b";s:1:"C";s:1:"c";s:1:"D";s:1:"d";s:1:"E";s:1:"e";s:1:"F";s:1:"f";s:1:"G";s:1:"g";s:1:"H";s:1:"h";s:1:"I";s:1:"i";s:1:"J";s:1:"j";s:1:"K";s:1:"k";s:1:"L";s:1:"l";s:1:"M";s:1:"m";s:1:"N";s:1:"n";s:1:"O";s:1:"o";s:1:"P";s:1:"p";s:1:"Q";s:1:"q";s:1:"R";s:1:"r";s:1:"S";s:1:"s";s:1:"T";s:1:"t";s:1:"U";s:1:"u";s:1:"V";s:1:"v";s:1:"W";s:1:"w";s:1:"X";s:1:"x";s:1:"Y";s:1:"y";s:1:"Z";s:1:"z";s:2:"À";s:2:"à";s:2:"Á";s:2:"á";s:2:"Â";s:2:"â";s:2:"Ã";s:2:"ã";s:2:"Ä";s:2:"ä";s:2:"Å";s:2:"å";s:2:"Æ";s:2:"æ";s:2:"Ç";s:2:"ç";s:2:"È";s:2:"è";s:2:"É";s:2:"é";s:2:"Ê";s:2:"ê";s:2:"Ë";s:2:"ë";s:2:"Ì";s:2:"ì";s:2:"Í";s:2:"í";s:2:"Î";s:2:"î";s:2:"Ï";s:2:"ï";s:2:"Ð";s:2:"ð";s:2:"Ñ";s:2:"ñ";s:2:"Ò";s:2:"ò";s:2:"Ó";s:2:"ó";s:2:"Ô";s:2:"ô";s:2:"Õ";s:2:"õ";s:2:"Ö";s:2:"ö";s:2:"Ø";s:2:"ø";s:2:"Ù";s:2:"ù";s:2:"Ú";s:2:"ú";s:2:"Û";s:2:"û";s:2:"Ü";s:2:"ü";s:2:"Ý";s:2:"ý";s:2:"Þ";s:2:"þ";s:2:"Ā";s:2:"ā";s:2:"Ă";s:2:"ă";s:2:"Ą";s:2:"ą";s:2:"Ć";s:2:"ć";s:2:"Ĉ";s:2:"ĉ";s:2:"Ċ";s:2:"ċ";s:2:"Č";s:2:"č";s:2:"Ď";s:2:"ď";s:2:"Đ";s:2:"đ";s:2:"Ē";s:2:"ē";s:2:"Ĕ";s:2:"ĕ";s:2:"Ė";s:2:"ė";s:2:"Ę";s:2:"ę";s:2:"Ě";s:2:"ě";s:2:"Ĝ";s:2:"ĝ";s:2:"Ğ";s:2:"ğ";s:2:"Ġ";s:2:"ġ";s:2:"Ģ";s:2:"ģ";s:2:"Ĥ";s:2:"ĥ";s:2:"Ħ";s:2:"ħ";s:2:"Ĩ";s:2:"ĩ";s:2:"Ī";s:2:"ī";s:2:"Ĭ";s:2:"ĭ";s:2:"Į";s:2:"į";s:2:"İ";s:1:"i";s:2:"IJ";s:2:"ij";s:2:"Ĵ";s:2:"ĵ";s:2:"Ķ";s:2:"ķ";s:2:"Ĺ";s:2:"ĺ";s:2:"Ļ";s:2:"ļ";s:2:"Ľ";s:2:"ľ";s:2:"Ŀ";s:2:"ŀ";s:2:"Ł";s:2:"ł";s:2:"Ń";s:2:"ń";s:2:"Ņ";s:2:"ņ";s:2:"Ň";s:2:"ň";s:2:"Ŋ";s:2:"ŋ";s:2:"Ō";s:2:"ō";s:2:"Ŏ";s:2:"ŏ";s:2:"Ő";s:2:"ő";s:2:"Œ";s:2:"œ";s:2:"Ŕ";s:2:"ŕ";s:2:"Ŗ";s:2:"ŗ";s:2:"Ř";s:2:"ř";s:2:"Ś";s:2:"ś";s:2:"Ŝ";s:2:"ŝ";s:2:"Ş";s:2:"ş";s:2:"Š";s:2:"š";s:2:"Ţ";s:2:"ţ";s:2:"Ť";s:2:"ť";s:2:"Ŧ";s:2:"ŧ";s:2:"Ũ";s:2:"ũ";s:2:"Ū";s:2:"ū";s:2:"Ŭ";s:2:"ŭ";s:2:"Ů";s:2:"ů";s:2:"Ű";s:2:"ű";s:2:"Ų";s:2:"ų";s:2:"Ŵ";s:2:"ŵ";s:2:"Ŷ";s:2:"ŷ";s:2:"Ÿ";s:2:"ÿ";s:2:"Ź";s:2:"ź";s:2:"Ż";s:2:"ż";s:2:"Ž";s:2:"ž";s:2:"Ɓ";s:2:"ɓ";s:2:"Ƃ";s:2:"ƃ";s:2:"Ƅ";s:2:"ƅ";s:2:"Ɔ";s:2:"ɔ";s:2:"Ƈ";s:2:"ƈ";s:2:"Ɖ";s:2:"ɖ";s:2:"Ɗ";s:2:"ɗ";s:2:"Ƌ";s:2:"ƌ";s:2:"Ǝ";s:2:"ǝ";s:2:"Ə";s:2:"ə";s:2:"Ɛ";s:2:"ɛ";s:2:"Ƒ";s:2:"ƒ";s:2:"Ɠ";s:2:"ɠ";s:2:"Ɣ";s:2:"ɣ";s:2:"Ɩ";s:2:"ɩ";s:2:"Ɨ";s:2:"ɨ";s:2:"Ƙ";s:2:"ƙ";s:2:"Ɯ";s:2:"ɯ";s:2:"Ɲ";s:2:"ɲ";s:2:"Ɵ";s:2:"ɵ";s:2:"Ơ";s:2:"ơ";s:2:"Ƣ";s:2:"ƣ";s:2:"Ƥ";s:2:"ƥ";s:2:"Ʀ";s:2:"ʀ";s:2:"Ƨ";s:2:"ƨ";s:2:"Ʃ";s:2:"ʃ";s:2:"Ƭ";s:2:"ƭ";s:2:"Ʈ";s:2:"ʈ";s:2:"Ư";s:2:"ư";s:2:"Ʊ";s:2:"ʊ";s:2:"Ʋ";s:2:"ʋ";s:2:"Ƴ";s:2:"ƴ";s:2:"Ƶ";s:2:"ƶ";s:2:"Ʒ";s:2:"ʒ";s:2:"Ƹ";s:2:"ƹ";s:2:"Ƽ";s:2:"ƽ";s:2:"DŽ";s:2:"dž";s:2:"Dž";s:2:"dž";s:2:"LJ";s:2:"lj";s:2:"Lj";s:2:"lj";s:2:"NJ";s:2:"nj";s:2:"Nj";s:2:"nj";s:2:"Ǎ";s:2:"ǎ";s:2:"Ǐ";s:2:"ǐ";s:2:"Ǒ";s:2:"ǒ";s:2:"Ǔ";s:2:"ǔ";s:2:"Ǖ";s:2:"ǖ";s:2:"Ǘ";s:2:"ǘ";s:2:"Ǚ";s:2:"ǚ";s:2:"Ǜ";s:2:"ǜ";s:2:"Ǟ";s:2:"ǟ";s:2:"Ǡ";s:2:"ǡ";s:2:"Ǣ";s:2:"ǣ";s:2:"Ǥ";s:2:"ǥ";s:2:"Ǧ";s:2:"ǧ";s:2:"Ǩ";s:2:"ǩ";s:2:"Ǫ";s:2:"ǫ";s:2:"Ǭ";s:2:"ǭ";s:2:"Ǯ";s:2:"ǯ";s:2:"DZ";s:2:"dz";s:2:"Dz";s:2:"dz";s:2:"Ǵ";s:2:"ǵ";s:2:"Ƕ";s:2:"ƕ";s:2:"Ƿ";s:2:"ƿ";s:2:"Ǹ";s:2:"ǹ";s:2:"Ǻ";s:2:"ǻ";s:2:"Ǽ";s:2:"ǽ";s:2:"Ǿ";s:2:"ǿ";s:2:"Ȁ";s:2:"ȁ";s:2:"Ȃ";s:2:"ȃ";s:2:"Ȅ";s:2:"ȅ";s:2:"Ȇ";s:2:"ȇ";s:2:"Ȉ";s:2:"ȉ";s:2:"Ȋ";s:2:"ȋ";s:2:"Ȍ";s:2:"ȍ";s:2:"Ȏ";s:2:"ȏ";s:2:"Ȑ";s:2:"ȑ";s:2:"Ȓ";s:2:"ȓ";s:2:"Ȕ";s:2:"ȕ";s:2:"Ȗ";s:2:"ȗ";s:2:"Ș";s:2:"ș";s:2:"Ț";s:2:"ț";s:2:"Ȝ";s:2:"ȝ";s:2:"Ȟ";s:2:"ȟ";s:2:"Ƞ";s:2:"ƞ";s:2:"Ȣ";s:2:"ȣ";s:2:"Ȥ";s:2:"ȥ";s:2:"Ȧ";s:2:"ȧ";s:2:"Ȩ";s:2:"ȩ";s:2:"Ȫ";s:2:"ȫ";s:2:"Ȭ";s:2:"ȭ";s:2:"Ȯ";s:2:"ȯ";s:2:"Ȱ";s:2:"ȱ";s:2:"Ȳ";s:2:"ȳ";s:2:"Ⱥ";s:3:"ⱥ";s:2:"Ȼ";s:2:"ȼ";s:2:"Ƚ";s:2:"ƚ";s:2:"Ⱦ";s:3:"ⱦ";s:2:"Ɂ";s:2:"ɂ";s:2:"Ƀ";s:2:"ƀ";s:2:"Ʉ";s:2:"ʉ";s:2:"Ʌ";s:2:"ʌ";s:2:"Ɇ";s:2:"ɇ";s:2:"Ɉ";s:2:"ɉ";s:2:"Ɋ";s:2:"ɋ";s:2:"Ɍ";s:2:"ɍ";s:2:"Ɏ";s:2:"ɏ";s:2:"Ͱ";s:2:"ͱ";s:2:"Ͳ";s:2:"ͳ";s:2:"Ͷ";s:2:"ͷ";s:2:"Ϳ";s:2:"ϳ";s:2:"Ά";s:2:"ά";s:2:"Έ";s:2:"έ";s:2:"Ή";s:2:"ή";s:2:"Ί";s:2:"ί";s:2:"Ό";s:2:"ό";s:2:"Ύ";s:2:"ύ";s:2:"Ώ";s:2:"ώ";s:2:"Α";s:2:"α";s:2:"Β";s:2:"β";s:2:"Γ";s:2:"γ";s:2:"Δ";s:2:"δ";s:2:"Ε";s:2:"ε";s:2:"Ζ";s:2:"ζ";s:2:"Η";s:2:"η";s:2:"Θ";s:2:"θ";s:2:"Ι";s:2:"ι";s:2:"Κ";s:2:"κ";s:2:"Λ";s:2:"λ";s:2:"Μ";s:2:"μ";s:2:"Ν";s:2:"ν";s:2:"Ξ";s:2:"ξ";s:2:"Ο";s:2:"ο";s:2:"Π";s:2:"π";s:2:"Ρ";s:2:"ρ";s:2:"Σ";s:2:"σ";s:2:"Τ";s:2:"τ";s:2:"Υ";s:2:"υ";s:2:"Φ";s:2:"φ";s:2:"Χ";s:2:"χ";s:2:"Ψ";s:2:"ψ";s:2:"Ω";s:2:"ω";s:2:"Ϊ";s:2:"ϊ";s:2:"Ϋ";s:2:"ϋ";s:2:"Ϗ";s:2:"ϗ";s:2:"Ϙ";s:2:"ϙ";s:2:"Ϛ";s:2:"ϛ";s:2:"Ϝ";s:2:"ϝ";s:2:"Ϟ";s:2:"ϟ";s:2:"Ϡ";s:2:"ϡ";s:2:"Ϣ";s:2:"ϣ";s:2:"Ϥ";s:2:"ϥ";s:2:"Ϧ";s:2:"ϧ";s:2:"Ϩ";s:2:"ϩ";s:2:"Ϫ";s:2:"ϫ";s:2:"Ϭ";s:2:"ϭ";s:2:"Ϯ";s:2:"ϯ";s:2:"ϴ";s:2:"θ";s:2:"Ϸ";s:2:"ϸ";s:2:"Ϲ";s:2:"ϲ";s:2:"Ϻ";s:2:"ϻ";s:2:"Ͻ";s:2:"ͻ";s:2:"Ͼ";s:2:"ͼ";s:2:"Ͽ";s:2:"ͽ";s:2:"Ѐ";s:2:"ѐ";s:2:"Ё";s:2:"ё";s:2:"Ђ";s:2:"ђ";s:2:"Ѓ";s:2:"ѓ";s:2:"Є";s:2:"є";s:2:"Ѕ";s:2:"ѕ";s:2:"І";s:2:"і";s:2:"Ї";s:2:"ї";s:2:"Ј";s:2:"ј";s:2:"Љ";s:2:"љ";s:2:"Њ";s:2:"њ";s:2:"Ћ";s:2:"ћ";s:2:"Ќ";s:2:"ќ";s:2:"Ѝ";s:2:"ѝ";s:2:"Ў";s:2:"ў";s:2:"Џ";s:2:"џ";s:2:"А";s:2:"а";s:2:"Б";s:2:"б";s:2:"В";s:2:"в";s:2:"Г";s:2:"г";s:2:"Д";s:2:"д";s:2:"Е";s:2:"е";s:2:"Ж";s:2:"ж";s:2:"З";s:2:"з";s:2:"И";s:2:"и";s:2:"Й";s:2:"й";s:2:"К";s:2:"к";s:2:"Л";s:2:"л";s:2:"М";s:2:"м";s:2:"Н";s:2:"н";s:2:"О";s:2:"о";s:2:"П";s:2:"п";s:2:"Р";s:2:"р";s:2:"С";s:2:"с";s:2:"Т";s:2:"т";s:2:"У";s:2:"у";s:2:"Ф";s:2:"ф";s:2:"Х";s:2:"х";s:2:"Ц";s:2:"ц";s:2:"Ч";s:2:"ч";s:2:"Ш";s:2:"ш";s:2:"Щ";s:2:"щ";s:2:"Ъ";s:2:"ъ";s:2:"Ы";s:2:"ы";s:2:"Ь";s:2:"ь";s:2:"Э";s:2:"э";s:2:"Ю";s:2:"ю";s:2:"Я";s:2:"я";s:2:"Ѡ";s:2:"ѡ";s:2:"Ѣ";s:2:"ѣ";s:2:"Ѥ";s:2:"ѥ";s:2:"Ѧ";s:2:"ѧ";s:2:"Ѩ";s:2:"ѩ";s:2:"Ѫ";s:2:"ѫ";s:2:"Ѭ";s:2:"ѭ";s:2:"Ѯ";s:2:"ѯ";s:2:"Ѱ";s:2:"ѱ";s:2:"Ѳ";s:2:"ѳ";s:2:"Ѵ";s:2:"ѵ";s:2:"Ѷ";s:2:"ѷ";s:2:"Ѹ";s:2:"ѹ";s:2:"Ѻ";s:2:"ѻ";s:2:"Ѽ";s:2:"ѽ";s:2:"Ѿ";s:2:"ѿ";s:2:"Ҁ";s:2:"ҁ";s:2:"Ҋ";s:2:"ҋ";s:2:"Ҍ";s:2:"ҍ";s:2:"Ҏ";s:2:"ҏ";s:2:"Ґ";s:2:"ґ";s:2:"Ғ";s:2:"ғ";s:2:"Ҕ";s:2:"ҕ";s:2:"Җ";s:2:"җ";s:2:"Ҙ";s:2:"ҙ";s:2:"Қ";s:2:"қ";s:2:"Ҝ";s:2:"ҝ";s:2:"Ҟ";s:2:"ҟ";s:2:"Ҡ";s:2:"ҡ";s:2:"Ң";s:2:"ң";s:2:"Ҥ";s:2:"ҥ";s:2:"Ҧ";s:2:"ҧ";s:2:"Ҩ";s:2:"ҩ";s:2:"Ҫ";s:2:"ҫ";s:2:"Ҭ";s:2:"ҭ";s:2:"Ү";s:2:"ү";s:2:"Ұ";s:2:"ұ";s:2:"Ҳ";s:2:"ҳ";s:2:"Ҵ";s:2:"ҵ";s:2:"Ҷ";s:2:"ҷ";s:2:"Ҹ";s:2:"ҹ";s:2:"Һ";s:2:"һ";s:2:"Ҽ";s:2:"ҽ";s:2:"Ҿ";s:2:"ҿ";s:2:"Ӏ";s:2:"ӏ";s:2:"Ӂ";s:2:"ӂ";s:2:"Ӄ";s:2:"ӄ";s:2:"Ӆ";s:2:"ӆ";s:2:"Ӈ";s:2:"ӈ";s:2:"Ӊ";s:2:"ӊ";s:2:"Ӌ";s:2:"ӌ";s:2:"Ӎ";s:2:"ӎ";s:2:"Ӑ";s:2:"ӑ";s:2:"Ӓ";s:2:"ӓ";s:2:"Ӕ";s:2:"ӕ";s:2:"Ӗ";s:2:"ӗ";s:2:"Ә";s:2:"ә";s:2:"Ӛ";s:2:"ӛ";s:2:"Ӝ";s:2:"ӝ";s:2:"Ӟ";s:2:"ӟ";s:2:"Ӡ";s:2:"ӡ";s:2:"Ӣ";s:2:"ӣ";s:2:"Ӥ";s:2:"ӥ";s:2:"Ӧ";s:2:"ӧ";s:2:"Ө";s:2:"ө";s:2:"Ӫ";s:2:"ӫ";s:2:"Ӭ";s:2:"ӭ";s:2:"Ӯ";s:2:"ӯ";s:2:"Ӱ";s:2:"ӱ";s:2:"Ӳ";s:2:"ӳ";s:2:"Ӵ";s:2:"ӵ";s:2:"Ӷ";s:2:"ӷ";s:2:"Ӹ";s:2:"ӹ";s:2:"Ӻ";s:2:"ӻ";s:2:"Ӽ";s:2:"ӽ";s:2:"Ӿ";s:2:"ӿ";s:2:"Ԁ";s:2:"ԁ";s:2:"Ԃ";s:2:"ԃ";s:2:"Ԅ";s:2:"ԅ";s:2:"Ԇ";s:2:"ԇ";s:2:"Ԉ";s:2:"ԉ";s:2:"Ԋ";s:2:"ԋ";s:2:"Ԍ";s:2:"ԍ";s:2:"Ԏ";s:2:"ԏ";s:2:"Ԑ";s:2:"ԑ";s:2:"Ԓ";s:2:"ԓ";s:2:"Ԕ";s:2:"ԕ";s:2:"Ԗ";s:2:"ԗ";s:2:"Ԙ";s:2:"ԙ";s:2:"Ԛ";s:2:"ԛ";s:2:"Ԝ";s:2:"ԝ";s:2:"Ԟ";s:2:"ԟ";s:2:"Ԡ";s:2:"ԡ";s:2:"Ԣ";s:2:"ԣ";s:2:"Ԥ";s:2:"ԥ";s:2:"Ԧ";s:2:"ԧ";s:2:"Ԩ";s:2:"ԩ";s:2:"Ԫ";s:2:"ԫ";s:2:"Ԭ";s:2:"ԭ";s:2:"Ԯ";s:2:"ԯ";s:2:"Ա";s:2:"ա";s:2:"Բ";s:2:"բ";s:2:"Գ";s:2:"գ";s:2:"Դ";s:2:"դ";s:2:"Ե";s:2:"ե";s:2:"Զ";s:2:"զ";s:2:"Է";s:2:"է";s:2:"Ը";s:2:"ը";s:2:"Թ";s:2:"թ";s:2:"Ժ";s:2:"ժ";s:2:"Ի";s:2:"ի";s:2:"Լ";s:2:"լ";s:2:"Խ";s:2:"խ";s:2:"Ծ";s:2:"ծ";s:2:"Կ";s:2:"կ";s:2:"Հ";s:2:"հ";s:2:"Ձ";s:2:"ձ";s:2:"Ղ";s:2:"ղ";s:2:"Ճ";s:2:"ճ";s:2:"Մ";s:2:"մ";s:2:"Յ";s:2:"յ";s:2:"Ն";s:2:"ն";s:2:"Շ";s:2:"շ";s:2:"Ո";s:2:"ո";s:2:"Չ";s:2:"չ";s:2:"Պ";s:2:"պ";s:2:"Ջ";s:2:"ջ";s:2:"Ռ";s:2:"ռ";s:2:"Ս";s:2:"ս";s:2:"Վ";s:2:"վ";s:2:"Տ";s:2:"տ";s:2:"Ր";s:2:"ր";s:2:"Ց";s:2:"ց";s:2:"Ւ";s:2:"ւ";s:2:"Փ";s:2:"փ";s:2:"Ք";s:2:"ք";s:2:"Օ";s:2:"օ";s:2:"Ֆ";s:2:"ֆ";s:3:"Ⴀ";s:3:"ⴀ";s:3:"Ⴁ";s:3:"ⴁ";s:3:"Ⴂ";s:3:"ⴂ";s:3:"Ⴃ";s:3:"ⴃ";s:3:"Ⴄ";s:3:"ⴄ";s:3:"Ⴅ";s:3:"ⴅ";s:3:"Ⴆ";s:3:"ⴆ";s:3:"Ⴇ";s:3:"ⴇ";s:3:"Ⴈ";s:3:"ⴈ";s:3:"Ⴉ";s:3:"ⴉ";s:3:"Ⴊ";s:3:"ⴊ";s:3:"Ⴋ";s:3:"ⴋ";s:3:"Ⴌ";s:3:"ⴌ";s:3:"Ⴍ";s:3:"ⴍ";s:3:"Ⴎ";s:3:"ⴎ";s:3:"Ⴏ";s:3:"ⴏ";s:3:"Ⴐ";s:3:"ⴐ";s:3:"Ⴑ";s:3:"ⴑ";s:3:"Ⴒ";s:3:"ⴒ";s:3:"Ⴓ";s:3:"ⴓ";s:3:"Ⴔ";s:3:"ⴔ";s:3:"Ⴕ";s:3:"ⴕ";s:3:"Ⴖ";s:3:"ⴖ";s:3:"Ⴗ";s:3:"ⴗ";s:3:"Ⴘ";s:3:"ⴘ";s:3:"Ⴙ";s:3:"ⴙ";s:3:"Ⴚ";s:3:"ⴚ";s:3:"Ⴛ";s:3:"ⴛ";s:3:"Ⴜ";s:3:"ⴜ";s:3:"Ⴝ";s:3:"ⴝ";s:3:"Ⴞ";s:3:"ⴞ";s:3:"Ⴟ";s:3:"ⴟ";s:3:"Ⴠ";s:3:"ⴠ";s:3:"Ⴡ";s:3:"ⴡ";s:3:"Ⴢ";s:3:"ⴢ";s:3:"Ⴣ";s:3:"ⴣ";s:3:"Ⴤ";s:3:"ⴤ";s:3:"Ⴥ";s:3:"ⴥ";s:3:"Ⴧ";s:3:"ⴧ";s:3:"Ⴭ";s:3:"ⴭ";s:3:"Ḁ";s:3:"ḁ";s:3:"Ḃ";s:3:"ḃ";s:3:"Ḅ";s:3:"ḅ";s:3:"Ḇ";s:3:"ḇ";s:3:"Ḉ";s:3:"ḉ";s:3:"Ḋ";s:3:"ḋ";s:3:"Ḍ";s:3:"ḍ";s:3:"Ḏ";s:3:"ḏ";s:3:"Ḑ";s:3:"ḑ";s:3:"Ḓ";s:3:"ḓ";s:3:"Ḕ";s:3:"ḕ";s:3:"Ḗ";s:3:"ḗ";s:3:"Ḙ";s:3:"ḙ";s:3:"Ḛ";s:3:"ḛ";s:3:"Ḝ";s:3:"ḝ";s:3:"Ḟ";s:3:"ḟ";s:3:"Ḡ";s:3:"ḡ";s:3:"Ḣ";s:3:"ḣ";s:3:"Ḥ";s:3:"ḥ";s:3:"Ḧ";s:3:"ḧ";s:3:"Ḩ";s:3:"ḩ";s:3:"Ḫ";s:3:"ḫ";s:3:"Ḭ";s:3:"ḭ";s:3:"Ḯ";s:3:"ḯ";s:3:"Ḱ";s:3:"ḱ";s:3:"Ḳ";s:3:"ḳ";s:3:"Ḵ";s:3:"ḵ";s:3:"Ḷ";s:3:"ḷ";s:3:"Ḹ";s:3:"ḹ";s:3:"Ḻ";s:3:"ḻ";s:3:"Ḽ";s:3:"ḽ";s:3:"Ḿ";s:3:"ḿ";s:3:"Ṁ";s:3:"ṁ";s:3:"Ṃ";s:3:"ṃ";s:3:"Ṅ";s:3:"ṅ";s:3:"Ṇ";s:3:"ṇ";s:3:"Ṉ";s:3:"ṉ";s:3:"Ṋ";s:3:"ṋ";s:3:"Ṍ";s:3:"ṍ";s:3:"Ṏ";s:3:"ṏ";s:3:"Ṑ";s:3:"ṑ";s:3:"Ṓ";s:3:"ṓ";s:3:"Ṕ";s:3:"ṕ";s:3:"Ṗ";s:3:"ṗ";s:3:"Ṙ";s:3:"ṙ";s:3:"Ṛ";s:3:"ṛ";s:3:"Ṝ";s:3:"ṝ";s:3:"Ṟ";s:3:"ṟ";s:3:"Ṡ";s:3:"ṡ";s:3:"Ṣ";s:3:"ṣ";s:3:"Ṥ";s:3:"ṥ";s:3:"Ṧ";s:3:"ṧ";s:3:"Ṩ";s:3:"ṩ";s:3:"Ṫ";s:3:"ṫ";s:3:"Ṭ";s:3:"ṭ";s:3:"Ṯ";s:3:"ṯ";s:3:"Ṱ";s:3:"ṱ";s:3:"Ṳ";s:3:"ṳ";s:3:"Ṵ";s:3:"ṵ";s:3:"Ṷ";s:3:"ṷ";s:3:"Ṹ";s:3:"ṹ";s:3:"Ṻ";s:3:"ṻ";s:3:"Ṽ";s:3:"ṽ";s:3:"Ṿ";s:3:"ṿ";s:3:"Ẁ";s:3:"ẁ";s:3:"Ẃ";s:3:"ẃ";s:3:"Ẅ";s:3:"ẅ";s:3:"Ẇ";s:3:"ẇ";s:3:"Ẉ";s:3:"ẉ";s:3:"Ẋ";s:3:"ẋ";s:3:"Ẍ";s:3:"ẍ";s:3:"Ẏ";s:3:"ẏ";s:3:"Ẑ";s:3:"ẑ";s:3:"Ẓ";s:3:"ẓ";s:3:"Ẕ";s:3:"ẕ";s:3:"ẞ";s:2:"ß";s:3:"Ạ";s:3:"ạ";s:3:"Ả";s:3:"ả";s:3:"Ấ";s:3:"ấ";s:3:"Ầ";s:3:"ầ";s:3:"Ẩ";s:3:"ẩ";s:3:"Ẫ";s:3:"ẫ";s:3:"Ậ";s:3:"ậ";s:3:"Ắ";s:3:"ắ";s:3:"Ằ";s:3:"ằ";s:3:"Ẳ";s:3:"ẳ";s:3:"Ẵ";s:3:"ẵ";s:3:"Ặ";s:3:"ặ";s:3:"Ẹ";s:3:"ẹ";s:3:"Ẻ";s:3:"ẻ";s:3:"Ẽ";s:3:"ẽ";s:3:"Ế";s:3:"ế";s:3:"Ề";s:3:"ề";s:3:"Ể";s:3:"ể";s:3:"Ễ";s:3:"ễ";s:3:"Ệ";s:3:"ệ";s:3:"Ỉ";s:3:"ỉ";s:3:"Ị";s:3:"ị";s:3:"Ọ";s:3:"ọ";s:3:"Ỏ";s:3:"ỏ";s:3:"Ố";s:3:"ố";s:3:"Ồ";s:3:"ồ";s:3:"Ổ";s:3:"ổ";s:3:"Ỗ";s:3:"ỗ";s:3:"Ộ";s:3:"ộ";s:3:"Ớ";s:3:"ớ";s:3:"Ờ";s:3:"ờ";s:3:"Ở";s:3:"ở";s:3:"Ỡ";s:3:"ỡ";s:3:"Ợ";s:3:"ợ";s:3:"Ụ";s:3:"ụ";s:3:"Ủ";s:3:"ủ";s:3:"Ứ";s:3:"ứ";s:3:"Ừ";s:3:"ừ";s:3:"Ử";s:3:"ử";s:3:"Ữ";s:3:"ữ";s:3:"Ự";s:3:"ự";s:3:"Ỳ";s:3:"ỳ";s:3:"Ỵ";s:3:"ỵ";s:3:"Ỷ";s:3:"ỷ";s:3:"Ỹ";s:3:"ỹ";s:3:"Ỻ";s:3:"ỻ";s:3:"Ỽ";s:3:"ỽ";s:3:"Ỿ";s:3:"ỿ";s:3:"Ἀ";s:3:"ἀ";s:3:"Ἁ";s:3:"ἁ";s:3:"Ἂ";s:3:"ἂ";s:3:"Ἃ";s:3:"ἃ";s:3:"Ἄ";s:3:"ἄ";s:3:"Ἅ";s:3:"ἅ";s:3:"Ἆ";s:3:"ἆ";s:3:"Ἇ";s:3:"ἇ";s:3:"Ἐ";s:3:"ἐ";s:3:"Ἑ";s:3:"ἑ";s:3:"Ἒ";s:3:"ἒ";s:3:"Ἓ";s:3:"ἓ";s:3:"Ἔ";s:3:"ἔ";s:3:"Ἕ";s:3:"ἕ";s:3:"Ἠ";s:3:"ἠ";s:3:"Ἡ";s:3:"ἡ";s:3:"Ἢ";s:3:"ἢ";s:3:"Ἣ";s:3:"ἣ";s:3:"Ἤ";s:3:"ἤ";s:3:"Ἥ";s:3:"ἥ";s:3:"Ἦ";s:3:"ἦ";s:3:"Ἧ";s:3:"ἧ";s:3:"Ἰ";s:3:"ἰ";s:3:"Ἱ";s:3:"ἱ";s:3:"Ἲ";s:3:"ἲ";s:3:"Ἳ";s:3:"ἳ";s:3:"Ἴ";s:3:"ἴ";s:3:"Ἵ";s:3:"ἵ";s:3:"Ἶ";s:3:"ἶ";s:3:"Ἷ";s:3:"ἷ";s:3:"Ὀ";s:3:"ὀ";s:3:"Ὁ";s:3:"ὁ";s:3:"Ὂ";s:3:"ὂ";s:3:"Ὃ";s:3:"ὃ";s:3:"Ὄ";s:3:"ὄ";s:3:"Ὅ";s:3:"ὅ";s:3:"Ὑ";s:3:"ὑ";s:3:"Ὓ";s:3:"ὓ";s:3:"Ὕ";s:3:"ὕ";s:3:"Ὗ";s:3:"ὗ";s:3:"Ὠ";s:3:"ὠ";s:3:"Ὡ";s:3:"ὡ";s:3:"Ὢ";s:3:"ὢ";s:3:"Ὣ";s:3:"ὣ";s:3:"Ὤ";s:3:"ὤ";s:3:"Ὥ";s:3:"ὥ";s:3:"Ὦ";s:3:"ὦ";s:3:"Ὧ";s:3:"ὧ";s:3:"ᾈ";s:3:"ᾀ";s:3:"ᾉ";s:3:"ᾁ";s:3:"ᾊ";s:3:"ᾂ";s:3:"ᾋ";s:3:"ᾃ";s:3:"ᾌ";s:3:"ᾄ";s:3:"ᾍ";s:3:"ᾅ";s:3:"ᾎ";s:3:"ᾆ";s:3:"ᾏ";s:3:"ᾇ";s:3:"ᾘ";s:3:"ᾐ";s:3:"ᾙ";s:3:"ᾑ";s:3:"ᾚ";s:3:"ᾒ";s:3:"ᾛ";s:3:"ᾓ";s:3:"ᾜ";s:3:"ᾔ";s:3:"ᾝ";s:3:"ᾕ";s:3:"ᾞ";s:3:"ᾖ";s:3:"ᾟ";s:3:"ᾗ";s:3:"ᾨ";s:3:"ᾠ";s:3:"ᾩ";s:3:"ᾡ";s:3:"ᾪ";s:3:"ᾢ";s:3:"ᾫ";s:3:"ᾣ";s:3:"ᾬ";s:3:"ᾤ";s:3:"ᾭ";s:3:"ᾥ";s:3:"ᾮ";s:3:"ᾦ";s:3:"ᾯ";s:3:"ᾧ";s:3:"Ᾰ";s:3:"ᾰ";s:3:"Ᾱ";s:3:"ᾱ";s:3:"Ὰ";s:3:"ὰ";s:3:"Ά";s:3:"ά";s:3:"ᾼ";s:3:"ᾳ";s:3:"Ὲ";s:3:"ὲ";s:3:"Έ";s:3:"έ";s:3:"Ὴ";s:3:"ὴ";s:3:"Ή";s:3:"ή";s:3:"ῌ";s:3:"ῃ";s:3:"Ῐ";s:3:"ῐ";s:3:"Ῑ";s:3:"ῑ";s:3:"Ὶ";s:3:"ὶ";s:3:"Ί";s:3:"ί";s:3:"Ῠ";s:3:"ῠ";s:3:"Ῡ";s:3:"ῡ";s:3:"Ὺ";s:3:"ὺ";s:3:"Ύ";s:3:"ύ";s:3:"Ῥ";s:3:"ῥ";s:3:"Ὸ";s:3:"ὸ";s:3:"Ό";s:3:"ό";s:3:"Ὼ";s:3:"ὼ";s:3:"Ώ";s:3:"ώ";s:3:"ῼ";s:3:"ῳ";s:3:"Ω";s:2:"ω";s:3:"K";s:1:"k";s:3:"Å";s:2:"å";s:3:"Ⅎ";s:3:"ⅎ";s:3:"Ⅰ";s:3:"ⅰ";s:3:"Ⅱ";s:3:"ⅱ";s:3:"Ⅲ";s:3:"ⅲ";s:3:"Ⅳ";s:3:"ⅳ";s:3:"Ⅴ";s:3:"ⅴ";s:3:"Ⅵ";s:3:"ⅵ";s:3:"Ⅶ";s:3:"ⅶ";s:3:"Ⅷ";s:3:"ⅷ";s:3:"Ⅸ";s:3:"ⅸ";s:3:"Ⅹ";s:3:"ⅹ";s:3:"Ⅺ";s:3:"ⅺ";s:3:"Ⅻ";s:3:"ⅻ";s:3:"Ⅼ";s:3:"ⅼ";s:3:"Ⅽ";s:3:"ⅽ";s:3:"Ⅾ";s:3:"ⅾ";s:3:"Ⅿ";s:3:"ⅿ";s:3:"Ↄ";s:3:"ↄ";s:3:"Ⓐ";s:3:"ⓐ";s:3:"Ⓑ";s:3:"ⓑ";s:3:"Ⓒ";s:3:"ⓒ";s:3:"Ⓓ";s:3:"ⓓ";s:3:"Ⓔ";s:3:"ⓔ";s:3:"Ⓕ";s:3:"ⓕ";s:3:"Ⓖ";s:3:"ⓖ";s:3:"Ⓗ";s:3:"ⓗ";s:3:"Ⓘ";s:3:"ⓘ";s:3:"Ⓙ";s:3:"ⓙ";s:3:"Ⓚ";s:3:"ⓚ";s:3:"Ⓛ";s:3:"ⓛ";s:3:"Ⓜ";s:3:"ⓜ";s:3:"Ⓝ";s:3:"ⓝ";s:3:"Ⓞ";s:3:"ⓞ";s:3:"Ⓟ";s:3:"ⓟ";s:3:"Ⓠ";s:3:"ⓠ";s:3:"Ⓡ";s:3:"ⓡ";s:3:"Ⓢ";s:3:"ⓢ";s:3:"Ⓣ";s:3:"ⓣ";s:3:"Ⓤ";s:3:"ⓤ";s:3:"Ⓥ";s:3:"ⓥ";s:3:"Ⓦ";s:3:"ⓦ";s:3:"Ⓧ";s:3:"ⓧ";s:3:"Ⓨ";s:3:"ⓨ";s:3:"Ⓩ";s:3:"ⓩ";s:3:"Ⰰ";s:3:"ⰰ";s:3:"Ⰱ";s:3:"ⰱ";s:3:"Ⰲ";s:3:"ⰲ";s:3:"Ⰳ";s:3:"ⰳ";s:3:"Ⰴ";s:3:"ⰴ";s:3:"Ⰵ";s:3:"ⰵ";s:3:"Ⰶ";s:3:"ⰶ";s:3:"Ⰷ";s:3:"ⰷ";s:3:"Ⰸ";s:3:"ⰸ";s:3:"Ⰹ";s:3:"ⰹ";s:3:"Ⰺ";s:3:"ⰺ";s:3:"Ⰻ";s:3:"ⰻ";s:3:"Ⰼ";s:3:"ⰼ";s:3:"Ⰽ";s:3:"ⰽ";s:3:"Ⰾ";s:3:"ⰾ";s:3:"Ⰿ";s:3:"ⰿ";s:3:"Ⱀ";s:3:"ⱀ";s:3:"Ⱁ";s:3:"ⱁ";s:3:"Ⱂ";s:3:"ⱂ";s:3:"Ⱃ";s:3:"ⱃ";s:3:"Ⱄ";s:3:"ⱄ";s:3:"Ⱅ";s:3:"ⱅ";s:3:"Ⱆ";s:3:"ⱆ";s:3:"Ⱇ";s:3:"ⱇ";s:3:"Ⱈ";s:3:"ⱈ";s:3:"Ⱉ";s:3:"ⱉ";s:3:"Ⱊ";s:3:"ⱊ";s:3:"Ⱋ";s:3:"ⱋ";s:3:"Ⱌ";s:3:"ⱌ";s:3:"Ⱍ";s:3:"ⱍ";s:3:"Ⱎ";s:3:"ⱎ";s:3:"Ⱏ";s:3:"ⱏ";s:3:"Ⱐ";s:3:"ⱐ";s:3:"Ⱑ";s:3:"ⱑ";s:3:"Ⱒ";s:3:"ⱒ";s:3:"Ⱓ";s:3:"ⱓ";s:3:"Ⱔ";s:3:"ⱔ";s:3:"Ⱕ";s:3:"ⱕ";s:3:"Ⱖ";s:3:"ⱖ";s:3:"Ⱗ";s:3:"ⱗ";s:3:"Ⱘ";s:3:"ⱘ";s:3:"Ⱙ";s:3:"ⱙ";s:3:"Ⱚ";s:3:"ⱚ";s:3:"Ⱛ";s:3:"ⱛ";s:3:"Ⱜ";s:3:"ⱜ";s:3:"Ⱝ";s:3:"ⱝ";s:3:"Ⱞ";s:3:"ⱞ";s:3:"Ⱡ";s:3:"ⱡ";s:3:"Ɫ";s:2:"ɫ";s:3:"Ᵽ";s:3:"ᵽ";s:3:"Ɽ";s:2:"ɽ";s:3:"Ⱨ";s:3:"ⱨ";s:3:"Ⱪ";s:3:"ⱪ";s:3:"Ⱬ";s:3:"ⱬ";s:3:"Ɑ";s:2:"ɑ";s:3:"Ɱ";s:2:"ɱ";s:3:"Ɐ";s:2:"ɐ";s:3:"Ɒ";s:2:"ɒ";s:3:"Ⱳ";s:3:"ⱳ";s:3:"Ⱶ";s:3:"ⱶ";s:3:"Ȿ";s:2:"ȿ";s:3:"Ɀ";s:2:"ɀ";s:3:"Ⲁ";s:3:"ⲁ";s:3:"Ⲃ";s:3:"ⲃ";s:3:"Ⲅ";s:3:"ⲅ";s:3:"Ⲇ";s:3:"ⲇ";s:3:"Ⲉ";s:3:"ⲉ";s:3:"Ⲋ";s:3:"ⲋ";s:3:"Ⲍ";s:3:"ⲍ";s:3:"Ⲏ";s:3:"ⲏ";s:3:"Ⲑ";s:3:"ⲑ";s:3:"Ⲓ";s:3:"ⲓ";s:3:"Ⲕ";s:3:"ⲕ";s:3:"Ⲗ";s:3:"ⲗ";s:3:"Ⲙ";s:3:"ⲙ";s:3:"Ⲛ";s:3:"ⲛ";s:3:"Ⲝ";s:3:"ⲝ";s:3:"Ⲟ";s:3:"ⲟ";s:3:"Ⲡ";s:3:"ⲡ";s:3:"Ⲣ";s:3:"ⲣ";s:3:"Ⲥ";s:3:"ⲥ";s:3:"Ⲧ";s:3:"ⲧ";s:3:"Ⲩ";s:3:"ⲩ";s:3:"Ⲫ";s:3:"ⲫ";s:3:"Ⲭ";s:3:"ⲭ";s:3:"Ⲯ";s:3:"ⲯ";s:3:"Ⲱ";s:3:"ⲱ";s:3:"Ⲳ";s:3:"ⲳ";s:3:"Ⲵ";s:3:"ⲵ";s:3:"Ⲷ";s:3:"ⲷ";s:3:"Ⲹ";s:3:"ⲹ";s:3:"Ⲻ";s:3:"ⲻ";s:3:"Ⲽ";s:3:"ⲽ";s:3:"Ⲿ";s:3:"ⲿ";s:3:"Ⳁ";s:3:"ⳁ";s:3:"Ⳃ";s:3:"ⳃ";s:3:"Ⳅ";s:3:"ⳅ";s:3:"Ⳇ";s:3:"ⳇ";s:3:"Ⳉ";s:3:"ⳉ";s:3:"Ⳋ";s:3:"ⳋ";s:3:"Ⳍ";s:3:"ⳍ";s:3:"Ⳏ";s:3:"ⳏ";s:3:"Ⳑ";s:3:"ⳑ";s:3:"Ⳓ";s:3:"ⳓ";s:3:"Ⳕ";s:3:"ⳕ";s:3:"Ⳗ";s:3:"ⳗ";s:3:"Ⳙ";s:3:"ⳙ";s:3:"Ⳛ";s:3:"ⳛ";s:3:"Ⳝ";s:3:"ⳝ";s:3:"Ⳟ";s:3:"ⳟ";s:3:"Ⳡ";s:3:"ⳡ";s:3:"Ⳣ";s:3:"ⳣ";s:3:"Ⳬ";s:3:"ⳬ";s:3:"Ⳮ";s:3:"ⳮ";s:3:"Ⳳ";s:3:"ⳳ";s:3:"Ꙁ";s:3:"ꙁ";s:3:"Ꙃ";s:3:"ꙃ";s:3:"Ꙅ";s:3:"ꙅ";s:3:"Ꙇ";s:3:"ꙇ";s:3:"Ꙉ";s:3:"ꙉ";s:3:"Ꙋ";s:3:"ꙋ";s:3:"Ꙍ";s:3:"ꙍ";s:3:"Ꙏ";s:3:"ꙏ";s:3:"Ꙑ";s:3:"ꙑ";s:3:"Ꙓ";s:3:"ꙓ";s:3:"Ꙕ";s:3:"ꙕ";s:3:"Ꙗ";s:3:"ꙗ";s:3:"Ꙙ";s:3:"ꙙ";s:3:"Ꙛ";s:3:"ꙛ";s:3:"Ꙝ";s:3:"ꙝ";s:3:"Ꙟ";s:3:"ꙟ";s:3:"Ꙡ";s:3:"ꙡ";s:3:"Ꙣ";s:3:"ꙣ";s:3:"Ꙥ";s:3:"ꙥ";s:3:"Ꙧ";s:3:"ꙧ";s:3:"Ꙩ";s:3:"ꙩ";s:3:"Ꙫ";s:3:"ꙫ";s:3:"Ꙭ";s:3:"ꙭ";s:3:"Ꚁ";s:3:"ꚁ";s:3:"Ꚃ";s:3:"ꚃ";s:3:"Ꚅ";s:3:"ꚅ";s:3:"Ꚇ";s:3:"ꚇ";s:3:"Ꚉ";s:3:"ꚉ";s:3:"Ꚋ";s:3:"ꚋ";s:3:"Ꚍ";s:3:"ꚍ";s:3:"Ꚏ";s:3:"ꚏ";s:3:"Ꚑ";s:3:"ꚑ";s:3:"Ꚓ";s:3:"ꚓ";s:3:"Ꚕ";s:3:"ꚕ";s:3:"Ꚗ";s:3:"ꚗ";s:3:"Ꚙ";s:3:"ꚙ";s:3:"Ꚛ";s:3:"ꚛ";s:3:"Ꜣ";s:3:"ꜣ";s:3:"Ꜥ";s:3:"ꜥ";s:3:"Ꜧ";s:3:"ꜧ";s:3:"Ꜩ";s:3:"ꜩ";s:3:"Ꜫ";s:3:"ꜫ";s:3:"Ꜭ";s:3:"ꜭ";s:3:"Ꜯ";s:3:"ꜯ";s:3:"Ꜳ";s:3:"ꜳ";s:3:"Ꜵ";s:3:"ꜵ";s:3:"Ꜷ";s:3:"ꜷ";s:3:"Ꜹ";s:3:"ꜹ";s:3:"Ꜻ";s:3:"ꜻ";s:3:"Ꜽ";s:3:"ꜽ";s:3:"Ꜿ";s:3:"ꜿ";s:3:"Ꝁ";s:3:"ꝁ";s:3:"Ꝃ";s:3:"ꝃ";s:3:"Ꝅ";s:3:"ꝅ";s:3:"Ꝇ";s:3:"ꝇ";s:3:"Ꝉ";s:3:"ꝉ";s:3:"Ꝋ";s:3:"ꝋ";s:3:"Ꝍ";s:3:"ꝍ";s:3:"Ꝏ";s:3:"ꝏ";s:3:"Ꝑ";s:3:"ꝑ";s:3:"Ꝓ";s:3:"ꝓ";s:3:"Ꝕ";s:3:"ꝕ";s:3:"Ꝗ";s:3:"ꝗ";s:3:"Ꝙ";s:3:"ꝙ";s:3:"Ꝛ";s:3:"ꝛ";s:3:"Ꝝ";s:3:"ꝝ";s:3:"Ꝟ";s:3:"ꝟ";s:3:"Ꝡ";s:3:"ꝡ";s:3:"Ꝣ";s:3:"ꝣ";s:3:"Ꝥ";s:3:"ꝥ";s:3:"Ꝧ";s:3:"ꝧ";s:3:"Ꝩ";s:3:"ꝩ";s:3:"Ꝫ";s:3:"ꝫ";s:3:"Ꝭ";s:3:"ꝭ";s:3:"Ꝯ";s:3:"ꝯ";s:3:"Ꝺ";s:3:"ꝺ";s:3:"Ꝼ";s:3:"ꝼ";s:3:"Ᵹ";s:3:"ᵹ";s:3:"Ꝿ";s:3:"ꝿ";s:3:"Ꞁ";s:3:"ꞁ";s:3:"Ꞃ";s:3:"ꞃ";s:3:"Ꞅ";s:3:"ꞅ";s:3:"Ꞇ";s:3:"ꞇ";s:3:"Ꞌ";s:3:"ꞌ";s:3:"Ɥ";s:2:"ɥ";s:3:"Ꞑ";s:3:"ꞑ";s:3:"Ꞓ";s:3:"ꞓ";s:3:"Ꞗ";s:3:"ꞗ";s:3:"Ꞙ";s:3:"ꞙ";s:3:"Ꞛ";s:3:"ꞛ";s:3:"Ꞝ";s:3:"ꞝ";s:3:"Ꞟ";s:3:"ꞟ";s:3:"Ꞡ";s:3:"ꞡ";s:3:"Ꞣ";s:3:"ꞣ";s:3:"Ꞥ";s:3:"ꞥ";s:3:"Ꞧ";s:3:"ꞧ";s:3:"Ꞩ";s:3:"ꞩ";s:3:"Ɦ";s:2:"ɦ";s:3:"Ɜ";s:2:"ɜ";s:3:"Ɡ";s:2:"ɡ";s:3:"Ɬ";s:2:"ɬ";s:3:"Ʞ";s:2:"ʞ";s:3:"Ʇ";s:2:"ʇ";s:3:"A";s:3:"a";s:3:"B";s:3:"b";s:3:"C";s:3:"c";s:3:"D";s:3:"d";s:3:"E";s:3:"e";s:3:"F";s:3:"f";s:3:"G";s:3:"g";s:3:"H";s:3:"h";s:3:"I";s:3:"i";s:3:"J";s:3:"j";s:3:"K";s:3:"k";s:3:"L";s:3:"l";s:3:"M";s:3:"m";s:3:"N";s:3:"n";s:3:"O";s:3:"o";s:3:"P";s:3:"p";s:3:"Q";s:3:"q";s:3:"R";s:3:"r";s:3:"S";s:3:"s";s:3:"T";s:3:"t";s:3:"U";s:3:"u";s:3:"V";s:3:"v";s:3:"W";s:3:"w";s:3:"X";s:3:"x";s:3:"Y";s:3:"y";s:3:"Z";s:3:"z";s:4:"𐐀";s:4:"𐐨";s:4:"𐐁";s:4:"𐐩";s:4:"𐐂";s:4:"𐐪";s:4:"𐐃";s:4:"𐐫";s:4:"𐐄";s:4:"𐐬";s:4:"𐐅";s:4:"𐐭";s:4:"𐐆";s:4:"𐐮";s:4:"𐐇";s:4:"𐐯";s:4:"𐐈";s:4:"𐐰";s:4:"𐐉";s:4:"𐐱";s:4:"𐐊";s:4:"𐐲";s:4:"𐐋";s:4:"𐐳";s:4:"𐐌";s:4:"𐐴";s:4:"𐐍";s:4:"𐐵";s:4:"𐐎";s:4:"𐐶";s:4:"𐐏";s:4:"𐐷";s:4:"𐐐";s:4:"𐐸";s:4:"𐐑";s:4:"𐐹";s:4:"𐐒";s:4:"𐐺";s:4:"𐐓";s:4:"𐐻";s:4:"𐐔";s:4:"𐐼";s:4:"𐐕";s:4:"𐐽";s:4:"𐐖";s:4:"𐐾";s:4:"𐐗";s:4:"𐐿";s:4:"𐐘";s:4:"𐑀";s:4:"𐐙";s:4:"𐑁";s:4:"𐐚";s:4:"𐑂";s:4:"𐐛";s:4:"𐑃";s:4:"𐐜";s:4:"𐑄";s:4:"𐐝";s:4:"𐑅";s:4:"𐐞";s:4:"𐑆";s:4:"𐐟";s:4:"𐑇";s:4:"𐐠";s:4:"𐑈";s:4:"𐐡";s:4:"𐑉";s:4:"𐐢";s:4:"𐑊";s:4:"𐐣";s:4:"𐑋";s:4:"𐐤";s:4:"𐑌";s:4:"𐐥";s:4:"𐑍";s:4:"𐐦";s:4:"𐑎";s:4:"𐐧";s:4:"𐑏";s:4:"𑢠";s:4:"𑣀";s:4:"𑢡";s:4:"𑣁";s:4:"𑢢";s:4:"𑣂";s:4:"𑢣";s:4:"𑣃";s:4:"𑢤";s:4:"𑣄";s:4:"𑢥";s:4:"𑣅";s:4:"𑢦";s:4:"𑣆";s:4:"𑢧";s:4:"𑣇";s:4:"𑢨";s:4:"𑣈";s:4:"𑢩";s:4:"𑣉";s:4:"𑢪";s:4:"𑣊";s:4:"𑢫";s:4:"𑣋";s:4:"𑢬";s:4:"𑣌";s:4:"𑢭";s:4:"𑣍";s:4:"𑢮";s:4:"𑣎";s:4:"𑢯";s:4:"𑣏";s:4:"𑢰";s:4:"𑣐";s:4:"𑢱";s:4:"𑣑";s:4:"𑢲";s:4:"𑣒";s:4:"𑢳";s:4:"𑣓";s:4:"𑢴";s:4:"𑣔";s:4:"𑢵";s:4:"𑣕";s:4:"𑢶";s:4:"𑣖";s:4:"𑢷";s:4:"𑣗";s:4:"𑢸";s:4:"𑣘";s:4:"𑢹";s:4:"𑣙";s:4:"𑢺";s:4:"𑣚";s:4:"𑢻";s:4:"𑣛";s:4:"𑢼";s:4:"𑣜";s:4:"𑢽";s:4:"𑣝";s:4:"𑢾";s:4:"𑣞";s:4:"𑢿";s:4:"𑣟";} \ No newline at end of file +a:1390:{s:1:"A";s:1:"a";s:1:"B";s:1:"b";s:1:"C";s:1:"c";s:1:"D";s:1:"d";s:1:"E";s:1:"e";s:1:"F";s:1:"f";s:1:"G";s:1:"g";s:1:"H";s:1:"h";s:1:"I";s:1:"i";s:1:"J";s:1:"j";s:1:"K";s:1:"k";s:1:"L";s:1:"l";s:1:"M";s:1:"m";s:1:"N";s:1:"n";s:1:"O";s:1:"o";s:1:"P";s:1:"p";s:1:"Q";s:1:"q";s:1:"R";s:1:"r";s:1:"S";s:1:"s";s:1:"T";s:1:"t";s:1:"U";s:1:"u";s:1:"V";s:1:"v";s:1:"W";s:1:"w";s:1:"X";s:1:"x";s:1:"Y";s:1:"y";s:1:"Z";s:1:"z";s:2:"À";s:2:"à";s:2:"Á";s:2:"á";s:2:"Â";s:2:"â";s:2:"Ã";s:2:"ã";s:2:"Ä";s:2:"ä";s:2:"Å";s:2:"å";s:2:"Æ";s:2:"æ";s:2:"Ç";s:2:"ç";s:2:"È";s:2:"è";s:2:"É";s:2:"é";s:2:"Ê";s:2:"ê";s:2:"Ë";s:2:"ë";s:2:"Ì";s:2:"ì";s:2:"Í";s:2:"í";s:2:"Î";s:2:"î";s:2:"Ï";s:2:"ï";s:2:"Ð";s:2:"ð";s:2:"Ñ";s:2:"ñ";s:2:"Ò";s:2:"ò";s:2:"Ó";s:2:"ó";s:2:"Ô";s:2:"ô";s:2:"Õ";s:2:"õ";s:2:"Ö";s:2:"ö";s:2:"Ø";s:2:"ø";s:2:"Ù";s:2:"ù";s:2:"Ú";s:2:"ú";s:2:"Û";s:2:"û";s:2:"Ü";s:2:"ü";s:2:"Ý";s:2:"ý";s:2:"Þ";s:2:"þ";s:2:"Ā";s:2:"ā";s:2:"Ă";s:2:"ă";s:2:"Ą";s:2:"ą";s:2:"Ć";s:2:"ć";s:2:"Ĉ";s:2:"ĉ";s:2:"Ċ";s:2:"ċ";s:2:"Č";s:2:"č";s:2:"Ď";s:2:"ď";s:2:"Đ";s:2:"đ";s:2:"Ē";s:2:"ē";s:2:"Ĕ";s:2:"ĕ";s:2:"Ė";s:2:"ė";s:2:"Ę";s:2:"ę";s:2:"Ě";s:2:"ě";s:2:"Ĝ";s:2:"ĝ";s:2:"Ğ";s:2:"ğ";s:2:"Ġ";s:2:"ġ";s:2:"Ģ";s:2:"ģ";s:2:"Ĥ";s:2:"ĥ";s:2:"Ħ";s:2:"ħ";s:2:"Ĩ";s:2:"ĩ";s:2:"Ī";s:2:"ī";s:2:"Ĭ";s:2:"ĭ";s:2:"Į";s:2:"į";s:2:"İ";s:1:"i";s:2:"IJ";s:2:"ij";s:2:"Ĵ";s:2:"ĵ";s:2:"Ķ";s:2:"ķ";s:2:"Ĺ";s:2:"ĺ";s:2:"Ļ";s:2:"ļ";s:2:"Ľ";s:2:"ľ";s:2:"Ŀ";s:2:"ŀ";s:2:"Ł";s:2:"ł";s:2:"Ń";s:2:"ń";s:2:"Ņ";s:2:"ņ";s:2:"Ň";s:2:"ň";s:2:"Ŋ";s:2:"ŋ";s:2:"Ō";s:2:"ō";s:2:"Ŏ";s:2:"ŏ";s:2:"Ő";s:2:"ő";s:2:"Œ";s:2:"œ";s:2:"Ŕ";s:2:"ŕ";s:2:"Ŗ";s:2:"ŗ";s:2:"Ř";s:2:"ř";s:2:"Ś";s:2:"ś";s:2:"Ŝ";s:2:"ŝ";s:2:"Ş";s:2:"ş";s:2:"Š";s:2:"š";s:2:"Ţ";s:2:"ţ";s:2:"Ť";s:2:"ť";s:2:"Ŧ";s:2:"ŧ";s:2:"Ũ";s:2:"ũ";s:2:"Ū";s:2:"ū";s:2:"Ŭ";s:2:"ŭ";s:2:"Ů";s:2:"ů";s:2:"Ű";s:2:"ű";s:2:"Ų";s:2:"ų";s:2:"Ŵ";s:2:"ŵ";s:2:"Ŷ";s:2:"ŷ";s:2:"Ÿ";s:2:"ÿ";s:2:"Ź";s:2:"ź";s:2:"Ż";s:2:"ż";s:2:"Ž";s:2:"ž";s:2:"Ɓ";s:2:"ɓ";s:2:"Ƃ";s:2:"ƃ";s:2:"Ƅ";s:2:"ƅ";s:2:"Ɔ";s:2:"ɔ";s:2:"Ƈ";s:2:"ƈ";s:2:"Ɖ";s:2:"ɖ";s:2:"Ɗ";s:2:"ɗ";s:2:"Ƌ";s:2:"ƌ";s:2:"Ǝ";s:2:"ǝ";s:2:"Ə";s:2:"ə";s:2:"Ɛ";s:2:"ɛ";s:2:"Ƒ";s:2:"ƒ";s:2:"Ɠ";s:2:"ɠ";s:2:"Ɣ";s:2:"ɣ";s:2:"Ɩ";s:2:"ɩ";s:2:"Ɨ";s:2:"ɨ";s:2:"Ƙ";s:2:"ƙ";s:2:"Ɯ";s:2:"ɯ";s:2:"Ɲ";s:2:"ɲ";s:2:"Ɵ";s:2:"ɵ";s:2:"Ơ";s:2:"ơ";s:2:"Ƣ";s:2:"ƣ";s:2:"Ƥ";s:2:"ƥ";s:2:"Ʀ";s:2:"ʀ";s:2:"Ƨ";s:2:"ƨ";s:2:"Ʃ";s:2:"ʃ";s:2:"Ƭ";s:2:"ƭ";s:2:"Ʈ";s:2:"ʈ";s:2:"Ư";s:2:"ư";s:2:"Ʊ";s:2:"ʊ";s:2:"Ʋ";s:2:"ʋ";s:2:"Ƴ";s:2:"ƴ";s:2:"Ƶ";s:2:"ƶ";s:2:"Ʒ";s:2:"ʒ";s:2:"Ƹ";s:2:"ƹ";s:2:"Ƽ";s:2:"ƽ";s:2:"DŽ";s:2:"dž";s:2:"Dž";s:2:"dž";s:2:"LJ";s:2:"lj";s:2:"Lj";s:2:"lj";s:2:"NJ";s:2:"nj";s:2:"Nj";s:2:"nj";s:2:"Ǎ";s:2:"ǎ";s:2:"Ǐ";s:2:"ǐ";s:2:"Ǒ";s:2:"ǒ";s:2:"Ǔ";s:2:"ǔ";s:2:"Ǖ";s:2:"ǖ";s:2:"Ǘ";s:2:"ǘ";s:2:"Ǚ";s:2:"ǚ";s:2:"Ǜ";s:2:"ǜ";s:2:"Ǟ";s:2:"ǟ";s:2:"Ǡ";s:2:"ǡ";s:2:"Ǣ";s:2:"ǣ";s:2:"Ǥ";s:2:"ǥ";s:2:"Ǧ";s:2:"ǧ";s:2:"Ǩ";s:2:"ǩ";s:2:"Ǫ";s:2:"ǫ";s:2:"Ǭ";s:2:"ǭ";s:2:"Ǯ";s:2:"ǯ";s:2:"DZ";s:2:"dz";s:2:"Dz";s:2:"dz";s:2:"Ǵ";s:2:"ǵ";s:2:"Ƕ";s:2:"ƕ";s:2:"Ƿ";s:2:"ƿ";s:2:"Ǹ";s:2:"ǹ";s:2:"Ǻ";s:2:"ǻ";s:2:"Ǽ";s:2:"ǽ";s:2:"Ǿ";s:2:"ǿ";s:2:"Ȁ";s:2:"ȁ";s:2:"Ȃ";s:2:"ȃ";s:2:"Ȅ";s:2:"ȅ";s:2:"Ȇ";s:2:"ȇ";s:2:"Ȉ";s:2:"ȉ";s:2:"Ȋ";s:2:"ȋ";s:2:"Ȍ";s:2:"ȍ";s:2:"Ȏ";s:2:"ȏ";s:2:"Ȑ";s:2:"ȑ";s:2:"Ȓ";s:2:"ȓ";s:2:"Ȕ";s:2:"ȕ";s:2:"Ȗ";s:2:"ȗ";s:2:"Ș";s:2:"ș";s:2:"Ț";s:2:"ț";s:2:"Ȝ";s:2:"ȝ";s:2:"Ȟ";s:2:"ȟ";s:2:"Ƞ";s:2:"ƞ";s:2:"Ȣ";s:2:"ȣ";s:2:"Ȥ";s:2:"ȥ";s:2:"Ȧ";s:2:"ȧ";s:2:"Ȩ";s:2:"ȩ";s:2:"Ȫ";s:2:"ȫ";s:2:"Ȭ";s:2:"ȭ";s:2:"Ȯ";s:2:"ȯ";s:2:"Ȱ";s:2:"ȱ";s:2:"Ȳ";s:2:"ȳ";s:2:"Ⱥ";s:3:"ⱥ";s:2:"Ȼ";s:2:"ȼ";s:2:"Ƚ";s:2:"ƚ";s:2:"Ⱦ";s:3:"ⱦ";s:2:"Ɂ";s:2:"ɂ";s:2:"Ƀ";s:2:"ƀ";s:2:"Ʉ";s:2:"ʉ";s:2:"Ʌ";s:2:"ʌ";s:2:"Ɇ";s:2:"ɇ";s:2:"Ɉ";s:2:"ɉ";s:2:"Ɋ";s:2:"ɋ";s:2:"Ɍ";s:2:"ɍ";s:2:"Ɏ";s:2:"ɏ";s:2:"Ͱ";s:2:"ͱ";s:2:"Ͳ";s:2:"ͳ";s:2:"Ͷ";s:2:"ͷ";s:2:"Ϳ";s:2:"ϳ";s:2:"Ά";s:2:"ά";s:2:"Έ";s:2:"έ";s:2:"Ή";s:2:"ή";s:2:"Ί";s:2:"ί";s:2:"Ό";s:2:"ό";s:2:"Ύ";s:2:"ύ";s:2:"Ώ";s:2:"ώ";s:2:"Α";s:2:"α";s:2:"Β";s:2:"β";s:2:"Γ";s:2:"γ";s:2:"Δ";s:2:"δ";s:2:"Ε";s:2:"ε";s:2:"Ζ";s:2:"ζ";s:2:"Η";s:2:"η";s:2:"Θ";s:2:"θ";s:2:"Ι";s:2:"ι";s:2:"Κ";s:2:"κ";s:2:"Λ";s:2:"λ";s:2:"Μ";s:2:"μ";s:2:"Ν";s:2:"ν";s:2:"Ξ";s:2:"ξ";s:2:"Ο";s:2:"ο";s:2:"Π";s:2:"π";s:2:"Ρ";s:2:"ρ";s:2:"Σ";s:2:"σ";s:2:"Τ";s:2:"τ";s:2:"Υ";s:2:"υ";s:2:"Φ";s:2:"φ";s:2:"Χ";s:2:"χ";s:2:"Ψ";s:2:"ψ";s:2:"Ω";s:2:"ω";s:2:"Ϊ";s:2:"ϊ";s:2:"Ϋ";s:2:"ϋ";s:2:"Ϗ";s:2:"ϗ";s:2:"Ϙ";s:2:"ϙ";s:2:"Ϛ";s:2:"ϛ";s:2:"Ϝ";s:2:"ϝ";s:2:"Ϟ";s:2:"ϟ";s:2:"Ϡ";s:2:"ϡ";s:2:"Ϣ";s:2:"ϣ";s:2:"Ϥ";s:2:"ϥ";s:2:"Ϧ";s:2:"ϧ";s:2:"Ϩ";s:2:"ϩ";s:2:"Ϫ";s:2:"ϫ";s:2:"Ϭ";s:2:"ϭ";s:2:"Ϯ";s:2:"ϯ";s:2:"ϴ";s:2:"θ";s:2:"Ϸ";s:2:"ϸ";s:2:"Ϲ";s:2:"ϲ";s:2:"Ϻ";s:2:"ϻ";s:2:"Ͻ";s:2:"ͻ";s:2:"Ͼ";s:2:"ͼ";s:2:"Ͽ";s:2:"ͽ";s:2:"Ѐ";s:2:"ѐ";s:2:"Ё";s:2:"ё";s:2:"Ђ";s:2:"ђ";s:2:"Ѓ";s:2:"ѓ";s:2:"Є";s:2:"є";s:2:"Ѕ";s:2:"ѕ";s:2:"І";s:2:"і";s:2:"Ї";s:2:"ї";s:2:"Ј";s:2:"ј";s:2:"Љ";s:2:"љ";s:2:"Њ";s:2:"њ";s:2:"Ћ";s:2:"ћ";s:2:"Ќ";s:2:"ќ";s:2:"Ѝ";s:2:"ѝ";s:2:"Ў";s:2:"ў";s:2:"Џ";s:2:"џ";s:2:"А";s:2:"а";s:2:"Б";s:2:"б";s:2:"В";s:2:"в";s:2:"Г";s:2:"г";s:2:"Д";s:2:"д";s:2:"Е";s:2:"е";s:2:"Ж";s:2:"ж";s:2:"З";s:2:"з";s:2:"И";s:2:"и";s:2:"Й";s:2:"й";s:2:"К";s:2:"к";s:2:"Л";s:2:"л";s:2:"М";s:2:"м";s:2:"Н";s:2:"н";s:2:"О";s:2:"о";s:2:"П";s:2:"п";s:2:"Р";s:2:"р";s:2:"С";s:2:"с";s:2:"Т";s:2:"т";s:2:"У";s:2:"у";s:2:"Ф";s:2:"ф";s:2:"Х";s:2:"х";s:2:"Ц";s:2:"ц";s:2:"Ч";s:2:"ч";s:2:"Ш";s:2:"ш";s:2:"Щ";s:2:"щ";s:2:"Ъ";s:2:"ъ";s:2:"Ы";s:2:"ы";s:2:"Ь";s:2:"ь";s:2:"Э";s:2:"э";s:2:"Ю";s:2:"ю";s:2:"Я";s:2:"я";s:2:"Ѡ";s:2:"ѡ";s:2:"Ѣ";s:2:"ѣ";s:2:"Ѥ";s:2:"ѥ";s:2:"Ѧ";s:2:"ѧ";s:2:"Ѩ";s:2:"ѩ";s:2:"Ѫ";s:2:"ѫ";s:2:"Ѭ";s:2:"ѭ";s:2:"Ѯ";s:2:"ѯ";s:2:"Ѱ";s:2:"ѱ";s:2:"Ѳ";s:2:"ѳ";s:2:"Ѵ";s:2:"ѵ";s:2:"Ѷ";s:2:"ѷ";s:2:"Ѹ";s:2:"ѹ";s:2:"Ѻ";s:2:"ѻ";s:2:"Ѽ";s:2:"ѽ";s:2:"Ѿ";s:2:"ѿ";s:2:"Ҁ";s:2:"ҁ";s:2:"Ҋ";s:2:"ҋ";s:2:"Ҍ";s:2:"ҍ";s:2:"Ҏ";s:2:"ҏ";s:2:"Ґ";s:2:"ґ";s:2:"Ғ";s:2:"ғ";s:2:"Ҕ";s:2:"ҕ";s:2:"Җ";s:2:"җ";s:2:"Ҙ";s:2:"ҙ";s:2:"Қ";s:2:"қ";s:2:"Ҝ";s:2:"ҝ";s:2:"Ҟ";s:2:"ҟ";s:2:"Ҡ";s:2:"ҡ";s:2:"Ң";s:2:"ң";s:2:"Ҥ";s:2:"ҥ";s:2:"Ҧ";s:2:"ҧ";s:2:"Ҩ";s:2:"ҩ";s:2:"Ҫ";s:2:"ҫ";s:2:"Ҭ";s:2:"ҭ";s:2:"Ү";s:2:"ү";s:2:"Ұ";s:2:"ұ";s:2:"Ҳ";s:2:"ҳ";s:2:"Ҵ";s:2:"ҵ";s:2:"Ҷ";s:2:"ҷ";s:2:"Ҹ";s:2:"ҹ";s:2:"Һ";s:2:"һ";s:2:"Ҽ";s:2:"ҽ";s:2:"Ҿ";s:2:"ҿ";s:2:"Ӏ";s:2:"ӏ";s:2:"Ӂ";s:2:"ӂ";s:2:"Ӄ";s:2:"ӄ";s:2:"Ӆ";s:2:"ӆ";s:2:"Ӈ";s:2:"ӈ";s:2:"Ӊ";s:2:"ӊ";s:2:"Ӌ";s:2:"ӌ";s:2:"Ӎ";s:2:"ӎ";s:2:"Ӑ";s:2:"ӑ";s:2:"Ӓ";s:2:"ӓ";s:2:"Ӕ";s:2:"ӕ";s:2:"Ӗ";s:2:"ӗ";s:2:"Ә";s:2:"ә";s:2:"Ӛ";s:2:"ӛ";s:2:"Ӝ";s:2:"ӝ";s:2:"Ӟ";s:2:"ӟ";s:2:"Ӡ";s:2:"ӡ";s:2:"Ӣ";s:2:"ӣ";s:2:"Ӥ";s:2:"ӥ";s:2:"Ӧ";s:2:"ӧ";s:2:"Ө";s:2:"ө";s:2:"Ӫ";s:2:"ӫ";s:2:"Ӭ";s:2:"ӭ";s:2:"Ӯ";s:2:"ӯ";s:2:"Ӱ";s:2:"ӱ";s:2:"Ӳ";s:2:"ӳ";s:2:"Ӵ";s:2:"ӵ";s:2:"Ӷ";s:2:"ӷ";s:2:"Ӹ";s:2:"ӹ";s:2:"Ӻ";s:2:"ӻ";s:2:"Ӽ";s:2:"ӽ";s:2:"Ӿ";s:2:"ӿ";s:2:"Ԁ";s:2:"ԁ";s:2:"Ԃ";s:2:"ԃ";s:2:"Ԅ";s:2:"ԅ";s:2:"Ԇ";s:2:"ԇ";s:2:"Ԉ";s:2:"ԉ";s:2:"Ԋ";s:2:"ԋ";s:2:"Ԍ";s:2:"ԍ";s:2:"Ԏ";s:2:"ԏ";s:2:"Ԑ";s:2:"ԑ";s:2:"Ԓ";s:2:"ԓ";s:2:"Ԕ";s:2:"ԕ";s:2:"Ԗ";s:2:"ԗ";s:2:"Ԙ";s:2:"ԙ";s:2:"Ԛ";s:2:"ԛ";s:2:"Ԝ";s:2:"ԝ";s:2:"Ԟ";s:2:"ԟ";s:2:"Ԡ";s:2:"ԡ";s:2:"Ԣ";s:2:"ԣ";s:2:"Ԥ";s:2:"ԥ";s:2:"Ԧ";s:2:"ԧ";s:2:"Ԩ";s:2:"ԩ";s:2:"Ԫ";s:2:"ԫ";s:2:"Ԭ";s:2:"ԭ";s:2:"Ԯ";s:2:"ԯ";s:2:"Ա";s:2:"ա";s:2:"Բ";s:2:"բ";s:2:"Գ";s:2:"գ";s:2:"Դ";s:2:"դ";s:2:"Ե";s:2:"ե";s:2:"Զ";s:2:"զ";s:2:"Է";s:2:"է";s:2:"Ը";s:2:"ը";s:2:"Թ";s:2:"թ";s:2:"Ժ";s:2:"ժ";s:2:"Ի";s:2:"ի";s:2:"Լ";s:2:"լ";s:2:"Խ";s:2:"խ";s:2:"Ծ";s:2:"ծ";s:2:"Կ";s:2:"կ";s:2:"Հ";s:2:"հ";s:2:"Ձ";s:2:"ձ";s:2:"Ղ";s:2:"ղ";s:2:"Ճ";s:2:"ճ";s:2:"Մ";s:2:"մ";s:2:"Յ";s:2:"յ";s:2:"Ն";s:2:"ն";s:2:"Շ";s:2:"շ";s:2:"Ո";s:2:"ո";s:2:"Չ";s:2:"չ";s:2:"Պ";s:2:"պ";s:2:"Ջ";s:2:"ջ";s:2:"Ռ";s:2:"ռ";s:2:"Ս";s:2:"ս";s:2:"Վ";s:2:"վ";s:2:"Տ";s:2:"տ";s:2:"Ր";s:2:"ր";s:2:"Ց";s:2:"ց";s:2:"Ւ";s:2:"ւ";s:2:"Փ";s:2:"փ";s:2:"Ք";s:2:"ք";s:2:"Օ";s:2:"օ";s:2:"Ֆ";s:2:"ֆ";s:3:"Ⴀ";s:3:"ⴀ";s:3:"Ⴁ";s:3:"ⴁ";s:3:"Ⴂ";s:3:"ⴂ";s:3:"Ⴃ";s:3:"ⴃ";s:3:"Ⴄ";s:3:"ⴄ";s:3:"Ⴅ";s:3:"ⴅ";s:3:"Ⴆ";s:3:"ⴆ";s:3:"Ⴇ";s:3:"ⴇ";s:3:"Ⴈ";s:3:"ⴈ";s:3:"Ⴉ";s:3:"ⴉ";s:3:"Ⴊ";s:3:"ⴊ";s:3:"Ⴋ";s:3:"ⴋ";s:3:"Ⴌ";s:3:"ⴌ";s:3:"Ⴍ";s:3:"ⴍ";s:3:"Ⴎ";s:3:"ⴎ";s:3:"Ⴏ";s:3:"ⴏ";s:3:"Ⴐ";s:3:"ⴐ";s:3:"Ⴑ";s:3:"ⴑ";s:3:"Ⴒ";s:3:"ⴒ";s:3:"Ⴓ";s:3:"ⴓ";s:3:"Ⴔ";s:3:"ⴔ";s:3:"Ⴕ";s:3:"ⴕ";s:3:"Ⴖ";s:3:"ⴖ";s:3:"Ⴗ";s:3:"ⴗ";s:3:"Ⴘ";s:3:"ⴘ";s:3:"Ⴙ";s:3:"ⴙ";s:3:"Ⴚ";s:3:"ⴚ";s:3:"Ⴛ";s:3:"ⴛ";s:3:"Ⴜ";s:3:"ⴜ";s:3:"Ⴝ";s:3:"ⴝ";s:3:"Ⴞ";s:3:"ⴞ";s:3:"Ⴟ";s:3:"ⴟ";s:3:"Ⴠ";s:3:"ⴠ";s:3:"Ⴡ";s:3:"ⴡ";s:3:"Ⴢ";s:3:"ⴢ";s:3:"Ⴣ";s:3:"ⴣ";s:3:"Ⴤ";s:3:"ⴤ";s:3:"Ⴥ";s:3:"ⴥ";s:3:"Ⴧ";s:3:"ⴧ";s:3:"Ⴭ";s:3:"ⴭ";s:3:"Ꭰ";s:3:"ꭰ";s:3:"Ꭱ";s:3:"ꭱ";s:3:"Ꭲ";s:3:"ꭲ";s:3:"Ꭳ";s:3:"ꭳ";s:3:"Ꭴ";s:3:"ꭴ";s:3:"Ꭵ";s:3:"ꭵ";s:3:"Ꭶ";s:3:"ꭶ";s:3:"Ꭷ";s:3:"ꭷ";s:3:"Ꭸ";s:3:"ꭸ";s:3:"Ꭹ";s:3:"ꭹ";s:3:"Ꭺ";s:3:"ꭺ";s:3:"Ꭻ";s:3:"ꭻ";s:3:"Ꭼ";s:3:"ꭼ";s:3:"Ꭽ";s:3:"ꭽ";s:3:"Ꭾ";s:3:"ꭾ";s:3:"Ꭿ";s:3:"ꭿ";s:3:"Ꮀ";s:3:"ꮀ";s:3:"Ꮁ";s:3:"ꮁ";s:3:"Ꮂ";s:3:"ꮂ";s:3:"Ꮃ";s:3:"ꮃ";s:3:"Ꮄ";s:3:"ꮄ";s:3:"Ꮅ";s:3:"ꮅ";s:3:"Ꮆ";s:3:"ꮆ";s:3:"Ꮇ";s:3:"ꮇ";s:3:"Ꮈ";s:3:"ꮈ";s:3:"Ꮉ";s:3:"ꮉ";s:3:"Ꮊ";s:3:"ꮊ";s:3:"Ꮋ";s:3:"ꮋ";s:3:"Ꮌ";s:3:"ꮌ";s:3:"Ꮍ";s:3:"ꮍ";s:3:"Ꮎ";s:3:"ꮎ";s:3:"Ꮏ";s:3:"ꮏ";s:3:"Ꮐ";s:3:"ꮐ";s:3:"Ꮑ";s:3:"ꮑ";s:3:"Ꮒ";s:3:"ꮒ";s:3:"Ꮓ";s:3:"ꮓ";s:3:"Ꮔ";s:3:"ꮔ";s:3:"Ꮕ";s:3:"ꮕ";s:3:"Ꮖ";s:3:"ꮖ";s:3:"Ꮗ";s:3:"ꮗ";s:3:"Ꮘ";s:3:"ꮘ";s:3:"Ꮙ";s:3:"ꮙ";s:3:"Ꮚ";s:3:"ꮚ";s:3:"Ꮛ";s:3:"ꮛ";s:3:"Ꮜ";s:3:"ꮜ";s:3:"Ꮝ";s:3:"ꮝ";s:3:"Ꮞ";s:3:"ꮞ";s:3:"Ꮟ";s:3:"ꮟ";s:3:"Ꮠ";s:3:"ꮠ";s:3:"Ꮡ";s:3:"ꮡ";s:3:"Ꮢ";s:3:"ꮢ";s:3:"Ꮣ";s:3:"ꮣ";s:3:"Ꮤ";s:3:"ꮤ";s:3:"Ꮥ";s:3:"ꮥ";s:3:"Ꮦ";s:3:"ꮦ";s:3:"Ꮧ";s:3:"ꮧ";s:3:"Ꮨ";s:3:"ꮨ";s:3:"Ꮩ";s:3:"ꮩ";s:3:"Ꮪ";s:3:"ꮪ";s:3:"Ꮫ";s:3:"ꮫ";s:3:"Ꮬ";s:3:"ꮬ";s:3:"Ꮭ";s:3:"ꮭ";s:3:"Ꮮ";s:3:"ꮮ";s:3:"Ꮯ";s:3:"ꮯ";s:3:"Ꮰ";s:3:"ꮰ";s:3:"Ꮱ";s:3:"ꮱ";s:3:"Ꮲ";s:3:"ꮲ";s:3:"Ꮳ";s:3:"ꮳ";s:3:"Ꮴ";s:3:"ꮴ";s:3:"Ꮵ";s:3:"ꮵ";s:3:"Ꮶ";s:3:"ꮶ";s:3:"Ꮷ";s:3:"ꮷ";s:3:"Ꮸ";s:3:"ꮸ";s:3:"Ꮹ";s:3:"ꮹ";s:3:"Ꮺ";s:3:"ꮺ";s:3:"Ꮻ";s:3:"ꮻ";s:3:"Ꮼ";s:3:"ꮼ";s:3:"Ꮽ";s:3:"ꮽ";s:3:"Ꮾ";s:3:"ꮾ";s:3:"Ꮿ";s:3:"ꮿ";s:3:"Ᏸ";s:3:"ᏸ";s:3:"Ᏹ";s:3:"ᏹ";s:3:"Ᏺ";s:3:"ᏺ";s:3:"Ᏻ";s:3:"ᏻ";s:3:"Ᏼ";s:3:"ᏼ";s:3:"Ᏽ";s:3:"ᏽ";s:3:"Ა";s:3:"ა";s:3:"Ბ";s:3:"ბ";s:3:"Გ";s:3:"გ";s:3:"Დ";s:3:"დ";s:3:"Ე";s:3:"ე";s:3:"Ვ";s:3:"ვ";s:3:"Ზ";s:3:"ზ";s:3:"Თ";s:3:"თ";s:3:"Ი";s:3:"ი";s:3:"Კ";s:3:"კ";s:3:"Ლ";s:3:"ლ";s:3:"Მ";s:3:"მ";s:3:"Ნ";s:3:"ნ";s:3:"Ო";s:3:"ო";s:3:"Პ";s:3:"პ";s:3:"Ჟ";s:3:"ჟ";s:3:"Რ";s:3:"რ";s:3:"Ს";s:3:"ს";s:3:"Ტ";s:3:"ტ";s:3:"Უ";s:3:"უ";s:3:"Ფ";s:3:"ფ";s:3:"Ქ";s:3:"ქ";s:3:"Ღ";s:3:"ღ";s:3:"Ყ";s:3:"ყ";s:3:"Შ";s:3:"შ";s:3:"Ჩ";s:3:"ჩ";s:3:"Ც";s:3:"ც";s:3:"Ძ";s:3:"ძ";s:3:"Წ";s:3:"წ";s:3:"Ჭ";s:3:"ჭ";s:3:"Ხ";s:3:"ხ";s:3:"Ჯ";s:3:"ჯ";s:3:"Ჰ";s:3:"ჰ";s:3:"Ჱ";s:3:"ჱ";s:3:"Ჲ";s:3:"ჲ";s:3:"Ჳ";s:3:"ჳ";s:3:"Ჴ";s:3:"ჴ";s:3:"Ჵ";s:3:"ჵ";s:3:"Ჶ";s:3:"ჶ";s:3:"Ჷ";s:3:"ჷ";s:3:"Ჸ";s:3:"ჸ";s:3:"Ჹ";s:3:"ჹ";s:3:"Ჺ";s:3:"ჺ";s:3:"Ჽ";s:3:"ჽ";s:3:"Ჾ";s:3:"ჾ";s:3:"Ჿ";s:3:"ჿ";s:3:"Ḁ";s:3:"ḁ";s:3:"Ḃ";s:3:"ḃ";s:3:"Ḅ";s:3:"ḅ";s:3:"Ḇ";s:3:"ḇ";s:3:"Ḉ";s:3:"ḉ";s:3:"Ḋ";s:3:"ḋ";s:3:"Ḍ";s:3:"ḍ";s:3:"Ḏ";s:3:"ḏ";s:3:"Ḑ";s:3:"ḑ";s:3:"Ḓ";s:3:"ḓ";s:3:"Ḕ";s:3:"ḕ";s:3:"Ḗ";s:3:"ḗ";s:3:"Ḙ";s:3:"ḙ";s:3:"Ḛ";s:3:"ḛ";s:3:"Ḝ";s:3:"ḝ";s:3:"Ḟ";s:3:"ḟ";s:3:"Ḡ";s:3:"ḡ";s:3:"Ḣ";s:3:"ḣ";s:3:"Ḥ";s:3:"ḥ";s:3:"Ḧ";s:3:"ḧ";s:3:"Ḩ";s:3:"ḩ";s:3:"Ḫ";s:3:"ḫ";s:3:"Ḭ";s:3:"ḭ";s:3:"Ḯ";s:3:"ḯ";s:3:"Ḱ";s:3:"ḱ";s:3:"Ḳ";s:3:"ḳ";s:3:"Ḵ";s:3:"ḵ";s:3:"Ḷ";s:3:"ḷ";s:3:"Ḹ";s:3:"ḹ";s:3:"Ḻ";s:3:"ḻ";s:3:"Ḽ";s:3:"ḽ";s:3:"Ḿ";s:3:"ḿ";s:3:"Ṁ";s:3:"ṁ";s:3:"Ṃ";s:3:"ṃ";s:3:"Ṅ";s:3:"ṅ";s:3:"Ṇ";s:3:"ṇ";s:3:"Ṉ";s:3:"ṉ";s:3:"Ṋ";s:3:"ṋ";s:3:"Ṍ";s:3:"ṍ";s:3:"Ṏ";s:3:"ṏ";s:3:"Ṑ";s:3:"ṑ";s:3:"Ṓ";s:3:"ṓ";s:3:"Ṕ";s:3:"ṕ";s:3:"Ṗ";s:3:"ṗ";s:3:"Ṙ";s:3:"ṙ";s:3:"Ṛ";s:3:"ṛ";s:3:"Ṝ";s:3:"ṝ";s:3:"Ṟ";s:3:"ṟ";s:3:"Ṡ";s:3:"ṡ";s:3:"Ṣ";s:3:"ṣ";s:3:"Ṥ";s:3:"ṥ";s:3:"Ṧ";s:3:"ṧ";s:3:"Ṩ";s:3:"ṩ";s:3:"Ṫ";s:3:"ṫ";s:3:"Ṭ";s:3:"ṭ";s:3:"Ṯ";s:3:"ṯ";s:3:"Ṱ";s:3:"ṱ";s:3:"Ṳ";s:3:"ṳ";s:3:"Ṵ";s:3:"ṵ";s:3:"Ṷ";s:3:"ṷ";s:3:"Ṹ";s:3:"ṹ";s:3:"Ṻ";s:3:"ṻ";s:3:"Ṽ";s:3:"ṽ";s:3:"Ṿ";s:3:"ṿ";s:3:"Ẁ";s:3:"ẁ";s:3:"Ẃ";s:3:"ẃ";s:3:"Ẅ";s:3:"ẅ";s:3:"Ẇ";s:3:"ẇ";s:3:"Ẉ";s:3:"ẉ";s:3:"Ẋ";s:3:"ẋ";s:3:"Ẍ";s:3:"ẍ";s:3:"Ẏ";s:3:"ẏ";s:3:"Ẑ";s:3:"ẑ";s:3:"Ẓ";s:3:"ẓ";s:3:"Ẕ";s:3:"ẕ";s:3:"ẞ";s:2:"ß";s:3:"Ạ";s:3:"ạ";s:3:"Ả";s:3:"ả";s:3:"Ấ";s:3:"ấ";s:3:"Ầ";s:3:"ầ";s:3:"Ẩ";s:3:"ẩ";s:3:"Ẫ";s:3:"ẫ";s:3:"Ậ";s:3:"ậ";s:3:"Ắ";s:3:"ắ";s:3:"Ằ";s:3:"ằ";s:3:"Ẳ";s:3:"ẳ";s:3:"Ẵ";s:3:"ẵ";s:3:"Ặ";s:3:"ặ";s:3:"Ẹ";s:3:"ẹ";s:3:"Ẻ";s:3:"ẻ";s:3:"Ẽ";s:3:"ẽ";s:3:"Ế";s:3:"ế";s:3:"Ề";s:3:"ề";s:3:"Ể";s:3:"ể";s:3:"Ễ";s:3:"ễ";s:3:"Ệ";s:3:"ệ";s:3:"Ỉ";s:3:"ỉ";s:3:"Ị";s:3:"ị";s:3:"Ọ";s:3:"ọ";s:3:"Ỏ";s:3:"ỏ";s:3:"Ố";s:3:"ố";s:3:"Ồ";s:3:"ồ";s:3:"Ổ";s:3:"ổ";s:3:"Ỗ";s:3:"ỗ";s:3:"Ộ";s:3:"ộ";s:3:"Ớ";s:3:"ớ";s:3:"Ờ";s:3:"ờ";s:3:"Ở";s:3:"ở";s:3:"Ỡ";s:3:"ỡ";s:3:"Ợ";s:3:"ợ";s:3:"Ụ";s:3:"ụ";s:3:"Ủ";s:3:"ủ";s:3:"Ứ";s:3:"ứ";s:3:"Ừ";s:3:"ừ";s:3:"Ử";s:3:"ử";s:3:"Ữ";s:3:"ữ";s:3:"Ự";s:3:"ự";s:3:"Ỳ";s:3:"ỳ";s:3:"Ỵ";s:3:"ỵ";s:3:"Ỷ";s:3:"ỷ";s:3:"Ỹ";s:3:"ỹ";s:3:"Ỻ";s:3:"ỻ";s:3:"Ỽ";s:3:"ỽ";s:3:"Ỿ";s:3:"ỿ";s:3:"Ἀ";s:3:"ἀ";s:3:"Ἁ";s:3:"ἁ";s:3:"Ἂ";s:3:"ἂ";s:3:"Ἃ";s:3:"ἃ";s:3:"Ἄ";s:3:"ἄ";s:3:"Ἅ";s:3:"ἅ";s:3:"Ἆ";s:3:"ἆ";s:3:"Ἇ";s:3:"ἇ";s:3:"Ἐ";s:3:"ἐ";s:3:"Ἑ";s:3:"ἑ";s:3:"Ἒ";s:3:"ἒ";s:3:"Ἓ";s:3:"ἓ";s:3:"Ἔ";s:3:"ἔ";s:3:"Ἕ";s:3:"ἕ";s:3:"Ἠ";s:3:"ἠ";s:3:"Ἡ";s:3:"ἡ";s:3:"Ἢ";s:3:"ἢ";s:3:"Ἣ";s:3:"ἣ";s:3:"Ἤ";s:3:"ἤ";s:3:"Ἥ";s:3:"ἥ";s:3:"Ἦ";s:3:"ἦ";s:3:"Ἧ";s:3:"ἧ";s:3:"Ἰ";s:3:"ἰ";s:3:"Ἱ";s:3:"ἱ";s:3:"Ἲ";s:3:"ἲ";s:3:"Ἳ";s:3:"ἳ";s:3:"Ἴ";s:3:"ἴ";s:3:"Ἵ";s:3:"ἵ";s:3:"Ἶ";s:3:"ἶ";s:3:"Ἷ";s:3:"ἷ";s:3:"Ὀ";s:3:"ὀ";s:3:"Ὁ";s:3:"ὁ";s:3:"Ὂ";s:3:"ὂ";s:3:"Ὃ";s:3:"ὃ";s:3:"Ὄ";s:3:"ὄ";s:3:"Ὅ";s:3:"ὅ";s:3:"Ὑ";s:3:"ὑ";s:3:"Ὓ";s:3:"ὓ";s:3:"Ὕ";s:3:"ὕ";s:3:"Ὗ";s:3:"ὗ";s:3:"Ὠ";s:3:"ὠ";s:3:"Ὡ";s:3:"ὡ";s:3:"Ὢ";s:3:"ὢ";s:3:"Ὣ";s:3:"ὣ";s:3:"Ὤ";s:3:"ὤ";s:3:"Ὥ";s:3:"ὥ";s:3:"Ὦ";s:3:"ὦ";s:3:"Ὧ";s:3:"ὧ";s:3:"ᾈ";s:3:"ᾀ";s:3:"ᾉ";s:3:"ᾁ";s:3:"ᾊ";s:3:"ᾂ";s:3:"ᾋ";s:3:"ᾃ";s:3:"ᾌ";s:3:"ᾄ";s:3:"ᾍ";s:3:"ᾅ";s:3:"ᾎ";s:3:"ᾆ";s:3:"ᾏ";s:3:"ᾇ";s:3:"ᾘ";s:3:"ᾐ";s:3:"ᾙ";s:3:"ᾑ";s:3:"ᾚ";s:3:"ᾒ";s:3:"ᾛ";s:3:"ᾓ";s:3:"ᾜ";s:3:"ᾔ";s:3:"ᾝ";s:3:"ᾕ";s:3:"ᾞ";s:3:"ᾖ";s:3:"ᾟ";s:3:"ᾗ";s:3:"ᾨ";s:3:"ᾠ";s:3:"ᾩ";s:3:"ᾡ";s:3:"ᾪ";s:3:"ᾢ";s:3:"ᾫ";s:3:"ᾣ";s:3:"ᾬ";s:3:"ᾤ";s:3:"ᾭ";s:3:"ᾥ";s:3:"ᾮ";s:3:"ᾦ";s:3:"ᾯ";s:3:"ᾧ";s:3:"Ᾰ";s:3:"ᾰ";s:3:"Ᾱ";s:3:"ᾱ";s:3:"Ὰ";s:3:"ὰ";s:3:"Ά";s:3:"ά";s:3:"ᾼ";s:3:"ᾳ";s:3:"Ὲ";s:3:"ὲ";s:3:"Έ";s:3:"έ";s:3:"Ὴ";s:3:"ὴ";s:3:"Ή";s:3:"ή";s:3:"ῌ";s:3:"ῃ";s:3:"Ῐ";s:3:"ῐ";s:3:"Ῑ";s:3:"ῑ";s:3:"Ὶ";s:3:"ὶ";s:3:"Ί";s:3:"ί";s:3:"Ῠ";s:3:"ῠ";s:3:"Ῡ";s:3:"ῡ";s:3:"Ὺ";s:3:"ὺ";s:3:"Ύ";s:3:"ύ";s:3:"Ῥ";s:3:"ῥ";s:3:"Ὸ";s:3:"ὸ";s:3:"Ό";s:3:"ό";s:3:"Ὼ";s:3:"ὼ";s:3:"Ώ";s:3:"ώ";s:3:"ῼ";s:3:"ῳ";s:3:"Ω";s:2:"ω";s:3:"K";s:1:"k";s:3:"Å";s:2:"å";s:3:"Ⅎ";s:3:"ⅎ";s:3:"Ⅰ";s:3:"ⅰ";s:3:"Ⅱ";s:3:"ⅱ";s:3:"Ⅲ";s:3:"ⅲ";s:3:"Ⅳ";s:3:"ⅳ";s:3:"Ⅴ";s:3:"ⅴ";s:3:"Ⅵ";s:3:"ⅵ";s:3:"Ⅶ";s:3:"ⅶ";s:3:"Ⅷ";s:3:"ⅷ";s:3:"Ⅸ";s:3:"ⅸ";s:3:"Ⅹ";s:3:"ⅹ";s:3:"Ⅺ";s:3:"ⅺ";s:3:"Ⅻ";s:3:"ⅻ";s:3:"Ⅼ";s:3:"ⅼ";s:3:"Ⅽ";s:3:"ⅽ";s:3:"Ⅾ";s:3:"ⅾ";s:3:"Ⅿ";s:3:"ⅿ";s:3:"Ↄ";s:3:"ↄ";s:3:"Ⓐ";s:3:"ⓐ";s:3:"Ⓑ";s:3:"ⓑ";s:3:"Ⓒ";s:3:"ⓒ";s:3:"Ⓓ";s:3:"ⓓ";s:3:"Ⓔ";s:3:"ⓔ";s:3:"Ⓕ";s:3:"ⓕ";s:3:"Ⓖ";s:3:"ⓖ";s:3:"Ⓗ";s:3:"ⓗ";s:3:"Ⓘ";s:3:"ⓘ";s:3:"Ⓙ";s:3:"ⓙ";s:3:"Ⓚ";s:3:"ⓚ";s:3:"Ⓛ";s:3:"ⓛ";s:3:"Ⓜ";s:3:"ⓜ";s:3:"Ⓝ";s:3:"ⓝ";s:3:"Ⓞ";s:3:"ⓞ";s:3:"Ⓟ";s:3:"ⓟ";s:3:"Ⓠ";s:3:"ⓠ";s:3:"Ⓡ";s:3:"ⓡ";s:3:"Ⓢ";s:3:"ⓢ";s:3:"Ⓣ";s:3:"ⓣ";s:3:"Ⓤ";s:3:"ⓤ";s:3:"Ⓥ";s:3:"ⓥ";s:3:"Ⓦ";s:3:"ⓦ";s:3:"Ⓧ";s:3:"ⓧ";s:3:"Ⓨ";s:3:"ⓨ";s:3:"Ⓩ";s:3:"ⓩ";s:3:"Ⰰ";s:3:"ⰰ";s:3:"Ⰱ";s:3:"ⰱ";s:3:"Ⰲ";s:3:"ⰲ";s:3:"Ⰳ";s:3:"ⰳ";s:3:"Ⰴ";s:3:"ⰴ";s:3:"Ⰵ";s:3:"ⰵ";s:3:"Ⰶ";s:3:"ⰶ";s:3:"Ⰷ";s:3:"ⰷ";s:3:"Ⰸ";s:3:"ⰸ";s:3:"Ⰹ";s:3:"ⰹ";s:3:"Ⰺ";s:3:"ⰺ";s:3:"Ⰻ";s:3:"ⰻ";s:3:"Ⰼ";s:3:"ⰼ";s:3:"Ⰽ";s:3:"ⰽ";s:3:"Ⰾ";s:3:"ⰾ";s:3:"Ⰿ";s:3:"ⰿ";s:3:"Ⱀ";s:3:"ⱀ";s:3:"Ⱁ";s:3:"ⱁ";s:3:"Ⱂ";s:3:"ⱂ";s:3:"Ⱃ";s:3:"ⱃ";s:3:"Ⱄ";s:3:"ⱄ";s:3:"Ⱅ";s:3:"ⱅ";s:3:"Ⱆ";s:3:"ⱆ";s:3:"Ⱇ";s:3:"ⱇ";s:3:"Ⱈ";s:3:"ⱈ";s:3:"Ⱉ";s:3:"ⱉ";s:3:"Ⱊ";s:3:"ⱊ";s:3:"Ⱋ";s:3:"ⱋ";s:3:"Ⱌ";s:3:"ⱌ";s:3:"Ⱍ";s:3:"ⱍ";s:3:"Ⱎ";s:3:"ⱎ";s:3:"Ⱏ";s:3:"ⱏ";s:3:"Ⱐ";s:3:"ⱐ";s:3:"Ⱑ";s:3:"ⱑ";s:3:"Ⱒ";s:3:"ⱒ";s:3:"Ⱓ";s:3:"ⱓ";s:3:"Ⱔ";s:3:"ⱔ";s:3:"Ⱕ";s:3:"ⱕ";s:3:"Ⱖ";s:3:"ⱖ";s:3:"Ⱗ";s:3:"ⱗ";s:3:"Ⱘ";s:3:"ⱘ";s:3:"Ⱙ";s:3:"ⱙ";s:3:"Ⱚ";s:3:"ⱚ";s:3:"Ⱛ";s:3:"ⱛ";s:3:"Ⱜ";s:3:"ⱜ";s:3:"Ⱝ";s:3:"ⱝ";s:3:"Ⱞ";s:3:"ⱞ";s:3:"Ⱡ";s:3:"ⱡ";s:3:"Ɫ";s:2:"ɫ";s:3:"Ᵽ";s:3:"ᵽ";s:3:"Ɽ";s:2:"ɽ";s:3:"Ⱨ";s:3:"ⱨ";s:3:"Ⱪ";s:3:"ⱪ";s:3:"Ⱬ";s:3:"ⱬ";s:3:"Ɑ";s:2:"ɑ";s:3:"Ɱ";s:2:"ɱ";s:3:"Ɐ";s:2:"ɐ";s:3:"Ɒ";s:2:"ɒ";s:3:"Ⱳ";s:3:"ⱳ";s:3:"Ⱶ";s:3:"ⱶ";s:3:"Ȿ";s:2:"ȿ";s:3:"Ɀ";s:2:"ɀ";s:3:"Ⲁ";s:3:"ⲁ";s:3:"Ⲃ";s:3:"ⲃ";s:3:"Ⲅ";s:3:"ⲅ";s:3:"Ⲇ";s:3:"ⲇ";s:3:"Ⲉ";s:3:"ⲉ";s:3:"Ⲋ";s:3:"ⲋ";s:3:"Ⲍ";s:3:"ⲍ";s:3:"Ⲏ";s:3:"ⲏ";s:3:"Ⲑ";s:3:"ⲑ";s:3:"Ⲓ";s:3:"ⲓ";s:3:"Ⲕ";s:3:"ⲕ";s:3:"Ⲗ";s:3:"ⲗ";s:3:"Ⲙ";s:3:"ⲙ";s:3:"Ⲛ";s:3:"ⲛ";s:3:"Ⲝ";s:3:"ⲝ";s:3:"Ⲟ";s:3:"ⲟ";s:3:"Ⲡ";s:3:"ⲡ";s:3:"Ⲣ";s:3:"ⲣ";s:3:"Ⲥ";s:3:"ⲥ";s:3:"Ⲧ";s:3:"ⲧ";s:3:"Ⲩ";s:3:"ⲩ";s:3:"Ⲫ";s:3:"ⲫ";s:3:"Ⲭ";s:3:"ⲭ";s:3:"Ⲯ";s:3:"ⲯ";s:3:"Ⲱ";s:3:"ⲱ";s:3:"Ⲳ";s:3:"ⲳ";s:3:"Ⲵ";s:3:"ⲵ";s:3:"Ⲷ";s:3:"ⲷ";s:3:"Ⲹ";s:3:"ⲹ";s:3:"Ⲻ";s:3:"ⲻ";s:3:"Ⲽ";s:3:"ⲽ";s:3:"Ⲿ";s:3:"ⲿ";s:3:"Ⳁ";s:3:"ⳁ";s:3:"Ⳃ";s:3:"ⳃ";s:3:"Ⳅ";s:3:"ⳅ";s:3:"Ⳇ";s:3:"ⳇ";s:3:"Ⳉ";s:3:"ⳉ";s:3:"Ⳋ";s:3:"ⳋ";s:3:"Ⳍ";s:3:"ⳍ";s:3:"Ⳏ";s:3:"ⳏ";s:3:"Ⳑ";s:3:"ⳑ";s:3:"Ⳓ";s:3:"ⳓ";s:3:"Ⳕ";s:3:"ⳕ";s:3:"Ⳗ";s:3:"ⳗ";s:3:"Ⳙ";s:3:"ⳙ";s:3:"Ⳛ";s:3:"ⳛ";s:3:"Ⳝ";s:3:"ⳝ";s:3:"Ⳟ";s:3:"ⳟ";s:3:"Ⳡ";s:3:"ⳡ";s:3:"Ⳣ";s:3:"ⳣ";s:3:"Ⳬ";s:3:"ⳬ";s:3:"Ⳮ";s:3:"ⳮ";s:3:"Ⳳ";s:3:"ⳳ";s:3:"Ꙁ";s:3:"ꙁ";s:3:"Ꙃ";s:3:"ꙃ";s:3:"Ꙅ";s:3:"ꙅ";s:3:"Ꙇ";s:3:"ꙇ";s:3:"Ꙉ";s:3:"ꙉ";s:3:"Ꙋ";s:3:"ꙋ";s:3:"Ꙍ";s:3:"ꙍ";s:3:"Ꙏ";s:3:"ꙏ";s:3:"Ꙑ";s:3:"ꙑ";s:3:"Ꙓ";s:3:"ꙓ";s:3:"Ꙕ";s:3:"ꙕ";s:3:"Ꙗ";s:3:"ꙗ";s:3:"Ꙙ";s:3:"ꙙ";s:3:"Ꙛ";s:3:"ꙛ";s:3:"Ꙝ";s:3:"ꙝ";s:3:"Ꙟ";s:3:"ꙟ";s:3:"Ꙡ";s:3:"ꙡ";s:3:"Ꙣ";s:3:"ꙣ";s:3:"Ꙥ";s:3:"ꙥ";s:3:"Ꙧ";s:3:"ꙧ";s:3:"Ꙩ";s:3:"ꙩ";s:3:"Ꙫ";s:3:"ꙫ";s:3:"Ꙭ";s:3:"ꙭ";s:3:"Ꚁ";s:3:"ꚁ";s:3:"Ꚃ";s:3:"ꚃ";s:3:"Ꚅ";s:3:"ꚅ";s:3:"Ꚇ";s:3:"ꚇ";s:3:"Ꚉ";s:3:"ꚉ";s:3:"Ꚋ";s:3:"ꚋ";s:3:"Ꚍ";s:3:"ꚍ";s:3:"Ꚏ";s:3:"ꚏ";s:3:"Ꚑ";s:3:"ꚑ";s:3:"Ꚓ";s:3:"ꚓ";s:3:"Ꚕ";s:3:"ꚕ";s:3:"Ꚗ";s:3:"ꚗ";s:3:"Ꚙ";s:3:"ꚙ";s:3:"Ꚛ";s:3:"ꚛ";s:3:"Ꜣ";s:3:"ꜣ";s:3:"Ꜥ";s:3:"ꜥ";s:3:"Ꜧ";s:3:"ꜧ";s:3:"Ꜩ";s:3:"ꜩ";s:3:"Ꜫ";s:3:"ꜫ";s:3:"Ꜭ";s:3:"ꜭ";s:3:"Ꜯ";s:3:"ꜯ";s:3:"Ꜳ";s:3:"ꜳ";s:3:"Ꜵ";s:3:"ꜵ";s:3:"Ꜷ";s:3:"ꜷ";s:3:"Ꜹ";s:3:"ꜹ";s:3:"Ꜻ";s:3:"ꜻ";s:3:"Ꜽ";s:3:"ꜽ";s:3:"Ꜿ";s:3:"ꜿ";s:3:"Ꝁ";s:3:"ꝁ";s:3:"Ꝃ";s:3:"ꝃ";s:3:"Ꝅ";s:3:"ꝅ";s:3:"Ꝇ";s:3:"ꝇ";s:3:"Ꝉ";s:3:"ꝉ";s:3:"Ꝋ";s:3:"ꝋ";s:3:"Ꝍ";s:3:"ꝍ";s:3:"Ꝏ";s:3:"ꝏ";s:3:"Ꝑ";s:3:"ꝑ";s:3:"Ꝓ";s:3:"ꝓ";s:3:"Ꝕ";s:3:"ꝕ";s:3:"Ꝗ";s:3:"ꝗ";s:3:"Ꝙ";s:3:"ꝙ";s:3:"Ꝛ";s:3:"ꝛ";s:3:"Ꝝ";s:3:"ꝝ";s:3:"Ꝟ";s:3:"ꝟ";s:3:"Ꝡ";s:3:"ꝡ";s:3:"Ꝣ";s:3:"ꝣ";s:3:"Ꝥ";s:3:"ꝥ";s:3:"Ꝧ";s:3:"ꝧ";s:3:"Ꝩ";s:3:"ꝩ";s:3:"Ꝫ";s:3:"ꝫ";s:3:"Ꝭ";s:3:"ꝭ";s:3:"Ꝯ";s:3:"ꝯ";s:3:"Ꝺ";s:3:"ꝺ";s:3:"Ꝼ";s:3:"ꝼ";s:3:"Ᵹ";s:3:"ᵹ";s:3:"Ꝿ";s:3:"ꝿ";s:3:"Ꞁ";s:3:"ꞁ";s:3:"Ꞃ";s:3:"ꞃ";s:3:"Ꞅ";s:3:"ꞅ";s:3:"Ꞇ";s:3:"ꞇ";s:3:"Ꞌ";s:3:"ꞌ";s:3:"Ɥ";s:2:"ɥ";s:3:"Ꞑ";s:3:"ꞑ";s:3:"Ꞓ";s:3:"ꞓ";s:3:"Ꞗ";s:3:"ꞗ";s:3:"Ꞙ";s:3:"ꞙ";s:3:"Ꞛ";s:3:"ꞛ";s:3:"Ꞝ";s:3:"ꞝ";s:3:"Ꞟ";s:3:"ꞟ";s:3:"Ꞡ";s:3:"ꞡ";s:3:"Ꞣ";s:3:"ꞣ";s:3:"Ꞥ";s:3:"ꞥ";s:3:"Ꞧ";s:3:"ꞧ";s:3:"Ꞩ";s:3:"ꞩ";s:3:"Ɦ";s:2:"ɦ";s:3:"Ɜ";s:2:"ɜ";s:3:"Ɡ";s:2:"ɡ";s:3:"Ɬ";s:2:"ɬ";s:3:"Ɪ";s:2:"ɪ";s:3:"Ʞ";s:2:"ʞ";s:3:"Ʇ";s:2:"ʇ";s:3:"Ʝ";s:2:"ʝ";s:3:"Ꭓ";s:3:"ꭓ";s:3:"Ꞵ";s:3:"ꞵ";s:3:"Ꞷ";s:3:"ꞷ";s:3:"Ꞹ";s:3:"ꞹ";s:3:"Ꞻ";s:3:"ꞻ";s:3:"Ꞽ";s:3:"ꞽ";s:3:"Ꞿ";s:3:"ꞿ";s:3:"Ꟃ";s:3:"ꟃ";s:3:"Ꞔ";s:3:"ꞔ";s:3:"Ʂ";s:2:"ʂ";s:3:"Ᶎ";s:3:"ᶎ";s:3:"A";s:3:"a";s:3:"B";s:3:"b";s:3:"C";s:3:"c";s:3:"D";s:3:"d";s:3:"E";s:3:"e";s:3:"F";s:3:"f";s:3:"G";s:3:"g";s:3:"H";s:3:"h";s:3:"I";s:3:"i";s:3:"J";s:3:"j";s:3:"K";s:3:"k";s:3:"L";s:3:"l";s:3:"M";s:3:"m";s:3:"N";s:3:"n";s:3:"O";s:3:"o";s:3:"P";s:3:"p";s:3:"Q";s:3:"q";s:3:"R";s:3:"r";s:3:"S";s:3:"s";s:3:"T";s:3:"t";s:3:"U";s:3:"u";s:3:"V";s:3:"v";s:3:"W";s:3:"w";s:3:"X";s:3:"x";s:3:"Y";s:3:"y";s:3:"Z";s:3:"z";s:4:"𐐀";s:4:"𐐨";s:4:"𐐁";s:4:"𐐩";s:4:"𐐂";s:4:"𐐪";s:4:"𐐃";s:4:"𐐫";s:4:"𐐄";s:4:"𐐬";s:4:"𐐅";s:4:"𐐭";s:4:"𐐆";s:4:"𐐮";s:4:"𐐇";s:4:"𐐯";s:4:"𐐈";s:4:"𐐰";s:4:"𐐉";s:4:"𐐱";s:4:"𐐊";s:4:"𐐲";s:4:"𐐋";s:4:"𐐳";s:4:"𐐌";s:4:"𐐴";s:4:"𐐍";s:4:"𐐵";s:4:"𐐎";s:4:"𐐶";s:4:"𐐏";s:4:"𐐷";s:4:"𐐐";s:4:"𐐸";s:4:"𐐑";s:4:"𐐹";s:4:"𐐒";s:4:"𐐺";s:4:"𐐓";s:4:"𐐻";s:4:"𐐔";s:4:"𐐼";s:4:"𐐕";s:4:"𐐽";s:4:"𐐖";s:4:"𐐾";s:4:"𐐗";s:4:"𐐿";s:4:"𐐘";s:4:"𐑀";s:4:"𐐙";s:4:"𐑁";s:4:"𐐚";s:4:"𐑂";s:4:"𐐛";s:4:"𐑃";s:4:"𐐜";s:4:"𐑄";s:4:"𐐝";s:4:"𐑅";s:4:"𐐞";s:4:"𐑆";s:4:"𐐟";s:4:"𐑇";s:4:"𐐠";s:4:"𐑈";s:4:"𐐡";s:4:"𐑉";s:4:"𐐢";s:4:"𐑊";s:4:"𐐣";s:4:"𐑋";s:4:"𐐤";s:4:"𐑌";s:4:"𐐥";s:4:"𐑍";s:4:"𐐦";s:4:"𐑎";s:4:"𐐧";s:4:"𐑏";s:4:"𐒰";s:4:"𐓘";s:4:"𐒱";s:4:"𐓙";s:4:"𐒲";s:4:"𐓚";s:4:"𐒳";s:4:"𐓛";s:4:"𐒴";s:4:"𐓜";s:4:"𐒵";s:4:"𐓝";s:4:"𐒶";s:4:"𐓞";s:4:"𐒷";s:4:"𐓟";s:4:"𐒸";s:4:"𐓠";s:4:"𐒹";s:4:"𐓡";s:4:"𐒺";s:4:"𐓢";s:4:"𐒻";s:4:"𐓣";s:4:"𐒼";s:4:"𐓤";s:4:"𐒽";s:4:"𐓥";s:4:"𐒾";s:4:"𐓦";s:4:"𐒿";s:4:"𐓧";s:4:"𐓀";s:4:"𐓨";s:4:"𐓁";s:4:"𐓩";s:4:"𐓂";s:4:"𐓪";s:4:"𐓃";s:4:"𐓫";s:4:"𐓄";s:4:"𐓬";s:4:"𐓅";s:4:"𐓭";s:4:"𐓆";s:4:"𐓮";s:4:"𐓇";s:4:"𐓯";s:4:"𐓈";s:4:"𐓰";s:4:"𐓉";s:4:"𐓱";s:4:"𐓊";s:4:"𐓲";s:4:"𐓋";s:4:"𐓳";s:4:"𐓌";s:4:"𐓴";s:4:"𐓍";s:4:"𐓵";s:4:"𐓎";s:4:"𐓶";s:4:"𐓏";s:4:"𐓷";s:4:"𐓐";s:4:"𐓸";s:4:"𐓑";s:4:"𐓹";s:4:"𐓒";s:4:"𐓺";s:4:"𐓓";s:4:"𐓻";s:4:"𐲀";s:4:"𐳀";s:4:"𐲁";s:4:"𐳁";s:4:"𐲂";s:4:"𐳂";s:4:"𐲃";s:4:"𐳃";s:4:"𐲄";s:4:"𐳄";s:4:"𐲅";s:4:"𐳅";s:4:"𐲆";s:4:"𐳆";s:4:"𐲇";s:4:"𐳇";s:4:"𐲈";s:4:"𐳈";s:4:"𐲉";s:4:"𐳉";s:4:"𐲊";s:4:"𐳊";s:4:"𐲋";s:4:"𐳋";s:4:"𐲌";s:4:"𐳌";s:4:"𐲍";s:4:"𐳍";s:4:"𐲎";s:4:"𐳎";s:4:"𐲏";s:4:"𐳏";s:4:"𐲐";s:4:"𐳐";s:4:"𐲑";s:4:"𐳑";s:4:"𐲒";s:4:"𐳒";s:4:"𐲓";s:4:"𐳓";s:4:"𐲔";s:4:"𐳔";s:4:"𐲕";s:4:"𐳕";s:4:"𐲖";s:4:"𐳖";s:4:"𐲗";s:4:"𐳗";s:4:"𐲘";s:4:"𐳘";s:4:"𐲙";s:4:"𐳙";s:4:"𐲚";s:4:"𐳚";s:4:"𐲛";s:4:"𐳛";s:4:"𐲜";s:4:"𐳜";s:4:"𐲝";s:4:"𐳝";s:4:"𐲞";s:4:"𐳞";s:4:"𐲟";s:4:"𐳟";s:4:"𐲠";s:4:"𐳠";s:4:"𐲡";s:4:"𐳡";s:4:"𐲢";s:4:"𐳢";s:4:"𐲣";s:4:"𐳣";s:4:"𐲤";s:4:"𐳤";s:4:"𐲥";s:4:"𐳥";s:4:"𐲦";s:4:"𐳦";s:4:"𐲧";s:4:"𐳧";s:4:"𐲨";s:4:"𐳨";s:4:"𐲩";s:4:"𐳩";s:4:"𐲪";s:4:"𐳪";s:4:"𐲫";s:4:"𐳫";s:4:"𐲬";s:4:"𐳬";s:4:"𐲭";s:4:"𐳭";s:4:"𐲮";s:4:"𐳮";s:4:"𐲯";s:4:"𐳯";s:4:"𐲰";s:4:"𐳰";s:4:"𐲱";s:4:"𐳱";s:4:"𐲲";s:4:"𐳲";s:4:"𑢠";s:4:"𑣀";s:4:"𑢡";s:4:"𑣁";s:4:"𑢢";s:4:"𑣂";s:4:"𑢣";s:4:"𑣃";s:4:"𑢤";s:4:"𑣄";s:4:"𑢥";s:4:"𑣅";s:4:"𑢦";s:4:"𑣆";s:4:"𑢧";s:4:"𑣇";s:4:"𑢨";s:4:"𑣈";s:4:"𑢩";s:4:"𑣉";s:4:"𑢪";s:4:"𑣊";s:4:"𑢫";s:4:"𑣋";s:4:"𑢬";s:4:"𑣌";s:4:"𑢭";s:4:"𑣍";s:4:"𑢮";s:4:"𑣎";s:4:"𑢯";s:4:"𑣏";s:4:"𑢰";s:4:"𑣐";s:4:"𑢱";s:4:"𑣑";s:4:"𑢲";s:4:"𑣒";s:4:"𑢳";s:4:"𑣓";s:4:"𑢴";s:4:"𑣔";s:4:"𑢵";s:4:"𑣕";s:4:"𑢶";s:4:"𑣖";s:4:"𑢷";s:4:"𑣗";s:4:"𑢸";s:4:"𑣘";s:4:"𑢹";s:4:"𑣙";s:4:"𑢺";s:4:"𑣚";s:4:"𑢻";s:4:"𑣛";s:4:"𑢼";s:4:"𑣜";s:4:"𑢽";s:4:"𑣝";s:4:"𑢾";s:4:"𑣞";s:4:"𑢿";s:4:"𑣟";s:4:"𖹀";s:4:"𖹠";s:4:"𖹁";s:4:"𖹡";s:4:"𖹂";s:4:"𖹢";s:4:"𖹃";s:4:"𖹣";s:4:"𖹄";s:4:"𖹤";s:4:"𖹅";s:4:"𖹥";s:4:"𖹆";s:4:"𖹦";s:4:"𖹇";s:4:"𖹧";s:4:"𖹈";s:4:"𖹨";s:4:"𖹉";s:4:"𖹩";s:4:"𖹊";s:4:"𖹪";s:4:"𖹋";s:4:"𖹫";s:4:"𖹌";s:4:"𖹬";s:4:"𖹍";s:4:"𖹭";s:4:"𖹎";s:4:"𖹮";s:4:"𖹏";s:4:"𖹯";s:4:"𖹐";s:4:"𖹰";s:4:"𖹑";s:4:"𖹱";s:4:"𖹒";s:4:"𖹲";s:4:"𖹓";s:4:"𖹳";s:4:"𖹔";s:4:"𖹴";s:4:"𖹕";s:4:"𖹵";s:4:"𖹖";s:4:"𖹶";s:4:"𖹗";s:4:"𖹷";s:4:"𖹘";s:4:"𖹸";s:4:"𖹙";s:4:"𖹹";s:4:"𖹚";s:4:"𖹺";s:4:"𖹛";s:4:"𖹻";s:4:"𖹜";s:4:"𖹼";s:4:"𖹝";s:4:"𖹽";s:4:"𖹞";s:4:"𖹾";s:4:"𖹟";s:4:"𖹿";s:4:"𞤀";s:4:"𞤢";s:4:"𞤁";s:4:"𞤣";s:4:"𞤂";s:4:"𞤤";s:4:"𞤃";s:4:"𞤥";s:4:"𞤄";s:4:"𞤦";s:4:"𞤅";s:4:"𞤧";s:4:"𞤆";s:4:"𞤨";s:4:"𞤇";s:4:"𞤩";s:4:"𞤈";s:4:"𞤪";s:4:"𞤉";s:4:"𞤫";s:4:"𞤊";s:4:"𞤬";s:4:"𞤋";s:4:"𞤭";s:4:"𞤌";s:4:"𞤮";s:4:"𞤍";s:4:"𞤯";s:4:"𞤎";s:4:"𞤰";s:4:"𞤏";s:4:"𞤱";s:4:"𞤐";s:4:"𞤲";s:4:"𞤑";s:4:"𞤳";s:4:"𞤒";s:4:"𞤴";s:4:"𞤓";s:4:"𞤵";s:4:"𞤔";s:4:"𞤶";s:4:"𞤕";s:4:"𞤷";s:4:"𞤖";s:4:"𞤸";s:4:"𞤗";s:4:"𞤹";s:4:"𞤘";s:4:"𞤺";s:4:"𞤙";s:4:"𞤻";s:4:"𞤚";s:4:"𞤼";s:4:"𞤛";s:4:"𞤽";s:4:"𞤜";s:4:"𞤾";s:4:"𞤝";s:4:"𞤿";s:4:"𞤞";s:4:"𞥀";s:4:"𞤟";s:4:"𞥁";s:4:"𞤠";s:4:"𞥂";s:4:"𞤡";s:4:"𞥃";} \ No newline at end of file diff --git a/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/upperCase.ser b/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/upperCase.ser index e9e0ec2..08ff920 100644 --- a/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/upperCase.ser +++ b/vendor/patchwork/utf8/src/Patchwork/PHP/Shim/unidata/upperCase.ser @@ -1 +1 @@ -a:1100:{s:1:"a";s:1:"A";s:1:"b";s:1:"B";s:1:"c";s:1:"C";s:1:"d";s:1:"D";s:1:"e";s:1:"E";s:1:"f";s:1:"F";s:1:"g";s:1:"G";s:1:"h";s:1:"H";s:1:"i";s:1:"I";s:1:"j";s:1:"J";s:1:"k";s:1:"K";s:1:"l";s:1:"L";s:1:"m";s:1:"M";s:1:"n";s:1:"N";s:1:"o";s:1:"O";s:1:"p";s:1:"P";s:1:"q";s:1:"Q";s:1:"r";s:1:"R";s:1:"s";s:1:"S";s:1:"t";s:1:"T";s:1:"u";s:1:"U";s:1:"v";s:1:"V";s:1:"w";s:1:"W";s:1:"x";s:1:"X";s:1:"y";s:1:"Y";s:1:"z";s:1:"Z";s:2:"µ";s:2:"Μ";s:2:"à";s:2:"À";s:2:"á";s:2:"Á";s:2:"â";s:2:"Â";s:2:"ã";s:2:"Ã";s:2:"ä";s:2:"Ä";s:2:"å";s:2:"Å";s:2:"æ";s:2:"Æ";s:2:"ç";s:2:"Ç";s:2:"è";s:2:"È";s:2:"é";s:2:"É";s:2:"ê";s:2:"Ê";s:2:"ë";s:2:"Ë";s:2:"ì";s:2:"Ì";s:2:"í";s:2:"Í";s:2:"î";s:2:"Î";s:2:"ï";s:2:"Ï";s:2:"ð";s:2:"Ð";s:2:"ñ";s:2:"Ñ";s:2:"ò";s:2:"Ò";s:2:"ó";s:2:"Ó";s:2:"ô";s:2:"Ô";s:2:"õ";s:2:"Õ";s:2:"ö";s:2:"Ö";s:2:"ø";s:2:"Ø";s:2:"ù";s:2:"Ù";s:2:"ú";s:2:"Ú";s:2:"û";s:2:"Û";s:2:"ü";s:2:"Ü";s:2:"ý";s:2:"Ý";s:2:"þ";s:2:"Þ";s:2:"ÿ";s:2:"Ÿ";s:2:"ā";s:2:"Ā";s:2:"ă";s:2:"Ă";s:2:"ą";s:2:"Ą";s:2:"ć";s:2:"Ć";s:2:"ĉ";s:2:"Ĉ";s:2:"ċ";s:2:"Ċ";s:2:"č";s:2:"Č";s:2:"ď";s:2:"Ď";s:2:"đ";s:2:"Đ";s:2:"ē";s:2:"Ē";s:2:"ĕ";s:2:"Ĕ";s:2:"ė";s:2:"Ė";s:2:"ę";s:2:"Ę";s:2:"ě";s:2:"Ě";s:2:"ĝ";s:2:"Ĝ";s:2:"ğ";s:2:"Ğ";s:2:"ġ";s:2:"Ġ";s:2:"ģ";s:2:"Ģ";s:2:"ĥ";s:2:"Ĥ";s:2:"ħ";s:2:"Ħ";s:2:"ĩ";s:2:"Ĩ";s:2:"ī";s:2:"Ī";s:2:"ĭ";s:2:"Ĭ";s:2:"į";s:2:"Į";s:2:"ı";s:1:"I";s:2:"ij";s:2:"IJ";s:2:"ĵ";s:2:"Ĵ";s:2:"ķ";s:2:"Ķ";s:2:"ĺ";s:2:"Ĺ";s:2:"ļ";s:2:"Ļ";s:2:"ľ";s:2:"Ľ";s:2:"ŀ";s:2:"Ŀ";s:2:"ł";s:2:"Ł";s:2:"ń";s:2:"Ń";s:2:"ņ";s:2:"Ņ";s:2:"ň";s:2:"Ň";s:2:"ŋ";s:2:"Ŋ";s:2:"ō";s:2:"Ō";s:2:"ŏ";s:2:"Ŏ";s:2:"ő";s:2:"Ő";s:2:"œ";s:2:"Œ";s:2:"ŕ";s:2:"Ŕ";s:2:"ŗ";s:2:"Ŗ";s:2:"ř";s:2:"Ř";s:2:"ś";s:2:"Ś";s:2:"ŝ";s:2:"Ŝ";s:2:"ş";s:2:"Ş";s:2:"š";s:2:"Š";s:2:"ţ";s:2:"Ţ";s:2:"ť";s:2:"Ť";s:2:"ŧ";s:2:"Ŧ";s:2:"ũ";s:2:"Ũ";s:2:"ū";s:2:"Ū";s:2:"ŭ";s:2:"Ŭ";s:2:"ů";s:2:"Ů";s:2:"ű";s:2:"Ű";s:2:"ų";s:2:"Ų";s:2:"ŵ";s:2:"Ŵ";s:2:"ŷ";s:2:"Ŷ";s:2:"ź";s:2:"Ź";s:2:"ż";s:2:"Ż";s:2:"ž";s:2:"Ž";s:2:"ſ";s:1:"S";s:2:"ƀ";s:2:"Ƀ";s:2:"ƃ";s:2:"Ƃ";s:2:"ƅ";s:2:"Ƅ";s:2:"ƈ";s:2:"Ƈ";s:2:"ƌ";s:2:"Ƌ";s:2:"ƒ";s:2:"Ƒ";s:2:"ƕ";s:2:"Ƕ";s:2:"ƙ";s:2:"Ƙ";s:2:"ƚ";s:2:"Ƚ";s:2:"ƞ";s:2:"Ƞ";s:2:"ơ";s:2:"Ơ";s:2:"ƣ";s:2:"Ƣ";s:2:"ƥ";s:2:"Ƥ";s:2:"ƨ";s:2:"Ƨ";s:2:"ƭ";s:2:"Ƭ";s:2:"ư";s:2:"Ư";s:2:"ƴ";s:2:"Ƴ";s:2:"ƶ";s:2:"Ƶ";s:2:"ƹ";s:2:"Ƹ";s:2:"ƽ";s:2:"Ƽ";s:2:"ƿ";s:2:"Ƿ";s:2:"Dž";s:2:"DŽ";s:2:"dž";s:2:"DŽ";s:2:"Lj";s:2:"LJ";s:2:"lj";s:2:"LJ";s:2:"Nj";s:2:"NJ";s:2:"nj";s:2:"NJ";s:2:"ǎ";s:2:"Ǎ";s:2:"ǐ";s:2:"Ǐ";s:2:"ǒ";s:2:"Ǒ";s:2:"ǔ";s:2:"Ǔ";s:2:"ǖ";s:2:"Ǖ";s:2:"ǘ";s:2:"Ǘ";s:2:"ǚ";s:2:"Ǚ";s:2:"ǜ";s:2:"Ǜ";s:2:"ǝ";s:2:"Ǝ";s:2:"ǟ";s:2:"Ǟ";s:2:"ǡ";s:2:"Ǡ";s:2:"ǣ";s:2:"Ǣ";s:2:"ǥ";s:2:"Ǥ";s:2:"ǧ";s:2:"Ǧ";s:2:"ǩ";s:2:"Ǩ";s:2:"ǫ";s:2:"Ǫ";s:2:"ǭ";s:2:"Ǭ";s:2:"ǯ";s:2:"Ǯ";s:2:"Dz";s:2:"DZ";s:2:"dz";s:2:"DZ";s:2:"ǵ";s:2:"Ǵ";s:2:"ǹ";s:2:"Ǹ";s:2:"ǻ";s:2:"Ǻ";s:2:"ǽ";s:2:"Ǽ";s:2:"ǿ";s:2:"Ǿ";s:2:"ȁ";s:2:"Ȁ";s:2:"ȃ";s:2:"Ȃ";s:2:"ȅ";s:2:"Ȅ";s:2:"ȇ";s:2:"Ȇ";s:2:"ȉ";s:2:"Ȉ";s:2:"ȋ";s:2:"Ȋ";s:2:"ȍ";s:2:"Ȍ";s:2:"ȏ";s:2:"Ȏ";s:2:"ȑ";s:2:"Ȑ";s:2:"ȓ";s:2:"Ȓ";s:2:"ȕ";s:2:"Ȕ";s:2:"ȗ";s:2:"Ȗ";s:2:"ș";s:2:"Ș";s:2:"ț";s:2:"Ț";s:2:"ȝ";s:2:"Ȝ";s:2:"ȟ";s:2:"Ȟ";s:2:"ȣ";s:2:"Ȣ";s:2:"ȥ";s:2:"Ȥ";s:2:"ȧ";s:2:"Ȧ";s:2:"ȩ";s:2:"Ȩ";s:2:"ȫ";s:2:"Ȫ";s:2:"ȭ";s:2:"Ȭ";s:2:"ȯ";s:2:"Ȯ";s:2:"ȱ";s:2:"Ȱ";s:2:"ȳ";s:2:"Ȳ";s:2:"ȼ";s:2:"Ȼ";s:2:"ȿ";s:3:"Ȿ";s:2:"ɀ";s:3:"Ɀ";s:2:"ɂ";s:2:"Ɂ";s:2:"ɇ";s:2:"Ɇ";s:2:"ɉ";s:2:"Ɉ";s:2:"ɋ";s:2:"Ɋ";s:2:"ɍ";s:2:"Ɍ";s:2:"ɏ";s:2:"Ɏ";s:2:"ɐ";s:3:"Ɐ";s:2:"ɑ";s:3:"Ɑ";s:2:"ɒ";s:3:"Ɒ";s:2:"ɓ";s:2:"Ɓ";s:2:"ɔ";s:2:"Ɔ";s:2:"ɖ";s:2:"Ɖ";s:2:"ɗ";s:2:"Ɗ";s:2:"ə";s:2:"Ə";s:2:"ɛ";s:2:"Ɛ";s:2:"ɜ";s:3:"Ɜ";s:2:"ɠ";s:2:"Ɠ";s:2:"ɡ";s:3:"Ɡ";s:2:"ɣ";s:2:"Ɣ";s:2:"ɥ";s:3:"Ɥ";s:2:"ɦ";s:3:"Ɦ";s:2:"ɨ";s:2:"Ɨ";s:2:"ɩ";s:2:"Ɩ";s:2:"ɫ";s:3:"Ɫ";s:2:"ɬ";s:3:"Ɬ";s:2:"ɯ";s:2:"Ɯ";s:2:"ɱ";s:3:"Ɱ";s:2:"ɲ";s:2:"Ɲ";s:2:"ɵ";s:2:"Ɵ";s:2:"ɽ";s:3:"Ɽ";s:2:"ʀ";s:2:"Ʀ";s:2:"ʃ";s:2:"Ʃ";s:2:"ʇ";s:3:"Ʇ";s:2:"ʈ";s:2:"Ʈ";s:2:"ʉ";s:2:"Ʉ";s:2:"ʊ";s:2:"Ʊ";s:2:"ʋ";s:2:"Ʋ";s:2:"ʌ";s:2:"Ʌ";s:2:"ʒ";s:2:"Ʒ";s:2:"ʞ";s:3:"Ʞ";s:2:"ͅ";s:2:"Ι";s:2:"ͱ";s:2:"Ͱ";s:2:"ͳ";s:2:"Ͳ";s:2:"ͷ";s:2:"Ͷ";s:2:"ͻ";s:2:"Ͻ";s:2:"ͼ";s:2:"Ͼ";s:2:"ͽ";s:2:"Ͽ";s:2:"ά";s:2:"Ά";s:2:"έ";s:2:"Έ";s:2:"ή";s:2:"Ή";s:2:"ί";s:2:"Ί";s:2:"α";s:2:"Α";s:2:"β";s:2:"Β";s:2:"γ";s:2:"Γ";s:2:"δ";s:2:"Δ";s:2:"ε";s:2:"Ε";s:2:"ζ";s:2:"Ζ";s:2:"η";s:2:"Η";s:2:"θ";s:2:"Θ";s:2:"ι";s:2:"Ι";s:2:"κ";s:2:"Κ";s:2:"λ";s:2:"Λ";s:2:"μ";s:2:"Μ";s:2:"ν";s:2:"Ν";s:2:"ξ";s:2:"Ξ";s:2:"ο";s:2:"Ο";s:2:"π";s:2:"Π";s:2:"ρ";s:2:"Ρ";s:2:"ς";s:2:"Σ";s:2:"σ";s:2:"Σ";s:2:"τ";s:2:"Τ";s:2:"υ";s:2:"Υ";s:2:"φ";s:2:"Φ";s:2:"χ";s:2:"Χ";s:2:"ψ";s:2:"Ψ";s:2:"ω";s:2:"Ω";s:2:"ϊ";s:2:"Ϊ";s:2:"ϋ";s:2:"Ϋ";s:2:"ό";s:2:"Ό";s:2:"ύ";s:2:"Ύ";s:2:"ώ";s:2:"Ώ";s:2:"ϐ";s:2:"Β";s:2:"ϑ";s:2:"Θ";s:2:"ϕ";s:2:"Φ";s:2:"ϖ";s:2:"Π";s:2:"ϗ";s:2:"Ϗ";s:2:"ϙ";s:2:"Ϙ";s:2:"ϛ";s:2:"Ϛ";s:2:"ϝ";s:2:"Ϝ";s:2:"ϟ";s:2:"Ϟ";s:2:"ϡ";s:2:"Ϡ";s:2:"ϣ";s:2:"Ϣ";s:2:"ϥ";s:2:"Ϥ";s:2:"ϧ";s:2:"Ϧ";s:2:"ϩ";s:2:"Ϩ";s:2:"ϫ";s:2:"Ϫ";s:2:"ϭ";s:2:"Ϭ";s:2:"ϯ";s:2:"Ϯ";s:2:"ϰ";s:2:"Κ";s:2:"ϱ";s:2:"Ρ";s:2:"ϲ";s:2:"Ϲ";s:2:"ϳ";s:2:"Ϳ";s:2:"ϵ";s:2:"Ε";s:2:"ϸ";s:2:"Ϸ";s:2:"ϻ";s:2:"Ϻ";s:2:"а";s:2:"А";s:2:"б";s:2:"Б";s:2:"в";s:2:"В";s:2:"г";s:2:"Г";s:2:"д";s:2:"Д";s:2:"е";s:2:"Е";s:2:"ж";s:2:"Ж";s:2:"з";s:2:"З";s:2:"и";s:2:"И";s:2:"й";s:2:"Й";s:2:"к";s:2:"К";s:2:"л";s:2:"Л";s:2:"м";s:2:"М";s:2:"н";s:2:"Н";s:2:"о";s:2:"О";s:2:"п";s:2:"П";s:2:"р";s:2:"Р";s:2:"с";s:2:"С";s:2:"т";s:2:"Т";s:2:"у";s:2:"У";s:2:"ф";s:2:"Ф";s:2:"х";s:2:"Х";s:2:"ц";s:2:"Ц";s:2:"ч";s:2:"Ч";s:2:"ш";s:2:"Ш";s:2:"щ";s:2:"Щ";s:2:"ъ";s:2:"Ъ";s:2:"ы";s:2:"Ы";s:2:"ь";s:2:"Ь";s:2:"э";s:2:"Э";s:2:"ю";s:2:"Ю";s:2:"я";s:2:"Я";s:2:"ѐ";s:2:"Ѐ";s:2:"ё";s:2:"Ё";s:2:"ђ";s:2:"Ђ";s:2:"ѓ";s:2:"Ѓ";s:2:"є";s:2:"Є";s:2:"ѕ";s:2:"Ѕ";s:2:"і";s:2:"І";s:2:"ї";s:2:"Ї";s:2:"ј";s:2:"Ј";s:2:"љ";s:2:"Љ";s:2:"њ";s:2:"Њ";s:2:"ћ";s:2:"Ћ";s:2:"ќ";s:2:"Ќ";s:2:"ѝ";s:2:"Ѝ";s:2:"ў";s:2:"Ў";s:2:"џ";s:2:"Џ";s:2:"ѡ";s:2:"Ѡ";s:2:"ѣ";s:2:"Ѣ";s:2:"ѥ";s:2:"Ѥ";s:2:"ѧ";s:2:"Ѧ";s:2:"ѩ";s:2:"Ѩ";s:2:"ѫ";s:2:"Ѫ";s:2:"ѭ";s:2:"Ѭ";s:2:"ѯ";s:2:"Ѯ";s:2:"ѱ";s:2:"Ѱ";s:2:"ѳ";s:2:"Ѳ";s:2:"ѵ";s:2:"Ѵ";s:2:"ѷ";s:2:"Ѷ";s:2:"ѹ";s:2:"Ѹ";s:2:"ѻ";s:2:"Ѻ";s:2:"ѽ";s:2:"Ѽ";s:2:"ѿ";s:2:"Ѿ";s:2:"ҁ";s:2:"Ҁ";s:2:"ҋ";s:2:"Ҋ";s:2:"ҍ";s:2:"Ҍ";s:2:"ҏ";s:2:"Ҏ";s:2:"ґ";s:2:"Ґ";s:2:"ғ";s:2:"Ғ";s:2:"ҕ";s:2:"Ҕ";s:2:"җ";s:2:"Җ";s:2:"ҙ";s:2:"Ҙ";s:2:"қ";s:2:"Қ";s:2:"ҝ";s:2:"Ҝ";s:2:"ҟ";s:2:"Ҟ";s:2:"ҡ";s:2:"Ҡ";s:2:"ң";s:2:"Ң";s:2:"ҥ";s:2:"Ҥ";s:2:"ҧ";s:2:"Ҧ";s:2:"ҩ";s:2:"Ҩ";s:2:"ҫ";s:2:"Ҫ";s:2:"ҭ";s:2:"Ҭ";s:2:"ү";s:2:"Ү";s:2:"ұ";s:2:"Ұ";s:2:"ҳ";s:2:"Ҳ";s:2:"ҵ";s:2:"Ҵ";s:2:"ҷ";s:2:"Ҷ";s:2:"ҹ";s:2:"Ҹ";s:2:"һ";s:2:"Һ";s:2:"ҽ";s:2:"Ҽ";s:2:"ҿ";s:2:"Ҿ";s:2:"ӂ";s:2:"Ӂ";s:2:"ӄ";s:2:"Ӄ";s:2:"ӆ";s:2:"Ӆ";s:2:"ӈ";s:2:"Ӈ";s:2:"ӊ";s:2:"Ӊ";s:2:"ӌ";s:2:"Ӌ";s:2:"ӎ";s:2:"Ӎ";s:2:"ӏ";s:2:"Ӏ";s:2:"ӑ";s:2:"Ӑ";s:2:"ӓ";s:2:"Ӓ";s:2:"ӕ";s:2:"Ӕ";s:2:"ӗ";s:2:"Ӗ";s:2:"ә";s:2:"Ә";s:2:"ӛ";s:2:"Ӛ";s:2:"ӝ";s:2:"Ӝ";s:2:"ӟ";s:2:"Ӟ";s:2:"ӡ";s:2:"Ӡ";s:2:"ӣ";s:2:"Ӣ";s:2:"ӥ";s:2:"Ӥ";s:2:"ӧ";s:2:"Ӧ";s:2:"ө";s:2:"Ө";s:2:"ӫ";s:2:"Ӫ";s:2:"ӭ";s:2:"Ӭ";s:2:"ӯ";s:2:"Ӯ";s:2:"ӱ";s:2:"Ӱ";s:2:"ӳ";s:2:"Ӳ";s:2:"ӵ";s:2:"Ӵ";s:2:"ӷ";s:2:"Ӷ";s:2:"ӹ";s:2:"Ӹ";s:2:"ӻ";s:2:"Ӻ";s:2:"ӽ";s:2:"Ӽ";s:2:"ӿ";s:2:"Ӿ";s:2:"ԁ";s:2:"Ԁ";s:2:"ԃ";s:2:"Ԃ";s:2:"ԅ";s:2:"Ԅ";s:2:"ԇ";s:2:"Ԇ";s:2:"ԉ";s:2:"Ԉ";s:2:"ԋ";s:2:"Ԋ";s:2:"ԍ";s:2:"Ԍ";s:2:"ԏ";s:2:"Ԏ";s:2:"ԑ";s:2:"Ԑ";s:2:"ԓ";s:2:"Ԓ";s:2:"ԕ";s:2:"Ԕ";s:2:"ԗ";s:2:"Ԗ";s:2:"ԙ";s:2:"Ԙ";s:2:"ԛ";s:2:"Ԛ";s:2:"ԝ";s:2:"Ԝ";s:2:"ԟ";s:2:"Ԟ";s:2:"ԡ";s:2:"Ԡ";s:2:"ԣ";s:2:"Ԣ";s:2:"ԥ";s:2:"Ԥ";s:2:"ԧ";s:2:"Ԧ";s:2:"ԩ";s:2:"Ԩ";s:2:"ԫ";s:2:"Ԫ";s:2:"ԭ";s:2:"Ԭ";s:2:"ԯ";s:2:"Ԯ";s:2:"ա";s:2:"Ա";s:2:"բ";s:2:"Բ";s:2:"գ";s:2:"Գ";s:2:"դ";s:2:"Դ";s:2:"ե";s:2:"Ե";s:2:"զ";s:2:"Զ";s:2:"է";s:2:"Է";s:2:"ը";s:2:"Ը";s:2:"թ";s:2:"Թ";s:2:"ժ";s:2:"Ժ";s:2:"ի";s:2:"Ի";s:2:"լ";s:2:"Լ";s:2:"խ";s:2:"Խ";s:2:"ծ";s:2:"Ծ";s:2:"կ";s:2:"Կ";s:2:"հ";s:2:"Հ";s:2:"ձ";s:2:"Ձ";s:2:"ղ";s:2:"Ղ";s:2:"ճ";s:2:"Ճ";s:2:"մ";s:2:"Մ";s:2:"յ";s:2:"Յ";s:2:"ն";s:2:"Ն";s:2:"շ";s:2:"Շ";s:2:"ո";s:2:"Ո";s:2:"չ";s:2:"Չ";s:2:"պ";s:2:"Պ";s:2:"ջ";s:2:"Ջ";s:2:"ռ";s:2:"Ռ";s:2:"ս";s:2:"Ս";s:2:"վ";s:2:"Վ";s:2:"տ";s:2:"Տ";s:2:"ր";s:2:"Ր";s:2:"ց";s:2:"Ց";s:2:"ւ";s:2:"Ւ";s:2:"փ";s:2:"Փ";s:2:"ք";s:2:"Ք";s:2:"օ";s:2:"Օ";s:2:"ֆ";s:2:"Ֆ";s:3:"ᵹ";s:3:"Ᵹ";s:3:"ᵽ";s:3:"Ᵽ";s:3:"ḁ";s:3:"Ḁ";s:3:"ḃ";s:3:"Ḃ";s:3:"ḅ";s:3:"Ḅ";s:3:"ḇ";s:3:"Ḇ";s:3:"ḉ";s:3:"Ḉ";s:3:"ḋ";s:3:"Ḋ";s:3:"ḍ";s:3:"Ḍ";s:3:"ḏ";s:3:"Ḏ";s:3:"ḑ";s:3:"Ḑ";s:3:"ḓ";s:3:"Ḓ";s:3:"ḕ";s:3:"Ḕ";s:3:"ḗ";s:3:"Ḗ";s:3:"ḙ";s:3:"Ḙ";s:3:"ḛ";s:3:"Ḛ";s:3:"ḝ";s:3:"Ḝ";s:3:"ḟ";s:3:"Ḟ";s:3:"ḡ";s:3:"Ḡ";s:3:"ḣ";s:3:"Ḣ";s:3:"ḥ";s:3:"Ḥ";s:3:"ḧ";s:3:"Ḧ";s:3:"ḩ";s:3:"Ḩ";s:3:"ḫ";s:3:"Ḫ";s:3:"ḭ";s:3:"Ḭ";s:3:"ḯ";s:3:"Ḯ";s:3:"ḱ";s:3:"Ḱ";s:3:"ḳ";s:3:"Ḳ";s:3:"ḵ";s:3:"Ḵ";s:3:"ḷ";s:3:"Ḷ";s:3:"ḹ";s:3:"Ḹ";s:3:"ḻ";s:3:"Ḻ";s:3:"ḽ";s:3:"Ḽ";s:3:"ḿ";s:3:"Ḿ";s:3:"ṁ";s:3:"Ṁ";s:3:"ṃ";s:3:"Ṃ";s:3:"ṅ";s:3:"Ṅ";s:3:"ṇ";s:3:"Ṇ";s:3:"ṉ";s:3:"Ṉ";s:3:"ṋ";s:3:"Ṋ";s:3:"ṍ";s:3:"Ṍ";s:3:"ṏ";s:3:"Ṏ";s:3:"ṑ";s:3:"Ṑ";s:3:"ṓ";s:3:"Ṓ";s:3:"ṕ";s:3:"Ṕ";s:3:"ṗ";s:3:"Ṗ";s:3:"ṙ";s:3:"Ṙ";s:3:"ṛ";s:3:"Ṛ";s:3:"ṝ";s:3:"Ṝ";s:3:"ṟ";s:3:"Ṟ";s:3:"ṡ";s:3:"Ṡ";s:3:"ṣ";s:3:"Ṣ";s:3:"ṥ";s:3:"Ṥ";s:3:"ṧ";s:3:"Ṧ";s:3:"ṩ";s:3:"Ṩ";s:3:"ṫ";s:3:"Ṫ";s:3:"ṭ";s:3:"Ṭ";s:3:"ṯ";s:3:"Ṯ";s:3:"ṱ";s:3:"Ṱ";s:3:"ṳ";s:3:"Ṳ";s:3:"ṵ";s:3:"Ṵ";s:3:"ṷ";s:3:"Ṷ";s:3:"ṹ";s:3:"Ṹ";s:3:"ṻ";s:3:"Ṻ";s:3:"ṽ";s:3:"Ṽ";s:3:"ṿ";s:3:"Ṿ";s:3:"ẁ";s:3:"Ẁ";s:3:"ẃ";s:3:"Ẃ";s:3:"ẅ";s:3:"Ẅ";s:3:"ẇ";s:3:"Ẇ";s:3:"ẉ";s:3:"Ẉ";s:3:"ẋ";s:3:"Ẋ";s:3:"ẍ";s:3:"Ẍ";s:3:"ẏ";s:3:"Ẏ";s:3:"ẑ";s:3:"Ẑ";s:3:"ẓ";s:3:"Ẓ";s:3:"ẕ";s:3:"Ẕ";s:3:"ẛ";s:3:"Ṡ";s:3:"ạ";s:3:"Ạ";s:3:"ả";s:3:"Ả";s:3:"ấ";s:3:"Ấ";s:3:"ầ";s:3:"Ầ";s:3:"ẩ";s:3:"Ẩ";s:3:"ẫ";s:3:"Ẫ";s:3:"ậ";s:3:"Ậ";s:3:"ắ";s:3:"Ắ";s:3:"ằ";s:3:"Ằ";s:3:"ẳ";s:3:"Ẳ";s:3:"ẵ";s:3:"Ẵ";s:3:"ặ";s:3:"Ặ";s:3:"ẹ";s:3:"Ẹ";s:3:"ẻ";s:3:"Ẻ";s:3:"ẽ";s:3:"Ẽ";s:3:"ế";s:3:"Ế";s:3:"ề";s:3:"Ề";s:3:"ể";s:3:"Ể";s:3:"ễ";s:3:"Ễ";s:3:"ệ";s:3:"Ệ";s:3:"ỉ";s:3:"Ỉ";s:3:"ị";s:3:"Ị";s:3:"ọ";s:3:"Ọ";s:3:"ỏ";s:3:"Ỏ";s:3:"ố";s:3:"Ố";s:3:"ồ";s:3:"Ồ";s:3:"ổ";s:3:"Ổ";s:3:"ỗ";s:3:"Ỗ";s:3:"ộ";s:3:"Ộ";s:3:"ớ";s:3:"Ớ";s:3:"ờ";s:3:"Ờ";s:3:"ở";s:3:"Ở";s:3:"ỡ";s:3:"Ỡ";s:3:"ợ";s:3:"Ợ";s:3:"ụ";s:3:"Ụ";s:3:"ủ";s:3:"Ủ";s:3:"ứ";s:3:"Ứ";s:3:"ừ";s:3:"Ừ";s:3:"ử";s:3:"Ử";s:3:"ữ";s:3:"Ữ";s:3:"ự";s:3:"Ự";s:3:"ỳ";s:3:"Ỳ";s:3:"ỵ";s:3:"Ỵ";s:3:"ỷ";s:3:"Ỷ";s:3:"ỹ";s:3:"Ỹ";s:3:"ỻ";s:3:"Ỻ";s:3:"ỽ";s:3:"Ỽ";s:3:"ỿ";s:3:"Ỿ";s:3:"ἀ";s:3:"Ἀ";s:3:"ἁ";s:3:"Ἁ";s:3:"ἂ";s:3:"Ἂ";s:3:"ἃ";s:3:"Ἃ";s:3:"ἄ";s:3:"Ἄ";s:3:"ἅ";s:3:"Ἅ";s:3:"ἆ";s:3:"Ἆ";s:3:"ἇ";s:3:"Ἇ";s:3:"ἐ";s:3:"Ἐ";s:3:"ἑ";s:3:"Ἑ";s:3:"ἒ";s:3:"Ἒ";s:3:"ἓ";s:3:"Ἓ";s:3:"ἔ";s:3:"Ἔ";s:3:"ἕ";s:3:"Ἕ";s:3:"ἠ";s:3:"Ἠ";s:3:"ἡ";s:3:"Ἡ";s:3:"ἢ";s:3:"Ἢ";s:3:"ἣ";s:3:"Ἣ";s:3:"ἤ";s:3:"Ἤ";s:3:"ἥ";s:3:"Ἥ";s:3:"ἦ";s:3:"Ἦ";s:3:"ἧ";s:3:"Ἧ";s:3:"ἰ";s:3:"Ἰ";s:3:"ἱ";s:3:"Ἱ";s:3:"ἲ";s:3:"Ἲ";s:3:"ἳ";s:3:"Ἳ";s:3:"ἴ";s:3:"Ἴ";s:3:"ἵ";s:3:"Ἵ";s:3:"ἶ";s:3:"Ἶ";s:3:"ἷ";s:3:"Ἷ";s:3:"ὀ";s:3:"Ὀ";s:3:"ὁ";s:3:"Ὁ";s:3:"ὂ";s:3:"Ὂ";s:3:"ὃ";s:3:"Ὃ";s:3:"ὄ";s:3:"Ὄ";s:3:"ὅ";s:3:"Ὅ";s:3:"ὑ";s:3:"Ὑ";s:3:"ὓ";s:3:"Ὓ";s:3:"ὕ";s:3:"Ὕ";s:3:"ὗ";s:3:"Ὗ";s:3:"ὠ";s:3:"Ὠ";s:3:"ὡ";s:3:"Ὡ";s:3:"ὢ";s:3:"Ὢ";s:3:"ὣ";s:3:"Ὣ";s:3:"ὤ";s:3:"Ὤ";s:3:"ὥ";s:3:"Ὥ";s:3:"ὦ";s:3:"Ὦ";s:3:"ὧ";s:3:"Ὧ";s:3:"ὰ";s:3:"Ὰ";s:3:"ά";s:3:"Ά";s:3:"ὲ";s:3:"Ὲ";s:3:"έ";s:3:"Έ";s:3:"ὴ";s:3:"Ὴ";s:3:"ή";s:3:"Ή";s:3:"ὶ";s:3:"Ὶ";s:3:"ί";s:3:"Ί";s:3:"ὸ";s:3:"Ὸ";s:3:"ό";s:3:"Ό";s:3:"ὺ";s:3:"Ὺ";s:3:"ύ";s:3:"Ύ";s:3:"ὼ";s:3:"Ὼ";s:3:"ώ";s:3:"Ώ";s:3:"ᾀ";s:3:"ᾈ";s:3:"ᾁ";s:3:"ᾉ";s:3:"ᾂ";s:3:"ᾊ";s:3:"ᾃ";s:3:"ᾋ";s:3:"ᾄ";s:3:"ᾌ";s:3:"ᾅ";s:3:"ᾍ";s:3:"ᾆ";s:3:"ᾎ";s:3:"ᾇ";s:3:"ᾏ";s:3:"ᾐ";s:3:"ᾘ";s:3:"ᾑ";s:3:"ᾙ";s:3:"ᾒ";s:3:"ᾚ";s:3:"ᾓ";s:3:"ᾛ";s:3:"ᾔ";s:3:"ᾜ";s:3:"ᾕ";s:3:"ᾝ";s:3:"ᾖ";s:3:"ᾞ";s:3:"ᾗ";s:3:"ᾟ";s:3:"ᾠ";s:3:"ᾨ";s:3:"ᾡ";s:3:"ᾩ";s:3:"ᾢ";s:3:"ᾪ";s:3:"ᾣ";s:3:"ᾫ";s:3:"ᾤ";s:3:"ᾬ";s:3:"ᾥ";s:3:"ᾭ";s:3:"ᾦ";s:3:"ᾮ";s:3:"ᾧ";s:3:"ᾯ";s:3:"ᾰ";s:3:"Ᾰ";s:3:"ᾱ";s:3:"Ᾱ";s:3:"ᾳ";s:3:"ᾼ";s:3:"ι";s:2:"Ι";s:3:"ῃ";s:3:"ῌ";s:3:"ῐ";s:3:"Ῐ";s:3:"ῑ";s:3:"Ῑ";s:3:"ῠ";s:3:"Ῠ";s:3:"ῡ";s:3:"Ῡ";s:3:"ῥ";s:3:"Ῥ";s:3:"ῳ";s:3:"ῼ";s:3:"ⅎ";s:3:"Ⅎ";s:3:"ⅰ";s:3:"Ⅰ";s:3:"ⅱ";s:3:"Ⅱ";s:3:"ⅲ";s:3:"Ⅲ";s:3:"ⅳ";s:3:"Ⅳ";s:3:"ⅴ";s:3:"Ⅴ";s:3:"ⅵ";s:3:"Ⅵ";s:3:"ⅶ";s:3:"Ⅶ";s:3:"ⅷ";s:3:"Ⅷ";s:3:"ⅸ";s:3:"Ⅸ";s:3:"ⅹ";s:3:"Ⅹ";s:3:"ⅺ";s:3:"Ⅺ";s:3:"ⅻ";s:3:"Ⅻ";s:3:"ⅼ";s:3:"Ⅼ";s:3:"ⅽ";s:3:"Ⅽ";s:3:"ⅾ";s:3:"Ⅾ";s:3:"ⅿ";s:3:"Ⅿ";s:3:"ↄ";s:3:"Ↄ";s:3:"ⓐ";s:3:"Ⓐ";s:3:"ⓑ";s:3:"Ⓑ";s:3:"ⓒ";s:3:"Ⓒ";s:3:"ⓓ";s:3:"Ⓓ";s:3:"ⓔ";s:3:"Ⓔ";s:3:"ⓕ";s:3:"Ⓕ";s:3:"ⓖ";s:3:"Ⓖ";s:3:"ⓗ";s:3:"Ⓗ";s:3:"ⓘ";s:3:"Ⓘ";s:3:"ⓙ";s:3:"Ⓙ";s:3:"ⓚ";s:3:"Ⓚ";s:3:"ⓛ";s:3:"Ⓛ";s:3:"ⓜ";s:3:"Ⓜ";s:3:"ⓝ";s:3:"Ⓝ";s:3:"ⓞ";s:3:"Ⓞ";s:3:"ⓟ";s:3:"Ⓟ";s:3:"ⓠ";s:3:"Ⓠ";s:3:"ⓡ";s:3:"Ⓡ";s:3:"ⓢ";s:3:"Ⓢ";s:3:"ⓣ";s:3:"Ⓣ";s:3:"ⓤ";s:3:"Ⓤ";s:3:"ⓥ";s:3:"Ⓥ";s:3:"ⓦ";s:3:"Ⓦ";s:3:"ⓧ";s:3:"Ⓧ";s:3:"ⓨ";s:3:"Ⓨ";s:3:"ⓩ";s:3:"Ⓩ";s:3:"ⰰ";s:3:"Ⰰ";s:3:"ⰱ";s:3:"Ⰱ";s:3:"ⰲ";s:3:"Ⰲ";s:3:"ⰳ";s:3:"Ⰳ";s:3:"ⰴ";s:3:"Ⰴ";s:3:"ⰵ";s:3:"Ⰵ";s:3:"ⰶ";s:3:"Ⰶ";s:3:"ⰷ";s:3:"Ⰷ";s:3:"ⰸ";s:3:"Ⰸ";s:3:"ⰹ";s:3:"Ⰹ";s:3:"ⰺ";s:3:"Ⰺ";s:3:"ⰻ";s:3:"Ⰻ";s:3:"ⰼ";s:3:"Ⰼ";s:3:"ⰽ";s:3:"Ⰽ";s:3:"ⰾ";s:3:"Ⰾ";s:3:"ⰿ";s:3:"Ⰿ";s:3:"ⱀ";s:3:"Ⱀ";s:3:"ⱁ";s:3:"Ⱁ";s:3:"ⱂ";s:3:"Ⱂ";s:3:"ⱃ";s:3:"Ⱃ";s:3:"ⱄ";s:3:"Ⱄ";s:3:"ⱅ";s:3:"Ⱅ";s:3:"ⱆ";s:3:"Ⱆ";s:3:"ⱇ";s:3:"Ⱇ";s:3:"ⱈ";s:3:"Ⱈ";s:3:"ⱉ";s:3:"Ⱉ";s:3:"ⱊ";s:3:"Ⱊ";s:3:"ⱋ";s:3:"Ⱋ";s:3:"ⱌ";s:3:"Ⱌ";s:3:"ⱍ";s:3:"Ⱍ";s:3:"ⱎ";s:3:"Ⱎ";s:3:"ⱏ";s:3:"Ⱏ";s:3:"ⱐ";s:3:"Ⱐ";s:3:"ⱑ";s:3:"Ⱑ";s:3:"ⱒ";s:3:"Ⱒ";s:3:"ⱓ";s:3:"Ⱓ";s:3:"ⱔ";s:3:"Ⱔ";s:3:"ⱕ";s:3:"Ⱕ";s:3:"ⱖ";s:3:"Ⱖ";s:3:"ⱗ";s:3:"Ⱗ";s:3:"ⱘ";s:3:"Ⱘ";s:3:"ⱙ";s:3:"Ⱙ";s:3:"ⱚ";s:3:"Ⱚ";s:3:"ⱛ";s:3:"Ⱛ";s:3:"ⱜ";s:3:"Ⱜ";s:3:"ⱝ";s:3:"Ⱝ";s:3:"ⱞ";s:3:"Ⱞ";s:3:"ⱡ";s:3:"Ⱡ";s:3:"ⱥ";s:2:"Ⱥ";s:3:"ⱦ";s:2:"Ⱦ";s:3:"ⱨ";s:3:"Ⱨ";s:3:"ⱪ";s:3:"Ⱪ";s:3:"ⱬ";s:3:"Ⱬ";s:3:"ⱳ";s:3:"Ⱳ";s:3:"ⱶ";s:3:"Ⱶ";s:3:"ⲁ";s:3:"Ⲁ";s:3:"ⲃ";s:3:"Ⲃ";s:3:"ⲅ";s:3:"Ⲅ";s:3:"ⲇ";s:3:"Ⲇ";s:3:"ⲉ";s:3:"Ⲉ";s:3:"ⲋ";s:3:"Ⲋ";s:3:"ⲍ";s:3:"Ⲍ";s:3:"ⲏ";s:3:"Ⲏ";s:3:"ⲑ";s:3:"Ⲑ";s:3:"ⲓ";s:3:"Ⲓ";s:3:"ⲕ";s:3:"Ⲕ";s:3:"ⲗ";s:3:"Ⲗ";s:3:"ⲙ";s:3:"Ⲙ";s:3:"ⲛ";s:3:"Ⲛ";s:3:"ⲝ";s:3:"Ⲝ";s:3:"ⲟ";s:3:"Ⲟ";s:3:"ⲡ";s:3:"Ⲡ";s:3:"ⲣ";s:3:"Ⲣ";s:3:"ⲥ";s:3:"Ⲥ";s:3:"ⲧ";s:3:"Ⲧ";s:3:"ⲩ";s:3:"Ⲩ";s:3:"ⲫ";s:3:"Ⲫ";s:3:"ⲭ";s:3:"Ⲭ";s:3:"ⲯ";s:3:"Ⲯ";s:3:"ⲱ";s:3:"Ⲱ";s:3:"ⲳ";s:3:"Ⲳ";s:3:"ⲵ";s:3:"Ⲵ";s:3:"ⲷ";s:3:"Ⲷ";s:3:"ⲹ";s:3:"Ⲹ";s:3:"ⲻ";s:3:"Ⲻ";s:3:"ⲽ";s:3:"Ⲽ";s:3:"ⲿ";s:3:"Ⲿ";s:3:"ⳁ";s:3:"Ⳁ";s:3:"ⳃ";s:3:"Ⳃ";s:3:"ⳅ";s:3:"Ⳅ";s:3:"ⳇ";s:3:"Ⳇ";s:3:"ⳉ";s:3:"Ⳉ";s:3:"ⳋ";s:3:"Ⳋ";s:3:"ⳍ";s:3:"Ⳍ";s:3:"ⳏ";s:3:"Ⳏ";s:3:"ⳑ";s:3:"Ⳑ";s:3:"ⳓ";s:3:"Ⳓ";s:3:"ⳕ";s:3:"Ⳕ";s:3:"ⳗ";s:3:"Ⳗ";s:3:"ⳙ";s:3:"Ⳙ";s:3:"ⳛ";s:3:"Ⳛ";s:3:"ⳝ";s:3:"Ⳝ";s:3:"ⳟ";s:3:"Ⳟ";s:3:"ⳡ";s:3:"Ⳡ";s:3:"ⳣ";s:3:"Ⳣ";s:3:"ⳬ";s:3:"Ⳬ";s:3:"ⳮ";s:3:"Ⳮ";s:3:"ⳳ";s:3:"Ⳳ";s:3:"ⴀ";s:3:"Ⴀ";s:3:"ⴁ";s:3:"Ⴁ";s:3:"ⴂ";s:3:"Ⴂ";s:3:"ⴃ";s:3:"Ⴃ";s:3:"ⴄ";s:3:"Ⴄ";s:3:"ⴅ";s:3:"Ⴅ";s:3:"ⴆ";s:3:"Ⴆ";s:3:"ⴇ";s:3:"Ⴇ";s:3:"ⴈ";s:3:"Ⴈ";s:3:"ⴉ";s:3:"Ⴉ";s:3:"ⴊ";s:3:"Ⴊ";s:3:"ⴋ";s:3:"Ⴋ";s:3:"ⴌ";s:3:"Ⴌ";s:3:"ⴍ";s:3:"Ⴍ";s:3:"ⴎ";s:3:"Ⴎ";s:3:"ⴏ";s:3:"Ⴏ";s:3:"ⴐ";s:3:"Ⴐ";s:3:"ⴑ";s:3:"Ⴑ";s:3:"ⴒ";s:3:"Ⴒ";s:3:"ⴓ";s:3:"Ⴓ";s:3:"ⴔ";s:3:"Ⴔ";s:3:"ⴕ";s:3:"Ⴕ";s:3:"ⴖ";s:3:"Ⴖ";s:3:"ⴗ";s:3:"Ⴗ";s:3:"ⴘ";s:3:"Ⴘ";s:3:"ⴙ";s:3:"Ⴙ";s:3:"ⴚ";s:3:"Ⴚ";s:3:"ⴛ";s:3:"Ⴛ";s:3:"ⴜ";s:3:"Ⴜ";s:3:"ⴝ";s:3:"Ⴝ";s:3:"ⴞ";s:3:"Ⴞ";s:3:"ⴟ";s:3:"Ⴟ";s:3:"ⴠ";s:3:"Ⴠ";s:3:"ⴡ";s:3:"Ⴡ";s:3:"ⴢ";s:3:"Ⴢ";s:3:"ⴣ";s:3:"Ⴣ";s:3:"ⴤ";s:3:"Ⴤ";s:3:"ⴥ";s:3:"Ⴥ";s:3:"ⴧ";s:3:"Ⴧ";s:3:"ⴭ";s:3:"Ⴭ";s:3:"ꙁ";s:3:"Ꙁ";s:3:"ꙃ";s:3:"Ꙃ";s:3:"ꙅ";s:3:"Ꙅ";s:3:"ꙇ";s:3:"Ꙇ";s:3:"ꙉ";s:3:"Ꙉ";s:3:"ꙋ";s:3:"Ꙋ";s:3:"ꙍ";s:3:"Ꙍ";s:3:"ꙏ";s:3:"Ꙏ";s:3:"ꙑ";s:3:"Ꙑ";s:3:"ꙓ";s:3:"Ꙓ";s:3:"ꙕ";s:3:"Ꙕ";s:3:"ꙗ";s:3:"Ꙗ";s:3:"ꙙ";s:3:"Ꙙ";s:3:"ꙛ";s:3:"Ꙛ";s:3:"ꙝ";s:3:"Ꙝ";s:3:"ꙟ";s:3:"Ꙟ";s:3:"ꙡ";s:3:"Ꙡ";s:3:"ꙣ";s:3:"Ꙣ";s:3:"ꙥ";s:3:"Ꙥ";s:3:"ꙧ";s:3:"Ꙧ";s:3:"ꙩ";s:3:"Ꙩ";s:3:"ꙫ";s:3:"Ꙫ";s:3:"ꙭ";s:3:"Ꙭ";s:3:"ꚁ";s:3:"Ꚁ";s:3:"ꚃ";s:3:"Ꚃ";s:3:"ꚅ";s:3:"Ꚅ";s:3:"ꚇ";s:3:"Ꚇ";s:3:"ꚉ";s:3:"Ꚉ";s:3:"ꚋ";s:3:"Ꚋ";s:3:"ꚍ";s:3:"Ꚍ";s:3:"ꚏ";s:3:"Ꚏ";s:3:"ꚑ";s:3:"Ꚑ";s:3:"ꚓ";s:3:"Ꚓ";s:3:"ꚕ";s:3:"Ꚕ";s:3:"ꚗ";s:3:"Ꚗ";s:3:"ꚙ";s:3:"Ꚙ";s:3:"ꚛ";s:3:"Ꚛ";s:3:"ꜣ";s:3:"Ꜣ";s:3:"ꜥ";s:3:"Ꜥ";s:3:"ꜧ";s:3:"Ꜧ";s:3:"ꜩ";s:3:"Ꜩ";s:3:"ꜫ";s:3:"Ꜫ";s:3:"ꜭ";s:3:"Ꜭ";s:3:"ꜯ";s:3:"Ꜯ";s:3:"ꜳ";s:3:"Ꜳ";s:3:"ꜵ";s:3:"Ꜵ";s:3:"ꜷ";s:3:"Ꜷ";s:3:"ꜹ";s:3:"Ꜹ";s:3:"ꜻ";s:3:"Ꜻ";s:3:"ꜽ";s:3:"Ꜽ";s:3:"ꜿ";s:3:"Ꜿ";s:3:"ꝁ";s:3:"Ꝁ";s:3:"ꝃ";s:3:"Ꝃ";s:3:"ꝅ";s:3:"Ꝅ";s:3:"ꝇ";s:3:"Ꝇ";s:3:"ꝉ";s:3:"Ꝉ";s:3:"ꝋ";s:3:"Ꝋ";s:3:"ꝍ";s:3:"Ꝍ";s:3:"ꝏ";s:3:"Ꝏ";s:3:"ꝑ";s:3:"Ꝑ";s:3:"ꝓ";s:3:"Ꝓ";s:3:"ꝕ";s:3:"Ꝕ";s:3:"ꝗ";s:3:"Ꝗ";s:3:"ꝙ";s:3:"Ꝙ";s:3:"ꝛ";s:3:"Ꝛ";s:3:"ꝝ";s:3:"Ꝝ";s:3:"ꝟ";s:3:"Ꝟ";s:3:"ꝡ";s:3:"Ꝡ";s:3:"ꝣ";s:3:"Ꝣ";s:3:"ꝥ";s:3:"Ꝥ";s:3:"ꝧ";s:3:"Ꝧ";s:3:"ꝩ";s:3:"Ꝩ";s:3:"ꝫ";s:3:"Ꝫ";s:3:"ꝭ";s:3:"Ꝭ";s:3:"ꝯ";s:3:"Ꝯ";s:3:"ꝺ";s:3:"Ꝺ";s:3:"ꝼ";s:3:"Ꝼ";s:3:"ꝿ";s:3:"Ꝿ";s:3:"ꞁ";s:3:"Ꞁ";s:3:"ꞃ";s:3:"Ꞃ";s:3:"ꞅ";s:3:"Ꞅ";s:3:"ꞇ";s:3:"Ꞇ";s:3:"ꞌ";s:3:"Ꞌ";s:3:"ꞑ";s:3:"Ꞑ";s:3:"ꞓ";s:3:"Ꞓ";s:3:"ꞗ";s:3:"Ꞗ";s:3:"ꞙ";s:3:"Ꞙ";s:3:"ꞛ";s:3:"Ꞛ";s:3:"ꞝ";s:3:"Ꞝ";s:3:"ꞟ";s:3:"Ꞟ";s:3:"ꞡ";s:3:"Ꞡ";s:3:"ꞣ";s:3:"Ꞣ";s:3:"ꞥ";s:3:"Ꞥ";s:3:"ꞧ";s:3:"Ꞧ";s:3:"ꞩ";s:3:"Ꞩ";s:3:"a";s:3:"A";s:3:"b";s:3:"B";s:3:"c";s:3:"C";s:3:"d";s:3:"D";s:3:"e";s:3:"E";s:3:"f";s:3:"F";s:3:"g";s:3:"G";s:3:"h";s:3:"H";s:3:"i";s:3:"I";s:3:"j";s:3:"J";s:3:"k";s:3:"K";s:3:"l";s:3:"L";s:3:"m";s:3:"M";s:3:"n";s:3:"N";s:3:"o";s:3:"O";s:3:"p";s:3:"P";s:3:"q";s:3:"Q";s:3:"r";s:3:"R";s:3:"s";s:3:"S";s:3:"t";s:3:"T";s:3:"u";s:3:"U";s:3:"v";s:3:"V";s:3:"w";s:3:"W";s:3:"x";s:3:"X";s:3:"y";s:3:"Y";s:3:"z";s:3:"Z";s:4:"𐐨";s:4:"𐐀";s:4:"𐐩";s:4:"𐐁";s:4:"𐐪";s:4:"𐐂";s:4:"𐐫";s:4:"𐐃";s:4:"𐐬";s:4:"𐐄";s:4:"𐐭";s:4:"𐐅";s:4:"𐐮";s:4:"𐐆";s:4:"𐐯";s:4:"𐐇";s:4:"𐐰";s:4:"𐐈";s:4:"𐐱";s:4:"𐐉";s:4:"𐐲";s:4:"𐐊";s:4:"𐐳";s:4:"𐐋";s:4:"𐐴";s:4:"𐐌";s:4:"𐐵";s:4:"𐐍";s:4:"𐐶";s:4:"𐐎";s:4:"𐐷";s:4:"𐐏";s:4:"𐐸";s:4:"𐐐";s:4:"𐐹";s:4:"𐐑";s:4:"𐐺";s:4:"𐐒";s:4:"𐐻";s:4:"𐐓";s:4:"𐐼";s:4:"𐐔";s:4:"𐐽";s:4:"𐐕";s:4:"𐐾";s:4:"𐐖";s:4:"𐐿";s:4:"𐐗";s:4:"𐑀";s:4:"𐐘";s:4:"𐑁";s:4:"𐐙";s:4:"𐑂";s:4:"𐐚";s:4:"𐑃";s:4:"𐐛";s:4:"𐑄";s:4:"𐐜";s:4:"𐑅";s:4:"𐐝";s:4:"𐑆";s:4:"𐐞";s:4:"𐑇";s:4:"𐐟";s:4:"𐑈";s:4:"𐐠";s:4:"𐑉";s:4:"𐐡";s:4:"𐑊";s:4:"𐐢";s:4:"𐑋";s:4:"𐐣";s:4:"𐑌";s:4:"𐐤";s:4:"𐑍";s:4:"𐐥";s:4:"𐑎";s:4:"𐐦";s:4:"𐑏";s:4:"𐐧";s:4:"𑣀";s:4:"𑢠";s:4:"𑣁";s:4:"𑢡";s:4:"𑣂";s:4:"𑢢";s:4:"𑣃";s:4:"𑢣";s:4:"𑣄";s:4:"𑢤";s:4:"𑣅";s:4:"𑢥";s:4:"𑣆";s:4:"𑢦";s:4:"𑣇";s:4:"𑢧";s:4:"𑣈";s:4:"𑢨";s:4:"𑣉";s:4:"𑢩";s:4:"𑣊";s:4:"𑢪";s:4:"𑣋";s:4:"𑢫";s:4:"𑣌";s:4:"𑢬";s:4:"𑣍";s:4:"𑢭";s:4:"𑣎";s:4:"𑢮";s:4:"𑣏";s:4:"𑢯";s:4:"𑣐";s:4:"𑢰";s:4:"𑣑";s:4:"𑢱";s:4:"𑣒";s:4:"𑢲";s:4:"𑣓";s:4:"𑢳";s:4:"𑣔";s:4:"𑢴";s:4:"𑣕";s:4:"𑢵";s:4:"𑣖";s:4:"𑢶";s:4:"𑣗";s:4:"𑢷";s:4:"𑣘";s:4:"𑢸";s:4:"𑣙";s:4:"𑢹";s:4:"𑣚";s:4:"𑢺";s:4:"𑣛";s:4:"𑢻";s:4:"𑣜";s:4:"𑢼";s:4:"𑣝";s:4:"𑢽";s:4:"𑣞";s:4:"𑢾";s:4:"𑣟";s:4:"𑢿";} \ No newline at end of file +a:1407:{s:1:"a";s:1:"A";s:1:"b";s:1:"B";s:1:"c";s:1:"C";s:1:"d";s:1:"D";s:1:"e";s:1:"E";s:1:"f";s:1:"F";s:1:"g";s:1:"G";s:1:"h";s:1:"H";s:1:"i";s:1:"I";s:1:"j";s:1:"J";s:1:"k";s:1:"K";s:1:"l";s:1:"L";s:1:"m";s:1:"M";s:1:"n";s:1:"N";s:1:"o";s:1:"O";s:1:"p";s:1:"P";s:1:"q";s:1:"Q";s:1:"r";s:1:"R";s:1:"s";s:1:"S";s:1:"t";s:1:"T";s:1:"u";s:1:"U";s:1:"v";s:1:"V";s:1:"w";s:1:"W";s:1:"x";s:1:"X";s:1:"y";s:1:"Y";s:1:"z";s:1:"Z";s:2:"µ";s:2:"Μ";s:2:"à";s:2:"À";s:2:"á";s:2:"Á";s:2:"â";s:2:"Â";s:2:"ã";s:2:"Ã";s:2:"ä";s:2:"Ä";s:2:"å";s:2:"Å";s:2:"æ";s:2:"Æ";s:2:"ç";s:2:"Ç";s:2:"è";s:2:"È";s:2:"é";s:2:"É";s:2:"ê";s:2:"Ê";s:2:"ë";s:2:"Ë";s:2:"ì";s:2:"Ì";s:2:"í";s:2:"Í";s:2:"î";s:2:"Î";s:2:"ï";s:2:"Ï";s:2:"ð";s:2:"Ð";s:2:"ñ";s:2:"Ñ";s:2:"ò";s:2:"Ò";s:2:"ó";s:2:"Ó";s:2:"ô";s:2:"Ô";s:2:"õ";s:2:"Õ";s:2:"ö";s:2:"Ö";s:2:"ø";s:2:"Ø";s:2:"ù";s:2:"Ù";s:2:"ú";s:2:"Ú";s:2:"û";s:2:"Û";s:2:"ü";s:2:"Ü";s:2:"ý";s:2:"Ý";s:2:"þ";s:2:"Þ";s:2:"ÿ";s:2:"Ÿ";s:2:"ā";s:2:"Ā";s:2:"ă";s:2:"Ă";s:2:"ą";s:2:"Ą";s:2:"ć";s:2:"Ć";s:2:"ĉ";s:2:"Ĉ";s:2:"ċ";s:2:"Ċ";s:2:"č";s:2:"Č";s:2:"ď";s:2:"Ď";s:2:"đ";s:2:"Đ";s:2:"ē";s:2:"Ē";s:2:"ĕ";s:2:"Ĕ";s:2:"ė";s:2:"Ė";s:2:"ę";s:2:"Ę";s:2:"ě";s:2:"Ě";s:2:"ĝ";s:2:"Ĝ";s:2:"ğ";s:2:"Ğ";s:2:"ġ";s:2:"Ġ";s:2:"ģ";s:2:"Ģ";s:2:"ĥ";s:2:"Ĥ";s:2:"ħ";s:2:"Ħ";s:2:"ĩ";s:2:"Ĩ";s:2:"ī";s:2:"Ī";s:2:"ĭ";s:2:"Ĭ";s:2:"į";s:2:"Į";s:2:"ı";s:1:"I";s:2:"ij";s:2:"IJ";s:2:"ĵ";s:2:"Ĵ";s:2:"ķ";s:2:"Ķ";s:2:"ĺ";s:2:"Ĺ";s:2:"ļ";s:2:"Ļ";s:2:"ľ";s:2:"Ľ";s:2:"ŀ";s:2:"Ŀ";s:2:"ł";s:2:"Ł";s:2:"ń";s:2:"Ń";s:2:"ņ";s:2:"Ņ";s:2:"ň";s:2:"Ň";s:2:"ŋ";s:2:"Ŋ";s:2:"ō";s:2:"Ō";s:2:"ŏ";s:2:"Ŏ";s:2:"ő";s:2:"Ő";s:2:"œ";s:2:"Œ";s:2:"ŕ";s:2:"Ŕ";s:2:"ŗ";s:2:"Ŗ";s:2:"ř";s:2:"Ř";s:2:"ś";s:2:"Ś";s:2:"ŝ";s:2:"Ŝ";s:2:"ş";s:2:"Ş";s:2:"š";s:2:"Š";s:2:"ţ";s:2:"Ţ";s:2:"ť";s:2:"Ť";s:2:"ŧ";s:2:"Ŧ";s:2:"ũ";s:2:"Ũ";s:2:"ū";s:2:"Ū";s:2:"ŭ";s:2:"Ŭ";s:2:"ů";s:2:"Ů";s:2:"ű";s:2:"Ű";s:2:"ų";s:2:"Ų";s:2:"ŵ";s:2:"Ŵ";s:2:"ŷ";s:2:"Ŷ";s:2:"ź";s:2:"Ź";s:2:"ż";s:2:"Ż";s:2:"ž";s:2:"Ž";s:2:"ſ";s:1:"S";s:2:"ƀ";s:2:"Ƀ";s:2:"ƃ";s:2:"Ƃ";s:2:"ƅ";s:2:"Ƅ";s:2:"ƈ";s:2:"Ƈ";s:2:"ƌ";s:2:"Ƌ";s:2:"ƒ";s:2:"Ƒ";s:2:"ƕ";s:2:"Ƕ";s:2:"ƙ";s:2:"Ƙ";s:2:"ƚ";s:2:"Ƚ";s:2:"ƞ";s:2:"Ƞ";s:2:"ơ";s:2:"Ơ";s:2:"ƣ";s:2:"Ƣ";s:2:"ƥ";s:2:"Ƥ";s:2:"ƨ";s:2:"Ƨ";s:2:"ƭ";s:2:"Ƭ";s:2:"ư";s:2:"Ư";s:2:"ƴ";s:2:"Ƴ";s:2:"ƶ";s:2:"Ƶ";s:2:"ƹ";s:2:"Ƹ";s:2:"ƽ";s:2:"Ƽ";s:2:"ƿ";s:2:"Ƿ";s:2:"Dž";s:2:"DŽ";s:2:"dž";s:2:"DŽ";s:2:"Lj";s:2:"LJ";s:2:"lj";s:2:"LJ";s:2:"Nj";s:2:"NJ";s:2:"nj";s:2:"NJ";s:2:"ǎ";s:2:"Ǎ";s:2:"ǐ";s:2:"Ǐ";s:2:"ǒ";s:2:"Ǒ";s:2:"ǔ";s:2:"Ǔ";s:2:"ǖ";s:2:"Ǖ";s:2:"ǘ";s:2:"Ǘ";s:2:"ǚ";s:2:"Ǚ";s:2:"ǜ";s:2:"Ǜ";s:2:"ǝ";s:2:"Ǝ";s:2:"ǟ";s:2:"Ǟ";s:2:"ǡ";s:2:"Ǡ";s:2:"ǣ";s:2:"Ǣ";s:2:"ǥ";s:2:"Ǥ";s:2:"ǧ";s:2:"Ǧ";s:2:"ǩ";s:2:"Ǩ";s:2:"ǫ";s:2:"Ǫ";s:2:"ǭ";s:2:"Ǭ";s:2:"ǯ";s:2:"Ǯ";s:2:"Dz";s:2:"DZ";s:2:"dz";s:2:"DZ";s:2:"ǵ";s:2:"Ǵ";s:2:"ǹ";s:2:"Ǹ";s:2:"ǻ";s:2:"Ǻ";s:2:"ǽ";s:2:"Ǽ";s:2:"ǿ";s:2:"Ǿ";s:2:"ȁ";s:2:"Ȁ";s:2:"ȃ";s:2:"Ȃ";s:2:"ȅ";s:2:"Ȅ";s:2:"ȇ";s:2:"Ȇ";s:2:"ȉ";s:2:"Ȉ";s:2:"ȋ";s:2:"Ȋ";s:2:"ȍ";s:2:"Ȍ";s:2:"ȏ";s:2:"Ȏ";s:2:"ȑ";s:2:"Ȑ";s:2:"ȓ";s:2:"Ȓ";s:2:"ȕ";s:2:"Ȕ";s:2:"ȗ";s:2:"Ȗ";s:2:"ș";s:2:"Ș";s:2:"ț";s:2:"Ț";s:2:"ȝ";s:2:"Ȝ";s:2:"ȟ";s:2:"Ȟ";s:2:"ȣ";s:2:"Ȣ";s:2:"ȥ";s:2:"Ȥ";s:2:"ȧ";s:2:"Ȧ";s:2:"ȩ";s:2:"Ȩ";s:2:"ȫ";s:2:"Ȫ";s:2:"ȭ";s:2:"Ȭ";s:2:"ȯ";s:2:"Ȯ";s:2:"ȱ";s:2:"Ȱ";s:2:"ȳ";s:2:"Ȳ";s:2:"ȼ";s:2:"Ȼ";s:2:"ȿ";s:3:"Ȿ";s:2:"ɀ";s:3:"Ɀ";s:2:"ɂ";s:2:"Ɂ";s:2:"ɇ";s:2:"Ɇ";s:2:"ɉ";s:2:"Ɉ";s:2:"ɋ";s:2:"Ɋ";s:2:"ɍ";s:2:"Ɍ";s:2:"ɏ";s:2:"Ɏ";s:2:"ɐ";s:3:"Ɐ";s:2:"ɑ";s:3:"Ɑ";s:2:"ɒ";s:3:"Ɒ";s:2:"ɓ";s:2:"Ɓ";s:2:"ɔ";s:2:"Ɔ";s:2:"ɖ";s:2:"Ɖ";s:2:"ɗ";s:2:"Ɗ";s:2:"ə";s:2:"Ə";s:2:"ɛ";s:2:"Ɛ";s:2:"ɜ";s:3:"Ɜ";s:2:"ɠ";s:2:"Ɠ";s:2:"ɡ";s:3:"Ɡ";s:2:"ɣ";s:2:"Ɣ";s:2:"ɥ";s:3:"Ɥ";s:2:"ɦ";s:3:"Ɦ";s:2:"ɨ";s:2:"Ɨ";s:2:"ɩ";s:2:"Ɩ";s:2:"ɪ";s:3:"Ɪ";s:2:"ɫ";s:3:"Ɫ";s:2:"ɬ";s:3:"Ɬ";s:2:"ɯ";s:2:"Ɯ";s:2:"ɱ";s:3:"Ɱ";s:2:"ɲ";s:2:"Ɲ";s:2:"ɵ";s:2:"Ɵ";s:2:"ɽ";s:3:"Ɽ";s:2:"ʀ";s:2:"Ʀ";s:2:"ʂ";s:3:"Ʂ";s:2:"ʃ";s:2:"Ʃ";s:2:"ʇ";s:3:"Ʇ";s:2:"ʈ";s:2:"Ʈ";s:2:"ʉ";s:2:"Ʉ";s:2:"ʊ";s:2:"Ʊ";s:2:"ʋ";s:2:"Ʋ";s:2:"ʌ";s:2:"Ʌ";s:2:"ʒ";s:2:"Ʒ";s:2:"ʝ";s:3:"Ʝ";s:2:"ʞ";s:3:"Ʞ";s:2:"ͅ";s:2:"Ι";s:2:"ͱ";s:2:"Ͱ";s:2:"ͳ";s:2:"Ͳ";s:2:"ͷ";s:2:"Ͷ";s:2:"ͻ";s:2:"Ͻ";s:2:"ͼ";s:2:"Ͼ";s:2:"ͽ";s:2:"Ͽ";s:2:"ά";s:2:"Ά";s:2:"έ";s:2:"Έ";s:2:"ή";s:2:"Ή";s:2:"ί";s:2:"Ί";s:2:"α";s:2:"Α";s:2:"β";s:2:"Β";s:2:"γ";s:2:"Γ";s:2:"δ";s:2:"Δ";s:2:"ε";s:2:"Ε";s:2:"ζ";s:2:"Ζ";s:2:"η";s:2:"Η";s:2:"θ";s:2:"Θ";s:2:"ι";s:2:"Ι";s:2:"κ";s:2:"Κ";s:2:"λ";s:2:"Λ";s:2:"μ";s:2:"Μ";s:2:"ν";s:2:"Ν";s:2:"ξ";s:2:"Ξ";s:2:"ο";s:2:"Ο";s:2:"π";s:2:"Π";s:2:"ρ";s:2:"Ρ";s:2:"ς";s:2:"Σ";s:2:"σ";s:2:"Σ";s:2:"τ";s:2:"Τ";s:2:"υ";s:2:"Υ";s:2:"φ";s:2:"Φ";s:2:"χ";s:2:"Χ";s:2:"ψ";s:2:"Ψ";s:2:"ω";s:2:"Ω";s:2:"ϊ";s:2:"Ϊ";s:2:"ϋ";s:2:"Ϋ";s:2:"ό";s:2:"Ό";s:2:"ύ";s:2:"Ύ";s:2:"ώ";s:2:"Ώ";s:2:"ϐ";s:2:"Β";s:2:"ϑ";s:2:"Θ";s:2:"ϕ";s:2:"Φ";s:2:"ϖ";s:2:"Π";s:2:"ϗ";s:2:"Ϗ";s:2:"ϙ";s:2:"Ϙ";s:2:"ϛ";s:2:"Ϛ";s:2:"ϝ";s:2:"Ϝ";s:2:"ϟ";s:2:"Ϟ";s:2:"ϡ";s:2:"Ϡ";s:2:"ϣ";s:2:"Ϣ";s:2:"ϥ";s:2:"Ϥ";s:2:"ϧ";s:2:"Ϧ";s:2:"ϩ";s:2:"Ϩ";s:2:"ϫ";s:2:"Ϫ";s:2:"ϭ";s:2:"Ϭ";s:2:"ϯ";s:2:"Ϯ";s:2:"ϰ";s:2:"Κ";s:2:"ϱ";s:2:"Ρ";s:2:"ϲ";s:2:"Ϲ";s:2:"ϳ";s:2:"Ϳ";s:2:"ϵ";s:2:"Ε";s:2:"ϸ";s:2:"Ϸ";s:2:"ϻ";s:2:"Ϻ";s:2:"а";s:2:"А";s:2:"б";s:2:"Б";s:2:"в";s:2:"В";s:2:"г";s:2:"Г";s:2:"д";s:2:"Д";s:2:"е";s:2:"Е";s:2:"ж";s:2:"Ж";s:2:"з";s:2:"З";s:2:"и";s:2:"И";s:2:"й";s:2:"Й";s:2:"к";s:2:"К";s:2:"л";s:2:"Л";s:2:"м";s:2:"М";s:2:"н";s:2:"Н";s:2:"о";s:2:"О";s:2:"п";s:2:"П";s:2:"р";s:2:"Р";s:2:"с";s:2:"С";s:2:"т";s:2:"Т";s:2:"у";s:2:"У";s:2:"ф";s:2:"Ф";s:2:"х";s:2:"Х";s:2:"ц";s:2:"Ц";s:2:"ч";s:2:"Ч";s:2:"ш";s:2:"Ш";s:2:"щ";s:2:"Щ";s:2:"ъ";s:2:"Ъ";s:2:"ы";s:2:"Ы";s:2:"ь";s:2:"Ь";s:2:"э";s:2:"Э";s:2:"ю";s:2:"Ю";s:2:"я";s:2:"Я";s:2:"ѐ";s:2:"Ѐ";s:2:"ё";s:2:"Ё";s:2:"ђ";s:2:"Ђ";s:2:"ѓ";s:2:"Ѓ";s:2:"є";s:2:"Є";s:2:"ѕ";s:2:"Ѕ";s:2:"і";s:2:"І";s:2:"ї";s:2:"Ї";s:2:"ј";s:2:"Ј";s:2:"љ";s:2:"Љ";s:2:"њ";s:2:"Њ";s:2:"ћ";s:2:"Ћ";s:2:"ќ";s:2:"Ќ";s:2:"ѝ";s:2:"Ѝ";s:2:"ў";s:2:"Ў";s:2:"џ";s:2:"Џ";s:2:"ѡ";s:2:"Ѡ";s:2:"ѣ";s:2:"Ѣ";s:2:"ѥ";s:2:"Ѥ";s:2:"ѧ";s:2:"Ѧ";s:2:"ѩ";s:2:"Ѩ";s:2:"ѫ";s:2:"Ѫ";s:2:"ѭ";s:2:"Ѭ";s:2:"ѯ";s:2:"Ѯ";s:2:"ѱ";s:2:"Ѱ";s:2:"ѳ";s:2:"Ѳ";s:2:"ѵ";s:2:"Ѵ";s:2:"ѷ";s:2:"Ѷ";s:2:"ѹ";s:2:"Ѹ";s:2:"ѻ";s:2:"Ѻ";s:2:"ѽ";s:2:"Ѽ";s:2:"ѿ";s:2:"Ѿ";s:2:"ҁ";s:2:"Ҁ";s:2:"ҋ";s:2:"Ҋ";s:2:"ҍ";s:2:"Ҍ";s:2:"ҏ";s:2:"Ҏ";s:2:"ґ";s:2:"Ґ";s:2:"ғ";s:2:"Ғ";s:2:"ҕ";s:2:"Ҕ";s:2:"җ";s:2:"Җ";s:2:"ҙ";s:2:"Ҙ";s:2:"қ";s:2:"Қ";s:2:"ҝ";s:2:"Ҝ";s:2:"ҟ";s:2:"Ҟ";s:2:"ҡ";s:2:"Ҡ";s:2:"ң";s:2:"Ң";s:2:"ҥ";s:2:"Ҥ";s:2:"ҧ";s:2:"Ҧ";s:2:"ҩ";s:2:"Ҩ";s:2:"ҫ";s:2:"Ҫ";s:2:"ҭ";s:2:"Ҭ";s:2:"ү";s:2:"Ү";s:2:"ұ";s:2:"Ұ";s:2:"ҳ";s:2:"Ҳ";s:2:"ҵ";s:2:"Ҵ";s:2:"ҷ";s:2:"Ҷ";s:2:"ҹ";s:2:"Ҹ";s:2:"һ";s:2:"Һ";s:2:"ҽ";s:2:"Ҽ";s:2:"ҿ";s:2:"Ҿ";s:2:"ӂ";s:2:"Ӂ";s:2:"ӄ";s:2:"Ӄ";s:2:"ӆ";s:2:"Ӆ";s:2:"ӈ";s:2:"Ӈ";s:2:"ӊ";s:2:"Ӊ";s:2:"ӌ";s:2:"Ӌ";s:2:"ӎ";s:2:"Ӎ";s:2:"ӏ";s:2:"Ӏ";s:2:"ӑ";s:2:"Ӑ";s:2:"ӓ";s:2:"Ӓ";s:2:"ӕ";s:2:"Ӕ";s:2:"ӗ";s:2:"Ӗ";s:2:"ә";s:2:"Ә";s:2:"ӛ";s:2:"Ӛ";s:2:"ӝ";s:2:"Ӝ";s:2:"ӟ";s:2:"Ӟ";s:2:"ӡ";s:2:"Ӡ";s:2:"ӣ";s:2:"Ӣ";s:2:"ӥ";s:2:"Ӥ";s:2:"ӧ";s:2:"Ӧ";s:2:"ө";s:2:"Ө";s:2:"ӫ";s:2:"Ӫ";s:2:"ӭ";s:2:"Ӭ";s:2:"ӯ";s:2:"Ӯ";s:2:"ӱ";s:2:"Ӱ";s:2:"ӳ";s:2:"Ӳ";s:2:"ӵ";s:2:"Ӵ";s:2:"ӷ";s:2:"Ӷ";s:2:"ӹ";s:2:"Ӹ";s:2:"ӻ";s:2:"Ӻ";s:2:"ӽ";s:2:"Ӽ";s:2:"ӿ";s:2:"Ӿ";s:2:"ԁ";s:2:"Ԁ";s:2:"ԃ";s:2:"Ԃ";s:2:"ԅ";s:2:"Ԅ";s:2:"ԇ";s:2:"Ԇ";s:2:"ԉ";s:2:"Ԉ";s:2:"ԋ";s:2:"Ԋ";s:2:"ԍ";s:2:"Ԍ";s:2:"ԏ";s:2:"Ԏ";s:2:"ԑ";s:2:"Ԑ";s:2:"ԓ";s:2:"Ԓ";s:2:"ԕ";s:2:"Ԕ";s:2:"ԗ";s:2:"Ԗ";s:2:"ԙ";s:2:"Ԙ";s:2:"ԛ";s:2:"Ԛ";s:2:"ԝ";s:2:"Ԝ";s:2:"ԟ";s:2:"Ԟ";s:2:"ԡ";s:2:"Ԡ";s:2:"ԣ";s:2:"Ԣ";s:2:"ԥ";s:2:"Ԥ";s:2:"ԧ";s:2:"Ԧ";s:2:"ԩ";s:2:"Ԩ";s:2:"ԫ";s:2:"Ԫ";s:2:"ԭ";s:2:"Ԭ";s:2:"ԯ";s:2:"Ԯ";s:2:"ա";s:2:"Ա";s:2:"բ";s:2:"Բ";s:2:"գ";s:2:"Գ";s:2:"դ";s:2:"Դ";s:2:"ե";s:2:"Ե";s:2:"զ";s:2:"Զ";s:2:"է";s:2:"Է";s:2:"ը";s:2:"Ը";s:2:"թ";s:2:"Թ";s:2:"ժ";s:2:"Ժ";s:2:"ի";s:2:"Ի";s:2:"լ";s:2:"Լ";s:2:"խ";s:2:"Խ";s:2:"ծ";s:2:"Ծ";s:2:"կ";s:2:"Կ";s:2:"հ";s:2:"Հ";s:2:"ձ";s:2:"Ձ";s:2:"ղ";s:2:"Ղ";s:2:"ճ";s:2:"Ճ";s:2:"մ";s:2:"Մ";s:2:"յ";s:2:"Յ";s:2:"ն";s:2:"Ն";s:2:"շ";s:2:"Շ";s:2:"ո";s:2:"Ո";s:2:"չ";s:2:"Չ";s:2:"պ";s:2:"Պ";s:2:"ջ";s:2:"Ջ";s:2:"ռ";s:2:"Ռ";s:2:"ս";s:2:"Ս";s:2:"վ";s:2:"Վ";s:2:"տ";s:2:"Տ";s:2:"ր";s:2:"Ր";s:2:"ց";s:2:"Ց";s:2:"ւ";s:2:"Ւ";s:2:"փ";s:2:"Փ";s:2:"ք";s:2:"Ք";s:2:"օ";s:2:"Օ";s:2:"ֆ";s:2:"Ֆ";s:3:"ა";s:3:"Ა";s:3:"ბ";s:3:"Ბ";s:3:"გ";s:3:"Გ";s:3:"დ";s:3:"Დ";s:3:"ე";s:3:"Ე";s:3:"ვ";s:3:"Ვ";s:3:"ზ";s:3:"Ზ";s:3:"თ";s:3:"Თ";s:3:"ი";s:3:"Ი";s:3:"კ";s:3:"Კ";s:3:"ლ";s:3:"Ლ";s:3:"მ";s:3:"Მ";s:3:"ნ";s:3:"Ნ";s:3:"ო";s:3:"Ო";s:3:"პ";s:3:"Პ";s:3:"ჟ";s:3:"Ჟ";s:3:"რ";s:3:"Რ";s:3:"ს";s:3:"Ს";s:3:"ტ";s:3:"Ტ";s:3:"უ";s:3:"Უ";s:3:"ფ";s:3:"Ფ";s:3:"ქ";s:3:"Ქ";s:3:"ღ";s:3:"Ღ";s:3:"ყ";s:3:"Ყ";s:3:"შ";s:3:"Შ";s:3:"ჩ";s:3:"Ჩ";s:3:"ც";s:3:"Ც";s:3:"ძ";s:3:"Ძ";s:3:"წ";s:3:"Წ";s:3:"ჭ";s:3:"Ჭ";s:3:"ხ";s:3:"Ხ";s:3:"ჯ";s:3:"Ჯ";s:3:"ჰ";s:3:"Ჰ";s:3:"ჱ";s:3:"Ჱ";s:3:"ჲ";s:3:"Ჲ";s:3:"ჳ";s:3:"Ჳ";s:3:"ჴ";s:3:"Ჴ";s:3:"ჵ";s:3:"Ჵ";s:3:"ჶ";s:3:"Ჶ";s:3:"ჷ";s:3:"Ჷ";s:3:"ჸ";s:3:"Ჸ";s:3:"ჹ";s:3:"Ჹ";s:3:"ჺ";s:3:"Ჺ";s:3:"ჽ";s:3:"Ჽ";s:3:"ჾ";s:3:"Ჾ";s:3:"ჿ";s:3:"Ჿ";s:3:"ᏸ";s:3:"Ᏸ";s:3:"ᏹ";s:3:"Ᏹ";s:3:"ᏺ";s:3:"Ᏺ";s:3:"ᏻ";s:3:"Ᏻ";s:3:"ᏼ";s:3:"Ᏼ";s:3:"ᏽ";s:3:"Ᏽ";s:3:"ᲀ";s:2:"В";s:3:"ᲁ";s:2:"Д";s:3:"ᲂ";s:2:"О";s:3:"ᲃ";s:2:"С";s:3:"ᲄ";s:2:"Т";s:3:"ᲅ";s:2:"Т";s:3:"ᲆ";s:2:"Ъ";s:3:"ᲇ";s:2:"Ѣ";s:3:"ᲈ";s:3:"Ꙋ";s:3:"ᵹ";s:3:"Ᵹ";s:3:"ᵽ";s:3:"Ᵽ";s:3:"ᶎ";s:3:"Ᶎ";s:3:"ḁ";s:3:"Ḁ";s:3:"ḃ";s:3:"Ḃ";s:3:"ḅ";s:3:"Ḅ";s:3:"ḇ";s:3:"Ḇ";s:3:"ḉ";s:3:"Ḉ";s:3:"ḋ";s:3:"Ḋ";s:3:"ḍ";s:3:"Ḍ";s:3:"ḏ";s:3:"Ḏ";s:3:"ḑ";s:3:"Ḑ";s:3:"ḓ";s:3:"Ḓ";s:3:"ḕ";s:3:"Ḕ";s:3:"ḗ";s:3:"Ḗ";s:3:"ḙ";s:3:"Ḙ";s:3:"ḛ";s:3:"Ḛ";s:3:"ḝ";s:3:"Ḝ";s:3:"ḟ";s:3:"Ḟ";s:3:"ḡ";s:3:"Ḡ";s:3:"ḣ";s:3:"Ḣ";s:3:"ḥ";s:3:"Ḥ";s:3:"ḧ";s:3:"Ḧ";s:3:"ḩ";s:3:"Ḩ";s:3:"ḫ";s:3:"Ḫ";s:3:"ḭ";s:3:"Ḭ";s:3:"ḯ";s:3:"Ḯ";s:3:"ḱ";s:3:"Ḱ";s:3:"ḳ";s:3:"Ḳ";s:3:"ḵ";s:3:"Ḵ";s:3:"ḷ";s:3:"Ḷ";s:3:"ḹ";s:3:"Ḹ";s:3:"ḻ";s:3:"Ḻ";s:3:"ḽ";s:3:"Ḽ";s:3:"ḿ";s:3:"Ḿ";s:3:"ṁ";s:3:"Ṁ";s:3:"ṃ";s:3:"Ṃ";s:3:"ṅ";s:3:"Ṅ";s:3:"ṇ";s:3:"Ṇ";s:3:"ṉ";s:3:"Ṉ";s:3:"ṋ";s:3:"Ṋ";s:3:"ṍ";s:3:"Ṍ";s:3:"ṏ";s:3:"Ṏ";s:3:"ṑ";s:3:"Ṑ";s:3:"ṓ";s:3:"Ṓ";s:3:"ṕ";s:3:"Ṕ";s:3:"ṗ";s:3:"Ṗ";s:3:"ṙ";s:3:"Ṙ";s:3:"ṛ";s:3:"Ṛ";s:3:"ṝ";s:3:"Ṝ";s:3:"ṟ";s:3:"Ṟ";s:3:"ṡ";s:3:"Ṡ";s:3:"ṣ";s:3:"Ṣ";s:3:"ṥ";s:3:"Ṥ";s:3:"ṧ";s:3:"Ṧ";s:3:"ṩ";s:3:"Ṩ";s:3:"ṫ";s:3:"Ṫ";s:3:"ṭ";s:3:"Ṭ";s:3:"ṯ";s:3:"Ṯ";s:3:"ṱ";s:3:"Ṱ";s:3:"ṳ";s:3:"Ṳ";s:3:"ṵ";s:3:"Ṵ";s:3:"ṷ";s:3:"Ṷ";s:3:"ṹ";s:3:"Ṹ";s:3:"ṻ";s:3:"Ṻ";s:3:"ṽ";s:3:"Ṽ";s:3:"ṿ";s:3:"Ṿ";s:3:"ẁ";s:3:"Ẁ";s:3:"ẃ";s:3:"Ẃ";s:3:"ẅ";s:3:"Ẅ";s:3:"ẇ";s:3:"Ẇ";s:3:"ẉ";s:3:"Ẉ";s:3:"ẋ";s:3:"Ẋ";s:3:"ẍ";s:3:"Ẍ";s:3:"ẏ";s:3:"Ẏ";s:3:"ẑ";s:3:"Ẑ";s:3:"ẓ";s:3:"Ẓ";s:3:"ẕ";s:3:"Ẕ";s:3:"ẛ";s:3:"Ṡ";s:3:"ạ";s:3:"Ạ";s:3:"ả";s:3:"Ả";s:3:"ấ";s:3:"Ấ";s:3:"ầ";s:3:"Ầ";s:3:"ẩ";s:3:"Ẩ";s:3:"ẫ";s:3:"Ẫ";s:3:"ậ";s:3:"Ậ";s:3:"ắ";s:3:"Ắ";s:3:"ằ";s:3:"Ằ";s:3:"ẳ";s:3:"Ẳ";s:3:"ẵ";s:3:"Ẵ";s:3:"ặ";s:3:"Ặ";s:3:"ẹ";s:3:"Ẹ";s:3:"ẻ";s:3:"Ẻ";s:3:"ẽ";s:3:"Ẽ";s:3:"ế";s:3:"Ế";s:3:"ề";s:3:"Ề";s:3:"ể";s:3:"Ể";s:3:"ễ";s:3:"Ễ";s:3:"ệ";s:3:"Ệ";s:3:"ỉ";s:3:"Ỉ";s:3:"ị";s:3:"Ị";s:3:"ọ";s:3:"Ọ";s:3:"ỏ";s:3:"Ỏ";s:3:"ố";s:3:"Ố";s:3:"ồ";s:3:"Ồ";s:3:"ổ";s:3:"Ổ";s:3:"ỗ";s:3:"Ỗ";s:3:"ộ";s:3:"Ộ";s:3:"ớ";s:3:"Ớ";s:3:"ờ";s:3:"Ờ";s:3:"ở";s:3:"Ở";s:3:"ỡ";s:3:"Ỡ";s:3:"ợ";s:3:"Ợ";s:3:"ụ";s:3:"Ụ";s:3:"ủ";s:3:"Ủ";s:3:"ứ";s:3:"Ứ";s:3:"ừ";s:3:"Ừ";s:3:"ử";s:3:"Ử";s:3:"ữ";s:3:"Ữ";s:3:"ự";s:3:"Ự";s:3:"ỳ";s:3:"Ỳ";s:3:"ỵ";s:3:"Ỵ";s:3:"ỷ";s:3:"Ỷ";s:3:"ỹ";s:3:"Ỹ";s:3:"ỻ";s:3:"Ỻ";s:3:"ỽ";s:3:"Ỽ";s:3:"ỿ";s:3:"Ỿ";s:3:"ἀ";s:3:"Ἀ";s:3:"ἁ";s:3:"Ἁ";s:3:"ἂ";s:3:"Ἂ";s:3:"ἃ";s:3:"Ἃ";s:3:"ἄ";s:3:"Ἄ";s:3:"ἅ";s:3:"Ἅ";s:3:"ἆ";s:3:"Ἆ";s:3:"ἇ";s:3:"Ἇ";s:3:"ἐ";s:3:"Ἐ";s:3:"ἑ";s:3:"Ἑ";s:3:"ἒ";s:3:"Ἒ";s:3:"ἓ";s:3:"Ἓ";s:3:"ἔ";s:3:"Ἔ";s:3:"ἕ";s:3:"Ἕ";s:3:"ἠ";s:3:"Ἠ";s:3:"ἡ";s:3:"Ἡ";s:3:"ἢ";s:3:"Ἢ";s:3:"ἣ";s:3:"Ἣ";s:3:"ἤ";s:3:"Ἤ";s:3:"ἥ";s:3:"Ἥ";s:3:"ἦ";s:3:"Ἦ";s:3:"ἧ";s:3:"Ἧ";s:3:"ἰ";s:3:"Ἰ";s:3:"ἱ";s:3:"Ἱ";s:3:"ἲ";s:3:"Ἲ";s:3:"ἳ";s:3:"Ἳ";s:3:"ἴ";s:3:"Ἴ";s:3:"ἵ";s:3:"Ἵ";s:3:"ἶ";s:3:"Ἶ";s:3:"ἷ";s:3:"Ἷ";s:3:"ὀ";s:3:"Ὀ";s:3:"ὁ";s:3:"Ὁ";s:3:"ὂ";s:3:"Ὂ";s:3:"ὃ";s:3:"Ὃ";s:3:"ὄ";s:3:"Ὄ";s:3:"ὅ";s:3:"Ὅ";s:3:"ὑ";s:3:"Ὑ";s:3:"ὓ";s:3:"Ὓ";s:3:"ὕ";s:3:"Ὕ";s:3:"ὗ";s:3:"Ὗ";s:3:"ὠ";s:3:"Ὠ";s:3:"ὡ";s:3:"Ὡ";s:3:"ὢ";s:3:"Ὢ";s:3:"ὣ";s:3:"Ὣ";s:3:"ὤ";s:3:"Ὤ";s:3:"ὥ";s:3:"Ὥ";s:3:"ὦ";s:3:"Ὦ";s:3:"ὧ";s:3:"Ὧ";s:3:"ὰ";s:3:"Ὰ";s:3:"ά";s:3:"Ά";s:3:"ὲ";s:3:"Ὲ";s:3:"έ";s:3:"Έ";s:3:"ὴ";s:3:"Ὴ";s:3:"ή";s:3:"Ή";s:3:"ὶ";s:3:"Ὶ";s:3:"ί";s:3:"Ί";s:3:"ὸ";s:3:"Ὸ";s:3:"ό";s:3:"Ό";s:3:"ὺ";s:3:"Ὺ";s:3:"ύ";s:3:"Ύ";s:3:"ὼ";s:3:"Ὼ";s:3:"ώ";s:3:"Ώ";s:3:"ᾀ";s:3:"ᾈ";s:3:"ᾁ";s:3:"ᾉ";s:3:"ᾂ";s:3:"ᾊ";s:3:"ᾃ";s:3:"ᾋ";s:3:"ᾄ";s:3:"ᾌ";s:3:"ᾅ";s:3:"ᾍ";s:3:"ᾆ";s:3:"ᾎ";s:3:"ᾇ";s:3:"ᾏ";s:3:"ᾐ";s:3:"ᾘ";s:3:"ᾑ";s:3:"ᾙ";s:3:"ᾒ";s:3:"ᾚ";s:3:"ᾓ";s:3:"ᾛ";s:3:"ᾔ";s:3:"ᾜ";s:3:"ᾕ";s:3:"ᾝ";s:3:"ᾖ";s:3:"ᾞ";s:3:"ᾗ";s:3:"ᾟ";s:3:"ᾠ";s:3:"ᾨ";s:3:"ᾡ";s:3:"ᾩ";s:3:"ᾢ";s:3:"ᾪ";s:3:"ᾣ";s:3:"ᾫ";s:3:"ᾤ";s:3:"ᾬ";s:3:"ᾥ";s:3:"ᾭ";s:3:"ᾦ";s:3:"ᾮ";s:3:"ᾧ";s:3:"ᾯ";s:3:"ᾰ";s:3:"Ᾰ";s:3:"ᾱ";s:3:"Ᾱ";s:3:"ᾳ";s:3:"ᾼ";s:3:"ι";s:2:"Ι";s:3:"ῃ";s:3:"ῌ";s:3:"ῐ";s:3:"Ῐ";s:3:"ῑ";s:3:"Ῑ";s:3:"ῠ";s:3:"Ῠ";s:3:"ῡ";s:3:"Ῡ";s:3:"ῥ";s:3:"Ῥ";s:3:"ῳ";s:3:"ῼ";s:3:"ⅎ";s:3:"Ⅎ";s:3:"ⅰ";s:3:"Ⅰ";s:3:"ⅱ";s:3:"Ⅱ";s:3:"ⅲ";s:3:"Ⅲ";s:3:"ⅳ";s:3:"Ⅳ";s:3:"ⅴ";s:3:"Ⅴ";s:3:"ⅵ";s:3:"Ⅵ";s:3:"ⅶ";s:3:"Ⅶ";s:3:"ⅷ";s:3:"Ⅷ";s:3:"ⅸ";s:3:"Ⅸ";s:3:"ⅹ";s:3:"Ⅹ";s:3:"ⅺ";s:3:"Ⅺ";s:3:"ⅻ";s:3:"Ⅻ";s:3:"ⅼ";s:3:"Ⅼ";s:3:"ⅽ";s:3:"Ⅽ";s:3:"ⅾ";s:3:"Ⅾ";s:3:"ⅿ";s:3:"Ⅿ";s:3:"ↄ";s:3:"Ↄ";s:3:"ⓐ";s:3:"Ⓐ";s:3:"ⓑ";s:3:"Ⓑ";s:3:"ⓒ";s:3:"Ⓒ";s:3:"ⓓ";s:3:"Ⓓ";s:3:"ⓔ";s:3:"Ⓔ";s:3:"ⓕ";s:3:"Ⓕ";s:3:"ⓖ";s:3:"Ⓖ";s:3:"ⓗ";s:3:"Ⓗ";s:3:"ⓘ";s:3:"Ⓘ";s:3:"ⓙ";s:3:"Ⓙ";s:3:"ⓚ";s:3:"Ⓚ";s:3:"ⓛ";s:3:"Ⓛ";s:3:"ⓜ";s:3:"Ⓜ";s:3:"ⓝ";s:3:"Ⓝ";s:3:"ⓞ";s:3:"Ⓞ";s:3:"ⓟ";s:3:"Ⓟ";s:3:"ⓠ";s:3:"Ⓠ";s:3:"ⓡ";s:3:"Ⓡ";s:3:"ⓢ";s:3:"Ⓢ";s:3:"ⓣ";s:3:"Ⓣ";s:3:"ⓤ";s:3:"Ⓤ";s:3:"ⓥ";s:3:"Ⓥ";s:3:"ⓦ";s:3:"Ⓦ";s:3:"ⓧ";s:3:"Ⓧ";s:3:"ⓨ";s:3:"Ⓨ";s:3:"ⓩ";s:3:"Ⓩ";s:3:"ⰰ";s:3:"Ⰰ";s:3:"ⰱ";s:3:"Ⰱ";s:3:"ⰲ";s:3:"Ⰲ";s:3:"ⰳ";s:3:"Ⰳ";s:3:"ⰴ";s:3:"Ⰴ";s:3:"ⰵ";s:3:"Ⰵ";s:3:"ⰶ";s:3:"Ⰶ";s:3:"ⰷ";s:3:"Ⰷ";s:3:"ⰸ";s:3:"Ⰸ";s:3:"ⰹ";s:3:"Ⰹ";s:3:"ⰺ";s:3:"Ⰺ";s:3:"ⰻ";s:3:"Ⰻ";s:3:"ⰼ";s:3:"Ⰼ";s:3:"ⰽ";s:3:"Ⰽ";s:3:"ⰾ";s:3:"Ⰾ";s:3:"ⰿ";s:3:"Ⰿ";s:3:"ⱀ";s:3:"Ⱀ";s:3:"ⱁ";s:3:"Ⱁ";s:3:"ⱂ";s:3:"Ⱂ";s:3:"ⱃ";s:3:"Ⱃ";s:3:"ⱄ";s:3:"Ⱄ";s:3:"ⱅ";s:3:"Ⱅ";s:3:"ⱆ";s:3:"Ⱆ";s:3:"ⱇ";s:3:"Ⱇ";s:3:"ⱈ";s:3:"Ⱈ";s:3:"ⱉ";s:3:"Ⱉ";s:3:"ⱊ";s:3:"Ⱊ";s:3:"ⱋ";s:3:"Ⱋ";s:3:"ⱌ";s:3:"Ⱌ";s:3:"ⱍ";s:3:"Ⱍ";s:3:"ⱎ";s:3:"Ⱎ";s:3:"ⱏ";s:3:"Ⱏ";s:3:"ⱐ";s:3:"Ⱐ";s:3:"ⱑ";s:3:"Ⱑ";s:3:"ⱒ";s:3:"Ⱒ";s:3:"ⱓ";s:3:"Ⱓ";s:3:"ⱔ";s:3:"Ⱔ";s:3:"ⱕ";s:3:"Ⱕ";s:3:"ⱖ";s:3:"Ⱖ";s:3:"ⱗ";s:3:"Ⱗ";s:3:"ⱘ";s:3:"Ⱘ";s:3:"ⱙ";s:3:"Ⱙ";s:3:"ⱚ";s:3:"Ⱚ";s:3:"ⱛ";s:3:"Ⱛ";s:3:"ⱜ";s:3:"Ⱜ";s:3:"ⱝ";s:3:"Ⱝ";s:3:"ⱞ";s:3:"Ⱞ";s:3:"ⱡ";s:3:"Ⱡ";s:3:"ⱥ";s:2:"Ⱥ";s:3:"ⱦ";s:2:"Ⱦ";s:3:"ⱨ";s:3:"Ⱨ";s:3:"ⱪ";s:3:"Ⱪ";s:3:"ⱬ";s:3:"Ⱬ";s:3:"ⱳ";s:3:"Ⱳ";s:3:"ⱶ";s:3:"Ⱶ";s:3:"ⲁ";s:3:"Ⲁ";s:3:"ⲃ";s:3:"Ⲃ";s:3:"ⲅ";s:3:"Ⲅ";s:3:"ⲇ";s:3:"Ⲇ";s:3:"ⲉ";s:3:"Ⲉ";s:3:"ⲋ";s:3:"Ⲋ";s:3:"ⲍ";s:3:"Ⲍ";s:3:"ⲏ";s:3:"Ⲏ";s:3:"ⲑ";s:3:"Ⲑ";s:3:"ⲓ";s:3:"Ⲓ";s:3:"ⲕ";s:3:"Ⲕ";s:3:"ⲗ";s:3:"Ⲗ";s:3:"ⲙ";s:3:"Ⲙ";s:3:"ⲛ";s:3:"Ⲛ";s:3:"ⲝ";s:3:"Ⲝ";s:3:"ⲟ";s:3:"Ⲟ";s:3:"ⲡ";s:3:"Ⲡ";s:3:"ⲣ";s:3:"Ⲣ";s:3:"ⲥ";s:3:"Ⲥ";s:3:"ⲧ";s:3:"Ⲧ";s:3:"ⲩ";s:3:"Ⲩ";s:3:"ⲫ";s:3:"Ⲫ";s:3:"ⲭ";s:3:"Ⲭ";s:3:"ⲯ";s:3:"Ⲯ";s:3:"ⲱ";s:3:"Ⲱ";s:3:"ⲳ";s:3:"Ⲳ";s:3:"ⲵ";s:3:"Ⲵ";s:3:"ⲷ";s:3:"Ⲷ";s:3:"ⲹ";s:3:"Ⲹ";s:3:"ⲻ";s:3:"Ⲻ";s:3:"ⲽ";s:3:"Ⲽ";s:3:"ⲿ";s:3:"Ⲿ";s:3:"ⳁ";s:3:"Ⳁ";s:3:"ⳃ";s:3:"Ⳃ";s:3:"ⳅ";s:3:"Ⳅ";s:3:"ⳇ";s:3:"Ⳇ";s:3:"ⳉ";s:3:"Ⳉ";s:3:"ⳋ";s:3:"Ⳋ";s:3:"ⳍ";s:3:"Ⳍ";s:3:"ⳏ";s:3:"Ⳏ";s:3:"ⳑ";s:3:"Ⳑ";s:3:"ⳓ";s:3:"Ⳓ";s:3:"ⳕ";s:3:"Ⳕ";s:3:"ⳗ";s:3:"Ⳗ";s:3:"ⳙ";s:3:"Ⳙ";s:3:"ⳛ";s:3:"Ⳛ";s:3:"ⳝ";s:3:"Ⳝ";s:3:"ⳟ";s:3:"Ⳟ";s:3:"ⳡ";s:3:"Ⳡ";s:3:"ⳣ";s:3:"Ⳣ";s:3:"ⳬ";s:3:"Ⳬ";s:3:"ⳮ";s:3:"Ⳮ";s:3:"ⳳ";s:3:"Ⳳ";s:3:"ⴀ";s:3:"Ⴀ";s:3:"ⴁ";s:3:"Ⴁ";s:3:"ⴂ";s:3:"Ⴂ";s:3:"ⴃ";s:3:"Ⴃ";s:3:"ⴄ";s:3:"Ⴄ";s:3:"ⴅ";s:3:"Ⴅ";s:3:"ⴆ";s:3:"Ⴆ";s:3:"ⴇ";s:3:"Ⴇ";s:3:"ⴈ";s:3:"Ⴈ";s:3:"ⴉ";s:3:"Ⴉ";s:3:"ⴊ";s:3:"Ⴊ";s:3:"ⴋ";s:3:"Ⴋ";s:3:"ⴌ";s:3:"Ⴌ";s:3:"ⴍ";s:3:"Ⴍ";s:3:"ⴎ";s:3:"Ⴎ";s:3:"ⴏ";s:3:"Ⴏ";s:3:"ⴐ";s:3:"Ⴐ";s:3:"ⴑ";s:3:"Ⴑ";s:3:"ⴒ";s:3:"Ⴒ";s:3:"ⴓ";s:3:"Ⴓ";s:3:"ⴔ";s:3:"Ⴔ";s:3:"ⴕ";s:3:"Ⴕ";s:3:"ⴖ";s:3:"Ⴖ";s:3:"ⴗ";s:3:"Ⴗ";s:3:"ⴘ";s:3:"Ⴘ";s:3:"ⴙ";s:3:"Ⴙ";s:3:"ⴚ";s:3:"Ⴚ";s:3:"ⴛ";s:3:"Ⴛ";s:3:"ⴜ";s:3:"Ⴜ";s:3:"ⴝ";s:3:"Ⴝ";s:3:"ⴞ";s:3:"Ⴞ";s:3:"ⴟ";s:3:"Ⴟ";s:3:"ⴠ";s:3:"Ⴠ";s:3:"ⴡ";s:3:"Ⴡ";s:3:"ⴢ";s:3:"Ⴢ";s:3:"ⴣ";s:3:"Ⴣ";s:3:"ⴤ";s:3:"Ⴤ";s:3:"ⴥ";s:3:"Ⴥ";s:3:"ⴧ";s:3:"Ⴧ";s:3:"ⴭ";s:3:"Ⴭ";s:3:"ꙁ";s:3:"Ꙁ";s:3:"ꙃ";s:3:"Ꙃ";s:3:"ꙅ";s:3:"Ꙅ";s:3:"ꙇ";s:3:"Ꙇ";s:3:"ꙉ";s:3:"Ꙉ";s:3:"ꙋ";s:3:"Ꙋ";s:3:"ꙍ";s:3:"Ꙍ";s:3:"ꙏ";s:3:"Ꙏ";s:3:"ꙑ";s:3:"Ꙑ";s:3:"ꙓ";s:3:"Ꙓ";s:3:"ꙕ";s:3:"Ꙕ";s:3:"ꙗ";s:3:"Ꙗ";s:3:"ꙙ";s:3:"Ꙙ";s:3:"ꙛ";s:3:"Ꙛ";s:3:"ꙝ";s:3:"Ꙝ";s:3:"ꙟ";s:3:"Ꙟ";s:3:"ꙡ";s:3:"Ꙡ";s:3:"ꙣ";s:3:"Ꙣ";s:3:"ꙥ";s:3:"Ꙥ";s:3:"ꙧ";s:3:"Ꙧ";s:3:"ꙩ";s:3:"Ꙩ";s:3:"ꙫ";s:3:"Ꙫ";s:3:"ꙭ";s:3:"Ꙭ";s:3:"ꚁ";s:3:"Ꚁ";s:3:"ꚃ";s:3:"Ꚃ";s:3:"ꚅ";s:3:"Ꚅ";s:3:"ꚇ";s:3:"Ꚇ";s:3:"ꚉ";s:3:"Ꚉ";s:3:"ꚋ";s:3:"Ꚋ";s:3:"ꚍ";s:3:"Ꚍ";s:3:"ꚏ";s:3:"Ꚏ";s:3:"ꚑ";s:3:"Ꚑ";s:3:"ꚓ";s:3:"Ꚓ";s:3:"ꚕ";s:3:"Ꚕ";s:3:"ꚗ";s:3:"Ꚗ";s:3:"ꚙ";s:3:"Ꚙ";s:3:"ꚛ";s:3:"Ꚛ";s:3:"ꜣ";s:3:"Ꜣ";s:3:"ꜥ";s:3:"Ꜥ";s:3:"ꜧ";s:3:"Ꜧ";s:3:"ꜩ";s:3:"Ꜩ";s:3:"ꜫ";s:3:"Ꜫ";s:3:"ꜭ";s:3:"Ꜭ";s:3:"ꜯ";s:3:"Ꜯ";s:3:"ꜳ";s:3:"Ꜳ";s:3:"ꜵ";s:3:"Ꜵ";s:3:"ꜷ";s:3:"Ꜷ";s:3:"ꜹ";s:3:"Ꜹ";s:3:"ꜻ";s:3:"Ꜻ";s:3:"ꜽ";s:3:"Ꜽ";s:3:"ꜿ";s:3:"Ꜿ";s:3:"ꝁ";s:3:"Ꝁ";s:3:"ꝃ";s:3:"Ꝃ";s:3:"ꝅ";s:3:"Ꝅ";s:3:"ꝇ";s:3:"Ꝇ";s:3:"ꝉ";s:3:"Ꝉ";s:3:"ꝋ";s:3:"Ꝋ";s:3:"ꝍ";s:3:"Ꝍ";s:3:"ꝏ";s:3:"Ꝏ";s:3:"ꝑ";s:3:"Ꝑ";s:3:"ꝓ";s:3:"Ꝓ";s:3:"ꝕ";s:3:"Ꝕ";s:3:"ꝗ";s:3:"Ꝗ";s:3:"ꝙ";s:3:"Ꝙ";s:3:"ꝛ";s:3:"Ꝛ";s:3:"ꝝ";s:3:"Ꝝ";s:3:"ꝟ";s:3:"Ꝟ";s:3:"ꝡ";s:3:"Ꝡ";s:3:"ꝣ";s:3:"Ꝣ";s:3:"ꝥ";s:3:"Ꝥ";s:3:"ꝧ";s:3:"Ꝧ";s:3:"ꝩ";s:3:"Ꝩ";s:3:"ꝫ";s:3:"Ꝫ";s:3:"ꝭ";s:3:"Ꝭ";s:3:"ꝯ";s:3:"Ꝯ";s:3:"ꝺ";s:3:"Ꝺ";s:3:"ꝼ";s:3:"Ꝼ";s:3:"ꝿ";s:3:"Ꝿ";s:3:"ꞁ";s:3:"Ꞁ";s:3:"ꞃ";s:3:"Ꞃ";s:3:"ꞅ";s:3:"Ꞅ";s:3:"ꞇ";s:3:"Ꞇ";s:3:"ꞌ";s:3:"Ꞌ";s:3:"ꞑ";s:3:"Ꞑ";s:3:"ꞓ";s:3:"Ꞓ";s:3:"ꞔ";s:3:"Ꞔ";s:3:"ꞗ";s:3:"Ꞗ";s:3:"ꞙ";s:3:"Ꞙ";s:3:"ꞛ";s:3:"Ꞛ";s:3:"ꞝ";s:3:"Ꞝ";s:3:"ꞟ";s:3:"Ꞟ";s:3:"ꞡ";s:3:"Ꞡ";s:3:"ꞣ";s:3:"Ꞣ";s:3:"ꞥ";s:3:"Ꞥ";s:3:"ꞧ";s:3:"Ꞧ";s:3:"ꞩ";s:3:"Ꞩ";s:3:"ꞵ";s:3:"Ꞵ";s:3:"ꞷ";s:3:"Ꞷ";s:3:"ꞹ";s:3:"Ꞹ";s:3:"ꞻ";s:3:"Ꞻ";s:3:"ꞽ";s:3:"Ꞽ";s:3:"ꞿ";s:3:"Ꞿ";s:3:"ꟃ";s:3:"Ꟃ";s:3:"ꭓ";s:3:"Ꭓ";s:3:"ꭰ";s:3:"Ꭰ";s:3:"ꭱ";s:3:"Ꭱ";s:3:"ꭲ";s:3:"Ꭲ";s:3:"ꭳ";s:3:"Ꭳ";s:3:"ꭴ";s:3:"Ꭴ";s:3:"ꭵ";s:3:"Ꭵ";s:3:"ꭶ";s:3:"Ꭶ";s:3:"ꭷ";s:3:"Ꭷ";s:3:"ꭸ";s:3:"Ꭸ";s:3:"ꭹ";s:3:"Ꭹ";s:3:"ꭺ";s:3:"Ꭺ";s:3:"ꭻ";s:3:"Ꭻ";s:3:"ꭼ";s:3:"Ꭼ";s:3:"ꭽ";s:3:"Ꭽ";s:3:"ꭾ";s:3:"Ꭾ";s:3:"ꭿ";s:3:"Ꭿ";s:3:"ꮀ";s:3:"Ꮀ";s:3:"ꮁ";s:3:"Ꮁ";s:3:"ꮂ";s:3:"Ꮂ";s:3:"ꮃ";s:3:"Ꮃ";s:3:"ꮄ";s:3:"Ꮄ";s:3:"ꮅ";s:3:"Ꮅ";s:3:"ꮆ";s:3:"Ꮆ";s:3:"ꮇ";s:3:"Ꮇ";s:3:"ꮈ";s:3:"Ꮈ";s:3:"ꮉ";s:3:"Ꮉ";s:3:"ꮊ";s:3:"Ꮊ";s:3:"ꮋ";s:3:"Ꮋ";s:3:"ꮌ";s:3:"Ꮌ";s:3:"ꮍ";s:3:"Ꮍ";s:3:"ꮎ";s:3:"Ꮎ";s:3:"ꮏ";s:3:"Ꮏ";s:3:"ꮐ";s:3:"Ꮐ";s:3:"ꮑ";s:3:"Ꮑ";s:3:"ꮒ";s:3:"Ꮒ";s:3:"ꮓ";s:3:"Ꮓ";s:3:"ꮔ";s:3:"Ꮔ";s:3:"ꮕ";s:3:"Ꮕ";s:3:"ꮖ";s:3:"Ꮖ";s:3:"ꮗ";s:3:"Ꮗ";s:3:"ꮘ";s:3:"Ꮘ";s:3:"ꮙ";s:3:"Ꮙ";s:3:"ꮚ";s:3:"Ꮚ";s:3:"ꮛ";s:3:"Ꮛ";s:3:"ꮜ";s:3:"Ꮜ";s:3:"ꮝ";s:3:"Ꮝ";s:3:"ꮞ";s:3:"Ꮞ";s:3:"ꮟ";s:3:"Ꮟ";s:3:"ꮠ";s:3:"Ꮠ";s:3:"ꮡ";s:3:"Ꮡ";s:3:"ꮢ";s:3:"Ꮢ";s:3:"ꮣ";s:3:"Ꮣ";s:3:"ꮤ";s:3:"Ꮤ";s:3:"ꮥ";s:3:"Ꮥ";s:3:"ꮦ";s:3:"Ꮦ";s:3:"ꮧ";s:3:"Ꮧ";s:3:"ꮨ";s:3:"Ꮨ";s:3:"ꮩ";s:3:"Ꮩ";s:3:"ꮪ";s:3:"Ꮪ";s:3:"ꮫ";s:3:"Ꮫ";s:3:"ꮬ";s:3:"Ꮬ";s:3:"ꮭ";s:3:"Ꮭ";s:3:"ꮮ";s:3:"Ꮮ";s:3:"ꮯ";s:3:"Ꮯ";s:3:"ꮰ";s:3:"Ꮰ";s:3:"ꮱ";s:3:"Ꮱ";s:3:"ꮲ";s:3:"Ꮲ";s:3:"ꮳ";s:3:"Ꮳ";s:3:"ꮴ";s:3:"Ꮴ";s:3:"ꮵ";s:3:"Ꮵ";s:3:"ꮶ";s:3:"Ꮶ";s:3:"ꮷ";s:3:"Ꮷ";s:3:"ꮸ";s:3:"Ꮸ";s:3:"ꮹ";s:3:"Ꮹ";s:3:"ꮺ";s:3:"Ꮺ";s:3:"ꮻ";s:3:"Ꮻ";s:3:"ꮼ";s:3:"Ꮼ";s:3:"ꮽ";s:3:"Ꮽ";s:3:"ꮾ";s:3:"Ꮾ";s:3:"ꮿ";s:3:"Ꮿ";s:3:"a";s:3:"A";s:3:"b";s:3:"B";s:3:"c";s:3:"C";s:3:"d";s:3:"D";s:3:"e";s:3:"E";s:3:"f";s:3:"F";s:3:"g";s:3:"G";s:3:"h";s:3:"H";s:3:"i";s:3:"I";s:3:"j";s:3:"J";s:3:"k";s:3:"K";s:3:"l";s:3:"L";s:3:"m";s:3:"M";s:3:"n";s:3:"N";s:3:"o";s:3:"O";s:3:"p";s:3:"P";s:3:"q";s:3:"Q";s:3:"r";s:3:"R";s:3:"s";s:3:"S";s:3:"t";s:3:"T";s:3:"u";s:3:"U";s:3:"v";s:3:"V";s:3:"w";s:3:"W";s:3:"x";s:3:"X";s:3:"y";s:3:"Y";s:3:"z";s:3:"Z";s:4:"𐐨";s:4:"𐐀";s:4:"𐐩";s:4:"𐐁";s:4:"𐐪";s:4:"𐐂";s:4:"𐐫";s:4:"𐐃";s:4:"𐐬";s:4:"𐐄";s:4:"𐐭";s:4:"𐐅";s:4:"𐐮";s:4:"𐐆";s:4:"𐐯";s:4:"𐐇";s:4:"𐐰";s:4:"𐐈";s:4:"𐐱";s:4:"𐐉";s:4:"𐐲";s:4:"𐐊";s:4:"𐐳";s:4:"𐐋";s:4:"𐐴";s:4:"𐐌";s:4:"𐐵";s:4:"𐐍";s:4:"𐐶";s:4:"𐐎";s:4:"𐐷";s:4:"𐐏";s:4:"𐐸";s:4:"𐐐";s:4:"𐐹";s:4:"𐐑";s:4:"𐐺";s:4:"𐐒";s:4:"𐐻";s:4:"𐐓";s:4:"𐐼";s:4:"𐐔";s:4:"𐐽";s:4:"𐐕";s:4:"𐐾";s:4:"𐐖";s:4:"𐐿";s:4:"𐐗";s:4:"𐑀";s:4:"𐐘";s:4:"𐑁";s:4:"𐐙";s:4:"𐑂";s:4:"𐐚";s:4:"𐑃";s:4:"𐐛";s:4:"𐑄";s:4:"𐐜";s:4:"𐑅";s:4:"𐐝";s:4:"𐑆";s:4:"𐐞";s:4:"𐑇";s:4:"𐐟";s:4:"𐑈";s:4:"𐐠";s:4:"𐑉";s:4:"𐐡";s:4:"𐑊";s:4:"𐐢";s:4:"𐑋";s:4:"𐐣";s:4:"𐑌";s:4:"𐐤";s:4:"𐑍";s:4:"𐐥";s:4:"𐑎";s:4:"𐐦";s:4:"𐑏";s:4:"𐐧";s:4:"𐓘";s:4:"𐒰";s:4:"𐓙";s:4:"𐒱";s:4:"𐓚";s:4:"𐒲";s:4:"𐓛";s:4:"𐒳";s:4:"𐓜";s:4:"𐒴";s:4:"𐓝";s:4:"𐒵";s:4:"𐓞";s:4:"𐒶";s:4:"𐓟";s:4:"𐒷";s:4:"𐓠";s:4:"𐒸";s:4:"𐓡";s:4:"𐒹";s:4:"𐓢";s:4:"𐒺";s:4:"𐓣";s:4:"𐒻";s:4:"𐓤";s:4:"𐒼";s:4:"𐓥";s:4:"𐒽";s:4:"𐓦";s:4:"𐒾";s:4:"𐓧";s:4:"𐒿";s:4:"𐓨";s:4:"𐓀";s:4:"𐓩";s:4:"𐓁";s:4:"𐓪";s:4:"𐓂";s:4:"𐓫";s:4:"𐓃";s:4:"𐓬";s:4:"𐓄";s:4:"𐓭";s:4:"𐓅";s:4:"𐓮";s:4:"𐓆";s:4:"𐓯";s:4:"𐓇";s:4:"𐓰";s:4:"𐓈";s:4:"𐓱";s:4:"𐓉";s:4:"𐓲";s:4:"𐓊";s:4:"𐓳";s:4:"𐓋";s:4:"𐓴";s:4:"𐓌";s:4:"𐓵";s:4:"𐓍";s:4:"𐓶";s:4:"𐓎";s:4:"𐓷";s:4:"𐓏";s:4:"𐓸";s:4:"𐓐";s:4:"𐓹";s:4:"𐓑";s:4:"𐓺";s:4:"𐓒";s:4:"𐓻";s:4:"𐓓";s:4:"𐳀";s:4:"𐲀";s:4:"𐳁";s:4:"𐲁";s:4:"𐳂";s:4:"𐲂";s:4:"𐳃";s:4:"𐲃";s:4:"𐳄";s:4:"𐲄";s:4:"𐳅";s:4:"𐲅";s:4:"𐳆";s:4:"𐲆";s:4:"𐳇";s:4:"𐲇";s:4:"𐳈";s:4:"𐲈";s:4:"𐳉";s:4:"𐲉";s:4:"𐳊";s:4:"𐲊";s:4:"𐳋";s:4:"𐲋";s:4:"𐳌";s:4:"𐲌";s:4:"𐳍";s:4:"𐲍";s:4:"𐳎";s:4:"𐲎";s:4:"𐳏";s:4:"𐲏";s:4:"𐳐";s:4:"𐲐";s:4:"𐳑";s:4:"𐲑";s:4:"𐳒";s:4:"𐲒";s:4:"𐳓";s:4:"𐲓";s:4:"𐳔";s:4:"𐲔";s:4:"𐳕";s:4:"𐲕";s:4:"𐳖";s:4:"𐲖";s:4:"𐳗";s:4:"𐲗";s:4:"𐳘";s:4:"𐲘";s:4:"𐳙";s:4:"𐲙";s:4:"𐳚";s:4:"𐲚";s:4:"𐳛";s:4:"𐲛";s:4:"𐳜";s:4:"𐲜";s:4:"𐳝";s:4:"𐲝";s:4:"𐳞";s:4:"𐲞";s:4:"𐳟";s:4:"𐲟";s:4:"𐳠";s:4:"𐲠";s:4:"𐳡";s:4:"𐲡";s:4:"𐳢";s:4:"𐲢";s:4:"𐳣";s:4:"𐲣";s:4:"𐳤";s:4:"𐲤";s:4:"𐳥";s:4:"𐲥";s:4:"𐳦";s:4:"𐲦";s:4:"𐳧";s:4:"𐲧";s:4:"𐳨";s:4:"𐲨";s:4:"𐳩";s:4:"𐲩";s:4:"𐳪";s:4:"𐲪";s:4:"𐳫";s:4:"𐲫";s:4:"𐳬";s:4:"𐲬";s:4:"𐳭";s:4:"𐲭";s:4:"𐳮";s:4:"𐲮";s:4:"𐳯";s:4:"𐲯";s:4:"𐳰";s:4:"𐲰";s:4:"𐳱";s:4:"𐲱";s:4:"𐳲";s:4:"𐲲";s:4:"𑣀";s:4:"𑢠";s:4:"𑣁";s:4:"𑢡";s:4:"𑣂";s:4:"𑢢";s:4:"𑣃";s:4:"𑢣";s:4:"𑣄";s:4:"𑢤";s:4:"𑣅";s:4:"𑢥";s:4:"𑣆";s:4:"𑢦";s:4:"𑣇";s:4:"𑢧";s:4:"𑣈";s:4:"𑢨";s:4:"𑣉";s:4:"𑢩";s:4:"𑣊";s:4:"𑢪";s:4:"𑣋";s:4:"𑢫";s:4:"𑣌";s:4:"𑢬";s:4:"𑣍";s:4:"𑢭";s:4:"𑣎";s:4:"𑢮";s:4:"𑣏";s:4:"𑢯";s:4:"𑣐";s:4:"𑢰";s:4:"𑣑";s:4:"𑢱";s:4:"𑣒";s:4:"𑢲";s:4:"𑣓";s:4:"𑢳";s:4:"𑣔";s:4:"𑢴";s:4:"𑣕";s:4:"𑢵";s:4:"𑣖";s:4:"𑢶";s:4:"𑣗";s:4:"𑢷";s:4:"𑣘";s:4:"𑢸";s:4:"𑣙";s:4:"𑢹";s:4:"𑣚";s:4:"𑢺";s:4:"𑣛";s:4:"𑢻";s:4:"𑣜";s:4:"𑢼";s:4:"𑣝";s:4:"𑢽";s:4:"𑣞";s:4:"𑢾";s:4:"𑣟";s:4:"𑢿";s:4:"𖹠";s:4:"𖹀";s:4:"𖹡";s:4:"𖹁";s:4:"𖹢";s:4:"𖹂";s:4:"𖹣";s:4:"𖹃";s:4:"𖹤";s:4:"𖹄";s:4:"𖹥";s:4:"𖹅";s:4:"𖹦";s:4:"𖹆";s:4:"𖹧";s:4:"𖹇";s:4:"𖹨";s:4:"𖹈";s:4:"𖹩";s:4:"𖹉";s:4:"𖹪";s:4:"𖹊";s:4:"𖹫";s:4:"𖹋";s:4:"𖹬";s:4:"𖹌";s:4:"𖹭";s:4:"𖹍";s:4:"𖹮";s:4:"𖹎";s:4:"𖹯";s:4:"𖹏";s:4:"𖹰";s:4:"𖹐";s:4:"𖹱";s:4:"𖹑";s:4:"𖹲";s:4:"𖹒";s:4:"𖹳";s:4:"𖹓";s:4:"𖹴";s:4:"𖹔";s:4:"𖹵";s:4:"𖹕";s:4:"𖹶";s:4:"𖹖";s:4:"𖹷";s:4:"𖹗";s:4:"𖹸";s:4:"𖹘";s:4:"𖹹";s:4:"𖹙";s:4:"𖹺";s:4:"𖹚";s:4:"𖹻";s:4:"𖹛";s:4:"𖹼";s:4:"𖹜";s:4:"𖹽";s:4:"𖹝";s:4:"𖹾";s:4:"𖹞";s:4:"𖹿";s:4:"𖹟";s:4:"𞤢";s:4:"𞤀";s:4:"𞤣";s:4:"𞤁";s:4:"𞤤";s:4:"𞤂";s:4:"𞤥";s:4:"𞤃";s:4:"𞤦";s:4:"𞤄";s:4:"𞤧";s:4:"𞤅";s:4:"𞤨";s:4:"𞤆";s:4:"𞤩";s:4:"𞤇";s:4:"𞤪";s:4:"𞤈";s:4:"𞤫";s:4:"𞤉";s:4:"𞤬";s:4:"𞤊";s:4:"𞤭";s:4:"𞤋";s:4:"𞤮";s:4:"𞤌";s:4:"𞤯";s:4:"𞤍";s:4:"𞤰";s:4:"𞤎";s:4:"𞤱";s:4:"𞤏";s:4:"𞤲";s:4:"𞤐";s:4:"𞤳";s:4:"𞤑";s:4:"𞤴";s:4:"𞤒";s:4:"𞤵";s:4:"𞤓";s:4:"𞤶";s:4:"𞤔";s:4:"𞤷";s:4:"𞤕";s:4:"𞤸";s:4:"𞤖";s:4:"𞤹";s:4:"𞤗";s:4:"𞤺";s:4:"𞤘";s:4:"𞤻";s:4:"𞤙";s:4:"𞤼";s:4:"𞤚";s:4:"𞤽";s:4:"𞤛";s:4:"𞤾";s:4:"𞤜";s:4:"𞤿";s:4:"𞤝";s:4:"𞥀";s:4:"𞤞";s:4:"𞥁";s:4:"𞤟";s:4:"𞥂";s:4:"𞤠";s:4:"𞥃";s:4:"𞤡";} \ No newline at end of file diff --git a/vendor/patchwork/utf8/src/Patchwork/Utf8/Bootup.php b/vendor/patchwork/utf8/src/Patchwork/Utf8/Bootup.php index 08cc5de..91c18d5 100644 --- a/vendor/patchwork/utf8/src/Patchwork/Utf8/Bootup.php +++ b/vendor/patchwork/utf8/src/Patchwork/Utf8/Bootup.php @@ -42,7 +42,7 @@ class Bootup user_error('php.ini settings: Please disable mbstring.encoding_translation or set mbstring.http_input to "pass"', E_USER_WARNING); } - if (MB_OVERLOAD_STRING & (int) ini_get('mbstring.func_overload')) { + if (defined('MB_OVERLOAD_STRING') && (MB_OVERLOAD_STRING & (int) ini_get('mbstring.func_overload'))) { user_error('php.ini settings: Please disable mbstring.func_overload', E_USER_WARNING); } diff --git a/vendor/patchwork/utf8/src/Patchwork/Utf8/Bootup/mbstring.php b/vendor/patchwork/utf8/src/Patchwork/Utf8/Bootup/mbstring.php index d06c6f7..fb2a46c 100644 --- a/vendor/patchwork/utf8/src/Patchwork/Utf8/Bootup/mbstring.php +++ b/vendor/patchwork/utf8/src/Patchwork/Utf8/Bootup/mbstring.php @@ -21,7 +21,7 @@ const MB_CASE_TITLE = 2; @trigger_error('You are using a fallback implementation of the mbstring extension. Installing the native one is highly recommended instead.', E_USER_DEPRECATED); function mb_convert_encoding($s, $to, $from = null) {return s\Mbstring::mb_convert_encoding($s, $to, $from);} -function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) {return mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f);} +function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) {return s\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f);} function mb_decode_mimeheader($s) {return s\Mbstring::mb_decode_mimeheader($s);} function mb_encode_mimeheader($s, $charset = null, $transfer_enc = null, $lf = null, $indent = null) {return s\Mbstring::mb_encode_mimeheader($s, $charset, $transfer_enc, $lf, $indent);} function mb_convert_case($s, $mode, $enc = null) {return s\Mbstring::mb_convert_case($s, $mode, $enc);} diff --git a/vendor/psr/container/.gitignore b/vendor/psr/container/.gitignore new file mode 100644 index 0000000..b2395aa --- /dev/null +++ b/vendor/psr/container/.gitignore @@ -0,0 +1,3 @@ +composer.lock +composer.phar +/vendor/ diff --git a/vendor/psr/container/LICENSE b/vendor/psr/container/LICENSE new file mode 100644 index 0000000..2877a48 --- /dev/null +++ b/vendor/psr/container/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013-2016 container-interop +Copyright (c) 2016 PHP Framework Interoperability Group + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/psr/container/README.md b/vendor/psr/container/README.md new file mode 100644 index 0000000..084f6df --- /dev/null +++ b/vendor/psr/container/README.md @@ -0,0 +1,5 @@ +# PSR Container + +This repository holds all interfaces/classes/traits related to [PSR-11](https://github.com/container-interop/fig-standards/blob/master/proposed/container.md). + +Note that this is not a container implementation of its own. See the specification for more details. diff --git a/vendor/psr/container/composer.json b/vendor/psr/container/composer.json new file mode 100644 index 0000000..b8ee012 --- /dev/null +++ b/vendor/psr/container/composer.json @@ -0,0 +1,27 @@ +{ + "name": "psr/container", + "type": "library", + "description": "Common Container Interface (PHP FIG PSR-11)", + "keywords": ["psr", "psr-11", "container", "container-interop", "container-interface"], + "homepage": "https://github.com/php-fig/container", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "require": { + "php": ">=5.3.0" + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/psr/container/src/ContainerExceptionInterface.php b/vendor/psr/container/src/ContainerExceptionInterface.php new file mode 100644 index 0000000..d35c6b4 --- /dev/null +++ b/vendor/psr/container/src/ContainerExceptionInterface.php @@ -0,0 +1,13 @@ +=5.3.0" + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + } +} diff --git a/vendor/psr/http-message/src/MessageInterface.php b/vendor/psr/http-message/src/MessageInterface.php new file mode 100644 index 0000000..dd46e5e --- /dev/null +++ b/vendor/psr/http-message/src/MessageInterface.php @@ -0,0 +1,187 @@ +getHeaders() as $name => $values) { + * echo $name . ": " . implode(", ", $values); + * } + * + * // Emit headers iteratively: + * foreach ($message->getHeaders() as $name => $values) { + * foreach ($values as $value) { + * header(sprintf('%s: %s', $name, $value), false); + * } + * } + * + * While header names are not case-sensitive, getHeaders() will preserve the + * exact case in which headers were originally specified. + * + * @return string[][] Returns an associative array of the message's headers. Each + * key MUST be a header name, and each value MUST be an array of strings + * for that header. + */ + public function getHeaders(); + + /** + * Checks if a header exists by the given case-insensitive name. + * + * @param string $name Case-insensitive header field name. + * @return bool Returns true if any header names match the given header + * name using a case-insensitive string comparison. Returns false if + * no matching header name is found in the message. + */ + public function hasHeader($name); + + /** + * Retrieves a message header value by the given case-insensitive name. + * + * This method returns an array of all the header values of the given + * case-insensitive header name. + * + * If the header does not appear in the message, this method MUST return an + * empty array. + * + * @param string $name Case-insensitive header field name. + * @return string[] An array of string values as provided for the given + * header. If the header does not appear in the message, this method MUST + * return an empty array. + */ + public function getHeader($name); + + /** + * Retrieves a comma-separated string of the values for a single header. + * + * This method returns all of the header values of the given + * case-insensitive header name as a string concatenated together using + * a comma. + * + * NOTE: Not all header values may be appropriately represented using + * comma concatenation. For such headers, use getHeader() instead + * and supply your own delimiter when concatenating. + * + * If the header does not appear in the message, this method MUST return + * an empty string. + * + * @param string $name Case-insensitive header field name. + * @return string A string of values as provided for the given header + * concatenated together using a comma. If the header does not appear in + * the message, this method MUST return an empty string. + */ + public function getHeaderLine($name); + + /** + * Return an instance with the provided value replacing the specified header. + * + * While header names are case-insensitive, the casing of the header will + * be preserved by this function, and returned from getHeaders(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new and/or updated header and value. + * + * @param string $name Case-insensitive header field name. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withHeader($name, $value); + + /** + * Return an instance with the specified header appended with the given value. + * + * Existing values for the specified header will be maintained. The new + * value(s) will be appended to the existing list. If the header did not + * exist previously, it will be added. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * new header and/or value. + * + * @param string $name Case-insensitive header field name to add. + * @param string|string[] $value Header value(s). + * @return static + * @throws \InvalidArgumentException for invalid header names or values. + */ + public function withAddedHeader($name, $value); + + /** + * Return an instance without the specified header. + * + * Header resolution MUST be done without case-sensitivity. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the named header. + * + * @param string $name Case-insensitive header field name to remove. + * @return static + */ + public function withoutHeader($name); + + /** + * Gets the body of the message. + * + * @return StreamInterface Returns the body as a stream. + */ + public function getBody(); + + /** + * Return an instance with the specified message body. + * + * The body MUST be a StreamInterface object. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return a new instance that has the + * new body stream. + * + * @param StreamInterface $body Body. + * @return static + * @throws \InvalidArgumentException When the body is not valid. + */ + public function withBody(StreamInterface $body); +} diff --git a/vendor/psr/http-message/src/RequestInterface.php b/vendor/psr/http-message/src/RequestInterface.php new file mode 100644 index 0000000..a96d4fd --- /dev/null +++ b/vendor/psr/http-message/src/RequestInterface.php @@ -0,0 +1,129 @@ +getQuery()` + * or from the `QUERY_STRING` server param. + * + * @return array + */ + public function getQueryParams(); + + /** + * Return an instance with the specified query string arguments. + * + * These values SHOULD remain immutable over the course of the incoming + * request. They MAY be injected during instantiation, such as from PHP's + * $_GET superglobal, or MAY be derived from some other value such as the + * URI. In cases where the arguments are parsed from the URI, the data + * MUST be compatible with what PHP's parse_str() would return for + * purposes of how duplicate query parameters are handled, and how nested + * sets are handled. + * + * Setting query string arguments MUST NOT change the URI stored by the + * request, nor the values in the server params. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated query string arguments. + * + * @param array $query Array of query string arguments, typically from + * $_GET. + * @return static + */ + public function withQueryParams(array $query); + + /** + * Retrieve normalized file upload data. + * + * This method returns upload metadata in a normalized tree, with each leaf + * an instance of Psr\Http\Message\UploadedFileInterface. + * + * These values MAY be prepared from $_FILES or the message body during + * instantiation, or MAY be injected via withUploadedFiles(). + * + * @return array An array tree of UploadedFileInterface instances; an empty + * array MUST be returned if no data is present. + */ + public function getUploadedFiles(); + + /** + * Create a new instance with the specified uploaded files. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param array $uploadedFiles An array tree of UploadedFileInterface instances. + * @return static + * @throws \InvalidArgumentException if an invalid structure is provided. + */ + public function withUploadedFiles(array $uploadedFiles); + + /** + * Retrieve any parameters provided in the request body. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, this method MUST + * return the contents of $_POST. + * + * Otherwise, this method may return any results of deserializing + * the request body content; as parsing returns structured content, the + * potential types MUST be arrays or objects only. A null value indicates + * the absence of body content. + * + * @return null|array|object The deserialized body parameters, if any. + * These will typically be an array or object. + */ + public function getParsedBody(); + + /** + * Return an instance with the specified body parameters. + * + * These MAY be injected during instantiation. + * + * If the request Content-Type is either application/x-www-form-urlencoded + * or multipart/form-data, and the request method is POST, use this method + * ONLY to inject the contents of $_POST. + * + * The data IS NOT REQUIRED to come from $_POST, but MUST be the results of + * deserializing the request body content. Deserialization/parsing returns + * structured data, and, as such, this method ONLY accepts arrays or objects, + * or a null value if nothing was available to parse. + * + * As an example, if content negotiation determines that the request data + * is a JSON payload, this method could be used to create a request + * instance with the deserialized parameters. + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated body parameters. + * + * @param null|array|object $data The deserialized body data. This will + * typically be in an array or object. + * @return static + * @throws \InvalidArgumentException if an unsupported argument type is + * provided. + */ + public function withParsedBody($data); + + /** + * Retrieve attributes derived from the request. + * + * The request "attributes" may be used to allow injection of any + * parameters derived from the request: e.g., the results of path + * match operations; the results of decrypting cookies; the results of + * deserializing non-form-encoded message bodies; etc. Attributes + * will be application and request specific, and CAN be mutable. + * + * @return array Attributes derived from the request. + */ + public function getAttributes(); + + /** + * Retrieve a single derived request attribute. + * + * Retrieves a single derived request attribute as described in + * getAttributes(). If the attribute has not been previously set, returns + * the default value as provided. + * + * This method obviates the need for a hasAttribute() method, as it allows + * specifying a default value to return if the attribute is not found. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $default Default value to return if the attribute does not exist. + * @return mixed + */ + public function getAttribute($name, $default = null); + + /** + * Return an instance with the specified derived request attribute. + * + * This method allows setting a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that has the + * updated attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @param mixed $value The value of the attribute. + * @return static + */ + public function withAttribute($name, $value); + + /** + * Return an instance that removes the specified derived request attribute. + * + * This method allows removing a single derived request attribute as + * described in getAttributes(). + * + * This method MUST be implemented in such a way as to retain the + * immutability of the message, and MUST return an instance that removes + * the attribute. + * + * @see getAttributes() + * @param string $name The attribute name. + * @return static + */ + public function withoutAttribute($name); +} diff --git a/vendor/psr/http-message/src/StreamInterface.php b/vendor/psr/http-message/src/StreamInterface.php new file mode 100644 index 0000000..f68f391 --- /dev/null +++ b/vendor/psr/http-message/src/StreamInterface.php @@ -0,0 +1,158 @@ + + * [user-info@]host[:port] + * + * + * If the port component is not set or is the standard port for the current + * scheme, it SHOULD NOT be included. + * + * @see https://tools.ietf.org/html/rfc3986#section-3.2 + * @return string The URI authority, in "[user-info@]host[:port]" format. + */ + public function getAuthority(); + + /** + * Retrieve the user information component of the URI. + * + * If no user information is present, this method MUST return an empty + * string. + * + * If a user is present in the URI, this will return that value; + * additionally, if the password is also present, it will be appended to the + * user value, with a colon (":") separating the values. + * + * The trailing "@" character is not part of the user information and MUST + * NOT be added. + * + * @return string The URI user information, in "username[:password]" format. + */ + public function getUserInfo(); + + /** + * Retrieve the host component of the URI. + * + * If no host is present, this method MUST return an empty string. + * + * The value returned MUST be normalized to lowercase, per RFC 3986 + * Section 3.2.2. + * + * @see http://tools.ietf.org/html/rfc3986#section-3.2.2 + * @return string The URI host. + */ + public function getHost(); + + /** + * Retrieve the port component of the URI. + * + * If a port is present, and it is non-standard for the current scheme, + * this method MUST return it as an integer. If the port is the standard port + * used with the current scheme, this method SHOULD return null. + * + * If no port is present, and no scheme is present, this method MUST return + * a null value. + * + * If no port is present, but a scheme is present, this method MAY return + * the standard port for that scheme, but SHOULD return null. + * + * @return null|int The URI port. + */ + public function getPort(); + + /** + * Retrieve the path component of the URI. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * Normally, the empty path "" and absolute path "/" are considered equal as + * defined in RFC 7230 Section 2.7.3. But this method MUST NOT automatically + * do this normalization because in contexts with a trimmed base path, e.g. + * the front controller, this difference becomes significant. It's the task + * of the user to handle both "" and "/". + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.3. + * + * As an example, if the value should include a slash ("/") not intended as + * delimiter between path segments, that value MUST be passed in encoded + * form (e.g., "%2F") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.3 + * @return string The URI path. + */ + public function getPath(); + + /** + * Retrieve the query string of the URI. + * + * If no query string is present, this method MUST return an empty string. + * + * The leading "?" character is not part of the query and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.4. + * + * As an example, if a value in a key/value pair of the query string should + * include an ampersand ("&") not intended as a delimiter between values, + * that value MUST be passed in encoded form (e.g., "%26") to the instance. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.4 + * @return string The URI query string. + */ + public function getQuery(); + + /** + * Retrieve the fragment component of the URI. + * + * If no fragment is present, this method MUST return an empty string. + * + * The leading "#" character is not part of the fragment and MUST NOT be + * added. + * + * The value returned MUST be percent-encoded, but MUST NOT double-encode + * any characters. To determine what characters to encode, please refer to + * RFC 3986, Sections 2 and 3.5. + * + * @see https://tools.ietf.org/html/rfc3986#section-2 + * @see https://tools.ietf.org/html/rfc3986#section-3.5 + * @return string The URI fragment. + */ + public function getFragment(); + + /** + * Return an instance with the specified scheme. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified scheme. + * + * Implementations MUST support the schemes "http" and "https" case + * insensitively, and MAY accommodate other schemes if required. + * + * An empty scheme is equivalent to removing the scheme. + * + * @param string $scheme The scheme to use with the new instance. + * @return static A new instance with the specified scheme. + * @throws \InvalidArgumentException for invalid or unsupported schemes. + */ + public function withScheme($scheme); + + /** + * Return an instance with the specified user information. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified user information. + * + * Password is optional, but the user information MUST include the + * user; an empty string for the user is equivalent to removing user + * information. + * + * @param string $user The user name to use for authority. + * @param null|string $password The password associated with $user. + * @return static A new instance with the specified user information. + */ + public function withUserInfo($user, $password = null); + + /** + * Return an instance with the specified host. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified host. + * + * An empty host value is equivalent to removing the host. + * + * @param string $host The hostname to use with the new instance. + * @return static A new instance with the specified host. + * @throws \InvalidArgumentException for invalid hostnames. + */ + public function withHost($host); + + /** + * Return an instance with the specified port. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified port. + * + * Implementations MUST raise an exception for ports outside the + * established TCP and UDP port ranges. + * + * A null value provided for the port is equivalent to removing the port + * information. + * + * @param null|int $port The port to use with the new instance; a null value + * removes the port information. + * @return static A new instance with the specified port. + * @throws \InvalidArgumentException for invalid ports. + */ + public function withPort($port); + + /** + * Return an instance with the specified path. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified path. + * + * The path can either be empty or absolute (starting with a slash) or + * rootless (not starting with a slash). Implementations MUST support all + * three syntaxes. + * + * If the path is intended to be domain-relative rather than path relative then + * it must begin with a slash ("/"). Paths not starting with a slash ("/") + * are assumed to be relative to some base path known to the application or + * consumer. + * + * Users can provide both encoded and decoded path characters. + * Implementations ensure the correct encoding as outlined in getPath(). + * + * @param string $path The path to use with the new instance. + * @return static A new instance with the specified path. + * @throws \InvalidArgumentException for invalid paths. + */ + public function withPath($path); + + /** + * Return an instance with the specified query string. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified query string. + * + * Users can provide both encoded and decoded query characters. + * Implementations ensure the correct encoding as outlined in getQuery(). + * + * An empty query string value is equivalent to removing the query string. + * + * @param string $query The query string to use with the new instance. + * @return static A new instance with the specified query string. + * @throws \InvalidArgumentException for invalid query strings. + */ + public function withQuery($query); + + /** + * Return an instance with the specified URI fragment. + * + * This method MUST retain the state of the current instance, and return + * an instance that contains the specified URI fragment. + * + * Users can provide both encoded and decoded fragment characters. + * Implementations ensure the correct encoding as outlined in getFragment(). + * + * An empty fragment value is equivalent to removing the fragment. + * + * @param string $fragment The fragment to use with the new instance. + * @return static A new instance with the specified fragment. + */ + public function withFragment($fragment); + + /** + * Return the string representation as a URI reference. + * + * Depending on which components of the URI are present, the resulting + * string is either a full URI or relative reference according to RFC 3986, + * Section 4.1. The method concatenates the various components of the URI, + * using the appropriate delimiters: + * + * - If a scheme is present, it MUST be suffixed by ":". + * - If an authority is present, it MUST be prefixed by "//". + * - The path can be concatenated without delimiters. But there are two + * cases where the path has to be adjusted to make the URI reference + * valid as PHP does not allow to throw an exception in __toString(): + * - If the path is rootless and an authority is present, the path MUST + * be prefixed by "/". + * - If the path is starting with more than one "/" and no authority is + * present, the starting slashes MUST be reduced to one. + * - If a query is present, it MUST be prefixed by "?". + * - If a fragment is present, it MUST be prefixed by "#". + * + * @see http://tools.ietf.org/html/rfc3986#section-4.1 + * @return string + */ + public function __toString(); +} diff --git a/vendor/psr/log/Psr/Log/LoggerInterface.php b/vendor/psr/log/Psr/Log/LoggerInterface.php index 5ea7243..e695046 100644 --- a/vendor/psr/log/Psr/Log/LoggerInterface.php +++ b/vendor/psr/log/Psr/Log/LoggerInterface.php @@ -118,6 +118,8 @@ interface LoggerInterface * @param array $context * * @return void + * + * @throws \Psr\Log\InvalidArgumentException */ public function log($level, $message, array $context = array()); } diff --git a/vendor/psr/log/Psr/Log/LoggerTrait.php b/vendor/psr/log/Psr/Log/LoggerTrait.php index 867225d..e392fef 100644 --- a/vendor/psr/log/Psr/Log/LoggerTrait.php +++ b/vendor/psr/log/Psr/Log/LoggerTrait.php @@ -135,6 +135,8 @@ trait LoggerTrait * @param array $context * * @return void + * + * @throws \Psr\Log\InvalidArgumentException */ abstract public function log($level, $message, array $context = array()); } diff --git a/vendor/psr/log/Psr/Log/NullLogger.php b/vendor/psr/log/Psr/Log/NullLogger.php index d8cd682..c8f7293 100644 --- a/vendor/psr/log/Psr/Log/NullLogger.php +++ b/vendor/psr/log/Psr/Log/NullLogger.php @@ -20,6 +20,8 @@ class NullLogger extends AbstractLogger * @param array $context * * @return void + * + * @throws \Psr\Log\InvalidArgumentException */ public function log($level, $message, array $context = array()) { diff --git a/vendor/psr/log/composer.json b/vendor/psr/log/composer.json index 87934d7..3f6d4ee 100644 --- a/vendor/psr/log/composer.json +++ b/vendor/psr/log/composer.json @@ -20,7 +20,7 @@ }, "extra": { "branch-alias": { - "dev-master": "1.0.x-dev" + "dev-master": "1.1.x-dev" } } } diff --git a/vendor/ralouphie/getallheaders/LICENSE b/vendor/ralouphie/getallheaders/LICENSE new file mode 100644 index 0000000..be5540c --- /dev/null +++ b/vendor/ralouphie/getallheaders/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Ralph Khattar + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/ralouphie/getallheaders/README.md b/vendor/ralouphie/getallheaders/README.md new file mode 100644 index 0000000..9430d76 --- /dev/null +++ b/vendor/ralouphie/getallheaders/README.md @@ -0,0 +1,27 @@ +getallheaders +============= + +PHP `getallheaders()` polyfill. Compatible with PHP >= 5.3. + +[![Build Status](https://travis-ci.org/ralouphie/getallheaders.svg?branch=master)](https://travis-ci.org/ralouphie/getallheaders) +[![Coverage Status](https://coveralls.io/repos/ralouphie/getallheaders/badge.png?branch=master)](https://coveralls.io/r/ralouphie/getallheaders?branch=master) +[![Latest Stable Version](https://poser.pugx.org/ralouphie/getallheaders/v/stable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![Latest Unstable Version](https://poser.pugx.org/ralouphie/getallheaders/v/unstable.png)](https://packagist.org/packages/ralouphie/getallheaders) +[![License](https://poser.pugx.org/ralouphie/getallheaders/license.png)](https://packagist.org/packages/ralouphie/getallheaders) + + +This is a simple polyfill for [`getallheaders()`](http://www.php.net/manual/en/function.getallheaders.php). + +## Install + +For PHP version **`>= 5.6`**: + +``` +composer require ralouphie/getallheaders +``` + +For PHP version **`< 5.6`**: + +``` +composer require ralouphie/getallheaders "^2" +``` diff --git a/vendor/ralouphie/getallheaders/composer.json b/vendor/ralouphie/getallheaders/composer.json new file mode 100644 index 0000000..de8ce62 --- /dev/null +++ b/vendor/ralouphie/getallheaders/composer.json @@ -0,0 +1,26 @@ +{ + "name": "ralouphie/getallheaders", + "description": "A polyfill for getallheaders.", + "license": "MIT", + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "require": { + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5 || ^6.5", + "php-coveralls/php-coveralls": "^2.1" + }, + "autoload": { + "files": ["src/getallheaders.php"] + }, + "autoload-dev": { + "psr-4": { + "getallheaders\\Tests\\": "tests/" + } + } +} diff --git a/vendor/ralouphie/getallheaders/src/getallheaders.php b/vendor/ralouphie/getallheaders/src/getallheaders.php new file mode 100644 index 0000000..c7285a5 --- /dev/null +++ b/vendor/ralouphie/getallheaders/src/getallheaders.php @@ -0,0 +1,46 @@ + 'Content-Type', + 'CONTENT_LENGTH' => 'Content-Length', + 'CONTENT_MD5' => 'Content-Md5', + ); + + foreach ($_SERVER as $key => $value) { + if (substr($key, 0, 5) === 'HTTP_') { + $key = substr($key, 5); + if (!isset($copy_server[$key]) || !isset($_SERVER[$key])) { + $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $key)))); + $headers[$key] = $value; + } + } elseif (isset($copy_server[$key])) { + $headers[$copy_server[$key]] = $value; + } + } + + if (!isset($headers['Authorization'])) { + if (isset($_SERVER['REDIRECT_HTTP_AUTHORIZATION'])) { + $headers['Authorization'] = $_SERVER['REDIRECT_HTTP_AUTHORIZATION']; + } elseif (isset($_SERVER['PHP_AUTH_USER'])) { + $basic_pass = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : ''; + $headers['Authorization'] = 'Basic ' . base64_encode($_SERVER['PHP_AUTH_USER'] . ':' . $basic_pass); + } elseif (isset($_SERVER['PHP_AUTH_DIGEST'])) { + $headers['Authorization'] = $_SERVER['PHP_AUTH_DIGEST']; + } + } + + return $headers; + } + +} diff --git a/vendor/s9e/regexp-builder/LICENSE b/vendor/s9e/regexp-builder/LICENSE new file mode 100644 index 0000000..060955a --- /dev/null +++ b/vendor/s9e/regexp-builder/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2016-2018 The s9e Authors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/s9e/regexp-builder/composer.json b/vendor/s9e/regexp-builder/composer.json new file mode 100644 index 0000000..30ad4a8 --- /dev/null +++ b/vendor/s9e/regexp-builder/composer.json @@ -0,0 +1,25 @@ +{ + "name": "s9e/regexp-builder", + "type": "library", + "description": "Single-purpose library that generates regular expressions that match a list of strings.", + "homepage": "https://github.com/s9e/RegexpBuilder/", + "keywords": ["regexp"], + "license": "MIT", + "require": { + "lib-pcre": ">=7.2", + "php": ">=5.5.1" + }, + "require-dev": { + "phpunit/phpunit": "<5.8" + }, + "autoload": { + "psr-4": { + "s9e\\RegexpBuilder\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "s9e\\RegexpBuilder\\Tests\\": "tests" + } + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Builder.php b/vendor/s9e/regexp-builder/src/Builder.php new file mode 100644 index 0000000..069e906 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Builder.php @@ -0,0 +1,167 @@ + '/', + 'input' => 'Bytes', + 'inputOptions' => [], + 'meta' => [], + 'output' => 'Bytes', + 'outputOptions' => [] + ]; + + $this->setInput($config['input'], $config['inputOptions']); + $this->setMeta($config['meta']); + $this->setSerializer($config['output'], $config['outputOptions'], $config['delimiter']); + $this->setRunner(); + } + + /** + * Build and return a regular expression that matches all of the given strings + * + * @param string[] $strings Literal strings to be matched + * @return string Regular expression (without delimiters) + */ + public function build(array $strings) + { + $strings = array_unique($strings); + sort($strings); + if ($this->isEmpty($strings)) + { + return ''; + } + + $strings = $this->splitStrings($strings); + $strings = $this->meta->replaceMeta($strings); + $strings = $this->runner->run($strings); + + return $this->serializer->serializeStrings($strings); + } + + /** + * Test whether the list of strings is empty + * + * @param string[] $strings + * @return bool + */ + protected function isEmpty(array $strings) + { + return (empty($strings) || $strings === ['']); + } + + /** + * Set the InputInterface instance in $this->input + * + * @param string $inputType + * @param array $inputOptions + * @return void + */ + protected function setInput($inputType, array $inputOptions) + { + $className = __NAMESPACE__ . '\\Input\\' . $inputType; + $this->input = new $className($inputOptions); + } + + /** + * Set the MetaCharacters instance in $this->meta + * + * @param array $map + * @return void + */ + protected function setMeta(array $map) + { + $this->meta = new MetaCharacters($this->input); + foreach ($map as $char => $expr) + { + $this->meta->add($char, $expr); + } + } + + /** + * Set the Runner instance $in this->runner + * + * @return void + */ + protected function setRunner() + { + $this->runner = new Runner; + $this->runner->addPass(new MergePrefix); + $this->runner->addPass(new GroupSingleCharacters); + $this->runner->addPass(new Recurse($this->runner)); + $this->runner->addPass(new PromoteSingleStrings); + $this->runner->addPass(new CoalesceOptionalStrings); + $this->runner->addPass(new MergeSuffix); + $this->runner->addPass(new CoalesceSingleCharacterPrefix); + } + + /** + * Set the Serializer instance in $this->serializer + * + * @param string $outputType + * @param array $outputOptions + * @param string $delimiter + * @return void + */ + protected function setSerializer($outputType, array $outputOptions, $delimiter) + { + $className = __NAMESPACE__ . '\\Output\\' . $outputType; + $output = new $className($outputOptions); + $escaper = new Escaper($delimiter); + + $this->serializer = new Serializer($output, $this->meta, $escaper); + } + + /** + * Split all given strings by character + * + * @param string[] $strings List of strings + * @return array[] List of arrays + */ + protected function splitStrings(array $strings) + { + return array_map([$this->input, 'split'], $strings); + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Escaper.php b/vendor/s9e/regexp-builder/src/Escaper.php new file mode 100644 index 0000000..ca618bb --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Escaper.php @@ -0,0 +1,59 @@ + '\\-', '\\' => '\\\\', ']' => '\\]', '^' => '\\^']; + + /** + * @var array Characters to escape outside of a character class + */ + public $inLiteral = [ + '$' => '\\$', '(' => '\\(', ')' => '\\)', '*' => '\\*', + '+' => '\\+', '.' => '\\.', '?' => '\\?', '[' => '\\]', + '\\' => '\\\\', '^' => '\\^', '{' => '\\{', '|' => '\\|' + ]; + + /** + * @param string $delimiter Delimiter used in the final regexp + */ + public function __construct($delimiter = '/') + { + foreach (str_split($delimiter, 1) as $char) + { + $this->inCharacterClass[$char] = '\\' . $char; + $this->inLiteral[$char] = '\\' . $char; + } + } + + /** + * Escape given character to be used in a character class + * + * @param string $char Original character + * @return string Escaped character + */ + public function escapeCharacterClass($char) + { + return (isset($this->inCharacterClass[$char])) ? $this->inCharacterClass[$char] : $char; + } + + /** + * Escape given character to be used outside of a character class + * + * @param string $char Original character + * @return string Escaped character + */ + public function escapeLiteral($char) + { + return (isset($this->inLiteral[$char])) ? $this->inLiteral[$char] : $char; + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Input/BaseImplementation.php b/vendor/s9e/regexp-builder/src/Input/BaseImplementation.php new file mode 100644 index 0000000..69cc9a4 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Input/BaseImplementation.php @@ -0,0 +1,23 @@ +useSurrogates = !empty($options['useSurrogates']); + } + + /** + * {@inheritdoc} + */ + public function split($string) + { + if (preg_match_all('(.)us', $string, $matches) === false) + { + throw new InvalidArgumentException('Invalid UTF-8 string'); + } + + return ($this->useSurrogates) ? $this->charsToCodepointsWithSurrogates($matches[0]) : $this->charsToCodepoints($matches[0]); + } + + /** + * Convert a list of UTF-8 characters into a list of Unicode codepoint + * + * @param string[] $chars + * @return integer[] + */ + protected function charsToCodepoints(array $chars) + { + return array_map([$this, 'cp'], $chars); + } + + /** + * Convert a list of UTF-8 characters into a list of Unicode codepoint with surrogates + * + * @param string[] $chars + * @return integer[] + */ + protected function charsToCodepointsWithSurrogates(array $chars) + { + $codepoints = []; + foreach ($chars as $char) + { + $cp = $this->cp($char); + if ($cp < 0x10000) + { + $codepoints[] = $cp; + } + else + { + $codepoints[] = 0xD7C0 + ($cp >> 10); + $codepoints[] = 0xDC00 + ($cp & 0x3FF); + } + } + + return $codepoints; + } + + /** + * Compute and return the Unicode codepoint for given UTF-8 char + * + * @param string $char UTF-8 char + * @return integer + */ + protected function cp($char) + { + $cp = ord($char[0]); + if ($cp >= 0xF0) + { + $cp = ($cp << 18) + (ord($char[1]) << 12) + (ord($char[2]) << 6) + ord($char[3]) - 0x3C82080; + } + elseif ($cp >= 0xE0) + { + $cp = ($cp << 12) + (ord($char[1]) << 6) + ord($char[2]) - 0xE2080; + } + elseif ($cp >= 0xC0) + { + $cp = ($cp << 6) + ord($char[1]) - 0x3080; + } + + return $cp; + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/MetaCharacters.php b/vendor/s9e/regexp-builder/src/MetaCharacters.php new file mode 100644 index 0000000..9eaa5b9 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/MetaCharacters.php @@ -0,0 +1,222 @@ +input = $input; + } + + /** + * Add a meta-character to the list + * + * @param string $char Meta-character + * @param string $expr Regular expression + * @return void + */ + public function add($char, $expr) + { + $split = $this->input->split($char); + if (count($split) !== 1) + { + throw new InvalidArgumentException('Meta-characters must be represented by exactly one character'); + } + if (@preg_match('(' . $expr . ')u', '') === false) + { + throw new InvalidArgumentException("Invalid expression '" . $expr . "'"); + } + + $inputValue = $split[0]; + $metaValue = $this->computeValue($expr); + + $this->exprs[$metaValue] = $expr; + $this->meta[$inputValue] = $metaValue; + } + + /** + * Get the expression associated with a meta value + * + * @param integer $metaValue + * @return string + */ + public function getExpression($metaValue) + { + if (!isset($this->exprs[$metaValue])) + { + throw new InvalidArgumentException('Invalid meta value ' . $metaValue); + } + + return $this->exprs[$metaValue]; + } + + /** + * Return whether a given value represents a single character usable in a character class + * + * @param integer $value + * @return bool + */ + public static function isChar($value) + { + return ($value >= 0 || ($value & self::IS_CHAR)); + } + + /** + * Return whether a given value represents a quantifiable expression + * + * @param integer $value + * @return bool + */ + public static function isQuantifiable($value) + { + return ($value >= 0 || ($value & self::IS_QUANTIFIABLE)); + } + + /** + * Replace values from meta-characters in a list of strings with their meta value + * + * @param array[] $strings + * @return array[] + */ + public function replaceMeta(array $strings) + { + foreach ($strings as &$string) + { + foreach ($string as &$value) + { + if (isset($this->meta[$value])) + { + $value = $this->meta[$value]; + } + } + } + + return $strings; + } + + /** + * Compute and return a value for given expression + * + * Values are meant to be a unique negative integer. The last 2 bits indicate whether the + * expression is quantifiable and/or represents a single character. + * + * @param string $expr Regular expression + * @return integer + */ + protected function computeValue($expr) + { + $properties = [ + 'exprIsChar' => self::IS_CHAR, + 'exprIsQuantifiable' => self::IS_QUANTIFIABLE + ]; + $value = (1 + count($this->meta)) * -pow(2, count($properties)); + foreach ($properties as $methodName => $bitValue) + { + if ($this->$methodName($expr)) + { + $value |= $bitValue; + } + } + + return $value; + } + + /** + * Test whether given expression represents a single character usable in a character class + * + * @param string $expr + * @return bool + */ + protected function exprIsChar($expr) + { + $regexps = [ + // Escaped literal or escape sequence such as \w but not \R + '(^\\\\[adefhnrstvwDHNSVW\\W]$)D', + + // Unicode properties such as \pL or \p{Lu} + '(^\\\\p(?:.|\\{[^}]+\\})$)Di', + + // An escape sequence such as \x1F or \x{2600} + '(^\\\\x(?:[0-9a-f]{2}|\\{[^}]+\\})$)Di' + ]; + + return $this->matchesAny($expr, $regexps); + } + + /** + * Test whether given expression is quantifiable + * + * @param string $expr + * @return bool + */ + protected function exprIsQuantifiable($expr) + { + $regexps = [ + // A dot or \R + '(^(?:\\.|\\\\R)$)D', + + // A character class + '(^\\[\\^?(?:([^\\\\\\]]|\\\\.)(?:-(?-1))?)++\\]$)D' + ]; + + return $this->matchesAny($expr, $regexps) || $this->exprIsChar($expr); + } + + /** + * Test whether given expression matches any of the given regexps + * + * @param string $expr + * @param string[] $regexps + * @return bool + */ + protected function matchesAny($expr, array $regexps) + { + foreach ($regexps as $regexp) + { + if (preg_match($regexp, $expr)) + { + return true; + } + } + + return false; + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Output/BaseImplementation.php b/vendor/s9e/regexp-builder/src/Output/BaseImplementation.php new file mode 100644 index 0000000..bf0eb65 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Output/BaseImplementation.php @@ -0,0 +1,62 @@ +validate($value); + + return $this->outputValidValue($value); + } + + /** + * Validate given value + * + * @param integer $value + * @return void + */ + protected function validate($value) + { + if ($value < $this->minValue || $value > $this->maxValue) + { + throw new InvalidArgumentException('Value ' . $value . ' is out of bounds (' . $this->minValue . '..' . $this->maxValue . ')'); + } + } + + /** + * Serialize a valid value into a character + * + * @param integer $value + * @return string + */ + abstract protected function outputValidValue($value); +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Output/Bytes.php b/vendor/s9e/regexp-builder/src/Output/Bytes.php new file mode 100644 index 0000000..1120182 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Output/Bytes.php @@ -0,0 +1,22 @@ + 0xFFFF) ? '\\u{%' . $this->hexCase . '}' : '\\u%04' . $this->hexCase; + + return sprintf($format, $cp); + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Output/OutputInterface.php b/vendor/s9e/regexp-builder/src/Output/OutputInterface.php new file mode 100644 index 0000000..26fa847 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Output/OutputInterface.php @@ -0,0 +1,19 @@ +hexCase . '}', $cp); + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Output/PrintableAscii.php b/vendor/s9e/regexp-builder/src/Output/PrintableAscii.php new file mode 100644 index 0000000..3179585 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Output/PrintableAscii.php @@ -0,0 +1,74 @@ +hexCase = (isset($options['case']) && $options['case'] === 'lower') ? 'x' : 'X'; + } + + /** + * Escape given ASCII codepoint + * + * @param integer $cp + * @return string + */ + protected function escapeAscii($cp) + { + return '\\x' . sprintf('%02' . $this->hexCase, $cp); + } + + /** + * Escape given control code + * + * @param integer $cp + * @return string + */ + protected function escapeControlCode($cp) + { + $table = [9 => '\\t', 10 => '\\n', 13 => '\\r']; + + return (isset($table[$cp])) ? $table[$cp] : $this->escapeAscii($cp); + } + + /** + * Output the representation of a unicode character + * + * @param integer $cp Unicode codepoint + * @return string + */ + abstract protected function escapeUnicode($cp); + + /** + * {@inheritdoc} + */ + protected function outputValidValue($value) + { + if ($value < 32) + { + return $this->escapeControlCode($value); + } + + if ($value < 127) + { + return chr($value); + } + + return ($value > 255) ? $this->escapeUnicode($value) : $this->escapeAscii($value); + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Output/Utf8.php b/vendor/s9e/regexp-builder/src/Output/Utf8.php new file mode 100644 index 0000000..48a484c --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Output/Utf8.php @@ -0,0 +1,54 @@ +> 6)) . chr(0x80 | ($value & 0x3F)); + } + if ($value < 0x10000) + { + return chr(0xE0 | ($value >> 12)) + . chr(0x80 | (($value >> 6) & 0x3F)) + . chr(0x80 | ($value & 0x3F)); + } + return chr(0xF0 | ($value >> 18)) + . chr(0x80 | (($value >> 12) & 0x3F)) + . chr(0x80 | (($value >> 6) & 0x3F)) + . chr(0x80 | ($value & 0x3F)); + } + + /** + * {@inheritdoc} + */ + protected function validate($value) + { + if ($value >= 0xD800 && $value <= 0xDFFF) + { + throw new InvalidArgumentException(sprintf('Surrogate 0x%X is not a valid UTF-8 character', $value)); + } + + parent::validate($value); + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Passes/AbstractPass.php b/vendor/s9e/regexp-builder/src/Passes/AbstractPass.php new file mode 100644 index 0000000..c012675 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Passes/AbstractPass.php @@ -0,0 +1,148 @@ +beforeRun($strings); + if ($this->canRun($strings)) + { + $strings = $this->runPass($strings); + } + $strings = $this->afterRun($strings); + + return $strings; + } + + /** + * Process the list of strings after the pass is run + * + * @param array[] $strings + * @return array[] + */ + protected function afterRun(array $strings) + { + if ($this->isOptional && $strings[0] !== []) + { + array_unshift($strings, []); + } + + return $strings; + } + + /** + * Prepare the list of strings before the pass is run + * + * @param array[] $strings + * @return array[] + */ + protected function beforeRun(array $strings) + { + $this->isOptional = (isset($strings[0]) && $strings[0] === []); + if ($this->isOptional) + { + array_shift($strings); + } + + return $strings; + } + + /** + * Test whether this pass can be run on a given list of strings + * + * @param array[] $strings + * @return bool + */ + protected function canRun(array $strings) + { + return true; + } + + /** + * Run this pass on a list of strings + * + * @param array[] $strings + * @return array[] + */ + abstract protected function runPass(array $strings); + + /** + * Test whether given string has an optional suffix + * + * @param array $string + * @return bool + */ + protected function hasOptionalSuffix(array $string) + { + $suffix = end($string); + + return (is_array($suffix) && $suffix[0] === []); + } + + /** + * Test whether given string contains a single alternations made of single values + * + * @param array $string + * @return bool + */ + protected function isCharacterClassString(array $string) + { + return ($this->isSingleAlternationString($string) && $this->isSingleCharStringList($string[0])); + } + + /** + * Test whether given string contains one single element that is an alternation + * + * @param array + * @return bool + */ + protected function isSingleAlternationString(array $string) + { + return (count($string) === 1 && is_array($string[0])); + } + + /** + * Test whether given string contains a single character value + * + * @param array $string + * @return bool + */ + protected function isSingleCharString(array $string) + { + return (count($string) === 1 && !is_array($string[0])); + } + + /** + * Test whether given list of strings contains nothing but single-char strings + * + * @param array[] $strings + * @return bool + */ + protected function isSingleCharStringList(array $strings) + { + foreach ($strings as $string) + { + if (!$this->isSingleCharString($string)) + { + return false; + } + } + + return true; + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Passes/CoalesceOptionalStrings.php b/vendor/s9e/regexp-builder/src/Passes/CoalesceOptionalStrings.php new file mode 100644 index 0000000..a8b4519 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Passes/CoalesceOptionalStrings.php @@ -0,0 +1,138 @@ +isOptional && count($strings) > 1); + } + + /** + * {@inheritdoc} + */ + protected function runPass(array $strings) + { + foreach ($this->getPrefixGroups($strings) as $suffix => $prefixStrings) + { + $suffix = unserialize($suffix); + $suffixStrings = array_diff_key($strings, $prefixStrings); + if ($suffix === $this->buildSuffix($suffixStrings)) + { + $this->isOptional = false; + + return $this->buildCoalescedStrings($prefixStrings, $suffix); + } + } + + return $strings; + } + + /** + * Build the final list of coalesced strings + * + * @param array[] $prefixStrings + * @param array $suffix + * @return array[] + */ + protected function buildCoalescedStrings(array $prefixStrings, array $suffix) + { + $strings = $this->runPass($this->buildPrefix($prefixStrings)); + if (count($strings) === 1 && $strings[0][0][0] === []) + { + // If the prefix has been remerged into a list of strings which contains only one string + // of which the first element is an optional alternations, we only need to append the + // suffix + $strings[0][] = $suffix; + } + else + { + // Put the current list of strings that form the prefix into a new list of strings, of + // which the only string is composed of our optional prefix followed by the suffix + array_unshift($strings, []); + $strings = [[$strings, $suffix]]; + } + + return $strings; + } + + /** + * Build the list of strings used as prefix + * + * @param array[] $strings + * @return array[] + */ + protected function buildPrefix(array $strings) + { + $prefix = []; + foreach ($strings as $string) + { + // Remove the last element (suffix) of each string before adding it + array_pop($string); + $prefix[] = $string; + } + + return $prefix; + } + + /** + * Build a list of strings that matches any given strings or nothing + * + * Will unpack groups of single characters + * + * @param array[] $strings + * @return array[] + */ + protected function buildSuffix(array $strings) + { + $suffix = [[]]; + foreach ($strings as $string) + { + if ($this->isCharacterClassString($string)) + { + foreach ($string[0] as $element) + { + $suffix[] = $element; + } + } + else + { + $suffix[] = $string; + } + } + + return $suffix; + } + + /** + * Get the list of potential prefix strings grouped by identical suffix + * + * @param array[] $strings + * @return array + */ + protected function getPrefixGroups(array $strings) + { + $groups = []; + foreach ($strings as $k => $string) + { + if ($this->hasOptionalSuffix($string)) + { + $groups[serialize(end($string))][$k] = $string; + } + } + + return $groups; + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Passes/CoalesceSingleCharacterPrefix.php b/vendor/s9e/regexp-builder/src/Passes/CoalesceSingleCharacterPrefix.php new file mode 100644 index 0000000..09d971e --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Passes/CoalesceSingleCharacterPrefix.php @@ -0,0 +1,81 @@ +getEligibleKeys($strings) as $keys) + { + // Create a new string to hold the merged strings and replace the first element with + // an empty character class + $newString = $strings[$keys[0]]; + $newString[0] = []; + + // Fill the character class with the prefix of each string in this group before removing + // the original string + foreach ($keys as $key) + { + $newString[0][] = [$strings[$key][0]]; + unset($strings[$key]); + } + $newStrings[] = $newString; + } + + return array_merge($newStrings, $strings); + } + + /** + * Filter the list of eligible keys and keep those that have at least two matches + * + * @param array[] $eligibleKeys List of lists of keys + * @return array[] + */ + protected function filterEligibleKeys(array $eligibleKeys) + { + $filteredKeys = []; + foreach ($eligibleKeys as $k => $keys) + { + if (count($keys) > 1) + { + $filteredKeys[] = $keys; + } + } + + return $filteredKeys; + } + + /** + * Get a list of keys of strings eligible to be merged together, grouped by suffix + * + * @param array[] $strings + * @return array[] + */ + protected function getEligibleKeys(array $strings) + { + $eligibleKeys = []; + foreach ($strings as $k => $string) + { + if (!is_array($string[0]) && isset($string[1])) + { + $suffix = serialize(array_slice($string, 1)); + $eligibleKeys[$suffix][] = $k; + } + } + + return $this->filterEligibleKeys($eligibleKeys); + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Passes/GroupSingleCharacters.php b/vendor/s9e/regexp-builder/src/Passes/GroupSingleCharacters.php new file mode 100644 index 0000000..a065e43 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Passes/GroupSingleCharacters.php @@ -0,0 +1,42 @@ +getSingleCharStrings($strings); + $cnt = count($singles); + if ($cnt > 1 && $cnt < count($strings)) + { + // Remove the singles from the input, then prepend them as a new string + $strings = array_diff_key($strings, $singles); + array_unshift($strings, [array_values($singles)]); + } + + return $strings; + } + + /** + * Return an array of every single-char string in given list of strings + * + * @param array[] $strings + * @return array[] + */ + protected function getSingleCharStrings(array $strings) + { + return array_filter($strings, [$this, 'isSingleCharString']); + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Passes/MergePrefix.php b/vendor/s9e/regexp-builder/src/Passes/MergePrefix.php new file mode 100644 index 0000000..cad79bc --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Passes/MergePrefix.php @@ -0,0 +1,104 @@ +getStringsByPrefix($strings) as $prefix => $strings) + { + $newStrings[] = (isset($strings[1])) ? $this->mergeStrings($strings) : $strings[0]; + } + + return $newStrings; + } + + /** + * Get the number of leading elements common to all given strings + * + * @param array[] $strings + * @return integer + */ + protected function getPrefixLength(array $strings) + { + $len = 1; + $cnt = count($strings[0]); + while ($len < $cnt && $this->stringsMatch($strings, $len)) + { + ++$len; + } + + return $len; + } + + /** + * Return given strings grouped by their first element + * + * NOTE: assumes that this pass is run before the first element of any string could be replaced + * + * @param array[] $strings + * @return array[] + */ + protected function getStringsByPrefix(array $strings) + { + $byPrefix = []; + foreach ($strings as $string) + { + $byPrefix[$string[0]][] = $string; + } + + return $byPrefix; + } + + /** + * Merge given strings into a new single string + * + * @param array[] $strings + * @return array + */ + protected function mergeStrings(array $strings) + { + $len = $this->getPrefixLength($strings); + $newString = array_slice($strings[0], 0, $len); + foreach ($strings as $string) + { + $newString[$len][] = array_slice($string, $len); + } + + return $newString; + } + + /** + * Test whether all given strings' elements match at given position + * + * @param array[] $strings + * @param integer $pos + * @return bool + */ + protected function stringsMatch(array $strings, $pos) + { + $value = $strings[0][$pos]; + foreach ($strings as $string) + { + if (!isset($string[$pos]) || $string[$pos] !== $value) + { + return false; + } + } + + return true; + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Passes/MergeSuffix.php b/vendor/s9e/regexp-builder/src/Passes/MergeSuffix.php new file mode 100644 index 0000000..5acbe85 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Passes/MergeSuffix.php @@ -0,0 +1,83 @@ + 1 && $this->hasMatchingSuffix($strings)); + } + + /** + * {@inheritdoc} + */ + protected function runPass(array $strings) + { + $newString = []; + while ($this->hasMatchingSuffix($strings)) + { + array_unshift($newString, end($strings[0])); + $strings = $this->pop($strings); + } + array_unshift($newString, $strings); + + return [$newString]; + } + + /** + * Test whether all given strings have the same last element + * + * @param array[] $strings + * @return bool + */ + protected function hasMatchingSuffix(array $strings) + { + $suffix = end($strings[1]); + foreach ($strings as $string) + { + if (end($string) !== $suffix) + { + return false; + } + } + + return ($suffix !== false); + } + + /** + * Remove the last element of every string + * + * @param array[] $strings Original strings + * @return array[] Processed strings + */ + protected function pop(array $strings) + { + $cnt = count($strings); + $i = $cnt; + while (--$i >= 0) + { + array_pop($strings[$i]); + } + + // Remove empty elements then prepend one back at the start of the array if applicable + $strings = array_filter($strings); + if (count($strings) < $cnt) + { + array_unshift($strings, []); + } + + return $strings; + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Passes/PassInterface.php b/vendor/s9e/regexp-builder/src/Passes/PassInterface.php new file mode 100644 index 0000000..6a15023 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Passes/PassInterface.php @@ -0,0 +1,19 @@ +runner = $runner; + } + + /** + * {@inheritdoc} + */ + protected function runPass(array $strings) + { + return array_map([$this, 'recurseString'], $strings); + } + + /** + * Recurse into given string and run all passes on each element + * + * @param array $string + * @return array + */ + protected function recurseString(array $string) + { + $isOptional = $this->isOptional; + foreach ($string as $k => $element) + { + if (is_array($element)) + { + $string[$k] = $this->runner->run($element); + } + } + $this->isOptional = $isOptional; + + return $string; + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Runner.php b/vendor/s9e/regexp-builder/src/Runner.php new file mode 100644 index 0000000..b0456fb --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Runner.php @@ -0,0 +1,45 @@ +passes[] = $pass; + } + + /** + * Run all passes on the list of strings + * + * @param array[] $strings + * @return array[] + */ + public function run(array $strings) + { + foreach ($this->passes as $pass) + { + $strings = $pass->run($strings); + } + + return $strings; + } +} \ No newline at end of file diff --git a/vendor/s9e/regexp-builder/src/Serializer.php b/vendor/s9e/regexp-builder/src/Serializer.php new file mode 100644 index 0000000..2ec3907 --- /dev/null +++ b/vendor/s9e/regexp-builder/src/Serializer.php @@ -0,0 +1,279 @@ +escaper = $escaper; + $this->meta = $meta; + $this->output = $output; + } + + /** + * Serialize given strings into a regular expression + * + * @param array[] $strings + * @return string + */ + public function serializeStrings(array $strings) + { + $info = $this->analyzeStrings($strings); + $alternations = array_map([$this, 'serializeString'], $info['strings']); + if (!empty($info['chars'])) + { + // Prepend the character class to the list of alternations + array_unshift($alternations, $this->serializeCharacterClass($info['chars'])); + } + + $expr = implode('|', $alternations); + if ($this->needsParentheses($info)) + { + $expr = '(?:' . $expr . ')'; + } + + return $expr . $info['quantifier']; + } + + /** + * Analyze given strings to determine how to serialize them + * + * The returned array may contains any of the following elements: + * + * - (string) quantifier Either '' or '?' + * - (array) chars List of values from single-char strings + * - (array) strings List of multi-char strings + * + * @param array[] $strings + * @return array + */ + protected function analyzeStrings(array $strings) + { + $info = ['alternationsCount' => 0, 'quantifier' => '']; + if ($strings[0] === []) + { + $info['quantifier'] = '?'; + unset($strings[0]); + } + + $chars = $this->getChars($strings); + if (count($chars) > 1) + { + ++$info['alternationsCount']; + $info['chars'] = array_values($chars); + $strings = array_diff_key($strings, $chars); + } + + $info['strings'] = array_values($strings); + $info['alternationsCount'] += count($strings); + + return $info; + } + + /** + * Return the portion of strings that are composed of a single character + * + * @param array[] + * @return array String key => value + */ + protected function getChars(array $strings) + { + $chars = []; + foreach ($strings as $k => $string) + { + if ($this->isChar($string)) + { + $chars[$k] = $string[0]; + } + } + + return $chars; + } + + /** + * Get the list of ranges that cover all given values + * + * @param integer[] $values Ordered list of values + * @return array[] List of ranges in the form [start, end] + */ + protected function getRanges(array $values) + { + $i = 0; + $cnt = count($values); + $start = $values[0]; + $end = $start; + $ranges = []; + while (++$i < $cnt) + { + if ($values[$i] === $end + 1) + { + ++$end; + } + else + { + $ranges[] = [$start, $end]; + $start = $end = $values[$i]; + } + } + $ranges[] = [$start, $end]; + + return $ranges; + } + + /** + * Test whether given string represents a single character + * + * @param array $string + * @return bool + */ + protected function isChar(array $string) + { + return count($string) === 1 && is_int($string[0]) && MetaCharacters::isChar($string[0]); + } + + /** + * Test whether an expression is quantifiable based on the strings info + * + * @param array $info + * @return bool + */ + protected function isQuantifiable(array $info) + { + $strings = $info['strings']; + + return empty($strings) || $this->isSingleQuantifiableString($strings); + } + + /** + * Test whether a list of strings contains only one single quantifiable string + * + * @param array[] $strings + * @return bool + */ + protected function isSingleQuantifiableString(array $strings) + { + return count($strings) === 1 && count($strings[0]) === 1 && MetaCharacters::isQuantifiable($strings[0][0]); + } + + /** + * Test whether an expression needs parentheses based on the strings info + * + * @param array $info + * @return bool + */ + protected function needsParentheses(array $info) + { + return ($info['alternationsCount'] > 1 || ($info['quantifier'] && !$this->isQuantifiable($info))); + } + + /** + * Serialize a given list of values into a character class + * + * @param integer[] $values + * @return string + */ + protected function serializeCharacterClass(array $values) + { + $expr = '['; + foreach ($this->getRanges($values) as list($start, $end)) + { + $expr .= $this->serializeCharacterClassUnit($start); + if ($end > $start) + { + if ($end > $start + 1) + { + $expr .= '-'; + } + $expr .= $this->serializeCharacterClassUnit($end); + } + } + $expr .= ']'; + + return $expr; + } + + /** + * Serialize a given value to be used in a character class + * + * @param integer $value + * @return string + */ + protected function serializeCharacterClassUnit($value) + { + return $this->serializeValue($value, 'escapeCharacterClass'); + } + + /** + * Serialize an element from a string + * + * @param array|integer $element + * @return string + */ + protected function serializeElement($element) + { + return (is_array($element)) ? $this->serializeStrings($element) : $this->serializeLiteral($element); + } + + /** + * Serialize a given value to be used as a literal + * + * @param integer $value + * @return string + */ + protected function serializeLiteral($value) + { + return $this->serializeValue($value, 'escapeLiteral'); + } + + /** + * Serialize a given string into a regular expression + * + * @param array $string + * @return string + */ + protected function serializeString(array $string) + { + return implode('', array_map([$this, 'serializeElement'], $string)); + } + + /** + * Serialize a given value + * + * @param integer $value + * @param string $escapeMethod + * @return string + */ + protected function serializeValue($value, $escapeMethod) + { + return ($value < 0) ? $this->meta->getExpression($value) : $this->escaper->$escapeMethod($this->output->output($value)); + } +} \ No newline at end of file diff --git a/vendor/s9e/text-formatter/composer.json b/vendor/s9e/text-formatter/composer.json index ba485df..f58c39e 100644 --- a/vendor/s9e/text-formatter/composer.json +++ b/vendor/s9e/text-formatter/composer.json @@ -6,15 +6,15 @@ "keywords": ["bbcode","bbcodes","blog","censor","embed","emoji","emoticons","engine","forum","html","markdown","markup","media","parser","shortcodes"], "license": "MIT", "require": { - "php": ">=5.4.7", + "php": ">=7.1", "ext-dom": "*", "ext-filter": "*", - "lib-pcre": ">=7.2" + "lib-pcre": ">=8.13", + "s9e/regexp-builder": "^1.4" }, "require-dev": { - "matthiasmullie/minify": "*", - "php-coveralls/php-coveralls": "*", - "s9e/regexp-builder": "1.*" + "matthiasmullie/minify": "*", + "phpunit/phpunit": "^7 || 8.2.*" }, "suggest": { "ext-curl": "Improves the performance of the MediaEmbed plugin and some JavaScript minifiers", @@ -34,5 +34,8 @@ "psr-4": { "s9e\\TextFormatter\\Tests\\": "tests" } + }, + "extra": { + "version": "2.3.1" } -} \ No newline at end of file +} diff --git a/vendor/s9e/text-formatter/src/Bundle.php b/vendor/s9e/text-formatter/src/Bundle.php index b4aad10..7bfbb5e 100644 --- a/vendor/s9e/text-formatter/src/Bundle.php +++ b/vendor/s9e/text-formatter/src/Bundle.php @@ -1,58 +1,153 @@ parse($text); + if (isset(static::$afterParse)) - $xml = \call_user_func(static::$afterParse, $xml); + { + $xml = call_user_func(static::$afterParse, $xml); + } + return $xml; } + + /** + * Render an intermediate representation using a singleton instance of the bundled Renderer + * + * @param string $xml Intermediate representation + * @param array $params Stylesheet parameters + * @return string Rendered result + */ public static function render($xml, array $params = []) { $renderer = static::getCachedRenderer(); + if (!empty($params)) + { $renderer->setParameters($params); + } + if (isset(static::$beforeRender)) - $xml = \call_user_func(static::$beforeRender, $xml); + { + $xml = call_user_func(static::$beforeRender, $xml); + } + $output = $renderer->render($xml); + if (isset(static::$afterRender)) - $output = \call_user_func(static::$afterRender, $output); + { + $output = call_user_func(static::$afterRender, $output); + } + return $output; } + + /** + * Reset the cached parser and renderer + * + * @return void + */ public static function reset() { - static::$parser = \null; - static::$renderer = \null; + static::$parser = null; + static::$renderer = null; } + + /** + * Transform an intermediate representation back to its original form + * + * @param string $xml Intermediate representation + * @return string Original text + */ public static function unparse($xml) { if (isset(static::$beforeUnparse)) - $xml = \call_user_func(static::$beforeUnparse, $xml); + { + $xml = call_user_func(static::$beforeUnparse, $xml); + } + $text = Unparser::unparse($xml); + if (isset(static::$afterUnparse)) - $text = \call_user_func(static::$afterUnparse, $text); + { + $text = call_user_func(static::$afterUnparse, $text); + } + return $text; } } \ No newline at end of file diff --git a/vendor/s9e/text-formatter/src/Bundles/Fatdown.php b/vendor/s9e/text-formatter/src/Bundles/Fatdown.php index b76c37f..4c0bf68 100644 --- a/vendor/s9e/text-formatter/src/Bundles/Fatdown.php +++ b/vendor/s9e/text-formatter/src/Bundles/Fatdown.php @@ -1,21 +1,120 @@ $aBANDCAMP"><$t$ibandcamp"$k$g400px"><$t$k$c100%">$h$k$f><$l$psrc">//bandcamp.com/EmbeddedPlayer/size=large/minimal=true/<$q><$r$m@album_id">album=$b@album_id"/><$s$m@track_num">/t=$b@track_num"/><$o>track=$b@track_id"/>$d$aC">$e$d$aCODE">
      <$s$m@lang"><$l$pclass">language-$b@lang"/>$e
      $d$aDAILYMOTION"><$t$idailymotion"$k$g640px"><$t$k$c56.25%">$h$k$f><$l$psrc">//www.dailymotion.com/embed/video/$b@id"/><$s$m@t">?start=$b@t"/>$d$aDEL|EM|H1|H2|H3|H4|H5|H6|LI|STRONG|SUB|SUP|TABLE|TBODY|THEAD|TR|html:b|html:br|html:code|html:dd|html:del|html:dl|html:dt|html:i|html:ins|html:li|html:ol|html:pre|html:rb|html:rp|html:rt|html:rtc|html:ruby|html:strong|html:sub|html:sup|html:table|html:tbody|html:tfoot|html:thead|html:tr|html:u|html:ul|p">$e$d$aEMAIL">$e$d$aESC">$e$d$aFACEBOOK">$d$aFP|HE">$b@char"/>$d$aHC">$b@content"/>$d$aHR">
      $d$aIMG">$jalt|@title"/>$d$aISPOILER"><$t class="spoiler"$nstyle" onclick="removeAttribute(\\\'style\\\')"$kbackground:#444;color:transparent">$e$d$aLIST"><$q><$r$mnot(@type)">
        $e
      <$o>
        $jstart"/>$e
      $d$aLIVELEAK"><$t$iliveleak"$k$g640px"><$t$k$c56.25%">$h src="//www.liveleak.com/e/{@id}"$k$f/>$d$aQUOTE">
      $e
      $d$aSOUNDCLOUD"><$l$psrc">https://w.soundcloud.com/player/?url=<$q><$r$m$w">https%3A//api.soundcloud.com/playlists/$b$w"/><$r$m@track_id">https%3A//api.soundcloud.com/tracks/$b@track_id"/>&secret_token=$b@secret_token"/><$o><$s$mnot(contains(@id,\\\'://\\\'))">https%3A//soundcloud.com/$b@id"/><$l$pstyle">border:0;height:<$q><$r$m$w or contains(@id,\\\'/sets/\\\')">450<$o>166px;max-width:900px;width:100%$d$aSPOILER">
      $e
      $d$aSPOTIFY"><$t$ispotify"$k$g400px"><$t$k$c100%">$d$aURL">$jtitle"/>$e$d$aVIMEO"><$t$ivimeo"$k$g640px"><$t$k$c56.25%">$h$k$f><$l$psrc">//player.vimeo.com/video/$b@id"/><$s$m@t">#t=$b@t"/>$d$aVINE"><$t$ivine"$k$g480px"><$t$k$c100%">$h src="https://vine.co/v/{@id}/embed/simple?audio=1"$k$f/>$d$aYOUTUBE"><$t$iyoutube"$k$g640px"><$t$k$c56.25%">$h$kbackground:url(https://i.ytimg.com/vi/{@id}/hqdefault.jpg) 50% 50% / cover;$f><$l$psrc">https://www.youtube.com/embed/$b@id"/><$s$m@list">?list=$b@list"/><$s$m@t"><$q><$r$m@list">&<$o>?start=$b@t"/>$d$abr">
      $d$ae|i|s"/>$ahtml:abbr">$jtitle"/>$e$d$ahtml:div">
      $jclass"/>$e
      $d$ahtml:img">$jalt|@height|@src|@title|@width"/>$e$d$ahtml:$t"><$t>$jclass"/>$e$d$ahtml:td">$jcol$t|@row$t"/>$e$d$ahtml:th">$jcol$t|@row$t|@scope"/>$e$d\'.replace(/\\$[a-w]/g, +function(a){return{$a:\'",$e:"",$f:\'border:0;height:100%;left:0;position:absolute;width:100%"\',$g:"display:inline-block;width:100%;max-width:",$h:\'';break;case'C':case'html:code':$this->out.='';$this->at($node);$this->out.='';break;case'CODE':$this->out.='
      hasAttribute('lang'))$this->out.=' class="language-'.\htmlspecialchars($node->getAttribute('lang'),2).'"';$this->out.='>';$this->at($node);$this->out.='
      ';break;case'DAILYMOTION':$this->out.='';break;case'DEL':case'html:del':$this->out.='';$this->at($node);$this->out.='';break;case'EM':$this->out.='';$this->at($node);$this->out.='';break;case'EMAIL':$this->out.='';$this->at($node);$this->out.='';break;case'ESC':$this->at($node);break;case'FACEBOOK':$this->out.='';break;case'FP':case'HE':$this->out.=\htmlspecialchars($node->getAttribute('char'),0);break;case'H1':$this->out.='

      ';$this->at($node);$this->out.='

      ';break;case'H2':$this->out.='

      ';$this->at($node);$this->out.='

      ';break;case'H3':$this->out.='

      ';$this->at($node);$this->out.='

      ';break;case'H4':$this->out.='

      ';$this->at($node);$this->out.='

      ';break;case'H5':$this->out.='
      ';$this->at($node);$this->out.='
      ';break;case'H6':$this->out.='
      ';$this->at($node);$this->out.='
      ';break;case'HC':$this->out.='';break;case'HR':$this->out.='
      ';break;case'IMG':$this->out.='hasAttribute('alt'))$this->out.=' alt="'.\htmlspecialchars($node->getAttribute('alt'),2).'"';if($node->hasAttribute('title'))$this->out.=' title="'.\htmlspecialchars($node->getAttribute('title'),2).'"';$this->out.='>';break;case'LI':case'html:li':$this->out.='
    1. ';$this->at($node);$this->out.='
    2. ';break;case'LIST':if(!$node->hasAttribute('type')){$this->out.='
        ';$this->at($node);$this->out.='
      ';}else{$this->out.='hasAttribute('start'))$this->out.=' start="'.\htmlspecialchars($node->getAttribute('start'),2).'"';$this->out.='>';$this->at($node);$this->out.='
    ';}break;case'LIVELEAK':$this->out.='';break;case'QUOTE':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'SOUNDCLOUD':$this->out.='';break;case'SPOTIFY':$this->out.='';break;case'STRONG':case'html:strong':$this->out.='';$this->at($node);$this->out.='';break;case'SUB':case'html:sub':$this->out.='';$this->at($node);$this->out.='';break;case'SUP':case'html:sup':$this->out.='';$this->at($node);$this->out.='';break;case'TABLE':case'html:table':$this->out.='';$this->at($node);$this->out.='
    ';break;case'TBODY':case'html:tbody':$this->out.='';$this->at($node);$this->out.='';break;case'TD':$this->out.='hasAttribute('align'))$this->out.=' style="text-align:'.\htmlspecialchars($node->getAttribute('align'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'TH':$this->out.='hasAttribute('align'))$this->out.=' style="text-align:'.\htmlspecialchars($node->getAttribute('align'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'THEAD':case'html:thead':$this->out.='';$this->at($node);$this->out.='';break;case'TR':case'html:tr':$this->out.='';$this->at($node);$this->out.='';break;case'TWITCH':$this->out.='';break;case'URL':$this->out.='hasAttribute('title'))$this->out.=' title="'.\htmlspecialchars($node->getAttribute('title'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'VIMEO':$this->out.='';break;case'VINE':$this->out.='';break;case'YOUTUBE':$this->out.='';break;case'br':case'html:br':$this->out.='
    ';break;case'e':case'i':case's':break;case'html:abbr':$this->out.='hasAttribute('title'))$this->out.=' title="'.\htmlspecialchars($node->getAttribute('title'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'html:b':$this->out.='';$this->at($node);$this->out.='';break;case'html:dd':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'html:div':$this->out.='hasAttribute('class'))$this->out.=' class="'.\htmlspecialchars($node->getAttribute('class'),2).'"';$this->out.='>';$this->at($node);$this->out.='
    ';break;case'html:dl':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'html:dt':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'html:i':$this->out.='';$this->at($node);$this->out.='';break;case'html:img':$this->out.='hasAttribute('alt'))$this->out.=' alt="'.\htmlspecialchars($node->getAttribute('alt'),2).'"';if($node->hasAttribute('height'))$this->out.=' height="'.\htmlspecialchars($node->getAttribute('height'),2).'"';if($node->hasAttribute('src'))$this->out.=' src="'.\htmlspecialchars($node->getAttribute('src'),2).'"';if($node->hasAttribute('title'))$this->out.=' title="'.\htmlspecialchars($node->getAttribute('title'),2).'"';if($node->hasAttribute('width'))$this->out.=' width="'.\htmlspecialchars($node->getAttribute('width'),2).'"';$this->out.='>';break;case'html:ins':$this->out.='';$this->at($node);$this->out.='';break;case'html:ol':$this->out.='
      ';$this->at($node);$this->out.='
    ';break;case'html:pre':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'html:rb':$this->out.='';$this->at($node);$this->out.='';break;case'html:rp':$this->out.='';$this->at($node);$this->out.='';break;case'html:rt':$this->out.='';$this->at($node);$this->out.='';break;case'html:rtc':$this->out.='';$this->at($node);$this->out.='';break;case'html:ruby':$this->out.='';$this->at($node);$this->out.='';break;case'html:span':$this->out.='hasAttribute('class'))$this->out.=' class="'.\htmlspecialchars($node->getAttribute('class'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'html:td':$this->out.='hasAttribute('colspan'))$this->out.=' colspan="'.\htmlspecialchars($node->getAttribute('colspan'),2).'"';if($node->hasAttribute('rowspan'))$this->out.=' rowspan="'.\htmlspecialchars($node->getAttribute('rowspan'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'html:tfoot':$this->out.='';$this->at($node);$this->out.='';break;case'html:th':$this->out.='hasAttribute('colspan'))$this->out.=' colspan="'.\htmlspecialchars($node->getAttribute('colspan'),2).'"';if($node->hasAttribute('rowspan'))$this->out.=' rowspan="'.\htmlspecialchars($node->getAttribute('rowspan'),2).'"';if($node->hasAttribute('scope'))$this->out.=' scope="'.\htmlspecialchars($node->getAttribute('scope'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'html:u':$this->out.='';$this->at($node);$this->out.='';break;case'html:ul':$this->out.='
      ';$this->at($node);$this->out.='
    ';break;case'p':$this->out.='

    ';$this->at($node);$this->out.='

    ';break;default:$this->at($node);} + switch($node->nodeName){case'BANDCAMP':$this->out.='';break;case'C':case'html:code':$this->out.='';$this->at($node);$this->out.='';break;case'CODE':$this->out.='
    hasAttribute('lang'))$this->out.=' class="language-'.htmlspecialchars($node->getAttribute('lang'),2).'"';$this->out.='>';$this->at($node);$this->out.='
    ';break;case'DAILYMOTION':$this->out.='';break;case'DEL':case'html:del':$this->out.='';$this->at($node);$this->out.='';break;case'EM':$this->out.='';$this->at($node);$this->out.='';break;case'EMAIL':$this->out.='';$this->at($node);$this->out.='';break;case'ESC':$this->at($node);break;case'FACEBOOK':$this->out.='';break;case'FP':case'HE':$this->out.=htmlspecialchars($node->getAttribute('char'),0);break;case'H1':$this->out.='

    ';$this->at($node);$this->out.='

    ';break;case'H2':$this->out.='

    ';$this->at($node);$this->out.='

    ';break;case'H3':$this->out.='

    ';$this->at($node);$this->out.='

    ';break;case'H4':$this->out.='

    ';$this->at($node);$this->out.='

    ';break;case'H5':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'H6':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'HC':$this->out.='';break;case'HR':$this->out.='
    ';break;case'IMG':$this->out.='hasAttribute('alt'))$this->out.=' alt="'.htmlspecialchars($node->getAttribute('alt'),2).'"';if($node->hasAttribute('title'))$this->out.=' title="'.htmlspecialchars($node->getAttribute('title'),2).'"';$this->out.='>';break;case'ISPOILER':$this->out.='';$this->at($node);$this->out.='';break;case'LI':case'html:li':$this->out.='
  • ';$this->at($node);$this->out.='
  • ';break;case'LIST':if(!$node->hasAttribute('type')){$this->out.='
      ';$this->at($node);$this->out.='
    ';}else{$this->out.='hasAttribute('start'))$this->out.=' start="'.htmlspecialchars($node->getAttribute('start'),2).'"';$this->out.='>';$this->at($node);$this->out.='';}break;case'LIVELEAK':$this->out.='';break;case'QUOTE':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'SOUNDCLOUD':$this->out.='';break;case'SPOILER':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'SPOTIFY':$this->out.='';break;case'STRONG':case'html:strong':$this->out.='';$this->at($node);$this->out.='';break;case'SUB':case'html:sub':$this->out.='';$this->at($node);$this->out.='';break;case'SUP':case'html:sup':$this->out.='';$this->at($node);$this->out.='';break;case'TABLE':case'html:table':$this->out.='';$this->at($node);$this->out.='
    ';break;case'TBODY':case'html:tbody':$this->out.='';$this->at($node);$this->out.='';break;case'TD':$this->out.='hasAttribute('align'))$this->out.=' style="text-align:'.htmlspecialchars($node->getAttribute('align'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'TH':$this->out.='hasAttribute('align'))$this->out.=' style="text-align:'.htmlspecialchars($node->getAttribute('align'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'THEAD':case'html:thead':$this->out.='';$this->at($node);$this->out.='';break;case'TR':case'html:tr':$this->out.='';$this->at($node);$this->out.='';break;case'TWITCH':$this->out.='';break;case'URL':$this->out.='hasAttribute('title'))$this->out.=' title="'.htmlspecialchars($node->getAttribute('title'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'VIMEO':$this->out.='';break;case'VINE':$this->out.='';break;case'YOUTUBE':$this->out.='';break;case'br':case'html:br':$this->out.='
    ';break;case'e':case'i':case's':break;case'html:abbr':$this->out.='hasAttribute('title'))$this->out.=' title="'.htmlspecialchars($node->getAttribute('title'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'html:b':$this->out.='';$this->at($node);$this->out.='';break;case'html:dd':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'html:div':$this->out.='hasAttribute('class'))$this->out.=' class="'.htmlspecialchars($node->getAttribute('class'),2).'"';$this->out.='>';$this->at($node);$this->out.='
    ';break;case'html:dl':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'html:dt':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'html:i':$this->out.='';$this->at($node);$this->out.='';break;case'html:img':$this->out.='hasAttribute('alt'))$this->out.=' alt="'.htmlspecialchars($node->getAttribute('alt'),2).'"';if($node->hasAttribute('height'))$this->out.=' height="'.htmlspecialchars($node->getAttribute('height'),2).'"';if($node->hasAttribute('src'))$this->out.=' src="'.htmlspecialchars($node->getAttribute('src'),2).'"';if($node->hasAttribute('title'))$this->out.=' title="'.htmlspecialchars($node->getAttribute('title'),2).'"';if($node->hasAttribute('width'))$this->out.=' width="'.htmlspecialchars($node->getAttribute('width'),2).'"';$this->out.='>';break;case'html:ins':$this->out.='';$this->at($node);$this->out.='';break;case'html:ol':$this->out.='
      ';$this->at($node);$this->out.='
    ';break;case'html:pre':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'html:rb':$this->out.='';$this->at($node);$this->out.='';break;case'html:rp':$this->out.='';$this->at($node);$this->out.='';break;case'html:rt':$this->out.='';$this->at($node);$this->out.='';break;case'html:rtc':$this->out.='';$this->at($node);$this->out.='';break;case'html:ruby':$this->out.='';$this->at($node);$this->out.='';break;case'html:span':$this->out.='hasAttribute('class'))$this->out.=' class="'.htmlspecialchars($node->getAttribute('class'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'html:td':$this->out.='hasAttribute('colspan'))$this->out.=' colspan="'.htmlspecialchars($node->getAttribute('colspan'),2).'"';if($node->hasAttribute('rowspan'))$this->out.=' rowspan="'.htmlspecialchars($node->getAttribute('rowspan'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'html:tfoot':$this->out.='';$this->at($node);$this->out.='';break;case'html:th':$this->out.='hasAttribute('colspan'))$this->out.=' colspan="'.htmlspecialchars($node->getAttribute('colspan'),2).'"';if($node->hasAttribute('rowspan'))$this->out.=' rowspan="'.htmlspecialchars($node->getAttribute('rowspan'),2).'"';if($node->hasAttribute('scope'))$this->out.=' scope="'.htmlspecialchars($node->getAttribute('scope'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'html:u':$this->out.='';$this->at($node);$this->out.='';break;case'html:ul':$this->out.='
      ';$this->at($node);$this->out.='
    ';break;case'p':$this->out.='

    ';$this->at($node);$this->out.='

    ';break;default:$this->at($node);} } - public $enableQuickRenderer=\true; - protected $static=['/C'=>'','/CODE'=>'','/DEL'=>'','/EM'=>'','/EMAIL'=>'','/ESC'=>'','/H1'=>'','/H2'=>'','/H3'=>'','/H4'=>'','/H5'=>'','/H6'=>'','/LI'=>'','/QUOTE'=>'','/STRONG'=>'
    ','/SUB'=>'','/SUP'=>'','/TABLE'=>'','/TBODY'=>'','/TD'=>'','/TH'=>'','/THEAD'=>'','/TR'=>'','/URL'=>'','/html:abbr'=>'','/html:b'=>'','/html:code'=>'','/html:dd'=>'','/html:del'=>'','/html:div'=>'
    ','/html:dl'=>'','/html:dt'=>'','/html:i'=>'','/html:ins'=>'','/html:li'=>'','/html:ol'=>'','/html:pre'=>'','/html:rb'=>'','/html:rp'=>'','/html:rt'=>'','/html:rtc'=>'','/html:ruby'=>'','/html:span'=>'','/html:strong'=>'','/html:sub'=>'','/html:sup'=>'','/html:table'=>'','/html:tbody'=>'','/html:td'=>'','/html:tfoot'=>'','/html:th'=>'','/html:thead'=>'','/html:tr'=>'','/html:u'=>'','/html:ul'=>'','C'=>'','DEL'=>'','EM'=>'','ESC'=>'','H1'=>'

    ','H2'=>'

    ','H3'=>'

    ','H4'=>'

    ','H5'=>'

    ','H6'=>'
    ','HR'=>'
    ','LI'=>'
  • ','QUOTE'=>'
    ','STRONG'=>'','SUB'=>'','SUP'=>'','TABLE'=>'','TBODY'=>'','THEAD'=>'','TR'=>'','html:b'=>'','html:br'=>'
    ','html:code'=>'','html:dd'=>'
    ','html:del'=>'','html:dl'=>'
    ','html:dt'=>'
    ','html:i'=>'','html:ins'=>'','html:li'=>'
  • ','html:ol'=>'
      ','html:pre'=>'
      ','html:rb'=>'','html:rp'=>'','html:rt'=>'','html:rtc'=>'','html:ruby'=>'','html:strong'=>'','html:sub'=>'','html:sup'=>'','html:table'=>'
  • ','html:tbody'=>'','html:tfoot'=>'','html:thead'=>'','html:tr'=>'','html:u'=>'','html:ul'=>'
    ','/TBODY'=>'','/TD'=>'','/TH'=>'','/THEAD'=>'','/TR'=>'','/URL'=>'','/html:abbr'=>'','/html:b'=>'','/html:code'=>'
    ','/html:dd'=>'','/html:del'=>'','/html:div'=>'
  • ','/html:dl'=>'','/html:dt'=>'','/html:i'=>'','/html:ins'=>'','/html:li'=>'','/html:ol'=>'','/html:pre'=>'','/html:rb'=>'','/html:rp'=>'','/html:rt'=>'','/html:rtc'=>'','/html:ruby'=>'','/html:span'=>'','/html:strong'=>'','/html:sub'=>'','/html:sup'=>'','/html:table'=>'','/html:tbody'=>'','/html:td'=>'','/html:tfoot'=>'','/html:th'=>'','/html:thead'=>'','/html:tr'=>'','/html:u'=>'','/html:ul'=>'','C'=>'','DEL'=>'','EM'=>'','ESC'=>'','H1'=>'

    ','H2'=>'

    ','H3'=>'

    ','H4'=>'

    ','H5'=>'

    ','H6'=>'
    ','HR'=>'
    ','ISPOILER'=>'','LI'=>'
  • ','QUOTE'=>'
    ','SPOILER'=>'
    ','STRONG'=>'','SUB'=>'','SUP'=>'','TABLE'=>'','TBODY'=>'','THEAD'=>'','TR'=>'','html:b'=>'','html:br'=>'
    ','html:code'=>'','html:dd'=>'
    ','html:del'=>'','html:dl'=>'
    ','html:dt'=>'
    ','html:i'=>'','html:ins'=>'','html:li'=>'
  • ','html:ol'=>'
      ','html:pre'=>'
      ','html:rb'=>'','html:rp'=>'','html:rt'=>'','html:rtc'=>'','html:ruby'=>'','html:strong'=>'','html:sub'=>'','html:sup'=>'','html:table'=>'
  • ','html:tbody'=>'','html:tfoot'=>'','html:thead'=>'','html:tr'=>'','html:u'=>'','html:ul'=>'';else$html.='';break;case'BANDCAMP':$attributes+=['track_num'=>\null,'track_id'=>\null];$html.='';break;case'CODE':$html.='
    \null];$html.='';break;case'FACEBOOK':$attributes+=['type'=>\null,'id'=>\null];$html.='';break;case'FP':case'HE':$attributes+=['char'=>\null];$html.=\str_replace('"','"',$attributes['char']);break;case'HC':$attributes+=['content'=>\null];$html.='';break;case'LIST':if(!isset($attributes['type']))$html.='
      ';else{$html.='attributes[]=$attributes;break;case'SOUNDCLOUD':$attributes+=['secret_token'=>\null,'id'=>\null];$html.='';break;case'SPOTIFY':$attributes+=['id'=>\null,'path'=>\null];$html.='';break;case'TD':$html.='\null,'clip_id'=>\null];$html.='';break;case'VIMEO':$attributes+=['id'=>\null];$html.='';break;case'YOUTUBE':$attributes+=['id'=>\null,'t'=>\null];$html.='';} + $html='';switch($id){case'/LIST':$attributes=array_pop($this->attributes);if(!isset($attributes['type']))$html.='
    ';else$html.='';break;case'BANDCAMP':$attributes+=['track_num'=>null,'track_id'=>null];$html.='';break;case'CODE':$html.='
    null];$html.='';break;case'FACEBOOK':$attributes+=['type'=>null,'id'=>null];$html.='';break;case'FP':case'HE':$attributes+=['char'=>null];$html.=str_replace('"','"',$attributes['char']);break;case'HC':$attributes+=['content'=>null];$html.='';break;case'LIST':if(!isset($attributes['type']))$html.='
    ';$this->at($node);$this->out.='
    ';break;case'TD':$this->out.='hasAttribute('colspan'))$this->out.=' colspan="'.\htmlspecialchars($node->getAttribute('colspan'),2).'"';if($node->hasAttribute('rowspan'))$this->out.=' rowspan="'.\htmlspecialchars($node->getAttribute('rowspan'),2).'"';if($node->hasAttribute('align'))$this->out.=' style="text-align:'.\htmlspecialchars($node->getAttribute('align'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'TH':$this->out.='hasAttribute('colspan'))$this->out.=' colspan="'.\htmlspecialchars($node->getAttribute('colspan'),2).'"';if($node->hasAttribute('rowspan'))$this->out.=' rowspan="'.\htmlspecialchars($node->getAttribute('rowspan'),2).'"';if($node->hasAttribute('align'))$this->out.=' style="text-align:'.\htmlspecialchars($node->getAttribute('align'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'TR':$this->out.='';$this->at($node);$this->out.='';break;case'TWITCH':$this->out.='';break;case'TWITTER':$this->out.='';break;case'U':$this->out.='';$this->at($node);$this->out.='';break;case'UL':$this->out.='
      ';$this->at($node);$this->out.='
    ';break;case'URL':$this->out.='hasAttribute('title'))$this->out.=' title="'.\htmlspecialchars($node->getAttribute('title'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'VIMEO':$this->out.='';break;case'VINE':$this->out.='';break;case'WSHH':$this->out.='';break;case'YOUTUBE':$this->out.='';break;case'br':$this->out.='
    ';break;case'e':case'i':case's':break;case'p':$this->out.='

    ';$this->at($node);$this->out.='

    ';break;default:$this->at($node);} + switch($node->nodeName){case'B':$this->out.='';$this->at($node);$this->out.='';break;case'BANDCAMP':$this->out.='';break;case'CENTER':$this->out.='
    ';$this->at($node);$this->out.='
    ';break;case'CODE':$this->out.='
    hasAttribute('lang'))$this->out.=' class="language-'.htmlspecialchars($node->getAttribute('lang'),2).'"';$this->out.='>';$this->at($node);$this->out.='
    ';break;case'COLOR':$this->out.='';$this->at($node);$this->out.='';break;case'DAILYMOTION':$this->out.='';break;case'EMAIL':$this->out.='';$this->at($node);$this->out.='';break;case'EMOJI':$this->out.=''.htmlspecialchars($node->textContent,2).'';break;case'FACEBOOK':$this->out.='';break;case'FONT':$this->out.='';$this->at($node);$this->out.='';break;case'I':$this->out.='';$this->at($node);$this->out.='';break;case'IMG':$this->out.=''.htmlspecialchars($node->getAttribute('alt'),2).'hasAttribute('height'))$this->out.=' height="'.htmlspecialchars($node->getAttribute('height'),2).'"';if($node->hasAttribute('width'))$this->out.=' width="'.htmlspecialchars($node->getAttribute('width'),2).'"';$this->out.='>';break;case'INDIEGOGO':$this->out.='';break;case'INSTAGRAM':$this->out.='';break;case'KICKSTARTER':$this->out.='hasAttribute('video'))$this->out.=' style="display:inline-block;width:100%;max-width:640px">';else$this->out.=' style="display:inline-block;width:100%;max-width:220px">';$this->out.='';break;case'LI':$this->out.='
  • ';$this->at($node);$this->out.='
  • ';break;case'LIST':if(!$node->hasAttribute('type')){$this->out.='
      ';$this->at($node);$this->out.='
    ';}elseif((strpos($node->getAttribute('type'),'decimal')===0)||(strpos($node->getAttribute('type'),'lower')===0)||(strpos($node->getAttribute('type'),'upper')===0)){$this->out.='
      hasAttribute('start'))$this->out.=' start="'.htmlspecialchars($node->getAttribute('start'),2).'"';$this->out.='>';$this->at($node);$this->out.='
    ';}else{$this->out.='
      ';$this->at($node);$this->out.='
    ';}break;case'LIVELEAK':$this->out.='';break;case'OL':$this->out.='
      ';$this->at($node);$this->out.='
    ';break;case'QUOTE':$this->out.='hasAttribute('author'))$this->out.=' class="uncited"';$this->out.='>
    ';if($node->hasAttribute('author'))$this->out.=''.htmlspecialchars($node->getAttribute('author'),0).' '.htmlspecialchars($this->params['L_WROTE'],0).'';$this->at($node);$this->out.='
    ';break;case'S':$this->out.='';$this->at($node);$this->out.='';break;case'SIZE':$this->out.='';$this->at($node);$this->out.='';break;case'SOUNDCLOUD':$this->out.='';break;case'SPOILER':$this->out.='
    '.htmlspecialchars($this->params['L_SPOILER'],0).' '.htmlspecialchars($node->getAttribute('title'),0).'
    ';break;case'TABLE':$this->out.='';$this->at($node);$this->out.='
    ';break;case'TD':$this->out.='hasAttribute('colspan'))$this->out.=' colspan="'.htmlspecialchars($node->getAttribute('colspan'),2).'"';if($node->hasAttribute('rowspan'))$this->out.=' rowspan="'.htmlspecialchars($node->getAttribute('rowspan'),2).'"';if($node->hasAttribute('align'))$this->out.=' style="text-align:'.htmlspecialchars($node->getAttribute('align'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'TH':$this->out.='hasAttribute('colspan'))$this->out.=' colspan="'.htmlspecialchars($node->getAttribute('colspan'),2).'"';if($node->hasAttribute('rowspan'))$this->out.=' rowspan="'.htmlspecialchars($node->getAttribute('rowspan'),2).'"';if($node->hasAttribute('align'))$this->out.=' style="text-align:'.htmlspecialchars($node->getAttribute('align'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'TR':$this->out.='';$this->at($node);$this->out.='';break;case'TWITCH':$this->out.='';break;case'TWITTER':$this->out.='';break;case'U':$this->out.='';$this->at($node);$this->out.='';break;case'UL':$this->out.='
      ';$this->at($node);$this->out.='
    ';break;case'URL':$this->out.='hasAttribute('title'))$this->out.=' title="'.htmlspecialchars($node->getAttribute('title'),2).'"';$this->out.='>';$this->at($node);$this->out.='';break;case'VIMEO':$this->out.='';break;case'VINE':$this->out.='';break;case'WSHH':$this->out.='';break;case'YOUTUBE':$this->out.='';break;case'br':$this->out.='
    ';break;case'e':case'i':case's':break;case'p':$this->out.='

    ';$this->at($node);$this->out.='

    ';break;default:$this->at($node);} } - public $enableQuickRenderer=\true; - protected $static=['/B'=>'
    ','/CENTER'=>'','/CODE'=>'
    ','/COLOR'=>'','/EMAIL'=>'','/FONT'=>'','/I'=>'','/LI'=>'
  • ','/OL'=>'','/QUOTE'=>'','/S'=>'
    ','/SIZE'=>'','/SPOILER'=>'','/TABLE'=>'','/TD'=>'','/TH'=>'','/TR'=>'','/U'=>'','/UL'=>'','/URL'=>'','B'=>'','CENTER'=>'
    ','I'=>'','LI'=>'
  • ','OL'=>'
      ','S'=>'','TABLE'=>'','TR'=>'','U'=>'','UL'=>'
      ','/TD'=>'','/TH'=>'','/TR'=>'','/U'=>'','/UL'=>'','/URL'=>'','B'=>'','CENTER'=>'
      ','I'=>'','LI'=>'
    1. ','OL'=>'
        ','S'=>'','TABLE'=>'','TR'=>'','U'=>'','UL'=>'';elseif((\strpos($attributes['type'],'decimal')===0)||(\strpos($attributes['type'],'lower')===0)||(\strpos($attributes['type'],'upper')===0))$html.='';else$html.='';break;case'BANDCAMP':$attributes+=['track_num'=>\null,'track_id'=>\null];$html.='';break;case'CODE':$html.='
        \null];$html.='';break;case'EMOJI':$attributes+=['seq'=>\null];$textContent=$this->getQuickTextContent($xml);$html.=''.\htmlspecialchars($textContent,2).'';break;case'FACEBOOK':$attributes+=['type'=>\null,'id'=>\null];$html.='';break;case'KICKSTARTER':$attributes+=['id'=>\null];$html.='';else$html.=' style="display:inline-block;width:100%;max-width:220px">';$html.='';break;case'LIST':$attributes+=['type'=>\null];if(!isset($attributes['type']))$html.='
          ';elseif((\strpos($attributes['type'],'decimal')===0)||(\strpos($attributes['type'],'lower')===0)||(\strpos($attributes['type'],'upper')===0)){$html.='
            ';$this->attributes[]=$attributes;break;case'QUOTE':$html.='params['L_WROTE'],0).'';break;case'SOUNDCLOUD':$attributes+=['secret_token'=>\null,'id'=>\null];$html.='';break;case'SPOILER':$attributes+=['title'=>\null];$html.='
            '.\htmlspecialchars($this->params['L_SPOILER'],0).' '.\str_replace('"','"',$attributes['title']).'
        ';elseif((strpos($attributes['type'],'decimal')===0)||(strpos($attributes['type'],'lower')===0)||(strpos($attributes['type'],'upper')===0))$html.='';else$html.='';break;case'BANDCAMP':$attributes+=['track_num'=>null,'track_id'=>null];$html.='';break;case'CODE':$html.='
        null];$html.='';break;case'EMOJI':$attributes+=['tseq'=>null];$textContent=$this->getQuickTextContent($xml);$html.=''.htmlspecialchars($textContent,2).'';break;case'FACEBOOK':$attributes+=['type'=>null,'id'=>null];$html.='';break;case'KICKSTARTER':$attributes+=['id'=>null];$html.='';else$html.=' style="display:inline-block;width:100%;max-width:220px">';$html.='';break;case'LIST':$attributes+=['type'=>null];if(!isset($attributes['type']))$html.='
          ';elseif((strpos($attributes['type'],'decimal')===0)||(strpos($attributes['type'],'lower')===0)||(strpos($attributes['type'],'upper')===0)){$html.='
            ';$this->attributes[]=$attributes;break;case'QUOTE':$html.='params['L_WROTE'],0).'';break;case'SOUNDCLOUD':$attributes+=['secret_token'=>null,'id'=>null];$html.='';break;case'SPOILER':$attributes+=['title'=>null];$html.='
            '.htmlspecialchars($this->params['L_SPOILER'],0).' '.str_replace('"','"',$attributes['title']).'